2010-07-26 09:34:29 +02:00
|
|
|
const n:int=42
|
|
|
|
|
|
|
|
fun f(a:bool; i:int; acc_in : bool) returns (acc_out : bool)
|
|
|
|
let
|
2012-07-17 17:57:04 +02:00
|
|
|
acc_out = if i = 0 then true else (a & acc_in);
|
|
|
|
tel
|
|
|
|
|
|
|
|
fun for(a:bool; i:int; acc_in : bool) returns (acc_out : bool)
|
|
|
|
let
|
|
|
|
acc_out = if i = 0 then false else (a or acc_in);
|
2010-07-26 09:34:29 +02:00
|
|
|
tel
|
|
|
|
|
|
|
|
fun g(a: bool^n) returns (o:bool)
|
|
|
|
let
|
2011-03-21 20:45:48 +01:00
|
|
|
o = foldi<<n>> f (a, true);
|
2010-07-26 09:34:29 +02:00
|
|
|
tel
|
2012-07-17 17:57:04 +02:00
|
|
|
|
|
|
|
node main() returns (o1,o2:bool)
|
|
|
|
var t:bool^n;
|
|
|
|
let
|
|
|
|
t = (true^n) fby (false^n) fby ([ true^n with [5]=false ]) fby ([ false^n with [12]=true ]) fby t;
|
|
|
|
o1 = g(t);
|
|
|
|
o2 = foldi<<n>> for (t, true);
|
|
|
|
tel
|