l3lab/ntp-mathlib huggingface dataset:
theorem realize_mapTermRel_id [L'.Structure M]
    {ft : ∀ n, L.Term (Sum α (Fin n)) → L'.Term (Sum β (Fin n))}
    {fr : ∀ n, L.Relations n → L'.Relations n} {n} {φ : L.BoundedFormula α n} {v : α → M}
    {v' : β → M} {xs : Fin n → M}
    (h1 :
      ∀ (n) (t : L.Term (Sum α (Fin n))) (xs : Fin n → M),
        (ft n t).realize (Sum.elim v' xs) = t.realize (Sum.elim v xs))
    (h2 : ∀ (n) (R : L.Relations n) (x : Fin n → M), RelMap (fr n R) x = RelMap R x) :
    (φ.mapTermRel ft fr fun _ => id).Realize v' xs ↔ φ.Realize v xs := by
  induction' φ with _ _ _ _ _ _ _ _ _ _ _ ih1 ih2 _ _ ih
  · rfl
  · simp [mapTermRel, Realize, h1]
  · simp [mapTermRel, Realize, h1, h2]
  · simp [mapTermRel, 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✝ : Structure L' M
ft : (n : ℕ) → Term L (α ⊕ Fin n) → Term L' (β ⊕ Fin n)
fr : (n : ℕ) → Relations L n → Relations L' n
n : ℕ
v : α → M
v' : β → M
h1 : ∀ (n : ℕ) (t : Term L (α ⊕ Fin n)) (xs : Fin n → M), realize (Sum.elim v' xs) (ft n t) = realize (Sum.elim v xs) t
h2 : ∀ (n : ℕ) (R : Relations L n) (x : Fin n → M), RelMap (fr n R) x = RelMap R x
n✝ : ℕ
f✝ : BoundedFormula L α (n✝ + 1)
ih : ∀ {xs : Fin (n✝ + 1) → M}, Realize (mapTermRel ft fr (fun x => id) f✝) v' xs ↔ Realize f✝ v xs
xs : Fin n✝ → M
⊢ Realize (mapTermRel ft fr (fun x => id) (∀'f✝)) v' xs ↔ Realize (∀'f✝) v xs

Next tactic:
simp only [mapTermRel, Realize, ih, id.def]
theorem realize_mapTermRel_add_castLe [L'.Structure M] {k : ℕ}
    {ft : ∀ n, L.Term (Sum α (Fin n)) → L'.Term (Sum β (Fin (k + n)))}
    {fr : ∀ n, L.Relations n → L'.Relations n} {n} {φ : L.BoundedFormula α n}
    (v : ∀ {n}, (Fin (k + n) → M) → α → M) {v' : β → M} (xs : Fin (k + n) → M)
    (h1 :
      ∀ (n) (t : L.Term (Sum α (Fin n))) (xs' : Fin (k + n) → M),
        (ft n t).realize (Sum.elim v' xs') = t.realize (Sum.elim (v xs') (xs' ∘ Fin.natAdd _)))
    (h2 : ∀ (n) (R : L.Relations n) (x : Fin n → M), RelMap (fr n R) x = RelMap R x)
    (hv : ∀ (n) (xs : Fin (k + n) → M) (x : M), @v (n + 1) (snoc xs x : Fin _ → M) = v xs) :
    (φ.mapTermRel ft fr fun n => castLE (add_assoc _ _ _).symm.le).Realize v' xs ↔
      φ.Realize (v xs) (xs ∘ Fin.natAdd _) := 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
k : ℕ
ft : (n : ℕ) → Term L (α ⊕ Fin n) → Term L' (β ⊕ Fin (k + n))
fr : (n : ℕ) → Relations L n → Relations L' n
n : ℕ
φ : BoundedFormula L α n
v : {n : ℕ} → (Fin (k + n) → M) → α → M
v' : β → M
xs : Fin (k + n) → M
h1 :
  ∀ (n : ℕ) (t : Term L (α ⊕ Fin n)) (xs' : Fin (k + n) → M),
    realize (Sum.elim v' xs') (ft n t) = realize (Sum.elim (v xs') (xs' ∘ natAdd k)) t
h2 : ∀ (n : ℕ) (R : Relations L n) (x : Fin n → M), RelMap (fr n R) x = RelMap R x
hv : ∀ (n : ℕ) (xs : Fin (k + n) → M) (x : M), v (snoc xs x) = v xs
⊢ Realize (mapTermRel ft fr (fun n => castLE (_ : k + (n + 1) ≤ k + n + 1)) φ) v' xs ↔ Realize φ (v xs) (xs ∘ natAdd k)

Next tactic:
induction' φ with _ _ _ _ _ _ _ _ _ _ _ ih1 ih2 _ _ ih
theorem realize_mapTermRel_add_castLe [L'.Structure M] {k : ℕ}
    {ft : ∀ n, L.Term (Sum α (Fin n)) → L'.Term (Sum β (Fin (k + n)))}
    {fr : ∀ n, L.Relations n → L'.Relations n} {n} {φ : L.BoundedFormula α n}
    (v : ∀ {n}, (Fin (k + n) → M) → α → M) {v' : β → M} (xs : Fin (k + n) → M)
    (h1 :
      ∀ (n) (t : L.Term (Sum α (Fin n))) (xs' : Fin (k + n) → M),
        (ft n t).realize (Sum.elim v' xs') = t.realize (Sum.elim (v xs') (xs' ∘ Fin.natAdd _)))
    (h2 : ∀ (n) (R : L.Relations n) (x : Fin n → M), RelMap (fr n R) x = RelMap R x)
    (hv : ∀ (n) (xs : Fin (k + n) → M) (x : M), @v (n + 1) (snoc xs x : Fin _ → M) = v xs) :
    (φ.mapTermRel ft fr fun n => castLE (add_assoc _ _ _).symm.le).Realize v' xs ↔
      φ.Realize (v xs) (xs ∘ Fin.natAdd _) := by
  induction' φ with _ _ _ _ _ _ _ _ _ _ _ ih1 ih2 _ _ ih
  · 

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✝ : Structure L' M
k : ℕ
ft : (n : ℕ) → Term L (α ⊕ Fin n) → Term L' (β ⊕ Fin (k + n))
fr : (n : ℕ) → Relations L n → Relations L' n
n : ℕ
v : {n : ℕ} → (Fin (k + n) → M) → α → M
v' : β → M
h1 :
  ∀ (n : ℕ) (t : Term L (α ⊕ Fin n)) (xs' : Fin (k + n) → M),
    realize (Sum.elim v' xs') (ft n t) = realize (Sum.elim (v xs') (xs' ∘ natAdd k)) t
h2 : ∀ (n : ℕ) (R : Relations L n) (x : Fin n → M), RelMap (fr n R) x = RelMap R x
hv : ∀ (n : ℕ) (xs : Fin (k + n) → M) (x : M), v (snoc xs x) = v xs
n✝ : ℕ
xs : Fin (k + n✝) → M
⊢ Realize (mapTermRel ft fr (fun n => castLE (_ : k + (n + 1) ≤ k + n + 1)) falsum) v' xs ↔
    Realize falsum (v xs) (xs ∘ natAdd k)

Next tactic:
rfl
theorem realize_mapTermRel_add_castLe [L'.Structure M] {k : ℕ}
    {ft : ∀ n, L.Term (Sum α (Fin n)) → L'.Term (Sum β (Fin (k + n)))}
    {fr : ∀ n, L.Relations n → L'.Relations n} {n} {φ : L.BoundedFormula α n}
    (v : ∀ {n}, (Fin (k + n) → M) → α → M) {v' : β → M} (xs : Fin (k + n) → M)
    (h1 :
      ∀ (n) (t : L.Term (Sum α (Fin n))) (xs' : Fin (k + n) → M),
        (ft n t).realize (Sum.elim v' xs') = t.realize (Sum.elim (v xs') (xs' ∘ Fin.natAdd _)))
    (h2 : ∀ (n) (R : L.Relations n) (x : Fin n → M), RelMap (fr n R) x = RelMap R x)
    (hv : ∀ (n) (xs : Fin (k + n) → M) (x : M), @v (n + 1) (snoc xs x : Fin _ → M) = v xs) :
    (φ.mapTermRel ft fr fun n => castLE (add_assoc _ _ _).symm.le).Realize v' xs ↔
      φ.Realize (v xs) (xs ∘ Fin.natAdd _) := by
  induction' φ with _ _ _ _ _ _ _ _ _ _ _ ih1 ih2 _ _ ih
  · 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✝ : Structure L' M
k : ℕ
ft : (n : ℕ) → Term L (α ⊕ Fin n) → Term L' (β ⊕ Fin (k + n))
fr : (n : ℕ) → Relations L n → Relations L' n
n : ℕ
v : {n : ℕ} → (Fin (k + n) → M) → α → M
v' : β → M
h1 :
  ∀ (n : ℕ) (t : Term L (α ⊕ Fin n)) (xs' : Fin (k + n) → M),
    realize (Sum.elim v' xs') (ft n t) = realize (Sum.elim (v xs') (xs' ∘ natAdd k)) t
h2 : ∀ (n : ℕ) (R : Relations L n) (x : Fin n → M), RelMap (fr n R) x = RelMap R x
hv : ∀ (n : ℕ) (xs : Fin (k + n) → M) (x : M), v (snoc xs x) = v xs
n✝ : ℕ
t₁✝ t₂✝ : Term L (α ⊕ Fin n✝)
xs : Fin (k + n✝) → M
⊢ Realize (mapTermRel ft fr (fun n => castLE (_ : k + (n + 1) ≤ k + n + 1)) (equal t₁✝ t₂✝)) v' xs ↔
    Realize (equal t₁✝ t₂✝) (v xs) (xs ∘ natAdd k)

Next tactic:
simp [mapTermRel, Realize, h1]
theorem realize_mapTermRel_add_castLe [L'.Structure M] {k : ℕ}
    {ft : ∀ n, L.Term (Sum α (Fin n)) → L'.Term (Sum β (Fin (k + n)))}
    {fr : ∀ n, L.Relations n → L'.Relations n} {n} {φ : L.BoundedFormula α n}
    (v : ∀ {n}, (Fin (k + n) → M) → α → M) {v' : β → M} (xs : Fin (k + n) → M)
    (h1 :
      ∀ (n) (t : L.Term (Sum α (Fin n))) (xs' : Fin (k + n) → M),
        (ft n t).realize (Sum.elim v' xs') = t.realize (Sum.elim (v xs') (xs' ∘ Fin.natAdd _)))
    (h2 : ∀ (n) (R : L.Relations n) (x : Fin n → M), RelMap (fr n R) x = RelMap R x)
    (hv : ∀ (n) (xs : Fin (k + n) → M) (x : M), @v (n + 1) (snoc xs x : Fin _ → M) = v xs) :
    (φ.mapTermRel ft fr fun n => castLE (add_assoc _ _ _).symm.le).Realize v' xs ↔
      φ.Realize (v xs) (xs ∘ Fin.natAdd _) := by
  induction' φ with _ _ _ _ _ _ _ _ _ _ _ ih1 ih2 _ _ ih
  · rfl
  · simp [mapTermRel, Realize, h1]
  · 

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✝ : Structure L' M
k : ℕ
ft : (n : ℕ) → Term L (α ⊕ Fin n) → Term L' (β ⊕ Fin (k + n))
fr : (n : ℕ) → Relations L n → Relations L' n
n : ℕ
v : {n : ℕ} → (Fin (k + n) → M) → α → M
v' : β → M
h1 :
  ∀ (n : ℕ) (t : Term L (α ⊕ Fin n)) (xs' : Fin (k + n) → M),
    realize (Sum.elim v' xs') (ft n t) = realize (Sum.elim (v xs') (xs' ∘ natAdd k)) t
h2 : ∀ (n : ℕ) (R : Relations L n) (x : Fin n → M), RelMap (fr n R) x = RelMap R x
hv : ∀ (n : ℕ) (xs : Fin (k + n) → M) (x : M), v (snoc xs x) = v xs
n✝ l✝ : ℕ
R✝ : Relations L l✝
ts✝ : Fin l✝ → Term L (α ⊕ Fin n✝)
xs : Fin (k + n✝) → M
⊢ Realize (mapTermRel ft fr (fun n => castLE (_ : k + (n + 1) ≤ k + n + 1)) (rel R✝ ts✝)) v' xs ↔
    Realize (rel R✝ ts✝) (v xs) (xs ∘ natAdd k)

Next tactic:
simp [mapTermRel, Realize, h1, h2]
theorem realize_mapTermRel_add_castLe [L'.Structure M] {k : ℕ}
    {ft : ∀ n, L.Term (Sum α (Fin n)) → L'.Term (Sum β (Fin (k + n)))}
    {fr : ∀ n, L.Relations n → L'.Relations n} {n} {φ : L.BoundedFormula α n}
    (v : ∀ {n}, (Fin (k + n) → M) → α → M) {v' : β → M} (xs : Fin (k + n) → M)
    (h1 :
      ∀ (n) (t : L.Term (Sum α (Fin n))) (xs' : Fin (k + n) → M),
        (ft n t).realize (Sum.elim v' xs') = t.realize (Sum.elim (v xs') (xs' ∘ Fin.natAdd _)))
    (h2 : ∀ (n) (R : L.Relations n) (x : Fin n → M), RelMap (fr n R) x = RelMap R x)
    (hv : ∀ (n) (xs : Fin (k + n) → M) (x : M), @v (n + 1) (snoc xs x : Fin _ → M) = v xs) :
    (φ.mapTermRel ft fr fun n => castLE (add_assoc _ _ _).symm.le).Realize v' xs ↔
      φ.Realize (v xs) (xs ∘ Fin.natAdd _) := by
  induction' φ with _ _ _ _ _ _ _ _ _ _ _ ih1 ih2 _ _ ih
  · rfl
  · simp [mapTermRel, Realize, h1]
  · simp [mapTermRel, Realize, h1, h2]
  · 

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✝ : Structure L' M
k : ℕ
ft : (n : ℕ) → Term L (α ⊕ Fin n) → Term L' (β ⊕ Fin (k + n))
fr : (n : ℕ) → Relations L n → Relations L' n
n : ℕ
v : {n : ℕ} → (Fin (k + n) → M) → α → M
v' : β → M
h1 :
  ∀ (n : ℕ) (t : Term L (α ⊕ Fin n)) (xs' : Fin (k + n) → M),
    realize (Sum.elim v' xs') (ft n t) = realize (Sum.elim (v xs') (xs' ∘ natAdd k)) t
h2 : ∀ (n : ℕ) (R : Relations L n) (x : Fin n → M), RelMap (fr n R) x = RelMap R x
hv : ∀ (n : ℕ) (xs : Fin (k + n) → M) (x : M), v (snoc xs x) = v xs
n✝ : ℕ
f₁✝ f₂✝ : BoundedFormula L α n✝
ih1 :
  ∀ (xs : Fin (k + n✝) → M),
    Realize (mapTermRel ft fr (fun n => castLE (_ : k + (n + 1) ≤ k + n + 1)) f₁✝) v' xs ↔
      Realize f₁✝ (v xs) (xs ∘ natAdd k)
ih2 :
  ∀ (xs : Fin (k + n✝) → M),
    Realize (mapTermRel ft fr (fun n => castLE (_ : k + (n + 1) ≤ k + n + 1)) f₂✝) v' xs ↔
      Realize f₂✝ (v xs) (xs ∘ natAdd k)
xs : Fin (k + n✝) → M
⊢ Realize (mapTermRel ft fr (fun n => castLE (_ : k + (n + 1) ≤ k + n + 1)) (f₁✝ ⟹ f₂✝)) v' xs ↔
    Realize (f₁✝ ⟹ f₂✝) (v xs) (xs ∘ natAdd k)

Next tactic:
simp [mapTermRel, Realize, ih1, ih2]
theorem realize_mapTermRel_add_castLe [L'.Structure M] {k : ℕ}
    {ft : ∀ n, L.Term (Sum α (Fin n)) → L'.Term (Sum β (Fin (k + n)))}
    {fr : ∀ n, L.Relations n → L'.Relations n} {n} {φ : L.BoundedFormula α n}
    (v : ∀ {n}, (Fin (k + n) → M) → α → M) {v' : β → M} (xs : Fin (k + n) → M)
    (h1 :
      ∀ (n) (t : L.Term (Sum α (Fin n))) (xs' : Fin (k + n) → M),
        (ft n t).realize (Sum.elim v' xs') = t.realize (Sum.elim (v xs') (xs' ∘ Fin.natAdd _)))
    (h2 : ∀ (n) (R : L.Relations n) (x : Fin n → M), RelMap (fr n R) x = RelMap R x)
    (hv : ∀ (n) (xs : Fin (k + n) → M) (x : M), @v (n + 1) (snoc xs x : Fin _ → M) = v xs) :
    (φ.mapTermRel ft fr fun n => castLE (add_assoc _ _ _).symm.le).Realize v' xs ↔
      φ.Realize (v xs) (xs ∘ Fin.natAdd _) := by
  induction' φ with _ _ _ _ _ _ _ _ _ _ _ ih1 ih2 _ _ ih
  · rfl
  · simp [mapTermRel, Realize, h1]
  · simp [mapTermRel, Realize, h1, h2]
  · simp [mapTermRel, 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✝ : Structure L' M
k : ℕ
ft : (n : ℕ) → Term L (α ⊕ Fin n) → Term L' (β ⊕ Fin (k + n))
fr : (n : ℕ) → Relations L n → Relations L' n
n : ℕ
v : {n : ℕ} → (Fin (k + n) → M) → α → M
v' : β → M
h1 :
  ∀ (n : ℕ) (t : Term L (α ⊕ Fin n)) (xs' : Fin (k + n) → M),
    realize (Sum.elim v' xs') (ft n t) = realize (Sum.elim (v xs') (xs' ∘ natAdd k)) t
h2 : ∀ (n : ℕ) (R : Relations L n) (x : Fin n → M), RelMap (fr n R) x = RelMap R x
hv : ∀ (n : ℕ) (xs : Fin (k + n) → M) (x : M), v (snoc xs x) = v xs
n✝ : ℕ
f✝ : BoundedFormula L α (n✝ + 1)
ih :
  ∀ (xs : Fin (k + (n✝ + 1)) → M),
    Realize (mapTermRel ft fr (fun n => castLE (_ : k + (n + 1) ≤ k + n + 1)) f✝) v' xs ↔
      Realize f✝ (v xs) (xs ∘ natAdd k)
xs : Fin (k + n✝) → M
⊢ Realize (mapTermRel ft fr (fun n => castLE (_ : k + (n + 1) ≤ k + n + 1)) (∀'f✝)) v' xs ↔
    Realize (∀'f✝) (v xs) (xs ∘ natAdd k)

Next tactic:
simp [mapTermRel, Realize, ih, hv]
@[simp]
theorem realize_relabel {m n : ℕ} {φ : L.BoundedFormula α n} {g : α → Sum β (Fin m)} {v : β → M}
    {xs : Fin (m + n) → M} :
    (φ.relabel g).Realize v xs ↔
      φ.Realize (Sum.elim v (xs ∘ Fin.castAdd n) ∘ g) (xs ∘ Fin.natAdd 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✝ l : ℕ
φ✝ ψ : BoundedFormula L α l
θ : BoundedFormula L α (Nat.succ l)
v✝ : α → M
xs✝ : Fin l → M
m n : ℕ
φ : BoundedFormula L α n
g : α → β ⊕ Fin m
v : β → M
xs : Fin (m + n) → M
⊢ Realize (relabel g φ) v xs ↔ Realize φ (Sum.elim v (xs ∘ castAdd n) ∘ g) (xs ∘ natAdd m)

Next tactic:
rw [relabel, realize_mapTermRel_add_castLe]
@[simp]
theorem realize_relabel {m n : ℕ} {φ : L.BoundedFormula α n} {g : α → Sum β (Fin m)} {v : β → M}
    {xs : Fin (m + n) → M} :
    (φ.relabel g).Realize v xs ↔
      φ.Realize (Sum.elim v (xs ∘ Fin.castAdd n) ∘ g) (xs ∘ Fin.natAdd m) :=
  by rw [relabel, realize_mapTermRel_add_castLe] <;> 

Proof state:
case h1
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
m n : ℕ
φ : BoundedFormula L α n
g : α → β ⊕ Fin m
v : β → M
xs : Fin (m + n) → M
⊢ ∀ (n : ℕ) (t : Term L (α ⊕ Fin n)) (xs' : Fin (m + n) → M),
    realize (Sum.elim v xs') (Term.relabel (relabelAux g n) t) =
      realize (Sum.elim (Sum.elim v (xs' ∘ castAdd n) ∘ g) (xs' ∘ natAdd m)) t

Next tactic:
intros
@[simp]
theorem realize_relabel {m n : ℕ} {φ : L.BoundedFormula α n} {g : α → Sum β (Fin m)} {v : β → M}
    {xs : Fin (m + n) → M} :
    (φ.relabel g).Realize v xs ↔
      φ.Realize (Sum.elim v (xs ∘ Fin.castAdd n) ∘ g) (xs ∘ Fin.natAdd m) :=
  by rw [relabel, realize_mapTermRel_add_castLe] <;> 

Proof state:
case h2
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
m n : ℕ
φ : BoundedFormula L α n
g : α → β ⊕ Fin m
v : β → M
xs : Fin (m + n) → M
⊢ ∀ (n : ℕ) (R : Relations L n) (x : Fin n → M), RelMap (id R) x = RelMap R x

Next tactic:
intros
@[simp]
theorem realize_relabel {m n : ℕ} {φ : L.BoundedFormula α n} {g : α → Sum β (Fin m)} {v : β → M}
    {xs : Fin (m + n) → M} :
    (φ.relabel g).Realize v xs ↔
      φ.Realize (Sum.elim v (xs ∘ Fin.castAdd n) ∘ g) (xs ∘ Fin.natAdd m) :=
  by rw [relabel, realize_mapTermRel_add_castLe] <;> 

Proof state:
case hv
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
m n : ℕ
φ : BoundedFormula L α n
g : α → β ⊕ Fin m
v : β → M
xs : Fin (m + n) → M
⊢ ∀ (n : ℕ) (xs : Fin (m + n) → M) (x : M),
    Sum.elim v (snoc xs x ∘ castAdd (n + 1)) ∘ g = Sum.elim v (xs ∘ castAdd n) ∘ g

Next tactic:
intros
@[simp]
theorem realize_relabel {m n : ℕ} {φ : L.BoundedFormula α n} {g : α → Sum β (Fin m)} {v : β → M}
    {xs : Fin (m + n) → M} :
    (φ.relabel g).Realize v xs ↔
      φ.Realize (Sum.elim v (xs ∘ Fin.castAdd n) ∘ g) (xs ∘ Fin.natAdd m) :=
  by rw [relabel, realize_mapTermRel_add_castLe] <;> intros <;> 

Proof state:
case h1
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
m n : ℕ
φ : BoundedFormula L α n
g : α → β ⊕ Fin m
v : β → M
xs : Fin (m + n) → M
n✝ : ℕ
t✝ : Term L (α ⊕ Fin n✝)
xs'✝ : Fin (m + n✝) → M
⊢ realize (Sum.elim v xs'✝) (Term.relabel (relabelAux g n✝) t✝) =
    realize (Sum.elim (Sum.elim v (xs'✝ ∘ castAdd n✝) ∘ g) (xs'✝ ∘ natAdd m)) t✝

Next tactic:
simp
@[simp]
theorem realize_relabel {m n : ℕ} {φ : L.BoundedFormula α n} {g : α → Sum β (Fin m)} {v : β → M}
    {xs : Fin (m + n) → M} :
    (φ.relabel g).Realize v xs ↔
      φ.Realize (Sum.elim v (xs ∘ Fin.castAdd n) ∘ g) (xs ∘ Fin.natAdd m) :=
  by rw [relabel, realize_mapTermRel_add_castLe] <;> intros <;> 

Proof state:
case h2
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
m n : ℕ
φ : BoundedFormula L α n
g : α → β ⊕ Fin m
v : β → M
xs : Fin (m + n) → M
n✝ : ℕ
R✝ : Relations L n✝
x✝ : Fin n✝ → M
⊢ RelMap (id R✝) x✝ = RelMap R✝ x✝

Next tactic:
simp
@[simp]
theorem realize_relabel {m n : ℕ} {φ : L.BoundedFormula α n} {g : α → Sum β (Fin m)} {v : β → M}
    {xs : Fin (m + n) → M} :
    (φ.relabel g).Realize v xs ↔
      φ.Realize (Sum.elim v (xs ∘ Fin.castAdd n) ∘ g) (xs ∘ Fin.natAdd m) :=
  by rw [relabel, realize_mapTermRel_add_castLe] <;> intros <;> 

Proof state:
case hv
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
m n : ℕ
φ : BoundedFormula L α n
g : α → β ⊕ Fin m
v : β → M
xs : Fin (m + n) → M
n✝ : ℕ
xs✝ : Fin (m + n✝) → M
x✝ : M
⊢ Sum.elim v (snoc xs✝ x✝ ∘ castAdd (n✝ + 1)) ∘ g = Sum.elim v (xs✝ ∘ castAdd n✝) ∘ g

Next tactic:
simp
theorem realize_liftAt {n n' m : ℕ} {φ : L.BoundedFormula α n} {v : α → M} {xs : Fin (n + n') → M}
    (hmn : m + n' ≤ n + 1) :
    (φ.liftAt n' m).Realize v xs ↔
      φ.Realize v (xs ∘ fun i => if ↑i < m then Fin.castAdd n' i else Fin.addNat i 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✝ l : ℕ
φ✝ ψ : BoundedFormula L α l
θ : BoundedFormula L α (Nat.succ l)
v✝ : α → M
xs✝ : Fin l → M
n n' m : ℕ
φ : BoundedFormula L α n
v : α → M
xs : Fin (n + n') → M
hmn : m + n' ≤ n + 1
⊢ Realize (liftAt n' m φ) v xs ↔ Realize φ v (xs ∘ fun i => if ↑i < m then castAdd n' i else addNat i n')

Next tactic:
rw [liftAt]
theorem realize_liftAt {n n' m : ℕ} {φ : L.BoundedFormula α n} {v : α → M} {xs : Fin (n + n') → M}
    (hmn : m + n' ≤ n + 1) :
    (φ.liftAt n' m).Realize v xs ↔
      φ.Realize v (xs ∘ fun i => if ↑i < m then Fin.castAdd n' i else Fin.addNat i n') := by
  rw [liftAt]
  

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
n n' m : ℕ
φ : BoundedFormula L α n
v : α → M
xs : Fin (n + n') → M
hmn : m + n' ≤ n + 1
⊢ Realize (mapTermRel (fun k t => Term.liftAt n' m t) (fun x => id) (fun x => castLE (_ : x + 1 + n' ≤ x + n' + 1)) φ) v
      xs ↔
    Realize φ v (xs ∘ fun i => if ↑i < m then castAdd n' i else addNat i n')

Next tactic:
induction' φ with _ _ _ _ _ _ _ _ _ _ _ ih1 ih2 k _ ih3
theorem realize_liftAt {n n' m : ℕ} {φ : L.BoundedFormula α n} {v : α → M} {xs : Fin (n + n') → M}
    (hmn : m + n' ≤ n + 1) :
    (φ.liftAt n' m).Realize v xs ↔
      φ.Realize v (xs ∘ fun i => if ↑i < m then Fin.castAdd n' i else Fin.addNat i n') := by
  rw [liftAt]
  induction' φ with _ _ _ _ _ _ _ _ _ _ _ ih1 ih2 k _ 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
n n' m : ℕ
v : α → M
n✝ : ℕ
xs : Fin (n✝ + n') → M
hmn : m + n' ≤ n✝ + 1
⊢ Realize
      (mapTermRel (fun k t => Term.liftAt n' m t) (fun x => id) (fun x => castLE (_ : x + 1 + n' ≤ x + n' + 1)) falsum)
      v xs ↔
    Realize falsum v (xs ∘ fun i => if ↑i < m then castAdd n' i else addNat i n')

Next tactic:
simp [mapTermRel, Realize]
theorem realize_liftAt {n n' m : ℕ} {φ : L.BoundedFormula α n} {v : α → M} {xs : Fin (n + n') → M}
    (hmn : m + n' ≤ n + 1) :
    (φ.liftAt n' m).Realize v xs ↔
      φ.Realize v (xs ∘ fun i => if ↑i < m then Fin.castAdd n' i else Fin.addNat i n') := by
  rw [liftAt]
  induction' φ with _ _ _ _ _ _ _ _ _ _ _ ih1 ih2 k _ ih3
  · simp [mapTermRel, Realize]
  · 

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
n n' m : ℕ
v : α → M
n✝ : ℕ
t₁✝ t₂✝ : Term L (α ⊕ Fin n✝)
xs : Fin (n✝ + n') → M
hmn : m + n' ≤ n✝ + 1
⊢ Realize
      (mapTermRel (fun k t => Term.liftAt n' m t) (fun x => id) (fun x => castLE (_ : x + 1 + n' ≤ x + n' + 1))
        (equal t₁✝ t₂✝))
      v xs ↔
    Realize (equal t₁✝ t₂✝) v (xs ∘ fun i => if ↑i < m then castAdd n' i else addNat i n')

Next tactic:
simp [mapTermRel, Realize, realize_rel, realize_liftAt, Sum.elim_comp_map]
theorem realize_liftAt {n n' m : ℕ} {φ : L.BoundedFormula α n} {v : α → M} {xs : Fin (n + n') → M}
    (hmn : m + n' ≤ n + 1) :
    (φ.liftAt n' m).Realize v xs ↔
      φ.Realize v (xs ∘ fun i => if ↑i < m then Fin.castAdd n' i else Fin.addNat i n') := by
  rw [liftAt]
  induction' φ with _ _ _ _ _ _ _ _ _ _ _ ih1 ih2 k _ ih3
  · simp [mapTermRel, Realize]
  · simp [mapTermRel, Realize, realize_rel, realize_liftAt, Sum.elim_comp_map]
  · 

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
n n' m : ℕ
v : α → M
n✝ l✝ : ℕ
R✝ : Relations L l✝
ts✝ : Fin l✝ → Term L (α ⊕ Fin n✝)
xs : Fin (n✝ + n') → M
hmn : m + n' ≤ n✝ + 1
⊢ Realize
      (mapTermRel (fun k t => Term.liftAt n' m t) (fun x => id) (fun x => castLE (_ : x + 1 + n' ≤ x + n' + 1))
        (rel R✝ ts✝))
      v xs ↔
    Realize (rel R✝ ts✝) v (xs ∘ fun i => if ↑i < m then castAdd n' i else addNat i n')

Next tactic:
simp [mapTermRel, Realize, realize_rel, realize_liftAt, Sum.elim_comp_map]