Debian Codegraph @

test-suite/bugs/bug_12417.v

raw
1 Declare ML Module "rocq-runtime.plugins.funind".
2
3 Inductive tm :=
4 | E: nat -> tm
5 | L: list tm -> tm.
6
7 Definition T := list tm.
8
9 Fixpoint max_list (p: nat) (l: list nat) : nat :=
10 match l with
11 | nil => p
12 | cons n l' => max_list (Init.Nat.max n p) l'
13 end.
14
15 Fixpoint map {A B} (f : A -> B) (l : list A) : list B :=
16 match l with
17 | nil => nil
18 | cons x l => cons (f x) (map f l)
19 end.
20
21 Fixpoint depth (t: tm) : nat :=
22 match t with
23 | E _ => 0
24 | L l => 1 + max_list 0 (map depth l)
25 end.
26
27 Fixpoint sum_depth (l: T) : nat :=
28 match l with
29 | nil => 0
30 | cons n l' => (depth n) + sum_depth l'
31 end.
32
33 Fail Function sum_total (l: T) {wf sum_depth l} : nat :=
34 match l with
35 | nil => 0
36 | cons t l' =>
37 (match t with
38 | E n => n
39 | L li => sum_total li
40 end) + sum_total l'
41 end.