aboutsummaryrefslogtreecommitdiff
path: root/mathcomp/test_suite
diff options
context:
space:
mode:
authorKazuhiko Sakaguchi2020-09-10 21:19:55 +0900
committerKazuhiko Sakaguchi2020-10-07 23:23:26 +0900
commitad55cb4128382852370ea53d36f4d21a83274e8b (patch)
tree8148c7f1949eacec6f80db04c85b6b745e623d5b /mathcomp/test_suite
parent5222da0de26b9843dfbb1b8462fabea9c0396714 (diff)
Turn class_of records into primitive records and get rid of the xclass idiom
Diffstat (limited to 'mathcomp/test_suite')
-rw-r--r--mathcomp/test_suite/test_regular_conv.v34
1 files changed, 34 insertions, 0 deletions
diff --git a/mathcomp/test_suite/test_regular_conv.v b/mathcomp/test_suite/test_regular_conv.v
new file mode 100644
index 0000000..b6c9f05
--- /dev/null
+++ b/mathcomp/test_suite/test_regular_conv.v
@@ -0,0 +1,34 @@
+From mathcomp Require Import all_ssreflect all_algebra all_field.
+
+Section regular.
+
+Import GRing.
+
+Let eq_ringType_of_regular_lalgType (R : ringType) :=
+ erefl : regular_lalgType R = Ring.Pack (Ring.class R) :> ringType.
+
+Let eq_ringType_of_regular_algType (R : comRingType) :=
+ erefl : regular_algType R = Ring.Pack (Ring.class R) :> ringType.
+
+Let eq_comRingType_of_regular_comAlgType (R : comRingType) :=
+ erefl : regular_comAlgType R = ComRing.Pack (ComRing.class R) :> ringType.
+
+Let eq_unitRingType_of_regular_unitAlgType (R : comUnitRingType) :=
+ erefl : regular_unitAlgType R =
+ UnitRing.Pack (UnitRing.class R) :> unitRingType.
+
+(* The following assertion fails if the class records are not primitive *)
+(* because the [comUnitAlgType _ of _] packager inserts an eta-expansion on *)
+(* the class. *)
+Let eq_comUnitRingType_of_regular_comUnitAlgType (R : comUnitRingType) :=
+ erefl : regular_comUnitAlgType R =
+ ComUnitRing.Pack (ComUnitRing.class R) :> comUnitRingType.
+
+Let eq_unitRingType_of_regular_FalgType (R : comUnitRingType) :=
+ erefl : regular_FalgType R = UnitRing.Pack (UnitRing.class R) :> unitRingType.
+
+(* The following assertion also fails if the class records are not primitive. *)
+Let eq_fieldType_of_regular_fieldExtType (K : fieldType) :=
+ erefl : regular_fieldExtType K = Field.Pack (Field.class K) :> fieldType.
+
+End regular.