Commit Graph

484 Commits

Author SHA1 Message Date
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