|
Hello Felix, I'll try to answer as many of these as I can. I'll skip the ones I am unsure about. On 23/4/2012 6:06, Felix Breuer wrote: 1) How to undo definitions? It sometimes does happen that I make a "wrong" definition and would like to correct it on the REPL afterwards. How can I do that (without restarting OCaml)? As far as I know, the answer is negative. There is no notion of a locale, or context, or module in HOL Light. All theorems are stored at the same "level" (the OCaml toplevel really). Once you store a definition you are not allowed to undo or correct it, as this (for instance) may break some of the theorems you may have already proven with the old definition.
You can make REAL_FIELD into a tactic using CONV_TAC REAL_FIELD. eg: e (CONV_TAC REAL_FIELD);;
In what context do you want to compute things? - If you simply have a term that you want to evaluate, you can use the conversion directly on it. It will return a theorem showing that your term is equal to a reduced version. You can use "rhs o concl" to retrieve the result from such a theorem. - If you want to compute things in the goal of your proof, you can use CONV_TAC with the same conversion. - If you want to compute things in the assumptions of your proof, you can use (among other things) (RULE_ASSUM_TAC (CONV_RULE REAL_RAT_REDUCE_CONV)). You basically use conversions to do such computations. If you have a custom function, you need to build a custom conversion to be able to compute it. For simple definitions, you can use REWRITE_CONV[definition]. Depending on how complicated your definition is, this may become fairly hard.
I think there have been some efforts towards building a tool to do what you described, but as far as I know nothing complete has been built yet. I believe your best option at the moment is to manually break down the proof into "e" commands.
It is preferable if you can use new_recursive_definition with num_RECURSION. (In this case it fails, so there must be something I'm missing in the definition.)
You can do induction by: e (MATCH_MP_TAC num_INDUCTION);; before the second GEN_TAC below. This would change the proof altogether (possibly solving some of your problems) so I'm mentioning it here in case you were looking for it.
You can use: e (CONV_TAC NUM_REDUCE_CONV);; to get rid of the 0-0 term. I think your use of REAL_ARITH is fairly standard if you want to do something quickly, but you can't find the corresponding theorem or automated method (or they simply don't exist).
You could do: let split_sum_lemma = MATCH_MP (SPEC `(\k. f k * recip f (x - k))` SUM_CLAUSES_LEFT) (SPEC_ALL LE_0);; MATCH_MP is much more convenient in cases like this.
You can reduce this to: e(REWRITE_TAC[split_sum_lemma;SUB_0;ADD_0;ADD_AC]);;
See above! :)
Or simpler: let rewrite_x_lemma = prove (`~(x:num=0) ==> ?n:num. x = n + 1`, SIMP_TAC[num_CASES;GSYM ADD1; TAUT `!p q . ~p ==> q <=> p \/ q`]);;
You are probably looking for this: e (FIRST_X_ASSUM (ASSUME_TAC o (MATCH_MP rewrite_x_lemma)));; FIRST_X_ASSUM pops the first assumption on which the following tactic succeeds. ASSUME_TAC adds a theorem as a new assumption. MATCH_MP applies modus ponens by matching the lhs of rewrite_x_lemma to the assumption, thus returning the desired conclusion. Generally the syntax: e (FIRST_ASSUM (ASSUME_TAC o (some_rule)));; is the most straightforward way to manipulate an assumption with some_rule.
Similarly to above, you could do this in one step: e (FIRST_X_ASSUM (ASSUME_TAC o (MATCH_MP (MESON[] `(?n. x = n + 1) ==> x = (@n. x = n + 1) + 1`))));;
I'm not sure I can give a complete answer to this. I would suggest SUBST1_TAC for most such cases anyway as it gives precise control of the substitution.
I would personally go for: e (FIRST_ASSUM (ASSUME_TAC o (MATCH_MP (REAL_FIELD `!x. ~(x = &0) ==> !a. x * --(&1 / x) * a = -- a`))));; e (ASM_REWRITE_TAC[]);; but I'm sure there are even better ways of doing this. Hopefully I managed to give you some standard ways to do simple things in HOL Light. Of course, there are usually many different ways to accomplish the same thing in HOL Light, and I'm sure quite a few people here could give more elegant solutions to your questions, but at least I hope mine helped a bit. Regards, Petros -- Petros Papapanagiotou CISA, School of Informatics The University of Edinburgh Email: [email protected] --- The University of Edinburgh is a charitable body, registered in Scotland, with registration number SC005336. |
The University of Edinburgh is a charitable body, registered in Scotland, with registration number SC005336.
------------------------------------------------------------------------------ For Developers, A Lot Can Happen In A Second. Boundary is the first to Know...and Tell You. Monitor Your Applications in Ultra-Fine Resolution. Try it FREE! http://p.sf.net/sfu/Boundary-d2dvs2
_______________________________________________ hol-info mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/hol-info
