From 6ba431cad7db7cc29717a865d6cc1abd5d82c0ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Pereira?= Date: Fri, 31 Jan 2025 11:36:30 +0100 Subject: [PATCH] Clean-up big comments --- src/pure.md | 38 -------------------------------------- 1 file changed, 38 deletions(-) diff --git a/src/pure.md b/src/pure.md index f2f4f1f..657264e 100644 --- a/src/pure.md +++ b/src/pure.md @@ -46,20 +46,6 @@ Unlike normal functions, Gobra may peek inside the body of a function. For example, `Cube(n)` can be treated as `n * n * n` ## Side effects and nondeterminism - - - - - - - - - Pure functions correspond to mathematical functions, which we use when reasoning about them. For example, `assert Cube(2) == 8` and `assert Cube(2) >= 8 && Cube(2) <= 8` are equivalent. Now if `Cube` were nondeterministic, the calls `Cube(2)` and `Cube(2)` with the same output might produce different outputs. @@ -75,30 +61,6 @@ Now if another function `foo` had the precondition `a == sideEffect()`, would we This is not allowed in any case, since specifications are ghost code, so non-ghost state must not be modified. Still, if only ghost state is affected, keeping track of the side effects would break modular reasoning. - - ## Specifying functional correctness with pure functions We define a `pure` function `fibonacci` as a mathematical reference implementation, following the recursive definition of the [Fibonacci sequence](https://en.wikipedia.org/wiki/Fibonacci_sequence). While recursion is not idiomatic in Go, recursion is often used for specifications.