l3lab/ntp-mathlib huggingface dataset:
@[simp]
theorem realize_toFormula (φ : L.BoundedFormula α n) (v : Sum α (Fin n) → M) :
    φ.toFormula.Realize v ↔ φ.Realize (v ∘ Sum.inl) (v ∘ Sum.inr) := by
  induction' φ with _ _ _ _ _ _ _ _ _ _ _ ih1 ih2 _ _ ih3 a8 a9 a0
  · rfl
  · simp [BoundedFormula.Realize]
  · simp [BoundedFormula.Realize]
  · rw [toFormula, Formula.Realize, realize_imp, ← Formula.Realize, ih1, ← Formula.Realize, ih2,
      realize_imp]
  · rw [toFormula, Formula.Realize, realize_all, realize_all]
    refine' forall_congr' fun a => _
    have h := ih3 (Sum.elim (v ∘ Sum.inl) (snoc (v ∘ Sum.inr) a))
    simp only [Sum.elim_comp_inl, Sum.elim_comp_inr] at h
    rw [← h, realize_relabel, Formula.Realize, iff_iff_eq]
    simp only [Function.comp]
    congr with x
    · cases' x with _ x
      · simp
      · refine' Fin.lastCases _ _ x
        · rw [Sum.elim_inr, Sum.elim_inr,
            finSumFinEquiv_symm_last, Sum.map_inr, Sum.elim_inr]
          simp [Fin.snoc]
        · simp only [castSucc, Function.comp_apply, Sum.elim_inr,
            finSumFinEquiv_symm_apply_castAdd, Sum.map_inl, Sum.elim_inl]
          rw [← castSucc]
          simp
    · 

Proof state:
case all.e__xs.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 : ℕ
T : Theory L
n✝ : ℕ
f✝ : BoundedFormula L α (n✝ + 1)
ih3 : ∀ (v : α ⊕ Fin (n✝ + 1) → M), Formula.Realize (toFormula f✝) v ↔ Realize f✝ (v ∘ Sum.inl) (v ∘ Sum.inr)
v : α ⊕ Fin n✝ → M
a : M
h :
  Formula.Realize (toFormula f✝) (Sum.elim (v ∘ Sum.inl) (snoc (v ∘ Sum.inr) a)) ↔
    Realize f✝ (v ∘ Sum.inl) (snoc (v ∘ Sum.inr) a)
x : Fin 0
⊢ snoc default a (natAdd 1 x) = default x

Next tactic:
exact Fin.elim0 x
@[simp]
theorem realize_iSup (s : Finset β) (f : β → L.BoundedFormula α n)
    (v : α → M) (v' : Fin n → M) :
    (iSup s f).Realize v v' ↔ ∃ b ∈ s, (f b).Realize v 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 : ℕ
T : Theory L
s : Finset β
f : β → BoundedFormula L α n
v : α → M
v' : Fin n → M
⊢ Realize (iSup s f) v v' ↔ ∃ b ∈ s, Realize (f b) v v'

Next tactic:
simp only [iSup, realize_foldr_sup, List.mem_map, Finset.mem_toList,
    exists_exists_and_eq_and]
@[simp]
theorem realize_iInf (s : Finset β) (f : β → L.BoundedFormula α n)
    (v : α → M) (v' : Fin n → M) :
    (iInf s f).Realize v v' ↔ ∀ b ∈ s, (f b).Realize v 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 : ℕ
T : Theory L
s : Finset β
f : β → BoundedFormula L α n
v : α → M
v' : Fin n → M
⊢ Realize (iInf s f) v v' ↔ ∀ b ∈ s, Realize (f b) v v'

Next tactic:
simp only [iInf, realize_foldr_inf, List.mem_map, Finset.mem_toList,
    forall_exists_index, and_imp, forall_apply_eq_imp_iff₂]
@[simp]
theorem realize_boundedFormula (g : M ≃[L] N) (φ : L.BoundedFormula α n) {v : α → M}
    {xs : Fin n → M} : φ.Realize (g ∘ v) (g ∘ 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 : ℕ
T : Theory L
g : M ≃[L] N
φ : BoundedFormula L α n
v : α → M
xs : Fin n → M
⊢ BoundedFormula.Realize φ (⇑g ∘ v) (⇑g ∘ xs) ↔ BoundedFormula.Realize φ v xs

Next tactic:
induction' φ with _ _ _ _ _ _ _ _ _ _ _ ih1 ih2 _ _ ih3
@[simp]
theorem realize_boundedFormula (g : M ≃[L] N) (φ : L.BoundedFormula α n) {v : α → M}
    {xs : Fin n → M} : φ.Realize (g ∘ v) (g ∘ 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 : ℕ
T : Theory L
g : M ≃[L] N
v : α → M
n✝ : ℕ
xs : Fin n✝ → M
⊢ BoundedFormula.Realize BoundedFormula.falsum (⇑g ∘ v) (⇑g ∘ xs) ↔ BoundedFormula.Realize BoundedFormula.falsum v xs

Next tactic:
rfl
@[simp]
theorem realize_boundedFormula (g : M ≃[L] N) (φ : L.BoundedFormula α n) {v : α → M}
    {xs : Fin n → M} : φ.Realize (g ∘ v) (g ∘ 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 : ℕ
T : Theory L
g : M ≃[L] N
v : α → M
n✝ : ℕ
t₁✝ t₂✝ : Term L (α ⊕ Fin n✝)
xs : Fin n✝ → M
⊢ BoundedFormula.Realize (BoundedFormula.equal t₁✝ t₂✝) (⇑g ∘ v) (⇑g ∘ xs) ↔
    BoundedFormula.Realize (BoundedFormula.equal t₁✝ t₂✝) v xs

Next tactic:
simp only [BoundedFormula.Realize, ← Sum.comp_elim, Equiv.realize_term, g.injective.eq_iff]
@[simp]
theorem realize_boundedFormula (g : M ≃[L] N) (φ : L.BoundedFormula α n) {v : α → M}
    {xs : Fin n → M} : φ.Realize (g ∘ v) (g ∘ xs) ↔ φ.Realize v xs := by
  induction' φ with _ _ _ _ _ _ _ _ _ _ _ ih1 ih2 _ _ ih3
  · rfl
  · simp only [BoundedFormula.Realize, ← Sum.comp_elim, Equiv.realize_term, g.injective.eq_iff]
  · 

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 : ℕ
T : Theory L
g : M ≃[L] N
v : α → M
n✝ l✝ : ℕ
R✝ : Relations L l✝
ts✝ : Fin l✝ → Term L (α ⊕ Fin n✝)
xs : Fin n✝ → M
⊢ BoundedFormula.Realize (BoundedFormula.rel R✝ ts✝) (⇑g ∘ v) (⇑g ∘ xs) ↔
    BoundedFormula.Realize (BoundedFormula.rel R✝ ts✝) v xs

Next tactic:
simp only [BoundedFormula.Realize, ← Sum.comp_elim, Equiv.realize_term]
@[simp]
theorem realize_boundedFormula (g : M ≃[L] N) (φ : L.BoundedFormula α n) {v : α → M}
    {xs : Fin n → M} : φ.Realize (g ∘ v) (g ∘ xs) ↔ φ.Realize v xs := by
  induction' φ with _ _ _ _ _ _ _ _ _ _ _ ih1 ih2 _ _ ih3
  · rfl
  · simp only [BoundedFormula.Realize, ← Sum.comp_elim, Equiv.realize_term, g.injective.eq_iff]
  · simp only [BoundedFormula.Realize, ← Sum.comp_elim, Equiv.realize_term]
    

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 : ℕ
T : Theory L
g : M ≃[L] N
v : α → M
n✝ l✝ : ℕ
R✝ : Relations L l✝
ts✝ : Fin l✝ → Term L (α ⊕ Fin n✝)
xs : Fin n✝ → M
⊢ (RelMap R✝ fun i => g (Term.realize (Sum.elim v xs) (ts✝ i))) ↔
    RelMap R✝ fun i => Term.realize (Sum.elim v xs) (ts✝ i)

Next tactic:
exact g.map_rel _ _
@[simp]
theorem realize_boundedFormula (g : M ≃[L] N) (φ : L.BoundedFormula α n) {v : α → M}
    {xs : Fin n → M} : φ.Realize (g ∘ v) (g ∘ xs) ↔ φ.Realize v xs := by
  induction' φ with _ _ _ _ _ _ _ _ _ _ _ ih1 ih2 _ _ ih3
  · rfl
  · simp only [BoundedFormula.Realize, ← Sum.comp_elim, Equiv.realize_term, g.injective.eq_iff]
  · simp only [BoundedFormula.Realize, ← Sum.comp_elim, Equiv.realize_term]
    exact g.map_rel _ _
  · 

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 : ℕ
T : Theory L
g : M ≃[L] N
v : α → M
n✝ : ℕ
f₁✝ f₂✝ : BoundedFormula L α n✝
ih1 : ∀ {xs : Fin n✝ → M}, BoundedFormula.Realize f₁✝ (⇑g ∘ v) (⇑g ∘ xs) ↔ BoundedFormula.Realize f₁✝ v xs
ih2 : ∀ {xs : Fin n✝ → M}, BoundedFormula.Realize f₂✝ (⇑g ∘ v) (⇑g ∘ xs) ↔ BoundedFormula.Realize f₂✝ v xs
xs : Fin n✝ → M
⊢ BoundedFormula.Realize (f₁✝ ⟹ f₂✝) (⇑g ∘ v) (⇑g ∘ xs) ↔ BoundedFormula.Realize (f₁✝ ⟹ f₂✝) v xs

Next tactic:
rw [BoundedFormula.Realize, ih1, ih2, BoundedFormula.Realize]
@[simp]
theorem realize_boundedFormula (g : M ≃[L] N) (φ : L.BoundedFormula α n) {v : α → M}
    {xs : Fin n → M} : φ.Realize (g ∘ v) (g ∘ xs) ↔ φ.Realize v xs := by
  induction' φ with _ _ _ _ _ _ _ _ _ _ _ ih1 ih2 _ _ ih3
  · rfl
  · simp only [BoundedFormula.Realize, ← Sum.comp_elim, Equiv.realize_term, g.injective.eq_iff]
  · simp only [BoundedFormula.Realize, ← Sum.comp_elim, Equiv.realize_term]
    exact g.map_rel _ _
  · rw [BoundedFormula.Realize, ih1, ih2, BoundedFormula.Realize]
  · 

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 : ℕ
T : Theory L
g : M ≃[L] N
v : α → M
n✝ : ℕ
f✝ : BoundedFormula L α (n✝ + 1)
ih3 : ∀ {xs : Fin (n✝ + 1) → M}, BoundedFormula.Realize f✝ (⇑g ∘ v) (⇑g ∘ xs) ↔ BoundedFormula.Realize f✝ v xs
xs : Fin n✝ → M
⊢ BoundedFormula.Realize (∀'f✝) (⇑g ∘ v) (⇑g ∘ xs) ↔ BoundedFormula.Realize (∀'f✝) v xs

Next tactic:
rw [BoundedFormula.Realize, BoundedFormula.Realize]
@[simp]
theorem realize_boundedFormula (g : M ≃[L] N) (φ : L.BoundedFormula α n) {v : α → M}
    {xs : Fin n → M} : φ.Realize (g ∘ v) (g ∘ xs) ↔ φ.Realize v xs := by
  induction' φ with _ _ _ _ _ _ _ _ _ _ _ ih1 ih2 _ _ ih3
  · rfl
  · simp only [BoundedFormula.Realize, ← Sum.comp_elim, Equiv.realize_term, g.injective.eq_iff]
  · simp only [BoundedFormula.Realize, ← Sum.comp_elim, Equiv.realize_term]
    exact g.map_rel _ _
  · rw [BoundedFormula.Realize, ih1, ih2, BoundedFormula.Realize]
  · rw [BoundedFormula.Realize, BoundedFormula.Realize]
    

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 : ℕ
T : Theory L
g : M ≃[L] N
v : α → M
n✝ : ℕ
f✝ : BoundedFormula L α (n✝ + 1)
ih3 : ∀ {xs : Fin (n✝ + 1) → M}, BoundedFormula.Realize f✝ (⇑g ∘ v) (⇑g ∘ xs) ↔ BoundedFormula.Realize f✝ v xs
xs : Fin n✝ → M
⊢ (∀ (x : N), BoundedFormula.Realize f✝ (⇑g ∘ v) (snoc (⇑g ∘ xs) x)) ↔
    ∀ (x : M), BoundedFormula.Realize f✝ v (snoc xs x)

Next tactic:
constructor
@[simp]
theorem realize_boundedFormula (g : M ≃[L] N) (φ : L.BoundedFormula α n) {v : α → M}
    {xs : Fin n → M} : φ.Realize (g ∘ v) (g ∘ xs) ↔ φ.Realize v xs := by
  induction' φ with _ _ _ _ _ _ _ _ _ _ _ ih1 ih2 _ _ ih3
  · rfl
  · simp only [BoundedFormula.Realize, ← Sum.comp_elim, Equiv.realize_term, g.injective.eq_iff]
  · simp only [BoundedFormula.Realize, ← Sum.comp_elim, Equiv.realize_term]
    exact g.map_rel _ _
  · rw [BoundedFormula.Realize, ih1, ih2, BoundedFormula.Realize]
  · rw [BoundedFormula.Realize, BoundedFormula.Realize]
    constructor
    · 

Proof state:
case all.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
g : M ≃[L] N
v : α → M
n✝ : ℕ
f✝ : BoundedFormula L α (n✝ + 1)
ih3 : ∀ {xs : Fin (n✝ + 1) → M}, BoundedFormula.Realize f✝ (⇑g ∘ v) (⇑g ∘ xs) ↔ BoundedFormula.Realize f✝ v xs
xs : Fin n✝ → M
⊢ (∀ (x : N), BoundedFormula.Realize f✝ (⇑g ∘ v) (snoc (⇑g ∘ xs) x)) →
    ∀ (x : M), BoundedFormula.Realize f✝ v (snoc xs x)

Next tactic:
intro h a
@[simp]
theorem realize_boundedFormula (g : M ≃[L] N) (φ : L.BoundedFormula α n) {v : α → M}
    {xs : Fin n → M} : φ.Realize (g ∘ v) (g ∘ xs) ↔ φ.Realize v xs := by
  induction' φ with _ _ _ _ _ _ _ _ _ _ _ ih1 ih2 _ _ ih3
  · rfl
  · simp only [BoundedFormula.Realize, ← Sum.comp_elim, Equiv.realize_term, g.injective.eq_iff]
  · simp only [BoundedFormula.Realize, ← Sum.comp_elim, Equiv.realize_term]
    exact g.map_rel _ _
  · rw [BoundedFormula.Realize, ih1, ih2, BoundedFormula.Realize]
  · rw [BoundedFormula.Realize, BoundedFormula.Realize]
    constructor
    · intro h a
      

Proof state:
case all.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
g : M ≃[L] N
v : α → M
n✝ : ℕ
f✝ : BoundedFormula L α (n✝ + 1)
ih3 : ∀ {xs : Fin (n✝ + 1) → M}, BoundedFormula.Realize f✝ (⇑g ∘ v) (⇑g ∘ xs) ↔ BoundedFormula.Realize f✝ v xs
xs : Fin n✝ → M
h : ∀ (x : N), BoundedFormula.Realize f✝ (⇑g ∘ v) (snoc (⇑g ∘ xs) x)
a : M
⊢ BoundedFormula.Realize f✝ v (snoc xs a)

Next tactic:
have h' := h (g a)
@[simp]
theorem realize_boundedFormula (g : M ≃[L] N) (φ : L.BoundedFormula α n) {v : α → M}
    {xs : Fin n → M} : φ.Realize (g ∘ v) (g ∘ xs) ↔ φ.Realize v xs := by
  induction' φ with _ _ _ _ _ _ _ _ _ _ _ ih1 ih2 _ _ ih3
  · rfl
  · simp only [BoundedFormula.Realize, ← Sum.comp_elim, Equiv.realize_term, g.injective.eq_iff]
  · simp only [BoundedFormula.Realize, ← Sum.comp_elim, Equiv.realize_term]
    exact g.map_rel _ _
  · rw [BoundedFormula.Realize, ih1, ih2, BoundedFormula.Realize]
  · rw [BoundedFormula.Realize, BoundedFormula.Realize]
    constructor
    · intro h a
      have h' := h (g a)
      

Proof state:
case all.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
g : M ≃[L] N
v : α → M
n✝ : ℕ
f✝ : BoundedFormula L α (n✝ + 1)
ih3 : ∀ {xs : Fin (n✝ + 1) → M}, BoundedFormula.Realize f✝ (⇑g ∘ v) (⇑g ∘ xs) ↔ BoundedFormula.Realize f✝ v xs
xs : Fin n✝ → M
h : ∀ (x : N), BoundedFormula.Realize f✝ (⇑g ∘ v) (snoc (⇑g ∘ xs) x)
a : M
h' : BoundedFormula.Realize f✝ (⇑g ∘ v) (snoc (⇑g ∘ xs) (g a))
⊢ BoundedFormula.Realize f✝ v (snoc xs a)

Next tactic:
rw [← Fin.comp_snoc, ih3] at h'
@[simp]
theorem realize_boundedFormula (g : M ≃[L] N) (φ : L.BoundedFormula α n) {v : α → M}
    {xs : Fin n → M} : φ.Realize (g ∘ v) (g ∘ xs) ↔ φ.Realize v xs := by
  induction' φ with _ _ _ _ _ _ _ _ _ _ _ ih1 ih2 _ _ ih3
  · rfl
  · simp only [BoundedFormula.Realize, ← Sum.comp_elim, Equiv.realize_term, g.injective.eq_iff]
  · simp only [BoundedFormula.Realize, ← Sum.comp_elim, Equiv.realize_term]
    exact g.map_rel _ _
  · rw [BoundedFormula.Realize, ih1, ih2, BoundedFormula.Realize]
  · rw [BoundedFormula.Realize, BoundedFormula.Realize]
    constructor
    · intro h a
      have h' := h (g a)
      rw [← Fin.comp_snoc, ih3] at h'
      

Proof state:
case all.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
g : M ≃[L] N
v : α → M
n✝ : ℕ
f✝ : BoundedFormula L α (n✝ + 1)
ih3 : ∀ {xs : Fin (n✝ + 1) → M}, BoundedFormula.Realize f✝ (⇑g ∘ v) (⇑g ∘ xs) ↔ BoundedFormula.Realize f✝ v xs
xs : Fin n✝ → M
h : ∀ (x : N), BoundedFormula.Realize f✝ (⇑g ∘ v) (snoc (⇑g ∘ xs) x)
a : M
h' : BoundedFormula.Realize f✝ v (snoc xs a)
⊢ BoundedFormula.Realize f✝ v (snoc xs a)

Next tactic:
exact h'
@[simp]
theorem realize_boundedFormula (g : M ≃[L] N) (φ : L.BoundedFormula α n) {v : α → M}
    {xs : Fin n → M} : φ.Realize (g ∘ v) (g ∘ xs) ↔ φ.Realize v xs := by
  induction' φ with _ _ _ _ _ _ _ _ _ _ _ ih1 ih2 _ _ ih3
  · rfl
  · simp only [BoundedFormula.Realize, ← Sum.comp_elim, Equiv.realize_term, g.injective.eq_iff]
  · simp only [BoundedFormula.Realize, ← Sum.comp_elim, Equiv.realize_term]
    exact g.map_rel _ _
  · rw [BoundedFormula.Realize, ih1, ih2, BoundedFormula.Realize]
  · rw [BoundedFormula.Realize, BoundedFormula.Realize]
    constructor
    · intro h a
      have h' := h (g a)
      rw [← Fin.comp_snoc, ih3] at h'
      exact h'
    · 

Proof state:
case all.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
g : M ≃[L] N
v : α → M
n✝ : ℕ
f✝ : BoundedFormula L α (n✝ + 1)
ih3 : ∀ {xs : Fin (n✝ + 1) → M}, BoundedFormula.Realize f✝ (⇑g ∘ v) (⇑g ∘ xs) ↔ BoundedFormula.Realize f✝ v xs
xs : Fin n✝ → M
⊢ (∀ (x : M), BoundedFormula.Realize f✝ v (snoc xs x)) →
    ∀ (x : N), BoundedFormula.Realize f✝ (⇑g ∘ v) (snoc (⇑g ∘ xs) x)

Next tactic:
intro h a
@[simp]
theorem realize_boundedFormula (g : M ≃[L] N) (φ : L.BoundedFormula α n) {v : α → M}
    {xs : Fin n → M} : φ.Realize (g ∘ v) (g ∘ xs) ↔ φ.Realize v xs := by
  induction' φ with _ _ _ _ _ _ _ _ _ _ _ ih1 ih2 _ _ ih3
  · rfl
  · simp only [BoundedFormula.Realize, ← Sum.comp_elim, Equiv.realize_term, g.injective.eq_iff]
  · simp only [BoundedFormula.Realize, ← Sum.comp_elim, Equiv.realize_term]
    exact g.map_rel _ _
  · rw [BoundedFormula.Realize, ih1, ih2, BoundedFormula.Realize]
  · rw [BoundedFormula.Realize, BoundedFormula.Realize]
    constructor
    · intro h a
      have h' := h (g a)
      rw [← Fin.comp_snoc, ih3] at h'
      exact h'
    · intro h a
      

Proof state:
case all.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
g : M ≃[L] N
v : α → M
n✝ : ℕ
f✝ : BoundedFormula L α (n✝ + 1)
ih3 : ∀ {xs : Fin (n✝ + 1) → M}, BoundedFormula.Realize f✝ (⇑g ∘ v) (⇑g ∘ xs) ↔ BoundedFormula.Realize f✝ v xs
xs : Fin n✝ → M
h : ∀ (x : M), BoundedFormula.Realize f✝ v (snoc xs x)
a : N
⊢ BoundedFormula.Realize f✝ (⇑g ∘ v) (snoc (⇑g ∘ xs) a)

Next tactic:
have h' := h (g.symm a)
@[simp]
theorem realize_boundedFormula (g : M ≃[L] N) (φ : L.BoundedFormula α n) {v : α → M}
    {xs : Fin n → M} : φ.Realize (g ∘ v) (g ∘ xs) ↔ φ.Realize v xs := by
  induction' φ with _ _ _ _ _ _ _ _ _ _ _ ih1 ih2 _ _ ih3
  · rfl
  · simp only [BoundedFormula.Realize, ← Sum.comp_elim, Equiv.realize_term, g.injective.eq_iff]
  · simp only [BoundedFormula.Realize, ← Sum.comp_elim, Equiv.realize_term]
    exact g.map_rel _ _
  · rw [BoundedFormula.Realize, ih1, ih2, BoundedFormula.Realize]
  · rw [BoundedFormula.Realize, BoundedFormula.Realize]
    constructor
    · intro h a
      have h' := h (g a)
      rw [← Fin.comp_snoc, ih3] at h'
      exact h'
    · intro h a
      have h' := h (g.symm a)
      

Proof state:
case all.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
g : M ≃[L] N
v : α → M
n✝ : ℕ
f✝ : BoundedFormula L α (n✝ + 1)
ih3 : ∀ {xs : Fin (n✝ + 1) → M}, BoundedFormula.Realize f✝ (⇑g ∘ v) (⇑g ∘ xs) ↔ BoundedFormula.Realize f✝ v xs
xs : Fin n✝ → M
h : ∀ (x : M), BoundedFormula.Realize f✝ v (snoc xs x)
a : N
h' : BoundedFormula.Realize f✝ v (snoc xs ((symm g) a))
⊢ BoundedFormula.Realize f✝ (⇑g ∘ v) (snoc (⇑g ∘ xs) a)

Next tactic:
rw [← ih3, Fin.comp_snoc, g.apply_symm_apply] at h'
@[simp]
theorem realize_boundedFormula (g : M ≃[L] N) (φ : L.BoundedFormula α n) {v : α → M}
    {xs : Fin n → M} : φ.Realize (g ∘ v) (g ∘ xs) ↔ φ.Realize v xs := by
  induction' φ with _ _ _ _ _ _ _ _ _ _ _ ih1 ih2 _ _ ih3
  · rfl
  · simp only [BoundedFormula.Realize, ← Sum.comp_elim, Equiv.realize_term, g.injective.eq_iff]
  · simp only [BoundedFormula.Realize, ← Sum.comp_elim, Equiv.realize_term]
    exact g.map_rel _ _
  · rw [BoundedFormula.Realize, ih1, ih2, BoundedFormula.Realize]
  · rw [BoundedFormula.Realize, BoundedFormula.Realize]
    constructor
    · intro h a
      have h' := h (g a)
      rw [← Fin.comp_snoc, ih3] at h'
      exact h'
    · intro h a
      have h' := h (g.symm a)
      rw [← ih3, Fin.comp_snoc, g.apply_symm_apply] at h'
      

Proof state:
case all.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
g : M ≃[L] N
v : α → M
n✝ : ℕ
f✝ : BoundedFormula L α (n✝ + 1)
ih3 : ∀ {xs : Fin (n✝ + 1) → M}, BoundedFormula.Realize f✝ (⇑g ∘ v) (⇑g ∘ xs) ↔ BoundedFormula.Realize f✝ v xs
xs : Fin n✝ → M
h : ∀ (x : M), BoundedFormula.Realize f✝ v (snoc xs x)
a : N
h' : BoundedFormula.Realize f✝ (⇑g ∘ v) (snoc (⇑g ∘ xs) a)
⊢ BoundedFormula.Realize f✝ (⇑g ∘ v) (snoc (⇑g ∘ xs) a)

Next tactic:
exact h'
@[simp]
theorem realize_formula (g : M ≃[L] N) (φ : L.Formula α) {v : α → M} :
    φ.Realize (g ∘ v) ↔ φ.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 : ℕ
T : Theory L
g : M ≃[L] N
φ : Formula L α
v : α → M
⊢ Formula.Realize φ (⇑g ∘ v) ↔ Formula.Realize φ v

Next tactic:
rw [Formula.Realize, Formula.Realize, ← g.realize_boundedFormula φ, iff_eq_eq,
    Unique.eq_default (g ∘ default)]
theorem realize_sentence (g : 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 : ℕ
T : Theory L
g : M ≃[L] N
φ : Sentence L
⊢ M ⊨ φ ↔ N ⊨ φ

Next tactic:
rw [Sentence.Realize, Sentence.Realize, ← g.realize_formula, Unique.eq_default (g ∘ default)]
@[simp]
theorem Sentence.realize_cardGe (n) : M ⊨ Sentence.cardGe L n ↔ ↑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
n : ℕ
⊢ M ⊨ Sentence.cardGe L n ↔ ↑n ≤ #M

Next tactic:
rw [← lift_mk_fin, ← lift_le.{0}, lift_lift, lift_mk_le, Sentence.cardGe, Sentence.Realize,
    BoundedFormula.realize_exs]
@[simp]
theorem Sentence.realize_cardGe (n) : M ⊨ Sentence.cardGe L n ↔ ↑n ≤ #M := by
  rw [← lift_mk_fin, ← lift_le.{0}, lift_lift, lift_mk_le, Sentence.cardGe, Sentence.Realize,
    BoundedFormula.realize_exs]
  

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
n : ℕ
⊢ (∃ xs,
      BoundedFormula.Realize
        (List.foldr (fun x x_1 => x ⊓ x_1) ⊤
          (List.map (fun ij => ∼((var ∘ Sum.inr) ij.1 =' (var ∘ Sum.inr) ij.2))
            (List.filter (fun ij => decide (ij.1 ≠ ij.2)) (List.finRange n ×ˢ List.finRange n))))
        default xs) ↔
    Nonempty (Fin n ↪ M)

Next tactic:
simp_rw [BoundedFormula.realize_foldr_inf]
@[simp]
theorem Sentence.realize_cardGe (n) : M ⊨ Sentence.cardGe L n ↔ ↑n ≤ #M := by
  rw [← lift_mk_fin, ← lift_le.{0}, lift_lift, lift_mk_le, Sentence.cardGe, Sentence.Realize,
    BoundedFormula.realize_exs]
  simp_rw [BoundedFormula.realize_foldr_inf]
  

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
n : ℕ
⊢ (∃ xs,
      ∀
        φ ∈
          List.map (fun ij => ∼((var ∘ Sum.inr) ij.1 =' (var ∘ Sum.inr) ij.2))
            (List.filter (fun ij => decide (ij.1 ≠ ij.2)) (List.finRange n ×ˢ List.finRange n)),
        BoundedFormula.Realize φ default xs) ↔
    Nonempty (Fin n ↪ M)

Next tactic:
simp only [Function.comp_apply, List.mem_map, Prod.exists, Ne.def, List.mem_product,
    List.mem_finRange, forall_exists_index, and_imp, List.mem_filter, true_and_iff]
@[simp]
theorem Sentence.realize_cardGe (n) : M ⊨ Sentence.cardGe L n ↔ ↑n ≤ #M := by
  rw [← lift_mk_fin, ← lift_le.{0}, lift_lift, lift_mk_le, Sentence.cardGe, Sentence.Realize,
    BoundedFormula.realize_exs]
  simp_rw [BoundedFormula.realize_foldr_inf]
  simp only [Function.comp_apply, List.mem_map, Prod.exists, Ne.def, List.mem_product,
    List.mem_finRange, forall_exists_index, and_imp, List.mem_filter, true_and_iff]
  

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
n : ℕ
⊢ (∃ xs,
      ∀ (φ : BoundedFormula L Empty n) (x x_1 : Fin n),
        (decide ¬x = x_1) = true → ∼(var (Sum.inr x) =' var (Sum.inr x_1)) = φ → BoundedFormula.Realize φ default xs) ↔
    Nonempty (Fin n ↪ M)

Next tactic:
refine' ⟨_, fun xs => ⟨xs.some, _⟩⟩