Theorem: Set.Definable.image_comp_sum_inl_fin
File: Mathlib/ModelTheory/Definability.lean

tactic: obtain ⟨φ, rfl⟩ := h
state_before: M : Type w
A : Set M
L : Language
inst✝ : Structure L M
α : Type u₁
β : Type ?u.18147
B : Set M
s✝ : Set (α → M)
m : ℕ
s : Set (α ⊕ Fin m → M)
h : Definable A L s
⊢ Definable A L ((fun g => g ∘ Sum.inl) '' s)

tactic: refine' ⟨(BoundedFormula.relabel id φ).exs, _⟩
state_before: case intro
M : Type w
A : Set M
L : Language
inst✝ : Structure L M
α : Type u₁
β : Type ?u.18147
B : Set M
s : Set (α → M)
m : ℕ
φ : Formula (L[[↑A]]) (α ⊕ Fin m)
⊢ Definable A L ((fun g => g ∘ Sum.inl) '' setOf (Formula.Realize φ))

tactic: ext x
state_before: case intro
M : Type w
A : Set M
L : Language
inst✝ : Structure L M
α : Type u₁
β : Type ?u.18147
B : Set M
s : Set (α → M)
m : ℕ
φ : Formula (L[[↑A]]) (α ⊕ Fin m)
⊢ (fun g => g ∘ Sum.inl) '' setOf (Formula.Realize φ) =
    setOf (Formula.Realize (BoundedFormula.exs (BoundedFormula.relabel id φ)))

tactic: simp only [Set.mem_image, mem_setOf_eq, BoundedFormula.realize_exs,
  BoundedFormula.realize_relabel, Function.comp.right_id, Fin.castAdd_zero, Fin.cast_refl]
state_before: case intro.h
M : Type w
A : Set M
L : Language
inst✝ : Structure L M
α : Type u₁
β : Type ?u.18147
B : Set M
s : Set (α → M)
m : ℕ
φ : Formula (L[[↑A]]) (α ⊕ Fin m)
x : α → M
⊢ x ∈ (fun g => g ∘ Sum.inl) '' setOf (Formula.Realize φ) ↔
    x ∈ setOf (Formula.Realize (BoundedFormula.exs (BoundedFormula.relabel id φ)))

tactic: constructor
state_before: case intro.h
M : Type w
A : Set M
L : Language
inst✝ : Structure L M
α : Type u₁
β : Type ?u.18147
B : Set M
s : Set (α → M)
m : ℕ
φ : Formula (L[[↑A]]) (α ⊕ Fin m)
x : α → M
⊢ (∃ x_1, Formula.Realize φ x_1 ∧ x_1 ∘ Sum.inl = x) ↔
    ∃ xs, BoundedFormula.Realize φ (Sum.elim x (xs ∘ ↑(OrderIso.refl (Fin m)))) (xs ∘ ↑(Fin.natAdd m))

tactic: rintro ⟨y, hy, rfl⟩
state_before: case intro.h.mp
M : Type w
A : Set M
L : Language
inst✝ : Structure L M
α : Type u₁
β : Type ?u.18147
B : Set M
s : Set (α → M)
m : ℕ
φ : Formula (L[[↑A]]) (α ⊕ Fin m)
x : α → M
⊢ (∃ x_1, Formula.Realize φ x_1 ∧ x_1 ∘ Sum.inl = x) →
    ∃ xs, BoundedFormula.Realize φ (Sum.elim x (xs ∘ ↑(OrderIso.refl (Fin m)))) (xs ∘ ↑(Fin.natAdd m))

tactic: exact
  ⟨y ∘ Sum.inr, (congr (congr rfl (Sum.elim_comp_inl_inr y).symm) (funext finZeroElim)).mp hy⟩
state_before: case intro.h.mp.intro.intro
M : Type w
A : Set M
L : Language
inst✝ : Structure L M
α : Type u₁
β : Type ?u.18147
B : Set M
s : Set (α → M)
m : ℕ
φ : Formula (L[[↑A]]) (α ⊕ Fin m)
y : α ⊕ Fin m → M
hy : Formula.Realize φ y
⊢ ∃ xs, BoundedFormula.Realize φ (Sum.elim (y ∘ Sum.inl) (xs ∘ ↑(OrderIso.refl (Fin m)))) (xs ∘ ↑(Fin.natAdd m))

tactic: rintro ⟨y, hy⟩
state_before: case intro.h.mpr
M : Type w
A : Set M
L : Language
inst✝ : Structure L M
α : Type u₁
β : Type ?u.18147
B : Set M
s : Set (α → M)
m : ℕ
φ : Formula (L[[↑A]]) (α ⊕ Fin m)
x : α → M
⊢ (∃ xs, BoundedFormula.Realize φ (Sum.elim x (xs ∘ ↑(OrderIso.refl (Fin m)))) (xs ∘ ↑(Fin.natAdd m))) →
    ∃ x_1, Formula.Realize φ x_1 ∧ x_1 ∘ Sum.inl = x

tactic: exact ⟨Sum.elim x y, (congr rfl (funext finZeroElim)).mp hy, Sum.elim_comp_inl _ _⟩
state_before: case intro.h.mpr.intro
M : Type w
A : Set M
L : Language
inst✝ : Structure L M
α : Type u₁
β : Type ?u.18147
B : Set M
s : Set (α → M)
m : ℕ
φ : Formula (L[[↑A]]) (α ⊕ Fin m)
x : α → M
y : Fin (m + 0) → M
hy : BoundedFormula.Realize φ (Sum.elim x (y ∘ ↑(OrderIso.refl (Fin m)))) (y ∘ ↑(Fin.natAdd m))
⊢ ∃ x_1, Formula.Realize φ x_1 ∧ x_1 ∘ Sum.inl = x