Theorem: FirstOrder.Language.Substructure.coe_closure_eq_range_term_realize
File: Mathlib/ModelTheory/Substructures.lean

tactic: let S : L.Substructure M := ⟨range (Term.realize (L := L) ((↑) : s → M)), fun {n} f x hx => by
  simp only [mem_range] at *
  refine' ⟨func f fun i => Classical.choose (hx i), _⟩
  simp only [Term.realize, fun i => Classical.choose_spec (hx i)]⟩
state_before: L : Language
M : Type w
N : Type ?u.30865
P : Type ?u.30868
inst✝² : Structure L M
inst✝¹ : Structure L N
inst✝ : Structure L P
S : Substructure L M
s : Set M
⊢ ↑(LowerAdjoint.toFun (closure L) s) = range (Term.realize Subtype.val)

tactic: change _ = (S : Set M)
state_before: L : Language
M : Type w
N : Type ?u.30865
P : Type ?u.30868
inst✝² : Structure L M
inst✝¹ : Structure L N
inst✝ : Structure L P
S✝ : Substructure L M
s : Set M
S : Substructure L M :=
  { carrier := range (Term.realize Subtype.val),
    fun_mem :=
      (_ :
        ∀ {n : ℕ} (f : Functions L n) (x : Fin n → M),
          (∀ (i : Fin n), x i ∈ range (Term.realize Subtype.val)) → funMap f x ∈ range (Term.realize Subtype.val)) }
⊢ ↑(LowerAdjoint.toFun (closure L) s) = range (Term.realize Subtype.val)

tactic: rw [← SetLike.ext'_iff]
state_before: L : Language
M : Type w
N : Type ?u.30865
P : Type ?u.30868
inst✝² : Structure L M
inst✝¹ : Structure L N
inst✝ : Structure L P
S✝ : Substructure L M
s : Set M
S : Substructure L M :=
  { carrier := range (Term.realize Subtype.val),
    fun_mem :=
      (_ :
        ∀ {n : ℕ} (f : Functions L n) (x : Fin n → M),
          (∀ (i : Fin n), x i ∈ range (Term.realize Subtype.val)) → funMap f x ∈ range (Term.realize Subtype.val)) }
⊢ ↑(LowerAdjoint.toFun (closure L) s) = ↑S

tactic: refine' closure_eq_of_le (fun x hx => ⟨var ⟨x, hx⟩, rfl⟩) (le_sInf fun S' hS' => _)
state_before: L : Language
M : Type w
N : Type ?u.30865
P : Type ?u.30868
inst✝² : Structure L M
inst✝¹ : Structure L N
inst✝ : Structure L P
S✝ : Substructure L M
s : Set M
S : Substructure L M :=
  { carrier := range (Term.realize Subtype.val),
    fun_mem :=
      (_ :
        ∀ {n : ℕ} (f : Functions L n) (x : Fin n → M),
          (∀ (i : Fin n), x i ∈ range (Term.realize Subtype.val)) → funMap f x ∈ range (Term.realize Subtype.val)) }
⊢ LowerAdjoint.toFun (closure L) s = S

tactic: simp only [mem_range] at *
state_before: L : Language
M : Type w
N : Type ?u.30865
P : Type ?u.30868
inst✝² : Structure L M
inst✝¹ : Structure L N
inst✝ : Structure L P
S : Substructure L M
s : Set M
n : ℕ
f : Functions L n
x : Fin n → M
hx : ∀ (i : Fin n), x i ∈ range (Term.realize Subtype.val)
⊢ funMap f x ∈ range (Term.realize Subtype.val)

tactic: refine' ⟨func f fun i => Classical.choose (hx i), _⟩
state_before: L : Language
M : Type w
N : Type ?u.30865
P : Type ?u.30868
inst✝² : Structure L M
inst✝¹ : Structure L N
inst✝ : Structure L P
S : Substructure L M
s : Set M
n : ℕ
f : Functions L n
x : Fin n → M
hx : ∀ (i : Fin n), ∃ y, Term.realize Subtype.val y = x i
⊢ ∃ y, Term.realize Subtype.val y = funMap f x

tactic: simp only [Term.realize, fun i => Classical.choose_spec (hx i)]
state_before: L : Language
M : Type w
N : Type ?u.30865
P : Type ?u.30868
inst✝² : Structure L M
inst✝¹ : Structure L N
inst✝ : Structure L P
S : Substructure L M
s : Set M
n : ℕ
f : Functions L n
x : Fin n → M
hx : ∀ (i : Fin n), ∃ y, Term.realize Subtype.val y = x i
⊢ Term.realize Subtype.val (func f fun i => Classical.choose (_ : ∃ y, Term.realize Subtype.val y = x i)) = funMap f x

tactic: rintro _ ⟨t, rfl⟩
state_before: L : Language
M : Type w
N : Type ?u.30865
P : Type ?u.30868
inst✝² : Structure L M
inst✝¹ : Structure L N
inst✝ : Structure L P
S✝ : Substructure L M
s : Set M
S : Substructure L M :=
  { carrier := range (Term.realize Subtype.val),
    fun_mem :=
      (_ :
        ∀ {n : ℕ} (f : Functions L n) (x : Fin n → M),
          (∀ (i : Fin n), x i ∈ range (Term.realize Subtype.val)) → funMap f x ∈ range (Term.realize Subtype.val)) }
S' : Substructure L M
hS' : S' ∈ {S | s ⊆ ↑S}
⊢ S ≤ S'

tactic: exact t.realize_mem _ fun i => hS' i.2
state_before: case intro
L : Language
M : Type w
N : Type ?u.30865
P : Type ?u.30868
inst✝² : Structure L M
inst✝¹ : Structure L N
inst✝ : Structure L P
S✝ : Substructure L M
s : Set M
S : Substructure L M :=
  { carrier := range (Term.realize Subtype.val),
    fun_mem :=
      (_ :
        ∀ {n : ℕ} (f : Functions L n) (x : Fin n → M),
          (∀ (i : Fin n), x i ∈ range (Term.realize Subtype.val)) → funMap f x ∈ range (Term.realize Subtype.val)) }
S' : Substructure L M
hS' : S' ∈ {S | s ⊆ ↑S}
t : Term L { x // x ∈ s }
⊢ Term.realize Subtype.val t ∈ S'