aboutsummaryrefslogtreecommitdiff
path: root/src/Util
diff options
context:
space:
mode:
authorGravatar Jason Gross <jgross@mit.edu>2017-04-04 17:44:29 -0400
committerGravatar Jason Gross <jgross@mit.edu>2017-04-04 17:44:29 -0400
commit574d8ba0dec35e1f13674d38f1430358576df1a2 (patch)
treecf6ba8291e7dba0e71fc521f2d15bc2c108646e0 /src/Util
parentb305156e01725fb9a5e70f0a33131554a0530adc (diff)
Add Tactics.PrintContext
Diffstat (limited to 'src/Util')
-rw-r--r--src/Util/Tactics.v1
-rw-r--r--src/Util/Tactics/PrintContext.v12
2 files changed, 13 insertions, 0 deletions
diff --git a/src/Util/Tactics.v b/src/Util/Tactics.v
index 88dcb0aa8..60c93df2f 100644
--- a/src/Util/Tactics.v
+++ b/src/Util/Tactics.v
@@ -17,6 +17,7 @@ Require Export Crypto.Util.Tactics.Forward.
Require Export Crypto.Util.Tactics.GetGoal.
Require Export Crypto.Util.Tactics.OnSubterms.
Require Export Crypto.Util.Tactics.Not.
+Require Export Crypto.Util.Tactics.PrintContext.
Require Export Crypto.Util.Tactics.Revert.
Require Export Crypto.Util.Tactics.RewriteHyp.
Require Export Crypto.Util.Tactics.SetEvars.
diff --git a/src/Util/Tactics/PrintContext.v b/src/Util/Tactics/PrintContext.v
new file mode 100644
index 000000000..1a774bdfc
--- /dev/null
+++ b/src/Util/Tactics/PrintContext.v
@@ -0,0 +1,12 @@
+Ltac print_context _ :=
+ lazymatch goal with
+ | [ H : ?T |- False ]
+ => try ((clear H || fail 10000 "Anomaly in print_context: could not clear" H); print_context (); fail);
+ match goal with
+ | _ => let body := (eval cbv delta [H] in H) in
+ idtac H ":=" body ":" T
+ | _ => idtac H ":" T
+ end
+ | [ |- False ] => idtac
+ | [ |- _ ] => try (exfalso; print_context (); fail)
+ end.