Commit Graph

862 Commits

Author SHA1 Message Date
Corey Lewis 66eda2a4d2 lib: add a crunch option for naming schemes
Some properties that crunch can be used for have different legacy naming
schemes. This commit makes it possible for different instances of crunch
to be configured for either prefix or suffix naming.

Signed-off-by: Corey Lewis <corey.lewis@proofcraft.systems>
2022-05-31 11:34:29 +10:00
Corey Lewis 33ecebe634 lib: fix crunch to only apply attributes once
This means that spurious warnings are no longer produced by crunch when adding
attributes like simp or intro.

Signed-off-by: Corey Lewis <corey.lewis@proofcraft.systems>
2022-05-30 21:57:57 +10:00
Corey Lewis 4674b5ce1d squash: update other crunch instances
Signed-off-by: Corey Lewis <corey.lewis@proofcraft.systems>
2022-05-27 15:43:37 +10:00
Corey Lewis 71b208edf5 lib: add warnings to crunch_ignore
These warn when attempting to add a constant to crunch_ignore that is
already being ignored, or when removing a constant that is not being ignored.

Signed-off-by: Corey Lewis <corey.lewis@proofcraft.systems>
2022-05-27 15:03:10 +10:00
Corey Lewis 141983368b lib: add syntax to crunch_ignore multiple instances
Add support to crunch_ignore so that multiple instances can be added to
and removed from simultaneously.

Signed-off-by: Corey Lewis <corey.lewis@proofcraft.systems>
2022-05-27 15:03:03 +10:00
Gerwin Klein a18d822cfc lib: increase oreturn automation
This is a partial cherry-pick of bcafa85c from the rt branch.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-05-10 08:00:56 +10:00
Michael McInerney 08fe7d1a63 lib: move map_set definition to OptionMonad.thy
Signed-off-by: Michael McInerney <m.mcinerney@unsw.edu.au>
2022-05-10 08:00:56 +10:00
Miki Tanaka c3a210877f lib: more opt_map lemmas for upd/foldr upd
Signed-off-by: Miki Tanaka <miki.tanaka@data61.csiro.au>
2022-05-10 08:00:56 +10:00
Miki Tanaka cba3971a86 lib: add some opt_map/opt_map_Some update lemmas
- for trivial updates, etc.
- also flip opt_map_Some_comp

Signed-off-by: Miki Tanaka <miki.tanaka@data61.csiro.au>
2022-05-10 08:00:56 +10:00
Miki Tanaka f8235a2fe6 lib: eta_contract opt_map unity/zero lemmas
for better applicability

Signed-off-by: Miki Tanaka <miki.tanaka@data61.csiro.au>
2022-05-10 08:00:56 +10:00
Miki Tanaka 0daf495578 lib: add opt_predD + unfolding lemmas for opt_pred
Signed-off-by: Miki Tanaka <miki.tanaka@data61.csiro.au>
2022-05-10 08:00:56 +10:00
Miki Tanaka dc348b5f23 lib: add some opt_map lemmas
- for unfolding, composition with Some or None (Map.empty), etc.

Signed-off-by: Miki Tanaka <miki.tanaka@data61.csiro.au>
2022-05-10 08:00:56 +10:00
Gerwin Klein 68ed2f62c2 lib: rename opt_map_left_Some to opt_map_red
This is partial cherry-pick from Miki's commit d05b80 on the rt branch.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-05-10 08:00:56 +10:00
Miki Tanaka 5bb2a4cf06 lib: add opt_pred in lib/Monad_WP/OptionMonad.thy
- opt_pred takes a predicate P and an option value x and
  returns P y if x = Some y and False if x = None
- infix notation (|<), which lets us write in the style of
     P |< projections

Signed-off-by: Miki Tanaka <miki.tanaka@data61.csiro.au>
2022-05-10 08:00:56 +10:00
Miki Tanaka 71c735540e lib: make asks and ogets coexist
- ogets and asks are equivalent
- make ogets a full abrreviation of asks
- provide the original definition of ogets as ogets_def

Signed-off-by: Miki Tanaka <miki.tanaka@data61.csiro.au>
2022-05-10 08:00:56 +10:00
Miki Tanaka f6d919f159 lib: add some basic option monad functions
Signed-off-by: Miki Tanaka <miki.tanaka@data61.csiro.au>
2022-05-10 08:00:56 +10:00
Gerwin Klein 65b7139398 lib: support for Haskell Reader monad constructs
Signed-off-by: Gerwin Klein <gerwin.klein@data61.csiro.au>
2022-05-10 08:00:56 +10:00
Miki Tanaka eda47153d1 lib: add more opt_map lemmas; opt_map_left_Some, etc.
Signed-off-by: Miki Tanaka <miki.tanaka@data61.csiro.au>
2022-05-10 08:00:56 +10:00
Gerwin Klein 4bb5899359 word_lib: move in lemma from l4v
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-03-29 08:38:25 +11:00
Gerwin Klein 2d930d69db word_lib: fix non-terminal `auto` violations
Not acceptable in either AFP or l4v.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-03-29 08:38:25 +11:00
Gerwin Klein 896434499e word_lib: fix license headers
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-03-29 08:38:25 +11:00
Gerwin Klein c953ab0396 word_lib/proofs: bundle word simp set changes
Add a bundle for global word simp set changes -- unfortunately we
can't actually do this globally, because they are mostly simp rule
removals which will be overwritten by theory merges. So this new
l4v_word_lib bundle will have to be activated/unbundled multiple times.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-03-29 08:38:25 +11:00
Gerwin Klein 65fbeb5b01 isabelle2021-1 word_lib: add lemmas from l4v
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-03-29 08:38:25 +11:00
Gerwin Klein 49f75949b0 isabelle2021-1: CSpec (via lib/BitFieldProofsLib)
Isabelle2021-1 simplifies `a << Suc 0` too eagerly, so we add simp
rules to compensate for new forms of goals. Removing the too-eager simp
rules would be less stable against theory merge.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-03-29 08:38:25 +11:00
Gerwin Klein 78930612c3 isabelle2021-1: Sep_Algebra
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-03-29 08:38:25 +11:00
Gerwin Klein 71e78ac126 isabelle2021-1 word_lib: make bit_simps [simp]
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-03-29 08:38:25 +11:00
Gerwin Klein c9f8e023f4 isabelle2021-1 word_lib: tweak word_eqI method
More controlled simpset setup, so we don't get warnings if we have
bit_simps in the simpset already.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-03-29 08:38:25 +11:00
Gerwin Klein a0bf14024e isabelle2021-1 word_lib: sync from AFP
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-03-29 08:38:25 +11:00
Gerwin Klein ac87d6e28b lib: update for Word_Lib tweaks
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-03-29 08:38:25 +11:00
Gerwin Klein bba7dd942b word_lib internal: update from definition tweaks
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-03-29 08:38:25 +11:00
Gerwin Klein 15d9167521 word_lib: provide more backwards compatible names
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-03-29 08:38:25 +11:00
Gerwin Klein 60126b5591 word_lib: use more general bit_simps in word_eqI
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-03-29 08:38:25 +11:00
Gerwin Klein 3196054268 isabelle2021-1: remove extend from TheoryData
No longer required in Isabelle2021-1 for TheoryData and GenericData

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-03-29 08:38:25 +11:00
Gerwin Klein 84a8b4a4dd isabelle2021-1 clib: update CLib session
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-03-29 08:38:25 +11:00
Gerwin Klein 0f633ce387 isabelle2021-1 lib: update Lib session, retire wpx
The benefit of the wpx method is not worth the maintenance effort.
There are still a few instances of wpx left in AInvs, which will have
to be fixed later.

We are keeping the wps method from the same file (WPEx.thy), because
that is used more widely and does not break with Isabelle2021-1

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-03-29 08:38:25 +11:00
Gerwin Klein 7ce3ccb068 isabelle2021-1 lib: remove unused theories
In particular, retire the unused AutoLevity and TSubst

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-03-29 08:38:25 +11:00
Gerwin Klein 25d2da46e1 isabelle2021-1: Word_Lib adjustments for l4v
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-03-29 08:38:25 +11:00
Gerwin Klein 1b15714cbf isabelle2021-1: sync Word_Lib from afp
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-03-29 08:38:25 +11:00
Michael McInerney 9b7df2713b lib: add forward_inv_step_rules set and forward_inv_step method
Signed-off-by: Michael McInerney <m.mcinerney@unsw.edu.au>
2022-03-28 11:04:05 +10:30
Michael McInerney 416a097cec lib: add hoare_seq_ext_skip and friends (from AInvs)
This commit was cherry-picked from the rt branch.

Signed-off-by: Michael McInerney <Michael.McInerney@data61.csiro.au>
2022-03-08 21:49:10 +10:30
Michael McInerney f9234e9f27 lib: add FIXME for repeat_unless
Signed-off-by: Michael McInerney <m.mcinerney@unsw.edu.au>
2022-03-08 21:49:10 +10:30
Michael McInerney ce3fc6b9b4 lib: add repeat_unless Eisbach method
The repeat_unless method allows one to repeatedly apply some method
until some other method can be applied. This should be particularly
useful in Hoare triple proofs that use the forward-reasoning style

This commit was cherry-picked from the rt branch.

Signed-off-by: Michael McInerney <Michael.McInerney@data61.csiro.au>
2022-03-08 21:49:10 +10:30
Gerwin Klein d3ecd0e451 aarch64 lib: add 64 bit word setup
This is equal to the setup for RISCV64 and X64.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-02-03 16:13:45 +11:00
Gerwin Klein 78007a4179 lib: add value_type command
The `value_type` top-level command allows evaluating a term down to a
natural number, and using that number to define an enumerated type, as
well as (optionally) a constant definition.

Co-authored-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2021-12-22 23:50:22 +11:00
Ryan Barry 72ab7cc180 various: resolve some new fixmes
Signed-off-by: Ryan Barry <ryan.barry@unsw.edu.au>
2021-11-12 09:39:16 +11:00
Corey Lewis f28ce0b310 lib: notify if crunch generates side-conditions
Signed-off-by: Corey Lewis <corey.lewis@unsw.edu.au>
2021-11-10 16:39:23 +11:00
Gerwin Klein 203af59e29 word_lib: make sure Word_Lib setup is not shadowed
The theory import order is important for name shadowing, including
default rules for induction and cases. This commit makes sure we
get the Word_Lib version by default, not the HOL.Word version.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2021-09-30 16:53:17 +10:00
Gerwin Klein c5a3917a6d lib: retire OR syntax for monads
The syntax OR for nondeterministic choice between two executions now
conflicts with the OR bit operation from the Isabelle distribution.
Since it was almost unused anyway, we remove it entirely and use only
the \<sqinter> symbol instead.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2021-09-30 16:53:17 +10:00
Gerwin Klein ac325266b8 Word_Lib: make word_and_max_simps 64bit clean
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2021-09-30 16:53:17 +10:00
Gerwin Klein 414eb5ce3d Word_Lib: simplify numeral + Suc 0 expressions
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2021-09-30 16:53:17 +10:00