reserve n for Nat;
reserve i for Integer;
reserve r,s,t for Real;
reserve An,Bn,Cn,Dn for Point of TOP-REAL n;
reserve L1,L2 for Element of line_of_REAL n;
reserve A,B,C for Point of TOP-REAL 2;
reserve D for Point of TOP-REAL 2;
reserve a,b,c,d for Real;

theorem Th50:
  A,B,C is_a_triangle & |(C-A,B-C)| is non zero & |(B-C,A-B)| is non zero &
  |(C-A,A-B)| is non zero implies
  Line(A,the_foot_of_the_altitude(A,B,C)),
  Line(C,the_foot_of_the_altitude(C,A,B)),
  Line(B,the_foot_of_the_altitude(B,C,A)) are_concurrent
  proof
    assume that
A1: A,B,C is_a_triangle and
A2: |(C-A,B-C)| is non zero & |(B-C,A-B)| is non zero &
    |(C-A,A-B)| is non zero;
A3: A,B,C are_mutually_distinct by A1,EUCLID_6:20;
    set r = -(|(B,C)| -|(C,C)| -|(A,B)|+|(A,C)|)/|(B-C,B-C)|,
        s = -(|(C,A)| -|(A,A)| -|(B,C)|+|(B,A)|)/|(C-A,C-A)|,
        t = -(|(A,B)| -|(B,B)| -|(C,A)|+|(C,B)|)/|(A-B,A-B)|,
        D = r * B + (1 - r) * C, E = s * C + (1 - s) * A,
        F = t * A + (1 - t) * B;
    D <> C & E <> A & F <> B
    proof
      assume not (D <> C & E <> A & F <> B);
      then
A4:   C = the_foot_of_the_altitude(A,B,C) or
      A = the_foot_of_the_altitude(B,C,A) or
      B = the_foot_of_the_altitude(C,A,B) by A3,Th49;
      |(A-C,B-C)| = - |(C-A,B-C)| & |(B-A,C-A)| = - |(C-A,A-B)| &
      |(C-B,A-B)| = - |(B-C,A-B)| by Th16;
      hence contradiction by A4,A2,A3,Th38ThJ8;
    end;
    then
A5: D = the_foot_of_the_altitude(A,B,C) & E = the_foot_of_the_altitude(B,C,A) &
    F = the_foot_of_the_altitude(C,A,B) by A3,Th48;
    r/(1-r)*s/(1-s)*t/(1-t) = 1 by A3,A2,Th17;
    then
A6: (r/(1-r))*(t/(1-t))*(s/(1-s)) = 1;
A7: A,C,B is_a_triangle by A1,MENELAUS:15;
    r <> 1 & s <> 1 & t <> 1
    proof
      assume not (r <> 1 & s <> 1 & t <> 1);
      then (r=1 & B <> C & r = -(|(B,C)| -|(C,C)| -|(A,B)|
           +|(A,C)|)/|(B-C,B-C)| &
      D = r * B + (1 - r) * C) or
      (s = 1 & C <> A & s = -(|(C,A)| -|(A,A)| -|(B,C)|+|(B,A)|)/|(C-A,C-A)| &
      E = s * C + (1 - s) * A) or
      (t = 1 & A <> B & t = -(|(A,B)| -|(B,B)| -|(C,A)|+|(C,B)|)/|(A-B,A-B)| &
      F = t * A + (1 - t) * B);
      hence contradiction by A2,Th19;
    end;
    hence thesis by A5,A6,A7,MENELAUS:22;
  end;
