Add prime factorization (Factoring.v) and coprimality iff lemmas - #306
Closed
JasonGross wants to merge 1 commit into
Closed
JasonGross wants to merge 1 commit into
JasonGross wants to merge 1 commit into
Conversation
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
JasonGross
force-pushed
the
fable/factoring
branch
from
September 17, 2026 14:42
045cee3 to
9fc63ee
Compare
andres-erbsen
marked this pull request as draft
September 17, 2026 14:44
andres-erbsen
requested changes
Sep 17, 2026
| Proof. cbv [pow_pred pow_N]; case Pos.pred_N; trivial. Qed. | ||
| End Pos. | ||
|
|
||
| Module N. |
Collaborator
There was a problem hiding this comment.
This PR is clearly not ready. Additions to other types' namespaces should go in appropriate modules.
2 tasks
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds
theories/ZArith/Factoring.v: the p-adic valuationval, the prime-power factorizationppfactor, the sorted prime factorizationfactorand Euler'stotienton positive numbers, all computable, with the fundamental theorem of arithmetic and the induction principlesfactor_indandppfactor_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_iffandZ.coprime_prime_primetoZdivisibility.v, and the generic list lemmas the file needs toList.v,Sorted.vandPermutation.v(Sorted.vnow requiresPermutation). A test file checks the computations.Written by Claude Fable 5.1.
🤖 Generated with Claude Code
https://claude.ai/code/session_01YJbiRBkJtM7x6PvYV6hmEm