l3lab/ntp-mathlib huggingface dataset:
@[simp]
theorem realize_subst {φ : L.BoundedFormula α n} {tf : α → L.Term β} {v : β → M} {xs : Fin n → M} :
    (φ.subst tf).Realize v xs ↔ φ.Realize (fun a => (tf a).realize v) xs :=
  realize_mapTermRel_id
    (fun n t x => by
      rw [Term.realize_subst]
      rcongr a
      · cases 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✝ l : ℕ
φ✝ ψ : BoundedFormula L α l
θ : BoundedFormula L α (Nat.succ l)
v✝ : α → M
xs✝ : Fin l → M
φ : BoundedFormula L α n✝
tf : α → Term L β
v : β → M
xs : Fin n✝ → M
n : ℕ
t : Term L (α ⊕ Fin n)
x : Fin n → M
val✝ : α
⊢ realize (Sum.elim v x) (Sum.elim (Term.relabel Sum.inl ∘ tf) (var ∘ Sum.inr) (Sum.inl val✝)) =
    Sum.elim (fun a => realize v (tf a)) x (Sum.inl val✝)

Next tactic:
simp only [Sum.elim_inl, Function.comp_apply, Term.realize_relabel, Sum.elim_comp_inl]
@[simp]
theorem realize_subst {φ : L.BoundedFormula α n} {tf : α → L.Term β} {v : β → M} {xs : Fin n → M} :
    (φ.subst tf).Realize v xs ↔ φ.Realize (fun a => (tf a).realize v) xs :=
  realize_mapTermRel_id
    (fun n t x => by
      rw [Term.realize_subst]
      rcongr a
      · cases a
        · simp only [Sum.elim_inl, Function.comp_apply, Term.realize_relabel, Sum.elim_comp_inl]
        · 

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✝ l : ℕ
φ✝ ψ : BoundedFormula L α l
θ : BoundedFormula L α (Nat.succ l)
v✝ : α → M
xs✝ : Fin l → M
φ : BoundedFormula L α n✝
tf : α → Term L β
v : β → M
xs : Fin n✝ → M
n : ℕ
t : Term L (α ⊕ Fin n)
x : Fin n → M
val✝ : Fin n
⊢ realize (Sum.elim v x) (Sum.elim (Term.relabel Sum.inl ∘ tf) (var ∘ Sum.inr) (Sum.inr val✝)) =
    Sum.elim (fun a => realize v (tf a)) x (Sum.inr val✝)

Next tactic:
rfl
@[simp]
theorem realize_subst {φ : L.BoundedFormula α n} {tf : α → L.Term β} {v : β → M} {xs : Fin n → M} :
    (φ.subst tf).Realize v xs ↔ φ.Realize (fun a => (tf a).realize v) xs :=
  realize_mapTermRel_id
    (fun n t x => by
      rw [Term.realize_subst]
      rcongr a
      · cases a
        · simp only [Sum.elim_inl, Function.comp_apply, Term.realize_relabel, Sum.elim_comp_inl]
        · rfl)
    (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
φ : BoundedFormula L α n
tf : α → Term L β
v : β → M
xs : Fin n → M
⊢ ∀ (n : ℕ) (R : Relations L n) (x : Fin n → M), RelMap (id R) x = RelMap R x

Next tactic:
simp
@[simp]
theorem realize_restrictFreeVar [DecidableEq α] {n : ℕ} {φ : L.BoundedFormula α n} {s : Set α}
    (h : ↑φ.freeVarFinset ⊆ s) {v : α → M} {xs : Fin n → M} :
    (φ.restrictFreeVar (Set.inclusion h)).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✝ : DecidableEq α
n : ℕ
φ : BoundedFormula L α n
s : Set α
h : ↑(freeVarFinset φ) ⊆ s
v : α → M
xs : Fin n → M
⊢ Realize (restrictFreeVar φ (Set.inclusion h)) (v ∘ Subtype.val) xs ↔ Realize φ v xs

Next tactic:
induction' φ with _ _ _ _ _ _ _ _ _ _ _ ih1 ih2 _ _ ih3
@[simp]
theorem realize_restrictFreeVar [DecidableEq α] {n : ℕ} {φ : L.BoundedFormula α n} {s : Set α}
    (h : ↑φ.freeVarFinset ⊆ s) {v : α → M} {xs : Fin n → M} :
    (φ.restrictFreeVar (Set.inclusion h)).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✝¹ l : ℕ
φ ψ : BoundedFormula L α l
θ : BoundedFormula L α (Nat.succ l)
v✝ : α → M
xs✝ : Fin l → M
inst✝ : DecidableEq α
n : ℕ
s : Set α
v : α → M
n✝ : ℕ
h : ↑(freeVarFinset falsum) ⊆ s
xs : Fin n✝ → M
⊢ Realize (restrictFreeVar falsum (Set.inclusion h)) (v ∘ Subtype.val) xs ↔ Realize falsum v xs

Next tactic:
rfl
@[simp]
theorem realize_restrictFreeVar [DecidableEq α] {n : ℕ} {φ : L.BoundedFormula α n} {s : Set α}
    (h : ↑φ.freeVarFinset ⊆ s) {v : α → M} {xs : Fin n → M} :
    (φ.restrictFreeVar (Set.inclusion h)).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✝¹ l : ℕ
φ ψ : BoundedFormula L α l
θ : BoundedFormula L α (Nat.succ l)
v✝ : α → M
xs✝ : Fin l → M
inst✝ : DecidableEq α
n : ℕ
s : Set α
v : α → M
n✝ : ℕ
t₁✝ t₂✝ : Term L (α ⊕ Fin n✝)
h : ↑(freeVarFinset (equal t₁✝ t₂✝)) ⊆ s
xs : Fin n✝ → M
⊢ Realize (restrictFreeVar (equal t₁✝ t₂✝) (Set.inclusion h)) (v ∘ Subtype.val) xs ↔ Realize (equal t₁✝ t₂✝) v xs

Next tactic:
simp [restrictFreeVar, Realize]
@[simp]
theorem realize_restrictFreeVar [DecidableEq α] {n : ℕ} {φ : L.BoundedFormula α n} {s : Set α}
    (h : ↑φ.freeVarFinset ⊆ s) {v : α → M} {xs : Fin n → M} :
    (φ.restrictFreeVar (Set.inclusion h)).Realize (v ∘ (↑)) xs ↔ φ.Realize v xs := by
  induction' φ with _ _ _ _ _ _ _ _ _ _ _ ih1 ih2 _ _ ih3
  · rfl
  · simp [restrictFreeVar, Realize]
  · 

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✝ : DecidableEq α
n : ℕ
s : Set α
v : α → M
n✝ l✝ : ℕ
R✝ : Relations L l✝
ts✝ : Fin l✝ → Term L (α ⊕ Fin n✝)
h : ↑(freeVarFinset (rel R✝ ts✝)) ⊆ s
xs : Fin n✝ → M
⊢ Realize (restrictFreeVar (rel R✝ ts✝) (Set.inclusion h)) (v ∘ Subtype.val) xs ↔ Realize (rel R✝ ts✝) v xs

Next tactic:
simp [restrictFreeVar, Realize]
@[simp]
theorem realize_restrictFreeVar [DecidableEq α] {n : ℕ} {φ : L.BoundedFormula α n} {s : Set α}
    (h : ↑φ.freeVarFinset ⊆ s) {v : α → M} {xs : Fin n → M} :
    (φ.restrictFreeVar (Set.inclusion h)).Realize (v ∘ (↑)) xs ↔ φ.Realize v xs := by
  induction' φ with _ _ _ _ _ _ _ _ _ _ _ ih1 ih2 _ _ ih3
  · rfl
  · simp [restrictFreeVar, Realize]
  · simp [restrictFreeVar, Realize]
  · 

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✝ : DecidableEq α
n : ℕ
s : Set α
v : α → M
n✝ : ℕ
f₁✝ f₂✝ : BoundedFormula L α n✝
ih1 :
  ∀ (h : ↑(freeVarFinset f₁✝) ⊆ s) {xs : Fin n✝ → M},
    Realize (restrictFreeVar f₁✝ (Set.inclusion h)) (v ∘ Subtype.val) xs ↔ Realize f₁✝ v xs
ih2 :
  ∀ (h : ↑(freeVarFinset f₂✝) ⊆ s) {xs : Fin n✝ → M},
    Realize (restrictFreeVar f₂✝ (Set.inclusion h)) (v ∘ Subtype.val) xs ↔ Realize f₂✝ v xs
h : ↑(freeVarFinset (f₁✝ ⟹ f₂✝)) ⊆ s
xs : Fin n✝ → M
⊢ Realize (restrictFreeVar (f₁✝ ⟹ f₂✝) (Set.inclusion h)) (v ∘ Subtype.val) xs ↔ Realize (f₁✝ ⟹ f₂✝) v xs

Next tactic:
simp [restrictFreeVar, Realize, ih1, ih2]
@[simp]
theorem realize_restrictFreeVar [DecidableEq α] {n : ℕ} {φ : L.BoundedFormula α n} {s : Set α}
    (h : ↑φ.freeVarFinset ⊆ s) {v : α → M} {xs : Fin n → M} :
    (φ.restrictFreeVar (Set.inclusion h)).Realize (v ∘ (↑)) xs ↔ φ.Realize v xs := by
  induction' φ with _ _ _ _ _ _ _ _ _ _ _ ih1 ih2 _ _ ih3
  · rfl
  · simp [restrictFreeVar, Realize]
  · simp [restrictFreeVar, Realize]
  · simp [restrictFreeVar, Realize, ih1, ih2]
  · 

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✝ : DecidableEq α
n : ℕ
s : Set α
v : α → M
n✝ : ℕ
f✝ : BoundedFormula L α (n✝ + 1)
ih3 :
  ∀ (h : ↑(freeVarFinset f✝) ⊆ s) {xs : Fin (n✝ + 1) → M},
    Realize (restrictFreeVar f✝ (Set.inclusion h)) (v ∘ Subtype.val) xs ↔ Realize f✝ v xs
h : ↑(freeVarFinset (∀'f✝)) ⊆ s
xs : Fin n✝ → M
⊢ Realize (restrictFreeVar (∀'f✝) (Set.inclusion h)) (v ∘ Subtype.val) xs ↔ Realize (∀'f✝) v xs

Next tactic:
simp [restrictFreeVar, Realize, ih3]
theorem realize_constantsVarsEquiv [L[[α]].Structure M] [(lhomWithConstants L α).IsExpansionOn M]
    {n} {φ : L[[α]].BoundedFormula β n} {v : β → M} {xs : Fin n → M} :
    (constantsVarsEquiv φ).Realize (Sum.elim (fun a => ↑(L.con a)) 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✝¹ : Structure (L[[α]]) M
inst✝ : LHom.IsExpansionOn (lhomWithConstants L α) M
n : ℕ
φ : BoundedFormula (L[[α]]) β n
v : β → M
xs : Fin n → M
⊢ Realize (constantsVarsEquiv φ) (Sum.elim (fun a => ↑(Language.con L a)) v) xs ↔ Realize φ v xs

Next tactic:
refine' realize_mapTermRel_id (fun n t xs => realize_constantsVarsEquivLeft) fun n R xs => _
theorem realize_constantsVarsEquiv [L[[α]].Structure M] [(lhomWithConstants L α).IsExpansionOn M]
    {n} {φ : L[[α]].BoundedFormula β n} {v : β → M} {xs : Fin n → M} :
    (constantsVarsEquiv φ).Realize (Sum.elim (fun a => ↑(L.con a)) v) xs ↔ φ.Realize v xs := by
  refine' realize_mapTermRel_id (fun n t xs => realize_constantsVarsEquivLeft) fun n R xs => _
  -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
  

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✝¹ : Structure (L[[α]]) M
inst✝ : LHom.IsExpansionOn (lhomWithConstants L α) M
n✝ : ℕ
φ : BoundedFormula (L[[α]]) β n✝
v : β → M
xs✝ : Fin n✝ → M
n : ℕ
R : Relations (L[[α]]) n
xs : Fin n → M
⊢ RelMap (((fun x => Equiv.sumEmpty (Relations L x) (Relations (constantsOn α) x)) n) R) xs = RelMap R xs

Next tactic:
erw [← (lhomWithConstants L α).map_onRelation
      (Equiv.sumEmpty (L.Relations n) ((constantsOn α).Relations n) R) xs]
theorem realize_constantsVarsEquiv [L[[α]].Structure M] [(lhomWithConstants L α).IsExpansionOn M]
    {n} {φ : L[[α]].BoundedFormula β n} {v : β → M} {xs : Fin n → M} :
    (constantsVarsEquiv φ).Realize (Sum.elim (fun a => ↑(L.con a)) v) xs ↔ φ.Realize v xs := by
  refine' realize_mapTermRel_id (fun n t xs => realize_constantsVarsEquivLeft) fun n R xs => _
  -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
  erw [← (lhomWithConstants L α).map_onRelation
      (Equiv.sumEmpty (L.Relations n) ((constantsOn α).Relations n) R) xs]
  

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✝¹ : Structure (L[[α]]) M
inst✝ : LHom.IsExpansionOn (lhomWithConstants L α) M
n✝ : ℕ
φ : BoundedFormula (L[[α]]) β n✝
v : β → M
xs✝ : Fin n✝ → M
n : ℕ
R : Relations (L[[α]]) n
xs : Fin n → M
⊢ RelMap (LHom.onRelation (lhomWithConstants L α) ((Equiv.sumEmpty (Relations L n) (Relations (constantsOn α) n)) R))
      xs =
    RelMap R xs

Next tactic:
rcongr
theorem realize_constantsVarsEquiv [L[[α]].Structure M] [(lhomWithConstants L α).IsExpansionOn M]
    {n} {φ : L[[α]].BoundedFormula β n} {v : β → M} {xs : Fin n → M} :
    (constantsVarsEquiv φ).Realize (Sum.elim (fun a => ↑(L.con a)) v) xs ↔ φ.Realize v xs := by
  refine' realize_mapTermRel_id (fun n t xs => realize_constantsVarsEquivLeft) fun n R xs => _
  -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
  erw [← (lhomWithConstants L α).map_onRelation
      (Equiv.sumEmpty (L.Relations n) ((constantsOn α).Relations n) R) xs]
  rcongr
  

Proof state:
case a
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✝¹ : Structure (L[[α]]) M
inst✝ : LHom.IsExpansionOn (lhomWithConstants L α) M
n✝ : ℕ
φ : BoundedFormula (L[[α]]) β n✝
v : β → M
xs✝ : Fin n✝ → M
n : ℕ
R : Relations (L[[α]]) n
xs : Fin n → M
⊢ RelMap (LHom.onRelation (lhomWithConstants L α) ((Equiv.sumEmpty (Relations L n) (Relations (constantsOn α) n)) R))
      xs ↔
    RelMap R xs

Next tactic:
cases' R with R R
theorem realize_constantsVarsEquiv [L[[α]].Structure M] [(lhomWithConstants L α).IsExpansionOn M]
    {n} {φ : L[[α]].BoundedFormula β n} {v : β → M} {xs : Fin n → M} :
    (constantsVarsEquiv φ).Realize (Sum.elim (fun a => ↑(L.con a)) v) xs ↔ φ.Realize v xs := by
  refine' realize_mapTermRel_id (fun n t xs => realize_constantsVarsEquivLeft) fun n R xs => _
  -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
  erw [← (lhomWithConstants L α).map_onRelation
      (Equiv.sumEmpty (L.Relations n) ((constantsOn α).Relations n) R) xs]
  rcongr
  cases' R with R R
  · -- This used to be `simp` before leanprover/lean4#2644
    

Proof state:
case a.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✝¹ l : ℕ
φ✝ ψ : BoundedFormula L α l
θ : BoundedFormula L α (Nat.succ l)
v✝ : α → M
xs✝¹ : Fin l → M
inst✝¹ : Structure (L[[α]]) M
inst✝ : LHom.IsExpansionOn (lhomWithConstants L α) M
n✝ : ℕ
φ : BoundedFormula (L[[α]]) β n✝
v : β → M
xs✝ : Fin n✝ → M
n : ℕ
xs : Fin n → M
R : Relations L n
⊢ RelMap
      (LHom.onRelation (lhomWithConstants L α)
        ((Equiv.sumEmpty (Relations L n) (Relations (constantsOn α) n)) (Sum.inl R)))
      xs ↔
    RelMap (Sum.inl R) xs

Next tactic:
simp
theorem realize_constantsVarsEquiv [L[[α]].Structure M] [(lhomWithConstants L α).IsExpansionOn M]
    {n} {φ : L[[α]].BoundedFormula β n} {v : β → M} {xs : Fin n → M} :
    (constantsVarsEquiv φ).Realize (Sum.elim (fun a => ↑(L.con a)) v) xs ↔ φ.Realize v xs := by
  refine' realize_mapTermRel_id (fun n t xs => realize_constantsVarsEquivLeft) fun n R xs => _
  -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
  erw [← (lhomWithConstants L α).map_onRelation
      (Equiv.sumEmpty (L.Relations n) ((constantsOn α).Relations n) R) xs]
  rcongr
  cases' R with R R
  · -- This used to be `simp` before leanprover/lean4#2644
    simp; 

Proof state:
case a.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✝¹ l : ℕ
φ✝ ψ : BoundedFormula L α l
θ : BoundedFormula L α (Nat.succ l)
v✝ : α → M
xs✝¹ : Fin l → M
inst✝¹ : Structure (L[[α]]) M
inst✝ : LHom.IsExpansionOn (lhomWithConstants L α) M
n✝ : ℕ
φ : BoundedFormula (L[[α]]) β n✝
v : β → M
xs✝ : Fin n✝ → M
n : ℕ
xs : Fin n → M
R : Relations L n
⊢ RelMap (Sum.inl ((Equiv.sumEmpty (Relations L n) (Relations (constantsOn α) n)) (Sum.inl R))) xs ↔
    RelMap (Sum.inl R) xs

Next tactic:
erw [Equiv.sumEmpty_apply_inl]
theorem realize_constantsVarsEquiv [L[[α]].Structure M] [(lhomWithConstants L α).IsExpansionOn M]
    {n} {φ : L[[α]].BoundedFormula β n} {v : β → M} {xs : Fin n → M} :
    (constantsVarsEquiv φ).Realize (Sum.elim (fun a => ↑(L.con a)) v) xs ↔ φ.Realize v xs := by
  refine' realize_mapTermRel_id (fun n t xs => realize_constantsVarsEquivLeft) fun n R xs => _
  -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
  erw [← (lhomWithConstants L α).map_onRelation
      (Equiv.sumEmpty (L.Relations n) ((constantsOn α).Relations n) R) xs]
  rcongr
  cases' R with R R
  · -- This used to be `simp` before leanprover/lean4#2644
    simp; erw [Equiv.sumEmpty_apply_inl]
  · 

Proof state:
case a.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✝¹ l : ℕ
φ✝ ψ : BoundedFormula L α l
θ : BoundedFormula L α (Nat.succ l)
v✝ : α → M
xs✝¹ : Fin l → M
inst✝¹ : Structure (L[[α]]) M
inst✝ : LHom.IsExpansionOn (lhomWithConstants L α) M
n✝ : ℕ
φ : BoundedFormula (L[[α]]) β n✝
v : β → M
xs✝ : Fin n✝ → M
n : ℕ
xs : Fin n → M
R : Relations (constantsOn α) n
⊢ RelMap
      (LHom.onRelation (lhomWithConstants L α)
        ((Equiv.sumEmpty (Relations L n) (Relations (constantsOn α) n)) (Sum.inr R)))
      xs ↔
    RelMap (Sum.inr R) xs

Next tactic:
exact isEmptyElim R
@[simp]
theorem realize_relabelEquiv {g : α ≃ β} {k} {φ : L.BoundedFormula α k} {v : β → M}
    {xs : Fin k → M} : (relabelEquiv g φ).Realize v xs ↔ φ.Realize (v ∘ g) 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
g : α ≃ β
k : ℕ
φ : BoundedFormula L α k
v : β → M
xs : Fin k → M
⊢ Realize ((relabelEquiv g) φ) v xs ↔ Realize φ (v ∘ ⇑g) xs

Next tactic:
simp only [relabelEquiv, mapTermRelEquiv_apply, Equiv.coe_refl]
@[simp]
theorem realize_relabelEquiv {g : α ≃ β} {k} {φ : L.BoundedFormula α k} {v : β → M}
    {xs : Fin k → M} : (relabelEquiv g φ).Realize v xs ↔ φ.Realize (v ∘ g) xs := by
  simp only [relabelEquiv, mapTermRelEquiv_apply, Equiv.coe_refl]
  

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
g : α ≃ β
k : ℕ
φ : BoundedFormula L α k
v : β → M
xs : Fin k → M
⊢ Realize
      (mapTermRel (fun n => ⇑(Term.relabelEquiv (Equiv.sumCongr g (_root_.Equiv.refl (Fin n))))) (fun n => id)
        (fun x => id) φ)
      v xs ↔
    Realize φ (v ∘ ⇑g) xs

Next tactic:
refine' realize_mapTermRel_id (fun n t xs => _) fun _ _ _ => rfl
@[simp]
theorem realize_relabelEquiv {g : α ≃ β} {k} {φ : L.BoundedFormula α k} {v : β → M}
    {xs : Fin k → M} : (relabelEquiv g φ).Realize v xs ↔ φ.Realize (v ∘ g) xs := by
  simp only [relabelEquiv, mapTermRelEquiv_apply, Equiv.coe_refl]
  refine' realize_mapTermRel_id (fun n t xs => _) fun _ _ _ => rfl
  

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
g : α ≃ β
k : ℕ
φ : BoundedFormula L α k
v : β → M
xs✝ : Fin k → M
n : ℕ
t : Term L (α ⊕ Fin n)
xs : Fin n → M
⊢ realize (Sum.elim v xs) ((Term.relabelEquiv (Equiv.sumCongr g (_root_.Equiv.refl (Fin n)))) t) =
    realize (Sum.elim (v ∘ ⇑g) xs) t

Next tactic:
simp only [relabelEquiv_apply, Term.realize_relabel]
@[simp]
theorem realize_relabelEquiv {g : α ≃ β} {k} {φ : L.BoundedFormula α k} {v : β → M}
    {xs : Fin k → M} : (relabelEquiv g φ).Realize v xs ↔ φ.Realize (v ∘ g) xs := by
  simp only [relabelEquiv, mapTermRelEquiv_apply, Equiv.coe_refl]
  refine' realize_mapTermRel_id (fun n t xs => _) fun _ _ _ => rfl
  simp only [relabelEquiv_apply, Term.realize_relabel]
  

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
g : α ≃ β
k : ℕ
φ : BoundedFormula L α k
v : β → M
xs✝ : Fin k → M
n : ℕ
t : Term L (α ⊕ Fin n)
xs : Fin n → M
⊢ realize (Sum.elim v xs ∘ ⇑(Equiv.sumCongr g (_root_.Equiv.refl (Fin n)))) t = realize (Sum.elim (v ∘ ⇑g) xs) t

Next tactic:
refine' congr (congr rfl _) rfl
@[simp]
theorem realize_relabelEquiv {g : α ≃ β} {k} {φ : L.BoundedFormula α k} {v : β → M}
    {xs : Fin k → M} : (relabelEquiv g φ).Realize v xs ↔ φ.Realize (v ∘ g) xs := by
  simp only [relabelEquiv, mapTermRelEquiv_apply, Equiv.coe_refl]
  refine' realize_mapTermRel_id (fun n t xs => _) fun _ _ _ => rfl
  simp only [relabelEquiv_apply, Term.realize_relabel]
  refine' congr (congr rfl _) rfl
  

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
g : α ≃ β
k : ℕ
φ : BoundedFormula L α k
v : β → M
xs✝ : Fin k → M
n : ℕ
t : Term L (α ⊕ Fin n)
xs : Fin n → M
⊢ Sum.elim v xs ∘ ⇑(Equiv.sumCongr g (_root_.Equiv.refl (Fin n))) = Sum.elim (v ∘ ⇑g) xs

Next tactic:
ext (i | i)
@[simp]
theorem realize_relabelEquiv {g : α ≃ β} {k} {φ : L.BoundedFormula α k} {v : β → M}
    {xs : Fin k → M} : (relabelEquiv g φ).Realize v xs ↔ φ.Realize (v ∘ g) xs := by
  simp only [relabelEquiv, mapTermRelEquiv_apply, Equiv.coe_refl]
  refine' realize_mapTermRel_id (fun n t xs => _) fun _ _ _ => rfl
  simp only [relabelEquiv_apply, Term.realize_relabel]
  refine' congr (congr rfl _) rfl
  ext (i | i) <;> 

Proof state:
case 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✝ l : ℕ
φ✝ ψ : BoundedFormula L α l
θ : BoundedFormula L α (Nat.succ l)
v✝ : α → M
xs✝¹ : Fin l → M
g : α ≃ β
k : ℕ
φ : BoundedFormula L α k
v : β → M
xs✝ : Fin k → M
n : ℕ
t : Term L (α ⊕ Fin n)
xs : Fin n → M
i : α
⊢ (Sum.elim v xs ∘ ⇑(Equiv.sumCongr g (_root_.Equiv.refl (Fin n)))) (Sum.inl i) = Sum.elim (v ∘ ⇑g) xs (Sum.inl i)

Next tactic:
rfl
@[simp]
theorem realize_relabelEquiv {g : α ≃ β} {k} {φ : L.BoundedFormula α k} {v : β → M}
    {xs : Fin k → M} : (relabelEquiv g φ).Realize v xs ↔ φ.Realize (v ∘ g) xs := by
  simp only [relabelEquiv, mapTermRelEquiv_apply, Equiv.coe_refl]
  refine' realize_mapTermRel_id (fun n t xs => _) fun _ _ _ => rfl
  simp only [relabelEquiv_apply, Term.realize_relabel]
  refine' congr (congr rfl _) rfl
  ext (i | i) <;> 

Proof state:
case 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✝ l : ℕ
φ✝ ψ : BoundedFormula L α l
θ : BoundedFormula L α (Nat.succ l)
v✝ : α → M
xs✝¹ : Fin l → M
g : α ≃ β
k : ℕ
φ : BoundedFormula L α k
v : β → M
xs✝ : Fin k → M
n : ℕ
t : Term L (α ⊕ Fin n)
xs : Fin n → M
i : Fin n
⊢ (Sum.elim v xs ∘ ⇑(Equiv.sumCongr g (_root_.Equiv.refl (Fin n)))) (Sum.inr i) = Sum.elim (v ∘ ⇑g) xs (Sum.inr i)

Next tactic:
rfl
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
  

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
⊢ Realize (∀'liftAt 1 n φ) v xs ↔ Realize φ v xs

Next tactic:
inhabit M