From 1cd1801ee86d6be178f5bce700633aee2416d236 Mon Sep 17 00:00:00 2001 From: msozeau Date: Wed, 28 Oct 2009 22:51:46 +0000 Subject: Integrate a few improvements on typeclasses and Program from the equations branch and remove equations stuff which moves to a separate plugin. Classes: - Ability to define classes post-hoc from constants or inductive types. - Correctly rebuild the hint database associated to local hypotheses when they are changed by a [Hint Extern] in typeclass resolution. Tactics and proofs: - Change [revert] so that it keeps let-ins (but not [generalize]). - Various improvements to the [generalize_eqs] tactic to make it more robust and produce the smallest proof terms possible. Move [specialize_hypothesis] in tactics.ml as it goes hand in hand with [generalize_eqs]. - A few new general purpose tactics in Program.Tactics like [revert_until] - Make transitive closure well-foundedness proofs transparent. - More uniform testing for metas/evars in pretyping/unification.ml (might introduce a few changes in the contribs). Program: - Better sorting of dependencies in obligations. - Ability to start a Program definition from just a type and no obligations, automatically adding an obligation for this type. - In compilation of Program's well-founded definitions, make the functional a separate definition for easier reasoning. - Add a hint database for every Program populated by [Hint Unfold]s for every defined obligation constant. git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/coq/trunk@12440 85f007b7-540e-0410-9357-904b9bb8a0f7 --- parsing/g_vernac.ml4 | 2 ++ parsing/ppvernac.ml | 5 ++++- parsing/prettyp.ml | 2 +- parsing/printer.ml | 6 +++--- 4 files changed, 10 insertions(+), 5 deletions(-) (limited to 'parsing') diff --git a/parsing/g_vernac.ml4 b/parsing/g_vernac.ml4 index 7494ffd7c9..2fd822636e 100644 --- a/parsing/g_vernac.ml4 +++ b/parsing/g_vernac.ml4 @@ -538,6 +538,8 @@ GEXTEND Gram | IDENT "Existing"; IDENT "Instance"; is = identref -> VernacDeclareInstance is + | IDENT "Existing"; IDENT "Class"; is = identref -> VernacDeclareClass is + (* Implicit *) | IDENT "Implicit"; IDENT "Arguments"; qid = smart_global; pos = OPT [ "["; l = LIST0 implicit_name; "]" -> diff --git a/parsing/ppvernac.ml b/parsing/ppvernac.ml index 8a8248bf4c..6449add92e 100644 --- a/parsing/ppvernac.ml +++ b/parsing/ppvernac.ml @@ -741,7 +741,10 @@ let rec pr_vernac = function | VernacDeclareInstance id -> - hov 1 (str"Instance" ++ spc () ++ pr_lident id) + hov 1 (str"Existing" ++ spc () ++ str"Instance" ++ spc () ++ pr_lident id) + + | VernacDeclareClass id -> + hov 1 (str"Existing" ++ spc () ++ str"Class" ++ spc () ++ pr_lident id) (* Modules and Module Types *) | VernacDefineModule (export,m,bl,ty,bd) -> diff --git a/parsing/prettyp.ml b/parsing/prettyp.ml index f96a94fb42..b7e2187197 100644 --- a/parsing/prettyp.ml +++ b/parsing/prettyp.ml @@ -786,7 +786,7 @@ let print_typeclasses () = let pr_instance env i = (* gallina_print_constant_with_infos i.is_impl *) (* lighter *) - print_ref false (ConstRef (instance_impl i)) + print_ref false (instance_impl i) let print_all_instances () = let env = Global.env () in diff --git a/parsing/printer.ml b/parsing/printer.ml index eacad74c4c..d9dced7916 100644 --- a/parsing/printer.ml +++ b/parsing/printer.ml @@ -540,9 +540,9 @@ let cmap_to_list m = Cmap.fold (fun k v acc -> v :: acc) m [] open Typeclasses -let pr_instance i = - pr_global (ConstRef (instance_impl i)) - +let pr_instance i = + pr_global (instance_impl i) + let pr_instance_gmap insts = prlist_with_sep fnl (fun (gr, insts) -> prlist_with_sep fnl pr_instance (cmap_to_list insts)) -- cgit v1.2.3