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 Th39:
  B <> C implies |(A - the_foot_of_the_altitude(A,B,C),
                   B - the_foot_of_the_altitude(A,B,C))| = 0
  proof
    assume
A1: B <> C;
    consider L1,L2 be Element of line_of_REAL 2 such that
A2: the_altitude(A,B,C) = L1 and
A3: L2 = Line(B,C) & A in L1 & L1 _|_ L2 by A1,Def1;
    per cases;
    suppose
A4:   B = the_foot_of_the_altitude(A,B,C);
      |(A - the_foot_of_the_altitude(A,B,C),
        B - the_foot_of_the_altitude(A,B,C))|
         = |( A - the_foot_of_the_altitude(A,B,C), B )|
           - |(A - the_foot_of_the_altitude(A,B,C),
                      the_foot_of_the_altitude(A,B,C))|
              by EUCLID_2:27;
      hence thesis by A4;
    end;
    suppose
A5:   B <> the_foot_of_the_altitude(A,B,C);
A6:   L2 is being_line by A3,EUCLIDLP:67;
      the_foot_of_the_altitude(A,B,C) in Line(B,C) & B in Line(B,C) &
         C in Line(B,C) by EUCLID_4:41,A1,Th35;
      then
A7:   Line(B,C) = Line(B,the_foot_of_the_altitude(A,B,C))
        by A6,A5,A3,EUCLID12:49;
      per cases;
      suppose not A in Line(B,C);
        then L1 _|_ L2 & L1 = Line(A,the_foot_of_the_altitude(A,B,C)) &
               L2 = Line(B,C) by A1,A2,A3,Th36;
        hence thesis by A7,EUCLID12:48;
      end;
      suppose A in Line(B,C);
        then
A8:     A = the_foot_of_the_altitude(A,B,C) by A1,Th37;
        |(A - the_foot_of_the_altitude(A,B,C),
             B - the_foot_of_the_altitude(A,B,C))|
            = |(A,B - the_foot_of_the_altitude(A,B,C))|
               - |(the_foot_of_the_altitude(A,B,C),
                   B - the_foot_of_the_altitude(A,B,C))| by EUCLID_2:27
           .= 0 by A8;
        hence thesis;
      end;
    end;
  end;
