# Declarations

decl_type: tcc
theory: acos
library: trig_fnd
signature: nil
location: 98 0 102 999
body:
  % Subtype TCC generated (at line 33, column 45) for
      % LAMBDA (x: real_abs_lt1): acos(x)
      % expected type  deriv_fun[real_abs_lt1]
  deriv_acos_fun_TCC1: OBLIGATION
    derivable?[real_abs_lt1](LAMBDA (x: real_abs_lt1): acos(x));


decl_type: tcc
theory: acos
library: trig_fnd
signature: nil
location: 104 0 108 999
body:
  % Subtype TCC generated (at line 34, column 40) for
      % LAMBDA (x: real_abs_lt1): asin(x)
      % expected type  deriv_fun[real_abs_lt1]
  deriv_acos_fun_TCC2: OBLIGATION
    derivable?[real_abs_lt1](LAMBDA (x: real_abs_lt1): asin(x));


decl_type: formula
theory: sincos_quad
library: trig_fnd
signature: nil
location: 102 2 103 79
body:
    cos_value_sum:  LEMMA cos_value(q1+q2) = 
                          cos_value(q1)*cos_value(q2)-sin_value(q1)*sin_value(q2)


decl_type: formula
theory: sincos_quad
library: trig_fnd
signature: nil
location: 105 2 106 79
body:
    sin_value_diff: LEMMA sin_value(q1-q2) = 
                          sin_value(q1)*cos_value(q2)-cos_value(q1)*sin_value(q2)


decl_type: formula
theory: sincos_quad
library: trig_fnd
signature: nil
location: 108 2 109 81
body:
    sin_value_derivable:  LEMMA FORALL (x:real_abs_lt_pi2):
          derivable?[real_abs_lt_pi2]((LAMBDA (x:real_abs_lt_pi2): sin_value(x)),x)


decl_type: formula
theory: sincos_quad
library: trig_fnd
signature: nil
location: 111 2 112 77
body:
    sin_value_derivable_fun: LEMMA
          derivable?[real_abs_lt_pi2](LAMBDA (x:real_abs_lt_pi2): sin_value(x))


decl_type: formula
theory: sincos_quad
library: trig_fnd
signature: nil
location: 114 2 116 76
body:
    deriv_sin_value     :   LEMMA
          deriv[real_abs_lt_pi2](LAMBDA (x:real_abs_lt_pi2): sin_value(x))
                            = (LAMBDA (x:real_abs_lt_pi2): cos_value (abs(x)))


decl_type: formula
theory: sincos_quad
library: trig_fnd
signature: nil
location: 118 2 120 78
body:
    sin_value_sum: LEMMA  IF q1+q2 <= pi/2 THEN sin_value(q1+q2) 
                          ELSE cos_value(q1+q2-pi/2) ENDIF
                       = sin_value(q1)*cos_value(q2)+cos_value(q1)*sin_value(q2)


decl_type: formula
theory: sincos_quad
library: trig_fnd
signature: nil
location: 122 2 124 78
body:
    cos_value_diff:  LEMMA IF q1-q2 < 0 THEN cos_value(q2-q1) 
                           ELSE cos_value(q1-q2) ENDIF
                       = cos_value(q1)*cos_value(q2)+sin_value(q1)*sin_value(q2)


decl_type: formula
theory: sincos_quad
library: trig_fnd
signature: nil
location: 126 2 127 77
body:
    cos_value_derivable:  LEMMA FORALL (x:posreal_lt_pi):
          derivable?[posreal_lt_pi]((LAMBDA (x:posreal_lt_pi): cos_value(x)),x)


decl_type: formula
theory: sincos_quad
library: trig_fnd
signature: nil
location: 129 2 130 73
body:
    cos_value_derivable_fun: LEMMA
          derivable?[posreal_lt_pi](LAMBDA (x:posreal_lt_pi): cos_value(x))


decl_type: formula
theory: sincos_quad
library: trig_fnd
signature: nil
location: 132 2 135 70
body:
    deriv_cos_value:   LEMMA
       deriv[posreal_lt_pi](LAMBDA (x:posreal_lt_pi): cos_value(x))
               = (LAMBDA (x:posreal_lt_pi): IF x < pi/2 THEN -sin_value(x)
                                            ELSE -sin_value(pi-x) ENDIF)


decl_type: tcc
theory: sincos_quad
library: trig_fnd
signature: nil
location: 142 0 144 999
body:
  % Subtype TCC generated (at line 17, column 73) for  0
      % expected type  nnreal_quad1_closed
  nnreal_quad1_closed_TCC1: OBLIGATION 0 <= pi / 2;


decl_type: tcc
theory: sincos_quad
library: trig_fnd
signature: nil
location: 146 0 148 999
body:
  % Subtype TCC generated (at line 18, column 73) for  0
      % expected type  nnreal_quad1_open
  nnreal_quad1_open_TCC1: OBLIGATION 0 < pi / 2;


decl_type: tcc
theory: sincos_quad
library: trig_fnd
signature: nil
location: 150 0 152 999
body:
  % Subtype TCC generated (at line 19, column 70) for  pi / 2
      % expected type  posreal_lt_pi
  posreal_lt_pi_TCC1: OBLIGATION pi / 2 < pi;


decl_type: tcc
theory: sincos_quad
library: trig_fnd
signature: nil
location: 154 0 157 999
body:
  % Subtype TCC generated (at line 72, column 39) for  -xs
      % expected type  real_abs_le_pi2
  sin_value_neg_TCC1: OBLIGATION
    FORALL (xs: real_abs_le_pi2): -pi / 2 <= -xs AND -xs <= pi / 2;


decl_type: tcc
theory: sincos_quad
library: trig_fnd
signature: nil
location: 159 0 162 999
body:
  % Subtype TCC generated (at line 73, column 39) for  pi - xc
      % expected type  nnreal_le_pi
  cos_value_neg_TCC1: OBLIGATION
    FORALL (xc: nnreal_le_pi): pi - xc >= 0 AND pi - xc <= pi;


decl_type: tcc
theory: sincos_quad
library: trig_fnd
signature: nil
location: 164 0 167 999
body:
  % Subtype TCC generated (at line 74, column 59) for  pi / 2 + xs
      % expected type  nnreal_le_pi
  sin_eqv_cos_value_TCC1: OBLIGATION
    FORALL (xs: real_abs_le_pi2): pi / 2 + xs >= 0 AND pi / 2 + xs <= pi;


decl_type: tcc
theory: sincos_quad
library: trig_fnd
signature: nil
location: 169 0 172 999
body:
  % Subtype TCC generated (at line 75, column 39) for  q1
      % expected type  real_abs_le_pi2
  sin_eqv_cos_quad_TCC1: OBLIGATION
    FORALL (q1: nnreal_quad1_closed): -pi / 2 <= q1 AND q1 <= pi / 2;


decl_type: tcc
theory: sincos_quad
library: trig_fnd
signature: nil
location: 174 0 177 999
body:
  % Subtype TCC generated (at line 75, column 58) for  pi / 2 - q1
      % expected type  nnreal_le_pi
  sin_eqv_cos_quad_TCC2: OBLIGATION
    FORALL (q1: nnreal_quad1_closed): pi / 2 - q1 >= 0 AND pi / 2 - q1 <= pi;


decl_type: tcc
theory: sincos_quad
library: trig_fnd
signature: nil
location: 179 0 182 999
body:
  % Subtype TCC generated (at line 76, column 39) for  q1
      % expected type  nnreal_le_pi
  cos_eqv_sin_quad_TCC1: OBLIGATION
    FORALL (q1: nnreal_quad1_closed): q1 <= pi;


decl_type: tcc
theory: sincos_quad
library: trig_fnd
signature: nil
location: 184 0 188 999
body:
  % Subtype TCC generated (at line 76, column 58) for  pi / 2 - q1
      % expected type  real_abs_le_pi2
  cos_eqv_sin_quad_TCC2: OBLIGATION
    FORALL (q1: nnreal_quad1_closed):
      -pi / 2 <= pi / 2 - q1 AND pi / 2 - q1 <= pi / 2;


decl_type: tcc
theory: sincos_quad
library: trig_fnd
signature: nil
location: 190 0 193 999
body:
  % Subtype TCC generated (at line 77, column 39) for  -pi / 2
      % expected type  real_abs_le_pi2
  sin_value_minus_pi2_TCC1: OBLIGATION
    -pi / 2 <= -pi / 2 AND -pi / 2 <= pi / 2;


decl_type: tcc
theory: sincos_quad
library: trig_fnd
signature: nil
location: 195 0 197 999
body:
  % Subtype TCC generated (at line 78, column 39) for  0
      % expected type  real_abs_le_pi2
  sin_value_0_TCC1: OBLIGATION -pi / 2 <= 0 AND 0 <= pi / 2;


decl_type: tcc
theory: sincos_quad
library: trig_fnd
signature: nil
location: 199 0 201 999
body:
  % Subtype TCC generated (at line 79, column 39) for  pi / 4
      % expected type  real_abs_le_pi2
  sin_value_pi4_TCC1: OBLIGATION -pi / 2 <= pi / 4 AND pi / 4 <= pi / 2;


decl_type: tcc
theory: sincos_quad
library: trig_fnd
signature: nil
location: 203 0 205 999
body:
  % Subtype TCC generated (at line 80, column 39) for  pi / 2
      % expected type  real_abs_le_pi2
  sin_value_pi2_TCC1: OBLIGATION -pi / 2 <= pi / 2 AND pi / 2 <= pi / 2;


decl_type: tcc
theory: sincos_quad
library: trig_fnd
signature: nil
location: 207 0 209 999
body:
  % Subtype TCC generated (at line 81, column 39) for  0
      % expected type  nnreal_le_pi
  cos_value_0_TCC1: OBLIGATION 0 <= pi;


decl_type: tcc
theory: sincos_quad
library: trig_fnd
signature: nil
location: 211 0 213 999
body:
  % Subtype TCC generated (at line 82, column 39) for  pi / 4
      % expected type  nnreal_le_pi
  cos_value_pi4_TCC1: OBLIGATION pi / 4 <= pi;


decl_type: tcc
theory: sincos_quad
library: trig_fnd
signature: nil
location: 215 0 217 999
body:
  % Subtype TCC generated (at line 83, column 39) for  pi / 2
      % expected type  nnreal_le_pi
  cos_value_pi2_TCC1: OBLIGATION pi / 2 <= pi;


decl_type: tcc
theory: sincos_quad
library: trig_fnd
signature: nil
location: 219 0 221 999
body:
  % Subtype TCC generated (at line 84, column 39) for  pi
      % expected type  nnreal_le_pi
  cos_value_pi_TCC1: OBLIGATION pi <= pi;


decl_type: tcc
theory: sincos_quad
library: trig_fnd
signature: nil
location: 223 0 226 999
body:
  % Subtype TCC generated (at line 92, column 37) for  1 - sq(cos_value(q1))
      % expected type  nnx: nonneg_real
  sin_eqv_sqrt_cos_value_TCC1: OBLIGATION
    FORALL (q1: nnreal_quad1_closed): 1 - sq(cos_value(q1)) >= 0;


decl_type: tcc
theory: sincos_quad
library: trig_fnd
signature: nil
location: 228 0 231 999
body:
  % Subtype TCC generated (at line 93, column 37) for  1 - sq(sin_value(q1))
      % expected type  nnx: nonneg_real
  cos_eqv_sqrt_sin_value_TCC1: OBLIGATION
    FORALL (q1: nnreal_quad1_closed): 1 - sq(sin_value(q1)) >= 0;


decl_type: tcc
theory: sincos_quad
library: trig_fnd
signature: nil
location: 233 0 236 999
body:
  % Subtype TCC generated (at line 95, column 44) for  qo1
      % expected type  real_abs_le_pi2
  atan_tan_value_TCC1: OBLIGATION
    FORALL (qo1: nnreal_quad1_open): -pi / 2 <= qo1 AND qo1 <= pi / 2;


decl_type: tcc
theory: sincos_quad
library: trig_fnd
signature: nil
location: 238 0 240 999
body:
  % Subtype TCC generated (at line 95, column 59) for  qo1
      % expected type  nnreal_le_pi
  atan_tan_value_TCC2: OBLIGATION FORALL (qo1: nnreal_quad1_open): qo1 <= pi;


decl_type: tcc
theory: sincos_quad
library: trig_fnd
signature: nil
location: 242 0 245 999
body:
  % Subtype TCC generated (at line 95, column 49) for  cos_value(qo1)
      % expected type  nznum
  atan_tan_value_TCC3: OBLIGATION
    FORALL (qo1: nnreal_quad1_open): cos_value(qo1) /= 0;


decl_type: tcc
theory: sincos_quad
library: trig_fnd
signature: nil
location: 247 0 250 999
body:
  % Subtype TCC generated (at line 96, column 39) for  atan(x)
      % expected type  real_abs_le_pi2
  sin_value_atan_TCC1: OBLIGATION
    FORALL (x: real): -pi / 2 <= atan(x) AND atan(x) <= pi / 2;


decl_type: tcc
theory: sincos_quad
library: trig_fnd
signature: nil
location: 252 0 255 999
body:
  % Subtype TCC generated (at line 97, column 39) for  atan(nnx)
      % expected type  nnreal_le_pi
  cos_value_atan_TCC1: OBLIGATION
    FORALL (nnx: nnreal): atan(nnx) >= 0 AND atan(nnx) <= pi;


decl_type: tcc
theory: sincos_quad
library: trig_fnd
signature: nil
location: 257 0 259 999
body:
  % Subtype TCC generated (at line 99, column 39) for  pi / 6
      % expected type  real_abs_le_pi2
  sin_value_pi6_TCC1: OBLIGATION -pi / 2 <= pi / 6 AND pi / 6 <= pi / 2;


decl_type: tcc
theory: sincos_quad
library: trig_fnd
signature: nil
location: 261 0 263 999
body:
  % Subtype TCC generated (at line 100, column 39) for  pi / 6
      % expected type  nnreal_le_pi
  cos_value_pi6_TCC1: OBLIGATION pi / 6 <= pi;


decl_type: tcc
theory: sincos_quad
library: trig_fnd
signature: nil
location: 265 0 268 999
body:
  % Subtype TCC generated (at line 102, column 34) for  q1 + q2
      % expected type  nnreal_le_pi
  cos_value_sum_TCC1: OBLIGATION
    FORALL (q1, q2: nnreal_quad1_closed): q1 + q2 <= pi;


decl_type: tcc
theory: sincos_quad
library: trig_fnd
signature: nil
location: 270 0 274 999
body:
  % Subtype TCC generated (at line 105, column 34) for  q1 - q2
      % expected type  real_abs_le_pi2
  sin_value_diff_TCC1: OBLIGATION
    FORALL (q1, q2: nnreal_quad1_closed):
      -pi / 2 <= q1 - q2 AND q1 - q2 <= pi / 2;


decl_type: tcc
theory: sincos_quad
library: trig_fnd
signature: nil
location: 276 0 279 999
body:
  % Subtype TCC generated (at line 109, column 75) for  x
      % expected type  real_abs_le_pi2
  sin_value_derivable_TCC1: OBLIGATION
    FORALL (x1: real_abs_lt_pi2): -pi / 2 <= x1 AND x1 <= pi / 2;


decl_type: tcc
theory: sincos_quad
library: trig_fnd
signature: nil
location: 281 0 284 999
body:
  % Assuming TCC generated (at line 26, column 4) for
      % analysis@derivatives_def[real_abs_lt_pi2]
      % generated from assumption derivatives_def.deriv_domain
  sin_value_derivable_TCC2: OBLIGATION deriv_domain?[real_abs_lt_pi2];


decl_type: tcc
theory: sincos_quad
library: trig_fnd
signature: nil
location: 286 0 289 999
body:
  % Assuming TCC generated (at line 28, column 4) for
      % analysis@derivatives_def[real_abs_lt_pi2]
      % generated from assumption derivatives_def.not_one_element
  sin_value_derivable_TCC3: OBLIGATION not_one_element?[real_abs_lt_pi2];


decl_type: tcc
theory: sincos_quad
library: trig_fnd
signature: nil
location: 291 0 295 999
body:
  % Subtype TCC generated (at line 115, column 31) for
      % LAMBDA (x: real_abs_lt_pi2): sin_value(x)
      % expected type  deriv_fun[real_abs_lt_pi2]
  deriv_sin_value_TCC1: OBLIGATION
    derivable?[real_abs_lt_pi2](LAMBDA (x: real_abs_lt_pi2): sin_value(x));


decl_type: tcc
theory: sincos_quad
library: trig_fnd
signature: nil
location: 297 0 299 999
body:
  % Subtype TCC generated (at line 116, column 68) for  abs(x)
      % expected type  nnreal_le_pi
  deriv_sin_value_TCC2: OBLIGATION FORALL (x: real_abs_lt_pi2): abs(x) <= pi;


decl_type: tcc
theory: sincos_quad
library: trig_fnd
signature: nil
location: 301 0 305 999
body:
  % Subtype TCC generated (at line 118, column 56) for  q1 + q2
      % expected type  real_abs_le_pi2
  sin_value_sum_TCC1: OBLIGATION
    FORALL (q1, q2: nnreal_quad1_closed):
      q1 + q2 <= pi / 2 IMPLIES -pi / 2 <= q1 + q2 AND q1 + q2 <= pi / 2;


decl_type: tcc
theory: sincos_quad
library: trig_fnd
signature: nil
location: 307 0 312 999
body:
  % Subtype TCC generated (at line 119, column 39) for  q1 + q2 - pi / 2
      % expected type  nnreal_le_pi
  sin_value_sum_TCC2: OBLIGATION
    FORALL (q1, q2: nnreal_quad1_closed):
      NOT q1 + q2 <= pi / 2 IMPLIES
       q1 + q2 - pi / 2 >= 0 AND q1 + q2 - pi / 2 <= pi;


decl_type: tcc
theory: sincos_quad
library: trig_fnd
signature: nil
location: 314 0 318 999
body:
  % Subtype TCC generated (at line 122, column 53) for  q2 - q1
      % expected type  nnreal_le_pi
  cos_value_diff_TCC1: OBLIGATION
    FORALL (q1, q2: nnreal_quad1_closed):
      q1 - q2 < 0 IMPLIES q2 - q1 >= 0 AND q2 - q1 <= pi;


decl_type: tcc
theory: sincos_quad
library: trig_fnd
signature: nil
location: 320 0 324 999
body:
  % Subtype TCC generated (at line 123, column 40) for  q1 - q2
      % expected type  nnreal_le_pi
  cos_value_diff_TCC2: OBLIGATION
    FORALL (q1, q2: nnreal_quad1_closed):
      NOT q1 - q2 < 0 IMPLIES q1 - q2 >= 0 AND q1 - q2 <= pi;


decl_type: tcc
theory: sincos_quad
library: trig_fnd
signature: nil
location: 326 0 328 999
body:
  % Subtype TCC generated (at line 127, column 71) for  x
      % expected type  nnreal_le_pi
  cos_value_derivable_TCC1: OBLIGATION FORALL (x1: posreal_lt_pi): x1 <= pi;


decl_type: tcc
theory: sincos_quad
library: trig_fnd
signature: nil
location: 330 0 333 999
body:
  % Assuming TCC generated (at line 26, column 4) for
      % analysis@derivatives_def[posreal_lt_pi]
      % generated from assumption derivatives_def.deriv_domain
  cos_value_derivable_TCC2: OBLIGATION deriv_domain?[posreal_lt_pi];


decl_type: tcc
theory: sincos_quad
library: trig_fnd
signature: nil
location: 335 0 338 999
body:
  % Assuming TCC generated (at line 28, column 4) for
      % analysis@derivatives_def[posreal_lt_pi]
      % generated from assumption derivatives_def.not_one_element
  cos_value_derivable_TCC3: OBLIGATION not_one_element?[posreal_lt_pi];


decl_type: tcc
theory: sincos_quad
library: trig_fnd
signature: nil
location: 340 0 344 999
body:
  % Subtype TCC generated (at line 133, column 26) for
      % LAMBDA (x: posreal_lt_pi): cos_value(x)
      % expected type  deriv_fun[posreal_lt_pi]
  deriv_cos_value_TCC1: OBLIGATION
    derivable?[posreal_lt_pi](LAMBDA (x: posreal_lt_pi): cos_value(x));


decl_type: tcc
theory: sincos_quad
library: trig_fnd
signature: nil
location: 346 0 350 999
body:
  % Subtype TCC generated (at line 134, column 70) for  x
      % expected type  real_abs_le_pi2
  deriv_cos_value_TCC2: OBLIGATION
    FORALL (x: posreal_lt_pi):
      x < pi / 2 IMPLIES -pi / 2 <= x AND x <= pi / 2;


decl_type: tcc
theory: sincos_quad
library: trig_fnd
signature: nil
location: 352 0 356 999
body:
  % Subtype TCC generated (at line 135, column 58) for  pi - x
      % expected type  real_abs_le_pi2
  deriv_cos_value_TCC3: OBLIGATION
    FORALL (x: posreal_lt_pi):
      NOT x < pi / 2 IMPLIES -pi / 2 <= pi - x AND pi - x <= pi / 2;


decl_type: tcc
theory: tan_quad
library: trig_fnd
signature: nil
location: 23 0 26 999
body:
  % Subtype TCC generated (at line 13, column 48) for  x
      % expected type  real_abs_le_pi2
  tan_value_def_TCC1: OBLIGATION
    FORALL (x: real_abs_lt_pi2): -pi / 2 <= x AND x <= pi / 2;


decl_type: tcc
theory: tan_quad
library: trig_fnd
signature: nil
location: 28 0 30 999
body:
  % Subtype TCC generated (at line 13, column 61) for  abs(x)
      % expected type  nnreal_le_pi
  tan_value_def_TCC2: OBLIGATION FORALL (x: real_abs_lt_pi2): abs(x) <= pi;


decl_type: tcc
theory: tan_quad
library: trig_fnd
signature: nil
location: 32 0 35 999
body:
  % Subtype TCC generated (at line 13, column 51) for  cos_value(abs(x))
      % expected type  nznum
  tan_value_def_TCC3: OBLIGATION
    FORALL (x: real_abs_lt_pi2): cos_value(abs(x)) /= 0;


decl_type: tcc
theory: tan_quad
library: trig_fnd
signature: nil
location: 37 0 39 999
body:
  % Subtype TCC generated (at line 15, column 33) for  0
      % expected type  real_abs_lt_pi2
  tan_value_0_TCC1: OBLIGATION -pi / 2 < 0 AND 0 < pi / 2;


decl_type: tcc
theory: tan_quad
library: trig_fnd
signature: nil
location: 41 0 43 999
body:
  % Subtype TCC generated (at line 16, column 33) for  pi / 4
      % expected type  real_abs_lt_pi2
  tan_value_pi4_TCC1: OBLIGATION -pi / 2 < pi / 4 AND pi / 4 < pi / 2;


decl_type: formula
theory: sincos_phase
library: trig_fnd
signature: nil
location: 38 2 39 64
body:
    phases_sin:   LEMMA floor((2*x)/pi) = 0 OR floor((2*x)/pi) = 1 OR 
                        floor((2*x)/pi) = 2 OR floor((2*x)/pi) = 3


decl_type: formula
theory: sincos_phase
library: trig_fnd
signature: nil
location: 63 2 65 64
body:
    sin_eqv_cos_phase:   LEMMA
      sin_phase(x) = IF x < 3*pi/2 THEN -cos_phase(pi/2+x)
                                   ELSE -cos_phase(x-3*pi/2) ENDIF


decl_type: formula
theory: sincos_phase
library: trig_fnd
signature: nil
location: 66 2 68 63
body:
    cos_eqv_sin_phase:   LEMMA
      cos_phase(x) = IF x < 3*pi/2 THEN sin_phase(pi/2+x)
                                   ELSE sin_phase(x-3*pi/2) ENDIF


decl_type: formula
theory: sincos_phase
library: trig_fnd
signature: nil
location: 69 2 70 78
body:
    sin_phase_inv:       LEMMA
      sin_phase(x) = IF x < pi THEN -sin_phase(x+pi) ELSE -sin_phase(x-pi) ENDIF


decl_type: formula
theory: sincos_phase
library: trig_fnd
signature: nil
location: 71 2 72 78
body:
    cos_phase_inv:       LEMMA
      cos_phase(x) = IF x < pi THEN -cos_phase(x+pi) ELSE -cos_phase(x-pi) ENDIF


decl_type: formula
theory: sincos_phase
library: trig_fnd
signature: nil
location: 82 2 83 74
body:
    sin_phase_asin:      LEMMA IF xa < 0 THEN sin_phase(asin(xa)+2*pi)
                                         ELSE sin_phase(asin(xa)) ENDIF = xa


decl_type: formula
theory: sincos_phase
library: trig_fnd
signature: nil
location: 88 2 89 71
body:
    sin_phase_diff: LEMMA sin_phase(x)*cos_phase(y)-cos_phase(x)*sin_phase(y)
       = IF x-y >= 0   THEN sin_phase(x-y) ELSE sin_phase(x-y+2*pi) ENDIF


decl_type: formula
theory: sincos_phase
library: trig_fnd
signature: nil
location: 91 2 92 71
body:
    cos_phase_sum:  LEMMA cos_phase(x)*cos_phase(y)-sin_phase(x)*sin_phase(y)
       = IF x+y < 2*pi THEN cos_phase(x+y) ELSE cos_phase(x+y-2*pi) ENDIF 


decl_type: formula
theory: sincos_phase
library: trig_fnd
signature: nil
location: 94 2 95 71
body:
    cos_phase_diff:  LEMMA cos_phase(x)*cos_phase(y)+sin_phase(x)*sin_phase(y)
       = IF x-y >= 0   THEN cos_phase(x-y) ELSE cos_phase(x-y+2*pi) ENDIF 


decl_type: formula
theory: sincos_phase
library: trig_fnd
signature: nil
location: 97 2 98 71
body:
    sin_phase_sum:  LEMMA sin_phase(x)*cos_phase(y)+cos_phase(x)*sin_phase(y)
       = IF x+y < 2*pi THEN sin_phase(x+y) ELSE sin_phase(x+y-2*pi) ENDIF


decl_type: function
theory: sincos_phase
library: trig_fnd
signature: [trig_phase -> real_abs_le1]
location: 21 2 27 12
body:
    sin_phase(x:trig_phase):real_abs_le1
       = LET   i = floor((2*x)/pi) IN
         IF    i = 0 THEN  sin_value(x)
         ELSIF i = 1 THEN  sin_value(pi-x)
         ELSIF i = 2 THEN -sin_value(x-pi)
                     ELSE -sin_value(2*pi-x)
         ENDIF


decl_type: function
theory: sincos_phase
library: trig_fnd
signature: [trig_phase -> real_abs_le1]
location: 29 2 31 62
body:
    cos_phase(x:trig_phase):real_abs_le1
       = LET i = floor(x/pi) IN
         IF i = 0 THEN cos_value(x) ELSE cos_value(2*pi-x) ENDIF


decl_type: tcc
theory: sincos_phase
library: trig_fnd
signature: nil
location: 105 0 107 999
body:
  % Subtype TCC generated (at line 14, column 62) for  0
      % expected type  trig_phase
  trig_phase_TCC1: OBLIGATION 0 < 2 * pi;


decl_type: tcc
theory: sincos_phase
library: trig_fnd
signature: nil
location: 109 0 114 999
body:
  % Subtype TCC generated (at line 23, column 35) for  x
      % expected type  real_abs_le_pi2
  sin_phase_TCC1: OBLIGATION
    FORALL (x: trig_phase,
            i: {i | i <= (2 * x) / pi & (2 * x) / pi < 1 + i}):
      i = 0 AND i = floor((2 * x) / pi) IMPLIES -pi / 2 <= x AND x <= pi / 2;


decl_type: tcc
theory: sincos_phase
library: trig_fnd
signature: nil
location: 116 0 122 999
body:
  % Subtype TCC generated (at line 24, column 35) for  pi - x
      % expected type  real_abs_le_pi2
  sin_phase_TCC2: OBLIGATION
    FORALL (x: trig_phase,
            i: {i | i <= (2 * x) / pi & (2 * x) / pi < 1 + i}):
      i = 1 AND NOT i = 0 AND i = floor((2 * x) / pi) IMPLIES
       -pi / 2 <= pi - x AND pi - x <= pi / 2;


decl_type: tcc
theory: sincos_phase
library: trig_fnd
signature: nil
location: 124 0 130 999
body:
  % Subtype TCC generated (at line 25, column 35) for  x - pi
      % expected type  real_abs_le_pi2
  sin_phase_TCC3: OBLIGATION
    FORALL (x: trig_phase,
            i: {i | i <= (2 * x) / pi & (2 * x) / pi < 1 + i}):
      i = 2 AND NOT i = 1 AND NOT i = 0 AND i = floor((2 * x) / pi) IMPLIES
       -pi / 2 <= x - pi AND x - pi <= pi / 2;


decl_type: tcc
theory: sincos_phase
library: trig_fnd
signature: nil
location: 132 0 138 999
body:
  % Subtype TCC generated (at line 25, column 24) for  -sin_value(x - pi)
      % expected type  real_abs_le1
  sin_phase_TCC4: OBLIGATION
    FORALL (x: trig_phase,
            i: {i | i <= (2 * x) / pi & (2 * x) / pi < 1 + i}):
      i = 2 AND NOT i = 1 AND NOT i = 0 AND i = floor((2 * x) / pi) IMPLIES
       -1 <= -sin_value(x - pi) AND -sin_value(x - pi) <= 1;


decl_type: tcc
theory: sincos_phase
library: trig_fnd
signature: nil
location: 140 0 146 999
body:
  % Subtype TCC generated (at line 26, column 35) for  2 * pi - x
      % expected type  real_abs_le_pi2
  sin_phase_TCC5: OBLIGATION
    FORALL (x: trig_phase,
            i: {i | i <= (2 * x) / pi & (2 * x) / pi < 1 + i}):
      NOT i = 2 AND NOT i = 1 AND NOT i = 0 AND i = floor((2 * x) / pi)
       IMPLIES -pi / 2 <= 2 * pi - x AND 2 * pi - x <= pi / 2;


decl_type: tcc
theory: sincos_phase
library: trig_fnd
signature: nil
location: 148 0 154 999
body:
  % Subtype TCC generated (at line 26, column 24) for  -sin_value(2 * pi - x)
      % expected type  real_abs_le1
  sin_phase_TCC6: OBLIGATION
    FORALL (x: trig_phase,
            i: {i | i <= (2 * x) / pi & (2 * x) / pi < 1 + i}):
      NOT i = 2 AND NOT i = 1 AND NOT i = 0 AND i = floor((2 * x) / pi)
       IMPLIES -1 <= -sin_value(2 * pi - x) AND -sin_value(2 * pi - x) <= 1;


decl_type: tcc
theory: sincos_phase
library: trig_fnd
signature: nil
location: 156 0 160 999
body:
  % Subtype TCC generated (at line 31, column 31) for  x
      % expected type  nnreal_le_pi
  cos_phase_TCC1: OBLIGATION
    FORALL (x: trig_phase, i: {i | i <= x / pi & x / pi < 1 + i}):
      i = 0 AND i = floor(x / pi) IMPLIES x <= pi;


decl_type: tcc
theory: sincos_phase
library: trig_fnd
signature: nil
location: 162 0 167 999
body:
  % Subtype TCC generated (at line 31, column 49) for  2 * pi - x
      % expected type  nnreal_le_pi
  cos_phase_TCC2: OBLIGATION
    FORALL (x: trig_phase, i: {i | i <= x / pi & x / pi < 1 + i}):
      NOT i = 0 AND i = floor(x / pi) IMPLIES
       2 * pi - x >= 0 AND 2 * pi - x <= pi;


decl_type: tcc
theory: sincos_phase
library: trig_fnd
signature: nil
location: 169 0 173 999
body:
  % Subtype TCC generated (at line 41, column 65) for  x
      % expected type  real_abs_le_pi2
  sin_q1_TCC1: OBLIGATION
    FORALL (x: trig_phase):
      floor((2 * x) / pi) = 0 IMPLIES -pi / 2 <= x AND x <= pi / 2;


decl_type: tcc
theory: sincos_phase
library: trig_fnd
signature: nil
location: 175 0 179 999
body:
  % Subtype TCC generated (at line 42, column 65) for  x - pi / 2
      % expected type  nnreal_le_pi
  sin_q2_TCC1: OBLIGATION
    FORALL (x: trig_phase):
      floor((2 * x) / pi) = 1 IMPLIES x - pi / 2 >= 0 AND x - pi / 2 <= pi;


decl_type: tcc
theory: sincos_phase
library: trig_fnd
signature: nil
location: 181 0 185 999
body:
  % Subtype TCC generated (at line 43, column 65) for  x - pi
      % expected type  real_abs_le_pi2
  sin_q3_TCC1: OBLIGATION
    FORALL (x: trig_phase):
      floor((2 * x) / pi) = 2 IMPLIES -pi / 2 <= x - pi AND x - pi <= pi / 2;


decl_type: tcc
theory: sincos_phase
library: trig_fnd
signature: nil
location: 187 0 192 999
body:
  % Subtype TCC generated (at line 44, column 65) for  x - 3 * pi / 2
      % expected type  nnreal_le_pi
  sin_q4_TCC1: OBLIGATION
    FORALL (x: trig_phase):
      floor((2 * x) / pi) = 3 IMPLIES
       x - 3 * pi / 2 >= 0 AND x - 3 * pi / 2 <= pi;


decl_type: tcc
theory: sincos_phase
library: trig_fnd
signature: nil
location: 194 0 197 999
body:
  % Subtype TCC generated (at line 51, column 65) for  x
      % expected type  nnreal_le_pi
  cos_q1_TCC1: OBLIGATION
    FORALL (x: trig_phase): floor((2 * x) / pi) = 0 IMPLIES x <= pi;


decl_type: tcc
theory: sincos_phase
library: trig_fnd
signature: nil
location: 199 0 204 999
body:
  % Subtype TCC generated (at line 52, column 65) for  x - pi / 2
      % expected type  real_abs_le_pi2
  cos_q2_TCC1: OBLIGATION
    FORALL (x: trig_phase):
      floor((2 * x) / pi) = 1 IMPLIES
       -pi / 2 <= x - pi / 2 AND x - pi / 2 <= pi / 2;


decl_type: tcc
theory: sincos_phase
library: trig_fnd
signature: nil
location: 206 0 210 999
body:
  % Subtype TCC generated (at line 53, column 65) for  x - pi
      % expected type  nnreal_le_pi
  cos_q3_TCC1: OBLIGATION
    FORALL (x: trig_phase):
      floor((2 * x) / pi) = 2 IMPLIES x - pi >= 0 AND x - pi <= pi;


decl_type: tcc
theory: sincos_phase
library: trig_fnd
signature: nil
location: 212 0 217 999
body:
  % Subtype TCC generated (at line 54, column 65) for  x - 3 * pi / 2
      % expected type  real_abs_le_pi2
  cos_q4_TCC1: OBLIGATION
    FORALL (x: trig_phase):
      floor((2 * x) / pi) = 3 IMPLIES
       -pi / 2 <= x - 3 * pi / 2 AND x - 3 * pi / 2 <= pi / 2;


decl_type: tcc
theory: sincos_phase
library: trig_fnd
signature: nil
location: 219 0 223 999
body:
  % Subtype TCC generated (at line 56, column 61) for  x - pi
      % expected type  trig_phase
  sin_h2_TCC1: OBLIGATION
    FORALL (x: trig_phase):
      floor(x / pi) = 1 IMPLIES x - pi >= 0 AND x - pi < 2 * pi;


decl_type: tcc
theory: sincos_phase
library: trig_fnd
signature: nil
location: 225 0 228 999
body:
  % Subtype TCC generated (at line 57, column 61) for  x + pi
      % expected type  trig_phase
  sin_h1_TCC1: OBLIGATION
    FORALL (x: trig_phase): floor(x / pi) = 0 IMPLIES x + pi < 2 * pi;


decl_type: tcc
theory: sincos_phase
library: trig_fnd
signature: nil
location: 230 0 234 999
body:
  % Subtype TCC generated (at line 61, column 39) for  2 * pi - px
      % expected type  trig_phase
  sin_phase_neg_TCC1: OBLIGATION
    FORALL (px: {x: posreal | x < 2 * pi}):
      2 * pi - px >= 0 AND 2 * pi - px < 2 * pi;


decl_type: tcc
theory: sincos_phase
library: trig_fnd
signature: nil
location: 236 0 239 999
body:
  % Subtype TCC generated (at line 64, column 49) for  pi / 2 + x
      % expected type  trig_phase
  sin_eqv_cos_phase_TCC1: OBLIGATION
    FORALL (x: trig_phase): x < 3 * pi / 2 IMPLIES pi / 2 + x < 2 * pi;


decl_type: tcc
theory: sincos_phase
library: trig_fnd
signature: nil
location: 241 0 246 999
body:
  % Subtype TCC generated (at line 65, column 49) for  x - 3 * pi / 2
      % expected type  trig_phase
  sin_eqv_cos_phase_TCC2: OBLIGATION
    FORALL (x: trig_phase):
      NOT x < 3 * pi / 2 IMPLIES
       x - 3 * pi / 2 >= 0 AND x - 3 * pi / 2 < 2 * pi;


decl_type: tcc
theory: sincos_phase
library: trig_fnd
signature: nil
location: 248 0 251 999
body:
  % Subtype TCC generated (at line 70, column 45) for  x + pi
      % expected type  trig_phase
  sin_phase_inv_TCC1: OBLIGATION
    FORALL (x: trig_phase): x < pi IMPLIES x + pi < 2 * pi;


decl_type: tcc
theory: sincos_phase
library: trig_fnd
signature: nil
location: 253 0 257 999
body:
  % Subtype TCC generated (at line 70, column 67) for  x - pi
      % expected type  trig_phase
  sin_phase_inv_TCC2: OBLIGATION
    FORALL (x: trig_phase):
      NOT x < pi IMPLIES x - pi >= 0 AND x - pi < 2 * pi;


decl_type: tcc
theory: sincos_phase
library: trig_fnd
signature: nil
location: 259 0 261 999
body:
  % Subtype TCC generated (at line 73, column 39) for  3 * pi / 2
      % expected type  trig_phase
  sin_phase_3pi2_TCC1: OBLIGATION 3 * pi / 2 < 2 * pi;


decl_type: tcc
theory: sincos_phase
library: trig_fnd
signature: nil
location: 263 0 265 999
body:
  % Subtype TCC generated (at line 75, column 39) for  pi / 4
      % expected type  trig_phase
  sin_phase_pi4_TCC1: OBLIGATION pi / 4 < 2 * pi;


decl_type: tcc
theory: sincos_phase
library: trig_fnd
signature: nil
location: 267 0 269 999
body:
  % Subtype TCC generated (at line 76, column 39) for  pi / 2
      % expected type  trig_phase
  sin_phase_pi2_TCC1: OBLIGATION pi / 2 < 2 * pi;


decl_type: tcc
theory: sincos_phase
library: trig_fnd
signature: nil
location: 271 0 273 999
body:
  % Subtype TCC generated (at line 80, column 39) for  pi
      % expected type  trig_phase
  cos_phase_pi_TCC1: OBLIGATION pi < 2 * pi;


decl_type: tcc
theory: sincos_phase
library: trig_fnd
signature: nil
location: 275 0 279 999
body:
  % Subtype TCC generated (at line 82, column 54) for  asin(xa) + 2 * pi
      % expected type  trig_phase
  sin_phase_asin_TCC1: OBLIGATION
    FORALL (xa: real_abs_le1):
      xa < 0 IMPLIES asin(xa) + 2 * pi >= 0 AND asin(xa) + 2 * pi < 2 * pi;


decl_type: tcc
theory: sincos_phase
library: trig_fnd
signature: nil
location: 281 0 285 999
body:
  % Subtype TCC generated (at line 83, column 54) for  asin(xa)
      % expected type  trig_phase
  sin_phase_asin_TCC2: OBLIGATION
    FORALL (xa: real_abs_le1):
      NOT xa < 0 IMPLIES asin(xa) >= 0 AND asin(xa) < 2 * pi;


decl_type: tcc
theory: sincos_phase
library: trig_fnd
signature: nil
location: 287 0 290 999
body:
  % Subtype TCC generated (at line 84, column 39) for  acos(xa)
      % expected type  trig_phase
  cos_phase_acos_TCC1: OBLIGATION
    FORALL (xa: real_abs_le1): acos(xa) < 2 * pi;


decl_type: tcc
theory: sincos_phase
library: trig_fnd
signature: nil
location: 292 0 295 999
body:
  % Subtype TCC generated (at line 89, column 36) for  x - y
      % expected type  trig_phase
  sin_phase_diff_TCC1: OBLIGATION
    FORALL (x, y: trig_phase): x - y >= 0 IMPLIES x - y < 2 * pi;


decl_type: tcc
theory: sincos_phase
library: trig_fnd
signature: nil
location: 297 0 301 999
body:
  % Subtype TCC generated (at line 89, column 56) for  x - y + 2 * pi
      % expected type  trig_phase
  sin_phase_diff_TCC2: OBLIGATION
    FORALL (x, y: trig_phase):
      NOT x - y >= 0 IMPLIES x - y + 2 * pi >= 0 AND x - y + 2 * pi < 2 * pi;


decl_type: tcc
theory: sincos_phase
library: trig_fnd
signature: nil
location: 303 0 308 999
body:
  % Subtype TCC generated (at line 92, column 56) for  x + y - 2 * pi
      % expected type  trig_phase
  cos_phase_sum_TCC1: OBLIGATION
    FORALL (x, y: trig_phase):
      NOT x + y < 2 * pi IMPLIES
       x + y - 2 * pi >= 0 AND x + y - 2 * pi < 2 * pi;


decl_type: tcc
theory: sincos_def
library: trig_fnd
signature: nil
location: 60 0 66 999
body:
  % Subtype TCC generated (at line 19, column 32) for
      % x - 2 * pi * floor(x / (2 * pi))
      % expected type  trig_phase
  sin_TCC1: OBLIGATION
    FORALL (x: real):
      x - 2 * pi * floor(x / (2 * pi)) >= 0 AND
       x - 2 * pi * floor(x / (2 * pi)) < 2 * pi;


decl_type: tcc
theory: sincos_def
library: trig_fnd
signature: nil
location: 68 0 70 999
body:
  % Judgement subtype TCC generated (at line 22, column 26) for  sin(a)
      % expected type  trig_range
  sin_range: OBLIGATION FORALL (a): -1 <= sin(a) AND sin(a) <= 1;


decl_type: tcc
theory: sincos_def
library: trig_fnd
signature: nil
location: 72 0 74 999
body:
  % Judgement subtype TCC generated (at line 23, column 26) for  cos(a)
      % expected type  trig_range
  cos_range: OBLIGATION FORALL (a): -1 <= cos(a) AND cos(a) <= 1;


decl_type: tcc
theory: sincos_def
library: trig_fnd
signature: nil
location: 76 0 78 999
body:
  % Subtype TCC generated (at line 30, column 33) for  cos(a)
      % expected type  nznum
  tan_TCC1: OBLIGATION FORALL (a: (Tan?)): cos(a) /= 0;


decl_type: tcc
theory: sincos_def
library: trig_fnd
signature: nil
location: 80 0 83 999
body:
  % Subtype TCC generated (at line 38, column 75) for  a
      % expected type  trig_phase
  sin_sin_phase_TCC1: OBLIGATION
    FORALL (a: real): a < 2 * pi AND 0 <= a IMPLIES a >= 0;


decl_type: tcc
theory: sincos_def
library: trig_fnd
signature: nil
location: 85 0 89 999
body:
  % Subtype TCC generated (at line 40, column 75) for  a
      % expected type  real_abs_le_pi2
  sin_sin_value_TCC1: OBLIGATION
    FORALL (a: real):
      a <= pi / 2 AND -pi / 2 <= a IMPLIES -pi / 2 <= a AND a <= pi / 2;


decl_type: tcc
theory: sincos_def
library: trig_fnd
signature: nil
location: 91 0 94 999
body:
  % Subtype TCC generated (at line 41, column 75) for  a
      % expected type  nnreal_le_pi
  cos_cos_value_TCC1: OBLIGATION
    FORALL (a: real): a <= pi AND 0 <= a IMPLIES a >= 0;


decl_type: tcc
theory: sincos_def
library: trig_fnd
signature: nil
location: 96 0 99 999
body:
  % Subtype TCC generated (at line 45, column 60) for  a
      % expected type  (Tan?)
  tan_tan_value_TCC1: OBLIGATION
    FORALL (a: real): a < pi / 2 AND -pi / 2 < a IMPLIES Tan?(a);


decl_type: tcc
theory: sincos_def
library: trig_fnd
signature: nil
location: 101 0 105 999
body:
  % Subtype TCC generated (at line 45, column 75) for  a
      % expected type  real_abs_lt_pi2
  tan_tan_value_TCC2: OBLIGATION
    FORALL (a: real):
      a < pi / 2 AND -pi / 2 < a IMPLIES -pi / 2 < a AND a < pi / 2;


decl_type: tcc
theory: sincos_def
library: trig_fnd
signature: nil
location: 107 0 109 999
body:
  % Subtype TCC generated (at line 49, column 22) for  atan(a)
      % expected type  (Tan?)
  tan_atan_TCC1: OBLIGATION FORALL (a: real): Tan?(atan(a));


decl_type: tcc
theory: sincos_def
library: trig_fnd
signature: nil
location: 111 0 113 999
body:
  % Subtype TCC generated (at line 53, column 55) for  x
      % expected type  (Tan?)
  atan_tan_TCC1: OBLIGATION FORALL (x: real_abs_lt_pi2): Tan?(x);


decl_type: formula
theory: atan_approx
library: trig_fnd
signature: nil
location: 31 2 32 71
body:
    atan_pos_le1_bounds: LEMMA 0 < x AND x <= 1 IMPLIES
      (atan_pos_le1_lb(n,x) < atan(x) AND atan(x) < atan_pos_le1_ub(n,x))


decl_type: formula
theory: atan_approx
library: trig_fnd
signature: nil
location: 100 2 101 61
body:
    pi_lb_pi: LEMMA pi-pi_lbn(n) <= 16*((1/5)^(4*n+5)/(4*n+5)) +
                                    4*((1/239)^(4*n+3)/(4*n+3))


decl_type: formula
theory: atan_approx
library: trig_fnd
signature: nil
location: 103 2 104 61
body:
    pi_ub_pi: LEMMA pi_ubn(n)-pi <= 16*((1/5)^(4*n+3)/(4*n+3)) +
                                    4*((1/239)^(4*n+5)/(4*n+5))


decl_type: formula
theory: atan_approx
library: trig_fnd
signature: nil
location: 110 2 114 39
body:
    pi_ub_diff: LEMMA pi_ubn(n)-pi_ubn(n+1) = 
                     16*(((1/5)^(3+4*n))*(1/(3+4*n)))
                     -16*(((1/5)^(5+4*n))*(1/(5+4*n)))
                     +4*(((1/239)^(5+4*n))*(1/(5+4*n)))
                     -4*(((1/239)^(7+4*n))*(1/(7+4*n)))


decl_type: formula
theory: atan_approx
library: trig_fnd
signature: nil
location: 116 2 118 63
body:
    pi_lb_diff_bounds: LEMMA n>=5 IMPLIES
      LET xdiff = pi_lbn(n+1)-pi_lbn(n) IN
      14*(1/5)^(5*n+5) < xdiff AND xdiff < (116/25)*(1/5)^(4*n+3)


decl_type: formula
theory: atan_approx
library: trig_fnd
signature: nil
location: 120 2 122 48
body:
    pi_lb_quot_bounds: LEMMA 
      LET xquot = pi_lbn(n)/pi_lbn(n+1) IN
      1-14.5*(1/5)^(4*n+3) <= xquot AND xquot <= 1


decl_type: formula
theory: atan_approx
library: trig_fnd
signature: nil
location: 124 2 126 60
body:
    pi_ub_diff_bounds: LEMMA n>=5 IMPLIES
      LET xdiff = pi_ubn(n)-pi_ubn(n+1) IN
      32*(1/5)^(5*n+3) < xdiff AND xdiff < (7/5)*(1/5)^(4*n+3)


decl_type: formula
theory: atan_approx
library: trig_fnd
signature: nil
location: 128 2 130 49
body:
    pi_ub_quot_bounds: LEMMA 
      LET xquot = pi_ubn(n+1)/pi_ubn(n) IN
      1-(9/5)*(1/5)^(4*n+3) <= xquot AND xquot <= 1


decl_type: function
theory: atan_approx
library: trig_fnd
signature: [[nat, posreal] -> real]
location: 73 2 74 97
body:
    atan_pos_lb(n,px): real = IF px <= 1 THEN atan_pos_le1_lb(n,px) ELSE
                              max(atan_pos_le1_lb(n,1),pi_lbn(n)/2 - atan_pos_le1_ub(n,1/px)) ENDIF


decl_type: function
theory: atan_approx
library: trig_fnd
signature: [[nat, posreal] -> real]
location: 76 2 77 97
body:
    atan_pos_ub(n,px): real = IF px <= 1 THEN atan_pos_le1_ub(n,px) ELSE
                              max(atan_pos_le1_ub(n,1),pi_ubn(n)/2 - atan_pos_le1_lb(n,1/px)) ENDIF


decl_type: tcc
theory: atan_approx
library: trig_fnd
signature: nil
location: 137 0 139 999
body:
  % Judgement subtype TCC generated (at line 53, column 4) for  pi_lbn(n)
      % expected type  posreal
  pi_lb_pos: OBLIGATION FORALL (n): pi_lbn(n) >= 0 AND pi_lbn(n) > 0;


decl_type: tcc
theory: atan_approx
library: trig_fnd
signature: nil
location: 141 0 143 999
body:
  % Judgement subtype TCC generated (at line 56, column 4) for  pi_ubn(n)
      % expected type  posreal
  pi_ub_pos: OBLIGATION FORALL (n): pi_ubn(n) >= 0 AND pi_ubn(n) > 0;


decl_type: tcc
theory: atan_approx
library: trig_fnd
signature: nil
location: 145 0 147 999
body:
  % Judgement subtype TCC generated (at line 67, column 23) for  pi
      % expected type  {r: posreal | pi_lb < r AND r < pi_ub}
  pi_bound: OBLIGATION pi_lb < pi AND pi < pi_ub;


decl_type: tcc
theory: atan_approx
library: trig_fnd
signature: nil
location: 149 0 152 999
body:
  % Subtype TCC generated (at line 80, column 19) for  x
      % expected type  posreal
  atan_pos_bounds_TCC1: OBLIGATION
    FORALL (x: real): 0 < x IMPLIES x >= 0 AND x > 0;


decl_type: tcc
theory: atan_approx
library: trig_fnd
signature: nil
location: 154 0 156 999
body:
  % Subtype TCC generated (at line 82, column 54) for  x
      % expected type  posreal
  atan_lb_TCC1: OBLIGATION FORALL (x: real): x > 0 IMPLIES x >= 0;


decl_type: tcc
theory: atan_approx
library: trig_fnd
signature: nil
location: 158 0 161 999
body:
  % Subtype TCC generated (at line 84, column 55) for  -x
      % expected type  posreal
  atan_lb_TCC2: OBLIGATION
    FORALL (x: real): NOT x = 0 AND NOT x > 0 IMPLIES -x >= 0 AND -x > 0;


decl_type: formula
theory: trig_basic
library: trig_fnd
signature: nil
location: 120 2 121 67
body:
    arc_sin_cos  : LEMMA sq(a)+sq(b)=sq(c) IMPLIES
                              EXISTS d: a = c*cos(d) AND b = c*sin(d)


decl_type: tcc
theory: trig_basic
library: trig_fnd
signature: nil
location: 178 0 180 999
body:
  % Subtype TCC generated (at line 74, column 28) for  0
      % expected type  (Tan?)
  tan_0_TCC1: OBLIGATION Tan?(0);


decl_type: tcc
theory: trig_basic
library: trig_fnd
signature: nil
location: 182 0 184 999
body:
  % Subtype TCC generated (at line 80, column 40) for  -a
      % expected type  (Tan?)
  tan_neg_TCC1: OBLIGATION FORALL (a: (Tan?)): Tan?(-a);


decl_type: tcc
theory: trig_basic
library: trig_fnd
signature: nil
location: 186 0 188 999
body:
  % Subtype TCC generated (at line 97, column 26) for  pi
      % expected type  (Tan?)
  tan_pi_TCC1: OBLIGATION Tan?(pi);


decl_type: tcc
theory: trig_basic
library: trig_fnd
signature: nil
location: 190 0 192 999
body:
  % Subtype TCC generated (at line 102, column 26) for  2 * pi
      % expected type  (Tan?)
  tan_2pi_TCC1: OBLIGATION Tan?(2 * pi);


decl_type: tcc
theory: trig_basic
library: trig_fnd
signature: nil
location: 194 0 199 999
body:
  % Subtype TCC generated (at line 114, column 54) for  (1 - tan(a) * tan(b))
      % expected type  nznum
  tan_plus_TCC1: OBLIGATION
    FORALL (a, b: real):
      tan(a) * tan(b) /= 1 AND Tan?(a + b) AND Tan?(b) AND Tan?(a) IMPLIES
       (1 - tan(a) * tan(b)) /= 0;


decl_type: tcc
theory: trig_basic
library: trig_fnd
signature: nil
location: 201 0 206 999
body:
  % Subtype TCC generated (at line 118, column 54) for  (1 + tan(a) * tan(b))
      % expected type  nznum
  tan_minus_TCC1: OBLIGATION
    FORALL (a, b: real):
      tan(a) * tan(b) /= -1 AND Tan?(a - b) AND Tan?(b) AND Tan?(a) IMPLIES
       (1 + tan(a) * tan(b)) /= 0;


decl_type: tcc
theory: trig_basic
library: trig_fnd
signature: nil
location: 208 0 213 999
body:
  % Subtype TCC generated (at line 134, column 47) for  (1 - tan(a) * tan(a))
      % expected type  nznum
  tan_2a_TCC1: OBLIGATION
    FORALL (a: real):
      tan(a) * tan(a) /= 1 AND Tan?(2 * a) AND Tan?(a) IMPLIES
       (1 - tan(a) * tan(a)) /= 0;


decl_type: tcc
theory: trig_basic
library: trig_fnd
signature: nil
location: 215 0 218 999
body:
  % Subtype TCC generated (at line 145, column 51) for  a + j * pi
      % expected type  (Tan?)
  tan_period_TCC1: OBLIGATION
    FORALL (a: real, j: integer): Tan?(a) IMPLIES Tan?(a + j * pi);


decl_type: tcc
theory: trig_basic
library: trig_fnd
signature: nil
location: 220 0 222 999
body:
  % Subtype TCC generated (at line 151, column 26) for  k * pi
      % expected type  (Tan?)
  tan_k_pi_TCC1: OBLIGATION FORALL (k: integer): Tan?(k * pi);


decl_type: formula
theory: sincos
library: trig_fnd
signature: nil
location: 85 2 86 73
body:
    nderiv_sin_fun:  LEMMA derivable_n_times?(sin,n) AND
                           nderiv(n,sin) = LAMBDA (x:real): sin((n*pi/2)+x)


decl_type: formula
theory: sincos
library: trig_fnd
signature: nil
location: 87 2 88 73
body:
    nderiv_cos_fun:  LEMMA derivable_n_times?(cos,n) AND
                           nderiv(n,cos) = LAMBDA (x:real): cos((n*pi/2)+x)


decl_type: formula
theory: sincos
library: trig_fnd
signature: nil
location: 99 2 100 79
body:
    sin_taylors: LEMMA (EXISTS (c: between(0,x)): 
      sin(x) = sin_series_n(x,n)+nderiv(2*n+3,sin)(c)*x^(2*n+3)/factorial(2*n+3))


decl_type: formula
theory: sincos
library: trig_fnd
signature: nil
location: 102 2 103 79
body:
    cos_taylors: LEMMA (EXISTS (c: between(0,x)): 
      cos(x) = cos_series_n(x,n)+nderiv(2*n+2,cos)(c)*x^(2*n+2)/factorial(2*n+2))


decl_type: formula
theory: sincos
library: trig_fnd
signature: nil
location: 105 2 106 56
body:
    sin_series: LEMMA abs(sin(x)-sin_series_n(x,n))
                        <= abs(x^(2*n+3))/factorial(2*n+3)


decl_type: formula
theory: sincos
library: trig_fnd
signature: nil
location: 107 2 108 56
body:
    cos_series: LEMMA abs(cos(x)-cos_series_n(x,n))
                        <= abs(x^(2*n+2))/factorial(2*n+2)


decl_type: tcc
theory: sincos
library: trig_fnd
signature: nil
location: 116 0 119 999
body:
  % Assuming TCC generated (at line 30, column 12) for
      % analysis@derivatives_def[real]
      % generated from assumption derivatives_def.deriv_domain
  sin_convergence_TCC1: OBLIGATION deriv_domain?[real];


decl_type: tcc
theory: sincos
library: trig_fnd
signature: nil
location: 121 0 124 999
body:
  % Assuming TCC generated (at line 30, column 12) for
      % analysis@derivatives_def[real]
      % generated from assumption derivatives_def.not_one_element
  sin_convergence_TCC2: OBLIGATION not_one_element?[real];


decl_type: tcc
theory: sincos
library: trig_fnd
signature: nil
location: 126 0 128 999
body:
  % Subtype TCC generated (at line 73, column 33) for  sin
      % expected type  deriv_fun[real]
  deriv_sin_fun_TCC1: OBLIGATION derivable?[real](sin);


decl_type: tcc
theory: sincos
library: trig_fnd
signature: nil
location: 130 0 132 999
body:
  % Subtype TCC generated (at line 78, column 33) for  cos
      % expected type  deriv_fun[real]
  deriv_cos_fun_TCC1: OBLIGATION derivable?[real](cos);


decl_type: tcc
theory: sincos
library: trig_fnd
signature: nil
location: 134 0 137 999
body:
  % Subtype TCC generated (at line 91, column 33) for  (2 * n + 1)
      % expected type  {i: int | x /= 0 OR i >= 0}
  sin_series_term_TCC1: OBLIGATION
    FORALL (x: real, n: nat): x /= 0 OR (2 * n + 1) >= 0;


decl_type: tcc
theory: sincos
library: trig_fnd
signature: nil
location: 139 0 142 999
body:
  % Subtype TCC generated (at line 93, column 14) for  n
      % expected type  T_high[nat]
  sin_series_n_TCC1: OBLIGATION
    FORALL (n: nat): n >= 0 OR (EXISTS (j: nat): n <= j);


decl_type: tcc
theory: sincos
library: trig_fnd
signature: nil
location: 144 0 147 999
body:
  % Subtype TCC generated (at line 95, column 52) for  (2 * n)
      % expected type  {i: int | x /= 0 OR i >= 0}
  cos_series_term_TCC1: OBLIGATION
    FORALL (x: real, n: nat): NOT n = 0 IMPLIES x /= 0 OR (2 * n) >= 0;


decl_type: tcc
theory: sincos
library: trig_fnd
signature: nil
location: 149 0 153 999
body:
  % Subtype TCC generated (at line 100, column 44) for  sin
      % expected type  nderiv_fun[real](3 + 2 * n)
  sin_taylors_TCC1: OBLIGATION
    FORALL (n: nat, x: real, c: between[real](0, x)):
      derivable_n_times?[real](sin, 3 + 2 * n);


decl_type: tcc
theory: sincos
library: trig_fnd
signature: nil
location: 155 0 159 999
body:
  % Subtype TCC generated (at line 100, column 55) for  (2 * n + 3)
      % expected type  {i: int | x /= 0 OR i >= 0}
  sin_taylors_TCC2: OBLIGATION
    FORALL (n: nat, x: real, c: between[real](0, x)):
      x /= 0 OR (2 * n + 3) >= 0;


decl_type: tcc
theory: sincos
library: trig_fnd
signature: nil
location: 161 0 165 999
body:
  % Subtype TCC generated (at line 103, column 44) for  cos
      % expected type  nderiv_fun[real](2 + 2 * n)
  cos_taylors_TCC1: OBLIGATION
    FORALL (n: nat, x: real, c: between[real](0, x)):
      derivable_n_times?[real](cos, 2 + 2 * n);


decl_type: tcc
theory: sincos
library: trig_fnd
signature: nil
location: 167 0 171 999
body:
  % Subtype TCC generated (at line 103, column 55) for  (2 * n + 2)
      % expected type  {i: int | x /= 0 OR i >= 0}
  cos_taylors_TCC2: OBLIGATION
    FORALL (n: nat, x: real, c: between[real](0, x)):
      x /= 0 OR (2 * n + 2) >= 0;


decl_type: tcc
theory: sincos
library: trig_fnd
signature: nil
location: 173 0 176 999
body:
  % Subtype TCC generated (at line 106, column 32) for  (2 * n + 3)
      % expected type  {i: int | x /= 0 OR i >= 0}
  sin_series_TCC1: OBLIGATION
    FORALL (n: nat, x: real): x /= 0 OR (2 * n + 3) >= 0;


decl_type: tcc
theory: sincos
library: trig_fnd
signature: nil
location: 178 0 181 999
body:
  % Subtype TCC generated (at line 108, column 32) for  (2 * n + 2)
      % expected type  {i: int | x /= 0 OR i >= 0}
  cos_series_TCC1: OBLIGATION
    FORALL (n: nat, x: real): x /= 0 OR (2 * n + 2) >= 0;


decl_type: tcc
theory: deriv_sincos
library: trig_fnd
signature: nil
location: 55 0 57 999
body:
  % Assuming TCC generated (at line 24, column 4) for  analysis@derivatives[T]
      % generated from assumption derivatives.deriv_domain
  sin_derivable_TCC1: OBLIGATION deriv_domain?[T];


decl_type: tcc
theory: deriv_sincos
library: trig_fnd
signature: nil
location: 59 0 61 999
body:
  % Assuming TCC generated (at line 26, column 4) for  analysis@derivatives[T]
      % generated from assumption derivatives.not_one_element
  sin_derivable_TCC2: OBLIGATION not_one_element?[T];


decl_type: tcc
theory: integral_indef_sincos
library: trig_fnd
signature: nil
location: 80 0 84 999
body:
  % Assuming TCC generated (at line 13, column 12) for
      % analysis@derivatives[T]
      % generated from assumption derivatives.deriv_domain
  derivable_sin_lin_TCC1: OBLIGATION
    FORALL (a: real): a /= 0 IMPLIES deriv_domain?[T];


decl_type: tcc
theory: integral_indef_sincos
library: trig_fnd
signature: nil
location: 86 0 90 999
body:
  % Assuming TCC generated (at line 13, column 12) for
      % analysis@derivatives[T]
      % generated from assumption derivatives.not_one_element
  derivable_sin_lin_TCC2: OBLIGATION
    FORALL (a: real): a /= 0 IMPLIES not_one_element?[T];


decl_type: tcc
theory: integral_indef_sincos
library: trig_fnd
signature: nil
location: 106 0 110 999
body:
  % Assuming TCC generated (at line 17, column 6) for
      % analysis@indefinite_integral[T]
      % generated from assumption indefinite_integral.connected_domain
  cos_lin_integrable_TCC1: OBLIGATION
    FORALL (alpha: real): alpha /= 0 IMPLIES connected?[T];


decl_type: tcc
theory: integral_indef_sincos
library: trig_fnd
signature: nil
location: 119 0 122 999
body:
  % Assuming TCC generated (at line 17, column 6) for
      % analysis@indefinite_integral[T]
      % generated from assumption indefinite_integral.connected_domain
  integral_sin_TCC2: OBLIGATION connected?[T];


decl_type: tcc
theory: integral_indef_sincos
library: trig_fnd
signature: nil
location: 124 0 127 999
body:
  % Assuming TCC generated (at line 20, column 6) for
      % analysis@indefinite_integral[T]
      % generated from assumption indefinite_integral.not_one_element
  integral_sin_TCC3: OBLIGATION not_one_element?[T];


decl_type: tcc
theory: integral_sincos
library: trig_fnd
signature: nil
location: 47 0 49 999
body:
  % Assuming TCC generated (at line 21, column 36) for  deriv_sincos[T]
      % generated from assumption deriv_sincos.connected_domain
  IMP_deriv_sincos_TCC1: OBLIGATION connected?[T];


decl_type: tcc
theory: integral_sincos
library: trig_fnd
signature: nil
location: 51 0 53 999
body:
  % Assuming TCC generated (at line 21, column 36) for  deriv_sincos[T]
      % generated from assumption deriv_sincos.not_one_element
  IMP_deriv_sincos_TCC2: OBLIGATION not_one_element?[T];


decl_type: formula
theory: atan2
library: trig_fnd
signature: nil
location: 69 2 80 13
body:
    sin_atan2 : LEMMA
      (x /= 0 OR y /= 0) IMPLIES 
        sin(atan2(x,y)) = 
          IF x=0 THEN 
            IF y > 0 THEN 1 ELSE -1 ENDIF
          ELSE 
            LET yx = y/x IN 
            LET r = yx/sqrt((sq(yx)+1)) IN
              IF x > 0 THEN r
              ELSE -r
              ENDIF
          ENDIF


decl_type: formula
theory: atan2
library: trig_fnd
signature: nil
location: 82 2 91 13
body:
    cos_atan2 : LEMMA
      (x /= 0 OR y /= 0) IMPLIES
        cos(atan2(x,y)) = 
          IF x = 0 THEN 0 
          ELSE
            LET yx = y/x IN
            IF  x > 0 THEN 1/sqrt((sq(yx)+1)) 
            ELSE -1/sqrt((sq(yx)+1)) 
            ENDIF
          ENDIF


decl_type: tcc
theory: atan2
library: trig_fnd
signature: nil
location: 98 0 102 999
body:
  % Subtype TCC generated (at line 19, column 45) for  x
      % expected type  nznum
  atan2_TCC1: OBLIGATION
    FORALL (x: real, y: {z: real | x = 0 => z /= 0}):
      y >= 0 AND x > 0 IMPLIES x /= 0;


decl_type: tcc
theory: atan2
library: trig_fnd
signature: nil
location: 104 0 108 999
body:
  % Subtype TCC generated (at line 19, column 65) for  x
      % expected type  nznum
  atan2_TCC2: OBLIGATION
    FORALL (x: real, y: {z: real | x = 0 => z /= 0}):
      NOT y >= 0 AND x > 0 IMPLIES x /= 0;


decl_type: tcc
theory: atan2
library: trig_fnd
signature: nil
location: 110 0 114 999
body:
  % Subtype TCC generated (at line 21, column 35) for  x
      % expected type  nznum
  atan2_TCC3: OBLIGATION
    FORALL (x: real, y: {z: real | x = 0 => z /= 0}):
      NOT x = 0 AND NOT x > 0 IMPLIES x /= 0;


decl_type: tcc
theory: atan2
library: trig_fnd
signature: nil
location: 116 0 120 999
body:
  % Subtype TCC generated (at line 25, column 41) for  y
      % expected type  {z: real | x = 0 => z /= 0}
  atan2_0_2pi_TCC1: OBLIGATION
    FORALL (x, y: real):
      (x /= 0 OR y /= 0) AND y >= 0 AND x >= 0 IMPLIES x = 0 => y /= 0;


decl_type: tcc
theory: atan2
library: trig_fnd
signature: nil
location: 122 0 129 999
body:
  % Subtype TCC generated (at line 26, column 43) for  y
      % expected type  {z: real | x = 0 => z /= 0}
  atan2_0_2pi_TCC2: OBLIGATION
    FORALL (x, y: real):
      (x /= 0 OR y /= 0) AND
       ((x >= 0 AND y >= 0) => (0 <= atan2(x, y) AND atan2(x, y) <= pi / 2))
        AND y >= 0 AND x < 0
       IMPLIES x = 0 => y /= 0;


decl_type: tcc
theory: atan2
library: trig_fnd
signature: nil
location: 131 0 141 999
body:
  % Subtype TCC generated (at line 27, column 41) for  y
      % expected type  {z: real | x = 0 => z /= 0}
  atan2_0_2pi_TCC3: OBLIGATION
    FORALL (x, y: real):
           (x /= 0 OR y /= 0)
       AND ((x >= 0 AND y >= 0) =>
             (0 <= atan2(x, y) AND atan2(x, y) <= pi / 2))
       AND ((x < 0 AND y >= 0) =>
             (pi / 2 < atan2(x, y) AND atan2(x, y) <= pi))
       AND y < 0 AND x < 0
       IMPLIES x = 0 => y /= 0;


decl_type: tcc
theory: atan2
library: trig_fnd
signature: nil
location: 143 0 155 999
body:
  % Subtype TCC generated (at line 28, column 46) for  y
      % expected type  {z: real | x = 0 => z /= 0}
  atan2_0_2pi_TCC4: OBLIGATION
    FORALL (x, y: real):
           (x /= 0 OR y /= 0)
       AND ((x >= 0 AND y >= 0) =>
             (0 <= atan2(x, y) AND atan2(x, y) <= pi / 2))
       AND ((x < 0 AND y >= 0) =>
             (pi / 2 < atan2(x, y) AND atan2(x, y) <= pi))
       AND ((x < 0 AND y < 0) =>
             (pi < atan2(x, y) AND atan2(x, y) < 3 * pi / 2))
       AND y < 0 AND x >= 0
       IMPLIES x = 0 => y /= 0;


decl_type: tcc
theory: atan2
library: trig_fnd
signature: nil
location: 157 0 160 999
body:
  % Subtype TCC generated (at line 33, column 12) for  y
      % expected type  {z: real | x = 0 => z /= 0}
  atan2_ge_0_lt_2pi_TCC1: OBLIGATION
    FORALL (x, y: real): (x /= 0 OR y /= 0) IMPLIES x = 0 => y /= 0;


decl_type: tcc
theory: atan2
library: trig_fnd
signature: nil
location: 172 0 176 999
body:
  % Subtype TCC generated (at line 44, column 42) for  y * pz
      % expected type  {z: real | x * pz = 0 => z /= 0}
  atan2_cancel_pos_TCC1: OBLIGATION
    FORALL (pz: posreal, x, y: real):
      (x /= 0 OR y /= 0) IMPLIES x * pz = 0 => y * pz /= 0;


decl_type: tcc
theory: atan2
library: trig_fnd
signature: nil
location: 178 0 182 999
body:
  % Subtype TCC generated (at line 48, column 18) for  y * nz
      % expected type  {z: real | x * nz = 0 => z /= 0}
  atan2_cancel_neg_TCC1: OBLIGATION
    FORALL (nz: negreal, x, y: real):
      (x /= 0 OR y /= 0) IMPLIES x * nz = 0 => y * nz /= 0;


decl_type: tcc
theory: atan2
library: trig_fnd
signature: nil
location: 184 0 187 999
body:
  % Subtype TCC generated (at line 54, column 12) for  y
      % expected type  {z: real | x = 0 => z /= 0}
  atan2_swap_pos_TCC1: OBLIGATION
    FORALL (x, y: real): x * y > 0 IMPLIES x = 0 => y /= 0;


decl_type: tcc
theory: atan2
library: trig_fnd
signature: nil
location: 189 0 192 999
body:
  % Subtype TCC generated (at line 54, column 40) for  2
      % expected type  {i: int | y /= 0 OR i >= 0}
  atan2_swap_pos_TCC2: OBLIGATION
    FORALL (x, y: real): x * y > 0 IMPLIES y /= 0 OR 2 >= 0;


decl_type: tcc
theory: atan2
library: trig_fnd
signature: nil
location: 194 0 197 999
body:
  % Subtype TCC generated (at line 54, column 48) for  2
      % expected type  {i: int | x /= 0 OR i >= 0}
  atan2_swap_pos_TCC3: OBLIGATION
    FORALL (x, y: real): x * y > 0 IMPLIES x /= 0 OR 2 >= 0;


decl_type: tcc
theory: atan2
library: trig_fnd
signature: nil
location: 199 0 202 999
body:
  % Subtype TCC generated (at line 54, column 54) for  (2 * (x * y))
      % expected type  nznum
  atan2_swap_pos_TCC4: OBLIGATION
    FORALL (x, y: real): x * y > 0 IMPLIES (2 * (x * y)) /= 0;


decl_type: tcc
theory: atan2
library: trig_fnd
signature: nil
location: 204 0 207 999
body:
  % Subtype TCC generated (at line 58, column 12) for  y
      % expected type  {z: real | x = 0 => z /= 0}
  atan2_swap_neg_TCC1: OBLIGATION
    FORALL (x, y: real): x * y < 0 IMPLIES x = 0 => y /= 0;


decl_type: tcc
theory: atan2
library: trig_fnd
signature: nil
location: 209 0 212 999
body:
  % Subtype TCC generated (at line 58, column 41) for  2
      % expected type  {i: int | y /= 0 OR i >= 0}
  atan2_swap_neg_TCC2: OBLIGATION
    FORALL (x, y: real): x * y < 0 IMPLIES y /= 0 OR 2 >= 0;


decl_type: tcc
theory: atan2
library: trig_fnd
signature: nil
location: 214 0 217 999
body:
  % Subtype TCC generated (at line 58, column 49) for  2
      % expected type  {i: int | x /= 0 OR i >= 0}
  atan2_swap_neg_TCC3: OBLIGATION
    FORALL (x, y: real): x * y < 0 IMPLIES x /= 0 OR 2 >= 0;


decl_type: tcc
theory: atan2
library: trig_fnd
signature: nil
location: 219 0 222 999
body:
  % Subtype TCC generated (at line 58, column 55) for  (2 * (x * y))
      % expected type  nznum
  atan2_swap_neg_TCC4: OBLIGATION
    FORALL (x, y: real): x * y < 0 IMPLIES (2 * (x * y)) /= 0;


decl_type: tcc
theory: atan2
library: trig_fnd
signature: nil
location: 224 0 227 999
body:
  % Subtype TCC generated (at line 62, column 14) for  y
      % expected type  {z: real | x = 0 => z /= 0}
  atan2_swap_zero_TCC1: OBLIGATION
    FORALL (x, y: real): y /= 0 AND x = 0 IMPLIES x = 0 => y /= 0;


decl_type: tcc
theory: atan2
library: trig_fnd
signature: nil
location: 229 0 235 999
body:
  % Subtype TCC generated (at line 64, column 14) for  y
      % expected type  {z: real | x = 0 => z /= 0}
  atan2_swap_zero_TCC2: OBLIGATION
    FORALL (x, y: real):
      (x = 0 AND y /= 0 IMPLIES atan2(x, y) = atan2(y, x) + pi / 2) AND
       x /= 0 AND y = 0
       IMPLIES x = 0 => y /= 0;


decl_type: tcc
theory: atan2
library: trig_fnd
signature: nil
location: 237 0 240 999
body:
  % Subtype TCC generated (at line 67, column 17) for  sin(a)
      % expected type  {z: real | cos(a) = 0 => z /= 0}
  atan2_cos_sin_TCC1: OBLIGATION
    FORALL (a: {z: nnreal | z < 2 * pi}): cos(a) = 0 => sin(a) /= 0;


decl_type: tcc
theory: atan2
library: trig_fnd
signature: nil
location: 242 0 245 999
body:
  % Subtype TCC generated (at line 75, column 21) for  x
      % expected type  nznum
  sin_atan2_TCC1: OBLIGATION
    FORALL (x, y: real): (x /= 0 OR y /= 0) AND NOT x = 0 IMPLIES x /= 0;


decl_type: tcc
theory: to2pi
library: trig_fnd
signature: nil
location: 80 0 85 999
body:
  % Subtype TCC generated (at line 14, column 4) for  a - 2 * n * pi
      % expected type  nnreal_lt_2pi
  to2pi_TCC1: OBLIGATION
    FORALL (a: real, n: {i | i <= a / (2 * pi) & a / (2 * pi) < 1 + i}):
      n = floor(a / (2 * pi)) IMPLIES
       a - 2 * n * pi >= 0 AND a - 2 * n * pi < 2 * pi;


decl_type: tcc
theory: trig_inverses
library: trig_fnd
signature: nil
location: 108 0 110 999
body:
  % Subtype TCC generated (at line 82, column 64) for  asin(y)
      % expected type  {x: real_abs_le_pi2 | y = sin(x)}
  arcsin_TCC1: OBLIGATION FORALL (y: real_abs_le1): y = sin(asin(y));


decl_type: tcc
theory: trig_inverses
library: trig_fnd
signature: nil
location: 112 0 114 999
body:
  % Subtype TCC generated (at line 89, column 61) for  acos(y)
      % expected type  {x: nnreal_le_pi | y = cos(x)}
  arccos_TCC1: OBLIGATION FORALL (y: real_abs_le1): y = cos(acos(y));


decl_type: tcc
theory: trig_inverses
library: trig_fnd
signature: nil
location: 116 0 118 999
body:
  % Subtype TCC generated (at line 98, column 50) for  x
      % expected type  (Tan?)
  arctan_TCC1: OBLIGATION FORALL (x: real_abs_lt_pi2): Tan?(x);


decl_type: tcc
theory: trig_inverses
library: trig_fnd
signature: nil
location: 120 0 122 999
body:
  % Subtype TCC generated (at line 98, column 56) for  atan(y)
      % expected type  {x: real_abs_lt_pi2 | y = tan(x)}
  arctan_TCC2: OBLIGATION FORALL (y: real): y = tan(atan(y));


decl_type: tcc
theory: trig_inverses
library: trig_fnd
signature: nil
location: 124 0 126 999
body:
  % Subtype TCC generated (at line 100, column 44) for  arctan(y)
      % expected type  (Tan?)
  tan_arctan_TCC1: OBLIGATION FORALL (y: real): Tan?(arctan(y));


decl_type: tcc
theory: atan2_props
library: trig_fnd
signature: nil
location: 64 0 66 999
body:
  % Subtype TCC generated (at line 43, column 35) for  0
      % expected type  {z: real | nzx = 0 => z /= 0}
  atan2_x0_TCC1: OBLIGATION FORALL (nzx: nzreal): nzx = 0 => 0 /= 0;


decl_type: tcc
theory: atan2_props
library: trig_fnd
signature: nil
location: 68 0 70 999
body:
  % Subtype TCC generated (at line 52, column 39) for  1
      % expected type  {z: real | sqrt(3) = 0 => z /= 0}
  atan2_sqrt3_TCC1: OBLIGATION sqrt(3) = 0 => 1 /= 0;


decl_type: tcc
theory: atan2_props
library: trig_fnd
signature: nil
location: 72 0 74 999
body:
  % Subtype TCC generated (at line 56, column 39) for  -1
      % expected type  {z: real | sqrt(3) = 0 => z /= 0}
  atan2_sqrt3m1_TCC1: OBLIGATION sqrt(3) = 0 => -1 /= 0;


decl_type: tcc
theory: trig_extra
library: trig_fnd
signature: nil
location: 286 0 289 999
body:
  % Subtype TCC generated (at line 152, column 75) for  y
      % expected type  {z: real | x = 0 => z /= 0}
  sin_plus_cos_atan2_TCC1: OBLIGATION
    FORALL (x, y: real): x /= 0 OR y /= 0 IMPLIES x = 0 => y /= 0;


decl_type: formula
theory: trig_approx
library: trig_fnd
signature: nil
location: 77 2 78 72
body:
    sin_term_deriv: LEMMA derivable?[real](LAMBDA a: sin_term(a)(n)) AND
        deriv[real](LAMBDA a: sin_term(a)(n)) = (LAMBDA a: cos_term(a)(n))


decl_type: formula
theory: trig_approx
library: trig_fnd
signature: nil
location: 80 2 82 78
body:
    cos_term_deriv: LEMMA derivable?[real](LAMBDA a: cos_term(a)(n)) AND
        deriv[real](LAMBDA a: cos_term(a)(n)) =
                        (LAMBDA a: IF n = 0 THEN 0 ELSE -sin_term(a)(n-1) ENDIF)


decl_type: formula
theory: trig_approx
library: trig_fnd
signature: nil
location: 112 2 114 78
body:
    sin_approx_deriv: LEMMA derivable?[real](LAMBDA a: sin_approx(a,n)) AND
                      deriv[real](LAMBDA a: sin_approx(a,n))
                                                   = (LAMBDA a: cos_approx(a,n))


decl_type: formula
theory: trig_approx
library: trig_fnd
signature: nil
location: 116 2 118 79
body:
    cos_approx_deriv: LEMMA derivable?[real](LAMBDA a: cos_approx(a,n)) AND
                      deriv[real](LAMBDA a: cos_approx(a,n)) =
                        (LAMBDA a: IF n = 0 THEN 0 ELSE -sin_approx(a,n-1) ENDIF)


decl_type: formula
theory: trig_approx
library: trig_fnd
signature: nil
location: 173 2 174 77
body:
    sin_lb_deriv: LEMMA derivable?[nnreal](LAMBDA nnx: sin_lb(nnx,n)) AND
         deriv[nnreal](LAMBDA nnx: sin_lb(nnx,n)) = (LAMBDA nnx: cos_lb(nnx,n))


decl_type: formula
theory: trig_approx
library: trig_fnd
signature: nil
location: 176 2 177 77
body:
    sin_ub_deriv: LEMMA derivable?[nnreal](LAMBDA nnx: sin_ub(nnx,n)) AND
         deriv[nnreal](LAMBDA nnx: sin_ub(nnx,n)) = (LAMBDA nnx: cos_ub(nnx,n))


decl_type: formula
theory: trig_approx
library: trig_fnd
signature: nil
location: 179 2 181 73
body:
    cos_lb_deriv: LEMMA derivable?[real](LAMBDA a: cos_lb(a,n)) AND
         deriv[real](LAMBDA a: cos_lb(a,n))
           = (LAMBDA a: IF a < 0 THEN -sin_lb(a,n) ELSE -sin_ub(a,n) ENDIF)


decl_type: formula
theory: trig_approx
library: trig_fnd
signature: nil
location: 183 2 186 77
body:
    cos_ub_deriv: LEMMA derivable?[real](LAMBDA a: cos_ub(a,n)) AND
         deriv[real](LAMBDA a: cos_ub(a,n))
           = (LAMBDA a: IF n = 0 THEN 0 ELSIF
                           a < 0 THEN -sin_ub(a,n-1) ELSE -sin_lb(a,n-1) ENDIF)


decl_type: formula
theory: trig_approx
library: trig_fnd
signature: nil
location: 188 2 189 78
body:
    cos_lb_nn_strict_decreasing:
          LEMMA strict_decreasing?(LAMBDA (x:{x:nnreal| x <=  pi}): cos_lb(x,n))


decl_type: formula
theory: trig_approx
library: trig_fnd
signature: nil
location: 191 2 192 78
body:
    cos_lb_np_strict_increasing:
          LEMMA strict_increasing?(LAMBDA (x:{x:npreal| x >= -pi}): cos_lb(x,n))


decl_type: formula
theory: trig_approx
library: trig_fnd
signature: nil
location: 219 2 220 71
body:
    sin_term_pi_lb: LEMMA n >= Sin_pos_n IMPLIES
                          sin_term(pi_lbn(n+1))(2*n+2) < sin(pi_lbn(n+1))


decl_type: formula
theory: trig_approx
library: trig_fnd
signature: nil
location: 243 2 245 75
body:
    cos_ub_nn_strict_decreasing:
          LEMMA n>=1 IMPLIES 
          strict_decreasing?(LAMBDA (x:{x:nnreal| x <=  pi_lb_est(n)}): cos_ub(x,n))


decl_type: formula
theory: trig_approx
library: trig_fnd
signature: nil
location: 247 2 249 75
body:
    cos_ub_np_strict_increasing:
          LEMMA n>=1 IMPLIES 
          strict_increasing?(LAMBDA (x:{x:npreal| x >= -pi_lb_est(n)}): cos_ub(x,n))


decl_type: formula
theory: trig_approx
library: trig_fnd
signature: nil
location: 253 2 254 102
body:
    sin_lb_increasing: LEMMA 
      strict_increasing?(LAMBDA (x:{x:real| -pi_lb_est(n)/2 <= x AND x <= pi_lb_est(n)/2}): sin_lb(x,n))


decl_type: formula
theory: trig_approx
library: trig_fnd
signature: nil
location: 256 2 257 102
body:
    sin_ub_increasing: LEMMA 
      strict_increasing?(LAMBDA (x:{x:real| -pi_lb_est(n)/2 <= x AND x <= pi_lb_est(n)/2}): sin_ub(x,n))


decl_type: formula
theory: trig_approx
library: trig_fnd
signature: nil
location: 259 2 260 80
body:
    sin_lb_nn_decreasing: LEMMA
      strict_decreasing?(LAMBDA (x:{x:real | pi/2 <= x AND x <= pi}): sin_lb(x,n))


decl_type: formula
theory: trig_approx
library: trig_fnd
signature: nil
location: 262 2 263 73
body:
    cos_term_pi_ub: LEMMA n >= Cos_pos_n IMPLIES
                          -cos_term(pi_ubn(n)/2)(2*n+1) < -cos(pi_ubn(n)/2)


decl_type: formula
theory: trig_approx
library: trig_fnd
signature: nil
location: 273 2 274 100
body:
    sin_ub_nn_decreasing: LEMMA n>=1 IMPLIES 
      strict_decreasing?(LAMBDA (x:{x:real | pi_ub_est(n)/2 <= x AND x <= pi_lb_est(n)}): sin_ub(x,n))


decl_type: function
theory: trig_approx
library: trig_fnd
signature: [nat -> {rr: nnreal | rr < pi}]
location: 230 2 232 24
body:
    pi_lb_est(n:nat): {rr:nnreal | rr < pi} =
      IF n < 12 THEN pi_lbn(n)-2/(n^3+1)
      ELSE pi_lbn(n) ENDIF


decl_type: function
theory: trig_approx
library: trig_fnd
signature: [nat -> {rr: nnreal | pi < rr AND rr < 3 * pi / 2}]
location: 269 2 271 24
body:
    pi_ub_est(n:nat): {rr:nnreal | pi < rr AND rr < 3*pi/2} =
      IF n < 5 THEN pi_ubn(n)+1/(n+1)^4
      ELSE pi_ubn(n) ENDIF


decl_type: tcc
theory: trig_approx
library: trig_fnd
signature: nil
location: 281 0 284 999
body:
  % Subtype TCC generated (at line 40, column 35) for  (2 * n + 1)
      % expected type  {i: int | a /= 0 OR i >= 0}
  sin_term_TCC1: OBLIGATION
    FORALL (a: real, n: nat): a /= 0 OR (2 * n + 1) >= 0;


decl_type: tcc
theory: trig_approx
library: trig_fnd
signature: nil
location: 286 0 289 999
body:
  % Subtype TCC generated (at line 59, column 54) for  (2 * n)
      % expected type  {i: int | a /= 0 OR i >= 0}
  cos_term_TCC1: OBLIGATION
    FORALL (a: real, n: nat): NOT n = 0 IMPLIES a /= 0 OR (2 * n) >= 0;


decl_type: tcc
theory: trig_approx
library: trig_fnd
signature: nil
location: 291 0 294 999
body:
  % Assuming TCC generated (at line 24, column 4) for
      % analysis@derivatives[real]
      % generated from assumption derivatives.deriv_domain
  sin_term_deriv_TCC1: OBLIGATION deriv_domain?[real];


decl_type: tcc
theory: trig_approx
library: trig_fnd
signature: nil
location: 296 0 299 999
body:
  % Assuming TCC generated (at line 26, column 4) for
      % analysis@derivatives[real]
      % generated from assumption derivatives.not_one_element
  sin_term_deriv_TCC2: OBLIGATION not_one_element?[real];


decl_type: tcc
theory: trig_approx
library: trig_fnd
signature: nil
location: 301 0 306 999
body:
  % Subtype TCC generated (at line 82, column 67) for  n - 1
      % expected type  nat
  cos_term_deriv_TCC1: OBLIGATION
    FORALL (n: nat):
      derivable?[real](LAMBDA a: cos_term(a)(n)) IMPLIES
       NOT n = 0 IMPLIES n - 1 >= 0;


decl_type: tcc
theory: trig_approx
library: trig_fnd
signature: nil
location: 308 0 311 999
body:
  % Subtype TCC generated (at line 84, column 33) for  n
      % expected type  T_high[nat]
  sin_approx_TCC1: OBLIGATION
    FORALL (n: nat): n >= 0 OR (EXISTS (j: nat): n <= j);


decl_type: tcc
theory: trig_approx
library: trig_fnd
signature: nil
location: 313 0 318 999
body:
  % Subtype TCC generated (at line 118, column 68) for  n - 1
      % expected type  nat
  cos_approx_deriv_TCC1: OBLIGATION
    FORALL (n: nat):
      derivable?[real](LAMBDA a: cos_approx(a, n)) IMPLIES
       NOT n = 0 IMPLIES n - 1 >= 0;


decl_type: tcc
theory: trig_approx
library: trig_fnd
signature: nil
location: 320 0 323 999
body:
  % Assuming TCC generated (at line 24, column 4) for
      % analysis@derivatives[nnreal]
      % generated from assumption derivatives.deriv_domain
  sin_lb_deriv_TCC1: OBLIGATION deriv_domain?[nnreal];


decl_type: tcc
theory: trig_approx
library: trig_fnd
signature: nil
location: 325 0 328 999
body:
  % Assuming TCC generated (at line 26, column 4) for
      % analysis@derivatives[nnreal]
      % generated from assumption derivatives.not_one_element
  sin_lb_deriv_TCC2: OBLIGATION not_one_element?[nnreal];


decl_type: tcc
theory: trig_approx
library: trig_fnd
signature: nil
location: 330 0 335 999
body:
  % Subtype TCC generated (at line 186, column 46) for  n - 1
      % expected type  nat
  cos_ub_deriv_TCC1: OBLIGATION
    FORALL (n: nat):
      derivable?[real](LAMBDA a: cos_ub(a, n)) IMPLIES
       (FORALL (a1): a1 < 0 AND NOT n = 0 IMPLIES n - 1 >= 0);


decl_type: tcc
theory: trig_approx
library: trig_fnd
signature: nil
location: 337 0 342 999
body:
  % Subtype TCC generated (at line 186, column 66) for  n - 1
      % expected type  nat
  cos_ub_deriv_TCC2: OBLIGATION
    FORALL (n: nat):
      derivable?[real](LAMBDA a: cos_ub(a, n)) IMPLIES
       (FORALL (a1): NOT a1 < 0 AND NOT n = 0 IMPLIES n - 1 >= 0);


decl_type: tcc
theory: trig_approx
library: trig_fnd
signature: nil
location: 344 0 346 999
body:
  % Subtype TCC generated (at line 231, column 34) for  3
      % expected type  {i: int | n /= 0 OR i >= 0}
  pi_lb_est_TCC1: OBLIGATION FORALL (n: nat): n < 12 IMPLIES n /= 0 OR 3 >= 0;


decl_type: tcc
theory: trig_approx
library: trig_fnd
signature: nil
location: 348 0 354 999
body:
  % Subtype TCC generated (at line 231, column 19) for
      % pi_lbn(n) - 2 / (n ^ 3 + 1)
      % expected type  {rr: nnreal | rr < pi}
  pi_lb_est_TCC2: OBLIGATION
    FORALL (n: nat):
      n < 12 IMPLIES
       pi_lbn(n) - 2 / (n ^ 3 + 1) >= 0 AND pi_lbn(n) - 2 / (n ^ 3 + 1) < pi;


decl_type: tcc
theory: trig_approx
library: trig_fnd
signature: nil
location: 356 0 359 999
body:
  % Subtype TCC generated (at line 232, column 9) for  pi_lbn(n)
      % expected type  {rr: nnreal | rr < pi}
  pi_lb_est_TCC3: OBLIGATION
    FORALL (n: nat): NOT n < 12 IMPLIES pi_lbn(n) < pi;


decl_type: tcc
theory: trig_approx
library: trig_fnd
signature: nil
location: 361 0 364 999
body:
  % Subtype TCC generated (at line 270, column 36) for  4
      % expected type  {i: int | NOT 1 + n = 0 OR i >= 0}
  pi_ub_est_TCC1: OBLIGATION
    FORALL (n: nat): n < 5 IMPLIES NOT 1 + n = 0 OR 4 >= 0;


decl_type: tcc
theory: trig_approx
library: trig_fnd
signature: nil
location: 366 0 373 999
body:
  % Subtype TCC generated (at line 270, column 18) for
      % pi_ubn(n) + 1 / (n + 1) ^ 4
      % expected type  {rr: nnreal | pi < rr AND rr < 3 * pi / 2}
  pi_ub_est_TCC2: OBLIGATION
    FORALL (n: nat):
      n < 5 IMPLIES
       pi < pi_ubn(n) + 1 / (n + 1) ^ 4 AND
        pi_ubn(n) + 1 / (n + 1) ^ 4 < 3 * pi / 2;


decl_type: tcc
theory: trig_approx
library: trig_fnd
signature: nil
location: 375 0 379 999
body:
  % Subtype TCC generated (at line 271, column 9) for  pi_ubn(n)
      % expected type  {rr: nnreal | pi < rr AND rr < 3 * pi / 2}
  pi_ub_est_TCC3: OBLIGATION
    FORALL (n: nat):
      NOT n < 5 IMPLIES pi < pi_ubn(n) AND pi_ubn(n) < 3 * pi / 2;


decl_type: formula
theory: law_cosines
library: trig_fnd
signature: nil
location: 44 2 49 74
body:
    dot_product   : LEMMA
                       LET a = dist(x1,y1,x0,y0),
                           b = dist(x2,y2,x0,y0),
                           c = dist(x2,y2,x1,y1) IN
                       EXISTS (ac) : 
                           a*c*cos(ac) = ((x0-x1)*(x2-x1) + (y0-y1)*(y2-y1))


decl_type: formula
theory: law_cosines
library: trig_fnd
signature: nil
location: 59 2 60 67
body:
    triangle      : LEMMA  dist(x0,y0,x1,y1) <= 
                                dist(x2,y2,x1,y1) + dist(x2,y2,x0,y0)


decl_type: formula
theory: deriv_sincos_ax
library: vect_analysis
signature: nil
location: 35 3 37 49
body:
     deriv_sin: AXIOM alpha /= 0 IMPLIES
         deriv[T](LAMBDA (x:T): k*sin(alpha*x)) =  
              (LAMBDA (t: T): k*alpha*cos(alpha*t))


decl_type: formula
theory: deriv_sincos_ax
library: vect_analysis
signature: nil
location: 39 3 41 50
body:
     deriv_cos: AXIOM alpha /= 0 IMPLIES
         deriv[T](LAMBDA (x:T): k*cos(alpha*x)) = 
              (LAMBDA (t: T): -k*alpha*sin(alpha*t))


decl_type: tcc
theory: deriv_sincos_ax
library: vect_analysis
signature: nil
location: 59 0 64 999
body:
  % Subtype TCC generated (at line 36, column 16) for
      % LAMBDA (x: T): k * sin(alpha * x)
      % expected type  deriv_fun[T]
  deriv_sin_TCC1: OBLIGATION
    FORALL (alpha, k: real):
      alpha /= 0 IMPLIES derivable?[T](LAMBDA (x: T): k * sin(alpha * x));


decl_type: tcc
theory: deriv_sincos_ax
library: vect_analysis
signature: nil
location: 66 0 71 999
body:
  % Subtype TCC generated (at line 40, column 16) for
      % LAMBDA (x: T): k * cos(alpha * x)
      % expected type  deriv_fun[T]
  deriv_cos_TCC1: OBLIGATION
    FORALL (alpha, k: real):
      alpha /= 0 IMPLIES derivable?[T](LAMBDA (x: T): k * cos(alpha * x));


decl_type: function
theory: vect_vect_2D_continuity
library: vect_analysis
signature: [[[Vect2, Nz_vect2] -> Vect2] -> bool]
location: 16 2 23 49
body:
    continuous_vvv?(ffv): bool =
      FORALL (epsil:posreal,s:Vect2,nzv:Nz_vect2): 
      EXISTS (ds, dv: posreal):
      FORALL (sp:Vect2,nzvp:Nz_vect2):
           norm(s - sp) < ds AND
           norm(nzv-nzvp) < dv
           IMPLIES
           norm(ffv(s, nzv) - ffv(sp,nzvp)) < epsil


decl_type: function
theory: vect_vect_2D_continuity
library: vect_analysis
location: 25 2 25 56
body: sum_vvv(ggv,hhv)(s,nzv): Vect2 = ggv(s,nzv)+hhv(s,nzv)
signature:
  [[[[Vect2, Nz_vect2] -> Vect2], [[Vect2, Nz_vect2] -> Vect2]] ->
          [[Vect2, Nz_vect2] -> Vect2]]


decl_type: function
theory: vect_vect_2D_continuity
library: vect_analysis
signature: [[[Vect2, Nz_vect2] -> real] -> bool]
location: 31 2 38 48
body:
    continuous_vvr?(ffr): bool =
      FORALL (epsil:posreal,s:Vect2,nzv:Nz_vect2): 
      EXISTS (ds, dv: posreal):
      FORALL (sp:Vect2,nzvp:Nz_vect2):
           norm(s - sp) < ds AND
           norm(nzv-nzvp) < dv
           IMPLIES
           abs(ffr(s, nzv) - ffr(sp,nzvp)) < epsil


decl_type: function
theory: vect_vect_2D_continuity
library: vect_analysis
location: 52 2 52 61
body: scal_vvr_vvv(ffr,ggv)(s,nzv): Vect2 = ffr(s,nzv)*ggv(s,nzv)
signature:
  [[[[Vect2, Nz_vect2] -> real], [[Vect2, Nz_vect2] -> Vect2]] ->
          [[Vect2, Nz_vect2] -> Vect2]]


decl_type: function
theory: vect_vect_2D_continuity
library: vect_analysis
location: 54 2 54 55
body: dot_vvv(ffv,ggv)(s,nzv): real = ffv(s,nzv)*ggv(s,nzv)
signature:
  [[[[Vect2, Nz_vect2] -> Vect2], [[Vect2, Nz_vect2] -> Vect2]] ->
          [[Vect2, Nz_vect2] -> real]]


decl_type: tcc
theory: vect_vect_2D_continuity
library: vect_analysis
signature: nil
location: 109 0 112 999
body:
  % Subtype TCC generated (at line 65, column 46) for  ggnz(s, nzv)
      % expected type  nznum
  div_vvr_TCC1: OBLIGATION
    FORALL (ggnz: (nzero_vvr?), s: Vect2, nzv: Nz_vect2): ggnz(s, nzv) /= 0;


decl_type: tcc
theory: vect_vect_2D_continuity
library: vect_analysis
signature: nil
location: 114 0 117 999
body:
  % Subtype TCC generated (at line 91, column 51) for  ggnzc
      % expected type  (nzero_vvr?)
  div_vvr_cont_TCC1: OBLIGATION
    FORALL (ggnzc: (continuous_nz_vvr?)): nzero_vvr?(ggnzc);


decl_type: tcc
theory: vect2_metric_space
library: vect_analysis
signature: nil
location: 30 0 34 999
body:
  % Assuming TCC generated (at line 16, column 33) for
      % analysis@metric_spaces[Vect2, dist]
      % generated from assumption metric_spaces.fullset_metric_space
  IMP_metric_spaces_TCC1: OBLIGATION
    metric_space?[Vect2, dist](fullset[Vect2]);


decl_type: formula
theory: vect2_Heine
library: vect_analysis
signature: nil
location: 23 3 30 97
body:
     curried_min_exists_2D: LEMMA FORALL (A: real, B: {x: real | A < x}):
      continuous?(f,fullset[[(closed_intv(A,B)),Vect2]])
       IMPLIES (FORALL (y: Vect2):  
          nonempty?[real]({r: real | EXISTS (t: (LAMBDA (x: real): A <= x AND x <= B)):r = f(t, y)})
      AND below_bounded[real]({r: real | EXISTS (t: (LAMBDA (x: real): A <= x AND x <= B)):r = f(t, y)})
      AND ext[real]({r: real | EXISTS (t: (LAMBDA (x: real): A <= x AND x <= B)): r = f(t, y)})
                (inf[real]({r: real | EXISTS (t: (LAMBDA (x: real): A <= x AND x <= B)): r = f(t, y)}))
      AND (EXISTS (tmin: (closed_intv(A,B))): FORALL (s: (closed_intv(A,B))): f(tmin,y) <= f(s,y)))


decl_type: formula
theory: vect2_Heine
library: vect_analysis
signature: nil
location: 32 3 37 40
body:
     curried_min_is_cont_2D: THEOREM FORALL (A: real, B: {x: real | A < x}): 
        continuous?(f,fullset[[(closed_intv(A,B)),Vect2]]) 
        IMPLIES
            LET unif_min_first(y: Vect2): real 
                = min({r: real | EXISTS (t: (closed_intv(A,B))): r = f(t,y)})
            IN continuous?(unif_min_first)


decl_type: formula
theory: vect2_Heine
library: vect_analysis
signature: nil
location: 39 3 50 106
body:
     curried_min_is_cont_2D_ed: THEOREM FORALL (A: real, B: {x: real | A < x}):
         (FORALL (x: (closed_intv(A,B)), y: Vect2, epsilon: posreal): 
            EXISTS (delta: posreal): 
               FORALL (z: (closed_intv(A,B)), w: Vect2): 
                 (real_dist(x,z) <= delta AND dist(y,w) <= delta) IMPLIES real_dist(f(x,y),f(z,w))<epsilon)
         IMPLIES
             LET unif_min_first(y: Vect2): real 
                 = min({r: real | EXISTS (t: (closed_intv(A,B))): r = f(t,y)})
             IN
                (FORALL (y: Vect2): FORALL (epsilon: posreal): 
                    EXISTS (delta: posreal): FORALL (q:Vect2):
                         dist(y,q) < delta IMPLIES real_dist(unif_min_first(y),unif_min_first(q)) < epsilon)


decl_type: formula
theory: vect2_Heine
library: vect_analysis
signature: nil
location: 55 3 57 79
body:
     multiary_Heine_2D:   THEOREM FORALL (A: real, B: {x: real | A < x}):
        continuous?(f,fullset[[(closed_intv(A,B)),Vect2]]) 
        IMPLIES uniformly_continuous_in_first?(f,closed_intv(A,B),fullset[Vect2])


decl_type: formula
theory: vect2_Heine
library: vect_analysis
signature: nil
location: 60 3 68 58
body:
     multiary_Heine_2D_ed:   THEOREM FORALL (A: real, B: {x: real | A < x}):
       (FORALL (x: (closed_intv(A,B)), y: Vect2, epsilon: posreal): 
          EXISTS (delta: posreal): 
             FORALL (z: (closed_intv(A,B)), w: Vect2): (real_dist(x,z) <= delta AND dist(y,w) <= delta) 
                                                            IMPLIES real_dist(f(x,y),f(z,w))<epsilon)
       IMPLIES
          FORALL (y1: Vect2, epsilon: posreal): EXISTS (delta: posreal):
             FORALL (x1,x2: (closed_intv(A,B)), y2: Vect2): (real_dist(x1,x2) <= delta AND dist(y1,y2) <= delta) 
                IMPLIES real_dist(f(x1,y1),f(x2,y2))<epsilon


decl_type: tcc
theory: vect2_Heine
library: vect_analysis
signature: nil
location: 75 0 79 999
body:
  % Assuming TCC generated (at line 18, column 13) for
      % analysis@cross_metric_real_fun[real, real_dist, Vect2, dist]
      % generated from assumption cross_metric_real_fun.fullset_metric_space1
  IMP_cross_metric_real_fun_TCC1: OBLIGATION
    metric_space?[real, real_dist](fullset[real]);


decl_type: tcc
theory: vect2_Heine
library: vect_analysis
signature: nil
location: 81 0 85 999
body:
  % Assuming TCC generated (at line 18, column 13) for
      % analysis@cross_metric_real_fun[real, real_dist, Vect2, dist]
      % generated from assumption cross_metric_real_fun.fullset_metric_space2
  IMP_cross_metric_real_fun_TCC2: OBLIGATION
    metric_space?[Vect2, dist](fullset[Vect2]);


decl_type: tcc
theory: vect2_Heine
library: vect_analysis
signature: nil
location: 87 0 90 999
body:
  % Subtype TCC generated (at line 24, column 42) for  B
      % expected type  {x: real | A <= x}
  curried_min_exists_2D_TCC1: OBLIGATION
    FORALL (A: real, B: {x: real | A < x}): A <= B;


decl_type: tcc
theory: vect2_Heine
library: vect_analysis
signature: nil
location: 92 0 124 999
body:
  % Subtype TCC generated (at line 36, column 20) for
      % {r: real |
      %    EXISTS (t: (LAMBDA (x: real): A <= x AND x <= B)): r = f(t, y)}
      % expected type  min_set[real]
  curried_min_is_cont_2D_TCC1: OBLIGATION
    FORALL (f: [[real, Vect2] -> real], A: real, B: {x: real | A < x}):
      continuous?(f,
                  extend
                      [[real, Vect2],
                       [(LAMBDA (x: real): A <= x AND x <= B), Vect2], bool,
                       FALSE]
                      (fullset
                           [[(LAMBDA (x: real): A <= x AND x <= B), Vect2]]))
       IMPLIES
       (FORALL (y: Vect2):
          nonempty?[real]
              ({r: real |
                  EXISTS (t: (LAMBDA (x: real): A <= x AND x <= B)):
                    r = f(t, y)})
           AND
           below_bounded[real]
               ({r: real |
                   EXISTS (t: (LAMBDA (x: real): A <= x AND x <= B)):
                     r = f(t, y)})
            AND
            ext[real]
                ({r: real |
                    EXISTS (t: (LAMBDA (x: real): A <= x AND x <= B)):
                      r = f(t, y)})
                (inf[real]
                     ({r: real |
                         EXISTS (t: (LAMBDA (x: real): A <= x AND x <= B)):
                           r = f(t, y)})));


decl_type: tcc
theory: vect2_Heine
library: vect_analysis
signature: nil
location: 126 0 157 999
body:
  % Subtype TCC generated (at line 46, column 21) for
      % {r: real |
      %    EXISTS (t: (LAMBDA (x: real): A <= x AND x <= B)): r = f(t, y)}
      % expected type  min_set[real]
  curried_min_is_cont_2D_ed_TCC1: OBLIGATION
    FORALL (f: [[real, Vect2] -> real], A: real, B: {x: real | A < x}):
      (FORALL (x: (LAMBDA (x: real): A <= x AND x <= B), y: Vect2,
               epsilon: posreal):
         EXISTS (delta: posreal):
           FORALL (z: (LAMBDA (x: real): A <= x AND x <= B), w: Vect2):
             (real_dist(x, z) <= delta AND dist(y, w) <= delta) IMPLIES
              real_dist(f(x, y), f(z, w)) < epsilon)
       IMPLIES
       (FORALL (y1: Vect2):
          nonempty?[real]
              ({r: real |
                  EXISTS (t: (LAMBDA (x: real): A <= x AND x <= B)):
                    r = f(t, y1)})
           AND
           below_bounded[real]
               ({r: real |
                   EXISTS (t: (LAMBDA (x: real): A <= x AND x <= B)):
                     r = f(t, y1)})
            AND
            ext[real]
                ({r: real |
                    EXISTS (t: (LAMBDA (x: real): A <= x AND x <= B)):
                      r = f(t, y1)})
                (inf[real]
                     ({r: real |
                         EXISTS (t: (LAMBDA (x: real): A <= x AND x <= B)):
                           r = f(t, y1)})));


decl_type: function
theory: four_vects_2D_continuity
library: vect_analysis
signature: [[[Vect2, Vect2, Vect2, Vect2] -> Vect2] -> bool]
location: 17 2 26 60
body:
    continuous_vvv?(ffv): bool =
      FORALL (epsil:posreal,so,vo,si,vi): 
      EXISTS (dso,dvo,dsi,dvi: posreal):
      FORALL (nso,nvo,nsi,nvi):
           norm(so - nso) < dso AND
           norm(vo - nvo) < dvo AND
           norm(si - nsi) < dsi AND
           norm(vi - nvi) < dvi
           IMPLIES
           norm(ffv(so,vo,si,vi)-ffv(nso,nvo,nsi,nvi)) < epsil


decl_type: function
theory: four_vects_2D_continuity
library: vect_analysis
location: 28 2 28 74
body: sum_vvv(ggv,hhv)(so,vo,si,vi): Vect2 = ggv(so,vo,si,vi)+hhv(so,vo,si,vi)
signature:
  [[[[Vect2, Vect2, Vect2, Vect2] -> Vect2],
         [[Vect2, Vect2, Vect2, Vect2] -> Vect2]] ->
          [[Vect2, Vect2, Vect2, Vect2] -> Vect2]]


decl_type: function
theory: four_vects_2D_continuity
library: vect_analysis
location: 32 2 32 58
body: scal_vvv(c,hhv)(so,vo,si,vi): Vect2 = c*hhv(so,vo,si,vi)
signature:
  [[real, [[Vect2, Vect2, Vect2, Vect2] -> Vect2]] ->
          [[Vect2, Vect2, Vect2, Vect2] -> Vect2]]


decl_type: function
theory: four_vects_2D_continuity
library: vect_analysis
signature: [[[Vect2, Vect2, Vect2, Vect2] -> real] -> bool]
location: 34 2 43 59
body:
    continuous_vvr?(ffr): bool =
      FORALL (epsil:posreal,so,vo,si,vi): 
      EXISTS (dso,dvo,dsi,dvi: posreal):
      FORALL (nso,nvo,nsi,nvi):
           norm(so - nso) < dso AND
           norm(vo - nvo) < dvo AND
           norm(si - nsi) < dsi AND
           norm(vi - nvi) < dvi
           IMPLIES
           abs(ffr(so,vo,si,vi)-ffr(nso,nvo,nsi,nvi)) < epsil


decl_type: function
theory: four_vects_2D_continuity
library: vect_analysis
location: 45 2 45 73
body: sum_vvr(ggr,hhr)(so,vo,si,vi): real = ggr(so,vo,si,vi)+hhr(so,vo,si,vi)
signature:
  [[[[Vect2, Vect2, Vect2, Vect2] -> real],
         [[Vect2, Vect2, Vect2, Vect2] -> real]] ->
          [[Vect2, Vect2, Vect2, Vect2] -> real]]


decl_type: function
theory: four_vects_2D_continuity
library: vect_analysis
location: 57 2 57 79
body: scal_vvr_vvv(ffr,ggv)(so,vo,si,vi): Vect2 = ffr(so,vo,si,vi)*ggv(so,vo,si,vi)
signature:
  [[[[Vect2, Vect2, Vect2, Vect2] -> real],
         [[Vect2, Vect2, Vect2, Vect2] -> Vect2]] ->
          [[Vect2, Vect2, Vect2, Vect2] -> Vect2]]


decl_type: function
theory: four_vects_2D_continuity
library: vect_analysis
location: 59 2 59 73
body: dot_vvv(ffv,ggv)(so,vo,si,vi): real = ffv(so,vo,si,vi)*ggv(so,vo,si,vi)
signature:
  [[[[Vect2, Vect2, Vect2, Vect2] -> Vect2],
         [[Vect2, Vect2, Vect2, Vect2] -> Vect2]] ->
          [[Vect2, Vect2, Vect2, Vect2] -> real]]


decl_type: function
theory: four_vects_2D_continuity
library: vect_analysis
location: 70 2 70 75
body: div_vvr(ffr,ggnz)(so,vo,si,vi): real = ffr(so,vo,si,vi)/ggnz(so,vo,si,vi)
signature:
  [[[[Vect2, Vect2, Vect2, Vect2] -> real], (nzero_vvr?)] ->
          [[Vect2, Vect2, Vect2, Vect2] -> real]]


decl_type: tcc
theory: four_vects_2D_continuity
library: vect_analysis
signature: nil
location: 118 0 122 999
body:
  % Subtype TCC generated (at line 70, column 58) for  ggnz(so, vo, si, vi)
      % expected type  nznum
  div_vvr_TCC1: OBLIGATION
    FORALL (ggnz: (nzero_vvr?), so: Vect2, vo: Vect2, si: Vect2, vi: Vect2):
      ggnz(so, vo, si, vi) /= 0;


decl_type: tcc
theory: four_vects_2D_continuity
library: vect_analysis
signature: nil
location: 124 0 127 999
body:
  % Subtype TCC generated (at line 96, column 51) for  ggnzc
      % expected type  (nzero_vvr?)
  div_vvr_cont_TCC1: OBLIGATION
    FORALL (ggnzc: (continuous_nz_vvr?)): nzero_vvr?(ggnzc);


decl_type: formula
theory: deriv_real_vect2
library: vect_analysis
signature: nil
location: 76 2 77 73
body:
    deriv_sqv_vfun    : LEMMA 
       deriv(LAMBDA (x: T): sqv(f(x))) = (LAMBDA (x:T): 2*f(x)*deriv(f)(x)) 


decl_type: formula
theory: deriv_real_vect2
library: vect_analysis
signature: nil
location: 87 2 88 82
body:
    d_sum_vfun   : LEMMA derivable_rv?(LAMBDA (x: T): f1(x) + f2(x)) AND
                         deriv(LAMBDA (x: T): f1(x) + f2(x)) = deriv(f1) + deriv(f2)


decl_type: formula
theory: deriv_real_vect2
library: vect_analysis
signature: nil
location: 90 2 91 82
body:
    d_diff_vfun  : LEMMA derivable_rv?(LAMBDA (x: T): f1(x) - f2(x)) AND 
                         deriv(LAMBDA (x: T): f1(x) - f2(x)) = deriv(f1) - deriv(f2)


decl_type: formula
theory: deriv_real_vect2
library: vect_analysis
signature: nil
location: 93 2 94 61
body:
    d_neg_vfun   : LEMMA derivable_rv?(LAMBDA (x: T): -f(x)) AND
                         deriv(LAMBDA (x:T): -f(x)) = -deriv(f)


decl_type: formula
theory: deriv_real_vect2
library: vect_analysis
signature: nil
location: 96 2 97 82
body:
    d_prod_vfun  : LEMMA derivable_rv?(LAMBDA (x: T): h(x)*f(x)) AND
                         deriv(LAMBDA (x: T): h(x) * f(x)) = deriv(h)*f + h*deriv(f)


decl_type: formula
theory: deriv_real_vect2
library: vect_analysis
signature: nil
location: 99 2 100 88
body:
    d_dot_vfun   : LEMMA derivable?(LAMBDA (x: T): f1(x)*f2(x)) AND
                         deriv(LAMBDA (x: T): f1(x) * f2(x)) = deriv(f1)*f2 + f1*deriv(f2)


decl_type: formula
theory: deriv_real_vect2
library: vect_analysis
signature: nil
location: 102 2 103 69
body:
    d_const_vfun : LEMMA derivable_rv?(LAMBDA (x: T): s) AND
                         deriv(LAMBDA (x: T): s) = (LAMBDA (x:T): zero)


decl_type: formula
theory: deriv_real_vect2
library: vect_analysis
signature: nil
location: 105 2 106 68
body:
    d_scal_vfun  : LEMMA derivable_rv?(LAMBDA (x: T): c * f(x)) AND
                         deriv(LAMBDA (x: T): c * f(x)) = c * deriv(f)


decl_type: function
theory: deriv_real_vect2
library: vect_analysis
signature: [[T -> Vect2] -> bool]
location: 20 2 22 32
body:
    derivable_rv?(V:[T->Vect2]): bool =
      derivable?(LAMBDA(a):V(a)`x) AND
      derivable?(LAMBDA(a):V(a)`y)


decl_type: tcc
theory: deriv_real_vect2
library: vect_analysis
signature: nil
location: 116 0 119 999
body:
  % Assuming TCC generated (at line 14, column 35) for
      % analysis@derivatives[T]
      % generated from assumption derivatives.deriv_domain
  IMP_derivatives_TCC1: OBLIGATION deriv_domain?[T];


decl_type: tcc
theory: deriv_real_vect2
library: vect_analysis
signature: nil
location: 121 0 124 999
body:
  % Assuming TCC generated (at line 14, column 35) for
      % analysis@derivatives[T]
      % generated from assumption derivatives.not_one_element
  IMP_derivatives_TCC2: OBLIGATION not_one_element?[T];


decl_type: tcc
theory: deriv_real_vect2
library: vect_analysis
signature: nil
location: 126 0 129 999
body:
  % Subtype TCC generated (at line 29, column 28) for  r
      % expected type  {x_1 | derivable?(LAMBDA (a): V(a)`x, x_1)}
  deriv_rv_TCC1: OBLIGATION
    FORALL (V: (derivable_rv?), r: T): derivable?[T](LAMBDA (a): V(a)`x, r);


decl_type: tcc
theory: deriv_real_vect2
library: vect_analysis
signature: nil
location: 131 0 134 999
body:
  % Subtype TCC generated (at line 29, column 54) for  r
      % expected type  {x | derivable?(LAMBDA (a): V(a)`y, x)}
  deriv_rv_TCC2: OBLIGATION
    FORALL (V: (derivable_rv?), r: T): derivable?[T](LAMBDA (a): V(a)`y, r);


decl_type: tcc
theory: deriv_real_vect2
library: vect_analysis
signature: nil
location: 136 0 141 999
body:
  % Subtype TCC generated (at line 66, column 34) for
      % LAMBDA (x: T): f1(x) + f2(x)
      % expected type  (derivable_rv?)
  deriv_sum_vfun_TCC1: OBLIGATION
    FORALL (f1, f2: (derivable_rv?)):
      derivable_rv?(LAMBDA (x: T): f1(x) + f2(x));


decl_type: tcc
theory: deriv_real_vect2
library: vect_analysis
signature: nil
location: 143 0 148 999
body:
  % Subtype TCC generated (at line 68, column 34) for
      % LAMBDA (x: T): f1(x) - f2(x)
      % expected type  (derivable_rv?)
  deriv_diff_vfun_TCC1: OBLIGATION
    FORALL (f1, f2: (derivable_rv?)):
      derivable_rv?(LAMBDA (x: T): f1(x) - f2(x));


decl_type: tcc
theory: deriv_real_vect2
library: vect_analysis
signature: nil
location: 150 0 153 999
body:
  % Subtype TCC generated (at line 70, column 34) for  LAMBDA (x: T): -f(x)
      % expected type  (derivable_rv?)
  deriv_neg_vfun_TCC1: OBLIGATION
    FORALL (f: (derivable_rv?)): derivable_rv?(LAMBDA (x: T): -f(x));


decl_type: tcc
theory: deriv_real_vect2
library: vect_analysis
signature: nil
location: 155 0 160 999
body:
  % Subtype TCC generated (at line 72, column 34) for
      % LAMBDA (x: T): h(x) * f(x)
      % expected type  (derivable_rv?)
  deriv_prod_vfun_TCC1: OBLIGATION
    FORALL (f: (derivable_rv?), h: deriv_fun[T]):
      derivable_rv?(LAMBDA (x: T): h(x) * f(x));


decl_type: tcc
theory: deriv_real_vect2
library: vect_analysis
signature: nil
location: 162 0 167 999
body:
  % Subtype TCC generated (at line 74, column 34) for
      % LAMBDA (x: T): f1(x) * f2(x)
      % expected type  deriv_fun[T]
  deriv_dot_vfun_TCC1: OBLIGATION
    FORALL (f1, f2: (derivable_rv?)):
      derivable?[T](LAMBDA (x: T): f1(x) * f2(x));


decl_type: tcc
theory: deriv_real_vect2
library: vect_analysis
signature: nil
location: 169 0 173 999
body:
  % Subtype TCC generated (at line 77, column 11) for
      % LAMBDA (x: T): sqv(f(x))
      % expected type  deriv_fun[T]
  deriv_sqv_vfun_TCC1: OBLIGATION
    FORALL (f: (derivable_rv?)): derivable?[T](LAMBDA (x: T): sqv(f(x)));


decl_type: tcc
theory: deriv_real_vect2
library: vect_analysis
signature: nil
location: 175 0 178 999
body:
  % Subtype TCC generated (at line 80, column 34) for  LAMBDA (x: T): s
      % expected type  (derivable_rv?)
  deriv_const_vfun_TCC1: OBLIGATION
    FORALL (s: Vect2): derivable_rv?(LAMBDA (x: T): s);


decl_type: tcc
theory: deriv_real_vect2
library: vect_analysis
signature: nil
location: 180 0 184 999
body:
  % Subtype TCC generated (at line 82, column 34) for  LAMBDA (x: T): c * f(x)
      % expected type  (derivable_rv?)
  deriv_scal_vfun_TCC1: OBLIGATION
    FORALL (c: real, f: (derivable_rv?)):
      derivable_rv?(LAMBDA (x: T): c * f(x));


decl_type: tcc
theory: deriv_real_vect2
library: vect_analysis
signature: nil
location: 186 0 189 999
body:
  % Subtype TCC generated (at line 84, column 34) for  LAMBDA (x: T): x * v
      % expected type  (derivable_rv?)
  deriv_prod_id_vfun_TCC1: OBLIGATION
    FORALL (v: Vect2): derivable_rv?(LAMBDA (x: T): x * v);


decl_type: tcc
theory: vect_deriv_2D
library: vect_analysis
signature: nil
location: 39 0 41 999
body:
  % Assuming TCC generated (at line 12, column 12) for  deriv_real_vect2[T]
      % generated from assumption deriv_real_vect2.deriv_domain
  IMP_deriv_real_vect2_TCC1: OBLIGATION deriv_domain?[T];


decl_type: tcc
theory: vect_deriv_2D
library: vect_analysis
signature: nil
location: 43 0 45 999
body:
  % Assuming TCC generated (at line 12, column 12) for  deriv_real_vect2[T]
      % generated from assumption deriv_real_vect2.not_one_element
  IMP_deriv_real_vect2_TCC2: OBLIGATION not_one_element?[T];


decl_type: tcc
theory: vect_deriv_2D
library: vect_analysis
signature: nil
location: 47 0 50 999
body:
  % Subtype TCC generated (at line 26, column 10) for  detsv(s, V)
      % expected type  deriv_fun[T]
  detsvp_deriv_TCC1: OBLIGATION
    FORALL (V: (derivable_rv?), s: Vect2): derivable?[T](detsv(s, V));


decl_type: tcc
theory: vect_deriv_2D
library: vect_analysis
signature: nil
location: 52 0 55 999
body:
  % Subtype TCC generated (at line 32, column 10) for  LAMBDA (r): sqv(V(r))
      % expected type  deriv_fun[T]
  sqvdot_deriv_TCC1: OBLIGATION
    FORALL (V: (derivable_rv?)): derivable?[T](LAMBDA (r): sqv(V(r)));


decl_type: formula
theory: vect_chain_rule
library: vect_analysis
signature: nil
location: 25 2 26 72
body:
    composition_derivable_vfun : LEMMA derivable?(f) AND differentiable_rv?(g) 
                                         IMPLIES differentiable_rv?(g o f)


decl_type: tcc
theory: vect_chain_rule
library: vect_analysis
signature: nil
location: 42 0 45 999
body:
  % Assuming TCC generated (at line 14, column 12) for
      % analysis@derivatives[T1]
      % generated from assumption derivatives.deriv_domain
  composition_derivable_vfun_TCC1: OBLIGATION deriv_domain?[T1];


decl_type: tcc
theory: vect_chain_rule
library: vect_analysis
signature: nil
location: 47 0 50 999
body:
  % Assuming TCC generated (at line 14, column 12) for
      % analysis@derivatives[T1]
      % generated from assumption derivatives.not_one_element
  composition_derivable_vfun_TCC2: OBLIGATION not_one_element?[T1];


decl_type: tcc
theory: vect_chain_rule
library: vect_analysis
signature: nil
location: 52 0 55 999
body:
  % Assuming TCC generated (at line 12, column 12) for  deriv_real_vect2[T2]
      % generated from assumption deriv_real_vect2.deriv_domain
  composition_derivable_vfun_TCC3: OBLIGATION
    FORALL (f: [T1 -> T2]): derivable?(f) IMPLIES deriv_domain?[T2];


decl_type: tcc
theory: vect_chain_rule
library: vect_analysis
signature: nil
location: 57 0 60 999
body:
  % Assuming TCC generated (at line 12, column 12) for  deriv_real_vect2[T2]
      % generated from assumption deriv_real_vect2.not_one_element
  composition_derivable_vfun_TCC4: OBLIGATION
    FORALL (f: [T1 -> T2]): derivable?(f) IMPLIES not_one_element?[T2];


decl_type: tcc
theory: vect_chain_rule
library: vect_analysis
signature: nil
location: 62 0 64 999
body:
  % Assuming TCC generated (at line 12, column 12) for  deriv_real_vect2[T2]
      % generated from assumption deriv_real_vect2.deriv_domain
  gg_TCC1: OBLIGATION deriv_domain?[T2];


decl_type: tcc
theory: vect_chain_rule
library: vect_analysis
signature: nil
location: 66 0 68 999
body:
  % Assuming TCC generated (at line 12, column 12) for  deriv_real_vect2[T2]
      % generated from assumption deriv_real_vect2.not_one_element
  gg_TCC2: OBLIGATION not_one_element?[T2];


decl_type: tcc
theory: vect_chain_rule
library: vect_analysis
signature: nil
location: 70 0 74 999
body:
  % Subtype TCC generated (at line 35, column 32) for  gg o ff
      % expected type  (derivable_rv?)
  deriv_comp_vfun_TCC1: OBLIGATION
    FORALL (ff: {f | derivable?(f)}, gg: {g | derivable_rv?(g)}):
      derivable_rv?[T1](o[T1, T2, Vect2](gg, ff));


decl_type: function
theory: limit_real_vect2
library: vect_analysis
signature: [[[T -> Vect2], T, Vect2] -> bool]
location: 30 2 34 49
body:
    convergence(f, a, l) : bool = 
  %%        (FORALL e: EXISTS x: abs(x - a) < e) AND   % a has a ball containing T values
          FORALL epsilon : EXISTS delta : 
              FORALL x: abs(x-a) < delta        
                   IMPLIES norm(f(x) - l) < epsilon


decl_type: function
theory: limit_real_vect2
library: vect_analysis
signature: [[f: [T -> Vect2], {a | convergent?(f, a)}] -> Vect2]
location: 66 2 67 47
body:
    lim(f, (x0 : {a | convergent?(f, a)})) : Vect2 =  
          choose(LAMBDA l: convergence(f, x0, l))


decl_type: tcc
theory: limit_real_vect2
library: vect_analysis
signature: nil
location: 159 0 164 999
body:
  % Subtype TCC generated (at line 67, column 15) for
      % LAMBDA l: convergence(f, x0, l)
      % expected type  p: (nonempty?[Vect2])
  lim_TCC1: OBLIGATION
    FORALL (f: [T -> Vect2], (x0: {a | convergent?(f, a)})):
      nonempty?[Vect2](LAMBDA l: convergence(f, x0, l));


decl_type: tcc
theory: limit_real_vect2
library: vect_analysis
signature: nil
location: 166 0 171 999
body:
  % Subtype TCC generated (at line 103, column 50) for  a
      % expected type  {a | convergent?(LAMBDA (x: T): f1(x) + f2(x), a)}
  lim_sum_fun_TCC1: OBLIGATION
    FORALL (a: T, f1, f2: [T -> Vect2]):
      convergent?(f2, a) AND convergent?(f1, a) IMPLIES
       convergent?(LAMBDA (x: T): f1(x) + f2(x), a);


decl_type: tcc
theory: limit_real_vect2
library: vect_analysis
signature: nil
location: 173 0 177 999
body:
  % Subtype TCC generated (at line 106, column 46) for  a
      % expected type  {a | convergent?(LAMBDA (x: T): -f(x), a)}
  lim_neg_fun_TCC1: OBLIGATION
    FORALL (a: T, f: [T -> Vect2]):
      convergent?(f, a) IMPLIES convergent?(LAMBDA (x: T): -f(x), a);


decl_type: tcc
theory: limit_real_vect2
library: vect_analysis
signature: nil
location: 179 0 184 999
body:
  % Subtype TCC generated (at line 109, column 50) for  a
      % expected type  {a | convergent?(LAMBDA (x: T): f1(x) - f2(x), a)}
  lim_diff_fun_TCC1: OBLIGATION
    FORALL (a: T, f1, f2: [T -> Vect2]):
      convergent?(f2, a) AND convergent?(f1, a) IMPLIES
       convergent?(LAMBDA (x: T): f1(x) - f2(x), a);


decl_type: formula
theory: cont_real_vect2
library: vect_analysis
signature: nil
location: 53 2 54 73
body:
    continuous_iff_comps: LEMMA continuous_rv?(f,a) IFF
                              continuous?(fx(f),a) AND continuous?(fy(f),a)


decl_type: formula
theory: cont_real_vect2
library: vect_analysis
signature: nil
location: 58 2 59 69
body:
    cont_rv_iff_comps: LEMMA continuous_rv?(f) IFF
                              continuous?(fx(f)) AND continuous?(fy(f))


decl_type: formula
theory: cont_real_vect2
library: vect_analysis
signature: nil
location: 67 2 68 62
body:
    sum_continuous_rv  : LEMMA continuous_rv?(f1, x0) AND continuous_rv?(f2, x0)
                             IMPLIES continuous_rv?(f1 + f2, x0)


decl_type: formula
theory: cont_real_vect2
library: vect_analysis
signature: nil
location: 70 2 71 62
body:
    diff_continuous_rv : LEMMA continuous_rv?(f1, x0) AND continuous_rv?(f2, x0)
                             IMPLIES continuous_rv?(f1 - f2, x0)


decl_type: formula
theory: cont_real_vect2
library: vect_analysis
signature: nil
location: 77 2 78 60
body:
    prod_continuous_rv : LEMMA continuous?(hh,x0) AND                               
        continuous_rv?(f,x0) IMPLIES continuous_rv?(hh * f,x0)


decl_type: formula
theory: cont_real_vect2
library: vect_analysis
signature: nil
location: 89 2 90 58
body:
    sum_cont_rv_fun   : LEMMA continuous_rv?(f1) AND continuous_rv?(f2)
                             IMPLIES continuous_rv?(f1 + f2)


decl_type: formula
theory: cont_real_vect2
library: vect_analysis
signature: nil
location: 92 2 93 58
body:
    diff_cont_rv_fun  : LEMMA continuous_rv?(f1) AND continuous_rv?(f2)
                             IMPLIES continuous_rv?(f1 - f2)


decl_type: formula
theory: cont_real_vect2
library: vect_analysis
signature: nil
location: 101 2 102 54
body:
    prod_cont_rv_fun  : LEMMA continuous?(hh) AND                               
        continuous_rv?(f) IMPLIES continuous_rv?(hh * f)


decl_type: function
theory: cont_real_vect2
library: vect_analysis
signature: [[[T -> Vect2], T] -> bool]
location: 31 2 34 53
body:
    continuous_rv?(f, x0) : bool = 
          FORALL epsilon : EXISTS delta : 
              FORALL x: abs(x-x0) < delta        
                   IMPLIES norm(f(x) - f(x0)) < epsilon


decl_type: tcc
theory: cont_real_vect2
library: vect_analysis
signature: nil
location: 133 0 136 999
body:
  % Existence TCC generated (at line 110, column 2) for
      % continuous_rv_fun: TYPE+ = {f | continuous_rv?(f)}
  continuous_rv_fun_TCC1: OBLIGATION
    EXISTS (x: {f | continuous_rv?(f)}): TRUE;


decl_type: tcc
theory: cont_real_vect2
library: vect_analysis
signature: nil
location: 138 0 142 999
body:
  % Judgement subtype TCC generated (at line 16, column 37) for
      % LAMBDA (x: T): h1(x) + h2(x)
      % expected type  continuous_rv_fun
  sum_fun_continuous_rv: OBLIGATION
    FORALL (h1, h2): continuous_rv?(LAMBDA (x: T): h1(x) + h2(x));


decl_type: tcc
theory: cont_real_vect2
library: vect_analysis
signature: nil
location: 144 0 148 999
body:
  % Judgement subtype TCC generated (at line 18, column 37) for
      % LAMBDA (x: T): h1(x) - h2(x)
      % expected type  continuous_rv_fun
  diff_fun_continuous_rv: OBLIGATION
    FORALL (h1, h2): continuous_rv?(LAMBDA (x: T): h1(x) - h2(x));


decl_type: tcc
theory: cont_real_vect2
library: vect_analysis
signature: nil
location: 150 0 153 999
body:
  % Judgement subtype TCC generated (at line 121, column 37) for  const_vfun(u)
      % expected type  continuous_rv_fun
  const_fun_continuous_rv: OBLIGATION
    FORALL (u): continuous_rv?(const_vfun[T](u));


decl_type: tcc
theory: cont_real_vect2
library: vect_analysis
signature: nil
location: 155 0 159 999
body:
  % Judgement subtype TCC generated (at line 17, column 37) for
      % LAMBDA (x: T): -h(x)
      % expected type  continuous_rv_fun
  neg_fun_continuous_rv: OBLIGATION
    FORALL (h): continuous_rv?(LAMBDA (x: T): -h(x));


decl_type: function
theory: limit_vect2_vect2
library: vect_analysis
signature: [[[Vect2 -> Vect2], Vect2, Vect2] -> bool]
location: 30 2 33 49
body:
    convergence(f, a, l) : bool = 
          FORALL epsilon : EXISTS delta : 
              FORALL x: norm(x-a) < delta        
                   IMPLIES norm(f(x) - l) < epsilon


decl_type: function
theory: limit_vect2_vect2
library: vect_analysis
signature: [[f: [Vect2 -> Vect2], {a | convergent?(f, a)}] -> Vect2]
location: 68 2 69 48
body:
    lim(f, (x0 : {a | convergent?(f, a)})) : Vect2 =  
          choose(LAMBDA l : convergence(f, x0, l))


decl_type: tcc
theory: limit_vect2_vect2
library: vect_analysis
signature: nil
location: 173 0 178 999
body:
  % Subtype TCC generated (at line 69, column 15) for
      % LAMBDA l: convergence(f, x0, l)
      % expected type  p: (nonempty?[Vect2])
  lim_TCC1: OBLIGATION
    FORALL (f: [Vect2 -> Vect2], (x0: {a | convergent?(f, a)})):
      nonempty?[Vect2](LAMBDA l: convergence(f, x0, l));


decl_type: tcc
theory: limit_vect2_vect2
library: vect_analysis
signature: nil
location: 180 0 185 999
body:
  % Subtype TCC generated (at line 109, column 50) for  a
      % expected type  {a | convergent?(f1 + f2, a)}
  lim_sum_fun_TCC1: OBLIGATION
    FORALL (a: Vect2, f1, f2: [Vect2 -> Vect2]):
      convergent?(f2, a) AND convergent?(f1, a) IMPLIES
       convergent?(f1 + f2, a);


decl_type: tcc
theory: limit_vect2_vect2
library: vect_analysis
signature: nil
location: 187 0 191 999
body:
  % Subtype TCC generated (at line 112, column 46) for  a
      % expected type  {a | convergent?(-f, a)}
  lim_neg_fun_TCC1: OBLIGATION
    FORALL (a: Vect2, f: [Vect2 -> Vect2]):
      convergent?(f, a) IMPLIES convergent?(-f, a);


decl_type: tcc
theory: limit_vect2_vect2
library: vect_analysis
signature: nil
location: 193 0 198 999
body:
  % Subtype TCC generated (at line 115, column 50) for  a
      % expected type  {a | convergent?(f1 - f2, a)}
  lim_diff_fun_TCC1: OBLIGATION
    FORALL (a: Vect2, f1, f2: [Vect2 -> Vect2]):
      convergent?(f2, a) AND convergent?(f1, a) IMPLIES
       convergent?(f1 - f2, a);


decl_type: tcc
theory: limit_vect2_vect2
library: vect_analysis
signature: nil
location: 200 0 203 999
body:
  % Subtype TCC generated (at line 120, column 45) for  v
      % expected type  {a | convergent?(const_fun(b), a)}
  lim_const_fun_TCC1: OBLIGATION
    FORALL (b, v: Vect2): convergent?(const_fun(b), v);


decl_type: formula
theory: cont_vect2_vect2
library: vect_analysis
signature: nil
location: 39 2 40 62
body:
    sum_continuous_vv  : LEMMA continuous_vv?(f1, x0) AND continuous_vv?(f2, x0)
                             IMPLIES continuous_vv?(f1 + f2, x0)


decl_type: formula
theory: cont_vect2_vect2
library: vect_analysis
signature: nil
location: 42 2 43 62
body:
    diff_continuous_vv : LEMMA continuous_vv?(f1, x0) AND continuous_vv?(f2, x0)
                             IMPLIES continuous_vv?(f1 - f2, x0)


decl_type: formula
theory: cont_vect2_vect2
library: vect_analysis
signature: nil
location: 57 2 58 58
body:
    sum_cont_vv_fun  : LEMMA continuous_vv?(f1) AND continuous_vv?(f2)
                             IMPLIES continuous_vv?(f1 + f2)


decl_type: formula
theory: cont_vect2_vect2
library: vect_analysis
signature: nil
location: 60 2 61 58
body:
    diff_cont_vv_fun : LEMMA continuous_vv?(f1) AND continuous_vv?(f2)
                             IMPLIES continuous_vv?(f1 - f2)


decl_type: function
theory: cont_vect2_vect2
library: vect_analysis
signature: [[[Vect2 -> Vect2], Vect2] -> bool]
location: 23 2 26 53
body:
    continuous_vv?(f, x0) : bool = 
          FORALL epsilon : EXISTS delta : 
              FORALL x: norm(x-x0) < delta        
                   IMPLIES norm(f(x) - f(x0)) < epsilon


decl_type: tcc
theory: cont_vect2_vect2
library: vect_analysis
signature: nil
location: 96 0 99 999
body:
  % Existence TCC generated (at line 72, column 2) for
      % continuous_vv_fun: TYPE+ = {f | continuous_vv?(f)}
  continuous_vv_fun_TCC1: OBLIGATION
    EXISTS (x: {f | continuous_vv?(f)}): TRUE;


decl_type: tcc
theory: cont_vect2_vect2
library: vect_analysis
signature: nil
location: 101 0 103 999
body:
  % Judgement subtype TCC generated (at line 79, column 37) for  h1 + h2
      % expected type  continuous_vv_fun
  sum_fun_continuous_vv: OBLIGATION FORALL (h1, h2): continuous_vv?(h1 + h2);


decl_type: tcc
theory: cont_vect2_vect2
library: vect_analysis
signature: nil
location: 105 0 107 999
body:
  % Judgement subtype TCC generated (at line 81, column 37) for  h1 - h2
      % expected type  continuous_vv_fun
  diff_fun_continuous_vv: OBLIGATION FORALL (h1, h2): continuous_vv?(h1 - h2);


decl_type: tcc
theory: cont_vect2_vect2
library: vect_analysis
signature: nil
location: 109 0 112 999
body:
  % Judgement subtype TCC generated (at line 83, column 37) for  const_fun(u)
      % expected type  continuous_vv_fun
  const_fun_continuous_vv: OBLIGATION
    FORALL (u): continuous_vv?(const_fun(u));


decl_type: tcc
theory: cont_vect2_vect2
library: vect_analysis
signature: nil
location: 114 0 116 999
body:
  % Judgement subtype TCC generated (at line 85, column 36) for  -h
      % expected type  continuous_vv_fun
  neg_fun_continuous_vv: OBLIGATION FORALL (h): continuous_vv?(-h);


decl_type: formula
theory: limit_vect2_real
library: vect_analysis
signature: nil
location: 131 2 132 72
body:
    lim_div_fun      : LEMMA convergent?(f, a) AND convergent?(g, a) AND lim(g, a) /= 0
                               IMPLIES lim(f / g, a) = lim(f, a)/lim(g, a)


decl_type: formula
theory: limit_vect2_real
library: vect_analysis
signature: nil
location: 139 2 144 17
body:
    convergence_order : LEMMA
          FORALL f1, f2, a, l1, l2 :
                  convergence(f1, a, l1)
              AND convergence(f2, a, l2)
              AND (FORALL x : f1(x) <= f2(x))
          IMPLIES l1 <= l2


decl_type: formula
theory: limit_vect2_real
library: vect_analysis
signature: nil
location: 151 2 155 15
body:
    convergence_lower_bound : COROLLARY
          FORALL f, b, a, l :
                  convergence(f, a, l)
              AND (FORALL x : b <= f(x))
          IMPLIES b <= l


decl_type: formula
theory: limit_vect2_real
library: vect_analysis
signature: nil
location: 157 2 161 15
body:
    convergence_upper_bound : COROLLARY
          FORALL f, b, a, l :
                  convergence(f, a, l)
              AND (FORALL x : f(x) <= b)
          IMPLIES l <= b


decl_type: function
theory: limit_vect2_real
library: vect_analysis
signature: [[[Vect2 -> real], Vect2, real] -> bool]
location: 18 2 22 48
body:
    convergence(f, a, l) : bool = 
          FORALL epsilon : EXISTS delta : 
              FORALL x: %%% 0 < norm(x-a) AND
                        norm(x-a) < delta          %% AND x in dom(f)
                   IMPLIES abs(f(x) - l) < epsilon


decl_type: function
theory: limit_vect2_real
library: vect_analysis
signature: [[f: [Vect2 -> real], {a | convergent?(f, a)}] -> real]
location: 64 2 65 48
body:
    lim(f, (x0 : {a | convergent?(f, a)})) : real =  
          choose(LAMBDA l : convergence(f, x0, l))


decl_type: tcc
theory: limit_vect2_real
library: vect_analysis
signature: nil
location: 183 0 188 999
body:
  % Subtype TCC generated (at line 65, column 15) for
      % LAMBDA l: convergence(f, x0, l)
      % expected type  p: (nonempty?[real])
  lim_TCC1: OBLIGATION
    FORALL (f: [Vect2 -> real], (x0: {a | convergent?(f, a)})):
      nonempty?[real](LAMBDA l: convergence(f, x0, l));


decl_type: tcc
theory: limit_vect2_real
library: vect_analysis
signature: nil
location: 190 0 195 999
body:
  % Subtype TCC generated (at line 112, column 50) for  a
      % expected type  {a | convergent?(f1 + f2, a)}
  lim_sum_fun_TCC1: OBLIGATION
    FORALL (a: Vect2, f1, f2: [Vect2 -> real]):
      convergent?(f2, a) AND convergent?(f1, a) IMPLIES
       convergent?(f1 + f2, a);


decl_type: tcc
theory: limit_vect2_real
library: vect_analysis
signature: nil
location: 197 0 201 999
body:
  % Subtype TCC generated (at line 115, column 46) for  a
      % expected type  {a | convergent?(-f, a)}
  lim_neg_fun_TCC1: OBLIGATION
    FORALL (a: Vect2, f: [Vect2 -> real]):
      convergent?(f, a) IMPLIES convergent?(-f, a);


decl_type: tcc
theory: limit_vect2_real
library: vect_analysis
signature: nil
location: 203 0 208 999
body:
  % Subtype TCC generated (at line 118, column 50) for  a
      % expected type  {a | convergent?(f1 - f2, a)}
  lim_diff_fun_TCC1: OBLIGATION
    FORALL (a: Vect2, f1, f2: [Vect2 -> real]):
      convergent?(f2, a) AND convergent?(f1, a) IMPLIES
       convergent?(f1 - f2, a);


decl_type: tcc
theory: limit_vect2_real
library: vect_analysis
signature: nil
location: 210 0 215 999
body:
  % Subtype TCC generated (at line 121, column 50) for  a
      % expected type  {a | convergent?(f1 * f2, a)}
  lim_prod_fun_TCC1: OBLIGATION
    FORALL (a: Vect2, f1, f2: [Vect2 -> real]):
      convergent?(f2, a) AND convergent?(f1, a) IMPLIES
       convergent?(f1 * f2, a);


decl_type: tcc
theory: limit_vect2_real
library: vect_analysis
signature: nil
location: 217 0 220 999
body:
  % Subtype TCC generated (at line 123, column 45) for  v
      % expected type  {a | convergent?(const_fun(b), a)}
  lim_const_fun_TCC1: OBLIGATION
    FORALL (b: real, v: Vect2): convergent?(const_fun(b), v);


decl_type: tcc
theory: limit_vect2_real
library: vect_analysis
signature: nil
location: 222 0 226 999
body:
  % Subtype TCC generated (at line 126, column 48) for  a
      % expected type  {a | convergent?(b * f, a)}
  lim_scal_fun_TCC1: OBLIGATION
    FORALL (a: Vect2, b: real, f: [Vect2 -> real]):
      convergent?(f, a) IMPLIES convergent?(b * f, a);


decl_type: tcc
theory: limit_vect2_real
library: vect_analysis
signature: nil
location: 228 0 232 999
body:
  % Subtype TCC generated (at line 129, column 46) for  a
      % expected type  {a | convergent?(1 / g, a)}
  lim_inv_fun_TCC1: OBLIGATION
    FORALL (a: Vect2, g: [Vect2 -> nzreal]):
      lim(g, a) /= 0 AND convergent?(g, a) IMPLIES convergent?(1 / g, a);


decl_type: tcc
theory: limit_vect2_real
library: vect_analysis
signature: nil
location: 234 0 239 999
body:
  % Subtype TCC generated (at line 132, column 48) for  a
      % expected type  {a | convergent?(f / g, a)}
  lim_div_fun_TCC1: OBLIGATION
    FORALL (a: Vect2, f: [Vect2 -> real], g: [Vect2 -> nzreal]):
      lim(g, a) /= 0 AND convergent?(g, a) AND convergent?(f, a) IMPLIES
       convergent?(f / g, a);


decl_type: formula
theory: cont_vect2_real
library: vect_analysis
signature: nil
location: 38 2 39 62
body:
    sum_continuous_vr  : LEMMA continuous_vr?(f1, x0) AND continuous_vr?(f2, x0)
                             IMPLIES continuous_vr?(f1 + f2, x0)


decl_type: formula
theory: cont_vect2_real
library: vect_analysis
signature: nil
location: 41 2 42 62
body:
    diff_continuous_vr : LEMMA continuous_vr?(f1, x0) AND continuous_vr?(f2, x0)
                             IMPLIES continuous_vr?(f1 - f2, x0)


decl_type: formula
theory: cont_vect2_real
library: vect_analysis
signature: nil
location: 44 2 45 62
body:
    prod_continuous_vr : LEMMA continuous_vr?(f1, x0) AND continuous_vr?(f2, x0)
                             IMPLIES continuous_vr?(f1 * f2, x0)


decl_type: formula
theory: cont_vect2_real
library: vect_analysis
signature: nil
location: 53 2 54 59
body:
    div_continuous_vr  : LEMMA continuous_vr?(f, x0) AND continuous_vr?(g, x0) 
                              IMPLIES continuous_vr?(f/g, x0)


decl_type: formula
theory: cont_vect2_real
library: vect_analysis
signature: nil
location: 69 2 70 58
body:
    sum_cont_vr_fun  : LEMMA continuous_vr?(f1) AND continuous_vr?(f2)
                             IMPLIES continuous_vr?(f1 + f2)


decl_type: formula
theory: cont_vect2_real
library: vect_analysis
signature: nil
location: 72 2 73 58
body:
    diff_cont_vr_fun : LEMMA continuous_vr?(f1) AND continuous_vr?(f2)
                             IMPLIES continuous_vr?(f1 - f2)


decl_type: formula
theory: cont_vect2_real
library: vect_analysis
signature: nil
location: 75 2 76 58
body:
    prod_cont_vr_fun : LEMMA continuous_vr?(f1) AND continuous_vr?(f2)
                             IMPLIES continuous_vr?(f1 * f2)


decl_type: formula
theory: cont_vect2_real
library: vect_analysis
signature: nil
location: 84 2 85 55
body:
    div_cont_vr_fun  : LEMMA continuous_vr?(f) AND continuous_vr?(g) 
                              IMPLIES continuous_vr?(f/g)


decl_type: function
theory: cont_vect2_real
library: vect_analysis
signature: [[[Vect2 -> real], Vect2] -> bool]
location: 23 2 25 72
body:
    continuous_vr?(f, x0) : bool = 
          FORALL epsilon : EXISTS delta : FORALL x :
                  norm(x - x0) < delta IMPLIES abs(f(x) - f(x0)) < epsilon


decl_type: tcc
theory: cont_vect2_real
library: vect_analysis
signature: nil
location: 131 0 134 999
body:
  % Existence TCC generated (at line 96, column 2) for
      % continuous_vr_fun: TYPE+ = {f | continuous_vr?(f)}
  continuous_vr_fun_TCC1: OBLIGATION
    EXISTS (x: {f | continuous_vr?(f)}): TRUE;


decl_type: tcc
theory: cont_vect2_real
library: vect_analysis
signature: nil
location: 136 0 138 999
body:
  % Judgement subtype TCC generated (at line 104, column 37) for  h1 + h2
      % expected type  continuous_vr_fun
  sum_fun_continuous_vr: OBLIGATION FORALL (h1, h2): continuous_vr?(h1 + h2);


decl_type: tcc
theory: cont_vect2_real
library: vect_analysis
signature: nil
location: 140 0 142 999
body:
  % Judgement subtype TCC generated (at line 106, column 37) for  h1 - h2
      % expected type  continuous_vr_fun
  diff_fun_continuous_vr: OBLIGATION FORALL (h1, h2): continuous_vr?(h1 - h2);


decl_type: tcc
theory: cont_vect2_real
library: vect_analysis
signature: nil
location: 144 0 146 999
body:
  % Judgement subtype TCC generated (at line 108, column 37) for  h1 * h2
      % expected type  continuous_vr_fun
  prod_fun_continuous_vr: OBLIGATION FORALL (h1, h2): continuous_vr?(h1 * h2);


decl_type: tcc
theory: cont_vect2_real
library: vect_analysis
signature: nil
location: 148 0 151 999
body:
  % Judgement subtype TCC generated (at line 110, column 37) for  const_fun(u)
      % expected type  continuous_vr_fun
  const_fun_continuous_vr: OBLIGATION
    FORALL (u): continuous_vr?(const_fun(u));


decl_type: tcc
theory: cont_vect2_real
library: vect_analysis
signature: nil
location: 153 0 155 999
body:
  % Judgement subtype TCC generated (at line 112, column 37) for  u * h
      % expected type  continuous_vr_fun
  scal_fun_continuous_vr: OBLIGATION FORALL (h, u): continuous_vr?(u * h);


decl_type: tcc
theory: cont_vect2_real
library: vect_analysis
signature: nil
location: 157 0 159 999
body:
  % Judgement subtype TCC generated (at line 114, column 36) for  -h
      % expected type  continuous_vr_fun
  neg_fun_continuous_vr: OBLIGATION FORALL (h): continuous_vr?(-h);


decl_type: tcc
theory: cont_vect2_real
library: vect_analysis
signature: nil
location: 161 0 163 999
body:
  % Judgement subtype TCC generated (at line 116, column 36) for  h / h3
      % expected type  continuous_vr_fun
  div_fun_continuous_vr: OBLIGATION FORALL (h, h3): continuous_vr?(h / h3);


decl_type: function
theory: vect2_cont_comp
library: vect_analysis
signature: [[[Vect2 -> Vect2], [Vect2 -> Vect2]] -> [Vect2 -> Vect2]]
location: 29 3 31 3
body:
    ;o(fvv1,fvv2): [Vect2->Vect2] = LAMBDA (v): fvv1(fvv2(v))

    ;o(frv,fvT)  : [Vect2->Vect2] = LAMBDA (v): frv(fvT(v))


decl_type: function
theory: vect2_cont_comp
library: vect_analysis
signature: [[[T -> Vect2], [Vect2 -> T]] -> [Vect2 -> Vect2]]
location: 31 3 33 3
body:
    ;o(frv,fvT)  : [Vect2->Vect2] = LAMBDA (v): frv(fvT(v))

    ;o(fvr,fvv)  : [Vect2->real]  = LAMBDA (v): fvr(fvv(v))


decl_type: function
theory: vect2_cont_comp
library: vect_analysis
signature: [[[Vect2 -> real], [Vect2 -> Vect2]] -> [Vect2 -> real]]
location: 33 3 35 3
body:
    ;o(fvr,fvv)  : [Vect2->real]  = LAMBDA (v): fvr(fvv(v))

    ;o(frr,fvT)  : [Vect2->real]  = LAMBDA (v): frr(fvT(v))


decl_type: function
theory: vect2_cont_comp
library: vect_analysis
signature: [[[T -> real], [Vect2 -> T]] -> [Vect2 -> real]]
location: 35 3 37 3
body:
    ;o(frr,fvT)  : [Vect2->real]  = LAMBDA (v): frr(fvT(v))

    ;o(fvv,frv)  : [T->Vect2]  = LAMBDA (x): fvv(frv(x))


decl_type: function
theory: vect2_cont_comp
library: vect_analysis
signature: [[[Vect2 -> Vect2], [T -> Vect2]] -> [T -> Vect2]]
location: 37 3 39 3
body:
    ;o(fvv,frv)  : [T->Vect2]  = LAMBDA (x): fvv(frv(x))

    ;o(frv,frT)  : [T->Vect2]  = LAMBDA (x): frv(frT(x))


decl_type: function
theory: vect2_cont_comp
library: vect_analysis
signature: [[[T -> Vect2], [T -> T]] -> [T -> Vect2]]
location: 39 3 41 3
body:
    ;o(frv,frT)  : [T->Vect2]  = LAMBDA (x): frv(frT(x))

    ;o(fvr,frv)  : [T->real]   = LAMBDA (x): fvr(frv(x))


decl_type: formula
theory: vect_cont_2D
library: vect_analysis
signature: nil
location: 78 2 81 44
body:
    div_cont_vr : LEMMA 
      FORALL (vnz:[Vect2->nzreal]):
        continuous_vr?(vnz) IMPLIES
        continuous_vr?(LAMBDA(v):vr(v)/vnz(v)) 


decl_type: formula
theory: vect_cont_2D
library: vect_analysis
signature: nil
location: 86 2 89 40
body:
    scal_div2_cont_vr : LEMMA
      FORALL (vnz:[Vect2->nzreal]): 
        continuous_vr?(vnz) IMPLIES
        continuous_vr?(LAMBDA(v):x/vnz(v))


decl_type: tcc
theory: vect_cont_2D
library: vect_analysis
signature: nil
location: 165 0 167 999
body:
  % Judgement subtype TCC generated (at line 135, column 4) for  sqv
      % expected type  continuous_vr_fun
  sqv_cont: OBLIGATION continuous_vr?(sqv);


decl_type: tcc
theory: vect_cont_2D
library: vect_analysis
signature: nil
location: 169 0 171 999
body:
  % Judgement subtype TCC generated (at line 138, column 4) for  vectors_2D.-
      % expected type  continuous_vv_fun
  neg_cont: OBLIGATION continuous_vv?(vectors_2D.-);


decl_type: function
theory: vect2_cont_comp2
library: vect_analysis
signature: [[[T1 -> T2], [Vect2 -> T1]] -> [Vect2 -> T2]]
location: 22 3 24 3
body:
    ;o(ftt,fvT)  : [Vect2->T2]  = LAMBDA (v): ftt(fvT(v))

    ;o(frv,ftt)  : [T1->Vect2]  = LAMBDA (x): frv(ftt(x))


decl_type: function
theory: limit_vect3_real
library: vect_analysis
signature: [[f: [Vect3 -> real], {a | convergent?(f, a)}] -> real]
location: 64 2 65 49
body:
    lim(f, (x0 : {a | convergent?(f, a)})) : real =  
          epsilon(LAMBDA l : convergence(f, x0, l))


decl_type: tcc
theory: limit_vect3_real
library: vect_analysis
signature: nil
location: 183 0 188 999
body:
  % Subtype TCC generated (at line 112, column 50) for  a
      % expected type  {a | convergent?(f1 + f2, a)}
  lim_sum_fun_TCC1: OBLIGATION
    FORALL (a: Vect3, f1, f2: [Vect3 -> real]):
      convergent?(f2, a) AND convergent?(f1, a) IMPLIES
       convergent?(f1 + f2, a);


decl_type: tcc
theory: limit_vect3_real
library: vect_analysis
signature: nil
location: 190 0 194 999
body:
  % Subtype TCC generated (at line 115, column 46) for  a
      % expected type  {a | convergent?(-f, a)}
  lim_neg_fun_TCC1: OBLIGATION
    FORALL (a: Vect3, f: [Vect3 -> real]):
      convergent?(f, a) IMPLIES convergent?(-f, a);


decl_type: tcc
theory: limit_vect3_real
library: vect_analysis
signature: nil
location: 196 0 201 999
body:
  % Subtype TCC generated (at line 118, column 50) for  a
      % expected type  {a | convergent?(f1 - f2, a)}
  lim_diff_fun_TCC1: OBLIGATION
    FORALL (a: Vect3, f1, f2: [Vect3 -> real]):
      convergent?(f2, a) AND convergent?(f1, a) IMPLIES
       convergent?(f1 - f2, a);


decl_type: tcc
theory: limit_vect3_real
library: vect_analysis
signature: nil
location: 203 0 208 999
body:
  % Subtype TCC generated (at line 121, column 50) for  a
      % expected type  {a | convergent?(f1 * f2, a)}
  lim_prod_fun_TCC1: OBLIGATION
    FORALL (a: Vect3, f1, f2: [Vect3 -> real]):
      convergent?(f2, a) AND convergent?(f1, a) IMPLIES
       convergent?(f1 * f2, a);


decl_type: tcc
theory: limit_vect3_real
library: vect_analysis
signature: nil
location: 210 0 213 999
body:
  % Subtype TCC generated (at line 123, column 45) for  v
      % expected type  {a | convergent?(const_fun(b), a)}
  lim_const_fun_TCC1: OBLIGATION
    FORALL (b: real, v: Vect3): convergent?(const_fun(b), v);


decl_type: tcc
theory: limit_vect3_real
library: vect_analysis
signature: nil
location: 215 0 219 999
body:
  % Subtype TCC generated (at line 126, column 48) for  a
      % expected type  {a | convergent?(b * f, a)}
  lim_scal_fun_TCC1: OBLIGATION
    FORALL (a: Vect3, b: real, f: [Vect3 -> real]):
      convergent?(f, a) IMPLIES convergent?(b * f, a);


decl_type: tcc
theory: limit_vect3_real
library: vect_analysis
signature: nil
location: 221 0 225 999
body:
  % Subtype TCC generated (at line 129, column 46) for  a
      % expected type  {a | convergent?(1 / g, a)}
  lim_inv_fun_TCC1: OBLIGATION
    FORALL (a: Vect3, g: [Vect3 -> nzreal]):
      lim(g, a) /= 0 AND convergent?(g, a) IMPLIES convergent?(1 / g, a);


decl_type: tcc
theory: limit_vect3_real
library: vect_analysis
signature: nil
location: 227 0 232 999
body:
  % Subtype TCC generated (at line 132, column 48) for  a
      % expected type  {a | convergent?(f / g, a)}
  lim_div_fun_TCC1: OBLIGATION
    FORALL (a: Vect3, f: [Vect3 -> real], g: [Vect3 -> nzreal]):
      lim(g, a) /= 0 AND convergent?(g, a) AND convergent?(f, a) IMPLIES
       convergent?(f / g, a);


decl_type: function
theory: cont_vect3_real
library: vect_analysis
signature: [[[Vect3 -> real], Vect3] -> bool]
location: 23 2 25 65
body:
    continuous_vr?(f, x0) : bool = 
        FORALL epsilon : EXISTS delta : FORALL x :
           norm(x - x0) < delta IMPLIES abs(f(x) - f(x0)) < epsilon


decl_type: tcc
theory: cont_vect3_real
library: vect_analysis
signature: nil
location: 129 0 132 999
body:
  % Existence TCC generated (at line 95, column 2) for
      % continuous_vr_fun: TYPE+ = {f | continuous_vr?(f)}
  continuous_vr_fun_TCC1: OBLIGATION
    EXISTS (x: {f | continuous_vr?(f)}): TRUE;


decl_type: tcc
theory: cont_vect3_real
library: vect_analysis
signature: nil
location: 134 0 136 999
body:
  % Judgement subtype TCC generated (at line 102, column 37) for  h1 + h2
      % expected type  continuous_vr_fun
  sum_fun_continuous_vr: OBLIGATION FORALL (h1, h2): continuous_vr?(h1 + h2);


decl_type: tcc
theory: cont_vect3_real
library: vect_analysis
signature: nil
location: 138 0 140 999
body:
  % Judgement subtype TCC generated (at line 104, column 37) for  h1 - h2
      % expected type  continuous_vr_fun
  diff_fun_continuous_vr: OBLIGATION FORALL (h1, h2): continuous_vr?(h1 - h2);


decl_type: tcc
theory: cont_vect3_real
library: vect_analysis
signature: nil
location: 142 0 144 999
body:
  % Judgement subtype TCC generated (at line 106, column 37) for  h1 * h2
      % expected type  continuous_vr_fun
  prod_fun_continuous_vr: OBLIGATION FORALL (h1, h2): continuous_vr?(h1 * h2);


decl_type: tcc
theory: cont_vect3_real
library: vect_analysis
signature: nil
location: 146 0 149 999
body:
  % Judgement subtype TCC generated (at line 108, column 37) for  const_fun(u)
      % expected type  continuous_vr_fun
  const_fun_continuous_vr: OBLIGATION
    FORALL (u): continuous_vr?(const_fun(u));


decl_type: tcc
theory: cont_vect3_real
library: vect_analysis
signature: nil
location: 151 0 153 999
body:
  % Judgement subtype TCC generated (at line 110, column 37) for  u * h
      % expected type  continuous_vr_fun
  scal_fun_continuous_vr: OBLIGATION FORALL (h, u): continuous_vr?(u * h);


decl_type: tcc
theory: cont_vect3_real
library: vect_analysis
signature: nil
location: 155 0 157 999
body:
  % Judgement subtype TCC generated (at line 112, column 36) for  -h
      % expected type  continuous_vr_fun
  neg_fun_continuous_vr: OBLIGATION FORALL (h): continuous_vr?(-h);


decl_type: tcc
theory: cont_vect3_real
library: vect_analysis
signature: nil
location: 159 0 161 999
body:
  % Judgement subtype TCC generated (at line 114, column 36) for  h / h3
      % expected type  continuous_vr_fun
  div_fun_continuous_vr: OBLIGATION FORALL (h, h3): continuous_vr?(h / h3);


decl_type: tcc
theory: vect3_metric_space
library: vect_analysis
signature: nil
location: 30 0 34 999
body:
  % Assuming TCC generated (at line 16, column 33) for
      % analysis@metric_spaces[Vect3, dist]
      % generated from assumption metric_spaces.fullset_metric_space
  IMP_metric_spaces_TCC1: OBLIGATION
    metric_space?[Vect3, dist](fullset[Vect3]);


decl_type: formula
theory: vect3_Heine
library: vect_analysis
signature: nil
location: 23 3 30 97
body:
     curried_min_exists_3D: LEMMA FORALL (A: real, B: {x: real | A < x}):
      continuous?(f,fullset[[(closed_intv(A,B)),Vect3]])
       IMPLIES (FORALL (y: Vect3):  
          nonempty?[real]({r: real | EXISTS (t: (LAMBDA (x: real): A <= x AND x <= B)):r = f(t, y)})
      AND below_bounded[real]({r: real | EXISTS (t: (LAMBDA (x: real): A <= x AND x <= B)):r = f(t, y)})
      AND ext[real]({r: real | EXISTS (t: (LAMBDA (x: real): A <= x AND x <= B)): r = f(t, y)})
                (inf[real]({r: real | EXISTS (t: (LAMBDA (x: real): A <= x AND x <= B)): r = f(t, y)}))
      AND (EXISTS (tmin: (closed_intv(A,B))): FORALL (s: (closed_intv(A,B))): f(tmin,y) <= f(s,y)))


decl_type: formula
theory: vect3_Heine
library: vect_analysis
signature: nil
location: 32 3 37 40
body:
     curried_min_is_cont_3D: THEOREM FORALL (A: real, B: {x: real | A < x}): 
        continuous?(f,fullset[[(closed_intv(A,B)),Vect3]]) 
        IMPLIES
            LET unif_min_first(y: Vect3): real 
                = min({r: real | EXISTS (t: (closed_intv(A,B))): r = f(t,y)})
            IN continuous?(unif_min_first)


decl_type: formula
theory: vect3_Heine
library: vect_analysis
signature: nil
location: 39 3 50 106
body:
     curried_min_is_cont_3D_ed: THEOREM FORALL (A: real, B: {x: real | A < x}):
         (FORALL (x: (closed_intv(A,B)), y: Vect3, epsilon: posreal): 
            EXISTS (delta: posreal): 
               FORALL (z: (closed_intv(A,B)), w: Vect3): 
                 (real_dist(x,z) <= delta AND dist(y,w) <= delta) IMPLIES real_dist(f(x,y),f(z,w))<epsilon)
         IMPLIES
             LET unif_min_first(y: Vect3): real 
                 = min({r: real | EXISTS (t: (closed_intv(A,B))): r = f(t,y)})
             IN
                (FORALL (y: Vect3): FORALL (epsilon: posreal): 
                    EXISTS (delta: posreal): FORALL (q:Vect3):
                         dist(y,q) < delta IMPLIES real_dist(unif_min_first(y),unif_min_first(q)) < epsilon)


decl_type: formula
theory: vect3_Heine
library: vect_analysis
signature: nil
location: 55 3 57 79
body:
     multiary_Heine_3D:   THEOREM FORALL (A: real, B: {x: real | A < x}):
        continuous?(f,fullset[[(closed_intv(A,B)),Vect3]]) 
        IMPLIES uniformly_continuous_in_first?(f,closed_intv(A,B),fullset[Vect3])


decl_type: formula
theory: vect3_Heine
library: vect_analysis
signature: nil
location: 60 3 68 58
body:
     multiary_Heine_3D_ed:   THEOREM FORALL (A: real, B: {x: real | A < x}):
       (FORALL (x: (closed_intv(A,B)), y: Vect3, epsilon: posreal): 
          EXISTS (delta: posreal): 
             FORALL (z: (closed_intv(A,B)), w: Vect3): (real_dist(x,z) <= delta AND dist(y,w) <= delta) 
                                                            IMPLIES real_dist(f(x,y),f(z,w))<epsilon)
       IMPLIES
          FORALL (y1: Vect3, epsilon: posreal): EXISTS (delta: posreal):
             FORALL (x1,x2: (closed_intv(A,B)), y2: Vect3): (real_dist(x1,x2) <= delta AND dist(y1,y2) <= delta) 
                IMPLIES real_dist(f(x1,y1),f(x2,y2))<epsilon


decl_type: tcc
theory: vect3_Heine
library: vect_analysis
signature: nil
location: 75 0 79 999
body:
  % Assuming TCC generated (at line 18, column 13) for
      % analysis@cross_metric_real_fun[real, real_dist, Vect3, dist]
      % generated from assumption cross_metric_real_fun.fullset_metric_space1
  IMP_cross_metric_real_fun_TCC1: OBLIGATION
    metric_space?[real, real_dist](fullset[real]);


decl_type: tcc
theory: vect3_Heine
library: vect_analysis
signature: nil
location: 81 0 85 999
body:
  % Assuming TCC generated (at line 18, column 13) for
      % analysis@cross_metric_real_fun[real, real_dist, Vect3, dist]
      % generated from assumption cross_metric_real_fun.fullset_metric_space2
  IMP_cross_metric_real_fun_TCC2: OBLIGATION
    metric_space?[Vect3, dist](fullset[Vect3]);


decl_type: tcc
theory: vect3_Heine
library: vect_analysis
signature: nil
location: 87 0 90 999
body:
  % Subtype TCC generated (at line 24, column 42) for  B
      % expected type  {x: real | A <= x}
  curried_min_exists_3D_TCC1: OBLIGATION
    FORALL (A: real, B: {x: real | A < x}): A <= B;


decl_type: tcc
theory: vect3_Heine
library: vect_analysis
signature: nil
location: 92 0 124 999
body:
  % Subtype TCC generated (at line 36, column 20) for
      % {r: real |
      %    EXISTS (t: (LAMBDA (x: real): A <= x AND x <= B)): r = f(t, y)}
      % expected type  min_set[real]
  curried_min_is_cont_3D_TCC1: OBLIGATION
    FORALL (f: [[real, Vect3] -> real], A: real, B: {x: real | A < x}):
      continuous?(f,
                  extend
                      [[real, Vect3],
                       [(LAMBDA (x: real): A <= x AND x <= B), Vect3], bool,
                       FALSE]
                      (fullset
                           [[(LAMBDA (x: real): A <= x AND x <= B), Vect3]]))
       IMPLIES
       (FORALL (y: Vect3):
          nonempty?[real]
              ({r: real |
                  EXISTS (t: (LAMBDA (x: real): A <= x AND x <= B)):
                    r = f(t, y)})
           AND
           below_bounded[real]
               ({r: real |
                   EXISTS (t: (LAMBDA (x: real): A <= x AND x <= B)):
                     r = f(t, y)})
            AND
            ext[real]
                ({r: real |
                    EXISTS (t: (LAMBDA (x: real): A <= x AND x <= B)):
                      r = f(t, y)})
                (inf[real]
                     ({r: real |
                         EXISTS (t: (LAMBDA (x: real): A <= x AND x <= B)):
                           r = f(t, y)})));


decl_type: tcc
theory: vect3_Heine
library: vect_analysis
signature: nil
location: 126 0 157 999
body:
  % Subtype TCC generated (at line 46, column 21) for
      % {r: real |
      %    EXISTS (t: (LAMBDA (x: real): A <= x AND x <= B)): r = f(t, y)}
      % expected type  min_set[real]
  curried_min_is_cont_3D_ed_TCC1: OBLIGATION
    FORALL (f: [[real, Vect3] -> real], A: real, B: {x: real | A < x}):
      (FORALL (x: (LAMBDA (x: real): A <= x AND x <= B), y: Vect3,
               epsilon: posreal):
         EXISTS (delta: posreal):
           FORALL (z: (LAMBDA (x: real): A <= x AND x <= B), w: Vect3):
             (real_dist(x, z) <= delta AND dist(y, w) <= delta) IMPLIES
              real_dist(f(x, y), f(z, w)) < epsilon)
       IMPLIES
       (FORALL (y1: Vect3):
          nonempty?[real]
              ({r: real |
                  EXISTS (t: (LAMBDA (x: real): A <= x AND x <= B)):
                    r = f(t, y1)})
           AND
           below_bounded[real]
               ({r: real |
                   EXISTS (t: (LAMBDA (x: real): A <= x AND x <= B)):
                     r = f(t, y1)})
            AND
            ext[real]
                ({r: real |
                    EXISTS (t: (LAMBDA (x: real): A <= x AND x <= B)):
                      r = f(t, y1)})
                (inf[real]
                     ({r: real |
                         EXISTS (t: (LAMBDA (x: real): A <= x AND x <= B)):
                           r = f(t, y1)})));


decl_type: tcc
theory: vect_metric_space
library: vect_analysis
signature: nil
location: 30 0 34 999
body:
  % Assuming TCC generated (at line 16, column 33) for
      % analysis@metric_spaces[Vector[n], dist]
      % generated from assumption metric_spaces.fullset_metric_space
  IMP_metric_spaces_TCC1: OBLIGATION
    metric_space?[Vector[n], dist[n]](fullset[Vector[n]]);


decl_type: tcc
theory: deriv_cont_2D
library: vect_analysis
signature: nil
location: 31 0 33 999
body:
  % Assuming TCC generated (at line 14, column 29) for  deriv_real_vect2[T]
      % generated from assumption deriv_real_vect2.deriv_domain
  derivable_rv_cont_rv_TCC1: OBLIGATION deriv_domain?[T];


decl_type: tcc
theory: deriv_cont_2D
library: vect_analysis
signature: nil
location: 35 0 37 999
body:
  % Assuming TCC generated (at line 14, column 29) for  deriv_real_vect2[T]
      % generated from assumption deriv_real_vect2.not_one_element
  derivable_rv_cont_rv_TCC2: OBLIGATION not_one_element?[T];


decl_type: formula
theory: deriv_real_vect_def
library: vect_analysis
signature: nil
location: 43 2 44 59
body:
    sum_derivable      : LEMMA derivable?(f1, x) AND derivable?(f2, x)
                               IMPLIES derivable?(f1 + f2, x)


decl_type: formula
theory: deriv_real_vect_def
library: vect_analysis
signature: nil
location: 46 2 47 59
body:
    diff_derivable     : LEMMA derivable?(f1, x) AND derivable?(f2, x)
                               IMPLIES derivable?(f1 - f2, x)


decl_type: formula
theory: deriv_real_vect_def
library: vect_analysis
signature: nil
location: 55 2 56 72
body:
    deriv_sum          : LEMMA derivable?(f1, x) AND derivable?(f2, x) IMPLIES
                            deriv(f1 + f2, x) = deriv(f1, x) + deriv(f2, x)


decl_type: formula
theory: deriv_real_vect_def
library: vect_analysis
signature: nil
location: 58 2 59 54
body:
    deriv_neg          : LEMMA derivable?(f, x) IMPLIES 
                            deriv(- f, x) = - deriv(f, x)


decl_type: formula
theory: deriv_real_vect_def
library: vect_analysis
signature: nil
location: 61 2 62 75
body:
    deriv_diff         : LEMMA derivable?(f1, x) AND derivable?(f2, x) IMPLIES
                               deriv(f1 - f2, x) = deriv(f1, x) - deriv(f2, x)


decl_type: function
theory: deriv_real_vect_def
library: vect_analysis
signature: [[f: [T -> Vector[n]], {x | derivable?(f, x)}] -> Vector[n]]
location: 40 2 41 73
body:
    deriv(f, (x0 : { x | derivable?(f, x) })) : Vector[n] = 
                  (LAMBDA (i: below(n)): deriv(LAMBDA (t:T): f(t)(i), x0 ))


decl_type: tcc
theory: deriv_real_vect_def
library: vect_analysis
signature: nil
location: 74 0 77 999
body:
  % Assuming TCC generated (at line 25, column 12) for
      % analysis@derivatives[T]
      % generated from assumption derivatives.deriv_domain
  IMP_derivatives_TCC1: OBLIGATION deriv_domain?[T];


decl_type: tcc
theory: deriv_real_vect_def
library: vect_analysis
signature: nil
location: 79 0 82 999
body:
  % Assuming TCC generated (at line 25, column 12) for
      % analysis@derivatives[T]
      % generated from assumption derivatives.not_one_element
  IMP_derivatives_TCC2: OBLIGATION not_one_element?[T];


decl_type: tcc
theory: deriv_real_vect_def
library: vect_analysis
signature: nil
location: 84 0 88 999
body:
  % Subtype TCC generated (at line 41, column 68) for  x0
      % expected type  {x | derivable?(LAMBDA (t: T): f(t)(i), x)}
  deriv_TCC1: OBLIGATION
    FORALL (f: [T -> Vector[n]], (x0: {x | derivable?(f, x)}), i: below(n)):
      derivable?[T](LAMBDA (t: T): f(t)(i), x0);


decl_type: tcc
theory: deriv_real_vect_def
library: vect_analysis
signature: nil
location: 90 0 95 999
body:
  % Subtype TCC generated (at line 56, column 40) for  x
      % expected type  {x_1 | derivable?(LAMBDA (x: T): f1(x) + f2(x), x_1)}
  deriv_sum_TCC1: OBLIGATION
    FORALL (f1, f2: [T -> Vector[n]], x1: T):
      derivable?(f2, x1) AND derivable?(f1, x1) IMPLIES
       derivable?(LAMBDA (x: T): (+[n])(f1(x), f2(x)), x1);


decl_type: tcc
theory: deriv_real_vect_def
library: vect_analysis
signature: nil
location: 97 0 101 999
body:
  % Subtype TCC generated (at line 59, column 36) for  x
      % expected type  {x_1 | derivable?(LAMBDA (x: T): -f(x), x_1)}
  deriv_neg_TCC1: OBLIGATION
    FORALL (f: [T -> Vector[n]], x1: T):
      derivable?(f, x1) IMPLIES derivable?(LAMBDA (x: T): -f(x), x1);


decl_type: tcc
theory: deriv_real_vect_def
library: vect_analysis
signature: nil
location: 103 0 108 999
body:
  % Subtype TCC generated (at line 62, column 43) for  x
      % expected type  {x_1 | derivable?(LAMBDA (x: T): f1(x) - f2(x), x_1)}
  deriv_diff_TCC1: OBLIGATION
    FORALL (f1, f2: [T -> Vector[n]], x1: T):
      derivable?(f2, x1) AND derivable?(f1, x1) IMPLIES
       derivable?(LAMBDA (x: T): (-[n])(f1(x), f2(x)), x1);


decl_type: tcc
theory: deriv_real_vect_def
library: vect_analysis
signature: nil
location: 110 0 118 999
body:
  % Subtype TCC generated (at line 64, column 50) for  x
      % expected type  {x_1 |
                     %          derivable?(LAMBDA
                     %                     (x):
                     %                     LAMBDA (i: below(n)): b,
                     %                     x_1)}
  deriv_const_TCC1: OBLIGATION
    FORALL (b: real, x: T):
      derivable?(LAMBDA (x_1: T): LAMBDA (i: below(n)): b, x);


decl_type: tcc
theory: deriv_real_vect_def
library: vect_analysis
signature: nil
location: 120 0 124 999
body:
  % Subtype TCC generated (at line 66, column 67) for  x
      % expected type  {x_1 | derivable?(LAMBDA (x: T): b * f(x), x_1)}
  deriv_scal_TCC1: OBLIGATION
    FORALL (b: real, f: [T -> Vector[n]], x1: T):
      derivable?(f, x1) IMPLIES derivable?(LAMBDA (x: T): *[n](b, f(x)), x1);


decl_type: formula
theory: deriv_sigma
library: vect_analysis
signature: nil
location: 22 2 25 83
body:
    sigma_derivable: LEMMA  
       FORALL (h: [T -> [Index[m] -> real]]):
       (FORALL (i: below[m]): derivable?(LAMBDA (t: T): h(t)(i), y)) IMPLIES
       derivable?((LAMBDA (x: T): sigma(0, m - 1, LAMBDA (i: Index[m]): h(x)(i))), y)


decl_type: formula
theory: deriv_sigma
library: vect_analysis
signature: nil
location: 27 2 32 63
body:
    deriv_sigma: LEMMA n > 0 IMPLIES
       FORALL (h: [T -> [Index[n] -> real]]):
       (FORALL (i: below[n]): derivable?(LAMBDA (t: T): h(t)(i), y))
       IMPLIES
       deriv(LAMBDA (x: T): sigma(0, n - 1, LAMBDA (i: Index[n]): h(x)(i)),y)
          = sigma(0, n - 1, LAMBDA (i: Index[n]): deriv(h, y)(i))


decl_type: tcc
theory: deriv_sigma
library: vect_analysis
signature: nil
location: 39 0 42 999
body:
  % Assuming TCC generated (at line 16, column 12) for
      % analysis@derivatives[T]
      % generated from assumption derivatives.deriv_domain
  IMP_derivatives_TCC1: OBLIGATION deriv_domain?[T];


decl_type: tcc
theory: deriv_sigma
library: vect_analysis
signature: nil
location: 44 0 47 999
body:
  % Assuming TCC generated (at line 16, column 12) for
      % analysis@derivatives[T]
      % generated from assumption derivatives.not_one_element
  IMP_derivatives_TCC2: OBLIGATION not_one_element?[T];


decl_type: tcc
theory: deriv_sigma
library: vect_analysis
signature: nil
location: 49 0 54 999
body:
  % Subtype TCC generated (at line 25, column 38) for  0
      % expected type  T_low[Index[m]]
  sigma_derivable_TCC1: OBLIGATION
    FORALL (m: posnat, y: T, h: [T -> [Index[m] -> real]]):
      (FORALL (i: below[m]): derivable?(LAMBDA (t: T): h(t)(i), y)) IMPLIES
       (FORALL (x: T): 0 >= 0 AND 0 < m OR (EXISTS (j: Index[m]): j <= 0));


decl_type: tcc
theory: deriv_sigma
library: vect_analysis
signature: nil
location: 56 0 62 999
body:
  % Subtype TCC generated (at line 25, column 41) for  m - 1
      % expected type  T_high[Index[m]]
  sigma_derivable_TCC2: OBLIGATION
    FORALL (m: posnat, y: T, h: [T -> [Index[m] -> real]]):
      (FORALL (i: below[m]): derivable?(LAMBDA (t: T): h(t)(i), y)) IMPLIES
       (FORALL (x: T):
          m - 1 >= 0 AND m - 1 < m OR (EXISTS (j: Index[m]): m - 1 <= j));


decl_type: tcc
theory: deriv_sigma
library: vect_analysis
signature: nil
location: 64 0 71 999
body:
  % Assuming TCC generated (at line 21, column 12) for  reals@sigma[Index[m]]
      % generated from assumption sigma.connected_domain
  sigma_derivable_TCC3: OBLIGATION
    FORALL (m: posnat, y1: T, h: [T -> [Index[m] -> real]]):
      (FORALL (i: below[m]): derivable?(LAMBDA (t: T): h(t)(i), y1)) IMPLIES
       (FORALL (x: T):
          FORALL (x, y: Index[m]), (z: integer):
            x <= z AND z <= y IMPLIES z >= 0 AND z < m);


decl_type: tcc
theory: deriv_sigma
library: vect_analysis
signature: nil
location: 73 0 82 999
body:
  % Subtype TCC generated (at line 31, column 32) for  0
      % expected type  T_low[Index[n]]
  deriv_sigma_TCC1: OBLIGATION
    FORALL (n: nat, y: T):
      n > 0 IMPLIES
       (FORALL (h: [T -> [Index[n] -> real]]):
          (FORALL (i: below[n]): derivable?(LAMBDA (t: T): h(t)(i), y))
           IMPLIES
           (FORALL (x: T):
              0 >= 0 AND 0 < n OR (EXISTS (j: Index[n]): j <= 0)));


decl_type: tcc
theory: deriv_sigma
library: vect_analysis
signature: nil
location: 84 0 94 999
body:
  % Subtype TCC generated (at line 31, column 35) for  n - 1
      % expected type  T_high[Index[n]]
  deriv_sigma_TCC2: OBLIGATION
    FORALL (n: nat, y: T):
      n > 0 IMPLIES
       (FORALL (h: [T -> [Index[n] -> real]]):
          (FORALL (i: below[n]): derivable?(LAMBDA (t: T): h(t)(i), y))
           IMPLIES
           (FORALL (x: T):
              n - 1 >= 0 AND n - 1 < n OR
               (EXISTS (j: Index[n]): n - 1 <= j)));


decl_type: tcc
theory: deriv_sigma
library: vect_analysis
signature: nil
location: 96 0 106 999
body:
  % Assuming TCC generated (at line 21, column 12) for  reals@sigma[Index[n]]
      % generated from assumption sigma.connected_domain
  deriv_sigma_TCC3: OBLIGATION
    FORALL (n: nat, y1: T):
      n > 0 IMPLIES
       (FORALL (h: [T -> [Index[n] -> real]]):
          (FORALL (i: below[n]): derivable?(LAMBDA (t: T): h(t)(i), y1))
           IMPLIES
           (FORALL (x: T):
              FORALL (x, y: Index[n]), (z: integer):
                x <= z AND z <= y IMPLIES z >= 0 AND z < n));


decl_type: tcc
theory: deriv_sigma
library: vect_analysis
signature: nil
location: 108 0 126 999
body:
  % Subtype TCC generated (at line 31, column 73) for  y
      % expected type  {x_1 |
                     %          derivable?(LAMBDA
                     %                     (x: T):
                     %                     sigma
                     %                     (0,
                     %                      n - 1,
                     %                      LAMBDA (i: Index[n]): h(x)(i)),
                     %                     x_1)}
  deriv_sigma_TCC4: OBLIGATION
    FORALL (n: nat, y: T):
      n > 0 IMPLIES
       (FORALL (h: [T -> [Index[n] -> real]]):
          (FORALL (i: below[n]): derivable?(LAMBDA (t: T): h(t)(i), y))
           IMPLIES
           derivable?[T]
               (LAMBDA (x: T):
                  sigma[Index[n]](0, n - 1, LAMBDA (i: Index[n]): h(x)(i)),
                y));


decl_type: tcc
theory: deriv_sigma
library: vect_analysis
signature: nil
location: 128 0 135 999
body:
  % Subtype TCC generated (at line 32, column 16) for  0
      % expected type  T_low[Index[n]]
  deriv_sigma_TCC5: OBLIGATION
    FORALL (n: nat, y: T):
      n > 0 IMPLIES
       (FORALL (h: [T -> [Index[n] -> real]]):
          (FORALL (i: below[n]): derivable?(LAMBDA (t: T): h(t)(i), y))
           IMPLIES 0 >= 0 AND 0 < n OR (EXISTS (j: Index[n]): j <= 0));


decl_type: tcc
theory: deriv_sigma
library: vect_analysis
signature: nil
location: 137 0 145 999
body:
  % Subtype TCC generated (at line 32, column 19) for  n - 1
      % expected type  T_high[Index[n]]
  deriv_sigma_TCC6: OBLIGATION
    FORALL (n: nat, y: T):
      n > 0 IMPLIES
       (FORALL (h: [T -> [Index[n] -> real]]):
          (FORALL (i: below[n]): derivable?(LAMBDA (t: T): h(t)(i), y))
           IMPLIES
           n - 1 >= 0 AND n - 1 < n OR (EXISTS (j: Index[n]): n - 1 <= j));


decl_type: tcc
theory: deriv_sigma
library: vect_analysis
signature: nil
location: 147 0 154 999
body:
  % Subtype TCC generated (at line 32, column 57) for  y
      % expected type  {x | derivable?[T, n](h, x)}
  deriv_sigma_TCC7: OBLIGATION
    FORALL (n: nat, y: T):
      n > 0 IMPLIES
       (FORALL (h: [T -> [Index[n] -> real]]):
          (FORALL (i: below[n]): derivable?(LAMBDA (t: T): h(t)(i), y))
           IMPLIES (FORALL (i1: Index[n]): derivable?[T, n](h, y)));


decl_type: tcc
theory: deriv_sigma
library: vect_analysis
signature: nil
location: 156 0 165 999
body:
  % Assuming TCC generated (at line 21, column 12) for  reals@sigma[Index[n]]
      % generated from assumption sigma.connected_domain
  deriv_sigma_TCC8: OBLIGATION
    FORALL (n: nat, y1: T):
      n > 0 IMPLIES
       (FORALL (h: [T -> [Index[n] -> real]]):
          (FORALL (i: below[n]): derivable?(LAMBDA (t: T): h(t)(i), y1))
           IMPLIES
           (FORALL (x, y: Index[n]), (z: integer):
              x <= z AND z <= y IMPLIES z >= 0 AND z < n));


decl_type: formula
theory: deriv_dot_prod
library: vect_analysis
signature: nil
location: 26 2 27 61
body:
    dot_prod_derivable  : LEMMA derivable?(f1, x) AND derivable?(f2, x)
                                 IMPLIES derivable?(f1 * f2, x)


decl_type: formula
theory: deriv_dot_prod
library: vect_analysis
signature: nil
location: 30 2 32 67
body:
    deriv_dot_prod      : LEMMA derivable?(f1, x) AND derivable?(f2, x) IMPLIES
                           deriv(f1 * f2, x) = deriv(f1, x) * f2(x) 
                                               + deriv(f2, x) * f1(x)


decl_type: tcc
theory: deriv_dot_prod
library: vect_analysis
signature: nil
location: 50 0 55 999
body:
  % Subtype TCC generated (at line 31, column 40) for  x
      % expected type  {x_1 | derivable?(LAMBDA (x: T): f1(x) * f2(x), x_1)}
  deriv_dot_prod_TCC1: OBLIGATION
    FORALL (f1, f2: [T -> Vector[n]], x1: T):
      derivable?(f2, x1) AND derivable?(f1, x1) IMPLIES
       derivable?[T](LAMBDA (x: T): *[n](f1(x), f2(x)), x1);


decl_type: formula
theory: deriv_real_vect
library: vect_analysis
signature: nil
location: 42 2 43 56
body:
    sum_derivable_vfun     : LEMMA derivable?(f1) AND derivable?(f2)
                               IMPLIES derivable?(f1 + f2)


decl_type: formula
theory: deriv_real_vect
library: vect_analysis
signature: nil
location: 47 2 48 56
body:
    diff_derivable_vfun    : LEMMA derivable?(f1) AND derivable?(f2)
                               IMPLIES derivable?(f1 - f2)


decl_type: formula
theory: deriv_real_vect
library: vect_analysis
signature: nil
location: 52 2 53 56
body:
    dot_derivable_vfun      : LEMMA derivable?(f1) AND derivable?(f2)
                               IMPLIES derivable?(f1 * f2)


decl_type: tcc
theory: deriv_real_vect
library: vect_analysis
signature: nil
location: 96 0 99 999
body:
  % Assuming TCC generated (at line 21, column 12) for
      % deriv_real_vect_def[T, n]
      % generated from assumption deriv_real_vect_def.deriv_domain
  IMP_deriv_real_vect_def_TCC1: OBLIGATION deriv_domain?[T];


decl_type: tcc
theory: deriv_real_vect
library: vect_analysis
signature: nil
location: 101 0 104 999
body:
  % Assuming TCC generated (at line 21, column 12) for
      % deriv_real_vect_def[T, n]
      % generated from assumption deriv_real_vect_def.not_one_element
  IMP_deriv_real_vect_def_TCC2: OBLIGATION not_one_element?[T];


decl_type: tcc
theory: deriv_real_vect
library: vect_analysis
signature: nil
location: 106 0 108 999
body:
  % Subtype TCC generated (at line 38, column 66) for  x
      % expected type  {x | derivable?(ff, x)}
  deriv_TCC1: OBLIGATION FORALL (ff: deriv_vfun, x): derivable?[T, n](ff, x);


decl_type: tcc
theory: deriv_real_vect
library: vect_analysis
signature: nil
location: 110 0 114 999
body:
  % Judgement subtype TCC generated (at line 14, column 41) for
      % LAMBDA (x: T): ff1(x) + ff2(x)
      % expected type  deriv_vfun
  derivable_sum: OBLIGATION
    FORALL (ff1, ff2): derivable?(LAMBDA (x: T): (+[n])(ff1(x), ff2(x)));


decl_type: tcc
theory: deriv_real_vect
library: vect_analysis
signature: nil
location: 116 0 120 999
body:
  % Judgement subtype TCC generated (at line 16, column 41) for
      % LAMBDA (x: T): ff1(x) - ff2(x)
      % expected type  deriv_vfun
  derivable_diff: OBLIGATION
    FORALL (ff1, ff2): derivable?(LAMBDA (x: T): (-[n])(ff1(x), ff2(x)));


decl_type: tcc
theory: deriv_real_vect
library: vect_analysis
signature: nil
location: 122 0 126 999
body:
  % Judgement subtype TCC generated (at line 17, column 41) for
      % LAMBDA (x: T): b * ff(x)
      % expected type  deriv_vfun
  derivable_scal: OBLIGATION
    FORALL (b, ff): derivable?(LAMBDA (x: T): *[n](b, ff(x)));


decl_type: tcc
theory: deriv_real_vect
library: vect_analysis
signature: nil
location: 128 0 131 999
body:
  % Judgement subtype TCC generated (at line 15, column 41) for
      % LAMBDA (x: T): -ff(x)
      % expected type  deriv_vfun
  derivable_neg: OBLIGATION FORALL (ff): derivable?(LAMBDA (x: T): -ff(x));


decl_type: tcc
theory: deriv_real_vect
library: vect_analysis
signature: nil
location: 133 0 137 999
body:
  % Judgement subtype TCC generated (at line 36, column 44) for
      % LAMBDA (x: T): LAMBDA (i: below(n)): b
      % expected type  deriv_vfun
  derivable_const: OBLIGATION
    FORALL (b): derivable?(LAMBDA (x: T): LAMBDA (i: below(n)): b);


decl_type: tcc
theory: deriv_real_vect
library: vect_analysis
signature: nil
location: 139 0 144 999
body:
  % Subtype TCC generated (at line 19, column 41) for
      % LAMBDA (x: T): ff1(x) * ff2(x)
      % expected type  deriv_fun[T]
  deriv_dot_vfun_TCC1: OBLIGATION
    FORALL (ff1, ff2: deriv_vfun):
      derivable?[T](LAMBDA (x: T): *[n](ff1(x), ff2(x)));


decl_type: formula
theory: limit_vect
library: vect_analysis
signature: nil
location: 48 2 50 46
body:
    cv_sum   : LEMMA 
      convergence(f1, a, l1) AND convergence(f2, a, l2)
        IMPLIES convergence(f1 + f2, a, l1 + l2)


decl_type: formula
theory: limit_vect
library: vect_analysis
signature: nil
location: 56 2 58 46
body:
    cv_diff  : LEMMA 
      convergence(f1, a, l1) AND convergence(f2, a, l2)
        IMPLIES convergence(f1 - f2, a, l1 - l2)


decl_type: formula
theory: limit_vect
library: vect_analysis
signature: nil
location: 125 3 126 67
body:
     lim_scal_fun     : LEMMA convergent?(f, a) 
                                IMPLIES lim(k * f, a) = k * lim(f, a)


decl_type: function
theory: limit_vect
library: vect_analysis
signature: [[[Vector[n] -> Vector[m]], Vector[n], Vector[m]] -> bool]
location: 31 2 34 49
body:
    convergence(f, a, l): bool = 
          FORALL epsilon : EXISTS delta : 
              FORALL v: norm(v-a) < delta        
                   IMPLIES norm(f(v) - l) < epsilon


decl_type: function
theory: limit_vect
library: vect_analysis
signature:
  [[f: [Vector[n] -> Vector[m]], {a | convergent?(f, a)}] ->
  Vector[m]]

location: 72 2 73 48
body:
    lim(f, (x0 : {a | convergent?(f, a)})) : Vector[m] =  
          choose(LAMBDA l : convergence(f, x0, l))


decl_type: tcc
theory: limit_vect
library: vect_analysis
signature: nil
location: 133 0 138 999
body:
  % Subtype TCC generated (at line 73, column 15) for
      % LAMBDA l: convergence(f, x0, l)
      % expected type  p: (nonempty?[Vector[m]])
  lim_TCC1: OBLIGATION
    FORALL (f: [Vector[n] -> Vector[m]], (x0: {a | convergent?(f, a)})):
      nonempty?[Vector[m]](LAMBDA l: convergence(f, x0, l));


decl_type: tcc
theory: limit_vect
library: vect_analysis
signature: nil
location: 140 0 145 999
body:
  % Subtype TCC generated (at line 112, column 50) for  a
      % expected type  {a | convergent?(LAMBDA (v): f1(v) + f2(v), a)}
  lim_sum_fun_TCC1: OBLIGATION
    FORALL (a: Vector[n], f1, f2: [Vector[n] -> Vector[m]]):
      convergent?(f2, a) AND convergent?(f1, a) IMPLIES
       convergent?(LAMBDA (v): (+[m])(f1(v), f2(v)), a);


decl_type: tcc
theory: limit_vect
library: vect_analysis
signature: nil
location: 147 0 151 999
body:
  % Subtype TCC generated (at line 115, column 46) for  a
      % expected type  {a | convergent?(LAMBDA (v): -f(v), a)}
  lim_neg_fun_TCC1: OBLIGATION
    FORALL (a: Vector[n], f: [Vector[n] -> Vector[m]]):
      convergent?(f, a) IMPLIES convergent?(LAMBDA (v): -f(v), a);


decl_type: tcc
theory: limit_vect
library: vect_analysis
signature: nil
location: 153 0 158 999
body:
  % Subtype TCC generated (at line 118, column 50) for  a
      % expected type  {a | convergent?(LAMBDA (v): f1(v) - f2(v), a)}
  lim_diff_fun_TCC1: OBLIGATION
    FORALL (a: Vector[n], f1, f2: [Vector[n] -> Vector[m]]):
      convergent?(f2, a) AND convergent?(f1, a) IMPLIES
       convergent?(LAMBDA (v): (-[m])(f1(v), f2(v)), a);


decl_type: tcc
theory: limit_vect
library: vect_analysis
signature: nil
location: 160 0 163 999
body:
  % Subtype TCC generated (at line 123, column 45) for  a
      % expected type  {a | convergent?(const_fun(l), a)}
  lim_const_fun_TCC1: OBLIGATION
    FORALL (a: Vector[n], l: Vector[m]): convergent?(const_fun(l), a);


decl_type: tcc
theory: limit_vect
library: vect_analysis
signature: nil
location: 165 0 169 999
body:
  % Subtype TCC generated (at line 126, column 49) for  a
      % expected type  {a | convergent?(LAMBDA (v): k * f(v), a)}
  lim_scal_fun_TCC1: OBLIGATION
    FORALL (a: Vector[n], f: [Vector[n] -> Vector[m]], k: real):
      convergent?(f, a) IMPLIES convergent?(LAMBDA (v): *[m](k, f(v)), a);


decl_type: formula
theory: cont_vect
library: vect_analysis
signature: nil
location: 79 2 80 58
body:
    sum_cont_fun  : LEMMA continuous_vv?(f1) AND continuous_vv?(f2)
                             IMPLIES continuous_vv?(f1 + f2)


decl_type: formula
theory: cont_vect
library: vect_analysis
signature: nil
location: 82 2 83 58
body:
    diff_cont_fun : LEMMA continuous_vv?(f1) AND continuous_vv?(f2)
                             IMPLIES continuous_vv?(f1 - f2)


decl_type: tcc
theory: cont_vect
library: vect_analysis
signature: nil
location: 98 0 101 999
body:
  % Existence TCC generated (at line 61, column 2) for
      % continuous_vv_fun: TYPE+ = {f | continuous_vv?(f)}
  continuous_vv_fun_TCC1: OBLIGATION
    EXISTS (x: {f | continuous_vv?(f)}): TRUE;


decl_type: tcc
theory: cont_vect
library: vect_analysis
signature: nil
location: 103 0 108 999
body:
  % Judgement subtype TCC generated (at line 14, column 36) for
      % LAMBDA (v: Vector[n]): h1(v) + h2(v)
      % expected type  continuous_vv_fun
  sum_fun_continuous_vv: OBLIGATION
    FORALL (h1, h2):
      continuous_vv?(LAMBDA (v: Vector[n]): (+[m])(h1(v), h2(v)));


decl_type: tcc
theory: cont_vect
library: vect_analysis
signature: nil
location: 110 0 115 999
body:
  % Judgement subtype TCC generated (at line 18, column 36) for
      % LAMBDA (v: Vector[n]): h1(v) - h2(v)
      % expected type  continuous_vv_fun
  diff_fun_continuous_vv: OBLIGATION
    FORALL (h1, h2):
      continuous_vv?(LAMBDA (v: Vector[n]): (-[m])(h1(v), h2(v)));


decl_type: tcc
theory: cont_vect
library: vect_analysis
signature: nil
location: 117 0 120 999
body:
  % Judgement subtype TCC generated (at line 72, column 37) for  const_fun(u)
      % expected type  continuous_vv_fun
  const_fun_continuous_vv: OBLIGATION
    FORALL (u): continuous_vv?(const_fun[n, m](u));


decl_type: tcc
theory: cont_vect
library: vect_analysis
signature: nil
location: 122 0 126 999
body:
  % Judgement subtype TCC generated (at line 16, column 30) for
      % LAMBDA (v: Vector[n]): -h(v)
      % expected type  continuous_vv_fun
  neg_fun_continuous_vv: OBLIGATION
    FORALL (h): continuous_vv?(LAMBDA (v: Vector[n]): -h(v));


decl_type: tcc
theory: limit_vect_real
library: vect_analysis
signature: nil
location: 183 0 188 999
body:
  % Subtype TCC generated (at line 112, column 50) for  a
      % expected type  {a | convergent?(f1 + f2, a)}
  lim_sum_fun_TCC1: OBLIGATION
    FORALL (a: Vector[n], f1, f2: [Vector[n] -> real]):
      convergent?(f2, a) AND convergent?(f1, a) IMPLIES
       convergent?((+[n])(f1, f2), a);


decl_type: tcc
theory: limit_vect_real
library: vect_analysis
signature: nil
location: 190 0 194 999
body:
  % Subtype TCC generated (at line 115, column 46) for  a
      % expected type  {a | convergent?(-f, a)}
  lim_neg_fun_TCC1: OBLIGATION
    FORALL (a: Vector[n], f: [Vector[n] -> real]):
      convergent?(f, a) IMPLIES convergent?(-f, a);


decl_type: tcc
theory: limit_vect_real
library: vect_analysis
signature: nil
location: 196 0 201 999
body:
  % Subtype TCC generated (at line 118, column 50) for  a
      % expected type  {a | convergent?(f1 - f2, a)}
  lim_diff_fun_TCC1: OBLIGATION
    FORALL (a: Vector[n], f1, f2: [Vector[n] -> real]):
      convergent?(f2, a) AND convergent?(f1, a) IMPLIES
       convergent?((-[n])(f1, f2), a);


decl_type: tcc
theory: limit_vect_real
library: vect_analysis
signature: nil
location: 203 0 208 999
body:
  % Subtype TCC generated (at line 121, column 50) for  a
      % expected type  {a | convergent?(f1 * f2, a)}
  lim_prod_fun_TCC1: OBLIGATION
    FORALL (a: Vector[n], f1, f2: [Vector[n] -> real]):
      convergent?(f2, a) AND convergent?(f1, a) IMPLIES
       convergent?(*[n](f1, f2), a);


decl_type: tcc
theory: limit_vect_real
library: vect_analysis
signature: nil
location: 210 0 213 999
body:
  % Subtype TCC generated (at line 123, column 45) for  v
      % expected type  {a | convergent?(const_fun(b), a)}
  lim_const_fun_TCC1: OBLIGATION
    FORALL (b: real, v: Vector[n]): convergent?(const_fun[n](b), v);


decl_type: tcc
theory: limit_vect_real
library: vect_analysis
signature: nil
location: 215 0 219 999
body:
  % Subtype TCC generated (at line 126, column 48) for  a
      % expected type  {a | convergent?(b * f, a)}
  lim_scal_fun_TCC1: OBLIGATION
    FORALL (a: Vector[n], b: real, f: [Vector[n] -> real]):
      convergent?(f, a) IMPLIES convergent?(*[n](b, f), a);


decl_type: tcc
theory: limit_vect_real
library: vect_analysis
signature: nil
location: 221 0 225 999
body:
  % Subtype TCC generated (at line 129, column 46) for  a
      % expected type  {a | convergent?(1 / g, a)}
  lim_inv_fun_TCC1: OBLIGATION
    FORALL (a: Vector[n], g: [Vector[n] -> nzreal]):
      lim(g, a) /= 0 AND convergent?(g, a) IMPLIES convergent?(/[n](1, g), a);


decl_type: tcc
theory: limit_vect_real
library: vect_analysis
signature: nil
location: 227 0 232 999
body:
  % Subtype TCC generated (at line 132, column 48) for  a
      % expected type  {a | convergent?(f / g, a)}
  lim_div_fun_TCC1: OBLIGATION
    FORALL (a: Vector[n], f: [Vector[n] -> real], g: [Vector[n] -> nzreal]):
      lim(g, a) /= 0 AND convergent?(g, a) AND convergent?(f, a) IMPLIES
       convergent?(/[n](f, g), a);


decl_type: formula
theory: vectors
library: vectors
signature: nil
location: 322 3 324 54
body:
     sq_norm_dist   : LEMMA 
       LET a = v1-v0, b = v1-v2, c = v2-v0 IN    
         sq(norm(c)) = sq(norm(a)) + sq(norm(b)) - 2*a*b


decl_type: tcc
theory: vectors
library: vectors
signature: nil
location: 414 0 417 999
body:
  % Subtype TCC generated (at line 31, column 26) for  n - 1
      % expected type  T_high[below(n)]
  times_TCC1: OBLIGATION
    n - 1 >= 0 AND n - 1 < n OR (EXISTS (j: below(n)): n - 1 <= j);


decl_type: tcc
theory: vectors
library: vectors
signature: nil
location: 419 0 421 999
body:
  % Subtype TCC generated (at line 37, column 20) for  v * v
      % expected type  nnreal
  sqv_TCC1: OBLIGATION FORALL (v: Vector): v * v >= 0;


decl_type: tcc
theory: vectors
library: vectors
signature: nil
location: 423 0 425 999
body:
  % Subtype TCC generated (at line 59, column 28) for  zero WITH [i := 1]
      % expected type  Normalized
  unity_TCC1: OBLIGATION FORALL (i: Index): norm((zero WITH [i := 1])) = 1;


decl_type: tcc
theory: vectors
library: vectors
signature: nil
location: 427 0 429 999
body:
  % Judgement subtype TCC generated (at line 100, column 5) for  norm(nzu)
      % expected type  posreal
  nz_norm_gt_0: OBLIGATION FORALL (nzu): norm(nzu) > 0;


decl_type: tcc
theory: vectors
library: vectors
signature: nil
location: 431 0 433 999
body:
  % Judgement subtype TCC generated (at line 103, column 5) for  sqv(nzu)
      % expected type  posreal
  nz_sqv_gt_0: OBLIGATION FORALL (nzu): sqv(nzu) > 0;


decl_type: tcc
theory: vectors
library: vectors
signature: nil
location: 435 0 437 999
body:
  % Judgement subtype TCC generated (at line 106, column 5) for  x
      % expected type  Nz_vector
  normalized_nz: OBLIGATION FORALL (x: Normalized): x /= zero;


decl_type: tcc
theory: vectors
library: vectors
signature: nil
location: 439 0 441 999
body:
  % Judgement subtype TCC generated (at line 109, column 5) for  -nzu
      % expected type  Nz_vector
  neg_nzv: OBLIGATION FORALL (nzu): -nzu /= zero;


decl_type: tcc
theory: vectors
library: vectors
signature: nil
location: 443 0 445 999
body:
  % Judgement subtype TCC generated (at line 112, column 5) for  nza * nzv
      % expected type  Nz_vector
  nz_nzv: OBLIGATION FORALL (nza, nzv): nza * nzv /= zero;


decl_type: tcc
theory: vectors
library: vectors
signature: nil
location: 447 0 450 999
body:
  % Subtype TCC generated (at line 286, column 33) for  (1 / norm(nzv)) * nzv
      % expected type  Normalized
  caret_TCC1: OBLIGATION
    FORALL (nzv: Nz_vector): norm((1 / norm(nzv)) * nzv) = 1;


decl_type: formula
theory: vectors_3D
library: vectors
signature: nil
location: 348 3 350 46
body:
     norm_ge_comps   : LEMMA norm(u) >= abs(u`x) AND
                             norm(u) >= abs(u`y) AND               
                             norm(u) >= abs(u`z)                      


decl_type: formula
theory: vectors_3D
library: vectors
signature: nil
location: 353 3 354 76
body:
     sq_norm_dist   : LEMMA LET a = v1-v0, b = v1-v2, c = v2-v0 IN    
                               sq(norm(c)) = sq(norm(a)) + sq(norm(b)) - 2*a*b


decl_type: tcc
theory: vectors_3D
library: vectors
signature: nil
location: 447 0 449 999
body:
  % Subtype TCC generated (at line 36, column 20) for  v * v
      % expected type  nnreal
  sqv_TCC1: OBLIGATION FORALL (v: Vector): v * v >= 0;


decl_type: tcc
theory: vectors_3D
library: vectors
signature: nil
location: 451 0 453 999
body:
  % Judgement subtype TCC generated (at line 119, column 5) for  norm(nzu)
      % expected type  posreal
  nz_norm_gt_0: OBLIGATION FORALL (nzu): norm(nzu) > 0;


decl_type: tcc
theory: vectors_3D
library: vectors
signature: nil
location: 455 0 457 999
body:
  % Judgement subtype TCC generated (at line 122, column 5) for  sqv(nzu)
      % expected type  posreal
  nz_sqv_gt_0: OBLIGATION FORALL (nzu): sqv(nzu) > 0;


decl_type: tcc
theory: vectors_3D
library: vectors
signature: nil
location: 459 0 463 999
body:
  % Judgement subtype TCC generated (at line 8, column 41) for
      % (# x := nza, y := b, z := c #)
      % expected type  Nz_vector
  nz_nvz_left: OBLIGATION
    FORALL (b, c, nza): (# x := nza, y := b, z := c #) /= zero;


decl_type: tcc
theory: vectors_3D
library: vectors
signature: nil
location: 465 0 469 999
body:
  % Judgement subtype TCC generated (at line 8, column 41) for
      % (# x := b, y := nza, z := c #)
      % expected type  Nz_vector
  nz_nvz_middle: OBLIGATION
    FORALL (b, c, nza): (# x := b, y := nza, z := c #) /= zero;


decl_type: tcc
theory: vectors_3D
library: vectors
signature: nil
location: 471 0 475 999
body:
  % Judgement subtype TCC generated (at line 8, column 41) for
      % (# x := b, y := c, z := nza #)
      % expected type  Nz_vector
  nz_nvz_right: OBLIGATION
    FORALL (b, c, nza): (# x := b, y := c, z := nza #) /= zero;


decl_type: tcc
theory: vectors_3D
library: vectors
signature: nil
location: 477 0 479 999
body:
  % Judgement subtype TCC generated (at line 134, column 5) for  x
      % expected type  Nz_vector
  normalized_nz: OBLIGATION FORALL (x: Normalized): x /= zero;


decl_type: tcc
theory: vectors_3D
library: vectors
signature: nil
location: 481 0 483 999
body:
  % Judgement subtype TCC generated (at line 137, column 5) for  -nzu
      % expected type  Nz_vector
  neg_nzv: OBLIGATION FORALL (nzu): -nzu /= zero;


decl_type: tcc
theory: vectors_3D
library: vectors
signature: nil
location: 485 0 487 999
body:
  % Judgement subtype TCC generated (at line 140, column 5) for  nza * nzv
      % expected type  Nz_vector
  nz_nzv: OBLIGATION FORALL (nza, nzv): nza * nzv /= zero;


decl_type: tcc
theory: vectors_3D
library: vectors
signature: nil
location: 489 0 492 999
body:
  % Subtype TCC generated (at line 316, column 33) for  (1 / norm(nzv)) * nzv
      % expected type  Normalized
  caret_TCC1: OBLIGATION
    FORALL (nzv: Nz_vector): norm((1 / norm(nzv)) * nzv) = 1;


decl_type: formula
theory: test_vec
library: vectors
signature: nil
location: 51 3 52 57
body:
     t15: LEMMA c*(a*u)*(b*v)*(d*w)*(a*v3*(b*v2)*(c*v1)) = 
                   a*b*c*(u*v)*((d*w)*(a*v1))*(b*v3)*(c*v2)


decl_type: formula
theory: test_vec
library: vectors
signature: nil
location: 73 3 75 56
body:
     t28: LEMMA norm(sqv(-w)*(u+v))*v1*(v2 - b*v3) = 
                    (norm(sqv(w)*u + sqv(w)*v)*v1)*v2 - 
                       (norm(sqv(w)*u + sqv(w)*v)*b*v1)*v3


decl_type: formula
theory: test_vec
library: vectors
signature: nil
location: 79 3 80 67
body:
     t30: LEMMA a*(v*u)*norm(w)*(u*v) + (sqv(a*u)*sqv(v)) *(u*v) 
                   = (((a*v)*(norm(-w)*u)+sq(a)*sqv(u)* sqv(v) )*u)*v  


decl_type: formula
theory: vectors_dot_alt
library: vectors
signature: nil
location: 28 3 30 71
body:
     dot_rew_prep: LEMMA m < n IMPLIES
                         sigma[nat](0, m, LAMBDA (j: nat): IF j < n THEN u(j) * v(j) ELSE 0 ENDIF)
                         = sigma(0, m, LAMBDA (i: Index[n]): u(i) * v(i))


decl_type: function
theory: vectors_dot_alt
library: vectors
signature: [[Vector[n], Vector[n]] -> real]
location: 24 3 25 51
body:
     dot(u,v): real = sigma[nat](0,n-1, LAMBDA (j: nat): IF j < n THEN u(j)*v(j)
                                        ELSE 0 ENDIF)


decl_type: tcc
theory: vectors_dot_alt
library: vectors
signature: nil
location: 39 0 41 999
body:
  % Subtype TCC generated (at line 24, column 33) for  n - 1
      % expected type  T_high[nat]
  dot_TCC1: OBLIGATION n - 1 >= 0 OR (EXISTS (j: nat): n - 1 <= j);


decl_type: tcc
theory: vectors_dot_alt
library: vectors
signature: nil
location: 43 0 46 999
body:
  % Subtype TCC generated (at line 29, column 37) for  m
      % expected type  T_high[nat]
  dot_rew_prep_TCC1: OBLIGATION
    FORALL (m: nat): m < n IMPLIES m >= 0 OR (EXISTS (j: nat): m <= j);


decl_type: tcc
theory: vectors_dot_alt
library: vectors
signature: nil
location: 48 0 52 999
body:
  % Subtype TCC generated (at line 30, column 34) for  m
      % expected type  T_high[below(n)]
  dot_rew_prep_TCC2: OBLIGATION
    FORALL (m: nat):
      m < n IMPLIES m >= 0 AND m < n OR (EXISTS (j: below(n)): m <= j);


decl_type: formula
theory: vectors_2D
library: vectors
signature: nil
location: 310 3 312 4
body:
     norm_scal      : LEMMA norm(a*v) = abs(a)*norm(v) 

     ;^(nzv)         : Normalized = (1/norm(nzv))*nzv        


decl_type: formula
theory: vectors_2D
library: vectors
signature: nil
location: 334 3 335 44
body:
     schwarz_converse: LEMMA norm(u)*norm(nzv) = abs(u*nzv) IMPLIES 
                              EXISTS (cr:real): cr*nzv = u


decl_type: formula
theory: vectors_2D
library: vectors
signature: nil
location: 347 3 348 46
body:
     norm_ge_comps   : LEMMA norm(u) >= abs(u`x) AND
                             norm(u) >= abs(u`y)                 


decl_type: formula
theory: vectors_2D
library: vectors
signature: nil
location: 352 3 353 77
body:
     sq_norm_dist   : LEMMA LET a = v1-v0, b = v1-v2, c = v2-v0 IN  
                                sq(norm(c)) = sq(norm(a)) + sq(norm(b)) - 2*a*b


decl_type: formula
theory: vectors_2D
library: vectors
signature: nil
location: 448 2 455 18
body:
    bolzano_weierstrass: LEMMA
      FORALL (M:posnat,VS:[nat->Vect2]):
        (FORALL (i:nat): norm(VS(i))<=M)
        IMPLIES (EXISTS (ns:[nat->nat],acp:Vect2):
          (FORALL (j:nat): ns(j)>=j) AND
          (FORALL (epsil:posreal): EXISTS (K:posnat):
            FORALL (j:nat): j>=K IMPLIES norm(VS(ns(j))-acp)<epsil)
          AND norm(acp)<=M)


decl_type: tcc
theory: vectors_2D
library: vectors
signature: nil
location: 463 0 465 999
body:
  % Subtype TCC generated (at line 48, column 20) for  v * v
      % expected type  nnreal
  sqv_TCC1: OBLIGATION FORALL (v: Vector): v * v >= 0;


decl_type: tcc
theory: vectors_2D
library: vectors
signature: nil
location: 467 0 469 999
body:
  % Subtype TCC generated (at line 63, column 20) for  mk_vect2(1, 0)
      % expected type  Normalized
  iv_TCC1: OBLIGATION norm((# x := 1, y := 0 #)) = 1;


decl_type: tcc
theory: vectors_2D
library: vectors
signature: nil
location: 471 0 473 999
body:
  % Subtype TCC generated (at line 64, column 20) for  mk_vect2(0, 1)
      % expected type  Normalized
  jv_TCC1: OBLIGATION norm((# x := 0, y := 1 #)) = 1;


decl_type: tcc
theory: vectors_2D
library: vectors
signature: nil
location: 475 0 477 999
body:
  % Judgement subtype TCC generated (at line 113, column 5) for  norm(nzu)
      % expected type  posreal
  nz_norm_gt_0: OBLIGATION FORALL (nzu): norm(nzu) > 0;


decl_type: tcc
theory: vectors_2D
library: vectors
signature: nil
location: 479 0 481 999
body:
  % Judgement subtype TCC generated (at line 116, column 5) for  sqv(nzu)
      % expected type  posreal
  nz_sqv_gt_0: OBLIGATION FORALL (nzu): sqv(nzu) > 0;


decl_type: tcc
theory: vectors_2D
library: vectors
signature: nil
location: 483 0 486 999
body:
  % Judgement subtype TCC generated (at line 6, column 38) for
      % (# x := nza, y := b #)
      % expected type  Nz_vector
  nz_nvz_left: OBLIGATION FORALL (b, nza): (# x := nza, y := b #) /= zero;


decl_type: tcc
theory: vectors_2D
library: vectors
signature: nil
location: 488 0 491 999
body:
  % Judgement subtype TCC generated (at line 6, column 38) for
      % (# x := b, y := nza #)
      % expected type  Nz_vector
  nz_nvz_right: OBLIGATION FORALL (b, nza): (# x := b, y := nza #) /= zero;


decl_type: tcc
theory: vectors_2D
library: vectors
signature: nil
location: 493 0 495 999
body:
  % Judgement subtype TCC generated (at line 125, column 5) for  x
      % expected type  Nz_vector
  normalized_nz: OBLIGATION FORALL (x: Normalized): x /= zero;


decl_type: tcc
theory: vectors_2D
library: vectors
signature: nil
location: 497 0 499 999
body:
  % Judgement subtype TCC generated (at line 128, column 5) for  -nzu
      % expected type  Nz_vector
  neg_nzv: OBLIGATION FORALL (nzu): -nzu /= zero;


decl_type: tcc
theory: vectors_2D
library: vectors
signature: nil
location: 501 0 503 999
body:
  % Judgement subtype TCC generated (at line 131, column 5) for  nza * nzv
      % expected type  Nz_vector
  nz_nzv: OBLIGATION FORALL (nza, nzv): nza * nzv /= zero;


decl_type: tcc
theory: vectors_2D
library: vectors
signature: nil
location: 505 0 508 999
body:
  % Subtype TCC generated (at line 312, column 34) for  (1 / norm(nzv)) * nzv
      % expected type  Normalized
  caret_TCC1: OBLIGATION
    FORALL (nzv: Nz_vector): norm((1 / norm(nzv)) * nzv) = 1;


decl_type: formula
theory: distance_2D
library: vectors
signature: nil
location: 36 3 37 54
body:
     sq_dist_le   : LEMMA sq_dist(v1,v2) <= sq_dist(p1,p2) IMPLIES
                              dist(v1,v2) <= dist(p1,p2)        


decl_type: formula
theory: distance_2D
library: vectors
signature: nil
location: 39 3 40 54
body:
     sq_dist_lt   : LEMMA sq_dist(v1,v2) <  sq_dist(p1,p2) IMPLIES
                              dist(v1,v2) <  dist(p1,p2)        


decl_type: formula
theory: distance_2D
library: vectors
signature: nil
location: 46 3 47 64
body:
     sq_dist_dist : LEMMA sq(dist(p2,p0)) = sq(dist(p1,p0)) + sq(dist(p1,p2)) 
                                               - 2*(p1-p0)*(p1-p2) 


decl_type: function
theory: distance_2D
library: vectors
signature: [[Vect2, Vect2, Vect2] -> bool]
location: 68 3 69 75
body:
     on_segment?(p1,p2,p): bool = 
                  EXISTS (x : { y: nnreal | y <= 1}) : p = p1 + x * (p2 - p1) 


decl_type: formula
theory: lines_2D
library: vectors
signature: nil
location: 72 3 74 53
body:
     vel_from_tm_length  : LEMMA p1 /= p2 IMPLIES
                                   sq(norm(vel_from_tm(p1,p2,t))) =
                                   sq_dist(p1,p2)/sq(t)


decl_type: formula
theory: lines_2D
library: vectors
signature: nil
location: 84 3 85 79
body:
     vel_from_spd_lem: LEMMA p1 /= p2 IMPLIES
                       vel_from_spd(p1,p2,ps) = vel_from_tm(p1,p2,dist(p1,p2)/ps)


decl_type: formula
theory: lines_2D
library: vectors
signature: nil
location: 88 3 89 73
body:
     vel_from_spd_norm: LEMMA p1 /= p2 IMPLIES
                                 vel_from_spd(p1,p2,s) = s*normalize(p2-p1)


decl_type: formula
theory: lines_2D
library: vectors
signature: nil
location: 117 3 117 112
body:
     on_line_lem: LEMMA FORALL (p2:{v|v /= p1}): on_line?(p1, line_from(p1,p2)) AND on_line?(p2, line_from(p1,p2))


decl_type: formula
theory: lines_2D
library: vectors
signature: nil
location: 121 3 121 114
body:
     on_line_sym: LEMMA FORALL (p2:{v|v /= p1}): on_line?(p, line_from(p1,p2)) IMPLIES on_line?(p, line_from(p2,p1)) 


decl_type: formula
theory: lines_2D
library: vectors
signature: nil
location: 139 3 141 61
body:
     vel_from_spd_on_line: LEMMA  LET vv = vel_from_spd(p1,p2,s) IN 
                                    p = p1 + t*vv 
                                      IMPLIES on_line?(p1,p2,p) 


decl_type: type
theory: lines_2D
library: vectors
signature: nil
location: 27 3 28 34
body:
     Line : TYPE = [# p: Vect2,        % point on the line| position at time 0
                      v: Nz_vect2 #]   % direction vector | velocity vector


decl_type: function
theory: lines_2D
library: vectors
signature: [[Vect2, Vect2, posreal] -> Vect2]
location: 80 3 82 40
body:
     vel_from_spd(p1,p2,s):  Vect2 = IF p1 = p2 then zero
                                     ELSE s/dist(p1,p2)*(p2-p1)
                                     ENDIF


decl_type: function
theory: lines_2D
library: vectors
signature: [[Vect2, Line] -> bool]
location: 110 3 111 72
body:
     on_segment?(p,L): bool =
                  EXISTS (x : { y: nnreal | y <= 1}) : p = p(L) + x * v(L)


decl_type: function
theory: lines_2D
library: vectors
signature: [[p1: Vect2, {v | v /= p1}, nzreal] -> Line]
location: 126 3 127 64
body:
     gen_line_tm(p1,(p2:{v| v /= p1}),t) : Line = (# p := p1,
                                      v := vel_from_tm(p1,p2,t) #)


decl_type: function
theory: lines_2D
library: vectors
signature: [[p1: Vect2, {v | v /= p1}, posreal] -> Line]
location: 129 3 130 65
body:
     gen_line_spd(p1,(p2:{v| v /= p1}),s): Line = (# p := p1,
                                      v := vel_from_spd(p1,p2,s) #)


decl_type: tcc
theory: lines_2D
library: vectors
signature: nil
location: 152 0 155 999
body:
  % Subtype TCC generated (at line 51, column 35) for  p2 - p1
      % expected type  Nz_vect2
  line_from_TCC1: OBLIGATION
    FORALL (p1: Vect2, (p2: {v | v /= p1})): p2 - p1 /= zero;


decl_type: tcc
theory: lines_2D
library: vectors
signature: nil
location: 157 0 161 999
body:
  % Subtype TCC generated (at line 60, column 49) for  1 / t * (p2 - p1)
      % expected type  {v | p2 = p1 + t * v}
  vel_from_tm_TCC1: OBLIGATION
    FORALL (p1: Vect2, p2: Vect2, t: nzreal):
      p2 = p1 + t * (1 / t * (p2 - p1));


decl_type: tcc
theory: lines_2D
library: vectors
signature: nil
location: 163 0 167 999
body:
  % Subtype TCC generated (at line 62, column 52) for  vel_from_tm(p1, p2, t)
      % expected type  Nz_vect2
  line_from_tm_TCC1: OBLIGATION
    FORALL (p1: Vect2, (p2: {v | v /= p1}), t: nzreal):
      vel_from_tm(p1, p2, t) /= zero;


decl_type: tcc
theory: lines_2D
library: vectors
signature: nil
location: 169 0 172 999
body:
  % Subtype TCC generated (at line 81, column 42) for  dist(p1, p2)
      % expected type  nznum
  vel_from_spd_TCC1: OBLIGATION
    FORALL (p1: Vect2, p2: Vect2): NOT p1 = p2 IMPLIES dist(p1, p2) /= 0;


decl_type: tcc
theory: lines_2D
library: vectors
signature: nil
location: 174 0 178 999
body:
  % Subtype TCC generated (at line 85, column 64) for  dist(p1, p2) / ps
      % expected type  nzreal
  vel_from_spd_lem_TCC1: OBLIGATION
    FORALL (p1, p2: Vect2, ps: posreal):
      p1 /= p2 IMPLIES dist(p1, p2) / ps /= 0;


decl_type: tcc
theory: lines_2D
library: vectors
signature: nil
location: 180 0 183 999
body:
  % Subtype TCC generated (at line 89, column 67) for  p2 - p1
      % expected type  Nz_vector
  vel_from_spd_norm_TCC1: OBLIGATION
    FORALL (p1, p2: Vect2): p1 /= p2 IMPLIES p2 - p1 /= zero;


decl_type: tcc
theory: lines_2D
library: vectors
signature: nil
location: 185 0 191 999
body:
  % Existence TCC generated (at line 92, column 3) for
      % gen_speed(p1, p2, pt): {s1: nnreal | s1 = 1 / pt * dist(p1, p2)}
  gen_speed_TCC1: OBLIGATION
    EXISTS (x:
              [d: [Vect2, Vect2, posreal] ->
                 {s1: nnreal | s1 = 1 / d`3 * dist(d`1, d`2)}]):
      TRUE;


decl_type: tcc
theory: lines_2D
library: vectors
signature: nil
location: 193 0 197 999
body:
  % Subtype TCC generated (at line 121, column 110) for  p1
      % expected type  {v | v /= p2}
  on_line_sym_TCC1: OBLIGATION
    FORALL (p, p1: Vect2, p2: {v | v /= p1}):
      on_line?(p, line_from(p1, p2)) IMPLIES p1 /= p2;


decl_type: tcc
theory: lines_2D
library: vectors
signature: nil
location: 199 0 204 999
body:
  % Subtype TCC generated (at line 130, column 41) for
      % vel_from_spd(p1, p2, s)
      % expected type  Nz_vect2
  gen_line_spd_TCC1: OBLIGATION
    FORALL (p1: Vect2, (p2: {v | v /= p1}), s: posreal):
      vel_from_spd(p1, p2, s) /= zero;


decl_type: tcc
theory: lines_2D
library: vectors
signature: nil
location: 206 0 208 999
body:
  % Subtype TCC generated (at line 133, column 60) for  p2
      % expected type  {v | v /= p1}
  test1_TCC1: OBLIGATION FORALL (p1, p2: Vect2): p1 /= p2 IMPLIES p2 /= p1;


decl_type: formula
theory: perpendicular_2D
library: vectors
signature: nil
location: 115 3 119 46
body:
     perp_is_normal: LEMMA tp = perp_pt(Q,P0,nzv) 
                             IMPLIES
                                LET c = (P0 + tp*nzv) - Q,
                                    del = (t-tp)*nzv       IN
                                       del*c = 0


decl_type: formula
theory: perpendicular_2D
library: vectors
signature: nil
location: 122 3 126 46
body:
     perp_is_min: LEMMA tp = perp_pt(Q,P0,nzv) 
                        IMPLIES
                            LET d = (P0 + t*nzv) - Q,
                                c = (P0 + tp*nzv) - Q  IN
                              norm(d) >= norm(c) 


decl_type: formula
theory: perpendicular_2D
library: vectors
signature: nil
location: 128 3 132 48
body:
     perp_gt_del: LEMMA tp = perp_pt(Q,P0,nzv) 
                         IMPLIES
                            LET d = (P0 + t*nzv) - Q,
                                del = (t-tp)*nzv   IN
                              norm(d) >= norm(del) 


decl_type: formula
theory: perpendicular_2D
library: vectors
signature: nil
location: 135 3 140 62
body:
     perp_comps: LEMMA tp = perp_pt(Q,P0,nzv) 
                       IMPLIES
                          LET d = (P0 + t*nzv) - Q,
                              c = (P0 + tp*nzv) - Q,
                              del = (t-tp)*nzv   IN
                       sq(norm(d)) = sq(norm(del)) + sq(norm(c)) 


decl_type: formula
theory: perpendicular_2D
library: vectors
signature: nil
location: 163 3 165 76
body:
     perp_pt_perp: LEMMA q /= p(L) + perp_pt(q,L)*v(L) IMPLIES
                          perpendicular?(L,line_from(q,p(L) 
                                                         + perp_pt(q,L)*v(L)))


decl_type: function
theory: perpendicular_2D
library: vectors
signature: [[Vect2, Line] -> nnreal]
location: 154 3 155 53
body:
     dist(q,L): nnreal =  LET tp = perp_pt(q,L) IN
                                 dist(p(L) + tp*v(L),q)


decl_type: tcc
theory: perpendicular_2D
library: vectors
signature: nil
location: 178 0 180 999
body:
  % Judgement subtype TCC generated (at line 105, column 5) for  perpL(nzv)
      % expected type  Nz_vect2
  perpL_nz: OBLIGATION FORALL (nzv): perpL(nzv) /= zero;


decl_type: tcc
theory: perpendicular_2D
library: vectors
signature: nil
location: 182 0 184 999
body:
  % Judgement subtype TCC generated (at line 108, column 5) for  perpR(nzv)
      % expected type  Nz_vect2
  perpR_nz: OBLIGATION FORALL (nzv): perpR(nzv) /= zero;


decl_type: tcc
theory: perpendicular_2D
library: vectors
signature: nil
location: 186 0 188 999
body:
  % Subtype TCC generated (at line 113, column 41) for  (nzv * nzv)
      % expected type  nznum
  perp_pt_TCC1: OBLIGATION FORALL (nzv: Nz_vect2): (nzv * nzv) /= 0;


decl_type: tcc
theory: perpendicular_2D
library: vectors
signature: nil
location: 190 0 192 999
body:
  % Subtype TCC generated (at line 152, column 39) for  (v(L) * v(L))
      % expected type  nznum
  perp_pt_TCC2: OBLIGATION FORALL (L: Line): (v(L) * v(L)) /= 0;


decl_type: tcc
theory: perpendicular_2D
library: vectors
signature: nil
location: 194 0 200 999
body:
  % Subtype TCC generated (at line 164, column 53) for
      % p(L) + perp_pt(q, L) * v(L)
      % expected type  {v | v /= q}
  perp_pt_perp_TCC1: OBLIGATION
    FORALL (L: Line, q: Vect2):
      q /= p(L) + perp_pt(q, L) * v(L) IMPLIES
       p(L) + perp_pt(q, L) * v(L) /= q;


decl_type: formula
theory: basis_2D
library: vectors
signature: nil
location: 17 3 21 50
body:
     orthogonal_basis: LEMMA
       e1 /= zero AND
       e2 /= zero AND
       orthogonal?(e1,e2) IMPLIES
       w = ((w*e1)/sqv(e1))*e1 + ((w*e2)/sqv(e2))*e2


decl_type: formula
theory: basis_2D
library: vectors
signature: nil
location: 27 3 29 30
body:
     orthonormal_basis: LEMMA FORALL (w:Vect2):
       orthonormal?(e1,e2) IMPLIES
       w = (w*e1)*e1 + (w*e2)*e2


decl_type: formula
theory: basis_2D
library: vectors
signature: nil
location: 31 3 34 33
body:
     basis_two_dot_zero: LEMMA
       w /= zero AND e1 /= zero AND w*e1 = 0 AND w*e2 = 0
       IMPLIES
       (EXISTS (c:real): c*e1 = e2)


decl_type: formula
theory: basis_2D
library: vectors
signature: nil
location: 36 3 41 46
body:
     basis_add: LEMMA
       %% orthonormal?(e1,e2) AND
       w1 = (w1*e1)*e1 + (w1*e2)*e2 AND
       w2 = (w2*e1)*e1 + (w2*e2)*e2
     IMPLIES 
       w1+w2 = ((w1+w2)*e1)*e1 + ((w1+w2)*e2)*e2


decl_type: formula
theory: basis_2D
library: vectors
signature: nil
location: 43 3 48 46
body:
     basis_sub: LEMMA
       %% orthonormal?(e1,e2) AND
       w1 = (w1*e1)*e1 + (w1*e2)*e2 AND
       w2 = (w2*e1)*e1 + (w2*e2)*e2
     IMPLIES 
       w1-w2 = ((w1-w2)*e1)*e1 + ((w1-w2)*e2)*e2


decl_type: formula
theory: basis_2D
library: vectors
signature: nil
location: 50 3 54 30
body:
     basis_sqv: LEMMA FORALL (a,b: real,w: Vect2):
       orthonormal?(e1,e2) AND
       w = (a)*e1 + (b)*e2
       IMPLIES
          sqv(w) = sq(a) + sq(b)


decl_type: formula
theory: basis_2D
library: vectors
signature: nil
location: 56 3 61 23
body:
     basis_dot: LEMMA  FORALL (a,b,c,d: real):
       orthonormal?(e1,e2) IMPLIES
       LET s = (a)*e1 + (b)*e2,
           v = (c)*e1 + (d)*e2
       IN
          s*v = a*c + b*d


decl_type: formula
theory: basis_2D
library: vectors
signature: nil
location: 66 3 70 32
body:
     basis_perpR: LEMMA  FORALL (a,b: real):
       LET e2 = perpR(e1),
           s = (a)*e1 + (b)*e2
       IN
          perpR(s) = (a)*e2 - b*e1


decl_type: formula
theory: basis_2D
library: vectors
signature: nil
location: 72 3 77 26
body:
     vh_vp_orthon: LEMMA FORALL (v: Nz_vect2):
       LET
         vh = ^(v),
         vp = perpR(vh)
       IN
        orthonormal?(vh, vp)


decl_type: formula
theory: basis_2D
library: vectors
signature: nil
location: 79 2 82 44
body:
    orthogonal_basis_sqv: LEMMA
      orthogonal?(e1,e2) AND
      w = a1*e1 + a2*e2 IMPLIES
      sqv(w) = sq(a1)*sqv(e1) + sq(a2)*sqv(e2)


decl_type: formula
theory: basis_2D
library: vectors
signature: nil
location: 84 2 87 28
body:
    orthonormal_basis_sqv: LEMMA
      orthonormal?(e1,e2) AND
      w = a1*e1 + a2*e2 IMPLIES
      sqv(w) = sq(a1) + sq(a2)


decl_type: formula
theory: basis_2D
library: vectors
signature: nil
location: 89 2 92 51
body:
    orthogonal_basis_norm: LEMMA
      orthogonal?(e1,e2) AND
      w = a1*e1 + a2*e2 IMPLIES
      norm(w) = sqrt(sq(a1)*sqv(e1) + sq(a2)*sqv(e2))


decl_type: formula
theory: basis_2D
library: vectors
signature: nil
location: 94 2 97 35
body:
    orthonormal_basis_norm: LEMMA
      orthonormal?(e1,e2) AND
      w = a1*e1 + a2*e2 IMPLIES
      norm(w) = sqrt(sq(a1) + sq(a2))


decl_type: formula
theory: basis_2D
library: vectors
signature: nil
location: 99 2 102 31
body:
    orthogonal_basis_norm_ge: LEMMA
      orthogonal?(e1,e2) AND
      w = a1*e1 + a2*e2 IMPLIES
      norm(w) >= abs(a1)*norm(e1)


decl_type: formula
theory: basis_2D
library: vectors
signature: nil
location: 104 2 107 22
body:
    orthonormal_basis_norm_ge: LEMMA
      orthonormal?(e1,e2) AND
      w = a1*e1 + a2*e2 IMPLIES
      norm(w) >= abs(a1)


decl_type: formula
theory: basis_2D
library: vectors
signature: nil
location: 109 2 113 45
body:
    orthogonal_basis_dot: LEMMA
      orthogonal?(e1,e2) AND
      w1 = a1*e1 + a2*e2 AND
      w2 = b1*e1 + b2*e2 IMPLIES
      w1*w2 = (a1*b1)*sqv(e1) + (a2*b2)*sqv(e2)


decl_type: formula
theory: basis_2D
library: vectors
signature: nil
location: 115 2 119 25
body:
    orthonormal_basis_dot: LEMMA
      orthonormal?(e1,e2) AND
      w1 = a1*e1 + a2*e2 AND
      w2 = b1*e1 + b2*e2 IMPLIES
      w1*w2 = a1*b1 + a2*b2


decl_type: function
theory: basis_2D
library: vectors
signature: [[Vect2, Vect2] -> bool]
location: 23 3 25 32
body:
     orthonormal?(e1,e2): bool =  
       orthogonal?(e1,e2) AND e1 /= zero AND norm(e1) = 1 AND
       e2 /= zero AND norm(e2) = 1


decl_type: tcc
theory: basis_2D
library: vectors
signature: nil
location: 128 0 132 999
body:
  % Subtype TCC generated (at line 21, column 17) for  sqv(e1)
      % expected type  nznum
  orthogonal_basis_TCC1: OBLIGATION
    FORALL (e1, e2: Vect2):
      orthogonal?(e1, e2) AND e2 /= zero AND e1 /= zero IMPLIES sqv(e1) /= 0;


decl_type: tcc
theory: basis_2D
library: vectors
signature: nil
location: 134 0 138 999
body:
  % Subtype TCC generated (at line 21, column 39) for  sqv(e2)
      % expected type  nznum
  orthogonal_basis_TCC2: OBLIGATION
    FORALL (e1, e2: Vect2):
      orthogonal?(e1, e2) AND e2 /= zero AND e1 /= zero IMPLIES sqv(e2) /= 0;


decl_type: formula
theory: linear_transformations_2D
library: vectors
signature: nil
location: 33 2 35 48
body:
    linear_transform_scal: LEMMA
      linear_transform?(L) IMPLIES 
      FORALL (u: Vector, a: real): L(a*u) = a*L(u)


decl_type: formula
theory: linear_transformations_2D
library: vectors
signature: nil
location: 37 2 39 46
body:
    linear_transform_add: LEMMA
      linear_transform?(L) IMPLIES
      FORALL (u,v: Vector): L(u+v) = L(u) + L(v)


decl_type: formula
theory: linear_transformations_2D
library: vectors
signature: nil
location: 41 2 43 46
body:
    linear_transform_sub: LEMMA
      linear_transform?(L) IMPLIES
      FORALL (u,v: Vector): L(u-v) = L(u) - L(v)


decl_type: formula
theory: linear_transformations_2D
library: vectors
signature: nil
location: 47 2 49 50
body:
    linear_transform_rew: LEMMA linear_transform?(L) IFF
      (FORALL (u,v: Vector): L(u+v) = L(u) + L(v)) AND
      (FORALL (u: Vector, a: real): L(a*u) = a*L(u))


decl_type: formula
theory: linear_transformations_2D
library: vectors
signature: nil
location: 51 2 52 70
body:
    linear_transform_alt_left: LEMMA linear_transform?(L) IFF
      FORALL (u,v: Vector): FORALL (a: real): L(a*u + v) = a*L(u) + L(v)


decl_type: formula
theory: linear_transformations_2D
library: vectors
signature: nil
location: 54 2 55 68
body:
    linear_transform_alt_right: LEMMA linear_transform?(L) IFF
      FORALL (u,v: Vector): FORALL (a: real): L(u+a*v) = L(u) + a*L(v)


decl_type: formula
theory: linear_transformations_2D
library: vectors
signature: nil
location: 59 2 66 9
body:
    linear_transform_perp_unique: LEMMA u /= zero AND v /= zero AND
      linear_transform?(L) AND
      linear_transform?(J) AND
      orthogonal?(u,v) AND
      L(u) = J(u) AND
      L(v) = J(v)
      IMPLIES
      L = J


decl_type: formula
theory: linear_transformations_2D
library: vectors
signature: nil
location: 84 2 86 48
body:
    linear_functional_scal: LEMMA
      linear_functional?(F) IMPLIES 
      FORALL (u: Vector, a: real): F(a*u) = a*F(u)


decl_type: formula
theory: linear_transformations_2D
library: vectors
signature: nil
location: 88 2 90 46
body:
    linear_functional_add: LEMMA
      linear_functional?(F) IMPLIES
      FORALL (u,v: Vector): F(u+v) = F(u) + F(v)


decl_type: formula
theory: linear_transformations_2D
library: vectors
signature: nil
location: 92 2 94 46
body:
    linear_functional_sub: LEMMA
      linear_functional?(F) IMPLIES
      FORALL (u,v: Vector): F(u-v) = F(u) - F(v)


decl_type: formula
theory: linear_transformations_2D
library: vectors
signature: nil
location: 96 2 98 46
body:
    kernel_functional_nonempty: LEMMA
      linear_functional?(F) IMPLIES
      EXISTS (v: Vector): v /= zero AND F(v) = 0


decl_type: formula
theory: linear_transformations_2D
library: vectors
signature: nil
location: 100 2 102 53
body:
    linear_functional_is_dot: LEMMA
      linear_functional?(F) IMPLIES
      EXISTS (w: Vector): F = (LAMBDA (v: Vector): w*v)


decl_type: formula
theory: linear_transformations_2D
library: vectors
signature: nil
location: 106 2 108 50
body:
    linear_functional_rew: LEMMA linear_functional?(F) IFF
      (FORALL (u,v: Vector): F(u+v) = F(u) + F(v)) AND
      (FORALL (u: Vector, a: real): F(a*u) = a*F(u))


decl_type: formula
theory: linear_transformations_2D
library: vectors
signature: nil
location: 110 2 111 70
body:
    linear_functional_alt_left: LEMMA linear_functional?(F) IFF
      FORALL (u,v: Vector): FORALL (a: real): F(a*u + v) = a*F(u) + F(v)


decl_type: formula
theory: linear_transformations_2D
library: vectors
signature: nil
location: 113 2 114 68
body:
    linear_functional_alt_right: LEMMA linear_functional?(F) IFF
      FORALL (u,v: Vector): FORALL (a: real): F(u+a*v) = F(u) + a*F(v)


decl_type: formula
theory: linear_transformations_2D
library: vectors
signature: nil
location: 118 2 125 9
body:
    linear_functional_perp_unique: LEMMA u /= zero AND v /= zero AND
      linear_functional?(F) AND
      linear_functional?(G) AND
      orthogonal?(u,v) AND
      F(u) = G(u) AND
      F(v) = G(v)
      IMPLIES
      F = G


decl_type: formula
theory: linear_transformations_2D
library: vectors
signature: nil
location: 127 2 132 64
body:
    linear_functional_is_perp_dot: LEMMA
      linear_functional?(F) AND 
      u/=zero AND
      F(u) = 0
      IMPLIES
      (EXISTS (rzk: real): F = (LAMBDA (v: Vector): rzk*det(v,u)))


decl_type: formula
theory: linear_transformations_2D
library: vectors
signature: nil
location: 134 2 141 38
body:
    linear_functional_perp_signs_unique: LEMMA v /= zero AND
      linear_functional?(F) AND
      linear_functional?(G) AND
      F(u)*G(u) > 0 AND
      F(v) = 0 AND
      G(v) = 0
      IMPLIES
      FORALL (w: Vector): F(w)*G(w) >= 0


decl_type: function
theory: linear_transformations_2D
library: vectors
signature: [[Vector -> Vector] -> bool]
location: 25 2 26 74
body:
    linear_transform?(L): bool = 
      FORALL (u,v: Vector): FORALL (a,b: real): L(a*u+b*v) = a*L(u) + b*L(v)


decl_type: function
theory: linear_transformations_2D
library: vectors
signature: [[Vector -> real] -> bool]
location: 76 2 77 74
body:
    linear_functional?(F): bool = 
      FORALL (u,v: Vector): FORALL (a,b: real): F(a*u+b*v) = a*F(u) + b*F(v)


decl_type: tcc
theory: vect3_fun_ops
library: vectors
signature: nil
location: 56 0 59 999
body:
  % Subtype TCC generated (at line 34, column 57) for  n
      % expected type  {i: int | f(v) /= 0 OR i >= 0}
  caret_TCC1: OBLIGATION
    FORALL (f: [Vect3 -> real], n: nat, v: Vect3): f(v) /= 0 OR n >= 0;


decl_type: tcc
theory: vect2_fun_ops
library: vectors
signature: nil
location: 56 0 59 999
body:
  % Subtype TCC generated (at line 34, column 57) for  n
      % expected type  {i: int | f(v) /= 0 OR i >= 0}
  caret_TCC1: OBLIGATION
    FORALL (f: [Vect2 -> real], n: nat, v: Vect2): f(v) /= 0 OR n >= 0;


decl_type: tcc
theory: vect_fun_ops
library: vectors
signature: nil
location: 56 0 60 999
body:
  % Subtype TCC generated (at line 34, column 59) for  m
      % expected type  {i: int | f(v) /= 0 OR i >= 0}
  caret_TCC1: OBLIGATION
    FORALL (f: [Vector[n] -> real], m: nat, v: Vector[n]):
      f(v) /= 0 OR m >= 0;


decl_type: function
theory: ECEF
library: vectors
signature: [[posreal, real, real] -> Nz_vect3]
location: 15 2 21 14
body:
    spherical2xyz(r,lat,lon): Nz_vect3 =   % Convert LatLon to ECEF
      LET theta = pi/2 - lat,
          phi   = pi-lon,
          x     = r*sin(theta)*cos(phi),
          y     = r*sin(theta)*sin(phi),
          z     = r*cos(theta)
      IN (x,y,z)


decl_type: tcc
theory: ECEF
library: vectors
signature: nil
location: 31 0 47 999
body:
  % Subtype TCC generated (at line 16, column 4) for
      % mk_vect3(LET theta = pi / 2 - lat,
      %              phi = pi - lon,
      %              x = r * sin(theta) * cos(phi),
      %              y = r * sin(theta) * sin(phi),
      %              z = r * cos(theta)
      %            IN (x, y, z))
      % expected type  Nz_vect3
  spherical2xyz_TCC1: OBLIGATION
    FORALL (r: posreal, lat: real, lon: real):
      mk_vect3(LET theta = pi / 2 - lat,
                   phi = pi - lon,
                   x = r * sin(theta) * cos(phi),
                   y = r * sin(theta) * sin(phi),
                   z = r * cos(theta)
                 IN (x, y, z))
       /= zero;


decl_type: tcc
theory: ECEF
library: vectors
signature: nil
location: 49 0 95 999
body:
  % Subtype TCC generated (at line 8, column 41) for
      % (# x
      %      := (LET theta = pi / 2 - lat,
      %              phi = pi - lon,
      %              x = r * sin(theta) * cos(phi),
      %              y = r * sin(theta) * sin(phi),
      %              z = r * cos(theta)
      %            IN (x, y, z))`1,
      %    y
      %      := (LET theta = pi / 2 - lat,
      %              phi = pi - lon,
      %              x = r * sin(theta) * cos(phi),
      %              y = r * sin(theta) * sin(phi),
      %              z = r * cos(theta)
      %            IN (x, y, z))`2,
      %    z
      %      := (LET theta = pi / 2 - lat,
      %              phi = pi - lon,
      %              x = r * sin(theta) * cos(phi),
      %              y = r * sin(theta) * sin(phi),
      %              z = r * cos(theta)
      %            IN (x, y, z))`3 #)
      % expected type  Nz_vect3
  spherical2xyz_TCC2: OBLIGATION
    FORALL (r: posreal, lat: real, lon: real):
      (# x
           := (LET theta = pi / 2 - lat,
                   phi = pi - lon,
                   x = r * sin(theta) * cos(phi),
                   y = r * sin(theta) * sin(phi),
                   z = r * cos(theta)
                 IN (x, y, z))`1,
         y
           := (LET theta = pi / 2 - lat,
                   phi = pi - lon,
                   x = r * sin(theta) * cos(phi),
                   y = r * sin(theta) * sin(phi),
                   z = r * cos(theta)
                 IN (x, y, z))`2,
         z
           := (LET theta = pi / 2 - lat,
                   phi = pi - lon,
                   x = r * sin(theta) * cos(phi),
                   y = r * sin(theta) * sin(phi),
                   z = r * cos(theta)
                 IN (x, y, z))`3 #)
       /= zero;


decl_type: formula
theory: cross_3D
library: vectors
signature: nil
location: 55 3 61 3
body:
     lin_indep_cross: LEMMA 
       linearly_dependent?(nzu,nzv) IFF cross(nzu,nzv) = zero
   
    % ------------ mixed product ------------
    % ------------ aka triple product, aka determinant of vectors a, b, c

    ;[||](u,v,w): real = u*cross(v,w)


decl_type: formula
theory: cross_3D
library: vectors
signature: nil
location: 77 2 78 55
body:
    cross_cross_mixed   : LEMMA cross(cross(u,v),cross(w,z)) = 
                                [|u,v,z|]*w - [|u,v,w|]*z


decl_type: function
theory: cross_3D
library: vectors
signature: [[Vect3, Vect3] -> Vector]
location: 26 2 28 42
body:
    cross(u,v): Vector = (u`y*v`z - v`y*u`z,
                          u`z*v`x - v`z*u`x,
                          u`x*v`y - v`x*u`y)


decl_type: function
theory: cross_3D
library: vectors
signature: [[Vect3, Vect3] -> bool]
location: 48 3 50 50
body:
     linearly_dependent?(u,v): bool = 
         (EXISTS (k1,k2: real): (k1 /= 0 OR k2 /= 0) AND
                                 k1*u + k2*v = zero)


decl_type: formula
theory: distance_3D
library: vectors
signature: nil
location: 36 3 37 54
body:
     sq_dist_le   : LEMMA sq_dist(v1,v2) <= sq_dist(p1,p2) IMPLIES
                              dist(v1,v2) <= dist(p1,p2)          


decl_type: formula
theory: distance_3D
library: vectors
signature: nil
location: 39 3 40 54
body:
     sq_dist_lt   : LEMMA sq_dist(v1,v2) <  sq_dist(p1,p2) IMPLIES
                              dist(v1,v2) <  dist(p1,p2)          


decl_type: formula
theory: distance_3D
library: vectors
signature: nil
location: 48 3 49 64
body:
     sq_dist_dist : LEMMA sq(dist(p2,p0)) = sq(dist(p1,p0)) + sq(dist(p1,p2)) 
                                               - 2*(p1-p0)*(p1-p2)


decl_type: formula
theory: lines_3D
library: vectors
signature: nil
location: 72 3 73 53
body:
     vel_from_tm_length  : LEMMA sq(norm(vel_from_tm(p1,p2,t))) =
                                   sq_dist(p1,p2)/sq(t)


decl_type: type
theory: lines_3D
library: vectors
signature: nil
location: 27 3 28 34
body:
     Line : Type = [# p: Vect3,        % point on the line| position at time 0
                      v: Nz_vect3 #]   % direction vector | velocity vector


decl_type: function
theory: lines_3D
library: vectors
signature: [[Vect3, Vect3, posreal] -> Vect3]
location: 79 3 81 40
body:
     vel_from_spd(p1,p2,s):  Vect3 = IF p1 = p2 then zero
                                     ELSE s/dist(p1,p2)*(p2-p1)
                                     ENDIF


decl_type: tcc
theory: lines_3D
library: vectors
signature: nil
location: 150 0 153 999
body:
  % Subtype TCC generated (at line 53, column 47) for  vec_from(p1, p2)
      % expected type  Nz_vect3
  line_from_TCC1: OBLIGATION
    FORALL (p1: Vect3, (p2: {v | v /= p1})): vec_from(p1, p2) /= zero;


decl_type: tcc
theory: lines_3D
library: vectors
signature: nil
location: 155 0 159 999
body:
  % Subtype TCC generated (at line 60, column 49) for  1 / t * (p2 - p1)
      % expected type  {v | p2 = p1 + t * v}
  vel_from_tm_TCC1: OBLIGATION
    FORALL (p1: Vect3, p2: Vect3, t: nzreal):
      p2 = p1 + t * (1 / t * (p2 - p1));


decl_type: tcc
theory: lines_3D
library: vectors
signature: nil
location: 161 0 165 999
body:
  % Subtype TCC generated (at line 62, column 52) for  vel_from_tm(p1, p2, t)
      % expected type  Nz_vect3
  line_from_tm_TCC1: OBLIGATION
    FORALL (p1: Vect3, (p2: {v | v /= p1}), t: nzreal):
      vel_from_tm(p1, p2, t) /= zero;


decl_type: tcc
theory: lines_3D
library: vectors
signature: nil
location: 167 0 170 999
body:
  % Subtype TCC generated (at line 80, column 42) for  dist(p1, p2)
      % expected type  nznum
  vel_from_spd_TCC1: OBLIGATION
    FORALL (p1: Vect3, p2: Vect3): NOT p1 = p2 IMPLIES dist(p1, p2) /= 0;


decl_type: tcc
theory: lines_3D
library: vectors
signature: nil
location: 172 0 176 999
body:
  % Subtype TCC generated (at line 84, column 64) for  dist(p1, p2) / ps
      % expected type  nzreal
  vel_from_spd_lem_TCC1: OBLIGATION
    FORALL (p1, p2: Vect3, ps: posreal):
      p1 /= p2 IMPLIES dist(p1, p2) / ps /= 0;


decl_type: tcc
theory: lines_3D
library: vectors
signature: nil
location: 178 0 181 999
body:
  % Subtype TCC generated (at line 88, column 67) for  p2 - p1
      % expected type  Nz_vector
  vel_from_spd_norm_TCC1: OBLIGATION
    FORALL (p1, p2: Vect3): p1 /= p2 IMPLIES p2 - p1 /= zero;


decl_type: tcc
theory: lines_3D
library: vectors
signature: nil
location: 183 0 190 999
body:
  % Existence TCC generated (at line 91, column 3) for
      % gen_speed(p1, (p2: {v | v /= p1}), pt):
      %       {s1: nnreal | s1 = 1 / pt * dist(p1, p2)}
  gen_speed_TCC1: OBLIGATION
    EXISTS (x:
              [d: [p1: Vect3, {v | v /= p1}, posreal] ->
                 {s1: nnreal | s1 = 1 / d`3 * dist(d`1, d`2)}]):
      TRUE;


decl_type: tcc
theory: lines_3D
library: vectors
signature: nil
location: 192 0 196 999
body:
  % Subtype TCC generated (at line 120, column 110) for  p1
      % expected type  {v | v /= p2}
  on_line_sym_TCC1: OBLIGATION
    FORALL (p, p1: Vect3, p2: {v | v /= p1}):
      on_line?(p, line_from(p1, p2)) IMPLIES p1 /= p2;


decl_type: tcc
theory: lines_3D
library: vectors
signature: nil
location: 198 0 203 999
body:
  % Subtype TCC generated (at line 128, column 41) for
      % vel_from_spd(p1, p2, s)
      % expected type  Nz_vect3
  gen_line_spd_TCC1: OBLIGATION
    FORALL (p1: Vect3, (p2: {v | v /= p1}), s: posreal):
      vel_from_spd(p1, p2, s) /= zero;


decl_type: tcc
theory: lines_3D
library: vectors
signature: nil
location: 205 0 207 999
body:
  % Subtype TCC generated (at line 131, column 60) for  p2
      % expected type  {v | v /= p1}
  test1_TCC1: OBLIGATION FORALL (p1, p2: Vect3): p1 /= p2 IMPLIES p2 /= p1;


decl_type: formula
theory: perpendicular_3D
library: vectors
signature: nil
location: 43 4 47 46
body:
      perp_is_normal: LEMMA tp = perp_pt(Q,P0,nzv) 
                             IMPLIES
                                LET c = (P0 + tp*nzv) - Q,
                                    del = (t-tp)*nzv       IN
                                       del*c = 0


decl_type: formula
theory: perpendicular_3D
library: vectors
signature: nil
location: 50 4 54 47
body:
      perp_is_min: LEMMA tp = perp_pt(Q,P0,nzv) 
                         IMPLIES
                             LET d = (P0 + t*nzv) - Q,
                                 c = (P0 + tp*nzv) - Q  IN
                               norm(d) >= norm(c) 


decl_type: formula
theory: perpendicular_3D
library: vectors
signature: nil
location: 56 4 60 49
body:
      perp_gt_del: LEMMA tp = perp_pt(Q,P0,nzv) 
                          IMPLIES
                             LET d = (P0 + t*nzv) - Q,
                                 del = (t-tp)*nzv   IN
                               norm(d) >= norm(del) 


decl_type: formula
theory: perpendicular_3D
library: vectors
signature: nil
location: 63 4 68 63
body:
      perp_comps: LEMMA tp = perp_pt(Q, P0,nzv) 
                        IMPLIES
                           LET d = (P0 + t*nzv) - Q,
                               c = (P0 + tp*nzv) - Q,
                               del = (t-tp)*nzv   IN
                        sq(norm(d)) = sq(norm(del)) + sq(norm(c)) 


decl_type: formula
theory: perpendicular_3D
library: vectors
signature: nil
location: 91 4 93 76
body:
      perp_pt_perp: LEMMA q /= p(L) + perp_pt(q,L)*v(L) IMPLIES
                             perpendicular?(L,line_from(q,p(L) 
                                                         + perp_pt(q,L)*v(L)))


decl_type: function
theory: perpendicular_3D
library: vectors
signature: [[Vect3, Line] -> nnreal]
location: 82 4 83 54
body:
      dist(q,L): nnreal =  LET tp = perp_pt(q,L) IN
                                  dist(p(L) + tp*v(L),q)


decl_type: tcc
theory: perpendicular_3D
library: vectors
signature: nil
location: 106 0 108 999
body:
  % Subtype TCC generated (at line 41, column 42) for  (nzv * nzv)
      % expected type  nznum
  perp_pt_TCC1: OBLIGATION FORALL (nzv: Nz_vect3): (nzv * nzv) /= 0;


decl_type: tcc
theory: perpendicular_3D
library: vectors
signature: nil
location: 110 0 112 999
body:
  % Subtype TCC generated (at line 80, column 40) for  (v(L) * v(L))
      % expected type  nznum
  perp_pt_TCC2: OBLIGATION FORALL (L: Line): (v(L) * v(L)) /= 0;


decl_type: tcc
theory: perpendicular_3D
library: vectors
signature: nil
location: 114 0 120 999
body:
  % Subtype TCC generated (at line 92, column 56) for
      % p(L) + perp_pt(q, L) * v(L)
      % expected type  {v | v /= q}
  perp_pt_perp_TCC1: OBLIGATION
    FORALL (L: Line, q: Vect3):
      q /= p(L) + perp_pt(q, L) * v(L) IMPLIES
       p(L) + perp_pt(q, L) * v(L) /= q;


decl_type: formula
theory: vect3_basis
library: vectors
signature: nil
location: 25 3 27 62
body:
     vect3_orthog_toz_def: LEMMA orthogonal?(v,vect3_orthog_toz(v))
                                 AND
                                 orthogonal?(vect3_orthog_toy(v),vect3_orthog_toz(v))


decl_type: formula
theory: vect3_basis
library: vectors
signature: nil
location: 38 3 43 67
body:
     vect3_orthonorm_basis: LEMMA
       LET v = vect3_orthonorm_tox(nzv),
           u = vect3_orthonorm_toy(nzv),
           w = vect3_orthonorm_toz(nzv)
       IN
           orthogonal?(v,u) AND orthogonal?(u,w) AND orthogonal?(w,v)


decl_type: function
theory: vect3_basis
library: vectors
signature: [Vect3 -> Vect3]
location: 17 3 19 24
body:
     vect3_orthog_toy(v): Vect3 =
        IF v`x/=0 OR v`y /=0 THEN (v`y,-v`x,0)
        ELSE (1,0,0) ENDIF


decl_type: function
theory: vect3_basis
library: vectors
signature: [Nz_vect3 -> [Vect3 -> Vect3]]
location: 49 2 54 33
body:
    Equator_map(nzv)(w): Vect3 =
      LET xmult: Vect3 = vect3_orthonorm_tox(nzv),
          ymult: Vect3 = vect3_orthonorm_toy(nzv),
          zmult: Vect3 = vect3_orthonorm_toz(nzv)
      IN
          (xmult*w,ymult*w,zmult*w)


decl_type: function
theory: vect3_basis
library: vectors
signature: [Nz_vect3 -> [Vect3, Vect3, Vect3]]
location: 59 2 66 36
body:
    transpose_Equator_map(nzv): [Vect3,Vect3,Vect3] =
      LET xvect: Vect3 = vect3_orthonorm_tox(nzv),
          yvect: Vect3 = vect3_orthonorm_toy(nzv),
          zvect: Vect3 = vect3_orthonorm_toz(nzv),
          xmultinv: Vect3 = (xvect`x,yvect`x,zvect`x),
          ymultinv: Vect3 = (xvect`y,yvect`y,zvect`y),
          zmultinv: Vect3 = (xvect`z,yvect`z,zvect`z)
      IN  (xmultinv,ymultinv,zmultinv)


decl_type: function
theory: vect3_basis
library: vectors
signature: [Nz_vect3 -> [Vect3 -> Vect3]]
location: 68 2 76 42
body:
    Equator_map_inv(nzv)(w): Vect3 =
      LET xvect: Vect3 = vect3_orthonorm_tox(nzv),
          yvect: Vect3 = vect3_orthonorm_toy(nzv),
          zvect: Vect3 = vect3_orthonorm_toz(nzv),
          xmultinv: Vect3 = (xvect`x,yvect`x,zvect`x),
          ymultinv: Vect3 = (xvect`y,yvect`y,zvect`y),
          zmultinv: Vect3 = (xvect`z,yvect`z,zvect`z)
      IN
          (xmultinv*w,ymultinv*w,zmultinv*w)


decl_type: function
theory: vect3_basis
library: vectors
signature: [Nz_vect3 -> [Vect3 -> Vect2]]
location: 84 2 89 25
body:
    sphere_to_2D_plane(nzv)(w): Vect2 =
      LET xmult: Vect3 = vect3_orthonorm_tox(nzv),
          ymult: Vect3 = vect3_orthonorm_toy(nzv),
          zmult: Vect3 = vect3_orthonorm_toz(nzv)
      IN
          (ymult*w,zmult*w)


decl_type: tcc
theory: vect3_basis
library: vectors
signature: nil
location: 96 0 99 999
body:
  % Subtype TCC generated (at line 34, column 44) for  vect3_orthog_toy(nzv)
      % expected type  Nz_vector
  vect3_orthonorm_toy_TCC1: OBLIGATION
    FORALL (nzv: Nz_vect3): vect3_orthog_toy(nzv) /= zero;


decl_type: tcc
theory: vect3_basis
library: vectors
signature: nil
location: 101 0 104 999
body:
  % Subtype TCC generated (at line 36, column 44) for  vect3_orthog_toz(nzv)
      % expected type  Nz_vector
  vect3_orthonorm_toz_TCC1: OBLIGATION
    FORALL (nzv: Nz_vect3): vect3_orthog_toz(nzv) /= zero;


decl_type: formula
theory: angles_2D_scaf
library: vectors
signature: nil
location: 10 3 14 39
body:
     trig_prop2: LEMMA 
       cos(a) /= 0 AND u`x /= 0 AND sin(a) / cos(a) = u`y / u`x 
       IMPLIES
         sq(u`x) = sq(norm(u))*sq(cos(a))  AND 
         sq(u`y) = sq(norm(u))*sq(sin(a))  


decl_type: formula
theory: angles_2D_scaf
library: vectors
signature: nil
location: 16 3 20 54
body:
     trig_prop: LEMMA 
       cos(a) /= 0 AND u`x /= 0 AND sin(a) / cos(a) = u`y / u`x 
       IMPLIES
         sin(a) = u`y/norm(u) AND cos(a) = u`x/norm(u) OR
         sin(a) = -u`y/norm(u) AND cos(a) = -u`x/norm(u) 


decl_type: formula
theory: angles_2D_scaf
library: vectors
signature: nil
location: 25 3 28 31
body:
     sin_cos_angle: LEMMA 
       (pa*cos(alpha),pa*sin(alpha)) =(pb*cos(beta),pb*sin(beta)) 
       IMPLIES
         pa = pb AND alpha = beta 


decl_type: formula
theory: angles_2D
library: vectors
signature: nil
location: 45 3 46 68
body:
     angle_exists_x: LEMMA  (EXISTS (a: real): u`x = norm(u) * cos(a) AND
                                               u`y = norm(u) * sin(a))


decl_type: formula
theory: angles_2D
library: vectors
signature: nil
location: 56 3 58 57
body:
     angle_exists: LEMMA  (EXISTS (alpha: Angle): 
                                u`x = norm(u) * cos(alpha) AND
                                u`y = norm(u) * sin(alpha))


decl_type: formula
theory: angles_2D
library: vectors
signature: nil
location: 97 3 100 59
body:
     dot_prod_angles    : LEMMA LET s = v_from(c),
                                    nv = v_from(a),
                                    v = v_from(b) IN
                               s*(nv-v) = cos(a-c) - cos(b-c) 


decl_type: function
theory: angles_2D
library: vectors
signature: [u: Nz_vect2 -> {alpha: Angle | u = v_from(alpha, norm(u))}]
location: 60 3 61 78
body:
     angle(u: Nz_vect2): {alpha: Angle | u = vec_from(alpha, norm(u))} 
                         = choose({alpha: Angle | u = vec_from(alpha, norm(u))})


decl_type: tcc
theory: angles_2D
library: vectors
signature: nil
location: 110 0 115 999
body:
  % Subtype TCC generated (at line 61, column 32) for
      % {alpha: Angle | u = v_from(alpha, norm(u))}
      % expected type  p: (nonempty?[Angle])
  angle_TCC1: OBLIGATION
    FORALL (u: Nz_vect2):
      nonempty?[Angle]({alpha: Angle | u = v_from(alpha, norm(u))});


decl_type: tcc
theory: angles_2D
library: vectors
signature: nil
location: 117 0 120 999
body:
  % Subtype TCC generated (at line 50, column 49) for  v_from(alpha, k)
      % expected type  u: Nz_vect2
  angle_vec_from_TCC1: OBLIGATION
    FORALL (alpha: Angle, k: posreal): v_from(alpha, k) /= zero;


decl_type: tcc
theory: angles_2D
library: vectors
signature: nil
location: 122 0 124 999
body:
  % Subtype TCC generated (at line 67, column 41) for  u`y
      % expected type  {z: real | u`x = 0 => z /= 0}
  Angle_TCC1: OBLIGATION FORALL (u: Nz_vect2): u`x = 0 => u`y /= 0;


decl_type: tcc
theory: angles_2D
library: vectors
signature: nil
location: 126 0 128 999
body:
  % Subtype TCC generated (at line 6, column 38) for  (# x := x, y := 0 #)
      % expected type  u: Nz_vect2
  angle_x0_TCC1: OBLIGATION FORALL (x: posreal): (# x := x, y := 0 #) /= zero;


decl_type: tcc
theory: angles_2D
library: vectors
signature: nil
location: 130 0 132 999
body:
  % Subtype TCC generated (at line 6, column 38) for  (# x := 0, y := x #)
      % expected type  u: Nz_vect2
  angle_0x_TCC1: OBLIGATION FORALL (x: posreal): (# x := 0, y := x #) /= zero;


decl_type: tcc
theory: angles_2D
library: vectors
signature: nil
location: 134 0 136 999
body:
  % Subtype TCC generated (at line 6, column 38) for  (# x := x, y := x #)
      % expected type  u: Nz_vect2
  angle_xx_TCC1: OBLIGATION FORALL (x: posreal): (# x := x, y := x #) /= zero;


decl_type: tcc
theory: angles_2D
library: vectors
signature: nil
location: 138 0 141 999
body:
  % Subtype TCC generated (at line 6, column 38) for  (# x := ngr, y := 0 #)
      % expected type  u: Nz_vect2
  angle_n0_TCC1: OBLIGATION
    FORALL (ngr: negreal): (# x := ngr, y := 0 #) /= zero;


decl_type: tcc
theory: angles_2D
library: vectors
signature: nil
location: 143 0 146 999
body:
  % Subtype TCC generated (at line 6, column 38) for  (# x := 0, y := ngr #)
      % expected type  u: Nz_vect2
  angle_0n_TCC1: OBLIGATION
    FORALL (ngr: negreal): (# x := 0, y := ngr #) /= zero;


decl_type: tcc
theory: angles_2D
library: vectors
signature: nil
location: 148 0 151 999
body:
  % Subtype TCC generated (at line 6, column 38) for  (# x := -x, y := x #)
      % expected type  u: Nz_vect2
  angle_nx_TCC1: OBLIGATION
    FORALL (x: posreal): (# x := -x, y := x #) /= zero;


decl_type: tcc
theory: angles_2D
library: vectors
signature: nil
location: 153 0 156 999
body:
  % Subtype TCC generated (at line 6, column 38) for  (# x := x, y := -x #)
      % expected type  u: Nz_vect2
  angle_xn_TCC1: OBLIGATION
    FORALL (x: posreal): (# x := x, y := -x #) /= zero;


decl_type: tcc
theory: angles_2D
library: vectors
signature: nil
location: 158 0 161 999
body:
  % Subtype TCC generated (at line 6, column 38) for  (# x := -x, y := -x #)
      % expected type  u: Nz_vect2
  angle_nn_TCC1: OBLIGATION
    FORALL (x: posreal): (# x := -x, y := -x #) /= zero;


decl_type: formula
theory: between_2D
library: vectors
signature: nil
location: 35 3 40 58
body:
     between_cos: LEMMA LET v1 = v_from(a1,k1),
                            v2 = v_from(a2,k2),
                            v3 = v_from(a3,k3) IN
                        between?(v1,v3)(v2) IFF
                            ( cos(a3 - a1) <= cos(a3 - a2) AND
                              cos(a3 - a1) <= cos(a2 - a1) )


decl_type: formula
theory: between_2D
library: vectors
signature: nil
location: 42 3 48 43
body:
     is_between: LEMMA  a1 <= a2 AND a2 <= a3 AND
                        a3 - a1 <= pi AND a2 - a1 <= pi
                     IMPLIES
                        LET v1 = v_from(a1,k1),
                            v2 = v_from(a2,k2),
                            v3 = v_from(a3,k3) IN
                          between?(v1,v3)(v2)


decl_type: formula
theory: between_2D
library: vectors
signature: nil
location: 51 3 55 39
body:
     is_between2: COROLLARY 0 <= a1 AND a1 <= a2 AND a2 <= a3 AND a3 <= pi IMPLIES
                      LET v1 = v_from(a1,k1),
                          v2 = v_from(a2,k2),
                          v3 = v_from(a3,k3) IN
                      between?(v1,v3)(v2)


decl_type: formula
theory: between_2D
library: vectors
signature: nil
location: 58 3 66 55
body:
     between_lem: LEMMA LET v1 = v_from(a1,k1),
                         v2 = v_from(a2,k2),
                         v3 = v_from(a3,k3) IN
                      0 <= a1 AND a1 <= pi AND
                      0 <= a2 AND a2 <= pi AND
                      0 <= a3 AND a3 <= pi AND
                      a1 <= a3 AND
                      between?(v1,v3)(v2)
                          IMPLIES (a1 <= a2 AND a2 <= a3) 


decl_type: formula
theory: between_2D
library: vectors
signature: nil
location: 69 3 77 55
body:
     between_thm: THEOREM LET v1 = v_from(a1,k1),
                         v2 = v_from(a2,k2),
                         v3 = v_from(a3,k3) IN
                      0 <= a1 AND a1 <= pi AND
                      0 <= a2 AND a2 <= pi AND
                      0 <= a3 AND a3 <= pi AND
                      between?(v1,v3)(v2)
                          IMPLIES (a1 <= a2 AND a2 <= a3) OR
                                  (a3 <= a2 AND a2 <= a1)


decl_type: formula
theory: between_2D
library: vectors
signature: nil
location: 86 3 89 70
body:
     betw_between: LEMMA FORALL (v1,v2,xx: Nz_vect2):
                            angle(v2) - angle(v1) <= pi AND 
                            angle(xx) - angle(v1) <= pi AND
                            betw?(v1,v2)(xx) IMPLIES between?(v1,v2)(xx)


decl_type: formula
theory: between_2D
library: vectors
signature: nil
location: 91 3 94 67
body:
     between_betw: LEMMA FORALL (v1,v2,xx: Nz_vect2):
                         angle(v1) <= pi AND angle(xx) <= pi AND angle(v2) <= pi AND
                         angle(v1) <= angle(v2) AND
                         between?(v1,v2)(xx) IMPLIES betw?(v1,v2)(xx) 


decl_type: function
theory: between_2D
library: vectors
signature: [[Vect2, Vect2] -> [Vect2 -> bool]]
location: 20 3 25 31
body:
     between?(v1,v2: Vect2)(xx: Vect2): bool =
         LET k1 = norm(v1),
             k2 = norm(v2),
             kx = norm(xx) IN
            v1*(kx*v2-k2*xx) <= 0 AND
            v2*(kx*v1-k1*xx) <= 0 


decl_type: function
theory: between_2D
library: vectors
signature: [[Nz_vect2, Nz_vect2] -> [Nz_vect2 -> bool]]
location: 82 3 83 60
body:
     betw?(v1,v2: Nz_vect2)(xx: Nz_vect2): bool =
             angle(v1) <= angle(xx) AND angle(xx) <= angle(v2)


decl_type: formula
theory: trackAngles_scaf
library: vectors
signature: nil
location: 31 3 32 68
body:
     track_exists_x: LEMMA  (EXISTS (a: real): u`x = norm(u) * sin(a) AND
                                               u`y = norm(u) * cos(a))


decl_type: formula
theory: trackAngles_scaf
library: vectors
signature: nil
location: 34 3 36 57
body:
     track_exists  : LEMMA  (EXISTS (alpha: Track): 
                                u`x = norm(u) * sin(alpha) AND
                                u`y = norm(u) * cos(alpha))


decl_type: formula
theory: trackAngles_2D
library: vectors
signature: nil
location: 81 3 84 59
body:
     dot_prod_tracks    : LEMMA LET s = v_from(c,1),
                                    nv = v_from(a,1),
                                    v = v_from(b,1) IN
                               s*(nv-v) = cos(a-c) - cos(b-c) 


decl_type: tcc
theory: trackAngles_2D
library: vectors
signature: nil
location: 93 0 98 999
body:
  % Subtype TCC generated (at line 30, column 49) for
      % (# x := k * sin(a), y := k * cos(a) #)
      % expected type  Nz_vect2
  v_from_TCC1: OBLIGATION
    FORALL (a: real, k: posreal):
      (# x := k * sin(a), y := k * cos(a) #) /= zero;


decl_type: tcc
theory: trackAngles_2D
library: vectors
signature: nil
location: 100 0 102 999
body:
  % Subtype TCC generated (at line 34, column 41) for  u`x
      % expected type  {z: real | u`y = 0 => z /= 0}
  trk_TCC1: OBLIGATION FORALL (u: Nz_vect2): u`y = 0 => u`x /= 0;


decl_type: tcc
theory: trackAngles_2D
library: vectors
signature: nil
location: 104 0 110 999
body:
  % Existence TCC generated (at line 38, column 3) for
      % track(u: Nz_vect2): {alpha: Track | u = vec_from(alpha, norm(u))}
  track_TCC1: OBLIGATION
    EXISTS (x:
              [u: Nz_vect2 ->
                 {alpha: Track | u = vec_from(alpha, norm(u))}]):
      TRUE;


decl_type: tcc
theory: trackAngles_2D
library: vectors
signature: nil
location: 112 0 115 999
body:
  % Subtype TCC generated (at line 50, column 32) for  vec_from(alpha, k)
      % expected type  u: Nz_vect2
  track_vec_from_TCC1: OBLIGATION
    FORALL (alpha: Track, k: posreal): vec_from(alpha, k) /= zero;


decl_type: tcc
theory: trackAngles_2D
library: vectors
signature: nil
location: 117 0 119 999
body:
  % Subtype TCC generated (at line 6, column 38) for  (# x := x, y := 0 #)
      % expected type  u: Nz_vect2
  track_x0_TCC1: OBLIGATION FORALL (x: posreal): (# x := x, y := 0 #) /= zero;


decl_type: tcc
theory: trackAngles_2D
library: vectors
signature: nil
location: 121 0 123 999
body:
  % Subtype TCC generated (at line 6, column 38) for  (# x := 0, y := x #)
      % expected type  u: Nz_vect2
  track_0x_TCC1: OBLIGATION FORALL (x: posreal): (# x := 0, y := x #) /= zero;


decl_type: tcc
theory: trackAngles_2D
library: vectors
signature: nil
location: 125 0 127 999
body:
  % Subtype TCC generated (at line 6, column 38) for  (# x := x, y := x #)
      % expected type  u: Nz_vect2
  track_xx_TCC1: OBLIGATION FORALL (x: posreal): (# x := x, y := x #) /= zero;


decl_type: tcc
theory: trackAngles_2D
library: vectors
signature: nil
location: 129 0 132 999
body:
  % Subtype TCC generated (at line 6, column 38) for  (# x := ngr, y := 0 #)
      % expected type  u: Nz_vect2
  track_n0_TCC1: OBLIGATION
    FORALL (ngr: negreal): (# x := ngr, y := 0 #) /= zero;


decl_type: tcc
theory: trackAngles_2D
library: vectors
signature: nil
location: 134 0 137 999
body:
  % Subtype TCC generated (at line 6, column 38) for  (# x := 0, y := ngr #)
      % expected type  u: Nz_vect2
  track_0n_TCC1: OBLIGATION
    FORALL (ngr: negreal): (# x := 0, y := ngr #) /= zero;


decl_type: tcc
theory: trackAngles_2D
library: vectors
signature: nil
location: 139 0 142 999
body:
  % Subtype TCC generated (at line 6, column 38) for  (# x := -x, y := x #)
      % expected type  u: Nz_vect2
  track_nx_TCC1: OBLIGATION
    FORALL (x: posreal): (# x := -x, y := x #) /= zero;


decl_type: tcc
theory: trackAngles_2D
library: vectors
signature: nil
location: 144 0 147 999
body:
  % Subtype TCC generated (at line 6, column 38) for  (# x := x, y := -x #)
      % expected type  u: Nz_vect2
  track_xn_TCC1: OBLIGATION
    FORALL (x: posreal): (# x := x, y := -x #) /= zero;


decl_type: tcc
theory: trackAngles_2D
library: vectors
signature: nil
location: 149 0 152 999
body:
  % Subtype TCC generated (at line 6, column 38) for  (# x := -x, y := -x #)
      % expected type  u: Nz_vect2
  track_nn_TCC1: OBLIGATION
    FORALL (x: posreal): (# x := -x, y := -x #) /= zero;


decl_type: formula
theory: parallel_2D
library: vectors
signature: nil
location: 18 2 19 52
body:
    dot_perpL_parallel: LEMMA nzu*nzv = 0 IMPLIES
                             parallel?(perpL(nzu),nzv)


decl_type: formula
theory: parallel_2D
library: vectors
signature: nil
location: 22 2 23 52
body:
    dot_perpR_parallel: LEMMA nzu*nzv = 0 IMPLIES
                             parallel?(perpR(nzu),nzv)


decl_type: formula
theory: vectors_4D
library: vectors
signature: nil
location: 358 3 361 46
body:
     norm_ge_comps   : LEMMA norm(u) >= abs(u`x) AND
                             norm(u) >= abs(u`y) AND               
                             norm(u) >= abs(u`z) AND                      
                             norm(u) >= abs(u`t)


decl_type: tcc
theory: vectors_4D
library: vectors
signature: nil
location: 462 0 464 999
body:
  % Judgement subtype TCC generated (at line 126, column 5) for  norm(nzu)
      % expected type  posreal
  nz_norm_gt_0: OBLIGATION FORALL (nzu): norm(nzu) > 0;


decl_type: tcc
theory: vectors_4D
library: vectors
signature: nil
location: 466 0 468 999
body:
  % Judgement subtype TCC generated (at line 129, column 5) for  sqv(nzu)
      % expected type  posreal
  nz_sqv_gt_0: OBLIGATION FORALL (nzu): sqv(nzu) > 0;


decl_type: tcc
theory: vectors_4D
library: vectors
signature: nil
location: 470 0 474 999
body:
  % Judgement subtype TCC generated (at line 8, column 43) for
      % (# x := nza, y := b, z := c, t := d #)
      % expected type  Nz_vector
  nz_nvz_left: OBLIGATION
    FORALL (b, c, d, nza): (# x := nza, y := b, z := c, t := d #) /= zero;


decl_type: tcc
theory: vectors_4D
library: vectors
signature: nil
location: 476 0 480 999
body:
  % Judgement subtype TCC generated (at line 8, column 43) for
      % (# x := b, y := nza, z := c, t := d #)
      % expected type  Nz_vector
  nz_nvz_middle: OBLIGATION
    FORALL (b, c, d, nza): (# x := b, y := nza, z := c, t := d #) /= zero;


decl_type: tcc
theory: vectors_4D
library: vectors
signature: nil
location: 482 0 486 999
body:
  % Judgement subtype TCC generated (at line 8, column 43) for
      % (# x := b, y := c, z := nza, t := d #)
      % expected type  Nz_vector
  nz_nvz_right: OBLIGATION
    FORALL (b, c, d, nza): (# x := b, y := c, z := nza, t := d #) /= zero;


decl_type: tcc
theory: vectors_4D
library: vectors
signature: nil
location: 488 0 492 999
body:
  % Judgement subtype TCC generated (at line 8, column 43) for
      % (# x := b, y := c, z := d, t := nza #)
      % expected type  Nz_vector
  nz_nvz_time: OBLIGATION
    FORALL (b, c, d, nza): (# x := b, y := c, z := d, t := nza #) /= zero;


decl_type: tcc
theory: vectors_4D
library: vectors
signature: nil
location: 494 0 496 999
body:
  % Judgement subtype TCC generated (at line 144, column 5) for  x
      % expected type  Nz_vector
  normalized_nz: OBLIGATION FORALL (x: Normalized): x /= zero;


decl_type: tcc
theory: vectors_4D
library: vectors
signature: nil
location: 498 0 500 999
body:
  % Judgement subtype TCC generated (at line 147, column 5) for  -nzu
      % expected type  Nz_vector
  neg_nzv: OBLIGATION FORALL (nzu): -nzu /= zero;


decl_type: tcc
theory: vectors_4D
library: vectors
signature: nil
location: 502 0 504 999
body:
  % Judgement subtype TCC generated (at line 150, column 5) for  nza * nzv
      % expected type  Nz_vector
  nz_nzv: OBLIGATION FORALL (nza, nzv): nza * nzv /= zero;


decl_type: tcc
theory: vectors_4D
library: vectors
signature: nil
location: 506 0 509 999
body:
  % Subtype TCC generated (at line 326, column 33) for  (1 / norm(nzv)) * nzv
      % expected type  Normalized
  caret_TCC1: OBLIGATION
    FORALL (nzv: Nz_vector): norm((1 / norm(nzv)) * nzv) = 1;


decl_type: function
theory: fseqs_ops_vect3
library: vectors
signature: [[fseq[Vect3], fseq[Vect3]] -> fseq[Vect3]]
location: 23 2 28 24
body:
    +(fs,gs): fseq[Vect3] = LET len = mmin(l(fs),l(gs)) IN
                      (# length := len,
                        seq := (LAMBDA n: IF n < len THEN fs(n) + gs(n) 
                                          ELSE default
                                          ENDIF)
                      #) ;


decl_type: function
theory: fseqs_ops_vect3
library: vectors
signature: [[fseq[Vect3], fseq[Vect3]] -> fseq[Vect3]]
location: 31 2 36 24
body:
    -(fs,gs): fseq[Vect3] = LET len = mmin(l(fs),l(gs)) IN
                      (# length := len,
                        seq := (LAMBDA n: IF n < len THEN fs(n) + gs(n) 
                                          ELSE default
                                          ENDIF)
                      #) ;


decl_type: function
theory: fseqs_ops_vect3
library: vectors
signature: [[fseq[real], fseq[Vect3]] -> fseq[Vect3]]
location: 45 2 49 24
body:
    *(c,gs): fseq[Vect3] = (# length := l(gs),
                        seq := (LAMBDA n: IF n < l(gs) THEN c(n) * gs(n) 
                                          ELSE default
                                          ENDIF)
                      #) ;


decl_type: tcc
theory: fseqs_ops_vect3
library: vectors
signature: nil
location: 56 0 66 999
body:
  % Subtype TCC generated (at line 25, column 30) for
      % (LAMBDA n: IF n < len THEN fs`seq(n) + gs`seq(n) ELSE default ENDIF)
      % expected type  barray[Vect3](len)
  plus_TCC1: OBLIGATION
    FORALL (fs: fseq[Vect3], gs: fseq[Vect3], len: nat):
      len = IF fs`length > gs`length THEN gs`length ELSE fs`length ENDIF
       IMPLIES
       (FORALL (i: nat):
          i >= len IMPLIES
           IF i < len THEN fs`seq(i) + gs`seq(i) ELSE default[Vect3] ENDIF =
            default[Vect3]);


decl_type: tcc
theory: fseqs_ops_vect3
library: vectors
signature: nil
location: 68 0 77 999
body:
  % Subtype TCC generated (at line 46, column 30) for
      % (LAMBDA n:
      %    IF n < gs`length THEN c`seq(n) * gs`seq(n) ELSE default ENDIF)
      % expected type  barray[Vect3](gs`length)
  times_TCC1: OBLIGATION
    FORALL (c: fseq[real], gs: fseq[Vect3]):
      FORALL (i: nat):
        i >= gs`length IMPLIES
         IF i < gs`length THEN c`seq(i) * gs`seq(i) ELSE default[Vect3] ENDIF
          = default[Vect3];


decl_type: formula
theory: sigma_3D
library: vectors
signature: nil
location: 71 2 74 47
body:
    sigma_rew : LEMMA sigma(low, high, F) = IF low > high THEN zero
                                            ELSIF high = low THEN F(low) 
                                            ELSE  F(high) + sigma(low, high-1, F)
                                            ENDIF


decl_type: formula
theory: sigma_3D
library: vectors
signature: nil
location: 102 2 104 42
body:
    sigma_const   : THEOREM sigma(low, high, (LAMBDA i: const_vec(x))) = 
                             IF high >= low THEN (high-low+1) * const_vec(x) 
                             ELSE zero ENDIF


decl_type: formula
theory: sigma_3D
library: vectors
signature: nil
location: 133 2 136 65
body:
    sigma_shift_T2 : THEOREM T_pred(low+z) AND T_pred(high+z) IMPLIES 
                                   sigma(low+z,high+z,F) = 
                   sigma(low,high, (LAMBDA (i:T): IF T_pred(i+z) THEN F(i+z)
                                                  ELSE zero ENDIF))


decl_type: formula
theory: sigma_3D
library: vectors
signature: nil
location: 180 2 182 75
body:
    sigma_with       : THEOREM low <= i AND i <= high AND
                               F = G WITH [i := v] IMPLIES
                            sigma(low, high,F) = sigma(low,high,G) - G(i) + v


decl_type: function
theory: sigma_3D
library: vectors
signature: [[T_low, T_high, [T -> Vector]] -> Vector]
location: 64 2 68 49
body:
    sigma(low, high, F): RECURSIVE Vector
        = IF low > high THEN zero
          ELSE  F(high) + sigma(low, high-1, F)
          ENDIF                            
     MEASURE (LAMBDA low, high, F: abs(high+1-low))


decl_type: function
theory: sigma_3D
library: vectors
signature: [[[T -> Vector], T_low, T_high] -> [T -> Vector]]
location: 153 2 154 66
body:
    restrict(F, low, high): function[T -> Vector] = 
       (LAMBDA i: IF i < low OR i > high THEN zero ELSE F(i) ENDIF )


decl_type: function
theory: sigma_3D
library: vectors
signature: [[T_low, T_high, [T -> Vector], Vector] -> Vector]
location: 222 3 226 52
body:
     sum_it_def(low, high, F,v): RECURSIVE Vector
        = IF low > high THEN v
          ELSE  sum_it_def(low+1,high,F,v+F(low))
          ENDIF
     MEASURE (LAMBDA low, high, F, v: abs(high+1-low))


decl_type: tcc
theory: sigma_3D
library: vectors
signature: nil
location: 241 0 247 999
body:
  % Subtype TCC generated (at line 56, column 47) for  n
      % expected type  T_high
  high_low_rewrite_TCC1: OBLIGATION
    FORALL (high: T_high, low: T_low):
      NOT high < low IMPLIES
       (FORALL (n: subrange(low, high)):
          T_pred(n) OR (EXISTS (j: T): n <= j));


decl_type: tcc
theory: sigma_3D
library: vectors
signature: nil
location: 249 0 252 999
body:
  % Subtype TCC generated (at line 66, column 16) for  high
      % expected type  T
  sigma_TCC1: OBLIGATION
    FORALL (low: T_low, high: T_high): NOT low > high IMPLIES T_pred(high);


decl_type: tcc
theory: sigma_3D
library: vectors
signature: nil
location: 254 0 259 999
body:
  % Subtype TCC generated (at line 66, column 35) for  high - 1
      % expected type  T_high
  sigma_TCC2: OBLIGATION
    FORALL (low: T_low, high: T_high):
      NOT low > high IMPLIES
       T_pred(high - 1) OR (EXISTS (j: T): high - 1 <= j);


decl_type: tcc
theory: sigma_3D
library: vectors
signature: nil
location: 261 0 265 999
body:
  % Termination TCC generated (at line 66, column 24) for
      % sigma(low, high - 1, F)
  sigma_TCC3: OBLIGATION
    FORALL (low: T_low, high: T_high):
      NOT low > high IMPLIES abs(high - 1 + 1 - low) < abs(high + 1 - low);


decl_type: tcc
theory: sigma_3D
library: vectors
signature: nil
location: 267 0 271 999
body:
  % Subtype TCC generated (at line 72, column 66) for  low
      % expected type  T
  sigma_rew_TCC1: OBLIGATION
    FORALL (high: T_high, low: T_low):
      NOT low > high AND high = low IMPLIES T_pred(low);


decl_type: tcc
theory: sigma_3D
library: vectors
signature: nil
location: 273 0 278 999
body:
  % Subtype TCC generated (at line 77, column 38) for  low + nn + rng
      % expected type  T_high
  sigma_spl_TCC1: OBLIGATION
    FORALL (low: T_low, nn, rng: nat):
      T_pred(low + nn + rng) IMPLIES
       T_pred(low + nn + rng) OR (EXISTS (j: T): low + nn + rng <= j);


decl_type: tcc
theory: sigma_3D
library: vectors
signature: nil
location: 280 0 285 999
body:
  % Subtype TCC generated (at line 78, column 40) for  low + nn
      % expected type  T_high
  sigma_spl_TCC2: OBLIGATION
    FORALL (low: T_low, nn, rng: nat):
      T_pred(low + nn + rng) IMPLIES
       T_pred(low + nn) OR (EXISTS (j: T): low + nn <= j);


decl_type: tcc
theory: sigma_3D
library: vectors
signature: nil
location: 287 0 292 999
body:
  % Subtype TCC generated (at line 78, column 58) for  low + nn + 1
      % expected type  T_low
  sigma_spl_TCC3: OBLIGATION
    FORALL (low: T_low, nn, rng: nat):
      T_pred(low + nn + rng) IMPLIES
       T_pred(low + nn + 1) OR (EXISTS (j: T): j <= low + nn + 1);


decl_type: tcc
theory: sigma_3D
library: vectors
signature: nil
location: 294 0 298 999
body:
  % Subtype TCC generated (at line 82, column 48) for  z
      % expected type  T_high
  sigma_split_TCC1: OBLIGATION
    FORALL (high: T_high, low: T_low, z: int):
      z <= high AND low - 1 <= z IMPLIES T_pred(z) OR (EXISTS (j: T): z <= j);


decl_type: tcc
theory: sigma_3D
library: vectors
signature: nil
location: 300 0 305 999
body:
  % Subtype TCC generated (at line 82, column 62) for  z + 1
      % expected type  T_low
  sigma_split_TCC2: OBLIGATION
    FORALL (high: T_high, low: T_low, z: int):
      z <= high AND low - 1 <= z IMPLIES
       T_pred(z + 1) OR (EXISTS (j: T): j <= z + 1);


decl_type: tcc
theory: sigma_3D
library: vectors
signature: nil
location: 307 0 310 999
body:
  % Subtype TCC generated (at line 93, column 51) for  low
      % expected type  T
  sigma_first_TCC1: OBLIGATION
    FORALL (high: T_high, low: T_low): high >= low IMPLIES T_pred(low);


decl_type: tcc
theory: sigma_3D
library: vectors
signature: nil
location: 312 0 316 999
body:
  % Subtype TCC generated (at line 93, column 64) for  low + 1
      % expected type  T_low
  sigma_first_TCC2: OBLIGATION
    FORALL (high: T_high, low: T_low):
      high >= low IMPLIES T_pred(low + 1) OR (EXISTS (j: T): j <= low + 1);


decl_type: tcc
theory: sigma_3D
library: vectors
signature: nil
location: 318 0 322 999
body:
  % Subtype TCC generated (at line 96, column 59) for  high - 1
      % expected type  T_high
  sigma_last_TCC1: OBLIGATION
    FORALL (high: T_high, low: T_low):
      high >= low IMPLIES T_pred(high - 1) OR (EXISTS (j: T): high - 1 <= j);


decl_type: tcc
theory: sigma_3D
library: vectors
signature: nil
location: 324 0 327 999
body:
  % Subtype TCC generated (at line 96, column 74) for  high
      % expected type  T
  sigma_last_TCC2: OBLIGATION
    FORALL (high: T_high, low: T_low): high >= low IMPLIES T_pred(high);


decl_type: tcc
theory: sigma_3D
library: vectors
signature: nil
location: 329 0 334 999
body:
  % Subtype TCC generated (at line 99, column 59) for  i - 1
      % expected type  T_high
  sigma_middle_TCC1: OBLIGATION
    FORALL (high: T_high, i: T, low: T_low):
      i >= low AND high >= i IMPLIES
       T_pred(i - 1) OR (EXISTS (j: T): i - 1 <= j);


decl_type: tcc
theory: sigma_3D
library: vectors
signature: nil
location: 336 0 341 999
body:
  % Subtype TCC generated (at line 100, column 54) for  i + 1
      % expected type  T_low
  sigma_middle_TCC2: OBLIGATION
    FORALL (high: T_high, i: T, low: T_low):
      i >= low AND high >= i IMPLIES
       T_pred(i + 1) OR (EXISTS (j: T): j <= i + 1);


decl_type: tcc
theory: sigma_3D
library: vectors
signature: nil
location: 343 0 348 999
body:
  % Subtype TCC generated (at line 130, column 18) for  low + z
      % expected type  T_low
  sigma_shift_T_TCC1: OBLIGATION
    FORALL (low: T_low, z: int):
      (FORALL (i: T): T_pred(i + z)) IMPLIES
       T_pred(low + z) OR (EXISTS (j: T): j <= low + z);


decl_type: tcc
theory: sigma_3D
library: vectors
signature: nil
location: 350 0 355 999
body:
  % Subtype TCC generated (at line 130, column 24) for  high + z
      % expected type  T_high
  sigma_shift_T_TCC2: OBLIGATION
    FORALL (high: T_high, z: int):
      (FORALL (i: T): T_pred(i + z)) IMPLIES
       T_pred(high + z) OR (EXISTS (j: T): high + z <= j);


decl_type: tcc
theory: sigma_3D
library: vectors
signature: nil
location: 357 0 361 999
body:
  % Subtype TCC generated (at line 131, column 69) for  i + z
      % expected type  T
  sigma_shift_T_TCC3: OBLIGATION
    FORALL (z: int):
      (FORALL (i: T): T_pred(i + z)) IMPLIES (FORALL (i1: T): T_pred(i1 + z));


decl_type: tcc
theory: sigma_3D
library: vectors
signature: nil
location: 363 0 368 999
body:
  % Subtype TCC generated (at line 134, column 18) for  low + z
      % expected type  T_low
  sigma_shift_T2_TCC1: OBLIGATION
    FORALL (high: T_high, low: T_low, z: int):
      T_pred(high + z) AND T_pred(low + z) IMPLIES
       T_pred(low + z) OR (EXISTS (j: T): j <= low + z);


decl_type: tcc
theory: sigma_3D
library: vectors
signature: nil
location: 370 0 375 999
body:
  % Subtype TCC generated (at line 134, column 24) for  high + z
      % expected type  T_high
  sigma_shift_T2_TCC2: OBLIGATION
    FORALL (high: T_high, low: T_low, z: int):
      T_pred(high + z) AND T_pred(low + z) IMPLIES
       T_pred(high + z) OR (EXISTS (j: T): high + z <= j);


decl_type: tcc
theory: sigma_3D
library: vectors
signature: nil
location: 377 0 380 999
body:
  % Subtype TCC generated (at line 167, column 64) for  n
      % expected type  T
  sigma_eq_TCC1: OBLIGATION
    FORALL (high: T_high, low: T_low, n: subrange(low, high)): T_pred(n);


decl_type: tcc
theory: sigma_3D
library: vectors
signature: nil
location: 382 0 386 999
body:
  % Subtype TCC generated (at line 224, column 25) for  low + 1
      % expected type  T_low
  sum_it_def_TCC1: OBLIGATION
    FORALL (low: T_low, high: T_high):
      NOT low > high IMPLIES T_pred(low + 1) OR (EXISTS (j: T): j <= low + 1);


decl_type: tcc
theory: sigma_3D
library: vectors
signature: nil
location: 388 0 391 999
body:
  % Subtype TCC generated (at line 224, column 42) for  low
      % expected type  T
  sum_it_def_TCC2: OBLIGATION
    FORALL (low: T_low, high: T_high): NOT low > high IMPLIES T_pred(low);


decl_type: tcc
theory: sigma_3D
library: vectors
signature: nil
location: 393 0 397 999
body:
  % Termination TCC generated (at line 224, column 14) for
      % sum_it_def(low + 1, high, F, v + F(low))
  sum_it_def_TCC3: OBLIGATION
    FORALL (low: T_low, high: T_high):
      NOT low > high IMPLIES abs(high + 1 - (low + 1)) < abs(high + 1 - low);


decl_type: tcc
theory: sigma_3D
library: vectors
signature: nil
location: 399 0 404 999
body:
  % Subtype TCC generated (at line 232, column 16) for  i + 1
      % expected type  T_low
  sum_it_prop_TCC1: OBLIGATION
    FORALL (high: T_high, i: T, low: T_low):
      i <= high AND low - 1 <= i IMPLIES
       T_pred(i + 1) OR (EXISTS (j: T): j <= i + 1);


decl_type: tcc
theory: sigma_fseq_3D
library: vectors
signature: nil
location: 31 0 34 999
body:
  % Subtype TCC generated (at line 23, column 28) for  0
      % expected type  T_low[nat]
  sigma_TCC1: OBLIGATION
    FORALL (fs: fseq[Vector]): 0 >= 0 OR (EXISTS (j: nat): j <= 0);


decl_type: tcc
theory: sigma_fseq_3D
library: vectors
signature: nil
location: 36 0 40 999
body:
  % Subtype TCC generated (at line 23, column 30) for  fs`length - 1
      % expected type  T_high[nat]
  sigma_TCC2: OBLIGATION
    FORALL (fs: fseq[Vector]):
      fs`length - 1 >= 0 OR (EXISTS (j: nat): fs`length - 1 <= j);


decl_type: tcc
theory: sigma_fseq_3D
library: vectors
signature: nil
location: 42 0 46 999
body:
  % Assuming TCC generated (at line 19, column 12) for  sigma_3D[nat]
      % generated from assumption sigma_3D.connected_domain
  sigma_TCC3: OBLIGATION
    FORALL (fs: fseq[Vector]):
      (FORALL (x, y: nat), (z: integer): x <= z AND z <= y IMPLIES z >= 0);


decl_type: formula
theory: linear_independence_3D
library: vectors
signature: nil
location: 26 3 27 50
body:
     get_around_bug: LEMMA (FORALL (n: int): 0 <= n AND n < 2 
                             IMPLIES n = 0 OR n = 1)


decl_type: formula
theory: linear_independence_3D
library: vectors
signature: nil
location: 30 3 31 70
body:
     test2: LEMMA l(av) = 2 IMPLIES   %% PVS BUG %%
          (linearly_dependent?(av) IFF linearly_dependent?(av(0),av(1)))


decl_type: function
theory: linear_independence_3D
library: vectors
signature: [fseq[Vect3] -> bool]
location: 16 3 19 34
body:
     linearly_dependent?(av: fseq[Vect3]): bool = 
          EXISTS (rk: fseq[real]): length(rk) = length(av) AND
                         EXISTS (jj: nat): jj < length(rk) AND rk(jj) /= 0 AND
                 sigma(rk*av) = zero


decl_type: tcc
theory: vect_trig_3D
library: vectors
signature: nil
location: 23 0 25 999
body:
  % Judgement subtype TCC generated (at line 12, column 26) for  cos(u, v)
      % expected type  trig_range
  cos_range: OBLIGATION FORALL (u, v): -1 <= cos(u, v) AND cos(u, v) <= 1;


decl_type: tcc
theory: vect_trig_2D
library: vectors
signature: nil
location: 34 0 36 999
body:
  % Judgement subtype TCC generated (at line 17, column 26) for  sin(u, v)
      % expected type  trig_range
  sin_range: OBLIGATION FORALL (u, v): -1 <= sin(u, v) AND sin(u, v) <= 1;


decl_type: tcc
theory: vect_trig_2D
library: vectors
signature: nil
location: 38 0 40 999
body:
  % Judgement subtype TCC generated (at line 19, column 26) for  cos(u, v)
      % expected type  trig_range
  cos_range: OBLIGATION FORALL (u, v): -1 <= cos(u, v) AND cos(u, v) <= 1;


decl_type: function
theory: vect3D
library: vectors
signature: [[real, real, real] -> Vect3]
location: 26 2 27 73
body:
    vect3(x,y,z) : Vect3 =  LAMBDA(i:Index):
                              IF  i=0 THEN x ELSIF i=1 THEN y ELSE z  ENDIF


decl_type: function
theory: matrices
library: vectors
signature:
  [[real, real, real, real, real, real, real, real, real] ->
  Mat3]

location: 17 2 29 20
body:
    mat3(x00,x01,x02,x10,x11,x12,x20,x21,x22): Mat3 =
                                                 LAMBDA(x,y:below(3)):
                                                   IF    (x=0 AND y=0) THEN x00
                                                   ELSIF (x=0 AND y=1) THEN x01
                                                   ELSIF (x=0 AND y=2) THEN x02
                                                   ELSIF (x=1 AND y=0) THEN x10
                                                   ELSIF (x=1 AND y=1) THEN x11
                                                   ELSIF (x=1 AND y=2) THEN x12
                                                   ELSIF (x=2 AND y=0) THEN x20
                                                   ELSIF (x=2 AND y=1) THEN x21
                                                   ELSIF (x=2 AND y=2) THEN x22
                                                   ELSE 0
                                                   ENDIF  


decl_type: function
theory: matrices
library: vectors
signature: [Mat3 -> real]
location: 43 2 48 27
body:
    det(m): real = m(0,0)*m(1,1)*m(2,2) +
                   m(0,1)*m(1,2)*m(2,0) +
                   m(0,2)*m(1,0)*m(2,1) -
                   m(0,2)*m(1,1)*m(2,0) -
                   m(0,0)*m(1,2)*m(2,1) -
                   m(0,1)*m(1,0)*m(2,2)


decl_type: function
theory: matrices
library: vectors
signature: [Mat3 -> Mat3]
location: 59 2 61 42
body:
    T(m): Mat3 =  mat3(m(0,0),m(1,0),m(2,0),
                       m(0,1),m(1,1),m(2,1),
                       m(0,2),m(1,2),m(2,2)) 


decl_type: function
theory: matrices
library: vectors
signature: [[real, Mat3] -> Mat3]
location: 67 2 69 53
body:
    *(k,m): Mat3 =    mat3(k*m(0,0),k*m(0,1),k*m(0,2),
                           k*m(1,0),k*m(1,1),k*m(1,2),
                           k*m(2,0),k*m(2,1),k*m(2,2));


decl_type: function
theory: matrices
library: vectors
signature: [[Mat3, Mat3] -> Mat3]
location: 75 2 77 79
body:
    *(m,n): Mat3 =    mat3(row(m,0)*col(n,0),row(m,0)*col(n,1),row(m,0)*col(n,2),
                           row(m,1)*col(n,0),row(m,1)*col(n,1),row(m,1)*col(n,2),
                           row(m,2)*col(n,0),row(m,2)*col(n,1),row(m,2)*col(n,2))


decl_type: function
theory: matrices
library: vectors
signature: [[Mat3, below(3), below(3)] -> Mat3]
location: 103 2 107 21
body:
    cofactor_ij(m:Mat3, i,j:below(3)): Mat3 = LAMBDA(a,b:below(3)):
                                               IF    (a=i AND b=j) THEN 1
                                               ELSIF (a=i OR  b=j) THEN 0
                                               ELSE  m(a,b)
                                               ENDIF


decl_type: function
theory: matrices
library: vectors
signature: [[Vect3, Vect3, Vect3] -> Mat3]
location: 138 2 139 75
body:
    system3(v,u,w:Vect3): MACRO Mat3 =
                           mat3(x(v),y(v),z(v),x(u),y(u),z(u),x(w),y(w),z(w))


decl_type: tcc
theory: matrices
library: vectors
signature: nil
location: 146 0 153 999
body:
  % Subtype TCC generated (at line 99, column 33) for
      % mat3(x00, x01, 0, x10, x11, 0, 0, 0, 1)
      % expected type  Mat2
  mat2_TCC1: OBLIGATION
    FORALL (x00: real, x01: real, x10: real, x11: real):
      mat3(x00, x01, 0, x10, x11, 0, 0, 0, 1)(2, 0) = 0 AND
       mat3(x00, x01, 0, x10, x11, 0, 0, 0, 1)(2, 1) = 0 AND
        mat3(x00, x01, 0, x10, x11, 0, 0, 0, 1)(2, 2) = 1;


decl_type: tcc
theory: matrices
library: vectors
signature: nil
location: 155 0 157 999
body:
  % Subtype TCC generated (at line 113, column 21) for  det(ns)
      % expected type  nznum
  inv_TCC1: OBLIGATION FORALL (ns: NonSingular): det(ns) /= 0;


decl_type: tcc
theory: matrices
library: vectors
signature: nil
location: 159 0 161 999
body:
  % Subtype TCC generated (at line 115, column 24) for  id
      % expected type  NonSingular
  inv_id_TCC1: OBLIGATION NOT singular?(id);


decl_type: formula
theory: intersections_2D
library: vectors
signature: nil
location: 38 3 41 58
body:
     det_line: LEMMA LET DELTA = L1`p - L0`p IN
                       L0`p + s*L0`v =  L1`p + t*L1`v IMPLIES
                          det(L0`v,L1`v)*s = det(DELTA,L1`v) AND
                          det(L0`v,L1`v)*t = det(DELTA,L0`v)


decl_type: formula
theory: intersections_2D
library: vectors
signature: nil
location: 66 3 67 59
body:
     intersect_not_parallel: LEMMA intersect?(L0,L1) IMPLIES
                                     NOT parallel?(L0`v,L1`v)


decl_type: formula
theory: intersections_2D
library: vectors
signature: nil
location: 69 3 74 62
body:
     intersection_lem      : LEMMA det(L0`v,L1`v) /= 0 IMPLIES
                                      LET DELTA = L1`p - L0`p,
                                         ss = det(DELTA,L1`v)/det(L0`v,L1`v),
                                         tt = det(DELTA,L0`v)/det(L0`v,L1`v)
                                      IN
                                L0`p + ss*L0`v =  L1`p + tt*L1`v


decl_type: formula
theory: intersections_2D
library: vectors
signature: nil
location: 81 3 84 26
body:
     lines_intersection_sound : LEMMA
       FORALL(so:Vect2,vo:Nz_vect2,si:Vect2,vi:Nz_vect2|det(vo,vi) /= 0):
         LET (ko,ki) = lines_intersection(so,vo,si,vi) IN
         so+ko*vo = si+ki*vi


decl_type: formula
theory: intersections_2D
library: vectors
signature: nil
location: 86 4 88 54
body:
      pt_intersect          : LEMMA on_line?(p,L0) AND on_line?(p,L1) AND
                                   NOT same_line?(L0,L1) IMPLIES
                                       intersect?(L0,L1) 


decl_type: formula
theory: intersections_2D
library: vectors
signature: nil
location: 91 3 95 54
body:
     intersect_pt_unique   : LEMMA intersect?(L0,L1) IMPLIES
                                   pnot /= intersect_pt(L0,L1) AND
                                   on_line?(pnot,L0)  
                                IMPLIES
                                   NOT on_line?(pnot,L1)


decl_type: formula
theory: intersections_2D
library: vectors
signature: nil
location: 97 3 100 62
body:
     same_line_lem         : LEMMA p0 /= p1 AND
                                  ( on_line?(p0,L0) AND on_line?(p0,L1) AND
                                    on_line?(p1,L0) AND on_line?(p1,L1) )
                                       IMPLIES same_line?(L0,L1)


decl_type: formula
theory: intersections_2D
library: vectors
signature: nil
location: 102 3 103 54
body:
     not_same_line         : LEMMA on_line?(p,L0) AND NOT on_line?(p,L1) IMPLIES
                                   NOT same_line?(L0,L1)


decl_type: formula
theory: intersections_2D
library: vectors
signature: nil
location: 106 3 110 60
body:
     intersect_pt_lem      : LEMMA NOT same_line?(L0,L1) AND
                                   on_line?(pnot,L0)  AND
                                   on_line?(pnot,L1)  
                                IMPLIES
                                    intersect_pt(L0,L1) = pnot 


decl_type: function
theory: intersections_2D
library: vectors
signature: [[Line2D, Line2D] -> bool]
location: 51 3 52 73
body:
     same_line?(L0,L1): bool = LET DELTA = L1`p - L0`p IN  
                                 det(L0`v,L1`v) = 0 AND det(DELTA,L0`v) = 0


decl_type: function
theory: intersections_2D
library: vectors
signature: [[L0: Line2D, {L1: Line2D | det(L0`v, L1`v) /= 0}] -> Vect2]
location: 55 4 58 49
body:
      intersect_pt(L0:Line2D,L1: Line2D | det(L0`v,L1`v) /= 0): Vect2 =
                                 LET DELTA = L1`p - L0`p,
                                     ss = det(DELTA,L1`v)/det(L0`v,L1`v) IN 
                                     L0`p + ss*L0`v


decl_type: function
theory: intersections_2D
library: vectors
signature:
  [[Vect2, vo: Nz_vect2, Vect2,
  {vi: Nz_vect2 | det(vo, vi) /= 0}] ->
  [real, real]]

location: 76 3 79 33
body:
     lines_intersection(so:Vect2,vo:Nz_vect2,si:Vect2,vi:Nz_vect2|det(vo,vi) /= 0) : [real,real] =
       LET ns = si-so,
           d = det(vo,vi) IN
       (det(ns,vi)/d, det(ns,vo)/d)


decl_type: tcc
theory: intersections_2D
library: vectors
signature: nil
location: 119 0 123 999
body:
  % Subtype TCC generated (at line 57, column 56) for  det(L0`v, L1`v)
      % expected type  nznum
  intersect_pt_TCC1: OBLIGATION
    FORALL (L0: Line2D, L1: Line2D | det(L0`v, L1`v) /= 0, DELTA: Vector):
      DELTA = L1`p - L0`p IMPLIES det(L0`v, L1`v) /= 0;


decl_type: tcc
theory: intersections_2D
library: vectors
signature: nil
location: 125 0 130 999
body:
  % Subtype TCC generated (at line 79, column 17) for  d
      % expected type  nznum
  lines_intersection_TCC1: OBLIGATION
    FORALL (so: Vect2, vo: Nz_vect2, si: Vect2,
            vi: Nz_vect2 | det(vo, vi) /= 0, ns: Vector):
      ns = si - so IMPLIES (FORALL (d: real): d = det(vo, vi) IMPLIES d /= 0);


decl_type: tcc
theory: intersections_2D
library: vectors
signature: nil
location: 132 0 135 999
body:
  % Subtype TCC generated (at line 92, column 57) for  L1
      % expected type  {L1: Line2D | det(L0`v, L1`v) /= 0}
  intersect_pt_unique_TCC1: OBLIGATION
    FORALL (L0, L1: Line2D): intersect?(L0, L1) IMPLIES det(L0`v, L1`v) /= 0;


decl_type: tcc
theory: intersections_2D
library: vectors
signature: nil
location: 137 0 142 999
body:
  % Subtype TCC generated (at line 110, column 50) for  L1
      % expected type  {L1: Line2D | det(L0`v, L1`v) /= 0}
  intersect_pt_lem_TCC1: OBLIGATION
    FORALL (L0, L1: Line2D, pnot: Vect2):
      on_line?(pnot, L1) AND on_line?(pnot, L0) AND NOT same_line?(L0, L1)
       IMPLIES det(L0`v, L1`v) /= 0;


decl_type: formula
theory: closest_approach_3D
library: vectors
signature: nil
location: 51 2 54 53
body:
    sq_dist_lem: LEMMA LET p(t) = p0 + t*u, q(t) = q0 + t*v,
                           w0 = p0 - q0,
                           w(t) = w0 + t*(u-v) IN
                         sq_dist(p(t),q(t)) = w(t)*w(t)


decl_type: formula
theory: closest_approach_3D
library: vectors
signature: nil
location: 60 2 64 72
body:
    sq_dist_quad: LEMMA w0 = p0 - q0 AND
                        a = (u-v)*(u-v) AND
                        b = 2*w0*(u-v) AND
                        c = w0*w0
                        IMPLIES sq_dist(p0+t*u,q0+t*v) = a*sq(t) + b*t + c


decl_type: formula
theory: closest_approach_3D
library: vectors
signature: nil
location: 72 2 73 71
body:
    norm_diff_eq_0: LEMMA norm(u-v) = 0 IMPLIES
                          dist(p0+t1*u, q0+t1*v) = dist(p0+t2*u, q0+t2*v)


decl_type: formula
theory: closest_approach_3D
library: vectors
signature: nil
location: 84 2 88 62
body:
    time_closest_lem: LEMMA norm(u-v) /= 0 AND
                            a = (u-v)*(u-v) AND
                            b = 2*(p0-q0)*(u-v) 
                            IMPLIES
                              time_closest(p0,q0,u,v) = -b/(2*a)


decl_type: formula
theory: closest_approach_3D
library: vectors
signature: nil
location: 110 2 119 39
body:
    cpa_prep_mono: LEMMA w0 = p0 - q0 AND
                      a = (u-v)*(u-v) AND
                      b = 2*w0*(u-v) AND
                      c = w0*w0 AND
                      t_cpa = time_closest(p0,q0,u,v) AND
                      norm(u-v) /= 0 AND
                      t_cpa <= t1 AND t1 < t2 
                   IMPLIES
                      LET D2 = (LAMBDA t: sq_dist(p0+t*u,q0+t*v)) IN
                          D2(t1) < D2(t2)


decl_type: formula
theory: closest_approach_3D
library: vectors
signature: nil
location: 121 2 123 71
body:
    time_cpa: LEMMA t_cpa = time_closest(p0,q0,u,v) 
                 IMPLIES
                    is_minimum?(t_cpa,(LAMBDA t: sq_dist(p0+t*u,q0+t*v))) 


decl_type: formula
theory: closest_approach_3D
library: vectors
signature: nil
location: 128 2 133 39
body:
    dist_cpa_lt: LEMMA t_cpa = time_closest(p0,q0,u,v) AND
                       norm(u-v) /= 0 AND
                       t_cpa <= t1 AND t1 < t2 
                 IMPLIES
                      LET D2 = (LAMBDA t: sq_dist(p0+t*u,q0+t*v)) IN
                          D2(t1) < D2(t2)


decl_type: formula
theory: closest_approach_3D
library: vectors
signature: nil
location: 135 2 139 60
body:
    dist_min: LEMMA LET p(t) = p0 + t*u,      
                        q(t) = q0 + t*v IN
                    t_cpa = time_closest(p0,q0,u,v) 
                IMPLIES
                    dist(p(t_cpa),q(t_cpa)) <= dist(p(t),q(t))


decl_type: formula
theory: closest_approach_3D
library: vectors
signature: nil
location: 144 2 150 55
body:
    dist_diverges: LEMMA  LET p(t) = p0 + t*u,      
                              q(t) = q0 + t*v IN
                          t_cpa = time_closest(p0,q0,u,v) AND
                          t_cpa <= t1 AND t1 < t2 AND
                          norm(u-v) /= 0 
                IMPLIES
                    dist(p(t1),q(t1)) < dist(p(t2),q(t2))


decl_type: formula
theory: closest_approach_3D
library: vectors
signature: nil
location: 152 2 156 67
body:
    dist_parallel_lines: LEMMA  LET p(t) = p0 + t*u,      
                                    q(t) = q0 + t*v IN
                                norm(u-v) = 0
                             IMPLIES
                                dist(p(t1),q(t1)) = dist(p(t2),q(t2))


decl_type: formula
theory: closest_approach_3D
library: vectors
signature: nil
location: 174 2 176 27
body:
    dot_nneg_divergent : THEOREM 
      (p0-q0)*(u-v) >= 0 AND u /= v IMPLIES 
        divergent?(p0,q0,u,v)   


decl_type: formula
theory: closest_approach_3D
library: vectors
signature: nil
location: 182 2 185 62
body:
    divergent_t1_lt_t2 : LEMMA
      divergent?(p0,q0,u,v) IFF
        FORALL (t1,t2): 0 <= t1 AND t1 < t2 
          IMPLIES dist(p0+t1*u,q0+t1*v) <  dist(p0+t2*u,q0+t2*v)


decl_type: formula
theory: closest_approach_3D
library: vectors
signature: nil
location: 187 2 188 78
body:
    dot_prop_divergent: THEOREM u /= v IMPLIES 
                                (dot_prop?(p0,q0,u,v) IFF divergent?(p0,q0,u,v))


decl_type: formula
theory: closest_approach_3D
library: vectors
signature: nil
location: 200 2 206 37
body:
    t1_lt_t2_lt_D : LEMMA FORALL (t,t1,t2,D:real):
                       v*v /= 0 AND
                       t1 < t2 AND
                       (s+t1*v)*(s+t1*v) = D AND
                       (s+t2*v)*(s+t2*v) = D AND
                       t1 < t AND t < t2 IMPLIES
                       (s+t*v)*(s+t*v) < D


decl_type: formula
theory: closest_approach_3D
library: vectors
signature: nil
location: 212 2 218 35
body:
    lt_D_t1_lt_t2 : LEMMA FORALL (t,t1,t2,D:real):
                             v*v /= 0 AND
                             t1 < t2 AND
                             (s+t1*v)*(s+t1*v) = D AND
                             (s+t2*v)*(s+t2*v) = D AND
                             (s+t*v)*(s+t*v) < D IMPLIES
                             t1 < t AND t < t2 


decl_type: formula
theory: closest_approach_3D
library: vectors
signature: nil
location: 224 2 228 33
body:
    discr_le_0 : LEMMA FORALL (t,discrm,D:real): 
                          sos(v) /= 0 AND
                          discr(sos(v),2*(s*v),sos(s) - D) <= 0
                          IMPLIES
                            (s+t*v)*(s+t*v) >= D 


decl_type: function
theory: closest_approach_3D
library: vectors
signature: [[Vect3, Vect3, Vect3, Vect3] -> real]
location: 78 2 82 39
body:
    time_closest(p0,q0,u,v): real = IF norm(u-v) = 0 THEN  % parallel, eq speed
                                       0
                                    ELSE
                                       -((p0-q0)*(u-v))/sq(norm(u-v))
                                    ENDIF 


decl_type: function
theory: closest_approach_3D
library: vectors
signature: [[Vect3, Vect3, Vect3, Vect3] -> nnreal]
location: 96 2 98 35
body:
    dist_closest(p0,q0,u,v): MACRO nnreal = 
      LET t_cpa=time_closest(p0,q0,u,v) IN
         dist(p0+t_cpa*u, q0+t_cpa*v)


decl_type: tcc
theory: closest_approach_3D
library: vectors
signature: nil
location: 237 0 241 999
body:
  % Subtype TCC generated (at line 81, column 54) for  sq(norm(u - v))
      % expected type  nznum
  time_closest_TCC1: OBLIGATION
    FORALL (u: Vect3, v: Vect3):
      NOT norm(u - v) = 0 IMPLIES sq(norm(u - v)) /= 0;


decl_type: tcc
theory: closest_approach_3D
library: vectors
signature: nil
location: 243 0 249 999
body:
  % Subtype TCC generated (at line 88, column 58) for  (2 * a)
      % expected type  nznum
  time_closest_lem_TCC1: OBLIGATION
    FORALL (a, b: real, p0, q0, u, v: Vect3):
      b = 2 * (p0 - q0) * (u - v) AND
       a = (u - v) * (u - v) AND norm(u - v) /= 0
       IMPLIES (2 * a) /= 0;


decl_type: formula
theory: closest_approach_2D
library: vectors
signature: nil
location: 138 2 142 61
body:
    dist_min: LEMMA LET p(t) = p0 + t*u,      
                        q(t) = q0 + t*v IN
                    t_cpa = time_closest(p0,q0,u,v) 
                IMPLIES
                     dist(p(t_cpa),q(t_cpa)) <= dist(p(t),q(t))


decl_type: formula
theory: closest_approach_2D
library: vectors
signature: nil
location: 190 2 192 52
body:
    dot_prop_divergent: THEOREM 
      u /= v IMPLIES 
      (dot_prop?(p0,q0,u,v) IFF divergent?(p0,q0,u,v))


decl_type: formula
theory: closest_approach_2D
library: vectors
signature: nil
location: 208 2 214 32
body:
    t1_lt_t2_lt_D : LEMMA FORALL (t,t1,t2,D:real):
                       sqv(v) /= 0 AND
                       t1 < t2 AND
                       sqv(s+t1*v) = D AND
                       sqv(s+t2*v) = D AND
                       t1 < t AND t < t2 IMPLIES
                       sqv(s+t*v) < D


decl_type: formula
theory: closest_approach_2D
library: vectors
signature: nil
location: 220 2 226 35
body:
    lt_D_t1_lt_t2 : LEMMA FORALL (t,t1,t2,D:real):
                             sqv(v) /= 0 AND
                             t1 < t2 AND
                             sqv(s+t1*v) = D AND
                             sqv(s+t2*v) = D AND
                             sqv(s+t*v) < D IMPLIES
                             t1 < t AND t < t2 


decl_type: formula
theory: closest_approach_2D
library: vectors
signature: nil
location: 231 2 235 28
body:
    discr_le_0 : LEMMA FORALL (t,D:real): 
                          sqv(v) /= 0  AND
                          discr(sqv(v),2*(s*v),sqv(s) - D) <= 0 
                          IMPLIES
                            sqv(s+t*v) >= D 


decl_type: formula
theory: closest_approach_2D
library: vectors
signature: nil
location: 239 2 246 23
body:
    gt_D_t1_lt_t2 : LEMMA FORALL (t,t1,t2,t3,D:real):
       sqv(v) /= 0 AND
       t1 <= t AND t < t2 AND t2 < t3 AND
       sqv(s+t1*v) > D AND
       sqv(s+t2*v) = D AND
       sqv(s+t3*v) < D
       IMPLIES
           sqv(s+t*v) > D 


decl_type: tcc
theory: closest_approach_2D
library: vectors
signature: nil
location: 260 0 264 999
body:
  % Subtype TCC generated (at line 92, column 54) for  sq(norm(u - v))
      % expected type  nznum
  time_closest_TCC1: OBLIGATION
    FORALL (u: Vect2, v: Vect2):
      NOT norm(u - v) = 0 IMPLIES sq(norm(u - v)) /= 0;


decl_type: tcc
theory: closest_approach_2D
library: vectors
signature: nil
location: 266 0 272 999
body:
  % Subtype TCC generated (at line 99, column 58) for  (2 * a)
      % expected type  nznum
  time_closest_lem_TCC1: OBLIGATION
    FORALL (a, b: real, p0, q0, u, v: Vect2):
      b = 2 * (p0 - q0) * (u - v) AND
       a = (u - v) * (u - v) AND norm(u - v) /= 0
       IMPLIES (2 * a) /= 0;


decl_type: formula
theory: closest_approach_relative_2D
library: vectors
signature: nil
location: 45 2 49 47
body:
    divergent_lt : LEMMA
      divergent?(s,v) IFF
        FORALL(t1,t2:real): 
          0 <= t1 AND t1 < t2 IMPLIES
          sq_dist_at(s,v,t1) < sq_dist_at(s,v,t2)


decl_type: formula
theory: closest_approach_relative_2D
library: vectors
signature: nil
location: 71 2 72 64
body:
    tau_is_min: LEMMA LET Tau = tau_2D(s,nzv) IN
                    is_minimum?(Tau,(LAMBDA t: sq(norm(s+t*nzv))))


decl_type: function
theory: closest_approach_relative_2D
library: vectors
signature: [[Vect2, Vect2] -> real]
location: 67 2 69 24
body:
    tau(s,v): real = IF v = zero THEN 0
                     ELSE -(s*v)/sqv(v) 
                     ENDIF


decl_type: tcc
theory: closest_approach_relative_2D
library: vectors
signature: nil
location: 86 0 88 999
body:
  % Subtype TCC generated (at line 68, column 31) for  sqv(v)
      % expected type  nznum
  tau_TCC1: OBLIGATION FORALL (v: Vect2): NOT v = zero IMPLIES sqv(v) /= 0;


decl_type: formula
theory: distance
library: vectors
signature: nil
location: 38 3 39 54
body:
     sq_dist_le   : LEMMA sq_dist(v1,v2) <= sq_dist(p1,p2) IMPLIES
                              dist(v1,v2) <= dist(p1,p2)             %% NEW %%


decl_type: formula
theory: distance
library: vectors
signature: nil
location: 41 3 42 54
body:
     sq_dist_lt   : LEMMA sq_dist(v1,v2) <  sq_dist(p1,p2) IMPLIES
                              dist(v1,v2) <  dist(p1,p2)             %% NEW %%


decl_type: formula
theory: distance
library: vectors
signature: nil
location: 46 3 47 64
body:
     sq_dist_dist : LEMMA sq(dist(p2,p0)) = sq(dist(p1,p0)) + sq(dist(p1,p2)) 
                                               - 2*(p1-p0)*(p1-p2) %% NEW %% 


decl_type: tcc
theory: distance
library: vectors
signature: nil
location: 92 0 94 999
body:
  % Subtype TCC generated (at line 14, column 34) for  0
      % expected type  T_low[Index[n]]
  sq_dist_TCC1: OBLIGATION 0 >= 0 AND 0 < n OR (EXISTS (j: Index[n]): j <= 0);


decl_type: tcc
theory: distance
library: vectors
signature: nil
location: 96 0 99 999
body:
  % Subtype TCC generated (at line 14, column 36) for  n - 1
      % expected type  T_high[Index[n]]
  sq_dist_TCC2: OBLIGATION
    n - 1 >= 0 AND n - 1 < n OR (EXISTS (j: Index[n]): n - 1 <= j);


decl_type: tcc
theory: distance
library: vectors
signature: nil
location: 101 0 105 999
body:
  % Assuming TCC generated (at line 21, column 12) for  reals@sigma[Index[n]]
      % generated from assumption sigma.connected_domain
  sq_dist_TCC3: OBLIGATION
    (FORALL (x, y: Index[n]), (z: integer):
       x <= z AND z <= y IMPLIES z >= 0 AND z < n);


decl_type: formula
theory: closest_approach
library: vectors
signature: nil
location: 56 2 59 53
body:
    sq_dist_lem: LEMMA LET p(t) = p0 + t*u, q(t) = q0 + t*v,  
                           w0 = p0 - q0,
                           w(t) = w0 + t*(u-v) IN
                         sq_dist(p(t),q(t)) = w(t)*w(t)


decl_type: formula
theory: closest_approach
library: vectors
signature: nil
location: 65 2 69 72
body:
    sq_dist_quad: LEMMA w0 = p0 - q0 AND                      
                        a = (u-v)*(u-v) AND
                        b = 2*w0*(u-v) AND
                        c = w0*w0
                        IMPLIES sq_dist(p0+t*u,q0+t*v) = a*sq(t) + b*t + c


decl_type: tcc
theory: closest_approach
library: vectors
signature: nil
location: 198 0 202 999
body:
  % Subtype TCC generated (at line 86, column 54) for  sq(norm(u - v))
      % expected type  nznum
  time_closest_TCC1: OBLIGATION
    FORALL (u: Vector[n], v: Vector[n]):
      NOT norm(u - v) = 0 IMPLIES sq(norm[n]((-[n])(u, v))) /= 0;


decl_type: tcc
theory: closest_approach
library: vectors
signature: nil
location: 204 0 210 999
body:
  % Subtype TCC generated (at line 93, column 58) for  (2 * a)
      % expected type  nznum
  time_closest_lem_TCC1: OBLIGATION
    FORALL (a, b: real, p0, q0, u, v: Vector[n]):
      b = 2 * (p0 - q0) * (u - v) AND
       a = (u - v) * (u - v) AND norm(u - v) /= 0
       IMPLIES (2 * a) /= 0;


decl_type: formula
theory: law_cos_pos_3D
library: vectors
signature: nil
location: 30 2 37 64
body:
    law_cosines   : LEMMA
                       LET a = dist(v1,v0),
                           b = dist(v2,v1),
                           c = dist(v2,v0)
                       IN
                        a*b*cos(ab) = (v1-v0)*(v1-v2)
                          IMPLIES
                             sq(c) = sq(a) + sq(b) - 2*a*b*cos(ab)


decl_type: formula
theory: law_cos_pos_3D
library: vectors
signature: nil
location: 40 2 45 67
body:
    law_cosines_alt   : LEMMA
                        LET a = dist(v1,v0),
                            b = dist(v2,v1),
                            c = dist(v2,v0)
                        IN
                            sq(c) = sq(a) + sq(b) - 2*(v1-v0)*(v1-v2)


decl_type: formula
theory: law_cos_pos_3D
library: vectors
signature: nil
location: 49 2 51 60
body:
    angle_exists: LEMMA (EXISTS ab:  LET  a = dist(v1,v0),
                                          b = dist(v2,v1) IN
                                a*b*cos(ab) = (v1-v0)*(v1-v2))


decl_type: formula
theory: law_cos_pos_3D
library: vectors
signature: nil
location: 57 2 62 41
body:
    law_cosines_bnd : LEMMA
                       LET a = dist(v1,v0),
                           b = dist(v2,v1),
                           c = dist(v2,v0)
                       IN
                           sq(c) >= sq(a-b)


decl_type: formula
theory: law_cos_pos_3D
library: vectors
signature: nil
location: 64 2 69 41
body:
    law_cosines_bnd_abs : LEMMA
                          LET a = dist(v1,v0),
                              b = dist(v2,v1),
                              c = dist(v2,v0)
                          IN
                              c >= abs(a-b)


decl_type: formula
theory: law_cos_pos_3D
library: vectors
signature: nil
location: 72 2 76 43
body:
    law_cosines_le : LEMMA LET  a = dist(v1,v0),
                                b = dist(v2,v1),
                                c = dist(v2,v0)
                           IN
                                   c <= a + b


decl_type: tcc
theory: law_cos_pos_3D
library: vectors
signature: nil
location: 87 0 92 999
body:
  % Subtype TCC generated (at line 54, column 45) for
      % u * v / (norm(u) * norm(v))
      % expected type  y: real_abs_le1
  angle_between_TCC1: OBLIGATION
    FORALL (u, v: Nz_vect3):
      -1 <= u * v / (norm(u) * norm(v)) AND u * v / (norm(u) * norm(v)) <= 1;


decl_type: tcc
theory: law_cos_pos_2D
library: vectors
signature: nil
location: 87 0 92 999
body:
  % Subtype TCC generated (at line 54, column 45) for
      % u * v / (norm(u) * norm(v))
      % expected type  y: real_abs_le1
  angle_between_TCC1: OBLIGATION
    FORALL (u, v: Nz_vect2):
      -1 <= u * v / (norm(u) * norm(v)) AND u * v / (norm(u) * norm(v)) <= 1;


decl_type: formula
theory: lines
library: vectors
signature: nil
location: 69 3 70 56
body:
     vel_from_tm_length  : LEMMA sq(norm(vel_from_tm(p1,p2,t))) =
                                      sq_dist(p1,p2)/sq(t)


decl_type: type
theory: lines
library: vectors
signature: nil
location: 27 3 28 38
body:
     Line : TYPE = [# p: Vector[n],       % point on the line| position at time 0
                      v: Nz_vector[n] #]  % direction vector | velocity vector


decl_type: function
theory: lines
library: vectors
signature: [[Vector[n], Vector[n], posreal] -> Vector[n]]
location: 76 3 78 40
body:
     vel_from_spd(p1,p2,s):  Vector[n] = IF p1 = p2 then zero
                                     ELSE s/dist(p1,p2)*(p2-p1)
                                     ENDIF


decl_type: tcc
theory: lines
library: vectors
signature: nil
location: 140 0 143 999
body:
  % Subtype TCC generated (at line 50, column 47) for  vec_from(p1, p2)
      % expected type  Nz_vector[n]
  line_from_TCC1: OBLIGATION
    FORALL (p1: Vector[n], (p2: {v | v /= p1})): vec_from(p1, p2) /= zero[n];


decl_type: tcc
theory: lines
library: vectors
signature: nil
location: 145 0 149 999
body:
  % Subtype TCC generated (at line 57, column 49) for  1 / t * (p2 - p1)
      % expected type  {v | p2 = p1 + t * v}
  vel_from_tm_TCC1: OBLIGATION
    FORALL (p1: Vector[n], p2: Vector[n], t: nzreal):
      p2 = (+[n])(p1, *[n](t, *[n](1 / t, ((-[n])(p2, p1)))));


decl_type: tcc
theory: lines
library: vectors
signature: nil
location: 151 0 155 999
body:
  % Subtype TCC generated (at line 59, column 52) for  vel_from_tm(p1, p2, t)
      % expected type  Nz_vector[n]
  line_from_tm_TCC1: OBLIGATION
    FORALL (p1: Vector[n], (p2: {v | v /= p1}), t: nzreal):
      vel_from_tm(p1, p2, t) /= zero[n];


decl_type: tcc
theory: lines
library: vectors
signature: nil
location: 157 0 161 999
body:
  % Subtype TCC generated (at line 77, column 42) for  dist(p1, p2)
      % expected type  nznum
  vel_from_spd_TCC1: OBLIGATION
    FORALL (p1: Vector[n], p2: Vector[n]):
      NOT p1 = p2 IMPLIES dist[n](p1, p2) /= 0;


decl_type: tcc
theory: lines
library: vectors
signature: nil
location: 163 0 167 999
body:
  % Subtype TCC generated (at line 81, column 64) for  dist(p1, p2) / ps
      % expected type  nzreal
  vel_from_spd_lem_TCC1: OBLIGATION
    FORALL (p1, p2: Vector[n], ps: posreal):
      p1 /= p2 IMPLIES dist[n](p1, p2) / ps /= 0;


decl_type: tcc
theory: lines
library: vectors
signature: nil
location: 169 0 172 999
body:
  % Subtype TCC generated (at line 85, column 67) for  p2 - p1
      % expected type  Nz_vector[n]
  vel_from_spd_norm_TCC1: OBLIGATION
    FORALL (p1, p2: Vector[n]): p1 /= p2 IMPLIES (-[n])(p2, p1) /= zero[n];


decl_type: tcc
theory: lines
library: vectors
signature: nil
location: 174 0 180 999
body:
  % Existence TCC generated (at line 88, column 3) for
      % gen_speed(p1, p2, pt): {s1: nnreal | s1 = 1 / pt * dist(p1, p2)}
  gen_speed_TCC1: OBLIGATION
    EXISTS (x:
              [d: [Vector[n], Vector[n], posreal] ->
                 {s1: nnreal | s1 = 1 / d`3 * dist[n](d`1, d`2)}]):
      TRUE;


decl_type: tcc
theory: lines
library: vectors
signature: nil
location: 182 0 187 999
body:
  % Subtype TCC generated (at line 120, column 41) for
      % vel_from_spd(p1, p2, s)
      % expected type  Nz_vector[n]
  gen_line_spd_TCC1: OBLIGATION
    FORALL (p1: Vector[n], (p2: {v | v /= p1}), s: posreal):
      vel_from_spd(p1, p2, s) /= zero[n];


decl_type: tcc
theory: lines
library: vectors
signature: nil
location: 189 0 192 999
body:
  % Subtype TCC generated (at line 123, column 60) for  p2
      % expected type  {v | v /= p1}
  test1_TCC1: OBLIGATION
    FORALL (p1, p2: Vector[n]): p1 /= p2 IMPLIES p2 /= p1;


decl_type: formula
theory: vectors_3D_cos
library: vectors
signature: nil
location: 28 2 36 64
body:
    cosines_law   : LEMMA
                       LET a = norm(va),
                           b = norm(vb),
                           c = norm(vc)
                       IN
                        vc = va - vb AND
                        a*b*cos(ab) = va*vb
                          IMPLIES
                             sq(c) = sq(a) + sq(b) - 2*a*b*cos(ab)


decl_type: formula
theory: vectors_3D_cos
library: vectors
signature: nil
location: 41 2 43 50
body:
    angle_exists: LEMMA (EXISTS ab:  LET  a = norm(va),
                                          b = norm(vb) IN
                                a*b*cos(ab) = va*vb)


decl_type: formula
theory: vectors_3D_cos
library: vectors
signature: nil
location: 49 2 55 44
body:
    cosines_law_bnd : LEMMA
                       LET a = norm(va),
                           b = norm(vb),
                           c = norm(vc)
                       IN
                           vc = va - vb IMPLIES
                              sq(c) >= sq(a-b)


decl_type: formula
theory: vectors_3D_cos
library: vectors
signature: nil
location: 57 2 63 41
body:
    cosines_law_ge : LEMMA
                       LET a = norm(va),
                           b = norm(vb),
                           c = norm(vc)
                       IN
                           vc = va - vb IMPLIES
                              c >= abs(a-b)


decl_type: formula
theory: vectors_3D_cos
library: vectors
signature: nil
location: 66 2 72 43
body:
    cosines_law_le : LEMMA 
                       LET a = norm(va),
                           b = norm(vb),
                           c = norm(vc)
                       IN
                           vc = va - vb IMPLIES
                                   c <= a + b


decl_type: tcc
theory: vectors_3D_cos
library: vectors
signature: nil
location: 83 0 88 999
body:
  % Subtype TCC generated (at line 46, column 45) for
      % u * v / (norm(u) * norm(v))
      % expected type  y: real_abs_le1
  angle_between_TCC1: OBLIGATION
    FORALL (u, v: Nz_vect3):
      -1 <= u * v / (norm(u) * norm(v)) AND u * v / (norm(u) * norm(v)) <= 1;


decl_type: tcc
theory: vectors_2D_cos
library: vectors
signature: nil
location: 84 0 89 999
body:
  % Subtype TCC generated (at line 47, column 45) for
      % u * v / (norm(u) * norm(v))
      % expected type  y: real_abs_le1
  angle_between_TCC1: OBLIGATION
    FORALL (u, v: Nz_vect2):
      -1 <= u * v / (norm(u) * norm(v)) AND u * v / (norm(u) * norm(v)) <= 1;


decl_type: tcc
theory: vectors_cos
library: vectors
signature: nil
location: 83 0 89 999
body:
  % Subtype TCC generated (at line 46, column 49) for
      % u * v / (norm(u) * norm(v))
      % expected type  y: real_abs_le1
  angle_between_TCC1: OBLIGATION
    FORALL (u, v: Nz_vector[n]):
      -1 <= *[n](u, v) / (norm[n](u) * norm[n](v)) AND
       *[n](u, v) / (norm[n](u) * norm[n](v)) <= 1;


decl_type: formula
theory: nvectors
library: vectors
signature: nil
location: 86 3 88 43
body:
     comp_distr_add  : LEMMA
       FORALL (v: Vector, w: Vect(v`length), i: nat): i < v`length IMPLIES
         (v + w)`seq(i) = v`seq(i) + w`seq(i)  


decl_type: formula
theory: nvectors
library: vectors
signature: nil
location: 90 3 92 43
body:
     comp_distr_sub  : LEMMA
       FORALL (v: Vector, w: Vect(v`length), i: nat): i < v`length IMPLIES
         (v - w)`seq(i) = v`seq(i) - w`seq(i)  


decl_type: formula
theory: nvectors
library: vectors
signature: nil
location: 94 3 96 34
body:
     comp_distr_scal : LEMMA 
       FORALL (v: Vector, i: nat): i < v`length IMPLIES
         (a*v)`seq(i) = a*(v`seq(i))                %% NEW %%


decl_type: formula
theory: nvectors
library: vectors
signature: nil
location: 100 3 102 58
body:
     comp_eq : LEMMA
       FORALL (u, (w: Vect(u`length))):
          u = w IFF FORALL (i: below(u`length)): u(i) = w(i)   %%%% NEW %%%%


decl_type: formula
theory: nvectors
library: vectors
signature: nil
location: 198 3 199 72
body:
     dot_divby           : LEMMA
        FORALL (u: Vector, v: Vect(u`length)): nza*u = nza*v IMPLIES u = v   %%%% NEW %%%%


decl_type: formula
theory: nvectors
library: vectors
signature: nil
location: 210 3 211 70
body:
     dot_scal_canon      : LEMMA
        FORALL (u: Vector, v: Vect(u`length)): (a*u)*(b*v) = (a*b)*(u*v)      %% NEW %%x


decl_type: formula
theory: nvectors
library: vectors
signature: nil
location: 233 3 234 69
body:
     scal_dot_eq_0  : LEMMA
        FORALL (v: Vect(n)): c*v = zero(n) IMPLIES c = 0 OR v = zero(n) %%%% NEW %%%%


decl_type: formula
theory: nvectors
library: vectors
signature: nil
location: 236 3 237 79
body:
     dot_ge_dist    : LEMMA
        FORALL (u: Vector, v, w: Vect(u`length)): w*u >= w*v IMPLIES w*(u-v) >= 0 


decl_type: formula
theory: nvectors
library: vectors
signature: nil
location: 239 3 240 77
body:
     dot_gt_dist    : LEMMA 
        FORALL (u: Vector, v, w: Vect(u`length)): w*u > w*v IMPLIES w*(u-v) > 0 


decl_type: formula
theory: nvectors
library: vectors
signature: nil
location: 261 3 262 79
body:
     sqv_add        : LEMMA
        FORALL (u: Vector, v: Vect(u`length)): sqv(u+v) = sqv(u) + sqv(v) + 2*u*v


decl_type: formula
theory: nvectors
library: vectors
signature: nil
location: 264 3 265 79
body:
     sqv_sub        : LEMMA
        FORALL (u: Vector, v: Vect(u`length)): sqv(u-v) = sqv(u) + sqv(v) - 2*u*v


decl_type: formula
theory: nvectors
library: vectors
signature: nil
location: 290 3 291 82
body:
     norms_eq_sqv   : LEMMA
        FORALL (u: Vector, v: Vect(u`length)): norm(u) = norm(v) IFF sqv(u) = sqv(v)


decl_type: formula
theory: nvectors
library: vectors
signature: nil
location: 302 3 304 62
body:
     dot_normalize  : LEMMA
         FORALL (nzv: Nz_vect(nzu`length)): ^(nzu) * ^(nzv) %% NEW %%
                                 = nzu*nzv/(norm(nzu)*norm(nzv))


decl_type: formula
theory: nvectors
library: vectors
signature: nil
location: 309 3 310 90
body:
     sqv_minus_dot   : LEMMA
         FORALL (u: Vector, v: Vect(u`length)): sqv(u-a*v) = sqv(u) - 2*a*u*v + sq(a)*sqv(v)


decl_type: formula
theory: nvectors
library: vectors
signature: nil
location: 315 3 316 96
body:
     dot_norm        : LEMMA
         FORALL (u: Vector, v: Vect(u`length)): -norm(u)*norm(v) <= u*v AND u*v <= norm(u)*norm(v)


decl_type: formula
theory: nvectors
library: vectors
signature: nil
location: 318 3 319 76
body:
     norm_add_le     : LEMMA
         FORALL (u: Vector, v: Vect(u`length)): norm(u+v) <= norm(u) + norm(v)


decl_type: formula
theory: nvectors
library: vectors
signature: nil
location: 321 3 322 76
body:
     norm_sub_le     : LEMMA
         FORALL (u: Vector, v: Vect(u`length)): norm(u-v) <= norm(u) + norm(v)


decl_type: formula
theory: nvectors
library: vectors
signature: nil
location: 324 3 325 76
body:
     norm_sub_ge     : LEMMA
         FORALL (u: Vector, v: Vect(u`length)): norm(u-v) >= norm(u) - norm(v)


decl_type: formula
theory: nvectors
library: vectors
signature: nil
location: 332 3 335 59
body:
     norm_triangle   : LEMMA
        FORALL (v0: Vector, v1, v2: Vect(v0`length)):
          LET a = v1-v0, b = v1-v2, c = v2-v0 IN    %% NEW %%
              sq(norm(c)) = sq(norm(a)) + sq(norm(b)) - 2*a*b


decl_type: formula
theory: nvectors
library: vectors
signature: nil
location: 342 3 342 101
body:
     v_neq_0        : LEMMA v /= zero(v`length) IFF sigma(0,v`length-1,(LAMBDA (i: nat): sq(v(i)))) > 0


decl_type: function
theory: nvectors
library: vectors
signature: [v: Vector -> Vect(v`length)]
location: 24 3 27 11
body:
     -(v): Vect(v`length) = 
         (# length := v`length,
            seq    := LAMBDA (i: nat): -v(i) 
         #) ;


decl_type: function
theory: nvectors
library: vectors
signature: [d: [u: Vector, Vect(u`length)] -> Vect(d`1`length)]
location: 29 3 32 10
body:
     +(u: Vector, v: Vect(u`length)): Vect(u`length) = 
       (# length := u`length,
          seq := (LAMBDA (i: nat): u`seq(i) + v`seq(i))
        #) ;


decl_type: function
theory: nvectors
library: vectors
signature: [[u: Vector, Vect(u`length)] -> real]
location: 36 3 37 55
body:
     *(u: Vector, v: Vect(u`length)): real =
         sigma(0, u`length-1, LAMBDA (i: nat):u(i)*v(i)); % Dot Product


decl_type: function
theory: nvectors
library: vectors
signature: [d: [real, Vector] -> Vect(d`2`length)]
location: 39 3 42 9
body:
     *(a,v): Vect(v`length) =
         (# length := v`length,
            seq := LAMBDA (i: nat): a*v(i) 
         #)


decl_type: function
theory: nvectors
library: vectors
signature: [[nzu: Nz_vector, Nz_vect(nzu`length)] -> bool]
location: 346 2 347 47
body:
    parallel?(nzu, (nzv: Nz_vect(nzu`length))): bool =
          ^(nzu)*^(nzv) = 1 OR ^(nzu)*^(nzv) = -1  %% NEW %%


decl_type: tcc
theory: nvectors
library: vectors
signature: nil
location: 402 0 404 999
body:
  % Subtype TCC generated (at line 24, column 14) for  v`length
      % expected type  posnat
  difference_TCC1: OBLIGATION FORALL (v): v`length > 0;


decl_type: tcc
theory: nvectors
library: vectors
signature: nil
location: 406 0 411 999
body:
  % Subtype TCC generated (at line 26, column 20) for
      % LAMBDA (i: nat): -v`seq(i)
      % expected type  barray[real, 0](v`length)
  difference_TCC2: OBLIGATION
    FORALL (v: Vector):
      FORALL (i_1: nat): i_1 >= v`length IMPLIES -v`seq(i_1) = 0;


decl_type: tcc
theory: nvectors
library: vectors
signature: nil
location: 413 0 418 999
body:
  % Subtype TCC generated (at line 31, column 16) for
      % (LAMBDA (i: nat): u`seq(i) + v`seq(i))
      % expected type  barray[real, 0](u`length)
  plus_TCC1: OBLIGATION
    FORALL (u: Vector, v: Vect(u`length)):
      FORALL (i_1: nat): i_1 >= u`length IMPLIES u`seq(i_1) + v`seq(i_1) = 0;


decl_type: tcc
theory: nvectors
library: vectors
signature: nil
location: 420 0 424 999
body:
  % Subtype TCC generated (at line 30, column 5) for
      % (# length := u`length,
      %    seq := (LAMBDA (i: nat): u`seq(i) + v`seq(i)) #)
      % expected type  Vect(u`length)
  plus_TCC2: OBLIGATION FORALL (u: Vector, v: Vect(u`length)): u`length > 0;


decl_type: tcc
theory: nvectors
library: vectors
signature: nil
location: 426 0 429 999
body:
  % Subtype TCC generated (at line 34, column 57) for  -v
      % expected type  Vect(u`length)
  difference_TCC3: OBLIGATION
    FORALL (u: Vector, v: Vect(u`length)): (-v)`length = u`length;


decl_type: tcc
theory: nvectors
library: vectors
signature: nil
location: 431 0 435 999
body:
  % Subtype TCC generated (at line 37, column 16) for  u`length - 1
      % expected type  T_high[nat]
  times_TCC1: OBLIGATION
    FORALL (u: Vector, v: Vect(u`length)):
      u`length - 1 >= 0 OR (EXISTS (j: nat): u`length - 1 <= j);


decl_type: tcc
theory: nvectors
library: vectors
signature: nil
location: 437 0 442 999
body:
  % Subtype TCC generated (at line 41, column 17) for
      % LAMBDA (i: nat): a * v`seq(i)
      % expected type  barray[real, 0](v`length)
  times_TCC2: OBLIGATION
    FORALL (a: real, v: Vector):
      FORALL (i_1: nat): i_1 >= v`length IMPLIES a * v`seq(i_1) = 0;


decl_type: tcc
theory: nvectors
library: vectors
signature: nil
location: 444 0 446 999
body:
  % Subtype TCC generated (at line 49, column 20) for  v * v
      % expected type  nnreal
  sqv_TCC1: OBLIGATION FORALL (v: Vector): v * v >= 0;


decl_type: tcc
theory: nvectors
library: vectors
signature: nil
location: 448 0 452 999
body:
  % Subtype TCC generated (at line 51, column 27) for  v`length - 1
      % expected type  T_high[nat]
  sq_TCC1: OBLIGATION
    FORALL (v: Vector):
      v`length - 1 >= 0 OR (EXISTS (j: nat): v`length - 1 <= j);


decl_type: tcc
theory: nvectors
library: vectors
signature: nil
location: 454 0 456 999
body:
  % Subtype TCC generated (at line 77, column 51) for  LAMBDA (i: nat): 0
      % expected type  barray[real, 0](n)
  zero_TCC1: OBLIGATION FORALL (i_1: nat): TRUE;


decl_type: tcc
theory: nvectors
library: vectors
signature: nil
location: 458 0 463 999
body:
  % Subtype TCC generated (at line 77, column 28) for
      % (# length := n, seq := LAMBDA (i: nat): 0 #)
      % expected type  Zero_vect(n)
  zero_TCC2: OBLIGATION
    FORALL (n: posnat):
      n > 0 AND (norm((# length := n, seq := LAMBDA (i: nat): 0 #)) = 0);


decl_type: tcc
theory: nvectors
library: vectors
signature: nil
location: 465 0 471 999
body:
  % Subtype TCC generated (at line 80, column 6) for
      % zero(n) WITH [`seq(i) := 1]
      % expected type  Normalized_vect(n)
  unity_TCC1: OBLIGATION
    FORALL (n: posnat, i: below(n)):
      zero(n)`length > 0 AND
       zero(n)`length = n AND (norm((zero(n) WITH [`seq(i) := 1])) = 1);


decl_type: tcc
theory: nvectors
library: vectors
signature: nil
location: 473 0 478 999
body:
  % Subtype TCC generated (at line 82, column 31) for  const_seq(n, a)
      % expected type  Vect(n)
  const_vec_TCC1: OBLIGATION
    FORALL (n: posnat, a: real):
      const_seq[real, 0](n, a)`length > 0 AND
       const_seq[real, 0](n, a)`length = n;


decl_type: tcc
theory: nvectors
library: vectors
signature: nil
location: 480 0 483 999
body:
  % Subtype TCC generated (at line 106, column 57) for  v
      % expected type  Vect(zero(n)`length)
  add_zero_left_TCC1: OBLIGATION
    FORALL (n: posnat, v: Vect(n)): v`length = zero(n)`length;


decl_type: tcc
theory: nvectors
library: vectors
signature: nil
location: 485 0 488 999
body:
  % Subtype TCC generated (at line 108, column 51) for  zero(n)
      % expected type  Vect(v`length)
  add_zero_right_TCC1: OBLIGATION
    FORALL (n: posnat, v: Vect(n)): zero(n)`length = v`length;


decl_type: tcc
theory: nvectors
library: vectors
signature: nil
location: 490 0 493 999
body:
  % Subtype TCC generated (at line 110, column 73) for  u
      % expected type  Vect(v`length)
  add_comm_TCC1: OBLIGATION
    FORALL (u: Vector, v: Vect(u`length)): u`length = v`length;


decl_type: tcc
theory: nvectors
library: vectors
signature: nil
location: 495 0 498 999
body:
  % Subtype TCC generated (at line 113, column 52) for  w
      % expected type  Vect(v`length)
  add_assoc_TCC1: OBLIGATION
    FORALL (u: Vector, v, w: Vect(u`length)): w`length = v`length;


decl_type: tcc
theory: nvectors
library: vectors
signature: nil
location: 500 0 503 999
body:
  % Subtype TCC generated (at line 113, column 50) for  (v + w)
      % expected type  Vect(u`length)
  add_assoc_TCC2: OBLIGATION
    FORALL (u: Vector, v, w: Vect(u`length)): (v + w)`length = u`length;


decl_type: tcc
theory: nvectors
library: vectors
signature: nil
location: 505 0 508 999
body:
  % Subtype TCC generated (at line 113, column 63) for  w
      % expected type  Vect((u + v)`length)
  add_assoc_TCC3: OBLIGATION
    FORALL (u: Vector, v, w: Vect(u`length)): w`length = (u + v)`length;


decl_type: tcc
theory: nvectors
library: vectors
signature: nil
location: 510 0 513 999
body:
  % Subtype TCC generated (at line 122, column 48) for  -u
      % expected type  Vect(v`length)
  add_neg_sub_TCC1: OBLIGATION
    FORALL (u: Vector, v: Vect(u`length)): (-u)`length = v`length;


decl_type: tcc
theory: nvectors
library: vectors
signature: nil
location: 515 0 518 999
body:
  % Subtype TCC generated (at line 125, column 52) for  v
      % expected type  Vect((v + w)`length)
  add_cancel_TCC1: OBLIGATION
    FORALL (v: Vector, w: Vect(v`length)): v`length = (v + w)`length;


decl_type: tcc
theory: nvectors
library: vectors
signature: nil
location: 520 0 523 999
body:
  % Subtype TCC generated (at line 128, column 49) for  w
      % expected type  Vect((-v)`length)
  add_cancel_neg_TCC1: OBLIGATION
    FORALL (v: Vector, w: Vect(v`length)): w`length = (-v)`length;


decl_type: tcc
theory: nvectors
library: vectors
signature: nil
location: 525 0 528 999
body:
  % Subtype TCC generated (at line 128, column 53) for  v
      % expected type  Vect((-v + w)`length)
  add_cancel_neg_TCC2: OBLIGATION
    FORALL (v: Vector, w: Vect(v`length)): v`length = (-v + w)`length;


decl_type: tcc
theory: nvectors
library: vectors
signature: nil
location: 530 0 533 999
body:
  % Subtype TCC generated (at line 131, column 52) for  v
      % expected type  Vect((w - v)`length)
  add_cancel2_TCC1: OBLIGATION
    FORALL (v: Vector, w: Vect(v`length)): v`length = (w - v)`length;


decl_type: tcc
theory: nvectors
library: vectors
signature: nil
location: 535 0 538 999
body:
  % Subtype TCC generated (at line 134, column 52) for  v
      % expected type  Vect((w + v)`length)
  add_cancel_neg2_TCC1: OBLIGATION
    FORALL (v: Vector, w: Vect(v`length)): v`length = (w + v)`length;


decl_type: tcc
theory: nvectors
library: vectors
signature: nil
location: 540 0 543 999
body:
  % Subtype TCC generated (at line 144, column 10) for  v
      % expected type  Vect(u`length)
  sub_eq_zero_TCC1: OBLIGATION
    FORALL (n: posnat, u, v: Vect(n)): v`length = u`length;


decl_type: tcc
theory: nvectors
library: vectors
signature: nil
location: 545 0 548 999
body:
  % Subtype TCC generated (at line 147, column 53) for  v
      % expected type  Vect((v - w)`length)
  sub_cancel_TCC1: OBLIGATION
    FORALL (v: Vector, w: Vect(v`length)): v`length = (v - w)`length;


decl_type: tcc
theory: nvectors
library: vectors
signature: nil
location: 550 0 553 999
body:
  % Subtype TCC generated (at line 150, column 54) for  v
      % expected type  Vect((-v - w)`length)
  sub_cancel_neg_TCC1: OBLIGATION
    FORALL (v: Vector, w: Vect(v`length)): v`length = (-v - w)`length;


decl_type: tcc
theory: nvectors
library: vectors
signature: nil
location: 555 0 558 999
body:
  % Subtype TCC generated (at line 153, column 52) for  v
      % expected type  Vect((-v)`length)
  neg_add_left_TCC1: OBLIGATION
    FORALL (n: posnat, v: Vect(n)): v`length = (-v)`length;


decl_type: tcc
theory: nvectors
library: vectors
signature: nil
location: 560 0 563 999
body:
  % Subtype TCC generated (at line 163, column 61) for  v
      % expected type  Vect((-u)`length)
  neg_distr_add_TCC1: OBLIGATION
    FORALL (u: Vector, v: Vect(u`length)): v`length = (-u)`length;


decl_type: tcc
theory: nvectors
library: vectors
signature: nil
location: 565 0 568 999
body:
  % Subtype TCC generated (at line 174, column 48) for  v
      % expected type  Vect(zero(v`length)`length)
  dot_zero_left_TCC1: OBLIGATION
    FORALL (v: Vector): v`length = zero(v`length)`length;


decl_type: tcc
theory: nvectors
library: vectors
signature: nil
location: 570 0 573 999
body:
  % Subtype TCC generated (at line 182, column 50) for  w
      % expected type  Vect((a * v)`length)
  dot_assoc_TCC1: OBLIGATION
    FORALL (a: real, v: Vector, w: Vect(v`length)): w`length = (a * v)`length;


decl_type: tcc
theory: nvectors
library: vectors
signature: nil
location: 575 0 578 999
body:
  % Subtype TCC generated (at line 190, column 54) for  u
      % expected type  Vect((v + w)`length)
  dot_distr_add_right_TCC1: OBLIGATION
    FORALL (u: Vector, v, w: Vect(u`length)): u`length = (v + w)`length;


decl_type: tcc
theory: nvectors
library: vectors
signature: nil
location: 580 0 583 999
body:
  % Subtype TCC generated (at line 190, column 66) for  u
      % expected type  Vect(w`length)
  dot_distr_add_right_TCC2: OBLIGATION
    FORALL (u: Vector, v, w: Vect(u`length)): u`length = w`length;


decl_type: tcc
theory: nvectors
library: vectors
signature: nil
location: 585 0 588 999
body:
  % Subtype TCC generated (at line 193, column 51) for  (v - w)
      % expected type  Vect(u`length)
  dot_distr_sub_left_TCC1: OBLIGATION
    FORALL (u: Vector, v, w: Vect(u`length)): (v - w)`length = u`length;


decl_type: tcc
theory: nvectors
library: vectors
signature: nil
location: 590 0 593 999
body:
  % Subtype TCC generated (at line 196, column 54) for  u
      % expected type  Vect((v - w)`length)
  dot_distr_sub_right_TCC1: OBLIGATION
    FORALL (u: Vector, v, w: Vect(u`length)): u`length = (v - w)`length;


decl_type: tcc
theory: nvectors
library: vectors
signature: nil
location: 595 0 598 999
body:
  % Subtype TCC generated (at line 203, column 51) for  v
      % expected type  Vect((a * u)`length)
  dot_scal_left_TCC1: OBLIGATION
    FORALL (a: real, u: Vector, v: Vect(u`length)): v`length = (a * u)`length;


decl_type: tcc
theory: nvectors
library: vectors
signature: nil
location: 600 0 603 999
body:
  % Subtype TCC generated (at line 206, column 48) for  (a * v)
      % expected type  Vect(u`length)
  dot_scal_right_TCC1: OBLIGATION
    FORALL (a: real, u: Vector, v: Vect(u`length)): (a * v)`length = u`length;


decl_type: tcc
theory: nvectors
library: vectors
signature: nil
location: 605 0 609 999
body:
  % Subtype TCC generated (at line 211, column 52) for  (b * v)
      % expected type  Vect((a * u)`length)
  dot_scal_canon_TCC1: OBLIGATION
    FORALL (a, b: real, u: Vector, v: Vect(u`length)):
      (b * v)`length = (a * u)`length;


decl_type: tcc
theory: nvectors
library: vectors
signature: nil
location: 611 0 614 999
body:
  % Subtype TCC generated (at line 213, column 47) for  b * u
      % expected type  Vect((a * u)`length)
  dot_scal_distr_add_TCC1: OBLIGATION
    FORALL (a, b: real, u: Vector): (b * u)`length = (a * u)`length;


decl_type: tcc
theory: nvectors
library: vectors
signature: nil
location: 616 0 620 999
body:
  % Subtype TCC generated (at line 218, column 61) for  a * v
      % expected type  Vect((a * u)`length)
  scal_add_distr_TCC1: OBLIGATION
    FORALL (a: real, u: Vector, v: Vect(u`length)):
      (a * v)`length = (a * u)`length;


decl_type: tcc
theory: nvectors
library: vectors
signature: nil
location: 622 0 625 999
body:
  % Subtype TCC generated (at line 237, column 57) for  v
      % expected type  Vect(w`length)
  dot_ge_dist_TCC1: OBLIGATION
    FORALL (u: Vector, v, w: Vect(u`length)): v`length = w`length;


decl_type: tcc
theory: nvectors
library: vectors
signature: nil
location: 627 0 631 999
body:
  % Subtype TCC generated (at line 237, column 70) for  (u - v)
      % expected type  Vect(w`length)
  dot_ge_dist_TCC2: OBLIGATION
    FORALL (u: Vector, v, w: Vect(u`length)):
      w * u >= w * v IMPLIES (u - v)`length = w`length;


decl_type: tcc
theory: nvectors
library: vectors
signature: nil
location: 633 0 637 999
body:
  % Subtype TCC generated (at line 240, column 69) for  (u - v)
      % expected type  Vect(w`length)
  dot_gt_dist_TCC1: OBLIGATION
    FORALL (u: Vector, v, w: Vect(u`length)):
      w * u > w * v IMPLIES (u - v)`length = w`length;


decl_type: tcc
theory: nvectors
library: vectors
signature: nil
location: 639 0 642 999
body:
  % Subtype TCC generated (at line 262, column 78) for  v
      % expected type  Vect((2 * u)`length)
  sqv_add_TCC1: OBLIGATION
    FORALL (u: Vector, v: Vect(u`length)): v`length = (2 * u)`length;


decl_type: tcc
theory: nvectors
library: vectors
signature: nil
location: 644 0 646 999
body:
  % Subtype TCC generated (at line 298, column 36) for  norm(nzv)
      % expected type  nznum
  caret_TCC1: OBLIGATION FORALL (nzv: Nz_vector): norm(nzv) /= 0;


decl_type: tcc
theory: nvectors
library: vectors
signature: nil
location: 648 0 651 999
body:
  % Subtype TCC generated (at line 298, column 33) for  (1 / norm(nzv)) * nzv
      % expected type  Normalized
  caret_TCC2: OBLIGATION
    FORALL (nzv: Nz_vector): (norm((1 / norm(nzv)) * nzv) = 1);


decl_type: tcc
theory: nvectors
library: vectors
signature: nil
location: 653 0 657 999
body:
  % Subtype TCC generated (at line 303, column 51) for  ^(nzv)
      % expected type  Vect(^(nzu)`length)
  dot_normalize_TCC1: OBLIGATION
    FORALL (nzu: Nz_vector, nzv: Nz_vect(nzu`length)):
      ^(nzv)`length = ^(nzu)`length;


decl_type: tcc
theory: nvectors
library: vectors
signature: nil
location: 659 0 664 999
body:
  % Subtype TCC generated (at line 304, column 42) for
      % (norm(nzu) * norm(nzv))
      % expected type  nznum
  dot_normalize_TCC2: OBLIGATION
    FORALL (nzu: Nz_vector, nzv: Nz_vect(nzu`length)):
      (norm(nzu) * norm(nzv)) /= 0;


decl_type: tcc
theory: nvectors
library: vectors
signature: nil
location: 666 0 669 999
body:
  % Subtype TCC generated (at line 306, column 32) for  ^(nzv)
      % expected type  Nz_vector
  normalize_normalize_TCC1: OBLIGATION
    FORALL (nzv: Nz_vector): (norm(^(nzv)) /= 0);


decl_type: tcc
theory: nvectors
library: vectors
signature: nil
location: 671 0 675 999
body:
  % Subtype TCC generated (at line 310, column 74) for  v
      % expected type  Vect((2 * a * u)`length)
  sqv_minus_dot_TCC1: OBLIGATION
    FORALL (a: real, u: Vector, v: Vect(u`length)):
      v`length = (2 * a * u)`length;


decl_type: tcc
theory: nvectors
library: vectors
signature: nil
location: 677 0 685 999
body:
  % Subtype TCC generated (at line 335, column 58) for  b
      % expected type  Vect((2 * a)`length)
  norm_triangle_TCC1: OBLIGATION
    FORALL (v0: Vector, v1, v2: Vect(v0`length), a: Vect(v1`length)):
      a = v1 - v0 IMPLIES
       (FORALL (b: Vect(v1`length)):
          b = v1 - v2 IMPLIES
           (FORALL (c: Vect(v2`length)):
              c = v2 - v0 IMPLIES b`length = (2 * a)`length));


decl_type: tcc
theory: nvectors
library: vectors
signature: nil
location: 687 0 689 999
body:
  % Subtype TCC generated (at line 339, column 39) for  nzv`length
      % expected type  n: posnat
  nzvec_neq_zero_TCC1: OBLIGATION FORALL (nzv: Nz_vector): nzv`length > 0;


decl_type: formula
theory: Cont
library: while
signature: nil
location: 32 2 33 62
body:
    sq_le_def: LEMMA sq_le(c1,c2) IFF
                     subset?[[State,State]](graph(c1),graph(c2))      % NN 4.8


decl_type: formula
theory: Cont
library: while
signature: nil
location: 42 2 43 66
body:
    lub_graph: LEMMA empty?(D) OR directed?(sq_le)(D) IMPLIES
       least_upper_bound?(from_graph(Union(image(graph,D))),D,sq_le)


decl_type: formula
theory: Cont
library: while
signature: nil
location: 57 2 59 74
body:
    sq_le_conditional: LEMMA sq_le(c,conditional(p,c1,c2)) IFF
      (FORALL s1,s2: (    p(s1) AND c(s1) = up(s2) IMPLIES c1(s1) = up(s2)) AND
                     (NOT p(s1) AND c(s1) = up(s2) IMPLIES c2(s1) = up(s2)))


decl_type: judgement
theory: Cont
library: while
signature: (pointed_directed_complete_partial_order?[Cont])
location: 47 2 48 79
body:
    sq_le_pdcpo: JUDGEMENT
                  sq_le HAS_TYPE (pointed_directed_complete_partial_order?[Cont])


decl_type: tcc
theory: Cont
library: while
signature: nil
location: 73 0 75 999
body:
  % Judgement subtype TCC generated (at line 35, column 33) for  sq_le
      % expected type  (partial_order?[Cont])
  partial_order_sq_le: OBLIGATION partial_order?[Cont](sq_le);


decl_type: tcc
theory: Cont
library: while
signature: nil
location: 77 0 80 999
body:
  % Subtype TCC generated (at line 42, column 49) for  D
      % expected type  (nonempty?[Cont])
  lub_graph_TCC1: OBLIGATION
    FORALL (D: set[Cont]): NOT empty?(D) IMPLIES nonempty?[Cont](D);


decl_type: tcc
theory: Cont
library: while
signature: nil
location: 82 0 92 999
body:
  % Subtype TCC generated (at line 43, column 35) for  Union(image(graph, D))
      % expected type  (graph?)
  lub_graph_TCC2: OBLIGATION
    FORALL (D: set[Cont]):
      empty?(D) OR directed?(sq_le)(D) IMPLIES
       graph?[State, State]
           (Union[[State[V], State[V]]]
                (image
                     [LiftPartialFunction[State, State],
                      set[[State[V], State[V]]]]
                     (graph[State, State], D)));


decl_type: tcc
theory: Cont
library: while
signature: nil
location: 94 0 96 999
body:
  % Judgement subtype TCC generated (at line 46, column 16) for  sq_le
      % expected type  (directed_complete_partial_order?[Cont])
  sq_le_dcpo: OBLIGATION directed_complete_partial_order?[Cont](sq_le);


decl_type: tcc
theory: Cont
library: while
signature: nil
location: 98 0 101 999
body:
  % Judgement subtype TCC generated (at line 48, column 16) for  sq_le
      % expected type  (pointed_directed_complete_partial_order?[Cont])
  sq_le_pdcpo: OBLIGATION
    pointed_directed_complete_partial_order?[Cont](sq_le);


decl_type: formula
theory: AExp
library: while
signature: nil
location: 45 0 50 999
body:
  AExp_ord_defaxiom: AXIOM
         (FORALL (n: int): AExp_ord(N(n)) = 0)
     AND (FORALL (x: V): AExp_ord(V(x)) = 1)
     AND (FORALL (a1: AExp, a2: AExp): AExp_ord(Add(a1, a2)) = 2)
     AND (FORALL (a1: AExp, a2: AExp): AExp_ord(Sub(a1, a2)) = 3)
     AND (FORALL (a1: AExp, a2: AExp): AExp_ord(Mul(a1, a2)) = 4);


decl_type: formula
theory: AExp
library: while
signature: nil
location: 52 0 54 999
body:
  AExp_N_extensionality: AXIOM
    FORALL (N?_var: (N?), N?_var2: (N?)):
      n(N?_var) = n(N?_var2) IMPLIES N?_var = N?_var2;


decl_type: formula
theory: AExp
library: while
signature: nil
location: 58 0 60 999
body:
  AExp_V_extensionality: AXIOM
    FORALL (V?_var: (V?), V?_var2: (V?)):
      x(V?_var) = x(V?_var2) IMPLIES V?_var = V?_var2;


decl_type: formula
theory: AExp
library: while
signature: nil
location: 64 0 67 999
body:
  AExp_Add_extensionality: AXIOM
    FORALL (Add?_var: (Add?), Add?_var2: (Add?)):
      a1(Add?_var) = a1(Add?_var2) AND a2(Add?_var) = a2(Add?_var2) IMPLIES
       Add?_var = Add?_var2;


decl_type: formula
theory: AExp
library: while
signature: nil
location: 72 0 75 999
body:
  AExp_Sub_extensionality: AXIOM
    FORALL (Sub?_var: (Sub?), Sub?_var2: (Sub?)):
      a1(Sub?_var) = a1(Sub?_var2) AND a2(Sub?_var) = a2(Sub?_var2) IMPLIES
       Sub?_var = Sub?_var2;


decl_type: formula
theory: AExp
library: while
signature: nil
location: 80 0 83 999
body:
  AExp_Mul_extensionality: AXIOM
    FORALL (Mul?_var: (Mul?), Mul?_var2: (Mul?)):
      a1(Mul?_var) = a1(Mul?_var2) AND a2(Mul?_var) = a2(Mul?_var2) IMPLIES
       Mul?_var = Mul?_var2;


decl_type: formula
theory: AExp
library: while
signature: nil
location: 92 0 94 999
body:
  AExp_a1_Add: AXIOM
    FORALL (Add1_var: AExp, Add2_var: AExp):
      a1(Add(Add1_var, Add2_var)) = Add1_var;


decl_type: formula
theory: AExp
library: while
signature: nil
location: 96 0 98 999
body:
  AExp_a2_Add: AXIOM
    FORALL (Add1_var: AExp, Add2_var: AExp):
      a2(Add(Add1_var, Add2_var)) = Add2_var;


decl_type: formula
theory: AExp
library: while
signature: nil
location: 100 0 102 999
body:
  AExp_a1_Sub: AXIOM
    FORALL (Sub1_var: AExp, Sub2_var: AExp):
      a1(Sub(Sub1_var, Sub2_var)) = Sub1_var;


decl_type: formula
theory: AExp
library: while
signature: nil
location: 104 0 106 999
body:
  AExp_a2_Sub: AXIOM
    FORALL (Sub1_var: AExp, Sub2_var: AExp):
      a2(Sub(Sub1_var, Sub2_var)) = Sub2_var;


decl_type: formula
theory: AExp
library: while
signature: nil
location: 108 0 110 999
body:
  AExp_a1_Mul: AXIOM
    FORALL (Mul1_var: AExp, Mul2_var: AExp):
      a1(Mul(Mul1_var, Mul2_var)) = Mul1_var;


decl_type: formula
theory: AExp
library: while
signature: nil
location: 112 0 114 999
body:
  AExp_a2_Mul: AXIOM
    FORALL (Mul1_var: AExp, Mul2_var: AExp):
      a2(Mul(Mul1_var, Mul2_var)) = Mul2_var;


decl_type: formula
theory: AExp
library: while
signature: nil
location: 116 0 119 999
body:
  AExp_inclusive: AXIOM
    FORALL (AExp_var: AExp):
          N?(AExp_var) OR V?(AExp_var) OR Add?(AExp_var) OR Sub?(AExp_var)
       OR Mul?(AExp_var);


decl_type: formula
theory: AExp
library: while
signature: nil
location: 121 0 131 999
body:
  AExp_induction: AXIOM
    FORALL (p: [AExp -> boolean]):
      (     FORALL (N1_var: int): p(N(N1_var))
        AND FORALL (V1_var: V): p(V(V1_var))
        AND FORALL (Add1_var: AExp, Add2_var: AExp):
              p(Add1_var) AND p(Add2_var) IMPLIES p(Add(Add1_var, Add2_var))
        AND FORALL (Sub1_var: AExp, Sub2_var: AExp):
              p(Sub1_var) AND p(Sub2_var) IMPLIES p(Sub(Sub1_var, Sub2_var))
        AND FORALL (Mul1_var: AExp, Mul2_var: AExp):
              p(Mul1_var) AND p(Mul2_var) IMPLIES p(Mul(Mul1_var, Mul2_var)))
       IMPLIES (FORALL (AExp_var: AExp): p(AExp_var));


decl_type: function
theory: AExp
library: while
signature: [AExp -> upto(4)]
location: 167 0 174 999
body:
  ord(x1: AExp): [AExp -> upto(4)] =
      CASES x1
        OF N(N1_var): 0,
           V(V1_var): 1,
           Add(Add1_var, Add2_var): 2,
           Sub(Sub1_var, Sub2_var): 3,
           Mul(Mul1_var, Mul2_var): 4
        ENDCASES


decl_type: function
theory: AExp
library: while
signature: [[AExp, AExp] -> boolean]
location: 176 0 187 999
body:
  subterm(x1: AExp, y: AExp):  boolean =
      x1 = y OR
       CASES y
         OF N(N1_var): FALSE,
            V(V1_var): FALSE,
            Add(Add1_var, Add2_var):
              subterm(x1, Add1_var) OR subterm(x1, Add2_var),
            Sub(Sub1_var, Sub2_var):
              subterm(x1, Sub1_var) OR subterm(x1, Sub2_var),
            Mul(Mul1_var, Mul2_var):
              subterm(x1, Mul1_var) OR subterm(x1, Mul2_var)
         ENDCASES;


decl_type: function
theory: AExp
library: while
location: 189 0 206 999
signature:
  [[[int -> nat], [V -> nat], [[nat, nat] -> nat],
         [[nat, nat] -> nat], [[nat, nat] -> nat]] ->
          [AExp -> nat]]

body:
  reduce_nat(N?_fun: [int -> nat], V?_fun: [V -> nat],
             Add?_fun: [[nat, nat] -> nat], Sub?_fun: [[nat, nat] -> nat],
             Mul?_fun: [[nat, nat] -> nat]):
        [AExp -> nat] =
      LAMBDA (AExp_adtvar: AExp):
        LET red: [AExp -> nat] =
              reduce_nat(N?_fun, V?_fun, Add?_fun, Sub?_fun, Mul?_fun)
          IN
          CASES AExp_adtvar
            OF N(N1_var): N?_fun(N1_var),
               V(V1_var): V?_fun(V1_var),
               Add(Add1_var, Add2_var):
                 Add?_fun(red(Add1_var), red(Add2_var)),
               Sub(Sub1_var, Sub2_var):
                 Sub?_fun(red(Sub1_var), red(Sub2_var)),
               Mul(Mul1_var, Mul2_var):
                 Mul?_fun(red(Mul1_var), red(Mul2_var))
            ENDCASES;


decl_type: function
theory: AExp
library: while
location: 208 0 226 999
signature:
  [[[[int, AExp] -> nat], [[V, AExp] -> nat],
         [[nat, nat, AExp] -> nat], [[nat, nat, AExp] -> nat],
         [[nat, nat, AExp] -> nat]] ->
          [AExp -> nat]]

body:
  REDUCE_nat(N?_fun: [[int, AExp] -> nat], V?_fun: [[V, AExp] -> nat],
             Add?_fun: [[nat, nat, AExp] -> nat],
             Sub?_fun: [[nat, nat, AExp] -> nat],
             Mul?_fun: [[nat, nat, AExp] -> nat]):
        [AExp -> nat] =
      LAMBDA (AExp_adtvar: AExp):
        LET red: [AExp -> nat] =
              REDUCE_nat(N?_fun, V?_fun, Add?_fun, Sub?_fun, Mul?_fun)
          IN
          CASES AExp_adtvar
            OF N(N1_var): N?_fun(N1_var, AExp_adtvar),
               V(V1_var): V?_fun(V1_var, AExp_adtvar),
               Add(Add1_var, Add2_var):
                 Add?_fun(red(Add1_var), red(Add2_var), AExp_adtvar),
               Sub(Sub1_var, Sub2_var):
                 Sub?_fun(red(Sub1_var), red(Sub2_var), AExp_adtvar),
               Mul(Mul1_var, Mul2_var):
                 Mul?_fun(red(Mul1_var), red(Mul2_var), AExp_adtvar)
            ENDCASES;


decl_type: function
theory: AExp
library: while
location: 228 0 246 999
signature:
  [[[int -> ordinal], [V -> ordinal],
         [[ordinal, ordinal] -> ordinal],
         [[ordinal, ordinal] -> ordinal],
         [[ordinal, ordinal] -> ordinal]] ->
          [AExp -> ordinal]]

body:
  reduce_ordinal(N?_fun: [int -> ordinal], V?_fun: [V -> ordinal],
                 Add?_fun: [[ordinal, ordinal] -> ordinal],
                 Sub?_fun: [[ordinal, ordinal] -> ordinal],
                 Mul?_fun: [[ordinal, ordinal] -> ordinal]):
        [AExp -> ordinal] =
      LAMBDA (AExp_adtvar: AExp):
        LET red: [AExp -> ordinal] =
              reduce_ordinal(N?_fun, V?_fun, Add?_fun, Sub?_fun, Mul?_fun)
          IN
          CASES AExp_adtvar
            OF N(N1_var): N?_fun(N1_var),
               V(V1_var): V?_fun(V1_var),
               Add(Add1_var, Add2_var):
                 Add?_fun(red(Add1_var), red(Add2_var)),
               Sub(Sub1_var, Sub2_var):
                 Sub?_fun(red(Sub1_var), red(Sub2_var)),
               Mul(Mul1_var, Mul2_var):
                 Mul?_fun(red(Mul1_var), red(Mul2_var))
            ENDCASES;


decl_type: function
theory: AExp
library: while
location: 248 0 267 999
signature:
  [[[[int, AExp] -> ordinal], [[V, AExp] -> ordinal],
         [[ordinal, ordinal, AExp] -> ordinal],
         [[ordinal, ordinal, AExp] -> ordinal],
         [[ordinal, ordinal, AExp] -> ordinal]] ->
          [AExp -> ordinal]]

body:
  REDUCE_ordinal(N?_fun: [[int, AExp] -> ordinal],
                 V?_fun: [[V, AExp] -> ordinal],
                 Add?_fun: [[ordinal, ordinal, AExp] -> ordinal],
                 Sub?_fun: [[ordinal, ordinal, AExp] -> ordinal],
                 Mul?_fun: [[ordinal, ordinal, AExp] -> ordinal]):
        [AExp -> ordinal] =
      LAMBDA (AExp_adtvar: AExp):
        LET red: [AExp -> ordinal] =
              REDUCE_ordinal(N?_fun, V?_fun, Add?_fun, Sub?_fun, Mul?_fun)
          IN
          CASES AExp_adtvar
            OF N(N1_var): N?_fun(N1_var, AExp_adtvar),
               V(V1_var): V?_fun(V1_var, AExp_adtvar),
               Add(Add1_var, Add2_var):
                 Add?_fun(red(Add1_var), red(Add2_var), AExp_adtvar),
               Sub(Sub1_var, Sub2_var):
                 Sub?_fun(red(Sub1_var), red(Sub2_var), AExp_adtvar),
               Mul(Mul1_var, Mul2_var):
                 Mul?_fun(red(Mul1_var), red(Mul2_var), AExp_adtvar)
            ENDCASES;


decl_type: function
theory: AExp
library: while
signature: [AExp -> [State[V] -> int]]
location: 30 2 38 35
body:
    A(a:AExp) : RECURSIVE [State->int] =
      LAMBDA s: cases a of
                        N(n) : n,
                        V(x) : s(x),
                        Add(a1,a2) : A(a1)(s) + A(a2)(s),
                        Sub(a1,a2) : A(a1)(s) - A(a2)(s),
                        Mul(a1,a2) : A(a1)(s) * A(a2)(s)
                      endcases
                      MEASURE a by <<


decl_type: constant
theory: AExp
library: while
signature: (strict_well_founded?[AExp])
location: 269 0 283 999
body:
  <<:  (strict_well_founded?[AExp]) =
      LAMBDA (x1, y: AExp):
        CASES y
          OF N(N1_var): FALSE,
             V(V1_var): FALSE,
             Add(Add1_var, Add2_var):
               (x1 = Add1_var OR x1 << Add1_var) OR
                x1 = Add2_var OR x1 << Add2_var,
             Sub(Sub1_var, Sub2_var):
               (x1 = Sub1_var OR x1 << Sub1_var) OR
                x1 = Sub2_var OR x1 << Sub2_var,
             Mul(Mul1_var, Mul2_var):
               (x1 = Mul1_var OR x1 << Mul1_var) OR
                x1 = Mul2_var OR x1 << Mul2_var
          ENDCASES;


decl_type: datatype
theory: AExp
library: while
signature: nil
location: 19 8 26 10
body:
    AExp: DATATYPE  
    BEGIN
      N(n:int)        : N?
      V(x:V)          : V?
      Add(a1,a2:AExp) : Add?
      Sub(a1,a2:AExp) : Sub?
      Mul(a1,a2:AExp) : Mul?
    END AExp


decl_type: tcc
theory: AExp
library: while
signature: nil
location: 285 0 287 999
body:
  % Termination TCC generated (at line 34, column 35) for  A(a1)
  A_TCC1: OBLIGATION
    FORALL (a: AExp, a1: AExp, a2: AExp): a = Add(a1, a2) IMPLIES a1 << a;


decl_type: tcc
theory: AExp
library: while
signature: nil
location: 289 0 291 999
body:
  % Termination TCC generated (at line 34, column 46) for  A(a2)
  A_TCC2: OBLIGATION
    FORALL (a: AExp, a1: AExp, a2: AExp): a = Add(a1, a2) IMPLIES a2 << a;


decl_type: tcc
theory: AExp
library: while
signature: nil
location: 293 0 295 999
body:
  % Termination TCC generated (at line 35, column 35) for  A(a1)
  A_TCC3: OBLIGATION
    FORALL (a: AExp, a1: AExp, a2: AExp): a = Sub(a1, a2) IMPLIES a1 << a;


decl_type: tcc
theory: AExp
library: while
signature: nil
location: 297 0 299 999
body:
  % Termination TCC generated (at line 35, column 46) for  A(a2)
  A_TCC4: OBLIGATION
    FORALL (a: AExp, a1: AExp, a2: AExp): a = Sub(a1, a2) IMPLIES a2 << a;


decl_type: tcc
theory: AExp
library: while
signature: nil
location: 301 0 303 999
body:
  % Termination TCC generated (at line 36, column 35) for  A(a1)
  A_TCC5: OBLIGATION
    FORALL (a: AExp, a1: AExp, a2: AExp): a = Mul(a1, a2) IMPLIES a1 << a;


decl_type: tcc
theory: AExp
library: while
signature: nil
location: 305 0 307 999
body:
  % Termination TCC generated (at line 36, column 46) for  A(a2)
  A_TCC6: OBLIGATION
    FORALL (a: AExp, a1: AExp, a2: AExp): a = Mul(a1, a2) IMPLIES a2 << a;


decl_type: formula
theory: BExp
library: while
signature: nil
location: 47 0 52 999
body:
  BExp_ord_defaxiom: AXIOM
         BExp_ord(TT) = 0 AND BExp_ord(FF) = 1
     AND (FORALL (a1: AExp, a2: AExp): BExp_ord(Eq(a1, a2)) = 2)
     AND (FORALL (a1: AExp, a2: AExp): BExp_ord(Le(a1, a2)) = 3)
     AND (FORALL (b: BExp): BExp_ord(Neg(b)) = 4)
     AND (FORALL (b1: BExp, b2: BExp): BExp_ord(Band(b1, b2)) = 5);


decl_type: formula
theory: BExp
library: while
signature: nil
location: 60 0 63 999
body:
  BExp_Eq_extensionality: AXIOM
    FORALL (Eq?_var: (Eq?), Eq?_var2: (Eq?)):
      a1(Eq?_var) = a1(Eq?_var2) AND a2(Eq?_var) = a2(Eq?_var2) IMPLIES
       Eq?_var = Eq?_var2;


decl_type: formula
theory: BExp
library: while
signature: nil
location: 68 0 71 999
body:
  BExp_Le_extensionality: AXIOM
    FORALL (Le?_var: (Le?), Le?_var2: (Le?)):
      a1(Le?_var) = a1(Le?_var2) AND a2(Le?_var) = a2(Le?_var2) IMPLIES
       Le?_var = Le?_var2;


decl_type: formula
theory: BExp
library: while
signature: nil
location: 76 0 78 999
body:
  BExp_Neg_extensionality: AXIOM
    FORALL (Neg?_var: (Neg?), Neg?_var2: (Neg?)):
      b(Neg?_var) = b(Neg?_var2) IMPLIES Neg?_var = Neg?_var2;


decl_type: formula
theory: BExp
library: while
signature: nil
location: 82 0 85 999
body:
  BExp_Band_extensionality: AXIOM
    FORALL (Band?_var: (Band?), Band?_var2: (Band?)):
      b1(Band?_var) = b1(Band?_var2) AND b2(Band?_var) = b2(Band?_var2)
       IMPLIES Band?_var = Band?_var2;


decl_type: formula
theory: BExp
library: while
signature: nil
location: 87 0 89 999
body:
  BExp_Band_eta: AXIOM
    FORALL (Band?_var: (Band?)):
      Band(b1(Band?_var), b2(Band?_var)) = Band?_var;


decl_type: formula
theory: BExp
library: while
signature: nil
location: 105 0 107 999
body:
  BExp_b1_Band: AXIOM
    FORALL (Band1_var: BExp, Band2_var: BExp):
      b1(Band(Band1_var, Band2_var)) = Band1_var;


decl_type: formula
theory: BExp
library: while
signature: nil
location: 109 0 111 999
body:
  BExp_b2_Band: AXIOM
    FORALL (Band1_var: BExp, Band2_var: BExp):
      b2(Band(Band1_var, Band2_var)) = Band2_var;


decl_type: formula
theory: BExp
library: while
signature: nil
location: 113 0 116 999
body:
  BExp_inclusive: AXIOM
    FORALL (BExp_var: BExp):
          TT?(BExp_var) OR FF?(BExp_var) OR Eq?(BExp_var) OR Le?(BExp_var)
       OR Neg?(BExp_var) OR Band?(BExp_var);


decl_type: formula
theory: BExp
library: while
signature: nil
location: 118 0 127 999
body:
  BExp_induction: AXIOM
    FORALL (p: [BExp -> boolean]):
      (     p(TT) AND p(FF)
        AND FORALL (Eq1_var: AExp, Eq2_var: AExp): p(Eq(Eq1_var, Eq2_var))
        AND FORALL (Le1_var: AExp, Le2_var: AExp): p(Le(Le1_var, Le2_var))
        AND FORALL (Neg1_var: BExp): p(Neg1_var) IMPLIES p(Neg(Neg1_var))
        AND FORALL (Band1_var: BExp, Band2_var: BExp):
              p(Band1_var) AND p(Band2_var) IMPLIES
               p(Band(Band1_var, Band2_var)))
       IMPLIES (FORALL (BExp_var: BExp): p(BExp_var));


decl_type: function
theory: BExp
library: while
signature: [BExp -> upto(5)]
location: 165 0 173 999
body:
  ord(x: BExp): [BExp -> upto(5)] =
      CASES x
        OF TT: 0,
           FF: 1,
           Eq(Eq1_var, Eq2_var): 2,
           Le(Le1_var, Le2_var): 3,
           Neg(Neg1_var): 4,
           Band(Band1_var, Band2_var): 5
        ENDCASES


decl_type: function
theory: BExp
library: while
signature: [[BExp, BExp] -> boolean]
location: 175 0 185 999
body:
  subterm(x: BExp, y: BExp):  boolean =
      x = y OR
       CASES y
         OF TT: FALSE,
            FF: FALSE,
            Eq(Eq1_var, Eq2_var): FALSE,
            Le(Le1_var, Le2_var): FALSE,
            Neg(Neg1_var): subterm(x, Neg1_var),
            Band(Band1_var, Band2_var):
              subterm(x, Band1_var) OR subterm(x, Band2_var)
         ENDCASES;


decl_type: function
theory: BExp
library: while
location: 187 0 205 999
signature:
  [[nat, nat, [[AExp[V], AExp[V]] -> nat],
         [[AExp[V], AExp[V]] -> nat], [nat -> nat],
         [[nat, nat] -> nat]] ->
          [BExp -> nat]]

body:
  reduce_nat(TT?_fun: nat, FF?_fun: nat,
             Eq?_fun: [[AExp[V], AExp[V]] -> nat],
             Le?_fun: [[AExp[V], AExp[V]] -> nat], Neg?_fun: [nat -> nat],
             Band?_fun: [[nat, nat] -> nat]):
        [BExp -> nat] =
      LAMBDA (BExp_adtvar: BExp):
        LET red: [BExp -> nat] =
              reduce_nat(TT?_fun, FF?_fun, Eq?_fun, Le?_fun, Neg?_fun,
                         Band?_fun)
          IN
          CASES BExp_adtvar
            OF TT: TT?_fun,
               FF: FF?_fun,
               Eq(Eq1_var, Eq2_var): Eq?_fun(Eq1_var, Eq2_var),
               Le(Le1_var, Le2_var): Le?_fun(Le1_var, Le2_var),
               Neg(Neg1_var): Neg?_fun(red(Neg1_var)),
               Band(Band1_var, Band2_var):
                 Band?_fun(red(Band1_var), red(Band2_var))
            ENDCASES;


decl_type: function
theory: BExp
library: while
location: 207 0 226 999
signature:
  [[[BExp -> nat], [BExp -> nat], [[AExp[V], AExp[V], BExp] -> nat],
         [[AExp[V], AExp[V], BExp] -> nat], [[nat, BExp] -> nat],
         [[nat, nat, BExp] -> nat]] ->
          [BExp -> nat]]

body:
  REDUCE_nat(TT?_fun: [BExp -> nat], FF?_fun: [BExp -> nat],
             Eq?_fun: [[AExp[V], AExp[V], BExp] -> nat],
             Le?_fun: [[AExp[V], AExp[V], BExp] -> nat],
             Neg?_fun: [[nat, BExp] -> nat],
             Band?_fun: [[nat, nat, BExp] -> nat]):
        [BExp -> nat] =
      LAMBDA (BExp_adtvar: BExp):
        LET red: [BExp -> nat] =
              REDUCE_nat(TT?_fun, FF?_fun, Eq?_fun, Le?_fun, Neg?_fun,
                         Band?_fun)
          IN
          CASES BExp_adtvar
            OF TT: TT?_fun(BExp_adtvar),
               FF: FF?_fun(BExp_adtvar),
               Eq(Eq1_var, Eq2_var): Eq?_fun(Eq1_var, Eq2_var, BExp_adtvar),
               Le(Le1_var, Le2_var): Le?_fun(Le1_var, Le2_var, BExp_adtvar),
               Neg(Neg1_var): Neg?_fun(red(Neg1_var), BExp_adtvar),
               Band(Band1_var, Band2_var):
                 Band?_fun(red(Band1_var), red(Band2_var), BExp_adtvar)
            ENDCASES;


decl_type: function
theory: BExp
library: while
location: 228 0 247 999
signature:
  [[ordinal, ordinal, [[AExp[V], AExp[V]] -> ordinal],
         [[AExp[V], AExp[V]] -> ordinal], [ordinal -> ordinal],
         [[ordinal, ordinal] -> ordinal]] ->
          [BExp -> ordinal]]

body:
  reduce_ordinal(TT?_fun: ordinal, FF?_fun: ordinal,
                 Eq?_fun: [[AExp[V], AExp[V]] -> ordinal],
                 Le?_fun: [[AExp[V], AExp[V]] -> ordinal],
                 Neg?_fun: [ordinal -> ordinal],
                 Band?_fun: [[ordinal, ordinal] -> ordinal]):
        [BExp -> ordinal] =
      LAMBDA (BExp_adtvar: BExp):
        LET red: [BExp -> ordinal] =
              reduce_ordinal(TT?_fun, FF?_fun, Eq?_fun, Le?_fun, Neg?_fun,
                             Band?_fun)
          IN
          CASES BExp_adtvar
            OF TT: TT?_fun,
               FF: FF?_fun,
               Eq(Eq1_var, Eq2_var): Eq?_fun(Eq1_var, Eq2_var),
               Le(Le1_var, Le2_var): Le?_fun(Le1_var, Le2_var),
               Neg(Neg1_var): Neg?_fun(red(Neg1_var)),
               Band(Band1_var, Band2_var):
                 Band?_fun(red(Band1_var), red(Band2_var))
            ENDCASES;


decl_type: function
theory: BExp
library: while
location: 249 0 268 999
signature:
  [[[BExp -> ordinal], [BExp -> ordinal],
         [[AExp[V], AExp[V], BExp] -> ordinal],
         [[AExp[V], AExp[V], BExp] -> ordinal],
         [[ordinal, BExp] -> ordinal],
         [[ordinal, ordinal, BExp] -> ordinal]] ->
          [BExp -> ordinal]]

body:
  REDUCE_ordinal(TT?_fun: [BExp -> ordinal], FF?_fun: [BExp -> ordinal],
                 Eq?_fun: [[AExp[V], AExp[V], BExp] -> ordinal],
                 Le?_fun: [[AExp[V], AExp[V], BExp] -> ordinal],
                 Neg?_fun: [[ordinal, BExp] -> ordinal],
                 Band?_fun: [[ordinal, ordinal, BExp] -> ordinal]):
        [BExp -> ordinal] =
      LAMBDA (BExp_adtvar: BExp):
        LET red: [BExp -> ordinal] =
              REDUCE_ordinal(TT?_fun, FF?_fun, Eq?_fun, Le?_fun, Neg?_fun,
                             Band?_fun)
          IN
          CASES BExp_adtvar
            OF TT: TT?_fun(BExp_adtvar),
               FF: FF?_fun(BExp_adtvar),
               Eq(Eq1_var, Eq2_var): Eq?_fun(Eq1_var, Eq2_var, BExp_adtvar),
               Le(Le1_var, Le2_var): Le?_fun(Le1_var, Le2_var, BExp_adtvar),
               Neg(Neg1_var): Neg?_fun(red(Neg1_var), BExp_adtvar),
               Band(Band1_var, Band2_var):
                 Band?_fun(red(Band1_var), red(Band2_var), BExp_adtvar)
            ENDCASES;


decl_type: function
theory: BExp
library: while
signature: [BExp -> [State[V] -> bool]]
location: 31 2 40 35
body:
    B(b:BExp) : RECURSIVE [State->bool] =
      LAMBDA s: cases b of
                        TT         : True,
                        FF         : False,
                        Eq(a1,a2)  : A(a1)(s) =  A(a2)(s),
                        Le(a1,a2)  : A(a1)(s) <= A(a2)(s),
                        Neg(b)     : NOT (B(b)(s)),
                        Band(b1,b2): B(b1)(s) AND B(b2)(s)
                      endcases
                      MEASURE b by <<


decl_type: constant
theory: BExp
library: while
signature: (strict_well_founded?[BExp])
location: 274 0 285 999
body:
  <<:  (strict_well_founded?[BExp]) =
      LAMBDA (x, y: BExp):
        CASES y
          OF TT: FALSE,
             FF: FALSE,
             Eq(Eq1_var, Eq2_var): FALSE,
             Le(Le1_var, Le2_var): FALSE,
             Neg(Neg1_var): x = Neg1_var OR x << Neg1_var,
             Band(Band1_var, Band2_var):
               (x = Band1_var OR x << Band1_var) OR
                x = Band2_var OR x << Band2_var
          ENDCASES;


decl_type: datatype
theory: BExp
library: while
signature: nil
location: 21 8 29 10
body:
    BExp: DATATYPE  
    BEGIN
      TT               : TT?
      FF               : FF?
      Eq(a1,a2:AExp)   : Eq?
      Le(a1,a2:AExp)   : Le?
      Neg(b:BExp)      : Neg?
      Band(b1,b2:BExp) : Band?
    END BExp


decl_type: tcc
theory: BExp
library: while
signature: nil
location: 287 0 288 999
body:
  % Termination TCC generated (at line 37, column 40) for  B(b)
  B_TCC1: OBLIGATION FORALL (b: BExp, b1: BExp): b = Neg(b1) IMPLIES b1 << b;


decl_type: tcc
theory: BExp
library: while
signature: nil
location: 290 0 292 999
body:
  % Termination TCC generated (at line 38, column 35) for  B(b1)
  B_TCC2: OBLIGATION
    FORALL (b: BExp, b1: BExp, b2: BExp): b = Band(b1, b2) IMPLIES b1 << b;


decl_type: tcc
theory: BExp
library: while
signature: nil
location: 294 0 298 999
body:
  % Termination TCC generated (at line 38, column 48) for  B(b2)
  B_TCC3: OBLIGATION
    FORALL (b: BExp, v: [{z: BExp | z << b} -> [State[V] -> bool]], s,
            b1: BExp, b2: BExp):
      v(b1)(s) AND b = Band(b1, b2) IMPLIES b2 << b;


decl_type: formula
theory: Stm
library: while
signature: nil
location: 60 0 66 999
body:
  Stm_ord_defaxiom: AXIOM
         (FORALL (x: V, a: AExp): Stm_ord(Assign(x, a)) = 0)
     AND Stm_ord(Skip) = 1
     AND (FORALL (S1: Stm, S2: Stm): Stm_ord(Sequence(S1, S2)) = 2)
     AND (FORALL (b: BExp, S1: Stm, S2: Stm):
            Stm_ord(Conditional(b, S1, S2)) = 3)
     AND (FORALL (b: BExp, S1: Stm): Stm_ord(While(b, S1)) = 4);


decl_type: formula
theory: Stm
library: while
signature: nil
location: 68 0 71 999
body:
  Stm_Assign_extensionality: AXIOM
    FORALL (Assign?_var: (Assign?), Assign?_var2: (Assign?)):
      x(Assign?_var) = x(Assign?_var2) AND a(Assign?_var) = a(Assign?_var2)
       IMPLIES Assign?_var = Assign?_var2;


decl_type: formula
theory: Stm
library: while
signature: nil
location: 73 0 75 999
body:
  Stm_Assign_eta: AXIOM
    FORALL (Assign?_var: (Assign?)):
      Assign(x(Assign?_var), a(Assign?_var)) = Assign?_var;


decl_type: formula
theory: Stm
library: while
signature: nil
location: 77 0 78 999
body:
  Stm_Skip_extensionality: AXIOM
    FORALL (Skip?_var: (Skip?), Skip?_var2: (Skip?)): Skip?_var = Skip?_var2;


decl_type: formula
theory: Stm
library: while
signature: nil
location: 80 0 84 999
body:
  Stm_Sequence_extensionality: AXIOM
    FORALL (Sequence?_var: (Sequence?), Sequence?_var2: (Sequence?)):
      S1(Sequence?_var) = S1(Sequence?_var2) AND
       S2(Sequence?_var) = S2(Sequence?_var2)
       IMPLIES Sequence?_var = Sequence?_var2;


decl_type: formula
theory: Stm
library: while
signature: nil
location: 86 0 88 999
body:
  Stm_Sequence_eta: AXIOM
    FORALL (Sequence?_var: (Sequence?)):
      Sequence(S1(Sequence?_var), S2(Sequence?_var)) = Sequence?_var;


decl_type: formula
theory: Stm
library: while
signature: nil
location: 90 0 96 999
body:
  Stm_Conditional_extensionality: AXIOM
    FORALL (Conditional?_var: (Conditional?),
            Conditional?_var2: (Conditional?)):
      b(Conditional?_var) = b(Conditional?_var2) AND
       S1(Conditional?_var) = S1(Conditional?_var2) AND
        S2(Conditional?_var) = S2(Conditional?_var2)
       IMPLIES Conditional?_var = Conditional?_var2;


decl_type: formula
theory: Stm
library: while
signature: nil
location: 98 0 102 999
body:
  Stm_Conditional_eta: AXIOM
    FORALL (Conditional?_var: (Conditional?)):
      Conditional(b(Conditional?_var), S1(Conditional?_var),
                  S2(Conditional?_var))
       = Conditional?_var;


decl_type: formula
theory: Stm
library: while
signature: nil
location: 104 0 107 999
body:
  Stm_While_extensionality: AXIOM
    FORALL (While?_var: (While?), While?_var2: (While?)):
      b(While?_var) = b(While?_var2) AND S1(While?_var) = S1(While?_var2)
       IMPLIES While?_var = While?_var2;


decl_type: formula
theory: Stm
library: while
signature: nil
location: 109 0 111 999
body:
  Stm_While_eta: AXIOM
    FORALL (While?_var: (While?)):
      While(b(While?_var), S1(While?_var)) = While?_var;


decl_type: formula
theory: Stm
library: while
signature: nil
location: 113 0 115 999
body:
  Stm_x_Assign: AXIOM
    FORALL (Assign1_var: V, Assign2_var: AExp):
      x(Assign(Assign1_var, Assign2_var)) = Assign1_var;


decl_type: formula
theory: Stm
library: while
signature: nil
location: 117 0 119 999
body:
  Stm_a_Assign: AXIOM
    FORALL (Assign1_var: V, Assign2_var: AExp):
      a(Assign(Assign1_var, Assign2_var)) = Assign2_var;


decl_type: formula
theory: Stm
library: while
signature: nil
location: 121 0 123 999
body:
  Stm_S1_Sequence: AXIOM
    FORALL (Sequence1_var: Stm, Sequence2_var: Stm):
      S1(Sequence(Sequence1_var, Sequence2_var)) = Sequence1_var;


decl_type: formula
theory: Stm
library: while
signature: nil
location: 125 0 127 999
body:
  Stm_S2_Sequence: AXIOM
    FORALL (Sequence1_var: Stm, Sequence2_var: Stm):
      S2(Sequence(Sequence1_var, Sequence2_var)) = Sequence2_var;


decl_type: formula
theory: Stm
library: while
signature: nil
location: 129 0 133 999
body:
  Stm_b_Conditional: AXIOM
    FORALL (Conditional1_var: BExp, Conditional2_var: Stm,
            Conditional3_var: Stm):
      b(Conditional(Conditional1_var, Conditional2_var, Conditional3_var)) =
       Conditional1_var;


decl_type: formula
theory: Stm
library: while
signature: nil
location: 135 0 139 999
body:
  Stm_S1_Conditional: AXIOM
    FORALL (Conditional1_var: BExp, Conditional2_var: Stm,
            Conditional3_var: Stm):
      S1(Conditional(Conditional1_var, Conditional2_var, Conditional3_var)) =
       Conditional2_var;


decl_type: formula
theory: Stm
library: while
signature: nil
location: 141 0 145 999
body:
  Stm_S2_Conditional: AXIOM
    FORALL (Conditional1_var: BExp, Conditional2_var: Stm,
            Conditional3_var: Stm):
      S2(Conditional(Conditional1_var, Conditional2_var, Conditional3_var)) =
       Conditional3_var;


decl_type: formula
theory: Stm
library: while
signature: nil
location: 147 0 149 999
body:
  Stm_b_While: AXIOM
    FORALL (While1_var: BExp, While2_var: Stm):
      b(While(While1_var, While2_var)) = While1_var;


decl_type: formula
theory: Stm
library: while
signature: nil
location: 151 0 153 999
body:
  Stm_S1_While: AXIOM
    FORALL (While1_var: BExp, While2_var: Stm):
      S1(While(While1_var, While2_var)) = While2_var;


decl_type: formula
theory: Stm
library: while
signature: nil
location: 155 0 158 999
body:
  Stm_inclusive: AXIOM
    FORALL (Stm_var: Stm):
          Assign?(Stm_var) OR Skip?(Stm_var) OR Sequence?(Stm_var)
       OR Conditional?(Stm_var) OR While?(Stm_var);


decl_type: formula
theory: Stm
library: while
signature: nil
location: 160 0 175 999
body:
  Stm_induction: AXIOM
    FORALL (p: [Stm -> boolean]):
      (     FORALL (Assign1_var: V, Assign2_var: AExp):
              p(Assign(Assign1_var, Assign2_var))
        AND p(Skip)
        AND FORALL (Sequence1_var: Stm, Sequence2_var: Stm):
              p(Sequence1_var) AND p(Sequence2_var) IMPLIES
               p(Sequence(Sequence1_var, Sequence2_var))
        AND FORALL (Conditional1_var: BExp, Conditional2_var: Stm,
                    Conditional3_var: Stm):
              p(Conditional2_var) AND p(Conditional3_var) IMPLIES
               p(Conditional(Conditional1_var, Conditional2_var,
                             Conditional3_var))
        AND FORALL (While1_var: BExp, While2_var: Stm):
              p(While2_var) IMPLIES p(While(While1_var, While2_var)))
       IMPLIES (FORALL (Stm_var: Stm): p(Stm_var));


decl_type: formula
theory: Stm
library: while
signature: nil
location: 46 2 53 31
body:
    structural_induction: LEMMA
                 (FORALL x,a:                        p(Assign(x,a)))          AND
                                                     p(Skip)                  AND
                 (FORALL S1,S2:   p(S1) AND p(S2) => p(Sequence(S1,S2)))      AND
                 (FORALL b,S1,S2: p(S1) AND p(S2) => p(Conditional(b,S1,S2))) AND
                 (FORALL b,S1:    p(S1)           => p(While(b,S1)))
      IMPLIES
                 (FORALL S: p(S))


decl_type: function
theory: Stm
library: while
signature: [Stm -> upto(4)]
location: 211 0 219 999
body:
  ord(x1: Stm): [Stm -> upto(4)] =
      CASES x1
        OF Assign(Assign1_var, Assign2_var): 0,
           Skip: 1,
           Sequence(Sequence1_var, Sequence2_var): 2,
           Conditional(Conditional1_var, Conditional2_var, Conditional3_var):
             3,
           While(While1_var, While2_var): 4
        ENDCASES


decl_type: function
theory: Stm
library: while
signature: [[Stm, Stm] -> boolean]
location: 221 0 232 999
body:
  subterm(x1: Stm, y: Stm):  boolean =
      x1 = y OR
       CASES y
         OF Assign(Assign1_var, Assign2_var): FALSE,
            Skip: FALSE,
            Sequence(Sequence1_var, Sequence2_var):
              subterm(x1, Sequence1_var) OR subterm(x1, Sequence2_var),
            Conditional(Conditional1_var, Conditional2_var,
                        Conditional3_var):
              subterm(x1, Conditional2_var) OR subterm(x1, Conditional3_var),
            While(While1_var, While2_var): subterm(x1, While2_var)
         ENDCASES;


decl_type: function
theory: Stm
library: while
location: 234 0 256 999
signature:
  [[[[V, AExp[V]] -> nat], nat, [[nat, nat] -> nat],
         [[BExp[V], nat, nat] -> nat], [[BExp[V], nat] -> nat]] ->
          [Stm -> nat]]

body:
  reduce_nat(Assign?_fun: [[V, AExp[V]] -> nat], Skip?_fun: nat,
             Sequence?_fun: [[nat, nat] -> nat],
             Conditional?_fun: [[BExp[V], nat, nat] -> nat],
             While?_fun: [[BExp[V], nat] -> nat]):
        [Stm -> nat] =
      LAMBDA (Stm_adtvar: Stm):
        LET red: [Stm -> nat] =
              reduce_nat(Assign?_fun, Skip?_fun, Sequence?_fun,
                         Conditional?_fun, While?_fun)
          IN
          CASES Stm_adtvar
            OF Assign(Assign1_var, Assign2_var):
                 Assign?_fun(Assign1_var, Assign2_var),
               Skip: Skip?_fun,
               Sequence(Sequence1_var, Sequence2_var):
                 Sequence?_fun(red(Sequence1_var), red(Sequence2_var)),
               Conditional(Conditional1_var, Conditional2_var,
                           Conditional3_var):
                 Conditional?_fun(Conditional1_var, red(Conditional2_var),
                                  red(Conditional3_var)),
               While(While1_var, While2_var):
                 While?_fun(While1_var, red(While2_var))
            ENDCASES;


decl_type: function
theory: Stm
library: while
location: 258 0 282 999
signature:
  [[[[V, AExp[V], Stm] -> nat], [Stm -> nat],
         [[nat, nat, Stm] -> nat], [[BExp[V], nat, nat, Stm] -> nat],
         [[BExp[V], nat, Stm] -> nat]] ->
          [Stm -> nat]]

body:
  REDUCE_nat(Assign?_fun: [[V, AExp[V], Stm] -> nat],
             Skip?_fun: [Stm -> nat],
             Sequence?_fun: [[nat, nat, Stm] -> nat],
             Conditional?_fun: [[BExp[V], nat, nat, Stm] -> nat],
             While?_fun: [[BExp[V], nat, Stm] -> nat]):
        [Stm -> nat] =
      LAMBDA (Stm_adtvar: Stm):
        LET red: [Stm -> nat] =
              REDUCE_nat(Assign?_fun, Skip?_fun, Sequence?_fun,
                         Conditional?_fun, While?_fun)
          IN
          CASES Stm_adtvar
            OF Assign(Assign1_var, Assign2_var):
                 Assign?_fun(Assign1_var, Assign2_var, Stm_adtvar),
               Skip: Skip?_fun(Stm_adtvar),
               Sequence(Sequence1_var, Sequence2_var):
                 Sequence?_fun(red(Sequence1_var), red(Sequence2_var),
                               Stm_adtvar),
               Conditional(Conditional1_var, Conditional2_var,
                           Conditional3_var):
                 Conditional?_fun(Conditional1_var, red(Conditional2_var),
                                  red(Conditional3_var), Stm_adtvar),
               While(While1_var, While2_var):
                 While?_fun(While1_var, red(While2_var), Stm_adtvar)
            ENDCASES;


decl_type: function
theory: Stm
library: while
location: 284 0 306 999
signature:
  [[[[V, AExp[V]] -> ordinal], ordinal,
         [[ordinal, ordinal] -> ordinal],
         [[BExp[V], ordinal, ordinal] -> ordinal],
         [[BExp[V], ordinal] -> ordinal]] ->
          [Stm -> ordinal]]

body:
  reduce_ordinal(Assign?_fun: [[V, AExp[V]] -> ordinal], Skip?_fun: ordinal,
                 Sequence?_fun: [[ordinal, ordinal] -> ordinal],
                 Conditional?_fun: [[BExp[V], ordinal, ordinal] -> ordinal],
                 While?_fun: [[BExp[V], ordinal] -> ordinal]):
        [Stm -> ordinal] =
      LAMBDA (Stm_adtvar: Stm):
        LET red: [Stm -> ordinal] =
              reduce_ordinal(Assign?_fun, Skip?_fun, Sequence?_fun,
                             Conditional?_fun, While?_fun)
          IN
          CASES Stm_adtvar
            OF Assign(Assign1_var, Assign2_var):
                 Assign?_fun(Assign1_var, Assign2_var),
               Skip: Skip?_fun,
               Sequence(Sequence1_var, Sequence2_var):
                 Sequence?_fun(red(Sequence1_var), red(Sequence2_var)),
               Conditional(Conditional1_var, Conditional2_var,
                           Conditional3_var):
                 Conditional?_fun(Conditional1_var, red(Conditional2_var),
                                  red(Conditional3_var)),
               While(While1_var, While2_var):
                 While?_fun(While1_var, red(While2_var))
            ENDCASES;


decl_type: function
theory: Stm
library: while
location: 308 0 333 999
signature:
  [[[[V, AExp[V], Stm] -> ordinal], [Stm -> ordinal],
         [[ordinal, ordinal, Stm] -> ordinal],
         [[BExp[V], ordinal, ordinal, Stm] -> ordinal],
         [[BExp[V], ordinal, Stm] -> ordinal]] ->
          [Stm -> ordinal]]

body:
  REDUCE_ordinal(Assign?_fun: [[V, AExp[V], Stm] -> ordinal],
                 Skip?_fun: [Stm -> ordinal],
                 Sequence?_fun: [[ordinal, ordinal, Stm] -> ordinal],
                 Conditional?_fun:
                   [[BExp[V], ordinal, ordinal, Stm] -> ordinal],
                 While?_fun: [[BExp[V], ordinal, Stm] -> ordinal]):
        [Stm -> ordinal] =
      LAMBDA (Stm_adtvar: Stm):
        LET red: [Stm -> ordinal] =
              REDUCE_ordinal(Assign?_fun, Skip?_fun, Sequence?_fun,
                             Conditional?_fun, While?_fun)
          IN
          CASES Stm_adtvar
            OF Assign(Assign1_var, Assign2_var):
                 Assign?_fun(Assign1_var, Assign2_var, Stm_adtvar),
               Skip: Skip?_fun(Stm_adtvar),
               Sequence(Sequence1_var, Sequence2_var):
                 Sequence?_fun(red(Sequence1_var), red(Sequence2_var),
                               Stm_adtvar),
               Conditional(Conditional1_var, Conditional2_var,
                           Conditional3_var):
                 Conditional?_fun(Conditional1_var, red(Conditional2_var),
                                  red(Conditional3_var), Stm_adtvar),
               While(While1_var, While2_var):
                 While?_fun(While1_var, red(While2_var), Stm_adtvar)
            ENDCASES;


decl_type: function
theory: Stm
library: while
signature: [Stm -> nat]
location: 34 2 42 20
body:
    Stm_measure(S): RECURSIVE nat =
       cases S of
         Assign(x,a)          : 0,
         Skip                 : 0,
         Sequence(S1,S2)      : max(Stm_measure(S1),Stm_measure(S2))+1,
         Conditional(b,S1,S2) : max(Stm_measure(S1),Stm_measure(S2))+1,
         While(b,S1)          : Stm_measure(S1)+1
       endcases
       MEASURE S by <<


decl_type: constant
theory: Stm
library: while
signature: (strict_well_founded?[Stm])
location: 337 0 351 999
body:
  <<:  (strict_well_founded?[Stm]) =
      LAMBDA (x1, y: Stm):
        CASES y
          OF Assign(Assign1_var, Assign2_var): FALSE,
             Skip: FALSE,
             Sequence(Sequence1_var, Sequence2_var):
               (x1 = Sequence1_var OR x1 << Sequence1_var) OR
                x1 = Sequence2_var OR x1 << Sequence2_var,
             Conditional(Conditional1_var, Conditional2_var,
                         Conditional3_var):
               (x1 = Conditional2_var OR x1 << Conditional2_var) OR
                x1 = Conditional3_var OR x1 << Conditional3_var,
             While(While1_var, While2_var):
               x1 = While2_var OR x1 << While2_var
          ENDCASES;


decl_type: datatype
theory: Stm
library: while
signature: nil
location: 19 7 26 9
body:
    Stm: DATATYPE  
    BEGIN
      Assign(x:V,a:AExp)            : Assign?
      Skip                          : Skip?
      Sequence(S1,S2:Stm)           : Sequence?
      Conditional(b:BExp,S1,S2:Stm) : Conditional?
      While(b:BExp,S1:Stm)          : While?
    END Stm


decl_type: tcc
theory: Stm
library: while
signature: nil
location: 353 0 355 999
body:
  % Termination TCC generated (at line 38, column 34) for  Stm_measure(S1)
  Stm_measure_TCC1: OBLIGATION
    FORALL (S: Stm, S1: Stm, S2: Stm): S = Sequence(S1, S2) IMPLIES S1 << S;


decl_type: tcc
theory: Stm
library: while
signature: nil
location: 357 0 359 999
body:
  % Termination TCC generated (at line 38, column 50) for  Stm_measure(S2)
  Stm_measure_TCC2: OBLIGATION
    FORALL (S: Stm, S1: Stm, S2: Stm): S = Sequence(S1, S2) IMPLIES S2 << S;


decl_type: tcc
theory: Stm
library: while
signature: nil
location: 361 0 364 999
body:
  % Termination TCC generated (at line 39, column 34) for  Stm_measure(S1)
  Stm_measure_TCC3: OBLIGATION
    FORALL (S: Stm, b: BExp[V], S1: Stm, S2: Stm):
      S = Conditional(b, S1, S2) IMPLIES S1 << S;


decl_type: tcc
theory: Stm
library: while
signature: nil
location: 366 0 369 999
body:
  % Termination TCC generated (at line 39, column 50) for  Stm_measure(S2)
  Stm_measure_TCC4: OBLIGATION
    FORALL (S: Stm, b: BExp[V], S1: Stm, S2: Stm):
      S = Conditional(b, S1, S2) IMPLIES S2 << S;


decl_type: tcc
theory: Stm
library: while
signature: nil
location: 371 0 373 999
body:
  % Termination TCC generated (at line 40, column 30) for  Stm_measure(S1)
  Stm_measure_TCC5: OBLIGATION
    FORALL (S: Stm, b: BExp[V], S1: Stm): S = While(b, S1) IMPLIES S1 << S;


decl_type: tcc
theory: Stm
library: while
signature: nil
location: 375 0 379 999
body:
  % Subtype TCC generated (at line 44, column 50) for
      % restrict[[real, real], [nat, nat], boolean](<)
      % expected type  (well_founded?[nat])
  IMP_measure_induction_TCC1: OBLIGATION
    well_founded?[nat](restrict[[real, real], [nat, nat], boolean](<));


decl_type: formula
theory: continuation
library: while
signature: nil
location: 37 2 38 79
body:
    assign_continuous:      LEMMA
                      scott_continuous?(LAMBDA c: LAMBDA s: c(assign(x,A(a))(s)))


decl_type: formula
theory: continuation
library: while
signature: nil
location: 39 2 40 79
body:
    conditional_continuous: LEMMA
                         scott_continuous?(LAMBDA c: conditional(B(b),f(c),g(c)))


decl_type: function
theory: continuation
library: while
signature: [Stm[V] -> (scott_continuous?[Cont, Cont, (sq_le), (sq_le)])]
location: 45 2 53 28
body:
    SS(S) : RECURSIVE (scott_continuous?[Cont,Cont,(sq_le),(sq_le)]) =
      cases S of
        Assign(x,a)          : (LAMBDA c: LAMBDA s: c(assign(x,A(a))(s))),
        Skip                 : I[Cont],
        Sequence(S1,S2)      : SS(S1) o SS(S2),
        Conditional(b,S1,S2) : LAMBDA c: conditional(B(b),SS(S1)(c),SS(S2)(c)),
        While(b,S1)          :
                 fix(LAMBDA g: LAMBDA c: conditional(B(b),SS(S1)(g(c)), c))
      endcases MEASURE S by <<


decl_type: tcc
theory: continuation
library: while
signature: nil
location: 60 0 66 999
body:
  % Existence TCC generated (at line 24, column 12) for
      % scott@fixpoints
      %     [scott_continuous[Cont, Cont, (sq_le), (sq_le)],
      %      continuous_pointwise(sq_le, sq_le)]
  IMP_fixpoints_TCC1: OBLIGATION
    EXISTS (x: scott_continuous[Cont[V], Cont[V], (sq_le[V]), (sq_le[V])]):
      TRUE;


decl_type: tcc
theory: continuation
library: while
signature: nil
location: 68 0 75 999
body:
  % Subtype TCC generated (at line 47, column 30) for
      % (LAMBDA c: LAMBDA s: c(assign(x, A(a))(s)))
      % expected type  (scott_continuous?[Cont, Cont, (sq_le), (sq_le)])
  SS_TCC1: OBLIGATION
    FORALL (S: Stm[V], x: V, a: AExp[V]):
      S = Assign(x, a) IMPLIES
       scott_continuous?[Cont[V], Cont[V], (sq_le[V]), (sq_le[V])]
           ((LAMBDA c: LAMBDA s: c(assign[V](x, A[V](a))(s))));


decl_type: tcc
theory: continuation
library: while
signature: nil
location: 77 0 80 999
body:
  % Termination TCC generated (at line 49, column 29) for  SS(S1)
  SS_TCC2: OBLIGATION
    FORALL (S: Stm[V], S1: Stm[V], S2: Stm[V]):
      S = Sequence(S1, S2) IMPLIES <<[V](S1, S);


decl_type: tcc
theory: continuation
library: while
signature: nil
location: 82 0 85 999
body:
  % Termination TCC generated (at line 49, column 38) for  SS(S2)
  SS_TCC3: OBLIGATION
    FORALL (S: Stm[V], S1: Stm[V], S2: Stm[V]):
      S = Sequence(S1, S2) IMPLIES <<[V](S2, S);


decl_type: tcc
theory: continuation
library: while
signature: nil
location: 87 0 90 999
body:
  % Termination TCC generated (at line 50, column 56) for  SS(S1)
  SS_TCC4: OBLIGATION
    FORALL (S: Stm[V], b: BExp[V], S1: Stm[V], S2: Stm[V]):
      S = Conditional(b, S1, S2) IMPLIES <<[V](S1, S);


decl_type: tcc
theory: continuation
library: while
signature: nil
location: 92 0 95 999
body:
  % Termination TCC generated (at line 50, column 66) for  SS(S2)
  SS_TCC5: OBLIGATION
    FORALL (S: Stm[V], b: BExp[V], S1: Stm[V], S2: Stm[V]):
      S = Conditional(b, S1, S2) IMPLIES <<[V](S2, S);


decl_type: tcc
theory: continuation
library: while
signature: nil
location: 97 0 108 999
body:
  % Subtype TCC generated (at line 50, column 29) for
      % LAMBDA c: conditional(B(b), SS(S1)(c), SS(S2)(c))
      % expected type  (scott_continuous?[Cont, Cont, (sq_le), (sq_le)])
  SS_TCC6: OBLIGATION
    FORALL (S: Stm[V],
            v:
              [{z: Stm[V] | z << S} ->
                 (scott_continuous?[Cont, Cont, (sq_le), (sq_le)])],
            b: BExp[V], S1: Stm[V], S2: Stm[V]):
      S = Conditional(b, S1, S2) IMPLIES
       scott_continuous?[Cont[V], Cont[V], (sq_le[V]), (sq_le[V])]
           (LAMBDA c: conditional[V](B[V](b), v(S1)(c), v(S2)(c)));


decl_type: tcc
theory: continuation
library: while
signature: nil
location: 110 0 113 999
body:
  % Termination TCC generated (at line 52, column 56) for  SS(S1)
  SS_TCC7: OBLIGATION
    FORALL (S: Stm[V], b: BExp[V], S1: Stm[V]):
      S = While(b, S1) IMPLIES <<[V](S1, S);


decl_type: tcc
theory: continuation
library: while
signature: nil
location: 115 0 127 999
body:
  % Subtype TCC generated (at line 52, column 29) for
      % LAMBDA c: conditional(B(b), SS(S1)(g(c)), c)
      % expected type  scott_continuous[Cont, Cont, (sq_le), (sq_le)]
  SS_TCC8: OBLIGATION
    FORALL (S: Stm[V],
            v:
              [{z: Stm[V] | z << S} ->
                 (scott_continuous?[Cont, Cont, (sq_le), (sq_le)])],
            b: BExp[V], S1: Stm[V]):
      S = While(b, S1) IMPLIES
       (FORALL (g):
          (scott_continuous?[Cont, Cont, (sq_le), (sq_le)])
              (LAMBDA c: conditional[V](B[V](b), v(S1)(g(c)), c)));


decl_type: tcc
theory: continuation
library: while
signature: nil
location: 129 0 144 999
body:
  % Subtype TCC generated (at line 52, column 19) for
      % LAMBDA g: LAMBDA c: conditional(B(b), SS(S1)(g(c)), c)
      % expected type  (increasing?)
  SS_TCC9: OBLIGATION
    FORALL (S: Stm[V],
            v:
              [{z: Stm[V] | z << S} ->
                 (scott_continuous?[Cont, Cont, (sq_le), (sq_le)])],
            b: BExp[V], S1: Stm[V]):
      S = While(b, S1) IMPLIES
       increasing?
           [scott_continuous[Cont, Cont, (sq_le), (sq_le)],
            scott_continuous[Cont, Cont, (sq_le), (sq_le)],
            continuous_pointwise(sq_le, sq_le),
            continuous_pointwise(sq_le, sq_le)]
           (LAMBDA g: LAMBDA c: conditional[V](B[V](b), v(S1)(g(c)), c));


decl_type: formula
theory: sos
library: while
signature: nil
location: 88 0 90 999
body:
  Config_ord_defaxiom: AXIOM
    (FORALL (S: Stm, s: State): Config_ord(I(S, s)) = 0) AND
     (FORALL (s1: State): Config_ord(T(s1)) = 1);


decl_type: formula
theory: sos
library: while
signature: nil
location: 92 0 95 999
body:
  Config_I_extensionality: AXIOM
    FORALL (I?_var: (I?), I?_var2: (I?)):
      S(I?_var) = S(I?_var2) AND s(I?_var) = s(I?_var2) IMPLIES
       I?_var = I?_var2;


decl_type: formula
theory: sos
library: while
signature: nil
location: 99 0 101 999
body:
  Config_T_extensionality: AXIOM
    FORALL (T?_var: (T?), T?_var2: (T?)):
      s1(T?_var) = s1(T?_var2) IMPLIES T?_var = T?_var2;


decl_type: formula
theory: sos
library: while
signature: nil
location: 116 0 120 999
body:
  Config_induction: AXIOM
    FORALL (p: [Config -> boolean]):
      ((FORALL (I1_var: Stm, I2_var: State): p(I(I1_var, I2_var))) AND
        (FORALL (T1_var: State): p(T(T1_var))))
       IMPLIES (FORALL (Config_var: Config): p(Config_var));


decl_type: formula
theory: sos
library: while
signature: nil
location: 63 2 66 68
body:
    tr_split: LEMMA                                                    % N&N 2.19
       tr(k)(I(Sequence(S1,S2),s0),T(s2)) =>
       EXISTS s1,k1,k2:
         tr(k1)(I(S1,s0),T(s1)) AND tr(k2)(I(S2,s1),T(s2)) AND k1+k2=k


decl_type: formula
theory: sos
library: while
signature: nil
location: 68 2 69 67
body:
    tr_partial: LEMMA                                                  % N&N 2.21
       tr(k)(I(S1,s0),T(s1)) => tr(k)(I(Sequence(S1,S2),s0),I(S2,s1))


decl_type: function
theory: sos
library: while
signature:
  [[[[Stm[V], [V -> int]] -> nat], [[V -> int] -> nat]] ->
  [Config -> nat]]

location: 147 0 155 999
body:
  reduce_nat(I?_fun: [[Stm[V], State[V]] -> nat],
             T?_fun: [State[V] -> nat]):
        [Config -> nat] =
      LAMBDA (Config_adtvar: Config):
        LET red: [Config -> nat] = reduce_nat(I?_fun, T?_fun) IN
          CASES Config_adtvar
            OF I(I1_var, I2_var): I?_fun(I1_var, I2_var),
               T(T1_var): T?_fun(T1_var)
            ENDCASES;


decl_type: function
theory: sos
library: while
location: 157 0 165 999
signature:
  [[[[Stm[V], [V -> int], Config] -> nat],
         [[[V -> int], Config] -> nat]] ->
          [Config -> nat]]

body:
  REDUCE_nat(I?_fun: [[Stm[V], State[V], Config] -> nat],
             T?_fun: [[State[V], Config] -> nat]):
        [Config -> nat] =
      LAMBDA (Config_adtvar: Config):
        LET red: [Config -> nat] = REDUCE_nat(I?_fun, T?_fun) IN
          CASES Config_adtvar
            OF I(I1_var, I2_var): I?_fun(I1_var, I2_var, Config_adtvar),
               T(T1_var): T?_fun(T1_var, Config_adtvar)
            ENDCASES;


decl_type: function
theory: sos
library: while
signature:
  [[[[Stm[V], [V -> int]] -> ordinal], [[V -> int] -> ordinal]] ->
  [Config -> ordinal]]

location: 167 0 175 999
body:
  reduce_ordinal(I?_fun: [[Stm[V], State[V]] -> ordinal],
                 T?_fun: [State[V] -> ordinal]):
        [Config -> ordinal] =
      LAMBDA (Config_adtvar: Config):
        LET red: [Config -> ordinal] = reduce_ordinal(I?_fun, T?_fun) IN
          CASES Config_adtvar
            OF I(I1_var, I2_var): I?_fun(I1_var, I2_var),
               T(T1_var): T?_fun(T1_var)
            ENDCASES;


decl_type: function
theory: sos
library: while
location: 177 0 185 999
signature:
  [[[[Stm[V], [V -> int], Config] -> ordinal],
         [[[V -> int], Config] -> ordinal]] ->
          [Config -> ordinal]]

body:
  REDUCE_ordinal(I?_fun: [[Stm[V], State[V], Config] -> ordinal],
                 T?_fun: [[State[V], Config] -> ordinal]):
        [Config -> ordinal] =
      LAMBDA (Config_adtvar: Config):
        LET red: [Config -> ordinal] = REDUCE_ordinal(I?_fun, T?_fun) IN
          CASES Config_adtvar
            OF I(I1_var, I2_var): I?_fun(I1_var, I2_var, Config_adtvar),
               T(T1_var): T?_fun(T1_var, Config_adtvar)
            ENDCASES;


decl_type: function
theory: sos
library: while
signature: [[Stm[V], State[V]] -> Config]
location: 35 2 44 30
body:
    step(S,s): RECURSIVE [Config]
      = CASES S OF
          Assign(x,a)          : T(assign(x,A(a))(s)),
          Skip                 : T(s),
          Sequence(S1,S2)      : CASES step(S1,s) OF
                                   I(S11,s1) : I(Sequence(S11,S2),s1),
                                   T(s1)     : I(S2,s1) ENDCASES,
          Conditional(b,S1,S2) : IF B(b)(s) THEN I(S1,s) ELSE I(S2,s) ENDIF,
          While(b,S1)          : I(Conditional(b,Sequence(S1,S),Skip),s)
        ENDCASES MEASURE S BY <<


decl_type: function
theory: sos
library: while
signature: [nat -> [[Config, Config] -> bool]]
location: 55 2 58 15
body:
    tr(n)(c0,c): RECURSIVE bool
      = IF n=0 THEN c0=c
        ELSE I?(c0) AND CASES c0 OF I(S,s): tr(n-1)(step(S,s),c) ENDCASES ENDIF
        MEASURE n


decl_type: function
theory: sos
library: while
signature: [Stm[V] -> Cont[V]]
location: 74 2 78 25
body:
    SS(S) : Cont
      = lambda s:
          IF EXISTS n,s1: tr(n)(I(S,s),T(s1))
          THEN up(choose({s1 | EXISTS n: tr(n)(I(S,s),T(s1))}))
          ELSE bottom ENDIF


decl_type: tcc
theory: sos
library: while
signature: nil
location: 189 0 192 999
body:
  % Termination TCC generated (at line 39, column 37) for  step(S1, s)
  step_TCC1: OBLIGATION
    FORALL (S: Stm[V], S1: Stm[V], S2: Stm[V]):
      S = Sequence(S1, S2) IMPLIES <<[V](S1, S);


decl_type: tcc
theory: sos
library: while
signature: nil
location: 194 0 199 999
body:
  % Subtype TCC generated (at line 57, column 45) for  n - 1
      % expected type  nat
  tr_TCC1: OBLIGATION
    FORALL (n: nat, c0: Config):
      I?(c0) AND NOT n = 0 IMPLIES
       (FORALL (S: Stm[V], s: State[V]): c0 = I(S, s) IMPLIES n - 1 >= 0);


decl_type: tcc
theory: sos
library: while
signature: nil
location: 201 0 205 999
body:
  % Termination TCC generated (at line 57, column 42) for  tr(n - 1)
  tr_TCC2: OBLIGATION
    FORALL (n: nat, c0: Config):
      I?(c0) AND NOT n = 0 IMPLIES
       (FORALL (S: Stm[V], s: State[V]): c0 = I(S, s) IMPLIES n - 1 < n);


decl_type: tcc
theory: sos
library: while
signature: nil
location: 207 0 210 999
body:
  % Cases TCC generated (at line 57, column 28) for  c0
      % for missing ELSE of CASES expression over datatype Config
  tr_TCC3: OBLIGATION
    FORALL (n: nat, c0: Config): I?(c0) AND NOT n = 0 IMPLIES NOT T?(c0);


decl_type: tcc
theory: sos
library: while
signature: nil
location: 212 0 218 999
body:
  % Subtype TCC generated (at line 77, column 23) for
      % {s1 | EXISTS n: tr(n)(I(S, s), T(s1))}
      % expected type  p: (nonempty?[State[V]])
  SS_TCC1: OBLIGATION
    FORALL (S: Stm[V], s):
      (EXISTS n, s1: tr(n)(I(S, s), T(s1))) IMPLIES
       nonempty?[State[V]]({s1 | EXISTS n: tr(n)(I(S, s), T(s1))});


decl_type: formula
theory: natural
library: while
signature: nil
location: 95 0 101 999
body:
  tree_ord_defaxiom: AXIOM
    (FORALL (d: [Stm, State, State]): tree_ord(leaf(d)) = 0) AND
     (FORALL (d: [Stm, State, State], t1: tree):
        tree_ord(branch1(d, t1)) = 1)
      AND
      (FORALL (d: [Stm, State, State], t1: tree, t2: tree):
         tree_ord(branch2(d, t1, t2)) = 2);


decl_type: formula
theory: natural
library: while
signature: nil
location: 103 0 105 999
body:
  tree_leaf_extensionality: AXIOM
    FORALL (leaf?_var: (leaf?), leaf?_var2: (leaf?)):
      d(leaf?_var) = d(leaf?_var2) IMPLIES leaf?_var = leaf?_var2;


decl_type: formula
theory: natural
library: while
signature: nil
location: 110 0 114 999
body:
  tree_branch1_extensionality: AXIOM
    FORALL (branch1?_var: (branch1?), branch1?_var2: (branch1?)):
      d(branch1?_var) = d(branch1?_var2) AND
       t1(branch1?_var) = t1(branch1?_var2)
       IMPLIES branch1?_var = branch1?_var2;


decl_type: formula
theory: natural
library: while
signature: nil
location: 116 0 118 999
body:
  tree_branch1_eta: AXIOM
    FORALL (branch1?_var: (branch1?)):
      branch1(d(branch1?_var), t1(branch1?_var)) = branch1?_var;


decl_type: formula
theory: natural
library: while
signature: nil
location: 120 0 125 999
body:
  tree_branch2_extensionality: AXIOM
    FORALL (branch2?_var: (branch2?), branch2?_var2: (branch2?)):
      d(branch2?_var) = d(branch2?_var2) AND
       t1(branch2?_var) = t1(branch2?_var2) AND
        t2(branch2?_var) = t2(branch2?_var2)
       IMPLIES branch2?_var = branch2?_var2;


decl_type: formula
theory: natural
library: while
signature: nil
location: 127 0 130 999
body:
  tree_branch2_eta: AXIOM
    FORALL (branch2?_var: (branch2?)):
      branch2(d(branch2?_var), t1(branch2?_var), t2(branch2?_var)) =
       branch2?_var;


decl_type: formula
theory: natural
library: while
signature: nil
location: 135 0 137 999
body:
  tree_d_branch1: AXIOM
    FORALL (branch11_var: [Stm, State, State], branch12_var: tree):
      d(branch1(branch11_var, branch12_var)) = branch11_var;


decl_type: formula
theory: natural
library: while
signature: nil
location: 139 0 141 999
body:
  tree_t1_branch1: AXIOM
    FORALL (branch11_var: [Stm, State, State], branch12_var: tree):
      t1(branch1(branch11_var, branch12_var)) = branch12_var;


decl_type: formula
theory: natural
library: while
signature: nil
location: 143 0 146 999
body:
  tree_d_branch2: AXIOM
    FORALL (branch21_var: [Stm, State, State], branch22_var: tree,
            branch23_var: tree):
      d(branch2(branch21_var, branch22_var, branch23_var)) = branch21_var;


decl_type: formula
theory: natural
library: while
signature: nil
location: 148 0 151 999
body:
  tree_t1_branch2: AXIOM
    FORALL (branch21_var: [Stm, State, State], branch22_var: tree,
            branch23_var: tree):
      t1(branch2(branch21_var, branch22_var, branch23_var)) = branch22_var;


decl_type: formula
theory: natural
library: while
signature: nil
location: 153 0 156 999
body:
  tree_t2_branch2: AXIOM
    FORALL (branch21_var: [Stm, State, State], branch22_var: tree,
            branch23_var: tree):
      t2(branch2(branch21_var, branch22_var, branch23_var)) = branch23_var;


decl_type: formula
theory: natural
library: while
signature: nil
location: 158 0 160 999
body:
  tree_inclusive: AXIOM
    FORALL (tree_var: tree):
      leaf?(tree_var) OR branch1?(tree_var) OR branch2?(tree_var);


decl_type: formula
theory: natural
library: while
signature: nil
location: 162 0 175 999
body:
  tree_induction: AXIOM
    FORALL (p: [tree -> boolean]):
      ((FORALL (leaf1_var: [Stm, State, State]):
          TRUE IMPLIES p(leaf(leaf1_var)))
        AND
        (FORALL (branch11_var: [Stm, State, State], branch12_var: tree):
           TRUE AND p(branch12_var) IMPLIES
            p(branch1(branch11_var, branch12_var)))
         AND
         (FORALL (branch21_var: [Stm, State, State], branch22_var: tree,
                  branch23_var: tree):
            TRUE AND p(branch22_var) AND p(branch23_var) IMPLIES
             p(branch2(branch21_var, branch22_var, branch23_var))))
       IMPLIES (FORALL (tree_var: tree): p(tree_var));


decl_type: formula
theory: natural
library: while
signature: nil
location: 79 2 80 47
body:
    SS_deterministic: LEMMA (EXISTS d: S(d) = S AND s0(d) = s AND s1(d) = s1)
                            IFF SS(S)(s) = up(s1)                       % N%N 2.9


decl_type: type
theory: natural
library: while
signature: nil
location: 66 2 67 74
body:
    derivation_tree: TYPE+ = (derivation_tree?)
                             CONTAINING leaf((Skip,lambda x: 0,lambda x: 0))


decl_type: function
theory: natural
library: while
signature: [tree -> upto(2)]
location: 201 0 206 999
body:
  ord(x: tree): [tree -> upto(2)] =
      CASES x
        OF leaf(leaf1_var): 0,
           branch1(branch11_var, branch12_var): 1,
           branch2(branch21_var, branch22_var, branch23_var): 2
        ENDCASES


decl_type: function
theory: natural
library: while
signature: [[tree, tree] -> boolean]
location: 208 0 215 999
body:
  subterm(x: tree, y: tree):  boolean =
      x = y OR
       CASES y
         OF leaf(leaf1_var): FALSE,
            branch1(branch11_var, branch12_var): subterm(x, branch12_var),
            branch2(branch21_var, branch22_var, branch23_var):
              subterm(x, branch22_var) OR subterm(x, branch23_var)
         ENDCASES;


decl_type: function
theory: natural
library: while
location: 217 0 233 999
signature:
  [[[[Stm[V], [V -> int], [V -> int]] -> nat],
         [[[Stm[V], [V -> int], [V -> int]], nat] -> nat],
         [[[Stm[V], [V -> int], [V -> int]], nat, nat] -> nat]] ->
          [tree -> nat]]

body:
  reduce_nat(leaf?_fun: [[Stm[V], State[V], State[V]] -> nat],
             branch1?_fun: [[[Stm[V], State[V], State[V]], nat] -> nat],
             branch2?_fun:
               [[[Stm[V], State[V], State[V]], nat, nat] -> nat]):
        [tree -> nat] =
      LAMBDA (tree_adtvar: tree):
        LET red: [tree -> nat] =
              reduce_nat(leaf?_fun, branch1?_fun, branch2?_fun)
          IN
          CASES tree_adtvar
            OF leaf(leaf1_var): leaf?_fun(leaf1_var),
               branch1(branch11_var, branch12_var):
                 branch1?_fun(branch11_var, red(branch12_var)),
               branch2(branch21_var, branch22_var, branch23_var):
                 branch2?_fun(branch21_var, red(branch22_var),
                              red(branch23_var))
            ENDCASES;


decl_type: function
theory: natural
library: while
location: 235 0 252 999
signature:
  [[[[[Stm[V], [V -> int], [V -> int]], tree] -> nat],
         [[[Stm[V], [V -> int], [V -> int]], nat, tree] -> nat],
         [[[Stm[V], [V -> int], [V -> int]], nat, nat, tree] -> nat]] ->
          [tree -> nat]]

body:
  REDUCE_nat(leaf?_fun: [[[Stm[V], State[V], State[V]], tree] -> nat],
             branch1?_fun:
               [[[Stm[V], State[V], State[V]], nat, tree] -> nat],
             branch2?_fun:
               [[[Stm[V], State[V], State[V]], nat, nat, tree] -> nat]):
        [tree -> nat] =
      LAMBDA (tree_adtvar: tree):
        LET red: [tree -> nat] =
              REDUCE_nat(leaf?_fun, branch1?_fun, branch2?_fun)
          IN
          CASES tree_adtvar
            OF leaf(leaf1_var): leaf?_fun(leaf1_var, tree_adtvar),
               branch1(branch11_var, branch12_var):
                 branch1?_fun(branch11_var, red(branch12_var), tree_adtvar),
               branch2(branch21_var, branch22_var, branch23_var):
                 branch2?_fun(branch21_var, red(branch22_var),
                              red(branch23_var), tree_adtvar)
            ENDCASES;


decl_type: function
theory: natural
library: while
location: 254 0 272 999
signature:
  [[[[Stm[V], [V -> int], [V -> int]] -> ordinal],
         [[[Stm[V], [V -> int], [V -> int]], ordinal] -> ordinal],
         [[[Stm[V], [V -> int], [V -> int]], ordinal, ordinal] ->
            ordinal]] ->
          [tree -> ordinal]]

body:
  reduce_ordinal(leaf?_fun: [[Stm[V], State[V], State[V]] -> ordinal],
                 branch1?_fun:
                   [[[Stm[V], State[V], State[V]], ordinal] -> ordinal],
                 branch2?_fun:
                   [[[Stm[V], State[V], State[V]], ordinal, ordinal] ->
                      ordinal]):
        [tree -> ordinal] =
      LAMBDA (tree_adtvar: tree):
        LET red: [tree -> ordinal] =
              reduce_ordinal(leaf?_fun, branch1?_fun, branch2?_fun)
          IN
          CASES tree_adtvar
            OF leaf(leaf1_var): leaf?_fun(leaf1_var),
               branch1(branch11_var, branch12_var):
                 branch1?_fun(branch11_var, red(branch12_var)),
               branch2(branch21_var, branch22_var, branch23_var):
                 branch2?_fun(branch21_var, red(branch22_var),
                              red(branch23_var))
            ENDCASES;


decl_type: function
theory: natural
library: while
location: 274 0 294 999
signature:
  [[[[[Stm[V], [V -> int], [V -> int]], tree] -> ordinal],
         [[[Stm[V], [V -> int], [V -> int]], ordinal, tree] -> ordinal],
         [[[Stm[V], [V -> int], [V -> int]], ordinal, ordinal, tree] ->
            ordinal]] ->
          [tree -> ordinal]]

body:
  REDUCE_ordinal(leaf?_fun:
                   [[[Stm[V], State[V], State[V]], tree] -> ordinal],
                 branch1?_fun:
                   [[[Stm[V], State[V], State[V]], ordinal, tree] ->
                      ordinal],
                 branch2?_fun:
                   [[[Stm[V], State[V], State[V]], ordinal, ordinal, tree] ->
                      ordinal]):
        [tree -> ordinal] =
      LAMBDA (tree_adtvar: tree):
        LET red: [tree -> ordinal] =
              REDUCE_ordinal(leaf?_fun, branch1?_fun, branch2?_fun)
          IN
          CASES tree_adtvar
            OF leaf(leaf1_var): leaf?_fun(leaf1_var, tree_adtvar),
               branch1(branch11_var, branch12_var):
                 branch1?_fun(branch11_var, red(branch12_var), tree_adtvar),
               branch2(branch21_var, branch22_var, branch23_var):
                 branch2?_fun(branch21_var, red(branch22_var),
                              red(branch23_var), tree_adtvar)
            ENDCASES;


decl_type: function
theory: natural
library: while
signature: [tree -> nat]
location: 26 2 31 28
body:
    depth(t:tree): RECURSIVE nat =
      CASES t OF
        leaf(d)          : 0,
        branch1(d,t1)    : depth(t1)+1,
        branch2(d,t1,t2) : max(depth(t1),depth(t2))+1
      ENDCASES MEASURE t by <<


decl_type: function
theory: natural
library: while
signature: [tree -> bool]
location: 45 2 64 28
body:
    derivation_tree?(t:tree): RECURSIVE bool =
      CASES t OF
        leaf(d):
                 (Assign?(S(d)) AND s1(d)= assign(x(S(d)),A(a(S(d))))(s0(d))) OR
                 (Skip?(S(d))   AND s1(d)= s0(d)) OR
                 (While?(S(d)) AND (NOT B(b(S(d)))(s0(d))) AND s1(d) = s0(d)),
        branch2(d,t1,t2):
                 derivation_tree?(t1) AND derivation_tree?(t2) AND
                 ((Sequence?(S(d)) AND
                  S1(S(d)) = S(t1) AND S2(S(d)) = S(t2) AND
                  s0(t1) = s0(d) AND s1(t1) = s0(t2) AND s1(t) = s1(t2)) OR
                 (While?(S(d)) AND B(b(S(d)))(s0(d)) AND
                  S1(S(d)) = S(t1) AND S(t2) = S(d) AND
                  s0(t1) = s0(d) AND s1(t1) = s0(t2) AND s1(t) = s1(t2))),
        branch1(d,t1):
                 Conditional?(S(d)) AND derivation_tree?(t1) AND
                 s0(t1) = s0(d) AND s1(t1) = s1(d) AND
                 ((B(b(S(d)))(s0(d)) AND S1(S(d)) = S(t1)) OR
                  ((NOT B(b(S(d)))(s0(d))) AND S2(S(d)) = S(t1)))
      ENDCASES MEASURE t by <<


decl_type: function
theory: natural
library: while
signature: [Stm[V] -> Cont[V]]
location: 73 2 77 25
body:
    SS(S): Cont
      = lambda s:
          IF EXISTS d: S(d) = S AND s0(d) = s
          THEN up(choose({s1 | EXISTS d: S(d) = S AND s0(d) = s AND s1(d) = s1}))
          ELSE bottom ENDIF


decl_type: constant
theory: natural
library: while
signature: (strict_well_founded?[tree])
location: 296 0 305 999
body:
  <<:  (strict_well_founded?[tree]) =
      LAMBDA (x, y: tree):
        CASES y
          OF leaf(leaf1_var): FALSE,
             branch1(branch11_var, branch12_var):
               x = branch12_var OR x << branch12_var,
             branch2(branch21_var, branch22_var, branch23_var):
               (x = branch22_var OR x << branch22_var) OR
                x = branch23_var OR x << branch23_var
          ENDCASES;


decl_type: datatype
theory: natural
library: while
signature: nil
location: 19 8 24 10
body:
    tree: DATATYPE
    BEGIN
      leaf(d:[Stm,State,State])               : leaf?
      branch1(d:[Stm,State,State],t1:tree)    : branch1?
      branch2(d:[Stm,State,State],t1,t2:tree) : branch2?
    END tree


decl_type: tcc
theory: natural
library: while
signature: nil
location: 307 0 310 999
body:
  % Termination TCC generated (at line 29, column 25) for  depth(t1)
  depth_TCC1: OBLIGATION
    FORALL (t: tree, d: [Stm[V], State[V], State[V]], t1: tree):
      t = branch1(d, t1) IMPLIES t1 << t;


decl_type: tcc
theory: natural
library: while
signature: nil
location: 312 0 315 999
body:
  % Termination TCC generated (at line 30, column 29) for  depth(t1)
  depth_TCC2: OBLIGATION
    FORALL (t: tree, d: [Stm[V], State[V], State[V]], t1: tree, t2: tree):
      t = branch2(d, t1, t2) IMPLIES t1 << t;


decl_type: tcc
theory: natural
library: while
signature: nil
location: 317 0 320 999
body:
  % Termination TCC generated (at line 30, column 39) for  depth(t2)
  depth_TCC3: OBLIGATION
    FORALL (t: tree, d: [Stm[V], State[V], State[V]], t1: tree, t2: tree):
      t = branch2(d, t1, t2) IMPLIES t2 << t;


decl_type: tcc
theory: natural
library: while
signature: nil
location: 322 0 330 999
body:
  % Subtype TCC generated (at line 50, column 42) for  S(d)
      % expected type  {x: Stm[V] | Conditional?(x) OR While?(x)}
  derivation_tree?_TCC1: OBLIGATION
    FORALL (t: tree, d: [Stm[V], State[V], State[V]]):
      While?(S(d)) AND
       NOT (Skip?(S(d)) AND s1(d) = s0(d)) AND
        NOT (Assign?(S(d)) AND s1(d) = assign(x(S(d)), A(a(S(d))))(s0(d)))
         AND t = leaf(d)
       IMPLIES Conditional?[V](S(d)) OR While?[V](S(d));


decl_type: tcc
theory: natural
library: while
signature: nil
location: 332 0 340 999
body:
  % Subtype TCC generated (at line 54, column 19) for  S(d)
      % expected type  {x: Stm[V] |
                     %          Sequence?[V](x) OR
                     %           Conditional?(x) OR While?(x)}
  derivation_tree?_TCC2: OBLIGATION
    FORALL (t: tree, v: [{z: tree | z << t} -> bool],
            d: [Stm[V], State[V], State[V]], t1: tree, t2: tree):
      Sequence?(S(d)) AND v(t2) AND v(t1) AND t = branch2(d, t1, t2) IMPLIES
       Sequence?[V](S(d)) OR Conditional?[V](S(d)) OR While?[V](S(d));


decl_type: tcc
theory: natural
library: while
signature: nil
location: 342 0 349 999
body:
  % Subtype TCC generated (at line 54, column 40) for  S(d)
      % expected type  {x: Stm[V] | Sequence?[V](x) OR Conditional?(x)}
  derivation_tree?_TCC3: OBLIGATION
    FORALL (t: tree, v: [{z: tree | z << t} -> bool],
            d: [Stm[V], State[V], State[V]], t1: tree, t2: tree):
           S1(S(d)) = S(t1) AND Sequence?(S(d)) AND v(t2) AND v(t1)
       AND t = branch2(d, t1, t2)
       IMPLIES Sequence?[V](S(d)) OR Conditional?[V](S(d));


decl_type: tcc
theory: natural
library: while
signature: nil
location: 351 0 360 999
body:
  % Subtype TCC generated (at line 56, column 37) for  S(d)
      % expected type  {x: Stm[V] | Conditional?(x) OR While?(x)}
  derivation_tree?_TCC4: OBLIGATION
    FORALL (t: tree, v: [{z: tree | z << t} -> bool],
            d: [Stm[V], State[V], State[V]], t1: tree, t2: tree):
           While?(S(d))
       AND NOT (     Sequence?(S(d)) AND S1(S(d)) = S(t1) AND S2(S(d)) = S(t2)
                 AND s0(t1) = s0(d) AND s1(t1) = s0(t2) AND s1(t) = s1(t2))
       AND v(t2) AND v(t1) AND t = branch2(d, t1, t2)
       IMPLIES Conditional?[V](S(d)) OR While?[V](S(d));


decl_type: tcc
theory: natural
library: while
signature: nil
location: 362 0 369 999
body:
  % Subtype TCC generated (at line 62, column 21) for  S(d)
      % expected type  {x: Stm[V] | Conditional?(x) OR While?(x)}
  derivation_tree?_TCC5: OBLIGATION
    FORALL (t: tree, v: [{z: tree | z << t} -> bool],
            d: [Stm[V], State[V], State[V]], t1: tree):
           s1(t1) = s1(d) AND s0(t1) = s0(d) AND v(t1) AND Conditional?(S(d))
       AND t = branch1(d, t1)
       IMPLIES Conditional?[V](S(d)) OR While?[V](S(d));


decl_type: tcc
theory: natural
library: while
signature: nil
location: 371 0 380 999
body:
  % Subtype TCC generated (at line 63, column 48) for  S(d)
      % expected type  {x: Stm[V] | Sequence?[V](x) OR Conditional?(x)}
  derivation_tree?_TCC6: OBLIGATION
    FORALL (t: tree, v: [{z: tree | z << t} -> bool],
            d: [Stm[V], State[V], State[V]], t1: tree):
           (NOT B(b(S(d)))(s0(d)))
       AND NOT (B(b(S(d)))(s0(d)) AND S1(S(d)) = S(t1)) AND s1(t1) = s1(d)
       AND s0(t1) = s0(d) AND v(t1) AND Conditional?(S(d))
       AND t = branch1(d, t1)
       IMPLIES Sequence?[V](S(d)) OR Conditional?[V](S(d));


decl_type: tcc
theory: natural
library: while
signature: nil
location: 382 0 386 999
body:
  % Subtype TCC generated (at line 67, column 38) for
      % leaf(Skip, LAMBDA x: 0, LAMBDA x: 0)
      % expected type  derivation_tree
  derivation_tree_TCC1: OBLIGATION
    derivation_tree?(leaf(Skip[V], LAMBDA x: 0, LAMBDA x: 0));


decl_type: tcc
theory: natural
library: while
signature: nil
location: 388 0 395 999
body:
  % Subtype TCC generated (at line 76, column 23) for
      % {s1 | EXISTS d: S(d) = S AND s0(d) = s AND s1(d) = s1}
      % expected type  p: (nonempty?[State[V]])
  SS_TCC1: OBLIGATION
    FORALL (S: Stm[V], s):
      (EXISTS d: S(d) = S AND s0(d) = s) IMPLIES
       nonempty?[State[V]]
           ({s1 | EXISTS d: S(d) = S AND s0(d) = s AND s1(d) = s1});


decl_type: formula
theory: axiomatic
library: while
signature: nil
location: 112 0 119 999
body:
  tree_ord_defaxiom: AXIOM
         (FORALL (h: Hoare): tree_ord(ass(h)) = 0)
     AND (FORALL (h: Hoare): tree_ord(skip(h)) = 1)
     AND (FORALL (h: Hoare, t1: tree, t2: tree):
            tree_ord(comp(h, t1, t2)) = 2)
     AND (FORALL (h: Hoare, t1: tree, t2: tree): tree_ord(iif(h, t1, t2)) = 3)
     AND (FORALL (h: Hoare, t: tree): tree_ord(while(h, t)) = 4)
     AND (FORALL (h: Hoare, t: tree): tree_ord(cons(h, t)) = 5);


decl_type: formula
theory: axiomatic
library: while
signature: nil
location: 121 0 123 999
body:
  tree_ass_extensionality: AXIOM
    FORALL (ass?_var: (ass?), ass?_var2: (ass?)):
      h(ass?_var) = h(ass?_var2) IMPLIES ass?_var = ass?_var2;


decl_type: formula
theory: axiomatic
library: while
signature: nil
location: 127 0 129 999
body:
  tree_skip_extensionality: AXIOM
    FORALL (skip?_var: (skip?), skip?_var2: (skip?)):
      h(skip?_var) = h(skip?_var2) IMPLIES skip?_var = skip?_var2;


decl_type: formula
theory: axiomatic
library: while
signature: nil
location: 134 0 138 999
body:
  tree_comp_extensionality: AXIOM
    FORALL (comp?_var: (comp?), comp?_var2: (comp?)):
      h(comp?_var) = h(comp?_var2) AND
       t1(comp?_var) = t1(comp?_var2) AND t2(comp?_var) = t2(comp?_var2)
       IMPLIES comp?_var = comp?_var2;


decl_type: formula
theory: axiomatic
library: while
signature: nil
location: 140 0 142 999
body:
  tree_comp_eta: AXIOM
    FORALL (comp?_var: (comp?)):
      comp(h(comp?_var), t1(comp?_var), t2(comp?_var)) = comp?_var;


decl_type: formula
theory: axiomatic
library: while
signature: nil
location: 144 0 148 999
body:
  tree_iif_extensionality: AXIOM
    FORALL (iif?_var: (iif?), iif?_var2: (iif?)):
      h(iif?_var) = h(iif?_var2) AND
       t1(iif?_var) = t1(iif?_var2) AND t2(iif?_var) = t2(iif?_var2)
       IMPLIES iif?_var = iif?_var2;


decl_type: formula
theory: axiomatic
library: while
signature: nil
location: 150 0 152 999
body:
  tree_iif_eta: AXIOM
    FORALL (iif?_var: (iif?)):
      iif(h(iif?_var), t1(iif?_var), t2(iif?_var)) = iif?_var;


decl_type: formula
theory: axiomatic
library: while
signature: nil
location: 154 0 157 999
body:
  tree_while_extensionality: AXIOM
    FORALL (while?_var: (while?), while?_var2: (while?)):
      h(while?_var) = h(while?_var2) AND t(while?_var) = t(while?_var2)
       IMPLIES while?_var = while?_var2;


decl_type: formula
theory: axiomatic
library: while
signature: nil
location: 159 0 161 999
body:
  tree_while_eta: AXIOM
    FORALL (while?_var: (while?)):
      while(h(while?_var), t(while?_var)) = while?_var;


decl_type: formula
theory: axiomatic
library: while
signature: nil
location: 163 0 166 999
body:
  tree_cons_extensionality: AXIOM
    FORALL (cons?_var: (cons?), cons?_var2: (cons?)):
      h(cons?_var) = h(cons?_var2) AND t(cons?_var) = t(cons?_var2) IMPLIES
       cons?_var = cons?_var2;


decl_type: formula
theory: axiomatic
library: while
signature: nil
location: 176 0 178 999
body:
  tree_h_comp: AXIOM
    FORALL (comp1_var: Hoare, comp2_var: tree, comp3_var: tree):
      h(comp(comp1_var, comp2_var, comp3_var)) = comp1_var;


decl_type: formula
theory: axiomatic
library: while
signature: nil
location: 180 0 182 999
body:
  tree_t1_comp: AXIOM
    FORALL (comp1_var: Hoare, comp2_var: tree, comp3_var: tree):
      t1(comp(comp1_var, comp2_var, comp3_var)) = comp2_var;


decl_type: formula
theory: axiomatic
library: while
signature: nil
location: 184 0 186 999
body:
  tree_t2_comp: AXIOM
    FORALL (comp1_var: Hoare, comp2_var: tree, comp3_var: tree):
      t2(comp(comp1_var, comp2_var, comp3_var)) = comp3_var;


decl_type: formula
theory: axiomatic
library: while
signature: nil
location: 188 0 190 999
body:
  tree_h_iif: AXIOM
    FORALL (iif1_var: Hoare, iif2_var: tree, iif3_var: tree):
      h(iif(iif1_var, iif2_var, iif3_var)) = iif1_var;


decl_type: formula
theory: axiomatic
library: while
signature: nil
location: 192 0 194 999
body:
  tree_t1_iif: AXIOM
    FORALL (iif1_var: Hoare, iif2_var: tree, iif3_var: tree):
      t1(iif(iif1_var, iif2_var, iif3_var)) = iif2_var;


decl_type: formula
theory: axiomatic
library: while
signature: nil
location: 196 0 198 999
body:
  tree_t2_iif: AXIOM
    FORALL (iif1_var: Hoare, iif2_var: tree, iif3_var: tree):
      t2(iif(iif1_var, iif2_var, iif3_var)) = iif3_var;


decl_type: formula
theory: axiomatic
library: while
signature: nil
location: 200 0 202 999
body:
  tree_h_while: AXIOM
    FORALL (while1_var: Hoare, while2_var: tree):
      h(while(while1_var, while2_var)) = while1_var;


decl_type: formula
theory: axiomatic
library: while
signature: nil
location: 204 0 206 999
body:
  tree_t_while: AXIOM
    FORALL (while1_var: Hoare, while2_var: tree):
      t(while(while1_var, while2_var)) = while2_var;


decl_type: formula
theory: axiomatic
library: while
signature: nil
location: 208 0 210 999
body:
  tree_h_cons: AXIOM
    FORALL (cons1_var: Hoare, cons2_var: tree):
      h(cons(cons1_var, cons2_var)) = cons1_var;


decl_type: formula
theory: axiomatic
library: while
signature: nil
location: 212 0 214 999
body:
  tree_t_cons: AXIOM
    FORALL (cons1_var: Hoare, cons2_var: tree):
      t(cons(cons1_var, cons2_var)) = cons2_var;


decl_type: formula
theory: axiomatic
library: while
signature: nil
location: 216 0 219 999
body:
  tree_inclusive: AXIOM
    FORALL (tree_var: tree):
          ass?(tree_var) OR skip?(tree_var) OR comp?(tree_var)
       OR iif?(tree_var) OR while?(tree_var) OR cons?(tree_var);


decl_type: formula
theory: axiomatic
library: while
signature: nil
location: 221 0 235 999
body:
  tree_induction: AXIOM
    FORALL (p: [tree -> boolean]):
      (     FORALL (ass1_var: Hoare): TRUE IMPLIES p(ass(ass1_var))
        AND FORALL (skip1_var: Hoare): TRUE IMPLIES p(skip(skip1_var))
        AND FORALL (comp1_var: Hoare, comp2_var: tree, comp3_var: tree):
              TRUE AND p(comp2_var) AND p(comp3_var) IMPLIES
               p(comp(comp1_var, comp2_var, comp3_var))
        AND FORALL (iif1_var: Hoare, iif2_var: tree, iif3_var: tree):
              TRUE AND p(iif2_var) AND p(iif3_var) IMPLIES
               p(iif(iif1_var, iif2_var, iif3_var))
        AND FORALL (while1_var: Hoare, while2_var: tree):
              TRUE AND p(while2_var) IMPLIES p(while(while1_var, while2_var))
        AND FORALL (cons1_var: Hoare, cons2_var: tree):
              TRUE AND p(cons2_var) IMPLIES p(cons(cons1_var, cons2_var)))
       IMPLIES (FORALL (tree_var: tree): p(tree_var));


decl_type: type
theory: axiomatic
library: while
signature: nil
location: 84 2 85 78
body:
    inference_tree:TYPE+ = (inference_tree?)
                           CONTAINING skip((lambda s: TRUE,Skip,lambda s: TRUE))


decl_type: function
theory: axiomatic
library: while
location: 267 0 270 999
signature:
  [[[[[V -> int] -> boolean], Stm[V], [[V -> int] -> boolean]],
         tree, tree] ->
          (comp?)]

body:
  comp:
        [[[[[V -> int] -> boolean], Stm[V], [[V -> int] -> boolean]], tree,
          tree] ->
           (comp?)]


decl_type: function
theory: axiomatic
library: while
signature:
  [[[[[V -> int] -> boolean], Stm[V], [[V -> int] -> boolean]],
  tree, tree] ->
  (iif?)]

location: 272 0 275 999
body:
  iif:
        [[[[[V -> int] -> boolean], Stm[V], [[V -> int] -> boolean]], tree,
          tree] ->
           (iif?)]


decl_type: function
theory: axiomatic
library: while
signature:
  [[[[[V -> int] -> boolean], Stm[V], [[V -> int] -> boolean]],
  tree] ->
  (while?)]

location: 277 0 280 999
body:
  while:
        [[[[[V -> int] -> boolean], Stm[V], [[V -> int] -> boolean]],
          tree] ->
           (while?)]


decl_type: function
theory: axiomatic
library: while
signature:
  [[[[[V -> int] -> boolean], Stm[V], [[V -> int] -> boolean]],
  tree] ->
  (cons?)]

location: 282 0 285 999
body:
  cons:
        [[[[[V -> int] -> boolean], Stm[V], [[V -> int] -> boolean]],
          tree] ->
           (cons?)]


decl_type: function
theory: axiomatic
library: while
signature: [tree -> upto(5)]
location: 289 0 297 999
body:
  ord(x: tree): [tree -> upto(5)] =
      CASES x
        OF ass(ass1_var): 0,
           skip(skip1_var): 1,
           comp(comp1_var, comp2_var, comp3_var): 2,
           iif(iif1_var, iif2_var, iif3_var): 3,
           while(while1_var, while2_var): 4,
           cons(cons1_var, cons2_var): 5
        ENDCASES


decl_type: function
theory: axiomatic
library: while
signature: [[tree, tree] -> boolean]
location: 299 0 310 999
body:
  subterm(x: tree, y: tree):  boolean =
      x = y OR
       CASES y
         OF ass(ass1_var): FALSE,
            skip(skip1_var): FALSE,
            comp(comp1_var, comp2_var, comp3_var):
              subterm(x, comp2_var) OR subterm(x, comp3_var),
            iif(iif1_var, iif2_var, iif3_var):
              subterm(x, iif2_var) OR subterm(x, iif3_var),
            while(while1_var, while2_var): subterm(x, while2_var),
            cons(cons1_var, cons2_var): subterm(x, cons2_var)
         ENDCASES;


decl_type: function
theory: axiomatic
library: while
location: 312 0 334 999
signature:
  [[[[[[V -> int] -> boolean], Stm[V], [[V -> int] -> boolean]] ->
            nat],
         [[[[V -> int] -> boolean], Stm[V], [[V -> int] -> boolean]] ->
            nat],
         [[[[[V -> int] -> boolean], Stm[V], [[V -> int] -> boolean]],
           nat, nat] ->
            nat],
         [[[[[V -> int] -> boolean], Stm[V], [[V -> int] -> boolean]],
           nat, nat] ->
            nat],
         [[[[[V -> int] -> boolean], Stm[V], [[V -> int] -> boolean]],
           nat] ->
            nat],
         [[[[[V -> int] -> boolean], Stm[V], [[V -> int] -> boolean]],
           nat] ->
            nat]] ->
          [tree -> nat]]

body:
  reduce_nat(ass?_fun: [Hoare -> nat], skip?_fun: [Hoare -> nat],
             comp?_fun: [[Hoare, nat, nat] -> nat],
             iif?_fun: [[Hoare, nat, nat] -> nat],
             while?_fun: [[Hoare, nat] -> nat],
             cons?_fun: [[Hoare, nat] -> nat]):
        [tree -> nat] =
      LAMBDA (tree_adtvar: tree):
        LET red: [tree -> nat] =
              reduce_nat(ass?_fun, skip?_fun, comp?_fun, iif?_fun,
                         while?_fun, cons?_fun)
          IN
          CASES tree_adtvar
            OF ass(ass1_var): ass?_fun(ass1_var),
               skip(skip1_var): skip?_fun(skip1_var),
               comp(comp1_var, comp2_var, comp3_var):
                 comp?_fun(comp1_var, red(comp2_var), red(comp3_var)),
               iif(iif1_var, iif2_var, iif3_var):
                 iif?_fun(iif1_var, red(iif2_var), red(iif3_var)),
               while(while1_var, while2_var):
                 while?_fun(while1_var, red(while2_var)),
               cons(cons1_var, cons2_var):
                 cons?_fun(cons1_var, red(cons2_var))
            ENDCASES;


decl_type: function
theory: axiomatic
library: while
location: 336 0 361 999
signature:
  [[[[[[[V -> int] -> boolean], Stm[V], [[V -> int] -> boolean]],
           tree] ->
            nat],
         [[[[[V -> int] -> boolean], Stm[V], [[V -> int] -> boolean]],
           tree] ->
            nat],
         [[[[[V -> int] -> boolean], Stm[V], [[V -> int] -> boolean]],
           nat, nat, tree] ->
            nat],
         [[[[[V -> int] -> boolean], Stm[V], [[V -> int] -> boolean]],
           nat, nat, tree] ->
            nat],
         [[[[[V -> int] -> boolean], Stm[V], [[V -> int] -> boolean]],
           nat, tree] ->
            nat],
         [[[[[V -> int] -> boolean], Stm[V], [[V -> int] -> boolean]],
           nat, tree] ->
            nat]] ->
          [tree -> nat]]

body:
  REDUCE_nat(ass?_fun: [[Hoare, tree] -> nat],
             skip?_fun: [[Hoare, tree] -> nat],
             comp?_fun: [[Hoare, nat, nat, tree] -> nat],
             iif?_fun: [[Hoare, nat, nat, tree] -> nat],
             while?_fun: [[Hoare, nat, tree] -> nat],
             cons?_fun: [[Hoare, nat, tree] -> nat]):
        [tree -> nat] =
      LAMBDA (tree_adtvar: tree):
        LET red: [tree -> nat] =
              REDUCE_nat(ass?_fun, skip?_fun, comp?_fun, iif?_fun,
                         while?_fun, cons?_fun)
          IN
          CASES tree_adtvar
            OF ass(ass1_var): ass?_fun(ass1_var, tree_adtvar),
               skip(skip1_var): skip?_fun(skip1_var, tree_adtvar),
               comp(comp1_var, comp2_var, comp3_var):
                 comp?_fun(comp1_var, red(comp2_var), red(comp3_var),
                           tree_adtvar),
               iif(iif1_var, iif2_var, iif3_var):
                 iif?_fun(iif1_var, red(iif2_var), red(iif3_var),
                          tree_adtvar),
               while(while1_var, while2_var):
                 while?_fun(while1_var, red(while2_var), tree_adtvar),
               cons(cons1_var, cons2_var):
                 cons?_fun(cons1_var, red(cons2_var), tree_adtvar)
            ENDCASES;


decl_type: function
theory: axiomatic
library: while
location: 363 0 385 999
signature:
  [[[[[[V -> int] -> boolean], Stm[V], [[V -> int] -> boolean]] ->
            ordinal],
         [[[[V -> int] -> boolean], Stm[V], [[V -> int] -> boolean]] ->
            ordinal],
         [[[[[V -> int] -> boolean], Stm[V], [[V -> int] -> boolean]],
           ordinal, ordinal] ->
            ordinal],
         [[[[[V -> int] -> boolean], Stm[V], [[V -> int] -> boolean]],
           ordinal, ordinal] ->
            ordinal],
         [[[[[V -> int] -> boolean], Stm[V], [[V -> int] -> boolean]],
           ordinal] ->
            ordinal],
         [[[[[V -> int] -> boolean], Stm[V], [[V -> int] -> boolean]],
           ordinal] ->
            ordinal]] ->
          [tree -> ordinal]]

body:
  reduce_ordinal(ass?_fun: [Hoare -> ordinal], skip?_fun: [Hoare -> ordinal],
                 comp?_fun: [[Hoare, ordinal, ordinal] -> ordinal],
                 iif?_fun: [[Hoare, ordinal, ordinal] -> ordinal],
                 while?_fun: [[Hoare, ordinal] -> ordinal],
                 cons?_fun: [[Hoare, ordinal] -> ordinal]):
        [tree -> ordinal] =
      LAMBDA (tree_adtvar: tree):
        LET red: [tree -> ordinal] =
              reduce_ordinal(ass?_fun, skip?_fun, comp?_fun, iif?_fun,
                             while?_fun, cons?_fun)
          IN
          CASES tree_adtvar
            OF ass(ass1_var): ass?_fun(ass1_var),
               skip(skip1_var): skip?_fun(skip1_var),
               comp(comp1_var, comp2_var, comp3_var):
                 comp?_fun(comp1_var, red(comp2_var), red(comp3_var)),
               iif(iif1_var, iif2_var, iif3_var):
                 iif?_fun(iif1_var, red(iif2_var), red(iif3_var)),
               while(while1_var, while2_var):
                 while?_fun(while1_var, red(while2_var)),
               cons(cons1_var, cons2_var):
                 cons?_fun(cons1_var, red(cons2_var))
            ENDCASES;


decl_type: function
theory: axiomatic
library: while
location: 387 0 412 999
signature:
  [[[[[[[V -> int] -> boolean], Stm[V], [[V -> int] -> boolean]],
           tree] ->
            ordinal],
         [[[[[V -> int] -> boolean], Stm[V], [[V -> int] -> boolean]],
           tree] ->
            ordinal],
         [[[[[V -> int] -> boolean], Stm[V], [[V -> int] -> boolean]],
           ordinal, ordinal, tree] ->
            ordinal],
         [[[[[V -> int] -> boolean], Stm[V], [[V -> int] -> boolean]],
           ordinal, ordinal, tree] ->
            ordinal],
         [[[[[V -> int] -> boolean], Stm[V], [[V -> int] -> boolean]],
           ordinal, tree] ->
            ordinal],
         [[[[[V -> int] -> boolean], Stm[V], [[V -> int] -> boolean]],
           ordinal, tree] ->
            ordinal]] ->
          [tree -> ordinal]]

body:
  REDUCE_ordinal(ass?_fun: [[Hoare, tree] -> ordinal],
                 skip?_fun: [[Hoare, tree] -> ordinal],
                 comp?_fun: [[Hoare, ordinal, ordinal, tree] -> ordinal],
                 iif?_fun: [[Hoare, ordinal, ordinal, tree] -> ordinal],
                 while?_fun: [[Hoare, ordinal, tree] -> ordinal],
                 cons?_fun: [[Hoare, ordinal, tree] -> ordinal]):
        [tree -> ordinal] =
      LAMBDA (tree_adtvar: tree):
        LET red: [tree -> ordinal] =
              REDUCE_ordinal(ass?_fun, skip?_fun, comp?_fun, iif?_fun,
                             while?_fun, cons?_fun)
          IN
          CASES tree_adtvar
            OF ass(ass1_var): ass?_fun(ass1_var, tree_adtvar),
               skip(skip1_var): skip?_fun(skip1_var, tree_adtvar),
               comp(comp1_var, comp2_var, comp3_var):
                 comp?_fun(comp1_var, red(comp2_var), red(comp3_var),
                           tree_adtvar),
               iif(iif1_var, iif2_var, iif3_var):
                 iif?_fun(iif1_var, red(iif2_var), red(iif3_var),
                          tree_adtvar),
               while(while1_var, while2_var):
                 while?_fun(while1_var, red(while2_var), tree_adtvar),
               cons(cons1_var, cons2_var):
                 cons?_fun(cons1_var, red(cons2_var), tree_adtvar)
            ENDCASES;


decl_type: function
theory: axiomatic
library: while
signature: [tree -> Hoare]
location: 44 2 52 41
body:
    H(t:tree): RECURSIVE Hoare = 
      CASES t OF
        ass(h)        : h,
        skip(h)       : h,
        comp(h,t1,t2) : h,
        iif(h,t1,t2)  : h,
        while(h,t)    : h,
        cons(h,t)     : h
      ENDCASES MEASURE (lambda (t:tree): 1)


decl_type: function
theory: axiomatic
library: while
signature: [tree -> bool]
location: 58 2 82 28
body:
    inference_tree?(t:tree): RECURSIVE bool =
      CASES t OF
        ass(h)        : Assign?(S(h)) AND assign(x(S(h)),a(S(h)))(Q(h)) = P(h),
        skip(h)       : Skip?(S(h)) AND P(h) = Q(h),
        comp(h,t1,t2) : Sequence?(S(h)) AND
                        S1(S(h)) = S(H(t1)) AND S2(S(h)) = S(H(t2)) AND
                        inference_tree?(t1) AND inference_tree?(t2) AND
                        P(H(t1)) = P(h)     AND
                        Q(H(t1)) = P(H(t2)) AND
                        Q(H(t2)) = Q(h),
        iif(h,t1,t2)  : Conditional?(S(h))  AND
                        S1(S(h)) = S(H(t1)) AND S2(S(h)) = S(H(t2)) AND
                        inference_tree?(t1) AND inference_tree?(t2) AND
                        P(H(t1)) = (B(b(S(h))) & P(h))     AND
                        P(H(t2)) = (~B(b(S(h))) & P(h))     AND
                        Q(H(t1)) = Q(h) AND
                        Q(H(t2)) = Q(h),
        while(h,t)    : While?(S(h)) AND inference_tree?(t) AND
                        P(H(t)) = (B(b(S(h))) & P(h)) AND
                        Q(H(t)) = P(h)                  AND
                        Q(h)    = (~B(b(S(h))) & P(h))AND
                        S1(S(h)) = S(H(t)),
        cons(h,t)     : inference_tree?(t) AND S(h) = S(H(t)) AND
                        P(h) |> P(H(t)) AND Q(H(t)) |> Q(h)
      ENDCASES MEASURE t by <<


decl_type: constant
theory: axiomatic
library: while
signature: (strict_well_founded?[tree])
location: 414 0 428 999
body:
  <<:  (strict_well_founded?[tree]) =
      LAMBDA (x, y: tree):
        CASES y
          OF ass(ass1_var): FALSE,
             skip(skip1_var): FALSE,
             comp(comp1_var, comp2_var, comp3_var):
               (x = comp2_var OR x << comp2_var) OR
                x = comp3_var OR x << comp3_var,
             iif(iif1_var, iif2_var, iif3_var):
               (x = iif2_var OR x << iif2_var) OR
                x = iif3_var OR x << iif3_var,
             while(while1_var, while2_var):
               x = while2_var OR x << while2_var,
             cons(cons1_var, cons2_var): x = cons2_var OR x << cons2_var
          ENDCASES;


decl_type: datatype
theory: axiomatic
library: while
signature: nil
location: 34 8 42 10
body:
    tree: DATATYPE
    BEGIN
      ass(h:Hoare)             : ass?
      skip(h:Hoare)            : skip?
      comp(h:Hoare,t1,t2:tree) : comp?
      iif(h:Hoare,t1,t2:tree)  : iif? 
      while(h:Hoare,t:tree)    : while?
      cons(h:Hoare,t:tree)     : cons?
    END tree


decl_type: tcc
theory: axiomatic
library: while
signature: nil
location: 430 0 436 999
body:
  % Subtype TCC generated (at line 63, column 25) for  S(h)
      % expected type  {x: Stm[V] |
                     %          Sequence?(x) OR Conditional?(x) OR While?(x)}
  inference_tree?_TCC1: OBLIGATION
    FORALL (t: tree, h: Hoare, t1: tree, t2: tree):
      Sequence?(S(h)) AND t = comp(h, t1, t2) IMPLIES
       Sequence?[V](S(h)) OR Conditional?[V](S(h)) OR While?[V](S(h));


decl_type: tcc
theory: axiomatic
library: while
signature: nil
location: 438 0 443 999
body:
  % Subtype TCC generated (at line 63, column 49) for  S(h)
      % expected type  {x: Stm[V] | Sequence?(x) OR Conditional?(x)}
  inference_tree?_TCC2: OBLIGATION
    FORALL (t: tree, h: Hoare, t1: tree, t2: tree):
      S1(S(h)) = S(H(t1)) AND Sequence?(S(h)) AND t = comp(h, t1, t2) IMPLIES
       Sequence?[V](S(h)) OR Conditional?[V](S(h));


decl_type: tcc
theory: axiomatic
library: while
signature: nil
location: 445 0 450 999
body:
  % Termination TCC generated (at line 64, column 22) for  inference_tree?(t1)
  inference_tree?_TCC3: OBLIGATION
    FORALL (t: tree, h: Hoare, t1: tree, t2: tree):
      S2(S(h)) = S(H(t2)) AND
       S1(S(h)) = S(H(t1)) AND Sequence?(S(h)) AND t = comp(h, t1, t2)
       IMPLIES t1 << t;


decl_type: tcc
theory: axiomatic
library: while
signature: nil
location: 452 0 458 999
body:
  % Termination TCC generated (at line 64, column 46) for  inference_tree?(t2)
  inference_tree?_TCC4: OBLIGATION
    FORALL (t: tree, v: [{z: tree | z << t} -> bool], h: Hoare, t1: tree,
            t2: tree):
           v(t1) AND S2(S(h)) = S(H(t2)) AND S1(S(h)) = S(H(t1))
       AND Sequence?(S(h)) AND t = comp(h, t1, t2)
       IMPLIES t2 << t;


decl_type: tcc
theory: axiomatic
library: while
signature: nil
location: 460 0 466 999
body:
  % Subtype TCC generated (at line 69, column 25) for  S(h)
      % expected type  {x: Stm[V] |
                     %          Sequence?(x) OR Conditional?(x) OR While?(x)}
  inference_tree?_TCC5: OBLIGATION
    FORALL (t: tree, h: Hoare, t1: tree, t2: tree):
      Conditional?(S(h)) AND t = iif(h, t1, t2) IMPLIES
       Sequence?[V](S(h)) OR Conditional?[V](S(h)) OR While?[V](S(h));


decl_type: tcc
theory: axiomatic
library: while
signature: nil
location: 468 0 473 999
body:
  % Subtype TCC generated (at line 69, column 49) for  S(h)
      % expected type  {x: Stm[V] | Sequence?(x) OR Conditional?(x)}
  inference_tree?_TCC6: OBLIGATION
    FORALL (t: tree, h: Hoare, t1: tree, t2: tree):
      S1(S(h)) = S(H(t1)) AND Conditional?(S(h)) AND t = iif(h, t1, t2)
       IMPLIES Sequence?[V](S(h)) OR Conditional?[V](S(h));


decl_type: tcc
theory: axiomatic
library: while
signature: nil
location: 475 0 480 999
body:
  % Termination TCC generated (at line 70, column 22) for  inference_tree?(t1)
  inference_tree?_TCC7: OBLIGATION
    FORALL (t: tree, h: Hoare, t1: tree, t2: tree):
      S2(S(h)) = S(H(t2)) AND
       S1(S(h)) = S(H(t1)) AND Conditional?(S(h)) AND t = iif(h, t1, t2)
       IMPLIES t1 << t;


decl_type: tcc
theory: axiomatic
library: while
signature: nil
location: 482 0 488 999
body:
  % Termination TCC generated (at line 70, column 46) for  inference_tree?(t2)
  inference_tree?_TCC8: OBLIGATION
    FORALL (t: tree, v: [{z: tree | z << t} -> bool], h: Hoare, t1: tree,
            t2: tree):
           v(t1) AND S2(S(h)) = S(H(t2)) AND S1(S(h)) = S(H(t1))
       AND Conditional?(S(h)) AND t = iif(h, t1, t2)
       IMPLIES t2 << t;


decl_type: tcc
theory: axiomatic
library: while
signature: nil
location: 490 0 497 999
body:
  % Subtype TCC generated (at line 71, column 38) for  S(h)
      % expected type  {x: Stm[V] | Conditional?(x) OR While?(x)}
  inference_tree?_TCC9: OBLIGATION
    FORALL (t: tree, v: [{z: tree | z << t} -> bool], h: Hoare, t1: tree,
            t2: tree):
           v(t2) AND v(t1) AND S2(S(h)) = S(H(t2)) AND S1(S(h)) = S(H(t1))
       AND Conditional?(S(h)) AND t = iif(h, t1, t2)
       IMPLIES Conditional?[V](S(h)) OR While?[V](S(h));


decl_type: tcc
theory: axiomatic
library: while
signature: nil
location: 499 0 502 999
body:
  % Termination TCC generated (at line 75, column 39) for  inference_tree?(t)
  inference_tree?_TCC10: OBLIGATION
    FORALL (t: tree, h: Hoare, t1: tree):
      While?(S(h)) AND t = while(h, t1) IMPLIES t1 << t;


