Debian Codegraph @

test-suite/success/Case9.v

raw
1 Inductive List (A : Set) : Set :=
2 | Nil : List A
3 | Cons : A -> List A -> List A.
4
5 Inductive eqlong : List nat -> List nat -> Prop :=
6 | eql_cons :
7 forall (n m : nat) (x y : List nat),
8 eqlong x y -> eqlong (Cons nat n x) (Cons nat m y)
9 | eql_nil : eqlong (Nil nat) (Nil nat).
10
11
12 Parameter V1 : eqlong (Nil nat) (Nil nat) \/ ~ eqlong (Nil nat) (Nil nat).
13 Parameter
14 V2 :
15 forall (a : nat) (x : List nat),
16 eqlong (Nil nat) (Cons nat a x) \/ ~ eqlong (Nil nat) (Cons nat a x).
17 Parameter
18 V3 :
19 forall (a : nat) (x : List nat),
20 eqlong (Cons nat a x) (Nil nat) \/ ~ eqlong (Cons nat a x) (Nil nat).
21 Parameter
22 V4 :
23 forall (a : nat) (x : List nat) (b : nat) (y : List nat),
24 eqlong (Cons nat a x) (Cons nat b y) \/
25 ~ eqlong (Cons nat a x) (Cons nat b y).
26
27 Parameter
28 nff :
29 forall (n m : nat) (x y : List nat),
30 ~ eqlong x y -> ~ eqlong (Cons nat n x) (Cons nat m y).
31 Parameter
32 inv_r : forall (n : nat) (x : List nat), ~ eqlong (Nil nat) (Cons nat n x).
33 Parameter
34 inv_l : forall (n : nat) (x : List nat), ~ eqlong (Cons nat n x) (Nil nat).
35
36 Fixpoint eqlongdec (x y : List nat) {struct x} :
37 eqlong x y \/ ~ eqlong x y :=
38 match x, y return (eqlong x y \/ ~ eqlong x y) with
39 | Nil _, Nil _ => or_introl (~ eqlong (Nil nat) (Nil nat)) eql_nil
40 | Nil _, Cons _ a x as L => or_intror (eqlong (Nil nat) L) (inv_r a x)
41 | Cons _ a x as L, Nil _ => or_intror (eqlong L (Nil nat)) (inv_l a x)
42 | Cons _ a x as L1, Cons _ b y as L2 =>
43 match eqlongdec x y return (eqlong L1 L2 \/ ~ eqlong L1 L2) with
44 | or_introl h => or_introl (~ eqlong L1 L2) (eql_cons a b x y h)
45 | or_intror h => or_intror (eqlong L1 L2) (nff a b x y h)
46 end
47 end.
48
49
50 Type
51 match Nil nat as x, Nil nat as y return (eqlong x y \/ ~ eqlong x y) with
52 | Nil _, Nil _ => or_introl (~ eqlong (Nil nat) (Nil nat)) eql_nil
53 | Nil _, Cons _ a x as L => or_intror (eqlong (Nil nat) L) (inv_r a x)
54 | Cons _ a x as L, Nil _ => or_intror (eqlong L (Nil nat)) (inv_l a x)
55 | Cons _ a x as L1, Cons _ b y as L2 =>
56 match eqlongdec x y return (eqlong L1 L2 \/ ~ eqlong L1 L2) with
57 | or_introl h => or_introl (~ eqlong L1 L2) (eql_cons a b x y h)
58 | or_intror h => or_intror (eqlong L1 L2) (nff a b x y h)
59 end
60 end.
61