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 Th48:
  B <> C & r = -(|(B,C)| -|(C,C)| -|(A,B)|+|(A,C)|)/|(B-C,B-C)|&
  D = r * B + (1 - r) * C & D <> C implies D = the_foot_of_the_altitude(A,B,C)
  proof
    assume that
A1: B <> C and
A2: r = -(|(B,C)| -|(C,C)| -|(A,B)|+|(A,C)|)/|(B-C,B-C)| and
A3: D = r * B + (1 - r) * C and
A4: D <> C;
    |(D-A,D-C)| = 0 by A1,A2,A3,Th11;
    then
A5: D = the_foot_of_the_altitude(A,D,C) by A4,Th43;
    reconsider rB = B, rC = C as Element of REAL 2 by EUCLID:22;
    D in Line(B,C)
    proof
      D in Line(rC,rB) by A3;
      hence thesis by EUCLID12:4;
    end;
    hence thesis by A1,A4,A5,Th42;
  end;
