# Declarations

decl_type: tcc
theory: lebesgue_fundamental
library: lebesgue
signature: nil
location: 82 0 86 999
body:
  % Assuming TCC generated (at line 20, column 4) for
      % restriction_integral[(closed(a, b)), real]
      % generated from assumption restriction_integral.not_one_element_T2
  IMP_restriction_integral_TCC4: OBLIGATION
    FORALL (x: real): EXISTS (y: real): x /= y;


decl_type: tcc
theory: lebesgue_fundamental
library: lebesgue
signature: nil
location: 88 0 92 999
body:
  % Assuming TCC generated (at line 20, column 4) for
      % restriction_integral[(closed(a, b)), real]
      % generated from assumption restriction_integral.sub_domain
  IMP_restriction_integral_TCC5: OBLIGATION
    FORALL (x: (closed(a, b))): EXISTS (y: real): x = y;


decl_type: tcc
theory: lebesgue_fundamental
library: lebesgue
signature: nil
location: 94 0 97 999
body:
  % Assuming TCC generated (at line 22, column 11) for
      % deriv_fun[(closed(a, b))]
      % generated from assumption derivatives.deriv_domain
  F_TCC1: OBLIGATION deriv_domain?[(closed(a, b))];


decl_type: tcc
theory: lebesgue_fundamental
library: lebesgue
signature: nil
location: 99 0 105 999
body:
  % Subtype TCC generated (at line 32, column 48) for  b
      % expected type  (closed(a, b))
  fundamental_lebesgue_TCC1: OBLIGATION
    FORALL (F: deriv_fun[(closed(a, b))], f: continuous_on[(closed(a, b))]):
      deriv(F) = restrict[real, (closed(a, b)), real](f) AND
       integrable?(closed(a, b))(f)
       IMPLIES closed(a, b)(b);


decl_type: tcc
theory: lebesgue_fundamental
library: lebesgue
signature: nil
location: 107 0 113 999
body:
  % Subtype TCC generated (at line 32, column 55) for  a
      % expected type  (closed(a, b))
  fundamental_lebesgue_TCC2: OBLIGATION
    FORALL (F: deriv_fun[(closed(a, b))], f: continuous_on[(closed(a, b))]):
      deriv(F) = restrict[real, (closed(a, b)), real](f) AND
       integrable?(closed(a, b))(f)
       IMPLIES closed(a, b)(a);


decl_type: tcc
theory: lebesgue_fundamental
library: lebesgue
signature: nil
location: 115 0 129 999
body:
  % Subtype TCC generated (at line 38, column 35) for  b
      % expected type  (closed(a, b))
  integration_by_parts_TCC1: OBLIGATION
    FORALL (F, G: deriv_fun[(closed(a, b))],
            f, g: continuous_on[(closed(a, b))]):
      deriv(G) = restrict[real, (closed(a, b)), real](g) AND
       deriv(F) = restrict[real, (closed(a, b)), real](f) AND
        integrable?(closed(a, b))
                   (LAMBDA (x):
                      extend[real, (closed(a, b)), real, 0](F)(x) * g(x))
         AND
         integrable?(closed(a, b))
                    (LAMBDA (x):
                       extend[real, (closed(a, b)), real, 0](G)(x) * f(x))
       IMPLIES closed(a, b)(b);


decl_type: tcc
theory: lebesgue_fundamental
library: lebesgue
signature: nil
location: 131 0 145 999
body:
  % Subtype TCC generated (at line 38, column 45) for  a
      % expected type  (closed(a, b))
  integration_by_parts_TCC2: OBLIGATION
    FORALL (F, G: deriv_fun[(closed(a, b))],
            f, g: continuous_on[(closed(a, b))]):
      deriv(G) = restrict[real, (closed(a, b)), real](g) AND
       deriv(F) = restrict[real, (closed(a, b)), real](f) AND
        integrable?(closed(a, b))
                   (LAMBDA (x):
                      extend[real, (closed(a, b)), real, 0](F)(x) * g(x))
         AND
         integrable?(closed(a, b))
                    (LAMBDA (x):
                       extend[real, (closed(a, b)), real, 0](G)(x) * f(x))
       IMPLIES closed(a, b)(a);


decl_type: formula
theory: bounded_interval_props
library: lebesgue
signature: nil
location: 18 2 19 34
body:
    bounded_interval2: LEMMA nonempty?[real](A) AND inf(A) < a AND a < sup(A)
                             => A(a)


decl_type: formula
theory: bounded_interval_props
library: lebesgue
signature: nil
location: 21 2 22 43
body:
    bounded_interval4: LEMMA disjoint?[real](A,B) AND A(a) AND B(b) AND a <= b =>
                             sup(A) <= inf(B)


decl_type: formula
theory: bounded_interval_props
library: lebesgue
signature: nil
location: 23 2 24 54
body:
    bounded_interval5: LEMMA disjoint?[real](A,B) AND A(a) AND B(b) AND a <= b =>
                             FORALL (x:(A),y:(B)): x < y


decl_type: formula
theory: bounded_interval_props
library: lebesgue
signature: nil
location: 26 2 29 26
body:
    bounded_interval_disjoint_union1:
       LEMMA disjoint?[real](A,B) AND bounded_interval?(union[real](A,B)) AND
             A(a) AND B(b) AND a <= b =>
             sup(A) = inf(B)


decl_type: formula
theory: bounded_interval_props
library: lebesgue
signature: nil
location: 31 2 34 35
body:
    bounded_interval_disjoint_union2:
       LEMMA disjoint?[real](A,B) AND bounded_interval?(union[real](A,B)) AND
             A(a) AND B(b) AND a <= b =>
             (A(sup(A)) OR B(inf(B)))


decl_type: formula
theory: bounded_interval_props
library: lebesgue
signature: nil
location: 36 2 39 41
body:
    bounded_interval_disjoint_union3:
       LEMMA disjoint?[real](A,B) AND bounded_interval?(union[real](A,B)) AND
             A(a) AND B(b) AND a <= b =>
             inf(union[real](A,B)) = inf(A)


decl_type: formula
theory: bounded_interval_props
library: lebesgue
signature: nil
location: 41 2 44 41
body:
    bounded_interval_disjoint_union4:
       LEMMA disjoint?[real](A,B) AND bounded_interval?(union[real](A,B)) AND
             A(a) AND B(b) AND a <= b =>
             sup(union[real](A,B)) = sup(B)


decl_type: tcc
theory: bounded_interval_props
library: lebesgue
signature: nil
location: 51 0 55 999
body:
  % Subtype TCC generated (at line 17, column 39) for  A
      % expected type  Sl: inf_set[real]
  bounded_interval1_TCC1: OBLIGATION
    FORALL (A: bounded_interval, a: real):
      A(a) IMPLIES nonempty?[real](A) AND below_bounded[real](A);


decl_type: tcc
theory: bounded_interval_props
library: lebesgue
signature: nil
location: 57 0 62 999
body:
  % Subtype TCC generated (at line 17, column 60) for  A
      % expected type  Su: sup_set[real]
  bounded_interval1_TCC2: OBLIGATION
    FORALL (A: bounded_interval, a: real):
      A(a) AND inf(A) <= a IMPLIES
       nonempty?[real](A) AND above_bounded[real](A);


decl_type: tcc
theory: bounded_interval_props
library: lebesgue
signature: nil
location: 64 0 68 999
body:
  % Subtype TCC generated (at line 18, column 54) for  A
      % expected type  Sl: inf_set[real]
  bounded_interval2_TCC1: OBLIGATION
    FORALL (A: bounded_interval):
      nonempty?[real](A) IMPLIES below_bounded[real](A);


decl_type: tcc
theory: bounded_interval_props
library: lebesgue
signature: nil
location: 70 0 74 999
body:
  % Subtype TCC generated (at line 18, column 73) for  A
      % expected type  Su: sup_set[real]
  bounded_interval2_TCC2: OBLIGATION
    FORALL (A: bounded_interval, a: real):
      nonempty?[real](A) AND inf(A) < a IMPLIES above_bounded[real](A);


decl_type: tcc
theory: bounded_interval_props
library: lebesgue
signature: nil
location: 76 0 80 999
body:
  % Subtype TCC generated (at line 20, column 63) for  A
      % expected type  Su: sup_set[real]
  bounded_interval3_TCC1: OBLIGATION
    FORALL (A: bounded_interval):
      nonempty?[real](A) IMPLIES above_bounded[real](A);


decl_type: tcc
theory: bounded_interval_props
library: lebesgue
signature: nil
location: 82 0 87 999
body:
  % Subtype TCC generated (at line 22, column 31) for  A
      % expected type  Su: sup_set[real]
  bounded_interval4_TCC1: OBLIGATION
    FORALL (A, B: bounded_interval, a, b: real):
      a <= b AND B(b) AND A(a) AND disjoint?[real](A, B) IMPLIES
       nonempty?[real](A) AND above_bounded[real](A);


decl_type: tcc
theory: bounded_interval_props
library: lebesgue
signature: nil
location: 89 0 94 999
body:
  % Subtype TCC generated (at line 22, column 41) for  B
      % expected type  Sl: inf_set[real]
  bounded_interval4_TCC2: OBLIGATION
    FORALL (A, B: bounded_interval, a, b: real):
      a <= b AND B(b) AND A(a) AND disjoint?[real](A, B) IMPLIES
       nonempty?[real](B) AND below_bounded[real](B);


decl_type: tcc
theory: bounded_interval_props
library: lebesgue
signature: nil
location: 96 0 104 999
body:
  % Subtype TCC generated (at line 39, column 15) for  union[real](A, B)
      % expected type  Sl: inf_set[real]
  bounded_interval_disjoint_union3_TCC1: OBLIGATION
    FORALL (A, B: bounded_interval, a, b: real):
           a <= b AND B(b) AND A(a) AND bounded_interval?(union[real](A, B))
       AND disjoint?[real](A, B)
       IMPLIES
       nonempty?[real](union[real](A, B)) AND
        below_bounded[real](union[real](A, B));


decl_type: tcc
theory: bounded_interval_props
library: lebesgue
signature: nil
location: 106 0 114 999
body:
  % Subtype TCC generated (at line 44, column 15) for  union[real](A, B)
      % expected type  Su: sup_set[real]
  bounded_interval_disjoint_union4_TCC1: OBLIGATION
    FORALL (A, B: bounded_interval, a, b: real):
           a <= b AND B(b) AND A(a) AND bounded_interval?(union[real](A, B))
       AND disjoint?[real](A, B)
       IMPLIES
       nonempty?[real](union[real](A, B)) AND
        above_bounded[real](union[real](A, B));


decl_type: tcc
theory: bounded_interval_props
library: lebesgue
signature: nil
location: 116 0 122 999
body:
  % Subtype TCC generated (at line 44, column 39) for  B
      % expected type  Su: sup_set[real]
  bounded_interval_disjoint_union4_TCC2: OBLIGATION
    FORALL (A, B: bounded_interval, a, b: real):
           a <= b AND B(b) AND A(a) AND bounded_interval?(union[real](A, B))
       AND disjoint?[real](A, B)
       IMPLIES nonempty?[real](B) AND above_bounded[real](B);


decl_type: formula
theory: sigma_lemmas
library: linear_algebra
signature: nil
location: 28 1 28 221
body:
   sigma_restrict_dom: LEMMA FORALL (j: posnat, m: posnat, F: [below[m] -> real],G: [below[m+1] -> real]): (FORALL (i: below[m]): F(i) = G(i)) IMPLIES (j <= m IMPLIES sigma[below[m]](0,j - 1,F) = sigma[below[m+1]](0,j-1,G))


decl_type: formula
theory: sigma_lemmas
library: linear_algebra
signature: nil
location: 30 1 30 216
body:
   sigma_restrict_dom2:  LEMMA FORALL (j: posnat, m: posnat, F: [below[m] -> real],G: [below[m+1] -> real]): (FORALL (i: below[m]): F(i) = G(i)) IMPLIES (j < m IMPLIES sigma[below[m]](1,j,F) = sigma[below[m+1]](1,j,G))


decl_type: formula
theory: sigma_lemmas
library: linear_algebra
signature: nil
location: 34 1 34 167
body:
   sigma_below_shift: LEMMA FORALL (m: posnat, F:[below[m + 1] -> real]):  sigma(1, m, LAMBDA (i: below[1 + m]): F(i)) =  sigma(0, m - 1, LAMBDA (i: below[m]): F(i + 1))


decl_type: formula
theory: sigma_lemmas
library: linear_algebra
signature: nil
location: 38 1 38 227
body:
   sigma_eq_index: LEMMA FORALL (m,n: posnat, F: [below[m] -> real],G: [below[n] -> real]): (m = n AND FORALL (i: below[m]): F(i) = G(i)) IMPLIES sigma(0,m - 1,LAMBDA(i: Index[m]): F(i)) = sigma(0,n - 1,LAMBDA(i: Index[n]): G(i))


decl_type: formula
theory: sigma_lemmas
library: linear_algebra
signature: nil
location: 41 1 41 239
body:
   aux_sigma: LEMMA FORALL (m: posnat,n: nat, F: [below[m] -> real],G: [below[m + n] -> real]): (n = 0 AND FORALL (i: below[m]): F(i) = G(i)) IMPLIES sigma(0,m - 1,LAMBDA(i: below[m]): F(i)) = sigma(0,m + n - 1,LAMBDA(i: below[m + n]): G(i))


decl_type: formula
theory: sigma_lemmas
library: linear_algebra
signature: nil
location: 44 1 44 253
body:
   aux_sigma2: LEMMA FORALL (m,j: posnat,n: nat, F: [below[m] -> real],G: [below[m + n] -> real]): (n = 0 AND j <= m AND FORALL (i: below[m]): F(i) = G(i)) IMPLIES sigma(0,j - 1,LAMBDA(i: below[m]): F(i)) = sigma(0,j + n - 1,LAMBDA(i: below[m + n]): G(i))


decl_type: formula
theory: sigma_lemmas
library: linear_algebra
signature: nil
location: 47 1 47 227
body:
   sigma_restrict_gen: LEMMA FORALL (j: posnat, m,n: posnat, F: [below[m] -> real],G: [below[m + n] -> real]): (FORALL (i: below[m]): F(i) = G(i)) IMPLIES (j <= m IMPLIES sigma[below[m]](0,j - 1,F) = sigma[below[m + n]](0,j-1,G))


decl_type: formula
theory: sigma_lemmas
library: linear_algebra
signature: nil
location: 51 1 51 241
body:
   sigma_eq_index2: LEMMA FORALL (m,n,j: posnat, F: [below[m] -> real],G: [below[n] -> real]): (m = n AND j <= m AND FORALL (i: below[m]): F(i) = G(i)) IMPLIES sigma(0,j - 1,LAMBDA(i: Index[m]): F(i)) = sigma(0,j - 1,LAMBDA(i: Index[n]): G(i))


decl_type: formula
theory: sigma_lemmas
library: linear_algebra
signature: nil
location: 54 2 54 245
body:
    sigma_restrict_gen2: LEMMA FORALL (j: posnat,k: nat,m,n: posnat, F: [below[m] -> real],G: [below[m + n] -> real]): (FORALL (i: below[m]): F(i) = G(i)) IMPLIES (j <= m AND k < j IMPLIES sigma[below[m]](k,j - 1,F) = sigma[below[m + n]](k,j-1,G))


decl_type: formula
theory: sigma_lemmas
library: linear_algebra
signature: nil
location: 58 1 58 253
body:
   sigma_eq_index3: LEMMA FORALL (m,n,j,k: posnat, F: [below[m] -> real],G: [below[n] -> real]): (m = n AND j <= m AND k < j AND FORALL (i: below[m]): F(i) = G(i)) IMPLIES sigma(k,j - 1,LAMBDA(i: Index[m]): F(i)) = sigma(k,j - 1,LAMBDA(i: Index[n]): G(i))


decl_type: formula
theory: sigma_lemmas
library: linear_algebra
signature: nil
location: 61 1 61 222
body:
   sigma_shift_gen: LEMMA FORALL (j: posnat, m,n: posnat,F: [below[m + n] -> real]): (j <= m IMPLIES sigma[below[m]](0,j - 1,LAMBDA (i: below[m]): F(i + n)) = sigma[below[m + n]](n,j - 1 + n, LAMBDA (i: below[m + n]): F(i)))


decl_type: tcc
theory: sigma_lemmas
library: linear_algebra
signature: nil
location: 69 0 72 999
body:
  % Subtype TCC generated (at line 28, column 137) for  i
      % expected type  below[m + 1]
  sigma_restrict_dom_TCC1: OBLIGATION
    FORALL (m: posnat, i: below[m]): i < 1 + m;


decl_type: tcc
theory: sigma_lemmas
library: linear_algebra
signature: nil
location: 74 0 80 999
body:
  % Subtype TCC generated (at line 28, column 181) for  0
      % expected type  T_low[below[m]]
  sigma_restrict_dom_TCC2: OBLIGATION
    FORALL (j: posnat, m: posnat, F: [below[m] -> real],
            G: [below[m + 1] -> real]):
      j <= m AND (FORALL (i: below[m]): F(i) = G(i)) IMPLIES
       0 >= 0 AND 0 < m OR (EXISTS (j: below[m]): j <= 0);


decl_type: tcc
theory: sigma_lemmas
library: linear_algebra
signature: nil
location: 82 0 88 999
body:
  % Subtype TCC generated (at line 28, column 183) for  j - 1
      % expected type  T_high[below[m]]
  sigma_restrict_dom_TCC3: OBLIGATION
    FORALL (j: posnat, m: posnat, F: [below[m] -> real],
            G: [below[m + 1] -> real]):
      j <= m AND (FORALL (i: below[m]): F(i) = G(i)) IMPLIES
       j - 1 >= 0 AND j - 1 < m OR (EXISTS (j_1: below[m]): j - 1 <= j_1);


decl_type: tcc
theory: sigma_lemmas
library: linear_algebra
signature: nil
location: 90 0 97 999
body:
  % Assuming TCC generated (at line 41, column 5) for  reals@sigma[below[m]]
      % generated from assumption sigma.connected_domain
  sigma_restrict_dom_TCC4: OBLIGATION
    FORALL (j: posnat, m: posnat, F: [below[m] -> real],
            G: [below[m + 1] -> real]):
      j <= m AND (FORALL (i: below[m]): F(i) = G(i)) IMPLIES
       (FORALL (x, y: below[m]), (z: integer):
          x <= z AND z <= y IMPLIES z >= 0 AND z < m);


decl_type: tcc
theory: sigma_lemmas
library: linear_algebra
signature: nil
location: 99 0 105 999
body:
  % Subtype TCC generated (at line 28, column 212) for  0
      % expected type  T_low[below[m + 1]]
  sigma_restrict_dom_TCC5: OBLIGATION
    FORALL (j: posnat, m: posnat, F: [below[m] -> real],
            G: [below[m + 1] -> real]):
      j <= m AND (FORALL (i: below[m]): F(i) = G(i)) IMPLIES
       0 >= 0 AND 0 < 1 + m OR (EXISTS (j: below[1 + m]): j <= 0);


decl_type: tcc
theory: sigma_lemmas
library: linear_algebra
signature: nil
location: 107 0 114 999
body:
  % Subtype TCC generated (at line 28, column 214) for  j - 1
      % expected type  T_high[below[m + 1]]
  sigma_restrict_dom_TCC6: OBLIGATION
    FORALL (j: posnat, m: posnat, F: [below[m] -> real],
            G: [below[m + 1] -> real]):
      j <= m AND (FORALL (i: below[m]): F(i) = G(i)) IMPLIES
       j - 1 >= 0 AND j - 1 < 1 + m OR
        (EXISTS (j_1: below[1 + m]): j - 1 <= j_1);


decl_type: tcc
theory: sigma_lemmas
library: linear_algebra
signature: nil
location: 116 0 124 999
body:
  % Assuming TCC generated (at line 41, column 5) for
      % reals@sigma[below[m + 1]]
      % generated from assumption sigma.connected_domain
  sigma_restrict_dom_TCC7: OBLIGATION
    FORALL (j: posnat, m: posnat, F: [below[m] -> real],
            G: [below[m + 1] -> real]):
      j <= m AND (FORALL (i: below[m]): F(i) = G(i)) IMPLIES
       (FORALL (x, y: below[1 + m]), (z: integer):
          x <= z AND z <= y IMPLIES z >= 0 AND z < 1 + m);


decl_type: tcc
theory: sigma_lemmas
library: linear_algebra
signature: nil
location: 126 0 132 999
body:
  % Subtype TCC generated (at line 30, column 182) for  1
      % expected type  T_low[below[m]]
  sigma_restrict_dom2_TCC1: OBLIGATION
    FORALL (j: posnat, m: posnat, F: [below[m] -> real],
            G: [below[m + 1] -> real]):
      j < m AND (FORALL (i: below[m]): F(i) = G(i)) IMPLIES
       1 >= 0 AND 1 < m OR (EXISTS (j: below[m]): j <= 1);


decl_type: tcc
theory: sigma_lemmas
library: linear_algebra
signature: nil
location: 134 0 140 999
body:
  % Subtype TCC generated (at line 30, column 184) for  j
      % expected type  T_high[below[m]]
  sigma_restrict_dom2_TCC2: OBLIGATION
    FORALL (j: posnat, m: posnat, F: [below[m] -> real],
            G: [below[m + 1] -> real]):
      j < m AND (FORALL (i: below[m]): F(i) = G(i)) IMPLIES
       j >= 0 AND j < m OR (EXISTS (j_1: below[m]): j <= j_1);


decl_type: tcc
theory: sigma_lemmas
library: linear_algebra
signature: nil
location: 142 0 149 999
body:
  % Assuming TCC generated (at line 41, column 5) for  reals@sigma[below[m]]
      % generated from assumption sigma.connected_domain
  sigma_restrict_dom2_TCC3: OBLIGATION
    FORALL (j: posnat, m: posnat, F: [below[m] -> real],
            G: [below[m + 1] -> real]):
      j < m AND (FORALL (i: below[m]): F(i) = G(i)) IMPLIES
       (FORALL (x, y: below[m]), (z: integer):
          x <= z AND z <= y IMPLIES z >= 0 AND z < m);


decl_type: tcc
theory: sigma_lemmas
library: linear_algebra
signature: nil
location: 151 0 157 999
body:
  % Subtype TCC generated (at line 30, column 209) for  1
      % expected type  T_low[below[m + 1]]
  sigma_restrict_dom2_TCC4: OBLIGATION
    FORALL (j: posnat, m: posnat, F: [below[m] -> real],
            G: [below[m + 1] -> real]):
      j < m AND (FORALL (i: below[m]): F(i) = G(i)) IMPLIES
       1 >= 0 AND 1 < 1 + m OR (EXISTS (j: below[1 + m]): j <= 1);


decl_type: tcc
theory: sigma_lemmas
library: linear_algebra
signature: nil
location: 159 0 165 999
body:
  % Subtype TCC generated (at line 30, column 211) for  j
      % expected type  T_high[below[m + 1]]
  sigma_restrict_dom2_TCC5: OBLIGATION
    FORALL (j: posnat, m: posnat, F: [below[m] -> real],
            G: [below[m + 1] -> real]):
      j < m AND (FORALL (i: below[m]): F(i) = G(i)) IMPLIES
       j >= 0 AND j < 1 + m OR (EXISTS (j_1: below[1 + m]): j <= j_1);


decl_type: tcc
theory: sigma_lemmas
library: linear_algebra
signature: nil
location: 167 0 175 999
body:
  % Assuming TCC generated (at line 41, column 5) for
      % reals@sigma[below[m + 1]]
      % generated from assumption sigma.connected_domain
  sigma_restrict_dom2_TCC6: OBLIGATION
    FORALL (j: posnat, m: posnat, F: [below[m] -> real],
            G: [below[m + 1] -> real]):
      j < m AND (FORALL (i: below[m]): F(i) = G(i)) IMPLIES
       (FORALL (x, y: below[1 + m]), (z: integer):
          x <= z AND z <= y IMPLIES z >= 0 AND z < 1 + m);


decl_type: tcc
theory: sigma_lemmas
library: linear_algebra
signature: nil
location: 177 0 181 999
body:
  % Subtype TCC generated (at line 34, column 79) for  1
      % expected type  T_low[below[1 + m]]
  sigma_below_shift_TCC1: OBLIGATION
    FORALL (m: posnat):
      1 >= 0 AND 1 < 1 + m OR (EXISTS (j: below[1 + m]): j <= 1);


decl_type: tcc
theory: sigma_lemmas
library: linear_algebra
signature: nil
location: 183 0 187 999
body:
  % Subtype TCC generated (at line 34, column 82) for  m
      % expected type  T_high[below[1 + m]]
  sigma_below_shift_TCC2: OBLIGATION
    FORALL (m: posnat):
      m >= 0 AND m < 1 + m OR (EXISTS (j: below[1 + m]): m <= j);


decl_type: tcc
theory: sigma_lemmas
library: linear_algebra
signature: nil
location: 189 0 195 999
body:
  % Assuming TCC generated (at line 21, column 12) for
      % reals@sigma[below[1 + m]]
      % generated from assumption sigma.connected_domain
  sigma_below_shift_TCC3: OBLIGATION
    FORALL (m: posnat):
      (FORALL (x, y: below[1 + m]), (z: integer):
         x <= z AND z <= y IMPLIES z >= 0 AND z < 1 + m);


decl_type: tcc
theory: sigma_lemmas
library: linear_algebra
signature: nil
location: 197 0 200 999
body:
  % Subtype TCC generated (at line 34, column 126) for  0
      % expected type  T_low[below[m]]
  sigma_below_shift_TCC4: OBLIGATION
    FORALL (m: posnat): 0 >= 0 AND 0 < m OR (EXISTS (j: below[m]): j <= 0);


decl_type: tcc
theory: sigma_lemmas
library: linear_algebra
signature: nil
location: 202 0 206 999
body:
  % Subtype TCC generated (at line 34, column 129) for  m - 1
      % expected type  T_high[below[m]]
  sigma_below_shift_TCC5: OBLIGATION
    FORALL (m: posnat):
      m - 1 >= 0 AND m - 1 < m OR (EXISTS (j: below[m]): m - 1 <= j);


decl_type: tcc
theory: sigma_lemmas
library: linear_algebra
signature: nil
location: 208 0 211 999
body:
  % Subtype TCC generated (at line 34, column 160) for  i + 1
      % expected type  below[m + 1]
  sigma_below_shift_TCC6: OBLIGATION
    FORALL (m: posnat, i: below[m]): i + 1 < 1 + m;


decl_type: tcc
theory: sigma_lemmas
library: linear_algebra
signature: nil
location: 213 0 218 999
body:
  % Assuming TCC generated (at line 21, column 12) for  reals@sigma[below[m]]
      % generated from assumption sigma.connected_domain
  sigma_below_shift_TCC7: OBLIGATION
    FORALL (m: posnat):
      (FORALL (x, y: below[m]), (z: integer):
         x <= z AND z <= y IMPLIES z >= 0 AND z < m);


decl_type: tcc
theory: sigma_lemmas
library: linear_algebra
signature: nil
location: 220 0 223 999
body:
  % Subtype TCC generated (at line 38, column 132) for  i
      % expected type  below[n]
  sigma_eq_index_TCC1: OBLIGATION
    FORALL (m, n: posnat): m = n IMPLIES (FORALL (i: below[m]): i < n);


decl_type: tcc
theory: sigma_lemmas
library: linear_algebra
signature: nil
location: 225 0 230 999
body:
  % Subtype TCC generated (at line 38, column 193) for  0
      % expected type  T_low[Index[n]]
  sigma_eq_index_TCC2: OBLIGATION
    FORALL (m, n: posnat, F: [below[m] -> real], G: [below[n] -> real]):
      (m = n AND (FORALL (i: below[m]): F(i) = G(i))) IMPLIES
       0 >= 0 AND 0 < n OR (EXISTS (j: Index[n]): j <= 0);


decl_type: tcc
theory: sigma_lemmas
library: linear_algebra
signature: nil
location: 232 0 237 999
body:
  % Subtype TCC generated (at line 38, column 195) for  n - 1
      % expected type  T_high[Index[n]]
  sigma_eq_index_TCC3: OBLIGATION
    FORALL (m, n: posnat, F: [below[m] -> real], G: [below[n] -> real]):
      (m = n AND (FORALL (i: below[m]): F(i) = G(i))) IMPLIES
       n - 1 >= 0 AND n - 1 < n OR (EXISTS (j: Index[n]): n - 1 <= j);


decl_type: tcc
theory: sigma_lemmas
library: linear_algebra
signature: nil
location: 239 0 243 999
body:
  % Subtype TCC generated (at line 41, column 136) for  i
      % expected type  below[m + n]
  aux_sigma_TCC1: OBLIGATION
    FORALL (m: posnat, n: nat):
      n = 0 IMPLIES (FORALL (i: below[m]): i < m + n);


decl_type: tcc
theory: sigma_lemmas
library: linear_algebra
signature: nil
location: 245 0 251 999
body:
  % Subtype TCC generated (at line 41, column 197) for  0
      % expected type  T_low[below[m + n]]
  aux_sigma_TCC2: OBLIGATION
    FORALL (m: posnat, n: nat, F: [below[m] -> real],
            G: [below[m + n] -> real]):
      (n = 0 AND (FORALL (i: below[m]): F(i) = G(i))) IMPLIES
       0 >= 0 AND 0 < m + n OR (EXISTS (j: below[m + n]): j <= 0);


decl_type: tcc
theory: sigma_lemmas
library: linear_algebra
signature: nil
location: 253 0 260 999
body:
  % Subtype TCC generated (at line 41, column 199) for  m + n - 1
      % expected type  T_high[below[m + n]]
  aux_sigma_TCC3: OBLIGATION
    FORALL (m: posnat, n: nat, F: [below[m] -> real],
            G: [below[m + n] -> real]):
      (n = 0 AND (FORALL (i: below[m]): F(i) = G(i))) IMPLIES
       m + n - 1 >= 0 AND m + n - 1 < m + n OR
        (EXISTS (j: below[m + n]): m + n - 1 <= j);


decl_type: tcc
theory: sigma_lemmas
library: linear_algebra
signature: nil
location: 262 0 268 999
body:
  % Subtype TCC generated (at line 44, column 170) for  j - 1
      % expected type  T_high[below[m]]
  aux_sigma2_TCC1: OBLIGATION
    FORALL (m, j: posnat, n: nat, F: [below[m] -> real],
            G: [below[m + n] -> real]):
      (n = 0 AND j <= m AND (FORALL (i: below[m]): F(i) = G(i))) IMPLIES
       j - 1 >= 0 AND j - 1 < m OR (EXISTS (j_1: below[m]): j - 1 <= j_1);


decl_type: tcc
theory: sigma_lemmas
library: linear_algebra
signature: nil
location: 270 0 277 999
body:
  % Subtype TCC generated (at line 44, column 213) for  j + n - 1
      % expected type  T_high[below[m + n]]
  aux_sigma2_TCC2: OBLIGATION
    FORALL (m, j: posnat, n: nat, F: [below[m] -> real],
            G: [below[m + n] -> real]):
      (n = 0 AND j <= m AND (FORALL (i: below[m]): F(i) = G(i))) IMPLIES
       j + n - 1 >= 0 AND j + n - 1 < m + n OR
        (EXISTS (j_1: below[m + n]): j + n - 1 <= j_1);


decl_type: tcc
theory: sigma_lemmas
library: linear_algebra
signature: nil
location: 279 0 282 999
body:
  % Subtype TCC generated (at line 47, column 141) for  i
      % expected type  below[m + n]
  sigma_restrict_gen_TCC1: OBLIGATION
    FORALL (m, n: posnat, i: below[m]): i < m + n;


decl_type: tcc
theory: sigma_lemmas
library: linear_algebra
signature: nil
location: 284 0 290 999
body:
  % Subtype TCC generated (at line 47, column 187) for  j - 1
      % expected type  T_high[below[m]]
  sigma_restrict_gen_TCC2: OBLIGATION
    FORALL (j: posnat, m, n: posnat, F: [below[m] -> real],
            G: [below[m + n] -> real]):
      (j <= m AND (FORALL (i: below[m]): F(i) = G(i))) IMPLIES
       j - 1 >= 0 AND j - 1 < m OR (EXISTS (j_1: below[m]): j - 1 <= j_1);


decl_type: tcc
theory: sigma_lemmas
library: linear_algebra
signature: nil
location: 292 0 298 999
body:
  % Subtype TCC generated (at line 47, column 218) for  0
      % expected type  T_low[below[m + n]]
  sigma_restrict_gen_TCC3: OBLIGATION
    FORALL (j: posnat, m, n: posnat, F: [below[m] -> real],
            G: [below[m + n] -> real]):
      (j <= m AND (FORALL (i: below[m]): F(i) = G(i))) IMPLIES
       0 >= 0 AND 0 < m + n OR (EXISTS (j: below[m + n]): j <= 0);


decl_type: tcc
theory: sigma_lemmas
library: linear_algebra
signature: nil
location: 300 0 307 999
body:
  % Subtype TCC generated (at line 47, column 220) for  j - 1
      % expected type  T_high[below[m + n]]
  sigma_restrict_gen_TCC4: OBLIGATION
    FORALL (j: posnat, m, n: posnat, F: [below[m] -> real],
            G: [below[m + n] -> real]):
      (j <= m AND (FORALL (i: below[m]): F(i) = G(i))) IMPLIES
       j - 1 >= 0 AND j - 1 < m + n OR
        (EXISTS (j_1: below[m + n]): j - 1 <= j_1);


decl_type: tcc
theory: sigma_lemmas
library: linear_algebra
signature: nil
location: 309 0 314 999
body:
  % Subtype TCC generated (at line 51, column 166) for  j - 1
      % expected type  T_high[Index[m]]
  sigma_eq_index2_TCC1: OBLIGATION
    FORALL (m, n, j: posnat, F: [below[m] -> real], G: [below[n] -> real]):
      (m = n AND j <= m AND (FORALL (i: below[m]): F(i) = G(i))) IMPLIES
       j - 1 >= 0 AND j - 1 < m OR (EXISTS (j_1: Index[m]): j - 1 <= j_1);


decl_type: tcc
theory: sigma_lemmas
library: linear_algebra
signature: nil
location: 316 0 321 999
body:
  % Subtype TCC generated (at line 51, column 209) for  j - 1
      % expected type  T_high[Index[n]]
  sigma_eq_index2_TCC2: OBLIGATION
    FORALL (m, n, j: posnat, F: [below[m] -> real], G: [below[n] -> real]):
      (m = n AND j <= m AND (FORALL (i: below[m]): F(i) = G(i))) IMPLIES
       j - 1 >= 0 AND j - 1 < n OR (EXISTS (j_1: Index[n]): j - 1 <= j_1);


decl_type: tcc
theory: sigma_lemmas
library: linear_algebra
signature: nil
location: 323 0 329 999
body:
  % Subtype TCC generated (at line 54, column 203) for  k
      % expected type  T_low[below[m]]
  sigma_restrict_gen2_TCC1: OBLIGATION
    FORALL (j: posnat, k: nat, m, n: posnat, F: [below[m] -> real],
            G: [below[m + n] -> real]):
      (j <= m AND k < j AND (FORALL (i: below[m]): F(i) = G(i))) IMPLIES
       k >= 0 AND k < m OR (EXISTS (j: below[m]): j <= k);


decl_type: tcc
theory: sigma_lemmas
library: linear_algebra
signature: nil
location: 331 0 337 999
body:
  % Subtype TCC generated (at line 54, column 236) for  k
      % expected type  T_low[below[m + n]]
  sigma_restrict_gen2_TCC2: OBLIGATION
    FORALL (j: posnat, k: nat, m, n: posnat, F: [below[m] -> real],
            G: [below[m + n] -> real]):
      (j <= m AND k < j AND (FORALL (i: below[m]): F(i) = G(i))) IMPLIES
       k >= 0 AND k < m + n OR (EXISTS (j: below[m + n]): j <= k);


decl_type: tcc
theory: sigma_lemmas
library: linear_algebra
signature: nil
location: 339 0 345 999
body:
  % Subtype TCC generated (at line 58, column 176) for  k
      % expected type  T_low[Index[m]]
  sigma_eq_index3_TCC1: OBLIGATION
    FORALL (m, n, j, k: posnat, F: [below[m] -> real],
            G: [below[n] -> real]):
      (m = n AND j <= m AND k < j AND (FORALL (i: below[m]): F(i) = G(i)))
       IMPLIES k >= 0 AND k < m OR (EXISTS (j_1: Index[m]): j_1 <= k);


decl_type: tcc
theory: sigma_lemmas
library: linear_algebra
signature: nil
location: 347 0 353 999
body:
  % Subtype TCC generated (at line 58, column 219) for  k
      % expected type  T_low[Index[n]]
  sigma_eq_index3_TCC2: OBLIGATION
    FORALL (m, n, j, k: posnat, F: [below[m] -> real],
            G: [below[n] -> real]):
      (m = n AND j <= m AND k < j AND (FORALL (i: below[m]): F(i) = G(i)))
       IMPLIES k >= 0 AND k < n OR (EXISTS (j_1: Index[n]): j_1 <= k);


decl_type: tcc
theory: sigma_lemmas
library: linear_algebra
signature: nil
location: 355 0 360 999
body:
  % Subtype TCC generated (at line 61, column 117) for  j - 1
      % expected type  T_high[below[m]]
  sigma_shift_gen_TCC1: OBLIGATION
    FORALL (j: posnat, m, n: posnat):
      j <= m IMPLIES
       j - 1 >= 0 AND j - 1 < m OR (EXISTS (j_1: below[m]): j - 1 <= j_1);


decl_type: tcc
theory: sigma_lemmas
library: linear_algebra
signature: nil
location: 362 0 366 999
body:
  % Subtype TCC generated (at line 61, column 147) for  i + n
      % expected type  below[m + n]
  sigma_shift_gen_TCC2: OBLIGATION
    FORALL (j: posnat, m, n: posnat):
      j <= m IMPLIES (FORALL (i: below[m]): i + n < m + n);


decl_type: tcc
theory: sigma_lemmas
library: linear_algebra
signature: nil
location: 368 0 373 999
body:
  % Subtype TCC generated (at line 61, column 177) for  n
      % expected type  T_low[below[m + n]]
  sigma_shift_gen_TCC3: OBLIGATION
    FORALL (j: posnat, m, n: posnat):
      j <= m IMPLIES
       n >= 0 AND n < m + n OR (EXISTS (j: below[m + n]): j <= n);


decl_type: tcc
theory: sigma_lemmas
library: linear_algebra
signature: nil
location: 375 0 381 999
body:
  % Subtype TCC generated (at line 61, column 179) for  j - 1 + n
      % expected type  T_high[below[m + n]]
  sigma_shift_gen_TCC4: OBLIGATION
    FORALL (j: posnat, m, n: posnat):
      j <= m IMPLIES
       j - 1 + n >= 0 AND j - 1 + n < m + n OR
        (EXISTS (j_1: below[m + n]): j - 1 + n <= j_1);


decl_type: formula
theory: matrices
library: linear_algebra
signature: nil
location: 226 1 228 76
body:
   sigma_lem: LEMMA % This lemma is just to make other proofs easier
     FORALL (n: posnat, j: below(n), r: real):
      sigma[below(n)](0, n - 1, (lambda (k: below(n)): 0) WITH [(j) := r]) = r


decl_type: formula
theory: matrices
library: linear_algebra
signature: nil
location: 232 1 234 24
body:
   right_mult_ident: LEMMA
     FORALL (M, (I: Matrix | identity?(I) AND M`cols = I`rows)):
                 M * I = M


decl_type: formula
theory: matrices
library: linear_algebra
signature: nil
location: 236 1 238 24
body:
   left_mult_ident: LEMMA
     FORALL (M, (I: Matrix | identity?(I) AND M`rows = I`cols)):
                 I * M = M


decl_type: formula
theory: matrices
library: linear_algebra
signature: nil
location: 245 1 250 83
body:
   sigma_prop: LEMMA
     FORALL (m, n: posint, f: [below(m) -> real], g: [below(m), below(n) -> real]):
      sigma[below(m)](0, m-1, lambda (i: below(m)):
                      f(i) * sigma[below(n)](0, n-1, lambda (j: below(n)): g(i,j)))
       = sigma[below(m)](0, m-1, lambda (i: below(m)):
                         sigma[below(n)](0, n-1, lambda(j: below(n)): f(i) * g(i,j)))


decl_type: formula
theory: matrices
library: linear_algebra
signature: nil
location: 252 1 257 76
body:
   sigma_comm: LEMMA
     FORALL (m, n: posnat, f: [below(m), below(n) -> real]):
       sigma[below(m)](0, m-1, lambda (i: below(m)):
                       sigma[below(n)](0, n-1, lambda (j: below(n)): f(i, j)))
        = sigma[below(n)](0, n-1, lambda (j: below(n)):
                       sigma[below(m)](0, m-1, lambda (i: below(m)): f(i, j)))


decl_type: formula
theory: matrices
library: linear_algebra
signature: nil
location: 262 1 264 29
body:
   mult_assoc: LEMMA
     FORALL (M, (N | M`cols = N`rows), (P | N`cols = P`rows)):
      M * (N * P) = (M * N) * P


decl_type: formula
theory: matrices
library: linear_algebra
signature: nil
location: 266 1 266 102
body:
   mult_assoc_vect: LEMMA FORALL (M, (N | M`cols = N`rows), V:Vector[N`cols]): (M * N) * V = M * (N * V)


decl_type: formula
theory: matrices
library: linear_algebra
signature: nil
location: 271 1 273 35
body:
   left_distributive: LEMMA
     FORALL (M, (N | M`cols = N`rows), (P: (same_dim?(N)))):
      M * (N + P) = (M * N) + (M * P)


decl_type: formula
theory: matrices
library: linear_algebra
signature: nil
location: 275 1 277 35
body:
   right_distributive: LEMMA
     FORALL (M, (N: (same_dim?(M))), (P | M`cols = P`rows)):
      (M + N) * P = (M * P) + (N * P)


decl_type: formula
theory: matrices
library: linear_algebra
signature: nil
location: 279 1 279 101
body:
   left_distributive_vect:  LEMMA FORALL (M, (v1, v2:Vector[M`cols])):  M * v1 - M * v2 = M * (v1 - v2)


decl_type: formula
theory: matrices
library: linear_algebra
signature: nil
location: 284 1 286 50
body:
   transpose_product: LEMMA
     FORALL (M, (N | M`cols = N`rows)):
      transpose(M * N) = transpose(N) * transpose(M)


decl_type: formula
theory: matrices
library: linear_algebra
signature: nil
location: 288 1 288 114
body:
   trans_mat_scal: LEMMA FORALL (A:Matrix, x:Vector[A`rows], y:Vector[A`cols]): x * (A * y) = (transpose(A) * x) * y   


decl_type: formula
theory: matrices
library: linear_algebra
signature: nil
location: 310 1 312 23
body:
   invertible_product: lemma
     FORALL (M: (invertible?), N: (invertible?) | N`rows = M`rows):
       invertible?(M * N)


decl_type: formula
theory: matrices
library: linear_algebra
signature: nil
location: 316 1 318 45
body:
   product_inverse: lemma
     FORALL (M: (invertible?), N: (invertible?) | N`rows = M`rows):
       inverse(M * N) = inverse(N) * inverse(M)


decl_type: formula
theory: matrices
library: linear_algebra
signature: nil
location: 347 1 351 38
body:
   square_matrix_induct: LEMMA
     forall (p: pred[Square]):
      (forall (M: Square):
        (forall (N: Square): N`rows < M`rows implies p(N)) implies p(M))
      implies (forall (M: Square): p(M))


decl_type: type
theory: matrices
library: linear_algebra
signature: nil
location: 20 1 21 64
body:
   Matrix: TYPE = [# rows: posnat, cols: posnat,
                     matrix: [below(rows), below(cols) -> real] #]


decl_type: function
theory: matrices
library: linear_algebra
signature: [M: Matrix -> [below(M`rows) -> Matrix]]
location: 42 1 44 73
body:
   rowM(M)(i: below(M`rows)): Matrix =
     (# rows := 1, cols := M`cols,
        matrix := lambda (k: below(1), j: below(M`cols)): M`matrix(i, j) #)


decl_type: function
theory: matrices
library: linear_algebra
signature: [M: Matrix -> [below(M`cols) -> Matrix]]
location: 46 1 48 73
body:
   colM(M)(j: below(M`cols)): Matrix =
     (# rows := M`rows, cols := 1,
        matrix := lambda (i: below(M`rows), k: below(1)): M`matrix(i, j) #)


decl_type: function
theory: matrices
library: linear_algebra
signature: [M: Matrix -> Vector_of_Vectors[M`rows, M`cols]]
location: 64 1 66 46
body:
   cols(M): Vector_of_Vectors[M`rows, M`cols] =
     lambda (i: below(M`cols)):
       lambda (j: below(M`rows)): M`matrix(j, i)


decl_type: function
theory: matrices
library: linear_algebra
signature: [M: Matrix -> Vector_of_Vectors[M`cols, M`rows]]
location: 68 1 70 46
body:
   rows(M): Vector_of_Vectors[M`cols, M`rows] =
     lambda (i: below(M`rows)):
       lambda (j: below(M`cols)): M`matrix(i, j)


decl_type: function
theory: matrices
library: linear_algebra
signature:
  [d: [posnat, posnat] ->
  [Vector_of_Vectors[d`1, d`2] -> Matrix]]

location: 72 1 74 64
body:
   vectors2matrix(pn, pm)(V2: Vector_of_Vectors[pn, pm]): Matrix = 
     (# cols := pm, rows := pn,
        matrix := lambda (i: below(pn), j: below(pm)): V2(j)(i) #)


decl_type: function
theory: matrices
library: linear_algebra
signature: [Matrix -> Matrix]
location: 82 1 84 78
body:
   transpose(M): Matrix =
     (# rows := M`cols, cols := M`rows,
        matrix := lambda (i: below(M`cols), j: below(M`rows)): M`matrix(j, i) #)


decl_type: function
theory: matrices
library: linear_algebra
signature: [Matrix -> bool]
location: 118 1 121 33
body:
   identity?(M: Matrix): bool =
     square?(M) and
     FORALL (i, j: below(M`rows)):
       M`matrix(i, j) = delta(i, j)


decl_type: function
theory: matrices
library: linear_algebra
signature: [posnat -> (identity?)]
location: 123 1 125 58
body:
   I(n: posnat): (identity?)
      = (# rows := n, cols := n,
           matrix := lambda (i, j: below(n)): delta(i, j) #)


decl_type: function
theory: matrices
library: linear_algebra
signature: [Matrix -> bool]
location: 134 1 135 63
body:
   upper_triangular?(M): bool = square?(M)
     AND FORALL (i, j: below(M`rows)): i > j => M`matrix(i,j) = 0


decl_type: function
theory: matrices
library: linear_algebra
signature: [Matrix -> bool]
location: 137 1 138 63
body:
   lower_triangular?(M): bool = square?(M)
     AND FORALL (i, j: below(M`rows)): i < j => M`matrix(i,j) = 0


decl_type: function
theory: matrices
library: linear_algebra
signature: [Matrix -> Matrix]
location: 147 1 148 84
body:
   -(M): Matrix =
      M WITH [`matrix := LAMBDA (i: below(M`rows), j: below(M`cols)): -M`matrix(i, j)]


decl_type: function
theory: matrices
library: linear_algebra
signature:
  [[M: Matrix, (LAMBDA (N): M`rows = N`rows AND M`cols = N`cols)] ->
  Matrix]

location: 165 1 167 57
body:
   +(M, (N: (same_dim?(M)))): Matrix =
     M WITH [ `matrix := LAMBDA (i: below(M`rows), j: below(M`cols)):
                         M`matrix(i, j) + N`matrix(i, j) ];


decl_type: function
theory: matrices
library: linear_algebra
signature:
  [[M: Matrix, (LAMBDA (N): M`rows = N`rows AND M`cols = N`cols)] ->
  Matrix]

location: 169 1 171 57
body:
   -(M, (N: (same_dim?(M)))): Matrix =
     M WITH [ `matrix := LAMBDA (i: below(M`rows), j: below(M`cols)):
                         M`matrix(i, j) - N`matrix(i, j) ];


decl_type: function
theory: matrices
library: linear_algebra
signature: [[real, Matrix] -> Matrix]
location: 193 1 195 44
body:
   *(r, M): Matrix =
      M WITH [`matrix := LAMBDA (i: below(M`rows), j: below(M`cols)):
                          r * M`matrix(i, j)];


decl_type: function
theory: matrices
library: linear_algebra
signature: [[M: Matrix, {N: Matrix | M`cols = N`rows}] -> Matrix]
location: 205 1 209 73
body:
   *(M, (N: Matrix | M`cols = N`rows)): Matrix =
     (# rows := M`rows, cols := N`cols,
        matrix := lambda (i: below(M`rows), j: below(N`cols)):
                    sigma[below(M`cols)](0, M`cols-1, lambda (k: below(M`cols)):
                                       M`matrix(i, k) * N`matrix(k, j)) #);


decl_type: function
theory: matrices
library: linear_algebra
signature: [d: [M: Matrix, Vector[M`cols]] -> Vector[d`1`rows]]
location: 211 1 213 60
body:
   *(M, (v:Vector[M`cols])): Vector[M`rows] = lambda (i: below(M`rows)):
                    sigma[below(M`cols)](0, M`cols-1, lambda (k: below(M`cols)):
                                       M`matrix(i, k) * v(k)); 


decl_type: function
theory: matrices
library: linear_algebra
signature: [M: Square -> [{N: Square | N`rows = M`rows} -> bool]]
location: 296 1 297 42
body:
   inverse?(M: Square)(N: Square | N`rows = M`rows): bool =
     M * N = I(M`rows) and N * M = I(M`rows)


decl_type: function
theory: matrices
library: linear_algebra
signature: [M: (invertible?) -> {N: Square | N`rows = M`rows}]
location: 304 1 305 55
body:
   inverse(M: (invertible?)): {N: Square | N`rows = M`rows}
     = the! (N: Square | N`rows = M`rows): inverse?(M)(N)


decl_type: function
theory: matrices
library: linear_algebra
signature: [Square -> real]
location: 324 1 324 102
body:
   trace(M: Square): real = sigma[below(M`rows)](0, M`rows-1, lambda (k: below(M`rows)): M`matrix(k, k))


decl_type: tcc
theory: matrices
library: linear_algebra
signature: nil
location: 367 0 370 999
body:
  % Subtype TCC generated (at line 55, column 39) for  0
      % expected type  below(M`rows)
  Mr2V_TCC1: OBLIGATION
    FORALL (M: Matrix | M`rows = 1, j: below(M`cols)): 0 < M`rows;


decl_type: tcc
theory: matrices
library: linear_algebra
signature: nil
location: 372 0 375 999
body:
  % Subtype TCC generated (at line 58, column 42) for  0
      % expected type  below(M`cols)
  Mc2V_TCC1: OBLIGATION
    FORALL (M: Matrix | M`cols = 1, j: below(M`rows)): 0 < M`cols;


decl_type: tcc
theory: matrices
library: linear_algebra
signature: nil
location: 377 0 381 999
body:
  % Subtype TCC generated (at line 121, column 17) for  j
      % expected type  below(M`cols)
  identity?_TCC1: OBLIGATION
    FORALL (M: Matrix):
      square?(M) IMPLIES (FORALL (i, j: below(M`rows)): j < M`cols);


decl_type: tcc
theory: matrices
library: linear_algebra
signature: nil
location: 383 0 394 999
body:
  % Subtype TCC generated (at line 124, column 6) for
      % (# rows := n,
      %    cols := n,
      %    matrix := LAMBDA (i, j: below(n)): IF i = j THEN 1 ELSE 0 ENDIF #)
      % expected type  (identity?)
  I_TCC1: OBLIGATION
    FORALL (n: posnat):
      identity?((# rows := n,
                   cols := n,
                   matrix
                     := LAMBDA (i, j: below(n)):
                          IF i = j THEN 1 ELSE 0 ENDIF #));


decl_type: tcc
theory: matrices
library: linear_algebra
signature: nil
location: 396 0 402 999
body:
  % Subtype TCC generated (at line 167, column 49) for  i
      % expected type  below(N`rows)
  plus_TCC1: OBLIGATION
    FORALL (M: Matrix,
            (N: (LAMBDA (N): M`rows = N`rows AND M`cols = N`cols)),
            i: below(M`rows), j: below(M`cols)):
      i < N`rows;


decl_type: tcc
theory: matrices
library: linear_algebra
signature: nil
location: 404 0 410 999
body:
  % Subtype TCC generated (at line 167, column 52) for  j
      % expected type  below(N`cols)
  plus_TCC2: OBLIGATION
    FORALL (M: Matrix,
            (N: (LAMBDA (N): M`rows = N`rows AND M`cols = N`cols)),
            i: below(M`rows), j: below(M`cols)):
      j < N`cols;


decl_type: tcc
theory: matrices
library: linear_algebra
signature: nil
location: 412 0 421 999
body:
  % Subtype TCC generated (at line 176, column 48) for  P
      % expected type  (LAMBDA (N_1: Matrix):
                     %    N`rows = N_1`rows AND N`cols = N_1`cols)
  plus_assoc_TCC1: OBLIGATION
    FORALL (M: Matrix,
            (N: (LAMBDA (N): M`rows = N`rows AND M`cols = N`cols)),
            (P:
               (LAMBDA (N_1: Matrix):
                  M`rows = N_1`rows AND M`cols = N_1`cols))):
      N`rows = P`rows AND N`cols = P`cols;


decl_type: tcc
theory: matrices
library: linear_algebra
signature: nil
location: 423 0 431 999
body:
  % Subtype TCC generated (at line 176, column 44) for  (N + P)
      % expected type  (LAMBDA (N): M`rows = N`rows AND M`cols = N`cols)
  plus_assoc_TCC2: OBLIGATION
    FORALL (M: Matrix,
            (N: (LAMBDA (N): M`rows = N`rows AND M`cols = N`cols)),
            (P:
               (LAMBDA (N_1: Matrix):
                  M`rows = N_1`rows AND M`cols = N_1`cols))):
      M`rows = (N + P)`rows AND M`cols = (N + P)`cols;


decl_type: tcc
theory: matrices
library: linear_algebra
signature: nil
location: 433 0 442 999
body:
  % Subtype TCC generated (at line 176, column 63) for  P
      % expected type  (LAMBDA (N_1: Matrix):
                     %    (M + N)`rows = N_1`rows AND (M + N)`cols = N_1`cols)
  plus_assoc_TCC3: OBLIGATION
    FORALL (M: Matrix,
            (N: (LAMBDA (N): M`rows = N`rows AND M`cols = N`cols)),
            (P:
               (LAMBDA (N_1: Matrix):
                  M`rows = N_1`rows AND M`cols = N_1`cols))):
      (M + N)`rows = P`rows AND (M + N)`cols = P`cols;


decl_type: tcc
theory: matrices
library: linear_algebra
signature: nil
location: 444 0 450 999
body:
  % Subtype TCC generated (at line 179, column 48) for  M
      % expected type  (LAMBDA (N_1: Matrix):
                     %    N`rows = N_1`rows AND N`cols = N_1`cols)
  plus_comm_TCC1: OBLIGATION
    FORALL (M: Matrix,
            (N: (LAMBDA (N): M`rows = N`rows AND M`cols = N`cols))):
      N`rows = M`rows AND N`cols = M`cols;


decl_type: tcc
theory: matrices
library: linear_algebra
signature: nil
location: 452 0 456 999
body:
  % Subtype TCC generated (at line 187, column 44) for  Z
      % expected type  (LAMBDA (N): M`rows = N`rows AND M`cols = N`cols)
  zero_right_ident_TCC1: OBLIGATION
    FORALL (Z: Zero, M: (LAMBDA (N): Z`rows = N`rows AND Z`cols = N`cols)):
      M`rows = Z`rows AND M`cols = Z`cols;


decl_type: tcc
theory: matrices
library: linear_algebra
signature: nil
location: 458 0 463 999
body:
  % Subtype TCC generated (at line 208, column 39) for  0
      % expected type  T_low[below(M`cols)]
  times_TCC1: OBLIGATION
    FORALL (M: Matrix, (N: Matrix | M`cols = N`rows), i: below(M`rows),
            j: below(N`cols)):
      0 >= 0 AND 0 < M`cols OR (EXISTS (j: below(M`cols)): j <= 0);


decl_type: tcc
theory: matrices
library: linear_algebra
signature: nil
location: 465 0 471 999
body:
  % Subtype TCC generated (at line 208, column 42) for  M`cols - 1
      % expected type  T_high[below(M`cols)]
  times_TCC2: OBLIGATION
    FORALL (M: Matrix, (N: Matrix | M`cols = N`rows), i: below(M`rows),
            j: below(N`cols)):
      M`cols - 1 >= 0 AND M`cols - 1 < M`cols OR
       (EXISTS (j: below(M`cols)): M`cols - 1 <= j);


decl_type: tcc
theory: matrices
library: linear_algebra
signature: nil
location: 473 0 478 999
body:
  % Subtype TCC generated (at line 209, column 63) for  k
      % expected type  below(N`rows)
  times_TCC3: OBLIGATION
    FORALL (M: Matrix, (N: Matrix | M`cols = N`rows), i: below(M`rows),
            j: below(N`cols), k: below(M`cols)):
      k < N`rows;


decl_type: tcc
theory: matrices
library: linear_algebra
signature: nil
location: 480 0 487 999
body:
  % Assuming TCC generated (at line 41, column 5) for
      % reals@sigma[below(M`cols)]
      % generated from assumption sigma.connected_domain
  times_TCC4: OBLIGATION
    FORALL (M: Matrix, (N: Matrix | M`cols = N`rows), i: below(M`rows),
            j: below(N`cols)):
      FORALL (x, y: below(M`cols)), (z: integer):
        x <= z AND z <= y IMPLIES z >= 0 AND z < M`cols;


decl_type: tcc
theory: matrices
library: linear_algebra
signature: nil
location: 489 0 493 999
body:
  % Subtype TCC generated (at line 212, column 39) for  0
      % expected type  T_low[below(M`cols)]
  times_TCC5: OBLIGATION
    FORALL (M: Matrix, i: below(M`rows)):
      0 >= 0 AND 0 < M`cols OR (EXISTS (j: below(M`cols)): j <= 0);


decl_type: tcc
theory: matrices
library: linear_algebra
signature: nil
location: 495 0 500 999
body:
  % Subtype TCC generated (at line 212, column 42) for  M`cols - 1
      % expected type  T_high[below(M`cols)]
  times_TCC6: OBLIGATION
    FORALL (M: Matrix, i: below(M`rows)):
      M`cols - 1 >= 0 AND M`cols - 1 < M`cols OR
       (EXISTS (j: below(M`cols)): M`cols - 1 <= j);


decl_type: tcc
theory: matrices
library: linear_algebra
signature: nil
location: 502 0 505 999
body:
  % Subtype TCC generated (at line 219, column 54) for  M
      % expected type  {N: Matrix | Z`cols = N`rows}
  zero_times_left_TCC1: OBLIGATION
    FORALL (M: Matrix, (Z: Zero | Z`cols = M`rows)): Z`cols = M`rows;


decl_type: tcc
theory: matrices
library: linear_algebra
signature: nil
location: 507 0 510 999
body:
  % Subtype TCC generated (at line 222, column 54) for  Z
      % expected type  {N: Matrix | M`cols = N`rows}
  zero_times_right_TCC1: OBLIGATION
    FORALL (Z: Zero, (M: Matrix | M`cols = Z`rows)): M`cols = Z`rows;


decl_type: tcc
theory: matrices
library: linear_algebra
signature: nil
location: 512 0 516 999
body:
  % Subtype TCC generated (at line 228, column 20) for  0
      % expected type  T_low[below(n)]
  sigma_lem_TCC1: OBLIGATION
    FORALL (n: posnat, j: below(n)):
      0 >= 0 AND 0 < n OR (EXISTS (j: below(n)): j <= 0);


decl_type: tcc
theory: matrices
library: linear_algebra
signature: nil
location: 518 0 522 999
body:
  % Subtype TCC generated (at line 228, column 23) for  n - 1
      % expected type  T_high[below(n)]
  sigma_lem_TCC2: OBLIGATION
    FORALL (n: posnat, j: below(n)):
      n - 1 >= 0 AND n - 1 < n OR (EXISTS (j: below(n)): n - 1 <= j);


decl_type: tcc
theory: matrices
library: linear_algebra
signature: nil
location: 524 0 529 999
body:
  % Assuming TCC generated (at line 41, column 5) for  reals@sigma[below(n)]
      % generated from assumption sigma.connected_domain
  sigma_lem_TCC3: OBLIGATION
    FORALL (n: posnat, j: below(n)):
      (FORALL (x, y: below(n)), (z: integer):
         x <= z AND z <= y IMPLIES z >= 0 AND z < n);


decl_type: tcc
theory: matrices
library: linear_algebra
signature: nil
location: 531 0 535 999
body:
  % Subtype TCC generated (at line 238, column 19) for  M
      % expected type  {N: Matrix | I`cols = N`rows}
  left_mult_ident_TCC1: OBLIGATION
    FORALL (M: Matrix, (I: Matrix | identity?(I) AND M`rows = I`cols)):
      I`cols = M`rows;


decl_type: tcc
theory: matrices
library: linear_algebra
signature: nil
location: 537 0 541 999
body:
  % Subtype TCC generated (at line 240, column 81) for  x
      % expected type  Vector[I`rows]
  ident_vect_TCC1: OBLIGATION
    FORALL (I: Matrix | identity?(I)):
      FORALL (x2: nat): x2 < I`cols IFF x2 < I`rows;


decl_type: tcc
theory: matrices
library: linear_algebra
signature: nil
location: 543 0 546 999
body:
  % Subtype TCC generated (at line 247, column 20) for  0
      % expected type  T_low[below(m)]
  sigma_prop_TCC1: OBLIGATION
    FORALL (m, n: posint): 0 >= 0 AND 0 < m OR (EXISTS (j: below(m)): j <= 0);


decl_type: tcc
theory: matrices
library: linear_algebra
signature: nil
location: 548 0 552 999
body:
  % Subtype TCC generated (at line 247, column 23) for  m - 1
      % expected type  T_high[below(m)]
  sigma_prop_TCC2: OBLIGATION
    FORALL (m, n: posint):
      m - 1 >= 0 AND m - 1 < m OR (EXISTS (j: below(m)): m - 1 <= j);


decl_type: tcc
theory: matrices
library: linear_algebra
signature: nil
location: 554 0 558 999
body:
  % Subtype TCC generated (at line 248, column 43) for  0
      % expected type  T_low[below(n)]
  sigma_prop_TCC3: OBLIGATION
    FORALL (m, n: posint, i: below(m)):
      0 >= 0 AND 0 < n OR (EXISTS (j: below(n)): j <= 0);


decl_type: tcc
theory: matrices
library: linear_algebra
signature: nil
location: 560 0 564 999
body:
  % Subtype TCC generated (at line 248, column 46) for  n - 1
      % expected type  T_high[below(n)]
  sigma_prop_TCC4: OBLIGATION
    FORALL (m, n: posint, i: below(m)):
      n - 1 >= 0 AND n - 1 < n OR (EXISTS (j: below(n)): n - 1 <= j);


decl_type: tcc
theory: matrices
library: linear_algebra
signature: nil
location: 566 0 569 999
body:
  % Subtype TCC generated (at line 256, column 24) for  0
      % expected type  T_low[below(n)]
  sigma_comm_TCC1: OBLIGATION
    FORALL (m, n: posnat): 0 >= 0 AND 0 < n OR (EXISTS (j: below(n)): j <= 0);


decl_type: tcc
theory: matrices
library: linear_algebra
signature: nil
location: 571 0 575 999
body:
  % Subtype TCC generated (at line 256, column 27) for  n - 1
      % expected type  T_high[below(n)]
  sigma_comm_TCC2: OBLIGATION
    FORALL (m, n: posnat):
      n - 1 >= 0 AND n - 1 < n OR (EXISTS (j: below(n)): n - 1 <= j);


decl_type: tcc
theory: matrices
library: linear_algebra
signature: nil
location: 577 0 582 999
body:
  % Subtype TCC generated (at line 264, column 9) for  (N * P)
      % expected type  {N: Matrix | M`cols = N`rows}
  mult_assoc_TCC1: OBLIGATION
    FORALL (M: Matrix, (N: Matrix | M`cols = N`rows),
            (P: Matrix | N`cols = P`rows)):
      M`cols = (N * P)`rows;


decl_type: tcc
theory: matrices
library: linear_algebra
signature: nil
location: 584 0 589 999
body:
  % Subtype TCC generated (at line 264, column 28) for  P
      % expected type  {N_1: Matrix | (M * N)`cols = N_1`rows}
  mult_assoc_TCC2: OBLIGATION
    FORALL (M: Matrix, (N: Matrix | M`cols = N`rows),
            (P: Matrix | N`cols = P`rows)):
      (M * N)`cols = P`rows;


decl_type: tcc
theory: matrices
library: linear_algebra
signature: nil
location: 591 0 595 999
body:
  % Subtype TCC generated (at line 266, column 87) for  V
      % expected type  Vector[(M * N)`cols]
  mult_assoc_vect_TCC1: OBLIGATION
    FORALL (M: Matrix, (N: Matrix | M`cols = N`rows)):
      FORALL (x: nat): x < N`cols IFF x < (M * N)`cols;


decl_type: tcc
theory: matrices
library: linear_algebra
signature: nil
location: 597 0 601 999
body:
  % Subtype TCC generated (at line 266, column 96) for  (N * V)
      % expected type  Vector[M`cols]
  mult_assoc_vect_TCC2: OBLIGATION
    FORALL (M: Matrix, (N: Matrix | M`cols = N`rows)):
      FORALL (x: nat): x < N`rows IFF x < M`cols;


decl_type: tcc
theory: matrices
library: linear_algebra
signature: nil
location: 603 0 607 999
body:
  % Subtype TCC generated (at line 266, column 91) for  M * (N * V)
      % expected type  Vector[(M * N)`rows]
  mult_assoc_vect_TCC3: OBLIGATION
    FORALL (M: Matrix, (N: Matrix | M`cols = N`rows)):
      FORALL (x: nat): x < M`rows IFF x < (M * N)`rows;


decl_type: tcc
theory: matrices
library: linear_algebra
signature: nil
location: 609 0 616 999
body:
  % Subtype TCC generated (at line 273, column 9) for  (N + P)
      % expected type  {N: Matrix | M`cols = N`rows}
  left_distributive_TCC1: OBLIGATION
    FORALL (M: Matrix, (N: Matrix | M`cols = N`rows),
            (P:
               (LAMBDA (N_1: Matrix):
                  N`rows = N_1`rows AND N`cols = N_1`cols))):
      M`cols = (N + P)`rows;


decl_type: tcc
theory: matrices
library: linear_algebra
signature: nil
location: 618 0 625 999
body:
  % Subtype TCC generated (at line 273, column 33) for  P
      % expected type  {N: Matrix | M`cols = N`rows}
  left_distributive_TCC2: OBLIGATION
    FORALL (M: Matrix, (N: Matrix | M`cols = N`rows),
            (P:
               (LAMBDA (N_1: Matrix):
                  N`rows = N_1`rows AND N`cols = N_1`cols))):
      M`cols = P`rows;


decl_type: tcc
theory: matrices
library: linear_algebra
signature: nil
location: 627 0 635 999
body:
  % Subtype TCC generated (at line 273, column 29) for  (M * P)
      % expected type  (LAMBDA (N_1: Matrix):
                     %    (M * N)`rows = N_1`rows AND (M * N)`cols = N_1`cols)
  left_distributive_TCC3: OBLIGATION
    FORALL (M: Matrix, (N: Matrix | M`cols = N`rows),
            (P:
               (LAMBDA (N_1: Matrix):
                  N`rows = N_1`rows AND N`cols = N_1`cols))):
      (M * N)`rows = (M * P)`rows AND (M * N)`cols = (M * P)`cols;


decl_type: tcc
theory: matrices
library: linear_algebra
signature: nil
location: 637 0 643 999
body:
  % Subtype TCC generated (at line 277, column 14) for  P
      % expected type  {N_1: Matrix | (M + N)`cols = N_1`rows}
  right_distributive_TCC1: OBLIGATION
    FORALL (M: Matrix,
            (N: (LAMBDA (N): M`rows = N`rows AND M`cols = N`cols)),
            (P: Matrix | M`cols = P`rows)):
      (M + N)`cols = P`rows;


decl_type: tcc
theory: matrices
library: linear_algebra
signature: nil
location: 645 0 651 999
body:
  % Subtype TCC generated (at line 277, column 33) for  P
      % expected type  {N_1: Matrix | N`cols = N_1`rows}
  right_distributive_TCC2: OBLIGATION
    FORALL (M: Matrix,
            (N: (LAMBDA (N): M`rows = N`rows AND M`cols = N`cols)),
            (P: Matrix | M`cols = P`rows)):
      N`cols = P`rows;


decl_type: tcc
theory: matrices
library: linear_algebra
signature: nil
location: 653 0 660 999
body:
  % Subtype TCC generated (at line 277, column 29) for  (N * P)
      % expected type  (LAMBDA (N):
                     %    (M * P)`rows = N`rows AND (M * P)`cols = N`cols)
  right_distributive_TCC3: OBLIGATION
    FORALL (M: Matrix,
            (N: (LAMBDA (N): M`rows = N`rows AND M`cols = N`cols)),
            (P: Matrix | M`cols = P`rows)):
      (M * P)`rows = (N * P)`rows AND (M * P)`cols = (N * P)`cols;


decl_type: tcc
theory: matrices
library: linear_algebra
signature: nil
location: 662 0 666 999
body:
  % Subtype TCC generated (at line 286, column 38) for  transpose(M)
      % expected type  {N_1: Matrix | transpose(N)`cols = N_1`rows}
  transpose_product_TCC1: OBLIGATION
    FORALL (M: Matrix, (N: Matrix | M`cols = N`rows)):
      transpose(N)`cols = transpose(M)`rows;


decl_type: tcc
theory: matrices
library: linear_algebra
signature: nil
location: 668 0 672 999
body:
  % Subtype TCC generated (at line 288, column 108) for  x
      % expected type  Vector[transpose(A)`cols]
  trans_mat_scal_TCC1: OBLIGATION
    FORALL (A: Matrix):
      FORALL (x2: nat): x2 < A`rows IFF x2 < transpose(A)`cols;


decl_type: tcc
theory: matrices
library: linear_algebra
signature: nil
location: 674 0 678 999
body:
  % Subtype TCC generated (at line 288, column 113) for  y
      % expected type  Vector[transpose(A)`rows]
  trans_mat_scal_TCC2: OBLIGATION
    FORALL (A: Matrix):
      FORALL (x2: nat): x2 < A`cols IFF x2 < transpose(A)`rows;


decl_type: tcc
theory: matrices
library: linear_algebra
signature: nil
location: 680 0 683 999
body:
  % Subtype TCC generated (at line 297, column 7) for  N
      % expected type  {N: Matrix | M`cols = N`rows}
  inverse?_TCC1: OBLIGATION
    FORALL (M: Square, N: Square | N`rows = M`rows): M`cols = N`rows;


decl_type: tcc
theory: matrices
library: linear_algebra
signature: nil
location: 685 0 689 999
body:
  % Subtype TCC generated (at line 297, column 29) for  M
      % expected type  {N_1: Matrix | N`cols = N_1`rows}
  inverse?_TCC2: OBLIGATION
    FORALL (M: Square, N: Square | N`rows = M`rows):
      M * N = I(M`rows) IMPLIES N`cols = M`rows;


decl_type: tcc
theory: matrices
library: linear_algebra
signature: nil
location: 691 0 697 999
body:
  % Subtype TCC generated for
      % LAMBDA (N: Square | N`rows = M`rows): inverse?(M)(N)
      % expected type  p: (singleton?[{N: Square | N`rows = M`rows}])
  inverse_TCC1: OBLIGATION
    FORALL (M: (invertible?)):
      singleton?[{N: Square | N`rows = M`rows}]
          (LAMBDA (N: Square | N`rows = M`rows): inverse?(M)(N));


decl_type: tcc
theory: matrices
library: linear_algebra
signature: nil
location: 699 0 703 999
body:
  % Subtype TCC generated (at line 312, column 17) for  M * N
      % expected type  Square
  invertible_product_TCC1: OBLIGATION
    FORALL (M: (invertible?), N: (invertible?) | N`rows = M`rows):
      square?(M * N);


decl_type: tcc
theory: matrices
library: linear_algebra
signature: nil
location: 705 0 709 999
body:
  % Subtype TCC generated (at line 318, column 13) for  M * N
      % expected type  M: (invertible?)
  product_inverse_TCC1: OBLIGATION
    FORALL (M: (invertible?), N: (invertible?) | N`rows = M`rows):
      square?(M * N) AND invertible?(M * N);


decl_type: tcc
theory: matrices
library: linear_algebra
signature: nil
location: 711 0 715 999
body:
  % Subtype TCC generated (at line 318, column 35) for  inverse(M)
      % expected type  {N_1: Matrix | inverse(N)`cols = N_1`rows}
  product_inverse_TCC2: OBLIGATION
    FORALL (M: (invertible?), N: (invertible?) | N`rows = M`rows):
      inverse(N)`cols = inverse(M)`rows;


decl_type: tcc
theory: matrices
library: linear_algebra
signature: nil
location: 717 0 721 999
body:
  % Subtype TCC generated (at line 324, column 47) for  0
      % expected type  T_low[below(M`rows)]
  trace_TCC1: OBLIGATION
    FORALL (M: Square):
      0 >= 0 AND 0 < M`rows OR (EXISTS (j: below(M`rows)): j <= 0);


decl_type: tcc
theory: matrices
library: linear_algebra
signature: nil
location: 723 0 728 999
body:
  % Subtype TCC generated (at line 324, column 50) for  M`rows - 1
      % expected type  T_high[below(M`rows)]
  trace_TCC2: OBLIGATION
    FORALL (M: Square):
      M`rows - 1 >= 0 AND M`rows - 1 < M`rows OR
       (EXISTS (j: below(M`rows)): M`rows - 1 <= j);


decl_type: tcc
theory: matrices
library: linear_algebra
signature: nil
location: 730 0 732 999
body:
  % Subtype TCC generated (at line 324, column 99) for  k
      % expected type  below(M`cols)
  trace_TCC3: OBLIGATION FORALL (M: Square, k: below(M`rows)): k < M`cols;


decl_type: tcc
theory: matrices
library: linear_algebra
signature: nil
location: 734 0 738 999
body:
  % Subtype TCC generated (at line 335, column 14) for  transpose(M)
      % expected type  (LAMBDA (N): M`rows = N`rows AND M`cols = N`cols)
  symmetric_part_TCC1: OBLIGATION
    FORALL (M: Square):
      M`rows = transpose(M)`rows AND M`cols = transpose(M)`cols;


decl_type: tcc
theory: matrices
library: linear_algebra
signature: nil
location: 740 0 744 999
body:
  % Subtype TCC generated (at line 335, column 3) for
      % 1 / 2 * (M + transpose(M))
      % expected type  (symmetric?)
  symmetric_part_TCC2: OBLIGATION
    FORALL (M: Square): symmetric?(1 / 2 * (M + transpose(M)));


decl_type: tcc
theory: matrices
library: linear_algebra
signature: nil
location: 746 0 750 999
body:
  % Subtype TCC generated (at line 338, column 3) for
      % 1 / 2 * (M - transpose(M))
      % expected type  (skew_symmetric?)
  skew_symmetric_part_TCC1: OBLIGATION
    FORALL (M: Square): skew_symmetric?(1 / 2 * (M - transpose(M)));


decl_type: tcc
theory: matrices
library: linear_algebra
signature: nil
location: 752 0 759 999
body:
  % Subtype TCC generated (at line 341, column 47) for  skew_symmetric_part(M)
      % expected type  (LAMBDA (N):
                     %    symmetric_part(M)`rows = N`rows AND
                     %     symmetric_part(M)`cols = N`cols)
  square_decomp_TCC1: OBLIGATION
    FORALL (M: Square):
      symmetric_part(M)`rows = skew_symmetric_part(M)`rows AND
       symmetric_part(M)`cols = skew_symmetric_part(M)`cols;


decl_type: tcc
theory: matrices
library: linear_algebra
signature: nil
location: 761 0 764 999
body:
  % Subtype TCC generated (at line 357, column 69) for  x
      % expected type  Vector[A`cols]
  semidef_pos?_TCC1: OBLIGATION
    FORALL (A: (square?)): FORALL (x2: nat): x2 < A`rows IFF x2 < A`cols;


decl_type: formula
theory: block_matrices
library: linear_algebra
signature: nil
location: 151 1 151 195
body:
   conv_transp: LEMMA FORALL (M: Block_Matrix): Btranspose(M) = M2Block(M`cols1,M`cols2,M`rows1,M`rows2)(transpose(Block2M1(M)),transpose(Block2M3(M)),transpose(Block2M2(M)),transpose(Block2M4(M)))


decl_type: formula
theory: block_matrices
library: linear_algebra
signature: nil
location: 155 1 155 166
body:
   block_symmetric: LEMMA FORALL (M: Block_Matrix): symmetric?(Block2M1(M)) AND symmetric?(Block2M4(M)) AND transpose(Block2M2(M)) = Block2M3(M) IMPLIES Bsymmetric?(M);


decl_type: formula
theory: block_matrices
library: linear_algebra
signature: nil
location: 157 1 157 216
body:
   block_symmetric2: LEMMA FORALL (M: Block_Matrix): Bsymmetric?(M) AND square?(Block2M1(M)) AND square?(Block2M4(M)) IMPLIES symmetric?(Block2M1(M)) AND symmetric?(Block2M4(M)) AND transpose(Block2M2(M)) = Block2M3(M)


decl_type: formula
theory: block_matrices
library: linear_algebra
signature: nil
location: 173 1 173 142
body:
   VtoBlocktoV: LEMMA FORALL (x: Vector[m],y: Vector[n],i: below[m + n]): Block2V(V2Block(m,n)(x,y))(i) = IF i < m THEN x(i) ELSE y(i - m) ENDIF


decl_type: formula
theory: block_matrices
library: linear_algebra
signature: nil
location: 181 1 181 118
body:
   block_product: LEMMA FORALL (M: (Bdiag_square?),V: Block_Vect(M`cols1,M`cols2)): Block2V(M*V) = Block2M(M)*Block2V(V)


decl_type: type
theory: block_matrices
library: linear_algebra
signature: nil
location: 26 1 26 144
body:
   Block_Matrix: TYPE = [# rows1: posnat,rows2: posnat,cols1: posnat,cols2: posnat,matrix: [below(rows1 + rows2), below(cols1 + cols2) -> real] #]


decl_type: type
theory: block_matrices
library: linear_algebra
signature: nil
location: 78 1 78 120
body:
   Block_Vector2: TYPE = [# comp1: posnat,comp2: posnat,vector1: [below(comp1) -> real],vector2: [below(comp2) -> real] #]


decl_type: function
theory: block_matrices
library: linear_algebra
signature: [Block_Matrix -> Matrix]
location: 38 1 38 171
body:
   Block2M(M): Matrix = (# rows := M`rows1 + M`rows2, cols := M`cols1 + M`cols2,matrix := LAMBDA (i: below(M`rows1 + M`rows2), j: below(M`cols1 + M`cols2)): M`matrix(i,j) #)


decl_type: function
theory: block_matrices
library: linear_algebra
signature: [Block_Matrix -> Matrix]
location: 45 1 45 132
body:
   Block2M1(M): Matrix = (# rows := M`rows1, cols := M`cols1,matrix := LAMBDA (i: below(M`rows1), j: below(M`cols1)): M`matrix(i,j) #) %upper left block


decl_type: function
theory: block_matrices
library: linear_algebra
signature: [Block_Matrix -> Matrix]
location: 47 1 47 142
body:
   Block2M2(M): Matrix = (# rows := M`rows2, cols := M`cols1,matrix := LAMBDA (i: below(M`rows2), j: below(M`cols1)): M`matrix(i + M`rows1,j) #) %lower left block


decl_type: function
theory: block_matrices
library: linear_algebra
signature: [Block_Matrix -> Matrix]
location: 49 1 49 142
body:
   Block2M3(M): Matrix = (# rows := M`rows1, cols := M`cols2,matrix := LAMBDA (i: below(M`rows1), j: below(M`cols2)): M`matrix(i,j + M`cols1) #) %upper right block


decl_type: function
theory: block_matrices
library: linear_algebra
signature: [Block_Matrix -> Matrix]
location: 51 1 51 152
body:
   Block2M4(M): Matrix = (# rows := M`rows2, cols := M`cols2,matrix := LAMBDA (i: below(M`rows2), j: below(M`cols2)): M`matrix(i + M`rows1,j + M`cols1) #) %lower right block


decl_type: function
theory: block_matrices
library: linear_algebra
location: 57 1 68 7
signature:
  [d: [posnat, posnat, posnat, posnat] ->
          [[Mat(d`1, d`3), Mat(d`2, d`3), Mat(d`1, d`4),
            Mat(d`2, d`4)] ->
             Block_Matrix]]

body:
   M2Block(m,n,p,q)(A: Mat(m,p),B: Mat(n,p),C: Mat(m,q),D: Mat(n,q)): Block_Matrix =  (# rows1 := A`rows,rows2 := B`rows,cols1 := A`cols,cols2 := C`cols,matrix := 
              LAMBDA (i: below(A`rows + B`rows), j: below(A`cols + C`cols)): 
              IF i < A`rows THEN 
                   IF j < A`cols THEN A`matrix(i,j)
                      ELSE C`matrix(i,j - A`cols) 
                   ENDIF

                   ELSE IF j < A`cols THEN B`matrix (i - A`rows,j)
                      ELSE D`matrix(i - A`rows,j - A`cols)
                   ENDIF
              ENDIF  
              #)


decl_type: function
theory: block_matrices
library: linear_algebra
signature: [Block_Vector -> Block_Vector2]
location: 91 1 91 182
body:
   BV1toBV2(V): Block_Vector2 = (# comp1 := V`comp1, comp2 := V`comp2, vector1 := LAMBDA (i: below(V`comp1)): V`vector(i),vector2 := LAMBDA (i: below(V`comp2)): V`vector(i + V`comp1)#)


decl_type: function
theory: block_matrices
library: linear_algebra
signature: [Block_Vector2 -> Block_Vector]
location: 93 1 93 200
body:
   BV2toBV1(V: Block_Vector2): Block_Vector = (# comp1 := V`comp1, comp2 := V`comp2, vector := LAMBDA (i: below(V`comp1 + V`comp2)): IF i < V`comp1 THEN V`vector1(i) ELSE V`vector2(i - V`comp1) ENDIF #)


decl_type: function
theory: block_matrices
library: linear_algebra
signature:
  [d: [posnat, posnat] ->
  [[Vector[d`1], Vector[d`2]] -> Block_Vector]]

location: 103 1 107 8
body:
   V2Block(m,n: posnat)(x: Vector[m],y: Vector[n]): Block_Vector = (# comp1 := m,comp2 := n,vector := 
              LAMBDA (i: below(m + n)): 
              IF i < m THEN x(i)
              ELSE y(i - m) ENDIF  
              #);


decl_type: function
theory: block_matrices
library: linear_algebra
signature: [d: [posnat, posnat] -> [Vector[d`1 + d`2] -> Block_Vector]]
location: 110 1 110 127
body:
   Vec2Block(m,n: posnat)(x: Vector[m + n]): Block_Vector = (# comp1 := m,comp2 := n,vector := LAMBDA (i: below(m + n)): x(i) #);


decl_type: function
theory: block_matrices
library: linear_algebra
signature: [Block_Matrix -> Block_Matrix]
location: 121 1 121 196
body:
   Btranspose(M): Block_Matrix =  (# rows1 := M`cols1,rows2 := M`cols2,cols1 := M`rows1,cols2 := M`rows2,matrix := LAMBDA (i: below(M`cols1 + M`cols2), j: below(M`rows1 + M`rows2)): M`matrix(j,i) #)


decl_type: function
theory: block_matrices
library: linear_algebra
signature: [Block_Matrix -> [Block_Matrix -> bool]]
location: 129 1 129 110
body:
   same_Bdim?(M)(N): bool = M`rows1 = N`rows1 AND M`rows2 = N`rows2 AND M`cols1 = N`cols1 AND M`cols2 = N`cols2;


decl_type: function
theory: block_matrices
library: linear_algebra
signature:
  [[M: (Bdiag_square?), Block_Vect(M`cols1, M`cols2)] ->
  Block_Vector2]

location: 139 1 139 234
body:
   *(M: (Bdiag_square?),V: Block_Vect(M`cols1,M`cols2)): Block_Vector2 = (# comp1 := M`rows1, comp2 := M`rows2,vector1 := Block2M1(M)*Block2V1(V) + Block2M3(M)*Block2V2(V), vector2 := Block2M2(M)*Block2V1(V) + Block2M4(M)*Block2V2(V)#);


decl_type: function
theory: block_matrices
library: linear_algebra
signature: [[M: Block_Matrix, (same_Bdim?(M))] -> Block_Matrix]
location: 141 1 141 236
body:
   +(M: Block_Matrix,N: (same_Bdim?(M))): Block_Matrix = (# rows1 := M`rows1,rows2 := M`rows2,cols1 := M`cols1 ,cols2 := M`cols2,matrix := LAMBDA (i: below(M`rows1 + M`rows2),j: below(M`cols1 + M`cols2)): M`matrix(i,j) + N`matrix(i,j) #);


decl_type: function
theory: block_matrices
library: linear_algebra
signature: [[real, Block_Matrix] -> Block_Matrix]
location: 143 1 143 151
body:
   *(r: real, M: Block_Matrix): Block_Matrix = M WITH [`matrix := LAMBDA (i: below(M`rows1 + M`rows2), j: below(M`cols1 + M`cols2)): r * M`matrix(i, j)];


decl_type: tcc
theory: block_matrices
library: linear_algebra
signature: nil
location: 191 0 195 999
body:
  % Subtype TCC generated (at line 46, column 125) for  i
      % expected type  below(M`rows1 + M`rows2)
  Block2M1_TCC1: OBLIGATION
    FORALL (M: Block_Matrix, i: below(M`rows1), j: below(M`cols1)):
      i < M`rows1 + M`rows2;


decl_type: tcc
theory: block_matrices
library: linear_algebra
signature: nil
location: 197 0 201 999
body:
  % Subtype TCC generated (at line 46, column 127) for  j
      % expected type  below(M`cols1 + M`cols2)
  Block2M1_TCC2: OBLIGATION
    FORALL (M: Block_Matrix, i: below(M`rows1), j: below(M`cols1)):
      j < M`cols1 + M`cols2;


decl_type: tcc
theory: block_matrices
library: linear_algebra
signature: nil
location: 203 0 207 999
body:
  % Subtype TCC generated (at line 48, column 125) for  i + M`rows1
      % expected type  below(M`rows1 + M`rows2)
  Block2M2_TCC1: OBLIGATION
    FORALL (M: Block_Matrix, i: below(M`rows2), j: below(M`cols1)):
      i + M`rows1 < M`rows1 + M`rows2;


decl_type: tcc
theory: block_matrices
library: linear_algebra
signature: nil
location: 209 0 213 999
body:
  % Subtype TCC generated (at line 48, column 137) for  j
      % expected type  below(M`cols1 + M`cols2)
  Block2M2_TCC2: OBLIGATION
    FORALL (M: Block_Matrix, i: below(M`rows2), j: below(M`cols1)):
      j < M`cols1 + M`cols2;


decl_type: tcc
theory: block_matrices
library: linear_algebra
signature: nil
location: 215 0 219 999
body:
  % Subtype TCC generated (at line 50, column 125) for  i
      % expected type  below(M`rows1 + M`rows2)
  Block2M3_TCC1: OBLIGATION
    FORALL (M: Block_Matrix, i: below(M`rows1), j: below(M`cols2)):
      i < M`rows1 + M`rows2;


decl_type: tcc
theory: block_matrices
library: linear_algebra
signature: nil
location: 221 0 225 999
body:
  % Subtype TCC generated (at line 50, column 127) for  j + M`cols1
      % expected type  below(M`cols1 + M`cols2)
  Block2M3_TCC2: OBLIGATION
    FORALL (M: Block_Matrix, i: below(M`rows1), j: below(M`cols2)):
      j + M`cols1 < M`cols1 + M`cols2;


decl_type: tcc
theory: block_matrices
library: linear_algebra
signature: nil
location: 227 0 231 999
body:
  % Subtype TCC generated (at line 52, column 125) for  i + M`rows1
      % expected type  below(M`rows1 + M`rows2)
  Block2M4_TCC1: OBLIGATION
    FORALL (M: Block_Matrix, i: below(M`rows2), j: below(M`cols2)):
      i + M`rows1 < M`rows1 + M`rows2;


decl_type: tcc
theory: block_matrices
library: linear_algebra
signature: nil
location: 233 0 237 999
body:
  % Subtype TCC generated (at line 52, column 137) for  j + M`cols1
      % expected type  below(M`cols1 + M`cols2)
  Block2M4_TCC2: OBLIGATION
    FORALL (M: Block_Matrix, i: below(M`rows2), j: below(M`cols2)):
      j + M`cols1 < M`cols1 + M`cols2;


decl_type: tcc
theory: block_matrices
library: linear_algebra
signature: nil
location: 239 0 245 999
body:
  % Subtype TCC generated (at line 62, column 27) for  i
      % expected type  below(C`rows)
  M2Block_TCC1: OBLIGATION
    FORALL (m: posnat, n: posnat, p: posnat, q: posnat, A: Mat(m, p),
            B: Mat(n, p), C: Mat(m, q), D: Mat(n, q),
            i: below(A`rows + B`rows), j: below(A`cols + C`cols)):
      NOT j < A`cols AND i < A`rows IMPLIES i < C`rows;


decl_type: tcc
theory: block_matrices
library: linear_algebra
signature: nil
location: 247 0 254 999
body:
  % Subtype TCC generated (at line 62, column 29) for  j - A`cols
      % expected type  below(C`cols)
  M2Block_TCC2: OBLIGATION
    FORALL (m: posnat, n: posnat, p: posnat, q: posnat, A: Mat(m, p),
            B: Mat(n, p), C: Mat(m, q), D: Mat(n, q),
            i: below(A`rows + B`rows), j: below(A`cols + C`cols)):
      NOT j < A`cols AND i < A`rows IMPLIES
       j - A`cols >= 0 AND j - A`cols < C`cols;


decl_type: tcc
theory: block_matrices
library: linear_algebra
signature: nil
location: 256 0 263 999
body:
  % Subtype TCC generated (at line 65, column 44) for  i - A`rows
      % expected type  below(B`rows)
  M2Block_TCC3: OBLIGATION
    FORALL (m: posnat, n: posnat, p: posnat, q: posnat, A: Mat(m, p),
            B: Mat(n, p), C: Mat(m, q), D: Mat(n, q),
            i: below(A`rows + B`rows), j: below(A`cols + C`cols)):
      j < A`cols AND NOT i < A`rows IMPLIES
       i - A`rows >= 0 AND i - A`rows < B`rows;


decl_type: tcc
theory: block_matrices
library: linear_algebra
signature: nil
location: 265 0 271 999
body:
  % Subtype TCC generated (at line 65, column 55) for  j
      % expected type  below(B`cols)
  M2Block_TCC4: OBLIGATION
    FORALL (m: posnat, n: posnat, p: posnat, q: posnat, A: Mat(m, p),
            B: Mat(n, p), C: Mat(m, q), D: Mat(n, q),
            i: below(A`rows + B`rows), j: below(A`cols + C`cols)):
      j < A`cols AND NOT i < A`rows IMPLIES j < B`cols;


decl_type: tcc
theory: block_matrices
library: linear_algebra
signature: nil
location: 273 0 280 999
body:
  % Subtype TCC generated (at line 66, column 20) for  i - A`rows
      % expected type  below(D`rows)
  M2Block_TCC5: OBLIGATION
    FORALL (m: posnat, n: posnat, p: posnat, q: posnat, A: Mat(m, p),
            B: Mat(n, p), C: Mat(m, q), D: Mat(n, q),
            i: below(A`rows + B`rows), j: below(A`cols + C`cols)):
      NOT j < A`cols AND NOT i < A`rows IMPLIES
       i - A`rows >= 0 AND i - A`rows < D`rows;


decl_type: tcc
theory: block_matrices
library: linear_algebra
signature: nil
location: 282 0 289 999
body:
  % Subtype TCC generated (at line 66, column 31) for  j - A`cols
      % expected type  below(D`cols)
  M2Block_TCC6: OBLIGATION
    FORALL (m: posnat, n: posnat, p: posnat, q: posnat, A: Mat(m, p),
            B: Mat(n, p), C: Mat(m, q), D: Mat(n, q),
            i: below(A`rows + B`rows), j: below(A`cols + C`cols)):
      NOT j < A`cols AND NOT i < A`rows IMPLIES
       j - A`cols >= 0 AND j - A`cols < D`cols;


decl_type: tcc
theory: block_matrices
library: linear_algebra
signature: nil
location: 291 0 294 999
body:
  % Subtype TCC generated (at line 92, column 117) for  i
      % expected type  below(V`comp1 + V`comp2)
  BV1toBV2_TCC1: OBLIGATION
    FORALL (V: Block_Vector, i: below(V`comp1)): i < V`comp1 + V`comp2;


decl_type: tcc
theory: block_matrices
library: linear_algebra
signature: nil
location: 296 0 300 999
body:
  % Subtype TCC generated (at line 92, column 168) for  i + V`comp1
      % expected type  below(V`comp1 + V`comp2)
  BV1toBV2_TCC2: OBLIGATION
    FORALL (V: Block_Vector, i: below(V`comp2)):
      i + V`comp1 < V`comp1 + V`comp2;


decl_type: tcc
theory: block_matrices
library: linear_algebra
signature: nil
location: 302 0 306 999
body:
  % Subtype TCC generated (at line 94, column 179) for  i - V`comp1
      % expected type  below(V`comp2)
  BV2toBV1_TCC1: OBLIGATION
    FORALL (V: Block_Vector2, i: below(V`comp1 + V`comp2)):
      NOT i < V`comp1 IMPLIES i - V`comp1 >= 0 AND i - V`comp1 < V`comp2;


decl_type: tcc
theory: block_matrices
library: linear_algebra
signature: nil
location: 308 0 312 999
body:
  % Subtype TCC generated (at line 107, column 12) for  i - m
      % expected type  Index[n]
  V2Block_TCC1: OBLIGATION
    FORALL (m, n: posnat, i: below(m + n)):
      NOT i < m IMPLIES i - m >= 0 AND i - m < n;


decl_type: tcc
theory: block_matrices
library: linear_algebra
signature: nil
location: 314 0 318 999
body:
  % Subtype TCC generated (at line 138, column 60) for  Block2V1(W)
      % expected type  Vector[V`comp1]
  times_TCC1: OBLIGATION
    FORALL (V: Block_Vector, (W: Block_Vect(V`comp1, V`comp2))):
      FORALL (x: nat): x < W`comp1 IFF x < V`comp1;


decl_type: tcc
theory: block_matrices
library: linear_algebra
signature: nil
location: 320 0 324 999
body:
  % Subtype TCC generated (at line 138, column 86) for  Block2V2(W)
      % expected type  Vector[V`comp2]
  times_TCC2: OBLIGATION
    FORALL (V: Block_Vector, (W: Block_Vect(V`comp1, V`comp2))):
      FORALL (x: nat): x < W`comp2 IFF x < V`comp2;


decl_type: tcc
theory: block_matrices
library: linear_algebra
signature: nil
location: 326 0 330 999
body:
  % Subtype TCC generated (at line 140, column 132) for  Block2V1(V)
      % expected type  Vector[Block2M1(M)`cols]
  times_TCC3: OBLIGATION
    FORALL (M: (Bdiag_square?), V: Block_Vect(M`cols1, M`cols2)):
      FORALL (x: nat): x < V`comp1 IFF x < Block2M1(M)`cols;


decl_type: tcc
theory: block_matrices
library: linear_algebra
signature: nil
location: 332 0 336 999
body:
  % Subtype TCC generated (at line 140, column 158) for  Block2V2(V)
      % expected type  Vector[Block2M3(M)`cols]
  times_TCC4: OBLIGATION
    FORALL (M: (Bdiag_square?), V: Block_Vect(M`cols1, M`cols2)):
      FORALL (x: nat): x < V`comp2 IFF x < Block2M3(M)`cols;


decl_type: tcc
theory: block_matrices
library: linear_algebra
signature: nil
location: 338 0 343 999
body:
  % Subtype TCC generated (at line 140, column 146) for
      % Block2M3(M) * Block2V2(V)
      % expected type  Vector[Block2M1(M)`rows]
  times_TCC5: OBLIGATION
    FORALL (M: (Bdiag_square?), V: Block_Vect(M`cols1, M`cols2)):
      FORALL (x: nat): x < Block2M3(M)`rows IFF x < Block2M1(M)`rows;


decl_type: tcc
theory: block_matrices
library: linear_algebra
signature: nil
location: 345 0 350 999
body:
  % Subtype TCC generated (at line 140, column 120) for
      % Block2M1(M) * Block2V1(V) + Block2M3(M) * Block2V2(V)
      % expected type  [below(M`rows1) -> real]
  times_TCC6: OBLIGATION
    FORALL (M: (Bdiag_square?), V: Block_Vect(M`cols1, M`cols2)):
      FORALL (x: nat): x < Block2M1(M)`rows IFF x < M`rows1;


decl_type: tcc
theory: block_matrices
library: linear_algebra
signature: nil
location: 352 0 356 999
body:
  % Subtype TCC generated (at line 140, column 194) for  Block2V1(V)
      % expected type  Vector[Block2M2(M)`cols]
  times_TCC7: OBLIGATION
    FORALL (M: (Bdiag_square?), V: Block_Vect(M`cols1, M`cols2)):
      FORALL (x: nat): x < V`comp1 IFF x < Block2M2(M)`cols;


decl_type: tcc
theory: block_matrices
library: linear_algebra
signature: nil
location: 358 0 362 999
body:
  % Subtype TCC generated (at line 140, column 220) for  Block2V2(V)
      % expected type  Vector[Block2M4(M)`cols]
  times_TCC8: OBLIGATION
    FORALL (M: (Bdiag_square?), V: Block_Vect(M`cols1, M`cols2)):
      FORALL (x: nat): x < V`comp2 IFF x < Block2M4(M)`cols;


decl_type: tcc
theory: block_matrices
library: linear_algebra
signature: nil
location: 364 0 369 999
body:
  % Subtype TCC generated (at line 140, column 208) for
      % Block2M4(M) * Block2V2(V)
      % expected type  Vector[Block2M2(M)`rows]
  times_TCC9: OBLIGATION
    FORALL (M: (Bdiag_square?), V: Block_Vect(M`cols1, M`cols2)):
      FORALL (x: nat): x < Block2M4(M)`rows IFF x < Block2M2(M)`rows;


decl_type: tcc
theory: block_matrices
library: linear_algebra
signature: nil
location: 371 0 376 999
body:
  % Subtype TCC generated (at line 140, column 182) for
      % Block2M2(M) * Block2V1(V) + Block2M4(M) * Block2V2(V)
      % expected type  [below(M`rows2) -> real]
  times_TCC10: OBLIGATION
    FORALL (M: (Bdiag_square?), V: Block_Vect(M`cols1, M`cols2)):
      FORALL (x: nat): x < Block2M2(M)`rows IFF x < M`rows2;


decl_type: tcc
theory: block_matrices
library: linear_algebra
signature: nil
location: 378 0 383 999
body:
  % Subtype TCC generated (at line 142, column 228) for  i
      % expected type  below(N`rows1 + N`rows2)
  plus_TCC1: OBLIGATION
    FORALL (M: Block_Matrix, N: (same_Bdim?(M)), i: below(M`rows1 + M`rows2),
            j: below(M`cols1 + M`cols2)):
      i < N`rows1 + N`rows2;


decl_type: tcc
theory: block_matrices
library: linear_algebra
signature: nil
location: 385 0 390 999
body:
  % Subtype TCC generated (at line 142, column 230) for  j
      % expected type  below(N`cols1 + N`cols2)
  plus_TCC2: OBLIGATION
    FORALL (M: Block_Matrix, N: (same_Bdim?(M)), i: below(M`rows1 + M`rows2),
            j: below(M`cols1 + M`cols2)):
      j < N`cols1 + N`cols2;


decl_type: tcc
theory: block_matrices
library: linear_algebra
signature: nil
location: 392 0 398 999
body:
  % Subtype TCC generated (at line 152, column 103) for
      % transpose(Block2M1(M))
      % expected type  Mat(M`cols1, M`rows1)
  conv_transp_TCC1: OBLIGATION
    FORALL (M: Block_Matrix):
      transpose(Block2M1(M))`rows = M`cols1 AND
       transpose(Block2M1(M))`cols = M`rows1;


decl_type: tcc
theory: block_matrices
library: linear_algebra
signature: nil
location: 400 0 406 999
body:
  % Subtype TCC generated (at line 152, column 126) for
      % transpose(Block2M3(M))
      % expected type  Mat(M`cols2, M`rows1)
  conv_transp_TCC2: OBLIGATION
    FORALL (M: Block_Matrix):
      transpose(Block2M3(M))`rows = M`cols2 AND
       transpose(Block2M3(M))`cols = M`rows1;


decl_type: tcc
theory: block_matrices
library: linear_algebra
signature: nil
location: 408 0 414 999
body:
  % Subtype TCC generated (at line 152, column 149) for
      % transpose(Block2M2(M))
      % expected type  Mat(M`cols1, M`rows2)
  conv_transp_TCC3: OBLIGATION
    FORALL (M: Block_Matrix):
      transpose(Block2M2(M))`rows = M`cols1 AND
       transpose(Block2M2(M))`cols = M`rows2;


decl_type: tcc
theory: block_matrices
library: linear_algebra
signature: nil
location: 416 0 422 999
body:
  % Subtype TCC generated (at line 152, column 172) for
      % transpose(Block2M4(M))
      % expected type  Mat(M`cols2, M`rows2)
  conv_transp_TCC4: OBLIGATION
    FORALL (M: Block_Matrix):
      transpose(Block2M4(M))`rows = M`cols2 AND
       transpose(Block2M4(M))`cols = M`rows2;


decl_type: tcc
theory: block_matrices
library: linear_algebra
signature: nil
location: 424 0 428 999
body:
  % Subtype TCC generated (at line 166, column 85) for  Block2V(W)
      % expected type  Vector[V`comp1 + V`comp2]
  blockV_equal_TCC1: OBLIGATION
    FORALL (V: Block_Vector, W: Block_Vect(V`comp1, V`comp2)):
      FORALL (x: nat): x < W`comp1 + W`comp2 IFF x < V`comp1 + V`comp2;


decl_type: tcc
theory: block_matrices
library: linear_algebra
signature: nil
location: 430 0 434 999
body:
  % Subtype TCC generated (at line 170, column 87) for  x
      % expected type  Vector[V2Block(m, n)(x, y)`comp1]
  VtoBlocktoV1_TCC1: OBLIGATION
    FORALL (m, n: posnat, x: Vector[m], y: Vector[n]):
      FORALL (x2: nat): x2 < m IFF x2 < V2Block(m, n)(x, y)`comp1;


decl_type: tcc
theory: block_matrices
library: linear_algebra
signature: nil
location: 436 0 440 999
body:
  % Subtype TCC generated (at line 172, column 87) for  y
      % expected type  Vector[V2Block(m, n)(x, y)`comp2]
  VtoBlocktoV2_TCC1: OBLIGATION
    FORALL (m, n: posnat, x: Vector[m], y: Vector[n]):
      FORALL (x2: nat): x2 < n IFF x2 < V2Block(m, n)(x, y)`comp2;


decl_type: tcc
theory: block_matrices
library: linear_algebra
signature: nil
location: 442 0 448 999
body:
  % Subtype TCC generated (at line 174, column 99) for  i
      % expected type  Index
                     %     [V2Block(m, n)(x, y)`comp1 +
                     %       V2Block(m, n)(x, y)`comp2]
  VtoBlocktoV_TCC1: OBLIGATION
    FORALL (m, n: posnat, x: Vector[m], y: Vector[n], i: below[m + n]):
      i < V2Block(m, n)(x, y)`comp1 + V2Block(m, n)(x, y)`comp2;


decl_type: tcc
theory: block_matrices
library: linear_algebra
signature: nil
location: 450 0 457 999
body:
  % Subtype TCC generated (at line 176, column 92) for  V
      % expected type  Vector
                     %     [Vec2Block(m, n)(V)`comp1 +
                     %       Vec2Block(m, n)(V)`comp2]
  Vec_block_Vec_TCC1: OBLIGATION
    FORALL (m, n: posnat, V: Vector[m + n]):
      FORALL (x: nat):
        x < m + n IFF x < Vec2Block(m, n)(V)`comp1 + Vec2Block(m, n)(V)`comp2;


decl_type: tcc
theory: block_matrices
library: linear_algebra
signature: nil
location: 459 0 463 999
body:
  % Subtype TCC generated (at line 182, column 108) for  Block2V(V)
      % expected type  Vector[Block2M(M)`cols]
  block_product_TCC1: OBLIGATION
    FORALL (M: (Bdiag_square?), V: Block_Vect(M`cols1, M`cols2)):
      FORALL (x: nat): x < V`comp1 + V`comp2 IFF x < Block2M(M)`cols;


decl_type: tcc
theory: block_matrices
library: linear_algebra
signature: nil
location: 465 0 472 999
body:
  % Subtype TCC generated (at line 182, column 97) for
      % Block2M(M) * Block2V(V)
      % expected type  Vector[BV2toBV1(M * V)`comp1 + BV2toBV1(M * V)`comp2]
  block_product_TCC2: OBLIGATION
    FORALL (M: (Bdiag_square?), V: Block_Vect(M`cols1, M`cols2)):
      FORALL (x: nat):
        x < Block2M(M)`rows IFF
         x < BV2toBV1(M * V)`comp1 + BV2toBV1(M * V)`comp2;


decl_type: function
theory: linear_map
library: linear_algebra
signature: [[f: Maping, (same_dim?(f))] -> Maping]
location: 70 1 70 103
body:
   +(f: Maping,(g: (same_dim?(f)))): Maping = f WITH [`mp:= lambda(x: Vector[f`dom]): f`mp(x) + g`mp(x)]; 


decl_type: tcc
theory: linear_map
library: linear_algebra
signature: nil
location: 97 0 101 999
body:
  % Subtype TCC generated (at line 70, column 99) for  x
      % expected type  Vector[g`dom]
  plus_TCC1: OBLIGATION
    FORALL (f: Maping, (g: (same_dim?(f)))):
      FORALL (x2: nat): x2 < f`dom IFF x2 < g`dom;


decl_type: tcc
theory: linear_map
library: linear_algebra
signature: nil
location: 103 0 107 999
body:
  % Subtype TCC generated (at line 70, column 94) for  g`mp(x)
      % expected type  Vector[f`codom]
  plus_TCC2: OBLIGATION
    FORALL (f: Maping, (g: (same_dim?(f)))):
      FORALL (x2: nat): x2 < g`codom IFF x2 < f`codom;


decl_type: tcc
theory: linear_map
library: linear_algebra
signature: nil
location: 109 0 113 999
body:
  % Subtype TCC generated (at line 74, column 82) for  g`mp
      % expected type  [Vector[g`dom] -> Vector[f`dom]]
  oh_TCC1: OBLIGATION
    FORALL (f: Maping, (g: (same?(f)))):
      FORALL (x1: Vector[g`dom], x: nat): x < g`codom IFF x < f`dom;


decl_type: tcc
theory: linear_map
library: linear_algebra
signature: nil
location: 115 0 120 999
body:
  % Subtype TCC generated (at line 84, column 68) for  f`mp
      % expected type  [Vector[n] -> Vector[n]]
  bijective?_TCC1: OBLIGATION
    FORALL (n: posnat, f: Map(n, n)):
      (FORALL (x: nat): x < f`dom IFF x < n) AND
       (FORALL (x1: Vector[f`dom], x: nat): x < f`codom IFF x < n);


decl_type: formula
theory: sigma_vector
library: linear_algebra
signature: nil
location: 108 1 108 98
body:
   SigmaV_last: THEOREM high >= low IMPLIES SigmaV(low, high, F) = SigmaV(low, high-1, F) + F(high);      


decl_type: function
theory: sigma_vector
library: linear_algebra
signature: [[real, [T -> Vector[n]]] -> [T -> Vector[n]]]
location: 86 1 86 100
body:
   *: [real,function[T -> Vector[n]] -> function[T -> Vector[n]]] = LAMBDA(a,F): LAMBDA(i: T): a*F(i);


decl_type: function
theory: sigma_vector
library: linear_algebra
signature: [[[T -> real], [T -> Vector[n]]] -> [T -> Vector[n]]]
location: 93 1 93 118
body:
   *: [function[T -> real],function[T -> Vector[n]] -> function[T -> Vector[n]]] = LAMBDA(d,F): LAMBDA(i: T): d(i)*F(i);


decl_type: function
theory: sigma_vector
library: linear_algebra
signature: [[Map(n, n), [T -> Vector[n]]] -> [T -> Vector[n]]]
location: 100 1 100 118
body:
   o: [Map(n,n),function[T -> Vector[n]] -> function[T -> Vector[n]]] = LAMBDA(h: Map(n,n),F): LAMBDA(i: T): h`mp(F(i));


decl_type: tcc
theory: sigma_vector
library: linear_algebra
signature: nil
location: 125 0 128 999
body:
  % Assuming TCC generated (at line 69, column 10) for  T_low[T]
      % generated from assumption sigma.connected_domain
  low_TCC1: OBLIGATION
    (FORALL (x, y: T), (z: integer): x <= z AND z <= y IMPLIES T_pred(z));


decl_type: tcc
theory: sigma_vector
library: linear_algebra
signature: nil
location: 130 0 133 999
body:
  % Subtype TCC generated (at line 101, column 112) for  F(i)
      % expected type  Vector[h`dom]
  oh_TCC1: OBLIGATION
    FORALL (h: Map(n, n), i: T): FORALL (x: nat): x < n IFF x < h`dom;


decl_type: tcc
theory: sigma_vector
library: linear_algebra
signature: nil
location: 135 0 138 999
body:
  % Subtype TCC generated (at line 101, column 107) for  h`mp(F(i))
      % expected type  Vector[n]
  oh_TCC2: OBLIGATION
    FORALL (h: Map(n, n), i: T): FORALL (x: nat): x < h`codom IFF x < n;


decl_type: tcc
theory: sigma_vector
library: linear_algebra
signature: nil
location: 140 0 144 999
body:
  % Subtype TCC generated (at line 109, column 77) for  high - 1
      % expected type  T_high[T]
  SigmaV_last_TCC1: OBLIGATION
    FORALL (high: T_high[T], low: T_low[T]):
      high >= low IMPLIES T_pred(high - 1) OR (EXISTS (j: T): high - 1 <= j);


decl_type: tcc
theory: sigma_vector
library: linear_algebra
signature: nil
location: 146 0 149 999
body:
  % Subtype TCC generated (at line 109, column 92) for  high
      % expected type  T
  SigmaV_last_TCC2: OBLIGATION
    FORALL (high: T_high[T], low: T_low[T]): high >= low IMPLIES T_pred(high);


decl_type: formula
theory: linear_map_def
library: linear_algebra
signature: nil
location: 104 1 105 55
body:
   linear_map_e_comp: LEMMA FORALL (f: Map(m,p),g: Map(n,m)): linear_map_e?(m,p)(f)  AND linear_map_e?(n,m)(g) 
                        IMPLIES linear_map_e?(n,p)(f o g)


decl_type: formula
theory: linear_map_def
library: linear_algebra
signature: nil
location: 113 1 115 34
body:
   bijecti_fun_equa: LEMMA FORALL (k,h:Map(n,n)):k=h AND bijective?(n)(h) 
                    IMPLIES 
                    bijective?(n)(k)


decl_type: formula
theory: linear_map_def
library: linear_algebra
signature: nil
location: 124 1 125 33
body:
   equa_basis_n: LEMMA FORALL (h,k: Map_linear(n,m)): h`mp o e(n) = k`mp o e(n) 
                      IMPLIES h = k


decl_type: function
theory: linear_map_def
library: linear_algebra
signature: [n: posnat -> [below[n] -> Vector[n]]]
location: 76 1 76 101
body:
   e(n): [below[n]->Vector[n]] = LAMBDA(j: below[n]): LAMBDA(i: below[n]): IF (i=j) THEN 1 ELSE 0 ENDIF


decl_type: function
theory: linear_map_def
library: linear_algebra
signature: [[Maping, posnat, posnat, posnat] -> bool]
location: 89 1 90 80
body:
   linear_map_e?(h,l,n,m): bool = h`dom = n and h`codom = m and FORALL (x: Vector[l],F: [below[l]->Vector[n]]): 
   h`mp(SigmaV[below[l],n](0,l-1,x*F)) = SigmaV[below[l],m](0,l - 1,x*(h`mp o F));


decl_type: tcc
theory: linear_map_def
library: linear_algebra
signature: nil
location: 156 0 159 999
body:
  % Subtype TCC generated (at line 59, column 85) for  0
      % expected type  T_low[Index[n]]
  vec_expan?_TCC1: OBLIGATION
    FORALL (n: posnat): 0 >= 0 AND 0 < n OR (EXISTS (j: Index[n]): j <= 0);


decl_type: tcc
theory: linear_map_def
library: linear_algebra
signature: nil
location: 161 0 165 999
body:
  % Subtype TCC generated (at line 59, column 87) for  n - 1
      % expected type  T_high[Index[n]]
  vec_expan?_TCC2: OBLIGATION
    FORALL (n: posnat):
      n - 1 >= 0 AND n - 1 < n OR (EXISTS (j: Index[n]): n - 1 <= j);


decl_type: tcc
theory: linear_map_def
library: linear_algebra
signature: nil
location: 167 0 173 999
body:
  % Assuming TCC generated (at line 43, column 11) for
      % sigma_vector[Index[n], n]
      % generated from assumption sigma_vector.connected_domain
  vec_expan?_TCC3: OBLIGATION
    FORALL (n: posnat):
      FORALL (x, y: Index[n]), (z: integer):
        x <= z AND z <= y IMPLIES z >= 0 AND z < n;


decl_type: tcc
theory: linear_map_def
library: linear_algebra
signature: nil
location: 175 0 180 999
body:
  % Subtype TCC generated (at line 91, column 25) for  0
      % expected type  T_low[below[l]]
  linear_map_e?_TCC1: OBLIGATION
    FORALL (h: Maping, l: posnat, n: posnat, m: posnat):
      h`codom = m AND h`dom = n IMPLIES
       0 >= 0 AND 0 < l OR (EXISTS (j: below[l]): j <= 0);


decl_type: tcc
theory: linear_map_def
library: linear_algebra
signature: nil
location: 182 0 187 999
body:
  % Subtype TCC generated (at line 91, column 27) for  l - 1
      % expected type  T_high[below[l]]
  linear_map_e?_TCC2: OBLIGATION
    FORALL (h: Maping, l: posnat, n: posnat, m: posnat):
      h`codom = m AND h`dom = n IMPLIES
       l - 1 >= 0 AND l - 1 < l OR (EXISTS (j: below[l]): l - 1 <= j);


decl_type: tcc
theory: linear_map_def
library: linear_algebra
signature: nil
location: 189 0 196 999
body:
  % Assuming TCC generated (at line 43, column 11) for
      % sigma_vector[Index[l], n]
      % generated from assumption sigma_vector.connected_domain
  linear_map_e?_TCC3: OBLIGATION
    FORALL (h: Maping, l: posnat, n: posnat, m: posnat):
      h`codom = m AND h`dom = n IMPLIES
       (FORALL (x, y: Index[l]), (z: integer):
          x <= z AND z <= y IMPLIES z >= 0 AND z < l);


decl_type: tcc
theory: linear_map_def
library: linear_algebra
signature: nil
location: 198 0 204 999
body:
  % Subtype TCC generated (at line 91, column 6) for
      % SigmaV[below[l], n](0, l - 1, x * F)
      % expected type  Vector[h`dom]
  linear_map_e?_TCC4: OBLIGATION
    FORALL (h: Maping, n: posnat, m: posnat):
      h`codom = m AND h`dom = n IMPLIES
       (FORALL (x2: nat): x2 < n IFF x2 < h`dom);


decl_type: tcc
theory: linear_map_def
library: linear_algebra
signature: nil
location: 206 0 211 999
body:
  % Subtype TCC generated (at line 91, column 66) for  x * (h`mp o F)
      % expected type  [below[l] -> Vector[m]]
  linear_map_e?_TCC5: OBLIGATION
    FORALL (h: Maping, l: posnat, n: posnat, m: posnat):
      h`codom = m AND h`dom = n IMPLIES
       (FORALL (x1: Index[l], x3: nat): x3 < h`codom IFF x3 < m);


decl_type: tcc
theory: linear_map_def
library: linear_algebra
signature: nil
location: 213 0 219 999
body:
  % Subtype TCC generated (at line 91, column 39) for
      % SigmaV[below[l], m](0, l - 1, x * (h`mp o F))
      % expected type  Vector[h`codom]
  linear_map_e?_TCC6: OBLIGATION
    FORALL (h: Maping, n: posnat, m: posnat):
      h`codom = m AND h`dom = n IMPLIES
       (FORALL (x2: nat): x2 < m IFF x2 < h`codom);


decl_type: tcc
theory: linear_map_def
library: linear_algebra
signature: nil
location: 221 0 225 999
body:
  % Subtype TCC generated (at line 106, column 53) for  g
      % expected type  (same?(f))
  linear_map_e_comp_TCC1: OBLIGATION
    FORALL (m, n, p: posnat, f: Map(m, p), g: Map(n, m)):
      linear_map_e?(m, p)(f) AND linear_map_e?(n, m)(g) IMPLIES same?(f)(g);


decl_type: tcc
theory: linear_map_def
library: linear_algebra
signature: nil
location: 227 0 231 999
body:
  % Subtype TCC generated (at line 125, column 59) for  e(n)
      % expected type  [below[n] -> Vector[h`dom]]
  equa_basis_n_TCC1: OBLIGATION
    FORALL (m, n: posnat, h, k: Map_linear(n, m)):
      FORALL (x1: below[n], x: nat): x < n IFF x < h`dom;


decl_type: tcc
theory: linear_map_def
library: linear_algebra
signature: nil
location: 233 0 237 999
body:
  % Subtype TCC generated (at line 125, column 73) for  e(n)
      % expected type  [below[n] -> Vector[k`dom]]
  equa_basis_n_TCC2: OBLIGATION
    FORALL (m, n: posnat, h, k: Map_linear(n, m)):
      FORALL (x1: below[n], x: nat): x < n IFF x < k`dom;


decl_type: tcc
theory: linear_map_def
library: linear_algebra
signature: nil
location: 239 0 243 999
body:
  % Subtype TCC generated (at line 125, column 66) for  k`mp o e(n)
      % expected type  [below[n] -> Vector[h`codom]]
  equa_basis_n_TCC3: OBLIGATION
    FORALL (m, n: posnat, h, k: Map_linear(n, m)):
      FORALL (x1: below[n], x: nat): x < k`codom IFF x < h`codom;


decl_type: formula
theory: matrix_operator
library: linear_algebra
signature: nil
location: 56 1 56 118
body:
   linear_inverse_map_n: LEMMA  FORALL (f: Map_linear(n,n)): bijective?(n)(f)  IMPLIES linear_map_e?(n,n)(inverse(n)(f))


decl_type: formula
theory: matrix_operator
library: linear_algebra
signature: nil
location: 60 1 61 44
body:
   linear_comp: LEMMA FORALL (n,m,l: posnat,g: Map_linear(n,m),f: Map_linear(m,l)):
                     linear_map_e?(n,l)(f o g)


decl_type: formula
theory: matrix_operator
library: linear_algebra
signature: nil
location: 64 1 64 133
body:
   linear_matrix: LEMMA FORALL (A: Mat(n,m),F: [below[l] -> [Vector[m]]]): A*SigmaV(0,l-1,F) = SigmaV(0,l-1,lambda(i: below[l]):A*F(i))


decl_type: formula
theory: matrix_operator
library: linear_algebra
signature: nil
location: 68 1 70 31
body:
   equa_inv:LEMMA FORALL(f,g,h: Map(n,n)):(f o g)`mp = id(n)`mp and (h o f)`mp = id(n)`mp
                 IMPLIES
                 bijective?(n)(f)                     


decl_type: formula
theory: matrix_operator
library: linear_algebra
signature: nil
location: 72 1 74 54
body:
   inv_uni:LEMMA FORALL(f,g,h: Map(n,n)): (f o g)`mp = id(n)`mp and (h o f)`mp = id(n)`mp
                 IMPLIES
                 inverse(n)(f) = g and inverse(n)(f) = h 


decl_type: formula
theory: matrix_operator
library: linear_algebra
signature: nil
location: 128 1 130 57
body:
   operator: LEMMA FORALL (f,g: Map_linear(n,m)): f = g 
                  IMPLIES 
                  L(f`dom,f`codom)(f) = L(g`dom,g`codom)(g)              


decl_type: formula
theory: matrix_operator
library: linear_algebra
signature: nil
location: 174 1 175 57
body:
   comp_mult:   LEMMA FORALL (g: Map_linear(n,m),f: Map_linear(m,p)): 
                        L(n,p)(f o g) = L(m,p)(f)*L(n,m)(g)


decl_type: formula
theory: matrix_operator
library: linear_algebra
signature: nil
location: 204 1 213 75
body:
   inverse_invertible: LEMMA 
                       
                       square?(A) AND 
                       squareMat?(n)(A) AND 
                       bijective?(n)(T(n,n)(A)) 
                      
                      IMPLIES 
                      
                      squareMat?(n)(L(n, n)(inverse(n)(T(n, n)(A)))) AND
                      bijective?(n)(T(n, n)(L(n, n)(inverse(n)(T(n, n)(A)))))


decl_type: formula
theory: matrix_operator
library: linear_algebra
signature: nil
location: 228 1 230 59
body:
   iso_inv: LEMMA  squareMat?(n)(M) AND bijective?(n)(T(n,n)(M))  
                   IMPLIES  
                   inv(n)(M)*M  = I(n) AND M*inv(n)(M) = I(n)


decl_type: formula
theory: matrix_operator
library: linear_algebra
signature: nil
location: 238 1 241 44
body:
   inv: LEMMA squareMat?(n)(M) AND  
                        bijective?(n)(T(n,n)(M)) 
                        IMPLIES    
                        inverse?(M)(inv(n)(M))


decl_type: formula
theory: matrix_operator
library: linear_algebra
signature: nil
location: 246 1 249 44
body:
   bijec_prod: LEMMA square?(A) AND squareMat?(n)(A) AND bijective?(n)(T(n,n)(A)) AND
                    square?(M) AND squareMat?(n)(M) AND bijective?(n)(T(n,n)(M)) 
                    IMPLIES 
                    bijective?(n)(T(n,n)(A*M))


decl_type: formula
theory: matrix_operator
library: linear_algebra
signature: nil
location: 261 1 263 55
body:
   tran_inv: LEMMA square?(A) and squareMat?(n)(A) and bijective?(n)(T(n,n)(A))
             IMPLIES 
             inverse?(transpose(A))(transpose(inv(n)(A)))  


decl_type: formula
theory: matrix_operator
library: linear_algebra
signature: nil
location: 271 0 274 58
body:
  bijec_transpose: LEMMA square?(A) AND squareMat?(n)(A) AND 
                         bijective?(n)(T(n,n)(A)) 
                         IMPLIES 
                         bijective?(n)(T(n,n)(transpose(A)))


decl_type: formula
theory: matrix_operator
library: linear_algebra
signature: nil
location: 277 0 279 57
body:
  tran_inv_oper: LEMMA square?(A) and squareMat?(n)(A) and bijective?(n)(T(n,n)(A))
                 IMPLIES 
                  inv(n)(transpose(A))=transpose(inv(n)(A))


decl_type: formula
theory: matrix_operator
library: linear_algebra
signature: nil
location: 287 0 290 49
body:
  prod_inv:LEMMA square?(A) and squareMat?(n)(A) and bijective?(n)(T(n,n)(A)) AND
                 square?(B) and squareMat?(n)(B) and bijective?(n)(T(n,n)(B))
                 IMPLIES 
                 inverse?(A*B)(inv(n)(B)*inv(n)(A))


decl_type: formula
theory: matrix_operator
library: linear_algebra
signature: nil
location: 293 0 296 46
body:
  prod_inv_oper:LEMMA square?(A) and squareMat?(n)(A) and bijective?(n)(T(n,n)(A)) AND
                 square?(B) and squareMat?(n)(B) and bijective?(n)(T(n,n)(B))
                 IMPLIES 
                 inv(n)(A*B)=inv(n)(B)*inv(n)(A)


decl_type: formula
theory: matrix_operator
library: linear_algebra
signature: nil
location: 302 0 307 33
body:
  equa_sol: LEMMA FORALL(x,y,b:Vector[n]): square?(M) AND 
                  squareMat?(n)(M) and 
                  y=M*x+b and 
                  bijective?(n)(T(n,n)(M)) 
                  IMPLIES 
                  x=inv(n)(M)*(y-b) 


decl_type: function
theory: matrix_operator
library: linear_algebra
signature:
  [d: [posnat, posnat] ->
  [Map_linear(d`1, d`2) -> Mat(d`2, d`1)]]

location: 84 1 85 98
body:
   L(n,m): [Map_linear(n,m) -> Mat(m,n)] = (lambda(f: Map_linear(n,m)): 
                   (#rows:= m,cols:= n,matrix:= lambda(j: below[m],i: below[n]): f`mp(e(n)(i))(j)#))


decl_type: function
theory: matrix_operator
library: linear_algebra
signature:
  [d: [posnat, posnat] ->
  [Mat(d`2, d`1) -> Map_linear(d`1, d`2)]]

location: 94 0 95 125
body:
  T(n,m): [Mat(m,n) -> Map_linear(n,m)]=(lambda(A: Mat(m,n)): (#dom:= n,codom:= m,mp:= lambda(x: Vector[n]): lambda(j: below[m]): 
                                                              sigma(0,A`cols-1,lambda(i: below[A`cols]): A`matrix(j,i)*x(i))#))  


decl_type: function
theory: matrix_operator
library: linear_algebra
signature: [n: posnat -> [Matrix_inv(n) -> Matrix_inv(n)]]
location: 216 1 216 102
body:
   inv(n): [Matrix_inv(n) -> Matrix_inv(n)] = (lambda (A: Matrix_inv(n)): L(n,n)(inverse(n)(T(n,n)(A))))


decl_type: tcc
theory: matrix_operator
library: linear_algebra
signature: nil
location: 315 0 319 999
body:
  % Subtype TCC generated (at line 63, column 42) for  g
      % expected type  (same?(f))
  linear_comp_TCC1: OBLIGATION
    FORALL (n, m, l: posnat, g: Map_linear(n, m), f: Map_linear(m, l)):
      same?(f)(g);


decl_type: tcc
theory: matrix_operator
library: linear_algebra
signature: nil
location: 321 0 325 999
body:
  % Subtype TCC generated (at line 66, column 82) for  0
      % expected type  T_low[below[l]]
  linear_matrix_TCC1: OBLIGATION
    FORALL (l, m, n: posnat, A: Mat(n, m)):
      0 >= 0 AND 0 < l OR (EXISTS (j: below[l]): j <= 0);


decl_type: tcc
theory: matrix_operator
library: linear_algebra
signature: nil
location: 327 0 331 999
body:
  % Subtype TCC generated (at line 66, column 84) for  l - 1
      % expected type  T_high[below[l]]
  linear_matrix_TCC2: OBLIGATION
    FORALL (l, m, n: posnat, A: Mat(n, m)):
      l - 1 >= 0 AND l - 1 < l OR (EXISTS (j: below[l]): l - 1 <= j);


decl_type: tcc
theory: matrix_operator
library: linear_algebra
signature: nil
location: 333 0 339 999
body:
  % Assuming TCC generated (at line 43, column 11) for
      % sigma_vector[below[l], m]
      % generated from assumption sigma_vector.connected_domain
  linear_matrix_TCC3: OBLIGATION
    FORALL (l, m, n: posnat, A: Mat(n, m)):
      FORALL (x, y: below[l]), (z: integer):
        x <= z AND z <= y IMPLIES z >= 0 AND z < l;


decl_type: tcc
theory: matrix_operator
library: linear_algebra
signature: nil
location: 341 0 345 999
body:
  % Subtype TCC generated (at line 66, column 75) for  SigmaV(0, l - 1, F)
      % expected type  Vector[A`cols]
  linear_matrix_TCC4: OBLIGATION
    FORALL (m, n: posnat, A: Mat(n, m)):
      FORALL (x: nat): x < m IFF x < A`cols;


decl_type: tcc
theory: matrix_operator
library: linear_algebra
signature: nil
location: 347 0 350 999
body:
  % Subtype TCC generated (at line 70, column 45) for  g
      % expected type  (same?(f))
  equa_inv_TCC1: OBLIGATION
    FORALL (n: posnat, f, g, h: Map(n, n)): same?(f)(g);


decl_type: tcc
theory: matrix_operator
library: linear_algebra
signature: nil
location: 352 0 358 999
body:
  % Subtype TCC generated (at line 70, column 53) for  id(n)`mp
      % expected type  [Vector[(f o g)`dom] -> Vector[(f o g)`codom]]
  equa_inv_TCC2: OBLIGATION
    FORALL (n: posnat, f, g, h: Map(n, n)):
      (FORALL (x: nat): x < id(n)`dom IFF x < (f o g)`dom) AND
       (FORALL (x1: Vector[id(n)`dom], x: nat):
          x < id(n)`codom IFF x < (f o g)`codom);


decl_type: tcc
theory: matrix_operator
library: linear_algebra
signature: nil
location: 360 0 364 999
body:
  % Subtype TCC generated (at line 70, column 71) for  f
      % expected type  (same?(h))
  equa_inv_TCC3: OBLIGATION
    FORALL (n: posnat, f, g, h: Map(n, n)):
      (f o g)`mp = id(n)`mp IMPLIES same?(h)(f);


decl_type: tcc
theory: matrix_operator
library: linear_algebra
signature: nil
location: 366 0 373 999
body:
  % Subtype TCC generated (at line 70, column 79) for  id(n)`mp
      % expected type  [Vector[(h o f)`dom] -> Vector[(h o f)`codom]]
  equa_inv_TCC4: OBLIGATION
    FORALL (n: posnat, f, g, h: Map(n, n)):
      (f o g)`mp = id(n)`mp IMPLIES
       (FORALL (x: nat): x < id(n)`dom IFF x < (h o f)`dom) AND
        (FORALL (x1: Vector[id(n)`dom], x: nat):
           x < id(n)`codom IFF x < (h o f)`codom);


decl_type: tcc
theory: matrix_operator
library: linear_algebra
signature: nil
location: 375 0 380 999
body:
  % Subtype TCC generated (at line 87, column 93) for  j
      % expected type  Index[f`codom]
  L_TCC1: OBLIGATION
    FORALL (n: posnat, m: posnat, f: Map_linear(n, m), j: below[m],
            i: below[n]):
      j < f`codom;


decl_type: tcc
theory: matrix_operator
library: linear_algebra
signature: nil
location: 382 0 387 999
body:
  % Subtype TCC generated (at line 87, column 84) for  e(n)(i)
      % expected type  Vector[f`dom]
  L_TCC2: OBLIGATION
    FORALL (n: posnat, m: posnat, f: Map_linear(n, m), j: below[m],
            i: below[n]):
      FORALL (x: nat): x < n IFF x < f`dom;


decl_type: tcc
theory: matrix_operator
library: linear_algebra
signature: nil
location: 389 0 393 999
body:
  % Subtype TCC generated (at line 97, column 66) for  0
      % expected type  T_low[below[A`cols]]
  T_TCC1: OBLIGATION
    FORALL (n: posnat, m: posnat, A: Mat(m, n), j: below[m]):
      0 >= 0 AND 0 < A`cols OR (EXISTS (j: below[A`cols]): j <= 0);


decl_type: tcc
theory: matrix_operator
library: linear_algebra
signature: nil
location: 395 0 400 999
body:
  % Subtype TCC generated (at line 97, column 68) for  A`cols - 1
      % expected type  T_high[below[A`cols]]
  T_TCC2: OBLIGATION
    FORALL (n: posnat, m: posnat, A: Mat(m, n), j: below[m]):
      A`cols - 1 >= 0 AND A`cols - 1 < A`cols OR
       (EXISTS (j: below[A`cols]): A`cols - 1 <= j);


decl_type: tcc
theory: matrix_operator
library: linear_algebra
signature: nil
location: 402 0 407 999
body:
  % Subtype TCC generated (at line 97, column 112) for  j
      % expected type  below(A`rows)
  T_TCC3: OBLIGATION
    FORALL (n: posnat, m: posnat, A: Mat(m, n), j: below[m],
            i: below[A`cols]):
      j < A`rows;


decl_type: tcc
theory: matrix_operator
library: linear_algebra
signature: nil
location: 409 0 414 999
body:
  % Subtype TCC generated (at line 97, column 119) for  i
      % expected type  Index[n]
  T_TCC4: OBLIGATION
    FORALL (n: posnat, m: posnat, A: Mat(m, n), j: below[m],
            i: below[A`cols]):
      i < n;


decl_type: tcc
theory: matrix_operator
library: linear_algebra
signature: nil
location: 416 0 422 999
body:
  % Assuming TCC generated (at line 21, column 12) for
      % reals@sigma[below[A`cols]]
      % generated from assumption sigma.connected_domain
  T_TCC5: OBLIGATION
    FORALL (n: posnat, m: posnat, A: Mat(m, n), j: below[m]):
      FORALL (x, y: below[A`cols]), (z: integer):
        x <= z AND z <= y IMPLIES z >= 0 AND z < A`cols;


decl_type: tcc
theory: matrix_operator
library: linear_algebra
signature: nil
location: 424 0 444 999
body:
  % Subtype TCC generated (at line 96, column 60) for
      % (# dom := n,
      %    codom := m,
      %    mp
      %      := LAMBDA (x: Vector[n]):
      %           LAMBDA (j: below[m]):
      %             sigma(0, A`cols - 1,
      %                   LAMBDA (i: below[A`cols]): A`matrix(j, i) * x(i)) #)
      % expected type  Map_linear(n, m)
  T_TCC6: OBLIGATION
    FORALL (n: posnat, m: posnat, A: Mat(m, n)):
      linear_map_e?(n, m)
                   ((# dom := n,
                       codom := m,
                       mp
                         := LAMBDA (x: Vector[n]):
                              LAMBDA (j: below[m]):
                                sigma[below[A`cols]]
                                    (0, A`cols - 1,
                                     LAMBDA (i: below[A`cols]):
                                       A`matrix(j, i) * x(i)) #));


decl_type: tcc
theory: matrix_operator
library: linear_algebra
signature: nil
location: 446 0 450 999
body:
  % Subtype TCC generated (at line 105, column 65) for  x
      % expected type  Vector[(T(n, m)(A))`dom]
  T_matr_TCC1: OBLIGATION
    FORALL (m, n: posnat, A: Mat(m, n)):
      FORALL (x2: nat): x2 < n IFF x2 < (T(n, m)(A))`dom;


decl_type: tcc
theory: matrix_operator
library: linear_algebra
signature: nil
location: 452 0 456 999
body:
  % Subtype TCC generated (at line 105, column 72) for  x
      % expected type  Vector[A`cols]
  T_matr_TCC2: OBLIGATION
    FORALL (m, n: posnat, A: Mat(m, n)):
      FORALL (x2: nat): x2 < n IFF x2 < A`cols;


decl_type: tcc
theory: matrix_operator
library: linear_algebra
signature: nil
location: 458 0 462 999
body:
  % Subtype TCC generated (at line 105, column 70) for  A * x
      % expected type  Vector[(T(n, m)(A))`codom]
  T_matr_TCC3: OBLIGATION
    FORALL (m, n: posnat, A: Mat(m, n)):
      FORALL (x2: nat): x2 < A`rows IFF x2 < (T(n, m)(A))`codom;


decl_type: tcc
theory: matrix_operator
library: linear_algebra
signature: nil
location: 464 0 468 999
body:
  % Subtype TCC generated (at line 132, column 33) for  f
      % expected type  Map_linear(f`dom, f`codom)
  operator_TCC1: OBLIGATION
    FORALL (m, n: posnat, f, g: Map_linear(n, m)):
      f = g IMPLIES linear_map_e?(f`dom, f`codom)(f);


decl_type: tcc
theory: matrix_operator
library: linear_algebra
signature: nil
location: 470 0 474 999
body:
  % Subtype TCC generated (at line 132, column 55) for  g
      % expected type  Map_linear(g`dom, g`codom)
  operator_TCC2: OBLIGATION
    FORALL (m, n: posnat, f, g: Map_linear(n, m)):
      f = g IMPLIES linear_map_e?(g`dom, g`codom)(g);


decl_type: tcc
theory: matrix_operator
library: linear_algebra
signature: nil
location: 476 0 478 999
body:
  % Existence TCC generated (at line 157, column 18) for  inverse
  L_inverse_TCC1: OBLIGATION
    FORALL (m, n: posnat): EXISTS (x: Map_linear(n, m)): TRUE;


decl_type: tcc
theory: matrix_operator
library: linear_algebra
signature: nil
location: 480 0 483 999
body:
  % Subtype TCC generated (at line 174, column 61) for  B
      % expected type  {N: Matrix | A`cols = N`rows}
  mult_comp_TCC1: OBLIGATION
    FORALL (m, n, p: posnat, A: Mat(p, m), B: Mat(m, n)): A`cols = B`rows;


decl_type: tcc
theory: matrix_operator
library: linear_algebra
signature: nil
location: 485 0 489 999
body:
  % Subtype TCC generated (at line 174, column 59) for  A * B
      % expected type  Mat(p, n)
  mult_comp_TCC2: OBLIGATION
    FORALL (m, n, p: posnat, A: Mat(p, m), B: Mat(m, n)):
      (A * B)`rows = p AND (A * B)`cols = n;


decl_type: tcc
theory: matrix_operator
library: linear_algebra
signature: nil
location: 491 0 495 999
body:
  % Subtype TCC generated (at line 174, column 78) for  T(n, m)(B)
      % expected type  (same?(T(m, p)(A)))
  mult_comp_TCC3: OBLIGATION
    FORALL (m, n, p: posnat, A: Mat(p, m), B: Mat(m, n)):
      same?(T(m, p)(A))(T(n, m)(B));


decl_type: tcc
theory: matrix_operator
library: linear_algebra
signature: nil
location: 497 0 501 999
body:
  % Subtype TCC generated (at line 177, column 29) for  f o g
      % expected type  Map_linear(n, p)
  comp_mult_TCC1: OBLIGATION
    FORALL (m, n, p: posnat, g: Map_linear(n, m), f: Map_linear(m, p)):
      ((f o g)`dom = n AND (f o g)`codom = p) AND linear_map_e?(n, p)(f o g);


decl_type: tcc
theory: matrix_operator
library: linear_algebra
signature: nil
location: 503 0 507 999
body:
  % Subtype TCC generated (at line 177, column 48) for  L(n, m)(g)
      % expected type  {N: Matrix | L(m, p)(f)`cols = N`rows}
  comp_mult_TCC2: OBLIGATION
    FORALL (m, n, p: posnat, g: Map_linear(n, m), f: Map_linear(m, p)):
      L(m, p)(f)`cols = L(n, m)(g)`rows;


decl_type: tcc
theory: matrix_operator
library: linear_algebra
signature: nil
location: 509 0 513 999
body:
  % Subtype TCC generated (at line 186, column 25) for  id(n)
      % expected type  Map_linear(n, n)
  iso_ide_L_TCC1: OBLIGATION
    FORALL (n: posnat):
      (id(n)`dom = n AND id(n)`codom = n) AND linear_map_e?(n, n)(id(n));


decl_type: tcc
theory: matrix_operator
library: linear_algebra
signature: nil
location: 515 0 518 999
body:
  % Subtype TCC generated (at line 188, column 24) for  I(n)
      % expected type  Mat(n, n)
  iso_ide_T_TCC1: OBLIGATION
    FORALL (n: posnat): I(n)`rows = n AND I(n)`cols = n;


decl_type: tcc
theory: matrix_operator
library: linear_algebra
signature: nil
location: 520 0 524 999
body:
  % Subtype TCC generated (at line 197, column 75) for  A
      % expected type  Mat(n, n)
  Matrix_inv_TCC1: OBLIGATION
    FORALL (n: posnat, A: Square):
      squareMat?(n)(A) IMPLIES A`rows = n AND A`cols = n;


decl_type: tcc
theory: matrix_operator
library: linear_algebra
signature: nil
location: 526 0 530 999
body:
  % Subtype TCC generated (at line 210, column 42) for  A
      % expected type  Mat(n, n)
  inverse_invertible_TCC1: OBLIGATION
    FORALL (A: Matrix, n: posnat):
      square?(A) AND squareMat?(n)(A) IMPLIES A`rows = n AND A`cols = n;


decl_type: tcc
theory: matrix_operator
library: linear_algebra
signature: nil
location: 532 0 538 999
body:
  % Subtype TCC generated (at line 214, column 28) for  inverse(n)(T(n, n)(A))
      % expected type  Map_linear(n, n)
  inverse_invertible_TCC2: OBLIGATION
    FORALL (A: Matrix, n: posnat):
      bijective?(n)(T(n, n)(A)) AND squareMat?(n)(A) AND square?(A) IMPLIES
       (inverse(n)(T(n, n)(A))`dom = n AND inverse(n)(T(n, n)(A))`codom = n)
        AND linear_map_e?(n, n)(inverse(n)(T(n, n)(A)));


decl_type: tcc
theory: matrix_operator
library: linear_algebra
signature: nil
location: 540 0 546 999
body:
  % Subtype TCC generated (at line 214, column 20) for
      % L(n, n)(inverse(n)(T(n, n)(A)))
      % expected type  Square
  inverse_invertible_TCC3: OBLIGATION
    FORALL (A: Matrix, n: posnat):
      bijective?(n)(T(n, n)(A)) AND squareMat?(n)(A) AND square?(A) IMPLIES
       square?(L(n, n)(inverse(n)(T(n, n)(A))));


decl_type: tcc
theory: matrix_operator
library: linear_algebra
signature: nil
location: 548 0 551 999
body:
  % Subtype TCC generated (at line 218, column 97) for  A
      % expected type  Mat(n, n)
  inv_TCC1: OBLIGATION
    FORALL (n: posnat, A: Matrix_inv(n)): A`rows = n AND A`cols = n;


decl_type: tcc
theory: matrix_operator
library: linear_algebra
signature: nil
location: 553 0 558 999
body:
  % Subtype TCC generated (at line 218, column 79) for  inverse(n)(T(n, n)(A))
      % expected type  Map_linear(n, n)
  inv_TCC2: OBLIGATION
    FORALL (n: posnat, A: Matrix_inv(n)):
      (inverse(n)(T(n, n)(A))`dom = n AND inverse(n)(T(n, n)(A))`codom = n)
       AND linear_map_e?(n, n)(inverse(n)(T(n, n)(A)));


decl_type: tcc
theory: matrix_operator
library: linear_algebra
signature: nil
location: 560 0 567 999
body:
  % Subtype TCC generated (at line 218, column 72) for
      % L(n, n)(inverse(n)(T(n, n)(A)))
      % expected type  Matrix_inv(n)
  inv_TCC3: OBLIGATION
    FORALL (n: posnat, A: Matrix_inv(n)):
      square?(L(n, n)(inverse(n)(T(n, n)(A)))) AND
       squareMat?(n)(L(n, n)(inverse(n)(T(n, n)(A)))) AND
        bijective?(n)(T(n, n)(L(n, n)(inverse(n)(T(n, n)(A)))));


decl_type: tcc
theory: matrix_operator
library: linear_algebra
signature: nil
location: 569 0 574 999
body:
  % Subtype TCC generated (at line 232, column 24) for  M
      % expected type  Matrix_inv(n)
  iso_inv_TCC1: OBLIGATION
    FORALL (M: Square, n: posnat):
      bijective?(n)(T(n, n)(M)) AND squareMat?(n)(M) IMPLIES
       squareMat?(n)(M) AND bijective?(n)(T(n, n)(M));


decl_type: tcc
theory: matrix_operator
library: linear_algebra
signature: nil
location: 576 0 581 999
body:
  % Subtype TCC generated (at line 232, column 27) for  M
      % expected type  {N: Matrix | inv(n)(M)`cols = N`rows}
  iso_inv_TCC2: OBLIGATION
    FORALL (M: Square, n: posnat):
      bijective?(n)(T(n, n)(M)) AND squareMat?(n)(M) IMPLIES
       inv(n)(M)`cols = M`rows;


decl_type: tcc
theory: matrix_operator
library: linear_algebra
signature: nil
location: 583 0 588 999
body:
  % Subtype TCC generated (at line 232, column 43) for  inv(n)(M)
      % expected type  {N: Matrix | M`cols = N`rows}
  iso_inv_TCC3: OBLIGATION
    FORALL (M: Square, n: posnat):
      bijective?(n)(T(n, n)(M)) AND squareMat?(n)(M) AND inv(n)(M) * M = I(n)
       IMPLIES M`cols = inv(n)(M)`rows;


decl_type: tcc
theory: matrix_operator
library: linear_algebra
signature: nil
location: 590 0 595 999
body:
  % Subtype TCC generated (at line 243, column 34) for  inv(n)(M)
      % expected type  {N: Square | N`rows = M`rows}
  inv_TCC4: OBLIGATION
    FORALL (M: Square, n: posnat):
      bijective?(n)(T(n, n)(M)) AND squareMat?(n)(M) IMPLIES
       inv(n)(M)`rows = M`rows;


decl_type: tcc
theory: matrix_operator
library: linear_algebra
signature: nil
location: 597 0 603 999
body:
  % Subtype TCC generated (at line 251, column 41) for  M
      % expected type  {N: Matrix | A`cols = N`rows}
  bijec_prod_TCC1: OBLIGATION
    FORALL (A: Matrix, M: Square, n: posnat):
           bijective?(n)(T(n, n)(M)) AND squareMat?(n)(M) AND square?(M)
       AND bijective?(n)(T(n, n)(A)) AND squareMat?(n)(A) AND square?(A)
       IMPLIES A`cols = M`rows;


decl_type: tcc
theory: matrix_operator
library: linear_algebra
signature: nil
location: 605 0 611 999
body:
  % Subtype TCC generated (at line 251, column 39) for  A * M
      % expected type  Mat(n, n)
  bijec_prod_TCC2: OBLIGATION
    FORALL (A: Matrix, M: Square, n: posnat):
           bijective?(n)(T(n, n)(M)) AND squareMat?(n)(M) AND square?(M)
       AND bijective?(n)(T(n, n)(A)) AND squareMat?(n)(A) AND square?(A)
       IMPLIES (A * M)`rows = n AND (A * M)`cols = n;


decl_type: tcc
theory: matrix_operator
library: linear_algebra
signature: nil
location: 613 0 617 999
body:
  % Subtype TCC generated (at line 258, column 85) for  inv(n)(A)
      % expected type  Mat(n, n)
  map_matrix_bij_inv_TCC1: OBLIGATION
    FORALL (n: posnat, A: Matrix_inv(n)):
      inv(n)(A)`rows = n AND inv(n)(A)`cols = n;


decl_type: tcc
theory: matrix_operator
library: linear_algebra
signature: nil
location: 619 0 624 999
body:
  % Subtype TCC generated (at line 265, column 51) for  A
      % expected type  Matrix_inv(n)
  tran_inv_TCC1: OBLIGATION
    FORALL (A: Matrix, n: posnat):
      bijective?(n)(T(n, n)(A)) AND squareMat?(n)(A) AND square?(A) IMPLIES
       squareMat?(n)(A) AND bijective?(n)(T(n, n)(A));


decl_type: tcc
theory: matrix_operator
library: linear_algebra
signature: nil
location: 626 0 632 999
body:
  % Subtype TCC generated (at line 265, column 34) for  transpose(inv(n)(A))
      % expected type  {N: Square | N`rows = transpose(A)`rows}
  tran_inv_TCC2: OBLIGATION
    FORALL (A: Matrix, n: posnat):
      bijective?(n)(T(n, n)(A)) AND squareMat?(n)(A) AND square?(A) IMPLIES
       square?(transpose(inv(n)(A))) AND
        transpose(inv(n)(A))`rows = transpose(A)`rows;


decl_type: tcc
theory: matrix_operator
library: linear_algebra
signature: nil
location: 634 0 639 999
body:
  % Subtype TCC generated (at line 265, column 20) for  transpose(A)
      % expected type  M: Square
  tran_inv_TCC3: OBLIGATION
    FORALL (A: Matrix, n: posnat):
      bijective?(n)(T(n, n)(A)) AND squareMat?(n)(A) AND square?(A) IMPLIES
       square?(transpose(A));


decl_type: tcc
theory: matrix_operator
library: linear_algebra
signature: nil
location: 641 0 646 999
body:
  % Subtype TCC generated (at line 276, column 44) for  transpose(A)
      % expected type  Mat(n, n)
  bijec_transpose_TCC1: OBLIGATION
    FORALL (A: Matrix, n: posnat):
      bijective?(n)(T(n, n)(A)) AND squareMat?(n)(A) AND square?(A) IMPLIES
       transpose(A)`rows = n AND transpose(A)`cols = n;


decl_type: tcc
theory: matrix_operator
library: linear_algebra
signature: nil
location: 648 0 654 999
body:
  % Subtype TCC generated (at line 281, column 23) for  transpose(A)
      % expected type  Matrix_inv(n)
  tran_inv_oper_TCC1: OBLIGATION
    FORALL (A: Matrix, n: posnat):
      bijective?(n)(T(n, n)(A)) AND squareMat?(n)(A) AND square?(A) IMPLIES
       square?(transpose(A)) AND
        squareMat?(n)(transpose(A)) AND bijective?(n)(T(n, n)(transpose(A)));


decl_type: tcc
theory: matrix_operator
library: linear_algebra
signature: nil
location: 656 0 662 999
body:
  % Subtype TCC generated (at line 290, column 72) for  B
      % expected type  Mat(n, n)
  prod_inv_TCC1: OBLIGATION
    FORALL (A, B: Matrix, n: posnat):
           square?(A) AND squareMat?(n)(A) AND bijective?(n)(T(n, n)(A))
       AND square?(B) AND squareMat?(n)(B)
       IMPLIES B`rows = n AND B`cols = n;


decl_type: tcc
theory: matrix_operator
library: linear_algebra
signature: nil
location: 664 0 670 999
body:
  % Subtype TCC generated (at line 292, column 36) for  B
      % expected type  Matrix_inv(n)
  prod_inv_TCC2: OBLIGATION
    FORALL (A, B: Matrix, n: posnat):
           bijective?(n)(T(n, n)(B)) AND squareMat?(n)(B) AND square?(B)
       AND bijective?(n)(T(n, n)(A)) AND squareMat?(n)(A) AND square?(A)
       IMPLIES squareMat?(n)(B) AND bijective?(n)(T(n, n)(B));


decl_type: tcc
theory: matrix_operator
library: linear_algebra
signature: nil
location: 672 0 678 999
body:
  % Subtype TCC generated (at line 292, column 39) for  inv(n)(A)
      % expected type  {N: Matrix | inv(n)(B)`cols = N`rows}
  prod_inv_TCC3: OBLIGATION
    FORALL (A, B: Matrix, n: posnat):
           bijective?(n)(T(n, n)(B)) AND squareMat?(n)(B) AND square?(B)
       AND bijective?(n)(T(n, n)(A)) AND squareMat?(n)(A) AND square?(A)
       IMPLIES inv(n)(B)`cols = inv(n)(A)`rows;


decl_type: tcc
theory: matrix_operator
library: linear_algebra
signature: nil
location: 680 0 688 999
body:
  % Subtype TCC generated (at line 292, column 29) for  inv(n)(B) * inv(n)(A)
      % expected type  {N: Square | N`rows = (A * B)`rows}
  prod_inv_TCC4: OBLIGATION
    FORALL (A, B: Matrix, n: posnat):
           bijective?(n)(T(n, n)(B)) AND squareMat?(n)(B) AND square?(B)
       AND bijective?(n)(T(n, n)(A)) AND squareMat?(n)(A) AND square?(A)
       IMPLIES
       square?(inv(n)(B) * inv(n)(A)) AND
        (inv(n)(B) * inv(n)(A))`rows = (A * B)`rows;


decl_type: tcc
theory: matrix_operator
library: linear_algebra
signature: nil
location: 690 0 696 999
body:
  % Subtype TCC generated (at line 292, column 26) for  B
      % expected type  {N: Matrix | A`cols = N`rows}
  prod_inv_TCC5: OBLIGATION
    FORALL (A, B: Matrix, n: posnat):
           bijective?(n)(T(n, n)(B)) AND squareMat?(n)(B) AND square?(B)
       AND bijective?(n)(T(n, n)(A)) AND squareMat?(n)(A) AND square?(A)
       IMPLIES A`cols = B`rows;


decl_type: tcc
theory: matrix_operator
library: linear_algebra
signature: nil
location: 698 0 704 999
body:
  % Subtype TCC generated (at line 292, column 24) for  A * B
      % expected type  M: Square
  prod_inv_TCC6: OBLIGATION
    FORALL (A, B: Matrix, n: posnat):
           bijective?(n)(T(n, n)(B)) AND squareMat?(n)(B) AND square?(B)
       AND bijective?(n)(T(n, n)(A)) AND squareMat?(n)(A) AND square?(A)
       IMPLIES square?(A * B);


decl_type: tcc
theory: matrix_operator
library: linear_algebra
signature: nil
location: 706 0 714 999
body:
  % Subtype TCC generated (at line 298, column 22) for  A * B
      % expected type  Matrix_inv(n)
  prod_inv_oper_TCC1: OBLIGATION
    FORALL (A, B: Matrix, n: posnat):
           bijective?(n)(T(n, n)(B)) AND squareMat?(n)(B) AND square?(B)
       AND bijective?(n)(T(n, n)(A)) AND squareMat?(n)(A) AND square?(A)
       IMPLIES
       square?(A * B) AND
        squareMat?(n)(A * B) AND bijective?(n)(T(n, n)(A * B));


decl_type: tcc
theory: matrix_operator
library: linear_algebra
signature: nil
location: 716 0 721 999
body:
  % Subtype TCC generated (at line 306, column 20) for  x
      % expected type  Vector[M`cols]
  equa_sol_TCC1: OBLIGATION
    FORALL (M: Square, n: posnat):
      squareMat?(n)(M) AND square?(M) IMPLIES
       (FORALL (x2: nat): x2 < n IFF x2 < M`cols);


decl_type: tcc
theory: matrix_operator
library: linear_algebra
signature: nil
location: 723 0 728 999
body:
  % Subtype TCC generated (at line 306, column 22) for  b
      % expected type  Vector[M`rows]
  equa_sol_TCC2: OBLIGATION
    FORALL (M: Square, n: posnat):
      squareMat?(n)(M) AND square?(M) IMPLIES
       (FORALL (x2: nat): x2 < n IFF x2 < M`rows);


decl_type: tcc
theory: matrix_operator
library: linear_algebra
signature: nil
location: 730 0 735 999
body:
  % Subtype TCC generated (at line 306, column 18) for  M * x + b
      % expected type  Vector[n]
  equa_sol_TCC3: OBLIGATION
    FORALL (M: Square, n: posnat):
      squareMat?(n)(M) AND square?(M) IMPLIES
       (FORALL (x2: nat): x2 < M`rows IFF x2 < n);


decl_type: tcc
theory: matrix_operator
library: linear_algebra
signature: nil
location: 737 0 743 999
body:
  % Subtype TCC generated (at line 309, column 29) for  (y - b)
      % expected type  Vector[inv(n)(M)`cols]
  equa_sol_TCC4: OBLIGATION
    FORALL (M: Square, n: posnat, x, y, b: Vector[n]):
      square?(M) AND
       squareMat?(n)(M) AND y = M * x + b AND bijective?(n)(T(n, n)(M))
       IMPLIES (FORALL (x2: nat): x2 < n IFF x2 < inv(n)(M)`cols);


decl_type: tcc
theory: matrix_operator
library: linear_algebra
signature: nil
location: 745 0 751 999
body:
  % Subtype TCC generated (at line 309, column 18) for  inv(n)(M) * (y - b)
      % expected type  Vector[n]
  equa_sol_TCC5: OBLIGATION
    FORALL (M: Square, n: posnat, x, y, b: Vector[n]):
      square?(M) AND
       squareMat?(n)(M) AND y = M * x + b AND bijective?(n)(T(n, n)(M))
       IMPLIES (FORALL (x2: nat): x2 < inv(n)(M)`rows IFF x2 < n);


decl_type: formula
theory: matrix_lemmas
library: linear_algebra
signature: nil
location: 60 1 60 127
body:
   product_rows2: LEMMA FORALL (A: Matrix,(B: Matrix | B`rows = A`cols),(C: Matrix | C`rows = B`cols)): (A * B * C)`rows = A`rows


decl_type: formula
theory: matrix_lemmas
library: linear_algebra
signature: nil
location: 62 1 62 127
body:
   product_cols2: LEMMA FORALL (A: Matrix,(B: Matrix | B`rows = A`cols),(C: Matrix | C`rows = B`cols)): (A * B * C)`cols = C`cols


decl_type: formula
theory: matrix_lemmas
library: linear_algebra
signature: nil
location: 66 1 66 161
body:
   product_rows3: LEMMA FORALL (A: Matrix,(B: Matrix | B`rows = A`cols),(C: Matrix | C`rows = B`cols),(D: Matrix | D`rows = C`cols)): (A * B * C * D)`rows = A`rows


decl_type: formula
theory: matrix_lemmas
library: linear_algebra
signature: nil
location: 68 1 68 161
body:
   product_cols3: LEMMA FORALL (A: Matrix,(B: Matrix | B`rows = A`cols),(C: Matrix | C`rows = B`cols),(D: Matrix | D`rows = C`cols)): (A * B * C * D)`cols = D`cols


decl_type: formula
theory: matrix_lemmas
library: linear_algebra
signature: nil
location: 72 1 72 195
body:
   product_rows4: LEMMA FORALL (A: Matrix,(B: Matrix | B`rows = A`cols),(C: Matrix | C`rows = B`cols),(D: Matrix | D`rows = C`cols),(E: Matrix | E`rows = D`cols)): (A * B * C * D * E)`rows = A`rows


decl_type: formula
theory: matrix_lemmas
library: linear_algebra
signature: nil
location: 74 1 74 195
body:
   product_cols4: LEMMA FORALL (A: Matrix,(B: Matrix | B`rows = A`cols),(C: Matrix | C`rows = B`cols),(D: Matrix | D`rows = C`cols),(E: Matrix | E`rows = D`cols)): (A * B * C * D * E)`cols = E`cols


decl_type: formula
theory: matrix_lemmas
library: linear_algebra
signature: nil
location: 118 1 119 61
body:
   transp_inv: LEMMA FORALL (M: (invertible?)):
                  transpose(inverse(M))=inverse((transpose(M)))


decl_type: formula
theory: matrix_lemmas
library: linear_algebra
signature: nil
location: 127 1 128 29
body:
   invar_inverse: LEMMA FORALL (A: Matrix, (N: (invertible?) | A`cols = N`rows)):
       A * (inverse(N) * N) = A


decl_type: formula
theory: matrix_lemmas
library: linear_algebra
signature: nil
location: 130 1 131 29
body:
   invar_inverse_left: LEMMA FORALL (B: Matrix, (N: (invertible?) | B`rows = N`cols)):
       N * (inverse(N)) * B = B


decl_type: formula
theory: matrix_lemmas
library: linear_algebra
signature: nil
location: 135 1 136 51
body:
   simply1_mat_vect: LEMMA FORALL (A: Matrix, (N: (invertible?) | A`cols = N`rows), y: Vector[A`rows], x: Vector[A`cols]):
       y * ((A * (inverse(N) * N)) * x) = y * (A * x)


decl_type: formula
theory: matrix_lemmas
library: linear_algebra
signature: nil
location: 138 1 139 49
body:
   simply2_mat_vect: LEMMA FORALL (B: Matrix, (N: (invertible?) | B`rows = N`rows), y: Vector[B`rows], x: Vector[B`cols]):
       y * (N * (inverse(N)) * B * x) = y * (B * x)


decl_type: formula
theory: matrix_lemmas
library: linear_algebra
signature: nil
location: 147 1 148 31
body:
   distr_mat_vect: LEMMA FORALL (A: Matrix, (B: (same_dim?(A))), y: Vector[A`cols]):
      (A + B) * y = A * y + B * y


decl_type: formula
theory: matrix_lemmas
library: linear_algebra
signature: nil
location: 169 1 170 49
body:
   distr_esc_add: LEMMA FORALL (A: Matrix, (B: (same_dim?(A))), x:Vector[A`rows], y:Vector[A`cols]):
      x * ((A + B) * y) = x * (A * y) + x * (B * y)


decl_type: formula
theory: matrix_lemmas
library: linear_algebra
signature: nil
location: 172 1 173 49
body:
   distr_esc_dif: LEMMA FORALL (A: Matrix, (B: (same_dim?(A))), x:Vector[A`rows], y:Vector[A`cols]):
      x * ((A - B) * y) = x * (A * y) - x * (B * y)


decl_type: formula
theory: matrix_lemmas
library: linear_algebra
signature: nil
location: 175 1 176 84
body:
   distr_add_esc: LEMMA FORALL (A: (square?), x:Vector[A`cols], y:Vector[A`cols]):
      (x + y) * (A  * (x + y)) = x * (A * x) + x * (A * y) + y * (A * x) + y * (A * y)


decl_type: formula
theory: matrix_lemmas
library: linear_algebra
signature: nil
location: 184 1 185 48
body:
   conv_prod_int:  LEMMA FORALL (B: Matrix, (A: Matrix | B`cols = A`rows), (C: Matrix | A`cols = C`rows),  x: Vector[B`rows], y: Vector[C`cols]):
      x*((B*(A*C))*y) = (transpose(B)*x)*(A*(C*y)) 


decl_type: tcc
theory: matrix_lemmas
library: linear_algebra
signature: nil
location: 193 0 196 999
body:
  % Subtype TCC generated (at line 54, column 76) for  B
      % expected type  {N: Matrix | A`cols = N`rows}
  product_rows_TCC1: OBLIGATION
    FORALL (A: Matrix, (B: Matrix | B`rows = A`cols)): A`cols = B`rows;


decl_type: tcc
theory: matrix_lemmas
library: linear_algebra
signature: nil
location: 198 0 203 999
body:
  % Subtype TCC generated (at line 60, column 111) for  C
      % expected type  {N: Matrix | (A * B)`cols = N`rows}
  product_rows2_TCC1: OBLIGATION
    FORALL (A: Matrix, (B: Matrix | B`rows = A`cols),
            (C: Matrix | C`rows = B`cols)):
      (A * B)`cols = C`rows;


decl_type: tcc
theory: matrix_lemmas
library: linear_algebra
signature: nil
location: 205 0 210 999
body:
  % Subtype TCC generated (at line 66, column 145) for  D
      % expected type  {N: Matrix | (A * B * C)`cols = N`rows}
  product_rows3_TCC1: OBLIGATION
    FORALL (A: Matrix, (B: Matrix | B`rows = A`cols),
            (C: Matrix | C`rows = B`cols), (D: Matrix | D`rows = C`cols)):
      (A * B * C)`cols = D`rows;


decl_type: tcc
theory: matrix_lemmas
library: linear_algebra
signature: nil
location: 212 0 218 999
body:
  % Subtype TCC generated (at line 72, column 179) for  E
      % expected type  {N: Matrix | (A * B * C * D)`cols = N`rows}
  product_rows4_TCC1: OBLIGATION
    FORALL (A: Matrix, (B: Matrix | B`rows = A`cols),
            (C: Matrix | C`rows = B`cols), (D: Matrix | D`rows = C`cols),
            (E: Matrix | E`rows = D`cols)):
      (A * B * C * D)`cols = E`rows;


decl_type: tcc
theory: matrix_lemmas
library: linear_algebra
signature: nil
location: 220 0 223 999
body:
  % Subtype TCC generated (at line 82, column 62) for  N
      % expected type  {N_1: Matrix | inverse(N)`cols = N_1`rows}
  inverse_ident_TCC1: OBLIGATION
    FORALL (N: (invertible?)): inverse(N)`cols = N`rows;


decl_type: tcc
theory: matrix_lemmas
library: linear_algebra
signature: nil
location: 225 0 228 999
body:
  % Subtype TCC generated (at line 84, column 54) for  (inverse(N))
      % expected type  {N_1: Matrix | N`cols = N_1`rows}
  ident_inverse_TCC1: OBLIGATION
    FORALL (N: (invertible?)): N`cols = (inverse(N))`rows;


decl_type: tcc
theory: matrix_lemmas
library: linear_algebra
signature: nil
location: 230 0 233 999
body:
  % Subtype TCC generated (at line 92, column 73) for  x
      % expected type  Vector[matrices.I(n)`cols]
  ident_mat_prod_TCC1: OBLIGATION
    FORALL (n: posnat): FORALL (x2: nat): x2 < n IFF x2 < matrices.I(n)`cols;


decl_type: tcc
theory: matrix_lemmas
library: linear_algebra
signature: nil
location: 235 0 238 999
body:
  % Subtype TCC generated (at line 92, column 77) for  x
      % expected type  Vector[matrices.I(n)`rows]
  ident_mat_prod_TCC2: OBLIGATION
    FORALL (n: posnat): FORALL (x2: nat): x2 < n IFF x2 < matrices.I(n)`rows;


decl_type: tcc
theory: matrix_lemmas
library: linear_algebra
signature: nil
location: 240 0 244 999
body:
  % Subtype TCC generated (at line 119, column 47) for  (transpose(M))
      % expected type  M: (invertible?)
  transp_inv_TCC1: OBLIGATION
    FORALL (M: (invertible?)):
      square?((transpose(M))) AND invertible?((transpose(M)));


decl_type: tcc
theory: matrix_lemmas
library: linear_algebra
signature: nil
location: 246 0 250 999
body:
  % Subtype TCC generated (at line 128, column 10) for  (inverse(N) * N)
      % expected type  {N: Matrix | A`cols = N`rows}
  invar_inverse_TCC1: OBLIGATION
    FORALL (A: Matrix, (N: (invertible?) | A`cols = N`rows)):
      A`cols = (inverse(N) * N)`rows;


decl_type: tcc
theory: matrix_lemmas
library: linear_algebra
signature: nil
location: 252 0 256 999
body:
  % Subtype TCC generated (at line 131, column 24) for  B
      % expected type  {N_1: Matrix | (N * (inverse(N)))`cols = N_1`rows}
  invar_inverse_left_TCC1: OBLIGATION
    FORALL (B: Matrix, (N: (invertible?) | B`rows = N`cols)):
      (N * (inverse(N)))`cols = B`rows;


decl_type: tcc
theory: matrix_lemmas
library: linear_algebra
signature: nil
location: 258 0 262 999
body:
  % Subtype TCC generated (at line 136, column 35) for  x
      % expected type  Vector[(A * (inverse(N) * N))`cols]
  simply1_mat_vect_TCC1: OBLIGATION
    FORALL (A: Matrix, (N: (invertible?) | A`cols = N`rows)):
      FORALL (x2: nat): x2 < A`cols IFF x2 < (A * (inverse(N) * N))`cols;


decl_type: tcc
theory: matrix_lemmas
library: linear_algebra
signature: nil
location: 264 0 269 999
body:
  % Subtype TCC generated (at line 136, column 10) for
      % ((A * (inverse(N) * N)) * x)
      % expected type  Vector[A`rows]
  simply1_mat_vect_TCC2: OBLIGATION
    FORALL (A: Matrix, (N: (invertible?) | A`cols = N`rows)):
      FORALL (x2: nat): x2 < (A * (inverse(N) * N))`rows IFF x2 < A`rows;


decl_type: tcc
theory: matrix_lemmas
library: linear_algebra
signature: nil
location: 271 0 275 999
body:
  % Subtype TCC generated (at line 139, column 29) for  B
      % expected type  {N_1: Matrix | (N * (inverse(N)))`cols = N_1`rows}
  simply2_mat_vect_TCC1: OBLIGATION
    FORALL (B: Matrix, (N: (invertible?) | B`rows = N`rows)):
      (N * (inverse(N)))`cols = B`rows;


decl_type: tcc
theory: matrix_lemmas
library: linear_algebra
signature: nil
location: 277 0 281 999
body:
  % Subtype TCC generated (at line 139, column 33) for  x
      % expected type  Vector[(N * (inverse(N)) * B)`cols]
  simply2_mat_vect_TCC2: OBLIGATION
    FORALL (B: Matrix, (N: (invertible?) | B`rows = N`rows)):
      FORALL (x2: nat): x2 < B`cols IFF x2 < (N * (inverse(N)) * B)`cols;


decl_type: tcc
theory: matrix_lemmas
library: linear_algebra
signature: nil
location: 283 0 288 999
body:
  % Subtype TCC generated (at line 139, column 10) for
      % (N * (inverse(N)) * B * x)
      % expected type  Vector[B`rows]
  simply2_mat_vect_TCC3: OBLIGATION
    FORALL (B: Matrix, (N: (invertible?) | B`rows = N`rows)):
      FORALL (x2: nat): x2 < (N * (inverse(N)) * B)`rows IFF x2 < B`rows;


decl_type: tcc
theory: matrix_lemmas
library: linear_algebra
signature: nil
location: 290 0 295 999
body:
  % Subtype TCC generated (at line 148, column 14) for  y
      % expected type  Vector[(A + B)`cols]
  distr_mat_vect_TCC1: OBLIGATION
    FORALL (A: Matrix,
            (B: (LAMBDA (N): A`rows = N`rows AND A`cols = N`cols))):
      FORALL (x: nat): x < A`cols IFF x < (A + B)`cols;


decl_type: tcc
theory: matrix_lemmas
library: linear_algebra
signature: nil
location: 297 0 302 999
body:
  % Subtype TCC generated (at line 148, column 30) for  y
      % expected type  Vector[B`cols]
  distr_mat_vect_TCC2: OBLIGATION
    FORALL (A: Matrix,
            (B: (LAMBDA (N): A`rows = N`rows AND A`cols = N`cols))):
      FORALL (x: nat): x < A`cols IFF x < B`cols;


decl_type: tcc
theory: matrix_lemmas
library: linear_algebra
signature: nil
location: 304 0 309 999
body:
  % Subtype TCC generated (at line 148, column 26) for  B * y
      % expected type  Vector[A`rows]
  distr_mat_vect_TCC3: OBLIGATION
    FORALL (A: Matrix,
            (B: (LAMBDA (N): A`rows = N`rows AND A`cols = N`cols))):
      FORALL (x: nat): x < B`rows IFF x < A`rows;


decl_type: tcc
theory: matrix_lemmas
library: linear_algebra
signature: nil
location: 311 0 316 999
body:
  % Subtype TCC generated (at line 148, column 18) for  A * y + B * y
      % expected type  Vector[(A + B)`rows]
  distr_mat_vect_TCC4: OBLIGATION
    FORALL (A: Matrix,
            (B: (LAMBDA (N): A`rows = N`rows AND A`cols = N`cols))):
      FORALL (x: nat): x < A`rows IFF x < (A + B)`rows;


decl_type: tcc
theory: matrix_lemmas
library: linear_algebra
signature: nil
location: 318 0 323 999
body:
  % Subtype TCC generated (at line 159, column 79) for  (-B)
      % expected type  (LAMBDA (N): A`rows = N`rows AND A`cols = N`cols)
  matrix_sum_minus_TCC1: OBLIGATION
    FORALL (A: Matrix,
            (B: (LAMBDA (N): A`rows = N`rows AND A`cols = N`cols))):
      A`rows = (-B)`rows AND A`cols = (-B)`cols;


decl_type: tcc
theory: matrix_lemmas
library: linear_algebra
signature: nil
location: 325 0 328 999
body:
  % Subtype TCC generated (at line 161, column 83) for  x
      % expected type  Vector[(-A)`cols]
  matrix_prod_minus_TCC1: OBLIGATION
    FORALL (A: Matrix): FORALL (x2: nat): x2 < A`cols IFF x2 < (-A)`cols;


decl_type: tcc
theory: matrix_lemmas
library: linear_algebra
signature: nil
location: 330 0 333 999
body:
  % Subtype TCC generated (at line 161, column 76) for  (-A) * x
      % expected type  Vector[A`rows]
  matrix_prod_minus_TCC2: OBLIGATION
    FORALL (A: Matrix): FORALL (x2: nat): x2 < (-A)`rows IFF x2 < A`rows;


decl_type: tcc
theory: matrix_lemmas
library: linear_algebra
signature: nil
location: 335 0 340 999
body:
  % Subtype TCC generated (at line 170, column 9) for  ((A + B) * y)
      % expected type  Vector[A`rows]
  distr_esc_add_TCC1: OBLIGATION
    FORALL (A: Matrix,
            (B: (LAMBDA (N): A`rows = N`rows AND A`cols = N`cols))):
      FORALL (x2: nat): x2 < (A + B)`rows IFF x2 < A`rows;


decl_type: tcc
theory: matrix_lemmas
library: linear_algebra
signature: nil
location: 342 0 347 999
body:
  % Subtype TCC generated (at line 173, column 19) for  y
      % expected type  Vector[(A - B)`cols]
  distr_esc_dif_TCC1: OBLIGATION
    FORALL (A: Matrix,
            (B: (LAMBDA (N): A`rows = N`rows AND A`cols = N`cols))):
      FORALL (x2: nat): x2 < A`cols IFF x2 < (A - B)`cols;


decl_type: tcc
theory: matrix_lemmas
library: linear_algebra
signature: nil
location: 349 0 354 999
body:
  % Subtype TCC generated (at line 173, column 9) for  ((A - B) * y)
      % expected type  Vector[A`rows]
  distr_esc_dif_TCC2: OBLIGATION
    FORALL (A: Matrix,
            (B: (LAMBDA (N): A`rows = N`rows AND A`cols = N`cols))):
      FORALL (x2: nat): x2 < (A - B)`rows IFF x2 < A`rows;


decl_type: tcc
theory: matrix_lemmas
library: linear_algebra
signature: nil
location: 356 0 359 999
body:
  % Subtype TCC generated (at line 176, column 15) for  (A * (x + y))
      % expected type  Vector[A`cols]
  distr_add_esc_TCC1: OBLIGATION
    FORALL (A: (square?)): FORALL (x2: nat): x2 < A`rows IFF x2 < A`cols;


decl_type: tcc
theory: matrix_lemmas
library: linear_algebra
signature: nil
location: 361 0 366 999
body:
  % Subtype TCC generated (at line 185, column 11) for  (A * C)
      % expected type  {N: Matrix | B`cols = N`rows}
  conv_prod_int_TCC1: OBLIGATION
    FORALL (B: Matrix, (A: Matrix | B`cols = A`rows),
            (C: Matrix | A`cols = C`rows)):
      B`cols = (A * C)`rows;


decl_type: tcc
theory: matrix_lemmas
library: linear_algebra
signature: nil
location: 368 0 373 999
body:
  % Subtype TCC generated (at line 185, column 17) for  y
      % expected type  Vector[(B * (A * C))`cols]
  conv_prod_int_TCC2: OBLIGATION
    FORALL (B: Matrix, (A: Matrix | B`cols = A`rows),
            (C: Matrix | A`cols = C`rows)):
      FORALL (x2: nat): x2 < C`cols IFF x2 < (B * (A * C))`cols;


decl_type: tcc
theory: matrix_lemmas
library: linear_algebra
signature: nil
location: 375 0 380 999
body:
  % Subtype TCC generated (at line 185, column 7) for  ((B * (A * C)) * y)
      % expected type  Vector[B`rows]
  conv_prod_int_TCC3: OBLIGATION
    FORALL (B: Matrix, (A: Matrix | B`cols = A`rows),
            (C: Matrix | A`cols = C`rows)):
      FORALL (x2: nat): x2 < (B * (A * C))`rows IFF x2 < B`rows;


decl_type: tcc
theory: matrix_lemmas
library: linear_algebra
signature: nil
location: 382 0 387 999
body:
  % Subtype TCC generated (at line 185, column 36) for  x
      % expected type  Vector[transpose(B)`cols]
  conv_prod_int_TCC4: OBLIGATION
    FORALL (B: Matrix, (A: Matrix | B`cols = A`rows),
            (C: Matrix | A`cols = C`rows)):
      FORALL (x2: nat): x2 < B`rows IFF x2 < transpose(B)`cols;


decl_type: tcc
theory: matrix_lemmas
library: linear_algebra
signature: nil
location: 389 0 394 999
body:
  % Subtype TCC generated (at line 185, column 43) for  (C * y)
      % expected type  Vector[A`cols]
  conv_prod_int_TCC5: OBLIGATION
    FORALL (B: Matrix, (A: Matrix | B`cols = A`rows),
            (C: Matrix | A`cols = C`rows)):
      FORALL (x2: nat): x2 < C`rows IFF x2 < A`cols;


decl_type: tcc
theory: matrix_lemmas
library: linear_algebra
signature: nil
location: 396 0 401 999
body:
  % Subtype TCC generated (at line 185, column 40) for  (A * (C * y))
      % expected type  Vector[transpose(B)`rows]
  conv_prod_int_TCC6: OBLIGATION
    FORALL (B: Matrix, (A: Matrix | B`cols = A`rows),
            (C: Matrix | A`cols = C`rows)):
      FORALL (x2: nat): x2 < A`rows IFF x2 < transpose(B)`rows;


decl_type: tcc
theory: ln_exp
library: lnexp
signature: nil
location: 116 0 119 999
body:
  % Subtype TCC generated (at line 38, column 32) for  i
      % expected type  {i: int | px /= 0 OR i >= 0}
  ln_expt_TCC1: OBLIGATION
    FORALL (i: integer, px: posreal): px /= 0 OR i >= 0;


decl_type: tcc
theory: ln_exp
library: lnexp
signature: nil
location: 121 0 123 999
body:
  % Existence TCC generated (at line 56, column 3) for
      % exp(x): {py | x = ln(py)}
  exp_TCC1: OBLIGATION EXISTS (x1: [x: real -> {py | x = ln(py)}]): TRUE;


decl_type: tcc
theory: ln_exp
library: lnexp
signature: nil
location: 125 0 127 999
body:
  % Subtype TCC generated (at line 72, column 37) for  i
      % expected type  {i: int | e /= 0 OR i >= 0}
  exp_int_TCC1: OBLIGATION FORALL (i: integer): e /= 0 OR i >= 0;


decl_type: tcc
theory: ln_exp
library: lnexp
signature: nil
location: 129 0 132 999
body:
  % Subtype TCC generated (at line 78, column 44) for  i
      % expected type  {i: int | exp(x) /= 0 OR i >= 0}
  exp_scal_TCC1: OBLIGATION
    FORALL (i: integer, x: real): exp(x) /= 0 OR i >= 0;


decl_type: tcc
theory: ln_exp
library: lnexp
signature: nil
location: 134 0 137 999
body:
  % Subtype TCC generated (at line 86, column 42) for  i
      % expected type  {i: int | x /= 0 OR i >= 0}
  expt_alt_def_TCC1: OBLIGATION
    FORALL (i: integer, x: real): x > 0 IMPLIES x /= 0 OR i >= 0;


decl_type: tcc
theory: ln_exp
library: lnexp
signature: nil
location: 139 0 141 999
body:
  % Subtype TCC generated (at line 86, column 55) for  x
      % expected type  posreal
  expt_alt_def_TCC2: OBLIGATION FORALL (x: real): x > 0 IMPLIES x >= 0;


decl_type: formula
theory: ln_exp_series_alt
library: lnexp
signature: nil
location: 43 3 44 69
body:
     ln_estimate_scaf4: LEMMA x /= 1 IMPLIES
             1/(1-x) = sigma(0,n,(LAMBDA (i:nat): x^i)) + x^(n+1)/(1-x)


decl_type: formula
theory: ln_exp_series_alt
library: lnexp
signature: nil
location: 46 3 47 77
body:
     ln_estimate_scaf5: LEMMA
             1/nzx = sigma(0,n,(LAMBDA (i:nat): (1-nzx)^i)) + (1-nzx)^(n+1)/nzx


decl_type: formula
theory: ln_exp_series_alt
library: lnexp
signature: nil
location: 70 3 71 73
body:
     ln_estimate_bnd: AXIOM abs(ln(1+z) - ln_estimate(z,n)) <=
                        abs(z)^(n+1)/(IF z < 0 THEN 1+z ELSE 1 ENDIF*(n+1))


decl_type: formula
theory: ln_exp_series_alt
library: lnexp
signature: nil
location: 81 3 82 76
body:
     ln_taylors:     AXIOM EXISTS (c: between[{x:real | x > -1}](1,1+xgm1)):
                       ln(xgm1+1) = ln_estimate(xgm1,n) -(xgm1/-c)^(n+1)/(n+1)


decl_type: formula
theory: ln_exp_series_alt
library: lnexp
signature: nil
location: 93 3 94 79
body:
     exp_taylors:     AXIOM EXISTS (c:between[real](0,x)):
                       exp(x) = exp_estimate(x,n) + exp(c)*x^(n+1)/factorial(n+1)


decl_type: formula
theory: ln_exp_series_alt
library: lnexp
signature: nil
location: 96 3 97 76
body:
     exp_estimate_bnd:  LEMMA abs(exp(x)-exp_estimate(x,n)) 
                                  <= max(exp(x),1)*abs(x)^(n+1)/factorial(n+1)


decl_type: function
theory: ln_exp_series_alt
library: lnexp
signature: [[real, nat] -> real]
location: 32 3 33 78
body:
     ln_estimate(x:real,n:nat):real
           = sigma(0,n,(LAMBDA (nn:nat): IF nn=0 THEN 0 ELSE -(-x)^nn/nn ENDIF))


decl_type: tcc
theory: ln_exp_series_alt
library: lnexp
signature: nil
location: 114 0 117 999
body:
  % Subtype TCC generated (at line 33, column 19) for  n
      % expected type  T_high[nat]
  ln_estimate_TCC1: OBLIGATION
    FORALL (n: nat): n >= 0 OR (EXISTS (j: nat): n <= j);


decl_type: tcc
theory: ln_exp_series_alt
library: lnexp
signature: nil
location: 119 0 122 999
body:
  % Subtype TCC generated (at line 33, column 65) for  nn
      % expected type  {i: int | (-x) /= 0 OR i >= 0}
  ln_estimate_TCC2: OBLIGATION
    FORALL (x: real, nn: nat): NOT nn = 0 IMPLIES (-x) /= 0 OR nn >= 0;


decl_type: tcc
theory: ln_exp_series_alt
library: lnexp
signature: nil
location: 124 0 126 999
body:
  % Subtype TCC generated (at line 33, column 68) for  nn
      % expected type  nznum
  ln_estimate_TCC3: OBLIGATION FORALL (nn: nat): NOT nn = 0 IMPLIES nn /= 0;


decl_type: tcc
theory: ln_exp_series_alt
library: lnexp
signature: nil
location: 128 0 131 999
body:
  % Subtype TCC generated (at line 44, column 14) for  (1 - x)
      % expected type  nznum
  ln_estimate_scaf4_TCC1: OBLIGATION
    FORALL (x: real): x /= 1 IMPLIES (1 - x) /= 0;


decl_type: tcc
theory: ln_exp_series_alt
library: lnexp
signature: nil
location: 133 0 136 999
body:
  % Subtype TCC generated (at line 44, column 50) for  i
      % expected type  {i: int | x /= 0 OR i >= 0}
  ln_estimate_scaf4_TCC2: OBLIGATION
    FORALL (x: real): x /= 1 IMPLIES (FORALL (i: nat): x /= 0 OR i >= 0);


decl_type: tcc
theory: ln_exp_series_alt
library: lnexp
signature: nil
location: 138 0 141 999
body:
  % Subtype TCC generated (at line 44, column 59) for  (n + 1)
      % expected type  {i: int | x /= 0 OR i >= 0}
  ln_estimate_scaf4_TCC3: OBLIGATION
    FORALL (n: nat, x: real): x /= 1 IMPLIES x /= 0 OR (n + 1) >= 0;


decl_type: tcc
theory: ln_exp_series_alt
library: lnexp
signature: nil
location: 143 0 146 999
body:
  % Subtype TCC generated (at line 47, column 54) for  i
      % expected type  {i: int | (1 - nzx) /= 0 OR i >= 0}
  ln_estimate_scaf5_TCC1: OBLIGATION
    FORALL (nzx: nzreal, i: nat): (1 - nzx) /= 0 OR i >= 0;


decl_type: tcc
theory: ln_exp_series_alt
library: lnexp
signature: nil
location: 148 0 151 999
body:
  % Subtype TCC generated (at line 47, column 69) for  (n + 1)
      % expected type  {i: int | (1 - nzx) /= 0 OR i >= 0}
  ln_estimate_scaf5_TCC2: OBLIGATION
    FORALL (n: nat, nzx: nzreal): (1 - nzx) /= 0 OR (n + 1) >= 0;


decl_type: tcc
theory: ln_exp_series_alt
library: lnexp
signature: nil
location: 153 0 156 999
body:
  % Subtype TCC generated (at line 70, column 33) for  1 + z
      % expected type  posreal
  ln_estimate_bnd_TCC1: OBLIGATION
    FORALL (z: real_gtm1_le1): 1 + z >= 0 AND 1 + z > 0;


decl_type: tcc
theory: ln_exp_series_alt
library: lnexp
signature: nil
location: 158 0 161 999
body:
  % Subtype TCC generated (at line 71, column 30) for  (n + 1)
      % expected type  {i: int | abs(z) /= 0 OR i >= 0}
  ln_estimate_bnd_TCC2: OBLIGATION
    FORALL (n: nat, z: real_gtm1_le1): abs(z) /= 0 OR (n + 1) >= 0;


decl_type: tcc
theory: ln_exp_series_alt
library: lnexp
signature: nil
location: 163 0 168 999
body:
  % Subtype TCC generated (at line 71, column 36) for
      % (IF z < 0 THEN 1 + z ELSE 1 ENDIF * (n + 1))
      % expected type  nznum
  ln_estimate_bnd_TCC3: OBLIGATION
    FORALL (n: nat, z: real_gtm1_le1):
      (IF z < 0 THEN 1 + z ELSE 1 ENDIF * (n + 1)) /= 0;


decl_type: tcc
theory: ln_exp_series_alt
library: lnexp
signature: nil
location: 170 0 173 999
body:
  % Subtype TCC generated (at line 73, column 54) for  (n + 1)
      % expected type  {i: int | (-x) /= 0 OR i >= 0}
  lnT_TCC1: OBLIGATION
    FORALL (x: real_gtm1_le1, n: nat): (-x) /= 0 OR (n + 1) >= 0;


decl_type: tcc
theory: ln_exp_series_alt
library: lnexp
signature: nil
location: 175 0 180 999
body:
  % Subtype TCC generated (at line 73, column 47) for
      % -(-x) ^ (n + 1) / (n + 1)
      % expected type  real_gtm1_le1
  lnT_TCC2: OBLIGATION
    FORALL (x: real_gtm1_le1, n: nat):
      -1 < -(-x) ^ (n + 1) / (n + 1) AND -(-x) ^ (n + 1) / (n + 1) <= 1;


decl_type: tcc
theory: ln_exp_series_alt
library: lnexp
signature: nil
location: 182 0 187 999
body:
  % Subtype TCC generated (at line 82, column 24) for  xgm1 + 1
      % expected type  posreal
  ln_taylors_TCC1: OBLIGATION
    FORALL (xgm1: {x: real | x > -1},
            c: between[{x: real | x > -1}](1, 1 + xgm1)):
      xgm1 + 1 >= 0 AND xgm1 + 1 > 0;


decl_type: tcc
theory: ln_exp_series_alt
library: lnexp
signature: nil
location: 189 0 194 999
body:
  % Subtype TCC generated (at line 82, column 61) for  -c
      % expected type  nznum
  ln_taylors_TCC2: OBLIGATION
    FORALL (xgm1: {x: real | x > -1},
            c: between[{x: real | x > -1}](1, 1 + xgm1)):
      -c /= 0;


decl_type: tcc
theory: ln_exp_series_alt
library: lnexp
signature: nil
location: 196 0 201 999
body:
  % Subtype TCC generated (at line 82, column 66) for  (n + 1)
      % expected type  {i: int | (xgm1 / -c) /= 0 OR i >= 0}
  ln_taylors_TCC3: OBLIGATION
    FORALL (n: nat, xgm1: {x: real | x > -1},
            c: between[{x: real | x > -1}](1, 1 + xgm1)):
      (xgm1 / -c) /= 0 OR (n + 1) >= 0;


decl_type: tcc
theory: ln_exp_series_alt
library: lnexp
signature: nil
location: 203 0 206 999
body:
  % Subtype TCC generated (at line 89, column 44) for  n
      % expected type  {i: int | x /= 0 OR i >= 0}
  expT_TCC1: OBLIGATION
    FORALL (x: real, n: nat): NOT n = 0 IMPLIES x /= 0 OR n >= 0;


decl_type: tcc
theory: ln_exp_series_alt
library: lnexp
signature: nil
location: 208 0 211 999
body:
  % Subtype TCC generated (at line 94, column 60) for  (n + 1)
      % expected type  {i: int | x /= 0 OR i >= 0}
  exp_taylors_TCC1: OBLIGATION
    FORALL (n: nat, x: real, c: between[real](0, x)): x /= 0 OR (n + 1) >= 0;


decl_type: tcc
theory: ln_exp_series_alt
library: lnexp
signature: nil
location: 213 0 216 999
body:
  % Subtype TCC generated (at line 97, column 57) for  (n + 1)
      % expected type  {i: int | abs(x) /= 0 OR i >= 0}
  exp_estimate_bnd_TCC1: OBLIGATION
    FORALL (n: nat, x: real): abs(x) /= 0 OR (n + 1) >= 0;


decl_type: formula
theory: ln_exp_ineq
library: lnexp
signature: nil
location: 28 2 29 38
body:
    ln_ineq1:  AXIOM xgtm1/(1+xgtm1) < ln(1+xgtm1) AND
                     ln(1+xgtm1) < xgtm1                                 % 4.1.33


decl_type: formula
theory: ln_exp_ineq
library: lnexp
signature: nil
location: 41 2 42 38
body:
    exp_ineq1: LEMMA exp(-xlt1/(1-xlt1)) < 1-xlt1 AND
                     1-xlt1 < exp(-xlt1)                                 % 4.2.29


decl_type: tcc
theory: ln_exp_ineq
library: lnexp
signature: nil
location: 53 0 55 999
body:
  % Subtype TCC generated (at line 28, column 26) for  (1 + xgtm1)
      % expected type  nznum
  ln_ineq1_TCC1: OBLIGATION FORALL (xgtm1: nzreal_gt_m1): (1 + xgtm1) /= 0;


decl_type: tcc
theory: ln_exp_ineq
library: lnexp
signature: nil
location: 57 0 60 999
body:
  % Subtype TCC generated (at line 28, column 40) for  1 + xgtm1
      % expected type  posreal
  ln_ineq1_TCC2: OBLIGATION
    FORALL (xgtm1: nzreal_gt_m1): 1 + xgtm1 >= 0 AND 1 + xgtm1 > 0;


decl_type: tcc
theory: ln_exp_ineq
library: lnexp
signature: nil
location: 62 0 65 999
body:
  % Subtype TCC generated (at line 31, column 30) for  1 - xlt1
      % expected type  posreal
  ln_ineq2_TCC1: OBLIGATION
    FORALL (xlt1: nzreal_lt1): 1 - xlt1 >= 0 AND 1 - xlt1 > 0;


decl_type: tcc
theory: ln_exp_ineq
library: lnexp
signature: nil
location: 67 0 70 999
body:
  % Subtype TCC generated (at line 31, column 62) for  (1 - xlt1)
      % expected type  nznum
  ln_ineq2_TCC2: OBLIGATION
    FORALL (xlt1: nzreal_lt1): xlt1 < -ln(1 - xlt1) IMPLIES (1 - xlt1) /= 0;


decl_type: tcc
theory: ln_exp_ineq
library: lnexp
signature: nil
location: 72 0 76 999
body:
  % Subtype TCC generated (at line 33, column 51) for  1 - px
      % expected type  posreal
  ln_ineq3_TCC1: OBLIGATION
    FORALL (px: posreal):
      px <= 5828 / 10000 IMPLIES 1 - px >= 0 AND 1 - px > 0;


decl_type: tcc
theory: ln_exp_ineq
library: lnexp
signature: nil
location: 78 0 81 999
body:
  % Subtype TCC generated (at line 39, column 26) for  1 + xalt1
      % expected type  posreal
  ln_ineq6_TCC1: OBLIGATION
    FORALL (xalt1: real_abs_lt1): 1 + xalt1 >= 0 AND 1 + xalt1 > 0;


decl_type: tcc
theory: ln_exp_ineq
library: lnexp
signature: nil
location: 83 0 86 999
body:
  % Subtype TCC generated (at line 39, column 43) for  1 - abs(xalt1)
      % expected type  posreal
  ln_ineq6_TCC2: OBLIGATION
    FORALL (xalt1: real_abs_lt1): 1 - abs(xalt1) >= 0 AND 1 - abs(xalt1) > 0;


decl_type: tcc
theory: ln_exp_ineq
library: lnexp
signature: nil
location: 88 0 90 999
body:
  % Subtype TCC generated (at line 41, column 30) for  (1 - xlt1)
      % expected type  nznum
  exp_ineq1_TCC1: OBLIGATION FORALL (xlt1: nzreal_lt1): (1 - xlt1) /= 0;


decl_type: formula
theory: ln_series
library: lnexp
signature: nil
location: 43 3 44 76
body:
     ln_taylors:  AXIOM EXISTS (c: between[{x:real | x > -1}](1,1+xgm1)):
                       ln(xgm1+1) = ln_estimate(xgm1,n) -(xgm1/-c)^(n+1)/(n+1)


decl_type: function
theory: ln_series
library: lnexp
signature: [[real, nat] -> real]
location: 40 3 41 76
body:
     ln_estimate(x:real,n:nat):real = 
           sigma(0,n,(LAMBDA (nn:nat): IF nn=0 THEN 0 ELSE -(-x)^nn/nn ENDIF))


decl_type: tcc
theory: ln_series
library: lnexp
signature: nil
location: 97 0 100 999
body:
  % Subtype TCC generated (at line 41, column 17) for  n
      % expected type  T_high[nat]
  ln_estimate_TCC1: OBLIGATION
    FORALL (n: nat): n >= 0 OR (EXISTS (j: nat): n <= j);


decl_type: tcc
theory: ln_series
library: lnexp
signature: nil
location: 102 0 105 999
body:
  % Subtype TCC generated (at line 41, column 63) for  nn
      % expected type  {i: int | (-x) /= 0 OR i >= 0}
  ln_estimate_TCC2: OBLIGATION
    FORALL (x: real, nn: nat): NOT nn = 0 IMPLIES (-x) /= 0 OR nn >= 0;


decl_type: tcc
theory: ln_series
library: lnexp
signature: nil
location: 107 0 109 999
body:
  % Subtype TCC generated (at line 41, column 66) for  nn
      % expected type  nznum
  ln_estimate_TCC3: OBLIGATION FORALL (nn: nat): NOT nn = 0 IMPLIES nn /= 0;


decl_type: tcc
theory: ln_series
library: lnexp
signature: nil
location: 111 0 115 999
body:
  % Subtype TCC generated (at line 44, column 24) for  xgm1 + 1
      % expected type  posreal
  ln_taylors_TCC1: OBLIGATION
    FORALL (xgm1: Gt_m1, c: between[{x: real | x > -1}](1, 1 + xgm1)):
      xgm1 + 1 >= 0 AND xgm1 + 1 > 0;


decl_type: tcc
theory: ln_series
library: lnexp
signature: nil
location: 117 0 121 999
body:
  % Subtype TCC generated (at line 44, column 61) for  -c
      % expected type  nznum
  ln_taylors_TCC2: OBLIGATION
    FORALL (xgm1: Gt_m1, c: between[{x: real | x > -1}](1, 1 + xgm1)):
      -c /= 0;


decl_type: tcc
theory: ln_series
library: lnexp
signature: nil
location: 123 0 128 999
body:
  % Subtype TCC generated (at line 44, column 66) for  (n + 1)
      % expected type  {i: int | (xgm1 / -c) /= 0 OR i >= 0}
  ln_taylors_TCC3: OBLIGATION
    FORALL (n: nat, xgm1: Gt_m1,
            c: between[{x: real | x > -1}](1, 1 + xgm1)):
      (xgm1 / -c) /= 0 OR (n + 1) >= 0;


decl_type: tcc
theory: ln_series
library: lnexp
signature: nil
location: 130 0 132 999
body:
  % Subtype TCC generated (at line 73, column 31) for  1 + x
      % expected type  posreal
  lnp1_TCC1: OBLIGATION FORALL (x: abslt1): 1 + x >= 0 AND 1 + x > 0;


decl_type: formula
theory: ln_approx
library: lnexp
signature: nil
location: 23 2 24 62
body:
    ln_le2_bounds: LEMMA 0 < x AND x <= 1 IMPLIES
         (ln_le2_lb(n,x) < ln(x+1) AND ln(x+1) < ln_le2_ub(n,x))


decl_type: function
theory: ln_approx
library: lnexp
signature: [[nat, {x: posreal | x > 1}] -> real]
location: 33 2 35 35
body:
    ln_gt1_ub(n,xgt1): real = 
      let (m,y) = log_nat(xgt1,2) in
         m*ln2_ub(n)+ln_le2_ub(n,y-1) 


decl_type: function
theory: ln_approx
library: lnexp
signature: [[posreal, nat] -> real]
location: 40 2 42 64
body:
    ln_lb(px,n): real = IF    px < 1 THEN -ln_gt1_ub(n,1/px)
                        ELSIF px = 1 THEN 0
                                     ELSE ln_gt1_lb(n,px)    ENDIF


decl_type: function
theory: ln_approx
library: lnexp
signature: [[posreal, nat] -> real]
location: 44 2 46 64
body:
    ln_ub(px,n): real = IF    px < 1 THEN -ln_gt1_lb(n,1/px)
                        ELSIF px = 1 THEN 0
                                     ELSE ln_gt1_ub(n,px)    ENDIF


decl_type: tcc
theory: ln_approx
library: lnexp
signature: nil
location: 55 0 58 999
body:
  % Subtype TCC generated (at line 24, column 28) for  x + 1
      % expected type  posreal
  ln_le2_bounds_TCC1: OBLIGATION
    FORALL (x: real): x <= 1 AND 0 < x IMPLIES x + 1 >= 0 AND x + 1 > 0;


decl_type: tcc
theory: ln_approx
library: lnexp
signature: nil
location: 60 0 62 999
body:
  % Subtype TCC generated (at line 30, column 24) for  xgt1
      % expected type  {x: real | x >= 1}
  ln_gt1_lb_TCC1: OBLIGATION FORALL (xgt1: {x: posreal | x > 1}): xgt1 >= 1;


decl_type: tcc
theory: ln_approx
library: lnexp
signature: nil
location: 64 0 67 999
body:
  % Subtype TCC generated (at line 38, column 20) for  x
      % expected type  {x: posreal | x > 1}
  ln_gt1_bounds_TCC1: OBLIGATION
    FORALL (x: real): 1 < x IMPLIES x >= 0 AND x > 0 AND x > 1;


decl_type: tcc
theory: ln_approx
library: lnexp
signature: nil
location: 69 0 72 999
body:
  % Subtype TCC generated (at line 38, column 28) for  x
      % expected type  posreal
  ln_gt1_bounds_TCC2: OBLIGATION
    FORALL (x: real): 1 < x IMPLIES x >= 0 AND x > 0;


decl_type: tcc
theory: ln_approx
library: lnexp
signature: nil
location: 74 0 76 999
body:
  % Subtype TCC generated (at line 40, column 53) for  1 / px
      % expected type  {x: posreal | x > 1}
  ln_lb_TCC1: OBLIGATION FORALL (px: posreal): px < 1 IMPLIES 1 / px > 1;


decl_type: tcc
theory: ln_approx
library: lnexp
signature: nil
location: 78 0 81 999
body:
  % Subtype TCC generated (at line 42, column 52) for  px
      % expected type  {x: posreal | x > 1}
  ln_lb_TCC2: OBLIGATION
    FORALL (px: posreal): NOT px = 1 AND NOT px < 1 IMPLIES px > 1;


decl_type: formula
theory: exp_series
library: lnexp
signature: nil
location: 43 3 45 71
body:
     exp_taylors: AXIOM EXISTS (c: between[real](0,x)):
                             exp(x) = exp_estimate(x,n)
                                          + exp(c)*x^(n+1)/factorial(n+1)


decl_type: formula
theory: exp_series
library: lnexp
signature: nil
location: 47 3 48 76
body:
     exp_taylors_err: LEMMA abs(exp(x)-exp_estimate(x,n)) 
                                  <= max(exp(x),1)*abs(x)^(n+1)/factorial(n+1)


decl_type: function
theory: exp_series
library: lnexp
signature: [[real, nat] -> real]
location: 39 3 40 68
body:
     exp_estimate(x:real,n:nat):real = 
                  1 + sigma(1,n,(LAMBDA (nn:nat): x^nn/factorial(nn)))


decl_type: tcc
theory: exp_series
library: lnexp
signature: nil
location: 57 0 60 999
body:
  % Subtype TCC generated (at line 40, column 28) for  n
      % expected type  T_high[nat]
  exp_estimate_TCC1: OBLIGATION
    FORALL (n: nat): n >= 0 OR (EXISTS (j: nat): n <= j);


decl_type: tcc
theory: exp_series
library: lnexp
signature: nil
location: 62 0 64 999
body:
  % Subtype TCC generated (at line 40, column 50) for  nn
      % expected type  {i: int | x /= 0 OR i >= 0}
  exp_estimate_TCC2: OBLIGATION FORALL (x: real, nn: nat): x /= 0 OR nn >= 0;


decl_type: tcc
theory: exp_series
library: lnexp
signature: nil
location: 66 0 69 999
body:
  % Subtype TCC generated (at line 45, column 52) for  (n + 1)
      % expected type  {i: int | x /= 0 OR i >= 0}
  exp_taylors_TCC1: OBLIGATION
    FORALL (n: nat, x: real, c: between[real](0, x)): x /= 0 OR (n + 1) >= 0;


decl_type: tcc
theory: exp_series
library: lnexp
signature: nil
location: 71 0 74 999
body:
  % Subtype TCC generated (at line 48, column 57) for  (n + 1)
      % expected type  {i: int | abs(x) /= 0 OR i >= 0}
  exp_taylors_err_TCC1: OBLIGATION
    FORALL (n: nat, x: real): abs(x) /= 0 OR (n + 1) >= 0;


decl_type: formula
theory: exp_approx
library: lnexp
signature: nil
location: 27 2 28 67
body:
    exp_neg_le1_bounds: LEMMA -1 <= x AND x < 0 IMPLIES
      (exp_neg_le1_lb(n,x) < exp(x) AND exp(x) < exp_neg_le1_ub(n,x))


decl_type: formula
theory: exp_approx
library: lnexp
signature: nil
location: 30 2 31 61
body:
    exp_neg_le1_ub_strict_decreasing_n: LEMMA -1 <= x AND x < 0 IMPLIES
        strict_decreasing?(LAMBDA (n:nat): exp_neg_le1_ub(n,x))


decl_type: formula
theory: exp_approx
library: lnexp
signature: nil
location: 33 2 34 61
body:
    exp_neg_le1_lb_strict_increasing_n: LEMMA -1 <= x AND x < 0 IMPLIES
        strict_increasing?(LAMBDA (n:nat): exp_neg_le1_lb(n,x))


decl_type: function
theory: exp_approx
library: lnexp
signature: [[real, nat] -> posreal]
location: 44 2 46 66
body:
    exp_ub(x,n): posreal = IF    x < 0 THEN exp_neg_ub(n,x)
                           ELSIF x = 0 THEN 1
                                       ELSE 1/exp_neg_lb(n,-x) ENDIF


decl_type: function
theory: exp_approx
library: lnexp
signature: [[real, nat] -> posreal]
location: 48 2 50 66
body:
    exp_lb(x,n): posreal = IF    x < 0 THEN exp_neg_lb(n,x)
                           ELSIF x = 0 THEN 1
                                       ELSE 1/exp_neg_ub(n,-x) ENDIF


decl_type: tcc
theory: exp_approx
library: lnexp
signature: nil
location: 77 0 80 999
body:
  % Subtype TCC generated (at line 38, column 73) for  pn
      % expected type  nznum
  exp_neg_ub_TCC1: OBLIGATION
    FORALL (nx: negreal, pn: int): pn = -floor(nx) IMPLIES pn /= 0;


decl_type: tcc
theory: exp_approx
library: lnexp
signature: nil
location: 82 0 89 999
body:
  % Subtype TCC generated (at line 38, column 77) for  pn
      % expected type  {i: int |
                     %          NOT exp_neg_le1_ub(1 + n, nx / pn) = 0 OR
                     %           i >= 0}
  exp_neg_ub_TCC2: OBLIGATION
    FORALL (n: nat, nx: negreal, pn: int):
      pn = -floor(nx) IMPLIES
       NOT exp_neg_le1_ub(1 + n, nx / pn) = 0 OR pn >= 0;


decl_type: tcc
theory: exp_approx
library: lnexp
signature: nil
location: 91 0 98 999
body:
  % Subtype TCC generated (at line 38, column 51) for
      % exp_neg_le1_ub(n + 1, nx / pn) ^ pn
      % expected type  posreal
  exp_neg_ub_TCC3: OBLIGATION
    FORALL (n: nat, nx: negreal, pn: int):
      pn = -floor(nx) IMPLIES
       exp_neg_le1_ub(n + 1, nx / pn) ^ pn >= 0 AND
        exp_neg_le1_ub(n + 1, nx / pn) ^ pn > 0;


decl_type: tcc
theory: exp_approx
library: lnexp
signature: nil
location: 100 0 107 999
body:
  % Subtype TCC generated (at line 40, column 77) for  pn
      % expected type  {i: int |
                     %          NOT exp_neg_le1_lb(1 + n, nx / pn) = 0 OR
                     %           i >= 0}
  exp_neg_lb_TCC1: OBLIGATION
    FORALL (n: nat, nx: negreal, pn: int):
      pn = -floor(nx) IMPLIES
       NOT exp_neg_le1_lb(1 + n, nx / pn) = 0 OR pn >= 0;


decl_type: tcc
theory: exp_approx
library: lnexp
signature: nil
location: 109 0 116 999
body:
  % Subtype TCC generated (at line 40, column 51) for
      % exp_neg_le1_lb(n + 1, nx / pn) ^ pn
      % expected type  posreal
  exp_neg_lb_TCC2: OBLIGATION
    FORALL (n: nat, nx: negreal, pn: int):
      pn = -floor(nx) IMPLIES
       exp_neg_le1_lb(n + 1, nx / pn) ^ pn >= 0 AND
        exp_neg_le1_lb(n + 1, nx / pn) ^ pn > 0;


decl_type: tcc
theory: exp_approx
library: lnexp
signature: nil
location: 118 0 120 999
body:
  % Subtype TCC generated (at line 44, column 55) for  x
      % expected type  negreal
  exp_ub_TCC1: OBLIGATION FORALL (x: real): x < 0 IMPLIES x <= 0;


decl_type: tcc
theory: exp_approx
library: lnexp
signature: nil
location: 122 0 125 999
body:
  % Subtype TCC generated (at line 46, column 57) for  -x
      % expected type  negreal
  exp_ub_TCC2: OBLIGATION
    FORALL (x: real): NOT x = 0 AND NOT x < 0 IMPLIES -x <= 0 AND -x < 0;


decl_type: tcc
theory: exp_approx
library: lnexp
signature: nil
location: 127 0 129 999
body:
  % Judgement subtype TCC generated (at line 70, column 22) for  e
      % expected type  {x: posreal | e_lb < e AND e < e_ub}
  e_bound: OBLIGATION e_lb < e AND e < e_ub;


decl_type: formula
theory: hyperbolic
library: lnexp
signature: nil
location: 92 2 94 76
body:
    coth_sum:  LEMMA n0x+n0y /= 0 IMPLIES                                % 4.5.27
                     coth(n0x+n0y)
                               = (1+coth(n0x)*coth(n0y))/(coth(n0x)+coth(n0y))


decl_type: formula
theory: hyperbolic
library: lnexp
signature: nil
location: 98 2 99 62
body:
    sinh_half:  LEMMA sinh(x/2) = LET y = sqrt((cosh(x)-1)/2) IN         % 4.5.28
                                  IF x >= 0 THEN y ELSE -y ENDIF


decl_type: formula
theory: hyperbolic
library: lnexp
signature: nil
location: 101 2 102 65
body:
    tanh_half1: LEMMA tanh(x/2) = LET y = sqrt((cosh(x)-1)/(cosh(x)+1))  % 4.5.30
                                  IN IF x >= 0 THEN y ELSE -y ENDIF


decl_type: formula
theory: hyperbolic
library: lnexp
signature: nil
location: 116 2 117 77
body:
    sinh4x:     LEMMA sinh(4*x)                                          % 4.5.36
                                = 4*sinh(x)*cosh(x)*(sq(sinh(x)) + sq(cosh(x)))


decl_type: formula
theory: hyperbolic
library: lnexp
signature: nil
location: 118 2 119 73
body:
    cosh4x:     LEMMA cosh(4*x)                                          % 4.5.37
                                = cosh(x)^4+6*sq(sinh(x)*cosh(x))+sinh(x)^4


decl_type: formula
theory: hyperbolic
library: lnexp
signature: nil
location: 134 2 135 73
body:
    sum_coth:   LEMMA coth(n0x)+coth(n0y)                                % 4.5.46
                                      = sinh(n0x+n0y)/(sinh(n0x)*sinh(n0y))


decl_type: formula
theory: hyperbolic
library: lnexp
signature: nil
location: 141 2 142 67
body:
    sum_cosh_sinh_sq: LEMMA sq(sinh(x))+sq(cosh(y))                      % 4.5.48
                                                = cosh(x+y)*cosh(x-y)


decl_type: formula
theory: hyperbolic
library: lnexp
signature: nil
location: 154 2 155 78
body:
    sinh_taylors: AXIOM EXISTS (c: between[real](0,x)):                  % 4.5.62
               sinh(x) = sinh_series_n(x,n) + cosh(c)*x^(2*n+3)/factorial(2*n+3)


decl_type: formula
theory: hyperbolic
library: lnexp
signature: nil
location: 259 2 260 78
body:
    atanh_series: AXIOM abs(atanh(z)-atanh_series_n(z,n)) <=
                     ((1+z)^(2*n+3)+(1-z)^(2*n+3))/(2*(2*n+3)*(1-sq(z))^(2*n+3))


decl_type: tcc
theory: hyperbolic
library: lnexp
signature: nil
location: 300 0 302 999
body:
  % Subtype TCC generated (at line 38, column 34) for  (exp(x) + exp(-x)) / 2
      % expected type  posreal_ge1
  cosh_TCC1: OBLIGATION FORALL (x: real): (exp(x) + exp(-x)) / 2 >= 1;


decl_type: tcc
theory: hyperbolic
library: lnexp
signature: nil
location: 304 0 306 999
body:
  % Subtype TCC generated (at line 39, column 42) for  cosh(x)
      % expected type  nznum
  tanh_TCC1: OBLIGATION FORALL (x: real): cosh(x) /= 0;


decl_type: tcc
theory: hyperbolic
library: lnexp
signature: nil
location: 308 0 311 999
body:
  % Subtype TCC generated (at line 39, column 34) for  sinh(x) / cosh(x)
      % expected type  real_abs_lt1
  tanh_TCC2: OBLIGATION
    FORALL (x: real): -1 < sinh(x) / cosh(x) & sinh(x) / cosh(x) < 1;


decl_type: tcc
theory: hyperbolic
library: lnexp
signature: nil
location: 313 0 315 999
body:
  % Subtype TCC generated (at line 40, column 36) for  sinh(n0x)
      % expected type  nznum
  csch_TCC1: OBLIGATION FORALL (n0x: nzreal): sinh(n0x) /= 0;


decl_type: tcc
theory: hyperbolic
library: lnexp
signature: nil
location: 317 0 321 999
body:
  % Subtype TCC generated (at line 41, column 34) for  1 / cosh(x)
      % expected type  posreal_le1
  sech_TCC1: OBLIGATION
    FORALL (x: real):
      1 / cosh(x) >= 0 AND 1 / cosh(x) > 0 AND 1 / cosh(x) <= 1;


decl_type: tcc
theory: hyperbolic
library: lnexp
signature: nil
location: 323 0 325 999
body:
  % Subtype TCC generated (at line 42, column 36) for  tanh(n0x)
      % expected type  nznum
  coth_TCC1: OBLIGATION FORALL (n0x: nzreal): tanh(n0x) /= 0;


decl_type: tcc
theory: hyperbolic
library: lnexp
signature: nil
location: 327 0 330 999
body:
  % Subtype TCC generated (at line 42, column 34) for  1 / tanh(n0x)
      % expected type  real_abs_gt1
  coth_TCC2: OBLIGATION
    FORALL (n0x: nzreal): 1 / tanh(n0x) < -1 OR 1 < 1 / tanh(n0x);


decl_type: tcc
theory: hyperbolic
library: lnexp
signature: nil
location: 332 0 335 999
body:
  % Subtype TCC generated (at line 47, column 42) for  csch(px)
      % expected type  posreal
  posreal_csch_TCC1: OBLIGATION
    FORALL (px: posreal): csch(px) >= 0 AND csch(px) > 0;


decl_type: tcc
theory: hyperbolic
library: lnexp
signature: nil
location: 337 0 339 999
body:
  % Subtype TCC generated (at line 49, column 42) for  coth(px)
      % expected type  posreal_gt1
  posreal_coth_TCC1: OBLIGATION FORALL (px: posreal): coth(px) > 1;


decl_type: tcc
theory: hyperbolic
library: lnexp
signature: nil
location: 341 0 343 999
body:
  % Subtype TCC generated (at line 91, column 50) for  (1 + tanh(x) * tanh(y))
      % expected type  nznum
  tanh_sum_TCC1: OBLIGATION FORALL (x, y: real): (1 + tanh(x) * tanh(y)) /= 0;


decl_type: tcc
theory: hyperbolic
library: lnexp
signature: nil
location: 345 0 349 999
body:
  % Subtype TCC generated (at line 94, column 56) for  (coth(n0x) + coth(n0y))
      % expected type  nznum
  coth_sum_TCC1: OBLIGATION
    FORALL (n0x, n0y: nzreal):
      n0x + n0y /= 0 IMPLIES (coth(n0x) + coth(n0y)) /= 0;


decl_type: tcc
theory: hyperbolic
library: lnexp
signature: nil
location: 351 0 353 999
body:
  % Subtype TCC generated (at line 98, column 45) for  (cosh(x) - 1) / 2
      % expected type  nnx: nonneg_real
  sinh_half_TCC1: OBLIGATION FORALL (x: real): (cosh(x) - 1) / 2 >= 0;


decl_type: tcc
theory: hyperbolic
library: lnexp
signature: nil
location: 355 0 357 999
body:
  % Subtype TCC generated (at line 100, column 37) for  (cosh(x) + 1) / 2
      % expected type  nnx: nonneg_real
  cosh_half_TCC1: OBLIGATION FORALL (x: real): (cosh(x) + 1) / 2 >= 0;


decl_type: tcc
theory: hyperbolic
library: lnexp
signature: nil
location: 359 0 361 999
body:
  % Subtype TCC generated (at line 101, column 58) for  (cosh(x) + 1)
      % expected type  nznum
  tanh_half1_TCC1: OBLIGATION FORALL (x: real): (cosh(x) + 1) /= 0;


decl_type: tcc
theory: hyperbolic
library: lnexp
signature: nil
location: 363 0 367 999
body:
  % Subtype TCC generated (at line 101, column 45) for
      % (cosh(x) - 1) / (cosh(x) + 1)
      % expected type  nnx: nonneg_real
  tanh_half1_TCC2: OBLIGATION
    FORALL (x: real): (cosh(x) - 1) / (cosh(x) + 1) >= 0;


decl_type: tcc
theory: hyperbolic
library: lnexp
signature: nil
location: 369 0 371 999
body:
  % Subtype TCC generated (at line 109, column 43) for  (1 - sq(tanh(x)))
      % expected type  nznum
  sinh2x_B_TCC1: OBLIGATION FORALL (x: real): (1 - sq(tanh(x))) /= 0;


decl_type: tcc
theory: hyperbolic
library: lnexp
signature: nil
location: 373 0 375 999
body:
  % Subtype TCC generated (at line 114, column 54) for  3
      % expected type  {i: int | sinh(x) /= 0 OR i >= 0}
  sinh3x_TCC1: OBLIGATION FORALL (x: real): sinh(x) /= 0 OR 3 >= 0;


decl_type: tcc
theory: hyperbolic
library: lnexp
signature: nil
location: 377 0 379 999
body:
  % Subtype TCC generated (at line 119, column 72) for  4
      % expected type  {i: int | sinh(x) /= 0 OR i >= 0}
  cosh4x_TCC1: OBLIGATION FORALL (x: real): sinh(x) /= 0 OR 4 >= 0;


decl_type: tcc
theory: hyperbolic
library: lnexp
signature: nil
location: 381 0 383 999
body:
  % Subtype TCC generated (at line 133, column 49) for  (cosh(x) * cosh(y))
      % expected type  nznum
  sum_tanh_TCC1: OBLIGATION FORALL (x, y: real): (cosh(x) * cosh(y)) /= 0;


decl_type: tcc
theory: hyperbolic
library: lnexp
signature: nil
location: 385 0 389 999
body:
  % Subtype TCC generated (at line 135, column 53) for
      % (sinh(n0x) * sinh(n0y))
      % expected type  nznum
  sum_coth_TCC1: OBLIGATION
    FORALL (n0x, n0y: nzreal): (sinh(n0x) * sinh(n0y)) /= 0;


decl_type: tcc
theory: hyperbolic
library: lnexp
signature: nil
location: 391 0 394 999
body:
  % Subtype TCC generated (at line 146, column 47) for  n
      % expected type  {i: int | (cosh(x) + sinh(x)) /= 0 OR i >= 0}
  hyperbolic_deMoivre_TCC1: OBLIGATION
    FORALL (n: nat, x: real): (cosh(x) + sinh(x)) /= 0 OR n >= 0;


decl_type: tcc
theory: hyperbolic
library: lnexp
signature: nil
location: 396 0 399 999
body:
  % Subtype TCC generated (at line 152, column 14) for  n
      % expected type  T_high[nat]
  sinh_series_n_TCC1: OBLIGATION
    FORALL (n: nat): n >= 0 OR (EXISTS (j: nat): n <= j);


decl_type: tcc
theory: hyperbolic
library: lnexp
signature: nil
location: 401 0 404 999
body:
  % Subtype TCC generated (at line 152, column 35) for  (2 * i + 1)
      % expected type  {i: int | x /= 0 OR i >= 0}
  sinh_series_n_TCC2: OBLIGATION
    FORALL (x: real, i: nat): x /= 0 OR (2 * i + 1) >= 0;


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


decl_type: tcc
theory: hyperbolic
library: lnexp
signature: nil
location: 412 0 415 999
body:
  % Subtype TCC generated (at line 160, column 35) for  x + sqrt(sq(x) + 1)
      % expected type  posreal
  asinh_TCC1: OBLIGATION
    FORALL (x: real): x + sqrt(sq(x) + 1) >= 0 AND x + sqrt(sq(x) + 1) > 0;


decl_type: tcc
theory: hyperbolic
library: lnexp
signature: nil
location: 417 0 419 999
body:
  % Subtype TCC generated (at line 161, column 42) for  sq(x) - 1
      % expected type  nnx: nonneg_real
  acosh_TCC1: OBLIGATION FORALL (x: posreal_ge1): sq(x) - 1 >= 0;


decl_type: tcc
theory: hyperbolic
library: lnexp
signature: nil
location: 421 0 425 999
body:
  % Subtype TCC generated (at line 161, column 35) for  x + sqrt(sq(x) - 1)
      % expected type  posreal
  acosh_TCC2: OBLIGATION
    FORALL (x: posreal_ge1):
      x + sqrt(sq(x) - 1) >= 0 AND x + sqrt(sq(x) - 1) > 0;


decl_type: tcc
theory: hyperbolic
library: lnexp
signature: nil
location: 427 0 431 999
body:
  % Subtype TCC generated (at line 161, column 32) for
      % ln(x + sqrt(sq(x) - 1))
      % expected type  nnreal
  acosh_TCC3: OBLIGATION
    FORALL (x: posreal_ge1): ln(x + sqrt(sq(x) - 1)) >= 0;


decl_type: tcc
theory: hyperbolic
library: lnexp
signature: nil
location: 433 0 435 999
body:
  % Subtype TCC generated (at line 162, column 42) for  (1 - x)
      % expected type  nznum
  atanh_TCC1: OBLIGATION FORALL (x: real_abs_lt1): (1 - x) /= 0;


decl_type: tcc
theory: hyperbolic
library: lnexp
signature: nil
location: 437 0 441 999
body:
  % Subtype TCC generated (at line 162, column 35) for  (1 + x) / (1 - x)
      % expected type  posreal
  atanh_TCC2: OBLIGATION
    FORALL (x: real_abs_lt1):
      (1 + x) / (1 - x) >= 0 AND (1 + x) / (1 - x) > 0;


decl_type: tcc
theory: hyperbolic
library: lnexp
signature: nil
location: 443 0 446 999
body:
  % Subtype TCC generated (at line 188, column 63) for  i
      % expected type  {i: nat | i <= 1 + 2 * n}
  atanhF_TCC1: OBLIGATION
    FORALL (n, i: nat): NOT i > 2 * n AND NOT odd?(i) IMPLIES i <= 1 + 2 * n;


decl_type: tcc
theory: hyperbolic
library: lnexp
signature: nil
location: 448 0 451 999
body:
  % Subtype TCC generated (at line 190, column 42) for  (2 * n + 1)
      % expected type  {i: int | (1 - sq(x)) /= 0 OR i >= 0}
  atanhD_TCC1: OBLIGATION
    FORALL (n: nat, x: real): (1 - sq(x)) /= 0 OR (2 * n + 1) >= 0;


decl_type: tcc
theory: hyperbolic
library: lnexp
signature: nil
location: 453 0 456 999
body:
  % Subtype TCC generated (at line 221, column 47) for  atanhD(n)(x)
      % expected type  nznum
  atanhND_TCC1: OBLIGATION
    FORALL (n: nat, x: real_abs_lt1): atanhD(n)(x) /= 0;


decl_type: tcc
theory: hyperbolic
library: lnexp
signature: nil
location: 458 0 461 999
body:
  % Subtype TCC generated (at line 245, column 28) for  (2 * n + 1)
      % expected type  {i: int | z /= 0 OR i >= 0}
  atanh_series_term_TCC1: OBLIGATION
    FORALL (z: real_abs_lt1, n: nat): z /= 0 OR (2 * n + 1) >= 0;


decl_type: tcc
theory: hyperbolic
library: lnexp
signature: nil
location: 463 0 466 999
body:
  % Subtype TCC generated (at line 260, column 27) for  (2 * n + 3)
      % expected type  {i: int | (1 + z) /= 0 OR i >= 0}
  atanh_series_TCC1: OBLIGATION
    FORALL (n: nat, z: real_abs_lt1): (1 + z) /= 0 OR (2 * n + 3) >= 0;


decl_type: tcc
theory: hyperbolic
library: lnexp
signature: nil
location: 468 0 471 999
body:
  % Subtype TCC generated (at line 260, column 71) for  (2 * n + 3)
      % expected type  {i: int | (1 - sq(z)) /= 0 OR i >= 0}
  atanh_series_TCC2: OBLIGATION
    FORALL (n: nat, z: real_abs_lt1): (1 - sq(z)) /= 0 OR (2 * n + 3) >= 0;


decl_type: tcc
theory: hyperbolic
library: lnexp
signature: nil
location: 473 0 478 999
body:
  % Subtype TCC generated (at line 260, column 50) for
      % (2 * (2 * n + 3) * (1 - sq(z)) ^ (2 * n + 3))
      % expected type  nznum
  atanh_series_TCC3: OBLIGATION
    FORALL (n: nat, z: real_abs_lt1):
      (2 * (2 * n + 3) * (1 - sq(z)) ^ (2 * n + 3)) /= 0;


decl_type: function
theory: expt
library: lnexp
signature: [[a: nnreal, {r: real | a /= 0 OR r /= 0}] -> nnreal]
location: 21 3 23 63
body:
     ^^(a: nnreal,x: {r:real | a /= 0 OR r /= 0}): nnreal = IF a = 0 THEN 0
                                                            ELSE exp(x*ln(a))
                                                            ENDIF


decl_type: tcc
theory: expt
library: lnexp
signature: nil
location: 85 0 89 999
body:
  % Subtype TCC generated (at line 22, column 72) for  a
      % expected type  posreal
  doublecaret_TCC1: OBLIGATION
    FORALL (a: nnreal, x: {r: real | a /= 0 OR r /= 0}):
      NOT a = 0 IMPLIES a > 0;


decl_type: tcc
theory: expt
library: lnexp
signature: nil
location: 91 0 94 999
body:
  % Subtype TCC generated (at line 30, column 28) for  (n + m)
      % expected type  {r: real | a /= 0 OR r /= 0}
  hathat_sum_TCC1: OBLIGATION
    FORALL (a: posreal, m, n: nat): a /= 0 OR (n + m) /= 0;


decl_type: tcc
theory: expt
library: lnexp
signature: nil
location: 96 0 98 999
body:
  % Subtype TCC generated (at line 30, column 41) for  n
      % expected type  {r: real | a /= 0 OR r /= 0}
  hathat_sum_TCC2: OBLIGATION FORALL (a: posreal, n: nat): a /= 0 OR n /= 0;


decl_type: tcc
theory: expt
library: lnexp
signature: nil
location: 100 0 103 999
body:
  % Subtype TCC generated (at line 31, column 28) for  (n - m)
      % expected type  {r: real | a /= 0 OR r /= 0}
  hathat_diff_TCC1: OBLIGATION
    FORALL (a: posreal, m, n: nat): a /= 0 OR (n - m) /= 0;


decl_type: tcc
theory: expt
library: lnexp
signature: nil
location: 105 0 107 999
body:
  % Subtype TCC generated (at line 31, column 45) for  (a ^^ m)
      % expected type  nznum
  hathat_diff_TCC2: OBLIGATION FORALL (a: posreal, m: nat): (a ^^ m) /= 0;


decl_type: tcc
theory: expt
library: lnexp
signature: nil
location: 109 0 111 999
body:
  % Subtype TCC generated (at line 33, column 28) for  0
      % expected type  {r: real | px /= 0 OR r /= 0}
  hathat_to_0_TCC1: OBLIGATION FORALL (px: posreal): px /= 0 OR 0 /= 0;


decl_type: tcc
theory: expt
library: lnexp
signature: nil
location: 113 0 115 999
body:
  % Subtype TCC generated (at line 35, column 27) for  1
      % expected type  {r: real | a /= 0 OR r /= 0}
  hathat_to_1_TCC1: OBLIGATION FORALL (a: posreal): a /= 0 OR 1 /= 0;


decl_type: tcc
theory: expt
library: lnexp
signature: nil
location: 117 0 119 999
body:
  % Subtype TCC generated (at line 41, column 33) for  n
      % expected type  {i: int | a /= 0 OR i >= 0}
  hathat_nat_TCC1: OBLIGATION FORALL (a: posreal, n: nat): a /= 0 OR n >= 0;


decl_type: tcc
theory: expt
library: lnexp
signature: nil
location: 121 0 124 999
body:
  % Subtype TCC generated (at line 43, column 30) for  (1 / px)
      % expected type  {r: real | a /= 0 OR r /= 0}
  hathat_lt_cross_TCC1: OBLIGATION
    FORALL (a, px: posreal): a /= 0 OR (1 / px) /= 0;


decl_type: tcc
theory: expt
library: lnexp
signature: nil
location: 126 0 129 999
body:
  % Subtype TCC generated (at line 43, column 55) for  px
      % expected type  {r: real | b /= 0 OR r /= 0}
  hathat_lt_cross_TCC2: OBLIGATION
    FORALL (a, b, px: posreal): a ^^ (1 / px) < b IMPLIES b /= 0 OR px /= 0;


decl_type: tcc
theory: expt
library: lnexp
signature: nil
location: 131 0 134 999
body:
  % Subtype TCC generated (at line 45, column 55) for  px
      % expected type  {r: real | b /= 0 OR r /= 0}
  hathat_gt_cross_TCC1: OBLIGATION
    FORALL (a, b, px: posreal): a ^^ (1 / px) > b IMPLIES b /= 0 OR px /= 0;


decl_type: tcc
theory: expt
library: lnexp
signature: nil
location: 136 0 139 999
body:
  % Subtype TCC generated (at line 47, column 27) for  nzx
      % expected type  {r: real | a /= 0 OR r /= 0}
  hathat_eq_0_TCC1: OBLIGATION
    FORALL (a: posreal, nzx: nzreal): a /= 0 OR nzx /= 0;


decl_type: tcc
theory: expt
library: lnexp
signature: nil
location: 141 0 144 999
body:
  % Subtype TCC generated (at line 49, column 28) for  x
      % expected type  {r: real | px /= 0 OR r /= 0}
  hathat_eq_1_TCC1: OBLIGATION
    FORALL (px: posreal, x: real): px /= 0 OR x /= 0;


decl_type: tcc
theory: expt
library: lnexp
signature: nil
location: 146 0 149 999
body:
  % Subtype TCC generated (at line 51, column 32) for  x
      % expected type  {r: real | (a / px) /= 0 OR r /= 0}
  hathat_div_TCC1: OBLIGATION
    FORALL (a, px: posreal, x: real): (a / px) /= 0 OR x /= 0;


decl_type: tcc
theory: expt
library: lnexp
signature: nil
location: 151 0 153 999
body:
  % Subtype TCC generated (at line 51, column 41) for  px ^^ x
      % expected type  nznum
  hathat_div_TCC2: OBLIGATION FORALL (px: posreal, x: real): px ^^ x /= 0;


decl_type: tcc
theory: expt
library: lnexp
signature: nil
location: 155 0 158 999
body:
  % Subtype TCC generated (at line 53, column 44) for  x
      % expected type  {r: real | abs(a) /= 0 OR r /= 0}
  hathat_abs_TCC1: OBLIGATION
    FORALL (a: posreal, x: real): abs(a) /= 0 OR x /= 0;


decl_type: formula
theory: ln_exp
library: lnexp_fnd
signature: nil
location: 25 3 26 66
body:
     ln_prep: LEMMA FORALL (x: posreal):
           Integrable?[posreal](1, x, (LAMBDA (t: posreal): 1 / t));


decl_type: formula
theory: ln_exp
library: lnexp_fnd
signature: nil
location: 31 3 32 61
body:
     ln_derivable   : LEMMA derivable?(ln) AND
                         deriv(ln) = (LAMBDA (t: posreal): 1/t)


decl_type: tcc
theory: ln_exp
library: lnexp_fnd
signature: nil
location: 118 0 121 999
body:
  % Assuming TCC generated (at line 14, column 6) for
      % analysis@integral_def[posreal]
      % generated from assumption integral_def.connected_domain
  ln_prep_TCC1: OBLIGATION connected?[posreal];


decl_type: tcc
theory: ln_exp
library: lnexp_fnd
signature: nil
location: 123 0 126 999
body:
  % Assuming TCC generated (at line 17, column 6) for
      % analysis@integral_def[posreal]
      % generated from assumption integral_def.not_one_element
  ln_prep_TCC2: OBLIGATION not_one_element?[posreal];


decl_type: tcc
theory: ln_exp
library: lnexp_fnd
signature: nil
location: 128 0 133 999
body:
  % Subtype TCC generated (at line 29, column 41) for
      % (LAMBDA (t: posreal): 1 / t)
      % expected type  Integrable_funs[posreal](1, x)
  ln_TCC1: OBLIGATION
    FORALL (x: posreal):
      Integrable?[posreal](1, x, (LAMBDA (t: posreal): 1 / t));


decl_type: tcc
theory: ln_exp
library: lnexp_fnd
signature: nil
location: 135 0 138 999
body:
  % Assuming TCC generated (at line 14, column 12) for
      % analysis@derivatives[posreal]
      % generated from assumption derivatives.deriv_domain
  ln_derivable_TCC1: OBLIGATION deriv_domain?[posreal];


decl_type: tcc
theory: ln_exp
library: lnexp_fnd
signature: nil
location: 140 0 143 999
body:
  % Subtype TCC generated (at line 40, column 32) for  i
      % expected type  {i: int | px /= 0 OR i >= 0}
  ln_expt_TCC1: OBLIGATION
    FORALL (i: integer, px: posreal): px /= 0 OR i >= 0;


decl_type: tcc
theory: ln_exp
library: lnexp_fnd
signature: nil
location: 145 0 147 999
body:
  % Existence TCC generated (at line 58, column 3) for
      % exp(x): {py | x = ln(py)}
  exp_TCC1: OBLIGATION EXISTS (x1: [x: real -> {py | x = ln(py)}]): TRUE;


decl_type: tcc
theory: ln_exp
library: lnexp_fnd
signature: nil
location: 149 0 151 999
body:
  % Subtype TCC generated (at line 74, column 37) for  i
      % expected type  {i: int | e /= 0 OR i >= 0}
  exp_int_TCC1: OBLIGATION FORALL (i: integer): e /= 0 OR i >= 0;


decl_type: tcc
theory: ln_exp
library: lnexp_fnd
signature: nil
location: 153 0 156 999
body:
  % Subtype TCC generated (at line 80, column 44) for  i
      % expected type  {i: int | exp(x) /= 0 OR i >= 0}
  exp_scal_TCC1: OBLIGATION
    FORALL (i: integer, x: real): exp(x) /= 0 OR i >= 0;


decl_type: tcc
theory: ln_exp
library: lnexp_fnd
signature: nil
location: 158 0 161 999
body:
  % Subtype TCC generated (at line 88, column 42) for  i
      % expected type  {i: int | x /= 0 OR i >= 0}
  expt_alt_def_TCC1: OBLIGATION
    FORALL (i: integer, x: real): x > 0 IMPLIES x /= 0 OR i >= 0;


decl_type: tcc
theory: ln_exp
library: lnexp_fnd
signature: nil
location: 163 0 165 999
body:
  % Subtype TCC generated (at line 88, column 55) for  x
      % expected type  posreal
  expt_alt_def_TCC2: OBLIGATION FORALL (x: real): x > 0 IMPLIES x >= 0;


decl_type: tcc
theory: ln_exp
library: lnexp_fnd
signature: nil
location: 167 0 170 999
body:
  % Assuming TCC generated (at line 14, column 12) for
      % analysis@derivatives[real]
      % generated from assumption derivatives.deriv_domain
  exp_deriv_TCC1: OBLIGATION deriv_domain?[real];


decl_type: tcc
theory: ln_exp
library: lnexp_fnd
signature: nil
location: 172 0 175 999
body:
  % Assuming TCC generated (at line 14, column 12) for
      % analysis@derivatives[real]
      % generated from assumption derivatives.not_one_element
  exp_deriv_TCC2: OBLIGATION not_one_element?[real];


decl_type: formula
theory: ln_exp_series_alt
library: lnexp_fnd
signature: nil
location: 44 3 45 74
body:
     ln_nderiv      : LEMMA nderiv[posreal](n,ln) = IF n = 0 THEN ln ELSE 
                          (LAMBDA (x:posreal): -factorial(n-1)/(-x)^n) ENDIF


decl_type: formula
theory: ln_exp_series_alt
library: lnexp_fnd
signature: nil
location: 52 3 53 79
body:
     ln_estimate_scaf2: LEMMA FORALL (x:posreal):
                       Integrable?[posreal](1,x,(LAMBDA (t: posreal): (1-t)^n/t))


decl_type: formula
theory: ln_exp_series_alt
library: lnexp_fnd
signature: nil
location: 55 3 56 79
body:
     ln_estimate_scaf3: LEMMA FORALL (x:posreal):
                              ln(x) = Integral(1,x,LAMBDA (t:posreal): (1-t)^0/t)


decl_type: formula
theory: ln_exp_series_alt
library: lnexp_fnd
signature: nil
location: 66 3 67 68
body:
     ln_estimate_scaf7: LEMMA deriv[posreal](LAMBDA px: ln_estimate(px-1, n+1))
                  = (LAMBDA px: sigma(0,n,(LAMBDA (i:nat): (1-px)^i)))


decl_type: formula
theory: ln_exp_series_alt
library: lnexp_fnd
signature: nil
location: 69 3 71 70
body:
     ln_estimate_scaf8: LEMMA
           ln(px) = ln_estimate(px-1,n+1) +
                        Integral(1,px,LAMBDA (t:posreal): (1-t)^(n+1)/t)


decl_type: formula
theory: ln_exp_series_alt
library: lnexp_fnd
signature: nil
location: 73 3 75 66
body:
     ln_estimate_scaf9: LEMMA
           ln(px) = ln_estimate(px-1,n) +
                        Integral(1,px,LAMBDA (t:posreal): (1-t)^n/t)


decl_type: formula
theory: ln_exp_series_alt
library: lnexp_fnd
signature: nil
location: 77 3 79 61
body:
     ln_estimate_scaf10: LEMMA 1 <= px AND px <= 2 IMPLIES
             abs(Integral(1,px,LAMBDA (t:posreal): (1-t)^n/t))
                                          <= (px-1)^(n+1)/(n+1)


decl_type: formula
theory: ln_exp_series_alt
library: lnexp_fnd
signature: nil
location: 81 3 83 66
body:
     ln_estimate_scaf11: LEMMA px < 1 IMPLIES
             abs(Integral(1,px,LAMBDA (t:posreal): (1-t)^n/t))
                                          <= (1-px)^(n+1)/((n+1)*px)


decl_type: formula
theory: ln_exp_series_alt
library: lnexp_fnd
signature: nil
location: 85 3 86 73
body:
     ln_estimate_bnd: LEMMA abs(ln(1+z) - ln_estimate(z,n)) <=
                        abs(z)^(n+1)/(IF z < 0 THEN 1+z ELSE 1 ENDIF*(n+1))


decl_type: formula
theory: ln_exp_series_alt
library: lnexp_fnd
signature: nil
location: 96 3 97 76
body:
     ln_taylors:     LEMMA EXISTS (c: between[{x:real | x > -1}](1,1+xgm1)):
                       ln(xgm1+1) = ln_estimate(xgm1,n) -(xgm1/-c)^(n+1)/(n+1)


decl_type: formula
theory: ln_exp_series_alt
library: lnexp_fnd
signature: nil
location: 108 3 109 79
body:
     exp_taylors:     LEMMA EXISTS (c:between[real](0,x)):
                       exp(x) = exp_estimate(x,n) + exp(c)*x^(n+1)/factorial(n+1)


decl_type: formula
theory: ln_exp_series_alt
library: lnexp_fnd
signature: nil
location: 111 3 112 76
body:
     exp_estimate_bnd:      LEMMA abs(exp(x)-exp_estimate(x,n)) 
                                  <= max(exp(x),1)*abs(x)^(n+1)/factorial(n+1)


decl_type: tcc
theory: ln_exp_series_alt
library: lnexp_fnd
signature: nil
location: 129 0 132 999
body:
  % Assuming TCC generated (at line 22, column 3) for
      % analysis@nth_derivatives[posreal]
      % generated from assumption nth_derivatives.deriv_domain
  nderiv_ln_TCC1: OBLIGATION deriv_domain?[posreal];


decl_type: tcc
theory: ln_exp_series_alt
library: lnexp_fnd
signature: nil
location: 134 0 137 999
body:
  % Assuming TCC generated (at line 24, column 3) for
      % analysis@nth_derivatives[posreal]
      % generated from assumption nth_derivatives.not_one_element
  nderiv_ln_TCC2: OBLIGATION not_one_element?[posreal];


decl_type: tcc
theory: ln_exp_series_alt
library: lnexp_fnd
signature: nil
location: 139 0 142 999
body:
  % Subtype TCC generated (at line 44, column 44) for  ln
      % expected type  nderiv_fun[posreal](n)
  ln_nderiv_TCC1: OBLIGATION
    FORALL (n: nat): derivable_n_times?[posreal](ln, n);


decl_type: tcc
theory: ln_exp_series_alt
library: lnexp_fnd
signature: nil
location: 144 0 146 999
body:
  % Subtype TCC generated (at line 45, column 56) for  n - 1
      % expected type  nat
  ln_nderiv_TCC2: OBLIGATION FORALL (n: nat): NOT n = 0 IMPLIES n - 1 >= 0;


decl_type: tcc
theory: ln_exp_series_alt
library: lnexp_fnd
signature: nil
location: 148 0 152 999
body:
  % Subtype TCC generated (at line 45, column 66) for  n
      % expected type  {i: int | (-x) /= 0 OR i >= 0}
  ln_nderiv_TCC3: OBLIGATION
    FORALL (n: nat):
      NOT n = 0 IMPLIES (FORALL (x: posreal): (-x) /= 0 OR n >= 0);


decl_type: tcc
theory: ln_exp_series_alt
library: lnexp_fnd
signature: nil
location: 154 0 156 999
body:
  % Subtype TCC generated (at line 48, column 17) for  0
      % expected type  T_low[nat]
  ln_estimate_TCC1: OBLIGATION 0 >= 0 OR (EXISTS (j: nat): j <= 0);


decl_type: tcc
theory: ln_exp_series_alt
library: lnexp_fnd
signature: nil
location: 158 0 161 999
body:
  % Subtype TCC generated (at line 48, column 19) for  n
      % expected type  T_high[nat]
  ln_estimate_TCC2: OBLIGATION
    FORALL (n: nat): n >= 0 OR (EXISTS (j: nat): n <= j);


decl_type: tcc
theory: ln_exp_series_alt
library: lnexp_fnd
signature: nil
location: 163 0 166 999
body:
  % Subtype TCC generated (at line 48, column 65) for  nn
      % expected type  {i: int | (-x) /= 0 OR i >= 0}
  ln_estimate_TCC3: OBLIGATION
    FORALL (x: real, nn: nat): NOT nn = 0 IMPLIES (-x) /= 0 OR nn >= 0;


decl_type: tcc
theory: ln_exp_series_alt
library: lnexp_fnd
signature: nil
location: 168 0 170 999
body:
  % Subtype TCC generated (at line 48, column 68) for  nn
      % expected type  nznum
  ln_estimate_TCC4: OBLIGATION FORALL (nn: nat): NOT nn = 0 IMPLIES nn /= 0;


decl_type: tcc
theory: ln_exp_series_alt
library: lnexp_fnd
signature: nil
location: 172 0 175 999
body:
  % Subtype TCC generated (at line 50, column 68) for  n
      % expected type  {i: int | (1 - t) /= 0 OR i >= 0}
  ln_estimate_scaf1_TCC1: OBLIGATION
    FORALL (n: nat, t: posreal): (1 - t) /= 0 OR n >= 0;


decl_type: tcc
theory: ln_exp_series_alt
library: lnexp_fnd
signature: nil
location: 177 0 180 999
body:
  % Assuming TCC generated (at line 14, column 6) for
      % analysis@integral_def[posreal]
      % generated from assumption integral_def.connected_domain
  ln_estimate_scaf2_TCC1: OBLIGATION connected?[posreal];


decl_type: tcc
theory: ln_exp_series_alt
library: lnexp_fnd
signature: nil
location: 182 0 185 999
body:
  % Subtype TCC generated (at line 56, column 75) for  0
      % expected type  {i: int | (1 - t) /= 0 OR i >= 0}
  ln_estimate_scaf3_TCC1: OBLIGATION
    FORALL (t: posreal): (1 - t) /= 0 OR 0 >= 0;


decl_type: tcc
theory: ln_exp_series_alt
library: lnexp_fnd
signature: nil
location: 187 0 192 999
body:
  % Subtype TCC generated (at line 56, column 49) for
      % LAMBDA (t: posreal): (1 - t) ^ 0 / t
      % expected type  Integrable_funs[posreal](1, x)
  ln_estimate_scaf3_TCC2: OBLIGATION
    FORALL (x: posreal):
      Integrable?[posreal](1, x, LAMBDA (t: posreal): (1 - t) ^ 0 / t);


decl_type: tcc
theory: ln_exp_series_alt
library: lnexp_fnd
signature: nil
location: 194 0 197 999
body:
  % Subtype TCC generated (at line 59, column 14) for  (1 - x)
      % expected type  nznum
  ln_estimate_scaf4_TCC1: OBLIGATION
    FORALL (x: real): x /= 1 IMPLIES (1 - x) /= 0;


decl_type: tcc
theory: ln_exp_series_alt
library: lnexp_fnd
signature: nil
location: 199 0 202 999
body:
  % Subtype TCC generated (at line 59, column 50) for  i
      % expected type  {i: int | x /= 0 OR i >= 0}
  ln_estimate_scaf4_TCC2: OBLIGATION
    FORALL (x: real): x /= 1 IMPLIES (FORALL (i: nat): x /= 0 OR i >= 0);


decl_type: tcc
theory: ln_exp_series_alt
library: lnexp_fnd
signature: nil
location: 204 0 207 999
body:
  % Subtype TCC generated (at line 59, column 59) for  (n + 1)
      % expected type  {i: int | x /= 0 OR i >= 0}
  ln_estimate_scaf4_TCC3: OBLIGATION
    FORALL (n: nat, x: real): x /= 1 IMPLIES x /= 0 OR (n + 1) >= 0;


decl_type: tcc
theory: ln_exp_series_alt
library: lnexp_fnd
signature: nil
location: 209 0 212 999
body:
  % Subtype TCC generated (at line 62, column 54) for  i
      % expected type  {i: int | (1 - nzx) /= 0 OR i >= 0}
  ln_estimate_scaf5_TCC1: OBLIGATION
    FORALL (nzx: nzreal, i: nat): (1 - nzx) /= 0 OR i >= 0;


decl_type: tcc
theory: ln_exp_series_alt
library: lnexp_fnd
signature: nil
location: 214 0 217 999
body:
  % Subtype TCC generated (at line 62, column 69) for  (n + 1)
      % expected type  {i: int | (1 - nzx) /= 0 OR i >= 0}
  ln_estimate_scaf5_TCC2: OBLIGATION
    FORALL (n: nat, nzx: nzreal): (1 - nzx) /= 0 OR (n + 1) >= 0;


decl_type: tcc
theory: ln_exp_series_alt
library: lnexp_fnd
signature: nil
location: 219 0 224 999
body:
  % Subtype TCC generated (at line 66, column 43) for
      % LAMBDA px: ln_estimate(px - 1, n + 1)
      % expected type  deriv_fun[posreal]
  ln_estimate_scaf7_TCC1: OBLIGATION
    FORALL (n: nat):
      derivable?[posreal](LAMBDA px: ln_estimate(px - 1, n + 1));


decl_type: tcc
theory: ln_exp_series_alt
library: lnexp_fnd
signature: nil
location: 226 0 229 999
body:
  % Subtype TCC generated (at line 71, column 63) for  (n + 1)
      % expected type  {i: int | (1 - t) /= 0 OR i >= 0}
  ln_estimate_scaf8_TCC1: OBLIGATION
    FORALL (n: nat, t: posreal): (1 - t) /= 0 OR (n + 1) >= 0;


decl_type: tcc
theory: ln_exp_series_alt
library: lnexp_fnd
signature: nil
location: 231 0 236 999
body:
  % Subtype TCC generated (at line 71, column 36) for
      % LAMBDA (t: posreal): (1 - t) ^ (n + 1) / t
      % expected type  Integrable_funs[posreal](1, px)
  ln_estimate_scaf8_TCC2: OBLIGATION
    FORALL (n: nat, px: posreal):
      Integrable?[posreal](1, px, LAMBDA (t: posreal): (1 - t) ^ (n + 1) / t);


decl_type: tcc
theory: ln_exp_series_alt
library: lnexp_fnd
signature: nil
location: 238 0 243 999
body:
  % Subtype TCC generated (at line 75, column 36) for
      % LAMBDA (t: posreal): (1 - t) ^ n / t
      % expected type  Integrable_funs[posreal](1, px)
  ln_estimate_scaf9_TCC1: OBLIGATION
    FORALL (n: nat, px: posreal):
      Integrable?[posreal](1, px, LAMBDA (t: posreal): (1 - t) ^ n / t);


decl_type: tcc
theory: ln_exp_series_alt
library: lnexp_fnd
signature: nil
location: 245 0 249 999
body:
  % Subtype TCC generated (at line 79, column 51) for  (n + 1)
      % expected type  {i: int | (px - 1) /= 0 OR i >= 0}
  ln_estimate_scaf10_TCC1: OBLIGATION
    FORALL (n: nat, px: posreal):
      px <= 2 AND 1 <= px IMPLIES (px - 1) /= 0 OR (n + 1) >= 0;


decl_type: tcc
theory: ln_exp_series_alt
library: lnexp_fnd
signature: nil
location: 251 0 254 999
body:
  % Subtype TCC generated (at line 85, column 33) for  1 + z
      % expected type  posreal
  ln_estimate_bnd_TCC1: OBLIGATION
    FORALL (z: real_gtm1_le1): 1 + z >= 0 AND 1 + z > 0;


decl_type: tcc
theory: ln_exp_series_alt
library: lnexp_fnd
signature: nil
location: 256 0 259 999
body:
  % Subtype TCC generated (at line 86, column 30) for  (n + 1)
      % expected type  {i: int | abs(z) /= 0 OR i >= 0}
  ln_estimate_bnd_TCC2: OBLIGATION
    FORALL (n: nat, z: real_gtm1_le1): abs(z) /= 0 OR (n + 1) >= 0;


decl_type: tcc
theory: ln_exp_series_alt
library: lnexp_fnd
signature: nil
location: 261 0 266 999
body:
  % Subtype TCC generated (at line 86, column 36) for
      % (IF z < 0 THEN 1 + z ELSE 1 ENDIF * (n + 1))
      % expected type  nznum
  ln_estimate_bnd_TCC3: OBLIGATION
    FORALL (n: nat, z: real_gtm1_le1):
      (IF z < 0 THEN 1 + z ELSE 1 ENDIF * (n + 1)) /= 0;


decl_type: tcc
theory: ln_exp_series_alt
library: lnexp_fnd
signature: nil
location: 268 0 271 999
body:
  % Subtype TCC generated (at line 88, column 54) for  (n + 1)
      % expected type  {i: int | (-x) /= 0 OR i >= 0}
  lnT_TCC1: OBLIGATION
    FORALL (x: real_gtm1_le1, n: nat): (-x) /= 0 OR (n + 1) >= 0;


decl_type: tcc
theory: ln_exp_series_alt
library: lnexp_fnd
signature: nil
location: 273 0 278 999
body:
  % Subtype TCC generated (at line 88, column 47) for
      % -(-x) ^ (n + 1) / (n + 1)
      % expected type  real_gtm1_le1
  lnT_TCC2: OBLIGATION
    FORALL (x: real_gtm1_le1, n: nat):
      -1 < -(-x) ^ (n + 1) / (n + 1) AND -(-x) ^ (n + 1) / (n + 1) <= 1;


decl_type: tcc
theory: ln_exp_series_alt
library: lnexp_fnd
signature: nil
location: 280 0 283 999
body:
  % Subtype TCC generated (at line 94, column 42) for  lnT(z)
      % expected type  (conv_series?)
  ln_series_def_TCC1: OBLIGATION
    FORALL (z: real_gtm1_le1): conv_series?(lnT(z));


decl_type: tcc
theory: ln_exp_series_alt
library: lnexp_fnd
signature: nil
location: 285 0 288 999
body:
  % Assuming TCC generated (at line 19, column 5) for
      % analysis@taylors[{x: real | x > -1}]
      % generated from assumption taylors.connected_domain
  ln_taylors_TCC1: OBLIGATION connected?[{x: real | x > -1}];


decl_type: tcc
theory: ln_exp_series_alt
library: lnexp_fnd
signature: nil
location: 290 0 293 999
body:
  % Assuming TCC generated (at line 21, column 5) for
      % analysis@taylors[{x: real | x > -1}]
      % generated from assumption taylors.not_one_element
  ln_taylors_TCC2: OBLIGATION not_one_element?[{x: real | x > -1}];


decl_type: tcc
theory: ln_exp_series_alt
library: lnexp_fnd
signature: nil
location: 295 0 300 999
body:
  % Subtype TCC generated (at line 97, column 24) for  xgm1 + 1
      % expected type  posreal
  ln_taylors_TCC3: OBLIGATION
    FORALL (xgm1: {x: real | x > -1},
            c: between[{x: real | x > -1}](1, 1 + xgm1)):
      xgm1 + 1 >= 0 AND xgm1 + 1 > 0;


decl_type: tcc
theory: ln_exp_series_alt
library: lnexp_fnd
signature: nil
location: 302 0 307 999
body:
  % Subtype TCC generated (at line 97, column 61) for  -c
      % expected type  nznum
  ln_taylors_TCC4: OBLIGATION
    FORALL (xgm1: {x: real | x > -1},
            c: between[{x: real | x > -1}](1, 1 + xgm1)):
      -c /= 0;


decl_type: tcc
theory: ln_exp_series_alt
library: lnexp_fnd
signature: nil
location: 309 0 314 999
body:
  % Subtype TCC generated (at line 97, column 66) for  (n + 1)
      % expected type  {i: int | (xgm1 / -c) /= 0 OR i >= 0}
  ln_taylors_TCC5: OBLIGATION
    FORALL (n: nat, xgm1: {x: real | x > -1},
            c: between[{x: real | x > -1}](1, 1 + xgm1)):
      (xgm1 / -c) /= 0 OR (n + 1) >= 0;


decl_type: tcc
theory: ln_exp_series_alt
library: lnexp_fnd
signature: nil
location: 316 0 319 999
body:
  % Assuming TCC generated (at line 23, column 13) for
      % analysis@nth_derivatives[real]
      % generated from assumption nth_derivatives.deriv_domain
  nderiv_exp_TCC1: OBLIGATION deriv_domain?[real];


decl_type: tcc
theory: ln_exp_series_alt
library: lnexp_fnd
signature: nil
location: 321 0 324 999
body:
  % Assuming TCC generated (at line 23, column 13) for
      % analysis@nth_derivatives[real]
      % generated from assumption nth_derivatives.not_one_element
  nderiv_exp_TCC2: OBLIGATION not_one_element?[real];


decl_type: tcc
theory: ln_exp_series_alt
library: lnexp_fnd
signature: nil
location: 326 0 329 999
body:
  % Subtype TCC generated (at line 104, column 44) for  n
      % expected type  {i: int | x /= 0 OR i >= 0}
  expT_TCC1: OBLIGATION
    FORALL (x: real, n: nat): NOT n = 0 IMPLIES x /= 0 OR n >= 0;


decl_type: tcc
theory: ln_exp_series_alt
library: lnexp_fnd
signature: nil
location: 331 0 333 999
body:
  % Assuming TCC generated (at line 19, column 5) for  analysis@taylors[real]
      % generated from assumption taylors.connected_domain
  exp_taylors_TCC1: OBLIGATION connected?[real];


decl_type: tcc
theory: ln_exp_series_alt
library: lnexp_fnd
signature: nil
location: 335 0 338 999
body:
  % Subtype TCC generated (at line 109, column 60) for  (n + 1)
      % expected type  {i: int | x /= 0 OR i >= 0}
  exp_taylors_TCC2: OBLIGATION
    FORALL (n: nat, x: real, c: between[real](0, x)): x /= 0 OR (n + 1) >= 0;


decl_type: tcc
theory: ln_exp_series_alt
library: lnexp_fnd
signature: nil
location: 340 0 343 999
body:
  % Subtype TCC generated (at line 112, column 57) for  (n + 1)
      % expected type  {i: int | abs(x) /= 0 OR i >= 0}
  exp_estimate_bnd_TCC1: OBLIGATION
    FORALL (n: nat, x: real): abs(x) /= 0 OR (n + 1) >= 0;


decl_type: tcc
theory: ln_exp_series_alt
library: lnexp_fnd
signature: nil
location: 345 0 348 999
body:
  % Subtype TCC generated (at line 114, column 36) for  (2 * n)
      % expected type  {i: int | sqrt(n) /= 0 OR i >= 0}
  exp_series_scaf2_TCC1: OBLIGATION
    FORALL (n: nat): sqrt(n) /= 0 OR (2 * n) >= 0;


decl_type: tcc
theory: ln_exp_series_alt
library: lnexp_fnd
signature: nil
location: 350 0 353 999
body:
  % Subtype TCC generated (at line 116, column 36) for  (2 * n + 1)
      % expected type  {i: int | sqrt(n) /= 0 OR i >= 0}
  exp_series_scaf3_TCC1: OBLIGATION
    FORALL (n: nat): sqrt(n) /= 0 OR (2 * n + 1) >= 0;


decl_type: tcc
theory: ln_exp_series_alt
library: lnexp_fnd
signature: nil
location: 355 0 357 999
body:
  % Subtype TCC generated (at line 122, column 38) for  expT(x)
      % expected type  (conv_series?)
  exp_series_TCC1: OBLIGATION FORALL (x: real): conv_series?(expT(x));


decl_type: formula
theory: ln_exp_ineq
library: lnexp_fnd
signature: nil
location: 37 2 38 38
body:
    ln_ineq1:  LEMMA xgtm1/(1+xgtm1) < ln(1+xgtm1) AND
                     ln(1+xgtm1) < xgtm1                                 % 4.1.33


decl_type: tcc
theory: ln_exp_ineq
library: lnexp_fnd
signature: nil
location: 62 0 64 999
body:
  % Subtype TCC generated (at line 37, column 26) for  (1 + xgtm1)
      % expected type  nznum
  ln_ineq1_TCC1: OBLIGATION FORALL (xgtm1: nzreal_gt_m1): (1 + xgtm1) /= 0;


decl_type: tcc
theory: ln_exp_ineq
library: lnexp_fnd
signature: nil
location: 66 0 69 999
body:
  % Subtype TCC generated (at line 37, column 40) for  1 + xgtm1
      % expected type  posreal
  ln_ineq1_TCC2: OBLIGATION
    FORALL (xgtm1: nzreal_gt_m1): 1 + xgtm1 >= 0 AND 1 + xgtm1 > 0;


decl_type: tcc
theory: ln_exp_ineq
library: lnexp_fnd
signature: nil
location: 71 0 74 999
body:
  % Subtype TCC generated (at line 40, column 30) for  1 - xlt1
      % expected type  posreal
  ln_ineq2_TCC1: OBLIGATION
    FORALL (xlt1: nzreal_lt1): 1 - xlt1 >= 0 AND 1 - xlt1 > 0;


decl_type: tcc
theory: ln_exp_ineq
library: lnexp_fnd
signature: nil
location: 76 0 79 999
body:
  % Subtype TCC generated (at line 40, column 62) for  (1 - xlt1)
      % expected type  nznum
  ln_ineq2_TCC2: OBLIGATION
    FORALL (xlt1: nzreal_lt1): xlt1 < -ln(1 - xlt1) IMPLIES (1 - xlt1) /= 0;


decl_type: tcc
theory: ln_exp_ineq
library: lnexp_fnd
signature: nil
location: 81 0 85 999
body:
  % Subtype TCC generated (at line 42, column 51) for  1 - px
      % expected type  posreal
  ln_ineq3_TCC1: OBLIGATION
    FORALL (px: posreal):
      px <= 5828 / 10000 IMPLIES 1 - px >= 0 AND 1 - px > 0;


decl_type: tcc
theory: ln_exp_ineq
library: lnexp_fnd
signature: nil
location: 87 0 90 999
body:
  % Subtype TCC generated (at line 48, column 26) for  1 + xalt1
      % expected type  posreal
  ln_ineq6_TCC1: OBLIGATION
    FORALL (xalt1: real_abs_lt1): 1 + xalt1 >= 0 AND 1 + xalt1 > 0;


decl_type: tcc
theory: ln_exp_ineq
library: lnexp_fnd
signature: nil
location: 92 0 95 999
body:
  % Subtype TCC generated (at line 48, column 43) for  1 - abs(xalt1)
      % expected type  posreal
  ln_ineq6_TCC2: OBLIGATION
    FORALL (xalt1: real_abs_lt1): 1 - abs(xalt1) >= 0 AND 1 - abs(xalt1) > 0;


decl_type: tcc
theory: ln_exp_ineq
library: lnexp_fnd
signature: nil
location: 97 0 99 999
body:
  % Subtype TCC generated (at line 50, column 30) for  (1 - xlt1)
      % expected type  nznum
  exp_ineq1_TCC1: OBLIGATION FORALL (xlt1: nzreal_lt1): (1 - xlt1) /= 0;


decl_type: tcc
theory: expt
library: lnexp_fnd
signature: nil
location: 95 0 99 999
body:
  % Subtype TCC generated (at line 23, column 72) for  a
      % expected type  posreal
  doublecaret_TCC1: OBLIGATION
    FORALL (a: nnreal, x: {r: real | a /= 0 OR r /= 0}):
      NOT a = 0 IMPLIES a > 0;


decl_type: tcc
theory: expt
library: lnexp_fnd
signature: nil
location: 101 0 104 999
body:
  % Subtype TCC generated (at line 31, column 28) for  (n + m)
      % expected type  {r: real | a /= 0 OR r /= 0}
  hathat_sum_TCC1: OBLIGATION
    FORALL (a: posreal, m, n: nat): a /= 0 OR (n + m) /= 0;


decl_type: tcc
theory: expt
library: lnexp_fnd
signature: nil
location: 106 0 108 999
body:
  % Subtype TCC generated (at line 31, column 41) for  n
      % expected type  {r: real | a /= 0 OR r /= 0}
  hathat_sum_TCC2: OBLIGATION FORALL (a: posreal, n: nat): a /= 0 OR n /= 0;


decl_type: tcc
theory: expt
library: lnexp_fnd
signature: nil
location: 110 0 113 999
body:
  % Subtype TCC generated (at line 32, column 28) for  (n - m)
      % expected type  {r: real | a /= 0 OR r /= 0}
  hathat_diff_TCC1: OBLIGATION
    FORALL (a: posreal, m, n: nat): a /= 0 OR (n - m) /= 0;


decl_type: tcc
theory: expt
library: lnexp_fnd
signature: nil
location: 115 0 117 999
body:
  % Subtype TCC generated (at line 32, column 45) for  (a ^^ m)
      % expected type  nznum
  hathat_diff_TCC2: OBLIGATION FORALL (a: posreal, m: nat): (a ^^ m) /= 0;


decl_type: tcc
theory: expt
library: lnexp_fnd
signature: nil
location: 119 0 121 999
body:
  % Subtype TCC generated (at line 34, column 28) for  0
      % expected type  {r: real | px /= 0 OR r /= 0}
  hathat_to_0_TCC1: OBLIGATION FORALL (px: posreal): px /= 0 OR 0 /= 0;


decl_type: tcc
theory: expt
library: lnexp_fnd
signature: nil
location: 123 0 125 999
body:
  % Subtype TCC generated (at line 36, column 27) for  1
      % expected type  {r: real | a /= 0 OR r /= 0}
  hathat_to_1_TCC1: OBLIGATION FORALL (a: posreal): a /= 0 OR 1 /= 0;


decl_type: tcc
theory: expt
library: lnexp_fnd
signature: nil
location: 127 0 129 999
body:
  % Subtype TCC generated (at line 42, column 33) for  n
      % expected type  {i: int | a /= 0 OR i >= 0}
  hathat_nat_TCC1: OBLIGATION FORALL (a: posreal, n: nat): a /= 0 OR n >= 0;


decl_type: tcc
theory: expt
library: lnexp_fnd
signature: nil
location: 131 0 134 999
body:
  % Subtype TCC generated (at line 44, column 30) for  (1 / px)
      % expected type  {r: real | a /= 0 OR r /= 0}
  hathat_lt_cross_TCC1: OBLIGATION
    FORALL (a, px: posreal): a /= 0 OR (1 / px) /= 0;


decl_type: tcc
theory: expt
library: lnexp_fnd
signature: nil
location: 136 0 139 999
body:
  % Subtype TCC generated (at line 44, column 55) for  px
      % expected type  {r: real | b /= 0 OR r /= 0}
  hathat_lt_cross_TCC2: OBLIGATION
    FORALL (a, b, px: posreal): a ^^ (1 / px) < b IMPLIES b /= 0 OR px /= 0;


decl_type: tcc
theory: expt
library: lnexp_fnd
signature: nil
location: 141 0 144 999
body:
  % Subtype TCC generated (at line 46, column 55) for  px
      % expected type  {r: real | b /= 0 OR r /= 0}
  hathat_gt_cross_TCC1: OBLIGATION
    FORALL (a, b, px: posreal): a ^^ (1 / px) > b IMPLIES b /= 0 OR px /= 0;


decl_type: tcc
theory: expt
library: lnexp_fnd
signature: nil
location: 146 0 149 999
body:
  % Subtype TCC generated (at line 48, column 27) for  nzx
      % expected type  {r: real | a /= 0 OR r /= 0}
  hathat_eq_0_TCC1: OBLIGATION
    FORALL (a: posreal, nzx: nzreal): a /= 0 OR nzx /= 0;


decl_type: tcc
theory: expt
library: lnexp_fnd
signature: nil
location: 151 0 154 999
body:
  % Subtype TCC generated (at line 50, column 28) for  x
      % expected type  {r: real | px /= 0 OR r /= 0}
  hathat_eq_1_TCC1: OBLIGATION
    FORALL (px: posreal, x: real): px /= 0 OR x /= 0;


decl_type: tcc
theory: expt
library: lnexp_fnd
signature: nil
location: 156 0 159 999
body:
  % Subtype TCC generated (at line 52, column 49) for  px
      % expected type  {r: real | b /= 0 OR r /= 0}
  hathat_cross_TCC1: OBLIGATION
    FORALL (a, b, px: posreal): a ^^ (1 / px) = b IMPLIES b /= 0 OR px /= 0;


decl_type: tcc
theory: expt
library: lnexp_fnd
signature: nil
location: 161 0 163 999
body:
  % Subtype TCC generated (at line 54, column 28) for  px
      % expected type  {r: real | a /= 0 OR r /= 0}
  hathat_mult_TCC1: OBLIGATION FORALL (a, px: posreal): a /= 0 OR px /= 0;


decl_type: tcc
theory: expt
library: lnexp_fnd
signature: nil
location: 165 0 168 999
body:
  % Subtype TCC generated (at line 54, column 33) for  py
      % expected type  {r: real | (a ^^ px) /= 0 OR r /= 0}
  hathat_mult_TCC2: OBLIGATION
    FORALL (a, px, py: posreal): (a ^^ px) /= 0 OR py /= 0;


decl_type: tcc
theory: expt
library: lnexp_fnd
signature: nil
location: 170 0 173 999
body:
  % Subtype TCC generated (at line 54, column 40) for  (px * py)
      % expected type  {r: real | a /= 0 OR r /= 0}
  hathat_mult_TCC3: OBLIGATION
    FORALL (a, px, py: posreal): a /= 0 OR (px * py) /= 0;


decl_type: tcc
theory: expt
library: lnexp_fnd
signature: nil
location: 175 0 178 999
body:
  % Subtype TCC generated (at line 56, column 32) for  x
      % expected type  {r: real | (a / px) /= 0 OR r /= 0}
  hathat_div_TCC1: OBLIGATION
    FORALL (a, px: posreal, x: real): (a / px) /= 0 OR x /= 0;


decl_type: tcc
theory: expt
library: lnexp_fnd
signature: nil
location: 180 0 182 999
body:
  % Subtype TCC generated (at line 56, column 41) for  px ^^ x
      % expected type  nznum
  hathat_div_TCC2: OBLIGATION FORALL (px: posreal, x: real): px ^^ x /= 0;


decl_type: tcc
theory: expt
library: lnexp_fnd
signature: nil
location: 184 0 187 999
body:
  % Subtype TCC generated (at line 58, column 44) for  x
      % expected type  {r: real | abs(a) /= 0 OR r /= 0}
  hathat_abs_TCC1: OBLIGATION
    FORALL (a: posreal, x: real): abs(a) /= 0 OR x /= 0;


decl_type: tcc
theory: expt
library: lnexp_fnd
signature: nil
location: 189 0 192 999
body:
  % Subtype TCC generated (at line 60, column 49) for  (px + py)
      % expected type  {r: real | a /= 0 OR r /= 0}
  hathat_sum_posreal_TCC1: OBLIGATION
    FORALL (a, px, py: posreal): a /= 0 OR (px + py) /= 0;


decl_type: tcc
theory: expt
library: lnexp_fnd
signature: nil
location: 194 0 197 999
body:
  % Subtype TCC generated (at line 62, column 39) for  (a ^^ py)
      % expected type  nznum
  hathat_diff_posreal_TCC1: OBLIGATION
    FORALL (a, py: posreal): (a ^^ py) /= 0;


decl_type: tcc
theory: expt
library: lnexp_fnd
signature: nil
location: 199 0 202 999
body:
  % Subtype TCC generated (at line 62, column 50) for  (px - py)
      % expected type  {r: real | a /= 0 OR r /= 0}
  hathat_diff_posreal_TCC2: OBLIGATION
    FORALL (a, px, py: posreal): a /= 0 OR (px - py) /= 0;


decl_type: formula
theory: convergence_special
library: lnexp_fnd
signature: nil
location: 39 3 40 63
body:
     conv_x_to_n         : LEMMA abs(x) < 1 IMPLIES 
                                     convergence(LAMBDA n: x^n,0)


decl_type: tcc
theory: convergence_special
library: lnexp_fnd
signature: nil
location: 65 0 68 999
body:
  % Subtype TCC generated (at line 37, column 58) for  (1 / (n + 1))
      % expected type  {r: real | px /= 0 OR r /= 0}
  conv_x_to_1_div_n_TCC1: OBLIGATION
    FORALL (px: posreal, n): px /= 0 OR (1 / (n + 1)) /= 0;


decl_type: tcc
theory: convergence_special
library: lnexp_fnd
signature: nil
location: 70 0 73 999
body:
  % Subtype TCC generated (at line 40, column 59) for  n
      % expected type  {i: int | x /= 0 OR i >= 0}
  conv_x_to_n_TCC1: OBLIGATION
    FORALL (x: real): abs(x) < 1 IMPLIES (FORALL (n): x /= 0 OR n >= 0);


decl_type: tcc
theory: convergence_special
library: lnexp_fnd
signature: nil
location: 75 0 78 999
body:
  % Subtype TCC generated (at line 42, column 40) for  n
      % expected type  {i: int | abs(x) /= 0 OR i >= 0}
  expt_abs_gt_TCC1: OBLIGATION
    FORALL (n: nat, x: real): abs(x) /= 0 OR n >= 0;


decl_type: tcc
theory: convergence_special
library: lnexp_fnd
signature: nil
location: 80 0 82 999
body:
  % Subtype TCC generated (at line 42, column 49) for  n
      % expected type  {i: int | x /= 0 OR i >= 0}
  expt_abs_gt_TCC2: OBLIGATION FORALL (n: nat, x: real): x /= 0 OR n >= 0;


decl_type: formula
theory: ln_series
library: lnexp_fnd
signature: nil
location: 43 3 44 74
body:
     ln_nderiv  : LEMMA nderiv[posreal](n,ln) = IF n = 0 THEN ln ELSE 
                          (LAMBDA (x:posreal): -factorial(n-1)/(-x)^n) ENDIF


decl_type: formula
theory: ln_series
library: lnexp_fnd
signature: nil
location: 57 3 58 62
body:
     ln_estimate_error_bound: LEMMA FORALL (xp:posreal):
       abs(ln(xp+1)-ln_estimate(xp,n)) <= xp ^ (n + 1) / (n + 1)


decl_type: formula
theory: ln_series
library: lnexp_fnd
signature: nil
location: 76 3 77 64
body:
     ln_estimate_increasing_odd: LEMMA FORALL (px,py:real):
       px<=py IMPLIES ln_estimate(px,2*n+1)<=ln_estimate(py,2*n+1)


decl_type: formula
theory: ln_series
library: lnexp_fnd
signature: nil
location: 79 3 80 60
body:
     ln_estimate_increasing_even: LEMMA FORALL (x1,y1:absle1):
       x1<=y1 IMPLIES ln_estimate(x1,2*n)<=ln_estimate(y1,2*n)


decl_type: formula
theory: ln_series
library: lnexp_fnd
signature: nil
location: 82 3 84 66
body:
     lnp1_prep: LEMMA  Integrable?(0,x1,(LAMBDA (u: Gt_m1): 1/(u+1))) AND
                         Integral(1,1+x1,(LAMBDA (t: posreal): 1/t)) = 
                         Integral(0,x1,(LAMBDA (u: Gt_m1): 1/(u+1)))


decl_type: formula
theory: ln_series
library: lnexp_fnd
signature: nil
location: 86 4 88 68
body:
      geom_neg: LEMMA abs(x) < 1 IMPLIES 
                                 convergent?(series(LAMBDA n: (-x) ^ n))  AND
                                 1/(1+x) = inf_sum((LAMBDA n: (-x)^n))


decl_type: formula
theory: ln_series
library: lnexp_fnd
signature: nil
location: 102 4 104 49
body:
      int_geo_neg: LEMMA conv_powerseries?[abslt1](lnp1_seq) AND
                         Integral(0,x1,(LAMBDA (u: {x:real | x > -1}): 1/(u+1))) 
                            = Inf_sum(lnp1_seq)(x1)  % inf Sum - (-1)^n/n x^n


decl_type: tcc
theory: ln_series
library: lnexp_fnd
signature: nil
location: 123 0 126 999
body:
  % Subtype TCC generated (at line 43, column 40) for  ln
      % expected type  nderiv_fun[posreal](n)
  ln_nderiv_TCC1: OBLIGATION
    FORALL (n: nat): derivable_n_times?[posreal](ln, n);


decl_type: tcc
theory: ln_series
library: lnexp_fnd
signature: nil
location: 128 0 130 999
body:
  % Subtype TCC generated (at line 44, column 56) for  n - 1
      % expected type  nat
  ln_nderiv_TCC2: OBLIGATION FORALL (n: nat): NOT n = 0 IMPLIES n - 1 >= 0;


decl_type: tcc
theory: ln_series
library: lnexp_fnd
signature: nil
location: 132 0 136 999
body:
  % Subtype TCC generated (at line 44, column 66) for  n
      % expected type  {i: int | (-x) /= 0 OR i >= 0}
  ln_nderiv_TCC3: OBLIGATION
    FORALL (n: nat):
      NOT n = 0 IMPLIES (FORALL (x: posreal): (-x) /= 0 OR n >= 0);


decl_type: tcc
theory: ln_series
library: lnexp_fnd
signature: nil
location: 138 0 141 999
body:
  % Assuming TCC generated (at line 46, column 13) for
      % series@taylor_series[abslt1]
      % generated from assumption taylor_series.connected_domain
  IMP_taylor_series_TCC1: OBLIGATION connected?[abslt1];


decl_type: tcc
theory: ln_series
library: lnexp_fnd
signature: nil
location: 143 0 146 999
body:
  % Assuming TCC generated (at line 46, column 13) for
      % series@taylor_series[abslt1]
      % generated from assumption taylor_series.not_one_element
  IMP_taylor_series_TCC2: OBLIGATION not_one_element?[abslt1];


decl_type: tcc
theory: ln_series
library: lnexp_fnd
signature: nil
location: 148 0 154 999
body:
  % Assuming TCC generated (at line 46, column 13) for
      % series@taylor_series[abslt1]
      % generated from assumption taylor_series.open
  IMP_taylor_series_TCC3: OBLIGATION
    FORALL (x: abslt1):
      EXISTS (delta: posreal):
        FORALL (y: real): abs(x - y) < delta IMPLIES abs(y) < 1;


decl_type: tcc
theory: ln_series
library: lnexp_fnd
signature: nil
location: 156 0 160 999
body:
  % Assuming TCC generated (at line 46, column 13) for
      % series@taylor_series[abslt1]
      % generated from assumption taylor_series.ball
  IMP_taylor_series_TCC4: OBLIGATION
    FORALL (x: abslt1): abs(x) < 1 IMPLIES abs(-x) < 1;


decl_type: tcc
theory: ln_series
library: lnexp_fnd
signature: nil
location: 162 0 164 999
body:
  % Existence TCC generated (at line 46, column 13) for
      % series@taylor_series[abslt1]
  IMP_taylor_series_TCC5: OBLIGATION EXISTS (x: abslt1): TRUE;


decl_type: tcc
theory: ln_series
library: lnexp_fnd
signature: nil
location: 166 0 168 999
body:
  % Subtype TCC generated (at line 52, column 15) for  0
      % expected type  T_low[nat]
  ln_estimate_TCC1: OBLIGATION 0 >= 0 OR (EXISTS (j: nat): j <= 0);


decl_type: tcc
theory: ln_series
library: lnexp_fnd
signature: nil
location: 170 0 173 999
body:
  % Subtype TCC generated (at line 52, column 17) for  n
      % expected type  T_high[nat]
  ln_estimate_TCC2: OBLIGATION
    FORALL (n: nat): n >= 0 OR (EXISTS (j: nat): n <= j);


decl_type: tcc
theory: ln_series
library: lnexp_fnd
signature: nil
location: 175 0 178 999
body:
  % Subtype TCC generated (at line 52, column 63) for  nn
      % expected type  {i: int | (-x) /= 0 OR i >= 0}
  ln_estimate_TCC3: OBLIGATION
    FORALL (x: real, nn: nat): NOT nn = 0 IMPLIES (-x) /= 0 OR nn >= 0;


decl_type: tcc
theory: ln_series
library: lnexp_fnd
signature: nil
location: 180 0 182 999
body:
  % Subtype TCC generated (at line 52, column 66) for  nn
      % expected type  nznum
  ln_estimate_TCC4: OBLIGATION FORALL (nn: nat): NOT nn = 0 IMPLIES nn /= 0;


decl_type: tcc
theory: ln_series
library: lnexp_fnd
signature: nil
location: 194 0 198 999
body:
  % Subtype TCC generated (at line 55, column 24) for  xgm1 + 1
      % expected type  posreal
  ln_taylors_TCC3: OBLIGATION
    FORALL (xgm1: Gt_m1, c: between[{x: real | x > -1}](1, 1 + xgm1)):
      xgm1 + 1 >= 0 AND xgm1 + 1 > 0;


decl_type: tcc
theory: ln_series
library: lnexp_fnd
signature: nil
location: 200 0 204 999
body:
  % Subtype TCC generated (at line 55, column 61) for  -c
      % expected type  nznum
  ln_taylors_TCC4: OBLIGATION
    FORALL (xgm1: Gt_m1, c: between[{x: real | x > -1}](1, 1 + xgm1)):
      -c /= 0;


decl_type: tcc
theory: ln_series
library: lnexp_fnd
signature: nil
location: 206 0 211 999
body:
  % Subtype TCC generated (at line 55, column 66) for  (n + 1)
      % expected type  {i: int | (xgm1 / -c) /= 0 OR i >= 0}
  ln_taylors_TCC5: OBLIGATION
    FORALL (n: nat, xgm1: Gt_m1,
            c: between[{x: real | x > -1}](1, 1 + xgm1)):
      (xgm1 / -c) /= 0 OR (n + 1) >= 0;


decl_type: tcc
theory: ln_series
library: lnexp_fnd
signature: nil
location: 213 0 216 999
body:
  % Subtype TCC generated (at line 58, column 46) for  (n + 1)
      % expected type  {i: int | xp /= 0 OR i >= 0}
  ln_estimate_error_bound_TCC1: OBLIGATION
    FORALL (n: nat, xp: posreal): xp /= 0 OR (n + 1) >= 0;


decl_type: tcc
theory: ln_series
library: lnexp_fnd
signature: nil
location: 218 0 220 999
body:
  % Subtype TCC generated (at line 74, column 18) for  1 + x1
      % expected type  posreal
  lnp1_TCC1: OBLIGATION FORALL (x1: abslt1): 1 + x1 >= 0 AND 1 + x1 > 0;


decl_type: tcc
theory: ln_series
library: lnexp_fnd
signature: nil
location: 222 0 227 999
body:
  % Subtype TCC generated (at line 74, column 43) for
      % (LAMBDA (t: posreal): 1 / t)
      % expected type  Integrable_funs[posreal](1, 1 + x1)
  lnp1_TCC2: OBLIGATION
    FORALL (x1: abslt1):
      Integrable?[posreal](1, 1 + x1, (LAMBDA (t: posreal): 1 / t));


decl_type: tcc
theory: ln_series
library: lnexp_fnd
signature: nil
location: 229 0 232 999
body:
  % Assuming TCC generated (at line 26, column 13) for
      % analysis@integral_def[posreal]
      % generated from assumption integral_def.connected_domain
  lnp1_TCC3: OBLIGATION connected?[posreal];


decl_type: tcc
theory: ln_series
library: lnexp_fnd
signature: nil
location: 234 0 236 999
body:
  % Subtype TCC generated (at line 82, column 35) for  x1
      % expected type  Gt_m1
  lnp1_prep_TCC1: OBLIGATION FORALL (x1: abslt1): x1 > -1;


decl_type: tcc
theory: ln_series
library: lnexp_fnd
signature: nil
location: 238 0 240 999
body:
  % Subtype TCC generated (at line 82, column 61) for  (u + 1)
      % expected type  nznum
  lnp1_prep_TCC2: OBLIGATION FORALL (u: Gt_m1): (u + 1) /= 0;


decl_type: tcc
theory: ln_series
library: lnexp_fnd
signature: nil
location: 242 0 245 999
body:
  % Subtype TCC generated (at line 87, column 67) for  n
      % expected type  {i: int | (-x) /= 0 OR i >= 0}
  geom_neg_TCC1: OBLIGATION
    FORALL (x: real): abs(x) < 1 IMPLIES (FORALL (n): (-x) /= 0 OR n >= 0);


decl_type: tcc
theory: ln_series
library: lnexp_fnd
signature: nil
location: 247 0 252 999
body:
  % Subtype TCC generated (at line 88, column 34) for  (1 + x)
      % expected type  nznum
  geom_neg_TCC2: OBLIGATION
    FORALL (x: real):
      abs(x) < 1 AND convergent?(series(LAMBDA n: (-x) ^ n)) IMPLIES
       (1 + x) /= 0;


decl_type: tcc
theory: ln_series
library: lnexp_fnd
signature: nil
location: 254 0 259 999
body:
  % Subtype TCC generated (at line 88, column 50) for  (LAMBDA n: (-x) ^ n)
      % expected type  (conv_series?)
  geom_neg_TCC3: OBLIGATION
    FORALL (x: real):
      abs(x) < 1 AND convergent?(series(LAMBDA n: (-x) ^ n)) IMPLIES
       conv_series?(LAMBDA n: (-x) ^ n);


decl_type: tcc
theory: ln_series
library: lnexp_fnd
signature: nil
location: 261 0 263 999
body:
  % Subtype TCC generated (at line 98, column 36) for  0
      % expected type  abslt1
  int_geo_prep_TCC1: OBLIGATION abs(0) < 1;


decl_type: tcc
theory: ln_series
library: lnexp_fnd
signature: nil
location: 265 0 267 999
body:
  % Subtype TCC generated (at line 98, column 67) for  (1 + u)
      % expected type  nznum
  int_geo_prep_TCC2: OBLIGATION FORALL (u: abslt1): (1 + u) /= 0;


decl_type: tcc
theory: ln_series
library: lnexp_fnd
signature: nil
location: 269 0 276 999
body:
  % Subtype TCC generated (at line 103, column 38) for
      % (LAMBDA (u: {x: real | x > -1}): 1 / (u + 1))
      % expected type  Integrable_funs[{x: real | x > -1}](0, x1)
  int_geo_neg_TCC1: OBLIGATION
    FORALL (x1: abslt1):
      conv_powerseries?[abslt1](lnp1_seq) IMPLIES
       Integrable?[{x: real | x > -1}]
           (0, x1, (LAMBDA (u: {x: real | x > -1}): 1 / (u + 1)));


decl_type: formula
theory: ln_approx
library: lnexp_fnd
signature: nil
location: 67 2 69 43
body:
    floor_eq_log_nat_ge_1: LEMMA
      FORALL ((xp:real|xp>=1),(np:posnat|np>1)):
      floor(ln(xp)/ln(np)) = log_nat(xp,np)`1


decl_type: tcc
theory: ln_approx
library: lnexp_fnd
signature: nil
location: 76 0 79 999
body:
  % Subtype TCC generated (at line 25, column 28) for  x + 1
      % expected type  posreal
  ln_le2_bounds_TCC1: OBLIGATION
    FORALL (x: real): x <= 1 AND 0 < x IMPLIES x + 1 >= 0 AND x + 1 > 0;


decl_type: tcc
theory: ln_approx
library: lnexp_fnd
signature: nil
location: 81 0 83 999
body:
  % Subtype TCC generated (at line 31, column 24) for  xgt1
      % expected type  {x: real | x >= 1}
  ln_gt1_lb_TCC1: OBLIGATION FORALL (xgt1: {x: posreal | x > 1}): xgt1 >= 1;


decl_type: tcc
theory: ln_approx
library: lnexp_fnd
signature: nil
location: 85 0 88 999
body:
  % Subtype TCC generated (at line 47, column 20) for  x
      % expected type  {x: posreal | x > 1}
  ln_gt1_bounds_TCC1: OBLIGATION
    FORALL (x: real): 1 < x IMPLIES x >= 0 AND x > 0 AND x > 1;


decl_type: tcc
theory: ln_approx
library: lnexp_fnd
signature: nil
location: 90 0 93 999
body:
  % Subtype TCC generated (at line 47, column 28) for  x
      % expected type  posreal
  ln_gt1_bounds_TCC2: OBLIGATION
    FORALL (x: real): 1 < x IMPLIES x >= 0 AND x > 0;


decl_type: tcc
theory: ln_approx
library: lnexp_fnd
signature: nil
location: 95 0 97 999
body:
  % Subtype TCC generated (at line 49, column 53) for  1 / px
      % expected type  {x: posreal | x > 1}
  ln_lb_TCC1: OBLIGATION FORALL (px: posreal): px < 1 IMPLIES 1 / px > 1;


decl_type: tcc
theory: ln_approx
library: lnexp_fnd
signature: nil
location: 99 0 102 999
body:
  % Subtype TCC generated (at line 51, column 52) for  px
      % expected type  {x: posreal | x > 1}
  ln_lb_TCC2: OBLIGATION
    FORALL (px: posreal): NOT px = 1 AND NOT px < 1 IMPLIES px > 1;


decl_type: tcc
theory: ln_approx
library: lnexp_fnd
signature: nil
location: 104 0 107 999
body:
  % Subtype TCC generated (at line 69, column 13) for  xp
      % expected type  posreal
  floor_eq_log_nat_ge_1_TCC1: OBLIGATION
    FORALL ((xp: real | xp >= 1), (np: posnat | np > 1)): xp >= 0 AND xp > 0;


decl_type: tcc
theory: ln_approx
library: lnexp_fnd
signature: nil
location: 109 0 112 999
body:
  % Subtype TCC generated (at line 69, column 17) for  ln(np)
      % expected type  nznum
  floor_eq_log_nat_ge_1_TCC2: OBLIGATION
    FORALL ((xp: real | xp >= 1), (np: posnat | np > 1)): ln(np) /= 0;


decl_type: formula
theory: exp_series
library: lnexp_fnd
signature: nil
location: 31 3 33 61
body:
     exp_series_prep: LEMMA 
                       convergence(LAMBDA n: Taylor_rem(n,exp,0,x,
                                             GET_C(exp,x,n)),0)


decl_type: formula
theory: exp_series
library: lnexp_fnd
signature: nil
location: 42 3 44 71
body:
     exp_taylors: LEMMA EXISTS (c: between[real](0,x)):
                             exp(x) = exp_estimate(x,n)
                                          + exp(c)*x^(n+1)/factorial(n+1)


decl_type: formula
theory: exp_series
library: lnexp_fnd
signature: nil
location: 46 3 47 76
body:
     exp_taylors_err: LEMMA abs(exp(x)-exp_estimate(x,n)) 
                                  <= max(exp(x),1)*abs(x)^(n+1)/factorial(n+1) 


decl_type: formula
theory: exp_series
library: lnexp_fnd
signature: nil
location: 49 3 51 43
body:
     exp_estimate_increasing: LEMMA
       -1 <= x AND x<=y IMPLIES
       exp_estimate(x,n) <= exp_estimate(y,n)


decl_type: tcc
theory: exp_series
library: lnexp_fnd
signature: nil
location: 67 0 70 999
body:
  % Assuming TCC generated (at line 12, column 14) for
      % series@taylor_series[real]
      % generated from assumption taylor_series.connected_domain
  IMP_taylor_series_TCC1: OBLIGATION connected?[real];


decl_type: tcc
theory: exp_series
library: lnexp_fnd
signature: nil
location: 72 0 75 999
body:
  % Assuming TCC generated (at line 12, column 14) for
      % series@taylor_series[real]
      % generated from assumption taylor_series.not_one_element
  IMP_taylor_series_TCC2: OBLIGATION not_one_element?[real];


decl_type: tcc
theory: exp_series
library: lnexp_fnd
signature: nil
location: 77 0 81 999
body:
  % Assuming TCC generated (at line 12, column 14) for
      % series@taylor_series[real]
      % generated from assumption taylor_series.open
  IMP_taylor_series_TCC3: OBLIGATION
    FORALL (x: real): EXISTS (delta: posreal): FORALL (y: real): TRUE;


decl_type: tcc
theory: exp_series
library: lnexp_fnd
signature: nil
location: 83 0 86 999
body:
  % Assuming TCC generated (at line 12, column 14) for
      % series@taylor_series[real]
      % generated from assumption taylor_series.ball
  IMP_taylor_series_TCC4: OBLIGATION FORALL (x: real): TRUE;


decl_type: tcc
theory: exp_series
library: lnexp_fnd
signature: nil
location: 88 0 91 999
body:
  % Assuming TCC generated (at line 27, column 26) for
      % analysis@nth_derivatives[real]
      % generated from assumption nth_derivatives.deriv_domain
  nderiv_exp_TCC1: OBLIGATION deriv_domain?[real];


decl_type: tcc
theory: exp_series
library: lnexp_fnd
signature: nil
location: 93 0 96 999
body:
  % Subtype TCC generated (at line 32, column 56) for  exp
      % expected type  nderiv_fun[real](1 + n)
  exp_series_prep_TCC1: OBLIGATION
    FORALL (n): derivable_n_times?[real](exp, 1 + n);


decl_type: tcc
theory: exp_series
library: lnexp_fnd
signature: nil
location: 98 0 100 999
body:
  % Subtype TCC generated (at line 33, column 49) for  exp
      % expected type  (inf_deriv_fun?[real])
  exp_series_prep_TCC2: OBLIGATION inf_deriv_fun?[real](exp);


decl_type: tcc
theory: exp_series
library: lnexp_fnd
signature: nil
location: 102 0 104 999
body:
  % Subtype TCC generated (at line 37, column 37) for  exp_seq
      % expected type  (conv_powerseries?)
  exp_series_TCC1: OBLIGATION conv_powerseries?[real](exp_seq);


decl_type: tcc
theory: exp_series
library: lnexp_fnd
signature: nil
location: 106 0 108 999
body:
  % Subtype TCC generated (at line 40, column 26) for  1
      % expected type  T_low[nat]
  exp_estimate_TCC1: OBLIGATION 1 >= 0 OR (EXISTS (j: nat): j <= 1);


decl_type: tcc
theory: exp_series
library: lnexp_fnd
signature: nil
location: 110 0 113 999
body:
  % Subtype TCC generated (at line 40, column 28) for  n
      % expected type  T_high[nat]
  exp_estimate_TCC2: OBLIGATION
    FORALL (n: nat): n >= 0 OR (EXISTS (j: nat): n <= j);


decl_type: tcc
theory: exp_series
library: lnexp_fnd
signature: nil
location: 115 0 117 999
body:
  % Subtype TCC generated (at line 40, column 50) for  nn
      % expected type  {i: int | x /= 0 OR i >= 0}
  exp_estimate_TCC3: OBLIGATION FORALL (x: real, nn: nat): x /= 0 OR nn >= 0;


decl_type: tcc
theory: exp_series
library: lnexp_fnd
signature: nil
location: 119 0 122 999
body:
  % Subtype TCC generated (at line 44, column 52) for  (n + 1)
      % expected type  {i: int | x /= 0 OR i >= 0}
  exp_taylors_TCC1: OBLIGATION
    FORALL (n: nat, x: real, c: between[real](0, x)): x /= 0 OR (n + 1) >= 0;


decl_type: tcc
theory: exp_series
library: lnexp_fnd
signature: nil
location: 124 0 127 999
body:
  % Subtype TCC generated (at line 47, column 57) for  (n + 1)
      % expected type  {i: int | abs(x) /= 0 OR i >= 0}
  exp_taylors_err_TCC1: OBLIGATION
    FORALL (n: nat, x: real): abs(x) /= 0 OR (n + 1) >= 0;


decl_type: formula
theory: exp_approx
library: lnexp_fnd
signature: nil
location: 74 2 76 68
body:
    exp_range_test: LEMMA FORALL (kk:subrange(1,exp_approx_int_cutoff)):
      FORALL (nn:subrange(1,exp_approx_term_cutoff+1)):
      exp_estimate(-kk/(kk+1),2*nn)^(kk+1) <= exp_estimate(-1,2*nn)^kk


decl_type: formula
theory: exp_approx
library: lnexp_fnd
signature: nil
location: 78 2 80 128
body:
    exp_range_test_lb: LEMMA FORALL (kk:subrange(1,exp_approx_int_cutoff)):
      FORALL (nn:subrange(1,exp_approx_term_cutoff+1)):
      (exp_estimate(-kk/(kk+1),2*nn)- 1.000001/factorial(2*nn+1))^(kk+1) <= (exp_estimate(-1,2*nn)- 1.000001/factorial(2*nn+1))^kk


decl_type: formula
theory: exp_approx
library: lnexp_fnd
signature: nil
location: 82 2 84 89
body:
    exp_neg_ub_increasing: LEMMA
      LET TT = (LAMBDA (xr:negreal): xr >= - exp_approx_int_cutoff)
      IN n<=exp_approx_term_cutoff IMPLIES increasing?(LAMBDA (xr:(TT)): exp_neg_ub(n, xr))


decl_type: formula
theory: exp_approx
library: lnexp_fnd
signature: nil
location: 86 2 88 89
body:
    exp_neg_lb_increasing: LEMMA
      LET TT = (LAMBDA (xr:negreal): xr >= - exp_approx_int_cutoff)
      IN n<=exp_approx_term_cutoff IMPLIES increasing?(LAMBDA (xr:(TT)): exp_neg_lb(n, xr))


decl_type: formula
theory: exp_approx
library: lnexp_fnd
signature: nil
location: 90 2 93 44
body:
    test: LEMMA
      FORALL (ii:below(1000)):
        LET xx = -30*((ii+1)/(1000)), yy = xx + 1/1000000 IN
          exp_neg_lb(1,xx) <= exp_neg_lb(1,yy)


decl_type: function
theory: exp_approx
library: lnexp_fnd
signature: [[real, nat] -> posreal]
location: 50 2 56 80
body:
    exp_ub_n(x,n): posreal = IF    x < 0 AND x>=-exp_approx_int_cutoff
                                         THEN exp_neg_ub(n,x)
                           ELSIF x<0     THEN exp_neg_ub(n,-exp_approx_int_cutoff)
                           ELSIF x = 0   THEN 1 
                           ELSIF x<=exp_approx_int_cutoff
                                         THEN 1/exp_neg_lb(n,-x)
                                         ELSE max(1/exp_neg_lb(n,-exp_approx_int_cutoff),4^(floor(x)+1)) ENDIF


decl_type: function
theory: exp_approx
library: lnexp_fnd
signature: [[real, nat] -> posreal]
location: 58 2 64 77
body:
    exp_lb_n(x,n): posreal = IF    x < 0 AND x>=-exp_approx_int_cutoff
                                         THEN exp_neg_lb(n,x)
                           ELSIF x < 0   THEN min(exp_neg_lb(n,-exp_approx_int_cutoff),4^floor(x))
                           ELSIF x = 0   THEN 1
                           ELSIF x<=exp_approx_int_cutoff
                                         THEN 1/exp_neg_ub(n,-x)
                                         ELSE max(1/exp_neg_ub(n,-exp_approx_int_cutoff),2^floor(x)) ENDIF


decl_type: function
theory: exp_approx
library: lnexp_fnd
signature: [[real, nat] -> posreal]
location: 66 2 67 65
body:
    exp_ub(x,n): posreal = IF n <= exp_approx_term_cutoff THEN exp_ub_n(x,n)
                           ELSE exp_ub_n(x,exp_approx_term_cutoff) ENDIF


decl_type: function
theory: exp_approx
library: lnexp_fnd
signature: [[real, nat] -> posreal]
location: 69 2 70 65
body:
    exp_lb(x,n): posreal = IF n <= exp_approx_term_cutoff THEN exp_lb_n(x,n)
                           ELSE exp_lb_n(x,exp_approx_term_cutoff) ENDIF


decl_type: tcc
theory: exp_approx
library: lnexp_fnd
signature: nil
location: 124 0 127 999
body:
  % Subtype TCC generated (at line 41, column 73) for  pn
      % expected type  nznum
  exp_neg_ub_TCC1: OBLIGATION
    FORALL (nx: negreal, pn: int): pn = -floor(nx) IMPLIES pn /= 0;


decl_type: tcc
theory: exp_approx
library: lnexp_fnd
signature: nil
location: 129 0 136 999
body:
  % Subtype TCC generated (at line 41, column 77) for  pn
      % expected type  {i: int |
                     %          NOT exp_neg_le1_ub(1 + n, nx / pn) = 0 OR
                     %           i >= 0}
  exp_neg_ub_TCC2: OBLIGATION
    FORALL (n: nat, nx: negreal, pn: int):
      pn = -floor(nx) IMPLIES
       NOT exp_neg_le1_ub(1 + n, nx / pn) = 0 OR pn >= 0;


decl_type: tcc
theory: exp_approx
library: lnexp_fnd
signature: nil
location: 138 0 145 999
body:
  % Subtype TCC generated (at line 41, column 51) for
      % exp_neg_le1_ub(n + 1, nx / pn) ^ pn
      % expected type  posreal
  exp_neg_ub_TCC3: OBLIGATION
    FORALL (n: nat, nx: negreal, pn: int):
      pn = -floor(nx) IMPLIES
       exp_neg_le1_ub(n + 1, nx / pn) ^ pn >= 0 AND
        exp_neg_le1_ub(n + 1, nx / pn) ^ pn > 0;


decl_type: tcc
theory: exp_approx
library: lnexp_fnd
signature: nil
location: 147 0 154 999
body:
  % Subtype TCC generated (at line 43, column 77) for  pn
      % expected type  {i: int |
                     %          NOT exp_neg_le1_lb(1 + n, nx / pn) = 0 OR
                     %           i >= 0}
  exp_neg_lb_TCC1: OBLIGATION
    FORALL (n: nat, nx: negreal, pn: int):
      pn = -floor(nx) IMPLIES
       NOT exp_neg_le1_lb(1 + n, nx / pn) = 0 OR pn >= 0;


decl_type: tcc
theory: exp_approx
library: lnexp_fnd
signature: nil
location: 156 0 163 999
body:
  % Subtype TCC generated (at line 43, column 51) for
      % exp_neg_le1_lb(n + 1, nx / pn) ^ pn
      % expected type  posreal
  exp_neg_lb_TCC2: OBLIGATION
    FORALL (n: nat, nx: negreal, pn: int):
      pn = -floor(nx) IMPLIES
       exp_neg_le1_lb(n + 1, nx / pn) ^ pn >= 0 AND
        exp_neg_le1_lb(n + 1, nx / pn) ^ pn > 0;


decl_type: tcc
theory: exp_approx
library: lnexp_fnd
signature: nil
location: 165 0 168 999
body:
  % Subtype TCC generated (at line 51, column 52) for  x
      % expected type  negreal
  exp_ub_n_TCC1: OBLIGATION
    FORALL (x: real): x < 0 AND x >= -60 IMPLIES x <= 0;


decl_type: tcc
theory: exp_approx
library: lnexp_fnd
signature: nil
location: 170 0 175 999
body:
  % Subtype TCC generated (at line 55, column 31) for  -x
      % expected type  negreal
  exp_ub_n_TCC2: OBLIGATION
    FORALL (x: real):
      x <= 60 AND NOT x = 0 AND NOT x < 0 AND NOT (x < 0 AND x >= -60)
       IMPLIES -x <= 0 AND -x < 0;


decl_type: tcc
theory: exp_approx
library: lnexp_fnd
signature: nil
location: 177 0 183 999
body:
  % Subtype TCC generated (at line 76, column 35) for  (kk + 1)
      % expected type  {i: int |
                     %          NOT exp_estimate(-kk / (1 + kk), 2 * nn) = 0
                     %           OR i >= 0}
  exp_range_test_TCC1: OBLIGATION
    FORALL (kk: subrange(1, 60), nn: subrange(1, 30 + 1)):
      NOT exp_estimate(-kk / (1 + kk), 2 * nn) = 0 OR (kk + 1) >= 0;


decl_type: tcc
theory: exp_approx
library: lnexp_fnd
signature: nil
location: 185 0 189 999
body:
  % Subtype TCC generated (at line 76, column 66) for  kk
      % expected type  {i: int | exp_estimate(-1, 2 * nn) /= 0 OR i >= 0}
  exp_range_test_TCC2: OBLIGATION
    FORALL (kk: subrange(1, 60), nn: subrange(1, 30 + 1)):
      exp_estimate(-1, 2 * nn) /= 0 OR kk >= 0;


decl_type: tcc
theory: exp_approx
library: lnexp_fnd
signature: nil
location: 191 0 204 999
body:
  % Subtype TCC generated (at line 80, column 65) for  (kk + 1)
      % expected type  {i: int |
                     %          NOT (exp_estimate(-kk / (1 + kk), 2 * nn) -
                     %                1000001/1000000
                     %                /
                     %                factorial(1 + 2 * nn))
                     %               = 0
                     %           OR i >= 0}
  exp_range_test_lb_TCC1: OBLIGATION
    FORALL (kk: subrange(1, 60), nn: subrange(1, 30 + 1)):
      NOT (exp_estimate(-kk / (1 + kk), 2 * nn) -
            1000001/1000000 / factorial(1 + 2 * nn))
           = 0
       OR (kk + 1) >= 0;


decl_type: tcc
theory: exp_approx
library: lnexp_fnd
signature: nil
location: 206 0 219 999
body:
  % Subtype TCC generated (at line 80, column 126) for  kk
      % expected type  {i: int |
                     %          NOT (exp_estimate(-1, 2 * nn) -
                     %                1000001/1000000
                     %                /
                     %                factorial(1 + 2 * nn))
                     %               = 0
                     %           OR i >= 0}
  exp_range_test_lb_TCC2: OBLIGATION
    FORALL (kk: subrange(1, 60), nn: subrange(1, 30 + 1)):
      NOT (exp_estimate(-1, 2 * nn) -
            1000001/1000000 / factorial(1 + 2 * nn))
           = 0
       OR kk >= 0;


decl_type: tcc
theory: exp_approx
library: lnexp_fnd
signature: nil
location: 221 0 226 999
body:
  % Subtype TCC generated (at line 93, column 21) for  xx
      % expected type  negreal
  test_TCC1: OBLIGATION
    FORALL (ii: below(1000), xx: nzrat):
      xx = -30 * ((ii + 1) / (1000)) IMPLIES
       (FORALL (yy: rat): yy = xx + 1 / 1000000 IMPLIES xx <= 0 AND xx < 0);


decl_type: tcc
theory: exp_approx
library: lnexp_fnd
signature: nil
location: 228 0 233 999
body:
  % Subtype TCC generated (at line 93, column 41) for  yy
      % expected type  negreal
  test_TCC2: OBLIGATION
    FORALL (ii: below(1000), xx: nzrat):
      xx = -30 * ((ii + 1) / (1000)) IMPLIES
       (FORALL (yy: rat): yy = xx + 1 / 1000000 IMPLIES yy <= 0 AND yy < 0);


decl_type: tcc
theory: exp_approx
library: lnexp_fnd
signature: nil
location: 235 0 237 999
body:
  % Judgement subtype TCC generated (at line 117, column 22) for  e
      % expected type  {x: posreal | e_lb < e AND e < e_ub}
  e_bound: OBLIGATION e_lb < e AND e < e_ub;


decl_type: formula
theory: hyperbolic
library: lnexp_fnd
signature: nil
location: 185 2 186 78
body:
    sinh_taylors: LEMMA EXISTS (c: between[real](0,x)):                  % 4.5.62
               sinh(x) = sinh_series_n(x,n) + cosh(c)*x^(2*n+3)/factorial(2*n+3)


decl_type: formula
theory: hyperbolic
library: lnexp_fnd
signature: nil
location: 219 2 220 78
body:
    acosh_derivable2: LEMMA
                       derivable?[posreal_gt1](LAMBDA (x:posreal_gt1): acosh(x))


decl_type: formula
theory: hyperbolic
library: lnexp_fnd
signature: nil
location: 223 2 224 69
body:
    deriv_asinh:      LEMMA deriv(asinh)                                % 4.6.37
                                  =  (LAMBDA (x:real): 1/sqrt(1+sq(x)))


decl_type: formula
theory: hyperbolic
library: lnexp_fnd
signature: nil
location: 225 2 227 75
body:
    deriv_acosh:      LEMMA                                              % 4.6.38
                deriv[posreal_gt1](LAMBDA (x:posreal_gt1): acosh(x))
                                  = (LAMBDA (x:posreal_gt1): 1/sqrt(sq(x)-1))


decl_type: formula
theory: hyperbolic
library: lnexp_fnd
signature: nil
location: 228 2 229 73
body:
    deriv_atanh:      LEMMA deriv[real_abs_lt1](atanh)                   % 4.6.39
                                  =  (LAMBDA (x:real_abs_lt1): 1/(1-sq(x)))


decl_type: formula
theory: hyperbolic
library: lnexp_fnd
signature: nil
location: 243 2 244 71
body:
    atanh_taylors_prep1: LEMMA
      derivable_n_times?(atanhN(n),m) AND derivable_n_times?(atanhD(n),m)


decl_type: formula
theory: hyperbolic
library: lnexp_fnd
signature: nil
location: 246 2 250 13
body:
    atanh_taylors_prep2: LEMMA
      deriv(atanhN(n))
        = IF n = 0 THEN const_fun(0)
                   ELSE polynomial(LAMBDA (i:nat): (i+1)*atanhF(n)(i+1),2*n-1)
          ENDIF


decl_type: formula
theory: hyperbolic
library: lnexp_fnd
signature: nil
location: 252 2 254 72
body:
    atanh_taylors_prep3: LEMMA
      deriv(atanhD(n)) = (LAMBDA (z:real): -(4*n+2)*z*
                      IF n = 0 THEN 1 ELSE (1-sq(z))*atanhD(n-1)(z) ENDIF)


decl_type: formula
theory: hyperbolic
library: lnexp_fnd
signature: nil
location: 256 2 260 13
body:
    atanh_taylors_prep4: LEMMA
      deriv(deriv(atanhN(n)))
        = IF n = 0 THEN const_fun(0)
                   ELSE polynomial(LAMBDA (i:nat): (i+2)*(i+1)*atanhF(n)(i+2),2*n-2)
          ENDIF


decl_type: formula
theory: hyperbolic
library: lnexp_fnd
signature: nil
location: 262 2 267 77
body:
    atanh_taylors_prep5: LEMMA FORALL (f:[real_abs_lt1->real],
                                       g:[real_abs_lt1->nzreal]):
      derivable?[real_abs_lt1](f) AND derivable?[real_abs_lt1](g) IMPLIES
         derivable?[real_abs_lt1](f/g^pn) AND
         deriv[real_abs_lt1](f/g^pn)
            = (deriv[real_abs_lt1](f)*g-pn*f*deriv[real_abs_lt1](g))/(g^(pn+1))


decl_type: formula
theory: hyperbolic
library: lnexp_fnd
signature: nil
location: 272 2 274 64
body:
    atanh_taylors_prep6: LEMMA
      nderiv[real_abs_lt1](2,LAMBDA (x:real_abs_lt1): atanhN(n)(x)/atanhD(n)(x))
        = (LAMBDA (x:real_abs_lt1): atanhN(n+1)(x)/atanhD(n+1)(x))


decl_type: formula
theory: hyperbolic
library: lnexp_fnd
signature: nil
location: 281 2 285 50
body:
    atanh_nderiv: LEMMA
      nderiv[real_abs_lt1](n,atanh)
        = IF    n = 0    THEN atanh
          ELSIF even?(n) THEN deriv[real_abs_lt1](atanhND(n/2-1))
                         ELSE atanhND((n-1)/2) ENDIF


decl_type: formula
theory: hyperbolic
library: lnexp_fnd
signature: nil
location: 287 2 289 52
body:
    atanh_nderiv_0: LEMMA
      nderiv[real_abs_lt1](n,atanh)(0)
        = IF even?(n) THEN 0 ELSE factorial(n-1) ENDIF


decl_type: formula
theory: hyperbolic
library: lnexp_fnd
signature: nil
location: 297 2 301 78
body:
    atanh_series_eqv: LEMMA
     atanh_series_n(z,n) = sigma(0,2*n+2,
        LAMBDA (nn:nat): IF nn > 2*n+2 OR nn = 0 THEN 0 ELSE
                           nderiv[real_abs_lt1](nn,atanh)(0)*
                                                       z^nn/factorial(nn) ENDIF)


decl_type: formula
theory: hyperbolic
library: lnexp_fnd
signature: nil
location: 303 2 306 79
body:
    atanh_taylors: LEMMA (EXISTS (c: between[real_abs_lt1](0,z)): 
                 atanh(z) = atanh_series_n(z,n) + 
                                   nderiv[real_abs_lt1](2*n+3,atanh)(c)*
                                                      z^(2*n+3)/factorial(2*n+3))


decl_type: formula
theory: hyperbolic
library: lnexp_fnd
signature: nil
location: 308 2 309 78
body:
    atanh_series: LEMMA abs(atanh(z)-atanh_series_n(z,n)) <=
                     ((1+z)^(2*n+3)+(1-z)^(2*n+3))/(2*(2*n+3)*(1-sq(z))^(2*n+3))


decl_type: tcc
theory: hyperbolic
library: lnexp_fnd
signature: nil
location: 316 0 318 999
body:
  % Subtype TCC generated (at line 59, column 34) for  (exp(x) + exp(-x)) / 2
      % expected type  posreal_ge1
  cosh_TCC1: OBLIGATION FORALL (x: real): (exp(x) + exp(-x)) / 2 >= 1;


decl_type: tcc
theory: hyperbolic
library: lnexp_fnd
signature: nil
location: 320 0 322 999
body:
  % Subtype TCC generated (at line 60, column 42) for  cosh(x)
      % expected type  nznum
  tanh_TCC1: OBLIGATION FORALL (x: real): cosh(x) /= 0;


decl_type: tcc
theory: hyperbolic
library: lnexp_fnd
signature: nil
location: 324 0 327 999
body:
  % Subtype TCC generated (at line 60, column 34) for  sinh(x) / cosh(x)
      % expected type  real_abs_lt1
  tanh_TCC2: OBLIGATION
    FORALL (x: real): -1 < sinh(x) / cosh(x) & sinh(x) / cosh(x) < 1;


decl_type: tcc
theory: hyperbolic
library: lnexp_fnd
signature: nil
location: 329 0 331 999
body:
  % Subtype TCC generated (at line 61, column 36) for  sinh(n0x)
      % expected type  nznum
  csch_TCC1: OBLIGATION FORALL (n0x: nzreal): sinh(n0x) /= 0;


decl_type: tcc
theory: hyperbolic
library: lnexp_fnd
signature: nil
location: 333 0 337 999
body:
  % Subtype TCC generated (at line 62, column 34) for  1 / cosh(x)
      % expected type  posreal_le1
  sech_TCC1: OBLIGATION
    FORALL (x: real):
      1 / cosh(x) >= 0 AND 1 / cosh(x) > 0 AND 1 / cosh(x) <= 1;


decl_type: tcc
theory: hyperbolic
library: lnexp_fnd
signature: nil
location: 339 0 341 999
body:
  % Subtype TCC generated (at line 63, column 36) for  tanh(n0x)
      % expected type  nznum
  coth_TCC1: OBLIGATION FORALL (n0x: nzreal): tanh(n0x) /= 0;


decl_type: tcc
theory: hyperbolic
library: lnexp_fnd
signature: nil
location: 343 0 346 999
body:
  % Subtype TCC generated (at line 63, column 34) for  1 / tanh(n0x)
      % expected type  real_abs_gt1
  coth_TCC2: OBLIGATION
    FORALL (n0x: nzreal): 1 / tanh(n0x) < -1 OR 1 < 1 / tanh(n0x);


decl_type: tcc
theory: hyperbolic
library: lnexp_fnd
signature: nil
location: 348 0 351 999
body:
  % Subtype TCC generated (at line 68, column 42) for  csch(px)
      % expected type  posreal
  posreal_csch_TCC1: OBLIGATION
    FORALL (px: posreal): csch(px) >= 0 AND csch(px) > 0;


decl_type: tcc
theory: hyperbolic
library: lnexp_fnd
signature: nil
location: 353 0 355 999
body:
  % Subtype TCC generated (at line 70, column 42) for  coth(px)
      % expected type  posreal_gt1
  posreal_coth_TCC1: OBLIGATION FORALL (px: posreal): coth(px) > 1;


decl_type: tcc
theory: hyperbolic
library: lnexp_fnd
signature: nil
location: 357 0 360 999
body:
  % Subtype TCC generated (at line 112, column 50) for
      % (1 + tanh(x) * tanh(y))
      % expected type  nznum
  tanh_sum_TCC1: OBLIGATION FORALL (x, y: real): (1 + tanh(x) * tanh(y)) /= 0;


decl_type: tcc
theory: hyperbolic
library: lnexp_fnd
signature: nil
location: 362 0 367 999
body:
  % Subtype TCC generated (at line 115, column 56) for
      % (coth(n0x) + coth(n0y))
      % expected type  nznum
  coth_sum_TCC1: OBLIGATION
    FORALL (n0x, n0y: nzreal):
      n0x + n0y /= 0 IMPLIES (coth(n0x) + coth(n0y)) /= 0;


decl_type: tcc
theory: hyperbolic
library: lnexp_fnd
signature: nil
location: 369 0 371 999
body:
  % Subtype TCC generated (at line 119, column 45) for  (cosh(x) - 1) / 2
      % expected type  nnx: nonneg_real
  sinh_half_TCC1: OBLIGATION FORALL (x: real): (cosh(x) - 1) / 2 >= 0;


decl_type: tcc
theory: hyperbolic
library: lnexp_fnd
signature: nil
location: 373 0 375 999
body:
  % Subtype TCC generated (at line 121, column 37) for  (cosh(x) + 1) / 2
      % expected type  nnx: nonneg_real
  cosh_half_TCC1: OBLIGATION FORALL (x: real): (cosh(x) + 1) / 2 >= 0;


decl_type: tcc
theory: hyperbolic
library: lnexp_fnd
signature: nil
location: 377 0 379 999
body:
  % Subtype TCC generated (at line 122, column 58) for  (cosh(x) + 1)
      % expected type  nznum
  tanh_half1_TCC1: OBLIGATION FORALL (x: real): (cosh(x) + 1) /= 0;


decl_type: tcc
theory: hyperbolic
library: lnexp_fnd
signature: nil
location: 381 0 385 999
body:
  % Subtype TCC generated (at line 122, column 45) for
      % (cosh(x) - 1) / (cosh(x) + 1)
      % expected type  nnx: nonneg_real
  tanh_half1_TCC2: OBLIGATION
    FORALL (x: real): (cosh(x) - 1) / (cosh(x) + 1) >= 0;


decl_type: tcc
theory: hyperbolic
library: lnexp_fnd
signature: nil
location: 387 0 389 999
body:
  % Subtype TCC generated (at line 130, column 43) for  (1 - sq(tanh(x)))
      % expected type  nznum
  sinh2x_B_TCC1: OBLIGATION FORALL (x: real): (1 - sq(tanh(x))) /= 0;


decl_type: tcc
theory: hyperbolic
library: lnexp_fnd
signature: nil
location: 391 0 393 999
body:
  % Subtype TCC generated (at line 135, column 54) for  3
      % expected type  {i: int | sinh(x) /= 0 OR i >= 0}
  sinh3x_TCC1: OBLIGATION FORALL (x: real): sinh(x) /= 0 OR 3 >= 0;


decl_type: tcc
theory: hyperbolic
library: lnexp_fnd
signature: nil
location: 395 0 397 999
body:
  % Subtype TCC generated (at line 140, column 72) for  4
      % expected type  {i: int | sinh(x) /= 0 OR i >= 0}
  cosh4x_TCC1: OBLIGATION FORALL (x: real): sinh(x) /= 0 OR 4 >= 0;


decl_type: tcc
theory: hyperbolic
library: lnexp_fnd
signature: nil
location: 399 0 401 999
body:
  % Subtype TCC generated (at line 154, column 49) for  (cosh(x) * cosh(y))
      % expected type  nznum
  sum_tanh_TCC1: OBLIGATION FORALL (x, y: real): (cosh(x) * cosh(y)) /= 0;


decl_type: tcc
theory: hyperbolic
library: lnexp_fnd
signature: nil
location: 403 0 407 999
body:
  % Subtype TCC generated (at line 156, column 53) for
      % (sinh(n0x) * sinh(n0y))
      % expected type  nznum
  sum_coth_TCC1: OBLIGATION
    FORALL (n0x, n0y: nzreal): (sinh(n0x) * sinh(n0y)) /= 0;


decl_type: tcc
theory: hyperbolic
library: lnexp_fnd
signature: nil
location: 409 0 412 999
body:
  % Subtype TCC generated (at line 167, column 47) for  n
      % expected type  {i: int | (cosh(x) + sinh(x)) /= 0 OR i >= 0}
  hyperbolic_deMoivre_TCC1: OBLIGATION
    FORALL (n: nat, x: real): (cosh(x) + sinh(x)) /= 0 OR n >= 0;


decl_type: tcc
theory: hyperbolic
library: lnexp_fnd
signature: nil
location: 414 0 417 999
body:
  % Assuming TCC generated (at line 29, column 12) for
      % analysis@derivatives[real]
      % generated from assumption derivatives.deriv_domain
  sinh_derivable2_TCC1: OBLIGATION deriv_domain?[real];


decl_type: tcc
theory: hyperbolic
library: lnexp_fnd
signature: nil
location: 419 0 422 999
body:
  % Assuming TCC generated (at line 29, column 12) for
      % analysis@derivatives[real]
      % generated from assumption derivatives.not_one_element
  sinh_derivable2_TCC2: OBLIGATION not_one_element?[real];


decl_type: tcc
theory: hyperbolic
library: lnexp_fnd
signature: nil
location: 424 0 426 999
body:
  % Subtype TCC generated (at line 176, column 32) for  sinh
      % expected type  deriv_fun[real]
  deriv_sinh_TCC1: OBLIGATION derivable?[real](sinh);


decl_type: tcc
theory: hyperbolic
library: lnexp_fnd
signature: nil
location: 428 0 430 999
body:
  % Subtype TCC generated (at line 177, column 32) for  cosh
      % expected type  deriv_fun[real]
  deriv_cosh_TCC1: OBLIGATION derivable?[real](cosh);


decl_type: tcc
theory: hyperbolic
library: lnexp_fnd
signature: nil
location: 432 0 434 999
body:
  % Subtype TCC generated (at line 178, column 32) for  tanh
      % expected type  deriv_fun[real]
  deriv_tanh_TCC1: OBLIGATION derivable?[real](tanh);


decl_type: tcc
theory: hyperbolic
library: lnexp_fnd
signature: nil
location: 436 0 439 999
body:
  % Subtype TCC generated (at line 183, column 14) for  n
      % expected type  T_high[nat]
  sinh_series_n_TCC1: OBLIGATION
    FORALL (n: nat): n >= 0 OR (EXISTS (j: nat): n <= j);


decl_type: tcc
theory: hyperbolic
library: lnexp_fnd
signature: nil
location: 441 0 444 999
body:
  % Subtype TCC generated (at line 183, column 35) for  (2 * i + 1)
      % expected type  {i: int | x /= 0 OR i >= 0}
  sinh_series_n_TCC2: OBLIGATION
    FORALL (x: real, i: nat): x /= 0 OR (2 * i + 1) >= 0;


decl_type: tcc
theory: hyperbolic
library: lnexp_fnd
signature: nil
location: 446 0 448 999
body:
  % Assuming TCC generated (at line 19, column 5) for  analysis@taylors[real]
      % generated from assumption taylors.connected_domain
  sinh_taylors_TCC1: OBLIGATION connected?[real];


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


decl_type: tcc
theory: hyperbolic
library: lnexp_fnd
signature: nil
location: 456 0 459 999
body:
  % Subtype TCC generated (at line 196, column 35) for  x + sqrt(sq(x) + 1)
      % expected type  posreal
  asinh_TCC1: OBLIGATION
    FORALL (x: real): x + sqrt(sq(x) + 1) >= 0 AND x + sqrt(sq(x) + 1) > 0;


decl_type: tcc
theory: hyperbolic
library: lnexp_fnd
signature: nil
location: 461 0 463 999
body:
  % Subtype TCC generated (at line 197, column 42) for  sq(x) - 1
      % expected type  nnx: nonneg_real
  acosh_TCC1: OBLIGATION FORALL (x: posreal_ge1): sq(x) - 1 >= 0;


decl_type: tcc
theory: hyperbolic
library: lnexp_fnd
signature: nil
location: 465 0 469 999
body:
  % Subtype TCC generated (at line 197, column 35) for  x + sqrt(sq(x) - 1)
      % expected type  posreal
  acosh_TCC2: OBLIGATION
    FORALL (x: posreal_ge1):
      x + sqrt(sq(x) - 1) >= 0 AND x + sqrt(sq(x) - 1) > 0;


decl_type: tcc
theory: hyperbolic
library: lnexp_fnd
signature: nil
location: 471 0 475 999
body:
  % Subtype TCC generated (at line 197, column 32) for
      % ln(x + sqrt(sq(x) - 1))
      % expected type  nnreal
  acosh_TCC3: OBLIGATION
    FORALL (x: posreal_ge1): ln(x + sqrt(sq(x) - 1)) >= 0;


decl_type: tcc
theory: hyperbolic
library: lnexp_fnd
signature: nil
location: 477 0 479 999
body:
  % Subtype TCC generated (at line 198, column 42) for  (1 - x)
      % expected type  nznum
  atanh_TCC1: OBLIGATION FORALL (x: real_abs_lt1): (1 - x) /= 0;


decl_type: tcc
theory: hyperbolic
library: lnexp_fnd
signature: nil
location: 481 0 485 999
body:
  % Subtype TCC generated (at line 198, column 35) for  (1 + x) / (1 - x)
      % expected type  posreal
  atanh_TCC2: OBLIGATION
    FORALL (x: real_abs_lt1):
      (1 + x) / (1 - x) >= 0 AND (1 + x) / (1 - x) > 0;


decl_type: tcc
theory: hyperbolic
library: lnexp_fnd
signature: nil
location: 487 0 489 999
body:
  % Subtype TCC generated (at line 220, column 75) for  x
      % expected type  posreal_ge1
  acosh_derivable2_TCC1: OBLIGATION FORALL (x: posreal_gt1): x >= 1;


decl_type: tcc
theory: hyperbolic
library: lnexp_fnd
signature: nil
location: 491 0 494 999
body:
  % Assuming TCC generated (at line 24, column 4) for
      % analysis@derivatives[posreal_gt1]
      % generated from assumption derivatives.deriv_domain
  acosh_derivable2_TCC2: OBLIGATION deriv_domain?[posreal_gt1];


decl_type: tcc
theory: hyperbolic
library: lnexp_fnd
signature: nil
location: 496 0 499 999
body:
  % Assuming TCC generated (at line 26, column 4) for
      % analysis@derivatives[posreal_gt1]
      % generated from assumption derivatives.not_one_element
  acosh_derivable2_TCC3: OBLIGATION not_one_element?[posreal_gt1];


decl_type: tcc
theory: hyperbolic
library: lnexp_fnd
signature: nil
location: 501 0 504 999
body:
  % Assuming TCC generated (at line 24, column 4) for
      % analysis@derivatives[real_abs_lt1]
      % generated from assumption derivatives.deriv_domain
  atanh_derivable2_TCC1: OBLIGATION deriv_domain?[real_abs_lt1];


decl_type: tcc
theory: hyperbolic
library: lnexp_fnd
signature: nil
location: 506 0 509 999
body:
  % Assuming TCC generated (at line 26, column 4) for
      % analysis@derivatives[real_abs_lt1]
      % generated from assumption derivatives.not_one_element
  atanh_derivable2_TCC2: OBLIGATION not_one_element?[real_abs_lt1];


decl_type: tcc
theory: hyperbolic
library: lnexp_fnd
signature: nil
location: 511 0 513 999
body:
  % Subtype TCC generated (at line 223, column 32) for  asinh
      % expected type  deriv_fun[real]
  deriv_asinh_TCC1: OBLIGATION derivable?[real](asinh);


decl_type: tcc
theory: hyperbolic
library: lnexp_fnd
signature: nil
location: 515 0 519 999
body:
  % Subtype TCC generated (at line 226, column 33) for
      % LAMBDA (x: posreal_gt1): acosh(x)
      % expected type  deriv_fun[posreal_gt1]
  deriv_acosh_TCC1: OBLIGATION
    derivable?[posreal_gt1](LAMBDA (x: posreal_gt1): acosh(x));


decl_type: tcc
theory: hyperbolic
library: lnexp_fnd
signature: nil
location: 521 0 523 999
body:
  % Subtype TCC generated (at line 227, column 66) for  sq(x) - 1
      % expected type  nnx: nonneg_real
  deriv_acosh_TCC2: OBLIGATION FORALL (x: posreal_gt1): sq(x) - 1 >= 0;


decl_type: tcc
theory: hyperbolic
library: lnexp_fnd
signature: nil
location: 525 0 527 999
body:
  % Subtype TCC generated (at line 227, column 61) for  sqrt(sq(x) - 1)
      % expected type  nznum
  deriv_acosh_TCC3: OBLIGATION FORALL (x: posreal_gt1): sqrt(sq(x) - 1) /= 0;


decl_type: tcc
theory: hyperbolic
library: lnexp_fnd
signature: nil
location: 529 0 531 999
body:
  % Subtype TCC generated (at line 228, column 46) for  atanh
      % expected type  deriv_fun[real_abs_lt1]
  deriv_atanh_TCC1: OBLIGATION derivable?[real_abs_lt1](atanh);


decl_type: tcc
theory: hyperbolic
library: lnexp_fnd
signature: nil
location: 533 0 535 999
body:
  % Subtype TCC generated (at line 229, column 64) for  (1 - sq(x))
      % expected type  nznum
  deriv_atanh_TCC2: OBLIGATION FORALL (x: real_abs_lt1): (1 - sq(x)) /= 0;


decl_type: tcc
theory: hyperbolic
library: lnexp_fnd
signature: nil
location: 537 0 540 999
body:
  % Subtype TCC generated (at line 237, column 63) for  i
      % expected type  {i: nat | i <= 1 + 2 * n}
  atanhF_TCC1: OBLIGATION
    FORALL (n, i: nat): NOT i > 2 * n AND NOT odd?(i) IMPLIES i <= 1 + 2 * n;


decl_type: tcc
theory: hyperbolic
library: lnexp_fnd
signature: nil
location: 542 0 545 999
body:
  % Subtype TCC generated (at line 239, column 42) for  (2 * n + 1)
      % expected type  {i: int | (1 - sq(x)) /= 0 OR i >= 0}
  atanhD_TCC1: OBLIGATION
    FORALL (n: nat, x: real): (1 - sq(x)) /= 0 OR (2 * n + 1) >= 0;


decl_type: tcc
theory: hyperbolic
library: lnexp_fnd
signature: nil
location: 547 0 550 999
body:
  % Subtype TCC generated (at line 247, column 10) for  atanhN(n)
      % expected type  deriv_fun[real]
  atanh_taylors_prep2_TCC1: OBLIGATION
    FORALL (n: nat): derivable?[real](atanhN(n));


decl_type: tcc
theory: hyperbolic
library: lnexp_fnd
signature: nil
location: 552 0 555 999
body:
  % Subtype TCC generated (at line 249, column 70) for  2 * n - 1
      % expected type  nat
  atanh_taylors_prep2_TCC2: OBLIGATION
    FORALL (n: nat): NOT n = 0 IMPLIES 2 * n - 1 >= 0;


decl_type: tcc
theory: hyperbolic
library: lnexp_fnd
signature: nil
location: 557 0 560 999
body:
  % Subtype TCC generated (at line 253, column 10) for  atanhD(n)
      % expected type  deriv_fun[real]
  atanh_taylors_prep3_TCC1: OBLIGATION
    FORALL (n: nat): derivable?[real](atanhD(n));


decl_type: tcc
theory: hyperbolic
library: lnexp_fnd
signature: nil
location: 562 0 565 999
body:
  % Subtype TCC generated (at line 254, column 58) for  n - 1
      % expected type  nat
  atanh_taylors_prep3_TCC2: OBLIGATION
    FORALL (n: nat): NOT n = 0 IMPLIES n - 1 >= 0;


decl_type: tcc
theory: hyperbolic
library: lnexp_fnd
signature: nil
location: 567 0 570 999
body:
  % Subtype TCC generated (at line 257, column 10) for  deriv(atanhN(n))
      % expected type  deriv_fun[real]
  atanh_taylors_prep4_TCC1: OBLIGATION
    FORALL (n: nat): derivable?[real](deriv[real](atanhN(n)));


decl_type: tcc
theory: hyperbolic
library: lnexp_fnd
signature: nil
location: 572 0 575 999
body:
  % Subtype TCC generated (at line 259, column 76) for  2 * n - 2
      % expected type  nat
  atanh_taylors_prep4_TCC2: OBLIGATION
    FORALL (n: nat): NOT n = 0 IMPLIES 2 * n - 2 >= 0;


decl_type: tcc
theory: hyperbolic
library: lnexp_fnd
signature: nil
location: 577 0 583 999
body:
  % Subtype TCC generated (at line 265, column 34) for  g ^ pn
      % expected type  [real_abs_lt1 -> nzreal]
  atanh_taylors_prep5_TCC1: OBLIGATION
    FORALL (pn: posnat, f: [real_abs_lt1 -> real],
            g: [real_abs_lt1 -> nzreal]):
      derivable?[real_abs_lt1](f) AND derivable?[real_abs_lt1](g) IMPLIES
       (FORALL (x1: real_abs_lt1): (^[real_abs_lt1](g, pn))(x1) /= 0);


decl_type: tcc
theory: hyperbolic
library: lnexp_fnd
signature: nil
location: 585 0 593 999
body:
  % Subtype TCC generated (at line 267, column 68) for  (g ^ (pn + 1))
      % expected type  [real_abs_lt1 -> nzreal]
  atanh_taylors_prep5_TCC2: OBLIGATION
    FORALL (pn: posnat, f: [real_abs_lt1 -> real],
            g: [real_abs_lt1 -> nzreal]):
      derivable?[real_abs_lt1](f / g ^ pn) AND
       derivable?[real_abs_lt1](f) AND derivable?[real_abs_lt1](g)
       IMPLIES
       (FORALL (x1: real_abs_lt1): (^[real_abs_lt1](g, (pn + 1)))(x1) /= 0);


decl_type: tcc
theory: hyperbolic
library: lnexp_fnd
signature: nil
location: 595 0 598 999
body:
  % Subtype TCC generated (at line 270, column 47) for  atanhD(n)(x)
      % expected type  nznum
  atanhND_TCC1: OBLIGATION
    FORALL (n: nat, x: real_abs_lt1): atanhD(n)(x) /= 0;


decl_type: tcc
theory: hyperbolic
library: lnexp_fnd
signature: nil
location: 600 0 606 999
body:
  % Subtype TCC generated (at line 273, column 27) for
      % LAMBDA (x: real_abs_lt1): atanhN(n)(x) / atanhD(n)(x)
      % expected type  nderiv_fun[real_abs_lt1](2)
  atanh_taylors_prep6_TCC1: OBLIGATION
    FORALL (n: nat):
      derivable_n_times?[real_abs_lt1]
          (LAMBDA (x: real_abs_lt1): atanhN(n)(x) / atanhD(n)(x), 2);


decl_type: tcc
theory: hyperbolic
library: lnexp_fnd
signature: nil
location: 608 0 611 999
body:
  % Subtype TCC generated (at line 274, column 49) for  atanhD(n + 1)(x)
      % expected type  nznum
  atanh_taylors_prep6_TCC2: OBLIGATION
    FORALL (n: nat, x: real_abs_lt1): atanhD(n + 1)(x) /= 0;


decl_type: tcc
theory: hyperbolic
library: lnexp_fnd
signature: nil
location: 613 0 616 999
body:
  % Subtype TCC generated (at line 279, column 54) for  atanhND(n)
      % expected type  nderiv_fun[real_abs_lt1](2 * m)
  atanh_taylors_prep8_TCC1: OBLIGATION
    FORALL (m, n: nat): derivable_n_times?[real_abs_lt1](atanhND(n), 2 * m);


decl_type: tcc
theory: hyperbolic
library: lnexp_fnd
signature: nil
location: 618 0 621 999
body:
  % Subtype TCC generated (at line 282, column 27) for  atanh
      % expected type  nderiv_fun[real_abs_lt1](n)
  atanh_nderiv_TCC1: OBLIGATION
    FORALL (n: nat): derivable_n_times?[real_abs_lt1](atanh, n);


decl_type: tcc
theory: hyperbolic
library: lnexp_fnd
signature: nil
location: 623 0 628 999
body:
  % Subtype TCC generated (at line 284, column 56) for  n / 2 - 1
      % expected type  nat
  atanh_nderiv_TCC2: OBLIGATION
    FORALL (n: nat):
      NOT n = 0 AND even?(n) IMPLIES
       integer_pred(n / 2 - 1) AND n / 2 - 1 >= 0;


decl_type: tcc
theory: hyperbolic
library: lnexp_fnd
signature: nil
location: 630 0 635 999
body:
  % Subtype TCC generated (at line 284, column 48) for  atanhND(n / 2 - 1)
      % expected type  deriv_fun[real_abs_lt1]
  atanh_nderiv_TCC3: OBLIGATION
    FORALL (n: nat):
      NOT n = 0 AND even?(n) IMPLIES
       derivable?[real_abs_lt1](atanhND(n / 2 - 1));


decl_type: tcc
theory: hyperbolic
library: lnexp_fnd
signature: nil
location: 637 0 642 999
body:
  % Subtype TCC generated (at line 285, column 36) for  (n - 1) / 2
      % expected type  nat
  atanh_nderiv_TCC4: OBLIGATION
    FORALL (n: nat):
      NOT n = 0 AND NOT even?(n) IMPLIES
       integer_pred((n - 1) / 2) AND (n - 1) / 2 >= 0;


decl_type: tcc
theory: hyperbolic
library: lnexp_fnd
signature: nil
location: 644 0 647 999
body:
  % Subtype TCC generated (at line 289, column 42) for  n - 1
      % expected type  nat
  atanh_nderiv_0_TCC1: OBLIGATION
    FORALL (n: nat): NOT even?(n) IMPLIES n - 1 >= 0;


decl_type: tcc
theory: hyperbolic
library: lnexp_fnd
signature: nil
location: 649 0 652 999
body:
  % Subtype TCC generated (at line 294, column 28) for  (2 * n + 1)
      % expected type  {i: int | z /= 0 OR i >= 0}
  atanh_series_term_TCC1: OBLIGATION
    FORALL (z: real_abs_lt1, n: nat): z /= 0 OR (2 * n + 1) >= 0;


decl_type: tcc
theory: hyperbolic
library: lnexp_fnd
signature: nil
location: 654 0 657 999
body:
  % Subtype TCC generated (at line 298, column 33) for  2 * n + 2
      % expected type  T_high[nat]
  atanh_series_eqv_TCC1: OBLIGATION
    FORALL (n: nat): 2 * n + 2 >= 0 OR (EXISTS (j: nat): 2 * n + 2 <= j);


decl_type: tcc
theory: hyperbolic
library: lnexp_fnd
signature: nil
location: 659 0 664 999
body:
  % Subtype TCC generated (at line 300, column 49) for  atanh
      % expected type  nderiv_fun[real_abs_lt1](nn)
  atanh_series_eqv_TCC2: OBLIGATION
    FORALL (n, nn: nat):
      NOT nn > 2 * n + 2 AND NOT nn = 0 IMPLIES
       derivable_n_times?[real_abs_lt1](atanh, nn);


decl_type: tcc
theory: hyperbolic
library: lnexp_fnd
signature: nil
location: 666 0 670 999
body:
  % Subtype TCC generated (at line 301, column 55) for  nn
      % expected type  {i: int | z /= 0 OR i >= 0}
  atanh_series_eqv_TCC3: OBLIGATION
    FORALL (n: nat, z: real_abs_lt1, nn: nat):
      NOT nn > 2 * n + 2 AND NOT nn = 0 IMPLIES z /= 0 OR nn >= 0;


decl_type: tcc
theory: hyperbolic
library: lnexp_fnd
signature: nil
location: 672 0 675 999
body:
  % Assuming TCC generated (at line 19, column 5) for
      % analysis@taylors[real_abs_lt1]
      % generated from assumption taylors.connected_domain
  atanh_taylors_TCC1: OBLIGATION connected?[real_abs_lt1];


decl_type: tcc
theory: hyperbolic
library: lnexp_fnd
signature: nil
location: 677 0 681 999
body:
  % Subtype TCC generated (at line 305, column 60) for  atanh
      % expected type  nderiv_fun[real_abs_lt1](3 + 2 * n)
  atanh_taylors_TCC2: OBLIGATION
    FORALL (n: nat, z: real_abs_lt1, c: between[real_abs_lt1](0, z)):
      derivable_n_times?[real_abs_lt1](atanh, 3 + 2 * n);


decl_type: tcc
theory: hyperbolic
library: lnexp_fnd
signature: nil
location: 683 0 687 999
body:
  % Subtype TCC generated (at line 306, column 55) for  (2 * n + 3)
      % expected type  {i: int | z /= 0 OR i >= 0}
  atanh_taylors_TCC3: OBLIGATION
    FORALL (n: nat, z: real_abs_lt1, c: between[real_abs_lt1](0, z)):
      z /= 0 OR (2 * n + 3) >= 0;


decl_type: tcc
theory: hyperbolic
library: lnexp_fnd
signature: nil
location: 689 0 692 999
body:
  % Subtype TCC generated (at line 309, column 27) for  (2 * n + 3)
      % expected type  {i: int | (1 + z) /= 0 OR i >= 0}
  atanh_series_TCC1: OBLIGATION
    FORALL (n: nat, z: real_abs_lt1): (1 + z) /= 0 OR (2 * n + 3) >= 0;


decl_type: tcc
theory: hyperbolic
library: lnexp_fnd
signature: nil
location: 694 0 699 999
body:
  % Subtype TCC generated (at line 309, column 50) for
      % (2 * (2 * n + 3) * (1 - sq(z)) ^ (2 * n + 3))
      % expected type  nznum
  atanh_series_TCC2: OBLIGATION
    FORALL (n: nat, z: real_abs_lt1):
      (2 * (2 * n + 3) * (1 - sq(z)) ^ (2 * n + 3)) /= 0;


decl_type: formula
theory: matrices
library: matrices
signature: nil
location: 56 2 58 58
body:
    length_matrix_eq: LEMMA 
      FORALL (nn: nat, LL: list[listn[real](nn)]):
        length[list[real]](LL) = length[listn[real](nn)](LL)


decl_type: formula
theory: matrices
library: matrices
signature: nil
location: 60 2 62 57
body:
    nth_matrix_eq : LEMMA
     FORALL (nn: nat, LL: list[listn[real](nn)],i:below[length[list[real]](LL)]):
       nth[listn[real](nn)](LL, i) = nth[list[real]](LL, i)


decl_type: formula
theory: matrices
library: matrices
signature: nil
location: 64 2 66 58
body:
    length_matrix_equiv: LEMMA 
      FORALL (nn: nat, LL: list[listn[real](nn)]):
        length[list[real]](LL) = length[listn[real](nn)](LL)


decl_type: formula
theory: matrices
library: matrices
signature: nil
location: 68 2 70 46
body:
    length_matrix_nth: LEMMA 
      FORALL (nn: nat, LL: list[listn[real](nn)],i:below[length[list[real]](LL)]):
        length[real](nth[list[real]](LL,i)) = nn


decl_type: formula
theory: matrices
library: matrices
signature: nil
location: 72 2 76 40
body:
    matrix_listn_nth: LEMMA
      FORALL (nn: nat, LL: list[listn[real](nn)],i:below[length[list[real]](LL)],
             j:below[length[real](nth[listn[real](nn)](LL,i))]):
        nth[real](nth[listn[real](nn)](LL,i),j)=
        nth[real](nth[list[real]](LL,i),j)


decl_type: formula
theory: matrices
library: matrices
signature: nil
location: 104 2 109 13
body:
    col_def: LEMMA
      length(col(M)(i)) = rows(M) AND
      FORALL (j:below(rows(M))):
        nth(col(M)(i),j) = 
          IF i < length(nth(M,j)) THEN nth(nth(M,j),i)
          ELSE 0 ENDIF


decl_type: formula
theory: matrices
library: matrices
signature: nil
location: 211 2 213 34
body:
    dot_eq_sigma: LEMMA
      dot(v1,v2) = sigma(0,min(length(v1)-1,length(v2)-1),LAMBDA (k:nat):
        access(v1)(k)*access(v2)(k))


decl_type: formula
theory: matrices
library: matrices
signature: nil
location: 239 2 240 42
body:
    columns_form_matrix: LEMMA FORALL (F:[[nat,nat]->real]):
      m=0 OR columns(form_matrix(F,m,n)) = n


decl_type: formula
theory: matrices
library: matrices
signature: nil
location: 245 2 246 48
body:
    form_matrix_empty: LEMMA FORALL (m, n: nat, F:[[nat, nat]->real]):
          m=0  IMPLIES null?(form_matrix(F, m, n)) 


decl_type: formula
theory: matrices
library: matrices
signature: nil
location: 253 2 254 53
body:
    form_matrix_test1: LEMMA form_matrix(FEx,3,3) =  
      (: (: 1, 2, 0 :), (: 3, 4, 5 :), (: 6, 0, 0 :) :)


decl_type: formula
theory: matrices
library: matrices
signature: nil
location: 256 2 259 43
body:
    full_matrix_eq: LEMMA
      SM1=SM2 IFF (rows(SM1)=rows(SM2) AND columns(SM1)=columns(SM2)
        AND FORALL (i:below(rows(SM1)),j:below(columns(SM1))):
              entry(SM1)(i,j)=entry(SM2)(i,j))


decl_type: formula
theory: matrices
library: matrices
signature: nil
location: 264 2 266 45
body:
    entry_form_matrix: LEMMA
      entry(form_matrix(F,m,n))(i,j) = 
        IF i<m AND j<n THEN F(i,j) ELSE 0 ENDIF


decl_type: formula
theory: matrices
library: matrices
signature: nil
location: 272 2 274 51
body:
    form_matrix_eq: LEMMA
      form_matrix(F,m,n)=form_matrix(G,m,n) IFF
      FORALL (i,j): i<m AND j<n IMPLIES F(i,j)=G(i,j)


decl_type: formula
theory: matrices
library: matrices
signature: nil
location: 276 2 278 36
body:
    matrix_reduce_prop: LEMMA FORALL (P:[Matrix->bool]):
      (FORALL (F): P(form_matrix(F,m,n))) IMPLIES
      (FORALL (M:MatrixMN(m,n)): P(M))


decl_type: formula
theory: matrices
library: matrices
signature: nil
location: 299 2 302 55
body:
    mult_null_right: LEMMA
      LET N = M*null[list[real]] IN
        length(N) = length(M) AND
         FORALL (i:below(length(N))): nth(N,i)=null[real]


decl_type: formula
theory: matrices
library: matrices
signature: nil
location: 319 2 321 38
body:
    entry_mult: LEMMA
      entry(M*N)(i,j) = IF i<rows(M) AND j<columns(N) THEN
        row(M)(i)*col(N)(j) ELSE 0 ENDIF


decl_type: formula
theory: matrices
library: matrices
signature: nil
location: 323 2 328 68
body:
    form_matrix_mult: LEMMA 
      FORALL (F,G:[[nat,nat]->real],k,m,n:nat):
        m>0 AND k>0 IMPLIES
        form_matrix(F,k,m)*form_matrix(G,m,n) =
        form_matrix(LAMBDA (i,j:nat): IF i>k OR j>n THEN 0
                           ELSE sigma(0,m-1,LAMBDA (d:nat): F(i,d)*G(d,j)) ENDIF,k,n)


decl_type: formula
theory: matrices
library: matrices
signature: nil
location: 378 2 381 51
body:
    matrix_sub_test: LEMMA
      (: (: 1,2,3 :), (: 4,5,6 :), (: 7,8,9 :) :)-
      (: (: 9,8,7 :), (: 6,5,4 :), (: 3,2,1 :) :) =
      (: (: -8,-6,-4 :), (: -2,0,2 :), (: 4,6,8 :) :)


decl_type: formula
theory: matrices
library: matrices
signature: nil
location: 414 2 415 48
body:
    transpose_mult: LEMMA columns(D1)=rows(D2) IMPLIES
      transpose(D1*D2)=transpose(D2)*transpose(D1)


decl_type: formula
theory: matrices
library: matrices
signature: nil
location: 425 2 427 9
body:
    vect2matrix_eq: LEMMA length(v1)>0 AND length(v2)>0 AND
      vect2matrix(v1)=vect2matrix(v2) IMPLIES
      v1=v2


decl_type: type
theory: matrices
library: matrices
signature: nil
location: 20 2 22 27
body:
    MatrixMN(m,n:nat): TYPE = {M:Matrix |
      length(M)=m AND FORALL (i:below(length(M))):
        length(nth(M,i)) = n}


decl_type: type
theory: matrices
library: matrices
signature: nil
location: 24 2 27 42
body:
    FullMatrix: TYPE = {M:Matrix |
      null?(M) OR
      FORALL (i,j:below(length(M))):
        length(nth(M,i)) = length(nth(M,j))}


decl_type: function
theory: matrices
library: matrices
location: 86 2 93 21
signature:
  [M: Matrix ->
          {c: nat |
                   (FORALL (i: below(length(M))): length(nth(M, i)) <= c)
                    AND
                    (null?(M) AND c = 0 OR
                      (EXISTS (i: below(length(M))):
                         length(nth(M, i)) = c))}]

body:
    columns(M): RECURSIVE {c:nat|
      (FORALL (i:below(length(M))):
        length(nth(M,i))<=c) AND 
      (null?(M) AND c=0 OR EXISTS (i:below(length(M))):
        length(nth(M,i))=c)} =
      IF null?(M) THEN 0
      ELSE max(length(car(M)),columns(cdr(M))) ENDIF
      MEASURE length(M)


decl_type: function
theory: matrices
library: matrices
signature: [M: Matrix -> [nat -> VectorN(rows(M))]]
location: 99 2 102 21
body:
    col(M)(i): RECURSIVE VectorN(rows(M)) =
      IF null?(M) THEN null[real]
      ELSE cons(access(car(M))(i),col(cdr(M))(i)) ENDIF
      MEASURE length(M)


decl_type: function
theory: matrices
library: matrices
signature: [d: [Vector, Vector] -> VectorN(max(length(d`1), length(d`2)))]
location: 167 2 171 33
body:
    add(v1,v2): RECURSIVE VectorN(max(length(v1),length(v2))) =
      IF null?(v1) THEN v2
      ELSIF null?(v2) THEN v1
      ELSE cons(car(v1)+car(v2),add(cdr(v1),cdr(v2))) ENDIF
      MEASURE length(v1)+length(v2)


decl_type: function
theory: matrices
library: matrices
signature: [d: [real, Vector] -> VectorN(length(d`2))]
location: 173 2 176 22
body:
    scal(r,v2): RECURSIVE VectorN(length(v2)) =
      IF null?(v2) THEN v2
      ELSE cons(r*car(v2),scal(r,cdr(v2))) ENDIF
      MEASURE length(v2)


decl_type: function
theory: matrices
library: matrices
signature: [[Vector, Vector] -> real]
location: 181 2 184 34
body:
    dot(v1,v2): RECURSIVE real =
      IF null?(v1) OR null?(v2) THEN 0
      ELSE car(v1)*car(v2)+dot(cdr(v1),cdr(v2)) ENDIF
      MEASURE length(v1)+length(v2);


decl_type: function
theory: matrices
library: matrices
signature: [d: [Vector, Vector] -> {rr: real | rr = dot(d`1, d`2)}]
location: 186 2 190 34
body:
    super_dot(v1,v2): RECURSIVE {rr:real|rr=dot(v1,v2)} =
      IF null?(v1) OR null?(v2) THEN 0
      ELSIF car(v1)=0 THEN dot(cdr(v1),cdr(v2))
      ELSE car(v1)*car(v2)+dot(cdr(v1),cdr(v2)) ENDIF
      MEASURE length(v1)+length(v2);


decl_type: function
theory: matrices
library: matrices
signature: [[[nat -> real], [nat -> real], nat] -> real]
location: 192 2 195 21
body:
    super_duper_dot(FF,GG:[nat->real],kz:nat): RECURSIVE real =
      IF kz = 0 THEN (IF FF(0)=0 THEN 0 ELSE FF(0)*GG(0) ENDIF) 
      ELSE super_duper_dot(FF,GG,kz-1)+(IF FF(kz)=0 THEN 0 ELSE FF(kz)*GG(kz) ENDIF)
      ENDIF MEASURE kz;


decl_type: function
theory: matrices
library: matrices
location: 233 2 237 50
signature:
  [d: [[[nat, nat] -> real], nat, nat] ->
          {M: MatrixMN(d`2, d`3) |
                   FORALL (i: below(d`2), j: below(d`3)):
                     nth(row(M)(i), j) = d`1(i, j)}]

body:
    form_matrix(F:[[nat,nat]->real],m,n:nat):
      {M:MatrixMN(m,n)| FORALL (i:below(m),j:below(n)):
        nth(row(M)(i),j) = F(i,j)} =
      array2list[listn[real](n)](m)(LAMBDA (k:nat): 
        array2list[real](n)(LAMBDA (p:nat): F(k,p)))


decl_type: function
theory: matrices
library: matrices
signature: [[nat, nat] -> real]
location: 248 2 251 41
body:
    FEx(i,j:nat): real =
                  IF i=0 THEN (IF j=0 THEN 1 ELSIF j=1 THEN 2 ELSE 0 ENDIF)
                  ELSIF i=1 THEN IF j=0 THEN 3 ELSIF j=1 THEN 4 ELSE 5 ENDIF
                  ELSIF i=2 AND j=0 THEN 6 ELSE 0 ENDIF


decl_type: function
theory: matrices
library: matrices
location: 286 2 288 79
signature:
  [d: [Matrix, Matrix] ->
          {A: MatrixMN(rows(d`1), columns(d`2)) |
                   FORALL (i, j):
                     entry(A)(i, j) = row(d`1)(i) * col(d`2)(j)}]

body:
    mult(M,N): {A: MatrixMN(rows(M),columns(N))|
      FORALL (i,j): entry(A)(i,j) = row(M)(i)*col(N)(j)}  =
      form_matrix(LAMBDA (i,j:nat): dot(row(M)(i),col(N)(j)),rows(M),columns(N));


decl_type: function
theory: matrices
library: matrices
location: 290 2 291 67
signature:
  [d: [Matrix, Matrix] ->
          {A: MatrixMN(rows(d`1), columns(d`2)) |
                   FORALL (i, j):
                     entry(A)(i, j) = row(d`1)(i) * col(d`2)(j)}]

body:
    *(M,N): {A: MatrixMN(rows(M),columns(N))|
      FORALL (i,j): entry(A)(i,j) = row(M)(i)*col(N)(j)} = mult(M,N);


decl_type: function
theory: matrices
library: matrices
location: 332 2 335 55
signature:
  [d: [Matrix, Matrix] ->
          {A:
             MatrixMN(max(rows(d`1), rows(d`2)),
                      max(columns(d`1), columns(d`2))) |
                   FORALL (i, j):
                     entry(A)(i, j) =
                      entry(d`1)(i, j) + entry(d`2)(i, j)}]

body:
    add(M,N): {A: MatrixMN(max(rows(M),rows(N)),max(columns(M),columns(N)))|
      FORALL (i,j): entry(A)(i,j) = entry(M)(i,j)+entry(N)(i,j)}  =
      form_matrix(LAMBDA (i,j:nat): entry(M)(i,j)+entry(N)(i,j),
        max(rows(M),rows(N)),max(columns(M),columns(N)));


decl_type: function
theory: matrices
library: matrices
location: 337 2 339 15
signature:
  [d: [Matrix, Matrix] ->
          {A:
             MatrixMN(max(rows(d`1), rows(d`2)),
                      max(columns(d`1), columns(d`2))) |
                   FORALL (i, j):
                     entry(A)(i, j) =
                      entry(d`1)(i, j) + entry(d`2)(i, j)}]

body:
    +(M,N): {A: MatrixMN(max(rows(M),rows(N)),max(columns(M),columns(N)))|
      FORALL (i,j): entry(A)(i,j) = entry(M)(i,j)+entry(N)(i,j)} =
        add(M,N);


decl_type: function
theory: matrices
library: matrices
location: 353 2 356 26
signature:
  [d: [real, Matrix] ->
          {A: MatrixMN(rows(d`2), columns(d`2)) |
                   FORALL (i, j):
                     entry(A)(i, j) = d`1 * entry(d`2)(i, j)}]

body:
    scal(r,M): {A: MatrixMN(rows(M),columns(M))|
      FORALL (i,j): entry(A)(i,j) = r*entry(M)(i,j)}  =
      form_matrix(LAMBDA (i,j:nat): r*entry(M)(i,j),
        rows(M),columns(M));


decl_type: function
theory: matrices
library: matrices
location: 358 2 360 14
signature:
  [d: [real, Matrix] ->
          {A: MatrixMN(rows(d`2), columns(d`2)) |
                   FORALL (i, j):
                     entry(A)(i, j) = d`1 * entry(d`2)(i, j)}]

body:
    *(r,M): {A: MatrixMN(rows(M),columns(M))|
      FORALL (i,j): entry(A)(i,j) = r*entry(M)(i,j)}  =
      scal(r,M);


decl_type: function
theory: matrices
library: matrices
location: 366 2 368 13
signature:
  [d: [Matrix, Matrix] ->
          {A:
             MatrixMN(max(rows(d`1), rows(d`2)),
                      max(columns(d`1), columns(d`2))) |
                   FORALL (i, j):
                     entry(A)(i, j) =
                      entry(d`1)(i, j) - entry(d`2)(i, j)}]

body:
    sub(M,N): {A: MatrixMN(max(rows(M),rows(N)),max(columns(M),columns(N)))|
      FORALL (i,j): entry(A)(i,j) = entry(M)(i,j)-entry(N)(i,j)}  =
      M+(-1)*N;


decl_type: function
theory: matrices
library: matrices
location: 370 2 372 13
signature:
  [d: [Matrix, Matrix] ->
          {A:
             MatrixMN(max(rows(d`1), rows(d`2)),
                      max(columns(d`1), columns(d`2))) |
                   FORALL (i, j):
                     entry(A)(i, j) =
                      entry(d`1)(i, j) - entry(d`2)(i, j)}]

body:
    -(M,N): {A: MatrixMN(max(rows(M),rows(N)),max(columns(M),columns(N)))|
      FORALL (i,j): entry(A)(i,j) = entry(M)(i,j)-entry(N)(i,j)}  =
      sub(M,N);


decl_type: function
theory: matrices
library: matrices
location: 385 2 390 67
signature:
  [pm: posnat ->
          {M: SquareMatrix(pm) |
                   (FORALL (i, j):
                      entry(M)(i, j) =
                       IF i < pm AND i = j THEN 1 ELSE 0 ENDIF)
                    AND
                    (FORALL (pn: posnat, N: MatrixMN(pm, pn)): M * N = N)
                     AND
                     (FORALL (pn: posnat, N: MatrixMN(pn, pm)):
                        N * M = N)}]

body:
    Id(pm): {M: SquareMatrix(pm) |
      (FORALL (i,j): entry(M)(i,j) =
        IF i<pm AND i=j THEN 1 ELSE 0 ENDIF) AND
      (FORALL (pn:posnat,N:MatrixMN(pm,pn)): M*N = N) AND
      (FORALL (pn:posnat,N:MatrixMN(pn,pm)): N*M = N)} =
      form_matrix(LAMBDA (i,j:nat): IF i=j THEN 1 ELSE 0 ENDIF,pm,pm)


decl_type: function
theory: matrices
library: matrices
signature: [PosFullMatrix -> PosFullMatrix]
location: 403 2 404 73
body:
    transpose(PFM): PosFullMatrix =
      form_matrix(LAMBDA (i,j:nat): entry(PFM)(j,i),columns(PFM),rows(PFM))


decl_type: function
theory: matrices
library: matrices
signature:
  [v: {v | length(v) > 0} ->
  {PFM | rows(PFM) = 1 AND columns(PFM) = length(v)}]

location: 422 2 423 80
body:
    vect2matrix(v|length(v)>0): {PFM | rows(PFM)=1 AND columns(PFM)=length(v)} =
      form_matrix(LAMBDA (i,j): IF i=0 THEN access(v)(j) ELSE 0 ENDIF,1,length(v))


decl_type: tcc
theory: matrices
library: matrices
signature: nil
location: 434 0 437 999
body:
  % Assuming TCC generated (at line 8, column 5) for  reals@sigma_swap[nat]
      % generated from assumption sigma_swap.connected_domain
  IMP_sigma_swap_TCC1: OBLIGATION
    (FORALL (x, y: nat), (z: integer): x <= z AND z <= y IMPLIES z >= 0);


decl_type: tcc
theory: matrices
library: matrices
signature: nil
location: 439 0 444 999
body:
  % Subtype TCC generated (at line 62, column 30) for  i
      % expected type  below[length[listn[real](nn)](LL)]
  nth_matrix_eq_TCC1: OBLIGATION
    FORALL (nn: nat, LL: list[listn[real](nn)],
            i: below[length[list[real]](LL)]):
      i < length[listn[real](nn)](LL);


decl_type: tcc
theory: matrices
library: matrices
signature: nil
location: 446 0 452 999
body:
  % Subtype TCC generated (at line 76, column 38) for  j
      % expected type  below[length(nth[list[real]](LL, i))]
  matrix_listn_nth_TCC1: OBLIGATION
    FORALL (nn: nat, LL: list[listn[real](nn)],
            i: below[length[list[real]](LL)],
            j: below[length[real](nth[listn[real](nn)](LL, i))]):
      j < length[real](nth[list[real]](LL, i));


decl_type: tcc
theory: matrices
library: matrices
signature: nil
location: 454 0 470 999
body:
  % Subtype TCC generated (at line 91, column 21) for  0
      % expected type  {c: nat |
                     %          (FORALL (i: below(length(M))):
                     %             length(nth(M, i)) <= c)
                     %           AND
                     %           (null?(M) AND c = 0 OR
                     %             (EXISTS (i: below(length(M))):
                     %                length(nth(M, i)) = c))}
  columns_TCC1: OBLIGATION
    FORALL (M: Matrix):
      null?(M) IMPLIES
       (FORALL (i: below(length[list[real]](M))):
          length[real](nth[list[real]](M, i)) <= 0)
        AND
        (null?[list[real]](M) OR
          (EXISTS (i: below(length[list[real]](M))):
             length[real](nth[list[real]](M, i)) = 0));


decl_type: tcc
theory: matrices
library: matrices
signature: nil
location: 472 0 475 999
body:
  % Subtype TCC generated (at line 92, column 24) for  M
      % expected type  (cons?[list[real]])
  columns_TCC2: OBLIGATION
    FORALL (M: Matrix): NOT null?(M) IMPLIES cons?[list[real]](M);


decl_type: tcc
theory: matrices
library: matrices
signature: nil
location: 477 0 481 999
body:
  % Termination TCC generated (at line 92, column 28) for  columns(cdr(M))
  columns_TCC3: OBLIGATION
    FORALL (M: Matrix):
      NOT null?(M) IMPLIES
       length[list[real]](cdr[list[real]](M)) < length[list[real]](M);


decl_type: tcc
theory: matrices
library: matrices
signature: nil
location: 483 0 513 999
body:
  % Subtype TCC generated (at line 92, column 9) for
      % max(length(car(M)), columns(cdr(M)))
      % expected type  {c: nat |
                     %          (FORALL (i: below(length(M))):
                     %             length(nth(M, i)) <= c)
                     %           AND
                     %           (null?(M) AND c = 0 OR
                     %             (EXISTS (i: below(length(M))):
                     %                length(nth(M, i)) = c))}
  columns_TCC4: OBLIGATION
    FORALL (M: Matrix,
            v:
              [M1: {z: Matrix | length(z) < length(M)} ->
                 {c: nat |
                          (FORALL (i: below(length(M1))):
                             length(nth(M1, i)) <= c)
                           AND
                           (null?(M1) AND c = 0 OR
                             (EXISTS (i: below(length(M1))):
                                length(nth(M1, i)) = c))}]):
      NOT null?(M) IMPLIES
       (FORALL (i: below(length[list[real]](M))):
          length[real](nth[list[real]](M, i)) <=
           max(length[real](car[list[real]](M)), v(cdr[list[real]](M))))
        AND
        (null?[list[real]](M) AND
          max(length[real](car[list[real]](M)), v(cdr[list[real]](M))) = 0
          OR
          (EXISTS (i: below(length[list[real]](M))):
             length[real](nth[list[real]](M, i)) =
              max(length[real](car[list[real]](M)), v(cdr[list[real]](M)))));


decl_type: tcc
theory: matrices
library: matrices
signature: nil
location: 515 0 519 999
body:
  % Subtype TCC generated (at line 97, column 15) for  i
      % expected type  below[length[list[real]](M)]
  row_TCC1: OBLIGATION
    FORALL (M: Matrix, i: nat):
      NOT i >= length(M) IMPLIES i < length[list[real]](M);


decl_type: tcc
theory: matrices
library: matrices
signature: nil
location: 521 0 524 999
body:
  % Subtype TCC generated (at line 100, column 21) for  null[real]
      % expected type  VectorN(rows(M))
  col_TCC1: OBLIGATION
    FORALL (M: Matrix): null?(M) IMPLIES length[real](null[real]) = rows(M);


decl_type: tcc
theory: matrices
library: matrices
signature: nil
location: 526 0 539 999
body:
  % Subtype TCC generated (at line 101, column 9) for
      % cons(access(car(M))(i), col(cdr(M))(i))
      % expected type  VectorN(rows(M))
  col_TCC2: OBLIGATION
    FORALL (M: Matrix,
            v:
              [M1: {z: Matrix | length(z) < length(M)} ->
                 [nat -> VectorN(rows(M1))]],
            i: nat):
      NOT null?(M) IMPLIES
       length[real]
           (cons[real]
                (access(car[list[real]](M))(i), v(cdr[list[real]](M))(i)))
        = rows(M);


decl_type: tcc
theory: matrices
library: matrices
signature: nil
location: 541 0 546 999
body:
  % Subtype TCC generated (at line 107, column 20) for  j
      % expected type  below[length(col(M)(i))]
  col_def_TCC1: OBLIGATION
    FORALL (M: Matrix, i: nat):
      length(col(M)(i)) = rows(M) IMPLIES
       (FORALL (j: below(rows(M))): j < length[real](col(M)(i)));


decl_type: tcc
theory: matrices
library: matrices
signature: nil
location: 548 0 553 999
body:
  % Subtype TCC generated (at line 108, column 28) for  j
      % expected type  below[length[list[real]](M)]
  col_def_TCC2: OBLIGATION
    FORALL (M: Matrix, i: nat):
      length(col(M)(i)) = rows(M) IMPLIES
       (FORALL (j: below(rows(M))): j < length[list[real]](M));


decl_type: tcc
theory: matrices
library: matrices
signature: nil
location: 555 0 559 999
body:
  % Subtype TCC generated (at line 134, column 29) for  SM
      % expected type  (cons?[list[real]])
  full_matrix_columns_TCC1: OBLIGATION
    FORALL (SM: FullMatrix):
      NOT (null?(SM) AND columns(SM) = 0) IMPLIES cons?[list[real]](SM);


decl_type: tcc
theory: matrices
library: matrices
signature: nil
location: 561 0 566 999
body:
  % Subtype TCC generated (at line 168, column 22) for  v2
      % expected type  VectorN(max(length(v1), length(v2)))
  add_TCC1: OBLIGATION
    FORALL (v1: Vector, v2: Vector):
      null?(v1) IMPLIES
       length[real](v2) = max(length[real](v1), length[real](v2));


decl_type: tcc
theory: matrices
library: matrices
signature: nil
location: 568 0 573 999
body:
  % Subtype TCC generated (at line 169, column 25) for  v1
      % expected type  VectorN(max(length(v1), length(v2)))
  add_TCC2: OBLIGATION
    FORALL (v1: Vector, v2: Vector):
      null?(v2) AND NOT null?(v1) IMPLIES
       length[real](v1) = max(length[real](v1), length[real](v2));


decl_type: tcc
theory: matrices
library: matrices
signature: nil
location: 575 0 579 999
body:
  % Subtype TCC generated (at line 170, column 18) for  v1
      % expected type  (cons?[real])
  add_TCC3: OBLIGATION
    FORALL (v1: Vector, v2: Vector):
      NOT null?(v2) AND NOT null?(v1) IMPLIES cons?[real](v1);


decl_type: tcc
theory: matrices
library: matrices
signature: nil
location: 581 0 585 999
body:
  % Subtype TCC generated (at line 170, column 26) for  v2
      % expected type  (cons?[real])
  add_TCC4: OBLIGATION
    FORALL (v1: Vector, v2: Vector):
      NOT null?(v2) AND NOT null?(v1) IMPLIES cons?[real](v2);


decl_type: tcc
theory: matrices
library: matrices
signature: nil
location: 587 0 593 999
body:
  % Termination TCC generated (at line 170, column 30) for
      % add(cdr(v1), cdr(v2))
  add_TCC5: OBLIGATION
    FORALL (v1: Vector, v2: Vector):
      NOT null?(v2) AND NOT null?(v1) IMPLIES
       length[real](cdr[real](v1)) + length[real](cdr[real](v2)) <
        length[real](v1) + length[real](v2);


decl_type: tcc
theory: matrices
library: matrices
signature: nil
location: 595 0 611 999
body:
  % Subtype TCC generated (at line 170, column 9) for
      % cons(car(v1) + car(v2), add(cdr(v1), cdr(v2)))
      % expected type  VectorN(max(length(v1), length(v2)))
  add_TCC6: OBLIGATION
    FORALL (v1: Vector, v2: Vector,
            v:
              [d1:
                 {z: [Vector, Vector] |
                          length(z`1) + length(z`2) <
                           length(v1) + length(v2)} ->
                 VectorN(max(length(d1`1), length(d1`2)))]):
      NOT null?(v2) AND NOT null?(v1) IMPLIES
       length[real]
           (cons[real]
                (car[real](v1) + car[real](v2),
                 v(cdr[real](v1), cdr[real](v2))))
        = max(length[real](v1), length[real](v2));


decl_type: tcc
theory: matrices
library: matrices
signature: nil
location: 613 0 616 999
body:
  % Subtype TCC generated (at line 175, column 20) for  v2
      % expected type  (cons?[real])
  scal_TCC1: OBLIGATION
    FORALL (v2: Vector): NOT null?(v2) IMPLIES cons?[real](v2);


decl_type: tcc
theory: matrices
library: matrices
signature: nil
location: 618 0 621 999
body:
  % Termination TCC generated (at line 175, column 24) for  scal(r, cdr(v2))
  scal_TCC2: OBLIGATION
    FORALL (v2: Vector):
      NOT null?(v2) IMPLIES length[real](cdr[real](v2)) < length[real](v2);


decl_type: tcc
theory: matrices
library: matrices
signature: nil
location: 623 0 633 999
body:
  % Subtype TCC generated (at line 175, column 9) for
      % cons(r * car(v2), scal(r, cdr(v2)))
      % expected type  VectorN(length(v2))
  scal_TCC3: OBLIGATION
    FORALL (r: real, v2: Vector,
            v:
              [d1: {z: [real, Vector] | length(z`2) < length(v2)} ->
                 VectorN(length(d1`2))]):
      NOT null?(v2) IMPLIES
       length[real](cons[real](r * car[real](v2), v(r, cdr[real](v2)))) =
        length[real](v2);


decl_type: tcc
theory: matrices
library: matrices
signature: nil
location: 635 0 640 999
body:
  % Subtype TCC generated (at line 179, column 4) for  add(v1, scal(-1, v2))
      % expected type  VectorN(max(length(v1), length(v2)))
  sub_TCC1: OBLIGATION
    FORALL (v1: Vector, v2: Vector):
      length[real](add(v1, scal(-1, v2))) =
       max(length[real](v1), length[real](v2));


decl_type: tcc
theory: matrices
library: matrices
signature: nil
location: 642 0 646 999
body:
  % Subtype TCC generated (at line 187, column 35) for  0
      % expected type  {rr: real | rr = dot(v1, v2)}
  super_dot_TCC1: OBLIGATION
    FORALL (v1: Vector, v2: Vector):
      null?(v1) OR null?(v2) IMPLIES 0 = dot(v1, v2);


decl_type: tcc
theory: matrices
library: matrices
signature: nil
location: 648 0 653 999
body:
  % Subtype TCC generated (at line 188, column 25) for  dot(cdr(v1), cdr(v2))
      % expected type  {rr: real | rr = dot(v1, v2)}
  super_dot_TCC2: OBLIGATION
    FORALL (v1: Vector, v2: Vector):
      car(v1) = 0 AND NOT null?(v1) AND NOT null?(v2) IMPLIES
       dot(cdr[real](v1), cdr[real](v2)) = dot(v1, v2);


decl_type: tcc
theory: matrices
library: matrices
signature: nil
location: 655 0 662 999
body:
  % Subtype TCC generated (at line 189, column 9) for
      % car(v1) * car(v2) + dot(cdr(v1), cdr(v2))
      % expected type  {rr: real | rr = dot(v1, v2)}
  super_dot_TCC3: OBLIGATION
    FORALL (v1: Vector, v2: Vector):
      NOT car(v1) = 0 AND NOT null?(v1) AND NOT null?(v2) IMPLIES
       car[real](v1) * car[real](v2) + dot(cdr[real](v1), cdr[real](v2)) =
        dot(v1, v2);


decl_type: tcc
theory: matrices
library: matrices
signature: nil
location: 664 0 667 999
body:
  % Subtype TCC generated (at line 194, column 31) for  kz - 1
      % expected type  nat
  super_duper_dot_TCC1: OBLIGATION
    FORALL (kz: nat): NOT kz = 0 IMPLIES kz - 1 >= 0;


decl_type: tcc
theory: matrices
library: matrices
signature: nil
location: 669 0 672 999
body:
  % Termination TCC generated (at line 194, column 9) for
      % super_duper_dot(FF, GG, kz - 1)
  super_duper_dot_TCC2: OBLIGATION
    FORALL (kz: nat): NOT kz = 0 IMPLIES kz - 1 < kz;


decl_type: tcc
theory: matrices
library: matrices
signature: nil
location: 674 0 681 999
body:
  % Subtype TCC generated (at line 212, column 25) for
      % min(length(v1) - 1, length(v2) - 1)
      % expected type  T_high[nat]
  dot_eq_sigma_TCC1: OBLIGATION
    FORALL (v1, v2: Vector):
      min(length[real](v1) - 1, length[real](v2) - 1) >= 0 OR
       (EXISTS (j: nat):
          min(length[real](v1) - 1, length[real](v2) - 1) <= j);


decl_type: tcc
theory: matrices
library: matrices
signature: nil
location: 683 0 687 999
body:
  % Subtype TCC generated (at line 235, column 20) for  j
      % expected type  below[length(row(M)(i))]
  form_matrix_TCC1: OBLIGATION
    FORALL (m, n: nat, M: MatrixMN(m, n), i: below(m), j: below(n)):
      j < length[real](row(M)(i));


decl_type: tcc
theory: matrices
library: matrices
signature: nil
location: 689 0 692 999
body:
  % Existence TCC generated (at line 236, column 4) for
      % array2list[listn[real](n)]
  form_matrix_TCC2: OBLIGATION
    FORALL (n: nat): EXISTS (x: listn[real](n)): TRUE;


decl_type: tcc
theory: matrices
library: matrices
signature: nil
location: 694 0 734 999
body:
  % Subtype TCC generated (at line 236, column 4) for
      % array2list[listn[real](n)]
      %     (m)
      %     (LAMBDA (k: nat): array2list[real](n)(LAMBDA (p: nat): F(k, p)))
      % expected type  {M: MatrixMN(m, n) |
                     %          FORALL (i: below(m), j: below(n)):
                     %            nth(row(M)(i), j) = F(i, j)}
  form_matrix_TCC3: OBLIGATION
    FORALL (F: [[nat, nat] -> real], m, n: nat):
      (length[list[real]]
           (array2list[listn[real](n)]
                (m)
                (LAMBDA (k: nat):
                   array2list[real](n)(LAMBDA (p: nat): F(k, p))))
        = m
        AND
        (FORALL (i:
                   below(length[list[real]]
                             (array2list[listn[real](n)]
                                  (m)
                                  (LAMBDA (k: nat):
                                     array2list[real]
                                         (n)(LAMBDA (p: nat): F(k, p)))))):
           length[real]
               (nth[list[real]]
                    (array2list[listn[real](n)]
                         (m)
                         (LAMBDA (k: nat):
                            array2list[real](n)(LAMBDA (p: nat): F(k, p))),
                     i))
            = n))
       AND
       (FORALL (i: below(m), j: below(n)):
          nth[real]
              (row(array2list[listn[real](n)]
                       (m)
                       (LAMBDA (k: nat):
                          array2list[real](n)(LAMBDA (p: nat): F(k, p))))
                  (i),
               j)
           = F(i, j));


decl_type: tcc
theory: matrices
library: matrices
signature: nil
location: 736 0 748 999
body:
  % Subtype TCC generated (at line 288, column 4) for
      % form_matrix(LAMBDA (i, j: nat): dot(row(M)(i), col(N)(j)), rows(M),
      %             columns(N))
      % expected type  {A: MatrixMN(rows(M), columns(N)) |
                     %          FORALL (i, j):
                     %            entry(A)(i, j) = row(M)(i) * col(N)(j)}
  mult_TCC1: OBLIGATION
    FORALL (M: Matrix, N: Matrix):
      FORALL (i_1: nat, j_1: nat):
        entry(form_matrix(LAMBDA (i, j: nat): dot(row(M)(i), col(N)(j)),
                          rows(M), columns(N)))
             (i_1, j_1)
         = row(M)(i_1) * col(N)(j_1);


decl_type: tcc
theory: matrices
library: matrices
signature: nil
location: 750 0 757 999
body:
  % Judgement subtype TCC generated (at line 294, column 4) for  M * N
      % expected type  FullMatrix
  mult_full: OBLIGATION
    FORALL (M, N):
      null?[list[real]](M * N) OR
       (FORALL (i, j: below(length[list[real]](M * N))):
          length[real](nth[list[real]](M * N, i)) =
           length[real](nth[list[real]](M * N, j)));


decl_type: tcc
theory: matrices
library: matrices
signature: nil
location: 759 0 766 999
body:
  % Subtype TCC generated (at line 328, column 23) for  m - 1
      % expected type  T_high[nat]
  form_matrix_mult_TCC1: OBLIGATION
    FORALL (k, m, n: nat):
      m > 0 AND k > 0 IMPLIES
       (FORALL (i, j: nat):
          NOT i > k AND NOT j > n IMPLIES
           m - 1 >= 0 OR (EXISTS (j: nat): m - 1 <= j));


decl_type: tcc
theory: matrices
library: matrices
signature: nil
location: 768 0 784 999
body:
  % Subtype TCC generated (at line 334, column 4) for
      % form_matrix(LAMBDA (i, j: nat): entry(M)(i, j) + entry(N)(i, j),
      %             max(rows(M), rows(N)), max(columns(M), columns(N)))
      % expected type  {A:
                     %    MatrixMN(max(rows(M), rows(N)),
                     %             max(columns(M), columns(N))) |
                     %          FORALL (i, j):
                     %            entry(A)(i, j) =
                     %             entry(M)(i, j) + entry(N)(i, j)}
  add_TCC7: OBLIGATION
    FORALL (M: Matrix, N: Matrix):
      FORALL (i_1: nat, j_1: nat):
        entry(form_matrix(LAMBDA (i, j: nat):
                            entry(M)(i, j) + entry(N)(i, j),
                          max(rows(M), rows(N)), max(columns(M), columns(N))))
             (i_1, j_1)
         = entry(M)(i_1, j_1) + entry(N)(i_1, j_1);


decl_type: tcc
theory: matrices
library: matrices
signature: nil
location: 786 0 798 999
body:
  % Subtype TCC generated (at line 355, column 4) for
      % form_matrix(LAMBDA (i, j: nat): r * entry(M)(i, j), rows(M),
      %             columns(M))
      % expected type  {A: MatrixMN(rows(M), columns(M)) |
                     %          FORALL (i, j):
                     %            entry(A)(i, j) = r * entry(M)(i, j)}
  scal_TCC4: OBLIGATION
    FORALL (r: real, M: Matrix):
      FORALL (i_1: nat, j_1: nat):
        entry(form_matrix(LAMBDA (i, j: nat): r * entry(M)(i, j), rows(M),
                          columns(M)))
             (i_1, j_1)
         = r * entry(M)(i_1, j_1);


decl_type: tcc
theory: matrices
library: matrices
signature: nil
location: 800 0 815 999
body:
  % Subtype TCC generated (at line 368, column 4) for  M + (-1) * N
      % expected type  {A:
                     %    MatrixMN(max(rows(M), rows(N)),
                     %             max(columns(M), columns(N))) |
                     %          FORALL (i, j):
                     %            entry(A)(i, j) =
                     %             entry(M)(i, j) - entry(N)(i, j)}
  sub_TCC2: OBLIGATION
    FORALL (M: Matrix, N: Matrix):
      (length[list[real]](M + (-1) * N) = max(rows(M), rows(N)) AND
        (FORALL (i: below(length[list[real]](M + (-1) * N))):
           length[real](nth[list[real]](M + (-1) * N, i)) =
            max(columns(M), columns(N))))
       AND
       (FORALL (i, j):
          entry(M + (-1) * N)(i, j) = entry(M)(i, j) - entry(N)(i, j));


decl_type: tcc
theory: matrices
library: matrices
signature: nil
location: 817 0 889 999
body:
  % Subtype TCC generated (at line 390, column 4) for
      % form_matrix(LAMBDA (i, j: nat): IF i = j THEN 1 ELSE 0 ENDIF, pm, pm)
      % expected type  {M: SquareMatrix(pm) |
                     %          (FORALL (i, j):
                     %             entry(M)(i, j) =
                     %              IF i < pm AND i = j THEN 1 ELSE 0 ENDIF)
                     %           AND
                     %           (FORALL (pn: posnat, N: MatrixMN(pm, pn)):
                     %              M * N = N)
                     %            AND
                     %            (FORALL (pn: posnat, N: MatrixMN(pn, pm)):
                     %               N * M = N)}
  Id_TCC1: OBLIGATION
    FORALL (pm: posnat):
           null?[list[real]]
               (form_matrix(LAMBDA (i, j: nat): IF i = j THEN 1 ELSE 0 ENDIF,
                            pm, pm))
            OR
            (FORALL (i_1,
                     j_1:
                       below(length[list[real]]
                                 (form_matrix(LAMBDA
                                              (i, j: nat):
                                              IF i = j THEN 1 ELSE 0 ENDIF,
                                              pm,
                                              pm)))):
               length[real]
                   (nth[list[real]]
                        (form_matrix(LAMBDA (i, j: nat):
                                       IF i = j THEN 1 ELSE 0 ENDIF,
                                     pm, pm),
                         i_1))
                =
                length[real]
                    (nth[list[real]]
                         (form_matrix(LAMBDA
                                      (i, j: nat):
                                      IF i = j THEN 1 ELSE 0 ENDIF,
                                      pm,
                                      pm),
                          j_1)))
       AND rows(form_matrix(LAMBDA (i, j: nat): IF i = j THEN 1 ELSE 0 ENDIF,
                            pm, pm))
            > 0
       AND columns(form_matrix(LAMBDA (i, j: nat):
                                 IF i = j THEN 1 ELSE 0 ENDIF,
                               pm, pm))
            > 0
       AND rows(form_matrix(LAMBDA (i, j: nat): IF i = j THEN 1 ELSE 0 ENDIF,
                            pm, pm))
            =
            columns(form_matrix(LAMBDA (i, j: nat):
                                  IF i = j THEN 1 ELSE 0 ENDIF,
                                pm, pm))
       AND rows(form_matrix(LAMBDA (i, j: nat): IF i = j THEN 1 ELSE 0 ENDIF,
                            pm, pm))
            = pm
       AND FORALL (i_1: nat, j_1: nat):
             entry(form_matrix(LAMBDA (i, j: nat):
                                 IF i = j THEN 1 ELSE 0 ENDIF,
                               pm, pm))
                  (i_1, j_1)
              = IF i_1 < pm AND i_1 = j_1 THEN 1 ELSE 0 ENDIF
       AND FORALL (pn: posnat, N: MatrixMN(pm, pn)):
             form_matrix(LAMBDA (i, j: nat): IF i = j THEN 1 ELSE 0 ENDIF,
                         pm, pm)
              * N
              = N
       AND FORALL (pn: posnat, N: MatrixMN(pn, pm)):
             N *
              form_matrix(LAMBDA (i, j: nat): IF i = j THEN 1 ELSE 0 ENDIF,
                          pm, pm)
              = N;


decl_type: tcc
theory: matrices
library: matrices
signature: nil
location: 891 0 927 999
body:
  % Subtype TCC generated (at line 404, column 4) for
      % form_matrix(LAMBDA (i, j: nat): entry(PFM)(j, i), columns(PFM),
      %             rows(PFM))
      % expected type  PosFullMatrix
  transpose_TCC1: OBLIGATION
    FORALL (PFM: PosFullMatrix):
      (null?[list[real]]
           (form_matrix(LAMBDA (i, j: nat): entry(PFM)(j, i), columns(PFM),
                        rows(PFM)))
        OR
        (FORALL (i_1,
                 j_1:
                   below(length[list[real]]
                             (form_matrix(LAMBDA
                                          (i, j: nat):
                                          entry(PFM)(j, i),
                                          columns(PFM),
                                          rows(PFM))))):
           length[real]
               (nth[list[real]]
                    (form_matrix(LAMBDA (i, j: nat): entry(PFM)(j, i),
                                 columns(PFM), rows(PFM)),
                     i_1))
            =
            length[real]
                (nth[list[real]]
                     (form_matrix(LAMBDA (i, j: nat): entry(PFM)(j, i),
                                  columns(PFM), rows(PFM)),
                      j_1))))
       AND
       rows(form_matrix(LAMBDA (i, j: nat): entry(PFM)(j, i), columns(PFM),
                        rows(PFM)))
        > 0
        AND
        columns(form_matrix(LAMBDA (i, j: nat): entry(PFM)(j, i),
                            columns(PFM), rows(PFM)))
         > 0;


decl_type: tcc
theory: matrices
library: matrices
signature: nil
location: 929 0 934 999
body:
  % Subtype TCC generated (at line 415, column 14) for  D1 * D2
      % expected type  PosFullMatrix
  transpose_mult_TCC1: OBLIGATION
    FORALL (D1, D2: PosFullMatrix):
      columns(D1) = rows(D2) IMPLIES
       rows(D1 * D2) > 0 AND columns(D1 * D2) > 0;


decl_type: tcc
theory: matrices
library: matrices
signature: nil
location: 936 0 944 999
body:
  % Judgement subtype TCC generated (at line 418, column 4) for
      % form_matrix(F, i, j)
      % expected type  FullMatrix
  form_matrix_square: OBLIGATION
    FORALL (F, i, j):
      null?[list[real]](form_matrix(F, i, j)) OR
       (FORALL (i_1, j_1: below(length[list[real]](form_matrix(F, i, j)))):
          length[real](nth[list[real]](form_matrix(F, i, j), i_1)) =
           length[real](nth[list[real]](form_matrix(F, i, j), j_1)));


decl_type: tcc
theory: matrices
library: matrices
signature: nil
location: 946 0 970 999
body:
  % Subtype TCC generated (at line 423, column 4) for
      % form_matrix(LAMBDA (i, j): IF i = 0 THEN access(v)(j) ELSE 0 ENDIF,
      %             1, length(v))
      % expected type  {PFM | rows(PFM) = 1 AND columns(PFM) = length(v)}
  vect2matrix_TCC1: OBLIGATION
    FORALL (v: Vector | length[real](v) > 0):
      (rows(form_matrix(LAMBDA (i, j):
                          IF i = 0 THEN access(v)(j) ELSE 0 ENDIF,
                        1, length[real](v)))
        = 1
        AND
        columns(form_matrix(LAMBDA (i, j):
                              IF i = 0 THEN access(v)(j) ELSE 0 ENDIF,
                            1, length[real](v)))
         = length[real](v))
       AND
       rows(form_matrix(LAMBDA (i, j):
                          IF i = 0 THEN access(v)(j) ELSE 0 ENDIF,
                        1, length[real](v)))
        > 0
        AND
        columns(form_matrix(LAMBDA (i, j):
                              IF i = 0 THEN access(v)(j) ELSE 0 ENDIF,
                            1, length[real](v)))
         > 0;


decl_type: formula
theory: matrix_props
library: matrices
signature: nil
location: 31 2 34 42
body:
    matrix_2x2: LEMMA
      rows(D)=2 AND columns(D)=2 IMPLIES
      D = (:(:entry(D)(0,0),entry(D)(0,1):),
            (:entry(D)(1,0),entry(D)(1,1):):)


decl_type: formula
theory: matrix_props
library: matrices
signature: nil
location: 65 2 66 82
body:
    rows_remove: LEMMA
      rows(remove(M,i,j)) = IF rows(M)=0 or columns(M)=0 THEN 0 ELSE rows(M)-1 ENDIF


decl_type: formula
theory: matrix_props
library: matrices
signature: nil
location: 68 2 70 35
body:
    columns_remove: LEMMA
      columns(remove(M,i,j)) = IF rows(M)<=1 OR columns(M)=0 THEN 0
                               ELSE columns(M)-1 ENDIF


decl_type: formula
theory: matrix_props
library: matrices
signature: nil
location: 72 2 76 33
body:
    remove_remove_1_0: LEMMA rows(D)>2 AND
      columns(D)>2 AND m<=n 
      AND n<columns(D)-1 AND m<columns(D)-1 IMPLIES
      remove(remove(D, 1, n+1), 0, m) = 
      remove(remove(D, 0, m), 0, n)


decl_type: formula
theory: matrix_props
library: matrices
signature: nil
location: 78 2 81 67
body:
    remove_remove_1_0_0: LEMMA rows(D)>2 AND
      columns(D)>2 
      AND n<columns(D)-1 IMPLIES
      remove(remove(D, 1, 0), 0, n)=remove(remove(D, 0, 1 + n), 0, 0)


decl_type: formula
theory: matrix_props
library: matrices
signature: nil
location: 83 2 87 45
body:
    remove_remove_1_n: LEMMA rows(D)>2 AND
      columns(D)>2 
      AND n+m<columns(D)-1 IMPLIES
      remove(remove(D, 1, n), 0, m + n)
         =remove(remove(D, 0, 1 + m + n), 0, n)


decl_type: formula
theory: matrix_props
library: matrices
signature: nil
location: 89 2 93 25
body:
    entry_remove: LEMMA 
      entry(remove(M,i,j))(m,n) =
        LET newm= IF m>=i OR i>=rows(M) THEN m+1 ELSE m ENDIF,
            newn= IF n>=j OR j>=columns(M) THEN n+1 ELSE n ENDIF IN
        entry(M)(newm,newn)


decl_type: formula
theory: matrix_props
library: matrices
signature: nil
location: 133 2 135 48
body:
    entry_swap: LEMMA
      entry(swap(i,j)(D))(k,p) = IF k<rows(D) AND p<columns(D)
        THEN swap(i,j)(entry(D))(k,p) ELSE 0 ENDIF


decl_type: formula
theory: matrix_props
library: matrices
signature: nil
location: 139 2 141 17
body:
    remove_swap_1: LEMMA rows(D)>=2 AND columns(D)>=2 IMPLIES
      remove(swap(0, 1)(D), 0, n) =
      remove(D,1,n)


decl_type: formula
theory: matrix_props
library: matrices
signature: nil
location: 143 2 146 58
body:
    remove_swap_2: LEMMA i/=0 AND j/=0 AND i<rows(D) AND j<rows(D)
      AND rows(D)=columns(D)
      IMPLIES
       remove(swap(i,j)(D),0,n)=swap(i-1,j-1)(remove(D,0,n))


decl_type: formula
theory: matrix_props
library: matrices
signature: nil
location: 155 2 157 53
body:
    swap_similar: LEMMA i<rows(D) AND j<rows(D) AND k<rows(D) AND
    i/=j AND j/=k AND k/=i IMPLIES
      swap(k,j)(D) = swap(i,j)(swap(k,i)(swap(i,j)(D)))


decl_type: formula
theory: matrix_props
library: matrices
signature: nil
location: 162 2 164 55
body:
    row_swap: LEMMA i<rows(D) AND j<rows(D) IMPLIES
      row(swap(i,j)(D))(k) =
      row(D)(IF k=i THEN j ELSIF k=j THEN i ELSE k ENDIF)


decl_type: formula
theory: matrix_props
library: matrices
signature: nil
location: 175 2 177 14
body:
    det_rows_eq_0: LEMMA i<rows(D) AND j<rows(D) AND
      row(D)(i) = row(D)(j) AND i/=j IMPLIES
      det(D) = 0


decl_type: formula
theory: matrix_props
library: matrices
signature: nil
location: 190 2 191 103
body:
    entry_replace_row: LEMMA columns(D)=length(v) IMPLIES
      entry(replace_row(i,v)(D))(j,k) = (IF j<rows(D) AND j=i THEN access(v)(k) ELSE entry(D)(j,k) ENDIF)


decl_type: formula
theory: matrix_props
library: matrices
signature: nil
location: 196 2 197 45
body:
    columns_replace_row: LEMMA columns(D) = length(v) IMPLIES
      columns(replace_row(i,v)(D)) = columns(D)


decl_type: formula
theory: matrix_props
library: matrices
signature: nil
location: 199 2 200 51
body:
    remove_replace_row: LEMMA columns(D) = length(v) AND rows(D)>1 AND columns(D)>1 IMPLIES
      remove(replace_row(k,v)(D),k,j) = remove(D,k,j)


decl_type: formula
theory: matrix_props
library: matrices
signature: nil
location: 202 2 206 51
body:
    swap_replace_row: LEMMA columns(D)=length(v) AND i<rows(D) AND 
      j<rows(D) AND k<rows(D) IMPLIES
      swap(i,j)(replace_row(k,v)(D)) = (IF i = k THEN replace_row(j,v)(swap(i,j)(D))
                                       ELSIF j = k THEN replace_row(i,v)(swap(i,j)(D))
                                       ELSE replace_row(k,v)(swap(i,j)(D)) ENDIF)


decl_type: formula
theory: matrix_props
library: matrices
signature: nil
location: 208 2 209 82
body:
    row_replace_row: LEMMA columns(D) = length(v) IMPLIES
      row(replace_row(i,v)(D))(j) = IF j<rows(D) AND j=i THEN v ELSE row(D)(j) ENDIF


decl_type: formula
theory: matrix_props
library: matrices
signature: nil
location: 211 2 212 51
body:
    remove_replace_row_eq: LEMMA columns(D) = length(v) IMPLIES
      remove(replace_row(i,v)(D),i,j) = remove(D,i,j)


decl_type: formula
theory: matrix_props
library: matrices
signature: nil
location: 214 2 215 88
body:
    det_replace_row_sum: LEMMA length(v1)=length(v2) AND columns(D)=length(v1) AND i<rows(D) IMPLIES
      det(replace_row(i,v1+v2)(D)) = det(replace_row(i,v1)(D)) + det(replace_row(i,v2)(D))


decl_type: formula
theory: matrix_props
library: matrices
signature: nil
location: 217 2 218 59
body:
    det_replace_row_scal: LEMMA columns(D) = length(v) AND i<rows(D) IMPLIES
      det(replace_row(i,r*v)(D)) = r*det(replace_row(i,v)(D))


decl_type: formula
theory: matrix_props
library: matrices
signature: nil
location: 223 2 224 57
body:
    det_replace_row_sum_scal: LEMMA i<rows(D) AND j<rows(D) AND i/=j IMPLIES
      det(replace_row(i,row(D)(i)+r*row(D)(j))(D)) = det(D)


decl_type: formula
theory: matrix_props
library: matrices
signature: nil
location: 226 2 227 81
body:
    replace_row_sum_to_scal: LEMMA i<rows(D) AND j<rows(D) IMPLIES
      replace_row(i,row(D)(i)+row(D)(j))(D)=replace_row(i,row(D)(i)+1*row(D)(j))(D)


decl_type: formula
theory: matrix_props
library: matrices
signature: nil
location: 231 2 233 12
body:
    det_first_column_zero: LEMMA
      (FORALL (i): i<rows(D) IMPLIES entry(D)(i,0)=0) IMPLIES
      det(D)=0


decl_type: formula
theory: matrix_props
library: matrices
signature: nil
location: 235 2 238 28
body:
    remove_transpose: LEMMA 
      rows(D)>1 AND columns(D)>1 IMPLIES
      remove(transpose(D),i,j) =
      transpose(remove(D,j,i))


decl_type: function
theory: matrix_props
library: matrices
location: 50 2 60 114
signature:
  [d: [Matrix, nat, nat] ->
          {N |
                   (rows(d`1) > 1 AND columns(d`1) > 1 IMPLIES
                     (rows(N) = rows(d`1) - 1 AND
                       columns(N) = columns(d`1) - 1))
                    AND
                    (FORALL (m, n):
                       entry(N)(m, n) =
                        entry(d`1)
                             (IF m >= d`2 OR d`2 >= rows(d`1) THEN 1 + m
                              ELSE m
                              ENDIF,
                              IF n >= d`3 OR d`3 >= columns(d`1)
                                THEN 1 + n
                              ELSE n
                              ENDIF))}]

body:
    remove(M,i,j): {N |
      (rows(M)>1 AND columns(M)>1  IMPLIES
      (rows(N)=rows(M)-1 AND columns(N)=columns(M)-1)) AND
      (FORALL (m,n):
        LET newm= IF m>=i OR i>=rows(M) THEN m+1 ELSE m ENDIF,
            newn= IF n>=j OR j>=columns(M) THEN n+1 ELSE n ENDIF IN
        entry(N)(m,n)=entry(M)(newm,newn))} =
      IF rows(M)=0 OR columns(M)=0 THEN null[list[real]] ELSE
       form_matrix(LAMBDA (m,n): 
        LET newm= IF m>=i OR i>=rows(M) THEN m+1 ELSE m ENDIF,
            newn= IF n>=j OR j>=columns(M) THEN n+1 ELSE n ENDIF IN entry(M)(newm,newn),rows(M)-1,columns(M)-1) ENDIF


decl_type: function
theory: matrix_props
library: matrices
signature: [Matrix -> real]
location: 103 2 108 21
body:
    det(M): RECURSIVE real =
      IF null?(M) OR rows(M)/=columns(M) THEN 0
      ELSIF rows(M)=1 THEN entry(M)(0,0)
      ELSE sigma(0,columns(M)-1,LAMBDA (k): 
           (-1)^k*entry(M)(0,k)*det(remove(M,0,k))) ENDIF
      MEASURE length(M)


decl_type: function
theory: matrix_props
library: matrices
signature: [[nat, nat] -> [[[nat, nat] -> real] -> [[nat, nat] -> real]]]
location: 119 2 121 22
body:
    swap(i,j)(F)(k,p): real = IF k=i THEN F(j,p)
                            ELSIF k=j THEN F(i,p)
                            ELSE F(k,p) ENDIF


decl_type: function
theory: matrix_props
library: matrices
location: 127 2 131 54
signature:
  [d: [nat, nat] ->
          [D: PosFullMatrix ->
             {PFM |
                      rows(PFM) = rows(D) AND
                       columns(PFM) = columns(D) AND
                        (FORALL (k, p):
                           d`1 < rows(D) AND d`2 < rows(D) IMPLIES
                            entry(PFM)(k, p) =
                             (IF k = d`1 THEN entry(D)(d`2, p)
                              ELSIF k = d`2 THEN entry(D)(d`1, p)
                              ELSE entry(D)(k, p)
                              ENDIF))}]]

body:
    swap(i,j)(D): {PFM|rows(PFM)=rows(D) AND columns(PFM)=columns(D) AND
      FORALL (k,p): i<rows(D) AND j<rows(D) IMPLIES entry(PFM)(k,p)=(IF k=i 
                                 THEN entry(D)(j,p) ELSIF k=j THEN entry(D)(i,p)
                            ELSE entry(D)(k,p) ENDIF)} =
     form_matrix(swap(i,j)(entry(D)),rows(D),columns(D))


decl_type: function
theory: matrix_props
library: matrices
location: 181 2 188 70
signature:
  [d: [nat, Vector] ->
          [D: {D | columns(D) = length(d`2)} ->
             {PFM |
                      rows(PFM) = rows(D) AND
                       columns(PFM) = columns(D) AND
                        (FORALL (j):
                           row(PFM)(j) =
                            IF j < rows(D) AND j = d`1 THEN d`2
                            ELSE row(D)(j)
                            ENDIF)
                         AND
                         (FORALL (j, k):
                            entry(PFM)(j, k) =
                             IF j < rows(D) AND j = d`1
                               THEN access(d`2)(k)
                             ELSE entry(D)(j, k)
                             ENDIF)}]]

body:
    replace_row(i,v)(D|columns(D)=length(v)): RECURSIVE 
      {PFM|rows(PFM)=rows(D) AND columns(PFM)=columns(D) AND
        (FORALL (j): row(PFM)(j) = IF j<rows(D) AND j=i THEN v ELSE row(D)(j) ENDIF) AND
        (FORALL (j,k): entry(PFM)(j,k)=IF j<rows(D) AND j=i THEN access(v)(k) ELSE entry(D)(j,k) ENDIF)} =
      IF i>=rows(D) THEN D
      ELSIF rows(D)=1 THEN cons(v,null[list[real]])
      ELSIF i=0 THEN cons(v,cdr(D))
      ELSE cons(car(D),replace_row(i-1,v)(cdr(D))) ENDIF MEASURE rows(D)


decl_type: tcc
theory: matrix_props
library: matrices
signature: nil
location: 247 0 250 999
body:
  % Subtype TCC generated (at line 42, column 51) for  D
      % expected type  (cons?[list[real]])
  columns_cdr_TCC1: OBLIGATION
    FORALL (D: PosFullMatrix): rows(D) > 1 IMPLIES cons?[list[real]](D);


decl_type: tcc
theory: matrix_props
library: matrices
signature: nil
location: 252 0 280 999
body:
  % Subtype TCC generated (at line 57, column 38) for  null[list[real]]
      % expected type  {N |
                     %          (rows(M) > 1 AND columns(M) > 1 IMPLIES
                     %            (rows(N) = rows(M) - 1 AND
                     %              columns(N) = columns(M) - 1))
                     %           AND
                     %           (FORALL (m, n):
                     %              entry(N)(m, n) =
                     %               entry(M)
                     %                    (IF m >= i OR i >= rows(M)
                     %                     THEN 1 + m
                     %                     ELSE m
                     %                     ENDIF,
                     %                     IF n >= j OR j >= columns(M)
                     %                     THEN 1 + n
                     %                     ELSE n
                     %                     ENDIF))}
  remove_TCC1: OBLIGATION
    FORALL (M: Matrix, i: nat, j: nat):
      rows(M) = 0 OR columns(M) = 0 IMPLIES
       (rows(M) > 1 AND columns(M) > 1 IMPLIES
         (rows(null[list[real]]) = rows(M) - 1 AND
           columns(null[list[real]]) = columns(M) - 1))
        AND
        (FORALL (m, n):
           entry(null[list[real]])(m, n) =
            entry(M)
                 (IF m >= i OR i >= rows(M) THEN 1 + m ELSE m ENDIF,
                  IF n >= j OR j >= columns(M) THEN 1 + n ELSE n ENDIF));


decl_type: tcc
theory: matrix_props
library: matrices
signature: nil
location: 282 0 286 999
body:
  % Subtype TCC generated (at line 60, column 85) for  rows(M) - 1
      % expected type  nat
  remove_TCC2: OBLIGATION
    FORALL (M: Matrix):
      NOT rows(M) = 0 AND NOT columns(M) = 0 IMPLIES rows(M) - 1 >= 0;


decl_type: tcc
theory: matrix_props
library: matrices
signature: nil
location: 288 0 292 999
body:
  % Subtype TCC generated (at line 60, column 95) for  columns(M) - 1
      % expected type  nat
  remove_TCC3: OBLIGATION
    FORALL (M: Matrix):
      NOT rows(M) = 0 AND NOT columns(M) = 0 IMPLIES columns(M) - 1 >= 0;


decl_type: tcc
theory: matrix_props
library: matrices
signature: nil
location: 294 0 372 999
body:
  % Subtype TCC generated (at line 58, column 5) for
      % form_matrix(LAMBDA (m, n):
      %               LET newm =
      %                     IF m >= i OR i >= rows(M) THEN m + 1
      %                     ELSE m
      %                     ENDIF,
      %                   newn =
      %                     IF n >= j OR j >= columns(M) THEN n + 1
      %                     ELSE n
      %                     ENDIF
      %                 IN entry(M)(newm, newn),
      %             rows(M) - 1, columns(M) - 1)
      % expected type  {N |
                     %          (rows(M) > 1 AND columns(M) > 1 IMPLIES
                     %            (rows(N) = rows(M) - 1 AND
                     %              columns(N) = columns(M) - 1))
                     %           AND
                     %           (FORALL (m, n):
                     %              entry(N)(m, n) =
                     %               entry(M)
                     %                    (IF m >= i OR i >= rows(M)
                     %                     THEN 1 + m
                     %                     ELSE m
                     %                     ENDIF,
                     %                     IF n >= j OR j >= columns(M)
                     %                     THEN 1 + n
                     %                     ELSE n
                     %                     ENDIF))}
  remove_TCC4: OBLIGATION
    FORALL (M: Matrix, i: nat, j: nat):
      NOT rows(M) = 0 AND NOT columns(M) = 0 IMPLIES
       (rows(M) > 1 AND columns(M) > 1 IMPLIES
         (rows(form_matrix(LAMBDA (m, n):
                             LET newm =
                                   IF m >= i OR i >= rows(M) THEN m + 1
                                   ELSE m
                                   ENDIF,
                                 newn =
                                   IF n >= j OR j >= columns(M) THEN n + 1
                                   ELSE n
                                   ENDIF
                               IN entry(M)(newm, newn),
                           rows(M) - 1, columns(M) - 1))
           = rows(M) - 1
           AND
           columns(form_matrix(LAMBDA (m, n):
                                 LET newm =
                                       IF m >= i OR i >= rows(M)
                                       THEN m + 1
                                       ELSE m
                                       ENDIF,
                                     newn =
                                       IF n >= j OR j >= columns(M)
                                       THEN n + 1
                                       ELSE n
                                       ENDIF
                                   IN entry(M)(newm, newn),
                               rows(M) - 1, columns(M) - 1))
            = columns(M) - 1))
        AND
        (FORALL (m_1: nat, n_1: nat):
           entry(form_matrix(LAMBDA (m, n):
                               LET newm =
                                     IF m >= i OR i >= rows(M) THEN m + 1
                                     ELSE m
                                     ENDIF,
                                   newn =
                                     IF n >= j OR j >= columns(M) THEN n + 1
                                     ELSE n
                                     ENDIF
                                 IN entry(M)(newm, newn),
                             rows(M) - 1, columns(M) - 1))
                (m_1, n_1)
            =
            entry(M)
                 (IF m_1 >= i OR i >= rows(M) THEN 1 + m_1 ELSE m_1 ENDIF,
                  IF n_1 >= j OR j >= columns(M) THEN 1 + n_1
                  ELSE n_1
                  ENDIF));


decl_type: tcc
theory: matrix_props
library: matrices
signature: nil
location: 374 0 381 999
body:
  % Judgement subtype TCC generated (at line 63, column 4) for  remove(D, i, j)
      % expected type  FullMatrix
  remove_posfullmatrix: OBLIGATION
    FORALL (D, i, j):
      null?[list[real]](remove(D, i, j)) OR
       (FORALL (i_1, j_1: below(length[list[real]](remove(D, i, j)))):
          length[real](nth[list[real]](remove(D, i, j), i_1)) =
           length[real](nth[list[real]](remove(D, i, j), j_1)));


decl_type: tcc
theory: matrix_props
library: matrices
signature: nil
location: 383 0 386 999
body:
  % Subtype TCC generated (at line 95, column 60) for  pm - 1
      % expected type  pm: posnat
  remove_Id_0_0_TCC1: OBLIGATION
    FORALL (pm: posnat): pm > 1 IMPLIES pm - 1 >= 0 AND pm - 1 > 0;


decl_type: tcc
theory: matrix_props
library: matrices
signature: nil
location: 388 0 393 999
body:
  % Subtype TCC generated (at line 106, column 17) for  columns(M) - 1
      % expected type  T_high[nat]
  det_TCC1: OBLIGATION
    FORALL (M: Matrix):
      NOT rows(M) = 1 AND NOT null?(M) AND NOT rows(M) /= columns(M) IMPLIES
       columns(M) - 1 >= 0 OR (EXISTS (j: nat): columns(M) - 1 <= j);


decl_type: tcc
theory: matrix_props
library: matrices
signature: nil
location: 395 0 401 999
body:
  % Termination TCC generated (at line 107, column 30) for
      % det(remove(M, 0, k))
  det_TCC2: OBLIGATION
    FORALL (M: Matrix):
      NOT rows(M) = 1 AND NOT null?(M) AND NOT rows(M) /= columns(M) IMPLIES
       (FORALL (k: nat):
          length[list[real]](remove(M, 0, k)) < length[list[real]](M));


decl_type: tcc
theory: matrix_props
library: matrices
signature: nil
location: 403 0 435 999
body:
  % Subtype TCC generated (at line 131, column 3) for
      % form_matrix(swap(i, j)(entry(D)), rows(D), columns(D))
      % expected type  {PFM |
                     %          rows(PFM) = rows(D) AND
                     %           columns(PFM) = columns(D) AND
                     %            (FORALL (k, p):
                     %               i < rows(D) AND j < rows(D) IMPLIES
                     %                entry(PFM)(k, p)
                     %                =
                     %                (IF k = i
                     %                 THEN entry(D)(j, p)
                     %                 ELSIF k = j
                     %                 THEN entry(D)(i, p)
                     %                 ELSE entry(D)(k, p)
                     %                 ENDIF))}
  swap_TCC1: OBLIGATION
    FORALL (i: nat, j: nat, D: PosFullMatrix):
           rows(form_matrix(swap(i, j)(entry(D)), rows(D), columns(D))) =
            rows(D)
       AND columns(form_matrix(swap(i, j)(entry(D)), rows(D), columns(D))) =
            columns(D)
       AND FORALL (k, p):
             i < rows(D) AND j < rows(D) IMPLIES
              entry(form_matrix(swap(i, j)(entry(D)), rows(D), columns(D)))
                   (k, p)
               =
               (IF k = i THEN entry(D)(j, p)
                ELSIF k = j THEN entry(D)(i, p)
                ELSE entry(D)(k, p)
                ENDIF)
       AND rows(form_matrix(swap(i, j)(entry(D)), rows(D), columns(D))) > 0
       AND columns(form_matrix(swap(i, j)(entry(D)), rows(D), columns(D))) >
            0;


decl_type: tcc
theory: matrix_props
library: matrices
signature: nil
location: 437 0 448 999
body:
  % Subtype TCC generated (at line 137, column 29) for
      % (: (: 1, 2 :), (: 3, 4 :) :)
      % expected type  D: PosFullMatrix
  swap_test_TCC1: OBLIGATION
    (null?[list[real]]((: (: 1, 2 :), (: 3, 4 :) :)) OR
      (FORALL (i,
               j: below(length[list[real]]((: (: 1, 2 :), (: 3, 4 :) :)))):
         length[real](nth[list[real]]((: (: 1, 2 :), (: 3, 4 :) :), i)) =
          length[real](nth[list[real]]((: (: 1, 2 :), (: 3, 4 :) :), j))))
     AND
     rows((: (: 1, 2 :), (: 3, 4 :) :)) > 0 AND
      columns((: (: 1, 2 :), (: 3, 4 :) :)) > 0;


decl_type: tcc
theory: matrix_props
library: matrices
signature: nil
location: 450 0 456 999
body:
  % Subtype TCC generated (at line 146, column 44) for  remove(D, 0, n)
      % expected type  D: PosFullMatrix
  remove_swap_2_TCC1: OBLIGATION
    FORALL (D: PosFullMatrix, i, j, n: nat):
           rows(D) = columns(D) AND j < rows(D) AND i < rows(D) AND j /= 0
       AND i /= 0
       IMPLIES rows(remove(D, 0, n)) > 0 AND columns(remove(D, 0, n)) > 0;


decl_type: tcc
theory: matrix_props
library: matrices
signature: nil
location: 458 0 464 999
body:
  % Subtype TCC generated (at line 146, column 35) for  i - 1
      % expected type  nat
  remove_swap_2_TCC2: OBLIGATION
    FORALL (D: PosFullMatrix, i, j: nat):
           rows(D) = columns(D) AND j < rows(D) AND i < rows(D) AND j /= 0
       AND i /= 0
       IMPLIES i - 1 >= 0;


decl_type: tcc
theory: matrix_props
library: matrices
signature: nil
location: 466 0 472 999
body:
  % Subtype TCC generated (at line 146, column 39) for  j - 1
      % expected type  nat
  remove_swap_2_TCC3: OBLIGATION
    FORALL (D: PosFullMatrix, i, j: nat):
           rows(D) = columns(D) AND j < rows(D) AND i < rows(D) AND j /= 0
       AND i /= 0
       IMPLIES j - 1 >= 0;


decl_type: tcc
theory: matrix_props
library: matrices
signature: nil
location: 474 0 503 999
body:
  % Subtype TCC generated (at line 185, column 23) for  D
      % expected type  {PFM |
                     %          rows(PFM) = rows(D) AND
                     %           columns(PFM) = columns(D) AND
                     %            (FORALL (j):
                     %               row(PFM)(j) =
                     %                IF j < rows(D) AND j = i
                     %                THEN v
                     %                ELSE row(D)(j)
                     %                ENDIF)
                     %             AND
                     %             (FORALL (j, k):
                     %                entry(PFM)(j, k)
                     %                =
                     %                IF j < rows(D) AND j = i
                     %                THEN access(v)(k)
                     %                ELSE entry(D)(j, k)
                     %                ENDIF)}
  replace_row_TCC1: OBLIGATION
    FORALL (i: nat, v: Vector,
            D: PosFullMatrix | columns(D) = length[real](v)):
      i >= rows(D) IMPLIES
       (FORALL (j):
          row(D)(j) = IF j < rows(D) AND j = i THEN v ELSE row(D)(j) ENDIF)
        AND
        (FORALL (j, k):
           entry(D)(j, k) =
            IF j < rows(D) AND j = i THEN access(v)(k)
            ELSE entry(D)(j, k)
            ENDIF);


decl_type: tcc
theory: matrix_props
library: matrices
signature: nil
location: 505 0 549 999
body:
  % Subtype TCC generated (at line 186, column 25) for
      % cons(v, null[list[real]])
      % expected type  {PFM |
                     %          rows(PFM) = rows(D) AND
                     %           columns(PFM) = columns(D) AND
                     %            (FORALL (j):
                     %               row(PFM)(j) =
                     %                IF j < rows(D) AND j = i
                     %                THEN v
                     %                ELSE row(D)(j)
                     %                ENDIF)
                     %             AND
                     %             (FORALL (j, k):
                     %                entry(PFM)(j, k)
                     %                =
                     %                IF j < rows(D) AND j = i
                     %                THEN access(v)(k)
                     %                ELSE entry(D)(j, k)
                     %                ENDIF)}
  replace_row_TCC2: OBLIGATION
    FORALL (i: nat, v: Vector,
            D: PosFullMatrix | columns(D) = length[real](v)):
      rows(D) = 1 AND NOT i >= rows(D) IMPLIES
            null?[list[real]](cons[Vector](v, null[list[real]])) OR
             (FORALL (i_1,
                      j:
                        below(length[list[real]]
                                  (cons[Vector](v, null[list[real]])))):
                length[real]
                    (nth[list[real]](cons[Vector](v, null[list[real]]), i_1))
                 =
                 length[real]
                     (nth[list[real]](cons[Vector](v, null[list[real]]), j)))
        AND rows(cons[Vector](v, null[list[real]])) > 0
        AND columns(cons[Vector](v, null[list[real]])) > 0
        AND rows(cons[Vector](v, null[list[real]])) = rows(D)
        AND columns(cons[Vector](v, null[list[real]])) = columns(D)
        AND FORALL (j):
              row(cons[Vector](v, null[list[real]]))(j) =
               IF j < rows(D) AND j = i THEN v ELSE row(D)(j) ENDIF
        AND FORALL (j, k):
              entry(cons[Vector](v, null[list[real]]))(j, k) =
               IF j < rows(D) AND j = i THEN access(v)(k)
               ELSE entry(D)(j, k)
               ENDIF;


decl_type: tcc
theory: matrix_props
library: matrices
signature: nil
location: 551 0 557 999
body:
  % Subtype TCC generated (at line 187, column 30) for  D
      % expected type  (cons?[list[real]])
  replace_row_TCC3: OBLIGATION
    FORALL (i: nat, v: Vector,
            D: PosFullMatrix | columns(D) = length[real](v)):
      i = 0 AND NOT rows(D) = 1 AND NOT i >= rows(D) IMPLIES
       cons?[list[real]](D);


decl_type: tcc
theory: matrix_props
library: matrices
signature: nil
location: 559 0 604 999
body:
  % Subtype TCC generated (at line 187, column 19) for  cons(v, cdr(D))
      % expected type  {PFM |
                     %          rows(PFM) = rows(D) AND
                     %           columns(PFM) = columns(D) AND
                     %            (FORALL (j):
                     %               row(PFM)(j) =
                     %                IF j < rows(D) AND j = i
                     %                THEN v
                     %                ELSE row(D)(j)
                     %                ENDIF)
                     %             AND
                     %             (FORALL (j, k):
                     %                entry(PFM)(j, k)
                     %                =
                     %                IF j < rows(D) AND j = i
                     %                THEN access(v)(k)
                     %                ELSE entry(D)(j, k)
                     %                ENDIF)}
  replace_row_TCC4: OBLIGATION
    FORALL (i: nat, v: Vector,
            D: PosFullMatrix | columns(D) = length[real](v)):
      i = 0 AND NOT rows(D) = 1 AND NOT i >= rows(D) IMPLIES
            null?[list[real]](cons[Vector](v, cdr[list[real]](D))) OR
             (FORALL (i_1,
                      j:
                        below(length[list[real]]
                                  (cons[Vector](v, cdr[list[real]](D))))):
                length[real]
                    (nth[list[real]]
                         (cons[Vector](v, cdr[list[real]](D)), i_1))
                 =
                 length[real]
                     (nth[list[real]]
                          (cons[Vector](v, cdr[list[real]](D)), j)))
        AND rows(cons[Vector](v, cdr[list[real]](D))) > 0
        AND columns(cons[Vector](v, cdr[list[real]](D))) > 0
        AND rows(cons[Vector](v, cdr[list[real]](D))) = rows(D)
        AND columns(cons[Vector](v, cdr[list[real]](D))) = columns(D)
        AND FORALL (j):
              row(cons[Vector](v, cdr[list[real]](D)))(j) =
               IF j < rows(D) AND j = i THEN v ELSE row(D)(j) ENDIF
        AND FORALL (j, k):
              entry(cons[Vector](v, cdr[list[real]](D)))(j, k) =
               IF j < rows(D) AND j = i THEN access(v)(k)
               ELSE entry(D)(j, k)
               ENDIF;


decl_type: tcc
theory: matrix_props
library: matrices
signature: nil
location: 606 0 612 999
body:
  % Subtype TCC generated (at line 188, column 18) for  D
      % expected type  (cons?[list[real]])
  replace_row_TCC5: OBLIGATION
    FORALL (i: nat, v: Vector,
            D: PosFullMatrix | columns(D) = length[real](v)):
      NOT i = 0 AND NOT rows(D) = 1 AND NOT i >= rows(D) IMPLIES
       cons?[list[real]](D);


decl_type: tcc
theory: matrix_props
library: matrices
signature: nil
location: 614 0 626 999
body:
  % Subtype TCC generated (at line 188, column 40) for  cdr(D)
      % expected type  D: {D | columns(D) = length(v)}
  replace_row_TCC6: OBLIGATION
    FORALL (i: nat, v: Vector,
            D: PosFullMatrix | columns(D) = length[real](v)):
      NOT i = 0 AND NOT rows(D) = 1 AND NOT i >= rows(D) IMPLIES
       (null?[list[real]](cdr[list[real]](D)) OR
         (FORALL (i_1, j: below(length[list[real]](cdr[list[real]](D)))):
            length[real](nth[list[real]](cdr[list[real]](D), i_1)) =
             length[real](nth[list[real]](cdr[list[real]](D), j))))
        AND
        (rows(cdr[list[real]](D)) > 0 AND columns(cdr[list[real]](D)) > 0)
         AND columns(cdr[list[real]](D)) = length[real](v);


decl_type: tcc
theory: matrix_props
library: matrices
signature: nil
location: 628 0 633 999
body:
  % Subtype TCC generated (at line 188, column 33) for  i - 1
      % expected type  nat
  replace_row_TCC7: OBLIGATION
    FORALL (i: nat, v: Vector,
            D: PosFullMatrix | columns(D) = length[real](v)):
      NOT i = 0 AND NOT rows(D) = 1 AND NOT i >= rows(D) IMPLIES i - 1 >= 0;


decl_type: tcc
theory: matrix_props
library: matrices
signature: nil
location: 635 0 641 999
body:
  % Termination TCC generated (at line 188, column 21) for
      % replace_row(i - 1, v)(cdr(D))
  replace_row_TCC8: OBLIGATION
    FORALL (i: nat, v: Vector,
            D: PosFullMatrix | columns(D) = length[real](v)):
      NOT i = 0 AND NOT rows(D) = 1 AND NOT i >= rows(D) IMPLIES
       rows(cdr[list[real]](D)) < rows(D);


decl_type: tcc
theory: matrix_props
library: matrices
signature: nil
location: 643 0 736 999
body:
  % Subtype TCC generated (at line 188, column 9) for
      % cons(car(D), replace_row(i - 1, v)(cdr(D)))
      % expected type  {PFM |
                     %          rows(PFM) = rows(D) AND
                     %           columns(PFM) = columns(D) AND
                     %            (FORALL (j):
                     %               row(PFM)(j) =
                     %                IF j < rows(D) AND j = i
                     %                THEN v
                     %                ELSE row(D)(j)
                     %                ENDIF)
                     %             AND
                     %             (FORALL (j, k):
                     %                entry(PFM)(j, k)
                     %                =
                     %                IF j < rows(D) AND j = i
                     %                THEN access(v)(k)
                     %                ELSE entry(D)(j, k)
                     %                ENDIF)}
  replace_row_TCC9: OBLIGATION
    FORALL (i: nat, v: Vector,
            D: PosFullMatrix | columns(D) = length[real](v),
            v1:
              [d1: [nat, Vector] ->
                 [D1:
                    {z: {D | columns(D) = length(d1`2)} |
                             rows(z) < rows(D)} ->
                    {PFM |
                             rows(PFM) = rows(D1) AND
                              columns(PFM) = columns(D1) AND
                               (FORALL (j):
                                  row(PFM)(j) =
                                   IF j < rows(D1) AND j = d1`1 THEN d1`2
                                   ELSE row(D1)(j)
                                   ENDIF)
                                AND
                                (FORALL (j, k):
                                   entry(PFM)(j, k) =
                                    IF j < rows(D1) AND j = d1`1
                                      THEN access(d1`2)(k)
                                    ELSE entry(D1)(j, k)
                                    ENDIF)}]]):
      NOT i = 0 AND NOT rows(D) = 1 AND NOT i >= rows(D) IMPLIES
            null?[list[real]]
                (cons[list[real]]
                     (car[list[real]](D), v1(i - 1, v)(cdr[list[real]](D))))
             OR
             (FORALL (i_1,
                      j:
                        below(length[list[real]]
                                  (cons[list[real]]
                                       (car[list[real]](D),
                                        v1(i - 1, v)(cdr[list[real]](D)))))):
                length[real]
                    (nth[list[real]]
                         (cons[list[real]]
                              (car[list[real]](D),
                               v1(i - 1, v)(cdr[list[real]](D))),
                          i_1))
                 =
                 length[real]
                     (nth[list[real]]
                          (cons[list[real]]
                               (car[list[real]](D),
                                v1(i - 1, v)(cdr[list[real]](D))),
                           j)))
        AND rows(cons[list[real]]
                     (car[list[real]](D), v1(i - 1, v)(cdr[list[real]](D))))
             > 0
        AND columns(cons[list[real]]
                        (car[list[real]](D),
                         v1(i - 1, v)(cdr[list[real]](D))))
             > 0
        AND rows(cons[list[real]]
                     (car[list[real]](D), v1(i - 1, v)(cdr[list[real]](D))))
             = rows(D)
        AND columns(cons[list[real]]
                        (car[list[real]](D),
                         v1(i - 1, v)(cdr[list[real]](D))))
             = columns(D)
        AND FORALL (j):
              row(cons[list[real]]
                      (car[list[real]](D), v1(i - 1, v)(cdr[list[real]](D))))
                 (j)
               = IF j < rows(D) AND j = i THEN v ELSE row(D)(j) ENDIF
        AND FORALL (j, k):
              entry(cons[list[real]]
                        (car[list[real]](D),
                         v1(i - 1, v)(cdr[list[real]](D))))
                   (j, k)
               =
               IF j < rows(D) AND j = i THEN access(v)(k)
               ELSE entry(D)(j, k)
               ENDIF;


decl_type: tcc
theory: matrix_props
library: matrices
signature: nil
location: 738 0 744 999
body:
  % Subtype TCC generated (at line 204, column 69) for  swap(i, j)(D)
      % expected type  D: {D | columns(D) = length(v)}
  swap_replace_row_TCC1: OBLIGATION
    FORALL (D: PosFullMatrix, i, j, k: nat, v: Vector):
           k < rows(D) AND j < rows(D) AND i < rows(D)
       AND columns(D) = length(v) AND i = k
       IMPLIES columns(swap(i, j)(D)) = length[real](v);


decl_type: tcc
theory: matrix_props
library: matrices
signature: nil
location: 746 0 752 999
body:
  % Subtype TCC generated (at line 205, column 47) for  swap(i, j)(D)
      % expected type  D: {D | columns(D) = length(v)}
  swap_replace_row_TCC2: OBLIGATION
    FORALL (D: PosFullMatrix, i, j, k: nat, v: Vector):
           k < rows(D) AND j < rows(D) AND i < rows(D)
       AND columns(D) = length(v) AND NOT i = k AND j = k
       IMPLIES columns(swap(i, j)(D)) = length[real](v);


decl_type: tcc
theory: matrix_props
library: matrices
signature: nil
location: 754 0 760 999
body:
  % Subtype TCC generated (at line 206, column 31) for  swap(i, j)(D)
      % expected type  D: {D | columns(D) = length(v)}
  swap_replace_row_TCC3: OBLIGATION
    FORALL (D: PosFullMatrix, i, j, k: nat, v: Vector):
           k < rows(D) AND j < rows(D) AND i < rows(D)
       AND columns(D) = length(v) AND NOT i = k AND NOT j = k
       IMPLIES columns(swap(i, j)(D)) = length[real](v);


decl_type: tcc
theory: matrix_props
library: matrices
signature: nil
location: 762 0 767 999
body:
  % Subtype TCC generated (at line 215, column 29) for  D
      % expected type  D: {D | columns(D) = length(v1 + v2)}
  det_replace_row_sum_TCC1: OBLIGATION
    FORALL (D: PosFullMatrix, i: nat, v1, v2: Vector):
      i < rows(D) AND columns(D) = length(v1) AND length(v1) = length(v2)
       IMPLIES columns(D) = length[real](v1 + v2);


decl_type: tcc
theory: matrix_props
library: matrices
signature: nil
location: 769 0 774 999
body:
  % Subtype TCC generated (at line 215, column 85) for  D
      % expected type  D: {D | columns(D) = length(v2)}
  det_replace_row_sum_TCC2: OBLIGATION
    FORALL (D: PosFullMatrix, i: nat, v1, v2: Vector):
      i < rows(D) AND columns(D) = length(v1) AND length(v1) = length(v2)
       IMPLIES columns(D) = length[real](v2);


decl_type: tcc
theory: matrix_props
library: matrices
signature: nil
location: 776 0 781 999
body:
  % Subtype TCC generated (at line 218, column 27) for  D
      % expected type  D: {D | columns(D) = length(r * v)}
  det_replace_row_scal_TCC1: OBLIGATION
    FORALL (D: PosFullMatrix, i: nat, r: real, v: Vector):
      i < rows(D) AND columns(D) = length(v) IMPLIES
       columns(D) = length[real](r * v);


decl_type: tcc
theory: matrix_props
library: matrices
signature: nil
location: 783 0 787 999
body:
  % Subtype TCC generated (at line 221, column 29) for  D
      % expected type  D: {D_1 | columns(D_1) = length(row(D)(i))}
  replace_row_id_TCC1: OBLIGATION
    FORALL (D: PosFullMatrix, i: nat):
      i < rows(D) IMPLIES columns(D) = length[real](row(D)(i));


decl_type: tcc
theory: matrix_props
library: matrices
signature: nil
location: 789 0 797 999
body:
  % Subtype TCC generated (at line 224, column 45) for  D
      % expected type  D:
                     %   {D_1 |
                     %            columns(D_1) =
                     %             length(row(D)(i) + r * row(D)(j))}
  det_replace_row_sum_scal_TCC1: OBLIGATION
    FORALL (D: PosFullMatrix, i, j: nat, r: real):
      i /= j AND j < rows(D) AND i < rows(D) IMPLIES
       columns(D) = length[real](row(D)(i) + r * row(D)(j));


decl_type: tcc
theory: matrix_props
library: matrices
signature: nil
location: 799 0 804 999
body:
  % Subtype TCC generated (at line 227, column 39) for  D
      % expected type  D: {D_1 | columns(D_1) = length(row(D)(i) + row(D)(j))}
  replace_row_sum_to_scal_TCC1: OBLIGATION
    FORALL (D: PosFullMatrix, i, j: nat):
      j < rows(D) AND i < rows(D) IMPLIES
       columns(D) = length[real](row(D)(i) + row(D)(j));


decl_type: tcc
theory: matrix_props
library: matrices
signature: nil
location: 806 0 814 999
body:
  % Subtype TCC generated (at line 227, column 79) for  D
      % expected type  D:
                     %   {D_1 |
                     %            columns(D_1) =
                     %             length(row(D)(i) + 1 * row(D)(j))}
  replace_row_sum_to_scal_TCC2: OBLIGATION
    FORALL (D: PosFullMatrix, i, j: nat):
      j < rows(D) AND i < rows(D) IMPLIES
       columns(D) = length[real](row(D)(i) + 1 * row(D)(j));


decl_type: tcc
theory: matrix_props
library: matrices
signature: nil
location: 816 0 821 999
body:
  % Subtype TCC generated (at line 238, column 14) for  remove(D, j, i)
      % expected type  PosFullMatrix
  remove_transpose_TCC1: OBLIGATION
    FORALL (D: PosFullMatrix, i, j: nat):
      columns(D) > 1 AND rows(D) > 1 IMPLIES
       rows(remove(D, j, i)) > 0 AND columns(remove(D, j, i)) > 0;


decl_type: formula
theory: matrix_det
library: matrices
signature: nil
location: 41 2 42 67
body:
    entry_Esr: LEMMA entry(Esr(pn)(i,r))(k,j) =
      IF k/=j OR k>=pn OR j>=pn THEN 0 ELSIF k/=i THEN 1 ELSE r ENDIF


decl_type: formula
theory: matrix_det
library: matrices
signature: nil
location: 63 2 65 51
body:
    entry_Ers: LEMMA entry(Ers(pn)(i,j))(k,p) =
      IF k>=pn OR p>=pn THEN 0 ELSIF k=i AND p=j THEN 1 ELSIF k=j AND p=i THEN 1
      ELSIF k/=i AND k/=j AND k=p THEN 1 ELSE 0 ENDIF


decl_type: formula
theory: matrix_det
library: matrices
signature: nil
location: 88 2 91 30
body:
    entry_Easr: LEMMA entry(Easr(pn)(i,j,r))(k,p) =
      IF k>=pn OR p>=pn THEN 0 ELSIF k=i THEN (IF j=i AND p=i THEN 1+r
          ELSIF p=i THEN 1 ELSIF p=j THEN r ELSE 0 ENDIF)
          ELSIF k=p THEN 1 ELSE 0 ENDIF


decl_type: formula
theory: matrix_det
library: matrices
signature: nil
location: 97 2 98 63
body:
    mult_Easr_left: LEMMA rows(D)=pn AND i<pn AND j<pn IMPLIES
      Easr(pn)(i,j,r)*D = replace_row(i,row(D)(i)+r*row(D)(j))(D)


decl_type: formula
theory: matrix_det
library: matrices
signature: nil
location: 105 2 106 45
body:
    mult_Easr_Easr_inv: LEMMA i<pn AND j<pn AND i/=j IMPLIES
      Easr(pn)(i,j,r)*Easr(pn)(i,j,-r) = Id(pn)


decl_type: formula
theory: matrix_det
library: matrices
signature: nil
location: 121 2 122 52
body:
    prod_diag_remove_0_0: LEMMA k+1<rows(S) IMPLIES
      prod_diag(remove(S, 0, 0), k) = prod_diag(S,k+1)


decl_type: formula
theory: matrix_det
library: matrices
signature: nil
location: 133 2 135 62
body:
    det_upper_triangular_zero: LEMMA
      upper_triangular?(S) IMPLIES
      (det(S)=0 IFF (EXISTS (i): i<rows(S) AND entry(S)(i,i)=0))


decl_type: formula
theory: matrix_det
library: matrices
signature: nil
location: 137 2 139 26
body:
    upper_triangular_mult: LEMMA
      upper_triangular?(S) AND upper_triangular?(R) IMPLIES
      upper_triangular?(S*R)


decl_type: formula
theory: matrix_det
library: matrices
signature: nil
location: 144 2 146 26
body:
    lower_triangular_mult: LEMMA
      lower_triangular?(S) AND lower_triangular?(R) IMPLIES
      lower_triangular?(S*R)


decl_type: formula
theory: matrix_det
library: matrices
signature: nil
location: 167 2 168 87
body:
    prod_mat_eq: LEMMA FORALL (FM,GM:[nat->SquareMatrix(pn)]):
      (FORALL (i):i<=k IMPLIES FM(i)=GM(i)) IMPLIES prod_mat(pn)(FM,k)=prod_mat(pn)(GM,k)


decl_type: formula
theory: matrix_det
library: matrices
signature: nil
location: 170 2 172 79
body:
    mult_prod_mat: LEMMA FORALL (FM,GM:[nat->SquareMatrix(pn)]):
      prod_mat(pn)(FM,k)*prod_mat(pn)(GM,p) =
      prod_mat(pn)(LAMBDA (i:nat): IF i<=k THEN FM(i) ELSE GM(i-k-1) ENDIF,k+p+1)


decl_type: formula
theory: matrix_det
library: matrices
signature: nil
location: 174 2 175 68
body:
    prod_mat_expand_left: LEMMA FORALL (FM:[nat->SquareMatrix(pn)]): k>0 IMPLIES
      prod_mat(pn)(FM,k) = FM(0)*prod_mat(pn)(LAMBDA (i): FM(i+1),k-1)


decl_type: formula
theory: matrix_det
library: matrices
signature: nil
location: 177 2 179 48
body:
    transpose_prod_mat: LEMMA FORALL (FM:[nat->SquareMatrix(pn)]):
      transpose(prod_mat(pn)(FM,k)) = prod_mat(pn)(LAMBDA (i): IF i<=k THEN 
                                    transpose(FM(k-i)) ELSE FM(i) ENDIF,k)


decl_type: formula
theory: matrix_det
library: matrices
signature: nil
location: 191 2 194 56
body:
    mult_simple_prod: LEMMA FORALL (R,S:SquareMatrix(pn)):
      is_simple_prod?(pn,include_scals,include_swaps)(R) AND
      is_simple_prod?(pn,include_scals,include_swaps)(S) IMPLIES
      is_simple_prod?(pn,include_scals,include_swaps)(R*S)


decl_type: formula
theory: matrix_det
library: matrices
signature: nil
location: 198 2 199 65
body:
    Esr_simple_prod: LEMMA i<pn AND include_scals  IMPLIES
      is_simple_prod?(pn,include_scals,include_swaps)(Esr(pn)(i,r))


decl_type: formula
theory: matrix_det
library: matrices
signature: nil
location: 201 2 202 65
body:
    Ers_simple_prod: LEMMA i<pn AND j<pn AND include_swaps IMPLIES
      is_simple_prod?(pn,include_scals,include_swaps)(Ers(pn)(i,j))


decl_type: formula
theory: matrix_det
library: matrices
signature: nil
location: 204 2 205 68
body:
    Easr_simple_prod: LEMMA i<pn AND j<pn AND i/=j IMPLIES
      is_simple_prod?(pn,include_scals,include_swaps)(Easr(pn)(i,j,r))


decl_type: formula
theory: matrix_det
library: matrices
signature: nil
location: 207 2 209 12
body:
    det_simple_prod_1: LEMMA FORALL (S:SquareMatrix(pn)):
      is_simple_prod?(pn,false,false)(S) IMPLIES
      det(S)=1


decl_type: formula
theory: matrix_det
library: matrices
signature: nil
location: 211 2 213 19
body:
    det_mult_simple_prod_left: LEMMA FORALL (S,R:SquareMatrix(pn)):
      is_simple_prod?(pn,false,false)(S) IMPLIES
      det(S*R)=det(R)


decl_type: formula
theory: matrix_det
library: matrices
signature: nil
location: 217 2 219 65
body:
    transpose_simple_prod: LEMMA FORALL (S:SquareMatrix(pn)):
      is_simple_prod?(pn,include_scals,include_swaps)(S) IFF 
      is_simple_prod?(pn,include_scals,include_swaps)(transpose(S))


decl_type: formula
theory: matrix_det
library: matrices
signature: nil
location: 221 2 222 67
body:
    diagonal_simple_prod: LEMMA FORALL (S:SquareMatrix(pn)):
                          diagonal?(S) IMPLIES is_simple_prod?(pn,true,include_swaps)(S)


decl_type: formula
theory: matrix_det
library: matrices
signature: nil
location: 224 2 229 56
body:
    is_simple_prod_implic: LEMMA
      FORALL (S:SquareMatrix(pn),include_scals2,include_swaps2:bool):
      (include_scals IMPLIES include_scals2) AND
      (include_swaps IMPLIES include_swaps2) AND
      is_simple_prod?(pn,include_scals,include_swaps)(S) IMPLIES
      is_simple_prod?(pn,include_scals2,include_swaps2)(S)


decl_type: function
theory: matrix_det
library: matrices
signature: [pn: posnat -> [[nat, real] -> SquareMatrix(pn)]]
location: 38 2 39 86
body:
    Esr(pn)(i,r): SquareMatrix(pn) =
      form_matrix(LAMBDA (k,j:nat): IF k/=j THEN 0 ELSIF k/=i THEN 1 ELSE r ENDIF,pn,pn)


decl_type: function
theory: matrix_det
library: matrices
location: 57 2 61 25
signature:
  [pn: posnat ->
          [d: [nat, nat] ->
             {M: SquareMatrix(pn) | M = swap(d`1, d`2)(Id(pn))}]]

body:
    Ers(pn)(i,j): {M:SquareMatrix(pn)|M=swap(i,j)(Id(pn))} =
      form_matrix(LAMBDA (k,p:nat): IF k=i AND p=j THEN 1
                                    ELSIF k=j AND p=i THEN 1
                                    ELSIF k/=i AND k/=j AND k=p THEN 1
                                    ELSE 0 ENDIF,pn,pn)


decl_type: function
theory: matrix_det
library: matrices
signature: [pn: posnat -> [[nat, nat, real] -> SquareMatrix(pn)]]
location: 82 2 86 42
body:
    Easr(pn)(i,j,r): SquareMatrix(pn) =
      form_matrix(LAMBDA (k,p:nat): IF k=i THEN (IF j=i AND p=i THEN 1+r
                                                 ELSIF p=i THEN 1 ELSIF p=j THEN r
                                                 ELSE 0 ENDIF)
                                    ELSIF k=p THEN 1 ELSE 0 ENDIF,pn,pn)


decl_type: function
theory: matrix_det
library: matrices
signature: [[{M | rows(M) > 0}, nat] -> real]
location: 117 2 119 70
body:
    prod_diag((M|rows(M)>0),i): RECURSIVE real =
      IF i >=rows(M)-1 THEN entry(M)(rows(M)-1,rows(M)-1) 
      ELSE entry(M)(i,i)*prod_diag(M,i+1) ENDIF MEASURE max(rows(M)-i,0)


decl_type: function
theory: matrix_det
library: matrices
signature:
  [pn: posnat ->
  [[[nat -> SquareMatrix(pn)], nat] -> SquareMatrix(pn)]]

location: 164 2 165 69
body:
    prod_mat(pn)(FM:[nat->SquareMatrix(pn)],k): RECURSIVE SquareMatrix(pn) =
      IF k=0 THEN FM(0) ELSE prod_mat(pn)(FM,k-1)*FM(k) ENDIF MEASURE k


decl_type: function
theory: matrix_det
library: matrices
signature:
  [pn: posnat ->
  [[[nat -> SquareMatrix(pn)], nat, bool, bool] -> bool]]

location: 181 2 185 69
body:
    is_simple_seq?(pn)(FM:[nat->SquareMatrix(pn)],k,include_scals,include_swaps):bool =
      FORALL (p): FM(p)=Id(pn) OR 
        (include_swaps AND EXISTS (i,j): i<pn AND j<pn AND FM(p)=Ers(pn)(i,j)) OR
        (EXISTS (i,j,r): i<pn AND j<pn AND i/=j AND FM(p) = Easr(pn)(i,j,r)) OR
        (include_scals AND EXISTS (i,r): i<pn AND FM(p) = Esr(pn)(i,r))


decl_type: function
theory: matrix_det
library: matrices
signature: [d: [posnat, bool, bool] -> [SquareMatrix(d`1) -> bool]]
location: 187 2 189 33
body:
    is_simple_prod?(pn,include_scals,include_swaps)(SQ:SquareMatrix(pn)): bool = 
      EXISTS (FM:[nat->SquareMatrix(pn)],k): is_simple_seq?(pn)(FM,k,include_scals,include_swaps)
        AND SQ = prod_mat(pn)(FM,k)


decl_type: tcc
theory: matrix_det
library: matrices
signature: nil
location: 240 0 274 999
body:
  % Subtype TCC generated (at line 39, column 4) for
      % form_matrix(LAMBDA (k, j: nat):
      %               IF k /= j THEN 0 ELSIF k /= i THEN 1 ELSE r ENDIF,
      %             pn, pn)
      % expected type  SquareMatrix(pn)
  Esr_TCC1: OBLIGATION
    FORALL (pn: posnat, i: nat, r: real):
      rows(form_matrix(LAMBDA (k, j: nat):
                         IF k /= j THEN 0 ELSIF k /= i THEN 1 ELSE r ENDIF,
                       pn, pn))
       = pn
       AND
       rows(form_matrix(LAMBDA (k, j: nat):
                          IF k /= j THEN 0 ELSIF k /= i THEN 1 ELSE r ENDIF,
                        pn, pn))
        =
        columns(form_matrix(LAMBDA (k, j: nat):
                              IF k /= j THEN 0
                              ELSIF k /= i THEN 1
                              ELSE r
                              ENDIF,
                            pn, pn))
        AND
        rows(form_matrix(LAMBDA (k, j: nat):
                           IF k /= j THEN 0 ELSIF k /= i THEN 1 ELSE r ENDIF,
                         pn, pn))
         > 0
         AND
         columns(form_matrix(LAMBDA (k, j: nat):
                               IF k /= j THEN 0
                               ELSIF k /= i THEN 1
                               ELSE r
                               ENDIF,
                             pn, pn))
          > 0;


decl_type: tcc
theory: matrix_det
library: matrices
signature: nil
location: 276 0 281 999
body:
  % Subtype TCC generated (at line 52, column 95) for  D
      % expected type  D: {D_1 | columns(D_1) = length(r * row(D)(i))}
  mult_Esr_left_TCC1: OBLIGATION
    FORALL (D: PosFullMatrix, i: nat, pn: posnat, r: real):
      i < pn AND rows(D) = pn IMPLIES
       columns(D) = length[real](r * row(D)(i));


decl_type: tcc
theory: matrix_det
library: matrices
signature: nil
location: 283 0 340 999
body:
  % Subtype TCC generated (at line 58, column 4) for
      % form_matrix(LAMBDA (k, p: nat):
      %               IF k = i AND p = j THEN 1
      %               ELSIF k = j AND p = i THEN 1
      %               ELSIF k /= i AND k /= j AND k = p THEN 1
      %               ELSE 0
      %               ENDIF,
      %             pn, pn)
      % expected type  {M: SquareMatrix(pn) | M = swap(i, j)(Id(pn))}
  Ers_TCC1: OBLIGATION
    FORALL (pn: posnat, i: nat, j: nat):
           form_matrix(LAMBDA (k, p: nat):
                         IF k = i AND p = j THEN 1
                         ELSIF k = j AND p = i THEN 1
                         ELSIF k /= i AND k /= j AND k = p THEN 1
                         ELSE 0
                         ENDIF,
                       pn, pn)
            = swap(i, j)(Id(pn))
       AND rows(form_matrix(LAMBDA (k, p: nat):
                              IF k = i AND p = j THEN 1
                              ELSIF k = j AND p = i THEN 1
                              ELSIF k /= i AND k /= j AND k = p THEN 1
                              ELSE 0
                              ENDIF,
                            pn, pn))
            = pn
       AND rows(form_matrix(LAMBDA (k, p: nat):
                              IF k = i AND p = j THEN 1
                              ELSIF k = j AND p = i THEN 1
                              ELSIF k /= i AND k /= j AND k = p THEN 1
                              ELSE 0
                              ENDIF,
                            pn, pn))
            =
            columns(form_matrix(LAMBDA (k, p: nat):
                                  IF k = i AND p = j THEN 1
                                  ELSIF k = j AND p = i THEN 1
                                  ELSIF k /= i AND k /= j AND k = p THEN 1
                                  ELSE 0
                                  ENDIF,
                                pn, pn))
       AND rows(form_matrix(LAMBDA (k, p: nat):
                              IF k = i AND p = j THEN 1
                              ELSIF k = j AND p = i THEN 1
                              ELSIF k /= i AND k /= j AND k = p THEN 1
                              ELSE 0
                              ENDIF,
                            pn, pn))
            > 0
       AND columns(form_matrix(LAMBDA (k, p: nat):
                                 IF k = i AND p = j THEN 1
                                 ELSIF k = j AND p = i THEN 1
                                 ELSIF k /= i AND k /= j AND k = p THEN 1
                                 ELSE 0
                                 ENDIF,
                               pn, pn))
            > 0;


decl_type: tcc
theory: matrix_det
library: matrices
signature: nil
location: 342 0 424 999
body:
  % Subtype TCC generated (at line 83, column 4) for
      % form_matrix(LAMBDA (k, p: nat):
      %               IF k = i
      %                 THEN (IF j = i AND p = i THEN 1 + r
      %                       ELSIF p = i THEN 1
      %                       ELSIF p = j THEN r
      %                       ELSE 0
      %                       ENDIF)
      %               ELSIF k = p THEN 1
      %               ELSE 0
      %               ENDIF,
      %             pn, pn)
      % expected type  SquareMatrix(pn)
  Easr_TCC1: OBLIGATION
    FORALL (pn: posnat, i: nat, j: nat, r: real):
      rows(form_matrix(LAMBDA (k, p: nat):
                         IF k = i
                           THEN (IF j = i AND p = i THEN 1 + r
                                 ELSIF p = i THEN 1
                                 ELSIF p = j THEN r
                                 ELSE 0
                                 ENDIF)
                         ELSIF k = p THEN 1
                         ELSE 0
                         ENDIF,
                       pn, pn))
       = pn
       AND
       rows(form_matrix(LAMBDA (k, p: nat):
                          IF k = i
                            THEN (IF j = i AND p = i THEN 1 + r
                                  ELSIF p = i THEN 1
                                  ELSIF p = j THEN r
                                  ELSE 0
                                  ENDIF)
                          ELSIF k = p THEN 1
                          ELSE 0
                          ENDIF,
                        pn, pn))
        =
        columns(form_matrix(LAMBDA (k, p: nat):
                              IF k = i
                                THEN (IF j = i AND p = i
                                      THEN 1 + r
                                      ELSIF p = i
                                      THEN 1
                                      ELSIF p = j
                                      THEN r
                                      ELSE 0
                                      ENDIF)
                              ELSIF k = p THEN 1
                              ELSE 0
                              ENDIF,
                            pn, pn))
        AND
        rows(form_matrix(LAMBDA (k, p: nat):
                           IF k = i
                             THEN (IF j = i AND p = i THEN 1 + r
                                   ELSIF p = i THEN 1
                                   ELSIF p = j THEN r
                                   ELSE 0
                                   ENDIF)
                           ELSIF k = p THEN 1
                           ELSE 0
                           ENDIF,
                         pn, pn))
         > 0
         AND
         columns(form_matrix(LAMBDA (k, p: nat):
                               IF k = i
                                 THEN (IF j = i AND p = i
                                       THEN 1 + r
                                       ELSIF p = i
                                       THEN 1
                                       ELSIF p = j
                                       THEN r
                                       ELSE 0
                                       ENDIF)
                               ELSIF k = p THEN 1
                               ELSE 0
                               ENDIF,
                             pn, pn))
          > 0;


decl_type: tcc
theory: matrix_det
library: matrices
signature: nil
location: 426 0 434 999
body:
  % Subtype TCC generated (at line 98, column 61) for  D
      % expected type  D:
                     %   {D_1 |
                     %            columns(D_1) =
                     %             length(row(D)(i) + r * row(D)(j))}
  mult_Easr_left_TCC1: OBLIGATION
    FORALL (D: PosFullMatrix, i, j: nat, pn: posnat, r: real):
      j < pn AND i < pn AND rows(D) = pn IMPLIES
       columns(D) = length[real](row(D)(i) + r * row(D)(j));


decl_type: tcc
theory: matrix_det
library: matrices
signature: nil
location: 436 0 446 999
body:
  % Subtype TCC generated (at line 110, column 31) for
      % form_matrix(LAMBDA (i, j): 0, pn, pn)
      % expected type  SquareMatrix(pn)
  ZERO_TCC1: OBLIGATION
    FORALL (pn: posnat):
      rows(form_matrix(LAMBDA (i, j): 0, pn, pn)) = pn AND
       rows(form_matrix(LAMBDA (i, j): 0, pn, pn)) =
        columns(form_matrix(LAMBDA (i, j): 0, pn, pn))
        AND
        rows(form_matrix(LAMBDA (i, j): 0, pn, pn)) > 0 AND
         columns(form_matrix(LAMBDA (i, j): 0, pn, pn)) > 0;


decl_type: tcc
theory: matrix_det
library: matrices
signature: nil
location: 448 0 451 999
body:
  % Subtype TCC generated (at line 119, column 54) for  max(rows(M) - i, 0)
      % expected type  naturalnumber
  prod_diag_TCC1: OBLIGATION
    FORALL ((M: Matrix | rows(M) > 0), i: nat): max(rows(M) - i, 0) >= 0;


decl_type: tcc
theory: matrix_det
library: matrices
signature: nil
location: 453 0 457 999
body:
  % Subtype TCC generated (at line 118, column 35) for  rows(M) - 1
      % expected type  nat
  prod_diag_TCC2: OBLIGATION
    FORALL ((M: Matrix | rows(M) > 0), i: nat):
      i >= rows(M) - 1 IMPLIES rows(M) - 1 >= 0;


decl_type: tcc
theory: matrix_det
library: matrices
signature: nil
location: 459 0 464 999
body:
  % Termination TCC generated (at line 119, column 23) for
      % prod_diag(M, i + 1)
  prod_diag_TCC3: OBLIGATION
    FORALL ((M: Matrix | rows(M) > 0), i: nat):
      NOT i >= rows(M) - 1 IMPLIES
       max(rows(M) - (i + 1), 0) < max(rows(M) - i, 0);


decl_type: tcc
theory: matrix_det
library: matrices
signature: nil
location: 466 0 470 999
body:
  % Subtype TCC generated (at line 122, column 14) for  remove(S, 0, 0)
      % expected type  {M | rows(M) > 0}
  prod_diag_remove_0_0_TCC1: OBLIGATION
    FORALL (S: Square, k: nat):
      k + 1 < rows(S) IMPLIES rows(remove(S, 0, 0)) > 0;


decl_type: tcc
theory: matrix_det
library: matrices
signature: nil
location: 472 0 476 999
body:
  % Subtype TCC generated (at line 165, column 43) for  k - 1
      % expected type  nat
  prod_mat_TCC1: OBLIGATION
    FORALL (pn: posnat, FM: [nat -> SquareMatrix(pn)], k: nat):
      NOT k = 0 IMPLIES k - 1 >= 0;


decl_type: tcc
theory: matrix_det
library: matrices
signature: nil
location: 478 0 482 999
body:
  % Termination TCC generated (at line 165, column 27) for
      % prod_mat(pn)(FM, k - 1)
  prod_mat_TCC2: OBLIGATION
    FORALL (pn: posnat, FM: [nat -> SquareMatrix(pn)], k: nat):
      NOT k = 0 IMPLIES k - 1 < k;


decl_type: tcc
theory: matrix_det
library: matrices
signature: nil
location: 484 0 498 999
body:
  % Subtype TCC generated (at line 165, column 27) for
      % prod_mat(pn)(FM, k - 1) * FM(k)
      % expected type  SquareMatrix(pn)
  prod_mat_TCC3: OBLIGATION
    FORALL (pn: posnat, FM: [nat -> SquareMatrix(pn)], k: nat,
            v:
              [pn1: posnat ->
                 [{z: [[nat -> SquareMatrix(pn1)], nat] | z`2 < k} ->
                    SquareMatrix(pn1)]]):
      NOT k = 0 IMPLIES
       rows(v(pn)(FM, k - 1) * FM(k)) = pn AND
        rows(v(pn)(FM, k - 1) * FM(k)) = columns(v(pn)(FM, k - 1) * FM(k))
         AND
         rows(v(pn)(FM, k - 1) * FM(k)) > 0 AND
          columns(v(pn)(FM, k - 1) * FM(k)) > 0;


decl_type: tcc
theory: matrix_det
library: matrices
signature: nil
location: 500 0 504 999
body:
  % Subtype TCC generated (at line 172, column 60) for  i - k - 1
      % expected type  nat
  mult_prod_mat_TCC1: OBLIGATION
    FORALL (k: nat, pn: posnat, FM, GM: [nat -> SquareMatrix(pn)], i: nat):
      NOT i <= k IMPLIES i - k - 1 >= 0;


decl_type: tcc
theory: matrix_det
library: matrices
signature: nil
location: 506 0 510 999
body:
  % Subtype TCC generated (at line 175, column 64) for  k - 1
      % expected type  nat
  prod_mat_expand_left_TCC1: OBLIGATION
    FORALL (k: nat, pn: posnat, FM: [nat -> SquareMatrix(pn)]):
      k > 0 IMPLIES k - 1 >= 0;


decl_type: tcc
theory: matrix_det
library: matrices
signature: nil
location: 512 0 516 999
body:
  % Subtype TCC generated (at line 179, column 23) for  k - i
      % expected type  nat
  transpose_prod_mat_TCC1: OBLIGATION
    FORALL (k: nat, pn: posnat, FM: [nat -> SquareMatrix(pn)], i: nat):
      i <= k IMPLIES k - i >= 0;


decl_type: tcc
theory: matrix_det
library: matrices
signature: nil
location: 518 0 524 999
body:
  % Subtype TCC generated (at line 179, column 10) for  transpose(FM(k - i))
      % expected type  SquareMatrix(pn)
  transpose_prod_mat_TCC2: OBLIGATION
    FORALL (k: nat, pn: posnat, FM: [nat -> SquareMatrix(pn)], i: nat):
      i <= k IMPLIES
       rows(transpose(FM(k - i))) = columns(transpose(FM(k - i))) AND
        rows(transpose(FM(k - i))) = pn;


decl_type: tcc
theory: matrix_det
library: matrices
signature: nil
location: 526 0 536 999
body:
  % Subtype TCC generated (at line 194, column 52) for  R * S
      % expected type  SquareMatrix(pn)
  mult_simple_prod_TCC1: OBLIGATION
    FORALL (include_scals, include_swaps: bool, pn: posnat,
            R, S: SquareMatrix(pn)):
      is_simple_prod?(pn, include_scals, include_swaps)(R) AND
       is_simple_prod?(pn, include_scals, include_swaps)(S)
       IMPLIES
       rows(R * S) = pn AND
        rows(R * S) = columns(R * S) AND
         rows(R * S) > 0 AND columns(R * S) > 0;


decl_type: tcc
theory: matrix_det
library: matrices
signature: nil
location: 538 0 542 999
body:
  % Subtype TCC generated (at line 219, column 52) for  transpose(S)
      % expected type  SquareMatrix(pn)
  transpose_simple_prod_TCC1: OBLIGATION
    FORALL (pn: posnat, S: SquareMatrix(pn)):
      rows(transpose(S)) = columns(transpose(S)) AND rows(transpose(S)) = pn;


decl_type: function
theory: matrix_upper_triang
library: matrices
signature: [Square -> [nat -> bool]]
location: 36 2 38 70
body:
    ut_point1(SQ)(j): bool = 
      j<rows(SQ) AND
      (FORALL (k,p):p<j AND k>p AND k<rows(SQ) IMPLIES entry(SQ)(k,p)=0)


decl_type: function
theory: matrix_upper_triang
library: matrices
signature: [[Square, nat] -> [nat -> bool]]
location: 40 2 42 60
body:
    ut_point2(SQ,j)(i): bool =
      i<rows(SQ) AND i>=j AND
      (FORALL (k):k>i AND k<rows(SQ) IMPLIES entry(SQ)(k,j)=0)


decl_type: function
theory: matrix_upper_triang
library: matrices
location: 46 2 76 90
signature:
  [pn: posnat ->
          [d:
             [comp_matrix: bool, comp_inverse: bool, S: SquareMatrix(pn),
              Q:
                {Q: SquareMatrix(pn) |
                         is_simple_prod?(pn, FALSE, FALSE)(Q)},
              {R: SquareMatrix(pn) |
                       is_simple_prod?(pn, FALSE, FALSE)(R) AND
                        (comp_matrix AND comp_inverse IMPLIES
                          (R * Q = Id(pn) AND Q * R = Id(pn)))},
              {T: SquareMatrix(pn) | comp_matrix IMPLIES Q * T = S},
              j: {j | ut_point1(S)(j)}, {i | ut_point2(S, j)(i)}, bool,
              nat] ->
             {SGI:
                [SquareMatrix(pn), SquareMatrix(pn), SquareMatrix(pn)] |
                      (NOT d`9) IMPLIES
                       upper_triangular?(SGI`1) AND
                        (d`1 IMPLIES
                          SGI`2 * d`6 = SGI`1 AND
                           is_simple_prod?(pn, FALSE, FALSE)(SGI`2))
                         AND
                         (d`1 AND d`2 IMPLIES
                           (SGI`3 * SGI`2 = Id(pn) AND
                             SGI`2 * SGI`3 = Id(pn) AND
                              is_simple_prod?(pn, FALSE, FALSE)(SGI`3)))
                          AND det(SGI`1) = det(d`3)}]]

body:
    upper_triangulate(pn)(comp_matrix,comp_inverse:bool,
      S:SquareMatrix(pn),
      (Q:SquareMatrix(pn)|is_simple_prod?(pn,false,false)(Q)),
      (R:SquareMatrix(pn)|is_simple_prod?(pn,false,false)(R) 
                   AND (comp_matrix AND comp_inverse IMPLIES (R*Q=Id(pn) AND Q*R=Id(pn)))),
      (T:SquareMatrix(pn)|comp_matrix IMPLIES Q*T = S),
      (j|ut_point1(S)(j)),(i|ut_point2(S,j)(i)),stop_rec:bool,k): RECURSIVE
        {SGI:[SquareMatrix(pn),SquareMatrix(pn),SquareMatrix(pn)]|
          (not stop_rec) IMPLIES (LET (S2,Q2,R2)=SGI IN
           upper_triangular?(S2) AND
           (comp_matrix IMPLIES Q2*T=S2 AND is_simple_prod?(pn,false,false)(Q2)) AND
           (comp_matrix AND comp_inverse IMPLIES (R2*Q2=Id(pn) AND Q2*R2=Id(pn) AND 
                  is_simple_prod?(pn,false,false)(R2))) AND
           det(S2)=det(S))} =
      IF (stop_rec AND k=0) OR (i=pn-1 AND j=pn-1) THEN (S,Q,R)
      ELSIF i=j THEN upper_triangulate(pn)(comp_matrix,comp_inverse,S,Q,R,T,j+1,pn-1,stop_rec,max(k-1,0))
      ELSIF entry(S)(i,j)=0 THEN upper_triangulate(pn)(comp_matrix,comp_inverse,S,Q,R,T,j,i-1,stop_rec,max(k-1,0))
      ELSIF entry(S)(j,j)=0 THEN 
        upper_triangulate(pn)(comp_matrix,comp_inverse,
                             replace_row(j,row(S)(j)+row(S)(i))(S),
                             IF comp_matrix THEN replace_row(j,row(Q)(j)+row(Q)(i))(Q)
                                  ELSE Id(pn) ENDIF,
                             IF comp_matrix AND comp_inverse THEN R*Easr(pn)(j,i,-1) ELSE Id(pn) ENDIF,
                             T,j,i,stop_rec,max(k-1,0))
      ELSE LET pivnum = -entry(S)(i,j)/entry(S)(j,j) IN
        upper_triangulate(pn)(comp_matrix,comp_inverse,
                             replace_row(i,row(S)(i)+pivnum*row(S)(j))(S),
                             IF comp_matrix THEN replace_row(i,row(Q)(i)+pivnum*row(Q)(j))(Q) ELSE Id(pn) ENDIF,
                             IF comp_matrix AND comp_inverse THEN R*Easr(pn)(i,j,-pivnum) ELSE Id(pn) ENDIF,
                             T,j,i-1,stop_rec,max(k-1,0))
      ENDIF MEASURE lex3(pn-j,i,IF entry(S)(i,j)/=0 AND entry(S)(j,j)=0 THEN 1 ELSE 0 ENDIF)


decl_type: tcc
theory: matrix_upper_triang
library: matrices
signature: nil
location: 86 0 97 999
body:
  % Subtype TCC generated (at line 76, column 23) for  pn - j
      % expected type  nat
  upper_triangulate_TCC1: OBLIGATION
    FORALL (pn: posnat, comp_matrix, comp_inverse: bool, S: SquareMatrix(pn),
            (Q: SquareMatrix(pn) | is_simple_prod?(pn, FALSE, FALSE)(Q)),
            (R: SquareMatrix(pn)
                 | is_simple_prod?(pn, FALSE, FALSE)(R) AND
                    (comp_matrix AND comp_inverse IMPLIES
                      (R * Q = Id(pn) AND Q * R = Id(pn)))),
            (T: SquareMatrix(pn) | comp_matrix IMPLIES Q * T = S),
            (j: nat | ut_point1(S)(j)), (i: nat | ut_point2(S, j)(i))):
      pn - j >= 0;


decl_type: tcc
theory: matrix_upper_triang
library: matrices
signature: nil
location: 99 0 115 999
body:
  % Subtype TCC generated (at line 76, column 23) for  pn1 - z`7
      % expected type  nat
  upper_triangulate_TCC2: OBLIGATION
    FORALL (pn1: posnat,
            z:
              [comp_matrix: bool, comp_inverse: bool, S: SquareMatrix(pn1),
               Q:
                 {Q: SquareMatrix(pn1) |
                          is_simple_prod?(pn1, FALSE, FALSE)(Q)},
               {R: SquareMatrix(pn1) |
                        is_simple_prod?(pn1, FALSE, FALSE)(R) AND
                         (comp_matrix AND comp_inverse IMPLIES
                           (R * Q = Id(pn1) AND Q * R = Id(pn1)))},
               {T: SquareMatrix(pn1) | comp_matrix IMPLIES Q * T = S},
               j: {j | ut_point1(S)(j)}, {i | ut_point2(S, j)(i)}, bool,
               nat]):
      pn1 - z`7 >= 0;


decl_type: tcc
theory: matrix_upper_triang
library: matrices
signature: nil
location: 117 0 120 999
body:
  % Subtype TCC generated (at line 76, column 23) for  pn - j
      % expected type  nat
  upper_triangulate_TCC3: OBLIGATION
    FORALL (pn, S: SquareMatrix(pn), (j: nat | ut_point1(S)(j))): pn - j >= 0;


decl_type: tcc
theory: matrix_upper_triang
library: matrices
signature: nil
location: 122 0 159 999
body:
  % Subtype TCC generated (at line 60, column 54) for  (S, Q, R)
      % expected type  {SGI:
                     %    [SquareMatrix(pn), SquareMatrix(pn),
                     %     SquareMatrix(pn)] |
                     %          (NOT stop_rec) IMPLIES
                     %           upper_triangular?(SGI`1) AND
                     %            (comp_matrix IMPLIES
                     %              SGI`2 * T = SGI`1 AND
                     %               is_simple_prod?(pn, FALSE, FALSE)
                     %                              (SGI`2))
                     %             AND
                     %             (comp_matrix AND comp_inverse IMPLIES
                     %               (SGI`3 * SGI`2 = Id(pn)
                     %                AND
                     %                SGI`2 * SGI`3 = Id(pn)
                     %                AND
                     %                is_simple_prod?
                     %                (pn, FALSE, FALSE)(SGI`3)))
                     %              AND det(SGI`1) = det(S)}
  upper_triangulate_TCC4: OBLIGATION
    FORALL (pn: posnat, comp_matrix, comp_inverse: bool, S: SquareMatrix(pn),
            (Q: SquareMatrix(pn) | is_simple_prod?(pn, FALSE, FALSE)(Q)),
            (R: SquareMatrix(pn)
                 | is_simple_prod?(pn, FALSE, FALSE)(R) AND
                    (comp_matrix AND comp_inverse IMPLIES
                      (R * Q = Id(pn) AND Q * R = Id(pn)))),
            (T: SquareMatrix(pn) | comp_matrix IMPLIES Q * T = S),
            (j: nat | ut_point1(S)(j)), (i: nat | ut_point2(S, j)(i)),
            stop_rec: bool, k: nat):
      (stop_rec AND k = 0) OR (i = pn - 1 AND j = pn - 1) IMPLIES
       (NOT stop_rec) IMPLIES
        upper_triangular?(S) AND
         (comp_matrix IMPLIES
           Q * T = S AND is_simple_prod?(pn, FALSE, FALSE)(Q))
          AND
          (comp_matrix AND comp_inverse IMPLIES
            (R * Q = Id(pn) AND
              Q * R = Id(pn) AND is_simple_prod?(pn, FALSE, FALSE)(R)));


decl_type: tcc
theory: matrix_upper_triang
library: matrices
signature: nil
location: 161 0 174 999
body:
  % Subtype TCC generated (at line 61, column 74) for  j + 1
      % expected type  {j | ut_point1(S)(j)}
  upper_triangulate_TCC5: OBLIGATION
    FORALL (pn: posnat, comp_matrix, comp_inverse: bool, S: SquareMatrix(pn),
            (Q: SquareMatrix(pn) | is_simple_prod?(pn, FALSE, FALSE)(Q)),
            (R: SquareMatrix(pn)
                 | is_simple_prod?(pn, FALSE, FALSE)(R) AND
                    (comp_matrix AND comp_inverse IMPLIES
                      (R * Q = Id(pn) AND Q * R = Id(pn)))),
            (T: SquareMatrix(pn) | comp_matrix IMPLIES Q * T = S),
            (j: nat | ut_point1(S)(j)), (i: nat | ut_point2(S, j)(i)),
            stop_rec: bool, k: nat):
      i = j AND NOT (stop_rec AND k = 0) AND NOT (i = pn - 1 AND j = pn - 1)
       IMPLIES ut_point1(S)(j + 1);


decl_type: tcc
theory: matrix_upper_triang
library: matrices
signature: nil
location: 176 0 189 999
body:
  % Subtype TCC generated (at line 61, column 78) for  pn - 1
      % expected type  {i | ut_point2(S, 1 + j)(i)}
  upper_triangulate_TCC6: OBLIGATION
    FORALL (pn: posnat, comp_matrix, comp_inverse: bool, S: SquareMatrix(pn),
            (Q: SquareMatrix(pn) | is_simple_prod?(pn, FALSE, FALSE)(Q)),
            (R: SquareMatrix(pn)
                 | is_simple_prod?(pn, FALSE, FALSE)(R) AND
                    (comp_matrix AND comp_inverse IMPLIES
                      (R * Q = Id(pn) AND Q * R = Id(pn)))),
            (T: SquareMatrix(pn) | comp_matrix IMPLIES Q * T = S),
            (j: nat | ut_point1(S)(j)), (i: nat | ut_point2(S, j)(i)),
            stop_rec: bool, k: nat):
      i = j AND NOT (stop_rec AND k = 0) AND NOT (i = pn - 1 AND j = pn - 1)
       IMPLIES pn - 1 >= 0 AND ut_point2(S, 1 + j)(pn - 1);


decl_type: tcc
theory: matrix_upper_triang
library: matrices
signature: nil
location: 191 0 204 999
body:
  % Subtype TCC generated (at line 61, column 92) for  max(k - 1, 0)
      % expected type  nat
  upper_triangulate_TCC7: OBLIGATION
    FORALL (pn: posnat, comp_matrix, comp_inverse: bool, S: SquareMatrix(pn),
            (Q: SquareMatrix(pn) | is_simple_prod?(pn, FALSE, FALSE)(Q)),
            (R: SquareMatrix(pn)
                 | is_simple_prod?(pn, FALSE, FALSE)(R) AND
                    (comp_matrix AND comp_inverse IMPLIES
                      (R * Q = Id(pn) AND Q * R = Id(pn)))),
            (T: SquareMatrix(pn) | comp_matrix IMPLIES Q * T = S),
            (j: nat | ut_point1(S)(j)), (i: nat | ut_point2(S, j)(i)),
            stop_rec: bool, k: nat):
      i = j AND NOT (stop_rec AND k = 0) AND NOT (i = pn - 1 AND j = pn - 1)
       IMPLIES max(k - 1, 0) >= 0;


decl_type: tcc
theory: matrix_upper_triang
library: matrices
signature: nil
location: 206 0 231 999
body:
  % Termination TCC generated (at line 61, column 19) for
      % upper_triangulate(pn)
      %                  (comp_matrix, comp_inverse, S, Q, R, T, j + 1,
      %                   pn - 1, stop_rec, max(k - 1, 0))
  upper_triangulate_TCC8: OBLIGATION
    FORALL (pn: posnat, comp_matrix, comp_inverse: bool, S: SquareMatrix(pn),
            (Q: SquareMatrix(pn) | is_simple_prod?(pn, FALSE, FALSE)(Q)),
            (R: SquareMatrix(pn)
                 | is_simple_prod?(pn, FALSE, FALSE)(R) AND
                    (comp_matrix AND comp_inverse IMPLIES
                      (R * Q = Id(pn) AND Q * R = Id(pn)))),
            (T: SquareMatrix(pn) | comp_matrix IMPLIES Q * T = S),
            (j: nat | ut_point1(S)(j)), (i: nat | ut_point2(S, j)(i)),
            stop_rec: bool, k: nat):
      i = j AND NOT (stop_rec AND k = 0) AND NOT (i = pn - 1 AND j = pn - 1)
       IMPLIES
       lex3(pn - (j + 1), pn - 1,
            IF entry(S)(pn - 1, j + 1) /= 0 AND entry(S)(j + 1, j + 1) = 0
              THEN 1
            ELSE 0
            ENDIF)
        <
        lex3(pn - j, i,
             IF entry(S)(i, j) /= 0 AND entry(S)(j, j) = 0 THEN 1
             ELSE 0
             ENDIF);


decl_type: tcc
theory: matrix_upper_triang
library: matrices
signature: nil
location: 233 0 248 999
body:
  % Subtype TCC generated (at line 62, column 88) for  i - 1
      % expected type  {i | ut_point2(S, j)(i)}
  upper_triangulate_TCC9: OBLIGATION
    FORALL (pn: posnat, comp_matrix, comp_inverse: bool, S: SquareMatrix(pn),
            (Q: SquareMatrix(pn) | is_simple_prod?(pn, FALSE, FALSE)(Q)),
            (R: SquareMatrix(pn)
                 | is_simple_prod?(pn, FALSE, FALSE)(R) AND
                    (comp_matrix AND comp_inverse IMPLIES
                      (R * Q = Id(pn) AND Q * R = Id(pn)))),
            (T: SquareMatrix(pn) | comp_matrix IMPLIES Q * T = S),
            (j: nat | ut_point1(S)(j)), (i: nat | ut_point2(S, j)(i)),
            stop_rec: bool, k: nat):
      entry(S)(i, j) = 0 AND
       NOT i = j AND
        NOT (stop_rec AND k = 0) AND NOT (i = pn - 1 AND j = pn - 1)
       IMPLIES i - 1 >= 0 AND ut_point2(S, j)(i - 1);


decl_type: tcc
theory: matrix_upper_triang
library: matrices
signature: nil
location: 250 0 265 999
body:
  % Subtype TCC generated (at line 62, column 101) for  max(k - 1, 0)
      % expected type  nat
  upper_triangulate_TCC10: OBLIGATION
    FORALL (pn: posnat, comp_matrix, comp_inverse: bool, S: SquareMatrix(pn),
            (Q: SquareMatrix(pn) | is_simple_prod?(pn, FALSE, FALSE)(Q)),
            (R: SquareMatrix(pn)
                 | is_simple_prod?(pn, FALSE, FALSE)(R) AND
                    (comp_matrix AND comp_inverse IMPLIES
                      (R * Q = Id(pn) AND Q * R = Id(pn)))),
            (T: SquareMatrix(pn) | comp_matrix IMPLIES Q * T = S),
            (j: nat | ut_point1(S)(j)), (i: nat | ut_point2(S, j)(i)),
            stop_rec: bool, k: nat):
      entry(S)(i, j) = 0 AND
       NOT i = j AND
        NOT (stop_rec AND k = 0) AND NOT (i = pn - 1 AND j = pn - 1)
       IMPLIES max(k - 1, 0) >= 0;


decl_type: tcc
theory: matrix_upper_triang
library: matrices
signature: nil
location: 267 0 293 999
body:
  % Termination TCC generated (at line 62, column 31) for
      % upper_triangulate(pn)
      %                  (comp_matrix, comp_inverse, S, Q, R, T, j, i - 1,
      %                   stop_rec, max(k - 1, 0))
  upper_triangulate_TCC11: OBLIGATION
    FORALL (pn: posnat, comp_matrix, comp_inverse: bool, S: SquareMatrix(pn),
            (Q: SquareMatrix(pn) | is_simple_prod?(pn, FALSE, FALSE)(Q)),
            (R: SquareMatrix(pn)
                 | is_simple_prod?(pn, FALSE, FALSE)(R) AND
                    (comp_matrix AND comp_inverse IMPLIES
                      (R * Q = Id(pn) AND Q * R = Id(pn)))),
            (T: SquareMatrix(pn) | comp_matrix IMPLIES Q * T = S),
            (j: nat | ut_point1(S)(j)), (i: nat | ut_point2(S, j)(i)),
            stop_rec: bool, k: nat):
      entry(S)(i, j) = 0 AND
       NOT i = j AND
        NOT (stop_rec AND k = 0) AND NOT (i = pn - 1 AND j = pn - 1)
       IMPLIES
       lex3(pn - j, i - 1,
            IF entry(S)(i - 1, j) /= 0 AND entry(S)(j, j) = 0 THEN 1
            ELSE 0
            ENDIF)
        <
        lex3(pn - j, i,
             IF entry(S)(i, j) /= 0 AND entry(S)(j, j) = 0 THEN 1
             ELSE 0
             ENDIF);


decl_type: tcc
theory: matrix_upper_triang
library: matrices
signature: nil
location: 295 0 309 999
body:
  % Subtype TCC generated (at line 65, column 55) for  S
      % expected type  D: {D | columns(D) = length(row(S)(j) + row(S)(i))}
  upper_triangulate_TCC12: OBLIGATION
    FORALL (pn: posnat, comp_matrix, comp_inverse: bool, S: SquareMatrix(pn),
            (Q: SquareMatrix(pn) | is_simple_prod?(pn, FALSE, FALSE)(Q)),
            (R: SquareMatrix(pn)
                 | is_simple_prod?(pn, FALSE, FALSE)(R) AND
                    (comp_matrix AND comp_inverse IMPLIES
                      (R * Q = Id(pn) AND Q * R = Id(pn)))),
            (T: SquareMatrix(pn) | comp_matrix IMPLIES Q * T = S),
            (j: nat | ut_point1(S)(j)), (i: nat | ut_point2(S, j)(i)),
            stop_rec: bool, k: nat):
           entry(S)(j, j) = 0 AND NOT entry(S)(i, j) = 0 AND NOT i = j
       AND NOT (stop_rec AND k = 0) AND NOT (i = pn - 1 AND j = pn - 1)
       IMPLIES columns(S) = length[real](row(S)(j) + row(S)(i));


decl_type: tcc
theory: matrix_upper_triang
library: matrices
signature: nil
location: 311 0 329 999
body:
  % Subtype TCC generated (at line 65, column 20) for
      % replace_row(j, row(S)(j) + row(S)(i))(S)
      % expected type  SquareMatrix(pn)
  upper_triangulate_TCC13: OBLIGATION
    FORALL (pn: posnat, comp_matrix, comp_inverse: bool, S: SquareMatrix(pn),
            (Q: SquareMatrix(pn) | is_simple_prod?(pn, FALSE, FALSE)(Q)),
            (R: SquareMatrix(pn)
                 | is_simple_prod?(pn, FALSE, FALSE)(R) AND
                    (comp_matrix AND comp_inverse IMPLIES
                      (R * Q = Id(pn) AND Q * R = Id(pn)))),
            (T: SquareMatrix(pn) | comp_matrix IMPLIES Q * T = S),
            (j: nat | ut_point1(S)(j)), (i: nat | ut_point2(S, j)(i)),
            stop_rec: bool, k: nat):
           entry(S)(j, j) = 0 AND NOT entry(S)(i, j) = 0 AND NOT i = j
       AND NOT (stop_rec AND k = 0) AND NOT (i = pn - 1 AND j = pn - 1)
       IMPLIES
       rows(replace_row(j, row(S)(j) + row(S)(i))(S)) =
        columns(replace_row(j, row(S)(j) + row(S)(i))(S))
        AND rows(replace_row(j, row(S)(j) + row(S)(i))(S)) = pn;


decl_type: tcc
theory: matrix_upper_triang
library: matrices
signature: nil
location: 331 0 346 999
body:
  % Subtype TCC generated (at line 66, column 61) for  Q
      % expected type  D: {D | columns(D) = length(row(Q)(j) + row(Q)(i))}
  upper_triangulate_TCC14: OBLIGATION
    FORALL (pn: posnat, comp_matrix, comp_inverse: bool, S: SquareMatrix(pn),
            (Q: SquareMatrix(pn) | is_simple_prod?(pn, FALSE, FALSE)(Q)),
            (R: SquareMatrix(pn)
                 | is_simple_prod?(pn, FALSE, FALSE)(R) AND
                    (comp_matrix AND comp_inverse IMPLIES
                      (R * Q = Id(pn) AND Q * R = Id(pn)))),
            (T: SquareMatrix(pn) | comp_matrix IMPLIES Q * T = S),
            (j: nat | ut_point1(S)(j)), (i: nat | ut_point2(S, j)(i)),
            stop_rec: bool, k: nat):
           comp_matrix AND entry(S)(j, j) = 0 AND NOT entry(S)(i, j) = 0
       AND NOT i = j AND NOT (stop_rec AND k = 0)
       AND NOT (i = pn - 1 AND j = pn - 1)
       IMPLIES columns(Q) = length[real](row(Q)(j) + row(Q)(i));


decl_type: tcc
theory: matrix_upper_triang
library: matrices
signature: nil
location: 348 0 371 999
body:
  % Subtype TCC generated (at line 66, column 26) for
      % replace_row(j, row(Q)(j) + row(Q)(i))(Q)
      % expected type  {Q: SquareMatrix(pn) |
                     %          is_simple_prod?(pn, FALSE, FALSE)(Q)}
  upper_triangulate_TCC15: OBLIGATION
    FORALL (pn: posnat, comp_matrix, comp_inverse: bool, S: SquareMatrix(pn),
            (Q: SquareMatrix(pn) | is_simple_prod?(pn, FALSE, FALSE)(Q)),
            (R: SquareMatrix(pn)
                 | is_simple_prod?(pn, FALSE, FALSE)(R) AND
                    (comp_matrix AND comp_inverse IMPLIES
                      (R * Q = Id(pn) AND Q * R = Id(pn)))),
            (T: SquareMatrix(pn) | comp_matrix IMPLIES Q * T = S),
            (j: nat | ut_point1(S)(j)), (i: nat | ut_point2(S, j)(i)),
            stop_rec: bool, k: nat):
           comp_matrix AND entry(S)(j, j) = 0 AND NOT entry(S)(i, j) = 0
       AND NOT i = j AND NOT (stop_rec AND k = 0)
       AND NOT (i = pn - 1 AND j = pn - 1)
       IMPLIES
       rows(replace_row(j, row(Q)(j) + row(Q)(i))(Q)) =
        columns(replace_row(j, row(Q)(j) + row(Q)(i))(Q))
        AND
        rows(replace_row(j, row(Q)(j) + row(Q)(i))(Q)) = pn AND
         is_simple_prod?(pn, FALSE, FALSE)
                        (replace_row(j, row(Q)(j) + row(Q)(i))(Q));


decl_type: tcc
theory: matrix_upper_triang
library: matrices
signature: nil
location: 373 0 389 999
body:
  % Subtype TCC generated (at line 67, column 9) for  Id(pn)
      % expected type  {Q: SquareMatrix(pn) |
                     %          is_simple_prod?(pn, FALSE, FALSE)(Q)}
  upper_triangulate_TCC16: OBLIGATION
    FORALL (pn: posnat, comp_matrix, comp_inverse: bool, S: SquareMatrix(pn),
            (Q: SquareMatrix(pn) | is_simple_prod?(pn, FALSE, FALSE)(Q)),
            (R: SquareMatrix(pn)
                 | is_simple_prod?(pn, FALSE, FALSE)(R) AND
                    (comp_matrix AND comp_inverse IMPLIES
                      (R * Q = Id(pn) AND Q * R = Id(pn)))),
            (T: SquareMatrix(pn) | comp_matrix IMPLIES Q * T = S),
            (j: nat | ut_point1(S)(j)), (i: nat | ut_point2(S, j)(i)),
            stop_rec: bool, k: nat):
           NOT comp_matrix AND entry(S)(j, j) = 0 AND NOT entry(S)(i, j) = 0
       AND NOT i = j AND NOT (stop_rec AND k = 0)
       AND NOT (i = pn - 1 AND j = pn - 1)
       IMPLIES is_simple_prod?(pn, FALSE, FALSE)(Id(pn));


decl_type: tcc
theory: matrix_upper_triang
library: matrices
signature: nil
location: 391 0 440 999
body:
  % Subtype TCC generated (at line 68, column 43) for  R * Easr(pn)(j, i, -1)
      % expected type  {R: SquareMatrix(pn) |
                     %          is_simple_prod?(pn, FALSE, FALSE)(R) AND
                     %           (comp_matrix AND comp_inverse IMPLIES
                     %             (R *
                     %               IF comp_matrix
                     %                 THEN replace_row
                     %                      (j, row(Q)(j) + row(Q)(i))(Q)
                     %               ELSE Id(pn)
                     %               ENDIF
                     %               = Id(pn)
                     %               AND
                     %               IF comp_matrix
                     %                 THEN replace_row
                     %                      (j, row(Q)(j) + row(Q)(i))(Q)
                     %               ELSE Id(pn)
                     %               ENDIF
                     %                * R
                     %                = Id(pn)))}
  upper_triangulate_TCC17: OBLIGATION
    FORALL (pn: posnat, comp_matrix, comp_inverse: bool, S: SquareMatrix(pn),
            (Q: SquareMatrix(pn) | is_simple_prod?(pn, FALSE, FALSE)(Q)),
            (R: SquareMatrix(pn)
                 | is_simple_prod?(pn, FALSE, FALSE)(R) AND
                    (comp_matrix AND comp_inverse IMPLIES
                      (R * Q = Id(pn) AND Q * R = Id(pn)))),
            (T: SquareMatrix(pn) | comp_matrix IMPLIES Q * T = S),
            (j: nat | ut_point1(S)(j)), (i: nat | ut_point2(S, j)(i)),
            stop_rec: bool, k: nat):
           comp_matrix AND comp_inverse AND entry(S)(j, j) = 0
       AND NOT entry(S)(i, j) = 0 AND NOT i = j AND NOT (stop_rec AND k = 0)
       AND NOT (i = pn - 1 AND j = pn - 1)
       IMPLIES
            is_simple_prod?(pn, FALSE, FALSE)(R * Easr(pn)(j, i, -1))
        AND (comp_matrix AND comp_inverse IMPLIES
              (R * Easr(pn)(j, i, -1) *
                IF comp_matrix THEN replace_row(j, row(Q)(j) + row(Q)(i))(Q)
                ELSE Id(pn)
                ENDIF
                = Id(pn)
                AND
                IF comp_matrix THEN replace_row(j, row(Q)(j) + row(Q)(i))(Q)
                ELSE Id(pn)
                ENDIF
                 * (R * Easr(pn)(j, i, -1))
                 = Id(pn)))
        AND rows(R * Easr(pn)(j, i, -1)) = pn
        AND rows(R * Easr(pn)(j, i, -1)) = columns(R * Easr(pn)(j, i, -1))
        AND rows(R * Easr(pn)(j, i, -1)) > 0
        AND columns(R * Easr(pn)(j, i, -1)) > 0;


