fact
stringlengths
6
3.84k
type
stringclasses
11 values
library
stringclasses
32 values
imports
listlengths
1
14
filename
stringlengths
20
95
symbolic_name
stringlengths
1
90
docstring
stringlengths
7
20k
notMem_disjointOfDiff (hC : IsSetSemiring C) (hs : s ∈ C) (ht : t ∈ C) : t ∉ hC.disjointOfDiff hs ht := by intro hs_mem suffices t ⊆ s \ t by have h := @disjoint_sdiff_self_right _ t s _ specialize h le_rfl this simp only [Set.bot_eq_empty, Set.le_eq_subset, subset_empty_iff] at h refine hC.empty_notMem_disjointOfDiff hs ht ?_ rwa [← h] rw [← hC.sUnion_disjointOfDiff hs ht] exact subset_sUnion_of_mem hs_mem @[deprecated (since := "2025-05-24")] alias nmem_disjointOfDiff := notMem_disjointOfDiff
lemma
MeasureTheory
[ "Mathlib.Data.Nat.Lattice", "Mathlib.Data.Set.Accumulate", "Mathlib.Data.Set.Pairwise.Lattice", "Mathlib.MeasureTheory.PiSystem" ]
Mathlib/MeasureTheory/SetSemiring.lean
notMem_disjointOfDiff
null
sUnion_insert_disjointOfDiff (hC : IsSetSemiring C) (hs : s ∈ C) (ht : t ∈ C) (hst : t ⊆ s) : ⋃₀ insert t (hC.disjointOfDiff hs ht) = s := by conv_rhs => rw [← union_diff_cancel hst, ← hC.sUnion_disjointOfDiff hs ht] simp only [sUnion_insert]
lemma
MeasureTheory
[ "Mathlib.Data.Nat.Lattice", "Mathlib.Data.Set.Accumulate", "Mathlib.Data.Set.Pairwise.Lattice", "Mathlib.MeasureTheory.PiSystem" ]
Mathlib/MeasureTheory/SetSemiring.lean
sUnion_insert_disjointOfDiff
null
disjoint_sUnion_disjointOfDiff (hC : IsSetSemiring C) (hs : s ∈ C) (ht : t ∈ C) : Disjoint t (⋃₀ hC.disjointOfDiff hs ht) := by rw [hC.sUnion_disjointOfDiff] exact disjoint_sdiff_right
lemma
MeasureTheory
[ "Mathlib.Data.Nat.Lattice", "Mathlib.Data.Set.Accumulate", "Mathlib.Data.Set.Pairwise.Lattice", "Mathlib.MeasureTheory.PiSystem" ]
Mathlib/MeasureTheory/SetSemiring.lean
disjoint_sUnion_disjointOfDiff
null
pairwiseDisjoint_insert_disjointOfDiff (hC : IsSetSemiring C) (hs : s ∈ C) (ht : t ∈ C) : PairwiseDisjoint (insert t (hC.disjointOfDiff hs ht) : Set (Set α)) id := by have h := hC.pairwiseDisjoint_disjointOfDiff hs ht refine PairwiseDisjoint.insert_of_notMem h (hC.notMem_disjointOfDiff hs ht) fun u hu ↦ ?_ simp_rw [id] refine Disjoint.mono_right ?_ (hC.disjoint_sUnion_disjointOfDiff hs ht) simp only [Set.le_eq_subset] exact subset_sUnion_of_mem hu
lemma
MeasureTheory
[ "Mathlib.Data.Nat.Lattice", "Mathlib.Data.Set.Accumulate", "Mathlib.Data.Set.Pairwise.Lattice", "Mathlib.MeasureTheory.PiSystem" ]
Mathlib/MeasureTheory/SetSemiring.lean
pairwiseDisjoint_insert_disjointOfDiff
null
exists_disjoint_finset_diff_eq (hC : IsSetSemiring C) (hs : s ∈ C) (hI : ↑I ⊆ C) : ∃ J : Finset (Set α), ↑J ⊆ C ∧ PairwiseDisjoint (J : Set (Set α)) id ∧ s \ ⋃₀ I = ⋃₀ J := by classical induction I using Finset.induction with | empty => simp only [coe_empty, sUnion_empty, diff_empty] refine ⟨{s}, singleton_subset_set_iff.mpr hs, ?_⟩ simp only [coe_singleton, pairwiseDisjoint_singleton, sUnion_singleton, and_self_iff] | insert t I' _ h => ?_ rw [coe_insert] at hI have ht : t ∈ C := hI (Set.mem_insert _ _) obtain ⟨J, h_ss, h_dis, h_eq⟩ := h ((Set.subset_insert _ _).trans hI) let Ju : ∀ u ∈ C, Finset (Set α) := fun u hu ↦ hC.disjointOfDiff hu ht have hJu_subset : ∀ (u) (hu : u ∈ C), ↑(Ju u hu) ⊆ C := by intro u hu x hx exact hC.subset_disjointOfDiff hu ht hx have hJu_disj : ∀ (u) (hu : u ∈ C), (Ju u hu : Set (Set α)).PairwiseDisjoint id := fun u hu ↦ hC.pairwiseDisjoint_disjointOfDiff hu ht have hJu_sUnion : ∀ (u) (hu : u ∈ C), ⋃₀ (Ju u hu : Set (Set α)) = u \ t := fun u hu ↦ hC.sUnion_disjointOfDiff hu ht have hJu_disj' : ∀ (u) (hu : u ∈ C) (v) (hv : v ∈ C) (_h_dis : Disjoint u v), Disjoint (⋃₀ (Ju u hu : Set (Set α))) (⋃₀ ↑(Ju v hv)) := by intro u hu v hv huv_disj rw [hJu_sUnion, hJu_sUnion] exact disjoint_of_subset Set.diff_subset Set.diff_subset huv_disj let J' : Finset (Set α) := Finset.biUnion (Finset.univ : Finset J) fun u ↦ Ju u (h_ss u.prop) have hJ'_subset : ↑J' ⊆ C := by intro u simp only [J', univ_eq_attach, coe_biUnion, mem_coe, mem_attach, iUnion_true, mem_iUnion, Finset.exists_coe, exists₂_imp] intro v hv huvt exact hJu_subset v (h_ss hv) huvt refine ⟨J', hJ'_subset, ?_, ?_⟩ · rw [Finset.coe_biUnion] refine PairwiseDisjoint.biUnion ?_ ?_ · simp only [univ_eq_attach, mem_coe, id, iSup_eq_iUnion] simp_rw [PairwiseDisjoint, Set.Pairwise] intro x _ y _ hxy have hxy_disj : Disjoint (x : Set α) y := by by_contra h_contra refine hxy ?_ refine Subtype.ext ?_ exact h_dis.elim x.prop y.prop h_contra convert hJu_disj' (x : Set α) (h_ss x.prop) y (h_ss y.prop) hxy_disj · rw [sUnion_eq_biUnion] congr · rw [sUnion_eq_biUnion] congr · exact fun u _ ↦ hJu_disj _ _ ...
lemma
MeasureTheory
[ "Mathlib.Data.Nat.Lattice", "Mathlib.Data.Set.Accumulate", "Mathlib.Data.Set.Pairwise.Lattice", "Mathlib.MeasureTheory.PiSystem" ]
Mathlib/MeasureTheory/SetSemiring.lean
exists_disjoint_finset_diff_eq
In a semiring of sets `C`, for all set `s ∈ C` and finite set of sets `I ⊆ C`, there is a finite set of sets in `C` whose union is `s \ ⋃₀ I`. See `IsSetSemiring.disjointOfDiffUnion` for a definition that gives such a set.
noncomputable disjointOfDiffUnion (hC : IsSetSemiring C) (hs : s ∈ C) (hI : ↑I ⊆ C) : Finset (Set α) := (hC.exists_disjoint_finset_diff_eq hs hI).choose \ {∅}
def
MeasureTheory
[ "Mathlib.Data.Nat.Lattice", "Mathlib.Data.Set.Accumulate", "Mathlib.Data.Set.Pairwise.Lattice", "Mathlib.MeasureTheory.PiSystem" ]
Mathlib/MeasureTheory/SetSemiring.lean
disjointOfDiffUnion
In a semiring of sets `C`, for all set `s ∈ C` and finite set of sets `I ⊆ C`, `disjointOfDiffUnion` is a finite set of sets in `C` such that `s \ ⋃₀ I = ⋃₀ (hC.disjointOfDiffUnion hs I hI)`. `disjointOfDiff` is a special case of `disjointOfDiffUnion` where `I` is a singleton.
empty_notMem_disjointOfDiffUnion (hC : IsSetSemiring C) (hs : s ∈ C) (hI : ↑I ⊆ C) : ∅ ∉ hC.disjointOfDiffUnion hs hI := by classical simp only [disjointOfDiffUnion, mem_sdiff, Finset.mem_singleton, not_true, and_false, not_false_iff] @[deprecated (since := "2025-05-24")] alias empty_nmem_disjointOfDiffUnion := empty_notMem_disjointOfDiffUnion
lemma
MeasureTheory
[ "Mathlib.Data.Nat.Lattice", "Mathlib.Data.Set.Accumulate", "Mathlib.Data.Set.Pairwise.Lattice", "Mathlib.MeasureTheory.PiSystem" ]
Mathlib/MeasureTheory/SetSemiring.lean
empty_notMem_disjointOfDiffUnion
null
disjointOfDiffUnion_subset (hC : IsSetSemiring C) (hs : s ∈ C) (hI : ↑I ⊆ C) : ↑(hC.disjointOfDiffUnion hs hI) ⊆ C := by classical simp only [disjointOfDiffUnion, coe_sdiff, coe_singleton, diff_singleton_subset_iff] exact (hC.exists_disjoint_finset_diff_eq hs hI).choose_spec.1.trans (Set.subset_insert _ _)
lemma
MeasureTheory
[ "Mathlib.Data.Nat.Lattice", "Mathlib.Data.Set.Accumulate", "Mathlib.Data.Set.Pairwise.Lattice", "Mathlib.MeasureTheory.PiSystem" ]
Mathlib/MeasureTheory/SetSemiring.lean
disjointOfDiffUnion_subset
null
pairwiseDisjoint_disjointOfDiffUnion (hC : IsSetSemiring C) (hs : s ∈ C) (hI : ↑I ⊆ C) : PairwiseDisjoint (hC.disjointOfDiffUnion hs hI : Set (Set α)) id := by classical simp only [disjointOfDiffUnion, coe_sdiff, coe_singleton] exact Set.PairwiseDisjoint.subset (hC.exists_disjoint_finset_diff_eq hs hI).choose_spec.2.1 diff_subset
lemma
MeasureTheory
[ "Mathlib.Data.Nat.Lattice", "Mathlib.Data.Set.Accumulate", "Mathlib.Data.Set.Pairwise.Lattice", "Mathlib.MeasureTheory.PiSystem" ]
Mathlib/MeasureTheory/SetSemiring.lean
pairwiseDisjoint_disjointOfDiffUnion
null
diff_sUnion_eq_sUnion_disjointOfDiffUnion (hC : IsSetSemiring C) (hs : s ∈ C) (hI : ↑I ⊆ C) : s \ ⋃₀ I = ⋃₀ hC.disjointOfDiffUnion hs hI := by classical rw [(hC.exists_disjoint_finset_diff_eq hs hI).choose_spec.2.2] simp only [disjointOfDiffUnion, coe_sdiff, coe_singleton] rw [sUnion_diff_singleton_empty]
lemma
MeasureTheory
[ "Mathlib.Data.Nat.Lattice", "Mathlib.Data.Set.Accumulate", "Mathlib.Data.Set.Pairwise.Lattice", "Mathlib.MeasureTheory.PiSystem" ]
Mathlib/MeasureTheory/SetSemiring.lean
diff_sUnion_eq_sUnion_disjointOfDiffUnion
null
sUnion_disjointOfDiffUnion_subset (hC : IsSetSemiring C) (hs : s ∈ C) (hI : ↑I ⊆ C) : ⋃₀ (hC.disjointOfDiffUnion hs hI : Set (Set α)) ⊆ s := by rw [← hC.diff_sUnion_eq_sUnion_disjointOfDiffUnion] exact diff_subset
lemma
MeasureTheory
[ "Mathlib.Data.Nat.Lattice", "Mathlib.Data.Set.Accumulate", "Mathlib.Data.Set.Pairwise.Lattice", "Mathlib.MeasureTheory.PiSystem" ]
Mathlib/MeasureTheory/SetSemiring.lean
sUnion_disjointOfDiffUnion_subset
null
subset_of_diffUnion_disjointOfDiffUnion (hC : IsSetSemiring C) (hs : s ∈ C) (hI : ↑I ⊆ C) (t : Set α) (ht : t ∈ (hC.disjointOfDiffUnion hs hI : Set (Set α))) : t ⊆ s \ ⋃₀ I := by revert t ht rw [← sUnion_subset_iff, hC.diff_sUnion_eq_sUnion_disjointOfDiffUnion hs hI]
lemma
MeasureTheory
[ "Mathlib.Data.Nat.Lattice", "Mathlib.Data.Set.Accumulate", "Mathlib.Data.Set.Pairwise.Lattice", "Mathlib.MeasureTheory.PiSystem" ]
Mathlib/MeasureTheory/SetSemiring.lean
subset_of_diffUnion_disjointOfDiffUnion
null
subset_of_mem_disjointOfDiffUnion (hC : IsSetSemiring C) {I : Finset (Set α)} (hs : s ∈ C) (hI : ↑I ⊆ C) (t : Set α) (ht : t ∈ (hC.disjointOfDiffUnion hs hI : Set (Set α))) : t ⊆ s := by apply le_trans <| hC.subset_of_diffUnion_disjointOfDiffUnion hs hI t ht exact sdiff_le (a := s) (b := ⋃₀ I)
lemma
MeasureTheory
[ "Mathlib.Data.Nat.Lattice", "Mathlib.Data.Set.Accumulate", "Mathlib.Data.Set.Pairwise.Lattice", "Mathlib.MeasureTheory.PiSystem" ]
Mathlib/MeasureTheory/SetSemiring.lean
subset_of_mem_disjointOfDiffUnion
null
disjoint_sUnion_disjointOfDiffUnion (hC : IsSetSemiring C) (hs : s ∈ C) (hI : ↑I ⊆ C) : Disjoint (⋃₀ (I : Set (Set α))) (⋃₀ hC.disjointOfDiffUnion hs hI) := by rw [← hC.diff_sUnion_eq_sUnion_disjointOfDiffUnion]; exact Set.disjoint_sdiff_right
lemma
MeasureTheory
[ "Mathlib.Data.Nat.Lattice", "Mathlib.Data.Set.Accumulate", "Mathlib.Data.Set.Pairwise.Lattice", "Mathlib.MeasureTheory.PiSystem" ]
Mathlib/MeasureTheory/SetSemiring.lean
disjoint_sUnion_disjointOfDiffUnion
null
disjoint_disjointOfDiffUnion (hC : IsSetSemiring C) (hs : s ∈ C) (hI : ↑I ⊆ C) : Disjoint I (hC.disjointOfDiffUnion hs hI) := by by_contra h rw [Finset.not_disjoint_iff] at h obtain ⟨u, huI, hu_disjointOfDiffUnion⟩ := h have h_disj : u ≤ ⊥ := hC.disjoint_sUnion_disjointOfDiffUnion hs hI (subset_sUnion_of_mem huI) (subset_sUnion_of_mem hu_disjointOfDiffUnion) simp only [Set.bot_eq_empty, Set.le_eq_subset, subset_empty_iff] at h_disj refine hC.empty_notMem_disjointOfDiffUnion hs hI ?_ rwa [h_disj] at hu_disjointOfDiffUnion
lemma
MeasureTheory
[ "Mathlib.Data.Nat.Lattice", "Mathlib.Data.Set.Accumulate", "Mathlib.Data.Set.Pairwise.Lattice", "Mathlib.MeasureTheory.PiSystem" ]
Mathlib/MeasureTheory/SetSemiring.lean
disjoint_disjointOfDiffUnion
null
pairwiseDisjoint_union_disjointOfDiffUnion (hC : IsSetSemiring C) (hs : s ∈ C) (hI : ↑I ⊆ C) (h_dis : PairwiseDisjoint (I : Set (Set α)) id) : PairwiseDisjoint (I ∪ hC.disjointOfDiffUnion hs hI : Set (Set α)) id := by rw [pairwiseDisjoint_union] refine ⟨h_dis, hC.pairwiseDisjoint_disjointOfDiffUnion hs hI, fun u hu v hv _ ↦ ?_⟩ simp_rw [id] exact disjoint_of_subset (subset_sUnion_of_mem hu) (subset_sUnion_of_mem hv) (hC.disjoint_sUnion_disjointOfDiffUnion hs hI)
lemma
MeasureTheory
[ "Mathlib.Data.Nat.Lattice", "Mathlib.Data.Set.Accumulate", "Mathlib.Data.Set.Pairwise.Lattice", "Mathlib.MeasureTheory.PiSystem" ]
Mathlib/MeasureTheory/SetSemiring.lean
pairwiseDisjoint_union_disjointOfDiffUnion
null
sUnion_union_sUnion_disjointOfDiffUnion_of_subset (hC : IsSetSemiring C) (hs : s ∈ C) (hI : ↑I ⊆ C) (hI_ss : ∀ t ∈ I, t ⊆ s) : ⋃₀ I ∪ ⋃₀ hC.disjointOfDiffUnion hs hI = s := by conv_rhs => rw [← union_diff_cancel (Set.sUnion_subset hI_ss : ⋃₀ ↑I ⊆ s), hC.diff_sUnion_eq_sUnion_disjointOfDiffUnion hs hI]
lemma
MeasureTheory
[ "Mathlib.Data.Nat.Lattice", "Mathlib.Data.Set.Accumulate", "Mathlib.Data.Set.Pairwise.Lattice", "Mathlib.MeasureTheory.PiSystem" ]
Mathlib/MeasureTheory/SetSemiring.lean
sUnion_union_sUnion_disjointOfDiffUnion_of_subset
null
sUnion_union_disjointOfDiffUnion_of_subset (hC : IsSetSemiring C) (hs : s ∈ C) (hI : ↑I ⊆ C) (hI_ss : ∀ t ∈ I, t ⊆ s) [DecidableEq (Set α)] : ⋃₀ ↑(I ∪ hC.disjointOfDiffUnion hs hI) = s := by conv_rhs => rw [← sUnion_union_sUnion_disjointOfDiffUnion_of_subset hC hs hI hI_ss] simp_rw [coe_union] rw [sUnion_union]
lemma
MeasureTheory
[ "Mathlib.Data.Nat.Lattice", "Mathlib.Data.Set.Accumulate", "Mathlib.Data.Set.Pairwise.Lattice", "Mathlib.MeasureTheory.PiSystem" ]
Mathlib/MeasureTheory/SetSemiring.lean
sUnion_union_disjointOfDiffUnion_of_subset
null
disjointOfUnion_props (hC : IsSetSemiring C) (h1 : ↑J ⊆ C) : ∃ K : Set α → Finset (Set α), PairwiseDisjoint J K ∧ (∀ i ∈ J, ↑(K i) ⊆ C) ∧ PairwiseDisjoint (⋃ x ∈ J, (K x : Set (Set α))) id ∧ (∀ j ∈ J, ⋃₀ K j ⊆ j) ∧ (∀ j ∈ J, ∅ ∉ K j) ∧ ⋃₀ J = ⋃₀ (⋃ x ∈ J, (K x : Set (Set α))) := by classical induction J using Finset.cons_induction with | empty => simp | cons s J hJ hind => rw [cons_eq_insert, coe_insert, Set.insert_subset_iff] at h1 obtain ⟨K, hK0, ⟨hK1, hK2, hK3, hK4, hK5⟩⟩ := hind h1.2 let K1 : Set α → Finset (Set α) := fun (t : Set α) ↦ if t = s then (hC.disjointOfDiffUnion h1.1 h1.2) else K t have hK1s : K1 s = hC.disjointOfDiffUnion h1.1 h1.2 := by simp [K1] have hK1_of_ne t (ht : t ≠ s) : K1 t = K t := by simp [K1, ht] use K1 simp only [cons_eq_insert, mem_coe, Finset.mem_insert, sUnion_subset_iff, forall_eq_or_imp, coe_insert, sUnion_insert] have ht1' : ∀ x ∈ J, K1 x = K x := fun x hx ↦ hK1_of_ne _ (fun h_eq ↦ hJ (h_eq ▸ hx)) have ht2 : (⋃ x ∈ J, (K1 x : Set (Set α))) = ⋃ x ∈ J, ((K x : Set (Set α))) := by apply iUnion₂_congr intro x hx exact_mod_cast hK1_of_ne _ (ne_of_mem_of_not_mem hx hJ) simp only [hK1s] refine ⟨?_, ⟨hC.disjointOfDiffUnion_subset h1.1 h1.2, ?_⟩, ?_, ⟨hC.subset_of_mem_disjointOfDiffUnion h1.1 h1.2, ?_⟩, ?_, ?_⟩ · apply Set.Pairwise.insert · intro j hj i hi hij rw [Function.onFun, ht1' j hj, ht1' i hi] exact hK0 hj hi hij · intro i hi _ have h7 : Disjoint ↑(hC.disjointOfDiffUnion h1.1 h1.2) (K i : Set (Set α)) := by refine disjoint_of_sSup_disjoint_of_le_of_le (hC.subset_of_diffUnion_disjointOfDiffUnion h1.1 h1.2) ?_ (@disjoint_sdiff_left _ (⋃₀ J) s) (Or.inl (hC.empty_notMem_disjointOfDiffUnion h1.1 h1.2)) simp only [mem_coe, Set.le_eq_subset] apply sUnion_subset_iff.mp exact (hK3 i hi).trans (subset_sUnion_of_mem hi) have h8 : Function.onFun Disjoint K1 s i := by refine Finset.disjoint_iff_inter_eq_empty.mpr ?_ rw [ht1' i hi, hK1s] rw [Set.disjoint_iff_inter_eq_empty] at h7 exact_mod_cast h7 exact ⟨h8, Disjoint.symm h8⟩ · intro i hi rw [ht1' i hi] ...
theorem
MeasureTheory
[ "Mathlib.Data.Nat.Lattice", "Mathlib.Data.Set.Accumulate", "Mathlib.Data.Set.Pairwise.Lattice", "Mathlib.MeasureTheory.PiSystem" ]
Mathlib/MeasureTheory/SetSemiring.lean
disjointOfUnion_props
null
noncomputable disjointOfUnion (hC : IsSetSemiring C) (hJ : ↑J ⊆ C) (j : Set α) := (hC.disjointOfUnion_props hJ).choose j
def
MeasureTheory
[ "Mathlib.Data.Nat.Lattice", "Mathlib.Data.Set.Accumulate", "Mathlib.Data.Set.Pairwise.Lattice", "Mathlib.MeasureTheory.PiSystem" ]
Mathlib/MeasureTheory/SetSemiring.lean
disjointOfUnion
For some `hJ : J ⊆ C` and `j : Set α`, where `hC : IsSetSemiring C`, this is a `Finset (Set α)` such that `K j := hC.disjointOfUnion hJ` are disjoint and `⋃₀ K j ⊆ j`, for `j ∈ J`. Using these we write `⋃₀ J` as a disjoint union `⋃₀ J = ⋃₀ ⋃ x ∈ J, (K x)`. See `MeasureTheory.IsSetSemiring.disjointOfUnion_props`.
pairwiseDisjoint_disjointOfUnion (hC : IsSetSemiring C) (hJ : ↑J ⊆ C) : PairwiseDisjoint J (hC.disjointOfUnion hJ) := (Exists.choose_spec (hC.disjointOfUnion_props hJ)).1
lemma
MeasureTheory
[ "Mathlib.Data.Nat.Lattice", "Mathlib.Data.Set.Accumulate", "Mathlib.Data.Set.Pairwise.Lattice", "Mathlib.MeasureTheory.PiSystem" ]
Mathlib/MeasureTheory/SetSemiring.lean
pairwiseDisjoint_disjointOfUnion
null
disjointOfUnion_subset (hC : IsSetSemiring C) (hJ : ↑J ⊆ C) (hj : j ∈ J) : (disjointOfUnion hC hJ j : Set (Set α)) ⊆ C := (Exists.choose_spec (hC.disjointOfUnion_props hJ)).2.1 _ hj
lemma
MeasureTheory
[ "Mathlib.Data.Nat.Lattice", "Mathlib.Data.Set.Accumulate", "Mathlib.Data.Set.Pairwise.Lattice", "Mathlib.MeasureTheory.PiSystem" ]
Mathlib/MeasureTheory/SetSemiring.lean
disjointOfUnion_subset
null
pairwiseDisjoint_biUnion_disjointOfUnion (hC : IsSetSemiring C) (hJ : ↑J ⊆ C) : PairwiseDisjoint (⋃ x ∈ J, (hC.disjointOfUnion hJ x : Set (Set α))) id := (Exists.choose_spec (hC.disjointOfUnion_props hJ)).2.2.1
lemma
MeasureTheory
[ "Mathlib.Data.Nat.Lattice", "Mathlib.Data.Set.Accumulate", "Mathlib.Data.Set.Pairwise.Lattice", "Mathlib.MeasureTheory.PiSystem" ]
Mathlib/MeasureTheory/SetSemiring.lean
pairwiseDisjoint_biUnion_disjointOfUnion
null
pairwiseDisjoint_disjointOfUnion_of_mem (hC : IsSetSemiring C) (hJ : ↑J ⊆ C) (hj : j ∈ J) : PairwiseDisjoint (hC.disjointOfUnion hJ j : Set (Set α)) id := by apply PairwiseDisjoint.subset (hC.pairwiseDisjoint_biUnion_disjointOfUnion hJ) exact subset_iUnion₂_of_subset j hj fun ⦃a⦄ a ↦ a
lemma
MeasureTheory
[ "Mathlib.Data.Nat.Lattice", "Mathlib.Data.Set.Accumulate", "Mathlib.Data.Set.Pairwise.Lattice", "Mathlib.MeasureTheory.PiSystem" ]
Mathlib/MeasureTheory/SetSemiring.lean
pairwiseDisjoint_disjointOfUnion_of_mem
null
disjointOfUnion_subset_of_mem (hC : IsSetSemiring C) (hJ : ↑J ⊆ C) (hj : j ∈ J) : ⋃₀ hC.disjointOfUnion hJ j ⊆ j := (Exists.choose_spec (hC.disjointOfUnion_props hJ)).2.2.2.1 j hj
lemma
MeasureTheory
[ "Mathlib.Data.Nat.Lattice", "Mathlib.Data.Set.Accumulate", "Mathlib.Data.Set.Pairwise.Lattice", "Mathlib.MeasureTheory.PiSystem" ]
Mathlib/MeasureTheory/SetSemiring.lean
disjointOfUnion_subset_of_mem
null
subset_of_mem_disjointOfUnion (hC : IsSetSemiring C) (hJ : ↑J ⊆ C) (hj : j ∈ J) {x : Set α} (hx : x ∈ (hC.disjointOfUnion hJ) j) : x ⊆ j := sUnion_subset_iff.mp (hC.disjointOfUnion_subset_of_mem hJ hj) x hx
lemma
MeasureTheory
[ "Mathlib.Data.Nat.Lattice", "Mathlib.Data.Set.Accumulate", "Mathlib.Data.Set.Pairwise.Lattice", "Mathlib.MeasureTheory.PiSystem" ]
Mathlib/MeasureTheory/SetSemiring.lean
subset_of_mem_disjointOfUnion
null
empty_notMem_disjointOfUnion (hC : IsSetSemiring C) (hJ : ↑J ⊆ C) (hj : j ∈ J) : ∅ ∉ hC.disjointOfUnion hJ j := (Exists.choose_spec (hC.disjointOfUnion_props hJ)).2.2.2.2.1 j hj @[deprecated (since := "2025-05-24")] alias empty_nmem_disjointOfUnion := empty_notMem_disjointOfUnion
lemma
MeasureTheory
[ "Mathlib.Data.Nat.Lattice", "Mathlib.Data.Set.Accumulate", "Mathlib.Data.Set.Pairwise.Lattice", "Mathlib.MeasureTheory.PiSystem" ]
Mathlib/MeasureTheory/SetSemiring.lean
empty_notMem_disjointOfUnion
null
sUnion_disjointOfUnion (hC : IsSetSemiring C) (hJ : ↑J ⊆ C) : ⋃₀ ⋃ x ∈ J, (hC.disjointOfUnion hJ x : Set (Set α)) = ⋃₀ J := (Exists.choose_spec (hC.disjointOfUnion_props hJ)).2.2.2.2.2.symm
lemma
MeasureTheory
[ "Mathlib.Data.Nat.Lattice", "Mathlib.Data.Set.Accumulate", "Mathlib.Data.Set.Pairwise.Lattice", "Mathlib.MeasureTheory.PiSystem" ]
Mathlib/MeasureTheory/SetSemiring.lean
sUnion_disjointOfUnion
null
IsSetRing (C : Set (Set α)) : Prop where empty_mem : ∅ ∈ C union_mem ⦃s t : Set α⦄ : s ∈ C → t ∈ C → s ∪ t ∈ C diff_mem ⦃s t : Set α⦄ : s ∈ C → t ∈ C → s \ t ∈ C
structure
MeasureTheory
[ "Mathlib.Data.Nat.Lattice", "Mathlib.Data.Set.Accumulate", "Mathlib.Data.Set.Pairwise.Lattice", "Mathlib.MeasureTheory.PiSystem" ]
Mathlib/MeasureTheory/SetSemiring.lean
IsSetRing
A ring of sets `C` is a family of sets containing `∅`, stable by union and set difference. It is then also stable by intersection (see `IsSetRing.inter_mem`).
inter_mem (hC : IsSetRing C) (hs : s ∈ C) (ht : t ∈ C) : s ∩ t ∈ C := by rw [← diff_diff_right_self]; exact hC.diff_mem hs (hC.diff_mem hs ht)
lemma
MeasureTheory
[ "Mathlib.Data.Nat.Lattice", "Mathlib.Data.Set.Accumulate", "Mathlib.Data.Set.Pairwise.Lattice", "Mathlib.MeasureTheory.PiSystem" ]
Mathlib/MeasureTheory/SetSemiring.lean
inter_mem
null
isSetSemiring (hC : IsSetRing C) : IsSetSemiring C where empty_mem := hC.empty_mem inter_mem := fun _ hs _ ht => hC.inter_mem hs ht diff_eq_sUnion' := by refine fun s hs t ht => ⟨{s \ t}, ?_, ?_, ?_⟩ · simp only [coe_singleton, Set.singleton_subset_iff] exact hC.diff_mem hs ht · simp only [coe_singleton, pairwiseDisjoint_singleton] · simp only [coe_singleton, sUnion_singleton]
lemma
MeasureTheory
[ "Mathlib.Data.Nat.Lattice", "Mathlib.Data.Set.Accumulate", "Mathlib.Data.Set.Pairwise.Lattice", "Mathlib.MeasureTheory.PiSystem" ]
Mathlib/MeasureTheory/SetSemiring.lean
isSetSemiring
null
biUnion_mem {ι : Type*} (hC : IsSetRing C) {s : ι → Set α} (S : Finset ι) (hs : ∀ n ∈ S, s n ∈ C) : ⋃ i ∈ S, s i ∈ C := by classical induction S using Finset.induction with | empty => simp [hC.empty_mem] | insert i S _ h => simp_rw [← Finset.mem_coe, Finset.coe_insert, Set.biUnion_insert] refine hC.union_mem (hs i (mem_insert_self i S)) ?_ exact h (fun n hnS ↦ hs n (mem_insert_of_mem hnS))
lemma
MeasureTheory
[ "Mathlib.Data.Nat.Lattice", "Mathlib.Data.Set.Accumulate", "Mathlib.Data.Set.Pairwise.Lattice", "Mathlib.MeasureTheory.PiSystem" ]
Mathlib/MeasureTheory/SetSemiring.lean
biUnion_mem
null
biInter_mem {ι : Type*} (hC : IsSetRing C) {s : ι → Set α} (S : Finset ι) (hS : S.Nonempty) (hs : ∀ n ∈ S, s n ∈ C) : ⋂ i ∈ S, s i ∈ C := by classical induction hS using Finset.Nonempty.cons_induction with | singleton => simpa using hs | cons i S hiS _ h => simp_rw [← Finset.mem_coe, Finset.coe_cons, Set.biInter_insert] simp only [cons_eq_insert, Finset.mem_insert, forall_eq_or_imp] at hs refine hC.inter_mem hs.1 ?_ exact h (fun n hnS ↦ hs.2 n hnS)
lemma
MeasureTheory
[ "Mathlib.Data.Nat.Lattice", "Mathlib.Data.Set.Accumulate", "Mathlib.Data.Set.Pairwise.Lattice", "Mathlib.MeasureTheory.PiSystem" ]
Mathlib/MeasureTheory/SetSemiring.lean
biInter_mem
null
finsetSup_mem (hC : IsSetRing C) {ι : Type*} {s : ι → Set α} {t : Finset ι} (hs : ∀ i ∈ t, s i ∈ C) : t.sup s ∈ C := by classical induction t using Finset.induction_on with | empty => exact hC.empty_mem | insert m t hm ih => simpa only [sup_insert] using hC.union_mem (hs m <| mem_insert_self m t) (ih <| fun i hi ↦ hs _ <| mem_insert_of_mem hi)
lemma
MeasureTheory
[ "Mathlib.Data.Nat.Lattice", "Mathlib.Data.Set.Accumulate", "Mathlib.Data.Set.Pairwise.Lattice", "Mathlib.MeasureTheory.PiSystem" ]
Mathlib/MeasureTheory/SetSemiring.lean
finsetSup_mem
null
partialSups_mem {ι : Type*} [Preorder ι] [LocallyFiniteOrderBot ι] (hC : IsSetRing C) {s : ι → Set α} (hs : ∀ n, s n ∈ C) (n : ι) : partialSups s n ∈ C := by simpa only [partialSups_apply, sup'_eq_sup] using hC.finsetSup_mem (fun i hi ↦ hs i)
lemma
MeasureTheory
[ "Mathlib.Data.Nat.Lattice", "Mathlib.Data.Set.Accumulate", "Mathlib.Data.Set.Pairwise.Lattice", "Mathlib.MeasureTheory.PiSystem" ]
Mathlib/MeasureTheory/SetSemiring.lean
partialSups_mem
null
disjointed_mem {ι : Type*} [Preorder ι] [LocallyFiniteOrderBot ι] (hC : IsSetRing C) {s : ι → Set α} (hs : ∀ j, s j ∈ C) (i : ι) : disjointed s i ∈ C := disjointedRec (fun _ j ht ↦ hC.diff_mem ht <| hs j) (hs i)
lemma
MeasureTheory
[ "Mathlib.Data.Nat.Lattice", "Mathlib.Data.Set.Accumulate", "Mathlib.Data.Set.Pairwise.Lattice", "Mathlib.MeasureTheory.PiSystem" ]
Mathlib/MeasureTheory/SetSemiring.lean
disjointed_mem
null
iUnion_le_mem (hC : IsSetRing C) {s : ℕ → Set α} (hs : ∀ n, s n ∈ C) (n : ℕ) : (⋃ i ≤ n, s i) ∈ C := by induction n with | zero => simp [hs 0] | succ n hn => rw [biUnion_le_succ]; exact hC.union_mem hn (hs _)
theorem
MeasureTheory
[ "Mathlib.Data.Nat.Lattice", "Mathlib.Data.Set.Accumulate", "Mathlib.Data.Set.Pairwise.Lattice", "Mathlib.MeasureTheory.PiSystem" ]
Mathlib/MeasureTheory/SetSemiring.lean
iUnion_le_mem
null
iInter_le_mem (hC : IsSetRing C) {s : ℕ → Set α} (hs : ∀ n, s n ∈ C) (n : ℕ) : (⋂ i ≤ n, s i) ∈ C := by induction n with | zero => simp [hs 0] | succ n hn => rw [biInter_le_succ]; exact hC.inter_mem hn (hs _)
theorem
MeasureTheory
[ "Mathlib.Data.Nat.Lattice", "Mathlib.Data.Set.Accumulate", "Mathlib.Data.Set.Pairwise.Lattice", "Mathlib.MeasureTheory.PiSystem" ]
Mathlib/MeasureTheory/SetSemiring.lean
iInter_le_mem
null
accumulate_mem (hC : IsSetRing C) {s : ℕ → Set α} (hs : ∀ i, s i ∈ C) (n : ℕ) : Accumulate s n ∈ C := by induction n with | zero => simp [hs 0] | succ n hn => rw [accumulate_succ]; exact hC.union_mem hn (hs _)
theorem
MeasureTheory
[ "Mathlib.Data.Nat.Lattice", "Mathlib.Data.Set.Accumulate", "Mathlib.Data.Set.Pairwise.Lattice", "Mathlib.MeasureTheory.PiSystem" ]
Mathlib/MeasureTheory/SetSemiring.lean
accumulate_mem
null
ae_restrict_le_codiscreteWithin {α : Type*} [MeasurableSpace α] [TopologicalSpace α] [SecondCountableTopology α] {μ : Measure α} [NoAtoms μ] {U : Set α} (hU : MeasurableSet U) : ae (μ.restrict U) ≤ codiscreteWithin U := by intro s hs have := discreteTopology_of_codiscreteWithin hs rw [mem_ae_iff, Measure.restrict_apply' hU] apply Set.Countable.measure_zero (TopologicalSpace.separableSpace_iff_countable.1 inferInstance)
theorem
MeasureTheory
[ "Mathlib.MeasureTheory.Measure.Typeclasses.NoAtoms", "Mathlib.Topology.DiscreteSubset" ]
Mathlib/MeasureTheory/Topology.lean
ae_restrict_le_codiscreteWithin
Under reasonable assumptions, sets that are codiscrete within `U` are contained in the “almost everywhere” filter of co-null sets.
@[nolint checkUnivs] Language where /-- For every arity, a `Type*` of functions of that arity -/ Functions : ℕ → Type u /-- For every arity, a `Type*` of relations of that arity -/ Relations : ℕ → Type v
structure
ModelTheory
[ "Mathlib.SetTheory.Cardinal.Basic" ]
Mathlib/ModelTheory/Basic.lean
Language
A first-order language consists of a type of functions of every natural-number arity and a type of relations of every natural-number arity.
IsRelational : Prop := ∀ n, IsEmpty (L.Functions n)
abbrev
ModelTheory
[ "Mathlib.SetTheory.Cardinal.Basic" ]
Mathlib/ModelTheory/Basic.lean
IsRelational
A language is relational when it has no function symbols.
IsAlgebraic : Prop := ∀ n, IsEmpty (L.Relations n)
abbrev
ModelTheory
[ "Mathlib.SetTheory.Cardinal.Basic" ]
Mathlib/ModelTheory/Basic.lean
IsAlgebraic
A language is algebraic when it has no relation symbols.
protected empty : Language := ⟨fun _ => Empty, fun _ => Empty⟩ deriving IsAlgebraic, IsRelational
def
ModelTheory
[ "Mathlib.SetTheory.Cardinal.Basic" ]
Mathlib/ModelTheory/Basic.lean
empty
The empty language has no symbols.
protected sum (L' : Language.{u', v'}) : Language := ⟨fun n => L.Functions n ⊕ L'.Functions n, fun n => L.Relations n ⊕ L'.Relations n⟩
def
ModelTheory
[ "Mathlib.SetTheory.Cardinal.Basic" ]
Mathlib/ModelTheory/Basic.lean
sum
The sum of two languages consists of the disjoint union of their symbols.
protected Constants := L.Functions 0
abbrev
ModelTheory
[ "Mathlib.SetTheory.Cardinal.Basic" ]
Mathlib/ModelTheory/Basic.lean
Constants
The type of constants in a given language.
Symbols := (Σ l, L.Functions l) ⊕ (Σ l, L.Relations l)
abbrev
ModelTheory
[ "Mathlib.SetTheory.Cardinal.Basic" ]
Mathlib/ModelTheory/Basic.lean
Symbols
The type of symbols in a given language.
card : Cardinal := #L.Symbols variable {L} {L' : Language.{u', v'}}
def
ModelTheory
[ "Mathlib.SetTheory.Cardinal.Basic" ]
Mathlib/ModelTheory/Basic.lean
card
The cardinality of a language is the cardinality of its type of symbols.
card_eq_card_functions_add_card_relations : L.card = (Cardinal.sum fun l => Cardinal.lift.{v} #(L.Functions l)) + Cardinal.sum fun l => Cardinal.lift.{u} #(L.Relations l) := by simp only [card, mk_sum, mk_sigma, lift_sum]
theorem
ModelTheory
[ "Mathlib.SetTheory.Cardinal.Basic" ]
Mathlib/ModelTheory/Basic.lean
card_eq_card_functions_add_card_relations
null
isRelational_sum [L.IsRelational] [L'.IsRelational] : IsRelational (L.sum L') := fun _ => instIsEmptySum
instance
ModelTheory
[ "Mathlib.SetTheory.Cardinal.Basic" ]
Mathlib/ModelTheory/Basic.lean
isRelational_sum
null
isAlgebraic_sum [L.IsAlgebraic] [L'.IsAlgebraic] : IsAlgebraic (L.sum L') := fun _ => instIsEmptySum @[simp]
instance
ModelTheory
[ "Mathlib.SetTheory.Cardinal.Basic" ]
Mathlib/ModelTheory/Basic.lean
isAlgebraic_sum
null
card_empty : Language.empty.card = 0 := by simp only [card, mk_sum, mk_sigma, mk_eq_zero, sum_const, mk_eq_aleph0, lift_id', mul_zero, add_zero]
theorem
ModelTheory
[ "Mathlib.SetTheory.Cardinal.Basic" ]
Mathlib/ModelTheory/Basic.lean
card_empty
null
isEmpty_empty : IsEmpty Language.empty.Symbols := by simp only [Language.Symbols, isEmpty_sum, isEmpty_sigma] exact ⟨fun _ => inferInstance, fun _ => inferInstance⟩
instance
ModelTheory
[ "Mathlib.SetTheory.Cardinal.Basic" ]
Mathlib/ModelTheory/Basic.lean
isEmpty_empty
null
Countable.countable_functions [h : Countable L.Symbols] : Countable (Σ l, L.Functions l) := @Function.Injective.countable _ _ h _ Sum.inl_injective @[simp]
instance
ModelTheory
[ "Mathlib.SetTheory.Cardinal.Basic" ]
Mathlib/ModelTheory/Basic.lean
Countable.countable_functions
null
card_functions_sum (i : ℕ) : #((L.sum L').Functions i) = (Cardinal.lift.{u'} #(L.Functions i) + Cardinal.lift.{u} #(L'.Functions i) : Cardinal) := by simp [Language.sum] @[simp]
theorem
ModelTheory
[ "Mathlib.SetTheory.Cardinal.Basic" ]
Mathlib/ModelTheory/Basic.lean
card_functions_sum
null
card_relations_sum (i : ℕ) : #((L.sum L').Relations i) = Cardinal.lift.{v'} #(L.Relations i) + Cardinal.lift.{v} #(L'.Relations i) := by simp [Language.sum]
theorem
ModelTheory
[ "Mathlib.SetTheory.Cardinal.Basic" ]
Mathlib/ModelTheory/Basic.lean
card_relations_sum
null
card_sum : (L.sum L').card = Cardinal.lift.{max u' v'} L.card + Cardinal.lift.{max u v} L'.card := by simp only [card, mk_sum, mk_sigma, card_functions_sum, sum_add_distrib', lift_add, lift_sum, lift_lift, card_relations_sum, add_assoc, add_comm (Cardinal.sum fun i => (#(L'.Functions i)).lift)]
theorem
ModelTheory
[ "Mathlib.SetTheory.Cardinal.Basic" ]
Mathlib/ModelTheory/Basic.lean
card_sum
null
instDecidableEqFunctions {f : ℕ → Type*} {R : ℕ → Type*} (n : ℕ) [DecidableEq (f n)] : DecidableEq ((⟨f, R⟩ : Language).Functions n) := inferInstance
instance
ModelTheory
[ "Mathlib.SetTheory.Cardinal.Basic" ]
Mathlib/ModelTheory/Basic.lean
instDecidableEqFunctions
Passes a `DecidableEq` instance on a type of function symbols through the `Language` constructor. Despite the fact that this is proven by `inferInstance`, it is still needed - see the `example`s in `ModelTheory/Ring/Basic`.
instDecidableEqRelations {f : ℕ → Type*} {R : ℕ → Type*} (n : ℕ) [DecidableEq (R n)] : DecidableEq ((⟨f, R⟩ : Language).Relations n) := inferInstance variable (L) (M : Type w)
instance
ModelTheory
[ "Mathlib.SetTheory.Cardinal.Basic" ]
Mathlib/ModelTheory/Basic.lean
instDecidableEqRelations
Passes a `DecidableEq` instance on a type of relation symbols through the `Language` constructor. Despite the fact that this is proven by `inferInstance`, it is still needed - see the `example`s in `ModelTheory/Ring/Basic`.
@[ext] Structure where /-- Interpretation of the function symbols -/ funMap : ∀ {n}, L.Functions n → (Fin n → M) → M := by exact fun {n} => isEmptyElim /-- Interpretation of the relation symbols -/ RelMap : ∀ {n}, L.Relations n → (Fin n → M) → Prop := by exact fun {n} => isEmptyElim variable (N : Type w') [L.Structure M] [L.Structure N] open Structure
class
ModelTheory
[ "Mathlib.SetTheory.Cardinal.Basic" ]
Mathlib/ModelTheory/Basic.lean
Structure
A first-order structure on a type `M` consists of interpretations of all the symbols in a given language. Each function of arity `n` is interpreted as a function sending tuples of length `n` (modeled as `(Fin n → M)`) to `M`, and a relation of arity `n` is a function from tuples of length `n` to `Prop`.
Inhabited.trivialStructure {α : Type*} [Inhabited α] : L.Structure α := ⟨default, default⟩ /-! ### Maps -/
def
ModelTheory
[ "Mathlib.SetTheory.Cardinal.Basic" ]
Mathlib/ModelTheory/Basic.lean
Inhabited.trivialStructure
Used for defining `FirstOrder.Language.Theory.ModelType.instInhabited`.
Hom where /-- The underlying function of a homomorphism of structures -/ toFun : M → N /-- The homomorphism commutes with the interpretations of the function symbols -/ map_fun' : ∀ {n} (f : L.Functions n) (x), toFun (funMap f x) = funMap f (toFun ∘ x) := by intros; trivial /-- The homomorphism sends related elements to related elements -/ map_rel' : ∀ {n} (r : L.Relations n) (x), RelMap r x → RelMap r (toFun ∘ x) := by intros; trivial @[inherit_doc] scoped[FirstOrder] notation:25 A " →[" L "] " B => FirstOrder.Language.Hom L A B
structure
ModelTheory
[ "Mathlib.SetTheory.Cardinal.Basic" ]
Mathlib/ModelTheory/Basic.lean
Hom
A homomorphism between first-order structures is a function that commutes with the interpretations of functions and maps tuples in one structure where a given relation is true to tuples in the second structure where that relation is still true.
Embedding extends M ↪ N where map_fun' : ∀ {n} (f : L.Functions n) (x), toFun (funMap f x) = funMap f (toFun ∘ x) := by intros; trivial map_rel' : ∀ {n} (r : L.Relations n) (x), RelMap r (toFun ∘ x) ↔ RelMap r x := by intros; trivial @[inherit_doc] scoped[FirstOrder] notation:25 A " ↪[" L "] " B => FirstOrder.Language.Embedding L A B
structure
ModelTheory
[ "Mathlib.SetTheory.Cardinal.Basic" ]
Mathlib/ModelTheory/Basic.lean
Embedding
An embedding of first-order structures is an embedding that commutes with the interpretations of functions and relations.
Equiv extends M ≃ N where map_fun' : ∀ {n} (f : L.Functions n) (x), toFun (funMap f x) = funMap f (toFun ∘ x) := by intros; trivial map_rel' : ∀ {n} (r : L.Relations n) (x), RelMap r (toFun ∘ x) ↔ RelMap r x := by intros; trivial @[inherit_doc] scoped[FirstOrder] notation:25 A " ≃[" L "] " B => FirstOrder.Language.Equiv L A B variable {L M N} {P : Type*} [L.Structure P] {Q : Type*} [L.Structure Q]
structure
ModelTheory
[ "Mathlib.SetTheory.Cardinal.Basic" ]
Mathlib/ModelTheory/Basic.lean
Equiv
An equivalence of first-order structures is an equivalence that commutes with the interpretations of functions and relations.
@[coe] constantMap (c : L.Constants) : M := funMap c default
def
ModelTheory
[ "Mathlib.SetTheory.Cardinal.Basic" ]
Mathlib/ModelTheory/Basic.lean
constantMap
Interpretation of a constant symbol
funMap_eq_coe_constants {c : L.Constants} {x : Fin 0 → M} : funMap c x = c := congr rfl (funext finZeroElim)
theorem
ModelTheory
[ "Mathlib.SetTheory.Cardinal.Basic" ]
Mathlib/ModelTheory/Basic.lean
funMap_eq_coe_constants
null
nonempty_of_nonempty_constants [h : Nonempty L.Constants] : Nonempty M := h.map (↑)
theorem
ModelTheory
[ "Mathlib.SetTheory.Cardinal.Basic" ]
Mathlib/ModelTheory/Basic.lean
nonempty_of_nonempty_constants
Given a language with a nonempty type of constants, any structure will be nonempty. This cannot be a global instance, because `L` becomes a metavariable.
HomClass (L : outParam Language) (F : Type*) (M N : outParam Type*) [FunLike F M N] [L.Structure M] [L.Structure N] : Prop where map_fun : ∀ (φ : F) {n} (f : L.Functions n) (x), φ (funMap f x) = funMap f (φ ∘ x) map_rel : ∀ (φ : F) {n} (r : L.Relations n) (x), RelMap r x → RelMap r (φ ∘ x)
class
ModelTheory
[ "Mathlib.SetTheory.Cardinal.Basic" ]
Mathlib/ModelTheory/Basic.lean
HomClass
`HomClass L F M N` states that `F` is a type of `L`-homomorphisms. You should extend this typeclass when you extend `FirstOrder.Language.Hom`.
StrongHomClass (L : outParam Language) (F : Type*) (M N : outParam Type*) [FunLike F M N] [L.Structure M] [L.Structure N] : Prop where map_fun : ∀ (φ : F) {n} (f : L.Functions n) (x), φ (funMap f x) = funMap f (φ ∘ x) map_rel : ∀ (φ : F) {n} (r : L.Relations n) (x), RelMap r (φ ∘ x) ↔ RelMap r x
class
ModelTheory
[ "Mathlib.SetTheory.Cardinal.Basic" ]
Mathlib/ModelTheory/Basic.lean
StrongHomClass
`StrongHomClass L F M N` states that `F` is a type of `L`-homomorphisms which preserve relations in both directions.
HomClass.strongHomClassOfIsAlgebraic [L.IsAlgebraic] {F M N} [L.Structure M] [L.Structure N] [FunLike F M N] [HomClass L F M N] : StrongHomClass L F M N where map_fun := HomClass.map_fun map_rel _ _ := isEmptyElim
theorem
ModelTheory
[ "Mathlib.SetTheory.Cardinal.Basic" ]
Mathlib/ModelTheory/Basic.lean
HomClass.strongHomClassOfIsAlgebraic
Not an instance to avoid a loop.
HomClass.map_constants {F M N} [L.Structure M] [L.Structure N] [FunLike F M N] [HomClass L F M N] (φ : F) (c : L.Constants) : φ c = c := (HomClass.map_fun φ c default).trans (congr rfl (funext default)) attribute [inherit_doc FirstOrder.Language.Hom.map_fun'] FirstOrder.Language.Embedding.map_fun' FirstOrder.Language.HomClass.map_fun FirstOrder.Language.StrongHomClass.map_fun FirstOrder.Language.Equiv.map_fun' attribute [inherit_doc FirstOrder.Language.Hom.map_rel'] FirstOrder.Language.Embedding.map_rel' FirstOrder.Language.HomClass.map_rel FirstOrder.Language.StrongHomClass.map_rel FirstOrder.Language.Equiv.map_rel'
theorem
ModelTheory
[ "Mathlib.SetTheory.Cardinal.Basic" ]
Mathlib/ModelTheory/Basic.lean
HomClass.map_constants
null
instFunLike : FunLike (M →[L] N) M N where coe := Hom.toFun coe_injective' f g h := by cases f; cases g; cases h; rfl
instance
ModelTheory
[ "Mathlib.SetTheory.Cardinal.Basic" ]
Mathlib/ModelTheory/Basic.lean
instFunLike
null
homClass : HomClass L (M →[L] N) M N where map_fun := map_fun' map_rel := map_rel'
instance
ModelTheory
[ "Mathlib.SetTheory.Cardinal.Basic" ]
Mathlib/ModelTheory/Basic.lean
homClass
null
@[simp] toFun_eq_coe {f : M →[L] N} : f.toFun = (f : M → N) := rfl @[ext]
theorem
ModelTheory
[ "Mathlib.SetTheory.Cardinal.Basic" ]
Mathlib/ModelTheory/Basic.lean
toFun_eq_coe
null
ext ⦃f g : M →[L] N⦄ (h : ∀ x, f x = g x) : f = g := DFunLike.ext f g h @[simp]
theorem
ModelTheory
[ "Mathlib.SetTheory.Cardinal.Basic" ]
Mathlib/ModelTheory/Basic.lean
ext
null
map_fun (φ : M →[L] N) {n : ℕ} (f : L.Functions n) (x : Fin n → M) : φ (funMap f x) = funMap f (φ ∘ x) := HomClass.map_fun φ f x @[simp]
theorem
ModelTheory
[ "Mathlib.SetTheory.Cardinal.Basic" ]
Mathlib/ModelTheory/Basic.lean
map_fun
null
map_constants (φ : M →[L] N) (c : L.Constants) : φ c = c := HomClass.map_constants φ c @[simp]
theorem
ModelTheory
[ "Mathlib.SetTheory.Cardinal.Basic" ]
Mathlib/ModelTheory/Basic.lean
map_constants
null
map_rel (φ : M →[L] N) {n : ℕ} (r : L.Relations n) (x : Fin n → M) : RelMap r x → RelMap r (φ ∘ x) := HomClass.map_rel φ r x variable (L) (M)
theorem
ModelTheory
[ "Mathlib.SetTheory.Cardinal.Basic" ]
Mathlib/ModelTheory/Basic.lean
map_rel
null
@[refl] id : M →[L] M where toFun m := m variable {L} {M}
def
ModelTheory
[ "Mathlib.SetTheory.Cardinal.Basic" ]
Mathlib/ModelTheory/Basic.lean
id
The identity map from a structure to itself.
@[simp] id_apply (x : M) : id L M x = x := rfl
theorem
ModelTheory
[ "Mathlib.SetTheory.Cardinal.Basic" ]
Mathlib/ModelTheory/Basic.lean
id_apply
null
@[trans] comp (hnp : N →[L] P) (hmn : M →[L] N) : M →[L] P where toFun := hnp ∘ hmn map_fun' _ _ := by simp; rfl map_rel' _ _ h := map_rel _ _ _ (map_rel _ _ _ h) @[simp]
def
ModelTheory
[ "Mathlib.SetTheory.Cardinal.Basic" ]
Mathlib/ModelTheory/Basic.lean
comp
Composition of first-order homomorphisms.
comp_apply (g : N →[L] P) (f : M →[L] N) (x : M) : g.comp f x = g (f x) := rfl
theorem
ModelTheory
[ "Mathlib.SetTheory.Cardinal.Basic" ]
Mathlib/ModelTheory/Basic.lean
comp_apply
null
comp_assoc (f : M →[L] N) (g : N →[L] P) (h : P →[L] Q) : (h.comp g).comp f = h.comp (g.comp f) := rfl @[simp]
theorem
ModelTheory
[ "Mathlib.SetTheory.Cardinal.Basic" ]
Mathlib/ModelTheory/Basic.lean
comp_assoc
Composition of first-order homomorphisms is associative.
comp_id (f : M →[L] N) : f.comp (id L M) = f := rfl @[simp]
theorem
ModelTheory
[ "Mathlib.SetTheory.Cardinal.Basic" ]
Mathlib/ModelTheory/Basic.lean
comp_id
null
id_comp (f : M →[L] N) : (id L N).comp f = f := rfl
theorem
ModelTheory
[ "Mathlib.SetTheory.Cardinal.Basic" ]
Mathlib/ModelTheory/Basic.lean
id_comp
null
@[simps] HomClass.toHom {F M N} [L.Structure M] [L.Structure N] [FunLike F M N] [HomClass L F M N] : F → M →[L] N := fun φ => ⟨φ, HomClass.map_fun φ, HomClass.map_rel φ⟩
def
ModelTheory
[ "Mathlib.SetTheory.Cardinal.Basic" ]
Mathlib/ModelTheory/Basic.lean
HomClass.toHom
Any element of a `HomClass` can be realized as a first_order homomorphism.
funLike : FunLike (M ↪[L] N) M N where coe f := f.toFun coe_injective' f g h := by cases f cases g congr ext x exact funext_iff.1 h x
instance
ModelTheory
[ "Mathlib.SetTheory.Cardinal.Basic" ]
Mathlib/ModelTheory/Basic.lean
funLike
null
embeddingLike : EmbeddingLike (M ↪[L] N) M N where injective' f := f.toEmbedding.injective
instance
ModelTheory
[ "Mathlib.SetTheory.Cardinal.Basic" ]
Mathlib/ModelTheory/Basic.lean
embeddingLike
null
strongHomClass : StrongHomClass L (M ↪[L] N) M N where map_fun := map_fun' map_rel := map_rel' @[simp]
instance
ModelTheory
[ "Mathlib.SetTheory.Cardinal.Basic" ]
Mathlib/ModelTheory/Basic.lean
strongHomClass
null
map_fun (φ : M ↪[L] N) {n : ℕ} (f : L.Functions n) (x : Fin n → M) : φ (funMap f x) = funMap f (φ ∘ x) := HomClass.map_fun φ f x @[simp]
theorem
ModelTheory
[ "Mathlib.SetTheory.Cardinal.Basic" ]
Mathlib/ModelTheory/Basic.lean
map_fun
null
map_constants (φ : M ↪[L] N) (c : L.Constants) : φ c = c := HomClass.map_constants φ c @[simp]
theorem
ModelTheory
[ "Mathlib.SetTheory.Cardinal.Basic" ]
Mathlib/ModelTheory/Basic.lean
map_constants
null
map_rel (φ : M ↪[L] N) {n : ℕ} (r : L.Relations n) (x : Fin n → M) : RelMap r (φ ∘ x) ↔ RelMap r x := StrongHomClass.map_rel φ r x
theorem
ModelTheory
[ "Mathlib.SetTheory.Cardinal.Basic" ]
Mathlib/ModelTheory/Basic.lean
map_rel
null
toHom : (M ↪[L] N) → M →[L] N := HomClass.toHom @[simp]
def
ModelTheory
[ "Mathlib.SetTheory.Cardinal.Basic" ]
Mathlib/ModelTheory/Basic.lean
toHom
A first-order embedding is also a first-order homomorphism.
coe_toHom {f : M ↪[L] N} : (f.toHom : M → N) = f := rfl
theorem
ModelTheory
[ "Mathlib.SetTheory.Cardinal.Basic" ]
Mathlib/ModelTheory/Basic.lean
coe_toHom
null
coe_injective : @Function.Injective (M ↪[L] N) (M → N) (↑) | f, g, h => by cases f cases g congr ext x exact funext_iff.1 h x @[ext]
theorem
ModelTheory
[ "Mathlib.SetTheory.Cardinal.Basic" ]
Mathlib/ModelTheory/Basic.lean
coe_injective
null
ext ⦃f g : M ↪[L] N⦄ (h : ∀ x, f x = g x) : f = g := coe_injective (funext h)
theorem
ModelTheory
[ "Mathlib.SetTheory.Cardinal.Basic" ]
Mathlib/ModelTheory/Basic.lean
ext
null
toHom_injective : @Function.Injective (M ↪[L] N) (M →[L] N) (·.toHom) := by intro f f' h ext exact congr_fun (congr_arg (↑) h) _ @[simp]
theorem
ModelTheory
[ "Mathlib.SetTheory.Cardinal.Basic" ]
Mathlib/ModelTheory/Basic.lean
toHom_injective
null
toHom_inj {f g : M ↪[L] N} : f.toHom = g.toHom ↔ f = g := ⟨fun h ↦ toHom_injective h, fun h ↦ congr_arg (·.toHom) h⟩
theorem
ModelTheory
[ "Mathlib.SetTheory.Cardinal.Basic" ]
Mathlib/ModelTheory/Basic.lean
toHom_inj
null
injective (f : M ↪[L] N) : Function.Injective f := f.toEmbedding.injective
theorem
ModelTheory
[ "Mathlib.SetTheory.Cardinal.Basic" ]
Mathlib/ModelTheory/Basic.lean
injective
null
@[simps!] ofInjective [L.IsAlgebraic] {f : M →[L] N} (hf : Function.Injective f) : M ↪[L] N := { f with inj' := hf map_rel' := fun {_} r x => StrongHomClass.map_rel f r x } @[simp]
def
ModelTheory
[ "Mathlib.SetTheory.Cardinal.Basic" ]
Mathlib/ModelTheory/Basic.lean
ofInjective
In an algebraic language, any injective homomorphism is an embedding.