| 1 |
(* Test the behaviour of hnf and simpl introduced in revision *) |
| 2 |
|
| 3 |
Parameter n:nat. |
| 4 |
Definition a:=0. |
| 5 |
|
| 6 |
Eval simpl in (fix plus (n m : nat) {struct n} : nat := |
| 7 |
match n with |
| 8 |
| 0 => m |
| 9 |
| S p => S (p + m) |
| 10 |
end) a a. |
| 11 |
|
| 12 |
Eval hnf in match (plus (S n) O) with S n => n | _ => O end. |
| 13 |
|
| 14 |
Eval simpl head in 2 + 2. |
| 15 |
Eval cbn head in 2 + 2. |
| 16 |
Eval lazy head in 2 + 2. |
| 17 |
Eval cbv head in 2 + 2. |
| 18 |
|
| 19 |
Eval lazy head delta in 2 + 2. |
| 20 |
|
| 21 |
Eval simpl head in 2 + (2 + 2). |
| 22 |
|
| 23 |
Eval simpl head in (2 + 2) + 2. |
| 24 |
|
| 25 |
Eval cbv head in (2 + 2) + 2. |
| 26 |
|
| 27 |
Axiom ignore : forall {T}, T -> unit. |
| 28 |
Eval simpl head in ignore (fun x => 1 + x). |
| 29 |
Eval cbn head in ignore (fun x => 1 + x). |
| 30 |
Eval lazy head in ignore (fun x => 1 + x). |
| 31 |
Eval cbv head in ignore (fun x => 1 + x). |
| 32 |
|
| 33 |
Require Import Ltac2.Ltac2. |
| 34 |
|
| 35 |
Ltac2 Eval eval lazy in (2 + 2). |
| 36 |
Ltac2 Eval eval lazy head in (2 + 2). |
| 37 |
|
| 38 |
(* Cbv examples *) |
| 39 |
|
| 40 |
Eval cbv head beta delta iota in let x := 1 + 1 in 2 + 2. (* not fully clear what head w/o zeta should be *) |
| 41 |
Eval cbv beta delta iota in let x := 1 + 1 in 2 + 2. (* not fully clear what head w/o zeta should be *) |
| 42 |
Eval cbv head beta delta iota in (let x := 1 + 1 in fun x => 1 + x) 2. (* not fully clear whether we should apply commutative cuts or not *) |
| 43 |
Eval cbv head in match 0 + n with 0 => 1 + 1 | S n => 1 + n end. |
| 44 |
Eval cbv head in fix f n := match 0 + n with 0 => 1 + 1 | S n => 1 + f n end. |
| 45 |
|
| 46 |
Require Import PrimInt63. |
| 47 |
Eval cbv head in PrimInt63.add 2 2. |
| 48 |
Parameter x:int. |
| 49 |
Eval cbv head in PrimInt63.add 2 x. |
| 50 |
|
| 51 |
Require Import PrimFloat. |
| 52 |
Eval cbv head in 0x1p+0%float. |