summaryrefslogtreecommitdiff
path: root/tests/source/gilbreath.scade
blob: 2723f9f93141c6e23ae04962b145051e663bcdab (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
node gilbreath_stream(c: bool) returns (o, probe property: bool)
var
  half: bool;
let
  activate
    if c then
      let
        o = false -> not pre o;
      tel 
    else
      let
        o = true -> not pre o;
      tel
  returns o;

  half = false -> not pre half;

  property = true -> not (half and (o = pre o));
tel

node test(i: int) returns (a, b, c: int; exit: bool)
var
  cond: bool;
  o, prop: bool;
let
  exit = i >= 20;
  cond = i mod 3 = 0 and not (i mod 7 = 2);
  c = if cond then 1 else 0;
  o, prop = gilbreath_stream(cond);
  a = if o then 1 else 0;
  b = if prop then 1 else 0;
tel