diff options
author | Enrico Tassi <Enrico.Tassi@inria.fr> | 2014-12-26 15:51:57 +0100 |
---|---|---|
committer | Enrico Tassi <Enrico.Tassi@inria.fr> | 2014-12-26 16:00:31 +0100 |
commit | 3f4af783a249aab22d0d772bf21a0d5284aba407 (patch) | |
tree | bbe13c0f7b7374f0314cb5fdc1cb063a31238272 /test-suite | |
parent | 2919e4a927a4574a28012ae4ba9523e01fed1360 (diff) |
new test for coqchk
Diffstat (limited to 'test-suite')
-rw-r--r-- | test-suite/Makefile | 19 | ||||
-rw-r--r-- | test-suite/coqchk/univ.v | 35 |
2 files changed, 53 insertions, 1 deletions
diff --git a/test-suite/Makefile b/test-suite/Makefile index a144d6a55..45a2e2046 100644 --- a/test-suite/Makefile +++ b/test-suite/Makefile @@ -82,7 +82,7 @@ VSUBSYSTEMS := prerequisite success failure $(BUGS) output \ interactive micromega $(COMPLEXITY) modules stm # All subsystems -SUBSYSTEMS := $(VSUBSYSTEMS) misc bugs ide vi +SUBSYSTEMS := $(VSUBSYSTEMS) misc bugs ide vi coqchk ####################################################################### # Phony targets @@ -443,3 +443,20 @@ vi: $(patsubst %.v,%.vi.log,$(wildcard vi/*.v)) echo " $<...Error!"; \ fi; \ } > "$@" + +coqchk: $(patsubst %.v,%.chk.log,$(wildcard coqchk/*.v)) + +%.chk.log:%.v + @echo "TEST $<" + $(HIDE){ \ + $(bincoqc) -R coqchk coqchk $* 2>&1 && \ + $(bincoqchk) -R coqchk coqchk -norec $(subst /,.,$*) 2>&1; \ + if [ $$? = 0 ]; then \ + echo $(log_success); \ + echo " $<...Ok"; \ + else \ + echo $(log_failure); \ + echo " $<...Error!"; \ + fi; \ + } > "$@" + diff --git a/test-suite/coqchk/univ.v b/test-suite/coqchk/univ.v new file mode 100644 index 000000000..84a4009d7 --- /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)). |