:: EUCLID semantic presentation

definition
let n be Element of NAT ;
func REAL c1 -> FinSequence-DOMAIN of REAL equals :: EUCLID:def 1
n -tuples_on REAL ;
coherence
n -tuples_on REAL is FinSequence-DOMAIN of REAL
;
end;

:: deftheorem Def1 defines REAL EUCLID:def 1 :
for n being Element of NAT holds REAL n = n -tuples_on REAL ;

definition
func absreal -> Function of REAL , REAL means :Def2: :: EUCLID:def 2
for r being real number holds it . r = abs r;
existence
ex b1 being Function of REAL , REAL st
for r being real number holds b1 . r = abs r
proof end;
uniqueness
for b1, b2 being Function of REAL , REAL st ( for r being real number holds b1 . r = abs r ) & ( for r being real number holds b2 . r = abs r ) holds
b1 = b2
proof end;
end;

:: deftheorem Def2 defines absreal EUCLID:def 2 :
for b1 being Function of REAL , REAL holds
( b1 = absreal iff for r being real number holds b1 . r = abs r );

definition
let x be FinSequence of REAL ;
func abs c1 -> FinSequence of REAL equals :: EUCLID:def 3
absreal * x;
coherence
absreal * x is FinSequence of REAL
;
end;

:: deftheorem Def3 defines abs EUCLID:def 3 :
for x being FinSequence of REAL holds abs x = absreal * x;

definition
let n be Element of NAT ;
func 0* c1 -> FinSequence of REAL equals :: EUCLID:def 4
n |-> 0;
coherence
n |-> 0 is FinSequence of REAL
;
end;

:: deftheorem Def4 defines 0* EUCLID:def 4 :
for n being Element of NAT holds 0* n = n |-> 0;

definition
let n be Element of NAT ;
redefine func 0* as 0* c1 -> Element of REAL a1;
coherence
0* n is Element of REAL n
;
end;

definition
let n be Element of NAT ;
let x be Element of REAL n;
redefine func - as - c2 -> Element of REAL a1;
coherence
- x is Element of REAL n
proof end;
end;

definition
let n be Element of NAT ;
let x be Element of REAL n;
let y be Element of REAL n;
redefine func + as c2 + c3 -> Element of REAL a1;
coherence
x + y is Element of REAL n
proof end;
redefine func - as c2 - c3 -> Element of REAL a1;
coherence
x - y is Element of REAL n
proof end;
end;

definition
let n be Element of NAT ;
let r be real number ;
let x be Element of REAL n;
redefine func * as c2 * c3 -> Element of REAL a1;
coherence
r * x is Element of REAL n
proof end;
end;

definition
let n be Element of NAT ;
let x be Element of REAL n;
redefine func abs as abs c2 -> Element of a1 -tuples_on REAL ;
coherence
abs x is Element of n -tuples_on REAL
by FINSEQ_2:133;
end;

definition
let n be Element of NAT ;
let x be Element of REAL n;
redefine func sqr as sqr c2 -> Element of a1 -tuples_on REAL ;
coherence
sqr x is Element of n -tuples_on REAL
by FINSEQ_2:133;
end;

definition
let x be FinSequence of REAL ;
func |.c1.| -> Real equals :: EUCLID:def 5
sqrt (Sum (sqr x));
coherence
sqrt (Sum (sqr x)) is Real
;
end;

:: deftheorem Def5 defines |. EUCLID:def 5 :
for x being FinSequence of REAL holds |.x.| = sqrt (Sum (sqr x));

theorem Th1: :: EUCLID:1
canceled;

theorem Th2: :: EUCLID:2
for n being Element of NAT
for x being Element of REAL n holds len x = n by FINSEQ_2:109;

theorem Th3: :: EUCLID:3
for n being Element of NAT
for x being Element of REAL n holds dom x = Seg n
proof end;

theorem Th4: :: EUCLID:4
for n, k being Element of NAT
for x being Element of REAL n holds x . k in REAL
proof end;

theorem Th5: :: EUCLID:5
for n being Element of NAT
for x1, x2 being Element of REAL n st ( for k being Element of NAT st k in Seg n holds
x1 . k = x2 . k ) holds
x1 = x2 by FINSEQ_2:139;

Lemma50: for n being Element of NAT
for x being Element of REAL n holds dom (abs x) = dom x
proof end;

theorem Th6: :: EUCLID:6
for n, k being Element of NAT
for r being real number
for x being Element of REAL n st r = x . k holds
(abs x) . k = abs r
proof end;

Lemma54: for n being Element of NAT
for x being Element of REAL n holds sqr (abs x) = sqr x
proof end;

theorem Th7: :: EUCLID:7
for n being Element of NAT holds abs (0* n) = n |-> 0
proof end;

theorem Th8: :: EUCLID:8
for n being Element of NAT
for x being Element of REAL n holds abs (- x) = abs x
proof end;

theorem Th9: :: EUCLID:9
for n being Element of NAT
for r being real number
for x being Element of REAL n holds abs (r * x) = (abs r) * (abs x)
proof end;

theorem Th10: :: EUCLID:10
for n being Element of NAT holds |.(0* n).| = 0
proof end;

theorem Th11: :: EUCLID:11
for n being Element of NAT
for x being Element of REAL n st |.x.| = 0 holds
x = 0* n
proof end;

theorem Th12: :: EUCLID:12
for n being Element of NAT
for x being Element of REAL n holds |.x.| >= 0
proof end;

theorem Th13: :: EUCLID:13
for n being Element of NAT
for x being Element of REAL n holds |.(- x).| = |.x.|
proof end;

theorem Th14: :: EUCLID:14
for n being Element of NAT
for r being real number
for x being Element of REAL n holds |.(r * x).| = (abs r) * |.x.|
proof end;

theorem Th15: :: EUCLID:15
for n being Element of NAT
for x1, x2 being Element of REAL n holds |.(x1 + x2).| <= |.x1.| + |.x2.|
proof end;

theorem Th16: :: EUCLID:16
for n being Element of NAT
for x1, x2 being Element of REAL n holds |.(x1 - x2).| <= |.x1.| + |.x2.|
proof end;

theorem Th17: :: EUCLID:17
for n being Element of NAT
for x1, x2 being Element of REAL n holds |.x1.| - |.x2.| <= |.(x1 + x2).|
proof end;

theorem Th18: :: EUCLID:18
for n being Element of NAT
for x1, x2 being Element of REAL n holds |.x1.| - |.x2.| <= |.(x1 - x2).|
proof end;

theorem Th19: :: EUCLID:19
for n being Element of NAT
for x1, x2 being Element of REAL n holds
( |.(x1 - x2).| = 0 iff x1 = x2 )
proof end;

theorem Th20: :: EUCLID:20
for n being Element of NAT
for x1, x2 being Element of REAL n st x1 <> x2 holds
|.(x1 - x2).| > 0
proof end;

theorem Th21: :: EUCLID:21
for n being Element of NAT
for x1, x2 being Element of REAL n holds |.(x1 - x2).| = |.(x2 - x1).|
proof end;

theorem Th22: :: EUCLID:22
for n being Element of NAT
for x1, x2, x being Element of REAL n holds |.(x1 - x2).| <= |.(x1 - x).| + |.(x - x2).|
proof end;

definition
let n be Element of NAT ;
func Pitag_dist c1 -> Function of [:(REAL a1),(REAL a1):], REAL means :Def6: :: EUCLID:def 6
for x, y being Element of REAL n holds it . x,y = |.(x - y).|;
existence
ex b1 being Function of [:(REAL n),(REAL n):], REAL st
for x, y being Element of REAL n holds b1 . x,y = |.(x - y).|
proof end;
uniqueness
for b1, b2 being Function of [:(REAL n),(REAL n):], REAL st ( for x, y being Element of REAL n holds b1 . x,y = |.(x - y).| ) & ( for x, y being Element of REAL n holds b2 . x,y = |.(x - y).| ) holds
b1 = b2
proof end;
end;

:: deftheorem Def6 defines Pitag_dist EUCLID:def 6 :
for n being Element of NAT
for b2 being Function of [:(REAL n),(REAL n):], REAL holds
( b2 = Pitag_dist n iff for x, y being Element of REAL n holds b2 . x,y = |.(x - y).| );

theorem Th23: :: EUCLID:23
for n being Element of NAT
for x, y being Element of REAL n holds sqr (x - y) = sqr (y - x)
proof end;

theorem Th24: :: EUCLID:24
for n being Element of NAT holds Pitag_dist n is_metric_of REAL n
proof end;

definition
let n be Element of NAT ;
func Euclid c1 -> strict MetrSpace equals :: EUCLID:def 7
MetrStruct(# (REAL n),(Pitag_dist n) #);
coherence
MetrStruct(# (REAL n),(Pitag_dist n) #) is strict MetrSpace
proof end;
end;

:: deftheorem Def7 defines Euclid EUCLID:def 7 :
for n being Element of NAT holds Euclid n = MetrStruct(# (REAL n),(Pitag_dist n) #);

registration
let n be Element of NAT ;
cluster Euclid a1 -> non empty strict ;
coherence
not Euclid n is empty
proof end;
end;

definition
let n be Element of NAT ;
func TOP-REAL c1 -> strict TopSpace equals :: EUCLID:def 8
TopSpaceMetr (Euclid n);
coherence
TopSpaceMetr (Euclid n) is strict TopSpace
;
end;

:: deftheorem Def8 defines TOP-REAL EUCLID:def 8 :
for n being Element of NAT holds TOP-REAL n = TopSpaceMetr (Euclid n);

registration
let n be Element of NAT ;
cluster TOP-REAL a1 -> non empty strict ;
coherence
not TOP-REAL n is empty
;
end;

theorem Th25: :: EUCLID:25
for n being Element of NAT holds the carrier of (TOP-REAL n) = REAL n ;

theorem Th26: :: EUCLID:26
for n being Element of NAT
for p being Point of (TOP-REAL n) holds p is Function of Seg n, REAL
proof end;

theorem Th27: :: EUCLID:27
for n being Element of NAT
for p being Point of (TOP-REAL n) holds p is FinSequence of REAL
proof end;

theorem Th28: :: EUCLID:28
for n being Element of NAT
for p being Point of (TOP-REAL n)
for f being FinSequence st f = p holds
len f = n
proof end;

definition
let n be Element of NAT ;
func 0.REAL c1 -> Point of (TOP-REAL a1) equals :: EUCLID:def 9
0* n;
coherence
0* n is Point of (TOP-REAL n)
;
end;

:: deftheorem Def9 defines 0.REAL EUCLID:def 9 :
for n being Element of NAT holds 0.REAL n = 0* n;

definition
let n be Element of NAT ;
let p1 be Point of (TOP-REAL n);
let p2 be Point of (TOP-REAL n);
func c2 + c3 -> Point of (TOP-REAL a1) means :Def10: :: EUCLID:def 10
for p1', p2' being Element of REAL n st p1' = p1 & p2' = p2 holds
it = p1' + p2';
existence
ex b1 being Point of (TOP-REAL n) st
for p1', p2' being Element of REAL n st p1' = p1 & p2' = p2 holds
b1 = p1' + p2'
proof end;
uniqueness
for b1, b2 being Point of (TOP-REAL n) st ( for p1', p2' being Element of REAL n st p1' = p1 & p2' = p2 holds
b1 = p1' + p2' ) & ( for p1', p2' being Element of REAL n st p1' = p1 & p2' = p2 holds
b2 = p1' + p2' ) holds
b1 = b2
proof end;
commutativity
for b1, p1, p2 being Point of (TOP-REAL n) st ( for p1', p2' being Element of REAL n st p1' = p1 & p2' = p2 holds
b1 = p1' + p2' ) holds
for p1', p2' being Element of REAL n st p1' = p2 & p2' = p1 holds
b1 = p1' + p2'
;
end;

:: deftheorem Def10 defines + EUCLID:def 10 :
for n being Element of NAT
for p1, p2, b4 being Point of (TOP-REAL n) holds
( b4 = p1 + p2 iff for p1', p2' being Element of REAL n st p1' = p1 & p2' = p2 holds
b4 = p1' + p2' );

theorem Th29: :: EUCLID:29
for n being Element of NAT
for x being Element of REAL n holds sqr (abs x) = sqr x by ;

theorem Th30: :: EUCLID:30
for n being Element of NAT
for p1, p2, p3 being Point of (TOP-REAL n) holds (p1 + p2) + p3 = p1 + (p2 + p3)
proof end;

theorem Th31: :: EUCLID:31
for n being Element of NAT
for p being Point of (TOP-REAL n) holds
( (0.REAL n) + p = p & p + (0.REAL n) = p )
proof end;

definition
let x be real number ;
let n be Element of NAT ;
let p be Point of (TOP-REAL n);
func c1 * c3 -> Point of (TOP-REAL a2) means :Def11: :: EUCLID:def 11
for p' being Element of REAL n st p' = p holds
it = x * p';
existence
ex b1 being Point of (TOP-REAL n) st
for p' being Element of REAL n st p' = p holds
b1 = x * p'
proof end;
uniqueness
for b1, b2 being Point of (TOP-REAL n) st ( for p' being Element of REAL n st p' = p holds
b1 = x * p' ) & ( for p' being Element of REAL n st p' = p holds
b2 = x * p' ) holds
b1 = b2
proof end;
end;

:: deftheorem Def11 defines * EUCLID:def 11 :
for x being real number
for n being Element of NAT
for p, b4 being Point of (TOP-REAL n) holds
( b4 = x * p iff for p' being Element of REAL n st p' = p holds
b4 = x * p' );

theorem Th32: :: EUCLID:32
for n being Element of NAT
for x being real number holds x * (0.REAL n) = 0.REAL n
proof end;

theorem Th33: :: EUCLID:33
for n being Element of NAT
for p being Point of (TOP-REAL n) holds
( 1 * p = p & 0 * p = 0.REAL n )
proof end;

theorem Th34: :: EUCLID:34
for n being Element of NAT
for p being Point of (TOP-REAL n)
for x, y being real number holds (x * y) * p = x * (y * p)
proof end;

theorem Th35: :: EUCLID:35
for n being Element of NAT
for p being Point of (TOP-REAL n)
for x being real number holds
( not x * p = 0.REAL n or x = 0 or p = 0.REAL n )
proof end;

theorem Th36: :: EUCLID:36
for n being Element of NAT
for p1, p2 being Point of (TOP-REAL n)
for x being real number holds x * (p1 + p2) = (x * p1) + (x * p2)
proof end;

theorem Th37: :: EUCLID:37
for n being Element of NAT
for p being Point of (TOP-REAL n)
for x, y being real number holds (x + y) * p = (x * p) + (y * p)
proof end;

theorem Th38: :: EUCLID:38
for n being Element of NAT
for p1, p2 being Point of (TOP-REAL n)
for x being real number holds
( not x * p1 = x * p2 or x = 0 or p1 = p2 )
proof end;

definition
let n be Element of NAT ;
let p be Point of (TOP-REAL n);
func - c2 -> Point of (TOP-REAL a1) means :Def12: :: EUCLID:def 12
for p' being Element of REAL n st p' = p holds
it = - p';
existence
ex b1 being Point of (TOP-REAL n) st
for p' being Element of REAL n st p' = p holds
b1 = - p'
proof end;
uniqueness
for b1, b2 being Point of (TOP-REAL n) st ( for p' being Element of REAL n st p' = p holds
b1 = - p' ) & ( for p' being Element of REAL n st p' = p holds
b2 = - p' ) holds
b1 = b2
proof end;
end;

:: deftheorem Def12 defines - EUCLID:def 12 :
for n being Element of NAT
for p, b3 being Point of (TOP-REAL n) holds
( b3 = - p iff for p' being Element of REAL n st p' = p holds
b3 = - p' );

theorem Th39: :: EUCLID:39
for n being Element of NAT
for p being Point of (TOP-REAL n) holds - (- p) = p
proof end;

theorem Th40: :: EUCLID:40
for n being Element of NAT
for p being Point of (TOP-REAL n) holds p + (- p) = 0.REAL n
proof end;

theorem Th41: :: EUCLID:41
for n being Element of NAT
for p1, p2 being Point of (TOP-REAL n) st p1 + p2 = 0.REAL n holds
( p1 = - p2 & p2 = - p1 )
proof end;

theorem Th42: :: EUCLID:42
for n being Element of NAT
for p1, p2 being Point of (TOP-REAL n) holds - (p1 + p2) = (- p1) + (- p2)
proof end;

theorem Th43: :: EUCLID:43
for n being Element of NAT
for p being Point of (TOP-REAL n) holds - p = (- 1) * p
proof end;

theorem Th44: :: EUCLID:44
for n being Element of NAT
for p being Point of (TOP-REAL n)
for x being real number holds
( - (x * p) = (- x) * p & - (x * p) = x * (- p) )
proof end;

definition
let n be Element of NAT ;
let p1 be Point of (TOP-REAL n);
let p2 be Point of (TOP-REAL n);
func c2 - c3 -> Point of (TOP-REAL a1) means :Def13: :: EUCLID:def 13
for p1', p2' being Element of REAL n st p1' = p1 & p2' = p2 holds
it = p1' - p2';
existence
ex b1 being Point of (TOP-REAL n) st
for p1', p2' being Element of REAL n st p1' = p1 & p2' = p2 holds
b1 = p1' - p2'
proof end;
uniqueness
for b1, b2 being Point of (TOP-REAL n) st ( for p1', p2' being Element of REAL n st p1' = p1 & p2' = p2 holds
b1 = p1' - p2' ) & ( for p1', p2' being Element of REAL n st p1' = p1 & p2' = p2 holds
b2 = p1' - p2' ) holds
b1 = b2
proof end;
end;

:: deftheorem Def13 defines - EUCLID:def 13 :
for n being Element of NAT
for p1, p2, b4 being Point of (TOP-REAL n) holds
( b4 = p1 - p2 iff for p1', p2' being Element of REAL n st p1' = p1 & p2' = p2 holds
b4 = p1' - p2' );

theorem Th45: :: EUCLID:45
for n being Element of NAT
for p1, p2 being Point of (TOP-REAL n) holds p1 - p2 = p1 + (- p2)
proof end;

theorem Th46: :: EUCLID:46
for n being Element of NAT
for p being Point of (TOP-REAL n) holds p - p = 0.REAL n
proof end;

theorem Th47: :: EUCLID:47
for n being Element of NAT
for p1, p2 being Point of (TOP-REAL n) st p1 - p2 = 0.REAL n holds
p1 = p2
proof end;

theorem Th48: :: EUCLID:48
for n being Element of NAT
for p1, p2 being Point of (TOP-REAL n) holds
( - (p1 - p2) = p2 - p1 & - (p1 - p2) = (- p1) + p2 )
proof end;

theorem Th49: :: EUCLID:49
for n being Element of NAT
for p1, p2, p3 being Point of (TOP-REAL n) holds p1 + (p2 - p3) = (p1 + p2) - p3
proof end;

theorem Th50: :: EUCLID:50
for n being Element of NAT
for p1, p2, p3 being Point of (TOP-REAL n) holds p1 - (p2 + p3) = (p1 - p2) - p3
proof end;

theorem Th51: :: EUCLID:51
for n being Element of NAT
for p1, p2, p3 being Point of (TOP-REAL n) holds p1 - (p2 - p3) = (p1 - p2) + p3
proof end;

theorem Th52: :: EUCLID:52
for n being Element of NAT
for p, p1 being Point of (TOP-REAL n) holds
( p = (p + p1) - p1 & p = (p - p1) + p1 )
proof end;

theorem Th53: :: EUCLID:53
for n being Element of NAT
for p1, p2 being Point of (TOP-REAL n)
for x being real number holds x * (p1 - p2) = (x * p1) - (x * p2)
proof end;

theorem Th54: :: EUCLID:54
for n being Element of NAT
for p being Point of (TOP-REAL n)
for x, y being real number holds (x - y) * p = (x * p) - (y * p)
proof end;

theorem Th55: :: EUCLID:55
for p being Point of (TOP-REAL 2) ex x, y being Real st p = <*x,y*> by FINSEQ_2:120;

definition
let p be Point of (TOP-REAL 2);
func c1 `1 -> Real means :Def14: :: EUCLID:def 14
for f being FinSequence st p = f holds
it = f . 1;
existence
ex b1 being Real st
for f being FinSequence st p = f holds
b1 = f . 1
proof end;
uniqueness
for b1, b2 being Real st ( for f being FinSequence st p = f holds
b1 = f . 1 ) & ( for f being FinSequence st p = f holds
b2 = f . 1 ) holds
b1 = b2
proof end;
func c1 `2 -> Real means :Def15: :: EUCLID:def 15
for f being FinSequence st p = f holds
it = f . 2;
existence
ex b1 being Real st
for f being FinSequence st p = f holds
b1 = f . 2
proof end;
uniqueness
for b1, b2 being Real st ( for f being FinSequence st p = f holds
b1 = f . 2 ) & ( for f being FinSequence st p = f holds
b2 = f . 2 ) holds
b1 = b2
proof end;
end;

:: deftheorem Def14 defines `1 EUCLID:def 14 :
for p being Point of (TOP-REAL 2)
for b2 being Real holds
( b2 = p `1 iff for f being FinSequence st p = f holds
b2 = f . 1 );

:: deftheorem Def15 defines `2 EUCLID:def 15 :
for p being Point of (TOP-REAL 2)
for b2 being Real holds
( b2 = p `2 iff for f being FinSequence st p = f holds
b2 = f . 2 );

definition
let x be real number , y be real number ;
func |[c1,c2]| -> Point of (TOP-REAL 2) equals :: EUCLID:def 16
<*x,y*>;
coherence
<*x,y*> is Point of (TOP-REAL 2)
proof end;
end;

:: deftheorem Def16 defines |[ EUCLID:def 16 :
for x, y being real number holds |[x,y]| = <*x,y*>;

theorem Th56: :: EUCLID:56
for x, y being real number holds
( |[x,y]| `1 = x & |[x,y]| `2 = y )
proof end;

theorem Th57: :: EUCLID:57
for p being Point of (TOP-REAL 2) holds p = |[(p `1 ),(p `2 )]|
proof end;

theorem Th58: :: EUCLID:58
0.REAL 2 = |[0,0]| by FINSEQ_2:75;

theorem Th59: :: EUCLID:59
for p1, p2 being Point of (TOP-REAL 2) holds p1 + p2 = |[((p1 `1 ) + (p2 `1 )),((p1 `2 ) + (p2 `2 ))]|
proof end;

theorem Th60: :: EUCLID:60
for x1, y1, x2, y2 being real number holds |[x1,y1]| + |[x2,y2]| = |[(x1 + x2),(y1 + y2)]|
proof end;

theorem Th61: :: EUCLID:61
for x being real number
for p being Point of (TOP-REAL 2) holds x * p = |[(x * (p `1 )),(x * (p `2 ))]|
proof end;

theorem Th62: :: EUCLID:62
for x, x1, y1 being real number holds x * |[x1,y1]| = |[(x * x1),(x * y1)]|
proof end;

theorem Th63: :: EUCLID:63
for p being Point of (TOP-REAL 2) holds - p = |[(- (p `1 )),(- (p `2 ))]|
proof end;

theorem Th64: :: EUCLID:64
for x1, y1 being real number holds - |[x1,y1]| = |[(- x1),(- y1)]|
proof end;

theorem Th65: :: EUCLID:65
for p1, p2 being Point of (TOP-REAL 2) holds p1 - p2 = |[((p1 `1 ) - (p2 `1 )),((p1 `2 ) - (p2 `2 ))]|
proof end;

theorem Th66: :: EUCLID:66
for x1, y1, x2, y2 being real number holds |[x1,y1]| - |[x2,y2]| = |[(x1 - x2),(y1 - y2)]|
proof end;