:: GRAPH_2 semantic presentation

scheme :: GRAPH_2:sch 1
s1{ F1() -> Nat, F2() -> Nat, F3( set ) -> set , P1[ Nat] } :
{ F3(b1) where B is Nat : ( F1() <= b1 & b1 <= F2() & P1[b1] ) } is finite
proof end;

theorem Th1: :: GRAPH_2:1
for b1, b2, b3 being Nat holds
( ( b1 + 1 <= b2 & b2 <= b3 ) iff ex b4 being Nat st
( b1 <= b4 & b4 < b3 & b2 = b4 + 1 ) )
proof end;

theorem Th2: :: GRAPH_2:2
for b1, b2 being FinSequence
for b3 being Nat st b1 = b2 | (Seg b3) holds
( len b1 <= len b2 & ( for b4 being Nat st 1 <= b4 & b4 <= len b1 holds
b2 . b4 = b1 . b4 ) )
proof end;

theorem Th3: :: GRAPH_2:3
for b1, b2 being set
for b3 being Nat st b1 c= Seg b3 & b2 c= dom (Sgm b1) holds
(Sgm b1) * (Sgm b2) = Sgm (rng ((Sgm b1) | b2))
proof end;

Lemma4: for b1, b2 being Nat
for b3 being finite set st b3 = { b4 where B is Nat : ( b1 <= b4 & b4 <= b1 + b2 ) } holds
card b3 = b2 + 1
proof end;

theorem Th4: :: GRAPH_2:4
for b1, b2 being Nat holds Card { b3 where B is Nat : ( b1 <= b3 & b3 <= b1 + b2 ) } = b2 + 1
proof end;

theorem Th5: :: GRAPH_2:5
for b1, b2, b3 being Nat st 1 <= b3 & b3 <= b1 holds
(Sgm { b4 where B is Nat : ( b2 + 1 <= b4 & b4 <= b2 + b1 ) } ) . b3 = b2 + b3
proof end;

definition
let c1 be FinSequence;
let c2, c3 be Nat;
func c2,c3 -cut c1 -> FinSequence means :Def1: :: GRAPH_2:def 1
( (len a4) + a2 = a3 + 1 & ( for b1 being Nat st b1 < len a4 holds
a4 . (b1 + 1) = a1 . (a2 + b1) ) ) if ( 1 <= a2 & a2 <= a3 + 1 & a3 <= len a1 )
otherwise a4 = {} ;
consistency
for b1 being FinSequence holds verum
;
existence
( ( 1 <= c2 & c2 <= c3 + 1 & c3 <= len c1 implies ex b1 being FinSequence st
( (len b1) + c2 = c3 + 1 & ( for b2 being Nat st b2 < len b1 holds
b1 . (b2 + 1) = c1 . (c2 + b2) ) ) ) & ( ( not 1 <= c2 or not c2 <= c3 + 1 or not c3 <= len c1 ) implies ex b1 being FinSequence st b1 = {} ) )
proof end;
uniqueness
for b1, b2 being FinSequence holds
( ( 1 <= c2 & c2 <= c3 + 1 & c3 <= len c1 & (len b1) + c2 = c3 + 1 & ( for b3 being Nat st b3 < len b1 holds
b1 . (b3 + 1) = c1 . (c2 + b3) ) & (len b2) + c2 = c3 + 1 & ( for b3 being Nat st b3 < len b2 holds
b2 . (b3 + 1) = c1 . (c2 + b3) ) implies b1 = b2 ) & ( ( not 1 <= c2 or not c2 <= c3 + 1 or not c3 <= len c1 ) & b1 = {} & b2 = {} implies b1 = b2 ) )
proof end;
end;

:: deftheorem Def1 defines -cut GRAPH_2:def 1 :
for b1 being FinSequence
for b2, b3 being Nat
for b4 being FinSequence holds
( ( 1 <= b2 & b2 <= b3 + 1 & b3 <= len b1 implies ( b4 = b2,b3 -cut b1 iff ( (len b4) + b2 = b3 + 1 & ( for b5 being Nat st b5 < len b4 holds
b4 . (b5 + 1) = b1 . (b2 + b5) ) ) ) ) & ( ( not 1 <= b2 or not b2 <= b3 + 1 or not b3 <= len b1 ) implies ( b4 = b2,b3 -cut b1 iff b4 = {} ) ) );

theorem Th6: :: GRAPH_2:6
for b1 being FinSequence
for b2 being Nat st 1 <= b2 & b2 <= len b1 holds
b2,b2 -cut b1 = <*(b1 . b2)*>
proof end;

theorem Th7: :: GRAPH_2:7
for b1 being FinSequence holds 1,(len b1) -cut b1 = b1
proof end;

theorem Th8: :: GRAPH_2:8
for b1 being FinSequence
for b2, b3, b4 being Nat st b2 <= b3 & b3 <= b4 & b4 <= len b1 holds
((b2 + 1),b3 -cut b1) ^ ((b3 + 1),b4 -cut b1) = (b2 + 1),b4 -cut b1
proof end;

theorem Th9: :: GRAPH_2:9
for b1 being FinSequence
for b2 being Nat st b2 <= len b1 holds
(1,b2 -cut b1) ^ ((b2 + 1),(len b1) -cut b1) = b1
proof end;

theorem Th10: :: GRAPH_2:10
for b1 being FinSequence
for b2, b3 being Nat st b2 <= b3 & b3 <= len b1 holds
((1,b2 -cut b1) ^ ((b2 + 1),b3 -cut b1)) ^ ((b3 + 1),(len b1) -cut b1) = b1
proof end;

theorem Th11: :: GRAPH_2:11
for b1 being FinSequence
for b2, b3 being Nat holds rng (b2,b3 -cut b1) c= rng b1
proof end;

definition
let c1 be set ;
let c2 be FinSequence of c1;
let c3, c4 be Nat;
redefine func -cut as c3,c4 -cut c2 -> FinSequence of a1;
coherence
c3,c4 -cut c2 is FinSequence of c1
proof end;
end;

theorem Th12: :: GRAPH_2:12
for b1 being FinSequence
for b2, b3 being Nat st 1 <= b2 & b2 <= b3 & b3 <= len b1 holds
( (b2,b3 -cut b1) . 1 = b1 . b2 & (b2,b3 -cut b1) . (len (b2,b3 -cut b1)) = b1 . b3 )
proof end;

definition
let c1, c2 be FinSequence;
func c1 ^' c2 -> FinSequence equals :: GRAPH_2:def 2
a1 ^ (2,(len a2) -cut a2);
correctness
coherence
c1 ^ (2,(len c2) -cut c2) is FinSequence
;
;
end;

:: deftheorem Def2 defines ^' GRAPH_2:def 2 :
for b1, b2 being FinSequence holds b1 ^' b2 = b1 ^ (2,(len b2) -cut b2);

theorem Th13: :: GRAPH_2:13
for b1, b2 being FinSequence st b1 <> {} holds
(len (b2 ^' b1)) + 1 = (len b2) + (len b1)
proof end;

theorem Th14: :: GRAPH_2:14
for b1, b2 being FinSequence
for b3 being Nat st 1 <= b3 & b3 <= len b1 holds
(b1 ^' b2) . b3 = b1 . b3
proof end;

theorem Th15: :: GRAPH_2:15
for b1, b2 being FinSequence
for b3 being Nat st 1 <= b3 & b3 < len b1 holds
(b2 ^' b1) . ((len b2) + b3) = b1 . (b3 + 1)
proof end;

theorem Th16: :: GRAPH_2:16
for b1, b2 being FinSequence st 1 < len b1 holds
(b2 ^' b1) . (len (b2 ^' b1)) = b1 . (len b1)
proof end;

theorem Th17: :: GRAPH_2:17
for b1, b2 being FinSequence holds rng (b1 ^' b2) c= (rng b1) \/ (rng b2)
proof end;

definition
let c1 be set ;
let c2, c3 be FinSequence of c1;
redefine func ^' as c2 ^' c3 -> FinSequence of a1;
coherence
c2 ^' c3 is FinSequence of c1
proof end;
end;

theorem Th18: :: GRAPH_2:18
for b1, b2 being FinSequence st b1 <> {} & b2 <> {} & b1 . (len b1) = b2 . 1 holds
rng (b1 ^' b2) = (rng b1) \/ (rng b2)
proof end;

definition
let c1 be FinSequence;
attr a1 is TwoValued means :Def3: :: GRAPH_2:def 3
card (rng a1) = 2;
end;

:: deftheorem Def3 defines TwoValued GRAPH_2:def 3 :
for b1 being FinSequence holds
( b1 is TwoValued iff card (rng b1) = 2 );

E19: now
set c1 = <*1,2*>;
2 > 1 ;
hence len <*1,2*> > 1 by FINSEQ_1:61;
thus 1 <> 2 ;
thus rng <*1,2*> = rng (<*1*> ^ <*2*>) by FINSEQ_1:def 9
.= (rng <*1*>) \/ (rng <*2*>) by FINSEQ_1:44
.= {1} \/ (rng <*2*>) by FINSEQ_1:55
.= {1} \/ {2} by FINSEQ_1:55
.= {1,2} by ENUMSET1:41 ;
end;

theorem Th19: :: GRAPH_2:19
for b1 being FinSequence holds
( b1 is TwoValued iff ( len b1 > 1 & ex b2, b3 being set st
( b2 <> b3 & rng b1 = {b2,b3} ) ) )
proof end;

then Lemma21: <*1,2*> is TwoValued
by Lemma19;

E22: now
set c1 = <*1,2*>;
let c2 be Nat;
assume that
E23: 1 <= c2 and
E24: c2 + 1 <= len <*1,2*> ;
c2 + 1 <= 1 + 1 by E24, FINSEQ_1:61;
then c2 <= 1 by XREAL_1:8;
then c2 = 1 by E23, XREAL_1:1;
then ( <*1,2*> . c2 = 1 & <*1,2*> . (c2 + 1) = 2 ) by FINSEQ_1:61;
hence <*1,2*> . c2 <> <*1,2*> . (c2 + 1) ;
end;

definition
let c1 be FinSequence;
attr a1 is Alternating means :Def4: :: GRAPH_2:def 4
for b1 being Nat st 1 <= b1 & b1 + 1 <= len a1 holds
a1 . b1 <> a1 . (b1 + 1);
end;

:: deftheorem Def4 defines Alternating GRAPH_2:def 4 :
for b1 being FinSequence holds
( b1 is Alternating iff for b2 being Nat st 1 <= b2 & b2 + 1 <= len b1 holds
b1 . b2 <> b1 . (b2 + 1) );

Lemma24: <*1,2*> is Alternating
by Def4, Lemma22;

registration
cluster TwoValued Alternating set ;
existence
ex b1 being FinSequence st
( b1 is TwoValued & b1 is Alternating )
by Lemma21, Lemma24;
end;

theorem Th20: :: GRAPH_2:20
for b1, b2 being TwoValued Alternating FinSequence st len b1 = len b2 & rng b1 = rng b2 & b1 . 1 = b2 . 1 holds
b1 = b2
proof end;

theorem Th21: :: GRAPH_2:21
for b1, b2 being TwoValued Alternating FinSequence st b1 <> b2 & len b1 = len b2 & rng b1 = rng b2 holds
for b3 being Nat st 1 <= b3 & b3 <= len b1 holds
b1 . b3 <> b2 . b3
proof end;

theorem Th22: :: GRAPH_2:22
for b1, b2 being TwoValued Alternating FinSequence st b1 <> b2 & len b1 = len b2 & rng b1 = rng b2 holds
for b3 being TwoValued Alternating FinSequence st len b3 = len b1 & rng b3 = rng b1 & not b3 = b1 holds
b3 = b2
proof end;

theorem Th23: :: GRAPH_2:23
for b1, b2 being set
for b3 being Nat st b1 <> b2 & b3 > 1 holds
ex b4 being TwoValued Alternating FinSequence st
( rng b4 = {b1,b2} & len b4 = b3 & b4 . 1 = b1 )
proof end;

definition
let c1 be set ;
let c2 be FinSequence of c1;
mode FinSubsequence of c2 -> FinSubsequence means :Def5: :: GRAPH_2:def 5
a3 c= a2;
existence
ex b1 being FinSubsequence st b1 c= c2
proof end;
end;

:: deftheorem Def5 defines FinSubsequence GRAPH_2:def 5 :
for b1 being set
for b2 being FinSequence of b1
for b3 being FinSubsequence holds
( b3 is FinSubsequence of b2 iff b3 c= b2 );

theorem Th24: :: GRAPH_2:24
for b1 being FinSubsequence st b1 is FinSequence holds
Seq b1 = b1
proof end;

theorem Th25: :: GRAPH_2:25
canceled;

theorem Th26: :: GRAPH_2:26
for b1 being FinSubsequence
for b2, b3, b4, b5, b6 being FinSequence st rng b2 c= dom b1 & rng b3 c= dom b1 & b4 = b1 * b2 & b5 = b1 * b3 & b6 = b1 * (b2 ^ b3) holds
b6 = b4 ^ b5
proof end;

theorem Th27: :: GRAPH_2:27
for b1 being set
for b2 being FinSequence of b1
for b3 being FinSubsequence of b2 holds
( dom b3 c= dom b2 & rng b3 c= rng b2 )
proof end;

theorem Th28: :: GRAPH_2:28
for b1 being set
for b2 being FinSequence of b1 holds b2 is FinSubsequence of b2
proof end;

theorem Th29: :: GRAPH_2:29
for b1, b2 being set
for b3 being FinSequence of b1
for b4 being FinSubsequence of b3 holds b4 | b2 is FinSubsequence of b3
proof end;

theorem Th30: :: GRAPH_2:30
for b1 being set
for b2, b3, b4 being FinSequence of b1
for b5, b6 being FinSubsequence of b2
for b7 being FinSubsequence of b3 st Seq b5 = b3 & Seq b7 = b4 & b6 = b5 | (rng ((Sgm (dom b5)) | (dom b7))) holds
Seq b6 = b4
proof end;

registration
let c1 be Graph;
cluster the Vertices of a1 -> non empty ;
coherence
not the Vertices of c1 is empty
by GRAPH_1:def 1;
end;

theorem Th31: :: GRAPH_2:31
for b1 being Graph
for b2, b3 being Element of the Vertices of b1
for b4 being set st b4 joins b2,b3 holds
b4 joins b3,b2
proof end;

theorem Th32: :: GRAPH_2:32
for b1 being Graph
for b2, b3, b4, b5 being Element of the Vertices of b1
for b6 being set st b6 joins b2,b3 & b6 joins b4,b5 & not ( b2 = b4 & b3 = b5 ) holds
( b2 = b5 & b3 = b4 )
proof end;

registration
let c1 be Graph;
cluster empty Chain of a1;
existence
ex b1 being Chain of c1 st b1 is empty
proof end;
end;

definition
let c1 be Graph;
let c2 be set ;
func c1 -VSet c2 -> set equals :: GRAPH_2:def 6
{ b1 where B is Element of the Vertices of a1 : ex b1 being Element of the Edges of a1 st
( b2 in a2 & ( b1 = the Source of a1 . b2 or b1 = the Target of a1 . b2 ) )
}
;
correctness
coherence
{ b1 where B is Element of the Vertices of c1 : ex b1 being Element of the Edges of c1 st
( b2 in c2 & ( b1 = the Source of c1 . b2 or b1 = the Target of c1 . b2 ) )
}
is set
;
;
end;

:: deftheorem Def6 defines -VSet GRAPH_2:def 6 :
for b1 being Graph
for b2 being set holds b1 -VSet b2 = { b3 where B is Element of the Vertices of b1 : ex b1 being Element of the Edges of b1 st
( b4 in b2 & ( b3 = the Source of b1 . b4 or b3 = the Target of b1 . b4 ) )
}
;

definition
let c1 be Graph;
let c2 be FinSequence of the Vertices of c1;
let c3 be FinSequence;
pred c2 is_vertex_seq_of c3 means :Def7: :: GRAPH_2:def 7
( len a2 = (len a3) + 1 & ( for b1 being Nat st 1 <= b1 & b1 <= len a3 holds
a3 . b1 joins a2 /. b1,a2 /. (b1 + 1) ) );
end;

:: deftheorem Def7 defines is_vertex_seq_of GRAPH_2:def 7 :
for b1 being Graph
for b2 being FinSequence of the Vertices of b1
for b3 being FinSequence holds
( b2 is_vertex_seq_of b3 iff ( len b2 = (len b3) + 1 & ( for b4 being Nat st 1 <= b4 & b4 <= len b3 holds
b3 . b4 joins b2 /. b4,b2 /. (b4 + 1) ) ) );

theorem Th33: :: GRAPH_2:33
canceled;

theorem Th34: :: GRAPH_2:34
for b1 being Graph
for b2 being FinSequence of the Vertices of b1
for b3 being Chain of b1 st b3 <> {} & b2 is_vertex_seq_of b3 holds
b1 -VSet (rng b3) = rng b2
proof end;

theorem Th35: :: GRAPH_2:35
for b1 being Graph
for b2 being Element of the Vertices of b1 holds <*b2*> is_vertex_seq_of {}
proof end;

theorem Th36: :: GRAPH_2:36
for b1 being Graph
for b2 being Chain of b1 ex b3 being FinSequence of the Vertices of b1 st b3 is_vertex_seq_of b2
proof end;

theorem Th37: :: GRAPH_2:37
for b1 being Graph
for b2, b3 being FinSequence of the Vertices of b1
for b4 being Chain of b1 st b4 <> {} & b2 is_vertex_seq_of b4 & b3 is_vertex_seq_of b4 & b2 <> b3 holds
( b2 . 1 <> b3 . 1 & ( for b5 being FinSequence of the Vertices of b1 holds
( not b5 is_vertex_seq_of b4 or b5 = b2 or b5 = b3 ) ) )
proof end;

definition
let c1 be Graph;
let c2 be FinSequence;
pred c2 alternates_vertices_in c1 means :Def8: :: GRAPH_2:def 8
( len a2 >= 1 & Card (a1 -VSet (rng a2)) = 2 & ( for b1 being Nat st b1 in dom a2 holds
the Source of a1 . (a2 . b1) <> the Target of a1 . (a2 . b1) ) );
end;

:: deftheorem Def8 defines alternates_vertices_in GRAPH_2:def 8 :
for b1 being Graph
for b2 being FinSequence holds
( b2 alternates_vertices_in b1 iff ( len b2 >= 1 & Card (b1 -VSet (rng b2)) = 2 & ( for b3 being Nat st b3 in dom b2 holds
the Source of b1 . (b2 . b3) <> the Target of b1 . (b2 . b3) ) ) );

theorem Th38: :: GRAPH_2:38
for b1 being Graph
for b2 being FinSequence of the Vertices of b1
for b3 being Chain of b1 st b3 alternates_vertices_in b1 & b2 is_vertex_seq_of b3 holds
for b4 being Nat st b4 in dom b3 holds
b2 . b4 <> b2 . (b4 + 1)
proof end;

theorem Th39: :: GRAPH_2:39
for b1 being Graph
for b2 being FinSequence of the Vertices of b1
for b3 being Chain of b1 st b3 alternates_vertices_in b1 & b2 is_vertex_seq_of b3 holds
rng b2 = {(the Source of b1 . (b3 . 1)),(the Target of b1 . (b3 . 1))}
proof end;

theorem Th40: :: GRAPH_2:40
for b1 being Graph
for b2 being FinSequence of the Vertices of b1
for b3 being Chain of b1 st b3 alternates_vertices_in b1 & b2 is_vertex_seq_of b3 holds
b2 is TwoValued Alternating FinSequence
proof end;

theorem Th41: :: GRAPH_2:41
for b1 being Graph
for b2 being Chain of b1 st b2 alternates_vertices_in b1 holds
ex b3, b4 being FinSequence of the Vertices of b1 st
( b3 <> b4 & b3 is_vertex_seq_of b2 & b4 is_vertex_seq_of b2 & ( for b5 being FinSequence of the Vertices of b1 holds
( not b5 is_vertex_seq_of b2 or b5 = b3 or b5 = b4 ) ) )
proof end;

Lemma48: for b1 being non empty set st ( for b2, b3 being set st b2 in b1 & b3 in b1 holds
b2 = b3 ) holds
Card b1 = 1
proof end;

theorem Th42: :: GRAPH_2:42
for b1 being Graph
for b2 being FinSequence of the Vertices of b1
for b3 being Chain of b1 st b2 is_vertex_seq_of b3 holds
( ( Card the Vertices of b1 = 1 or ( b3 <> {} & not b3 alternates_vertices_in b1 ) ) iff for b4 being FinSequence of the Vertices of b1 st b4 is_vertex_seq_of b3 holds
b4 = b2 )
proof end;

definition
let c1 be Graph;
let c2 be Chain of c1;
assume E50: ( Card the Vertices of c1 = 1 or ( c2 <> {} & not c2 alternates_vertices_in c1 ) ) ;
func vertex-seq c2 -> FinSequence of the Vertices of a1 means :: GRAPH_2:def 9
a3 is_vertex_seq_of a2;
existence
ex b1 being FinSequence of the Vertices of c1 st b1 is_vertex_seq_of c2
by Th36;
uniqueness
for b1, b2 being FinSequence of the Vertices of c1 st b1 is_vertex_seq_of c2 & b2 is_vertex_seq_of c2 holds
b1 = b2
by E50, Th42;
end;

:: deftheorem Def9 defines vertex-seq GRAPH_2:def 9 :
for b1 being Graph
for b2 being Chain of b1 st ( Card the Vertices of b1 = 1 or ( b2 <> {} & not b2 alternates_vertices_in b1 ) ) holds
for b3 being FinSequence of the Vertices of b1 holds
( b3 = vertex-seq b2 iff b3 is_vertex_seq_of b2 );

theorem Th43: :: GRAPH_2:43
for b1 being Nat
for b2 being Graph
for b3, b4 being FinSequence of the Vertices of b2
for b5, b6 being Chain of b2 st b3 is_vertex_seq_of b5 & b6 = b5 | (Seg b1) & b4 = b3 | (Seg (b1 + 1)) holds
b4 is_vertex_seq_of b6
proof end;

theorem Th44: :: GRAPH_2:44
for b1 being FinSequence
for b2, b3 being Nat
for b4 being Graph
for b5 being Chain of b4 st 1 <= b2 & b2 <= b3 & b3 <= len b5 & b1 = b2,b3 -cut b5 holds
b1 is Chain of b4
proof end;

theorem Th45: :: GRAPH_2:45
for b1, b2 being Nat
for b3 being Graph
for b4, b5 being FinSequence of the Vertices of b3
for b6, b7 being Chain of b3 st 1 <= b1 & b1 <= b2 & b2 <= len b6 & b7 = b1,b2 -cut b6 & b4 is_vertex_seq_of b6 & b5 = b1,(b2 + 1) -cut b4 holds
b5 is_vertex_seq_of b7
proof end;

theorem Th46: :: GRAPH_2:46
for b1 being Graph
for b2, b3 being FinSequence of the Vertices of b1
for b4, b5 being Chain of b1 st b2 is_vertex_seq_of b4 & b3 is_vertex_seq_of b5 & b2 . (len b2) = b3 . 1 holds
b4 ^ b5 is Chain of b1
proof end;

theorem Th47: :: GRAPH_2:47
for b1 being Graph
for b2, b3, b4 being FinSequence of the Vertices of b1
for b5, b6, b7 being Chain of b1 st b2 is_vertex_seq_of b5 & b3 is_vertex_seq_of b6 & b2 . (len b2) = b3 . 1 & b7 = b5 ^ b6 & b4 = b2 ^' b3 holds
b4 is_vertex_seq_of b7
proof end;

Lemma55: for b1 being Graph
for b2 being Element of the Vertices of b1 holds <*b2*> is_vertex_seq_of {}
proof end;

definition
let c1 be Graph;
let c2 be Chain of c1;
attr a2 is simple means :Def10: :: GRAPH_2:def 10
ex b1 being FinSequence of the Vertices of a1 st
( b1 is_vertex_seq_of a2 & ( for b2, b3 being Nat st 1 <= b2 & b2 < b3 & b3 <= len b1 & b1 . b2 = b1 . b3 holds
( b2 = 1 & b3 = len b1 ) ) );
end;

:: deftheorem Def10 defines simple GRAPH_2:def 10 :
for b1 being Graph
for b2 being Chain of b1 holds
( b2 is simple iff ex b3 being FinSequence of the Vertices of b1 st
( b3 is_vertex_seq_of b2 & ( for b4, b5 being Nat st 1 <= b4 & b4 < b5 & b5 <= len b3 & b3 . b4 = b3 . b5 holds
( b4 = 1 & b5 = len b3 ) ) ) );

registration
let c1 be Graph;
cluster simple Chain of a1;
existence
ex b1 being Chain of c1 st b1 is simple
proof end;
end;

theorem Th48: :: GRAPH_2:48
canceled;

theorem Th49: :: GRAPH_2:49
for b1 being Nat
for b2 being Graph
for b3 being simple Chain of b2 holds b3 | (Seg b1) is simple Chain of b2
proof end;

theorem Th50: :: GRAPH_2:50
for b1 being Graph
for b2, b3 being FinSequence of the Vertices of b1
for b4 being simple Chain of b1 st 2 < len b4 & b2 is_vertex_seq_of b4 & b3 is_vertex_seq_of b4 holds
b2 = b3
proof end;

theorem Th51: :: GRAPH_2:51
for b1 being Graph
for b2 being FinSequence of the Vertices of b1
for b3 being simple Chain of b1 st b2 is_vertex_seq_of b3 holds
for b4, b5 being Nat st 1 <= b4 & b4 < b5 & b5 <= len b2 & b2 . b4 = b2 . b5 holds
( b4 = 1 & b5 = len b2 )
proof end;

theorem Th52: :: GRAPH_2:52
for b1 being Graph
for b2 being FinSequence of the Vertices of b1
for b3 being Chain of b1 st b3 is not simple Chain of b1 & b2 is_vertex_seq_of b3 holds
ex b4 being FinSubsequence of b3ex b5 being FinSubsequence of b2ex b6 being Chain of b1ex b7 being FinSequence of the Vertices of b1 st
( len b6 < len b3 & b7 is_vertex_seq_of b6 & len b7 < len b2 & b2 . 1 = b7 . 1 & b2 . (len b2) = b7 . (len b7) & Seq b4 = b6 & Seq b5 = b7 )
proof end;

theorem Th53: :: GRAPH_2:53
for b1 being Graph
for b2 being FinSequence of the Vertices of b1
for b3 being Chain of b1 st b2 is_vertex_seq_of b3 holds
ex b4 being FinSubsequence of b3ex b5 being FinSubsequence of b2ex b6 being simple Chain of b1ex b7 being FinSequence of the Vertices of b1 st
( Seq b4 = b6 & Seq b5 = b7 & b7 is_vertex_seq_of b6 & b2 . 1 = b7 . 1 & b2 . (len b2) = b7 . (len b7) )
proof end;

registration
let c1 be Graph;
cluster empty -> V5 Chain of a1;
correctness
coherence
for b1 being Chain of c1 st b1 is empty holds
b1 is one-to-one
;
;
end;

theorem Th54: :: GRAPH_2:54
for b1 being FinSequence
for b2 being Nat
for b3 being Graph st b1 is Path of b3 holds
b1 | (Seg b2) is Path of b3
proof end;

registration
let c1 be Graph;
cluster simple Chain of a1;
existence
ex b1 being Path of c1 st b1 is simple
proof end;
end;

theorem Th55: :: GRAPH_2:55
for b1 being Graph
for b2 being simple Chain of b1 st 2 < len b2 holds
b2 is Path of b1
proof end;

theorem Th56: :: GRAPH_2:56
for b1 being Graph
for b2 being simple Chain of b1 holds
( b2 is Path of b1 iff ( len b2 = 0 or len b2 = 1 or b2 . 1 <> b2 . 2 ) )
proof end;

registration
let c1 be Graph;
cluster empty -> oriented Chain of a1;
correctness
coherence
for b1 being Chain of c1 st b1 is empty holds
b1 is oriented
;
proof end;
end;

definition
let c1 be Graph;
let c2 be oriented Chain of c1;
assume E59: c2 <> {} ;
func vertex-seq c2 -> FinSequence of the Vertices of a1 means :: GRAPH_2:def 11
( a3 is_vertex_seq_of a2 & a3 . 1 = the Source of a1 . (a2 . 1) );
existence
ex b1 being FinSequence of the Vertices of c1 st
( b1 is_vertex_seq_of c2 & b1 . 1 = the Source of c1 . (c2 . 1) )
proof end;
uniqueness
for b1, b2 being FinSequence of the Vertices of c1 st b1 is_vertex_seq_of c2 & b1 . 1 = the Source of c1 . (c2 . 1) & b2 is_vertex_seq_of c2 & b2 . 1 = the Source of c1 . (c2 . 1) holds
b1 = b2
by E59, Th37;
end;

:: deftheorem Def11 defines vertex-seq GRAPH_2:def 11 :
for b1 being Graph
for b2 being oriented Chain of b1 st b2 <> {} holds
for b3 being FinSequence of the Vertices of b1 holds
( b3 = vertex-seq b2 iff ( b3 is_vertex_seq_of b2 & b3 . 1 = the Source of b1 . (b2 . 1) ) );