Commit Graph

5059 Commits

Author SHA1 Message Date
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
Gerwin Klein 2f1493c7ab
aarch64 machine: add relevant non_kernel_IRQs
The non_kernel_IRQs constant collects IRQs that cannot occur in kernel
mode. For non-hyp platforms this is usually empty, for hyp platforms we
add software-generated virtual interrupts.

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 b5038beb6d
aarch64 aspec: add associate_vcpu_tcb fix from ARM_HYP
On ARM_HYP we added a fix for a problem discovered during the proof of
the VCPU invariant that the current VCPU always belongs to the current
thread. This commit ports that fix from ARM_HYP to AARCH64.

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 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 1a1fdffb11
aarch64 aspec: adjust Init_A to satisfy invariants
- align init_irq_node_ptr to its size (which is larger than in RISCV)
- remove ArmVSpaceUserRegion, because kernel has its own page table
- define global_pt_obj, add to initial heap

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 88dd8d8f7a
aarch64 haskell+machine: sync pptrTop and pptrBase with C
Sync both values with what the C code does. The corresponding comment
in C is wrong and would not produce a safe value for pptrTop (the
comment says 2^48 - 2^30), but the actual definition in C (the
equivalent of 2^40 - 2^30) is safe.

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 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 ea00978a6a
aarch64 aspec: fix decode vspace_root check
Previously the wrong cap argument was checked against being the vspace
root (cap vs vspace_cap).

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 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
Michael McInerney 3c322eab1d cparser+crefine: move h_t_array_valid_array_assertion to cparser session
Signed-off-by: Michael McInerney <michael.mcinerney@proofcraft.systems>
2023-01-30 18:00:42 +10:30
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 2c4c22ccdf
autocorres: reduce Lib dependencies
Remove dependency on Lib.thy. Theory imports of AutoCorres are now
reduced to theories that can be moved out of the Lib session.

The proof context changes a bit, but impact on test cases is minimal.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-01-25 10:13:46 +11:00
Gerwin Klein f6dbf4ab09
tools: proof fixups for LemmaBucket_C changes
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-01-25 10:13:46 +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