reserve n for Element of NAT,
  a, r for Real,
  x for Point of TOP-REAL n;
reserve n for Element of NAT,
  r for non negative Real,
  s, t, x for Point of TOP-REAL n;
reserve n for non zero Element of NAT,
  s, t, o for Point of TOP-REAL n;

theorem Th8:
  for r1, r2, s1, s2 being Real, s, t, o being Point of
TOP-REAL 2 holds s is Point of Tdisk(o,r) & t is Point of Tdisk(o,r) & s <> t &
r1 = t`1-s`1 & r2 = t`2-s`2 & s1 = s`1-o`1 & s2 = s`2-o`2 & a = (-(s1*r1+s2*r2)
+sqrt((s1*r1+s2*r2)^2-(r1^2+r2^2)*(s1^2+s2^2-r^2))) / (r1^2+r2^2) implies HC(s,
  t,o,r) = |[ s`1+a*r1, s`2+a*r2 ]|
proof
  let r1, r2, s1, s2 be Real, s, t, o be Point of TOP-REAL 2 such that
A1: s is Point of Tdisk(o,r) and
A2: t is Point of Tdisk(o,r) and
A3: s <> t and
A4: r1 = t`1-s`1 & r2 = t`2-s`2 and
A5: s1 = s`1-o`1 and
A6: s2 = s`2-o`2 and
A7: a = (-(s1*r1+s2*r2)+sqrt((s1*r1+s2*r2)^2-(r1^2+r2^2)*(s1^2+s2^2-r^2)
  )) / (r1^2+r2^2);
  the carrier of Tdisk(o,r) = cl_Ball(o,r) by Th3;
  then |. s-o .| <= r by A1,TOPREAL9:8;
  then
A8: |. s-o .|^2 <= r^2 by SQUARE_1:15;
  set C = s1^2+s2^2-r^2;
  set A = r1^2+r2^2;
  set M = s1*r1+s2*r2;
  set B = 2*M;
  set l1 = (- B - sqrt delta(A,B,C)) / (2 * A);
  set l2 = (- B + sqrt delta(A,B,C)) / (2 * A);
A9: delta(A,B,C) = B^2 - 4*A*C by QUIN_1:def 1;
  |. s-o .|^2 = ((s-o)`1)^2+((s-o)`2)^2 by JGRAPH_1:29
    .= s1^2+((s-o)`2)^2 by A5,TOPREAL3:3
    .= s1^2+s2^2 by A6,TOPREAL3:3;
  then
A10: C <= r^2-r^2 by A8,XREAL_1:9;
  then
A11: B^2 - 4*A*C >= 0;
A12: now
    set D = sqrt delta(A,B,C);
    assume l1 > l2;
    then -D - B > D - B by XREAL_1:72;
    then -D > D by XREAL_1:9;
    then -D+D > D+D by XREAL_1:6;
    hence contradiction by A9,A11;
  end;
  r1 <> 0 or r2 <> 0 by A3,A4,TOPREAL3:6;
  then
A13: (0 qua Nat)+(0 qua Nat) < A by SQUARE_1:12,XREAL_1:8;
  for x being Real holds Polynom(A,B,C,x) = Quard(A,l1,l2,x)
  proof
    let x be Real;
    thus Polynom(A,B,C,x) = A*x^2+B*x+C by POLYEQ_1:def 2
      .= A*(x-l1)*(x-l2) by A13,A9,A10,QUIN_1:16
      .= A*((x-l1)*(x-l2))
      .= Quard(A,l1,l2,x) by POLYEQ_1:def 3;
  end;
  then
A14: C/A = l1*l2 by A13,POLYEQ_1:11;
  delta(A,B,C) = B^2 - 4*A*C by QUIN_1:def 1
    .= 4*(M^2-A*C);
  then
A15: l2 = (-B+sqrt(4)*sqrt(M^2-A*C)) / (2*A) by A10,SQUARE_1:29
    .= (2*(-(M-sqrt(M^2-A*C)))) / (2*A) by SQUARE_1:20
    .= a by A7,XCMPLX_1:91;
  set H = HC(s,t,o,r);
A16: H in halfline(s,t) /\ Sphere(o,r) by A1,A2,A3,Def3;
  then H in halfline(s,t) by XBOOLE_0:def 4;
  then consider l being Real such that
A17: H = (1-l)*s + l*t and
A18: 0 <= l by TOPREAL9:26;
A19: H = 1 * s -l*s + l*t by A17,RLVECT_1:35
    .= s -l*s + l*t by RLVECT_1:def 8
    .= s+l*t-l*s by RLVECT_1:def 3
    .= s+(l*t-l*s) by RLVECT_1:def 3
    .= s+l*(t-s) by RLVECT_1:34;
  then
A20: H`1 = s`1+(l*(t-s))`1 by TOPREAL3:2
    .= s`1+l*(t-s)`1 by TOPREAL3:4
    .= s`1+l*(t`1-s`1) by TOPREAL3:3;
  H in Sphere(o,r) by A16,XBOOLE_0:def 4;
  then |. H-o .| = r by TOPREAL9:9;
  then r^2 = ((H-o)`1)^2 + ((H-o)`2)^2 by JGRAPH_1:29
    .= (H`1-o`1)^2 + ((H-o)`2)^2 by TOPREAL3:3
    .= (H`1-o`1)^2 + (H`2-o`2)^2 by TOPREAL3:3
    .= ((1-l)*s`1+l*t`1-o`1)^2 + (H`2-o`2)^2 by A17,TOPREAL9:41
    .= ((1-l)*s`1+l*t`1-o`1)^2 + ((1-l)*s`2+l*t`2-o`2)^2 by A17,TOPREAL9:42
    .= l^2*(r1^2+r2^2)+l*2*M+s1^2+s2^2 by A4,A5,A6;
  then A*l^2+B*l+C = 0;
  then Polynom(A,B,C,l) = 0 by POLYEQ_1:def 2;
  then
A21: l = l1 or l = l2 by A13,A9,A10,POLYEQ_1:5;
A22: H`2 = s`2+(l*(t-s))`2 by A19,TOPREAL3:2
    .= s`2+l*(t-s)`2 by TOPREAL3:4
    .= s`2+l*(t`2-s`2) by TOPREAL3:3;
  per cases by A10;
  suppose
    C < 0;
    hence thesis by A4,A18,A20,A22,A13,A15,A21,A14,A12,EUCLID:53,XREAL_1:141;
  end;
  suppose
    l1 = l2;
    hence thesis by A4,A20,A22,A15,A21,EUCLID:53;
  end;
  suppose
A23: C = 0;
    now
A24:  now
        assume l = 0;
        then H = s+0.TOP-REAL 2 by A19,RLVECT_1:10
          .= s by RLVECT_1:4;
        hence contradiction by A1,A2,A3,Def3;
      end;
      assume
A25:  l = l1;
      per cases;
      suppose
A26:    0 < B;
        then l1 = (-B-B) / (2*A) by A9,A23,SQUARE_1:22;
        hence contradiction by A18,A13,A25,A26,XREAL_1:129,141;
      end;
      suppose
        B <= 0;
        then l1 = (-B--B) / (2*A) by A9,A23,SQUARE_1:23
          .= 0;
        hence contradiction by A25,A24;
      end;
    end;
    hence thesis by A4,A20,A22,A15,A21,EUCLID:53;
  end;
end;
