aboutsummaryrefslogtreecommitdiffhomepage
path: root/test-suite/bugs/closed
diff options
context:
space:
mode:
authorGravatar Matthieu Sozeau <matthieu.sozeau@inria.fr>2016-06-14 12:02:40 +0200
committerGravatar Matthieu Sozeau <matthieu.sozeau@inria.fr>2016-06-14 12:02:40 +0200
commit494312f05a10188cf51f66cf189681f389e179b2 (patch)
treef29e7ea7903ee14d02ffc06c29444ce0e50747b8 /test-suite/bugs/closed
parent2b19f0923a314a6df0a9cfed0f56cf2405e6591c (diff)
parent4ae315f92e4a9849a56d3d9b0da33027f362d6e8 (diff)
Merge branch 'bug4725' into v8.5
Diffstat (limited to 'test-suite/bugs/closed')
-rw-r--r--test-suite/bugs/closed/4725.v38
1 files changed, 38 insertions, 0 deletions
diff --git a/test-suite/bugs/closed/4725.v b/test-suite/bugs/closed/4725.v
new file mode 100644
index 000000000..fd5e0fb60
--- /dev/null
+++ b/test-suite/bugs/closed/4725.v
@@ -0,0 +1,38 @@
+Require Import EquivDec Equivalence List Program.
+Require Import Relation_Definitions.
+Import ListNotations.
+Generalizable All Variables.
+
+Fixpoint removeV `{eqDecV : @EqDec V eqV equivV}`(x : V) (l : list V) : list V
+:=
+ match l with
+ | nil => nil
+ | y::tl => if (equiv_dec x y) then removeV x tl else y::(removeV x tl)
+ end.
+
+Lemma remove_le {V:Type}{eqV:relation V}{equivV:@Equivalence V eqV}{eqDecV :
+@EqDec V eqV equivV} (xs : list V) (x : V) :
+ length (removeV x xs) < length (x :: xs).
+ Proof. Admitted.
+
+(* Function version *)
+Set Printing Universes.
+
+Require Import Recdef.
+
+Function nubV {V:Type}{eqV:relation V}{equivV:@Equivalence V eqV}{eqDecV :
+@EqDec V eqV equivV} (l : list V) { measure length l} :=
+ match l with
+ | nil => nil
+ | x::xs => x :: @nubV V eqV equivV eqDecV (removeV x xs)
+ end.
+Proof. intros. apply remove_le. Qed.
+
+(* Program version *)
+
+Program Fixpoint nubV `{eqDecV : @EqDec V eqV equivV} (l : list V)
+ { measure (@length V l) lt } :=
+ match l with
+ | nil => nil
+ | x::xs => x :: @nubV V eqV equivV eqDecV (removeV x xs) _
+ end.