From 9628140878d0f57bbb37186b00164b80365f9b34 Mon Sep 17 00:00:00 2001 From: Alex Auvolat Date: Fri, 4 Jul 2014 17:54:40 +0200 Subject: Add example counters.scade. --- tests/source/counters.scade | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100755 tests/source/counters.scade diff --git a/tests/source/counters.scade b/tests/source/counters.scade new file mode 100755 index 0000000..3266ec9 --- /dev/null +++ b/tests/source/counters.scade @@ -0,0 +1,27 @@ + + +const bound: int = 1000; + +node counters(z: bool) returns (eq_nind : bool ; probe x, probe y : int) +var + b1, b2 : bool; + a, b : bool; +let + + a = false -> (if pre a then pre x < bound else pre x <= 0); + --a = false -> pre(if a then x < bound else x <= 0); + x = bound -> (if a then pre x + 1 else pre x - 1); + + b = true -> (if pre b then pre y < bound else pre y <= 0); + --b = true -> pre(if b then y < bound else y <= 0); + y = 0 -> (if b then pre y + 1 else pre y - 1); + + b1 = x=bound; + b2 = y=0; + + + guarantee xy : x+y = bound; + guarantee bb : b1 = b2; + guarantee rp : -bound <= (x-y) and (x-y) <= bound; + +tel -- cgit v1.2.3