packages feed

phino-0.0.157: test-resources/evaluate-packs/answers-its-own-sides-on-a-condition-another-join-read.yaml

# SPDX-FileCopyrightText: Copyright (c) 2025 Objectionary.com
# SPDX-License-Identifier: MIT
---
# yamllint disable rule:line-length
# Two joins on one condition answer each its own sides (#1940). The memo of
# 'plausible' keeps the answer of a firing by the Ξ» name and the operands it
# came down to, and a join reads its sides as well as its condition, so the
# second join, on the condition the first one read, reduces its own sides and
# answers 70 instead of the 7 of the first join.
symbolic: |
  - Ξ»: L_number_gt
    dataize:
      𝛿1: $.ρ
      𝛿2: $.x
    𝑛: Ξ¦.bool( Ο† ↦ ⟦ Ξ» ‍ 𝜎 ⟧ )
  - Ξ»: L_pick
    dataize:
      𝛿1: $.x
    morph:
      𝑛1: $.y
    evaluate:
      𝑛2: 𝑛1
    𝑛: 𝑛2
  - Ξ»: L_fork
    dataize:
      𝛿1: $.ρ
    join:
      on: 𝛿1
      left: $.then
      right: $.else
location: 'Q.@'
acyclic: plausible
input: >
  ⟦ bytes(Ο†) ↦ ⟦⟧,
    bool(Ο†) ↦ ⟦ if ↦ ⟦ ρ ↦ βˆ…, then ↦ βˆ…, else ↦ βˆ…, Ξ» ‍ L_fork ⟧ ⟧,
    number(Ο†) ↦ ⟦ gt(ρ, x) ↦ ⟦ Ξ» ‍ L_number_gt ⟧ ⟧,
    pick(x, y) ↦ ⟦ Ξ» ‍ L_pick ⟧,
    Ο† ↦ Ξ¦.pick( 5.gt( 0 ).if( 7, 7 ), 5.gt( 0 ).if( 70, 70 ) ).Ο† ⟧
result: '⟦ Ο† ↦ ⟦ Ξ” ‍ 40-51-80-00-00-00-00-00 ⟧ ⟧'
protocol: |
  𝕄(Ξ¦.Ο†):
    𝑛·0Β·1 := Ξ¦.pick( x ↦ 5.gt( 0 ).if( 7, 7 ) )
    𝑛·0Β·2 := 𝑛·0Β·1( y ↦ 5.gt( 0 ).if( 70, 70 ) )
    𝔼(L_pick):
      𝔻(Ξ¦.a🌡0):
        𝕄(Ξ¦.a🌡0):
          𝑛·1Β·1 := 5
          𝑛·1Β·2 := 𝑛·1Β·1.gt( x ↦ 0 )
          𝔼(L_number_gt):
            𝔻(Ξ¦.a🌡1):
              𝕄(Ξ¦.a🌡1):
                𝑛·2Β·1 := 5
                𝑛·2Β·2 := Ξ¦.bytes( Ο† ↦ 40-14-00-00-00-00-00-00:Ξ” )
              𝛿·2Β·1 := 40-14-00-00-00-00-00-00  # 5.0
            𝛿1Β·2 := 𝛿·2Β·1  # 𝔻(ΞΎ.ρ)
            𝔻(Ξ¦.a🌡2):
              𝕄(Ξ¦.a🌡2):
                𝑛·2Β·3 := 0
                𝑛·2Β·4 := Ξ¦.bytes( Ο† ↦ 00-00-00-00-00-00-00-00:Ξ” )
              𝛿·2Β·2 := 00-00-00-00-00-00-00-00  # 0.0
            𝛿2Β·2 := 𝛿·2Β·2  # 𝔻(ΞΎ.x)
            𝑛·2Β·5 := Ξ¦.bool( Ο† ↦ 𝜎1:Ξ» )  # 𝑛
            𝕄(𝑛·2Β·5):
              𝑛·2Β·6 := Ξ¦.bool( Ο† ↦ 𝜎1:Ξ» )
            𝑛·2Β·7 := 𝑛·2Β·6  # 𝕄(𝑛·2Β·5)
          𝑛·1Β·3 := 𝑛·2Β·6.if( then ↦ 7 )
          𝑛·1Β·4 := 𝑛·1Β·3( else ↦ 7 )
        𝔼(L_fork):
          𝔻(Ξ¦.a🌡3):
            𝕄(Ξ¦.a🌡3):
              𝑛·3Β·1 := Ξ¦.bool( Ο† ↦ 𝜎1:Ξ» )
          𝛿1Β·3 := 𝔻(𝜎1:Ξ»)  # 𝔻(ΞΎ.ρ)
          𝕄(Ξ¦.a🌡4):
            𝑛·3Β·2 := 7
          𝕄(Ξ¦.a🌡5):
            𝑛·3Β·3 := 7
          𝑛·3Β·4 := 𝑛·3Β·3  # 𝕄(ΞΎ.then), 𝕄(ΞΎ.else)
        𝕄(Ξ¦.a🌡0):
          𝑛·1Β·5 := Ξ¦.bytes( Ο† ↦ 40-1C-00-00-00-00-00-00:Ξ” )
        𝛿·1Β·1 := 40-1C-00-00-00-00-00-00  # 7.0
      𝛿1Β·1 := 𝛿·1Β·1  # 𝔻(ΞΎ.x)
      𝕄(Ξ¦.a🌡6):
        𝑛·1Β·6 := Ξ¦.number( Ο† ↦ 𝑛·2Β·2 )
        𝑛·1Β·7 := 𝑛·1Β·6.gt( x ↦ 𝑛·2Β·3 )
        𝔼(L_number_gt):
          𝑛·4Β·1 := 𝑛·3Β·1  # 𝑛
          𝑛·4Β·2 := 𝑛·2Β·7  # 𝕄(𝑛·4Β·1)
        𝑛·1Β·8 := 𝑛·3Β·1.if( then ↦ 70 )
        𝑛·1Β·9 := 𝑛·1Β·8( else ↦ 70 )
      𝑛1Β·1 := 𝑛·1Β·9  # 𝕄(ΞΎ.y)
      𝔼(L_fork):  # 𝔼(𝑛1)
        𝔻(Ξ¦.a🌡7):
          𝕄(Ξ¦.a🌡7):
            𝑛·5Β·1 := Ξ¦.bool( Ο† ↦ 𝜎1:Ξ» )
        𝛿1Β·5 := 𝔻(𝜎1:Ξ»)  # 𝔻(ΞΎ.ρ)
        𝕄(Ξ¦.a🌡8):
          𝑛·5Β·2 := 70
        𝕄(Ξ¦.a🌡9):
          𝑛·5Β·3 := 70
        𝑛·5Β·4 := 𝑛·5Β·3  # 𝕄(ΞΎ.then), 𝕄(ΞΎ.else)
      𝑛2Β·1 := 𝑛·5Β·3  # 𝔼(𝑛1)
      𝑛·1Β·10 := 𝑛·5Β·3  # 𝑛
      𝑛·1Β·11 := 𝑛·5Β·3  # 𝕄(𝑛·1Β·10)
    𝑛·0Β·3 := Ξ¦.bytes( Ο† ↦ 40-51-80-00-00-00-00-00:Ξ” )