l3lab/ntp-mathlib huggingface dataset:
/-- Relabels a term's variables along a bijection. -/
@[simps]
def relabelEquiv (g : α ≃ β) : L.Term α ≃ L.Term β :=
  ⟨relabel g, relabel g.symm, fun t => by simp, fun t => by 

Proof state:
L : Language
L' : Language
M : Type w
N : Type u_1
P : Type u_2
inst✝² : Structure L M
inst✝¹ : Structure L N
inst✝ : Structure L P
α : Type u'
β : Type v'
γ : Type u_3
g : α ≃ β
t : Term L β
⊢ relabel (⇑g) (relabel (⇑g.symm) t) = t

Next tactic:
simp
/-- A bijection between terms with constants and terms with extra variables. -/
@[simps]
def constantsVarsEquiv : L[[γ]].Term α ≃ L.Term (Sum γ α) :=
  ⟨constantsToVars, varsToConstants, 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
⊢ Function.LeftInverse varsToConstants constantsToVars

Next tactic:
intro t
/-- A bijection between terms with constants and terms with extra variables. -/
@[simps]
def constantsVarsEquiv : L[[γ]].Term α ≃ L.Term (Sum γ α) :=
  ⟨constantsToVars, varsToConstants, by
    intro t
    

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
t : Term (L[[γ]]) α
⊢ varsToConstants (constantsToVars t) = t

Next tactic:
induction' t with _ n f _ ih
/-- A bijection between terms with constants and terms with extra variables. -/
@[simps]
def constantsVarsEquiv : L[[γ]].Term α ≃ L.Term (Sum γ α) :=
  ⟨constantsToVars, varsToConstants, by
    intro t
    induction' t with _ n f _ ih
    · 

Proof state:
case var
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
_a✝ : α
⊢ varsToConstants (constantsToVars (var _a✝)) = var _a✝

Next tactic:
rfl
/-- A bijection between terms with constants and terms with extra variables. -/
@[simps]
def constantsVarsEquiv : L[[γ]].Term α ≃ L.Term (Sum γ α) :=
  ⟨constantsToVars, varsToConstants, by
    intro t
    induction' t with _ n f _ ih
    · rfl
    · 

Proof state:
case func
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 : ℕ
f : Functions (L[[γ]]) n
_ts✝ : Fin n → Term (L[[γ]]) α
ih : ∀ (a : Fin n), varsToConstants (constantsToVars (_ts✝ a)) = _ts✝ a
⊢ varsToConstants (constantsToVars (func f _ts✝)) = func f _ts✝

Next tactic:
cases n
/-- A bijection between terms with constants and terms with extra variables. -/
@[simps]
def constantsVarsEquiv : L[[γ]].Term α ≃ L.Term (Sum γ α) :=
  ⟨constantsToVars, varsToConstants, by
    intro t
    induction' t with _ n f _ ih
    · rfl
    · cases n
      · 

Proof state:
case func.zero
L : Language
L' : Language
M : Type w
N : Type u_1
P : Type u_2
inst✝² : Structure L M
inst✝¹ : Structure L N
inst✝ : Structure L P
α : Type u'
β : Type v'
γ : Type u_3
f : Functions (L[[γ]]) Nat.zero
_ts✝ : Fin Nat.zero → Term (L[[γ]]) α
ih : ∀ (a : Fin Nat.zero), varsToConstants (constantsToVars (_ts✝ a)) = _ts✝ a
⊢ varsToConstants (constantsToVars (func f _ts✝)) = func f _ts✝

Next tactic:
cases f
/-- A bijection between terms with constants and terms with extra variables. -/
@[simps]
def constantsVarsEquiv : L[[γ]].Term α ≃ L.Term (Sum γ α) :=
  ⟨constantsToVars, varsToConstants, by
    intro t
    induction' t with _ n f _ ih
    · rfl
    · cases n
      · cases f
        · 

Proof state:
case func.zero.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
_ts✝ : Fin Nat.zero → Term (L[[γ]]) α
ih : ∀ (a : Fin Nat.zero), varsToConstants (constantsToVars (_ts✝ a)) = _ts✝ a
val✝ : Functions L Nat.zero
⊢ varsToConstants (constantsToVars (func (Sum.inl val✝) _ts✝)) = func (Sum.inl val✝) _ts✝

Next tactic:
simp [constantsToVars, varsToConstants, ih]
/-- A bijection between terms with constants and terms with extra variables. -/
@[simps]
def constantsVarsEquiv : L[[γ]].Term α ≃ L.Term (Sum γ α) :=
  ⟨constantsToVars, varsToConstants, by
    intro t
    induction' t with _ n f _ ih
    · rfl
    · cases n
      · cases f
        · simp [constantsToVars, varsToConstants, ih]
        · 

Proof state:
case func.zero.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
_ts✝ : Fin Nat.zero → Term (L[[γ]]) α
ih : ∀ (a : Fin Nat.zero), varsToConstants (constantsToVars (_ts✝ a)) = _ts✝ a
val✝ : Functions (constantsOn γ) Nat.zero
⊢ varsToConstants (constantsToVars (func (Sum.inr val✝) _ts✝)) = func (Sum.inr val✝) _ts✝

Next tactic:
simp [constantsToVars, varsToConstants, Constants.term, eq_iff_true_of_subsingleton]
/-- A bijection between terms with constants and terms with extra variables. -/
@[simps]
def constantsVarsEquiv : L[[γ]].Term α ≃ L.Term (Sum γ α) :=
  ⟨constantsToVars, varsToConstants, by
    intro t
    induction' t with _ n f _ ih
    · rfl
    · cases n
      · cases f
        · simp [constantsToVars, varsToConstants, ih]
        · simp [constantsToVars, varsToConstants, Constants.term, eq_iff_true_of_subsingleton]
      · 

Proof state:
case func.succ
L : Language
L' : Language
M : Type w
N : Type u_1
P : Type u_2
inst✝² : Structure L M
inst✝¹ : Structure L N
inst✝ : Structure L P
α : Type u'
β : Type v'
γ : Type u_3
n✝ : ℕ
f : Functions (L[[γ]]) (Nat.succ n✝)
_ts✝ : Fin (Nat.succ n✝) → Term (L[[γ]]) α
ih : ∀ (a : Fin (Nat.succ n✝)), varsToConstants (constantsToVars (_ts✝ a)) = _ts✝ a
⊢ varsToConstants (constantsToVars (func f _ts✝)) = func f _ts✝

Next tactic:
cases' f with f f
/-- A bijection between terms with constants and terms with extra variables. -/
@[simps]
def constantsVarsEquiv : L[[γ]].Term α ≃ L.Term (Sum γ α) :=
  ⟨constantsToVars, varsToConstants, by
    intro t
    induction' t with _ n f _ ih
    · rfl
    · cases n
      · cases f
        · simp [constantsToVars, varsToConstants, ih]
        · simp [constantsToVars, varsToConstants, Constants.term, eq_iff_true_of_subsingleton]
      · cases' f with f f
        · 

Proof state:
case func.succ.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✝ : ℕ
_ts✝ : Fin (Nat.succ n✝) → Term (L[[γ]]) α
ih : ∀ (a : Fin (Nat.succ n✝)), varsToConstants (constantsToVars (_ts✝ a)) = _ts✝ a
f : Functions L (Nat.succ n✝)
⊢ varsToConstants (constantsToVars (func (Sum.inl f) _ts✝)) = func (Sum.inl f) _ts✝

Next tactic:
simp [constantsToVars, varsToConstants, ih]
/-- A bijection between terms with constants and terms with extra variables. -/
@[simps]
def constantsVarsEquiv : L[[γ]].Term α ≃ L.Term (Sum γ α) :=
  ⟨constantsToVars, varsToConstants, by
    intro t
    induction' t with _ n f _ ih
    · rfl
    · cases n
      · cases f
        · simp [constantsToVars, varsToConstants, ih]
        · simp [constantsToVars, varsToConstants, Constants.term, eq_iff_true_of_subsingleton]
      · cases' f with f f
        · simp [constantsToVars, varsToConstants, ih]
        · 

Proof state:
case func.succ.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✝ : ℕ
_ts✝ : Fin (Nat.succ n✝) → Term (L[[γ]]) α
ih : ∀ (a : Fin (Nat.succ n✝)), varsToConstants (constantsToVars (_ts✝ a)) = _ts✝ a
f : Functions (constantsOn γ) (Nat.succ n✝)
⊢ varsToConstants (constantsToVars (func (Sum.inr f) _ts✝)) = func (Sum.inr f) _ts✝

Next tactic:
exact isEmptyElim f
/-- A bijection between terms with constants and terms with extra variables. -/
@[simps]
def constantsVarsEquiv : L[[γ]].Term α ≃ L.Term (Sum γ α) :=
  ⟨constantsToVars, varsToConstants, by
    intro t
    induction' t with _ n f _ ih
    · rfl
    · cases n
      · cases f
        · simp [constantsToVars, varsToConstants, ih]
        · simp [constantsToVars, varsToConstants, Constants.term, eq_iff_true_of_subsingleton]
      · cases' f with f f
        · simp [constantsToVars, varsToConstants, ih]
        · exact isEmptyElim f, 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
⊢ Function.RightInverse varsToConstants constantsToVars

Next tactic:
intro t
/-- A bijection between terms with constants and terms with extra variables. -/
@[simps]
def constantsVarsEquiv : L[[γ]].Term α ≃ L.Term (Sum γ α) :=
  ⟨constantsToVars, varsToConstants, by
    intro t
    induction' t with _ n f _ ih
    · rfl
    · cases n
      · cases f
        · simp [constantsToVars, varsToConstants, ih]
        · simp [constantsToVars, varsToConstants, Constants.term, eq_iff_true_of_subsingleton]
      · cases' f with f f
        · simp [constantsToVars, varsToConstants, ih]
        · exact isEmptyElim f, by
    intro t
    

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
t : Term L (γ ⊕ α)
⊢ constantsToVars (varsToConstants t) = t

Next tactic:
induction' t with x n f _ ih
/-- A bijection between terms with constants and terms with extra variables. -/
@[simps]
def constantsVarsEquiv : L[[γ]].Term α ≃ L.Term (Sum γ α) :=
  ⟨constantsToVars, varsToConstants, by
    intro t
    induction' t with _ n f _ ih
    · rfl
    · cases n
      · cases f
        · simp [constantsToVars, varsToConstants, ih]
        · simp [constantsToVars, varsToConstants, Constants.term, eq_iff_true_of_subsingleton]
      · cases' f with f f
        · simp [constantsToVars, varsToConstants, ih]
        · exact isEmptyElim f, by
    intro t
    induction' t with x n f _ ih
    · 

Proof state:
case var
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
x : γ ⊕ α
⊢ constantsToVars (varsToConstants (var x)) = var x

Next tactic:
cases x
/-- A bijection between terms with constants and terms with extra variables. -/
@[simps]
def constantsVarsEquiv : L[[γ]].Term α ≃ L.Term (Sum γ α) :=
  ⟨constantsToVars, varsToConstants, by
    intro t
    induction' t with _ n f _ ih
    · rfl
    · cases n
      · cases f
        · simp [constantsToVars, varsToConstants, ih]
        · simp [constantsToVars, varsToConstants, Constants.term, eq_iff_true_of_subsingleton]
      · cases' f with f f
        · simp [constantsToVars, varsToConstants, ih]
        · exact isEmptyElim f, by
    intro t
    induction' t with x n f _ ih
    · cases x <;> 

Proof state:
case var.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
val✝ : γ
⊢ constantsToVars (varsToConstants (var (Sum.inl val✝))) = var (Sum.inl val✝)

Next tactic:
rfl
/-- A bijection between terms with constants and terms with extra variables. -/
@[simps]
def constantsVarsEquiv : L[[γ]].Term α ≃ L.Term (Sum γ α) :=
  ⟨constantsToVars, varsToConstants, by
    intro t
    induction' t with _ n f _ ih
    · rfl
    · cases n
      · cases f
        · simp [constantsToVars, varsToConstants, ih]
        · simp [constantsToVars, varsToConstants, Constants.term, eq_iff_true_of_subsingleton]
      · cases' f with f f
        · simp [constantsToVars, varsToConstants, ih]
        · exact isEmptyElim f, by
    intro t
    induction' t with x n f _ ih
    · cases x <;> 

Proof state:
case var.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
val✝ : α
⊢ constantsToVars (varsToConstants (var (Sum.inr val✝))) = var (Sum.inr val✝)

Next tactic:
rfl
/-- A bijection between terms with constants and terms with extra variables. -/
@[simps]
def constantsVarsEquiv : L[[γ]].Term α ≃ L.Term (Sum γ α) :=
  ⟨constantsToVars, varsToConstants, by
    intro t
    induction' t with _ n f _ ih
    · rfl
    · cases n
      · cases f
        · simp [constantsToVars, varsToConstants, ih]
        · simp [constantsToVars, varsToConstants, Constants.term, eq_iff_true_of_subsingleton]
      · cases' f with f f
        · simp [constantsToVars, varsToConstants, ih]
        · exact isEmptyElim f, by
    intro t
    induction' t with x n f _ ih
    · cases x <;> rfl
    · 

Proof state:
case func
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 : ℕ
f : Functions L n
_ts✝ : Fin n → Term L (γ ⊕ α)
ih : ∀ (a : Fin n), constantsToVars (varsToConstants (_ts✝ a)) = _ts✝ a
⊢ constantsToVars (varsToConstants (func f _ts✝)) = func f _ts✝

Next tactic:
cases n
/-- A bijection between terms with constants and terms with extra variables. -/
@[simps]
def constantsVarsEquiv : L[[γ]].Term α ≃ L.Term (Sum γ α) :=
  ⟨constantsToVars, varsToConstants, by
    intro t
    induction' t with _ n f _ ih
    · rfl
    · cases n
      · cases f
        · simp [constantsToVars, varsToConstants, ih]
        · simp [constantsToVars, varsToConstants, Constants.term, eq_iff_true_of_subsingleton]
      · cases' f with f f
        · simp [constantsToVars, varsToConstants, ih]
        · exact isEmptyElim f, by
    intro t
    induction' t with x n f _ ih
    · cases x <;> rfl
    · cases n <;> · 

Proof state:
case func.zero
L : Language
L' : Language
M : Type w
N : Type u_1
P : Type u_2
inst✝² : Structure L M
inst✝¹ : Structure L N
inst✝ : Structure L P
α : Type u'
β : Type v'
γ : Type u_3
f : Functions L Nat.zero
_ts✝ : Fin Nat.zero → Term L (γ ⊕ α)
ih : ∀ (a : Fin Nat.zero), constantsToVars (varsToConstants (_ts✝ a)) = _ts✝ a
⊢ constantsToVars (varsToConstants (func f _ts✝)) = func f _ts✝

Next tactic:
simp [varsToConstants, constantsToVars, ih]
/-- A bijection between terms with constants and terms with extra variables. -/
@[simps]
def constantsVarsEquiv : L[[γ]].Term α ≃ L.Term (Sum γ α) :=
  ⟨constantsToVars, varsToConstants, by
    intro t
    induction' t with _ n f _ ih
    · rfl
    · cases n
      · cases f
        · simp [constantsToVars, varsToConstants, ih]
        · simp [constantsToVars, varsToConstants, Constants.term, eq_iff_true_of_subsingleton]
      · cases' f with f f
        · simp [constantsToVars, varsToConstants, ih]
        · exact isEmptyElim f, by
    intro t
    induction' t with x n f _ ih
    · cases x <;> rfl
    · cases n <;> · 

Proof state:
case func.succ
L : Language
L' : Language
M : Type w
N : Type u_1
P : Type u_2
inst✝² : Structure L M
inst✝¹ : Structure L N
inst✝ : Structure L P
α : Type u'
β : Type v'
γ : Type u_3
n✝ : ℕ
f : Functions L (Nat.succ n✝)
_ts✝ : Fin (Nat.succ n✝) → Term L (γ ⊕ α)
ih : ∀ (a : Fin (Nat.succ n✝)), constantsToVars (varsToConstants (_ts✝ a)) = _ts✝ a
⊢ constantsToVars (varsToConstants (func f _ts✝)) = func f _ts✝

Next tactic:
simp [varsToConstants, constantsToVars, ih]
@[simp]
theorem id_onTerm : ((LHom.id L).onTerm : L.Term α → L.Term α) = 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
⊢ onTerm (LHom.id L) = id

Next tactic:
ext t
@[simp]
theorem id_onTerm : ((LHom.id L).onTerm : L.Term α → L.Term α) = id := by
  ext t
  

Proof state:
case h
L : Language
L' : Language
M : Type w
N : Type u_1
P : Type u_2
inst✝² : Structure L M
inst✝¹ : Structure L N
inst✝ : Structure L P
α : Type u'
β : Type v'
γ : Type u_3
t : Term L α
⊢ onTerm (LHom.id L) t = id t

Next tactic:
induction' t with _ _ _ _ ih
@[simp]
theorem id_onTerm : ((LHom.id L).onTerm : L.Term α → L.Term α) = id := by
  ext t
  induction' t with _ _ _ _ ih
  · 

Proof state:
case h.var
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
_a✝ : α
⊢ onTerm (LHom.id L) (var _a✝) = id (var _a✝)

Next tactic:
rfl
@[simp]
theorem id_onTerm : ((LHom.id L).onTerm : L.Term α → L.Term α) = id := by
  ext t
  induction' t with _ _ _ _ ih
  · rfl
  · 

Proof state:
case h.func
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
l✝ : ℕ
_f✝ : Functions L l✝
_ts✝ : Fin l✝ → Term L α
ih : ∀ (a : Fin l✝), onTerm (LHom.id L) (_ts✝ a) = id (_ts✝ a)
⊢ onTerm (LHom.id L) (func _f✝ _ts✝) = id (func _f✝ _ts✝)

Next tactic:
simp_rw [onTerm, ih]
@[simp]
theorem id_onTerm : ((LHom.id L).onTerm : L.Term α → L.Term α) = id := by
  ext t
  induction' t with _ _ _ _ ih
  · rfl
  · simp_rw [onTerm, ih]
    

Proof state:
case h.func
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
l✝ : ℕ
_f✝ : Functions L l✝
_ts✝ : Fin l✝ → Term L α
ih : ∀ (a : Fin l✝), onTerm (LHom.id L) (_ts✝ a) = id (_ts✝ a)
⊢ (func (onFunction (LHom.id L) _f✝) fun i => id (_ts✝ i)) = id (func _f✝ _ts✝)

Next tactic:
rfl
@[simp]
theorem comp_onTerm {L'' : Language} (φ : L' →ᴸ L'') (ψ : L →ᴸ L') :
    ((φ.comp ψ).onTerm : L.Term α → L''.Term α) = φ.onTerm ∘ ψ.onTerm := 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
L'' : Language
φ : L' →ᴸ L''
ψ : L →ᴸ L'
⊢ onTerm (comp φ ψ) = onTerm φ ∘ onTerm ψ

Next tactic:
ext t
@[simp]
theorem comp_onTerm {L'' : Language} (φ : L' →ᴸ L'') (ψ : L →ᴸ L') :
    ((φ.comp ψ).onTerm : L.Term α → L''.Term α) = φ.onTerm ∘ ψ.onTerm := by
  ext t
  

Proof state:
case h
L : Language
L' : Language
M : Type w
N : Type u_1
P : Type u_2
inst✝² : Structure L M
inst✝¹ : Structure L N
inst✝ : Structure L P
α : Type u'
β : Type v'
γ : Type u_3
L'' : Language
φ : L' →ᴸ L''
ψ : L →ᴸ L'
t : Term L α
⊢ onTerm (comp φ ψ) t = (onTerm φ ∘ onTerm ψ) t

Next tactic:
induction' t with _ _ _ _ ih
@[simp]
theorem comp_onTerm {L'' : Language} (φ : L' →ᴸ L'') (ψ : L →ᴸ L') :
    ((φ.comp ψ).onTerm : L.Term α → L''.Term α) = φ.onTerm ∘ ψ.onTerm := by
  ext t
  induction' t with _ _ _ _ ih
  · 

Proof state:
case h.var
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
L'' : Language
φ : L' →ᴸ L''
ψ : L →ᴸ L'
_a✝ : α
⊢ onTerm (comp φ ψ) (var _a✝) = (onTerm φ ∘ onTerm ψ) (var _a✝)

Next tactic:
rfl
@[simp]
theorem comp_onTerm {L'' : Language} (φ : L' →ᴸ L'') (ψ : L →ᴸ L') :
    ((φ.comp ψ).onTerm : L.Term α → L''.Term α) = φ.onTerm ∘ ψ.onTerm := by
  ext t
  induction' t with _ _ _ _ ih
  · rfl
  · 

Proof state:
case h.func
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
L'' : Language
φ : L' →ᴸ L''
ψ : L →ᴸ L'
l✝ : ℕ
_f✝ : Functions L l✝
_ts✝ : Fin l✝ → Term L α
ih : ∀ (a : Fin l✝), onTerm (comp φ ψ) (_ts✝ a) = (onTerm φ ∘ onTerm ψ) (_ts✝ a)
⊢ onTerm (comp φ ψ) (func _f✝ _ts✝) = (onTerm φ ∘ onTerm ψ) (func _f✝ _ts✝)

Next tactic:
simp_rw [onTerm, ih]
@[simp]
theorem comp_onTerm {L'' : Language} (φ : L' →ᴸ L'') (ψ : L →ᴸ L') :
    ((φ.comp ψ).onTerm : L.Term α → L''.Term α) = φ.onTerm ∘ ψ.onTerm := by
  ext t
  induction' t with _ _ _ _ ih
  · rfl
  · simp_rw [onTerm, ih]
    

Proof state:
case h.func
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
L'' : Language
φ : L' →ᴸ L''
ψ : L →ᴸ L'
l✝ : ℕ
_f✝ : Functions L l✝
_ts✝ : Fin l✝ → Term L α
ih : ∀ (a : Fin l✝), onTerm (comp φ ψ) (_ts✝ a) = (onTerm φ ∘ onTerm ψ) (_ts✝ a)
⊢ (func (onFunction (comp φ ψ) _f✝) fun i => (onTerm φ ∘ onTerm ψ) (_ts✝ i)) = (onTerm φ ∘ onTerm ψ) (func _f✝ _ts✝)

Next tactic:
rfl
/-- Maps a term's symbols along a language equivalence. -/
@[simps]
def Lequiv.onTerm (φ : L ≃ᴸ L') : L.Term α ≃ L'.Term α where
  toFun := φ.toLHom.onTerm
  invFun := φ.invLHom.onTerm
  left_inv := 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
φ : L ≃ᴸ L'
⊢ Function.LeftInverse (LHom.onTerm φ.invLHom) (LHom.onTerm φ.toLHom)

Next tactic:
rw [Function.leftInverse_iff_comp, ← LHom.comp_onTerm, φ.left_inv, LHom.id_onTerm]
/-- Maps a term's symbols along a language equivalence. -/
@[simps]
def Lequiv.onTerm (φ : L ≃ᴸ L') : L.Term α ≃ L'.Term α where
  toFun := φ.toLHom.onTerm
  invFun := φ.invLHom.onTerm
  left_inv := by
    rw [Function.leftInverse_iff_comp, ← LHom.comp_onTerm, φ.left_inv, LHom.id_onTerm]
  right_inv := 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
φ : L ≃ᴸ L'
⊢ Function.RightInverse (LHom.onTerm φ.invLHom) (LHom.onTerm φ.toLHom)

Next tactic:
rw [Function.rightInverse_iff_comp, ← LHom.comp_onTerm, φ.right_inv, LHom.id_onTerm]
@[simp]
theorem castLE_rfl {n} (h : n ≤ n) (φ : L.BoundedFormula α n) : φ.castLE h = φ := 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 : ℕ
h : n ≤ n
φ : BoundedFormula L α n
⊢ castLE h φ = φ

Next tactic:
induction' φ with _ _ _ _ _ _ _ _ _ _ _ ih1 ih2 _ _ ih3
@[simp]
theorem castLE_rfl {n} (h : n ≤ n) (φ : L.BoundedFormula α n) : φ.castLE h = φ := 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✝ : ℕ
h : n✝ ≤ n✝
⊢ castLE h falsum = falsum

Next tactic:
rfl
@[simp]
theorem castLE_rfl {n} (h : n ≤ n) (φ : L.BoundedFormula α n) : φ.castLE h = φ := 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✝)
h : n✝ ≤ n✝
⊢ castLE h (equal t₁✝ t₂✝) = equal t₁✝ t₂✝

Next tactic:
simp [Fin.castLE_of_eq]
@[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]
  · 

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✝)
h : n✝ ≤ n✝
⊢ castLE h (rel R✝ ts✝) = rel R✝ ts✝

Next tactic:
simp [Fin.castLE_of_eq]
@[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]
  · 

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 : ∀ (h : n✝ ≤ n✝), castLE h f₁✝ = f₁✝
ih2 : ∀ (h : n✝ ≤ n✝), castLE h f₂✝ = f₂✝
h : n✝ ≤ n✝
⊢ castLE h (imp f₁✝ f₂✝) = imp f₁✝ f₂✝

Next tactic:
simp [Fin.castLE_of_eq, ih1, ih2]