:: NET_1 semantic presentation

definition
attr a1 is strict;
struct Net -> ;
aggr Net(# Places, Transitions, Flow #) -> Net ;
sel Places c1 -> set ;
sel Transitions c1 -> set ;
sel Flow c1 -> Relation;
end;

definition
let c1 be Net ;
attr a1 is Petri means :Def1: :: NET_1:def 1
( the Places of a1 misses the Transitions of a1 & the Flow of a1 c= [:the Places of a1,the Transitions of a1:] \/ [:the Transitions of a1,the Places of a1:] );
end;

:: deftheorem Def1 defines Petri NET_1:def 1 :
for b1 being Net holds
( b1 is Petri iff ( the Places of b1 misses the Transitions of b1 & the Flow of b1 c= [:the Places of b1,the Transitions of b1:] \/ [:the Transitions of b1,the Places of b1:] ) );

notation
let c1 be Net ;
synonym c1 is_Petri_net for Petri c1;
end;

definition
let c1 be Net ;
func Elements c1 -> set equals :: NET_1:def 2
the Places of a1 \/ the Transitions of a1;
correctness
coherence
the Places of c1 \/ the Transitions of c1 is set
;
;
end;

:: deftheorem Def2 defines Elements NET_1:def 2 :
for b1 being Net holds Elements b1 = the Places of b1 \/ the Transitions of b1;

theorem Th1: :: NET_1:1
canceled;

theorem Th2: :: NET_1:2
canceled;

theorem Th3: :: NET_1:3
canceled;

theorem Th4: :: NET_1:4
for b1 being Net holds the Places of b1 c= Elements b1 by XBOOLE_1:7;

theorem Th5: :: NET_1:5
for b1 being Net holds the Transitions of b1 c= Elements b1 by XBOOLE_1:7;

theorem Th6: :: NET_1:6
for b1 being set
for b2 being Net holds
( b1 in Elements b2 iff ( b1 in the Places of b2 or b1 in the Transitions of b2 ) ) by XBOOLE_0:def 2;

theorem Th7: :: NET_1:7
for b1 being set
for b2 being Net holds
( not Elements b2 <> {} or not b1 is Element of Elements b2 or b1 is Element of the Places of b2 or b1 is Element of the Transitions of b2 ) by Th6;

theorem Th8: :: NET_1:8
for b1 being set
for b2 being Net st b1 is Element of the Places of b2 & the Places of b2 <> {} holds
b1 is Element of Elements b2
proof end;

theorem Th9: :: NET_1:9
for b1 being set
for b2 being Net st b1 is Element of the Transitions of b2 & the Transitions of b2 <> {} holds
b1 is Element of Elements b2
proof end;

Lemma5: Net(# {} ,{} ,{} #) is_Petri_net
proof end;

registration
cluster Net(# {} ,{} ,{} #) -> Petri ;
coherence
Net(# {} ,{} ,{} #) is Petri
by Lemma5;
end;

registration
cluster strict Petri Net ;
existence
ex b1 being Net st
( b1 is strict & b1 is Petri )
proof end;
end;

definition
mode Pnet is Petri Net ;
end;

theorem Th10: :: NET_1:10
canceled;

theorem Th11: :: NET_1:11
for b1 being set
for b2 being Pnet holds
( not b1 in the Places of b2 or not b1 in the Transitions of b2 )
proof end;

theorem Th12: :: NET_1:12
for b1, b2 being set
for b3 being Pnet st [b1,b2] in the Flow of b3 & b1 in the Transitions of b3 holds
b2 in the Places of b3
proof end;

theorem Th13: :: NET_1:13
for b1, b2 being set
for b3 being Pnet st [b1,b2] in the Flow of b3 & b2 in the Transitions of b3 holds
b1 in the Places of b3
proof end;

theorem Th14: :: NET_1:14
for b1, b2 being set
for b3 being Pnet st [b1,b2] in the Flow of b3 & b1 in the Places of b3 holds
b2 in the Transitions of b3
proof end;

theorem Th15: :: NET_1:15
for b1, b2 being set
for b3 being Pnet st [b1,b2] in the Flow of b3 & b2 in the Places of b3 holds
b1 in the Transitions of b3
proof end;

definition
let c1 be Pnet;
let c2, c3 be set ;
canceled;
canceled;
pred pre c1,c2,c3 means :Def5: :: NET_1:def 5
( [a3,a2] in the Flow of a1 & a2 in the Transitions of a1 );
pred post c1,c2,c3 means :Def6: :: NET_1:def 6
( [a2,a3] in the Flow of a1 & a2 in the Transitions of a1 );
end;

:: deftheorem Def3 NET_1:def 3 :
canceled;

:: deftheorem Def4 NET_1:def 4 :
canceled;

:: deftheorem Def5 defines pre NET_1:def 5 :
for b1 being Pnet
for b2, b3 being set holds
( pre b1,b2,b3 iff ( [b3,b2] in the Flow of b1 & b2 in the Transitions of b1 ) );

:: deftheorem Def6 defines post NET_1:def 6 :
for b1 being Pnet
for b2, b3 being set holds
( post b1,b2,b3 iff ( [b2,b3] in the Flow of b1 & b2 in the Transitions of b1 ) );

definition
let c1 be Net ;
let c2 be Element of Elements c1;
func Pre c1,c2 -> set means :Def7: :: NET_1:def 7
for b1 being set holds
( b1 in a3 iff ( b1 in Elements a1 & [b1,a2] in the Flow of a1 ) );
existence
ex b1 being set st
for b2 being set holds
( b2 in b1 iff ( b2 in Elements c1 & [b2,c2] in the Flow of c1 ) )
proof end;
uniqueness
for b1, b2 being set st ( for b3 being set holds
( b3 in b1 iff ( b3 in Elements c1 & [b3,c2] in the Flow of c1 ) ) ) & ( for b3 being set holds
( b3 in b2 iff ( b3 in Elements c1 & [b3,c2] in the Flow of c1 ) ) ) holds
b1 = b2
proof end;
func Post c1,c2 -> set means :Def8: :: NET_1:def 8
for b1 being set holds
( b1 in a3 iff ( b1 in Elements a1 & [a2,b1] in the Flow of a1 ) );
existence
ex b1 being set st
for b2 being set holds
( b2 in b1 iff ( b2 in Elements c1 & [c2,b2] in the Flow of c1 ) )
proof end;
uniqueness
for b1, b2 being set st ( for b3 being set holds
( b3 in b1 iff ( b3 in Elements c1 & [c2,b3] in the Flow of c1 ) ) ) & ( for b3 being set holds
( b3 in b2 iff ( b3 in Elements c1 & [c2,b3] in the Flow of c1 ) ) ) holds
b1 = b2
proof end;
end;

:: deftheorem Def7 defines Pre NET_1:def 7 :
for b1 being Net
for b2 being Element of Elements b1
for b3 being set holds
( b3 = Pre b1,b2 iff for b4 being set holds
( b4 in b3 iff ( b4 in Elements b1 & [b4,b2] in the Flow of b1 ) ) );

:: deftheorem Def8 defines Post NET_1:def 8 :
for b1 being Net
for b2 being Element of Elements b1
for b3 being set holds
( b3 = Post b1,b2 iff for b4 being set holds
( b4 in b3 iff ( b4 in Elements b1 & [b2,b4] in the Flow of b1 ) ) );

theorem Th16: :: NET_1:16
for b1 being Pnet
for b2 being Element of Elements b1 holds Pre b1,b2 c= Elements b1
proof end;

theorem Th17: :: NET_1:17
for b1 being Pnet
for b2 being Element of Elements b1 holds Pre b1,b2 c= Elements b1 by Th16;

theorem Th18: :: NET_1:18
for b1 being Pnet
for b2 being Element of Elements b1 holds Post b1,b2 c= Elements b1
proof end;

theorem Th19: :: NET_1:19
for b1 being Pnet
for b2 being Element of Elements b1 holds Post b1,b2 c= Elements b1 by Th18;

theorem Th20: :: NET_1:20
for b1 being set
for b2 being Pnet
for b3 being Element of Elements b2 st b3 in the Transitions of b2 holds
( b1 in Pre b2,b3 iff pre b2,b3,b1 )
proof end;

theorem Th21: :: NET_1:21
for b1 being set
for b2 being Pnet
for b3 being Element of Elements b2 st b3 in the Transitions of b2 holds
( b1 in Post b2,b3 iff post b2,b3,b1 )
proof end;

definition
let c1 be Pnet;
let c2 be Element of Elements c1;
assume E15: Elements c1 <> {} ;
func enter c1,c2 -> set means :Def9: :: NET_1:def 9
( ( a2 in the Places of a1 implies a3 = {a2} ) & ( a2 in the Transitions of a1 implies a3 = Pre a1,a2 ) );
existence
ex b1 being set st
( ( c2 in the Places of c1 implies b1 = {c2} ) & ( c2 in the Transitions of c1 implies b1 = Pre c1,c2 ) )
proof end;
uniqueness
for b1, b2 being set st ( c2 in the Places of c1 implies b1 = {c2} ) & ( c2 in the Transitions of c1 implies b1 = Pre c1,c2 ) & ( c2 in the Places of c1 implies b2 = {c2} ) & ( c2 in the Transitions of c1 implies b2 = Pre c1,c2 ) holds
b1 = b2
by E15, Th6;
end;

:: deftheorem Def9 defines enter NET_1:def 9 :
for b1 being Pnet
for b2 being Element of Elements b1 st Elements b1 <> {} holds
for b3 being set holds
( b3 = enter b1,b2 iff ( ( b2 in the Places of b1 implies b3 = {b2} ) & ( b2 in the Transitions of b1 implies b3 = Pre b1,b2 ) ) );

theorem Th22: :: NET_1:22
for b1 being Pnet
for b2 being Element of Elements b1 holds
( not Elements b1 <> {} or enter b1,b2 = {b2} or enter b1,b2 = Pre b1,b2 )
proof end;

theorem Th23: :: NET_1:23
for b1 being Pnet
for b2 being Element of Elements b1 st Elements b1 <> {} holds
enter b1,b2 c= Elements b1
proof end;

theorem Th24: :: NET_1:24
for b1 being Pnet
for b2 being Element of Elements b1 st Elements b1 <> {} holds
enter b1,b2 c= Elements b1 by Th23;

definition
let c1 be Pnet;
let c2 be Element of Elements c1;
assume E18: Elements c1 <> {} ;
func exit c1,c2 -> set means :Def10: :: NET_1:def 10
( ( a2 in the Places of a1 implies a3 = {a2} ) & ( a2 in the Transitions of a1 implies a3 = Post a1,a2 ) );
existence
ex b1 being set st
( ( c2 in the Places of c1 implies b1 = {c2} ) & ( c2 in the Transitions of c1 implies b1 = Post c1,c2 ) )
proof end;
uniqueness
for b1, b2 being set st ( c2 in the Places of c1 implies b1 = {c2} ) & ( c2 in the Transitions of c1 implies b1 = Post c1,c2 ) & ( c2 in the Places of c1 implies b2 = {c2} ) & ( c2 in the Transitions of c1 implies b2 = Post c1,c2 ) holds
b1 = b2
by E18, Th6;
end;

:: deftheorem Def10 defines exit NET_1:def 10 :
for b1 being Pnet
for b2 being Element of Elements b1 st Elements b1 <> {} holds
for b3 being set holds
( b3 = exit b1,b2 iff ( ( b2 in the Places of b1 implies b3 = {b2} ) & ( b2 in the Transitions of b1 implies b3 = Post b1,b2 ) ) );

theorem Th25: :: NET_1:25
for b1 being Pnet
for b2 being Element of Elements b1 holds
( not Elements b1 <> {} or exit b1,b2 = {b2} or exit b1,b2 = Post b1,b2 )
proof end;

theorem Th26: :: NET_1:26
for b1 being Pnet
for b2 being Element of Elements b1 st Elements b1 <> {} holds
exit b1,b2 c= Elements b1
proof end;

theorem Th27: :: NET_1:27
for b1 being Pnet
for b2 being Element of Elements b1 st Elements b1 <> {} holds
exit b1,b2 c= Elements b1 by Th26;

definition
let c1 be Pnet;
let c2 be Element of Elements c1;
func field c1,c2 -> set equals :: NET_1:def 11
(enter a1,a2) \/ (exit a1,a2);
correctness
coherence
(enter c1,c2) \/ (exit c1,c2) is set
;
;
end;

:: deftheorem Def11 defines field NET_1:def 11 :
for b1 being Pnet
for b2 being Element of Elements b1 holds field b1,b2 = (enter b1,b2) \/ (exit b1,b2);

definition
let c1 be Net ;
let c2 be Element of the Transitions of c1;
func Prec c1,c2 -> set means :: NET_1:def 12
for b1 being set holds
( b1 in a3 iff ( b1 in the Places of a1 & [b1,a2] in the Flow of a1 ) );
existence
ex b1 being set st
for b2 being set holds
( b2 in b1 iff ( b2 in the Places of c1 & [b2,c2] in the Flow of c1 ) )
proof end;
uniqueness
for b1, b2 being set st ( for b3 being set holds
( b3 in b1 iff ( b3 in the Places of c1 & [b3,c2] in the Flow of c1 ) ) ) & ( for b3 being set holds
( b3 in b2 iff ( b3 in the Places of c1 & [b3,c2] in the Flow of c1 ) ) ) holds
b1 = b2
proof end;
func Postc c1,c2 -> set means :: NET_1:def 13
for b1 being set holds
( b1 in a3 iff ( b1 in the Places of a1 & [a2,b1] in the Flow of a1 ) );
existence
ex b1 being set st
for b2 being set holds
( b2 in b1 iff ( b2 in the Places of c1 & [c2,b2] in the Flow of c1 ) )
proof end;
uniqueness
for b1, b2 being set st ( for b3 being set holds
( b3 in b1 iff ( b3 in the Places of c1 & [c2,b3] in the Flow of c1 ) ) ) & ( for b3 being set holds
( b3 in b2 iff ( b3 in the Places of c1 & [c2,b3] in the Flow of c1 ) ) ) holds
b1 = b2
proof end;
end;

:: deftheorem Def12 defines Prec NET_1:def 12 :
for b1 being Net
for b2 being Element of the Transitions of b1
for b3 being set holds
( b3 = Prec b1,b2 iff for b4 being set holds
( b4 in b3 iff ( b4 in the Places of b1 & [b4,b2] in the Flow of b1 ) ) );

:: deftheorem Def13 defines Postc NET_1:def 13 :
for b1 being Net
for b2 being Element of the Transitions of b1
for b3 being set holds
( b3 = Postc b1,b2 iff for b4 being set holds
( b4 in b3 iff ( b4 in the Places of b1 & [b2,b4] in the Flow of b1 ) ) );

definition
let c1 be Pnet;
let c2 be set ;
func Entr c1,c2 -> set means :Def14: :: NET_1:def 14
for b1 being set holds
( b1 in a3 iff ( b1 c= Elements a1 & ex b2 being Element of Elements a1 st
( b2 in a2 & b1 = enter a1,b2 ) ) );
existence
ex b1 being set st
for b2 being set holds
( b2 in b1 iff ( b2 c= Elements c1 & ex b3 being Element of Elements c1 st
( b3 in c2 & b2 = enter c1,b3 ) ) )
proof end;
uniqueness
for b1, b2 being set st ( for b3 being set holds
( b3 in b1 iff ( b3 c= Elements c1 & ex b4 being Element of Elements c1 st
( b4 in c2 & b3 = enter c1,b4 ) ) ) ) & ( for b3 being set holds
( b3 in b2 iff ( b3 c= Elements c1 & ex b4 being Element of Elements c1 st
( b4 in c2 & b3 = enter c1,b4 ) ) ) ) holds
b1 = b2
proof end;
func Ext c1,c2 -> set means :Def15: :: NET_1:def 15
for b1 being set holds
( b1 in a3 iff ( b1 c= Elements a1 & ex b2 being Element of Elements a1 st
( b2 in a2 & b1 = exit a1,b2 ) ) );
existence
ex b1 being set st
for b2 being set holds
( b2 in b1 iff ( b2 c= Elements c1 & ex b3 being Element of Elements c1 st
( b3 in c2 & b2 = exit c1,b3 ) ) )
proof end;
uniqueness
for b1, b2 being set st ( for b3 being set holds
( b3 in b1 iff ( b3 c= Elements c1 & ex b4 being Element of Elements c1 st
( b4 in c2 & b3 = exit c1,b4 ) ) ) ) & ( for b3 being set holds
( b3 in b2 iff ( b3 c= Elements c1 & ex b4 being Element of Elements c1 st
( b4 in c2 & b3 = exit c1,b4 ) ) ) ) holds
b1 = b2
proof end;
end;

:: deftheorem Def14 defines Entr NET_1:def 14 :
for b1 being Pnet
for b2 being set
for b3 being set holds
( b3 = Entr b1,b2 iff for b4 being set holds
( b4 in b3 iff ( b4 c= Elements b1 & ex b5 being Element of Elements b1 st
( b5 in b2 & b4 = enter b1,b5 ) ) ) );

:: deftheorem Def15 defines Ext NET_1:def 15 :
for b1 being Pnet
for b2 being set
for b3 being set holds
( b3 = Ext b1,b2 iff for b4 being set holds
( b4 in b3 iff ( b4 c= Elements b1 & ex b5 being Element of Elements b1 st
( b5 in b2 & b4 = exit b1,b5 ) ) ) );

theorem Th28: :: NET_1:28
for b1 being Pnet
for b2 being Element of Elements b1
for b3 being set st Elements b1 <> {} & b3 c= Elements b1 & b2 in b3 holds
enter b1,b2 in Entr b1,b3
proof end;

theorem Th29: :: NET_1:29
for b1 being Pnet
for b2 being Element of Elements b1
for b3 being set st Elements b1 <> {} & b3 c= Elements b1 & b2 in b3 holds
exit b1,b2 in Ext b1,b3
proof end;

definition
let c1 be Pnet;
let c2 be set ;
func Input c1,c2 -> set equals :: NET_1:def 16
union (Entr a1,a2);
correctness
coherence
union (Entr c1,c2) is set
;
;
func Output c1,c2 -> set equals :: NET_1:def 17
union (Ext a1,a2);
correctness
coherence
union (Ext c1,c2) is set
;
;
end;

:: deftheorem Def16 defines Input NET_1:def 16 :
for b1 being Pnet
for b2 being set holds Input b1,b2 = union (Entr b1,b2);

:: deftheorem Def17 defines Output NET_1:def 17 :
for b1 being Pnet
for b2 being set holds Output b1,b2 = union (Ext b1,b2);

theorem Th30: :: NET_1:30
for b1 being Pnet
for b2, b3 being set st Elements b1 <> {} & b3 c= Elements b1 holds
( b2 in Input b1,b3 iff ex b4 being Element of Elements b1 st
( b4 in b3 & b2 in enter b1,b4 ) )
proof end;

theorem Th31: :: NET_1:31
for b1 being Pnet
for b2, b3 being set st Elements b1 <> {} & b3 c= Elements b1 holds
( b2 in Output b1,b3 iff ex b4 being Element of Elements b1 st
( b4 in b3 & b2 in exit b1,b4 ) )
proof end;

theorem Th32: :: NET_1:32
for b1 being Pnet
for b2 being Subset of (Elements b1)
for b3 being Element of Elements b1 st Elements b1 <> {} holds
( b3 in Input b1,b2 iff ( ( b3 in b2 & b3 in the Places of b1 ) or ex b4 being Element of Elements b1 st
( b4 in b2 & b4 in the Transitions of b1 & pre b1,b4,b3 ) ) )
proof end;

theorem Th33: :: NET_1:33
for b1 being Pnet
for b2 being Subset of (Elements b1)
for b3 being Element of Elements b1 st Elements b1 <> {} holds
( b3 in Output b1,b2 iff ( ( b3 in b2 & b3 in the Places of b1 ) or ex b4 being Element of Elements b1 st
( b4 in b2 & b4 in the Transitions of b1 & post b1,b4,b3 ) ) )
proof end;