# SPDX-FileCopyrightText: Copyright (c) 2025 Objectionary.com# SPDX-License-Identifier: MIT---# yamllint disable rule:line-length# A factorial over a symbolic argument, under '--acyclic=proven'. Every round# of the recursion mints fresh symbols, so the deep walk fires 'mul' with# a β¦ π1 and b β¦ Ξ¦.fact( n β¦ π3 ) on the first round and with a β¦ π3 and# b β¦ Ξ¦.fact( n β¦ π5 ) on the second, and no two rounds are ever the same term.# They are the same formation up to a renaming of symbols, which is what the# guard compares by (#1420), and the walk enters the formation it fires (#1451),# so the second firing is cut before it opens and writes a 'looped' line where# its block would have stood, carrying the term of the round that was kept# (#1434). The budget is generous here, so what ends the run is the cut and not# the limit. The argument 'n' and every symbol 'dec' answers stand in a# carrier 'β¦ Ο β¦ π β§', since the walk defers a copy one of whose arguments is# a bare symbol instead of entering it (#1729). The first 'L_if' gets stuck,# yet the symbols it minted stay taken, so the second one mints from π7 (#1738).symbolic: | - Ξ»: L_zero dataize: πΏ1: $.x π: β¦ Ξ» β€ π β§ - Ξ»: L_dec dataize: πΏ1: $.x π: β¦ Ο β¦ β¦ Ξ» β€ π β§ β§ - Ξ»: L_mul dataize: πΏ1: $.a πΏ2: $.b π: β¦ Ξ» β€ π β§ - Ξ»: L_if dataize: πΏ1: $.c morph: π1: $.left π2: $.right symbolize: π3: π1 π4: π2 join: π5: [π3, π4] π: π5location: 'Q.x'deep: trueacyclic: provenpartial: truesteps: 250input: > β¦ if β¦ β¦ c β¦ β
, left β¦ β
, right β¦ β
, Ξ» β€ L_if β§, zero β¦ β¦ x β¦ β
, Ξ» β€ L_zero β§, dec β¦ β¦ x β¦ β
, Ξ» β€ L_dec β§, mul β¦ β¦ a β¦ β
, b β¦ β
, Ξ» β€ L_mul β§, fact β¦ β¦ n β¦ β
, Ο β¦ Ξ¦.if( c β¦ Ξ¦.zero( x β¦ ΞΎ.n ), left β¦ β¦ Ξ β€ 01- β§, right β¦ Ξ¦.mul( a β¦ ΞΎ.n, b β¦ Ξ¦.fact( n β¦ Ξ¦.dec( x β¦ ΞΎ.n ) ) ) ) β§, x β¦ Ξ¦.fact( n β¦ β¦ Ο β¦ β¦ Ξ» β€ π1 β§ β§ ) β§result: |- β¦ n β¦ π1:Ξ»:Ο, Ο β¦ Ξ¦.if( c β¦ π2:Ξ», left β¦ 01-:Ξ, right β¦ Ξ¦.mul( a β¦ n, b β¦ Ξ¦.fact( n β¦ π3:Ξ»:Ο ) ) ) β§protocol: | π(Ξ¦.x): πΒ·0Β·1 := Ξ¦.fact( n β¦ π1:Ξ»:Ο ) π(Ξ¦.x.Ο): πΒ·0Β·2 := Ξ¦.zero( x β¦ π1:Ξ»:Ο ) πΌ(L_zero): πΏ1Β·1 := π»(π1:Ξ») # π»(ΞΎ.x) πΒ·1Β·1 := π2:Ξ» # π πΒ·1Β·2 := π2:Ξ» # π(πΒ·1Β·1) πΒ·0Β·3 := Ξ¦.if( c β¦ π2:Ξ» ) πΒ·0Β·4 := Ξ¦.if( c β¦ π2:Ξ» ) πΒ·0Β·5 := πΒ·0Β·4( left β¦ 01-:Ξ ) πΒ·0Β·6 := Ξ¦.mul( a β¦ π1:Ξ»:Ο ) πΒ·0Β·7 := Ξ¦.dec( x β¦ π1:Ξ»:Ο ) πΌ(L_dec): πΏ1Β·2 := π»(π1:Ξ») # π»(ΞΎ.x) πΒ·2Β·1 := π3:Ξ»:Ο # π πΒ·2Β·2 := π3:Ξ»:Ο # π(πΒ·2Β·1) πΒ·0Β·8 := Ξ¦.fact( n β¦ π3:Ξ»:Ο ) πΒ·0Β·9 := Ξ¦.mul( a β¦ π1:Ξ»:Ο ) πΒ·0Β·10 := πΒ·0Β·9( b β¦ πΒ·0Β·8 ) πΌ(L_mul): πΏ1Β·3 := π»(π1:Ξ») # π»(ΞΎ.a) π»(Ξ¦.aπ΅3): π(Ξ¦.aπ΅3): πΒ·3Β·1 := Ξ¦.fact( n β¦ π3:Ξ»:Ο ) πΒ·3Β·2 := Ξ¦.if( c β¦ Ξ¦.zero( x β¦ π3:Ξ»:Ο ) ) πΒ·3Β·3 := πΒ·3Β·2( left β¦ 01-:Ξ ) πΒ·3Β·4 := πΒ·3Β·3( right β¦ Ξ¦.mul( a β¦ π3:Ξ»:Ο, b β¦ Ξ¦.fact( n β¦ Ξ¦.dec( x β¦ π3:Ξ»:Ο ) ) ) ) πΌ(L_if): π»(Ξ¦.aπ΅4): π(Ξ¦.aπ΅4): πΒ·4Β·1 := Ξ¦.zero( x β¦ π3:Ξ»:Ο ) πΌ(L_zero): πΏ1Β·5 := π»(π3:Ξ») # π»(ΞΎ.x) πΒ·5Β·1 := π4:Ξ» # π πΒ·5Β·2 := π4:Ξ» # π(πΒ·5Β·1) πΏ1Β·4 := π»(π4:Ξ») # π»(ΞΎ.c) π1Β·4 := 01-:Ξ # π(ΞΎ.left) π(Ξ¦.aπ΅7): πΒ·4Β·2 := Ξ¦.mul( a β¦ π3:Ξ»:Ο ) πΒ·4Β·3 := πΒ·4Β·2( b β¦ Ξ¦.fact( n β¦ Ξ¦.dec( x β¦ π3:Ξ»:Ο ) ) ) π(Ξ¦.aπ΅7.b): πΒ·4Β·4 := Ξ¦.dec( x β¦ π3:Ξ»:Ο ) πΌ(L_dec): πΏ1Β·6 := π»(π3:Ξ») # π»(ΞΎ.x) πΒ·6Β·1 := π5:Ξ»:Ο # π πΒ·6Β·2 := π5:Ξ»:Ο # π(πΒ·6Β·1) πΒ·4Β·5 := Ξ¦.fact( n β¦ π5:Ξ»:Ο ) looped(πΒ·0Β·10) # proven π2Β·4 := πΒ·4Β·3 # π(ΞΎ.right) π»(π6:Ξ») == 01- π3Β·4 := π6:Ξ» # π1 π4Β·4 := πΒ·4Β·3 # π2 stuck(L_if) stuck(L_if) πΒ·0Β·11 := Ξ¦.if( c β¦ π2:Ξ» ) πΒ·0Β·12 := πΒ·0Β·11( left β¦ 01-:Ξ ) πΒ·0Β·13 := πΒ·0Β·12( right β¦ πΒ·0Β·10 ) πΌ(L_if): πΏ1Β·7 := π»(π2:Ξ») # π»(ΞΎ.c) π1Β·7 := 01-:Ξ # π(ΞΎ.left) π(Ξ¦.aπ΅11): πΒ·7Β·1 := Ξ¦.mul( a β¦ π1:Ξ»:Ο ) πΒ·7Β·2 := πΒ·7Β·1( b β¦ πΒ·3Β·1 ) π(Ξ¦.aπ΅11.b): πΒ·7Β·3 := Ξ¦.fact( n β¦ π3:Ξ»:Ο ) πΌ(L_mul): πΏ1Β·8 := π»(π1:Ξ») # π»(ΞΎ.a) π»(Ξ¦.aπ΅13): π(Ξ¦.aπ΅13): πΒ·8Β·1 := Ξ¦.fact( n β¦ π3:Ξ»:Ο ) πΒ·8Β·2 := Ξ¦.if( c β¦ πΒ·4Β·1 ) πΒ·8Β·3 := πΒ·8Β·2( left β¦ 01-:Ξ ) πΒ·8Β·4 := πΒ·8Β·3( right β¦ πΒ·4Β·3 ) πΌ(L_if): π»(Ξ¦.aπ΅14): π(Ξ¦.aπ΅14): πΒ·9Β·1 := Ξ¦.zero( x β¦ π3:Ξ»:Ο ) πΌ(L_zero): πΏ1Β·10 := π»(π3:Ξ») # π»(ΞΎ.x) πΒ·10Β·1 := π7:Ξ» # π πΒ·10Β·2 := π7:Ξ» # π(πΒ·10Β·1) πΏ1Β·9 := π»(π7:Ξ») # π»(ΞΎ.c) π1Β·9 := 01-:Ξ # π(ΞΎ.left) π(Ξ¦.aπ΅17): πΒ·9Β·2 := Ξ¦.mul( a β¦ π3:Ξ»:Ο ) πΒ·9Β·3 := πΒ·9Β·2( b β¦ Ξ¦.fact( n β¦ πΒ·4Β·4 ) ) π(Ξ¦.aπ΅17.b): πΒ·9Β·4 := Ξ¦.dec( x β¦ π3:Ξ»:Ο ) πΌ(L_dec): πΏ1Β·11 := π»(π3:Ξ») # π»(ΞΎ.x) πΒ·11Β·1 := π8:Ξ»:Ο # π πΒ·11Β·2 := π8:Ξ»:Ο # π(πΒ·11Β·1) πΒ·9Β·5 := Ξ¦.fact( n β¦ π8:Ξ»:Ο ) looped(πΒ·7Β·2) # proven π2Β·9 := πΒ·9Β·3 # π(ΞΎ.right) π»(π9:Ξ») == 01- π3Β·9 := π9:Ξ» # π1 π4Β·9 := πΒ·9Β·3 # π2 stuck(L_if) stuck(L_if) π2Β·7 := πΒ·7Β·2 # π(ΞΎ.right) π»(π10:Ξ») == 01- π3Β·7 := π10:Ξ» # π1 π4Β·7 := πΒ·7Β·2 # π2 stuck(L_if)