2022-12-07 21:56:38 +01:00
|
|
|
node diagonal_int (i: int) returns (o1, o2 : int);
|
2022-12-07 16:45:55 +01:00
|
|
|
let
|
2023-01-03 22:58:38 +01:00
|
|
|
(o1, o2) = (i, i);
|
2022-12-07 21:56:38 +01:00
|
|
|
tel
|
|
|
|
|
|
|
|
node undiag_test (i: int) returns (o : bool);
|
|
|
|
var l1, l2: int; l3: int;
|
|
|
|
let
|
2023-01-03 22:58:38 +01:00
|
|
|
l3 = (pre (1)) -> 0;
|
|
|
|
(l1, l2) = diagonal_int(i);
|
|
|
|
o = (not (not (l1 = l2))) and (l1 = l2) and true;
|
2022-12-07 16:45:55 +01:00
|
|
|
tel
|
2022-12-13 11:45:40 +01:00
|
|
|
|
2022-12-13 15:02:54 +01:00
|
|
|
node auto (i: int) returns (o : int);
|
2022-12-16 01:04:09 +01:00
|
|
|
var x, y:int;
|
2022-12-13 15:02:54 +01:00
|
|
|
let
|
2023-01-03 22:58:38 +01:00
|
|
|
automaton
|
2023-01-05 18:31:12 +01:00
|
|
|
| Incr -> do (o,x) = (0 fby o + 1, 2); until x > 0 then Decr else if x = o then Done
|
|
|
|
| Decr -> do (o,x) = diagonal_int(0 fby o); until x < o then Incr
|
|
|
|
| Done -> do o = pre o; done
|
2022-12-13 15:02:54 +01:00
|
|
|
tel
|
|
|
|
|