Debian Codegraph @

test-suite/success/sprop_hcons.v

raw
1 (* -*- coq-prog-args: ("-allow-sprop"); -*- *)
2
3 (* A bug due to bad hashconsing of case info *)
4
5 Inductive sBox (A : SProp) : Type :=
6 sbox : A -> sBox A.
7
8 Definition ubox {A : SProp} (bA : sBox A) : A :=
9 match bA with
10 sbox _ X => X
11 end.
12
13 Inductive sle : nat -> nat -> SProp :=
14 sle_0 : forall n, sle 0 n
15 | sle_S : forall n m : nat, sle n m -> sle (S n) (S m).
16
17 Definition sle_Sn (n : nat) : sle n (S n).
18 Proof.
19 induction n; constructor; auto.
20 Defined.
21
22 Definition sle_trans {n m p} (H : sle n m) (H': sle m p) : sle n p.
23 Proof.
24 revert H'. revert p. induction H.
25 - intros p H'. apply sle_0.
26 - intros p H'. inversion H'. apply ubox. subst. apply sbox. apply sle_S. apply IHsle;auto.
27 Defined.
28
29 Lemma sle_Sn_m {n m} : sle n m -> sle n (S m).
30 Proof.
31 intros H. destruct n.
32 - constructor.
33 - constructor;auto. assert (H1 : sle n (S n)) by apply sle_Sn.
34 exact (sle_trans H1 H ).
35 Defined.
36
37 Definition sle_Sn_Sm {n m} : sle (S n) (S m) -> sle n m.
38 Proof.
39 intros H.
40 inversion H. apply ubox. subst. apply sbox. exact H2.
41 Qed.
42
43
44 Notation "g ∘ f" := (sle_trans g f) (at level 40).
45
46 Lemma bazz q0 m (f : sle (S q0) (S m)) :
47 sbox _ (sle_Sn q0 ∘ f) = sbox _ (sle_Sn_m (sle_Sn_Sm f)).
48 Proof.
49 reflexivity. (* used to fail *)
50 (* NB: exact eq_refl succeeded even with the bug so no guarantee
51 that this test will continue to test the right thing. *)
52 Qed.