projects
/
cfuerst
/
formal-numbers.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
acc909c
)
added invariants
author
Christoph Fuerst
<ch.fuerst@gmx.at>
Sun, 21 May 2017 18:45:01 +0000
(20:45 +0200)
committer
Christoph Fuerst
<ch.fuerst@gmx.at>
Sun, 21 May 2017 18:45:01 +0000
(20:45 +0200)
sieveEratosthenes.txt
patch
|
blob
|
history
diff --git
a/sieveEratosthenes.txt
b/sieveEratosthenes.txt
index
e30f59d
..
2449a5a
100644
(file)
--- a/
sieveEratosthenes.txt
+++ b/
sieveEratosthenes.txt
@@
-46,6
+46,8
@@
proc SieveOfErathostenes(m:nat): Array[MAX,Bool]
{
for var k:nat=1;i*(k+1)<MAX;k=k+1 do
invariant 1 ≤ k ∧ k ≤ MAX/i;
+ invariant ∀j:nat with j < i. (ret[j] = true) ⇔ isPrime(j);
+ invariant ∀j:nat with j < i. (ret[j] = false) ⇔ ¬isPrime(j);
invariant ∀p:nat with p ≤ i. (ret[p] = true ⇒
// p+r*i < MAX is implied by range of k
// partial processed array