# Declarations

decl_type: formula
theory: lim_of_composition
library: analysis
signature: nil
location: 21 2 22 70
body:
    adherence_lemma2 : LEMMA convergent?(f, x) 
                               IMPLIES adh[T2](fullset[real])(lim(f, x))


decl_type: formula
theory: lim_of_composition
library: analysis
signature: nil
location: 25 2 26 61
body:
    convergence_composition : LEMMA convergence(f, x, y) AND convergence(g, y, l)
                                      IMPLIES convergence(g o f, x, l)


decl_type: formula
theory: lim_of_composition
library: analysis
signature: nil
location: 28 2 29 58
body:
    convergent_composition  : LEMMA convergent?(f, x) AND convergent?(g, lim(f, x))
                                      IMPLIES convergent?(g o f, x)


decl_type: formula
theory: lim_of_composition
library: analysis
signature: nil
location: 31 2 32 70
body:
    lim_composition         : LEMMA convergent?(f, x) AND convergent?(g, lim(f, x))
                                      IMPLIES lim(g o f, x) = lim(g, lim(f, x))


decl_type: formula
theory: lim_of_composition
library: analysis
signature: nil
location: 35 2 36 68
body:
    convergence_comp_continuous: LEMMA convergence(f, x, z) AND continuous?(g, z) 
                                          IMPLIES convergence(g o f, x, g(z))


decl_type: formula
theory: lim_of_composition
library: analysis
signature: nil
location: 38 2 40 62
body:
    convergent_comp_continuous : LEMMA convergent?(f, x) AND T2_pred(lim(f, x))
                                       AND continuous?(g, lim(f, x))
                                          IMPLIES convergent?(g o f, x)


decl_type: formula
theory: lim_of_composition
library: analysis
signature: nil
location: 42 2 45 63
body:
    lim_comp_continuous        : LEMMA convergent?(f, x) AND T2_pred(lim(f, x))
                                       AND continuous?(g, lim(f, x))
                                       IMPLIES
                                            lim(g o f, x) = g(lim(f, x))


decl_type: tcc
theory: lim_of_composition
library: analysis
signature: nil
location: 52 0 57 999
body:
  % Subtype TCC generated (at line 32, column 48) for  x
      % expected type  {a | convergent?[T1](g o f, a)}
  lim_composition_TCC1: OBLIGATION
    FORALL (f: [T1 -> T2], g: [T2 -> real], x: real):
      convergent?(g, lim(f, x)) AND convergent?(f, x) IMPLIES
       convergent?[T1](o[T1, T2, real](g, f), x);


decl_type: tcc
theory: lim_of_composition
library: analysis
signature: nil
location: 59 0 64 999
body:
  % Subtype TCC generated (at line 45, column 46) for  x
      % expected type  {a | convergent?[T1](g o f, a)}
  lim_comp_continuous_TCC1: OBLIGATION
    FORALL (f: [T1 -> T2], g: [T2 -> real], x: real):
      continuous?(g, lim(f, x)) AND T2_pred(lim(f, x)) AND convergent?(f, x)
       IMPLIES convergent?[T1](o[T1, T2, real](g, f), x);


decl_type: formula
theory: chain_rule
library: analysis
signature: nil
location: 28 2 30 71
body:
    chain_rule_cnvg        : LEMMA convergence(NQ(f, x), 0, DF) AND 
                                convergence(NQ(g, f(x)), 0, DG)
                                   IMPLIES convergence(NQ(g o f, x), 0, DG * DF)


decl_type: formula
theory: chain_rule
library: analysis
signature: nil
location: 32 2 33 56
body:
    composition_derivable : LEMMA derivable?(f, x) AND derivable?(g, f(x))
                                     IMPLIES derivable?(g o f, x)


decl_type: formula
theory: chain_rule
library: analysis
signature: nil
location: 38 2 39 72
body:
    deriv_composition : LEMMA derivable?(f, x) AND derivable?(g, f(x))
                           IMPLIES deriv(g o f, x) = deriv(g, f(x)) * deriv(f, x)


decl_type: tcc
theory: chain_rule
library: analysis
signature: nil
location: 59 0 61 999
body:
  % Assuming TCC generated (at line 30, column 12) for  derivatives_def[T1]
      % generated from assumption derivatives_def.deriv_domain
  chain_rule_cnvg_TCC1: OBLIGATION deriv_domain?[T1];


decl_type: tcc
theory: chain_rule
library: analysis
signature: nil
location: 63 0 65 999
body:
  % Assuming TCC generated (at line 30, column 12) for  derivatives_def[T1]
      % generated from assumption derivatives_def.not_one_element
  chain_rule_cnvg_TCC2: OBLIGATION not_one_element?[T1];


decl_type: tcc
theory: chain_rule
library: analysis
signature: nil
location: 67 0 71 999
body:
  % Assuming TCC generated (at line 30, column 12) for  derivatives_def[T2]
      % generated from assumption derivatives_def.deriv_domain
  chain_rule_cnvg_TCC3: OBLIGATION
    FORALL (DF: real, f: [T1 -> T2], x: T1):
      convergence(NQ(f, x), 0, DF) IMPLIES deriv_domain?[T2];


decl_type: tcc
theory: chain_rule
library: analysis
signature: nil
location: 73 0 77 999
body:
  % Assuming TCC generated (at line 30, column 12) for  derivatives_def[T2]
      % generated from assumption derivatives_def.not_one_element
  chain_rule_cnvg_TCC4: OBLIGATION
    FORALL (DF: real, f: [T1 -> T2], x: T1):
      convergence(NQ(f, x), 0, DF) IMPLIES not_one_element?[T2];


decl_type: tcc
theory: chain_rule
library: analysis
signature: nil
location: 79 0 82 999
body:
  % Assuming TCC generated (at line 30, column 12) for  derivatives_def[T2]
      % generated from assumption derivatives_def.deriv_domain
  composition_derivable_TCC1: OBLIGATION
    FORALL (f: [T1 -> T2], x: T1): derivable?(f, x) IMPLIES deriv_domain?[T2];


decl_type: tcc
theory: chain_rule
library: analysis
signature: nil
location: 84 0 88 999
body:
  % Assuming TCC generated (at line 30, column 12) for  derivatives_def[T2]
      % generated from assumption derivatives_def.not_one_element
  composition_derivable_TCC2: OBLIGATION
    FORALL (f: [T1 -> T2], x: T1):
      derivable?(f, x) IMPLIES not_one_element?[T2];


decl_type: tcc
theory: chain_rule
library: analysis
signature: nil
location: 90 0 93 999
body:
  % Assuming TCC generated (at line 14, column 12) for  derivatives[T2]
      % generated from assumption derivatives.deriv_domain
  composition_derivable_fun_TCC1: OBLIGATION
    FORALL (f: [T1 -> T2]): derivable?(f) IMPLIES deriv_domain?[T2];


decl_type: tcc
theory: chain_rule
library: analysis
signature: nil
location: 95 0 98 999
body:
  % Assuming TCC generated (at line 14, column 12) for  derivatives[T2]
      % generated from assumption derivatives.not_one_element
  composition_derivable_fun_TCC2: OBLIGATION
    FORALL (f: [T1 -> T2]): derivable?(f) IMPLIES not_one_element?[T2];


decl_type: tcc
theory: chain_rule
library: analysis
signature: nil
location: 107 0 109 999
body:
  % Assuming TCC generated (at line 14, column 12) for  derivatives[T2]
      % generated from assumption derivatives.deriv_domain
  gg_TCC1: OBLIGATION deriv_domain?[T2];


decl_type: tcc
theory: chain_rule
library: analysis
signature: nil
location: 111 0 113 999
body:
  % Assuming TCC generated (at line 14, column 12) for  derivatives[T2]
      % generated from assumption derivatives.not_one_element
  gg_TCC2: OBLIGATION not_one_element?[T2];


decl_type: formula
theory: composition_continuous
library: analysis
signature: nil
location: 20 2 21 59
body:
    composition_cont_set : LEMMA continuous_on?(f, F) AND continuous_on?(g, Im(f, F))
                                    IMPLIES continuous_on?(g o f, F)


decl_type: formula
theory: integral_chg_var
library: analysis
signature: nil
location: 39 3 42 78
body:
     int_chg_var_prep: LEMMA continuous?(f) AND derivable?(phi)  
                             AND continuous?(deriv(phi)) IMPLIES
              continuous?((f o phi) * deriv(phi)) AND
              Integrable?[U](a, b, LAMBDA (u: U): f(phi(u)) * deriv[U](phi)(u));


decl_type: formula
theory: integral_chg_var
library: analysis
signature: nil
location: 45 3 49 72
body:
     Int_chg_var: THEOREM derivable?(phi) AND continuous?(deriv(phi)) AND
                          continuous?(f) 
                          IMPLIES
                               Integral(phi(a),phi(b),f) =
                     Integral(a,b,(LAMBDA (u:U): f(phi(u))*deriv(phi)(u)))


decl_type: formula
theory: integral_chg_var
library: analysis
signature: nil
location: 52 3 56 72
body:
     int_chg_var: THEOREM derivable?(phi) AND continuous?(deriv(phi)) AND
                          continuous?(f) AND a < b AND phi(a) < phi(b)
                          IMPLIES
                               integral(phi(a),phi(b),f) =
                     integral(a,b,(LAMBDA (u:U): f(phi(u))*deriv(phi)(u)))


decl_type: tcc
theory: integral_chg_var
library: analysis
signature: nil
location: 67 0 70 999
body:
  % Assuming TCC generated (at line 14, column 12) for  derivatives[U]
      % generated from assumption derivatives.deriv_domain
  int_chg_var_prep_TCC1: OBLIGATION
    FORALL (f: [T -> real]): continuous?(f) IMPLIES deriv_domain?[U];


decl_type: tcc
theory: integral_chg_var
library: analysis
signature: nil
location: 72 0 75 999
body:
  % Assuming TCC generated (at line 14, column 12) for  derivatives[U]
      % generated from assumption derivatives.not_one_element
  int_chg_var_prep_TCC2: OBLIGATION
    FORALL (f: [T -> real]): continuous?(f) IMPLIES not_one_element?[U];


decl_type: tcc
theory: integral_chg_var
library: analysis
signature: nil
location: 77 0 84 999
body:
  % Assuming TCC generated (at line 14, column 6) for  integral_def[U]
      % generated from assumption integral_def.connected_domain
  int_chg_var_prep_TCC3: OBLIGATION
    FORALL (f: [T -> real], phi: [U -> T]):
      continuous?(deriv(phi)) AND
       derivable?(phi) AND
        continuous?(f) AND continuous?((f o phi) * deriv(phi))
       IMPLIES connected?[U];


decl_type: tcc
theory: integral_chg_var
library: analysis
signature: nil
location: 86 0 88 999
body:
  % Assuming TCC generated (at line 14, column 12) for  derivatives[U]
      % generated from assumption derivatives.deriv_domain
  Int_chg_var_TCC1: OBLIGATION deriv_domain?[U];


decl_type: tcc
theory: integral_chg_var
library: analysis
signature: nil
location: 90 0 92 999
body:
  % Assuming TCC generated (at line 14, column 12) for  derivatives[U]
      % generated from assumption derivatives.not_one_element
  Int_chg_var_TCC2: OBLIGATION not_one_element?[U];


decl_type: tcc
theory: integral_chg_var
library: analysis
signature: nil
location: 94 0 99 999
body:
  % Subtype TCC generated (at line 48, column 52) for  f
      % expected type  Integrable_funs[T](phi(a), phi(b))
  Int_chg_var_TCC3: OBLIGATION
    FORALL (a, b: U, f: [T -> real], phi: [U -> T]):
      continuous?(f) AND continuous?(deriv(phi)) AND derivable?(phi) IMPLIES
       Integrable?[T](phi(a), phi(b), f);


decl_type: tcc
theory: integral_chg_var
library: analysis
signature: nil
location: 101 0 106 999
body:
  % Assuming TCC generated (at line 26, column 13) for  integral_def[T]
      % generated from assumption integral_def.connected_domain
  Int_chg_var_TCC4: OBLIGATION
    FORALL (f: [T -> real], phi: [U -> T]):
      continuous?(f) AND continuous?(deriv(phi)) AND derivable?(phi) IMPLIES
       connected?[T];


decl_type: tcc
theory: integral_chg_var
library: analysis
signature: nil
location: 108 0 113 999
body:
  % Assuming TCC generated (at line 26, column 13) for  integral_def[T]
      % generated from assumption integral_def.not_one_element
  Int_chg_var_TCC5: OBLIGATION
    FORALL (f: [T -> real], phi: [U -> T]):
      continuous?(f) AND continuous?(deriv(phi)) AND derivable?(phi) IMPLIES
       not_one_element?[T];


decl_type: tcc
theory: integral_chg_var
library: analysis
signature: nil
location: 115 0 121 999
body:
  % Subtype TCC generated (at line 49, column 33) for
      % (LAMBDA (u: U): f(phi(u)) * deriv(phi)(u))
      % expected type  Integrable_funs[U](a, b)
  Int_chg_var_TCC6: OBLIGATION
    FORALL (a, b: U, f: [T -> real], phi: [U -> T]):
      continuous?(f) AND continuous?(deriv(phi)) AND derivable?(phi) IMPLIES
       Integrable?[U](a, b, LAMBDA (u: U): f(phi(u)) * deriv[U](phi)(u));


decl_type: tcc
theory: integral_chg_var
library: analysis
signature: nil
location: 123 0 128 999
body:
  % Assuming TCC generated (at line 26, column 13) for  integral_def[U]
      % generated from assumption integral_def.connected_domain
  Int_chg_var_TCC7: OBLIGATION
    FORALL (f: [T -> real], phi: [U -> T]):
      continuous?(f) AND continuous?(deriv(phi)) AND derivable?(phi) IMPLIES
       connected?[U];


decl_type: tcc
theory: integral_chg_var
library: analysis
signature: nil
location: 130 0 136 999
body:
  % Subtype TCC generated (at line 55, column 52) for  f
      % expected type  {f | integrable?[T](phi(a), phi(b), f)}
  int_chg_var_TCC1: OBLIGATION
    FORALL (a, b: U, f: [T -> real], phi: [U -> T]):
           phi(a) < phi(b) AND a < b AND continuous?(f)
       AND continuous?(deriv(phi)) AND derivable?(phi)
       IMPLIES integrable?[T](phi(a), phi(b), f);


decl_type: tcc
theory: integral_chg_var
library: analysis
signature: nil
location: 138 0 146 999
body:
  % Subtype TCC generated (at line 56, column 33) for
      % (LAMBDA (u: U): f(phi(u)) * deriv(phi)(u))
      % expected type  {f | integrable?[U](a, b, f)}
  int_chg_var_TCC2: OBLIGATION
    FORALL (a, b: U, f: [T -> real], phi: [U -> T]):
           phi(a) < phi(b) AND a < b AND continuous?(f)
       AND continuous?(deriv(phi)) AND derivable?(phi)
       IMPLIES
       integrable?[U](a, b, LAMBDA (u: U): f(phi(u)) * deriv[U](phi)(u));


decl_type: formula
theory: rs_partition
library: analysis
signature: nil
location: 47 3 47 111
body:
     partition_strictly_sort: LEMMA a<b IMPLIES FORALL (P:partition(a,b)): partition_pred?(a,b)(strictly_sort(P))


decl_type: formula
theory: rs_partition
library: analysis
signature: nil
location: 54 3 56 57
body:
     width_lem     : LEMMA (FORALL (a:T), (b:{x:T|a<x}),
                              (P: partition(a,b)),(ii: below(P`length-1)):
                           width(a,b,P) >= P(ii+1) - P(ii))


decl_type: formula
theory: rs_partition
library: analysis
signature: nil
location: 58 3 59 69
body:
     width_lem_exists: LEMMA a<b IMPLIES FORALL (P:partition(a,b)):
                       EXISTS (ii:below(P`length-1)): width(a,b,P) = P(ii+1)-P(ii)


decl_type: formula
theory: rs_partition
library: analysis
signature: nil
location: 61 3 62 69
body:
     parts_order   : LEMMA  FORALL (P: partition(a,b), ii,jj: below(P`length)):
                                ii <= jj IMPLIES P`seq(ii) <= P`seq(jj)


decl_type: formula
theory: rs_partition
library: analysis
signature: nil
location: 64 3 68 39
body:
     parts_disjoint: LEMMA FORALL (P: partition(a,b), ii,jj: below(P`length-1)):
                               P`seq(ii) < x AND x < P`seq(1 + ii) AND
                               P`seq(jj) < x AND x < P`seq(1 + jj)
                               IMPLIES
                                  jj = ii


decl_type: formula
theory: rs_partition
library: analysis
signature: nil
location: 78 3 81 75
body:
     part_in       : LEMMA FORALL (P: partition(a,b)):    
                               a < b AND a <= x AND x <= b IMPLIES
                                   (EXISTS (ii: below(P`length-1)): 
                                         P`seq(ii) <= x AND x <= P`seq(ii+1))


decl_type: formula
theory: rs_partition
library: analysis
signature: nil
location: 83 3 86 74
body:
     part_in_strict_left       : LEMMA FORALL (P: partition(a,b)):    
                               a < b AND a < x AND x <= b IMPLIES
                                   (EXISTS (ii: below(P`length-1)): 
                                         P`seq(ii) < x AND x <= P`seq(ii+1))


decl_type: formula
theory: rs_partition
library: analysis
signature: nil
location: 88 3 91 54
body:
     part_not_in       : LEMMA a < b IMPLIES FORALL (P: partition(a,b)):    
                                  FORALL (ii,jj: below(P`length-1)): 
                                    P`seq(ii) < x AND x < P`seq(ii+1) 
                                  IMPLIES x /= P`seq(jj)


decl_type: formula
theory: rs_partition
library: analysis
signature: nil
location: 94 3 100 37
body:
     part_induction: LEMMA  (FORALL (P: partition(a,b)): 
                                (FORALL ( x: closed_interval(a,b)):
                             LET xx = P`seq, N = P`length IN 
                     (FORALL (ii : below(N-1)):
                             xx(ii) <= x AND x <= xx(ii+1) IMPLIES
                                  Prop(x))
                    IMPLIES Prop(x) ) )


decl_type: formula
theory: rs_partition
library: analysis
signature: nil
location: 128 3 129 74
body:
     partition_exists: LEMMA a < b IMPLIES
                          (EXISTS (P: partition(a,b)): width(a,b,P) < delta)


decl_type: formula
theory: rs_partition
library: analysis
signature: nil
location: 137 3 140 84
body:
     partjoin_def: LEMMA a<b AND b<c IMPLIES FORALL (Pab: partition(a,b),Pbc: partition(b,c)):
                   LET Pac = partjoin(a,b,c)(Pab,Pbc) IN
                   (n < Pab`length IMPLIES Pac`seq(n) = Pab`seq(n)) AND
                   (Pab`length-1 <= n AND n<Pac`length IMPLIES Pac`seq(n) = Pbc`seq(n-Pab`length+1))


decl_type: formula
theory: rs_partition
library: analysis
signature: nil
location: 142 3 143 80
body:
     partjoin_width: LEMMA a<b AND b<c IMPLIES FORALL (Pab: partition(a,b),Pbc: partition(b,c)):
                     width(a,c,partjoin(a,b,c)(Pab,Pbc)) = max(width(a,b,Pab),width(b,c,Pbc))


decl_type: formula
theory: rs_partition
library: analysis
signature: nil
location: 149 3 150 59
body:
     partition_union_sym: LEMMA a<b IMPLIES FORALL (P,Q:partition(a,b)):
                          partition_union(a,b)(P,Q) = partition_union(a,b)(Q,P)


decl_type: formula
theory: rs_partition
library: analysis
signature: nil
location: 152 3 156 36
body:
     partition_union_unique: LEMMA a<b IMPLIES FORALL (P,Q,PQ:partition(a,b)):
                             ((FORALL (x:T): member(x,PQ) IFF (member(x,P) OR member(x,Q))) AND
                          strictly_increasing?(PQ))
                             IFF
                             PQ = partition_union(a,b)(P,Q)


decl_type: formula
theory: rs_partition
library: analysis
signature: nil
location: 158 3 159 78
body:
     partition_union_width: LEMMA a<b IMPLIES FORALL (P,Q:partition(a,b)):
                            width(a,b,partition_union(a,b)(P,Q)) <= min(width(a,b,P),width(a,b,Q))


decl_type: formula
theory: rs_partition
library: analysis
signature: nil
location: 161 3 162 77
body:
     partition_strictly_sort_union: LEMMA a<b IMPLIES FORALL (P,Q:partition(a,b)):
                                    partition_union(a,b)(P,Q) = partition_union(a,b)(strictly_sort(P),Q)


decl_type: formula
theory: rs_partition
library: analysis
signature: nil
location: 164 3 165 56
body:
     partition_union_is_strictly_sort: LEMMA a<b IMPLIES FORALL (P:partition(a,b)):
                                       partition_union(a,b)(P,P) = strictly_sort(P)


decl_type: formula
theory: rs_partition
library: analysis
signature: nil
location: 170 3 173 43
body:
     partition_union_map_unique: LEMMA a<b IMPLIES FORALL (P,Q:partition(a,b),pm:[below(P`length)->below(partition_union(a,b)(P,Q)`length)]):
                                 (FORALL (ii:below(P`length)): P`seq(ii) = partition_union(a,b)(P,Q)`seq(pm(ii)))
                                 IMPLIES
                                 pm = partition_union_map(a,b,P,Q)


decl_type: formula
theory: rs_partition
library: analysis
signature: nil
location: 175 3 176 119
body:
     partition_union_map_increasing: LEMMA a<b IMPLIES FORALL (P,Q:partition(a,b),ii,jj:below(P`length)):
                                     strictly_increasing?(P) AND ii<jj IMPLIES partition_union_map(a,b,P,Q)(ii) < partition_union_map(a,b,P,Q)(jj)


decl_type: formula
theory: rs_partition
library: analysis
signature: nil
location: 178 3 179 72
body:
     partition_union_strictly_sort_map_inv: LEMMA a<b IMPLIES FORALL (P:partition(a,b),ii:below(strictly_sort(P)`length)):
                                        partition_union_map(a,b,P,P)(strictly_sort_map(P)(ii)) = ii


decl_type: formula
theory: rs_partition
library: analysis
signature: nil
location: 185 3 193 19
body:
     partition_union_map_inv_def: LEMMA a<b IMPLIES FORALL (P,Q:partition(a,b)): 
                              LET PQ = partition_union(a,b)(P,Q),
                                  pum = partition_union_map(a,b,P,Q),     
                                  puminv = partition_union_map_inv(a,b,P,Q)
                              IN
                                  FORALL (ii:below(PQ`length),jj:below(P`length)):
                                  (pum(jj) <= ii AND (jj<P`length-1 IMPLIES ii < pum(jj+1)))
                                  IMPLIES
                                  puminv(ii) = jj


decl_type: formula
theory: rs_partition
library: analysis
signature: nil
location: 196 3 200 69
body:
     partition_sort_inv_map: LEMMA a<b IMPLIES FORALL (P:partition(a,b)):
                             LET SSP = partition_union(a,b)(P,P),
                                 sig = partition_union_map_inv(a,b,P,P)
                             IN
                                 FORALL (ii:below(SSP`length)): SSP`seq(ii) = P`seq(sig(ii))


decl_type: function
theory: rs_partition
library: analysis
signature: [[a: T, {x: T | a < x}] -> [fseq[T] -> bool]]
location: 39 3 43 57
body:
     partition_pred?(a:T,b:{x:T|a<x})(fs:fseq): MACRO bool = 
                        (Let N = fs`length, xx = fs`seq IN
                        N > 1 AND xx(0) = a AND xx(N-1) = b AND 
                        increasing?(fs) AND
                        (FORALL (i:below(N)): a <= xx(i) AND xx(i) <= b))


decl_type: function
theory: rs_partition
library: analysis
signature: [[a: T, b: {x: T | a < x}, partition(a, b)] -> posreal]
location: 49 3 52 64
body:
     width(a:T, b:{x:T|a<x}, P: partition(a,b)): posreal =
               LET xx = P`seq, N = P`length IN
                        max({ l: real | EXISTS (ii: below(N-1)):
                                           l = xx(ii+1) - xx(ii)}) 


decl_type: function
theory: rs_partition
library: analysis
signature: [[a: T, b: {x: T | a < x}, partition(a, b), T] -> bool]
location: 70 3 71 70
body:
     in_part?(a:T, b:{x:T|a<x},P: partition(a,b),xx:T): MACRO bool = 
                          EXISTS (ii: below(P`length-1)): xx = P`seq(ii)


decl_type: function
theory: rs_partition
library: analysis
signature:
  [[a: T, b: {x: T | a < x}, P: partition(a, b),
  below(P`length - 1), T] ->
  bool]

location: 73 3 75 57
body:
     in_sect?(a:T, b:{x:T|a<x},P: partition(a,b),
              ii: below(P`length-1),xx:T): MACRO bool = 
                        P`seq(ii) < xx AND xx < P`seq(ii+1)


decl_type: function
theory: rs_partition
library: analysis
signature: [d: [a: T, {x: T | a < x}, above(1)] -> partition(d`1, d`2)]
location: 105 3 107 101
body:
     eq_partition(a:T,b:{x:T|a<x},N: above(1)): partition(a,b) =
                    (# length := N,
                       seq := (LAMBDA (ii: nat): IF ii<N THEN a + ii*(b-a)/(N-1) ELSE default ENDIF) #)


decl_type: function
theory: rs_partition
library: analysis
location: 134 3 135 30
signature:
  [d: [a: T, b: {bb: T | a < bb}, {cc: T | b < cc}] ->
          [[partition(d`1, d`2), partition(d`2, d`3)] ->
             partition(d`1, d`3)]]

body:
     partjoin(a:T,b: {bb:T | a<bb}, c: {cc:T | b<cc})(Pab: partition(a,b),Pbc: partition(b,c)): partition(a,c) =
       concat(Pab,delete(0,Pbc))


decl_type: function
theory: rs_partition
library: analysis
location: 145 3 147 28
signature:
  [d1: [a: T, {b | a < b}] ->
          [d: [partition(d1`1, d1`2), partition(d1`1, d1`2)] ->
             {PQ: partition(d1`1, d1`2) |
                      (FORALL (x: T):
                         member(x, PQ) IFF
                          (member(x, d`1) OR member(x, d`2)))
                       AND strictly_increasing?(PQ)}]]

body:
     partition_union(a,(b|a<b))(P,Q: partition(a,b)): {PQ: partition(a,b) |
                          (FORALL (x:T): member(x,PQ) IFF (member(x,P) OR member(x,Q))) AND
                          strictly_increasing?(PQ)}


decl_type: function
theory: rs_partition
library: analysis
location: 167 3 168 94
signature:
  [d: [a: T, b: {b | a < b}, partition(a, b), partition(a, b)] ->
          {pm:
             [below(d`3`length) ->
                below(partition_union(d`1, d`2)(d`3, d`4)`length)] |
                   FORALL (ii: below(d`3`length)):
                     d`3`seq(ii) =
                      partition_union(d`1, d`2)(d`3, d`4)`seq
                          (pm(ii))}]

body:
     partition_union_map(a,(b|a<b),P,Q:partition(a,b)): {pm:[below(P`length)->below(partition_union(a,b)(P,Q)`length)] | 
                                                        FORALL (ii:below(P`length)): P`seq(ii) = partition_union(a,b)(P,Q)`seq(pm(ii))}


decl_type: function
theory: rs_partition
library: analysis
location: 181 3 183 140
signature:
  [d: [a: T, b: {b | a < b}, partition(a, b), partition(a, b)] ->
          {pm:
             [below(partition_union(d`1, d`2)(d`3, d`4)`length) ->
                below(d`3`length)] |
                   FORALL (jj:
                             below(partition_union
                                   (d`1, d`2)(d`3, d`4)`length)):
                     d`3`seq(pm(jj)) <=
                      partition_union(d`1, d`2)(d`3, d`4)`seq(jj)
                      AND
                      (pm(jj) < d`3`length - 1 IMPLIES
                        partition_union(d`1, d`2)(d`3, d`4)`seq(jj) <
                         d`3`seq(1 + pm(jj)))}]

body:
     partition_union_map_inv(a,(b|a<b),P,Q:partition(a,b)): {pm:[below(partition_union(a,b)(P,Q)`length)->below(P`length)] | 
                          FORALL (jj:below(partition_union(a,b)(P,Q)`length)): 
                          P`seq(pm(jj)) <= partition_union(a,b)(P,Q)`seq(jj) AND (pm(jj) < P`length-1 IMPLIES partition_union(a,b)(P,Q)`seq(jj) < P`seq(pm(jj)+1))}


decl_type: tcc
theory: rs_partition
library: analysis
signature: nil
location: 214 0 220 999
body:
  % Subtype TCC generated (at line 41, column 49) for  N - 1
      % expected type  nat
  partition_pred?_TCC1: OBLIGATION
    FORALL (a: T, b: {x: T | a < x}, fs: fseq[T], N: nat):
      N = fs`length IMPLIES
       (FORALL (xx: barray[T](fs`length)):
          xx(0) = a AND N > 1 AND xx = fs`seq IMPLIES N - 1 >= 0);


decl_type: tcc
theory: rs_partition
library: analysis
signature: nil
location: 222 0 237 999
body:
  % Subtype TCC generated (at line 51, column 26) for
      % {l: real | EXISTS (ii: below(N - 1)): l = xx(ii + 1) - xx(ii)}
      % expected type  SS: non_empty_finite_set[real]
  width_TCC1: OBLIGATION
    FORALL (a: T, b: {x: T | a < x}, P: partition(a, b),
            xx: barray[T](P`length)):
      xx = P`seq IMPLIES
       (FORALL (N: nat):
          N = P`length IMPLIES
           is_finite[real]
               ({l: real |
                   EXISTS (ii: below(N - 1)): l = xx(ii + 1) - xx(ii)})
            AND
            NOT empty?[real]
                    ({l: real |
                        EXISTS (ii: below(N - 1)): l = xx(ii + 1) - xx(ii)}));


decl_type: tcc
theory: rs_partition
library: analysis
signature: nil
location: 239 0 256 999
body:
  % Subtype TCC generated (at line 51, column 22) for
      % max({l: real | EXISTS (ii: below(N - 1)): l = xx(ii + 1) - xx(ii)})
      % expected type  posreal
  width_TCC2: OBLIGATION
    FORALL (a: T, b: {x: T | a < x}, P: partition(a, b),
            xx: barray[T](P`length)):
      xx = P`seq IMPLIES
       (FORALL (N: nat):
          N = P`length IMPLIES
           max[real, <=]
               ({l: real |
                   EXISTS (ii: below(N - 1)): l = xx(ii + 1) - xx(ii)})
            >= 0
            AND
            max[real, <=]
                ({l: real |
                    EXISTS (ii: below(N - 1)): l = xx(ii + 1) - xx(ii)})
             > 0);


decl_type: tcc
theory: rs_partition
library: analysis
signature: nil
location: 258 0 261 999
body:
  % Subtype TCC generated (at line 74, column 22) for  P`length - 1
      % expected type  nat
  in_sect?_TCC1: OBLIGATION
    FORALL (a: T, b: {x: T | a < x}, P: partition(a, b)): P`length - 1 >= 0;


decl_type: tcc
theory: rs_partition
library: analysis
signature: nil
location: 263 0 267 999
body:
  % Subtype TCC generated (at line 107, column 74) for  (N - 1)
      % expected type  nznum
  eq_partition_TCC1: OBLIGATION
    FORALL (a: T, b: {x: T | a < x}, N: above(1), ii: nat):
      ii < N IMPLIES (N - 1) /= 0;


decl_type: tcc
theory: rs_partition
library: analysis
signature: nil
location: 269 0 274 999
body:
  % Subtype TCC generated (at line 107, column 60) for
      % a + ii * (b - a) / (N - 1)
      % expected type  T
  eq_partition_TCC2: OBLIGATION
    FORALL (a: T, b: {x: T | a < x}, N: above(1), ii: nat):
      ii < N IMPLIES T_pred(a + ii * (b - a) / (N - 1));


decl_type: tcc
theory: rs_partition
library: analysis
signature: nil
location: 276 0 290 999
body:
  % Subtype TCC generated (at line 107, column 29) for
      % (LAMBDA (ii: nat):
      %    IF ii < N THEN a + ii * (b - a) / (N - 1) ELSE default ENDIF)
      % expected type  barray[T](N)
  eq_partition_TCC3: OBLIGATION
    FORALL (a: T, b: {x: T | a < x}, N: above(1)):
      (FORALL (ii: nat):
         T_pred(IF ii < N THEN a + ii * (b - a) / (N - 1)
                ELSE default[T]
                ENDIF))
       AND
       (FORALL (i: nat):
          i >= N IMPLIES
           IF i < N THEN a + i * (b - a) / (N - 1) ELSE default[T] ENDIF =
            default[T]);


decl_type: tcc
theory: rs_partition
library: analysis
signature: nil
location: 292 0 320 999
body:
  % Subtype TCC generated (at line 106, column 18) for
      % (# length := N,
      %    seq
      %      := (LAMBDA (ii: nat):
      %            IF ii < N THEN a + ii * (b - a) / (N - 1)
      %            ELSE default
      %            ENDIF) #)
      % expected type  partition(a, b)
  eq_partition_TCC4: OBLIGATION
    FORALL (a: T, b: {x: T | a < x}, N: above(1)):
           N > 1
       AND IF 0 < N THEN a + 0 * (b - a) / (N - 1) ELSE default[T] ENDIF = a
       AND IF N - 1 < N THEN a + (N - 1) * (b - a) / (N - 1)
           ELSE default[T]
           ENDIF
            = b
       AND increasing?[T, restrict[[real, real], [T, T], boolean](<=)]
               ((# length := N,
                   seq
                     := (LAMBDA (ii: nat):
                           IF ii < N THEN a + ii * (b - a) / (N - 1)
                           ELSE default[T]
                           ENDIF) #))
       AND FORALL (i: below(N)):
             a <=
              IF i < N THEN a + i * (b - a) / (N - 1) ELSE default[T] ENDIF
              AND
              IF i < N THEN a + i * (b - a) / (N - 1) ELSE default[T] ENDIF
               <= b;


decl_type: tcc
theory: rs_partition
library: analysis
signature: nil
location: 322 0 325 999
body:
  % Subtype TCC generated (at line 116, column 63) for  N - 1
      % expected type  nat
  eq_part_lem_b_TCC1: OBLIGATION
    FORALL (N: above(1), a, b: T): a < b IMPLIES N - 1 >= 0;


decl_type: tcc
theory: rs_partition
library: analysis
signature: nil
location: 327 0 330 999
body:
  % Subtype TCC generated (at line 119, column 68) for  (N - 1)
      % expected type  nznum
  width_eq_part_TCC1: OBLIGATION
    FORALL (N: above(1), a, b: T): a < b IMPLIES (N - 1) /= 0;


decl_type: tcc
theory: rs_partition
library: analysis
signature: nil
location: 332 0 337 999
body:
  % Subtype TCC generated (at line 125, column 54) for  N
      % expected type  above(1)
  N_from_delta_TCC1: OBLIGATION
    FORALL (a, b: T, delta: posreal):
      a < b IMPLIES
       (FORALL (N: int): N = 2 + floor((b - a) / delta) IMPLIES N > 1);


decl_type: tcc
theory: rs_partition
library: analysis
signature: nil
location: 339 0 342 999
body:
  % Subtype TCC generated (at line 134, column 106) for  c
      % expected type  {x: T | a < x}
  partjoin_TCC1: OBLIGATION
    FORALL (a: T, b: {bb: T | a < bb}, c: {cc: T | b < cc}): a < c;


decl_type: tcc
theory: rs_partition
library: analysis
signature: nil
location: 344 0 349 999
body:
  % Subtype TCC generated (at line 135, column 25) for  Pbc
      % expected type  ne_fseq[T]
  partjoin_TCC2: OBLIGATION
    FORALL (a: T, b: {bb: T | a < bb}, c: {cc: T | b < cc},
            Pab: partition(a, b), Pbc: partition(b, c)):
      length(Pbc) > 0;


decl_type: tcc
theory: rs_partition
library: analysis
signature: nil
location: 351 0 366 999
body:
  % Subtype TCC generated (at line 135, column 5) for
      % concat(Pab, delete(0, Pbc))
      % expected type  partition(a, c)
  partjoin_TCC3: OBLIGATION
    FORALL (a: T, b: {bb: T | a < bb}, c: {cc: T | b < cc},
            Pab: partition(a, b), Pbc: partition(b, c)):
           concat[T](Pab, delete[T](0, Pbc))`length > 1
       AND concat[T](Pab, delete[T](0, Pbc))`seq(0) = a
       AND concat[T](Pab, delete[T](0, Pbc))`seq
               (concat[T](Pab, delete[T](0, Pbc))`length - 1)
            = c
       AND increasing?[T, restrict[[real, real], [T, T], boolean](<=)]
               (concat[T](Pab, delete[T](0, Pbc)))
       AND FORALL (i: below(concat[T](Pab, delete[T](0, Pbc))`length)):
             a <= concat[T](Pab, delete[T](0, Pbc))`seq(i) AND
              concat[T](Pab, delete[T](0, Pbc))`seq(i) <= c;


decl_type: tcc
theory: rs_partition
library: analysis
signature: nil
location: 368 0 379 999
body:
  % Subtype TCC generated (at line 140, column 68) for  n - Pab`length + 1
      % expected type  nat
  partjoin_def_TCC1: OBLIGATION
    FORALL (a, b, c: T, n: nat):
      b < c AND a < b IMPLIES
       (FORALL (Pab: partition(a, b), Pbc: partition(b, c),
                Pac: partition(a, c)):
          Pab`length - 1 <= n AND
           n < Pac`length AND
            (n < Pab`length IMPLIES Pac`seq(n) = Pab`seq(n)) AND
             Pac = partjoin(a, b, c)(Pab, Pbc)
           IMPLIES n - Pab`length + 1 >= 0);


decl_type: tcc
theory: rs_partition
library: analysis
signature: nil
location: 381 0 386 999
body:
  % Subtype TCC generated (at line 143, column 16) for  c
      % expected type  {x: T | a < x}
  partjoin_width_TCC1: OBLIGATION
    FORALL (a, b, c: T):
      b < c AND a < b IMPLIES
       (FORALL (Pab: partition(a, b), Pbc: partition(b, c)): a < c);


decl_type: tcc
theory: rs_partition
library: analysis
signature: nil
location: 388 0 392 999
body:
  % Subtype TCC generated (at line 41, column 49) for  fs`length - 1
      % expected type  nat
  partition_union_TCC1: OBLIGATION
    FORALL (a, fs: fseq[T]):
      fs`seq(0) = a AND fs`length > 1 IMPLIES fs`length - 1 >= 0;


decl_type: tcc
theory: rs_partition
library: analysis
signature: nil
location: 394 0 414 999
body:
  % Existence TCC generated (at line 145, column 3) for
      % partition_union(a, (b: T | a < b))(P, Q: partition(a, b)):
      %       {PQ: partition(a, b) |
      %                (FORALL (x: T):
      %                   member(x, PQ) IFF (member(x, P) OR member(x, Q)))
      %                 AND strictly_increasing?(PQ)}
  partition_union_TCC2: OBLIGATION
    EXISTS (x1:
              [d1: [a: T, {b | a < b}] ->
                 [d: [partition(d1`1, d1`2), partition(d1`1, d1`2)] ->
                    {PQ: partition(d1`1, d1`2) |
                             (FORALL (x: T):
                                member[T](x, PQ) IFF
                                 (member[T](x, d`1) OR member[T](x, d`2)))
                              AND
                              strictly_increasing?
                                  [T,
                                   restrict[[real, real], [T, T], boolean]
                                       (<=)]
                                  (PQ)}]]):
      TRUE;


decl_type: tcc
theory: rs_partition
library: analysis
signature: nil
location: 416 0 456 999
body:
  % Subtype TCC generated (at line 162, column 58) for  strictly_sort(P)
      % expected type  partition(a, b)
  partition_strictly_sort_union_TCC1: OBLIGATION
    FORALL (a, b: T):
      a < b IMPLIES
       (FORALL (P, Q: partition(a, b)):
               strictly_sort[T, restrict[[real, real], [T, T], boolean](<=)]
                   (P)`length
                > 1
           AND strictly_sort[T, restrict[[real, real], [T, T], boolean](<=)]
                   (P)`seq
                   (0)
                = a
           AND strictly_sort[T, restrict[[real, real], [T, T], boolean](<=)]
                   (P)`seq
                   (strictly_sort
                        [T, restrict[[real, real], [T, T], boolean](<=)]
                        (P)`length
                     - 1)
                = b
           AND increasing?[T, restrict[[real, real], [T, T], boolean](<=)]
                   (strictly_sort
                        [T, restrict[[real, real], [T, T], boolean](<=)]
                        (P))
           AND FORALL (i:
                         below(strictly_sort
                                   [T,
                                    restrict[[real, real], [T, T], boolean]
                                        (<=)]
                                   (P)`length)):
                 a <=
                  strictly_sort
                      [T, restrict[[real, real], [T, T], boolean](<=)]
                      (P)`seq
                      (i)
                  AND
                  strictly_sort
                      [T, restrict[[real, real], [T, T], boolean](<=)]
                      (P)`seq
                      (i)
                   <= b);


decl_type: tcc
theory: rs_partition
library: analysis
signature: nil
location: 458 0 475 999
body:
  % Existence TCC generated (at line 167, column 3) for
      % partition_union_map(a, (b: T | a < b), P, Q: partition(a, b)):
      %       {pm:
      %          [below(P`length) ->
      %             below(partition_union(a, b)(P, Q)`length)] |
      %                FORALL (ii: below(P`length)):
      %                  P`seq(ii) = partition_union(a, b)(P, Q)`seq(pm(ii))}
  partition_union_map_TCC1: OBLIGATION
    EXISTS (x:
              [d: [a: T, b: {b | a < b}, partition(a, b), partition(a, b)] ->
                 {pm:
                    [below(d`3`length) ->
                       below(partition_union(d`1, d`2)(d`3, d`4)`length)] |
                          FORALL (ii: below(d`3`length)):
                            d`3`seq(ii) =
                             partition_union(d`1, d`2)(d`3, d`4)`seq
                                 (pm(ii))}]):
      TRUE;


decl_type: tcc
theory: rs_partition
library: analysis
signature: nil
location: 477 0 504 999
body:
  % Existence TCC generated (at line 181, column 3) for
      % partition_union_map_inv(a, (b: T | a < b), P, Q: partition(a, b)):
      %       {pm:
      %          [below(partition_union(a, b)(P, Q)`length) ->
      %             below(P`length)] |
      %                FORALL (jj:
      %                          below(partition_union(a, b)(P, Q)`length)):
      %                  P`seq(pm(jj)) <= partition_union(a, b)(P, Q)`seq(jj)
      %                   AND
      %                   (pm(jj) < P`length - 1 IMPLIES
      %                     partition_union(a, b)(P, Q)`seq(jj) <
      %                      P`seq(pm(jj) + 1))}
  partition_union_map_inv_TCC1: OBLIGATION
    EXISTS (x:
              [d: [a: T, b: {b | a < b}, partition(a, b), partition(a, b)] ->
                 {pm:
                    [below(partition_union(d`1, d`2)(d`3, d`4)`length) ->
                       below(d`3`length)] |
                          FORALL (jj:
                                    below(partition_union
                                          (d`1, d`2)(d`3, d`4)`length)):
                            d`3`seq(pm(jj)) <=
                             partition_union(d`1, d`2)(d`3, d`4)`seq(jj)
                             AND
                             (pm(jj) < d`3`length - 1 IMPLIES
                               partition_union(d`1, d`2)(d`3, d`4)`seq(jj) <
                                d`3`seq(1 + pm(jj)))}]):
      TRUE;


decl_type: tcc
theory: rs_partition
library: analysis
signature: nil
location: 506 0 549 999
body:
  % Subtype TCC generated (at line 191, column 55) for  jj + 1
      % expected type  below(P`length)
  partition_union_map_inv_def_TCC1: OBLIGATION
    FORALL (a, b: T):
      a < b IMPLIES
       (FORALL (P, Q: partition(a, b),
                PQ:
                  {PQ: partition(a, b) |
                           (FORALL (x: T):
                              member[T](x, PQ) IFF
                               (member[T](x, P) OR member[T](x, Q)))
                            AND
                            strictly_increasing?
                                [T,
                                 restrict[[real, real], [T, T], boolean](<=)]
                                (PQ)}):
          PQ = partition_union(a, b)(P, Q) IMPLIES
           (FORALL (pum:
                      {pm:
                         [below(P`length) ->
                            below(partition_union(a, b)(P, Q)`length)] |
                               FORALL (ii: below(P`length)):
                                 P`seq(ii) =
                                  partition_union(a, b)(P, Q)`seq(pm(ii))}):
              pum = partition_union_map(a, b, P, Q) IMPLIES
               (FORALL (puminv:
                          {pm:
                             [below(partition_union(a, b)(P, Q)`length) ->
                                below(P`length)] |
                                   FORALL (jj:
                                           below(partition_union
                                                 (a, b)(P, Q)`length)):
                                     P`seq(pm(jj)) <=
                                      partition_union(a, b)(P, Q)`seq(jj)
                                      AND
                                      (pm(jj) < P`length - 1
                                       IMPLIES
                                       partition_union(a, b)(P, Q)`seq(jj)
                                       <
                                       P`seq(1 + pm(jj)))}):
                  puminv = partition_union_map_inv(a, b, P, Q) IMPLIES
                   (FORALL (ii: below(PQ`length), jj: below(P`length)):
                      jj < P`length - 1 AND pum(jj) <= ii IMPLIES
                       jj + 1 < P`length))));


decl_type: tcc
theory: rs_partition
library: analysis
signature: nil
location: 551 0 595 999
body:
  % Subtype TCC generated (at line 193, column 11) for  ii
      % expected type  below(partition_union(a, b)(P, Q)`length)
  partition_union_map_inv_def_TCC2: OBLIGATION
    FORALL (a, b: T):
      a < b IMPLIES
       (FORALL (P, Q: partition(a, b),
                PQ:
                  {PQ: partition(a, b) |
                           (FORALL (x: T):
                              member[T](x, PQ) IFF
                               (member[T](x, P) OR member[T](x, Q)))
                            AND
                            strictly_increasing?
                                [T,
                                 restrict[[real, real], [T, T], boolean](<=)]
                                (PQ)}):
          PQ = partition_union(a, b)(P, Q) IMPLIES
           (FORALL (pum:
                      {pm:
                         [below(P`length) ->
                            below(partition_union(a, b)(P, Q)`length)] |
                               FORALL (ii: below(P`length)):
                                 P`seq(ii) =
                                  partition_union(a, b)(P, Q)`seq(pm(ii))}):
              pum = partition_union_map(a, b, P, Q) IMPLIES
               (FORALL (puminv:
                          {pm:
                             [below(partition_union(a, b)(P, Q)`length) ->
                                below(P`length)] |
                                   FORALL (jj:
                                           below(partition_union
                                                 (a, b)(P, Q)`length)):
                                     P`seq(pm(jj)) <=
                                      partition_union(a, b)(P, Q)`seq(jj)
                                      AND
                                      (pm(jj) < P`length - 1
                                       IMPLIES
                                       partition_union(a, b)(P, Q)`seq(jj)
                                       <
                                       P`seq(1 + pm(jj)))}):
                  puminv = partition_union_map_inv(a, b, P, Q) IMPLIES
                   (FORALL (ii: below(PQ`length), jj: below(P`length)):
                      pum(jj) <= ii AND
                       (jj < P`length - 1 IMPLIES ii < pum(jj + 1))
                       IMPLIES ii < partition_union(a, b)(P, Q)`length))));


decl_type: tcc
theory: rs_partition
library: analysis
signature: nil
location: 597 0 629 999
body:
  % Subtype TCC generated (at line 200, column 65) for  ii
      % expected type  below(partition_union(a, b)(P, P)`length)
  partition_sort_inv_map_TCC1: OBLIGATION
    FORALL (a, b: T):
      a < b IMPLIES
       (FORALL (P: partition(a, b),
                SSP:
                  {PQ: partition(a, b) |
                           (FORALL (x: T):
                              member[T](x, PQ) IFF
                               (member[T](x, P) OR member[T](x, P)))
                            AND
                            strictly_increasing?
                                [T,
                                 restrict[[real, real], [T, T], boolean](<=)]
                                (PQ)}):
          SSP = partition_union(a, b)(P, P) IMPLIES
           (FORALL (sig:
                      {pm:
                         [below(partition_union(a, b)(P, P)`length) ->
                            below(P`length)] |
                               FORALL (jj:
                                       below(partition_union
                                             (a, b)(P, P)`length)):
                                 P`seq(pm(jj)) <=
                                  partition_union(a, b)(P, P)`seq(jj)
                                  AND
                                  (pm(jj) < P`length - 1 IMPLIES
                                    partition_union(a, b)(P, P)`seq(jj) <
                                     P`seq(1 + pm(jj)))}):
              sig = partition_union_map_inv(a, b, P, P) IMPLIES
               (FORALL (ii: below(SSP`length)):
                  ii < partition_union(a, b)(P, P)`length)));


decl_type: formula
theory: rs_integral_def
library: analysis
signature: nil
location: 39 3 41 64
body:
     xis_lem: LEMMA FORALL (P: partition(a,b), (xis: xis?(a,b,P)),
                           (ii: below(P`length-1))):
                           P(ii) <= xis(ii) AND xis(ii) <= P(ii+1)


decl_type: formula
theory: rs_integral_def
library: analysis
signature: nil
location: 43 3 45 54
body:
     xis_bounded: LEMMA FORALL (P: partition(a,b), (xis: xis?(a,b,P)),
                           (ii: below(P`length-1))):
                           a <= xis(ii) AND xis(ii) <= b


decl_type: formula
theory: rs_integral_def
library: analysis
signature: nil
location: 67 3 69 82
body:
     Rie_sum_alt_lem: LEMMA a < b IMPLIES
                              FORALL (P: partition(a,b), (xis: xis?(a,b,P))):
                                 Rie_sum(a,b,g,P,xis,f) = Rie_sum_alt(a,b,g,P,xis,f) 


decl_type: formula
theory: rs_integral_def
library: analysis
signature: nil
location: 76 3 79 95
body:
     Riemann_sum_strictly_sort: LEMMA a<b IMPLIES FORALL (P:partition(a,b),RS:real):
                                 (EXISTS (xis:xis?(a,b,P)): RS = Rie_sum(a,b,g,P,xis,f))
                                 IFF
                                 (EXISTS (xis:xis?(a,b,strictly_sort(P))): RS = Rie_sum(a,b,g,strictly_sort(P),xis,f))


decl_type: formula
theory: rs_integral_def
library: analysis
signature: nil
location: 100 3 102 78
body:
     Riemann?_Rie: LEMMA a < b IMPLIES FORALL (P: partition(a,b),
                                               xis: xis?(a,b,P)): 
                                 Riemann_sum?(a,b,P,g,f)(Rie_sum(a,b,g,P,xis,f)) 


decl_type: formula
theory: rs_integral_def
library: analysis
signature: nil
location: 107 3 108 66
body:
     integral_unique: LEMMA a < b AND integral?(a,b,g,f,A1) AND
                               integral?(a,b,g,f,A2) IMPLIES A1 = A2


decl_type: formula
theory: rs_integral_def
library: analysis
signature: nil
location: 119 3 121 52
body:
     integral_def: LEMMA a < b IMPLIES
                     ( (integrable?(a,b,g,f) AND integral(a,b,g,f) = s)
                            IFF integral?(a,b,g,f,s) )


decl_type: formula
theory: rs_integral_def
library: analysis
signature: nil
location: 123 3 128 72
body:
     integral_restrict_eq: LEMMA a < b AND
                                  (FORALL x: a <= x AND x <= b IMPLIES
                                            f(x) = h(x)) AND
                                 integrable?(a,b,g,f)
                            IMPLIES integrable?(a,b,g,h) AND
                                     integral(a,b,g,h) = integral(a,b,g,f)


decl_type: formula
theory: rs_integral_def
library: analysis
signature: nil
location: 149 2 153 92
body:
    Rie_sum_extend_union : LEMMA a<b IMPLIES
                                 FORALL (P,Q: partition(a,b)): LET PQ = partition_union(a,b)(P,Q) IN
                                 strictly_increasing?(P) IMPLIES FORALL (xis:xis?(a,b,P)): Rie_sum(a,b,g,P,xis,f) = 
                                 sigma[below(PQ`length-1)](0,PQ`length-2,LAMBDA (n:below(PQ`length-1)):
                                                          f(xis`seq(partition_union_map_inv(a,b,P,Q)(n)))*(g(PQ`seq(1+n))-g(PQ`seq(n))))


decl_type: formula
theory: rs_integral_def
library: analysis
signature: nil
location: 155 2 166 54
body:
    Rie_sum_restrict_union: LEMMA a<b IMPLIES FORALL (P,Q: partition(a,b)): 
                            LET
                                  PQ = partition_union(a,b)(P,Q),
                                  pum = partition_union_map(a,b,P,Q)
                            IN    FORALL (xispq:xis?(a,b,PQ)):
                                  strictly_increasing?(P) AND
                                  (FORALL (ii:below(P`length),jj,kk:below(PQ`length)):
                                  pum(ii)<=jj AND pum(ii)<=kk AND (ii<P`length-1 IMPLIES jj<pum(ii+1) AND kk<pum(ii+1))
                                  IMPLIES xispq`seq(jj) = xispq`seq(kk))
                                  IMPLIES
                                  EXISTS (xis:xis?(a,b,P)):
                                  Rie_sum(a,b,g,PQ,xispq,f) = Rie_sum(a,b,g,P,xis,f)


decl_type: formula
theory: rs_integral_def
library: analysis
signature: nil
location: 168 2 173 62
body:
    Rie_sum_diff_extend_union : LEMMA a<b IMPLIES LET CI = closed_intv(a,b) IN
                                   (increasing?[(CI)](g) IMPLIES
                                 FORALL (P,Q: partition(a,b)): LET PQ = partition_union(a,b)(P,Q) IN
                                 FORALL (xispq:xis?(a,b,PQ),xis:xis?(a,b,P)): EXISTS (xis2:xis?(a,b,P)):
                                 abs(Rie_sum(a,b,g,P,xis,f) - Rie_sum(a,b,g,PQ,xispq,f)) <=
                                 abs(Rie_sum(a,b,g,P,xis,f)-Rie_sum(a,b,g,P,xis2,f)))


decl_type: function
theory: rs_integral_def
library: analysis
signature:
  [[a: T, b: {b | a < b}, partition[T](a, b)] ->
  [fseq[T] -> bool]]

location: 30 3 31 76
body:
     xis_pred?(a:T,(b|a<b),P:partition(a,b))(fs:fseq): MACRO bool = (fs`length = P`length-1 AND (FORALL (ii: below(P`length-1)):
                       P`seq(ii) <= fs`seq(ii) AND fs`seq(ii) <= P`seq(ii+1)))


decl_type: function
theory: rs_integral_def
library: analysis
location: 35 3 37 14
signature:
  [d1: [a: T, b: {b | a < b}, {c | b < c}] ->
          [d: [partition[T](d1`1, d1`2), partition[T](d1`2, d1`3)] ->
             [[xis?(d1`1, d1`2, d`1), xis?(d1`2, d1`3, d`2)] ->
                xis?(d1`1, d1`3,
                     partjoin(d1`1, d1`2, d1`3)(d`1, d`2))]]]

body:
     xis_join(a:T,(b | a<b), (c| b<c))(Pab: partition(a,b),Pbc: partition(b,c))(xab: xis?(a,b,Pab),xbc:xis?(b,c,Pbc)):
       xis?(a,c,partjoin(a,b,c)(Pab,Pbc)) =
       xab o xbc


decl_type: function
theory: rs_integral_def
library: analysis
location: 49 3 53 82
signature:
  [[a: T, b: {x: T | a < x}, [T -> real], P: partition[T](a, b),
         xis?(a, b, P), [T -> real]] ->
          real]

body:
     Rie_sum(a:T,b:{x:T|a<x},g:[T->real],P:partition(a,b),
                    xis: xis?(a,b,P),f:[T->real]): real =
                    LET N = P`length-1 IN
            sigma[below(N)](0,N-1,(LAMBDA (n: below(N)):
                                         (g(P`seq(n+1)) - g(P`seq(n))) * f(xis(n))))


decl_type: function
theory: rs_integral_def
library: analysis
location: 55 3 59 32
signature:
  [[a: T, b: {x: T | a < x}, [T -> real], P: partition[T](a, b),
         xis?(a, b, P), [T -> real], upto(P`length - 1)] ->
          real]

body:
     Rie_sec(a:T,b:{x:T|a<x},g:[T->real],P:partition(a,b), xis: xis?(a,b,P), f:[T->real], 
             n: upto(P`length-1)): real = 
                             IF n = 0 THEN 0
                             ELSE (g(P`seq(n)) - g(P`seq(n - 1))) * f(xis(n-1)) 
                             ENDIF


decl_type: function
theory: rs_integral_def
library: analysis
location: 61 3 65 54
signature:
  [[a: T, b: {x: T | a < x}, [T -> real], P: partition[T](a, b),
         xis?(a, b, P), [T -> real]] ->
          real]

body:
     Rie_sum_alt(a:T,b:{x:T|a<x},g:[T->real],P:partition(a,b),
                    xis: xis?(a,b,P),f:[T->real]): real =
                    LET N = P`length-1 IN
                       sigma[upto(N)](1,N,(LAMBDA (n: upto(N)): 
                              Rie_sec(a,b,g,P,xis,f,n)))


decl_type: function
theory: rs_integral_def
library: analysis
location: 71 3 73 38
signature:
  [[a: T, b: {x: T | a < x}, partition[T](a, b), [T -> real],
         [T -> real]] ->
          [real -> bool]]

body:
     Riemann_sum?(a:T,b:{x:T|a<x},P:partition(a,b),g,f:[T->real])(S:real): bool =
       (EXISTS (xis: xis?(a,b,P)): LET N = P`length-1 IN
             S = Rie_sum(a,b,g,P,xis,f))


decl_type: function
theory: rs_integral_def
library: analysis
signature:
  [[a: T, {x: T | a < x}, [T -> real], [T -> real], real] ->
  bool]

location: 82 3 87 53
body:
     integral?(a:T,b:{x:T|a<x},g,f:[T->real],S:real): bool  = 
                  (FORALL (epsi: posreal): (EXISTS (delta: posreal):
                      (FORALL (P: partition(a,b)):
                          width(a,b,P) < delta IMPLIES
                             (FORALL (R: (Riemann_sum?(a,b,P,g,f))):
                                  abs(S - R) < epsi))))


decl_type: function
theory: rs_integral_def
library: analysis
signature: [[a: T, b: {x: T | a < x}, partition[T](a, b)] -> [nat -> T]]
location: 91 3 93 55
body:
     pick_one(a:T,b:{x:T|a<x},P: partition(a,b))(ii: nat): T =
                          IF ii>= P`length-1 THEN default
                          ELSE x_in(P(ii), P(ii+1)) ENDIF


decl_type: function
theory: rs_integral_def
library: analysis
signature:
  [d: [a: T, b: {x: T | a < x}, partition[T](a, b)] ->
  xis?(d`1, d`2, d`3)]

location: 95 3 98 40
body:
     gen_xis(a:T,b:{x:T|a<x},P: partition(a,b)): xis?(a,b,P) = 
                                       (# length := P`length - 1,
                                          seq :=  pick_one(a,b,P)
                                        #)


decl_type: function
theory: rs_integral_def
library: analysis
signature: [[a: T, {x: T | a < x}, [T -> real], [T -> real]] -> bool]
location: 111 3 112 60
body:
     integrable?(a:T,b:{x:T|a<x},g,f:[T->real]): bool = 
                       (EXISTS (S:real): integral?(a,b,g,f,S))


decl_type: function
theory: rs_integral_def
library: analysis
location: 114 3 115 53
signature:
  [d:
          [a: T, b: {x: T | a < x}, gg: [T -> real],
           {f | integrable?(a, b, gg, f)}] ->
          {S: real | integral?(d`1, d`2, d`3, d`4, S)}]

body:
     integral(a:T,b:{x:T|a<x}, gg:[T->real],ff: { f | integrable?(a,b,gg,f)} ):
                      {S:real | integral?(a,b,gg,ff,S)}


decl_type: function
theory: rs_integral_def
library: analysis
signature: [[T, T, [T -> real], [T -> real]] -> bool]
location: 130 3 132 66
body:
     Integrable?(a:T,b:T,g,f:[T->real]): bool = (a = b) OR
                                   (a < b AND integrable?(a,b,g,f)) OR
                                   (b < a  AND integrable?(b,a,g,f))


decl_type: function
theory: rs_integral_def
library: analysis
signature: [[T, T, [T -> real], [T -> real], real] -> bool]
location: 136 3 137 63
body:
     Integral?(a:T,b:T,g,f:[T->real],S:real): bool = (a = b AND S = 0) OR
                                 (a < b AND integral?(a,b,g,f,S))


decl_type: function
theory: rs_integral_def
library: analysis
signature:
  [[a: T, b: T, g: [T -> real], Integrable_funs(a, b, g)] ->
  real]

location: 140 3 144 31
body:
     Integral(a:T,b:T,g:[T->real],f:Integrable_funs(a,b,g)): real =
                                            IF a = b THEN 0
                                            ELSIF a < b THEN integral(a,b,g,f)
                                            ELSE -integral(b,a,g,f)
                                            ENDIF


decl_type: tcc
theory: rs_integral_def
library: analysis
signature: nil
location: 184 0 186 999
body:
  % Assuming TCC generated (at line 18, column 13) for  rs_partition[T]
      % generated from assumption rs_partition.connected_domain
  IMP_rs_partition_TCC1: OBLIGATION connected?[T];


decl_type: tcc
theory: rs_integral_def
library: analysis
signature: nil
location: 188 0 190 999
body:
  % Assuming TCC generated (at line 18, column 13) for  rs_partition[T]
      % generated from assumption rs_partition.not_one_element
  IMP_rs_partition_TCC2: OBLIGATION not_one_element?[T];


decl_type: tcc
theory: rs_integral_def
library: analysis
signature: nil
location: 192 0 195 999
body:
  % Subtype TCC generated (at line 36, column 12) for  c
      % expected type  b: {b | a < b}
  xis_join_TCC1: OBLIGATION
    FORALL (a: T, (b: T | a < b), (c: T | b < c)): a < c;


decl_type: tcc
theory: rs_integral_def
library: analysis
signature: nil
location: 197 0 209 999
body:
  % Subtype TCC generated (at line 37, column 5) for  xab o xbc
      % expected type  xis?(a, c, partjoin(a, b, c)(Pab, Pbc))
  xis_join_TCC2: OBLIGATION
    FORALL (a: T, (b: T | a < b), (c: T | b < c), Pab: partition[T](a, b),
            Pbc: partition[T](b, c), xab: xis?(a, b, Pab),
            xbc: xis?(b, c, Pbc)):
      ((o[T](xab, xbc))`length = partjoin[T](a, b, c)(Pab, Pbc)`length - 1
        AND
        (FORALL (ii: below(partjoin[T](a, b, c)(Pab, Pbc)`length - 1)):
           partjoin[T](a, b, c)(Pab, Pbc)`seq(ii) <= (o[T](xab, xbc))`seq(ii)
            AND
            (o[T](xab, xbc))`seq(ii) <=
             partjoin[T](a, b, c)(Pab, Pbc)`seq(1 + ii)));


decl_type: tcc
theory: rs_integral_def
library: analysis
signature: nil
location: 211 0 217 999
body:
  % Subtype TCC generated (at line 52, column 26) for  0
      % expected type  T_low[below(N)]
  Rie_sum_TCC1: OBLIGATION
    FORALL (a: T, b: {x: T | a < x}, P: partition[T](a, b),
            xis: xis?(a, b, P), N: int):
      N = P`length - 1 IMPLIES
       0 >= 0 AND 0 < N OR (EXISTS (j: below(N)): j <= 0);


decl_type: tcc
theory: rs_integral_def
library: analysis
signature: nil
location: 219 0 225 999
body:
  % Subtype TCC generated (at line 52, column 28) for  N - 1
      % expected type  T_high[below(N)]
  Rie_sum_TCC2: OBLIGATION
    FORALL (a: T, b: {x: T | a < x}, P: partition[T](a, b),
            xis: xis?(a, b, P), N: int):
      N = P`length - 1 IMPLIES
       N - 1 >= 0 AND N - 1 < N OR (EXISTS (j: below(N)): N - 1 <= j);


decl_type: tcc
theory: rs_integral_def
library: analysis
signature: nil
location: 227 0 234 999
body:
  % Assuming TCC generated (at line 41, column 5) for  reals@sigma[below(N)]
      % generated from assumption sigma.connected_domain
  Rie_sum_TCC3: OBLIGATION
    FORALL (a: T, b: {x: T | a < x}, P: partition[T](a, b),
            xis: xis?(a, b, P), N: int):
      N = P`length - 1 IMPLIES
       (FORALL (x, y: below(N)), (z: integer):
          x <= z AND z <= y IMPLIES z >= 0 AND z < N);


decl_type: tcc
theory: rs_integral_def
library: analysis
signature: nil
location: 236 0 239 999
body:
  % Subtype TCC generated (at line 56, column 19) for  P`length - 1
      % expected type  nat
  Rie_sec_TCC1: OBLIGATION
    FORALL (a: T, b: {x: T | a < x}, P: partition(a, b)): P`length - 1 >= 0;


decl_type: tcc
theory: rs_integral_def
library: analysis
signature: nil
location: 241 0 246 999
body:
  % Subtype TCC generated (at line 58, column 55) for  n - 1
      % expected type  nat
  Rie_sec_TCC2: OBLIGATION
    FORALL (a: T, b: {x: T | a < x}, P: partition[T](a, b),
            xis: xis?(a, b, P), n: upto(P`length - 1)):
      NOT n = 0 IMPLIES n - 1 >= 0;


decl_type: tcc
theory: rs_integral_def
library: analysis
signature: nil
location: 248 0 254 999
body:
  % Subtype TCC generated (at line 64, column 36) for  1
      % expected type  T_low[upto(N)]
  Rie_sum_alt_TCC1: OBLIGATION
    FORALL (a: T, b: {x: T | a < x}, P: partition[T](a, b),
            xis: xis?(a, b, P), N: int):
      N = P`length - 1 IMPLIES
       1 >= 0 AND 1 <= N OR (EXISTS (j: upto(N)): j <= 1);


decl_type: tcc
theory: rs_integral_def
library: analysis
signature: nil
location: 256 0 262 999
body:
  % Subtype TCC generated (at line 64, column 38) for  N
      % expected type  T_high[upto(N)]
  Rie_sum_alt_TCC2: OBLIGATION
    FORALL (a: T, b: {x: T | a < x}, P: partition[T](a, b),
            xis: xis?(a, b, P), N: int):
      N = P`length - 1 IMPLIES
       N >= 0 AND N <= N OR (EXISTS (j: upto(N)): N <= j);


decl_type: tcc
theory: rs_integral_def
library: analysis
signature: nil
location: 264 0 269 999
body:
  % Subtype TCC generated (at line 65, column 50) for  n
      % expected type  upto(P`length - 1)
  Rie_sum_alt_TCC3: OBLIGATION
    FORALL (a: T, b: {x: T | a < x}, P: partition[T](a, b),
            xis: xis?(a, b, P), N: int):
      N = P`length - 1 IMPLIES (FORALL (n: upto(N)): n <= P`length - 1);


decl_type: tcc
theory: rs_integral_def
library: analysis
signature: nil
location: 271 0 278 999
body:
  % Assuming TCC generated (at line 41, column 5) for  reals@sigma[upto(N)]
      % generated from assumption sigma.connected_domain
  Rie_sum_alt_TCC4: OBLIGATION
    FORALL (a: T, b: {x: T | a < x}, P: partition[T](a, b),
            xis: xis?(a, b, P), N: int):
      N = P`length - 1 IMPLIES
       (FORALL (x, y: upto(N)), (z: integer):
          x <= z AND z <= y IMPLIES z >= 0 AND z <= N);


decl_type: tcc
theory: rs_integral_def
library: analysis
signature: nil
location: 280 0 325 999
body:
  % Subtype TCC generated (at line 79, column 71) for  strictly_sort(P)
      % expected type  partition[T](a, b)
  Riemann_sum_strictly_sort_TCC1: OBLIGATION
    FORALL (a, b: T):
      a < b IMPLIES
       (FORALL (P: partition[T](a, b),
                xis:
                  xis?(a, b,
                       strictly_sort
                           [T, restrict[[real, real], [T, T], boolean](<=)]
                           (P))):
               strictly_sort[T, restrict[[real, real], [T, T], boolean](<=)]
                   (P)`length
                > 1
           AND strictly_sort[T, restrict[[real, real], [T, T], boolean](<=)]
                   (P)`seq
                   (0)
                = a
           AND strictly_sort[T, restrict[[real, real], [T, T], boolean](<=)]
                   (P)`seq
                   (strictly_sort
                        [T, restrict[[real, real], [T, T], boolean](<=)]
                        (P)`length
                     - 1)
                = b
           AND increasing?[T, restrict[[real, real], [T, T], boolean](<=)]
                   (strictly_sort
                        [T, restrict[[real, real], [T, T], boolean](<=)]
                        (P))
           AND FORALL (i:
                         below(strictly_sort
                                   [T,
                                    restrict[[real, real], [T, T], boolean]
                                        (<=)]
                                   (P)`length)):
                 a <=
                  strictly_sort
                      [T, restrict[[real, real], [T, T], boolean](<=)]
                      (P)`seq
                      (i)
                  AND
                  strictly_sort
                      [T, restrict[[real, real], [T, T], boolean](<=)]
                      (P)`seq
                      (i)
                   <= b);


decl_type: tcc
theory: rs_integral_def
library: analysis
signature: nil
location: 327 0 333 999
body:
  % Existence TCC generated (at line 89, column 3) for
      % x_in(aa: T, bb: {x: T | aa <= x}): {t: T | aa <= t AND t <= bb}
  x_in_TCC1: OBLIGATION
    EXISTS (x1:
              [d: [aa: T, {x: T | aa <= x}] ->
                 {t: T | d`1 <= t AND t <= d`2}]):
      TRUE;


decl_type: tcc
theory: rs_integral_def
library: analysis
signature: nil
location: 335 0 339 999
body:
  % Subtype TCC generated (at line 93, column 41) for  P`seq(ii + 1)
      % expected type  {x: T | P`seq(ii) <= x}
  pick_one_TCC1: OBLIGATION
    FORALL (a: T, b: {x: T | a < x}, P: partition[T](a, b), ii: nat):
      NOT ii >= P`length - 1 IMPLIES P`seq(ii) <= P`seq(ii + 1);


decl_type: tcc
theory: rs_integral_def
library: analysis
signature: nil
location: 341 0 346 999
body:
  % Subtype TCC generated (at line 97, column 48) for  pick_one(a, b, P)
      % expected type  barray[T](P`length - 1)
  gen_xis_TCC1: OBLIGATION
    FORALL (a: T, b: {x: T | a < x}, P: partition[T](a, b)):
      FORALL (i: nat):
        i >= P`length - 1 IMPLIES pick_one(a, b, P)(i) = default[T];


decl_type: tcc
theory: rs_integral_def
library: analysis
signature: nil
location: 348 0 355 999
body:
  % Subtype TCC generated (at line 96, column 37) for
      % (# length := P`length - 1, seq := pick_one(a, b, P) #)
      % expected type  xis?(a, b, P)
  gen_xis_TCC2: OBLIGATION
    FORALL (a: T, b: {x: T | a < x}, P: partition[T](a, b)):
      FORALL (ii: below(P`length - 1)):
        P`seq(ii) <= pick_one(a, b, P)(ii) AND
         pick_one(a, b, P)(ii) <= P`seq(1 + ii);


decl_type: tcc
theory: rs_integral_def
library: analysis
signature: nil
location: 357 0 367 999
body:
  % Existence TCC generated (at line 114, column 3) for
      % integral(a: T, b: {x: T | a < x}, gg: [T -> real],
      %          ff: {f | integrable?(a, b, gg, f)}):
      %       {S: real | integral?(a, b, gg, ff, S)}
  integral_TCC1: OBLIGATION
    EXISTS (x1:
              [d:
                 [a: T, b: {x: T | a < x}, gg: [T -> real],
                  {f | integrable?(a, b, gg, f)}] ->
                 {S: real | integral?(d`1, d`2, d`3, d`4, S)}]):
      TRUE;


decl_type: tcc
theory: rs_integral_def
library: analysis
signature: nil
location: 369 0 373 999
body:
  % Subtype TCC generated (at line 142, column 58) for  f
      % expected type  {f | integrable?(a, b, g, f)}
  Integral_TCC1: OBLIGATION
    FORALL (a, b: T, g: [T -> real], f: Integrable_funs(a, b, g)):
      a < b AND NOT a = b IMPLIES integrable?(a, b, g, f);


decl_type: tcc
theory: rs_integral_def
library: analysis
signature: nil
location: 375 0 379 999
body:
  % Subtype TCC generated (at line 143, column 43) for  a
      % expected type  {x: T | b < x}
  Integral_TCC2: OBLIGATION
    FORALL (a, b: T, g: [T -> real], f: Integrable_funs(a, b, g)):
      NOT a < b AND NOT a = b IMPLIES b < a;


decl_type: tcc
theory: rs_integral_def
library: analysis
signature: nil
location: 381 0 385 999
body:
  % Subtype TCC generated (at line 143, column 47) for  f
      % expected type  {f | integrable?(b, a, g, f)}
  Integral_TCC3: OBLIGATION
    FORALL (a, b: T, g: [T -> real], f: Integrable_funs(a, b, g)):
      NOT a < b AND NOT a = b IMPLIES integrable?(b, a, g, f);


decl_type: tcc
theory: rs_integral_def
library: analysis
signature: nil
location: 387 0 407 999
body:
  % Subtype TCC generated (at line 152, column 36) for  0
      % expected type  T_low[below(PQ`length - 1)]
  Rie_sum_extend_union_TCC1: OBLIGATION
    FORALL (a, b: T):
      a < b IMPLIES
       (FORALL (P, Q: partition[T](a, b),
                PQ:
                  {PQ: partition[T](a, b) |
                           (FORALL (x: T):
                              member[T](x, PQ) IFF
                               (member[T](x, P) OR member[T](x, Q)))
                            AND
                            strictly_increasing?
                                [T,
                                 restrict[[real, real], [T, T], boolean](<=)]
                                (PQ)}):
          strictly_increasing?(P) AND PQ = partition_union(a, b)(P, Q)
           IMPLIES
           (FORALL (xis: xis?(a, b, P)):
              0 >= 0 AND 0 < PQ`length - 1 OR
               (EXISTS (j: below(PQ`length - 1)): j <= 0)));


decl_type: tcc
theory: rs_integral_def
library: analysis
signature: nil
location: 409 0 429 999
body:
  % Subtype TCC generated (at line 152, column 38) for  PQ`length - 2
      % expected type  T_high[below(PQ`length - 1)]
  Rie_sum_extend_union_TCC2: OBLIGATION
    FORALL (a, b: T):
      a < b IMPLIES
       (FORALL (P, Q: partition[T](a, b),
                PQ:
                  {PQ: partition[T](a, b) |
                           (FORALL (x: T):
                              member[T](x, PQ) IFF
                               (member[T](x, P) OR member[T](x, Q)))
                            AND
                            strictly_increasing?
                                [T,
                                 restrict[[real, real], [T, T], boolean](<=)]
                                (PQ)}):
          strictly_increasing?(P) AND PQ = partition_union(a, b)(P, Q)
           IMPLIES
           (FORALL (xis: xis?(a, b, P)):
              PQ`length - 2 >= 0 AND PQ`length - 2 < PQ`length - 1 OR
               (EXISTS (j: below(PQ`length - 1)): PQ`length - 2 <= j)));


decl_type: tcc
theory: rs_integral_def
library: analysis
signature: nil
location: 431 0 450 999
body:
  % Subtype TCC generated (at line 153, column 57) for  n
      % expected type  below(partition_union(a, b)(P, Q)`length)
  Rie_sum_extend_union_TCC3: OBLIGATION
    FORALL (a, b: T):
      a < b IMPLIES
       (FORALL (P, Q: partition[T](a, b),
                PQ:
                  {PQ: partition[T](a, b) |
                           (FORALL (x: T):
                              member[T](x, PQ) IFF
                               (member[T](x, P) OR member[T](x, Q)))
                            AND
                            strictly_increasing?
                                [T,
                                 restrict[[real, real], [T, T], boolean](<=)]
                                (PQ)}):
          strictly_increasing?(P) AND PQ = partition_union(a, b)(P, Q)
           IMPLIES
           (FORALL (xis: xis?(a, b, P), n: below(PQ`length - 1)):
              n < partition_union[T](a, b)(P, Q)`length));


decl_type: tcc
theory: rs_integral_def
library: analysis
signature: nil
location: 452 0 482 999
body:
  % Subtype TCC generated (at line 162, column 66) for  ii + 1
      % expected type  below(P`length)
  Rie_sum_restrict_union_TCC1: OBLIGATION
    FORALL (a, b: T):
      a < b IMPLIES
       (FORALL (P, Q: partition[T](a, b),
                PQ:
                  {PQ: partition[T](a, b) |
                           (FORALL (x: T):
                              member[T](x, PQ) IFF
                               (member[T](x, P) OR member[T](x, Q)))
                            AND
                            strictly_increasing?
                                [T,
                                 restrict[[real, real], [T, T], boolean](<=)]
                                (PQ)}):
          PQ = partition_union(a, b)(P, Q) IMPLIES
           (FORALL (pum:
                      {pm:
                         [below(P`length) ->
                            below(partition_union[T](a, b)(P, Q)`length)] |
                               FORALL (ii: below(P`length)):
                                 P`seq(ii) =
                                  partition_union[T](a, b)(P, Q)`seq
                                      (pm(ii))}):
              pum = partition_union_map(a, b, P, Q) IMPLIES
               (FORALL (xispq: xis?(a, b, PQ)):
                  strictly_increasing?(P) IMPLIES
                   (FORALL (ii: below(P`length), jj, kk: below(PQ`length)):
                      ii < P`length - 1 AND pum(ii) <= kk AND pum(ii) <= jj
                       IMPLIES ii + 1 < P`length))));


decl_type: formula
theory: rs_integral_prep
library: analysis
signature: nil
location: 32 3 33 80
body:
     integral_const_fun: LEMMA a < b IMPLIES integrable?(a,b,g,const_fun(D))
                                 AND integral(a,b,g, const_fun(D)) = D*(g(b)-g(a))


decl_type: formula
theory: rs_integral_prep
library: analysis
signature: nil
location: 35 3 37 66
body:
     integral_const_restrict: LEMMA a < b AND 
                 (FORALL (x: closed_interval(a,b)): f(x) = D) IMPLIES
                                    integral?(a,b,g,f,D*(g(b)-g(a)))


decl_type: formula
theory: rs_integral_prep
library: analysis
signature: nil
location: 46 3 48 72
body:
     integral_scal: LEMMA a < b AND integrable?(a,b,g,f) IMPLIES
                              integrable?(a,b,g,D*f) AND
                                 integral(a,b,g,D*f) = D*integral(a,b,g,f)


decl_type: formula
theory: rs_integral_prep
library: analysis
signature: nil
location: 50 3 52 72
body:
     integral_scal_g: LEMMA a < b AND integrable?(a,b,g,f) IMPLIES
                              integrable?(a,b,D*g,f) AND
                                 integral(a,b,D*g,f) = D*integral(a,b,g,f)


decl_type: formula
theory: rs_integral_prep
library: analysis
signature: nil
location: 55 3 59 71
body:
     integral_sum: LEMMA a < b AND integrable?(a,b,g,f) AND integrable?(a,b,g,h) 
                        IMPLIES
                           integrable?(a,b,g,(LAMBDA x: f(x) + h(x)))  AND
                               integral(a,b,g,(LAMBDA x: f(x) + h(x))) =
                                    integral(a,b,g,f) + integral(a,b,g,h)


decl_type: formula
theory: rs_integral_prep
library: analysis
signature: nil
location: 61 3 65 71
body:
     integral_sum_g: LEMMA a < b AND integrable?(a,b,g,f) AND integrable?(a,b,h,f) 
                        IMPLIES
                           integrable?(a,b,(LAMBDA x: g(x) + h(x)),f)  AND
                               integral(a,b,(LAMBDA x: g(x) + h(x)),f) =
                                    integral(a,b,g,f) + integral(a,b,h,f)


decl_type: formula
theory: rs_integral_prep
library: analysis
signature: nil
location: 68 3 71 71
body:
     integral?_sum: LEMMA a < b AND integral?(a,b,g,f,v1) AND 
                                      integral?(a,b,g,h,v2) 
                        IMPLIES
                           integral?(a,b,g,(LAMBDA x: f(x) + h(x)),v1+v2)


decl_type: formula
theory: rs_integral_prep
library: analysis
signature: nil
location: 73 3 76 68
body:
     integral?_sum_g: LEMMA a < b AND integral?(a,b,g,f,v1) AND 
                                      integral?(a,b,h,f,v2) 
                        IMPLIES
                           integral?(a,b,(LAMBDA x:g(x)+h(x)),f,v1+v2)


decl_type: formula
theory: rs_integral_prep
library: analysis
signature: nil
location: 78 3 82 71
body:
     integral_diff: LEMMA a < b AND integrable?(a,b,g,f) AND integrable?(a,b,g,h) 
                        IMPLIES
                           integrable?(a,b,g,(LAMBDA x: f(x) - h(x)))  AND
                               integral(a,b,g,(LAMBDA x: f(x) - h(x))) =
                                    integral(a,b,g,f) - integral(a,b,g,h)


decl_type: formula
theory: rs_integral_prep
library: analysis
signature: nil
location: 84 3 88 71
body:
     integral_diff_g: LEMMA a < b AND integrable?(a,b,g,f) AND integrable?(a,b,h,f) 
                        IMPLIES
                           integrable?(a,b,(LAMBDA x:g(x)-h(x)),f)  AND
                               integral(a,b,(LAMBDA x:g(x)-h(x)),f) =
                                    integral(a,b,g,f) - integral(a,b,h,f)


decl_type: formula
theory: rs_integral_prep
library: analysis
signature: nil
location: 90 3 93 49
body:
     integral_ge_0: LEMMA a < b AND increasing?(g) AND
                          integrable?(a,b,g,f) AND 
                          (FORALL (x: closed_interval(a,b)): f(x) >= 0) IMPLIES
                             integral(a,b,g,f) >= 0


decl_type: formula
theory: rs_integral_prep
library: analysis
signature: nil
location: 96 3 101 72
body:
     integral_restr_eq: LEMMA a < b AND          
                                  (FORALL x: a <= x AND x <= b IMPLIES
                                            f(x) = h(x)) AND
                                 integrable?(a,b,g,f)
                            IMPLIES integrable?(a,b,g,h) AND
                                     integral(a,b,g,h) = integral(a,b,g,f)


decl_type: formula
theory: rs_integral_prep
library: analysis
signature: nil
location: 103 3 106 53
body:
     integral_bound_above: LEMMA a < b AND increasing?(g) AND
                             integrable?(a,b,g,f) AND 
                             (FORALL (x: closed_interval(a,b)):f(x)<=M)
             IMPLIES integral(a,b,g,f) <= M*(g(b)-g(a))


decl_type: formula
theory: rs_integral_prep
library: analysis
signature: nil
location: 108 3 111 53
body:
     integral_bound_below: LEMMA a < b AND increasing?(g) AND
                             integrable?(a,b,g,f) AND
                             (FORALL (x: closed_interval(a,b)): m<=f(x))
             IMPLIES m*(g(b)-g(a)) <= integral(a,b,g,f)


decl_type: formula
theory: rs_integral_prep
library: analysis
signature: nil
location: 115 3 119 61
body:
     integral_le : LEMMA a < b AND increasing?(g) AND
                         integrable?(a,b,g,f) AND integrable?(a,b,g,h)
                         AND (FORALL (x: closed_interval(a,b)): f(x) <= h(x))
                      IMPLIES
                         integral(a,b,g,f) <= integral(a,b,g,h)


decl_type: formula
theory: rs_integral_prep
library: analysis
signature: nil
location: 123 3 134 52
body:
     Lemma_1: LEMMA a < b IMPLIES
                 (integrable?(a,b,g,f) IMPLIES
                    (FORALL eps: EXISTS delta:
                        (FORALL (P1,P2: partition(a,b),
                                 xis1:xis?(a,b,P1),
                                 xis2:xis?(a,b,P2)):
                          LET S1 = Rie_sum(a,b,g,P1,xis1,f),
                              S2 = Rie_sum(a,b,g,P2,xis2,f) IN
                          (width(a,b,P1) < delta AND
                           width(a,b,P2) < delta)
                             IMPLIES
                                abs(S1 - S2) < eps )))


decl_type: formula
theory: rs_integral_prep
library: analysis
signature: nil
location: 136 3 144 62
body:
     integrable_lem: THEOREM  a < b IMPLIES      
                       (integrable?(a,b,g,f) IFF
                          (FORALL (epsi: posreal): (EXISTS (delta: posreal):
                               (FORALL (P1,P2: partition(a,b)):
                                 width(a,b,P1) < delta AND
                                 width(a,b,P2) < delta IMPLIES
                                 (FORALL (RS1: (Riemann_sum?(a,b,P1,g,f)),
                                          RS2: (Riemann_sum?(a,b,P2,g,f))):
                                     abs(RS1 - RS2) < epsi )))))


decl_type: formula
theory: rs_integral_prep
library: analysis
signature: nil
location: 148 3 156 63
body:
     integrable_lem2_alt: LEMMA a<b IMPLIES LET CI = closed_intv(a,b) IN
                  (monotonic?[(CI)](g) IMPLIES   % Added 8/2010 for RS integral
                        (integrable?(a,b,g,f) IFF
                          (FORALL (epsi: posreal): (EXISTS (delta: posreal):
                               (FORALL (P: partition(a,b)):
                                 width(a,b,P) < delta IMPLIES
                                 (FORALL (RS1: (Riemann_sum?(a,b,P,g,f)),
                                          RS2: (Riemann_sum?(a,b,P,g,f))):
                                     abs(RS1 - RS2) < epsi ))))))


decl_type: formula
theory: rs_integral_prep
library: analysis
signature: nil
location: 158 3 166 63
body:
     integrable_lem2: LEMMA a<b IMPLIES LET CI = closed_intv(a,b) IN
                  (monotonic?[(CI)](g) IMPLIES   % Added 8/2010 for RS integral
                        (integrable?(a,b,g,f) IFF
                          (FORALL (epsi: posreal): (EXISTS (delta: posreal):
                               (FORALL (P: partition(a,b)):
                                 width(a,b,P) < delta IMPLIES
                                 (FORALL (RS1: (Riemann_sum?(a,b,P,g,f)),
                                          RS2: (Riemann_sum?(a,b,P,g,f))):
                                     abs(RS1 - RS2) < epsi ))))))


decl_type: tcc
theory: rs_integral_prep
library: analysis
signature: nil
location: 182 0 184 999
body:
  % Assuming TCC generated (at line 19, column 13) for  rs_integral_def[T]
      % generated from assumption rs_integral_def.connected_domain
  IMP_rs_integral_def_TCC1: OBLIGATION connected?[T];


decl_type: tcc
theory: rs_integral_prep
library: analysis
signature: nil
location: 186 0 188 999
body:
  % Assuming TCC generated (at line 19, column 13) for  rs_integral_def[T]
      % generated from assumption rs_integral_def.not_one_element
  IMP_rs_integral_def_TCC2: OBLIGATION not_one_element?[T];


decl_type: formula
theory: bounded_variation
library: analysis
signature: nil
location: 33 3 34 69
body:
     variation_on_strictly_sort: LEMMA a<b IMPLIES FORALL (P:partition(a,b)):
                                 variation_on(a,b,P) = variation_on(a,b,strictly_sort(P))


decl_type: formula
theory: bounded_variation
library: analysis
signature: nil
location: 39 3 39 115
body:
     monotonic_BV: LEMMA FORALL (bb:T | a<bb): monotonic?[(closed_intv(a,bb))](f) IMPLIES bounded_variation?(a,bb)(f)


decl_type: formula
theory: bounded_variation
library: analysis
signature: nil
location: 43 3 44 66
body:
     BV_bound: LEMMA a<b AND (FORALL (P:partition(a,b)): variation_on(a,b,P)(f) <= M) IMPLIES
               (FORALL (x:(closed_intv(a,b))): abs(f(x)) <= abs(f(a))+M)


decl_type: formula
theory: bounded_variation
library: analysis
signature: nil
location: 46 3 47 65
body:
     BV_add: LEMMA a<b AND bounded_variation?(a,b)(f) AND bounded_variation?(a,b)(g) 
             IMPLIES bounded_variation?(a,b)((LAMBDA (x:T): f(x)+g(x)))


decl_type: formula
theory: bounded_variation
library: analysis
signature: nil
location: 49 3 49 106
body:
     BV_scal: LEMMA a<b and bounded_variation?(a,b)(f) IMPLIES bounded_variation?(a,b)(LAMBDA (x:T): D*f(x))


decl_type: formula
theory: bounded_variation
library: analysis
signature: nil
location: 51 3 52 65
body:
     BV_sub: LEMMA a<b AND bounded_variation?(a,b)(f) AND bounded_variation?(a,b)(g)
             IMPLIES bounded_variation?(a,b)((LAMBDA (x:T): f(x)-g(x)))


decl_type: formula
theory: bounded_variation
library: analysis
signature: nil
location: 54 3 55 63
body:
     BV_mult: LEMMA a<b AND bounded_variation?(a,b)(f) AND bounded_variation?(a,b)(g)
             IMPLIES bounded_variation?(a,b)(LAMBDA (x:T): f(x)*g(x))


decl_type: formula
theory: bounded_variation
library: analysis
signature: nil
location: 59 3 61 55
body:
     variation_on_subset: LEMMA a<=c AND c<d AND d<=b IMPLIES FORALL (Pcd:partition(c,d)):
                          EXISTS (Pab:partition(a,b)):
                          variation_on(c,d,Pcd)(f) <= variation_on(a,b,Pab)(f)


decl_type: formula
theory: bounded_variation
library: analysis
signature: nil
location: 63 3 63 107
body:
     BV_subset: LEMMA a<=c AND c<d AND d<=b AND bounded_variation?(a,b)(f) IMPLIES bounded_variation?(c,d)(f)


decl_type: formula
theory: bounded_variation
library: analysis
signature: nil
location: 75 3 77 64
body:
     total_variation_approx: LEMMA a<b AND bounded_variation?(a,b)(f) IMPLIES FORALL (x:(closed_intv(a,b))):
           a /= x IMPLIES FORALL (epsi:posreal): EXISTS (P:partition(a,x)):
           variation_on(a,x,P)(f) > total_variation(a,b,f)(x)-epsi


decl_type: formula
theory: bounded_variation
library: analysis
signature: nil
location: 80 3 83 53
body:
     BV_decomposition: LEMMA a<b IMPLIES (bounded_variation?(a,b)(f) IFF
                       LET CI = closed_intv(a,b) IN
                       EXISTS (g,h): f = (LAMBDA (x:T): g(x)-h(x)) AND
                       increasing?[(CI)](g) AND increasing?[(CI)](h))


decl_type: function
theory: bounded_variation
library: analysis
signature:
  [[a: T, b: {b | a < b}, partition[T](a, b)] ->
  [[T -> real] -> nnreal]]

location: 29 3 31 44
body:
     variation_on(a,(b | a<b),P:partition(a,b))(f) : nnreal =
        sigma[below(P`length-1)](0,P`length-2,LAMBDA (n:below(P`length-1)):
                                                   abs(f(P`seq(n+1))-f(P`seq(n))))


decl_type: function
theory: bounded_variation
library: analysis
signature: [[a: T, {b | a < b}] -> [[T -> real] -> bool]]
location: 36 3 37 76
body:
     bounded_variation?(a,(b | a<b))(f): bool = (EXISTS (M: nnreal): 
                     (FORALL (P:partition(a,b)): variation_on(a,b,P)(f) <= M))


decl_type: function
theory: bounded_variation
library: analysis
location: 67 3 71 34
signature:
  [d: [a: T, b: {b | a < b}, (bounded_variation?(a, b))] ->
          [x: (LAMBDA (x: T): d`1 <= x AND x <= d`2) ->
             {M: nnreal |
                      (x = d`1 IMPLIES M = 0) AND
                       (x > d`1 IMPLIES
                         (FORALL (P: partition(d`1, x)):
                            variation_on(d`1, x, P)(d`3) <= M))
                        AND
                        (FORALL (M1: nnreal):
                           M1 < M IMPLIES
                            (EXISTS (P: partition(d`1, x)):
                               variation_on(d`1, x, P)(d`3) > M1))}]]

body:
     total_variation(a,(b|a<b),f:(bounded_variation?(a,b)))(x : (closed_intv(a,b))) : {M : nnreal |
                                  (x = a IMPLIES M = 0) AND
                                  (x>a IMPLIES FORALL (P:partition(a,x)): variation_on(a,x,P)(f)<=M) AND
                                  (FORALL (M1: nnreal): M1 < M IMPLIES EXISTS (P:partition(a,x)):
                                          variation_on(a,x,P)(f) > M1)}


decl_type: tcc
theory: bounded_variation
library: analysis
signature: nil
location: 103 0 108 999
body:
  % Subtype TCC generated (at line 30, column 31) for  0
      % expected type  T_low[below(P`length - 1)]
  variation_on_TCC1: OBLIGATION
    FORALL (a: T, (b: T | a < b), P: partition[T](a, b)):
      0 >= 0 AND 0 < P`length - 1 OR
       (EXISTS (j: below(P`length - 1)): j <= 0);


decl_type: tcc
theory: bounded_variation
library: analysis
signature: nil
location: 110 0 115 999
body:
  % Subtype TCC generated (at line 30, column 33) for  P`length - 2
      % expected type  T_high[below(P`length - 1)]
  variation_on_TCC2: OBLIGATION
    FORALL (a: T, (b: T | a < b), P: partition[T](a, b)):
      P`length - 2 >= 0 AND P`length - 2 < P`length - 1 OR
       (EXISTS (j: below(P`length - 1)): P`length - 2 <= j);


decl_type: tcc
theory: bounded_variation
library: analysis
signature: nil
location: 117 0 123 999
body:
  % Assuming TCC generated (at line 41, column 5) for
      % reals@sigma[below(P`length - 1)]
      % generated from assumption sigma.connected_domain
  variation_on_TCC3: OBLIGATION
    FORALL (a: T, (b: T | a < b), P: partition[T](a, b)):
      FORALL (x, y: below(P`length - 1)), (z: integer):
        x <= z AND z <= y IMPLIES z >= 0 AND z < P`length - 1;


decl_type: tcc
theory: bounded_variation
library: analysis
signature: nil
location: 125 0 165 999
body:
  % Subtype TCC generated (at line 34, column 52) for  strictly_sort(P)
      % expected type  partition[T](a, b)
  variation_on_strictly_sort_TCC1: OBLIGATION
    FORALL (a, b: T):
      a < b IMPLIES
       (FORALL (P: partition[T](a, b)):
               strictly_sort[T, restrict[[real, real], [T, T], boolean](<=)]
                   (P)`length
                > 1
           AND strictly_sort[T, restrict[[real, real], [T, T], boolean](<=)]
                   (P)`seq
                   (0)
                = a
           AND strictly_sort[T, restrict[[real, real], [T, T], boolean](<=)]
                   (P)`seq
                   (strictly_sort
                        [T, restrict[[real, real], [T, T], boolean](<=)]
                        (P)`length
                     - 1)
                = b
           AND increasing?[T, restrict[[real, real], [T, T], boolean](<=)]
                   (strictly_sort
                        [T, restrict[[real, real], [T, T], boolean](<=)]
                        (P))
           AND FORALL (i:
                         below(strictly_sort
                                   [T,
                                    restrict[[real, real], [T, T], boolean]
                                        (<=)]
                                   (P)`length)):
                 a <=
                  strictly_sort
                      [T, restrict[[real, real], [T, T], boolean](<=)]
                      (P)`seq
                      (i)
                  AND
                  strictly_sort
                      [T, restrict[[real, real], [T, T], boolean](<=)]
                      (P)`seq
                      (i)
                   <= b);


decl_type: tcc
theory: bounded_variation
library: analysis
signature: nil
location: 167 0 169 999
body:
  % Subtype TCC generated (at line 39, column 71) for  bb
      % expected type  {x: T | a <= x}
  monotonic_BV_TCC1: OBLIGATION FORALL (a: T, bb: T | a < bb): a <= bb;


decl_type: tcc
theory: bounded_variation
library: analysis
signature: nil
location: 171 0 176 999
body:
  % Subtype TCC generated (at line 61, column 46) for  b
      % expected type  {b | a < b}
  variation_on_subset_TCC1: OBLIGATION
    FORALL (a, b, c, d: T):
      d <= b AND c < d AND a <= c IMPLIES
       (FORALL (Pcd: partition[T](c, d), Pab: partition[T](a, b)): a < b);


decl_type: tcc
theory: bounded_variation
library: analysis
signature: nil
location: 178 0 181 999
body:
  % Subtype TCC generated (at line 63, column 67) for  b
      % expected type  {b | a < b}
  BV_subset_TCC1: OBLIGATION
    FORALL (a, b, c, d: T): a <= c AND c < d AND d <= b IMPLIES a < b;


decl_type: tcc
theory: bounded_variation
library: analysis
signature: nil
location: 183 0 189 999
body:
  % Subtype TCC generated (at line 69, column 59) for  x
      % expected type  {b | a < b}
  total_variation_TCC1: OBLIGATION
    FORALL (a, (b: T | a < b), x: (LAMBDA (x: T): a <= x AND x <= b),
            M: nnreal):
      x > a AND (x = a IMPLIES M = 0) IMPLIES
       (FORALL (P: partition[T](a, x)): a < x);


decl_type: tcc
theory: bounded_variation
library: analysis
signature: nil
location: 191 0 201 999
body:
  % Subtype TCC generated (at line 71, column 20) for  x
      % expected type  {b | a < b}
  total_variation_TCC2: OBLIGATION
    FORALL (a, (b: T | a < b), f: (bounded_variation?(a, b)),
            x: (LAMBDA (x: T): a <= x AND x <= b), M: nnreal):
      (x > a IMPLIES
        (FORALL (P: partition(a, x)): variation_on(a, x, P)(f) <= M))
       AND (x = a IMPLIES M = 0)
       IMPLIES
       (FORALL (M1: nnreal):
          M1 < M IMPLIES (FORALL (P1: partition[T](a, x)): a < x));


decl_type: tcc
theory: bounded_variation
library: analysis
signature: nil
location: 203 0 232 999
body:
  % Existence TCC generated (at line 67, column 3) for
      % total_variation(a, (b: T | a < b), f: (bounded_variation?(a, b)))
      %                (x: (LAMBDA (x: T): a <= x AND x <= b)):
      %       {M: nnreal |
      %                (x = a IMPLIES M = 0) AND
      %                 (x > a IMPLIES
      %                   (FORALL (P: partition(a, x)):
      %                      variation_on(a, x, P)(f) <= M))
      %                  AND
      %                  (FORALL (M1: nnreal):
      %                     M1 < M IMPLIES
      %                      (EXISTS (P: partition(a, x)):
      %                         variation_on(a, x, P)(f) > M1))}
  total_variation_TCC3: OBLIGATION
    EXISTS (x1:
              [d: [a: T, b: {b | a < b}, (bounded_variation?(a, b))] ->
                 [x: (LAMBDA (x: T): d`1 <= x AND x <= d`2) ->
                    {M: nnreal |
                             (x = d`1 IMPLIES M = 0) AND
                              (x > d`1 IMPLIES
                                (FORALL (P: partition[T](d`1, x)):
                                   variation_on(d`1, x, P)(d`3) <= M))
                               AND
                               (FORALL (M1: nnreal):
                                  M1 < M IMPLIES
                                   (EXISTS (P: partition[T](d`1, x)):
                                      variation_on(d`1, x, P)(d`3)
                                      >
                                      M1))}]]):
      TRUE;


decl_type: tcc
theory: bounded_variation
library: analysis
signature: nil
location: 234 0 240 999
body:
  % Subtype TCC generated (at line 77, column 24) for  x
      % expected type  {b | a < b}
  total_variation_approx_TCC1: OBLIGATION
    FORALL (a, b: T, f: [T -> real]):
      bounded_variation?(a, b)(f) AND a < b IMPLIES
       (FORALL (x: (LAMBDA (x: T): a <= x AND x <= b)):
          a /= x IMPLIES (FORALL (P: partition[T](a, x)): a < x));


decl_type: formula
theory: prelude_sets_aux
library: analysis
signature: nil
location: 13 2 14 78
body:
    Intersection_member:
               LEMMA member(x,Intersection(A)) IFF (FORALL (a:(A)): member(x,a))


decl_type: formula
theory: prelude_sets_aux
library: analysis
signature: nil
location: 16 2 17 78
body:
    Intersection_split: LEMMA nonempty?(A) IMPLIES
               (Intersection(A) = intersection(choose(A),Intersection(rest(A))))


decl_type: formula
theory: prelude_sets_aux
library: analysis
signature: nil
location: 19 2 22 58
body:
    Intersection_finite: LEMMA
          P(fullset[T]) AND is_finite(A) AND (FORALL (a:(A)): P(a)) AND
          (FORALL (a,b:set[T]): P(a) AND P(b) IMPLIES P(intersection(a,b)))
                                  IMPLIES P(Intersection(A))


decl_type: formula
theory: prelude_sets_aux
library: analysis
signature: nil
location: 29 2 32 51
body:
    Union_finite: LEMMA
          P(emptyset[T]) AND is_finite(A) AND (FORALL (a:(A)): P(a)) AND
          (FORALL (a,b:set[T]): P(a) AND P(b) IMPLIES P(union(a,b)))
                                  IMPLIES P(Union(A))


decl_type: formula
theory: prelude_sets_aux
library: analysis
signature: nil
location: 49 2 52 80
body:
    epsilon_to_sequence: LEMMA 
       (FORALL (epsilon: posreal): EXISTS (s: (S)):
           f(s) < epsilon)IMPLIES
              (EXISTS (seq: [posint -> (S)]): FORALL (n: posint): f(seq(n)) < 1/n)


decl_type: formula
theory: finite_sets_aux
library: analysis
signature: nil
location: 6 3 7 62
body:
     is_finite_exists_N: LEMMA FORALL (g: [below[N] -> T]):
              is_finite({r: T | EXISTS (n: below[N]): r = g(n)})


decl_type: formula
theory: metric_spaces
library: analysis
signature: nil
location: 82 2 83 78
body:
    Complement_open:   LEMMA FORALL (XS:set[open_set]):
                                                  every(closed?)(Complement(XS))


decl_type: formula
theory: metric_spaces
library: analysis
signature: nil
location: 84 2 85 76
body:
    Complement_closed: LEMMA FORALL (XS:set[closed_set]):
                                                  every(open?)(Complement(XS))


decl_type: formula
theory: metric_spaces
library: analysis
signature: nil
location: 97 2 98 72
body:
    open_Intersection_open: THEOREM 
                 FORALL (FS:finite_set[open_set]): open?(Intersection(FS))


decl_type: formula
theory: metric_spaces
library: analysis
signature: nil
location: 103 2 104 69
body:
    closed_Union_closed: THEOREM
                 FORALL (FS:finite_set[closed_set]): closed?(Union(FS))


decl_type: formula
theory: metric_spaces
library: analysis
signature: nil
location: 109 2 110 69
body:
    closed_Intersection_closed: THEOREM 
                 FORALL (XS:set[closed_set]): closed?(Intersection(XS))


decl_type: formula
theory: metric_spaces
library: analysis
signature: nil
location: 114 2 115 77
body:
    open_closed_difference: LEMMA FORALL (A:open_set,B:closed_set):
                                                         open?(difference(A,B))


decl_type: formula
theory: metric_spaces
library: analysis
signature: nil
location: 118 2 119 79
body:
    closed_open_difference: LEMMA FORALL (A:open_set,B:closed_set):
                                                         closed?(difference(B,A))


decl_type: formula
theory: metric_spaces
library: analysis
signature: nil
location: 124 2 125 96
body:
    open_def: THEOREM subset?(S,X) AND subset?(A,S) IMPLIES
                    (open?(A) IFF (EXISTS B: subset?(B,S) AND open?(B) AND A = intersection(B,S)))


decl_type: function
theory: metric_spaces
library: analysis
signature: [[set[T], set[T]] -> bool]
location: 45 2 46 47
body:
    open_in?(S,U): bool        = (FORALL (s: (S)): EXISTS r: subset?(intersection(ball(s,r),U),S)) 
                                 AND subset?(S,U)


decl_type: formula
theory: compactness
library: analysis
signature: nil
location: 78 2 82 84
body:
    set_compact: LEMMA 
       (compact?(S) AND open_cover?(ball_covering(H),S)) 
       IMPLIES (EXISTS (N: nat, seq: [below[N] -> (H)]): 
           open_cover?(ball_covering({h: [T,posreal] | H(h) AND 
                                              (EXISTS (n: below[N]): h = seq(n))}),S))


decl_type: formula
theory: compactness
library: analysis
signature: nil
location: 99 2 104 64
body:
    idxCover_def: LEMMA
        compact?(S) AND open_cover?(ball_covering(H),S) AND
        S(x) IMPLIES
              LET (N,seq) = idxCover(S,H) IN
                (EXISTS (n: below[N]): LET (a,r) = seq(n) IN
                     ball(a,r)(x) AND ball_covering(H)(ball(a,r)))


decl_type: formula
theory: compactness
library: analysis
signature: nil
location: 107 2 110 101
body:
    set_compact_alt: LEMMA 
        compact?(S) AND open_cover?(ball_covering(H),S)
        IMPLIES LET (N,seq) = idxCover(S,H) IN
           open_cover?(ball_covering({h: [T,posreal] | H(h) AND (EXISTS (n: below[N]): h = seq(n))}),S)


decl_type: formula
theory: compactness
library: analysis
signature: nil
location: 117 2 120 99
body:
    max_min_finite_scaf: LEMMA
        FORALL (P: [nat,below(N) -> bool]): (FORALL (n: below(N)): 
           EXISTS (M: nat): FORALL (m: above(M)): 
               P(m,n)) IMPLIES (EXISTS (TOTAL_M: nat): FORALL (m:above(TOTAL_M),n: below(N)): P(m,n))


decl_type: formula
theory: compactness
library: analysis
signature: nil
location: 122 2 125 92
body:
    compact_sequence_limit: LEMMA 
       (nonempty?(S) AND compact?(S)) 
        IMPLIES (FORALL (seq: [nat -> (S)]): EXISTS (p: (S)): 
            FORALL (epsilon: posreal, N: posint): EXISTS (n: above(N)): d(seq(n),p) < epsilon)


decl_type: formula
theory: compactness
library: analysis
signature: nil
location: 131 2 133 39
body:
    compact_open_increasing_seq: LEMMA compact?(S) IMPLIES (FORALL (seq: [nat -> (open?)]): (FORALL (j: nat):
      subset?(seq(j),seq(j+1))) AND open_cover?({AZ: set[T] | EXISTS (k: nat): AZ = seq(k)},S) IMPLIES
      EXISTS (i: nat): subset?(S,seq(i)))


decl_type: function
theory: compactness
library: analysis
signature: [[set[set[T]], set[T]] -> bool]
location: 46 2 47 72
body:
    open_cover?(XS,S): bool = subset?(S,Union(XS)) AND
                              (FORALL (C: set[T]): XS(C) IMPLIES open?(C))


decl_type: function
theory: compactness
library: analysis
signature: [set[T] -> bool]
location: 52 2 53 78
body:
    compact?(S): bool          = FORALL XS: open_cover?(XS,S) IMPLIES
                                 EXISTS YS: subset?(YS,XS) & finite_cover?(YS,S)


decl_type: function
theory: compactness
library: analysis
signature: [set[T] -> bool]
location: 57 2 58 90
body:
    precompact?(S): bool       = FORALL r: EXISTS (X:set[T]):
                                 finite_cover?({z:set[T] | EXISTS (x:(X)): ball(x,r) = z},S)


decl_type: function
theory: compactness
library: analysis
location: 75 2 76 35
signature:
  [d:
          [H: set[[T, posreal]],
           {s: (nonempty?[T]) | ball_covering(H)(s)}] ->
          {h: (d`1) | ball(h`1, h`2) = d`2}]

body:
    reverse_ball(H: set[[T,posreal]],A: {s: (nonempty?[T]) | ball_covering(H)(s)}): 
        {h: (H) | ball(h`1,h`2)  = A}


decl_type: function
theory: compactness
library: analysis
location: 91 2 97 70
signature:
  [d: [S: (compact?), Htype(S)] ->
          {pair: [N: nat, seq: [below[N] -> (d`2)]] |
                   open_cover?(ball_covering({h: [T, posreal]
                                              |
                                              d`2(h)
                                              AND
                                              (EXISTS
                                               (n: below[pair`1]):
                                               h = pair`2(n))}),
                               d`1)}]

body:
    idxCover(S: (compact?), H: Htype(S)): 
        {pair: [N: nat,seq: [below[N]->(H)]] | 
           open_cover?(ball_covering({h: [T,posreal] | H(h)
                   AND (EXISTS (n: below[pair`1]): h = pair`2(n))}),S)} 
         = choose({ pair: [N: nat,seq: [below[N]->(H)]] | 
                open_cover?(ball_covering({h: [T,posreal] | H(h) 
                   AND (EXISTS (n: below[pair`1]): h = pair`2(n))}),S)})


decl_type: tcc
theory: compactness
library: analysis
signature: nil
location: 149 0 151 999
body:
  % Assuming TCC generated (at line 42, column 12) for  metric_spaces[T, d]
      % generated from assumption metric_spaces.fullset_metric_space
  IMP_metric_spaces_TCC1: OBLIGATION metric_space?[T, d](fullset[T]);


decl_type: tcc
theory: compactness
library: analysis
signature: nil
location: 153 0 163 999
body:
  % Existence TCC generated (at line 75, column 2) for
      % reverse_ball(H: set[[T, posreal]],
      %              A: {s: (nonempty?[T]) | ball_covering(H)(s)}):
      %       {h: (H) | ball(h`1, h`2) = A}
  reverse_ball_TCC1: OBLIGATION
    EXISTS (x:
              [d:
                 [H: set[[T, posreal]],
                  {s: (nonempty?[T]) | ball_covering(H)(s)}] ->
                 {h: (d`1) | ball[T, d](h`1, h`2) = d`2}]):
      TRUE;


decl_type: tcc
theory: compactness
library: analysis
signature: nil
location: 165 0 187 999
body:
  % Subtype TCC generated (at line 95, column 16) for
      % {pair: [N: nat, seq: [below[N] -> (H)]] |
      %    open_cover?(ball_covering({h: [T, posreal]
      %                               |
      %                               H(h)
      %                               AND
      %                               (EXISTS
      %                                (n: below[pair`1]):
      %                                h = pair`2(n))}),
      %                S)}
      % expected type  p: (nonempty?[[N: nat, seq: [below[N] -> (H)]]])
  idxCover_TCC1: OBLIGATION
    FORALL (S: (compact?), H: Htype(S)):
      nonempty?[[N: nat, seq: [below[N] -> (H)]]]
          ({pair: [N: nat, seq: [below[N] -> (H)]] |
              open_cover?(ball_covering({h: [T, posreal]
                                         |
                                         H(h)
                                         AND
                                         (EXISTS
                                          (n: below[pair`1]):
                                          h = pair`2(n))}),
                          S)});


decl_type: function
theory: continuity_ms_def
library: analysis
signature: [[[T1 -> T2], E: set[T1], (E)] -> bool]
location: 27 2 30 70
body:
    continuous_at?(f:[T1->T2], E: set[T1],x: (E)):bool
      = FORALL epsilon: EXISTS delta: FORALL (y:(E)):
              member(y, ball[T1,d1](x,delta)) IMPLIES
                                 member(f(y), ball[T2,d2](f(x),epsilon))


decl_type: tcc
theory: continuity_ms_def
library: analysis
signature: nil
location: 44 0 47 999
body:
  % Assuming TCC generated (at line 21, column 6) for  metric_spaces[T1, d1]
      % generated from assumption metric_spaces.fullset_metric_space
  continuous_at?_TCC1: OBLIGATION
    FORALL (E: set[T1], x: (E), y: (E)): metric_space?[T1, d1](fullset[T1]);


decl_type: tcc
theory: continuity_ms_def
library: analysis
signature: nil
location: 49 0 54 999
body:
  % Assuming TCC generated (at line 21, column 6) for  metric_spaces[T2, d2]
      % generated from assumption metric_spaces.fullset_metric_space
  continuous_at?_TCC2: OBLIGATION
    FORALL (E: set[T1], x: (E), delta, y: (E)):
      member(y, ball[T1, d1](x, delta)) IMPLIES
       metric_space?[T2, d2](fullset[T2]);


decl_type: tcc
theory: continuity_ms_def
library: analysis
signature: nil
location: 56 0 58 999
body:
  % Subtype TCC generated (at line 32, column 70) for  x
      % expected type  (fullset[T1])
  continuous_at?_TCC3: OBLIGATION FORALL (x: T1): fullset[T1](x);


decl_type: formula
theory: continuity_ms
library: analysis
signature: nil
location: 30 2 32 79
body:
    image_inverse_image: THEOREM FORALL (f:[(S)->(T)]): 
              subset?(X,S) AND subset?(Y,T) AND
                             X = inverse_image(f,Y) IMPLIES subset?(image(f,X),Y)


decl_type: formula
theory: continuity_ms
library: analysis
signature: nil
location: 36 2 38 79
body:
    inverse_image_image: THEOREM FORALL (f:[(S)->(T)]): 
            subset?(X,S) AND subset?(Y,T) AND
                             Y = image(f,X) IMPLIES subset?(X,inverse_image(f,Y))


decl_type: formula
theory: continuity_ms
library: analysis
signature: nil
location: 42 2 44 93
body:
    continuous_open_sets: THEOREM FORALL (f:[T1->T2]):
      continuous?(f,(S)) IFF
      (Forall Y: open?[T2,d2](Y) IMPLIES open_in?[T1,d1](intersection(inverse_image(f,Y),S),S))


decl_type: formula
theory: continuity_ms
library: analysis
signature: nil
location: 48 2 50 97
body:
    continuous_closed_sets: THEOREM FORALL (f:[T1->T2]):
      continuous?(f,(S)) IFF
      (FORALL Y: closed?[T2,d2](Y) IMPLIES closed_in?[T1,d1](intersection(inverse_image(f,Y),S),S))


decl_type: tcc
theory: continuity_ms
library: analysis
signature: nil
location: 58 0 61 999
body:
  % Assuming TCC generated (at line 23, column 12) for
      % continuity_ms_def[T1, d1, T2, d2]
      % generated from assumption continuity_ms_def.fullset_metric_space1
  IMP_continuity_ms_def_TCC1: OBLIGATION metric_space?[T1, d1](fullset[T1]);


decl_type: tcc
theory: continuity_ms
library: analysis
signature: nil
location: 63 0 66 999
body:
  % Assuming TCC generated (at line 23, column 12) for
      % continuity_ms_def[T1, d1, T2, d2]
      % generated from assumption continuity_ms_def.fullset_metric_space2
  IMP_continuity_ms_def_TCC2: OBLIGATION metric_space?[T2, d2](fullset[T2]);


decl_type: formula
theory: uniform_continuity
library: analysis
signature: nil
location: 48 3 49 27
body:
     unif_cont_implies_cont: LEMMA uniformly_continuous?(f,A) IMPLIES
                                   continuous?(f,A)


decl_type: formula
theory: uniform_continuity
library: analysis
signature: nil
location: 62 3 65 40
body:
     Hset_def: LEMMA continuous?(f,A) IMPLIES
                 FORALL (x:(A)): EXISTS (p: [a: (A), r: posreal]): 
                    LET B = ball[S,ds](p) IN
             Hset(A,epsilon,f)(p) AND B(x)


decl_type: formula
theory: uniform_continuity
library: analysis
signature: nil
location: 70 3 71 63
body:
     ball_cover_lem: LEMMA continuous?(f,A) IMPLIES
                           open_cover?(ball_cover(A,epsilon,f),A)


decl_type: formula
theory: uniform_continuity
library: analysis
signature: nil
location: 77 3 83 66
body:
     compact_ball_all: LEMMA continuous?(f,A) AND compact?(A) 
        IMPLIES 
            (FORALL (epsilon: posreal): 
                FORALL (a: (A)):
                   EXISTS (r: posreal) : 
                      FORALL (x: S): intersection(ball(a,r),A)(x)
                                    IMPLIES dt(f(x),f(a)) < epsilon)


decl_type: formula
theory: uniform_continuity
library: analysis
signature: nil
location: 85 3 86 71
body:
     rset_prep: LEMMA  continuous?(f,A) AND compact?(A) IMPLIES
        open_cover?[S, ds](ball_covering[S, ds](Hset(A, epsilon, f)), A);


decl_type: formula
theory: uniform_continuity
library: analysis
signature: nil
location: 97 3 100 61
body:
     rset_lem: LEMMA continuous?(f,A) AND compact?(A) AND
                     rset(A,epsilon,f)(r) IMPLIES
                        LET (N,seq) = idxCover(A,Hset(A,epsilon,f)) IN
                             EXISTS (i: below[N]): r = seq(i)`2               


decl_type: formula
theory: uniform_continuity
library: analysis
signature: nil
location: 105 3 106 62
body:
     rset_finite: LEMMA continuous?(f,A) AND compact?(A) IMPLIES
                         is_finite[posreal](rset(A, epsilon, f))


decl_type: formula
theory: uniform_continuity
library: analysis
signature: nil
location: 109 3 112 62
body:
     rset_not_empty: LEMMA continuous?(f,A) AND compact?(A) AND NOT empty?(A) AND
                            open_cover?(ball_cover(A, epsilon, f), A)
                IMPLIES
                        NOT empty?[posreal](rset(A, epsilon, f))


decl_type: formula
theory: uniform_continuity
library: analysis
signature: nil
location: 120 3 122 40
body:
     Heine: THEOREM 
        continuous?(f,A) AND compact?(A) AND NOT empty?(A)
        IMPLIES uniformly_continuous?(f,A)


decl_type: formula
theory: uniform_continuity
library: analysis
signature: nil
location: 128 3 132 58
body:
     uniform_continuity_sequence: LEMMA NOT uniformly_continuous?[S,ds,T,dt](f,A)
                      IFF (EXISTS (epsilon: posreal): EXISTS (seq: [posint -> [S,S]]):
                          FORALL (n: posint): (A(seq(n)`1) AND A(seq(n)`2) AND
                                              ds(seq(n)`1,seq(n)`2) < 1/n AND
                                              dt(f(seq(n)`1),f(seq(n)`2)) > epsilon))


decl_type: formula
theory: uniform_continuity
library: analysis
signature: nil
location: 135 2 136 31
body:
    continuous_image_of_compact: THEOREM compact?(A) AND continuous?(f)
     IMPLIES compact?(image(f,A))


decl_type: function
theory: uniform_continuity
library: analysis
signature: [[[S -> T], set[S]] -> bool]
location: 31 3 34 63
body:
     uniformly_continuous?(f: [S -> T], A: set[S]):bool = 
       FORALL epsilon: EXISTS delta: 
             (FORALL (x,p: (A)): 
                 ds(x,p) < delta IMPLIES dt(f(x),f(p)) < epsilon)


decl_type: function
theory: uniform_continuity
library: analysis
signature: [[set[S], posreal, [S -> T]] -> set[[S, posreal]]]
location: 56 3 60 76
body:
     Hset(A: set[S], epsilon: posreal, f): set[[S,posreal]] = 
              { p: [a: S, r: posreal] | 
                          LET (a,r) = p IN A(a) AND 
                               FORALL (x: S): intersection(ball(a,2*r),A)(x)
                                              IMPLIES dt(f(x),f(a)) < epsilon}


decl_type: function
theory: uniform_continuity
library: analysis
signature: [[set[S], posreal, [S -> T]] -> set[set[S]]]
location: 67 3 68 46
body:
     ball_cover(A: set[S], epsilon: posreal,f): set[set[S]] =
                ball_covering(Hset(A,epsilon,f))


decl_type: function
theory: uniform_continuity
library: analysis
signature:
  [[A: (compact?[S, ds]), posreal, continuous_funs(A)] ->
  set[posreal]]

location: 91 3 94 49
body:
     rset(A: (compact?[S,ds]), epsilon: posreal, f: continuous_funs(A)): set[posreal] =
                LET (N,seq) = idxCover(A, Hset(A,epsilon,f)) IN
                   {r: posreal | EXISTS (i: below[N]): 
                       LET (a,R) = seq(i) IN r = R}


decl_type: tcc
theory: uniform_continuity
library: analysis
signature: nil
location: 144 0 147 999
body:
  % Assuming TCC generated (at line 37, column 14) for
      % continuity_ms[S, ds, T, dt]
      % generated from assumption continuity_ms.fullset_metric_space1
  IMP_continuity_ms_TCC1: OBLIGATION metric_space?[S, ds](fullset[S]);


decl_type: tcc
theory: uniform_continuity
library: analysis
signature: nil
location: 149 0 152 999
body:
  % Assuming TCC generated (at line 37, column 14) for
      % continuity_ms[S, ds, T, dt]
      % generated from assumption continuity_ms.fullset_metric_space2
  IMP_continuity_ms_TCC2: OBLIGATION metric_space?[T, dt](fullset[T]);


decl_type: tcc
theory: uniform_continuity
library: analysis
signature: nil
location: 154 0 158 999
body:
  % Subtype TCC generated (at line 92, column 40) for  Hset(A, epsilon, f)
      % expected type  Htype[S, ds](A)
  rset_TCC1: OBLIGATION
    FORALL (A: (compact?[S, ds]), epsilon: posreal, f: continuous_funs(A)):
      open_cover?[S, ds](ball_covering[S, ds](Hset(A, epsilon, f)), A);


decl_type: tcc
theory: uniform_continuity
library: analysis
signature: nil
location: 160 0 165 999
body:
  % Subtype TCC generated (at line 99, column 47) for  Hset(A, epsilon, f)
      % expected type  Htype[S, ds](A)
  rset_lem_TCC1: OBLIGATION
    FORALL (A: set[S], epsilon: posreal, f: [S -> T], r: posreal):
      rset(A, epsilon, f)(r) AND compact?(A) AND continuous?(f, A) IMPLIES
       open_cover?[S, ds](ball_covering[S, ds](Hset(A, epsilon, f)), A);


decl_type: formula
theory: open_sets
library: analysis
signature: nil
location: 14 3 15 62
body:
     open_ball?_lem: LEMMA open_ball?(x,S) IFF
                             EXISTS r: subset?(open_ball(x,r),S) 


decl_type: formula
theory: open_sets
library: analysis
signature: nil
location: 40 3 41 52
body:
     union_open         : LEMMA open?(S1) AND open?(S2) IMPLIES
                                   open?(union(S1,S2))


decl_type: function
theory: open_sets
library: analysis
signature: [[T, set[T]] -> bool]
location: 8 3 9 74
body:
     open_ball?(x,S): bool = (EXISTS (delta: posreal): 
                                  (FORALL y: abs(x-y) < delta IMPLIES S(y)))


decl_type: formula
theory: real_metric_space
library: analysis
signature: nil
location: 26 2 29 58
body:
    compact_induction: LEMMA FORALL (c: real, d: {x: real | c < x}): 
       (compact?[real,real_dist](closed_intv(c,(c+d)/2))
       AND compact?[real,real_dist](closed_intv((c+d)/2,d))) 
          IMPLIES compact?[real,real_dist](closed_intv(c,d))


decl_type: formula
theory: real_metric_space
library: analysis
signature: nil
location: 47 2 53 81
body:
    seq_inv_scaf_decreasing: LEMMA 
       FORALL (c: real, d: {x: real | c < x},YS: {XST: set[set[real]] | 
               open_cover?(XST,closed_intv(c,d))}): 
       FORALL (n:nat): seq_intv_scaf(c,d,YS)(n)`1 < seq_intv_scaf(c,d,YS)(n)`2
          AND subset?(closed_intv(seq_intv_scaf(c,d,YS)(n+1)`1,seq_intv_scaf(c,d,YS)(n+1)`2),
                      closed_intv(seq_intv_scaf(c,d,YS)(n)`1,seq_intv_scaf(c,d,YS)(n)`2))
          AND seq_intv_scaf(c,d,YS)(n)`2 - seq_intv_scaf(c,d,YS)(n)`1 = (d-c)/(2^n)


decl_type: formula
theory: real_metric_space
library: analysis
signature: nil
location: 56 2 62 73
body:
    compact_seq_induction: LEMMA FORALL (c: real, d: {x: real | c < x}):
        (NOT compact?[real,real_dist](closed_intv(c,d))) 
        IMPLIES
             EXISTS (YS: set[set[real]]): open_cover?(YS,closed_intv(c,d)) AND
                 FORALL (n:nat): LET W = seq_intv_scaf(c,d,YS)(n) IN  
                       (NOT EXISTS (XS: set[set[real]]): subset?(XS,YS) AND
                                    finite_cover?(XS,closed_intv(W`1,W`2)))


decl_type: formula
theory: real_metric_space
library: analysis
signature: nil
location: 66 2 67 47
body:
    closed_intervals_compact: THEOREM FORALL (a: real, b: {x: real | a < x}): 
       compact?[real,real_dist](closed_intv(a,b))


decl_type: function
theory: real_metric_space
library: analysis
location: 32 2 44 23
signature:
  [[c: real, d: {x: real | c < x},
         {XST: set[set[real]] |
                  open_cover?(XST,
                              LAMBDA (x: real): c <= x AND x <= d)}] ->
          [nat -> [real, real]]]

body:
    seq_intv_scaf(c: real, d: {x: real | c < x}, 
                  YS: {XST: set[set[real]] | open_cover?(XST,closed_intv(c,d))})(n: nat): 
    RECURSIVE [real,real] = 
          IF n = 0 THEN (c,d) 
          ELSIF
             NOT EXISTS (XS: set[set[real]]): subset?(XS,YS) 
             AND finite_cover?(XS,closed_intv(seq_intv_scaf(c,d,YS)(n-1)`1,
                               (seq_intv_scaf(c,d,YS)(n-1)`1+seq_intv_scaf(c,d,YS)(n-1)`2)/2))
          THEN
             (seq_intv_scaf(c,d,YS)(n-1)`1,(seq_intv_scaf(c,d,YS)(n-1)`1+seq_intv_scaf(c,d,YS)(n-1)`2)/2)
          ELSE
             ((seq_intv_scaf(c,d,YS)(n-1)`1+seq_intv_scaf(c,d,YS)(n-1)`2)/2,seq_intv_scaf(c,d,YS)(n-1)`2)
          ENDIF MEASURE n


decl_type: tcc
theory: real_metric_space
library: analysis
signature: nil
location: 74 0 78 999
body:
  % Assuming TCC generated (at line 23, column 29) for
      % compactness[real, real_dist]
      % generated from assumption compactness.fullset_metric_space
  IMP_compactness_TCC1: OBLIGATION
    metric_space?[real, real_dist](fullset[real]);


decl_type: tcc
theory: real_metric_space
library: analysis
signature: nil
location: 80 0 90 999
body:
  % Subtype TCC generated (at line 38, column 66) for  n - 1
      % expected type  nat
  seq_intv_scaf_TCC1: OBLIGATION
    FORALL (c: real, d: {x: real | c < x},
            YS:
              {XST: set[set[real]] |
                       open_cover?[real, real_dist]
                           (XST, LAMBDA (x: real): c <= x AND x <= d)},
            n: nat):
      NOT n = 0 IMPLIES
       (FORALL (XS: set[set[real]]): subset?(XS, YS) IMPLIES n - 1 >= 0);


decl_type: tcc
theory: real_metric_space
library: analysis
signature: nil
location: 92 0 102 999
body:
  % Termination TCC generated (at line 38, column 44) for
      % seq_intv_scaf(c, d, YS)(n - 1)
  seq_intv_scaf_TCC2: OBLIGATION
    FORALL (c: real, d: {x: real | c < x},
            YS:
              {XST: set[set[real]] |
                       open_cover?[real, real_dist]
                           (XST, LAMBDA (x: real): c <= x AND x <= d)},
            n: nat):
      NOT n = 0 IMPLIES
       (FORALL (XS: set[set[real]]): subset?(XS, YS) IMPLIES n - 1 < n);


decl_type: tcc
theory: real_metric_space
library: analysis
signature: nil
location: 104 0 129 999
body:
  % Subtype TCC generated (at line 41, column 34) for  n - 1
      % expected type  nat
  seq_intv_scaf_TCC3: OBLIGATION
    FORALL (c: real, d: {x: real | c < x},
            YS:
              {XST: set[set[real]] |
                       open_cover?[real, real_dist]
                           (XST, LAMBDA (x: real): c <= x AND x <= d)},
            n: nat,
            v:
              [[c: real, d: {x: real | c < x},
                {XST: set[set[real]] |
                         open_cover?(XST,
                                     LAMBDA (x: real):
                                       c <= x AND x <= d)}] ->
                 [{z1: nat | z1 < n} -> [real, real]]]):
      NOT (EXISTS (XS: set[set[real]]):
             subset?(XS, YS) AND
              finite_cover?(XS,
                            LAMBDA (x: real):
                              v(c, d, YS)(n - 1)`1 <= x AND
                               x <=
                                (v(c, d, YS)(n - 1)`1 + v(c, d, YS)(n - 1)`2)
                                 / 2))
       AND NOT n = 0
       IMPLIES n - 1 >= 0;


decl_type: tcc
theory: real_metric_space
library: analysis
signature: nil
location: 131 0 156 999
body:
  % Termination TCC generated (at line 41, column 12) for
      % seq_intv_scaf(c, d, YS)(n - 1)
  seq_intv_scaf_TCC4: OBLIGATION
    FORALL (c: real, d: {x: real | c < x},
            YS:
              {XST: set[set[real]] |
                       open_cover?[real, real_dist]
                           (XST, LAMBDA (x: real): c <= x AND x <= d)},
            n: nat,
            v:
              [[c: real, d: {x: real | c < x},
                {XST: set[set[real]] |
                         open_cover?(XST,
                                     LAMBDA (x: real):
                                       c <= x AND x <= d)}] ->
                 [{z1: nat | z1 < n} -> [real, real]]]):
      NOT (EXISTS (XS: set[set[real]]):
             subset?(XS, YS) AND
              finite_cover?(XS,
                            LAMBDA (x: real):
                              v(c, d, YS)(n - 1)`1 <= x AND
                               x <=
                                (v(c, d, YS)(n - 1)`1 + v(c, d, YS)(n - 1)`2)
                                 / 2))
       AND NOT n = 0
       IMPLIES n - 1 < n;


decl_type: tcc
theory: real_metric_space
library: analysis
signature: nil
location: 158 0 183 999
body:
  % Subtype TCC generated (at line 43, column 35) for  n - 1
      % expected type  nat
  seq_intv_scaf_TCC5: OBLIGATION
    FORALL (c: real, d: {x: real | c < x},
            YS:
              {XST: set[set[real]] |
                       open_cover?[real, real_dist]
                           (XST, LAMBDA (x: real): c <= x AND x <= d)},
            n: nat,
            v:
              [[c: real, d: {x: real | c < x},
                {XST: set[set[real]] |
                         open_cover?(XST,
                                     LAMBDA (x: real):
                                       c <= x AND x <= d)}] ->
                 [{z1: nat | z1 < n} -> [real, real]]]):
      (EXISTS (XS: set[set[real]]):
         subset?(XS, YS) AND
          finite_cover?(XS,
                        LAMBDA (x: real):
                          v(c, d, YS)(n - 1)`1 <= x AND
                           x <=
                            (v(c, d, YS)(n - 1)`1 + v(c, d, YS)(n - 1)`2) /
                             2))
       AND NOT n = 0
       IMPLIES n - 1 >= 0;


decl_type: tcc
theory: real_metric_space
library: analysis
signature: nil
location: 185 0 210 999
body:
  % Termination TCC generated (at line 43, column 13) for
      % seq_intv_scaf(c, d, YS)(n - 1)
  seq_intv_scaf_TCC6: OBLIGATION
    FORALL (c: real, d: {x: real | c < x},
            YS:
              {XST: set[set[real]] |
                       open_cover?[real, real_dist]
                           (XST, LAMBDA (x: real): c <= x AND x <= d)},
            n: nat,
            v:
              [[c: real, d: {x: real | c < x},
                {XST: set[set[real]] |
                         open_cover?(XST,
                                     LAMBDA (x: real):
                                       c <= x AND x <= d)}] ->
                 [{z1: nat | z1 < n} -> [real, real]]]):
      (EXISTS (XS: set[set[real]]):
         subset?(XS, YS) AND
          finite_cover?(XS,
                        LAMBDA (x: real):
                          v(c, d, YS)(n - 1)`1 <= x AND
                           x <=
                            (v(c, d, YS)(n - 1)`1 + v(c, d, YS)(n - 1)`2) /
                             2))
       AND NOT n = 0
       IMPLIES n - 1 < n;


decl_type: formula
theory: rs_integral_cont
library: analysis
signature: nil
location: 31 2 35 54
body:
    RS_integrable_cont_inc: LEMMA a < b IMPLIES
                           LET CI = closed_intv[T](a,b) IN
                           (continuous?[T,real_dist,real,real_dist](f,closed_intv[T](a,b)) AND
                           increasing?[(CI)](g)
                           IMPLIES integrable?(a,b,g,f))


decl_type: formula
theory: rs_integral_cont
library: analysis
signature: nil
location: 37 2 41 54
body:
    RS_integrable_cont_BV: LEMMA a < b IMPLIES
                           LET CI = closed_intv[T](a,b) IN
                           (continuous?[T,real_dist,real,real_dist](f,closed_intv[T](a,b)) AND
                           bounded_variation?(a,b)(g)
                           IMPLIES integrable?(a,b,g,f)) 


decl_type: tcc
theory: rs_integral_cont
library: analysis
signature: nil
location: 56 0 58 999
body:
  % Assuming TCC generated (at line 20, column 5) for  rs_integral_prep[T]
      % generated from assumption rs_integral_prep.connected_domain
  IMP_rs_integral_prep_TCC1: OBLIGATION connected?[T];


decl_type: tcc
theory: rs_integral_cont
library: analysis
signature: nil
location: 60 0 62 999
body:
  % Assuming TCC generated (at line 20, column 5) for  rs_integral_prep[T]
      % generated from assumption rs_integral_prep.not_one_element
  IMP_rs_integral_prep_TCC2: OBLIGATION not_one_element?[T];


decl_type: tcc
theory: rs_integral_cont
library: analysis
signature: nil
location: 64 0 75 999
body:
  % Assuming TCC generated (at line 17, column 8) for
      % continuity_ms_def
      %     [T, restrict[[real, real], [T, T], nnreal](real_dist), real,
      %      real_dist]
      % generated from assumption continuity_ms_def.fullset_metric_space1
  RS_integrable_cont_inc_TCC1: OBLIGATION
    FORALL (a, b: T):
      a < b IMPLIES
       (FORALL (CI: [T -> bool]):
          (CI = (LAMBDA (x: T): a <= x AND x <= b)) IMPLIES
           metric_space?[T, restrict[[real, real], [T, T], nnreal](real_dist)]
               (fullset[T]));


decl_type: tcc
theory: rs_integral_cont
library: analysis
signature: nil
location: 77 0 87 999
body:
  % Assuming TCC generated (at line 18, column 8) for
      % continuity_ms_def
      %     [T, restrict[[real, real], [T, T], nnreal](real_dist), real,
      %      real_dist]
      % generated from assumption continuity_ms_def.fullset_metric_space2
  RS_integrable_cont_inc_TCC2: OBLIGATION
    FORALL (a, b: T):
      a < b IMPLIES
       (FORALL (CI: [T -> bool]):
          (CI = (LAMBDA (x: T): a <= x AND x <= b)) IMPLIES
           metric_space?[real, real_dist](fullset[real]));


decl_type: formula
theory: metric_space_real_fun
library: analysis
signature: nil
location: 26 3 27 30
body:
     sum_continuous:  LEMMA continuous?(f,S) AND continuous?(g,S) IMPLIES
                            continuous?(f+g,S)


decl_type: formula
theory: metric_space_real_fun
library: analysis
signature: nil
location: 28 3 29 30
body:
     diff_continuous: LEMMA continuous?(f,S) AND continuous?(g,S) IMPLIES
                            continuous?(f-g,S)


decl_type: formula
theory: metric_space_real_fun
library: analysis
signature: nil
location: 30 3 31 30
body:
     prod_continuous: LEMMA continuous?(f,S) AND continuous?(g,S) IMPLIES
                            continuous?(f*g,S)


decl_type: tcc
theory: metric_space_real_fun
library: analysis
signature: nil
location: 40 0 43 999
body:
  % Assuming TCC generated (at line 19, column 32) for
      % continuity_ms_def[T, d, real, real_dist]
      % generated from assumption continuity_ms_def.fullset_metric_space1
  IMP_continuity_ms_def_TCC1: OBLIGATION metric_space?[T, d](fullset[T]);


decl_type: tcc
theory: metric_space_real_fun
library: analysis
signature: nil
location: 45 0 49 999
body:
  % Assuming TCC generated (at line 19, column 32) for
      % continuity_ms_def[T, d, real, real_dist]
      % generated from assumption continuity_ms_def.fullset_metric_space2
  IMP_continuity_ms_def_TCC2: OBLIGATION
    metric_space?[real, real_dist](fullset[real]);


decl_type: formula
theory: real_fun_on_compact_sets
library: analysis
signature: nil
location: 26 3 28 75
body:
     cont_on_compact_max: THEOREM 
        (continuous?(f,S) and compact?(S)) 
        IMPLIES empty?(S) or (EXISTS (s: (S)): FORALL (t: (S)): f(t) <= f(s))


decl_type: formula
theory: real_fun_on_compact_sets
library: analysis
signature: nil
location: 30 3 32 75
body:
     cont_on_compact_min: THEOREM 
        (continuous?(f,S) and compact?(S)) 
        IMPLIES empty?(S) or (EXISTS (s: (S)): FORALL (t: (S)): f(t) >= f(s))


decl_type: tcc
theory: real_fun_on_compact_sets
library: analysis
signature: nil
location: 39 0 42 999
body:
  % Assuming TCC generated (at line 21, column 32) for
      % continuity_ms_def[T, d, real, real_dist]
      % generated from assumption continuity_ms_def.fullset_metric_space1
  IMP_continuity_ms_def_TCC1: OBLIGATION metric_space?[T, d](fullset[T]);


decl_type: tcc
theory: real_fun_on_compact_sets
library: analysis
signature: nil
location: 44 0 48 999
body:
  % Assuming TCC generated (at line 21, column 32) for
      % continuity_ms_def[T, d, real, real_dist]
      % generated from assumption continuity_ms_def.fullset_metric_space2
  IMP_continuity_ms_def_TCC2: OBLIGATION
    metric_space?[real, real_dist](fullset[real]);


decl_type: formula
theory: riesz_interval_funs
library: analysis
signature: nil
location: 26 3 26 106
body:
     bounded_on_int_sum_closed: LEMMA bounded_on_int?(f) AND bounded_on_int?(h) IMPLIES bounded_on_int?(f+h)


decl_type: formula
theory: riesz_interval_funs
library: analysis
signature: nil
location: 41 3 41 100
body:
     fun_norm_triangle: LEMMA FORALL (f,g:(bounded_on_int?)): fun_norm(f+g) <= fun_norm(f)+fun_norm(g)


decl_type: function
theory: riesz_interval_funs
library: analysis
location: 30 3 31 39
signature:
  [f: (bounded_on_int?) ->
          {M: nnreal |
                   (FORALL (x): abs(f(x)) <= M) AND
                    (FORALL (M1: real):
                       M1 < M IMPLIES (EXISTS (x): abs(f(x)) > M1))}]

body:
     fun_norm(f: (bounded_on_int?)): {M:nnreal | (FORALL (x): abs(f(x))<=M) AND (FORALL (M1:real): M1 < M IMPLIES 
                                     EXISTS (x): abs(f(x)) > M1)}


decl_type: tcc
theory: riesz_interval_funs
library: analysis
signature: nil
location: 71 0 73 999
body:
  % Subtype TCC generated (at line 15, column 37) for  b
      % expected type  {x: real | a <= x}
  Intab_TCC1: OBLIGATION a <= b;


decl_type: tcc
theory: riesz_interval_funs
library: analysis
signature: nil
location: 75 0 82 999
body:
  % Assuming TCC generated (at line 22, column 13) for
      % metric_space_real_fun
      %     [INTab, restrict[[real, real], [INTab, INTab], nnreal](real_dist)]
      % generated from assumption metric_space_real_fun.fullset_metric_space
  IMP_metric_space_real_fun_TCC1: OBLIGATION
    metric_space?
        [INTab, restrict[[real, real], [INTab, INTab], nnreal](real_dist)]
        (fullset[INTab]);


decl_type: tcc
theory: riesz_interval_funs
library: analysis
signature: nil
location: 84 0 87 999
body:
  % Existence TCC generated (at line 22, column 13) for
      % metric_space_real_fun
      %     [INTab, restrict[[real, real], [INTab, INTab], nnreal](real_dist)]
  IMP_metric_space_real_fun_TCC2: OBLIGATION EXISTS (x: INTab): TRUE;


decl_type: tcc
theory: riesz_interval_funs
library: analysis
signature: nil
location: 89 0 103 999
body:
  % Existence TCC generated (at line 30, column 3) for
      % fun_norm(f: (bounded_on_int?)):
      %       {M: nnreal |
      %                (FORALL (x): abs(f(x)) <= M) AND
      %                 (FORALL (M1: real):
      %                    M1 < M IMPLIES (EXISTS (x): abs(f(x)) > M1))}
  fun_norm_TCC1: OBLIGATION
    EXISTS (x1:
              [f: (bounded_on_int?) ->
                 {M: nnreal |
                          (FORALL (x): abs(f(x)) <= M) AND
                           (FORALL (M1: real):
                              M1 < M IMPLIES
                               (EXISTS (x): abs(f(x)) > M1))}]):
      TRUE;


decl_type: tcc
theory: riesz_interval_funs
library: analysis
signature: nil
location: 105 0 108 999
body:
  % Subtype TCC generated (at line 33, column 75) for  f - g
      % expected type  f: (bounded_on_int?)
  fun_norm_dist_TCC1: OBLIGATION
    FORALL (f, g: (bounded_on_int?)): bounded_on_int?((-[INTab])(f, g));


decl_type: tcc
theory: riesz_interval_funs
library: analysis
signature: nil
location: 110 0 114 999
body:
  % Subtype TCC generated (at line 33, column 66) for  fun_norm(f - g)
      % expected type  {k: nnreal | k = 0 IFF f = g}
  fun_norm_dist_TCC2: OBLIGATION
    FORALL (f, g: (bounded_on_int?)):
      fun_norm((-[INTab])(f, g)) = 0 IFF f = g;


decl_type: tcc
theory: riesz_interval_funs
library: analysis
signature: nil
location: 116 0 119 999
body:
  % Subtype TCC generated (at line 39, column 65) for  c * f
      % expected type  f: (bounded_on_int?)
  fun_norm_scal_TCC1: OBLIGATION
    FORALL (f: (bounded_on_int?), c: real): bounded_on_int?(*[INTab](c, f));


decl_type: tcc
theory: riesz_interval_funs
library: analysis
signature: nil
location: 121 0 124 999
body:
  % Subtype TCC generated (at line 41, column 69) for  f + g
      % expected type  f: (bounded_on_int?)
  fun_norm_triangle_TCC1: OBLIGATION
    FORALL (f, g: (bounded_on_int?)): bounded_on_int?((+[INTab])(f, g));


decl_type: tcc
theory: riesz_interval_funs
library: analysis
signature: nil
location: 126 0 129 999
body:
  % Existence TCC generated (at line 43, column 36) for
      % metric_space?[(bounded_on_int?), fun_norm_dist]
  bounded_funs_metric_space_TCC1: OBLIGATION
    EXISTS (x: (bounded_on_int?)): TRUE;


decl_type: tcc
theory: riesz_interval_funs
library: analysis
signature: nil
location: 131 0 134 999
body:
  % Judgement subtype TCC generated (at line 60, column 42) for  x
      % expected type  Bounded_Function
  continuous_function_bounded: OBLIGATION
    FORALL (x: Continuous_Function): bounded_on_int?(x);


decl_type: function
theory: riesz_function_sets
library: analysis
signature: [set[[INTab -> real]] -> bool]
location: 19 3 19 106
body:
     funs_contain_continuous?(Fnz): bool  =   FORALL (f:[INTab->real]): continuous_on_int?(f) IMPLIES Fnz(f)


decl_type: function
theory: riesz_function_sets
library: analysis
signature: [set[[INTab -> real]] -> bool]
location: 21 3 26 35
body:
     bounded_linear_subspace?(Fnz): bool = 
                                    funs_sum_closed?(Fnz) AND
                                    funs_const_closed?(Fnz) AND
                                    funs_bounded?(Fnz) AND
                                    funs_contain_constants?(Fnz) AND
                                    funs_contain_continuous?(Fnz)


decl_type: tcc
theory: riesz_linear_functionals
library: analysis
signature: nil
location: 39 0 42 999
body:
  % Subtype TCC generated (at line 28, column 45) for  f + g
      % expected type  Funs
  additive_op?_TCC1: OBLIGATION
    FORALL (f: Funs, g: Funs): Funs_pred((+[INTab[a, b]])(f, g));


decl_type: tcc
theory: riesz_linear_functionals
library: analysis
signature: nil
location: 44 0 47 999
body:
  % Subtype TCC generated (at line 29, column 56) for  c * f
      % expected type  Funs
  const_inv_op?_TCC1: OBLIGATION
    FORALL (f: Funs, c: real): Funs_pred(*[INTab[a, b]](c, f));


decl_type: tcc
theory: riesz_linear_functionals
library: analysis
signature: nil
location: 49 0 53 999
body:
  % Subtype TCC generated (at line 32, column 49) for  LAMBDA (y: INTab): 0
      % expected type  Funs
  linear_op_zero_TCC1: OBLIGATION
    FORALL (L: Operator):
      linear_op?(L) IMPLIES Funs_pred(LAMBDA (y: INTab[a, b]): 0);


decl_type: function
theory: riesz_bounded_functionals
library: analysis
location: 26 3 27 57
signature:
  [L: (bounded_op?) ->
          {M: nnreal |
                   (FORALL (f: Funs): abs(L(f)) <= M * fun_norm(f)) AND
                    (FORALL (M1: real):
                       M1 < M IMPLIES
                        (EXISTS (f: Funs):
                           abs(L(f)) > M1 * fun_norm(f)))}]

body:
     op_norm(L: (bounded_op?)): {M:nnreal | (FORALL (f:Funs): abs(L(f))<=M*fun_norm(f)) AND (FORALL (M1:real): M1 < M IMPLIES 
                                      EXISTS (f:Funs): abs(L(f)) > M1*fun_norm(f))}


decl_type: tcc
theory: riesz_bounded_functionals
library: analysis
signature: nil
location: 39 0 43 999
body:
  % Assuming TCC generated (at line 16, column 13) for
      % riesz_linear_functionals[a, b, Funs]
      % generated from assumption riesz_linear_functionals.funs_sum_closed
  IMP_riesz_linear_functionals_TCC1: OBLIGATION
    FORALL (f, g: Funs): Funs_pred((+[INTab[a, b]])(f, g));


decl_type: tcc
theory: riesz_bounded_functionals
library: analysis
signature: nil
location: 45 0 49 999
body:
  % Assuming TCC generated (at line 16, column 13) for
      % riesz_linear_functionals[a, b, Funs]
      % generated from assumption riesz_linear_functionals.funs_const_closed
  IMP_riesz_linear_functionals_TCC2: OBLIGATION
    FORALL (f: Funs, c: real): Funs_pred(*[INTab[a, b]](c, f));


decl_type: tcc
theory: riesz_bounded_functionals
library: analysis
signature: nil
location: 51 0 55 999
body:
  % Assuming TCC generated (at line 16, column 13) for
      % riesz_linear_functionals[a, b, Funs]
      % generated from assumption riesz_linear_functionals.funs_contain_zero
  IMP_riesz_linear_functionals_TCC3: OBLIGATION
    Funs_pred(LAMBDA (y: INTab[a, b]): 0);


decl_type: tcc
theory: riesz_bounded_functionals
library: analysis
signature: nil
location: 57 0 59 999
body:
  % Subtype TCC generated (at line 24, column 83) for  f
      % expected type  f: (bounded_on_int?)
  bounded_op?_TCC1: OBLIGATION FORALL (f: Funs): bounded_on_int?[a, b](f);


decl_type: tcc
theory: riesz_bounded_functionals
library: analysis
signature: nil
location: 61 0 79 999
body:
  % Existence TCC generated (at line 26, column 3) for
      % op_norm(L: (bounded_op?)):
      %       {M: nnreal |
      %                (FORALL (f: Funs): abs(L(f)) <= M * fun_norm(f)) AND
      %                 (FORALL (M1: real):
      %                    M1 < M IMPLIES
      %                     (EXISTS (f: Funs): abs(L(f)) > M1 * fun_norm(f)))}
  op_norm_TCC1: OBLIGATION
    EXISTS (x:
              [L: (bounded_op?) ->
                 {M: nnreal |
                          (FORALL (f: Funs):
                             abs(L(f)) <= M * fun_norm[a, b](f))
                           AND
                           (FORALL (M1: real):
                              M1 < M IMPLIES
                               (EXISTS (f: Funs):
                                  abs(L(f)) > M1 * fun_norm[a, b](f)))}]):
      TRUE;


decl_type: formula
theory: riesz_hahn_banach
library: analysis
signature: nil
location: 44 3 45 58
body:
     Op_Extension_exists: LEMMA FORALL (ff:Bounded_Function[a,b]): (NOT member(ff,OE`space) IMPLIES
                          EXISTS (Ext:Op_Extension(OE)): member(ff,Ext`space))


decl_type: formula
theory: riesz_hahn_banach
library: analysis
signature: nil
location: 47 3 48 75
body:
     Hahn_Banach: THEOREM EXISTS (LB): op_norm[a,b,(bounded_on_int?[a,b])](LB) = op_norm[a,b,(continuous_on_int?[a,b])](LC)
                                       AND (FORALL (f:Continuous_Function[a,b]): LB(f) = LC(f))


decl_type: type
theory: riesz_hahn_banach
library: analysis
signature: nil
location: 27 3 27 109
body:
     Op_Pair: TYPE = [# space: (bounded_linear_subspace?[a,b]), Lop: (bounded_linear_operator?[a,b,(space)]) #]


decl_type: function
theory: riesz_hahn_banach
library: analysis
signature: [[Op_Pair, Op_Pair] -> bool]
location: 31 3 32 89
body:
     <=(OE,Ext) : bool = subset?(OE`space,Ext`space) AND (FORALL (ff:[INTab->real]): OE`space(ff) IMPLIES OE`Lop(ff) = Ext`Lop(ff))
                         AND op_norm[a,b,(OE`space)](OE`Lop) = op_norm[a,b,(Ext`space)](Ext`Lop)


decl_type: tcc
theory: riesz_hahn_banach
library: analysis
signature: nil
location: 56 0 63 999
body:
  % Assuming TCC generated (at line 20, column 39) for
      % bounded_linear_operator?[a, b, (continuous_on_int?[a, b])]
      % generated from assumption riesz_bounded_functionals.funs_subspace
  C_Bounded_Linear_Operator_TCC1: OBLIGATION
    bounded_linear_subspace?[a, b]
        (extend
             [[INTab[a, b] -> real], (continuous_on_int?[a, b]), bool, FALSE]
             (fullset[(continuous_on_int?[a, b])]));


decl_type: tcc
theory: riesz_hahn_banach
library: analysis
signature: nil
location: 65 0 71 999
body:
  % Assuming TCC generated (at line 22, column 39) for
      % bounded_linear_operator?[a, b, (bounded_on_int?[a, b])]
      % generated from assumption riesz_bounded_functionals.funs_subspace
  B_Bounded_Linear_Operator_TCC1: OBLIGATION
    bounded_linear_subspace?[a, b]
        (extend[[INTab[a, b] -> real], (bounded_on_int?[a, b]), bool, FALSE]
             (fullset[(bounded_on_int?[a, b])]));


decl_type: tcc
theory: riesz_hahn_banach
library: analysis
signature: nil
location: 73 0 79 999
body:
  % Subtype TCC generated (at line 31, column 125) for  ff
      % expected type  (Ext`space)
  lesseqp_TCC1: OBLIGATION
    FORALL (OE: Op_Pair, Ext: Op_Pair):
      subset?(OE`space, Ext`space) IMPLIES
       (FORALL (ff: [INTab[a, b] -> real]):
          OE`space(ff) IMPLIES Ext`space(ff));


decl_type: tcc
theory: riesz_hahn_banach
library: analysis
signature: nil
location: 81 0 88 999
body:
  % Subtype TCC generated (at line 32, column 46) for  OE`Lop
      % expected type  L: (bounded_op?[a, b, (OE`space)])
  lesseqp_TCC2: OBLIGATION
    FORALL (OE: Op_Pair, Ext: Op_Pair):
      (FORALL (ff: [INTab -> real]):
         OE`space(ff) IMPLIES OE`Lop(ff) = Ext`Lop(ff))
       AND subset?(OE`space, Ext`space)
       IMPLIES bounded_op?[a, b, (OE`space)](OE`Lop);


decl_type: tcc
theory: riesz_hahn_banach
library: analysis
signature: nil
location: 90 0 101 999
body:
  % Assuming TCC generated (at line 12, column 3) for
      % riesz_bounded_functionals[a, b, (OE`space)]
      % generated from assumption riesz_bounded_functionals.funs_subspace
  lesseqp_TCC3: OBLIGATION
    FORALL (OE: Op_Pair, Ext: Op_Pair):
      (FORALL (ff: [INTab -> real]):
         OE`space(ff) IMPLIES OE`Lop(ff) = Ext`Lop(ff))
       AND subset?(OE`space, Ext`space)
       IMPLIES
       bounded_linear_subspace?[a, b]
           (extend[[INTab[a, b] -> real], (OE`space), bool, FALSE]
                (fullset[(OE`space)]));


decl_type: tcc
theory: riesz_hahn_banach
library: analysis
signature: nil
location: 103 0 110 999
body:
  % Subtype TCC generated (at line 32, column 81) for  Ext`Lop
      % expected type  L: (bounded_op?[a, b, (Ext`space)])
  lesseqp_TCC4: OBLIGATION
    FORALL (OE: Op_Pair, Ext: Op_Pair):
      (FORALL (ff: [INTab -> real]):
         OE`space(ff) IMPLIES OE`Lop(ff) = Ext`Lop(ff))
       AND subset?(OE`space, Ext`space)
       IMPLIES bounded_op?[a, b, (Ext`space)](Ext`Lop);


decl_type: tcc
theory: riesz_hahn_banach
library: analysis
signature: nil
location: 112 0 123 999
body:
  % Assuming TCC generated (at line 12, column 3) for
      % riesz_bounded_functionals[a, b, (Ext`space)]
      % generated from assumption riesz_bounded_functionals.funs_subspace
  lesseqp_TCC5: OBLIGATION
    FORALL (OE: Op_Pair, Ext: Op_Pair):
      (FORALL (ff: [INTab -> real]):
         OE`space(ff) IMPLIES OE`Lop(ff) = Ext`Lop(ff))
       AND subset?(OE`space, Ext`space)
       IMPLIES
       bounded_linear_subspace?[a, b]
           (extend[[INTab[a, b] -> real], (Ext`space), bool, FALSE]
                (fullset[(Ext`space)]));


decl_type: tcc
theory: riesz_hahn_banach
library: analysis
signature: nil
location: 125 0 129 999
body:
  % Subtype TCC generated (at line 47, column 73) for  LB
      % expected type  L: (bounded_op?)
  Hahn_Banach_TCC1: OBLIGATION
    FORALL (LB: B_Bounded_Linear_Operator):
      bounded_op?[a, b, (bounded_on_int?[a, b])](LB);


decl_type: tcc
theory: riesz_hahn_banach
library: analysis
signature: nil
location: 131 0 135 999
body:
  % Subtype TCC generated (at line 47, column 118) for  LC
      % expected type  L: (bounded_op?)
  Hahn_Banach_TCC2: OBLIGATION
    FORALL (LC: C_Bounded_Linear_Operator, LB: B_Bounded_Linear_Operator):
      bounded_op?[a, b, (continuous_on_int?[a, b])](LC);


decl_type: formula
theory: riesz_representation
library: analysis
signature: nil
location: 30 3 31 71
body:
     integral_norm_bounded: LEMMA integrable?(a,b,g,f) AND
                            abs(integral(a,b,g,f)) <= total_variation(a,b,g)(b)*fun_norm(f)


decl_type: formula
theory: riesz_representation
library: analysis
signature: nil
location: 40 3 40 122
body:
     char_fun_minus: LEMMA r1<=r2 AND (r2<r3 OR (r2<=r3 AND r3<b)) IMPLIES char_fun(r1,r3)-char_fun(r1,r2) = char_fun(r2,r3)


decl_type: formula
theory: riesz_representation
library: analysis
signature: nil
location: 48 3 49 121
body:
     step_approx_def: LEMMA FORALL (eps:posreal): EXISTS (delta:posreal): FORALL (P:partition(a,b),xis:xis?(a,b,P)):
        strictly_increasing?(P) AND width(a,b,P)<delta IMPLIES (FORALL (x:INTab): abs(f(x)-step_approx(P,xis)(f)(x)) < eps)


decl_type: formula
theory: riesz_representation
library: analysis
signature: nil
location: 53 3 55 18
body:
     riesz_representation: LEMMA EXISTS g:
          op_norm[a,b,Continuous_Function[a,b]](LC) = total_variation(a,b,g)(b) AND
          LC = fun_to_op(g)


decl_type: function
theory: riesz_representation
library: analysis
signature: [(bounded_variation?(a, b)) -> C_Bounded_Linear_Operator[a, b]]
location: 33 3 34 30
body:
     fun_to_op(g): C_Bounded_Linear_Operator = (LAMBDA (f):
                                             integral(a,b,g,f))


decl_type: function
theory: riesz_representation
library: analysis
signature: [[INTab[a, b], INTab[a, b]] -> [INTab[a, b] -> nnreal]]
location: 38 3 38 116
body:
     char_fun(r1,r2)(x): nnreal = IF r1<=x AND x<r2 AND r2<b THEN 1 ELSIF r1<=x AND x<=r2 AND r2=b THEN 1 ELSE 0 ENDIF


decl_type: function
theory: riesz_representation
library: analysis
location: 44 3 46 51
signature:
  [[P: partition(a, b), xis?[INTab](a, b, P)] ->
          [(bounded_on_int?[a, b]) -> (bounded_on_int?[a, b])]]

body:
     step_approx(P:partition(a,b),xis:xis?(a,b,P))(fr:(bounded_on_int?[a,b])): (bounded_on_int?[a,b]) =
          (LAMBDA (x:INTab): sigma[below(P`length-1)](0,P`length-2,LAMBDA (n:below(P`length-1)):
                  fr(xis`seq(n))*char_fun(P`seq(n),P`seq(n+1))(x)))


decl_type: tcc
theory: riesz_representation
library: analysis
signature: nil
location: 63 0 66 999
body:
  % Assuming TCC generated (at line 14, column 38) for
      % rs_integral_cont[INTab]
      % generated from assumption rs_integral_cont.connected_domain
  IMP_rs_integral_cont_TCC1: OBLIGATION connected?[INTab[a, b]];


decl_type: tcc
theory: riesz_representation
library: analysis
signature: nil
location: 68 0 71 999
body:
  % Assuming TCC generated (at line 14, column 38) for
      % rs_integral_cont[INTab]
      % generated from assumption rs_integral_cont.not_one_element
  IMP_rs_integral_cont_TCC2: OBLIGATION not_one_element?[INTab[a, b]];


decl_type: tcc
theory: riesz_representation
library: analysis
signature: nil
location: 73 0 75 999
body:
  % Subtype TCC generated (at line 30, column 44) for  a
      % expected type  INTab[a, b]
  integral_norm_bounded_TCC1: OBLIGATION a <= a AND a <= b;


decl_type: tcc
theory: riesz_representation
library: analysis
signature: nil
location: 77 0 79 999
body:
  % Subtype TCC generated (at line 30, column 46) for  b
      % expected type  {x: INTab[a, b] | a < x}
  integral_norm_bounded_TCC2: OBLIGATION (a <= b AND b <= b) AND a < b;


decl_type: tcc
theory: riesz_representation
library: analysis
signature: nil
location: 81 0 85 999
body:
  % Subtype TCC generated (at line 31, column 57) for  b
      % expected type  x: {x | TRUE}
  integral_norm_bounded_TCC3: OBLIGATION
    FORALL (f: Continuous_Function[a, b], g: (bounded_variation?(a, b))):
      integrable?(a, b, g, f) IMPLIES a <= b AND b <= b;


decl_type: tcc
theory: riesz_representation
library: analysis
signature: nil
location: 87 0 92 999
body:
  % Subtype TCC generated (at line 34, column 27) for  f
      % expected type  {f | integrable?(a, b, g, f)}
  fun_to_op_TCC1: OBLIGATION
    FORALL (g: (bounded_variation?[INTab](a, b)),
            f: Continuous_Function[a, b]):
      integrable?[INTab](a, b, g, f);


decl_type: tcc
theory: riesz_representation
library: analysis
signature: nil
location: 94 0 100 999
body:
  % Subtype TCC generated (at line 33, column 46) for
      % (LAMBDA (f): integral(a, b, g, f))
      % expected type  C_Bounded_Linear_Operator[a, b]
  fun_to_op_TCC2: OBLIGATION
    FORALL (g: (bounded_variation?[INTab](a, b))):
      bounded_linear_operator?[a, b, (continuous_on_int?[a, b])]
          (LAMBDA (f): integral[INTab](a, b, g, f));


decl_type: tcc
theory: riesz_representation
library: analysis
signature: nil
location: 102 0 104 999
body:
  % Subtype TCC generated (at line 36, column 73) for  b
      % expected type  x: {x | TRUE}
  fun_to_op_bound_TCC1: OBLIGATION a <= b AND b <= b;


decl_type: tcc
theory: riesz_representation
library: analysis
signature: nil
location: 106 0 112 999
body:
  % Subtype TCC generated (at line 45, column 48) for  0
      % expected type  T_low[below(P`length - 1)]
  step_approx_TCC1: OBLIGATION
    FORALL (P: partition[INTab](a, b), xis: xis?[INTab](a, b, P),
            fr: (bounded_on_int?[a, b])):
      0 >= 0 AND 0 < P`length - 1 OR
       (EXISTS (j: below(P`length - 1)): j <= 0);


decl_type: tcc
theory: riesz_representation
library: analysis
signature: nil
location: 114 0 120 999
body:
  % Subtype TCC generated (at line 45, column 50) for  P`length - 2
      % expected type  T_high[below(P`length - 1)]
  step_approx_TCC2: OBLIGATION
    FORALL (P: partition[INTab](a, b), xis: xis?[INTab](a, b, P),
            fr: (bounded_on_int?[a, b])):
      P`length - 2 >= 0 AND P`length - 2 < P`length - 1 OR
       (EXISTS (j: below(P`length - 1)): P`length - 2 <= j);


decl_type: tcc
theory: riesz_representation
library: analysis
signature: nil
location: 122 0 129 999
body:
  % Assuming TCC generated (at line 41, column 5) for
      % reals@sigma[below(P`length - 1)]
      % generated from assumption sigma.connected_domain
  step_approx_TCC3: OBLIGATION
    FORALL (P: partition[INTab](a, b), xis: xis?[INTab](a, b, P),
            fr: (bounded_on_int?[a, b])):
      FORALL (x, y: below(P`length - 1)), (z: integer):
        x <= z AND z <= y IMPLIES z >= 0 AND z < P`length - 1;


decl_type: tcc
theory: riesz_representation
library: analysis
signature: nil
location: 131 0 146 999
body:
  % Subtype TCC generated (at line 45, column 5) for
      % (LAMBDA (x: INTab):
      %    sigma[below(P`length - 1)]
      %        (0, P`length - 2,
      %         LAMBDA (n: below(P`length - 1)):
      %           fr(xis`seq(n)) * char_fun(P`seq(n), P`seq(n + 1))(x)))
      % expected type  (bounded_on_int?[a, b])
  step_approx_TCC4: OBLIGATION
    FORALL (P: partition[INTab](a, b), xis: xis?[INTab](a, b, P),
            fr: (bounded_on_int?[a, b])):
      bounded_on_int?[a, b]
          (LAMBDA (x: INTab[a, b]):
             sigma[below(P`length - 1)]
                 (0, P`length - 2,
                  LAMBDA (n: below(P`length - 1)):
                    fr(xis`seq(n)) * char_fun(P`seq(n), P`seq(n + 1))(x)));


decl_type: tcc
theory: riesz_representation
library: analysis
signature: nil
location: 148 0 154 999
body:
  % Assuming TCC generated (at line 51, column 13) for
      % riesz_bounded_functionals[a, b, Continuous_Function[a, b]]
      % generated from assumption riesz_bounded_functionals.funs_subspace
  IMP_riesz_bounded_functionals_TCC1: OBLIGATION
    bounded_linear_subspace?[a, b]
        (extend[[INTab[a, b] -> real], Continuous_Function[a, b], bool, FALSE]
             (fullset[Continuous_Function[a, b]]));


decl_type: tcc
theory: riesz_representation
library: analysis
signature: nil
location: 156 0 162 999
body:
  % Assuming TCC generated (at line 51, column 69) for
      % riesz_bounded_functionals[a, b, Bounded_Function[a, b]]
      % generated from assumption riesz_bounded_functionals.funs_subspace
  IMP_riesz_bounded_functionals_TCC2: OBLIGATION
    bounded_linear_subspace?[a, b]
        (extend[[INTab[a, b] -> real], Bounded_Function[a, b], bool, FALSE]
             (fullset[Bounded_Function[a, b]]));


decl_type: tcc
theory: riesz_representation
library: analysis
signature: nil
location: 164 0 168 999
body:
  % Subtype TCC generated (at line 54, column 39) for  LC
      % expected type  L: (bounded_op?)
  riesz_representation_TCC1: OBLIGATION
    FORALL (LC: C_Bounded_Linear_Operator[a, b], g):
      bounded_op?[a, b, Continuous_Function[a, b]](LC);


decl_type: formula
theory: polynomial_deriv
library: analysis
signature: nil
location: 24 2 27 31
body:
    deriv_polynomial    : LEMMA deriv(polynomial(a,n))
                          = IF n = 0 THEN (LAMBDA (x:real): 0)
                            ELSE polynomial((LAMBDA (i:nat): (i+1)*a(i+1)),n-1) 
                            ENDIF


decl_type: formula
theory: polynomial_deriv
library: analysis
signature: nil
location: 31 2 34 19
body:
    nderiv_polynomial  : LEMMA nderiv(n,polynomial(b,m))
              = IF n > m THEN (LAMBDA (x:real): 0)
                ELSE polynomial(LAMBDA (i:nat): C(i+n,n)*factorial(n)*b(i+n),m-n)
                ENDIF


decl_type: tcc
theory: polynomial_deriv
library: analysis
signature: nil
location: 42 0 44 999
body:
  % Assuming TCC generated (at line 12, column 12) for  derivatives[real]
      % generated from assumption derivatives.deriv_domain
  derivable_polynomial_TCC1: OBLIGATION deriv_domain?[real];


decl_type: tcc
theory: polynomial_deriv
library: analysis
signature: nil
location: 46 0 48 999
body:
  % Assuming TCC generated (at line 12, column 12) for  derivatives[real]
      % generated from assumption derivatives.not_one_element
  derivable_polynomial_TCC2: OBLIGATION not_one_element?[real];


decl_type: tcc
theory: polynomial_deriv
library: analysis
signature: nil
location: 50 0 53 999
body:
  % Subtype TCC generated (at line 24, column 36) for  polynomial(a, n)
      % expected type  deriv_fun[real]
  deriv_polynomial_TCC1: OBLIGATION
    FORALL (a: sequence[real], n: nat): derivable?[real](polynomial(a, n));


decl_type: tcc
theory: polynomial_deriv
library: analysis
signature: nil
location: 55 0 58 999
body:
  % Subtype TCC generated (at line 26, column 73) for  n - 1
      % expected type  nat
  deriv_polynomial_TCC2: OBLIGATION
    FORALL (n: nat): NOT n = 0 IMPLIES n - 1 >= 0;


decl_type: tcc
theory: polynomial_deriv
library: analysis
signature: nil
location: 60 0 64 999
body:
  % Subtype TCC generated (at line 31, column 38) for  polynomial(b, m)
      % expected type  nderiv_fun[real](n)
  nderiv_polynomial_TCC1: OBLIGATION
    FORALL (b: sequence[real], m, n: nat):
      derivable_n_times?[real](polynomial(b, m), n);


decl_type: tcc
theory: polynomial_deriv
library: analysis
signature: nil
location: 66 0 69 999
body:
  % Subtype TCC generated (at line 33, column 52) for  n
      % expected type  {i_1: nat | i_1 <= i + n}
  nderiv_polynomial_TCC2: OBLIGATION
    FORALL (m, n: nat): NOT n > m IMPLIES (FORALL (i: nat): n <= i + n);


decl_type: tcc
theory: polynomial_deriv
library: analysis
signature: nil
location: 71 0 74 999
body:
  % Subtype TCC generated (at line 33, column 75) for  m - n
      % expected type  nat
  nderiv_polynomial_TCC3: OBLIGATION
    FORALL (m, n: nat): NOT n > m IMPLIES m - n >= 0;


decl_type: formula
theory: inverse_continuous_functions
library: analysis
signature: nil
location: 29 2 30 58
body:
    inverse_incr : LEMMA  bijective?[T1, T2](g) AND strict_increasing?(g) 
                             IMPLIES continuous?(inverse(g))


decl_type: formula
theory: inverse_continuous_functions
library: analysis
signature: nil
location: 32 2 33 58
body:
    inverse_decr : LEMMA bijective?[T1, T2](g) AND strict_decreasing?(g) 
                             IMPLIES continuous?(inverse(g))


decl_type: formula
theory: inverse_continuous_functions
library: analysis
signature: nil
location: 35 2 36 63
body:
    inverse_continuous : LEMMA bijective?[T1, T2](g) 
                                  IMPLIES continuous?(inverse(g))


decl_type: formula
theory: derivative_inverse
library: analysis
signature: nil
location: 40 2 42 57
body:
    inverse_derivable: LEMMA
       derivable?[T1](F) AND bijective?[T1,T2](F) AND deriv[T1](F) = f
       AND inverse?[T1,T2](G,F) IMPLIES derivable?[T2](G,x)


decl_type: formula
theory: derivative_inverse
library: analysis
signature: nil
location: 44 2 46 55
body:
    inverse_derivable_fun: LEMMA
       derivable?[T1](F) AND bijective?[T1,T2](F) AND deriv[T1](F) = f
       AND inverse?[T1,T2](G,F) IMPLIES derivable?[T2](G)


decl_type: formula
theory: derivative_inverse
library: analysis
signature: nil
location: 48 2 50 52
body:
    deriv_inverse_fun: LEMMA derivable?[T1](F) AND deriv[T1](F) = f
       AND bijective?[T1,T2](F) AND inverse?[T1,T2](G,F)
     IMPLIES deriv[T2](G) = (LAMBDA (x:T2): 1/f(G(x)))


decl_type: formula
theory: derivative_inverse
library: analysis
signature: nil
location: 53 2 56 68
body:
    deriv_inverse: LEMMA derivable?[T1](F) AND deriv[T1](F) = f
                         AND bijective?[T1,T2](F) AND inverse?[T1,T2](G,F)
                     IMPLIES derivable?[T1](F) AND 
                             deriv[T2](G) = (LAMBDA (x:T2): 1/f(G(x)))


decl_type: tcc
theory: derivative_inverse
library: analysis
signature: nil
location: 63 0 65 999
body:
  % Assuming TCC generated (at line 24, column 4) for  derivatives[T1]
      % generated from assumption derivatives.deriv_domain
  inverse_derivable_TCC1: OBLIGATION deriv_domain?[T1];


decl_type: tcc
theory: derivative_inverse
library: analysis
signature: nil
location: 67 0 69 999
body:
  % Assuming TCC generated (at line 26, column 4) for  derivatives[T1]
      % generated from assumption derivatives.not_one_element
  inverse_derivable_TCC2: OBLIGATION not_one_element?[T1];


decl_type: tcc
theory: derivative_inverse
library: analysis
signature: nil
location: 71 0 77 999
body:
  % Assuming TCC generated (at line 26, column 4) for  derivatives_def[T2]
      % generated from assumption derivatives_def.deriv_domain
  inverse_derivable_TCC3: OBLIGATION
    FORALL (F: [T1 -> T2], G: [T2 -> T1], f: [T1 -> nzreal]):
      inverse?[T1, T2](G, F) AND
       deriv[T1](F) = f AND bijective?[T1, T2](F) AND derivable?[T1](F)
       IMPLIES deriv_domain?[T2];


decl_type: tcc
theory: derivative_inverse
library: analysis
signature: nil
location: 79 0 85 999
body:
  % Assuming TCC generated (at line 28, column 4) for  derivatives_def[T2]
      % generated from assumption derivatives_def.not_one_element
  inverse_derivable_TCC4: OBLIGATION
    FORALL (F: [T1 -> T2], G: [T2 -> T1], f: [T1 -> nzreal]):
      inverse?[T1, T2](G, F) AND
       deriv[T1](F) = f AND bijective?[T1, T2](F) AND derivable?[T1](F)
       IMPLIES not_one_element?[T2];


decl_type: tcc
theory: derivative_inverse
library: analysis
signature: nil
location: 87 0 93 999
body:
  % Subtype TCC generated (at line 50, column 21) for  G
      % expected type  deriv_fun[T2]
  deriv_inverse_fun_TCC1: OBLIGATION
    FORALL (F: [T1 -> T2], G: [T2 -> T1], f: [T1 -> nzreal]):
      inverse?[T1, T2](G, F) AND
       bijective?[T1, T2](F) AND deriv[T1](F) = f AND derivable?[T1](F)
       IMPLIES derivable?[T2](G);


decl_type: formula
theory: sqrt_derivative
library: analysis
signature: nil
location: 17 2 18 66
body:
    deriv_sqrt_fun :  LEMMA deriv[posreal](sqrt)
                               = (LAMBDA (x:posreal): 1/(2*sqrt(x)))


decl_type: formula
theory: sqrt_derivative
library: analysis
signature: nil
location: 20 2 22 69
body:
    deriv_sqrt     : LEMMA derivable?[posreal](sqrt) AND
                             deriv[posreal](sqrt)
                                  = (LAMBDA (x:posreal): 1/(2*sqrt(x)))


decl_type: tcc
theory: restrict2_deriv
library: analysis
signature: nil
location: 42 0 44 999
body:
  % Assuming TCC generated (at line 23, column 10) for  deriv_fun[T2]
      % generated from assumption derivatives.deriv_domain
  f_TCC1: OBLIGATION deriv_domain?[T2];


decl_type: tcc
theory: restrict2_deriv
library: analysis
signature: nil
location: 46 0 48 999
body:
  % Assuming TCC generated (at line 23, column 10) for  deriv_fun[T2]
      % generated from assumption derivatives.not_one_element
  f_TCC2: OBLIGATION not_one_element?[T2];


decl_type: tcc
theory: restrict2_deriv
library: analysis
signature: nil
location: 50 0 52 999
body:
  % Judgement subtype TCC generated (at line 26, column 22) for  x
      % expected type  T2
  sub_dom: OBLIGATION FORALL (x: T1): T2_pred(x);


decl_type: tcc
theory: restrict2_deriv
library: analysis
signature: nil
location: 54 0 56 999
body:
  % Assuming TCC generated (at line 24, column 4) for  derivatives[T1]
      % generated from assumption derivatives.deriv_domain
  restrict2_derivable_TCC1: OBLIGATION deriv_domain?[T1];


decl_type: tcc
theory: restrict2_deriv
library: analysis
signature: nil
location: 58 0 60 999
body:
  % Assuming TCC generated (at line 26, column 4) for  derivatives[T1]
      % generated from assumption derivatives.not_one_element
  restrict2_derivable_TCC2: OBLIGATION not_one_element?[T1];


decl_type: tcc
theory: restrict2_deriv
library: analysis
signature: nil
location: 62 0 65 999
body:
  % Subtype TCC generated (at line 34, column 54) for  restrict2(f)
      % expected type  deriv_fun[T1]
  restrict2_deriv_TCC1: OBLIGATION
    FORALL (f: deriv_fun[T2]): derivable?[T1](restrict2(f));


decl_type: formula
theory: derivatives_subtype
library: analysis
signature: nil
location: 17 2 18 35
body:
    derivable_subtype: LEMMA derivable?[T](f) AND deriv_domain?[S] AND not_one_element?[S] 
             IMPLIES derivable?[S](f)


decl_type: formula
theory: derivatives_subtype
library: analysis
signature: nil
location: 21 2 22 63
body:
    deriv_subtype: LEMMA derivable?[T](f) AND del_neigh_all?[S] AND not_one_element?[S] 
             IMPLIES deriv[S](f) = (LAMBDA (s:S): deriv[T](f)(s))


decl_type: tcc
theory: derivatives_subtype
library: analysis
signature: nil
location: 30 0 32 999
body:
  % Assuming TCC generated (at line 24, column 4) for  derivatives[T]
      % generated from assumption derivatives.deriv_domain
  derivable_subtype_TCC1: OBLIGATION deriv_domain?[T];


decl_type: tcc
theory: derivatives_subtype
library: analysis
signature: nil
location: 34 0 36 999
body:
  % Assuming TCC generated (at line 26, column 4) for  derivatives[T]
      % generated from assumption derivatives.not_one_element
  derivable_subtype_TCC2: OBLIGATION not_one_element?[T];


decl_type: tcc
theory: derivatives_subtype
library: analysis
signature: nil
location: 38 0 43 999
body:
  % Assuming TCC generated (at line 24, column 4) for  derivatives[S]
      % generated from assumption derivatives.deriv_domain
  derivable_subtype_TCC3: OBLIGATION
    FORALL (f: [T -> real]):
      not_one_element?[S] AND deriv_domain?[S] AND derivable?[T](f) IMPLIES
       deriv_domain?[S];


decl_type: tcc
theory: derivatives_subtype
library: analysis
signature: nil
location: 45 0 50 999
body:
  % Assuming TCC generated (at line 26, column 4) for  derivatives[S]
      % generated from assumption derivatives.not_one_element
  derivable_subtype_TCC4: OBLIGATION
    FORALL (f: [T -> real]):
      not_one_element?[S] AND deriv_domain?[S] AND derivable?[T](f) IMPLIES
       not_one_element?[S];


decl_type: tcc
theory: derivatives_subtype
library: analysis
signature: nil
location: 52 0 57 999
body:
  % Subtype TCC generated (at line 22, column 28) for  restrict[T, S, real](f)
      % expected type  deriv_fun[S]
  deriv_subtype_TCC1: OBLIGATION
    FORALL (f: [T -> real]):
      not_one_element?[S] AND del_neigh_all?[S] AND derivable?[T](f) IMPLIES
       derivable?[S](restrict[T, S, real](f));


decl_type: tcc
theory: derivatives_subtype
library: analysis
signature: nil
location: 59 0 64 999
body:
  % Assuming TCC generated (at line 24, column 4) for  derivatives[S]
      % generated from assumption derivatives.deriv_domain
  deriv_subtype_TCC2: OBLIGATION
    FORALL (f: [T -> real]):
      not_one_element?[S] AND del_neigh_all?[S] AND derivable?[T](f) IMPLIES
       deriv_domain?[S];


decl_type: tcc
theory: derivatives_subtype
library: analysis
signature: nil
location: 66 0 71 999
body:
  % Assuming TCC generated (at line 26, column 4) for  derivatives[S]
      % generated from assumption derivatives.not_one_element
  deriv_subtype_TCC3: OBLIGATION
    FORALL (f: [T -> real]):
      not_one_element?[S] AND del_neigh_all?[S] AND derivable?[T](f) IMPLIES
       not_one_element?[S];


decl_type: tcc
theory: deriv_sign
library: analysis
signature: nil
location: 20 0 22 999
body:
  % Assuming TCC generated (at line 4, column 28) for  derivatives[nzreal]
      % generated from assumption derivatives.deriv_domain
  IMP_derivatives_TCC1: OBLIGATION deriv_domain?[nzreal];


decl_type: tcc
theory: deriv_sign
library: analysis
signature: nil
location: 24 0 26 999
body:
  % Assuming TCC generated (at line 4, column 28) for  derivatives[nzreal]
      % generated from assumption derivatives.not_one_element
  IMP_derivatives_TCC2: OBLIGATION not_one_element?[nzreal];


decl_type: tcc
theory: deriv_sign
library: analysis
signature: nil
location: 28 0 32 999
body:
  % Subtype TCC generated (at line 10, column 36) for
      % restrict[real, nzreal, Sign](sign)
      % expected type  deriv_fun[nzreal]
  deriv_sign_TCC1: OBLIGATION
    derivable?[nzreal](restrict[real, nzreal, Sign](sign));


decl_type: tcc
theory: derivatives_lam
library: analysis
signature: nil
location: 89 0 91 999
body:
  % Subtype TCC generated (at line 36, column 54) for  n
      % expected type  {i: int | t /= 0 OR i >= 0}
  derivable_pow_lam_TCC1: OBLIGATION FORALL (n: nat, t: T): t /= 0 OR n >= 0;


decl_type: tcc
theory: derivatives_lam
library: analysis
signature: nil
location: 93 0 95 999
body:
  % Subtype TCC generated (at line 46, column 37) for  LAMBDA (t): t
      % expected type  deriv_fun[T]
  deriv_id_lam_TCC1: OBLIGATION derivable?[T](LAMBDA (t): t);


decl_type: tcc
theory: derivatives_lam
library: analysis
signature: nil
location: 97 0 100 999
body:
  % Subtype TCC generated (at line 48, column 37) for  LAMBDA (t): a
      % expected type  deriv_fun[T]
  deriv_const_lam_TCC1: OBLIGATION
    FORALL (a: real): derivable?[T](LAMBDA (t): a);


decl_type: tcc
theory: derivatives_lam
library: analysis
signature: nil
location: 102 0 105 999
body:
  % Subtype TCC generated (at line 50, column 37) for  LAMBDA (t): f(t) + g(t)
      % expected type  deriv_fun[T]
  deriv_add_lam_TCC1: OBLIGATION
    FORALL (f, g: deriv_fun[T]): derivable?[T](LAMBDA (t): f(t) + g(t));


decl_type: tcc
theory: derivatives_lam
library: analysis
signature: nil
location: 107 0 110 999
body:
  % Subtype TCC generated (at line 52, column 37) for  LAMBDA (t): f(t) * g(t)
      % expected type  deriv_fun[T]
  deriv_mult_lam_TCC1: OBLIGATION
    FORALL (f, g: deriv_fun[T]): derivable?[T](LAMBDA (t): f(t) * g(t));


decl_type: tcc
theory: derivatives_lam
library: analysis
signature: nil
location: 112 0 114 999
body:
  % Subtype TCC generated (at line 55, column 49) for  m
      % expected type  {i: int | t /= 0 OR i >= 0}
  deriv_pow_lam_TCC1: OBLIGATION FORALL (m: posnat, t: T): t /= 0 OR m >= 0;


decl_type: tcc
theory: derivatives_lam
library: analysis
signature: nil
location: 116 0 119 999
body:
  % Subtype TCC generated (at line 55, column 37) for  LAMBDA (t): t ^ m
      % expected type  deriv_fun[T]
  deriv_pow_lam_TCC2: OBLIGATION
    FORALL (m: posnat): derivable?[T](LAMBDA (t): t ^ m);


decl_type: tcc
theory: derivatives_lam
library: analysis
signature: nil
location: 121 0 124 999
body:
  % Subtype TCC generated (at line 55, column 70) for  (m - 1)
      % expected type  {i: int | t /= 0 OR i >= 0}
  deriv_pow_lam_TCC3: OBLIGATION
    FORALL (m: posnat, t: T): t /= 0 OR (m - 1) >= 0;


decl_type: tcc
theory: derivatives_lam
library: analysis
signature: nil
location: 126 0 129 999
body:
  % Subtype TCC generated (at line 57, column 37) for  LAMBDA (t): a * f(t)
      % expected type  deriv_fun[T]
  deriv_scal1_lam_TCC1: OBLIGATION
    FORALL (a: real, f: deriv_fun[T]): derivable?[T](LAMBDA (t): a * f(t));


decl_type: tcc
theory: derivatives_lam
library: analysis
signature: nil
location: 131 0 134 999
body:
  % Subtype TCC generated (at line 59, column 37) for  LAMBDA (t): f(t) * a
      % expected type  deriv_fun[T]
  deriv_scal2_lam_TCC1: OBLIGATION
    FORALL (a: real, f: deriv_fun[T]): derivable?[T](LAMBDA (t): f(t) * a);


decl_type: tcc
theory: derivatives_lam
library: analysis
signature: nil
location: 136 0 139 999
body:
  % Subtype TCC generated (at line 61, column 37) for  LAMBDA (t): -g(t)
      % expected type  deriv_fun[T]
  deriv_neg_lam_TCC1: OBLIGATION
    FORALL (g: deriv_fun[T]): derivable?[T](LAMBDA (t): -g(t));


decl_type: tcc
theory: derivatives_lam
library: analysis
signature: nil
location: 141 0 144 999
body:
  % Subtype TCC generated (at line 63, column 37) for  LAMBDA (t): f(t) - g(t)
      % expected type  deriv_fun[T]
  deriv_sub_lam_TCC1: OBLIGATION
    FORALL (f, g: deriv_fun[T]): derivable?[T](LAMBDA (t): f(t) - g(t));


decl_type: tcc
theory: derivatives_lam
library: analysis
signature: nil
location: 146 0 148 999
body:
  % Subtype TCC generated (at line 65, column 37) for  LAMBDA (t): sq(t)
      % expected type  deriv_fun[T]
  deriv_sq_lam_TCC1: OBLIGATION derivable?[T](LAMBDA (t): sq(t));


decl_type: tcc
theory: derivatives_lam
library: analysis
signature: nil
location: 150 0 154 999
body:
  % Subtype TCC generated (at line 67, column 37) for  LAMBDA (t): f(t) / k(t)
      % expected type  deriv_fun[T]
  deriv_div_lam_TCC1: OBLIGATION
    FORALL (f: deriv_fun[T], k: nz_deriv_fun[T]):
      derivable?[T](LAMBDA (t): f(t) / k(t));


decl_type: tcc
theory: derivatives_lam
library: analysis
signature: nil
location: 156 0 159 999
body:
  % Subtype TCC generated (at line 70, column 37) for  LAMBDA (t): a / k(t)
      % expected type  deriv_fun[T]
  deriv_scald1_lam_TCC1: OBLIGATION
    FORALL (a: real, k: nz_deriv_fun[T]): derivable?[T](LAMBDA (t): a / k(t));


decl_type: tcc
theory: derivatives_lam
library: analysis
signature: nil
location: 161 0 164 999
body:
  % Subtype TCC generated (at line 73, column 37) for  LAMBDA (t): f(t) / b
      % expected type  deriv_fun[T]
  deriv_scald2_lam_TCC1: OBLIGATION
    FORALL (b: nzreal, f: deriv_fun[T]): derivable?[T](LAMBDA (t): f(t) / b);


decl_type: formula
theory: convex_function_props
library: analysis
signature: nil
location: 20 2 21 87
body:
    convex_functions_locally_bounded: LEMMA convex?(f) IMPLIES FORALL (A, B: real):
      A<=B IMPLIES EXISTS (M: nat): FORALL (x: real): A<=x AND x<=B IMPLIES abs(f(x)) < M


decl_type: formula
theory: convex_function_props
library: analysis
signature: nil
location: 23 2 24 62
body:
    convex_diff_quot_left_lt: LEMMA convex?(f) IMPLIES FORALL(A,B,C):
      A<B AND B<C IMPLIES (f(C)-f(B))/(C-B) >= (f(C)-f(A))/(C-A)


decl_type: formula
theory: convex_function_props
library: analysis
signature: nil
location: 26 2 27 62
body:
    convex_diff_quot_right_lt: LEMMA convex?(f) IMPLIES FORALL(A,B,C):
      A<B AND B<C IMPLIES (f(B)-f(A))/(B-A) <= (f(C)-f(A))/(C-A)


decl_type: formula
theory: convex_function_props
library: analysis
signature: nil
location: 29 2 30 62
body:
    convex_diff_quot_increasing: LEMMA convex?(f) IMPLIES FORALL(A,B,C):
      A<B AND B<C IMPLIES (f(B)-f(A))/(B-A) <= (f(C)-f(B))/(C-B)


decl_type: formula
theory: convex_function_props
library: analysis
signature: nil
location: 32 2 35 65
body:
    convex_diff_quot_bounded: LEMMA convex?(f) IMPLIES
      FORALL (x: real): FORALL (epsil: posreal): EXISTS (M: nat):
      FORALL (delta: nzreal):
      abs(delta)<=epsil IMPLIES abs(f(x+delta)-f(x))/abs(delta) < M


decl_type: formula
theory: convex_function_props
library: analysis
signature: nil
location: 38 2 39 49
body:
    convex_functions_continuous: LEMMA convex?(f) IMPLIES
      continuous?[real,real_dist,real,real_dist](f)


decl_type: tcc
theory: convex_function_props
library: analysis
signature: nil
location: 47 0 53 999
body:
  % Subtype TCC generated (at line 24, column 37) for  (C - B)
      % expected type  nznum
  convex_diff_quot_left_lt_TCC1: OBLIGATION
    FORALL (f: [real -> real]):
      convex?(f) IMPLIES
       (FORALL (A: real, B: real, C: real):
          A < B AND B < C IMPLIES (C - B) /= 0);


decl_type: tcc
theory: convex_function_props
library: analysis
signature: nil
location: 55 0 61 999
body:
  % Subtype TCC generated (at line 24, column 58) for  (C - A)
      % expected type  nznum
  convex_diff_quot_left_lt_TCC2: OBLIGATION
    FORALL (f: [real -> real]):
      convex?(f) IMPLIES
       (FORALL (A: real, B: real, C: real):
          A < B AND B < C IMPLIES (C - A) /= 0);


decl_type: tcc
theory: convex_function_props
library: analysis
signature: nil
location: 63 0 69 999
body:
  % Subtype TCC generated (at line 27, column 37) for  (B - A)
      % expected type  nznum
  convex_diff_quot_right_lt_TCC1: OBLIGATION
    FORALL (f: [real -> real]):
      convex?(f) IMPLIES
       (FORALL (A: real, B: real, C: real):
          A < B AND B < C IMPLIES (B - A) /= 0);


decl_type: tcc
theory: convex_function_props
library: analysis
signature: nil
location: 71 0 76 999
body:
  % Assuming TCC generated (at line 17, column 8) for
      % continuity_ms_def[real, real_dist, real, real_dist]
      % generated from assumption continuity_ms_def.fullset_metric_space1
  convex_functions_continuous_TCC1: OBLIGATION
    FORALL (f: [real -> real]):
      convex?(f) IMPLIES metric_space?[real, real_dist](fullset[real]);


decl_type: formula
theory: inverse_fun_ms_continuous
library: analysis
signature: nil
location: 23 2 26 28
body:
    image_function_continuous: THEOREM FORALL (f:[T1->T2]): 
              continuous?(f) AND compact?(fullset[T1]) AND bijective?(f) 
              IMPLIES 
              continuous?(inverse(f))


decl_type: tcc
theory: inverse_fun_ms_continuous
library: analysis
signature: nil
location: 34 0 37 999
body:
  % Assuming TCC generated (at line 20, column 12) for
      % uniform_continuity[T1, d1, T2, d2]
      % generated from assumption uniform_continuity.fullset_S_metric_space
  IMP_uniform_continuity_TCC1: OBLIGATION metric_space?[T1, d1](fullset[T1]);


decl_type: tcc
theory: inverse_fun_ms_continuous
library: analysis
signature: nil
location: 39 0 42 999
body:
  % Assuming TCC generated (at line 20, column 12) for
      % uniform_continuity[T1, d1, T2, d2]
      % generated from assumption uniform_continuity.fullset_T_metric_space
  IMP_uniform_continuity_TCC2: OBLIGATION metric_space?[T2, d2](fullset[T2]);


decl_type: formula
theory: ms_composition_cont
library: analysis
signature: nil
location: 33 2 34 35
body:
    composition_continuous: LEMMA continuous?(f,S) AND continuous?(g,image[T1,T2](f,S))
                            IMPLIES continuous?(g o f,S)


decl_type: tcc
theory: ms_composition_cont
library: analysis
signature: nil
location: 42 0 45 999
body:
  % Assuming TCC generated (at line 26, column 12) for
      % continuity_ms[T1, d1, T2, d2]
      % generated from assumption continuity_ms.fullset_metric_space1
  IMP_continuity_ms_TCC1: OBLIGATION metric_space?[T1, d1](fullset[T1]);


decl_type: tcc
theory: ms_composition_cont
library: analysis
signature: nil
location: 47 0 50 999
body:
  % Assuming TCC generated (at line 26, column 12) for
      % continuity_ms[T1, d1, T2, d2]
      % generated from assumption continuity_ms.fullset_metric_space2
  IMP_continuity_ms_TCC2: OBLIGATION metric_space?[T2, d2](fullset[T2]);


decl_type: tcc
theory: ms_composition_cont
library: analysis
signature: nil
location: 52 0 55 999
body:
  % Assuming TCC generated (at line 26, column 40) for
      % continuity_ms[T2, d2, T3, d3]
      % generated from assumption continuity_ms.fullset_metric_space2
  IMP_continuity_ms_TCC3: OBLIGATION metric_space?[T3, d3](fullset[T3]);


decl_type: formula
theory: continuity_of_max_min
library: analysis
signature: nil
location: 31 3 32 81
body:
     max_min_fun_convert: LEMMA max_fun(-f,-g) = -min_fun(f,g) AND min_fun(-f,-g) = -max_fun(f,g)
                                AND min_fun(f,g) = -max_fun(-f,-g) AND max_fun(f,g) = -min_fun(-f,-g)


decl_type: formula
theory: continuity_of_max_min
library: analysis
signature: nil
location: 34 3 35 45
body:
     max_fun_continuous: LEMMA continuous?(f,S) AND continuous?(g,S) IMPLIES
                               continuous?(max_fun(f,g),S)


decl_type: formula
theory: continuity_of_max_min
library: analysis
signature: nil
location: 37 3 38 45
body:
     min_fun_continuous: LEMMA continuous?(f,S) AND continuous?(g,S) IMPLIES
                               continuous?(min_fun(f,g),S)


decl_type: tcc
theory: continuity_of_max_min
library: analysis
signature: nil
location: 46 0 49 999
body:
  % Assuming TCC generated (at line 22, column 32) for
      % continuity_ms_def[T, d, real, real_dist]
      % generated from assumption continuity_ms_def.fullset_metric_space1
  IMP_continuity_ms_def_TCC1: OBLIGATION metric_space?[T, d](fullset[T]);


decl_type: tcc
theory: continuity_of_max_min
library: analysis
signature: nil
location: 51 0 55 999
body:
  % Assuming TCC generated (at line 22, column 32) for
      % continuity_ms_def[T, d, real, real_dist]
      % generated from assumption continuity_ms_def.fullset_metric_space2
  IMP_continuity_ms_def_TCC2: OBLIGATION
    metric_space?[real, real_dist](fullset[real]);


decl_type: formula
theory: cross_metric_spaces
library: analysis
signature: nil
location: 47 2 48 68
body:
    euclic_linear_lemma: LEMMA   
       FORALL (a,b,r: nnreal): sqrt(sq(a) + sq(b)) < r/2 implies a+b<r


decl_type: tcc
theory: cross_metric_spaces
library: analysis
signature: nil
location: 61 0 65 999
body:
  % Assuming TCC generated (at line 21, column 6) for
      % metric_spaces[[T1, T2], d]
      % generated from assumption metric_spaces.fullset_metric_space
  metric_equivalence_TCC1: OBLIGATION
    metric_space?[[T1, T2], d](fullset[[T1, T2]]);


decl_type: tcc
theory: cross_metric_spaces
library: analysis
signature: nil
location: 67 0 71 999
body:
  % Assuming TCC generated (at line 21, column 6) for
      % metric_spaces[[T1, T2], d_square]
      % generated from assumption metric_spaces.fullset_metric_space
  metric_equivalence_TCC2: OBLIGATION
    metric_space?[[T1, T2], d_square](fullset[[T1, T2]]);


decl_type: formula
theory: cross_metric_cont
library: analysis
signature: nil
location: 34 2 38 45
body:
    product_cont_equiv: LEMMA 
      continuous?(f,S) IFF 
         (FORALL (x: (S), epsilon: posreal):  EXISTS (delta: posreal): 
              FORALL (y: (S)): (d1(x`1,y`1) <= delta AND d2(x`2,y`2) <= delta) 
                 IMPLIES d3(f(x),f(y))<epsilon)


decl_type: formula
theory: cross_metric_cont
library: analysis
signature: nil
location: 40 2 44 50
body:
    product_cont_product_subset: COROLLARY 
       continuous?(f,fullset[[(X),(Y)]]) IFF 
          (FORALL (x: (X), y: (Y), epsilon: posreal): EXISTS (delta: posreal): 
              FORALL (z: (X), w: (Y)): (d1(x,z) <= delta AND d2(y,w) <= delta) 
                  IMPLIES d3(f(x,y),f(z,w))<epsilon)


decl_type: formula
theory: cross_metric_cont
library: analysis
signature: nil
location: 64 2 69 62
body:
    one_variable_unif_cont_sequence: LEMMA NOT uniformly_continuous_in_first?(f,X,Y) IFF
                  EXISTS (epsilon: posreal): EXISTS (y: (Y)): EXISTS (seq: [posint -> [T1,T1,T2]]):
                  FORALL (n: posint): 
                         (X(seq(n)`1) AND X(seq(n)`2) AND Y(seq(n)`3) 
                         AND d1(seq(n)`1,seq(n)`2) < 1/n AND d2(y,seq(n)`3) < 1/n
                         AND d3(f(seq(n)`1,y),f(seq(n)`2,seq(n)`3)) > epsilon)


decl_type: formula
theory: cross_metric_cont
library: analysis
signature: nil
location: 73 2 74 65
body:
    curried_is_uniform: LEMMA uniformly_continuous_in_first?(f,X,Y) IMPLIES (FORALL (y: (Y)):
                              uniformly_continuous?((LAMBDA (t: T1): f(t,y)),X))


decl_type: function
theory: cross_metric_cont
library: analysis
signature: [[[[T1, T2] -> T3], set[T1], set[T2]] -> bool]
location: 51 2 54 49
body:
    uniformly_continuous_in_first?(f,X,Y): bool = 
       FORALL (y1: (Y), epsilon: posreal): EXISTS (delta: posreal):
          FORALL (x1,x2: (X), y2: (Y)): (d1(x1,x2) <= delta AND d2(y1,y2) <= delta) 
              IMPLIES d3(f(x1,y1),f(x2,y2))<epsilon


decl_type: function
theory: cross_metric_cont
library: analysis
signature: [[[[T1, T2] -> T3], set[T1], set[T2]] -> bool]
location: 56 2 59 49
body:
    uniformly_continuous_in_second?(f,X,Y): bool = 
       FORALL (x1: (X), epsilon: posreal): EXISTS (delta: posreal):
          FORALL (x2: (X), y1,y2: (Y)): (d1(x1,x2) <= delta AND d2(y1,y2) <= delta) 
              IMPLIES d3(f(x1,y1),f(x2,y2))<epsilon


decl_type: tcc
theory: cross_metric_cont
library: analysis
signature: nil
location: 85 0 88 999
body:
  % Assuming TCC generated (at line 26, column 12) for
      % cross_metric_spaces[T1, d1, T2, d2]
      % generated from assumption cross_metric_spaces.fullset_metric_space1
  IMP_cross_metric_spaces_TCC1: OBLIGATION metric_space?[T1, d1](fullset[T1]);


decl_type: tcc
theory: cross_metric_cont
library: analysis
signature: nil
location: 90 0 93 999
body:
  % Assuming TCC generated (at line 26, column 12) for
      % cross_metric_spaces[T1, d1, T2, d2]
      % generated from assumption cross_metric_spaces.fullset_metric_space2
  IMP_cross_metric_spaces_TCC2: OBLIGATION metric_space?[T2, d2](fullset[T2]);


decl_type: tcc
theory: cross_metric_cont
library: analysis
signature: nil
location: 95 0 99 999
body:
  % Assuming TCC generated (at line 26, column 46) for
      % continuity_ms_def[[T1, T2], d[T1, d1, T2, d2], T3, d3]
      % generated from assumption continuity_ms_def.fullset_metric_space1
  IMP_continuity_ms_def_TCC1: OBLIGATION
    metric_space?[[T1, T2], d[T1, d1, T2, d2]](fullset[[T1, T2]]);


decl_type: tcc
theory: cross_metric_cont
library: analysis
signature: nil
location: 101 0 104 999
body:
  % Assuming TCC generated (at line 26, column 46) for
      % continuity_ms_def[[T1, T2], d[T1, d1, T2, d2], T3, d3]
      % generated from assumption continuity_ms_def.fullset_metric_space2
  IMP_continuity_ms_def_TCC2: OBLIGATION metric_space?[T3, d3](fullset[T3]);


decl_type: formula
theory: cross_metric_uniform_continuity
library: analysis
signature: nil
location: 34 2 36 50
body:
    multiary_Heine: THEOREM 
       compact?(X) AND continuous?(f,fullset[[(X),(Y)]]) 
       IMPLIES uniformly_continuous_in_first?(f,X,Y)


decl_type: formula
theory: cross_metric_uniform_continuity
library: analysis
signature: nil
location: 38 2 43 72
body:
    multi_Heine_Corollary1: COROLLARY 
       compact?(X) AND continuous?(f,fullset[[(X),(Y)]]) 
       IMPLIES 
            FORALL (y1: (Y), epsilon: posreal): EXISTS (delta: posreal):
               FORALL (y2: (Y)): (d2(y1,y2) <= delta) 
                  IMPLIES (FORALL (x: (X)): d3(f(x,y1),f(x,y2)) < epsilon)


decl_type: formula
theory: cross_metric_real_fun
library: analysis
signature: nil
location: 41 2 46 61
body:
    curried_min_exists: LEMMA nonempty?(X) AND continuous?(f,fullset[[(X),(Y)]]) AND compact?(X)
       IMPLIES (FORALL (t: T2): Y(t) IMPLIES
           nonempty?[real]({r: real | EXISTS (x: (X)): r = f(x, t)}) AND
            below_bounded[real]({r: real | EXISTS (x: (X)): r = f(x, t)}) AND
             ext[real]({r: real | EXISTS (x: (X)): r = f(x, t)})(inf[real]({r: real | EXISTS (x: (X)): r = f(x, t)}))
             AND (EXISTS (x: (X)): FORALL (y: (X)): f(x,t) <= f(y,t)))


decl_type: formula
theory: cross_metric_real_fun
library: analysis
signature: nil
location: 48 2 50 42
body:
    curried_min_is_cont: THEOREM (compact?(X) AND continuous?(f,fullset[[(X),(Y)]]) AND nonempty?(X)) IMPLIES
                         LET unif_min_first(t: T2): real = IF Y(t) THEN min({r: real | EXISTS (x: (X)): r = f(x,t)}) ELSE 0 ENDIF
                         IN  continuous?(unif_min_first,Y)


decl_type: tcc
theory: cross_metric_real_fun
library: analysis
signature: nil
location: 59 0 63 999
body:
  % Assuming TCC generated (at line 25, column 30) for
      % cross_metric_uniform_continuity[T1, d1, T2, d2, real, real_dist]
      % generated from assumption cross_metric_uniform_continuity.fullset_metric_space1
  IMP_cross_metric_uniform_continuity_TCC1: OBLIGATION
    metric_space?[T1, d1](fullset[T1]);


decl_type: tcc
theory: cross_metric_real_fun
library: analysis
signature: nil
location: 65 0 69 999
body:
  % Assuming TCC generated (at line 25, column 30) for
      % cross_metric_uniform_continuity[T1, d1, T2, d2, real, real_dist]
      % generated from assumption cross_metric_uniform_continuity.fullset_metric_space2
  IMP_cross_metric_uniform_continuity_TCC2: OBLIGATION
    metric_space?[T2, d2](fullset[T2]);


decl_type: tcc
theory: cross_metric_real_fun
library: analysis
signature: nil
location: 71 0 75 999
body:
  % Assuming TCC generated (at line 25, column 30) for
      % cross_metric_uniform_continuity[T1, d1, T2, d2, real, real_dist]
      % generated from assumption cross_metric_uniform_continuity.fullset_metric_space3
  IMP_cross_metric_uniform_continuity_TCC3: OBLIGATION
    metric_space?[real, real_dist](fullset[real]);


decl_type: tcc
theory: cross_metric_real_fun
library: analysis
signature: nil
location: 77 0 94 999
body:
  % Subtype TCC generated (at line 49, column 62) for
      % {r: real | EXISTS (x: (X)): r = f(x, t)}
      % expected type  min_set[real]
  curried_min_is_cont_TCC1: OBLIGATION
    FORALL (X: set[T1], Y: set[T2], f: [[T1, T2] -> real]):
      nonempty?(X) AND
       continuous?(f,
                   extend[[T1, T2], [(X), (Y)], bool, FALSE]
                       (fullset[[(X), (Y)]]))
        AND compact?(X)
       IMPLIES
       (FORALL (t: T2):
          Y(t) IMPLIES
           nonempty?[real]({r: real | EXISTS (x: (X)): r = f(x, t)}) AND
            below_bounded[real]({r: real | EXISTS (x: (X)): r = f(x, t)}) AND
             ext[real]
                 ({r: real | EXISTS (x: (X)): r = f(x, t)})
                 (inf[real]({r: real | EXISTS (x: (X)): r = f(x, t)})));


decl_type: formula
theory: real_fun_continuity_equiv
library: analysis
signature: nil
location: 20 2 23 28
body:
    real_fun_continuity_equiv: LEMMA
                               continuous?[real,real_dist,real,real_dist](f)
                               IFF
                               continuous?[real](f)


decl_type: tcc
theory: real_fun_continuity_equiv
library: analysis
signature: nil
location: 31 0 35 999
body:
  % Assuming TCC generated (at line 17, column 8) for
      % continuity_ms_def[real, real_dist, real, real_dist]
      % generated from assumption continuity_ms_def.fullset_metric_space1
  real_fun_continuity_equiv_TCC1: OBLIGATION
    metric_space?[real, real_dist](fullset[real]);


decl_type: formula
theory: weierstrass_approximation
library: analysis
signature: nil
location: 30 3 32 84
body:
     Weierstrass_approx_combin1: LEMMA
       p<=2 AND k > p IMPLIES
       sigma(0,k,LAMBDA (i:nat): IF i > k THEN 0 ELSE i^p*C(k,i)*(-1)^(k-i) ENDIF) = 0


decl_type: formula
theory: weierstrass_approximation
library: analysis
signature: nil
location: 34 3 40 46
body:
     Weierstrass_approximation_0_1: LEMMA
      continuous?[real,real_dist,real,real_dist](f,closed_intv(0,1))
      IMPLIES
        FORALL (epsilon:posreal):
        EXISTS (a: sequence[real],n:nat):
        FORALL (x:(closed_intv(0,1))):
        abs(polynomial(a,n)(x) - f(x)) < epsilon


decl_type: tcc
theory: weierstrass_approximation
library: analysis
signature: nil
location: 47 0 51 999
body:
  % Assuming TCC generated (at line 17, column 5) for
      % real_fun_on_compact_sets[real, real_dist]
      % generated from assumption real_fun_on_compact_sets.fullset_metric_space
  IMP_real_fun_on_compact_sets_TCC1: OBLIGATION
    metric_space?[real, real_dist](fullset[real]);


decl_type: tcc
theory: weierstrass_approximation
library: analysis
signature: nil
location: 53 0 57 999
body:
  % Subtype TCC generated (at line 32, column 13) for  k
      % expected type  T_high[nat]
  Weierstrass_approx_combin1_TCC1: OBLIGATION
    FORALL (k: posnat, p: nat):
      k > p AND p <= 2 IMPLIES k >= 0 OR (EXISTS (j: nat): k <= j);


decl_type: tcc
theory: weierstrass_approximation
library: analysis
signature: nil
location: 59 0 64 999
body:
  % Subtype TCC generated (at line 32, column 54) for  p
      % expected type  {i_1: int | i /= 0 OR i_1 >= 0}
  Weierstrass_approx_combin1_TCC2: OBLIGATION
    FORALL (k: posnat, p: nat):
      k > p AND p <= 2 IMPLIES
       (FORALL (i: nat): NOT i > k IMPLIES i /= 0 OR p >= 0);


decl_type: tcc
theory: weierstrass_approximation
library: analysis
signature: nil
location: 66 0 70 999
body:
  % Subtype TCC generated (at line 32, column 60) for  i
      % expected type  {i: nat | i <= k}
  Weierstrass_approx_combin1_TCC3: OBLIGATION
    FORALL (k: posnat, p: nat):
      k > p AND p <= 2 IMPLIES (FORALL (i: nat): NOT i > k IMPLIES i <= k);


decl_type: formula
theory: cont_if_fun
library: analysis
signature: nil
location: 34 2 37 84
body:
    discont_pts_lem: LEMMA NOT discont_pts(P)(a) IMPLIES
                              EXISTS (delta: posreal): 
                                 (FORALL (x:T): abs(x-a) < delta IMPLIES P(x) = true) OR
                                 (FORALL (x:T): abs(x-a) < delta IMPLIES P(x) = false)


decl_type: formula
theory: cont_if_fun
library: analysis
signature: nil
location: 42 2 45 49
body:
    if_fun_cont: LEMMA continuous?(f1) AND continuous?(f2) AND
                       (FORALL (x:T): discont_pts(P)(x) IMPLIES f1(x) = f2(x))
                      IMPLIES
                       continuous?(if_fun(P,f1,f2))


decl_type: formula
theory: cont_if_fun
library: analysis
signature: nil
location: 47 2 50 34
body:
    discont_pts_simple: LEMMA continuous?(f1) AND continuous?(f2) AND
      P = (LAMBDA (t: T): f1(t) > 0 AND f2(t) > 0) AND
      discont_pts(P)(x) 
      IMPLIES f1(x) = 0 OR f2(x) = 0


decl_type: formula
theory: cont_if_fun
library: analysis
signature: nil
location: 52 2 56 38
body:
    prod_fun_lem: LEMMA continuous?(f1) AND continuous?(f2) AND
      P = (LAMBDA (t: T): f1(t) > 0 AND f2(t) > 0) AND
      discont_pts(P)(x)
      IMPLIES
         f1(x)*f2(x) = -abs(f1(x)*f2(x))


decl_type: function
theory: cont_if_fun
library: analysis
signature: [[[T -> bool], [T -> real], [T -> real]] -> [T -> real]]
location: 39 2 40 58
body:
    if_fun(P: [T-> bool], f1:[T -> real], f2:[T -> real]): [T -> real] = 
         (LAMBDA (x:T): IF P(x) THEN f1(x) ELSE f2(x) ENDIF)


decl_type: function
theory: linear_functions
library: analysis
signature: [[[T -> real], T, T] -> bool]
location: 24 3 25 77
body:
     linear_on?(f,a,b): bool = 
             (EXISTS m,k: (FORALL x: a <= x AND x <= b IMPLIES f(x) = m*x + k))


decl_type: formula
theory: continuous_linear
library: analysis
signature: nil
location: 44 3 49 38
body:
     piecewise: LEMMA   f1(b) = f2(b) AND a < b AND b < c AND
                        linear_on?(f1,a,b) AND
                        linear_on?(f2,b,c)
                     IMPLIES
              LET f = (LAMBDA x: IF x <= b THEN f1(x) ELSE f2(x) ENDIF) IN
                        continuous?(f,b)


decl_type: formula
theory: continuous_linear
library: analysis
signature: nil
location: 51 3 54 38
body:
     cont_piece: LEMMA (FORALL y: a < y AND y < b IMPLIES f1(y) = f2(y)) AND
                       a < x AND x < b AND
                       continuous?(f1,x) IMPLIES
                       continuous?(f2,x) 


decl_type: formula
theory: continuous_linear
library: analysis
signature: nil
location: 67 2 68 56
body:
    top_least: LEMMA (FORALL y: upper_bound?(y, fullset[T]) IMPLIES
                                              top(a) <= y)    


decl_type: formula
theory: continuous_linear
library: analysis
signature: nil
location: 73 2 74 60
body:
    bot_least: LEMMA (FORALL y: lower_bound?(y, fullset[T]) IMPLIES
                                                 y <= bot(a) )    


decl_type: formula
theory: continuous_linear
library: analysis
signature: nil
location: 76 2 81 50
body:
    cont_upto_lub: LEMMA T_pred(x) AND  a < x AND
                               bounded_above?(fullset[T]) AND 
                               T_pred(top(a)) AND
                               linear_on?(f, a, top(a))
                               IMPLIES
                                  continuous?(f, x )


decl_type: formula
theory: continuous_linear
library: analysis
signature: nil
location: 83 2 88 50
body:
    cont_downto_glb: LEMMA T_pred(x) AND  a > x AND
                               bounded_below?(fullset[T]) AND 
                               T_pred(bot(a)) AND
                               linear_on?(f, bot(a), a)
                               IMPLIES
                                  continuous?(f, x )


decl_type: formula
theory: continuous_linear
library: analysis
signature: nil
location: 117 3 118 48
body:
     cont_piecewise_linear: LEMMA piecewise_linear?(f) IMPLIES
                                    continuous?(f)                              


decl_type: function
theory: continuous_linear
library: analysis
signature: [[[T -> real], T, T] -> bool]
location: 32 3 33 59
body:
     continuous_in?(f,a,b): bool = (FORALL x: a < x AND x < b IMPLIES
                                         continuous?[T](f,x))


decl_type: function
theory: continuous_linear
library: analysis
signature: [[T, [T -> real]] -> bool]
location: 92 3 93 58
body:
     on_linear_part?(x,f): bool = EXISTS a,b: a < x AND x < b AND
                                           linear_on?(f,a,b)


decl_type: function
theory: continuous_linear
library: analysis
signature: [[T, [T -> real]] -> bool]
location: 96 3 98 63
body:
     on_linear_top?(x,f): bool = bounded_above?(fullset[T]) AND
                                    (EXISTS a:  a < x AND T_pred(top(a)) AND
                                          linear_on?(f,a,top(x)))


decl_type: function
theory: continuous_linear
library: analysis
signature: [[T, [T -> real]] -> bool]
location: 101 3 103 64
body:
     on_linear_bottom?(x,f): bool = bounded_below?(fullset[T]) AND
                                 (EXISTS a: a > x AND T_pred(bot(a)) AND
                                           linear_on?(f,bot(a),a))


decl_type: function
theory: continuous_linear
library: analysis
signature: [[T, [T -> real]] -> bool]
location: 105 3 109 55
body:
     on_junction?(b,f): bool =  (EXISTS a,c: a < b AND b < c AND
                                   (EXISTS (m1,k1,m2,k2: real):
               (FORALL y: a <= y AND y <= b IMPLIES f(y) = m1*y + k1) AND
               (FORALL y: b <= y AND y <= c IMPLIES f(y) = m2*y + k2) AND
                                    m1*b+k1 = m2*b + k2))


decl_type: function
theory: continuous_linear
library: analysis
signature: [[T -> real] -> bool]
location: 112 3 115 61
body:
     piecewise_linear?(f): bool = (FORALL x: on_linear_part?(x,f) OR
                                             on_linear_top?(x,f) OR
                                             on_linear_bottom?(x,f) OR
                                             on_junction?(x,f))        


decl_type: tcc
theory: continuous_linear
library: analysis
signature: nil
location: 127 0 130 999
body:
  % Assuming TCC generated (at line 19, column 35) for  linear_functions[T]
      % generated from assumption linear_functions.connected_domain
  linear_cont_TCC1: OBLIGATION
    FORALL (x, y: T), (z: real): x <= z AND z <= y IMPLIES T_pred(z);


decl_type: tcc
theory: continuous_linear
library: analysis
signature: nil
location: 132 0 134 999
body:
  % Assuming TCC generated (at line 19, column 35) for  linear_functions[T]
      % generated from assumption linear_functions.not_one_element
  linear_cont_TCC2: OBLIGATION FORALL (x: T): EXISTS (y: T): x /= y;


decl_type: tcc
theory: continuous_linear
library: analysis
signature: nil
location: 136 0 140 999
body:
  % Subtype TCC generated (at line 59, column 35) for
      % extend[real, T, bool, FALSE](fullset[T])
      % expected type  (nonempty?[real])
  top_TCC1: OBLIGATION
    FORALL (a: T): nonempty?[real](extend[real, T, bool, FALSE](fullset[T]));


decl_type: tcc
theory: continuous_linear
library: analysis
signature: nil
location: 142 0 147 999
body:
  % Subtype TCC generated (at line 98, column 55) for  top(x)
      % expected type  T
  on_linear_top?_TCC1: OBLIGATION
    FORALL (x: T):
      bounded_above?(extend[real, T, bool, FALSE](fullset[T])) IMPLIES
       (FORALL (a): T_pred(top(a)) AND a < x IMPLIES T_pred(top(x)));


decl_type: formula
theory: interm_value_thm
library: analysis
signature: nil
location: 11 2 14 75
body:
    interm_value1 : LEMMA a < b IMPLIES
                                FORALL (f: [closed_interval(a,b) -> real]):
                                continuous?(f) AND f(a) < x AND x < f(b)
                                  IMPLIES EXISTS (c: closed_interval(a,b)): f(c) = x


decl_type: formula
theory: interm_value_thm
library: analysis
signature: nil
location: 16 2 19 75
body:
    interm_value2 : LEMMA a < b IMPLIES
                                FORALL (f: [closed_interval(a,b) -> real]):
                                continuous?(f) AND f(a) <= x AND x <= f(b)
                                  IMPLIES EXISTS (c: closed_interval(a,b)): f(c) = x


decl_type: formula
theory: interm_value_thm
library: analysis
signature: nil
location: 21 2 24 75
body:
    interm_value3 : LEMMA a < b IMPLIES
                                FORALL (f: [closed_interval(a,b) -> real]):
                                continuous?(f) AND f(b) < x AND x < f(a)
                                  IMPLIES EXISTS (c: closed_interval(a,b)): f(c) = x


decl_type: formula
theory: interm_value_thm
library: analysis
signature: nil
location: 26 2 29 75
body:
    interm_value4 : LEMMA a < b IMPLIES
                                FORALL (f: [closed_interval(a,b) -> real]):
                                continuous?(f) AND f(b) <= x AND x <= f(a)
                                  IMPLIES EXISTS (c: closed_interval(a,b)): f(c) = x


decl_type: formula
theory: interm_value_thm
library: analysis
signature: nil
location: 31 2 35 53
body:
    interm_value5 : LEMMA a < b IMPLIES
                                FORALL (f: [closed_interval(a,b) -> real],p,q:closed_interval(a,b)):
                                continuous?(f) AND f(p) <= x AND x <= f(q)
                                  IMPLIES EXISTS (c: closed_interval(a,b)): 
                                  ((p<=c AND c<=q) OR (q<=c AND c<=p)) AND f(c) = x


decl_type: formula
theory: interm_value_thm
library: analysis
signature: nil
location: 41 2 42 74
body:
    cont_intv : LEMMA a < b AND continuous?(f) 
                IMPLIES continuous?(LAMBDA (x: closed_interval(a, b)): f(x))


decl_type: formula
theory: interm_value_thm
library: analysis
signature: nil
location: 45 2 46 74
body:
    cont_intv1: LEMMA a < b AND continuous?[closed_interval[real](a, b)](f) 
                IMPLIES continuous?(LAMBDA (x: closed_interval(a, b)): f(x))


decl_type: formula
theory: interm_value_thm
library: analysis
signature: nil
location: 51 2 53 75
body:
    interm_val1 : LEMMA a < b IMPLIES
                                continuous?[closed_interval(a,b)](f) AND f(a) < x AND x < f(b)
                                  IMPLIES EXISTS (c: closed_interval(a,b)): f(c) = x


decl_type: formula
theory: interm_value_thm
library: analysis
signature: nil
location: 55 2 58 75
body:
    interm_val2 : LEMMA a < b IMPLIES
                                FORALL (f: [real -> real]):
                                continuous?[closed_interval(a,b)](f) AND f(a) <= x AND x <= f(b)
                                  IMPLIES EXISTS (c: closed_interval(a,b)): f(c) = x


decl_type: formula
theory: interm_value_thm
library: analysis
signature: nil
location: 60 2 63 75
body:
    interm_val3 : LEMMA a < b IMPLIES
                                FORALL (f: [real -> real]):
                                continuous?[closed_interval(a,b)](f) AND f(b) < x AND x < f(a)
                                  IMPLIES EXISTS (c: closed_interval(a,b)): f(c) = x


decl_type: formula
theory: interm_value_thm
library: analysis
signature: nil
location: 65 2 68 75
body:
    interm_val4 : LEMMA a < b IMPLIES
                                FORALL (f: [real -> real]):
                                continuous?[closed_interval(a,b)](f) AND f(b) <= x AND x <= f(a)
                                  IMPLIES EXISTS (c: closed_interval(a,b)): f(c) = x


decl_type: formula
theory: interm_value_thm
library: analysis
signature: nil
location: 74 2 79 64
body:
    zeros_interm: LEMMA  continuous?(f)
                       AND f(xl) = 0 AND f(xu) = 0 AND
                      (FORALL (x: open_interval(xl,xu)): f(x) /= 0)
                    IMPLIES
                      (FORALL (x: open_interval(xl,xu)): f(x) > 0) OR
                      (FORALL (x: open_interval(xl,xu)): f(x) < 0)


decl_type: formula
theory: interm_value_thm
library: analysis
signature: nil
location: 87 2 91 39
body:
    IntermediateValue : THEOREM
      FORALL (f:[real->real]):
      continuous?(f) AND
      (FORALL (c:(ab)) : f(c) /= 0) IMPLIES 
      (FORALL (x,y:(ab)) : f(x)*f(y) > 0)       


decl_type: tcc
theory: interm_value_thm
library: analysis
signature: nil
location: 98 0 104 999
body:
  % Subtype TCC generated (at line 13, column 51) for  a
      % expected type  closed_interval[real](a, b)
  interm_value1_TCC1: OBLIGATION
    FORALL (a, b: real):
      a < b IMPLIES
       (FORALL (f: [closed_interval[real](a, b) -> real]):
          continuous?(f) IMPLIES a <= a AND a <= b);


decl_type: tcc
theory: interm_value_thm
library: analysis
signature: nil
location: 106 0 112 999
body:
  % Subtype TCC generated (at line 13, column 68) for  b
      % expected type  closed_interval[real](a, b)
  interm_value1_TCC2: OBLIGATION
    FORALL (a, b, x: real):
      a < b IMPLIES
       (FORALL (f: [closed_interval[real](a, b) -> real]):
          f(a) < x AND continuous?(f) IMPLIES a <= b AND b <= b);


decl_type: tcc
theory: interm_value_thm
library: analysis
signature: nil
location: 114 0 120 999
body:
  % Subtype TCC generated (at line 18, column 70) for  b
      % expected type  closed_interval[real](a, b)
  interm_value2_TCC1: OBLIGATION
    FORALL (a, b, x: real):
      a < b IMPLIES
       (FORALL (f: [closed_interval[real](a, b) -> real]):
          f(a) <= x AND continuous?(f) IMPLIES a <= b AND b <= b);


decl_type: tcc
theory: interm_value_thm
library: analysis
signature: nil
location: 122 0 128 999
body:
  % Subtype TCC generated (at line 23, column 51) for  b
      % expected type  closed_interval[real](a, b)
  interm_value3_TCC1: OBLIGATION
    FORALL (a, b: real):
      a < b IMPLIES
       (FORALL (f: [closed_interval[real](a, b) -> real]):
          continuous?(f) IMPLIES a <= b AND b <= b);


decl_type: tcc
theory: restriction_continuous2
library: analysis
signature: nil
location: 33 0 35 999
body:
  % Subtype TCC generated (at line 21, column 52) for  u
      % expected type  T2
  restrict2_TCC1: OBLIGATION FORALL (u: T1): T2_pred(u);


decl_type: function
theory: relation_extension
library: sets_aux
signature:
  [[equivalence[[T, U]], [[T, U] -> T], [T, U], [T, U]] ->
  set[T]]

location: 29 1 30 62
body:
   extended_equiv_classT(R, p_r1, m, n) : set[T] = 
     { (t : T) | t= p_r1(m) AND  extended_equiv_class(R)(n)(m) }


decl_type: function
theory: relation_extension
library: sets_aux
signature:
  [[equivalence[[T, U]], [[T, U] -> U], [T, U], [T, U]] ->
  set[U]]

location: 32 1 33 62
body:
   extended_equiv_classU(R, p_r2, m, n) : set[U] = 
     { (u : U) | u= p_r2(m) AND  extended_equiv_class(R)(n)(m) }


decl_type: function
theory: relation_extension
library: sets_aux
signature: [[equivalence[T], equivalence[U]] -> set[[[T, U], [T, U]]]]
location: 38 1 39 49
body:
   rel_extension(le_T, le_U) : set[[[T, U], [T, U]]] =
     { (m, n) | le_T(m`1, n`1) AND le_U(m`2, n`2) }


decl_type: tcc
theory: relation_extension
library: sets_aux
signature: nil
location: 53 0 57 999
body:
  % Judgement subtype TCC generated (at line 42, column 1) for
      % rel_extension(le_T, le_U)
      % expected type  equivalence[[T, U]]
  rel_extension_is_equivalence: OBLIGATION
    FORALL (le_T, le_U): equivalence?[[T, U]](rel_extension(le_T, le_U));


decl_type: formula
theory: relation_inverse_image
library: sets_aux
signature: nil
location: 30 2 31 48
body:
    inverse_image_of_equivalence: LEMMA equivalence?[U](R) 
      IMPLIES equivalence?[T](image_inverse(R, f))


decl_type: formula
theory: relation_inverse_image
library: sets_aux
signature: nil
location: 40 2 42 68
body:
    inv_img_surj_impl_codom_eq: LEMMA  
      FORALL (f:(surjective?[T, U])):
        equivalence?[T](image_inverse(R,f)) IMPLIES equivalence?[U](R)


decl_type: formula
theory: relation_inverse_image
library: sets_aux
signature: nil
location: 44 2 46 69
body:
    right_inv_inv_finv_image_impl_codom_eq: LEMMA  
      right_inverse?(inverse(f), f) IMPLIES
        equivalence?[T](image_inverse(R, f)) IMPLIES equivalence?[U](R)


decl_type: formula
theory: relation_inverse_image
library: sets_aux
signature: nil
location: 48 2 50 63
body:
    surjective_eqv_image_inv_rel_codomain: THEOREM 
      FORALL (f:(surjective?[T, U])):
        equivalence?[T](image_inverse(R)(f)) = equivalence?[U](R)


decl_type: formula
theory: relation_inverse_image
library: sets_aux
signature: nil
location: 52 2 54 64
body:
    right_inv_inv_finv_image_eq_codom_eq: LEMMA  
      right_inverse?(inverse(f), f) IMPLIES
        equivalence?[T](image_inverse(R, f)) =  equivalence?[U](R)


decl_type: formula
theory: relation_inverse_extension
library: sets_aux
signature: nil
location: 42 1 45 48
body:
   rel_extension_IFF_rel_ext : LEMMA 
     LET GFm=(g(m`2),f(m`1)), GFn=(g(n`2),f(n`1)) IN
       rel_extension(re_T, re_U)(GFm, GFn) = 
         rel_inv_extension(re_T, re_U, f, g)(n, m)


decl_type: judgement
theory: relation_inverse_extension
library: sets_aux
signature: equivalence[[T, U]]
location: 36 1 37 67
body:
   rel_inv_extension_is_equivalence: JUDGEMENT 
     rel_inv_extension(re_T, re_U, f, g) HAS_TYPE equivalence[[T, U]]


decl_type: judgement
theory: relation_inverse_extension
library: sets_aux
signature: equivalence[[T, U]]
location: 54 1 55 68
body:
   rel_inv_extension2_is_equivalence: JUDGEMENT 
     rel_inv_extension2(re_T, re_U, f, g) HAS_TYPE equivalence[[T, U]]


decl_type: function
theory: relation_inverse_extension
library: sets_aux
signature:
  [[equivalence[T], equivalence[U], [T -> U], [U -> T]] ->
  set[[[T, U], [T, U]]]]

location: 33 1 34 63
body:
   rel_inv_extension(re_T, re_U, f, g) : set[[[T, U], [T, U]]] =
     { (m, n) | l_T(re_U, f)(n`1,m`1) AND l_U(re_T, g)(n`2,m`2) }


decl_type: function
theory: relation_inverse_extension
library: sets_aux
signature:
  [[equivalence[T], equivalence[U], [T -> U], [U -> T]] ->
  set[[[T, U], [T, U]]]]

location: 49 1 52 4
body:
   rel_inv_extension2(re_T, re_U, f, g):set[[[T, U], [T, U]]] = 
     { (n, m) | LET GFm=(g(m`2),f(m`1)), GFn=(g(n`2),f(n`1)) IN
        rel_extension(re_T, re_U)(GFm, GFn) 
     }


decl_type: tcc
theory: relation_inverse_extension
library: sets_aux
signature: nil
location: 62 0 65 999
body:
  % Judgement subtype TCC generated (at line 24, column 37) for  l_T(re_U, f)
      % expected type  equivalence[T]
  le_U_induces_equivalence: OBLIGATION
    FORALL (f, re_U): equivalence?[T](l_T(re_U, f));


decl_type: tcc
theory: relation_inverse_extension
library: sets_aux
signature: nil
location: 67 0 70 999
body:
  % Judgement subtype TCC generated (at line 28, column 37) for  l_U(re_T, g)
      % expected type  equivalence[U]
  le_T_induces_equivalence: OBLIGATION
    FORALL (g, re_T): equivalence?[U](l_U(re_T, g));


decl_type: tcc
theory: relation_inverse_extension
library: sets_aux
signature: nil
location: 72 0 77 999
body:
  % Judgement subtype TCC generated (at line 37, column 3) for
      % rel_inv_extension(re_T, re_U, f, g)
      % expected type  equivalence[[T, U]]
  rel_inv_extension_is_equivalence: OBLIGATION
    FORALL (f, g, re_T, re_U):
      equivalence?[[T, U]](rel_inv_extension(re_T, re_U, f, g));


decl_type: tcc
theory: relation_inverse_extension
library: sets_aux
signature: nil
location: 79 0 84 999
body:
  % Judgement subtype TCC generated (at line 55, column 3) for
      % rel_inv_extension2(re_T, re_U, f, g)
      % expected type  equivalence[[T, U]]
  rel_inv_extension2_is_equivalence: OBLIGATION
    FORALL (f, g, re_T, re_U):
      equivalence?[[T, U]](rel_inv_extension2(re_T, re_U, f, g));


decl_type: formula
theory: rr_rel
library: sets_aux
signature: nil
location: 59 1 61 61
body:
   RR_functional_conditional_equal_RR2: LEMMA
      LET GFn=(g(n`2),f(n`1)) IN 
        RR(le_T, le_U, f, g)(GFn) IFF  RR2(le_T, le_U, f, g)(n)


decl_type: function
theory: rr_rel
library: sets_aux
signature:
  [[equivalence[T], equivalence[U], [T -> U], [U -> T]] ->
  set[[T, U]]]

location: 26 1 33 4
body:
   RR(le_T, le_U, f, g):set[[T,U]] = 
     { (n) | LET Fn = (n`1,f(n`1)), 
                   Gn  = (g(n`2), n`2), 
                     GFn  = (g(n`2), f(n`1))  IN 
                       rel_extension(le_T, le_U)(Fn, Gn)     OR
                         rel_extension(le_T, le_U)(GFn, Fn)  OR
                           rel_extension(le_T, le_U)(GFn, Gn)  
     }


decl_type: function
theory: rr_rel
library: sets_aux
signature:
  [[equivalence[T], equivalence[U], [T -> U], [U -> T]] ->
  set[[T, U]]]

location: 41 0 48 4
body:
  RR2(le_T, le_U, f, g):set[[T,U]] = 
     { (n) | LET Fn = (n`1,f(n`1)), 
                   Gn  = (g(n`2), n`2), 
                     GFn  = (g(n`2), f(n`1))  IN 
                       rel_inv_extension2(le_T, le_U, f, g)(Fn, Gn)     OR
                         rel_inv_extension2(le_T, le_U, f, g)(GFn, Fn)  OR
                           rel_inv_extension2(le_T, le_U, f, g)(GFn, Gn)  
     }


decl_type: tcc
theory: finite_to_infinite_finite_equival_infinite_equival_classes
library: sets_aux
signature: nil
location: -188 0 -187 999
body:
  % Existence TCC generated (at line 200, column 2) for  T11: TYPE+ = below(2)
  T11_TCC1: OBLIGATION EXISTS (x: {s: nat | s < 2}): TRUE;


decl_type: tcc
theory: finite_to_infinite_finite_equival_infinite_equival_classes
library: sets_aux
signature: nil
location: -185 0 -183 999
body:
  % Subtype TCC generated (at line 212, column 40) for  equivT
      % expected type  equivalence[T11]
  relations_equality_TCC1: OBLIGATION equivalence?[T11](equivT);


decl_type: tcc
theory: finite_to_infinite_finite_equival_infinite_equival_classes
library: sets_aux
signature: nil
location: -181 0 -179 999
body:
  % Subtype TCC generated (at line 212, column 48) for  equivU
      % expected type  equivalence[U11]
  relations_equality_TCC2: OBLIGATION equivalence?[U11](equivU);


decl_type: tcc
theory: infinite_to_infinite_infinite_equival_finite_equival_classes
library: sets_aux
signature: nil
location: -164 0 -162 999
body:
  % Subtype TCC generated (at line 188, column 40) for  equivT
      % expected type  equivalence[T10]
  relations_equality_TCC1: OBLIGATION equivalence?[T10](equivT);


decl_type: tcc
theory: infinite_to_infinite_infinite_equival_finite_equival_classes
library: sets_aux
signature: nil
location: -160 0 -158 999
body:
  % Subtype TCC generated (at line 188, column 48) for  equivU
      % expected type  equivalence[U10]
  relations_equality_TCC2: OBLIGATION equivalence?[U10](equivU);


decl_type: tcc
theory: infinite_to_infinite_infinite_equival_infinite_equival_classes
library: sets_aux
signature: nil
location: -141 0 -139 999
body:
  % Subtype TCC generated (at line 161, column 35) for  u - 1
      % expected type  T9
  e9_TCC1: OBLIGATION FORALL (u: U9): u - 1 >= 0;


decl_type: tcc
theory: infinite_to_infinite_infinite_equival_infinite_equival_classes
library: sets_aux
signature: nil
location: -137 0 -135 999
body:
  % Subtype TCC generated (at line 164, column 39) for  equivT
      % expected type  equivalence[T9]
  relations_equality_TCC1: OBLIGATION equivalence?[T9](equivT);


decl_type: tcc
theory: infinite_to_infinite_infinite_equival_infinite_equival_classes
library: sets_aux
signature: nil
location: -133 0 -131 999
body:
  % Subtype TCC generated (at line 164, column 47) for  equivU
      % expected type  equivalence[U9]
  relations_equality_TCC2: OBLIGATION equivalence?[U9](equivU);


decl_type: tcc
theory: infinite_to_finite_infinite_equival_finite_equival_classes
library: sets_aux
signature: nil
location: -117 0 -116 999
body:
  % Existence TCC generated (at line 130, column 2) for  U8: TYPE+ = below(2)
  U8_TCC1: OBLIGATION EXISTS (x: {s: nat | s < 2}): TRUE;


decl_type: tcc
theory: infinite_to_finite_infinite_equival_finite_equival_classes
library: sets_aux
signature: nil
location: -114 0 -112 999
body:
  % Subtype TCC generated (at line 141, column 39) for  equivT
      % expected type  equivalence[T8]
  relations_equality_TCC1: OBLIGATION equivalence?[T8](equivT);


decl_type: tcc
theory: infinite_to_finite_infinite_equival_finite_equival_classes
library: sets_aux
signature: nil
location: -110 0 -108 999
body:
  % Subtype TCC generated (at line 141, column 47) for  equivU
      % expected type  equivalence[U8]
  relations_equality_TCC2: OBLIGATION equivalence?[U8](equivU);


decl_type: formula
theory: infinite_to_finite_finite_equival_finite_equival_classes
library: sets_aux
signature: nil
location: -89 0 -87 999
body:
  U7_induction: AXIOM
    FORALL (p: [U7 -> boolean]):
      p(0) AND p(1) IMPLIES (FORALL (U7_var: U7): p(U7_var));


decl_type: tcc
theory: infinite_to_finite_finite_equival_finite_equival_classes
library: sets_aux
signature: nil
location: -65 0 -63 999
body:
  % Subtype TCC generated (at line 117, column 39) for  equivT
      % expected type  equivalence[T7]
  relations_equality_TCC1: OBLIGATION equivalence?[T7](equivT);


decl_type: tcc
theory: infinite_to_finite_finite_equival_finite_equival_classes
library: sets_aux
signature: nil
location: -61 0 -59 999
body:
  % Subtype TCC generated (at line 117, column 47) for  equivU
      % expected type  equivalence[U7]
  relations_equality_TCC2: OBLIGATION equivalence?[U7](equivU);


decl_type: tcc
theory: finite_to_infinite
library: sets_aux
signature: nil
location: -70 0 -68 999
body:
  % Subtype TCC generated (at line 93, column 39) for  equivT
      % expected type  equivalence[T6]
  relations_equality_TCC1: OBLIGATION equivalence?[T6](equivT);


decl_type: tcc
theory: finite_to_infinite
library: sets_aux
signature: nil
location: -66 0 -64 999
body:
  % Subtype TCC generated (at line 93, column 47) for  equivU
      % expected type  equivalence[U6]
  relations_equality_TCC2: OBLIGATION equivalence?[U6](equivU);


decl_type: tcc
theory: infinite_to_infinite_trivial
library: sets_aux
signature: nil
location: -47 0 -45 999
body:
  % Subtype TCC generated (at line 70, column 39) for  equivT
      % expected type  equivalence[T4]
  relations_equality_TCC1: OBLIGATION equivalence?[T4](equivT);


decl_type: tcc
theory: infinite_to_infinite_trivial
library: sets_aux
signature: nil
location: -43 0 -41 999
body:
  % Subtype TCC generated (at line 70, column 47) for  equivU
      % expected type  equivalence[U4]
  relations_equality_TCC2: OBLIGATION equivalence?[U4](equivU);


decl_type: tcc
theory: finite_nats_trivial
library: sets_aux
signature: nil
location: -22 0 -21 999
body:
  % Existence TCC generated (at line 34, column 2) for  T1: TYPE+ = below(3)
  T1_TCC1: OBLIGATION EXISTS (x: {s: nat | s < 3}): TRUE;


decl_type: tcc
theory: finite_nats_trivial
library: sets_aux
signature: nil
location: -19 0 -18 999
body:
  % Existence TCC generated (at line 35, column 2) for  U1: TYPE+ = below(6)
  U1_TCC1: OBLIGATION EXISTS (x: {s: nat | s < 6}): TRUE;


decl_type: tcc
theory: finite_nats_trivial
library: sets_aux
signature: nil
location: -16 0 -14 999
body:
  % Subtype TCC generated (at line 42, column 35) for  2 * t
      % expected type  U1
  g1_TCC1: OBLIGATION FORALL (t: T1): 2 * t < 6;


decl_type: tcc
theory: finite_nats_trivial
library: sets_aux
signature: nil
location: -12 0 -10 999
body:
  % Subtype TCC generated (at line 43, column 35) for  div(u, 2)
      % expected type  T1
  e1_TCC1: OBLIGATION FORALL (u: U1): div(u, 2) < 3;


decl_type: tcc
theory: finite_nats_trivial
library: sets_aux
signature: nil
location: -8 0 -6 999
body:
  % Subtype TCC generated (at line 47, column 32) for  ==
      % expected type  equivalence[T1]
  relations_equality_TCC1: OBLIGATION equivalence?[T1](==);


decl_type: tcc
theory: finite_nats_trivial
library: sets_aux
signature: nil
location: -4 0 -2 999
body:
  % Subtype TCC generated (at line 47, column 35) for  ==
      % expected type  equivalence[U1]
  relations_equality_TCC2: OBLIGATION equivalence?[U1](==);


decl_type: formula
theory: singleton_example
library: sets_aux
signature: nil
location: 9 0 11 999
body:
  T0_induction: AXIOM
    FORALL (p: [T0 -> boolean]):
      p(t) IMPLIES (FORALL (T0_var: T0): p(T0_var));


decl_type: formula
theory: singleton_example
library: sets_aux
signature: nil
location: 19 0 21 999
body:
  U0_induction: AXIOM
    FORALL (p: [U0 -> boolean]):
      p(u) IMPLIES (FORALL (U0_var: U0): p(U0_var));


decl_type: tcc
theory: singleton_example
library: sets_aux
signature: nil
location: 53 0 55 999
body:
  % Subtype TCC generated (at line 22, column 31) for  ==
      % expected type  equivalence[T0]
  relations_equality_TCC1: OBLIGATION equivalence?[T0](==);


decl_type: tcc
theory: singleton_example
library: sets_aux
signature: nil
location: 57 0 59 999
body:
  % Subtype TCC generated (at line 22, column 34) for  ==
      % expected type  equivalence[U0]
  relations_equality_TCC2: OBLIGATION equivalence?[U0](==);


decl_type: formula
theory: relation_implication
library: sets_aux
signature: nil
location: 16 2 17 50
body:
    rel_impl_extensionality: LEMMA (R1 |- R2 ) IMPLIES 
       FORALL(t: T)(u: U): R1(t, u) IMPLIES R2(t, u) 


decl_type: tcc
theory: relation_implication
library: sets_aux
signature: nil
location: 37 0 39 999
body:
  % Judgement subtype TCC generated (at line 26, column 12) for  |-
      % expected type  (partial_order?[pred[[T, U]]])
  turnstile_TCC1: OBLIGATION partial_order?[pred[[T, U]]](|-);


decl_type: tcc
theory: relation_implication
library: sets_aux
signature: nil
location: 41 0 43 999
body:
  % Judgement subtype TCC generated (at line 28, column 12) for  |=
      % expected type  (equivalence?[pred[[T, U]]])
  models_TCC1: OBLIGATION equivalence?[pred[[T, U]]](|=);


decl_type: formula
theory: cantor_bernstein_schroeder
library: sets_aux
signature: nil
location: 33 2 39 44
body:
    Afuneq: LEMMA FORALL (i,j:nat,a1,a2:A):
      injective?(f) AND injective?(g) AND
      (Afun(f,g)(a1)(i)`1 = Afun(f,g)(a2)(j)`1 OR
       Afun(f,g)(a1)(i)`2 = Afun(f,g)(a2)(j)`2)
      IMPLIES
      FORALL (k:nat): k<=i AND k<=j IMPLIES
       Afun(f,g)(a1)(i-k) = Afun(f,g)(a2)(j-k)


decl_type: formula
theory: cantor_bernstein_schroeder
library: sets_aux
signature: nil
location: 56 2 62 42
body:
    Bfuneq: LEMMA FORALL (i,j:nat,b:B):
      injective?(f) AND injective?(g) AND
      (Bfun(f,g)(b)(i)`1 = Bfun(f,g)(b)(j)`1 OR
       Bfun(f,g)(b)(i)`2 = Bfun(f,g)(b)(j)`2)
      IMPLIES
      FORALL (k:nat): k<i AND k<j IMPLIES
       Bfun(f,g)(b)(i-k) = Bfun(f,g)(b)(j-k)


decl_type: formula
theory: cantor_bernstein_schroeder
library: sets_aux
signature: nil
location: 70 2 76 42
body:
    ABfuneq: LEMMA FORALL (i,j:nat,b:B,a:A):
      injective?(f) AND injective?(g) AND
      (Bfun(f,g)(b)(i)`1 = Afun(f,g)(a)(j)`1 OR
       Bfun(f,g)(b)(i)`2 = Afun(f,g)(a)(j)`2)
      IMPLIES
      FORALL (k:nat): k<i AND k<=j IMPLIES
       Bfun(f,g)(b)(i-k) = Afun(f,g)(a)(j-k)


decl_type: formula
theory: cantor_bernstein_schroeder
library: sets_aux
signature: nil
location: 99 2 102 43
body:
    ABrel_Arel_equiv: LEMMA FORALL (b:B,a,aa:A):
      (NOT preim_B?(f)(b)) AND ABrel(f,g)(a)(b) AND
      Arel(f,g)(a)(aa) AND injective?(f) AND 
      injective?(g) IMPLIES ABrel(f,g)(aa)(b)


decl_type: formula
theory: cantor_bernstein_schroeder
library: sets_aux
signature: nil
location: 104 2 107 43
body:
    ABrel_Brel_equiv: LEMMA FORALL (b,bb:B,a:A):
      (NOT preim_B?(f)(b)) AND ABrel(f,g)(a)(b) AND
      Brel(f,g)(b)(bb) AND injective?(f) AND 
      injective?(g) IMPLIES BArel(f,g)(bb)(a)


decl_type: formula
theory: cantor_bernstein_schroeder
library: sets_aux
signature: nil
location: 109 2 111 49
body:
    Brel_Arel: LEMMA FORALL (b,bb:B):
      injective?(g) IMPLIES
      (Brel(f,g)(b)(bb) IFF Arel(f,g)(g(b))(g(bb)))


decl_type: formula
theory: cantor_bernstein_schroeder
library: sets_aux
signature: nil
location: 113 2 115 47
body:
    Arel_Brel: LEMMA FORALL (a,aa:A):
      injective?(f) IMPLIES
      (Arel(f,g)(a)(aa) = Brel(f,g)(f(a))(f(aa)))


decl_type: formula
theory: cantor_bernstein_schroeder
library: sets_aux
signature: nil
location: 117 2 119 45
body:
    ABrel_Brel: LEMMA FORALL (b:B,a:A):
      injective?(f) AND injective?(g) IMPLIES
      (ABrel(f,g)(a)(b) IFF Brel(f,g)(f(a))(b))


decl_type: formula
theory: cantor_bernstein_schroeder
library: sets_aux
signature: nil
location: 123 2 126 21
body:
    Afununique: LEMMA FORALL (a1,a2:A,i,j:nat):
      injective?(f) AND injective?(g) AND
      Afun(f,g)(a1)(i) = Afun(f,g)(a2)(j) IMPLIES
      Arel(f,g)(a1)(a2)


decl_type: formula
theory: cantor_bernstein_schroeder
library: sets_aux
signature: nil
location: 132 2 136 31
body:
    aginj: LEMMA FORALL (a:A):
             injective?(g) AND injective?(f)
             IMPLIES bijective?(ag_fun(f,g)(a))
                     OR
                     bijective?(af_fun(f,g)(a))


decl_type: formula
theory: cantor_bernstein_schroeder
library: sets_aux
signature: nil
location: 140 2 141 41
body:
    Arel_disjoint: LEMMA FORALL (a1,a2,a:A): Arel(f,g)(a1)(a) AND Arel(f,g)(a2)(a) AND injective?(g) AND injective?(f)
      IMPLIES Arel(f,g)(a1) = Arel(f,g)(a2)


decl_type: formula
theory: cantor_bernstein_schroeder
library: sets_aux
signature: nil
location: 143 2 144 32
body:
    Brel_disjoint: LEMMA FORALL (b1,b2,b:B): Brel(f,g)(b1)(b) AND Brel(f,g)(b2)(b) AND injective?(g) AND injective?(f) IMPLIES
     Brel(f,g)(b1) = Brel(f,g)(b2)


decl_type: formula
theory: cantor_bernstein_schroeder
library: sets_aux
signature: nil
location: 148 2 149 43
body:
    ABrel_disjoint: LEMMA FORALL (a1,a2:A,b:B): ABrel(f,g)(a1)(b) AND ABrel(f,g)(a2)(b) AND injective?(g) AND injective?(f)
      IMPLIES ABrel(f,g)(a1) = ABrel(f,g)(a2)


decl_type: formula
theory: cantor_bernstein_schroeder
library: sets_aux
signature: nil
location: 151 2 154 33
body:
    Cantor_Bernstein_Schroeder: LEMMA
      injective?(f) AND
      injective?(g) IMPLIES
      EXISTS (hab): bijective?(hab)


decl_type: function
theory: cantor_bernstein_schroeder
library: sets_aux
signature: [[[A -> B], [B -> A]] -> [A -> [nat -> [A, B]]]]
location: 18 2 22 19
body:
    Afun(f,g)(a:A)(i:nat): RECURSIVE [A,B] =
      IF i = 0 THEN (a,f(a))
      ELSE LET bo = Afun(f,g)(a)(i-1)`2 IN
           (g(bo),f(g(bo)))
      ENDIF MEASURE i


decl_type: function
theory: cantor_bernstein_schroeder
library: sets_aux
signature: [[[A -> B], [B -> A]] -> [B -> [nat -> [A, B]]]]
location: 41 2 48 19
body:
    Bfun(f,g)(b:B)(i:nat): RECURSIVE [A,B] =
      IF i = 0 THEN 
        IF (EXISTS (a:A): f(a) = b)
        THEN LET a = choose({aa:A|f(aa)=b}) IN (a,b)
        ELSE (g(b),b) ENDIF
      ELSE LET bo = Bfun(f,g)(b)(i-1)`2 IN
           (g(bo),f(g(bo)))
      ENDIF MEASURE i


decl_type: function
theory: cantor_bernstein_schroeder
library: sets_aux
signature: [[[A -> B], [B -> A]] -> [A -> [B -> bool]]]
location: 78 2 81 43
body:
    ABrel(f,g)(a:A)(b:B): bool = 
      (EXISTS (i:nat): b = Afun(f,g)(a)(i)`2)
      OR
      (EXISTS (i:nat): a = Bfun(f,g)(b)(i)`1)


decl_type: function
theory: cantor_bernstein_schroeder
library: sets_aux
signature: [[[A -> B], [B -> A]] -> [A -> [A -> bool]]]
location: 85 2 88 45
body:
    Arel(f,g)(a1:A)(a2:A): bool =
      (EXISTS (i:nat): a1 = Afun(f,g)(a2)(i)`1)
      OR
      (EXISTS (i:nat): a2 = Afun(f,g)(a1)(i)`1)


decl_type: function
theory: cantor_bernstein_schroeder
library: sets_aux
signature: [[[A -> B], [B -> A]] -> [B -> [B -> bool]]]
location: 90 2 93 45
body:
    Brel(f,g)(b1:B)(b2:B): bool =
      (EXISTS (i:nat): b1 = Bfun(f,g)(b2)(i)`2)
      OR
      (EXISTS (i:nat): b2 = Bfun(f,g)(b1)(i)`2)


decl_type: tcc
theory: cantor_bernstein_schroeder
library: sets_aux
signature: nil
location: 161 0 165 999
body:
  % Subtype TCC generated (at line 20, column 31) for  i - 1
      % expected type  nat
  Afun_TCC1: OBLIGATION
    FORALL (f: [A -> B], g: [B -> A], a: A, i: nat):
      NOT i = 0 IMPLIES i - 1 >= 0;


decl_type: tcc
theory: cantor_bernstein_schroeder
library: sets_aux
signature: nil
location: 167 0 171 999
body:
  % Termination TCC generated (at line 20, column 18) for
      % Afun(f, g)(a)(i - 1)
  Afun_TCC2: OBLIGATION
    FORALL (f: [A -> B], g: [B -> A], a: A, i: nat):
      NOT i = 0 IMPLIES i - 1 < i;


decl_type: tcc
theory: cantor_bernstein_schroeder
library: sets_aux
signature: nil
location: 173 0 181 999
body:
  % Subtype TCC generated (at line 39, column 19) for  i - k
      % expected type  nat
  Afuneq_TCC1: OBLIGATION
    FORALL (f: [A -> B], g: [B -> A], i, j: nat, a1, a2: A):
      injective?(f) AND
       injective?(g) AND
        (Afun(f, g)(a1)(i)`1 = Afun(f, g)(a2)(j)`1 OR
          Afun(f, g)(a1)(i)`2 = Afun(f, g)(a2)(j)`2)
       IMPLIES (FORALL (k: nat): k <= i AND k <= j IMPLIES i - k >= 0);


decl_type: tcc
theory: cantor_bernstein_schroeder
library: sets_aux
signature: nil
location: 183 0 191 999
body:
  % Subtype TCC generated (at line 39, column 40) for  j - k
      % expected type  nat
  Afuneq_TCC2: OBLIGATION
    FORALL (f: [A -> B], g: [B -> A], i, j: nat, a1, a2: A):
      injective?(f) AND
       injective?(g) AND
        (Afun(f, g)(a1)(i)`1 = Afun(f, g)(a2)(j)`1 OR
          Afun(f, g)(a1)(i)`2 = Afun(f, g)(a2)(j)`2)
       IMPLIES (FORALL (k: nat): k <= i AND k <= j IMPLIES j - k >= 0);


decl_type: tcc
theory: cantor_bernstein_schroeder
library: sets_aux
signature: nil
location: 193 0 198 999
body:
  % Subtype TCC generated (at line 44, column 26) for  {aa: A | f(aa) = b}
      % expected type  p: (nonempty?[A])
  Bfun_TCC1: OBLIGATION
    FORALL (f: [A -> B], g: [B -> A], b: B, i: nat):
      (EXISTS (a: A): f(a) = b) AND i = 0 IMPLIES
       nonempty?[A]({aa: A | f(aa) = b});


decl_type: tcc
theory: cantor_bernstein_schroeder
library: sets_aux
signature: nil
location: 200 0 204 999
body:
  % Subtype TCC generated (at line 46, column 31) for  i - 1
      % expected type  nat
  Bfun_TCC2: OBLIGATION
    FORALL (f: [A -> B], g: [B -> A], b: B, i: nat):
      NOT i = 0 IMPLIES i - 1 >= 0;


decl_type: tcc
theory: cantor_bernstein_schroeder
library: sets_aux
signature: nil
location: 206 0 210 999
body:
  % Termination TCC generated (at line 46, column 18) for
      % Bfun(f, g)(b)(i - 1)
  Bfun_TCC3: OBLIGATION
    FORALL (f: [A -> B], g: [B -> A], b: B, i: nat):
      NOT i = 0 IMPLIES i - 1 < i;


decl_type: tcc
theory: cantor_bernstein_schroeder
library: sets_aux
signature: nil
location: 212 0 220 999
body:
  % Subtype TCC generated (at line 62, column 18) for  i - k
      % expected type  nat
  Bfuneq_TCC1: OBLIGATION
    FORALL (f: [A -> B], g: [B -> A], i, j: nat, b: B):
      injective?(f) AND
       injective?(g) AND
        (Bfun(f, g)(b)(i)`1 = Bfun(f, g)(b)(j)`1 OR
          Bfun(f, g)(b)(i)`2 = Bfun(f, g)(b)(j)`2)
       IMPLIES (FORALL (k: nat): k < i AND k < j IMPLIES i - k >= 0);


decl_type: tcc
theory: cantor_bernstein_schroeder
library: sets_aux
signature: nil
location: 222 0 230 999
body:
  % Subtype TCC generated (at line 62, column 38) for  j - k
      % expected type  nat
  Bfuneq_TCC2: OBLIGATION
    FORALL (f: [A -> B], g: [B -> A], i, j: nat, b: B):
      injective?(f) AND
       injective?(g) AND
        (Bfun(f, g)(b)(i)`1 = Bfun(f, g)(b)(j)`1 OR
          Bfun(f, g)(b)(i)`2 = Bfun(f, g)(b)(j)`2)
       IMPLIES (FORALL (k: nat): k < i AND k < j IMPLIES j - k >= 0);


decl_type: tcc
theory: cantor_bernstein_schroeder
library: sets_aux
signature: nil
location: 232 0 240 999
body:
  % Subtype TCC generated (at line 76, column 18) for  i - k
      % expected type  nat
  ABfuneq_TCC1: OBLIGATION
    FORALL (f: [A -> B], g: [B -> A], i, j: nat, b: B, a: A):
      injective?(f) AND
       injective?(g) AND
        (Bfun(f, g)(b)(i)`1 = Afun(f, g)(a)(j)`1 OR
          Bfun(f, g)(b)(i)`2 = Afun(f, g)(a)(j)`2)
       IMPLIES (FORALL (k: nat): k < i AND k <= j IMPLIES i - k >= 0);


decl_type: tcc
theory: cantor_bernstein_schroeder
library: sets_aux
signature: nil
location: 242 0 250 999
body:
  % Subtype TCC generated (at line 76, column 38) for  j - k
      % expected type  nat
  ABfuneq_TCC2: OBLIGATION
    FORALL (f: [A -> B], g: [B -> A], i, j: nat, b: B, a: A):
      injective?(f) AND
       injective?(g) AND
        (Bfun(f, g)(b)(i)`1 = Afun(f, g)(a)(j)`1 OR
          Bfun(f, g)(b)(i)`2 = Afun(f, g)(a)(j)`2)
       IMPLIES (FORALL (k: nat): k < i AND k <= j IMPLIES j - k >= 0);


decl_type: tcc
theory: cantor_bernstein_schroeder
library: sets_aux
signature: nil
location: 252 0 256 999
body:
  % Subtype TCC generated (at line 128, column 87) for  f(an)
      % expected type  (ABrel(f, g)(a))
  af_fun_TCC1: OBLIGATION
    FORALL (f: [A -> B], g: [B -> A], a: A, an: (Arel(f, g)(a))):
      ABrel(f, g)(a)(f(an));


decl_type: tcc
theory: cantor_bernstein_schroeder
library: sets_aux
signature: nil
location: 258 0 262 999
body:
  % Subtype TCC generated (at line 130, column 88) for  g(bn)
      % expected type  (Arel(f, g)(a))
  ag_fun_TCC1: OBLIGATION
    FORALL (f: [A -> B], g: [B -> A], a: A, bn: (ABrel(f, g)(a))):
      Arel(f, g)(a)(g(bn));


decl_type: formula
theory: card_comp_set_props
library: sets_aux
signature: nil
location: 35 2 39 56
body:
    card_lt_surj: LEMMA
      FORALL S1, S2:
        card_lt(S1, S2) IFF
         (EXISTS (t: (S2)): TRUE) AND
          NOT (EXISTS (f: [(S1) -> (S2)]): surjective?(f))


decl_type: formula
theory: card_comp_set_props
library: sets_aux
signature: nil
location: 41 2 45 52
body:
    card_ge_surj: LEMMA
      FORALL S1, S2:
        card_ge(S1, S2) IFF
         ((EXISTS (t: (S1)): TRUE) AND (FORALL (t: (S2)): FALSE)) OR
          (EXISTS (f: [(S1) -> (S2)]): surjective?(f))


decl_type: formula
theory: card_comp_set_props
library: sets_aux
signature: nil
location: 70 2 72 68
body:
    card_lt_neq_ngt: LEMMA
      FORALL S1, S2:
        card_lt(S1, S2) => NOT card_eq(S1, S2) AND NOT card_gt(S1, S2)


decl_type: formula
theory: card_comp_set_props
library: sets_aux
signature: nil
location: 73 2 75 68
body:
    card_gt_neq_nlt: LEMMA
      FORALL S1, S2:
        card_gt(S1, S2) => NOT card_eq(S1, S2) AND NOT card_lt(S1, S2)


decl_type: formula
theory: card_comp_set_props
library: sets_aux
signature: nil
location: 85 2 86 73
body:
    card_le_antisymmetric: LEMMA
      FORALL S1, S2: card_le(S1, S2) AND card_le(S2, S1) => card_eq(S1, S2)


decl_type: formula
theory: card_comp_set_props
library: sets_aux
signature: nil
location: 90 2 91 73
body:
    card_ge_antisymmetric: LEMMA
      FORALL S1, S2: card_ge(S1, S2) AND card_ge(S2, S1) => card_eq(S1, S2)


decl_type: formula
theory: card_comp_set_props
library: sets_aux
signature: nil
location: 101 2 102 72
body:
    card_lt_trichotomous: LEMMA
      FORALL S1, S2: card_lt(S1, S2) OR card_lt(S2, S1) OR card_eq(S1, S2)


decl_type: formula
theory: card_comp_set_props
library: sets_aux
signature: nil
location: 110 2 111 72
body:
    card_gt_trichotomous: LEMMA
      FORALL S1, S2: card_gt(S1, S2) OR card_gt(S2, S1) OR card_eq(S1, S2)


decl_type: formula
theory: countability
library: sets_aux
signature: nil
location: 45 2 47 63
body:
    countably_infinite_subset: THEOREM
      FORALL (CountInf: countably_infinite_set), (Inf: infinite_set[T]):
        subset?(Inf, CountInf) IMPLIES is_countably_infinite(Inf)


decl_type: formula
theory: countability
library: sets_aux
signature: nil
location: 49 2 51 47
body:
    countable_subset: THEOREM
      FORALL S, (Count: countable_set):
        subset?(S, Count) IMPLIES is_countable(S)


decl_type: formula
theory: countability
library: sets_aux
signature: nil
location: 62 2 63 56
body:
    countable_type_is_countably_infinite: LEMMA
      is_countably_infinite_type IMPLIES is_countable_type


decl_type: formula
theory: countability
library: sets_aux
signature: nil
location: 66 2 67 68
body:
    countably_infinite_full: LEMMA
      is_countably_infinite_type IFF is_countably_infinite(fullset[T])


decl_type: formula
theory: countability
library: sets_aux
signature: nil
location: 73 2 74 66
body:
    countably_infinite_type_set: LEMMA
      is_countably_infinite_type IMPLIES (FORALL S: is_countable(S))


decl_type: formula
theory: countability
library: sets_aux
signature: nil
location: 75 2 76 61
body:
    uncountably_infinite_type_set: LEMMA
      (EXISTS S: is_uncountable(S)) IMPLIES is_uncountable_type


decl_type: formula
theory: countability
library: sets_aux
signature: nil
location: 80 2 81 78
body:
    countably_infinite_complement: LEMMA
      is_countably_infinite_type IMPLIES (FORALL S: is_countable(complement(S)))


decl_type: tcc
theory: countability
library: sets_aux
signature: nil
location: 88 0 90 999
body:
  % Subtype TCC generated (at line 33, column 51) for  emptyset[T]
      % expected type  countable_set
  countable_set_TCC1: OBLIGATION is_countable(emptyset[T]);


decl_type: tcc
theory: countability
library: sets_aux
signature: nil
location: 92 0 95 999
body:
  % Judgement subtype TCC generated (at line 38, column 4) for  x
      % expected type  countable_set
  countably_infinite_countable: OBLIGATION
    FORALL (x: countably_infinite_set): is_countable(x);


decl_type: formula
theory: countable_props
library: sets_aux
signature: nil
location: 71 2 72 62
body:
    countably_infinite_strict_subset_exists: THEOREM
      FORALL Inf: EXISTS CountInf: strict_subset?(CountInf, Inf)


decl_type: formula
theory: countable_props
library: sets_aux
signature: nil
location: 108 2 110 59
body:
    card_eq_countably_infinite: THEOREM
      FORALL S, CountInf:
        card_eq(S, CountInf) IMPLIES is_countably_infinite(S)


decl_type: formula
theory: countable_props
library: sets_aux
signature: nil
location: 115 2 116 68
body:
    card_ge_uncountable: COROLLARY
      FORALL S, Uncount: card_ge(S, Uncount) IMPLIES is_uncountable(S)


decl_type: formula
theory: countable_props
library: sets_aux
signature: nil
location: 119 2 124 38
body:
    countably_infinite_subset_union: LEMMA
      FORALL Q, R, S:
        subset?(Q, S) AND
         disjoint?(S, R) AND
          is_countably_infinite(R) AND is_countably_infinite(Q)
         IMPLIES card_eq(S, union(S, R))


decl_type: formula
theory: countable_props
library: sets_aux
signature: nil
location: 126 2 130 38
body:
    countable_finite_subset_union: LEMMA
      FORALL Q, R, S:
        subset?(Q, S) AND
         disjoint?(S, R) AND is_finite(R) AND is_countably_infinite(Q)
         IMPLIES card_eq(S, union(S, R))


decl_type: formula
theory: countable_props
library: sets_aux
signature: nil
location: 135 2 137 73
body:
    infinite_countable_difference: THEOREM
      FORALL S, Count:
        is_finite(difference(S, Count)) OR card_eq(S, difference(S, Count))  


decl_type: judgement
theory: countable_props
library: sets_aux
signature: countably_infinite_set[T]
location: 54 2 55 64
body:
    countably_infinite_difference: JUDGEMENT
      difference(CountInf, Fin) HAS_TYPE countably_infinite_set[T]


decl_type: judgement
theory: countable_props
library: sets_aux
signature: countably_infinite_set[T]
location: 79 2 80 61
body:
    countably_infinite_union1: JUDGEMENT
      union(CountInf, Count) HAS_TYPE countably_infinite_set[T]


decl_type: judgement
theory: countable_props
library: sets_aux
signature: countably_infinite_set[T]
location: 81 2 82 61
body:
    countably_infinite_union2: JUDGEMENT
      union(Count, CountInf) HAS_TYPE countably_infinite_set[T]


decl_type: tcc
theory: countable_props
library: sets_aux
signature: nil
location: 148 0 151 999
body:
  % Judgement subtype TCC generated (at line 31, column 4) for  x
      % expected type  infinite_set[T]
  infinite_countably_infinite: OBLIGATION
    FORALL (x: countably_infinite_set[T]): NOT is_finite[T](x);


decl_type: tcc
theory: countable_props
library: sets_aux
signature: nil
location: 153 0 157 999
body:
  % Judgement subtype TCC generated (at line 38, column 4) for
      % add(t, CountInf)
      % expected type  countably_infinite_set
  countably_infinite_add: OBLIGATION
    FORALL (CountInf, t): is_countably_infinite[T](add[T](t, CountInf));


decl_type: tcc
theory: countable_props
library: sets_aux
signature: nil
location: 159 0 162 999
body:
  % Judgement subtype TCC generated (at line 39, column 27) for  add(t, Count)
      % expected type  countable_set[T]
  countable_add: OBLIGATION
    FORALL (Count, t): is_countable[T](add[T](t, Count));


decl_type: tcc
theory: countable_props
library: sets_aux
signature: nil
location: 164 0 168 999
body:
  % Judgement subtype TCC generated (at line 42, column 4) for
      % remove(t, CountInf)
      % expected type  countably_infinite_set
  countably_infinite_remove: OBLIGATION
    FORALL (CountInf, t): is_countably_infinite[T](remove[T](t, CountInf));


decl_type: tcc
theory: countable_props
library: sets_aux
signature: nil
location: 170 0 174 999
body:
  % Judgement subtype TCC generated (at line 43, column 30) for
      % remove(t, Count)
      % expected type  countable_set[T]
  countable_remove: OBLIGATION
    FORALL (Count, t): is_countable[T](remove[T](t, Count));


decl_type: tcc
theory: countable_props
library: sets_aux
signature: nil
location: 176 0 179 999
body:
  % Judgement subtype TCC generated (at line 46, column 4) for  rest(CountInf)
      % expected type  countably_infinite_set
  countably_infinite_rest: OBLIGATION
    FORALL (CountInf): is_countably_infinite[T](rest[T](CountInf));


decl_type: tcc
theory: countable_props
library: sets_aux
signature: nil
location: 181 0 183 999
body:
  % Judgement subtype TCC generated (at line 47, column 28) for  rest(Count)
      % expected type  countable_set[T]
  countable_rest: OBLIGATION FORALL (Count): is_countable[T](rest[T](Count));


decl_type: tcc
theory: countable_props
library: sets_aux
signature: nil
location: 185 0 189 999
body:
  % Judgement subtype TCC generated (at line 50, column 4) for
      % intersection(Count, S)
      % expected type  countable_set[T]
  countable_intersection1: OBLIGATION
    FORALL (Count, S): is_countable[T](intersection[T](Count, S));


decl_type: tcc
theory: countable_props
library: sets_aux
signature: nil
location: 191 0 195 999
body:
  % Judgement subtype TCC generated (at line 52, column 4) for
      % intersection(S, Count)
      % expected type  countable_set[T]
  countable_intersection2: OBLIGATION
    FORALL (Count, S): is_countable[T](intersection[T](S, Count));


decl_type: tcc
theory: countable_props
library: sets_aux
signature: nil
location: 197 0 202 999
body:
  % Judgement subtype TCC generated (at line 55, column 4) for
      % difference(CountInf, Fin)
      % expected type  countably_infinite_set
  countably_infinite_difference: OBLIGATION
    FORALL (CountInf, Fin):
      is_countably_infinite[T](difference[T](CountInf, Fin));


decl_type: tcc
theory: countable_props
library: sets_aux
signature: nil
location: 204 0 208 999
body:
  % Judgement subtype TCC generated (at line 57, column 4) for
      % difference(Count, S)
      % expected type  countable_set[T]
  countable_difference: OBLIGATION
    FORALL (Count, S): is_countable[T](difference[T](Count, S));


decl_type: tcc
theory: countable_props
library: sets_aux
signature: nil
location: 210 0 212 999
body:
  % Judgement subtype TCC generated (at line 59, column 30) for  x
      % expected type  countable_set[T]
  finite_countable: OBLIGATION FORALL (x: finite_set[T]): is_countable[T](x);


decl_type: tcc
theory: countable_props
library: sets_aux
signature: nil
location: 214 0 217 999
body:
  % Judgement subtype TCC generated (at line 64, column 4) for  x
      % expected type  infinite_set[T]
  infinite_uncountable: OBLIGATION
    FORALL (x: uncountable_set[T]): NOT is_finite[T](x);


decl_type: tcc
theory: countable_props
library: sets_aux
signature: nil
location: 219 0 224 999
body:
  % Judgement subtype TCC generated (at line 80, column 4) for
      % union(CountInf, Count)
      % expected type  countably_infinite_set
  countably_infinite_union1: OBLIGATION
    FORALL (Count, CountInf):
      is_countably_infinite[T](union[T](CountInf, Count));


decl_type: tcc
theory: countable_props
library: sets_aux
signature: nil
location: 226 0 231 999
body:
  % Judgement subtype TCC generated (at line 82, column 4) for
      % union(Count, CountInf)
      % expected type  countably_infinite_set
  countably_infinite_union2: OBLIGATION
    FORALL (Count, CountInf):
      is_countably_infinite[T](union[T](Count, CountInf));


decl_type: tcc
theory: countable_props
library: sets_aux
signature: nil
location: 233 0 237 999
body:
  % Judgement subtype TCC generated (at line 83, column 29) for
      % union(Count1, Count2)
      % expected type  countable_set[T]
  countable_union: OBLIGATION
    FORALL (Count1, Count2): is_countable[T](union[T](Count1, Count2));


decl_type: formula
theory: inverse_image_Union
library: sets_aux
signature: nil
location: 16 2 17 78
body:
    inverse_image_Union: LEMMA inverse_image(f,Union(X)) =
                               Union({y | EXISTS (x:(X)): y=inverse_image(f,x)})


decl_type: tcc
theory: indexed_sets_aux
library: sets_aux
signature: nil
location: 33 0 35 999
body:
  % Subtype TCC generated (at line 19, column 56) for  (LAMBDA i: emptyset[T])
      % expected type  disjoint_indexed_set
  disjoint_indexed_set_TCC1: OBLIGATION disjoint?((LAMBDA i: emptyset[T]));


decl_type: formula
theory: nat_indexed_sets
library: sets_aux
signature: nil
location: 37 2 41 36
body:
    increasing_IUnion: LEMMA
       EXISTS B: increasing?(B) AND
                 B(0) = A(0) AND
                 (FORALL n: B(n+1) = union(B(n),A(n+1))) AND
                 IUnion(A) = IUnion(B)


decl_type: formula
theory: nat_indexed_sets
library: sets_aux
signature: nil
location: 43 2 47 50
body:
    decreasing_IIntersection: LEMMA
       EXISTS B: decreasing?(B) AND
                 B(0) = A(0) AND
                 (FORALL n: B(n+1) = intersection(B(n),A(n+1))) AND
                 IIntersection(A) = IIntersection(B)


decl_type: formula
theory: nat_indexed_sets
library: sets_aux
signature: nil
location: 49 2 54 36
body:
    disjoint_IUnion: LEMMA
       EXISTS B: disjoint?(B) AND
                 (FORALL n: IUnion(n,B) = IUnion(n,A)) AND
                 B(0) = A(0) AND
                 (FORALL n: B(n+1) = difference(A(n+1),IUnion(n,A))) AND
                 IUnion(A) = IUnion(B)


decl_type: type
theory: nat_indexed_sets
library: sets_aux
signature: nil
location: 34 2 35 79
body:
    increasing_indexed: TYPE+ = (increasing_indexed?) CONTAINING
                                                           (lambda n: fullset[T])


decl_type: tcc
theory: nat_indexed_sets
library: sets_aux
signature: nil
location: 61 0 64 999
body:
  % Subtype TCC generated (at line 35, column 58) for  (LAMBDA n: fullset[T])
      % expected type  increasing_indexed
  increasing_indexed_TCC1: OBLIGATION
    increasing_indexed?((LAMBDA n: fullset[T]));


decl_type: formula
theory: countable_indexed_sets
library: sets_aux
signature: nil
location: 20 2 22 69
body:
    Union_IUnion: LEMMA is_countable(XS) =>
                        EXISTS YS: Union(XS) = IUnion(YS) AND 
                                   FORALL n: empty?(YS(n)) OR XS(YS(n))


decl_type: formula
theory: countable_indexed_sets
library: sets_aux
signature: nil
location: 24 2 27 68
body:
    Intersection_IIntersection:
                  LEMMA is_countable(XS) =>
                        EXISTS YS: Intersection(XS) = IIntersection(YS) AND
                                   FORALL n: full?(YS(n)) OR XS(YS(n))


decl_type: formula
theory: card_function
library: sets_aux
signature: nil
location: 15 2 16 74
body:
    infinite_bijection:  LEMMA
       bijective?(f)  AND is_infinite(fullset[D]) => is_infinite(fullset[R])


decl_type: formula
theory: card_function
library: sets_aux
signature: nil
location: 17 2 18 72
body:
    finite_bijection:    LEMMA
       bijective?(f)  AND is_finite(fullset[D])   => is_finite(fullset[R])


decl_type: formula
theory: card_function
library: sets_aux
signature: nil
location: 19 2 20 74
body:
    infinite_injection:  LEMMA
       injective?(f)  AND is_infinite(fullset[D]) => is_infinite(fullset[R])


decl_type: formula
theory: card_function
library: sets_aux
signature: nil
location: 21 2 22 72
body:
    finite_injection:    LEMMA
       injective?(f)  AND is_finite(fullset[R])   => is_finite(fullset[D])


decl_type: formula
theory: card_function
library: sets_aux
signature: nil
location: 23 2 24 74
body:
    infinite_surjection: LEMMA
       surjective?(f) AND is_infinite(fullset[R]) => is_infinite(fullset[D])


decl_type: formula
theory: card_function
library: sets_aux
signature: nil
location: 25 2 26 72
body:
    finite_surjection:   LEMMA
       surjective?(f) AND is_finite(fullset[D])   => is_finite(fullset[R])


decl_type: formula
theory: infinite_image
library: sets_aux
signature: nil
location: 20 2 22 54
body:
    infinite_image: THEOREM
      FORALL (S: set[D]), (f: [D -> R]):
        is_infinite[R](image(f, S)) => is_infinite[D](S)


decl_type: tcc
theory: infinite_image
library: sets_aux
signature: nil
location: 34 0 37 999
body:
  % Judgement subtype TCC generated (at line 27, column 38) for  image(f, S)
      % expected type  infinite_set[R]
  infinite_injective_image: OBLIGATION
    FORALL (S, f): NOT is_finite[R](image[D, R](f, S));


decl_type: formula
theory: card_comp_set_transitive
library: sets_aux
signature: nil
location: 32 2 34 60
body:
    card_lt_transitive: LEMMA
      FORALL S1, S2, S3:
        card_lt(S1, S2) AND card_lt(S2, S3) => card_lt(S1, S3)


decl_type: formula
theory: card_comp_set_transitive
library: sets_aux
signature: nil
location: 35 2 37 60
body:
    card_lt_le_transitive: LEMMA
      FORALL S1, S2, S3:
        card_lt(S1, S2) AND card_le(S2, S3) => card_lt(S1, S3)


decl_type: formula
theory: card_comp_set_transitive
library: sets_aux
signature: nil
location: 38 2 40 60
body:
    card_lt_eq_transitive: LEMMA
      FORALL S1, S2, S3:
        card_lt(S1, S2) AND card_eq(S2, S3) => card_lt(S1, S3)


decl_type: formula
theory: card_comp_set_transitive
library: sets_aux
signature: nil
location: 41 2 43 60
body:
    card_le_lt_transitive: LEMMA
      FORALL S1, S2, S3:
        card_le(S1, S2) AND card_lt(S2, S3) => card_lt(S1, S3)


decl_type: formula
theory: card_comp_set_transitive
library: sets_aux
signature: nil
location: 44 2 46 60
body:
    card_eq_lt_transitive: LEMMA
      FORALL S1, S2, S3:
        card_eq(S1, S2) AND card_lt(S2, S3) => card_lt(S1, S3)


decl_type: formula
theory: card_comp_set_transitive
library: sets_aux
signature: nil
location: 49 2 51 60
body:
    card_le_transitive: LEMMA
      FORALL S1, S2, S3:
        card_le(S1, S2) AND card_le(S2, S3) => card_le(S1, S3)


decl_type: formula
theory: card_comp_set_transitive
library: sets_aux
signature: nil
location: 52 2 54 60
body:
    card_le_eq_transitive: LEMMA
      FORALL S1, S2, S3:
        card_le(S1, S2) AND card_eq(S2, S3) => card_le(S1, S3)


decl_type: formula
theory: card_comp_set_transitive
library: sets_aux
signature: nil
location: 55 2 57 60
body:
    card_eq_le_transitive: LEMMA
      FORALL S1, S2, S3:
        card_eq(S1, S2) AND card_le(S2, S3) => card_le(S1, S3)


decl_type: formula
theory: card_comp_set_transitive
library: sets_aux
signature: nil
location: 60 2 62 60
body:
    card_eq_transitive: LEMMA
      FORALL S1, S2, S3:
        card_eq(S1, S2) AND card_eq(S2, S3) => card_eq(S1, S3)


decl_type: formula
theory: card_comp_set_transitive
library: sets_aux
signature: nil
location: 65 2 67 60
body:
    card_eq_ge_transitive: LEMMA
      FORALL S1, S2, S3:
        card_eq(S1, S2) AND card_ge(S2, S3) => card_ge(S1, S3)


decl_type: formula
theory: card_comp_set_transitive
library: sets_aux
signature: nil
location: 68 2 70 60
body:
    card_ge_eq_transitive: LEMMA
      FORALL S1, S2, S3:
        card_ge(S1, S2) AND card_eq(S2, S3) => card_ge(S1, S3)


decl_type: formula
theory: card_comp_set_transitive
library: sets_aux
signature: nil
location: 71 2 73 60
body:
    card_ge_transitive: LEMMA
      FORALL S1, S2, S3:
        card_ge(S1, S2) AND card_ge(S2, S3) => card_ge(S1, S3)


decl_type: formula
theory: card_comp_set_transitive
library: sets_aux
signature: nil
location: 76 2 78 60
body:
    card_eq_gt_transitive: LEMMA
      FORALL S1, S2, S3:
        card_eq(S1, S2) AND card_gt(S2, S3) => card_gt(S1, S3)


decl_type: formula
theory: card_comp_set_transitive
library: sets_aux
signature: nil
location: 79 2 81 60
body:
    card_ge_gt_transitive: LEMMA
      FORALL S1, S2, S3:
        card_ge(S1, S2) AND card_gt(S2, S3) => card_gt(S1, S3)


decl_type: formula
theory: card_comp_set_transitive
library: sets_aux
signature: nil
location: 82 2 84 60
body:
    card_gt_eq_transitive: LEMMA
      FORALL S1, S2, S3:
        card_gt(S1, S2) AND card_eq(S2, S3) => card_gt(S1, S3)


decl_type: formula
theory: card_comp_set_transitive
library: sets_aux
signature: nil
location: 85 2 87 60
body:
    card_gt_ge_transitive: LEMMA
      FORALL S1, S2, S3:
        card_gt(S1, S2) AND card_ge(S2, S3) => card_gt(S1, S3)


decl_type: formula
theory: card_comp_set_transitive
library: sets_aux
signature: nil
location: 88 2 90 60
body:
    card_gt_transitive: LEMMA
      FORALL S1, S2, S3:
        card_gt(S1, S2) AND card_gt(S2, S3) => card_gt(S1, S3)


decl_type: tcc
theory: card_single
library: sets_aux
signature: nil
location: 70 0 72 999
body:
  % Judgement subtype TCC generated (at line 24, column 36) for  card_lt
      % expected type  (irreflexive?[set[T]])
  card_lt_is_irreflexive: OBLIGATION irreflexive?[set[T]](card_lt[T, T]);


decl_type: tcc
theory: card_single
library: sets_aux
signature: nil
location: 74 0 76 999
body:
  % Judgement subtype TCC generated (at line 25, column 36) for  card_le
      % expected type  (reflexive?[set[T]])
  card_le_is_reflexive: OBLIGATION reflexive?[set[T]](card_le[T, T]);


decl_type: tcc
theory: card_single
library: sets_aux
signature: nil
location: 78 0 80 999
body:
  % Judgement subtype TCC generated (at line 26, column 36) for  card_eq
      % expected type  (reflexive?[set[T]])
  card_eq_is_reflexive: OBLIGATION reflexive?[set[T]](card_eq[T, T]);


decl_type: tcc
theory: card_single
library: sets_aux
signature: nil
location: 82 0 84 999
body:
  % Judgement subtype TCC generated (at line 27, column 36) for  card_ge
      % expected type  (reflexive?[set[T]])
  card_ge_is_reflexive: OBLIGATION reflexive?[set[T]](card_ge[T, T]);


decl_type: tcc
theory: card_single
library: sets_aux
signature: nil
location: 86 0 88 999
body:
  % Judgement subtype TCC generated (at line 28, column 36) for  card_gt
      % expected type  (irreflexive?[set[T]])
  card_gt_is_irreflexive: OBLIGATION irreflexive?[set[T]](card_gt[T, T]);


decl_type: tcc
theory: card_single
library: sets_aux
signature: nil
location: 90 0 92 999
body:
  % Judgement subtype TCC generated (at line 35, column 38) for  card_lt
      % expected type  (antisymmetric?[set[T]])
  card_lt_is_antisymmetric: OBLIGATION antisymmetric?[set[T]](card_lt[T, T]);


decl_type: tcc
theory: card_single
library: sets_aux
signature: nil
location: 94 0 96 999
body:
  % Judgement subtype TCC generated (at line 36, column 38) for  card_eq
      % expected type  (symmetric?[set[T]])
  card_eq_is_symmetric: OBLIGATION symmetric?[set[T]](card_eq[T, T]);


decl_type: tcc
theory: card_single
library: sets_aux
signature: nil
location: 98 0 100 999
body:
  % Judgement subtype TCC generated (at line 37, column 38) for  card_gt
      % expected type  (antisymmetric?[set[T]])
  card_gt_is_antisymmetric: OBLIGATION antisymmetric?[set[T]](card_gt[T, T]);


decl_type: tcc
theory: card_single
library: sets_aux
signature: nil
location: 102 0 104 999
body:
  % Judgement subtype TCC generated (at line 44, column 35) for  card_lt
      % expected type  (transitive?[set[T]])
  card_lt_is_transitive: OBLIGATION transitive?[set[T]](card_lt[T, T]);


decl_type: tcc
theory: card_single
library: sets_aux
signature: nil
location: 106 0 108 999
body:
  % Judgement subtype TCC generated (at line 45, column 35) for  card_le
      % expected type  (transitive?[set[T]])
  card_le_is_transitive: OBLIGATION transitive?[set[T]](card_le[T, T]);


decl_type: tcc
theory: card_single
library: sets_aux
signature: nil
location: 110 0 112 999
body:
  % Judgement subtype TCC generated (at line 46, column 35) for  card_eq
      % expected type  (transitive?[set[T]])
  card_eq_is_transitive: OBLIGATION transitive?[set[T]](card_eq[T, T]);


decl_type: tcc
theory: card_single
library: sets_aux
signature: nil
location: 114 0 116 999
body:
  % Judgement subtype TCC generated (at line 47, column 35) for  card_ge
      % expected type  (transitive?[set[T]])
  card_ge_is_transitive: OBLIGATION transitive?[set[T]](card_ge[T, T]);


decl_type: tcc
theory: card_single
library: sets_aux
signature: nil
location: 118 0 120 999
body:
  % Judgement subtype TCC generated (at line 48, column 35) for  card_gt
      % expected type  (transitive?[set[T]])
  card_gt_is_transitive: OBLIGATION transitive?[set[T]](card_gt[T, T]);


decl_type: tcc
theory: card_single
library: sets_aux
signature: nil
location: 122 0 124 999
body:
  % Judgement subtype TCC generated (at line 55, column 36) for  card_le
      % expected type  (dichotomous?[set[T]])
  card_le_is_dichotomous: OBLIGATION dichotomous?[set[T]](card_le[T, T]);


decl_type: tcc
theory: card_single
library: sets_aux
signature: nil
location: 126 0 128 999
body:
  % Judgement subtype TCC generated (at line 56, column 36) for  card_ge
      % expected type  (dichotomous?[set[T]])
  card_ge_is_dichotomous: OBLIGATION dichotomous?[set[T]](card_ge[T, T]);


decl_type: tcc
theory: card_single
library: sets_aux
signature: nil
location: 130 0 132 999
body:
  % Judgement subtype TCC generated (at line 63, column 36) for  card_eq
      % expected type  equivalence[set[T]]
  card_eq_is_equivalence: OBLIGATION equivalence?[set[T]](card_eq[T, T]);


decl_type: formula
theory: card_sets_lemmas
library: sets_aux
signature: nil
location: 36 2 37 72
body:
    strict_subset_card_lt: LEMMA
      FORALL S, R: subset?(S, R) AND card_lt(S, R) => strict_subset?(S, R)


decl_type: formula
theory: infinite_card
library: sets_aux
signature: nil
location: 28 2 29 75
body:
    infinite_card_eq: COROLLARY
      FORALL S1, S2: card_eq(S1, S2) => (is_infinite(S1) IFF is_infinite(S2))


decl_type: formula
theory: infinite_card
library: sets_aux
signature: nil
location: 31 2 32 73
body:
    infinite_card_le: THEOREM
      FORALL S1, S2: card_le(S1, S2) AND is_infinite(S1) => is_infinite(S2)


decl_type: formula
theory: infinite_card
library: sets_aux
signature: nil
location: 34 2 35 73
body:
    infinite_card_ge: THEOREM
      FORALL S1, S2: card_ge(S1, S2) AND is_infinite(S2) => is_infinite(S1)


decl_type: formula
theory: bits
library: sets_aux
signature: nil
location: 83 2 84 66
body:
    bit_decoding_has_greatest: LEMMA
      FORALL n: n > 0 IMPLIES has_greatest?(bit_decoding(n), lesseq)


decl_type: formula
theory: bits
library: sets_aux
signature: nil
location: 89 2 93 43
body:
    bit_decoding_max2: LEMMA
      FORALL n:
        n > 0 IMPLIES
         greatest(lesseq)(bit_decoding(n)) =
          least(lesseq)(bounding_bits(n)) - 1


decl_type: formula
theory: bits
library: sets_aux
signature: nil
location: 112 2 114 55
body:
    bit_encoding_member2: LEMMA
      FORALL (S: non_empty_finite_set[nat]):
        bit_encoding(S) < exp2((greatest(lesseq)(S) + 1))


decl_type: formula
theory: bits
library: sets_aux
signature: nil
location: 116 2 119 26
body:
    bit_encoding_member3: LEMMA
      FORALL (S: non_empty_finite_set[nat]):
        least(lesseq)(bounding_bits(bit_encoding(S))) - 1 =
         greatest(lesseq)(S)


decl_type: formula
theory: bits
library: sets_aux
signature: nil
location: 126 2 128 75
body:
    decoding_encoding_max: LEMMA
      FORALL (S: non_empty_finite_set[nat]):
        greatest(lesseq)(S) = greatest(lesseq)(bit_decoding(bit_encoding(S)))


decl_type: formula
theory: bits
library: sets_aux
signature: nil
location: 133 2 136 65
body:
    decoding_encoding_remove: LEMMA
      FORALL (S: non_empty_finite_set[nat]):
        remove(greatest(lesseq)(S), bit_decoding(bit_encoding(S))) =
         bit_decoding(bit_encoding(remove(greatest(lesseq)(S), S)))


decl_type: function
theory: bits
library: sets_aux
signature: [nat -> finite_set[nat]]
location: 76 2 81 14
body:
    bit_decoding(n): RECURSIVE finite_set =
      IF n = 0 THEN emptyset[nat]
      ELSE LET bit: nat = least(lesseq)(bounding_bits(n)) - 1 IN
             add(bit, bit_decoding(n - exp2(bit)))
      ENDIF
       MEASURE n


decl_type: function
theory: bits
library: sets_aux
signature: [finite_set[nat] -> nat]
location: 103 2 108 20
body:
    bit_encoding(S): RECURSIVE nat =
      IF empty?(S) THEN 0
      ELSE exp2(greatest(lesseq)(S)) +
            bit_encoding(remove(greatest(lesseq)(S), S))
      ENDIF
       MEASURE card(S)


decl_type: tcc
theory: bits
library: sets_aux
signature: nil
location: 157 0 167 999
body:
  % Subtype TCC generated (at line 79, column 33) for  n - exp2(bit)
      % expected type  nat
  bit_decoding_TCC1: OBLIGATION
    FORALL (n: nat):
      NOT n = 0 IMPLIES
       (FORALL (bit: nat):
          bit =
           least(restrict[[real, real], [nat, nat], boolean](<=))
                (bounding_bits(n))
            - 1
           IMPLIES n - exp2(bit) >= 0);


decl_type: tcc
theory: bits
library: sets_aux
signature: nil
location: 169 0 179 999
body:
  % Termination TCC generated (at line 79, column 20) for
      % bit_decoding(n - exp2(bit))
  bit_decoding_TCC2: OBLIGATION
    FORALL (n: nat):
      NOT n = 0 IMPLIES
       (FORALL (bit: nat):
          bit =
           least(restrict[[real, real], [nat, nat], boolean](<=))
                (bounding_bits(n))
            - 1
           IMPLIES n - exp2(bit) < n);


decl_type: tcc
theory: bits
library: sets_aux
signature: nil
location: 181 0 193 999
body:
  % Subtype TCC generated (at line 78, column 38) for  bounding_bits(n)
      % expected type  S:
                     %   (LAMBDA (S: set[nat]):
                     %      has_least?(S,
                     %                 restrict
                     %                 [[real, real], [nat, nat], boolean]
                     %                 (<=)))
  bit_decoding_TCC3: OBLIGATION
    FORALL (n: nat):
      NOT n = 0 IMPLIES
       has_least?[nat]
           (bounding_bits(n),
            restrict[[real, real], [nat, nat], boolean](<=));


decl_type: tcc
theory: bits
library: sets_aux
signature: nil
location: 195 0 207 999
body:
  % Subtype TCC generated (at line 78, column 24) for
      % least(restrict[[real, real], [nat, nat], boolean](<=))
      %      (bounding_bits(n))
      %  - 1
      % expected type  nat
  bit_decoding_TCC4: OBLIGATION
    FORALL (n: nat):
      NOT n = 0 IMPLIES
       least[nat]
           (restrict[[real, real], [nat, nat], boolean](<=))
           (bounding_bits(n))
        - 1
        >= 0;


decl_type: tcc
theory: bits
library: sets_aux
signature: nil
location: 209 0 220 999
body:
  % Subtype TCC generated (at line 87, column 55) for  bit_decoding(n)
      % expected type  S:
                     %   (LAMBDA (S: set[nat]):
                     %      has_greatest?(S,
                     %                    restrict
                     %                    [[real, real], [nat, nat], boolean]
                     %                    (<=)))
  bit_decoding_max1_TCC1: OBLIGATION
    FORALL (n):
      n > 0 IMPLIES
       has_greatest?[nat]
           (bit_decoding(n), restrict[[real, real], [nat, nat], boolean](<=));


decl_type: tcc
theory: bits
library: sets_aux
signature: nil
location: 222 0 234 999
body:
  % Subtype TCC generated (at line 93, column 22) for  bounding_bits(n)
      % expected type  S:
                     %   (LAMBDA (S: set[nat]):
                     %      has_least?(S,
                     %                 restrict
                     %                 [[real, real], [nat, nat], boolean]
                     %                 (<=)))
  bit_decoding_max2_TCC1: OBLIGATION
    FORALL (n):
      n > 0 IMPLIES
       has_least?[nat]
           (bounding_bits(n),
            restrict[[real, real], [nat, nat], boolean](<=));


decl_type: tcc
theory: bits
library: sets_aux
signature: nil
location: 236 0 246 999
body:
  % Subtype TCC generated (at line 105, column 31) for  S
      % expected type  S:
                     %   (LAMBDA (S: set[nat]):
                     %      has_greatest?(S,
                     %                    restrict
                     %                    [[real, real], [nat, nat], boolean]
                     %                    (<=)))
  bit_encoding_TCC1: OBLIGATION
    FORALL (S: finite_set[nat]):
      NOT empty?(S) IMPLIES
       has_greatest?[nat](S, restrict[[real, real], [nat, nat], boolean](<=));


decl_type: tcc
theory: bits
library: sets_aux
signature: nil
location: 248 0 262 999
body:
  % Termination TCC generated (at line 106, column 10) for
      % bit_encoding(remove(greatest(restrict
      %                                  [[real, real], [nat, nat], boolean]
      %                                  (<=))
      %                             (S),
      %                     S))
  bit_encoding_TCC2: OBLIGATION
    FORALL (S: finite_set[nat]):
      NOT empty?(S) IMPLIES
       card[nat]
           (remove[nat]
                (greatest[nat]
                     (restrict[[real, real], [nat, nat], boolean](<=))(S),
                 S))
        < card[nat](S);


decl_type: tcc
theory: bits
library: sets_aux
signature: nil
location: 264 0 276 999
body:
  % Subtype TCC generated (at line 118, column 20) for
      % bounding_bits(bit_encoding(S))
      % expected type  S:
                     %   (LAMBDA (S: set[nat]):
                     %      has_least?(S,
                     %                 restrict
                     %                 [[real, real], [nat, nat], boolean]
                     %                 (<=)))
  bit_encoding_member3_TCC1: OBLIGATION
    FORALL (S: non_empty_finite_set[nat]):
      has_least?[nat]
          (bounding_bits(bit_encoding(S)),
           restrict[[real, real], [nat, nat], boolean](<=));


decl_type: tcc
theory: bits
library: sets_aux
signature: nil
location: 278 0 290 999
body:
  % Subtype TCC generated (at line 128, column 45) for
      % bit_decoding(bit_encoding(S))
      % expected type  S:
                     %   (LAMBDA (S: set[nat]):
                     %      has_greatest?(S,
                     %                    restrict
                     %                    [[real, real], [nat, nat], boolean]
                     %                    (<=)))
  decoding_encoding_max_TCC1: OBLIGATION
    FORALL (S: non_empty_finite_set[nat]):
      has_greatest?[nat]
          (bit_decoding(bit_encoding(S)),
           restrict[[real, real], [nat, nat], boolean](<=));


decl_type: tcc
theory: bits
library: sets_aux
signature: nil
location: 292 0 295 999
body:
  % Judgement subtype TCC generated (at line 143, column 4) for  bit_encoding
      % expected type  (bijective?[finite_set[nat], nat])
  encoding_bijection: OBLIGATION
    bijective?[finite_set[nat], nat](bit_encoding);


decl_type: tcc
theory: bits
library: sets_aux
signature: nil
location: 297 0 300 999
body:
  % Judgement subtype TCC generated (at line 146, column 4) for  bit_decoding
      % expected type  (bijective?[nat, finite_set[nat]])
  decoding_bijection: OBLIGATION
    bijective?[nat, finite_set[nat]](bit_decoding);


decl_type: judgement
theory: countable_set
library: sets_aux
signature: (bijective?[finite_set[int], finite_set[nat]])
location: 54 2 55 76
body:
    intset_to_natset_bijective: JUDGEMENT
      intset_to_natset HAS_TYPE (bijective?[finite_set[int], finite_set[nat]])


decl_type: tcc
theory: countable_set
library: sets_aux
signature: nil
location: 89 0 91 999
body:
  % Subtype TCC generated (at line 32, column 42) for  -2 * i - 1
      % expected type  nat
  int_to_nat_TCC1: OBLIGATION FORALL (i: int): i < 0 IMPLIES -2 * i - 1 >= 0;


decl_type: tcc
theory: countable_set
library: sets_aux
signature: nil
location: 93 0 95 999
body:
  % Subtype TCC generated (at line 32, column 58) for  2 * i
      % expected type  nat
  int_to_nat_TCC2: OBLIGATION FORALL (i: int): NOT i < 0 IMPLIES 2 * i >= 0;


decl_type: tcc
theory: countable_set
library: sets_aux
signature: nil
location: 97 0 100 999
body:
  % Subtype TCC generated (at line 33, column 45) for  n / 2
      % expected type  int
  nat_to_int_TCC1: OBLIGATION
    FORALL (n: nat): even?(n) IMPLIES integer_pred(n / 2);


decl_type: tcc
theory: countable_set
library: sets_aux
signature: nil
location: 102 0 105 999
body:
  % Subtype TCC generated (at line 33, column 56) for  (n + 1) / -2
      % expected type  int
  nat_to_int_TCC2: OBLIGATION
    FORALL (n: nat): NOT even?(n) IMPLIES integer_pred((n + 1) / -2);


decl_type: tcc
theory: countable_set
library: sets_aux
signature: nil
location: 107 0 109 999
body:
  % Judgement subtype TCC generated (at line 35, column 34) for  int_to_nat
      % expected type  (bijective?[int, nat])
  int_to_nat_bijective: OBLIGATION bijective?[int, nat](int_to_nat);


decl_type: tcc
theory: countable_set
library: sets_aux
signature: nil
location: 111 0 113 999
body:
  % Judgement subtype TCC generated (at line 36, column 34) for  nat_to_int
      % expected type  (bijective?[nat, int])
  nat_to_int_bijective: OBLIGATION bijective?[nat, int](nat_to_int);


decl_type: tcc
theory: countable_set
library: sets_aux
signature: nil
location: 115 0 119 999
body:
  % Judgement subtype TCC generated (at line 55, column 4) for
      % intset_to_natset
      % expected type  (bijective?[finite_set[int], finite_set[nat]])
  intset_to_natset_bijective: OBLIGATION
    bijective?[finite_set[int], finite_set[nat]](intset_to_natset);


decl_type: tcc
theory: countable_set
library: sets_aux
signature: nil
location: 121 0 126 999
body:
  % Subtype TCC generated (at line 66, column 6) for
      % {i: nat | i = n`1 * 2 OR i = n`2 * 2 + 1}
      % expected type  finite_set[nat]
  tuple_to_natset_TCC1: OBLIGATION
    FORALL (n: [nat, nat]):
      is_finite[nat]({i: nat | i = n`1 * 2 OR i = n`2 * 2 + 1});


decl_type: tcc
theory: countable_set
library: sets_aux
signature: nil
location: 128 0 133 999
body:
  % Subtype TCC generated (at line 72, column 6) for
      % {i: int | i = n`1 * 2 OR i = n`2 * 2 + 1}
      % expected type  finite_set[int]
  tuple_to_intset_TCC1: OBLIGATION
    FORALL (n: [int, int]):
      is_finite[int]({i: int | i = n`1 * 2 OR i = n`2 * 2 + 1});


decl_type: formula
theory: countable_setofsets
library: sets_aux
signature: nil
location: 41 2 44 32
body:
    countable_union1: THEOREM
      FORALL S:
        is_countable[set[T]](S) AND every(is_countable)(S) =>
         is_countable[T](Union(S))


decl_type: formula
theory: countable_setofsets
library: sets_aux
signature: nil
location: 54 2 57 36
body:
    countable_intersection: THEOREM
      FORALL S:
        nonempty?(S) AND every(is_countable)(S) =>
         is_countable(Intersection(S))


decl_type: judgement
theory: countable_setofsets
library: sets_aux
signature: countable_set[finite_set[T]]
location: 65 2 66 77
body:
    countable_finite_subsets: JUDGEMENT
      finite_subsets(S: countable_set[T]) HAS_TYPE countable_set[finite_set[T]]


decl_type: judgement
theory: countable_setofsets
library: sets_aux
signature: countably_infinite_set[finite_set[T]]
location: 68 2 70 52
body:
    countably_infinite_finite_subsets: JUDGEMENT
      finite_subsets(S: countably_infinite_set[T])
        HAS_TYPE countably_infinite_set[finite_set[T]]


decl_type: tcc
theory: countable_setofsets
library: sets_aux
signature: nil
location: 77 0 82 999
body:
  % Judgement subtype TCC generated (at line 66, column 4) for
      % finite_subsets(S)
      % expected type  countable_set[finite_set[T]]
  countable_finite_subsets: OBLIGATION
    FORALL (S: countable_set[T]):
      is_countable[finite_set[T]](finite_subsets(S));


decl_type: tcc
theory: countable_setofsets
library: sets_aux
signature: nil
location: 84 0 89 999
body:
  % Judgement subtype TCC generated (at line 69, column 4) for
      % finite_subsets(S)
      % expected type  countably_infinite_set[finite_set[T]]
  countably_infinite_finite_subsets: OBLIGATION
    FORALL (S: countably_infinite_set[T]):
      is_countably_infinite[finite_set[T]](finite_subsets(S));


decl_type: tcc
theory: cardinal
library: sets_aux
signature: nil
location: 180 0 183 999
body:
  % Subtype TCC generated (at line 45, column 56) for  R
      % expected type  S: finite_set[T]
  cardinal_finite_card_TCC1: OBLIGATION
    FORALL (S: finite_set[T], R: (cardinal(S))): is_finite[T](R);


decl_type: tcc
theory: cardinal
library: sets_aux
signature: nil
location: 185 0 188 999
body:
  % Judgement subtype TCC generated (at line 135, column 4) for  <
      % expected type  (strict_total_order?[cardinal_number])
  cardinal_lt_strict_total_order: OBLIGATION
    strict_total_order?[cardinal_number](<);


decl_type: tcc
theory: cardinal
library: sets_aux
signature: nil
location: 190 0 192 999
body:
  % Judgement subtype TCC generated (at line 138, column 4) for  <=
      % expected type  (total_order?[cardinal_number])
  cardinal_le_total_order: OBLIGATION total_order?[cardinal_number](<=);


decl_type: tcc
theory: cardinal
library: sets_aux
signature: nil
location: 194 0 196 999
body:
  % Judgement subtype TCC generated (at line 144, column 4) for  >=
      % expected type  (total_order?[cardinal_number])
  cardinal_ge_total_order: OBLIGATION total_order?[cardinal_number](>=);


decl_type: tcc
theory: cardinal
library: sets_aux
signature: nil
location: 198 0 201 999
body:
  % Judgement subtype TCC generated (at line 147, column 4) for  >
      % expected type  (strict_total_order?[cardinal_number])
  cardinal_gt_strict_total_order: OBLIGATION
    strict_total_order?[cardinal_number](>);


decl_type: formula
theory: card_comp_props
library: sets_aux
signature: nil
location: 36 2 38 76
body:
    card_lt_surj: LEMMA
      card_lt[T1, T2] IFF
       (EXISTS (t: T2): TRUE) AND NOT (EXISTS (f: [T1 -> T2]): surjective?(f))


decl_type: formula
theory: card_comp_props
library: sets_aux
signature: nil
location: 40 2 43 46
body:
    card_ge_surj: LEMMA
      card_ge[T1, T2] IFF
       ((EXISTS (t: T1): TRUE) AND (FORALL (t: T2): FALSE)) OR
        (EXISTS (f: [T1 -> T2]): surjective?(f))


decl_type: formula
theory: fun_below_props
library: sets_aux
signature: nil
location: 13 2 14 68
body:
    cartesian_bijection : THEOREM
          (EXISTS (f: [[below[n], below[m]] -> below[n * m]]): bijective?(f))


decl_type: formula
theory: fun_below_props
library: sets_aux
signature: nil
location: 22 2 23 71
body:
    empty_range      : LEMMA m = 0 IMPLIES 
                               (FORALL (f: [below[p]-> below[m]]): FALSE)


decl_type: formula
theory: fun_below_props
library: sets_aux
signature: nil
location: 25 2 26 70
body:
    funset_bijection : THEOREM
          (EXISTS (f: [[below[n] -> below[m]] -> below[m ^ n]]): bijective?(f))


decl_type: tcc
theory: fun_below_props
library: sets_aux
signature: nil
location: 34 0 36 999
body:
  % Subtype TCC generated (at line 26, column 50) for  n
      % expected type  {i: int | m /= 0 OR i >= 0}
  funset_bijection_TCC1: OBLIGATION FORALL (m, n: nat): m /= 0 OR n >= 0;


decl_type: formula
theory: set_of_functions
library: sets_aux
signature: nil
location: 22 2 23 72
body:
    empty_finite_domain1    : LEMMA card(A) = 0 IMPLIES 
                                          (EXISTS (f: [(A) -> (B)]): TRUE)


decl_type: formula
theory: set_of_functions
library: sets_aux
signature: nil
location: 25 2 26 80
body:
    empty_finite_domain2    : LEMMA card(A) = 0 IMPLIES 
                                          (FORALL (f1, f2: [(A) -> (B)]): f1 = f2)


decl_type: formula
theory: set_of_functions
library: sets_aux
signature: nil
location: 28 2 29 73
body:
    empty_finite_range      : LEMMA card(B) = 0 AND card(A) /= 0 IMPLIES 
                                          (FORALL (f: [(A) -> (B)]): FALSE)


decl_type: formula
theory: set_of_functions
library: sets_aux
signature: nil
location: 31 2 32 78
body:
    finite_funset_bijection1: THEOREM card(A) = n AND card(B) = m IMPLIES
           (EXISTS (f: [[(A) -> (B)] -> [below[n] -> below[m]]]): bijective?(f))


decl_type: formula
theory: set_of_functions
library: sets_aux
signature: nil
location: 34 2 35 68
body:
    finite_funset_bijection2: THEOREM card(A) = n AND card(B) = m IMPLIES
           (EXISTS (f: [[(A) -> (B)] -> below[m ^ n]]): bijective?(f))


decl_type: tcc
theory: set_of_functions
library: sets_aux
signature: nil
location: 48 0 52 999
body:
  % Subtype TCC generated (at line 35, column 48) for  n
      % expected type  {i: int | m /= 0 OR i >= 0}
  finite_funset_bijection2_TCC1: OBLIGATION
    FORALL (A: finite_set[T1], B: finite_set[T2], m, n: nat):
      card(B) = m AND card(A) = n IMPLIES m /= 0 OR n >= 0;


decl_type: tcc
theory: set_of_functions
library: sets_aux
signature: nil
location: 54 0 58 999
body:
  % Subtype TCC generated (at line 39, column 41) for  fullset[[(A) -> (B)]]
      % expected type  finite_set[[(A) -> (B)]]
  funset_TCC1: OBLIGATION
    FORALL (A: finite_set[T1], B: finite_set[T2]):
      is_finite[[(A) -> (B)]](fullset[[(A) -> (B)]]);


decl_type: tcc
theory: set_of_functions
library: sets_aux
signature: nil
location: 60 0 64 999
body:
  % Subtype TCC generated (at line 41, column 67) for  card(A)
      % expected type  {i: int | card(B) /= 0 OR i >= 0}
  card_funset_TCC1: OBLIGATION
    FORALL (A: finite_set[T1], B: finite_set[T2]):
      card[T2](B) /= 0 OR card[T1](A) >= 0;


decl_type: formula
theory: power_sets
library: sets_aux
signature: nil
location: 29 2 30 63
body:
    powerset_bijection       : LEMMA (EXISTS (f: [(powerset(S)) -> [(S)->(B)]]):
                                                   bijective?(f))


decl_type: formula
theory: power_sets
library: sets_aux
signature: nil
location: 32 2 33 63
body:
    finite_powerset_bijection: LEMMA (EXISTS (f: [(powerset(A))->(funset(A,B))]):
                                                   bijective?(f))


decl_type: formula
theory: power_sets
library: sets_aux
signature: nil
location: 40 2 41 61
body:
    finite_subset_of_powerset: THEOREM subset?(SS,powerset(A)) 
                                          IMPLIES is_finite(SS)


decl_type: tcc
theory: power_sets
library: sets_aux
signature: nil
location: 48 0 50 999
body:
  % Subtype TCC generated (at line 23, column 23) for  {n | n <= 1}
      % expected type  finite_set[nat]
  B_TCC1: OBLIGATION is_finite[nat]({n | n <= 1});


decl_type: formula
theory: util
library: Bernstein
signature: nil
location: 144 2 150 46
body:
    normalize_lambda_unitbox: LEMMA
      boxbetween?(nvars)(Avars, Bvars, intendpts, boundedpts)(X) AND
      lt_below?(nvars)(Avars,Bvars)
      IMPLIES
      unitbox?(nvars)
                (normalize_lambda(nvars, X, boundedpts)
                                 (Avars, Bvars))


decl_type: formula
theory: util
library: Bernstein
signature: nil
location: 198 2 201 19
body:
    translist_polylist_id: LEMMA  
     FORALL (t:below(terms),v:below(nvars),i:upto(degmono(v))):
       translist(polylist(mpoly,degmono,nvars,terms))(t)(v)(i) =
       mpoly(t)(v)(i)


decl_type: type
theory: util
library: Bernstein
signature: nil
location: 8 2 8 47
body:
    IntervalEndpoints : TYPE = [nat->[bool,bool]]  % Index i represent i-th var. It points to a qualification


decl_type: type
theory: util
library: Bernstein
signature: nil
location: 13 2 13 39
body:
    DegreeMono        : TYPE = [nat->nat] % Index i represents i-th var. It points to the degree of that var.


decl_type: type
theory: util
library: Bernstein
signature: nil
location: 15 2 15 40
body:
    Polynomial        : TYPE = [nat->real] % Index i represents degree i. It points to the coeffient on that


decl_type: type
theory: util
library: Bernstein
signature: nil
location: 21 2 21 47
body:
    MultiPolynomial   : TYPE = [nat->Polyproduct] % Index i points to the ith-term (standard polynomial)


decl_type: type
theory: util
library: Bernstein
signature: nil
location: 22 2 22 47
body:
    MultiBernstein    : TYPE = [nat->Polyproduct] % Index i points to the ith-term (Bernstein polynomial)


decl_type: type
theory: util
library: Bernstein
signature: nil
location: 23 2 23 51
body:
    PolyList          : TYPE = list[list[list[real]]] % List representation of multi-variate polynomial


decl_type: function
theory: util
library: Bernstein
signature: [posnat -> [IntervalEndpoints -> bool]]
location: 55 2 56 68
body:
    closed_box?(nvars)(intendpts) : bool = 
      FORALL (iup:below(nvars)): intendpts(iup)`1 AND intendpts(iup)`2


decl_type: function
theory: util
library: Bernstein
signature: [posnat -> [IntervalEndpoints -> bool]]
location: 61 2 62 71
body:
    bounded_points_true?(nvars)(boundedpts): bool =
      FORALL (i:below(nvars)): LET bpt = boundedpts(i) IN bpt`1 AND bpt`2


decl_type: function
theory: util
library: Bernstein
signature: [[posnat, DegreeMono] -> [CoeffMono -> bool]]
location: 67 2 68 74
body:
    corner_point?(nvars,degmono)(coeffmono): bool =
      FORALL (j:below(nvars)): coeffmono(j) = 0 OR coeffmono(j) = degmono(j)


decl_type: function
theory: util
library: Bernstein
signature:
  [[DegreeMono, posnat, CoeffMono, IntervalEndpoints, nat] ->
  [bool -> bool]]

location: 70 2 74 71
body:
    edge_point?(degmono,nvars,f,intendpts,v)(ep:bool) : bool =
      v <= nvars AND 
      (ep IMPLIES FORALL (i:subrange(v,nvars-1)):
                  f(i) = 0 AND intendpts(i)`1 OR
                  degmono(i)/=0 AND f(i) = degmono(i) AND intendpts(i)`2)


decl_type: function
theory: util
library: Bernstein
signature: [posnat -> [IntervalEndpoints -> bool]]
location: 81 2 82 66
body:
    bounded_points_exclusive?(nvars)(boundedpts): bool = 
      FORALL (ii:below(nvars)): boundedpts(ii)`1 OR boundedpts(ii)`2


decl_type: function
theory: util
library: Bernstein
signature: [posnat -> [[DegreeMono, DegreeMono] -> bool]]
location: 87 2 88 53
body:
    le_below_mono?(nvars)(degmono1,degmono2) : bool = 
      FORALL (j:below(nvars)): degmono1(j)<=degmono2(j)


decl_type: function
theory: util
library: Bernstein
signature: [posnat -> [[CoeffMono, CoeffMono] -> bool]]
location: 90 2 91 56
body:
    eq_below_mono?(nvars)(coeffmono1,coeffmono2) : bool = 
      FORALL (j:below(nvars)): coeffmono1(j)=coeffmono2(j)


decl_type: function
theory: util
library: Bernstein
signature: [[real, real, [bool, bool], [bool, bool]] -> [real -> bool]]
location: 93 2 100 34
body:
    interval_between?(A,B:real,intpt,bdpt:[bool,bool])(xyz:real): bool =
       LET relA: [[real,real]->bool]= IF intpt`1 THEN <= ELSE < ENDIF,    
           relB: [[real,real]->bool]= IF intpt`2 THEN <= ELSE < ENDIF
       IN
        (bdpt`1 AND bdpt`2 IMPLIES A < B) AND
        (bdpt`1 OR bdpt`2) AND
        (bdpt`1 IMPLIES relA(A,xyz)) AND
        (bdpt`2 IMPLIES relB(xyz,B))


decl_type: function
theory: util
library: Bernstein
location: 102 2 104 74
signature:
  [posnat ->
          [[Vars, Vars, IntervalEndpoints, IntervalEndpoints] ->
             [Vars -> bool]]]

body:
    boxbetween?(nvars)(Avars,Bvars,intendpts,boundedpts)(X) : bool =
      FORALL (j:below(nvars)):
       interval_between?(Avars(j),Bvars(j),intendpts(j),boundedpts(j))(X(j))


decl_type: function
theory: util
library: Bernstein
signature:
  [[Vars, Vars, IntervalEndpoints, IntervalEndpoints] ->
  [nat -> [bool, bool]]]

location: 109 2 113 9
body:
    interval_endpoints_inf_trans(Avars,Bvars,intendpts,boundedpts)(i:nat): [bool,bool] =
      IF (boundedpts(i)`1 AND boundedpts(i)`2) THEN intendpts(i)
      ELSIF boundedpts(i)`1 THEN (FALSE,intendpts(i)`1)
      ELSE  (FALSE,intendpts(i)`2)
      ENDIF


decl_type: function
theory: util
library: Bernstein
signature: [[posnat, Vars, IntervalEndpoints] -> [[Vars, Vars] -> Vars]]
location: 117 2 128 11
body:
    denormalize_lambda(nvars,X,boundedpts)(Avars,Bvars) : Vars = 
      LAMBDA (i:nat): 
        IF i < nvars THEN 
          IF (boundedpts(i)`1 AND boundedpts(i)`2) THEN 
            Avars(i) + X(i)*(Bvars(i)-Avars(i))
          ELSIF boundedpts(i)`1 AND X(i)/=0 THEN 
            (1+X(i)*(Avars(i)-1))/X(i)
          ELSIF boundedpts(i)`2 AND X(i)/=0 THEN 
            (-1-X(i)*(-Bvars(i)-1))/X(i)
          ELSE 0 ENDIF
        ELSE 0
        ENDIF


decl_type: function
theory: util
library: Bernstein
signature:
  [d: [posnat, Vars, IntervalEndpoints] ->
  [(lt_below?(d`1)) -> Vars]]

location: 130 2 142 11
body:
    normalize_lambda(nvars,X,boundedpts)(ABvars:(lt_below?(nvars))) : Vars = 
      LAMBDA (i:nat): LET (Avars,Bvars) = ABvars IN 
        IF i < nvars AND (boundedpts(i)`1 IMPLIES 
           X(i)/=Avars(i)-1) AND (boundedpts(i)`2 IMPLIES X(i)/=Bvars(i)+1) THEN
          IF (boundedpts(i)`1 AND boundedpts(i)`2) THEN 
            (X(i)-Avars(i))/(Bvars(i)-Avars(i))
          ELSIF boundedpts(i)`1 THEN 
            1/(X(i)-Avars(i)+1)
          ELSIF boundedpts(i)`2 THEN 
            1/(Bvars(i)+1-X(i))
          ELSE  0 ENDIF
        ELSE 0
        ENDIF


decl_type: function
theory: util
library: Bernstein
location: 154 2 181 17
signature:
  [d:
          [l: list[real], upfrom(length(l)), Vars, Vars,
           IntervalEndpoints] ->
          {norml: listn[real](length(d`1)) |
                   FORALL (i: below(length(d`1))):
                     nth(norml, i) =
                      IF (d`5(i - length(d`1) + d`2)`1 AND
                           d`5(i - length(d`1) + d`2)`2)
                        THEN d`3(i - length(d`1) + d`2) +
                              d`4(i - length(d`1) + d`2) * nth(d`1, i)
                              - d`3(i - length(d`1) + d`2) * nth(d`1, i)
                      ELSIF d`5(i - length(d`1) + d`2)`1 AND
                             nth(d`1, i) /= 0
                        THEN (1 +
                               d`3(i - length(d`1) + d`2) * nth(d`1, i)
                               - nth(d`1, i))
                              / nth(d`1, i)
                      ELSIF d`5(i - length(d`1) + d`2)`2 AND
                             nth(d`1, i) /= 0
                        THEN (nth(d`1, i) - 1 -
                               nth(d`1, i) * -d`4(i - length(d`1) + d`2))
                              / nth(d`1, i)
                      ELSE 0
                      ENDIF}]

body:
    denormalize_listreal_rec(l:list[real],nnvars:upfrom(length(l)),Avars,Bvars,boundedpts): RECURSIVE 
      {norml : listn[real](length(l)) |
               FORALL(i:below(length(l))) :
                 nth(norml,i) = LET n = nnvars-length(l) IN 
                                 IF n+i<nnvars THEN
                                    IF (boundedpts(n+i)`1 AND boundedpts(n+i)`2) THEN 
                                      Avars(n+i) + nth(l,i)*(Bvars(n+i)-Avars(n+i))
                                    ELSIF boundedpts(n+i)`1 AND nth(l,i)/=0 THEN 
                                      (1+nth(l,i)*(Avars(n+i)-1))/nth(l,i)
                                    ELSIF boundedpts(n+i)`2 AND nth(l,i)/=0 THEN 
                                      (-1-nth(l,i)*(-Bvars(n+i)-1))/nth(l,i)
                                    ELSE  0 ENDIF
                                 ELSE 0 ENDIF} =
      CASES l OF
        null : null,
        cons(a,r) : cons(LET n = nnvars-length(l) IN 
                                 IF n<nnvars THEN
                                    IF (boundedpts(n)`1 AND boundedpts(n)`2) THEN 
                                      Avars(n) + a*(Bvars(n)-Avars(n))
                                    ELSIF boundedpts(n)`1 AND a/=0 THEN 
                                      (1+a*(Avars(n)-1))/a
                                    ELSIF boundedpts(n)`2 AND a/=0 THEN 
                                      (-1-a*(-Bvars(n)-1))/a
                                    ELSE  0 ENDIF
                                 ELSE 0 ENDIF,
                         denormalize_listreal_rec(cdr(l),nnvars,Avars,Bvars,boundedpts))
      ENDCASES
    MEASURE l BY <<


decl_type: function
theory: util
library: Bernstein
signature:
  [l: list[real] ->
  [[Vars, Vars, IntervalEndpoints] -> listn[real](length(l))]]

location: 183 2 184 64
body:
    denormalize_listreal(l:list[real])(Avars,Bvars,boundedpts): listn[real](length(l)) =
      denormalize_listreal_rec(l,length(l),Avars,Bvars,boundedpts)


decl_type: function
theory: util
library: Bernstein
signature: [[MultiPolynomial, DegreeMono, posnat, posnat] -> PolyList]
location: 188 2 191 69
body:
    polylist(mpoly,degmono,nvars,terms) : PolyList =
      array2list[list[list[real]]](terms)(LAMBDA(t:nat):
                array2list[list[real]](nvars)(LAMBDA(v:nat):
                          array2list[real](degmono(v)+1)(mpoly(t)(v))))   


decl_type: function
theory: util
library: Bernstein
signature: [PolyList -> [nat -> [nat -> [nat -> real]]]]
location: 193 2 196 74
body:
    translist(mpl:PolyList)(t:nat)(v:nat)(d:nat) : real =
      list2array[real](0)(
                list2array[list[real]](null)(
                          list2array[list[list[real]]](null)(mpl)(t))(v))(d)


decl_type: function
theory: util
library: Bernstein
signature:
  [d: [CoeffMono, posnat] ->
  {l: listn[real](d`2) | unitbox?(d`2)(list2array(0)(l))}]

location: 205 2 207 66
body:
    corner_to_point(f:CoeffMono,nvars): {l : listn[real](nvars) | 
                                             unitbox?(nvars)(list2array(0)(l))} =
      array2list(nvars)(LAMBDA(v:nat):IF f(v)=0 THEN 0 ELSE 1 ENDIF)


decl_type: function
theory: util
library: Bernstein
signature: [posnat -> [[DegreeMono, DegreeMono] -> bool]]
location: 209 2 210 56
body:
    mono_le?(nvars)(degmono1,degmono2): bool = 
      FORALL (ii:below(nvars)): degmono1(ii)<=degmono2(ii)


decl_type: tcc
theory: util
library: Bernstein
signature: nil
location: 225 0 227 999
body:
  % Judgement subtype TCC generated (at line 47, column 30) for  <=
      % expected type  RealOrder
  le_realorder: OBLIGATION realorder?(<=);


decl_type: tcc
theory: util
library: Bernstein
signature: nil
location: 229 0 231 999
body:
  % Judgement subtype TCC generated (at line 48, column 30) for  <
      % expected type  RealOrder
  lt_realorder: OBLIGATION realorder?(<);


decl_type: tcc
theory: util
library: Bernstein
signature: nil
location: 233 0 235 999
body:
  % Judgement subtype TCC generated (at line 49, column 30) for  >=
      % expected type  RealOrder
  ge_realorder: OBLIGATION realorder?(>=);


decl_type: tcc
theory: util
library: Bernstein
signature: nil
location: 237 0 239 999
body:
  % Judgement subtype TCC generated (at line 50, column 30) for  >
      % expected type  RealOrder
  gt_realorder: OBLIGATION realorder?(>);


decl_type: tcc
theory: util
library: Bernstein
signature: nil
location: 241 0 245 999
body:
  % Subtype TCC generated (at line 73, column 18) for  i
      % expected type  nat
  edge_point?_TCC1: OBLIGATION
    FORALL (nvars: posnat, v: nat, ep: bool):
      ep AND v <= nvars IMPLIES (FORALL (i: subrange(v, nvars - 1)): i >= 0);


decl_type: tcc
theory: util
library: Bernstein
signature: nil
location: 247 0 256 999
body:
  % Subtype TCC generated (at line 135, column 27) for  (Bvars(i) - Avars(i))
      % expected type  nznum
  normalize_lambda_TCC1: OBLIGATION
    FORALL (nvars: posnat, X: Vars, boundedpts: IntervalEndpoints,
            ABvars: (lt_below?(nvars)), i: nat, Avars: Vars, Bvars: Vars):
           boundedpts(i)`1 AND boundedpts(i)`2 AND i < nvars
       AND (boundedpts(i)`1 IMPLIES X(i) /= Avars(i) - 1)
       AND (boundedpts(i)`2 IMPLIES X(i) /= Bvars(i) + 1) AND Bvars = ABvars`2
       AND Avars = ABvars`1
       IMPLIES (Bvars(i) - Avars(i)) /= 0;


decl_type: tcc
theory: util
library: Bernstein
signature: nil
location: 258 0 267 999
body:
  % Subtype TCC generated (at line 137, column 13) for  (X(i) - Avars(i) + 1)
      % expected type  nznum
  normalize_lambda_TCC2: OBLIGATION
    FORALL (nvars: posnat, X: Vars, boundedpts: IntervalEndpoints,
            ABvars: (lt_below?(nvars)), i: nat, Avars: Vars, Bvars: Vars):
           boundedpts(i)`1 AND NOT (boundedpts(i)`1 AND boundedpts(i)`2)
       AND i < nvars AND (boundedpts(i)`1 IMPLIES X(i) /= Avars(i) - 1)
       AND (boundedpts(i)`2 IMPLIES X(i) /= Bvars(i) + 1) AND Bvars = ABvars`2
       AND Avars = ABvars`1
       IMPLIES (X(i) - Avars(i) + 1) /= 0;


decl_type: tcc
theory: util
library: Bernstein
signature: nil
location: 269 0 279 999
body:
  % Subtype TCC generated (at line 139, column 13) for  (Bvars(i) + 1 - X(i))
      % expected type  nznum
  normalize_lambda_TCC3: OBLIGATION
    FORALL (nvars: posnat, X: Vars, boundedpts: IntervalEndpoints,
            ABvars: (lt_below?(nvars)), i: nat, Avars: Vars, Bvars: Vars):
           boundedpts(i)`2 AND NOT boundedpts(i)`1
       AND NOT (boundedpts(i)`1 AND boundedpts(i)`2) AND i < nvars
       AND (boundedpts(i)`1 IMPLIES X(i) /= Avars(i) - 1)
       AND (boundedpts(i)`2 IMPLIES X(i) /= Bvars(i) + 1) AND Bvars = ABvars`2
       AND Avars = ABvars`1
       IMPLIES (Bvars(i) + 1 - X(i)) /= 0;


decl_type: tcc
theory: util
library: Bernstein
signature: nil
location: 281 0 286 999
body:
  % Subtype TCC generated (at line 157, column 25) for  i
      % expected type  below[length[real](norml)]
  denormalize_listreal_rec_TCC1: OBLIGATION
    FORALL (l: list[real], norml: listn[real](length[real](l)),
            i: below(length[real](l))):
      i < length[real](norml);


decl_type: tcc
theory: util
library: Bernstein
signature: nil
location: 288 0 294 999
body:
  % Subtype TCC generated (at line 159, column 35) for  n + i
      % expected type  nat
  denormalize_listreal_rec_TCC2: OBLIGATION
    FORALL (l: list[real], nnvars: upfrom(length(l)),
            norml: listn[real](length[real](l)), i: below(length[real](l)),
            n: int):
      n + i < nnvars AND n = nnvars - length(l) IMPLIES n + i >= 0;


decl_type: tcc
theory: util
library: Bernstein
signature: nil
location: 296 0 359 999
body:
  % Subtype TCC generated (at line 168, column 13) for  null
      % expected type  {norml: listn[real](length(l)) |
                     %          FORALL (i: below(length(l))):
                     %            nth(norml, i) =
                     %             IF (boundedpts(i + nnvars - length(l))`1
                     %                 AND
                     %                 boundedpts(i + nnvars - length(l))`2)
                     %               THEN Avars(i + nnvars - length(l))
                     %                    +
                     %                    Bvars(i + nnvars - length(l))
                     %                    *
                     %                    nth(l, i)
                     %                    -
                     %                    Avars(i + nnvars - length(l))
                     %                    *
                     %                    nth(l, i)
                     %             ELSIF boundedpts(i + nnvars - length(l))`1
                     %                   AND
                     %                   nth(l, i) /= 0
                     %               THEN (1
                     %                     +
                     %                     Avars(i + nnvars - length(l))
                     %                     *
                     %                     nth(l, i)
                     %                     -
                     %                     nth(l, i))
                     %                    /
                     %                    nth(l, i)
                     %             ELSIF boundedpts(i + nnvars - length(l))`2
                     %                   AND
                     %                   nth(l, i) /= 0
                     %               THEN (nth(l, i) - 1
                     %                     -
                     %                     nth(l, i)
                     %                     *
                     %                     -Bvars(i + nnvars - length(l)))
                     %                    /
                     %                    nth(l, i)
                     %             ELSE 0
                     %             ENDIF}
  denormalize_listreal_rec_TCC3: OBLIGATION
    FORALL (l: list[real], nnvars: upfrom(length[real](l)), Avars: Vars,
            Bvars: Vars, boundedpts: IntervalEndpoints):
      l = null IMPLIES
       length[real](null[real]) = length[real](l) AND
        (FORALL (i: below(length[real](l))):
           nth[real](null[real], i) =
            IF (boundedpts(i + nnvars - length[real](l))`1 AND
                 boundedpts(i + nnvars - length[real](l))`2)
              THEN Avars(i + nnvars - length[real](l)) +
                    Bvars(i + nnvars - length[real](l)) * nth[real](l, i)
                    - Avars(i + nnvars - length[real](l)) * nth[real](l, i)
            ELSIF boundedpts(i + nnvars - length[real](l))`1 AND
                   nth[real](l, i) /= 0
              THEN (1 + Avars(i + nnvars - length[real](l)) * nth[real](l, i)
                     - nth[real](l, i))
                    / nth[real](l, i)
            ELSIF boundedpts(i + nnvars - length[real](l))`2 AND
                   nth[real](l, i) /= 0
              THEN (nth[real](l, i) - 1 -
                     nth[real](l, i) * -Bvars(i + nnvars - length[real](l)))
                    / nth[real](l, i)
            ELSE 0
            ENDIF);


decl_type: tcc
theory: util
library: Bernstein
signature: nil
location: 361 0 368 999
body:
  % Subtype TCC generated (at line 171, column 35) for  n
      % expected type  nat
  denormalize_listreal_rec_TCC4: OBLIGATION
    FORALL (l: list[real], nnvars: upfrom(length[real](l)), a: real,
            r: list[real]):
      l = cons(a, r) IMPLIES
       (FORALL (n: int):
          n < nnvars AND n = nnvars - length(l) IMPLIES n >= 0);


decl_type: tcc
theory: util
library: Bernstein
signature: nil
location: 370 0 374 999
body:
  % Subtype TCC generated (at line 179, column 52) for  l
      % expected type  (cons?[real])
  denormalize_listreal_rec_TCC5: OBLIGATION
    FORALL (l: list[real], a: real, r: list[real]):
      l = cons(a, r) IMPLIES cons?[real](l);


decl_type: tcc
theory: util
library: Bernstein
signature: nil
location: 376 0 381 999
body:
  % Subtype TCC generated (at line 179, column 55) for  nnvars
      % expected type  upfrom(length(cdr(l)))
  denormalize_listreal_rec_TCC6: OBLIGATION
    FORALL (l: list[real], nnvars: upfrom(length[real](l)), a: real,
            r: list[real]):
      l = cons(a, r) IMPLIES nnvars >= length[real](cdr[real](l));


decl_type: tcc
theory: util
library: Bernstein
signature: nil
location: 383 0 387 999
body:
  % Termination TCC generated (at line 179, column 23) for
      % denormalize_listreal_rec(cdr(l), nnvars, Avars, Bvars, boundedpts)
  denormalize_listreal_rec_TCC7: OBLIGATION
    FORALL (l: list[real], a: real, r: list[real]):
      l = cons(a, r) IMPLIES <<[real](cdr[real](l), l);


decl_type: tcc
theory: util
library: Bernstein
signature: nil
location: 389 0 536 999
body:
  % Subtype TCC generated (at line 169, column 18) for
      % cons(LET n = nnvars - length(l) IN
      %        IF n < nnvars
      %          THEN IF (boundedpts(n)`1 AND boundedpts(n)`2)
      %                 THEN Avars(n) + a * (Bvars(n) - Avars(n))
      %               ELSIF boundedpts(n)`1 AND a /= 0
      %                 THEN (1 + a * (Avars(n) - 1)) / a
      %               ELSIF boundedpts(n)`2 AND a /= 0
      %                 THEN (-1 - a * (-Bvars(n) - 1)) / a
      %               ELSE 0
      %               ENDIF
      %        ELSE 0
      %        ENDIF,
      %      denormalize_listreal_rec(cdr(l),
      %                               nnvars,
      %                               Avars,
      %                               Bvars,
      %                               boundedpts))
      % expected type  {norml: listn[real](length(l)) |
                     %          FORALL (i: below(length(l))):
                     %            nth(norml, i) =
                     %             IF (boundedpts(i + nnvars - length(l))`1
                     %                 AND
                     %                 boundedpts(i + nnvars - length(l))`2)
                     %               THEN Avars(i + nnvars - length(l))
                     %                    +
                     %                    Bvars(i + nnvars - length(l))
                     %                    *
                     %                    nth(l, i)
                     %                    -
                     %                    Avars(i + nnvars - length(l))
                     %                    *
                     %                    nth(l, i)
                     %             ELSIF boundedpts(i + nnvars - length(l))`1
                     %                   AND
                     %                   nth(l, i) /= 0
                     %               THEN (1
                     %                     +
                     %                     Avars(i + nnvars - length(l))
                     %                     *
                     %                     nth(l, i)
                     %                     -
                     %                     nth(l, i))
                     %                    /
                     %                    nth(l, i)
                     %             ELSIF boundedpts(i + nnvars - length(l))`2
                     %                   AND
                     %                   nth(l, i) /= 0
                     %               THEN (nth(l, i) - 1
                     %                     -
                     %                     nth(l, i)
                     %                     *
                     %                     -Bvars(i + nnvars - length(l)))
                     %                    /
                     %                    nth(l, i)
                     %             ELSE 0
                     %             ENDIF}
  denormalize_listreal_rec_TCC8: OBLIGATION
    FORALL (l: list[real],
            v:
              [d1:
                 {z:
                    [l: list[real], upfrom(length(l)), Vars, Vars,
                     IntervalEndpoints] |
                          z`1 << l} ->
                 {norml: listn[real](length(d1`1)) |
                          FORALL (i: below(length(d1`1))):
                            nth(norml, i) =
                             IF (d1`5(i - length(d1`1) + d1`2)`1 AND
                                  d1`5(i - length(d1`1) + d1`2)`2)
                               THEN d1`3(i - length(d1`1) + d1`2) +
                                     d1`4(i - length(d1`1) + d1`2) *
                                      nth(d1`1, i)
                                     -
                                     d1`3(i - length(d1`1) + d1`2) *
                                      nth(d1`1, i)
                             ELSIF d1`5(i - length(d1`1) + d1`2)`1 AND
                                    nth(d1`1, i) /= 0
                               THEN (1 +
                                      d1`3(i - length(d1`1) + d1`2)
                                      *
                                      nth(d1`1, i)
                                      - nth(d1`1, i))
                                     / nth(d1`1, i)
                             ELSIF d1`5(i - length(d1`1) + d1`2)`2 AND
                                    nth(d1`1, i) /= 0
                               THEN (nth(d1`1, i) - 1 -
                                      nth(d1`1, i)
                                      *
                                      -d1`4(i - length(d1`1) + d1`2))
                                     / nth(d1`1, i)
                             ELSE 0
                             ENDIF}],
            nnvars: upfrom(length[real](l)), Avars: Vars, Bvars: Vars,
            boundedpts: IntervalEndpoints, a: real, r: list[real]):
      l = cons(a, r) IMPLIES
       length[real]
           (cons[real]
                (LET n = nnvars - length[real](l) IN
                   IF n < nnvars
                     THEN IF (boundedpts(n)`1 AND boundedpts(n)`2)
                            THEN Avars(n) + a * (Bvars(n) - Avars(n))
                          ELSIF boundedpts(n)`1 AND a /= 0
                            THEN (1 + a * (Avars(n) - 1)) / a
                          ELSIF boundedpts(n)`2 AND a /= 0
                            THEN (-1 - a * (-Bvars(n) - 1)) / a
                          ELSE 0
                          ENDIF
                   ELSE 0
                   ENDIF,
                 v(cdr[real](l), nnvars, Avars, Bvars, boundedpts)))
        = length[real](l)
        AND
        (FORALL (i: below(length[real](l))):
           nth[real]
               (cons[real]
                    (LET n = nnvars - length[real](l) IN
                       IF n < nnvars
                         THEN IF (boundedpts(n)`1 AND boundedpts(n)`2)
                                THEN Avars(n) + a * (Bvars(n) - Avars(n))
                              ELSIF boundedpts(n)`1 AND a /= 0
                                THEN (1 + a * (Avars(n) - 1)) / a
                              ELSIF boundedpts(n)`2 AND a /= 0
                                THEN (-1 - a * (-Bvars(n) - 1)) / a
                              ELSE 0
                              ENDIF
                       ELSE 0
                       ENDIF,
                     v(cdr[real](l), nnvars, Avars, Bvars, boundedpts)),
                i)
            =
            IF (boundedpts(i + nnvars - length[real](l))`1 AND
                 boundedpts(i + nnvars - length[real](l))`2)
              THEN Avars(i + nnvars - length[real](l)) +
                    Bvars(i + nnvars - length[real](l)) * nth[real](l, i)
                    - Avars(i + nnvars - length[real](l)) * nth[real](l, i)
            ELSIF boundedpts(i + nnvars - length[real](l))`1 AND
                   nth[real](l, i) /= 0
              THEN (1 + Avars(i + nnvars - length[real](l)) * nth[real](l, i)
                     - nth[real](l, i))
                    / nth[real](l, i)
            ELSIF boundedpts(i + nnvars - length[real](l))`2 AND
                   nth[real](l, i) /= 0
              THEN (nth[real](l, i) - 1 -
                     nth[real](l, i) * -Bvars(i + nnvars - length[real](l)))
                    / nth[real](l, i)
            ELSE 0
            ENDIF);


decl_type: tcc
theory: util
library: Bernstein
signature: nil
location: 538 0 541 999
body:
  % Subtype TCC generated (at line 184, column 31) for  length(l)
      % expected type  upfrom(length(l))
  denormalize_listreal_TCC1: OBLIGATION
    FORALL (l: list[real]): length[real](l) >= length[real](l);


decl_type: tcc
theory: util
library: Bernstein
signature: nil
location: 543 0 554 999
body:
  % Subtype TCC generated (at line 207, column 4) for
      % array2list(nvars)(LAMBDA (v: nat): IF f(v) = 0 THEN 0 ELSE 1 ENDIF)
      % expected type  {l: listn[real](nvars) |
                     %          unitbox?(nvars)(list2array(0)(l))}
  corner_to_point_TCC1: OBLIGATION
    FORALL (f: CoeffMono, nvars: posnat):
      unitbox?(nvars)
              (list2array[real]
                   (0)
                   (array2list[real]
                        (nvars)
                        (LAMBDA (v: nat): IF f(v) = 0 THEN 0 ELSE 1 ENDIF)));


decl_type: function
theory: boxes_def
library: Bernstein
signature: [d: [nat, [real -> real], posnat] -> [Box(d`3) -> Box(d`3)]]
location: 13 2 16 4
body:
    setnth_box(v:nat,f:[real->real],n:posnat)(box:Box(n)) : Box(n) = (#
      vars_lb := setnth(box`vars_lb,v,f),
      vars_ub := setnth(box`vars_ub,v,f)
    #)


decl_type: function
theory: boxes_def
library: Bernstein
signature:
  [d: [n: posnat, [listn[real](n) -> listn[real](n)]] ->
  [Box(d`1) -> Box(d`1)]]

location: 18 2 21 4
body:
    map_box(n:posnat,f:[listn(n)->listn(n)])(box:Box(n)) : Box(n) = (#
      vars_lb := f(box`vars_lb),
      vars_ub := f(box`vars_ub)
    #)


decl_type: function
theory: boxes_def
library: Bernstein
signature: [n: posnat -> Box(n)]
location: 23 2 26 4
body:
    unitbox(n:posnat) : Box(n) = (#
      vars_lb := array2list(n)(zeroes),
      vars_ub := array2list(n)(ones)
    #)


decl_type: function
theory: boxes_def
library: Bernstein
signature:
  [d: [n: posnat, list[Box(n)], list[Box(n)], list[Box(n)]] ->
  Boxes(d`1)]

location: 34 2 38 4
body:
    mk_boxes(n:posnat,inside,outside,unknown:list[Box(n)]) : Boxes(n) = (#
      inside  := inside,
      outside := outside,
      unknown := unknown
    #)


decl_type: function
theory: boxes_def
library: Bernstein
signature: [[n: posnat, Box(n)] -> real]
location: 40 2 41 85
body:
    volume(n:posnat,box:Box(n)): real =
      product[below(n)](0,n-1,LAMBDA(i:below(n)):nth(box`vars_ub,i)-nth(box`vars_lb,i))


decl_type: tcc
theory: boxes_def
library: Bernstein
signature: nil
location: 48 0 53 999
body:
  % Subtype TCC generated (at line 14, column 15) for
      % setnth(box`vars_lb, v, f)
      % expected type  listn[real](n)
  setnth_box_TCC1: OBLIGATION
    FORALL (v: nat, f: [real -> real], n: posnat, box: Box(n)):
      length[real](setnth[real](box`vars_lb, v, f)) = n;


decl_type: tcc
theory: boxes_def
library: Bernstein
signature: nil
location: 55 0 60 999
body:
  % Subtype TCC generated (at line 15, column 15) for
      % setnth(box`vars_ub, v, f)
      % expected type  listn[real](n)
  setnth_box_TCC2: OBLIGATION
    FORALL (v: nat, f: [real -> real], n: posnat, box: Box(n)):
      length[real](setnth[real](box`vars_ub, v, f)) = n;


decl_type: tcc
theory: boxes_def
library: Bernstein
signature: nil
location: 62 0 66 999
body:
  % Subtype TCC generated (at line 41, column 22) for  0
      % expected type  T_low[below(n)]
  volume_TCC1: OBLIGATION
    FORALL (n: posnat, box: Box(n)):
      0 >= 0 AND 0 < n OR (EXISTS (j: below(n)): j <= 0);


decl_type: tcc
theory: boxes_def
library: Bernstein
signature: nil
location: 68 0 72 999
body:
  % Subtype TCC generated (at line 41, column 24) for  n - 1
      % expected type  T_high[below(n)]
  volume_TCC2: OBLIGATION
    FORALL (n: posnat, box: Box(n)):
      n - 1 >= 0 AND n - 1 < n OR (EXISTS (j: below(n)): n - 1 <= j);


decl_type: tcc
theory: boxes_def
library: Bernstein
signature: nil
location: 74 0 78 999
body:
  % Subtype TCC generated (at line 41, column 63) for  i
      % expected type  below[length[real](box`vars_ub)]
  volume_TCC3: OBLIGATION
    FORALL (n: posnat, box: Box(n), i: below(n)):
      i < length[real](box`vars_ub);


decl_type: tcc
theory: boxes_def
library: Bernstein
signature: nil
location: 80 0 84 999
body:
  % Subtype TCC generated (at line 41, column 82) for  i
      % expected type  below[length[real](box`vars_lb)]
  volume_TCC4: OBLIGATION
    FORALL (n: posnat, box: Box(n), i: below(n)):
      i < length[real](box`vars_lb);


decl_type: tcc
theory: boxes_def
library: Bernstein
signature: nil
location: 86 0 91 999
body:
  % Assuming TCC generated (at line 24, column 4) for  reals@product[below(n)]
      % generated from assumption product.connected_domain
  volume_TCC5: OBLIGATION
    FORALL (n: posnat, box: Box(n)):
      (FORALL (x, y: below(n)), (z: integer):
         x <= z AND z <= y IMPLIES z >= 0 AND z < n);


decl_type: formula
theory: minmax
library: Bernstein
signature: nil
location: 100 2 102 41
body:
    between_combine_lr : LEMMA
      between?(omm,combine(omm1,omm2)) IFF
      between?(omm,combine_lr(v,omm1,omm2))


decl_type: type
theory: minmax
library: Bernstein
signature: nil
location: 15 2 21 26
body:
    Outminmax   : TYPE = [# lb_min,lb_max:real,
                            lb_var: list[real],
                            ub_max,ub_min:real,
                            ub_var: list[real],
                            max_depth : nat,
                            splits : nat
                          #]


decl_type: function
theory: minmax
library: Bernstein
signature: [[real, real, list[real], nat] -> Outminmax]
location: 29 2 38 4
body:
    single_outminmax(a,b,l,depth): Outminmax = (# 
      lb_min := a,
      lb_max := b,
      lb_var := l,
      ub_max := a,
      ub_min := b,
      ub_var := l,
      max_depth := depth,
      splits    := 0 
    #)


decl_type: function
theory: minmax
library: Bernstein
signature: [[nat, [real -> real]] -> [Outminmax -> Outminmax]]
location: 43 2 49 8
body:
    outminmax_translate(j:nat,rf)(omm): Outminmax =
      IF j < length(omm`lb_var) AND j<length(omm`ub_var) THEN
       omm WITH [lb_var := setnth(omm`lb_var,j,rf),
                 ub_var := setnth(omm`ub_var,j,rf)]
     ELSE
       omm
     ENDIF


decl_type: function
theory: minmax
library: Bernstein
signature: [nat -> [Outminmax -> bool]]
location: 51 2 53 63
body:
    length_eq?(nvars)(omm): bool = 
      (cons?(omm`lb_var) OR cons?(omm`ub_var)) IMPLIES 
        length(omm`lb_var) = nvars AND length(omm`ub_var) = nvars


decl_type: function
theory: minmax
library: Bernstein
signature: [[Outminmax, Outminmax] -> Outminmax]
location: 56 2 74 6
body:
    combine(omm1,omm2): Outminmax =
      LET lbmax = IF    null?(omm1`lb_var) THEN omm2
                  ELSIF null?(omm2`lb_var) OR omm1`lb_max <= omm2`lb_max THEN omm1 
                  ELSE  omm2 
                  ENDIF,
          ubmin = IF    null?(omm1`ub_var) THEN omm2
                  ELSIF null?(omm2`ub_var) OR omm1`ub_min >= omm2`ub_min THEN omm1 
                  ELSE  omm2 
                  ENDIF
      IN (#
        lb_min    := min(omm1`lb_min,omm2`lb_min),
        lb_max    := IF null?(lbmax`lb_var) THEN 0 ELSE lbmax`lb_max ENDIF,
        lb_var    := lbmax`lb_var,
        ub_max    := max(omm1`ub_max,omm2`ub_max),
        ub_min    := IF null?(ubmin`ub_var) THEN 0 ELSE ubmin`ub_min ENDIF,
        ub_var    := ubmin`ub_var,
        max_depth := max(omm1`max_depth,omm2`max_depth),
        splits    := 0
      #)


decl_type: function
theory: minmax
library: Bernstein
signature: [[nat, Outminmax, Outminmax] -> Outminmax]
location: 77 2 81 5
body:
    combine_lr(v,omm1,omm2): Outminmax = 
      combine(outminmax_translate(v,LAMBDA(x:real):x/2)(omm1),
              outminmax_translate(v,LAMBDA(x:real):(x+1)/2)(omm2)) WITH [
        splits := omm1`splits + omm2`splits + 1
      ]


decl_type: function
theory: minmax
library: Bernstein
signature: [[nat, Outminmax, Outminmax] -> Outminmax]
location: 84 2 87 5
body:
    combine_l(v,omm1,omm2): Outminmax = 
      combine(outminmax_translate(v,LAMBDA(x:real):x/2)(omm1),omm2)  WITH [
         splits := omm1`splits + 1
      ]


decl_type: function
theory: minmax
library: Bernstein
signature: [[nat, Outminmax, Outminmax] -> Outminmax]
location: 90 2 93 5
body:
    combine_r(v,omm1,omm2): Outminmax = 
      combine(outminmax_translate(v,LAMBDA(x:real):(x+1)/2)(omm1),omm2)  WITH [
        splits := omm1`splits + 1
      ]


decl_type: function
theory: minmax
library: Bernstein
signature: [[Outminmax, Outminmax] -> bool]
location: 96 2 98 61
body:
    between?(omm1,omm2): bool = 
      cons?(omm1`lb_var) AND cons?(omm1`ub_var) AND 
      omm1`lb_max <= omm2`lb_min AND omm2`ub_max <= omm1`ub_min


decl_type: function
theory: minmax
library: Bernstein
signature: [Outminmax -> bool]
location: 104 2 110 31
body:
    pre_sound?(omm:Outminmax) : bool =
      length(omm`lb_var) = length(omm`ub_var) AND
      omm`lb_min <= omm`ub_max AND
      (cons?(omm`lb_var) IMPLIES 
        omm`lb_min <= omm`lb_max AND
        omm`ub_min <= omm`ub_max AND
        omm`lb_max <= omm`ub_min)


decl_type: function
theory: minmax
library: Bernstein
signature: [posreal -> [Outminmax -> bool]]
location: 112 2 114 61
body:
    eps_localexit(e)(omm): bool = 
      cons?(omm`lb_var) AND cons?(omm`ub_var) AND 
      omm`lb_max-omm`lb_min <= e AND omm`ub_max-omm`ub_min <= e


decl_type: function
theory: minmax
library: Bernstein
signature: [[real, real, real, list[real], nat] -> Outminmax]
location: 123 2 132 4
body:
    single_max_outminmax(a,b,d,l,depth): Outminmax = (# 
      lb_min    := b,
      lb_max    := d,
      lb_var    := l,
      ub_max    := a,
      ub_min    := d,
      ub_var    := l,
      max_depth := depth,
      splits    := 0 
    #)


decl_type: function
theory: minmax
library: Bernstein
signature: [[Outminmax, Outminmax] -> Outminmax]
location: 135 2 149 9
body:
    combine_max(omm1,omm2): Outminmax =
      IF    omm1`lb_min >= omm2`ub_max THEN omm1
      ELSIF omm2`lb_min >= omm1`ub_max THEN omm2
      ELSE
       (#
        lb_min    := min(omm1`lb_min,omm2`lb_min),
        lb_max    := 0,
        lb_var    := null,
        ub_max    := max(omm1`ub_max,omm2`ub_max),
        ub_min    := 0,
        ub_var    := null,
        max_depth := max(omm1`max_depth,omm1`max_depth),
        splits    := 0
       #)
      ENDIF


decl_type: function
theory: minmax
library: Bernstein
signature: [RealOrder -> [Outminmax -> bool]]
location: 153 2 157 41
body:
    rel_localexit(rel)(omm)  : bool = IF rel(0,1) THEN % Case < 0 or <= 0
                                        rel(omm`ub_max,0)
                                      ELSE % Case > 0 or >= 0
                                        rel(omm`lb_min,0)
                                      ENDIF


decl_type: function
theory: minmax
library: Bernstein
signature: [RealOrder -> [Outminmax -> bool]]
location: 159 2 163 40
body:
    rel_counterex(rel)(omm) : bool = IF rel(0,1) THEN % Case < 0 or <= 0
                                       cons?(omm`ub_var) AND NOT rel(omm`ub_min,0) 
                                     ELSE % Case > 0 or >= 0
                                       cons?(omm`lb_var) AND NOT rel(omm`lb_max,0)
                                     ENDIF


decl_type: function
theory: minmax
library: Bernstein
signature: [[RealOrder, nat, bool] -> [Outminmax -> bool]]
location: 165 2 167 27
body:
    rel_globalexit(rel,depth,exitatdepth)(omm) : bool = 
      (exitatdepth AND omm`max_depth = depth) OR
      rel_counterex(rel)(omm)


decl_type: function
theory: minmax
library: Bernstein
signature: [[Outminmax -> bool] -> bool]
location: 169 2 175 49
body:
    globalexit_inv?(globalexit:[Outminmax->bool]) : bool =
      (FORALL(omm1,omm2): globalexit(omm1) IMPLIES 
        globalexit(combine(omm1,omm2))) AND
      (FORALL(n:nat,omm) : globalexit(omm) IMPLIES
        globalexit(omm WITH [splits:= n])) AND
      (FORALL(j:nat,rf,omm) : globalexit(omm) IMPLIES
        globalexit(outminmax_translate(j,rf)(omm)))


decl_type: function
theory: minmax
library: Bernstein
signature: [[Outminmax -> bool] -> bool]
location: 183 2 189 48
body:
    localexit_inv?(localexit:[Outminmax->bool]) : bool = 
      (FORALL(omm1,omm2): localexit(omm1) AND localexit(omm2) IMPLIES 
        localexit(combine(omm1,omm2))) AND
      (FORALL(n:nat,omm) : localexit(omm) IMPLIES
        localexit(omm WITH [splits:= n])) AND
      (FORALL(j:nat,rf,omm) : localexit(omm) IMPLIES
        localexit(outminmax_translate(j,rf)(omm)))


decl_type: tcc
theory: minmax
library: Bernstein
signature: nil
location: 202 0 205 999
body:
  % Judgement subtype TCC generated (at line 178, column 4) for
      % false_globalexit
      % expected type  (globalexit_inv?)
  false_globalexit_inv: OBLIGATION globalexit_inv?(false_globalexit);


decl_type: tcc
theory: minmax
library: Bernstein
signature: nil
location: 207 0 210 999
body:
  % Judgement subtype TCC generated (at line 192, column 4) for
      % eps_localexit(e)
      % expected type  (localexit_inv?)
  eps_localexit_inv: OBLIGATION FORALL (e): localexit_inv?(eps_localexit(e));


decl_type: tcc
theory: minmax
library: Bernstein
signature: nil
location: 212 0 216 999
body:
  % Judgement subtype TCC generated (at line 195, column 4) for
      % rel_localexit(rel)
      % expected type  (localexit_inv?)
  rel_localexit_inv: OBLIGATION
    FORALL (rel): localexit_inv?(rel_localexit(rel));


decl_type: formula
theory: multi_bernstein
library: Bernstein
signature: nil
location: 53 2 55 66
body:
    multibs_eval_1_term: LEMMA 
      multibs_eval(bspoly,bsdegmono,cf,nvars,1)(X) = 
      multibs_eval_rec(bspoly,bsdegmono,cf,nvars,1,nvars)(zeroes)(X)


decl_type: formula
theory: multi_bernstein
library: Bernstein
signature: nil
location: 57 2 59 70
body:
    multibs_eval_equiv: LEMMA 
      multibs_eval(bspoly,bsdegmono,cf,nvars,terms)(X) = 
      multibs_eval_rec(bspoly,bsdegmono,cf,nvars,terms,nvars)(zeroes)(X)


decl_type: formula
theory: multi_bernstein
library: Bernstein
signature: nil
location: 61 2 64 52
body:
    multibs_eval_below_mono: LEMMA 
      (FORALL (i:below(nvars)): X(i) = Y(i)) IMPLIES
      multibs_eval(bspoly,bsdegmono,cf,nvars,terms)(X) =
      multibs_eval(bspoly,bsdegmono,cf,nvars,terms)(Y)


decl_type: formula
theory: multi_bernstein
library: Bernstein
signature: nil
location: 66 2 71 51
body:
    multibs_eval_id : LEMMA
      FORALL (bspoly,bspolz,bsdegmono,cf,nvars,terms): 
        (FORALL(t:below(terms),v:below(nvars),i:upto(bsdegmono(v))):
         bspoly(t)(v)(i) = bspolz(t)(v)(i)) IMPLIES
        multibs_eval(bspoly,bsdegmono,cf,nvars,terms) =
        multibs_eval(bspolz,bsdegmono,cf,nvars,terms)


decl_type: formula
theory: multi_bernstein
library: Bernstein
signature: nil
location: 79 2 83 61
body:
    multibscoeff_id: LEMMA
      eq_below_mono?(nvars)(coeffmono1,coeffmono2)
      IMPLIES
      multibscoeff(bspoly,bsdegmono,cf,nvars,terms)(coeffmono1) =
      multibscoeff(bspoly,bsdegmono,cf,nvars,terms)(coeffmono2)


decl_type: formula
theory: multi_bernstein
library: Bernstein
signature: nil
location: 95 2 98 78
body:
    Bern_coeffs_rel_implic: LEMMA 
      (FORALL (x:real): rel(x,a) IMPLIES rel(x,a1)) AND
      Bern_coeffs_rel_rec(bspoly,bsdegmono,cf,nvars,terms,v)(coeffmono,rel,a) IMPLIES
        Bern_coeffs_rel_rec(bspoly,bsdegmono,cf,nvars,terms,v)(coeffmono,rel,a1)    


decl_type: formula
theory: multi_bernstein
library: Bernstein
signature: nil
location: 100 2 103 73
body:
    Bern_coeffs_rel_def: LEMMA 
      Bern_coeffs_rel(bspoly,bsdegmono,cf,nvars,terms)(rel,a) IFF 
        (FORALL (coeffmono): le_below_mono?(nvars)(coeffmono,bsdegmono) IMPLIES 
           rel(multibscoeff(bspoly,bsdegmono,cf,nvars,terms)(coeffmono),a))


decl_type: formula
theory: multi_bernstein
library: Bernstein
signature: nil
location: 105 2 110 62
body:
    multibs_cornerpoint_coeff: LEMMA
      LET X = LAMBDA (i:nat): IF coeffmono(i)=0 THEN 0 ELSE 1 ENDIF
      IN
        corner_point?(nvars,bsdegmono)(coeffmono) IMPLIES
        multibs_eval(bspoly,bsdegmono,cf,nvars,terms)(X) =
        multibscoeff(bspoly,bsdegmono,cf,nvars,terms)(coeffmono)


decl_type: formula
theory: multi_bernstein
library: Bernstein
signature: nil
location: 118 2 123 53
body:
    forall_X_id : LEMMA
      FORALL (bspoly,bspolz,bsdegmono,nvars,terms,rel,a): 
        (FORALL(t:below(terms),v:below(nvars),i:upto(bsdegmono(v))):
         bspoly(t)(v)(i) = bspolz(t)(v)(i)) IMPLIES
        forall_X(bspoly,bsdegmono,cf,nvars,terms,rel,a) =
        forall_X(bspolz,bsdegmono,cf,nvars,terms,rel,a)


decl_type: formula
theory: multi_bernstein
library: Bernstein
signature: nil
location: 133 2 138 66
body:
    forall_X_between_id : LEMMA
      FORALL (amin,amax:real)(bspoly,bspolz,bsdegmono,nvars,terms): 
        (FORALL(t:below(terms),v:below(nvars),i:upto(bsdegmono(v))):
         bspoly(t)(v)(i) = bspolz(t)(v)(i)) IMPLIES
        forall_X_between(amin,amax)(bspoly,bsdegmono,cf,nvars,terms) =
        forall_X_between(amin,amax)(bspolz,bsdegmono,cf,nvars,terms)


decl_type: formula
theory: multi_bernstein
library: Bernstein
signature: nil
location: 169 2 171 85
body:
    Bern_coeffs_endpoints_rel_def: LEMMA 
     forall_X(bspoly,bsdegmono,cf,nvars,terms,rel,a) IMPLIES
     null?(Bern_coeffs_endpoints_rel(bspoly,bsdegmono,cf,nvars,terms,intendpts)(rel,a))


decl_type: formula
theory: multi_bernstein
library: Bernstein
signature: nil
location: 173 2 177 85
body:
    Bern_coeffs_counterexample: LEMMA 
      LET listex = Bern_coeffs_endpoints_rel(bspoly,bsdegmono,cf,nvars,terms,intendpts)(rel,a) IN
      cons?(listex) IMPLIES 
        length(listex) = nvars AND
        NOT rel(multibs_eval(bspoly,bsdegmono,cf,nvars,terms)(list2array(0)(listex)),a)


decl_type: formula
theory: multi_bernstein
library: Bernstein
signature: nil
location: 181 2 183 52
body:
    Bern_le: LEMMA 
      Bern_coeffs_rel(bspoly,bsdegmono,cf,nvars,terms)(<=,a) IMPLIES
        forall_X(bspoly,bsdegmono,cf,nvars,terms,<=,a)


decl_type: formula
theory: multi_bernstein
library: Bernstein
signature: nil
location: 185 2 187 50
body:
    Bern_lt: LEMMA 
      Bern_coeffs_rel(bspoly,bsdegmono,cf,nvars,terms)(<,a) IMPLIES
       forall_X(bspoly,bsdegmono,cf,nvars,terms,<,a)


decl_type: formula
theory: multi_bernstein
library: Bernstein
signature: nil
location: 189 2 191 52
body:
    Bern_ge: LEMMA 
      Bern_coeffs_rel(bspoly,bsdegmono,cf,nvars,terms)(>=,a) IMPLIES
        forall_X(bspoly,bsdegmono,cf,nvars,terms,>=,a)


decl_type: formula
theory: multi_bernstein
library: Bernstein
signature: nil
location: 193 2 195 51
body:
    Bern_gt: LEMMA 
      Bern_coeffs_rel(bspoly,bsdegmono,cf,nvars,terms)(>,a) IMPLIES
        forall_X(bspoly,bsdegmono,cf,nvars,terms,>,a)


decl_type: formula
theory: multi_bernstein
library: Bernstein
signature: nil
location: 197 2 199 57
body:
    Bern_rel : LEMMA
      Bern_coeffs_rel(bspoly,bsdegmono,cf,nvars,terms)(relreal,a) IMPLIES
        forall_X(bspoly,bsdegmono,cf,nvars,terms,relreal,a)


decl_type: formula
theory: multi_bernstein
library: Bernstein
signature: nil
location: 201 2 208 67
body:
    forall_X_between_minmax : LEMMA
      FORALL (amin,amax:real) :
        (FORALL(coeffmono):
         le_below_mono?(nvars)(coeffmono,bsdegmono) IMPLIES
         amin <= multibscoeff(bspoly, bsdegmono, cf, nvars, terms)(coeffmono) AND
         multibscoeff(bspoly, bsdegmono, cf, nvars, terms)(coeffmono) <= amax)
       IMPLIES
         forall_X_between(amin,amax)(bspoly,bsdegmono,cf,nvars,terms)


decl_type: formula
theory: multi_bernstein
library: Bernstein
signature: nil
location: 239 2 243 49
body:
    Bern_split_bspoly : LEMMA FORALL (i:nat,rel): i<nvars IMPLIES
        ((forall_X(Bern_split_left_mpoly(bspoly,bsdegmono)(i),bsdegmono,cf,nvars,terms,rel,a) AND
          forall_X(Bern_split_right_mpoly(bspoly,bsdegmono)(i),bsdegmono,cf,nvars,terms,rel,a))
          IFF
          forall_X(bspoly,bsdegmono,cf,nvars,terms,rel,a))


decl_type: formula
theory: multi_bernstein
library: Bernstein
signature: nil
location: 245 2 249 58
body:
    Bern_eval_left: LEMMA
      rel(multibs_eval(bspoly, bsdegmono, cf, nvars, terms)(X),a) IMPLIES
      LET Xmid = X WITH [(v) := 2*X(v)] IN
      rel(multibs_eval(LAMBDA (k: nat):Bern_split_left_mono(bspoly(k), bsdegmono)(v),
                       bsdegmono, cf, nvars, terms)(Xmid),a)


decl_type: formula
theory: multi_bernstein
library: Bernstein
signature: nil
location: 251 2 255 56
body:
    Bern_eval_left_def: LEMMA
      LET Xmid = X WITH [(v) := 2*X(v)] IN
      multibs_eval(LAMBDA (k: nat):Bern_split_left_mono(bspoly(k), bsdegmono)(v),
                       bsdegmono, cf, nvars, terms)(Xmid) =
      multibs_eval(bspoly, bsdegmono, cf, nvars, terms)(X)


decl_type: formula
theory: multi_bernstein
library: Bernstein
signature: nil
location: 258 2 262 58
body:
    Bern_eval_right: LEMMA
      rel(multibs_eval(bspoly, bsdegmono, cf, nvars, terms)(X),a) IMPLIES
      LET Xmid = X WITH [(v) := 2*X(v)-1] IN
      rel(multibs_eval(LAMBDA (k: nat):Bern_split_right_mono(bspoly(k), bsdegmono)(v),
                       bsdegmono, cf, nvars, terms)(Xmid),a)


decl_type: formula
theory: multi_bernstein
library: Bernstein
signature: nil
location: 264 2 268 56
body:
    Bern_eval_right_def: LEMMA
      LET Xmid = X WITH [(v) := 2*X(v)-1] IN
      multibs_eval(LAMBDA (k: nat):Bern_split_right_mono(bspoly(k), bsdegmono)(v),
                       bsdegmono, cf, nvars, terms)(Xmid)=
      multibs_eval(bspoly, bsdegmono, cf, nvars, terms)(X)


decl_type: formula
theory: multi_bernstein
library: Bernstein
signature: nil
location: 307 2 311 58
body:
    Bern_sweep_eval_left: LEMMA
      rel(multibs_eval(bspoly, bsdegmono, cf, nvars, terms)(X),a) IMPLIES
      LET Xmid = X WITH [(v) := 2*X(v)] IN
      rel(multibs_eval(LAMBDA (k: nat):Bern_sweep_left(bspoly(k), bsdegmono)(v),
                       bsdegmono, cf, nvars, terms)(Xmid),a)


decl_type: formula
theory: multi_bernstein
library: Bernstein
signature: nil
location: 313 2 317 58
body:
    Bern_sweep_eval_right: LEMMA
      rel(multibs_eval(bspoly, bsdegmono, cf, nvars, terms)(X),a) IMPLIES
      LET Xmid = X WITH [(v) := 2*X(v)-1] IN
      rel(multibs_eval(LAMBDA (k: nat):Bern_sweep_right(bspoly(k), bsdegmono)(v),
                       bsdegmono, cf, nvars, terms)(Xmid),a)


decl_type: function
theory: multi_bernstein
library: Bernstein
signature: [[Polyproduct, DegreeMono, posnat] -> [Vars -> real]]
location: 29 2 33 45
body:
    bsproduct_eval(pprod,bsdegmono,nvars)(X) : real = 
      product(0,nvars-1,LAMBDA (i:nat):sigma(0,bsdegmono(i),
                        LAMBDA (j:nat): IF j > bsdegmono(i) THEN 0 
                                        ELSE pprod(i)(j)*Bern(j,bsdegmono(i))(X(i)) 
                                        ENDIF))


decl_type: function
theory: multi_bernstein
library: Bernstein
signature:
  [[MultiBernstein, DegreeMono, Coeff, posnat, posnat] ->
  [Vars -> real]]

location: 35 2 36 87
body:
    multibs_eval(bspoly,bsdegmono,cf,nvars,terms)(X) : real =
      sigma(0,terms-1,LAMBDA (i:nat): cf(i)*bsproduct_eval(bspoly(i),bsdegmono,nvars)(X))


decl_type: function
theory: multi_bernstein
library: Bernstein
signature:
  [[MultiBernstein, DegreeMono, Coeff, posnat, posnat] ->
  [CoeffMono -> real]]

location: 40 2 41 104
body:
    multibs_eval_mono(bspoly,bsdegmono,cf,nvars,terms)(coeffmono) : real = 
      sigma(0,terms-1,LAMBDA (i:nat): cf(i)*product(0,nvars-1,LAMBDA (j:nat): bspoly(i)(j)(coeffmono(j))))


decl_type: function
theory: multi_bernstein
library: Bernstein
signature:
  [[MultiBernstein, DegreeMono, Coeff, posnat, posnat, nat] ->
  [CoeffMono -> [Vars -> real]]]

location: 43 2 51 19
body:
    multibs_eval_rec(bspoly,bsdegmono,cf,nvars,terms,v)
                    (f:CoeffMono)(X) : RECURSIVE real =
      IF v = 0 THEN multibs_eval_mono(bspoly,bsdegmono,cf,nvars,terms)(f)*
                    product(0,nvars-1,LAMBDA (k:nat): IF f(k)<=bsdegmono(k) THEN 
                                                        Bern(f(k),bsdegmono(k))(X(k)) 
                                                      ELSE 1 ENDIF)
      ELSE sigma(0,bsdegmono(v-1),LAMBDA (d:nat): LET nf = f WITH [(v-1) := d] IN 
        multibs_eval_rec(bspoly,bsdegmono,cf,nvars,terms,v-1)(nf)(X))
      ENDIF MEASURE v


decl_type: function
theory: multi_bernstein
library: Bernstein
signature:
  [[MultiBernstein, DegreeMono, Coeff, posnat, posnat] ->
  [CoeffMono -> real]]

location: 75 2 77 94
body:
    multibscoeff(bspoly,bsdegmono,cf,nvars,terms)(coeffmono) : real = 
      sigma(0,terms-1,
            LAMBDA (i:nat): cf(i)*product(0,nvars-1,LAMBDA (j:nat): bspoly(i)(j)(coeffmono(j))))


decl_type: function
theory: multi_bernstein
library: Bernstein
location: 85 2 90 19
signature:
  [[MultiBernstein, DegreeMono, Coeff, posnat, posnat, nat] ->
          [[CoeffMono, [[real, real] -> bool], real] -> bool]]

body:
    Bern_coeffs_rel_rec(bspoly,bsdegmono,cf,nvars,terms,v)
                       (f:CoeffMono,rel:[[real,real]->bool],a:real) : RECURSIVE bool =
      IF v = 0 THEN rel(multibscoeff(bspoly,bsdegmono,cf,nvars,terms)(f),a)
      ELSE FORALL (d:upto(bsdegmono(v-1))): LET nf = f WITH [(v-1) := d] IN 
        Bern_coeffs_rel_rec(bspoly,bsdegmono,cf,nvars,terms,v-1)(nf,rel,a)
      ENDIF MEASURE v


decl_type: function
theory: multi_bernstein
library: Bernstein
location: 92 2 93 76
signature:
  [[MultiBernstein, DegreeMono, Coeff, posnat, posnat] ->
          [[[[real, real] -> bool], real] -> bool]]

body:
    Bern_coeffs_rel(bspoly,bsdegmono,cf,nvars,terms)(rel,a) : bool = 
      Bern_coeffs_rel_rec(bspoly,bsdegmono,cf,nvars,terms,nvars)(zeroes,rel,a)


decl_type: function
theory: multi_bernstein
library: Bernstein
location: 114 2 116 61
signature:
  [[MultiBernstein, DegreeMono, Coeff, posnat, posnat,
         [[real, real] -> bool], real] ->
          bool]

body:
    forall_X(bspoly,bsdegmono,cf,nvars,terms,rel,a) : bool =
      FORALL (X): unitbox?(nvars)(X) IMPLIES 
        rel(multibs_eval(bspoly,bsdegmono,cf,nvars,terms)(X),a)


decl_type: function
theory: multi_bernstein
library: Bernstein
location: 125 2 127 62
signature:
  [[real, real] ->
          [[MultiBernstein, DegreeMono, Coeff, posnat, posnat] ->
             [Vars -> bool]]]

body:
    eval_X_between(amin,amax:real)(bspoly,bsdegmono,cf,nvars,terms)(X) : MACRO bool =
        amin <= multibs_eval(bspoly,bsdegmono,cf,nvars,terms)(X) AND
        multibs_eval(bspoly,bsdegmono,cf,nvars,terms)(X) <= amax


decl_type: function
theory: multi_bernstein
library: Bernstein
signature:
  [[real, real] ->
  [[MultiBernstein, DegreeMono, Coeff, posnat, posnat] ->
  bool]]

location: 129 2 131 67
body:
    forall_X_between(amin,amax:real)(bspoly,bsdegmono,cf,nvars,terms) : bool =
      FORALL (X): unitbox?(nvars)(X) IMPLIES 
        eval_X_between(amin,amax)(bspoly,bsdegmono,cf,nvars,terms)(X)


decl_type: function
theory: multi_bernstein
library: Bernstein
location: 142 2 160 12
signature:
  [d: [MultiBernstein, DegreeMono, Coeff, posnat, posnat, nat] ->
          [[CoeffMono, [[real, real] -> bool], real] ->
             {l: list[real] |
                      cons?(l) IMPLIES
                       unitbox?(d`4)(list2array(0)(l)) AND
                        length(l) = d`4}]]

body:
    Bern_coeffs_endpoints_rel_rec(bspoly,bsdegmono,cf,nvars,terms,v)
                                 (f:CoeffMono,rel:[[real,real]->bool],a:real) : 
    RECURSIVE {l : list[real] | cons?(l) IMPLIES unitbox?(nvars)(list2array(0)(l)) AND
                                                 length(l)=nvars} =
      IF v = 0 THEN
        IF rel(multibscoeff(bspoly,bsdegmono,cf,nvars,terms)(f),a) THEN null
        ELSE corner_to_point(f,nvars) 
        ENDIF
      ELSE 
        LET nf0   = f WITH [(v-1):=0],
            list0 = Bern_coeffs_endpoints_rel_rec(bspoly,bsdegmono,cf,nvars,terms,v-1)
                                                 (nf0,rel,a) IN
        IF cons?(list0) THEN list0
        ELSE 
          LET nfd = f WITH [(v-1):=bsdegmono(v-1)] IN 
          Bern_coeffs_endpoints_rel_rec(bspoly,bsdegmono,cf,nvars,terms,v-1)(nfd,rel,a)
        ENDIF
      ENDIF 
     MEASURE v


decl_type: function
theory: multi_bernstein
library: Bernstein
location: 162 2 167 9
signature:
  [d:
          [MultiBernstein, DegreeMono, Coeff, posnat, posnat,
           IntervalEndpoints] ->
          [[[[real, real] -> bool], real] ->
             {l: list[real] |
                      cons?(l) IMPLIES
                       unitbox?(d`4)(list2array(0)(l)) AND
                        length(l) = d`4}]]

body:
    Bern_coeffs_endpoints_rel(bspoly,bsdegmono,cf,nvars,terms,intendpts)(rel,a) : 
    {l : list[real] | cons?(l) IMPLIES unitbox?(nvars)(list2array(0)(l)) AND length(l)=nvars} = 
      IF (FORALL (j:below(nvars)): intendpts(j)`1 AND intendpts(j)`2) THEN
        Bern_coeffs_endpoints_rel_rec(bspoly,bsdegmono,cf,nvars,terms,nvars)(zeroes,rel,a)
      ELSE null
      ENDIF


decl_type: function
theory: multi_bernstein
library: Bernstein
signature: [[Polyproduct, DegreeMono] -> [nat -> [nat -> [nat -> real]]]]
location: 214 2 219 9
body:
    Bern_split_left_mono(pprod,bsdegmono)(i:nat)(r:nat)(j:nat): real = 
      IF i/=r THEN pprod(r)(j) 
      ELSIF j>bsdegmono(i) THEN 0 
      ELSE (1/2^j)*sigma(0,j,
           LAMBDA (k:nat): IF k>j THEN 0 ELSE C(j,k)*pprod(i)(k) ENDIF) 
      ENDIF 


decl_type: function
theory: multi_bernstein
library: Bernstein
signature: [[Polyproduct, DegreeMono] -> [nat -> [nat -> [nat -> real]]]]
location: 221 2 229 9
body:
    Bern_split_right_mono(pprod,bsdegmono)(i:nat)(r:nat)(j:nat): real =
      IF i/=r THEN pprod(r)(j) 
      ELSIF j>bsdegmono(i) THEN 0 
      ELSE 
        (1/2^(bsdegmono(i)-j))*sigma(0,bsdegmono(i)-j,
        LAMBDA (k:nat): IF k>bsdegmono(i)-j THEN 0 
                        ELSE C(bsdegmono(i)-j,k)*pprod(i)(bsdegmono(i)-k) 
                        ENDIF) 
      ENDIF


decl_type: function
theory: multi_bernstein
library: Bernstein
signature: [[MultiBernstein, DegreeMono] -> [nat -> [nat -> Polyproduct]]]
location: 233 2 234 48
body:
    Bern_split_left_mpoly(bspoly,bsdegmono)(i:nat)(k:nat): MACRO Polyproduct = 
      Bern_split_left_mono(bspoly(k),bsdegmono)(i)


decl_type: function
theory: multi_bernstein
library: Bernstein
signature: [[MultiBernstein, DegreeMono] -> [nat -> [nat -> Polyproduct]]]
location: 236 2 237 49
body:
    Bern_split_right_mpoly(bspoly,bsdegmono)(i:nat)(k:nat): MACRO Polyproduct = 
      Bern_split_right_mono(bspoly(k),bsdegmono)(i)


decl_type: function
theory: multi_bernstein
library: Bernstein
signature: [[Polyproduct, nat] -> [nat -> [nat -> real]]]
location: 276 2 284 13
body:
    Bernstein_sweep(pprod,v)(p:nat)(j:nat): RECURSIVE real =
      IF p = 0 THEN pprod(v)(j)
      ELSE
        LET bpm = Bernstein_sweep(pprod,v)(p-1) IN
          IF j < p THEN bpm(j)
          ELSE (1/2)*(bpm(j-1) + bpm(j))
          ENDIF
      ENDIF
      MEASURE p


decl_type: function
theory: multi_bernstein
library: Bernstein
signature: [[Polyproduct, DegreeMono] -> [nat -> [nat -> Polynomial]]]
location: 288 2 292 9
body:
    Bern_sweep_left(pprod,bsdegmono)(i:nat)(r:nat) : Polynomial = 
      IF i /= r THEN pprod(r)
      ELSE 
        Bernstein_sweep(pprod,i)(bsdegmono(i))
      ENDIF


decl_type: function
theory: multi_bernstein
library: Bernstein
signature: [[Polyproduct, DegreeMono] -> [nat -> [nat -> [nat -> real]]]]
location: 294 2 299 9
body:
    Bern_sweep_right(pprod,bsdegmono)(i:nat)(r:nat)(j:nat) : real = 
      IF i /= r THEN pprod(r)(j)
      ELSIF j <= bsdegmono(r) THEN 
        Bernstein_sweep(pprod,i)(bsdegmono(i)-j)(bsdegmono(i)) 
      ELSE 0 
      ENDIF


decl_type: function
theory: multi_bernstein
library: Bernstein
signature: [[MultiBernstein, DegreeMono] -> [nat -> [nat -> Polyproduct]]]
location: 301 2 302 43
body:
    Bern_sweep_left_mpoly(bspoly,bsdegmono)(i:nat)(k:nat): MACRO Polyproduct = 
      Bern_sweep_left(bspoly(k),bsdegmono)(i)


decl_type: function
theory: multi_bernstein
library: Bernstein
signature: [[MultiBernstein, DegreeMono] -> [nat -> [nat -> Polyproduct]]]
location: 304 2 305 44
body:
    Bern_sweep_right_mpoly(bspoly,bsdegmono)(i:nat)(k:nat): MACRO Polyproduct = 
      Bern_sweep_right(bspoly(k),bsdegmono)(i)


decl_type: tcc
theory: multi_bernstein
library: Bernstein
signature: nil
location: 324 0 328 999
body:
  % Assuming TCC generated (at line 6, column 5) for
      % sigma_set@sigma_bijection[nat]
      % generated from assumption sigma_bijection.connected_domain
  IMP_sigma_bijection_TCC1: OBLIGATION
    (FORALL (x, y: nat), (z: integer): x <= z AND z <= y IMPLIES z >= 0);


decl_type: tcc
theory: multi_bernstein
library: Bernstein
signature: nil
location: 330 0 334 999
body:
  % Subtype TCC generated (at line 30, column 14) for  nvars - 1
      % expected type  T_high[nat]
  bsproduct_eval_TCC1: OBLIGATION
    FORALL (nvars: posnat):
      nvars - 1 >= 0 OR (EXISTS (j: nat): nvars - 1 <= j);


decl_type: tcc
theory: multi_bernstein
library: Bernstein
signature: nil
location: 336 0 340 999
body:
  % Subtype TCC generated (at line 30, column 45) for  bsdegmono(i)
      % expected type  T_high[nat]
  bsproduct_eval_TCC2: OBLIGATION
    FORALL (bsdegmono: DegreeMono, i: nat):
      bsdegmono(i) >= 0 OR (EXISTS (j: nat): bsdegmono(i) <= j);


decl_type: tcc
theory: multi_bernstein
library: Bernstein
signature: nil
location: 342 0 346 999
body:
  % Subtype TCC generated (at line 32, column 62) for  bsdegmono(i)
      % expected type  above(j - 1)
  bsproduct_eval_TCC3: OBLIGATION
    FORALL (bsdegmono: DegreeMono, i: nat, j: nat):
      NOT j > bsdegmono(i) IMPLIES bsdegmono(i) > j - 1;


decl_type: tcc
theory: multi_bernstein
library: Bernstein
signature: nil
location: 348 0 354 999
body:
  % Subtype TCC generated (at line 47, column 64) for  bsdegmono(k)
      % expected type  above(f(k) - 1)
  multibs_eval_rec_TCC1: OBLIGATION
    FORALL (bsdegmono: DegreeMono, v: nat, f: CoeffMono):
      v = 0 IMPLIES
       (FORALL (k: nat):
          f(k) <= bsdegmono(k) IMPLIES bsdegmono(k) > f(k) - 1);


decl_type: tcc
theory: multi_bernstein
library: Bernstein
signature: nil
location: 356 0 359 999
body:
  % Subtype TCC generated (at line 49, column 27) for  v - 1
      % expected type  nat
  multibs_eval_rec_TCC2: OBLIGATION
    FORALL (v: nat): NOT v = 0 IMPLIES v - 1 >= 0;


decl_type: tcc
theory: multi_bernstein
library: Bernstein
signature: nil
location: 361 0 366 999
body:
  % Subtype TCC generated (at line 49, column 17) for  bsdegmono(v - 1)
      % expected type  T_high[nat]
  multibs_eval_rec_TCC3: OBLIGATION
    FORALL (bsdegmono: DegreeMono, v: nat):
      NOT v = 0 IMPLIES
       bsdegmono(v - 1) >= 0 OR (EXISTS (j: nat): bsdegmono(v - 1) <= j);


decl_type: tcc
theory: multi_bernstein
library: Bernstein
signature: nil
location: 368 0 374 999
body:
  % Termination TCC generated (at line 50, column 6) for
      % multibs_eval_rec(bspoly, bsdegmono, cf, nvars, terms, v - 1)
  multibs_eval_rec_TCC4: OBLIGATION
    FORALL (v: nat, f: CoeffMono):
      NOT v = 0 IMPLIES
       (FORALL (d: nat, nf: CoeffMono):
          nf = f WITH [(v - 1) := d] IMPLIES v - 1 < v);


decl_type: tcc
theory: multi_bernstein
library: Bernstein
signature: nil
location: 376 0 389 999
body:
  % Subtype TCC generated (at line 147, column 70) for  null
      % expected type  {l: list[real] |
                     %          cons?(l) IMPLIES
                     %           unitbox?(nvars)(list2array(0)(l)) AND
                     %            length(l) = nvars}
  Bern_coeffs_endpoints_rel_rec_TCC1: OBLIGATION
    FORALL (bspoly: MultiBernstein, bsdegmono: DegreeMono, cf: Coeff,
            nvars: posnat, terms: posnat, v: nat, f: CoeffMono,
            rel: [[real, real] -> bool], a: real):
      rel(multibscoeff(bspoly, bsdegmono, cf, nvars, terms)(f), a) AND v = 0
       IMPLIES
       cons?[real](null[real]) IMPLIES
        unitbox?(nvars)(list2array[real](0)(null[real])) AND
         length[real](null[real]) = nvars;


decl_type: tcc
theory: multi_bernstein
library: Bernstein
signature: nil
location: 391 0 406 999
body:
  % Subtype TCC generated (at line 148, column 11) for
      % corner_to_point(f, nvars)
      % expected type  {l: list[real] |
                     %          cons?(l) IMPLIES
                     %           unitbox?(nvars)(list2array(0)(l)) AND
                     %            length(l) = nvars}
  Bern_coeffs_endpoints_rel_rec_TCC2: OBLIGATION
    FORALL (bspoly: MultiBernstein, bsdegmono: DegreeMono, cf: Coeff,
            nvars: posnat, terms: posnat, v: nat, f: CoeffMono,
            rel: [[real, real] -> bool], a: real):
      NOT rel(multibscoeff(bspoly, bsdegmono, cf, nvars, terms)(f), a) AND
       v = 0
       IMPLIES
       cons?[real](corner_to_point(f, nvars)) IMPLIES
        unitbox?(nvars)(list2array[real](0)(corner_to_point(f, nvars))) AND
         length[real](corner_to_point(f, nvars)) = nvars;


decl_type: tcc
theory: multi_bernstein
library: Bernstein
signature: nil
location: 408 0 415 999
body:
  % Subtype TCC generated (at line 153, column 48) for  nf0
      % expected type  CoeffMono
  Bern_coeffs_endpoints_rel_rec_TCC3: OBLIGATION
    FORALL (v: nat, f: CoeffMono):
      NOT v = 0 IMPLIES
       (FORALL (nf0: [nat -> int]):
          nf0 = f WITH [(v - 1) := 0] IMPLIES
           (FORALL (x1: nat): nf0(x1) >= 0));


decl_type: tcc
theory: multi_bernstein
library: Bernstein
signature: nil
location: 417 0 428 999
body:
  % Termination TCC generated (at line 152, column 18) for
      % Bern_coeffs_endpoints_rel_rec(bspoly,
      %                               bsdegmono,
      %                               cf,
      %                               nvars,
      %                               terms,
      %                               v - 1)
  Bern_coeffs_endpoints_rel_rec_TCC4: OBLIGATION
    FORALL (v: nat, f: CoeffMono):
      NOT v = 0 IMPLIES
       (FORALL (nf0: [nat -> int]):
          nf0 = f WITH [(v - 1) := 0] IMPLIES v - 1 < v);


decl_type: tcc
theory: multi_bernstein
library: Bernstein
signature: nil
location: 430 0 441 999
body:
  % Subtype TCC generated (at line 166, column 9) for  null
      % expected type  {l: list[real] |
                     %          cons?(l) IMPLIES
                     %           unitbox?(nvars)(list2array(0)(l)) AND
                     %            length(l) = nvars}
  Bern_coeffs_endpoints_rel_TCC1: OBLIGATION
    FORALL (nvars: posnat, intendpts: IntervalEndpoints):
      NOT (FORALL (j: below(nvars)): intendpts(j)`1 AND intendpts(j)`2)
       IMPLIES
       cons?[real](null[real]) IMPLIES
        unitbox?(nvars)(list2array[real](0)(null[real])) AND
         length[real](null[real]) = nvars;


decl_type: tcc
theory: multi_bernstein
library: Bernstein
signature: nil
location: 443 0 448 999
body:
  % Subtype TCC generated (at line 217, column 25) for  j
      % expected type  T_high[nat]
  Bern_split_left_mono_TCC1: OBLIGATION
    FORALL (bsdegmono: DegreeMono, i, r, j: nat):
      NOT j > bsdegmono(i) AND NOT i /= r IMPLIES
       j >= 0 OR (EXISTS (j_1: nat): j <= j_1);


decl_type: tcc
theory: multi_bernstein
library: Bernstein
signature: nil
location: 450 0 455 999
body:
  % Subtype TCC generated (at line 218, column 48) for  k
      % expected type  {i: nat | i <= j}
  Bern_split_left_mono_TCC2: OBLIGATION
    FORALL (bsdegmono: DegreeMono, i, r, j: nat):
      NOT j > bsdegmono(i) AND NOT i /= r IMPLIES
       (FORALL (k: nat): NOT k > j IMPLIES k <= j);


decl_type: tcc
theory: multi_bernstein
library: Bernstein
signature: nil
location: 457 0 462 999
body:
  % Subtype TCC generated (at line 225, column 37) for  bsdegmono(i) - j
      % expected type  T_high[nat]
  Bern_split_right_mono_TCC1: OBLIGATION
    FORALL (bsdegmono: DegreeMono, i, r, j: nat):
      NOT j > bsdegmono(i) AND NOT i /= r IMPLIES
       bsdegmono(i) - j >= 0 OR (EXISTS (j_1: nat): bsdegmono(i) - j <= j_1);


decl_type: tcc
theory: multi_bernstein
library: Bernstein
signature: nil
location: 464 0 470 999
body:
  % Subtype TCC generated (at line 227, column 29) for  bsdegmono(i) - j
      % expected type  nat
  Bern_split_right_mono_TCC2: OBLIGATION
    FORALL (bsdegmono: DegreeMono, i, r, j: nat):
      NOT j > bsdegmono(i) AND NOT i /= r IMPLIES
       (FORALL (k: nat):
          NOT k > bsdegmono(i) - j IMPLIES bsdegmono(i) - j >= 0);


decl_type: tcc
theory: multi_bernstein
library: Bernstein
signature: nil
location: 472 0 478 999
body:
  % Subtype TCC generated (at line 227, column 44) for  k
      % expected type  {i_1: nat | i_1 <= bsdegmono(i) - j}
  Bern_split_right_mono_TCC3: OBLIGATION
    FORALL (bsdegmono: DegreeMono, i, r, j: nat):
      NOT j > bsdegmono(i) AND NOT i /= r IMPLIES
       (FORALL (k: nat):
          NOT k > bsdegmono(i) - j IMPLIES k <= bsdegmono(i) - j);


decl_type: tcc
theory: multi_bernstein
library: Bernstein
signature: nil
location: 480 0 486 999
body:
  % Subtype TCC generated (at line 227, column 56) for  bsdegmono(i) - k
      % expected type  nat
  Bern_split_right_mono_TCC4: OBLIGATION
    FORALL (bsdegmono: DegreeMono, i, r, j: nat):
      NOT j > bsdegmono(i) AND NOT i /= r IMPLIES
       (FORALL (k: nat):
          NOT k > bsdegmono(i) - j IMPLIES bsdegmono(i) - k >= 0);


decl_type: tcc
theory: multi_bernstein
library: Bernstein
signature: nil
location: 488 0 497 999
body:
  % Subtype TCC generated (at line 281, column 17) for  j - 1
      % expected type  nat
  Bernstein_sweep_TCC1: OBLIGATION
    FORALL (pprod: Polyproduct, v: nat, p: nat,
            v1:
              [[Polyproduct, nat] -> [{z1: nat | z1 < p} -> [nat -> real]]],
            j: nat):
      NOT p = 0 IMPLIES
       (FORALL (bpm: [nat -> real]):
          NOT j < p AND bpm = v1(pprod, v)(p - 1) IMPLIES j - 1 >= 0);


decl_type: tcc
theory: multi_bernstein
library: Bernstein
signature: nil
location: 499 0 502 999
body:
  % Termination TCC generated (at line 279, column 16) for
      % Bernstein_sweep(pprod, v)(p - 1)
  Bernstein_sweep_TCC2: OBLIGATION
    FORALL (p: nat): NOT p = 0 IMPLIES p - 1 < p;


decl_type: tcc
theory: multi_bernstein
library: Bernstein
signature: nil
location: 504 0 508 999
body:
  % Subtype TCC generated (at line 297, column 31) for  bsdegmono(i) - j
      % expected type  nat
  Bern_sweep_right_TCC1: OBLIGATION
    FORALL (bsdegmono: DegreeMono, i, r, j: nat):
      j <= bsdegmono(r) AND NOT i /= r IMPLIES bsdegmono(i) - j >= 0;


decl_type: function
theory: vardirselector
library: Bernstein
location: 30 2 48 13
signature:
  [[MultiBernstein, bsdegmono: DegreeMono, posnat, posnat, Coeff,
         v: nat, upto(bsdegmono(v))] ->
          [# currmax: real,
             currmin: real,
             firstc: real,
             lastc: real #]]

body:
    var_coeff_range_rec(bspoly,bsdegmono,nvars,terms,cf,v,(iup:upto(bsdegmono(v)))) : 
      RECURSIVE [# currmin: real, currmax:real, firstc:real,lastc:real #] =
      LET coefffun  = multibscoeff(bspoly,bsdegmono,cf,nvars,terms), 
          thismono  = zeroes WITH [(v):=iup], 
          thiscoeff = coefffun(thismono) 
      IN 
        IF iup=0 THEN 
          (# currmin := thiscoeff,
             currmax := thiscoeff,
             firstc  := thiscoeff,
             lastc   := thiscoeff #)
        ELSE 
          LET vcrrlast = var_coeff_range_rec(bspoly,bsdegmono,nvars,terms,cf,v,iup-1) IN
            (# currmin := min(vcrrlast`currmin,thiscoeff),
               currmax := max(vcrrlast`currmax,thiscoeff),
               firstc  := vcrrlast`firstc,
               lastc   := IF iup=bsdegmono(v) THEN thiscoeff ELSE vcrrlast`lastc ENDIF #)
        ENDIF 
    MEASURE iup


decl_type: function
theory: vardirselector
library: Bernstein
location: 50 2 71 11
signature:
  [[MultiBernstein, DegreeMono, posnat, posnat, Coeff, nat] ->
          [# firstc: real, lastc: real, variable: nat #]]

body:
    var_maxcoeff_rec(bspoly,bsdegmono,nvars,terms,cf,v): 
      RECURSIVE [# variable:nat,firstc:real,lastc:real #] =
      LET vcrr       = var_coeff_range_rec(bspoly,bsdegmono,nvars,terms,cf,v,bsdegmono(v)),
          thisanswer = (# variable := v,
                          firstc   := vcrr`firstc,
                          lastc    := vcrr`lastc #) 
      IN
        IF v = 0 THEN thisanswer
        ELSE 
          LET vmr = var_maxcoeff_rec(bspoly,bsdegmono,nvars,terms,cf,v-1),
              vcrrlast = var_coeff_range_rec(bspoly,bsdegmono,nvars,terms,cf,vmr`variable,
                                             bsdegmono(vmr`variable)),
              lastanswer =  (# variable :=vmr`variable,
                               firstc   :=vcrrlast`firstc,
                               lastc    :=vcrrlast`lastc #) IN
          IF vcrr`currmax-vcrr`currmin > vcrrlast`currmax-vcrrlast`currmin THEN 
            thisanswer
          ELSE 
            lastanswer  
          ENDIF
        ENDIF 
    MEASURE v


decl_type: function
theory: vardirselector
library: Bernstein
signature:
  [[MultiBernstein, DegreeMono, posnat, posnat, Coeff, nat] ->
  [bool, nat]]

location: 73 2 75 45
body:
    MaxVarMinDir(bspoly,bsdegmono,nvars,terms,cf,level): [bool,nat] = 
      LET vcrr = var_maxcoeff_rec(bspoly,bsdegmono,nvars,terms,cf,nvars-1) IN
        (vcrr`firstc<=vcrr`lastc,vcrr`variable)


decl_type: function
theory: vardirselector
library: Bernstein
signature:
  [[MultiBernstein, DegreeMono, posnat, posnat, Coeff, nat] ->
  [bool, nat]]

location: 77 2 79 46
body:
    MaxVarMaxDir(bspoly,bsdegmono,nvars,terms,cf,level): [bool,nat] = 
      LET vcrr = var_maxcoeff_rec(bspoly,bsdegmono,nvars,terms,cf,nvars-1) IN
        (vcrr`firstc > vcrr`lastc,vcrr`variable)


decl_type: tcc
theory: vardirselector
library: Bernstein
signature: nil
location: 86 0 97 999
body:
  % Subtype TCC generated (at line 34, column 29) for  thismono
      % expected type  CoeffMono
  var_coeff_range_rec_TCC1: OBLIGATION
    FORALL (bspoly: MultiBernstein, bsdegmono: DegreeMono, nvars: posnat,
            terms: posnat, cf: Coeff, v: nat, (iup: upto(bsdegmono(v))),
            coefffun: [CoeffMono -> real]):
      coefffun = multibscoeff(bspoly, bsdegmono, cf, nvars, terms) IMPLIES
       (FORALL (thismono: [nat -> real]):
          thismono = (LAMBDA (i: nat): 0) WITH [(v) := iup] IMPLIES
           (FORALL (x1: nat):
              rational_pred(thismono(x1)) AND
               integer_pred(thismono(x1)) AND thismono(x1) >= 0));


decl_type: tcc
theory: vardirselector
library: Bernstein
signature: nil
location: 99 0 110 999
body:
  % Subtype TCC generated (at line 42, column 77) for  iup - 1
      % expected type  upto(bsdegmono(v))
  var_coeff_range_rec_TCC2: OBLIGATION
    FORALL (bspoly: MultiBernstein, bsdegmono: DegreeMono, nvars: posnat,
            terms: posnat, cf: Coeff, v: nat, (iup: upto(bsdegmono(v))),
            coefffun: [CoeffMono -> real]):
      coefffun = multibscoeff(bspoly, bsdegmono, cf, nvars, terms) IMPLIES
       (FORALL (thismono: [nat -> real]):
          thismono = (LAMBDA (i: nat): 0) WITH [(v) := iup] IMPLIES
           (FORALL (thiscoeff: real):
              NOT iup = 0 AND thiscoeff = coefffun(thismono) IMPLIES
               iup - 1 >= 0 AND iup - 1 <= bsdegmono(v)));


decl_type: tcc
theory: vardirselector
library: Bernstein
signature: nil
location: 112 0 123 999
body:
  % Termination TCC generated (at line 42, column 23) for
      % var_coeff_range_rec(bspoly, bsdegmono, nvars, terms, cf, v, iup - 1)
  var_coeff_range_rec_TCC3: OBLIGATION
    FORALL (bspoly: MultiBernstein, bsdegmono: DegreeMono, nvars: posnat,
            terms: posnat, cf: Coeff, v: nat, (iup: upto(bsdegmono(v))),
            coefffun: [CoeffMono -> real]):
      coefffun = multibscoeff(bspoly, bsdegmono, cf, nvars, terms) IMPLIES
       (FORALL (thismono: [nat -> real]):
          thismono = (LAMBDA (i: nat): 0) WITH [(v) := iup] IMPLIES
           (FORALL (thiscoeff: real):
              NOT iup = 0 AND thiscoeff = coefffun(thismono) IMPLIES
               iup - 1 < iup));


decl_type: tcc
theory: vardirselector
library: Bernstein
signature: nil
location: 125 0 140 999
body:
  % Subtype TCC generated (at line 59, column 67) for  v - 1
      % expected type  nat
  var_maxcoeff_rec_TCC1: OBLIGATION
    FORALL (bspoly: MultiBernstein, bsdegmono: DegreeMono, nvars: posnat,
            terms: posnat, cf: Coeff, v: nat,
            vcrr:
              [# currmax: real, currmin: real, firstc: real, lastc: real #]):
      vcrr =
       var_coeff_range_rec(bspoly, bsdegmono, nvars, terms, cf, v,
                           bsdegmono(v))
       IMPLIES
       (FORALL (thisanswer: [# firstc: real, lastc: real, variable: nat #]):
          NOT v = 0 AND
           thisanswer =
            (# variable := v, firstc := vcrr`firstc, lastc := vcrr`lastc #)
           IMPLIES v - 1 >= 0);


decl_type: tcc
theory: vardirselector
library: Bernstein
signature: nil
location: 142 0 157 999
body:
  % Termination TCC generated (at line 59, column 18) for
      % var_maxcoeff_rec(bspoly, bsdegmono, nvars, terms, cf, v - 1)
  var_maxcoeff_rec_TCC2: OBLIGATION
    FORALL (bspoly: MultiBernstein, bsdegmono: DegreeMono, nvars: posnat,
            terms: posnat, cf: Coeff, v: nat,
            vcrr:
              [# currmax: real, currmin: real, firstc: real, lastc: real #]):
      vcrr =
       var_coeff_range_rec(bspoly, bsdegmono, nvars, terms, cf, v,
                           bsdegmono(v))
       IMPLIES
       (FORALL (thisanswer: [# firstc: real, lastc: real, variable: nat #]):
          NOT v = 0 AND
           thisanswer =
            (# variable := v, firstc := vcrr`firstc, lastc := vcrr`lastc #)
           IMPLIES v - 1 < v);


decl_type: tcc
theory: vardirselector
library: Bernstein
signature: nil
location: 159 0 181 999
body:
  % Subtype TCC generated (at line 61, column 43) for  bsdegmono(vmr`variable)
      % expected type  upto(bsdegmono(vmr`variable))
  var_maxcoeff_rec_TCC3: OBLIGATION
    FORALL (bspoly: MultiBernstein, bsdegmono: DegreeMono, nvars: posnat,
            terms: posnat, cf: Coeff, v: nat,
            v1:
              [{z: [MultiBernstein, DegreeMono, posnat, posnat, Coeff, nat] |
                        z`6 < v} ->
                 [# firstc: real, lastc: real, variable: nat #]],
            vcrr:
              [# currmax: real, currmin: real, firstc: real, lastc: real #]):
      vcrr =
       var_coeff_range_rec(bspoly, bsdegmono, nvars, terms, cf, v,
                           bsdegmono(v))
       IMPLIES
       (FORALL (thisanswer: [# firstc: real, lastc: real, variable: nat #]):
          NOT v = 0 AND
           thisanswer =
            (# variable := v, firstc := vcrr`firstc, lastc := vcrr`lastc #)
           IMPLIES
           (FORALL (vmr: [# firstc: real, lastc: real, variable: nat #]):
              vmr = v1(bspoly, bsdegmono, nvars, terms, cf, v - 1) IMPLIES
               bsdegmono(vmr`variable) <= bsdegmono(vmr`variable)));


decl_type: tcc
theory: vardirselector
library: Bernstein
signature: nil
location: 183 0 186 999
body:
  % Subtype TCC generated (at line 52, column 75) for  bsdegmono(v)
      % expected type  upto(bsdegmono(v))
  var_maxcoeff_rec_TCC4: OBLIGATION
    FORALL (bsdegmono: DegreeMono, v: nat): bsdegmono(v) <= bsdegmono(v);


decl_type: tcc
theory: vardirselector
library: Bernstein
signature: nil
location: 188 0 190 999
body:
  % Subtype TCC generated (at line 74, column 64) for  nvars - 1
      % expected type  nat
  MaxVarMinDir_TCC1: OBLIGATION FORALL (nvars: posnat): nvars - 1 >= 0;


decl_type: formula
theory: bernstein_minmax
library: Bernstein
signature: nil
location: 35 2 39 59
body:
    unit_box_lb_id : LEMMA
      (FORALL(t:below(terms),v:below(nvars),i:upto(bsdegmono(v))):
         bspoly(t)(v)(i) = bspolz(t)(v)(i)) IMPLIES
      unit_box_lb?(bspoly,bsdegmono,nvars,terms,cf,intendpts) =
      unit_box_lb?(bspolz,bsdegmono,nvars,terms,cf,intendpts)


decl_type: formula
theory: bernstein_minmax
library: Bernstein
signature: nil
location: 49 2 53 59
body:
    unit_box_ub_id : LEMMA
      (FORALL(t:below(terms),v:below(nvars),i:upto(bsdegmono(v))):
         bspoly(t)(v)(i) = bspolz(t)(v)(i)) IMPLIES
      unit_box_ub?(bspoly,bsdegmono,nvars,terms,cf,intendpts) =
      unit_box_ub?(bspolz,bsdegmono,nvars,terms,cf,intendpts)


decl_type: formula
theory: bernstein_minmax
library: Bernstein
signature: nil
location: 61 2 65 58
body:
    sound_id : LEMMA
      (FORALL(t:below(terms),v:below(nvars),i:upto(bsdegmono(v))):
         bspoly(t)(v)(i) = bspolz(t)(v)(i)) IMPLIES
      sound?(bspoly,bsdegmono,nvars,terms,cf,intendpts)(omm) =
      sound?(bspolz,bsdegmono,nvars,terms,cf,intendpts)(omm)


decl_type: formula
theory: bernstein_minmax
library: Bernstein
signature: nil
location: 67 2 70 18
body:
    sound_lb_le_ub: LEMMA
      sound?(bspoly,bsdegmono,nvars,terms,cf,intendpts)(omm)
      IMPLIES
      lb_le_ub?(omm)


decl_type: formula
theory: bernstein_minmax
library: Bernstein
signature: nil
location: 72 2 84 73
body:
    combine_sound: LEMMA
      (EXISTS (VPr:[Vars->bool]): FORALL (X:(unitbox?(nvars))): (VPr(X) 
      IMPLIES eval_X_between(omm1`lb_min,omm1`ub_max)(bspoly,bsdegmono,cf,nvars,terms)(X))
      AND ((NOT VPr(X)) 
      IMPLIES eval_X_between(omm2`lb_min,omm2`ub_max)(bspoly,bsdegmono,cf,nvars,terms)(X)))
      AND
      unit_box_lb?(bspoly,bsdegmono,nvars,terms,cf,intendpts)(omm1) AND
      unit_box_ub?(bspoly,bsdegmono,nvars,terms,cf,intendpts)(omm1) AND
      unit_box_lb?(bspoly,bsdegmono,nvars,terms,cf,intendpts)(omm2) AND
      unit_box_ub?(bspoly,bsdegmono,nvars,terms,cf,intendpts)(omm2) AND
      length_eq?(nvars)(omm1) AND length_eq?(nvars)(omm2)
      IMPLIES
      sound?(bspoly,bsdegmono,nvars,terms,cf,intendpts)(combine(omm1,omm2))


decl_type: formula
theory: bernstein_minmax
library: Bernstein
signature: nil
location: 122 2 124 26
body:
    Bern_coeffs_minmax_length: LEMMA 
      LET omm = Bern_coeffs_minmax(bspoly,bsdegmono,cf,nvars,terms,depth,intendpts) IN
      length_eq?(nvars)(omm)


decl_type: formula
theory: bernstein_minmax
library: Bernstein
signature: nil
location: 126 2 128 25
body:
    Bern_coeffs_minmax_maxdepth: LEMMA 
      LET omm = Bern_coeffs_minmax(bspoly,bsdegmono,cf,nvars,terms,depth,intendpts) IN
      omm`max_depth = depth


decl_type: formula
theory: bernstein_minmax
library: Bernstein
signature: nil
location: 130 2 136 53
body:
    Bern_coeffs_minmax_var: LEMMA 
     LET omm = Bern_coeffs_minmax(bspoly,bsdegmono,cf,nvars,terms,depth,intendpts),
         bseval = multibs_eval(bspoly, bsdegmono, cf, nvars, terms) 
     IN
       (cons?(omm`lb_var) OR cons?(omm`ub_var)) IMPLIES
         bseval(list2array(0)(omm`lb_var)) = omm`lb_max AND
         bseval(list2array(0)(omm`ub_var)) = omm`ub_min


decl_type: formula
theory: bernstein_minmax
library: Bernstein
signature: nil
location: 143 2 148 11
body:
    list2array_sound_pi : LEMMA
      FORALL(l:list[real],t:real) : 
        list2array(t)(l) = LAMBDA(i: nat):
          IF i < length(l) THEN nth(l,i)
          ELSE t
        ENDIF 


decl_type: function
theory: bernstein_minmax
library: Bernstein
location: 26 2 33 81
signature:
  [[MultiBernstein, DegreeMono, posnat, posnat, Coeff,
         IntervalEndpoints] ->
          [Outminmax -> bool]]

body:
    unit_box_lb?(bspoly,bsdegmono,nvars,terms,cf,intendpts)(omm): bool =
      cons?(omm`lb_var) IMPLIES
        (length(omm`lb_var) = nvars AND
         LET lb_varlam  = list2array(0)(omm`lb_var) IN
           (FORALL (iup:below(nvars)): 
             interval_between?(0,1,intendpts(iup),(true,true))(lb_varlam(iup)))
             AND
             multibs_eval(bspoly,bsdegmono,cf,nvars,terms)(lb_varlam) = omm`lb_max)


decl_type: function
theory: bernstein_minmax
library: Bernstein
location: 41 2 47 81
signature:
  [[MultiBernstein, DegreeMono, posnat, posnat, Coeff,
         IntervalEndpoints] ->
          [Outminmax -> bool]]

body:
    unit_box_ub?(bspoly,bsdegmono,nvars,terms,cf,intendpts)(omm): bool =
      cons?(omm`ub_var) IMPLIES
        (length(omm`ub_var) = nvars AND
        LET ub_varlam  = list2array(0)(omm`ub_var) IN
           (FORALL (iup:below(nvars)): 
             interval_between?(0,1,intendpts(iup),(true,true))(ub_varlam(iup))) AND
             multibs_eval(bspoly,bsdegmono,cf,nvars,terms)(ub_varlam) = omm`ub_min)


decl_type: function
theory: bernstein_minmax
library: Bernstein
location: 55 2 59 26
signature:
  [[MultiBernstein, DegreeMono, posnat, posnat, Coeff,
         IntervalEndpoints] ->
          [Outminmax -> bool]]

body:
    sound?(bspoly,bsdegmono,nvars,terms,cf,intendpts)(omm) : bool =
      forall_X_between(omm`lb_min,omm`ub_max)(bspoly,bsdegmono,cf,nvars,terms) AND
      unit_box_lb?(bspoly,bsdegmono,nvars,terms,cf,intendpts)(omm) AND
      unit_box_ub?(bspoly,bsdegmono,nvars,terms,cf,intendpts)(omm) AND
      length_eq?(nvars)(omm)


decl_type: function
theory: bernstein_minmax
library: Bernstein
location: 86 2 116 13
signature:
  [d:
          [MultiBernstein, bsdegmono: DegreeMono, Coeff, nvars: posnat,
           posnat, f: CoeffMono, nat, intendpts: IntervalEndpoints,
           v: nat, (edge_point?(bsdegmono, nvars, f, intendpts, v))] ->
          {omm: Outminmax |
                        FORALL (nf: CoeffMono):
                          (FORALL (i: below(d`4)):
                             nf(i) <= d`2(i) AND
                              (d`9 <= i IMPLIES d`6(i) = nf(i)))
                           IMPLIES
                           omm`lb_min <=
                            multibscoeff(d`1, d`2, d`3, d`4, d`5)(nf)
                            AND
                            multibscoeff(d`1, d`2, d`3, d`4, d`5)(nf) <=
                             omm`ub_max
                    AND unit_box_lb?(d`1, d`2, d`4, d`5, d`3, d`8)(omm)
                    AND unit_box_ub?(d`1, d`2, d`4, d`5, d`3, d`8)(omm)
                    AND length_eq?(d`4)(omm) AND omm`max_depth = d`7}]

body:
    Bern_coeffs_minmax_rec(bspoly,bsdegmono,cf,nvars,terms,f,
                           depth,intendpts,v,
                           (ep:(edge_point?(bsdegmono,nvars,f,intendpts,v)))): 
      RECURSIVE {omm:Outminmax |
        (FORALL (nf:CoeffMono): (FORALL (i:below(nvars)): nf(i)<=bsdegmono(i) AND 
                                        (v <= i IMPLIES f(i)=nf(i)))
                                IMPLIES
                                omm`lb_min <= multibscoeff(bspoly,bsdegmono,cf,nvars,terms)(nf)  AND
                                multibscoeff(bspoly,bsdegmono,cf,nvars,terms)(nf) <= omm`ub_max) AND
        unit_box_lb?(bspoly,bsdegmono,nvars,terms,cf,intendpts)(omm) AND
        unit_box_ub?(bspoly,bsdegmono,nvars,terms,cf,intendpts)(omm) AND
        length_eq?(nvars)(omm) AND
        omm`max_depth = depth} =
      IF v = 0 THEN 
        LET coefffun      = multibscoeff(bspoly,bsdegmono,cf,nvars,terms),
            thiscoeff     = coefffun(f),
            thisvar       = IF ep THEN corner_to_point(f,nvars) ELSE null ENDIF,
            thisachval    = IF ep THEN thiscoeff ELSE 0 ENDIF IN
          single_outminmax(thiscoeff,thisachval,thisvar,depth) 
      ELSE 
        LET iepts = intendpts(v-1) IN
          iterate_left(0,bsdegmono(v-1),
           LAMBDA(d:upto(bsdegmono(v-1))):
             LET nf    = f WITH [(v-1) := d],
                 nep   = ep AND (d=0 AND iepts`1 OR 
                                 bsdegmono(v-1)/=0 AND 
                                 d=bsdegmono(v-1) AND iepts`2) IN
             Bern_coeffs_minmax_rec(bspoly,bsdegmono,cf,nvars,terms,nf,depth,intendpts,v-1,nep),
           combine)
      ENDIF 
      MEASURE v


decl_type: function
theory: bernstein_minmax
library: Bernstein
location: 118 2 120 93
signature:
  [d:
          [MultiBernstein, DegreeMono, Coeff, posnat, posnat, nat,
           IntervalEndpoints] ->
          (sound?(d`1, d`2, d`4, d`5, d`3, d`7))]

body:
    Bern_coeffs_minmax(bspoly,bsdegmono,cf,nvars,terms,depth,intendpts) : 
      (sound?(bspoly,bsdegmono,nvars,terms,cf,intendpts)) = 
      Bern_coeffs_minmax_rec(bspoly,bsdegmono,cf,nvars,terms,zeroes,depth,intendpts,nvars,true)


decl_type: function
theory: bernstein_minmax
library: Bernstein
location: 151 2 189 25
signature:
  [d:
          [MultiBernstein, DegreeMono, posnat, posnat, Coeff, depth: nat,
           upto(depth), [Outminmax -> bool], [Outminmax -> bool],
           IntervalEndpoints, VarSelector, Outminmax] ->
          (sound?(d`1, d`2, d`3, d`4, d`5, d`10))]

body:
    Bernstein_minmax_rec(bspoly,bsdegmono,nvars,terms,cf,depth,(level:upto(depth)),
                         localexit,globalexit,intendpts,varselect,omm) : 
      RECURSIVE (sound?(bspoly,bsdegmono,nvars,terms,cf,intendpts)) =
      LET bp     = translist(polylist(bspoly,bsdegmono,nvars,terms)),
          minmax = Bern_coeffs_minmax(bp,bsdegmono,cf,nvars,terms,level,intendpts)
      IN
        IF level = depth OR localexit(minmax) OR between?(omm,minmax) OR globalexit(minmax) THEN
          minmax
        ELSE
          LET
            varsel       = varselect(bp,bsdegmono,nvars,terms,cf,level),
            v            = mod(varsel`2,nvars),
            spleft       = Bern_split_left_mpoly(bp,bsdegmono)(mod(varsel`2,nvars)),
            spright      = Bern_split_right_mpoly(bp,bsdegmono)(mod(varsel`2,nvars)),
            ipleft       = intendpts WITH [(v)`2 := true],
            ipright      = intendpts WITH [(v)`1 := true],
            (LR1,LR2)    = IF varsel`1 THEN (spleft,spright) ELSE (spright,spleft) ENDIF,
            LR1intendpts = IF varsel`1 THEN ipleft ELSE ipright ENDIF,
            LR2intendpts = IF varsel`1 THEN ipright ELSE ipleft ENDIF,
            combine_this = IF varsel`1 THEN combine_l ELSE combine_r ENDIF,
            newmm1       = combine(omm,minmax),
            level        = level + 1,
            bslr1        = Bernstein_minmax_rec(LR1,bsdegmono,nvars,terms,cf,depth,level,
                                                localexit,globalexit,LR1intendpts,varselect,newmm1)
          IN
            IF globalexit(bslr1) THEN
              combine_this(v,bslr1,minmax)
            ELSE 
              LET
                newmm2   = combine(newmm1,bslr1),
                bslr2    = Bernstein_minmax_rec(LR2,bsdegmono,nvars,terms,cf,depth,level,
                                                localexit,globalexit,LR2intendpts,varselect,newmm2),
                bslrleft = IF varsel`1 THEN bslr1 ELSE bslr2 ENDIF,
                bslrright = IF varsel`1 THEN bslr2 ELSE bslr1 ENDIF
              IN
                combine_lr(v,bslrleft,bslrright)
            ENDIF
        ENDIF
        MEASURE depth-level


decl_type: function
theory: bernstein_minmax
library: Bernstein
location: 191 2 194 79
signature:
  [d:
          [MultiBernstein, DegreeMono, posnat, posnat, Coeff, nat,
           [Outminmax -> bool], [Outminmax -> bool], IntervalEndpoints,
           VarSelector] ->
          (sound?(d`1, d`2, d`3, d`4, d`5, d`9))]

body:
    Bernstein_minmax(bspoly,bsdegmono,nvars,terms,cf,depth,localexit,globalexit,
                     intendpts,varselect) : (sound?(bspoly,bsdegmono,nvars,terms,cf,intendpts)) =
      Bernstein_minmax_rec(bspoly,bsdegmono,nvars,terms,cf,depth,0,
                           localexit,globalexit,intendpts,varselect,empty_minmax)


decl_type: tcc
theory: bernstein_minmax
library: Bernstein
signature: nil
location: 201 0 316 999
body:
  % Subtype TCC generated (at line 104, column 8) for
      % single_outminmax(thiscoeff, thisachval, thisvar, depth)
      % expected type  {omm: Outminmax |
                     %               (FORALL
                     %                (nf: CoeffMono):
                     %                (FORALL
                     %                 (i: below(nvars)):
                     %                 nf(i) <= bsdegmono(i)
                     %                 AND
                     %                 (v <= i IMPLIES f(i) = nf(i)))
                     %                IMPLIES
                     %                omm`lb_min
                     %                <=
                     %                multibscoeff
                     %                (bspoly, bsdegmono, cf, nvars, terms)
                     %                (nf)
                     %                AND
                     %                multibscoeff
                     %                (bspoly, bsdegmono, cf, nvars, terms)
                     %                (nf)
                     %                <=
                     %                omm`ub_max)
                     %           AND unit_box_lb?(bspoly,
                     %                            bsdegmono,
                     %                            nvars,
                     %                            terms,
                     %                            cf,
                     %                            intendpts)
                     %                           (omm)
                     %           AND unit_box_ub?(bspoly,
                     %                            bsdegmono,
                     %                            nvars,
                     %                            terms,
                     %                            cf,
                     %                            intendpts)
                     %                           (omm)
                     %           AND length_eq?(nvars)(omm)
                     %           AND omm`max_depth = depth}
  Bern_coeffs_minmax_rec_TCC1: OBLIGATION
    FORALL (bspoly: MultiBernstein, bsdegmono: DegreeMono, cf: Coeff,
            nvars: posnat, terms: posnat, f: CoeffMono, depth: nat,
            intendpts: IntervalEndpoints, v: nat,
            (ep: (edge_point?(bsdegmono, nvars, f, intendpts, v)))):
      v = 0 IMPLIES
       (FORALL (coefffun: [CoeffMono -> real]):
          coefffun = multibscoeff(bspoly, bsdegmono, cf, nvars, terms)
           IMPLIES
           (FORALL (thiscoeff: real):
              thiscoeff = coefffun(f) IMPLIES
               (FORALL (thisvar: list[real]):
                  thisvar =
                   IF ep THEN corner_to_point(f, nvars) ELSE null ENDIF
                   IMPLIES
                   (FORALL (thisachval: real):
                      thisachval = IF ep THEN thiscoeff ELSE 0 ENDIF IMPLIES
                            FORALL (nf: CoeffMono):
                              (FORALL (i: below(nvars)):
                                 nf(i) <= bsdegmono(i) AND
                                  (v <= i IMPLIES f(i) = nf(i)))
                               IMPLIES
                               single_outminmax(thiscoeff,
                                                thisachval,
                                                thisvar,
                                                depth)`lb_min
                                <=
                                multibscoeff(bspoly,
                                             bsdegmono,
                                             cf,
                                             nvars,
                                             terms)
                                            (nf)
                                AND
                                multibscoeff(bspoly,
                                             bsdegmono,
                                             cf,
                                             nvars,
                                             terms)
                                            (nf)
                                 <=
                                 single_outminmax(thiscoeff,
                                                  thisachval,
                                                  thisvar,
                                                  depth)`ub_max
                        AND unit_box_lb?(bspoly,
                                         bsdegmono,
                                         nvars,
                                         terms,
                                         cf,
                                         intendpts)
                                        (single_outminmax
                                         (thiscoeff,
                                          thisachval,
                                          thisvar,
                                          depth))
                        AND unit_box_ub?(bspoly,
                                         bsdegmono,
                                         nvars,
                                         terms,
                                         cf,
                                         intendpts)
                                        (single_outminmax
                                         (thiscoeff,
                                          thisachval,
                                          thisvar,
                                          depth))
                        AND length_eq?(nvars)
                                      (single_outminmax
                                       (thiscoeff,
                                        thisachval,
                                        thisvar,
                                        depth))
                        AND single_outminmax(thiscoeff,
                                             thisachval,
                                             thisvar,
                                             depth)`max_depth
                             = depth))));


decl_type: tcc
theory: bernstein_minmax
library: Bernstein
signature: nil
location: 318 0 326 999
body:
  % Subtype TCC generated (at line 107, column 33) for  v - 1
      % expected type  nat
  Bern_coeffs_minmax_rec_TCC2: OBLIGATION
    FORALL (bsdegmono: DegreeMono, nvars: posnat, f: CoeffMono,
            intendpts: IntervalEndpoints, v: nat,
            (ep: (edge_point?(bsdegmono, nvars, f, intendpts, v)))):
      NOT v = 0 IMPLIES
       (FORALL (iepts: [bool, bool]):
          iepts = intendpts(v - 1) IMPLIES v - 1 >= 0);


decl_type: tcc
theory: bernstein_minmax
library: Bernstein
signature: nil
location: 328 0 347 999
body:
  % Subtype TCC generated (at line 113, column 89) for  nep
      % expected type  (edge_point?(bsdegmono, nvars, nf, intendpts, v - 1))
  Bern_coeffs_minmax_rec_TCC3: OBLIGATION
    FORALL (bsdegmono: DegreeMono, nvars: posnat, f: CoeffMono,
            intendpts: IntervalEndpoints, v: nat,
            (ep: (edge_point?(bsdegmono, nvars, f, intendpts, v)))):
      NOT v = 0 IMPLIES
       (FORALL (iepts: [bool, bool]):
          iepts = intendpts(v - 1) IMPLIES
           (FORALL (d: upto(bsdegmono(v - 1)), nf: CoeffMono):
              nf = f WITH [(v - 1) := d] IMPLIES
               (FORALL (nep: boolean):
                  nep =
                   (ep AND
                     (d = 0 AND iepts`1 OR
                       bsdegmono(v - 1) /= 0 AND
                        d = bsdegmono(v - 1) AND iepts`2))
                   IMPLIES
                   edge_point?(bsdegmono, nvars, nf, intendpts, v - 1)
                              (nep))));


decl_type: tcc
theory: bernstein_minmax
library: Bernstein
signature: nil
location: 349 0 367 999
body:
  % Termination TCC generated (at line 113, column 11) for
      % Bern_coeffs_minmax_rec(bspoly, bsdegmono, cf, nvars, terms, nf,
      %                        depth, intendpts, v - 1, nep)
  Bern_coeffs_minmax_rec_TCC4: OBLIGATION
    FORALL (bsdegmono: DegreeMono, nvars: posnat, f: CoeffMono,
            intendpts: IntervalEndpoints, v: nat,
            (ep: (edge_point?(bsdegmono, nvars, f, intendpts, v)))):
      NOT v = 0 IMPLIES
       (FORALL (iepts: [bool, bool]):
          iepts = intendpts(v - 1) IMPLIES
           (FORALL (d: upto(bsdegmono(v - 1)), nf: CoeffMono):
              nf = f WITH [(v - 1) := d] IMPLIES
               (FORALL (nep: boolean):
                  nep =
                   (ep AND
                     (d = 0 AND iepts`1 OR
                       bsdegmono(v - 1) /= 0 AND
                        d = bsdegmono(v - 1) AND iepts`2))
                   IMPLIES v - 1 < v)));


decl_type: tcc
theory: bernstein_minmax
library: Bernstein
signature: nil
location: 369 0 390 999
body:
  % Subtype TCC generated (at line 108, column 9) for
      % LAMBDA (d: upto(bsdegmono(v - 1))):
      %   LET nf = f WITH [(v - 1) := d],
      %       nep =
      %         ep AND
      %          (d = 0 AND iepts`1 OR
      %            bsdegmono(v - 1) /= 0 AND
      %             d = bsdegmono(v - 1) AND iepts`2)
      %     IN
      %     Bern_coeffs_minmax_rec(bspoly, bsdegmono, cf, nvars, terms, nf,
      %                            depth, intendpts, v - 1, nep)
      % expected type  IterateBody[Outminmax](0, bsdegmono(v - 1))
  Bern_coeffs_minmax_rec_TCC5: OBLIGATION
    FORALL (bsdegmono: DegreeMono, nvars: posnat, f: CoeffMono,
            intendpts: IntervalEndpoints, v: nat,
            (ep: (edge_point?(bsdegmono, nvars, f, intendpts, v)))):
      NOT v = 0 IMPLIES
       (FORALL (iepts: [bool, bool]):
          iepts = intendpts(v - 1) IMPLIES
           (FORALL (x: int):
              x >= 0 AND x <= bsdegmono(v - 1) IFF
               0 <= x AND x <= bsdegmono(v - 1)));


decl_type: tcc
theory: bernstein_minmax
library: Bernstein
signature: nil
location: 392 0 629 999
body:
  % Subtype TCC generated (at line 107, column 8) for
      % iterate_left(0, bsdegmono(v - 1),
      %              LAMBDA (d: upto(bsdegmono(v - 1))):
      %                LET nf = f WITH [(v - 1) := d],
      %                    nep =
      %                      ep AND
      %                       (d = 0 AND iepts`1 OR
      %                         bsdegmono(v - 1) /= 0 AND
      %                          d = bsdegmono(v - 1) AND iepts`2)
      %                  IN
      %                  Bern_coeffs_minmax_rec(bspoly,
      %                                         bsdegmono,
      %                                         cf,
      %                                         nvars,
      %                                         terms,
      %                                         nf,
      %                                         depth,
      %                                         intendpts,
      %                                         v - 1,
      %                                         nep),
      %              combine)
      % expected type  {omm: Outminmax |
                     %               (FORALL
                     %                (nf: CoeffMono):
                     %                (FORALL
                     %                 (i: below(nvars)):
                     %                 nf(i) <= bsdegmono(i)
                     %                 AND
                     %                 (v <= i IMPLIES f(i) = nf(i)))
                     %                IMPLIES
                     %                omm`lb_min
                     %                <=
                     %                multibscoeff
                     %                (bspoly, bsdegmono, cf, nvars, terms)
                     %                (nf)
                     %                AND
                     %                multibscoeff
                     %                (bspoly, bsdegmono, cf, nvars, terms)
                     %                (nf)
                     %                <=
                     %                omm`ub_max)
                     %           AND unit_box_lb?(bspoly,
                     %                            bsdegmono,
                     %                            nvars,
                     %                            terms,
                     %                            cf,
                     %                            intendpts)
                     %                           (omm)
                     %           AND unit_box_ub?(bspoly,
                     %                            bsdegmono,
                     %                            nvars,
                     %                            terms,
                     %                            cf,
                     %                            intendpts)
                     %                           (omm)
                     %           AND length_eq?(nvars)(omm)
                     %           AND omm`max_depth = depth}
  Bern_coeffs_minmax_rec_TCC6: OBLIGATION
    FORALL (bspoly: MultiBernstein, bsdegmono: DegreeMono, cf: Coeff,
            nvars: posnat, terms: posnat, f: CoeffMono, depth: nat,
            intendpts: IntervalEndpoints, v: nat,
            v1:
              [d1:
                 {z:
                    [MultiBernstein, bsdegmono: DegreeMono, Coeff,
                     nvars: posnat, posnat, f: CoeffMono, nat,
                     intendpts: IntervalEndpoints, v: nat,
                     (edge_point?(bsdegmono, nvars, f, intendpts, v))] |
                          z`9 < v} ->
                 {omm: Outminmax |
                               FORALL (nf: CoeffMono):
                                 (FORALL (i: below(d1`4)):
                                    nf(i) <= d1`2(i) AND
                                     (d1`9 <= i IMPLIES d1`6(i) = nf(i)))
                                  IMPLIES
                                  omm`lb_min <=
                                   multibscoeff(d1`1, d1`2, d1`3, d1`4, d1`5)
                                               (nf)
                                   AND
                                   multibscoeff(d1`1, d1`2, d1`3, d1`4, d1`5)
                                               (nf)
                                    <= omm`ub_max
                           AND unit_box_lb?(d1`1,
                                            d1`2,
                                            d1`4,
                                            d1`5,
                                            d1`3,
                                            d1`8)
                                           (omm)
                           AND unit_box_ub?(d1`1,
                                            d1`2,
                                            d1`4,
                                            d1`5,
                                            d1`3,
                                            d1`8)
                                           (omm)
                           AND length_eq?(d1`4)(omm)
                           AND omm`max_depth = d1`7}],
            (ep: (edge_point?(bsdegmono, nvars, f, intendpts, v)))):
      NOT v = 0 IMPLIES
       (FORALL (iepts: [bool, bool]):
          iepts = intendpts(v - 1) IMPLIES
                FORALL (nf_1: CoeffMono):
                  (FORALL (i: below(nvars)):
                     nf_1(i) <= bsdegmono(i) AND
                      (v <= i IMPLIES f(i) = nf_1(i)))
                   IMPLIES
                   iterate_left[Outminmax]
                       (0, bsdegmono(v - 1),
                        LAMBDA (d: upto(bsdegmono(v - 1))):
                          LET nf = f WITH [(v - 1) := d],
                              nep =
                                ep AND
                                 (d = 0 AND iepts`1 OR
                                   bsdegmono(v - 1) /= 0 AND
                                    d = bsdegmono(v - 1) AND iepts`2)
                            IN
                            v1(bspoly, bsdegmono, cf, nvars, terms, nf,
                               depth, intendpts, v - 1, nep),
                        combine)`lb_min
                    <=
                    multibscoeff(bspoly, bsdegmono, cf, nvars, terms)(nf_1)
                    AND
                    multibscoeff(bspoly, bsdegmono, cf, nvars, terms)(nf_1)
                     <=
                     iterate_left[Outminmax]
                         (0, bsdegmono(v - 1),
                          LAMBDA (d: upto(bsdegmono(v - 1))):
                            LET nf = f WITH [(v - 1) := d],
                                nep =
                                  ep AND
                                   (d = 0 AND iepts`1 OR
                                     bsdegmono(v - 1) /= 0 AND
                                      d = bsdegmono(v - 1) AND iepts`2)
                              IN
                              v1(bspoly, bsdegmono, cf, nvars, terms, nf,
                                 depth, intendpts, v - 1, nep),
                          combine)`ub_max
            AND unit_box_lb?(bspoly, bsdegmono, nvars, terms, cf, intendpts)
                            (iterate_left[Outminmax]
                                 (0, bsdegmono(v - 1),
                                  LAMBDA (d: upto(bsdegmono(v - 1))):
                                    LET nf
                                        =
                                        f WITH [(v - 1) := d],
                                        nep
                                        =
                                        ep
                                        AND
                                        (d = 0 AND iepts`1
                                         OR
                                         bsdegmono(v - 1) /= 0
                                         AND
                                         d = bsdegmono(v - 1) AND iepts`2)
                                      IN
                                      v1
                                      (bspoly,
                                       bsdegmono,
                                       cf,
                                       nvars,
                                       terms,
                                       nf,
                                       depth,
                                       intendpts,
                                       v - 1,
                                       nep),
                                  combine))
            AND unit_box_ub?(bspoly, bsdegmono, nvars, terms, cf, intendpts)
                            (iterate_left[Outminmax]
                                 (0, bsdegmono(v - 1),
                                  LAMBDA (d: upto(bsdegmono(v - 1))):
                                    LET nf
                                        =
                                        f WITH [(v - 1) := d],
                                        nep
                                        =
                                        ep
                                        AND
                                        (d = 0 AND iepts`1
                                         OR
                                         bsdegmono(v - 1) /= 0
                                         AND
                                         d = bsdegmono(v - 1) AND iepts`2)
                                      IN
                                      v1
                                      (bspoly,
                                       bsdegmono,
                                       cf,
                                       nvars,
                                       terms,
                                       nf,
                                       depth,
                                       intendpts,
                                       v - 1,
                                       nep),
                                  combine))
            AND length_eq?(nvars)
                          (iterate_left[Outminmax]
                               (0, bsdegmono(v - 1),
                                LAMBDA (d: upto(bsdegmono(v - 1))):
                                  LET nf
                                      =
                                      f WITH [(v - 1) := d],
                                      nep
                                      =
                                      ep
                                      AND
                                      (d = 0 AND iepts`1
                                       OR
                                       bsdegmono(v - 1) /= 0
                                       AND
                                       d = bsdegmono(v - 1) AND iepts`2)
                                    IN
                                    v1(bspoly,
                                       bsdegmono,
                                       cf,
                                       nvars,
                                       terms,
                                       nf,
                                       depth,
                                       intendpts,
                                       v - 1,
                                       nep),
                                combine))
            AND iterate_left[Outminmax]
                    (0, bsdegmono(v - 1),
                     LAMBDA (d: upto(bsdegmono(v - 1))):
                       LET nf = f WITH [(v - 1) := d],
                           nep =
                             ep AND
                              (d = 0 AND iepts`1 OR
                                bsdegmono(v - 1) /= 0 AND
                                 d = bsdegmono(v - 1) AND iepts`2)
                         IN
                         v1(bspoly, bsdegmono, cf, nvars, terms, nf, depth,
                            intendpts, v - 1, nep),
                     combine)`max_depth
                 = depth);


decl_type: tcc
theory: bernstein_minmax
library: Bernstein
signature: nil
location: 631 0 637 999
body:
  % Subtype TCC generated (at line 106, column 28) for  v - 1
      % expected type  nat
  Bern_coeffs_minmax_rec_TCC7: OBLIGATION
    FORALL (bsdegmono: DegreeMono, nvars: posnat, f: CoeffMono,
            intendpts: IntervalEndpoints, v: nat,
            (ep: (edge_point?(bsdegmono, nvars, f, intendpts, v)))):
      NOT v = 0 IMPLIES v - 1 >= 0;


decl_type: tcc
theory: bernstein_minmax
library: Bernstein
signature: nil
location: 639 0 646 999
body:
  % Subtype TCC generated (at line 120, column 88) for  TRUE
      % expected type  (edge_point?(bsdegmono, nvars, LAMBDA (i: nat): 0,
                     %              intendpts, nvars))
  Bern_coeffs_minmax_TCC1: OBLIGATION
    FORALL (bsdegmono: DegreeMono, nvars: posnat,
            intendpts: IntervalEndpoints):
      edge_point?(bsdegmono, nvars, LAMBDA (i: nat): 0, intendpts, nvars)
                 (TRUE);


decl_type: tcc
theory: bernstein_minmax
library: Bernstein
signature: nil
location: 648 0 661 999
body:
  % Subtype TCC generated (at line 120, column 4) for
      % Bern_coeffs_minmax_rec(bspoly, bsdegmono, cf, nvars, terms,
      %                        LAMBDA (i: nat): 0, depth, intendpts, nvars,
      %                        TRUE)
      % expected type  (sound?(bspoly, bsdegmono, nvars, terms, cf,
                     %         intendpts))
  Bern_coeffs_minmax_TCC2: OBLIGATION
    FORALL (bspoly: MultiBernstein, bsdegmono: DegreeMono, cf: Coeff,
            nvars: posnat, terms: posnat, depth: nat,
            intendpts: IntervalEndpoints):
      sound?(bspoly, bsdegmono, nvars, terms, cf, intendpts)
            (Bern_coeffs_minmax_rec(bspoly, bsdegmono, cf, nvars, terms,
                                    LAMBDA (i: nat): 0, depth, intendpts,
                                    nvars, TRUE));


decl_type: tcc
theory: bernstein_minmax
library: Bernstein
signature: nil
location: 663 0 666 999
body:
  % Subtype TCC generated (at line 189, column 14) for  depth - level
      % expected type  naturalnumber
  Bernstein_minmax_rec_TCC1: OBLIGATION
    FORALL (depth: nat, (level: upto(depth))): depth - level >= 0;


decl_type: tcc
theory: bernstein_minmax
library: Bernstein
signature: nil
location: 668 0 687 999
body:
  % Subtype TCC generated (at line 158, column 8) for  minmax
      % expected type  (sound?(bspoly, bsdegmono, nvars, terms, cf,
                     %         intendpts))
  Bernstein_minmax_rec_TCC2: OBLIGATION
    FORALL (bspoly: MultiBernstein, bsdegmono: DegreeMono, nvars: posnat,
            terms: posnat, cf: Coeff, depth: nat, (level: upto(depth)),
            localexit: [Outminmax -> bool], globalexit: [Outminmax -> bool],
            intendpts: IntervalEndpoints, omm: Outminmax,
            bp: [nat -> [nat -> [nat -> real]]]):
      bp = translist(polylist(bspoly, bsdegmono, nvars, terms)) IMPLIES
       (FORALL (minmax:
                  (sound?(bp, bsdegmono, nvars, terms, cf, intendpts))):
          (level = depth OR
            localexit(minmax) OR between?(omm, minmax) OR globalexit(minmax))
           AND
           minmax =
            Bern_coeffs_minmax(bp, bsdegmono, cf, nvars, terms, level,
                               intendpts)
           IMPLIES
           sound?(bspoly, bsdegmono, nvars, terms, cf, intendpts)(minmax));


decl_type: tcc
theory: bernstein_minmax
library: Bernstein
signature: nil
location: 689 0 722 999
body:
  % Subtype TCC generated (at line 165, column 35) for  v
      % expected type  nat
  Bernstein_minmax_rec_TCC3: OBLIGATION
    FORALL (bspoly: MultiBernstein, bsdegmono: DegreeMono, nvars: posnat,
            terms: posnat, cf: Coeff, depth: nat, (level: upto(depth)),
            localexit: [Outminmax -> bool], globalexit: [Outminmax -> bool],
            intendpts: IntervalEndpoints, varselect: VarSelector,
            omm: Outminmax, bp: [nat -> [nat -> [nat -> real]]]):
      bp = translist(polylist(bspoly, bsdegmono, nvars, terms)) IMPLIES
       (FORALL (minmax:
                  (sound?(bp, bsdegmono, nvars, terms, cf, intendpts))):
               NOT level = depth AND NOT localexit(minmax)
           AND NOT between?(omm, minmax) AND NOT globalexit(minmax)
           AND minmax =
                Bern_coeffs_minmax(bp, bsdegmono, cf, nvars, terms, level,
                                   intendpts)
           IMPLIES
           (FORALL (varsel: [bool, nat]):
              varsel = varselect(bp, bsdegmono, nvars, terms, cf, level)
               IMPLIES
               (FORALL (v: {k | abs(k) < abs(nvars)}):
                  v = mod(varsel`2, nvars) IMPLIES
                   (FORALL (spleft: [nat -> Polyproduct]):
                      (spleft =
                        (LAMBDA (k: nat):
                           Bern_split_left_mono(bp(k), bsdegmono)
                                               (mod(varsel`2, nvars))))
                       IMPLIES
                       (FORALL (spright: [nat -> Polyproduct]):
                          (spright =
                            (LAMBDA (k: nat):
                               Bern_split_right_mono(bp(k), bsdegmono)
                                                    (mod(varsel`2, nvars))))
                           IMPLIES v >= 0)))));


decl_type: tcc
theory: bernstein_minmax
library: Bernstein
signature: nil
location: 724 0 816 999
body:
  % Subtype TCC generated (at line 173, column 81) for  level
      % expected type  upto(depth)
  Bernstein_minmax_rec_TCC4: OBLIGATION
    FORALL (bspoly: MultiBernstein, bsdegmono: DegreeMono, nvars: posnat,
            terms: posnat, cf: Coeff, depth: nat, (level: upto(depth)),
            localexit: [Outminmax -> bool], globalexit: [Outminmax -> bool],
            intendpts: IntervalEndpoints, varselect: VarSelector,
            omm: Outminmax, bp: [nat -> [nat -> [nat -> real]]]):
      bp = translist(polylist(bspoly, bsdegmono, nvars, terms)) IMPLIES
       (FORALL (minmax:
                  (sound?(bp, bsdegmono, nvars, terms, cf, intendpts))):
               NOT level = depth AND NOT localexit(minmax)
           AND NOT between?(omm, minmax) AND NOT globalexit(minmax)
           AND minmax =
                Bern_coeffs_minmax(bp, bsdegmono, cf, nvars, terms, level,
                                   intendpts)
           IMPLIES
           (FORALL (varsel: [bool, nat]):
              varsel = varselect(bp, bsdegmono, nvars, terms, cf, level)
               IMPLIES
               (FORALL (v: {k | abs(k) < abs(nvars)}):
                  v = mod(varsel`2, nvars) IMPLIES
                   (FORALL (spleft: [nat -> Polyproduct]):
                      (spleft =
                        (LAMBDA (k: nat):
                           Bern_split_left_mono(bp(k), bsdegmono)
                                               (mod(varsel`2, nvars))))
                       IMPLIES
                       (FORALL (spright: [nat -> Polyproduct]):
                          (spright =
                            (LAMBDA (k: nat):
                               Bern_split_right_mono(bp(k), bsdegmono)
                                                    (mod(varsel`2, nvars))))
                           IMPLIES
                           (FORALL (ipleft: IntervalEndpoints):
                              ipleft = intendpts WITH [(v)`2 := TRUE] IMPLIES
                               (FORALL (ipright: IntervalEndpoints):
                                  ipright = intendpts WITH [(v)`1 := TRUE]
                                   IMPLIES
                                   (FORALL (LR1: [nat -> Polyproduct],
                                            LR2: [nat -> Polyproduct]):
                                      LR2
                                      =
                                      IF varsel`1
                                      THEN (spleft, spright)
                                      ELSE (spright, spleft)
                                      ENDIF`2
                                      AND
                                      LR1
                                      =
                                      IF varsel`1
                                      THEN (spleft, spright)
                                      ELSE (spright, spleft)
                                      ENDIF`1
                                      IMPLIES
                                      (FORALL
                                       (LR1intendpts: IntervalEndpoints):
                                       LR1intendpts
                                       =
                                       IF varsel`1
                                       THEN ipleft
                                       ELSE ipright
                                       ENDIF
                                       IMPLIES
                                       (FORALL
                                        (LR2intendpts: IntervalEndpoints):
                                        LR2intendpts
                                        =
                                        IF varsel`1
                                        THEN ipright
                                        ELSE ipleft
                                        ENDIF
                                        IMPLIES
                                        (FORALL
                                         (combine_this:
                                          [[nat, Outminmax, Outminmax] ->
                                           Outminmax]):
                                         combine_this
                                         =
                                         IF varsel`1
                                         THEN combine_l
                                         ELSE combine_r
                                         ENDIF
                                         IMPLIES
                                         (FORALL
                                          (newmm1: Outminmax):
                                          newmm1 = combine(omm, minmax)
                                          IMPLIES
                                          (FORALL
                                           (level1: posint):
                                           level1 = level + 1
                                           IMPLIES
                                           level1 <= depth)))))))))))));


decl_type: tcc
theory: bernstein_minmax
library: Bernstein
signature: nil
location: 818 0 914 999
body:
  % Termination TCC generated (at line 173, column 25) for
      % Bernstein_minmax_rec(LR1, bsdegmono, nvars, terms, cf, depth, level,
      %                      localexit, globalexit, LR1intendpts, varselect,
      %                      newmm1)
  Bernstein_minmax_rec_TCC5: OBLIGATION
    FORALL (bspoly: MultiBernstein, bsdegmono: DegreeMono, nvars: posnat,
            terms: posnat, cf: Coeff, depth: nat, (level: upto(depth)),
            localexit: [Outminmax -> bool], globalexit: [Outminmax -> bool],
            intendpts: IntervalEndpoints, varselect: VarSelector,
            omm: Outminmax, bp: [nat -> [nat -> [nat -> real]]]):
      bp = translist(polylist(bspoly, bsdegmono, nvars, terms)) IMPLIES
       (FORALL (minmax:
                  (sound?(bp, bsdegmono, nvars, terms, cf, intendpts))):
               NOT level = depth AND NOT localexit(minmax)
           AND NOT between?(omm, minmax) AND NOT globalexit(minmax)
           AND minmax =
                Bern_coeffs_minmax(bp, bsdegmono, cf, nvars, terms, level,
                                   intendpts)
           IMPLIES
           (FORALL (varsel: [bool, nat]):
              varsel = varselect(bp, bsdegmono, nvars, terms, cf, level)
               IMPLIES
               (FORALL (v: {k | abs(k) < abs(nvars)}):
                  v = mod(varsel`2, nvars) IMPLIES
                   (FORALL (spleft: [nat -> Polyproduct]):
                      (spleft =
                        (LAMBDA (k: nat):
                           Bern_split_left_mono(bp(k), bsdegmono)
                                               (mod(varsel`2, nvars))))
                       IMPLIES
                       (FORALL (spright: [nat -> Polyproduct]):
                          (spright =
                            (LAMBDA (k: nat):
                               Bern_split_right_mono(bp(k), bsdegmono)
                                                    (mod(varsel`2, nvars))))
                           IMPLIES
                           (FORALL (ipleft: IntervalEndpoints):
                              ipleft = intendpts WITH [(v)`2 := TRUE] IMPLIES
                               (FORALL (ipright: IntervalEndpoints):
                                  ipright = intendpts WITH [(v)`1 := TRUE]
                                   IMPLIES
                                   (FORALL (LR1: [nat -> Polyproduct],
                                            LR2: [nat -> Polyproduct]):
                                      LR2
                                      =
                                      IF varsel`1
                                      THEN (spleft, spright)
                                      ELSE (spright, spleft)
                                      ENDIF`2
                                      AND
                                      LR1
                                      =
                                      IF varsel`1
                                      THEN (spleft, spright)
                                      ELSE (spright, spleft)
                                      ENDIF`1
                                      IMPLIES
                                      (FORALL
                                       (LR1intendpts: IntervalEndpoints):
                                       LR1intendpts
                                       =
                                       IF varsel`1
                                       THEN ipleft
                                       ELSE ipright
                                       ENDIF
                                       IMPLIES
                                       (FORALL
                                        (LR2intendpts: IntervalEndpoints):
                                        LR2intendpts
                                        =
                                        IF varsel`1
                                        THEN ipright
                                        ELSE ipleft
                                        ENDIF
                                        IMPLIES
                                        (FORALL
                                         (combine_this:
                                          [[nat, Outminmax, Outminmax] ->
                                           Outminmax]):
                                         combine_this
                                         =
                                         IF varsel`1
                                         THEN combine_l
                                         ELSE combine_r
                                         ENDIF
                                         IMPLIES
                                         (FORALL
                                          (newmm1: Outminmax):
                                          newmm1 = combine(omm, minmax)
                                          IMPLIES
                                          (FORALL
                                           (level1: posint):
                                           level1 = level + 1
                                           IMPLIES
                                           depth - level1
                                           <
                                           depth - level)))))))))))));


