Equations
- (Partrec.const n_3).eval x✝ = Part.some n_3
- Partrec.succ.eval v = Part.some v.head.succ
- (Partrec.proj i).eval x✝ = Part.some (x✝ i)
- (f.comp g).eval x✝ = (Part.bindVec fun (i : Fin n_3) => (g i).eval x✝) >>= f.eval
- (f.prec g).eval v = (f.eval v.tail).natrec (fun (n ih : ℕ) => do let m ← ↑(some ih) g.eval (n ∷ᵥ m ∷ᵥ v.tail)) v.head
- f.mu.eval x✝ = Part.find fun (n_1 : ℕ) => f.eval (n_1 ∷ᵥ x✝)
Instances For
Equations
- Partrec.instCoeFunPFunVecNat = { coe := Partrec.eval }
Equations
- Partrec.ofPrim (Primrec.const n_3) = Partrec.const n_3
- Partrec.ofPrim Primrec.succ = Partrec.succ
- Partrec.ofPrim (Primrec.proj i) = Partrec.proj i
- Partrec.ofPrim (f.comp g) = (Partrec.ofPrim f).comp fun (i : Fin n_3) => Partrec.ofPrim (g i)
- Partrec.ofPrim (f.prec g) = (Partrec.ofPrim f).prec (Partrec.ofPrim g)
Instances For
Equations
Instances For
Equations
Instances For
Equations
- f.cov = (Partrec.const 0).prec ((Partrec.ofPrim Primrec.rcons).comp₃ (Partrec.proj 0) (Partrec.proj 1) f)
Instances For
Course-of-values recursion. For simplicity we assume the totality of f on the first two arguments.
Equations
- f.covrec = (Partrec.ofPrim Primrec.vget).comp₂ (f.cov.comp (Partrec.succ.comp₁ (Partrec.proj 0) ∷ᵥ fun (x : Fin n) => Partrec.proj x.succ)) (Partrec.proj 0)
Instances For
bd f (k ∷ᵥ v) replaces all unbounded mu in f v with a Primrec.bdMu bounded by k;
it returns 0 for Part.none, and x + 1 for Part.some x.
bd is similar to Nat.Partrec.Code.evaln in mathlib, although bd itself is not primitive recursive
(since bd f is equivalent to f + 1 when f is primitive recursive).
Equations
- One or more equations did not get rendered due to their size.
- (Partrec.const n_3).bd = Primrec.const (n_3 + 1)
- Partrec.succ.bd = Primrec.succ.comp₁ (Primrec.succ.comp₁ (Primrec.proj 1))
- (Partrec.proj i).bd = Primrec.succ.comp₁ (Primrec.proj i.succ)
- (f.comp g).bd = (Primrec.andv fun (i : Fin n_3) => (g i).bd).ite (f.bd.comp (Primrec.proj 0 ∷ᵥ fun (i : Fin n_3) => Primrec.pred.comp₁ (g i).bd)) Primrec.zero
Instances For
Parallel execution of f and g.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
- (Partrec.const n_3).repr x✝ = Std.Format.text "const " ++ Std.Format.text n_3.repr
- Partrec.succ.repr x✝ = Std.Format.text "succ"
- (Partrec.proj i).repr x✝ = Repr.addAppParen (Std.Format.text "proj " ++ reprPrec i Lean.Parser.maxPrec) x✝
- (f.prec g).repr x✝ = Repr.addAppParen (Std.Format.text "prec " ++ f.repr Lean.Parser.maxPrec ++ Std.Format.text " " ++ g.repr Lean.Parser.maxPrec) x✝
- f.mu.repr x✝ = Repr.addAppParen (Std.Format.text "mu " ++ f.repr Lean.Parser.maxPrec) x✝
Instances For
Equations
- Partrec.instRepr = { reprPrec := Partrec.repr }
A set is recursive if it can be decided by a recursive function f.
Note: for flexibility, we only require f's totality on the image of Encodable.encode, instead
of the whole ℕ.
- char : Partrec 1
Instances
Equations
- Recursive.compl = { char := Primrec.nsign.toPart.comp₁ (Recursive.char s), char_dom := ⋯, mem_iff := ⋯ }
Instances For
Equations
- Recursive.dec s x = ⋯.mpr (⋯.mpr (⋯.mpr inferInstance))
A set is enumerable (also called recursively enumerable, or RE) if it can be decided through a
"μ-operator search" over a recursive function. The equivalent definitions are
IsEnumerable.iff_range_partrec and IsEnumerable.iff_semi_decidable.
- enum : Partrec 2
Instances
Equations
- Recursive.enumerable = { enum := (Recursive.char s).comp₁ (Partrec.proj 1), enum_dom := ⋯, mem_iff := ⋯ }
A set is enumerable if and only if it can be semi-decided.
A set is recursive if and only if it and its complement are both enumerable.