%Patch files loaded: patch2 version 1.2.2.36

$$$PVSHOME/pvs-strategies
(load "/home/rwb/fm/pvs/bld/manip-strategies")

$$$top.pvs
top: THEORY
%------------------------------------------------------------------------------
%
%  Test suites designed to explore the capabilities/efficiency of theorem 
%  provers for nonlinear arithmetic and algebraic manipulations.
%
%  Author: Ricky W. Butler    NASA Langley
%
%------------------------------------------------------------------------------
BEGIN
   IMPORTING algebra_probs,
             trig_probs 

END top



$$$trig_inverses.pvs
trig_inverses: THEORY
%-----------------------------------------------------------------------------
%      trig_inverses
%      -------------
%         - defines inverse trig functions: arcsin, arccos, and arctan 
%-----------------------------------------------------------------------------
BEGIN

   IMPORTING trig_basic


   rngPI2: TYPE = {x: real | -PI/2 <= x AND x <= PI/2}
   rngPI:  TYPE = {x: real | 0 <= x AND x <= PI}
   rngPI2_lt: TYPE = {x: real | -PI/2 < x AND x < PI/2}

   rng1  : TYPE =  {y: real | -1 <= y AND y <= 1}

   a,x: VAR real
   y : VAR rng1

%  -------------------- Arcsin --------------------

   rsin(x: rngPI2): rng1 = sin(x)

   rsin_bij: AXIOM bijective?(rsin)

   arcsin(y: rng1): {x: rngPI2 | y = rsin(x)}

   arcsin_def: LEMMA arcsin = inverse(rsin)

   sin_arcsin: LEMMA (FORALL (y: rng1): sin(arcsin(y)) = y)

   arcsin_sin: LEMMA (FORALL (x: rngPI2): arcsin(sin(x)) = x)

%  -------------------- Arccos --------------------


   rcos(x: rngPI): rng1 = cos(x)

   rcos_bij: AXIOM bijective?(rcos)

   arccos(y: rng1): {x: rngPI | y = rcos(x)}

   arccos_def: LEMMA arccos = inverse(rcos)

   cos_arccos: LEMMA (FORALL (y: rng1): cos(arccos(y)) = y)

   arccos_cos: LEMMA (FORALL (x: rngPI): arccos(cos(x)) = x)



%  -------------------- Arctan --------------------

   rtan_prep: LEMMA FORALL (x: rngPI2_lt): Tan?(x);

   rtan(x: rngPI2_lt): real = tan(x)

   rtan_bij: AXIOM bijective?(rtan)

   arctan(y: real): {x: rngPI2_lt | y = rtan(x)}

   arctan_def: LEMMA arctan = inverse(rtan)

   tan_arctan: LEMMA (FORALL (y: real): tan(arctan(y)) = y)

   arctan_tan: LEMMA (FORALL (x: rngPI2_lt): arctan(tan(x)) = x)

 
END trig_inverses



$$$trig_inverses.prf
(|trig_inverses|
 (|arcsin_TCC1| "" (INST + "inverse(rsin)")
  (("" (SKOSIMP*)
    (("" (LEMMA "bijective_inverse[rngPI2,rng1]")
      (("" (INST?)
        (("1" (ASSERT) NIL NIL)
         ("2" (ASSERT)
          (("2" (HIDE 2)
            (("2" (LEMMA "rsin_bij") (("2" (PROPAX) NIL NIL)) NIL)) NIL))
          NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|arcsin_def_TCC1| "" (INST 1 "PI/2") (("" (ASSERT) NIL NIL)) NIL)
 (|arcsin_def| "" (APPLY-EXTENSIONALITY 1 :HIDE? T)
  (("1" (TYPEPRED "arcsin(x!1)")
    (("1" (LEMMA "bijective_inverse[rngPI2,rng1]")
      (("1" (INST?)
        (("1" (ASSERT) NIL NIL)
         ("2" (LEMMA "rsin_bij") (("2" (PROPAX) NIL NIL)) NIL))
        NIL))
      NIL))
    NIL)
   ("2" (SKOSIMP*)
    (("2" (LEMMA "bijective_inverse[rngPI2,rng1]")
      (("2" (INST?)
        (("1" (ASSERT) NIL NIL)
         ("2" (LEMMA "rsin_bij") (("2" (PROPAX) NIL NIL)) NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|sin_arcsin| "" (SKOSIMP*)
  (("" (TYPEPRED "arcsin(y!1)")
    (("" (EXPAND "rsin") (("" (ASSERT) NIL NIL)) NIL)) NIL))
  NIL)
 (|arcsin_sin| "" (SKOSIMP*)
  (("" (TYPEPRED "arcsin(sin(x!1))")
    (("" (LEMMA "rsin_bij")
      (("" (EXPAND "bijective?")
        (("" (FLATTEN)
          (("" (EXPAND "injective?")
            (("" (INST -1 "x!1" "arcsin(sin(x!1))")
              (("" (EXPAND "rsin") (("" (ASSERT) NIL NIL)) NIL)) NIL))
            NIL))
          NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|arcsin_abcde| "" (SKOSIMP*)
  (("" (REPLACE -1 * RL)
    (("" (HIDE -1)
      (("" (CASE "(EXISTS (i:int),(c: rngPI2): c = a!1 + 2*i*PI)")
        (("1" (SKOSIMP*)
          (("1" (CASE-REPLACE "sin(a!1) = sin(c!1)")
            (("1" (HIDE -1)
              (("1" (REWRITE "arcsin_sin")
                (("1" (INST + "-i!1") (("1" (ASSERT) NIL)))))))
             ("2" (HIDE 2)
              (("2" (REPLACE -1)
                (("2" (HIDE -1)
                  (("2" (REWRITE "sin_plus")
                    (("2" (LEMMA "sin_k_PI")
                      (("2" (INST -1 "2*i!1")
                        (("2" (REPLACE -1)
                          (("2" (HIDE -1)
                            (("2" (LEMMA "cos_k_PI")
                              (("2" (INST -1 "2*i!1")
                                (("2" (REPLACE -1)
                                  (("2" (HIDE -1)
                                    (("2" (ASSERT)
                                      (("2"
                                        (LEMMA "even_m1_pow")
                                        (("2"
                                          (INST?)
                                          (("2"
                                            (ASSERT)
                                            NIL)))))))))))))))))))))))))))))))))))
         ("2" (HIDE 2)
          (("2" (NAME "J" "floor(a!1/(4*PI))")
            (("2" (INST + "-J" "(a!1-2*J*PI)")
              (("1" (ASSERT) NIL) ("2" (POSTPONE) NIL)))))))))))))))
 (|arccos_TCC1| "" (INST + "inverse(rcos)")
  (("" (SKOSIMP*)
    (("" (LEMMA "bijective_inverse[rngPI,rng1]")
      (("" (INST?)
        (("1" (ASSERT) NIL NIL)
         ("2" (ASSERT)
          (("2" (HIDE 2)
            (("2" (LEMMA "rcos_bij") (("2" (PROPAX) NIL NIL)) NIL)) NIL))
          NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|arccos_def_TCC1| "" (INST + "PI") (("" (ASSERT) NIL NIL)) NIL)
 (|arccos_def| "" (APPLY-EXTENSIONALITY 1 :HIDE? T)
  (("1" (TYPEPRED "arccos(x!1)")
    (("1" (LEMMA "bijective_inverse[rngPI,rng1]")
      (("1" (INST?)
        (("1" (ASSERT) NIL NIL)
         ("2" (LEMMA "rcos_bij") (("2" (PROPAX) NIL NIL)) NIL))
        NIL))
      NIL))
    NIL)
   ("2" (SKOSIMP*)
    (("2" (LEMMA "bijective_inverse[rngPI,rng1]")
      (("2" (INST?)
        (("1" (ASSERT) NIL NIL)
         ("2" (LEMMA "rcos_bij") (("2" (PROPAX) NIL NIL)) NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|cos_arccos| "" (SKOSIMP*)
  (("" (TYPEPRED "arccos(y!1)")
    (("" (EXPAND "rcos") (("" (ASSERT) NIL NIL)) NIL)) NIL))
  NIL)
 (|arccos_cos| "" (SKOSIMP*)
  (("" (TYPEPRED "arccos(cos(x!1))")
    (("" (LEMMA "rcos_bij")
      (("" (EXPAND "bijective?")
        (("" (FLATTEN)
          (("" (EXPAND "injective?")
            (("" (INST -1 "x!1" "arccos(cos(x!1))")
              (("" (EXPAND "rcos") (("" (ASSERT) NIL NIL)) NIL)) NIL))
            NIL))
          NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|rtan_prep| "" (SKOSIMP*)
  (("" (EXPAND "Tan?")
    (("" (TYPEPRED "x!1")
      (("" (LEMMA "cos_eq_0_2PI")
        (("" (INST?)
          (("" (ASSERT)
            (("" (LEMMA "cos_period")
              (("" (INST?)
                (("" (INST -1 "1")
                  (("" (REPLACE -1)
                    (("" (HIDE -1)
                      (("" (LEMMA "cos_eq_0_2PI")
                        (("" (INST?) (("" (ASSERT) NIL NIL)) NIL)) NIL))
                      NIL))
                    NIL))
                  NIL))
                NIL))
              NIL))
            NIL))
          NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|rtan_TCC1| "" (SKOSIMP*) (("" (REWRITE "rtan_prep") NIL NIL)) NIL)
 (|arctan_TCC1| "" (INST + "inverse(rtan)")
  (("" (SKOSIMP*)
    (("" (LEMMA "bijective_inverse[rngPI2_lt,real]")
      (("" (INST?)
        (("1" (ASSERT) NIL NIL)
         ("2" (HIDE 2) (("2" (LEMMA "rtan_bij") (("2" (PROPAX) NIL NIL)) NIL))
          NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|arctan_def_TCC1| "" (INST 1 "0")
  (("" (ASSERT)
    (("" (CASE-REPLACE "0 < PI ")
      (("1" (ASSERT) NIL NIL) ("2" (ASSERT) NIL NIL)) NIL))
    NIL))
  NIL)
 (|arctan_def| "" (APPLY-EXTENSIONALITY 1 :HIDE? T)
  (("1" (TYPEPRED "arctan(x!1)")
    (("1" (LEMMA "bijective_inverse[rngPI2_lt,real]")
      (("1" (INST?)
        (("1" (ASSERT) NIL NIL)
         ("2" (LEMMA "rtan_bij") (("2" (PROPAX) NIL NIL)) NIL))
        NIL))
      NIL))
    NIL)
   ("2" (SKOSIMP*)
    (("2" (LEMMA "bijective_inverse[rngPI2_lt,real]")
      (("2" (INST?)
        (("1" (ASSERT) NIL NIL)
         ("2" (LEMMA "rtan_bij") (("2" (PROPAX) NIL NIL)) NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|tan_arctan_TCC1| "" (SKOSIMP*)
  (("" (TYPEPRED "arctan(y!1)")
    (("" (LEMMA "rtan_prep") (("" (INST?) NIL NIL)) NIL)) NIL))
  NIL)
 (|tan_arctan| "" (SKOSIMP*)
  (("" (TYPEPRED "arctan(y!1)")
    (("" (EXPAND "rtan") (("" (ASSERT) NIL NIL)) NIL)) NIL))
  NIL)
 (|arctan_tan| "" (SKOSIMP*)
  (("" (TYPEPRED "arctan(tan(x!1))")
    (("1" (LEMMA "rtan_bij")
      (("1" (EXPAND "bijective?")
        (("1" (FLATTEN)
          (("1" (EXPAND "injective?")
            (("1" (INST -1 "x!1" "arctan(tan(x!1))")
              (("1" (EXPAND "rtan") (("1" (ASSERT) NIL NIL)) NIL)
               ("2" (LEMMA "rtan_prep") (("2" (INST?) NIL NIL)) NIL))
              NIL))
            NIL))
          NIL))
        NIL))
      NIL)
     ("2" (LEMMA "rtan_prep") (("2" (INST?) NIL NIL)) NIL))
    NIL))
  NIL))


$$$sigma.pvs
sigma[T: TYPE FROM int]: THEORY
%------------------------------------------------------------------------------
% The summations theory introduces and defines properties of the sigma 
% function that sums an arbitrary function F: [T -> real] over a range
% from low to high
%
%  		          high
%		          ----
%  sigma(low, high, F) =  \     F(j)
%		          /
%		          ----
%		         j = low
%
%------------------------------------------------------------------------------

BEGIN

  ASSUMING

    connected_domain: ASSUMPTION (FORALL (x, y: T), (z: integer):
                                       x <= z AND z <= y IMPLIES T_pred(z))

  ENDASSUMING
	
  low,high, 
  l,h,n,m,i : VAR T
  rng, nn   : VAR nat
  pn        : VAR posnat
  z         : VAR int
  a,x,B     : VAR real


  F, G: VAR function[T -> real]
  
  sigma(low, high, F): RECURSIVE real
      = IF low > high THEN 0
        ELSIF high = low THEN F(low) 
        ELSE  F(high) + sigma(low, high-1, F)
        ENDIF
   MEASURE (LAMBDA low, high, F: abs(high-low))

  sigma_sum     : THEOREM sigma(low, high, F) + sigma(low, high, G)
                             = sigma(low, high, (LAMBDA i: F(i) + G(i)))

  sigma_split   : THEOREM low <= m AND m < high IMPLIES 
                            sigma(low, high, F) = 
                                     sigma(low, m, F) + sigma(m+1, high, F)

  sigma_diff    : THEOREM low <= m AND m < high IMPLIES
                    sigma(low, high, F) - sigma(low, m, F) = sigma(m+1, high, F)

  sigma_diff_neg: THEOREM low <= m AND m < high IMPLIES
                  sigma(low, m, F) - sigma(low, high, F) = - sigma(m+1, high, F)
 		 
  sigma_spl     : THEOREM T_pred(low + nn + pn) IMPLIES 
                           sigma(low, low+nn+pn, F) = 
                              sigma(low,low+nn,F) + sigma(low+nn+1,low+nn+pn,F)

  sigma_first   : THEOREM high > low IMPLIES 
                           sigma(low, high, F) = F(low) + sigma(low+1, high, F)

  sigma_last    : THEOREM high > low IMPLIES 
                          sigma(low, high, F) = sigma(low, high-1, F) + F(high)


  sigma_eq_arg  : THEOREM sigma(low, low, F) = F(low)

  sigma_const   : THEOREM sigma(low, high, (LAMBDA i: x)) = 
                           IF high >= low THEN (high-low+1) * x ELSE 0 ENDIF
 		 
  sigma_scal    : THEOREM sigma(low, high, (LAMBDA i: a * F(i)))
                             = a * sigma(low, high, F)
		 
  sigma_bound   : THEOREM low <= high AND
                         (FORALL i: i >= low AND i <= high IMPLIES F(i) <= B)
                            IMPLIES sigma(low, high, F) <= B*abs(high-low+1)

  sigma_abs      : THEOREM abs(sigma(low, high, F)) <= 
                              sigma(low, high, LAMBDA (n: T): abs(F(n)))


  sigma_abs_bnd  : THEOREM (FORALL (i: subrange(low,high)): abs(F(i)) <= G(i))
                       IMPLIES sigma(low, high, LAMBDA (n: T): abs(F(n))) <=
                                        sigma(low, high, G)

  restrict(F, low, high): function[T -> real] = 
     (LAMBDA i: IF i < low OR i > high THEN 0 ELSE F(i) ENDIF )

  sigma_restrict   : THEOREM l <= low AND h >= high IMPLIES
                            sigma(low,high,F) = sigma(low,high,restrict(F,l,h))

  sigma_restrict_eq: THEOREM restrict(F,low,high) = restrict(G,low,high) 
                                IMPLIES sigma(low,high,F) = sigma(low,high,G) 


  sigma_eq         : THEOREM (FORALL (n: subrange(low,high)): F(n) = G(n))
                                IMPLIES sigma(low,high,F) = sigma(low,high,G) 


  sigma_shift_T    : THEOREM (FORALL (i:T): T_pred(i+z)) IMPLIES 
			         sigma(low+z,high+z,F) = 
                                    sigma(low,high, (LAMBDA (i:T): F(i+z)))

% ------------------- Alternate Summation  ---------------------

  sigma_nonneg     : THEOREM (FORALL i: F(i) >= 0) 
                                 IMPLIES sigma(low, high, F) >= 0
 
  sigma_nonpos     : THEOREM (FORALL i: F(i) <= 0) 
                                 IMPLIES sigma(low, high, F) <= 0

  Fnnr: VAR function[T -> nonneg_real]
  Fnpr: VAR function[T -> nonpos_real]
  Fnat: VAR function[T -> nat]
  Fnpi: VAR function[T -> nonpos_int]

  JUDGEMENT sigma(low,high,Fnnr) HAS_TYPE nonneg_real

  JUDGEMENT sigma(low,high,Fnpr) HAS_TYPE nonpos_real

  JUDGEMENT sigma(low,high,Fnat) HAS_TYPE nat

  JUDGEMENT sigma(low,high,Fnpi) HAS_TYPE nonpos_int

  sigma_nonneg_eq_0  : THEOREM sigma(low,high,Fnnr) = 0 
                              AND low <= i AND i <= high IMPLIES Fnnr(i) = 0

% ------------------- Iterative Summation (tail recursion) ------------

   sum_it_def(low, high, F,a): RECURSIVE real
      = IF low > high THEN a
	ELSIF low = high THEN a+F(low)
        ELSE  sum_it_def(low+1,high,F,a+F(low))
        ENDIF
   MEASURE (LAMBDA low, high, F, a: abs(high-low))

   sum_it(low,high,F) : real = sum_it_def(low,high,F,0)

   sum_it_prop : LEMMA
     low <= i AND i < high =>
     sum_it_def(i+1,high,F,sigma(low,i,F)) = sigma(low,high,F)

   sum_it_sigma: LEMMA sum_it(low,high,F) = sigma(low,high,F)

END sigma

$$$sigma.prf
(|sigma|
 (|sigma_TCC1| "" (SKOSIMP*)
  (("" (ASSERT)
    (("" (LEMMA "connected_domain")
      (("" (INST?)
        (("" (INST -1 "low!1" "high!1") (("" (ASSERT) NIL NIL)) NIL)) NIL))
      NIL))
    NIL))
  NIL)
 (|sigma_TCC2| "" (SKOSIMP*) (("" (GRIND) NIL NIL)) NIL)
 (|sigma_sum| "" (SKOSIMP*)
  ((""
    (CASE "(FORALL (rng: nat): T_pred(low!1+rng) IMPLIES sigma(low!1, low!1+rng, F!1) + sigma(low!1, low!1+rng, G!1) =   sigma(low!1, low!1+rng, LAMBDA i: F!1(i) + G!1(i)))")
    (("1" (INST -1 "high!1-low!1")
      (("1" (ASSERT) NIL NIL)
       ("2" (EXPAND "sigma") (("2" (LIFT-IF) (("2" (GROUND) NIL NIL)) NIL))
        NIL))
      NIL)
     ("2" (HIDE 2)
      (("2" (INDUCT "rng" 1)
        (("1" (FLATTEN) (("1" (EXPAND "sigma") (("1" (PROPAX) NIL NIL)) NIL))
          NIL)
         ("2" (SKOSIMP*)
          (("2" (ASSERT)
            (("2" (SPLIT -1)
              (("1" (EXPAND "sigma" 1) (("1" (PROPAX) NIL NIL)) NIL)
               ("2" (HIDE 2)
                (("2" (LEMMA "connected_domain")
                  (("2" (INST -1 "low!1" "j!1+low!1+1" "j!1+low!1")
                    (("2" (ASSERT) NIL NIL)) NIL))
                  NIL))
                NIL))
              NIL))
            NIL))
          NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|sigma_split_TCC1| "" (SKOSIMP*)
  (("" (LEMMA "connected_domain")
    (("" (INST -1 "low!1" "high!1" "m!1+1") (("" (ASSERT) NIL NIL)) NIL))
    NIL))
  NIL)
 (|sigma_split| ""
  (CASE "(FORALL (F: [T -> real]), low,m,rng:  m >= low AND m < low+rng  AND T_pred(low+rng) IMPLIES sigma(low, low+rng, F)  = sigma(low, m, F) + sigma(m+1, low+rng, F))")
  (("1" (SKOSIMP*)
    (("1" (INST -1 "F!1" "low!1" "m!1" "high!1-low!1")
      (("1" (ASSERT) NIL NIL) ("2" (ASSERT) NIL NIL)) NIL))
    NIL)
   ("2" (HIDE 2)
    (("2" (INDUCT "rng")
      (("1" (SKOSIMP*)
        (("1" (EXPAND "sigma" 1 3)
          (("1" (LIFT-IF) (("1" (GROUND) NIL NIL)) NIL)) NIL))
        NIL)
       ("2" (SKOSIMP*)
        (("2" (CASE-REPLACE "m!1 = 1 + j!1 + low!1")
          (("1" (HIDE -1)
            (("1" (EXPAND "sigma" + 3) (("1" (PROPAX) NIL NIL)) NIL)) NIL)
           ("2" (INST -1 "F!1" "low!1" "m!1")
            (("2" (EXPAND "sigma" + 1)
              (("2" (EXPAND "sigma" + 2)
                (("2" (LIFT-IF)
                  (("2" (GROUND)
                    (("2" (HIDE 2)
                      (("2" (LEMMA "connected_domain")
                        (("2" (INST -1 "low!1" "1+j!1+low!1" "j!1+low!1")
                          (("2" (ASSERT) NIL NIL)) NIL))
                        NIL))
                      NIL))
                    NIL))
                  NIL))
                NIL))
              NIL))
            NIL))
          NIL))
        NIL)
       ("3" (HIDE 2)
        (("3" (SKOSIMP*)
          (("3" (LEMMA "connected_domain")
            (("3" (INST -1 "m!1" "low!1 + rng!2" "1+m!1")
              (("3" (ASSERT) NIL NIL)) NIL))
            NIL))
          NIL))
        NIL))
      NIL))
    NIL)
   ("3" (HIDE 2)
    (("3" (SKOSIMP*)
      (("3" (LEMMA "connected_domain")
        (("3" (INST -1 "low!1" "low!1 + rng!1" "1+m!1")
          (("3" (ASSERT) NIL NIL)) NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|sigma_diff| "" (SKOSIMP*)
  (("" (LEMMA "sigma_split")
    (("" (INST?) (("" (INST -1 "m!1") (("" (ASSERT) NIL NIL)) NIL)) NIL))
    NIL))
  NIL)
 (|sigma_diff_neg| "" (SKOSIMP*)
  (("" (LEMMA "sigma_diff")
    (("" (INST -1 "F!1" "high!1" "low!1" "m!1") (("" (ASSERT) NIL NIL)) NIL))
    NIL))
  NIL)
 (|sigma_spl_TCC1| "" (SKOSIMP*)
  (("" (LEMMA "connected_domain")
    (("" (INST -1 "low!1" "low!1+nn!1+pn!1" "nn!1+low!1")
      (("" (ASSERT) NIL NIL)) NIL))
    NIL))
  NIL)
 (|sigma_spl_TCC2| "" (SKOSIMP*)
  (("" (LEMMA "connected_domain")
    (("" (INST -1 "low!1" "low!1+nn!1+pn!1" "nn!1+low!1+1")
      (("" (ASSERT) NIL NIL)) NIL))
    NIL))
  NIL)
 (|sigma_spl| "" (INDUCT "pn" 1)
  (("1" (ASSERT) NIL NIL) ("2" (ASSERT) NIL NIL)
   ("3" (SKOSIMP*)
    (("3" (EXPAND "sigma" 1 1)
      (("3" (EXPAND "sigma" 1 3)
        (("3" (GROUND)
          (("1" (INST?)
            (("1" (SPLIT -1)
              (("1" (REPLACE -1)
                (("1" (HIDE -1)
                  (("1" (LIFT-IF)
                    (("1" (GROUND)
                      (("1" (REPLACE -1)
                        (("1" (HIDE -1)
                          (("1" (ASSERT)
                            (("1" (EXPAND "sigma" 1 2)
                              (("1" (EXPAND "sigma" 1 2)
                                (("1" (LIFT-IF)
                                  (("1" (GROUND)
                                    (("1" (REPLACE -1)
                                      (("1"
                                        (ASSERT)
                                        (("1"
                                          (EXPAND "sigma" 1)
                                          (("1" (PROPAX) NIL NIL))
                                          NIL))
                                        NIL))
                                      NIL))
                                    NIL))
                                  NIL))
                                NIL))
                              NIL))
                            NIL))
                          NIL))
                        NIL)
                       ("2" (ASSERT)
                        (("2" (EXPAND "sigma" 2 3)
                          (("2" (LIFT-IF)
                            (("2" (GROUND)
                              (("1" (EXPAND "sigma" 1 2)
                                (("1" (REPLACE -1)
                                  (("1" (ASSERT)
                                    (("1" (EXPAND "sigma")
                                      (("1" (PROPAX) NIL NIL)) NIL))
                                    NIL))
                                  NIL))
                                NIL)
                               ("2" (EXPAND "sigma" 2 1)
                                (("2" (PROPAX) NIL NIL)) NIL))
                              NIL))
                            NIL))
                          NIL))
                        NIL))
                      NIL))
                    NIL))
                  NIL))
                NIL)
               ("2" (HIDE 2)
                (("2" (LEMMA "connected_domain")
                  (("2"
                    (INST -1 "low!1" "1 + j!1 + low!1 + nn!1"
                     "j!1 + low!1 + nn!1")
                    (("2" (ASSERT) NIL NIL)) NIL))
                  NIL))
                NIL))
              NIL))
            NIL)
           ("2" (ASSERT)
            (("2" (CASE-REPLACE "j!1 = 0")
              (("1" (ASSERT)
                (("1" (HIDE -1)
                  (("1" (LIFT-IF)
                    (("1" (GROUND)
                      (("1" (REPLACE -1)
                        (("1" (HIDE -1)
                          (("1" (ASSERT)
                            (("1" (EXPAND "sigma") (("1" (PROPAX) NIL NIL))
                              NIL))
                            NIL))
                          NIL))
                        NIL)
                       ("2" (EXPAND "sigma" 2 1)
                        (("2" (EXPAND "sigma") (("2" (PROPAX) NIL NIL)) NIL))
                        NIL))
                      NIL))
                    NIL))
                  NIL))
                NIL)
               ("2" (ASSERT) NIL NIL))
              NIL))
            NIL))
          NIL))
        NIL))
      NIL))
    NIL)
   ("4" (HIDE 2)
    (("4" (SKOSIMP*)
      (("4" (LEMMA "connected_domain")
        (("4" (INST -1 "low!1" "low!1 + nn!1 +pn!2" "1 + low!1 + nn!1")
          (("4" (ASSERT) NIL NIL)) NIL))
        NIL))
      NIL))
    NIL)
   ("5" (HIDE 2)
    (("5" (SKOSIMP*)
      (("5" (LEMMA "connected_domain")
        (("5" (INST -1 "low!1" "low!1 + nn!1 +pn!2" "low!1 + nn!1")
          (("5" (ASSERT) NIL NIL)) NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|sigma_first_TCC1| "" (SKOSIMP*)
  (("" (ASSERT)
    (("" (LEMMA "connected_domain")
      (("" (INST -1 "low!1" "high!1" "low!1+1") (("" (ASSERT) NIL NIL)) NIL))
      NIL))
    NIL))
  NIL)
 (|sigma_first| "" (SKOSIMP*)
  (("" (CASE-REPLACE "low!1=high!1")
    (("1" (EXPAND "sigma") (("1" (PROPAX) NIL NIL)) NIL)
     ("2" (LEMMA "sigma_split")
      (("2" (INST?)
        (("2" (INST -1 "low!1")
          (("2" (ASSERT)
            (("2" (EXPAND "sigma" -1 3) (("2" (PROPAX) NIL NIL)) NIL)) NIL))
          NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|sigma_last_TCC1| "" (SKOSIMP*)
  (("" (LEMMA "connected_domain")
    (("" (INST -1 "low!1" "high!1" "high!1-1") (("" (ASSERT) NIL NIL)) NIL))
    NIL))
  NIL)
 (|sigma_last| "" (SKOSIMP*)
  (("" (CASE-REPLACE "low!1=high!1")
    (("1" (EXPAND "sigma") (("1" (PROPAX) NIL NIL)) NIL)
     ("2" (LEMMA "sigma_split")
      (("2" (INST -1 "F!1" "high!1" "low!1" "high!1-1")
        (("1" (ASSERT)
          (("1" (EXPAND "sigma" -1 2) (("1" (PROPAX) NIL NIL)) NIL)) NIL)
         ("2" (ASSERT)
          (("2" (LEMMA "connected_domain")
            (("2" (INST -1 "low!1" "high!1" "high!1-1")
              (("2" (ASSERT) NIL NIL)) NIL))
            NIL))
          NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|sigma_eq_arg| "" (SKOSIMP*)
  (("" (EXPAND "sigma") (("" (PROPAX) NIL NIL)) NIL)) NIL)
 (|sigma_const| "" (SKOSIMP*)
  ((""
    (CASE "(FORALL (rng: nat):  T_pred(low!1+rng) IMPLIES sigma(low!1, low!1+rng, (LAMBDA i: x!1))                  = IF low!1+rng >= low!1 THEN (low!1+rng - low!1 + 1) * x!1 ELSE 0 ENDIF)")
    (("1" (INST -1 "high!1-low!1")
      (("1" (ASSERT) NIL NIL)
       ("2" (EXPAND "sigma") (("2" (ASSERT) NIL NIL)) NIL))
      NIL)
     ("2" (HIDE 2)
      (("2" (INDUCT "rng")
        (("1" (REWRITE "sigma_eq_arg")
          (("1" (LIFT-IF) (("1" (GROUND) NIL NIL)) NIL)) NIL)
         ("2" (SKOSIMP*)
          (("2" (EXPAND "sigma" 1)
            (("2" (ASSERT)
              (("2" (HIDE 2)
                (("2" (LEMMA "connected_domain")
                  (("2" (INST -1 "low!1" "j!1+low!1+1" "j!1+low!1")
                    (("2" (ASSERT) NIL NIL)) NIL))
                  NIL))
                NIL))
              NIL))
            NIL))
          NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|sigma_scal| "" (SKOSIMP*)
  ((""
    (CASE "(FORALL (rng:nat):  T_pred(low!1+rng) IMPLIES sigma(low!1, low!1+rng, (LAMBDA i: a!1 * F!1(i))) = a!1 * sigma(low!1, low!1+rng, F!1))")
    (("1" (INST -1 "high!1-low!1")
      (("1" (ASSERT) NIL NIL)
       ("2" (EXPAND "sigma") (("2" (ASSERT) NIL NIL)) NIL))
      NIL)
     ("2" (HIDE 2)
      (("2" (INDUCT "rng")
        (("1" (ASSERT) (("1" (EXPAND "sigma") (("1" (PROPAX) NIL NIL)) NIL))
          NIL)
         ("2" (SKOSIMP*)
          (("2" (EXPAND "sigma" 1)
            (("2" (ASSERT)
              (("2" (HIDE 2)
                (("2" (LEMMA "connected_domain")
                  (("2" (INST -1 "low!1" "j!1+low!1+1" "j!1+low!1")
                    (("2" (ASSERT) NIL NIL)) NIL))
                  NIL))
                NIL))
              NIL))
            NIL))
          NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|sigma_bound| "" (SKOSIMP*)
  ((""
    (CASE "(FORALL (rng: nat): T_pred(low!1+rng) AND (FORALL i: i >= low!1 AND i <= low!1+rng                 IMPLIES F!1(i) <= B!1) IMPLIES     sigma(low!1, low!1+rng, F!1) <= B!1 * abs(low!1+rng - low!1 + 1))")
    (("1" (INST -1 "high!1-low!1")
      (("1" (ASSERT) NIL NIL) ("2" (ASSERT) NIL NIL)) NIL)
     ("2" (HIDE -2 2)
      (("2" (INDUCT "rng")
        (("1" (SKOSIMP*)
          (("1" (REWRITE "sigma_eq_arg")
            (("1" (INST?)
              (("1" (ASSERT)
                (("1" (EXPAND "abs") (("1" (PROPAX) NIL NIL)) NIL)) NIL))
              NIL))
            NIL))
          NIL)
         ("2" (SKOSIMP*)
          (("2" (EXPAND "sigma" 1)
            (("2" (ASSERT)
              (("2" (SPLIT -1)
                (("1" (EXPAND "abs")
                  (("1" (INST - "1+j!1+low!1") (("1" (ASSERT) NIL NIL)) NIL))
                  NIL)
                 ("2" (HIDE -2 2)
                  (("2" (LEMMA "connected_domain")
                    (("2" (INST -1 "low!1" "1+j!1+low!1" "j!1+low!1")
                      (("2" (ASSERT) NIL NIL)) NIL))
                    NIL))
                  NIL)
                 ("3" (HIDE -2 2)
                  (("3" (SKOSIMP*)
                    (("3" (REVEAL -1)
                      (("3" (INST?) (("3" (ASSERT) NIL NIL)) NIL)) NIL))
                    NIL))
                  NIL))
                NIL))
              NIL))
            NIL))
          NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|sigma_abs| "" (SKOSIMP*)
  ((""
    (CASE "(FORALL (rng: nat): T_pred(low!1+rng) IMPLIES abs(sigma(low!1, low!1+rng, F!1)) <= sigma(low!1, low!1+rng, LAMBDA (n: T): abs(F!1(n))))")
    (("1" (INST -1 "high!1-low!1")
      (("1" (ASSERT) NIL NIL)
       ("2" (ASSERT)
        (("2" (EXPAND "sigma")
          (("2" (EXPAND "abs") (("2" (ASSERT) NIL NIL)) NIL)) NIL))
        NIL))
      NIL)
     ("2" (HIDE 2)
      (("2" (INDUCT "rng")
        (("1" (ASSERT) (("1" (EXPAND "sigma") (("1" (ASSERT) NIL NIL)) NIL))
          NIL)
         ("2" (SKOSIMP*)
          (("2" (EXPAND "sigma" 1)
            (("2" (SPLIT -1)
              (("1" (LEMMA "triangle")
                (("1" (INST?)
                  (("1" (ASSERT) NIL NIL)
                   ("2" (HIDE -1 2)
                    (("2" (LEMMA "connected_domain")
                      (("2" (INST -1 "low!1" "1+j!1+low!1" "j!1+low!1")
                        (("1" (ASSERT) NIL NIL) ("2" (ASSERT) NIL NIL)) NIL))
                      NIL))
                    NIL)
                   ("3" (ASSERT) NIL NIL))
                  NIL))
                NIL)
               ("2" (HIDE 2)
                (("2" (LEMMA "connected_domain")
                  (("2" (INST -1 "low!1" "1+j!1+low!1" "j!1+low!1")
                    (("1" (ASSERT) NIL NIL) ("2" (ASSERT) NIL NIL)) NIL))
                  NIL))
                NIL))
              NIL))
            NIL))
          NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|sigma_abs_bnd_TCC1| "" (SKOSIMP*)
  (("" (TYPEPRED "i!1")
    (("" (LEMMA "connected_domain")
      (("" (INST -1 "low!1" "high!1" "i!1") (("" (ASSERT) NIL NIL)) NIL))
      NIL))
    NIL))
  NIL)
 (|sigma_abs_bnd| "" (SKOSIMP*)
  ((""
    (CASE "(FORALL (rng: nat): T_pred(low!1+rng) AND (FORALL (i: subrange(low!1, low!1+rng)): abs(F!1(i)) <= G!1(i)) IMPLIES     sigma(low!1, low!1+rng, LAMBDA (n: T): abs(F!1(n))) <=   sigma(low!1, low!1+rng, G!1))")
    (("1" (INST -1 "high!1-low!1")
      (("1" (ASSERT) NIL NIL)
       ("2" (ASSERT) (("2" (EXPAND "sigma") (("2" (ASSERT) NIL NIL)) NIL))
        NIL))
      NIL)
     ("2" (HIDE 2)
      (("2" (INDUCT "rng" 1)
        (("1" (ASSERT)
          (("1" (FLATTEN)
            (("1" (EXPAND "sigma") (("1" (INST -1 "low!1") NIL NIL)) NIL))
            NIL))
          NIL)
         ("2" (SKOSIMP*)
          (("2" (SPLIT -1)
            (("1" (EXPAND "sigma" 1)
              (("1" (INST - "1+j!1+low!1") (("1" (ASSERT) NIL NIL)) NIL)) NIL)
             ("2" (HIDE -2 -3 2)
              (("2" (LEMMA "connected_domain")
                (("2" (INST -1 "low!1" "1+j!1+low!1" "j!1+low!1")
                  (("1" (ASSERT) NIL NIL) ("2" (ASSERT) NIL NIL)) NIL))
                NIL))
              NIL)
             ("3" (SKOSIMP*) (("3" (INST -2 "i!1") NIL NIL)) NIL))
            NIL))
          NIL)
         ("3" (SKOSIMP*)
          (("3" (TYPEPRED "i!1")
            (("3" (LEMMA "connected_domain")
              (("3" (INST -1 "low!1" "low!1+rng!2" "i!1")
                (("1" (ASSERT) NIL NIL) ("2" (ASSERT) NIL NIL)) NIL))
              NIL))
            NIL))
          NIL)
         ("4" (ASSERT)
          (("4" (SKOSIMP*)
            (("4" (TYPEPRED "i!1")
              (("4" (LEMMA "connected_domain")
                (("4" (INST -1 "low!1" "low!1+rng!2" "i!1")
                  (("1" (ASSERT) NIL NIL) ("2" (ASSERT) NIL NIL)) NIL))
                NIL))
              NIL))
            NIL))
          NIL)
         ("5" (ASSERT)
          (("5" (SKOSIMP*)
            (("5" (TYPEPRED "i!1")
              (("5" (LEMMA "connected_domain")
                (("5" (INST -1 "low!1" "low!1+rng!2" "i!1")
                  (("1" (ASSERT) NIL NIL) ("2" (ASSERT) NIL NIL)) NIL))
                NIL))
              NIL))
            NIL))
          NIL))
        NIL))
      NIL)
     ("3" (SKOSIMP*)
      (("3" (TYPEPRED "i!1")
        (("3" (LEMMA "connected_domain")
          (("3" (INST -1 "low!1" "low!1+rng!1" "i!1")
            (("1" (ASSERT) NIL NIL)
             ("2" (LEMMA "connected_domain") (("2" (ASSERT) NIL NIL)) NIL))
            NIL))
          NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|sigma_restrict| "" (SKOSIMP*)
  ((""
    (CASE "(FORALL (rng:nat): low!1+rng <= high!1 IMPLIES sigma(low!1, low!1+rng, F!1) = sigma(low!1, low!1+rng, restrict(F!1, l!1, h!1)))")
    (("1" (INST -1 "high!1-low!1")
      (("1" (ASSERT) NIL NIL)
       ("2" (EXPAND "sigma") (("2" (LIFT-IF) (("2" (GROUND) NIL NIL)) NIL))
        NIL))
      NIL)
     ("2" (INDUCT "rng")
      (("1" (HIDE 2)
        (("1" (REWRITE "sigma_eq_arg")
          (("1" (REWRITE "sigma_eq_arg")
            (("1" (EXPAND "restrict")
              (("1" (LIFT-IF) (("1" (GROUND) NIL NIL)) NIL)) NIL))
            NIL))
          NIL))
        NIL)
       ("2" (HIDE 2)
        (("2" (SKOSIMP*)
          (("2" (EXPAND "sigma" 1)
            (("2" (ASSERT)
              (("2" (REPLACE -1)
                (("2" (HIDE -1)
                  (("2" (EXPAND "restrict") (("2" (PROPAX) NIL NIL)) NIL))
                  NIL))
                NIL))
              NIL))
            NIL))
          NIL))
        NIL)
       ("3" (HIDE 2 3)
        (("3" (SKOSIMP*)
          (("3" (LEMMA "connected_domain")
            (("3" (INST -1 "low!1" "high!1" "rng!2+low!1")
              (("3" (ASSERT) NIL NIL)) NIL))
            NIL))
          NIL))
        NIL))
      NIL)
     ("3" (SKOSIMP*)
      (("3" (HIDE 2)
        (("3" (LEMMA "connected_domain")
          (("3" (INST -1 "low!1" "high!1" "rng!1+low!1")
            (("3" (ASSERT) NIL NIL)) NIL))
          NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|sigma_restrict_eq| "" (SKOSIMP*)
  (("" (LEMMA "sigma_restrict")
    (("" (INST?)
      (("" (INST -1 "high!1" "low!1")
        (("" (ASSERT)
          (("" (REPLACE -1)
            (("" (HIDE -1)
              (("" (LEMMA "sigma_restrict")
                (("" (INST -1 "G!1" "high!1" "high!1" "low!1" "low!1")
                  (("" (ASSERT) NIL NIL)) NIL))
                NIL))
              NIL))
            NIL))
          NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|sigma_eq| "" (SKOSIMP*)
  (("" (LEMMA "sigma_restrict_eq")
    (("" (INST?)
      (("" (ASSERT)
        (("" (HIDE 2)
          (("" (EXPAND "restrict")
            (("" (APPLY-EXTENSIONALITY 1 :HIDE? T)
              (("" (LIFT-IF) (("" (GROUND) (("" (INST?) NIL NIL)) NIL)) NIL))
              NIL))
            NIL))
          NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|sigma_shift_T_TCC1| "" (SUBTYPE-TCC) NIL NIL)
 (|sigma_shift_T_TCC2| "" (SUBTYPE-TCC) NIL NIL)
 (|sigma_shift_T_TCC3| "" (SUBTYPE-TCC) NIL NIL)
 (|sigma_shift_T| "" (SKOLEM 1 ("F" "high" "low" "z"))
  (("" (GROUND)
    (("" (CASE "low <= high")
      (("1"
        (CASE "(FORALL (lh: T| low <= lh AND lh <= high): sigma(low + z, lh + z, F) = sigma(low, lh, LAMBDA (n:T): F(n + z)))")
        (("1" (INST -1 "high") NIL NIL)
         ("2" (HIDE 2)
          (("2" (LEMMA "subrange_induction[low,high]")
            (("1"
              (INST -1
               "LAMBDA (lh: T | low <= lh AND lh <= high):         sigma(low + z, lh + z, F) =          sigma(low, lh, LAMBDA (n: T): F(n + z))")
              (("1" (GROUND)
                (("1" (SKOLEM 1 "r") (("1" (INST -1 "r") NIL NIL)) NIL)
                 ("2" (HIDE 2)
                  (("2" (EXPAND "sigma") (("2" (PROPAX) NIL NIL)) NIL)) NIL)
                 ("3" (HIDE 2)
                  (("3" (SKOLEM 1 "k")
                    (("3" (GROUND)
                      (("3" (EXPAND "sigma" 1) (("3" (PROPAX) NIL NIL)) NIL))
                      NIL))
                    NIL))
                  NIL))
                NIL)
               ("2" (HIDE 2)
                (("2" (GROUND)
                  (("2" (SKOLEM 1 "xx")
                    (("2" (GROUND)
                      (("2" (LEMMA "connected_domain")
                        (("2" (INST -1 "low" "high" "xx")
                          (("2" (GROUND) NIL NIL)) NIL))
                        NIL))
                      NIL))
                    NIL))
                  NIL))
                NIL)
               ("3" (HIDE 2)
                (("3" (SKOLEM 1 ("r" "n")) (("3" (INST -2 "n") NIL NIL)) NIL))
                NIL)
               ("4" (HIDE 2)
                (("4" (SKOLEM 1 "r") (("4" (INST -2 "r") NIL NIL)) NIL)) NIL)
               ("5" (HIDE 2)
                (("5" (SKOLEM 1 "r") (("5" (INST -2 "low") NIL NIL)) NIL))
                NIL))
              NIL)
             ("2" (GROUND) NIL NIL))
            NIL))
          NIL)
         ("3" (HIDE 2)
          (("3" (SKOLEM 1 ("r" "n")) (("3" (INST -2 "n") NIL NIL)) NIL)) NIL)
         ("4" (HIDE 2)
          (("4" (SKOLEM 1 "r") (("4" (INST -2 "r") NIL NIL)) NIL)) NIL)
         ("5" (HIDE 2)
          (("5" (SKOLEM 1 "r") (("5" (INST -2 "low") NIL NIL)) NIL)) NIL))
        NIL)
       ("2" (CASE "low + z > high + z")
        (("1" (EXPAND "sigma") (("1" (GROUND) NIL NIL)) NIL)
         ("2" (HIDE -1 3) (("2" (GROUND) NIL NIL)) NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|sigma_nonneg| "" (SKOSIMP*)
  ((""
    (CASE "(FORALL (rng:nat): T_pred(low!1+rng) IMPLIES sigma(low!1,low!1+rng, F!1) >= 0)")
    (("1" (INST -1 "high!1-low!1")
      (("1" (ASSERT) NIL NIL)
       ("2" (EXPAND "sigma") (("2" (LIFT-IF) (("2" (GROUND) NIL NIL)) NIL))
        NIL))
      NIL)
     ("2" (INDUCT "rng")
      (("1" (ASSERT)
        (("1" (REWRITE "sigma_eq_arg") (("1" (INST?) NIL NIL)) NIL)) NIL)
       ("2" (SKOSIMP*)
        (("2" (ASSERT)
          (("2" (SPLIT -1)
            (("1" (EXPAND "sigma" 1)
              (("1" (ASSERT)
                (("1" (INST -3 "1 + j!1 + low!1") (("1" (ASSERT) NIL NIL))
                  NIL))
                NIL))
              NIL)
             ("2" (HIDE 2 3)
              (("2" (LEMMA "connected_domain")
                (("2" (INST -1 "low!1" "1 + j!1 + low!1" "j!1 + low!1")
                  (("2" (ASSERT) NIL NIL)) NIL))
                NIL))
              NIL))
            NIL))
          NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|sigma_nonpos| "" (SKOSIMP*)
  ((""
    (CASE "(FORALL (rng:nat): T_pred(low!1+rng) IMPLIES sigma(low!1,low!1+rng, F!1) <= 0)")
    (("1" (INST -1 "high!1-low!1")
      (("1" (ASSERT) NIL NIL)
       ("2" (EXPAND "sigma") (("2" (LIFT-IF) (("2" (GROUND) NIL NIL)) NIL))
        NIL))
      NIL)
     ("2" (INDUCT "rng")
      (("1" (ASSERT)
        (("1" (REWRITE "sigma_eq_arg") (("1" (INST?) NIL NIL)) NIL)) NIL)
       ("2" (SKOSIMP*)
        (("2" (ASSERT)
          (("2" (SPLIT -1)
            (("1" (EXPAND "sigma" 1)
              (("1" (ASSERT)
                (("1" (INST -3 "1 + j!1 + low!1") (("1" (ASSERT) NIL NIL))
                  NIL))
                NIL))
              NIL)
             ("2" (HIDE 2 3)
              (("2" (LEMMA "connected_domain")
                (("2" (INST -1 "low!1" "1 + j!1 + low!1" "j!1 + low!1")
                  (("2" (ASSERT) NIL NIL)) NIL))
                NIL))
              NIL))
            NIL))
          NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|sigma_TCC3| "" (SKOSIMP*)
  (("" (REWRITE "sigma_nonneg") (("" (SKOSIMP*) (("" (ASSERT) NIL NIL)) NIL))
    NIL))
  NIL)
 (|sigma_TCC4| "" (SKOSIMP*)
  (("" (REWRITE "sigma_nonpos")
    (("" (HIDE 2) (("" (SKOSIMP*) (("" (ASSERT) NIL NIL)) NIL)) NIL)) NIL))
  NIL)
 (|sigma_TCC5| "" (AUTO-REWRITE-THEORY "integers")
  (("" (AUTO-REWRITE-THEORY "rationals")
    (("" (SKOSIMP*)
      ((""
        (CASE "(FORALL (rng: nat): T_pred(low!1+rng) IMPLIES (rational_pred(sigma(low!1, low!1+rng, Fnat!1))             AND integer_pred(sigma(low!1, low!1+rng, Fnat!1)))       AND sigma(low!1, low!1+rng, Fnat!1) >= 0)")
        (("1" (INST -1 "high!1-low!1")
          (("1" (ASSERT) NIL NIL)
           ("2" (EXPAND "sigma")
            (("2" (LIFT-IF) (("2" (GROUND) NIL NIL)) NIL)) NIL))
          NIL)
         ("2" (HIDE 2)
          (("2" (INDUCT "rng" 1)
            (("1" (EXPAND "sigma") (("1" (ASSERT) NIL NIL)) NIL)
             ("2" (SKOSIMP*)
              (("2" (EXPAND "sigma" 1)
                (("2" (SPLIT -1)
                  (("1" (FLATTEN)
                    (("1" (GROUND)
                      (("1" (ASSERT) NIL NIL) ("2" (ASSERT) NIL NIL)) NIL))
                    NIL)
                   ("2" (HIDE 2)
                    (("2" (LEMMA "connected_domain")
                      (("2"
                        (INST -1 "low!1" "low!1 + (j!1 + 1)" "low!1 + j!1")
                        (("1" (ASSERT) NIL NIL) ("2" (ASSERT) NIL NIL)) NIL))
                      NIL))
                    NIL))
                  NIL))
                NIL))
              NIL))
            NIL))
          NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|sigma_TCC6| "" (AUTO-REWRITE-THEORY "integers")
  (("" (AUTO-REWRITE-THEORY "rationals")
    (("" (SKOSIMP*)
      ((""
        (CASE "(FORALL (rng: nat): T_pred(low!1+rng) IMPLIES (rational_pred(sigma(low!1, low!1+rng, Fnpi!1))             AND integer_pred(sigma(low!1, low!1+rng, Fnpi!1)))       AND sigma(low!1, low!1+rng, Fnpi!1) <= 0)")
        (("1" (INST -1 "high!1-low!1")
          (("1" (ASSERT) NIL NIL)
           ("2" (EXPAND "sigma")
            (("2" (LIFT-IF) (("2" (GROUND) NIL NIL)) NIL)) NIL))
          NIL)
         ("2" (HIDE 2)
          (("2" (INDUCT "rng" 1)
            (("1" (EXPAND "sigma") (("1" (ASSERT) NIL NIL)) NIL)
             ("2" (SKOSIMP*)
              (("2" (EXPAND "sigma" 1)
                (("2" (SPLIT -1)
                  (("1" (FLATTEN)
                    (("1" (GROUND)
                      (("1" (ASSERT) NIL NIL) ("2" (ASSERT) NIL NIL)) NIL))
                    NIL)
                   ("2" (HIDE 2)
                    (("2" (LEMMA "connected_domain")
                      (("2"
                        (INST -1 "low!1" "low!1 + (j!1 + 1)" "low!1 + j!1")
                        (("1" (ASSERT) NIL NIL) ("2" (ASSERT) NIL NIL)) NIL))
                      NIL))
                    NIL))
                  NIL))
                NIL))
              NIL))
            NIL))
          NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|sigma_nonneg_eq_0| "" (SKOSIMP*)
  ((""
    (CASE "FORALL (rng:nat):  T_pred(low!1+rng) AND sigma(low!1, low!1+rng, Fnnr!1) = 0 AND low!1 <= i!1 AND i!1 <= low!1 + rng IMPLIES Fnnr!1(i!1) = 0")
    (("1" (INST -1 "high!1-low!1")
      (("1" (ASSERT) NIL NIL) ("2" (ASSERT) NIL NIL)) NIL)
     ("2" (INDUCT "rng")
      (("1" (SKOSIMP*) (("1" (EXPAND "sigma") (("1" (GROUND) NIL NIL)) NIL))
        NIL)
       ("2" (SKOSIMP*)
        (("2" (SPLIT -1)
          (("1" (PROPAX) NIL NIL)
           ("2" (HIDE -2 -3 -4 -5 -6 -7 -8 2 3)
            (("2" (LEMMA "connected_domain")
              (("2" (INST -1 "low!1" "low!1+j!1+1" "low!1+j!1")
                (("1" (ASSERT) NIL NIL) ("2" (ASSERT) NIL NIL)) NIL))
              NIL))
            NIL)
           ("3" (EXPAND "sigma" -2) (("3" (ASSERT) NIL NIL)) NIL)
           ("4" (PROPAX) NIL NIL)
           ("5" (EXPAND "sigma" -2) (("5" (ASSERT) NIL NIL)) NIL))
          NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|sum_it_def_TCC1| "" (SKOLEM 1 ("h" "l"))
  (("" (GROUND)
    (("" (LEMMA "connected_domain")
      (("" (INST -1 "l" "h" "1+l") (("" (GROUND) NIL NIL)) NIL)) NIL))
    NIL))
  NIL)
 (|sum_it_def_TCC2| "" (TERMINATION-TCC) NIL NIL)
 (|sum_it_prop| "" (SKOLEM 1 ("F" "high" "i" "low"))
  (("" (GROUND)
    (("" (LEMMA "subrange_induction[low,high-1]")
      ((""
        (INST -1
         "lambda(lh:T| low <= lh AND lh < high): sum_it_def((high-lh)+low, high, F, sigma(low,(high-lh)+low-1, F)) = sigma(low, high, F)")
        (("1" (GROUND)
          (("1" (INST -1 "high-i+low-1") (("1" (GROUND) NIL NIL)) NIL)
           ("2" (HIDE 2)
            (("2" (EXPAND "sum_it_def")
              (("2" (NAME-REPLACE "SS" "sigma(low,high-1,F)")
                (("1" (EXPAND "sigma")
                  (("1" (REVEAL -1) (("1" (GROUND) NIL NIL)) NIL)) NIL)
                 ("2" (HIDE 2)
                  (("2" (REVEAL -1)
                    (("2" (LEMMA "connected_domain")
                      (("2" (INST -1 "low" "high" "high-1")
                        (("2" (GROUND) NIL NIL)) NIL))
                      NIL))
                    NIL))
                  NIL))
                NIL))
              NIL))
            NIL)
           ("3" (HIDE 2)
            (("3" (SKOLEM 1 "k")
              (("3" (GROUND)
                (("3" (EXPAND "sum_it_def" 1)
                  (("3"
                    (CASE-REPLACE "   F(-1 - k + high + low) +
                  sigma(low, -2 - k + high + low, F) = sigma(low, -1 - k + high + low, F)")
                    (("1" (HIDE 2)
                      (("1"
                        (NAME-REPLACE "SS"
                         "sigma(low, -2 - k + high + low, F)")
                        (("1" (EXPAND "sigma" 1)
                          (("1" (REVEAL -1) (("1" (GROUND) NIL NIL)) NIL))
                          NIL)
                         ("2" (HIDE -1 2)
                          (("2" (LEMMA "connected_domain")
                            (("2" (INST -1 "low" "high" "-2 - k + high + low")
                              (("2" (GROUND) NIL NIL)) NIL))
                            NIL))
                          NIL))
                        NIL))
                      NIL)
                     ("2" (HIDE -2 2)
                      (("2" (LEMMA "connected_domain")
                        (("2" (INST -1 "low" "high" "-2 - k + high + low")
                          (("2" (GROUND) NIL NIL)) NIL))
                        NIL))
                      NIL)
                     ("3" (HIDE -2 2)
                      (("3" (LEMMA "connected_domain")
                        (("3" (GROUND)
                          (("3" (INST -1 "low" "high" "-1 - k + high + low")
                            (("3" (GROUND) NIL NIL)) NIL))
                          NIL))
                        NIL))
                      NIL))
                    NIL))
                  NIL))
                NIL))
              NIL))
            NIL))
          NIL)
         ("2" (HIDE 2)
          (("2" (SKOLEM 1 "lh")
            (("2" (GROUND)
              (("2" (LEMMA "connected_domain")
                (("2" (INST -1 "low" "high" "lh") (("2" (GROUND) NIL NIL))
                  NIL))
                NIL))
              NIL))
            NIL))
          NIL)
         ("3" (HIDE 2)
          (("3" (SKOLEM 1 "lh")
            (("3" (LEMMA "connected_domain")
              (("3" (INST -1 "low" "high" "-1 - lh + high + low")
                (("3" (GROUND) NIL NIL)) NIL))
              NIL))
            NIL))
          NIL)
         ("4" (HIDE 2)
          (("4" (LEMMA "connected_domain")
            (("4" (SKOLEM 1 "lh")
              (("4" (INST -1 "low" "high" "high-lh+low")
                (("4" (GROUND) NIL NIL)) NIL))
              NIL))
            NIL))
          NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|sum_it_sigma| "" (SKOLEM 1 ("F" "high" "low"))
  (("" (CASE "low > high")
    (("1" (EXPAND "sum_it")
      (("1" (EXPAND "sum_it_def")
        (("1" (EXPAND "sigma") (("1" (GROUND) NIL NIL)) NIL)) NIL))
      NIL)
     ("2" (CASE "low = high")
      (("1" (HIDE 1)
        (("1" (REPLACE -1 :HIDE? T)
          (("1" (EXPAND "sum_it")
            (("1" (EXPAND "sum_it_def")
              (("1" (EXPAND "sigma") (("1" (PROPAX) NIL NIL)) NIL)) NIL))
            NIL))
          NIL))
        NIL)
       ("2" (CASE "low < high")
        (("1" (HIDE 1 2)
          (("1" (EXPAND "sum_it")
            (("1" (EXPAND "sum_it_def")
              (("1" (GROUND)
                (("1" (LEMMA "sum_it_prop")
                  (("1" (INST -1 "F" "high" "low" "low")
                    (("1" (GROUND)
                      (("1" (HIDE -2)
                        (("1" (CASE-REPLACE "sigma(low,low,F) = F(low)")
                          (("1" (HIDE -1 2)
                            (("1" (EXPAND "sigma") (("1" (PROPAX) NIL NIL))
                              NIL))
                            NIL))
                          NIL))
                        NIL))
                      NIL))
                    NIL))
                  NIL))
                NIL))
              NIL))
            NIL))
          NIL)
         ("2" (GROUND) NIL NIL))
        NIL))
      NIL))
    NIL))
  NIL))


$$$sigma_posnat.pvs
sigma_posnat: THEORY
%------------------------------------------------------------------------------
% The summations theory introduces and defines properties of the sigma 
% function that sums an arbitrary function F: [T -> real] over a range
% from low to high
%
%  		          high
%		          ----
%  sigma(low, high, F) =  \     F(j)
%		          /
%		          ----
%		         j = low
%
%------------------------------------------------------------------------------


BEGIN

  IMPORTING sigma[posnat]

  low, high, n, m: VAR posnat
  F: VAR function[posnat -> real]


% --------- Following Theorems Not Provable In Generic Framework -------

  sigma_shift:  THEOREM sigma(low+m,high+m,F) = 
                              sigma(low,high, (LAMBDA (n: posnat): F(n+m)))

  sigma_shift_neg:  THEOREM low - m > 0 and low <= high IMPLIES 
                         sigma(low-m,high-m,F) = 
                             sigma(low,high, (LAMBDA n: IF n-m <= 0 THEN 0 
                                                        ELSE F(n-m) 
                                                        ENDIF))

END sigma_posnat

$$$sigma_posnat.prf
(|sigma_posnat| (|IMP_sigma_TCC1| "" (ASSUMING-TCC) NIL NIL)
 (|IMP_sigma_TCC2| "" (SUBTYPE-TCC) NIL NIL)
 (|sigma_shift| "" (SKOSIMP*) (("" (REWRITE "sigma_shift_T") NIL NIL)) NIL)
 (|sigma_shift_neg_TCC1| "" (SKOSIMP*) (("" (ASSERT) NIL NIL)) NIL)
 (|sigma_shift_neg_TCC2| "" (SUBTYPE-TCC) NIL NIL)
 (|sigma_shift_neg_TCC3| "" (SUBTYPE-TCC) NIL NIL)
 (|sigma_shift_neg| "" (SKOSIMP*)
  ((""
    (CASE "(FORALL (rng: nat): sigma(low!1 -  m!1, low!1+rng - m!1, F!1) =  sigma(low!1, low!1+rng, LAMBDA n: IF n - m!1 <= 0 THEN 0 ELSE F!1(n - m!1) ENDIF))")
    (("1" (INST -1 "high!1-low!1")
      (("1" (ASSERT) NIL NIL)
       ("2" (EXPAND "sigma") (("2" (LIFT-IF) (("2" (GROUND) NIL NIL)) NIL))
        NIL))
      NIL)
     ("2" (HIDE 2)
      (("2" (INDUCT "rng")
        (("1" (ASSERT) (("1" (EXPAND "sigma") (("1" (PROPAX) NIL NIL)) NIL))
          NIL)
         ("2" (SKOSIMP*)
          (("2" (EXPAND "sigma" 1) (("2" (ASSERT) NIL NIL)) NIL)) NIL)
         ("3" (HIDE 2) (("3" (SKOSIMP*) (("3" (ASSERT) NIL NIL)) NIL)) NIL)
         ("4" (HIDE 2) (("4" (SKOSIMP*) (("4" (ASSERT) NIL NIL)) NIL)) NIL)
         ("5" (ASSERT) NIL NIL))
        NIL))
      NIL)
     ("3" (HIDE 2) (("3" (SKOSIMP*) (("3" (ASSERT) NIL NIL)) NIL)) NIL)
     ("4" (HIDE 2) (("4" (SKOSIMP*) (("4" (ASSERT) NIL NIL)) NIL)) NIL)
     ("5" (ASSERT) NIL NIL))
    NIL))
  NIL))


$$$trig_approx.pvs
trig_approx : THEORY
%-----------------------------------------------------------------------------
%      trig_approx
%      -----------
%          - taylor series approximations to trig functions:
%               sin_approx(a,n): sum first n terms of taylor expansion of sin
%               cos_approx(a,n): sum first n terms of taylor expansion of cos
%               tan_approx(a,n): sum first n terms of taylor expansion of tan
%          - defines upper and lower bounds on trig functions:
%                sin_lb(a) = sin_approx(a,4)
%                sin_ub(a) = sin_approx(a,5)
%                cos_lb(a) = cos_approx(a,3)
%                cos_ub(a) = cos_approx(a,4)
%                tan_ub(a) = sin_ub(a)/cos_lb(a)
%                tan_lb(a) = sin_lb(a)/cos_ub(a)
%-----------------------------------------------------------------------------
BEGIN

%  sigmal: LIBRARY = "../reals"

  IMPORTING trig_basic, 
            sigma_posnat, 
            factorial

  i   : VAR posnat
  n   : VAR posnat
  a   : VAR real

  sin_term(a)(i) : real = (-1)^(i-1) * a^(2*i-1)/factorial(2*i-1)

  cos_term(a)(i) : real = (-1)^i * a^(2*i)/factorial(2*i)

  sin_approx(a,n) : real = sigma(1, n, sin_term(a))

  cos_approx(a,n) : real = 1+sigma(1, n, cos_term(a))

  sin_bound : AXIOM 0 <= a AND a <= PI IMPLIES
                       sin_approx(a,2*n) <= sin(a) AND
                       sin(a) <= sin_approx(a,2*n+1)  

  cos_bound : AXIOM -PI/2 <= a AND a <= PI/2 IMPLIES
                       cos_approx(a,2*n+1) <= cos(a) AND
                       cos(a) <= cos_approx(a,2*(n+1))  
  
  sin_lb(a) : real = sin_approx(a,4)
  sin_ub(a) : real = sin_approx(a,5)
  cos_lb(a) : real = cos_approx(a,3)
  cos_ub(a) : real = cos_approx(a,4)
  tan_ub(a:real|cos_lb(a) /= 0) : real = sin_ub(a)/cos_lb(a)
  tan_lb(a:real|cos_ub(a) /= 0) : real = sin_lb(a)/cos_ub(a)


% --------------------- Taylor expansion of sin >= 0 ---------------------

  sin_term_nonzero    : LEMMA 0 /= a IMPLIES sin_term(a)(n) /= 0

  sin_term_next       : LEMMA sin_term(a)(n+1) =
                             sin_term(a)(n) * -1 * a*a / ((2*n+1) * 2*n)

  sin_terms_alternate : LEMMA 0 < a IMPLIES (sin_term(a)(n+1) < 0 IFF
                                               sin_term(a)(n) > 0)

  sin_terms_decr      : LEMMA 0 < a AND a <= PI/2 IMPLIES
                           abs(sin_term(a)(n)) > 2 * abs(sin_term(a)(n+1))

  sin_approx_gt_term  : LEMMA 0 < a AND a <= PI/2 IMPLIES
                               sin_approx(a,n) > 2 * abs(sin_term(a)(n+1))

  sin_approx_n_gt_0   : LEMMA 0 < a AND a <= PI/2 IMPLIES sin_approx(a,n) > 0

  sin_lb_gt_0         : LEMMA 0 < a AND a <= PI/2 IMPLIES sin_lb(a) > 0


  SIN : LEMMA 0 <= a AND a <= PI IMPLIES
                 sin_lb(a) <= sin(a) AND
                 sin_ub(a) >= sin(a)

  COS : LEMMA -PI/2 <= a AND a <= PI/2 IMPLIES
                 cos_lb(a) <= cos(a) AND
                 cos_ub(a) >= cos(a) 

  TAN : LEMMA
          0 <= a AND a < PI/2 AND cos_lb(a) > 0 IMPLIES
          tan_ub(a) >= tan(a) AND
          tan_lb(a) <= tan(a)

END trig_approx

$$$trig_approx.prf
(|trig_approx| (|sin_term_TCC1| "" (SUBTYPE-TCC) NIL NIL)
 (|sin_term_TCC2| "" (SUBTYPE-TCC) NIL NIL)
 (|cos_term_TCC1| "" (SUBTYPE-TCC) NIL NIL)
 (|tan_ub_TCC1| "" (SUBTYPE-TCC) NIL NIL)
 (|tan_lb_TCC1| "" (SUBTYPE-TCC) NIL NIL)
 (|sin_term_nonzero| "" (SKOSIMP*)
  (("" (EXPAND "sin_term")
    (("" (REWRITE "div_eq_zero")
      (("" (REWRITE "zero_times3")
        (("" (GENERALIZE "n!1" "n")
          (("" (INDUCT "n")
            (("1" (TYPEPRED "n!2") (("1" (PROPAX) NIL NIL)) NIL)
             ("2" (TYPEPRED "n!2") (("2" (PROPAX) NIL NIL)) NIL)
             ("3" (GROUND) NIL NIL)
             ("4" (SKOSIMP*)
              (("4" (CASE "j!1 = 0")
                (("1" (REPLACE -1)
                  (("1" (HIDE -1 -2 -3) (("1" (GRIND) NIL NIL)) NIL)) NIL)
                 ("2" (ASSERT)
                  (("2" (EXPAND "^")
                    (("2" (EXPAND "expt" -2)
                      (("2" (GROUND)
                        (("2" (EXPAND "expt" -1)
                          (("2" (REWRITE "zero_times3")
                            (("2" (REWRITE "zero_times3") NIL NIL)) NIL))
                          NIL))
                        NIL))
                      NIL))
                    NIL))
                  NIL))
                NIL))
              NIL)
             ("5" (SKOSIMP*) (("5" (GROUND) NIL NIL)) NIL)
             ("6" (SKOSIMP*) (("6" (GROUND) NIL NIL)) NIL))
            NIL))
          NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|sin_term_next| "" (SKOSIMP*)
  (("" (EXPAND "sin_term")
    (("" (EXPAND "^")
      (("" (EXPAND "expt" + (1 2))
        (("" (EXPAND "expt" + 2)
          (("" (EXPAND "factorial" + 1)
            (("" (EXPAND "factorial" + (1 2))
              ((""
                (CASE "exists (x:int),(b:real),(k:posnat): x = expt((-1), n!1 - 1) & b = expt(a!1, 2 * n!1 - 1) & k = factorial(2 * n!1 - 1)")
                (("1" (SKOSIMP*)
                  (("1" (REPLACE -1 + RL)
                    (("1" (REPLACE -2 + RL)
                      (("1" (REPLACE -3 + RL)
                        (("1" (HIDE -1 -2 -3)
                          (("1"
                            (CASE "2 * (k!1 * n!1) + 4 * (k!1 * n!1 * n!1) = k!1 * (4 * (n!1 * n!1) + 2 * n!1)")
                            (("1" (REPLACE -1)
                              (("1"
                                (CASE "x!1 * b!1 / k!1 * a!1 * a!1 = x!1 * b!1 * a!1 * a!1 / k!1")
                                (("1" (REPLACE -1)
                                  (("1"
                                    (CASE "(x!1 * b!1 * a!1 * a!1) / (k!1 * (4 * (n!1 * n!1) + 2 * n!1)) = (x!1 * b!1 * a!1 * a!1 / k!1) / (4 * (n!1 * n!1) + 2 * n!1)")
                                    (("1" (GROUND) NIL NIL)
                                     ("2" (HIDE -1 -2 2)
                                      (("2"
                                        (REWRITE "div_div2")
                                        (("2" (GROUND) NIL NIL))
                                        NIL))
                                      NIL))
                                    NIL))
                                  NIL)
                                 ("2" (HIDE -1 2) (("2" (GROUND) NIL NIL))
                                  NIL))
                                NIL))
                              NIL)
                             ("2" (HIDE 2) (("2" (GROUND) NIL NIL)) NIL))
                            NIL))
                          NIL))
                        NIL))
                      NIL))
                    NIL))
                  NIL)
                 ("2" (HIDE 2)
                  (("2"
                    (INST 1 "expt((-1), n!1 - 1)" "expt(a!1, 2 * n!1 - 1)"
                     "factorial(2 * n!1 - 1)")
                    (("2" (GROUND) NIL NIL)) NIL))
                  NIL))
                NIL))
              NIL))
            NIL))
          NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|sin_terms_alternate| "" (SKOSIMP*)
  (("" (REWRITE "sin_term_next")
    (("" (LEMMA "neg_times_lt")
      ((""
        (INST -1 "-1"
         "(sin_term(a!1)(n!1) * a!1 * a!1) / (4 * (n!1 * n!1) + 2 * n!1)")
        (("" (REPLACE -1)
          (("" (HIDE -1)
            (("" (SIMPLIFY)
              (("" (REWRITE "pos_div_lt")
                (("" (REWRITE "pos_times_lt")
                  (("" (GROUND)
                    (("1" (REWRITE "pos_times_lt") NIL NIL)
                     ("2" (REWRITE "pos_times_lt") NIL NIL)
                     ("3" (REWRITE "pos_times_lt") NIL NIL))
                    NIL))
                  NIL))
                NIL))
              NIL))
            NIL))
          NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|sin_terms_decr| "" (INDUCT "n")
  (("1" (TYPEPRED "n!1") (("1" (PROPAX) NIL NIL)) NIL) ("2" (GROUND) NIL NIL)
   ("3" (SKOSIMP*)
    (("3" (HIDE -1)
      (("3" (LEMMA "sin_term_next")
        (("3" (INST -1 "a!1" "j!1+1")
          (("3" (REPLACE -1)
            (("3" (HIDE -1)
              (("3"
                (CASE "sin_term(a!1)(j!1 + 1) * -1 * a!1 * a!1 /
             ((2 * (j!1 + 1) + 1) * 2 * (j!1 + 1)) =
sin_term(a!1)(j!1 + 1) * -1 * ( a!1 * a!1 /
             ((2 * (j!1 + 1) + 1) * 2 * (j!1 + 1)))")
                (("1" (REPLACE -1)
                  (("1" (HIDE -1)
                    (("1" (REWRITE "abs_mult")
                      (("1" (REWRITE "abs_mult")
                        (("1"
                          (CASE "2 *
        (abs(sin_term(a!1)(1 + j!1)) * abs(-1) *
          abs((a!1 * a!1 / (6 + 6 * j!1 + (4 * (j!1 * j!1) + 4 * j!1))))) =

        abs(sin_term(a!1)(1 + j!1)) * abs(-1) * 2 *
          abs((a!1 * a!1 / (6 + 6 * j!1 + (4 * (j!1 * j!1) + 4 * j!1))))")
                          (("1" (REPLACE -1)
                            (("1" (HIDE -1)
                              (("1" (LEMMA "both_sides_times_pos_gt2")
                                (("1"
                                  (INST -1 "abs(sin_term(a!1)(j!1 + 1))" "1"
                                   "abs(-1) * 2 *
        abs((a!1 * a!1 / (6 + 6 * j!1 + (4 * (j!1 * j!1) + 4 * j!1))))")
                                  (("1" (REPLACE -1)
                                    (("1" (HIDE -1)
                                      (("1"
                                        (EXPAND "abs")
                                        (("1"
                                          (LIFT-IF)
                                          (("1"
                                            (GROUND)
                                            (("1"
                                              (HIDE 1)
                                              (("1"
                                                (REWRITE "neg_div_lt")
                                                NIL
                                                NIL))
                                              NIL)
                                             ("2"
                                              (HIDE 1)
                                              (("2"
                                                (TYPEPRED "PI")
                                                (("2"
                                                  (EXPAND "PI_ub")
                                                  (("2"
                                                    (CASE
                                                     "2 * a!1 * a!1 / 6 >=
2 * ((a!1 * a!1 / (6 + 4 * (j!1 * j!1) + 10 * j!1)) * --1)")
                                                    (("1"
                                                      (CASE
                                                       "315*315/(200*200) >= a!1 * a!1")
                                                      (("1" (GROUND) NIL NIL)
                                                       ("2"
                                                        (HIDE -1 2)
                                                        (("2"
                                                          (CASE
                                                           "315/200 >= a!1")
                                                          (("1"
                                                            (LEMMA
                                                             "div_mult_pos_ge1")
                                                            (("1"
                                                              (INST
                                                               -1
                                                               "200 * 200"
                                                               "a!1 * a!1"
                                                               "315 * 315")
                                                              (("1"
                                                                (REPLACE -1)
                                                                (("1"
                                                                  (HIDE -1)
                                                                  (("1"
                                                                    (REWRITE
                                                                     "div_mult_pos_ge1")
                                                                    (("1"
                                                                      (CASE
                                                                       "a!1 * a!1 * (200 * 200) = (200*a!1)*(200*a!1)")
                                                                      (("1"
                                                                        (REPLACE

                                                                         -1)
                                                                        (("1"
                                                                          (USE
                                                                           "ge_times_ge_pos")
                                                                          (("1"
                                                                            (GROUND)
                                                                            NIL
                                                                            NIL))
                                                                          NIL))
                                                                        NIL)
                                                                       ("2"
                                                                        (GROUND)
                                                                        NIL
                                                                        NIL))
                                                                      NIL))
                                                                    NIL))
                                                                  NIL))
                                                                NIL))
                                                              NIL))
                                                            NIL)
                                                           ("2"
                                                            (GROUND)
                                                            NIL
                                                            NIL))
                                                          NIL))
                                                        NIL))
                                                      NIL)
                                                     ("2"
                                                      (HIDE 2)
                                                      (("2"
                                                        (CASE
                                                         "2 * a!1 * a!1 / 6 = 2 * (a!1 * a!1 / 6)")
                                                        (("1"
                                                          (REPLACE -1)
                                                          (("1"
                                                            (REWRITE
                                                             "both_sides_times_pos_ge2")
                                                            (("1"
                                                              (CASE
                                                               "((a!1 * a!1 / (6 + 4 * (j!1 * j!1) + 10 * j!1)) * --1) =
a!1 * a!1 / (6 + 4 * (j!1 * j!1) + 10 * j!1)")
                                                              (("1"
                                                                (REPLACE -1)
                                                                (("1"
                                                                  (REWRITE
                                                                   "both_sides_div_pos_ge2")
                                                                  NIL
                                                                  NIL))
                                                                NIL)
                                                               ("2"
                                                                (GROUND)
                                                                NIL
                                                                NIL))
                                                              NIL))
                                                            NIL))
                                                          NIL)
                                                         ("2"
                                                          (GROUND)
                                                          NIL
                                                          NIL))
                                                        NIL))
                                                      NIL))
                                                    NIL))
                                                  NIL))
                                                NIL))
                                              NIL))
                                            NIL))
                                          NIL))
                                        NIL))
                                      NIL))
                                    NIL)
                                   ("2" (HIDE 2)
                                    (("2" (USE "sin_term_nonzero")
                                      (("2"
                                        (GROUND)
                                        (("2"
                                          (EXPAND "abs")
                                          (("2" (GROUND) NIL NIL))
                                          NIL))
                                        NIL))
                                      NIL))
                                    NIL))
                                  NIL))
                                NIL))
                              NIL))
                            NIL)
                           ("2" (GROUND) NIL NIL))
                          NIL))
                        NIL))
                      NIL))
                    NIL))
                  NIL)
                 ("2" (GROUND) NIL NIL))
                NIL))
              NIL))
            NIL))
          NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|sin_approx_gt_term| "" (INDUCT "n")
  (("1" (TYPEPRED "n!1") (("1" (PROPAX) NIL NIL)) NIL) ("2" (GROUND) NIL NIL)
   ("3" (SKOSIMP*)
    (("3" (EXPAND "sin_approx")
      (("3" (EXPAND "sigma" +)
        (("3" (LIFT-IF)
          (("3" (SPLIT 1)
            (("1" (HIDE -1 -2)
              (("1" (GROUND)
                (("1" (LEMMA "sin_terms_decr")
                  (("1" (INST -1 "a!1" "1")
                    (("1" (REPLACE -2)
                      (("1" (GROUND)
                        (("1" (EXPAND "abs" -1 1) (("1" (GRIND) NIL NIL))
                          NIL))
                        NIL))
                      NIL))
                    NIL))
                  NIL))
                NIL))
              NIL)
             ("2" (GROUND)
              (("2" (INST?)
                (("2" (GROUND)
                  (("2" (USE "sin_terms_decr")
                    (("2" (GROUND)
                      (("2" (EXPAND "abs" -1 1)
                        (("2" (EXPAND "abs" -2) (("2" (GROUND) NIL NIL)) NIL))
                        NIL))
                      NIL))
                    NIL))
                  NIL))
                NIL))
              NIL))
            NIL))
          NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|sin_approx_n_gt_0| "" (INDUCT "n")
  (("1" (TYPEPRED "n!1") (("1" (PROPAX) NIL NIL)) NIL) ("2" (GROUND) NIL NIL)
   ("3" (SKOSIMP*)
    (("3" (CASE "j!1 = 0")
      (("1" (REPLACE -1) (("1" (HIDE -1 -2) (("1" (GRIND) NIL NIL)) NIL)) NIL)
       ("2" (GROUND)
        (("2" (INST?)
          (("2" (LEMMA "sin_approx_gt_term")
            (("2" (INST -1 "a!1" "j!1")
              (("2" (GROUND)
                (("2" (EXPAND "sin_approx")
                  (("2" (EXPAND "sigma" +)
                    (("2" (EXPAND "abs") (("2" (GROUND) NIL NIL)) NIL)) NIL))
                  NIL))
                NIL))
              NIL))
            NIL))
          NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|sin_lb_gt_0| "" (SKOSIMP*)
  (("" (EXPAND "sin_lb")
    (("" (USE "sin_approx_n_gt_0") (("" (GROUND) NIL NIL)) NIL)) NIL))
  NIL)
 (SIN "" (SKOLEM 1 "a")
      (("" (LEMMA "sin_bound")
        (("" (INST -1 "a" "2")
          (("" (EXPAND "sin_lb")
            (("" (EXPAND "sin_ub") (("" (GROUND) NIL NIL)) NIL)) NIL))
          NIL))
        NIL))
      NIL)
 (COS "" (SKOLEM 1 "a")
      (("" (LEMMA "cos_bound")
        (("" (INST -1 "a" "1")
          (("" (EXPAND "cos_lb")
            (("" (EXPAND "cos_ub") (("" (GROUND) NIL NIL)) NIL)) NIL))
          NIL))
        NIL))
      NIL)
 (TAN_TCC1 "" (SUBTYPE-TCC) NIL NIL)
 (TAN_TCC2 "" (SKOLEM 1 "a")
  (("" (GROUND)
    (("" (EXPAND "Tan?")
      (("" (LEMMA "cos_eq_0_2PI") (("" (INST?) (("" (GROUND) NIL NIL)) NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (TAN_TCC3 "" (SKOLEM 1 "a")
  (("" (GROUND)
    (("" (LEMMA "COS") (("" (INST?) (("" (GROUND) NIL NIL)) NIL)) NIL)) NIL))
  NIL)
 (TAN "" (SKOLEM 1 "a")
      (("" (GROUND)
        (("1" (EXPAND "tan_ub")
          (("1" (EXPAND "tan")
            (("1" (CASE "sin_ub(a) / cos_lb(a) >= sin(a)/cos_lb(a)")
              (("1" (CASE "sin(a)/cos_lb(a) >= sin(a)/cos(a)")
                (("1" (GROUND) NIL NIL)
                 ("2" (HIDE -1 2)
                  (("2" (CASE-REPLACE "sin(a)=0")
                    (("1" (GROUND) NIL NIL)
                     ("2" (LEMMA "both_sides_div_pos_ge2")
                      (("2" (INST?)
                        (("1" (GROUND)
                          (("1" (LEMMA "COS")
                            (("1" (INST?) (("1" (GROUND) NIL NIL)) NIL)) NIL))
                          NIL)
                         ("2" (LEMMA "sin_lb_gt_0")
                          (("2" (INST?)
                            (("2" (ASSERT)
                              (("2" (CASE-REPLACE "a = 0")
                                (("1" (REWRITE "sin_0") NIL NIL)
                                 ("2" (ASSERT)
                                  (("2" (LEMMA "SIN")
                                    (("2" (INST?)
                                      (("2"
                                        (ASSERT)
                                        (("2"
                                          (FLATTEN)
                                          (("2" (ASSERT) NIL NIL))
                                          NIL))
                                        NIL))
                                      NIL))
                                    NIL))
                                  NIL))
                                NIL))
                              NIL))
                            NIL))
                          NIL)
                         ("3" (HIDE 2 3)
                          (("3" (LEMMA "cos_eq_0_2PI")
                            (("3" (INST?)
                              (("3" (GROUND)
                                (("1" (CASE-REPLACE "a = 0")
                                  (("1" (REWRITE "cos_0")
                                    (("1" (ASSERT) NIL NIL)) NIL)
                                   ("2" (ASSERT)
                                    (("2" (LEMMA "COS")
                                      (("2"
                                        (INST?)
                                        (("2" (ASSERT) NIL NIL))
                                        NIL))
                                      NIL))
                                    NIL))
                                  NIL)
                                 ("2" (LEMMA "COS")
                                  (("2" (INST?) (("2" (ASSERT) NIL NIL)) NIL))
                                  NIL))
                                NIL))
                              NIL))
                            NIL))
                          NIL))
                        NIL))
                      NIL))
                    NIL))
                  NIL)
                 ("3" (LEMMA "cos_eq_0_2PI")
                  (("3" (INST?) (("3" (GROUND) NIL NIL)) NIL)) NIL))
                NIL)
               ("2" (HIDE 2)
                (("2" (LEMMA "both_sides_div_pos_ge1")
                  (("2" (INST?)
                    (("2" (GROUND)
                      (("2" (LEMMA "SIN")
                        (("2" (INST?) (("2" (GROUND) NIL NIL)) NIL)) NIL))
                      NIL))
                    NIL))
                  NIL))
                NIL))
              NIL))
            NIL))
          NIL)
         ("2" (EXPAND "tan_lb")
          (("2" (EXPAND "tan")
            (("2"
              (CASE "sin_lb(a) / cos_ub(a) <= sin(a) / cos_ub(a)"
                "sin(a) / cos_ub(a) <= sin(a) / cos(a)")
              (("1" (GROUND) NIL NIL)
               ("2" (HIDE -1 2)
                (("2" (CASE-REPLACE "sin(a)=0")
                  (("1" (GROUND) NIL NIL)
                   ("2" (CASE-REPLACE "a = 0")
                    (("1" (REWRITE "sin_0") NIL NIL)
                     ("2" (CASE "sin(a) > 0")
                      (("1" (LEMMA "both_sides_div_pos_le2")
                        (("1" (INST?)
                          (("1" (GROUND)
                            (("1" (LEMMA "COS")
                              (("1" (INST?) (("1" (GROUND) NIL NIL)) NIL))
                              NIL))
                            NIL)
                           ("2" (ASSERT) NIL NIL)
                           ("3" (LEMMA "COS")
                            (("3" (INST?) (("3" (GROUND) NIL NIL)) NIL)) NIL)
                           ("4" (HIDE 2 3)
                            (("4" (LEMMA "COS")
                              (("4" (INST?)
                                (("4" (ASSERT)
                                  (("4" (FLATTEN) (("4" (ASSERT) NIL NIL))
                                    NIL))
                                  NIL))
                                NIL))
                              NIL))
                            NIL))
                          NIL))
                        NIL)
                       ("2" (LEMMA "sin_lb_gt_0")
                        (("2" (INST?)
                          (("2" (ASSERT)
                            (("2" (LEMMA "SIN")
                              (("2" (INST?) (("2" (ASSERT) NIL NIL)) NIL))
                              NIL))
                            NIL))
                          NIL))
                        NIL))
                      NIL))
                    NIL))
                  NIL))
                NIL)
               ("3" (HIDE 2)
                (("3" (LEMMA "both_sides_div_pos_le1")
                  (("3" (INST?)
                    (("1" (GROUND)
                      (("1" (LEMMA "SIN")
                        (("1" (INST?) (("1" (GROUND) NIL NIL)) NIL)) NIL))
                      NIL)
                     ("2" (LEMMA "COS")
                      (("2" (INST?) (("2" (GROUND) NIL NIL)) NIL)) NIL))
                    NIL))
                  NIL))
                NIL)
               ("4" (LEMMA "cos_eq_0_2PI")
                (("4" (INST?) (("4" (GROUND) NIL NIL)) NIL)) NIL)
               ("5" (LEMMA "COS") (("5" (INST?) (("5" (GROUND) NIL NIL)) NIL))
                NIL))
              NIL))
            NIL))
          NIL))
        NIL))
      NIL))


$$$trig_ineq.pvs
trig_ineq : THEORY
%-----------------------------------------------------------------------------
%      trig_ineq
%      ---------
%         - regions where functions are greater than 0
%         - regions where functions are less    than 0
%         - regions where functions are increasing
%         - regions where functions are decreasing
%-----------------------------------------------------------------------------
BEGIN


  IMPORTING trig_approx 

  a,b  : VAR real

% ------------------- Sign of sin, cos, and tan  -----------------------

  sin_gt_0    : LEMMA 0 < a      AND a < PI      IMPLIES sin(a) > 0
  cos_gt_0    : LEMMA -PI/2 < a  AND a < PI/2    IMPLIES cos(a) > 0
  sin_ge_0    : LEMMA 0 <= a     AND a <= PI     IMPLIES sin(a) >= 0
  cos_ge_0    : LEMMA -PI/2 <= a AND a <= PI/2   IMPLIES cos(a) >= 0
  sin_le_0    : LEMMA PI <= a    AND a <= 2*PI   IMPLIES sin(a) <= 0
  cos_le_0    : LEMMA PI/2 <= a  AND a <= 3*PI/2 IMPLIES cos(a) <= 0
  sin_lt_0    : LEMMA PI < a     AND a < 2*PI    IMPLIES sin(a) < 0
  cos_lt_0    : LEMMA PI/2 < a   AND a < 3*PI/2  IMPLIES cos(a) < 0
  tan_gt_0    : LEMMA 0 < a      AND a < PI/2    IMPLIES tan(a) > 0
  tan_lt_0    : LEMMA -PI/2 < a  AND a < 0       IMPLIES tan(a) < 0

  cos_ge_0_3PI2 : LEMMA 3*PI/2 <= a AND a <= 2*PI IMPLIES cos(a) >= 0 

% -------------------- Strict Inequalities --------------------

  sin_increasing_imp : LEMMA
                     a <= PI/2 AND a >= -PI/2 AND
                     b <= PI/2 AND b >= -PI/2 AND
                     a > b 
                     => 
                     sin(a) > sin(b)

  sin_increasing : LEMMA
                     a <= PI/2 AND a >= -PI/2 AND
                     b <= PI/2 AND b >= -PI/2 IMPLIES
                     (sin(a) > sin(b)
                     <=> 
                     a > b)

  sin_decreasing : LEMMA
                     a <= 3*PI/2 AND a >= PI/2 AND
                     b <= 3*PI/2 AND b >= PI/2 IMPLIES
                     (sin(b) > sin(a)
                     <=> 
                     a > b)


  cos_increasing : LEMMA
                     a >= PI AND a <= 2*PI AND
                     b >= PI AND b <= 2*PI IMPLIES
                     (cos(a) > cos(b)
                     <=> 
                     a > b)

  cos_decreasing : LEMMA
                     a <= PI AND a >= 0 AND
                     b <= PI AND b >= 0 IMPLIES
                     (cos(b) > cos(a)
                     <=> 
                     a > b)

  tan_PI4_def    : LEMMA  -PI/4 <= a AND a <= PI/4 IMPLIES Tan?(a) 

  tan_increasing_imp: LEMMA
                      -PI/4 <= a AND a <= PI/4 AND
                      -PI/4 <= b AND b <= PI/4 AND
                       a > b IMPLIES
                       tan(a) > tan(b)

  tan_increasing : LEMMA
                     -PI/4 <= a AND a <= PI/4 AND
                     -PI/4 <= b AND b <= PI/4 IMPLIES
                         (tan(a) > tan(b) <=> a > b)
                      

% -------------------- Non-Strict Inequalities --------------------

  sin_incr  : LEMMA  a <= PI/2 AND a >= -PI/2 AND
                     b <= PI/2 AND b >= -PI/2 IMPLIES
                     (sin(a) >= sin(b) <=> a >= b)

  sin_decr  : LEMMA  a <= 3*PI/2 AND a >= PI/2 AND
                     b <= 3*PI/2 AND b >= PI/2 IMPLIES
                     (sin(b) >= sin(a) <=> a >= b)

  cos_incr  : LEMMA  a >= PI AND a <= 2*PI AND
                     b >= PI AND b <= 2*PI IMPLIES
                     (cos(a) >= cos(b) <=> a >= b)

  cos_decr  : LEMMA  a <= PI AND a >= 0 AND
                     b <= PI AND b >= 0 IMPLIES
                     (cos(b) >= cos(a) <=> a >= b)

  tan_incr  : LEMMA  -PI/4 <= a AND a <= PI/4 AND
                     -PI/4 <= b AND b <= PI/4 IMPLIES
                     (tan(a) >= tan(b) <=> a >= b)


END trig_ineq

$$$trig_ineq.prf
(|trig_ineq|
 (|sin_gt_0| "" (SKOSIMP)
  (("" (CASE "a!1<=PI/2")
    (("1" (CASE "EXISTS (d: real): sin(a!1) >= d AND d > 0")
      (("1" (SKOSIMP*) (("1" (ASSERT) NIL NIL)) NIL)
       ("2" (HIDE 2)
        (("2" (INST 1 "sin_lb(a!1)")
          (("2" (SPLIT)
            (("1" (LEMMA "SIN")
              (("1" (INST -1 "a!1") (("1" (ASSERT) NIL NIL)) NIL)) NIL)
             ("2" (REWRITE "sin_lb_gt_0") NIL NIL))
            NIL))
          NIL))
        NIL))
      NIL)
     ("2" (LEMMA "sin_minus")
      (("2" (INST -1 "PI" "a!1")
        (("2" (REWRITE "sin_PI")
          (("2" (REWRITE "cos_PI")
            (("2" (ASSERT)
              (("2" (REPLACE -1 * RL)
                (("2" (HIDE -1)
                  (("2"
                    (CASE-REPLACE
                     "EXISTS (d: real): sin(PI - a!1) >= d AND d > 0")
                    (("1" (SKOSIMP*) (("1" (ASSERT) NIL NIL)) NIL)
                     ("2" (HIDE 3)
                      (("2" (INST + "sin_lb(PI-a!1)")
                        (("2" (LEMMA "SIN")
                          (("2" (INST -1 "a!1")
                            (("2" (ASSERT)
                              (("2" (FLATTEN)
                                (("2" (SPLIT)
                                  (("1" (ASSERT)
                                    (("1" (HIDE -2 -1)
                                      (("1"
                                        (LEMMA "SIN")
                                        (("1"
                                          (INST -1 "PI-a!1")
                                          (("1" (ASSERT) NIL NIL))
                                          NIL))
                                        NIL))
                                      NIL))
                                    NIL)
                                   ("2" (HIDE -2 -1)
                                    (("2" (REWRITE "sin_lb_gt_0") NIL NIL))
                                    NIL))
                                  NIL))
                                NIL))
                              NIL))
                            NIL))
                          NIL))
                        NIL))
                      NIL))
                    NIL))
                  NIL))
                NIL))
              NIL))
            NIL))
          NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|cos_gt_0| "" (SKOSIMP)
  (("" (LEMMA "sin_shift")
    (("" (INST -1 "a!1")
      (("" (REPLACE -1 * RL)
        (("" (HIDE -1) (("" (REWRITE "sin_gt_0") NIL NIL)) NIL)) NIL))
      NIL))
    NIL))
  NIL)
 (|sin_ge_0| "" (SKOSIMP)
  (("" (CASE "a!1=0")
    (("1" (REPLACE -1 * LR)
      (("1" (REWRITE "sin_0") (("1" (ASSERT) NIL NIL)) NIL)) NIL)
     ("2" (CASE "a!1=PI")
      (("1" (REPLACE -1 * LR)
        (("1" (REWRITE "sin_PI") (("1" (ASSERT) NIL NIL)) NIL)) NIL)
       ("2" (LEMMA "sin_gt_0")
        (("2" (INST -1 "a!1") (("2" (ASSERT) NIL NIL)) NIL)) NIL))
      NIL))
    NIL))
  NIL)
 (|cos_ge_0| "" (SKOSIMP)
  (("" (CASE "a!1=-PI/2")
    (("1" (REPLACE -1 * LR)
      (("1" (LEMMA "cos_neg")
        (("1" (INST -1 "PI/2")
          (("1" (ASSERT)
            (("1" (REPLACE -1 * LR)
              (("1" (REWRITE "cos_PI2") (("1" (ASSERT) NIL NIL)) NIL)) NIL))
            NIL))
          NIL))
        NIL))
      NIL)
     ("2" (CASE "a!1=PI/2")
      (("1" (REPLACE -1 * LR)
        (("1" (REWRITE "cos_PI2") (("1" (ASSERT) NIL NIL)) NIL)) NIL)
       ("2" (LEMMA "cos_gt_0")
        (("2" (INST -1 "a!1") (("2" (ASSERT) NIL NIL)) NIL)) NIL))
      NIL))
    NIL))
  NIL)
 (|sin_le_0| "" (SKOSIMP)
  (("" (LEMMA "sin_ge_0")
    (("" (INST -1 "a!1-PI")
      (("" (REWRITE "sin_minus")
        (("" (REWRITE "sin_PI")
          (("" (REWRITE "cos_PI") (("" (ASSERT) NIL NIL)) NIL)) NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|cos_le_0| "" (SKOSIMP)
  (("" (LEMMA "cos_ge_0")
    (("" (INST -1 "a!1-PI")
      (("" (REWRITE "cos_minus")
        (("" (REWRITE "cos_PI")
          (("" (REWRITE "sin_PI") (("" (ASSERT) NIL NIL)) NIL)) NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|sin_lt_0| "" (SKOSIMP*)
  (("" (LEMMA "sin_le_0")
    (("" (INST?)
      (("" (ASSERT)
        (("" (CASE-REPLACE "sin(a!1) = 0")
          (("1" (HIDE -2 1)
            (("1" (REWRITE "sin_eq_0")
              (("1" (SKOSIMP*)
                (("1" (REPLACE -)
                  (("1" (HIDE -1)
                    (("1" (LEMMA "both_sides_times_pos_lt1")
                      (("1" (INST?)
                        (("1" (ASSERT)
                          (("1" (HIDE -3)
                            (("1" (LEMMA "both_sides_times_pos_lt1")
                              (("1" (INST -1 "PI" "1" "i!1")
                                (("1" (ASSERT) NIL NIL)) NIL))
                              NIL))
                            NIL))
                          NIL))
                        NIL))
                      NIL))
                    NIL))
                  NIL))
                NIL))
              NIL))
            NIL)
           ("2" (ASSERT) NIL NIL))
          NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|cos_lt_0| "" (SKOSIMP*)
  (("" (LEMMA "cos_le_0")
    (("" (INST?)
      (("" (ASSERT)
        (("" (CASE-REPLACE "cos(a!1) = 0")
          (("1" (HIDE -2 1)
            (("1" (LEMMA "cos_eq_0")
              (("1" (INST?)
                (("1" (ASSERT)
                  (("1" (HIDE -2)
                    (("1" (SKOSIMP*)
                      (("1" (REPLACE -1)
                        (("1" (HIDE -1)
                          (("1" (CASE-REPLACE "0 < i!1 * PI")
                            (("1" (HIDE -2)
                              (("1" (CASE "i!1 * PI < PI  ")
                                (("1" (HIDE -3)
                                  (("1" (LEMMA "both_sides_times_pos_lt1")
                                    (("1" (INST -1 "PI" "i!1" "1")
                                      (("1"
                                        (ASSERT)
                                        (("1"
                                          (HIDE -2)
                                          (("1"
                                            (LEMMA "both_sides_times_pos_lt1")
                                            (("1"
                                              (INST -1 "PI" "0" "i!1")
                                              (("1" (ASSERT) NIL NIL))
                                              NIL))
                                            NIL))
                                          NIL))
                                        NIL))
                                      NIL))
                                    NIL))
                                  NIL)
                                 ("2" (ASSERT) NIL NIL))
                                NIL))
                              NIL)
                             ("2" (ASSERT) NIL NIL))
                            NIL))
                          NIL))
                        NIL))
                      NIL))
                    NIL))
                  NIL))
                NIL))
              NIL))
            NIL)
           ("2" (ASSERT) NIL NIL))
          NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|tan_gt_0_TCC1| "" (SKOSIMP)
  (("" (EXPAND "Tan?")
    (("" (LEMMA "cos_gt_0") (("" (INST -1 "a!1") (("" (ASSERT) NIL NIL)) NIL))
      NIL))
    NIL))
  NIL)
 (|tan_gt_0| "" (SKOSIMP)
  (("" (EXPAND "tan")
    (("" (LEMMA "cos_gt_0")
      (("" (INST -1 "a!1")
        (("" (ASSERT)
          (("" (REWRITE "pos_div_gt" 1) (("" (REWRITE "sin_gt_0") NIL NIL))
            NIL))
          NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|tan_lt_0_TCC1| "" (SKOSIMP*)
  (("" (EXPAND "Tan?")
    (("" (LEMMA "cos_gt_0") (("" (INST?) (("" (ASSERT) NIL NIL)) NIL)) NIL))
    NIL))
  NIL)
 (|tan_lt_0| "" (SKOSIMP)
  (("" (EXPAND "tan")
    (("" (LEMMA "cos_gt_0")
      (("" (INST -1 "a!1")
        (("" (ASSERT)
          (("" (LEMMA "sin_period")
            (("" (INST?)
              (("" (INST -1 "1")
                (("" (REPLACE -1)
                  (("" (HIDE -1)
                    (("" (LEMMA "sin_lt_0")
                      (("" (INST?)
                        (("" (ASSERT)
                          (("" (LEMMA "neg_div_lt")
                            (("" (INST?) (("" (ASSERT) NIL NIL)) NIL)) NIL))
                          NIL))
                        NIL))
                      NIL))
                    NIL))
                  NIL))
                NIL))
              NIL))
            NIL))
          NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|cos_ge_0_3PI2| "" (SKOSIMP*)
  (("" (NAME "BB" "a!1 - 2 * PI")
    (("" (CASE-REPLACE "a!1 = BB + 2*PI")
      (("1" (HIDE -1 -2)
        (("1" (ASSERT)
          (("1" (CASE-REPLACE "-PI/2 <= BB AND BB <= 0")
            (("1" (HIDE -2 -3)
              (("1" (REWRITE "cos_plus")
                (("1" (REWRITE "cos_2PI")
                  (("1" (REWRITE "sin_2PI")
                    (("1" (FLATTEN)
                      (("1" (ASSERT)
                        (("1" (LEMMA "cos_gt_0")
                          (("1" (INST?)
                            (("1" (LEMMA "cos_PI2")
                              (("1" (LEMMA "cos_neg")
                                (("1" (INST -1 "PI/2")
                                  (("1" (GROUND) NIL NIL)) NIL))
                                NIL))
                              NIL))
                            NIL))
                          NIL))
                        NIL))
                      NIL))
                    NIL))
                  NIL))
                NIL))
              NIL)
             ("2" (ASSERT) NIL NIL))
            NIL))
          NIL))
        NIL)
       ("2" (ASSERT) NIL NIL))
      NIL))
    NIL))
  NIL)
 (|sin_increasing_imp| "" (SKOSIMP)
  (("" (CASE "sin(a!1) - sin(b!1) > 0")
    (("1" (ASSERT) NIL NIL)
     ("2" (HIDE 2)
      (("2" (ASSERT)
        (("2" (LEMMA "sin_plus")
          (("2" (INST -1 "(a!1+b!1)/2" "(a!1-b!1)/2")
            (("2" (LEMMA "sin_minus")
              (("2" (INST -1 "(a!1+b!1)/2" "(a!1-b!1)/2")
                (("2" (REPLACE -2 * LR)
                  (("2" (REPLACE -1 * LR)
                    (("2" (HIDE -2 -1)
                      (("2" (ASSERT)
                        (("2" (ASSERT)
                          (("2" (LEMMA "pos_times_gt")
                            (("2"
                              (INST -1 "2"
                               "sin((a!1 - b!1) / 2) * cos((a!1 + b!1) / 2)")
                              (("2" (REPLACE -1 * LR)
                                (("2" (HIDE -1)
                                  (("2" (FLATTEN)
                                    (("2" (HIDE 1)
                                      (("2"
                                        (REWRITE "pos_times_gt" 1)
                                        (("2"
                                          (ASSERT)
                                          (("2"
                                            (FLATTEN)
                                            (("2"
                                              (HIDE 1)
                                              (("2"
                                                (REWRITE "sin_gt_0")
                                                (("2"
                                                  (REWRITE "cos_gt_0")
                                                  (("2" (ASSERT) NIL NIL))
                                                  NIL))
                                                NIL))
                                              NIL))
                                            NIL))
                                          NIL))
                                        NIL))
                                      NIL))
                                    NIL))
                                  NIL))
                                NIL))
                              NIL))
                            NIL))
                          NIL))
                        NIL))
                      NIL))
                    NIL))
                  NIL))
                NIL))
              NIL))
            NIL))
          NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|sin_increasing| "" (SKOSIMP)
  (("" (PROP)
    (("1" (LEMMA "sin_increasing_imp")
      (("1" (INST -1 "b!1" "a!1") (("1" (ASSERT) NIL NIL)) NIL)) NIL)
     ("2" (REWRITE "sin_increasing_imp") NIL NIL))
    NIL))
  NIL)
 (|sin_decreasing| "" (LEMMA "sin_increasing")
  (("" (SKOSIMP)
    (("" (INST -1 "PI-b!1" "PI-a!1")
      (("" (REWRITE "sin_minus")
        (("" (REWRITE "sin_PI")
          (("" (REWRITE "cos_PI")
            (("" (REWRITE "sin_minus")
              (("" (REWRITE "sin_PI")
                (("" (REWRITE "cos_PI")
                  (("" (ASSERT)
                    (("" (CASE-REPLACE "-1 * (sin(b!1) * -1) = sin(b!1)")
                      (("1" (HIDE -1)
                        (("1" (CASE-REPLACE "-1 * (sin(a!1) * -1) = sin(a!1)")
                          (("1" (HIDE -1) (("1" (GROUND) NIL NIL)) NIL)
                           ("2" (ASSERT) NIL NIL))
                          NIL))
                        NIL)
                       ("2" (ASSERT) NIL NIL))
                      NIL))
                    NIL))
                  NIL))
                NIL))
              NIL))
            NIL))
          NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|cos_increasing| "" (SKOSIMP)
  (("" (LEMMA "sin_increasing")
    (("" (INST -1 "a!1-3*PI/2" "b!1-3*PI/2")
      (("" (ASSERT)
        (("" (REWRITE "sin_minus")
          (("" (REWRITE "cos_3PI2")
            (("" (REWRITE "sin_3PI2")
              (("" (REWRITE "sin_minus")
                (("" (REWRITE "cos_3PI2")
                  (("" (REWRITE "sin_3PI2") (("" (GROUND) NIL NIL)) NIL))
                  NIL))
                NIL))
              NIL))
            NIL))
          NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|cos_decreasing| "" (SKOSIMP)
  (("" (LEMMA "sin_increasing")
    (("" (INST -1 "a!1-PI/2" "b!1-PI/2")
      (("" (ASSERT)
        (("" (REWRITE "sin_minus")
          (("" (REWRITE "sin_PI2")
            (("" (REWRITE "cos_PI2")
              (("" (ASSERT)
                (("" (REWRITE "sin_minus")
                  (("" (REWRITE "sin_PI2")
                    (("" (REWRITE "cos_PI2")
                      (("" (ASSERT) (("" (GROUND) NIL NIL)) NIL)) NIL))
                    NIL))
                  NIL))
                NIL))
              NIL))
            NIL))
          NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|tan_PI4_def| "" (SKOSIMP)
  (("" (EXPAND "Tan?")
    (("" (LEMMA "cos_gt_0") (("" (INST -1 "a!1") (("" (ASSERT) NIL NIL)) NIL))
      NIL))
    NIL))
  NIL)
 (|tan_increasing_imp_TCC1| "" (SKOSIMP)
  (("" (REWRITE "tan_PI4_def") NIL NIL)) NIL)
 (|tan_increasing_imp_TCC2| "" (SKOSIMP)
  (("" (REWRITE "tan_PI4_def") NIL NIL)) NIL)
 (|tan_increasing_imp| "" (SKOSIMP)
  (("" (EXPAND "tan")
    (("" (LEMMA "cos_gt_0")
      (("" (INST -1 "a!1")
        (("" (LEMMA "cos_gt_0")
          (("" (INST -1 "b!1")
            (("" (ASSERT)
              (("" (CASE "a!1>0" "b!1<0")
                (("1"
                  (CASE "EXISTS (d: real): sin(a!1) / cos(a!1) > d AND d >= sin(b!1) / cos(b!1)")
                  (("1" (SKOSIMP*) (("1" (ASSERT) NIL NIL)) NIL)
                   ("2" (HIDE 2)
                    (("2" (INST 1 "0")
                      (("2" (REWRITE "pos_div_gt" 1)
                        (("2" (REWRITE "sin_gt_0")
                          (("2" (REWRITE "neg_div_ge" 1)
                            (("2" (LEMMA "sin_gt_0")
                              (("2" (INST -1 "-b!1")
                                (("2" (REWRITE "sin_neg" -1)
                                  (("2"
                                    (CASE "0 < -b!1 AND -b!1 < PI IMPLIES sin(b!1) < 0")
                                    (("1" (HIDE -2) (("1" (ASSERT) NIL NIL))
                                      NIL)
                                     ("2" (GROUND) NIL NIL))
                                    NIL))
                                  NIL))
                                NIL))
                              NIL))
                            NIL))
                          NIL))
                        NIL))
                      NIL))
                    NIL))
                  NIL)
                 ("2"
                  (CASE "EXISTS (d: real): sin(a!1) / cos(a!1) > d AND d >= sin(b!1) / cos(b!1)")
                  (("1" (SKOSIMP*) (("1" (ASSERT) NIL NIL)) NIL)
                   ("2" (HIDE 3)
                    (("2" (INST + "sin(b!1)/cos(a!1)")
                      (("2" (SPLIT)
                        (("1" (LEMMA "both_sides_div_pos_lt1")
                          (("1" (INST -1 "cos(a!1)" "sin(b!1)" "sin(a!1)")
                            (("1" (ASSERT)
                              (("1" (LEMMA "sin_increasing")
                                (("1" (INST -1 "a!1" "b!1")
                                  (("1" (ASSERT) NIL NIL)) NIL))
                                NIL))
                              NIL))
                            NIL))
                          NIL)
                         ("2"
                          (CASE "(sin(b!1) = 0 OR
        sin(b!1) > 0 AND cos(a!1) <= cos(b!1) OR
         sin(b!1) < 0 AND cos(a!1) >= cos(b!1))")
                          (("1" (ASSERT)
                            (("1" (SPLIT -1)
                              (("1" (FLATTEN)
                                (("1" (LEMMA "both_sides_div_pos_le2")
                                  (("1"
                                    (INST -1 "cos(b!1)" "cos(a!1)" "sin(b!1)")
                                    (("1" (ASSERT) NIL NIL)
                                     ("2" (ASSERT) NIL NIL))
                                    NIL))
                                  NIL))
                                NIL)
                               ("2" (FLATTEN)
                                (("2" (LEMMA "both_sides_div_pos_le3")
                                  (("2"
                                    (INST -1 "sin(b!1)" "cos(b!1)" "cos(a!1)")
                                    (("1" (ASSERT) NIL NIL)
                                     ("2" (ASSERT) NIL NIL))
                                    NIL))
                                  NIL))
                                NIL))
                              NIL))
                            NIL)
                           ("2" (LEMMA "cos_decreasing")
                            (("2" (INST -1 "a!1" "b!1")
                              (("2" (ASSERT)
                                (("2" (LEMMA "sin_ge_0")
                                  (("2" (INST -1 "b!1")
                                    (("2" (ASSERT) NIL NIL)) NIL))
                                  NIL))
                                NIL))
                              NIL))
                            NIL))
                          NIL))
                        NIL))
                      NIL))
                    NIL))
                  NIL)
                 ("3"
                  (CASE "EXISTS (d: real): sin(a!1) / cos(a!1) > d AND d >= sin(b!1) / cos(b!1)")
                  (("1" (SKOSIMP*) (("1" (ASSERT) NIL NIL)) NIL)
                   ("2" (HIDE 3)
                    (("2" (INST + "sin(b!1)/cos(a!1)")
                      (("2" (SPLIT)
                        (("1" (LEMMA "both_sides_div_pos_gt1")
                          (("1" (INST -1 "cos(a!1)" "sin(a!1)" "sin(b!1)")
                            (("1" (ASSERT)
                              (("1" (HIDE 2)
                                (("1" (REWRITE "sin_increasing") NIL NIL))
                                NIL))
                              NIL))
                            NIL))
                          NIL)
                         ("2"
                          (CASE "(sin(b!1) = 0 OR
        sin(b!1) > 0 AND cos(a!1) <= cos(b!1) OR
         sin(b!1) < 0 AND cos(a!1) >= cos(b!1))")
                          (("1" (ASSERT)
                            (("1" (SPLIT -1)
                              (("1" (FLATTEN)
                                (("1" (LEMMA "both_sides_div_pos_le2")
                                  (("1"
                                    (INST -1 "cos(b!1)" "cos(a!1)" "sin(b!1)")
                                    (("1" (ASSERT) NIL NIL)
                                     ("2" (ASSERT) NIL NIL))
                                    NIL))
                                  NIL))
                                NIL)
                               ("2" (LEMMA "both_sides_div_pos_le3")
                                (("2"
                                  (INST -1 "sin(b!1)" "cos(b!1)" "cos(a!1)")
                                  (("1" (ASSERT) NIL NIL)
                                   ("2" (FLATTEN) (("2" (ASSERT) NIL NIL))
                                    NIL))
                                  NIL))
                                NIL))
                              NIL))
                            NIL)
                           ("2" (HIDE 2)
                            (("2" (LEMMA "sin_gt_0")
                              (("2" (INST -1 "-b!1")
                                (("2" (REWRITE "sin_neg" -1)
                                  (("2"
                                    (CASE "0 < -b!1 AND -b!1 < PI IMPLIES sin(b!1) < 0")
                                    (("1" (HIDE -2)
                                      (("1"
                                        (ASSERT)
                                        (("1"
                                          (LEMMA "cos_decreasing")
                                          (("1"
                                            (INST -1 "-b!1" "-a!1")
                                            (("1"
                                              (REWRITE "cos_neg" -1)
                                              (("1"
                                                (REWRITE "cos_neg" -1)
                                                (("1" (ASSERT) NIL NIL))
                                                NIL))
                                              NIL))
                                            NIL))
                                          NIL))
                                        NIL))
                                      NIL)
                                     ("2" (ASSERT) NIL NIL))
                                    NIL))
                                  NIL))
                                NIL))
                              NIL))
                            NIL))
                          NIL))
                        NIL))
                      NIL))
                    NIL))
                  NIL))
                NIL))
              NIL))
            NIL))
          NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|tan_increasing_TCC1| "" (SKOSIMP) (("" (REWRITE "tan_PI4_def") NIL NIL))
  NIL)
 (|tan_increasing_TCC2| "" (SKOSIMP*) (("" (REWRITE "tan_PI4_def") NIL NIL))
  NIL)
 (|tan_increasing| "" (SKOSIMP)
  (("" (ASSERT)
    (("" (PROP)
      (("1" (CASE "a!1=b!1")
        (("1" (REPLACE -1 * LR) (("1" (ASSERT) NIL NIL)) NIL)
         ("2" (LEMMA "trich_gt")
          (("2" (INST -1 "a!1" "b!1")
            (("2" (REPLACE 1 * LR)
              (("2" (PROP)
                (("2" (LEMMA "tan_increasing_imp")
                  (("2" (INST -1 "b!1" "a!1") (("2" (ASSERT) NIL NIL)) NIL))
                  NIL))
                NIL))
              NIL))
            NIL))
          NIL))
        NIL)
       ("2" (REWRITE "tan_increasing_imp") NIL NIL))
      NIL))
    NIL))
  NIL)
 (|sin_incr| "" (SKOSIMP*)
  (("" (CASE-REPLACE "a!1=b!1")
    (("1" (GROUND) NIL NIL)
     ("2" (LEMMA "sin_increasing")
      (("2" (INST-CP -1 "b!1" "a!1")
        (("2" (INST -1 "a!1" "b!1") (("2" (GROUND) NIL NIL)) NIL)) NIL))
      NIL))
    NIL))
  NIL)
 (|sin_decr| "" (SKOSIMP*)
  (("" (LEMMA "sin_decreasing")
    (("" (INST -1 "a!1" "b!1")
      (("" (ASSERT)
        (("" (LEMMA "sin_decreasing")
          (("" (INST -1 "b!1" "a!1")
            (("" (ASSERT) (("" (GROUND) NIL NIL)) NIL)) NIL))
          NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|cos_incr| "" (SKOSIMP*)
  (("" (LEMMA "cos_increasing")
    (("" (INST-CP -1 "b!1" "a!1")
      (("" (INST -1 "a!1" "b!1") (("" (GROUND) NIL NIL)) NIL)) NIL))
    NIL))
  NIL)
 (|cos_decr| "" (SKOSIMP*)
  (("" (LEMMA "cos_decreasing")
    (("" (INST-CP -1 "b!1" "a!1")
      (("" (INST -1 "a!1" "b!1") (("" (GROUND) NIL NIL)) NIL)) NIL))
    NIL))
  NIL)
 (|tan_incr| "" (SKOSIMP*)
  (("" (LEMMA "tan_increasing")
    (("" (INST-CP -1 "b!1" "a!1")
      (("" (INST -1 "a!1" "b!1") (("" (GROUND) NIL NIL)) NIL)) NIL))
    NIL))
  NIL))


$$$trig_extra.pvs
trig_extra : THEORY
%-----------------------------------------------------------------------------
%      trig_extra
%      ----------
%         - reduction theorems
%         - sum and product identities
%         - half-angle identities and zeros
%         - triple angle formulas
%-----------------------------------------------------------------------------
BEGIN

   IMPORTING trig_basic


  a,b             : VAR real

% ------------------------- Reduction Theorems -------------------------

  sin_minus_2PI    : LEMMA sin(a - 2*PI) = sin(a)  
  cos_minus_2PI    : LEMMA cos(a - 2*PI) = cos(a) 
  tan_minus_2PI    : LEMMA cos(a) /= 0 IMPLIES tan(a - 2*PI) = tan(a) 

  sin_minus_3PI2   : LEMMA sin(a - 3*PI/2) =   cos(a)
  cos_minus_3PI2   : LEMMA cos(a - 3*PI/2) = - sin(a)
  tan_minus_3PI2   : LEMMA sin(a) /= 0 AND cos(a) /= 0 
                              IMPLIES tan(a - 3*PI/2) = - 1/tan(a)

  sin_minus_PI     : LEMMA sin(a - PI) = - sin(a)
  cos_minus_PI     : LEMMA cos(a - PI) = - cos(a)
  tan_minus_PI     : LEMMA cos(a) /= 0 IMPLIES tan(a - PI) =   tan(a)

  sin_minus_PI2    : LEMMA sin(a - PI/2) = - cos(a)
  cos_minus_PI2    : LEMMA cos(a - PI/2) =   sin(a)
  tan_minus_PI2    : LEMMA sin(a) /= 0 AND cos(a) /= 0 
                              IMPLIES tan(a - PI/2) = - 1/tan(a)

  sin_2PI_minus    : LEMMA sin(2*PI - a) = - sin(a)
  cos_2PI_minus    : LEMMA cos(2*PI - a) =   cos(a)
  tan_2PI_minus    : LEMMA sin(a) /= 0 AND cos(a) /= 0 
                              IMPLIES tan(2*PI - a) =   - tan(a)
                               
  sin_3PI2_minus   : LEMMA sin(3*PI/2 - a) = - cos(a)
  cos_3PI2_minus   : LEMMA cos(3*PI/2 - a) = - sin(a)
  tan_3PI2_minus   : LEMMA sin(a) /= 0 AND cos(a) /= 0 
	                             IMPLIES tan(3*PI/2 - a) =   1/tan(a)
                               
  sin_PI_minus     : LEMMA sin(PI - a) =   sin(a)
  cos_PI_minus     : LEMMA cos(PI - a) = - cos(a)
  tan_PI_minus     : LEMMA cos(a) /= 0 IMPLIES tan(PI - a) = - tan(a)
                               
  sin_PI2_minus    : LEMMA sin(PI/2 - a) = cos(a)
  cos_PI2_minus    : LEMMA cos(PI/2 - a) = sin(a)
  tan_PI2_minus    : LEMMA sin(a) /= 0 AND cos(a) /= 0 
                              IMPLIES tan(PI/2 - a) = 1/tan(a)

% ------------------------- Sum and Product Formulas -------------------------

  sin_times_cos    : LEMMA sin(a)*cos(b) = (sin(a+b) + sin(a-b))/2
  cos_times_cos    : LEMMA cos(a)*cos(b) = (cos(a+b) + cos(a-b))/2
  sin_times_sin    : LEMMA sin(a)*sin(b) = (cos(a-b) - cos(a+b))/2

  sin_sum          : LEMMA sin(a) + sin(b) =   2 * sin((a+b)/2)*cos((a-b)/2)
  sin_diff         : LEMMA sin(a) - sin(b) =   2 * cos((a+b)/2)*sin((a-b)/2)
  cos_sum          : LEMMA cos(a) + cos(b) =   2 * cos((a+b)/2)*cos((a-b)/2)
  cos_diff         : LEMMA cos(a) - cos(b) = - 2 * sin((a+b)/2)*sin((a-b)/2)

  tan_diff         : LEMMA Tan?(a) AND Tan?(b) IMPLIES
                              tan(a) - tan(b) = sin(a-b)/(cos(a)*cos(b))

% ------------------------- Squares of sin and cos -------------------------

  sq_sin           : LEMMA sq(sin(a)) = (1-cos(2*a))/2
  sq_cos           : LEMMA sq(cos(a)) = (1+cos(2*a))/2
  sin_half_zeroes  : LEMMA sin(a/2) = 0 IFF 1-cos(a) = 0
  cos_half_zeroes  : LEMMA cos(a/2) = 0 IFF 1+cos(a) = 0
  cos_half_zeroes2 : LEMMA cos(a/2) = 0 IMPLIES sin(a) = 0
  sq_tan           : LEMMA (1+cos(2*a)) /= 0 
                                IMPLIES sq(tan(a)) = (1-cos(2*a))/(1+cos(2*a))

% ------------------------- Half Angle Formulas -------------------------

  IMPORTING trig_ineq 

  sin_half  : LEMMA 
                ( 0 <= a/2 AND a/2 <= PI IMPLIES
                  sin(a/2) = sqrt((1-cos(a))/2))  AND
                ( PI <= a/2 AND a/2 <= 2*PI IMPLIES
                  sin(a/2) = -sqrt((1-cos(a))/2))

  cos_half  : LEMMA 
                ( 0 <= a/2 AND a/2 <= PI/2 IMPLIES
                  cos(a/2) = sqrt((1+cos(a))/2))  AND
                ( PI/2 <= a/2 AND a/2 <= 3*PI/2 IMPLIES
                  cos(a/2) = -sqrt((1+cos(a))/2)) AND 
                ( 3*PI/2 <= a/2 AND a/2 <= 2*PI IMPLIES
                  cos(a/2) = sqrt((1+cos(a))/2)) 

  tan_half  : LEMMA
                cos(a) /= -1 IMPLIES tan(a/2) = sin(a)/(1 + cos(a)) 

  tan_half2 : LEMMA
                sin(a) /= 0 IMPLIES tan(a/2) = (1 - cos(a))/sin(a)

% ---------------------- Triple Angle Formulas ----------------------

  sin_3a      : LEMMA sin(3*a) = 3 * sin(a) - 4 * expt(sin(a),3)
  cos_3a      : LEMMA cos(3*a) = 4 * expt(cos(a),3) - 3 * cos(a)

% ---------------------- Base equations ---------------------

  sin_eq_sin  : LEMMA sin(a) = sin(b) <=> 
                   (EXISTS (k: int): (a = b + 2*k*PI) OR (a = PI - b + 2*k*PI)) 

  cos_eq_cos  : LEMMA cos(a) = cos(b) <=> 
                   (EXISTS (k: int): (a = b + 2*k*PI) OR (a = -b + 2*k*PI)) 

  tan_eq_tan  : LEMMA Tan?(a) AND Tan?(b) IMPLIES
                      ( tan(a) = tan(b) <=> (EXISTS (k: int): (a = b + k*PI)) )

  i,j: VAR integer

  sin_eq_pm1  : LEMMA sin(a) = (-1)^i IFF (EXISTS j: a = (i+2*j)*PI + PI/2)
  cos_eq_pm1  : LEMMA cos(a) = (-1)^i IFF (EXISTS j: a = (i+2*j)*PI)

END trig_extra

$$$trig_extra.prf
(|trig_extra|
 (|sin_minus_2PI| "" (SKOSIMP)
  (("" (REWRITE "sin_minus")
    (("" (REWRITE "sin_2PI")
      (("" (REWRITE "cos_2PI") (("" (ASSERT) NIL NIL)) NIL)) NIL))
    NIL))
  NIL)
 (|cos_minus_2PI| "" (SKOSIMP)
  (("" (REWRITE "cos_minus")
    (("" (REWRITE "cos_2PI")
      (("" (REWRITE "sin_2PI") (("" (ASSERT) NIL NIL)) NIL)) NIL))
    NIL))
  NIL)
 (|tan_minus_2PI_TCC1| "" (SKOSIMP)
  (("" (EXPAND "Tan?")
    (("" (REWRITE "cos_minus_2PI") (("" (ASSERT) NIL NIL)) NIL)) NIL))
  NIL)
 (|tan_minus_2PI_TCC2| "" (SUBTYPE-TCC) NIL NIL)
 (|tan_minus_2PI| "" (SKOSIMP)
  (("" (EXPAND "tan")
    (("" (REWRITE "sin_minus_2PI") (("" (REWRITE "cos_minus_2PI") NIL NIL))
      NIL))
    NIL))
  NIL)
 (|sin_minus_3PI2| "" (SKOSIMP)
  (("" (REWRITE "sin_minus")
    (("" (REWRITE "sin_3PI2")
      (("" (REWRITE "cos_3PI2") (("" (ASSERT) NIL NIL)) NIL)) NIL))
    NIL))
  NIL)
 (|cos_minus_3PI2| "" (SKOSIMP)
  (("" (REWRITE "cos_minus")
    (("" (REWRITE "cos_3PI2")
      (("" (REWRITE "sin_3PI2") (("" (ASSERT) NIL NIL)) NIL)) NIL))
    NIL))
  NIL)
 (|tan_minus_3PI2_TCC1| "" (SUBTYPE-TCC)
  (("" (REWRITE "cos_minus_3PI2") (("" (ASSERT) NIL NIL)) NIL)) NIL)
 (|tan_minus_3PI2_TCC2| "" (SKOSIMP)
  (("" (EXPAND "tan")
    (("" (LEMMA "div_eq_zero")
      (("" (INST -1 "cos(a!1)" "sin(a!1)")
        (("1" (REPLACE -1 * LR) (("1" (PROPAX) NIL NIL)) NIL)
         ("2" (ASSERT) NIL NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|tan_minus_3PI2| "" (SKOSIMP)
  (("" (EXPAND "tan")
    (("" (REWRITE "sin_minus_3PI2")
      (("" (REWRITE "cos_minus_3PI2") (("" (ASSERT) NIL NIL)) NIL)) NIL))
    NIL))
  NIL)
 (|sin_minus_PI| "" (SKOSIMP)
  (("" (REWRITE "sin_minus")
    (("" (REWRITE "sin_PI")
      (("" (REWRITE "cos_PI") (("" (ASSERT) NIL NIL)) NIL)) NIL))
    NIL))
  NIL)
 (|cos_minus_PI| "" (SKOSIMP)
  (("" (REWRITE "cos_minus")
    (("" (REWRITE "cos_PI")
      (("" (REWRITE "sin_PI") (("" (ASSERT) NIL NIL)) NIL)) NIL))
    NIL))
  NIL)
 (|tan_minus_PI_TCC1| "" (SUBTYPE-TCC)
  (("" (REWRITE "cos_minus_PI") (("" (ASSERT) NIL NIL)) NIL)) NIL)
 (|tan_minus_PI| "" (SKOSIMP)
  (("" (EXPAND "tan")
    (("" (REWRITE "sin_minus_PI")
      (("" (REWRITE "cos_minus_PI") (("" (ASSERT) NIL NIL)) NIL)) NIL))
    NIL))
  NIL)
 (|sin_minus_PI2| "" (SKOSIMP)
  (("" (REWRITE "sin_minus")
    (("" (REWRITE "cos_PI2")
      (("" (REWRITE "sin_PI2") (("" (ASSERT) NIL NIL)) NIL)) NIL))
    NIL))
  NIL)
 (|cos_minus_PI2| "" (SKOSIMP)
  (("" (REWRITE "cos_minus")
    (("" (REWRITE "cos_PI2")
      (("" (REWRITE "sin_PI2") (("" (ASSERT) NIL NIL)) NIL)) NIL))
    NIL))
  NIL)
 (|tan_minus_PI2_TCC1| "" (SUBTYPE-TCC)
  (("" (REWRITE "cos_minus_PI2") NIL NIL)) NIL)
 (|tan_minus_PI2| "" (SKOSIMP)
  (("" (EXPAND "tan")
    (("" (REWRITE "sin_minus_PI2")
      (("" (REWRITE "cos_minus_PI2") (("" (ASSERT) NIL NIL)) NIL)) NIL))
    NIL))
  NIL)
 (|sin_2PI_minus| "" (SKOSIMP)
  (("" (REWRITE "sin_minus")
    (("" (REWRITE "sin_2PI")
      (("" (REWRITE "cos_2PI") (("" (ASSERT) NIL NIL)) NIL)) NIL))
    NIL))
  NIL)
 (|cos_2PI_minus| "" (SKOSIMP)
  (("" (REWRITE "cos_minus")
    (("" (REWRITE "cos_2PI")
      (("" (REWRITE "sin_2PI") (("" (ASSERT) NIL NIL)) NIL)) NIL))
    NIL))
  NIL)
 (|tan_2PI_minus_TCC1| "" (SKOSIMP)
  (("" (EXPAND "Tan?")
    (("" (REWRITE "cos_2PI_minus") (("" (ASSERT) NIL NIL)) NIL)) NIL))
  NIL)
 (|tan_2PI_minus| "" (SKOSIMP)
  (("" (EXPAND "tan")
    (("" (REWRITE "sin_2PI_minus")
      (("" (REWRITE "cos_2PI_minus") (("" (ASSERT) NIL NIL)) NIL)) NIL))
    NIL))
  NIL)
 (|sin_3PI2_minus| "" (SKOSIMP)
  (("" (REWRITE "sin_minus")
    (("" (REWRITE "sin_3PI2")
      (("" (REWRITE "cos_3PI2") (("" (ASSERT) NIL NIL)) NIL)) NIL))
    NIL))
  NIL)
 (|cos_3PI2_minus| "" (SKOSIMP)
  (("" (REWRITE "cos_minus")
    (("" (REWRITE "cos_3PI2")
      (("" (REWRITE "sin_3PI2") (("" (ASSERT) NIL NIL)) NIL)) NIL))
    NIL))
  NIL)
 (|tan_3PI2_minus_TCC1| "" (SUBTYPE-TCC)
  (("" (REWRITE "cos_3PI2_minus") (("" (ASSERT) NIL NIL)) NIL)) NIL)
 (|tan_3PI2_minus| "" (SKOSIMP)
  (("" (EXPAND "tan")
    (("" (REWRITE "sin_3PI2_minus")
      (("" (REWRITE "cos_3PI2_minus") (("" (ASSERT) NIL NIL)) NIL)) NIL))
    NIL))
  NIL)
 (|sin_PI_minus| "" (SKOSIMP)
  (("" (REWRITE "sin_minus")
    (("" (REWRITE "sin_PI")
      (("" (REWRITE "cos_PI") (("" (ASSERT) NIL NIL)) NIL)) NIL))
    NIL))
  NIL)
 (|cos_PI_minus| "" (SKOSIMP)
  (("" (REWRITE "cos_minus")
    (("" (REWRITE "cos_PI")
      (("" (REWRITE "sin_PI") (("" (ASSERT) NIL NIL)) NIL)) NIL))
    NIL))
  NIL)
 (|tan_PI_minus_TCC1| "" (SUBTYPE-TCC)
  (("" (REWRITE "cos_PI_minus") (("" (ASSERT) NIL NIL)) NIL)) NIL)
 (|tan_PI_minus| "" (SKOSIMP)
  (("" (EXPAND "tan")
    (("" (REWRITE "sin_PI_minus")
      (("" (REWRITE "cos_PI_minus") (("" (ASSERT) NIL NIL)) NIL)) NIL))
    NIL))
  NIL)
 (|sin_PI2_minus| "" (SKOSIMP)
  (("" (REWRITE "sin_minus")
    (("" (REWRITE "sin_PI2")
      (("" (REWRITE "cos_PI2") (("" (ASSERT) NIL NIL)) NIL)) NIL))
    NIL))
  NIL)
 (|cos_PI2_minus| "" (SKOSIMP)
  (("" (REWRITE "cos_minus")
    (("" (REWRITE "cos_PI2")
      (("" (REWRITE "sin_PI2") (("" (ASSERT) NIL NIL)) NIL)) NIL))
    NIL))
  NIL)
 (|tan_PI2_minus_TCC1| "" (SUBTYPE-TCC)
  (("" (REWRITE "cos_PI2_minus") NIL NIL)) NIL)
 (|tan_PI2_minus| "" (SKOSIMP)
  (("" (EXPAND "tan")
    (("" (REWRITE "sin_PI2_minus")
      (("" (REWRITE "cos_PI2_minus") (("" (ASSERT) NIL NIL)) NIL)) NIL))
    NIL))
  NIL)
 (|sin_times_cos| "" (SKOSIMP)
  (("" (REWRITE "sin_plus")
    (("" (REWRITE "sin_minus") (("" (ASSERT) NIL NIL)) NIL)) NIL))
  NIL)
 (|cos_times_cos| "" (SKOSIMP)
  (("" (REWRITE "cos_plus")
    (("" (REWRITE "cos_minus") (("" (ASSERT) NIL NIL)) NIL)) NIL))
  NIL)
 (|sin_times_sin| "" (SKOSIMP)
  (("" (REWRITE "cos_plus")
    (("" (REWRITE "cos_minus") (("" (ASSERT) NIL NIL)) NIL)) NIL))
  NIL)
 (|sin_sum| "" (SKOSIMP*)
  (("" (NAME "A" "(a!1+b!1)/2")
    (("" (NAME "B" "(a!1-b!1)/2")
      (("" (REPLACE -1)
        (("" (REPLACE -2)
          (("" (CASE "a!1= A+B")
            (("1" (CASE "b!1= A-B")
              (("1" (REPLACE -1 +)
                (("1" (HIDE -1)
                  (("1" (REPLACE -1 +)
                    (("1" (HIDE -1)
                      (("1" (HIDE -1 -2)
                        (("1" (REWRITE "sin_plus")
                          (("1" (REWRITE "sin_minus") (("1" (ASSERT) NIL NIL))
                            NIL))
                          NIL))
                        NIL))
                      NIL))
                    NIL))
                  NIL))
                NIL)
               ("2" (HIDE 2) (("2" (ASSERT) NIL NIL)) NIL))
              NIL)
             ("2" (HIDE 2) (("2" (ASSERT) NIL NIL)) NIL))
            NIL))
          NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|sin_diff| "" (SKOSIMP*)
  (("" (NAME "A" "(a!1+b!1)/2")
    (("" (NAME "B" "(a!1-b!1)/2")
      (("" (REPLACE -1)
        (("" (REPLACE -2)
          (("" (CASE "a!1= A+B")
            (("1" (CASE "b!1= A-B")
              (("1" (REPLACE -1 +)
                (("1" (HIDE -1)
                  (("1" (REPLACE -1 +)
                    (("1" (HIDE -1)
                      (("1" (HIDE -1 -2)
                        (("1" (REWRITE "sin_plus")
                          (("1" (REWRITE "sin_minus") (("1" (ASSERT) NIL NIL))
                            NIL))
                          NIL))
                        NIL))
                      NIL))
                    NIL))
                  NIL))
                NIL)
               ("2" (HIDE 2) (("2" (ASSERT) NIL NIL)) NIL))
              NIL)
             ("2" (HIDE 2) (("2" (ASSERT) NIL NIL)) NIL))
            NIL))
          NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|cos_sum| "" (SKOSIMP*)
  (("" (NAME "A" "(a!1+b!1)/2")
    (("" (NAME "B" "(a!1-b!1)/2")
      (("" (REPLACE -1)
        (("" (REPLACE -2)
          (("" (CASE "a!1= A+B")
            (("1" (CASE "b!1= A-B")
              (("1" (REPLACE -1 +)
                (("1" (HIDE -1)
                  (("1" (REPLACE -1 +)
                    (("1" (HIDE -1)
                      (("1" (HIDE -1 -2)
                        (("1" (REWRITE "cos_plus")
                          (("1" (REWRITE "cos_minus") (("1" (ASSERT) NIL NIL))
                            NIL))
                          NIL))
                        NIL))
                      NIL))
                    NIL))
                  NIL))
                NIL)
               ("2" (HIDE 2) (("2" (ASSERT) NIL NIL)) NIL))
              NIL)
             ("2" (HIDE 2) (("2" (ASSERT) NIL NIL)) NIL))
            NIL))
          NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|cos_diff| "" (SKOSIMP*)
  (("" (NAME "A" "(a!1+b!1)/2")
    (("" (NAME "B" "(a!1-b!1)/2")
      (("" (REPLACE -1)
        (("" (REPLACE -2)
          (("" (CASE "a!1= A+B")
            (("1" (CASE "b!1= A-B")
              (("1" (REPLACE -1 +)
                (("1" (HIDE -1)
                  (("1" (REPLACE -1 +)
                    (("1" (HIDE -1)
                      (("1" (HIDE -1 -2)
                        (("1" (REWRITE "cos_plus")
                          (("1" (REWRITE "cos_minus") (("1" (ASSERT) NIL NIL))
                            NIL))
                          NIL))
                        NIL))
                      NIL))
                    NIL))
                  NIL))
                NIL)
               ("2" (HIDE 2) (("2" (ASSERT) NIL NIL)) NIL))
              NIL)
             ("2" (HIDE 2) (("2" (ASSERT) NIL NIL)) NIL))
            NIL))
          NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|tan_diff_TCC1| "" (SKOSIMP*)
  (("" (EXPAND "Tan?")
    (("" (REWRITE "zero_times3") (("" (GROUND) NIL NIL)) NIL)) NIL))
  NIL)
 (|tan_diff| "" (SKOSIMP*)
  (("" (EXPAND "tan")
    ((""
      (CASE "(sin(a!1) / cos(a!1) - sin(b!1) / cos(b!1) = sin(a!1 - b!1)
                                             /
                                             (cos(a!1)
                                              *
                                              cos(b!1))) = (sin(a!1 - b!1)
                                                            /
                                                            (cos(a!1)
                                                             *
                                                             cos
                                                             (b!1)) = sin(a!1)
                                                                      /
                                                                      cos(a!1)
                                                                      -
                                                                      sin(b!1)
                                                                      /
                                                                      cos(b!1))")
      (("1" (REPLACE -1 1 :HIDE? T)
        (("1" (REWRITE "div_cancel3" 1)
          (("1" (REWRITE "times_div1" 1)
            (("1"
              (CASE-REPLACE
               "(cos(a!1) * cos(b!1) * sin(a!1)) / cos(a!1) = cos(b!1) * sin(a!1)")
              (("1"
                (CASE-REPLACE
                 "cos(a!1) * cos(b!1) * (sin(b!1) / cos(b!1)) = cos(a!1) * sin(b!1)")
                (("1" (HIDE -1 -2)
                  (("1" (REWRITE "sin_minus") (("1" (ASSERT) NIL NIL)) NIL))
                  NIL)
                 ("2" (ASSERT) NIL NIL))
                NIL)
               ("2" (ASSERT) NIL NIL))
              NIL))
            NIL))
          NIL))
        NIL)
       ("2" (ASSERT) (("2" (ASSERT) NIL NIL)) NIL)
       ("3" (ASSERT)
        (("3" (ASSERT)
          (("3" (HIDE 2)
            (("3" (EXPAND "Tan?")
              (("3" (LEMMA "zero_times3")
                (("3" (INST?) (("3" (ASSERT) NIL NIL)) NIL)) NIL))
              NIL))
            NIL))
          NIL))
        NIL)
       ("4" (ASSERT)
        (("4" (ASSERT) (("4" (EXPAND "Tan?") (("4" (PROPAX) NIL NIL)) NIL))
          NIL))
        NIL)
       ("5" (ASSERT)
        (("5" (ASSERT) (("5" (EXPAND "Tan?") (("5" (PROPAX) NIL NIL)) NIL))
          NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|sq_sin| "" (SKOSIMP)
  (("" (LEMMA "sin2_cos2")
    (("" (INST -1 "a!1")
      (("" (REPLACE -1 * RL)
        (("" (HIDE -1)
          (("" (LEMMA "cos_plus")
            (("" (INST -1 "a!1" "a!1")
              (("" (REPLACE -1 * LR)
                (("" (HIDE -1)
                  (("" (EXPAND "sq") (("" (ASSERT) NIL NIL)) NIL)) NIL))
                NIL))
              NIL))
            NIL))
          NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|sq_cos| "" (SKOSIMP)
  (("" (LEMMA "sin2_cos2")
    (("" (INST -1 "a!1")
      (("" (REPLACE -1 * RL)
        (("" (HIDE -1)
          (("" (LEMMA "cos_plus")
            (("" (INST -1 "a!1" "a!1")
              (("" (REPLACE -1 * LR)
                (("" (HIDE -1)
                  (("" (EXPAND "sq") (("" (ASSERT) NIL NIL)) NIL)) NIL))
                NIL))
              NIL))
            NIL))
          NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|sin_half_zeroes| "" (SKOSIMP)
  (("" (PROP)
    (("1" (LEMMA "sq_sin")
      (("1" (INST -1 "a!1/2")
        (("1" (REPLACE -2 * LR)
          (("1" (EXPAND "sq") (("1" (ASSERT) NIL NIL)) NIL)) NIL))
        NIL))
      NIL)
     ("2" (LEMMA "sq_sin")
      (("2" (INST -1 "a!1/2")
        (("2" (REPLACE -2 * LR)
          (("2" (ASSERT)
            (("2" (LEMMA "sq_eq_0")
              (("2" (INST -1 "sin(a!1/2)") (("2" (ASSERT) NIL NIL)) NIL))
              NIL))
            NIL))
          NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|cos_half_zeroes| "" (SKOSIMP)
  (("" (PROP)
    (("1" (LEMMA "sq_cos")
      (("1" (INST -1 "a!1/2")
        (("1" (REPLACE -2 * LR)
          (("1" (EXPAND "sq") (("1" (ASSERT) NIL NIL)) NIL)) NIL))
        NIL))
      NIL)
     ("2" (LEMMA "sq_cos")
      (("2" (INST -1 "a!1/2")
        (("2" (REPLACE -2 * LR)
          (("2" (LEMMA "sq_eq_0")
            (("2" (INST -1 "cos(a!1/2)") (("2" (ASSERT) NIL NIL)) NIL)) NIL))
          NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|cos_half_zeroes2| "" (SKOSIMP)
  (("" (LEMMA "sin_plus")
    (("" (INST -1 "a!1/2" "a!1/2")
      (("" (REPLACE -2 * LR) (("" (ASSERT) NIL NIL)) NIL)) NIL))
    NIL))
  NIL)
 (|sq_tan_TCC1| "" (SKOSIMP)
  (("" (EXPAND "Tan?")
    (("" (PROP)
      (("" (REWRITE "cos_half_zeroes" :DIR RL) (("" (ASSERT) NIL NIL)) NIL))
      NIL))
    NIL))
  NIL)
 (|sq_tan| "" (SKOSIMP)
  (("" (EXPAND "tan")
    (("" (REWRITE "sq_div")
      (("1" (REWRITE "sq_sin")
        (("1" (REWRITE "sq_cos")
          (("1" (ASSERT)
            (("1" (REWRITE "div_div2") (("1" (REWRITE "div_cancel1") NIL NIL))
              NIL))
            NIL))
          NIL))
        NIL)
       ("2" (HIDE 3)
        (("2" (LEMMA "sq_cos")
          (("2" (INST -1 "a!1")
            (("2" (PROP)
              (("2" (REPLACE -2 * LR)
                (("2" (EXPAND "sq") (("2" (ASSERT) NIL NIL)) NIL)) NIL))
              NIL))
            NIL))
          NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|sin_half_TCC1| "" (SUBTYPE-TCC) NIL NIL)
 (|sin_half_TCC2| "" (SUBTYPE-TCC) NIL NIL)
 (|sin_half| "" (SKOSIMP*)
  (("" (LEMMA "cos_2a_sin")
    (("" (INST -1 "a!1/2")
      (("" (CASE-REPLACE "2 * (a!1 / 2) = a!1")
        (("1" (HIDE -1)
          (("1" (REPLACE -1)
            (("1" (HIDE -1)
              (("1"
                (CASE-REPLACE
                 "(2 * (sin(a!1 / 2) * sin(a!1 / 2)) / 2) = sq(sin(a!1/2))")
                (("1" (HIDE -1)
                  (("1" (PROP)
                    (("1" (REWRITE "sqrt_sq")
                      (("1" (HIDE 2) (("1" (REWRITE "sin_ge_0") NIL NIL))
                        NIL))
                      NIL)
                     ("2" (REWRITE "sqrt_sq_abs")
                      (("2" (EXPAND "abs")
                        (("2" (LIFT-IF)
                          (("2" (GROUND)
                            (("2" (LEMMA "sin_le_0")
                              (("2" (INST -1 "a!1/2") (("2" (ASSERT) NIL NIL))
                                NIL))
                              NIL))
                            NIL))
                          NIL))
                        NIL))
                      NIL))
                    NIL))
                  NIL)
                 ("2" (HIDE 2)
                  (("2" (EXPAND "sq") (("2" (ASSERT) NIL NIL)) NIL)) NIL))
                NIL))
              NIL))
            NIL))
          NIL)
         ("2" (ASSERT) NIL NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|cos_half_TCC1| "" (SUBTYPE-TCC) NIL NIL)
 (|cos_half_TCC2| "" (SUBTYPE-TCC) NIL NIL)
 (|cos_half_TCC3| "" (SUBTYPE-TCC) NIL NIL)
 (|cos_half| "" (SKOSIMP*)
  (("" (LEMMA "cos_2a_sin")
    (("" (INST -1 "a!1/2")
      (("" (CASE-REPLACE "2 * (a!1 / 2) = a!1")
        (("1" (HIDE -1)
          (("1" (REPLACE -1)
            (("1" (HIDE -1)
              (("1" (ASSERT)
                (("1"
                  (CASE-REPLACE
                   "sin(a!1 / 2) * sin(a!1 / 2) = sq(sin(a!1/2))")
                  (("1"
                    (CASE-REPLACE
                     "(2 - 2 * sq(sin(a!1 / 2))) / 2 = (1 - sq(sin(a!1 / 2)))")
                    (("1" (HIDE -1)
                      (("1" (REWRITE "cos2" :DIR RL)
                        (("1" (GROUND)
                          (("1" (CASE-REPLACE "cos(a!1/2) >= 0")
                            (("1" (REWRITE "sqrt_sq") NIL NIL)
                             ("2" (HIDE 2)
                              (("2" (REWRITE "cos_ge_0") NIL NIL)) NIL))
                            NIL)
                           ("2" (CASE "cos(a!1/2) <= 0")
                            (("1" (REWRITE "sqrt_sq_abs")
                              (("1" (EXPAND "abs")
                                (("1" (LIFT-IF) (("1" (ASSERT) NIL NIL)) NIL))
                                NIL))
                              NIL)
                             ("2" (HIDE 2)
                              (("2" (REWRITE "cos_le_0") NIL NIL)) NIL))
                            NIL)
                           ("3" (CASE "cos(a!1/2) >= 0")
                            (("1" (REWRITE "sqrt_sq") NIL NIL)
                             ("2" (HIDE 2)
                              (("2" (REWRITE "cos_ge_0_3PI2") NIL NIL)) NIL))
                            NIL))
                          NIL))
                        NIL))
                      NIL)
                     ("2" (HIDE 2) (("2" (ASSERT) NIL NIL)) NIL))
                    NIL)
                   ("2" (HIDE 2)
                    (("2" (EXPAND "sq") (("2" (PROPAX) NIL NIL)) NIL)) NIL))
                  NIL))
                NIL))
              NIL))
            NIL))
          NIL)
         ("2" (ASSERT) NIL NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|tan_half_TCC1| "" (SKOSIMP)
  (("" (EXPAND "Tan?")
    (("" (LEMMA "cos_2a")
      (("" (INST -1 "a!1/2")
        (("" (REPLACE -1 * LR)
          (("" (HIDE -1)
            (("" (PROP)
              (("" (REPLACE -1 * LR)
                (("" (ASSERT)
                  (("" (LEMMA "sin2")
                    (("" (INST -1 "a!1/2")
                      (("" (EXPAND "sq")
                        (("" (REPLACE -1 * LR)
                          (("" (HIDE -1) (("" (ASSERT) NIL NIL)) NIL)) NIL))
                        NIL))
                      NIL))
                    NIL))
                  NIL))
                NIL))
              NIL))
            NIL))
          NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|tan_half_TCC2| "" (SUBTYPE-TCC) NIL NIL)
 (|tan_half| "" (SKOSIMP)
  (("" (EXPAND "tan")
    (("" (LEMMA "sin_plus")
      (("" (INST -1 "a!1/2" "a!1/2")
        (("" (REPLACE -1 * LR)
          (("" (HIDE -1)
            (("" (LEMMA "sq_cos")
              (("" (INST -1 "a!1/2")
                (("" (REWRITE "div_cancel1")
                  (("" (LEMMA "div_cancel1")
                    (("" (INST -1 "2" "1+cos(a!1)")
                      (("" (REPLACE -2 * RL)
                        (("" (REPLACE -1 * RL)
                          (("" (HIDE -2 -1)
                            (("" (EXPAND "sq") (("" (ASSERT) NIL NIL)) NIL))
                            NIL))
                          NIL))
                        NIL))
                      NIL))
                    NIL))
                  NIL))
                NIL))
              NIL))
            NIL))
          NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|tan_half2_TCC1| "" (SKOSIMP)
  (("" (EXPAND "Tan?")
    (("" (LEMMA "sin_2a")
      (("" (INST -1 "a!1/2")
        (("" (REPLACE -1 * LR)
          (("" (HIDE -1)
            (("" (PROP) (("" (REPLACE -1 * LR) (("" (ASSERT) NIL NIL)) NIL))
              NIL))
            NIL))
          NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|tan_half2| "" (SKOSIMP*)
  (("" (NAME "BB" "a!1/2")
    (("" (REPLACE -1)
      (("" (CASE-REPLACE "a!1 = 2*BB")
        (("1" (HIDE -1 -2)
          (("1" (REWRITE "sin_2a")
            (("1" (REWRITE "cos_2a_sin")
              (("1" (ASSERT)
                (("1" (EXPAND "tan") (("1" (ASSERT) NIL NIL)) NIL)) NIL))
              NIL))
            NIL))
          NIL)
         ("2" (ASSERT) NIL NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|sin_3a| "" (SKOSIMP)
  (("" (LEMMA "sin_plus")
    (("" (INST -1 "a!1" "2*a!1")
      (("" (REWRITE "sin_2a")
        (("" (REWRITE "cos_2a")
          (("" (ASSERT)
            (("" (REPLACE -1)
              (("" (ASSERT)
                (("" (HIDE -1)
                  (("" (EXPAND "expt")
                    (("" (EXPAND "expt")
                      (("" (EXPAND "expt")
                        (("" (EXPAND "expt")
                          (("" (ASSERT)
                            (("" (LEMMA "sin_plus")
                              (("" (INST -1 "a!1" "2*a!1")
                                (("" (REWRITE "sin_2a")
                                  (("" (REWRITE "cos_2a")
                                    (("" (ASSERT)
                                      ((""
                                        (LEMMA "cos2")
                                        ((""
                                          (INST?)
                                          ((""
                                            (EXPAND "sq")
                                            ((""
                                              (REPLACE -1)
                                              (("" (ASSERT) NIL NIL))
                                              NIL))
                                            NIL))
                                          NIL))
                                        NIL))
                                      NIL))
                                    NIL))
                                  NIL))
                                NIL))
                              NIL))
                            NIL))
                          NIL))
                        NIL))
                      NIL))
                    NIL))
                  NIL))
                NIL))
              NIL))
            NIL))
          NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|cos_3a| "" (SKOSIMP)
  (("" (LEMMA "cos_plus")
    (("" (INST -1 "a!1" "2*a!1")
      (("" (REWRITE "sin_2a")
        (("" (ASSERT)
          (("" (REPLACE -1)
            (("" (HIDE -1)
              (("" (EXPAND "expt")
                (("" (EXPAND "expt")
                  (("" (EXPAND "expt")
                    (("" (EXPAND "expt")
                      (("" (LEMMA "cos2")
                        (("" (INST?)
                          (("" (EXPAND "sq")
                            (("" (REPLACE -1)
                              (("" (REWRITE "cos_2a") (("" (ASSERT) NIL NIL))
                                NIL))
                              NIL))
                            NIL))
                          NIL))
                        NIL))
                      NIL))
                    NIL))
                  NIL))
                NIL))
              NIL))
            NIL))
          NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|sin_eq_sin| "" (SKOSIMP*)
  (("" (PROP)
    (("1" (CASE "sin(a!1) - sin(b!1) = 0")
      (("1" (HIDE -2)
        (("1" (REWRITE "sin_diff")
          (("1" (REWRITE "zero_times3")
            (("1" (REWRITE "zero_times3")
              (("1" (PROP)
                (("1" (REWRITE "cos_eq_0")
                  (("1" (SKOSIMP*)
                    (("1" (INST + "i!1")
                      (("1" (ASSERT)
                        (("1" (FLATTEN) (("1" (GROUND) NIL NIL)) NIL)) NIL))
                      NIL))
                    NIL))
                  NIL)
                 ("2" (REWRITE "sin_eq_0")
                  (("2" (SKOSIMP*)
                    (("2" (LEMMA "both_sides_times1")
                      (("2" (INST -1 "2" "(a!1 - b!1) / 2" "i!1 * PI")
                        (("2" (REPLACE -1 -2 RL T)
                          (("2" (REWRITE "div_cancel2" -1)
                            (("2" (INST + "i!1")
                              (("2" (FLATTEN) (("2" (ASSERT) NIL NIL)) NIL))
                              NIL))
                            NIL))
                          NIL))
                        NIL))
                      NIL))
                    NIL))
                  NIL))
                NIL))
              NIL))
            NIL))
          NIL))
        NIL)
       ("2" (ASSERT) NIL NIL))
      NIL)
     ("2" (SKOSIMP*)
      (("2" (PROP)
        (("1" (REPLACE -1)
          (("1" (HIDE -1)
            (("1" (REWRITE "sin_plus")
              (("1" (ASSERT)
                (("1" (LEMMA "sin_k_PI")
                  (("1" (INST -1 "2*k!1")
                    (("1" (REPLACE -1)
                      (("1" (HIDE -1)
                        (("1" (LEMMA "cos_2k_PI")
                          (("1" (INST -1 "k!1")
                            (("1" (REPLACE -1) (("1" (ASSERT) NIL NIL)) NIL))
                            NIL))
                          NIL))
                        NIL))
                      NIL))
                    NIL))
                  NIL))
                NIL))
              NIL))
            NIL))
          NIL)
         ("2" (REPLACE -1)
          (("2" (HIDE -1)
            (("2" (LEMMA "sin_minus")
              (("2" (INST -1 "PI + 2*k!1*PI" "b!1")
                (("2" (REPLACE -1)
                  (("2" (HIDE -1)
                    (("2" (LEMMA "sin_k_PI")
                      (("2" (INST -1 "2*k!1+1")
                        (("2" (ASSERT)
                          (("2" (REPLACE -1)
                            (("2" (HIDE -1)
                              (("2" (ASSERT)
                                (("2" (REWRITE "cos_plus")
                                  (("2" (ASSERT)
                                    (("2" (LEMMA "cos_2k_PI")
                                      (("2"
                                        (INST -1 "k!1")
                                        (("2"
                                          (REPLACE -1)
                                          (("2"
                                            (HIDE -1)
                                            (("2"
                                              (LEMMA "sin_k_PI")
                                              (("2"
                                                (INST -1 "2*k!1")
                                                (("2"
                                                  (REPLACE -1)
                                                  (("2"
                                                    (ASSERT)
                                                    (("2"
                                                      (REWRITE "cos_PI")
                                                      (("2" (ASSERT) NIL NIL))
                                                      NIL))
                                                    NIL))
                                                  NIL))
                                                NIL))
                                              NIL))
                                            NIL))
                                          NIL))
                                        NIL))
                                      NIL))
                                    NIL))
                                  NIL))
                                NIL))
                              NIL))
                            NIL))
                          NIL))
                        NIL))
                      NIL))
                    NIL))
                  NIL))
                NIL))
              NIL))
            NIL))
          NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|cos_eq_cos| "" (SKOSIMP*)
  (("" (PROP)
    (("1" (CASE-REPLACE "cos(a!1)-cos(b!1) = 0")
      (("1" (HIDE -2)
        (("1" (REWRITE "cos_diff")
          (("1" (REWRITE "zero_times3")
            (("1" (REWRITE "zero_times3")
              (("1" (PROP)
                (("1" (REWRITE "sin_eq_0")
                  (("1" (SKOSIMP*)
                    (("1" (INST + "i!1") (("1" (GROUND) NIL NIL)) NIL)) NIL))
                  NIL)
                 ("2" (REWRITE "sin_eq_0")
                  (("2" (SKOSIMP*)
                    (("2" (INST + "i!1")
                      (("2" (FLATTEN) (("2" (GROUND) NIL NIL)) NIL)) NIL))
                    NIL))
                  NIL))
                NIL))
              NIL))
            NIL))
          NIL))
        NIL)
       ("2" (ASSERT) NIL NIL))
      NIL)
     ("2" (SKOSIMP*)
      (("2" (PROP)
        (("1" (REPLACE -1)
          (("1" (HIDE -1)
            (("1" (REWRITE "cos_plus")
              (("1" (LEMMA "cos_2k_PI")
                (("1" (INST -1 "k!1")
                  (("1" (REPLACE -1)
                    (("1" (HIDE -1)
                      (("1" (LEMMA "sin_k_PI")
                        (("1" (INST -1 "2*k!1")
                          (("1" (REPLACE -1)
                            (("1" (HIDE -1) (("1" (ASSERT) NIL NIL)) NIL))
                            NIL))
                          NIL))
                        NIL))
                      NIL))
                    NIL))
                  NIL))
                NIL))
              NIL))
            NIL))
          NIL)
         ("2" (REPLACE -1)
          (("2" (HIDE -1)
            (("2" (REWRITE "cos_plus")
              (("2" (LEMMA "sin_k_PI")
                (("2" (INST -1 "2*k!1")
                  (("2" (REPLACE -1)
                    (("2" (ASSERT)
                      (("2" (HIDE -1)
                        (("2" (LEMMA "cos_2k_PI")
                          (("2" (INST -1 "k!1")
                            (("2" (REPLACE -1)
                              (("2" (ASSERT)
                                (("2" (HIDE -1)
                                  (("2" (REWRITE "cos_neg") NIL NIL)) NIL))
                                NIL))
                              NIL))
                            NIL))
                          NIL))
                        NIL))
                      NIL))
                    NIL))
                  NIL))
                NIL))
              NIL))
            NIL))
          NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|tan_eq_tan| "" (SKOSIMP*)
  (("" (PROP)
    (("1" (CASE-REPLACE "tan(a!1) - tan(b!1) = 0")
      (("1" (HIDE -2)
        (("1" (REWRITE "tan_diff")
          (("1" (REWRITE "div_eq_zero")
            (("1" (REWRITE "sin_eq_0")
              (("1" (SKOSIMP*)
                (("1" (INST + "i!1") (("1" (ASSERT) NIL NIL)) NIL)) NIL))
              NIL)
             ("2" (HIDE -1 2)
              (("2" (EXPAND "Tan?")
                (("2" (LEMMA "zero_times3")
                  (("2" (INST?) (("2" (ASSERT) NIL NIL)) NIL)) NIL))
                NIL))
              NIL))
            NIL))
          NIL))
        NIL)
       ("2" (ASSERT) NIL NIL))
      NIL)
     ("2" (SKOSIMP*)
      (("2" (REPLACE -1)
        (("2" (HIDE -1)
          (("2" (EXPAND "tan")
            (("2" (EXPAND "Tan?")
              (("2" (REWRITE "sin_plus")
                (("2" (REWRITE "cos_plus")
                  (("2" (REWRITE "sin_k_PI") (("2" (ASSERT) NIL NIL)) NIL))
                  NIL))
                NIL))
              NIL))
            NIL))
          NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|sin_eq_pm1| "" (SKOSIMP*)
  (("" (GROUND)
    (("1" (LEMMA "sin_k_PI2")
      (("1" (INST -1 "i!1")
        (("1" (REPLACE -1 * RL)
          (("1" (HIDE -1)
            (("1" (REWRITE "sin_eq_sin")
              (("1" (SKOSIMP*)
                (("1" (PROP)
                  (("1" (INST + "k!1") (("1" (ASSERT) NIL NIL)) NIL)
                   ("2" (INST + "k!1-i!1") (("2" (ASSERT) NIL NIL)) NIL))
                  NIL))
                NIL))
              NIL))
            NIL))
          NIL))
        NIL))
      NIL)
     ("2" (SKOSIMP*)
      (("2" (LEMMA "sin_k_PI2")
        (("2" (INST -1 "2*j!1+i!1")
          (("2" (REPLACE -2 * RL)
            (("2" (HIDE -2)
              (("2" (REPLACE -1)
                (("2" (HIDE -1)
                  (("2" (LEMMA "expt_plus")
                    (("2" (INST -1 "2*j!1" "i!1" "-1")
                      (("2" (REPLACE -1)
                        (("2" (HIDE -1)
                          (("2" (CASE "(-1) ^ (2 * j!1) = 1")
                            (("1" (ASSERT) NIL NIL)
                             ("2" (HIDE 2)
                              (("2" (REWRITE "even_m1_pow") NIL NIL)) NIL))
                            NIL))
                          NIL))
                        NIL))
                      NIL))
                    NIL))
                  NIL))
                NIL))
              NIL))
            NIL))
          NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|cos_eq_pm1| "" (SKOSIMP*)
  (("" (GROUND)
    (("1" (LEMMA "cos_k_PI")
      (("1" (INST -1 "i!1")
        (("1" (REPLACE -1 * RL)
          (("1" (HIDE -1)
            (("1" (REWRITE "cos_eq_cos")
              (("1" (SKOSIMP*)
                (("1" (PROP)
                  (("1" (INST + "k!1") (("1" (ASSERT) NIL NIL)) NIL)
                   ("2" (INST + "k!1-i!1") (("2" (ASSERT) NIL NIL)) NIL))
                  NIL))
                NIL))
              NIL))
            NIL))
          NIL))
        NIL))
      NIL)
     ("2" (SKOSIMP*)
      (("2" (LEMMA "cos_k_PI")
        (("2" (INST -1 "2*j!1+i!1")
          (("2" (REPLACE -2 * RL)
            (("2" (HIDE -2)
              (("2" (REPLACE -1)
                (("2" (HIDE -1)
                  (("2" (LEMMA "expt_plus")
                    (("2" (INST -1 "2*j!1" "i!1" "-1")
                      (("2" (REPLACE -1)
                        (("2" (HIDE -1)
                          (("2" (CASE "(-1) ^ (2 * j!1) = 1")
                            (("1" (ASSERT) NIL NIL)
                             ("2" (HIDE 2)
                              (("2" (REWRITE "even_m1_pow") NIL NIL)) NIL))
                            NIL))
                          NIL))
                        NIL))
                      NIL))
                    NIL))
                  NIL))
                NIL))
              NIL))
            NIL))
          NIL))
        NIL))
      NIL))
    NIL))
  NIL))


$$$prelude_aux.pvs
prelude_aux: THEORY
BEGIN

   x: VAR real
   y: VAR nonzero_real
   n: VAR nat
   i: VAR int

   even_plus1      : LEMMA even?(n) IFF NOT even?(n+1)

   even_plus       : LEMMA even?(i) IFF NOT even?(i+1)

   even_int        : LEMMA even?(n) IMPLIES integer_pred((n / 2))

   not_even_int    : LEMMA NOT even?(n) IMPLIES integer_pred(((n - 1) / 2))

   even_m1_pow     : LEMMA even?(i) IMPLIES (-1)^i = 1

   not_even_m1_pow : LEMMA NOT even?(i) IMPLIES (-1)^i = -1

END prelude_aux



$$$prelude_aux.prf
(|prelude_aux|
 (|even_plus1| "" (INDUCT "n")
  (("1" (EXPAND "even?") (("1" (PROPAX) NIL NIL)) NIL)
   ("2" (EXPAND "even?") (("2" (PROPAX) NIL NIL)) NIL)
   ("3" (SKOSIMP*)
    (("3" (GROUND)
      (("1" (HIDE 2 3)
        (("1" (EXPAND "even?")
          (("1" (SKOSIMP*)
            (("1" (REPLACE -1)
              (("1" (HIDE -1)
                (("1" (INST + "j!2+1") (("1" (ASSERT) NIL NIL)) NIL)) NIL))
              NIL))
            NIL))
          NIL))
        NIL)
       ("2" (HIDE -1 -3)
        (("2" (EXPAND "even?")
          (("2" (SKOSIMP*)
            (("2" (INST + "j!2-1") (("2" (ASSERT) NIL NIL)) NIL)) NIL))
          NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|even_plus| "" (SKOSIMP*)
  (("" (LEMMA "even_plus1")
    (("" (INST?)
      (("" (LEMMA "even_plus1")
        (("" (INST -1 "-i!1")
          (("1" (GROUND)
            (("1" (EXPAND "even?")
              (("1" (SKOSIMP*)
                (("1" (REPLACE -1)
                  (("1" (LEMMA "both_sides_div1")
                    (("1" (INST -1 "2" "1 + 2 * j!1" "2 * j!2")
                      (("1" (REPLACE -1 -3 RL T) (("1" (ASSERT) NIL NIL))
                        NIL))
                      NIL))
                    NIL))
                  NIL))
                NIL))
              NIL)
             ("2" (EXPAND "even?")
              (("2" (SKOSIMP*)
                (("2" (INST 2 "-j!1") (("2" (ASSERT) NIL NIL)) NIL)) NIL))
              NIL)
             ("3" (EXPAND "even?")
              (("3" (SKOSIMP*)
                (("3" (INST + "-j!1") (("3" (ASSERT) NIL NIL)) NIL)) NIL))
              NIL)
             ("4" (EXPAND "even?")
              (("4" (SKOSIMP*)
                (("4" (INST 1 "-j!1+1") (("4" (ASSERT) NIL NIL)) NIL)) NIL))
              NIL))
            NIL)
           ("2" (ASSERT) NIL NIL))
          NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|even_int| "" (SKOSIMP*)
  (("" (EXPAND "even?") (("" (SKOSIMP*) (("" (ASSERT) NIL NIL)) NIL)) NIL))
  NIL)
 (|not_even_int| "" (SKOSIMP*)
  (("" (LEMMA "even_plus1")
    (("" (INST -1 "n!1-1")
      (("1" (ASSERT)
        (("1" (HIDE 1) (("1" (EXPAND "even?") (("1" (PROPAX) NIL NIL)) NIL))
          NIL))
        NIL)
       ("2" (ASSERT) NIL NIL))
      NIL))
    NIL))
  NIL)
 (|even_m1_pow| "" (CASE "FORALL (n: nat): even?(n) IMPLIES (-1) ^ n = 1")
  (("1" (SKOSIMP*)
    (("1" (CASE-REPLACE "i!1 >= 0")
      (("1" (INST?) (("1" (ASSERT) NIL NIL)) NIL)
       ("2" (INST -1 "-i!1")
        (("1" (SPLIT -1)
          (("1" (GRIND) NIL NIL)
           ("2" (HIDE 2 3)
            (("2" (EXPAND "even?")
              (("2" (SKOSIMP*)
                (("2" (INST 1 "-j!1") (("2" (ASSERT) NIL NIL)) NIL)) NIL))
              NIL))
            NIL))
          NIL)
         ("2" (ASSERT) NIL NIL))
        NIL))
      NIL))
    NIL)
   ("2" (HIDE 2)
    (("2" (INDUCT "n" 1 "NAT_induction")
      (("2" (SKOSIMP*)
        (("2" (INST -1 "j!1-2")
          (("1" (ASSERT)
            (("1" (LEMMA "expt_plus")
              (("1" (INST -1 "j!1-2" "2" "-1")
                (("1" (ASSERT)
                  (("1" (REPLACE -1)
                    (("1" (HIDE -1)
                      (("1" (SPLIT -1)
                        (("1" (REPLACE -1)
                          (("1" (HIDE -1) (("1" (GRIND) NIL NIL)) NIL)) NIL)
                         ("2" (HIDE 2)
                          (("2" (EXPAND "even?")
                            (("2" (SKOSIMP*)
                              (("2" (REPLACE -1)
                                (("2" (HIDE -1)
                                  (("2" (INST + "j!2-1")
                                    (("2" (ASSERT) NIL NIL)) NIL))
                                  NIL))
                                NIL))
                              NIL))
                            NIL))
                          NIL))
                        NIL))
                      NIL))
                    NIL))
                  NIL))
                NIL))
              NIL))
            NIL)
           ("2" (CASE-REPLACE "j!1 = 0 OR j!1 = 1")
            (("1" (HIDE 1) (("1" (GRIND) NIL NIL)) NIL)
             ("2" (HIDE -1 3) (("2" (GRIND) NIL NIL)) NIL))
            NIL))
          NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|not_even_m1_pow| ""
  (CASE "FORALL (n: nat): NOT even?(n) IMPLIES (-1) ^ n = -1")
  (("1" (SKOSIMP*)
    (("1" (CASE-REPLACE "i!1 >= 0")
      (("1" (INST?) (("1" (ASSERT) NIL NIL)) NIL)
       ("2" (INST -1 "-i!1")
        (("1" (SPLIT -1)
          (("1" (GRIND) NIL NIL)
           ("2" (HIDE 1 3)
            (("2" (EXPAND "even?")
              (("2" (SKOSIMP*)
                (("2" (INST 1 "-j!1") (("2" (ASSERT) NIL NIL)) NIL)) NIL))
              NIL))
            NIL))
          NIL)
         ("2" (ASSERT) NIL NIL))
        NIL))
      NIL))
    NIL)
   ("2" (HIDE 2)
    (("2" (INDUCT "n" 1 "NAT_induction")
      (("2" (SKOSIMP*)
        (("2" (INST -1 "j!1-2")
          (("1" (ASSERT)
            (("1" (LEMMA "expt_plus")
              (("1" (INST -1 "j!1-2" "2" "-1")
                (("1" (ASSERT)
                  (("1" (REPLACE -1)
                    (("1" (HIDE -1)
                      (("1" (SPLIT -1)
                        (("1" (REPLACE -1)
                          (("1" (HIDE -1 1) (("1" (GRIND) NIL NIL)) NIL)) NIL)
                         ("2" (HIDE 2)
                          (("2" (EXPAND "even?")
                            (("2" (SKOSIMP*)
                              (("2" (INST + "j!2+1") (("2" (ASSERT) NIL NIL))
                                NIL))
                              NIL))
                            NIL))
                          NIL))
                        NIL))
                      NIL))
                    NIL))
                  NIL))
                NIL))
              NIL))
            NIL)
           ("2" (CASE-REPLACE "j!1 = 0 OR j!1 = 1")
            (("1" (HIDE 1) (("1" (GRIND) NIL NIL)) NIL)
             ("2" (HIDE 3 4) (("2" (GRIND) NIL NIL)) NIL))
            NIL))
          NIL))
        NIL))
      NIL))
    NIL))
  NIL))


$$$trig_basic.pvs
trig_basic : THEORY
%-----------------------------------------------------------------------------
%     trig_basic:
%     -----------
%         - definition of PI with crude upper and lower bounds
%         - definition of sin, cos, and tan
%         - pythagorean properties: sq(sin(a)) + sq(cos(a)) = 1 
%         - sum and difference of two angles
%         - double angle formulas
%         - negative properties, e.g. sin(-a)
%         - periodicity, e.g. sin(a) = sin(a + 2 * j * PI) 
%         - co-function identities, e.g. sin(PI/2 - a) = cos(a)
%         - location of zeros of trig functions
%-----------------------------------------------------------------------------
BEGIN

%  reals: LIBRARY = "../reals"
  IMPORTING sqrt

  a,b,c,d           : VAR real
  nnc               : VAR nonneg_real 
  j                 : VAR integer

  
  PI_lb  : real = 314/100
 
  PI_ub  : real = 315/100

  PI     : {r:posreal | r >= PI_lb AND r <= PI_ub}

% -------------------- definition of sin and cos --------------------

  trig_range  : TYPE = {a | -1 <= a AND a <= 1}

  sin,cos     : [real -> real]

  sin_range_ax: AXIOM -1 <= sin(a) AND sin(a) <= 1
  cos_range_ax: AXIOM -1 <= cos(a) AND cos(a) <= 1

  sin_range   : JUDGEMENT sin(a) HAS_TYPE trig_range
  cos_range   : JUDGEMENT cos(a) HAS_TYPE trig_range

  Tan?(a)        : bool = cos(a) /= 0
 
  tan(a:(Tan?))  : real = sin(a)/cos(a)

% -------------------- Pythagorean Property --------------------
 
  sin2_cos2    : AXIOM sq(sin(a)) + sq(cos(a)) = 1

  cos2         : LEMMA sq(cos(a)) = 1 - sq(sin(a)) 

  sin2         : LEMMA sq(sin(a)) = 1 - sq(cos(a)) 

  arc_sin_cos  : AXIOM sq(a)+sq(b)=sq(c) IMPLIES
                            EXISTS d: a = c*cos(d) AND b = c*sin(d)

  pythagorean  : LEMMA sq(a)+sq(b)=sq(nnc) IMPLIES
                            EXISTS(alpha:real): nnc=a*cos(alpha)+b*sin(alpha)


% --------------------- Basic Values ----------------------------

  cos_0         : AXIOM cos(0) = 1 

  sin_0         : LEMMA sin(0) = 0

  sin_PI2       : AXIOM sin(PI/2) = 1

  cos_PI2       : LEMMA cos(PI/2) = 0

  tan_0         : LEMMA tan(0)=0

% ----------------- Sum and Difference of Two Angles ----------------

  sin_plus  : AXIOM sin(a + b) = sin(a)*cos(b) + cos(a)*sin(b)   
  sin_minus : AXIOM sin(a - b) = sin(a)*cos(b) - sin(b)*cos(a)

  cos_plus  : AXIOM cos(a + b) = cos(a)*cos(b) - sin(a)*sin(b)
  cos_minus : AXIOM cos(a - b) = cos(a)*cos(b) + sin(a)*sin(b)

  tan_plus  : AXIOM Tan?(a) AND Tan?(b) AND Tan?(a+b) AND
                    tan(a) * tan(b) /= 1 IMPLIES                 
                      tan(a + b) = (tan(a) + tan(b))/(1 - tan(a)*tan(b)) 

  tan_minus : AXIOM Tan?(a) AND Tan?(b) AND Tan?(a-b) AND
                    tan(a) * tan(b) /= -1 IMPLIES                 
                      tan(a - b) = (tan(a) - tan(b))/(1 + tan(a)*tan(b))


% -------------------- Double Angle Formulas -------------------- 

   sin_2a     : LEMMA sin(2*a) = 2 * sin(a) * cos(a)
   cos_2a     : LEMMA cos(2*a) = cos(a)*cos(a) - sin(a)*sin(a)
   cos_2a_cos : LEMMA cos(2*a) = 2 * cos(a)*cos(a) - 1
   cos_2a_sin : LEMMA cos(2*a) = 1 - 2 * sin(a)*sin(a)
   tan_2a     : LEMMA Tan?(a) AND Tan?(2*a) AND 
                      tan(a) * tan(a) /= 1 IMPLIES 
                        tan(2*a) = 2 * tan(a)/(1 - tan(a) * tan(a))
 
% --------------------- Negative Properties ----------------------

  sin_neg : LEMMA sin(-a) = -sin(a) 
  cos_neg : LEMMA cos(-a) = cos(a) 
  tan_neg : LEMMA FORALL(a:(Tan?)): tan(-a) = -tan(a)

% --------------------- Arguments involving PI ---------------------

  sin_PI      : LEMMA sin(PI) = 0
  cos_PI      : LEMMA cos(PI) = -1
  tan_PI      : LEMMA tan(PI) = 0
  sin_3PI2    : LEMMA sin(3*PI/2) = -1
  cos_3PI2    : LEMMA cos(3*PI/2) = 0
  sin_2PI     : LEMMA sin(2*PI) = 0
  cos_2PI     : LEMMA cos(2*PI) = 1
  tan_2PI     : LEMMA tan(2*PI) = 0

  neg_cos     : LEMMA -cos(a) = cos(a+PI)
  neg_sin     : LEMMA -sin(a) = sin(a+PI)

% ------------------------- Periodicity -----------------------------

  IMPORTING prelude_aux

  n: VAR nat
  k: VAR integer

  sin_period  : LEMMA sin(a) = sin(a + 2 * j * PI) 
  cos_period  : LEMMA cos(a) = cos(a + 2 * j * PI) 
  tan_period  : LEMMA Tan?(a) IMPLIES tan(a) = tan(a + j * PI) 

  sin_k_PI    : LEMMA sin(k*PI) = 0
  cos_2k_PI   : LEMMA cos(2*k*PI) = 1
  cos_k_PI    : LEMMA cos(k*PI) = (-1)^(k)
  sin_k_PI2   : LEMMA sin(k*PI + PI/2) = (-1)^k 
  tan_k_PI    : LEMMA tan(k*PI) = 0


% -------------------- Co-Function Identities -----------------------

  sin_shift  : LEMMA sin(PI/2 - a) = cos(a)
  cos_shift  : LEMMA cos(PI/2 - a) = sin(a)
  cos_sin    : LEMMA cos(a) = sin(a+PI/2)
  sin_cos    : LEMMA sin(a) = -cos(a+PI/2)

% -------------------- Characterization of zeroes -------------------


  sin_eq_0     : AXIOM sin(a) = 0 IFF EXISTS (i: int): a = i * PI
                 % LEMMA: See trig_scaffold for proof

  cos_eq_0     : LEMMA cos(a) = 0 IFF EXISTS (i: int): a = i * PI + PI/2

  sin_eq_0_2PI : COROLLARY 0 <= a AND a <= 2*PI IMPLIES
                    (sin(a)=0 IFF a=0 OR a=PI OR a=2*PI)

  cos_eq_0_2PI : COROLLARY 0 <= a AND a <= 2*PI IMPLIES
                    (cos(a)=0 IFF a=PI/2 OR a=3*PI/2)


% ---------------------- Maximum Points -----------------------------
 
  sin_eq_1     : LEMMA sin(a) = 1 IFF EXISTS (i: int): a = 2 * i * PI + PI/2
  cos_eq_1     : LEMMA cos(a) = 1 IFF EXISTS (i: int): a = 2 * i * PI 

END trig_basic


$$$trig_basic.prf
(|trig_basic| (PI_TCC1 "" (INST 1 "PI_lb") (("" (GRIND) NIL NIL)) NIL)
 (|sin_range| "" (SKOSIMP*) (("" (REWRITE "sin_range_ax") NIL NIL)) NIL)
 (|cos_range| "" (SKOSIMP*) (("" (REWRITE "cos_range_ax") NIL NIL)) NIL)
 (|tan_TCC1| "" (SUBTYPE-TCC) NIL NIL)
 (|cos2| "" (SKOSIMP*)
  (("" (LEMMA "sin2_cos2") (("" (INST?) (("" (ASSERT) NIL NIL)) NIL)) NIL))
  NIL)
 (|sin2| "" (SKOSIMP*)
  (("" (LEMMA "sin2_cos2") (("" (INST?) (("" (ASSERT) NIL NIL)) NIL)) NIL))
  NIL)
 (|pythagorean| "" (SKOLEM 1 ("A" "B" "C"))
  (("" (GROUND)
    (("" (LEMMA "arc_sin_cos")
      (("" (INST -1 "A" "B" "C")
        (("" (GROUND)
          (("" (SKOLEM -1 "alpha")
            (("" (FLATTEN)
              (("" (INST 1 "alpha")
                (("" (REPLACE -1 :HIDE? T)
                  (("" (REPLACE -1 :HIDE? T)
                    (("" (LEMMA "sin2_cos2")
                      (("" (INST -1 "alpha")
                        ((""
                          (CASE "C * cos(alpha) * cos(alpha) + C * sin(alpha) * sin(alpha)=             C * (sq(sin(alpha))+sq(cos(alpha)))")
                          (("1" (REPLACE -1 :HIDE? T)
                            (("1" (REPLACE -1 :HIDE? T)
                              (("1" (GROUND) NIL NIL)) NIL))
                            NIL)
                           ("2" (HIDE -1 -2 2)
                            (("2" (EXPAND "sq") (("2" (PROPAX) NIL NIL)) NIL))
                            NIL))
                          NIL))
                        NIL))
                      NIL))
                    NIL))
                  NIL))
                NIL))
              NIL))
            NIL))
          NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|sin_0| "" (LEMMA "sin2_cos2")
  (("" (INST?)
    (("" (REWRITE "cos_0")
      (("" (EXPAND "sq")
        (("" (REWRITE "zero_times3") (("" (GROUND) NIL NIL)) NIL)) NIL))
      NIL))
    NIL))
  NIL)
 (|cos_PI2| "" (LEMMA "sin2_cos2")
  (("" (INST?)
    (("" (REWRITE "sin_PI2")
      (("" (EXPAND "sq")
        (("" (REWRITE "zero_times3") (("" (GROUND) NIL NIL)) NIL)) NIL))
      NIL))
    NIL))
  NIL)
 (|tan_0_TCC1| "" (EXPAND "Tan?")
  (("" (REWRITE "cos_0") (("" (GROUND) NIL NIL)) NIL)) NIL)
 (|tan_0| "" (EXPAND "tan")
  (("" (REWRITE "cos_0") (("" (REWRITE "sin_0") NIL NIL)) NIL)) NIL)
 (|tan_plus_TCC1| "" (SUBTYPE-TCC) NIL NIL)
 (|tan_minus_TCC1| "" (SUBTYPE-TCC) NIL NIL)
 (|sin_2a| "" (SKOSIMP*)
  (("" (LEMMA "sin_plus")
    (("" (INST -1 "a!1" "a!1") (("" (ASSERT) NIL NIL)) NIL)) NIL))
  NIL)
 (|cos_2a| "" (SKOSIMP*)
  (("" (LEMMA "cos_plus")
    (("" (INST -1 "a!1" "a!1") (("" (ASSERT) NIL NIL)) NIL)) NIL))
  NIL)
 (|cos_2a_cos| "" (SKOSIMP*)
  (("" (LEMMA "cos_2a")
    (("" (INST?)
      (("" (LEMMA "sin2_cos2")
        (("" (INST?) (("" (EXPAND "sq") (("" (ASSERT) NIL NIL)) NIL)) NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|cos_2a_sin| "" (SKOSIMP*)
  (("" (LEMMA "cos_2a")
    (("" (INST?)
      (("" (LEMMA "sin2_cos2")
        (("" (INST?) (("" (EXPAND "sq") (("" (ASSERT) NIL NIL)) NIL)) NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|tan_2a_TCC1| "" (SUBTYPE-TCC) NIL NIL)
 (|tan_2a| "" (SKOSIMP*)
  (("" (EXPAND "tan" 2)
    (("" (REWRITE "sin_2a")
      (("" (REWRITE "cos_2a")
        (("" (CASE-REPLACE "cos(a!1) * cos(a!1) - sin(a!1) * sin(a!1) = 0")
          (("1" (HIDE 2)
            (("1" (EXPAND "tan")
              (("1" (EXPAND "Tan?")
                (("1" (LEMMA "both_sides_times1")
                  (("1"
                    (INST -1 "1/(cos(a!1) * cos(a!1))"
                     "cos(a!1) * cos(a!1) - sin(a!1) * sin(a!1)" "0")
                    (("1" (FLATTEN)
                      (("1" (HIDE -1)
                        (("1" (SPLIT -1)
                          (("1" (ASSERT) NIL NIL) ("2" (PROPAX) NIL NIL))
                          NIL))
                        NIL))
                      NIL)
                     ("2" (LEMMA "zero_times3")
                      (("2" (INST?) (("2" (ASSERT) NIL NIL)) NIL)) NIL))
                    NIL))
                  NIL))
                NIL))
              NIL))
            NIL)
           ("2"
            (CASE-REPLACE
             "2 * (cos(a!1) * sin(a!1)) / (cos(a!1) * cos(a!1) - sin(a!1) * sin(a!1)) =
        (2 * (cos(a!1) * sin(a!1))/ (cos(a!1)*cos(a!1))) / ((cos(a!1) * cos(a!1) - sin(a!1) * sin(a!1))/(cos(a!1)*cos(a!1)))")
            (("1" (ASSERT) NIL NIL)
             ("2" (HIDE 4)
              (("2" (ASSERT)
                (("2" (NAME-REPLACE "CC" "(cos(a!1) * cos(a!1))")
                  (("2" (NAME-REPLACE "CS2" "2 * (cos(a!1) * sin(a!1))")
                    (("2" (NAME-REPLACE "DD" "(CC - sin(a!1) * sin(a!1))")
                      (("2" (ASSERT) NIL NIL)) NIL))
                    NIL))
                  NIL))
                NIL))
              NIL)
             ("3" (HIDE 4)
              (("3" (LEMMA "div_eq_zero")
                (("3" (INST?)
                  (("1" (ASSERT) NIL NIL)
                   ("2" (EXPAND "Tan?")
                    (("2" (LEMMA "zero_times3")
                      (("2" (INST?) (("2" (ASSERT) NIL NIL)) NIL)) NIL))
                    NIL))
                  NIL))
                NIL))
              NIL)
             ("4" (EXPAND "Tan?")
              (("4" (LEMMA "zero_times3")
                (("4" (INST?) (("4" (ASSERT) NIL NIL)) NIL)) NIL))
              NIL)
             ("5" (ASSERT) NIL NIL))
            NIL))
          NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|sin_neg| "" (SKOLEM 1 "a")
  (("" (LEMMA "sin_minus")
    (("" (INST -1 "0" "a")
      (("" (GROUND)
        (("" (REWRITE "sin_0")
          (("" (REWRITE "cos_0") (("" (GROUND) NIL NIL)) NIL)) NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|cos_neg| "" (SKOLEM 1 "a")
  (("" (LEMMA "cos_minus")
    (("" (INST -1 "0" "a")
      (("" (REWRITE "cos_0")
        (("" (REWRITE "sin_0") (("" (GROUND) NIL NIL)) NIL)) NIL))
      NIL))
    NIL))
  NIL)
 (|tan_neg_TCC1| "" (SKOLEM 1 "A")
  (("" (TYPEPRED "A")
    (("" (EXPAND "Tan?") (("" (REWRITE "cos_neg") NIL NIL)) NIL)) NIL))
  NIL)
 (|tan_neg| "" (SKOLEM 1 "A")
  (("" (EXPAND "tan")
    (("" (REWRITE "sin_neg")
      (("" (REWRITE "cos_neg") (("" (GROUND) NIL NIL)) NIL)) NIL))
    NIL))
  NIL)
 (|sin_PI| "" (CASE "PI=PI/2 + PI/2")
  (("1" (REPLACE -1 :HIDE? T)
    (("1" (LEMMA "sin_minus")
      (("1" (INST -1 "PI/2" "-PI/2")
        (("1" (CASE "PI / 2 - -PI / 2 = PI / 2 + PI / 2")
          (("1" (REPLACE -1 :HIDE? T)
            (("1" (REPLACE -1 :HIDE? T)
              (("1" (CASE "(PI / 2 + PI / 2) / 2 = PI/2")
                (("1" (REPLACE -1 :HIDE? T)
                  (("1" (CASE "-(PI / 2 + PI / 2)/2 = -(PI/2)")
                    (("1" (REPLACE -1 :HIDE? T)
                      (("1" (REWRITE "sin_neg")
                        (("1" (REWRITE "cos_neg")
                          (("1" (REWRITE "sin_PI2")
                            (("1" (REWRITE "cos_PI2") (("1" (GROUND) NIL NIL))
                              NIL))
                            NIL))
                          NIL))
                        NIL))
                      NIL)
                     ("2" (GROUND) NIL NIL))
                    NIL))
                  NIL)
                 ("2" (GROUND) NIL NIL))
                NIL))
              NIL))
            NIL)
           ("2" (GROUND) NIL NIL))
          NIL))
        NIL))
      NIL))
    NIL)
   ("2" (GROUND) NIL NIL))
  NIL)
 (|cos_PI| "" (CASE "PI=PI/2 + PI/2")
  (("1" (REPLACE -1 :HIDE? T)
    (("1" (LEMMA "cos_minus")
      (("1" (INST -1 "PI/2" "-PI/2")
        (("1" (CASE "PI / 2 - -PI / 2 = PI / 2 + PI / 2")
          (("1" (REPLACE -1 :HIDE? T)
            (("1" (REPLACE -1 :HIDE? T)
              (("1" (CASE "-(PI / 2 + PI / 2)/2 = -(PI/2)")
                (("1" (REPLACE -1 :HIDE? T)
                  (("1" (CASE "(PI / 2 + PI / 2) = PI")
                    (("1" (REPLACE -1 :HIDE? T)
                      (("1" (REWRITE "cos_neg")
                        (("1" (REWRITE "sin_neg")
                          (("1" (REWRITE "cos_PI2")
                            (("1" (REWRITE "sin_PI2") (("1" (GROUND) NIL NIL))
                              NIL))
                            NIL))
                          NIL))
                        NIL))
                      NIL)
                     ("2" (GROUND) NIL NIL))
                    NIL))
                  NIL)
                 ("2" (GROUND) NIL NIL))
                NIL))
              NIL))
            NIL)
           ("2" (GROUND) NIL NIL))
          NIL))
        NIL))
      NIL))
    NIL)
   ("2" (GROUND) NIL NIL))
  NIL)
 (|tan_PI_TCC1| "" (EXPAND "Tan?")
  (("" (REWRITE "cos_PI") (("" (ASSERT) NIL NIL)) NIL)) NIL)
 (|tan_PI| "" (EXPAND "tan")
  (("" (REWRITE "sin_PI") (("" (ASSERT) NIL NIL)) NIL)) NIL)
 (|sin_3PI2| "" (CASE "3 * PI / 2 = PI + PI/2")
  (("1" (REPLACE -1 :HIDE? T)
    (("1" (LEMMA "sin_minus")
      (("1" (INST -1 "PI" "-(PI/2)")
        (("1" (CASE "PI - -(PI / 2) = PI + PI/2")
          (("1" (REPLACE -1 :HIDE? T)
            (("1" (REWRITE "cos_neg")
              (("1" (REWRITE "sin_neg")
                (("1" (REPLACE -1 :HIDE? T)
                  (("1" (REWRITE "sin_PI")
                    (("1" (REWRITE "sin_PI2")
                      (("1" (GROUND) (("1" (REWRITE "cos_PI") NIL NIL)) NIL))
                      NIL))
                    NIL))
                  NIL))
                NIL))
              NIL))
            NIL)
           ("2" (GROUND) NIL NIL))
          NIL))
        NIL))
      NIL))
    NIL)
   ("2" (GROUND) NIL NIL))
  NIL)
 (|cos_3PI2| "" (CASE "3 * PI / 2 = PI + PI/2")
  (("1" (REPLACE -1 :HIDE? T)
    (("1" (LEMMA "cos_minus")
      (("1" (INST -1 "PI" "-(PI/2)")
        (("1" (REWRITE "sin_neg")
          (("1" (REWRITE "cos_neg")
            (("1" (CASE "PI - -(PI / 2) = PI + PI/2")
              (("1" (REPLACE -1 :HIDE? T)
                (("1" (REPLACE -1 :HIDE? T)
                  (("1" (REWRITE "cos_PI")
                    (("1" (REWRITE "sin_PI")
                      (("1" (REWRITE "cos_PI2") (("1" (GROUND) NIL NIL)) NIL))
                      NIL))
                    NIL))
                  NIL))
                NIL)
               ("2" (GROUND) NIL NIL))
              NIL))
            NIL))
          NIL))
        NIL))
      NIL))
    NIL)
   ("2" (GROUND) NIL NIL))
  NIL)
 (|sin_2PI| "" (LEMMA "sin_plus")
  (("" (INST -1 "PI" "PI")
    (("" (REWRITE "cos_PI")
      (("" (REWRITE "sin_PI") (("" (GROUND) NIL NIL)) NIL)) NIL))
    NIL))
  NIL)
 (|cos_2PI| "" (LEMMA "cos_plus")
  (("" (INST -1 "PI" "PI")
    (("" (REWRITE "sin_PI")
      (("" (REWRITE "cos_PI") (("" (GROUND) NIL NIL)) NIL)) NIL))
    NIL))
  NIL)
 (|tan_2PI_TCC1| "" (EXPAND "Tan?")
  (("" (REWRITE "cos_2PI") (("" (ASSERT) NIL NIL)) NIL)) NIL)
 (|tan_2PI| "" (EXPAND "tan")
  (("" (REWRITE "sin_2PI") (("" (ASSERT) NIL NIL)) NIL)) NIL)
 (|neg_cos| "" (SKOLEM 1 "a")
  (("" (LEMMA "cos_minus")
    (("" (INST -1 "a" "-PI")
      (("" (CASE "a - -PI = a + PI")
        (("1" (REPLACE -1 :HIDE? T)
          (("1" (REPLACE -1 :HIDE? T)
            (("1" (REWRITE "sin_neg")
              (("1" (REWRITE "cos_neg")
                (("1" (REWRITE "cos_PI")
                  (("1" (REWRITE "sin_PI") (("1" (GROUND) NIL NIL)) NIL))
                  NIL))
                NIL))
              NIL))
            NIL))
          NIL)
         ("2" (GROUND) NIL NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|neg_sin| "" (SKOLEM 1 "a")
  (("" (LEMMA "sin_minus")
    (("" (INST -1 "a" "-PI")
      (("" (CASE "a - -PI = a + PI")
        (("1" (REPLACE -1 :HIDE? T)
          (("1" (REPLACE -1 :HIDE? T)
            (("1" (REWRITE "cos_neg")
              (("1" (REWRITE "sin_neg")
                (("1" (REWRITE "sin_PI")
                  (("1" (REWRITE "cos_PI") (("1" (GROUND) NIL NIL)) NIL))
                  NIL))
                NIL))
              NIL))
            NIL))
          NIL)
         ("2" (GROUND) NIL NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|sin_period| ""
  (CASE-REPLACE "FORALL (a: real, j: nat): sin(a) = sin(a + 2 * j * PI)")
  (("1" (SKOSIMP*)
    (("1" (CASE-REPLACE "j!1 >= 0")
      (("1" (INST?) NIL NIL)
       ("2"
        (CASE-REPLACE
         "sin(a!1 + 2 * j!1 * PI) = - sin(-a!1 + 2 * (-j!1) * PI)")
        (("1" (HIDE -1)
          (("1" (INST -1 "-a!1" "-j!1")
            (("1" (ASSERT)
              (("1" (REPLACE -1 * RL)
                (("1" (HIDE -1)
                  (("1" (REWRITE "sin_neg") (("1" (ASSERT) NIL NIL)) NIL))
                  NIL))
                NIL))
              NIL)
             ("2" (ASSERT) NIL NIL))
            NIL))
          NIL)
         ("2" (HIDE -1 3)
          (("2" (LEMMA "sin_neg")
            (("2" (INST - "-(a!1 + 2 * j!1 * PI)") (("2" (ASSERT) NIL NIL))
              NIL))
            NIL))
          NIL))
        NIL))
      NIL))
    NIL)
   ("2" (HIDE 2)
    (("2" (INDUCT "j" 1)
      (("1" (ASSERT) NIL NIL)
       ("2" (SKOSIMP*)
        (("2"
          (CASE-REPLACE
           "a!1 + (2 * (j!1 + 1)) * PI = a!1 + 2*PI + 2 * j!1 * PI")
          (("1" (HIDE -1)
            (("1" (INST -1 "a!1+2*PI")
              (("1" (REPLACE -1 * RL)
                (("1" (HIDE -1)
                  (("1" (REWRITE "sin_plus")
                    (("1" (REWRITE "sin_2PI")
                      (("1" (REWRITE "cos_2PI") (("1" (ASSERT) NIL NIL)) NIL))
                      NIL))
                    NIL))
                  NIL))
                NIL))
              NIL))
            NIL)
           ("2" (HIDE -1 2) (("2" (ASSERT) NIL NIL)) NIL))
          NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|cos_period| ""
  (CASE-REPLACE "FORALL (a: real, j: nat): cos(a) = cos(a + 2 * j * PI)")
  (("1" (SKOSIMP*)
    (("1" (CASE "j!1 >= 0")
      (("1" (INST?) NIL NIL)
       ("2" (INST -1 "0" "-j!1")
        (("1" (ASSERT)
          (("1" (REWRITE "cos_0")
            (("1" (LEMMA "cos_plus")
              (("1" (INST?)
                (("1" (REPLACE -1)
                  (("1" (HIDE -1)
                    (("1"
                      (CASE-REPLACE
                       "cos(2 * (-j!1 * PI)) = cos(2 * j!1 * PI)")
                      (("1" (HIDE -1)
                        (("1" (REPLACE -1 * RL)
                          (("1" (LEMMA "sin_period")
                            (("1" (INST -1 "0" "j!1")
                              (("1" (REWRITE "sin_0")
                                (("1" (REPLACE -1 * RL)
                                  (("1" (ASSERT) NIL NIL)) NIL))
                                NIL))
                              NIL))
                            NIL))
                          NIL))
                        NIL)
                       ("2" (HIDE -1 2)
                        (("2" (LEMMA "cos_neg")
                          (("2" (INST -1 "2 * j!1 * PI")
                            (("2" (ASSERT) NIL NIL)) NIL))
                          NIL))
                        NIL))
                      NIL))
                    NIL))
                  NIL))
                NIL))
              NIL))
            NIL))
          NIL)
         ("2" (ASSERT) NIL NIL))
        NIL))
      NIL))
    NIL)
   ("2" (HIDE 2)
    (("2" (INDUCT "j" 1)
      (("1" (ASSERT) NIL NIL)
       ("2" (SKOSIMP*)
        (("2" (INST -1 "a!1 + 2*PI")
          (("2"
            (CASE-REPLACE
             "a!1 + (2 * (j!1 + 1)) * PI = a!1 + 2*PI + 2 * j!1 * PI")
            (("1" (HIDE -1)
              (("1" (REPLACE -1 * RL)
                (("1" (HIDE -1)
                  (("1" (REWRITE "cos_plus")
                    (("1" (REWRITE "cos_2PI")
                      (("1" (REWRITE "sin_2PI") (("1" (ASSERT) NIL NIL)) NIL))
                      NIL))
                    NIL))
                  NIL))
                NIL))
              NIL)
             ("2" (ASSERT) NIL NIL))
            NIL))
          NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|tan_period_TCC1| "" (SKOSIMP*)
  (("" (EXPAND "Tan?")
    (("" (LEMMA "cos_period")
      (("" (INST?)
        (("" (CASE "even?(j!1)")
          (("1" (INST - "j!1/2")
            (("1" (ASSERT) NIL NIL)
             ("2" (EXPAND "even?")
              (("2" (SKOSIMP*) (("2" (ASSERT) NIL NIL)) NIL)) NIL))
            NIL)
           ("2" (CASE "even?(j!1-1)")
            (("1" (INST - "(j!1-1)/2")
              (("1" (ASSERT)
                (("1"
                  (CASE-REPLACE
                   "2 * ((j!1-1) / 2 * PI) + a!1 = a!1 + (j!1-1)*PI")
                  (("1" (HIDE -1)
                    (("1" (ASSERT)
                      (("1" (LEMMA "cos_minus")
                        (("1" (INST -1 "PI*j!1+a!1" "PI")
                          (("1" (REWRITE "cos_PI")
                            (("1" (REWRITE "sin_PI") (("1" (ASSERT) NIL NIL))
                              NIL))
                            NIL))
                          NIL))
                        NIL))
                      NIL))
                    NIL)
                   ("2" (ASSERT) NIL NIL))
                  NIL))
                NIL)
               ("2" (EXPAND "even?")
                (("2" (SKOSIMP*) (("2" (ASSERT) NIL NIL)) NIL)) NIL))
              NIL)
             ("2" (REWRITE "even_plus") NIL NIL))
            NIL))
          NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|tan_period| "" (SKOSIMP*)
  (("" (EXPAND "tan")
    (("" (LEMMA "sin_period")
      (("" (LEMMA "cos_period")
        (("" (CASE-REPLACE "even?(j!1)")
          (("1" (INST - "a!1" "j!1/2")
            (("1" (INST - "a!1" "j!1/2")
              (("1" (REPLACE -2 * RL)
                (("1" (HIDE -2)
                  (("1" (REPLACE -2 * RL) (("1" (PROPAX) NIL NIL)) NIL)) NIL))
                NIL)
               ("2" (HIDE -2)
                (("2" (EXPAND "even?")
                  (("2" (SKOSIMP*) (("2" (ASSERT) NIL NIL)) NIL)) NIL))
                NIL))
              NIL)
             ("2" (EXPAND "even?")
              (("2" (SKOSIMP*) (("2" (ASSERT) NIL NIL)) NIL)) NIL))
            NIL)
           ("2" (INST - "a!1" "(j!1+1)/2")
            (("1" (INST - "a!1" "(j!1+1)/2")
              (("1" (ASSERT)
                (("1"
                  (CASE-REPLACE
                   "2 * ((1 + j!1) / 2 * PI) + a!1 = a!1 + (1+j!1)*PI")
                  (("1" (HIDE -1)
                    (("1" (ASSERT)
                      (("1" (LEMMA "cos_plus")
                        (("1" (INST -1 "PI" "PI*j!1+a!1")
                          (("1" (REPLACE -1)
                            (("1" (HIDE -1)
                              (("1" (LEMMA "sin_plus")
                                (("1" (INST -1 "PI" "PI*j!1+a!1")
                                  (("1" (REWRITE "cos_PI")
                                    (("1" (REWRITE "sin_PI")
                                      (("1" (ASSERT) NIL NIL)) NIL))
                                    NIL))
                                  NIL))
                                NIL))
                              NIL))
                            NIL))
                          NIL))
                        NIL))
                      NIL))
                    NIL)
                   ("2" (ASSERT) NIL NIL))
                  NIL))
                NIL)
               ("2" (HIDE -1 -2 3)
                (("2" (CASE "even?(1 + j!1)")
                  (("1" (EXPAND "even?")
                    (("1" (SKOSIMP*) (("1" (ASSERT) NIL NIL)) NIL)) NIL)
                   ("2" (HIDE 2)
                    (("2" (LEMMA "even_plus")
                      (("2" (INST -1 "j!1") (("2" (ASSERT) NIL NIL)) NIL))
                      NIL))
                    NIL))
                  NIL))
                NIL))
              NIL)
             ("2" (HIDE -1 -2 3)
              (("2" (CASE "even?(j!1+1)")
                (("1" (EXPAND "even?")
                  (("1" (SKOSIMP*) (("1" (ASSERT) NIL NIL)) NIL)) NIL)
                 ("2" (HIDE 2)
                  (("2" (LEMMA "even_plus")
                    (("2" (INST -1 "j!1") (("2" (ASSERT) NIL NIL)) NIL)) NIL))
                  NIL))
                NIL))
              NIL))
            NIL))
          NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|sin_k_PI| "" (SKOSIMP*)
  (("" (LEMMA "sin_period")
    (("" (CASE "(EXISTS j: k!1 = 2*j)")
      (("1" (SKOSIMP*)
        (("1" (INST -2 "k!1*PI" "-j!1")
          (("1" (REPLACE -1)
            (("1" (HIDE -1)
              (("1" (ASSERT) (("1" (REWRITE "sin_0") NIL NIL)) NIL)) NIL))
            NIL))
          NIL))
        NIL)
       ("2" (CASE "(EXISTS j: k!1 = 2*j+1)")
        (("1" (HIDE 1)
          (("1" (SKOSIMP*)
            (("1" (REPLACE -1)
              (("1" (HIDE -1)
                (("1" (INST -1 "(2 * j!1 + 1) * PI" "-j!1")
                  (("1" (ASSERT) (("1" (REWRITE "sin_PI") NIL NIL)) NIL))
                  NIL))
                NIL))
              NIL))
            NIL))
          NIL)
         ("2" (HIDE -1 3)
          (("2" (CASE "integer_pred(k!1 / 2)")
            (("1" (INST 2 "k!1/2") (("1" (ASSERT) NIL NIL)) NIL)
             ("2" (INST 2 "floor(k!1/2)") (("2" (ASSERT) NIL NIL)) NIL))
            NIL))
          NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|cos_2k_PI| "" (SKOSIMP*)
  (("" (LEMMA "cos_period")
    (("" (INST?)
      (("" (INST -1 "-k!1")
        (("" (ASSERT)
          (("" (AUTO-REWRITE-THEORY "real_props")
            (("" (ASSERT)
              (("" (CASE-REPLACE "2 * (-k!1 * PI) + 2 * (PI * k!1) = 0")
                (("1" (HIDE -1) (("1" (REWRITE "cos_0") NIL NIL)) NIL)
                 ("2" (ASSERT) NIL NIL))
                NIL))
              NIL))
            NIL))
          NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|cos_k_PI| "" (SKOSIMP*)
  (("" (CASE "(FORALL n: cos(n*PI) = (-1)^(n))")
    (("1" (CASE-REPLACE "k!1 >= 0")
      (("1" (INST?) NIL NIL)
       ("2" (INST -1 "-k!1")
        (("1" (LEMMA "cos_neg")
          (("1" (INST -1 "k!1*PI")
            (("1" (REPLACE -1)
              (("1" (HIDE -1)
                (("1" (REPLACE -1)
                  (("1" (HIDE -1)
                    (("1" (CASE "(FORALL (n: nat): (-1) ^ -n = (-1) ^ n)")
                      (("1" (INST -1 "-k!1")
                        (("1" (ASSERT) NIL NIL) ("2" (ASSERT) NIL NIL)) NIL)
                       ("2" (HIDE 3)
                        (("2" (INDUCT "n")
                          (("1" (GRIND) NIL NIL)
                           ("2" (SKOSIMP*)
                            (("2" (EXPAND "^" 1)
                              (("2" (EXPAND "expt")
                                (("2" (ASSERT)
                                  (("2" (EXPAND "^")
                                    (("2" (GROUND)
                                      (("2"
                                        (LIFT-IF)
                                        (("2"
                                          (GROUND)
                                          (("2" (GRIND) NIL NIL))
                                          NIL))
                                        NIL))
                                      NIL))
                                    NIL))
                                  NIL))
                                NIL))
                              NIL))
                            NIL))
                          NIL))
                        NIL))
                      NIL))
                    NIL))
                  NIL))
                NIL))
              NIL))
            NIL))
          NIL)
         ("2" (ASSERT) NIL NIL))
        NIL))
      NIL)
     ("2" (HIDE 2)
      (("2" (SKOSIMP*)
        (("2" (LEMMA "cos_period")
          (("2" (INST?)
            (("2" (CASE "(Forall (n: nat): 1 = (-1) ^ (2 * n))")
              (("1" (CASE "EXISTS (nn: nat): n!1 = 2 * nn")
                (("1" (SKOSIMP*)
                  (("1" (REPLACE -1)
                    (("1" (HIDE -1)
                      (("1" (INST -2 "-nn!1")
                        (("1" (REWRITE "cos_0")
                          (("1" (INST?) (("1" (ASSERT) NIL NIL)) NIL)) NIL))
                        NIL))
                      NIL))
                    NIL))
                  NIL)
                 ("2" (CASE "EXISTS (nn: nat): n!1 = 2 * nn + 1")
                  (("1" (HIDE 1)
                    (("1" (SKOSIMP*)
                      (("1" (REPLACE -1)
                        (("1" (HIDE -1)
                          (("1" (INST -2 "-nn!1")
                            (("1" (REWRITE "cos_PI")
                              (("1" (INST?)
                                (("1" (ASSERT)
                                  (("1" (REPLACE -2)
                                    (("1" (HIDE -2)
                                      (("1"
                                        (LEMMA "expt_plus")
                                        (("1"
                                          (INST -1 "2*nn!1" "1" "-1")
                                          (("1"
                                            (REPLACE -1)
                                            (("1"
                                              (HIDE -1)
                                              (("1"
                                                (REPLACE -1 * RL)
                                                (("1"
                                                  (HIDE -1)
                                                  (("1" (GRIND) NIL NIL))
                                                  NIL))
                                                NIL))
                                              NIL))
                                            NIL))
                                          NIL))
                                        NIL))
                                      NIL))
                                    NIL))
                                  NIL))
                                NIL))
                              NIL))
                            NIL))
                          NIL))
                        NIL))
                      NIL))
                    NIL)
                   ("2" (HIDE -1 -2 3)
                    (("2" (CASE "integer_pred(n!1 / 2)")
                      (("1" (INST 2 "n!1/2") (("1" (ASSERT) NIL NIL)) NIL)
                       ("2" (INST 2 "floor(n!1/2)")
                        (("2" (HIDE 3) (("2" (ASSERT) NIL NIL)) NIL)) NIL))
                      NIL))
                    NIL))
                  NIL))
                NIL)
               ("2" (HIDE -1 2)
                (("2" (INDUCT "n")
                  (("1" (ASSERT)
                    (("1" (EXPAND "^")
                      (("1" (EXPAND "expt") (("1" (PROPAX) NIL NIL)) NIL))
                      NIL))
                    NIL)
                   ("2" (SKOSIMP*)
                    (("2" (LEMMA "expt_plus")
                      (("2" (INST -1 "2*j!1" "2" "-1")
                        (("2" (ASSERT)
                          (("2" (REPLACE -1)
                            (("2" (HIDE -1)
                              (("2" (REPLACE -1 * RL)
                                (("2" (HIDE-ALL-BUT 1) (("2" (GRIND) NIL NIL))
                                  NIL))
                                NIL))
                              NIL))
                            NIL))
                          NIL))
                        NIL))
                      NIL))
                    NIL))
                  NIL))
                NIL))
              NIL))
            NIL))
          NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|sin_k_PI2| "" (SKOSIMP*)
  (("" (REWRITE "sin_plus")
    (("" (REWRITE "sin_PI2")
      (("" (REWRITE "cos_PI2")
        (("" (ASSERT) (("" (REWRITE "cos_k_PI") NIL NIL)) NIL)) NIL))
      NIL))
    NIL))
  NIL)
 (|tan_k_PI_TCC1| "" (SKOSIMP*)
  (("" (EXPAND "Tan?")
    (("" (LEMMA "cos_k_PI")
      (("" (INST?)
        (("" (REPLACE -1)
          (("" (HIDE -1) (("" (REWRITE "expt_nonzero") NIL NIL)) NIL)) NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|tan_k_PI| "" (SKOSIMP*)
  (("" (EXPAND "tan")
    (("" (REWRITE "div_eq_zero")
      (("1" (REWRITE "sin_k_PI") NIL NIL)
       ("2" (HIDE 2)
        (("2" (REWRITE "cos_k_PI")
          (("2" (LEMMA "expt_nonzero") (("2" (INST -1 "k!1" "-1") NIL NIL))
            NIL))
          NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|sin_shift| "" (SKOSIMP)
  (("" (REWRITE "sin_minus")
    (("" (REWRITE "sin_PI2")
      (("" (REWRITE "cos_PI2") (("" (GROUND) NIL NIL)) NIL)) NIL))
    NIL))
  NIL)
 (|cos_shift| "" (SKOSIMP)
  (("" (REWRITE "cos_minus")
    (("" (REWRITE "cos_PI2")
      (("" (REWRITE "sin_PI2") (("" (GROUND) NIL NIL)) NIL)) NIL))
    NIL))
  NIL)
 (|cos_sin| "" (SKOSIMP)
  (("" (REWRITE "sin_plus")
    (("" (REWRITE "sin_PI2")
      (("" (REWRITE "cos_PI2") (("" (GROUND) NIL NIL)) NIL)) NIL))
    NIL))
  NIL)
 (|sin_cos| "" (SKOSIMP)
  (("" (REWRITE "cos_plus")
    (("" (REWRITE "sin_PI2")
      (("" (REWRITE "cos_PI2") (("" (GROUND) NIL NIL)) NIL)) NIL))
    NIL))
  NIL)
 (|cos_eq_0| "" (SKOSIMP)
  (("" (LEMMA "sin_eq_0")
    (("" (INST -1 "PI/2-a!1")
      (("" (REWRITE "sin_shift")
        (("" (ASSERT)
          (("" (REPLACE -1 * LR)
            (("" (HIDE -1)
              (("" (PROP)
                (("1" (SKOSIMP)
                  (("1" (INST 1 "-i!1") (("1" (ASSERT) NIL NIL)) NIL)) NIL)
                 ("2" (SKOSIMP)
                  (("2" (INST 1 "-i!1") (("2" (ASSERT) NIL NIL)) NIL)) NIL))
                NIL))
              NIL))
            NIL))
          NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|sin_eq_0_2PI| "" (SKOSIMP*)
  (("" (LEMMA "sin_eq_0")
    (("" (INST?)
      (("" (GROUND)
        (("1" (SKOSIMP*)
          (("1" (CASE "i!1 >= 0")
            (("1" (HIDE -2)
              (("1" (REPLACE -3 -)
                (("1" (LEMMA "both_sides_times_pos_le1")
                  (("1" (INST?) (("1" (ASSERT) NIL NIL)) NIL)) NIL))
                NIL))
              NIL)
             ("2" (HIDE -1 -2 -5 3 4)
              (("2" (LEMMA "pos_times_ge")
                (("2" (INST?) (("2" (ASSERT) NIL NIL)) NIL)) NIL))
              NIL))
            NIL))
          NIL)
         ("2" (LEMMA "sin_0") (("2" (ASSERT) NIL NIL)) NIL)
         ("3" (LEMMA "sin_PI") (("3" (ASSERT) NIL NIL)) NIL)
         ("4" (LEMMA "sin_2PI") (("4" (ASSERT) NIL NIL)) NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|cos_eq_0_2PI| "" (SKOSIMP*)
  (("" (LEMMA "cos_eq_0")
    (("" (INST?)
      (("" (GROUND)
        (("1" (SKOSIMP*)
          (("1" (HIDE -1)
            (("1" (CASE-REPLACE "PI / 2 + i!1 * PI = (i!1+1/2)*PI")
              (("1" (HIDE -1)
                (("1" (CASE "i!1 >= 0")
                  (("1" (REPLACE -3 -)
                    (("1" (LEMMA "both_sides_times_pos_le1")
                      (("1" (INST?) (("1" (ASSERT) NIL NIL)) NIL)) NIL))
                    NIL)
                   ("2" (HIDE -1)
                    (("2" (REPLACE -1 -)
                      (("2" (HIDE -1)
                        (("2" (LEMMA "pos_times_ge")
                          (("2" (INST -1 "i!1+1/2" "PI")
                            (("2" (ASSERT) NIL NIL)) NIL))
                          NIL))
                        NIL))
                      NIL))
                    NIL))
                  NIL))
                NIL)
               ("2" (ASSERT) NIL NIL))
              NIL))
            NIL))
          NIL)
         ("2" (LEMMA "cos_PI2") (("2" (ASSERT) NIL NIL)) NIL)
         ("3" (LEMMA "cos_3PI2") (("3" (ASSERT) NIL NIL)) NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|sin_eq_1| "" (SKOSIMP*)
  (("" (PROP)
    (("1" (CASE-REPLACE "cos(a!1) = 0")
      (("1" (LEMMA "cos_eq_0")
        (("1" (INST?)
          (("1" (ASSERT)
            (("1" (SKOSIMP*)
              (("1" (CASE "even?(i!1)")
                (("1" (EXPAND "even?")
                  (("1" (SKOSIMP*)
                    (("1" (REPLACE -1)
                      (("1" (INST + "j!1") (("1" (ASSERT) NIL NIL)) NIL))
                      NIL))
                    NIL))
                  NIL)
                 ("2" (HIDE 2)
                  (("2" (LEMMA "sin_3PI2")
                    (("2" (LEMMA "sin_period")
                      (("2" (INST?)
                        (("2" (INST -1 "(i!1-1)/2")
                          (("1" (ASSERT)
                            (("1" (AUTO-REWRITE-THEORY "real_props")
                              (("1" (ASSERT)
                                (("1" (CASE-REPLACE "3 * PI / 2 - PI = PI/2")
                                  (("1" (ASSERT)
                                    (("1" (REPLACE -4)
                                      (("1" (ASSERT) NIL NIL)) NIL))
                                    NIL)
                                   ("2" (ASSERT) NIL NIL))
                                  NIL))
                                NIL))
                              NIL))
                            NIL)
                           ("2" (HIDE -1 -2 -3 -4)
                            (("2" (CASE-REPLACE "even?(i!1-1)")
                              (("1" (EXPAND "even?")
                                (("1" (SKOSIMP*) (("1" (ASSERT) NIL NIL))
                                  NIL))
                                NIL)
                               ("2" (HIDE 2)
                                (("2" (REWRITE "even_plus") NIL NIL)) NIL))
                              NIL))
                            NIL))
                          NIL))
                        NIL))
                      NIL))
                    NIL))
                  NIL))
                NIL))
              NIL))
            NIL))
          NIL))
        NIL)
       ("2" (CASE-REPLACE "sq(sin(a!1)) = 1")
        (("1" (HIDE -2)
          (("1" (REWRITE "sin2")
            (("1" (EXPAND "sq")
              (("1" (ASSERT)
                (("1" (LEMMA "zero_times3")
                  (("1" (INST -1 "cos(a!1)" "cos(a!1)")
                    (("1" (ASSERT) NIL NIL)) NIL))
                  NIL))
                NIL))
              NIL))
            NIL))
          NIL)
         ("2" (EXPAND "sq") (("2" (ASSERT) NIL NIL)) NIL))
        NIL))
      NIL)
     ("2" (SKOSIMP*)
      (("2" (REPLACE -1)
        (("2" (HIDE -1)
          (("2" (REWRITE "sin_plus")
            (("2" (REWRITE "sin_PI2")
              (("2" (REWRITE "cos_PI2")
                (("2" (ASSERT)
                  (("2" (LEMMA "cos_2k_PI")
                    (("2" (INST -1 "i!1") (("2" (ASSERT) NIL NIL)) NIL)) NIL))
                  NIL))
                NIL))
              NIL))
            NIL))
          NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|cos_eq_1| "" (SKOSIMP*)
  (("" (GROUND)
    (("1" (CASE-REPLACE "sin(a!1) = 0")
      (("1" (LEMMA "sin_eq_0")
        (("1" (INST?)
          (("1" (ASSERT)
            (("1" (SKOSIMP*)
              (("1" (CASE "even?(i!1)")
                (("1" (INST + "i!1/2")
                  (("1" (ASSERT) NIL NIL)
                   ("2" (EXPAND "even?")
                    (("2" (SKOSIMP*) (("2" (ASSERT) NIL NIL)) NIL)) NIL))
                  NIL)
                 ("2" (REPLACE -1)
                  (("2" (LEMMA "cos_2k_PI")
                    (("2" (INST -1 "(i!1-1)/2")
                      (("1" (ASSERT)
                        (("1"
                          (CASE-REPLACE
                           "2 * ((i!1 - 1) / 2 * PI) = i!1*PI - PI")
                          (("1" (HIDE -1)
                            (("1" (REWRITE "cos_minus")
                              (("1" (REWRITE "cos_PI")
                                (("1" (REWRITE "sin_PI")
                                  (("1" (ASSERT) NIL NIL)) NIL))
                                NIL))
                              NIL))
                            NIL)
                           ("2" (ASSERT) NIL NIL))
                          NIL))
                        NIL)
                       ("2" (HIDE -1 -2 -3 3)
                        (("2" (CASE "even?(i!1-1)")
                          (("1" (EXPAND "even?")
                            (("1" (SKOSIMP*) (("1" (ASSERT) NIL NIL)) NIL))
                            NIL)
                           ("2" (HIDE 2)
                            (("2" (LEMMA "even_plus")
                              (("2" (INST?) (("2" (ASSERT) NIL NIL)) NIL))
                              NIL))
                            NIL))
                          NIL))
                        NIL))
                      NIL))
                    NIL))
                  NIL))
                NIL))
              NIL))
            NIL))
          NIL))
        NIL)
       ("2" (CASE-REPLACE "sq(cos(a!1)) = 1")
        (("1" (REWRITE "cos2")
          (("1" (EXPAND "sq")
            (("1" (LEMMA "zero_times3")
              (("1" (INST -1 "sin(a!1)" "sin(a!1)") (("1" (ASSERT) NIL NIL))
                NIL))
              NIL))
            NIL))
          NIL)
         ("2" (EXPAND "sq") (("2" (ASSERT) NIL NIL)) NIL))
        NIL))
      NIL)
     ("2" (SKOSIMP*)
      (("2" (REPLACE -1)
        (("2" (LEMMA "cos_2k_PI")
          (("2" (INST -1 "i!1") (("2" (ASSERT) NIL NIL)) NIL)) NIL))
        NIL))
      NIL))
    NIL))
  NIL))


$$$trig_probs.pvs
trig_probs: THEORY
BEGIN


%    trigl: LIBRARY = "/home/rwb/fm/pvs/test/lib/trig" 
%    IMPORTING trigl@trig_basic, trigl@trig_extra

    IMPORTING trig_basic, trig_extra, trig_ineq

    a,b,c,v: VAR real
    n: VAR nat

    t1: LEMMA (FORALL (k:nat): 2*n /= k*7) IMPLIES
         cos(n*PI/7) + cos(3*n*PI/7) + cos(5*n*PI/7) = (-1)^(n+1)/2

    t2: LEMMA cos(a+b)*cos(a-b) = sq(cos(a)) + sq(cos(b)) - 1

    t3: LEMMA a + b + c = PI IMPLIES
          1 - sq(cos(a)) - sq(cos(b)) - sq(cos(c)) - 2*cos(a)*cos(b)*cos(c) = 0

    t4: LEMMA cos(a) /= -1 AND (1 + sin(a) + cos(a)) /= 0 AND Tan?(a/2) IMPLIES
        (1 + sin(a) - cos(a)) / (1 + sin(a) + cos(a)) = tan(a/2)

    t5: LEMMA sin(a) - sin(b) /= 0 AND sin(a+b) /= 0 IMPLIES
                sin(a-b)/(sin(a) - sin(b)) = (sin(a) + sin(b))/sin(a+b)

    t6: LEMMA cos(a) + cos(3*a) + cos(5*a) = 0 AND
              sq(cos(a)) - sq(sin(a)) /= -1/2 IMPLIES
              (EXISTS (i: int): a = (2*i+1)*PI/6)
   
    t7: LEMMA Tan?(a) AND Tan?(b) AND Tan?(c) AND 
              Tan?(b+c) AND tan(b)*tan(c) /= 1 AND
              a+b+c=PI IMPLIES
                tan(a) + tan(b) + tan(c) = tan(a)*tan(b)*tan(c)

    t8: LEMMA a = b - v AND c = b + v AND Tan?(b) AND
              cos(a) + cos(b) + cos(c) /= 0
            IMPLIES
             (sin(a) + sin(b) + sin(c))/(cos(a) + cos(b) + cos(c)) = tan(b)

    
    t9: LEMMA 0 <= a AND a <= PI/2 AND 0 < b AND b <= PI/2 AND
              a > b
                 IMPLIES sin(a-b) > sin(b-a)
  
    t10: LEMMA -PI/4 < a AND a < 0 AND 0 < b AND b < PI/2 
               IMPLIES
                 (1 - cos(b)) * tan(a) <= sin(b) 

    IMPORTING trig_inverses

    t11: LEMMA 2*cos(a)^3 + 2*sin(a)^2*cos(a) = 5*sin(a)*cos(a)^2
               IMPLIES (EXISTS (k: int): a = PI/2 + k*PI or
                                         a = arctan(1/2) + k*PI or
                                         a  = arctan(2) + k*PI)

    t12: LEMMA cos(10*a) + 7 = 8 * cos(5*a) IMPLIES
                  (EXISTS (k: int): a = 2*k*PI/5)

    p: VAR rng1
    t13: LEMMA Tan?(arcsin(p)) IMPLIES
               tan(arcsin(p)) = p/sqrt(1-sq(p)) OR
               tan(arcsin(p)) = -p/sqrt(1-sq(p))

    t14: LEMMA Tan?(a) AND Tan?(a/2) AND tan(a)*tan(a/2) = -1 
                IMPLIES cos(a) = -1/2

    t15: LEMMA Tan?(a) AND Tan?(a/2) AND cos(a) /= -1/2 
                  IMPLIES (1+tan(a)*tan(a/2))^-1 = cos(a)

END trig_probs



$$$trig_probs.prf
(|trig_probs|
 (|t1| "" (SKOSIMP*)
  (("" (MULT-BY 1 "2*sin(2*n!1*PI/7)")
    (("1" (LEMMA "sin_times_cos")
      (("1" (ASSERT)
        (("1" (INST -1 "2 * (PI * n!1) / 7" "3 * (PI * n!1) / 7")
          (("1" (MULT-BY -1 "2")
            (("1" (REPLACE -1)
              (("1" (HIDE -1)
                (("1" (LEMMA "sin_times_cos")
                  (("1" (INST -1 "2 * (PI * n!1) / 7" "5 * (PI * n!1) / 7")
                    (("1" (MULT-BY -1 "2")
                      (("1" (REPLACE -1)
                        (("1" (HIDE -1)
                          (("1" (LEMMA "sin_times_cos")
                            (("1"
                              (INST -1 "2 * (PI * n!1) / 7" "(PI * n!1) / 7")
                              (("1" (MULT-BY -1 "2")
                                (("1" (REPLACE -1)
                                  (("1" (HIDE -1)
                                    (("1" (ASSERT)
                                      (("1"
                                        (AUTO-REWRITE-THEORY "real_props")
                                        (("1"
                                          (ASSERT)
                                          (("1"
                                            (LEMMA "sin_neg")
                                            (("1"
                                              (INST -1 "3 * (PI * n!1) / 7")
                                              (("1"
                                                (REPLACE -1)
                                                (("1"
                                                  (ASSERT)
                                                  (("1"
                                                    (HIDE -1)
                                                    (("1"
                                                      (ASSERT)
                                                      (("1"
                                                        (LEMMA "sin_neg")
                                                        (("1"
                                                          (INST
                                                           -1
                                                           "(PI * n!1) / 7")
                                                          (("1"
                                                            (REPLACE -1)
                                                            (("1"
                                                              (HIDE -1)
                                                              (("1"
                                                                (ASSERT)
                                                                (("1"
                                                                  (ASSERT)
                                                                  (("1"
                                                                    (NAME-REPLACE
                                                                     "A1"
                                                                     "sin(3 * (PI * n!1) / 7)")
                                                                    (("1"
                                                                      (ASSERT)
                                                                      (("1"
                                                                        (NAME-REPLACE
                                                                         "A2"
                                                                         "sin((PI * n!1) / 7)")
                                                                        (("1"
                                                                          (ASSERT)
                                                                          (("1"
                                                                            (CASE-REPLACE
                                                                             "7 * (PI * n!1) / 7 = PI*n!1")
                                                                            (("1"
                                                                              (HIDE
                                                                               -1)
                                                                              (("1"
                                                                                (LEMMA
                                                                                 "sin_eq_0")
                                                                                (("1"
                                                                                  (INST
                                                                                   -1
                                                                                   "PI*n!1")
                                                                                  (("1"
                                                                                    (GROUND)
                                                                                    (("1"
                                                                                      (REPLACE

                                                                                       -1)
                                                                                      (("1"
                                                                                        (ASSERT)
                                                                                        (("1"
                                                                                          (ASSERT)
                                                                                          (("1"
                                                                                            (CASE-REPLACE
                                                                                             "A1 + A2 + sin(5 * (PI * n!1) / 7) + -A1 + -A2 = sin(5 * (PI * n!1) / 7)")
                                                                                            (("1"
                                                                                              (HIDE
                                                                                               -1
                                                                                               -2
                                                                                               -3)
                                                                                              (("1"
                                                                                                (CASE-REPLACE
                                                                                                 "5 * (PI * n!1) / 7 =  n!1*PI - 2 * (PI * n!1) / 7")
                                                                                                (("1"
                                                                                                  (REWRITE
                                                                                                   "sin_minus")
                                                                                                  (("1"
                                                                                                    (REWRITE
                                                                                                     "sin_k_PI")
                                                                                                    (("1"
                                                                                                      (ASSERT)
                                                                                                      (("1"
                                                                                                        (REWRITE
                                                                                                         "cos_k_PI")
                                                                                                        (("1"
                                                                                                          (HIDE
                                                                                                           -1
                                                                                                           -2)
                                                                                                          (("1"
                                                                                                            (LEMMA
                                                                                                             "expt_plus")
                                                                                                            (("1"
                                                                                                              (INST
                                                                                                               -1
                                                                                                               "n!1"
                                                                                                               "1"
                                                                                                               "-1")
                                                                                                              (("1"
                                                                                                                (REPLACE

                                                                                                                 -1)
                                                                                                                (("1"
                                                                                                                  (HIDE
                                                                                                                   -1)
                                                                                                                  (("1"
                                                                                                                    (EXPAND
                                                                                                                     "^"
                                                                                                                     1
                                                                                                                     3)
                                                                                                                    (("1"
                                                                                                                      (EXPAND
                                                                                                                       "expt")
                                                                                                                      (("1"
                                                                                                                        (EXPAND
                                                                                                                         "expt")
                                                                                                                        (("1"
                                                                                                                          (ASSERT)
                                                                                                                          NIL
                                                                                                                          NIL))
                                                                                                                        NIL))
                                                                                                                      NIL))
                                                                                                                    NIL))
                                                                                                                  NIL))
                                                                                                                NIL))
                                                                                                              NIL))
                                                                                                            NIL))
                                                                                                          NIL))
                                                                                                        NIL))
                                                                                                      NIL))
                                                                                                    NIL))
                                                                                                  NIL)
                                                                                                 ("2"
                                                                                                  (HIDE
                                                                                                   2)
                                                                                                  (("2"
                                                                                                    (ASSERT)
                                                                                                    NIL
                                                                                                    NIL))
                                                                                                  NIL))
                                                                                                NIL))
                                                                                              NIL)
                                                                                             ("2"
                                                                                              (ASSERT)
                                                                                              NIL
                                                                                              NIL))
                                                                                            NIL))
                                                                                          NIL))
                                                                                        NIL))
                                                                                      NIL)
                                                                                     ("2"
                                                                                      (INST
                                                                                       +
                                                                                       "n!1")
                                                                                      (("2"
                                                                                        (ASSERT)
                                                                                        NIL
                                                                                        NIL))
                                                                                      NIL))
                                                                                    NIL))
                                                                                  NIL))
                                                                                NIL))
                                                                              NIL)
                                                                             ("2"
                                                                              (ASSERT)
                                                                              NIL
                                                                              NIL))
                                                                            NIL))
                                                                          NIL))
                                                                        NIL))
                                                                      NIL))
                                                                    NIL))
                                                                  NIL))
                                                                NIL))
                                                              NIL))
                                                            NIL))
                                                          NIL))
                                                        NIL))
                                                      NIL))
                                                    NIL))
                                                  NIL))
                                                NIL))
                                              NIL))
                                            NIL))
                                          NIL))
                                        NIL))
                                      NIL))
                                    NIL))
                                  NIL))
                                NIL))
                              NIL))
                            NIL))
                          NIL))
                        NIL))
                      NIL))
                    NIL))
                  NIL))
                NIL))
              NIL))
            NIL))
          NIL))
        NIL))
      NIL)
     ("2" (HIDE 1)
      (("2" (CASE-REPLACE "sin(2 * (PI * n!1) / 7) = 0")
        (("1" (REWRITE "sin_eq_0")
          (("1" (SKOSIMP*)
            (("1" (INST - "i!1")
              (("1" (HIDE -2)
                (("1" (MULT-BY -1 "7")
                  (("1" (DIV-BY -1 "PI")
                    (("1" (CASE-REPLACE "7 * (PI * i!1) / PI = 7*i!1")
                      (("1" (HIDE -1) (("1" (ASSERT) NIL NIL)) NIL)
                       ("2" (ASSERT) NIL NIL))
                      NIL))
                    NIL))
                  NIL))
                NIL)
               ("2" (HIDE -2)
                (("2" (CROSS-MULT)
                  (("2" (CASE-REPLACE "2 * (PI * n!1) >= 0")
                    (("1" (REPLACE -2)
                      (("1" (HIDE -2)
                        (("1" (MULT-CASES -1) (("1" (MULT-CASES -1) NIL NIL))
                          NIL))
                        NIL))
                      NIL)
                     ("2" (ASSERT) NIL NIL))
                    NIL))
                  NIL))
                NIL))
              NIL))
            NIL))
          NIL)
         ("2" (HIDE -2) (("2" (ASSERT) NIL NIL)) NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|t2| "" (SKOSIMP*)
  ((""
    (CASE-REPLACE
     "cos(a!1 + b!1) * cos(a!1 - b!1) = sq(cos(a!1))*sq(cos(b!1)) - sq(sin(a!1))*sq(sin(b!1))")
    (("1" (HIDE -1)
      (("1" (REWRITE "sin2")
        (("1" (REWRITE "sin2")
          (("1" (EXPAND "sq") (("1" (PROPAX) NIL NIL)) NIL)) NIL))
        NIL))
      NIL)
     ("2" (HIDE 2)
      (("2" (REWRITE "cos_plus")
        (("2" (REWRITE "cos_minus")
          (("2" (ASSERT) (("2" (EXPAND "sq") (("2" (ASSERT) NIL NIL)) NIL))
            NIL))
          NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|t3| "" (SKOSIMP*)
  (("" (LEMMA "t2")
    (("" (INST?)
      (("" (MOVE-TERMS -1 R 3)
        (("" (MOVE-TERMS -1 R 2)
          (("" (REPLACE -1 * RL)
            (("" (ASSERT)
              (("" (HIDE -1)
                (("" (MOVE-TERMS -1 L 3)
                  (("" (CASE-REPLACE "cos(a!1+b!1) = -1*cos(c!1)")
                    (("1" (HIDE -2)
                      (("1" (ASSERT)
                        (("1" (EXPAND "sq")
                          (("1" (FACTOR 1 L (1 2))
                            (("1"
                              (CASE "(cos(a!1 - b!1) - cos(c!1)) = (cos(a!1 - b!1) + cos(a!1 + b!1))")
                              (("1" (REPLACE -1)
                                (("1" (HIDE -1)
                                  (("1" (LEMMA "cos_times_cos")
                                    (("1" (INST?)
                                      (("1"
                                        (MULT-BY -1 "2")
                                        (("1"
                                          (REPLACE -1 * RL)
                                          (("1"
                                            (HIDE -1)
                                            (("1" (ASSERT) NIL NIL))
                                            NIL))
                                          NIL))
                                        NIL))
                                      NIL))
                                    NIL))
                                  NIL))
                                NIL)
                               ("2" (HIDE 2) (("2" (ASSERT) NIL NIL)) NIL))
                              NIL))
                            NIL))
                          NIL))
                        NIL))
                      NIL)
                     ("2" (HIDE 2)
                      (("2" (REPLACE -1)
                        (("2" (HIDE -1)
                          (("2" (REWRITE "cos_minus")
                            (("2" (REWRITE "cos_PI")
                              (("2" (REWRITE "sin_PI")
                                (("2" (ASSERT) NIL NIL)) NIL))
                              NIL))
                            NIL))
                          NIL))
                        NIL))
                      NIL))
                    NIL))
                  NIL))
                NIL))
              NIL))
            NIL))
          NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|t4| "" (SKOSIMP*)
  (("" (MULT-BY 3 "(1 + sin (a!1) + cos (a!1))")
    (("" (MULT-BY 3 "(1 + sin(a!1) + cos(a!1))")
      (("" (ASSERT)
        (("" (CASE-REPLACE "sin(a!1) * sin(a!1) = sq(sin(a!1))")
          (("1" (CASE-REPLACE "cos(a!1) * cos(a!1) = sq(cos(a!1))")
            (("1" (REWRITE "sin2")
              (("1" (ASSERT)
                (("1" (REWRITE "cos2" +)
                  (("1" (EXPAND "sq")
                    (("1" (FACTOR 3 R (1 2 3 4))
                      (("1" (FACTOR 3 L (1 2))
                        (("1" (HIDE -1 -2)
                          (("1"
                            (CASE-REPLACE
                             "(1 + cos(a!1) + sin(a!1) + cos(a!1) * sin(a!1)) = (1 + cos(a!1))*(1 + sin(a!1))")
                            (("1" (HIDE -1)
                              (("1" (NAME-REPLACE SP1 "(1 + sin(a!1))")
                                (("1"
                                  (CASE-REPLACE
                                   "sin(a!1)/(1+cos(a!1)) = tan(a!1/2)")
                                  (("1" (CROSS-MULT -1) NIL NIL)
                                   ("2" (HIDE 4)
                                    (("2" (REWRITE "tan_half") NIL NIL)) NIL))
                                  NIL))
                                NIL))
                              NIL)
                             ("2" (HIDE 4) (("2" (ASSERT) NIL NIL)) NIL))
                            NIL))
                          NIL))
                        NIL))
                      NIL))
                    NIL))
                  NIL))
                NIL))
              NIL)
             ("2" (HIDE -1 -2 4)
              (("2" (HIDE 2)
                (("2" (EXPAND "sq") (("2" (PROPAX) NIL NIL)) NIL)) NIL))
              NIL))
            NIL)
           ("2" (HIDE 4) (("2" (EXPAND "sq") (("2" (PROPAX) NIL NIL)) NIL))
            NIL))
          NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|t5| "" (SKOSIMP*)
  (("" (NAME SAMSB "(sin(a!1) - sin(b!1))")
    (("" (REPLACE -1)
      (("" (CROSS-MULT 3)
        (("" (FACTOR 3 R (1 2))
          (("" (REWRITE "sin_minus")
            (("" (REWRITE "sin_plus")
              (("" (REPLACE -1 * RL)
                (("" (HIDE -1)
                  (("" (ASSERT)
                    (("" (AUTO-REWRITE "sq_rew")
                      (("" (ASSERT)
                        (("" (ASSERT)
                          (("" (REWRITE "cos2")
                            (("" (REWRITE "cos2")
                              (("" (EXPAND "sq")
                                (("" (PROPAX)
                                  NIL)))))))))))))))))))))))))))))))))
 (|t6| "" (SKOSIMP*)
  (("" (LEMMA "cos_sum")
    (("" (INST -1 "a!1" "5*a!1")
      (("" (ASSERT)
        (("" (ASSERT)
          (("" (CASE-REPLACE "6 * a!1 / 2 = 3*a!1")
            (("1" (HIDE -1)
              (("1" (CASE-REPLACE "-4 * a!1 / 2 = -2*a!1")
                (("1" (LEMMA "cos_neg")
                  (("1" (INST -1 "2*a!1")
                    (("1" (REPLACE -1)
                      (("1" (HIDE -1)
                        (("1" (ASSERT)
                          (("1" (MOVE-TERMS -2 L 2)
                            (("1" (REPLACE -2)
                              (("1" (ASSERT)
                                (("1" (HIDE -1 -2)
                                  (("1" (FACTOR -1 L (1 2))
                                    (("1" (MULT-CASES -1)
                                      (("1"
                                        (REWRITE "cos_eq_0")
                                        (("1"
                                          (SKOSIMP*)
                                          (("1"
                                            (INST + "i!1")
                                            (("1" (ASSERT) NIL NIL))
                                            NIL))
                                          NIL))
                                        NIL)
                                       ("2"
                                        (HIDE 2)
                                        (("2"
                                          (LEMMA "cos_2a")
                                          (("2"
                                            (INST?)
                                            (("2"
                                              (REPLACE -1)
                                              (("2"
                                                (HIDE -1)
                                                (("2"
                                                  (EXPAND "sq")
                                                  (("2" (ASSERT) NIL NIL))
                                                  NIL))
                                                NIL))
                                              NIL))
                                            NIL))
                                          NIL))
                                        NIL))
                                      NIL))
                                    NIL))
                                  NIL))
                                NIL))
                              NIL))
                            NIL))
                          NIL))
                        NIL))
                      NIL))
                    NIL))
                  NIL)
                 ("2" (ASSERT) NIL NIL))
                NIL))
              NIL)
             ("2" (ASSERT) NIL NIL))
            NIL))
          NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|t7| "" (SKOSIMP*)
  (("" (MOVE-TERMS -5 L 1)
    (("" (TRANSFORM-BOTH -5 "tan(%1)")
      (("1" (REWRITE "tan_plus")
        (("1" (INVOKE (MULT-BY -1 "%1") (? -1 "%0 / %1 = %0"))
          (("1" (MOVE-TERMS 2 L 1)
            (("1" (REPLACE -1)
              (("1" (HIDE -1)
                (("1" (REWRITE "tan_minus")
                  (("1" (ASSERT)
                    (("1" (REWRITE "tan_PI") (("1" (ASSERT) NIL NIL)) NIL))
                    NIL)
                   ("2" (EXPAND "Tan?")
                    (("2" (REWRITE "cos_PI") (("2" (ASSERT) NIL NIL)) NIL))
                    NIL)
                   ("3" (REWRITE "tan_PI") (("3" (ASSERT) NIL NIL)) NIL))
                  NIL))
                NIL))
              NIL))
            NIL))
          NIL))
        NIL)
       ("2" (ASSERT) NIL NIL)
       ("3" (EXPAND "Tan?")
        (("3" (REWRITE "cos_minus")
          (("3" (REWRITE "sin_PI")
            (("3" (REWRITE "cos_PI") (("3" (ASSERT) NIL NIL)) NIL)) NIL))
          NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|t8| "" (SKOSIMP*)
  (("" (REPLACE -1)
    (("" (HIDE -1)
      (("" (REPLACE -1)
        (("" (HIDE -1)
          (("" (LEMMA "sin_times_cos")
            (("" (INST?)
              (("" (MULT-BY -1 "2")
                (("" (ASSERT)
                  (("" (REPLACE -1 * RL)
                    (("" (HIDE -1)
                      (("" (LEMMA "cos_times_cos")
                        (("" (INST?)
                          (("" (MULT-BY -1 "2")
                            (("" (REPLACE -1 * RL)
                              (("" (HIDE -1)
                                (("" (CROSS-MULT 2)
                                  (("" (FACTOR 2)
                                    (("" (CANCEL 2)
                                      ((""
                                        (EXPAND "tan")
                                        (("" (ASSERT) NIL NIL))
                                        NIL))
                                      NIL))
                                    NIL))
                                  NIL))
                                NIL))
                              NIL))
                            NIL))
                          NIL))
                        NIL))
                      NIL))
                    NIL))
                  NIL))
                NIL))
              NIL))
            NIL))
          NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|t9| "" (SKOSIMP*)
  (("" (LEMMA "sin_increasing")
    (("" (INST -1 "a!1" "b!1")
      (("" (ASSERT)
        (("" (LEMMA "cos_decreasing")
          (("" (INST -1 "a!1" "b!1")
            (("" (ASSERT)
              (("" (CASE-REPLACE "cos(a!1) >= 0")
                (("1" (CASE-REPLACE "sin(b!1) >= 0")
                  (("1" (MULT-INEQ -4 -3)
                    (("1" (HIDE -2 -3)
                      (("1" (MULT-BY -1 "2")
                        (("1" (REWRITE "sin_times_cos")
                          (("1" (REWRITE "sin_times_cos")
                            (("1" (ASSERT) NIL NIL)) NIL))
                          NIL))
                        NIL))
                      NIL))
                    NIL)
                   ("2" (REWRITE "sin_ge_0") NIL NIL))
                  NIL)
                 ("2" (REWRITE "cos_ge_0") NIL NIL))
                NIL))
              NIL))
            NIL))
          NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|t10_TCC1| "" (SKOSIMP*)
  (("" (HIDE -3 -4)
    (("" (EXPAND "Tan?")
      (("" (LEMMA "cos_eq_0")
        (("" (INST?)
          (("" (ASSERT)
            (("" (SKOSIMP*)
              (("" (CASE "i!1*PI >= 0")
                (("1" (ASSERT) NIL NIL)
                 ("2" (CASE-REPLACE "i!1*PI <= -PI")
                  (("1" (ASSERT) NIL NIL)
                   ("2" (HIDE -1 -2 -3)
                    (("2" (CASE "i!1 >= 0")
                      (("1" (MULT-BY -1 "PI") (("1" (ASSERT) NIL NIL)) NIL)
                       ("2" (DIV-BY 2 "PI") (("2" (ASSERT) NIL NIL)) NIL))
                      NIL))
                    NIL))
                  NIL))
                NIL))
              NIL))
            NIL))
          NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|t10| "" (SKOSIMP*)
  (("" (LEMMA "sin_increasing")
    (("" (INST -1 "a!1" "a!1+b!1")
      (("" (ASSERT)
        (("" (REWRITE "sin_plus")
          (("" (CASE "sin(a!1) < 0")
            (("1" (DIV-BY 1 "sin(a!1)" -)
              (("1" (CASE "cos(a!1) /= 0")
                (("1" (REWRITE "div_simp")
                  (("1" (CASE "tan(a!1) /= 0")
                    (("1"
                      (CASE-REPLACE
                       "(cos(a!1) * sin(b!1) + sin(a!1) * cos(b!1)) / sin(a!1) =                     sin(b!1)/tan(a!1) + cos(b!1)")
                      (("1" (HIDE -1)
                        (("1" (MOVE-TERMS 1 L 2)
                          (("1" (MULT-BY 1 "tan(a!1)" -)
                            (("1" (FACTOR 2 L)
                              (("1" (ASSERT) NIL NIL)
                               ("2" (HIDE 2 3)
                                (("2" (LEMMA "tan_incr")
                                  (("2" (INST -1 "0" "a!1")
                                    (("2" (ASSERT)
                                      (("2"
                                        (REWRITE "tan_0")
                                        (("2"
                                          (ASSERT)
                                          (("2"
                                            (EXPAND "Tan?")
                                            (("2" (PROPAX) NIL NIL))
                                            NIL))
                                          NIL))
                                        NIL))
                                      NIL))
                                    NIL))
                                  NIL))
                                NIL))
                              NIL)
                             ("2" (HIDE 2 3)
                              (("2" (LEMMA "tan_incr")
                                (("2" (INST -1 "0" "a!1")
                                  (("2" (ASSERT)
                                    (("2" (REWRITE "tan_0")
                                      (("2" (ASSERT) NIL NIL)) NIL))
                                    NIL))
                                  NIL))
                                NIL))
                              NIL)
                             ("3" (EXPAND "Tan?") (("3" (PROPAX) NIL NIL))
                              NIL))
                            NIL))
                          NIL))
                        NIL)
                       ("2" (EXPAND "tan" 1) (("2" (ASSERT) NIL NIL)) NIL)
                       ("3" (ASSERT) NIL NIL))
                      NIL)
                     ("2" (EXPAND "tan")
                      (("2" (LEMMA "div_eq_zero")
                        (("2" (INST?) (("2" (ASSERT) NIL NIL)) NIL)) NIL))
                      NIL)
                     ("3" (EXPAND "Tan?") (("3" (PROPAX) NIL NIL)) NIL))
                    NIL))
                  NIL)
                 ("2" (HIDE -1 -4 -5 2 3)
                  (("2" (LEMMA "cos_eq_0")
                    (("2" (INST?)
                      (("2" (ASSERT)
                        (("2" (SKOSIMP*)
                          (("2" (CASE "i!1*PI >= 0")
                            (("1" (ASSERT) NIL NIL)
                             ("2" (CASE-REPLACE "i!1*PI <= -PI")
                              (("1" (ASSERT) NIL NIL)
                               ("2" (HIDE -1 -2 -3)
                                (("2" (CASE "i!1 >= 0")
                                  (("1" (MULT-BY -1 "PI")
                                    (("1" (ASSERT) NIL NIL)) NIL)
                                   ("2" (DIV-BY 2 "PI")
                                    (("2" (ASSERT) NIL NIL)) NIL))
                                  NIL))
                                NIL))
                              NIL))
                            NIL))
                          NIL))
                        NIL))
                      NIL))
                    NIL))
                  NIL))
                NIL))
              NIL)
             ("2" (HIDE 2)
              (("2" (LEMMA "sin_increasing")
                (("2" (INST -1 "0" "a!1")
                  (("2" (ASSERT)
                    (("2" (REWRITE "sin_0") (("2" (ASSERT) NIL NIL)) NIL))
                    NIL))
                  NIL))
                NIL))
              NIL))
            NIL))
          NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|t11_TCC1| "" (SUBTYPE-TCC) NIL NIL) (|t11_TCC2| "" (SUBTYPE-TCC) NIL NIL)
 (|t11_TCC3| "" (SUBTYPE-TCC) NIL NIL)
 (|t11| "" (SKOSIMP*)
  (("" (MOVE-TERMS -1 R 1)
    (("" (CASE-REPLACE "cos(a!1)^3 = cos(a!1)*cos(a!1)^2")
      (("1" (CASE-REPLACE "cos(a!1)^2 = cos(a!1)*cos(a!1)")
        (("1" (HIDE -1 -2)
          (("1" (FACTOR -1 L)
            (("1" (CASE-REPLACE "cos(a!1) = 0 ")
              (("1" (REWRITE "cos_eq_0")
                (("1" (SKOSIMP*)
                  (("1" (INST + "i!1") (("1" (GROUND) NIL NIL)) NIL)) NIL))
                NIL)
               ("2" (ASSERT)
                (("2" (AUTO-REWRITE "expt")
                  (("2" (EXPAND "^")
                    (("2" (ASSERT)
                      (("2" (CASE "cos(a!1)*cos(a!1) = 0")
                        (("1" (HIDE -2 2) (("1" (MULT-CASES -1) NIL NIL)) NIL)
                         ("2" (FACTOR -1 L)
                          (("2" (MULT-CASES -1)
                            (("2" (MULT-BY -1 "1/(cos(a!1)*cos(a!1))")
                              (("2" (ASSERT)
                                (("2"
                                  (CASE-REPLACE
                                   "(cos(a!1) * cos(a!1) * (1 / (cos(a!1) * cos(a!1)))) = 1")
                                  (("1" (HIDE -1)
                                    (("1"
                                      (CASE-REPLACE
                                       "(sin(a!1) * sin(a!1) * (1 / (cos(a!1) * cos(a!1)))) = sq(tan(a!1))")
                                      (("1"
                                        (HIDE -1)
                                        (("1"
                                          (CASE-REPLACE
                                           "(cos(a!1) * sin(a!1) * (1 / (cos(a!1) * cos(a!1)))) = tan(a!1)")
                                          (("1"
                                            (HIDE -1)
                                            (("1"
                                              (ASSERT)
                                              (("1"
                                                (ASSERT)
                                                (("1"
                                                  (CASE
                                                   "(2*tan(a!1) - 1)*(tan(a!1) - 2) = 0")
                                                  (("1"
                                                    (HIDE -2)
                                                    (("1"
                                                      (MULT-CASES -1)
                                                      (("1"
                                                        (CASE
                                                         "tan(a!1) = 1/2")
                                                        (("1"
                                                          (HIDE -2)
                                                          (("1"
                                                            (LEMMA
                                                             "tan_eq_tan")
                                                            (("1"
                                                              (INST
                                                               -1
                                                               "a!1"
                                                               "arctan(1/2)")
                                                              (("1"
                                                                (REWRITE
                                                                 "tan_arctan")
                                                                (("1"
                                                                  (EXPAND
                                                                   "Tan?")
                                                                  (("1"
                                                                    (ASSERT)
                                                                    (("1"
                                                                      (GROUND)
                                                                      (("1"
                                                                        (SKOSIMP*)
                                                                        (("1"
                                                                          (INST
                                                                           +
                                                                           "k!1")
                                                                          (("1"
                                                                            (ASSERT)
                                                                            NIL
                                                                            NIL))
                                                                          NIL))
                                                                        NIL)
                                                                       ("2"
                                                                        (HIDE
                                                                         3)
                                                                        (("2"
                                                                          (TYPEPRED
                                                                           "arctan(1 / 2)")
                                                                          (("2"
                                                                            (NAME-REPLACE
                                                                             "B"
                                                                             "arctan(1/2)")
                                                                            (("2"
                                                                              (HIDE
                                                                               -3
                                                                               -5
                                                                               1
                                                                               2)
                                                                              (("2"
                                                                                (REWRITE
                                                                                 "cos_eq_0")
                                                                                (("2"
                                                                                  (SKOSIMP*)
                                                                                  (("2"
                                                                                    (ASSERT)
                                                                                    (("2"
                                                                                      (REPLACE

                                                                                       -3)
                                                                                      (("2"
                                                                                        (HIDE
                                                                                         -3)
                                                                                        (("2"
                                                                                          (CASE-REPLACE
                                                                                           "i!1 >= 0")
                                                                                          (("1"
                                                                                            (HIDE
                                                                                             -2)
                                                                                            (("1"
                                                                                              (MULT-BY
                                                                                               -2
                                                                                               "2")
                                                                                              (("1"
                                                                                                (MULT-BY
                                                                                                 -2
                                                                                                 "2")
                                                                                                (("1"
                                                                                                  (DIV-BY
                                                                                                   -2
                                                                                                   "PI")
                                                                                                  (("1"
                                                                                                    (AUTO-REWRITE-THEORY
                                                                                                     "real_props")
                                                                                                    (("1"
                                                                                                      (ASSERT)
                                                                                                      NIL
                                                                                                      NIL))
                                                                                                    NIL))
                                                                                                  NIL))
                                                                                                NIL))
                                                                                              NIL))
                                                                                            NIL)
                                                                                           ("2"
                                                                                            (HIDE
                                                                                             -2)
                                                                                            (("2"
                                                                                              (MULT-BY
                                                                                               -1
                                                                                               "2")
                                                                                              (("2"
                                                                                                (DIV-BY
                                                                                                 -1
                                                                                                 "PI")
                                                                                                (("2"
                                                                                                  (AUTO-REWRITE-THEORY
                                                                                                   "real_props")
                                                                                                  (("2"
                                                                                                    (ASSERT)
                                                                                                    NIL
                                                                                                    NIL))
                                                                                                  NIL))
                                                                                                NIL))
                                                                                              NIL))
                                                                                            NIL))
                                                                                          NIL))
                                                                                        NIL))
                                                                                      NIL))
                                                                                    NIL))
                                                                                  NIL))
                                                                                NIL))
                                                                              NIL))
                                                                            NIL))
                                                                          NIL))
                                                                        NIL))
                                                                      NIL))
                                                                    NIL))
                                                                  NIL))
                                                                NIL))
                                                              NIL))
                                                            NIL))
                                                          NIL)
                                                         ("2"
                                                          (ASSERT)
                                                          NIL
                                                          NIL))
                                                        NIL)
                                                       ("2"
                                                        (MOVE-TERMS -1 L 2)
                                                        (("2"
                                                          (ASSERT)
                                                          (("2"
                                                            (LEMMA
                                                             "tan_eq_tan")
                                                            (("2"
                                                              (INST
                                                               -1
                                                               "a!1"
                                                               "arctan(2)")
                                                              (("2"
                                                                (REWRITE
                                                                 "tan_arctan")
                                                                (("2"
                                                                  (EXPAND
                                                                   "Tan?")
                                                                  (("2"
                                                                    (GROUND)
                                                                    (("1"
                                                                      (SKOSIMP*)
                                                                      (("1"
                                                                        (INST
                                                                         +
                                                                         "k!1")
                                                                        (("1"
                                                                          (GROUND)
                                                                          NIL
                                                                          NIL))
                                                                        NIL))
                                                                      NIL)
                                                                     ("2"
                                                                      (HIDE 3)
                                                                      (("2"
                                                                        (HIDE
                                                                         -2
                                                                         1
                                                                         2)
                                                                        (("2"
                                                                          (TYPEPRED
                                                                           "arctan(2)")
                                                                          (("2"
                                                                            (NAME-REPLACE
                                                                             "B"
                                                                             "arctan(2)")
                                                                            (("2"
                                                                              (HIDE
                                                                               -3)
                                                                              (("2"
                                                                                (REWRITE
                                                                                 "cos_eq_0")
                                                                                (("2"
                                                                                  (SKOSIMP*)
                                                                                  (("2"
                                                                                    (ASSERT)
                                                                                    (("2"
                                                                                      (REPLACE

                                                                                       -3)
                                                                                      (("2"
                                                                                        (HIDE
                                                                                         -3)
                                                                                        (("2"
                                                                                          (CASE-REPLACE
                                                                                           "i!1 >= 0")
                                                                                          (("1"
                                                                                            (HIDE
                                                                                             -2)
                                                                                            (("1"
                                                                                              (MULT-BY
                                                                                               -2
                                                                                               "2")
                                                                                              (("1"
                                                                                                (MULT-BY
                                                                                                 -2
                                                                                                 "2")
                                                                                                (("1"
                                                                                                  (DIV-BY
                                                                                                   -2
                                                                                                   "PI")
                                                                                                  (("1"
                                                                                                    (AUTO-REWRITE-THEORY
                                                                                                     "real_props")
                                                                                                    (("1"
                                                                                                      (ASSERT)
                                                                                                      NIL
                                                                                                      NIL))
                                                                                                    NIL))
                                                                                                  NIL))
                                                                                                NIL))
                                                                                              NIL))
                                                                                            NIL)
                                                                                           ("2"
                                                                                            (HIDE
                                                                                             -2)
                                                                                            (("2"
                                                                                              (MULT-BY
                                                                                               -1
                                                                                               "2")
                                                                                              (("2"
                                                                                                (DIV-BY
                                                                                                 -1
                                                                                                 "PI")
                                                                                                (("2"
                                                                                                  (AUTO-REWRITE-THEORY
                                                                                                   "real_props")
                                                                                                  (("2"
                                                                                                    (ASSERT)
                                                                                                    NIL
                                                                                                    NIL))
                                                                                                  NIL))
                                                                                                NIL))
                                                                                              NIL))
                                                                                            NIL))
                                                                                          NIL))
                                                                                        NIL))
                                                                                      NIL))
                                                                                    NIL))
                                                                                  NIL))
                                                                                NIL))
                                                                              NIL))
                                                                            NIL))
                                                                          NIL))
                                                                        NIL))
                                                                      NIL))
                                                                    NIL))
                                                                  NIL))
                                                                NIL))
                                                              NIL))
                                                            NIL))
                                                          NIL))
                                                        NIL))
                                                      NIL))
                                                    NIL)
                                                   ("2"
                                                    (HIDE 4)
                                                    (("2"
                                                      (EXPAND "sq")
                                                      (("2" (ASSERT) NIL NIL))
                                                      NIL))
                                                    NIL)
                                                   ("3"
                                                    (EXPAND "Tan?")
                                                    (("3" (ASSERT) NIL NIL))
                                                    NIL))
                                                  NIL))
                                                NIL))
                                              NIL))
                                            NIL)
                                           ("2"
                                            (HIDE -1 4)
                                            (("2"
                                              (EXPAND "tan")
                                              (("2"
                                                (AUTO-REWRITE-THEORY
                                                 "real_props")
                                                (("2" (ASSERT) NIL NIL))
                                                NIL))
                                              NIL))
                                            NIL)
                                           ("3"
                                            (EXPAND "Tan?")
                                            (("3" (ASSERT) NIL NIL))
                                            NIL))
                                          NIL))
                                        NIL)
                                       ("2"
                                        (HIDE -1 4)
                                        (("2"
                                          (EXPAND "sq")
                                          (("2"
                                            (EXPAND "tan")
                                            (("2"
                                              (ASSERT)
                                              (("2"
                                                (AUTO-REWRITE-THEORY
                                                 "real_props")
                                                (("2" (ASSERT) NIL NIL))
                                                NIL))
                                              NIL))
                                            NIL))
                                          NIL))
                                        NIL)
                                       ("3"
                                        (EXPAND "Tan?")
                                        (("3" (ASSERT) NIL NIL))
                                        NIL))
                                      NIL))
                                    NIL)
                                   ("2" (HIDE -1 4)
                                    (("2" (AUTO-REWRITE-THEORY "real_props")
                                      (("2" (ASSERT) NIL NIL)) NIL))
                                    NIL))
                                  NIL))
                                NIL))
                              NIL))
                            NIL))
                          NIL))
                        NIL))
                      NIL))
                    NIL))
                  NIL))
                NIL))
              NIL))
            NIL))
          NIL)
         ("2" (HIDE -1 -2 2)
          (("2" (EXPAND "^")
            (("2" (ASSERT)
              (("2" (AUTO-REWRITE "expt") (("2" (ASSERT) NIL NIL)) NIL)) NIL))
            NIL))
          NIL))
        NIL)
       ("2" (HIDE -1 2)
        (("2" (EXPAND "^")
          (("2" (ASSERT)
            (("2" (AUTO-REWRITE "expt") (("2" (ASSERT) NIL NIL)) NIL)) NIL))
          NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|t12| "" (SKOSIMP*)
  (("" (LEMMA "cos_2a_cos")
    (("" (INST - "5*a!1")
      (("" (REPLACE -1)
        (("" (HIDE -1)
          (("" (ASSERT)
            (("" (CASE "(cos(5*a!1) - 3)*(cos(5*a!1) - 1) = 0")
              (("1" (HIDE -2)
                (("1" (REWRITE "zero_times3")
                  (("1" (REWRITE "cos_0" :DIR RL)
                    (("1" (LEMMA "cos_eq_cos")
                      (("1" (INST?)
                        (("1" (INST -1 "0")
                          (("1" (ASSERT)
                            (("1" (SKOSIMP*)
                              (("1" (PROP)
                                (("1" (INST + "k!1") (("1" (ASSERT) NIL NIL))
                                  NIL)
                                 ("2" (INST + "k!1") (("2" (ASSERT) NIL NIL))
                                  NIL))
                                NIL))
                              NIL))
                            NIL))
                          NIL))
                        NIL))
                      NIL))
                    NIL))
                  NIL))
                NIL)
               ("2" (ASSERT) NIL NIL))
              NIL))
            NIL))
          NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|t13_TCC1| "" (SKOSIMP*)
  (("" (HIDE -1)
    (("" (TYPEPRED "p!1")
      (("" (EXPAND "sq")
        (("" (CASE "p!1 >= 0")
          (("1" (MULT-INEQ -3 -3) (("1" (ASSERT) NIL NIL)) NIL)
           ("2" (MULT-INEQ -2 -2) (("2" (ASSERT) NIL NIL)) NIL))
          NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|t13_TCC2| "" (SKOSIMP*)
  (("" (EXPAND "Tan?")
    (("" (LEMMA "cos_eq_0")
      (("" (INST?)
        (("" (ASSERT)
          (("" (TRANSFORM-BOTH -2 "sq(%1)")
            (("1" (REWRITE "sq_sqrt")
              (("1" (HIDE -3)
                (("1" (EXPAND "sq")
                  (("1" (ASSERT)
                    (("1" (LEMMA "real_props.sqrt_1")
                      (("1" (INST?)
                        (("1" (ASSERT)
                          (("1" (SPLIT -1)
                            (("1" (REPLACE -1)
                              (("1" (HIDE -1 -2)
                                (("1" (CASE-REPLACE "arcsin(1) = PI/2")
                                  (("1" (INST + "0") (("1" (ASSERT) NIL NIL))
                                    NIL)
                                   ("2" (HIDE 2)
                                    (("2" (HIDE -1)
                                      (("2"
                                        (LEMMA "sin_PI2")
                                        (("2"
                                          (REPLACE -1 * RL)
                                          (("2"
                                            (HIDE -1)
                                            (("2"
                                              (REWRITE "arcsin_sin")
                                              NIL
                                              NIL))
                                            NIL))
                                          NIL))
                                        NIL))
                                      NIL))
                                    NIL))
                                  NIL))
                                NIL))
                              NIL)
                             ("2" (REPLACE -1)
                              (("2" (HIDE -1 -2)
                                (("2" (CASE "arcsin(-1) = -PI/2")
                                  (("1" (HIDE -2)
                                    (("1" (INST + "-1")
                                      (("1" (ASSERT) NIL NIL)) NIL))
                                    NIL)
                                   ("2" (HIDE -1 2)
                                    (("2" (LEMMA "sin_PI2")
                                      (("2"
                                        (LEMMA "sin_neg")
                                        (("2"
                                          (INST -1 "-PI/2")
                                          (("2"
                                            (ASSERT)
                                            (("2"
                                              (REPLACE -1)
                                              (("2"
                                                (HIDE -1)
                                                (("2"
                                                  (REPLACE -1 * RL)
                                                  (("2"
                                                    (HIDE -1)
                                                    (("2"
                                                      (AUTO-REWRITE-THEORY
                                                       "real_props")
                                                      (("2"
                                                        (ASSERT)
                                                        (("2"
                                                          (CASE-REPLACE
                                                           "--sin(-PI / 2) = sin(-PI / 2)")
                                                          (("1"
                                                            (REWRITE
                                                             "arcsin_sin")
                                                            NIL
                                                            NIL)
                                                           ("2"
                                                            (ASSERT)
                                                            NIL
                                                            NIL))
                                                          NIL))
                                                        NIL))
                                                      NIL))
                                                    NIL))
                                                  NIL))
                                                NIL))
                                              NIL))
                                            NIL))
                                          NIL))
                                        NIL))
                                      NIL))
                                    NIL))
                                  NIL))
                                NIL))
                              NIL))
                            NIL))
                          NIL))
                        NIL))
                      NIL))
                    NIL))
                  NIL))
                NIL))
              NIL)
             ("2" (ASSERT) NIL NIL))
            NIL))
          NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|t13| "" (SKOSIMP*)
  (("" (NAME "B" "arcsin(p!1)")
    (("" (LEMMA "sin_arcsin")
      (("" (INST?)
        (("" (REPLACE -2)
          (("" (HIDE -2)
            (("" (LEMMA "cos2")
              (("" (INST?)
                (("" (REPLACE -2)
                  (("" (TRANSFORM-BOTH -1 "sqrt(%1)")
                    (("1" (HIDE -2)
                      (("1" (REWRITE "sqrt_sq_abs")
                        (("1" (REPLACE -1 * RL)
                          (("1" (EXPAND "tan")
                            (("1" (HIDE -1)
                              (("1" (REPLACE -1 * RL)
                                (("1" (HIDE -1) (("1" (GRIND) NIL NIL)) NIL))
                                NIL))
                              NIL))
                            NIL))
                          NIL))
                        NIL))
                      NIL)
                     ("2" (ASSERT) NIL NIL)
                     ("3" (LEMMA "t13_TCC1")
                      (("3" (INST?) (("3" (ASSERT) NIL NIL)) NIL)) NIL))
                    NIL))
                  NIL))
                NIL))
              NIL))
            NIL))
          NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|t14| "" (SKOSIMP*)
  (("" (EXPAND "Tan?")
    (("" (EXPAND "tan")
      (("" (LEMMA "sin_2a")
        (("" (INST -1 "a!1/2")
          (("" (REPLACE -1)
            (("" (HIDE -1)
              (("" (LEMMA "cos_2a_cos")
                (("" (INST -1 "a!1/2")
                  (("" (REPLACE -1)
                    (("" (HIDE -1)
                      (("" (ASSERT)
                        (("" (NAME-REPLACE "C" "cos(a!1/2)")
                          (("" (NAME-REPLACE "S" "sin(a!1/2)")
                            (("" (NAME-REPLACE "CC2" "(2 * (C * C) - 1)")
                              ((""
                                (CASE-REPLACE
                                 "2 * (C * S) / CC2 * (S / C) = 2 * sq(S)/CC2")
                                (("1" (HIDE -1)
                                  (("1" (REVEAL -2 -3 -4)
                                    (("1" (REPLACE -1 * RL)
                                      (("1"
                                        (HIDE -1)
                                        (("1"
                                          (REPLACE -1 * RL)
                                          (("1"
                                            (HIDE -1)
                                            (("1"
                                              (REPLACE -1 * RL)
                                              (("1"
                                                (HIDE -1)
                                                (("1"
                                                  (LEMMA "cos_2a_cos")
                                                  (("1"
                                                    (INST -1 "a!1/2")
                                                    (("1"
                                                      (ASSERT)
                                                      (("1"
                                                        (REPLACE -1 * RL)
                                                        (("1"
                                                          (HIDE -1)
                                                          (("1"
                                                            (CROSS-MULT -2)
                                                            (("1"
                                                              (REWRITE "sin2")
                                                              (("1"
                                                                (ASSERT)
                                                                (("1"
                                                                  (EXPAND
                                                                   "sq")
                                                                  (("1"
                                                                    (ASSERT)
                                                                    NIL
                                                                    NIL))
                                                                  NIL))
                                                                NIL))
                                                              NIL))
                                                            NIL))
                                                          NIL))
                                                        NIL))
                                                      NIL))
                                                    NIL))
                                                  NIL))
                                                NIL))
                                              NIL))
                                            NIL))
                                          NIL))
                                        NIL))
                                      NIL))
                                    NIL))
                                  NIL)
                                 ("2" (EXPAND "sq") (("2" (ASSERT) NIL NIL))
                                  NIL)
                                 ("3" (ASSERT) NIL NIL))
                                NIL))
                              NIL))
                            NIL))
                          NIL))
                        NIL))
                      NIL))
                    NIL))
                  NIL))
                NIL))
              NIL))
            NIL))
          NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|t15_TCC1| "" (SKOSIMP*)
  (("" (LEMMA "t14") (("" (INST?) (("" (ASSERT) NIL NIL)) NIL)) NIL)) NIL)
 (|t15| "" (SKOSIMP*)
  (("" (HIDE 1)
    (("" (EXPAND "^")
      (("" (AUTO-REWRITE "expt")
        (("" (ASSERT)
          (("" (CROSS-MULT)
            (("1" (EXPAND "tan")
              (("1" (LEMMA "cos_2a_cos")
                (("1" (INST -1 "a!1/2")
                  (("1"
                    (CASE-REPLACE
                     "cos(a!1) * (sin(a!1 / 2) / cos(a!1 / 2)) * (sin(a!1) / cos(a!1)) =
               sin(a!1) * (sin(a!1 / 2) / cos(a!1 / 2)) ")
                    (("1" (HIDE -1)
                      (("1" (REPLACE -1)
                        (("1" (ASSERT)
                          (("1" (LEMMA "sin_2a")
                            (("1" (INST -1 "a!1/2")
                              (("1" (REPLACE -1)
                                (("1" (HIDE -1)
                                  (("1" (ASSERT)
                                    (("1"
                                      (CASE-REPLACE
                                       "(cos(a!1 / 2) * sin(a!1 / 2) * (sin(a!1 / 2) / cos(a!1 / 2))) = sq(sin(a!1 / 2))")
                                      (("1"
                                        (HIDE -1)
                                        (("1"
                                          (REWRITE "sin2")
                                          (("1"
                                            (ASSERT)
                                            (("1"
                                              (EXPAND "sq")
                                              (("1" (PROPAX) NIL NIL))
                                              NIL))
                                            NIL))
                                          NIL))
                                        NIL)
                                       ("2"
                                        (EXPAND "sq")
                                        (("2" (ASSERT) NIL NIL))
                                        NIL)
                                       ("3"
                                        (EXPAND "Tan?")
                                        (("3" (PROPAX) NIL NIL))
                                        NIL))
                                      NIL))
                                    NIL))
                                  NIL))
                                NIL))
                              NIL))
                            NIL))
                          NIL))
                        NIL))
                      NIL)
                     ("2" (ASSERT) NIL NIL)
                     ("3" (EXPAND "Tan?") (("3" (PROPAX) NIL NIL)) NIL)
                     ("4" (EXPAND "Tan?") (("4" (PROPAX) NIL NIL)) NIL))
                    NIL))
                  NIL))
                NIL))
              NIL)
             ("2" (LEMMA "t14")
              (("2" (INST?)
                (("2" (ASSERT) (("2" (REVEAL 1) (("2" (PROPAX) NIL NIL)) NIL))
                  NIL))
                NIL))
              NIL))
            NIL))
          NIL))
        NIL))
      NIL))
    NIL))
  NIL))


$$$sqrt_rew.pvs
sqrt_rew: THEORY
%------------------------------------------------------------------------
%
%  Square root rewrite library
%
%  NOTE: This library is meant to be used as a auto-rewrite library:
%
%           (auto-rewrite-theory "sqrt")
%      
%         Lemma names are subject to change.  Direct rewrite calls
%         should be made to lemmas in sqrt instead.
%
%------------------------------------------------------------------------

BEGIN

  IMPORTING sqrt

  nnx, nny, nnz, nna : VAR nonneg_real
  x,y,z,xx: VAR real


  sqrt_r0              : LEMMA  sqrt(0) = 0
  sqrt_r1              : LEMMA  sqrt(1) = 1
  sqrt_r1b             : LEMMA  sqrt(4) = 2
  sqrt_r1c             : LEMMA  sqrt(9) = 3 
  sqrt_r1d             : LEMMA  sqrt(16) = 4
  sqrt_r1e             : LEMMA  sqrt(25) = 5
  sqrt_r1f             : LEMMA  sqrt(36) = 6
  sqrt_r1g             : LEMMA  sqrt(49) = 7
  sqrt_r1h             : LEMMA  sqrt(64) = 8
  sqrt_r1i             : LEMMA  sqrt(81) = 9
  
  sqrt_r1j             : LEMMA  sqrt(100) = 10

  sqrt_r3              : LEMMA  sqrt(nnx) = 0 IMPLIES nnx = 0

  sqrt_r4              : LEMMA  sqrt(nnx) * sqrt(nnx) = nnx

  sqrt_r5              : LEMMA  sqrt(nnx * nnx) = nnx

  sqrt_r5b             : LEMMA  sqrt(nna * nnx * nnx) = sqrt(nna) * nnx

  sqrt_r5c             : LEMMA  sqrt(nna * (nnx * nnx)) = sqrt(nna) * nnx

  sqrt_r6              : LEMMA  x >= 0 IMPLIES sqrt(sq(x)) = x

  sqrt_r7              : LEMMA  sqrt(sq(nnx)) = nnx

  sqrt_r7b             : LEMMA  sqrt(sq(x)) = abs(x)

  sqrt_r8              : LEMMA  x >= 0 IMPLIES sq(sqrt(x))=x

  sqrt_r9              : LEMMA  sqrt(nny) * sqrt(nnz) = sqrt(nny * nnz)  

  sqrt_r10             : LEMMA  nnz /= 0 IMPLIES 
                                   sqrt(nny) / sqrt(nnz) = sqrt(nny / nnz) 


%  sqrt_rw11            : LEMMA  sqrt(nny) < sqrt(nnz) IMPLIES nny < nnz 

%----- The following sends test.t15 into an infinite loop -----
%
%   sqrt_rw12           : LEMMA  sqrt(nny) <= sqrt(nnz) IMPLIES nny <= nnz 

%----- The following sends test.t44 into an infinite loop -----
%
%  sqrt_rw13           : LEMMA  sqrt(nny) > sqrt(nnz) IMPLIES nny > nnz 

%----- The following sends test2.t25 into an infinite loop -----
%
%  sqrt_rw14           : LEMMA  sqrt(nny) >= sqrt(nnz) IMPLIES nny >= nnz 

%----- The following sends test2.t13 into an infinite loop -----
%
%   sqrt_rw15           : LEMMA  sqrt(nny) = sqrt(nnz) IMPLIES nny = nnz  

END sqrt_rew


$$$sqrt_rew.prf
(|sqrt_rew| (|sqrt_r0| "" (LEMMA "sqrt_0") (("" (PROPAX) NIL NIL)) NIL)
 (|sqrt_r1| "" (REWRITE "sqrt_1") NIL NIL)
 (|sqrt_r1b| "" (CASE-REPLACE "4 = 2*2")
  (("1" (REWRITE "sqrt_square") NIL NIL) ("2" (ASSERT) NIL NIL)) NIL)
 (|sqrt_r1c| "" (CASE-REPLACE "9 = 3*3")
  (("1" (REWRITE "sqrt_square") NIL NIL) ("2" (ASSERT) NIL NIL)) NIL)
 (|sqrt_r1d| "" (CASE-REPLACE "16 = 4*4")
  (("1" (REWRITE "sqrt_square") NIL NIL) ("2" (ASSERT) NIL NIL)) NIL)
 (|sqrt_r1e| "" (CASE-REPLACE "25=5*5")
  (("1" (REWRITE "sqrt_square") NIL NIL) ("2" (ASSERT) NIL NIL)) NIL)
 (|sqrt_r1f| "" (CASE-REPLACE "36=6*6")
  (("1" (REWRITE "sqrt_square") NIL NIL) ("2" (ASSERT) NIL NIL)) NIL)
 (|sqrt_r1g| "" (CASE-REPLACE "49=7*7")
  (("1" (REWRITE "sqrt_square") NIL NIL) ("2" (ASSERT) NIL NIL)) NIL)
 (|sqrt_r1h| "" (CASE-REPLACE "64=8*8")
  (("1" (REWRITE "sqrt_square") NIL NIL) ("2" (ASSERT) NIL NIL)) NIL)
 (|sqrt_r1i| "" (CASE-REPLACE "81=9*9")
  (("1" (REWRITE "sqrt_square") NIL NIL) ("2" (ASSERT) NIL NIL)) NIL)
 (|sqrt_r1j| "" (CASE-REPLACE "100=10*10")
  (("1" (REWRITE "sqrt_square") NIL NIL) ("2" (ASSERT) NIL NIL)) NIL)
 (|sqrt_r3| "" (SKOSIMP*) (("" (REWRITE "sqrt_eq_0") NIL NIL)) NIL)
 (|sqrt_r4| "" (SKOSIMP*) (("" (REWRITE "sqrt_def") NIL NIL)) NIL)
 (|sqrt_r5| "" (SKOSIMP*) (("" (REWRITE "sqrt_square") NIL NIL)) NIL)
 (|sqrt_r5b| "" (SKOSIMP*)
  (("" (LEMMA "sqrt_times")
    (("" (INST -1 "nna!1" "nnx!1*nnx!1")
      (("" (REPLACE -1)
        (("" (HIDE -1) (("" (REWRITE "sqrt_square") NIL NIL)) NIL)) NIL))
      NIL))
    NIL))
  NIL)
 (|sqrt_r5c| "" (SKOSIMP*)
  (("" (LEMMA "sqrt_times")
    (("" (INST -1 "nna!1" "nnx!1*nnx!1")
      (("" (REPLACE -1)
        (("" (HIDE -1) (("" (REWRITE "sqrt_square") NIL NIL)) NIL)) NIL))
      NIL))
    NIL))
  NIL)
 (|sqrt_r6| "" (SKOSIMP*) (("" (REWRITE "sqrt_sq") NIL NIL)) NIL)
 (|sqrt_r7| "" (SKOSIMP*) (("" (REWRITE "sqrt_sq") NIL NIL)) NIL)
 (|sqrt_r7b| "" (SKOSIMP*) (("" (REWRITE "sqrt_sq_abs") NIL NIL)) NIL)
 (|sqrt_r8| "" (SKOSIMP*) (("" (REWRITE "sq_sqrt") NIL NIL)) NIL)
 (|sqrt_r9| "" (SKOSIMP*) (("" (REWRITE "sqrt_times") NIL NIL)) NIL)
 (|sqrt_r10_TCC1| "" (SUBTYPE-TCC) NIL NIL)
 (|sqrt_r10_TCC2| "" (SKOSIMP*)
  (("" (LEMMA "pos_div_ge")
    (("" (INST?) (("1" (ASSERT) NIL NIL) ("2" (ASSERT) NIL NIL)) NIL)) NIL))
  NIL)
 (|sqrt_r10| "" (SKOSIMP*) (("" (REWRITE "sqrt_div") NIL NIL)) NIL)
 (|sqrt_rw11| "" (SKOSIMP*) (("" (REWRITE "sqrt_lt") NIL NIL)) NIL)
 (|sqrt_rw13| "" (SKOSIMP*) (("" (REWRITE "sqrt_gt") NIL NIL)) NIL))


$$$sq.pvs
sq: THEORY
BEGIN

  a,b,d       : VAR real
  nna,nnb,nnc : VAR nonneg_real   
  nz          : VAR nzreal 
  n           : VAR nat               

  sq(a): nonneg_real = a*a

  sq_rew            : LEMMA a*a = sq(a)

  sq_nz_pos         : JUDGEMENT sq(nz) HAS_TYPE posreal 

  sq_neg            : LEMMA sq(-a) = sq(a)
      
  sq_pos            : LEMMA sq(a) >= 0
      
  sq_plus_pos       : LEMMA sq(a)+sq(b) >= 0
      
  sq_times          : LEMMA sq(a*b) = sq(a) * sq(b)

  sq_plus           : LEMMA sq(a+b) = sq(a) + 2*a*b + sq(b)

  sq_minus          : LEMMA sq(a-b) = sq(a) - 2*a*b + sq(b)

  sq_neg_minus      : LEMMA sq(a-b) = sq(b-a)

  sq_0              : LEMMA sq(0) = 0

  sq_eq_0           : LEMMA sq(a) = 0 IFF a = 0

  sq_gt_0           : LEMMA sq(a) > 0 IFF a /= 0      

  sq_div            : LEMMA d /= 0 => sq(a/d) = sq(a)/sq(d)

  sq_plus_eq_0      : LEMMA sq(a) + sq(b) = 0 <=> (a = 0 AND b = 0)


% -------------------- Inequalities --------------------

  sq_ge  : LEMMA sq(nna) >= sq(nnb) IFF nna >= nnb 

  sq_le  : LEMMA sq(nna) <= sq(nnb) IFF nna <= nnb 

  sq_gt  : LEMMA sq(nna) > sq(nnb)  IFF nna > nnb

  sq_lt  : LEMMA sq(nna) < sq(nnb)  IFF nna < nnb 

  sq_eq  : LEMMA sq(nna) = sq(nnb)  IFF nna = nnb 
  

  sq_neg_pos_le : LEMMA sq(a) <= sq(nnc) IFF (-nnc <= a AND a <= nnc)

  neg_pos_sq_le : LEMMA (-b <= a AND a <= b) IMPLIES sq(a) <= sq(b)
      
  sq_neg_pos_lt : LEMMA  sq(a) < sq(nnc) IFF (-nnc < a AND a < nnc) 

  neg_pos_sq_lt : LEMMA (-b < a AND a < b) IMPLIES sq(a) < sq(b)

  sq_le_abs     : LEMMA sq(a) <= sq(b) IFF abs(a) <= abs(b)
      
  sq_lt_abs     : LEMMA sq(a) < sq(b) IFF abs(a) < abs(b)

  sq_eq_abs     : LEMMA sq(a) = sq(b) IFF abs(a) = abs(b)


  %   |\
  %   | \ C <= c
  % A |  \
  %   +----
  %    B 

  triangle_rectangle: LEMMA sq(a)+sq(b) <= sq(nnc) IMPLIES
                              -nnc <= a AND a <= nnc AND 
                              -nnc <= b AND b <= nnc   

  triangle_ineq_lt  : LEMMA sq(a) + sq(b) < sq(d) IMPLIES  
                                  abs(a) < abs(d) AND
                                  abs(b) < abs(d)   


  triangle_ineq_le  : LEMMA sq(a) + sq(b) <= sq(d) IMPLIES 
                                  abs(a) <= abs(d) AND
                                  abs(b) <= abs(d)   

END sq




$$$sq.prf
(|sq| (|sq_TCC1| "" (GROUND) NIL NIL)
 (|sq_rew| "" (SKOSIMP*) (("" (EXPAND "sq") (("" (PROPAX) NIL NIL)) NIL)) NIL)
 (|sq_nz_pos| "" (SUBTYPE-TCC) NIL NIL) (|sq_neg| "" (GRIND) NIL NIL)
 (|sq_pos| "" (GRIND) NIL NIL)
 (|sq_plus_pos| "" (SKOLEM 1 ("a" "b"))
  (("" (CASE "sq(a)>=0" "sq(b) >= 0")
    (("1" (GROUND) NIL NIL) ("2" (REWRITE "sq_pos") NIL NIL)
     ("3" (REWRITE "sq_pos") NIL NIL))
    NIL))
  NIL)
 (|sq_times| "" (GRIND) NIL NIL) (|sq_plus| "" (GRIND) NIL NIL)
 (|sq_minus| "" (GRIND) NIL NIL) (|sq_neg_minus| "" (GRIND) NIL NIL)
 (|sq_0| "" (GRIND) NIL NIL)
 (|sq_eq_0| "" (SKOSIMP*)
  (("" (EXPAND "sq")
    (("" (LEMMA "zero_times3") (("" (INST?) (("" (GROUND) NIL NIL)) NIL))
      NIL))
    NIL))
  NIL)
 (|sq_gt_0| "" (SKOSIMP*)
  (("" (EXPAND "sq")
    (("" (LEMMA "pos_times_gt") (("" (INST?) (("" (GROUND) NIL NIL)) NIL))
      NIL))
    NIL))
  NIL)
 (|sq_div_TCC1| "" (SKOLEM 1 "d")
  (("" (GROUND) (("" (REWRITE "sq_eq_0") NIL NIL)) NIL)) NIL)
 (|sq_div| "" (GRIND) NIL NIL)
 (|sq_plus_eq_0| "" (SKOLEM 1 ("a" "b"))
  (("" (GROUND)
    (("1" (LEMMA "sq_pos")
      (("1" (INST -1 "b")
        (("1" (CASE "sq(a)>0")
          (("1" (GROUND) NIL NIL)
           ("2" (DELETE -)
            (("2" (EXPAND "sq")
              (("2" (REWRITE "pos_times_gt") (("2" (GROUND) NIL NIL)) NIL))
              NIL))
            NIL))
          NIL))
        NIL))
      NIL)
     ("2" (LEMMA "sq_pos")
      (("2" (INST -1 "a")
        (("2" (CASE "sq(b)>0")
          (("1" (GROUND) NIL NIL)
           ("2" (DELETE -)
            (("2" (EXPAND "sq")
              (("2" (REWRITE "pos_times_gt") (("2" (GROUND) NIL NIL)) NIL))
              NIL))
            NIL))
          NIL))
        NIL))
      NIL)
     ("3" (GRIND) NIL NIL))
    NIL))
  NIL)
 (|sq_ge| "" (SKOSIMP*)
  (("" (GROUND)
    (("1" (CASE "nna!1 < nnb!1")
      (("1" (CASE "sq(nna!1) < sq(nnb!1)")
        (("1" (GROUND) NIL NIL)
         ("2" (HIDE -2 2)
          (("2" (LEMMA "lt_times_lt_pos1")
            (("2" (INST -1 "nna!1" "nna!1" "nnb!1" "nnb!1")
              (("1" (GROUND)
                (("1" (EXPAND "sq") (("1" (PROPAX) NIL NIL)) NIL)) NIL)
               ("2" (GROUND)
                (("2" (CASE "nna!1=0")
                  (("1" (GROUND)
                    (("1" (REPLACE -1 :HIDE? T)
                      (("1" (EXPAND "sq")
                        (("1" (GROUND)
                          (("1" (REWRITE "pos_times_lt") NIL NIL)) NIL))
                        NIL))
                      NIL))
                    NIL)
                   ("2" (GROUND) NIL NIL))
                  NIL))
                NIL))
              NIL))
            NIL))
          NIL))
        NIL)
       ("2" (GROUND) NIL NIL))
      NIL)
     ("2" (LEMMA "ge_times_ge_pos")
      (("2" (INST?)
        (("2" (INST -1 "nnb!1" "nna!1")
          (("2" (GROUND) (("2" (EXPAND "sq") (("2" (PROPAX) NIL NIL)) NIL))
            NIL))
          NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|sq_le| "" (LEMMA "sq_ge")
  (("" (SKOLEM 1 ("nna" "nnb"))
    (("" (INST -1 "nnb" "nna") (("" (GROUND) NIL NIL)) NIL)) NIL))
  NIL)
 (|sq_gt| "" (SKOSIMP*)
  (("" (GROUND)
    (("1" (CASE "nna!1 <= nnb!1")
      (("1" (CASE "sq(nna!1) <= sq(nnb!1)")
        (("1" (GROUND) NIL NIL)
         ("2" (HIDE -2 2)
          (("2" (LEMMA "le_times_le_pos")
            (("2" (INST -1 "nna!1" "nna!1" "nnb!1" "nnb!1")
              (("2" (GROUND)
                (("2" (EXPAND "sq") (("2" (PROPAX) NIL NIL)) NIL)) NIL))
              NIL))
            NIL))
          NIL))
        NIL)
       ("2" (GROUND) NIL NIL))
      NIL)
     ("2" (LEMMA "gt_times_gt_pos1")
      (("2" (INST?)
        (("2" (INST -1 "nnb!1" "nna!1")
          (("1" (ASSERT)
            (("1" (HIDE -2) (("1" (EXPAND "sq") (("1" (PROPAX) NIL NIL)) NIL))
              NIL))
            NIL)
           ("2" (CASE-REPLACE "nnb!1 = 0")
            (("1" (HIDE -1 1)
              (("1" (EXPAND "sq" 1 2)
                (("1" (LEMMA "sq_pos")
                  (("1" (INST?)
                    (("1" (ASSERT)
                      (("1" (LEMMA "sq_eq_0")
                        (("1" (INST?) (("1" (ASSERT) NIL NIL)) NIL)) NIL))
                      NIL))
                    NIL))
                  NIL))
                NIL))
              NIL)
             ("2" (ASSERT) NIL NIL))
            NIL))
          NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|sq_lt| "" (SKOLEM 1 ("nna" "nnb"))
  (("" (LEMMA "sq_gt")
    (("" (INST -1 "nnb" "nna") (("" (GROUND) NIL NIL)) NIL)) NIL))
  NIL)
 (|sq_eq| "" (SKOSIMP*)
  (("" (CASE-REPLACE "nna!1 = 0")
    (("1" (LEMMA "sq_eq_0")
      (("1" (INST -1 "nnb!1")
        (("1" (EXPAND "sq") (("1" (GROUND) NIL NIL)) NIL)) NIL))
      NIL)
     ("2" (CASE-REPLACE "nnb!1 = 0")
      (("1" (LEMMA "sq_eq_0")
        (("1" (INST?) (("1" (EXPAND "sq") (("1" (PROPAX) NIL NIL)) NIL)) NIL))
        NIL)
       ("2" (GROUND)
        (("2" (LEMMA "both_sides_expt2_aux")
          (("2" (INST -1 "2" "nna!1" "nnb!1")
            (("2" (EXPAND "expt")
              (("2" (EXPAND "expt")
                (("2" (EXPAND "expt")
                  (("2" (EXPAND "sq") (("2" (PROPAX) NIL NIL)) NIL)) NIL))
                NIL))
              NIL))
            NIL))
          NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|sq_neg_pos_le| "" (SKOLEM 1 ("a" "c"))
  (("" (CASE "a >= 0")
    (("1" (LEMMA "sq_le")
      (("1" (INST -1 "a" "c") (("1" (GROUND) NIL NIL)) NIL)) NIL)
     ("2" (LEMMA "sq_le")
      (("2" (INST -1 "-a" "c")
        (("1" (CASE-REPLACE "sq(-a) = sq(a)")
          (("1" (HIDE -1) (("1" (GROUND) NIL NIL)) NIL)
           ("2" (HIDE -1 3) (("2" (EXPAND "sq") (("2" (ASSERT) NIL NIL)) NIL))
            NIL))
          NIL)
         ("2" (ASSERT) NIL NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|neg_pos_sq_le| "" (SKOLEM 1 ("a" "b"))
  (("" (GROUND)
    (("" (CASE "a > 0")
      (("1" (LEMMA "sq_le")
        (("1" (INST -1 "a" "b")
          (("1" (GROUND) NIL NIL) ("2" (GROUND) NIL NIL)) NIL))
        NIL)
       ("2" (CASE "-a <= b")
        (("1" (LEMMA "sq_le")
          (("1" (INST -1 "-a" "b")
            (("1" (GROUND) (("1" (REWRITE "sq_neg") NIL NIL)) NIL)
             ("2" (GROUND) NIL NIL))
            NIL))
          NIL)
         ("2" (GROUND) NIL NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|sq_neg_pos_lt| "" (SKOLEM 1 ("a" "c"))
  (("" (CASE "a >= 0")
    (("1" (LEMMA "sq_lt")
      (("1" (INST -1 "a" "c") (("1" (GROUND) NIL NIL)) NIL)) NIL)
     ("2" (LEMMA "sq_lt")
      (("2" (INST -1 "-a" "c")
        (("1" (CASE-REPLACE "sq(-a) = sq(a)")
          (("1" (GROUND) NIL NIL)
           ("2" (HIDE -1 3) (("2" (EXPAND "sq") (("2" (ASSERT) NIL NIL)) NIL))
            NIL))
          NIL)
         ("2" (ASSERT) NIL NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|neg_pos_sq_lt| "" (SKOLEM 1 ("a" "b"))
  (("" (GROUND)
    (("" (CASE "a > 0")
      (("1" (LEMMA "sq_lt")
        (("1" (INST -1 "a" "b")
          (("1" (GROUND) NIL NIL) ("2" (GROUND) NIL NIL)) NIL))
        NIL)
       ("2" (CASE "-a < b")
        (("1" (LEMMA "sq_lt")
          (("1" (INST -1 "-a" "b")
            (("1" (GROUND) (("1" (REWRITE "sq_neg") NIL NIL)) NIL)
             ("2" (GROUND) NIL NIL))
            NIL))
          NIL)
         ("2" (GROUND) NIL NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|sq_le_abs| "" (SKOSIMP*)
  (("" (CASE-REPLACE "b!1 >= 0")
    (("1" (LEMMA "sq_neg_pos_le")
      (("1" (INST?)
        (("1" (EXPAND "abs") (("1" (LIFT-IF) (("1" (GROUND) NIL NIL)) NIL))
          NIL))
        NIL))
      NIL)
     ("2" (LEMMA "sq_neg_pos_le")
      (("2" (INST -1 "a!1" "-b!1")
        (("1" (CASE-REPLACE "sq(-b!1) = sq(b!1)")
          (("1" (HIDE -1)
            (("1" (EXPAND "abs")
              (("1" (LIFT-IF) (("1" (GROUND) NIL NIL)) NIL)) NIL))
            NIL)
           ("2" (HIDE -1 3) (("2" (EXPAND "sq") (("2" (ASSERT) NIL NIL)) NIL))
            NIL))
          NIL)
         ("2" (ASSERT) NIL NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|sq_lt_abs| "" (SKOSIMP*)
  (("" (CASE-REPLACE "b!1 >= 0")
    (("1" (LEMMA "sq_neg_pos_lt")
      (("1" (INST?)
        (("1" (EXPAND "abs") (("1" (LIFT-IF) (("1" (GROUND) NIL NIL)) NIL))
          NIL))
        NIL))
      NIL)
     ("2" (LEMMA "sq_neg_pos_lt")
      (("2" (INST -1 "a!1" "-b!1")
        (("1" (CASE-REPLACE "sq(-b!1) = sq(b!1)")
          (("1" (HIDE -1)
            (("1" (EXPAND "abs")
              (("1" (LIFT-IF) (("1" (GROUND) NIL NIL)) NIL)) NIL))
            NIL)
           ("2" (HIDE -1 3) (("2" (EXPAND "sq") (("2" (ASSERT) NIL NIL)) NIL))
            NIL))
          NIL)
         ("2" (ASSERT) NIL NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|sq_eq_abs| "" (SKOSIMP*)
  (("" (CASE "a!1 >= 0")
    (("1" (CASE "b!1 >= 0")
      (("1" (REWRITE "sq_eq") (("1" (GRIND) NIL NIL)) NIL)
       ("2" (CASE-REPLACE "sq(b!1) = sq(-b!1)")
        (("1" (HIDE -1) (("1" (REWRITE "sq_eq") (("1" (GRIND) NIL NIL)) NIL))
          NIL)
         ("2" (HIDE 3) (("2" (EXPAND "sq") (("2" (ASSERT) NIL NIL)) NIL))
          NIL))
        NIL))
      NIL)
     ("2" (CASE "b!1 >= 0")
      (("1" (CASE-REPLACE "sq(a!1) = sq(-a!1)")
        (("1" (HIDE -1) (("1" (REWRITE "sq_eq") (("1" (GRIND) NIL NIL)) NIL))
          NIL)
         ("2" (HIDE 3) (("2" (EXPAND "sq") (("2" (ASSERT) NIL NIL)) NIL))
          NIL))
        NIL)
       ("2" (CASE-REPLACE "sq(a!1) = sq(-a!1)")
        (("1" (CASE-REPLACE "sq(b!1) = sq(-b!1)")
          (("1" (HIDE -1 -2)
            (("1" (REWRITE "sq_eq") (("1" (GRIND) NIL NIL)) NIL)) NIL)
           ("2" (HIDE -1 4) (("2" (EXPAND "sq") (("2" (ASSERT) NIL NIL)) NIL))
            NIL))
          NIL)
         ("2" (HIDE 4) (("2" (EXPAND "sq") (("2" (ASSERT) NIL NIL)) NIL))
          NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|triangle_rectangle| "" (SKOLEM 1 ("a" "b" "c"))
  (("" (FLATTEN)
    (("" (CASE "sq(a)>=0" "sq(b)>=0" "sq(c)>=0")
      (("1" (CASE "sq(a) <= sq(c)")
        (("1" (CASE "sq(b) <= sq(c)")
          (("1" (LEMMA "sq_neg_pos_le")
            (("1" (INST-CP -1 "a" "c")
              (("1" (INST -1 "b" "c") (("1" (GROUND) NIL NIL)) NIL)) NIL))
            NIL)
           ("2" (HIDE 2 -1) (("2" (GROUND) NIL NIL)) NIL))
          NIL)
         ("2" (HIDE 2 -1) (("2" (GROUND) NIL NIL)) NIL))
        NIL)
       ("2" (REWRITE "sq_pos") NIL NIL) ("3" (REWRITE "sq_pos") NIL NIL)
       ("4" (REWRITE "sq_pos") NIL NIL))
      NIL))
    NIL))
  NIL)
 (|triangle_ineq_lt| "" (SKOSIMP*)
  (("" (LEMMA "sq_lt_abs")
    (("" (INST?)
      (("" (ASSERT)
        (("" (LEMMA "sq_lt_abs")
          (("" (INST -1 "b!1" "d!1") (("" (ASSERT) NIL NIL)) NIL)) NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|triangle_ineq_le| "" (SKOSIMP*)
  (("" (LEMMA "sq_le_abs")
    (("" (INST?)
      (("" (ASSERT)
        (("" (LEMMA "sq_le_abs")
          (("" (INST -1 "b!1" "d!1") (("" (ASSERT) NIL NIL)) NIL)) NIL))
        NIL))
      NIL))
    NIL))
  NIL))


$$$sqrt.pvs
sqrt: THEORY
%------------------------------------------------------------------------
%
%  Square root of non-negative real: AXIOMATIC VERSION
%
%  Supercedes older version: sqrt_ax
%
%------------------------------------------------------------------------

BEGIN

  IMPORTING sq    % sq(a): nonneg_real = a*a

  nnx, nny, nnz: VAR nonneg_real
  x,y,z,xx: VAR real

  sqrt_exists: AXIOM
     (EXISTS (f: [nnx: nonneg_real -> {nnz: nonneg_real | nnz * nnz = nnx}]):
                 TRUE)

  sqrt(nnx): {nnz | nnz*nnz = nnx}

  sqrt_pos            : JUDGEMENT sqrt(px: posreal) HAS_TYPE posreal
  sqrt_nnr            : JUDGEMENT sqrt(px: nonneg_real) HAS_TYPE nonneg_real

% -------------------- Special Arguments --------------------

  sqrt_0              : LEMMA  sqrt(0) = 0
  sqrt_1              : LEMMA  sqrt(1) = 1
  sqrt_eq_0           : LEMMA  sqrt(nnx) = 0 IMPLIES nnx = 0

% -------------------- Basic Properties --------------------

  sqrt_lem            : LEMMA  sqrt(nny) = nnz IFF nnz * nnz = nny
                               
  sqrt_def            : LEMMA  sqrt(nnx) * sqrt(nnx) = nnx

  sqrt_square         : LEMMA  sqrt(nnx * nnx) = nnx

  sqrt_sq             : LEMMA  x >= 0 IMPLIES sqrt(sq(x)) = x

  sqrt_sq_abs         : LEMMA  sqrt(sq(x)) = abs(x)

  sq_sqrt             : LEMMA  x >= 0 IMPLIES sq(sqrt(x))=x

  sqrt_times          : LEMMA  sqrt(nny * nnz) = sqrt(nny) * sqrt(nnz)

  sqrt_div            : LEMMA  nnz /= 0 IMPLIES 
                                   sqrt(nny / nnz) = sqrt(nny) / sqrt(nnz)

% --------------------- Inequalities --------------------
                               
  sqrt_lt             : LEMMA  sqrt(nny) < sqrt(nnz) IFF nny < nnz 

  sqrt_le             : LEMMA  sqrt(nny) <= sqrt(nnz) IFF nny <= nnz 

  sqrt_gt             : LEMMA  sqrt(nny) > sqrt(nnz) IFF nny > nnz 

  sqrt_ge             : LEMMA  sqrt(nny) >= sqrt(nnz) IFF nny >= nnz 

  sqrt_eq             : LEMMA  sqrt(nny) = sqrt(nnz) IFF nny = nnz  

  sqrt_less           : LEMMA  nnx > 1 IMPLIES sqrt(nnx) < nnx

  sqrt_more           : LEMMA  nnx > 0 AND nnx < 1 IMPLIES sqrt(nnx) > nnx


END sqrt


$$$sqrt.prf
(|sqrt| (|sqrt_TCC1| "" (LEMMA "sqrt_exists") (("" (PROPAX) NIL NIL)) NIL)
 (|sqrt_pos| "" (SKOSIMP*) (("" (ASSERT) NIL NIL)) NIL)
 (|sqrt_0| "" (TYPEPRED "sqrt(0)")
  (("" (LEMMA "zero_times3") (("" (INST?) (("" (GROUND) NIL NIL)) NIL)) NIL))
  NIL)
 (|sqrt_1| "" (TYPEPRED "sqrt(1)")
  (("" (LEMMA "sqrt_1") (("" (INST?) (("" (GROUND) NIL NIL)) NIL)) NIL)) NIL)
 (|sqrt_eq_0| "" (SKOSIMP*)
  (("" (TYPEPRED "sqrt(nnx!1)")
    (("" (LEMMA "both_sides_expt2")
      (("" (INST -1 "2" "_" "_")
        (("" (EXPAND "^")
          (("" (EXPAND "expt")
            (("" (EXPAND "expt")
              (("" (EXPAND "expt")
                (("" (INST?)
                  (("1" (ASSERT) NIL NIL) ("2" (ASSERT) NIL NIL)
                   ("3" (ASSERT) NIL NIL))
                  NIL))
                NIL))
              NIL))
            NIL))
          NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|sqrt_lem| "" (SKOSIMP*)
  (("" (GROUND)
    (("" (TYPEPRED "sqrt(nny!1)")
      (("" (REPLACE -2 - RL)
        (("" (HIDE -1 -2)
          (("" (LEMMA "both_sides_expt2")
            (("" (INST -1 "2" "_" "_")
              (("" (EXPAND "^")
                (("" (EXPAND "expt")
                  (("" (EXPAND "expt")
                    (("" (EXPAND "expt")
                      (("" (CASE-REPLACE "nnz!1 = 0")
                        (("1" (LEMMA "zero_times3")
                          (("1" (HIDE -2 -3)
                            (("1" (INST -1 "sqrt(nny!1)" "sqrt(nny!1)")
                              (("1" (GROUND) NIL NIL)) NIL))
                            NIL))
                          NIL)
                         ("2" (CASE-REPLACE "sqrt(nny!1) = 0")
                          (("1" (HIDE -1)
                            (("1" (LEMMA "zero_times3")
                              (("1" (HIDE -2)
                                (("1" (INST?) (("1" (GROUND) NIL NIL)) NIL))
                                NIL))
                              NIL))
                            NIL)
                           ("2" (INST?)
                            (("1" (GROUND) NIL NIL) ("2" (ASSERT) NIL NIL)
                             ("3" (ASSERT) NIL NIL))
                            NIL))
                          NIL))
                        NIL))
                      NIL))
                    NIL))
                  NIL))
                NIL))
              NIL))
            NIL))
          NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|sqrt_def| "" (SKOSIMP*)
  (("" (TYPEPRED "sqrt(nnx!1)") (("" (PROPAX) NIL NIL)) NIL)) NIL)
 (|sqrt_square| "" (SKOSIMP*)
  (("" (TYPEPRED "sqrt(nnx!1 * nnx!1)")
    (("" (CASE-REPLACE "nnx!1 = 0")
      (("1" (ASSERT)
        (("1" (LEMMA "zero_times3")
          (("1" (INST?) (("1" (GROUND) NIL NIL)) NIL)) NIL))
        NIL)
       ("2" (CASE-REPLACE "sqrt(nnx!1 * nnx!1) = 0")
        (("1" (LEMMA "zero_times3")
          (("1" (INST?) (("1" (GROUND) NIL NIL)) NIL)) NIL)
         ("2" (LEMMA "both_sides_expt2")
          (("2" (INST -1 "2" "_" "_")
            (("2" (EXPAND "^")
              (("2" (EXPAND "expt")
                (("2" (EXPAND "expt")
                  (("2" (EXPAND "expt")
                    (("2" (INST?)
                      (("1" (ASSERT) NIL NIL) ("2" (ASSERT) NIL NIL)
                       ("3" (ASSERT) NIL NIL))
                      NIL))
                    NIL))
                  NIL))
                NIL))
              NIL))
            NIL))
          NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|sqrt_sq| "" (SKOSIMP*)
  (("" (EXPAND "sq") (("" (REWRITE "sqrt_square") NIL NIL)) NIL)) NIL)
 (|sqrt_sq_abs| "" (SKOSIMP*)
  (("" (CASE "x!1 >= 0")
    (("1" (EXPAND "sq")
      (("1" (REWRITE "sqrt_square")
        (("1" (EXPAND "abs") (("1" (ASSERT) NIL NIL)) NIL)) NIL))
      NIL)
     ("2" (LEMMA "sq_neg")
      (("2" (INST?)
        (("2" (REPLACE -1 :HIDE? T :DIR RL)
          (("2" (EXPAND "sq")
            (("2" (REWRITE "sqrt_square")
              (("2" (EXPAND "abs") (("2" (ASSERT) NIL NIL)) NIL)) NIL))
            NIL))
          NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|sq_sqrt| "" (SKOSIMP*)
  (("" (EXPAND "sq") (("" (REWRITE "sqrt_def") NIL NIL)) NIL)) NIL)
 (|sqrt_times| "" (SKOSIMP*)
  (("" (CASE "sqrt(nny!1) = 0 OR  sqrt(nnz!1) = 0")
    (("1" (GROUND) NIL NIL)
     ("2" (FLATTEN)
      (("2" (LEMMA "both_sides_expt2")
        (("2" (INST -1 "2" "_" "_")
          (("2" (EXPAND "^")
            (("2" (EXPAND "expt")
              (("2" (EXPAND "expt")
                (("2" (EXPAND "expt")
                  (("2"
                    (INST -1 "sqrt(nny!1) * sqrt(nnz!1)"
                     "sqrt(nny!1 * nnz!1)")
                    (("1" (FLATTEN) (("1" (ASSERT) NIL NIL)) NIL)
                     ("2" (ASSERT)
                      (("2" (CASE-REPLACE "sqrt(nny!1 * nnz!1) = 0")
                        (("1" (LEMMA "sqrt_eq_0")
                          (("1" (INST -1 "nny!1*nnz!1")
                            (("1" (ASSERT)
                              (("1" (LEMMA "zero_times3")
                                (("1" (INST?) (("1" (ASSERT) NIL NIL)) NIL))
                                NIL))
                              NIL))
                            NIL))
                          NIL)
                         ("2" (ASSERT)
                          (("2" (TYPEPRED "sqrt(nny!1 * nnz!1)")
                            (("2" (ASSERT) NIL NIL)) NIL))
                          NIL))
                        NIL))
                      NIL)
                     ("3" (CASE-REPLACE "sqrt(nny!1) * sqrt(nnz!1) = 0")
                      (("1" (LEMMA "zero_times3")
                        (("1" (INST?) (("1" (ASSERT) NIL NIL)) NIL)) NIL)
                       ("2" (ASSERT) NIL NIL))
                      NIL))
                    NIL))
                  NIL))
                NIL))
              NIL))
            NIL))
          NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|sqrt_div_TCC1| "" (SKOSIMP*) (("" (REWRITE "pos_div_ge") NIL NIL)) NIL)
 (|sqrt_div_TCC2| "" (SUBTYPE-TCC) NIL NIL)
 (|sqrt_div| "" (SKOSIMP*)
  (("" (LEMMA "sqrt_sq")
    (("" (INST -1 "sqrt(nny!1)/sqrt(nnz!1)")
      (("1" (GROUND)
        (("1" (HIDE 2 3)
          (("1" (LEMMA "sqrt_pos")
            (("1" (INST -1 "nny!1")
              (("1" (REWRITE "pos_div_ge") NIL NIL)
               ("2" (CASE-REPLACE "nny!1=0")
                (("1" (REWRITE "sqrt_0") (("1" (ASSERT) NIL NIL)) NIL)
                 ("2" (GROUND) NIL NIL))
                NIL))
              NIL))
            NIL))
          NIL))
        NIL)
       ("2" (LEMMA "sqrt_eq_0") (("2" (INST?) (("2" (ASSERT) NIL NIL)) NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|sqrt_lt| "" (SKOSIMP*)
  (("" (GROUND)
    (("1" (LEMMA "gt_times_gt_pos1")
      (("1" (INST -1 "sqrt(nny!1)" "sqrt(nny!1)" "sqrt(nnz!1)" "sqrt(nnz!1)")
        (("1" (ASSERT) NIL NIL)) NIL))
      NIL)
     ("2" (TYPEPRED "sqrt(nny!1)")
      (("2" (REPLACE -2 - RL)
        (("2" (HIDE -2)
          (("2" (TYPEPRED "sqrt(nnz!1)")
            (("2" (REPLACE -2 - RL)
              (("2" (HIDE -1 -2 -3)
                (("2" (LEMMA "both_sides_expt_pos_lt_aux")
                  (("2" (INST -1 "1" "sqrt(nny!1)" "sqrt(nnz!1)")
                    (("2" (EXPAND "expt")
                      (("2" (EXPAND "expt")
                        (("2" (EXPAND "expt") (("2" (PROPAX) NIL NIL)) NIL))
                        NIL))
                      NIL))
                    NIL))
                  NIL))
                NIL))
              NIL))
            NIL))
          NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|sqrt_le| "" (SKOSIMP*)
  (("" (LEMMA "sqrt_lt")
    (("" (INST -1 "nny!1" "nnz!1") (("" (GROUND) NIL NIL)) NIL)) NIL))
  NIL)
 (|sqrt_gt| "" (SKOSIMP*)
  (("" (LEMMA "sqrt_lt")
    (("" (INST -1 "nny!1" "nnz!1") (("" (ASSERT) (("" (GROUND) NIL NIL)) NIL))
      NIL))
    NIL))
  NIL)
 (|sqrt_ge| "" (SKOSIMP*)
  (("" (LEMMA "sqrt_le")
    (("" (INST -1 "nny!1" "nnz!1") (("" (GROUND) NIL NIL)) NIL)) NIL))
  NIL)
 (|sqrt_eq| "" (SKOSIMP*) (("" (GROUND) NIL NIL)) NIL)
 (|sqrt_less| "" (SKOSIMP*)
  (("" (TYPEPRED "sqrt(nnx!1)")
    (("" (LEMMA "both_sides_expt_pos_gt_aux")
      (("" (INST -1 "1" "nnx!1" "sqrt(nnx!1)")
        (("1" (FLATTEN)
          (("1" (HIDE -2)
            (("1" (ASSERT)
              (("1" (EXPAND "expt")
                (("1" (EXPAND "expt")
                  (("1" (EXPAND "expt")
                    (("1" (REPLACE -2)
                      (("1" (HIDE -2 2)
                        (("1" (LEMMA "both_sides_times_pos_gt1")
                          (("1" (INST -1 "nnx!1" "nnx!1" "1")
                            (("1" (ASSERT) NIL NIL)) NIL))
                          NIL))
                        NIL))
                      NIL))
                    NIL))
                  NIL))
                NIL))
              NIL))
            NIL))
          NIL)
         ("2" (CASE-REPLACE "sqrt(nnx!1) = 0")
          (("1" (ASSERT) NIL NIL) ("2" (ASSERT) NIL NIL)) NIL)
         ("3" (ASSERT) NIL NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|sqrt_more| "" (SKOSIMP*)
  (("" (TYPEPRED "sqrt(nnx!1)")
    (("" (LEMMA "both_sides_expt_pos_gt_aux")
      (("" (INST -1 "1" "sqrt(nnx!1)" "nnx!1")
        (("1" (FLATTEN)
          (("1" (HIDE -2)
            (("1" (ASSERT)
              (("1" (EXPAND "expt")
                (("1" (EXPAND "expt")
                  (("1" (EXPAND "expt")
                    (("1" (REPLACE -2)
                      (("1" (HIDE -2 2)
                        (("1" (LEMMA "both_sides_times_pos_gt1")
                          (("1" (INST -1 "nnx!1" "1" "nnx!1")
                            (("1" (ASSERT) NIL NIL)) NIL))
                          NIL))
                        NIL))
                      NIL))
                    NIL))
                  NIL))
                NIL))
              NIL))
            NIL))
          NIL)
         ("2" (ASSERT) NIL NIL))
        NIL))
      NIL))
    NIL))
  NIL))


$$$factorial.pvs
factorial: THEORY
BEGIN
 
   n: VAR nat

   factorial(n): recursive posnat =
          (if n = 0 then 1 else n*factorial(n-1) endif) MEASURE n

END factorial

$$$factorial.prf
(|factorial| (|factorial_TCC1| "" (SUBTYPE-TCC) NIL NIL)
 (|factorial_TCC2| "" (TERMINATION-TCC) NIL NIL)
 (|factorial_TCC3| "" (INDUCT "n" 1)
  (("1" (SKOSIMP*) NIL NIL) ("2" (SKOSIMP*) (("2" (ASSERT) NIL NIL)) NIL)
   ("3" (HIDE 2) (("3" (SKOSIMP*) (("3" (ASSERT) NIL NIL)) NIL)) NIL))
  NIL)
 (|factorial_pos| "" (INDUCT "n" 1)
  (("1" (GRIND) NIL NIL)
   ("2" (SKOSIMP*) (("2" (EXPAND "factorial" 1) (("2" (ASSERT) NIL NIL)) NIL))
    NIL))
  NIL))

$$$algebra_probs.pvs
algebra_probs: THEORY
%------------------------------------------------------------------------------
%
%  Test Suite design to explore the capabilities/efficiency of theorem provers 
%  for nonlinear arithmetic and algebraic manipulations.
%
%  Author: Ricky W. Butler    NASA Langley
%
%------------------------------------------------------------------------------
BEGIN

   a,b,c,d,t,r,x,y,z: VAR real
   pa,pb,pc,pd,px,py,pz: VAR posreal
   zn,yn,xn,wn:    VAR nzreal
   nnx,nny,nnz: VAR nonneg_real
   n,j: VAR nat

   IMPORTING factorial
   IMPORTING sqrt, sqrt_rew

   t1: LEMMA x * yn / zn -  r * (yn / zn) = 0
             IMPLIES   r = x

   t2: LEMMA (1 + n) * (a-x)^ n * x / factorial(1 + n) =
             (a-x)^ n * x / factorial(n)

   t3: LEMMA abs(x)^2 + 3*abs(x) - 10 = 0 IMPLIES
             x = 2 OR x = -2


   t4: LEMMA x*(x-2*y) >= - y*y

   t5: LEMMA x^4 - y^4 = 0 AND x+y = a AND a > 0
             IMPLIES x = a/2 AND y = a/2

   t6: LEMMA pa/pb < pc/pd IMPLIES pa/pb < (pa+pc)/(pb+pd) AND
                                    (pa+pc)/(pb+pd) < pc/pd


   expt_of_mult: AXIOM  %  from Dutertre's exponent_props
                 expt(x * y, n) = expt(x, n) * expt(y, n)
  

   t7: LEMMA 2^(n+j) = 6^j IMPLIES 2^n/3^j = 1



   t8: LEMMA sq(a) + sq(b) = 1 AND sq(x) + sq(y) = 1 IMPLIES
             a*x + b*y <= 1

   t9: LEMMA sq(x) + 5*sq(y) >= 4*x*y

   t10: LEMMA x/pa > y AND y/pb > pc AND pa*pc > r IMPLIES
                  x > pb*r

   t11: LEMMA a >= 0 AND b >= 0 AND c >= 0 IMPLIES a + (a + b + c)/(x*x+1) >= 0

   t12: LEMMA x/pa > y AND y/pb > z AND z > 0 IMPLIES x > 0

   t13: LEMMA sqrt(8*nnx) - sqrt(2*nnx) = a IMPLIES nnx = sq(a)/2

   t14: LEMMA sqrt(sq(x)) + sqrt(sq(x-1)) = 1 IMPLIES sq(x) <= 1

   t15: LEMMA sqrt(sq(x)) + sqrt(sq(x-1)) = 1 IMPLIES
              0 <= x AND x <= 1

   i: VAR posnat
   sin_term(a)(i) : real = (-1)^(i-1) * a^(2*i-1)/factorial(2*i-1)
 
   t16: LEMMA n > 0 IMPLIES sin_term(a)(n+1) =
                              sin_term(a)(n) * -1 * a*a / ((2*n+1) * 2*n)

   t17: LEMMA abs(x) < 1 IMPLIES
                 x^(1+j) + (1 - x^(1+j)) / (1 - x) = (1 - x^(2+j)) / (1 - x)


   t18: LEMMA (4*x - 5) /= 0 IMPLIES
                  (64*x^3 - 125)/(4*x - 5) = 16*x^2 + 20*x + 25

   t19: LEMMA x /= 0 AND y /= 0 IMPLIES 3*x^2*y^3/(6*x*y^4) = x/(2*y)

   t20: LEMMA (zn+1)/zn^3 + (zn^2 - zn)/zn^4 = 2/zn^2

   t21: LEMMA b*c*a*y*x /= 0 IMPLIES
              a^3*b^2*c^3/(b^2*c*a) - x^4*y^3/(y*x^2) = (a*c + x*y)*(a*c - x*y)

   t22: LEMMA (x >= 0 AND y >= 0
               AND (sqrt(7*y) - sqrt(3*x)) /= 0 AND (7*y-3*x) /= 0) 
               IMPLIES
                 5/(sqrt(7*y) - sqrt(3*x)) = 5*(sqrt(7*y) + sqrt(3*x))/(7*y-3*x)

   t23: LEMMA sq(x) + x - 12 >= 0 IMPLIES x <= -4 OR x >= 3

   t24: LEMMA (x + a)^3 - x^3 = a*(3*x^2 + 3*x*a + a^2) 

   t25: LEMMA sqrt(pa)*sqrt(pb)*sqrt(pc)*sqrt(pd) = 8 
              AND pc = 2*pb AND pd = 2*pc AND pa = 2*pd
              IMPLIES pb = 1 OR pb = -1

   t26: LEMMA x > 1 IMPLIES sqrt(x-1)/sqrt(x+1) = 2 IMPLIES sq(x) = 4

   t27: LEMMA (px+2)*(y-3) = (px+2) IMPLIES y = 4

   t28: LEMMA px + py = 2 IMPLIES px*py <= 1

   t29: LEMMA sq(xn) > abs(n*xn) AND sqrt(sq(xn) + n*xn + 1) = xn+1 
                       IMPLIES n = 2

   t30: LEMMA px >= 1 IMPLIES sq(px/py) >= sq(1/py)

   t31: LEMMA (2*x-3) /= 0 IMPLIES
                 -5 * (2*x + 3)/ (2*x-3) < 1 IMPLIES x > -1 OR x < -1

   t32: LEMMA 2*x - 3*y = 10 AND 3*x + 2*y = 2 IMPLIES y = -2

   t33: LEMMA 2*x - 3*y = 10 AND 3*x + n*y = 2 IMPLIES y = -26/(9+2*n)
   
   t34: LEMMA pb <= 1 AND sqrt(1+sqrt(pa)) >= sqrt(1-sqrt(pb)) IMPLIES
                 (pa-pb)/(sqrt(pa)+sqrt(pb)) >= -2

   t35: LEMMA factorial(n + 2) - factorial(n) = factorial(n)*(sq(n) + 3*n + 1) 

   t36: LEMMA t > 1 AND a >= 0 AND b >= 0 AND c >= 0 AND d >= 0 AND % NYSMTJ 87
              (a*t + b)*(c*t + d) = (b*t + a)*(d*t + c) AND
              d + c = 2*(a+b) IMPLIES
                     d = 2*a AND c = 2*b

   t37: LEMMA (factorial(n + 3) - factorial(n+1))/(n+1) = 
                   factorial(n)*(sq(n) + 5*n + 5) 

   t38: LEMMA (x+1) /= 0 AND (y+1) /= 0 
                 IMPLIES (x+1)^5*(y+1)^4/((x+1)^4*(y+1)^6) = (x+1)/(y+1)^2

   t39: LEMMA (FORALL x: 2*sq(x) + 3 = a*sq(x) + b) IMPLIES a*b = 6

   t40: LEMMA pa < pb IMPLIES (pa-1)/pa < (pb-1)/pb

   t41: LEMMA pa < pb IMPLIES 3*sq(pa) < sq(pa) + pa*pb +sq(pb) 

   t42: LEMMA pa < pb IMPLIES sq(pa) + pa*pb +sq(pb) < 3*sq(pb) 

   t43: LEMMA (px+py) < px*py  IMPLIES 1/px + 1/py <= 1

   t44: LEMMA px > 1 IMPLIES sqrt(sq(px) - 1)/sqrt(px+1) = sqrt(px-1)

   t45: LEMMA 1 + x > 0 IMPLIES (1+x)^n >= 1 + n*x

   t46: LEMMA px^3 + py^3 >= sq(px)*py + px*sq(py)

   t47: LEMMA px + 1/px >= 2


   t48: LEMMA px + py = 1 IMPLIES sq(px) + sq(py) >= 1/2

   t50: LEMMA factorial(n)/factorial(n+1) <= 1

   t51: LEMMA (x + 1) /= 0 AND (y + 1) /= 0 
                 IMPLIES ((x + 1) ^ 8 * (y + 1) ^ 12) /= 0;


%  --------------------- Uninterpreted Functions ---------------------

   P: VAR [real -> bool]
   Pb: VAR [bool -> bool]
   f: VAR [real -> real]
   g: VAR [real,real -> real]
   h: VAR [real,bool,real -> real]

   t52: LEMMA x > 1 AND P(sqrt(sq(x) - 1)/sqrt(x-1)) IMPLIES P(sqrt(x+1))

   t53: LEMMA b /= 0 IMPLIES f(sq(b*x)-sq(a)) = f(sq(b)*(x-a/b)*(x+a/b))

   t54: LEMMA a /= 0 AND b /= 0 IMPLIES
                 g(a^3*b^6/(a*b^3),sq(x)-1) = g(a^4*b^3/a^2,(x+1)*(x-1))

   t55: LEMMA Pb(px > pa) IMPLIES Pb(sq(px) > sq(pa))
 
   t56: LEMMA h((x + a)^3 - x^3, x*x*x > 0, (sq(xn)+1)/xn)
              = h(a*(3*x^2 + 3*x*a + a^2), x > 0, xn^(-1)+xn)

   t57: LEMMA a > 1 AND b > 1 AND a > b IMPLIES
                   1 + (a-1)/floor((a-1)/(b-1)) >= b

   t60: LEMMA abs(a) <= 1 IMPLIES 1 - sq(a) >= 0

   t61: LEMMA b > a IMPLIES (b - a) / (1 + floor((b - a) / pd)) < pd

end algebra_probs

$$$algebra_probs.prf
(|algebra_probs|
 (|t1| "" (SKOSIMP*)
  (("" (MOVE-TERMS -1 L 2)
    (("" (MULT-BY -1 "zn!1/yn!1") (("" (ASSERT) NIL NIL)) NIL)) NIL))
  NIL)
 (|t2_TCC1| "" (SUBTYPE-TCC) NIL NIL)
 (|t2| "" (SKOSIMP*)
  (("" (NAME-REPLACE AXN "(a!1-x!1)^n!1")
    (("" (CASE-REPLACE "factorial(1 + n!1) = (1+n!1)*factorial(n!1)")
      (("1" (HIDE -1)
        (("1" (NAME-REPLACE N1 "1+n!1") (("1" (ASSERT) NIL NIL)) NIL)) NIL)
       ("2" (HIDE 2)
        (("2" (EXPAND "factorial" + 1) (("2" (PROPAX) NIL NIL)) NIL)) NIL))
      NIL))
    NIL))
  NIL)
 (|t3_TCC1| "" (SUBTYPE-TCC) NIL NIL)
 (|t3| "" (SKOSIMP*)
  ((""
    (CASE-REPLACE
     "abs(x!1)^2 + 3 * abs(x!1) - 10 = (abs(x!1) + 5)*(abs(x!1) - 2)")
    (("1" (HIDE -1) (("1" (MULT-CASES -1) (("1" (GRIND) NIL NIL)) NIL)) NIL)
     ("2" (HIDE -1 2 3) (("2" (GRIND :EXCLUDE "abs") NIL NIL)) NIL))
    NIL))
  NIL)
 (|t4| "" (SKOSIMP*)
  (("" (ASSERT)
    (("" (MOVE-TERMS 1 R 1)
      (("" (ASSERT)
        (("" (INVOKE (CASE "%1 = sq(x!1 - y!1)") (? 1 "(%1 >= 0)"))
          (("1" (ASSERT) NIL NIL)
           ("2" (HIDE 2) (("2" (EXPAND "sq") (("2" (ASSERT) NIL NIL)) NIL))
            NIL))
          NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|t5_TCC1| "" (SUBTYPE-TCC) NIL NIL)
 (|t5| "" (SKOSIMP*)
  (("" (AUTO-REWRITE-THEORY "real_props")
    ((""
      (CASE-REPLACE "x!1 ^ 4 - y!1 ^ 4 =  (x!1+y!1)*(x!1-y!1)*(x!1^2+y!1^2)")
      (("1" (HIDE -1)
        (("1" (NAME-REPLACE "TWTR" "(x!1 + y!1) * (x!1 - y!1)")
          (("1" (MULT-CASES -1)
            (("1" (REVEAL -1)
              (("1" (REPLACE -1 * RL)
                (("1" (HIDE -1) (("1" (MULT-CASES -1) NIL NIL)) NIL)) NIL))
              NIL)
             ("2" (CASE-REPLACE "x!1 = 0 AND y!1 = 0")
              (("1" (GROUND) NIL NIL)
               ("2" (HIDE -2 2)
                (("2" (CASE-REPLACE "x!1^2 = 0 AND y!1^2 = 0")
                  (("1" (HIDE -2) (("1" (GRIND) NIL NIL)) NIL)
                   ("2" (HIDE 2)
                    (("2" (CASE "x!1 ^ 2 >= 0")
                      (("1" (CASE "y!1 ^ 2 >= 0")
                        (("1" (ASSERT) NIL NIL)
                         ("2" (HIDE -1 -2 -3 2) (("2" (GRIND) NIL NIL)) NIL))
                        NIL)
                       ("2" (HIDE -1 -2 2) (("2" (GRIND) NIL NIL)) NIL))
                      NIL))
                    NIL))
                  NIL))
                NIL))
              NIL))
            NIL))
          NIL))
        NIL)
       ("2" (HIDE -1 -2 2) (("2" (GRIND) NIL NIL)) NIL))
      NIL))
    NIL))
  NIL)
 (|t6| "" (SKOSIMP*)
  (("" (AUTO-REWRITE-THEORY "real_props") (("" (ASSERT) NIL NIL)) NIL)) NIL)
 (|t7| "" (SKOSIMP*)
  (("" (REWRITE "expt_plus")
    (("" (CASE-REPLACE "6 ^ j!1 = 2^j!1*3^j!1")
      (("1" (HIDE -1) (("1" (DIV-BY -1 "2^j!1") (("1" (ASSERT) NIL NIL)) NIL))
        NIL)
       ("2" (HIDE -1 2)
        (("2" (EXPAND "^") (("2" (REWRITE "expt_of_mult" :DIR RL) NIL NIL))
          NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|t8| "" (SKOSIMP*)
  (("" (AUTO-REWRITE-THEORY "real_props")
    (("" (CASE "sq(a!1-x!1) >= 0")
      (("1" (CASE "sq(b!1-y!1) >= 0")
        (("1" (CASE "sq(b!1 - y!1) + sq(a!1 - x!1) >= 0")
          (("1" (GRIND) NIL NIL) ("2" (ASSERT) NIL NIL)) NIL)
         ("2" (ASSERT) NIL NIL))
        NIL)
       ("2" (ASSERT) NIL NIL))
      NIL))
    NIL))
  NIL)
 (|t9| "" (SKOSIMP*)
  (("" (CASE "sq(x!1 - 2*y!1) >= 0")
    (("1" (EXPAND "sq") (("1" (ASSERT) NIL NIL)) NIL)
     ("2" (HIDE 2) (("2" (ASSERT) NIL NIL)) NIL))
    NIL))
  NIL)
 (|t10| "" (SKOSIMP*)
  (("" (AUTO-REWRITE-THEORY "real_props")
    (("" (ASSERT)
      (("" (MULT-BY -2 "pa!1")
        (("" (ASSERT) (("" (MULT-BY -3 "pb!1") (("" (ASSERT) NIL NIL)) NIL))
          NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|t11_TCC1| "" (SUBTYPE-TCC) NIL NIL)
 (|t11| "" (SKOSIMP*)
  (("" (HAS-SIGN (! 1 L 2) 0+)
    (("1" (ASSERT) NIL NIL)
     ("2" (HIDE 2)
      (("2" (MULT-BY 1 "(x!1 * x!1 + 1)") (("2" (ASSERT) NIL NIL)) NIL)) NIL))
    NIL))
  NIL)
 (|t12| "" (SKOSIMP*)
  (("" (CROSS-MULT -1)
    (("" (CROSS-MULT -2)
      (("" (MULT-BY -2 "pa!1")
        (("" (ASSERT)
          (("" (CASE-REPLACE "pa!1 * pb!1 * z!1 >= 0")
            (("1" (ASSERT) NIL NIL) ("2" (MULT-CASES 1) NIL NIL)) NIL))
          NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|t13| "" (SKOSIMP*)
  (("" (AUTO-REWRITE-THEORY "sqrt_rew")
    (("" (TRANSFORM-BOTH -1 "sq(%1)")
      (("1" (HIDE -2) (("1" (GRIND) NIL NIL)) NIL) ("2" (ASSERT) NIL NIL))
      NIL))
    NIL))
  NIL)
 (|t14| "" (SKOSIMP*)
  (("" (REWRITE "sqrt_sq_abs")
    (("" (REWRITE "sqrt_sq_abs")
      (("" (GRIND)
        (("" (MOVE-TERMS -1 L 2)
          (("" (ASSERT) (("" (MULT-INEQ -1 -1) (("" (ASSERT) NIL NIL)) NIL))
            NIL))
          NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|t15| "" (SKOSIMP*)
  (("" (AUTO-REWRITE-THEORY "sqrt_rew")
    (("" (ASSERT) (("" (GRIND) NIL NIL)) NIL)) NIL))
  NIL)
 (|sin_term_TCC1| "" (SUBTYPE-TCC) NIL NIL)
 (|sin_term_TCC2| "" (SUBTYPE-TCC) NIL NIL)
 (|t16_TCC1| "" (SUBTYPE-TCC) NIL NIL)
 (|t16| "" (SKOSIMP*)
  (("" (AUTO-REWRITE-THEORY "real_props")
    (("" (EXPAND "sin_term")
      (("" (EXPAND "factorial" 1 1)
        (("" (EXPAND "factorial" 1 1)
          (("" (EXPAND "factorial" 1 2)
            (("" (LIFT-IF)
              (("" (ASSERT)
                (("" (NAME-REPLACE "F2n" "factorial(2 * n!1 - 1) ")
                  ((""
                    (NAME-REPLACE "DD"
                     "(2 * (F2n * n!1) + 4 * (F2n * n!1 * n!1))")
                    (("" (GRIND) NIL NIL)) NIL))
                  NIL))
                NIL))
              NIL))
            NIL))
          NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|t17_TCC1| "" (SUBTYPE-TCC) NIL NIL) (|t17_TCC2| "" (SUBTYPE-TCC) NIL NIL)
 (|t17_TCC3| "" (SUBTYPE-TCC) NIL NIL)
 (|t17| "" (SKOSIMP*)
  (("" (MULT-BY 1 "1-x!1")
    (("" (NAME-REPLACE "QQ" "(1 - x!1)")
      ((""
        (CASE-REPLACE
         "(x!1 ^ (1 + j!1) + (1 - x!1 ^ (1 + j!1)) / QQ) * QQ =   (x!1 ^ (1 + j!1)*QQ + (1 - x!1 ^ (1 + j!1)))")
        (("1" (HIDE -1)
          (("1" (REVEAL -2)
            (("1" (REPLACE -1 * RL)
              (("1" (ASSERT)
                (("1" (CASE-REPLACE "x!1 ^ (2 + j!1) = x!1*x!1 ^ (1 + j!1)")
                  (("1" (ASSERT) NIL NIL)
                   ("2" (HIDE -1 -2 2)
                    (("2" (EXPAND "^")
                      (("2" (EXPAND "expt" 1 1) (("2" (PROPAX) NIL NIL)) NIL))
                      NIL))
                    NIL))
                  NIL))
                NIL))
              NIL))
            NIL))
          NIL)
         ("2" (HIDE 2) (("2" (ASSERT) NIL NIL)) NIL)
         ("3" (ASSERT) (("3" (REVEAL -1) (("3" (ASSERT) NIL NIL)) NIL)) NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|t18_TCC1| "" (SUBTYPE-TCC) NIL NIL) (|t18_TCC2| "" (SUBTYPE-TCC) NIL NIL)
 (|t18| "" (SKOSIMP*)
  (("" (MULT-BY 2 "(4 * x!1 - 5)") (("" (GRIND) NIL NIL)) NIL)) NIL)
 (|t19_TCC1| "" (SUBTYPE-TCC) NIL NIL) (|t19_TCC2| "" (SUBTYPE-TCC) NIL NIL)
 (|t19_TCC3| "" (SUBTYPE-TCC) NIL NIL)
 (|t19_TCC4| "" (SKOSIMP*)
  (("" (MULT-CASES -1)
    (("" (GRIND)
      (("" (MULT-CASES -1)
        (("" (MULT-CASES -1) (("" (MULT-CASES -1) NIL NIL)) NIL)) NIL))
      NIL))
    NIL))
  NIL)
 (|t19_TCC5| "" (SUBTYPE-TCC) NIL NIL)
 (|t19| "" (SKOSIMP*) (("" (GRIND) NIL NIL)) NIL)
 (|t20_TCC1| "" (SUBTYPE-TCC) NIL NIL)
 (|t20_TCC2| "" (SKOSIMP*)
  (("" (GRIND) (("" (MULT-CASES -1) (("" (MULT-CASES -1) NIL NIL)) NIL)) NIL))
  NIL)
 (|t20_TCC3| "" (SUBTYPE-TCC) NIL NIL) (|t20_TCC4| "" (SUBTYPE-TCC) NIL NIL)
 (|t20_TCC5| "" (SKOSIMP*)
  (("" (GRIND)
    (("" (MULT-CASES -1)
      (("" (MULT-CASES -1) (("" (MULT-CASES -1) NIL NIL)) NIL)) NIL))
    NIL))
  NIL)
 (|t20_TCC6| "" (SKOSIMP*) (("" (GRIND) (("" (MULT-CASES -1) NIL NIL)) NIL))
  NIL)
 (|t20| "" (SKOSIMP*)
  (("" (MULT-BY 1 "zn!1^4")
    (("1" (AUTO-REWRITE-THEORY "real_props")
      (("1" (ASSERT)
        (("1" (CASE "2 / zn!1 ^ 2 * zn!1 ^ 4 = 2*zn!1^2")
          (("1" (REPLACE -1)
            (("1" (HIDE -1)
              (("1"
                (CASE-REPLACE
                 "zn!1 ^ 4 * ((1 + zn!1) / zn!1 ^ 3) = zn!1 * (1 + zn!1)")
                (("1" (HIDE -1)
                  (("1"
                    (CASE-REPLACE
                     "zn!1 ^ 4 * ((zn!1 ^ 2 - zn!1) / zn!1 ^ 4) = (zn!1 ^ 2 - zn!1)")
                    (("1" (HIDE -1) (("1" (GRIND) NIL NIL)) NIL)
                     ("2" (HIDE 2) (("2" (GRIND) NIL NIL)) NIL)
                     ("3" (HIDE 2) (("3" (GRIND) NIL NIL)) NIL))
                    NIL))
                  NIL)
                 ("2" (HIDE 2) (("2" (GRIND) NIL NIL)) NIL)
                 ("3" (HIDE 2) (("3" (GRIND) NIL NIL)) NIL))
                NIL))
              NIL))
            NIL)
           ("2" (HIDE 2) (("2" (GRIND) NIL NIL)) NIL)
           ("3" (HIDE 2) (("3" (GRIND) NIL NIL)) NIL))
          NIL))
        NIL))
      NIL)
     ("2" (ASSERT)
      (("2" (HIDE 2) (("2" (GRIND) (("2" (MULT-CASES -1) NIL NIL)) NIL)) NIL))
      NIL)
     ("3" (HIDE 2)
      (("3" (GRIND)
        (("3" (MULT-CASES -1) (("3" (MULT-CASES -1) NIL NIL)) NIL)) NIL))
      NIL)
     ("4" (HIDE 2)
      (("4" (GRIND)
        (("4" (MULT-CASES -1)
          (("4" (MULT-CASES -1) (("4" (MULT-CASES -1) NIL NIL)) NIL)) NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|t21_TCC1| "" (SUBTYPE-TCC) NIL NIL) (|t21_TCC2| "" (SUBTYPE-TCC) NIL NIL)
 (|t21_TCC3| "" (SUBTYPE-TCC) NIL NIL)
 (|t21_TCC4| "" (SKOSIMP*)
  (("" (GRIND)
    (("" (MULT-CASES -1)
      (("" (MULT-CASES -1) (("" (MULT-CASES -1) NIL NIL)) NIL)) NIL))
    NIL))
  NIL)
 (|t21_TCC5| "" (SKOSIMP*) (("" (ASSERT) NIL NIL)) NIL)
 (|t21_TCC6| "" (SKOSIMP*) (("" (ASSERT) NIL NIL)) NIL)
 (|t21_TCC7| "" (SKOSIMP*)
  (("" (GRIND) (("" (MULT-CASES -1) (("" (MULT-CASES -1) NIL NIL)) NIL)) NIL))
  NIL)
 (|t21| "" (SKOSIMP*) (("" (GRIND) NIL NIL)) NIL)
 (|t22_TCC1| "" (SUBTYPE-TCC) NIL NIL) (|t22_TCC2| "" (SUBTYPE-TCC) NIL NIL)
 (|t22| "" (SKOSIMP*)
  (("" (ASSERT)
    (("" (AUTO-REWRITE-THEORY "real_props") (("" (ASSERT) NIL NIL)) NIL))
    NIL))
  NIL)
 (|t23| "" (SKOSIMP*)
  (("" (CASE-REPLACE "sq(x!1) + x!1 - 12 = (x!1 + 4)*(x!1 - 3)")
    (("1" (HIDE -1) (("1" (MULT-CASES -1) NIL NIL)) NIL)
     ("2" (HIDE -1) (("2" (GRIND) NIL NIL)) NIL))
    NIL))
  NIL)
 (|t24_TCC1| "" (SUBTYPE-TCC) NIL NIL) (|t24_TCC2| "" (SUBTYPE-TCC) NIL NIL)
 (|t24_TCC3| "" (SUBTYPE-TCC) NIL NIL)
 (|t24| "" (SKOSIMP*) (("" (GRIND) NIL NIL)) NIL)
 (|t25| "" (SKOSIMP*)
  (("" (AUTO-REWRITE-THEORY "real_props")
    (("" (AUTO-REWRITE-THEORY "sqrt_rew")
      (("" (TRANSFORM-BOTH -1 "sq(%1)")
        (("1" (HIDE -2)
          (("1" (ASSERT)
            (("1" (REPLACE -2)
              (("1" (HIDE -2)
                (("1" (REPLACE -2)
                  (("1" (HIDE -2)
                    (("1" (REPLACE -2)
                      (("1" (HIDE -2)
                        (("1" (ASSERT)
                          (("1" (CASE-REPLACE "pb!1 * pb!1 * pb!1 * pb!1 = 1")
                            (("1" (HIDE -2)
                              (("1" (LEMMA "real_props.sqrt_1")
                                (("1" (INST -1 "sq(pb!1)")
                                  (("1" (EXPAND "sq") (("1" (ASSERT) NIL NIL))
                                    NIL))
                                  NIL))
                                NIL))
                              NIL)
                             ("2" (EXPAND "sq") (("2" (ASSERT) NIL NIL)) NIL))
                            NIL))
                          NIL))
                        NIL))
                      NIL))
                    NIL))
                  NIL))
                NIL))
              NIL))
            NIL))
          NIL)
         ("2" (REPLACE -1) (("2" (PROPAX) NIL NIL)) NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|t26_TCC1| "" (SUBTYPE-TCC) NIL NIL) (|t26_TCC2| "" (SUBTYPE-TCC) NIL NIL)
 (|t26_TCC3| "" (SUBTYPE-TCC) NIL NIL)
 (|t26| "" (SKOSIMP*)
  (("" (AUTO-REWRITE-THEORY "real_props")
    (("" (ASSERT)
      (("" (TRANSFORM-BOTH -2 "sq(%1)")
        (("1" (HIDE -2) (("1" (GRIND) NIL NIL)) NIL) ("2" (ASSERT) NIL NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|t27| "" (SKOSIMP*)
  (("" (NAME-REPLACE "PX2" "px!1 + 2")
    (("" (DIV-BY -1 "PX2") (("" (ASSERT) NIL NIL)) NIL)) NIL))
  NIL)
 (|t28| "" (SKOSIMP*)
  (("" (CASE "sq(sqrt(px!1) - sqrt(py!1)) >= 0")
    (("1" (EXPAND "sq")
      (("1" (REWRITE "sqrt_def")
        (("1" (REWRITE "sqrt_def")
          (("1" (ASSERT)
            (("1" (MOVE-TERMS -1 L 2)
              (("1" (ASSERT)
                (("1" (REPLACE -2)
                  (("1" (HIDE -2)
                    (("1" (MULT-INEQ -1 -1) (("1" (ASSERT) NIL NIL)) NIL))
                    NIL))
                  NIL))
                NIL))
              NIL))
            NIL))
          NIL))
        NIL))
      NIL)
     ("2" (ASSERT) NIL NIL))
    NIL))
  NIL)
 (|t29_TCC1| "" (SUBTYPE-TCC) NIL NIL)
 (|t29| "" (SKOSIMP*)
  (("" (TRANSFORM-BOTH -2 "sq(%1)")
    (("1" (HIDE -3)
      (("1" (REWRITE "sq_sqrt")
        (("1" (EXPAND "sq")
          (("1" (ASSERT)
            (("1" (ASSERT)
              (("1" (HIDE -2)
                (("1" (AUTO-REWRITE-THEORY "real_props")
                  (("1" (ASSERT) NIL NIL)) NIL))
                NIL))
              NIL))
            NIL))
          NIL))
        NIL))
      NIL)
     ("2" (ASSERT) NIL NIL) ("3" (HIDE -2) (("3" (GRIND) NIL NIL)) NIL))
    NIL))
  NIL)
 (|t30| "" (SKOSIMP*)
  (("" (AUTO-REWRITE-THEORY "real_props")
    (("" (GRIND) (("" (MULT-INEQ -1 -1) (("" (ASSERT) NIL NIL)) NIL)) NIL))
    NIL))
  NIL)
 (|t31| "" (SKOSIMP*)
  (("" (AUTO-REWRITE-THEORY "real_props")
    (("" (CASE-REPLACE "(2 * x!1 - 3) >= 0")
      (("1" (ASSERT) NIL NIL) ("2" (ASSERT) NIL NIL)) NIL))
    NIL))
  NIL)
 (|t32| "" (SKOSIMP*)
  (("" (AUTO-REWRITE-THEORY "real_props") (("" (ASSERT) NIL NIL)) NIL)) NIL)
 (|t33| "" (SKOSIMP*)
  (("" (MULT-BY -1 "3")
    (("" (MULT-BY -2 "2")
      (("" (MULT-BY 1 (! 1 R 2)) (("" (ASSERT) NIL NIL)) NIL)) NIL))
    NIL))
  NIL)
 (|t34_TCC1| "" (SKOSIMP*)
  (("" (LEMMA "sqrt_le")
    (("" (INST?)
      (("" (ASSERT) (("" (REWRITE "sqrt_1") (("" (ASSERT) NIL NIL)) NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|t34| "" (SKOSIMP*)
  (("" (AUTO-REWRITE-THEORY "real_props")
    (("" (AUTO-REWRITE-THEORY "sqrt_rew")
      (("" (TRANSFORM-BOTH -2 "sq(%1)")
        (("1" (HIDE -3)
          (("1" (REWRITE "sq_sqrt")
            (("1" (REWRITE "sq_sqrt")
              (("1" (TRANSFORM-BOTH -1 "sq(%1)")
                (("1" (HIDE -2)
                  (("1" (EXPAND "sq") (("1" (ASSERT) NIL NIL)) NIL)) NIL)
                 ("2" (HIDE -2 2)
                  (("2" (NAME-REPLACE "SP1" "1 + sqrt(pa!1)")
                    (("2" (NAME-REPLACE "SM1" "1 - sqrt(pb!1)")
                      (("2" (CASE-REPLACE "SM1 >= 0")
                        (("1" (MULT-INEQ -2 -2)
                          (("1" (EXPAND "sq") (("1" (PROPAX) NIL NIL)) NIL))
                          NIL)
                         ("2" (EXPAND "sq")
                          (("2" (REVEAL -1 -2 -3)
                            (("2" (REPLACE -1 * RL) (("2" (ASSERT) NIL NIL))
                              NIL))
                            NIL))
                          NIL))
                        NIL))
                      NIL))
                    NIL))
                  NIL))
                NIL))
              NIL))
            NIL))
          NIL)
         ("2" (HIDE 2) (("2" (REWRITE "sq_ge") NIL NIL)) NIL)
         ("3" (ASSERT) NIL NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|t35| "" (SKOSIMP*) (("" (GRIND) NIL NIL)) NIL)
 (|t36| "" (SKOSIMP*)
  (("" (CASE "(a!1*c!1 - b!1*d!1)*sq(t!1) = a!1*c!1 - b!1*d!1")
    (("1" (HIDE -7)
      (("1" (CASE-REPLACE "a!1 * c!1 = b!1 * d!1")
        (("1" (HIDE -2)
          (("1" (CASE "c!1*(d!1 + c!1) = c!1* 2 * (a!1 + b!1)")
            (("1" (ASSERT)
              (("1" (REPLACE -2)
                (("1" (HIDE -2)
                  (("1" (CASE "c!1 *(c!1 + d!1) = 2 * b!1 * (c!1 + d!1)")
                    (("1" (HIDE -2)
                      (("1" (CASE "c!1 + d!1 = 0")
                        (("1" (ASSERT) NIL NIL)
                         ("2" (NAME-REPLACE "CPD" "c!1+d!1")
                          (("2" (DIV-BY -1 "CPD") (("2" (ASSERT) NIL NIL))
                            NIL))
                          NIL))
                        NIL))
                      NIL)
                     ("2" (ASSERT) NIL NIL))
                    NIL))
                  NIL))
                NIL))
              NIL)
             ("2" (ASSERT) (("2" (ASSERT) NIL NIL)) NIL))
            NIL))
          NIL)
         ("2" (CASE "sq(t!1) = 1")
          (("1" (HIDE -2)
            (("1" (EXPAND "sq")
              (("1" (ASSERT)
                (("1" (LEMMA "real_props.sqrt_1")
                  (("1" (INST?) (("1" (ASSERT) NIL NIL)) NIL)) NIL))
                NIL))
              NIL))
            NIL)
           ("2" (HIDE -7 3)
            (("2" (MULT-BY 1 "a!1 * c!1 - b!1 * d!1") (("2" (ASSERT) NIL NIL))
              NIL))
            NIL))
          NIL))
        NIL))
      NIL)
     ("2" (EXPAND "sq") (("2" (ASSERT) NIL NIL)) NIL))
    NIL))
  NIL)
 (|t37| "" (SKOSIMP*) (("" (MULT-BY 1 "n!1+1") (("" (GRIND) NIL NIL)) NIL))
  NIL)
 (|t38_TCC1| "" (SUBTYPE-TCC) NIL NIL) (|t38_TCC2| "" (SUBTYPE-TCC) NIL NIL)
 (|t38_TCC3| "" (SUBTYPE-TCC) NIL NIL) (|t38_TCC4| "" (SUBTYPE-TCC) NIL NIL)
 (|t38_TCC5| "" (SKOSIMP*)
  (("" (NAME-REPLACE "Y1" "y!1+1")
    (("" (NAME-REPLACE "X1" "x!1+1")
      (("" (GRIND)
        (("" (MULT-CASES -1)
          (("" (MULT-CASES -1)
            (("" (MULT-CASES -1)
              (("" (MULT-CASES -1)
                (("" (MULT-CASES -1)
                  (("" (MULT-CASES -1)
                    (("" (MULT-CASES -1)
                      (("" (MULT-CASES -1) (("" (MULT-CASES -1) NIL NIL))
                        NIL))
                      NIL))
                    NIL))
                  NIL))
                NIL))
              NIL))
            NIL))
          NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|t38_TCC6| "" (SUBTYPE-TCC) NIL NIL)
 (|t38_TCC7| "" (SKOSIMP*)
  (("" (NAME-REPLACE "Y1" "y!1+1")
    (("" (GRIND) (("" (MULT-CASES -1) NIL NIL)) NIL)) NIL))
  NIL)
 (|t38| "" (SKOSIMP*)
  (("" (NAME-REPLACE "X1" "x!1+1")
    (("" (NAME-REPLACE "Y1" "y!1+1") (("" (GRIND) NIL NIL)) NIL)) NIL))
  NIL)
 (|t39| "" (SKOSIMP*)
  (("" (CASE-REPLACE "b!1 = 3")
    (("1" (ASSERT)
      (("1" (INST -2 "1") (("1" (EXPAND "sq") (("1" (ASSERT) NIL NIL)) NIL))
        NIL))
      NIL)
     ("2" (INST -1 "0") (("2" (GRIND) NIL NIL)) NIL))
    NIL))
  NIL)
 (|t40| "" (SKOSIMP*) (("" (CROSS-MULT 1) (("" (ASSERT) NIL NIL)) NIL)) NIL)
 (|t41| "" (SKOSIMP*)
  (("" (TRANSFORM-BOTH -1 "sq(%1)")
    (("1" (CASE "pa!1*pa!1 < pa!1*pb!1")
      (("1" (EXPAND "sq")
        (("1" (MULT-INEQ -1 -2) (("1" (ASSERT) NIL NIL)) NIL)) NIL)
       ("2" (MULT-BY -2 "pa!1") (("2" (ASSERT) NIL NIL)) NIL))
      NIL)
     ("2" (HIDE 2) (("2" (EXPAND "sq") (("2" (MULT-INEQ -1 -1) NIL NIL)) NIL))
      NIL))
    NIL))
  NIL)
 (|t42| "" (SKOSIMP*)
  (("" (TRANSFORM-BOTH -1 "sq(%1)")
    (("1" (MULT-BY -2 "pb!1")
      (("1" (EXPAND "sq") (("1" (ASSERT) NIL NIL)) NIL)) NIL)
     ("2" (HIDE 2) (("2" (EXPAND "sq") (("2" (MULT-INEQ -1 -1) NIL NIL)) NIL))
      NIL))
    NIL))
  NIL)
 (|t43| "" (SKOSIMP*)
  (("" (AUTO-REWRITE-THEORY "real_props") (("" (GRIND) NIL NIL)) NIL)) NIL)
 (|t44_TCC1| "" (SKOSIMP*)
  (("" (EXPAND "sq") (("" (MULT-INEQ -1 -1) (("" (ASSERT) NIL NIL)) NIL))
    NIL))
  NIL)
 (|t44_TCC2| "" (SUBTYPE-TCC) NIL NIL)
 (|t44| "" (SKOSIMP*)
  (("" (AUTO-REWRITE-THEORY "real_props")
    (("" (CROSS-MULT 1)
      (("" (CASE-REPLACE "sq(px!1) - 1 = (px!1+1)*(px!1-1)")
        (("1" (REWRITE "sqrt_times") (("1" (ASSERT) NIL NIL)) NIL)
         ("2" (HIDE 2) (("2" (EXPAND "sq") (("2" (ASSERT) NIL NIL)) NIL))
          NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|t45_TCC1| "" (SUBTYPE-TCC) NIL NIL)
 (|t45| "" (INDUCT "n")
  (("1" (SKOSIMP*) (("1" (GRIND) NIL NIL)) NIL)
   ("2" (SKOSIMP*)
    (("2" (CASE-REPLACE "(1 + x!1) ^ (j!1 + 1) = (1+x!1)*(1 + x!1) ^ j!1")
      (("1" (HIDE -1)
        (("1" (INST?)
          (("1" (SPLIT -1)
            (("1" (MULT-BY -1 "(1+x!1)")
              (("1"
                (CASE-REPLACE
                 "(1 + j!1 * x!1) * (1 + x!1) >= 1 + (j!1 + 1) * x!1")
                (("1" (ASSERT) NIL NIL)
                 ("2" (HIDE -1 2)
                  (("2" (GROUND)
                    (("2" (CASE "j!1 * x!1 * x!1 >= 0")
                      (("1" (ASSERT) NIL NIL)
                       ("2" (HIDE 2)
                        (("2" (MULT-CASES 1)
                          (("2" (GROUND)
                            (("1" (MULT-CASES 2) NIL NIL)
                             ("2" (MULT-CASES 1) NIL NIL))
                            NIL))
                          NIL))
                        NIL))
                      NIL))
                    NIL))
                  NIL))
                NIL))
              NIL)
             ("2" (PROPAX) NIL NIL))
            NIL))
          NIL))
        NIL)
       ("2" (ASSERT)
        (("2" (HIDE -1 2)
          (("2" (EXPAND "^")
            (("2" (EXPAND "expt" 1 1) (("2" (PROPAX) NIL NIL)) NIL)) NIL))
          NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|t46_TCC1| "" (SUBTYPE-TCC) NIL NIL)
 (|t46| "" (SKOSIMP*)
  (("" (CASE-REPLACE "(px!1+py!1)*sq(px!1-py!1) >= 0")
    (("1" (GRIND) NIL NIL) ("2" (HIDE 2) (("2" (ASSERT) NIL NIL)) NIL)) NIL))
  NIL)
 (|t47| "" (SKOSIMP*)
  (("" (CASE "sq(px!1-1) >= 0")
    (("1" (CASE-REPLACE "1 / px!1 + px!1 = (sq(px!1)+1)/px!1")
      (("1" (HIDE -1) (("1" (MULT-BY 1 "px!1") (("1" (GRIND) NIL NIL)) NIL))
        NIL)
       ("2" (HIDE 2) (("2" (GRIND) NIL NIL)) NIL))
      NIL)
     ("2" (ASSERT) NIL NIL))
    NIL))
  NIL)
 (|t48| "" (SKOSIMP*)
  (("" (CASE "sq(sqrt(px!1) - sqrt(py!1)) >= 0")
    (("1" (EXPAND "sq" -)
      (("1" (REWRITE "sqrt_def")
        (("1" (REWRITE "sqrt_def")
          (("1" (ASSERT)
            (("1" (MOVE-TERMS -1 L 2)
              (("1" (ASSERT)
                (("1" (REPLACE -2)
                  (("1" (DIV-BY -1 "2")
                    (("1" (MULT-EXTRACT! SQRTTERMS (! -1 R))
                      (("1" (REPLACE -1 -2 RL)
                        (("1" (HIDE -1)
                          (("1" (TRANSFORM-BOTH -1 "sq(%1)")
                            (("1" (HIDE -2)
                              (("1" (EXPAND "sq")
                                (("1" (REWRITE "sqrt_def")
                                  (("1" (ASSERT) NIL NIL)) NIL))
                                NIL))
                              NIL)
                             ("2" (HIDE 2)
                              (("2" (EXPAND "sq")
                                (("2" (MULT-INEQ -1 -1)
                                  (("2" (ASSERT) NIL NIL)) NIL))
                                NIL))
                              NIL))
                            NIL))
                          NIL))
                        NIL))
                      NIL))
                    NIL))
                  NIL))
                NIL))
              NIL))
            NIL))
          NIL))
        NIL))
      NIL)
     ("2" (ASSERT) NIL NIL))
    NIL))
  NIL)
 (|t50| "" (AUTO-REWRITE-THEORY "real_props") (("" (GRIND) NIL NIL)) NIL)
 (|t51_TCC1| "" (SUBTYPE-TCC) NIL NIL) (|t51_TCC2| "" (SUBTYPE-TCC) NIL NIL)
 (|t51| "" (SKOSIMP*)
  (("" (AUTO-REWRITE-THEORY "real_props")
    (("" (NAME-REPLACE "XP1" "(x!1 + 1)")
      (("" (NAME-REPLACE "YP1" "y!1 + 1") (("" (GRIND) NIL NIL)) NIL)) NIL))
    NIL))
  NIL)
 (|t52_TCC1| "" (SKOSIMP*)
  (("" (EXPAND "sq") (("" (MULT-INEQ -1 -1) (("" (ASSERT) NIL NIL)) NIL))
    NIL))
  NIL)
 (|t52_TCC2| "" (SUBTYPE-TCC) NIL NIL)
 (|t52| "" (SKOSIMP*)
  (("" (AUTO-REWRITE-THEORY "real_props")
    (("" (INVOKE (CASE-REPLACE "%1 = sqrt(x!1+1)") (? -2 "P!1(%1)"))
      (("1" (HIDE -2 2)
        (("1" (CASE-REPLACE "sq(x!1) - 1 = (x!1+1)*(x!1-1)")
          (("1" (NAME-REPLACE "PX1" "x!1 + 1")
            (("1" (NAME-REPLACE "PXM1" "x!1 - 1")
              (("1" (REWRITE "sqrt_times") (("1" (ASSERT) NIL NIL)) NIL))
              NIL))
            NIL)
           ("2" (HIDE 2) (("2" (GRIND) NIL NIL)) NIL))
          NIL))
        NIL)
       ("2" (ASSERT) NIL NIL) ("3" (ASSERT) NIL NIL) ("4" (ASSERT) NIL NIL)
       ("5" (ASSERT) NIL NIL))
      NIL))
    NIL))
  NIL)
 (|t53| "" (SKOSIMP*)
  (("" (REWRITE "congruence")
    (("" (HIDE 3)
      (("" (AUTO-REWRITE-THEORY "real_props") (("" (GRIND) NIL NIL)) NIL))
      NIL))
    NIL))
  NIL)
 (|t54_TCC1| "" (SUBTYPE-TCC) NIL NIL)
 (|t54_TCC2| "" (SKOSIMP*)
  (("" (GRIND)
    (("" (MULT-CASES -1)
      (("" (MULT-CASES -1) (("" (MULT-CASES -1) NIL NIL)) NIL)) NIL))
    NIL))
  NIL)
 (|t54_TCC3| "" (SKOSIMP*) (("" (GRIND) (("" (MULT-CASES -1) NIL NIL)) NIL))
  NIL)
 (|t54| "" (SKOSIMP*)
  (("" (REWRITE "congruence")
    (("1" (HIDE 4)
      (("1" (ASSERT)
        (("1" (AUTO-REWRITE-THEORY "real_props") (("1" (GRIND) NIL NIL)) NIL))
        NIL))
      NIL)
     ("2" (HIDE 4) (("2" (GRIND) (("2" (MULT-CASES -1) NIL NIL)) NIL)) NIL)
     ("3" (HIDE 4)
      (("3" (GRIND)
        (("3" (MULT-CASES -1)
          (("3" (MULT-CASES -1) (("3" (MULT-CASES -1) NIL NIL)) NIL)) NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|t55| "" (SKOSIMP*)
  (("" (CASE-REPLACE "px!1 > pa!1 IFF sq(px!1) > sq(pa!1)")
    (("" (ASSERT)
      (("" (HIDE -1 2)
        (("" (AUTO-REWRITE-THEORY "real_props")
          (("" (GRIND) (("" (MULT-INEQ 1 1) (("" (ASSERT) NIL NIL)) NIL))
            NIL))
          NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|t56_TCC1| "" (SUBTYPE-TCC) NIL NIL)
 (|t56| "" (SKOSIMP*)
  (("" (AUTO-REWRITE-THEORY "real_props")
    (("" (REWRITE "congruence") (("" (HIDE 2) (("" (GRIND) NIL NIL)) NIL))
      NIL))
    NIL))
  NIL)
 (|t57_TCC1| "" (SUBTYPE-TCC) NIL NIL)
 (|t57_TCC2| "" (SKOSIMP*)
  (("" (INVOKE (CASE "%1 > 1") (! -4 (-> "floor") 1))
    (("1" (ASSERT) NIL NIL)
     ("2" (MULT-BY 1 "b!1-1") (("2" (ASSERT) NIL NIL)) NIL)
     ("3" (ASSERT) NIL NIL))
    NIL))
  NIL)
 (|t57| "" (SKOSIMP*)
  (("" (INVOKE (CASE "%1 > 0") (! 1 (-> "floor")))
    (("1" (MOVE-TERMS 1 L 1)
      (("1" (MULT-BY 1 (! 1 (-> "floor")))
        (("1" (DIV-BY 1 "b!1-1")
          (("1" (NAME-REPLACE "bp" "b!1-1") (("1" (ASSERT) NIL NIL)) NIL))
          NIL))
        NIL)
       ("2" (ASSERT) NIL NIL) ("3" (ASSERT) NIL NIL))
      NIL)
     ("2" (HIDE 2)
      (("2" (INVOKE (CASE "%1 > 1") (! 1 (-> "floor") 1))
        (("1" (ASSERT) NIL NIL)
         ("2" (HIDE 2)
          (("2" (MULT-BY 1 "b!1-1") (("2" (ASSERT) NIL NIL)) NIL)) NIL)
         ("3" (ASSERT) NIL NIL))
        NIL))
      NIL)
     ("3" (ASSERT) NIL NIL))
    NIL))
  NIL)
 (|t60| "" (SKOSIMP*)
  (("" (EXPAND "abs")
    (("" (EXPAND "sq")
      (("" (LIFT-IF)
        (("" (GROUND)
          (("1" (MULT-INEQ -2 -2) (("1" (ASSERT) NIL NIL)) NIL)
           ("2" (MULT-INEQ -1 -1) (("2" (ASSERT) NIL NIL)) NIL))
          NIL))
        NIL))
      NIL))
    NIL))
  NIL)
 (|t61_TCC1| "" (SKOSIMP*)
  (("" (INVOKE (CASE "%1 > 0") (! -2 (-> "floor") 1))
    (("1" (ASSERT) NIL NIL)
     ("2" (MULT-BY 1 "pd!1") (("2" (ASSERT) NIL NIL)) NIL))
    NIL))
  NIL)
 (|t61| "" (SKOSIMP*)
  (("" (NAME "BMA" "b!1-a!1")
    (("" (REPLACE -1)
      (("" (CASE "BMA > 0")
        (("1" (HIDE -3)
          (("1" (CASE "BMA / pd!1 >= 0")
            (("1" (MULT-BY 1 "(1 + floor(BMA / pd!1))")
              (("1" (DIV-BY 1 "pd!1") (("1" (ASSERT) NIL NIL)) NIL)) NIL)
             ("2" (HIDE 2)
              (("2" (MULT-BY 1 "pd!1") (("2" (ASSERT) NIL NIL)) NIL)) NIL))
            NIL))
          NIL)
         ("2" (ASSERT) NIL NIL))
        NIL))
      NIL))
    NIL))
  NIL))