:: On the Segmentation of a Simple Closed Curve
:: by Andrzej Trybulec
::
:: Copyright (c) 2003-2021 Association of Mizar Users

theorem Th1: :: JORDAN_A:1
for T being non empty TopSpace
for f being continuous RealMap of T
for A being compact Subset of T holds f .: A is compact
proof end;

theorem Th2: :: JORDAN_A:2
for A being compact Subset of REAL
for B being non empty Subset of REAL st B c= A holds
lower_bound B in A
proof end;

theorem :: JORDAN_A:3
for n being Nat
for A, B being non empty compact Subset of ()
for f being continuous RealMap of [:(),():]
for g being RealMap of () st ( for p being Point of () ex G being Subset of REAL st
( G = { (f . (p,q)) where q is Point of () : q in B } & g . p = lower_bound G ) ) holds
lower_bound (f .: [:A,B:]) = lower_bound (g .: A)
proof end;

theorem :: JORDAN_A:4
for n being Nat
for A, B being non empty compact Subset of ()
for f being continuous RealMap of [:(),():]
for g being RealMap of () st ( for q being Point of () ex G being Subset of REAL st
( G = { (f . (p,q)) where p is Point of () : p in A } & g . q = lower_bound G ) ) holds
lower_bound (f .: [:A,B:]) = lower_bound (g .: B)
proof end;

theorem Th5: :: JORDAN_A:5
for C being Simple_closed_curve
for q being Point of () st q in Lower_Arc C & q <> W-min C holds
LE E-max C,q,C
proof end;

theorem Th6: :: JORDAN_A:6
for C being Simple_closed_curve
for q being Point of () st q in Upper_Arc C holds
LE q, E-max C,C
proof end;

definition
let n be Nat;
A1: [: the carrier of (), the carrier of ():] = the carrier of [:(),():] by BORSUK_1:def 2;
func Eucl_dist n -> RealMap of [:(),():] means :Def1: :: JORDAN_A:def 1
for p, q being Point of () holds it . (p,q) = |.(p - q).|;
existence
ex b1 being RealMap of [:(),():] st
for p, q being Point of () holds b1 . (p,q) = |.(p - q).|
proof end;
uniqueness
for b1, b2 being RealMap of [:(),():] st ( for p, q being Point of () holds b1 . (p,q) = |.(p - q).| ) & ( for p, q being Point of () holds b2 . (p,q) = |.(p - q).| ) holds
b1 = b2
proof end;
end;

:: deftheorem Def1 defines Eucl_dist JORDAN_A:def 1 :
for n being Nat
for b2 being RealMap of [:(),():] holds
( b2 = Eucl_dist n iff for p, q being Point of () holds b2 . (p,q) = |.(p - q).| );

definition
let T be non empty TopSpace;
let f be RealMap of T;
redefine attr f is continuous means :: JORDAN_A:def 2
for p being Point of T
for N being Neighbourhood of f . p ex V being a_neighborhood of p st f .: V c= N;
compatibility
( f is continuous iff for p being Point of T
for N being Neighbourhood of f . p ex V being a_neighborhood of p st f .: V c= N )
proof end;
end;

:: deftheorem defines continuous JORDAN_A:def 2 :
for T being non empty TopSpace
for f being RealMap of T holds
( f is continuous iff for p being Point of T
for N being Neighbourhood of f . p ex V being a_neighborhood of p st f .: V c= N );

Lm1: for X, Y being TopSpace holds TopStruct(# the carrier of [:X,Y:], the topology of [:X,Y:] #) = [:TopStruct(# the carrier of X, the topology of X #),TopStruct(# the carrier of Y, the topology of Y #):]
proof end;

registration
let n be Nat;
coherence
proof end;
end;

theorem Th7: :: JORDAN_A:7
for n being Nat
for A, B being non empty compact Subset of () st A misses B holds
dist_min (A,B) > 0
proof end;

theorem Th8: :: JORDAN_A:8
for C being Simple_closed_curve
for p, q being Point of () st LE p,q,C & LE q, E-max C,C & p <> q holds
Segment (p,q,C) = Segment ((),(),(),p,q)
proof end;

theorem Th9: :: JORDAN_A:9
for C being Simple_closed_curve
for q being Point of () st LE E-max C,q,C holds
Segment ((),q,C) = Segment ((),(),(),(),q)
proof end;

theorem Th10: :: JORDAN_A:10
for C being Simple_closed_curve
for q being Point of () st LE E-max C,q,C holds
Segment (q,(),C) = Segment ((),(),(),q,())
proof end;

theorem Th11: :: JORDAN_A:11
for C being Simple_closed_curve
for p, q being Point of () st LE p,q,C & LE E-max C,p,C holds
Segment (p,q,C) = Segment ((),(),(),p,q)
proof end;

theorem Th12: :: JORDAN_A:12
for C being Simple_closed_curve
for p, q being Point of () st LE p, E-max C,C & LE E-max C,q,C holds
Segment (p,q,C) = (R_Segment ((),(),(),p)) \/ (L_Segment ((),(),(),q))
proof end;

theorem Th13: :: JORDAN_A:13
for C being Simple_closed_curve
for p being Point of () st LE p, E-max C,C holds
Segment (p,(),C) = (R_Segment ((),(),(),p)) \/ (L_Segment ((),(),(),()))
proof end;

theorem Th14: :: JORDAN_A:14
for C being Simple_closed_curve
for p being Point of () holds R_Segment ((),(),(),p) = Segment ((),(),(),p,())
proof end;

theorem Th15: :: JORDAN_A:15
for C being Simple_closed_curve
for p being Point of () holds L_Segment ((),(),(),p) = Segment ((),(),(),(),p)
proof end;

theorem Th16: :: JORDAN_A:16
for C being Simple_closed_curve
for p being Point of () st p in C & p <> W-min C holds
Segment (p,(),C) is_an_arc_of p, W-min C
proof end;

theorem Th17: :: JORDAN_A:17
for C being Simple_closed_curve
for p, q being Point of () st p <> q & LE p,q,C holds
Segment (p,q,C) is_an_arc_of p,q
proof end;

theorem Th18: :: JORDAN_A:18
for C being Simple_closed_curve holds C = Segment ((),(),C)
proof end;

theorem Th19: :: JORDAN_A:19
for C being Simple_closed_curve
for q being Point of () st q in C holds
Segment (q,(),C) is compact
proof end;

theorem Th20: :: JORDAN_A:20
for C being Simple_closed_curve
for q1, q2 being Point of () st LE q1,q2,C holds
Segment (q1,q2,C) is compact
proof end;

definition
let C be Simple_closed_curve;
mode Segmentation of C -> FinSequence of () means :Def3: :: JORDAN_A:def 3
( it /. 1 = W-min C & it is one-to-one & 8 <= len it & rng it c= C & ( for i being Nat st 1 <= i & i < len it holds
LE it /. i,it /. (i + 1),C ) & ( for i being Nat st 1 <= i & i + 1 < len it holds
(Segment ((it /. i),(it /. (i + 1)),C)) /\ (Segment ((it /. (i + 1)),(it /. (i + 2)),C)) = {(it /. (i + 1))} ) & (Segment ((it /. (len it)),(it /. 1),C)) /\ (Segment ((it /. 1),(it /. 2),C)) = {(it /. 1)} & (Segment ((it /. ((len it) -' 1)),(it /. (len it)),C)) /\ (Segment ((it /. (len it)),(it /. 1),C)) = {(it /. (len it))} & Segment ((it /. ((len it) -' 1)),(it /. (len it)),C) misses Segment ((it /. 1),(it /. 2),C) & ( for i, j being Nat st 1 <= i & i < j & j < len it & i,j aren't_adjacent holds
Segment ((it /. i),(it /. (i + 1)),C) misses Segment ((it /. j),(it /. (j + 1)),C) ) & ( for i being Nat st 1 < i & i + 1 < len it holds
Segment ((it /. (len it)),(it /. 1),C) misses Segment ((it /. i),(it /. (i + 1)),C) ) );
existence
ex b1 being FinSequence of () st
( b1 /. 1 = W-min C & b1 is one-to-one & 8 <= len b1 & rng b1 c= C & ( for i being Nat st 1 <= i & i < len b1 holds
LE b1 /. i,b1 /. (i + 1),C ) & ( for i being Nat st 1 <= i & i + 1 < len b1 holds
(Segment ((b1 /. i),(b1 /. (i + 1)),C)) /\ (Segment ((b1 /. (i + 1)),(b1 /. (i + 2)),C)) = {(b1 /. (i + 1))} ) & (Segment ((b1 /. (len b1)),(b1 /. 1),C)) /\ (Segment ((b1 /. 1),(b1 /. 2),C)) = {(b1 /. 1)} & (Segment ((b1 /. ((len b1) -' 1)),(b1 /. (len b1)),C)) /\ (Segment ((b1 /. (len b1)),(b1 /. 1),C)) = {(b1 /. (len b1))} & Segment ((b1 /. ((len b1) -' 1)),(b1 /. (len b1)),C) misses Segment ((b1 /. 1),(b1 /. 2),C) & ( for i, j being Nat st 1 <= i & i < j & j < len b1 & i,j aren't_adjacent holds
Segment ((b1 /. i),(b1 /. (i + 1)),C) misses Segment ((b1 /. j),(b1 /. (j + 1)),C) ) & ( for i being Nat st 1 < i & i + 1 < len b1 holds
Segment ((b1 /. (len b1)),(b1 /. 1),C) misses Segment ((b1 /. i),(b1 /. (i + 1)),C) ) )
proof end;
end;

:: deftheorem Def3 defines Segmentation JORDAN_A:def 3 :
for C being Simple_closed_curve
for b2 being FinSequence of () holds
( b2 is Segmentation of C iff ( b2 /. 1 = W-min C & b2 is one-to-one & 8 <= len b2 & rng b2 c= C & ( for i being Nat st 1 <= i & i < len b2 holds
LE b2 /. i,b2 /. (i + 1),C ) & ( for i being Nat st 1 <= i & i + 1 < len b2 holds
(Segment ((b2 /. i),(b2 /. (i + 1)),C)) /\ (Segment ((b2 /. (i + 1)),(b2 /. (i + 2)),C)) = {(b2 /. (i + 1))} ) & (Segment ((b2 /. (len b2)),(b2 /. 1),C)) /\ (Segment ((b2 /. 1),(b2 /. 2),C)) = {(b2 /. 1)} & (Segment ((b2 /. ((len b2) -' 1)),(b2 /. (len b2)),C)) /\ (Segment ((b2 /. (len b2)),(b2 /. 1),C)) = {(b2 /. (len b2))} & Segment ((b2 /. ((len b2) -' 1)),(b2 /. (len b2)),C) misses Segment ((b2 /. 1),(b2 /. 2),C) & ( for i, j being Nat st 1 <= i & i < j & j < len b2 & i,j aren't_adjacent holds
Segment ((b2 /. i),(b2 /. (i + 1)),C) misses Segment ((b2 /. j),(b2 /. (j + 1)),C) ) & ( for i being Nat st 1 < i & i + 1 < len b2 holds
Segment ((b2 /. (len b2)),(b2 /. 1),C) misses Segment ((b2 /. i),(b2 /. (i + 1)),C) ) ) );

registration
let C be Simple_closed_curve;
cluster -> non trivial for Segmentation of C;
coherence
for b1 being Segmentation of C holds not b1 is trivial
proof end;
end;

theorem Th21: :: JORDAN_A:21
for C being Simple_closed_curve
for S being Segmentation of C
for i being Nat st 1 <= i & i <= len S holds
S /. i in C
proof end;

definition
let C be Simple_closed_curve;
let i be Nat;
let S be Segmentation of C;
func Segm (S,i) -> Subset of () equals :Def4: :: JORDAN_A:def 4
Segment ((S /. i),(S /. (i + 1)),C) if ( 1 <= i & i < len S )
otherwise Segment ((S /. (len S)),(S /. 1),C);
correctness
coherence
( ( 1 <= i & i < len S implies Segment ((S /. i),(S /. (i + 1)),C) is Subset of () ) & ( ( not 1 <= i or not i < len S ) implies Segment ((S /. (len S)),(S /. 1),C) is Subset of () ) )
;
consistency
for b1 being Subset of () holds verum
;
;
end;

:: deftheorem Def4 defines Segm JORDAN_A:def 4 :
for C being Simple_closed_curve
for i being Nat
for S being Segmentation of C holds
( ( 1 <= i & i < len S implies Segm (S,i) = Segment ((S /. i),(S /. (i + 1)),C) ) & ( ( not 1 <= i or not i < len S ) implies Segm (S,i) = Segment ((S /. (len S)),(S /. 1),C) ) );

theorem :: JORDAN_A:22
for C being Simple_closed_curve
for i being Nat
for S being Segmentation of C st i in dom S holds
Segm (S,i) c= C
proof end;

registration
let C be Simple_closed_curve;
let S be Segmentation of C;
let i be Nat;
cluster Segm (S,i) -> non empty compact ;
coherence
( not Segm (S,i) is empty & Segm (S,i) is compact )
proof end;
end;

theorem :: JORDAN_A:23
for C being Simple_closed_curve
for S being Segmentation of C
for p being Point of () st p in C holds
ex i being Nat st
( i in dom S & p in Segm (S,i) )
proof end;

theorem Th24: :: JORDAN_A:24
for C being Simple_closed_curve
for S being Segmentation of C
for i, j being Nat st 1 <= i & i < j & j < len S & i,j aren't_adjacent holds
Segm (S,i) misses Segm (S,j)
proof end;

theorem Th25: :: JORDAN_A:25
for C being Simple_closed_curve
for S being Segmentation of C
for j being Nat st 1 < j & j < (len S) -' 1 holds
Segm (S,(len S)) misses Segm (S,j)
proof end;

theorem Th26: :: JORDAN_A:26
for C being Simple_closed_curve
for S being Segmentation of C
for i, j being Nat st 1 <= i & i < j & j < len S & i,j are_adjacent holds
(Segm (S,i)) /\ (Segm (S,j)) = {(S /. (i + 1))}
proof end;

theorem Th27: :: JORDAN_A:27
for C being Simple_closed_curve
for S being Segmentation of C
for i, j being Nat st 1 <= i & i < j & j < len S & i,j are_adjacent holds
Segm (S,i) meets Segm (S,j)
proof end;

theorem Th28: :: JORDAN_A:28
for C being Simple_closed_curve
for S being Segmentation of C holds (Segm (S,(len S))) /\ (Segm (S,1)) = {(S /. 1)}
proof end;

theorem Th29: :: JORDAN_A:29
for C being Simple_closed_curve
for S being Segmentation of C holds Segm (S,(len S)) meets Segm (S,1)
proof end;

theorem Th30: :: JORDAN_A:30
for C being Simple_closed_curve
for S being Segmentation of C holds (Segm (S,(len S))) /\ (Segm (S,((len S) -' 1))) = {(S /. (len S))}
proof end;

theorem Th31: :: JORDAN_A:31
for C being Simple_closed_curve
for S being Segmentation of C holds Segm (S,(len S)) meets Segm (S,((len S) -' 1))
proof end;

definition
let n be Nat;
let C be Subset of ();
func diameter C -> Real means :Def5: :: JORDAN_A:def 5
ex W being Subset of () st
( W = C & it = diameter W );
existence
ex b1 being Real ex W being Subset of () st
( W = C & b1 = diameter W )
proof end;
correctness
uniqueness
for b1, b2 being Real st ex W being Subset of () st
( W = C & b1 = diameter W ) & ex W being Subset of () st
( W = C & b2 = diameter W ) holds
b1 = b2
;
;
end;

:: deftheorem Def5 defines diameter JORDAN_A:def 5 :
for n being Nat
for C being Subset of ()
for b3 being Real holds
( b3 = diameter C iff ex W being Subset of () st
( W = C & b3 = diameter W ) );

definition
let C be Simple_closed_curve;
let S be Segmentation of C;
func diameter S -> Real means :Def6: :: JORDAN_A:def 6
ex S1 being non empty finite Subset of REAL st
( S1 = { (diameter (Segm (S,i))) where i is Element of NAT : i in dom S } & it = max S1 );
existence
ex b1 being Real ex S1 being non empty finite Subset of REAL st
( S1 = { (diameter (Segm (S,i))) where i is Element of NAT : i in dom S } & b1 = max S1 )
proof end;
correctness
uniqueness
for b1, b2 being Real st ex S1 being non empty finite Subset of REAL st
( S1 = { (diameter (Segm (S,i))) where i is Element of NAT : i in dom S } & b1 = max S1 ) & ex S1 being non empty finite Subset of REAL st
( S1 = { (diameter (Segm (S,i))) where i is Element of NAT : i in dom S } & b2 = max S1 ) holds
b1 = b2
;
;
end;

:: deftheorem Def6 defines diameter JORDAN_A:def 6 :
for C being Simple_closed_curve
for S being Segmentation of C
for b3 being Real holds
( b3 = diameter S iff ex S1 being non empty finite Subset of REAL st
( S1 = { (diameter (Segm (S,i))) where i is Element of NAT : i in dom S } & b3 = max S1 ) );

theorem :: JORDAN_A:32
for C being Simple_closed_curve
for S being Segmentation of C
for i being Nat holds diameter (Segm (S,i)) <= diameter S
proof end;

theorem Th33: :: JORDAN_A:33
for C being Simple_closed_curve
for S being Segmentation of C
for e being Real st ( for i being Nat holds diameter (Segm (S,i)) < e ) holds
diameter S < e
proof end;

theorem :: JORDAN_A:34
for C being Simple_closed_curve
for e being Real st e > 0 holds
ex S being Segmentation of C st diameter S < e
proof end;

definition
let C be Simple_closed_curve;
let S be Segmentation of C;
func S-Gap S -> Real means :Def7: :: JORDAN_A:def 7
ex S1, S2 being non empty finite Subset of REAL st
( S1 = { (dist_min ((Segm (S,i)),(Segm (S,j)))) where i, j is Element of NAT : ( 1 <= i & i < j & j < len S & i,j aren't_adjacent ) } & S2 = { (dist_min ((Segm (S,(len S))),(Segm (S,k)))) where k is Element of NAT : ( 1 < k & k < (len S) -' 1 ) } & it = min ((min S1),(min S2)) );
existence
ex b1 being Real ex S1, S2 being non empty finite Subset of REAL st
( S1 = { (dist_min ((Segm (S,i)),(Segm (S,j)))) where i, j is Element of NAT : ( 1 <= i & i < j & j < len S & i,j aren't_adjacent ) } & S2 = { (dist_min ((Segm (S,(len S))),(Segm (S,k)))) where k is Element of NAT : ( 1 < k & k < (len S) -' 1 ) } & b1 = min ((min S1),(min S2)) )
proof end;
correctness
uniqueness
for b1, b2 being Real st ex S1, S2 being non empty finite Subset of REAL st
( S1 = { (dist_min ((Segm (S,i)),(Segm (S,j)))) where i, j is Element of NAT : ( 1 <= i & i < j & j < len S & i,j aren't_adjacent ) } & S2 = { (dist_min ((Segm (S,(len S))),(Segm (S,k)))) where k is Element of NAT : ( 1 < k & k < (len S) -' 1 ) } & b1 = min ((min S1),(min S2)) ) & ex S1, S2 being non empty finite Subset of REAL st
( S1 = { (dist_min ((Segm (S,i)),(Segm (S,j)))) where i, j is Element of NAT : ( 1 <= i & i < j & j < len S & i,j aren't_adjacent ) } & S2 = { (dist_min ((Segm (S,(len S))),(Segm (S,k)))) where k is Element of NAT : ( 1 < k & k < (len S) -' 1 ) } & b2 = min ((min S1),(min S2)) ) holds
b1 = b2
;
;
end;

:: deftheorem Def7 defines S-Gap JORDAN_A:def 7 :
for C being Simple_closed_curve
for S being Segmentation of C
for b3 being Real holds
( b3 = S-Gap S iff ex S1, S2 being non empty finite Subset of REAL st
( S1 = { (dist_min ((Segm (S,i)),(Segm (S,j)))) where i, j is Element of NAT : ( 1 <= i & i < j & j < len S & i,j aren't_adjacent ) } & S2 = { (dist_min ((Segm (S,(len S))),(Segm (S,k)))) where k is Element of NAT : ( 1 < k & k < (len S) -' 1 ) } & b3 = min ((min S1),(min S2)) ) );

theorem Th35: :: JORDAN_A:35
for C being Simple_closed_curve
for S being Segmentation of C ex F being non empty finite Subset of REAL st
( F = { (dist_min ((Segm (S,i)),(Segm (S,j)))) where i, j is Nat : ( 1 <= i & i < j & j <= len S & Segm (S,i) misses Segm (S,j) ) } & S-Gap S = min F )
proof end;

theorem :: JORDAN_A:36
for C being Simple_closed_curve
for S being Segmentation of C holds S-Gap S > 0
proof end;