From: Christoph Fuerst Date: Thu, 20 Apr 2017 15:31:05 +0000 (+0200) Subject: Update after second Review Wolfgang X-Git-Url: http://git.risc.jku.at/gitweb/?a=commitdiff_plain;h=b40dba72b79daeaa9f6e462c55de942706445b2f;p=cfuerst%2Fformal-numbers.git Update after second Review Wolfgang --- diff --git a/discrete_log.txt b/discrete_log.txt index 13ad706..3193ae5 100644 --- a/discrete_log.txt +++ b/discrete_log.txt @@ -43,6 +43,7 @@ proc IntegerRoot(a:nat): nat while y ≤ a do invariant x^2 ≤ a ∧ y = x^2+z ∧ z = 2*x+1; + decreases a-x^2; { x=x+1; z=z+2; @@ -98,3 +99,4 @@ proc DiscreteLog(p:prime,g:nat,a:nat): res + diff --git a/sieveEratosthenes.txt b/sieveEratosthenes.txt index 6b27a8a..a26805b 100644 --- a/sieveEratosthenes.txt +++ b/sieveEratosthenes.txt @@ -14,6 +14,7 @@ proc IntegerRoot(a:nat): nat while y ≤ a do invariant x^2 ≤ a ∧ y = x^2+z ∧ z = 2*x+1; + decreases a-x^2; { x=x+1; z=z+2; @@ -48,11 +49,13 @@ proc SieveOfErathostenes(m:nat): Array[MAX,Bool] proc SetMin(s:Set[nat]): nat requires s ≠ ∅[nat]; + requires ∀e ∈ s. e ≤ MAX; ensures result ∈ s ∧ ∀e ∈ s. result ≤ e; { var ret:nat := MAX; for x in s do + invariant ∀e in forSet. ret ≤ e; { if x < ret then { @@ -67,6 +70,8 @@ fun SetMin2(s:Set[nat]): nat ensures result ∈ s ∧ ∀e ∈ s. result ≤ e; = choose m in s with ∀e in s. m <= e; +theorem PrimeDivisor() ⇔ ∀e:nat. (e > 1 ∧ ¬isPrime(e)) ⇒ ∃p:nat. p