aboutsummaryrefslogtreecommitdiffhomepage
path: root/test-suite/success/coindprim.v
diff options
context:
space:
mode:
authorGravatar Matthieu Sozeau <matthieu.sozeau@inria.fr>2015-03-03 22:28:09 +0100
committerGravatar Matthieu Sozeau <matthieu.sozeau@inria.fr>2015-03-03 22:28:09 +0100
commitf51efdd18b01c7f3fce026c32c0cd21ff4f6ca02 (patch)
treee2525dc3f06393b9fe6c7850edbcdb7991c56c6d /test-suite/success/coindprim.v
parentc135410086c256fcc74f579459687a83718148b9 (diff)
Add a test-suite file ensuring coinductives with primitive projections
do not enjoy eta-conversion and do not allow the usual failure of subject reduction in presence of dependent pattern-matching.
Diffstat (limited to 'test-suite/success/coindprim.v')
-rw-r--r--test-suite/success/coindprim.v52
1 files changed, 52 insertions, 0 deletions
diff --git a/test-suite/success/coindprim.v b/test-suite/success/coindprim.v
new file mode 100644
index 000000000..4e0b7bf5c
--- /dev/null
+++ b/test-suite/success/coindprim.v
@@ -0,0 +1,52 @@
+Set Primitive Projections.
+
+CoInductive stream A := { hd : A; tl : stream A }.
+
+CoFixpoint ticks : stream unit :=
+ {| hd := tt; tl := ticks |}.
+
+Arguments hd [ A ] s.
+Arguments tl [ A ] s.
+
+CoInductive bisim {A} : stream A -> stream A -> Prop :=
+ | bisims s s' : hd s = hd s' -> bisim (tl s) (tl s') -> bisim s s'.
+
+Lemma bisim_refl {A} (s : stream A) : bisim s s.
+Proof.
+ revert s.
+ cofix aux. intros. constructor. reflexivity. apply aux.
+Defined.
+
+Lemma constr : forall (A : Type) (s : stream A),
+ bisim s (Build_stream _ s.(hd) s.(tl)).
+Proof.
+ intros. constructor. reflexivity. simpl. apply bisim_refl.
+Defined.
+
+Lemma constr' : forall (A : Type) (s : stream A),
+ s = Build_stream _ s.(hd) s.(tl).
+Proof.
+ intros.
+ Fail destruct s.
+Abort.
+
+Eval compute in constr _ ticks.
+
+Notation convertible x y := (eq_refl x : x = y).
+
+Fail Check convertible ticks {| hd := hd ticks; tl := tl ticks |}.
+
+CoInductive U := inU
+ { outU : U }.
+
+CoFixpoint u : U :=
+ inU u.
+
+CoFixpoint force (u : U) : U :=
+ inU (outU u).
+
+Lemma eq (x : U) : x = force x.
+Proof.
+ Fail destruct x.
+Abort.
+ (* Impossible *) \ No newline at end of file