Debian Codegraph @

test-suite/success/Case17.v

raw
1 (* Check the synthesis of predicate from a cast in case of matching of
2 the first component (here [list bool]) of a dependent type (here [sigT])
3 (Simplification of an example from file parsing2.v of the Coq'Art
4 exercises) *)
5
6 Parameter parse_rel : list bool -> list bool -> nat -> Prop.
7
8 Parameter (l0 : list bool)
9 (rec :
10 forall l' : list bool,
11 length l' <= S (length l0) ->
12 {l'' : list bool &
13 {t : nat | parse_rel l' l'' t /\ length l'' <= length l'}} +
14 {(forall (l'' : list bool) (t : nat), ~ parse_rel l' l'' t)}).
15
16 Axiom HHH : forall A : Prop, A.
17
18 Check
19 (match rec l0 (HHH _) with
20 | inleft (existT _ (cons false l1) _) => inright _ (HHH _)
21 | inleft (existT _ (cons true l1) (exist _ t1 (conj Hp Hl))) =>
22 inright _ (HHH _)
23 | inleft (existT _ _ _) => inright _ (HHH _)
24 | inright Hnp => inright _ (HHH _)
25 end
26 :{l'' : list bool &
27 {t : nat | parse_rel (true :: l0) l'' t /\ length l'' <= S (length l0)}} +
28 {(forall (l'' : list bool) (t : nat), ~ parse_rel (true :: l0) l'' t)}).
29
30 (* The same but with relative links to l0 and rec *)
31
32 Check
33 (fun (l0 : list bool)
34 (rec : forall l' : list bool,
35 length l' <= S (length l0) ->
36 {l'' : list bool &
37 {t : nat | parse_rel l' l'' t /\ length l'' <= length l'}} +
38 {(forall (l'' : list bool) (t : nat), ~ parse_rel l' l'' t)}) =>
39 match rec l0 (HHH _) with
40 | inleft (existT _ (cons false l1) _) => inright _ (HHH _)
41 | inleft (existT _ (cons true l1) (exist _ t1 (conj Hp Hl))) =>
42 inright _ (HHH _)
43 | inleft (existT _ _ _) => inright _ (HHH _)
44 | inright Hnp => inright _ (HHH _)
45 end
46 :{l'' : list bool &
47 {t : nat | parse_rel (true :: l0) l'' t /\ length l'' <= S (length l0)}} +
48 {(forall (l'' : list bool) (t : nat), ~ parse_rel (true :: l0) l'' t)}).