set XX = [:X,(the carrier of M \ {a}):] \/ {[X,a]};
defpred S1[ set , set , set ] means for x, y being Element of [:X,(the carrier of M \ {a}):] \/ {[X,a]} st x = $1 & y = $2 holds
for x1, y1 being set
for x2, y2 being Point of M st x = [x1,x2] & y = [y1,y2] holds
( ( x1 = y1 implies $3 = dist x2,y2 ) & ( x1 <> y1 implies $3 = (dist x2,a) + (dist a,y2) ) );
A1: for x, y being set st x in [:X,(the carrier of M \ {a}):] \/ {[X,a]} & y in [:X,(the carrier of M \ {a}):] \/ {[X,a]} holds
ex z being set st
( z in REAL & S1[x,y,z] )
proof
let x, y be set ; :: thesis: ( x in [:X,(the carrier of M \ {a}):] \/ {[X,a]} & y in [:X,(the carrier of M \ {a}):] \/ {[X,a]} implies ex z being set st
( z in REAL & S1[x,y,z] ) )

assume that
A2: x in [:X,(the carrier of M \ {a}):] \/ {[X,a]} and
A3: y in [:X,(the carrier of M \ {a}):] \/ {[X,a]} ; :: thesis: ex z being set st
( z in REAL & S1[x,y,z] )

consider y1 being set , y2 being Point of M such that
A4: y = [y1,y2] and
( ( y1 in X & y2 <> a ) or ( y1 = X & y2 = a ) ) by A3, Th38;
consider x1 being set , x2 being Point of M such that
A5: x = [x1,x2] and
( ( x1 in X & x2 <> a ) or ( x1 = X & x2 = a ) ) by A2, Th38;
now
per cases ( x1 = y1 or x1 <> y1 ) ;
suppose A6: x1 = y1 ; :: thesis: ex d being Element of REAL st
( d in REAL & ( for x9, y9 being Element of [:X,(the carrier of M \ {a}):] \/ {[X,a]} st x9 = x & y9 = y holds
for x19, y19 being set
for x29, y29 being Point of M st x9 = [x19,x29] & y9 = [y19,y29] holds
( ( x19 = y19 implies d = dist x29,y29 ) & ( x19 <> y19 implies d = (dist x29,a) + (dist a,y29) ) ) ) )

take d = dist x2,y2; :: thesis: ( d in REAL & ( for x9, y9 being Element of [:X,(the carrier of M \ {a}):] \/ {[X,a]} st x9 = x & y9 = y holds
for x19, y19 being set
for x29, y29 being Point of M st x9 = [x19,x29] & y9 = [y19,y29] holds
( ( x19 = y19 implies d = dist x29,y29 ) & ( x19 <> y19 implies d = (dist x29,a) + (dist a,y29) ) ) ) )

thus d in REAL ; :: thesis: for x9, y9 being Element of [:X,(the carrier of M \ {a}):] \/ {[X,a]} st x9 = x & y9 = y holds
for x19, y19 being set
for x29, y29 being Point of M st x9 = [x19,x29] & y9 = [y19,y29] holds
( ( x19 = y19 implies d = dist x29,y29 ) & ( x19 <> y19 implies d = (dist x29,a) + (dist a,y29) ) )

let x9, y9 be Element of [:X,(the carrier of M \ {a}):] \/ {[X,a]}; :: thesis: ( x9 = x & y9 = y implies for x19, y19 being set
for x29, y29 being Point of M st x9 = [x19,x29] & y9 = [y19,y29] holds
( ( x19 = y19 implies d = dist x29,y29 ) & ( x19 <> y19 implies d = (dist x29,a) + (dist a,y29) ) ) )

assume that
A7: x9 = x and
A8: y9 = y ; :: thesis: for x19, y19 being set
for x29, y29 being Point of M st x9 = [x19,x29] & y9 = [y19,y29] holds
( ( x19 = y19 implies d = dist x29,y29 ) & ( x19 <> y19 implies d = (dist x29,a) + (dist a,y29) ) )

let x19, y19 be set ; :: thesis: for x29, y29 being Point of M st x9 = [x19,x29] & y9 = [y19,y29] holds
( ( x19 = y19 implies d = dist x29,y29 ) & ( x19 <> y19 implies d = (dist x29,a) + (dist a,y29) ) )

let x29, y29 be Point of M; :: thesis: ( x9 = [x19,x29] & y9 = [y19,y29] implies ( ( x19 = y19 implies d = dist x29,y29 ) & ( x19 <> y19 implies d = (dist x29,a) + (dist a,y29) ) ) )
assume that
A9: x9 = [x19,x29] and
A10: y9 = [y19,y29] ; :: thesis: ( ( x19 = y19 implies d = dist x29,y29 ) & ( x19 <> y19 implies d = (dist x29,a) + (dist a,y29) ) )
A11: x29 = x2 by A5, A7, A9, ZFMISC_1:33;
x19 = x1 by A5, A7, A9, ZFMISC_1:33;
hence ( ( x19 = y19 implies d = dist x29,y29 ) & ( x19 <> y19 implies d = (dist x29,a) + (dist a,y29) ) ) by A4, A6, A8, A10, A11, ZFMISC_1:33; :: thesis: verum
end;
suppose A12: x1 <> y1 ; :: thesis: ex d being Element of REAL st
( d in REAL & ( for x9, y9 being Element of [:X,(the carrier of M \ {a}):] \/ {[X,a]} st x9 = x & y9 = y holds
for x19, y19 being set
for x29, y29 being Point of M st x9 = [x19,x29] & y9 = [y19,y29] holds
( ( x19 = y19 implies d = dist x29,y29 ) & ( x19 <> y19 implies d = (dist x29,a) + (dist a,y29) ) ) ) )

take d = (dist x2,a) + (dist a,y2); :: thesis: ( d in REAL & ( for x9, y9 being Element of [:X,(the carrier of M \ {a}):] \/ {[X,a]} st x9 = x & y9 = y holds
for x19, y19 being set
for x29, y29 being Point of M st x9 = [x19,x29] & y9 = [y19,y29] holds
( ( x19 = y19 implies d = dist x29,y29 ) & ( x19 <> y19 implies d = (dist x29,a) + (dist a,y29) ) ) ) )

thus d in REAL ; :: thesis: for x9, y9 being Element of [:X,(the carrier of M \ {a}):] \/ {[X,a]} st x9 = x & y9 = y holds
for x19, y19 being set
for x29, y29 being Point of M st x9 = [x19,x29] & y9 = [y19,y29] holds
( ( x19 = y19 implies d = dist x29,y29 ) & ( x19 <> y19 implies d = (dist x29,a) + (dist a,y29) ) )

let x9, y9 be Element of [:X,(the carrier of M \ {a}):] \/ {[X,a]}; :: thesis: ( x9 = x & y9 = y implies for x19, y19 being set
for x29, y29 being Point of M st x9 = [x19,x29] & y9 = [y19,y29] holds
( ( x19 = y19 implies d = dist x29,y29 ) & ( x19 <> y19 implies d = (dist x29,a) + (dist a,y29) ) ) )

assume that
A13: x9 = x and
A14: y9 = y ; :: thesis: for x19, y19 being set
for x29, y29 being Point of M st x9 = [x19,x29] & y9 = [y19,y29] holds
( ( x19 = y19 implies d = dist x29,y29 ) & ( x19 <> y19 implies d = (dist x29,a) + (dist a,y29) ) )

let x19, y19 be set ; :: thesis: for x29, y29 being Point of M st x9 = [x19,x29] & y9 = [y19,y29] holds
( ( x19 = y19 implies d = dist x29,y29 ) & ( x19 <> y19 implies d = (dist x29,a) + (dist a,y29) ) )

let x29, y29 be Point of M; :: thesis: ( x9 = [x19,x29] & y9 = [y19,y29] implies ( ( x19 = y19 implies d = dist x29,y29 ) & ( x19 <> y19 implies d = (dist x29,a) + (dist a,y29) ) ) )
assume that
A15: x9 = [x19,x29] and
A16: y9 = [y19,y29] ; :: thesis: ( ( x19 = y19 implies d = dist x29,y29 ) & ( x19 <> y19 implies d = (dist x29,a) + (dist a,y29) ) )
A17: x29 = x2 by A5, A13, A15, ZFMISC_1:33;
x19 = x1 by A5, A13, A15, ZFMISC_1:33;
hence ( ( x19 = y19 implies d = dist x29,y29 ) & ( x19 <> y19 implies d = (dist x29,a) + (dist a,y29) ) ) by A4, A12, A14, A16, A17, ZFMISC_1:33; :: thesis: verum
end;
end;
end;
hence ex z being set st
( z in REAL & S1[x,y,z] ) ; :: thesis: verum
end;
consider f being Function of [:([:X,(the carrier of M \ {a}):] \/ {[X,a]}),([:X,(the carrier of M \ {a}):] \/ {[X,a]}):],REAL such that
A18: for x, y being set st x in [:X,(the carrier of M \ {a}):] \/ {[X,a]} & y in [:X,(the carrier of M \ {a}):] \/ {[X,a]} holds
S1[x,y,f . x,y] from BINOP_1:sch 1(A1);
take f ; :: thesis: for x, y being Element of [:X,(the carrier of M \ {a}):] \/ {[X,a]}
for x1, y1 being set
for x2, y2 being Point of M st x = [x1,x2] & y = [y1,y2] holds
( ( x1 = y1 implies f . x,y = dist x2,y2 ) & ( x1 <> y1 implies f . x,y = (dist x2,a) + (dist a,y2) ) )

thus for x, y being Element of [:X,(the carrier of M \ {a}):] \/ {[X,a]}
for x1, y1 being set
for x2, y2 being Point of M st x = [x1,x2] & y = [y1,y2] holds
( ( x1 = y1 implies f . x,y = dist x2,y2 ) & ( x1 <> y1 implies f . x,y = (dist x2,a) + (dist a,y2) ) ) by A18; :: thesis: verum