Commit Graph

767 Commits

Author SHA1 Message Date
Japheth Lim a4878ccb2b lib: move crunch tests to LibTest session 2018-09-27 15:03:24 +10:00
Japheth Lim a8129d0695 lib: add license header text
These two files were @TAG-ged but without copyright header text.
2018-09-27 15:03:24 +10:00
Japheth Lim e968766e12 lib: test cases for Qualify tool 2018-09-27 15:03:24 +10:00
Japheth Lim f24db02c3b lib: test cases for Insulin and ShowTypes tools 2018-09-27 15:03:24 +10:00
Japheth Lim d43680fd43 lib: add Trace_Schematic_Insts_Test to LibTest 2018-09-27 15:03:24 +10:00
Edward Pierzchalski f8b7603d8a lib: TRY attribute: handle more errors
Widens the set of exceptions TRY ignores to anything that isn't
an interrupt.
2018-09-20 18:17:23 +10:00
Edward Pierzchalski d7fd868007 lib: Add attribute to ignore errors (VER-1007)
Adds the `TRY` attribute combinator, which applies the provided
inner attribute but ignores any failure by returning the original
theorem.
2018-09-19 11:57:19 +10:00
Callum Bannister 751480007b lib+sysinit: add extended separation algebra and forward reasoning tactics
Added Extended Separation Algebra, which contains septraction and
separating coimplication.
Added Sep_Forward which contains tactics for reasoning forwards in
separation logic, updated sep_cancel.
Updated SysInit proofs.
2018-09-18 12:01:52 +10:00
Edward Pierzchalski 91ab6007e8 lib: move test theories in Lib to LibTest
Leaves out crunch tests, which seem fragile to being moved.
2018-09-14 16:35:27 +10:00
Edward Pierzchalski e82cdd149c lib: add method to shorthand larger methods
Adds the `supply_local_method` command and `local_method` methods,
which store and apply methods as a way to shorten repeated
references to large or complicated methods.
2018-09-14 16:35:27 +10:00
Edward Pierzchalski 5af827b65e lib: time_methods: add flag to skip failure output
Adds a flag `skip_fail` to the method `time_methods`, to skip
output when a timed method fails.
2018-09-14 16:35:27 +10:00
Edward Pierzchalski 552ecb9dcd Eisbach: lib: add higher-order 'repeat' method.
repeat: Repeat a given inner method a given number of times.
2018-09-07 16:40:13 +10:00
Ilya Yanok 0044c57e14 lib: change runErrorT to runExceptT to match Haskell code 2018-09-04 14:59:45 +10:00
Rafal Kolanski df41be8092 lib: trivial: remove trailing whitespace in root.tex 2018-08-21 15:46:03 +10:00
Gerwin Klein 33c9712d0a Isabelle2018: record c-parser dependency for LibTest
A clean build complains about the generated grammar files missing from the C
parser even if the session itself does not depend on the CParser session.
2018-08-20 09:06:37 +10:00
Gerwin Klein c9f32225a4 Word_Lib: sync with AFP 2018-08-20 09:06:37 +10:00
Gerwin Klein 934ba36fd1 lib/clib: move DetWPLib from CLib to Lib
Doesn't have any C dependencies.
2018-08-20 09:06:37 +10:00
Gerwin Klein efe8d89a99 Word_Lib: record OTHER_BSD license for AFP contrib theory 2018-08-20 09:06:36 +10:00
Gerwin Klein 04f4336a5f Word_Lib: sync with AFP 2018-08-20 09:06:36 +10:00
Gerwin Klein 62b0ab207b Word_Lib: consolidate LemmaBucket and Lib lemmas into Word_Lib 2018-08-20 09:06:36 +10:00
Gerwin Klein 9850ae107c Isabelle2018 lib: requalify facts up to pattern equivalence
It looks like "interpretation" occasionally renames schematic variables.
Finding global facts up to pattern equivalence should give us the original
global version.
2018-08-20 09:06:36 +10:00
Gerwin Klein 52992889e5 Isabelle2018: Sep_Algebra 2018-08-20 09:06:36 +10:00
Gerwin Klein 1ae3a8d65b Isabelle2018: Lib update 2018-08-20 09:06:36 +10:00
Gerwin Klein cb49fa3b4b Isabelle2018: Extend_Locale update
The proof method "fact" no longer has access to thms produced by "interpret"
2018-08-20 09:06:36 +10:00
Gerwin Klein ccacaa46fc Isabelle2018: Subgoal_Methods update 2018-08-20 09:06:36 +10:00
Gerwin Klein 41316f1c4b Isabelle2018 lib: remove evaluator parameter for value_abbreviation
Unused and the name information you'd need is not visible in Isabelle2018 any more.
2018-08-20 09:06:36 +10:00
Gerwin Klein b02bf100dd lib/Word_Lib: import merge fixup from AFP
This commit keeps Word_Lib in sync with the AFP
2018-08-20 09:06:36 +10:00
Gerwin Klein 7f3fa50a32 lib/Word_Lib: sync with AFP 2018-08-20 09:06:35 +10:00
Gerwin Klein 6b9d9d24dd Isabelle2018: new "op x" syntax; now is "(x)"
(result of "isabelle update_op -m <dir>")
2018-08-20 09:06:35 +10:00
Gerwin Klein 011e08458e Isabelle2018: new comment syntax
(result of "isabelle update_comments <dirs>")
2018-08-20 09:06:35 +10:00
Gerwin Klein b1aa74d306 Isabelle2018 lib: Word_Lib 2018-08-20 09:06:34 +10:00
Gerwin Klein 84081d1206 Isabelle2018 lib: Apply_Trace 2018-08-20 09:06:34 +10:00
Gerwin Klein 349e8a0411 lib: repair WPTutorial and CorresTest
Parts of CorresTest don't work any more after changes to the underlying
example functions.
2018-08-20 09:06:34 +10:00
Gerwin Klein 0f1efbaa37 lib: add Lib test sessions 2018-08-20 09:06:34 +10:00
Gerwin Klein 9489b03ede lib: record AutoLevity session as broken 2018-08-20 09:06:34 +10:00
Gerwin Klein 6486bad264 lib: make Lib session a test dependency
Also ensure that the C parser is built before Lib, because it depends
on generated grammar files that need `make'.
2018-08-20 09:06:34 +10:00
Gerwin Klein b5cdf4703f globally use session-qualified imports; add Lib session
Session-qualified imports will be required for Isabelle2018 and help clarify
the structure of sessions in the build tree.

This commit mainly adds a new set of sessions for lib/, including a Lib
session that includes most theories in lib/ and a few separate sessions for
parts that have dependencies beyond CParser or are separate AFP sessions.
The group "lib" collects all lib/ sessions.

As a consequence, other theories should use lib/ theories by session name,
not by path, which in turns means spec and proof sessions should also refer
to each other by session name, not path, to avoid duplicate theory errors in
theory merges later.
2018-08-20 09:06:34 +10:00
Gerwin Klein 6aa78c310a lib: fix unused/historical StateMonad theory 2018-08-20 09:05:52 +10:00
Gerwin Klein b66d26f7e6 lib/Word_Lib: use qualified session imports
This also makes the dependency on lib/Distinct_Prop and $L4V_ARCH/WordSetup
more explicit.
2018-08-20 09:05:52 +10:00
Japheth Lim f617dc60e7 lib/Trace_Schematic_Insts: refactor; improve ML style 2018-08-16 14:21:16 +10:00
Japheth Lim cd1d05165d lib/Trace_Schematic_Insts: refactor and add code comments 2018-08-16 14:21:16 +10:00
Japheth Lim fe5c9b846c lib/Trace_Schematic_Insts: some cleanup; add basic tests 2018-08-16 14:21:16 +10:00
Japheth Lim f62ca33408 lib: add trace_schematic_insts method combinator 2018-08-16 14:21:16 +10:00
Japheth Lim 6065d3e7b0 lib/Time_Methods_Cmd: small fixes
Add method description string; fix a theory import.
2018-08-16 14:21:16 +10:00
Corey Lewis 52ce1022c6 lib: Change Add_Locale_Code_Defs to filter out rules with sort hypotheses. 2018-08-14 11:32:31 +10:00
Gerwin Klein 53fde5e5ff lib/design: enable more Haskell-like list comprehension syntax
Accept "[f x | x \leftarrow t]" in addition to "[f x . x \leftarrow t]",
because the former is what naturally comes out of the Haskell translator, and
the regexps that would be necessary in the Haskell translator for this are
distasteful.

JIRA-VER 927
2018-08-06 11:22:54 +10:00
Gerwin Klein 24fbac1e67 lib: remove non-exhaustive pattern warning 2018-08-06 11:22:53 +10:00
Gerwin Klein 9a4d2677e3 lib+spec: move definition of machine_word to Word_Lib
JIRA VER-963
2018-08-06 11:22:52 +10:00
Thomas Sewell 955b2ca8b2 lib: add non-cond-simplification, use in wpsimp.
Adds "non-conditional simplification" method simp_no_cond, and
various equivalents.

This is done by setting the simplifier depth limit to 0, which seems
to be a useful case. It prevents expensive conditional simplification
attempts but leaves the simplifier strategy otherwise unchanged.

This is easy to set up, and link to wpsimp.
2018-08-03 18:25:30 +10:00
Thomas Sewell ea7c58bf13 lib/crunch: use induct package.
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.
2018-08-03 12:20:49 +10:00
Thomas Sewell 9ba41a20ce lib: Improve documentation of Strengthen_Demo.
Clarify that the second proof is essentially a forward reference to
concepts that will be explained later in the file.
2018-08-03 12:20:49 +10:00
Thomas Sewell bfce624b2b lib: adjust some congruence rules for strengthen.
Adjusting the strengthen congruence rules for conjunction
and disjunction makes other conjuncts available as assumptions
in strengthening a conjunction. This may be useful occasionally.
2018-08-03 12:20:49 +10:00
Matthew Brecknell c390013909 x64 crefine: prove several lemmas in Retype_C
To prove that retyping a TCB establishes the state relation for TCBs,
it is necessary to prove that the C FPU null state is always equal to
the Haskell FPU null state. This commit therefore includes some
machinery for maintaining the state relation for the FPU null state,
and repairs many proofs.
2018-07-05 16:23:15 +10:00
Michael Sproul 19d9085b15 lib: word lemma about mask and shiftl 2018-07-05 16:23:15 +10:00
Michael Sproul df9c791a3f lib: add some word lemmas about sless, word_bits 2018-07-05 16:23:15 +10:00
Michael Sproul 4bc5fad560 lib: add ccorres_disj_division 2018-07-05 16:23:15 +10:00
Thibaut Perami 0335855e4e x64 crefine: partially remove unmapPageTable_ccorres sorry 2018-07-05 16:23:15 +10:00
Matthew Brecknell b9efd5f7b2 clib: infrastructure for using AutoCorres in CRefine 2018-07-05 16:23:15 +10:00
Matthew Brecknell 0a6c6f50f3 lib: ccorres_rewrite support for creturn_void 2018-07-05 16:23:15 +10:00
Matthew Brecknell 1ec4a8b12c lib: miscellaneous word lemmas 2018-07-05 16:23:15 +10:00
Matthew Brecknell bcac2c8492 x64: clear some sorry proofs from CSpace_C
Also update some Haskell and abstract specs relating to IO ports.
2018-07-05 16:23:14 +10:00
Rafal Kolanski d99efd0dd5 lib: Word_Lemmas: sign_extended addition and ~~mask lemmas 2018-07-05 16:23:14 +10:00
Joel Beeren e8c14602c5 lib: change Corres_C to use machine_word rather than word32 for the error case 2018-07-05 16:23:14 +10:00
Japheth Lim 46ccc2ba60 lib: change where temp file for AutoLevity tracing is created
We need to create the temp file on the same file system as the output
file in order for atomic renaming to work properly.
2018-07-04 19:24:36 +10:00
Japheth Lim a4b0287e9a lib: log exceptions from AutoLevity trace writer 2018-07-04 19:24:36 +10:00
Japheth Lim da86625580 lib: fail gracefully if AutoLevity can't install hooks in unpatched Isabelle 2018-07-04 19:24:36 +10:00
Japheth Lim 791f6ea3c6 lib: write autolevity traces on session shutdown
This commit depends on patching Isabelle to add a session shutdown hook.
2018-07-04 19:24:36 +10:00
Japheth Lim 00cab83c23 lib: fix AutoLevity JSON string encoding 2018-07-04 19:24:36 +10:00
Japheth Lim 301db83d2c lib: write one combined output file from AutoLevity_Run
The output file is still placed in Lib for now. Needs further adjustment.
2018-07-04 19:24:36 +10:00
Gerwin Klein 38242af44a lib: fundef termination rule for unlessE .. $ throwError ,, 2018-06-27 10:06:48 +02:00
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
Alejandro Gomez-Londono 7da301cfc3 Isabelle2017: update CRefine (ARM) for RC0 2017-10-30 12:23:26 +11:00
Matthew Brecknell 0d3325ee68 Isabelle2017: update lib for RC0
* ML Proof_Context.fact_alias renamed to alias_fact.

  * Named_Target.init removed redundant parameter.

  * Simplified Greatest, removed GreatestM.

  * Introduced thm_node type in proofterm.ML.
2017-10-30 12:23:26 +11:00
Matthew Brecknell 0102ef172a Isabelle2017: remove String_Compare
This was a workaround for an Isabelle2016-1 performace regression, and
is no longer required.
2017-10-30 12:23:26 +11:00
Matthew Brecknell b41f67ac51 Isabelle2017: update Word_Lib for RC0
* Various equalities from underlying HOL-Word have been reoriented.

  * word_eqI is no longer rule_format.

  * zdiff_zmod_* were renamed to mod_diff_*_eq.
2017-10-30 12:23:26 +11:00
Thomas Sewell 619aae2184 Add some methods to trym. 2017-10-27 13:39:32 +11:00
Thomas Sewell 3e720455a3 Spring cleaning in strengthen.
Make the tactic steps more explicit, especially involving the -oblig-
premises for which I've seen a bug in the past.
2017-10-27 13:39:32 +11:00
Thomas Sewell beef91f1b6 New eval_bool method, evaluated boolean terms.
This method/simproc uses the code generator setup to evaluate terms of boolean
type that can be reduced to True/False. Should avoid manual unfolding in
various places.
2017-10-27 13:39:32 +11:00
Thomas Sewell ed3b26f4ec Add "Try Methods" mechanism trym.
Like try0/try but extensible by new methods. Methods must currently
be single tokens, however Eisbach makes it easy to install such
abbreviations.
2017-10-27 13:21:08 +11:00
Pang Luo 6b9912c47a manually adjust non-obvious cases of tab to space replacement 2017-10-20 14:22:36 +11:00
Matthew Brecknell 184d6b70b7 remove most tab characters 2017-10-20 14:22:36 +11:00
Thomas Sewell 4eedad846a Add command/keyword 'value_abbreviation'.
This computes a value (like the existing value keyword) and also saves
the result of that computation as an abbreviation.

This will be useful in CRefine etc to give names to magic numbers that
derive from configuration variables/constants.
2017-10-12 12:44:45 +11:00
Adrian Danis 8273ca818d cspec: Remove redundancy in build rules and theory files for c-kernel builds
Removes files that were duplicated in cspec/$L4V_ARCH directories to exist directly in
the cspec directory and contain $L4V_ARCH switches where needed. This allows for a single
Makefile for building the C kernel and the KernelInc_C theory, which is different between
architectures, to still exist per L4V_ARCH.

As the build location of the C kernel, and the resulting kernel_all.c_pp artifact, is
moved this change needs to be reflected in all the theory files that refer to it.
2017-09-21 13:23:04 +10:00
Matthew Brecknell 27ae2ca752 lib: move some lemmas from bitfield proofs to word-lib 2017-08-11 11:24:25 +10:00
Joel Beeren 82863978bd Merge branch 'master' into x64 2017-08-09 17:10:06 +10:00
Joel Beeren 87b067de1e clib: Adjust Corres_C to use new CLanguage file from c-parser 2017-08-09 17:02:50 +10:00
Thomas Sewell 148f897bbc Add some comments.
After discussion with others, it's clear this is not self-documenting.
A few comments might make it easier to understand what's going on.

Thanks to Matt Brecknell for the more explanatory example.
2017-08-04 11:28:54 +10:00
Thomas Sewell 9f8297adc8 Attribute for adjusting preconds.
Should work for corres-like rules. Works on an example. Needs
real testing.
2017-08-04 11:27:23 +10:00
Matthew Brecknell 238e8b307e x64: merge master 2017-07-21 11:27:12 +10:00
Daniel Matichuk 5b1f7dde43 lib/corres_method: update docs 2017-07-18 12:13:16 -06:00
Daniel Matichuk a1ffb52888 lib/corres_method: more corresK map rules
Introduces F_all2, which allows us to have
a proper stateless precondition in corres_mapM_list_all2
(has access to all introduced goal parameters).

With it is the implicit assumption that the generated
condition can be phrased as a per-element property (although
it may talk about the list as a whole).
2017-07-18 12:13:16 -06:00
Daniel Matichuk 03ee8a9b3e lib/corres_method: more corresK lemmas
* rules for when the state relation is Id.
* rules for modify
* trivial return relations over units (i.e. = or dc)
  are now always weakened into a schematic
2017-07-17 13:09:46 -06:00
Daniel Matichuk 7bf1e1449d lib/corres_method: bug fixes
* corres_pre now performs more conservative weakening
  if the goal is already a corresK goal. This prevents
  introducing a verification condition in the middle
  of a proof.

* corres_inst_eq avoids splitting if statements when
  unfolding corres_protect.

* corres_rv correctly handles schematic atomic postconditions
  (previously would loop, now instiates them to True)

* corressimp fails on schematic goals to avoid looping
2017-07-17 13:09:46 -06:00
Daniel Matichuk 7964a5c9a8 lib/corres_method: more robust schematics
corres method now fails outright if the subgoal
conclusion is schematic, otherwise it can loop.

Handle cases where corressimp
would leave preconditions uninstantiated if the
goal was solved by clarsimp.
2017-07-17 13:09:46 -06:00
Daniel Matichuk fb6cd81aa8 lib/corres_method: tuning and documentation 2017-07-17 13:09:46 -06:00
Daniel Matichuk 66c34a3e60 lib/corres_method: method for corres_rv
This removes corres_choice in favour of making corres_rv smarter.
Now corres_rv can propagate a stateless condition, and the new
corres_rv method (called from corres) tries to push the generated
obligation into the appropriate place (stateless, left or right
precondition) based on which variables it discusses.

This avoids most cases where the corres_rv_wp_left/right or
corres_rv_defer rules needed to be specified manually.
2017-07-17 13:09:46 -06:00
Daniel Matichuk af314bdbff lib/corres_method: careful treatment for schematics
The new "corres_choice_true" and "corres_choice_false" constants
represent a deferred choice for how to propagate a generated
stateless precondition. If possible, we would prefer to do so
via the outermost stateless precondition, since it has access
to all green variables. Importantly corres_rv_defer_left/right
are subsumed by the more general corres_rv_defer.

Also we introduce alternative wp_comb rules which introduce
a corres_inst_eq goal, rather than a raw meta-implication. This
is to avoid cases where the existing wp_comb methods would incorrectly
introduce schematic assumptions, resulting in unprovable goals. This
allows for more carefully controlling unification in cases where
the precondition of a hoare triple doesn't have access to all
necessary green variables.
2017-07-17 13:09:09 -06:00
Daniel Matichuk 89b2e78722 lib/corres_method: fix test for latest method 2017-07-17 13:08:19 -06:00
Daniel Matichuk d1da0bf4ff lib/corres_method: add mapM, mapM_x and whenE rule 2017-07-17 13:08:19 -06:00
Daniel Matichuk 7a229632fc lib/corres_method: misc bugfixes
Avoid introducing schematic assumption when corres preconditions
are concrete put stateless condition is schematic.

Avoid empty ruleset for corres_concrete_rER: causes corres to
loop unless it has at least one member.
2017-07-17 13:08:19 -06:00
Daniel Matichuk ac4ab01c9f lib/corres_method: mark more rules as corres_split
Since corres_splits rules are applied conservatively, we
can safely put the straightforward "corresK_if" rule in it,
leaving the reverse rule for corres_search.

Also "when" and "liftM" rules should be corres_splits,
rather than corresK, to handle cases where we might have
some more specific rule about a particular scenario and don't
necessarily want to unwrap the function.
2017-07-17 13:08:19 -06:00
Daniel Matichuk 4818bfb032 lib/corres_method: add more conservative correswp
Correswp is wp but with more conservative treatment for
schematics. Rules in wp_comb that do precondition weakening
are avoided when the precondition is schematic, and there
is a final check which fails if any schematic preconditions
are found.

Realistically this should be the default behaviour for wp, but
that's a potentially bigger change.
2017-07-17 13:08:19 -06:00
Daniel Matichuk 680c12992e lib/corres_method: better lift_corres_args
Handles multiple arguments and fails if no arguments are lifted
2017-07-17 13:08:19 -06:00
Daniel Matichuk 07c54b5276 lib/corres_method: repair Corres_Test after changes 2017-07-17 13:06:56 -06:00
Daniel Matichuk 26ec1733fd lib/corres_method: misc tuning 2017-07-17 13:06:55 -06:00
Daniel Matichuk d8e0bd1d22 lib/corres_method: remove simp step from corres
Instead of doing rewriting corres should only rely on
rule application to ensure it only manipulates the
head function (and only if such manipulation causes
corres progress to be made).
2017-07-17 13:06:55 -06:00
Daniel Matichuk 07ed0a42d8 lib/corres_method: generalize assumption protection
Generated goal premises (i.e. from bind or if split rules)
should in most cases be redundant, as necessary conditions can
simply be propagated. By aggressively protecting them, we afford
ourselves greater control over how function bodies are rewritten.
2017-07-17 13:06:55 -06:00
Daniel Matichuk e8ce56f5d2 lib/corres_method: ex_abs -> ex_abs_underlying
ex_abs appears later in Refine so it can just be
rephrased as an abbreviation
2017-07-17 12:55:48 -06:00
Daniel Matichuk 57086fd782 lib/corres_method: make theory for corresK lemmas
Includes mapME_x rule
2017-07-17 12:55:48 -06:00
Daniel Matichuk 63f68eb6c1 lib/corres_method: unfold protect_r in corressimp
Allow corressimp to use the return-value relation in its clarsimp step
if doing so allows it to solve the subgoal.

This addresses some occasions where wp generates in-place goals that can
be easily solved (rather than pushing them into preconditions).
2017-07-17 12:55:48 -06:00
Daniel Matichuk f9fde43783 lib/corres_method: misc cleanup 2017-07-17 12:55:48 -06:00
Daniel Matichuk 46d5278f23 lib/corres_method: speed up corresc
This avoids any backtracking when solving the contradictions
emerging from left/right case splitting. Should result in 2-3x
speedup in some cases.
2017-07-17 12:55:47 -06:00
Daniel Matichuk 64d4a29e08 lib/corres_method: add const for instantiation
Some schematic instantiations require knowledge from return-value
relations. The special const "corres_eq_inst" indicates to corres
that a schematic instantiation should be possible/obvious by
unfolding the protected assumptions and applying fastforce.
2017-07-17 12:55:47 -06:00
Daniel Matichuk e07af805af lib/corres_method: add better corres_rv rules 2017-07-17 12:55:47 -06:00
Daniel Matichuk fac5b22095 lib/corres_method: hide return relation
Protect the return value relation by default so we can control
the simplifier.
2017-07-17 12:51:58 -06:00
Daniel Matichuk b7b25d89fa lib/corres_method: add corres to wp lifting rules 2017-07-17 12:51:58 -06:00
Alejandro Gomez-Londono 796887d9b1 Removes all trailing whitespaces 2017-07-12 15:13:51 +10:00
Joel Beeren 81064fdb55 idle-thread-pd: run idle thread with the global PD all the time.
This avoids the multicore scenario of the idle thread running in the
address space that has been deleted by a thread running on another core.
2017-07-11 11:29:34 +10:00
Sidney Amani 08940d5612 Fix bug in apply_trace when used with grouped lemmas.
This commit fixes a typo in apply_trace which
prevented correct printing of the index of
the lemma used in a grouped lemma.
An example is given in Apply_Trace_Cmd.thy
2017-07-04 11:51:45 +10:00
Gerwin Klein 54a8d1642e x64 cspec: arch-split Substitute; add sign_extend for bfgen
- arch-split Substitute and dependencies
 - add the function sign_extend to the bitfield proof library for
   new generated specs/proofs
2017-06-29 17:13:18 +10:00
Matthew Brecknell 2f4b822da9 x64: configure arch-specific array types 2017-06-22 17:24:53 +10:00
Gerwin Klein 18a7a76715 wordlib: show type for ucast/scast/revcast
Idea and initial code by Simon Winwood.
2017-06-19 14:32:44 +10:00
Rafal Kolanski a5c9384df5 clib: ccorres_grab_asm
like ccorres_gen_asm, but when your last conjunct is K (...)
2017-06-19 14:32:40 +10:00
Rafal Kolanski 0abead8f71 clib: add ccorres_rewrite_cond_sr_Seq
analogous to non-Seq version
2017-06-19 14:32:40 +10:00
Matthew Brecknell 9ea2232d11 Word_Lib: miscellaneous conditional injectivity rules 2017-06-19 14:32:39 +10:00
Matthew Brecknell 0bbfb85d85 Word_Lib: add le_mask_shiftl_le_mask 2017-06-19 14:32:39 +10:00
Rafal Kolanski 088cdf8cc6 clib: add ccorres_rewrite_cond_sr
When faced with a stateful IF conditional on the C side, when you know
exactly what that conditional is evaluating w.r.t. to Haskell side, you
can now say what it is and prove it in an eager manner, in a spirit
similar to ccorres_symb_exec_r_known_rv* lemmas.
2017-06-19 14:32:34 +10:00
Rafal Kolanski 9dbb5e4e2e clib: remove seL4-related lemmas from Ctac.thy 2017-06-19 14:32:33 +10:00
Daniel Matichuk 776408a2e9 lib/corres_method: add better corres_rv rules 2017-06-19 14:32:31 +10:00
Alejandro Gomez-Londono e99bd4d5f2 lib: properly defining arrayListUpdate (Fix) 2017-06-19 14:32:27 +10:00
Alejandro Gomez-Londono c850a8270a lib: Adding some lemmas about init
* init_Snoc: init (xs @ [x]) = xs

  * init_upto_enum_upt: init [0.e.n] = [0..<n]
2017-06-19 14:32:27 +10:00
Miki Tanaka 7e79b1b7b2 changes after rebasing (for isabelle2016-1 and the new wp) 2017-06-19 14:32:21 +10:00
Alejandro Gomez-Londono 059e67bc77 arm-hyp invariants: Changes to non_vspace_obj and valid_vso_at
tags: [VER-670]
2017-06-19 14:32:21 +10:00
Miki Tanaka 1f8127c6cc arm-hyp (abstract/design/machine): add ARM_HYP directories 2017-06-17 16:26:11 +10:00
Matthew Brecknell c01e9f68c6 x64: progress in VSpace_R
Corres lemmas are proven. Remaining:
- A handfull of Hoare triples.
- The Haskell spec for invalidateASID needs to be updated
  to close a small hole in each of unmap_pd_corres and
  unmap_pdpt_corres.
2017-04-24 13:58:37 +10:00
Matthew Brecknell 5788ada1eb x64 refine: fix Retype_R
Also:
- Design spec and haskell invariants fixes.
- Moves corresK rules for mapM and mapM_x into Corres_Method.
2017-04-11 10:19:21 +10:00
Daniel Matichuk cccb7033b8 lib/apply_debug: show protected subgoals
This overrides the default proof state printing function to also
show any subgoals which have been hidden (protected).

This makes proof states shown during apply_debug more
comprehensible.
2017-04-06 12:11:54 +10:00
Matthew Brecknell e263d4e7cd c-parser: improve support for 64-bit platforms
* Correct 64-bit pointer alignment.
* Consistently use 'addr' type alias for pointer values.
2017-04-03 14:44:17 +10:00
Rafal Kolanski c41c7a97ca update references from/to moved crefine, parametrise over L4V_ARCH 2017-03-31 16:13:41 +11:00
Matthew Brecknell 659088cc13 x64: merge master 2017-03-29 20:22:12 +11:00
Daniel Matichuk 1b7aa4b7c7 corres_method: add some documentation
Fixup proofs for test theory
2017-03-28 22:30:02 +11:00
Daniel Matichuk 6697068695 corres_method: remove corres_concrete_P, reorder preconditions
Prefer to solve corres_rv/stateless preconditions first. This
lets them easily be introduced as assumptions with context_conjI.
2017-03-28 22:30:01 +11:00
Daniel Matichuk 336d99f450 corres_method: update Corres_Test for new corresK
apply_debug steps now slightly different, different
verification condition.
2017-03-28 22:30:00 +11:00
Daniel Matichuk d1193f3080 corres_method: don't add F to goal prems
This causes too much unintentional simplification.
2017-03-28 22:30:00 +11:00
Daniel Matichuk 4e3bcc38da corres_method: major overhaul to use corres_underlyingK
This gives the corres method its own calculus where it has better
control over additional rule assumptions.
2017-03-28 22:29:59 +11:00
Daniel Matichuk 2c61894459 corres_method: add right-hand variant of normal_corres
This allows stateless preconditions to propagate from the
right (concrete) side rather than the left side as usual.
2017-03-28 22:29:58 +11:00
Daniel Matichuk c20a112a0c corres_method: more careful treatment of schematics
This adds new classes of corres rules which require different
goal parameters to be instantiated. corressimp avoids applying
wp or simp rules which would expose schematics.
2017-03-28 22:29:58 +11:00
Daniel Matichuk 3880048eb1 corres_method: invoke corresc from corres
This is done so that "corres_once" will consider it a successful
application if it manages to perform a case split.
2017-03-28 22:29:57 +11:00
Daniel Matichuk e21059823f corres_method: better symbolic execution support
- Abstract symbolic execution theorems into named_theorems
- More rules for error monad
2017-03-28 22:28:07 +11:00
Daniel Matichuk e2ad6f76a3 lib/rule_by_method: add "atomized" attribute
This recovers the original behaviour of the "atomize" attribute,
which converts a Pure rule into a HOL one.
2017-03-28 21:53:11 +11:00
Daniel Matichuk 24ee520350 lib/eisbach_methods: make print_headgoal a primitive tactic
This avoids administrative operations that SIMPLE_METHOD performs
2017-03-28 21:51:57 +11:00