Commit Graph

5299 Commits

Author SHA1 Message Date
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
Corey Lewis 6dbcf40d38 lib/monads: split content out into Trace_RG and Trace_No_Trace
Signed-off-by: Corey Lewis <corey.lewis@proofcraft.systems>
2023-08-23 11:53:22 +10:00
Corey Lewis 380520c768 lib/monads: refactor trace monad theories
This splits material out of Trace_Monad and Trace_VCG and into more
specific theories, following the same approach and structure as the
nondet theories. This commit is mainly focused on definitions and lemmas
that also appear in the nondet monad; trace monad concepts are left
where they are for now.

Signed-off-by: Corey Lewis <corey.lewis@proofcraft.systems>
2023-08-23 11:53:22 +10:00
Corey Lewis 477e8d2200 lib/monads: restyle Trace_Monad.thy
This should now be in sync with Nondet_Monad.thy wherever the two files
have similar content.

Signed-off-by: Corey Lewis <corey.lewis@proofcraft.systems>
2023-08-23 11:53:22 +10:00
Corey Lewis a084de4993 refine: update for changes to nondet monad
Signed-off-by: Corey Lewis <corey.lewis@proofcraft.systems>
2023-08-23 11:48:13 +10:00
Corey Lewis fde22d7092 lib/monads: minor cleanup and restyle in nondet monad
Signed-off-by: Corey Lewis <corey.lewis@proofcraft.systems>
2023-08-23 11:48:13 +10:00
Corey Lewis 631bc301d4 lib/monads: move lifting/splitting section earlier in Nondet_VCG
Signed-off-by: Corey Lewis <corey.lewis@proofcraft.systems>
2023-08-23 11:48:13 +10:00
Gerwin Klein 4d97b26dbf arm-hyp crefine: proof update for object_type enum reorder
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-08-14 15:51:34 +02:00
Gerwin Klein 540bb64383 arm-hyp abstract+design: object_type enum reorder
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-08-14 15:51:34 +02:00
Gerwin Klein 71dc79a879 arm crefine: proof updates for object_type enum reorder
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-08-14 15:51:34 +02:00
Gerwin Klein f7c3ee5760 drefine: adjust for object_type enum reorder
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-08-14 15:51:34 +02:00
Gerwin Klein f6eaad52f3 arm abstract+design: reorder object_type enum
AArch64 C code changes now designate PageDirectoryObj as the VSpace
object type, which comes first in the enum.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-08-14 15:51:34 +02:00
Corey Lewis 02116815be proof+autocorres: update for select_wp and alternative_wp
Signed-off-by: Corey Lewis <corey.lewis@proofcraft.systems>
2023-08-09 16:42:01 +10:00
Corey Lewis 0e0e0cafa4 lib/monads: add select_wp and alternative_wp to wp set for Nondet monad
Signed-off-by: Corey Lewis <corey.lewis@proofcraft.systems>
2023-08-09 16:42:01 +10:00
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