Debian Codegraph @

test-suite/complexity/guard.v

raw
1 (* Examples to check that the guard condition does not evaluate
2 irrelevant subterms *)
3 (* Expected time < 1.00s *)
4
5 Fixpoint slow n :=
6 match n with
7 | 0 => true
8 | S k => andb (slow k) (slow k)
9 end.
10
11 Timeout 5 Time Fixpoint F n :=
12 match n with
13 | 0 => 0
14 | S k =>
15 if slow 100 then F k else 0
16 end.
17
18 Fixpoint slow2 n :=
19 match n with
20 | 0 => 0
21 | S k => slow2 k + slow2 k
22 end.
23
24 Timeout 5 Time Fixpoint F' n :=
25 match n with
26 | 0 => 0
27 | S k =>
28 if slow2 100 then F' k else 0
29 end.