Commit Graph

5284 Commits

Author SHA1 Message Date
Corey Lewis aa8b108b1d lib/monads: reorder files in ROOT
Signed-off-by: Corey Lewis <corey.lewis@proofcraft.systems>
2023-08-09 12:07:06 +10:00
Corey Lewis 67946d414c lib: consistent Trace filename prefix
Signed-off-by: Corey Lewis <corey.lewis@proofcraft.systems>
2023-08-09 12:07:06 +10:00
Corey Lewis 2c8f9eeff1 lib+spec+proof+autocorres: consistent Nondet filename prefix
Signed-off-by: Corey Lewis <corey.lewis@proofcraft.systems>
2023-08-09 12:07:06 +10:00
Corey Lewis 9b9e613c57 lib/monads: move different monads to subdirectories
Signed-off-by: Corey Lewis <corey.lewis@proofcraft.systems>
2023-08-09 12:07:06 +10:00
Corey Lewis 9b90b9e34a lib+spec+proof+autocorres: update for renamed Reader_Option_Monad
Signed-off-by: Corey Lewis <corey.lewis@proofcraft.systems>
2023-08-09 12:07:06 +10:00
Corey Lewis 26f41e1764 lib/monads: rename OptionMonad to Reader_Option_Monad
Signed-off-by: Corey Lewis <corey.lewis@proofcraft.systems>
2023-08-09 12:07:06 +10:00
Corey Lewis c9dc6d2850 docs/setup: add step for installing cabal
Signed-off-by: Corey Lewis <corey.lewis@proofcraft.systems>
2023-07-19 10:17:21 +10:00
Corey Lewis fa484da6af monads: synchronise with rt branch
Signed-off-by: Corey Lewis <corey.lewis@unsw.edu.au>
2023-07-07 13:03:18 +10:00
Corey Lewis d87f5e13b5 crefine: update for no_name_eta
Signed-off-by: Corey Lewis <corey.lewis@proofcraft.systems>
2023-07-05 17:04:50 +10:00
Corey Lewis a0be68c211 clib+crefine: add no_name_eta to crefine tactics
This leads to improved consistency and better names for bound variables.

Signed-off-by: Corey Lewis <corey.lewis@proofcraft.systems>
2023-07-05 17:04:50 +10:00
Gerwin Klein 01a42167f9
riscv refine: example corres method use
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-06-30 15:58:14 +10:00
Gerwin Klein fad4b70825
refine: make corres method available in Refine
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-06-30 15:58:14 +10:00
Gerwin Klein 691c9e257f
lib: some remarks on corres_mapM*
Explain why the rule is strong enough as is before I prove the
(not really) stronger version yet again.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-06-30 15:58:13 +10:00
Gerwin Klein 445a8e4f12
lib: cleanup in Corres_UL and around liftM in Monads
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-06-30 15:56:43 +10:00
Gerwin Klein 865df5554a
lib: add new corres method
The new corres method is similar to the corresK method and calculus,
but much less ambitious. Its main purpose is to automate boilerplate
proof steps in corres proofs and is specifically not trying to fully
automate corres proofs (although some few might be solved).

The idea is that the method will make some progress with obvious steps
and leave over a proof state the user can operate on further.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-06-30 15:56:42 +10:00
Gerwin Klein c1fe4ad10f
lib+refine: rename Corres_Method to CorresK_Method
This also renames most of the corres* methods to corresK* methods,
including corressimp -> corresKsimp.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-06-30 10:56:47 +10:00
Corey Lewis 1f06802350 crefine: update for new ccorres cong rules
Signed-off-by: Corey Lewis <corey.lewis@proofcraft.systems>
2023-06-30 10:14:57 +10:00
Corey Lewis 0edd68f80a lib: cong rules for ccorres_underlying
The default behaviour is now to not rewrite the return relations and
extraction functions.

Signed-off-by: Corey Lewis <corey.lewis@proofcraft.systems>
2023-06-30 10:14:57 +10:00
Corey Lewis 163b9fe58a crefine: remove some duplicated lemmas
Signed-off-by: Corey Lewis <corey.lewis@proofcraft.systems>
2023-06-30 10:14:57 +10:00
Gerwin Klein 59759edc42
arm refine: deploy corres_cases in some examples
Demonstrates use of corres_cases and corres_cases_both. Main intended
benefit is less thinking about safety of schematics, fewer mentions
of goal parameter names, and fewer manual guard instantiations.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-06-26 16:20:33 +10:00
Gerwin Klein 168d3aae3c
crefine: remove obsolete corres wpc setup
This setup didn't actually work. Replaced by corres_cases.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-06-26 16:20:33 +10:00
Gerwin Klein 5abb456a60
lib: add corres_cases method
Add safe datatype case distinction for corres -- wpc turns out to be
insufficient even after generalisation of the helper predicate.

- corres_cases_left: case distinction on abstract monad
- corres_cases_right: case distinction on concrete monad
- corres_cases: try first corres_cases_left, then corres_cases_right
- corres_cases_both: simultaneous (quadratic) case distinction on
  both sides, with safe elimination of trivially contradictory cases.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-06-26 16:20:33 +10:00
Gerwin Klein 722cd25c32 github: use correct secret
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-06-21 16:05:28 +10:00
Gerwin Klein dc093cab26 github: use explicit token to enable push triggers
The implicit GITHUB_TOKEN does not trigger further push actions in
the same repo, but in this case we do want the push action to happen
on the `-rebased` branches, so we use an explicit auth token instead.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-06-21 11:47:19 +10:00
Gerwin Klein 460d99b2e0 haskell: upgrade to lts-20.25 and ghc 9.2.8
GHC 9.2.8 has better support for Linux/aarch64/v8 for use in Docker.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-06-19 10:00:45 +10:00
Rafal Kolanski 18cbdaeb7e infoflow: update for monadic rewrite changes
The `tcb` that previously became an `x` now remains a `tcb`.

Signed-off-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
2023-06-16 13:51:36 +10:00
Rafal Kolanski ec907bf017 lib: add test for monadic rewrite
This demonstrates some sanity checking, a standard iterate-rewrite-refl
deployment, and the three symbolic execution methods, with a lot of
commentary.

Signed-off-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
2023-06-16 13:51:36 +10:00
Rafal Kolanski f72702f2f3 lib: monadic rewrite: improve bound name retention
While in many cases using an eta form with a bind (`f >>= (λrv. g rv)`)
does manage to preserve names, this was not true in general when working
with monadic_rewrite. An obvious case of this was when performing a
rewrite in the middle of a function, all bound variables on the way to
that point would get renamed to `x`.

In order to iterate over a chain of bind/bindE with a
monadic_rewrite_bind_tail-style rule such that bound names are
preserved, the rule's `f >>= (λrv. g rv)` must match up with the
relevant bound term `do x <- f'; g' x; ...` on the RHS/LHS and only on
that side:
* if the rule has an eta term on both sides and the goal a schematic on
  any side, the schematic will match trivially producing the correct
  name in the first subgoal only
* if the goal is not schematic and a tail rule applies, we need to
  choose a side to get the name from (usually the left)
This means if the goal is schematic on the RHS, we need a tail rule with
an eta term on its LHS, and vice-versa.

Since a generic form of this is not possible, this commit introduces
transformation lemmas and updates the tactics to use them for stepping
on the left/right.

For stopping the iteration by applying a rule to the head of a bind, the
situation is reversed: to preserve the name of the bind in the tail, the
head rule must not have any eta terms. The bind[E]_head rules have been
updated to reflect this.

Signed-off-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
2023-06-16 13:51:36 +10:00
Gerwin Klein db44def660
arm-hyp crefine: use monadic_rewrite_pre
Replace wp_pre with monadic_rewrite_pre in one manual proof instance.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-06-15 16:00:28 +10:00
Gerwin Klein f75a3481ae
lib+refine+crefine: disambiguate corres_pre
- rename corres_pre set in CRefine to ccorres_pre
- rename internal corres_pre method in Corres_Method to corres_pre'
- use corres_pre instead of old wp_pre in refine

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-06-15 10:46:39 +10:00
Gerwin Klein 29873da877
lib: split out WP_Pre.pre_tac for wp_pre
Factor out pre_tac such that we can have separate theorem sets and
methods for wp_pre, monadic_rewrite_pre, corres_pre, and potentially
others in the future.

Leave everything in wp_pre that we expect to use wp or wpsimp on, in
particular no_fail.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-06-15 10:46:39 +10:00
Gerwin Klein 0e3016251f
lib+proof: proof updates for wpc change
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-06-15 09:52:15 +10:00
Gerwin Klein ea62a6cf27
lib: docs + 2nd predicate-type guard for wpc
- document the wpc_helper predicate and setup for wpc
  (but not the proof method internals at this point)

- add facilities for a second guard of predicate type

The current setup works well for judgements with one guard of type
predicate or set (valid, validE, etc), or with two guards where one is
a predicate and the other is a set (ccorres), but not for judgements
that have two predicate guards, i.e. plain corres. This commit adds a
second such guard, which can be ignored for the judgements that don't
need it in the same way that valid/validE currently ignore the set-type
guard.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-06-15 09:52:12 +10:00
Gerwin Klein 6f2ea86752 github: push to -rebased branch first
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-06-07 15:58:57 +10:00
Gerwin Klein 9fe16760b7 github: auto-rebase platform branches
The action will abort when no clean rebase is possible, and force-push
the rebased branch when the rebase over origin/master was clean.

The push will trigger proof runs on the rebased branches.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-06-07 15:58:57 +10:00
Gerwin Klein 443706fae8 github: distinguish proof PR checks from deployment run
Currently both workflows have the name "Proofs" which is confusing
in the GitHub UI.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-06-07 15:58:57 +10:00
Gerwin Klein 9752444a81 run_tests: REFINE_QUICK_AND_DIRTY already set in Makefile
REFINE_QUICK_AND_DIRTY is already set correctly in proofs/Makefile,
so doesn't need to be set here.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-06-06 15:37:01 +10:00
Gerwin Klein 290b7c73cc run_tests: update outdated comment
The Orphanage session is no longer conditional on L4V_ARCH_IS_ARM
(instead it is empty for those architectures that don't support it).

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-06-06 15:37:01 +10:00
Gerwin Klein 6da2d97c69 run_tests: echo L4V_FEATURES and L4V_PLAT
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-06-06 15:37:01 +10:00
Michael McInerney fc44f65175 aspec+haskell: add accessor names for scheduler_action datatype
This adds sch_act_target/schActTarget accessor names for the
switch_thread/SwitchToThread constructor of the scheduler_action
datatype at the aspec and Haskell level, respectively

Signed-off-by: Michael McInerney <michael.mcinerney@proofcraft.systems>
2023-06-05 17:52:06 +10:00
Matthew Brecknell c4d673b96d cspec: Use L4V_PLAT in build export script
CI is introducing an `L4V_PLAT` variable to support proof runs across
more platform configurations. This commit incorporates `L4V_PLAT` into
the paths generated by `export-kernel-builds.py`, to ensure that
exported builds can be disambiguated.

Signed-off-by: Matthew Brecknell <matt@kry10.com>
2023-06-05 13:34:14 +10:00
Gerwin Klein 7c422d7839 cspec: introduce L4V_PLAT
L4V_PLAT selects a platform variation within a L4V_ARCH. This mostly
affects which seL4 cmake config file is loaded when building config
data and the kernel C code. This in turn affects (and will rebuild)
ASpec, ExecSpec, and CSpec.

Examples:

    L4V_ARCH=ARM L4V_FEATURES="" L4V_PLAT=""

will load `ARM_verified.cmake`

    L4V_ARCH=ARM L4V_FEATURES="" L4V_PLAT=imx8mm

will load `ARM_imx8mm_verified.cmake`, and

    L4V_ARCH=ARM L4V_FEATURES=MCS L4V_PLAT=imx8mm

will load `ARM_MCS_imx8mm_verified.cmake`

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-06-05 12:04:29 +10:00
Gerwin Klein 971be5fe2d haskell: constrain run_tests to current L4V_ARCH
Provide L4V_ARCH targets in the Haskell Makefile and constrain
run_tests to use only the current L4V_ARCH, to avoid building all
architectures in all tests.

A manual invocation of just `make` will still build all architectures
for easier checking.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-05-31 14:46:35 +10:00
Rafal Kolanski 1e619439d2
proof/ROOT: RefineOrphanage: add quick and dirty option
Piggybacking off of REFINE_QUICK_AND_DIRTY as they are usually linked.

Signed-off-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
2023-05-26 18:04:49 +10:00
Rafal Kolanski 381ad05df9
run_tests: enable RefineOrphanage for AARCH64
Signed-off-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
2023-05-26 18:04:49 +10:00
Rafal Kolanski 7cdd203136
aarch64 refine: first run through Orphanage
Signed-off-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
2023-05-26 18:04:49 +10:00
Rafal Kolanski 496f70f7a6
run_tests: fix QUICK_AND_DIRTY handling
os.environ expects a string, not an integer

Signed-off-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
2023-05-26 18:04:49 +10:00
Rafal Kolanski 7b73a18757
run_tests: enable Refine (quick_and_dirty) for AARCH64
Signed-off-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
2023-05-26 18:04:49 +10:00
Rafal Kolanski 2f3e333500
aarch64 refine: first pass through EmptyFail_H (sorry-free)
Signed-off-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
2023-05-26 18:04:48 +10:00
Rafal Kolanski 81d382ec71
aarch64 refine: first pass through Refine (sorry-free)
Signed-off-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
2023-05-26 18:04:48 +10:00