| 1 |
Require Import PrimInt63. |
| 2 |
|
| 3 |
Open Scope uint63_scope. |
| 4 |
|
| 5 |
Definition div_eucl_plus_one i1 i2 := |
| 6 |
let (q,r) := diveucl i1 i2 in |
| 7 |
(add q 1, add r 1)%uint63. |
| 8 |
|
| 9 |
Definition rcbn := Eval cbn in div_eucl_plus_one 3 2. |
| 10 |
Check (eq_refl : rcbn = (2, 2)). |
| 11 |
|
| 12 |
Definition rcbv := Eval cbv in div_eucl_plus_one 3 2. |
| 13 |
Check (eq_refl : rcbv = (2, 2)). |
| 14 |
|
| 15 |
Definition rvmc := Eval vm_compute in div_eucl_plus_one 3 2. |
| 16 |
Check (eq_refl : rvmc = (2, 2)). |
| 17 |
|
| 18 |
Definition f n m := |
| 19 |
match (compare n 42)%uint63 with |
| 20 |
| Lt => add n m |
| 21 |
| _ => mul 2 m |
| 22 |
end. |
| 23 |
|
| 24 |
Goal forall n, (compare n 42)%uint63 = Gt -> f n 256 = 512%uint63. |
| 25 |
intros. unfold f. |
| 26 |
cbn. Undo. cbv. (* Test reductions under match clauses *) |
| 27 |
rewrite H. reflexivity. |
| 28 |
Qed. |