Partial Recursive → SKI-computable (Nat.Partrec) #
This file translates Nat.Partrec.Code to SKI terms and proves the translation
correct, showing that every partial recursive function is SKI-computable in the
sense of SKI.Computes (from Cslib.Languages.CombinatoryLogic.Computable).
Main definitions #
Nat.Partrec.Code.toSKI: translatesNat.Partrec.Codeconstructors to SKI terms.
Main results #
Nat.Partrec.Code.toSKI_correct: each translated code computes the correspondingCode.eval.natPartrec_skiComputable: everyNat.Partrecfunction is SKI-computable.
Helper terms for Code.prec and Code.rfind' #
Step function for primitive recursion:
λ a cn prev. tg ⬝ (NatPair ⬝ a ⬝ (NatPair ⬝ (Pred ⬝ cn) ⬝ prev))
Variables: &0 = a, &1 = cn, &2 = prev
Equations
- One or more equations did not get rendered due to their size.
Instances For
SKI term for the primitive recursion step function.
Equations
- tg.PrecStep = tg.PrecStepPoly.toSKI
Instances For
Full primitive recursion translation:
λ n. Rec (tf (left n)) (PrecStep tg (left n)) (right n)
Equations
- One or more equations did not get rendered due to their size.
Instances For
SKI term for primitive recursion via Rec with pair/unpair plumbing.
Equations
- tf.PrecTrans tg = (tf.PrecTransPoly tg).toSKI
Instances For
Unbounded search translation:
λ n. RFindAbove ⬝ (NatUnpairRight ⬝ n) ⬝ (B ⬝ tf ⬝ (NatPair ⬝ (NatUnpairLeft ⬝ n)))
Equations
- One or more equations did not get rendered due to their size.
Instances For
SKI term for unbounded search (μ-recursion).
Equations
- tf.RFindTrans = tf.RFindTransPoly.toSKI
Instances For
Translation from Nat.Partrec.Code to SKI #
Translate Nat.Partrec.Code to SKI terms operating on Church numerals.
Equations
- Nat.Partrec.Code.zero.toSKI = Cslib.SKI.K.app Cslib.SKI.Zero
- Nat.Partrec.Code.succ.toSKI = Cslib.SKI.Succ
- Nat.Partrec.Code.left.toSKI = Cslib.SKI.NatUnpairLeft
- Nat.Partrec.Code.right.toSKI = Cslib.SKI.NatUnpairRight
- (f.pair g).toSKI = (Cslib.SKI.S.app ((Cslib.SKI.B.app Cslib.SKI.NatPair).app f.toSKI)).app g.toSKI
- (f.comp g).toSKI = (Cslib.SKI.B.app f.toSKI).app g.toSKI
- (f.prec g).toSKI = f.toSKI.PrecTrans g.toSKI
- f.rfind'.toSKI = f.toSKI.RFindTrans
Instances For
Correctness proofs #
Main correctness theorem: Code.toSKI correctly computes Code.eval.
Main result #
Every partial recursive function on ℕ is SKI-computable.