aboutsummaryrefslogtreecommitdiff
path: root/test-suite/modules/subtyping.v
diff options
context:
space:
mode:
authorherbelin2007-01-17 14:47:50 +0000
committerherbelin2007-01-17 14:47:50 +0000
commite4dfd24e4a4d4251c79694d82b1aa860657ee6dc (patch)
tree5090fdfb3c6ae959fc2e3c0c7de451e067c866bd /test-suite/modules/subtyping.v
parent73b7f84df37666066fc6cf9cec0dba9e744c8f08 (diff)
Correction bug #1302
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/coq/trunk@9494 85f007b7-540e-0410-9357-904b9bb8a0f7
Diffstat (limited to 'test-suite/modules/subtyping.v')
-rw-r--r--test-suite/modules/subtyping.v37
1 files changed, 37 insertions, 0 deletions
diff --git a/test-suite/modules/subtyping.v b/test-suite/modules/subtyping.v
new file mode 100644
index 0000000000..fb3eae3af5
--- /dev/null
+++ b/test-suite/modules/subtyping.v
@@ -0,0 +1,37 @@
+(* Non regression for bug #1302 *)
+
+(* With universe polymorphism for inductive types, subtyping of
+ inductive types needs a special treatment: the standard conversion
+ algorithm does not work as it only knows to deal with constraints of
+ the form alpha = beta or max(alphas, alphas+1) <= beta, while
+ subtyping of inductive types in Type generates constraints of the form
+ max(alphas, alphas+1) <= max(betas, betas+1).
+
+ These constraints are anyway valid by monotonicity of subtyping but we
+ have to detect it early enough to avoid breaking the standard
+ algorithm for constraints on algebraic universes. *)
+
+Module Type T.
+
+ Parameter A : Type (* Top.1 *) .
+
+ Inductive L : Type (* max(Top.1,1) *) :=
+ | L0
+ | L1 : (A -> Prop) -> L.
+
+End T.
+
+Axiom Tp : Type (* Top.5 *) .
+
+Module TT : T.
+
+ Definition A : Type (* Top.6 *) := Tp. (* generates Top.5 <= Top.6 *)
+
+ Inductive L : Type (* max(Top.6,1) *) :=
+ | L0
+ | L1 : (A -> Prop) -> L.
+
+End TT. (* Generates Top.6 <= Top.1 (+ auxiliary constraints for L_rect) *)
+
+(* Note: Top.6 <= Top.1 is generated by subtyping on A;
+ subtyping of L follows and has not to be checked *)