-- Mathlib/ModelTheory/Semantics.lean
theorem realize_onBoundedFormula [L'.Structure M] (φ : L →ᴸ L') [φ.IsExpansionOn M] {n : ℕ}
    (ψ : L.BoundedFormula α n) {v : α → M} {xs : Fin n → M} :
    (φ.onBoundedFormula ψ).Realize v xs ↔ ψ.Realize v xs

Proof state:
case rel
L : Language
L' : Language
M : Type w
inst✝² : L.Structure M
α : Type u'
inst✝¹ : L'.Structure M
φ : L →ᴸ L'
inst✝ : φ.IsExpansionOn M
n : ℕ
v : α → M
n✝ l✝ : ℕ
R✝ : L.Relations l✝
ts✝ : Fin l✝ → L.Term (α ⊕ Fin n✝)
xs : Fin n✝ → M
⊢ (φ.onBoundedFormula (rel R✝ ts✝)).Realize v xs ↔ (rel R✝ ts✝).Realize v xs

Tactic:
simp only [onBoundedFormula, realize_rel, LHom.map_onRelation,
  Function.comp_apply, realize_onTerm]

Result:
case rel
L : Language
L' : Language
M : Type w
inst✝² : L.Structure M
α : Type u'
inst✝¹ : L'.Structure M
φ : L →ᴸ L'
inst✝ : φ.IsExpansionOn M
n : ℕ
v : α → M
n✝ l✝ : ℕ
R✝ : L.Relations l✝
ts✝ : Fin l✝ → L.Term (α ⊕ Fin n✝)
xs : Fin n✝ → M
⊢ (RelMap R✝ fun i => Term.realize (Sum.elim v xs) (ts✝ i)) ↔ (rel R✝ ts✝).Realize v xs

Proof state:
case all
L : Language
L' : Language
M : Type w
inst✝² : L.Structure M
α : Type u'
inst✝¹ : L'.Structure M
φ : L →ᴸ L'
inst✝ : φ.IsExpansionOn M
n : ℕ
v : α → M
n✝ : ℕ
f✝ : L.BoundedFormula α (n✝ + 1)
ih3 : ∀ {xs : Fin (n✝ + 1) → M}, (φ.onBoundedFormula f✝).Realize v xs ↔ f✝.Realize v xs
xs : Fin n✝ → M
⊢ (φ.onBoundedFormula (∀'f✝)).Realize v xs ↔ (∀'f✝).Realize v xs

Tactic:
simp only [onBoundedFormula, ih3, realize_all]

Result:
no goals

Proof state:
case falsum
L : Language
L' : Language
M : Type w
inst✝² : L.Structure M
α : Type u'
inst✝¹ : L'.Structure M
φ : L →ᴸ L'
inst✝ : φ.IsExpansionOn M
n : ℕ
v : α → M
n✝ : ℕ
xs : Fin n✝ → M
⊢ (φ.onBoundedFormula falsum).Realize v xs ↔ falsum.Realize v xs

Tactic:
rfl

Result:
no goals

Proof state:
case equal
L : Language
L' : Language
M : Type w
inst✝² : L.Structure M
α : Type u'
inst✝¹ : L'.Structure M
φ : L →ᴸ L'
inst✝ : φ.IsExpansionOn M
n : ℕ
v : α → M
n✝ : ℕ
t₁✝ t₂✝ : L.Term (α ⊕ Fin n✝)
xs : Fin n✝ → M
⊢ Term.realize (Sum.elim v xs) t₁✝ = Term.realize (Sum.elim v xs) t₂✝ ↔ (equal t₁✝ t₂✝).Realize v xs

Tactic:
rfl

Result:
no goals

Proof state:
case equal
L : Language
L' : Language
M : Type w
inst✝² : L.Structure M
α : Type u'
inst✝¹ : L'.Structure M
φ : L →ᴸ L'
inst✝ : φ.IsExpansionOn M
n : ℕ
v : α → M
n✝ : ℕ
t₁✝ t₂✝ : L.Term (α ⊕ Fin n✝)
xs : Fin n✝ → M
⊢ (φ.onBoundedFormula (equal t₁✝ t₂✝)).Realize v xs ↔ (equal t₁✝ t₂✝).Realize v xs

Tactic:
simp only [onBoundedFormula, realize_bdEqual, realize_onTerm]

Result:
case equal
L : Language
L' : Language
M : Type w
inst✝² : L.Structure M
α : Type u'
inst✝¹ : L'.Structure M
φ : L →ᴸ L'
inst✝ : φ.IsExpansionOn M
n : ℕ
v : α → M
n✝ : ℕ
t₁✝ t₂✝ : L.Term (α ⊕ Fin n✝)
xs : Fin n✝ → M
⊢ Term.realize (Sum.elim v xs) t₁✝ = Term.realize (Sum.elim v xs) t₂✝ ↔ (equal t₁✝ t₂✝).Realize v xs

Proof state:
case imp
L : Language
L' : Language
M : Type w
inst✝² : L.Structure M
α : Type u'
inst✝¹ : L'.Structure M
φ : L →ᴸ L'
inst✝ : φ.IsExpansionOn M
n : ℕ
v : α → M
n✝ : ℕ
f₁✝ f₂✝ : L.BoundedFormula α n✝
ih1 : ∀ {xs : Fin n✝ → M}, (φ.onBoundedFormula f₁✝).Realize v xs ↔ f₁✝.Realize v xs
ih2 : ∀ {xs : Fin n✝ → M}, (φ.onBoundedFormula f₂✝).Realize v xs ↔ f₂✝.Realize v xs
xs : Fin n✝ → M
⊢ (φ.onBoundedFormula (f₁✝ ⟹ f₂✝)).Realize v xs ↔ (f₁✝ ⟹ f₂✝).Realize v xs

Tactic:
simp only [onBoundedFormula, ih1, ih2, realize_imp]

Result:
no goals

Proof state:
L : Language
L' : Language
M : Type w
inst✝² : L.Structure M
α : Type u'
inst✝¹ : L'.Structure M
φ : L →ᴸ L'
inst✝ : φ.IsExpansionOn M
n : ℕ
ψ : L.BoundedFormula α n
v : α → M
xs : Fin n → M
⊢ (φ.onBoundedFormula ψ).Realize v xs ↔ ψ.Realize v xs

Tactic:
induction ψ with
| falsum => rfl
| equal => simp only [onBoundedFormula, realize_bdEqual, realize_onTerm]; rfl
| rel =>
  simp only [onBoundedFormula, realize_rel, LHom.map_onRelation,
    Function.comp_apply, realize_onTerm]
  rfl
| imp _ _ ih1 ih2 => simp only [onBoundedFormula, ih1, ih2, realize_imp]
| all _ ih3 => simp only [onBoundedFormula, ih3, realize_all]

Result:
no goals

Proof state:
case rel
L : Language
L' : Language
M : Type w
inst✝² : L.Structure M
α : Type u'
inst✝¹ : L'.Structure M
φ : L →ᴸ L'
inst✝ : φ.IsExpansionOn M
n : ℕ
v : α → M
n✝ l✝ : ℕ
R✝ : L.Relations l✝
ts✝ : Fin l✝ → L.Term (α ⊕ Fin n✝)
xs : Fin n✝ → M
⊢ (RelMap R✝ fun i => Term.realize (Sum.elim v xs) (ts✝ i)) ↔ (rel R✝ ts✝).Realize v xs

Tactic:
rfl

Result:
no goals