packages feed

phino-0.0.158: 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.0.gt( 0.0 ).if( 7.0, 7.0 ) )
    𝑛·0·2 := 𝑛·0·1( y ↦ 5.0.gt( 0.0 ).if( 70.0, 70.0 ) )
    𝔼(L_pick):
      𝔻(ξ.x):
        𝕄(ξ.x):
          𝑛·1·1 := 5.0
          𝑛·1·2 := 𝑛·1·1.gt( x ↦ 0.0 )
          𝔼(L_number_gt):
            𝔻(ξ.ρ):
              𝕄(ξ.ρ):
                𝑛·2·1 := 5.0
                morphed 𝑛·2·2 := 𝑛·2·1
              boxed 𝑛·2·3 := 𝑛·2·2.φ
              𝕄(𝑛·2·3):
                𝑛·2·4 := Φ.bytes( φ ↦ 40-14-00-00-00-00-00-00:Δ )
                morphed 𝑛·2·5 := 𝑛·2·4
              boxed 𝑛·2·6 := 𝑛·2·5.φ
              𝛿·2·1 := 40-14-00-00-00-00-00-00  # 5.0
            𝛿1·2 := 𝛿·2·1  # 𝔻(ξ.ρ)
            𝔻(ξ.x):
              𝕄(ξ.x):
                𝑛·2·7 := 0.0
                morphed 𝑛·2·8 := 𝑛·2·7
              boxed 𝑛·2·9 := 𝑛·2·8.φ
              𝕄(𝑛·2·9):
                𝑛·2·10 := Φ.bytes( φ ↦ 00-00-00-00-00-00-00-00:Δ )
                morphed 𝑛·2·11 := 𝑛·2·10
              boxed 𝑛·2·12 := 𝑛·2·11.φ
              𝛿·2·2 := 00-00-00-00-00-00-00-00  # 0.0
            𝛿2·2 := 𝛿·2·2  # 𝔻(ξ.x)
            𝑛·2·13 := Φ.bool( φ ↦ 𝜎1:λ )  # 𝑛
            𝕄(𝑛·2·13):
              𝑛·2·14 := Φ.bool( φ ↦ 𝜎1:λ )
              morphed 𝑛·2·15 := 𝑛·2·14
            𝑛·2·16 := 𝑛·2·15  # 𝕄(𝑛·2·13)
          𝑛·1·3 := 𝑛·2·14.if( then ↦ 7.0 )
          𝑛·1·4 := 𝑛·1·3( else ↦ 7.0 )
          morphed 𝑛·1·5 := 𝑛·1·4
        𝔼(L_fork):
          𝔻(ξ.ρ):
            𝕄(ξ.ρ):
              𝑛·3·1 := Φ.bool( φ ↦ 𝜎1:λ )
              morphed 𝑛·3·2 := 𝑛·2·16
            boxed 𝑛·3·3 := 𝑛·3·2.φ
            𝛿·3·1 := 𝔻(𝜎1:λ)
          𝛿1·3 := 𝛿·3·1  # 𝔻(ξ.ρ)
          𝕄(ξ.then):
            𝑛·3·4 := 7.0
            morphed 𝑛·3·5 := 𝑛·3·4
          𝕄(ξ.else):
            𝑛·3·6 := 7.0
            morphed 𝑛·3·7 := 𝑛·3·6
          𝑛·3·8 := 𝑛·3·7  # 𝕄(ξ.then), 𝕄(ξ.else)
        boxed 𝑛·1·6 := 𝑛·3·8.φ
        𝕄(𝑛·1·6):
          𝑛·1·7 := Φ.bytes( φ ↦ 40-1C-00-00-00-00-00-00:Δ )
          morphed 𝑛·1·8 := 𝑛·1·7
        boxed 𝑛·1·9 := 𝑛·1·8.φ
        𝛿·1·1 := 40-1C-00-00-00-00-00-00  # 7.0
      𝛿1·1 := 𝛿·1·1  # 𝔻(ξ.x)
      𝕄(ξ.y):
        𝑛·1·10 := Φ.number( φ ↦ 𝑛·2·4 )
        𝑛·1·11 := 𝑛·1·10.gt( x ↦ 𝑛·2·7 )
        𝔼(L_number_gt):
          𝑛·4·1 := 𝑛·3·1  # 𝑛
          𝑛·4·2 := 𝑛·2·16  # 𝕄(𝑛·4·1)
        𝑛·1·12 := 𝑛·3·1.if( then ↦ 70.0 )
        𝑛·1·13 := 𝑛·1·12( else ↦ 70.0 )
        morphed 𝑛·1·14 := 𝑛·1·13
      𝑛1·1 := 𝑛·1·13  # 𝕄(ξ.y)
      𝔼(L_fork):  # 𝔼(𝑛1)
        𝔻(ξ.ρ):
          𝕄(ξ.ρ):
            𝑛·5·1 := Φ.bool( φ ↦ 𝜎1:λ )
            morphed 𝑛·5·2 := 𝑛·4·2
          boxed 𝑛·5·3 := 𝑛·5·2.φ
          𝛿·5·1 := 𝔻(𝜎1:λ)
        𝛿1·5 := 𝛿·5·1  # 𝔻(ξ.ρ)
        𝕄(ξ.then):
          𝑛·5·4 := 70.0
          morphed 𝑛·5·5 := 𝑛·5·4
        𝕄(ξ.else):
          𝑛·5·6 := 70.0
          morphed 𝑛·5·7 := 𝑛·5·6
        𝑛·5·8 := 𝑛·5·7  # 𝕄(ξ.then), 𝕄(ξ.else)
      𝑛2·1 := 𝑛·5·8  # 𝔼(𝑛1)
      𝑛·1·15 := 𝑛·5·8  # 𝑛
      𝕄(𝑛·1·15):
        morphed 𝑛·1·16 := 𝑛·5·8
      𝑛·1·17 := 𝑛·1·16  # 𝕄(𝑛·1·15)
    𝑛·0·3 := Φ.bytes( φ ↦ 40-51-80-00-00-00-00-00:Δ )
    morphed 𝑛·0·4 := 𝑛·0·3