Theorems · Definition · logic and foundations
Turing.ToPartrec.stepNormal
Turing.ToPartrec.Code → Turing.ToPartrec.Cont → List ℕ → Turing.ToPartrec.Cfg
Evaluating c : Code in a continuation k : Cont and input v : List ℕ. This goes by
recursion on c, building an augmented continuation and a value to pass to it.
* zero' v = 0 :: v evaluates immediately, so we return it to the parent continuation
* succ v = [v.headI.succ] evaluates immediately, so we return it to the parent continuation
* tail v = v.tail evaluates immediately, so we return it to the parent continuation
* cons f fs v = (f v).headI :: fs v requires two sub-evaluations, so we evaluate
f v in the continuation k (_.headI :: fs v) (called Cont.cons₁ fs v k)
* comp f g v = f (g v) requires two sub-evaluations, so we evaluate
g v in the continuation k (f _) (called Cont.comp f k)
* case f g v = v.head.casesOn (f v.tail) (fun n => g (n :: v.tail)) has the information needed
to evaluate the case statement, so we do that and transition to either
f v or g (n :: v.tail).
* fix f v = let v' := f v; if v'.headI = 0 then k v'.tail else fix f v'.tail
needs to first evaluate f v, so we do that and leave the rest for the continuation (called
Cont.fix f k)
- Cited by
- 13 results in Mathlib
- Foundations
- Depth 7 from the axioms · uses no axioms
Around this declaration
Dashed lines are statement dependencies; solid lines are citations in proofs.
Cites4
Mathlib declarations this one mentions in its statement or cites explicitly in its proof. Plumbing is filtered out.
- Turing.ToPartrec.Codestatement and proof · cited by 83
- Turing.ToPartrec.Contstatement · cited by 33
- Turing.ToPartrec.Cfgstatement · cited by 20
- Turing.ToPartrec.Code.brecOnproof · cited by 1
Cited by14
Results whose statement or proof uses this declaration.
- Turing.ToPartrec.Code.Okproof · cited by 3
- Turing.PartrecToTM2.trNormal_respectsstatement and proof · cited by 2
- Turing.ToPartrec.code_is_okproof · cited by 2
- Turing.ToPartrec.cont_eval_fixstatement and proof · cited by 2
- Turing.ToPartrec.stepNormal_thenstatement and proof · cited by 2
- Turing.ToPartrec.stepNormal.is_retstatement and proof · cited by 1
- Turing.PartrecToTM2.tr_initstatement · cited by 1
- Turing.ToPartrec.stepNormal_evalstatement · cited by 1
- Turing.ToPartrec.stepRet_thenproof · cited by 1
- Turing.ToPartrec.Code.Ok.zerostatement · cited by 1
- Turing.PartrecToTM2.tr_ret_respectsproof · cited by 1
- Turing.ToPartrec.stepNormal.eq_defstatement and proof · cited by 0