Skip to content

Add prime factorization (Factoring.v) and coprimality iff lemmas - #306

Closed
JasonGross wants to merge 1 commit into
rocq-prover:masterfrom
JasonGross:fable/factoring
Closed

JasonGross wants to merge 1 commit into
rocq-prover:masterfrom
JasonGross:fable/factoring

Conversation

@JasonGross

Copy link
Copy Markdown
Member

Adds theories/ZArith/Factoring.v: the p-adic valuation val, the prime-power factorization ppfactor, the sorted prime factorization factor and Euler's totient on positive numbers, all computable, with the fundamental theorem of arithmetic and the induction principles factor_ind and ppfactor_ind. The file comes from Andres Erbsen's WIP ZmodSqrt branch (andres-erbsen/stdlib@5bd6d0db), minus its unfinished scratch lemmas.

Also adds the coprimality lemmas Z.coprime_mul_l_iff, Z.coprime_mul_r_iff, Z.coprime_pow_l_iff, Z.coprime_pow_r_iff and Z.coprime_prime_prime to Zdivisibility.v, and the generic list lemmas the file needs to List.v, Sorted.v and Permutation.v (Sorted.v now requires Permutation). A test file checks the computations.

  • Added changelog.
  • Added / updated documentation (nothing beyond the changelog applies).

Written by Claude Fable 5.1.

🤖 Generated with Claude Code

https://claude.ai/code/session_01YJbiRBkJtM7x6PvYV6hmEm

Factoring.v comes from Andres Erbsen's WIP ZmodSqrt branch
(andres-erbsen/stdlib@5bd6d0db, theories/ZArith/Factoring.v).  It
defines the p-adic valuation `val`, the prime-power factorization
`ppfactor`, the sorted prime factorization `factor` and Euler's
`totient` on positive numbers, all computable, and proves the
fundamental theorem of arithmetic together with the induction principles
`factor_ind` and `ppfactor_ind`.  The two unfinished scratch lemmas of
the WIP (`in_ppfactor`, `val_ext`) are left out.

Zdivisibility.v gains `Z.coprime_mul_l_iff`, `Z.coprime_mul_r_iff`,
`Z.coprime_pow_l_iff`, `Z.coprime_pow_r_iff` and `Z.coprime_prime_prime`,
which the same WIP used.  The generic list lemmas it needed go to their
natural homes: `Forall_repeat` and `repeat_inj` in List.v;
`Sorted_repeat`, `StronglySorted_app`, `NoDup_StronglySorted`,
`HdRel_map`, `Sorted_map`, `StronglySorted_Permutation_unique` and
`Sorted_Permutation_unique` in Sorted.v (which now requires
Permutation); `fold_right_Permutation` in Permutation.v.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YJbiRBkJtM7x6PvYV6hmEm
Proof. cbv [pow_pred pow_N]; case Pos.pred_N; trivial. Qed.
End Pos.

Module N.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This PR is clearly not ready. Additions to other types' namespaces should go in appropriate modules.

@JasonGross

Copy link
Copy Markdown
Member Author

Closing: the author of the development asked for this to go to mit-plv/fiat-crypto instead of stdlib for now. Sorry for the noise.

@JasonGross JasonGross closed this Sep 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants