File: Mathlib/Computability/Halting.lean

full_name: Nat.Partrec.merge'
code: theorem merge' {f g} (hf : Nat.Partrec f) (hg : Nat.Partrec g) :
    ∃ h, Nat.Partrec h ∧
      ∀ a, (∀ x ∈ h a, x ∈ f a ∨ x ∈ g a) ∧ ((h a).Dom ↔ (f a).Dom ∨ (g a).Dom) 
goal: ∃ h, Nat.Partrec h ∧ ∀ (a : ℕ), (∀ x ∈ h a, x ∈ f a ∨ x ∈ g a) ∧ ((h a).Dom ↔ (f a).Dom ∨ (g a).Dom)

full_name: Partrec.merge'
code: theorem merge' {f g : α →. σ} (hf : Partrec f) (hg : Partrec g) :
    ∃ k : α →. σ,
      Partrec k ∧ ∀ a, (∀ x ∈ k a, x ∈ f a ∨ x ∈ g a) ∧ ((k a).Dom ↔ (f a).Dom ∨ (g a).Dom) 
goal: ∃ k, Partrec k ∧ ∀ (a : α), (∀ x ∈ k a, x ∈ f a ∨ x ∈ g a) ∧ ((k a).Dom ↔ (f a).Dom ∨ (g a).Dom)

full_name: Partrec.merge
code: theorem merge {f g : α →. σ} (hf : Partrec f) (hg : Partrec g)
    (H : ∀ (a), ∀ x ∈ f a, ∀ y ∈ g a, x = y) :
    ∃ k : α →. σ, Partrec k ∧ ∀ a x, x ∈ k a ↔ x ∈ f a ∨ x ∈ g a 
goal: ∃ k, Partrec k ∧ ∀ (a : α) (x : σ), x ∈ k a ↔ x ∈ f a ∨ x ∈ g a

full_name: Partrec.cond
code: theorem cond {c : α → Bool} {f : α →. σ} {g : α →. σ} (hc : Computable c) (hf : Partrec f)
    (hg : Partrec g) : Partrec fun a => cond (c a) (f a) (g a) 
goal: Partrec fun a => bif c a then f a else g a

full_name: Partrec.sum_casesOn
code: nonrec theorem sum_casesOn {f : α → β ⊕ γ} {g : α → β →. σ} {h : α → γ →. σ} (hf : Computable f)
    (hg : Partrec₂ g) (hh : Partrec₂ h) : @Partrec _ σ _ _ fun a => Sum.casesOn (f a) (g a) (h a) 
goal: Partrec fun a => Sum.casesOn (f a) (g a) (h a)

full_name: ComputablePred
code: /-- A computable predicate is one whose indicator function is computable. -/
def ComputablePred {α} [Primcodable α] (p : α → Prop) 
goal: Prop

full_name: RePred
code: /-- A recursively enumerable predicate is one which is the domain of a computable partial function.
 -/
def RePred {α} [Primcodable α] (p : α → Prop) 
goal: Prop

full_name: RePred.of_eq
code: theorem RePred.of_eq {α} [Primcodable α] {p q : α → Prop} (hp : RePred p) (H : ∀ a, p a ↔ q a) :
    RePred q 
goal: RePred q

full_name: Partrec.dom_re
code: theorem Partrec.dom_re {α β} [Primcodable α] [Primcodable β] {f : α →. β} (h : Partrec f) :
    RePred fun a => (f a).Dom 
goal: RePred fun a => (f a).Dom

full_name: ComputablePred.of_eq
code: theorem ComputablePred.of_eq {α} [Primcodable α] {p q : α → Prop} (hp : ComputablePred p)
    (H : ∀ a, p a ↔ q a) : ComputablePred q 
goal: ComputablePred q

full_name: ComputablePred.computable_iff
code: theorem computable_iff {p : α → Prop} :
    ComputablePred p ↔ ∃ f : α → Bool, Computable f ∧ p = fun a => (f a : Prop) 
goal: ComputablePred p ↔ ∃ f, Computable f ∧ p = fun a => f a = true

full_name: ComputablePred.not
code: protected theorem not {p : α → Prop} (hp : ComputablePred p) : ComputablePred fun a => ¬p a 
goal: ComputablePred fun a => ¬p a

full_name: ComputablePred.to_re
code: theorem to_re {p : α → Prop} (hp : ComputablePred p) : RePred p 
goal: RePred p

full_name: ComputablePred.rice
code: /-- **Rice's Theorem** -/
theorem rice (C : Set (ℕ →. ℕ)) (h : ComputablePred fun c => eval c ∈ C) {f g} (hf : Nat.Partrec f)
    (hg : Nat.Partrec g) (fC : f ∈ C) : g ∈ C 
goal: g ∈ C

full_name: ComputablePred.rice₂
code: theorem rice₂ (C : Set Code) (H : ∀ cf cg, eval cf = eval cg → (cf ∈ C ↔ cg ∈ C)) :
    (ComputablePred fun c => c ∈ C) ↔ C = ∅ ∨ C = Set.univ 
goal: (ComputablePred fun c => c ∈ C) ↔ C = ∅ ∨ C = Set.univ

full_name: ComputablePred.halting_problem_re
code: /-- The Halting problem is recursively enumerable -/
theorem halting_problem_re (n) : RePred fun c => (eval c n).Dom 
goal: RePred fun c => (c.eval n).Dom

full_name: ComputablePred.halting_problem
code: /-- The **Halting problem** is not computable -/
theorem halting_problem (n) : ¬ComputablePred fun c => (eval c n).Dom
  
goal: ¬ComputablePred fun c => (c.eval n).Dom

full_name: ComputablePred.computable_iff_re_compl_re
code: theorem computable_iff_re_compl_re {p : α → Prop} [DecidablePred p] :
    ComputablePred p ↔ RePred p ∧ RePred fun a => ¬p a 
goal: ComputablePred p ↔ RePred p ∧ RePred fun a => ¬p a

full_name: ComputablePred.computable_iff_re_compl_re'
code: theorem computable_iff_re_compl_re' {p : α → Prop} :
    ComputablePred p ↔ RePred p ∧ RePred fun a => ¬p a 
goal: ComputablePred p ↔ RePred p ∧ RePred fun a => ¬p a

full_name: ComputablePred.halting_problem_not_re
code: theorem halting_problem_not_re (n) : ¬RePred fun c => ¬(eval c n).Dom
  
goal: ¬RePred fun c => ¬(c.eval n).Dom

full_name: Nat.Partrec'.rfind
code: /-- A simplified basis for `Partrec`. -/
inductive Partrec' : ∀ {n}, (Vector ℕ n →. ℕ) → Prop
  | prim {n f} : @Primrec' n f → @Partrec' n f
  | comp {m n f} (g : Fin n → Vector ℕ m →. ℕ) :
    Partrec' f → (∀ i, Partrec' (g i)) → Partrec' fun v => (Vector.mOfFn fun i => g i v) >>= f
  | rfind {n} {f : Vector ℕ (n + 1) → ℕ} :
    @Partrec' (n + 1) f → Partrec' fun v => rfind fun n => some (f (n ::ᵥ v) = 0)
goal: Nat.Partrec' ↑f → Nat.Partrec' fun v => Nat.rfind fun n_1 => Part.some (decide (f (n_1 ::ᵥ v) = 0))

full_name: Nat.Partrec'.prim
code: /-- A simplified basis for `Partrec`. -/
inductive Partrec' : ∀ {n}, (Vector ℕ n →. ℕ) → Prop
  | prim {n f} : @Primrec' n f → @Partrec' n f
  | comp {m n f} (g : Fin n → Vector ℕ m →. ℕ) :
    Partrec' f → (∀ i, Partrec' (g i)) → Partrec' fun v => (Vector.mOfFn fun i => g i v) >>= f
  | rfind {n} {f : Vector ℕ (n + 1) → ℕ} :
    @Partrec' (n + 1) f → Partrec' fun v => rfind fun n => some (f (n ::ᵥ v) = 0)
goal: Nat.Primrec' f → Nat.Partrec' ↑f

full_name: Nat.Partrec'
code: /-- A simplified basis for `Partrec`. -/
inductive Partrec' : ∀ {n}, (Vector ℕ n →. ℕ) → Prop
  | prim {n f} : @Primrec' n f → @Partrec' n f
  | comp {m n f} (g : Fin n → Vector ℕ m →. ℕ) :
    Partrec' f → (∀ i, Partrec' (g i)) → Partrec' fun v => (Vector.mOfFn fun i => g i v) >>= f
  | rfind {n} {f : Vector ℕ (n + 1) → ℕ} :
    @Partrec' (n + 1) f → Partrec' fun v => rfind fun n => some (f (n ::ᵥ v) = 0)
goal: (Mathlib.Vector ℕ n →. ℕ) → Prop

full_name: Nat.Partrec'.comp
code: /-- A simplified basis for `Partrec`. -/
inductive Partrec' : ∀ {n}, (Vector ℕ n →. ℕ) → Prop
  | prim {n f} : @Primrec' n f → @Partrec' n f
  | comp {m n f} (g : Fin n → Vector ℕ m →. ℕ) :
    Partrec' f → (∀ i, Partrec' (g i)) → Partrec' fun v => (Vector.mOfFn fun i => g i v) >>= f
  | rfind {n} {f : Vector ℕ (n + 1) → ℕ} :
    @Partrec' (n + 1) f → Partrec' fun v => rfind fun n => some (f (n ::ᵥ v) = 0)
goal: Nat.Partrec' f → (∀ (i : Fin n), Nat.Partrec' (g i)) → Nat.Partrec' fun v => (Mathlib.Vector.mOfFn fun i => g i v) >>= f

full_name: Nat.Partrec'.to_part
code: theorem to_part {n f} (pf : @Partrec' n f) : _root_.Partrec f 
goal: Partrec f

full_name: Nat.Partrec'.of_eq
code: theorem of_eq {n} {f g : Vector ℕ n →. ℕ} (hf : Partrec' f) (H : ∀ i, f i = g i) : Partrec' g 
goal: Nat.Partrec' g

full_name: Nat.Partrec'.of_prim
code: theorem of_prim {n} {f : Vector ℕ n → ℕ} (hf : Primrec f) : @Partrec' n f 
goal: Nat.Partrec' ↑f

full_name: Nat.Partrec'.head
code: theorem head {n : ℕ} : @Partrec' n.succ (@head ℕ n) 
goal: Nat.Partrec' ↑Mathlib.Vector.head

full_name: Nat.Partrec'.tail
code: theorem tail {n f} (hf : @Partrec' n f) : @Partrec' n.succ fun v => f v.tail 
goal: Nat.Partrec' fun v => f v.tail

full_name: Nat.Partrec'.bind
code: protected theorem bind {n f g} (hf : @Partrec' n f) (hg : @Partrec' (n + 1) g) :
    @Partrec' n fun v => (f v).bind fun a => g (a ::ᵥ v) 
goal: Nat.Partrec' fun v => (f v).bind fun a => g (a ::ᵥ v)

full_name: Nat.Partrec'.map
code: protected theorem map {n f} {g : Vector ℕ (n + 1) → ℕ} (hf : @Partrec' n f)
    (hg : @Partrec' (n + 1) g) : @Partrec' n fun v => (f v).map fun a => g (a ::ᵥ v) 
goal: Nat.Partrec' fun v => Part.map (fun a => g (a ::ᵥ v)) (f v)

full_name: Nat.Partrec'.Vec
code: /-- Analogous to `Nat.Partrec'` for `ℕ`-valued functions, a predicate for partial recursive
  vector-valued functions. -/
def Vec {n m} (f : Vector ℕ n → Vector ℕ m) 
goal: Prop

full_name: Nat.Partrec'.Vec.prim
code: nonrec theorem Vec.prim {n m f} (hf : @Nat.Primrec'.Vec n m f) : Vec f 
goal: Nat.Partrec'.Vec f

full_name: Nat.Partrec'.nil
code: protected theorem nil {n} : @Vec n 0 fun _ => nil 
goal: Nat.Partrec'.Vec fun x => Mathlib.Vector.nil

full_name: Nat.Partrec'.cons
code: protected theorem cons {n m} {f : Vector ℕ n → ℕ} {g} (hf : @Partrec' n f) (hg : @Vec n m g) :
    Vec fun v => f v ::ᵥ g v 
goal: Nat.Partrec'.Vec fun v => f v ::ᵥ g v

full_name: Nat.Partrec'.idv
code: theorem idv {n} : @Vec n n id 
goal: Nat.Partrec'.Vec id

full_name: Nat.Partrec'.comp'
code: theorem comp' {n m f g} (hf : @Partrec' m f) (hg : @Vec n m g) : Partrec' fun v => f (g v) 
goal: Nat.Partrec' fun v => f (g v)

full_name: Nat.Partrec'.comp₁
code: theorem comp₁ {n} (f : ℕ →. ℕ) {g : Vector ℕ n → ℕ} (hf : @Partrec' 1 fun v => f v.head)
    (hg : @Partrec' n g) : @Partrec' n fun v => f (g v) 
goal: Nat.Partrec' fun v => f (g v)

full_name: Nat.Partrec'.rfindOpt
code: theorem rfindOpt {n} {f : Vector ℕ (n + 1) → ℕ} (hf : @Partrec' (n + 1) f) :
    @Partrec' n fun v => Nat.rfindOpt fun a => ofNat (Option ℕ) (f (a ::ᵥ v)) 
goal: Nat.Partrec' fun v => Nat.rfindOpt fun a => Denumerable.ofNat (Option ℕ) (f (a ::ᵥ v))

full_name: Nat.Partrec'.of_part
code: theorem of_part : ∀ {n f}, _root_.Partrec f → @Partrec' n f 
goal: Partrec f → Nat.Partrec' f

full_name: Nat.Partrec'.part_iff
code: theorem part_iff {n f} : @Partrec' n f ↔ _root_.Partrec f 
goal: Nat.Partrec' f ↔ Partrec f

full_name: Nat.Partrec'.part_iff₁
code: theorem part_iff₁ {f : ℕ →. ℕ} : (@Partrec' 1 fun v => f v.head) ↔ _root_.Partrec f 
goal: (Nat.Partrec' fun v => f v.head) ↔ Partrec f

full_name: Nat.Partrec'.part_iff₂
code: theorem part_iff₂ {f : ℕ → ℕ →. ℕ} : (@Partrec' 2 fun v => f v.head v.tail.head) ↔ Partrec₂ f 
goal: (Nat.Partrec' fun v => f v.head v.tail.head) ↔ Partrec₂ f

full_name: Nat.Partrec'.vec_iff
code: theorem vec_iff {m n f} : @Vec m n f ↔ Computable f 
goal: Nat.Partrec'.Vec f ↔ Computable f