Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/_RocqProject
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
./rocq/TypeUtil.v
./rocq/GenAST.v
./rocq/GenLLVM.v
./rocq/Example.v
./rocq/GenAlive2.v



27 changes: 27 additions & 0 deletions src/rocq/Example.v
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
From GenLLVM Require Import Generators.
Require Import Flocq.IEEE754.Binary Bool.Bool.
From QuickChick Require Import QuickChick.

Definition Float_maxnum {prec emax} (a b : binary_float prec emax) :=
match Bcompare prec emax a b with
| Some Lt => b
| _ => a
end.

Definition maxnum_correct {prec emax} (a b : binary_float prec emax) :=
let m := Float_maxnum a b in
match Bcompare prec emax m a, Bcompare prec emax m b with
| Some Eq, Some Gt | Some Eq, Some Eq => true
| Some Gt, Some Eq => true
| _, _ => false
end.

Definition pair_fin32_gen : G (binary32 * binary32) :=
bindGen (fing32) (fun b1 =>
bindGen (fing32) (fun b2 =>
returnGen (b1, b2))).

QuickCheck (forAll pair_fin32_gen
(fun '(b1, b2) => maxnum_correct b1 b2 &&
maxnum_correct b1 b1 &&
maxnum_correct b2 b2)).
Loading