l3lab/ntp-mathlib huggingface dataset:
@[simp]
theorem realize_relabel {φ : L.Formula α} {g : α → β} {v : β → M} :
    (φ.relabel g).Realize v ↔ φ.Realize (v ∘ g) := 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
φ : Formula L α
g : α → β
v : β → M
⊢ Realize (relabel g φ) v ↔ Realize φ (v ∘ g)

Next tactic:
rw [Realize, Realize, relabel, BoundedFormula.realize_relabel, iff_eq_eq, Fin.castAdd_zero]
@[simp]
theorem realize_relabel {φ : L.Formula α} {g : α → β} {v : β → M} :
    (φ.relabel g).Realize v ↔ φ.Realize (v ∘ g) := by
  rw [Realize, Realize, relabel, BoundedFormula.realize_relabel, iff_eq_eq, Fin.castAdd_zero]
  

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
φ : Formula L α
g : α → β
v : β → M
⊢ BoundedFormula.Realize φ (Sum.elim v (default ∘ Fin.cast (_ : 0 = 0)) ∘ Sum.inl ∘ g) (default ∘ natAdd 0) =
    BoundedFormula.Realize φ (v ∘ g) default

Next tactic:
exact congr rfl (funext finZeroElim)
theorem realize_relabel_sum_inr (φ : L.Formula (Fin n)) {v : Empty → M} {x : Fin n → M} :
    (BoundedFormula.relabel Sum.inr φ).Realize v x ↔ φ.Realize x := 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
φ : Formula L (Fin n)
v : Empty → M
x : Fin n → M
⊢ BoundedFormula.Realize (BoundedFormula.relabel Sum.inr φ) v x ↔ Realize φ x

Next tactic:
rw [BoundedFormula.realize_relabel, Formula.Realize, Sum.elim_comp_inr, Fin.castAdd_zero,
    cast_refl, Function.comp.right_id,
    Subsingleton.elim (x ∘ (natAdd n : Fin 0 → Fin n)) default]
@[simp]
theorem realize_equal {t₁ t₂ : L.Term α} {x : α → M} :
    (t₁.equal t₂).Realize x ↔ t₁.realize x = t₂.realize x := 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
t₁ t₂ : Term L α
x : α → M
⊢ Realize (Term.equal t₁ t₂) x ↔ Term.realize x t₁ = Term.realize x t₂

Next tactic:
simp [Term.equal, Realize]
@[simp]
theorem realize_graph {f : L.Functions n} {x : Fin n → M} {y : M} :
    (Formula.graph f).Realize (Fin.cons y x : _ → M) ↔ funMap f x = y := 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
f : Functions L n
x : Fin n → M
y : M
⊢ Realize (graph f) (cons y x) ↔ funMap f x = y

Next tactic:
simp only [Formula.graph, Term.realize, realize_equal, Fin.cons_zero, Fin.cons_succ]
@[simp]
theorem realize_graph {f : L.Functions n} {x : Fin n → M} {y : M} :
    (Formula.graph f).Realize (Fin.cons y x : _ → M) ↔ funMap f x = y := by
  simp only [Formula.graph, Term.realize, realize_equal, Fin.cons_zero, Fin.cons_succ]
  

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
f : Functions L n
x : Fin n → M
y : M
⊢ (y = funMap f fun i => x i) ↔ funMap f x = y

Next tactic:
rw [eq_comm]
@[simp]
theorem LHom.setOf_realize_onFormula [L'.Structure M] (φ : L →ᴸ L') [φ.IsExpansionOn M]
    (ψ : L.Formula α) : (setOf (φ.onFormula ψ).Realize : Set (α → M)) = setOf ψ.Realize := 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
ψ : Formula L α
⊢ setOf (Formula.Realize (onFormula φ ψ)) = setOf (Formula.Realize ψ)

Next tactic:
ext
@[simp]
theorem LHom.setOf_realize_onFormula [L'.Structure M] (φ : L →ᴸ L') [φ.IsExpansionOn M]
    (ψ : L.Formula α) : (setOf (φ.onFormula ψ).Realize : Set (α → M)) = setOf ψ.Realize := by
  ext
  

Proof state:
case h
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
ψ : Formula L α
x✝ : α → M
⊢ x✝ ∈ setOf (Formula.Realize (onFormula φ ψ)) ↔ x✝ ∈ setOf (Formula.Realize ψ)

Next tactic:
simp
@[simp]
theorem realize_equivSentence_symm_con [L[[α]].Structure M]
    [(L.lhomWithConstants α).IsExpansionOn M] (φ : L[[α]].Sentence) :
    ((equivSentence.symm φ).Realize fun a => (L.con a : M)) ↔ φ.Realize M := 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
inst✝ : LHom.IsExpansionOn (lhomWithConstants L α) M
φ : Sentence (L[[α]])
⊢ (Realize (equivSentence.symm φ) fun a => ↑(Language.con L a)) ↔ M ⊨ φ

Next tactic:
simp only [equivSentence, Equiv.symm_symm, Equiv.coe_trans, Realize,
    BoundedFormula.realize_relabelEquiv, Function.comp]
@[simp]
theorem realize_equivSentence_symm_con [L[[α]].Structure M]
    [(L.lhomWithConstants α).IsExpansionOn M] (φ : L[[α]].Sentence) :
    ((equivSentence.symm φ).Realize fun a => (L.con a : M)) ↔ φ.Realize M := by
  simp only [equivSentence, Equiv.symm_symm, Equiv.coe_trans, Realize,
    BoundedFormula.realize_relabelEquiv, Function.comp]
  

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
inst✝ : LHom.IsExpansionOn (lhomWithConstants L α) M
φ : Sentence (L[[α]])
⊢ BoundedFormula.Realize (BoundedFormula.constantsVarsEquiv φ) (fun x => ↑(Language.con L ((Equiv.sumEmpty α Empty) x)))
      default ↔
    M ⊨ φ

Next tactic:
refine' _root_.trans _ BoundedFormula.realize_constantsVarsEquiv
@[simp]
theorem realize_equivSentence_symm_con [L[[α]].Structure M]
    [(L.lhomWithConstants α).IsExpansionOn M] (φ : L[[α]].Sentence) :
    ((equivSentence.symm φ).Realize fun a => (L.con a : M)) ↔ φ.Realize M := by
  simp only [equivSentence, Equiv.symm_symm, Equiv.coe_trans, Realize,
    BoundedFormula.realize_relabelEquiv, Function.comp]
  refine' _root_.trans _ BoundedFormula.realize_constantsVarsEquiv
  

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
inst✝ : LHom.IsExpansionOn (lhomWithConstants L α) M
φ : Sentence (L[[α]])
⊢ BoundedFormula.Realize (BoundedFormula.constantsVarsEquiv φ) (fun x => ↑(Language.con L ((Equiv.sumEmpty α Empty) x)))
      default ↔
    BoundedFormula.Realize (BoundedFormula.constantsVarsEquiv φ) (Sum.elim (fun a => ↑(Language.con L a)) default)
      default

Next tactic:
rw [iff_iff_eq]
@[simp]
theorem realize_equivSentence_symm_con [L[[α]].Structure M]
    [(L.lhomWithConstants α).IsExpansionOn M] (φ : L[[α]].Sentence) :
    ((equivSentence.symm φ).Realize fun a => (L.con a : M)) ↔ φ.Realize M := by
  simp only [equivSentence, Equiv.symm_symm, Equiv.coe_trans, Realize,
    BoundedFormula.realize_relabelEquiv, Function.comp]
  refine' _root_.trans _ BoundedFormula.realize_constantsVarsEquiv
  rw [iff_iff_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 : ℕ
inst✝¹ : Structure (L[[α]]) M
inst✝ : LHom.IsExpansionOn (lhomWithConstants L α) M
φ : Sentence (L[[α]])
⊢ BoundedFormula.Realize (BoundedFormula.constantsVarsEquiv φ) (fun x => ↑(Language.con L ((Equiv.sumEmpty α Empty) x)))
      default =
    BoundedFormula.Realize (BoundedFormula.constantsVarsEquiv φ) (Sum.elim (fun a => ↑(Language.con L a)) default)
      default

Next tactic:
congr with (_ | a)
@[simp]
theorem realize_equivSentence_symm_con [L[[α]].Structure M]
    [(L.lhomWithConstants α).IsExpansionOn M] (φ : L[[α]].Sentence) :
    ((equivSentence.symm φ).Realize fun a => (L.con a : M)) ↔ φ.Realize M := by
  simp only [equivSentence, Equiv.symm_symm, Equiv.coe_trans, Realize,
    BoundedFormula.realize_relabelEquiv, Function.comp]
  refine' _root_.trans _ BoundedFormula.realize_constantsVarsEquiv
  rw [iff_iff_eq]
  congr with (_ | a)
  · 

Proof state:
case e__v.h.inl
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
inst✝ : LHom.IsExpansionOn (lhomWithConstants L α) M
φ : Sentence (L[[α]])
val✝ : α
⊢ ↑(Language.con L ((Equiv.sumEmpty α Empty) (Sum.inl val✝))) =
    Sum.elim (fun a => ↑(Language.con L a)) default (Sum.inl val✝)

Next tactic:
simp
@[simp]
theorem realize_equivSentence_symm_con [L[[α]].Structure M]
    [(L.lhomWithConstants α).IsExpansionOn M] (φ : L[[α]].Sentence) :
    ((equivSentence.symm φ).Realize fun a => (L.con a : M)) ↔ φ.Realize M := by
  simp only [equivSentence, Equiv.symm_symm, Equiv.coe_trans, Realize,
    BoundedFormula.realize_relabelEquiv, Function.comp]
  refine' _root_.trans _ BoundedFormula.realize_constantsVarsEquiv
  rw [iff_iff_eq]
  congr with (_ | a)
  · simp
  · 

Proof state:
case e__v.h.inr
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
inst✝ : LHom.IsExpansionOn (lhomWithConstants L α) M
φ : Sentence (L[[α]])
a : Empty
⊢ ↑(Language.con L ((Equiv.sumEmpty α Empty) (Sum.inr a))) = Sum.elim (fun a => ↑(Language.con L a)) default (Sum.inr a)

Next tactic:
cases a
@[simp]
theorem realize_equivSentence [L[[α]].Structure M] [(L.lhomWithConstants α).IsExpansionOn M]
    (φ : L.Formula α) : (equivSentence φ).Realize M ↔ φ.Realize fun a => (L.con a : M) := 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
inst✝ : LHom.IsExpansionOn (lhomWithConstants L α) M
φ : Formula L α
⊢ M ⊨ equivSentence φ ↔ Realize φ fun a => ↑(Language.con L a)

Next tactic:
rw [← realize_equivSentence_symm_con M (equivSentence φ), _root_.Equiv.symm_apply_apply]
theorem elementarilyEquivalent_iff : M ≅[L] N ↔ ∀ φ : L.Sentence, M ⊨ φ ↔ N ⊨ φ := 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 : ℕ
⊢ M ≅[L] N ↔ ∀ (φ : Sentence L), M ⊨ φ ↔ N ⊨ φ

Next tactic:
simp only [ElementarilyEquivalent, Set.ext_iff, completeTheory, Set.mem_setOf_eq]
@[simp]
theorem LHom.onTheory_model [L'.Structure M] (φ : L →ᴸ L') [φ.IsExpansionOn M] (T : L.Theory) :
    M ⊨ φ.onTheory T ↔ M ⊨ T := 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 : ℕ
T✝ : Theory L
inst✝¹ : Structure L' M
φ : L →ᴸ L'
inst✝ : IsExpansionOn φ M
T : Theory L
⊢ M ⊨ onTheory φ T ↔ M ⊨ T

Next tactic:
simp [Theory.model_iff, LHom.onTheory]
theorem Model.union {T' : L.Theory} (h : M ⊨ T) (h' : M ⊨ T') : M ⊨ T ∪ T' := 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 : ℕ
T T' : Theory L
h : M ⊨ T
h' : M ⊨ T'
⊢ M ⊨ T ∪ T'

Next tactic:
simp only [model_iff, Set.mem_union] at *
theorem Model.union {T' : L.Theory} (h : M ⊨ T) (h' : M ⊨ T') : M ⊨ T ∪ T' := by
  simp only [model_iff, Set.mem_union] at *
  

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 : ℕ
T T' : Theory L
h : ∀ φ ∈ T, M ⊨ φ
h' : ∀ φ ∈ T', M ⊨ φ
⊢ ∀ (φ : Sentence L), φ ∈ T ∨ φ ∈ T' → M ⊨ φ

Next tactic:
exact fun φ hφ => hφ.elim (h _) (h' _)
theorem model_singleton_iff {φ : L.Sentence} : M ⊨ ({φ} : L.Theory) ↔ M ⊨ φ := 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 : ℕ
T : Theory L
φ : Sentence L
⊢ M ⊨ {φ} ↔ M ⊨ φ

Next tactic:
simp
theorem realize_iff_of_model_completeTheory [N ⊨ L.completeTheory M] (φ : L.Sentence) :
    N ⊨ φ ↔ M ⊨ φ := 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 : ℕ
T : Theory L
inst✝ : N ⊨ completeTheory L M
φ : Sentence L
⊢ N ⊨ φ ↔ M ⊨ φ

Next tactic:
refine' ⟨fun h => _, (L.completeTheory M).realize_sentence_of_mem⟩
theorem realize_iff_of_model_completeTheory [N ⊨ L.completeTheory M] (φ : L.Sentence) :
    N ⊨ φ ↔ M ⊨ φ := by
  refine' ⟨fun h => _, (L.completeTheory M).realize_sentence_of_mem⟩
  

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 : ℕ
T : Theory L
inst✝ : N ⊨ completeTheory L M
φ : Sentence L
h : N ⊨ φ
⊢ M ⊨ φ

Next tactic:
contrapose! h
theorem realize_iff_of_model_completeTheory [N ⊨ L.completeTheory M] (φ : L.Sentence) :
    N ⊨ φ ↔ M ⊨ φ := by
  refine' ⟨fun h => _, (L.completeTheory M).realize_sentence_of_mem⟩
  contrapose! h
  

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 : ℕ
T : Theory L
inst✝ : N ⊨ completeTheory L M
φ : Sentence L
h : ¬M ⊨ φ
⊢ ¬N ⊨ φ

Next tactic:
rw [← Sentence.realize_not] at *
theorem realize_iff_of_model_completeTheory [N ⊨ L.completeTheory M] (φ : L.Sentence) :
    N ⊨ φ ↔ M ⊨ φ := by
  refine' ⟨fun h => _, (L.completeTheory M).realize_sentence_of_mem⟩
  contrapose! h
  rw [← Sentence.realize_not] at *
  

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 : ℕ
T : Theory L
inst✝ : N ⊨ completeTheory L M
φ : Sentence L
h : M ⊨ Formula.not φ
⊢ N ⊨ Formula.not φ

Next tactic:
exact (L.completeTheory M).realize_sentence_of_mem (mem_completeTheory.2 h)
@[simp]
theorem realize_alls {φ : L.BoundedFormula α n} {v : α → M} :
    φ.alls.Realize v ↔ ∀ xs : Fin n → M, φ.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 : ℕ
T : Theory L
φ : BoundedFormula L α n
v : α → M
⊢ Formula.Realize (alls φ) v ↔ ∀ (xs : Fin n → M), Realize φ v xs

Next tactic:
induction' n with n ih
@[simp]
theorem realize_alls {φ : L.BoundedFormula α n} {v : α → M} :
    φ.alls.Realize v ↔ ∀ xs : Fin n → M, φ.Realize v xs := by
  induction' n with n ih
  · 

Proof state:
case zero
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 : ℕ
T : Theory L
v : α → M
φ : BoundedFormula L α Nat.zero
⊢ Formula.Realize (alls φ) v ↔ ∀ (xs : Fin Nat.zero → M), Realize φ v xs

Next tactic:
exact Unique.forall_iff.symm
@[simp]
theorem realize_alls {φ : L.BoundedFormula α n} {v : α → M} :
    φ.alls.Realize v ↔ ∀ xs : Fin n → M, φ.Realize v xs := by
  induction' n with n ih
  · exact Unique.forall_iff.symm
  · 

Proof state:
case succ
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✝ : ℕ
T : Theory L
v : α → M
n : ℕ
ih : ∀ {φ : BoundedFormula L α n}, Formula.Realize (alls φ) v ↔ ∀ (xs : Fin n → M), Realize φ v xs
φ : BoundedFormula L α (Nat.succ n)
⊢ Formula.Realize (alls φ) v ↔ ∀ (xs : Fin (Nat.succ n) → M), Realize φ v xs

Next tactic:
simp only [alls, ih, Realize]
@[simp]
theorem realize_alls {φ : L.BoundedFormula α n} {v : α → M} :
    φ.alls.Realize v ↔ ∀ xs : Fin n → M, φ.Realize v xs := by
  induction' n with n ih
  · exact Unique.forall_iff.symm
  · simp only [alls, ih, Realize]
    

Proof state:
case succ
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✝ : ℕ
T : Theory L
v : α → M
n : ℕ
ih : ∀ {φ : BoundedFormula L α n}, Formula.Realize (alls φ) v ↔ ∀ (xs : Fin n → M), Realize φ v xs
φ : BoundedFormula L α (Nat.succ n)
⊢ (∀ (xs : Fin n → M) (x : M), Realize φ v (snoc xs x)) ↔ ∀ (xs : Fin (Nat.succ n) → M), Realize φ v xs

Next tactic:
exact ⟨fun h xs => Fin.snoc_init_self xs ▸ h _ _, fun h xs x => h (Fin.snoc xs x)⟩
@[simp]
theorem realize_exs {φ : L.BoundedFormula α n} {v : α → M} :
    φ.exs.Realize v ↔ ∃ xs : Fin n → M, φ.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 : ℕ
T : Theory L
φ : BoundedFormula L α n
v : α → M
⊢ Formula.Realize (exs φ) v ↔ ∃ xs, Realize φ v xs

Next tactic:
induction' n with n ih
@[simp]
theorem realize_exs {φ : L.BoundedFormula α n} {v : α → M} :
    φ.exs.Realize v ↔ ∃ xs : Fin n → M, φ.Realize v xs := by
  induction' n with n ih
  · 

Proof state:
case zero
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 : ℕ
T : Theory L
v : α → M
φ : BoundedFormula L α Nat.zero
⊢ Formula.Realize (exs φ) v ↔ ∃ xs, Realize φ v xs

Next tactic:
exact Unique.exists_iff.symm
@[simp]
theorem realize_exs {φ : L.BoundedFormula α n} {v : α → M} :
    φ.exs.Realize v ↔ ∃ xs : Fin n → M, φ.Realize v xs := by
  induction' n with n ih
  · exact Unique.exists_iff.symm
  · 

Proof state:
case succ
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✝ : ℕ
T : Theory L
v : α → M
n : ℕ
ih : ∀ {φ : BoundedFormula L α n}, Formula.Realize (exs φ) v ↔ ∃ xs, Realize φ v xs
φ : BoundedFormula L α (Nat.succ n)
⊢ Formula.Realize (exs φ) v ↔ ∃ xs, Realize φ v xs

Next tactic:
simp only [BoundedFormula.exs, ih, realize_ex]
@[simp]
theorem realize_exs {φ : L.BoundedFormula α n} {v : α → M} :
    φ.exs.Realize v ↔ ∃ xs : Fin n → M, φ.Realize v xs := by
  induction' n with n ih
  · exact Unique.exists_iff.symm
  · simp only [BoundedFormula.exs, ih, realize_ex]
    

Proof state:
case succ
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✝ : ℕ
T : Theory L
v : α → M
n : ℕ
ih : ∀ {φ : BoundedFormula L α n}, Formula.Realize (exs φ) v ↔ ∃ xs, Realize φ v xs
φ : BoundedFormula L α (Nat.succ n)
⊢ (∃ xs a, Realize φ v (snoc xs a)) ↔ ∃ xs, Realize φ v xs

Next tactic:
constructor
@[simp]
theorem realize_exs {φ : L.BoundedFormula α n} {v : α → M} :
    φ.exs.Realize v ↔ ∃ xs : Fin n → M, φ.Realize v xs := by
  induction' n with n ih
  · exact Unique.exists_iff.symm
  · simp only [BoundedFormula.exs, ih, realize_ex]
    constructor
    · 

Proof state:
case succ.mp
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✝ : ℕ
T : Theory L
v : α → M
n : ℕ
ih : ∀ {φ : BoundedFormula L α n}, Formula.Realize (exs φ) v ↔ ∃ xs, Realize φ v xs
φ : BoundedFormula L α (Nat.succ n)
⊢ (∃ xs a, Realize φ v (snoc xs a)) → ∃ xs, Realize φ v xs

Next tactic:
rintro ⟨xs, x, h⟩
@[simp]
theorem realize_exs {φ : L.BoundedFormula α n} {v : α → M} :
    φ.exs.Realize v ↔ ∃ xs : Fin n → M, φ.Realize v xs := by
  induction' n with n ih
  · exact Unique.exists_iff.symm
  · simp only [BoundedFormula.exs, ih, realize_ex]
    constructor
    · rintro ⟨xs, x, h⟩
      

Proof state:
case succ.mp.intro.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✝ : ℕ
T : Theory L
v : α → M
n : ℕ
ih : ∀ {φ : BoundedFormula L α n}, Formula.Realize (exs φ) v ↔ ∃ xs, Realize φ v xs
φ : BoundedFormula L α (Nat.succ n)
xs : Fin n → M
x : M
h : Realize φ v (snoc xs x)
⊢ ∃ xs, Realize φ v xs

Next tactic:
exact ⟨_, h⟩
@[simp]
theorem realize_exs {φ : L.BoundedFormula α n} {v : α → M} :
    φ.exs.Realize v ↔ ∃ xs : Fin n → M, φ.Realize v xs := by
  induction' n with n ih
  · exact Unique.exists_iff.symm
  · simp only [BoundedFormula.exs, ih, realize_ex]
    constructor
    · rintro ⟨xs, x, h⟩
      exact ⟨_, h⟩
    · 

Proof state:
case succ.mpr
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✝ : ℕ
T : Theory L
v : α → M
n : ℕ
ih : ∀ {φ : BoundedFormula L α n}, Formula.Realize (exs φ) v ↔ ∃ xs, Realize φ v xs
φ : BoundedFormula L α (Nat.succ n)
⊢ (∃ xs, Realize φ v xs) → ∃ xs a, Realize φ v (snoc xs a)

Next tactic:
rintro ⟨xs, h⟩
@[simp]
theorem realize_exs {φ : L.BoundedFormula α n} {v : α → M} :
    φ.exs.Realize v ↔ ∃ xs : Fin n → M, φ.Realize v xs := by
  induction' n with n ih
  · exact Unique.exists_iff.symm
  · simp only [BoundedFormula.exs, ih, realize_ex]
    constructor
    · rintro ⟨xs, x, h⟩
      exact ⟨_, h⟩
    · rintro ⟨xs, h⟩
      

Proof state:
case succ.mpr.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✝ : ℕ
T : Theory L
v : α → M
n : ℕ
ih : ∀ {φ : BoundedFormula L α n}, Formula.Realize (exs φ) v ↔ ∃ xs, Realize φ v xs
φ : BoundedFormula L α (Nat.succ n)
xs : Fin (Nat.succ n) → M
h : Realize φ v xs
⊢ ∃ xs a, Realize φ v (snoc xs a)

Next tactic:
rw [← Fin.snoc_init_self xs] at h
@[simp]
theorem realize_exs {φ : L.BoundedFormula α n} {v : α → M} :
    φ.exs.Realize v ↔ ∃ xs : Fin n → M, φ.Realize v xs := by
  induction' n with n ih
  · exact Unique.exists_iff.symm
  · simp only [BoundedFormula.exs, ih, realize_ex]
    constructor
    · rintro ⟨xs, x, h⟩
      exact ⟨_, h⟩
    · rintro ⟨xs, h⟩
      rw [← Fin.snoc_init_self xs] at h
      

Proof state:
case succ.mpr.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✝ : ℕ
T : Theory L
v : α → M
n : ℕ
ih : ∀ {φ : BoundedFormula L α n}, Formula.Realize (exs φ) v ↔ ∃ xs, Realize φ v xs
φ : BoundedFormula L α (Nat.succ n)
xs : Fin (Nat.succ n) → M
h : Realize φ v (snoc (init xs) (xs (last n)))
⊢ ∃ xs a, Realize φ v (snoc xs a)

Next tactic:
exact ⟨_, _, h⟩
@[simp]
theorem _root_.FirstOrder.Language.Formula.realize_iAlls
    [Finite γ] {f : α → β ⊕ γ}
    {φ : L.Formula α} {v : β → M} : (φ.iAlls f).Realize v ↔
      ∀ (i : γ → M), φ.Realize (fun a => Sum.elim v i (f a)) := 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 : ℕ
T : Theory L
inst✝ : Finite γ
f : α → β ⊕ γ
φ : Formula L α
v : β → M
⊢ Formula.Realize (Formula.iAlls f φ) v ↔ ∀ (i : γ → M), Formula.Realize φ fun a => Sum.elim v i (f a)

Next tactic:
let e := Classical.choice (Classical.choose_spec (Finite.exists_equiv_fin γ))