Skip to content
This repository has been archived by the owner on Jul 24, 2024. It is now read-only.

[Merged by Bors] - feat(order/ideal, order/pfilter, order/prime_ideal): added ideal_inter_nonempty, proved that a maximal ideal is prime #6924

Closed
wants to merge 73 commits into from
Closed
Show file tree
Hide file tree
Changes from 60 commits
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
367ba3a
feat(order/ideal) added is_prime and is_maximal ideals
atarnoam Mar 12, 2021
fa268b1
Update src/order/ideal.lean
atarnoam Mar 12, 2021
ad910d6
Update src/order/ideal.lean
atarnoam Mar 12, 2021
79b765d
Update src/order/ideal.lean
atarnoam Mar 12, 2021
4d2b2da
Update src/order/ideal.lean
atarnoam Mar 12, 2021
0ff4f09
Update src/order/ideal.lean
atarnoam Mar 12, 2021
6e472a5
Update src/order/ideal.lean
atarnoam Mar 12, 2021
c6d2b3d
Update src/order/ideal.lean
atarnoam Mar 12, 2021
ae380c3
starting to work on is_prime_of_is_maximal
atarnoam Mar 12, 2021
663f793
Update ideal.lean
atarnoam Mar 12, 2021
d6076c7
Merge remote-tracking branch 'refs/remotes/origin/prime_ideal' into p…
atarnoam Mar 12, 2021
3e76e40
Merge branch 'prime_ideal' of github.com:leanprover-community/mathlib…
atarnoam Mar 12, 2021
3217ff6
Update ideal.lean
atarnoam Mar 12, 2021
2be706e
fixed bugs
atarnoam Mar 12, 2021
9cd7320
Merge remote-tracking branch 'refs/remotes/origin/prime_ideal' into p…
atarnoam Mar 12, 2021
e0c3590
Update ideal.lean
atarnoam Mar 12, 2021
7cb44dc
Update ideal.lean
atarnoam Mar 12, 2021
f6a3300
removed prime_of_is_maximal
atarnoam Mar 12, 2021
2d337d8
Merge branch 'prime_ideal' of github.com:leanprover-community/mathlib…
atarnoam Mar 12, 2021
ed01b5f
Update src/order/ideal.lean
atarnoam Mar 13, 2021
8c597f1
Made the lattice instance of I more general.
atarnoam Mar 13, 2021
472ebac
Changed `proper` to `is_proper`
atarnoam Mar 13, 2021
e63fe2b
Merge branch 'prime_ideal' of github.com:leanprover-community/mathlib…
atarnoam Mar 13, 2021
926c4ed
`is_prime`, `is_maximal` now extend `is_proper`.
atarnoam Mar 13, 2021
8fc4dcf
made `is_maximal` and `is_prime` to typeclasses.
atarnoam Mar 13, 2021
1d1dbfe
Update src/order/ideal.lean
atarnoam Mar 13, 2021
6bab0df
Update src/order/ideal.lean
atarnoam Mar 13, 2021
7813092
added `is_ideal`, `is_filter`, `prime_pair`
atarnoam Mar 13, 2021
e3a09e8
Merge branch 'prime_ideal' into is_prime_of_is_maximal
atarnoam Mar 13, 2021
52ae523
Update prime_ideal.lean
atarnoam Mar 13, 2021
3abbe48
If `I` is prime, `x \inf y \in I`,
atarnoam Mar 13, 2021
c9ac5c4
Update src/order/pfilter.lean
atarnoam Mar 15, 2021
4974ff1
Update src/order/pfilter.lean
atarnoam Mar 15, 2021
a3c2c0c
Update src/order/pfilter.lean
atarnoam Mar 15, 2021
89257a7
Update src/order/pfilter.lean
atarnoam Mar 15, 2021
7a70b0d
Update src/order/prime_ideal.lean
atarnoam Mar 15, 2021
dc4dca8
Update src/order/ideal.lean
atarnoam Mar 15, 2021
e0a1b83
Update src/order/prime_ideal.lean
atarnoam Mar 15, 2021
23907a7
Update src/order/prime_ideal.lean
atarnoam Mar 15, 2021
f175e85
Update src/order/prime_ideal.lean
atarnoam Mar 15, 2021
9663a56
Update src/order/prime_ideal.lean
atarnoam Mar 15, 2021
9c591ca
Update pfilter.lean
atarnoam Mar 15, 2021
f611e16
Update src/order/ideal.lean
atarnoam Mar 16, 2021
3bda7c6
Apply suggestions from code review
atarnoam Mar 16, 2021
619ea26
Merge remote-tracking branch 'community/master' into prime_ideal
bryangingechen Mar 20, 2021
3e2f540
fix, style tweaks
bryangingechen Mar 20, 2021
a0beea8
add order.pfilter.is_prime
bryangingechen Mar 20, 2021
604475c
Update src/order/prime_ideal.lean
bryangingechen Mar 20, 2021
26954c4
use compl in prime_pair
bryangingechen Mar 20, 2021
cb8b1d6
Merge remote-tracking branch 'community/prime_ideal' into prime_ideal
bryangingechen Mar 20, 2021
18e5500
Update src/order/pfilter.lean
bryangingechen Mar 20, 2021
0d0cf5a
naming
bryangingechen Mar 20, 2021
feaa40b
disjoint, cover
bryangingechen Mar 20, 2021
ccf25f2
use is_compl in prime_pair
bryangingechen Mar 20, 2021
255a361
golf
bryangingechen Mar 20, 2021
9e9e67d
Merge branch 'prime_ideal' into is_prime_of_is_maximal
atarnoam Mar 26, 2021
0a4cea2
proved that a maximal ideal is prime
atarnoam Mar 28, 2021
52ec220
Added documentation
atarnoam Mar 28, 2021
e38c4b5
set lower priority
atarnoam Mar 28, 2021
fafe945
Merge branch 'master' into is_prime_of_is_maximal
atarnoam Apr 2, 2021
561095a
Update src/order/ideal.lean
atarnoam Apr 2, 2021
8bf9cd4
Update src/order/pfilter.lean
atarnoam Apr 2, 2021
2bfd823
Update src/order/ideal.lean
atarnoam Apr 2, 2021
7e79f24
Update src/order/ideal.lean
atarnoam Apr 2, 2021
e9e4544
Update src/order/ideal.lean
atarnoam Apr 2, 2021
4b79c1a
Update src/order/prime_ideal.lean
atarnoam Apr 2, 2021
8a1f2bc
Update src/order/prime_ideal.lean
atarnoam Apr 2, 2021
ee19aee
removed attribute simp from mem_def
atarnoam Apr 2, 2021
1d2bf9b
Update src/order/ideal.lean
atarnoam Apr 8, 2021
667a4a2
changed mem_def to mem_coe
atarnoam Apr 8, 2021
06ac08d
applied CR
atarnoam Apr 11, 2021
a028592
applied CR
atarnoam Apr 11, 2021
b91a965
Update src/order/ideal.lean
atarnoam Apr 14, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
105 changes: 93 additions & 12 deletions src/order/ideal.lean
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,18 @@ import order.atoms

Throughout this file, `P` is at least a preorder, but some sections require more
structure, such as a bottom element, a top element, or a join-semilattice structure.

- `order.ideal P`: the type of nonempty, upward directed, and downward closed subsets of `P`.
Dual to the notion of a filter on a preorder.
- `order.is_ideal P`: a predicate for when a `set P` is an ideal.
- `order.ideal.principal p`: the principal ideal generated by `p : P`.
- `order.ideal.is_proper P`: a predicate for proper ideals.
Dual to the notion of a proper filter.
- `order.ideal.is_prime`: a predicate for prime ideals.
Dual to the notion of a prime filter.
atarnoam marked this conversation as resolved.
Show resolved Hide resolved
- `order.ideal.is_maximal`: a predicate for maximal ideals.
Dual to the notion of an ultrafilter.
- `ideal_inter_nonempty P`: a predicate for when the intersection of any two ideals of
`P` is nonempty.
- `order.cofinal P`: the type of subsets of `P` containing arbitrarily large elements.
Dual to the notion of 'dense set' used in forcing.
- `order.ideal_of_cofinals p 𝒟`, where `p : P`, and `𝒟` is a countable family of cofinal
Expand Down Expand Up @@ -72,10 +75,22 @@ structure ideal (P) [preorder P] :=
def is_ideal.to_ideal [preorder P] {I : set P} (h : is_ideal I) : ideal P :=
⟨I, h.1, h.2, h.3⟩

/-- A preorder `P` has the `ideal_inter_nonempty` property if the
intersection of any two ideals is nonempty.
Most importantly, a `semilattice_sup` preorder with this property
satisfies that its ideal poset is a lattice.
-/
class ideal_inter_nonempty (P) [preorder P] : Prop :=
(inter_nonempty : ∀ (I J : ideal P), (I.carrier ∩ J.carrier).nonempty)

lemma inter_nonempty [preorder P] [ideal_inter_nonempty P] :
∀ (I J : ideal P), (I.carrier ∩ J.carrier).nonempty :=
ideal_inter_nonempty.inter_nonempty

namespace ideal

section preorder
variables [preorder P] {x : P} {I J : ideal P}
variables [preorder P] {x y : P} {I J : ideal P}

/-- The smallest ideal containing a given element. -/
def principal (p : P) : ideal P :=
Expand All @@ -93,6 +108,10 @@ instance : has_coe (ideal P) (set P) := ⟨carrier⟩
/-- For the notation `x ∈ I`. -/
instance : has_mem P (ideal P) := ⟨λ x I, x ∈ (I : set P)⟩

@[simp] lemma mem_def : x ∈ I ↔ x ∈ (I : set P) := iff_of_eq rfl
atarnoam marked this conversation as resolved.
Show resolved Hide resolved

@[simp] lemma mem_principal : y ∈ principal x ↔ y ≤ x := by refl
bryangingechen marked this conversation as resolved.
Show resolved Hide resolved

/-- Two ideals are equal when their underlying sets are equal. -/
@[ext] lemma ext : ∀ (I J : ideal P), (I : set P) = J → I = J
| ⟨_, _, _, _⟩ ⟨_, _, _, _⟩ rfl := rfl
Expand All @@ -114,6 +133,9 @@ instance : partial_order (ideal P) := partial_order.lift coe ext
⟨λ (h : ∀ {y}, y ≤ x → y ∈ I), h (le_refl x),
λ h_mem y (h_le : y ≤ x), I.mem_of_le h_le h_mem⟩

lemma compl_mem_of_ge {x y : P} : x ≤ y → x ∈ (I : set P)ᶜ → y ∈ (I : set P)ᶜ :=
bryangingechen marked this conversation as resolved.
Show resolved Hide resolved
λ h, mt (I.mem_of_le h)

/-- A proper ideal is one that is not the whole set.
Note that the whole set might not be an ideal. -/
@[mk_iff] class is_proper (I : ideal P) : Prop := (ne_univ : (I : set P) ≠ set.univ)
Expand All @@ -129,7 +151,7 @@ end⟩
Note that we cannot use the `is_coatom` class because `P` might not have a `top` element.
-/
@[mk_iff] class is_maximal (I : ideal P) extends is_proper I : Prop :=
(maximal_proper : ∀ J : ideal P, I < J → J.carrier = set.univ)
(maximal_proper : ∀ {J : ideal P}, I < J → J.carrier = set.univ)
atarnoam marked this conversation as resolved.
Show resolved Hide resolved

end preorder

Expand Down Expand Up @@ -191,7 +213,7 @@ lemma is_proper_iff_ne_top {I : ideal P} : is_proper I ↔ I ≠ ⊤ :=

lemma is_maximal.is_coatom {I : ideal P} (h : is_maximal I) : is_coatom I :=
⟨is_maximal.to_is_proper.ne_top,
λ J _, by { rw [ext'_iff, top_coe], exact is_maximal.maximal_proper J ‹_› }⟩
λ _ _, by { rw [ext'_iff, top_coe], exact is_maximal.maximal_proper ‹_› }⟩

lemma is_maximal.is_coatom' {I : ideal P} [is_maximal I] : is_coatom I :=
is_maximal.is_coatom ‹_›
Expand Down Expand Up @@ -219,20 +241,22 @@ I.mem_of_le (sup_le hx hy) h_mem

end semilattice_sup

section semilattice_sup_bot
variables [semilattice_sup_bot P] (I J K : ideal P)
section semilattice_sup_ideal_inter_nonempty

/-- The intersection of two ideals is an ideal, when `P` has joins and a bottom. -/
variables [semilattice_sup P] [ideal_inter_nonempty P]
variables (I J K : ideal P)
bryangingechen marked this conversation as resolved.
Show resolved Hide resolved

/-- The intersection of two ideals is an ideal, when it is nonempty and `P` has joins. -/
def inf (I J : ideal P) : ideal P :=
{ carrier := I ∩ J,
nonempty := ⟨⊥, bot_mem, bot_mem⟩,
nonempty := inter_nonempty I J,
directed := λ x ⟨_, _⟩ y ⟨_, _⟩, ⟨x ⊔ y, ⟨sup_mem x y ‹_› ‹_›, sup_mem x y ‹_› ‹_›⟩, by simp⟩,
mem_of_le := λ x y h ⟨_, _⟩, ⟨mem_of_le I h ‹_›, mem_of_le J h ‹_›⟩ }

/-- There is a smallest ideal containing two ideals, when `P` has joins and a bottom. -/
/-- There is a smallest ideal containing two ideals, when it is nonempty and `P` has joins. -/
atarnoam marked this conversation as resolved.
Show resolved Hide resolved
def sup (I J : ideal P) : ideal P :=
{ carrier := {x | ∃ (i ∈ I) (j ∈ J), x ≤ i ⊔ j},
nonempty := ⟨⊥, ⊥, bot_mem, ⊥, bot_mem, bot_le⟩,
nonempty := by {cases inter_nonempty I J, refine ⟨w, w, h.1, w, h.2, le_sup_left⟩},
atarnoam marked this conversation as resolved.
Show resolved Hide resolved
directed := λ x ⟨xi, _, xj, _, _⟩ y ⟨yi, _, yj, _, _⟩,
⟨x ⊔ y,
⟨xi ⊔ yi, sup_mem xi yi ‹_› ‹_›,
Expand All @@ -251,8 +275,8 @@ K.mem_of_le hxij $ sup_mem i j (mem_of_mem_of_le hiI hIK) (mem_of_mem_of_le hjJ

instance : lattice (ideal P) :=
{ sup := sup,
le_sup_left := λ I J (i ∈ I), ⟨i, ‹_›, ⊥, bot_mem, by simp only [sup_bot_eq]⟩,
le_sup_right := λ I J (j ∈ J), ⟨⊥, bot_mem, j, ‹_›, by simp only [bot_sup_eq]⟩,
le_sup_left := λ I J (i ∈ I), by { cases nonempty J, refine ⟨i, ‹_›, w, ‹_›, le_sup_left⟩},
le_sup_right := λ I J (j ∈ J), by { cases nonempty I, refine ⟨w, ‹_›, j, ‹_›, le_sup_right⟩},
atarnoam marked this conversation as resolved.
Show resolved Hide resolved
sup_le := sup_le,
bryangingechen marked this conversation as resolved.
Show resolved Hide resolved
inf := inf,
inf_le_left := λ I J, set.inter_subset_left I J,
Expand All @@ -264,8 +288,65 @@ instance : lattice (ideal P) :=

@[simp] lemma mem_sup {x : P} : x ∈ I ⊔ J ↔ ∃ (i ∈ I) (j ∈ J), x ≤ i ⊔ j := iff_of_eq rfl

lemma gt_sup_principal_of_not_mem {I : ideal P} {x : P} (hx : x ∉ I) : I < I ⊔ principal x :=
bryangingechen marked this conversation as resolved.
Show resolved Hide resolved
begin
apply lt_of_le_of_ne le_sup_left,
intro h,
simp at h,
exact hx h
end

end semilattice_sup_ideal_inter_nonempty

section semilattice_sup_bot
variables [semilattice_sup_bot P] (I J K : ideal P)
bryangingechen marked this conversation as resolved.
Show resolved Hide resolved

@[priority 100]
instance semilattice_sup_bot.ideal_inter_nonempty : ideal_inter_nonempty P :=
{ inter_nonempty := λ _ _, ⟨⊥, ⟨bot_mem, bot_mem⟩⟩ }

end semilattice_sup_bot

section semilattice_inf

variable [semilattice_inf P]

@[priority 100]
instance semilattice_inf.ideal_inter_nonempty : ideal_inter_nonempty P :=
{
inter_nonempty := λ I J, begin
cases I.nonempty with i _,
cases J.nonempty with j _,
exact ⟨i ⊓ j, I.mem_of_le inf_le_left ‹_›, J.mem_of_le inf_le_right ‹_›⟩
end
}
atarnoam marked this conversation as resolved.
Show resolved Hide resolved

end semilattice_inf

section distrib_lattice

variables [distrib_lattice P]
variables {I J : ideal P}

lemma eq_sup_of_le_sup {x i j: P} (hi : i ∈ I) (hj : j ∈ J) (hx : x ≤ i ⊔ j):
∃ (i' ∈ I) (j' ∈ J), x = i' ⊔ j' :=
begin
refine ⟨x ⊓ i, I.mem_of_le inf_le_right hi, x ⊓ j, J.mem_of_le inf_le_right hj, _⟩,
calc
x = x ⊓ (i ⊔ j) : left_eq_inf.mpr hx
... = (x ⊓ i) ⊔ (x ⊓ j) : inf_sup_left,
bryangingechen marked this conversation as resolved.
Show resolved Hide resolved
end

lemma sup_coe_eq_sup_set : ↑(I ⊔ J) = {x | ∃ i ∈ I, ∃ j ∈ J, x = i ⊔ j} :=
bryangingechen marked this conversation as resolved.
Show resolved Hide resolved
begin
ext,
rw [← mem_def, mem_sup],
exact ⟨λ ⟨_, _, _, _, _⟩, eq_sup_of_le_sup ‹_› ‹_› ‹_›,
λ ⟨i, _, j, _, _⟩, ⟨i, ‹_›, j, ‹_›, le_of_eq ‹_›⟩⟩
end

end distrib_lattice

end ideal

/-- For a preorder `P`, `cofinal P` is the type of subsets of `P`
Expand Down
6 changes: 6 additions & 0 deletions src/order/pfilter.lean
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ structure pfilter (P) [preorder P] :=
def is_pfilter [preorder P] (F : set P) : Prop :=
@is_ideal (order_dual P) _ F

lemma is_pfilter.of_def [preorder P] {F : set P} (nonempty : F.nonempty)
(directed : directed_on (≥) F) (mem_of_le : ∀ {x y : P}, x ≤ y → x ∈ F → y ∈ F) : is_pfilter F :=
by { use [nonempty, directed], exact λ _ _ _ _, mem_of_le ‹_› ‹_›}
atarnoam marked this conversation as resolved.
Show resolved Hide resolved

/-- Create an element of type `order.pfilter` from a set satisfying the predicate
`order.is_pfilter`. -/
def is_pfilter.to_pfilter [preorder P] {F : set P} (h : is_pfilter F) : pfilter P :=
Expand All @@ -65,6 +69,8 @@ instance : has_coe (pfilter P) (set P) := ⟨λ F, F.dual.carrier⟩
/-- For the notation `x ∈ F`. -/
instance : has_mem P (pfilter P) := ⟨λ x F, x ∈ (F : set P)⟩

@[simp] lemma mem_def : x ∈ F ↔ x ∈ (F : set P) := iff_of_eq rfl
bryangingechen marked this conversation as resolved.
Show resolved Hide resolved

lemma is_pfilter : is_pfilter (F : set P) :=
F.dual.is_ideal

Expand Down
79 changes: 76 additions & 3 deletions src/order/prime_ideal.lean
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@ ideal, prime

-/

open order.pfilter

namespace order

variables {P : Type*}

section preorder
bryangingechen marked this conversation as resolved.
Show resolved Hide resolved

variables [preorder P]

namespace ideal

/-- A pair of an `ideal` and a `pfilter` which form a partition of `P`.
Expand All @@ -50,6 +50,9 @@ structure prime_pair (P : Type*) [preorder P] :=
(is_compl_I_F : is_compl (I : set P) F)

namespace prime_pair

variable [preorder P]

variable (IF : prime_pair P)
bryangingechen marked this conversation as resolved.
Show resolved Hide resolved

lemma compl_I_eq_F : (IF.I : set P)ᶜ = IF.F := IF.is_compl_I_F.compl_eq
Expand All @@ -71,9 +74,13 @@ end prime_pair

/-- An ideal `I` is prime if its complement is a filter.
-/
@[mk_iff] class is_prime (I : ideal P) extends is_proper I : Prop :=
@[mk_iff] class is_prime [preorder P] (I : ideal P) extends is_proper I : Prop :=
(compl_filter : is_pfilter (I : set P)ᶜ)

section preorder

variable [preorder P]

/-- Create an element of type `order.ideal.prime_pair` from an ideal satisfying the predicate
`order.ideal.is_prime`. -/
def is_prime.to_prime_pair {I : ideal P} (h : is_prime I) : prime_pair P :=
Expand All @@ -85,10 +92,76 @@ lemma prime_pair.I_is_prime (IF : prime_pair P) : is_prime IF.I :=
{ compl_filter := by { rw IF.compl_I_eq_F, exact IF.F.is_pfilter },
..IF.I_is_proper }

end preorder

section semilattice_inf

variable [semilattice_inf P]

variables {x y : P} {I : ideal P}
bryangingechen marked this conversation as resolved.
Show resolved Hide resolved

lemma is_prime.mem_or_mem (hI : is_prime I) {x y : P} : x ⊓ y ∈ I → x ∈ I ∨ y ∈ I :=
begin
contrapose!,
let F := hI.compl_filter.to_pfilter,
show x ∈ F ∧ y ∈ F → x ⊓ y ∈ F,
exact λ h, inf_mem _ _ h.1 h.2,
end

lemma is_prime.of_mem_or_mem [is_proper I] (hI : ∀ {x y : P}, x ⊓ y ∈ I → x ∈ I ∨ y ∈ I) :
is_prime I :=
atarnoam marked this conversation as resolved.
Show resolved Hide resolved
begin
rw is_prime_iff,
use ‹_›,
apply is_pfilter.of_def,
{ exact set.nonempty_compl.2 (I.is_proper_iff.1 ‹_›) },
{ intros x _ y _,
refine ⟨x ⊓ y, _, inf_le_left, inf_le_right⟩,
have := mt hI,
tauto!,
},
{ exact @compl_mem_of_ge _ _ _}
bryangingechen marked this conversation as resolved.
Show resolved Hide resolved
end

lemma is_prime_iff_mem_or_mem [is_proper I] : is_prime I ↔ ∀ {x y : P}, x ⊓ y ∈ I → x ∈ I ∨ y ∈ I :=
⟨is_prime.mem_or_mem, is_prime.of_mem_or_mem⟩

end semilattice_inf

section distrib_lattice

variables [distrib_lattice P]
variables {I : ideal P}
bryangingechen marked this conversation as resolved.
Show resolved Hide resolved

@[priority 100]
instance is_maximal.is_prime [is_maximal I] : is_prime I :=
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For such a nice theorem, and the main point of this PR, it's almost too bad that the statement is so unassuming!

begin
rw is_prime_iff_mem_or_mem,
intros x y,
contrapose!,
rintro ⟨hx, hynI⟩ hxy,
apply hynI,
let J := I ⊔ principal x,
have hJuniv : (J : set P) = set.univ :=
is_maximal.maximal_proper (gt_sup_principal_of_not_mem ‹_›),
atarnoam marked this conversation as resolved.
Show resolved Hide resolved
have hyJ : y ∈ ↑J := set.eq_univ_iff_forall.mp hJuniv y,
rw sup_coe_eq_sup_set at hyJ,
rcases hyJ with ⟨a, ha, b, hb, hy⟩,
rw hy,
apply sup_mem _ _ ha,
refine I.mem_of_le (le_inf hb _) hxy,
rw hy,
exact le_sup_right
end

end distrib_lattice

end ideal

namespace pfilter

variable [preorder P]

/-- A filter `F` is prime if its complement is an ideal.
-/
@[mk_iff] class is_prime (F : pfilter P) : Prop :=
Expand Down