@@ -93,35 +93,88 @@ theorem Definable.mono (hAs : A.Definable L s) (hAB : A ⊆ B) : B.Definable L s
9393 rw [definable_iff_empty_definable_with_params] at *
9494 exact hAs.map_expansion (L.lhomWithConstantsMap (Set.inclusion hAB))
9595
96+ end Set
97+
98+ namespace FirstOrder.Language
99+
100+ open Set
101+
102+ variable {L : Language.{u, v}} {M : Type w} [L.Structure M]
103+
104+ variable {A : Set M} {α : Type u₁}
105+
106+ namespace Formula
107+
108+ /-- A formula with parameters from `A` defines the set of its realizations. -/
109+ theorem definable_withConstants (φ : L[[A]].Formula α) :
110+ A.Definable L {v | φ.Realize v} :=
111+ ⟨φ, rfl⟩
112+
113+ theorem definable (φ : L.Formula α) :
114+ A.Definable L {v | φ.Realize v} :=
115+ (empty_definable_iff.mpr ⟨φ, rfl⟩).mono (empty_subset A)
116+
117+ end Formula
118+
119+ namespace BoundedFormula
120+
121+ variable {n : ℕ}
122+
123+ theorem definable_withConstants (φ : L[[A]].BoundedFormula α n) :
124+ A.Definable L {v | φ.Realize (v ∘ Sum.inl) (v ∘ Sum.inr)} := by
125+ simpa using φ.toFormula.definable_withConstants
126+
127+ theorem definable (φ : L.BoundedFormula α n) :
128+ A.Definable L {v | φ.Realize (v ∘ Sum.inl) (v ∘ Sum.inr)} := by
129+ simpa using φ.toFormula.definable
130+
131+ theorem definable_boundedSection_withConstants (φ : L[[A]].BoundedFormula Empty n) :
132+ A.Definable L {xs | φ.Realize default xs} := by
133+ convert (φ.toFormula.relabel (Sum.elim Empty.elim id)).definable_withConstants using 1
134+ ext xs
135+ simp only [Formula.realize_relabel, realize_toFormula]
136+ congr!
137+
138+ theorem definable_boundedSection (φ : L.BoundedFormula Empty n) :
139+ A.Definable L {xs | φ.Realize default xs} := by
140+ convert (φ.toFormula.relabel (Sum.elim Empty.elim id)).definable
141+ ext xs
142+ simp only [Formula.realize_relabel, realize_toFormula]
143+ congr!
144+
145+ end BoundedFormula
146+
147+ end FirstOrder.Language
148+
149+ namespace Set
150+
151+ open FirstOrder FirstOrder.Language
152+
153+ variable {M : Type w} {A : Set M} {L : FirstOrder.Language.{u, v}} [L.Structure M]
154+
155+ variable {α : Type u₁} {β : Type *} {s : Set (α → M)}
156+
96157@[simp]
97158theorem definable_empty : A.Definable L (∅ : Set (α → M)) :=
98- ⟨⊥, by
99- ext
100- simp⟩
159+ (⊥ : L[[A]].Formula α).definable_withConstants
101160
102161@[simp]
103- theorem definable_univ : A.Definable L (univ : Set (α → M)) :=
104- ⟨⊤, by
105- ext
106- simp⟩
162+ theorem definable_univ : A.Definable L (univ : Set (α → M)) := by
163+ simpa using (⊤ : L[[A]].Formula α).definable_withConstants
107164
108165@[simp]
109166theorem Definable.inter {f g : Set (α → M)} (hf : A.Definable L f) (hg : A.Definable L g) :
110167 A.Definable L (f ∩ g) := by
111168 rcases hf with ⟨φ, rfl⟩
112169 rcases hg with ⟨θ, rfl⟩
113- refine ⟨φ ⊓ θ, ?_⟩
114- ext
115- simp
170+ simpa using (φ ⊓ θ).definable_withConstants
116171
117172@[simp]
118173theorem Definable.union {f g : Set (α → M)} (hf : A.Definable L f) (hg : A.Definable L g) :
119174 A.Definable L (f ∪ g) := by
120- rcases hf with ⟨φ, hφ⟩
121- rcases hg with ⟨θ, hθ⟩
122- refine ⟨φ ⊔ θ, ?_⟩
123- ext
124- rw [hφ, hθ, mem_setOf_eq, Formula.realize_sup, mem_union, mem_setOf_eq, mem_setOf_eq]
175+ rcases hf with ⟨φ, rfl⟩
176+ rcases hg with ⟨θ, rfl⟩
177+ simpa using (φ ⊔ θ).definable_withConstants
125178
126179theorem definable_finset_inf {ι : Type *} {f : ι → Set (α → M)} (hf : ∀ i, A.Definable L (f i))
127180 (s : Finset ι) : A.Definable L (s.inf f) := by
@@ -161,10 +214,8 @@ theorem definable_iUnion_of_finite {ι : Type*} [Finite ι] {f : ι → Set (α
161214
162215@[simp]
163216theorem Definable.compl {s : Set (α → M)} (hf : A.Definable L s) : A.Definable L sᶜ := by
164- rcases hf with ⟨φ, hφ⟩
165- refine ⟨φ.not, ?_⟩
166- ext v
167- rw [hφ, compl_setOf, mem_setOf, mem_setOf, Formula.realize_not]
217+ rcases hf with ⟨φ, rfl⟩
218+ simpa using (φ.not).definable_withConstants
168219
169220@[simp]
170221theorem Definable.sdiff {s t : Set (α → M)} (hs : A.Definable L s) (ht : A.Definable L t) :
@@ -177,9 +228,7 @@ theorem Definable.sdiff {s t : Set (α → M)} (hs : A.Definable L s) (ht : A.De
177228theorem Definable.preimage_comp (f : α → β) {s : Set (α → M)} (h : A.Definable L s) :
178229 A.Definable L ((fun g : β → M => g ∘ f) ⁻¹' s) := by
179230 obtain ⟨φ, rfl⟩ := h
180- refine ⟨φ.relabel f, ?_⟩
181- ext
182- simp only [Set.preimage_setOf_eq, mem_setOf_eq, Formula.realize_relabel]
231+ simpa using (φ.relabel f).definable_withConstants
183232
184233theorem Definable.image_comp_equiv {s : Set (β → M)} (h : A.Definable L s) (f : α ≃ β) :
185234 A.Definable L ((fun g : β → M => g ∘ f) '' s) := by
@@ -278,19 +327,15 @@ theorem Definable.image_comp {s : Set (β → M)} (h : A.Definable L s) (f : α
278327lemma Definable.exists_of_finite [Finite β] {S : Set ((α ⊕ β) → M)}
279328 (hS : A.Definable L S) :
280329 A.Definable L { v : α → M | ∃ u : β → M, Sum.elim v u ∈ S } := by
281- obtain ⟨φ, hφ⟩ := hS
282- exists φ.iExs β
283- ext v
284- simp [hφ]
330+ obtain ⟨φ, rfl⟩ := hS
331+ simpa using (φ.iExs β).definable_withConstants
285332
286333/-- Finite universal quantifiers preserve definablity. -/
287334lemma Definable.forall_of_finite [Finite β] {S : Set ((α ⊕ β) → M)}
288335 (hS : A.Definable L S) :
289336 A.Definable L { v : α → M | ∀ u : β → M, Sum.elim v u ∈ S } := by
290- obtain ⟨φ, hφ⟩ := hS
291- exists φ.iAlls β
292- ext v
293- simp [hφ]
337+ obtain ⟨φ, rfl⟩ := hS
338+ simpa using (φ.iAlls β).definable_withConstants
294339
295340variable (L A)
296341
@@ -478,10 +523,7 @@ theorem definableFun_iff_empty_definableFun_with_params :
478523@[fun_prop]
479524theorem _root_.FirstOrder.Language.Term.definableFun_realize (t : L.Term α) :
480525 (∅ : Set M).DefinableFun L (t.realize) := by
481- rw [empty_definableFun_iff]
482- refine ⟨(t.relabel some).equal (Term.var none), ?_⟩
483- ext v
484- simp [tupleGraph]
526+ simpa using ((t.relabel some).equal (Term.var none)).definable
485527
486528/-- A function symbol is a definable function. -/
487529@[fun_prop]
@@ -591,9 +633,7 @@ def TermDefinable (f : (α → M) → M) : Prop :=
591633theorem TermDefinable.definable_tupleGraph {f : (α → M) → M} (h : A.TermDefinable L f) :
592634 A.Definable L f.tupleGraph := by
593635 obtain ⟨φ, rfl⟩ := h
594- use (φ.relabel some).equal (Term.var none)
595- ext
596- simp [Function.tupleGraph]
636+ simpa using ((φ.relabel some).equal (Term.var none)).definable_withConstants
597637
598638variable {L} {A B} {f : (α → M) → M}
599639
0 commit comments