def run_then_finishes

stelliferous@0.0.2.0 · proofs/loop_projection.bend:112

import stelliferous@0.0.2.0/proofs/loop_projection.bend as LoopProjection
import Base
import stelliferous@0.0.2.0/traversal_loop.bend as Loop

112# The final step is applied once, to the state the loop ends in.
113def run_then_finishes(~State: Type,~Result: Type,~step: State -> State,~finish: State -> Result,count: Nat,-state: State) ->
114  {Loop.run_then(~State,~Result,~step,~finish,count,state) == finish(Loop.run(~State,~step,count,state)) : Result}:
115  match count:
116    case 0n: {==}
117    case 1n+rest: run_then_finishes(~State,~Result,~step,~finish,rest,step(state))

Uses (3)

Used by (1)