Debian Codegraph @

test-suite/success/Case15.v

raw
1 (* Check compilation of multiple pattern-matching on terms non
2 apparently of inductive type *)
3
4 (* Check that the non dependency in y is OK both in V7 and V8 *)
5 Check
6 (fun x (y : Prop) z =>
7 match x, y, z return (x = x \/ z = z) with
8 | O, y, z' => or_introl (z' = z') (refl_equal 0)
9 | _, y, O => or_intror _ (refl_equal 0)
10 | x, y, _ => or_introl _ (refl_equal x)
11 end).
12
13 (* Suggested by Pierre Letouzey (PR#207) *)
14 Inductive Boite : Set :=
15 boite : forall b : bool, (if b then nat else (nat * nat)%type) -> Boite.
16
17 Definition test (B : Boite) :=
18 match B return nat with
19 | boite true n => n
20 | boite false (n, m) => n + m
21 end.
22
23 (* Check laziness of compilation ... future work
24 Inductive I : Set := c : (b:bool)(if b then bool else nat)->I.
25
26 Check [x]
27 Cases x of
28 (c (true as y) (true as x)) => (if x then y else true)
29 | (c false O) => true | _ => false
30 end.
31
32 Check [x]
33 Cases x of
34 (c true true) => true
35 | (c false O) => true
36 | _ => false
37 end.
38
39 (* Devrait produire ceci mais trouver le type intermediaire est coton ! *)
40 Check
41 [x:I]
42 Cases x of
43 (c b y) =>
44 (<[b:bool](if b then bool else nat)->bool>if b
45 then [y](if y then true else false)
46 else [y]Cases y of
47 O => true
48 | (S _) => false
49 end y)
50 end.
51 *)