packages feed

phino-0.0.169: test-resources/evaluate-packs/joins-two-sides-that-differ-only-in-symbols.yaml

# SPDX-FileCopyrightText: Copyright (c) 2025 Objectionary.com
# SPDX-License-Identifier: MIT
---
# yamllint disable rule:line-length
# A join brings both of its sides to a normal form through 𝕄 first (#1954).
# Each side here is a call of 'plus' over the answer of another 'plus', which
# 𝕄 fires: 𝜎2 on the left, 𝜎3 on the right, and nothing else tells the two
# sides apart. So the join mints 𝜎4, writes that 𝜎4 is 𝜎2 when the condition
# holds and 𝜎3 when it does not, and answers the joined call, whose ρ holds
# 𝜎4; the last 'plus' reads 𝜎4.
symbolic: |
  - Ξ»: L_number_gt
    dataize:
      𝛿1: $.ρ
      𝛿2: $.x
    𝑛: Ξ¦.bool( Ο† ↦ ⟦ Ξ» ‍ 𝜎 ⟧ )
  - Ξ»: L_number_plus
    dataize:
      𝛿1: $.ρ
      𝛿2: $.x
    𝑛: Ξ¦.number( Ο† ↦ ⟦ Ξ» ‍ 𝜎 ⟧ )
  - Ξ»: L_fork
    dataize:
      𝛿1: $.ρ
    join:
      on: 𝛿1
      left: $.then
      right: $.else
location: 'Q.@'
input: >
  ⟦ bytes(Ο†) ↦ ⟦⟧,
    bool(Ο†) ↦ ⟦ if ↦ ⟦ ρ ↦ βˆ…, then ↦ βˆ…, else ↦ βˆ…, Ξ» ‍ L_fork ⟧ ⟧,
    number(Ο†) ↦ ⟦
      gt(ρ, x) ↦ ⟦ Ξ» ‍ L_number_gt ⟧,
      plus(ρ, x) ↦ ⟦ Ξ» ‍ L_number_plus ⟧ ⟧,
    Ο† ↦ 5.gt( x ↦ 0 ).if( then ↦ 1.plus( x ↦ 2 ).plus( x ↦ 0 ), else ↦ 3.plus( x ↦ 4 ).plus( x ↦ 0 ) ).Ο† ⟧
result: '𝜎5:λ'
protocol: |
  𝕄(Ξ¦.Ο†):
    normalized 𝑛·0Β·1 ≔ ⟦ Ο† ↦ βˆ…, gt(x) ↦ L_number_gt:Ξ», plus(x) ↦ L_number_plus:Ξ» ⟧  # Ξ¦.number
    𝑛·0Β·2 ≔ 5.0
    𝑛·0Β·3 ≔ ⟦ Ο† ↦ Ξ¦.bytes( Ο† ↦ 40-14-00-00-00-00-00-00:Ξ” ), gt(x) ↦ L_number_gt:Ξ», plus(x) ↦ L_number_plus:Ξ» ⟧
    normalized 𝑛·0Β·4 ≔ ⟦ x ↦ βˆ…, Ξ» ‍ L_number_gt ⟧  # 𝑛·0Β·3.gt
    𝑛·0Β·5 ≔ 𝑛·0Β·2.gt( x ↦ 0.0 )
    𝑛·0Β·6 ≔ ⟦ x ↦ 0.0, Ξ» ‍ L_number_gt ⟧
    𝔼(L_number_gt):
      𝔻(ΞΎ.ρ):
        𝕄(ΞΎ.ρ):
          𝑛·1Β·1 ≔ 5.0
          𝑛·1Β·2 ≔ ⟦ Ο† ↦ Ξ¦.bytes( Ο† ↦ 40-14-00-00-00-00-00-00:Ξ” ), gt(x) ↦ L_number_gt:Ξ», plus(x) ↦ L_number_plus:Ξ» ⟧
          morphed 𝑛·1Β·3 ≔ 𝑛·1Β·2
        boxed 𝑛·1Β·4 ≔ 𝑛·1Β·3.Ο†
        normalized 𝑛·1Β·5 ≔ Ξ¦.bytes( Ο† ↦ 40-14-00-00-00-00-00-00:Ξ” )  # 𝑛·1Β·4
        𝕄(𝑛·1Β·4):
          normalized 𝑛·1Β·6 ≔ βˆ…:Ο†  # Ξ¦.bytes
          𝑛·1Β·7 ≔ Ξ¦.bytes( Ο† ↦ 40-14-00-00-00-00-00-00:Ξ” )
          𝑛·1Β·8 ≔ 40-14-00-00-00-00-00-00:Ξ”:Ο†
          morphed 𝑛·1Β·9 ≔ 𝑛·1Β·8
        boxed 𝑛·1Β·10 ≔ 𝑛·1Β·9.Ο†
        normalized 𝑛·1Β·11 ≔ 40-14-00-00-00-00-00-00:Ξ”  # 𝑛·1Β·10
        𝛿·1Β·1 ≔ 40-14-00-00-00-00-00-00  # 5.0
      𝛿1Β·1 ≔ 𝛿·1Β·1  # 𝔻(ΞΎ.ρ)
      𝔻(ΞΎ.x):
        𝕄(ΞΎ.x):
          𝑛·1Β·12 ≔ 0.0
          𝑛·1Β·13 ≔ ⟦ Ο† ↦ Ξ¦.bytes( Ο† ↦ 00-00-00-00-00-00-00-00:Ξ” ), gt(x) ↦ L_number_gt:Ξ», plus(x) ↦ L_number_plus:Ξ» ⟧
          morphed 𝑛·1Β·14 ≔ 𝑛·1Β·13
        boxed 𝑛·1Β·15 ≔ 𝑛·1Β·14.Ο†
        normalized 𝑛·1Β·16 ≔ Ξ¦.bytes( Ο† ↦ 00-00-00-00-00-00-00-00:Ξ” )  # 𝑛·1Β·15
        𝕄(𝑛·1Β·15):
          𝑛·1Β·17 ≔ Ξ¦.bytes( Ο† ↦ 00-00-00-00-00-00-00-00:Ξ” )
          𝑛·1Β·18 ≔ 00-00-00-00-00-00-00-00:Ξ”:Ο†
          morphed 𝑛·1Β·19 ≔ 𝑛·1Β·18
        boxed 𝑛·1Β·20 ≔ 𝑛·1Β·19.Ο†
        normalized 𝑛·1Β·21 ≔ 00-00-00-00-00-00-00-00:Ξ”  # 𝑛·1Β·20
        𝛿·1Β·2 ≔ 00-00-00-00-00-00-00-00  # 0.0
      𝛿2Β·1 ≔ 𝛿·1Β·2  # 𝔻(ΞΎ.x)
      𝑛·1Β·22 ≔ Ξ¦.bool( Ο† ↦ 𝜎1:Ξ» )  # 𝑛 of L_number_gt
      𝕄(𝑛·1Β·22):
        normalized 𝑛·1Β·23 ≔ ⟦ Ο† ↦ βˆ…, if(then, else) ↦ L_fork:Ξ» ⟧  # Ξ¦.bool
        𝑛·1Β·24 ≔ Ξ¦.bool( Ο† ↦ 𝜎1:Ξ» )
        𝑛·1Β·25 ≔ ⟦ Ο† ↦ 𝜎1:Ξ», if(then, else) ↦ L_fork:Ξ» ⟧
        morphed 𝑛·1Β·26 ≔ 𝑛·1Β·25
      𝑛·1Β·27 ≔ 𝑛·1Β·26  # 𝕄(𝑛·1Β·22)
      evaluated 𝑛·1Β·28 ≔ 𝑛·1Β·27  # 𝑛·0Β·6
    normalized 𝑛·0Β·7 ≔ ⟦ then ↦ βˆ…, else ↦ βˆ…, Ξ» ‍ L_fork ⟧  # 𝑛·1Β·28.if
    shared 𝑛·1 ≔ 1.0.plus( x ↦ 2.0 ).plus( x ↦ 𝑛·1Β·12 )
    𝑛·0Β·8 ≔ 𝑛·1Β·24.if( then ↦ 𝑛·1 )
    𝑛·0Β·9 ≔ ⟦ then ↦ 𝑛·1, else ↦ βˆ…, Ξ» ‍ L_fork ⟧
    shared 𝑛·2 ≔ 3.0.plus( x ↦ 4.0 ).plus( x ↦ 𝑛·1Β·12 )
    𝑛·0Β·10 ≔ 𝑛·0Β·9( else ↦ 𝑛·2 )
    𝑛·0Β·11 ≔ ⟦ then ↦ 𝑛·1, else ↦ 𝑛·2, Ξ» ‍ L_fork ⟧
    𝔼(L_fork):
      𝔻(ΞΎ.ρ):
        𝕄(ΞΎ.ρ):
          𝑛·2Β·1 ≔ Ξ¦.bool( Ο† ↦ 𝜎1:Ξ» )
          𝑛·2Β·2 ≔ ⟦ Ο† ↦ 𝜎1:Ξ», if(then, else) ↦ L_fork:Ξ» ⟧
          morphed 𝑛·2Β·3 ≔ 𝑛·1Β·27
        boxed 𝑛·2Β·4 ≔ 𝑛·2Β·3.Ο†
        normalized 𝑛·2Β·5 ≔ 𝜎1:Ξ»  # 𝑛·2Β·4
        𝛿·2Β·1 ≔ 𝔻(𝜎1:Ξ»)
      𝛿1Β·2 ≔ 𝛿·2Β·1  # 𝔻(ΞΎ.ρ)
      𝕄(ΞΎ.then):
        𝑛·2Β·6 ≔ 1.0
        𝑛·2Β·7 ≔ ⟦ Ο† ↦ Ξ¦.bytes( Ο† ↦ 3F-F0-00-00-00-00-00-00:Ξ” ), gt(x) ↦ L_number_gt:Ξ», plus(x) ↦ L_number_plus:Ξ» ⟧
        normalized 𝑛·2Β·8 ≔ ⟦ x ↦ βˆ…, Ξ» ‍ L_number_plus ⟧  # 𝑛·2Β·7.plus
        𝑛·2Β·9 ≔ 𝑛·2Β·6.plus( x ↦ 2.0 )
        𝑛·2Β·10 ≔ ⟦ x ↦ 2.0, Ξ» ‍ L_number_plus ⟧
        𝔼(L_number_plus):
          𝔻(ΞΎ.ρ):
            𝕄(ΞΎ.ρ):
              𝑛·3Β·1 ≔ 1.0
              𝑛·3Β·2 ≔ ⟦ Ο† ↦ Ξ¦.bytes( Ο† ↦ 3F-F0-00-00-00-00-00-00:Ξ” ), gt(x) ↦ L_number_gt:Ξ», plus(x) ↦ L_number_plus:Ξ» ⟧
              morphed 𝑛·3Β·3 ≔ 𝑛·3Β·2
            boxed 𝑛·3Β·4 ≔ 𝑛·3Β·3.Ο†
            normalized 𝑛·3Β·5 ≔ Ξ¦.bytes( Ο† ↦ 3F-F0-00-00-00-00-00-00:Ξ” )  # 𝑛·3Β·4
            𝕄(𝑛·3Β·4):
              𝑛·3Β·6 ≔ Ξ¦.bytes( Ο† ↦ 3F-F0-00-00-00-00-00-00:Ξ” )
              𝑛·3Β·7 ≔ 3F-F0-00-00-00-00-00-00:Ξ”:Ο†
              morphed 𝑛·3Β·8 ≔ 𝑛·3Β·7
            boxed 𝑛·3Β·9 ≔ 𝑛·3Β·8.Ο†
            normalized 𝑛·3Β·10 ≔ 3F-F0-00-00-00-00-00-00:Ξ”  # 𝑛·3Β·9
            𝛿·3Β·1 ≔ 3F-F0-00-00-00-00-00-00  # 1.0
          𝛿1Β·3 ≔ 𝛿·3Β·1  # 𝔻(ΞΎ.ρ)
          𝔻(ΞΎ.x):
            𝕄(ΞΎ.x):
              𝑛·3Β·11 ≔ 2.0
              𝑛·3Β·12 ≔ ⟦ Ο† ↦ Ξ¦.bytes( Ο† ↦ 40-00-00-00-00-00-00-00:Ξ” ), gt(x) ↦ L_number_gt:Ξ», plus(x) ↦ L_number_plus:Ξ» ⟧
              morphed 𝑛·3Β·13 ≔ 𝑛·3Β·12
            boxed 𝑛·3Β·14 ≔ 𝑛·3Β·13.Ο†
            normalized 𝑛·3Β·15 ≔ Ξ¦.bytes( Ο† ↦ 40-00-00-00-00-00-00-00:Ξ” )  # 𝑛·3Β·14
            𝕄(𝑛·3Β·14):
              𝑛·3Β·16 ≔ Ξ¦.bytes( Ο† ↦ 40-00-00-00-00-00-00-00:Ξ” )
              𝑛·3Β·17 ≔ 40-00-00-00-00-00-00-00:Ξ”:Ο†
              morphed 𝑛·3Β·18 ≔ 𝑛·3Β·17
            boxed 𝑛·3Β·19 ≔ 𝑛·3Β·18.Ο†
            normalized 𝑛·3Β·20 ≔ 40-00-00-00-00-00-00-00:Ξ”  # 𝑛·3Β·19
            𝛿·3Β·2 ≔ 40-00-00-00-00-00-00-00  # 2.0
          𝛿2Β·3 ≔ 𝛿·3Β·2  # 𝔻(ΞΎ.x)
          𝑛·3Β·21 ≔ Ξ¦.number( Ο† ↦ 𝜎2:Ξ» )  # 𝑛 of L_number_plus
          𝕄(𝑛·3Β·21):
            𝑛·3Β·22 ≔ Ξ¦.number( Ο† ↦ 𝜎2:Ξ» )
            𝑛·3Β·23 ≔ ⟦ Ο† ↦ 𝜎2:Ξ», gt(x) ↦ L_number_gt:Ξ», plus(x) ↦ L_number_plus:Ξ» ⟧
            morphed 𝑛·3Β·24 ≔ 𝑛·3Β·23
          𝑛·3Β·25 ≔ 𝑛·3Β·24  # 𝕄(𝑛·3Β·21)
          evaluated 𝑛·3Β·26 ≔ 𝑛·3Β·25  # 𝑛·2Β·10
        normalized 𝑛·2Β·11 ≔ ⟦ x ↦ βˆ…, Ξ» ‍ L_number_plus ⟧  # 𝑛·3Β·26.plus
        𝑛·2Β·12 ≔ 𝑛·3Β·22.plus( x ↦ 𝑛·1Β·12 )
        𝑛·2Β·13 ≔ ⟦ x ↦ 𝑛·1Β·12, Ξ» ‍ L_number_plus ⟧
        morphed 𝑛·2Β·14 ≔ 𝑛·2Β·13
      𝕄(ΞΎ.else):
        𝑛·2Β·15 ≔ 3.0
        𝑛·2Β·16 ≔ ⟦ Ο† ↦ Ξ¦.bytes( Ο† ↦ 40-08-00-00-00-00-00-00:Ξ” ), gt(x) ↦ L_number_gt:Ξ», plus(x) ↦ L_number_plus:Ξ» ⟧
        normalized 𝑛·2Β·17 ≔ ⟦ x ↦ βˆ…, Ξ» ‍ L_number_plus ⟧  # 𝑛·2Β·16.plus
        𝑛·2Β·18 ≔ 𝑛·2Β·15.plus( x ↦ 4.0 )
        𝑛·2Β·19 ≔ ⟦ x ↦ 4.0, Ξ» ‍ L_number_plus ⟧
        𝔼(L_number_plus):
          𝔻(ΞΎ.ρ):
            𝕄(ΞΎ.ρ):
              𝑛·4Β·1 ≔ 3.0
              𝑛·4Β·2 ≔ ⟦ Ο† ↦ Ξ¦.bytes( Ο† ↦ 40-08-00-00-00-00-00-00:Ξ” ), gt(x) ↦ L_number_gt:Ξ», plus(x) ↦ L_number_plus:Ξ» ⟧
              morphed 𝑛·4Β·3 ≔ 𝑛·4Β·2
            boxed 𝑛·4Β·4 ≔ 𝑛·4Β·3.Ο†
            normalized 𝑛·4Β·5 ≔ Ξ¦.bytes( Ο† ↦ 40-08-00-00-00-00-00-00:Ξ” )  # 𝑛·4Β·4
            𝕄(𝑛·4Β·4):
              𝑛·4Β·6 ≔ Ξ¦.bytes( Ο† ↦ 40-08-00-00-00-00-00-00:Ξ” )
              𝑛·4Β·7 ≔ 40-08-00-00-00-00-00-00:Ξ”:Ο†
              morphed 𝑛·4Β·8 ≔ 𝑛·4Β·7
            boxed 𝑛·4Β·9 ≔ 𝑛·4Β·8.Ο†
            normalized 𝑛·4Β·10 ≔ 40-08-00-00-00-00-00-00:Ξ”  # 𝑛·4Β·9
            𝛿·4Β·1 ≔ 40-08-00-00-00-00-00-00  # 3.0
          𝛿1Β·4 ≔ 𝛿·4Β·1  # 𝔻(ΞΎ.ρ)
          𝔻(ΞΎ.x):
            𝕄(ΞΎ.x):
              𝑛·4Β·11 ≔ 4.0
              𝑛·4Β·12 ≔ ⟦ Ο† ↦ Ξ¦.bytes( Ο† ↦ 40-10-00-00-00-00-00-00:Ξ” ), gt(x) ↦ L_number_gt:Ξ», plus(x) ↦ L_number_plus:Ξ» ⟧
              morphed 𝑛·4Β·13 ≔ 𝑛·4Β·12
            boxed 𝑛·4Β·14 ≔ 𝑛·4Β·13.Ο†
            normalized 𝑛·4Β·15 ≔ Ξ¦.bytes( Ο† ↦ 40-10-00-00-00-00-00-00:Ξ” )  # 𝑛·4Β·14
            𝕄(𝑛·4Β·14):
              𝑛·4Β·16 ≔ Ξ¦.bytes( Ο† ↦ 40-10-00-00-00-00-00-00:Ξ” )
              𝑛·4Β·17 ≔ 40-10-00-00-00-00-00-00:Ξ”:Ο†
              morphed 𝑛·4Β·18 ≔ 𝑛·4Β·17
            boxed 𝑛·4Β·19 ≔ 𝑛·4Β·18.Ο†
            normalized 𝑛·4Β·20 ≔ 40-10-00-00-00-00-00-00:Ξ”  # 𝑛·4Β·19
            𝛿·4Β·2 ≔ 40-10-00-00-00-00-00-00  # 4.0
          𝛿2Β·4 ≔ 𝛿·4Β·2  # 𝔻(ΞΎ.x)
          𝑛·4Β·21 ≔ Ξ¦.number( Ο† ↦ 𝜎3:Ξ» )  # 𝑛 of L_number_plus
          𝕄(𝑛·4Β·21):
            𝑛·4Β·22 ≔ Ξ¦.number( Ο† ↦ 𝜎3:Ξ» )
            𝑛·4Β·23 ≔ ⟦ Ο† ↦ 𝜎3:Ξ», gt(x) ↦ L_number_gt:Ξ», plus(x) ↦ L_number_plus:Ξ» ⟧
            morphed 𝑛·4Β·24 ≔ 𝑛·4Β·23
          𝑛·4Β·25 ≔ 𝑛·4Β·24  # 𝕄(𝑛·4Β·21)
          evaluated 𝑛·4Β·26 ≔ 𝑛·4Β·25  # 𝑛·2Β·19
        normalized 𝑛·2Β·20 ≔ ⟦ x ↦ βˆ…, Ξ» ‍ L_number_plus ⟧  # 𝑛·4Β·26.plus
        𝑛·2Β·21 ≔ 𝑛·4Β·22.plus( x ↦ 𝑛·1Β·12 )
        𝑛·2Β·22 ≔ ⟦ x ↦ 𝑛·1Β·12, Ξ» ‍ L_number_plus ⟧
        morphed 𝑛·2Β·23 ≔ 𝑛·2Β·22
      joined 𝜎4 ≔ 𝛿1Β·2 ? 𝜎2 : 𝜎3
      𝑛·2Β·24 ≔ ⟦ x ↦ 𝑛·1Β·12, Ξ» ‍ L_number_plus ⟧
      evaluated 𝑛·2Β·25 ≔ ⟦ x ↦ 𝑛·1Β·12, Ξ» ‍ L_number_plus ⟧  # 𝑛·0Β·11
    𝔼(L_number_plus):
      𝔻(ΞΎ.ρ):
        𝕄(ΞΎ.ρ):
          𝑛·5Β·1 ≔ Ξ¦.number( Ο† ↦ 𝜎4:Ξ» )
          𝑛·5Β·2 ≔ ⟦ Ο† ↦ 𝜎4:Ξ», gt(x) ↦ L_number_gt:Ξ», plus(x) ↦ L_number_plus:Ξ» ⟧
          morphed 𝑛·5Β·3 ≔ 𝑛·5Β·2
        boxed 𝑛·5Β·4 ≔ 𝑛·5Β·3.Ο†
        normalized 𝑛·5Β·5 ≔ 𝜎4:Ξ»  # 𝑛·5Β·4
        𝛿·5Β·1 ≔ 𝔻(𝜎4:Ξ»)
      𝛿1Β·5 ≔ 𝛿·5Β·1  # 𝔻(ΞΎ.ρ)
      𝔻(ΞΎ.x):
        𝕄(ΞΎ.x):
          𝑛·5Β·6 ≔ Ξ¦.number( Ο† ↦ 𝑛·1Β·17 )
          𝑛·5Β·7 ≔ ⟦ Ο† ↦ 𝑛·1Β·17, gt(x) ↦ L_number_gt:Ξ», plus(x) ↦ L_number_plus:Ξ» ⟧
          morphed 𝑛·5Β·8 ≔ 𝑛·5Β·7
        boxed 𝑛·5Β·9 ≔ 𝑛·5Β·8.Ο†
        normalized 𝑛·5Β·10 ≔ 𝑛·1Β·17  # 𝑛·5Β·9
        𝕄(𝑛·5Β·9):
          𝑛·5Β·11 ≔ Ξ¦.bytes( Ο† ↦ 00-00-00-00-00-00-00-00:Ξ” )
          𝑛·5Β·12 ≔ 00-00-00-00-00-00-00-00:Ξ”:Ο†
          morphed 𝑛·5Β·13 ≔ 𝑛·5Β·12
        boxed 𝑛·5Β·14 ≔ 𝑛·5Β·13.Ο†
        normalized 𝑛·5Β·15 ≔ 00-00-00-00-00-00-00-00:Ξ”  # 𝑛·5Β·14
        𝛿·5Β·2 ≔ 00-00-00-00-00-00-00-00  # 0.0
      𝛿2Β·5 ≔ 𝛿·5Β·2  # 𝔻(ΞΎ.x)
      𝑛·5Β·16 ≔ Ξ¦.number( Ο† ↦ 𝜎5:Ξ» )  # 𝑛 of L_number_plus
      𝕄(𝑛·5Β·16):
        𝑛·5Β·17 ≔ Ξ¦.number( Ο† ↦ 𝜎5:Ξ» )
        𝑛·5Β·18 ≔ ⟦ Ο† ↦ 𝜎5:Ξ», gt(x) ↦ L_number_gt:Ξ», plus(x) ↦ L_number_plus:Ξ» ⟧
        morphed 𝑛·5Β·19 ≔ 𝑛·5Β·18
      𝑛·5Β·20 ≔ 𝑛·5Β·19  # 𝕄(𝑛·5Β·16)
      evaluated 𝑛·5Β·21 ≔ 𝑛·5Β·20  # ⟦ x ↦ 𝑛·5Β·6, Ξ» ‍ L_number_plus ⟧
    normalized 𝑛·0Β·12 ≔ 𝜎5:Ξ»  # 𝑛·5Β·21.Ο†
    morphed 𝑛·0Β·13 ≔ 𝑛·0Β·12