Debian Codegraph @

test-suite/success/congruence.v

raw
1 Inductive Inner : Type :=
2 | innerI_nat : forall (x:nat), Inner
3 | innerI_fun : forall (f:nat->Type), Inner
4 | innerI_inner : forall (i:Inner), Inner
5 | innerI_Type : forall (T:Type), Inner
6 | innerI_extra : Inner.
7
8 Inductive ExtractTest (A:Type) (F:nat->Type) (I:Inner): Inner -> Inner -> unit -> Type :=
9 | extract_f_x_from_index : forall (x:nat) (f:nat->Type) (t:f x),
10 ExtractTest A F I (innerI_inner (innerI_nat x)) (innerI_fun f) tt
11 | extract_F_from_param_x_from_index : forall (x:nat) (f:nat->Type) (t:F x),
12 ExtractTest A F I (innerI_inner (innerI_nat x)) innerI_extra tt
13 | extract_fail : forall (x y: nat) (f : nat -> Type) (t : f x),
14 ExtractTest A F I (innerI_nat y) (innerI_fun f) tt
15 | extract_fx_from_index : forall (x:nat) (f:nat->Type) (t:f x),
16 ExtractTest A F I (innerI_Type (f x)) innerI_extra tt
17 | extract_t_match : forall (b:bool) (t:if b then unit else nat),
18 ExtractTest A F I (innerI_Type (if b then unit else nat)) innerI_extra tt
19 .
20
21
22 Lemma test_extract_f_x_from_index A F x f t1 t2 : extract_f_x_from_index A F innerI_extra x f t1 = extract_f_x_from_index A F innerI_extra x f t2 -> t1 = t2.
23 Proof.
24 intros H.
25 congruence.
26 Qed.
27
28 Lemma test_extract_F_from_param_x_from_index A F x f t1 t2 : extract_F_from_param_x_from_index A F innerI_extra x f t1 = extract_F_from_param_x_from_index A F innerI_extra x f t2 -> t1 = t2.
29 Proof.
30 intros H.
31 congruence.
32 Qed.
33
34 Lemma test_extract_fx_from_index A F x f t1 t2 :
35 extract_fx_from_index A F innerI_extra x f t1 = extract_fx_from_index A F innerI_extra x f t2 -> t1 = t2.
36 Proof.
37 intros H.
38 congruence.
39 Qed.
40
41 Inductive Vector (A : Type) : nat -> Type :=
42 | nil : Vector A 0
43 | cons : forall (h : A) (n : nat) (t : Vector A n), Vector A (S n).
44
45 Local Notation "[ ]" := (nil _) (format "[ ]").
46 Local Notation "h :: t" := (cons _ h _ t) (at level 60, right associativity).
47
48 Lemma test_vec_eq (A:Type) (x:A) (n:nat) (v v' : Vector A n) : (x::v = x::v') -> v = v'.
49 Proof.
50 congruence.
51 Qed.
52
53 Inductive Fin : nat -> Set :=
54 | F1 : forall {n}, Fin (S n)
55 | FS : forall {n}, Fin n -> Fin (S n).
56
57 Lemma test_fin_eq (n:nat) (f f': Fin n) : FS f = FS f' -> f = f'.
58 Proof.
59 congruence.
60 Qed.
61
62 Record R (A : Type) (B : A -> Type) : Type := RI { a : A; b : B a }.
63
64 Goal forall A B (x : A) (y1 y2 : B),
65 y1 <> y2 -> RI _ _ x y1 <> RI _ _ x y2.
66 Proof.
67 intros.
68 congruence.
69 Qed.
70
71 Inductive wrap1 (X : unit -> Type) : unit -> forall (v : unit), X v -> Type :=
72 | wrap1_zero (x : X tt) : wrap1 X tt tt x
73 | wrap1_succ u v x : wrap1 X u v x -> wrap1 X u v x.
74
75 Lemma test_wrap1 (x y : unit) (p q : wrap1 (fun _ : unit => unit) tt y x) :
76 wrap1_succ (fun _ => unit) tt y x p = wrap1_succ (fun _ => unit) tt y x q -> p = q.
77 Proof.
78 congruence.
79 Qed.
80
81 Inductive wrap2 (X : unit -> Type) : unit -> forall (v : unit), X tt -> Type :=
82 | wrap2_zero (x : X tt) : wrap2 X tt tt x
83 | wrap2_succ u v x : wrap2 X u v x -> wrap2 X u v x.
84
85 Lemma test_wrap2 (y : unit) (X : unit -> Type) (x : X tt) (p q : wrap2 X tt y x) :
86 wrap2_succ X tt y x p = wrap2_succ X tt y x q -> p = q.
87 Proof.
88 congruence.
89 Qed.