definition
let Values be   
Values_with_Bool;
attr c2 is  
strict ;
struct  Events_structure over 
Values -> ;
aggr Events_structure(# 
events, 
processes, 
locations, 
traces, 
procE, 
traceE, 
readE, 
writeE, 
val_of #)
 ->    Events_structure over 
Values;
sel  events c2 ->   non  
empty  LinearPreorder;
sel  processes c2 ->   non  
empty   set ;
sel  locations c2 ->   non  
empty   set ;
sel  traces c2 ->   non  
empty   set ;
sel  procE c2 ->   Function of  the 
processes of 
c2,
(bool  the carrier of  the events of c2);
sel  traceE c2 ->   Function of  the 
traces of 
c2,
(bool  the carrier of  the events of c2);
sel  readE c2 ->   Function of  the 
locations of 
c2,
(bool  the carrier of  the events of c2);
sel  writeE c2 ->   Function of  the 
locations of 
c2,
(bool  the carrier of  the events of c2);
sel  val_of c2 ->   PartFunc of  the 
carrier of  the 
events of 
c2, the 
carrier of 
Values;
 
end;
 
theorem thLinPreordEvents: 
 
theorem thEvStrictTrans1: 
 
theorem thEvStrictTrans2: 
 
definition
let Values be   
Values_with_Bool;
let DS be   
DistributedSysWithSharedMem of 
Values;
let p be   
Process of 
DS;
let tr be   
trace of 
DS;
let e be   
Event of 
DS;
let x1, 
x2, 
turn be   
Location of 
DS;
let a1, 
a2 be    
Element of  the 
carrier of 
Values;
pred e has_Peterson_mutex_in p,
x1,
x2,
turn,
a1,
a2,
tr means 
 ex 
e1, 
e2, 
e3 being   
Event of 
DS st 
( 
e1 in p,
tr & 
e2 in p,
tr & 
e3 in p,
tr & 
e1 < e2 & 
e2 < e3 & 
e3 < e & 
e1 writesto x1, the 
True of 
Values &  not (
e1,
e) 
interval_in (
p,
tr) 
writesto x1 & 
e2 writesto turn,
a2 &  not (
e2,
e) 
interval_in (
p,
tr) 
writesto turn & ( 
e3 reads x2, the 
False of 
Values or 
e3 reads turn,
a1 ) );
 
 
end;
 
:: 
deftheorem    defines 
has_Peterson_mutex_in PETERSON:def 23 : 
 for Values being   Values_with_Bool
  for DS being   DistributedSysWithSharedMem of Values
  for p being   Process of DS
  for tr being   trace of DS
  for e being   Event of DS
  for x1, x2, turn being   Location of DS
  for a1, a2 being    Element of  the carrier of Values holds 
 ( e has_Peterson_mutex_in p,x1,x2,turn,a1,a2,tr iff  ex e1, e2, e3 being   Event of DS st 
( e1 in p,tr & e2 in p,tr & e3 in p,tr & e1 < e2 & e2 < e3 & e3 < e & e1 writesto x1, the True of Values &  not (e1,e) interval_in (p,tr) writesto x1 & e2 writesto turn,a2 &  not (e2,e) interval_in (p,tr) writesto turn & ( e3 reads x2, the False of Values or e3 reads turn,a1 ) ) );
definition
let Values be   
Values_with_Bool;
let DS be   
DistributedSysWithSharedMem of 
Values;
let tr be   
trace of 
DS;
let Es be    
set ;
pred Es has_Peterson_mutex_in tr means 
 ex 
p1, 
p2 being   
Process of 
DS st 
( (  for 
p being   
Process of 
DS  holds 
( 
p = p1 or 
p = p2 ) ) &  ex 
flag1, 
flag2, 
turn being   
Location of 
DS st 
( (  for 
e being   
Event of 
DS  st 
e in p1,
tr holds 
(  not 
e writesto flag2 &  not 
e writesto turn, the 
False of 
Values ) ) & (  for 
e being   
Event of 
DS  st 
e in p2,
tr holds 
(  not 
e writesto flag1 &  not 
e writesto turn, the 
True of 
Values ) ) & (  for 
e being   
Event of 
DS  st 
e in Es holds 
( 
e has_Peterson_mutex_in p1,
flag1,
flag2,
turn, the 
False of 
Values, the 
True of 
Values,
tr & 
e has_Peterson_mutex_in p2,
flag2,
flag1,
turn, the 
True of 
Values, the 
False of 
Values,
tr ) ) ) );
 
 
end;
 
:: 
deftheorem    defines 
has_Peterson_mutex_in PETERSON:def 24 : 
 for Values being   Values_with_Bool
  for DS being   DistributedSysWithSharedMem of Values
  for tr being   trace of DS
  for Es being    set  holds 
 ( Es has_Peterson_mutex_in tr iff  ex p1, p2 being   Process of DS st 
( (  for p being   Process of DS  holds 
( p = p1 or p = p2 ) ) &  ex flag1, flag2, turn being   Location of DS st 
( (  for e being   Event of DS  st e in p1,tr holds 
(  not e writesto flag2 &  not e writesto turn, the False of Values ) ) & (  for e being   Event of DS  st e in p2,tr holds 
(  not e writesto flag1 &  not e writesto turn, the True of Values ) ) & (  for e being   Event of DS  st e in Es holds 
( e has_Peterson_mutex_in p1,flag1,flag2,turn, the False of Values, the True of Values,tr & e has_Peterson_mutex_in p2,flag2,flag1,turn, the True of Values, the False of Values,tr ) ) ) ) );