diff --git a/examples/fibonacci.mlw b/examples/fibonacci.mlw index bdfb39d0f6f6d8aa3927d1945f96d7f9b916ec10..ca9373fd94640a73cbaa6f85da5321de0ccbb8b8 100644 --- a/examples/fibonacci.mlw +++ b/examples/fibonacci.mlw @@ -301,12 +301,19 @@ module FibonacciLogarithmic = if n = 0 then (1, 0) else begin + assert { 0 <= div n 2 }; let a, b = logfib (div n 2) in let c = a + b in if mod n 2 = 0 then - (a*a + b*b, b*(a + c)) + begin + assert { 2 * (div n 2) = (div n 2) + (div n 2) }; + (a*a+ b*b, b*(a + c)) + end else + begin + assert { 2 * (div n 2) + 1 = (div n 2) + (div n 2) + 1 }; (b*(a + c), c*c + b*b) + end end (* by induction, we easily prove that diff --git a/examples/fibonacci/why3session.xml b/examples/fibonacci/why3session.xml index 923d1fdec5e9d633057f59de277f18e43f68290c..194e52b537c32a61d4752ee5cfd29c6e268c1f45 100644 --- a/examples/fibonacci/why3session.xml +++ b/examples/fibonacci/why3session.xml @@ -4,13 +4,12 @@ - - + @@ -24,7 +23,7 @@ - + @@ -161,7 +160,7 @@ - + @@ -171,51 +170,42 @@ - - - - - - - - + - - - - - - - + + + + - - + + - - + + - + - - + + + + + + + + + + + + + + - - - - - - - - - - - - - + + diff --git a/examples/fibonacci/why3shapes.gz b/examples/fibonacci/why3shapes.gz index 146189a94459de3cb6c42474fc653f3c01ab0c64..a70b6b6ad727bf5a47ae877338d88a623808648c 100644 Binary files a/examples/fibonacci/why3shapes.gz and b/examples/fibonacci/why3shapes.gz differ