Download benchmarks/Algorithms/linear_modular_inverse/lean/spec_lib.lean from PV-SJTU/PV-Bench: direct link, hf CLI and curl.
- Browser
- Download file 692 Bytes
-
https://huggingface.co/datasets/PV-SJTU/PV-Bench/resolve/main/benchmarks/Algorithms/linear_modular_inverse/lean/spec_lib.lean
- Command line
-
hf download hf://datasets/PV-SJTU/PV-Bench/benchmarks/Algorithms/linear_modular_inverse/lean/spec_lib.lean
-
curl -L -o spec_lib.lean https://huggingface.co/datasets/PV-SJTU/PV-Bench/resolve/main/benchmarks/Algorithms/linear_modular_inverse/lean/spec_lib.lean
692 Bytes
| import compcert.lib.ZArithCompat | |
| import AUXLib.ListLib | |
| namespace Algorithms.linear_modular_inverse.lean | |
| open AUXLib | |
| def PrimeForLinearInverse (p : Int) : Prop := | |
| 2 ≤ p ∧ ∀ divisor, (2 ≤ divisor ∧ divisor < p) → Z.modulo p divisor ≠ 0 | |
| def CanonicalModularInverse (p index value : Int) : Prop := | |
| (1 ≤ index ∧ index < p) ∧ (0 < value ∧ value < p) ∧ | |
| ∃ coefficient, index * value + p * coefficient = 1 | |
| def ModularInversePrefix (p next : Int) (values : List Int) : Prop := | |
| Zlength values = next - 1 ∧ ∀ index, (1 ≤ index ∧ index < next) → | |
| CanonicalModularInverse p index (Znth (index - 1) values 0) | |
| end Algorithms.linear_modular_inverse.lean | |