reserve x for Real;

theorem Th32:
  rng (cos|[.0,PI.]) = [.-1,1 .]
proof
  set cos1 = cos|[.0,PI.];
  now
    let y be object;
    thus y in [.-1,1 .] implies
ex x be object st x in dom cos1 & y = cos1.x
    proof
      PI in [.0,PI.] by XXREAL_1:1;
      then
A1:   cos1.PI = cos.PI by FUNCT_1:49;
      assume
A2:   y in [.-1,1 .];
      then reconsider y1=y as Real;
A3:   dom cos1 = [.0,PI .] /\ REAL by RELAT_1:61,SIN_COS:24
        .= [.0,PI .] by XBOOLE_1:28;
      0 in [.0,PI.] by XXREAL_1:1;
      then cos1.0 = cos.0 by FUNCT_1:49;
      then
      cos1|[.0,PI.] is continuous & y1 in [.cos1.0,cos1.PI.] \/ [.cos1.PI,
      cos1.0 .] by A2,A1,SIN_COS:30,76,XBOOLE_0:def 3;
      then consider x be Real such that
A4:   x in [.0,PI.] and
A5:   y1 = cos1.x by A3,FCONT_2:15;
      take x;
      x in REAL /\ [.0,PI.] by A4,XBOOLE_0:def 4;
      hence thesis by A5,RELAT_1:61,SIN_COS:24;
    end;
    thus (ex x be object st x in dom cos1 & y = cos1.x)
implies y in [.-1,1 .]
    proof
      given x be object such that
A6:   x in dom cos1 and
A7:   y = cos1.x;
      dom cos1 c= dom cos by RELAT_1:60;
      then reconsider x1=x as Real by A6,SIN_COS:24;
      y = cos.x1 by A6,A7,FUNCT_1:47;
      hence thesis by Th27;
    end;
  end;
  hence thesis by FUNCT_1:def 3;
end;
