diff options
| author | Erik Martin-Dorel | 2019-02-25 01:52:27 +0100 |
|---|---|---|
| committer | Erik Martin-Dorel | 2019-04-23 12:54:43 +0200 |
| commit | 540a581a42114d7cf19b0135d7ad3702fa7cdaca (patch) | |
| tree | 5148df39863ffff212b9bf2a879d94ac87f34e9d /plugins | |
| parent | 8279f7673c89254139869ac3a3688e12658db471 (diff) | |
[ssr] under: Strenghten over & Add test_big_andb
* Rely on a new tactic unify_helper that workarounds the fact
[apply Under.under_done] cannot unify (?G i...) with (expr i...) in
[|- @Under T (expr i...) (?G i...)]
when expr is a constant expression, or has more than one var (i...).
Idea: massage the expression with Ltac to obtain a beta redex.
* Simplify test-suite/ssr/under.v by using TestSuite.ssr_mini_mathcomp
and add a test-case [test_big_andb].
* Summary of commands to quickly test [under]:
$ cd .../coq
$ make plugins/ssr/ssreflect.vo plugins/ssr/ssrfun.vo plugins/ssr/ssrbool.vo
$ cd test-suite
$ touch prerequisite/ssr_mini_mathcomp.v
$ make
$ emacs under.v
Diffstat (limited to 'plugins')
| -rw-r--r-- | plugins/ssr/ssreflect.v | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/plugins/ssr/ssreflect.v b/plugins/ssr/ssreflect.v index 229f6ceb1a..7e2c1c913f 100644 --- a/plugins/ssr/ssreflect.v +++ b/plugins/ssr/ssreflect.v @@ -550,8 +550,33 @@ End Under. Register Under as plugins.ssreflect.Under. Register Under_from_eq as plugins.ssreflect.Under_from_eq. +Ltac beta_expand c e := + match e with + | ?G ?z => + let T := type of z in + match c with + | context f [z] => + let b := constr:(fun x : T => ltac:(let r := context f [x] in refine r)) in + rewrite -{1}[c]/(b z); beta_expand b G + | (* constante *) _ => + let b := constr:(fun x : T => ltac:(exact c)) in + rewrite -{1}[c]/(b z); beta_expand b G + end + | ?G => idtac + end. + +Ltac unify_helper := + move=> *; + lazymatch goal with + | [ |- @Under _ ?c ?e ] => + beta_expand c e + end. + Ltac over := - solve [ apply Under.under_done | by rewrite over ]. + solve [ apply Under.under_done + | by rewrite over + | unify_helper; eapply Under.under_done + ]. (* The 2 variants below wouldn't work on [test-suite/ssr/over.v:test_over_2_1] (2-var test case with evars). |
