Skip to content

Commit

Permalink
Add ring_simplify_subterms
Browse files Browse the repository at this point in the history
  • Loading branch information
JasonGross committed Jul 22, 2016
1 parent b144768 commit 1f304ca
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Algebra.v
Original file line number Diff line number Diff line change
Expand Up @@ -1299,6 +1299,10 @@ Ltac only_two_square_roots :=
=> repeat only_two_square_roots_step eq opp mul
end.

(*** Tactics for ring equations *)
Require Import Coq.setoid_ring.Ring_tac.
Ltac ring_simplify_subterms := tac_on_subterms ltac:(fun t => ring_simplify t).

Section Example.
Context {F zero one opp add sub mul inv div} `{F_field:field F eq zero one opp add sub mul inv div}.
Local Infix "+" := add. Local Infix "*" := mul. Local Infix "-" := sub. Local Infix "/" := div.
Expand Down
7 changes: 7 additions & 0 deletions src/Util/Tactics.v
Original file line number Diff line number Diff line change
Expand Up @@ -300,3 +300,10 @@ Tactic Notation "rewrite_hyp" "<-" "?*" "in" "*" := repeat do_with_hyp' ltac:(fu
Tactic Notation "rewrite_hyp" "!*" "in" "*" := progress rewrite_hyp ?* in *.
Tactic Notation "rewrite_hyp" "->" "!*" "in" "*" := progress rewrite_hyp -> ?* in *.
Tactic Notation "rewrite_hyp" "<-" "!*" "in" "*" := progress rewrite_hyp <- ?* in *.

(** Execute [progress tac] on all subterms of the goal. Useful for things like [ring_simplify]. *)
Ltac tac_on_subterms tac :=
repeat match goal with
| [ |- context[?t] ]
=> progress tac t
end.

0 comments on commit 1f304ca

Please sign in to comment.