diff options
| author | letouzey | 2012-07-09 18:17:58 +0000 |
|---|---|---|
| committer | letouzey | 2012-07-09 18:17:58 +0000 |
| commit | f3870c96a192ff52449db9695b1c160834ff023f (patch) | |
| tree | c5b02c6e9a12df51ce7ca5005e0bdf0c58d74cec /printing/pptactic.ml | |
| parent | 06d096b3ff3dff8cca216091c0c5ffa3a7530e1d (diff) | |
induction/destruct : nicer syntax for generating equations (solves #2741)
The ugly syntax "destruct x as [ ]_eqn:H" is replaced by:
destruct x eqn:H
destruct x as [ ] eqn:H
Some with induction. Of course, the pattern behind "as" is arbitrary.
For an anonymous version, H could be replaced by ?. The old syntax
with "_eqn" still works for the moment, by triggers a warning.
For making this new syntax work, we had to change the seldom-used
"induction x y z using foo" into "induction x, y, z using foo".
Now, only one "using" can be used per command instead of one per
comma-separated group earlier, but I doubt this will bother anyone.
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/coq/trunk@15566 85f007b7-540e-0410-9357-904b9bb8a0f7
Diffstat (limited to 'printing/pptactic.ml')
| -rw-r--r-- | printing/pptactic.ml | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/printing/pptactic.ml b/printing/pptactic.ml index 815ee6e5ce..e1575eab73 100644 --- a/printing/pptactic.ml +++ b/printing/pptactic.ml @@ -338,11 +338,15 @@ let pr_bindings prlc prc = pr_bindings_gen false prlc prc let pr_with_bindings prlc prc (c,bl) = hov 1 (prc c ++ pr_bindings prlc prc bl) +let pr_as_ipat pat = str "as " ++ pr_intro_pattern pat +let pr_eqn_ipat pat = str "eqn:" ++ pr_intro_pattern pat + let pr_with_induction_names = function | None, None -> mt () - | eqpat, ipat -> - spc () ++ hov 1 (str "as" ++ pr_opt pr_intro_pattern eqpat ++ - pr_opt pr_intro_pattern ipat) + | Some eqpat, None -> spc () ++ hov 1 (pr_eqn_ipat eqpat) + | None, Some ipat -> spc () ++ hov 1 (pr_as_ipat ipat) + | Some eqpat, Some ipat -> + spc () ++ hov 1 (pr_as_ipat ipat ++ spc () ++ pr_eqn_ipat eqpat) let pr_as_intro_pattern ipat = spc () ++ hov 1 (str "as" ++ spc () ++ pr_intro_pattern ipat) @@ -714,14 +718,14 @@ and pr_atom1 = function | TacSimpleInductionDestruct (isrec,h) -> hov 1 (str "simple " ++ str (if isrec then "induction" else "destruct") ++ pr_arg pr_quantified_hypothesis h) - | TacInductionDestruct (isrec,ev,(l,cl)) -> + | TacInductionDestruct (isrec,ev,(l,el,cl)) -> hov 1 (str (with_evars ev (if isrec then "induction" else "destruct")) ++ spc () ++ - prlist_with_sep pr_comma (fun (h,e,ids) -> - prlist_with_sep spc (pr_induction_arg pr_lconstr pr_constr) h ++ - pr_with_induction_names ids ++ - pr_opt pr_eliminator e) l ++ - pr_opt_no_spc (pr_clauses None pr_ident) cl) + prlist_with_sep pr_comma (fun (h,ids) -> + pr_induction_arg pr_lconstr pr_constr h ++ + pr_with_induction_names ids) l ++ + pr_opt pr_eliminator el ++ + pr_opt_no_spc (pr_clauses None pr_ident) cl) | TacDoubleInduction (h1,h2) -> hov 1 (str "double induction" ++ |
