summaryrefslogtreecommitdiff
path: root/test-suite/coqchk/univ.v
diff options
context:
space:
mode:
authorGravatar Enrico Tassi <gareuselesinge@debian.org>2015-01-25 14:42:51 +0100
committerGravatar Enrico Tassi <gareuselesinge@debian.org>2015-01-25 14:42:51 +0100
commit7cfc4e5146be5666419451bdd516f1f3f264d24a (patch)
treee4197645da03dc3c7cc84e434cc31d0a0cca7056 /test-suite/coqchk/univ.v
parent420f78b2caeaaddc6fe484565b2d0e49c66888e5 (diff)
Imported Upstream version 8.5~beta1+dfsg
Diffstat (limited to 'test-suite/coqchk/univ.v')
-rw-r--r--test-suite/coqchk/univ.v35
1 files changed, 35 insertions, 0 deletions
diff --git a/test-suite/coqchk/univ.v b/test-suite/coqchk/univ.v
new file mode 100644
index 00000000..84a4009d
--- /dev/null
+++ b/test-suite/coqchk/univ.v
@@ -0,0 +1,35 @@
+
+Inductive equivalent P Q := Equivalent (P_to_Q : P -> Q) (Q_to_P : Q -> P).
+
+Inductive equal T (x : T) : T -> Type := Equal : equal T x x.
+
+(* Arithmetic *)
+
+Inductive natural := Zero | Add_1_to (n : natural).
+
+Fixpoint add (m n : natural) : natural :=
+ match m with Zero => n | Add_1_to m_minus_1 => add m_minus_1 (Add_1_to n) end.
+
+Definition double (n : natural) : natural := add n n.
+
+Inductive odd (n : natural) :=
+ Odd (half : natural)
+ (n_odd : equal natural n (Add_1_to (double half))).
+
+Inductive less_than (m n : natural) :=
+ LessThan (diff : natural)
+ (m_lt_n : equal natural n (Add_1_to (add m diff))).
+
+(* Finite subsets *)
+
+Definition injective_in T R (D : T -> Type) (f : T -> R) :=
+ forall x y, D x -> D y -> equal R (f x) (f y) -> equal T x y.
+
+Inductive in_image T R (D : T -> Type) (f : T -> R) (a : R) :=
+ InImage (x : T) (x_in_D : D x) (a_is_fx : equal R a (f x)).
+
+Inductive finite_of_order T (D : T -> Type) (n : natural) :=
+ FiniteOfOrder (rank : T -> natural)
+ (rank_injective : injective_in T natural D rank)
+ (rank_onto :
+ forall i, equivalent (less_than i n) (in_image T natural D rank i)).