Theorem: FirstOrder.Language.Ultraproduct.boundedFormula_realize_cast
File: Mathlib/ModelTheory/Ultraproducts.lean

tactic: letI := (u : Filter α).productSetoid M
state_before: α : Type u_2
M : α → Type u_3
u : Ultrafilter α
L : Language
inst✝¹ : (a : α) → Structure L (M a)
inst✝ : ∀ (a : α), Nonempty (M a)
β : Type u_1
n : ℕ
φ : BoundedFormula L β n
x : β → (a : α) → M a
v : Fin n → (a : α) → M a
⊢ (BoundedFormula.Realize φ (fun i => Quotient.mk' (x i)) fun i => Quotient.mk' (v i)) ↔
    ∀ᶠ (a : α) in ↑u, BoundedFormula.Realize φ (fun i => x i a) fun i => v i a

tactic: induction' φ with _ _ _ _ _ _ _ _ m _ _ ih ih' k φ ih
state_before: α : Type u_2
M : α → Type u_3
u : Ultrafilter α
L : Language
inst✝¹ : (a : α) → Structure L (M a)
inst✝ : ∀ (a : α), Nonempty (M a)
β : Type u_1
n : ℕ
φ : BoundedFormula L β n
x : β → (a : α) → M a
v : Fin n → (a : α) → M a
this : Setoid ((a : α) → M a) := productSetoid (↑u) M
⊢ (BoundedFormula.Realize φ (fun i => Quotient.mk' (x i)) fun i => Quotient.mk' (v i)) ↔
    ∀ᶠ (a : α) in ↑u, BoundedFormula.Realize φ (fun i => x i a) fun i => v i a

tactic: simp only [BoundedFormula.Realize, eventually_const]
state_before: case falsum
α : Type u_2
M : α → Type u_3
u : Ultrafilter α
L : Language
inst✝¹ : (a : α) → Structure L (M a)
inst✝ : ∀ (a : α), Nonempty (M a)
β : Type u_1
n : ℕ
x : β → (a : α) → M a
v✝ : Fin n → (a : α) → M a
this : Setoid ((a : α) → M a) := productSetoid (↑u) M
n✝ : ℕ
v : Fin n✝ → (a : α) → M a
⊢ (BoundedFormula.Realize BoundedFormula.falsum (fun i => Quotient.mk' (x i)) fun i => Quotient.mk' (v i)) ↔
    ∀ᶠ (a : α) in ↑u, BoundedFormula.Realize BoundedFormula.falsum (fun i => x i a) fun i => v i a

tactic: have h2 : ∀ a : α, (Sum.elim (fun i : β => x i a) fun i => v i a) = fun i => Sum.elim x v i a :=
  fun a => funext fun i => Sum.casesOn i (fun i => rfl) fun i => rfl
state_before: case equal
α : Type u_2
M : α → Type u_3
u : Ultrafilter α
L : Language
inst✝¹ : (a : α) → Structure L (M a)
inst✝ : ∀ (a : α), Nonempty (M a)
β : Type u_1
n : ℕ
x : β → (a : α) → M a
v✝ : Fin n → (a : α) → M a
this : Setoid ((a : α) → M a) := productSetoid (↑u) M
n✝ : ℕ
t₁✝ t₂✝ : Term L (β ⊕ Fin n✝)
v : Fin n✝ → (a : α) → M a
⊢ (BoundedFormula.Realize (BoundedFormula.equal t₁✝ t₂✝) (fun i => Quotient.mk' (x i)) fun i => Quotient.mk' (v i)) ↔
    ∀ᶠ (a : α) in ↑u, BoundedFormula.Realize (BoundedFormula.equal t₁✝ t₂✝) (fun i => x i a) fun i => v i a

tactic: simp only [BoundedFormula.Realize, h2, term_realize_cast]
state_before: case equal
α : Type u_2
M : α → Type u_3
u : Ultrafilter α
L : Language
inst✝¹ : (a : α) → Structure L (M a)
inst✝ : ∀ (a : α), Nonempty (M a)
β : Type u_1
n : ℕ
x : β → (a : α) → M a
v✝ : Fin n → (a : α) → M a
this : Setoid ((a : α) → M a) := productSetoid (↑u) M
n✝ : ℕ
t₁✝ t₂✝ : Term L (β ⊕ Fin n✝)
v : Fin n✝ → (a : α) → M a
h2 : ∀ (a : α), (Sum.elim (fun i => x i a) fun i => v i a) = fun i => Sum.elim x v i a
⊢ (BoundedFormula.Realize (BoundedFormula.equal t₁✝ t₂✝) (fun i => Quotient.mk' (x i)) fun i => Quotient.mk' (v i)) ↔
    ∀ᶠ (a : α) in ↑u, BoundedFormula.Realize (BoundedFormula.equal t₁✝ t₂✝) (fun i => x i a) fun i => v i a

tactic: erw [(Sum.comp_elim ((↑) : (∀ a, M a) → (u : Filter α).Product M) x v).symm,
  term_realize_cast, term_realize_cast]
state_before: case equal
α : Type u_2
M : α → Type u_3
u : Ultrafilter α
L : Language
inst✝¹ : (a : α) → Structure L (M a)
inst✝ : ∀ (a : α), Nonempty (M a)
β : Type u_1
n : ℕ
x : β → (a : α) → M a
v✝ : Fin n → (a : α) → M a
this : Setoid ((a : α) → M a) := productSetoid (↑u) M
n✝ : ℕ
t₁✝ t₂✝ : Term L (β ⊕ Fin n✝)
v : Fin n✝ → (a : α) → M a
h2 : ∀ (a : α), (Sum.elim (fun i => x i a) fun i => v i a) = fun i => Sum.elim x v i a
⊢ Term.realize (Sum.elim (fun i => Quotient.mk' (x i)) fun i => Quotient.mk' (v i)) t₁✝ =
      Term.realize (Sum.elim (fun i => Quotient.mk' (x i)) fun i => Quotient.mk' (v i)) t₂✝ ↔
    ∀ᶠ (a : α) in ↑u, Term.realize (fun i => Sum.elim x v i a) t₁✝ = Term.realize (fun i => Sum.elim x v i a) t₂✝

tactic: exact Quotient.eq''
state_before: case equal
α : Type u_2
M : α → Type u_3
u : Ultrafilter α
L : Language
inst✝¹ : (a : α) → Structure L (M a)
inst✝ : ∀ (a : α), Nonempty (M a)
β : Type u_1
n : ℕ
x : β → (a : α) → M a
v✝ : Fin n → (a : α) → M a
this : Setoid ((a : α) → M a) := productSetoid (↑u) M
n✝ : ℕ
t₁✝ t₂✝ : Term L (β ⊕ Fin n✝)
v : Fin n✝ → (a : α) → M a
h2 : ∀ (a : α), (Sum.elim (fun i => x i a) fun i => v i a) = fun i => Sum.elim x v i a
⊢ ((Quotient.mk' fun a => Term.realize (fun i => Sum.elim x v i a) t₁✝) =
      Quotient.mk' fun a => Term.realize (fun i => Sum.elim x v i a) t₂✝) ↔
    ∀ᶠ (a : α) in ↑u, Term.realize (fun i => Sum.elim x v i a) t₁✝ = Term.realize (fun i => Sum.elim x v i a) t₂✝

tactic: have h2 : ∀ a : α, (Sum.elim (fun i : β => x i a) fun i => v i a) = fun i => Sum.elim x v i a :=
  fun a => funext fun i => Sum.casesOn i (fun i => rfl) fun i => rfl
state_before: case rel
α : Type u_2
M : α → Type u_3
u : Ultrafilter α
L : Language
inst✝¹ : (a : α) → Structure L (M a)
inst✝ : ∀ (a : α), Nonempty (M a)
β : Type u_1
n : ℕ
x : β → (a : α) → M a
v✝ : Fin n → (a : α) → M a
this : Setoid ((a : α) → M a) := productSetoid (↑u) M
n✝ l✝ : ℕ
R✝ : Relations L l✝
ts✝ : Fin l✝ → Term L (β ⊕ Fin n✝)
v : Fin n✝ → (a : α) → M a
⊢ (BoundedFormula.Realize (BoundedFormula.rel R✝ ts✝) (fun i => Quotient.mk' (x i)) fun i => Quotient.mk' (v i)) ↔
    ∀ᶠ (a : α) in ↑u, BoundedFormula.Realize (BoundedFormula.rel R✝ ts✝) (fun i => x i a) fun i => v i a

tactic: simp only [BoundedFormula.Realize, h2]
state_before: case rel
α : Type u_2
M : α → Type u_3
u : Ultrafilter α
L : Language
inst✝¹ : (a : α) → Structure L (M a)
inst✝ : ∀ (a : α), Nonempty (M a)
β : Type u_1
n : ℕ
x : β → (a : α) → M a
v✝ : Fin n → (a : α) → M a
this : Setoid ((a : α) → M a) := productSetoid (↑u) M
n✝ l✝ : ℕ
R✝ : Relations L l✝
ts✝ : Fin l✝ → Term L (β ⊕ Fin n✝)
v : Fin n✝ → (a : α) → M a
h2 : ∀ (a : α), (Sum.elim (fun i => x i a) fun i => v i a) = fun i => Sum.elim x v i a
⊢ (BoundedFormula.Realize (BoundedFormula.rel R✝ ts✝) (fun i => Quotient.mk' (x i)) fun i => Quotient.mk' (v i)) ↔
    ∀ᶠ (a : α) in ↑u, BoundedFormula.Realize (BoundedFormula.rel R✝ ts✝) (fun i => x i a) fun i => v i a

tactic: erw [(Sum.comp_elim ((↑) : (∀ a, M a) → (u : Filter α).Product M) x v).symm]
state_before: case rel
α : Type u_2
M : α → Type u_3
u : Ultrafilter α
L : Language
inst✝¹ : (a : α) → Structure L (M a)
inst✝ : ∀ (a : α), Nonempty (M a)
β : Type u_1
n : ℕ
x : β → (a : α) → M a
v✝ : Fin n → (a : α) → M a
this : Setoid ((a : α) → M a) := productSetoid (↑u) M
n✝ l✝ : ℕ
R✝ : Relations L l✝
ts✝ : Fin l✝ → Term L (β ⊕ Fin n✝)
v : Fin n✝ → (a : α) → M a
h2 : ∀ (a : α), (Sum.elim (fun i => x i a) fun i => v i a) = fun i => Sum.elim x v i a
⊢ (RelMap R✝ fun i => Term.realize (Sum.elim (fun i => Quotient.mk' (x i)) fun i => Quotient.mk' (v i)) (ts✝ i)) ↔
    ∀ᶠ (a : α) in ↑u, RelMap R✝ fun i => Term.realize (fun i => Sum.elim x v i a) (ts✝ i)

tactic: conv_lhs => enter [2, i]; erw [term_realize_cast]
state_before: case rel
α : Type u_2
M : α → Type u_3
u : Ultrafilter α
L : Language
inst✝¹ : (a : α) → Structure L (M a)
inst✝ : ∀ (a : α), Nonempty (M a)
β : Type u_1
n : ℕ
x : β → (a : α) → M a
v✝ : Fin n → (a : α) → M a
this : Setoid ((a : α) → M a) := productSetoid (↑u) M
n✝ l✝ : ℕ
R✝ : Relations L l✝
ts✝ : Fin l✝ → Term L (β ⊕ Fin n✝)
v : Fin n✝ → (a : α) → M a
h2 : ∀ (a : α), (Sum.elim (fun i => x i a) fun i => v i a) = fun i => Sum.elim x v i a
⊢ (RelMap R✝ fun i => Term.realize (Quotient.mk' ∘ Sum.elim x v) (ts✝ i)) ↔
    ∀ᶠ (a : α) in ↑u, RelMap R✝ fun i => Term.realize (fun i => Sum.elim x v i a) (ts✝ i)

tactic: apply relMap_quotient_mk'
state_before: case rel
α : Type u_2
M : α → Type u_3
u : Ultrafilter α
L : Language
inst✝¹ : (a : α) → Structure L (M a)
inst✝ : ∀ (a : α), Nonempty (M a)
β : Type u_1
n : ℕ
x : β → (a : α) → M a
v✝ : Fin n → (a : α) → M a
this : Setoid ((a : α) → M a) := productSetoid (↑u) M
n✝ l✝ : ℕ
R✝ : Relations L l✝
ts✝ : Fin l✝ → Term L (β ⊕ Fin n✝)
v : Fin n✝ → (a : α) → M a
h2 : ∀ (a : α), (Sum.elim (fun i => x i a) fun i => v i a) = fun i => Sum.elim x v i a
⊢ (RelMap R✝ fun i => Quotient.mk' fun a => Term.realize (fun i => Sum.elim x v i a) (ts✝ i)) ↔
    ∀ᶠ (a : α) in ↑u, RelMap R✝ fun i => Term.realize (fun i => Sum.elim x v i a) (ts✝ i)

tactic: simp only [BoundedFormula.Realize, ih v, ih' v]
state_before: case imp
α : Type u_2
M : α → Type u_3
u : Ultrafilter α
L : Language
inst✝¹ : (a : α) → Structure L (M a)
inst✝ : ∀ (a : α), Nonempty (M a)
β : Type u_1
n : ℕ
x : β → (a : α) → M a
v✝ : Fin n → (a : α) → M a
this : Setoid ((a : α) → M a) := productSetoid (↑u) M
m : ℕ
f₁✝ f₂✝ : BoundedFormula L β m
ih :
  ∀ (v : Fin m → (a : α) → M a),
    (BoundedFormula.Realize f₁✝ (fun i => Quotient.mk' (x i)) fun i => Quotient.mk' (v i)) ↔
      ∀ᶠ (a : α) in ↑u, BoundedFormula.Realize f₁✝ (fun i => x i a) fun i => v i a
ih' :
  ∀ (v : Fin m → (a : α) → M a),
    (BoundedFormula.Realize f₂✝ (fun i => Quotient.mk' (x i)) fun i => Quotient.mk' (v i)) ↔
      ∀ᶠ (a : α) in ↑u, BoundedFormula.Realize f₂✝ (fun i => x i a) fun i => v i a
v : Fin m → (a : α) → M a
⊢ (BoundedFormula.Realize (f₁✝ ⟹ f₂✝) (fun i => Quotient.mk' (x i)) fun i => Quotient.mk' (v i)) ↔
    ∀ᶠ (a : α) in ↑u, BoundedFormula.Realize (f₁✝ ⟹ f₂✝) (fun i => x i a) fun i => v i a

tactic: rw [Ultrafilter.eventually_imp]
state_before: case imp
α : Type u_2
M : α → Type u_3
u : Ultrafilter α
L : Language
inst✝¹ : (a : α) → Structure L (M a)
inst✝ : ∀ (a : α), Nonempty (M a)
β : Type u_1
n : ℕ
x : β → (a : α) → M a
v✝ : Fin n → (a : α) → M a
this : Setoid ((a : α) → M a) := productSetoid (↑u) M
m : ℕ
f₁✝ f₂✝ : BoundedFormula L β m
ih :
  ∀ (v : Fin m → (a : α) → M a),
    (BoundedFormula.Realize f₁✝ (fun i => Quotient.mk' (x i)) fun i => Quotient.mk' (v i)) ↔
      ∀ᶠ (a : α) in ↑u, BoundedFormula.Realize f₁✝ (fun i => x i a) fun i => v i a
ih' :
  ∀ (v : Fin m → (a : α) → M a),
    (BoundedFormula.Realize f₂✝ (fun i => Quotient.mk' (x i)) fun i => Quotient.mk' (v i)) ↔
      ∀ᶠ (a : α) in ↑u, BoundedFormula.Realize f₂✝ (fun i => x i a) fun i => v i a
v : Fin m → (a : α) → M a
⊢ ((∀ᶠ (a : α) in ↑u, BoundedFormula.Realize f₁✝ (fun i => x i a) fun i => v i a) →
      ∀ᶠ (a : α) in ↑u, BoundedFormula.Realize f₂✝ (fun i => x i a) fun i => v i a) ↔
    ∀ᶠ (a : α) in ↑u,
      (BoundedFormula.Realize f₁✝ (fun i => x i a) fun i => v i a) →
        BoundedFormula.Realize f₂✝ (fun i => x i a) fun i => v i a

tactic: simp only [BoundedFormula.Realize]
state_before: case all
α : Type u_2
M : α → Type u_3
u : Ultrafilter α
L : Language
inst✝¹ : (a : α) → Structure L (M a)
inst✝ : ∀ (a : α), Nonempty (M a)
β : Type u_1
n : ℕ
x : β → (a : α) → M a
v✝ : Fin n → (a : α) → M a
this : Setoid ((a : α) → M a) := productSetoid (↑u) M
k : ℕ
φ : BoundedFormula L β (k + 1)
ih :
  ∀ (v : Fin (k + 1) → (a : α) → M a),
    (BoundedFormula.Realize φ (fun i => Quotient.mk' (x i)) fun i => Quotient.mk' (v i)) ↔
      ∀ᶠ (a : α) in ↑u, BoundedFormula.Realize φ (fun i => x i a) fun i => v i a
v : Fin k → (a : α) → M a
⊢ (BoundedFormula.Realize (∀'φ) (fun i => Quotient.mk' (x i)) fun i => Quotient.mk' (v i)) ↔
    ∀ᶠ (a : α) in ↑u, BoundedFormula.Realize (∀'φ) (fun i => x i a) fun i => v i a

tactic: apply Iff.trans (b := ∀ m : ∀ a : α, M a,
  φ.Realize (fun i : β => (x i : (u : Filter α).Product M))
    (Fin.snoc (((↑) : (∀ a, M a) → (u : Filter α).Product M) ∘ v)
      (m : (u : Filter α).Product M)))
state_before: case all
α : Type u_2
M : α → Type u_3
u : Ultrafilter α
L : Language
inst✝¹ : (a : α) → Structure L (M a)
inst✝ : ∀ (a : α), Nonempty (M a)
β : Type u_1
n : ℕ
x : β → (a : α) → M a
v✝ : Fin n → (a : α) → M a
this : Setoid ((a : α) → M a) := productSetoid (↑u) M
k : ℕ
φ : BoundedFormula L β (k + 1)
ih :
  ∀ (v : Fin (k + 1) → (a : α) → M a),
    (BoundedFormula.Realize φ (fun i => Quotient.mk' (x i)) fun i => Quotient.mk' (v i)) ↔
      ∀ᶠ (a : α) in ↑u, BoundedFormula.Realize φ (fun i => x i a) fun i => v i a
v : Fin k → (a : α) → M a
⊢ (∀ (x_1 : Quotient (productSetoid ↑u fun a => M a)),
      BoundedFormula.Realize φ (fun i => Quotient.mk' (x i)) (Fin.snoc (fun i => Quotient.mk' (v i)) x_1)) ↔
    ∀ᶠ (a : α) in ↑u, ∀ (x_1 : M a), BoundedFormula.Realize φ (fun i => x i a) (Fin.snoc (fun i => v i a) x_1)

tactic: simp only [← Fin.comp_snoc]
state_before: case all.h₂
α : Type u_2
M : α → Type u_3
u : Ultrafilter α
L : Language
inst✝¹ : (a : α) → Structure L (M a)
inst✝ : ∀ (a : α), Nonempty (M a)
β : Type u_1
n : ℕ
x : β → (a : α) → M a
v✝ : Fin n → (a : α) → M a
this : Setoid ((a : α) → M a) := productSetoid (↑u) M
k : ℕ
φ : BoundedFormula L β (k + 1)
ih :
  ∀ (v : Fin (k + 1) → (a : α) → M a),
    (BoundedFormula.Realize φ (fun i => Quotient.mk' (x i)) fun i => Quotient.mk' (v i)) ↔
      ∀ᶠ (a : α) in ↑u, BoundedFormula.Realize φ (fun i => x i a) fun i => v i a
v : Fin k → (a : α) → M a
h' : ∀ (m : (a : α) → M a) (a : α), (fun i => Fin.snoc v m i a) = Fin.snoc (fun i => v i a) (m a)
⊢ (∀ (m : (a : α) → M a),
      BoundedFormula.Realize φ (fun i => Quotient.mk' (x i)) (Fin.snoc (Quotient.mk' ∘ v) (Quotient.mk' m))) ↔
    ∀ᶠ (a : α) in ↑u, ∀ (x_1 : M a), BoundedFormula.Realize φ (fun i => x i a) (Fin.snoc (fun i => v i a) x_1)

tactic: simp only [Function.comp, ih, h']
state_before: case all.h₂
α : Type u_2
M : α → Type u_3
u : Ultrafilter α
L : Language
inst✝¹ : (a : α) → Structure L (M a)
inst✝ : ∀ (a : α), Nonempty (M a)
β : Type u_1
n : ℕ
x : β → (a : α) → M a
v✝ : Fin n → (a : α) → M a
this : Setoid ((a : α) → M a) := productSetoid (↑u) M
k : ℕ
φ : BoundedFormula L β (k + 1)
ih :
  ∀ (v : Fin (k + 1) → (a : α) → M a),
    (BoundedFormula.Realize φ (fun i => Quotient.mk' (x i)) fun i => Quotient.mk' (v i)) ↔
      ∀ᶠ (a : α) in ↑u, BoundedFormula.Realize φ (fun i => x i a) fun i => v i a
v : Fin k → (a : α) → M a
h' : ∀ (m : (a : α) → M a) (a : α), (fun i => Fin.snoc v m i a) = Fin.snoc (fun i => v i a) (m a)
⊢ (∀ (m : (a : α) → M a), BoundedFormula.Realize φ (fun i => Quotient.mk' (x i)) (Quotient.mk' ∘ Fin.snoc v m)) ↔
    ∀ᶠ (a : α) in ↑u, ∀ (x_1 : M a), BoundedFormula.Realize φ (fun i => x i a) (Fin.snoc (fun i => v i a) x_1)

tactic: refine' ⟨fun h => _, fun h m => _⟩
state_before: case all.h₂
α : Type u_2
M : α → Type u_3
u : Ultrafilter α
L : Language
inst✝¹ : (a : α) → Structure L (M a)
inst✝ : ∀ (a : α), Nonempty (M a)
β : Type u_1
n : ℕ
x : β → (a : α) → M a
v✝ : Fin n → (a : α) → M a
this : Setoid ((a : α) → M a) := productSetoid (↑u) M
k : ℕ
φ : BoundedFormula L β (k + 1)
ih :
  ∀ (v : Fin (k + 1) → (a : α) → M a),
    (BoundedFormula.Realize φ (fun i => Quotient.mk' (x i)) fun i => Quotient.mk' (v i)) ↔
      ∀ᶠ (a : α) in ↑u, BoundedFormula.Realize φ (fun i => x i a) fun i => v i a
v : Fin k → (a : α) → M a
h' : ∀ (m : (a : α) → M a) (a : α), (fun i => Fin.snoc v m i a) = Fin.snoc (fun i => v i a) (m a)
⊢ (∀ (m : (a : α) → M a),
      ∀ᶠ (a : α) in ↑u, BoundedFormula.Realize φ (fun i => x i a) (Fin.snoc (fun i => v i a) (m a))) ↔
    ∀ᶠ (a : α) in ↑u, ∀ (x_1 : M a), BoundedFormula.Realize φ (fun i => x i a) (Fin.snoc (fun i => v i a) x_1)

tactic: exact forall_quotient_iff
state_before: case all.h₁
α : Type u_2
M : α → Type u_3
u : Ultrafilter α
L : Language
inst✝¹ : (a : α) → Structure L (M a)
inst✝ : ∀ (a : α), Nonempty (M a)
β : Type u_1
n : ℕ
x : β → (a : α) → M a
v✝ : Fin n → (a : α) → M a
this : Setoid ((a : α) → M a) := productSetoid (↑u) M
k : ℕ
φ : BoundedFormula L β (k + 1)
ih :
  ∀ (v : Fin (k + 1) → (a : α) → M a),
    (BoundedFormula.Realize φ (fun i => Quotient.mk' (x i)) fun i => Quotient.mk' (v i)) ↔
      ∀ᶠ (a : α) in ↑u, BoundedFormula.Realize φ (fun i => x i a) fun i => v i a
v : Fin k → (a : α) → M a
⊢ (∀ (x_1 : Quotient (productSetoid ↑u fun a => M a)),
      BoundedFormula.Realize φ (fun i => Quotient.mk' (x i)) (Fin.snoc (fun i => Quotient.mk' (v i)) x_1)) ↔
    ∀ (m : (a : α) → M a),
      BoundedFormula.Realize φ (fun i => Quotient.mk' (x i)) (Fin.snoc (Quotient.mk' ∘ v) (Quotient.mk' m))

tactic: refine' fun m a => funext (Fin.reverseInduction _ fun i _ => _)
state_before: α : Type u_2
M : α → Type u_3
u : Ultrafilter α
L : Language
inst✝¹ : (a : α) → Structure L (M a)
inst✝ : ∀ (a : α), Nonempty (M a)
β : Type u_1
n : ℕ
x : β → (a : α) → M a
v✝ : Fin n → (a : α) → M a
this : Setoid ((a : α) → M a) := productSetoid (↑u) M
k : ℕ
φ : BoundedFormula L β (k + 1)
ih :
  ∀ (v : Fin (k + 1) → (a : α) → M a),
    (BoundedFormula.Realize φ (fun i => Quotient.mk' (x i)) fun i => Quotient.mk' (v i)) ↔
      ∀ᶠ (a : α) in ↑u, BoundedFormula.Realize φ (fun i => x i a) fun i => v i a
v : Fin k → (a : α) → M a
⊢ ∀ (m : (a : α) → M a) (a : α), (fun i => Fin.snoc v m i a) = Fin.snoc (fun i => v i a) (m a)

tactic: simp only [Fin.snoc_last]
state_before: case refine'_1
α : Type u_2
M : α → Type u_3
u : Ultrafilter α
L : Language
inst✝¹ : (a : α) → Structure L (M a)
inst✝ : ∀ (a : α), Nonempty (M a)
β : Type u_1
n : ℕ
x : β → (a : α) → M a
v✝ : Fin n → (a : α) → M a
this : Setoid ((a : α) → M a) := productSetoid (↑u) M
k : ℕ
φ : BoundedFormula L β (k + 1)
ih :
  ∀ (v : Fin (k + 1) → (a : α) → M a),
    (BoundedFormula.Realize φ (fun i => Quotient.mk' (x i)) fun i => Quotient.mk' (v i)) ↔
      ∀ᶠ (a : α) in ↑u, BoundedFormula.Realize φ (fun i => x i a) fun i => v i a
v : Fin k → (a : α) → M a
m : (a : α) → M a
a : α
⊢ Fin.snoc v m (Fin.last k) a = Fin.snoc (fun i => v i a) (m a) (Fin.last k)

tactic: simp only [Fin.snoc_castSucc]
state_before: case refine'_2
α : Type u_2
M : α → Type u_3
u : Ultrafilter α
L : Language
inst✝¹ : (a : α) → Structure L (M a)
inst✝ : ∀ (a : α), Nonempty (M a)
β : Type u_1
n : ℕ
x : β → (a : α) → M a
v✝ : Fin n → (a : α) → M a
this : Setoid ((a : α) → M a) := productSetoid (↑u) M
k : ℕ
φ : BoundedFormula L β (k + 1)
ih :
  ∀ (v : Fin (k + 1) → (a : α) → M a),
    (BoundedFormula.Realize φ (fun i => Quotient.mk' (x i)) fun i => Quotient.mk' (v i)) ↔
      ∀ᶠ (a : α) in ↑u, BoundedFormula.Realize φ (fun i => x i a) fun i => v i a
v : Fin k → (a : α) → M a
m : (a : α) → M a
a : α
i : Fin k
x✝ : Fin.snoc v m (Fin.succ i) a = Fin.snoc (fun i => v i a) (m a) (Fin.succ i)
⊢ Fin.snoc v m (↑Fin.castSucc i) a = Fin.snoc (fun i => v i a) (m a) (↑Fin.castSucc i)

tactic: contrapose! h
state_before: case all.h₂.refine'_1
α : Type u_2
M : α → Type u_3
u : Ultrafilter α
L : Language
inst✝¹ : (a : α) → Structure L (M a)
inst✝ : ∀ (a : α), Nonempty (M a)
β : Type u_1
n : ℕ
x : β → (a : α) → M a
v✝ : Fin n → (a : α) → M a
this : Setoid ((a : α) → M a) := productSetoid (↑u) M
k : ℕ
φ : BoundedFormula L β (k + 1)
ih :
  ∀ (v : Fin (k + 1) → (a : α) → M a),
    (BoundedFormula.Realize φ (fun i => Quotient.mk' (x i)) fun i => Quotient.mk' (v i)) ↔
      ∀ᶠ (a : α) in ↑u, BoundedFormula.Realize φ (fun i => x i a) fun i => v i a
v : Fin k → (a : α) → M a
h' : ∀ (m : (a : α) → M a) (a : α), (fun i => Fin.snoc v m i a) = Fin.snoc (fun i => v i a) (m a)
h : ∀ (m : (a : α) → M a), ∀ᶠ (a : α) in ↑u, BoundedFormula.Realize φ (fun i => x i a) (Fin.snoc (fun i => v i a) (m a))
⊢ ∀ᶠ (a : α) in ↑u, ∀ (x_1 : M a), BoundedFormula.Realize φ (fun i => x i a) (Fin.snoc (fun i => v i a) x_1)

tactic: simp_rw [← Ultrafilter.eventually_not, not_forall] at h
state_before: case all.h₂.refine'_1
α : Type u_2
M : α → Type u_3
u : Ultrafilter α
L : Language
inst✝¹ : (a : α) → Structure L (M a)
inst✝ : ∀ (a : α), Nonempty (M a)
β : Type u_1
n : ℕ
x : β → (a : α) → M a
v✝ : Fin n → (a : α) → M a
this : Setoid ((a : α) → M a) := productSetoid (↑u) M
k : ℕ
φ : BoundedFormula L β (k + 1)
ih :
  ∀ (v : Fin (k + 1) → (a : α) → M a),
    (BoundedFormula.Realize φ (fun i => Quotient.mk' (x i)) fun i => Quotient.mk' (v i)) ↔
      ∀ᶠ (a : α) in ↑u, BoundedFormula.Realize φ (fun i => x i a) fun i => v i a
v : Fin k → (a : α) → M a
h' : ∀ (m : (a : α) → M a) (a : α), (fun i => Fin.snoc v m i a) = Fin.snoc (fun i => v i a) (m a)
h : ¬∀ᶠ (a : α) in ↑u, ∀ (x_1 : M a), BoundedFormula.Realize φ (fun i => x i a) (Fin.snoc (fun i => v i a) x_1)
⊢ ∃ m, ¬∀ᶠ (a : α) in ↑u, BoundedFormula.Realize φ (fun i => x i a) (Fin.snoc (fun i => v i a) (m a))

tactic: refine'
  ⟨fun a : α =>
    Classical.epsilon fun m : M a =>
      ¬φ.Realize (fun i => x i a) (Fin.snoc (fun i => v i a) m),
    _⟩
state_before: case all.h₂.refine'_1
α : Type u_2
M : α → Type u_3
u : Ultrafilter α
L : Language
inst✝¹ : (a : α) → Structure L (M a)
inst✝ : ∀ (a : α), Nonempty (M a)
β : Type u_1
n : ℕ
x : β → (a : α) → M a
v✝ : Fin n → (a : α) → M a
this : Setoid ((a : α) → M a) := productSetoid (↑u) M
k : ℕ
φ : BoundedFormula L β (k + 1)
ih :
  ∀ (v : Fin (k + 1) → (a : α) → M a),
    (BoundedFormula.Realize φ (fun i => Quotient.mk' (x i)) fun i => Quotient.mk' (v i)) ↔
      ∀ᶠ (a : α) in ↑u, BoundedFormula.Realize φ (fun i => x i a) fun i => v i a
v : Fin k → (a : α) → M a
h' : ∀ (m : (a : α) → M a) (a : α), (fun i => Fin.snoc v m i a) = Fin.snoc (fun i => v i a) (m a)
h : ∀ᶠ (x_1 : α) in ↑u, ∃ x_2, ¬BoundedFormula.Realize φ (fun i => x i x_1) (Fin.snoc (fun i => v i x_1) x_2)
⊢ ∃ m, ¬∀ᶠ (a : α) in ↑u, BoundedFormula.Realize φ (fun i => x i a) (Fin.snoc (fun i => v i a) (m a))

tactic: rw [← Ultrafilter.eventually_not]
state_before: case all.h₂.refine'_1
α : Type u_2
M : α → Type u_3
u : Ultrafilter α
L : Language
inst✝¹ : (a : α) → Structure L (M a)
inst✝ : ∀ (a : α), Nonempty (M a)
β : Type u_1
n : ℕ
x : β → (a : α) → M a
v✝ : Fin n → (a : α) → M a
this : Setoid ((a : α) → M a) := productSetoid (↑u) M
k : ℕ
φ : BoundedFormula L β (k + 1)
ih :
  ∀ (v : Fin (k + 1) → (a : α) → M a),
    (BoundedFormula.Realize φ (fun i => Quotient.mk' (x i)) fun i => Quotient.mk' (v i)) ↔
      ∀ᶠ (a : α) in ↑u, BoundedFormula.Realize φ (fun i => x i a) fun i => v i a
v : Fin k → (a : α) → M a
h' : ∀ (m : (a : α) → M a) (a : α), (fun i => Fin.snoc v m i a) = Fin.snoc (fun i => v i a) (m a)
h : ∀ᶠ (x_1 : α) in ↑u, ∃ x_2, ¬BoundedFormula.Realize φ (fun i => x i x_1) (Fin.snoc (fun i => v i x_1) x_2)
⊢ ¬∀ᶠ (a : α) in ↑u,
      BoundedFormula.Realize φ (fun i => x i a)
        (Fin.snoc (fun i => v i a)
          ((fun a =>
              Classical.epsilon fun m => ¬BoundedFormula.Realize φ (fun i => x i a) (Fin.snoc (fun i => v i a) m))
            a))

tactic: exact Filter.mem_of_superset h fun a ha => Classical.epsilon_spec ha
state_before: case all.h₂.refine'_1
α : Type u_2
M : α → Type u_3
u : Ultrafilter α
L : Language
inst✝¹ : (a : α) → Structure L (M a)
inst✝ : ∀ (a : α), Nonempty (M a)
β : Type u_1
n : ℕ
x : β → (a : α) → M a
v✝ : Fin n → (a : α) → M a
this : Setoid ((a : α) → M a) := productSetoid (↑u) M
k : ℕ
φ : BoundedFormula L β (k + 1)
ih :
  ∀ (v : Fin (k + 1) → (a : α) → M a),
    (BoundedFormula.Realize φ (fun i => Quotient.mk' (x i)) fun i => Quotient.mk' (v i)) ↔
      ∀ᶠ (a : α) in ↑u, BoundedFormula.Realize φ (fun i => x i a) fun i => v i a
v : Fin k → (a : α) → M a
h' : ∀ (m : (a : α) → M a) (a : α), (fun i => Fin.snoc v m i a) = Fin.snoc (fun i => v i a) (m a)
h : ∀ᶠ (x_1 : α) in ↑u, ∃ x_2, ¬BoundedFormula.Realize φ (fun i => x i x_1) (Fin.snoc (fun i => v i x_1) x_2)
⊢ ∀ᶠ (x_1 : α) in ↑u,
    ¬BoundedFormula.Realize φ (fun i => x i x_1)
        (Fin.snoc (fun i => v i x_1)
          ((fun a =>
              Classical.epsilon fun m => ¬BoundedFormula.Realize φ (fun i => x i a) (Fin.snoc (fun i => v i a) m))
            x_1))

tactic: rw [Filter.eventually_iff] at *
state_before: case all.h₂.refine'_2
α : Type u_2
M : α → Type u_3
u : Ultrafilter α
L : Language
inst✝¹ : (a : α) → Structure L (M a)
inst✝ : ∀ (a : α), Nonempty (M a)
β : Type u_1
n : ℕ
x : β → (a : α) → M a
v✝ : Fin n → (a : α) → M a
this : Setoid ((a : α) → M a) := productSetoid (↑u) M
k : ℕ
φ : BoundedFormula L β (k + 1)
ih :
  ∀ (v : Fin (k + 1) → (a : α) → M a),
    (BoundedFormula.Realize φ (fun i => Quotient.mk' (x i)) fun i => Quotient.mk' (v i)) ↔
      ∀ᶠ (a : α) in ↑u, BoundedFormula.Realize φ (fun i => x i a) fun i => v i a
v : Fin k → (a : α) → M a
h' : ∀ (m : (a : α) → M a) (a : α), (fun i => Fin.snoc v m i a) = Fin.snoc (fun i => v i a) (m a)
h : ∀ᶠ (a : α) in ↑u, ∀ (x_1 : M a), BoundedFormula.Realize φ (fun i => x i a) (Fin.snoc (fun i => v i a) x_1)
m : (a : α) → M a
⊢ ∀ᶠ (a : α) in ↑u, BoundedFormula.Realize φ (fun i => x i a) (Fin.snoc (fun i => v i a) (m a))

tactic: exact Filter.mem_of_superset h fun a ha => ha (m a)
state_before: case all.h₂.refine'_2
α : Type u_2
M : α → Type u_3
u : Ultrafilter α
L : Language
inst✝¹ : (a : α) → Structure L (M a)
inst✝ : ∀ (a : α), Nonempty (M a)
β : Type u_1
n : ℕ
x : β → (a : α) → M a
v✝ : Fin n → (a : α) → M a
this : Setoid ((a : α) → M a) := productSetoid (↑u) M
k : ℕ
φ : BoundedFormula L β (k + 1)
ih :
  ∀ (v : Fin (k + 1) → (a : α) → M a),
    (BoundedFormula.Realize φ (fun i => Quotient.mk' (x i)) fun i => Quotient.mk' (v i)) ↔
      ∀ᶠ (a : α) in ↑u, BoundedFormula.Realize φ (fun i => x i a) fun i => v i a
v : Fin k → (a : α) → M a
h' : ∀ (m : (a : α) → M a) (a : α), (fun i => Fin.snoc v m i a) = Fin.snoc (fun i => v i a) (m a)
h : {x_1 | ∀ (x_2 : M x_1), BoundedFormula.Realize φ (fun i => x i x_1) (Fin.snoc (fun i => v i x_1) x_2)} ∈ ↑u
m : (a : α) → M a
⊢ {x_1 | BoundedFormula.Realize φ (fun i => x i x_1) (Fin.snoc (fun i => v i x_1) (m x_1))} ∈ ↑u