l3lab/ntp-mathlib huggingface dataset:
theorem isPrenex_toPrenexImp {φ ψ : L.BoundedFormula α n} (hφ : IsPrenex φ) (hψ : IsPrenex ψ) :
    IsPrenex (φ.toPrenexImp ψ) := 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
hφ : IsPrenex φ
hψ : IsPrenex ψ
⊢ IsPrenex (toPrenexImp φ ψ)

Next tactic:
induction' hφ with _ _ hφ _ _ _ ih1 _ _ _ ih2
theorem isPrenex_toPrenexImp {φ ψ : L.BoundedFormula α n} (hφ : IsPrenex φ) (hψ : IsPrenex ψ) :
    IsPrenex (φ.toPrenexImp ψ) := by
  induction' hφ with _ _ hφ _ _ _ ih1 _ _ _ ih2
  · 

Proof state:
case of_isQF
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
n✝ : ℕ
φ✝ : BoundedFormula L α n✝
hφ : IsQF φ✝
ψ : BoundedFormula L α n✝
hψ : IsPrenex ψ
⊢ IsPrenex (toPrenexImp φ✝ ψ)

Next tactic:
rw [hφ.toPrenexImp]
theorem isPrenex_toPrenexImp {φ ψ : L.BoundedFormula α n} (hφ : IsPrenex φ) (hψ : IsPrenex ψ) :
    IsPrenex (φ.toPrenexImp ψ) := by
  induction' hφ with _ _ hφ _ _ _ ih1 _ _ _ ih2
  · rw [hφ.toPrenexImp]
    

Proof state:
case of_isQF
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
n✝ : ℕ
φ✝ : BoundedFormula L α n✝
hφ : IsQF φ✝
ψ : BoundedFormula L α n✝
hψ : IsPrenex ψ
⊢ IsPrenex (toPrenexImpRight φ✝ ψ)

Next tactic:
exact isPrenex_toPrenexImpRight hφ hψ
theorem isPrenex_toPrenexImp {φ ψ : L.BoundedFormula α n} (hφ : IsPrenex φ) (hψ : IsPrenex ψ) :
    IsPrenex (φ.toPrenexImp ψ) := by
  induction' hφ with _ _ hφ _ _ _ ih1 _ _ _ ih2
  · rw [hφ.toPrenexImp]
    exact isPrenex_toPrenexImpRight hφ hψ
  · 

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
φ : BoundedFormula L α n
n✝ : ℕ
φ✝ : BoundedFormula L α (n✝ + 1)
h✝ : IsPrenex φ✝
ih1 : ∀ {ψ : BoundedFormula L α (n✝ + 1)}, IsPrenex ψ → IsPrenex (toPrenexImp φ✝ ψ)
ψ : BoundedFormula L α n✝
hψ : IsPrenex ψ
⊢ IsPrenex (toPrenexImp (all φ✝) ψ)

Next tactic:
exact (ih1 hψ.liftAt).ex
theorem isPrenex_toPrenexImp {φ ψ : L.BoundedFormula α n} (hφ : IsPrenex φ) (hψ : IsPrenex ψ) :
    IsPrenex (φ.toPrenexImp ψ) := by
  induction' hφ with _ _ hφ _ _ _ ih1 _ _ _ ih2
  · rw [hφ.toPrenexImp]
    exact isPrenex_toPrenexImpRight hφ hψ
  · exact (ih1 hψ.liftAt).ex
  · 

Proof state:
case ex
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
n✝ : ℕ
φ✝ : BoundedFormula L α (n✝ + 1)
h✝ : IsPrenex φ✝
ih2 : ∀ {ψ : BoundedFormula L α (n✝ + 1)}, IsPrenex ψ → IsPrenex (toPrenexImp φ✝ ψ)
ψ : BoundedFormula L α n✝
hψ : IsPrenex ψ
⊢ IsPrenex (toPrenexImp (BoundedFormula.ex φ✝) ψ)

Next tactic:
exact (ih2 hψ.liftAt).all
@[simp]
theorem id_onBoundedFormula :
    ((LHom.id L).onBoundedFormula : L.BoundedFormula α n → L.BoundedFormula α n) = 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 : ℕ
⊢ onBoundedFormula (LHom.id L) = id

Next tactic:
ext f
@[simp]
theorem id_onBoundedFormula :
    ((LHom.id L).onBoundedFormula : L.BoundedFormula α n → L.BoundedFormula α n) = id := by
  ext f
  

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
n : ℕ
f : BoundedFormula L α n
⊢ onBoundedFormula (LHom.id L) f = id f

Next tactic:
induction' f with _ _ _ _ _ _ _ _ _ _ _ ih1 ih2 _ _ ih3
@[simp]
theorem id_onBoundedFormula :
    ((LHom.id L).onBoundedFormula : L.BoundedFormula α n → L.BoundedFormula α n) = id := by
  ext f
  induction' f with _ _ _ _ _ _ _ _ _ _ _ ih1 ih2 _ _ ih3
  · 

Proof state:
case h.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✝ : ℕ
⊢ onBoundedFormula (LHom.id L) falsum = id falsum

Next tactic:
rfl
@[simp]
theorem id_onBoundedFormula :
    ((LHom.id L).onBoundedFormula : L.BoundedFormula α n → L.BoundedFormula α n) = id := by
  ext f
  induction' f with _ _ _ _ _ _ _ _ _ _ _ ih1 ih2 _ _ ih3
  · rfl
  · 

Proof state:
case h.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✝ : ℕ
t₁✝ t₂✝ : Term L (α ⊕ Fin n✝)
⊢ onBoundedFormula (LHom.id L) (equal t₁✝ t₂✝) = id (equal t₁✝ t₂✝)

Next tactic:
rw [onBoundedFormula, LHom.id_onTerm, id.def, id.def, id.def, Term.bdEqual]
@[simp]
theorem id_onBoundedFormula :
    ((LHom.id L).onBoundedFormula : L.BoundedFormula α n → L.BoundedFormula α n) = id := by
  ext f
  induction' f with _ _ _ _ _ _ _ _ _ _ _ ih1 ih2 _ _ ih3
  · rfl
  · rw [onBoundedFormula, LHom.id_onTerm, id.def, id.def, id.def, Term.bdEqual]
  · 

Proof state:
case h.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✝ l✝ : ℕ
R✝ : Relations L l✝
ts✝ : Fin l✝ → Term L (α ⊕ Fin n✝)
⊢ onBoundedFormula (LHom.id L) (rel R✝ ts✝) = id (rel R✝ ts✝)

Next tactic:
rw [onBoundedFormula, LHom.id_onTerm]
@[simp]
theorem id_onBoundedFormula :
    ((LHom.id L).onBoundedFormula : L.BoundedFormula α n → L.BoundedFormula α n) = id := by
  ext f
  induction' f with _ _ _ _ _ _ _ _ _ _ _ ih1 ih2 _ _ ih3
  · rfl
  · rw [onBoundedFormula, LHom.id_onTerm, id.def, id.def, id.def, Term.bdEqual]
  · rw [onBoundedFormula, LHom.id_onTerm]
    

Proof state:
case h.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✝ l✝ : ℕ
R✝ : Relations L l✝
ts✝ : Fin l✝ → Term L (α ⊕ Fin n✝)
⊢ Relations.boundedFormula (onRelation (LHom.id L) R✝) (id ∘ ts✝) = id (rel R✝ ts✝)

Next tactic:
rfl
@[simp]
theorem id_onBoundedFormula :
    ((LHom.id L).onBoundedFormula : L.BoundedFormula α n → L.BoundedFormula α n) = id := by
  ext f
  induction' f with _ _ _ _ _ _ _ _ _ _ _ ih1 ih2 _ _ ih3
  · rfl
  · rw [onBoundedFormula, LHom.id_onTerm, id.def, id.def, id.def, Term.bdEqual]
  · rw [onBoundedFormula, LHom.id_onTerm]
    rfl
  · 

Proof state:
case h.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✝ : ℕ
f₁✝ f₂✝ : BoundedFormula L α n✝
ih1 : onBoundedFormula (LHom.id L) f₁✝ = id f₁✝
ih2 : onBoundedFormula (LHom.id L) f₂✝ = id f₂✝
⊢ onBoundedFormula (LHom.id L) (imp f₁✝ f₂✝) = id (imp f₁✝ f₂✝)

Next tactic:
rw [onBoundedFormula, ih1, ih2, id.def, id.def, id.def]
@[simp]
theorem id_onBoundedFormula :
    ((LHom.id L).onBoundedFormula : L.BoundedFormula α n → L.BoundedFormula α n) = id := by
  ext f
  induction' f with _ _ _ _ _ _ _ _ _ _ _ ih1 ih2 _ _ ih3
  · rfl
  · rw [onBoundedFormula, LHom.id_onTerm, id.def, id.def, id.def, Term.bdEqual]
  · rw [onBoundedFormula, LHom.id_onTerm]
    rfl
  · rw [onBoundedFormula, ih1, ih2, id.def, id.def, id.def]
  · 

Proof state:
case h.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✝ : ℕ
f✝ : BoundedFormula L α (n✝ + 1)
ih3 : onBoundedFormula (LHom.id L) f✝ = id f✝
⊢ onBoundedFormula (LHom.id L) (all f✝) = id (all f✝)

Next tactic:
rw [onBoundedFormula, ih3, id.def, id.def]
@[simp]
theorem comp_onBoundedFormula {L'' : Language} (φ : L' →ᴸ L'') (ψ : L →ᴸ L') :
    ((φ.comp ψ).onBoundedFormula : L.BoundedFormula α n → L''.BoundedFormula α n) =
      φ.onBoundedFormula ∘ ψ.onBoundedFormula := 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
φ : L' →ᴸ L''
ψ : L →ᴸ L'
⊢ onBoundedFormula (comp φ ψ) = onBoundedFormula φ ∘ onBoundedFormula ψ

Next tactic:
ext f
@[simp]
theorem comp_onBoundedFormula {L'' : Language} (φ : L' →ᴸ L'') (ψ : L →ᴸ L') :
    ((φ.comp ψ).onBoundedFormula : L.BoundedFormula α n → L''.BoundedFormula α n) =
      φ.onBoundedFormula ∘ ψ.onBoundedFormula := by
  ext f
  

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
n : ℕ
L'' : Language
φ : L' →ᴸ L''
ψ : L →ᴸ L'
f : BoundedFormula L α n
⊢ onBoundedFormula (comp φ ψ) f = (onBoundedFormula φ ∘ onBoundedFormula ψ) f

Next tactic:
induction' f with _ _ _ _ _ _ _ _ _ _ _ ih1 ih2 _ _ ih3
@[simp]
theorem comp_onBoundedFormula {L'' : Language} (φ : L' →ᴸ L'') (ψ : L →ᴸ L') :
    ((φ.comp ψ).onBoundedFormula : L.BoundedFormula α n → L''.BoundedFormula α n) =
      φ.onBoundedFormula ∘ ψ.onBoundedFormula := by
  ext f
  induction' f with _ _ _ _ _ _ _ _ _ _ _ ih1 ih2 _ _ ih3
  · 

Proof state:
case h.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
φ : L' →ᴸ L''
ψ : L →ᴸ L'
n✝ : ℕ
⊢ onBoundedFormula (comp φ ψ) falsum = (onBoundedFormula φ ∘ onBoundedFormula ψ) falsum

Next tactic:
rfl
@[simp]
theorem comp_onBoundedFormula {L'' : Language} (φ : L' →ᴸ L'') (ψ : L →ᴸ L') :
    ((φ.comp ψ).onBoundedFormula : L.BoundedFormula α n → L''.BoundedFormula α n) =
      φ.onBoundedFormula ∘ ψ.onBoundedFormula := by
  ext f
  induction' f with _ _ _ _ _ _ _ _ _ _ _ ih1 ih2 _ _ ih3
  · rfl
  · 

Proof state:
case h.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
φ : L' →ᴸ L''
ψ : L →ᴸ L'
n✝ : ℕ
t₁✝ t₂✝ : Term L (α ⊕ Fin n✝)
⊢ onBoundedFormula (comp φ ψ) (equal t₁✝ t₂✝) = (onBoundedFormula φ ∘ onBoundedFormula ψ) (equal t₁✝ t₂✝)

Next tactic:
simp only [onBoundedFormula, comp_onTerm, Function.comp_apply]
@[simp]
theorem comp_onBoundedFormula {L'' : Language} (φ : L' →ᴸ L'') (ψ : L →ᴸ L') :
    ((φ.comp ψ).onBoundedFormula : L.BoundedFormula α n → L''.BoundedFormula α n) =
      φ.onBoundedFormula ∘ ψ.onBoundedFormula := by
  ext f
  induction' f with _ _ _ _ _ _ _ _ _ _ _ ih1 ih2 _ _ ih3
  · rfl
  · simp only [onBoundedFormula, comp_onTerm, Function.comp_apply]
  · 

Proof state:
case h.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
φ : L' →ᴸ L''
ψ : L →ᴸ L'
n✝ l✝ : ℕ
R✝ : Relations L l✝
ts✝ : Fin l✝ → Term L (α ⊕ Fin n✝)
⊢ onBoundedFormula (comp φ ψ) (rel R✝ ts✝) = (onBoundedFormula φ ∘ onBoundedFormula ψ) (rel R✝ ts✝)

Next tactic:
simp only [onBoundedFormula, comp_onRelation, comp_onTerm, Function.comp_apply]
@[simp]
theorem comp_onBoundedFormula {L'' : Language} (φ : L' →ᴸ L'') (ψ : L →ᴸ L') :
    ((φ.comp ψ).onBoundedFormula : L.BoundedFormula α n → L''.BoundedFormula α n) =
      φ.onBoundedFormula ∘ ψ.onBoundedFormula := by
  ext f
  induction' f with _ _ _ _ _ _ _ _ _ _ _ ih1 ih2 _ _ ih3
  · rfl
  · simp only [onBoundedFormula, comp_onTerm, Function.comp_apply]
  · simp only [onBoundedFormula, comp_onRelation, comp_onTerm, Function.comp_apply]
    

Proof state:
case h.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
φ : L' →ᴸ L''
ψ : L →ᴸ L'
n✝ l✝ : ℕ
R✝ : Relations L l✝
ts✝ : Fin l✝ → Term L (α ⊕ Fin n✝)
⊢ Relations.boundedFormula (onRelation φ (onRelation ψ R✝)) ((onTerm φ ∘ onTerm ψ) ∘ ts✝) =
    Relations.boundedFormula (onRelation φ (onRelation ψ R✝)) (onTerm φ ∘ onTerm ψ ∘ ts✝)

Next tactic:
rfl
@[simp]
theorem comp_onBoundedFormula {L'' : Language} (φ : L' →ᴸ L'') (ψ : L →ᴸ L') :
    ((φ.comp ψ).onBoundedFormula : L.BoundedFormula α n → L''.BoundedFormula α n) =
      φ.onBoundedFormula ∘ ψ.onBoundedFormula := by
  ext f
  induction' f with _ _ _ _ _ _ _ _ _ _ _ ih1 ih2 _ _ ih3
  · rfl
  · simp only [onBoundedFormula, comp_onTerm, Function.comp_apply]
  · simp only [onBoundedFormula, comp_onRelation, comp_onTerm, Function.comp_apply]
    rfl
  · 

Proof state:
case h.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
φ : L' →ᴸ L''
ψ : L →ᴸ L'
n✝ : ℕ
f₁✝ f₂✝ : BoundedFormula L α n✝
ih1 : onBoundedFormula (comp φ ψ) f₁✝ = (onBoundedFormula φ ∘ onBoundedFormula ψ) f₁✝
ih2 : onBoundedFormula (comp φ ψ) f₂✝ = (onBoundedFormula φ ∘ onBoundedFormula ψ) f₂✝
⊢ onBoundedFormula (comp φ ψ) (imp f₁✝ f₂✝) = (onBoundedFormula φ ∘ onBoundedFormula ψ) (imp f₁✝ f₂✝)

Next tactic:
simp only [onBoundedFormula, Function.comp_apply, ih1, ih2, eq_self_iff_true, and_self_iff]
@[simp]
theorem comp_onBoundedFormula {L'' : Language} (φ : L' →ᴸ L'') (ψ : L →ᴸ L') :
    ((φ.comp ψ).onBoundedFormula : L.BoundedFormula α n → L''.BoundedFormula α n) =
      φ.onBoundedFormula ∘ ψ.onBoundedFormula := by
  ext f
  induction' f with _ _ _ _ _ _ _ _ _ _ _ ih1 ih2 _ _ ih3
  · rfl
  · simp only [onBoundedFormula, comp_onTerm, Function.comp_apply]
  · simp only [onBoundedFormula, comp_onRelation, comp_onTerm, Function.comp_apply]
    rfl
  · simp only [onBoundedFormula, Function.comp_apply, ih1, ih2, eq_self_iff_true, and_self_iff]
  · 

Proof state:
case h.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
φ : L' →ᴸ L''
ψ : L →ᴸ L'
n✝ : ℕ
f✝ : BoundedFormula L α (n✝ + 1)
ih3 : onBoundedFormula (comp φ ψ) f✝ = (onBoundedFormula φ ∘ onBoundedFormula ψ) f✝
⊢ onBoundedFormula (comp φ ψ) (all f✝) = (onBoundedFormula φ ∘ onBoundedFormula ψ) (all f✝)

Next tactic:
simp only [ih3, onBoundedFormula, Function.comp_apply]
/-- Maps a bounded formula's symbols along a language equivalence. -/
@[simps]
def onBoundedFormula (φ : L ≃ᴸ L') : L.BoundedFormula α n ≃ L'.BoundedFormula α n where
  toFun := φ.toLHom.onBoundedFormula
  invFun := φ.invLHom.onBoundedFormula
  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
n : ℕ
φ : L ≃ᴸ L'
⊢ Function.LeftInverse (LHom.onBoundedFormula φ.invLHom) (LHom.onBoundedFormula φ.toLHom)

Next tactic:
rw [Function.leftInverse_iff_comp, ← LHom.comp_onBoundedFormula, φ.left_inv,
      LHom.id_onBoundedFormula]
/-- Maps a bounded formula's symbols along a language equivalence. -/
@[simps]
def onBoundedFormula (φ : L ≃ᴸ L') : L.BoundedFormula α n ≃ L'.BoundedFormula α n where
  toFun := φ.toLHom.onBoundedFormula
  invFun := φ.invLHom.onBoundedFormula
  left_inv := by
    rw [Function.leftInverse_iff_comp, ← LHom.comp_onBoundedFormula, φ.left_inv,
      LHom.id_onBoundedFormula]
  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
n : ℕ
φ : L ≃ᴸ L'
⊢ Function.RightInverse (LHom.onBoundedFormula φ.invLHom) (LHom.onBoundedFormula φ.toLHom)

Next tactic:
rw [Function.rightInverse_iff_comp, ← LHom.comp_onBoundedFormula, φ.right_inv,
      LHom.id_onBoundedFormula]
theorem distinctConstantsTheory_eq_iUnion (s : Set α) :
    L.distinctConstantsTheory s =
      ⋃ t : Finset s,
        L.distinctConstantsTheory (t.map (Function.Embedding.subtype fun x => x ∈ s)) := 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 : ℕ
s : Set α
⊢ distinctConstantsTheory L s =
    ⋃ t, distinctConstantsTheory L ↑(Finset.map (Function.Embedding.subtype fun x => x ∈ s) t)

Next tactic:
classical
    simp only [distinctConstantsTheory]
    rw [← image_iUnion, ← iUnion_inter]
    refine' congr rfl (congr (congr rfl _) rfl)
    ext ⟨i, j⟩
    simp only [prod_mk_mem_set_prod_eq, Finset.coe_map, Function.Embedding.coe_subtype, mem_iUnion,
      mem_image, Finset.mem_coe, Subtype.exists, Subtype.coe_mk, exists_and_right, exists_eq_right]
    refine' ⟨fun h => ⟨{⟨i, h.1⟩, ⟨j, h.2⟩}, ⟨h.1, _⟩, ⟨h.2, _⟩⟩, _⟩
    · simp
    · simp
    · rintro ⟨t, ⟨is, _⟩, ⟨js, _⟩⟩
      exact ⟨is, js⟩
theorem distinctConstantsTheory_eq_iUnion (s : Set α) :
    L.distinctConstantsTheory s =
      ⋃ t : Finset s,
        L.distinctConstantsTheory (t.map (Function.Embedding.subtype fun x => x ∈ s)) := by
  classical
    

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 : ℕ
s : Set α
⊢ distinctConstantsTheory L s =
    ⋃ t, distinctConstantsTheory L ↑(Finset.map (Function.Embedding.subtype fun x => x ∈ s) t)

Next tactic:
simp only [distinctConstantsTheory]
theorem distinctConstantsTheory_eq_iUnion (s : Set α) :
    L.distinctConstantsTheory s =
      ⋃ t : Finset s,
        L.distinctConstantsTheory (t.map (Function.Embedding.subtype fun x => x ∈ s)) := by
  classical
    simp only [distinctConstantsTheory]
    

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 : ℕ
s : Set α
⊢ (fun ab => Formula.not (Term.equal (Constants.term (Language.con L ab.1)) (Constants.term (Language.con L ab.2)))) ''
      (s ×ˢ s ∩ (diagonal α)ᶜ) =
    ⋃ t,
      (fun ab =>
          Formula.not (Term.equal (Constants.term (Language.con L ab.1)) (Constants.term (Language.con L ab.2)))) ''
        (↑(Finset.map (Function.Embedding.subtype fun x => x ∈ s) t) ×ˢ
            ↑(Finset.map (Function.Embedding.subtype fun x => x ∈ s) t) ∩
          (diagonal α)ᶜ)

Next tactic:
rw [← image_iUnion, ← iUnion_inter]
theorem distinctConstantsTheory_eq_iUnion (s : Set α) :
    L.distinctConstantsTheory s =
      ⋃ t : Finset s,
        L.distinctConstantsTheory (t.map (Function.Embedding.subtype fun x => x ∈ s)) := by
  classical
    simp only [distinctConstantsTheory]
    rw [← image_iUnion, ← iUnion_inter]
    

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 : ℕ
s : Set α
⊢ (fun ab => Formula.not (Term.equal (Constants.term (Language.con L ab.1)) (Constants.term (Language.con L ab.2)))) ''
      (s ×ˢ s ∩ (diagonal α)ᶜ) =
    (fun ab =>
        Formula.not (Term.equal (Constants.term (Language.con L ab.1)) (Constants.term (Language.con L ab.2)))) ''
      ((⋃ i,
          ↑(Finset.map (Function.Embedding.subtype fun x => x ∈ s) i) ×ˢ
            ↑(Finset.map (Function.Embedding.subtype fun x => x ∈ s) i)) ∩
        (diagonal α)ᶜ)

Next tactic:
refine' congr rfl (congr (congr rfl _) rfl)
theorem distinctConstantsTheory_eq_iUnion (s : Set α) :
    L.distinctConstantsTheory s =
      ⋃ t : Finset s,
        L.distinctConstantsTheory (t.map (Function.Embedding.subtype fun x => x ∈ s)) := by
  classical
    simp only [distinctConstantsTheory]
    rw [← image_iUnion, ← iUnion_inter]
    refine' congr rfl (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 : ℕ
s : Set α
⊢ s ×ˢ s =
    ⋃ i,
      ↑(Finset.map (Function.Embedding.subtype fun x => x ∈ s) i) ×ˢ
        ↑(Finset.map (Function.Embedding.subtype fun x => x ∈ s) i)

Next tactic:
ext ⟨i, j⟩
theorem distinctConstantsTheory_eq_iUnion (s : Set α) :
    L.distinctConstantsTheory s =
      ⋃ t : Finset s,
        L.distinctConstantsTheory (t.map (Function.Embedding.subtype fun x => x ∈ s)) := by
  classical
    simp only [distinctConstantsTheory]
    rw [← image_iUnion, ← iUnion_inter]
    refine' congr rfl (congr (congr rfl _) rfl)
    ext ⟨i, j⟩
    

Proof state:
case h.mk
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 : ℕ
s : Set α
i j : α
⊢ (i, j) ∈ s ×ˢ s ↔
    (i, j) ∈
      ⋃ i,
        ↑(Finset.map (Function.Embedding.subtype fun x => x ∈ s) i) ×ˢ
          ↑(Finset.map (Function.Embedding.subtype fun x => x ∈ s) i)

Next tactic:
simp only [prod_mk_mem_set_prod_eq, Finset.coe_map, Function.Embedding.coe_subtype, mem_iUnion,
      mem_image, Finset.mem_coe, Subtype.exists, Subtype.coe_mk, exists_and_right, exists_eq_right]
theorem distinctConstantsTheory_eq_iUnion (s : Set α) :
    L.distinctConstantsTheory s =
      ⋃ t : Finset s,
        L.distinctConstantsTheory (t.map (Function.Embedding.subtype fun x => x ∈ s)) := by
  classical
    simp only [distinctConstantsTheory]
    rw [← image_iUnion, ← iUnion_inter]
    refine' congr rfl (congr (congr rfl _) rfl)
    ext ⟨i, j⟩
    simp only [prod_mk_mem_set_prod_eq, Finset.coe_map, Function.Embedding.coe_subtype, mem_iUnion,
      mem_image, Finset.mem_coe, Subtype.exists, Subtype.coe_mk, exists_and_right, exists_eq_right]
    

Proof state:
case h.mk
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 : ℕ
s : Set α
i j : α
⊢ i ∈ s ∧ j ∈ s ↔
    ∃ i_1,
      (∃ (x : i ∈ s), { val := i, property := (_ : i ∈ s) } ∈ i_1) ∧
        ∃ (x : j ∈ s), { val := j, property := (_ : j ∈ s) } ∈ i_1

Next tactic:
refine' ⟨fun h => ⟨{⟨i, h.1⟩, ⟨j, h.2⟩}, ⟨h.1, _⟩, ⟨h.2, _⟩⟩, _⟩
theorem distinctConstantsTheory_eq_iUnion (s : Set α) :
    L.distinctConstantsTheory s =
      ⋃ t : Finset s,
        L.distinctConstantsTheory (t.map (Function.Embedding.subtype fun x => x ∈ s)) := by
  classical
    simp only [distinctConstantsTheory]
    rw [← image_iUnion, ← iUnion_inter]
    refine' congr rfl (congr (congr rfl _) rfl)
    ext ⟨i, j⟩
    simp only [prod_mk_mem_set_prod_eq, Finset.coe_map, Function.Embedding.coe_subtype, mem_iUnion,
      mem_image, Finset.mem_coe, Subtype.exists, Subtype.coe_mk, exists_and_right, exists_eq_right]
    refine' ⟨fun h => ⟨{⟨i, h.1⟩, ⟨j, h.2⟩}, ⟨h.1, _⟩, ⟨h.2, _⟩⟩, _⟩
    · 

Proof state:
case h.mk.refine'_1
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 : ℕ
s : Set α
i j : α
h : i ∈ s ∧ j ∈ s
⊢ { val := i, property := (_ : i ∈ s) } ∈ {{ val := i, property := (_ : i ∈ s) }, { val := j, property := (_ : j ∈ s) }}

Next tactic:
simp