Skip to content

feat(Data/IsROrC/Basic): add a StarOrderedRing instance#6210

Open
MohanadAhmed wants to merge 21 commits intomasterfrom
IsROrCStarOrderedRing
Open

feat(Data/IsROrC/Basic): add a StarOrderedRing instance#6210
MohanadAhmed wants to merge 21 commits intomasterfrom
IsROrCStarOrderedRing

Conversation

@MohanadAhmed
Copy link
Copy Markdown
Collaborator

This PR implements a suggestion by @urkud on Zulip thread on how to get a StarOrderedRing on the IsROrC class. In that discussion the suggested step were:

  1. Add PartialOrder K to the list of extends and add le_iff_re_im : z ≤ w ↔ re z ≤ re w ∧ im z = im w to the list of axioms.
  2. Prove StarOrderedRing instance for any IsROrC.
  3. Add (almost trivial) le_iff_re_im proofs to IsROrC instances for real and complex numbers.

This PR does exactly these three steps


Open in Gitpod

Copy link
Copy Markdown
Member

@eric-wieser eric-wieser left a comment

Choose a reason for hiding this comment

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

Prove StarOrderedRing instance for any IsROrC.

I don't see this step in this PR; which is the titular one!

Copy link
Copy Markdown
Member

@eric-wieser eric-wieser left a comment

Choose a reason for hiding this comment

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

You should also probably delete these lines:

instance : StarOrderedRing ℝ :=
StarOrderedRing.ofNonnegIff' add_le_add_left fun r => by
refine ⟨fun hr => ⟨sqrt r, (mul_self_sqrt hr).symm⟩, ?_⟩
rintro ⟨s, rfl⟩
exact mul_self_nonneg s

/-- With `z ≤ w` iff `w - z` is real and nonnegative, `ℂ` is a star ordered ring.
(That is, a star ring in which the nonnegative elements are those of the form `star z * z`.)
-/
protected def starOrderedRing : StarOrderedRing ℂ :=
StarOrderedRing.ofNonnegIff' add_le_add_left fun r => by
refine' ⟨fun hr => ⟨Real.sqrt r.re, _⟩, fun h => _⟩
· have h₁ : 0 ≤ r.re := by
rw [le_def] at hr
exact hr.1
have h₂ : r.im = 0 := by
rw [le_def] at hr
exact hr.2.symm
ext
· simp only [ofReal_im, star_def, ofReal_re, sub_zero, conj_re, mul_re, mul_zero,
← Real.sqrt_mul h₁ r.re, Real.sqrt_mul_self h₁]
· simp only [h₂, add_zero, ofReal_im, star_def, zero_mul, conj_im, mul_im, mul_zero,
neg_zero]
· obtain ⟨s, rfl⟩ := h
simp only [← normSq_eq_conj_mul_self, normSq_nonneg, zero_le_real, star_def]
#align complex.star_ordered_ring Complex.starOrderedRing

@eric-wieser eric-wieser added awaiting-author A reviewer has asked the author a question or requested changes. t-analysis Analysis (normed *, calculus) t-algebra Algebra (groups, rings, fields, etc) labels Jul 28, 2023
@MohanadAhmed MohanadAhmed added awaiting-review and removed awaiting-author A reviewer has asked the author a question or requested changes. labels Jul 28, 2023
MohanadAhmed and others added 2 commits July 28, 2023 18:06
@eric-wieser eric-wieser changed the base branch from master to staging August 2, 2023 10:07
@eric-wieser eric-wieser changed the base branch from staging to master August 2, 2023 10:08
@eric-wieser
Copy link
Copy Markdown
Member

(Sometimes github makes a mess of the history after a merge; switching the base branch to something else and back fixed it)

@MohanadAhmed
Copy link
Copy Markdown
Collaborator Author

(Sometimes github makes a mess of the history after a merge; switching the base branch to something else and back fixed it)

Is there a way for me to reset it and just start from the current master? @eric-wieser

@eric-wieser eric-wieser changed the title IsROrC StarOrdered Ring feat(Data/IsROrC/Basic): add a StarOrderedRing instance Aug 2, 2023
@ghost ghost added the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label Aug 9, 2023
@MohanadAhmed MohanadAhmed added the WIP Work in progress label Aug 15, 2023
@bors bors bot changed the base branch from master to ScottCarnahan/BinomialRing2 September 17, 2023 03:25
@kim-em kim-em changed the base branch from ScottCarnahan/BinomialRing2 to master September 17, 2023 12:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) t-algebra Algebra (groups, rings, fields, etc) t-analysis Analysis (normed *, calculus) WIP Work in progress

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants