diff options
| author | Enrico Tassi | 2013-12-31 16:25:25 +0100 |
|---|---|---|
| committer | Enrico Tassi | 2014-01-05 16:55:59 +0100 |
| commit | f8970ec2140662274bb10f0eb8d3ca72924835c7 (patch) | |
| tree | be571df76cb769d482d389ec13e2b11cd51371b3 /kernel | |
| parent | 8e57267d4a08103506ebd6dd99b21c1f13813461 (diff) | |
Proof_using: new syntax + suggestion
Proof using can be followed by:
- All : all variables
- Type : all variables occurring in the type
- expr:
- (a b .. c) : set
- expr + expr : set union
- expr - expr : set difference
- -expr : set complement (All - expr)
Exceptions:
- a singleton set can be written without parentheses. This also allows
the implementation of named sets sharing the same name space of
section hyps ans write
- bla - x : where bla is defined as (a b .. x y) elsewhere.
- if expr is just a set, then parentheses can be omitted
This module also implements some AI to tell the user how he could
decorate "Proof" with a "using BLA" clause.
Finally, one can Set Default Proof Using "str" to any string that is
used whenever the "using ..." part is missing. The coding of this
sucks a little since it is the parser that applies the default.
Diffstat (limited to 'kernel')
| -rw-r--r-- | kernel/term_typing.ml | 4 | ||||
| -rw-r--r-- | kernel/term_typing.mli | 3 |
2 files changed, 7 insertions, 0 deletions
diff --git a/kernel/term_typing.ml b/kernel/term_typing.ml index 80da457670..55901bce93 100644 --- a/kernel/term_typing.ml +++ b/kernel/term_typing.ml @@ -135,6 +135,9 @@ let record_aux env s1 s2 = (keep_hyps env (Id.Set.union s1 s2))) in Aux_file.record_in_aux "context_used" v +let suggest_proof_using = ref (fun _ _ _ _ _ -> ()) +let set_suggest_proof_using f = suggest_proof_using := f + let build_constant_declaration kn env (def,typ,cst,inline_code,ctx) = let check declared inferred = let mk_set l = List.fold_right Id.Set.add (List.map pi1 l) Id.Set.empty in @@ -159,6 +162,7 @@ let build_constant_declaration kn env (def,typ,cst,inline_code,ctx) = ignore(Future.join cst); let vars = global_vars_set env (Lazyconstr.force_opaque (Future.join lc)) in + !suggest_proof_using kn env vars ids_typ context_ids; if !Flags.compilation_mode = Flags.BuildVo then record_aux env ids_typ vars; vars diff --git a/kernel/term_typing.mli b/kernel/term_typing.mli index 59706bb835..6f71ecd82f 100644 --- a/kernel/term_typing.mli +++ b/kernel/term_typing.mli @@ -35,3 +35,6 @@ val translate_recipe : env -> constant -> Cooking.recipe -> constant_body val infer_declaration : ?what:string -> env -> constant_entry -> Cooking.result val build_constant_declaration : constant -> env -> Cooking.result -> constant_body + +val set_suggest_proof_using : + (constant -> env -> Id.Set.t -> Id.Set.t -> Id.t list -> unit) -> unit |
