Equations
- Mt.instIsReservationReservation_1 = spec.is_reservation
- state : spec.State
- panics : Nat
Describes a system of zero or more threads running in parallel
Systems can be iterated one atomic step at a time by choosing one of its threads. They keep track of the number of threads which panicked during execution
Instances For
Equations
- Mt.System.ThreadIndex s = Fin (List.length s.threads)
Equations
- Mt.System.done s = decide (List.length s.threads = 0)
def
Mt.System.iterate
{spec : Mt.Spec}
(s : Mt.System spec)
:
Mt.System.ThreadIndex s → Mt.System spec
Equations
- One or more equations did not get rendered due to their size.
theorem
Mt.System.iterate_threads
{spec : Mt.Spec}
(s : Mt.System spec)
(thread_idx : Mt.System.ThreadIndex s)
(blocked_until : Mt.Thread.block_until (List.get s.threads thread_idx) s.state = true)
:
(Mt.System.iterate s thread_idx).threads = let _discr := Mt.Thread.iterate (List.get s.threads thread_idx) s.state;
match Mt.Thread.iterate (List.get s.threads thread_idx) s.state with
| Mt.Thread.IterationResult.Done a => List.eraseIdx s.threads thread_idx.val
| Mt.Thread.IterationResult.Panic a => List.eraseIdx s.threads thread_idx.val
| Mt.Thread.IterationResult.Running a thread => List.set s.threads thread_idx.val thread
theorem
Mt.System.iterate_panics
{spec : Mt.Spec}
(s : Mt.System spec)
(thread_idx : Mt.System.ThreadIndex s)
(blocked_until : Mt.Thread.block_until (List.get s.threads thread_idx) s.state = true)
:
(Mt.System.iterate s thread_idx).panics = let _discr := Mt.Thread.iterate (List.get s.threads thread_idx) s.state;
match Mt.Thread.iterate (List.get s.threads thread_idx) s.state with
| Mt.Thread.IterationResult.Done a => s.panics
| Mt.Thread.IterationResult.Panic a => s.panics + 1
| Mt.Thread.IterationResult.Running a a_1 => s.panics
- single: ∀ {spec : Mt.Spec} {a b : Mt.System spec} (idx : Mt.System.ThreadIndex a), Mt.System.iterate a idx = b → Mt.System.reduces_to a b
- trans: ∀ {spec : Mt.Spec} {a b c : Mt.System spec}, Mt.System.reduces_to a b → Mt.System.reduces_to b c → Mt.System.reduces_to a c
Instances For
Equations
- Mt.System.reduces_to_or_eq a b = (a = b ∨ Mt.System.reduces_to a b)
theorem
Mt.System.reduces_to_or_eq.trans
{spec : Mt.Spec}
{a : Mt.System spec}
{b : Mt.System spec}
{c : Mt.System spec}
: