l3lab/ntp-mathlib huggingface dataset:
theorem Definable.map_expansion {L' : FirstOrder.Language} [L'.Structure M] (h : A.Definable L s)
    (φ : L →ᴸ L') [φ.IsExpansionOn M] : A.Definable L' s := by
  obtain ⟨ψ, rfl⟩ := h
  refine' ⟨(φ.addConstants A).onFormula ψ, _⟩
  ext x
  

Proof state:
case intro.h
M : Type w
A : Set M
L : Language
inst✝² : Structure L M
α : Type u₁
β : Type u_1
B : Set M
L' : Language
inst✝¹ : Structure L' M
φ : L →ᴸ L'
inst✝ : LHom.IsExpansionOn φ M
ψ : Formula (L[[↑A]]) α
x : α → M
⊢ x ∈ setOf (Formula.Realize ψ) ↔ x ∈ setOf (Formula.Realize (LHom.onFormula (LHom.addConstants (↑A) φ) ψ))

Next tactic:
simp only [mem_setOf_eq, LHom.realize_onFormula]
theorem definable_iff_exists_formula_sum :
    A.Definable L s ↔ ∃ φ : L.Formula (A ⊕ α), s = {v | φ.Realize (Sum.elim (↑) v)} := by
  

Proof state:
M : Type w
A : Set M
L : Language
inst✝ : Structure L M
α : Type u₁
β : Type u_1
B : Set M
s : Set (α → M)
⊢ Definable A L s ↔ ∃ φ, s = {v | Formula.Realize φ (Sum.elim Subtype.val v)}

Next tactic:
rw [Definable, Equiv.exists_congr_left (BoundedFormula.constantsVarsEquiv)]
theorem definable_iff_exists_formula_sum :
    A.Definable L s ↔ ∃ φ : L.Formula (A ⊕ α), s = {v | φ.Realize (Sum.elim (↑) v)} := by
  rw [Definable, Equiv.exists_congr_left (BoundedFormula.constantsVarsEquiv)]
  

Proof state:
M : Type w
A : Set M
L : Language
inst✝ : Structure L M
α : Type u₁
β : Type u_1
B : Set M
s : Set (α → M)
⊢ (∃ b, s = setOf (Formula.Realize (BoundedFormula.constantsVarsEquiv.symm b))) ↔
    ∃ φ, s = {v | Formula.Realize φ (Sum.elim Subtype.val v)}

Next tactic:
refine exists_congr (fun φ => iff_iff_eq.2 (congr_arg (s = .) ?_))
theorem definable_iff_exists_formula_sum :
    A.Definable L s ↔ ∃ φ : L.Formula (A ⊕ α), s = {v | φ.Realize (Sum.elim (↑) v)} := by
  rw [Definable, Equiv.exists_congr_left (BoundedFormula.constantsVarsEquiv)]
  refine exists_congr (fun φ => iff_iff_eq.2 (congr_arg (s = .) ?_))
  

Proof state:
M : Type w
A : Set M
L : Language
inst✝ : Structure L M
α : Type u₁
β : Type u_1
B : Set M
s : Set (α → M)
φ : BoundedFormula L (↑A ⊕ α) 0
⊢ setOf (Formula.Realize (BoundedFormula.constantsVarsEquiv.symm φ)) = {v | Formula.Realize φ (Sum.elim Subtype.val v)}

Next tactic:
ext
theorem definable_iff_exists_formula_sum :
    A.Definable L s ↔ ∃ φ : L.Formula (A ⊕ α), s = {v | φ.Realize (Sum.elim (↑) v)} := by
  rw [Definable, Equiv.exists_congr_left (BoundedFormula.constantsVarsEquiv)]
  refine exists_congr (fun φ => iff_iff_eq.2 (congr_arg (s = .) ?_))
  ext
  

Proof state:
case h
M : Type w
A : Set M
L : Language
inst✝ : Structure L M
α : Type u₁
β : Type u_1
B : Set M
s : Set (α → M)
φ : BoundedFormula L (↑A ⊕ α) 0
x✝ : α → M
⊢ x✝ ∈ setOf (Formula.Realize (BoundedFormula.constantsVarsEquiv.symm φ)) ↔
    x✝ ∈ {v | Formula.Realize φ (Sum.elim Subtype.val v)}

Next tactic:
simp only [Formula.Realize, BoundedFormula.constantsVarsEquiv, constantsOn, mk₂_Relations,
    BoundedFormula.mapTermRelEquiv_symm_apply, mem_setOf_eq]
theorem definable_iff_exists_formula_sum :
    A.Definable L s ↔ ∃ φ : L.Formula (A ⊕ α), s = {v | φ.Realize (Sum.elim (↑) v)} := by
  rw [Definable, Equiv.exists_congr_left (BoundedFormula.constantsVarsEquiv)]
  refine exists_congr (fun φ => iff_iff_eq.2 (congr_arg (s = .) ?_))
  ext
  simp only [Formula.Realize, BoundedFormula.constantsVarsEquiv, constantsOn, mk₂_Relations,
    BoundedFormula.mapTermRelEquiv_symm_apply, mem_setOf_eq]
  

Proof state:
case h
M : Type w
A : Set M
L : Language
inst✝ : Structure L M
α : Type u₁
β : Type u_1
B : Set M
s : Set (α → M)
φ : BoundedFormula L (↑A ⊕ α) 0
x✝ : α → M
⊢ BoundedFormula.Realize
      (BoundedFormula.mapTermRel (fun n => ⇑Term.constantsVarsEquivLeft.symm)
        (fun n => ⇑(Equiv.sumEmpty (Relations L n) (Relations (constantsOn ↑A) n)).symm) (fun x => id) φ)
      x✝ default ↔
    BoundedFormula.Realize φ (Sum.elim Subtype.val x✝) default

Next tactic:
refine BoundedFormula.realize_mapTermRel_id ?_ (fun _ _ _ => rfl)
theorem definable_iff_exists_formula_sum :
    A.Definable L s ↔ ∃ φ : L.Formula (A ⊕ α), s = {v | φ.Realize (Sum.elim (↑) v)} := by
  rw [Definable, Equiv.exists_congr_left (BoundedFormula.constantsVarsEquiv)]
  refine exists_congr (fun φ => iff_iff_eq.2 (congr_arg (s = .) ?_))
  ext
  simp only [Formula.Realize, BoundedFormula.constantsVarsEquiv, constantsOn, mk₂_Relations,
    BoundedFormula.mapTermRelEquiv_symm_apply, mem_setOf_eq]
  refine BoundedFormula.realize_mapTermRel_id ?_ (fun _ _ _ => rfl)
  

Proof state:
case h
M : Type w
A : Set M
L : Language
inst✝ : Structure L M
α : Type u₁
β : Type u_1
B : Set M
s : Set (α → M)
φ : BoundedFormula L (↑A ⊕ α) 0
x✝ : α → M
⊢ ∀ (n : ℕ) (t : Term L ((↑A ⊕ α) ⊕ Fin n)) (xs : Fin n → M),
    Term.realize (Sum.elim x✝ xs) (Term.constantsVarsEquivLeft.symm t) =
      Term.realize (Sum.elim (Sum.elim Subtype.val x✝) xs) t

Next tactic:
intros
theorem definable_iff_exists_formula_sum :
    A.Definable L s ↔ ∃ φ : L.Formula (A ⊕ α), s = {v | φ.Realize (Sum.elim (↑) v)} := by
  rw [Definable, Equiv.exists_congr_left (BoundedFormula.constantsVarsEquiv)]
  refine exists_congr (fun φ => iff_iff_eq.2 (congr_arg (s = .) ?_))
  ext
  simp only [Formula.Realize, BoundedFormula.constantsVarsEquiv, constantsOn, mk₂_Relations,
    BoundedFormula.mapTermRelEquiv_symm_apply, mem_setOf_eq]
  refine BoundedFormula.realize_mapTermRel_id ?_ (fun _ _ _ => rfl)
  intros
  

Proof state:
case h
M : Type w
A : Set M
L : Language
inst✝ : Structure L M
α : Type u₁
β : Type u_1
B : Set M
s : Set (α → M)
φ : BoundedFormula L (↑A ⊕ α) 0
x✝ : α → M
n✝ : ℕ
t✝ : Term L ((↑A ⊕ α) ⊕ Fin n✝)
xs✝ : Fin n✝ → M
⊢ Term.realize (Sum.elim x✝ xs✝) (Term.constantsVarsEquivLeft.symm t✝) =
    Term.realize (Sum.elim (Sum.elim Subtype.val x✝) xs✝) t✝

Next tactic:
simp only [Term.constantsVarsEquivLeft_symm_apply, Term.realize_varsToConstants,
    coe_con, Term.realize_relabel]
theorem definable_iff_exists_formula_sum :
    A.Definable L s ↔ ∃ φ : L.Formula (A ⊕ α), s = {v | φ.Realize (Sum.elim (↑) v)} := by
  rw [Definable, Equiv.exists_congr_left (BoundedFormula.constantsVarsEquiv)]
  refine exists_congr (fun φ => iff_iff_eq.2 (congr_arg (s = .) ?_))
  ext
  simp only [Formula.Realize, BoundedFormula.constantsVarsEquiv, constantsOn, mk₂_Relations,
    BoundedFormula.mapTermRelEquiv_symm_apply, mem_setOf_eq]
  refine BoundedFormula.realize_mapTermRel_id ?_ (fun _ _ _ => rfl)
  intros
  simp only [Term.constantsVarsEquivLeft_symm_apply, Term.realize_varsToConstants,
    coe_con, Term.realize_relabel]
  

Proof state:
case h
M : Type w
A : Set M
L : Language
inst✝ : Structure L M
α : Type u₁
β : Type u_1
B : Set M
s : Set (α → M)
φ : BoundedFormula L (↑A ⊕ α) 0
x✝ : α → M
n✝ : ℕ
t✝ : Term L ((↑A ⊕ α) ⊕ Fin n✝)
xs✝ : Fin n✝ → M
⊢ Term.realize (Sum.elim (fun a => ↑a) (Sum.elim x✝ xs✝) ∘ ⇑(Equiv.sumAssoc (↑A) α (Fin n✝))) t✝ =
    Term.realize (Sum.elim (Sum.elim Subtype.val x✝) xs✝) t✝

Next tactic:
congr
theorem definable_iff_exists_formula_sum :
    A.Definable L s ↔ ∃ φ : L.Formula (A ⊕ α), s = {v | φ.Realize (Sum.elim (↑) v)} := by
  rw [Definable, Equiv.exists_congr_left (BoundedFormula.constantsVarsEquiv)]
  refine exists_congr (fun φ => iff_iff_eq.2 (congr_arg (s = .) ?_))
  ext
  simp only [Formula.Realize, BoundedFormula.constantsVarsEquiv, constantsOn, mk₂_Relations,
    BoundedFormula.mapTermRelEquiv_symm_apply, mem_setOf_eq]
  refine BoundedFormula.realize_mapTermRel_id ?_ (fun _ _ _ => rfl)
  intros
  simp only [Term.constantsVarsEquivLeft_symm_apply, Term.realize_varsToConstants,
    coe_con, Term.realize_relabel]
  congr
  

Proof state:
case h.e_v
M : Type w
A : Set M
L : Language
inst✝ : Structure L M
α : Type u₁
β : Type u_1
B : Set M
s : Set (α → M)
φ : BoundedFormula L (↑A ⊕ α) 0
x✝ : α → M
n✝ : ℕ
t✝ : Term L ((↑A ⊕ α) ⊕ Fin n✝)
xs✝ : Fin n✝ → M
⊢ Sum.elim (fun a => ↑a) (Sum.elim x✝ xs✝) ∘ ⇑(Equiv.sumAssoc (↑A) α (Fin n✝)) = Sum.elim (Sum.elim Subtype.val x✝) xs✝

Next tactic:
ext a
theorem definable_iff_exists_formula_sum :
    A.Definable L s ↔ ∃ φ : L.Formula (A ⊕ α), s = {v | φ.Realize (Sum.elim (↑) v)} := by
  rw [Definable, Equiv.exists_congr_left (BoundedFormula.constantsVarsEquiv)]
  refine exists_congr (fun φ => iff_iff_eq.2 (congr_arg (s = .) ?_))
  ext
  simp only [Formula.Realize, BoundedFormula.constantsVarsEquiv, constantsOn, mk₂_Relations,
    BoundedFormula.mapTermRelEquiv_symm_apply, mem_setOf_eq]
  refine BoundedFormula.realize_mapTermRel_id ?_ (fun _ _ _ => rfl)
  intros
  simp only [Term.constantsVarsEquivLeft_symm_apply, Term.realize_varsToConstants,
    coe_con, Term.realize_relabel]
  congr
  ext a
  

Proof state:
case h.e_v.h
M : Type w
A : Set M
L : Language
inst✝ : Structure L M
α : Type u₁
β : Type u_1
B : Set M
s : Set (α → M)
φ : BoundedFormula L (↑A ⊕ α) 0
x✝ : α → M
n✝ : ℕ
t✝ : Term L ((↑A ⊕ α) ⊕ Fin n✝)
xs✝ : Fin n✝ → M
a : (↑A ⊕ α) ⊕ Fin n✝
⊢ (Sum.elim (fun a => ↑a) (Sum.elim x✝ xs✝) ∘ ⇑(Equiv.sumAssoc (↑A) α (Fin n✝))) a =
    Sum.elim (Sum.elim Subtype.val x✝) xs✝ a

Next tactic:
rcases a with (_ | _) | _
theorem definable_iff_exists_formula_sum :
    A.Definable L s ↔ ∃ φ : L.Formula (A ⊕ α), s = {v | φ.Realize (Sum.elim (↑) v)} := by
  rw [Definable, Equiv.exists_congr_left (BoundedFormula.constantsVarsEquiv)]
  refine exists_congr (fun φ => iff_iff_eq.2 (congr_arg (s = .) ?_))
  ext
  simp only [Formula.Realize, BoundedFormula.constantsVarsEquiv, constantsOn, mk₂_Relations,
    BoundedFormula.mapTermRelEquiv_symm_apply, mem_setOf_eq]
  refine BoundedFormula.realize_mapTermRel_id ?_ (fun _ _ _ => rfl)
  intros
  simp only [Term.constantsVarsEquivLeft_symm_apply, Term.realize_varsToConstants,
    coe_con, Term.realize_relabel]
  congr
  ext a
  rcases a with (_ | _) | _ <;> 

Proof state:
case h.e_v.h.inl.inl
M : Type w
A : Set M
L : Language
inst✝ : Structure L M
α : Type u₁
β : Type u_1
B : Set M
s : Set (α → M)
φ : BoundedFormula L (↑A ⊕ α) 0
x✝ : α → M
n✝ : ℕ
t✝ : Term L ((↑A ⊕ α) ⊕ Fin n✝)
xs✝ : Fin n✝ → M
val✝ : ↑A
⊢ (Sum.elim (fun a => ↑a) (Sum.elim x✝ xs✝) ∘ ⇑(Equiv.sumAssoc (↑A) α (Fin n✝))) (Sum.inl (Sum.inl val✝)) =
    Sum.elim (Sum.elim Subtype.val x✝) xs✝ (Sum.inl (Sum.inl val✝))

Next tactic:
rfl
theorem definable_iff_exists_formula_sum :
    A.Definable L s ↔ ∃ φ : L.Formula (A ⊕ α), s = {v | φ.Realize (Sum.elim (↑) v)} := by
  rw [Definable, Equiv.exists_congr_left (BoundedFormula.constantsVarsEquiv)]
  refine exists_congr (fun φ => iff_iff_eq.2 (congr_arg (s = .) ?_))
  ext
  simp only [Formula.Realize, BoundedFormula.constantsVarsEquiv, constantsOn, mk₂_Relations,
    BoundedFormula.mapTermRelEquiv_symm_apply, mem_setOf_eq]
  refine BoundedFormula.realize_mapTermRel_id ?_ (fun _ _ _ => rfl)
  intros
  simp only [Term.constantsVarsEquivLeft_symm_apply, Term.realize_varsToConstants,
    coe_con, Term.realize_relabel]
  congr
  ext a
  rcases a with (_ | _) | _ <;> 

Proof state:
case h.e_v.h.inl.inr
M : Type w
A : Set M
L : Language
inst✝ : Structure L M
α : Type u₁
β : Type u_1
B : Set M
s : Set (α → M)
φ : BoundedFormula L (↑A ⊕ α) 0
x✝ : α → M
n✝ : ℕ
t✝ : Term L ((↑A ⊕ α) ⊕ Fin n✝)
xs✝ : Fin n✝ → M
val✝ : α
⊢ (Sum.elim (fun a => ↑a) (Sum.elim x✝ xs✝) ∘ ⇑(Equiv.sumAssoc (↑A) α (Fin n✝))) (Sum.inl (Sum.inr val✝)) =
    Sum.elim (Sum.elim Subtype.val x✝) xs✝ (Sum.inl (Sum.inr val✝))

Next tactic:
rfl
theorem definable_iff_exists_formula_sum :
    A.Definable L s ↔ ∃ φ : L.Formula (A ⊕ α), s = {v | φ.Realize (Sum.elim (↑) v)} := by
  rw [Definable, Equiv.exists_congr_left (BoundedFormula.constantsVarsEquiv)]
  refine exists_congr (fun φ => iff_iff_eq.2 (congr_arg (s = .) ?_))
  ext
  simp only [Formula.Realize, BoundedFormula.constantsVarsEquiv, constantsOn, mk₂_Relations,
    BoundedFormula.mapTermRelEquiv_symm_apply, mem_setOf_eq]
  refine BoundedFormula.realize_mapTermRel_id ?_ (fun _ _ _ => rfl)
  intros
  simp only [Term.constantsVarsEquivLeft_symm_apply, Term.realize_varsToConstants,
    coe_con, Term.realize_relabel]
  congr
  ext a
  rcases a with (_ | _) | _ <;> 

Proof state:
case h.e_v.h.inr
M : Type w
A : Set M
L : Language
inst✝ : Structure L M
α : Type u₁
β : Type u_1
B : Set M
s : Set (α → M)
φ : BoundedFormula L (↑A ⊕ α) 0
x✝ : α → M
n✝ : ℕ
t✝ : Term L ((↑A ⊕ α) ⊕ Fin n✝)
xs✝ : Fin n✝ → M
val✝ : Fin n✝
⊢ (Sum.elim (fun a => ↑a) (Sum.elim x✝ xs✝) ∘ ⇑(Equiv.sumAssoc (↑A) α (Fin n✝))) (Sum.inr val✝) =
    Sum.elim (Sum.elim Subtype.val x✝) xs✝ (Sum.inr val✝)

Next tactic:
rfl
theorem empty_definable_iff :
    (∅ : Set M).Definable L s ↔ ∃ φ : L.Formula α, s = setOf φ.Realize := by
  

Proof state:
M : Type w
A : Set M
L : Language
inst✝ : Structure L M
α : Type u₁
β : Type u_1
B : Set M
s : Set (α → M)
⊢ Definable ∅ L s ↔ ∃ φ, s = setOf (Formula.Realize φ)

Next tactic:
rw [Definable, Equiv.exists_congr_left (LEquiv.addEmptyConstants L (∅ : Set M)).onFormula]
theorem empty_definable_iff :
    (∅ : Set M).Definable L s ↔ ∃ φ : L.Formula α, s = setOf φ.Realize := by
  rw [Definable, Equiv.exists_congr_left (LEquiv.addEmptyConstants L (∅ : Set M)).onFormula]
  

Proof state:
M : Type w
A : Set M
L : Language
inst✝ : Structure L M
α : Type u₁
β : Type u_1
B : Set M
s : Set (α → M)
⊢ (∃ φ, s = setOf (Formula.Realize φ)) ↔
    ∃ b, s = setOf (Formula.Realize ((LEquiv.onFormula (LEquiv.addEmptyConstants L ↑∅)).symm b))

Next tactic:
simp [-constantsOn]
theorem Definable.mono (hAs : A.Definable L s) (hAB : A ⊆ B) : B.Definable L s := by
  

Proof state:
M : Type w
A : Set M
L : Language
inst✝ : Structure L M
α : Type u₁
β : Type u_1
B : Set M
s : Set (α → M)
hAs : Definable A L s
hAB : A ⊆ B
⊢ Definable B L s

Next tactic:
rw [definable_iff_empty_definable_with_params] at *
theorem Definable.mono (hAs : A.Definable L s) (hAB : A ⊆ B) : B.Definable L s := by
  rw [definable_iff_empty_definable_with_params] at *
  

Proof state:
M : Type w
A : Set M
L : Language
inst✝ : Structure L M
α : Type u₁
β : Type u_1
B : Set M
s : Set (α → M)
hAs : Definable ∅ (L[[↑A]]) s
hAB : A ⊆ B
⊢ Definable ∅ (L[[↑B]]) s

Next tactic:
exact hAs.map_expansion (L.lhomWithConstantsMap (Set.inclusion hAB))
@[simp]
theorem definable_empty : A.Definable L (∅ : Set (α → M)) :=
  ⟨⊥, by
    

Proof state:
M : Type w
A : Set M
L : Language
inst✝ : Structure L M
α : Type u₁
β : Type u_1
B : Set M
s : Set (α → M)
⊢ ∅ = setOf (Formula.Realize ⊥)

Next tactic:
ext
@[simp]
theorem definable_empty : A.Definable L (∅ : Set (α → M)) :=
  ⟨⊥, by
    ext
    

Proof state:
case h
M : Type w
A : Set M
L : Language
inst✝ : Structure L M
α : Type u₁
β : Type u_1
B : Set M
s : Set (α → M)
x✝ : α → M
⊢ x✝ ∈ ∅ ↔ x✝ ∈ setOf (Formula.Realize ⊥)

Next tactic:
simp
@[simp]
theorem definable_univ : A.Definable L (univ : Set (α → M)) :=
  ⟨⊤, by
    

Proof state:
M : Type w
A : Set M
L : Language
inst✝ : Structure L M
α : Type u₁
β : Type u_1
B : Set M
s : Set (α → M)
⊢ univ = setOf (Formula.Realize ⊤)

Next tactic:
ext
@[simp]
theorem definable_univ : A.Definable L (univ : Set (α → M)) :=
  ⟨⊤, by
    ext
    

Proof state:
case h
M : Type w
A : Set M
L : Language
inst✝ : Structure L M
α : Type u₁
β : Type u_1
B : Set M
s : Set (α → M)
x✝ : α → M
⊢ x✝ ∈ univ ↔ x✝ ∈ setOf (Formula.Realize ⊤)

Next tactic:
simp
@[simp]
theorem Definable.inter {f g : Set (α → M)} (hf : A.Definable L f) (hg : A.Definable L g) :
    A.Definable L (f ∩ g) := by
  

Proof state:
M : Type w
A : Set M
L : Language
inst✝ : Structure L M
α : Type u₁
β : Type u_1
B : Set M
s f g : Set (α → M)
hf : Definable A L f
hg : Definable A L g
⊢ Definable A L (f ∩ g)

Next tactic:
rcases hf with ⟨φ, rfl⟩
@[simp]
theorem Definable.inter {f g : Set (α → M)} (hf : A.Definable L f) (hg : A.Definable L g) :
    A.Definable L (f ∩ g) := by
  rcases hf with ⟨φ, rfl⟩
  

Proof state:
case intro
M : Type w
A : Set M
L : Language
inst✝ : Structure L M
α : Type u₁
β : Type u_1
B : Set M
s g : Set (α → M)
hg : Definable A L g
φ : Formula (L[[↑A]]) α
⊢ Definable A L (setOf (Formula.Realize φ) ∩ g)

Next tactic:
rcases hg with ⟨θ, rfl⟩
@[simp]
theorem Definable.inter {f g : Set (α → M)} (hf : A.Definable L f) (hg : A.Definable L g) :
    A.Definable L (f ∩ g) := by
  rcases hf with ⟨φ, rfl⟩
  rcases hg with ⟨θ, rfl⟩
  

Proof state:
case intro.intro
M : Type w
A : Set M
L : Language
inst✝ : Structure L M
α : Type u₁
β : Type u_1
B : Set M
s : Set (α → M)
φ θ : Formula (L[[↑A]]) α
⊢ Definable A L (setOf (Formula.Realize φ) ∩ setOf (Formula.Realize θ))

Next tactic:
refine' ⟨φ ⊓ θ, _⟩
@[simp]
theorem Definable.inter {f g : Set (α → M)} (hf : A.Definable L f) (hg : A.Definable L g) :
    A.Definable L (f ∩ g) := by
  rcases hf with ⟨φ, rfl⟩
  rcases hg with ⟨θ, rfl⟩
  refine' ⟨φ ⊓ θ, _⟩
  

Proof state:
case intro.intro
M : Type w
A : Set M
L : Language
inst✝ : Structure L M
α : Type u₁
β : Type u_1
B : Set M
s : Set (α → M)
φ θ : Formula (L[[↑A]]) α
⊢ setOf (Formula.Realize φ) ∩ setOf (Formula.Realize θ) = setOf (Formula.Realize (φ ⊓ θ))

Next tactic:
ext
@[simp]
theorem Definable.inter {f g : Set (α → M)} (hf : A.Definable L f) (hg : A.Definable L g) :
    A.Definable L (f ∩ g) := by
  rcases hf with ⟨φ, rfl⟩
  rcases hg with ⟨θ, rfl⟩
  refine' ⟨φ ⊓ θ, _⟩
  ext
  

Proof state:
case intro.intro.h
M : Type w
A : Set M
L : Language
inst✝ : Structure L M
α : Type u₁
β : Type u_1
B : Set M
s : Set (α → M)
φ θ : Formula (L[[↑A]]) α
x✝ : α → M
⊢ x✝ ∈ setOf (Formula.Realize φ) ∩ setOf (Formula.Realize θ) ↔ x✝ ∈ setOf (Formula.Realize (φ ⊓ θ))

Next tactic:
simp
@[simp]
theorem Definable.union {f g : Set (α → M)} (hf : A.Definable L f) (hg : A.Definable L g) :
    A.Definable L (f ∪ g) := by
  

Proof state:
M : Type w
A : Set M
L : Language
inst✝ : Structure L M
α : Type u₁
β : Type u_1
B : Set M
s f g : Set (α → M)
hf : Definable A L f
hg : Definable A L g
⊢ Definable A L (f ∪ g)

Next tactic:
rcases hf with ⟨φ, hφ⟩
@[simp]
theorem Definable.union {f g : Set (α → M)} (hf : A.Definable L f) (hg : A.Definable L g) :
    A.Definable L (f ∪ g) := by
  rcases hf with ⟨φ, hφ⟩
  

Proof state:
case intro
M : Type w
A : Set M
L : Language
inst✝ : Structure L M
α : Type u₁
β : Type u_1
B : Set M
s f g : Set (α → M)
hg : Definable A L g
φ : Formula (L[[↑A]]) α
hφ : f = setOf (Formula.Realize φ)
⊢ Definable A L (f ∪ g)

Next tactic:
rcases hg with ⟨θ, hθ⟩
@[simp]
theorem Definable.union {f g : Set (α → M)} (hf : A.Definable L f) (hg : A.Definable L g) :
    A.Definable L (f ∪ g) := by
  rcases hf with ⟨φ, hφ⟩
  rcases hg with ⟨θ, hθ⟩
  

Proof state:
case intro.intro
M : Type w
A : Set M
L : Language
inst✝ : Structure L M
α : Type u₁
β : Type u_1
B : Set M
s f g : Set (α → M)
φ : Formula (L[[↑A]]) α
hφ : f = setOf (Formula.Realize φ)
θ : Formula (L[[↑A]]) α
hθ : g = setOf (Formula.Realize θ)
⊢ Definable A L (f ∪ g)

Next tactic:
refine' ⟨φ ⊔ θ, _⟩
@[simp]
theorem Definable.union {f g : Set (α → M)} (hf : A.Definable L f) (hg : A.Definable L g) :
    A.Definable L (f ∪ g) := by
  rcases hf with ⟨φ, hφ⟩
  rcases hg with ⟨θ, hθ⟩
  refine' ⟨φ ⊔ θ, _⟩
  

Proof state:
case intro.intro
M : Type w
A : Set M
L : Language
inst✝ : Structure L M
α : Type u₁
β : Type u_1
B : Set M
s f g : Set (α → M)
φ : Formula (L[[↑A]]) α
hφ : f = setOf (Formula.Realize φ)
θ : Formula (L[[↑A]]) α
hθ : g = setOf (Formula.Realize θ)
⊢ f ∪ g = setOf (Formula.Realize (φ ⊔ θ))

Next tactic:
ext
@[simp]
theorem Definable.union {f g : Set (α → M)} (hf : A.Definable L f) (hg : A.Definable L g) :
    A.Definable L (f ∪ g) := by
  rcases hf with ⟨φ, hφ⟩
  rcases hg with ⟨θ, hθ⟩
  refine' ⟨φ ⊔ θ, _⟩
  ext
  

Proof state:
case intro.intro.h
M : Type w
A : Set M
L : Language
inst✝ : Structure L M
α : Type u₁
β : Type u_1
B : Set M
s f g : Set (α → M)
φ : Formula (L[[↑A]]) α
hφ : f = setOf (Formula.Realize φ)
θ : Formula (L[[↑A]]) α
hθ : g = setOf (Formula.Realize θ)
x✝ : α → M
⊢ x✝ ∈ f ∪ g ↔ x✝ ∈ setOf (Formula.Realize (φ ⊔ θ))

Next tactic:
rw [hφ, hθ, mem_setOf_eq, Formula.realize_sup, mem_union, mem_setOf_eq, mem_setOf_eq]
theorem definable_finset_inf {ι : Type*} {f : ∀ _ : ι, Set (α → M)} (hf : ∀ i, A.Definable L (f i))
    (s : Finset ι) : A.Definable L (s.inf f) := by
  

Proof state:
M : Type w
A : Set M
L : Language
inst✝ : Structure L M
α : Type u₁
β : Type u_1
B : Set M
s✝ : Set (α → M)
ι : Type u_2
f : ι → Set (α → M)
hf : ∀ (i : ι), Definable A L (f i)
s : Finset ι
⊢ Definable A L (Finset.inf s f)

Next tactic:
classical
    refine' Finset.induction definable_univ (fun i s _ h => _) s
    rw [Finset.inf_insert]
    exact (hf i).inter h
theorem definable_finset_inf {ι : Type*} {f : ∀ _ : ι, Set (α → M)} (hf : ∀ i, A.Definable L (f i))
    (s : Finset ι) : A.Definable L (s.inf f) := by
  classical
    

Proof state:
M : Type w
A : Set M
L : Language
inst✝ : Structure L M
α : Type u₁
β : Type u_1
B : Set M
s✝ : Set (α → M)
ι : Type u_2
f : ι → Set (α → M)
hf : ∀ (i : ι), Definable A L (f i)
s : Finset ι
⊢ Definable A L (Finset.inf s f)

Next tactic:
refine' Finset.induction definable_univ (fun i s _ h => _) s
theorem definable_finset_inf {ι : Type*} {f : ∀ _ : ι, Set (α → M)} (hf : ∀ i, A.Definable L (f i))
    (s : Finset ι) : A.Definable L (s.inf f) := by
  classical
    refine' Finset.induction definable_univ (fun i s _ h => _) s
    

Proof state:
M : Type w
A : Set M
L : Language
inst✝ : Structure L M
α : Type u₁
β : Type u_1
B : Set M
s✝¹ : Set (α → M)
ι : Type u_2
f : ι → Set (α → M)
hf : ∀ (i : ι), Definable A L (f i)
s✝ : Finset ι
i : ι
s : Finset ι
x✝ : i ∉ s
h : Definable A L (Finset.inf s f)
⊢ Definable A L (Finset.inf (insert i s) f)

Next tactic:
rw [Finset.inf_insert]
theorem definable_finset_inf {ι : Type*} {f : ∀ _ : ι, Set (α → M)} (hf : ∀ i, A.Definable L (f i))
    (s : Finset ι) : A.Definable L (s.inf f) := by
  classical
    refine' Finset.induction definable_univ (fun i s _ h => _) s
    rw [Finset.inf_insert]
    

Proof state:
M : Type w
A : Set M
L : Language
inst✝ : Structure L M
α : Type u₁
β : Type u_1
B : Set M
s✝¹ : Set (α → M)
ι : Type u_2
f : ι → Set (α → M)
hf : ∀ (i : ι), Definable A L (f i)
s✝ : Finset ι
i : ι
s : Finset ι
x✝ : i ∉ s
h : Definable A L (Finset.inf s f)
⊢ Definable A L (f i ⊓ Finset.inf s f)

Next tactic:
exact (hf i).inter h
theorem definable_finset_sup {ι : Type*} {f : ∀ _ : ι, Set (α → M)} (hf : ∀ i, A.Definable L (f i))
    (s : Finset ι) : A.Definable L (s.sup f) := by
  

Proof state:
M : Type w
A : Set M
L : Language
inst✝ : Structure L M
α : Type u₁
β : Type u_1
B : Set M
s✝ : Set (α → M)
ι : Type u_2
f : ι → Set (α → M)
hf : ∀ (i : ι), Definable A L (f i)
s : Finset ι
⊢ Definable A L (Finset.sup s f)

Next tactic:
classical
    refine' Finset.induction definable_empty (fun i s _ h => _) s
    rw [Finset.sup_insert]
    exact (hf i).union h
theorem definable_finset_sup {ι : Type*} {f : ∀ _ : ι, Set (α → M)} (hf : ∀ i, A.Definable L (f i))
    (s : Finset ι) : A.Definable L (s.sup f) := by
  classical
    

Proof state:
M : Type w
A : Set M
L : Language
inst✝ : Structure L M
α : Type u₁
β : Type u_1
B : Set M
s✝ : Set (α → M)
ι : Type u_2
f : ι → Set (α → M)
hf : ∀ (i : ι), Definable A L (f i)
s : Finset ι
⊢ Definable A L (Finset.sup s f)

Next tactic:
refine' Finset.induction definable_empty (fun i s _ h => _) s
theorem definable_finset_sup {ι : Type*} {f : ∀ _ : ι, Set (α → M)} (hf : ∀ i, A.Definable L (f i))
    (s : Finset ι) : A.Definable L (s.sup f) := by
  classical
    refine' Finset.induction definable_empty (fun i s _ h => _) s
    

Proof state:
M : Type w
A : Set M
L : Language
inst✝ : Structure L M
α : Type u₁
β : Type u_1
B : Set M
s✝¹ : Set (α → M)
ι : Type u_2
f : ι → Set (α → M)
hf : ∀ (i : ι), Definable A L (f i)
s✝ : Finset ι
i : ι
s : Finset ι
x✝ : i ∉ s
h : Definable A L (Finset.sup s f)
⊢ Definable A L (Finset.sup (insert i s) f)

Next tactic:
rw [Finset.sup_insert]
theorem definable_finset_sup {ι : Type*} {f : ∀ _ : ι, Set (α → M)} (hf : ∀ i, A.Definable L (f i))
    (s : Finset ι) : A.Definable L (s.sup f) := by
  classical
    refine' Finset.induction definable_empty (fun i s _ h => _) s
    rw [Finset.sup_insert]
    

Proof state:
M : Type w
A : Set M
L : Language
inst✝ : Structure L M
α : Type u₁
β : Type u_1
B : Set M
s✝¹ : Set (α → M)
ι : Type u_2
f : ι → Set (α → M)
hf : ∀ (i : ι), Definable A L (f i)
s✝ : Finset ι
i : ι
s : Finset ι
x✝ : i ∉ s
h : Definable A L (Finset.sup s f)
⊢ Definable A L (f i ⊔ Finset.sup s f)

Next tactic:
exact (hf i).union h