leanprover-community / leanprover-community/mathlib4
Autogenerate lemmas about `OfNat.ofNat`
Nobody has claimed this yet.
- Dominant language
- Lean
- Stars
- 4.2k
- Forks
- 1.7k
- PR merge metrics
- No merged PRs in 30d
Description
Add a command or an attribute that generates lemmas about OfNat.ofNat from lemmas about Nat.cast.
The initial version should work if the original lemma has exactly one argument n of type Nat.
It should:
- add
[n.AtLeastTwo]assumption; - replace all occurrences of
Nat.cast nwithOfNat.ofNat n; - drop the following assumptions proving them using
[n.AtLeastTwo]:-
n ≠ 0 -
0 < n -
n ≠ 1 -
1 < n -
2 ≤ n
-
- prove the resulting lemma by defeq to the old lemma;
- in case of a
simplemma, addno_indexas needed; - find one of
nat_castornatCastorcoe_natornat_coeornatin the name and replace it withofNat.
Optional features:
- deal with two natural numbers (should we replace both with
ofNator generate 3 versions?) - allow some customization (not sure what will be needed in real life).
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the existing lemmas about Nat.cast and the command or attribute mechanisms available for generating declarations. Define the initial scope around one Nat argument: add the AtLeastTwo assumption, perform the substitutions and assumption proofs, preserve simp behavior, prove by defeq, and rename the generated lemma. Treat the two-natural-number and customization ideas as out of scope unless clarified.
Written by the indexing model from the issue text.
Assessment
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100