Skip to content
Open
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
8fff536
start work on this
jcp19 Jan 20, 2026
3f67c3b
continue working on a model
jcp19 Jan 20, 2026
05f9026
change todos
jcp19 Jan 20, 2026
76b439c
resalgebraNoAxioms
jcp19 Jan 20, 2026
4e44225
add assumption to make verification pass
jcp19 Jan 20, 2026
9a5598a
backup
jcp19 Jan 20, 2026
bdb8b65
fix typo
jcp19 Jan 20, 2026
fe28b82
Merge branch 'main' into resalgebra2
jcp19 Jan 20, 2026
e898264
Merge branch 'main' into resalgebra2
jcp19 Jan 20, 2026
68dc6af
backup
jcp19 Jan 20, 2026
db29a30
clean-up
jcp19 Jan 20, 2026
46da2e4
backup
jcp19 Jan 20, 2026
37734ff
add init code
jcp19 Jan 20, 2026
0647c03
progress with proof
jcp19 Jan 20, 2026
a41cb20
drop duplicated code
jcp19 Jan 20, 2026
2a7ff7f
drop assumptions
jcp19 Jan 20, 2026
c9472c8
clean-up, verify some assumptions
jcp19 Jan 21, 2026
a9b0dc2
Merge branch 'main' into resalgebra2
jcp19 Jan 21, 2026
3ad5e99
another assumption proven
jcp19 Jan 21, 2026
545d582
anoda one
jcp19 Jan 21, 2026
35a7232
prove another assumption
jcp19 Jan 21, 2026
71a44b3
prove another assumption
jcp19 Jan 21, 2026
aa13f67
prove two more assumptions
jcp19 Jan 21, 2026
4709ed0
prove one more assumption
jcp19 Jan 21, 2026
0eb6783
simplify proof obligation
jcp19 Jan 21, 2026
7015069
cleanup
jcp19 Jan 21, 2026
142427d
made RA lemmas pure to make them easier to work with
jcp19 Jan 21, 2026
ed9e7c1
One more assumption proved
jcp19 Jan 21, 2026
a6cf4f1
last assumption
jcp19 Jan 21, 2026
1047c69
add explanation on missing invariant
jcp19 Jan 21, 2026
fd169f4
add body to all functions that depend on the invariant
jcp19 Jan 25, 2026
d0a119a
Merge branch 'main' into resalgebra2-invs
jcp19 Feb 22, 2026
13b1a90
Merge branch 'main' into resalgebra2-invs
jcp19 Apr 27, 2026
f876321
Merge branch 'main' into resalgebra2-invs
jcp19 Apr 27, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 45 additions & 15 deletions resalgebraNoAxioms/loc.gobra
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@

// +gobra

// todo: replace this by a dup invariant that GlobalMem() is an invariant
pkgInvariant GlobalMem()
dup pkgInvariant Invariant(GlobalMem!<!>)
package resalgebraNoAxioms

// At the moment, all of these definitions are trusted, and this,
Expand Down Expand Up @@ -241,7 +240,8 @@ ghost var inUseIdx@ dict[LocName](seq[idx])
ghost var inUseVal@ dict[LocName](seq[Elem])

func init() {
fold GlobalMem()
fold GlobalMem!<!>()
EstablishInvariant(GlobalMem!<!>)
}

/***** Model *****/
Expand Down Expand Up @@ -665,48 +665,57 @@ func GhostValidW(l LocName, ra RA, e Elem, w Witness) {
/***** Model: wrappers that acquire the global invariant; these functions may not be called from critical regions *****/

ghost
// opensInvariants
opensInvariants
requires ra != nil
requires ra.IsElem(e) && ra.IsValid(e)
ensures l != nil
ensures GhostLocationW(l, ra, e, w)
decreases
func AllocW(ra RA, e Elem) (l LocName, w Witness) {
inhale GlobalMem() // acquire dup pkg invariant && open invariant
openDupPkgInv
critical GlobalMem!<!> (
changeView1()
l, w = AllocWI(ra, e)
exhale GlobalMem() // close invariant
changeView2()
)
}

ghost
// opensInvariants
opensInvariants
requires ra != nil
requires ra.IsElem(e1)
requires ra.IsElem(e2)
requires GhostLocationW(l, ra, ra.Compose(e1, e2), w)
ensures GhostLocationW(l, ra, e1, w1) && GhostLocationW(l, ra, e2, w2)
decreases
func GhostOp1W(l LocName, ra RA, e1 Elem, e2 Elem, w Witness) (w1 Witness, w2 Witness) {
inhale GlobalMem() // acquire dup pkg invariant && open invariant
openDupPkgInv
critical GlobalMem!<!> (
changeView1()
w1, w2 = GhostOp1WI(l, ra, e1, e2, w)
exhale GlobalMem() // close invariant
changeView2()
)
}

ghost
// opensInvariants
opensInvariants
requires ra != nil
requires ra.IsElem(e1)
requires ra.IsElem(e2)
requires GhostLocationW(l, ra, e1, w1) && GhostLocationW(l, ra, e2, w2)
ensures GhostLocationW(l, ra, ra.Compose(e1, e2), w1)
decreases
func GhostOp2W(l LocName, ra RA, e1 Elem, e2 Elem, w1 Witness, w2 Witness) {
inhale GlobalMem() // acquire dup pkg invariant && open invariant
openDupPkgInv
critical GlobalMem!<!> (
changeView1()
GhostOp2WI(l, ra, e1, e2, w1, w2)
exhale GlobalMem() // close invariant
changeView2()
)
}

ghost
// opensInvariants
opensInvariants
requires ra != nil
requires ra.IsElem(e1)
requires ra.IsElem(e2)
Expand All @@ -715,7 +724,28 @@ requires IsFramePreservingUpdate(ra, e1, e2)
ensures GhostLocationW(l, ra, e2, w)
decreases
func GhostUpdateW(l LocName, ra RA, e1 Elem, e2 Elem, w Witness) {
inhale GlobalMem() // acquire dup pkg invariant && open invariant
openDupPkgInv
critical GlobalMem!<!> (
changeView1()
GhostUpdateWI(l, ra, e1, e2, w)
exhale GlobalMem() // close invariant
changeView2()
)
}

ghost
requires GlobalMem!<!>()
ensures GlobalMem()
decreases
func changeView1() {
unfold GlobalMem!<!>()
fold GlobalMem()
}

ghost
requires GlobalMem()
ensures GlobalMem!<!>()
decreases
func changeView2() {
unfold GlobalMem()
fold GlobalMem!<!>()
}
Loading