Refactor crunch to separately specify whether crunch_simps or
crunch_wps might be useful instead of printing one combined message.
Signed-off-by: Corey Lewis <Corey.Lewis@data61.csiro.au>
Change crunch to only warn when crunch_simps or crunch_wps can make
progress on the first goal. Previously it would try on all remaining
subgoals, which led to spurious warnings when schematic postconditions
could be unified incorrectly.
Signed-off-by: Corey Lewis <Corey.Lewis@data61.csiro.au>
Crunch would print spurious warning messages when using a rule with multiple
premises. By default, crunch generates a rule like that when applied to
functions with multiple non-trivial patterns.
The main one is that crunch now uses wpsimp when determining whether a goal
can already be solved, instead of just wp. Crunch can also now use wps
when proving a goal and will now always ignore a constant if told to, even
if it is the top-level constant being crunched.
The main visible change is from wp_trace', 'wp_once' and 'wp_once_trace' to
'wp (trace)', 'wp (once)' and 'wp (once, trace)'. The option for printing a
warning for unused supplied wp rules has also been removed.
The main benefit of this is that everything in crunch is now ctrl clickable.
As an added benefit, supplied rules can now be modified by attributes when
needed.
Discard some magic that was done to instantiate an induction rule,
and instead use the existing Induct_Tacs package to apply induction
rules, which seems to be successful more often.
The main aim of this is for crunch to make consistent decisions about
whether to prove new rules. If any rules in the wp set can be used to
directly solve the goal crunch is working on, then crunch will just
use it.
Other changes include:
- crunch_ignore works properly inside locales again.
- if a rule already exists with the specific name crunch is going
to use, but that rule does not solve the goal crunch is working on
then crunch will now error.
- if crunch fails to prove a goal it will now output a warning if
adding crunch_simps or crunch_wps would allow it to make more
progess.
Add two new tactics/methods which can fix common painful problems with
schematic variables.
Method datatype_schem improves unification outcomes, by making judicious use of
selectors like fst/snd/the/hd to bring variables into scope, and also using a
wrapper to avoid singleton constants like True being captured needlessly by
unification.
Method wpfix uses strengthen machinery to instantiate rogue postcondition
schematics to True and to split precondition schematics that are shared across
different sites.
It's just a parser tweak for crunch, and runs multiple crunch commands
with the same sections (wps, ignores, etc).
Also update the comments a little, and move them closer to the anchor of
command clicks (the @{command_keyword} antiquotation).
Substantial adjustments to crunch. Main user changes are:
- 'lift' and 'unfold' mechanisms replaced by more general 'rule'.
- some more 'ignores' standardised.
- crunch has a more principled overall design:
+ discover crunch rule
* provided or by definition extraction
+ recurse according to rule
+ prove goal based on rule, recursive discoveries, standard tactic
* wp/simp adjustments tweak tactic
Excessinve tracing messages cause jEdit to pause, waiting for the user
to click "Show more tracing output. We eliminate the debugging tracing
messages by default, and use "writeln" instead for the remainder.
("writeln" doesn't cause jEdit to pause.)