The areas / V32. Logic, model theory and computability
Mathlib.Computability.Partrec
128 declarations. Mathlib docs · Source
The partial recursive functions
The partial recursive functions are defined similarly to the primitive
recursive functions, but now all functions are partial, implemented
using the Part monad, and there is an additional operation, called
μ-recursion, which performs unbounded minimization: μ f returns the
least natural number n for which f n = 0, or diverges if such n doesn't exist.
Main definitions
Nat.Partrec f:fis partial recursive, for functionsf : ℕ →. ℕPartrec f:fis partial recursive, for partial functions betweenPrimcodabletypesComputable f:fis partial recursive, for total functions betweenPrimcodabletypes
References
- [Mario Carneiro, Formalizing computability theory via partial recursive functions][carneiro2019]
ctor Nat.Partrec.below.left E0 #
∀ {motive : (a : ℕ →. ℕ) → Nat.Partrec a → Prop}, Nat.Partrec.below Nat.Partrec.left
ctor Nat.Partrec.below.comp E0 #
∀ {motive : (a : ℕ →. ℕ) → Nat.Partrec a → Prop} {f g : ℕ →. ℕ} (a : Nat.Partrec f) (a_1 : Nat.Partrec g),
Nat.Partrec.below a → motive f a → Nat.Partrec.below a_1 → motive g a_1 → Nat.Partrec.below ⋯
ctor Nat.Partrec.below.rfind E0 #
∀ {motive : (a : ℕ →. ℕ) → Nat.Partrec a → Prop} {f : ℕ →. ℕ} (a : Nat.Partrec f),
Nat.Partrec.below a → motive f a → Nat.Partrec.below ⋯
ctor Nat.Partrec.below.succ E0 #
∀ {motive : (a : ℕ →. ℕ) → Nat.Partrec a → Prop}, Nat.Partrec.below Nat.Partrec.succ
ctor Nat.Partrec.below.pair E0 #
∀ {motive : (a : ℕ →. ℕ) → Nat.Partrec a → Prop} {f g : ℕ →. ℕ} (a : Nat.Partrec f) (a_1 : Nat.Partrec g),
Nat.Partrec.below a → motive f a → Nat.Partrec.below a_1 → motive g a_1 → Nat.Partrec.below ⋯
ctor Nat.Partrec.below.right E0 #
∀ {motive : (a : ℕ →. ℕ) → Nat.Partrec a → Prop}, Nat.Partrec.below Nat.Partrec.right
ctor Nat.Partrec.below.zero E0 #
∀ {motive : (a : ℕ →. ℕ) → Nat.Partrec a → Prop}, Nat.Partrec.below Nat.Partrec.zero
ctor Nat.Partrec.below.prec E0 #
∀ {motive : (a : ℕ →. ℕ) → Nat.Partrec a → Prop} {f g : ℕ →. ℕ} (a : Nat.Partrec f) (a_1 : Nat.Partrec g),
Nat.Partrec.below a → motive f a → Nat.Partrec.below a_1 → motive g a_1 → Nat.Partrec.below ⋯
def Nat.rfindX E1 #
(p : ℕ →. Bool) → (∃ n, true ∈ p n ∧ ∀ k < n, (p k).Dom) → { n // true ∈ p n ∧ ∀ m < n, false ∈ p m }
Find the smallest n satisfying p n, where all p k for k < n are defined as false.
Returns a subtype.
def Nat.rfind E1 #
(ℕ →. Bool) → Part ℕ
Find the smallest n satisfying p n, where all p k for k < n are defined as false.
Returns a Part.
theorem Nat.rfind_spec E1 #
∀ {p : ℕ →. Bool} {n : ℕ}, n ∈ Nat.rfind p → true ∈ p n
theorem Nat.rfind_min E1 #
∀ {p : ℕ →. Bool} {n : ℕ}, n ∈ Nat.rfind p → ∀ {m : ℕ}, m < n → false ∈ p m
theorem Nat.rfind_dom E0 #
∀ {p : ℕ →. Bool}, (Nat.rfind p).Dom ↔ ∃ n, true ∈ p n ∧ ∀ {m : ℕ}, m < n → (p m).Dom
theorem Nat.rfind_dom' E1 #
∀ {p : ℕ →. Bool}, (Nat.rfind p).Dom ↔ ∃ n, true ∈ p n ∧ ∀ {m : ℕ}, m ≤ n → (p m).Dom
theorem Nat.mem_rfind E0 #
∀ {p : ℕ →. Bool} {n : ℕ}, n ∈ Nat.rfind p ↔ true ∈ p n ∧ ∀ {m : ℕ}, m < n → false ∈ p m
theorem Nat.rfind_min' E1 #
∀ {p : ℕ → Bool} {m : ℕ}, p m = true → ∃ n ∈ Nat.rfind ↑p, n ≤ m
theorem Nat.rfind_zero_none E1 #
∀ (p : ℕ →. Bool), p 0 = Part.none → Nat.rfind p = Part.none
def Nat.rfindOpt E1 #
{α : Type u_1} → (ℕ → Option α) → Part α
Find the smallest n satisfying f n, where all f k for k < n are defined as false.
Returns a Part.
theorem Nat.rfindOpt_spec E1 #
∀ {α : Type u_1} {f : ℕ → Option α} {a : α}, a ∈ Nat.rfindOpt f → ∃ n, a ∈ f n
theorem Nat.rfindOpt_dom E1 #
∀ {α : Type u_1} {f : ℕ → Option α}, (Nat.rfindOpt f).Dom ↔ ∃ n a, a ∈ f n
theorem Nat.rfindOpt_mono E1 #
∀ {α : Type u_1} {f : ℕ → Option α},
(∀ {a : α} {m n : ℕ}, m ≤ n → a ∈ f m → a ∈ f n) → ∀ {a : α}, a ∈ Nat.rfindOpt f ↔ ∃ n, a ∈ f n
inductive Nat.Partrec E1 #
(ℕ →. ℕ) → Prop
Nat.Partrec f means that the partial function f : ℕ →. ℕ is partially recursive.
ctor Nat.Partrec.zero E0 #
Nat.Partrec (pure 0)
ctor Nat.Partrec.succ E0 #
Nat.Partrec ↑Nat.succ
ctor Nat.Partrec.left E0 #
Nat.Partrec ↑fun n ↦ (Nat.unpair n).1
ctor Nat.Partrec.right E0 #
Nat.Partrec ↑fun n ↦ (Nat.unpair n).2
ctor Nat.Partrec.pair E0 #
∀ {f g : ℕ →. ℕ}, Nat.Partrec f → Nat.Partrec g → Nat.Partrec fun n ↦ Nat.pair <$> f n <*> g n
ctor Nat.Partrec.comp E0 #
∀ {f g : ℕ →. ℕ}, Nat.Partrec f → Nat.Partrec g → Nat.Partrec fun n ↦ g n >>= f
ctor Nat.Partrec.prec E0 #
∀ {f g : ℕ →. ℕ},
Nat.Partrec f →
Nat.Partrec g →
Nat.Partrec
(Nat.unpaired fun a n ↦
Nat.rec (f a)
(fun y IH ↦ do
let i ← IH
g (Nat.pair a (Nat.pair y i)))
n)
ctor Nat.Partrec.rfind E0 #
∀ {f : ℕ →. ℕ}, Nat.Partrec f → Nat.Partrec fun a ↦ Nat.rfind fun n ↦ (fun m ↦ decide (m = 0)) <$> f (Nat.pair a n)
theorem Nat.Partrec.of_eq E0 #
∀ {f g : ℕ →. ℕ}, Nat.Partrec f → (∀ (n : ℕ), f n = g n) → Nat.Partrec g
theorem Nat.Partrec.of_eq_tot E1 #
∀ {f : ℕ →. ℕ} {g : ℕ → ℕ}, Nat.Partrec f → (∀ (n : ℕ), g n ∈ f n) → Nat.Partrec ↑g
theorem Nat.Partrec.of_primrec E1 #
∀ {f : ℕ → ℕ}, Nat.Primrec f → Nat.Partrec ↑f
theorem Nat.Partrec.some E1 #
Nat.Partrec Part.some
theorem Nat.Partrec.none E1 #
Nat.Partrec fun x ↦ Part.none
theorem Nat.Partrec.prec' E1 #
∀ {f g h : ℕ →. ℕ},
Nat.Partrec f →
Nat.Partrec g →
Nat.Partrec h →
Nat.Partrec fun a ↦
(f a).bind fun n ↦
Nat.rec (g a)
(fun y IH ↦ do
let i ← IH
h (Nat.pair a (Nat.pair y i)))
n
theorem Nat.Partrec.ppred E1 #
Nat.Partrec fun n ↦ ↑n.ppred
def Partrec E1 #
{α : Type u_1} → {σ : Type u_2} → [Primcodable α] → [Primcodable σ] → (α →. σ) → Prop
Partially recursive partial functions α → σ between Primcodable types
def Partrec₂ E1 #
{α : Type u_1} →
{β : Type u_2} → {σ : Type u_3} → [Primcodable α] → [Primcodable β] → [Primcodable σ] → (α → β →. σ) → Prop
Partially recursive partial functions α → β → σ between Primcodable types
def Computable E3 #
{α : Type u_1} → {σ : Type u_2} → [Primcodable α] → [Primcodable σ] → (α → σ) → Prop
Computable functions α → σ between Primcodable types:
a function is computable if and only if it is partially recursive (as a partial function)
def Computable₂ E1 #
{α : Type u_1} →
{β : Type u_2} → {σ : Type u_3} → [Primcodable α] → [Primcodable β] → [Primcodable σ] → (α → β → σ) → Prop
Computable functions α → β → σ between Primcodable types
theorem Primrec.to_comp E1 #
∀ {α : Type u_1} {σ : Type u_2} [inst : Primcodable α] [inst_1 : Primcodable σ] {f : α → σ}, Primrec f → Computable f
theorem Primrec₂.to_comp E1 #
∀ {α : Type u_1} {β : Type u_2} {σ : Type u_3} [inst : Primcodable α] [inst_1 : Primcodable β] [inst_2 : Primcodable σ]
{f : α → β → σ}, Primrec₂ f → Computable₂ f
theorem Computable.partrec E1 #
∀ {α : Type u_1} {σ : Type u_2} [inst : Primcodable α] [inst_1 : Primcodable σ] {f : α → σ}, Computable f → Partrec ↑f
theorem Computable₂.partrec₂ E1 #
∀ {α : Type u_1} {β : Type u_2} {σ : Type u_3} [inst : Primcodable α] [inst_1 : Primcodable β] [inst_2 : Primcodable σ]
{f : α → β → σ}, Computable₂ f → Partrec₂ fun a ↦ ↑(f a)
theorem Computable.of_eq E0 #
∀ {α : Type u_1} {σ : Type u_4} [inst : Primcodable α] [inst_1 : Primcodable σ] {f g : α → σ},
Computable f → (∀ (n : α), f n = g n) → Computable g
theorem Computable.const E1 #
∀ {α : Type u_1} {σ : Type u_4} [inst : Primcodable α] [inst_1 : Primcodable σ] (s : σ), Computable fun x ↦ s
theorem Computable.ofOption E1 #
∀ {α : Type u_1} {β : Type u_2} [inst : Primcodable α] [inst_1 : Primcodable β] {f : α → Option β},
Computable f → Partrec fun a ↦ ↑(f a)
theorem Computable.to₂ E1 #
∀ {α : Type u_1} {β : Type u_2} {σ : Type u_4} [inst : Primcodable α] [inst_1 : Primcodable β] [inst_2 : Primcodable σ]
{f : α × β → σ}, Computable f → Computable₂ fun a b ↦ f (a, b)
theorem Computable.id E1 #
∀ {α : Type u_1} [inst : Primcodable α], Computable id
theorem Computable.fst E1 #
∀ {α : Type u_1} {β : Type u_2} [inst : Primcodable α] [inst_1 : Primcodable β], Computable Prod.fst
theorem Computable.snd E1 #
∀ {α : Type u_1} {β : Type u_2} [inst : Primcodable α] [inst_1 : Primcodable β], Computable Prod.snd
theorem Computable.pair E1 #
∀ {α : Type u_1} {β : Type u_2} {γ : Type u_3} [inst : Primcodable α] [inst_1 : Primcodable β] [inst_2 : Primcodable γ]
{f : α → β} {g : α → γ}, Computable f → Computable g → Computable fun a ↦ (f a, g a)
theorem Computable.unpair E1 #
Computable Nat.unpair
theorem Computable.succ E1 #
Computable Nat.succ
theorem Computable.pred E1 #
Computable Nat.pred
theorem Computable.nat_bodd E1 #
Computable Nat.bodd
theorem Computable.nat_div2 E1 #
Computable Nat.div2
theorem Computable.sumInl E1 #
∀ {α : Type u_1} {β : Type u_2} [inst : Primcodable α] [inst_1 : Primcodable β], Computable Sum.inl
theorem Computable.sumInr E1 #
∀ {α : Type u_1} {β : Type u_2} [inst : Primcodable α] [inst_1 : Primcodable β], Computable Sum.inr
theorem Computable.list_cons E1 #
∀ {α : Type u_1} [inst : Primcodable α], Computable₂ List.cons
theorem Computable.list_reverse E1 #
∀ {α : Type u_1} [inst : Primcodable α], Computable List.reverse
theorem Computable.list_getElem? E1 #
∀ {α : Type u_1} [inst : Primcodable α], Computable₂ fun x1 x2 ↦ x1[x2]?
theorem Computable.list_append E1 #
∀ {α : Type u_1} [inst : Primcodable α], Computable₂ fun x1 x2 ↦ x1 ++ x2
theorem Computable.list_concat E1 #
∀ {α : Type u_1} [inst : Primcodable α], Computable₂ fun l a ↦ l ++ [a]
theorem Computable.list_length E1 #
∀ {α : Type u_1} [inst : Primcodable α], Computable List.length
theorem Computable.vector_cons E1 #
∀ {α : Type u_1} [inst : Primcodable α] {n : ℕ}, Computable₂ List.Vector.cons
theorem Computable.vector_toList E1 #
∀ {α : Type u_1} [inst : Primcodable α] {n : ℕ}, Computable List.Vector.toList
theorem Computable.vector_length E1 #
∀ {α : Type u_1} [inst : Primcodable α] {n : ℕ}, Computable List.Vector.length
theorem Computable.vector_head E1 #
∀ {α : Type u_1} [inst : Primcodable α] {n : ℕ}, Computable List.Vector.head
theorem Computable.vector_tail E1 #
∀ {α : Type u_1} [inst : Primcodable α] {n : ℕ}, Computable List.Vector.tail
theorem Computable.vector_get E1 #
∀ {α : Type u_1} [inst : Primcodable α] {n : ℕ}, Computable₂ List.Vector.get
theorem Computable.vector_ofFn' E1 #
∀ {α : Type u_1} [inst : Primcodable α] {n : ℕ}, Computable List.Vector.ofFn
theorem Computable.fin_app E1 #
∀ {σ : Type u_4} [inst : Primcodable σ] {n : ℕ}, Computable₂ id
theorem Computable.encode E1 #
∀ {α : Type u_1} [inst : Primcodable α], Computable Encodable.encode
theorem Computable.decode E1 #
∀ {α : Type u_1} [inst : Primcodable α], Computable Encodable.decode
theorem Computable.ofNat E1 #
∀ (α : Type u_5) [inst : Denumerable α], Computable (Denumerable.ofNat α)
theorem Computable.encode_iff E0 #
∀ {α : Type u_1} {σ : Type u_4} [inst : Primcodable α] [inst_1 : Primcodable σ] {f : α → σ},
(Computable fun a ↦ Encodable.encode (f a)) ↔ Computable f
theorem Computable.option_some E1 #
∀ {α : Type u_1} [inst : Primcodable α], Computable some
theorem Partrec.of_eq E0 #
∀ {α : Type u_1} {σ : Type u_3} [inst : Primcodable α] [inst_1 : Primcodable σ] {f g : α →. σ},
Partrec f → (∀ (n : α), f n = g n) → Partrec g
theorem Partrec.of_eq_tot E1 #
∀ {α : Type u_1} {σ : Type u_3} [inst : Primcodable α] [inst_1 : Primcodable σ] {f : α →. σ} {g : α → σ},
Partrec f → (∀ (n : α), g n ∈ f n) → Computable g
theorem Partrec.none E1 #
∀ {α : Type u_1} {σ : Type u_3} [inst : Primcodable α] [inst_1 : Primcodable σ], Partrec fun x ↦ Part.none
theorem Partrec.some E1 #
∀ {α : Type u_1} [inst : Primcodable α], Partrec Part.some
theorem Decidable.Partrec.const' E1 #
∀ {α : Type u_1} {σ : Type u_3} [inst : Primcodable α] [inst_1 : Primcodable σ] (s : Part σ) [Decidable s.Dom],
Partrec fun x ↦ s
theorem Partrec.const' E1 #
∀ {α : Type u_1} {σ : Type u_3} [inst : Primcodable α] [inst_1 : Primcodable σ] (s : Part σ), Partrec fun x ↦ s
theorem Partrec.bind E1 #
∀ {α : Type u_1} {β : Type u_2} {σ : Type u_3} [inst : Primcodable α] [inst_1 : Primcodable β] [inst_2 : Primcodable σ]
{f : α →. β} {g : α → β →. σ}, Partrec f → Partrec₂ g → Partrec fun a ↦ (f a).bind (g a)
theorem Partrec.map E1 #
∀ {α : Type u_1} {β : Type u_2} {σ : Type u_3} [inst : Primcodable α] [inst_1 : Primcodable β] [inst_2 : Primcodable σ]
{f : α →. β} {g : α → β → σ}, Partrec f → Computable₂ g → Partrec fun a ↦ Part.map (g a) (f a)
theorem Partrec.to₂ E1 #
∀ {α : Type u_1} {β : Type u_2} {σ : Type u_3} [inst : Primcodable α] [inst_1 : Primcodable β] [inst_2 : Primcodable σ]
{f : α × β →. σ}, Partrec f → Partrec₂ fun a b ↦ f (a, b)
theorem Partrec.nat_rec E1 #
∀ {α : Type u_1} {σ : Type u_3} [inst : Primcodable α] [inst_1 : Primcodable σ] {f : α → ℕ} {g : α →. σ}
{h : α → ℕ × σ →. σ},
Computable f → Partrec g → Partrec₂ h → Partrec fun a ↦ Nat.rec (g a) (fun y IH ↦ IH.bind fun i ↦ h a (y, i)) (f a)
theorem Partrec.comp E1 #
∀ {α : Type u_1} {β : Type u_2} {σ : Type u_3} [inst : Primcodable α] [inst_1 : Primcodable β] [inst_2 : Primcodable σ]
{f : β →. σ} {g : α → β}, Partrec f → Computable g → Partrec fun a ↦ f (g a)
theorem Partrec.nat_iff E0 #
∀ {f : ℕ →. ℕ}, Partrec f ↔ Nat.Partrec f
theorem Partrec.map_encode_iff E0 #
∀ {α : Type u_1} {σ : Type u_3} [inst : Primcodable α] [inst_1 : Primcodable σ] {f : α →. σ},
(Partrec fun a ↦ Part.map Encodable.encode (f a)) ↔ Partrec f
theorem Partrec₂.unpaired E1 #
∀ {α : Type u_1} [inst : Primcodable α] {f : ℕ → ℕ →. α}, Partrec (Nat.unpaired f) ↔ Partrec₂ f
theorem Partrec₂.unpaired' E1 #
∀ {f : ℕ → ℕ →. ℕ}, Nat.Partrec (Nat.unpaired f) ↔ Partrec₂ f
theorem Partrec₂.comp E1 #
∀ {α : Type u_1} {β : Type u_2} {γ : Type u_3} {σ : Type u_5} [inst : Primcodable α] [inst_1 : Primcodable β]
[inst_2 : Primcodable γ] [inst_3 : Primcodable σ] {f : β → γ →. σ} {g : α → β} {h : α → γ},
Partrec₂ f → Computable g → Computable h → Partrec fun a ↦ f (g a) (h a)
theorem Partrec₂.comp₂ E1 #
∀ {α : Type u_1} {β : Type u_2} {γ : Type u_3} {δ : Type u_4} {σ : Type u_5} [inst : Primcodable α]
[inst_1 : Primcodable β] [inst_2 : Primcodable γ] [inst_3 : Primcodable δ] [inst_4 : Primcodable σ] {f : γ → δ →. σ}
{g : α → β → γ} {h : α → β → δ}, Partrec₂ f → Computable₂ g → Computable₂ h → Partrec₂ fun a b ↦ f (g a b) (h a b)
theorem Computable.comp E1 #
∀ {α : Type u_1} {β : Type u_2} {σ : Type u_4} [inst : Primcodable α] [inst_1 : Primcodable β] [inst_2 : Primcodable σ]
{f : β → σ} {g : α → β}, Computable f → Computable g → Computable fun a ↦ f (g a)
theorem Computable.comp₂ E1 #
∀ {α : Type u_1} {β : Type u_2} {γ : Type u_3} {σ : Type u_4} [inst : Primcodable α] [inst_1 : Primcodable β]
[inst_2 : Primcodable γ] [inst_3 : Primcodable σ] {f : γ → σ} {g : α → β → γ},
Computable f → Computable₂ g → Computable₂ fun a b ↦ f (g a b)
theorem Computable₂.mk E1 #
∀ {α : Type u_1} {β : Type u_2} {σ : Type u_5} [inst : Primcodable α] [inst_1 : Primcodable β] [inst_2 : Primcodable σ]
{f : α → β → σ}, (Computable fun p ↦ f p.1 p.2) → Computable₂ f
theorem Computable₂.comp E1 #
∀ {α : Type u_1} {β : Type u_2} {γ : Type u_3} {σ : Type u_5} [inst : Primcodable α] [inst_1 : Primcodable β]
[inst_2 : Primcodable γ] [inst_3 : Primcodable σ] {f : β → γ → σ} {g : α → β} {h : α → γ},
Computable₂ f → Computable g → Computable h → Computable fun a ↦ f (g a) (h a)
theorem Computable₂.comp₂ E1 #
∀ {α : Type u_1} {β : Type u_2} {γ : Type u_3} {δ : Type u_4} {σ : Type u_5} [inst : Primcodable α]
[inst_1 : Primcodable β] [inst_2 : Primcodable γ] [inst_3 : Primcodable δ] [inst_4 : Primcodable σ] {f : γ → δ → σ}
{g : α → β → γ} {h : α → β → δ},
Computable₂ f → Computable₂ g → Computable₂ h → Computable₂ fun a b ↦ f (g a b) (h a b)
theorem Partrec.rfind E1 #
∀ {α : Type u_1} [inst : Primcodable α] {p : α → ℕ →. Bool}, Partrec₂ p → Partrec fun a ↦ Nat.rfind (p a)
theorem Partrec.rfindOpt E1 #
∀ {α : Type u_1} {σ : Type u_2} [inst : Primcodable α] [inst_1 : Primcodable σ] {f : α → ℕ → Option σ},
Computable₂ f → Partrec fun a ↦ Nat.rfindOpt (f a)
theorem Partrec.nat_casesOn_right E1 #
∀ {α : Type u_1} {σ : Type u_2} [inst : Primcodable α] [inst_1 : Primcodable σ] {f : α → ℕ} {g : α → σ}
{h : α → ℕ →. σ}, Computable f → Computable g → Partrec₂ h → Partrec fun a ↦ Nat.casesOn (f a) (Part.some (g a)) (h a)
theorem Partrec.bind_decode₂_iff E0 #
∀ {α : Type u_1} {σ : Type u_2} [inst : Primcodable α] [inst_1 : Primcodable σ] {f : α →. σ},
Partrec f ↔ Nat.Partrec fun n ↦ (↑(Encodable.decode₂ α n)).bind fun a ↦ Part.map Encodable.encode (f a)
theorem Partrec.vector_mOfFn E1 #
∀ {α : Type u_1} {σ : Type u_2} [inst : Primcodable α] [inst_1 : Primcodable σ] {n : ℕ} {f : Fin n → α →. σ},
(∀ (i : Fin n), Partrec (f i)) → Partrec fun a ↦ List.Vector.mOfFn fun i ↦ f i a
theorem Vector.mOfFn_part_some E0 #
∀ {α : Type u_1} {n : ℕ} (f : Fin n → α), (List.Vector.mOfFn fun i ↦ Part.some (f i)) = Part.some (List.Vector.ofFn f)
theorem Computable.option_some_iff E0 #
∀ {α : Type u_1} {σ : Type u_4} [inst : Primcodable α] [inst_1 : Primcodable σ] {f : α → σ},
(Computable fun a ↦ some (f a)) ↔ Computable f
theorem Computable.bind_decode_iff E0 #
∀ {α : Type u_1} {β : Type u_2} {σ : Type u_4} [inst : Primcodable α] [inst_1 : Primcodable β] [inst_2 : Primcodable σ]
{f : α → β → Option σ}, (Computable₂ fun a n ↦ (Encodable.decode n).bind (f a)) ↔ Computable₂ f
theorem Computable.map_decode_iff E0 #
∀ {α : Type u_1} {β : Type u_2} {σ : Type u_4} [inst : Primcodable α] [inst_1 : Primcodable β] [inst_2 : Primcodable σ]
{f : α → β → σ}, (Computable₂ fun a n ↦ Option.map (f a) (Encodable.decode n)) ↔ Computable₂ f
theorem Computable.nat_rec E1 #
∀ {α : Type u_1} {σ : Type u_4} [inst : Primcodable α] [inst_1 : Primcodable σ] {f : α → ℕ} {g : α → σ}
{h : α → ℕ × σ → σ},
Computable f → Computable g → Computable₂ h → Computable fun a ↦ Nat.rec (g a) (fun y IH ↦ h a (y, IH)) (f a)
theorem Computable.nat_casesOn E1 #
∀ {α : Type u_1} {σ : Type u_4} [inst : Primcodable α] [inst_1 : Primcodable σ] {f : α → ℕ} {g : α → σ} {h : α → ℕ → σ},
Computable f → Computable g → Computable₂ h → Computable fun a ↦ Nat.casesOn (f a) (g a) (h a)
theorem Computable.cond E1 #
∀ {α : Type u_1} {σ : Type u_4} [inst : Primcodable α] [inst_1 : Primcodable σ] {c : α → Bool} {f g : α → σ},
Computable c → Computable f → Computable g → Computable fun a ↦ bif c a then f a else g a
theorem Computable.option_casesOn E1 #
∀ {α : Type u_1} {β : Type u_2} {σ : Type u_4} [inst : Primcodable α] [inst_1 : Primcodable β] [inst_2 : Primcodable σ]
{o : α → Option β} {f : α → σ} {g : α → β → σ},
Computable o → Computable f → Computable₂ g → Computable fun a ↦ Option.casesOn (o a) (f a) (g a)
theorem Computable.option_bind E1 #
∀ {α : Type u_1} {β : Type u_2} {σ : Type u_4} [inst : Primcodable α] [inst_1 : Primcodable β] [inst_2 : Primcodable σ]
{f : α → Option β} {g : α → β → Option σ}, Computable f → Computable₂ g → Computable fun a ↦ (f a).bind (g a)
theorem Computable.option_map E1 #
∀ {α : Type u_1} {β : Type u_2} {σ : Type u_4} [inst : Primcodable α] [inst_1 : Primcodable β] [inst_2 : Primcodable σ]
{f : α → Option β} {g : α → β → σ}, Computable f → Computable₂ g → Computable fun a ↦ Option.map (g a) (f a)
theorem Computable.option_getD E1 #
∀ {α : Type u_1} {β : Type u_2} [inst : Primcodable α] [inst_1 : Primcodable β] {f : α → Option β} {g : α → β},
Computable f → Computable g → Computable fun a ↦ (f a).getD (g a)
theorem Computable.subtype_mk E0 #
∀ {α : Type u_1} {β : Type u_2} [inst : Primcodable α] [inst_1 : Primcodable β] {f : α → β} {p : β → Prop}
[inst_2 : DecidablePred p] {h : ∀ (a : α), p (f a)} (hp : PrimrecPred p), Computable f → Computable fun a ↦ ⟨f a, ⋯⟩
theorem Computable.sumCasesOn E1 #
∀ {α : Type u_1} {β : Type u_2} {γ : Type u_3} {σ : Type u_4} [inst : Primcodable α] [inst_1 : Primcodable β]
[inst_2 : Primcodable γ] [inst_3 : Primcodable σ] {f : α → β ⊕ γ} {g : α → β → σ} {h : α → γ → σ},
Computable f → Computable₂ g → Computable₂ h → Computable fun a ↦ Sum.casesOn (f a) (g a) (h a)
theorem Computable.nat_strong_rec E1 #
∀ {α : Type u_1} {σ : Type u_4} [inst : Primcodable α] [inst_1 : Primcodable σ] (f : α → ℕ → σ)
{g : α → List σ → Option σ},
Computable₂ g → (∀ (a : α) (n : ℕ), g a (List.map (f a) (List.range n)) = some (f a n)) → Computable₂ f
theorem Computable.list_ofFn E1 #
∀ {α : Type u_1} {σ : Type u_4} [inst : Primcodable α] [inst_1 : Primcodable σ] {n : ℕ} {f : Fin n → α → σ},
(∀ (i : Fin n), Computable (f i)) → Computable fun a ↦ List.ofFn fun i ↦ f i a
theorem Computable.vector_ofFn E1 #
∀ {α : Type u_1} {σ : Type u_4} [inst : Primcodable α] [inst_1 : Primcodable σ] {n : ℕ} {f : Fin n → α → σ},
(∀ (i : Fin n), Computable (f i)) → Computable fun a ↦ List.Vector.ofFn fun i ↦ f i a
theorem Partrec.option_some_iff E0 #
∀ {α : Type u_1} {σ : Type u_4} [inst : Primcodable α] [inst_1 : Primcodable σ] {f : α →. σ},
(Partrec fun a ↦ Part.map some (f a)) ↔ Partrec f
theorem Partrec.optionCasesOn_right E1 #
∀ {α : Type u_1} {β : Type u_2} {σ : Type u_4} [inst : Primcodable α] [inst_1 : Primcodable β] [inst_2 : Primcodable σ]
{o : α → Option β} {f : α → σ} {g : α → β →. σ},
Computable o → Computable f → Partrec₂ g → Partrec fun a ↦ Option.casesOn (o a) (Part.some (f a)) (g a)
theorem Partrec.sumCasesOn_right E1 #
∀ {α : Type u_1} {β : Type u_2} {γ : Type u_3} {σ : Type u_4} [inst : Primcodable α] [inst_1 : Primcodable β]
[inst_2 : Primcodable γ] [inst_3 : Primcodable σ] {f : α → β ⊕ γ} {g : α → β → σ} {h : α → γ →. σ},
Computable f → Computable₂ g → Partrec₂ h → Partrec fun a ↦ Sum.casesOn (f a) (fun b ↦ Part.some (g a b)) (h a)
theorem Partrec.sumCasesOn_left E1 #
∀ {α : Type u_1} {β : Type u_2} {γ : Type u_3} {σ : Type u_4} [inst : Primcodable α] [inst_1 : Primcodable β]
[inst_2 : Primcodable γ] [inst_3 : Primcodable σ] {f : α → β ⊕ γ} {g : α → β →. σ} {h : α → γ → σ},
Computable f → Partrec₂ g → Computable₂ h → Partrec fun a ↦ Sum.casesOn (f a) (g a) fun c ↦ Part.some (h a c)
theorem Partrec.fix_aux E0 #
∀ {α : Type u_5} {σ : Type u_6} (f : α →. σ ⊕ α) (a : α) (b : σ),
have F := fun a n ↦
Nat.rec (Part.some (Sum.inr a)) (fun x IH ↦ IH.bind fun s ↦ Sum.casesOn s (fun x ↦ Part.some s) f) n;
(∃ n, ((∃ b', Sum.inl b' ∈ F a n) ∧ ∀ {m : ℕ}, m < n → ∃ b, Sum.inr b ∈ F a m) ∧ Sum.inl b ∈ F a n) ↔ b ∈ f.fix a
theorem Partrec.fix E1 #
∀ {α : Type u_1} {σ : Type u_4} [inst : Primcodable α] [inst_1 : Primcodable σ] {f : α →. σ ⊕ α},
Partrec f → Partrec f.fix