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

feat(data/{nat,int}/parity): the 'even' predicate on nat and int #1219

Merged
merged 4 commits into from
Jul 13, 2019

Conversation

avigad
Copy link
Collaborator

@avigad avigad commented Jul 12, 2019

The predicate even is defined in terms of exists so that we can use cases to extract the half. The theorem even_iff shows that even n is equivalent to n % 2 = 0.

As the examples at the end of each file show, simp will reduce concrete instances to true or false, and simp with parity_simps will solve harder problems.

Note: @digama0 used to be against introducing a definition for even, but now is in favor.

@avigad avigad requested a review from a team as a code owner July 12, 2019 18:06
@cipher1024
Copy link
Collaborator

What used to be the argument and what made @digama0 change his mind?

@digama0
Copy link
Member

digama0 commented Jul 13, 2019

The argument was to prefer 2 | x and not (2 | x) for even and odd. But we want to have a theory of parity regardless, and even has been reinvented many times by users of mathlib. The easiest way to forestall this is to define it in mathlib so that people find it when they need it.

@cipher1024 cipher1024 added the ready-to-merge All that is left is for bors to build and merge this PR. (Remember you need to say `bors r+`.) label Jul 13, 2019
@mergify mergify bot merged commit 0eea0d9 into leanprover-community:master Jul 13, 2019
@avigad avigad deleted the parity branch July 18, 2019 00:54
anrddh pushed a commit to anrddh/mathlib that referenced this pull request May 15, 2020
…nprover-community#1219)

* feat(data/{nat,int}/parity): the 'even' predicate on nat and int

* fix(data/{nat,int}/parity): shorten proof

* delete extra comma
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
ready-to-merge All that is left is for bors to build and merge this PR. (Remember you need to say `bors r+`.)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants