l3lab/ntp-mathlib huggingface dataset:
theorem realize_all_liftAt_one_self {n : ℕ} {φ : L.BoundedFormula α n} {v : α → M}
    {xs : Fin n → M} : (φ.liftAt 1 n).all.Realize v xs ↔ φ.Realize v xs := by
  inhabit M
  

Proof state:
L : Language
L' : Language
M : Type w
N : Type u_1
P : Type u_2
inst✝³ : Structure L M
inst✝² : Structure L N
inst✝¹ : Structure L P
α : Type u'
β : Type v'
γ : Type u_3
n✝ l : ℕ
φ✝ ψ : BoundedFormula L α l
θ : BoundedFormula L α (Nat.succ l)
v✝ : α → M
xs✝ : Fin l → M
inst✝ : Nonempty M
n : ℕ
φ : BoundedFormula L α n
v : α → M
xs : Fin n → M
inhabited_h : Inhabited M
⊢ Realize (∀'liftAt 1 n φ) v xs ↔ Realize φ v xs

Next tactic:
simp only [realize_all, realize_liftAt_one_self]
theorem realize_all_liftAt_one_self {n : ℕ} {φ : L.BoundedFormula α n} {v : α → M}
    {xs : Fin n → M} : (φ.liftAt 1 n).all.Realize v xs ↔ φ.Realize v xs := by
  inhabit M
  simp only [realize_all, realize_liftAt_one_self]
  

Proof state:
L : Language
L' : Language
M : Type w
N : Type u_1
P : Type u_2
inst✝³ : Structure L M
inst✝² : Structure L N
inst✝¹ : Structure L P
α : Type u'
β : Type v'
γ : Type u_3
n✝ l : ℕ
φ✝ ψ : BoundedFormula L α l
θ : BoundedFormula L α (Nat.succ l)
v✝ : α → M
xs✝ : Fin l → M
inst✝ : Nonempty M
n : ℕ
φ : BoundedFormula L α n
v : α → M
xs : Fin n → M
inhabited_h : Inhabited M
⊢ (∀ (a : M), Realize φ v (snoc xs a ∘ castSucc)) ↔ Realize φ v xs

Next tactic:
refine' ⟨fun h => _, fun h a => _⟩
theorem realize_all_liftAt_one_self {n : ℕ} {φ : L.BoundedFormula α n} {v : α → M}
    {xs : Fin n → M} : (φ.liftAt 1 n).all.Realize v xs ↔ φ.Realize v xs := by
  inhabit M
  simp only [realize_all, realize_liftAt_one_self]
  refine' ⟨fun h => _, fun h a => _⟩
  · 

Proof state:
case refine'_1
L : Language
L' : Language
M : Type w
N : Type u_1
P : Type u_2
inst✝³ : Structure L M
inst✝² : Structure L N
inst✝¹ : Structure L P
α : Type u'
β : Type v'
γ : Type u_3
n✝ l : ℕ
φ✝ ψ : BoundedFormula L α l
θ : BoundedFormula L α (Nat.succ l)
v✝ : α → M
xs✝ : Fin l → M
inst✝ : Nonempty M
n : ℕ
φ : BoundedFormula L α n
v : α → M
xs : Fin n → M
inhabited_h : Inhabited M
h : ∀ (a : M), Realize φ v (snoc xs a ∘ castSucc)
⊢ Realize φ v xs

Next tactic:
refine' (congr rfl (funext fun i => _)).mp (h default)
theorem realize_all_liftAt_one_self {n : ℕ} {φ : L.BoundedFormula α n} {v : α → M}
    {xs : Fin n → M} : (φ.liftAt 1 n).all.Realize v xs ↔ φ.Realize v xs := by
  inhabit M
  simp only [realize_all, realize_liftAt_one_self]
  refine' ⟨fun h => _, fun h a => _⟩
  · refine' (congr rfl (funext fun i => _)).mp (h default)
    

Proof state:
case refine'_1
L : Language
L' : Language
M : Type w
N : Type u_1
P : Type u_2
inst✝³ : Structure L M
inst✝² : Structure L N
inst✝¹ : Structure L P
α : Type u'
β : Type v'
γ : Type u_3
n✝ l : ℕ
φ✝ ψ : BoundedFormula L α l
θ : BoundedFormula L α (Nat.succ l)
v✝ : α → M
xs✝ : Fin l → M
inst✝ : Nonempty M
n : ℕ
φ : BoundedFormula L α n
v : α → M
xs : Fin n → M
inhabited_h : Inhabited M
h : ∀ (a : M), Realize φ v (snoc xs a ∘ castSucc)
i : Fin n
⊢ (snoc xs default ∘ castSucc) i = xs i

Next tactic:
simp
theorem realize_all_liftAt_one_self {n : ℕ} {φ : L.BoundedFormula α n} {v : α → M}
    {xs : Fin n → M} : (φ.liftAt 1 n).all.Realize v xs ↔ φ.Realize v xs := by
  inhabit M
  simp only [realize_all, realize_liftAt_one_self]
  refine' ⟨fun h => _, fun h a => _⟩
  · refine' (congr rfl (funext fun i => _)).mp (h default)
    simp
  · 

Proof state:
case refine'_2
L : Language
L' : Language
M : Type w
N : Type u_1
P : Type u_2
inst✝³ : Structure L M
inst✝² : Structure L N
inst✝¹ : Structure L P
α : Type u'
β : Type v'
γ : Type u_3
n✝ l : ℕ
φ✝ ψ : BoundedFormula L α l
θ : BoundedFormula L α (Nat.succ l)
v✝ : α → M
xs✝ : Fin l → M
inst✝ : Nonempty M
n : ℕ
φ : BoundedFormula L α n
v : α → M
xs : Fin n → M
inhabited_h : Inhabited M
h : Realize φ v xs
a : M
⊢ Realize φ v (snoc xs a ∘ castSucc)

Next tactic:
refine' (congr rfl (funext fun i => _)).mp h
theorem realize_all_liftAt_one_self {n : ℕ} {φ : L.BoundedFormula α n} {v : α → M}
    {xs : Fin n → M} : (φ.liftAt 1 n).all.Realize v xs ↔ φ.Realize v xs := by
  inhabit M
  simp only [realize_all, realize_liftAt_one_self]
  refine' ⟨fun h => _, fun h a => _⟩
  · refine' (congr rfl (funext fun i => _)).mp (h default)
    simp
  · refine' (congr rfl (funext fun i => _)).mp h
    

Proof state:
case refine'_2
L : Language
L' : Language
M : Type w
N : Type u_1
P : Type u_2
inst✝³ : Structure L M
inst✝² : Structure L N
inst✝¹ : Structure L P
α : Type u'
β : Type v'
γ : Type u_3
n✝ l : ℕ
φ✝ ψ : BoundedFormula L α l
θ : BoundedFormula L α (Nat.succ l)
v✝ : α → M
xs✝ : Fin l → M
inst✝ : Nonempty M
n : ℕ
φ : BoundedFormula L α n
v : α → M
xs : Fin n → M
inhabited_h : Inhabited M
h : Realize φ v xs
a : M
i : Fin n
⊢ xs i = (snoc xs a ∘ castSucc) i

Next tactic:
simp
theorem realize_toPrenexImpRight {φ ψ : L.BoundedFormula α n} (hφ : IsQF φ) (hψ : IsPrenex ψ)
    {v : α → M} {xs : Fin n → M} :
    (φ.toPrenexImpRight ψ).Realize v xs ↔ (φ.imp ψ).Realize v xs := by
  

Proof state:
L : Language
L' : Language
M : Type w
N : Type u_1
P : Type u_2
inst✝³ : Structure L M
inst✝² : Structure L N
inst✝¹ : Structure L P
α : Type u'
β : Type v'
γ : Type u_3
n l : ℕ
φ✝ ψ✝ : BoundedFormula L α l
θ : BoundedFormula L α (Nat.succ l)
v✝ : α → M
xs✝ : Fin l → M
inst✝ : Nonempty M
φ ψ : BoundedFormula L α n
hφ : IsQF φ
hψ : IsPrenex ψ
v : α → M
xs : Fin n → M
⊢ Realize (toPrenexImpRight φ ψ) v xs ↔ Realize (φ ⟹ ψ) v xs

Next tactic:
induction' hψ with _ _ hψ _ _ _hψ ih _ _ _hψ ih
theorem realize_toPrenexImpRight {φ ψ : L.BoundedFormula α n} (hφ : IsQF φ) (hψ : IsPrenex ψ)
    {v : α → M} {xs : Fin n → M} :
    (φ.toPrenexImpRight ψ).Realize v xs ↔ (φ.imp ψ).Realize v xs := by
  induction' hψ with _ _ hψ _ _ _hψ ih _ _ _hψ ih
  · 

Proof state:
case of_isQF
L : Language
L' : Language
M : Type w
N : Type u_1
P : Type u_2
inst✝³ : Structure L M
inst✝² : Structure L N
inst✝¹ : Structure L P
α : Type u'
β : Type v'
γ : Type u_3
n l : ℕ
φ✝¹ ψ✝ : BoundedFormula L α l
θ : BoundedFormula L α (Nat.succ l)
v✝ : α → M
xs✝ : Fin l → M
inst✝ : Nonempty M
ψ : BoundedFormula L α n
v : α → M
n✝ : ℕ
φ✝ : BoundedFormula L α n✝
hψ : IsQF φ✝
φ : BoundedFormula L α n✝
hφ : IsQF φ
xs : Fin n✝ → M
⊢ Realize (toPrenexImpRight φ φ✝) v xs ↔ Realize (φ ⟹ φ✝) v xs

Next tactic:
rw [hψ.toPrenexImpRight]
theorem realize_toPrenexImpRight {φ ψ : L.BoundedFormula α n} (hφ : IsQF φ) (hψ : IsPrenex ψ)
    {v : α → M} {xs : Fin n → M} :
    (φ.toPrenexImpRight ψ).Realize v xs ↔ (φ.imp ψ).Realize v xs := by
  induction' hψ with _ _ hψ _ _ _hψ ih _ _ _hψ ih
  · rw [hψ.toPrenexImpRight]
  · 

Proof state:
case all
L : Language
L' : Language
M : Type w
N : Type u_1
P : Type u_2
inst✝³ : Structure L M
inst✝² : Structure L N
inst✝¹ : Structure L P
α : Type u'
β : Type v'
γ : Type u_3
n l : ℕ
φ✝¹ ψ✝ : BoundedFormula L α l
θ : BoundedFormula L α (Nat.succ l)
v✝ : α → M
xs✝ : Fin l → M
inst✝ : Nonempty M
ψ : BoundedFormula L α n
v : α → M
n✝ : ℕ
φ✝ : BoundedFormula L α (n✝ + 1)
_hψ : IsPrenex φ✝
ih :
  ∀ {φ : BoundedFormula L α (n✝ + 1)},
    IsQF φ → ∀ {xs : Fin (n✝ + 1) → M}, Realize (toPrenexImpRight φ φ✝) v xs ↔ Realize (φ ⟹ φ✝) v xs
φ : BoundedFormula L α n✝
hφ : IsQF φ
xs : Fin n✝ → M
⊢ Realize (toPrenexImpRight φ (∀'φ✝)) v xs ↔ Realize (φ ⟹ ∀'φ✝) v xs

Next tactic:
refine' _root_.trans (forall_congr' fun _ => ih hφ.liftAt) _
theorem realize_toPrenexImpRight {φ ψ : L.BoundedFormula α n} (hφ : IsQF φ) (hψ : IsPrenex ψ)
    {v : α → M} {xs : Fin n → M} :
    (φ.toPrenexImpRight ψ).Realize v xs ↔ (φ.imp ψ).Realize v xs := by
  induction' hψ with _ _ hψ _ _ _hψ ih _ _ _hψ ih
  · rw [hψ.toPrenexImpRight]
  · refine' _root_.trans (forall_congr' fun _ => ih hφ.liftAt) _
    

Proof state:
case all
L : Language
L' : Language
M : Type w
N : Type u_1
P : Type u_2
inst✝³ : Structure L M
inst✝² : Structure L N
inst✝¹ : Structure L P
α : Type u'
β : Type v'
γ : Type u_3
n l : ℕ
φ✝¹ ψ✝ : BoundedFormula L α l
θ : BoundedFormula L α (Nat.succ l)
v✝ : α → M
xs✝ : Fin l → M
inst✝ : Nonempty M
ψ : BoundedFormula L α n
v : α → M
n✝ : ℕ
φ✝ : BoundedFormula L α (n✝ + 1)
_hψ : IsPrenex φ✝
ih :
  ∀ {φ : BoundedFormula L α (n✝ + 1)},
    IsQF φ → ∀ {xs : Fin (n✝ + 1) → M}, Realize (toPrenexImpRight φ φ✝) v xs ↔ Realize (φ ⟹ φ✝) v xs
φ : BoundedFormula L α n✝
hφ : IsQF φ
xs : Fin n✝ → M
⊢ (∀ (a : M), Realize (liftAt 1 n✝ φ ⟹ φ✝) v (snoc xs a)) ↔ Realize (φ ⟹ ∀'φ✝) v xs

Next tactic:
simp only [realize_imp, realize_liftAt_one_self, snoc_comp_castSucc, realize_all]
theorem realize_toPrenexImpRight {φ ψ : L.BoundedFormula α n} (hφ : IsQF φ) (hψ : IsPrenex ψ)
    {v : α → M} {xs : Fin n → M} :
    (φ.toPrenexImpRight ψ).Realize v xs ↔ (φ.imp ψ).Realize v xs := by
  induction' hψ with _ _ hψ _ _ _hψ ih _ _ _hψ ih
  · rw [hψ.toPrenexImpRight]
  · refine' _root_.trans (forall_congr' fun _ => ih hφ.liftAt) _
    simp only [realize_imp, realize_liftAt_one_self, snoc_comp_castSucc, realize_all]
    

Proof state:
case all
L : Language
L' : Language
M : Type w
N : Type u_1
P : Type u_2
inst✝³ : Structure L M
inst✝² : Structure L N
inst✝¹ : Structure L P
α : Type u'
β : Type v'
γ : Type u_3
n l : ℕ
φ✝¹ ψ✝ : BoundedFormula L α l
θ : BoundedFormula L α (Nat.succ l)
v✝ : α → M
xs✝ : Fin l → M
inst✝ : Nonempty M
ψ : BoundedFormula L α n
v : α → M
n✝ : ℕ
φ✝ : BoundedFormula L α (n✝ + 1)
_hψ : IsPrenex φ✝
ih :
  ∀ {φ : BoundedFormula L α (n✝ + 1)},
    IsQF φ → ∀ {xs : Fin (n✝ + 1) → M}, Realize (toPrenexImpRight φ φ✝) v xs ↔ Realize (φ ⟹ φ✝) v xs
φ : BoundedFormula L α n✝
hφ : IsQF φ
xs : Fin n✝ → M
⊢ (∀ (a : M), Realize φ v xs → Realize φ✝ v (snoc xs a)) ↔ Realize φ v xs → ∀ (a : M), Realize φ✝ v (snoc xs a)

Next tactic:
exact ⟨fun h1 a h2 => h1 h2 a, fun h1 h2 a => h1 a h2⟩
theorem realize_toPrenexImpRight {φ ψ : L.BoundedFormula α n} (hφ : IsQF φ) (hψ : IsPrenex ψ)
    {v : α → M} {xs : Fin n → M} :
    (φ.toPrenexImpRight ψ).Realize v xs ↔ (φ.imp ψ).Realize v xs := by
  induction' hψ with _ _ hψ _ _ _hψ ih _ _ _hψ ih
  · rw [hψ.toPrenexImpRight]
  · refine' _root_.trans (forall_congr' fun _ => ih hφ.liftAt) _
    simp only [realize_imp, realize_liftAt_one_self, snoc_comp_castSucc, realize_all]
    exact ⟨fun h1 a h2 => h1 h2 a, fun h1 h2 a => h1 a h2⟩
  · 

Proof state:
case ex
L : Language
L' : Language
M : Type w
N : Type u_1
P : Type u_2
inst✝³ : Structure L M
inst✝² : Structure L N
inst✝¹ : Structure L P
α : Type u'
β : Type v'
γ : Type u_3
n l : ℕ
φ✝¹ ψ✝ : BoundedFormula L α l
θ : BoundedFormula L α (Nat.succ l)
v✝ : α → M
xs✝ : Fin l → M
inst✝ : Nonempty M
ψ : BoundedFormula L α n
v : α → M
n✝ : ℕ
φ✝ : BoundedFormula L α (n✝ + 1)
_hψ : IsPrenex φ✝
ih :
  ∀ {φ : BoundedFormula L α (n✝ + 1)},
    IsQF φ → ∀ {xs : Fin (n✝ + 1) → M}, Realize (toPrenexImpRight φ φ✝) v xs ↔ Realize (φ ⟹ φ✝) v xs
φ : BoundedFormula L α n✝
hφ : IsQF φ
xs : Fin n✝ → M
⊢ Realize (toPrenexImpRight φ (∃'φ✝)) v xs ↔ Realize (φ ⟹ ∃'φ✝) v xs

Next tactic:
unfold toPrenexImpRight
theorem realize_toPrenexImpRight {φ ψ : L.BoundedFormula α n} (hφ : IsQF φ) (hψ : IsPrenex ψ)
    {v : α → M} {xs : Fin n → M} :
    (φ.toPrenexImpRight ψ).Realize v xs ↔ (φ.imp ψ).Realize v xs := by
  induction' hψ with _ _ hψ _ _ _hψ ih _ _ _hψ ih
  · rw [hψ.toPrenexImpRight]
  · refine' _root_.trans (forall_congr' fun _ => ih hφ.liftAt) _
    simp only [realize_imp, realize_liftAt_one_self, snoc_comp_castSucc, realize_all]
    exact ⟨fun h1 a h2 => h1 h2 a, fun h1 h2 a => h1 a h2⟩
  · unfold toPrenexImpRight
    

Proof state:
case ex
L : Language
L' : Language
M : Type w
N : Type u_1
P : Type u_2
inst✝³ : Structure L M
inst✝² : Structure L N
inst✝¹ : Structure L P
α : Type u'
β : Type v'
γ : Type u_3
n l : ℕ
φ✝¹ ψ✝ : BoundedFormula L α l
θ : BoundedFormula L α (Nat.succ l)
v✝ : α → M
xs✝ : Fin l → M
inst✝ : Nonempty M
ψ : BoundedFormula L α n
v : α → M
n✝ : ℕ
φ✝ : BoundedFormula L α (n✝ + 1)
_hψ : IsPrenex φ✝
ih :
  ∀ {φ : BoundedFormula L α (n✝ + 1)},
    IsQF φ → ∀ {xs : Fin (n✝ + 1) → M}, Realize (toPrenexImpRight φ φ✝) v xs ↔ Realize (φ ⟹ φ✝) v xs
φ : BoundedFormula L α n✝
hφ : IsQF φ
xs : Fin n✝ → M
⊢ Realize (∃'toPrenexImpRight (liftAt 1 n✝ φ) φ✝) v xs ↔ Realize (φ ⟹ ∃'φ✝) v xs

Next tactic:
rw [realize_ex]
theorem realize_toPrenexImpRight {φ ψ : L.BoundedFormula α n} (hφ : IsQF φ) (hψ : IsPrenex ψ)
    {v : α → M} {xs : Fin n → M} :
    (φ.toPrenexImpRight ψ).Realize v xs ↔ (φ.imp ψ).Realize v xs := by
  induction' hψ with _ _ hψ _ _ _hψ ih _ _ _hψ ih
  · rw [hψ.toPrenexImpRight]
  · refine' _root_.trans (forall_congr' fun _ => ih hφ.liftAt) _
    simp only [realize_imp, realize_liftAt_one_self, snoc_comp_castSucc, realize_all]
    exact ⟨fun h1 a h2 => h1 h2 a, fun h1 h2 a => h1 a h2⟩
  · unfold toPrenexImpRight
    rw [realize_ex]
    

Proof state:
case ex
L : Language
L' : Language
M : Type w
N : Type u_1
P : Type u_2
inst✝³ : Structure L M
inst✝² : Structure L N
inst✝¹ : Structure L P
α : Type u'
β : Type v'
γ : Type u_3
n l : ℕ
φ✝¹ ψ✝ : BoundedFormula L α l
θ : BoundedFormula L α (Nat.succ l)
v✝ : α → M
xs✝ : Fin l → M
inst✝ : Nonempty M
ψ : BoundedFormula L α n
v : α → M
n✝ : ℕ
φ✝ : BoundedFormula L α (n✝ + 1)
_hψ : IsPrenex φ✝
ih :
  ∀ {φ : BoundedFormula L α (n✝ + 1)},
    IsQF φ → ∀ {xs : Fin (n✝ + 1) → M}, Realize (toPrenexImpRight φ φ✝) v xs ↔ Realize (φ ⟹ φ✝) v xs
φ : BoundedFormula L α n✝
hφ : IsQF φ
xs : Fin n✝ → M
⊢ (∃ a, Realize (toPrenexImpRight (liftAt 1 n✝ φ) φ✝) v (snoc xs a)) ↔ Realize (φ ⟹ ∃'φ✝) v xs

Next tactic:
refine' _root_.trans (exists_congr fun _ => ih hφ.liftAt) _
theorem realize_toPrenexImpRight {φ ψ : L.BoundedFormula α n} (hφ : IsQF φ) (hψ : IsPrenex ψ)
    {v : α → M} {xs : Fin n → M} :
    (φ.toPrenexImpRight ψ).Realize v xs ↔ (φ.imp ψ).Realize v xs := by
  induction' hψ with _ _ hψ _ _ _hψ ih _ _ _hψ ih
  · rw [hψ.toPrenexImpRight]
  · refine' _root_.trans (forall_congr' fun _ => ih hφ.liftAt) _
    simp only [realize_imp, realize_liftAt_one_self, snoc_comp_castSucc, realize_all]
    exact ⟨fun h1 a h2 => h1 h2 a, fun h1 h2 a => h1 a h2⟩
  · unfold toPrenexImpRight
    rw [realize_ex]
    refine' _root_.trans (exists_congr fun _ => ih hφ.liftAt) _
    

Proof state:
case ex
L : Language
L' : Language
M : Type w
N : Type u_1
P : Type u_2
inst✝³ : Structure L M
inst✝² : Structure L N
inst✝¹ : Structure L P
α : Type u'
β : Type v'
γ : Type u_3
n l : ℕ
φ✝¹ ψ✝ : BoundedFormula L α l
θ : BoundedFormula L α (Nat.succ l)
v✝ : α → M
xs✝ : Fin l → M
inst✝ : Nonempty M
ψ : BoundedFormula L α n
v : α → M
n✝ : ℕ
φ✝ : BoundedFormula L α (n✝ + 1)
_hψ : IsPrenex φ✝
ih :
  ∀ {φ : BoundedFormula L α (n✝ + 1)},
    IsQF φ → ∀ {xs : Fin (n✝ + 1) → M}, Realize (toPrenexImpRight φ φ✝) v xs ↔ Realize (φ ⟹ φ✝) v xs
φ : BoundedFormula L α n✝
hφ : IsQF φ
xs : Fin n✝ → M
⊢ (∃ a, Realize (liftAt 1 n✝ φ ⟹ φ✝) v (snoc xs a)) ↔ Realize (φ ⟹ ∃'φ✝) v xs

Next tactic:
simp only [realize_imp, realize_liftAt_one_self, snoc_comp_castSucc, realize_ex]
theorem realize_toPrenexImpRight {φ ψ : L.BoundedFormula α n} (hφ : IsQF φ) (hψ : IsPrenex ψ)
    {v : α → M} {xs : Fin n → M} :
    (φ.toPrenexImpRight ψ).Realize v xs ↔ (φ.imp ψ).Realize v xs := by
  induction' hψ with _ _ hψ _ _ _hψ ih _ _ _hψ ih
  · rw [hψ.toPrenexImpRight]
  · refine' _root_.trans (forall_congr' fun _ => ih hφ.liftAt) _
    simp only [realize_imp, realize_liftAt_one_self, snoc_comp_castSucc, realize_all]
    exact ⟨fun h1 a h2 => h1 h2 a, fun h1 h2 a => h1 a h2⟩
  · unfold toPrenexImpRight
    rw [realize_ex]
    refine' _root_.trans (exists_congr fun _ => ih hφ.liftAt) _
    simp only [realize_imp, realize_liftAt_one_self, snoc_comp_castSucc, realize_ex]
    

Proof state:
case ex
L : Language
L' : Language
M : Type w
N : Type u_1
P : Type u_2
inst✝³ : Structure L M
inst✝² : Structure L N
inst✝¹ : Structure L P
α : Type u'
β : Type v'
γ : Type u_3
n l : ℕ
φ✝¹ ψ✝ : BoundedFormula L α l
θ : BoundedFormula L α (Nat.succ l)
v✝ : α → M
xs✝ : Fin l → M
inst✝ : Nonempty M
ψ : BoundedFormula L α n
v : α → M
n✝ : ℕ
φ✝ : BoundedFormula L α (n✝ + 1)
_hψ : IsPrenex φ✝
ih :
  ∀ {φ : BoundedFormula L α (n✝ + 1)},
    IsQF φ → ∀ {xs : Fin (n✝ + 1) → M}, Realize (toPrenexImpRight φ φ✝) v xs ↔ Realize (φ ⟹ φ✝) v xs
φ : BoundedFormula L α n✝
hφ : IsQF φ
xs : Fin n✝ → M
⊢ (∃ a, Realize φ v xs → Realize φ✝ v (snoc xs a)) ↔ Realize φ v xs → ∃ a, Realize φ✝ v (snoc xs a)

Next tactic:
refine' ⟨_, fun h' => _⟩
theorem realize_toPrenexImpRight {φ ψ : L.BoundedFormula α n} (hφ : IsQF φ) (hψ : IsPrenex ψ)
    {v : α → M} {xs : Fin n → M} :
    (φ.toPrenexImpRight ψ).Realize v xs ↔ (φ.imp ψ).Realize v xs := by
  induction' hψ with _ _ hψ _ _ _hψ ih _ _ _hψ ih
  · rw [hψ.toPrenexImpRight]
  · refine' _root_.trans (forall_congr' fun _ => ih hφ.liftAt) _
    simp only [realize_imp, realize_liftAt_one_self, snoc_comp_castSucc, realize_all]
    exact ⟨fun h1 a h2 => h1 h2 a, fun h1 h2 a => h1 a h2⟩
  · unfold toPrenexImpRight
    rw [realize_ex]
    refine' _root_.trans (exists_congr fun _ => ih hφ.liftAt) _
    simp only [realize_imp, realize_liftAt_one_self, snoc_comp_castSucc, realize_ex]
    refine' ⟨_, fun h' => _⟩
    · 

Proof state:
case ex.refine'_1
L : Language
L' : Language
M : Type w
N : Type u_1
P : Type u_2
inst✝³ : Structure L M
inst✝² : Structure L N
inst✝¹ : Structure L P
α : Type u'
β : Type v'
γ : Type u_3
n l : ℕ
φ✝¹ ψ✝ : BoundedFormula L α l
θ : BoundedFormula L α (Nat.succ l)
v✝ : α → M
xs✝ : Fin l → M
inst✝ : Nonempty M
ψ : BoundedFormula L α n
v : α → M
n✝ : ℕ
φ✝ : BoundedFormula L α (n✝ + 1)
_hψ : IsPrenex φ✝
ih :
  ∀ {φ : BoundedFormula L α (n✝ + 1)},
    IsQF φ → ∀ {xs : Fin (n✝ + 1) → M}, Realize (toPrenexImpRight φ φ✝) v xs ↔ Realize (φ ⟹ φ✝) v xs
φ : BoundedFormula L α n✝
hφ : IsQF φ
xs : Fin n✝ → M
⊢ (∃ a, Realize φ v xs → Realize φ✝ v (snoc xs a)) → Realize φ v xs → ∃ a, Realize φ✝ v (snoc xs a)

Next tactic:
rintro ⟨a, ha⟩ h
theorem realize_toPrenexImpRight {φ ψ : L.BoundedFormula α n} (hφ : IsQF φ) (hψ : IsPrenex ψ)
    {v : α → M} {xs : Fin n → M} :
    (φ.toPrenexImpRight ψ).Realize v xs ↔ (φ.imp ψ).Realize v xs := by
  induction' hψ with _ _ hψ _ _ _hψ ih _ _ _hψ ih
  · rw [hψ.toPrenexImpRight]
  · refine' _root_.trans (forall_congr' fun _ => ih hφ.liftAt) _
    simp only [realize_imp, realize_liftAt_one_self, snoc_comp_castSucc, realize_all]
    exact ⟨fun h1 a h2 => h1 h2 a, fun h1 h2 a => h1 a h2⟩
  · unfold toPrenexImpRight
    rw [realize_ex]
    refine' _root_.trans (exists_congr fun _ => ih hφ.liftAt) _
    simp only [realize_imp, realize_liftAt_one_self, snoc_comp_castSucc, realize_ex]
    refine' ⟨_, fun h' => _⟩
    · rintro ⟨a, ha⟩ h
      

Proof state:
case ex.refine'_1.intro
L : Language
L' : Language
M : Type w
N : Type u_1
P : Type u_2
inst✝³ : Structure L M
inst✝² : Structure L N
inst✝¹ : Structure L P
α : Type u'
β : Type v'
γ : Type u_3
n l : ℕ
φ✝¹ ψ✝ : BoundedFormula L α l
θ : BoundedFormula L α (Nat.succ l)
v✝ : α → M
xs✝ : Fin l → M
inst✝ : Nonempty M
ψ : BoundedFormula L α n
v : α → M
n✝ : ℕ
φ✝ : BoundedFormula L α (n✝ + 1)
_hψ : IsPrenex φ✝
ih :
  ∀ {φ : BoundedFormula L α (n✝ + 1)},
    IsQF φ → ∀ {xs : Fin (n✝ + 1) → M}, Realize (toPrenexImpRight φ φ✝) v xs ↔ Realize (φ ⟹ φ✝) v xs
φ : BoundedFormula L α n✝
hφ : IsQF φ
xs : Fin n✝ → M
a : M
ha : Realize φ v xs → Realize φ✝ v (snoc xs a)
h : Realize φ v xs
⊢ ∃ a, Realize φ✝ v (snoc xs a)

Next tactic:
exact ⟨a, ha h⟩
theorem realize_toPrenexImpRight {φ ψ : L.BoundedFormula α n} (hφ : IsQF φ) (hψ : IsPrenex ψ)
    {v : α → M} {xs : Fin n → M} :
    (φ.toPrenexImpRight ψ).Realize v xs ↔ (φ.imp ψ).Realize v xs := by
  induction' hψ with _ _ hψ _ _ _hψ ih _ _ _hψ ih
  · rw [hψ.toPrenexImpRight]
  · refine' _root_.trans (forall_congr' fun _ => ih hφ.liftAt) _
    simp only [realize_imp, realize_liftAt_one_self, snoc_comp_castSucc, realize_all]
    exact ⟨fun h1 a h2 => h1 h2 a, fun h1 h2 a => h1 a h2⟩
  · unfold toPrenexImpRight
    rw [realize_ex]
    refine' _root_.trans (exists_congr fun _ => ih hφ.liftAt) _
    simp only [realize_imp, realize_liftAt_one_self, snoc_comp_castSucc, realize_ex]
    refine' ⟨_, fun h' => _⟩
    · rintro ⟨a, ha⟩ h
      exact ⟨a, ha h⟩
    · 

Proof state:
case ex.refine'_2
L : Language
L' : Language
M : Type w
N : Type u_1
P : Type u_2
inst✝³ : Structure L M
inst✝² : Structure L N
inst✝¹ : Structure L P
α : Type u'
β : Type v'
γ : Type u_3
n l : ℕ
φ✝¹ ψ✝ : BoundedFormula L α l
θ : BoundedFormula L α (Nat.succ l)
v✝ : α → M
xs✝ : Fin l → M
inst✝ : Nonempty M
ψ : BoundedFormula L α n
v : α → M
n✝ : ℕ
φ✝ : BoundedFormula L α (n✝ + 1)
_hψ : IsPrenex φ✝
ih :
  ∀ {φ : BoundedFormula L α (n✝ + 1)},
    IsQF φ → ∀ {xs : Fin (n✝ + 1) → M}, Realize (toPrenexImpRight φ φ✝) v xs ↔ Realize (φ ⟹ φ✝) v xs
φ : BoundedFormula L α n✝
hφ : IsQF φ
xs : Fin n✝ → M
h' : Realize φ v xs → ∃ a, Realize φ✝ v (snoc xs a)
⊢ ∃ a, Realize φ v xs → Realize φ✝ v (snoc xs a)

Next tactic:
by_cases h : φ.Realize v xs
theorem realize_toPrenexImpRight {φ ψ : L.BoundedFormula α n} (hφ : IsQF φ) (hψ : IsPrenex ψ)
    {v : α → M} {xs : Fin n → M} :
    (φ.toPrenexImpRight ψ).Realize v xs ↔ (φ.imp ψ).Realize v xs := by
  induction' hψ with _ _ hψ _ _ _hψ ih _ _ _hψ ih
  · rw [hψ.toPrenexImpRight]
  · refine' _root_.trans (forall_congr' fun _ => ih hφ.liftAt) _
    simp only [realize_imp, realize_liftAt_one_self, snoc_comp_castSucc, realize_all]
    exact ⟨fun h1 a h2 => h1 h2 a, fun h1 h2 a => h1 a h2⟩
  · unfold toPrenexImpRight
    rw [realize_ex]
    refine' _root_.trans (exists_congr fun _ => ih hφ.liftAt) _
    simp only [realize_imp, realize_liftAt_one_self, snoc_comp_castSucc, realize_ex]
    refine' ⟨_, fun h' => _⟩
    · rintro ⟨a, ha⟩ h
      exact ⟨a, ha h⟩
    · by_cases h : φ.Realize v xs
      · 

Proof state:
case pos
L : Language
L' : Language
M : Type w
N : Type u_1
P : Type u_2
inst✝³ : Structure L M
inst✝² : Structure L N
inst✝¹ : Structure L P
α : Type u'
β : Type v'
γ : Type u_3
n l : ℕ
φ✝¹ ψ✝ : BoundedFormula L α l
θ : BoundedFormula L α (Nat.succ l)
v✝ : α → M
xs✝ : Fin l → M
inst✝ : Nonempty M
ψ : BoundedFormula L α n
v : α → M
n✝ : ℕ
φ✝ : BoundedFormula L α (n✝ + 1)
_hψ : IsPrenex φ✝
ih :
  ∀ {φ : BoundedFormula L α (n✝ + 1)},
    IsQF φ → ∀ {xs : Fin (n✝ + 1) → M}, Realize (toPrenexImpRight φ φ✝) v xs ↔ Realize (φ ⟹ φ✝) v xs
φ : BoundedFormula L α n✝
hφ : IsQF φ
xs : Fin n✝ → M
h' : Realize φ v xs → ∃ a, Realize φ✝ v (snoc xs a)
h : Realize φ v xs
⊢ ∃ a, Realize φ v xs → Realize φ✝ v (snoc xs a)

Next tactic:
obtain ⟨a, ha⟩ := h' h
theorem realize_toPrenexImpRight {φ ψ : L.BoundedFormula α n} (hφ : IsQF φ) (hψ : IsPrenex ψ)
    {v : α → M} {xs : Fin n → M} :
    (φ.toPrenexImpRight ψ).Realize v xs ↔ (φ.imp ψ).Realize v xs := by
  induction' hψ with _ _ hψ _ _ _hψ ih _ _ _hψ ih
  · rw [hψ.toPrenexImpRight]
  · refine' _root_.trans (forall_congr' fun _ => ih hφ.liftAt) _
    simp only [realize_imp, realize_liftAt_one_self, snoc_comp_castSucc, realize_all]
    exact ⟨fun h1 a h2 => h1 h2 a, fun h1 h2 a => h1 a h2⟩
  · unfold toPrenexImpRight
    rw [realize_ex]
    refine' _root_.trans (exists_congr fun _ => ih hφ.liftAt) _
    simp only [realize_imp, realize_liftAt_one_self, snoc_comp_castSucc, realize_ex]
    refine' ⟨_, fun h' => _⟩
    · rintro ⟨a, ha⟩ h
      exact ⟨a, ha h⟩
    · by_cases h : φ.Realize v xs
      · obtain ⟨a, ha⟩ := h' h
        

Proof state:
case pos.intro
L : Language
L' : Language
M : Type w
N : Type u_1
P : Type u_2
inst✝³ : Structure L M
inst✝² : Structure L N
inst✝¹ : Structure L P
α : Type u'
β : Type v'
γ : Type u_3
n l : ℕ
φ✝¹ ψ✝ : BoundedFormula L α l
θ : BoundedFormula L α (Nat.succ l)
v✝ : α → M
xs✝ : Fin l → M
inst✝ : Nonempty M
ψ : BoundedFormula L α n
v : α → M
n✝ : ℕ
φ✝ : BoundedFormula L α (n✝ + 1)
_hψ : IsPrenex φ✝
ih :
  ∀ {φ : BoundedFormula L α (n✝ + 1)},
    IsQF φ → ∀ {xs : Fin (n✝ + 1) → M}, Realize (toPrenexImpRight φ φ✝) v xs ↔ Realize (φ ⟹ φ✝) v xs
φ : BoundedFormula L α n✝
hφ : IsQF φ
xs : Fin n✝ → M
h' : Realize φ v xs → ∃ a, Realize φ✝ v (snoc xs a)
h : Realize φ v xs
a : M
ha : Realize φ✝ v (snoc xs a)
⊢ ∃ a, Realize φ v xs → Realize φ✝ v (snoc xs a)

Next tactic:
exact ⟨a, fun _ => ha⟩