Skip to content

[Merged by Bors] - feat: a + a = 0 ↔ a = 0 in ZMod n for n odd#6086

Closed
tb65536 wants to merge 3 commits intomasterfrom
tb_add_eq_zero
Closed

[Merged by Bors] - feat: a + a = 0 ↔ a = 0 in ZMod n for n odd#6086
tb65536 wants to merge 3 commits intomasterfrom
tb_add_eq_zero

Conversation

@tb65536
Copy link
Copy Markdown
Contributor

@tb65536 tb65536 commented Jul 24, 2023

This PR proves that a + a = 0 ↔ a = 0, and uses it to golf the proof of ne_neg_self.


I removed le_div_two_iff_lt_neg since it seems to just be a technical auxiliary lemma for the current proof of ne_neg_self, but I can add it back if people think it should be kept around. If we do keep it around, I wonder if it would be better to state it as 2 * x.val < n ↔ n < 2 * (-x).val (or something like that) to avoid natural number division.

Open in Gitpod

rw [←mul_two, ←@Nat.cast_two (ZMod n),
←ZMod.coe_unitOfCoprime 2 (Nat.prime_two.coprime_iff_not_dvd.mpr hn), Units.mul_left_eq_zero]

theorem ne_neg_self (n : ℕ) [hn : Fact ((n : ℕ) % 2 = 1)] {a : ZMod n} (ha : a ≠ 0) : a ≠ -a := by
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 one shouldn't be using Fact (and probably should also be using Odd), but I guess that's out of scope.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I agree with Eric that it would be nice to excise this Fact in a future PR.

@tb65536 tb65536 added the t-algebra Algebra (groups, rings, fields, etc) label Jul 27, 2023
Copy link
Copy Markdown
Contributor

@ocfnash ocfnash left a comment

Choose a reason for hiding this comment

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

Thanks!

bors merge

rw [←mul_two, ←@Nat.cast_two (ZMod n),
←ZMod.coe_unitOfCoprime 2 (Nat.prime_two.coprime_iff_not_dvd.mpr hn), Units.mul_left_eq_zero]

theorem ne_neg_self (n : ℕ) [hn : Fact ((n : ℕ) % 2 = 1)] {a : ZMod n} (ha : a ≠ 0) : a ≠ -a := by
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I agree with Eric that it would be nice to excise this Fact in a future PR.

@ghost ghost added ready-to-merge This PR has been sent to bors. and removed awaiting-review labels Jul 31, 2023
bors bot pushed a commit that referenced this pull request Jul 31, 2023
This PR proves that `a + a = 0 ↔ a = 0`, and uses it to golf the proof of `ne_neg_self`.
@bors
Copy link
Copy Markdown

bors bot commented Jul 31, 2023

Pull request successfully merged into master.

Build succeeded!

The publicly hosted instance of bors-ng is deprecated and will go away soon.

If you want to self-host your own instance, instructions are here.
For more help, visit the forum.

If you want to switch to GitHub's built-in merge queue, visit their help page.

@bors bors bot changed the title feat: a + a = 0 ↔ a = 0 in ZMod n for n odd [Merged by Bors] - feat: a + a = 0 ↔ a = 0 in ZMod n for n odd Jul 31, 2023
@bors bors bot closed this Jul 31, 2023
@bors bors bot deleted the tb_add_eq_zero branch July 31, 2023 16:56
kim-em pushed a commit that referenced this pull request Aug 2, 2023
This PR proves that `a + a = 0 ↔ a = 0`, and uses it to golf the proof of `ne_neg_self`.
bors bot pushed a commit that referenced this pull request Aug 2, 2023
… n` (#6292)

This PR replaces `Fact ((n : ℕ) % 2 = 1)` with `Odd n`, as suggested in #6086.
kim-em pushed a commit that referenced this pull request Aug 3, 2023
… n` (#6292)

This PR replaces `Fact ((n : ℕ) % 2 = 1)` with `Odd n`, as suggested in #6086.
kim-em pushed a commit that referenced this pull request Aug 3, 2023
… n` (#6292)

This PR replaces `Fact ((n : ℕ) % 2 = 1)` with `Odd n`, as suggested in #6086.
kim-em pushed a commit that referenced this pull request Aug 14, 2023
This PR proves that `a + a = 0 ↔ a = 0`, and uses it to golf the proof of `ne_neg_self`.
kim-em pushed a commit that referenced this pull request Aug 14, 2023
… n` (#6292)

This PR replaces `Fact ((n : ℕ) % 2 = 1)` with `Odd n`, as suggested in #6086.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-to-merge This PR has been sent to bors. t-algebra Algebra (groups, rings, fields, etc)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants