l3lab/ntp-mathlib huggingface dataset:
theorem realize_toPrenexImp {φ ψ : L.BoundedFormula α n} (hφ : IsPrenex φ) (hψ : IsPrenex ψ)
    {v : α → M} {xs : Fin n → M} : (φ.toPrenexImp ψ).Realize v xs ↔ (φ.imp ψ).Realize v xs := by
  revert ψ
  induction' hφ with _ _ hφ _ _ _hφ ih _ _ _hφ ih <;> intro ψ hψ
  · rw [hφ.toPrenexImp]
    exact realize_toPrenexImpRight hφ hψ
  · unfold toPrenexImp
    rw [realize_ex]
    refine' _root_.trans (exists_congr fun _ => ih hψ.liftAt) _
    simp only [realize_imp, realize_liftAt_one_self, snoc_comp_castSucc, realize_all]
    refine' ⟨_, fun h' => _⟩
    · rintro ⟨a, ha⟩ h
      exact ha (h a)
    · by_cases h : ψ.Realize v xs
      · inhabit M
        exact ⟨default, fun _h'' => h⟩
      · obtain ⟨a, ha⟩ := not_forall.1 (h ∘ h')
        

Proof state:
case neg.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 :
  ∀ {xs : Fin (n✝ + 1) → M} {ψ : BoundedFormula L α (n✝ + 1)},
    IsPrenex ψ → (Realize (toPrenexImp φ✝ ψ) v xs ↔ Realize (φ✝ ⟹ ψ) v xs)
xs : Fin n✝ → M
ψ : BoundedFormula L α n✝
hψ : IsPrenex ψ
h' : (∀ (a : M), Realize φ✝ v (snoc xs a)) → Realize ψ v xs
h : ¬Realize ψ v xs
a : M
ha : ¬Realize φ✝ v (snoc xs a)
⊢ ∃ a, Realize φ✝ v (snoc xs a) → Realize ψ v xs

Next tactic:
exact ⟨a, fun h => (ha h).elim⟩
theorem realize_toPrenexImp {φ ψ : L.BoundedFormula α n} (hφ : IsPrenex φ) (hψ : IsPrenex ψ)
    {v : α → M} {xs : Fin n → M} : (φ.toPrenexImp ψ).Realize v xs ↔ (φ.imp ψ).Realize v xs := by
  revert ψ
  induction' hφ with _ _ hφ _ _ _hφ ih _ _ _hφ ih <;> intro ψ hψ
  · rw [hφ.toPrenexImp]
    exact realize_toPrenexImpRight hφ hψ
  · unfold toPrenexImp
    rw [realize_ex]
    refine' _root_.trans (exists_congr fun _ => ih hψ.liftAt) _
    simp only [realize_imp, realize_liftAt_one_self, snoc_comp_castSucc, realize_all]
    refine' ⟨_, fun h' => _⟩
    · rintro ⟨a, ha⟩ h
      exact ha (h a)
    · by_cases h : ψ.Realize v xs
      · inhabit M
        exact ⟨default, fun _h'' => h⟩
      · obtain ⟨a, ha⟩ := not_forall.1 (h ∘ h')
        exact ⟨a, fun h => (ha h).elim⟩
  · 

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 :
  ∀ {xs : Fin (n✝ + 1) → M} {ψ : BoundedFormula L α (n✝ + 1)},
    IsPrenex ψ → (Realize (toPrenexImp φ✝ ψ) v xs ↔ Realize (φ✝ ⟹ ψ) v xs)
xs : Fin n✝ → M
ψ : BoundedFormula L α n✝
hψ : IsPrenex ψ
⊢ Realize (toPrenexImp (∃'φ✝) ψ) v xs ↔ Realize (∃'φ✝ ⟹ ψ) v xs

Next tactic:
refine' _root_.trans (forall_congr' fun _ => ih hψ.liftAt) _
theorem realize_toPrenexImp {φ ψ : L.BoundedFormula α n} (hφ : IsPrenex φ) (hψ : IsPrenex ψ)
    {v : α → M} {xs : Fin n → M} : (φ.toPrenexImp ψ).Realize v xs ↔ (φ.imp ψ).Realize v xs := by
  revert ψ
  induction' hφ with _ _ hφ _ _ _hφ ih _ _ _hφ ih <;> intro ψ hψ
  · rw [hφ.toPrenexImp]
    exact realize_toPrenexImpRight hφ hψ
  · unfold toPrenexImp
    rw [realize_ex]
    refine' _root_.trans (exists_congr fun _ => ih hψ.liftAt) _
    simp only [realize_imp, realize_liftAt_one_self, snoc_comp_castSucc, realize_all]
    refine' ⟨_, fun h' => _⟩
    · rintro ⟨a, ha⟩ h
      exact ha (h a)
    · by_cases h : ψ.Realize v xs
      · inhabit M
        exact ⟨default, fun _h'' => h⟩
      · obtain ⟨a, ha⟩ := not_forall.1 (h ∘ h')
        exact ⟨a, fun h => (ha h).elim⟩
  · refine' _root_.trans (forall_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 :
  ∀ {xs : Fin (n✝ + 1) → M} {ψ : BoundedFormula L α (n✝ + 1)},
    IsPrenex ψ → (Realize (toPrenexImp φ✝ ψ) v xs ↔ Realize (φ✝ ⟹ ψ) v xs)
xs : Fin n✝ → M
ψ : BoundedFormula L α n✝
hψ : IsPrenex ψ
⊢ (∀ (a : M), Realize (φ✝ ⟹ liftAt 1 n✝ ψ) v (snoc xs a)) ↔ Realize (∃'φ✝ ⟹ ψ) v xs

Next tactic:
simp
@[simp]
theorem realize_toPrenex (φ : L.BoundedFormula α n) {v : α → M} :
    ∀ {xs : Fin n → M}, φ.toPrenex.Realize v xs ↔ φ.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
v : α → M
⊢ ∀ {xs : Fin n → M}, Realize (toPrenex φ) v xs ↔ Realize φ v xs

Next tactic:
induction' φ with _ _ _ _ _ _ _ _ _ f1 f2 h1 h2 _ _ h
@[simp]
theorem realize_toPrenex (φ : L.BoundedFormula α n) {v : α → M} :
    ∀ {xs : Fin n → M}, φ.toPrenex.Realize v xs ↔ φ.Realize v xs := by
  induction' φ with _ _ _ _ _ _ _ _ _ f1 f2 h1 h2 _ _ h
  · 

Proof state:
case falsum
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
v : α → M
n✝ : ℕ
⊢ ∀ {xs : Fin n✝ → M}, Realize (toPrenex falsum) v xs ↔ Realize falsum v xs

Next tactic:
exact Iff.rfl
@[simp]
theorem realize_toPrenex (φ : L.BoundedFormula α n) {v : α → M} :
    ∀ {xs : Fin n → M}, φ.toPrenex.Realize v xs ↔ φ.Realize v xs := by
  induction' φ with _ _ _ _ _ _ _ _ _ f1 f2 h1 h2 _ _ h
  · exact Iff.rfl
  · 

Proof state:
case equal
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
v : α → M
n✝ : ℕ
t₁✝ t₂✝ : Term L (α ⊕ Fin n✝)
⊢ ∀ {xs : Fin n✝ → M}, Realize (toPrenex (equal t₁✝ t₂✝)) v xs ↔ Realize (equal t₁✝ t₂✝) v xs

Next tactic:
exact Iff.rfl
@[simp]
theorem realize_toPrenex (φ : L.BoundedFormula α n) {v : α → M} :
    ∀ {xs : Fin n → M}, φ.toPrenex.Realize v xs ↔ φ.Realize v xs := by
  induction' φ with _ _ _ _ _ _ _ _ _ f1 f2 h1 h2 _ _ h
  · exact Iff.rfl
  · exact Iff.rfl
  · 

Proof state:
case rel
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
v : α → M
n✝ l✝ : ℕ
R✝ : Relations L l✝
ts✝ : Fin l✝ → Term L (α ⊕ Fin n✝)
⊢ ∀ {xs : Fin n✝ → M}, Realize (toPrenex (rel R✝ ts✝)) v xs ↔ Realize (rel R✝ ts✝) v xs

Next tactic:
exact Iff.rfl
@[simp]
theorem realize_toPrenex (φ : L.BoundedFormula α n) {v : α → M} :
    ∀ {xs : Fin n → M}, φ.toPrenex.Realize v xs ↔ φ.Realize v xs := by
  induction' φ with _ _ _ _ _ _ _ _ _ f1 f2 h1 h2 _ _ h
  · exact Iff.rfl
  · exact Iff.rfl
  · exact Iff.rfl
  · 

Proof state:
case imp
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
v : α → M
n✝ : ℕ
f1 f2 : BoundedFormula L α n✝
h1 : ∀ {xs : Fin n✝ → M}, Realize (toPrenex f1) v xs ↔ Realize f1 v xs
h2 : ∀ {xs : Fin n✝ → M}, Realize (toPrenex f2) v xs ↔ Realize f2 v xs
⊢ ∀ {xs : Fin n✝ → M}, Realize (toPrenex (f1 ⟹ f2)) v xs ↔ Realize (f1 ⟹ f2) v xs

Next tactic:
intros
@[simp]
theorem realize_toPrenex (φ : L.BoundedFormula α n) {v : α → M} :
    ∀ {xs : Fin n → M}, φ.toPrenex.Realize v xs ↔ φ.Realize v xs := by
  induction' φ with _ _ _ _ _ _ _ _ _ f1 f2 h1 h2 _ _ h
  · exact Iff.rfl
  · exact Iff.rfl
  · exact Iff.rfl
  · intros
    

Proof state:
case imp
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
v : α → M
n✝ : ℕ
f1 f2 : BoundedFormula L α n✝
h1 : ∀ {xs : Fin n✝ → M}, Realize (toPrenex f1) v xs ↔ Realize f1 v xs
h2 : ∀ {xs : Fin n✝ → M}, Realize (toPrenex f2) v xs ↔ Realize f2 v xs
xs✝ : Fin n✝ → M
⊢ Realize (toPrenex (f1 ⟹ f2)) v xs✝ ↔ Realize (f1 ⟹ f2) v xs✝

Next tactic:
rw [toPrenex, realize_toPrenexImp f1.toPrenex_isPrenex f2.toPrenex_isPrenex, realize_imp,
      realize_imp, h1, h2]
@[simp]
theorem realize_toPrenex (φ : L.BoundedFormula α n) {v : α → M} :
    ∀ {xs : Fin n → M}, φ.toPrenex.Realize v xs ↔ φ.Realize v xs := by
  induction' φ with _ _ _ _ _ _ _ _ _ f1 f2 h1 h2 _ _ h
  · exact Iff.rfl
  · exact Iff.rfl
  · exact Iff.rfl
  · intros
    rw [toPrenex, realize_toPrenexImp f1.toPrenex_isPrenex f2.toPrenex_isPrenex, realize_imp,
      realize_imp, h1, h2]
  · 

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
v : α → M
n✝ : ℕ
f✝ : BoundedFormula L α (n✝ + 1)
h : ∀ {xs : Fin (n✝ + 1) → M}, Realize (toPrenex f✝) v xs ↔ Realize f✝ v xs
⊢ ∀ {xs : Fin n✝ → M}, Realize (toPrenex (∀'f✝)) v xs ↔ Realize (∀'f✝) v xs

Next tactic:
intros
@[simp]
theorem realize_toPrenex (φ : L.BoundedFormula α n) {v : α → M} :
    ∀ {xs : Fin n → M}, φ.toPrenex.Realize v xs ↔ φ.Realize v xs := by
  induction' φ with _ _ _ _ _ _ _ _ _ f1 f2 h1 h2 _ _ h
  · exact Iff.rfl
  · exact Iff.rfl
  · exact Iff.rfl
  · intros
    rw [toPrenex, realize_toPrenexImp f1.toPrenex_isPrenex f2.toPrenex_isPrenex, realize_imp,
      realize_imp, h1, h2]
  · intros
    

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
v : α → M
n✝ : ℕ
f✝ : BoundedFormula L α (n✝ + 1)
h : ∀ {xs : Fin (n✝ + 1) → M}, Realize (toPrenex f✝) v xs ↔ Realize f✝ v xs
xs✝ : Fin n✝ → M
⊢ Realize (toPrenex (∀'f✝)) v xs✝ ↔ Realize (∀'f✝) v xs✝

Next tactic:
rw [realize_all, toPrenex, realize_all]
@[simp]
theorem realize_toPrenex (φ : L.BoundedFormula α n) {v : α → M} :
    ∀ {xs : Fin n → M}, φ.toPrenex.Realize v xs ↔ φ.Realize v xs := by
  induction' φ with _ _ _ _ _ _ _ _ _ f1 f2 h1 h2 _ _ h
  · exact Iff.rfl
  · exact Iff.rfl
  · exact Iff.rfl
  · intros
    rw [toPrenex, realize_toPrenexImp f1.toPrenex_isPrenex f2.toPrenex_isPrenex, realize_imp,
      realize_imp, h1, h2]
  · intros
    rw [realize_all, toPrenex, 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
v : α → M
n✝ : ℕ
f✝ : BoundedFormula L α (n✝ + 1)
h : ∀ {xs : Fin (n✝ + 1) → M}, Realize (toPrenex f✝) v xs ↔ Realize f✝ v xs
xs✝ : Fin n✝ → M
⊢ (∀ (a : M), Realize (toPrenex f✝) v (snoc xs✝ a)) ↔ ∀ (a : M), Realize f✝ v (snoc xs✝ a)

Next tactic:
exact forall_congr' fun a => h
@[simp]
theorem realize_onBoundedFormula [L'.Structure M] (φ : L →ᴸ L') [φ.IsExpansionOn M] {n : ℕ}
    (ψ : L.BoundedFormula α n) {v : α → M} {xs : Fin n → M} :
    (φ.onBoundedFormula ψ).Realize v xs ↔ ψ.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✝ : ℕ
inst✝¹ : Structure L' M
φ : L →ᴸ L'
inst✝ : IsExpansionOn φ M
n : ℕ
ψ : BoundedFormula L α n
v : α → M
xs : Fin n → M
⊢ Realize (onBoundedFormula φ ψ) v xs ↔ Realize ψ v xs

Next tactic:
induction' ψ with _ _ _ _ _ _ _ _ _ _ _ ih1 ih2 _ _ ih3
@[simp]
theorem realize_onBoundedFormula [L'.Structure M] (φ : L →ᴸ L') [φ.IsExpansionOn M] {n : ℕ}
    (ψ : L.BoundedFormula α n) {v : α → M} {xs : Fin n → M} :
    (φ.onBoundedFormula ψ).Realize v xs ↔ ψ.Realize v xs := by
  induction' ψ with _ _ _ _ _ _ _ _ _ _ _ ih1 ih2 _ _ ih3
  · 

Proof state:
case falsum
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✝¹ : ℕ
inst✝¹ : Structure L' M
φ : L →ᴸ L'
inst✝ : IsExpansionOn φ M
n : ℕ
v : α → M
n✝ : ℕ
xs : Fin n✝ → M
⊢ Realize (onBoundedFormula φ falsum) v xs ↔ Realize falsum v xs

Next tactic:
rfl
@[simp]
theorem realize_onBoundedFormula [L'.Structure M] (φ : L →ᴸ L') [φ.IsExpansionOn M] {n : ℕ}
    (ψ : L.BoundedFormula α n) {v : α → M} {xs : Fin n → M} :
    (φ.onBoundedFormula ψ).Realize v xs ↔ ψ.Realize v xs := by
  induction' ψ with _ _ _ _ _ _ _ _ _ _ _ ih1 ih2 _ _ ih3
  · rfl
  · 

Proof state:
case equal
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✝¹ : ℕ
inst✝¹ : Structure L' M
φ : L →ᴸ L'
inst✝ : IsExpansionOn φ M
n : ℕ
v : α → M
n✝ : ℕ
t₁✝ t₂✝ : Term L (α ⊕ Fin n✝)
xs : Fin n✝ → M
⊢ Realize (onBoundedFormula φ (equal t₁✝ t₂✝)) v xs ↔ Realize (equal t₁✝ t₂✝) v xs

Next tactic:
simp only [onBoundedFormula, realize_bdEqual, realize_onTerm]
@[simp]
theorem realize_onBoundedFormula [L'.Structure M] (φ : L →ᴸ L') [φ.IsExpansionOn M] {n : ℕ}
    (ψ : L.BoundedFormula α n) {v : α → M} {xs : Fin n → M} :
    (φ.onBoundedFormula ψ).Realize v xs ↔ ψ.Realize v xs := by
  induction' ψ with _ _ _ _ _ _ _ _ _ _ _ ih1 ih2 _ _ ih3
  · rfl
  · simp only [onBoundedFormula, realize_bdEqual, realize_onTerm]
    

Proof state:
case equal
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✝¹ : ℕ
inst✝¹ : Structure L' M
φ : L →ᴸ L'
inst✝ : IsExpansionOn φ M
n : ℕ
v : α → M
n✝ : ℕ
t₁✝ t₂✝ : Term L (α ⊕ Fin n✝)
xs : Fin n✝ → M
⊢ Term.realize (Sum.elim v xs) t₁✝ = Term.realize (Sum.elim v xs) t₂✝ ↔ Realize (equal t₁✝ t₂✝) v xs

Next tactic:
rfl
@[simp]
theorem realize_onBoundedFormula [L'.Structure M] (φ : L →ᴸ L') [φ.IsExpansionOn M] {n : ℕ}
    (ψ : L.BoundedFormula α n) {v : α → M} {xs : Fin n → M} :
    (φ.onBoundedFormula ψ).Realize v xs ↔ ψ.Realize v xs := by
  induction' ψ with _ _ _ _ _ _ _ _ _ _ _ ih1 ih2 _ _ ih3
  · rfl
  · simp only [onBoundedFormula, realize_bdEqual, realize_onTerm]
    rfl
  · 

Proof state:
case rel
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✝¹ : ℕ
inst✝¹ : Structure L' M
φ : L →ᴸ L'
inst✝ : IsExpansionOn φ M
n : ℕ
v : α → M
n✝ l✝ : ℕ
R✝ : Relations L l✝
ts✝ : Fin l✝ → Term L (α ⊕ Fin n✝)
xs : Fin n✝ → M
⊢ Realize (onBoundedFormula φ (rel R✝ ts✝)) v xs ↔ Realize (rel R✝ ts✝) v xs

Next tactic:
simp only [onBoundedFormula, realize_rel, LHom.map_onRelation,
      Function.comp_apply, realize_onTerm]
@[simp]
theorem realize_onBoundedFormula [L'.Structure M] (φ : L →ᴸ L') [φ.IsExpansionOn M] {n : ℕ}
    (ψ : L.BoundedFormula α n) {v : α → M} {xs : Fin n → M} :
    (φ.onBoundedFormula ψ).Realize v xs ↔ ψ.Realize v xs := by
  induction' ψ with _ _ _ _ _ _ _ _ _ _ _ ih1 ih2 _ _ ih3
  · rfl
  · simp only [onBoundedFormula, realize_bdEqual, realize_onTerm]
    rfl
  · simp only [onBoundedFormula, realize_rel, LHom.map_onRelation,
      Function.comp_apply, realize_onTerm]
    

Proof state:
case rel
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✝¹ : ℕ
inst✝¹ : Structure L' M
φ : L →ᴸ L'
inst✝ : IsExpansionOn φ M
n : ℕ
v : α → M
n✝ l✝ : ℕ
R✝ : Relations L l✝
ts✝ : Fin l✝ → Term L (α ⊕ Fin n✝)
xs : Fin n✝ → M
⊢ (RelMap R✝ fun i => Term.realize (Sum.elim v xs) (ts✝ i)) ↔ Realize (rel R✝ ts✝) v xs

Next tactic:
rfl
@[simp]
theorem realize_onBoundedFormula [L'.Structure M] (φ : L →ᴸ L') [φ.IsExpansionOn M] {n : ℕ}
    (ψ : L.BoundedFormula α n) {v : α → M} {xs : Fin n → M} :
    (φ.onBoundedFormula ψ).Realize v xs ↔ ψ.Realize v xs := by
  induction' ψ with _ _ _ _ _ _ _ _ _ _ _ ih1 ih2 _ _ ih3
  · rfl
  · simp only [onBoundedFormula, realize_bdEqual, realize_onTerm]
    rfl
  · simp only [onBoundedFormula, realize_rel, LHom.map_onRelation,
      Function.comp_apply, realize_onTerm]
    rfl
  · 

Proof state:
case imp
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✝¹ : ℕ
inst✝¹ : Structure L' M
φ : L →ᴸ L'
inst✝ : IsExpansionOn φ M
n : ℕ
v : α → M
n✝ : ℕ
f₁✝ f₂✝ : BoundedFormula L α n✝
ih1 : ∀ {xs : Fin n✝ → M}, Realize (onBoundedFormula φ f₁✝) v xs ↔ Realize f₁✝ v xs
ih2 : ∀ {xs : Fin n✝ → M}, Realize (onBoundedFormula φ f₂✝) v xs ↔ Realize f₂✝ v xs
xs : Fin n✝ → M
⊢ Realize (onBoundedFormula φ (f₁✝ ⟹ f₂✝)) v xs ↔ Realize (f₁✝ ⟹ f₂✝) v xs

Next tactic:
simp only [onBoundedFormula, ih1, ih2, realize_imp]
@[simp]
theorem realize_onBoundedFormula [L'.Structure M] (φ : L →ᴸ L') [φ.IsExpansionOn M] {n : ℕ}
    (ψ : L.BoundedFormula α n) {v : α → M} {xs : Fin n → M} :
    (φ.onBoundedFormula ψ).Realize v xs ↔ ψ.Realize v xs := by
  induction' ψ with _ _ _ _ _ _ _ _ _ _ _ ih1 ih2 _ _ ih3
  · rfl
  · simp only [onBoundedFormula, realize_bdEqual, realize_onTerm]
    rfl
  · simp only [onBoundedFormula, realize_rel, LHom.map_onRelation,
      Function.comp_apply, realize_onTerm]
    rfl
  · simp only [onBoundedFormula, ih1, ih2, realize_imp]
  · 

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✝¹ : ℕ
inst✝¹ : Structure L' M
φ : L →ᴸ L'
inst✝ : IsExpansionOn φ M
n : ℕ
v : α → M
n✝ : ℕ
f✝ : BoundedFormula L α (n✝ + 1)
ih3 : ∀ {xs : Fin (n✝ + 1) → M}, Realize (onBoundedFormula φ f✝) v xs ↔ Realize f✝ v xs
xs : Fin n✝ → M
⊢ Realize (onBoundedFormula φ (∀'f✝)) v xs ↔ Realize (∀'f✝) v xs

Next tactic:
simp only [onBoundedFormula, ih3, realize_all]
@[simp]
theorem realize_rel {k : ℕ} {R : L.Relations k} {ts : Fin k → L.Term α} :
    (R.formula ts).Realize v ↔ RelMap R fun i => (ts i).realize v :=
  BoundedFormula.realize_rel.trans (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 : ℕ
φ ψ : Formula L α
v : α → M
k : ℕ
R : Relations L k
ts : Fin k → Term L α
⊢ (RelMap R fun i => Term.realize (Sum.elim v default) (Term.relabel Sum.inl (ts i))) ↔
    RelMap R fun i => Term.realize v (ts i)

Next tactic:
simp
@[simp]
theorem realize_rel₁ {R : L.Relations 1} {t : L.Term _} :
    (R.formula₁ t).Realize v ↔ RelMap R ![t.realize v] := 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 : ℕ
φ ψ : Formula L α
v : α → M
R : Relations L 1
t : Term L α
⊢ Realize (Relations.formula₁ R t) v ↔ RelMap R ![Term.realize v t]

Next tactic:
rw [Relations.formula₁, realize_rel, iff_eq_eq]
@[simp]
theorem realize_rel₁ {R : L.Relations 1} {t : L.Term _} :
    (R.formula₁ t).Realize v ↔ RelMap R ![t.realize v] := by
  rw [Relations.formula₁, realize_rel, iff_eq_eq]
  

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 : ℕ
φ ψ : Formula L α
v : α → M
R : Relations L 1
t : Term L α
⊢ (RelMap R fun i => Term.realize v (Matrix.vecCons t ![] i)) = RelMap R ![Term.realize v t]

Next tactic:
refine' congr rfl (funext fun _ => _)
@[simp]
theorem realize_rel₁ {R : L.Relations 1} {t : L.Term _} :
    (R.formula₁ t).Realize v ↔ RelMap R ![t.realize v] := by
  rw [Relations.formula₁, realize_rel, iff_eq_eq]
  refine' congr rfl (funext fun _ => _)
  

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 : ℕ
φ ψ : Formula L α
v : α → M
R : Relations L 1
t : Term L α
x✝ : Fin 1
⊢ Term.realize v (Matrix.vecCons t ![] x✝) = Matrix.vecCons (Term.realize v t) ![] x✝

Next tactic:
simp only [Matrix.cons_val_fin_one]
@[simp]
theorem realize_rel₂ {R : L.Relations 2} {t₁ t₂ : L.Term _} :
    (R.formula₂ t₁ t₂).Realize v ↔ RelMap R ![t₁.realize v, t₂.realize v] := 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 : ℕ
φ ψ : Formula L α
v : α → M
R : Relations L 2
t₁ t₂ : Term L α
⊢ Realize (Relations.formula₂ R t₁ t₂) v ↔ RelMap R ![Term.realize v t₁, Term.realize v t₂]

Next tactic:
rw [Relations.formula₂, realize_rel, iff_eq_eq]
@[simp]
theorem realize_rel₂ {R : L.Relations 2} {t₁ t₂ : L.Term _} :
    (R.formula₂ t₁ t₂).Realize v ↔ RelMap R ![t₁.realize v, t₂.realize v] := by
  rw [Relations.formula₂, realize_rel, iff_eq_eq]
  

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 : ℕ
φ ψ : Formula L α
v : α → M
R : Relations L 2
t₁ t₂ : Term L α
⊢ (RelMap R fun i => Term.realize v (Matrix.vecCons t₁ ![t₂] i)) = RelMap R ![Term.realize v t₁, Term.realize v t₂]

Next tactic:
refine' congr rfl (funext (Fin.cases _ _))
@[simp]
theorem realize_rel₂ {R : L.Relations 2} {t₁ t₂ : L.Term _} :
    (R.formula₂ t₁ t₂).Realize v ↔ RelMap R ![t₁.realize v, t₂.realize v] := by
  rw [Relations.formula₂, realize_rel, iff_eq_eq]
  refine' congr rfl (funext (Fin.cases _ _))
  · 

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 : ℕ
φ ψ : Formula L α
v : α → M
R : Relations L 2
t₁ t₂ : Term L α
⊢ Term.realize v (Matrix.vecCons t₁ ![t₂] 0) = Matrix.vecCons (Term.realize v t₁) ![Term.realize v t₂] 0

Next tactic:
simp only [Matrix.cons_val_zero]
@[simp]
theorem realize_rel₂ {R : L.Relations 2} {t₁ t₂ : L.Term _} :
    (R.formula₂ t₁ t₂).Realize v ↔ RelMap R ![t₁.realize v, t₂.realize v] := by
  rw [Relations.formula₂, realize_rel, iff_eq_eq]
  refine' congr rfl (funext (Fin.cases _ _))
  · simp only [Matrix.cons_val_zero]
  · 

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 : ℕ
φ ψ : Formula L α
v : α → M
R : Relations L 2
t₁ t₂ : Term L α
⊢ ∀ (i : Fin 1),
    Term.realize v (Matrix.vecCons t₁ ![t₂] (succ i)) = Matrix.vecCons (Term.realize v t₁) ![Term.realize v t₂] (succ i)

Next tactic:
simp only [Matrix.cons_val_succ, Matrix.cons_val_fin_one, forall_const]