From: Christoph Fuerst Date: Thu, 20 Apr 2017 14:39:39 +0000 (+0200) Subject: Update after second review Wolfgang X-Git-Url: http://git.risc.jku.at/gitweb/?a=commitdiff_plain;h=1c583171052b937252aa94c592908b5de7ff2135;p=cfuerst%2Fformal-numbers.git Update after second review Wolfgang --- diff --git a/discrete_log.txt b/discrete_log.txt index b66aa0c..13ad706 100644 --- a/discrete_log.txt +++ b/discrete_log.txt @@ -12,16 +12,22 @@ pred divides(m:prime,n:prime) ⇔ ∃p:prime. m⋅p = n; pred isPrime(m:prime) ⇔ m > 1 ∧ ∀n:prime. n>1 ∧ divides(n,m) ⇒ (n = m); pred isComposite(m:prime) ⇔ ¬isPrime(m); +theorem InverseExists() ⇔ ∀a:nat. ∀p:prime. isPrime(p) ∧ 0 < a ∧ a < p ⇒ + ∃r:nat. 0 < r ∧ r < p ∧ (a*r)%p = 1; + proc InvModP(a:ℕ[K^2],p:prime): prime requires isPrime(p) ∧ 0 < a ∧ a < p; - ensures (a*result) % p = 1; + ensures 0 < result ∧ result < p ∧ + (a*result) % p = 1; { var ainv:prime := 0; var i:prime; for i=1;i