Commit Graph

5347 Commits

Author SHA1 Message Date
Gerwin Klein dc4955de6e
aarch64 refine: lemma moved to Word_Lib
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-09-27 14:28:35 +10:00
Gerwin Klein fe3ebf03b9
lib: lemmas moved from aarch64 refine
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-09-27 14:28:35 +10:00
Gerwin Klein 9f7e8f8351
word_lib: anti-monotonicity of shiftr
Co-authored-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-09-27 14:28:35 +10:00
Gerwin Klein 5f741944aa
aarch64 refine: move lemmas to lib
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-09-27 14:28:35 +10:00
Gerwin Klein 6793a9499d
lib: move lemmas from refine/AARCH64/ArchAcc
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-09-27 14:28:35 +10:00
Gerwin Klein 4c69a420ef
lib: fix ML warning
The (=) syntax is Isabelle, the ML syntax is still (op =)

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-09-27 14:28:34 +10:00
Gerwin Klein 62618fc48f
aarch64 refine: improve decode invariance crunch
With adjustment of ARMMMU_improve_cases, the decode functions can all
be done in a single crunch invocation.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-09-27 14:28:34 +10:00
Gerwin Klein c263749d4f
aarch64 refine: consolidate dmo_invs_no_cicd' lemmas
With a slightly better lifting rule, these can all be grouped and
proved automatically.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-09-27 14:28:34 +10:00
Gerwin Klein 6bfdecdbf9
aarch64 refine: defer some FIXMEs to CRefine
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-09-27 14:28:34 +10:00
Gerwin Klein 43c0759388
aarch64 refine: leave comment instead of FIXME
Might be useful for later proofs, but no need to fix now.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-09-27 14:28:34 +10:00
Gerwin Klein cf0e636c0e
aarch64 refine: resolve trivial FIXMEs
These have either already been resolved, are trivial moves within one
theory, or they are questions that the rest of the proof has now
answered.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-09-27 14:28:34 +10:00
Rafal Kolanski 2e3c97d055
aarch64 refine: Orphanage sorry-free
Signed-off-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
2023-09-27 14:28:33 +10:00
Gerwin Klein 8f2710d54d
aarch64 refine: Detype_R sorry-free
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-09-27 14:28:33 +10:00
Gerwin Klein 1fde0480c7
aarch64 refine: progress in Detype_R
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-09-27 14:28:33 +10:00
Gerwin Klein ffd038f69e
aarch64 refine: ADT_H sorry-free
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-09-27 14:28:33 +10:00
Gerwin Klein a0311bd946
aarch64 refine: Interrupt_R sorry-free
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-09-27 14:28:33 +10:00
Gerwin Klein 1f05109562
aarch64 refine: Ipc_R sorry-free
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-09-27 14:28:33 +10:00
Gerwin Klein da76bcaac8
aarch64 refine: Arch_R sorry-free
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-09-27 14:28:32 +10:00
Gerwin Klein c745d4ef57
aarch64 aspec: fix flush type in decode_vspace_invocation
decode_vspace_invocation operates on vspace flush labels, not page
flush labels.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-09-27 14:28:32 +10:00
Gerwin Klein 1fb96c7f1c
aarch64 ainvs: mark addrFromPPtr_mask_ipa
Lemma can potentially be removed if not used in the rest of Refine.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-09-27 14:28:32 +10:00
Gerwin Klein e2355c7114
aarch64 haskell: check cap type in checkVSpaceRoot
Correctly check the type of the table the PageTableCap points to in
checkVSpaceRoot (must be a VSRootPT, not NormalPT).

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-09-27 14:28:32 +10:00
Gerwin Klein d849c0bea2
aarch64 haskell: fix syscall arg error reporting
The argument numbers in the error messages for
decodeARMFrameInvocationMap are slightly off.

Same bug exists in C, see also seL4/seL4#1075.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-09-27 14:28:32 +10:00
Gerwin Klein 0e8048b49e
aarch64 aspec+ainvs: sync user_vtop check with C
The user_vtop check in decode_fr_inv_map_wf can be relaxed from >= to >
as done in Haskell and C.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-09-27 14:28:32 +10:00
Gerwin Klein 522cef18c1
aarch64 refine: Finalise_R sorry-free
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-09-27 14:28:31 +10:00
Gerwin Klein 73ba0cee03
aarch64 refine: IpcCancel_R sorry-free
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-09-27 14:28:31 +10:00
Gerwin Klein 1f60044d83
aarch64 refine: Schedule_R sorry-free
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-09-27 14:28:31 +10:00
Gerwin Klein 1ea097a7bf
aarch64 refine: Untyped_R sorry-free
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-09-27 14:28:31 +10:00
Gerwin Klein 2ec696f224
aarch64 refine: Retype_R sorry-free
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-09-27 14:28:31 +10:00
Gerwin Klein 4913aa8af9
aarch64 haskell: tweak createNewCaps definition
Tweak formulation of createNewCaps for page tables to be in the expected
"addr ~elem~ map .." form. The previous definition was not wrong, but
the lemmas in Retype_R expect the set membership form.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-09-27 14:28:30 +10:00
Gerwin Klein e74d5fe4b8
aarch64 refine: progress in Retype_R
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-09-27 14:28:30 +10:00
Gerwin Klein f14217e294
aarch64 refine: progress in Retype_R
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-09-27 14:28:30 +10:00
Gerwin Klein d16d35ef58
aarch64 refine: VSpace_R sorry-free
Main progress is in VSpace_R, with some fallout in ArchAcc_R, ADT_R, and
Schedule_R for invariant and spec changes.

General obj_at preservation for setVMRoot does not hold and is relegated
to something more specific in Schedule_R

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-09-27 14:28:30 +10:00
Gerwin Klein c6281810d4
aarch64 aspec+ainvs: add valid_asid_map invariant
Refine needs slightly stricter information about asid maps, in
particular we need to know explicitly that asid 0 never maps to
a VSpace. This is the reverse of valid_vmid_table, but unfortunately
does not fully follow from valid_vmid_table, because there can
be VSpaces mapped without an assigned VMID.

We shift the test for 0 < asid from entry_for_asid to vspace_for_asid
so we can use entry_for_asid in the formulation of the invariant.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-09-27 14:28:30 +10:00
Gerwin Klein 438e27a8f1
aarch64 aspec: fix do_flush spec bug
cleanInvalidate should be using cleanInvalidateCacheRange_RAM.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-09-27 14:28:30 +10:00
Gerwin Klein 7713dffccc
aarch64 ainvs: updates for spec change
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-09-27 14:28:29 +10:00
Gerwin Klein 345818d38f
aarch64 aspec: cleanByVA_PoU in perform_pg_inv_map
Add missing cache machine op.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-09-27 14:28:29 +10:00
Gerwin Klein d16b4fd518
aarch64 ainvs: new invariant on vmid_table
The vmid_table never maps ASID 0. We managed to get through AInvs
without this property, but Refine does need it later.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-09-27 14:28:29 +10:00
Gerwin Klein c77d6497a7
aarch64 aspec: sync with Haskell
Fix two small spec bugs where ASpec was out of sync with Haskell and C.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-09-27 14:28:29 +10:00
Gerwin Klein 7ae4e55594
aarch64 refine: ArchAcc_R sorry free
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-09-27 14:28:29 +10:00
Gerwin Klein 6e576674eb
aarch64 refine: invariant update lemmas
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-09-27 14:28:29 +10:00
Gerwin Klein 322f4f91d6
aarch64 refine: remove pspace_canonical'
This concept no longer makes sense on AARCH64, we will either need to
know that certain addresses are in user_region (which implies
canonical_user, which is more strict than canonical), or we will need
to know they are in the kernel_window, which is also more strict than
canonical. We'll only find out for sure in CRefine.

Both cases are liftable from valid_vspace_uses and
pspace_in_kernel_window from AInvs, so instead of a new invariant, the
plan is to use Haskell assertions to transport the relevant info to
CRefine when needed.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-09-27 14:28:26 +10:00
Rafal Kolanski deade608ac crefine: change misleading proof step in CSpace_RAB_C
Trying to figure this out was very educational, since ccorres_abstract
was used without intending to abstract a variable, the xf' and lambda
name were both red herrings (in fact, this proof only worked if xf' was
instantiated with an *irrelevant* C local var name), and the body was
not transformed.

Signed-off-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
2023-09-15 06:10:04 +10:00
Gerwin Klein c4369f512c lib: add docs and test for Corres_Method
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-08-30 21:59:37 +02:00
Gerwin Klein 09691962ed lib: factor out is_safe_wp method
Factor out is_safe_wp from corres method, so that we can refer to it
later in the documentation.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-08-30 21:59:37 +02:00
Gerwin Klein f80d7f8b37 lib: on the use of corres_liftM_simp rules
Explain that these are not nice simp rules, what one should do instead,
and why we leave them as is despite all that.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-08-30 21:59:37 +02:00
Gerwin Klein 7595c02d49 riscv refine: adjust for (no_asm) in Corres_Method
The (no_asm) for corres goals is now properly enforced, which means
it is now really necessary to provide terminal corres rules in their
proper form.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-08-30 21:59:37 +02:00
Gerwin Klein 51ebfd6ebe lib: enforce simp (no_asm) in Corres_Method
The subst_all rule in the standard simp set can circumvent the (no_asm)
mode of simp, which we are using in the corres method.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-08-30 21:59:37 +02:00
Gerwin Klein 1482841847 lib: add a breakpoint for corres_cleanup
This is useful for debugging the proof method for solving side
conditions, and will show which goals corres_cleanup is invoked on.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-08-30 21:59:37 +02:00
Corey Lewis 917fff59bb lib: update for trace monad refactor
Signed-off-by: Corey Lewis <corey.lewis@proofcraft.systems>
2023-08-23 11:53:22 +10:00
Corey Lewis 4a44874a26 lib/monads: restyle and reorder trace monad files
Signed-off-by: Corey Lewis <corey.lewis@proofcraft.systems>
2023-08-23 11:53:22 +10:00