l3lab/ntp-mathlib huggingface dataset:
@[simp]
theorem castLE_rfl {n} (h : n ≤ n) (φ : L.BoundedFormula α n) : φ.castLE h = φ := by
  induction' φ with _ _ _ _ _ _ _ _ _ _ _ ih1 ih2 _ _ ih3
  · rfl
  · simp [Fin.castLE_of_eq]
  · simp [Fin.castLE_of_eq]
  · simp [Fin.castLE_of_eq, 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✝¹ n n✝ : ℕ
f✝ : BoundedFormula L α (n✝ + 1)
ih3 : ∀ (h : n✝ + 1 ≤ n✝ + 1), castLE h f✝ = f✝
h : n✝ ≤ n✝
⊢ castLE h (all f✝) = all f✝

Next tactic:
simp [Fin.castLE_of_eq, ih3]
@[simp]
theorem castLE_castLE {k m n} (km : k ≤ m) (mn : m ≤ n) (φ : L.BoundedFormula α k) :
    (φ.castLE km).castLE mn = φ.castLE (km.trans mn) := 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✝ k m n : ℕ
km : k ≤ m
mn : m ≤ n
φ : BoundedFormula L α k
⊢ castLE mn (castLE km φ) = castLE (_ : k ≤ n) φ

Next tactic:
revert m n
@[simp]
theorem castLE_castLE {k m n} (km : k ≤ m) (mn : m ≤ n) (φ : L.BoundedFormula α k) :
    (φ.castLE km).castLE mn = φ.castLE (km.trans mn) := by
  revert m n
  

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 k : ℕ
φ : BoundedFormula L α k
⊢ ∀ {m n : ℕ} (km : k ≤ m) (mn : m ≤ n), castLE mn (castLE km φ) = castLE (_ : k ≤ n) φ

Next tactic:
induction' φ with _ _ _ _ _ _ _ _ _ _ _ ih1 ih2 _ _ ih3
@[simp]
theorem castLE_castLE {k m n} (km : k ≤ m) (mn : m ≤ n) (φ : L.BoundedFormula α k) :
    (φ.castLE km).castLE mn = φ.castLE (km.trans mn) := by
  revert m n
  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 k n✝ : ℕ
⊢ ∀ {m n : ℕ} (km : n✝ ≤ m) (mn : m ≤ n), castLE mn (castLE km falsum) = castLE (_ : n✝ ≤ n) falsum

Next tactic:
intro m n km mn
@[simp]
theorem castLE_castLE {k m n} (km : k ≤ m) (mn : m ≤ n) (φ : L.BoundedFormula α k) :
    (φ.castLE km).castLE mn = φ.castLE (km.trans mn) := by
  revert m n
  induction' φ with _ _ _ _ _ _ _ _ _ _ _ ih1 ih2 _ _ ih3 <;> 

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 k n✝ : ℕ
t₁✝ t₂✝ : Term L (α ⊕ Fin n✝)
⊢ ∀ {m n : ℕ} (km : n✝ ≤ m) (mn : m ≤ n), castLE mn (castLE km (equal t₁✝ t₂✝)) = castLE (_ : n✝ ≤ n) (equal t₁✝ t₂✝)

Next tactic:
intro m n km mn
@[simp]
theorem castLE_castLE {k m n} (km : k ≤ m) (mn : m ≤ n) (φ : L.BoundedFormula α k) :
    (φ.castLE km).castLE mn = φ.castLE (km.trans mn) := by
  revert m n
  induction' φ with _ _ _ _ _ _ _ _ _ _ _ ih1 ih2 _ _ ih3 <;> 

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 k n✝ l✝ : ℕ
R✝ : Relations L l✝
ts✝ : Fin l✝ → Term L (α ⊕ Fin n✝)
⊢ ∀ {m n : ℕ} (km : n✝ ≤ m) (mn : m ≤ n), castLE mn (castLE km (rel R✝ ts✝)) = castLE (_ : n✝ ≤ n) (rel R✝ ts✝)

Next tactic:
intro m n km mn
@[simp]
theorem castLE_castLE {k m n} (km : k ≤ m) (mn : m ≤ n) (φ : L.BoundedFormula α k) :
    (φ.castLE km).castLE mn = φ.castLE (km.trans mn) := by
  revert m n
  induction' φ with _ _ _ _ _ _ _ _ _ _ _ ih1 ih2 _ _ ih3 <;> 

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 k n✝ : ℕ
f₁✝ f₂✝ : BoundedFormula L α n✝
ih1 : ∀ {m n : ℕ} (km : n✝ ≤ m) (mn : m ≤ n), castLE mn (castLE km f₁✝) = castLE (_ : n✝ ≤ n) f₁✝
ih2 : ∀ {m n : ℕ} (km : n✝ ≤ m) (mn : m ≤ n), castLE mn (castLE km f₂✝) = castLE (_ : n✝ ≤ n) f₂✝
⊢ ∀ {m n : ℕ} (km : n✝ ≤ m) (mn : m ≤ n), castLE mn (castLE km (imp f₁✝ f₂✝)) = castLE (_ : n✝ ≤ n) (imp f₁✝ f₂✝)

Next tactic:
intro m n km mn
@[simp]
theorem castLE_castLE {k m n} (km : k ≤ m) (mn : m ≤ n) (φ : L.BoundedFormula α k) :
    (φ.castLE km).castLE mn = φ.castLE (km.trans mn) := by
  revert m n
  induction' φ with _ _ _ _ _ _ _ _ _ _ _ ih1 ih2 _ _ ih3 <;> 

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 k n✝ : ℕ
f✝ : BoundedFormula L α (n✝ + 1)
ih3 : ∀ {m n : ℕ} (km : n✝ + 1 ≤ m) (mn : m ≤ n), castLE mn (castLE km f✝) = castLE (_ : n✝ + 1 ≤ n) f✝
⊢ ∀ {m n : ℕ} (km : n✝ ≤ m) (mn : m ≤ n), castLE mn (castLE km (all f✝)) = castLE (_ : n✝ ≤ n) (all f✝)

Next tactic:
intro m n km mn
@[simp]
theorem castLE_castLE {k m n} (km : k ≤ m) (mn : m ≤ n) (φ : L.BoundedFormula α k) :
    (φ.castLE km).castLE mn = φ.castLE (km.trans mn) := by
  revert m n
  induction' φ with _ _ _ _ _ _ _ _ _ _ _ ih1 ih2 _ _ ih3 <;> intro m n km mn
  · 

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✝¹ k n✝ m n : ℕ
km : n✝ ≤ m
mn : m ≤ n
⊢ castLE mn (castLE km falsum) = castLE (_ : n✝ ≤ n) falsum

Next tactic:
rfl
@[simp]
theorem castLE_castLE {k m n} (km : k ≤ m) (mn : m ≤ n) (φ : L.BoundedFormula α k) :
    (φ.castLE km).castLE mn = φ.castLE (km.trans mn) := by
  revert m n
  induction' φ with _ _ _ _ _ _ _ _ _ _ _ ih1 ih2 _ _ ih3 <;> intro m n km mn
  · 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✝¹ k n✝ : ℕ
t₁✝ t₂✝ : Term L (α ⊕ Fin n✝)
m n : ℕ
km : n✝ ≤ m
mn : m ≤ n
⊢ castLE mn (castLE km (equal t₁✝ t₂✝)) = castLE (_ : n✝ ≤ n) (equal t₁✝ t₂✝)

Next tactic:
simp
@[simp]
theorem castLE_castLE {k m n} (km : k ≤ m) (mn : m ≤ n) (φ : L.BoundedFormula α k) :
    (φ.castLE km).castLE mn = φ.castLE (km.trans mn) := by
  revert m n
  induction' φ with _ _ _ _ _ _ _ _ _ _ _ ih1 ih2 _ _ ih3 <;> intro m n km mn
  · rfl
  · simp
  · 

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✝¹ k n✝ l✝ : ℕ
R✝ : Relations L l✝
ts✝ : Fin l✝ → Term L (α ⊕ Fin n✝)
m n : ℕ
km : n✝ ≤ m
mn : m ≤ n
⊢ castLE mn (castLE km (rel R✝ ts✝)) = castLE (_ : n✝ ≤ n) (rel R✝ ts✝)

Next tactic:
simp only [castLE, eq_self_iff_true, heq_iff_eq, true_and_iff]
@[simp]
theorem castLE_castLE {k m n} (km : k ≤ m) (mn : m ≤ n) (φ : L.BoundedFormula α k) :
    (φ.castLE km).castLE mn = φ.castLE (km.trans mn) := by
  revert m n
  induction' φ with _ _ _ _ _ _ _ _ _ _ _ ih1 ih2 _ _ ih3 <;> intro m n km mn
  · rfl
  · simp
  · simp only [castLE, eq_self_iff_true, heq_iff_eq, true_and_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✝¹ k n✝ l✝ : ℕ
R✝ : Relations L l✝
ts✝ : Fin l✝ → Term L (α ⊕ Fin n✝)
m n : ℕ
km : n✝ ≤ m
mn : m ≤ n
⊢ rel R✝ (Term.relabel (Sum.map id (Fin.castLE mn)) ∘ Term.relabel (Sum.map id (Fin.castLE km)) ∘ ts✝) =
    rel R✝ (Term.relabel (Sum.map id (Fin.castLE (_ : n✝ ≤ n))) ∘ ts✝)

Next tactic:
rw [← Function.comp.assoc, Term.relabel_comp_relabel]
@[simp]
theorem castLE_castLE {k m n} (km : k ≤ m) (mn : m ≤ n) (φ : L.BoundedFormula α k) :
    (φ.castLE km).castLE mn = φ.castLE (km.trans mn) := by
  revert m n
  induction' φ with _ _ _ _ _ _ _ _ _ _ _ ih1 ih2 _ _ ih3 <;> intro m n km mn
  · rfl
  · simp
  · simp only [castLE, eq_self_iff_true, heq_iff_eq, true_and_iff]
    rw [← Function.comp.assoc, Term.relabel_comp_relabel]
    

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✝¹ k n✝ l✝ : ℕ
R✝ : Relations L l✝
ts✝ : Fin l✝ → Term L (α ⊕ Fin n✝)
m n : ℕ
km : n✝ ≤ m
mn : m ≤ n
⊢ rel R✝ (Term.relabel (Sum.map id (Fin.castLE mn) ∘ Sum.map id (Fin.castLE km)) ∘ ts✝) =
    rel R✝ (Term.relabel (Sum.map id (Fin.castLE (_ : n✝ ≤ n))) ∘ ts✝)

Next tactic:
simp
@[simp]
theorem castLE_castLE {k m n} (km : k ≤ m) (mn : m ≤ n) (φ : L.BoundedFormula α k) :
    (φ.castLE km).castLE mn = φ.castLE (km.trans mn) := by
  revert m n
  induction' φ with _ _ _ _ _ _ _ _ _ _ _ ih1 ih2 _ _ ih3 <;> intro m n km mn
  · rfl
  · simp
  · simp only [castLE, eq_self_iff_true, heq_iff_eq, true_and_iff]
    rw [← Function.comp.assoc, Term.relabel_comp_relabel]
    simp
  · 

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✝¹ k n✝ : ℕ
f₁✝ f₂✝ : BoundedFormula L α n✝
ih1 : ∀ {m n : ℕ} (km : n✝ ≤ m) (mn : m ≤ n), castLE mn (castLE km f₁✝) = castLE (_ : n✝ ≤ n) f₁✝
ih2 : ∀ {m n : ℕ} (km : n✝ ≤ m) (mn : m ≤ n), castLE mn (castLE km f₂✝) = castLE (_ : n✝ ≤ n) f₂✝
m n : ℕ
km : n✝ ≤ m
mn : m ≤ n
⊢ castLE mn (castLE km (imp f₁✝ f₂✝)) = castLE (_ : n✝ ≤ n) (imp f₁✝ f₂✝)

Next tactic:
simp [ih1, ih2]
@[simp]
theorem castLE_castLE {k m n} (km : k ≤ m) (mn : m ≤ n) (φ : L.BoundedFormula α k) :
    (φ.castLE km).castLE mn = φ.castLE (km.trans mn) := by
  revert m n
  induction' φ with _ _ _ _ _ _ _ _ _ _ _ ih1 ih2 _ _ ih3 <;> intro m n km mn
  · rfl
  · simp
  · simp only [castLE, eq_self_iff_true, heq_iff_eq, true_and_iff]
    rw [← Function.comp.assoc, Term.relabel_comp_relabel]
    simp
  · simp [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✝¹ k n✝ : ℕ
f✝ : BoundedFormula L α (n✝ + 1)
ih3 : ∀ {m n : ℕ} (km : n✝ + 1 ≤ m) (mn : m ≤ n), castLE mn (castLE km f✝) = castLE (_ : n✝ + 1 ≤ n) f✝
m n : ℕ
km : n✝ ≤ m
mn : m ≤ n
⊢ castLE mn (castLE km (all f✝)) = castLE (_ : n✝ ≤ n) (all f✝)

Next tactic:
simp only [castLE, ih3]
/-- Raises all of the `Fin`-indexed variables of a formula greater than or equal to `m` by `n'`. -/
def liftAt : ∀ {n : ℕ} (n' _m : ℕ), L.BoundedFormula α n → L.BoundedFormula α (n + n') :=
  fun {n} n' m φ =>
  φ.mapTermRel (fun k t => t.liftAt n' m) (fun _ => id) fun _ =>
    castLE (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✝ n n' m : ℕ
φ : BoundedFormula L α n
x✝ : ℕ
⊢ x✝ + 1 + n' ≤ x✝ + n' + 1

Next tactic:
rw [add_assoc, add_comm 1, add_assoc]
@[simp]
theorem mapTermRel_mapTermRel {L'' : Language}
    (ft : ∀ n, L.Term (Sum α (Fin n)) → L'.Term (Sum β (Fin n)))
    (fr : ∀ n, L.Relations n → L'.Relations n)
    (ft' : ∀ n, L'.Term (Sum β (Fin n)) → L''.Term (Sum γ (Fin n)))
    (fr' : ∀ n, L'.Relations n → L''.Relations n) {n} (φ : L.BoundedFormula α n) :
    ((φ.mapTermRel ft fr fun _ => id).mapTermRel ft' fr' fun _ => id) =
      φ.mapTermRel (fun _ => ft' _ ∘ ft _) (fun _ => fr' _ ∘ fr _) fun _ => id := 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'' : Language
ft : (n : ℕ) → Term L (α ⊕ Fin n) → Term L' (β ⊕ Fin n)
fr : (n : ℕ) → Relations L n → Relations L' n
ft' : (n : ℕ) → Term L' (β ⊕ Fin n) → Term L'' (γ ⊕ Fin n)
fr' : (n : ℕ) → Relations L' n → Relations L'' n
n : ℕ
φ : BoundedFormula L α n
⊢ mapTermRel ft' fr' (fun x => id) (mapTermRel ft fr (fun x => id) φ) =
    mapTermRel (fun x => ft' x ∘ ft x) (fun x => fr' x ∘ fr x) (fun x => id) φ

Next tactic:
induction' φ with _ _ _ _ _ _ _ _ _ _ _ ih1 ih2 _ _ ih3
@[simp]
theorem mapTermRel_mapTermRel {L'' : Language}
    (ft : ∀ n, L.Term (Sum α (Fin n)) → L'.Term (Sum β (Fin n)))
    (fr : ∀ n, L.Relations n → L'.Relations n)
    (ft' : ∀ n, L'.Term (Sum β (Fin n)) → L''.Term (Sum γ (Fin n)))
    (fr' : ∀ n, L'.Relations n → L''.Relations n) {n} (φ : L.BoundedFormula α n) :
    ((φ.mapTermRel ft fr fun _ => id).mapTermRel ft' fr' fun _ => id) =
      φ.mapTermRel (fun _ => ft' _ ∘ ft _) (fun _ => fr' _ ∘ fr _) fun _ => id := 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'' : Language
ft : (n : ℕ) → Term L (α ⊕ Fin n) → Term L' (β ⊕ Fin n)
fr : (n : ℕ) → Relations L n → Relations L' n
ft' : (n : ℕ) → Term L' (β ⊕ Fin n) → Term L'' (γ ⊕ Fin n)
fr' : (n : ℕ) → Relations L' n → Relations L'' n
n n✝ : ℕ
⊢ mapTermRel ft' fr' (fun x => id) (mapTermRel ft fr (fun x => id) falsum) =
    mapTermRel (fun x => ft' x ∘ ft x) (fun x => fr' x ∘ fr x) (fun x => id) falsum

Next tactic:
rfl
@[simp]
theorem mapTermRel_mapTermRel {L'' : Language}
    (ft : ∀ n, L.Term (Sum α (Fin n)) → L'.Term (Sum β (Fin n)))
    (fr : ∀ n, L.Relations n → L'.Relations n)
    (ft' : ∀ n, L'.Term (Sum β (Fin n)) → L''.Term (Sum γ (Fin n)))
    (fr' : ∀ n, L'.Relations n → L''.Relations n) {n} (φ : L.BoundedFormula α n) :
    ((φ.mapTermRel ft fr fun _ => id).mapTermRel ft' fr' fun _ => id) =
      φ.mapTermRel (fun _ => ft' _ ∘ ft _) (fun _ => fr' _ ∘ fr _) fun _ => id := 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'' : Language
ft : (n : ℕ) → Term L (α ⊕ Fin n) → Term L' (β ⊕ Fin n)
fr : (n : ℕ) → Relations L n → Relations L' n
ft' : (n : ℕ) → Term L' (β ⊕ Fin n) → Term L'' (γ ⊕ Fin n)
fr' : (n : ℕ) → Relations L' n → Relations L'' n
n n✝ : ℕ
t₁✝ t₂✝ : Term L (α ⊕ Fin n✝)
⊢ mapTermRel ft' fr' (fun x => id) (mapTermRel ft fr (fun x => id) (equal t₁✝ t₂✝)) =
    mapTermRel (fun x => ft' x ∘ ft x) (fun x => fr' x ∘ fr x) (fun x => id) (equal t₁✝ t₂✝)

Next tactic:
simp [mapTermRel]
@[simp]
theorem mapTermRel_mapTermRel {L'' : Language}
    (ft : ∀ n, L.Term (Sum α (Fin n)) → L'.Term (Sum β (Fin n)))
    (fr : ∀ n, L.Relations n → L'.Relations n)
    (ft' : ∀ n, L'.Term (Sum β (Fin n)) → L''.Term (Sum γ (Fin n)))
    (fr' : ∀ n, L'.Relations n → L''.Relations n) {n} (φ : L.BoundedFormula α n) :
    ((φ.mapTermRel ft fr fun _ => id).mapTermRel ft' fr' fun _ => id) =
      φ.mapTermRel (fun _ => ft' _ ∘ ft _) (fun _ => fr' _ ∘ fr _) fun _ => id := by
  induction' φ with _ _ _ _ _ _ _ _ _ _ _ ih1 ih2 _ _ ih3
  · rfl
  · simp [mapTermRel]
  · 

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'' : Language
ft : (n : ℕ) → Term L (α ⊕ Fin n) → Term L' (β ⊕ Fin n)
fr : (n : ℕ) → Relations L n → Relations L' n
ft' : (n : ℕ) → Term L' (β ⊕ Fin n) → Term L'' (γ ⊕ Fin n)
fr' : (n : ℕ) → Relations L' n → Relations L'' n
n n✝ l✝ : ℕ
R✝ : Relations L l✝
ts✝ : Fin l✝ → Term L (α ⊕ Fin n✝)
⊢ mapTermRel ft' fr' (fun x => id) (mapTermRel ft fr (fun x => id) (rel R✝ ts✝)) =
    mapTermRel (fun x => ft' x ∘ ft x) (fun x => fr' x ∘ fr x) (fun x => id) (rel R✝ ts✝)

Next tactic:
simp [mapTermRel]
@[simp]
theorem mapTermRel_mapTermRel {L'' : Language}
    (ft : ∀ n, L.Term (Sum α (Fin n)) → L'.Term (Sum β (Fin n)))
    (fr : ∀ n, L.Relations n → L'.Relations n)
    (ft' : ∀ n, L'.Term (Sum β (Fin n)) → L''.Term (Sum γ (Fin n)))
    (fr' : ∀ n, L'.Relations n → L''.Relations n) {n} (φ : L.BoundedFormula α n) :
    ((φ.mapTermRel ft fr fun _ => id).mapTermRel ft' fr' fun _ => id) =
      φ.mapTermRel (fun _ => ft' _ ∘ ft _) (fun _ => fr' _ ∘ fr _) fun _ => id := by
  induction' φ with _ _ _ _ _ _ _ _ _ _ _ ih1 ih2 _ _ ih3
  · rfl
  · simp [mapTermRel]
  · simp [mapTermRel]
  · 

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'' : Language
ft : (n : ℕ) → Term L (α ⊕ Fin n) → Term L' (β ⊕ Fin n)
fr : (n : ℕ) → Relations L n → Relations L' n
ft' : (n : ℕ) → Term L' (β ⊕ Fin n) → Term L'' (γ ⊕ Fin n)
fr' : (n : ℕ) → Relations L' n → Relations L'' n
n n✝ : ℕ
f₁✝ f₂✝ : BoundedFormula L α n✝
ih1 :
  mapTermRel ft' fr' (fun x => id) (mapTermRel ft fr (fun x => id) f₁✝) =
    mapTermRel (fun x => ft' x ∘ ft x) (fun x => fr' x ∘ fr x) (fun x => id) f₁✝
ih2 :
  mapTermRel ft' fr' (fun x => id) (mapTermRel ft fr (fun x => id) f₂✝) =
    mapTermRel (fun x => ft' x ∘ ft x) (fun x => fr' x ∘ fr x) (fun x => id) f₂✝
⊢ mapTermRel ft' fr' (fun x => id) (mapTermRel ft fr (fun x => id) (imp f₁✝ f₂✝)) =
    mapTermRel (fun x => ft' x ∘ ft x) (fun x => fr' x ∘ fr x) (fun x => id) (imp f₁✝ f₂✝)

Next tactic:
simp [mapTermRel, ih1, ih2]
@[simp]
theorem mapTermRel_mapTermRel {L'' : Language}
    (ft : ∀ n, L.Term (Sum α (Fin n)) → L'.Term (Sum β (Fin n)))
    (fr : ∀ n, L.Relations n → L'.Relations n)
    (ft' : ∀ n, L'.Term (Sum β (Fin n)) → L''.Term (Sum γ (Fin n)))
    (fr' : ∀ n, L'.Relations n → L''.Relations n) {n} (φ : L.BoundedFormula α n) :
    ((φ.mapTermRel ft fr fun _ => id).mapTermRel ft' fr' fun _ => id) =
      φ.mapTermRel (fun _ => ft' _ ∘ ft _) (fun _ => fr' _ ∘ fr _) fun _ => id := by
  induction' φ with _ _ _ _ _ _ _ _ _ _ _ ih1 ih2 _ _ ih3
  · rfl
  · simp [mapTermRel]
  · simp [mapTermRel]
  · simp [mapTermRel, 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'' : Language
ft : (n : ℕ) → Term L (α ⊕ Fin n) → Term L' (β ⊕ Fin n)
fr : (n : ℕ) → Relations L n → Relations L' n
ft' : (n : ℕ) → Term L' (β ⊕ Fin n) → Term L'' (γ ⊕ Fin n)
fr' : (n : ℕ) → Relations L' n → Relations L'' n
n n✝ : ℕ
f✝ : BoundedFormula L α (n✝ + 1)
ih3 :
  mapTermRel ft' fr' (fun x => id) (mapTermRel ft fr (fun x => id) f✝) =
    mapTermRel (fun x => ft' x ∘ ft x) (fun x => fr' x ∘ fr x) (fun x => id) f✝
⊢ mapTermRel ft' fr' (fun x => id) (mapTermRel ft fr (fun x => id) (all f✝)) =
    mapTermRel (fun x => ft' x ∘ ft x) (fun x => fr' x ∘ fr x) (fun x => id) (all f✝)

Next tactic:
simp [mapTermRel, ih3]
@[simp]
theorem mapTermRel_id_id_id {n} (φ : L.BoundedFormula α n) :
    (φ.mapTermRel (fun _ => id) (fun _ => id) fun _ => id) = φ := 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✝ n : ℕ
φ : BoundedFormula L α n
⊢ mapTermRel (fun x => id) (fun x => id) (fun x => id) φ = φ

Next tactic:
induction' φ with _ _ _ _ _ _ _ _ _ _ _ ih1 ih2 _ _ ih3
@[simp]
theorem mapTermRel_id_id_id {n} (φ : L.BoundedFormula α n) :
    (φ.mapTermRel (fun _ => id) (fun _ => id) fun _ => id) = φ := 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✝¹ n n✝ : ℕ
⊢ mapTermRel (fun x => id) (fun x => id) (fun x => id) falsum = falsum

Next tactic:
rfl
@[simp]
theorem mapTermRel_id_id_id {n} (φ : L.BoundedFormula α n) :
    (φ.mapTermRel (fun _ => id) (fun _ => id) fun _ => id) = φ := 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✝¹ n n✝ : ℕ
t₁✝ t₂✝ : Term L (α ⊕ Fin n✝)
⊢ mapTermRel (fun x => id) (fun x => id) (fun x => id) (equal t₁✝ t₂✝) = equal t₁✝ t₂✝

Next tactic:
simp [mapTermRel]
@[simp]
theorem mapTermRel_id_id_id {n} (φ : L.BoundedFormula α n) :
    (φ.mapTermRel (fun _ => id) (fun _ => id) fun _ => id) = φ := by
  induction' φ with _ _ _ _ _ _ _ _ _ _ _ ih1 ih2 _ _ ih3
  · rfl
  · simp [mapTermRel]
  · 

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✝¹ n n✝ l✝ : ℕ
R✝ : Relations L l✝
ts✝ : Fin l✝ → Term L (α ⊕ Fin n✝)
⊢ mapTermRel (fun x => id) (fun x => id) (fun x => id) (rel R✝ ts✝) = rel R✝ ts✝

Next tactic:
simp [mapTermRel]
@[simp]
theorem mapTermRel_id_id_id {n} (φ : L.BoundedFormula α n) :
    (φ.mapTermRel (fun _ => id) (fun _ => id) fun _ => id) = φ := by
  induction' φ with _ _ _ _ _ _ _ _ _ _ _ ih1 ih2 _ _ ih3
  · rfl
  · simp [mapTermRel]
  · simp [mapTermRel]
  · 

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✝¹ n n✝ : ℕ
f₁✝ f₂✝ : BoundedFormula L α n✝
ih1 : mapTermRel (fun x => id) (fun x => id) (fun x => id) f₁✝ = f₁✝
ih2 : mapTermRel (fun x => id) (fun x => id) (fun x => id) f₂✝ = f₂✝
⊢ mapTermRel (fun x => id) (fun x => id) (fun x => id) (imp f₁✝ f₂✝) = imp f₁✝ f₂✝

Next tactic:
simp [mapTermRel, ih1, ih2]
@[simp]
theorem mapTermRel_id_id_id {n} (φ : L.BoundedFormula α n) :
    (φ.mapTermRel (fun _ => id) (fun _ => id) fun _ => id) = φ := by
  induction' φ with _ _ _ _ _ _ _ _ _ _ _ ih1 ih2 _ _ ih3
  · rfl
  · simp [mapTermRel]
  · simp [mapTermRel]
  · simp [mapTermRel, 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✝¹ n n✝ : ℕ
f✝ : BoundedFormula L α (n✝ + 1)
ih3 : mapTermRel (fun x => id) (fun x => id) (fun x => id) f✝ = f✝
⊢ mapTermRel (fun x => id) (fun x => id) (fun x => id) (all f✝) = all f✝

Next tactic:
simp [mapTermRel, ih3]
/-- An equivalence of bounded formulas given by an equivalence of terms and an equivalence of
relations. -/
@[simps]
def mapTermRelEquiv (ft : ∀ n, L.Term (Sum α (Fin n)) ≃ L'.Term (Sum β (Fin n)))
    (fr : ∀ n, L.Relations n ≃ L'.Relations n) {n} : L.BoundedFormula α n ≃ L'.BoundedFormula β n :=
  ⟨mapTermRel (fun n => ft n) (fun n => fr n) fun _ => id,
    mapTermRel (fun n => (ft n).symm) (fun n => (fr n).symm) fun _ => id, fun φ => 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✝ : ℕ
ft : (n : ℕ) → Term L (α ⊕ Fin n) ≃ Term L' (β ⊕ Fin n)
fr : (n : ℕ) → Relations L n ≃ Relations L' n
n : ℕ
φ : BoundedFormula L α n
⊢ mapTermRel (fun n => ⇑(ft n).symm) (fun n => ⇑(fr n).symm) (fun x => id)
      (mapTermRel (fun n => ⇑(ft n)) (fun n => ⇑(fr n)) (fun x => id) φ) =
    φ

Next tactic:
simp
/-- An equivalence of bounded formulas given by an equivalence of terms and an equivalence of
relations. -/
@[simps]
def mapTermRelEquiv (ft : ∀ n, L.Term (Sum α (Fin n)) ≃ L'.Term (Sum β (Fin n)))
    (fr : ∀ n, L.Relations n ≃ L'.Relations n) {n} : L.BoundedFormula α n ≃ L'.BoundedFormula β n :=
  ⟨mapTermRel (fun n => ft n) (fun n => fr n) fun _ => id,
    mapTermRel (fun n => (ft n).symm) (fun n => (fr n).symm) fun _ => id, fun φ => by simp, fun φ =>
    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✝ : ℕ
ft : (n : ℕ) → Term L (α ⊕ Fin n) ≃ Term L' (β ⊕ Fin n)
fr : (n : ℕ) → Relations L n ≃ Relations L' n
n : ℕ
φ : BoundedFormula L' β n
⊢ mapTermRel (fun n => ⇑(ft n)) (fun n => ⇑(fr n)) (fun x => id)
      (mapTermRel (fun n => ⇑(ft n).symm) (fun n => ⇑(fr n).symm) (fun x => id) φ) =
    φ

Next tactic:
simp