Commit Graph

547 Commits

Author SHA1 Message Date
Rafal Kolanski 31b635401d riscv: setup cspec build for L4V_ARCH=RISCV64
C parser and word setup copied from X64
2018-06-27 10:05:44 +02:00
Corey Lewis d77d31a77c lib: Refactor crunch so that it can be used for both the nondet monad and the trace monad 2018-06-26 14:45:28 +10:00
Rafal Kolanski d4996217b3 lib: add generic lemmas from SELFOUR-584 updates
Mainly concerning word_ctz and enumeration_both.
2018-06-15 18:48:47 +10:00
Corey Lewis c686d6e776 lib: Make Crunch more effective at applying supplied rules 2018-06-08 15:48:32 +10:00
Japheth Lim 3e51484a9b lib/time_methods: add subseq example 2018-06-06 14:39:03 +10:00
Corey Lewis dceb2692e2 lib: Add a warning to crunch if it does not do anything 2018-06-06 10:41:17 +10:00
Thomas Sewell c4f43fd8dc lib: two examples of concurrency reasoning.
Two different simple examples which make use of the prefix refinement
framework and the rely-guarantee VCG.
2018-05-28 16:53:01 +10:00
Thomas Sewell 64efe07ff7 lib: refinement theories related to concurrency.
These theories supply the interference trace monad with a useful notion of
simulation/refinement, which could be used to prove functional correctness
(similar to corres) in the presence of concurrency.
2018-05-28 15:56:48 +10:00
Thomas Sewell 891ae7cfa4 lib: some simple rules about rtrancl/rtranclp.
These generalise trancl_id from HOL to cover rtrancl and rtranclp.

Also improve one minor proof.
2018-05-28 15:39:39 +10:00
Thomas Sewell 5deb58a997 lib: add the Interference Trace Monad.
Adds another style of monad to the existing ones in lib/Monad_WP.

The Interference Trace monad is an extension of the nondeterministic
state monad to record interactions between the task and its environment.
It supports a parallel composition operator.

The VCG for this monad includes the same Hoare triple style as for the
state monads, and also includes a rely-guarantee quintuple which can be
used to verify a parallel composition of programs.
2018-05-28 15:39:39 +10:00
Japheth Lim b3e8155f73 lib: refactor time_methods and test cases 2018-05-21 14:30:00 +10:00
Japheth Lim f224e2392d lib: add time_methods method for comparing proof tactic speeds 2018-05-21 14:30:00 +10:00
Japheth Lim 0e780ace82 lib: add theory LexordList, for lexicographical string comparison
By default, strings (and other lists) cannot be lexicographically
ordered because our theories pull in a conflicting instance of the
"order" class for lists. This theory adds a "lexord_list" wrapper type
that provides lexicographical order.
2018-05-21 14:22:54 +10:00
Japheth Lim 1209dc4f2d lib: remove unused Etanercept tool 2018-05-18 14:59:09 +10:00
Thomas Sewell 26df0c04dd lib: Replace subseq->match abbreviation.
The subseq_abbreviation mechanism was a useful way of quoting some of a
definition or term, specialised to the case of left-associated sequences.

Lambda abstractions are now handled better.

The previous subseq mechanism required some generalisations. It is now replaced
by match_abbreviation, which is a more general approach.

The match mechanism picks a term, can select a matching subterm, and can
rewrite the selected term based on pattern matching also. The new mechanism
can cover all the cases of the previous one, as shown in examples.
2018-05-10 15:00:22 +10:00
Joel Beeren 4dcd4df2b6 lib: add foldl lemma to LemmaBucket 2018-04-19 05:27:05 +10:00
Thomas Sewell 10bf84a02c lib: Subseq_Abbreviation: also save a reassoc thm.
In the cases where the sequence constructor is associative, it can
be handy to immediately save a 'reassociate' theorem, that can be used
to parenthesise out the abbreviated subsequence from any sequence it
appears in.

This can be done by supplying the association rule.
2018-04-17 17:43:00 +10:00
Thomas Sewell 9cef82ebe3 lib: Subseq_Abbreviation, quote subsequence terms.
It's annoying that, given automatic definitions (such as we have
with the Haskell translator and C parser), there's no way to capture
a few lines of them.

This mechanism allows you to add an abbreviation for some subsequence of
elements, found somewhere in a theorem, where a sequence is defined by its
constructor and the start and end points are matched by pattern matching.
2018-04-17 15:02:12 +10:00
Corey Lewis 55d20591b4 lib: improved crunch
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.
2018-04-04 12:09:47 +10:00
Gerwin Klein b421aa70bb clib: use proper context under FOCUS_PREMS
removes the harmless but annoying "Bad Simplifier Context" warnings in cinit
2018-03-26 14:37:22 +11:00
Thomas Sewell d4d89922af lib/wp: Adjust some problematic attributes.
In particular, some intro! attributes for some wp rules are removed.
These previously caused auto/fastforce to play a really strange role
in some proofs.
2018-03-16 14:57:09 +11:00
Thomas Sewell 587972d40e lib/wp: Standard when/unless/whenE/unlessE rules.
The rules for these conditional monadic operators have been a bit
ad-hoc until now, with frequent headaches around the whenE/throwError
pattern.

Adding standard split rules ensures these operators are treated uniformly.
2018-03-16 14:56:11 +11:00
Thomas Sewell a70aeda39b lib: Datatype_Schematic and WPFix.
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.
2018-03-16 14:55:33 +11:00
Thomas Sewell 23088c3c18 lib/wp: More aggressive version of wp_pre.
The previous wp_pre would apply a rule (from the named theorems wp_pre) unless
there was already a schematic in the goal. This is frequently prevented by an
irrelevant schematic.

This implementation applies a wp_pre rule unless one of the resulting goals
can be solved by "erule FalseE", that is, unless we would promote a schematic
into the assumption position (or, more rarely, there was already an assumption
schematic or False as an assumption).
2018-03-16 14:54:37 +11:00
Thomas Sewell 7bff086fef lib/wp: Slight cleanup in WP-method.ML 2018-03-16 14:54:29 +11:00
Thomas Sewell be45b71fd7 lib/wp: Bundle to restore classic combinators.
The previous combinator change is desirable, but some proofs are too
difficult to fix. This bundle restores the classic behaviour.
2018-03-16 14:53:23 +11:00
Thomas Sewell 652cbb966e Initial proof updates for combinator changes. 2018-03-16 14:53:22 +11:00
Thomas Sewell b0f2217af4 lib/wp: Remove old wp combinator rules.
These combinator rules do something like what wp_pre does now.

They were helpful in the ancient past, but now that wp_pre exists it is
much better to just use automation.
2018-03-16 14:51:31 +11:00
Rafal Kolanski b749a23b87 lib: add find_names command to find other names of a theorem
When given a theorem, find_names finds other names the theorem appears
under, via matching on the whole proposition. It will not identify
unnamed theorems.
2018-02-25 21:47:35 +11:00
Matthew Brecknell 6ee106571a lib ccorres_rewrite: discard everything sequenced after a Throw
Also introduce simple conditional rewriting.
2018-02-18 12:39:16 +11:00
Thomas Sewell d2f38a0a80 lib: Add multi-crunch command 'crunches'.
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).
2018-02-02 10:26:15 +11:00
Thomas Sewell 5152952abb lib: Cleanup in crunch-cmd.ML
Mostly syntactic. Ensure less debug messages are generated
unconditionally.
2018-02-02 10:26:09 +11:00
Matthew Brecknell d108e3edee lib: a more intuitive definition of sign_extend for words
Also includes some supporting lemmas useful in bitfield proofs.
2017-12-21 21:41:01 +11:00
Matthew Brecknell edb30fa752 lib: faster simplification for common cases of word_and_max_word
In particular, this speeds up some bitfield proofs.
2017-12-21 21:41:01 +11:00
Matthew Brecknell a6d245b83f trivial lib: quote identifiers in text blocks for document builds 2017-12-21 16:19:23 +11:00
Thomas Sewell 00bc13d7ce Demo theory for strengthen. 2017-12-19 16:40:14 +11:00
Matthew Brecknell 09b793855b word-lib: add some lemmas about sign extension 2017-12-18 12:48:10 +11:00
Thomas Sewell d88c6e567b Upgrade strengthen for assumptions, methods.
The strengthen implementation can now do a bit more.

The new method strengthen_asm also adjusts assumptions.

The new method strengthen_meth takes a method as a parameter,
e.g. apply (strengthen_meth \<open> rule order.trans \<close>)
does the same thing as apply (strengthen order.trans)
with scope for other exciting applications I haven't thought of.
2017-12-13 17:40:06 +11:00
Matthew Brecknell d27f84767a lib: add methods for extracting conjuncts from the conclusion 2017-11-28 19:02:49 +11:00
Rafal Kolanski 877312f080 lib: generic/word/monad/hoare lemmas from SELFOUR-242 verification
Notably useful is hoare_vcg_lift_imp' which generates an implication
rather than a disjunction.

Monadic rewrite rules should be modified to preserve bound variable
names, as demonstrated by monadic_rewrite_symb_exec_l'_preserve_names.
Addressing this more comprehensively is left as a TODO item for the
future (see VER-554).
2017-11-27 21:00:04 +11:00
Matthew Brecknell 210465edf3 autocorres-crefine: make AutoCorres more compatible with existing CRefine proofs 2017-11-22 15:37:36 +11:00
Matthew Brecknell 0570943ee8 lib: make some elimination rules safer
Elimination against the pattern "P v", where both "P" and "v" are free,
can loop, if the rule is marked as a safe elimination rule. In the rules
modified in this commit, variable "v" provides no real benefit, so we
replace the pattern with "P".
2017-11-22 12:18:16 +11:00
Matthew Brecknell 079d5dec23 autocorres-crefine: make AutoCorres tools available in CRefine 2017-11-22 12:18:16 +11:00
Matthew Brecknell 919d0f4137 autocorres-crefine: update modifies proofs for Isabelle2017 2017-11-22 10:59:57 +11:00
Matthew Brecknell 40f83c5637 autocorres-crefine: add tools for moving between ccorres and corres
This commit adds a method `ac_init`, which converts a ccorres goal into
a corres goal. It also adds an attribute `ac`, which converts a ccorres
fact into a corres fact, in a form suitable for solving goals produced
by `ac_init`.
2017-11-22 10:59:57 +11:00
Matthew Brecknell 281fa6931b autocorres-crefine: fix modifies proofs after wp changes 2017-11-22 10:59:57 +11:00
Matthew Brecknell bd44bab6c6 autocorres-crefine: update for Isabelle2016-1 2017-11-22 10:59:57 +11:00
Gerwin Klein 30c812854a lib: prettier monad type printing 2017-11-21 11:00:42 +11:00
Gerwin Klein 68ae97454e lib: more modifiers for wpsimp (wp_del, simp_del) 2017-11-03 08:09:29 +11:00
Thomas Sewell 8753c05b20 Expand eval_bool; add a method word_eqI_solve.
A number of proofs begin with word_eqI followed by some similar steps,
suggesting a 'word_eqI_solve' proof method, which is implemented here.

Many of these steps are standard, however a tricky part is that constants of
type 'nat' which encode a particular number of bits must often be unfolded.
This was done by expanding the eval_bool machinery to add eval_int_nat, which
tries to evaluate ints and nats.

Testing eval_int_nat revealed the need to improve the code generator setup
somewhat. The Arch locale contains many of the relevant constants, and they are
given global names via requalify_const, but the code generator doesn't know
about them. Some tweaks make them available. I *think* this is safe for
arch_split, as long as the proofs that derive from them are true in each
architecture.
2017-11-01 17:30:46 +11:00