Commit Graph

922 Commits

Author SHA1 Message Date
Gerwin Klein 409d780e07
x64 ainvs: resolve FIXME move
These lemmas are in the right place, they should not be moved.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-02-09 11:46:52 +11:00
Gerwin Klein 91533a274e
ainvs: add invs_strengthen
A lemma set for the strengthen method to pull `invs` out of
implications. Together with simp and conj_cong, this can help avoid
proving `invs` multiple times (which tends to blow up the proof state).

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-02-09 11:46:52 +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 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 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 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 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 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
Gerwin Klein 2784c760df
aarch64 ainvs: ArchSyscall_AI sorry-free
Co-authored-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-02-06 09:50:39 +11:00
Gerwin Klein 23f0add6ae
aarch64 ainvs: ArchKernelInit sorry-free
Co-authored-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-02-06 09:50:39 +11:00
Gerwin Klein 13e9cd00c3
aarch64 ainvs: CNodeInvs sorry-free
Co-authored-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-02-06 09:50:39 +11:00
Gerwin Klein b7df1b7795
aarch64 ainvs: ArchArch sorry-free
Co-authored-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-02-06 09:50:39 +11:00
Gerwin Klein 2ef1c4994c
aarch64 ainvs: progress in ArchArch
Co-authored-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-02-06 09:50:38 +11:00
Gerwin Klein 6dfc95f76d
aarch64 ainvs: progress in ArchArch
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-02-06 09:50:38 +11:00
Gerwin Klein 379ed93f21
aarch64 ainvs: initial progress on ArchArch_AI
Co-authored-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-02-06 09:50:37 +11:00
Gerwin Klein 04a4972c6d
aarch64 ainvs: ArchFinalise sorry-free
Co-authored-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-02-06 09:50:37 +11:00
Gerwin Klein 1a7609b7d1
aarch64 ainvs: unmap_page_table for NormalPT only
Ensure in valid_pti that page table operations, in particular
unmap_page_table, are only called on NormalPTs. This means we can
remove the vspace_for_asid precondition in the associated lemmas.

Co-authored-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-02-06 09:50:36 +11:00
Gerwin Klein 60a1469f20 riscv+aarch64 ainvs+refine: adjust for opt_mapE change
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-02-02 17:56:55 +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 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 6dcbd4f09f
spec+proofs+autocorres: theory import fixes
Adjust theory imports for new sessions.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-01-24 11:30:06 +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 9c3a7faefd
lib+proofs: s/non_fail_/no_fail/
Some of the no_fail lemmas had he wrong name (non_fail instead of
no_fail).

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-01-19 17:02:10 +11:00
Gerwin Klein 79eccd3c10
lib+spec+proofs: proof fixes for NonDetMonadLemmaBucket split
Very minor changes, but in many modules.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-01-19 17:01:34 +11:00
Gerwin Klein 3960115459
lib+proofs+sys-init+tools: proof updates for Fun_Pred_Syntax
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-01-09 14:54:11 +11:00
Michael McInerney 9b33cfad36 update copyright
Signed-off-by: Michael McInerney <michael.mcinerney@proofcraft.systems>
2022-11-09 15:52:50 +11:00
Gerwin Klein 9ef097e85f aarch64 ainvs/cleanup: prefer invariant syntax
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-11-09 08:26:44 +11:00
Gerwin Klein 05838c4855 aarch64 ainvs: progress in ArchFinalise_AI
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-11-09 08:26:44 +11:00
Gerwin Klein 46adec77fd aarch64 ainvs: ArchIpc_AI sorry-free
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-11-09 08:26:44 +11:00
Gerwin Klein 52fcfa5f06 aarch64 ainvs: ArchTcb_AI sorry-free
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-11-09 08:26:44 +11:00
Gerwin Klein ba8f8a6be3 aarch64 ainvs: ArchVSpaceEntries_AI sorry-free
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-11-09 08:26:44 +11:00
Gerwin Klein 3f4f36e05a aarch64 ainvs: ArchEmptyFail_AI sorry-free
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-11-09 08:26:44 +11:00
Gerwin Klein 009fa075d5 aarch64 ainvs: ArchInterrupt_AI sorry-free
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-11-09 08:26:44 +11:00
Gerwin Klein 74c525ffcc aarch64 ainvs: asid_map sorries in ArchFinalise
Close some of the more hairy asid_map-related sorries in
ArchFinalise_AI.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-11-09 08:26:44 +11:00
Rafal Kolanski 29a997e0fe riscv64+aarch64 ainvs: remove two unused lemmas
set_asid_pool_empty and delete_asid_empty_table_pt aren't used on
RISCV64 (despite being proved and declared [wp]). Hopefully these won't
be needed on AARCH64.

Signed-off-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
2022-11-09 08:26:44 +11:00
Rafal Kolanski 5040547836 aarch64 ainvs: progress on ArchFinalise_AI
Signed-off-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
2022-11-09 08:26:44 +11:00