Commit Graph

962 Commits

Author SHA1 Message Date
Gerwin Klein bafe2586f4
clib: fix up qualified names
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-02-09 11:46:51 +11:00
Gerwin Klein bd449a071d
lib: theory imports + proof updates for monad refactor
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-02-09 11:46:51 +11:00
Gerwin Klein 549cb893de
lib+ainvs: pull up more empty_fail lemmas
- pull base-level empty_fail lemmas from AInvs into Monads.Empty_Fail
- apply consistent naming
- apply consistent [intro!, wp]
- make all non-conditional lemmas [simp]
- re-add context building to empty_fail rules, because the select_*
  rules may need context to solve their side condition

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-02-09 11:46:50 +11:00
Gerwin Klein a6e2d73e72
lib: introduce [empty_fail] and merge EmptyFailLib
- merge EmptyFailLib into Monads.Empty_Fail
- group Empty_Fail lemmas so it is clear where to add new ones
- add [empty_fail] so not every lemma has to declare multiple attributes
- add instructions

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-02-09 11:46:50 +11:00
Gerwin Klein e3c74c2b6e
lib/monads: remove alternative_valid in TraceMonad
subsumed by alternative_wp

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-02-09 11:46:50 +11:00
Gerwin Klein c679117676
lib/monads: style cleanup in NonDetMonadLemmas
- apply modern style
- contract some proofs
- this commit includes some lemmas factored out from NonDetMonadVCG in
  a previous commit

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-02-09 11:46:50 +11:00
Gerwin Klein 9573e5cb85
lib/monads: style cleanup in NonDetMonad
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-02-09 11:46:50 +11:00
Gerwin Klein b0da6b3ee9
lib/monads: style cleanup in MonadEq+MonadEq_Lemmas
Style and proof contraction.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-02-09 11:46:50 +11:00
Gerwin Klein 4f44b1ce7e
lib/monads: style cleanup in In_Monad
- style and some proof contraction
- `in_monad` set remains unchanged for now (could now add additional
  lemmas, but they might break things)

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-02-09 11:46:49 +11:00
Gerwin Klein 708cee52f6
lib/monads: style cleanup in WhileLoopRules
- adjusted thy imports for new theories
- apply consistent style
- fix indentation
- minor proof contraction

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-02-09 11:46:49 +11:00
Gerwin Klein 8e81962b47
lib/monads: refactor + cleanup in No_Fail
- factor out valid_NF definition and lemmas into NonDetMonad_Total
- apply modern style and (very) occasional proof contraction in both

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-02-09 11:46:49 +11:00
Gerwin Klein 6758f2b3e7
lib/monads: refactor + cleanup in NonDetMonadVCG
- factor out valid_exs definition and properties into NonDetMonad_Sat
- apply modern style to both of these and More_NonDetMonadVCG
- factor out one lemma into Monad_Lib
- better grouping of lemmas in NonDetMonadVCG
- occasional proof contraction

Should contain no real semantic differences, but might have subtle
wp set changes due to reordering (to be fixed up in a later commit).

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-02-09 11:46:49 +11:00
Gerwin Klein dfc7699407
lib/monads: add sum type to Datatype_Schematic
This should allow wpfix to automatically fix up projl/projr proofs.
This was previously not possible without drawing in Lib, but will now
be picked up by Lib since theLeft/theRight are now abbreviations.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-02-09 11:46:49 +11:00
Gerwin Klein b93335745e
lib/monads: style cleanup in Empty_Fail
Mostly contraction and some refactoring.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-02-09 11:46:48 +11:00
Gerwin Klein e51723ce5a
lib/monads: style cleanup in No_Throw
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-02-09 11:46:48 +11:00
Gerwin Klein 5e04e1b7ca
lib/monads: split up NonDetMonadVCG
Split up the material in NonDetMonadVCG into In_Monad, Det, Empty_Fail,
No_Fail, and No_Throw. Most of these can run concurrently and not all
applications need to include all of the material.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-02-09 11:46:46 +11:00
Michael McInerney 421dd9785b libtest: qualify bind for NonDetMonad
Signed-off-by: Michael McInerney <michael.mcinerney@proofcraft.systems>
2023-02-07 11:30:30 +10:30
Michael McInerney 527cdd329a clib: add ccorres_While rule
Signed-off-by: Michael McInerney <michael.mcinerney@proofcraft.systems>
2023-02-07 11:30:30 +10:30
Michael McInerney 7bf5798c0b clib: add ccorresE_gets_the rule
Signed-off-by: Michael McInerney <michael.mcinerney@proofcraft.systems>
2023-02-07 11:30:30 +10:30
Michael McInerney 3573111a7c clib: add exec_handlers_use_hoare_nothrow_hoarep rule
Signed-off-by: Michael McInerney <michael.mcinerney@proofcraft.systems>
2023-02-07 11:30:30 +10:30
Michael McInerney 2119182166 clib: move ccorresG abbreviation
Signed-off-by: Michael McInerney <michael.mcinerney@proofcraft.systems>
2023-02-07 11:30:30 +10:30
Michael McInerney c257b46009 lib: add some definitions and rules from rt branch
During the work on verifying the MCS kernel, many definitions
and rules were added to lib. This commit collects all of these,
with style improvements and some proof improvements.
In particular, this adds several results to deal with while loops,
such as corres_whileLoop

Signed-off-by: Michael McInerney <michael.mcinerney@proofcraft.systems>
2023-02-07 11:30:30 +10:30
Gerwin Klein 12c9c2bc21
lib: apply consistent style to OptionMonad
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-02-06 09:57:37 +11:00
Gerwin Klein ed0cd5b282
lib+aarch64 ainvs: make opt_pred a definition
The projection operators should be definitions so that they are stable
under simp and case splits. This enables later projection stacks to
use abbreviations that remain stable.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-02-06 09:56:37 +11:00
Gerwin Klein e5036721df
lib+ainvs+aarch64 ainvs: cleanup + move lemmas into lib
- make kheap crunch for do_machine_op generic
- make None_Some_strg available generically in LevityCatch
- move word lemmas up into Word_Lib
- move wp lemmas up into lib + minor lib cleanup

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-02-06 09:56:37 +11:00
Gerwin Klein 4001debe25
lib+ainvs: clean up LevityCatch_AI
- move proof methods spec and bspec to Eisbach_Methods
- move general lemmas to Lib
- move word lemmas to Word_Lemmas_Internal
- update proof style

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-02-06 09:56:36 +11:00
Gerwin Klein 3467e685b6 lib: remove opt_mapE from global [elim!] set
While we do want to break up full OptionMonad terms in assumptions, we
do not usually want to break up projections.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-02-02 17:56:55 +11:00
Gerwin Klein a13db04598
lib: README.md files for the new sessions
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-01-25 11:49:59 +11:00
Gerwin Klein 1893d00f83
lib: move general lemma to Lib
lifted_if_collapse has no dependencies that require it to be in
NonDetMonadLemmaBucket.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-01-25 11:48:39 +11:00
Gerwin Klein e3c2e878b9
lib+proof+autocorres: consolidate when[E]/unless[E]_wp naming
wp rules for most operators such as return, get, gets are named
return_wp, get_wp, etc. Then when, whenE, unless, unlessE operators had
an additional hoare_.. prefix that this commit removes for more
consistency.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-01-25 11:48:39 +11:00
Gerwin Klein 49c93e64ee
lib: eliminate hoare_gets_post
duplicate of hoare_gets_sp

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-01-25 11:48:39 +11:00
Gerwin Klein 625c6e359d
lib+proof: eliminate hoare_ex_wp
duplicate of hoare_vcg_ex_lift

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-01-25 11:48:38 +11:00
Gerwin Klein 9103f2b700
lib: remove unused duplicate lemma name
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-01-25 11:48:38 +11:00
Gerwin Klein a2a79ad3c4
lib: always prefer Main to HOL.HOL import
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-01-25 11:48:38 +11:00
Gerwin Klein b4b9a00a28
lib+refine: eliminate select_singleton_is_return
Also make select_singleton [simp], because it is later declared
globally [simp] anyway.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-01-25 11:48:38 +11:00
Gerwin Klein b1daf38dda
lib+crefine: eliminate list_case_return2
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-01-25 11:48:38 +11:00
Gerwin Klein 6bf7c92d22
lib+crefine: zipWith lemma [simp] consolidation
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-01-25 10:19:41 +11:00
Gerwin Klein 40dc7eaa01
lib+autocorres: remove last AutoCorres Lib dependency
Moving `Monad_Equations.thy` and `More_NonDetMonadVCG.thy` into Monads
session enables us to remove the Lib and CLib session dependencies in
AutoCorres.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-01-25 10:19:03 +11:00
Gerwin Klein 2d2cadb86b
lib+proof+tools: move LemmaBucket_C into CParser
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-01-25 10:18:11 +11:00
Gerwin Klein cb34fc3c4c
lib: introduce Basics session
This session currently contains only one theory (CLib), which we want
to include both in Lib and later independently in CParser/AutoCorres.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-01-25 10:18:11 +11:00
Gerwin Klein c9259eb8a4
lib: reduce dependencies of LemmaBucket_C
Remove Lib dependency. Introduce a new theory CLib which contains base
lemmas needed in LemmaBucket_C.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-01-25 10:13:46 +11:00
Gerwin Klein 0f71104ca9
lib+autocorres: move NatBitwise to AutoCorres
Since most bitwise operations are now available by default for nat,
only word abstraction in AutoCorres depends on NatBitwise.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-01-25 10:13:45 +11:00
Gerwin Klein a9fd0142be
all: adjust theory imports for TypHeapLib change
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-01-25 10:13:45 +11:00
Gerwin Klein 1ea235c152
lib+c-parser: move TypHeapLib into CParser
It has no other lib dependencies and over time should probably be
merged directly into umm theories. For now, move the entire file
and keep dependency structure.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-01-25 10:13:44 +11:00
Gerwin Klein b92974d93f
lib: theory import fixes for new sessions
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-01-24 11:30:05 +11:00
Gerwin Klein 0aa42207e5
lib/monads: move Datatype_Schematic into wp
Not at monad definition itself, more tool setup for WPFix.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-01-24 11:30:05 +11:00
Gerwin Klein cc0ca9118e
lib: introduce Monads session
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-01-24 11:30:05 +11:00
Gerwin Klein 2722fdcfc1
lib: move more monad thys into Monads directory
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-01-24 11:30:05 +11:00
Gerwin Klein bba173cb99
lib+READMEs: rename Monad_WP to Monads
In preparation for a separate Monads session.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-01-24 11:30:05 +11:00
Gerwin Klein 34c427d09d
lib: add separate Eisbach_Tools session
The idea is to collect Eisbach extensions and things like Apply_Trace,
Apply_Debug etc here.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-01-24 11:30:04 +11:00