reserve x,x1,x2,x3 for Real;

theorem
  sin(x/2)<>0 & cos(x/2)<>0 & 1-(tan(x/2))^2<>0 implies sec(x/2)= sqrt((
  2*sec(x))/(sec(x)+1)) or sec(x/2)=-sqrt((2*sec(x))/(sec(x)+1))
proof
  assume that
A1: sin(x/2)<>0 and
A2: cos(x/2)<>0 and
A3: 1-(tan(x/2))^2<>0;
  set b=(sec(x/2))^2;
  set a=1-(tan(x/2))^2;
A4: a+b=(1+(tan(x/2))^2)+(1-(tan(x/2))^2) by A2,Th11
    .=1+1;
  sqrt((2*sec(x))/(sec(x)+1)) =sqrt((2*((sec(x/2))^2/(1-(tan(x/2))^2)))/(
  sec(2*(x/2))+1)) by A1,A2,Th13
    .=sqrt((2*((sec(x/2))^2/(1-(tan(x/2))^2))) /(((sec(x/2))^2/(1-(tan(x/2))
  ^2))+1)) by A1,A2,Th13;
  then
A5: sqrt((2*sec(x))/(sec(x)+1))=sqrt(((2*(b/a))*a)/((b/a+1)*a)) by A3,
XCMPLX_1:91
    .=sqrt((2*((b/a)*a))/(b/a*a+1*a))
    .=sqrt((2*((b/a)*a))/(b+a)) by A3,XCMPLX_1:87
    .=sqrt(2*b/2) by A3,A4,XCMPLX_1:87
    .=|.sec(x/2).| by COMPLEX1:72;
  per cases;
  suppose
    sec(x/2)>=0;
    hence thesis by A5,ABSVALUE:def 1;
  end;
  suppose
    sec(x/2)<0;
    then sqrt((2*sec(x))/(sec(x)+1))*(-1) =(-sec(x/2))*(-1) by A5,
ABSVALUE:def 1;
    hence thesis;
  end;
end;
