reserve x,x1,x2,x3 for Real;

theorem
  cot(x/2) = sqrt((1+cos(x))/(1-cos(x))) or cot(x/2) =-sqrt((1+cos(x))/(
  1-cos(x)))
proof
A1: sqrt((1+cos(x))/(1-cos(x))) =sqrt((1+(2*(cos(x/2))^2-1))/(1-cos(2*(x/2))
  )) by Th7
    .=sqrt((1-(1-2*(cos(x/2))^2))/(1-(1-2*(sin(x/2))^2))) by Th7
    .=sqrt((cos(x/2))^2/(sin(x/2))^2) by XCMPLX_1:91
    .=sqrt((cot(x/2))^2) by XCMPLX_1:76
    .=|.cot(x/2).| by COMPLEX1:72;
  per cases;
  suppose
    cot(x/2)>=0;
    hence thesis by A1,ABSVALUE:def 1;
  end;
  suppose
    cot(x/2)<0;
    then sqrt((1+cos(x))/(1-cos(x)))*(-1) =(-cot(x/2))*(-1) by A1,
ABSVALUE:def 1;
    hence thesis;
  end;
end;
