Skip to content

[Merged by Bors] - feat: port Data.Complex.Basic#2718

Closed
siddhartha-gadgil wants to merge 42 commits intomasterfrom
port/Data.Complex.Basic
Closed

[Merged by Bors] - feat: port Data.Complex.Basic#2718
siddhartha-gadgil wants to merge 42 commits intomasterfrom
port/Data.Complex.Basic

Conversation

@siddhartha-gadgil
Copy link
Copy Markdown
Collaborator


Open in Gitpod

@siddhartha-gadgil siddhartha-gadgil added awaiting-review mathlib-port This is a port of a theory file from mathlib. labels Mar 9, 2023
@siddhartha-gadgil
Copy link
Copy Markdown
Collaborator Author

The commit 04c7d61 fixes many norm_cast issues by making the inclusion from reals to complex a function with the coe attribute. This however means the function has to be added to many simp calls (marking it simp will mess up many statements). I do not know whether this is the correct approach, so I have made it a single commit that can be reverted.

All checks pass before and after this commit.

@jcommelin jcommelin changed the title Port/data.complex.basic feat: port Data.Complex.Basic Mar 9, 2023
constructor <;>
simp <;>
· first |ring1|ring_nf
instance commRing : CommRing ℂ :=
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This should probably have a porting note too, since the instance above does.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Added

#align complex.conj_of_real Complex.conj_ofReal

@[simp]
theorem conj_i : conj i = -i :=
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Shouldn't this be I not i?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

This has got misaligned with edits.


/-- The norm squared function. -/
@[pp_nodot]
-- @[pp_nodot]
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This needs a porting note

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Added

Comment on lines +840 to +841
-- Porting note: removed `norm_cast` attribute because the RHS can't start with `↑`
@[simp]
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This sounds like a bug in norm_cast we need to fix.

Comment on lines +952 to +1067
theorem abs_le_abs_re_add_abs_im (z : ℂ) : abs z ≤ |z.re| + |z.im| := by
simpa [re_add_im] using abs.add_le z.re (z.im * I)
-- Porting note: probably should be golfed
theorem abs_le_abs_re_add_abs_im (z : ℂ) : Complex.abs z ≤ |z.re| + |z.im| := by
repeat (rw [← abs_ofReal])
conv =>
lhs
rw [← Complex.re_add_im z]
simpa [re_add_im] using Complex.abs.add_le z.re (z.im * i)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can we instead try to work out why the old proof fails?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Generally I attribute proofs being longer to my lack of skill with tactics.

Co-authored-by: Johan Commelin <johan@commelin.net>
@ChrisHughes24
Copy link
Copy Markdown
Member

bors merge

@github-actions github-actions bot added ready-to-merge This PR has been sent to bors. and removed awaiting-review labels Mar 10, 2023
bors bot pushed a commit that referenced this pull request Mar 10, 2023
@bors
Copy link
Copy Markdown

bors bot commented Mar 10, 2023

Pull request successfully merged into master.

Build succeeded:

@bors bors bot changed the title feat: port Data.Complex.Basic [Merged by Bors] - feat: port Data.Complex.Basic Mar 10, 2023
@bors bors bot closed this Mar 10, 2023
@bors bors bot deleted the port/Data.Complex.Basic branch March 10, 2023 13:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mathlib-port This is a port of a theory file from mathlib. ready-to-merge This PR has been sent to bors.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants