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
  B,C,A is_a_triangle & angle(B,C,A) < PI & D,C,A is_a_triangle &
  angle(C,D,A)=PI/2 & A in LSeg(D,B) & A <> D implies
  |.D-C.| = |.A-B.| * sin angle(A,B,C) / sin (angle(D,A,C) - angle(A,B,C))
                    * sin angle(D,A,C)
  proof
    assume that
A1: B,C,A is_a_triangle and
A2: angle(B,C,A) < PI and
A3: D,C,A is_a_triangle and
A4: angle(C,D,A)=PI/2 and
A5: A in LSeg(D,B) and
A6: A <> D;
    B,C,A are_mutually_distinct by A1,EUCLID_6:20;
    then
A7: angle(D,A,C) + angle(C,A,B) = PI or
    angle(D,A,C) + angle(C,A,B) = 3*PI by A5,A6,EUCLID_6:13;
    sin (angle(C,A,B) + angle(A,B,C)) = sin (angle(D,A,C)-angle(A,B,C))
    proof
      per cases by A7;
      suppose angle(C,A,B) = PI - angle(D,A,C);
        then sin (angle(C,A,B)+angle(A,B,C))
                        = sin (PI - (angle(D,A,C)-angle(A,B,C)))
                       .= sin (angle(D,A,C)-angle(A,B,C)) by EUCLID10:1;
        hence thesis;
      end;
      suppose angle(C,A,B) = 3*PI - angle(D,A,C);
        then sin (angle(C,A,B)+angle(A,B,C))
                  = sin (2*PI*1 + (PI - (angle(D,A,C)-angle(A,B,C))))
                 .= sin (PI- (angle(D,A,C)-angle(A,B,C))) by COMPLEX2:8
                 .= sin (angle(D,A,C)-angle(A,B,C)) by EUCLID10:1;
        hence thesis;
      end;
    end;
    hence thesis by A1,A2,A3,A4,Th71;
  end;
