[Imprint][Data Privacy Statement][E-Mail]
Back to main index.
View the specification.
View theorem base summary,
View theorem base listing,
the used properties by spec,
the dependency list,
the symbol table,
automaton specification
TMS2
using memlist, readwriteset
functions
. ⊕ . : (L → V) × Rwset → L → V;
predicates
validIdx : Nat × Nat × Rwset × Memlist;
∃valid : Nat × Rwset × Memlist;
. ⊆ . : Rwset × (L → V);
variables
memories : Memlist;
rdset : Rwset;
wrset : Rwset;
beginIdx : Nat;
v : V;
ov : V;
l : L;
il : L;
tid : T;
mem : L → V;
axioms
subset-base: ∅ ⊆ mem;
used for: s, ls;
subset-rec: ¬ l ∈ rws → (rws[l := v] ⊆ mem ↔ mem(l) = v ∧ rws ⊆ mem);
used for: s, ls;
overwrite-def: ((mem ⊕ rws))(l) = (l ∈ rws ⊃ rws[l];mem(l));
used for: s, ls;
validIdx-def: validIdx(n, beginIdx, rdset, memories) ↔ beginIdx ≤ n ∧ n < # memories ∧ rdset ⊆ memories[n];
used for: s, ls;
exvalid-def: ∃valid(beginIdx, rdset, memories) ↔ (∃ n. beginIdx ≤ n ∧ n < # memories ∧ rdset ⊆ memories[n]);
used for: ls;
state variables
memories : Memlist;
local state variables
tid : T;
rdset : Rwset;
wrset : Rwset;
beginIdx : Nat;
il : L;
ov : V;
thread id tid;
external labels
NotStarted,
Ready,
BeginPending,
CommitResp,
ReadResp,
WriteResp,
CommitInv,
ReadInv,
WriteInv,
CancelPending,
Committed,
Aborted;
special actions
callRetAbort(. .tid : T);
initial state
memories = ∅ ' ∧ pcf = (λ tid. NotStarted)
declarations
InvTMBegin:
NotStarted :- InvTMBegin(memories; beginIdx)
atomic
{
beginIdx := # memories - 1; return BeginPending :-
}
;
InvTMEnd:
Ready :- InvTMEnd()
atomic
{
return CommitInv :-
}
;
InvTMRead:
Ready :- InvTMRead(l; il)
atomic
{
il := l; return ReadInv :-
}
;
InvTMWrite:
Ready :- InvTMWrite(l, v; il, ov)
atomic
{
il := l, ov := v; return WriteInv :-
}
;
InvCancel:
Ready :- InvCancel()
atomic
{
return CancelPending :-
}
;
RetTMBegin:
BeginPending :- RetTMBegin()
atomic
{
return Ready :-
}
;
RetTMEnd:
CommitResp :- RetTMEnd()
atomic
{
return Committed :-
}
;
RetTMRead:
ReadResp :- RetTMRead(ov; v)
atomic
{
v := ov; return Ready :-
}
;
RetTMWrite:
WriteResp :- RetTMWrite()
atomic
{
return Ready :-
}
;
DoCommitReadOnly:
CommitInv :- DoCommitReadOnly(rdset, wrset, beginIdx, memories)
atomic
precondition wrset = ∅ ∧ ∃valid(beginIdx, rdset, memories);
{
return CommitResp :-
}
;
DoCommitWriter:
CommitInv :- DoCommitWriter(rdset, wrset; memories)
atomic
precondition rdset ⊆ memories.last;
{
memories := memories + (memories.last ⊕ wrset); return CommitResp :-
}
;
DoReadWrSet:
ReadInv :- DoReadWrSet(wrset, il; ov)
atomic
precondition il ∈ wrset;
{
ov := wrset[il]; return ReadResp :-
}
;
DoReadIx:
ReadInv :- DoReadIx(n, wrset, beginIdx, il, memories; rdset, ov)
atomic
precondition ¬ il ∈ wrset ∧ validIdx(n, beginIdx, rdset, memories);
{
ov := memories[n](il), rdset[il] := memories[n](il); return ReadResp :-
}
;
DoWrite:
WriteInv :- DoWrite(il, ov; wrset)
atomic
{
wrset[il] := ov; return WriteResp :-
}
;
AbortBeginPending:
BeginPending :- AbortBeginPending()
atomic with callRetAbort(tid)
{
return Aborted :-
}
;
AbortReadResp:
ReadResp :- AbortReadResp()
atomic with callRetAbort(tid)
{
return Aborted :-
}
;
AbortWriteResp:
WriteResp :- AbortWriteResp()
atomic with callRetAbort(tid)
{
return Aborted :-
}
;
AbortCommit:
CommitInv :- AbortCommit()
atomic with callRetAbort(tid)
{
return Aborted :-
}
;
AbortRead:
ReadInv :- AbortRead()
atomic with callRetAbort(tid)
{
return Aborted :-
}
;
AbortWrite:
WriteInv :- AbortWrite()
atomic with callRetAbort(tid)
{
return Aborted :-
}
;
AbortCancelPending:
CancelPending :- AbortCancelPending()
atomic with callRetAbort(tid)
{
return Aborted :-
}
;
assertions
: memories ≠ [];
Ready, BeginPending, CommitResp, ReadResp, WriteResp, CommitInv, ReadInv, WriteInv, CancelPending, Committed, Aborted
: beginIdx < # memories;
end automaton specification ;;; END
------------------------------------------------
base =
enrich
memlist,
readwriteset
with
functions
. ⊕ . : (L → V) × Rwset → L → V;
predicates
validIdx : Nat × Nat × Rwset × Memlist;
∃valid : Nat × Rwset × Memlist;
. ⊆ . : Rwset × (L → V);
variables
memories : Memlist;
rdset : Rwset;
wrset : Rwset;
beginIdx : Nat;
v : V;
ov : V;
l : L;
il : L;
tid : T;
mem : L → V;
axioms
subset-base: ∅ ⊆ mem;
used for: s, ls;
subset-rec: ¬ l ∈ rws → (rws[l := v] ⊆ mem ↔ mem(l) = v ∧ rws ⊆ mem);
used for: s, ls;
overwrite-def: ((mem ⊕ rws))(l) = (l ∈ rws ⊃ rws[l];mem(l));
used for: s, ls;
validIdx-def: validIdx(n, beginIdx, rdset, memories) ↔ beginIdx ≤ n ∧ n < # memories ∧ rdset ⊆ memories[n];
used for: s, ls;
exvalid-def: ∃valid(beginIdx, rdset, memories) ↔ (∃ n. beginIdx ≤ n ∧ n < # memories ∧ rdset ⊆ memories[n]);
used for: ls;
end enrich
pc =
data specification
TMS2PC = Aborted
| BeginPending
| CancelPending
| CommitInv
| CommitResp
| Committed
| NotStarted
| ReadInv
| ReadResp
| Ready
| WriteInv
| WriteResp
;
variables
pc : TMS2PC;
end data specification
gs =
data specification
using base
TMS2GState := mkTMS2gs(. .memories : Memlist)
;
variables
gs : TMS2GState;
memories : Memlist;
end data specification
ls =
data specification
using base
TMS2LState := mkTMS2ls(. .tid : T;
. .rdset : Rwset;
. .wrset : Rwset;
. .beginIdx : Nat;
. .il : L;
. .ov : V)
;
variables
ls : TMS2LState;
tid : T;
rdset : Rwset;
wrset : Rwset;
beginIdx : Nat;
il : L;
ov : V;
end data specification
state =
data specification
using pc, localstate,
globalstate
TMS2State := mkstate(. .gstate : TMS2GState;. .lsf : T → TMS2LState;. .pcf : T → TMS2PC)
;
variables
s : TMS2State;
lsf : T → TMS2LState;
pcf : T → TMS2PC;
gstate : TMS2GState;
end data specification
action =
data specification
using base
data types
TMS2Action = callDoCommitReadOnly(. .tid : T)
| callDoCommitWriter(. .tid : T)
| callDoReadIx(. .tid : T;. .invDoReadIxn : Nat)
| callDoReadWrSet(. .tid : T)
| callDoWrite(. .tid : T)
| callInvCancel(. .tid : T)
| callInvTMBegin(. .tid : T)
| callInvTMEnd(. .tid : T)
| callInvTMRead(. .tid : T;. .invInvTMReadl : L)
| callInvTMWrite(. .tid : T;. .invInvTMWritel : L;. .invInvTMWritev : V)
| callRetAbort(. .tid : T)
| callRetTMBegin(. .tid : T)
| callRetTMEnd(. .tid : T)
| callRetTMRead(. .tid : T;. .retRetTMReadv : V)
| callRetTMWrite(. .tid : T)
| τ
;
variables
a : TMS2Action;
tid : T;
invDoReadIxn : Nat;
invInvTMReadl : L;
invInvTMWritel : L;
invInvTMWritev : V;
retRetTMReadv : V;
end data specification
step =
enrich
state,
action
with
functions
lstepf : TMS2GState × TMS2LState × TMS2PC × TMS2Action → TMS2LState;
gstepf : TMS2GState × TMS2LState × TMS2PC × TMS2Action → TMS2GState;
pcstepf : TMS2GState × TMS2LState × TMS2PC × TMS2Action → TMS2PC;
predicates
tms2Init : TMS2State;
tms2Step : TMS2State × TMS2Action × TMS2State;
pre : TMS2GState × TMS2LState × TMS2PC × TMS2Action;
lstep : TMS2GState × TMS2LState × TMS2PC × TMS2Action × TMS2GState × TMS2LState × TMS2PC;
TMS2GInv : TMS2GState;
TMS2LInv : TMS2GState × TMS2LState × TMS2PC;
TMS2Inv : TMS2GState × (T → TMS2LState) × (T → TMS2PC);
procedures InvTMBegin Memlist : Nat nonfunctional ;
InvTMEnd : ;
InvTMRead L : L nonfunctional ;
InvTMWrite L × V : L × V nonfunctional ;
InvCancel : ;
RetTMBegin : ;
RetTMEnd : ;
RetTMRead V : : V ;
RetTMWrite : ;
DoCommitReadOnly Rwset × Rwset × Nat × Memlist : ;
DoCommitWriter Rwset × Rwset : Memlist nonfunctional ;
DoReadWrSet Rwset × L : V nonfunctional ;
DoReadIx Nat × Rwset × Nat × L × Memlist : Rwset × V nonfunctional ;
DoWrite L × V : Rwset nonfunctional ;
AbortBeginPending : ;
AbortReadResp : ;
AbortWriteResp : ;
AbortCommit : ;
AbortRead : ;
AbortWrite : ;
AbortCancelPending : ;
axioms
TMS2Inv: TMS2Inv(gs, lsf, pcf) ↔ TMS2GInv(gs) ∧ (∀ tid. lsf(tid).tid = tid ∧ TMS2LInv(gs, lsf(tid), pcf(tid)));
TMS2GInv: TMS2GInv(gs) ↔ gs.memories ≠ [];
TMS2LInv:
TMS2LInv(gs, ls, pc)
↔ pc = Ready ∨ pc = BeginPending ∨ pc = CommitResp ∨ pc = ReadResp ∨ pc = WriteResp ∨ pc = CommitInv ∨ pc = ReadInv ∨ pc = WriteInv
∨ pc = CancelPending ∨ pc = Committed ∨ pc = Aborted
→ ls.beginIdx < # gs.memories;
tms2Init: tms2Init(mkstate(gs, lsf, pcf)) ↔ (gs.memories = ∅ ' ∧ pcf = (λ tid. NotStarted)) ∧ (∀ tid. lsf(tid).tid = tid);
tms2Step:
tms2Step(mkstate(gs, lsf, pcf), a, mkstate(gs0, lsf0, pcf0))
↔ (∃ tid, ls, pc. lstep(gs, lsf(tid), pcf(tid), a, gs0, ls, pc) ∧ lsf0 = lsf(tid := ls) ∧ pcf0 = pcf(tid := pc));
lstep:
lstep(gs, ls, pc, a, gs0, ls0, pc0)
↔ pre(gs, ls, pc, a) ∧ ls0 = lstepf(gs, ls, pc, a) ∧ gs0 = gstepf(gs, ls, pc, a) ∧ pc0 = pcstepf(gs, ls, pc, a);
pre-BeginPending: pre(gs, ls, BeginPending, a) ↔ a = callRetTMBegin(ls.tid) ∨ a = callRetAbort(ls.tid);
used for: s, ls;
pre-CancelPending: pre(gs, ls, CancelPending, a) ↔ a = callRetAbort(ls.tid);
used for: s, ls;
pre-CommitInv:
pre(gs, ls, CommitInv, a)
↔ a = callDoCommitReadOnly(ls.tid) ∧ ls.wrset = ∅ ∧ ∃valid(ls.beginIdx, ls.rdset, gs.memories)
∨ a = callDoCommitWriter(ls.tid) ∧ ls.rdset ⊆ gs.memories.last ∨ a = callRetAbort(ls.tid);
used for: s, ls;
pre-CommitResp: pre(gs, ls, CommitResp, a) ↔ a = callRetTMEnd(ls.tid);
used for: s, ls;
pre-NotStarted: pre(gs, ls, NotStarted, a) ↔ a = callInvTMBegin(ls.tid);
used for: s, ls;
pre-ReadInv:
pre(gs, ls, ReadInv, a)
↔ a = callDoReadWrSet(ls.tid) ∧ ls.il ∈ ls.wrset
∨ (∃ n. a = callDoReadIx(ls.tid, n) ∧ ¬ ls.il ∈ ls.wrset ∧ validIdx(n, ls.beginIdx, ls.rdset, gs.memories)) ∨ a = callRetAbort(ls.tid);
used for: s, ls;
pre-ReadResp: pre(gs, ls, ReadResp, a) ↔ (∃ v0. a = callRetTMRead(ls.tid, v0) ∧ v0 = ls.ov) ∨ a = callRetAbort(ls.tid);
used for: s, ls;
pre-Ready:
pre(gs, ls, Ready, a)
↔ a = callInvTMEnd(ls.tid) ∨ (∃ l. a = callInvTMRead(ls.tid, l)) ∨ (∃ l, v. a = callInvTMWrite(ls.tid, l, v)) ∨ a = callInvCancel(ls.tid);
used for: s, ls;
pre-WriteInv: pre(gs, ls, WriteInv, a) ↔ a = callDoWrite(ls.tid) ∨ a = callRetAbort(ls.tid);
used for: s, ls;
pre-WriteResp: pre(gs, ls, WriteResp, a) ↔ a = callRetTMWrite(ls.tid) ∨ a = callRetAbort(ls.tid);
used for: s, ls;
pre-Aborted: pre(gs, ls, Aborted, a) ↔ false;
used for: s, ls;
pre-Committed: pre(gs, ls, Committed, a) ↔ false;
used for: s, ls;
lstepf-NotStarted-InvTMBegin: ls.tid = tid → lstepf(gs, ls, NotStarted, callInvTMBegin(tid)) = ls.beginIdx:= (# gs.memories - 1);
used for: s, ls;
lstepf-Ready-InvTMEnd: ls.tid = tid → lstepf(gs, ls, Ready, callInvTMEnd(tid)) = ls;
used for: s, ls;
lstepf-Ready-InvTMRead: ls.tid = tid → lstepf(gs, ls, Ready, callInvTMRead(tid, l)) = ls.il:= l;
used for: s, ls;
lstepf-Ready-InvTMWrite: ls.tid = tid → lstepf(gs, ls, Ready, callInvTMWrite(tid, l, v)) = (ls.il:= l).ov:= v;
used for: s, ls;
lstepf-Ready-InvCancel: ls.tid = tid → lstepf(gs, ls, Ready, callInvCancel(tid)) = ls;
used for: s, ls;
lstepf-BeginPending-RetTMBegin: ls.tid = tid → lstepf(gs, ls, BeginPending, callRetTMBegin(tid)) = ls;
used for: s, ls;
lstepf-CommitResp-RetTMEnd: ls.tid = tid → lstepf(gs, ls, CommitResp, callRetTMEnd(tid)) = ls;
used for: s, ls;
lstepf-ReadResp-RetTMRead: ls.tid = tid → lstepf(gs, ls, ReadResp, callRetTMRead(tid, v0)) = ls;
used for: s, ls;
lstepf-WriteResp-RetTMWrite: ls.tid = tid → lstepf(gs, ls, WriteResp, callRetTMWrite(tid)) = ls;
used for: s, ls;
lstepf-CommitInv-DoCommitReadOnly: ls.tid = tid → lstepf(gs, ls, CommitInv, callDoCommitReadOnly(tid)) = ls;
used for: s, ls;
lstepf-CommitInv-DoCommitWriter: ls.tid = tid → lstepf(gs, ls, CommitInv, callDoCommitWriter(tid)) = ls;
used for: s, ls;
lstepf-ReadInv-DoReadWrSet: ls.tid = tid → lstepf(gs, ls, ReadInv, callDoReadWrSet(tid)) = ls.ov:= ls.wrset[ls.il];
used for: s, ls;
lstepf-ReadInv-DoReadIx:
ls.tid = tid
→ lstepf(gs, ls, ReadInv, callDoReadIx(tid, n)) = (ls.ov:= gs.memories[n](ls.il)).rdset:= ls.rdset[ls.il := gs.memories[n](ls.il)];
used for: s, ls;
lstepf-WriteInv-DoWrite: ls.tid = tid → lstepf(gs, ls, WriteInv, callDoWrite(tid)) = ls.wrset:= ls.wrset[ls.il := ls.ov];
used for: s, ls;
lstepf-BeginPending-AbortBeginPending: ls.tid = tid → lstepf(gs, ls, BeginPending, callRetAbort(tid)) = ls;
used for: s, ls;
lstepf-ReadResp-AbortReadResp: ls.tid = tid → lstepf(gs, ls, ReadResp, callRetAbort(tid)) = ls;
used for: s, ls;
lstepf-WriteResp-AbortWriteResp: ls.tid = tid → lstepf(gs, ls, WriteResp, callRetAbort(tid)) = ls;
used for: s, ls;
lstepf-CommitInv-AbortCommit: ls.tid = tid → lstepf(gs, ls, CommitInv, callRetAbort(tid)) = ls;
used for: s, ls;
lstepf-ReadInv-AbortRead: ls.tid = tid → lstepf(gs, ls, ReadInv, callRetAbort(tid)) = ls;
used for: s, ls;
lstepf-WriteInv-AbortWrite: ls.tid = tid → lstepf(gs, ls, WriteInv, callRetAbort(tid)) = ls;
used for: s, ls;
lstepf-CancelPending-AbortCancelPending: ls.tid = tid → lstepf(gs, ls, CancelPending, callRetAbort(tid)) = ls;
used for: s, ls;
gstepf-BeginPending: gstepf(gs, ls, BeginPending, a) = gs;
used for: s, ls;
gstepf-CancelPending-AbortCancelPending: ls.tid = tid → gstepf(gs, ls, CancelPending, callRetAbort(tid)) = gs;
used for: s, ls;
gstepf-CommitInv-AbortCommit: ls.tid = tid → gstepf(gs, ls, CommitInv, callRetAbort(tid)) = gs;
used for: s, ls;
gstepf-CommitInv-DoCommitReadOnly: ls.tid = tid → gstepf(gs, ls, CommitInv, callDoCommitReadOnly(tid)) = gs;
used for: s, ls;
gstepf-CommitInv-DoCommitWriter:
ls.tid = tid → gstepf(gs, ls, CommitInv, callDoCommitWriter(tid)) = gs.memories:= (gs.memories + (gs.memories.last ⊕ ls.wrset));
used for: s, ls;
gstepf-CommitResp-RetTMEnd: ls.tid = tid → gstepf(gs, ls, CommitResp, callRetTMEnd(tid)) = gs;
used for: s, ls;
gstepf-NotStarted-InvTMBegin: ls.tid = tid → gstepf(gs, ls, NotStarted, callInvTMBegin(tid)) = gs;
used for: s, ls;
gstepf-ReadInv: gstepf(gs, ls, ReadInv, a) = gs;
used for: s, ls;
gstepf-ReadResp: gstepf(gs, ls, ReadResp, a) = gs;
used for: s, ls;
gstepf-Ready: gstepf(gs, ls, Ready, a) = gs;
used for: s, ls;
gstepf-WriteInv: gstepf(gs, ls, WriteInv, a) = gs;
used for: s, ls;
gstepf-WriteResp: gstepf(gs, ls, WriteResp, a) = gs;
used for: s, ls;
pcstepf-NotStarted-InvTMBegin: ls.tid = tid → pcstepf(gs, ls, NotStarted, callInvTMBegin(tid)) = BeginPending;
used for: s, ls;
pcstepf-Ready-InvTMEnd: ls.tid = tid → pcstepf(gs, ls, Ready, callInvTMEnd(tid)) = CommitInv;
used for: s, ls;
pcstepf-Ready-InvTMRead: ls.tid = tid → pcstepf(gs, ls, Ready, callInvTMRead(tid, l)) = ReadInv;
used for: s, ls;
pcstepf-Ready-InvTMWrite: ls.tid = tid → pcstepf(gs, ls, Ready, callInvTMWrite(tid, l, v)) = WriteInv;
used for: s, ls;
pcstepf-Ready-InvCancel: ls.tid = tid → pcstepf(gs, ls, Ready, callInvCancel(tid)) = CancelPending;
used for: s, ls;
pcstepf-BeginPending-RetTMBegin: ls.tid = tid → pcstepf(gs, ls, BeginPending, callRetTMBegin(tid)) = Ready;
used for: s, ls;
pcstepf-CommitResp-RetTMEnd: ls.tid = tid → pcstepf(gs, ls, CommitResp, callRetTMEnd(tid)) = Committed;
used for: s, ls;
pcstepf-ReadResp-RetTMRead: ls.tid = tid → pcstepf(gs, ls, ReadResp, callRetTMRead(tid, v0)) = Ready;
used for: s, ls;
pcstepf-WriteResp-RetTMWrite: ls.tid = tid → pcstepf(gs, ls, WriteResp, callRetTMWrite(tid)) = Ready;
used for: s, ls;
pcstepf-CommitInv-DoCommitReadOnly: ls.tid = tid → pcstepf(gs, ls, CommitInv, callDoCommitReadOnly(tid)) = CommitResp;
used for: s, ls;
pcstepf-CommitInv-DoCommitWriter: ls.tid = tid → pcstepf(gs, ls, CommitInv, callDoCommitWriter(tid)) = CommitResp;
used for: s, ls;
pcstepf-ReadInv-DoReadWrSet: ls.tid = tid → pcstepf(gs, ls, ReadInv, callDoReadWrSet(tid)) = ReadResp;
used for: s, ls;
pcstepf-ReadInv-DoReadIx: ls.tid = tid → pcstepf(gs, ls, ReadInv, callDoReadIx(tid, n)) = ReadResp;
used for: s, ls;
pcstepf-WriteInv-DoWrite: ls.tid = tid → pcstepf(gs, ls, WriteInv, callDoWrite(tid)) = WriteResp;
used for: s, ls;
pcstepf-BeginPending-AbortBeginPending: ls.tid = tid → pcstepf(gs, ls, BeginPending, callRetAbort(tid)) = Aborted;
used for: s, ls;
pcstepf-ReadResp-AbortReadResp: ls.tid = tid → pcstepf(gs, ls, ReadResp, callRetAbort(tid)) = Aborted;
used for: s, ls;
pcstepf-WriteResp-AbortWriteResp: ls.tid = tid → pcstepf(gs, ls, WriteResp, callRetAbort(tid)) = Aborted;
used for: s, ls;
pcstepf-CommitInv-AbortCommit: ls.tid = tid → pcstepf(gs, ls, CommitInv, callRetAbort(tid)) = Aborted;
used for: s, ls;
pcstepf-ReadInv-AbortRead: ls.tid = tid → pcstepf(gs, ls, ReadInv, callRetAbort(tid)) = Aborted;
used for: s, ls;
pcstepf-WriteInv-AbortWrite: ls.tid = tid → pcstepf(gs, ls, WriteInv, callRetAbort(tid)) = Aborted;
used for: s, ls;
pcstepf-CancelPending-AbortCancelPending: ls.tid = tid → pcstepf(gs, ls, CancelPending, callRetAbort(tid)) = Aborted;
used for: s, ls;
end enrich