Commit Graph

5145 Commits

Author SHA1 Message Date
Gerwin Klein a6dee7bf17
access: constrain auto
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-02-09 11:46:52 +11:00
Gerwin Klein 2da61f7373
access: remove unused lemma
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-02-09 11:46:52 +11:00
Gerwin Klein 8c1d67945d
crefine: NonDetMonad.valid -> NonDetMonadVCG.valid
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-02-09 11:46:51 +11:00
Gerwin Klein 8791c1be22
proofs: hoare_pre_cont variable renamed
s/hoare_pre_cont[where a=/hoare_pre_cont[where f=/

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-02-09 11:46:51 +11:00
Gerwin Klein 7b1e140912
proofs: valid_def moved to NonDetMonadVCG
NonDetMonad.valid_def -> NonDetMonadVCG.valid_def

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-02-09 11:46:51 +11:00
Gerwin Klein 0733fa582a
proofs: alternative_valid -> alternative_wp
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-02-09 11:46:51 +11:00
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 924209c251 refine: remove bind_dummy_ret_val duplicates (now in Lib)
Signed-off-by: Michael McInerney <michael.mcinerney@proofcraft.systems>
2023-02-07 11:30:30 +10:30
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 0ec91178fe
aarch64 ainvs: factor out vm_level bit setup
Factor out the bit0/bit1 setup for the vm_level type into its own file.
It doesn't really have anything to do with BCorres where it was before.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-02-06 10:34:18 +11:00
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 55bf10c1ab
aarch64 aspec+ainvs: provide+use symbolic ppn_len definition
We initially wanted to move ucast_ucast_ppn to Kernel_Config_Lemmas.
This doesn't work, because ppn is only defined in Arch_Structs_A, but
it turns out that ppn_len is exactly the term `ipa_size - pageBits`
that the lemma needs, so instead of moving the lemma up, we make its
proof generic by providing the symbolic form of `ppn_len` instead.

This still unfolds Kernel_Config.config_ARM_PA_SIZE_BITS_40, but it
does so only trivially and directly where ppn_len is defined.

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 549157a838
aarch64 ainvs: cleanup and resolve FIXMEs
- minor style/whitespace cleanup
- resolve all smaller AARCH64-local FIXMEs
- move AARCH64-local lemmas
- fix up proof fallout from move (gained some automation in the move)

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-02-06 09:56:36 +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 1c2f1d84db
ainvs: remove proof method "prove"
The method is mostly unused and easily replaced by prop_tac.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-02-06 09:56:36 +11:00
Gerwin Klein 8f6373c7ef
aspec + aarch64 ainvs: remove duplicate definition of the_arch_cap
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-02-06 09:56:36 +11:00
Gerwin Klein 6d31cd631c
aarch64 ainvs: clean up ArchDetSchedAux_AI
Consolidate crunches and update proof style.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-02-06 09:56:36 +11:00
Gerwin Klein 747e1e2531
arm_hyp+aarch64 machine: use standard machine op naming scheme
Implementations for machine ops returning a value should have a _val
postfix. This commit brings vcpuHardwareRegVal in line.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-02-06 09:56:36 +11:00
Gerwin Klein 02d055fb5e
aarch64 aspec+ainvs: resolve FIXME move
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-02-06 09:56:35 +11:00
Gerwin Klein de9fb23fb8
aarch64 ainvs: resolve FIXMEs
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-02-06 09:56:35 +11:00
Gerwin Klein 51e22f4533
aarch64 ainvs: automatically rename bit0/bit1 lemmas
This commit automatically renames bit0.*/bit1.* lemmas (depending on
the value of vm_level) to vm_level.*

The idea is that vm_level.* can now generically refer to the right
instance, so that the same proof text works without change for both an
even and odd number of page table levels.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-02-06 09:56:35 +11:00
Gerwin Klein ef6ef86de1
aarch64 aspec+design: import flush_type from Haskell
The flush_type definition is an exact duplicate, so it makes sense
to directly re-use the Haskell definition in ASpec.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-02-06 09:56:35 +11:00
Gerwin Klein 5b7e01e5f7
aarch64 haskell: port associateVCPUTCB fix from ARM_HYP
Apply the vcpuSwitch fix to Haskell as well (was previously added to
ASpec only).

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-02-06 09:56:35 +11:00
Gerwin Klein 04a4b37a12
aarch64 ainvs: avoid magic number in ArchKernelInit
- define formally where 14 is coming from instead of trying to explain
  in a comment,
- also remove unused parts of the lemma where it is used.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-02-06 09:50:40 +11:00
Gerwin Klein 1e4b3d7573
aarch64 machine: introduce irq_len
Make it possible to refer to the size of the irq type symbolically.
So far, this is only necessary in an example state for kernel init,
but it's still nicer to avoid magic numbers.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-02-06 09:50:40 +11:00
Gerwin Klein d43aa2e296
aarch64 proofs: switch quick_and_dirty to Refine
- switch off quick_and_dirty for AInvs session
- switch on quick_and_dirty for Refine session for development

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-02-06 09:50:40 +11:00
Gerwin Klein af8a8bb749
aarch64 ainvs: AInvs sorry-freee
Co-authored-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-02-06 09:50:40 +11:00
Gerwin Klein 7eacca3760
aarch64 ainvs: add valid_global_tables to invariants
For the proofs in ArchAInvsPre we require knowledge that the default
user-level tables do not map any user-space addresses. In hyp mode, the
default user-level table is completely empty, because the kernel has
its own separate table. We encode that empty table in the
`valid_global_tables` predicate analogously to the RISCV64 formulation.

We explicitly leave `valid_global_arch_objs` as a `typ_at` predicate,
because the proofs expect `valid_global_arch_objs` to be liftable.

Co-authored-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-02-06 09:50:40 +11:00