JSONParallelProof.balance: def of qasim-bend-kit@0.1.0.2 Import: import qasim-bend-kit@0.1.0.2/proof/JSON_ParallelProof.bend as JSONParallelProof Lines 32-44 of qasim-bend-kit@0.1.0.2/proof/JSON_ParallelProof.bend: https://jend.leeeet.dev/read.txt?path=qasim-bend-kit@0.1.0.2/proof/JSON_ParallelProof.bend&start_line=32&end_line=44 import Base import qasim-bend-kit@0.1.0.2/libs/JSON.bend as J def balance(+fuel: Nat, +trees: List<&2, J.LexTree>, -tail: List) -> {J.token_list(J.decode_tree(J.lex_balance(fuel, trees)), tail) == forest(trees, tail) : List}: match fuel: case 0n: join(trees, tail) case 1n+p: match trees: case Nil{}: {==} case head <> Nil{}: {==} case left <> right <> rest: Equal.trans(List, J.token_list(J.decode_tree(J.lex_balance(p, J.lex_pairs(left <> right <> rest))), tail), forest(J.lex_pairs(left <> right <> rest), tail), forest(left <> right <> rest, tail), balance(p, J.lex_pairs(left <> right <> rest), tail), pairs(left <> right <> rest, tail)) Uses (12): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Equal.trans https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=List https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat https://jend.leeeet.dev/definition.txt?path=qasim-bend-kit@0.1.0.2/libs/JSON.bend&name=LexTree https://jend.leeeet.dev/definition.txt?path=qasim-bend-kit@0.1.0.2/libs/JSON.bend&name=Token https://jend.leeeet.dev/definition.txt?path=qasim-bend-kit@0.1.0.2/libs/JSON.bend&name=decode_tree https://jend.leeeet.dev/definition.txt?path=qasim-bend-kit@0.1.0.2/libs/JSON.bend&name=lex_balance https://jend.leeeet.dev/definition.txt?path=qasim-bend-kit@0.1.0.2/libs/JSON.bend&name=lex_pairs https://jend.leeeet.dev/definition.txt?path=qasim-bend-kit@0.1.0.2/libs/JSON.bend&name=token_list https://jend.leeeet.dev/definition.txt?path=qasim-bend-kit@0.1.0.2/proof/JSON_ParallelProof.bend&name=forest https://jend.leeeet.dev/definition.txt?path=qasim-bend-kit@0.1.0.2/proof/JSON_ParallelProof.bend&name=join https://jend.leeeet.dev/definition.txt?path=qasim-bend-kit@0.1.0.2/proof/JSON_ParallelProof.bend&name=pairs