Theorem: ComputablePred.computable_iff_re_compl_re
File: Mathlib/Computability/Halting.lean

tactic: obtain ⟨k, pk, hk⟩ :=
  Partrec.merge (h₁.map (Computable.const true).to₂) (h₂.map (Computable.const false).to₂)
  (by
    intro a x hx y hy
    simp at hx hy
    cases hy.1 hx.1)
state_before: α : Type u_1
σ : Type ?u.307161
inst✝² : Primcodable α
inst✝¹ : Primcodable σ
p : α → Prop
inst✝ : DecidablePred p
x✝ : RePred p ∧ RePred fun a => ¬p a
h₁ : RePred p
h₂ : RePred fun a => ¬p a
⊢ Computable fun a => decide (p a)

tactic: intro a x hx y hy
state_before: α : Type u_1
σ : Type ?u.307161
inst✝² : Primcodable α
inst✝¹ : Primcodable σ
p : α → Prop
inst✝ : DecidablePred p
x✝ : RePred p ∧ RePred fun a => ¬p a
h₁ : RePred p
h₂ : RePred fun a => ¬p a
⊢ ∀ (a : α) (x : Bool),
    x ∈ Part.map (fun b => true) (Part.assert (p a) fun x => Part.some ()) →
      ∀ (y : Bool), y ∈ Part.map (fun b => false) (Part.assert ((fun a => ¬p a) a) fun x => Part.some ()) → x = y

tactic: simp at hx hy
state_before: α : Type u_1
σ : Type ?u.307161
inst✝² : Primcodable α
inst✝¹ : Primcodable σ
p : α → Prop
inst✝ : DecidablePred p
x✝ : RePred p ∧ RePred fun a => ¬p a
h₁ : RePred p
h₂ : RePred fun a => ¬p a
a : α
x : Bool
hx : x ∈ Part.map (fun b => true) (Part.assert (p a) fun x => Part.some ())
y : Bool
hy : y ∈ Part.map (fun b => false) (Part.assert ((fun a => ¬p a) a) fun x => Part.some ())
⊢ x = y

tactic: cases hy.1 hx.1
state_before: α : Type u_1
σ : Type ?u.307161
inst✝² : Primcodable α
inst✝¹ : Primcodable σ
p : α → Prop
inst✝ : DecidablePred p
x✝ : RePred p ∧ RePred fun a => ¬p a
h₁ : RePred p
h₂ : RePred fun a => ¬p a
a : α
x y : Bool
hx : p a ∧ true = x
hy : ¬p a ∧ false = y
⊢ x = y

tactic: refine' Partrec.of_eq pk fun n => Part.eq_some_iff.2 _
state_before: case intro.intro
α : Type u_1
σ : Type ?u.307161
inst✝² : Primcodable α
inst✝¹ : Primcodable σ
p : α → Prop
inst✝ : DecidablePred p
x✝ : RePred p ∧ RePred fun a => ¬p a
h₁ : RePred p
h₂ : RePred fun a => ¬p a
k : α →. Bool
pk : Partrec k
hk :
  ∀ (a : α) (x : Bool),
    x ∈ k a ↔
      x ∈ Part.map (fun b => true) (Part.assert (p a) fun x => Part.some ()) ∨
        x ∈ Part.map (fun b => false) (Part.assert ((fun a => ¬p a) a) fun x => Part.some ())
⊢ Computable fun a => decide (p a)

tactic: rw [hk]
state_before: case intro.intro
α : Type u_1
σ : Type ?u.307161
inst✝² : Primcodable α
inst✝¹ : Primcodable σ
p : α → Prop
inst✝ : DecidablePred p
x✝ : RePred p ∧ RePred fun a => ¬p a
h₁ : RePred p
h₂ : RePred fun a => ¬p a
k : α →. Bool
pk : Partrec k
hk :
  ∀ (a : α) (x : Bool),
    x ∈ k a ↔
      x ∈ Part.map (fun b => true) (Part.assert (p a) fun x => Part.some ()) ∨
        x ∈ Part.map (fun b => false) (Part.assert ((fun a => ¬p a) a) fun x => Part.some ())
n : α
⊢ (fun a => decide (p a)) n ∈ k n

tactic: simp
state_before: case intro.intro
α : Type u_1
σ : Type ?u.307161
inst✝² : Primcodable α
inst✝¹ : Primcodable σ
p : α → Prop
inst✝ : DecidablePred p
x✝ : RePred p ∧ RePred fun a => ¬p a
h₁ : RePred p
h₂ : RePred fun a => ¬p a
k : α →. Bool
pk : Partrec k
hk :
  ∀ (a : α) (x : Bool),
    x ∈ k a ↔
      x ∈ Part.map (fun b => true) (Part.assert (p a) fun x => Part.some ()) ∨
        x ∈ Part.map (fun b => false) (Part.assert ((fun a => ¬p a) a) fun x => Part.some ())
n : α
⊢ (fun a => decide (p a)) n ∈ Part.map (fun b => true) (Part.assert (p n) fun x => Part.some ()) ∨
    (fun a => decide (p a)) n ∈ Part.map (fun b => false) (Part.assert ((fun a => ¬p a) n) fun x => Part.some ())

tactic: apply Decidable.em
state_before: case intro.intro
α : Type u_1
σ : Type ?u.307161
inst✝² : Primcodable α
inst✝¹ : Primcodable σ
p : α → Prop
inst✝ : DecidablePred p
x✝ : RePred p ∧ RePred fun a => ¬p a
h₁ : RePred p
h₂ : RePred fun a => ¬p a
k : α →. Bool
pk : Partrec k
hk :
  ∀ (a : α) (x : Bool),
    x ∈ k a ↔
      x ∈ Part.map (fun b => true) (Part.assert (p a) fun x => Part.some ()) ∨
        x ∈ Part.map (fun b => false) (Part.assert ((fun a => ¬p a) a) fun x => Part.some ())
n : α
⊢ p n ∨ ¬p n