:: Trees: Connected, Acyclic Graphs
:: by Gilbert Lee
::
:: Received February 22, 2005
:: Copyright (c) 2005-2021 Association of Mizar Users


definition
let G be _Graph;
attr G is connected means :Def1: :: GLIB_002:def 1
for u, v being Vertex of G ex W being Walk of G st W is_Walk_from u,v;
end;

:: deftheorem Def1 defines connected GLIB_002:def 1 :
for G being _Graph holds
( G is connected iff for u, v being Vertex of G ex W being Walk of G st W is_Walk_from u,v );

definition
let G be _Graph;
attr G is acyclic means :Def2: :: GLIB_002:def 2
for W being Walk of G holds not W is Cycle-like ;
end;

:: deftheorem Def2 defines acyclic GLIB_002:def 2 :
for G being _Graph holds
( G is acyclic iff for W being Walk of G holds not W is Cycle-like );

definition
let G be _Graph;
attr G is Tree-like means :: GLIB_002:def 3
( G is acyclic & G is connected );
end;

:: deftheorem defines Tree-like GLIB_002:def 3 :
for G being _Graph holds
( G is Tree-like iff ( G is acyclic & G is connected ) );

registration
cluster Relation-like omega -defined Function-like V34() [Graph-like] _trivial -> connected for set ;
coherence
for b1 being _Graph st b1 is _trivial holds
b1 is connected
proof end;
end;

registration
cluster Relation-like omega -defined Function-like V34() [Graph-like] loopless _trivial -> Tree-like for set ;
coherence
for b1 being _Graph st b1 is _trivial & b1 is loopless holds
b1 is Tree-like
proof end;
end;

registration
cluster Relation-like omega -defined Function-like V34() [Graph-like] acyclic -> simple for set ;
coherence
for b1 being _Graph st b1 is acyclic holds
b1 is simple
proof end;
end;

registration
cluster Relation-like omega -defined Function-like V34() [Graph-like] Tree-like -> connected acyclic for set ;
coherence
for b1 being _Graph st b1 is Tree-like holds
( b1 is acyclic & b1 is connected )
;
end;

registration
cluster Relation-like omega -defined Function-like V34() [Graph-like] connected acyclic -> Tree-like for set ;
coherence
for b1 being _Graph st b1 is acyclic & b1 is connected holds
b1 is Tree-like
;
end;

registration
let G be _Graph;
let v be Vertex of G;
cluster -> Tree-like for inducedSubgraph of G,{v}, {} ;
coherence
for b1 being inducedSubgraph of G,{v}, {} holds b1 is Tree-like
;
end;

definition
let G be _Graph;
let v be set ;
pred G is_DTree_rooted_at v means :: GLIB_002:def 4
( G is Tree-like & ( for x being Vertex of G ex W being DWalk of G st W is_Walk_from v,x ) );
end;

:: deftheorem defines is_DTree_rooted_at GLIB_002:def 4 :
for G being _Graph
for v being set holds
( G is_DTree_rooted_at v iff ( G is Tree-like & ( for x being Vertex of G ex W being DWalk of G st W is_Walk_from v,x ) ) );

registration
cluster Relation-like omega -defined Function-like V34() [Graph-like] _finite _trivial Tree-like for set ;
existence
ex b1 being _Graph st
( b1 is _trivial & b1 is _finite & b1 is Tree-like )
proof end;
cluster Relation-like omega -defined Function-like V34() [Graph-like] _finite non _trivial Tree-like for set ;
existence
ex b1 being _Graph st
( not b1 is _trivial & b1 is _finite & b1 is Tree-like )
proof end;
end;

registration
let G be _Graph;
cluster Relation-like omega -defined Function-like V34() [Graph-like] _finite _trivial Tree-like for Subgraph of G;
existence
ex b1 being Subgraph of G st
( b1 is _trivial & b1 is _finite & b1 is Tree-like )
proof end;
end;

registration
let G be acyclic _Graph;
cluster -> acyclic for Subgraph of G;
coherence
for b1 being Subgraph of G holds b1 is acyclic
proof end;
end;

definition
let G be _Graph;
let v be Vertex of G;
func G .reachableFrom v -> non empty Subset of (the_Vertices_of G) means :Def5: :: GLIB_002:def 5
for x being object holds
( x in it iff ex W being Walk of G st W is_Walk_from v,x );
existence
ex b1 being non empty Subset of (the_Vertices_of G) st
for x being object holds
( x in b1 iff ex W being Walk of G st W is_Walk_from v,x )
proof end;
uniqueness
for b1, b2 being non empty Subset of (the_Vertices_of G) st ( for x being object holds
( x in b1 iff ex W being Walk of G st W is_Walk_from v,x ) ) & ( for x being object holds
( x in b2 iff ex W being Walk of G st W is_Walk_from v,x ) ) holds
b1 = b2
proof end;
end;

:: deftheorem Def5 defines .reachableFrom GLIB_002:def 5 :
for G being _Graph
for v being Vertex of G
for b3 being non empty Subset of (the_Vertices_of G) holds
( b3 = G .reachableFrom v iff for x being object holds
( x in b3 iff ex W being Walk of G st W is_Walk_from v,x ) );

definition
let G be _Graph;
let v be Vertex of G;
func G .reachableDFrom v -> non empty Subset of (the_Vertices_of G) means :Def6: :: GLIB_002:def 6
for x being object holds
( x in it iff ex W being DWalk of G st W is_Walk_from v,x );
existence
ex b1 being non empty Subset of (the_Vertices_of G) st
for x being object holds
( x in b1 iff ex W being DWalk of G st W is_Walk_from v,x )
proof end;
uniqueness
for b1, b2 being non empty Subset of (the_Vertices_of G) st ( for x being object holds
( x in b1 iff ex W being DWalk of G st W is_Walk_from v,x ) ) & ( for x being object holds
( x in b2 iff ex W being DWalk of G st W is_Walk_from v,x ) ) holds
b1 = b2
proof end;
end;

:: deftheorem Def6 defines .reachableDFrom GLIB_002:def 6 :
for G being _Graph
for v being Vertex of G
for b3 being non empty Subset of (the_Vertices_of G) holds
( b3 = G .reachableDFrom v iff for x being object holds
( x in b3 iff ex W being DWalk of G st W is_Walk_from v,x ) );

Lm1: for G being _Graph
for v being Vertex of G holds v in G .reachableFrom v

proof end;

Lm2: for G being _Graph
for v1 being Vertex of G
for e, x, y being object st x in G .reachableFrom v1 & e Joins x,y,G holds
y in G .reachableFrom v1

proof end;

Lm3: for G being _Graph
for v1, v2 being Vertex of G st v1 in G .reachableFrom v2 holds
G .reachableFrom v1 = G .reachableFrom v2

proof end;

Lm4: for G being _Graph
for W being Walk of G
for v being Vertex of G st v in W .vertices() holds
W .vertices() c= G .reachableFrom v

proof end;

definition
let G1 be _Graph;
let G2 be Subgraph of G1;
attr G2 is Component-like means :Def7: :: GLIB_002:def 7
( G2 is connected & ( for G3 being connected Subgraph of G1 holds not G2 c< G3 ) );
end;

:: deftheorem Def7 defines Component-like GLIB_002:def 7 :
for G1 being _Graph
for G2 being Subgraph of G1 holds
( G2 is Component-like iff ( G2 is connected & ( for G3 being connected Subgraph of G1 holds not G2 c< G3 ) ) );

registration
let G be _Graph;
cluster Component-like -> connected for Subgraph of G;
coherence
for b1 being Subgraph of G st b1 is Component-like holds
b1 is connected
;
end;

registration
let G be _Graph;
let v be Vertex of G;
cluster -> Component-like for inducedSubgraph of G,G .reachableFrom v,G .edgesBetween (G .reachableFrom v);
coherence
for b1 being inducedSubgraph of G,(G .reachableFrom v) holds b1 is Component-like
proof end;
end;

registration
let G be _Graph;
cluster Relation-like omega -defined Function-like V34() [Graph-like] Component-like for Subgraph of G;
existence
ex b1 being Subgraph of G st b1 is Component-like
proof end;
end;

definition
let G be _Graph;
mode Component of G is Component-like Subgraph of G;
end;

definition
let G be _Graph;
func G .componentSet() -> non empty Subset-Family of (the_Vertices_of G) means :Def8: :: GLIB_002:def 8
for x being set holds
( x in it iff ex v being Vertex of G st x = G .reachableFrom v );
existence
ex b1 being non empty Subset-Family of (the_Vertices_of G) st
for x being set holds
( x in b1 iff ex v being Vertex of G st x = G .reachableFrom v )
proof end;
uniqueness
for b1, b2 being non empty Subset-Family of (the_Vertices_of G) st ( for x being set holds
( x in b1 iff ex v being Vertex of G st x = G .reachableFrom v ) ) & ( for x being set holds
( x in b2 iff ex v being Vertex of G st x = G .reachableFrom v ) ) holds
b1 = b2
proof end;
end;

:: deftheorem Def8 defines .componentSet() GLIB_002:def 8 :
for G being _Graph
for b2 being non empty Subset-Family of (the_Vertices_of G) holds
( b2 = G .componentSet() iff for x being set holds
( x in b2 iff ex v being Vertex of G st x = G .reachableFrom v ) );

registration
let G be _Graph;
let X be Element of G .componentSet() ;
cluster -> Component-like for inducedSubgraph of G,X,G .edgesBetween X;
coherence
for b1 being inducedSubgraph of G,X holds b1 is Component-like
proof end;
end;

definition
let G be _Graph;
func G .numComponents() -> Cardinal equals :: GLIB_002:def 9
card (G .componentSet());
coherence
card (G .componentSet()) is Cardinal
;
end;

:: deftheorem defines .numComponents() GLIB_002:def 9 :
for G being _Graph holds G .numComponents() = card (G .componentSet());

definition
let G be _finite _Graph;
:: original: .numComponents()
redefine func G .numComponents() -> non zero Element of NAT ;
coherence
G .numComponents() is non zero Element of NAT
proof end;
end;

definition
let G be _Graph;
let v be Vertex of G;
attr v is cut-vertex means :: GLIB_002:def 10
for G2 being removeVertex of G,v holds G .numComponents() in G2 .numComponents() ;
end;

:: deftheorem defines cut-vertex GLIB_002:def 10 :
for G being _Graph
for v being Vertex of G holds
( v is cut-vertex iff for G2 being removeVertex of G,v holds G .numComponents() in G2 .numComponents() );

definition
let G be _finite _Graph;
let v be Vertex of G;
redefine attr v is cut-vertex means :: GLIB_002:def 11
for G2 being removeVertex of G,v holds G .numComponents() < G2 .numComponents() ;
compatibility
( v is cut-vertex iff for G2 being removeVertex of G,v holds G .numComponents() < G2 .numComponents() )
proof end;
end;

:: deftheorem defines cut-vertex GLIB_002:def 11 :
for G being _finite _Graph
for v being Vertex of G holds
( v is cut-vertex iff for G2 being removeVertex of G,v holds G .numComponents() < G2 .numComponents() );

Lm5: for G1 being non _trivial connected _Graph
for v being Vertex of G1
for G2 being removeVertex of G1,v st v is endvertex holds
G2 is connected

proof end;

Lm6: for G being _Graph st ex v1 being Vertex of G st
for v2 being Vertex of G ex W being Walk of G st W is_Walk_from v1,v2 holds
G is connected

proof end;

Lm7: for G being _Graph st ex v being Vertex of G st G .reachableFrom v = the_Vertices_of G holds
G is connected

proof end;

Lm8: for G being _Graph st G is connected holds
for v being Vertex of G holds G .reachableFrom v = the_Vertices_of G

proof end;

Lm9: for G1, G2 being _Graph
for v1 being Vertex of G1
for v2 being Vertex of G2 st G1 == G2 & v1 = v2 holds
G1 .reachableFrom v1 = G2 .reachableFrom v2

proof end;

Lm10: for G1 being _Graph
for G2 being connected Subgraph of G1 st G2 is spanning holds
G1 is connected

proof end;

Lm11: for G being _Graph holds
( G is connected iff G .componentSet() = {(the_Vertices_of G)} )

proof end;

Lm12: for G1, G2 being _Graph st G1 == G2 holds
G1 .componentSet() = G2 .componentSet()

proof end;

Lm13: for G being _Graph
for x being set st x in G .componentSet() holds
x is non empty Subset of (the_Vertices_of G)

proof end;

Lm14: for G being _Graph
for C being Component of G holds the_Edges_of C = G .edgesBetween (the_Vertices_of C)

proof end;

Lm15: for G being _Graph
for C1, C2 being Component of G holds
( the_Vertices_of C1 = the_Vertices_of C2 iff C1 == C2 )

proof end;

Lm16: for G being _Graph
for C being Component of G
for v being Vertex of G holds
( v in the_Vertices_of C iff the_Vertices_of C = G .reachableFrom v )

proof end;

Lm17: for G being _Graph
for C1, C2 being Component of G
for v being set st v in the_Vertices_of C1 & v in the_Vertices_of C2 holds
C1 == C2

proof end;

Lm18: for G being _Graph holds
( G is connected iff G .numComponents() = 1 )

proof end;

Lm19: for G being connected _Graph
for v being Vertex of G holds
( not v is cut-vertex iff for G2 being removeVertex of G,v holds G2 .numComponents() c= G .numComponents() )

proof end;

Lm20: for G being connected _Graph
for v being Vertex of G
for G2 being removeVertex of G,v st not v is cut-vertex holds
G2 is connected

proof end;

Lm21: for G being _finite non _trivial connected _Graph ex v1, v2 being Vertex of G st
( v1 <> v2 & not v1 is cut-vertex & not v2 is cut-vertex )

proof end;

registration
let G be _finite non _trivial connected _Graph;
cluster non cut-vertex for Element of the_Vertices_of G;
existence
not for b1 being Vertex of G holds b1 is cut-vertex
proof end;
end;

Lm22: for G being acyclic _Graph
for W being Path of G
for e being set st not e in W .edges() & e in (W .last()) .edgesInOut() holds
W .addEdge e is Path-like

proof end;

Lm23: for G being _finite non _trivial acyclic _Graph st the_Edges_of G <> {} holds
ex v1, v2 being Vertex of G st
( v1 <> v2 & v1 is endvertex & v2 is endvertex & v2 in G .reachableFrom v1 )

proof end;

Lm24: for G being _finite non _trivial Tree-like _Graph ex v1, v2 being Vertex of G st
( v1 <> v2 & v1 is endvertex & v2 is endvertex )

proof end;

registration
let G be _finite non _trivial Tree-like _Graph;
cluster endvertex for Element of the_Vertices_of G;
existence
ex b1 being Vertex of G st b1 is endvertex
proof end;
end;

registration
let G be _finite non _trivial Tree-like _Graph;
let v be endvertex Vertex of G;
cluster -> Tree-like for inducedSubgraph of G,(the_Vertices_of G) \ {v},G .edgesBetween ((the_Vertices_of G) \ {v});
coherence
for b1 being removeVertex of G,v holds b1 is Tree-like
by Lm5;
end;

definition
let GF be Graph-yielding Function;
attr GF is connected means :: GLIB_002:def 12
for x being object st x in dom GF holds
ex G being _Graph st
( GF . x = G & G is connected );
attr GF is acyclic means :: GLIB_002:def 13
for x being object st x in dom GF holds
ex G being _Graph st
( GF . x = G & G is acyclic );
attr GF is Tree-like means :: GLIB_002:def 14
for x being object st x in dom GF holds
ex G being _Graph st
( GF . x = G & G is Tree-like );
end;

:: deftheorem defines connected GLIB_002:def 12 :
for GF being Graph-yielding Function holds
( GF is connected iff for x being object st x in dom GF holds
ex G being _Graph st
( GF . x = G & G is connected ) );

:: deftheorem defines acyclic GLIB_002:def 13 :
for GF being Graph-yielding Function holds
( GF is acyclic iff for x being object st x in dom GF holds
ex G being _Graph st
( GF . x = G & G is acyclic ) );

:: deftheorem defines Tree-like GLIB_002:def 14 :
for GF being Graph-yielding Function holds
( GF is Tree-like iff for x being object st x in dom GF holds
ex G being _Graph st
( GF . x = G & G is Tree-like ) );

definition
let GF be non empty Graph-yielding Function;
redefine attr GF is connected means :Def12b: :: GLIB_002:def 15
for x being Element of dom GF holds GF . x is connected ;
compatibility
( GF is connected iff for x being Element of dom GF holds GF . x is connected )
proof end;
redefine attr GF is acyclic means :Def13b: :: GLIB_002:def 16
for x being Element of dom GF holds GF . x is acyclic ;
compatibility
( GF is acyclic iff for x being Element of dom GF holds GF . x is acyclic )
proof end;
redefine attr GF is Tree-like means :: GLIB_002:def 17
for x being Element of dom GF holds GF . x is Tree-like ;
compatibility
( GF is Tree-like iff for x being Element of dom GF holds GF . x is Tree-like )
proof end;
end;

:: deftheorem Def12b defines connected GLIB_002:def 15 :
for GF being non empty Graph-yielding Function holds
( GF is connected iff for x being Element of dom GF holds GF . x is connected );

:: deftheorem Def13b defines acyclic GLIB_002:def 16 :
for GF being non empty Graph-yielding Function holds
( GF is acyclic iff for x being Element of dom GF holds GF . x is acyclic );

:: deftheorem defines Tree-like GLIB_002:def 17 :
for GF being non empty Graph-yielding Function holds
( GF is Tree-like iff for x being Element of dom GF holds GF . x is Tree-like );

LmNat: for F being ManySortedSet of NAT
for n being object holds
( n is Nat iff n in dom F )

proof end;

definition
let GSq be GraphSeq;
redefine attr GSq is connected means :Def12: :: GLIB_002:def 18
for n being Nat holds GSq . n is connected ;
compatibility
( GSq is connected iff for n being Nat holds GSq . n is connected )
proof end;
redefine attr GSq is acyclic means :Def13: :: GLIB_002:def 19
for n being Nat holds GSq . n is acyclic ;
compatibility
( GSq is acyclic iff for n being Nat holds GSq . n is acyclic )
proof end;
redefine attr GSq is Tree-like means :: GLIB_002:def 20
for n being Nat holds GSq . n is Tree-like ;
compatibility
( GSq is Tree-like iff for n being Nat holds GSq . n is Tree-like )
proof end;
end;

:: deftheorem Def12 defines connected GLIB_002:def 18 :
for GSq being GraphSeq holds
( GSq is connected iff for n being Nat holds GSq . n is connected );

:: deftheorem Def13 defines acyclic GLIB_002:def 19 :
for GSq being GraphSeq holds
( GSq is acyclic iff for n being Nat holds GSq . n is acyclic );

:: deftheorem defines Tree-like GLIB_002:def 20 :
for GSq being GraphSeq holds
( GSq is Tree-like iff for n being Nat holds GSq . n is Tree-like );

registration
cluster non empty Relation-like Function-like Graph-yielding connected acyclic Tree-like for set ;
existence
ex b1 being Graph-yielding Function st
( b1 is connected & b1 is acyclic & b1 is Tree-like & not b1 is empty )
proof end;
end;

registration
cluster Relation-like Function-like Graph-yielding _trivial -> Graph-yielding connected for set ;
coherence
for b1 being Graph-yielding Function st b1 is _trivial holds
b1 is connected
proof end;
cluster Relation-like Function-like Graph-yielding loopless _trivial -> Graph-yielding Tree-like for set ;
coherence
for b1 being Graph-yielding Function st b1 is _trivial & b1 is loopless holds
b1 is Tree-like
proof end;
cluster Relation-like Function-like Graph-yielding acyclic -> Graph-yielding simple for set ;
coherence
for b1 being Graph-yielding Function st b1 is acyclic holds
b1 is simple
proof end;
cluster Relation-like Function-like Graph-yielding Tree-like -> Graph-yielding connected acyclic for set ;
coherence
for b1 being Graph-yielding Function st b1 is Tree-like holds
( b1 is acyclic & b1 is connected )
proof end;
cluster Relation-like Function-like Graph-yielding connected acyclic -> Graph-yielding Tree-like for set ;
coherence
for b1 being Graph-yielding Function st b1 is acyclic & b1 is connected holds
b1 is Tree-like
proof end;
end;

registration
cluster non empty Relation-like omega -defined Function-like V30( omega ) Graph-yielding halting _finite Tree-like for set ;
existence
ex b1 being GraphSeq st
( b1 is halting & b1 is _finite & b1 is Tree-like )
proof end;
end;

registration
let GF be non empty Graph-yielding connected Function;
let x be Element of dom GF;
cluster GF . x -> connected for _Graph;
coherence
for b1 being _Graph st b1 = GF . x holds
b1 is connected
by Def12b;
end;

registration
let GF be non empty Graph-yielding acyclic Function;
let x be Element of dom GF;
cluster GF . x -> acyclic for _Graph;
coherence
for b1 being _Graph st b1 = GF . x holds
b1 is acyclic
by Def13b;
end;

registration
let GF be non empty Graph-yielding Tree-like Function;
let x be Element of dom GF;
cluster GF . x -> Tree-like for _Graph;
coherence
for b1 being _Graph st b1 = GF . x holds
b1 is Tree-like
;
end;

registration
let GSq be connected GraphSeq;
let n be Nat;
cluster GSq . n -> connected for _Graph;
coherence
for b1 being _Graph st b1 = GSq . n holds
b1 is connected
by Def12;
end;

registration
let GSq be acyclic GraphSeq;
let n be Nat;
cluster GSq . n -> acyclic for _Graph;
coherence
for b1 being _Graph st b1 = GSq . n holds
b1 is acyclic
by Def13;
end;

registration
let GSq be Tree-like GraphSeq;
let n be Nat;
cluster GSq . n -> Tree-like for _Graph;
coherence
for b1 being _Graph st b1 = GSq . n holds
b1 is Tree-like
;
end;

theorem :: GLIB_002:1
canceled;

::$CT
theorem Th1: :: GLIB_002:2
for G being non _trivial connected _Graph
for v being Vertex of G holds not v is isolated
proof end;

theorem Th2: :: GLIB_002:3
for G1 being non _trivial _Graph
for v being Vertex of G1
for G2 being removeVertex of G1,v st G2 is connected & ex e being set st
( e in v .edgesInOut() & not e Joins v,v,G1 ) holds
G1 is connected
proof end;

theorem :: GLIB_002:4
for G1 being non _trivial connected _Graph
for v being Vertex of G1
for G2 being removeVertex of G1,v st v is endvertex holds
G2 is connected by Lm5;

theorem Th4: :: GLIB_002:5
for G1 being connected _Graph
for W being Walk of G1
for e being set
for G2 being removeEdge of G1,e st W is Cycle-like & e in W .edges() holds
G2 is connected
proof end;

theorem :: GLIB_002:6
for G being _Graph st ex v1 being Vertex of G st
for v2 being Vertex of G ex W being Walk of G st W is_Walk_from v1,v2 holds
G is connected by Lm6;

theorem :: GLIB_002:7
for G being _trivial _Graph holds G is connected ;

theorem Th7: :: GLIB_002:8
for G1, G2 being _Graph st G1 == G2 & G1 is connected holds
G2 is connected
proof end;

theorem :: GLIB_002:9
for G being _Graph
for v being Vertex of G holds v in G .reachableFrom v by Lm1;

theorem :: GLIB_002:10
for G being _Graph
for v1 being Vertex of G
for e, x, y being object st x in G .reachableFrom v1 & e Joins x,y,G holds
y in G .reachableFrom v1 by Lm2;

theorem :: GLIB_002:11
for G being _Graph
for v being Vertex of G holds G .edgesBetween (G .reachableFrom v) = G .edgesInOut (G .reachableFrom v)
proof end;

theorem :: GLIB_002:12
for G being _Graph
for v1, v2 being Vertex of G st v1 in G .reachableFrom v2 holds
G .reachableFrom v1 = G .reachableFrom v2 by Lm3;

theorem :: GLIB_002:13
for G being _Graph
for v being Vertex of G
for W being Walk of G st v in W .vertices() holds
W .vertices() c= G .reachableFrom v by Lm4;

theorem :: GLIB_002:14
for G1 being _Graph
for G2 being Subgraph of G1
for v1 being Vertex of G1
for v2 being Vertex of G2 st v1 = v2 holds
G2 .reachableFrom v2 c= G1 .reachableFrom v1
proof end;

theorem :: GLIB_002:15
for G being _Graph st ex v being Vertex of G st G .reachableFrom v = the_Vertices_of G holds
G is connected by Lm7;

theorem :: GLIB_002:16
for G being _Graph st G is connected holds
for v being Vertex of G holds G .reachableFrom v = the_Vertices_of G by Lm8;

theorem :: GLIB_002:17
for G1, G2 being _Graph
for v1 being Vertex of G1
for v2 being Vertex of G2 st G1 == G2 & v1 = v2 holds
G1 .reachableFrom v1 = G2 .reachableFrom v2 by Lm9;

theorem :: GLIB_002:18
for G being _Graph
for v being Vertex of G holds v in G .reachableDFrom v
proof end;

theorem :: GLIB_002:19
for G being _Graph
for e, x, y being set
for v1 being Vertex of G st x in G .reachableDFrom v1 & e DJoins x,y,G holds
y in G .reachableDFrom v1
proof end;

theorem :: GLIB_002:20
for G being _Graph
for v being Vertex of G holds G .reachableDFrom v c= G .reachableFrom v
proof end;

theorem :: GLIB_002:21
for G1 being _Graph
for G2 being Subgraph of G1
for v1 being Vertex of G1
for v2 being Vertex of G2 st v1 = v2 holds
G2 .reachableDFrom v2 c= G1 .reachableDFrom v1
proof end;

theorem :: GLIB_002:22
for G1, G2 being _Graph
for v1 being Vertex of G1
for v2 being Vertex of G2 st G1 == G2 & v1 = v2 holds
G1 .reachableDFrom v1 = G2 .reachableDFrom v2
proof end;

theorem :: GLIB_002:23
for G1 being _Graph
for G2 being connected Subgraph of G1 st G2 is spanning holds
G1 is connected by Lm10;

theorem :: GLIB_002:24
for G being _Graph holds union (G .componentSet()) = the_Vertices_of G
proof end;

theorem :: GLIB_002:25
for G being _Graph holds
( G is connected iff G .componentSet() = {(the_Vertices_of G)} ) by Lm11;

theorem :: GLIB_002:26
for G1, G2 being _Graph st G1 == G2 holds
G1 .componentSet() = G2 .componentSet() by Lm12;

theorem :: GLIB_002:27
for G being _Graph
for x being set st x in G .componentSet() holds
x is non empty Subset of (the_Vertices_of G) by Lm13;

theorem :: GLIB_002:28
for G being _Graph holds
( G is connected iff G .numComponents() = 1 ) by Lm18;

theorem :: GLIB_002:29
for G1, G2 being _Graph st G1 == G2 holds
G1 .numComponents() = G2 .numComponents() by Lm12;

theorem :: GLIB_002:30
for G being _Graph holds
( G is Component of G iff G is connected )
proof end;

theorem :: GLIB_002:31
for G being _Graph
for C being Component of G holds the_Edges_of C = G .edgesBetween (the_Vertices_of C) by Lm14;

theorem :: GLIB_002:32
for G being _Graph
for C1, C2 being Component of G holds
( the_Vertices_of C1 = the_Vertices_of C2 iff C1 == C2 ) by Lm15;

theorem :: GLIB_002:33
for G being _Graph
for C being Component of G
for v being Vertex of G holds
( v in the_Vertices_of C iff the_Vertices_of C = G .reachableFrom v ) by Lm16;

theorem :: GLIB_002:34
for G being _Graph
for C1, C2 being Component of G
for v being set st v in the_Vertices_of C1 & v in the_Vertices_of C2 holds
C1 == C2 by Lm17;

theorem :: GLIB_002:35
for G being connected _Graph
for v being Vertex of G holds
( not v is cut-vertex iff for G2 being removeVertex of G,v holds G2 .numComponents() c= G .numComponents() ) by Lm19;

theorem :: GLIB_002:36
for G being connected _Graph
for v being Vertex of G
for G2 being removeVertex of G,v st not v is cut-vertex holds
G2 is connected by Lm20;

theorem :: GLIB_002:37
for G being _finite non _trivial connected _Graph ex v1, v2 being Vertex of G st
( v1 <> v2 & not v1 is cut-vertex & not v2 is cut-vertex ) by Lm21;

theorem Th37: :: GLIB_002:38
for G being _Graph
for v being Vertex of G st v is cut-vertex holds
not G is _trivial
proof end;

theorem :: GLIB_002:39
for G1, G2 being _Graph
for v1 being Vertex of G1
for v2 being Vertex of G2 st G1 == G2 & v1 = v2 & v1 is cut-vertex holds
v2 is cut-vertex
proof end;

theorem Th39: :: GLIB_002:40
for G being _finite connected _Graph holds G .order() <= (G .size()) + 1
proof end;

theorem :: GLIB_002:41
for G being acyclic _Graph holds G is simple ;

theorem :: GLIB_002:42
for G being acyclic _Graph
for W being Path of G
for e being set st not e in W .edges() & e in (W .last()) .edgesInOut() holds
W .addEdge e is Path-like by Lm22;

theorem :: GLIB_002:43
for G being _finite non _trivial acyclic _Graph st the_Edges_of G <> {} holds
ex v1, v2 being Vertex of G st
( v1 <> v2 & v1 is endvertex & v2 is endvertex & v2 in G .reachableFrom v1 ) by Lm23;

theorem Th43: :: GLIB_002:44
for G1, G2 being _Graph st G1 == G2 & G1 is acyclic holds
G2 is acyclic
proof end;

theorem :: GLIB_002:45
for G being _finite non _trivial Tree-like _Graph ex v1, v2 being Vertex of G st
( v1 <> v2 & v1 is endvertex & v2 is endvertex ) by Lm24;

theorem Th45: :: GLIB_002:46
for G being _finite _Graph holds
( G is Tree-like iff ( G is acyclic & G .order() = (G .size()) + 1 ) )
proof end;

theorem :: GLIB_002:47
for G being _finite _Graph holds
( G is Tree-like iff ( G is connected & G .order() = (G .size()) + 1 ) )
proof end;

theorem Th47: :: GLIB_002:48
for G1, G2 being _Graph st G1 == G2 & G1 is Tree-like holds
G2 is Tree-like by Th7, Th43;

theorem :: GLIB_002:49
for G being _Graph
for x being set st G is_DTree_rooted_at x holds
x is Vertex of G
proof end;

theorem :: GLIB_002:50
for G1, G2 being _Graph
for x being set st G1 == G2 & G1 is_DTree_rooted_at x holds
G2 is_DTree_rooted_at x
proof end;