Created
December 15, 2020 15:39
-
-
Save Blaisorblade/89a54d11413c2b1d0aca110028edaf98 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Require Import NArith ZArith PArith. | |
Ltac is_positive p := | |
lazymatch p with | |
| xI ?pa => is_positive pa | |
| xO ?pa => is_positive pa | |
| xH => idtac | |
| _ => fail | |
end. | |
Ltac is_N n := | |
lazymatch n with | |
| N0 => idtac | |
| Npos ?p => is_positive p | |
| _ => fail | |
end. | |
Open Scope N_scope. | |
(* Ltac is_N n := match n with | N0 => idtac | Npos ?p => is_positive p | _ => fail "Not constant" end. *) | |
Goal forall n : N, (42 + 13) + (n + 7) + (n + n) = 62 + 3 * n. | |
intros. | |
(* let n := constr:(0%N) in | |
let c := is_N n in idtac c. *) | |
match goal with | |
| |- context [?n + ?p] => | |
idtac "n" n; | |
is_N n; | |
idtac "p" p | |
(* idtac res "n" n "p" p; *) | |
| _ => idtac "done" | |
end. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
output: