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 Th45:
  A,B,C is_a_triangle & |(B-A,B-C)| <> 0 implies
  the_foot_of_the_altitude(A,B,C),B,A is_a_triangle
  proof
    assume that
A1: A,B,C is_a_triangle and
A2: |(B-A,B-C)| <> 0;
A3: A,B,C are_mutually_distinct by A1,EUCLID_6:20;
    set p = the_foot_of_the_altitude(A,B,C);
    consider P being Point of TOP-REAL 2 such that
A4: the_foot_of_the_altitude(A,B,C) = P and
A5: the_altitude(A,B,C) /\ Line(B,C) = {P} by A3,Def2;
    consider L1,L2 being Element of line_of_REAL 2 such that
A6: the_altitude(A,B,C) = L1 and
A7: L2 = Line(B,C) and
A8: A in L1 and L1 _|_ L2 by A3,Def1;
A9: P <> B by A4,A3,A2,Th41;
A10: p <> A by A1,Th44;
A11: p,B,A are_mutually_distinct by A3,A2,Th41,A1,Th44;
    P in Line(B,C) by A4,A3,Th35;
    then B in Line(B,P) & C in Line(B,P) by A9,Th8,EUCLID_4:41;
    then
A12: Line(B,P) c= Line(B,C) by A3,EUCLID_4:43;
A13: angle(p,B,A) <> PI
     proof
       assume angle(p,B,A) = PI;
       then B in LSeg(p,A) by EUCLID_6:11;
       then B in Line(P,A) by A4,MENELAUS:12;
       then A in Line(B,P) by A3,A2,Th41,A4,Th8;
       then A in L1 /\ L2 by A12,A8,A7,XBOOLE_0:def 4;
       hence contradiction by A5,A6,A7,A4,A10,TARSKI:def 1;
     end;
A14: angle(B,A,p) <> PI
     proof
       assume angle(B,A,p) = PI;
       then A in LSeg(B,p) by EUCLID_6:11;
       then A in L1 & A in L2 by A12,A8,A7,A4,MENELAUS:12;
       then A in L1 /\ L2 by XBOOLE_0:def 4;
       hence contradiction by A4,A10,A5,A6,A7,TARSKI:def 1;
     end;
     angle(A,p,B) <> PI
     proof
       assume angle(A,p,B) = PI;
       then p in LSeg(A,B) by EUCLID_6:11;
       then P in Line(A,B) by A4,MENELAUS:12;
       then A in Line(B,P) by A9,Th8;
       then A in L1 /\ L2 by A12,A8,A7,XBOOLE_0:def 4;
       then A = P by A5,A6,A7,TARSKI:def 1;
       hence contradiction by A4,A1,Th44;
     end;
     hence thesis by A11,A13,A14,EUCLID_6:20;
   end;
