:: EUCLID_4 semantic presentation

theorem Th1: :: EUCLID_4:1
for b1 being Nat
for b2 being Element of REAL b1 holds
( (0 * b2) + b2 = b2 & b2 + (0* b1) = b2 )
proof end;

theorem Th2: :: EUCLID_4:2
for b1 being Real
for b2 being Nat holds b1 * (0* b2) = 0* b2
proof end;

theorem Th3: :: EUCLID_4:3
for b1 being Nat
for b2 being Element of REAL b1 holds
( 1 * b2 = b2 & 0 * b2 = 0* b1 )
proof end;

theorem Th4: :: EUCLID_4:4
for b1, b2 being Real
for b3 being Nat
for b4 being Element of REAL b3 holds (b1 * b2) * b4 = b1 * (b2 * b4)
proof end;

theorem Th5: :: EUCLID_4:5
for b1 being Real
for b2 being Nat
for b3 being Element of REAL b2 holds
( not b1 * b3 = 0* b2 or b1 = 0 or b3 = 0* b2 )
proof end;

theorem Th6: :: EUCLID_4:6
for b1 being Real
for b2 being Nat
for b3, b4 being Element of REAL b2 holds b1 * (b3 + b4) = (b1 * b3) + (b1 * b4)
proof end;

theorem Th7: :: EUCLID_4:7
for b1, b2 being Real
for b3 being Nat
for b4 being Element of REAL b3 holds (b1 + b2) * b4 = (b1 * b4) + (b2 * b4)
proof end;

theorem Th8: :: EUCLID_4:8
for b1 being Real
for b2 being Nat
for b3, b4 being Element of REAL b2 holds
( not b1 * b3 = b1 * b4 or b1 = 0 or b3 = b4 )
proof end;

definition
let c1 be Nat;
let c2, c3 be Element of REAL c1;
func Line c2,c3 -> Subset of (REAL a1) equals :: EUCLID_4:def 1
{ (((1 - b1) * a2) + (b1 * a3)) where B is Real : verum } ;
coherence
{ (((1 - b1) * c2) + (b1 * c3)) where B is Real : verum } is Subset of (REAL c1)
proof end;
end;

:: deftheorem Def1 defines Line EUCLID_4:def 1 :
for b1 being Nat
for b2, b3 being Element of REAL b1 holds Line b2,b3 = { (((1 - b4) * b2) + (b4 * b3)) where B is Real : verum } ;

registration
let c1 be Nat;
let c2, c3 be Element of REAL c1;
cluster Line a2,a3 -> non empty ;
coherence
not Line c2,c3 is empty
proof end;
end;

Lemma7: for b1 being Nat
for b2, b3 being Element of REAL b1 holds Line b2,b3 c= Line b3,b2
proof end;

theorem Th9: :: EUCLID_4:9
for b1 being Nat
for b2, b3 being Element of REAL b1 holds Line b2,b3 = Line b3,b2
proof end;

definition
let c1 be Nat;
let c2, c3 be Element of REAL c1;
redefine func Line as Line c2,c3 -> Subset of (REAL a1);
commutativity
for b1, b2 being Element of REAL c1 holds Line b1,b2 = Line b2,b1
by Th9;
end;

theorem Th10: :: EUCLID_4:10
for b1 being Nat
for b2, b3 being Element of REAL b1 holds
( b2 in Line b2,b3 & b3 in Line b2,b3 )
proof end;

Lemma10: for b1 being Nat
for b2, b3, b4 being Element of REAL b1 holds b2 + (b3 + b4) = (b2 + b3) + b4
proof end;

theorem Th11: :: EUCLID_4:11
for b1 being Nat
for b2, b3, b4, b5 being Element of REAL b1 st b2 in Line b3,b4 & b5 in Line b3,b4 holds
Line b2,b5 c= Line b3,b4
proof end;

theorem Th12: :: EUCLID_4:12
for b1 being Nat
for b2, b3, b4, b5 being Element of REAL b1 st b2 in Line b3,b4 & b5 in Line b3,b4 & b2 <> b5 holds
Line b3,b4 c= Line b2,b5
proof end;

definition
let c1 be Nat;
let c2 be Subset of (REAL c1);
attr a2 is being_line means :Def2: :: EUCLID_4:def 2
ex b1, b2 being Element of REAL a1 st
( b1 <> b2 & a2 = Line b1,b2 );
end;

:: deftheorem Def2 defines being_line EUCLID_4:def 2 :
for b1 being Nat
for b2 being Subset of (REAL b1) holds
( b2 is being_line iff ex b3, b4 being Element of REAL b1 st
( b3 <> b4 & b2 = Line b3,b4 ) );

notation
let c1 be Nat;
let c2 be Subset of (REAL c1);
synonym c2 is_line for being_line c2;
end;

Lemma14: for b1 being Nat
for b2 being Subset of (REAL b1)
for b3, b4 being Element of REAL b1 st b2 is_line & b3 in b2 & b4 in b2 & b3 <> b4 holds
b2 = Line b3,b4
proof end;

theorem Th13: :: EUCLID_4:13
for b1 being Nat
for b2, b3 being Subset of (REAL b1)
for b4, b5 being Element of REAL b1 st b2 is_line & b3 is_line & b4 in b2 & b5 in b2 & b4 in b3 & b5 in b3 & not b4 = b5 holds
b2 = b3
proof end;

theorem Th14: :: EUCLID_4:14
for b1 being Nat
for b2 being Subset of (REAL b1) st b2 is_line holds
ex b3, b4 being Element of REAL b1 st
( b3 in b2 & b4 in b2 & b3 <> b4 )
proof end;

theorem Th15: :: EUCLID_4:15
for b1 being Nat
for b2 being Element of REAL b1
for b3 being Subset of (REAL b1) st b3 is_line holds
ex b4 being Element of REAL b1 st
( b2 <> b4 & b4 in b3 )
proof end;

definition
let c1 be Nat;
let c2 be Element of REAL c1;
func Rn2Fin c2 -> FinSequence of REAL equals :: EUCLID_4:def 3
a2;
correctness
coherence
c2 is FinSequence of REAL
;
proof end;
end;

:: deftheorem Def3 defines Rn2Fin EUCLID_4:def 3 :
for b1 being Nat
for b2 being Element of REAL b1 holds Rn2Fin b2 = b2;

definition
let c1 be Nat;
let c2 be Element of REAL c1;
func |.c2.| -> Real equals :: EUCLID_4:def 4
|.(Rn2Fin a2).|;
correctness
coherence
|.(Rn2Fin c2).| is Real
;
;
end;

:: deftheorem Def4 defines |. EUCLID_4:def 4 :
for b1 being Nat
for b2 being Element of REAL b1 holds |.b2.| = |.(Rn2Fin b2).|;

definition
let c1 be Nat;
let c2, c3 be Element of REAL c1;
func |(c2,c3)| -> Real equals :: EUCLID_4:def 5
|((Rn2Fin a2),(Rn2Fin a3))|;
correctness
coherence
|((Rn2Fin c2),(Rn2Fin c3))| is Real
;
by XREAL_0:def 1;
commutativity
for b1 being Real
for b2, b3 being Element of REAL c1 st b1 = |((Rn2Fin b2),(Rn2Fin b3))| holds
b1 = |((Rn2Fin b3),(Rn2Fin b2))|
;
end;

:: deftheorem Def5 defines |( EUCLID_4:def 5 :
for b1 being Nat
for b2, b3 being Element of REAL b1 holds |(b2,b3)| = |((Rn2Fin b2),(Rn2Fin b3))|;

theorem Th16: :: EUCLID_4:16
for b1 being Nat
for b2, b3 being Element of REAL b1 holds |(b2,b3)| = (1 / 4) * ((|.(b2 + b3).| ^2 ) - (|.(b2 - b3).| ^2 )) by EUCLID_2:10;

theorem Th17: :: EUCLID_4:17
for b1 being Nat
for b2 being Element of REAL b1 holds |(b2,b2)| >= 0 by EUCLID_2:11;

theorem Th18: :: EUCLID_4:18
for b1 being Nat
for b2 being Element of REAL b1 holds |.b2.| ^2 = |(b2,b2)| by EUCLID_2:12;

theorem Th19: :: EUCLID_4:19
for b1 being Nat
for b2 being Element of REAL b1 holds 0 <= |.b2.| by EUCLID_2:14;

theorem Th20: :: EUCLID_4:20
for b1 being Nat
for b2 being Element of REAL b1 holds |.b2.| = sqrt |(b2,b2)|
proof end;

theorem Th21: :: EUCLID_4:21
for b1 being Nat
for b2 being Element of REAL b1 holds
( |(b2,b2)| = 0 iff |.b2.| = 0 )
proof end;

Lemma20: for b1 being Nat
for b2 being Element of REAL b1 holds b2 - (0* b1) = b2
proof end;

Lemma21: for b1 being Nat
for b2 being Element of REAL b1 holds (0* b1) - b2 = - b2
proof end;

theorem Th22: :: EUCLID_4:22
for b1 being Nat
for b2 being Element of REAL b1 holds
( |(b2,b2)| = 0 iff b2 = 0* b1 )
proof end;

theorem Th23: :: EUCLID_4:23
for b1 being Nat
for b2 being Element of REAL b1 holds |(b2,(0* b1))| = 0
proof end;

theorem Th24: :: EUCLID_4:24
for b1 being Nat
for b2 being Element of REAL b1 holds |((0* b1),b2)| = 0 by Th23;

Lemma24: for b1 being Nat
for b2 being Element of REAL b1 holds len (Rn2Fin b2) = b1
by EUCLID:2;

theorem Th25: :: EUCLID_4:25
for b1 being Nat
for b2, b3, b4 being Element of REAL b1 holds |((b2 + b3),b4)| = |(b2,b4)| + |(b3,b4)|
proof end;

theorem Th26: :: EUCLID_4:26
for b1 being Nat
for b2, b3 being Element of REAL b1
for b4 being real number holds |((b4 * b2),b3)| = b4 * |(b2,b3)|
proof end;

theorem Th27: :: EUCLID_4:27
for b1 being Nat
for b2, b3 being Element of REAL b1
for b4 being real number holds |(b2,(b4 * b3))| = b4 * |(b2,b3)| by Th26;

theorem Th28: :: EUCLID_4:28
for b1 being Nat
for b2, b3 being Element of REAL b1 holds |((- b2),b3)| = - |(b2,b3)|
proof end;

theorem Th29: :: EUCLID_4:29
for b1 being Nat
for b2, b3 being Element of REAL b1 holds |(b2,(- b3))| = - |(b2,b3)| by Th28;

theorem Th30: :: EUCLID_4:30
for b1 being Nat
for b2, b3 being Element of REAL b1 holds |((- b2),(- b3))| = |(b2,b3)|
proof end;

theorem Th31: :: EUCLID_4:31
for b1 being Nat
for b2, b3, b4 being Element of REAL b1 holds |((b2 - b3),b4)| = |(b2,b4)| - |(b3,b4)|
proof end;

theorem Th32: :: EUCLID_4:32
for b1 being Nat
for b2, b3 being real number
for b4, b5, b6 being Element of REAL b1 holds |(((b2 * b4) + (b3 * b5)),b6)| = (b2 * |(b4,b6)|) + (b3 * |(b5,b6)|)
proof end;

theorem Th33: :: EUCLID_4:33
for b1 being Nat
for b2, b3, b4 being Element of REAL b1 holds |(b2,(b3 + b4))| = |(b2,b3)| + |(b2,b4)| by Th25;

theorem Th34: :: EUCLID_4:34
for b1 being Nat
for b2, b3, b4 being Element of REAL b1 holds |(b2,(b3 - b4))| = |(b2,b3)| - |(b2,b4)| by Th31;

theorem Th35: :: EUCLID_4:35
for b1 being Nat
for b2, b3, b4, b5 being Element of REAL b1 holds |((b2 + b3),(b4 + b5))| = ((|(b2,b4)| + |(b2,b5)|) + |(b3,b4)|) + |(b3,b5)|
proof end;

theorem Th36: :: EUCLID_4:36
for b1 being Nat
for b2, b3, b4, b5 being Element of REAL b1 holds |((b2 - b3),(b4 - b5))| = ((|(b2,b4)| - |(b2,b5)|) - |(b3,b4)|) + |(b3,b5)|
proof end;

theorem Th37: :: EUCLID_4:37
for b1 being Nat
for b2, b3 being Element of REAL b1 holds |((b2 + b3),(b2 + b3))| = (|(b2,b2)| + (2 * |(b2,b3)|)) + |(b3,b3)|
proof end;

theorem Th38: :: EUCLID_4:38
for b1 being Nat
for b2, b3 being Element of REAL b1 holds |((b2 - b3),(b2 - b3))| = (|(b2,b2)| - (2 * |(b2,b3)|)) + |(b3,b3)|
proof end;

theorem Th39: :: EUCLID_4:39
for b1 being Nat
for b2, b3 being Element of REAL b1 holds |.(b2 + b3).| ^2 = ((|.b2.| ^2 ) + (2 * |(b2,b3)|)) + (|.b3.| ^2 )
proof end;

theorem Th40: :: EUCLID_4:40
for b1 being Nat
for b2, b3 being Element of REAL b1 holds |.(b2 - b3).| ^2 = ((|.b2.| ^2 ) - (2 * |(b2,b3)|)) + (|.b3.| ^2 )
proof end;

theorem Th41: :: EUCLID_4:41
for b1 being Nat
for b2, b3 being Element of REAL b1 holds (|.(b2 + b3).| ^2 ) + (|.(b2 - b3).| ^2 ) = 2 * ((|.b2.| ^2 ) + (|.b3.| ^2 ))
proof end;

theorem Th42: :: EUCLID_4:42
for b1 being Nat
for b2, b3 being Element of REAL b1 holds (|.(b2 + b3).| ^2 ) - (|.(b2 - b3).| ^2 ) = 4 * |(b2,b3)|
proof end;

theorem Th43: :: EUCLID_4:43
for b1 being Nat
for b2, b3 being Element of REAL b1 holds abs |(b2,b3)| <= |.b2.| * |.b3.|
proof end;

theorem Th44: :: EUCLID_4:44
for b1 being Nat
for b2, b3 being Element of REAL b1 holds |.(b2 + b3).| <= |.b2.| + |.b3.|
proof end;

definition
let c1 be Nat;
let c2, c3 be Element of REAL c1;
pred c2,c3 are_orthogonal means :Def6: :: EUCLID_4:def 6
|(a2,a3)| = 0;
symmetry
for b1, b2 being Element of REAL c1 st |(b1,b2)| = 0 holds
|(b2,b1)| = 0
;
end;

:: deftheorem Def6 defines are_orthogonal EUCLID_4:def 6 :
for b1 being Nat
for b2, b3 being Element of REAL b1 holds
( b2,b3 are_orthogonal iff |(b2,b3)| = 0 );

Lemma34: for b1 being Nat
for b2, b3, b4 being Element of REAL b1 holds b2 - (b3 + b4) = (b2 - b3) - b4
proof end;

Lemma35: for b1 being Real
for b2 being Nat
for b3 being Element of REAL b2 holds
( - (b1 * b3) = (- b1) * b3 & - (b1 * b3) = b1 * (- b3) )
proof end;

Lemma36: for b1 being Nat
for b2, b3 being Element of REAL b1 holds b2 - b3 = b2 + (- b3)
proof end;

Lemma37: for b1 being Nat
for b2 being Element of REAL b1 holds b2 - b2 = 0* b1
proof end;

Lemma38: for b1 being Nat
for b2, b3 being Element of REAL b1 st b2 <> b3 holds
|.(b2 - b3).| <> 0
proof end;

Lemma39: for b1 being Nat
for b2, b3, b4, b5 being Element of REAL b1 st b2 in Line b4,b5 & b3 in Line b4,b5 holds
ex b6 being Real st b2 - b3 = b6 * (b4 - b5)
proof end;

Lemma40: for b1 being Nat
for b2, b3, b4 being Element of REAL b1 ex b5 being Element of REAL b1 st
( b5 in Line b2,b3 & b2 - b3,b4 - b5 are_orthogonal & ( for b6 being Element of REAL b1 st b6 in Line b2,b3 holds
|.(b4 - b5).| <= |.(b4 - b6).| ) )
proof end;

theorem Th45: :: EUCLID_4:45
for b1 being Nat
for b2 being Subset of REAL
for b3, b4, b5 being Element of REAL b1 st b2 = { |.(b5 - b6).| where B is Element of REAL b1 : b6 in Line b3,b4 } holds
ex b6 being Element of REAL b1 st
( b6 in Line b3,b4 & |.(b5 - b6).| = lower_bound b2 & b3 - b4,b5 - b6 are_orthogonal )
proof end;

definition
let c1 be Nat;
let c2, c3 be Point of (TOP-REAL c1);
func Line c2,c3 -> Subset of (TOP-REAL a1) equals :: EUCLID_4:def 7
{ (((1 - b1) * a2) + (b1 * a3)) where B is Real : verum } ;
coherence
{ (((1 - b1) * c2) + (b1 * c3)) where B is Real : verum } is Subset of (TOP-REAL c1)
proof end;
end;

:: deftheorem Def7 defines Line EUCLID_4:def 7 :
for b1 being Nat
for b2, b3 being Point of (TOP-REAL b1) holds Line b2,b3 = { (((1 - b4) * b2) + (b4 * b3)) where B is Real : verum } ;

registration
let c1 be Nat;
let c2, c3 be Point of (TOP-REAL c1);
cluster Line a2,a3 -> non empty ;
coherence
not Line c2,c3 is empty
proof end;
end;

Lemma41: for b1 being Nat
for b2, b3 being Point of (TOP-REAL b1) ex b4, b5 being Element of REAL b1 st
( b2 = b4 & b3 = b5 & Line b4,b5 = Line b2,b3 )
proof end;

theorem Th46: :: EUCLID_4:46
for b1 being Nat
for b2, b3 being Point of (TOP-REAL b1) holds Line b2,b3 = Line b3,b2
proof end;

definition
let c1 be Nat;
let c2, c3 be Point of (TOP-REAL c1);
redefine func Line as Line c2,c3 -> Subset of (TOP-REAL a1);
commutativity
for b1, b2 being Point of (TOP-REAL c1) holds Line b1,b2 = Line b2,b1
by Th46;
end;

theorem Th47: :: EUCLID_4:47
for b1 being Nat
for b2, b3 being Point of (TOP-REAL b1) holds
( b2 in Line b2,b3 & b3 in Line b2,b3 )
proof end;

theorem Th48: :: EUCLID_4:48
for b1 being Nat
for b2, b3, b4, b5 being Point of (TOP-REAL b1) st b2 in Line b3,b4 & b5 in Line b3,b4 holds
Line b2,b5 c= Line b3,b4
proof end;

theorem Th49: :: EUCLID_4:49
for b1 being Nat
for b2, b3, b4, b5 being Point of (TOP-REAL b1) st b2 in Line b3,b4 & b5 in Line b3,b4 & b2 <> b5 holds
Line b3,b4 c= Line b2,b5
proof end;

definition
let c1 be Nat;
let c2 be Subset of (TOP-REAL c1);
attr a2 is being_line means :Def8: :: EUCLID_4:def 8
ex b1, b2 being Point of (TOP-REAL a1) st
( b1 <> b2 & a2 = Line b1,b2 );
end;

:: deftheorem Def8 defines being_line EUCLID_4:def 8 :
for b1 being Nat
for b2 being Subset of (TOP-REAL b1) holds
( b2 is being_line iff ex b3, b4 being Point of (TOP-REAL b1) st
( b3 <> b4 & b2 = Line b3,b4 ) );

notation
let c1 be Nat;
let c2 be Subset of (TOP-REAL c1);
synonym c2 is_line for being_line c2;
end;

Lemma47: for b1 being Nat
for b2 being Subset of (TOP-REAL b1)
for b3, b4 being Point of (TOP-REAL b1) st b2 is_line & b3 in b2 & b4 in b2 & b3 <> b4 holds
b2 = Line b3,b4
proof end;

theorem Th50: :: EUCLID_4:50
for b1 being Nat
for b2, b3 being Point of (TOP-REAL b1)
for b4, b5 being Subset of (TOP-REAL b1) st b4 is_line & b5 is_line & b2 in b4 & b3 in b4 & b2 in b5 & b3 in b5 & not b2 = b3 holds
b4 = b5
proof end;

theorem Th51: :: EUCLID_4:51
for b1 being Nat
for b2 being Subset of (TOP-REAL b1) st b2 is_line holds
ex b3, b4 being Point of (TOP-REAL b1) st
( b3 in b2 & b4 in b2 & b3 <> b4 )
proof end;

theorem Th52: :: EUCLID_4:52
for b1 being Nat
for b2 being Point of (TOP-REAL b1)
for b3 being Subset of (TOP-REAL b1) st b3 is_line holds
ex b4 being Point of (TOP-REAL b1) st
( b2 <> b4 & b4 in b3 )
proof end;

definition
let c1 be Nat;
let c2 be Point of (TOP-REAL c1);
func TPn2Rn c2 -> Element of REAL a1 equals :: EUCLID_4:def 9
a2;
correctness
coherence
c2 is Element of REAL c1
;
by EUCLID:25;
end;

:: deftheorem Def9 defines TPn2Rn EUCLID_4:def 9 :
for b1 being Nat
for b2 being Point of (TOP-REAL b1) holds TPn2Rn b2 = b2;

definition
let c1 be Nat;
let c2 be Point of (TOP-REAL c1);
func |.c2.| -> Real equals :: EUCLID_4:def 10
|.(TPn2Rn a2).|;
correctness
coherence
|.(TPn2Rn c2).| is Real
;
;
end;

:: deftheorem Def10 defines |. EUCLID_4:def 10 :
for b1 being Nat
for b2 being Point of (TOP-REAL b1) holds |.b2.| = |.(TPn2Rn b2).|;

definition
let c1 be Nat;
let c2, c3 be Point of (TOP-REAL c1);
func |(c2,c3)| -> Real equals :: EUCLID_4:def 11
|((TPn2Rn a2),(TPn2Rn a3))|;
correctness
coherence
|((TPn2Rn c2),(TPn2Rn c3))| is Real
;
;
commutativity
for b1 being Real
for b2, b3 being Point of (TOP-REAL c1) st b1 = |((TPn2Rn b2),(TPn2Rn b3))| holds
b1 = |((TPn2Rn b3),(TPn2Rn b2))|
;
end;

:: deftheorem Def11 defines |( EUCLID_4:def 11 :
for b1 being Nat
for b2, b3 being Point of (TOP-REAL b1) holds |(b2,b3)| = |((TPn2Rn b2),(TPn2Rn b3))|;

definition
let c1 be Nat;
let c2, c3 be Point of (TOP-REAL c1);
pred c2,c3 are_orthogonal means :Def12: :: EUCLID_4:def 12
|(a2,a3)| = 0;
symmetry
for b1, b2 being Point of (TOP-REAL c1) st |(b1,b2)| = 0 holds
|(b2,b1)| = 0
;
end;

:: deftheorem Def12 defines are_orthogonal EUCLID_4:def 12 :
for b1 being Nat
for b2, b3 being Point of (TOP-REAL b1) holds
( b2,b3 are_orthogonal iff |(b2,b3)| = 0 );

theorem Th53: :: EUCLID_4:53
for b1 being Nat
for b2 being Subset of REAL
for b3, b4, b5 being Point of (TOP-REAL b1) st b2 = { |.(b5 - b6).| where B is Point of (TOP-REAL b1) : b6 in Line b3,b4 } holds
ex b6 being Point of (TOP-REAL b1) st
( b6 in Line b3,b4 & |.(b5 - b6).| = lower_bound b2 & b3 - b4,b5 - b6 are_orthogonal )
proof end;