Built with doc-gen4, running Lean4. Bubbles () indicate interactive fragments: hover for details, tap to reveal contents. Use Ctrl+โ†‘Ctrl+โ†“to navigate, Ctrl+๐Ÿ–ฑ๏ธto focus. On Mac, use Cmdinstead of Ctrl.
import Mt.Reservation
import Mt.Task.Basic

namespace Mt.TaskM

variable {
spec: Spec
spec
:
Spec: Type 1
Spec
} local
instance: {spec : Spec} โ†’ IsReservation spec.Reservation
instance
:
IsReservation: Type โ†’ Type
IsReservation
spec: Spec
spec
.
Reservation: Spec โ†’ Type
Reservation
:=
spec: Spec
spec
.
is_reservation: (self : Spec) โ†’ IsReservation self.Reservation
is_reservation
/-- Validation primitive for reasoning for composable tasks. Validation may assume `assuming` and must ensure the following: * The task has to behave conform to the specification at all times * The task never panics * Finally, `motive` holds after the task completes ### Proving `valid` The definition is rather cumbersome to work with. You should use helper theorems like `valid_pure`, `valid_bind`, `valid_rmr`, ... They are designed to be used with the `apply` tactic. ### Blocking predicate: `assuming` When validating our task, we can assume `assuming state = true`. However, in most cases we have `assuming = ฮป _ => true`, i.e. our hypothesis does not provide anything useful. There is one important exception: Blocking threads. If a thread waits for a certain condition before it continues its task, we can safely assume that this condition holds when the task is excuting. ### Final goal: `motive` A valid thread must drop its reservations in the end. Therefore, the final goal on those tasks is `ฮป _ r => r = IsReservation.empty`. However, intermediate tasks (i.e. single operations) do not need to share this goal. In fact, they usally do not. If one operation prepares the next operation, it usually creates some reservation to ensure that no other thread undos this preparation. In this example, the motive should encode that the preparation has been made. `motive` is the only way to pass facts from one iteration to the next. See `valid_bind` for more information. -/ def
valid: {spec : Spec} โ†’ {T : Type} โ†’ (_ : TaskM spec T) ร—' (_ : spec.Reservation) ร—' (_ : spec.State โ†’ Bool) ร—' (T โ†’ spec.Reservation โ†’ Prop) โ†’ Prop
valid
{
T: Type
T
:
Type: Type 1
Type
} (
p: TaskM spec T
p
:
TaskM: Spec โ†’ Type โ†’ Type
TaskM
spec: Spec
spec
T: Type
T
) (
r: spec.Reservation
r
:
spec: Spec
spec
.
Reservation: Spec โ†’ Type
Reservation
) (
assuming: spec.State โ†’ Bool
assuming
:
spec: Spec
spec
.
State: Spec โ†’ Type
State
->
Bool: Type
Bool
) (
motive: T โ†’ spec.Reservation โ†’ Prop
motive
:
T: Type
T
->
spec: Spec
spec
.
Reservation: Spec โ†’ Type
Reservation
->
Prop: Type
Prop
) :
Prop: Type
Prop
:=โˆ€
env_r: ?m.51
env_r
s: ?m.54
s
,
assuming: spec.State โ†’ Bool
assuming
s: ?m.54
s
โ†’
spec: Spec
spec
.
validate: (self : Spec) โ†’ self.Reservation โ†’ self.State โ†’ Prop
validate
(
env_r: ?m.51
env_r
+
r: spec.Reservation
r
)
s: ?m.54
s
โ†’ โˆƒ
r': spec.Reservation
r'
:
spec: Spec
spec
.
Reservation: Spec โ†’ Type
Reservation
, match
h: iterate p s = IterationResult.Panic aโœยน aโœ
h
:
p: TaskM spec T
p
.
iterate: {spec : Spec} โ†’ {T : Type} โ†’ TaskM spec T โ†’ spec.State โ†’ IterationResult spec T
iterate
s: ?m.54
s
with |
IterationResult.Done: {spec : Spec} โ†’ {T : Type} โ†’ spec.State โ†’ T โ†’ IterationResult spec T
IterationResult.Done
s': spec.State
s'
t: T
t
=>
spec: Spec
spec
.
validate: (self : Spec) โ†’ self.Reservation โ†’ self.State โ†’ Prop
validate
(
env_r: ?m.51
env_r
+
r': spec.Reservation
r'
)
s': spec.State
s'
โˆง
motive: T โ†’ spec.Reservation โ†’ Prop
motive
t: T
t
r': spec.Reservation
r'
|
IterationResult.Panic: {spec : Spec} โ†’ {T : Type} โ†’ spec.State โ†’ String โ†’ IterationResult spec T
IterationResult.Panic
.. =>
False: Prop
False
|
IterationResult.Running: {spec : Spec} โ†’ {T : Type} โ†’ spec.State โ†’ (spec.State โ†’ Bool) โ†’ TaskM spec T โ†’ IterationResult spec T
IterationResult.Running
s': spec.State
s'
block_until: spec.State โ†’ Bool
block_until
cont: TaskM spec T
cont
=>
spec: Spec
spec
.
validate: (self : Spec) โ†’ self.Reservation โ†’ self.State โ†’ Prop
validate
(
env_r: ?m.51
env_r
+
r': spec.Reservation
r'
)
s': spec.State
s'
โˆง
cont: TaskM spec T
cont
.
valid: {T : Type} โ†’ TaskM spec T โ†’ spec.Reservation โ†’ (spec.State โ†’ Bool) โ†’ (T โ†’ spec.Reservation โ†’ Prop) โ†’ Prop
valid
r': spec.Reservation
r'
block_until: spec.State โ†’ Bool
block_until
motive: T โ†’ spec.Reservation โ†’ Prop
motive
termination_by valid =>
p: TaskM spec T
p
decreasing_by
spec: Spec

T: Type

p: TaskM spec T

r: spec.Reservation

assuming: spec.State โ†’ Bool

motive: T โ†’ spec.Reservation โ†’ Prop

env_r: spec.Reservation

s: spec.State

r': spec.Reservation

s': spec.State

block_until: spec.State โ†’ Bool

cont: TaskM spec T

h: iterate p s = IterationResult.Running s' block_until cont


spec: Spec

T: Type

p: TaskM spec T

r: spec.Reservation

assuming: spec.State โ†’ Bool

motive: T โ†’ spec.Reservation โ†’ Prop

env_r: spec.Reservation

s: spec.State

r': spec.Reservation

s': spec.State

block_until: spec.State โ†’ Bool

cont: TaskM spec T

h: iterate p s = IterationResult.Running s' block_until cont


(invImage (fun a => PSigma.casesOn a fun p snd => PSigma.casesOn snd fun r snd => PSigma.casesOn snd fun assuming snd => p) instWf).1 { fst := cont, snd := { fst := r', snd := { fst := block_until, snd := motive } } } { fst := p, snd := { fst := r, snd := { fst := assuming, snd := motive } } }
spec: Spec

T: Type

p: TaskM spec T

r: spec.Reservation

assuming: spec.State โ†’ Bool

motive: T โ†’ spec.Reservation โ†’ Prop

env_r: spec.Reservation

s: spec.State

r': spec.Reservation

s': spec.State

block_until: spec.State โ†’ Bool

cont: TaskM spec T

h: iterate p s = IterationResult.Running s' block_until cont


spec: Spec

T: Type

p: TaskM spec T

r: spec.Reservation

assuming: spec.State โ†’ Bool

motive: T โ†’ spec.Reservation โ†’ Prop

env_r: spec.Reservation

s: spec.State

r': spec.Reservation

s': spec.State

block_until: spec.State โ†’ Bool

cont: TaskM spec T

h: iterate p s = IterationResult.Running s' block_until cont


(invImage (fun a => PSigma.casesOn a fun p snd => PSigma.casesOn snd fun r snd => PSigma.casesOn snd fun assuming snd => p) instWf).1 { fst := cont, snd := { fst := r', snd := { fst := block_until, snd := motive } } } { fst := p, snd := { fst := r, snd := { fst := assuming, snd := motive } } }

Goals accomplished! ๐Ÿ™
/-- To prove that `pure t` is valid you need to prove that the `motive` holds -/ theorem
valid_pure: โˆ€ {T : Type} {t : T} {r : spec.Reservation} {assuming : spec.State โ†’ Bool} {motive : T โ†’ spec.Reservation โ†’ Prop}, motive t r โ†’ valid (pure t) r assuming motive
valid_pure
{
T: Type
T
:
Type: Type 1
Type
} {
t: T
t
:
T: Type
T
} {
r: ?m.1199
r
assuming: ?m.1202
assuming
motive: ?m.1205
motive
} (
is_valid: ?m.1208
is_valid
:
motive: ?m.1205
motive
t: T
t
r: ?m.1199
r
) :
valid: {spec : Spec} โ†’ {T : Type} โ†’ TaskM spec T โ†’ spec.Reservation โ†’ (spec.State โ†’ Bool) โ†’ (T โ†’ spec.Reservation โ†’ Prop) โ†’ Prop
valid
(spec :=
spec: Spec
spec
) (
pure: {f : Type ?u.1213 โ†’ Type ?u.1212} โ†’ [self : Pure f] โ†’ {ฮฑ : Type ?u.1213} โ†’ ฮฑ โ†’ f ฮฑ
pure
t: T
t
)
r: ?m.1199
r
assuming: ?m.1202
assuming
motive: ?m.1205
motive
:=
spec: Spec

T: Type

t: T

r: spec.Reservation

assuming: spec.State โ†’ Bool

motive: T โ†’ spec.Reservation โ†’ Prop

is_valid: motive t r


valid (pure t) r assuming motive
spec: Spec

T: Type

t: T

r: spec.Reservation

assuming: spec.State โ†’ Bool

motive: T โ†’ spec.Reservation โ†’ Prop

is_valid: motive t r


valid (pure t) r assuming motive
spec: Spec

T: Type

t: T

r: spec.Reservation

assuming: spec.State โ†’ Bool

motive: T โ†’ spec.Reservation โ†’ Prop

is_valid: motive t r


โˆ€ (env_r : spec.Reservation) (s : spec.State), assuming s = true โ†’ Spec.validate spec (env_r + r) s โ†’ โˆƒ r', match h : iterate (pure t) s with | IterationResult.Done s' t_1 => Spec.validate spec (env_r + r') s' โˆง motive t_1 r' | IterationResult.Panic a a_1 => False | IterationResult.Running s' block_until cont => Spec.validate spec (env_r + r') s' โˆง valid cont r' block_until motive
spec: Spec

T: Type

t: T

r: spec.Reservation

assuming: spec.State โ†’ Bool

motive: T โ†’ spec.Reservation โ†’ Prop

is_valid: motive t r


โˆ€ (env_r : spec.Reservation) (s : spec.State), assuming s = true โ†’ Spec.validate spec (env_r + r) s โ†’ โˆƒ r', match h : iterate (pure t) s with | IterationResult.Done s' t_1 => Spec.validate spec (env_r + r') s' โˆง motive t_1 r' | IterationResult.Panic a a_1 => False | IterationResult.Running s' block_until cont => Spec.validate spec (env_r + r') s' โˆง valid cont r' block_until motive
spec: Spec

T: Type

t: T

r: spec.Reservation

assuming: spec.State โ†’ Bool

motive: T โ†’ spec.Reservation โ†’ Prop

is_valid: motive t r


valid (pure t) r assuming motive
spec: Spec

T: Type

t: T

r: spec.Reservation

assuming: spec.State โ†’ Bool

motive: T โ†’ spec.Reservation โ†’ Prop

is_valid: motive t r

env_r: spec.Reservation

s: spec.State

initial_valid: Spec.validate spec (env_r + r) s


โˆƒ r', match h : iterate (pure t) s with | IterationResult.Done s' t_1 => Spec.validate spec (env_r + r') s' โˆง motive t_1 r' | IterationResult.Panic a a_1 => False | IterationResult.Running s' block_until cont => Spec.validate spec (env_r + r') s' โˆง valid cont r' block_until motive
spec: Spec

T: Type

t: T

r: spec.Reservation

assuming: spec.State โ†’ Bool

motive: T โ†’ spec.Reservation โ†’ Prop

is_valid: motive t r


valid (pure t) r assuming motive

Goals accomplished! ๐Ÿ™
/-- To prove that `a >>= f` is valid you need to prove that both `a` and `f u` for all results `u` are valid. In many cases, `a` does something to prepare `f u`. Since only `f u` needs to fulfil the final motive, we can choose an arbitrary motive to validate `a` as "intermediate goal". To validate `f u` with the original `motive`, we can use the fact that the intermediate goal `motive_u` has been ensured by `a`. Motives use only results and reservations, which cannot be changed by other threads. Therefore, they stay valid even if other threads become active between `a` and `f u`. -/ theorem
valid_bind: โˆ€ {spec : Spec} {U V : Type} (_x : (mu : TaskM spec U) ร—' (f : U โ†’ TaskM spec V) ร—' (r : spec.Reservation) ร—' (assuming : spec.State โ†’ Bool) ร—' (motive : V โ†’ spec.Reservation โ†’ Prop) ร—' (motive_u : U โ†’ spec.Reservation โ†’ Prop) ร—' (_ : valid mu r assuming motive_u) ร—' โˆ€ (r' : spec.Reservation) (u : U), motive_u u r' โ†’ valid (f u) r' (fun x => true) motive), valid (_x.1 >>= _x.2.1) _x.2.2.1 _x.2.2.2.1 _x.2.2.2.2.1
valid_bind
{
U: Type
U
V: Type
V
:
Type: Type 1
Type
} {
mu: TaskM spec U
mu
:
TaskM: Spec โ†’ Type โ†’ Type
TaskM
spec: Spec
spec
U: Type
U
} {
f: U โ†’ TaskM spec V
f
:
U: Type
U
->
TaskM: Spec โ†’ Type โ†’ Type
TaskM
spec: Spec
spec
V: Type
V
} {
r: spec.Reservation
r
assuming: ?m.1562
assuming
motive: V โ†’ spec.Reservation โ†’ Prop
motive
} (
motive_u: U โ†’ spec.Reservation โ†’ Prop
motive_u
:
U: Type
U
->
spec: Spec
spec
.
Reservation: Spec โ†’ Type
Reservation
->
Prop: Type
Prop
) (
mu_valid: valid mu r assuming motive_u
mu_valid
:
mu: TaskM spec U
mu
.
valid: {spec : Spec} โ†’ {T : Type} โ†’ TaskM spec T โ†’ spec.Reservation โ†’ (spec.State โ†’ Bool) โ†’ (T โ†’ spec.Reservation โ†’ Prop) โ†’ Prop
valid
r: ?m.1559
r
assuming: ?m.1562
assuming
motive_u: U โ†’ spec.Reservation โ†’ Prop
motive_u
) (
f_valid: โˆ€ (r' : spec.Reservation) (u : U), motive_u u r' โ†’ valid (f u) r' (fun x => true) motive
f_valid
: โˆ€
r': ?m.1595
r'
u: ?m.1598
u
,
motive_u: U โ†’ spec.Reservation โ†’ Prop
motive_u
u: ?m.1598
u
r': ?m.1595
r'
โ†’ (
f: U โ†’ TaskM spec V
f
u: ?m.1598
u
).
valid: {spec : Spec} โ†’ {T : Type} โ†’ TaskM spec T โ†’ spec.Reservation โ†’ (spec.State โ†’ Bool) โ†’ (T โ†’ spec.Reservation โ†’ Prop) โ†’ Prop
valid
r': ?m.1595
r'
(ฮป
_: ?m.1613
_
=>
true: Bool
true
)
motive: ?m.1565
motive
) :
valid: {spec : Spec} โ†’ {T : Type} โ†’ TaskM spec T โ†’ spec.Reservation โ†’ (spec.State โ†’ Bool) โ†’ (T โ†’ spec.Reservation โ†’ Prop) โ†’ Prop
valid
(
mu: TaskM spec U
mu
>>=
f: U โ†’ TaskM spec V
f
)
r: ?m.1559
r
assuming: ?m.1562
assuming
motive: ?m.1565
motive
:=
spec: Spec

U, V: Type

mu: TaskM spec U

f: U โ†’ TaskM spec V

r: spec.Reservation

assuming: spec.State โ†’ Bool

motive: V โ†’ spec.Reservation โ†’ Prop

motive_u: U โ†’ spec.Reservation โ†’ Prop

mu_valid: valid mu r assuming motive_u

f_valid: โˆ€ (r' : spec.Reservation) (u : U), motive_u u r' โ†’ valid (f u) r' (fun x => true) motive


valid (mu >>= f) r assuming motive
spec: Spec

U, V: Type

mu: TaskM spec U

f: U โ†’ TaskM spec V

r: spec.Reservation

assuming: spec.State โ†’ Bool

motive: V โ†’ spec.Reservation โ†’ Prop

motive_u: U โ†’ spec.Reservation โ†’ Prop

mu_valid: valid mu r assuming motive_u

f_valid: โˆ€ (r' : spec.Reservation) (u : U), motive_u u r' โ†’ valid (f u) r' (fun x => true) motive


valid (mu >>= f) r assuming motive
spec: Spec

U, V: Type

mu: TaskM spec U

f: U โ†’ TaskM spec V

r: spec.Reservation

assuming: spec.State โ†’ Bool

motive: V โ†’ spec.Reservation โ†’ Prop

motive_u: U โ†’ spec.Reservation โ†’ Prop

mu_valid: valid mu r assuming motive_u

f_valid: โˆ€ (r' : spec.Reservation) (u : U), motive_u u r' โ†’ valid (f u) r' (fun x => true) motive


โˆ€ (env_r : spec.Reservation) (s : spec.State), assuming s = true โ†’ Spec.validate spec (env_r + r) s โ†’ โˆƒ r', match h : iterate (mu >>= f) s with | IterationResult.Done s' t => Spec.validate spec (env_r + r') s' โˆง motive t r' | IterationResult.Panic a a_1 => False | IterationResult.Running s' block_until cont => Spec.validate spec (env_r + r') s' โˆง valid cont r' block_until motive
spec: Spec

U, V: Type

mu: TaskM spec U

f: U โ†’ TaskM spec V

r: spec.Reservation

assuming: spec.State โ†’ Bool

motive: V โ†’ spec.Reservation โ†’ Prop

motive_u: U โ†’ spec.Reservation โ†’ Prop

mu_valid: valid mu r assuming motive_u

f_valid: โˆ€ (r' : spec.Reservation) (u : U), motive_u u r' โ†’ valid (f u) r' (fun x => true) motive


โˆ€ (env_r : spec.Reservation) (s : spec.State), assuming s = true โ†’ Spec.validate spec (env_r + r) s โ†’ โˆƒ r', match h : iterate (mu >>= f) s with | IterationResult.Done s' t => Spec.validate spec (env_r + r') s' โˆง motive t r' | IterationResult.Panic a a_1 => False | IterationResult.Running s' block_until cont => Spec.validate spec (env_r + r') s' โˆง valid cont r' block_until motive
spec: Spec

U, V: Type

mu: TaskM spec U

f: U โ†’ TaskM spec V

r: spec.Reservation

assuming: spec.State โ†’ Bool

motive: V โ†’ spec.Reservation โ†’ Prop

motive_u: U โ†’ spec.Reservation โ†’ Prop

mu_valid: valid mu r assuming motive_u

f_valid: โˆ€ (r' : spec.Reservation) (u : U), motive_u u r' โ†’ valid (f u) r' (fun x => true) motive


valid (mu >>= f) r assuming motive
spec: Spec

U, V: Type

mu: TaskM spec U

f: U โ†’ TaskM spec V

r: spec.Reservation

assuming: spec.State โ†’ Bool

motive: V โ†’ spec.Reservation โ†’ Prop

motive_u: U โ†’ spec.Reservation โ†’ Prop

mu_valid: valid mu r assuming motive_u

f_valid: โˆ€ (r' : spec.Reservation) (u : U), motive_u u r' โ†’ valid (f u) r' (fun x => true) motive

env_r: spec.Reservation

s: spec.State

assuming_true: assuming s = true

initial_valid: Spec.validate spec (env_r + r) s


โˆƒ r', match h : iterate (mu >>= f) s with | IterationResult.Done s' t => Spec.validate spec (env_r + r') s' โˆง motive t r' | IterationResult.Panic a a_1 => False | IterationResult.Running s' block_until cont => Spec.validate spec (env_r + r') s' โˆง valid cont r' block_until motive
spec: Spec

U, V: Type

mu: TaskM spec U

f: U โ†’ TaskM spec V

r: spec.Reservation

assuming: spec.State โ†’ Bool

motive: V โ†’ spec.Reservation โ†’ Prop

motive_u: U โ†’ spec.Reservation โ†’ Prop

mu_valid: valid mu r assuming motive_u

f_valid: โˆ€ (r' : spec.Reservation) (u : U), motive_u u r' โ†’ valid (f u) r' (fun x => true) motive


valid (mu >>= f) r assuming motive
spec: Spec

U, V: Type

mu: TaskM spec U

f: U โ†’ TaskM spec V

r: spec.Reservation

assuming: spec.State โ†’ Bool

motive: V โ†’ spec.Reservation โ†’ Prop

motive_u: U โ†’ spec.Reservation โ†’ Prop

mu_valid: valid mu r assuming motive_u

f_valid: โˆ€ (r' : spec.Reservation) (u : U), motive_u u r' โ†’ valid (f u) r' (fun x => true) motive

env_r: spec.Reservation

s: spec.State

assuming_true: assuming s = true

initial_valid: Spec.validate spec (env_r + r) s


โˆƒ r', match h : iterate (mu >>= f) s with | IterationResult.Done s' t => Spec.validate spec (env_r + r') s' โˆง motive t r' | IterationResult.Panic a a_1 => False | IterationResult.Running s' block_until cont => Spec.validate spec (env_r + r') s' โˆง valid cont r' block_until motive
spec: Spec

U, V: Type

mu: TaskM spec U

f: U โ†’ TaskM spec V

r: spec.Reservation

assuming: spec.State โ†’ Bool

motive: V โ†’ spec.Reservation โ†’ Prop

motive_u: U โ†’ spec.Reservation โ†’ Prop

mu_valid: valid mu r assuming motive_u

f_valid: โˆ€ (r' : spec.Reservation) (u : U), motive_u u r' โ†’ valid (f u) r' (fun x => true) motive

env_r: spec.Reservation

s: spec.State

assuming_true: assuming s = true

initial_valid: Spec.validate spec (env_r + r) s


โˆƒ r', match h : let _discr := iterate mu s; match iterate mu s with | IterationResult.Done s' u => IterationResult.Running s' (fun x => true) (f u) | IterationResult.Panic s' msg => IterationResult.Panic s' msg | IterationResult.Running s' block_until cont => IterationResult.Running s' block_until (cont >>= f) with | IterationResult.Done s' t => Spec.validate spec (env_r + r') s' โˆง motive t r' | IterationResult.Panic a a_1 => False | IterationResult.Running s' block_until cont => Spec.validate spec (env_r + r') s' โˆง valid cont r' block_until motive
spec: Spec

U, V: Type

mu: TaskM spec U

f: U โ†’ TaskM spec V

r: spec.Reservation

assuming: spec.State โ†’ Bool

motive: V โ†’ spec.Reservation โ†’ Prop

motive_u: U โ†’ spec.Reservation โ†’ Prop

mu_valid: valid mu r assuming motive_u

f_valid: โˆ€ (r' : spec.Reservation) (u : U), motive_u u r' โ†’ valid (f u) r' (fun x => true) motive

env_r: spec.Reservation

s: spec.State

assuming_true: assuming s = true

initial_valid: Spec.validate spec (env_r + r) s


โˆƒ r', match h : let _discr := iterate mu s; match iterate mu s with | IterationResult.Done s' u => IterationResult.Running s' (fun x => true) (f u) | IterationResult.Panic s' msg => IterationResult.Panic s' msg | IterationResult.Running s' block_until cont => IterationResult.Running s' block_until (cont >>= f) with | IterationResult.Done s' t => Spec.validate spec (env_r + r') s' โˆง motive t r' | IterationResult.Panic a a_1 => False | IterationResult.Running s' block_until cont => Spec.validate spec (env_r + r') s' โˆง valid cont r' block_until motive
spec: Spec

U, V: Type

mu: TaskM spec U

f: U โ†’ TaskM spec V

r: spec.Reservation

assuming: spec.State โ†’ Bool

motive: V โ†’ spec.Reservation โ†’ Prop

motive_u: U โ†’ spec.Reservation โ†’ Prop

mu_valid: valid mu r assuming motive_u

f_valid: โˆ€ (r' : spec.Reservation) (u : U), motive_u u r' โ†’ valid (f u) r' (fun x => true) motive


valid (mu >>= f) r assuming motive
spec: Spec

U, V: Type

mu: TaskM spec U

f: U โ†’ TaskM spec V

r: spec.Reservation

assuming: spec.State โ†’ Bool

motive: V โ†’ spec.Reservation โ†’ Prop

motive_u: U โ†’ spec.Reservation โ†’ Prop

mu_valid: valid mu r assuming motive_u

f_valid: โˆ€ (r' : spec.Reservation) (u : U), motive_u u r' โ†’ valid (f u) r' (fun x => true) motive

env_r: spec.Reservation

s: spec.State

assuming_true: assuming s = true

initial_valid: Spec.validate spec (env_r + r) s


โˆƒ r', match h : let _discr := iterate mu s; match iterate mu s with | IterationResult.Done s' u => IterationResult.Running s' (fun x => true) (f u) | IterationResult.Panic s' msg => IterationResult.Panic s' msg | IterationResult.Running s' block_until cont => IterationResult.Running s' block_until (cont >>= f) with | IterationResult.Done s' t => Spec.validate spec (env_r + r') s' โˆง motive t r' | IterationResult.Panic a a_1 => False | IterationResult.Running s' block_until cont => Spec.validate spec (env_r + r') s' โˆง valid cont r' block_until motive
spec: Spec

U, V: Type

mu: TaskM spec U

f: U โ†’ TaskM spec V

r: spec.Reservation

assuming: spec.State โ†’ Bool

motive: V โ†’ spec.Reservation โ†’ Prop

motive_u: U โ†’ spec.Reservation โ†’ Prop

mu_valid: โˆ€ (env_r : spec.Reservation) (s : spec.State), assuming s = true โ†’ Spec.validate spec (env_r + r) s โ†’ โˆƒ r', match h : iterate mu s with | IterationResult.Done s' t => Spec.validate spec (env_r + r') s' โˆง motive_u t r' | IterationResult.Panic a a_1 => False | IterationResult.Running s' block_until cont => Spec.validate spec (env_r + r') s' โˆง valid cont r' block_until motive_u

f_valid: โˆ€ (r' : spec.Reservation) (u : U), motive_u u r' โ†’ valid (f u) r' (fun x => true) motive

env_r: spec.Reservation

s: spec.State

assuming_true: assuming s = true

initial_valid: Spec.validate spec (env_r + r) s


โˆƒ r', match h : let _discr := iterate mu s; match iterate mu s with | IterationResult.Done s' u => IterationResult.Running s' (fun x => true) (f u) | IterationResult.Panic s' msg => IterationResult.Panic s' msg | IterationResult.Running s' block_until cont => IterationResult.Running s' block_until (cont >>= f) with | IterationResult.Done s' t => Spec.validate spec (env_r + r') s' โˆง motive t r' | IterationResult.Panic a a_1 => False | IterationResult.Running s' block_until cont => Spec.validate spec (env_r + r') s' โˆง valid cont r' block_until motive
spec: Spec

U, V: Type

mu: TaskM spec U

f: U โ†’ TaskM spec V

r: spec.Reservation

assuming: spec.State โ†’ Bool

motive: V โ†’ spec.Reservation โ†’ Prop

motive_u: U โ†’ spec.Reservation โ†’ Prop

mu_valid: โˆ€ (env_r : spec.Reservation) (s : spec.State), assuming s = true โ†’ Spec.validate spec (env_r + r) s โ†’ โˆƒ r', match h : iterate mu s with | IterationResult.Done s' t => Spec.validate spec (env_r + r') s' โˆง motive_u t r' | IterationResult.Panic a a_1 => False | IterationResult.Running s' block_until cont => Spec.validate spec (env_r + r') s' โˆง valid cont r' block_until motive_u

f_valid: โˆ€ (r' : spec.Reservation) (u : U), motive_u u r' โ†’ valid (f u) r' (fun x => true) motive

env_r: spec.Reservation

s: spec.State

assuming_true: assuming s = true

initial_valid: Spec.validate spec (env_r + r) s


โˆƒ r', match h : let _discr := iterate mu s; match iterate mu s with | IterationResult.Done s' u => IterationResult.Running s' (fun x => true) (f u) | IterationResult.Panic s' msg => IterationResult.Panic s' msg | IterationResult.Running s' block_until cont => IterationResult.Running s' block_until (cont >>= f) with | IterationResult.Done s' t => Spec.validate spec (env_r + r') s' โˆง motive t r' | IterationResult.Panic a a_1 => False | IterationResult.Running s' block_until cont => Spec.validate spec (env_r + r') s' โˆง valid cont r' block_until motive
spec: Spec

U, V: Type

mu: TaskM spec U

f: U โ†’ TaskM spec V

r: spec.Reservation

assuming: spec.State โ†’ Bool

motive: V โ†’ spec.Reservation โ†’ Prop

motive_u: U โ†’ spec.Reservation โ†’ Prop

mu_valid: โˆ€ (env_r : spec.Reservation) (s : spec.State), assuming s = true โ†’ Spec.validate spec (env_r + r) s โ†’ โˆƒ r', match h : iterate mu s with | IterationResult.Done s' t => Spec.validate spec (env_r + r') s' โˆง motive_u t r' | IterationResult.Panic a a_1 => False | IterationResult.Running s' block_until cont => Spec.validate spec (env_r + r') s' โˆง valid cont r' block_until motive_u

f_valid: โˆ€ (r' : spec.Reservation) (u : U), motive_u u r' โ†’ valid (f u) r' (fun x => true) motive

env_r: spec.Reservation

s: spec.State

assuming_true: assuming s = true

initial_valid: Spec.validate spec (env_r + r) s


โˆƒ r', match h : let _discr := iterate mu s; match iterate mu s with | IterationResult.Done s' u => IterationResult.Running s' (fun x => true) (f u) | IterationResult.Panic s' msg => IterationResult.Panic s' msg | IterationResult.Running s' block_until cont => IterationResult.Running s' block_until (cont >>= f) with | IterationResult.Done s' t => Spec.validate spec (env_r + r') s' โˆง motive t r' | IterationResult.Panic a a_1 => False | IterationResult.Running s' block_until cont => Spec.validate spec (env_r + r') s' โˆง valid cont r' block_until motive
spec: Spec

U, V: Type

mu: TaskM spec U

f: U โ†’ TaskM spec V

r: spec.Reservation

assuming: spec.State โ†’ Bool

motive: V โ†’ spec.Reservation โ†’ Prop

motive_u: U โ†’ spec.Reservation โ†’ Prop

mu_valid: valid mu r assuming motive_u

f_valid: โˆ€ (r' : spec.Reservation) (u : U), motive_u u r' โ†’ valid (f u) r' (fun x => true) motive


valid (mu >>= f) r assuming motive
spec: Spec

U, V: Type

mu: TaskM spec U

f: U โ†’ TaskM spec V

r: spec.Reservation

assuming: spec.State โ†’ Bool

motive: V โ†’ spec.Reservation โ†’ Prop

motive_u: U โ†’ spec.Reservation โ†’ Prop

mu_valid: โˆ€ (env_r : spec.Reservation) (s : spec.State), assuming s = true โ†’ Spec.validate spec (env_r + r) s โ†’ โˆƒ r', match h : iterate mu s with | IterationResult.Done s' t => Spec.validate spec (env_r + r') s' โˆง motive_u t r' | IterationResult.Panic a a_1 => False | IterationResult.Running s' block_until cont => Spec.validate spec (env_r + r') s' โˆง valid cont r' block_until motive_u

f_valid: โˆ€ (r' : spec.Reservation) (u : U), motive_u u r' โ†’ valid (f u) r' (fun x => true) motive

env_r: spec.Reservation

s: spec.State

assuming_true: assuming s = true

initial_valid: Spec.validate spec (env_r + r) s

aโœยน: spec.State

aโœ: U

iteration: iterate mu s = IterationResult.Done aโœยน aโœ


Done
โˆƒ r', match h : let _discr := IterationResult.Done aโœยน aโœ; match IterationResult.Done aโœยน aโœ with | IterationResult.Done s' u => IterationResult.Running s' (fun x => true) (f u) | IterationResult.Panic s' msg => IterationResult.Panic s' msg | IterationResult.Running s' block_until cont => IterationResult.Running s' block_until (cont >>= f) with | IterationResult.Done s' t => Spec.validate spec (env_r + r') s' โˆง motive t r' | IterationResult.Panic a a_1 => False | IterationResult.Running s' block_until cont => Spec.validate spec (env_r + r') s' โˆง valid cont r' block_until motive
spec: Spec

U, V: Type

mu: TaskM spec U

f: U โ†’ TaskM spec V

r: spec.Reservation

assuming: spec.State โ†’ Bool

motive: V โ†’ spec.Reservation โ†’ Prop

motive_u: U โ†’ spec.Reservation โ†’ Prop

mu_valid: โˆ€ (env_r : spec.Reservation) (s : spec.State), assuming s = true โ†’ Spec.validate spec (env_r + r) s โ†’ โˆƒ r', match h : iterate mu s with | IterationResult.Done s' t => Spec.validate spec (env_r + r') s' โˆง motive_u t r' | IterationResult.Panic a a_1 => False | IterationResult.Running s' block_until cont => Spec.validate spec (env_r + r') s' โˆง valid cont r' block_until motive_u

f_valid: โˆ€ (r' : spec.Reservation) (u : U), motive_u u r' โ†’ valid (f u) r' (fun x => true) motive

env_r: spec.Reservation

s: spec.State

assuming_true: assuming s = true

initial_valid: Spec.validate spec (env_r + r) s

aโœยน: spec.State

aโœ: String

iteration: iterate mu s = IterationResult.Panic aโœยน aโœ


Panic
โˆƒ r', match h : let _discr := IterationResult.Panic aโœยน aโœ; match IterationResult.Panic aโœยน aโœ with | IterationResult.Done s' u => IterationResult.Running s' (fun x => true) (f u) | IterationResult.Panic s' msg => IterationResult.Panic s' msg | IterationResult.Running s' block_until cont => IterationResult.Running s' block_until (cont >>= f) with | IterationResult.Done s' t => Spec.validate spec (env_r + r') s' โˆง motive t r' | IterationResult.Panic a a_1 => False | IterationResult.Running s' block_until cont => Spec.validate spec (env_r + r') s' โˆง valid cont r' block_until motive
spec: Spec

U, V: Type

mu: TaskM spec U

f: U โ†’ TaskM spec V

r: spec.Reservation

assuming: spec.State โ†’ Bool

motive: V โ†’ spec.Reservation โ†’ Prop

motive_u: U โ†’ spec.Reservation โ†’ Prop

mu_valid: โˆ€ (env_r : spec.Reservation) (s : spec.State), assuming s = true โ†’ Spec.validate spec (env_r + r) s โ†’ โˆƒ r', match h : iterate mu s with | IterationResult.Done s' t => Spec.validate spec (env_r + r') s' โˆง motive_u t r' | IterationResult.Panic a a_1 => False | IterationResult.Running s' block_until cont => Spec.validate spec (env_r + r') s' โˆง valid cont r' block_until motive_u

f_valid: โˆ€ (r' : spec.Reservation) (u : U), motive_u u r' โ†’ valid (f u) r' (fun x => true) motive

env_r: spec.Reservation

s: spec.State

assuming_true: assuming s = true

initial_valid: Spec.validate spec (env_r + r) s

aโœยฒ: spec.State

aโœยน: spec.State โ†’ Bool

aโœ: TaskM spec U

iteration: iterate mu s = IterationResult.Running aโœยฒ aโœยน aโœ


Running
โˆƒ r', match h : let _discr := IterationResult.Running aโœยฒ aโœยน aโœ; match IterationResult.Running aโœยฒ aโœยน aโœ with | IterationResult.Done s' u => IterationResult.Running s' (fun x => true) (f u) | IterationResult.Panic s' msg => IterationResult.Panic s' msg | IterationResult.Running s' block_until cont => IterationResult.Running s' block_until (cont >>= f) with | IterationResult.Done s' t => Spec.validate spec (env_r + r') s' โˆง motive t r' | IterationResult.Panic a a_1 => False | IterationResult.Running s' block_until cont => Spec.validate spec (env_r + r') s' โˆง valid cont r' block_until motive
spec: Spec

U, V: Type

mu: TaskM spec U

f: U โ†’ TaskM spec V

r: spec.Reservation

assuming: spec.State โ†’ Bool

motive: V โ†’ spec.Reservation โ†’ Prop

motive_u: U โ†’ spec.Reservation โ†’ Prop

mu_valid: valid mu r assuming motive_u

f_valid: โˆ€ (r' : spec.Reservation) (u : U), motive_u u r' โ†’ valid (f u) r' (fun x => true) motive


valid (mu >>= f) r assuming motive
spec: Spec

U, V: Type

mu: TaskM spec U

f: U โ†’ TaskM spec V

r: spec.Reservation

assuming: spec.State โ†’ Bool

motive: V โ†’ spec.Reservation โ†’ Prop

motive_u: U โ†’ spec.Reservation โ†’ Prop

mu_valid: โˆ€ (env_r : spec.Reservation) (s : spec.State), assuming s = true โ†’ Spec.validate spec (env_r + r) s โ†’ โˆƒ r', match h : iterate mu s with | IterationResult.Done s' t => Spec.validate spec (env_r + r') s' โˆง motive_u t r' | IterationResult.Panic a a_1 => False | IterationResult.Running s' block_until cont => Spec.validate spec (env_r + r') s' โˆง valid cont r' block_until motive_u

f_valid: โˆ€ (r' : spec.Reservation) (u : U), motive_u u r' โ†’ valid (f u) r' (fun x => true) motive

env_r: spec.Reservation

s: spec.State

assuming_true: assuming s = true

initial_valid: Spec.validate spec (env_r + r) s

aโœยน: spec.State

aโœ: U

iteration: iterate mu s = IterationResult.Done aโœยน aโœ


Done
โˆƒ r', match h : let _discr := IterationResult.Done aโœยน aโœ; match IterationResult.Done aโœยน aโœ with | IterationResult.Done s' u => IterationResult.Running s' (fun x => true) (f u) | IterationResult.Panic s' msg => IterationResult.Panic s' msg | IterationResult.Running s' block_until cont => IterationResult.Running s' block_until (cont >>= f) with | IterationResult.Done s' t => Spec.validate spec (env_r + r') s' โˆง motive t r' | IterationResult.Panic a a_1 => False | IterationResult.Running s' block_until cont => Spec.validate spec (env_r + r') s' โˆง valid cont r' block_until motive
spec: Spec

U, V: Type

mu: TaskM spec U

f: U โ†’ TaskM spec V

r: spec.Reservation

assuming: spec.State โ†’ Bool

motive: V โ†’ spec.Reservation โ†’ Prop

motive_u: U โ†’ spec.Reservation โ†’ Prop

mu_valid: โˆ€ (env_r : spec.Reservation) (s : spec.State), assuming s = true โ†’ Spec.validate spec (env_r + r) s โ†’ โˆƒ r', match h : iterate mu s with | IterationResult.Done s' t => Spec.validate spec (env_r + r') s' โˆง motive_u t r' | IterationResult.Panic a a_1 => False | IterationResult.Running s' block_until cont => Spec.validate spec (env_r + r') s' โˆง valid cont r' block_until motive_u

f_valid: โˆ€ (r' : spec.Reservation) (u : U), motive_u u r' โ†’ valid (f u) r' (fun x => true) motive

env_r: spec.Reservation

s: spec.State

assuming_true: assuming s = true

initial_valid: Spec.validate spec (env_r + r) s

aโœยน: spec.State

aโœ: String

iteration: iterate mu s = IterationResult.Panic aโœยน aโœ


Panic
โˆƒ r', match h : let _discr := IterationResult.Panic aโœยน aโœ; match IterationResult.Panic aโœยน aโœ with | IterationResult.Done s' u => IterationResult.Running s' (fun x => true) (f u) | IterationResult.Panic s' msg => IterationResult.Panic s' msg | IterationResult.Running s' block_until cont => IterationResult.Running s' block_until (cont >>= f) with | IterationResult.Done s' t => Spec.validate spec (env_r + r') s' โˆง motive t r' | IterationResult.Panic a a_1 => False | IterationResult.Running s' block_until cont => Spec.validate spec (env_r + r') s' โˆง valid cont r' block_until motive
spec: Spec

U, V: Type

mu: TaskM spec U

f: U โ†’ TaskM spec V

r: spec.Reservation

assuming: spec.State โ†’ Bool

motive: V โ†’ spec.Reservation โ†’ Prop

motive_u: U โ†’ spec.Reservation โ†’ Prop

mu_valid: โˆ€ (env_r : spec.Reservation) (s : spec.State), assuming s = true โ†’ Spec.validate spec (env_r + r) s โ†’ โˆƒ r', match h : iterate mu s with | IterationResult.Done s' t => Spec.validate spec (env_r + r') s' โˆง motive_u t r' | IterationResult.Panic a a_1 => False | IterationResult.Running s' block_until cont => Spec.validate spec (env_r + r') s' โˆง valid cont r' block_until motive_u

f_valid: โˆ€ (r' : spec.Reservation) (u : U), motive_u u r' โ†’ valid (f u) r' (fun x => true) motive

env_r: spec.Reservation

s: spec.State

assuming_true: assuming s = true

initial_valid: Spec.validate spec (env_r + r) s

aโœยฒ: spec.State

aโœยน: spec.State โ†’ Bool

aโœ: TaskM spec U

iteration: iterate mu s = IterationResult.Running aโœยฒ aโœยน aโœ


Running
โˆƒ r', match h : let _discr := IterationResult.Running aโœยฒ aโœยน aโœ; match IterationResult.Running aโœยฒ aโœยน aโœ with | IterationResult.Done s' u => IterationResult.Running s' (fun x => true) (f u) | IterationResult.Panic s' msg => IterationResult.Panic s' msg | IterationResult.Running s' block_until cont => IterationResult.Running s' block_until (cont >>= f) with | IterationResult.Done s' t => Spec.validate spec (env_r + r') s' โˆง motive t r' | IterationResult.Panic a a_1 => False | IterationResult.Running s' block_until cont => Spec.validate spec (env_r + r') s' โˆง valid cont r' block_until motive
spec: Spec

U, V: Type

mu: TaskM spec U

f: U โ†’ TaskM spec V

r: spec.Reservation

assuming: spec.State โ†’ Bool

motive: V โ†’ spec.Reservation โ†’ Prop

motive_u: U โ†’ spec.Reservation โ†’ Prop

mu_valid: โˆ€ (env_r : spec.Reservation) (s : spec.State), assuming s = true โ†’ Spec.validate spec (env_r + r) s โ†’ โˆƒ r', match h : iterate mu s with | IterationResult.Done s' t => Spec.validate spec (env_r + r') s' โˆง motive_u t r' | IterationResult.Panic a a_1 => False | IterationResult.Running s' block_until cont => Spec.validate spec (env_r + r') s' โˆง valid cont r' block_until motive_u

f_valid: โˆ€ (r' : spec.Reservation) (u : U), motive_u u r' โ†’ valid (f u) r' (fun x => true) motive

env_r: spec.Reservation

s: spec.State

assuming_true: assuming s = true

initial_valid: Spec.validate spec (env_r + r) s

aโœยน: spec.State

aโœ: U

iteration: iterate mu s = IterationResult.Done aโœยน aโœ


Done
โˆƒ r', match h : let _discr := IterationResult.Done aโœยน aโœ; match IterationResult.Done aโœยน aโœ with | IterationResult.Done s' u => IterationResult.Running s' (fun x => true) (f u) | IterationResult.Panic s' msg => IterationResult.Panic s' msg | IterationResult.Running s' block_until cont => IterationResult.Running s' block_until (cont >>= f) with | IterationResult.Done s' t => Spec.validate spec (env_r + r') s' โˆง motive t r' | IterationResult.Panic a a_1 => False | IterationResult.Running s' block_until cont => Spec.validate spec (env_r + r') s' โˆง valid cont r' block_until motive
spec: Spec

U, V: Type

mu: TaskM spec U

f: U โ†’ TaskM spec V

r: spec.Reservation

assuming: spec.State โ†’ Bool

motive: V โ†’ spec.Reservation โ†’ Prop

motive_u: U โ†’ spec.Reservation โ†’ Prop

mu_valid: โˆ€ (env_r : spec.Reservation) (s : spec.State), assuming s = true โ†’ Spec.validate spec (env_r + r) s โ†’ โˆƒ r', match h : iterate mu s with | IterationResult.Done s' t => Spec.validate spec (env_r + r') s' โˆง motive_u t r' | IterationResult.Panic a a_1 => False | IterationResult.Running s' block_until cont => Spec.validate spec (env_r + r') s' โˆง valid cont r' block_until motive_u

f_valid: โˆ€ (r' : spec.Reservation) (u : U), motive_u u r' โ†’ valid (f u) r' (fun x => true) motive

env_r: spec.Reservation

s: spec.State

assuming_true: assuming s = true

initial_valid: Spec.validate spec (env_r + r) s

aโœยฒ: spec.State

aโœยน: spec.State โ†’ Bool

aโœ: TaskM spec U

iteration: iterate mu s = IterationResult.Running aโœยฒ aโœยน aโœ


Running
โˆƒ r', Spec.validate spec (env_r + r') aโœยฒ โˆง valid (aโœ >>= f) r' aโœยน motive
spec: Spec

U, V: Type

mu: TaskM spec U

f: U โ†’ TaskM spec V

r: spec.Reservation

assuming: spec.State โ†’ Bool

motive: V โ†’ spec.Reservation โ†’ Prop

motive_u: U โ†’ spec.Reservation โ†’ Prop

mu_valid: โˆ€ (env_r : spec.Reservation) (s : spec.State), assuming s = true โ†’ Spec.validate spec (env_r + r) s โ†’ โˆƒ r', match h : iterate mu s with | IterationResult.Done s' t => Spec.validate spec (env_r + r') s' โˆง motive_u t r' | IterationResult.Panic a a_1 => False | IterationResult.Running s' block_until cont => Spec.validate spec (env_r + r') s' โˆง valid cont r' block_until motive_u

f_valid: โˆ€ (r' : spec.Reservation) (u : U), motive_u u r' โ†’ valid (f u) r' (fun x => true) motive

env_r: spec.Reservation

s: spec.State

assuming_true: assuming s = true

initial_valid: Spec.validate spec (env_r + r) s

aโœยน: spec.State

aโœ: String

iteration: iterate mu s = IterationResult.Panic aโœยน aโœ


Panic
โˆƒ r', match h : let _discr := IterationResult.Panic aโœยน aโœ; match IterationResult.Panic aโœยน aโœ with | IterationResult.Done s' u => IterationResult.Running s' (fun x => true) (f u) | IterationResult.Panic s' msg => IterationResult.Panic s' msg | IterationResult.Running s' block_until cont => IterationResult.Running s' block_until (cont >>= f) with | IterationResult.Done s' t => Spec.validate spec (env_r + r') s' โˆง motive t r' | IterationResult.Panic a a_1 => False | IterationResult.Running s' block_until cont => Spec.validate spec (env_r + r') s' โˆง valid cont r' block_until motive
spec: Spec

U, V: Type

mu: TaskM spec U

f: U โ†’ TaskM spec V

r: spec.Reservation

assuming: spec.State โ†’ Bool

motive: V โ†’ spec.Reservation โ†’ Prop

motive_u: U โ†’ spec.Reservation โ†’ Prop

f_valid: โˆ€ (r' : spec.Reservation) (u : U), motive_u u r' โ†’ valid (f u) r' (fun x => true) motive

env_r: spec.Reservation

s: spec.State

assuming_true: assuming s = true

initial_valid: Spec.validate spec (env_r + r) s

aโœยฒ: spec.State

aโœยน: spec.State โ†’ Bool

aโœ: TaskM spec U

iteration: iterate mu s = IterationResult.Running aโœยฒ aโœยน aโœ

mu_valid: โˆƒ r', match h : iterate mu s with | IterationResult.Done s' t => Spec.validate spec (env_r + r') s' โˆง motive_u t r' | IterationResult.Panic a a_1 => False | IterationResult.Running s' block_until cont => Spec.validate spec (env_r + r') s' โˆง valid cont r' block_until motive_u


Running
โˆƒ r', Spec.validate spec (env_r + r') aโœยฒ โˆง valid (aโœ >>= f) r' aโœยน motive
spec: Spec

U, V: Type

mu: TaskM spec U

f: U โ†’ TaskM spec V

r: spec.Reservation

assuming: spec.State โ†’ Bool

motive: V โ†’ spec.Reservation โ†’ Prop

motive_u: U โ†’ spec.Reservation โ†’ Prop

mu_valid: โˆ€ (env_r : spec.Reservation) (s : spec.State), assuming s = true โ†’ Spec.validate spec (env_r + r) s โ†’ โˆƒ r', match h : iterate mu s with | IterationResult.Done s' t => Spec.validate spec (env_r + r') s' โˆง motive_u t r' | IterationResult.Panic a a_1 => False | IterationResult.Running s' block_until cont => Spec.validate spec (env_r + r') s' โˆง valid cont r' block_until motive_u

f_valid: โˆ€ (r' : spec.Reservation) (u : U), motive_u u r' โ†’ valid (f u) r' (fun x => true) motive

env_r: spec.Reservation

s: spec.State

assuming_true: assuming s = true

initial_valid: Spec.validate spec (env_r + r) s

aโœยน: spec.State

aโœ: String

iteration: iterate mu s = IterationResult.Panic aโœยน aโœ


Panic
โˆƒ r', match h : let _discr := IterationResult.Panic aโœยน aโœ; match IterationResult.Panic aโœยน aโœ with | IterationResult.Done s' u => IterationResult.Running s' (fun x => true) (f u) | IterationResult.Panic s' msg => IterationResult.Panic s' msg | IterationResult.Running s' block_until cont => IterationResult.Running s' block_until (cont >>= f) with | IterationResult.Done s' t => Spec.validate spec (env_r + r') s' โˆง motive t r' | IterationResult.Panic a a_1 => False | IterationResult.Running s' block_until cont => Spec.validate spec (env_r + r') s' โˆง valid cont r' block_until motive
spec: Spec

U, V: Type

mu: TaskM spec U

f: U โ†’ TaskM spec V

r: spec.Reservation

assuming: spec.State โ†’ Bool

motive: V โ†’ spec.Reservation โ†’ Prop

motive_u: U โ†’ spec.Reservation โ†’ Prop

f_valid: โˆ€ (r' : spec.Reservation) (u : U), motive_u u r' โ†’ valid (f u) r' (fun x => true) motive

env_r: spec.Reservation

s: spec.State

assuming_true: assuming s = true

initial_valid: Spec.validate spec (env_r + r) s

aโœยฒ: spec.State

aโœยน: spec.State โ†’ Bool

aโœ: TaskM spec U

iteration: iterate mu s = IterationResult.Running aโœยฒ aโœยน aโœ

mu_valid: โˆƒ r', match h : iterate mu s with | IterationResult.Done s' t => Spec.validate spec (env_r + r') s' โˆง motive_u t r' | IterationResult.Panic a a_1 => False | IterationResult.Running s' block_until cont => Spec.validate spec (env_r + r') s' โˆง valid cont r' block_until motive_u


Running
โˆƒ r', Spec.validate spec (env_r + r') aโœยฒ โˆง valid (aโœ >>= f) r' aโœยน motive
spec: Spec

U, V: Type

mu: TaskM spec U

f: U โ†’ TaskM spec V

r: spec.Reservation

assuming: spec.State โ†’ Bool

motive: V โ†’ spec.Reservation โ†’ Prop

motive_u: U โ†’ spec.Reservation โ†’ Prop

f_valid: โˆ€ (r' : spec.Reservation) (u : U), motive_u u r' โ†’ valid (f u) r' (fun x => true) motive

env_r: spec.Reservation

s: spec.State

assuming_true: assuming s = true

initial_valid: Spec.validate spec (env_r + r) s

aโœยน: spec.State

aโœ: String

iteration: iterate mu s = IterationResult.Panic aโœยน aโœ

mu_valid: โˆƒ r', match h : IterationResult.Panic aโœยน aโœ with | IterationResult.Done s' t => Spec.validate spec (env_r + r') s' โˆง motive_u t r' | IterationResult.Panic a a_1 => False | IterationResult.Running s' block_until cont => Spec.validate spec (env_r + r') s' โˆง valid cont r' block_until motive_u


Panic
โˆƒ r', False
spec: Spec

U, V: Type

mu: TaskM spec U

f: U โ†’ TaskM spec V

r: spec.Reservation

assuming: spec.State โ†’ Bool

motive: V โ†’ spec.Reservation โ†’ Prop

motive_u: U โ†’ spec.Reservation โ†’ Prop

f_valid: โˆ€ (r' : spec.Reservation) (u : U), motive_u u r' โ†’ valid (f u) r' (fun x => true) motive

env_r: spec.Reservation

s: spec.State

assuming_true: assuming s = true

initial_valid: Spec.validate spec (env_r + r) s

aโœยฒ: spec.State

aโœยน: spec.State โ†’ Bool

aโœ: TaskM spec U

iteration: iterate mu s = IterationResult.Running aโœยฒ aโœยน aโœ

mu_valid: โˆƒ r', match h : IterationResult.Running aโœยฒ aโœยน aโœ with | IterationResult.Done s' t => Spec.validate spec (env_r + r') s' โˆง motive_u t r' | IterationResult.Panic a a_1 => False | IterationResult.Running s' block_until cont => Spec.validate spec (env_r + r') s' โˆง valid cont r' block_until motive_u


Running
โˆƒ r', Spec.validate spec (env_r + r') aโœยฒ โˆง valid (aโœ >>= f) r' aโœยน motive
spec: Spec

U, V: Type

mu: TaskM spec U

f: U โ†’ TaskM spec V

r: spec.Reservation

assuming: spec.State โ†’ Bool

motive: V โ†’ spec.Reservation โ†’ Prop

motive_u: U โ†’ spec.Reservation โ†’ Prop

f_valid: โˆ€ (r' : spec.Reservation) (u : U), motive_u u r' โ†’ valid (f u) r' (fun x => true) motive

env_r: spec.Reservation

s: spec.State

assuming_true: assuming s = true

initial_valid: Spec.validate spec (env_r + r) s

aโœยฒ: spec.State

aโœยน: spec.State โ†’ Bool

aโœ: TaskM spec U

iteration: iterate mu s = IterationResult.Running aโœยฒ aโœยน aโœ

mu_valid: โˆƒ r', match h : IterationResult.Running aโœยฒ aโœยน aโœ with | IterationResult.Done s' t => Spec.validate spec (env_r + r') s' โˆง motive_u t r' | IterationResult.Panic a a_1 => False | IterationResult.Running s' block_until cont => Spec.validate spec (env_r + r') s' โˆง valid cont r' block_until motive_u


Running
โˆƒ r', Spec.validate spec (env_r + r') aโœยฒ โˆง valid (aโœ >>= f) r' aโœยน motive
spec: Spec

U, V: Type

mu: TaskM spec U

f: U โ†’ TaskM spec V

r: spec.Reservation

assuming: spec.State โ†’ Bool

motive: V โ†’ spec.Reservation โ†’ Prop

motive_u: U โ†’ spec.Reservation โ†’ Prop

mu_valid: โˆ€ (env_r : spec.Reservation) (s : spec.State), assuming s = true โ†’ Spec.validate spec (env_r + r) s โ†’ โˆƒ r', match h : iterate mu s with | IterationResult.Done s' t => Spec.validate spec (env_r + r') s' โˆง motive_u t r' | IterationResult.Panic a a_1 => False | IterationResult.Running s' block_until cont => Spec.validate spec (env_r + r') s' โˆง valid cont r' block_until motive_u

f_valid: โˆ€ (r' : spec.Reservation) (u : U), motive_u u r' โ†’ valid (f u) r' (fun x => true) motive

env_r: spec.Reservation

s: spec.State

assuming_true: assuming s = true

initial_valid: Spec.validate spec (env_r + r) s

aโœยน: spec.State

aโœ: String

iteration: iterate mu s = IterationResult.Panic aโœยน aโœ


Panic
โˆƒ r', match h : let _discr := IterationResult.Panic aโœยน aโœ; match IterationResult.Panic aโœยน aโœ with | IterationResult.Done s' u => IterationResult.Running s' (fun x => true) (f u) | IterationResult.Panic s' msg => IterationResult.Panic s' msg | IterationResult.Running s' block_until cont => IterationResult.Running s' block_until (cont >>= f) with | IterationResult.Done s' t => Spec.validate spec (env_r + r') s' โˆง motive t r' | IterationResult.Panic a a_1 => False | IterationResult.Running s' block_until cont => Spec.validate spec (env_r + r') s' โˆง valid cont r' block_until motive
spec: Spec

U, V: Type

mu: TaskM spec U

f: U โ†’ TaskM spec V

r: spec.Reservation

assuming: spec.State โ†’ Bool

motive: V โ†’ spec.Reservation โ†’ Prop

motive_u: U โ†’ spec.Reservation โ†’ Prop

f_valid: โˆ€ (r' : spec.Reservation) (u : U), motive_u u r' โ†’ valid (f u) r' (fun x => true) motive

env_r: spec.Reservation

s: spec.State

assuming_true: assuming s = true

initial_valid: Spec.validate spec (env_r + r) s

aโœยน: spec.State

aโœ: U

iteration: iterate mu s = IterationResult.Done aโœยน aโœ

mu_valid: โˆƒ r', Spec.validate spec (env_r + r') aโœยน โˆง motive_u aโœ r'


Done
โˆƒ r', Spec.validate spec (env_r + r') aโœยน โˆง valid (f aโœ) r' (fun x => true) motive
spec: Spec

U, V: Type

mu: TaskM spec U

f: U โ†’ TaskM spec V

r: spec.Reservation

assuming: spec.State โ†’ Bool

motive: V โ†’ spec.Reservation โ†’ Prop

motive_u: U โ†’ spec.Reservation โ†’ Prop

mu_valid: โˆ€ (env_r : spec.Reservation) (s : spec.State), assuming s = true โ†’ Spec.validate spec (env_r + r) s โ†’ โˆƒ r', match h : iterate mu s with | IterationResult.Done s' t => Spec.validate spec (env_r + r') s' โˆง motive_u t r' | IterationResult.Panic a a_1 => False | IterationResult.Running s' block_until cont => Spec.validate spec (env_r + r') s' โˆง valid cont r' block_until motive_u

f_valid: โˆ€ (r' : spec.Reservation) (u : U), motive_u u r' โ†’ valid (f u) r' (fun x => true) motive

env_r: spec.Reservation

s: spec.State

assuming_true: assuming s = true

initial_valid: Spec.validate spec (env_r + r) s

aโœยน: spec.State

aโœ: String

iteration: iterate mu s = IterationResult.Panic aโœยน aโœ


Panic
โˆƒ r', match h : let _discr := IterationResult.Panic aโœยน aโœ; match IterationResult.Panic aโœยน aโœ with | IterationResult.Done s' u => IterationResult.Running s' (fun x => true) (f u) | IterationResult.Panic s' msg => IterationResult.Panic s' msg | IterationResult.Running s' block_until cont => IterationResult.Running s' block_until (cont >>= f) with | IterationResult.Done s' t => Spec.validate spec (env_r + r') s' โˆง motive t r' | IterationResult.Panic a a_1 => False | IterationResult.Running s' block_until cont => Spec.validate spec (env_r + r') s' โˆง valid cont r' block_until motive
spec: Spec

U, V: Type

mu: TaskM spec U

f: U โ†’ TaskM spec V

r: spec.Reservation

assuming: spec.State โ†’ Bool

motive: V โ†’ spec.Reservation โ†’ Prop

motive_u: U โ†’ spec.Reservation โ†’ Prop

mu_valid: โˆ€ (env_r : spec.Reservation) (s : spec.State), assuming s = true โ†’ Spec.validate spec (env_r + r) s โ†’ โˆƒ r', match h : iterate mu s with | IterationResult.Done s' t => Spec.validate spec (env_r + r') s' โˆง motive_u t r' | IterationResult.Panic a a_1 => False | IterationResult.Running s' block_until cont => Spec.validate spec (env_r + r') s' โˆง valid cont r' block_until motive_u

f_valid: โˆ€ (r' : spec.Reservation) (u : U), motive_u u r' โ†’ valid (f u) r' (fun x => true) motive

env_r: spec.Reservation

s: spec.State

assuming_true: assuming s = true

initial_valid: Spec.validate spec (env_r + r) s

aโœยน: spec.State

aโœ: String

iteration: iterate mu s = IterationResult.Panic aโœยน aโœ

wโœ: spec.Reservation


Panic.intro
โˆƒ r', False
spec: Spec

U, V: Type

mu: TaskM spec U

f: U โ†’ TaskM spec V

r: spec.Reservation

assuming: spec.State โ†’ Bool

motive: V โ†’ spec.Reservation โ†’ Prop

motive_u: U โ†’ spec.Reservation โ†’ Prop

mu_valid: โˆ€ (env_r : spec.Reservation) (s : spec.State), assuming s = true โ†’ Spec.validate spec (env_r + r) s โ†’ โˆƒ r', match h : iterate mu s with | IterationResult.Done s' t => Spec.validate spec (env_r + r') s' โˆง motive_u t r' | IterationResult.Panic a a_1 => False | IterationResult.Running s' block_until cont => Spec.validate spec (env_r + r') s' โˆง valid cont r' block_until motive_u

f_valid: โˆ€ (r' : spec.Reservation) (u : U), motive_u u r' โ†’ valid (f u) r' (fun x => true) motive

env_r: spec.Reservation

s: spec.State

assuming_true: assuming s = true

initial_valid: Spec.validate spec (env_r + r) s

aโœยน: spec.State

aโœ: String

iteration: iterate mu s = IterationResult.Panic aโœยน aโœ


Panic
โˆƒ r', match h : let _discr := IterationResult.Panic aโœยน aโœ; match IterationResult.Panic aโœยน aโœ with | IterationResult.Done s' u => IterationResult.Running s' (fun x => true) (f u) | IterationResult.Panic s' msg => IterationResult.Panic s' msg | IterationResult.Running s' block_until cont => IterationResult.Running s' block_until (cont >>= f) with | IterationResult.Done s' t => Spec.validate spec (env_r + r') s' โˆง motive t r' | IterationResult.Panic a a_1 => False | IterationResult.Running s' block_until cont => Spec.validate spec (env_r + r') s' โˆง valid cont r' block_until motive
spec: Spec

U, V: Type

mu: TaskM spec U

f: U โ†’ TaskM spec V

r: spec.Reservation

assuming: spec.State โ†’ Bool

motive: V โ†’ spec.Reservation โ†’ Prop

motive_u: U โ†’ spec.Reservation โ†’ Prop

mu_valid: โˆ€ (env_r : spec.Reservation) (s : spec.State), assuming s = true โ†’ Spec.validate spec (env_r + r) s โ†’ โˆƒ r', match h : iterate mu s with | IterationResult.Done s' t => Spec.validate spec (env_r + r') s' โˆง motive_u t r' | IterationResult.Panic a a_1 => False | IterationResult.Running s' block_until cont => Spec.validate spec (env_r + r') s' โˆง valid cont r' block_until motive_u

f_valid: โˆ€ (r' : spec.Reservation) (u : U), motive_u u r' โ†’ valid (f u) r' (fun x => true) motive

env_r: spec.Reservation

s: spec.State

assuming_true: assuming s = true

initial_valid: Spec.validate spec (env_r + r) s

aโœยฒ: spec.State

aโœยน: spec.State โ†’ Bool

aโœ: TaskM spec U

iteration: iterate mu s = IterationResult.Running aโœยฒ aโœยน aโœ

wโœ: spec.Reservation


Running.intro
โˆƒ r', Spec.validate spec (env_r + r') aโœยฒ โˆง valid (aโœ >>= f) r' aโœยน motive
spec: Spec

U, V: Type

mu: TaskM spec U

f: U โ†’ TaskM spec V

r: spec.Reservation

assuming: spec.State โ†’ Bool

motive: V โ†’ spec.Reservation โ†’ Prop

motive_u: U โ†’ spec.Reservation โ†’ Prop

mu_valid: โˆ€ (env_r : spec.Reservation) (s : spec.State), assuming s = true โ†’ Spec.validate spec (env_r + r) s โ†’ โˆƒ r', match h : iterate mu s with | IterationResult.Done s' t => Spec.validate spec (env_r + r') s' โˆง motive_u t r' | IterationResult.Panic a a_1 => False | IterationResult.Running s' block_until cont => Spec.validate spec (env_r + r') s' โˆง valid cont r' block_until motive_u

f_valid: โˆ€ (r' : spec.Reservation) (u : U), motive_u u r' โ†’ valid (f u) r' (fun x => true) motive

env_r: spec.Reservation

s: spec.State

assuming_true: assuming s = true

initial_valid: Spec.validate spec (env_r + r) s

aโœยน: spec.State

aโœ: String

iteration: iterate mu s = IterationResult.Panic aโœยน aโœ


Panic
โˆƒ r', match h : let _discr := IterationResult.Panic aโœยน aโœ; match IterationResult.Panic aโœยน aโœ with | IterationResult.Done s' u => IterationResult.Running s' (fun x => true) (f u) | IterationResult.Panic s' msg => IterationResult.Panic s' msg | IterationResult.Running s' block_until cont => IterationResult.Running s' block_until (cont >>= f) with | IterationResult.Done s' t => Spec.validate spec (env_r + r') s' โˆง motive t r' | IterationResult.Panic a a_1 => False | IterationResult.Running s' block_until cont => Spec.validate spec (env_r + r') s' โˆง valid cont r' block_until motive
spec: Spec

U, V: Type

mu: TaskM spec U

f: U โ†’ TaskM spec V

r: spec.Reservation

assuming: spec.State โ†’ Bool

motive: V โ†’ spec.Reservation โ†’ Prop

motive_u: U โ†’ spec.Reservation โ†’ Prop

f_valid: โˆ€ (r' : spec.Reservation) (u : U), motive_u u r' โ†’ valid (f u) r' (fun x => true) motive

env_r: spec.Reservation

s: spec.State

assuming_true: assuming s = true

initial_valid: Spec.validate spec (env_r + r) s

aโœยน: spec.State

aโœ: String

iteration: iterate mu s = IterationResult.Panic aโœยน aโœ

r': spec.Reservation

mu_valid: False


Panic.intro
โˆƒ r', False
spec: Spec

U, V: Type

mu: TaskM spec U

f: U โ†’ TaskM spec V

r: spec.Reservation

assuming: spec.State โ†’ Bool

motive: V โ†’ spec.Reservation โ†’ Prop

motive_u: U โ†’ spec.Reservation โ†’ Prop

mu_valid: โˆ€ (env_r : spec.Reservation) (s : spec.State), assuming s = true โ†’ Spec.validate spec (env_r + r) s โ†’ โˆƒ r', match h : iterate mu s with | IterationResult.Done s' t => Spec.validate spec (env_r + r') s' โˆง motive_u t r' | IterationResult.Panic a a_1 => False | IterationResult.Running s' block_until cont => Spec.validate spec (env_r + r') s' โˆง valid cont r' block_until motive_u

f_valid: โˆ€ (r' : spec.Reservation) (u : U), motive_u u r' โ†’ valid (f u) r' (fun x => true) motive

env_r: spec.Reservation

s: spec.State

assuming_true: assuming s = true

initial_valid: Spec.validate spec (env_r + r) s

aโœยน: spec.State

aโœ: String

iteration: iterate mu s = IterationResult.Panic aโœยน aโœ


Panic
โˆƒ r', match h : let _discr := IterationResult.Panic aโœยน aโœ; match IterationResult.Panic aโœยน aโœ with | IterationResult.Done s' u => IterationResult.Running s' (fun x => true) (f u) | IterationResult.Panic s' msg => IterationResult.Panic s' msg | IterationResult.Running s' block_until cont => IterationResult.Running s' block_until (cont >>= f) with | IterationResult.Done s' t => Spec.validate spec (env_r + r') s' โˆง motive t r' | IterationResult.Panic a a_1 => False | IterationResult.Running s' block_until cont => Spec.validate spec (env_r + r') s' โˆง valid cont r' block_until motive
spec: Spec

U, V: Type

mu: TaskM spec U

f: U โ†’ TaskM spec V

r: spec.Reservation

assuming: spec.State โ†’ Bool

motive: V โ†’ spec.Reservation โ†’ Prop

motive_u: U โ†’ spec.Reservation โ†’ Prop

f_valid: โˆ€ (r' : spec.Reservation) (u : U), motive_u u r' โ†’ valid (f u) r' (fun x => true) motive

env_r: spec.Reservation

s: spec.State

assuming_true: assuming s = true

initial_valid: Spec.validate spec (env_r + r) s

aโœยน: spec.State

aโœ: U

iteration: iterate mu s = IterationResult.Done aโœยน aโœ

r': spec.Reservation

mu_valid: Spec.validate spec (env_r + r') aโœยน โˆง motive_u aโœ r'


Done.intro
Spec.validate spec (env_r + r') aโœยน โˆง valid (f aโœ) r' (fun x => true) motive
spec: Spec

U, V: Type

mu: TaskM spec U

f: U โ†’ TaskM spec V

r: spec.Reservation

assuming: spec.State โ†’ Bool

motive: V โ†’ spec.Reservation โ†’ Prop

motive_u: U โ†’ spec.Reservation โ†’ Prop

f_valid: โˆ€ (r' : spec.Reservation) (u : U), motive_u u r' โ†’ valid (f u) r' (fun x => true) motive

env_r: spec.Reservation

s: spec.State

assuming_true: assuming s = true

initial_valid: Spec.validate spec (env_r + r) s

aโœยน: spec.State

aโœ: U

iteration: iterate mu s = IterationResult.Done aโœยน aโœ

r': spec.Reservation

mu_valid: Spec.validate spec (env_r + r') aโœยน โˆง motive_u aโœ r'


Done.intro
Spec.validate spec (env_r + r') aโœยน โˆง valid (f aโœ) r' (fun x => true) motive
spec: Spec

U, V: Type

mu: TaskM spec U

f: U โ†’ TaskM spec V

r: spec.Reservation

assuming: spec.State โ†’ Bool

motive: V โ†’ spec.Reservation โ†’ Prop

motive_u: U โ†’ spec.Reservation โ†’ Prop

mu_valid: valid mu r assuming motive_u

f_valid: โˆ€ (r' : spec.Reservation) (u : U), motive_u u r' โ†’ valid (f u) r' (fun x => true) motive


valid (mu >>= f) r assuming motive
spec: Spec

U, V: Type

mu: TaskM spec U

f: U โ†’ TaskM spec V

r: spec.Reservation

assuming: spec.State โ†’ Bool

motive: V โ†’ spec.Reservation โ†’ Prop

motive_u: U โ†’ spec.Reservation โ†’ Prop

f_valid: โˆ€ (r' : spec.Reservation) (u : U), motive_u u r' โ†’ valid (f u) r' (fun x => true) motive

env_r: spec.Reservation

s: spec.State

assuming_true: assuming s = true

initial_valid: Spec.validate spec (env_r + r) s

aโœยน: spec.State

aโœ: U

iteration: iterate mu s = IterationResult.Done aโœยน aโœ

r': spec.Reservation

mu_valid: Spec.validate spec (env_r + r') aโœยน โˆง motive_u aโœ r'


Done.intro
Spec.validate spec (env_r + r') aโœยน โˆง valid (f aโœ) r' (fun x => true) motive
spec: Spec

U, V: Type

mu: TaskM spec U

f: U โ†’ TaskM spec V

r: spec.Reservation

assuming: spec.State โ†’ Bool

motive: V โ†’ spec.Reservation โ†’ Prop

motive_u: U โ†’ spec.Reservation โ†’ Prop

f_valid: โˆ€ (r' : spec.Reservation) (u : U), motive_u u r' โ†’ valid (f u) r' (fun x => true) motive

env_r: spec.Reservation

s: spec.State

assuming_true: assuming s = true

initial_valid: Spec.validate spec (env_r + r) s

aโœยน: spec.State

aโœ: U

iteration: iterate mu s = IterationResult.Done aโœยน aโœ

r': spec.Reservation

mu_valid: Spec.validate spec (env_r + r') aโœยน โˆง motive_u aโœ r'


Done.intro
Spec.validate spec (env_r + r') aโœยน โˆง valid (f aโœ) r' (fun x => true) motive
spec: Spec

U, V: Type

mu: TaskM spec U

f: U โ†’ TaskM spec V

r: spec.Reservation

assuming: spec.State โ†’ Bool

motive: V โ†’ spec.Reservation โ†’ Prop

motive_u: U โ†’ spec.Reservation โ†’ Prop

f_valid: โˆ€ (r' : spec.Reservation) (u : U), motive_u u r' โ†’ valid (f u) r' (fun x => true) motive

env_r: spec.Reservation

s: spec.State

assuming_true: assuming s = true

initial_valid: Spec.validate spec (env_r + r) s

aโœยฒ: spec.State

aโœยน: spec.State โ†’ Bool

aโœ: TaskM spec U

iteration: iterate mu s = IterationResult.Running aโœยฒ aโœยน aโœ

r': spec.Reservation

mu_valid: Spec.validate spec (env_r + r') aโœยฒ โˆง valid aโœ r' aโœยน motive_u


Running.intro
Spec.validate spec (env_r + r') aโœยฒ โˆง valid (aโœ >>= f) r' aโœยน motive

Goals accomplished! ๐Ÿ™
spec: Spec

U, V: Type

mu: TaskM spec U

f: U โ†’ TaskM spec V

r: spec.Reservation

assuming: spec.State โ†’ Bool

motive: V โ†’ spec.Reservation โ†’ Prop

motive_u: U โ†’ spec.Reservation โ†’ Prop

mu_valid: valid mu r assuming motive_u

f_valid: โˆ€ (r' : spec.Reservation) (u : U), motive_u u r' โ†’ valid (f u) r' (fun x => true) motive


valid (mu >>= f) r assuming motive
spec: Spec

U, V: Type

mu: TaskM spec U

f: U โ†’ TaskM spec V

r: spec.Reservation

assuming: spec.State โ†’ Bool

motive: V โ†’ spec.Reservation โ†’ Prop

motive_u: U โ†’ spec.Reservation โ†’ Prop

f_valid: โˆ€ (r' : spec.Reservation) (u : U), motive_u u r' โ†’ valid (f u) r' (fun x => true) motive

env_r: spec.Reservation

s: spec.State

assuming_true: assuming s = true

initial_valid: Spec.validate spec (env_r + r) s

aโœยฒ: spec.State

aโœยน: spec.State โ†’ Bool

aโœ: TaskM spec U

iteration: iterate mu s = IterationResult.Running aโœยฒ aโœยน aโœ

r': spec.Reservation

mu_valid: Spec.validate spec (env_r + r') aโœยฒ โˆง valid aโœ r' aโœยน motive_u


Running.intro
Spec.validate spec (env_r + r') aโœยฒ โˆง valid (aโœ >>= f) r' aโœยน motive
spec: Spec

U, V: Type

mu: TaskM spec U

f: U โ†’ TaskM spec V

r: spec.Reservation

assuming: spec.State โ†’ Bool

motive: V โ†’ spec.Reservation โ†’ Prop

motive_u: U โ†’ spec.Reservation โ†’ Prop

f_valid: โˆ€ (r' : spec.Reservation) (u : U), motive_u u r' โ†’ valid (f u) r' (fun x => true) motive

env_r: spec.Reservation

s: spec.State

assuming_true: assuming s = true

initial_valid: Spec.validate spec (env_r + r) s

aโœยฒ: spec.State

aโœยน: spec.State โ†’ Bool

aโœ: TaskM spec U

iteration: iterate mu s = IterationResult.Running aโœยฒ aโœยน aโœ

r': spec.Reservation

mu_valid: Spec.validate spec (env_r + r') aโœยฒ โˆง valid aโœ r' aโœยน motive_u


Running.intro
Spec.validate spec (env_r + r') aโœยฒ โˆง valid (aโœ >>= f) r' aโœยน motive
spec: Spec

U, V: Type

mu: TaskM spec U

f: U โ†’ TaskM spec V

r: spec.Reservation

assuming: spec.State โ†’ Bool

motive: V โ†’ spec.Reservation โ†’ Prop

motive_u: U โ†’ spec.Reservation โ†’ Prop

f_valid: โˆ€ (r' : spec.Reservation) (u : U), motive_u u r' โ†’ valid (f u) r' (fun x => true) motive

env_r: spec.Reservation

s: spec.State

assuming_true: assuming s = true

initial_valid: Spec.validate spec (env_r + r) s

aโœยฒ: spec.State

aโœยน: spec.State โ†’ Bool

aโœ: TaskM spec U

iteration: iterate mu s = IterationResult.Running aโœยฒ aโœยน aโœ

r': spec.Reservation

mu_valid: Spec.validate spec (env_r + r') aโœยฒ โˆง valid aโœ r' aโœยน motive_u


Running.intro.left
Spec.validate spec (env_r + r') aโœยฒ
spec: Spec

U, V: Type

mu: TaskM spec U

f: U โ†’ TaskM spec V

r: spec.Reservation

assuming: spec.State โ†’ Bool

motive: V โ†’ spec.Reservation โ†’ Prop

motive_u: U โ†’ spec.Reservation โ†’ Prop

f_valid: โˆ€ (r' : spec.Reservation) (u : U), motive_u u r' โ†’ valid (f u) r' (fun x => true) motive

env_r: spec.Reservation

s: spec.State

assuming_true: assuming s = true

initial_valid: Spec.validate spec (env_r + r) s

aโœยฒ: spec.State

aโœยน: spec.State โ†’ Bool

aโœ: TaskM spec U

iteration: iterate mu s = IterationResult.Running aโœยฒ aโœยน aโœ

r': spec.Reservation

mu_valid: Spec.validate spec (env_r + r') aโœยฒ โˆง valid aโœ r' aโœยน motive_u


Running.intro.right
valid (aโœ >>= f) r' aโœยน motive
spec: Spec

U, V: Type

mu: TaskM spec U

f: U โ†’ TaskM spec V

r: spec.Reservation

assuming: spec.State โ†’ Bool

motive: V โ†’ spec.Reservation โ†’ Prop

motive_u: U โ†’ spec.Reservation โ†’ Prop

f_valid: โˆ€ (r' : spec.Reservation) (u : U), motive_u u r' โ†’ valid (f u) r' (fun x => true) motive

env_r: spec.Reservation

s: spec.State

assuming_true: assuming s = true

initial_valid: Spec.validate spec (env_r + r) s

aโœยฒ: spec.State

aโœยน: spec.State โ†’ Bool

aโœ: TaskM spec U

iteration: iterate mu s = IterationResult.Running aโœยฒ aโœยน aโœ

r': spec.Reservation

mu_valid: Spec.validate spec (env_r + r') aโœยฒ โˆง valid aโœ r' aโœยน motive_u


Running.intro
Spec.validate spec (env_r + r') aโœยฒ โˆง valid (aโœ >>= f) r' aโœยน motive
spec: Spec

U, V: Type

mu: TaskM spec U

f: U โ†’ TaskM spec V

r: spec.Reservation

assuming: spec.State โ†’ Bool

motive: V โ†’ spec.Reservation โ†’ Prop

motive_u: U โ†’ spec.Reservation โ†’ Prop

f_valid: โˆ€ (r' : spec.Reservation) (u : U), motive_u u r' โ†’ valid (f u) r' (fun x => true) motive

env_r: spec.Reservation

s: spec.State

assuming_true: assuming s = true

initial_valid: Spec.validate spec (env_r + r) s

aโœยฒ: spec.State

aโœยน: spec.State โ†’ Bool

aโœ: TaskM spec U

iteration: iterate mu s = IterationResult.Running aโœยฒ aโœยน aโœ

r': spec.Reservation

mu_valid: Spec.validate spec (env_r + r') aโœยฒ โˆง valid aโœ r' aโœยน motive_u


Running.intro.left
Spec.validate spec (env_r + r') aโœยฒ
spec: Spec

U, V: Type

mu: TaskM spec U

f: U โ†’ TaskM spec V

r: spec.Reservation

assuming: spec.State โ†’ Bool

motive: V โ†’ spec.Reservation โ†’ Prop

motive_u: U โ†’ spec.Reservation โ†’ Prop

f_valid: โˆ€ (r' : spec.Reservation) (u : U), motive_u u r' โ†’ valid (f u) r' (fun x => true) motive

env_r: spec.Reservation

s: spec.State

assuming_true: assuming s = true

initial_valid: Spec.validate spec (env_r + r) s

aโœยฒ: spec.State

aโœยน: spec.State โ†’ Bool

aโœ: TaskM spec U

iteration: iterate mu s = IterationResult.Running aโœยฒ aโœยน aโœ

r': spec.Reservation

mu_valid: Spec.validate spec (env_r + r') aโœยฒ โˆง valid aโœ r' aโœยน motive_u


Running.intro.left
Spec.validate spec (env_r + r') aโœยฒ
spec: Spec

U, V: Type

mu: TaskM spec U

f: U โ†’ TaskM spec V

r: spec.Reservation

assuming: spec.State โ†’ Bool

motive: V โ†’ spec.Reservation โ†’ Prop

motive_u: U โ†’ spec.Reservation โ†’ Prop

f_valid: โˆ€ (r' : spec.Reservation) (u : U), motive_u u r' โ†’ valid (f u) r' (fun x => true) motive

env_r: spec.Reservation

s: spec.State

assuming_true: assuming s = true

initial_valid: Spec.validate spec (env_r + r) s

aโœยฒ: spec.State

aโœยน: spec.State โ†’ Bool

aโœ: TaskM spec U

iteration: iterate mu s = IterationResult.Running aโœยฒ aโœยน aโœ

r': spec.Reservation

mu_valid: Spec.validate spec (env_r + r') aโœยฒ โˆง valid aโœ r' aโœยน motive_u


Running.intro.right
valid (aโœ >>= f) r' aโœยน motive

Goals accomplished! ๐Ÿ™
spec: Spec

U, V: Type

mu: TaskM spec U

f: U โ†’ TaskM spec V

r: spec.Reservation

assuming: spec.State โ†’ Bool

motive: V โ†’ spec.Reservation โ†’ Prop

motive_u: U โ†’ spec.Reservation โ†’ Prop

f_valid: โˆ€ (r' : spec.Reservation) (u : U), motive_u u r' โ†’ valid (f u) r' (fun x => true) motive

env_r: spec.Reservation

s: spec.State

assuming_true: assuming s = true

initial_valid: Spec.validate spec (env_r + r) s

aโœยฒ: spec.State

aโœยน: spec.State โ†’ Bool

aโœ: TaskM spec U

iteration: iterate mu s = IterationResult.Running aโœยฒ aโœยน aโœ

r': spec.Reservation

mu_valid: Spec.validate spec (env_r + r') aโœยฒ โˆง valid aโœ r' aโœยน motive_u


Running.intro
Spec.validate spec (env_r + r') aโœยฒ โˆง valid (aโœ >>= f) r' aโœยน motive
spec: Spec

U, V: Type

mu: TaskM spec U

f: U โ†’ TaskM spec V

r: spec.Reservation

assuming: spec.State โ†’ Bool

motive: V โ†’ spec.Reservation โ†’ Prop

motive_u: U โ†’ spec.Reservation โ†’ Prop

f_valid: โˆ€ (r' : spec.Reservation) (u : U), motive_u u r' โ†’ valid (f u) r' (fun x => true) motive

env_r: spec.Reservation

s: spec.State

assuming_true: assuming s = true

initial_valid: Spec.validate spec (env_r + r) s

aโœยฒ: spec.State

aโœยน: spec.State โ†’ Bool

aโœ: TaskM spec U

iteration: iterate mu s = IterationResult.Running aโœยฒ aโœยน aโœ

r': spec.Reservation

mu_valid: Spec.validate spec (env_r + r') aโœยฒ โˆง valid aโœ r' aโœยน motive_u


Running.intro.right
valid (aโœ >>= f) r' aโœยน motive
spec: Spec

U, V: Type

mu: TaskM spec U

f: U โ†’ TaskM spec V

r: spec.Reservation

assuming: spec.State โ†’ Bool

motive: V โ†’ spec.Reservation โ†’ Prop

motive_u: U โ†’ spec.Reservation โ†’ Prop

f_valid: โˆ€ (r' : spec.Reservation) (u : U), motive_u u r' โ†’ valid (f u) r' (fun x => true) motive

env_r: spec.Reservation

s: spec.State

assuming_true: assuming s = true

initial_valid: Spec.validate spec (env_r + r) s

aโœยฒ: spec.State

aโœยน: spec.State โ†’ Bool

aโœ: TaskM spec U

iteration: iterate mu s = IterationResult.Running aโœยฒ aโœยน aโœ

r': spec.Reservation

mu_valid: Spec.validate spec (env_r + r') aโœยฒ โˆง valid aโœ r' aโœยน motive_u


Running.intro.right
valid (aโœ >>= f) r' aโœยน motive
spec: Spec

U, V: Type

mu: TaskM spec U

f: U โ†’ TaskM spec V

r: spec.Reservation

assuming: spec.State โ†’ Bool

motive: V โ†’ spec.Reservation โ†’ Prop

motive_u: U โ†’ spec.Reservation โ†’ Prop

f_valid: โˆ€ (r' : spec.Reservation) (u : U), motive_u u r' โ†’ valid (f u) r' (fun x => true) motive

env_r: spec.Reservation

s: spec.State

assuming_true: assuming s = true

initial_valid: Spec.validate spec (env_r + r) s

aโœยฒ: spec.State

aโœยน: spec.State โ†’ Bool

aโœ: TaskM spec U

iteration: iterate mu s = IterationResult.Running aโœยฒ aโœยน aโœ

r': spec.Reservation

mu_valid: Spec.validate spec (env_r + r') aโœยฒ โˆง valid aโœ r' aโœยน motive_u

this: is_direct_cont aโœ mu


Running.intro.right
valid (aโœ >>= f) r' aโœยน motive
spec: Spec

U, V: Type

mu: TaskM spec U

f: U โ†’ TaskM spec V

r: spec.Reservation

assuming: spec.State โ†’ Bool

motive: V โ†’ spec.Reservation โ†’ Prop

motive_u: U โ†’ spec.Reservation โ†’ Prop

f_valid: โˆ€ (r' : spec.Reservation) (u : U), motive_u u r' โ†’ valid (f u) r' (fun x => true) motive

env_r: spec.Reservation

s: spec.State

assuming_true: assuming s = true

initial_valid: Spec.validate spec (env_r + r) s

aโœยฒ: spec.State

aโœยน: spec.State โ†’ Bool

aโœ: TaskM spec U

iteration: iterate mu s = IterationResult.Running aโœยฒ aโœยน aโœ

r': spec.Reservation

mu_valid: Spec.validate spec (env_r + r') aโœยฒ โˆง valid aโœ r' aโœยน motive_u


Running.intro.right
valid (aโœ >>= f) r' aโœยน motive

Goals accomplished! ๐Ÿ™
termination_by valid_bind =>
mu: TaskM spec U
mu
theorem
valid_rmr: โˆ€ {T : Type} {f : spec.State โ†’ T ร— spec.State} {r : spec.Reservation} {assuming : spec.State โ†’ Bool} {motive : T โ†’ spec.Reservation โ†’ Prop}, (โˆ€ (env_r : spec.Reservation) (s : spec.State), assuming s = true โ†’ Spec.validate spec (env_r + r) s โ†’ โˆƒ r', let _discr := f s; match f s with | (t, s') => Spec.validate spec (env_r + r') s' โˆง motive t r') โ†’ valid (atomic_read_modify_read f) r assuming motive
valid_rmr
{
T: Type
T
:
Type: Type 1
Type
} {
f: spec.State โ†’ T ร— spec.State
f
:
spec: Spec
spec
.
State: Spec โ†’ Type
State
->
T: Type
T
ร—
spec: Spec
spec
.
State: Spec โ†’ Type
State
} {
r: ?m.6607
r
assuming: spec.State โ†’ Bool
assuming
motive: T โ†’ spec.Reservation โ†’ Prop
motive
} (
f_valid: โˆ€ (env_r : spec.Reservation) (s : spec.State), ?m.6797 env_r s โ†’ Spec.validate spec (env_r + r) s โ†’ โˆƒ r', let _discr := f s; match f s with | (t, s') => Spec.validate spec (env_r + r') s' โˆง ?m.6798 env_r s r' t s'
f_valid
: โˆ€
env_r: ?m.6617
env_r
s: ?m.6620
s
,
assuming: ?m.6610
assuming
s: ?m.6620
s
โ†’
spec: Spec
spec
.
validate: (self : Spec) โ†’ self.Reservation โ†’ self.State โ†’ Prop
validate
(
env_r: ?m.6617
env_r
+
r: ?m.6607
r
)
s: ?m.6620
s
โ†’ โˆƒ
r': spec.Reservation
r'
:
spec: Spec
spec
.
Reservation: Spec โ†’ Type
Reservation
, match
f: spec.State โ†’ T ร— spec.State
f
s: ?m.6620
s
with | โŸจ
t: T
t
,
s': spec.State
s'
โŸฉ =>
spec: Spec
spec
.
validate: (self : Spec) โ†’ self.Reservation โ†’ self.State โ†’ Prop
validate
(
env_r: ?m.6617
env_r
+
r': spec.Reservation
r'
)
s': spec.State
s'
โˆง
motive: ?m.6613
motive
t: T
t
r': spec.Reservation
r'
) : (
atomic_read_modify_read: {spec : Spec} โ†’ {T : Type} โ†’ (spec.State โ†’ T ร— spec.State) โ†’ TaskM spec T
atomic_read_modify_read
f: spec.State โ†’ T ร— spec.State
f
).
valid: {spec : Spec} โ†’ {T : Type} โ†’ TaskM spec T โ†’ spec.Reservation โ†’ (spec.State โ†’ Bool) โ†’ (T โ†’ spec.Reservation โ†’ Prop) โ†’ Prop
valid
r: ?m.6607
r
assuming: ?m.6610
assuming
motive: ?m.6613
motive
:=
spec: Spec

T: Type

f: spec.State โ†’ T ร— spec.State

r: spec.Reservation

assuming: spec.State โ†’ Bool

motive: T โ†’ spec.Reservation โ†’ Prop

f_valid: โˆ€ (env_r : spec.Reservation) (s : spec.State), assuming s = true โ†’ Spec.validate spec (env_r + r) s โ†’ โˆƒ r', let _discr := f s; match f s with | (t, s') => Spec.validate spec (env_r + r') s' โˆง motive t r'


valid (atomic_read_modify_read f) r assuming motive
spec: Spec

T: Type

f: spec.State โ†’ T ร— spec.State

r: spec.Reservation

assuming: spec.State โ†’ Bool

motive: T โ†’ spec.Reservation โ†’ Prop

f_valid: โˆ€ (env_r : spec.Reservation) (s : spec.State), assuming s = true โ†’ Spec.validate spec (env_r + r) s โ†’ โˆƒ r', let _discr := f s; match f s with | (t, s') => Spec.validate spec (env_r + r') s' โˆง motive t r'


valid (atomic_read_modify_read f) r assuming motive
spec: Spec

T: Type

f: spec.State โ†’ T ร— spec.State

r: spec.Reservation

assuming: spec.State โ†’ Bool

motive: T โ†’ spec.Reservation โ†’ Prop

f_valid: โˆ€ (env_r : spec.Reservation) (s : spec.State), assuming s = true โ†’ Spec.validate spec (env_r + r) s โ†’ โˆƒ r', let _discr := f s; match f s with | (t, s') => Spec.validate spec (env_r + r') s' โˆง motive t r'


โˆ€ (env_r : spec.Reservation) (s : spec.State), assuming s = true โ†’ Spec.validate spec (env_r + r) s โ†’ โˆƒ r', match h : iterate (atomic_read_modify_read f) s with | IterationResult.Done s' t => Spec.validate spec (env_r + r') s' โˆง motive t r' | IterationResult.Panic a a_1 => False | IterationResult.Running s' block_until cont => Spec.validate spec (env_r + r') s' โˆง valid cont r' block_until motive
spec: Spec

T: Type

f: spec.State โ†’ T ร— spec.State

r: spec.Reservation

assuming: spec.State โ†’ Bool

motive: T โ†’ spec.Reservation โ†’ Prop

f_valid: โˆ€ (env_r : spec.Reservation) (s : spec.State), assuming s = true โ†’ Spec.validate spec (env_r + r) s โ†’ โˆƒ r', let _discr := f s; match f s with | (t, s') => Spec.validate spec (env_r + r') s' โˆง motive t r'


โˆ€ (env_r : spec.Reservation) (s : spec.State), assuming s = true โ†’ Spec.validate spec (env_r + r) s โ†’ โˆƒ r', match h : iterate (atomic_read_modify_read f) s with | IterationResult.Done s' t => Spec.validate spec (env_r + r') s' โˆง motive t r' | IterationResult.Panic a a_1 => False | IterationResult.Running s' block_until cont => Spec.validate spec (env_r + r') s' โˆง valid cont r' block_until motive
spec: Spec

T: Type

f: spec.State โ†’ T ร— spec.State

r: spec.Reservation

assuming: spec.State โ†’ Bool

motive: T โ†’ spec.Reservation โ†’ Prop

f_valid: โˆ€ (env_r : spec.Reservation) (s : spec.State), assuming s = true โ†’ Spec.validate spec (env_r + r) s โ†’ โˆƒ r', let _discr := f s; match f s with | (t, s') => Spec.validate spec (env_r + r') s' โˆง motive t r'


valid (atomic_read_modify_read f) r assuming motive
spec: Spec

T: Type

f: spec.State โ†’ T ร— spec.State

r: spec.Reservation

assuming: spec.State โ†’ Bool

motive: T โ†’ spec.Reservation โ†’ Prop

f_valid: โˆ€ (env_r : spec.Reservation) (s : spec.State), assuming s = true โ†’ Spec.validate spec (env_r + r) s โ†’ โˆƒ r', let _discr := f s; match f s with | (t, s') => Spec.validate spec (env_r + r') s' โˆง motive t r'

env_r: spec.Reservation

s: spec.State

assuming_true: assuming s = true

initial_valid: Spec.validate spec (env_r + r) s


โˆƒ r', match h : iterate (atomic_read_modify_read f) s with | IterationResult.Done s' t => Spec.validate spec (env_r + r') s' โˆง motive t r' | IterationResult.Panic a a_1 => False | IterationResult.Running s' block_until cont => Spec.validate spec (env_r + r') s' โˆง valid cont r' block_until motive
spec: Spec

T: Type

f: spec.State โ†’ T ร— spec.State

r: spec.Reservation

assuming: spec.State โ†’ Bool

motive: T โ†’ spec.Reservation โ†’ Prop

f_valid: โˆ€ (env_r : spec.Reservation) (s : spec.State), assuming s = true โ†’ Spec.validate spec (env_r + r) s โ†’ โˆƒ r', let _discr := f s; match f s with | (t, s') => Spec.validate spec (env_r + r') s' โˆง motive t r'


valid (atomic_read_modify_read f) r assuming motive
spec: Spec

T: Type

f: spec.State โ†’ T ร— spec.State

r: spec.Reservation

assuming: spec.State โ†’ Bool

motive: T โ†’ spec.Reservation โ†’ Prop

f_valid: โˆ€ (env_r : spec.Reservation) (s : spec.State), assuming s = true โ†’ Spec.validate spec (env_r + r) s โ†’ โˆƒ r', let _discr := f s; match f s with | (t, s') => Spec.validate spec (env_r + r') s' โˆง motive t r'

env_r: spec.Reservation

s: spec.State

assuming_true: assuming s = true

initial_valid: Spec.validate spec (env_r + r) s


โˆƒ r', match h : iterate (atomic_read_modify_read f) s with | IterationResult.Done s' t => Spec.validate spec (env_r + r') s' โˆง motive t r' | IterationResult.Panic a a_1 => False | IterationResult.Running s' block_until cont => Spec.validate spec (env_r + r') s' โˆง valid cont r' block_until motive
spec: Spec

T: Type

f: spec.State โ†’ T ร— spec.State

r: spec.Reservation

assuming: spec.State โ†’ Bool

motive: T โ†’ spec.Reservation โ†’ Prop

f_valid: โˆ€ (env_r : spec.Reservation) (s : spec.State), assuming s = true โ†’ Spec.validate spec (env_r + r) s โ†’ โˆƒ r', let _discr := f s; match f s with | (t, s') => Spec.validate spec (env_r + r') s' โˆง motive t r'

env_r: spec.Reservation

s: spec.State

assuming_true: assuming s = true

initial_valid: Spec.validate spec (env_r + r) s


โˆƒ r', match h : let _discr := f s; match f s with | (t, s') => IterationResult.Done s' t with | IterationResult.Done s' t => Spec.validate spec (env_r + r') s' โˆง motive t r' | IterationResult.Panic a a_1 => False | IterationResult.Running s' block_until cont => Spec.validate spec (env_r + r') s' โˆง valid cont r' block_until motive
spec: Spec

T: Type

f: spec.State โ†’ T ร— spec.State

r: spec.Reservation

assuming: spec.State โ†’ Bool

motive: T โ†’ spec.Reservation โ†’ Prop

f_valid: โˆ€ (env_r : spec.Reservation) (s : spec.State), assuming s = true โ†’ Spec.validate spec (env_r + r) s โ†’ โˆƒ r', let _discr := f s; match f s with | (t, s') => Spec.validate spec (env_r + r') s' โˆง motive t r'

env_r: spec.Reservation

s: spec.State

assuming_true: assuming s = true

initial_valid: Spec.validate spec (env_r + r) s


โˆƒ r', match h : let _discr := f s; match f s with | (t, s') => IterationResult.Done s' t with | IterationResult.Done s' t => Spec.validate spec (env_r + r') s' โˆง motive t r' | IterationResult.Panic a a_1 => False | IterationResult.Running s' block_until cont => Spec.validate spec (env_r + r') s' โˆง valid cont r' block_until motive
spec: Spec

T: Type

f: spec.State โ†’ T ร— spec.State

r: spec.Reservation

assuming: spec.State โ†’ Bool

motive: T โ†’ spec.Reservation โ†’ Prop

f_valid: โˆ€ (env_r : spec.Reservation) (s : spec.State), assuming s = true โ†’ Spec.validate spec (env_r + r) s โ†’ โˆƒ r', let _discr := f s; match f s with | (t, s') => Spec.validate spec (env_r + r') s' โˆง motive t r'


valid (atomic_read_modify_read f) r assuming motive

Goals accomplished! ๐Ÿ™
theorem
valid_rm: โˆ€ {f : spec.State โ†’ spec.State} {r : spec.Reservation} {assuming : spec.State โ†’ Bool} {motive : Unit โ†’ spec.Reservation โ†’ Prop}, (โˆ€ (env_r : spec.Reservation) (s : spec.State), assuming s = true โ†’ Spec.validate spec (env_r + r) s โ†’ โˆƒ r', let s' := f s; Spec.validate spec (env_r + r') s' โˆง motive PUnit.unit r') โ†’ valid (atomic_read_modify f) r assuming motive
valid_rm
{
f: spec.State โ†’ spec.State
f
:
spec: Spec
spec
.
State: Spec โ†’ Type
State
->
spec: Spec
spec
.
State: Spec โ†’ Type
State
} {
r: spec.Reservation
r
assuming: spec.State โ†’ Bool
assuming
motive: Unit โ†’ spec.Reservation โ†’ Prop
motive
} (
f_valid: โˆ€ (env_r : spec.Reservation) (s : spec.State), ?m.7259 env_r s โ†’ Spec.validate spec (env_r + r) s โ†’ โˆƒ r', let s' := f s; Spec.validate spec (env_r + r') s' โˆง ?m.7260 env_r s r' s'
f_valid
: โˆ€
env_r: ?m.7167
env_r
s: ?m.7170
s
,
assuming: ?m.7160
assuming
s: ?m.7170
s
โ†’
spec: Spec
spec
.
validate: (self : Spec) โ†’ self.Reservation โ†’ self.State โ†’ Prop
validate
(
env_r: ?m.7167
env_r
+
r: ?m.7157
r
)
s: ?m.7170
s
โ†’ โˆƒ
r': spec.Reservation
r'
:
spec: Spec
spec
.
Reservation: Spec โ†’ Type
Reservation
, match
f: spec.State โ†’ spec.State
f
s: ?m.7170
s
with |
s': ?m.7226
s'
=>
spec: Spec
spec
.
validate: (self : Spec) โ†’ self.Reservation โ†’ self.State โ†’ Prop
validate
(
env_r: ?m.7167
env_r
+
r': spec.Reservation
r'
)
s': ?m.7226
s'
โˆง
motive: ?m.7163
motive
โŸจโŸฉ: PUnit
โŸจโŸฉ
r': spec.Reservation
r'
) : (
atomic_read_modify: {spec : Spec} โ†’ (spec.State โ†’ spec.State) โ†’ TaskM spec Unit
atomic_read_modify
f: spec.State โ†’ spec.State
f
).
valid: {spec : Spec} โ†’ {T : Type} โ†’ TaskM spec T โ†’ spec.Reservation โ†’ (spec.State โ†’ Bool) โ†’ (T โ†’ spec.Reservation โ†’ Prop) โ†’ Prop
valid
r: ?m.7157
r
assuming: ?m.7160
assuming
motive: ?m.7163
motive
:=
valid_rmr: โˆ€ {spec : Spec} {T : Type} {f : spec.State โ†’ T ร— spec.State} {r : spec.Reservation} {assuming : spec.State โ†’ Bool} {motive : T โ†’ spec.Reservation โ†’ Prop}, (โˆ€ (env_r : spec.Reservation) (s : spec.State), assuming s = true โ†’ Spec.validate spec (env_r + r) s โ†’ โˆƒ r', let _discr := f s; match f s with | (t, s') => Spec.validate spec (env_r + r') s' โˆง motive t r') โ†’ valid (atomic_read_modify_read f) r assuming motive
valid_rmr
f_valid: โˆ€ (env_r : spec.Reservation) (s : spec.State), assuming s = true โ†’ Spec.validate spec (env_r + r) s โ†’ โˆƒ r', let s' := f s; Spec.validate spec (env_r + r') s' โˆง motive PUnit.unit r'
f_valid
theorem
valid_read: โˆ€ {T : Type} {f : spec.State โ†’ T} {r : spec.Reservation} {assuming : spec.State โ†’ Bool} {motive : T โ†’ spec.Reservation โ†’ Prop}, (โˆ€ (env_r : spec.Reservation) (s : spec.State), assuming s = true โ†’ Spec.validate spec (env_r + r) s โ†’ โˆƒ r', let t := f s; Spec.validate spec (env_r + r') s โˆง motive t r') โ†’ valid (atomic_read f) r assuming motive
valid_read
{
f: spec.State โ†’ T
f
:
spec: Spec
spec
.
State: Spec โ†’ Type
State
->
T: ?m.7474
T
} {
r: ?m.7481
r
assuming: spec.State โ†’ Bool
assuming
motive: T โ†’ spec.Reservation โ†’ Prop
motive
} (
f_valid: โˆ€ (env_r : spec.Reservation) (s : spec.State), assuming s = true โ†’ Spec.validate spec (env_r + r) s โ†’ โˆƒ r', let t := f s; Spec.validate spec (env_r + r') s โˆง motive t r'
f_valid
: โˆ€
env_r: ?m.7491
env_r
s: ?m.7494
s
,
assuming: ?m.7484
assuming
s: ?m.7494
s
โ†’
spec: Spec
spec
.
validate: (self : Spec) โ†’ self.Reservation โ†’ self.State โ†’ Prop
validate
(
env_r: ?m.7491
env_r
+
r: ?m.7481
r
)
s: ?m.7494
s
โ†’ โˆƒ
r': spec.Reservation
r'
:
spec: Spec
spec
.
Reservation: Spec โ†’ Type
Reservation
, match
f: spec.State โ†’ T
f
s: ?m.7494
s
with |
t: ?m.7550
t
=>
spec: Spec
spec
.
validate: (self : Spec) โ†’ self.Reservation โ†’ self.State โ†’ Prop
validate
(
env_r: ?m.7491
env_r
+
r': spec.Reservation
r'
)
s: ?m.7494
s
โˆง
motive: ?m.7487
motive
t: ?m.7550
t
r': spec.Reservation
r'
) : (
atomic_read: {spec : Spec} โ†’ {T : Type} โ†’ (spec.State โ†’ T) โ†’ TaskM spec T
atomic_read
f: spec.State โ†’ T
f
).
valid: {spec : Spec} โ†’ {T : Type} โ†’ TaskM spec T โ†’ spec.Reservation โ†’ (spec.State โ†’ Bool) โ†’ (T โ†’ spec.Reservation โ†’ Prop) โ†’ Prop
valid
r: ?m.7481
r
assuming: ?m.7484
assuming
motive: ?m.7487
motive
:=
valid_rmr: โˆ€ {spec : Spec} {T : Type} {f : spec.State โ†’ T ร— spec.State} {r : spec.Reservation} {assuming : spec.State โ†’ Bool} {motive : T โ†’ spec.Reservation โ†’ Prop}, (โˆ€ (env_r : spec.Reservation) (s : spec.State), assuming s = true โ†’ Spec.validate spec (env_r + r) s โ†’ โˆƒ r', let _discr := f s; match f s with | (t, s') => Spec.validate spec (env_r + r') s' โˆง motive t r') โ†’ valid (atomic_read_modify_read f) r assuming motive
valid_rmr
f_valid: โˆ€ (env_r : spec.Reservation) (s : spec.State), assuming s = true โ†’ Spec.validate spec (env_r + r) s โ†’ โˆƒ r', let t := f s; Spec.validate spec (env_r + r') s โˆง motive t r'
f_valid
theorem
valid_assert: โˆ€ {cond : spec.State โ†’ Bool} {r : spec.Reservation} {assuming : spec.State โ†’ Bool} {motive : Unit โ†’ spec.Reservation โ†’ Prop}, motive PUnit.unit r โ†’ (โˆ€ (env_r : spec.Reservation) (s : spec.State), assuming s = true โ†’ Spec.validate spec (env_r + r) s โ†’ cond s = true) โ†’ valid (atomic_assert cond) r assuming motive
valid_assert
{
cond: spec.State โ†’ Bool
cond
:
spec: Spec
spec
.
State: Spec โ†’ Type
State
->
Bool: Type
Bool
} {
r: ?m.7801
r
assuming: spec.State โ†’ Bool
assuming
motive: Unit โ†’ spec.Reservation โ†’ Prop
motive
} (
motive_holds: ?m.7810
motive_holds
:
motive: ?m.7807
motive
โŸจโŸฉ: PUnit
โŸจโŸฉ
r: ?m.7801
r
) (
assertion_succeeds: โˆ€ (env_r : spec.Reservation) (s : spec.State), assuming s = true โ†’ Spec.validate spec (env_r + r) s โ†’ cond s = true
assertion_succeeds
: โˆ€
env_r: ?m.7814
env_r
s: ?m.7817
s
,
assuming: ?m.7804
assuming
s: ?m.7817
s
โ†’
spec: Spec
spec
.
validate: (self : Spec) โ†’ self.Reservation โ†’ self.State โ†’ Prop
validate
(
env_r: ?m.7814
env_r
+
r: ?m.7801
r
)
s: ?m.7817
s
โ†’
cond: spec.State โ†’ Bool
cond
s: ?m.7817
s
) : (
atomic_assert: {spec : Spec} โ†’ (spec.State โ†’ Bool) โ†’ TaskM spec Unit
atomic_assert
cond: spec.State โ†’ Bool
cond
).
valid: {spec : Spec} โ†’ {T : Type} โ†’ TaskM spec T โ†’ spec.Reservation โ†’ (spec.State โ†’ Bool) โ†’ (T โ†’ spec.Reservation โ†’ Prop) โ†’ Prop
valid
r: ?m.7801
r
assuming: ?m.7804
assuming
motive: ?m.7807
motive
:=
spec: Spec

cond: spec.State โ†’ Bool

r: spec.Reservation

assuming: spec.State โ†’ Bool

motive: Unit โ†’ spec.Reservation โ†’ Prop

motive_holds: motive PUnit.unit r

assertion_succeeds: โˆ€ (env_r : spec.Reservation) (s : spec.State), assuming s = true โ†’ Spec.validate spec (env_r + r) s โ†’ cond s = true


valid (atomic_assert cond) r assuming motive
spec: Spec

cond: spec.State โ†’ Bool

r: spec.Reservation

assuming: spec.State โ†’ Bool

motive: Unit โ†’ spec.Reservation โ†’ Prop

motive_holds: motive PUnit.unit r

assertion_succeeds: โˆ€ (env_r : spec.Reservation) (s : spec.State), assuming s = true โ†’ Spec.validate spec (env_r + r) s โ†’ cond s = true


valid (atomic_assert cond) r assuming motive
spec: Spec

cond: spec.State โ†’ Bool

r: spec.Reservation

assuming: spec.State โ†’ Bool

motive: Unit โ†’ spec.Reservation โ†’ Prop

motive_holds: motive PUnit.unit r

assertion_succeeds: โˆ€ (env_r : spec.Reservation) (s : spec.State), assuming s = true โ†’ Spec.validate spec (env_r + r) s โ†’ cond s = true


โˆ€ (env_r : spec.Reservation) (s : spec.State), assuming s = true โ†’ Spec.validate spec (env_r + r) s โ†’ โˆƒ r', match h : iterate (atomic_assert cond) s with | IterationResult.Done s' t => Spec.validate spec (env_r + r') s' โˆง motive t r' | IterationResult.Panic a a_1 => False | IterationResult.Running s' block_until cont => Spec.validate spec (env_r + r') s' โˆง valid cont r' block_until motive
spec: Spec

cond: spec.State โ†’ Bool

r: spec.Reservation

assuming: spec.State โ†’ Bool

motive: Unit โ†’ spec.Reservation โ†’ Prop

motive_holds: motive PUnit.unit r

assertion_succeeds: โˆ€ (env_r : spec.Reservation) (s : spec.State), assuming s = true โ†’ Spec.validate spec (env_r + r) s โ†’ cond s = true


โˆ€ (env_r : spec.Reservation) (s : spec.State), assuming s = true โ†’ Spec.validate spec (env_r + r) s โ†’ โˆƒ r', match h : iterate (atomic_assert cond) s with | IterationResult.Done s' t => Spec.validate spec (env_r + r') s' โˆง motive t r' | IterationResult.Panic a a_1 => False | IterationResult.Running s' block_until cont => Spec.validate spec (env_r + r') s' โˆง valid cont r' block_until motive
spec: Spec

cond: spec.State โ†’ Bool

r: spec.Reservation

assuming: spec.State โ†’ Bool

motive: Unit โ†’ spec.Reservation โ†’ Prop

motive_holds: motive PUnit.unit r

assertion_succeeds: โˆ€ (env_r : spec.Reservation) (s : spec.State), assuming s = true โ†’ Spec.validate spec (env_r + r) s โ†’ cond s = true


valid (atomic_assert cond) r assuming motive
spec: Spec

cond: spec.State โ†’ Bool

r: spec.Reservation

assuming: spec.State โ†’ Bool

motive: Unit โ†’ spec.Reservation โ†’ Prop

motive_holds: motive PUnit.unit r

assertion_succeeds: โˆ€ (env_r : spec.Reservation) (s : spec.State), assuming s = true โ†’ Spec.validate spec (env_r + r) s โ†’ cond s = true

env_r: spec.Reservation

s: spec.State

assuming_true: assuming s = true

initial_valid: Spec.validate spec (env_r + r) s


โˆƒ r', match h : iterate (atomic_assert cond) s with | IterationResult.Done s' t => Spec.validate spec (env_r + r') s' โˆง motive t r' | IterationResult.Panic a a_1 => False | IterationResult.Running s' block_until cont => Spec.validate spec (env_r + r') s' โˆง valid cont r' block_until motive
spec: Spec

cond: spec.State โ†’ Bool

r: spec.Reservation

assuming: spec.State โ†’ Bool

motive: Unit โ†’ spec.Reservation โ†’ Prop

motive_holds: motive PUnit.unit r

assertion_succeeds: โˆ€ (env_r : spec.Reservation) (s : spec.State), assuming s = true โ†’ Spec.validate spec (env_r + r) s โ†’ cond s = true


valid (atomic_assert cond) r assuming motive
spec: Spec

cond: spec.State โ†’ Bool

r: spec.Reservation

assuming: spec.State โ†’ Bool

motive: Unit โ†’ spec.Reservation โ†’ Prop

motive_holds: motive PUnit.unit r

assertion_succeeds: โˆ€ (env_r : spec.Reservation) (s : spec.State), assuming s = true โ†’ Spec.validate spec (env_r + r) s โ†’ cond s = true

env_r: spec.Reservation

s: spec.State

assuming_true: assuming s = true

initial_valid: Spec.validate spec (env_r + r) s


โˆƒ r', match h : iterate (atomic_assert cond) s with | IterationResult.Done s' t => Spec.validate spec (env_r + r') s' โˆง motive t r' | IterationResult.Panic a a_1 => False | IterationResult.Running s' block_until cont => Spec.validate spec (env_r + r') s' โˆง valid cont r' block_until motive
spec: Spec

cond: spec.State โ†’ Bool

r: spec.Reservation

assuming: spec.State โ†’ Bool

motive: Unit โ†’ spec.Reservation โ†’ Prop

motive_holds: motive PUnit.unit r

assertion_succeeds: โˆ€ (env_r : spec.Reservation) (s : spec.State), assuming s = true โ†’ Spec.validate spec (env_r + r) s โ†’ cond s = true

env_r: spec.Reservation

s: spec.State

assuming_true: assuming s = true

initial_valid: Spec.validate spec (env_r + r) s


โˆƒ r', match h : if cond s = true then IterationResult.Done s PUnit.unit else IterationResult.Panic s "Assertion failed" with | IterationResult.Done s' t => Spec.validate spec (env_r + r') s' โˆง motive t r' | IterationResult.Panic a a_1 => False | IterationResult.Running s' block_until cont => Spec.validate spec (env_r + r') s' โˆง valid cont r' block_until motive
spec: Spec

cond: spec.State โ†’ Bool

r: spec.Reservation

assuming: spec.State โ†’ Bool

motive: Unit โ†’ spec.Reservation โ†’ Prop

motive_holds: motive PUnit.unit r

assertion_succeeds: โˆ€ (env_r : spec.Reservation) (s : spec.State), assuming s = true โ†’ Spec.validate spec (env_r + r) s โ†’ cond s = true

env_r: spec.Reservation

s: spec.State

assuming_true: assuming s = true

initial_valid: Spec.validate spec (env_r + r) s


โˆƒ r', match h : if cond s = true then IterationResult.Done s PUnit.unit else IterationResult.Panic s "Assertion failed" with | IterationResult.Done s' t => Spec.validate spec (env_r + r') s' โˆง motive t r' | IterationResult.Panic a a_1 => False | IterationResult.Running s' block_until cont => Spec.validate spec (env_r + r') s' โˆง valid cont r' block_until motive
spec: Spec

cond: spec.State โ†’ Bool

r: spec.Reservation

assuming: spec.State โ†’ Bool

motive: Unit โ†’ spec.Reservation โ†’ Prop

motive_holds: motive PUnit.unit r

assertion_succeeds: โˆ€ (env_r : spec.Reservation) (s : spec.State), assuming s = true โ†’ Spec.validate spec (env_r + r) s โ†’ cond s = true


valid (atomic_assert cond) r assuming motive
spec: Spec

cond: spec.State โ†’ Bool

r: spec.Reservation

assuming: spec.State โ†’ Bool

motive: Unit โ†’ spec.Reservation โ†’ Prop

motive_holds: motive PUnit.unit r

assertion_succeeds: โˆ€ (env_r : spec.Reservation) (s : spec.State), assuming s = true โ†’ Spec.validate spec (env_r + r) s โ†’ cond s = true

env_r: spec.Reservation

s: spec.State

assuming_true: assuming s = true

initial_valid: Spec.validate spec (env_r + r) s

cond_true: cond s = true


โˆƒ r', match h : if cond s = true then IterationResult.Done s PUnit.unit else IterationResult.Panic s "Assertion failed" with | IterationResult.Done s' t => Spec.validate spec (env_r + r') s' โˆง motive t r' | IterationResult.Panic a a_1 => False | IterationResult.Running s' block_until cont => Spec.validate spec (env_r + r') s' โˆง valid cont r' block_until motive
spec: Spec

cond: spec.State โ†’ Bool

r: spec.Reservation

assuming: spec.State โ†’ Bool

motive: Unit โ†’ spec.Reservation โ†’ Prop

motive_holds: motive PUnit.unit r

assertion_succeeds: โˆ€ (env_r : spec.Reservation) (s : spec.State), assuming s = true โ†’ Spec.validate spec (env_r + r) s โ†’ cond s = true


valid (atomic_assert cond) r assuming motive
spec: Spec

cond: spec.State โ†’ Bool

r: spec.Reservation

assuming: spec.State โ†’ Bool

motive: Unit โ†’ spec.Reservation โ†’ Prop

motive_holds: motive PUnit.unit r

assertion_succeeds: โˆ€ (env_r : spec.Reservation) (s : spec.State), assuming s = true โ†’ Spec.validate spec (env_r + r) s โ†’ cond s = true

env_r: spec.Reservation

s: spec.State

assuming_true: assuming s = true

initial_valid: Spec.validate spec (env_r + r) s

cond_true: cond s = true


โˆƒ r', match h : if cond s = true then IterationResult.Done s PUnit.unit else IterationResult.Panic s "Assertion failed" with | IterationResult.Done s' t => Spec.validate spec (env_r + r') s' โˆง motive t r' | IterationResult.Panic a a_1 => False | IterationResult.Running s' block_until cont => Spec.validate spec (env_r + r') s' โˆง valid cont r' block_until motive
spec: Spec

cond: spec.State โ†’ Bool

r: spec.Reservation

assuming: spec.State โ†’ Bool

motive: Unit โ†’ spec.Reservation โ†’ Prop

motive_holds: motive PUnit.unit r

assertion_succeeds: โˆ€ (env_r : spec.Reservation) (s : spec.State), assuming s = true โ†’ Spec.validate spec (env_r + r) s โ†’ cond s = true

env_r: spec.Reservation

s: spec.State

assuming_true: assuming s = true

initial_valid: Spec.validate spec (env_r + r) s

cond_true: cond s = true


โˆƒ r', match h : if true = true then IterationResult.Done s PUnit.unit else IterationResult.Panic s "Assertion failed" with | IterationResult.Done s' t => Spec.validate spec (env_r + r') s' โˆง motive t r' | IterationResult.Panic a a_1 => False | IterationResult.Running s' block_until cont => Spec.validate spec (env_r + r') s' โˆง valid cont r' block_until motive
spec: Spec

cond: spec.State โ†’ Bool

r: spec.Reservation

assuming: spec.State โ†’ Bool

motive: Unit โ†’ spec.Reservation โ†’ Prop

motive_holds: motive PUnit.unit r

assertion_succeeds: โˆ€ (env_r : spec.Reservation) (s : spec.State), assuming s = true โ†’ Spec.validate spec (env_r + r) s โ†’ cond s = true

env_r: spec.Reservation

s: spec.State

assuming_true: assuming s = true

initial_valid: Spec.validate spec (env_r + r) s

cond_true: cond s = true


โˆƒ r', match h : if true = true then IterationResult.Done s PUnit.unit else IterationResult.Panic s "Assertion failed" with | IterationResult.Done s' t => Spec.validate spec (env_r + r') s' โˆง motive t r' | IterationResult.Panic a a_1 => False | IterationResult.Running s' block_until cont => Spec.validate spec (env_r + r') s' โˆง valid cont r' block_until motive
spec: Spec

cond: spec.State โ†’ Bool

r: spec.Reservation

assuming: spec.State โ†’ Bool

motive: Unit โ†’ spec.Reservation โ†’ Prop

motive_holds: motive PUnit.unit r

assertion_succeeds: โˆ€ (env_r : spec.Reservation) (s : spec.State), assuming s = true โ†’ Spec.validate spec (env_r + r) s โ†’ cond s = true


valid (atomic_assert cond) r assuming motive

Goals accomplished! ๐Ÿ™
theorem
valid_blocking_rmr: โˆ€ {spec : Spec} {T : Type} {block_until : spec.State โ†’ Bool} {f : spec.State โ†’ T ร— spec.State} {r : spec.Reservation} {assuming : spec.State โ†’ Bool} {motive : T โ†’ spec.Reservation โ†’ Prop}, (โˆ€ (env_r : spec.Reservation) (s : spec.State), block_until s = true โ†’ Spec.validate spec (env_r + r) s โ†’ โˆƒ r', let _discr := f s; match f s with | (t, s') => Spec.validate spec (env_r + r') s' โˆง motive t r') โ†’ valid (atomic_blocking_rmr block_until f) r assuming motive
valid_blocking_rmr
{
block_until: spec.State โ†’ Bool
block_until
:
spec: Spec
spec
.
State: Spec โ†’ Type
State
->
Bool: Type
Bool
} {
f: spec.State โ†’ T ร— spec.State
f
:
spec: Spec
spec
.
State: Spec โ†’ Type
State
->
T: ?m.8336
T
ร—
spec: Spec
spec
.
State: Spec โ†’ Type
State
} {
r: ?m.8349
r
assuming: spec.State โ†’ Bool
assuming
motive: T โ†’ spec.Reservation โ†’ Prop
motive
} (
f_valid: โˆ€ (env_r : spec.Reservation) (s : spec.State), block_until s = true โ†’ Spec.validate spec (env_r + r) s โ†’ โˆƒ r', let _discr := f s; match f s with | (t, s') => Spec.validate spec (env_r + r') s' โˆง motive t r'
f_valid
: โˆ€
env_r: ?m.8359
env_r
s: ?m.8362
s
,
block_until: spec.State โ†’ Bool
block_until
s: ?m.8362
s
โ†’
spec: Spec
spec
.
validate: (self : Spec) โ†’ self.Reservation โ†’ self.State โ†’ Prop
validate
(
env_r: ?m.8359
env_r
+
r: ?m.8349
r
)
s: ?m.8362
s
โ†’ โˆƒ
r': spec.Reservation
r'
:
spec: Spec
spec
.
Reservation: Spec โ†’ Type
Reservation
, match
f: spec.State โ†’ T ร— spec.State
f
s: ?m.8362
s
with | โŸจ
t: T
t
,
s': spec.State
s'
โŸฉ =>
spec: Spec
spec
.
validate: (self : Spec) โ†’ self.Reservation โ†’ self.State โ†’ Prop
validate
(
env_r: ?m.8359
env_r
+
r': spec.Reservation
r'
)
s': spec.State
s'
โˆง
motive: ?m.8355
motive
t: T
t
r': spec.Reservation
r'
) : (
atomic_blocking_rmr: {spec : Spec} โ†’ {T : Type} โ†’ (spec.State โ†’ Bool) โ†’ (spec.State โ†’ T ร— spec.State) โ†’ TaskM spec T
atomic_blocking_rmr
block_until: spec.State โ†’ Bool
block_until
f: spec.State โ†’ T ร— spec.State
f
).
valid: {spec : Spec} โ†’ {T : Type} โ†’ TaskM spec T โ†’ spec.Reservation โ†’ (spec.State โ†’ Bool) โ†’ (T โ†’ spec.Reservation โ†’ Prop) โ†’ Prop
valid
r: ?m.8349
r
assuming: ?m.8352
assuming
motive: ?m.8355
motive
:=
spec: Spec

T: Type

block_until: spec.State โ†’ Bool

f: spec.State โ†’ T ร— spec.State

r: spec.Reservation

assuming: spec.State โ†’ Bool

motive: T โ†’ spec.Reservation โ†’ Prop

f_valid: โˆ€ (env_r : spec.Reservation) (s : spec.State), block_until s = true โ†’ Spec.validate spec (env_r + r) s โ†’ โˆƒ r', let _discr := f s; match f s with | (t, s') => Spec.validate spec (env_r + r') s' โˆง motive t r'


valid (atomic_blocking_rmr block_until f) r assuming motive
spec: Spec

T: Type

block_until: spec.State โ†’ Bool

f: spec.State โ†’ T ร— spec.State

r: spec.Reservation

assuming: spec.State โ†’ Bool

motive: T โ†’ spec.Reservation โ†’ Prop

f_valid: โˆ€ (env_r : spec.Reservation) (s : spec.State), block_until s = true โ†’ Spec.validate spec (env_r + r) s โ†’ โˆƒ r', let _discr := f s; match f s with | (t, s') => Spec.validate spec (env_r + r') s' โˆง motive t r'


valid (atomic_blocking_rmr block_until f) r assuming motive
spec: Spec

T: Type

block_until: spec.State โ†’ Bool

f: spec.State โ†’ T ร— spec.State

r: spec.Reservation

assuming: spec.State โ†’ Bool

motive: T โ†’ spec.Reservation โ†’ Prop

f_valid: โˆ€ (env_r : spec.Reservation) (s : spec.State), block_until s = true โ†’ Spec.validate spec (env_r + r) s โ†’ โˆƒ r', let _discr := f s; match f s with | (t, s') => Spec.validate spec (env_r + r') s' โˆง motive t r'


โˆ€ (env_r : spec.Reservation) (s : spec.State), assuming s = true โ†’ Spec.validate spec (env_r + r) s โ†’ โˆƒ r', match h : iterate (atomic_blocking_rmr block_until f) s with | IterationResult.Done s' t => Spec.validate spec (env_r + r') s' โˆง motive t r' | IterationResult.Panic a a_1 => False | IterationResult.Running s' block_until_1 cont => Spec.validate spec (env_r + r') s' โˆง valid cont r' block_until_1 motive
spec: Spec

T: Type

block_until: spec.State โ†’ Bool

f: spec.State โ†’ T ร— spec.State

r: spec.Reservation

assuming: spec.State โ†’ Bool

motive: T โ†’ spec.Reservation โ†’ Prop

f_valid: โˆ€ (env_r : spec.Reservation) (s : spec.State), block_until s = true โ†’ Spec.validate spec (env_r + r) s โ†’ โˆƒ r', let _discr := f s; match f s with | (t, s') => Spec.validate spec (env_r + r') s' โˆง motive t r'


โˆ€ (env_r : spec.Reservation) (s : spec.State), assuming s = true โ†’ Spec.validate spec (env_r + r) s โ†’ โˆƒ r', match h : iterate (atomic_blocking_rmr block_until f) s with | IterationResult.Done s' t => Spec.validate spec (env_r + r') s' โˆง motive t r' | IterationResult.Panic a a_1 => False | IterationResult.Running s' block_until_1 cont => Spec.validate spec (env_r + r') s' โˆง valid cont r' block_until_1 motive
spec: Spec

T: Type

block_until: spec.State โ†’ Bool

f: spec.State โ†’ T ร— spec.State

r: spec.Reservation

assuming: spec.State โ†’ Bool

motive: T โ†’ spec.Reservation โ†’ Prop

f_valid: โˆ€ (env_r : spec.Reservation) (s : spec.State), block_until s = true โ†’ Spec.validate spec (env_r + r) s โ†’ โˆƒ r', let _discr := f s; match f s with | (t, s') => Spec.validate spec (env_r + r') s' โˆง motive t r'


valid (atomic_blocking_rmr block_until f) r assuming motive
spec: Spec

T: Type

block_until: spec.State โ†’ Bool

f: spec.State โ†’ T ร— spec.State

r: spec.Reservation

assuming: spec.State โ†’ Bool

motive: T โ†’ spec.Reservation โ†’ Prop

f_valid: โˆ€ (env_r : spec.Reservation) (s : spec.State), block_until s = true โ†’ Spec.validate spec (env_r + r) s โ†’ โˆƒ r', let _discr := f s; match f s with | (t, s') => Spec.validate spec (env_r + r') s' โˆง motive t r'

env_r: spec.Reservation

s: spec.State

initial_valid: Spec.validate spec (env_r + r) s


โˆƒ r', match h : iterate (atomic_blocking_rmr block_until f) s with | IterationResult.Done s' t => Spec.validate spec (env_r + r') s' โˆง motive t r' | IterationResult.Panic a a_1 => False | IterationResult.Running s' block_until_1 cont => Spec.validate spec (env_r + r') s' โˆง valid cont r' block_until_1 motive
spec: Spec

T: Type

block_until: spec.State โ†’ Bool

f: spec.State โ†’ T ร— spec.State

r: spec.Reservation

assuming: spec.State โ†’ Bool

motive: T โ†’ spec.Reservation โ†’ Prop

f_valid: โˆ€ (env_r : spec.Reservation) (s : spec.State), block_until s = true โ†’ Spec.validate spec (env_r + r) s โ†’ โˆƒ r', let _discr := f s; match f s with | (t, s') => Spec.validate spec (env_r + r') s' โˆง motive t r'


valid (atomic_blocking_rmr block_until f) r assuming motive
spec: Spec

T: Type

block_until: spec.State โ†’ Bool

f: spec.State โ†’ T ร— spec.State

r: spec.Reservation

assuming: spec.State โ†’ Bool

motive: T โ†’ spec.Reservation โ†’ Prop

f_valid: โˆ€ (env_r : spec.Reservation) (s : spec.State), block_until s = true โ†’ Spec.validate spec (env_r + r) s โ†’ โˆƒ r', let _discr := f s; match f s with | (t, s') => Spec.validate spec (env_r + r') s' โˆง motive t r'

env_r: spec.Reservation

s: spec.State

initial_valid: Spec.validate spec (env_r + r) s


โˆƒ r', Spec.validate spec (env_r + r') s โˆง valid (atomic_read_modify_read f) r' block_until motive
spec: Spec

T: Type

block_until: spec.State โ†’ Bool

f: spec.State โ†’ T ร— spec.State

r: spec.Reservation

assuming: spec.State โ†’ Bool

motive: T โ†’ spec.Reservation โ†’ Prop

f_valid: โˆ€ (env_r : spec.Reservation) (s : spec.State), block_until s = true โ†’ Spec.validate spec (env_r + r) s โ†’ โˆƒ r', let _discr := f s; match f s with | (t, s') => Spec.validate spec (env_r + r') s' โˆง motive t r'


valid (atomic_blocking_rmr block_until f) r assuming motive
spec: Spec

T: Type

block_until: spec.State โ†’ Bool

f: spec.State โ†’ T ร— spec.State

r: spec.Reservation

assuming: spec.State โ†’ Bool

motive: T โ†’ spec.Reservation โ†’ Prop

f_valid: โˆ€ (env_r : spec.Reservation) (s : spec.State), block_until s = true โ†’ Spec.validate spec (env_r + r) s โ†’ โˆƒ r', let _discr := f s; match f s with | (t, s') => Spec.validate spec (env_r + r') s' โˆง motive t r'

env_r: spec.Reservation

s: spec.State

initial_valid: Spec.validate spec (env_r + r) s


Spec.validate spec (env_r + r) s โˆง valid (atomic_read_modify_read f) r block_until motive
spec: Spec

T: Type

block_until: spec.State โ†’ Bool

f: spec.State โ†’ T ร— spec.State

r: spec.Reservation

assuming: spec.State โ†’ Bool

motive: T โ†’ spec.Reservation โ†’ Prop

f_valid: โˆ€ (env_r : spec.Reservation) (s : spec.State), block_until s = true โ†’ Spec.validate spec (env_r + r) s โ†’ โˆƒ r', let _discr := f s; match f s with | (t, s') => Spec.validate spec (env_r + r') s' โˆง motive t r'


valid (atomic_blocking_rmr block_until f) r assuming motive

Goals accomplished! ๐Ÿ™
end Mt.TaskM