File: function.v

package info (click to toggle)
coq-quickchick 2.1.1-2
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 2,432 kB
  • sloc: ml: 4,367; ansic: 789; makefile: 388; sh: 27; python: 4; lisp: 2; perl: 2
file content (34 lines) | stat: -rw-r--r-- 1,012 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
From QuickChick Require Import QuickChick.
Require Import Nat.

Inductive square_of_equiv : nat -> nat -> Prop :=
| sq' : forall n m,
    mult n n = m -> square_of_equiv n m.

Derive EnumSizedSuchThat for (fun n => square_of_equiv n m).
Derive DecOpt for (square_of_equiv n m).

Example equiv_1 :
  @decOpt (square_of_equiv 2 4) _ 42 = Some true.
Proof. reflexivity. Qed.
Example equiv_2 :
  @decOpt (square_of_equiv 2 5) _ 42 = Some false.
Proof. reflexivity. Qed.

Inductive square_of : nat -> nat -> Prop :=
| sq : forall n, square_of n (n * n).

Derive EnumSizedSuchThat for (fun n => square_of n m).
Derive DecOpt for (square_of n m).

Example sq_1 :
  @decOpt (square_of 2 4) _ 42 = Some true.
Proof. reflexivity. Qed.
Example sq_2 :
  @decOpt (square_of 2 5) _ 42 = Some false.
Proof. reflexivity. Qed.

Inductive correct_prod : (prod nat bool) -> Prop :=
    | CorrectR1 : forall (p : prod nat bool) (n : nat), correct_prod (pair n (snd p)).

Derive ArbitrarySizedSuchThat for (fun x => correct_prod x).