LoopProjection.run_then_finishes: def of stelliferous@0.0.2.0 Import: import stelliferous@0.0.2.0/proofs/loop_projection.bend as LoopProjection Lines 112-117 of stelliferous@0.0.2.0/proofs/loop_projection.bend: https://jend.leeeet.dev/read.txt?path=stelliferous@0.0.2.0/proofs/loop_projection.bend&start_line=112&end_line=117 import Base import stelliferous@0.0.2.0/traversal_loop.bend as Loop # The final step is applied once, to the state the loop ends in. def run_then_finishes(~State: Type,~Result: Type,~step: State -> State,~finish: State -> Result,count: Nat,-state: State) -> {Loop.run_then(~State,~Result,~step,~finish,count,state) == finish(Loop.run(~State,~step,count,state)) : Result}: match count: case 0n: {==} case 1n+rest: run_then_finishes(~State,~Result,~step,~finish,rest,step(state)) Uses (3): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat https://jend.leeeet.dev/definition.txt?path=stelliferous@0.0.2.0/traversal_loop.bend&name=run https://jend.leeeet.dev/definition.txt?path=stelliferous@0.0.2.0/traversal_loop.bend&name=run_then