-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
260 additions
and
169 deletions.
There are no files selected for viewing
160 changes: 160 additions & 0 deletions
160
RealClosedField/RealClosedField/RingOrdering/Adjoin.lean
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,160 @@ | ||
/- | ||
Copyright (c) 2024 Florent Schaffhauser. All rights reserved. | ||
Released under Apache 2.0 license as described in the file LICENSE. | ||
Authors: Florent Schaffhauser, Artie Khovanov | ||
-/ | ||
import RealClosedField.RealClosedField.RingOrdering.Basic | ||
|
||
import Mathlib.Order.Zorn | ||
|
||
/- | ||
## Adjoining an element to a preordering | ||
-/ | ||
|
||
variable {S R : Type*} [CommRing R] [SetLike S R] [RingPreorderingClass S R] (P : S) (a : R) | ||
|
||
namespace Subsemiring | ||
|
||
/-- An explicit form of the semiring generated by a preordering `P` and an element `a`. -/ | ||
def ringPreordering_adjoin : Subsemiring R where | ||
carrier := {z : R | ∃ x ∈ P, ∃ y ∈ P, z = x + a * y} | ||
zero_mem' := ⟨0, by aesop, 0, by aesop, by simp⟩ | ||
one_mem' := ⟨1, by aesop, 0, by aesop, by simp⟩ | ||
add_mem' := by | ||
intro a b ha hb | ||
obtain ⟨x₁, hx₁, y₁, hy₁, rfl⟩ := ha | ||
obtain ⟨x₂, hx₂, y₂, hy₂, rfl⟩ := hb | ||
exact ⟨x₁ + x₂, by aesop, y₁ + y₂, by aesop, by ring⟩ | ||
mul_mem' := by | ||
intro a b ha hb | ||
obtain ⟨x₁, hx₁, y₁, hy₁, rfl⟩ := ha | ||
obtain ⟨x₂, hx₂, y₂, hy₂, rfl⟩ := hb | ||
exact ⟨x₁ * x₂ + (a * a) * (y₁ * y₂), by aesop, x₁ * y₂ + y₁ * x₂, by aesop, by ring⟩ | ||
|
||
variable {P} in | ||
@[aesop unsafe 70% apply (rule_sets := [SetLike])] | ||
lemma subset_ringPreordering_adjoin {x : R} (hx : x ∈ P) : | ||
x ∈ ringPreordering_adjoin P a := ⟨x, by aesop, 0, by aesop, by simp⟩ | ||
|
||
@[aesop safe 0 apply (rule_sets := [SetLike])] | ||
lemma mem_ringPreordering_adjoin : a ∈ ringPreordering_adjoin P a := | ||
⟨0, by aesop, 1, by aesop, by simp⟩ | ||
|
||
@[aesop safe 0 apply (rule_sets := [SetLike])] | ||
lemma square_mem_ringPreordering_adjoin (x : R) : x * x ∈ ringPreordering_adjoin P a := | ||
by simpa using subset_ringPreordering_adjoin a (by aesop) | ||
|
||
theorem closure_insert_eq_ringPreordering_adjoin : | ||
closure (insert a P) = ringPreordering_adjoin P a := by | ||
refine closure_eq_of_le (fun x hx => ?_) | ||
(fun _ hz => ?_) | ||
· rcases hx with ⟨_, _⟩ | h | ||
· exact mem_ringPreordering_adjoin P a | ||
· exact subset_ringPreordering_adjoin a h | ||
· obtain ⟨_, _, _, _, rfl⟩ := hz; aesop | ||
|
||
end Subsemiring | ||
|
||
namespace RingPreordering | ||
|
||
variable {P a} in | ||
def adjoin (h : -1 ∉ Subsemiring.ringPreordering_adjoin P a) : | ||
RingPreordering R where | ||
__ := Subsemiring.ringPreordering_adjoin P a | ||
square_mem' := by aesop | ||
minus_one_not_mem' := h | ||
|
||
variable {P a} in | ||
@[aesop unsafe 70% apply (rule_sets := [SetLike])] | ||
lemma subset_adjoin' (h : -1 ∉ Subsemiring.ringPreordering_adjoin P a) | ||
{x : R} (hx : x ∈ P) : x ∈ adjoin h := | ||
Subsemiring.subset_ringPreordering_adjoin a hx | ||
|
||
variable {P a} in | ||
lemma subset_adjoin (h : -1 ∉ Subsemiring.ringPreordering_adjoin P a) : | ||
(P : Set R) ⊆ adjoin h := fun _ => by aesop | ||
|
||
variable {P a} in | ||
@[aesop safe 0 apply (rule_sets := [SetLike])] | ||
lemma mem_adjoin (h : -1 ∉ Subsemiring.ringPreordering_adjoin P a) : | ||
a ∈ adjoin h := Subsemiring.mem_ringPreordering_adjoin P a | ||
|
||
/- | ||
## Sufficient conditions for adjoining an element | ||
-/ | ||
|
||
variable {P} in | ||
theorem minus_one_not_mem_or {x y : R} (h : - (x * y) ∈ P) : | ||
-1 ∉ Subsemiring.ringPreordering_adjoin P x ∨ -1 ∉ Subsemiring.ringPreordering_adjoin P y := by | ||
by_contra | ||
have hx : -1 ∈ Subsemiring.ringPreordering_adjoin P x := by aesop | ||
have hy : -1 ∈ Subsemiring.ringPreordering_adjoin P y := by aesop | ||
rcases hx with ⟨t₁, ht₁, t₂, ht₂, eqx⟩ | ||
rcases hy with ⟨s₁, hs₁, s₂, hs₂, eqy⟩ | ||
/- annoying calculation -/ | ||
sorry | ||
|
||
theorem minus_one_not_mem_or' : | ||
-1 ∉ Subsemiring.ringPreordering_adjoin P a ∨ -1 ∉ Subsemiring.ringPreordering_adjoin P (-a) | ||
:= RingPreordering.minus_one_not_mem_or (by aesop : - (a * (-a)) ∈ P) | ||
|
||
theorem minus_one_not_mem_ringPreordering_adjoin | ||
(h : ∀ x y, x ∈ P → y ∈ P → x + (1 + y) * a + 1 ≠ 0) : | ||
-1 ∉ Subsemiring.ringPreordering_adjoin P a := fun contr => by | ||
have : -1 * (1 + a) ∈ Subsemiring.ringPreordering_adjoin P a := | ||
by aesop (config := { enableSimp := false }) | ||
obtain ⟨x, hx, y, hy, eqn⟩ := this | ||
have : x + a * y + (1 + a) = 0 := (add_eq_zero_iff_eq_neg).mpr (by aesop) | ||
exact h _ _ hx hy (by ring_nf at this ⊢; assumption) | ||
|
||
/-- | ||
If `F` is a field, `P` is a preordering on `F`, and `a` is an element of `P` such that `-a ∉ P`, | ||
then `-1` is not of the form `x + a * y` with `x` and `y` in `P`. | ||
-/ | ||
theorem minus_one_not_mem_adjoin_linear | ||
{S F : Type*} [Field F] [SetLike S F] [RingPreorderingClass S F] {P : S} {a : F} | ||
(ha : -a ∉ P) : -1 ∉ Subsemiring.ringPreordering_adjoin P a := fun h => by | ||
rcases h with ⟨x, hx, y, hy, eqn⟩ | ||
apply ha | ||
have : y ≠ 0 := fun _ => by simpa [*] using minus_one_not_mem P | ||
rw [show -a = x * y⁻¹ + y⁻¹ by | ||
field_simp | ||
rw [neg_eq_iff_eq_neg.mp eqn] | ||
ring] | ||
aesop | ||
|
||
/- | ||
## Existence of prime orderings | ||
-/ | ||
|
||
theorem exists_le : | ||
∃ Q : RingPreordering R, (P : Set R) ⊆ Q ∧ (a ∈ Q ∨ -a ∈ Q) := by | ||
cases RingPreordering.minus_one_not_mem_or' P a with | ||
| inl h => exact ⟨adjoin h, subset_adjoin _, by aesop⟩ | ||
| inr h => exact ⟨adjoin h, subset_adjoin _, by aesop⟩ | ||
|
||
theorem exists_lt (hp : a ∉ P) (hn : -a ∉ P) : | ||
∃ Q : RingPreordering R, (P : Set R) ⊂ Q := by | ||
rcases exists_le P a with ⟨Q, le, p_mem | n_mem⟩ | ||
· exact ⟨Q, lt_of_le_of_ne le <| Ne.symm (ne_of_mem_of_not_mem' p_mem hp)⟩ | ||
· exact ⟨Q, lt_of_le_of_ne le <| Ne.symm (ne_of_mem_of_not_mem' n_mem hn)⟩ | ||
|
||
variable {P} in | ||
/- A preordering on `R` that is maximal with respect to inclusion is a prime ordering. -/ | ||
theorem isPrimeOrdering_of_maximal | ||
(max : Maximal Set.univ (RingPreorderingClass.toRingPreordering P)) : | ||
IsPrimeOrdering P := isPrimeOrdering_iff.mpr (fun a b h => by | ||
cases RingPreordering.minus_one_not_mem_or h with | ||
| inl h => exact Or.inl <| Maximal.le_of_ge max trivial (subset_adjoin h) (mem_adjoin h) | ||
| inr h => exact Or.inr <| Maximal.le_of_ge max trivial (subset_adjoin h) (mem_adjoin h)) | ||
|
||
/- Every preordering on `R` extends to a prime ordering. -/ | ||
theorem exists_le_isPrimeOrdering : | ||
∃ Q : RingPreordering R, (P : Set R) ⊆ Q ∧ IsPrimeOrdering Q := by | ||
suffices ∃ Q, RingPreorderingClass.toRingPreordering P ≤ Q ∧ Maximal (fun x => x ∈ Set.univ) Q by | ||
obtain ⟨Q, hQ⟩ := this | ||
exact ⟨Q, by aesop, isPrimeOrdering_of_maximal hQ.2⟩ | ||
apply zorn_le_nonempty₀ | ||
· intro c _ hc P' hP' | ||
simp_all [← bddAbove_def, nonempty_chain_bddAbove c hc (Set.nonempty_of_mem hP')] | ||
· trivial |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.