aboutsummaryrefslogtreecommitdiff
path: root/src/Util/CaseUtil.v
blob: af04a1e49867fcbf4e733ab2dac133326514657d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
Require Import Coq.Arith.Arith.

Ltac case_max :=
  match goal with [ |- context[max ?x ?y] ] =>
      destruct (le_dec x y);
      match goal with
        | [ H : (?x <= ?y)%nat |- context[max ?x ?y] ] => rewrite Max.max_r by
          (exact H)
        | [ H : ~ (?x <= ?y)%nat   |- context[max ?x ?y] ] => rewrite Max.max_l by
          (exact (le_Sn_le _ _ (not_le _ _ H)))
      end
  end.