# Declarations

decl_type: tcc
theory: matrix_upper_triang
library: matrices
signature: nil
location: 442 0 487 999
body:
  % Subtype TCC generated (at line 68, column 67) for  Id(pn)
      % 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_TCC18: 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 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)(Id(pn)) AND
        (comp_matrix AND comp_inverse IMPLIES
          (Id(pn) *
            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
             * Id(pn)
             = Id(pn)));


decl_type: tcc
theory: matrix_upper_triang
library: matrices
signature: nil
location: 489 0 517 999
body:
  % Subtype TCC generated (at line 69, column 6) for  T
      % expected type  {T: SquareMatrix(pn) |
                     %          comp_matrix IMPLIES
                     %           IF comp_matrix
                     %             THEN replace_row
                     %                  (j, row(Q)(j) + row(Q)(i))(Q)
                     %           ELSE Id(pn)
                     %           ENDIF
                     %            * T
                     %            = replace_row(j, row(S)(j) + row(S)(i))(S)}
  upper_triangulate_TCC19: 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
       comp_matrix IMPLIES
        IF comp_matrix THEN replace_row(j, row(Q)(j) + row(Q)(i))(Q)
        ELSE Id(pn)
        ENDIF
         * T
         = replace_row(j, row(S)(j) + row(S)(i))(S);


decl_type: tcc
theory: matrix_upper_triang
library: matrices
signature: nil
location: 519 0 536 999
body:
  % Subtype TCC generated (at line 69, column 8) for  j
      % expected type  {j_1 |
                     %          ut_point1(replace_row
                     %                    (j, row(S)(j) + row(S)(i))(S))
                     %                   (j_1)}
  upper_triangulate_TCC20: 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 ut_point1(replace_row(j, row(S)(j) + row(S)(i))(S))(j);


decl_type: tcc
theory: matrix_upper_triang
library: matrices
signature: nil
location: 538 0 556 999
body:
  % Subtype TCC generated (at line 69, column 10) for  i
      % expected type  {i_1 |
                     %          ut_point2(replace_row
                     %                    (j, row(S)(j) + row(S)(i))(S),
                     %                    j)
                     %                   (i_1)}
  upper_triangulate_TCC21: 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 ut_point2(replace_row(j, row(S)(j) + row(S)(i))(S), j)(i);


decl_type: tcc
theory: matrix_upper_triang
library: matrices
signature: nil
location: 558 0 572 999
body:
  % Subtype TCC generated (at line 69, column 21) for  max(k - 1, 0)
      % expected type  nat
  upper_triangulate_TCC22: 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 max(k - 1, 0) >= 0;


decl_type: tcc
theory: matrix_upper_triang
library: matrices
signature: nil
location: 574 0 610 999
body:
  % Termination TCC generated (at line 64, column 6) for
      % 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))
  upper_triangulate_TCC23: 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
       lex3(pn - j, i,
            IF entry(replace_row(j, row(S)(j) + row(S)(i))(S))(i, j) /= 0 AND
                entry(replace_row(j, row(S)(j) + row(S)(i))(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: 612 0 826 999
body:
  % Subtype TCC generated (at line 64, column 6) for
      % 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))
      % 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_TCC24: 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)),
            v:
              [pn1: posnat ->
                 [d1:
                    {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] |
                             lex3(pn1 - z`7, z`8,
                                  IF entry(z`3)(z`8, z`7) /= 0 AND
                                      entry(z`3)(z`7, z`7) = 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)} ->
                    {SGI:
                       [SquareMatrix(pn1), SquareMatrix(pn1),
                        SquareMatrix(pn1)] |
                             (NOT d1`9) IMPLIES
                              upper_triangular?(SGI`1) AND
                               (d1`1 IMPLIES
                                 SGI`2 * d1`6 = SGI`1 AND
                                  is_simple_prod?(pn1, FALSE, FALSE)(SGI`2))
                                AND
                                (d1`1 AND d1`2 IMPLIES
                                  (SGI`3 * SGI`2 = Id(pn1) AND
                                    SGI`2 * SGI`3 = Id(pn1) AND
                                     is_simple_prod?(pn1, FALSE, FALSE)
                                                    (SGI`3)))
                                 AND det(SGI`1) = det(d1`3)}]],
            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
       (NOT stop_rec) IMPLIES
        upper_triangular?(v(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))`1)
         AND
         (comp_matrix IMPLIES
           v(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))`2
            * T
            =
            v(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))`1
            AND
            is_simple_prod?(pn, FALSE, FALSE)
                           (v(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))`2))
          AND
          (comp_matrix AND comp_inverse IMPLIES
            (v(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))`3
              *
              v(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))`2
              = Id(pn)
              AND
              v(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))`2
               *
               v(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))`3
               = Id(pn)
               AND
               is_simple_prod?(pn, FALSE, FALSE)
                              (v(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))`3)))
           AND
           det(v(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))`1)
            = det(S);


decl_type: tcc
theory: matrix_upper_triang
library: matrices
signature: nil
location: 828 0 848 999
body:
  % Subtype TCC generated (at line 72, column 52) for  S
      % expected type  D:
                     %   {D |
                     %            columns(D) =
                     %             length(row(S)(i) + pivnum * row(S)(j))}
  upper_triangulate_TCC25: 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 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
       (FORALL (pivnum: real):
          pivnum = -entry(S)(i, j) / entry(S)(j, j) IMPLIES
           columns(S) = length[real](row(S)(i) + pivnum * row(S)(j)));


decl_type: tcc
theory: matrix_upper_triang
library: matrices
signature: nil
location: 850 0 870 999
body:
  % Subtype TCC generated (at line 72, column 10) for
      % replace_row(i, row(S)(i) + pivnum * row(S)(j))(S)
      % expected type  SquareMatrix(pn)
  upper_triangulate_TCC26: 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 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
       (FORALL (pivnum: real):
          pivnum = -entry(S)(i, j) / entry(S)(j, j) IMPLIES
           rows(replace_row(i, row(S)(i) + pivnum * row(S)(j))(S)) =
            columns(replace_row(i, row(S)(i) + pivnum * row(S)(j))(S))
            AND rows(replace_row(i, row(S)(i) + pivnum * row(S)(j))(S)) = pn);


decl_type: tcc
theory: matrix_upper_triang
library: matrices
signature: nil
location: 872 0 892 999
body:
  % Subtype TCC generated (at line 73, column 72) for  Q
      % expected type  D:
                     %   {D |
                     %            columns(D) =
                     %             length(row(Q)(i) + pivnum * row(Q)(j))}
  upper_triangulate_TCC27: 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 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
       (FORALL (pivnum: real):
          comp_matrix AND pivnum = -entry(S)(i, j) / entry(S)(j, j) IMPLIES
           columns(Q) = length[real](row(Q)(i) + pivnum * row(Q)(j)));


decl_type: tcc
theory: matrix_upper_triang
library: matrices
signature: nil
location: 894 0 919 999
body:
  % Subtype TCC generated (at line 73, column 30) for
      % replace_row(i, row(Q)(i) + pivnum * row(Q)(j))(Q)
      % expected type  {Q: SquareMatrix(pn) |
                     %          is_simple_prod?(pn, FALSE, FALSE)(Q)}
  upper_triangulate_TCC28: 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 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
       (FORALL (pivnum: real):
          comp_matrix AND pivnum = -entry(S)(i, j) / entry(S)(j, j) IMPLIES
           rows(replace_row(i, row(Q)(i) + pivnum * row(Q)(j))(Q)) =
            columns(replace_row(i, row(Q)(i) + pivnum * row(Q)(j))(Q))
            AND
            rows(replace_row(i, row(Q)(i) + pivnum * row(Q)(j))(Q)) = pn AND
             is_simple_prod?(pn, FALSE, FALSE)
                            (replace_row(i, row(Q)(i) + pivnum * row(Q)(j))
                                        (Q)));


decl_type: tcc
theory: matrix_upper_triang
library: matrices
signature: nil
location: 921 0 939 999
body:
  % Subtype TCC generated (at line 73, column 80) for  Id(pn)
      % expected type  {Q: SquareMatrix(pn) |
                     %          is_simple_prod?(pn, FALSE, FALSE)(Q)}
  upper_triangulate_TCC29: 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 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
       (FORALL (pivnum: real):
          NOT comp_matrix AND pivnum = -entry(S)(i, j) / entry(S)(j, j)
           IMPLIES is_simple_prod?(pn, FALSE, FALSE)(Id(pn)));


decl_type: tcc
theory: matrix_upper_triang
library: matrices
signature: nil
location: 941 0 1001 999
body:
  % Subtype TCC generated (at line 74, column 47) for
      % R * Easr(pn)(i, j, -pivnum)
      % 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
                     %                      (i,
                     %                       row(Q)(i) + pivnum * row(Q)(j))
                     %                      (Q)
                     %               ELSE Id(pn)
                     %               ENDIF
                     %               = Id(pn)
                     %               AND
                     %               IF comp_matrix
                     %                 THEN replace_row
                     %                      (i,
                     %                       row(Q)(i) + pivnum * row(Q)(j))
                     %                      (Q)
                     %               ELSE Id(pn)
                     %               ENDIF
                     %                * R
                     %                = Id(pn)))}
  upper_triangulate_TCC30: 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 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
       (FORALL (pivnum: real):
          comp_matrix AND
           comp_inverse AND pivnum = -entry(S)(i, j) / entry(S)(j, j)
           IMPLIES
                is_simple_prod?(pn, FALSE, FALSE)(R * Easr(pn)(i, j, -pivnum))
            AND (comp_matrix AND comp_inverse IMPLIES
                  (R * Easr(pn)(i, j, -pivnum) *
                    IF comp_matrix
                      THEN replace_row(i, row(Q)(i) + pivnum * row(Q)(j))(Q)
                    ELSE Id(pn)
                    ENDIF
                    = Id(pn)
                    AND
                    IF comp_matrix
                      THEN replace_row(i, row(Q)(i) + pivnum * row(Q)(j))(Q)
                    ELSE Id(pn)
                    ENDIF
                     * (R * Easr(pn)(i, j, -pivnum))
                     = Id(pn)))
            AND rows(R * Easr(pn)(i, j, -pivnum)) = pn
            AND rows(R * Easr(pn)(i, j, -pivnum)) =
                 columns(R * Easr(pn)(i, j, -pivnum))
            AND rows(R * Easr(pn)(i, j, -pivnum)) > 0
            AND columns(R * Easr(pn)(i, j, -pivnum)) > 0);


decl_type: tcc
theory: matrix_upper_triang
library: matrices
signature: nil
location: 1003 0 1057 999
body:
  % Subtype TCC generated (at line 74, column 76) for  Id(pn)
      % 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
                     %                      (i,
                     %                       row(Q)(i) + pivnum * row(Q)(j))
                     %                      (Q)
                     %               ELSE Id(pn)
                     %               ENDIF
                     %               = Id(pn)
                     %               AND
                     %               IF comp_matrix
                     %                 THEN replace_row
                     %                      (i,
                     %                       row(Q)(i) + pivnum * row(Q)(j))
                     %                      (Q)
                     %               ELSE Id(pn)
                     %               ENDIF
                     %                * R
                     %                = Id(pn)))}
  upper_triangulate_TCC31: 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 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
       (FORALL (pivnum: real):
          NOT (comp_matrix AND comp_inverse) AND
           pivnum = -entry(S)(i, j) / entry(S)(j, j)
           IMPLIES
           is_simple_prod?(pn, FALSE, FALSE)(Id(pn)) AND
            (comp_matrix AND comp_inverse IMPLIES
              (Id(pn) *
                IF comp_matrix
                  THEN replace_row(i, row(Q)(i) + pivnum * row(Q)(j))(Q)
                ELSE Id(pn)
                ENDIF
                = Id(pn)
                AND
                IF comp_matrix
                  THEN replace_row(i, row(Q)(i) + pivnum * row(Q)(j))(Q)
                ELSE Id(pn)
                ENDIF
                 * Id(pn)
                 = Id(pn))));


decl_type: tcc
theory: matrix_upper_triang
library: matrices
signature: nil
location: 1059 0 1094 999
body:
  % Subtype TCC generated (at line 75, column 10) for  T
      % expected type  {T: SquareMatrix(pn) |
                     %          comp_matrix IMPLIES
                     %           IF comp_matrix
                     %             THEN replace_row
                     %                  (i, row(Q)(i) + pivnum * row(Q)(j))
                     %                  (Q)
                     %           ELSE Id(pn)
                     %           ENDIF
                     %            * T
                     %            =
                     %            replace_row(i,
                     %                        row(S)(i) + pivnum * row(S)(j))
                     %                       (S)}
  upper_triangulate_TCC32: 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 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
       (FORALL (pivnum: real):
          pivnum = -entry(S)(i, j) / entry(S)(j, j) IMPLIES
           comp_matrix IMPLIES
            IF comp_matrix
              THEN replace_row(i, row(Q)(i) + pivnum * row(Q)(j))(Q)
            ELSE Id(pn)
            ENDIF
             * T
             = replace_row(i, row(S)(i) + pivnum * row(S)(j))(S));


decl_type: tcc
theory: matrix_upper_triang
library: matrices
signature: nil
location: 1096 0 1117 999
body:
  % Subtype TCC generated (at line 75, column 12) for  j
      % expected type  {j_1 |
                     %          ut_point1(replace_row
                     %                    (i, row(S)(i) + pivnum * row(S)(j))
                     %                    (S))
                     %                   (j_1)}
  upper_triangulate_TCC33: 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 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
       (FORALL (pivnum: real):
          pivnum = -entry(S)(i, j) / entry(S)(j, j) IMPLIES
           ut_point1(replace_row(i, row(S)(i) + pivnum * row(S)(j))(S))(j));


decl_type: tcc
theory: matrix_upper_triang
library: matrices
signature: nil
location: 1119 0 1143 999
body:
  % Subtype TCC generated (at line 75, column 14) for  i - 1
      % expected type  {i_1 |
                     %          ut_point2(replace_row
                     %                    (i, row(S)(i) + pivnum * row(S)(j))
                     %                    (S),
                     %                    j)
                     %                   (i_1)}
  upper_triangulate_TCC34: 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 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
       (FORALL (pivnum: real):
          pivnum = -entry(S)(i, j) / entry(S)(j, j) IMPLIES
           i - 1 >= 0 AND
            ut_point2(replace_row(i, row(S)(i) + pivnum * row(S)(j))(S), j)
                     (i - 1));


decl_type: tcc
theory: matrix_upper_triang
library: matrices
signature: nil
location: 1145 0 1162 999
body:
  % Subtype TCC generated (at line 75, column 27) for  max(k - 1, 0)
      % expected type  nat
  upper_triangulate_TCC35: 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 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
       (FORALL (pivnum: real):
          pivnum = -entry(S)(i, j) / entry(S)(j, j) IMPLIES
           max(k - 1, 0) >= 0);


decl_type: tcc
theory: matrix_upper_triang
library: matrices
signature: nil
location: 1164 0 1209 999
body:
  % Termination TCC generated (at line 71, column 6) for
      % 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))
  upper_triangulate_TCC36: 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 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
       (FORALL (pivnum: real):
          pivnum = -entry(S)(i, j) / entry(S)(j, j) IMPLIES
           lex3(pn - j, i - 1,
                IF entry(replace_row(i, row(S)(i) + pivnum * row(S)(j))(S))
                        (i - 1, j)
                    /= 0
                    AND
                    entry(replace_row(i, row(S)(i) + pivnum * row(S)(j))(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: 1211 0 1456 999
body:
  % Subtype TCC generated (at line 71, column 6) for
      % 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))
      % 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_TCC37: 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)),
            v:
              [pn1: posnat ->
                 [d1:
                    {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] |
                             lex3(pn1 - z`7, z`8,
                                  IF entry(z`3)(z`8, z`7) /= 0 AND
                                      entry(z`3)(z`7, z`7) = 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)} ->
                    {SGI:
                       [SquareMatrix(pn1), SquareMatrix(pn1),
                        SquareMatrix(pn1)] |
                             (NOT d1`9) IMPLIES
                              upper_triangular?(SGI`1) AND
                               (d1`1 IMPLIES
                                 SGI`2 * d1`6 = SGI`1 AND
                                  is_simple_prod?(pn1, FALSE, FALSE)(SGI`2))
                                AND
                                (d1`1 AND d1`2 IMPLIES
                                  (SGI`3 * SGI`2 = Id(pn1) AND
                                    SGI`2 * SGI`3 = Id(pn1) AND
                                     is_simple_prod?(pn1, FALSE, FALSE)
                                                    (SGI`3)))
                                 AND det(SGI`1) = det(d1`3)}]],
            stop_rec: bool, k: nat):
           NOT 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
       (FORALL (pivnum: real):
          pivnum = -entry(S)(i, j) / entry(S)(j, j) IMPLIES
           (NOT stop_rec) IMPLIES
            upper_triangular?(v(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))`1)
             AND
             (comp_matrix IMPLIES
               v(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))`2
                * T
                =
                v(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))`1
                AND
                is_simple_prod?(pn, FALSE, FALSE)
                               (v(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))`2))
              AND
              (comp_matrix AND comp_inverse IMPLIES
                (v(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))`3
                  *
                  v(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))`2
                  = Id(pn)
                  AND
                  v(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))`2
                   *
                   v(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))`3
                   = Id(pn)
                   AND
                   is_simple_prod?(pn, FALSE, FALSE)
                                  (v(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))`3)))
               AND
               det(v(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))`1)
                = det(S));


decl_type: tcc
theory: matrix_upper_triang
library: matrices
signature: nil
location: 1458 0 1472 999
body:
  % Subtype TCC generated (at line 70, column 37) for  entry(S)(j, j)
      % expected type  nznum
  upper_triangulate_TCC38: 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 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 entry(S)(j, j) /= 0;


decl_type: formula
theory: linear_dependence
library: matrices
signature: nil
location: 24 1 24 108
body:
   row2mat_dim: LEMMA FORALL (j:below(rows(A))): rows(row2mat(A,j)) = 1 AND columns(row2mat(A,j)) = columns(A)


decl_type: formula
theory: linear_dependence
library: matrices
signature: nil
location: 34 1 36 43
body:
   sum_rows_eq: LEMMA FORALL (j:below(rows(A))): 
                             (FORALL (k:subrange(0,j)): f(k) = g(k)) IMPLIES 
                             sum_rows(A,f,j,M) = sum_rows(A,g,j,M)


decl_type: formula
theory: linear_dependence
library: matrices
signature: nil
location: 38 1 39 60
body:
   sum_rows_add_start: LEMMA FORALL (j:below(rows(A))):
             sum_rows(A, f, j, M+N) = sum_rows(A, f, j, M) + N


decl_type: formula
theory: linear_dependence
library: matrices
signature: nil
location: 41 1 41 120
body:
   subtract_same_scal: LEMMA FORALL (j:below(rows(A))):  (f(j) * row2mat(A, j) - f(j) * row2mat(A, j)) = 0 * row2mat(A, j)


decl_type: formula
theory: linear_dependence
library: matrices
signature: nil
location: 44 1 45 83
body:
   sum_lem_prep: LEMMA FORALL(j:below(rows(A)), k:below(j+1)):
           sum_rows(A,f WITH [k:=0], j, M) = sum_rows(A, f, j, M) - f(k)*row2mat(A,k)  


decl_type: formula
theory: linear_dependence
library: matrices
signature: nil
location: 47 1 47 102
body:
   sum_lem: LEMMA FORALL(j:below(rows(A))): sum_rows(A,f WITH [j:=0]) = sum_rows(A,f) -f(j)*row2mat(A,j) 


decl_type: formula
theory: linear_dependence
library: matrices
signature: nil
location: 53 1 56 52
body:
   row_dependence_lem: LEMMA FORALL (j:below(rows(A)), (f|f(j)=-1)):
         row_dependent(A,j,f) IMPLIES
         %FORALL ((M|rows(M) = columns(A) AND columns(M) =1)):
         row2mat(A,j)*M = sum_rows(A, f WITH [j:=0])*M


decl_type: function
theory: linear_dependence
library: matrices
signature:
  [[A: PosFullMatrix, [nat -> real], below(rows(A)),
  PosFullMatrix] ->
  PosFullMatrix]

location: 26 1 30 12
body:
   sum_rows(A,f,(j:below(rows(A))), M): RECURSIVE PosFullMatrix = 
     IF j=0 THEN M+f(j)*row2mat(A,j)
     ELSE sum_rows(A,f,j-1, M+f(j)*row2mat(A,j))
     ENDIF
     MEASURE j


decl_type: function
theory: linear_dependence
library: matrices
signature: [[A: PosFullMatrix, below(rows(A)), [nat -> real]] -> bool]
location: 58 1 58 105
body:
   row_dep(A, (j:below(rows(A))), f): bool = ((f(j)=-1 AND row_dependent(A,j,f)) OR (f = LAMBDA(i:nat): 0))


decl_type: function
theory: linear_dependence
library: matrices
location: 60 1 61 26
signature:
  [[A: PosFullMatrix, j: below(rows(A)),
         {g: [nat -> real] | row_dep(A, j, g)}] ->
          [nat -> real]]

body:
   row_dep_fun(A, (j:below(rows(A))), (f: {g:[nat->real]| row_dep(A,j,g)})): [nat->real] = 
         f WITH [j:= f(j)+1] 


decl_type: tcc
theory: linear_dependence
library: matrices
signature: nil
location: 70 0 78 999
body:
  % Subtype TCC generated (at line 14, column 27) for  (: zero(p) :)
      % expected type  PosFullMatrix
  zerow_TCC1: OBLIGATION
    FORALL (p: posnat):
      (null?[list[real]]((: zero(p) :)) OR
        (FORALL (i, j: below(length[list[real]]((: zero(p) :)))):
           length[real](nth[list[real]]((: zero(p) :), i)) =
            length[real](nth[list[real]]((: zero(p) :), j))))
       AND rows((: zero(p) :)) > 0 AND columns((: zero(p) :)) > 0;


decl_type: tcc
theory: linear_dependence
library: matrices
signature: nil
location: 80 0 88 999
body:
  % Subtype TCC generated (at line 22, column 49) for  (: row(A)(j) :)
      % expected type  PosFullMatrix
  row2mat_TCC1: OBLIGATION
    FORALL (A: PosFullMatrix, (j: below(rows(A)))):
      (null?[list[real]]((: row(A)(j) :)) OR
        (FORALL (i, j_1: below(length[list[real]]((: row(A)(j) :)))):
           length[real](nth[list[real]]((: row(A)(j) :), i)) =
            length[real](nth[list[real]]((: row(A)(j) :), j_1))))
       AND rows((: row(A)(j) :)) > 0 AND columns((: row(A)(j) :)) > 0;


decl_type: tcc
theory: linear_dependence
library: matrices
signature: nil
location: 90 0 104 999
body:
  % Subtype TCC generated (at line 27, column 15) for
      % M + f(j) * row2mat(A, j)
      % expected type  PosFullMatrix
  sum_rows_TCC1: OBLIGATION
    FORALL (A: PosFullMatrix, f: [nat -> real], (j: below(rows(A))),
            M: PosFullMatrix):
      j = 0 IMPLIES
       (null?[list[real]](M + f(j) * row2mat(A, j)) OR
         (FORALL (i,
                  j_1: below(length[list[real]](M + f(j) * row2mat(A, j)))):
            length[real](nth[list[real]](M + f(j) * row2mat(A, j), i)) =
             length[real](nth[list[real]](M + f(j) * row2mat(A, j), j_1))))
        AND
        rows(M + f(j) * row2mat(A, j)) > 0 AND
         columns(M + f(j) * row2mat(A, j)) > 0;


decl_type: tcc
theory: linear_dependence
library: matrices
signature: nil
location: 106 0 110 999
body:
  % Subtype TCC generated (at line 28, column 21) for  j - 1
      % expected type  below(rows(A))
  sum_rows_TCC2: OBLIGATION
    FORALL (A: PosFullMatrix, (j: below(rows(A)))):
      NOT j = 0 IMPLIES j - 1 >= 0 AND j - 1 < rows(A);


decl_type: tcc
theory: linear_dependence
library: matrices
signature: nil
location: 112 0 126 999
body:
  % Subtype TCC generated (at line 28, column 26) for
      % M + f(j) * row2mat(A, j)
      % expected type  PosFullMatrix
  sum_rows_TCC3: OBLIGATION
    FORALL (A: PosFullMatrix, f: [nat -> real], (j: below(rows(A))),
            M: PosFullMatrix):
      NOT j = 0 IMPLIES
       (null?[list[real]](M + f(j) * row2mat(A, j)) OR
         (FORALL (i,
                  j_1: below(length[list[real]](M + f(j) * row2mat(A, j)))):
            length[real](nth[list[real]](M + f(j) * row2mat(A, j), i)) =
             length[real](nth[list[real]](M + f(j) * row2mat(A, j), j_1))))
        AND
        rows(M + f(j) * row2mat(A, j)) > 0 AND
         columns(M + f(j) * row2mat(A, j)) > 0;


decl_type: tcc
theory: linear_dependence
library: matrices
signature: nil
location: 128 0 132 999
body:
  % Termination TCC generated (at line 28, column 8) for
      % sum_rows(A, f, j - 1, M + f(j) * row2mat(A, j))
  sum_rows_TCC4: OBLIGATION
    FORALL (A: PosFullMatrix, (j: below(rows(A)))):
      NOT j = 0 IMPLIES j - 1 < j;


decl_type: tcc
theory: linear_dependence
library: matrices
signature: nil
location: 134 0 137 999
body:
  % Subtype TCC generated (at line 32, column 46) for  rows(A) - 1
      % expected type  below(rows(A))
  sum_rows_TCC5: OBLIGATION
    FORALL (A: PosFullMatrix): rows(A) - 1 >= 0 AND rows(A) - 1 < rows(A);


decl_type: tcc
theory: linear_dependence
library: matrices
signature: nil
location: 139 0 141 999
body:
  % Subtype TCC generated (at line 32, column 63) for  columns(A)
      % expected type  posnat
  sum_rows_TCC6: OBLIGATION FORALL (A: PosFullMatrix): columns(A) > 0;


decl_type: tcc
theory: linear_dependence
library: matrices
signature: nil
location: 143 0 151 999
body:
  % Subtype TCC generated (at line 39, column 29) for  M + N
      % expected type  PosFullMatrix
  sum_rows_add_start_TCC1: OBLIGATION
    FORALL (A, M, N: PosFullMatrix, j: below(rows(A))):
      (null?[list[real]](M + N) OR
        (FORALL (i, j_1: below(length[list[real]](M + N))):
           length[real](nth[list[real]](M + N, i)) =
            length[real](nth[list[real]](M + N, j_1))))
       AND rows(M + N) > 0 AND columns(M + N) > 0;


decl_type: tcc
theory: linear_dependence
library: matrices
signature: nil
location: 153 0 157 999
body:
  % Subtype TCC generated (at line 45, column 81) for  k
      % expected type  below(rows(A))
  sum_lem_prep_TCC1: OBLIGATION
    FORALL (A: PosFullMatrix, j: below(rows(A)), k: below(1 + j)):
      k < rows(A);


decl_type: formula
theory: matrix_diag
library: matrices
signature: nil
location: 87 2 89 68
body:
    diag_det_zero_row: LEMMA comp_matrix AND
      det(S)=0 IMPLIES EXISTS (i): i<rows(S) AND 
        FORALL (j): entry(diag(comp_matrix,comp_inverse,S)`ans)(i,j)=0


decl_type: function
theory: matrix_diag
library: matrices
signature: [Square -> [nat -> bool]]
location: 38 2 40 92
body:
    d_point1(SQ)(j): bool = 
      j<rows(SQ) AND
      (FORALL (k,p):p>j AND k<p AND k<rows(SQ) IMPLIES (entry(SQ)(p,p)=0 OR entry(SQ)(k,p)=0))


decl_type: function
theory: matrix_diag
library: matrices
signature: [[Square, nat] -> [nat -> bool]]
location: 42 2 44 82
body:
    d_point2(SQ,j)(i): bool =
      i<rows(SQ) AND i<=j AND
      (FORALL (k):k<i AND k<rows(SQ) IMPLIES (entry(SQ)(j,j)=0 OR entry(SQ)(k,j)=0))


decl_type: function
theory: matrix_diag
library: matrices
location: 46 2 71 30
signature:
  [pn: posnat ->
          [d:
             [comp_matrix: bool, comp_inverse: bool,
              S: {S: SquareMatrix(pn) | upper_triangular?(S)},
              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) |
                       upper_triangular?(T) AND
                        (comp_matrix IMPLIES Q * T = S) AND
                         (FORALL (i):
                            i < rows(T) IMPLIES
                             entry(T)(i, i) = entry(S)(i, i))},
              j: {j | d_point1(S)(j)}, {i | d_point2(S, j)(i)}, bool,
              nat] ->
             {SGI:
                [SquareMatrix(pn), SquareMatrix(pn), SquareMatrix(pn)] |
                      (NOT d`9) IMPLIES
                            upper_triangular?(SGI`1)
                        AND FORALL (k):
                              k < rows(d`6) IMPLIES
                               entry(d`6)(k, k) = entry(SGI`1)(k, k)
                        AND FORALL (k, p):
                              k < rows(SGI`1) AND
                               k < rows(SGI`1) AND k < p
                               IMPLIES
                               (entry(SGI`1)(p, p) = 0 OR
                                 entry(SGI`1)(k, p) = 0)
                        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:
    diagonalize(pn)(comp_matrix,comp_inverse:bool,
      (S:SquareMatrix(pn)|upper_triangular?(S)),
      (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)|upper_triangular?(T) AND (comp_matrix IMPLIES Q*T = S) 
             AND (FORALL (i):i<rows(T) IMPLIES entry(T)(i,i)=entry(S)(i,i))),
      (j|d_point1(S)(j)),(i|d_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
           (FORALL (k): k<rows(T) IMPLIES entry(T)(k,k)=entry(S2)(k,k)) AND
           (FORALL (k,p): k<rows(S2) AND k<rows(S2) AND k<p IMPLIES (entry(S2)(p,p)=0 OR entry(S2)(k,p)=0)) 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=0 AND j=0) THEN (S,Q,R)
      ELSIF i=j OR entry(S)(j,j)=0 THEN diagonalize(pn)(comp_matrix,comp_inverse,S,Q,R,T,j-1,0,stop_rec,max(k-1,0))
      ELSIF entry(S)(i,j)=0 THEN diagonalize(pn)(comp_matrix,comp_inverse,S,Q,R,T,j,i+1,stop_rec,max(k-1,0))
      ELSE LET pivnum = -entry(S)(i,j)/entry(S)(j,j) IN
        diagonalize(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 lex2(j,pn-i)


decl_type: function
theory: matrix_diag
library: matrices
location: 74 2 85 45
signature:
  [d: [bool, bool, Square] ->
          {SGI:
             [# ans: SquareMatrix(rows(d`3)),
                inv: SquareMatrix(rows(d`3)),
                multip: SquareMatrix(rows(d`3)) #] |
                        upper_triangular?(SGI`ans)
                    AND FORALL (k, p):
                          k < rows(d`3) AND
                           p < rows(d`3) AND entry(SGI`ans)(k, p) /= 0
                           IMPLIES
                           (k = p OR (k < p AND entry(SGI`ans)(p, p) = 0))
                    AND (d`1 IMPLIES
                          SGI`multip * d`3 = SGI`ans AND
                           is_simple_prod?(rows(d`3), FALSE, FALSE)
                                          (SGI`multip))
                    AND (d`1 AND d`2 IMPLIES
                          (SGI`inv * SGI`multip = Id(rows(d`3)) AND
                            SGI`multip * SGI`inv = Id(rows(d`3)) AND
                             is_simple_prod?(rows(d`3), FALSE, FALSE)
                                            (SGI`inv)))
                    AND det(SGI`ans) = det(d`3)
                    AND (det(d`3) /= 0 IFF
                          (FORALL (k, p):
                             k < rows(d`3) AND p < rows(d`3) IMPLIES
                              (entry(SGI`ans)(k, p) /= 0 IFF
                                k = p)))}]

body:
    diag(comp_matrix,comp_inverse:bool,S): {SGI : [# ans: SquareMatrix(rows(S)),
                                              multip: SquareMatrix(rows(S)),
                                              inv: SquareMatrix(rows(S)) #] |
      upper_triangular?(SGI`ans) AND
      (FORALL (k,p): k<rows(S) AND p<rows(S) AND entry(SGI`ans)(k,p)/=0 IMPLIES (k=p OR (k<p AND entry(SGI`ans)(p,p)=0))) AND
      (comp_matrix IMPLIES SGI`multip*S=SGI`ans AND is_simple_prod?(rows(S),false,false)(SGI`multip)) AND
      (comp_matrix AND comp_inverse IMPLIES (SGI`inv*SGI`multip=Id(rows(S)) AND SGI`multip*SGI`inv=Id(rows(S)) AND is_simple_prod?(rows(S),false,false)(SGI`inv))) AND
      det(SGI`ans)=det(S) AND
      (det(S) /=0 IFF (FORALL (k,p): k<rows(S) AND p<rows(S) IMPLIES (entry(SGI`ans)(k,p)/=0 IFF k=p)))} =
        LET (S2,Q2,R2) = upper_triangulate(rows(S))(comp_matrix,comp_inverse,S,Id(rows(S)),Id(rows(S)),S,0,rows(S)-1,false,0),
            (S3,Q3,R3) = diagonalize(rows(S))(comp_matrix,comp_inverse,S2,Id(rows(S)),Id(rows(S)),S2,rows(S)-1,0,false,0) IN
            (# ans:= S3, multip:= Q3*Q2, inv:=R2*R3 #)


decl_type: tcc
theory: matrix_diag
library: matrices
signature: nil
location: 105 0 122 999
body:
  % Subtype TCC generated (at line 71, column 25) for  pn - i
      % expected type  nat
  diagonalize_TCC1: OBLIGATION
    FORALL (pn: posnat, comp_matrix, comp_inverse: bool,
            (S: SquareMatrix(pn) | upper_triangular?(S)),
            (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)
                 | upper_triangular?(T) AND
                    (comp_matrix IMPLIES Q * T = S) AND
                     (FORALL (i):
                        i < rows(T) IMPLIES
                         entry(T)(i, i) = entry(S)(i, i))),
            (j: nat | d_point1(S)(j)), (i: nat | d_point2(S, j)(i))):
      pn - i >= 0;


decl_type: tcc
theory: matrix_diag
library: matrices
signature: nil
location: 124 0 145 999
body:
  % Subtype TCC generated (at line 71, column 25) for  pn1 - z`8
      % expected type  nat
  diagonalize_TCC2: OBLIGATION
    FORALL (pn1: posnat,
            z:
              [comp_matrix: bool, comp_inverse: bool,
               S: {S: SquareMatrix(pn1) | upper_triangular?(S)},
               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) |
                        upper_triangular?(T) AND
                         (comp_matrix IMPLIES Q * T = S) AND
                          (FORALL (i):
                             i < rows(T) IMPLIES
                              entry(T)(i, i) = entry(S)(i, i))},
               j: {j | d_point1(S)(j)}, {i | d_point2(S, j)(i)}, bool, nat]):
      pn1 - z`8 >= 0;


decl_type: tcc
theory: matrix_diag
library: matrices
signature: nil
location: 147 0 152 999
body:
  % Subtype TCC generated (at line 71, column 25) for  pn - i
      % expected type  nat
  diagonalize_TCC3: OBLIGATION
    FORALL (pn, (S: SquareMatrix(pn) | upper_triangular?(S)),
            (j: nat | d_point1(S)(j)), (i: nat | d_point2(S, j)(i))):
      pn - i >= 0;


decl_type: tcc
theory: matrix_diag
library: matrices
signature: nil
location: 154 0 217 999
body:
  % Subtype TCC generated (at line 62, column 48) for  (S, Q, R)
      % expected type  {SGI:
                     %    [SquareMatrix(pn), SquareMatrix(pn),
                     %     SquareMatrix(pn)] |
                     %          (NOT stop_rec) IMPLIES
                     %                upper_triangular?(SGI`1)
                     %            AND FORALL
                     %                (k):
                     %                k < rows(T)
                     %                IMPLIES
                     %                entry(T)(k, k) = entry(SGI`1)(k, k)
                     %            AND FORALL
                     %                (k, p):
                     %                k < rows(SGI`1)
                     %                AND
                     %                k < rows(SGI`1) AND k < p
                     %                IMPLIES
                     %                (entry(SGI`1)(p, p) = 0
                     %                 OR
                     %                 entry(SGI`1)(k, p) = 0)
                     %            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)}
  diagonalize_TCC4: OBLIGATION
    FORALL (pn: posnat, comp_matrix, comp_inverse: bool,
            (S: SquareMatrix(pn) | upper_triangular?(S)),
            (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)
                 | upper_triangular?(T) AND
                    (comp_matrix IMPLIES Q * T = S) AND
                     (FORALL (i):
                        i < rows(T) IMPLIES
                         entry(T)(i, i) = entry(S)(i, i))),
            (j: nat | d_point1(S)(j)), (i: nat | d_point2(S, j)(i)),
            stop_rec: bool, k: nat):
      (stop_rec AND k = 0) OR (i = 0 AND j = 0) IMPLIES
       (NOT stop_rec) IMPLIES
             upper_triangular?(S)
         AND FORALL (k_1: nat):
               k_1 < rows(T) IMPLIES entry(T)(k_1, k_1) = entry(S)(k_1, k_1)
         AND FORALL (k_1: nat, p):
               k_1 < rows(S) AND k_1 < rows(S) AND k_1 < p IMPLIES
                (entry(S)(p, p) = 0 OR entry(S)(k_1, p) = 0)
         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_diag
library: matrices
signature: nil
location: 219 0 239 999
body:
  % Subtype TCC generated (at line 63, column 87) for  j - 1
      % expected type  {j | d_point1(S)(j)}
  diagonalize_TCC5: OBLIGATION
    FORALL (pn: posnat, comp_matrix, comp_inverse: bool,
            (S: SquareMatrix(pn) | upper_triangular?(S)),
            (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)
                 | upper_triangular?(T) AND
                    (comp_matrix IMPLIES Q * T = S) AND
                     (FORALL (i):
                        i < rows(T) IMPLIES
                         entry(T)(i, i) = entry(S)(i, i))),
            (j: nat | d_point1(S)(j)), (i: nat | d_point2(S, j)(i)),
            stop_rec: bool, k: nat):
      (i = j OR entry(S)(j, j) = 0) AND
       NOT (stop_rec AND k = 0) AND NOT (i = 0 AND j = 0)
       IMPLIES j - 1 >= 0 AND d_point1(S)(j - 1);


decl_type: tcc
theory: matrix_diag
library: matrices
signature: nil
location: 241 0 261 999
body:
  % Subtype TCC generated (at line 63, column 91) for  0
      % expected type  {i | d_point2(S, j - 1)(i)}
  diagonalize_TCC6: OBLIGATION
    FORALL (pn: posnat, comp_matrix, comp_inverse: bool,
            (S: SquareMatrix(pn) | upper_triangular?(S)),
            (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)
                 | upper_triangular?(T) AND
                    (comp_matrix IMPLIES Q * T = S) AND
                     (FORALL (i):
                        i < rows(T) IMPLIES
                         entry(T)(i, i) = entry(S)(i, i))),
            (j: nat | d_point1(S)(j)), (i: nat | d_point2(S, j)(i)),
            stop_rec: bool, k: nat):
      (i = j OR entry(S)(j, j) = 0) AND
       NOT (stop_rec AND k = 0) AND NOT (i = 0 AND j = 0)
       IMPLIES d_point2(S, j - 1)(0);


decl_type: tcc
theory: matrix_diag
library: matrices
signature: nil
location: 263 0 283 999
body:
  % Subtype TCC generated (at line 63, column 102) for  max(k - 1, 0)
      % expected type  nat
  diagonalize_TCC7: OBLIGATION
    FORALL (pn: posnat, comp_matrix, comp_inverse: bool,
            (S: SquareMatrix(pn) | upper_triangular?(S)),
            (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)
                 | upper_triangular?(T) AND
                    (comp_matrix IMPLIES Q * T = S) AND
                     (FORALL (i):
                        i < rows(T) IMPLIES
                         entry(T)(i, i) = entry(S)(i, i))),
            (j: nat | d_point1(S)(j)), (i: nat | d_point2(S, j)(i)),
            stop_rec: bool, k: nat):
      (i = j OR entry(S)(j, j) = 0) AND
       NOT (stop_rec AND k = 0) AND NOT (i = 0 AND j = 0)
       IMPLIES max(k - 1, 0) >= 0;


decl_type: tcc
theory: matrix_diag
library: matrices
signature: nil
location: 285 0 307 999
body:
  % Termination TCC generated (at line 63, column 38) for
      % diagonalize(pn)
      %            (comp_matrix, comp_inverse, S, Q, R, T, j - 1, 0,
      %             stop_rec, max(k - 1, 0))
  diagonalize_TCC8: OBLIGATION
    FORALL (pn: posnat, comp_matrix, comp_inverse: bool,
            (S: SquareMatrix(pn) | upper_triangular?(S)),
            (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)
                 | upper_triangular?(T) AND
                    (comp_matrix IMPLIES Q * T = S) AND
                     (FORALL (i):
                        i < rows(T) IMPLIES
                         entry(T)(i, i) = entry(S)(i, i))),
            (j: nat | d_point1(S)(j)), (i: nat | d_point2(S, j)(i)),
            stop_rec: bool, k: nat):
      (i = j OR entry(S)(j, j) = 0) AND
       NOT (stop_rec AND k = 0) AND NOT (i = 0 AND j = 0)
       IMPLIES lex2(j - 1, pn - 0) < lex2(j, pn - i);


decl_type: tcc
theory: matrix_diag
library: matrices
signature: nil
location: 309 0 329 999
body:
  % Subtype TCC generated (at line 64, column 82) for  i + 1
      % expected type  {i | d_point2(S, j)(i)}
  diagonalize_TCC9: OBLIGATION
    FORALL (pn: posnat, comp_matrix, comp_inverse: bool,
            (S: SquareMatrix(pn) | upper_triangular?(S)),
            (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)
                 | upper_triangular?(T) AND
                    (comp_matrix IMPLIES Q * T = S) AND
                     (FORALL (i):
                        i < rows(T) IMPLIES
                         entry(T)(i, i) = entry(S)(i, i))),
            (j: nat | d_point1(S)(j)), (i: nat | d_point2(S, j)(i)),
            stop_rec: bool, k: nat):
           entry(S)(i, j) = 0 AND NOT i = j AND NOT entry(S)(j, j) = 0
       AND NOT (stop_rec AND k = 0) AND NOT (i = 0 AND j = 0)
       IMPLIES d_point2(S, j)(i + 1);


decl_type: tcc
theory: matrix_diag
library: matrices
signature: nil
location: 331 0 351 999
body:
  % Subtype TCC generated (at line 64, column 95) for  max(k - 1, 0)
      % expected type  nat
  diagonalize_TCC10: OBLIGATION
    FORALL (pn: posnat, comp_matrix, comp_inverse: bool,
            (S: SquareMatrix(pn) | upper_triangular?(S)),
            (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)
                 | upper_triangular?(T) AND
                    (comp_matrix IMPLIES Q * T = S) AND
                     (FORALL (i):
                        i < rows(T) IMPLIES
                         entry(T)(i, i) = entry(S)(i, i))),
            (j: nat | d_point1(S)(j)), (i: nat | d_point2(S, j)(i)),
            stop_rec: bool, k: nat):
           entry(S)(i, j) = 0 AND NOT i = j AND NOT entry(S)(j, j) = 0
       AND NOT (stop_rec AND k = 0) AND NOT (i = 0 AND j = 0)
       IMPLIES max(k - 1, 0) >= 0;


decl_type: tcc
theory: matrix_diag
library: matrices
signature: nil
location: 353 0 375 999
body:
  % Termination TCC generated (at line 64, column 31) for
      % diagonalize(pn)
      %            (comp_matrix, comp_inverse, S, Q, R, T, j, i + 1,
      %             stop_rec, max(k - 1, 0))
  diagonalize_TCC11: OBLIGATION
    FORALL (pn: posnat, comp_matrix, comp_inverse: bool,
            (S: SquareMatrix(pn) | upper_triangular?(S)),
            (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)
                 | upper_triangular?(T) AND
                    (comp_matrix IMPLIES Q * T = S) AND
                     (FORALL (i):
                        i < rows(T) IMPLIES
                         entry(T)(i, i) = entry(S)(i, i))),
            (j: nat | d_point1(S)(j)), (i: nat | d_point2(S, j)(i)),
            stop_rec: bool, k: nat):
           entry(S)(i, j) = 0 AND NOT i = j AND NOT entry(S)(j, j) = 0
       AND NOT (stop_rec AND k = 0) AND NOT (i = 0 AND j = 0)
       IMPLIES lex2(j, pn - (i + 1)) < lex2(j, pn - i);


decl_type: tcc
theory: matrix_diag
library: matrices
signature: nil
location: 377 0 403 999
body:
  % Subtype TCC generated (at line 67, column 52) for  S
      % expected type  D:
                     %   {D |
                     %            columns(D) =
                     %             length(row(S)(i) + pivnum * row(S)(j))}
  diagonalize_TCC12: OBLIGATION
    FORALL (pn: posnat, comp_matrix, comp_inverse: bool,
            (S: SquareMatrix(pn) | upper_triangular?(S)),
            (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)
                 | upper_triangular?(T) AND
                    (comp_matrix IMPLIES Q * T = S) AND
                     (FORALL (i):
                        i < rows(T) IMPLIES
                         entry(T)(i, i) = entry(S)(i, i))),
            (j: nat | d_point1(S)(j)), (i: nat | d_point2(S, j)(i)),
            stop_rec: bool, k: nat):
           NOT entry(S)(i, j) = 0 AND NOT i = j AND NOT entry(S)(j, j) = 0
       AND NOT (stop_rec AND k = 0) AND NOT (i = 0 AND j = 0)
       IMPLIES
       (FORALL (pivnum: real):
          pivnum = -entry(S)(i, j) / entry(S)(j, j) IMPLIES
           columns(S) = length[real](row(S)(i) + pivnum * row(S)(j)));


decl_type: tcc
theory: matrix_diag
library: matrices
signature: nil
location: 405 0 434 999
body:
  % Subtype TCC generated (at line 67, column 10) for
      % replace_row(i, row(S)(i) + pivnum * row(S)(j))(S)
      % expected type  {S: SquareMatrix(pn) | upper_triangular?(S)}
  diagonalize_TCC13: OBLIGATION
    FORALL (pn: posnat, comp_matrix, comp_inverse: bool,
            (S: SquareMatrix(pn) | upper_triangular?(S)),
            (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)
                 | upper_triangular?(T) AND
                    (comp_matrix IMPLIES Q * T = S) AND
                     (FORALL (i):
                        i < rows(T) IMPLIES
                         entry(T)(i, i) = entry(S)(i, i))),
            (j: nat | d_point1(S)(j)), (i: nat | d_point2(S, j)(i)),
            stop_rec: bool, k: nat):
           NOT entry(S)(i, j) = 0 AND NOT i = j AND NOT entry(S)(j, j) = 0
       AND NOT (stop_rec AND k = 0) AND NOT (i = 0 AND j = 0)
       IMPLIES
       (FORALL (pivnum: real):
          pivnum = -entry(S)(i, j) / entry(S)(j, j) IMPLIES
           rows(replace_row(i, row(S)(i) + pivnum * row(S)(j))(S)) =
            columns(replace_row(i, row(S)(i) + pivnum * row(S)(j))(S))
            AND
            rows(replace_row(i, row(S)(i) + pivnum * row(S)(j))(S)) = pn AND
             upper_triangular?(replace_row(i, row(S)(i) + pivnum * row(S)(j))
                                          (S)));


decl_type: tcc
theory: matrix_diag
library: matrices
signature: nil
location: 436 0 462 999
body:
  % Subtype TCC generated (at line 68, column 72) for  Q
      % expected type  D:
                     %   {D |
                     %            columns(D) =
                     %             length(row(Q)(i) + pivnum * row(Q)(j))}
  diagonalize_TCC14: OBLIGATION
    FORALL (pn: posnat, comp_matrix, comp_inverse: bool,
            (S: SquareMatrix(pn) | upper_triangular?(S)),
            (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)
                 | upper_triangular?(T) AND
                    (comp_matrix IMPLIES Q * T = S) AND
                     (FORALL (i):
                        i < rows(T) IMPLIES
                         entry(T)(i, i) = entry(S)(i, i))),
            (j: nat | d_point1(S)(j)), (i: nat | d_point2(S, j)(i)),
            stop_rec: bool, k: nat):
           NOT entry(S)(i, j) = 0 AND NOT i = j AND NOT entry(S)(j, j) = 0
       AND NOT (stop_rec AND k = 0) AND NOT (i = 0 AND j = 0)
       IMPLIES
       (FORALL (pivnum: real):
          comp_matrix AND pivnum = -entry(S)(i, j) / entry(S)(j, j) IMPLIES
           columns(Q) = length[real](row(Q)(i) + pivnum * row(Q)(j)));


decl_type: tcc
theory: matrix_diag
library: matrices
signature: nil
location: 464 0 495 999
body:
  % Subtype TCC generated (at line 68, column 30) for
      % replace_row(i, row(Q)(i) + pivnum * row(Q)(j))(Q)
      % expected type  {Q: SquareMatrix(pn) |
                     %          is_simple_prod?(pn, FALSE, FALSE)(Q)}
  diagonalize_TCC15: OBLIGATION
    FORALL (pn: posnat, comp_matrix, comp_inverse: bool,
            (S: SquareMatrix(pn) | upper_triangular?(S)),
            (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)
                 | upper_triangular?(T) AND
                    (comp_matrix IMPLIES Q * T = S) AND
                     (FORALL (i):
                        i < rows(T) IMPLIES
                         entry(T)(i, i) = entry(S)(i, i))),
            (j: nat | d_point1(S)(j)), (i: nat | d_point2(S, j)(i)),
            stop_rec: bool, k: nat):
           NOT entry(S)(i, j) = 0 AND NOT i = j AND NOT entry(S)(j, j) = 0
       AND NOT (stop_rec AND k = 0) AND NOT (i = 0 AND j = 0)
       IMPLIES
       (FORALL (pivnum: real):
          comp_matrix AND pivnum = -entry(S)(i, j) / entry(S)(j, j) IMPLIES
           rows(replace_row(i, row(Q)(i) + pivnum * row(Q)(j))(Q)) =
            columns(replace_row(i, row(Q)(i) + pivnum * row(Q)(j))(Q))
            AND
            rows(replace_row(i, row(Q)(i) + pivnum * row(Q)(j))(Q)) = pn AND
             is_simple_prod?(pn, FALSE, FALSE)
                            (replace_row(i, row(Q)(i) + pivnum * row(Q)(j))
                                        (Q)));


decl_type: tcc
theory: matrix_diag
library: matrices
signature: nil
location: 497 0 521 999
body:
  % Subtype TCC generated (at line 68, column 80) for  Id(pn)
      % expected type  {Q: SquareMatrix(pn) |
                     %          is_simple_prod?(pn, FALSE, FALSE)(Q)}
  diagonalize_TCC16: OBLIGATION
    FORALL (pn: posnat, comp_matrix, comp_inverse: bool,
            (S: SquareMatrix(pn) | upper_triangular?(S)),
            (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)
                 | upper_triangular?(T) AND
                    (comp_matrix IMPLIES Q * T = S) AND
                     (FORALL (i):
                        i < rows(T) IMPLIES
                         entry(T)(i, i) = entry(S)(i, i))),
            (j: nat | d_point1(S)(j)), (i: nat | d_point2(S, j)(i)),
            stop_rec: bool, k: nat):
           NOT entry(S)(i, j) = 0 AND NOT i = j AND NOT entry(S)(j, j) = 0
       AND NOT (stop_rec AND k = 0) AND NOT (i = 0 AND j = 0)
       IMPLIES
       (FORALL (pivnum: real):
          NOT comp_matrix AND pivnum = -entry(S)(i, j) / entry(S)(j, j)
           IMPLIES is_simple_prod?(pn, FALSE, FALSE)(Id(pn)));


decl_type: tcc
theory: matrix_diag
library: matrices
signature: nil
location: 523 0 589 999
body:
  % Subtype TCC generated (at line 69, column 47) for
      % R * Easr(pn)(i, j, -pivnum)
      % 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
                     %                      (i,
                     %                       row(Q)(i) + pivnum * row(Q)(j))
                     %                      (Q)
                     %               ELSE Id(pn)
                     %               ENDIF
                     %               = Id(pn)
                     %               AND
                     %               IF comp_matrix
                     %                 THEN replace_row
                     %                      (i,
                     %                       row(Q)(i) + pivnum * row(Q)(j))
                     %                      (Q)
                     %               ELSE Id(pn)
                     %               ENDIF
                     %                * R
                     %                = Id(pn)))}
  diagonalize_TCC17: OBLIGATION
    FORALL (pn: posnat, comp_matrix, comp_inverse: bool,
            (S: SquareMatrix(pn) | upper_triangular?(S)),
            (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)
                 | upper_triangular?(T) AND
                    (comp_matrix IMPLIES Q * T = S) AND
                     (FORALL (i):
                        i < rows(T) IMPLIES
                         entry(T)(i, i) = entry(S)(i, i))),
            (j: nat | d_point1(S)(j)), (i: nat | d_point2(S, j)(i)),
            stop_rec: bool, k: nat):
           NOT entry(S)(i, j) = 0 AND NOT i = j AND NOT entry(S)(j, j) = 0
       AND NOT (stop_rec AND k = 0) AND NOT (i = 0 AND j = 0)
       IMPLIES
       (FORALL (pivnum: real):
          comp_matrix AND
           comp_inverse AND pivnum = -entry(S)(i, j) / entry(S)(j, j)
           IMPLIES
                is_simple_prod?(pn, FALSE, FALSE)(R * Easr(pn)(i, j, -pivnum))
            AND (comp_matrix AND comp_inverse IMPLIES
                  (R * Easr(pn)(i, j, -pivnum) *
                    IF comp_matrix
                      THEN replace_row(i, row(Q)(i) + pivnum * row(Q)(j))(Q)
                    ELSE Id(pn)
                    ENDIF
                    = Id(pn)
                    AND
                    IF comp_matrix
                      THEN replace_row(i, row(Q)(i) + pivnum * row(Q)(j))(Q)
                    ELSE Id(pn)
                    ENDIF
                     * (R * Easr(pn)(i, j, -pivnum))
                     = Id(pn)))
            AND rows(R * Easr(pn)(i, j, -pivnum)) = pn
            AND rows(R * Easr(pn)(i, j, -pivnum)) =
                 columns(R * Easr(pn)(i, j, -pivnum))
            AND rows(R * Easr(pn)(i, j, -pivnum)) > 0
            AND columns(R * Easr(pn)(i, j, -pivnum)) > 0);


decl_type: tcc
theory: matrix_diag
library: matrices
signature: nil
location: 591 0 651 999
body:
  % Subtype TCC generated (at line 69, column 76) for  Id(pn)
      % 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
                     %                      (i,
                     %                       row(Q)(i) + pivnum * row(Q)(j))
                     %                      (Q)
                     %               ELSE Id(pn)
                     %               ENDIF
                     %               = Id(pn)
                     %               AND
                     %               IF comp_matrix
                     %                 THEN replace_row
                     %                      (i,
                     %                       row(Q)(i) + pivnum * row(Q)(j))
                     %                      (Q)
                     %               ELSE Id(pn)
                     %               ENDIF
                     %                * R
                     %                = Id(pn)))}
  diagonalize_TCC18: OBLIGATION
    FORALL (pn: posnat, comp_matrix, comp_inverse: bool,
            (S: SquareMatrix(pn) | upper_triangular?(S)),
            (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)
                 | upper_triangular?(T) AND
                    (comp_matrix IMPLIES Q * T = S) AND
                     (FORALL (i):
                        i < rows(T) IMPLIES
                         entry(T)(i, i) = entry(S)(i, i))),
            (j: nat | d_point1(S)(j)), (i: nat | d_point2(S, j)(i)),
            stop_rec: bool, k: nat):
           NOT entry(S)(i, j) = 0 AND NOT i = j AND NOT entry(S)(j, j) = 0
       AND NOT (stop_rec AND k = 0) AND NOT (i = 0 AND j = 0)
       IMPLIES
       (FORALL (pivnum: real):
          NOT (comp_matrix AND comp_inverse) AND
           pivnum = -entry(S)(i, j) / entry(S)(j, j)
           IMPLIES
           is_simple_prod?(pn, FALSE, FALSE)(Id(pn)) AND
            (comp_matrix AND comp_inverse IMPLIES
              (Id(pn) *
                IF comp_matrix
                  THEN replace_row(i, row(Q)(i) + pivnum * row(Q)(j))(Q)
                ELSE Id(pn)
                ENDIF
                = Id(pn)
                AND
                IF comp_matrix
                  THEN replace_row(i, row(Q)(i) + pivnum * row(Q)(j))(Q)
                ELSE Id(pn)
                ENDIF
                 * Id(pn)
                 = Id(pn))));


decl_type: tcc
theory: matrix_diag
library: matrices
signature: nil
location: 653 0 713 999
body:
  % Subtype TCC generated (at line 70, column 10) for  T
      % expected type  {T: SquareMatrix(pn) |
                     %          upper_triangular?(T) AND
                     %           (comp_matrix IMPLIES
                     %             IF comp_matrix
                     %               THEN replace_row
                     %                    (i, row(Q)(i) + pivnum * row(Q)(j))
                     %                    (Q)
                     %             ELSE Id(pn)
                     %             ENDIF
                     %              * T
                     %              =
                     %              replace_row(i,
                     %                          row(S)(i)
                     %                          +
                     %                          pivnum * row(S)(j))
                     %                         (S))
                     %            AND
                     %            (FORALL (i_1: nat):
                     %               i_1 < rows(T) IMPLIES
                     %                entry(T)(i_1, i_1)
                     %                =
                     %                entry
                     %                (replace_row
                     %                 (i, row(S)(i) + pivnum * row(S)(j))(S))
                     %                (i_1, i_1))}
  diagonalize_TCC19: OBLIGATION
    FORALL (pn: posnat, comp_matrix, comp_inverse: bool,
            (S: SquareMatrix(pn) | upper_triangular?(S)),
            (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)
                 | upper_triangular?(T) AND
                    (comp_matrix IMPLIES Q * T = S) AND
                     (FORALL (i):
                        i < rows(T) IMPLIES
                         entry(T)(i, i) = entry(S)(i, i))),
            (j: nat | d_point1(S)(j)), (i: nat | d_point2(S, j)(i)),
            stop_rec: bool, k: nat):
           NOT entry(S)(i, j) = 0 AND NOT i = j AND NOT entry(S)(j, j) = 0
       AND NOT (stop_rec AND k = 0) AND NOT (i = 0 AND j = 0)
       IMPLIES
       (FORALL (pivnum: real):
          pivnum = -entry(S)(i, j) / entry(S)(j, j) IMPLIES
           upper_triangular?(T) AND
            (comp_matrix IMPLIES
              IF comp_matrix
                THEN replace_row(i, row(Q)(i) + pivnum * row(Q)(j))(Q)
              ELSE Id(pn)
              ENDIF
               * T
               = replace_row(i, row(S)(i) + pivnum * row(S)(j))(S))
             AND
             (FORALL (i_1: nat):
                i_1 < rows(T) IMPLIES
                 entry(T)(i_1, i_1) =
                  entry(replace_row(i, row(S)(i) + pivnum * row(S)(j))(S))
                       (i_1, i_1)));


decl_type: tcc
theory: matrix_diag
library: matrices
signature: nil
location: 715 0 742 999
body:
  % Subtype TCC generated (at line 70, column 12) for  j
      % expected type  {j_1 |
                     %          d_point1(replace_row
                     %                   (i, row(S)(i) + pivnum * row(S)(j))
                     %                   (S))
                     %                  (j_1)}
  diagonalize_TCC20: OBLIGATION
    FORALL (pn: posnat, comp_matrix, comp_inverse: bool,
            (S: SquareMatrix(pn) | upper_triangular?(S)),
            (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)
                 | upper_triangular?(T) AND
                    (comp_matrix IMPLIES Q * T = S) AND
                     (FORALL (i):
                        i < rows(T) IMPLIES
                         entry(T)(i, i) = entry(S)(i, i))),
            (j: nat | d_point1(S)(j)), (i: nat | d_point2(S, j)(i)),
            stop_rec: bool, k: nat):
           NOT entry(S)(i, j) = 0 AND NOT i = j AND NOT entry(S)(j, j) = 0
       AND NOT (stop_rec AND k = 0) AND NOT (i = 0 AND j = 0)
       IMPLIES
       (FORALL (pivnum: real):
          pivnum = -entry(S)(i, j) / entry(S)(j, j) IMPLIES
           d_point1(replace_row(i, row(S)(i) + pivnum * row(S)(j))(S))(j));


decl_type: tcc
theory: matrix_diag
library: matrices
signature: nil
location: 744 0 773 999
body:
  % Subtype TCC generated (at line 70, column 14) for  i + 1
      % expected type  {i_1 |
                     %          d_point2(replace_row
                     %                   (i, row(S)(i) + pivnum * row(S)(j))
                     %                   (S),
                     %                   j)
                     %                  (i_1)}
  diagonalize_TCC21: OBLIGATION
    FORALL (pn: posnat, comp_matrix, comp_inverse: bool,
            (S: SquareMatrix(pn) | upper_triangular?(S)),
            (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)
                 | upper_triangular?(T) AND
                    (comp_matrix IMPLIES Q * T = S) AND
                     (FORALL (i):
                        i < rows(T) IMPLIES
                         entry(T)(i, i) = entry(S)(i, i))),
            (j: nat | d_point1(S)(j)), (i: nat | d_point2(S, j)(i)),
            stop_rec: bool, k: nat):
           NOT entry(S)(i, j) = 0 AND NOT i = j AND NOT entry(S)(j, j) = 0
       AND NOT (stop_rec AND k = 0) AND NOT (i = 0 AND j = 0)
       IMPLIES
       (FORALL (pivnum: real):
          pivnum = -entry(S)(i, j) / entry(S)(j, j) IMPLIES
           d_point2(replace_row(i, row(S)(i) + pivnum * row(S)(j))(S), j)
                   (i + 1));


decl_type: tcc
theory: matrix_diag
library: matrices
signature: nil
location: 775 0 798 999
body:
  % Subtype TCC generated (at line 70, column 27) for  max(k - 1, 0)
      % expected type  nat
  diagonalize_TCC22: OBLIGATION
    FORALL (pn: posnat, comp_matrix, comp_inverse: bool,
            (S: SquareMatrix(pn) | upper_triangular?(S)),
            (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)
                 | upper_triangular?(T) AND
                    (comp_matrix IMPLIES Q * T = S) AND
                     (FORALL (i):
                        i < rows(T) IMPLIES
                         entry(T)(i, i) = entry(S)(i, i))),
            (j: nat | d_point1(S)(j)), (i: nat | d_point2(S, j)(i)),
            stop_rec: bool, k: nat):
           NOT entry(S)(i, j) = 0 AND NOT i = j AND NOT entry(S)(j, j) = 0
       AND NOT (stop_rec AND k = 0) AND NOT (i = 0 AND j = 0)
       IMPLIES
       (FORALL (pivnum: real):
          pivnum = -entry(S)(i, j) / entry(S)(j, j) IMPLIES
           max(k - 1, 0) >= 0);


decl_type: tcc
theory: matrix_diag
library: matrices
signature: nil
location: 800 0 834 999
body:
  % Termination TCC generated (at line 66, column 6) for
      % diagonalize(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))
  diagonalize_TCC23: OBLIGATION
    FORALL (pn: posnat, comp_matrix, comp_inverse: bool,
            (S: SquareMatrix(pn) | upper_triangular?(S)),
            (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)
                 | upper_triangular?(T) AND
                    (comp_matrix IMPLIES Q * T = S) AND
                     (FORALL (i):
                        i < rows(T) IMPLIES
                         entry(T)(i, i) = entry(S)(i, i))),
            (j: nat | d_point1(S)(j)), (i: nat | d_point2(S, j)(i)),
            stop_rec: bool, k: nat):
           NOT entry(S)(i, j) = 0 AND NOT i = j AND NOT entry(S)(j, j) = 0
       AND NOT (stop_rec AND k = 0) AND NOT (i = 0 AND j = 0)
       IMPLIES
       (FORALL (pivnum: real):
          pivnum = -entry(S)(i, j) / entry(S)(j, j) IMPLIES
           lex2(j, pn - (i + 1)) < lex2(j, pn - i));


decl_type: tcc
theory: matrix_diag
library: matrices
signature: nil
location: 836 0 1215 999
body:
  % Subtype TCC generated (at line 66, column 6) for
      % diagonalize(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))
      % expected type  {SGI:
                     %    [SquareMatrix(pn), SquareMatrix(pn),
                     %     SquareMatrix(pn)] |
                     %          (NOT stop_rec) IMPLIES
                     %                upper_triangular?(SGI`1)
                     %            AND FORALL
                     %                (k):
                     %                k < rows(T)
                     %                IMPLIES
                     %                entry(T)(k, k) = entry(SGI`1)(k, k)
                     %            AND FORALL
                     %                (k, p):
                     %                k < rows(SGI`1)
                     %                AND
                     %                k < rows(SGI`1) AND k < p
                     %                IMPLIES
                     %                (entry(SGI`1)(p, p) = 0
                     %                 OR
                     %                 entry(SGI`1)(k, p) = 0)
                     %            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)}
  diagonalize_TCC24: OBLIGATION
    FORALL (pn: posnat, comp_matrix, comp_inverse: bool,
            (S: SquareMatrix(pn) | upper_triangular?(S)),
            (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)
                 | upper_triangular?(T) AND
                    (comp_matrix IMPLIES Q * T = S) AND
                     (FORALL (i):
                        i < rows(T) IMPLIES
                         entry(T)(i, i) = entry(S)(i, i))),
            (j: nat | d_point1(S)(j)), (i: nat | d_point2(S, j)(i)),
            v:
              [pn1: posnat ->
                 [d1:
                    {z:
                       [comp_matrix: bool, comp_inverse: bool,
                        S: {S: SquareMatrix(pn1) | upper_triangular?(S)},
                        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) |
                                 upper_triangular?(T) AND
                                  (comp_matrix IMPLIES Q * T = S) AND
                                   (FORALL (i):
                                      i < rows(T)
                                      IMPLIES
                                      entry(T)(i, i) = entry(S)(i, i))},
                        j: {j | d_point1(S)(j)}, {i | d_point2(S, j)(i)},
                        bool, nat] |
                             lex2(z`7, pn1 - z`8) < lex2(j, pn - i)} ->
                    {SGI:
                       [SquareMatrix(pn1), SquareMatrix(pn1),
                        SquareMatrix(pn1)] |
                             (NOT d1`9) IMPLIES
                                   upper_triangular?(SGI`1)
                               AND FORALL (k):
                                     k < rows(d1`6) IMPLIES
                                      entry(d1`6)(k, k) = entry(SGI`1)(k, k)
                               AND FORALL (k, p):
                                     k < rows(SGI`1) AND
                                      k < rows(SGI`1) AND k < p
                                      IMPLIES
                                      (entry(SGI`1)(p, p) = 0
                                       OR
                                       entry(SGI`1)(k, p) = 0)
                               AND (d1`1 IMPLIES
                                     SGI`2 * d1`6 = SGI`1 AND
                                      is_simple_prod?
                                      (pn1, FALSE, FALSE)(SGI`2))
                               AND (d1`1 AND d1`2 IMPLIES
                                     (SGI`3 * SGI`2 = Id(pn1)
                                      AND
                                      SGI`2 * SGI`3 = Id(pn1)
                                      AND
                                      is_simple_prod?
                                      (pn1, FALSE, FALSE)(SGI`3)))
                               AND det(SGI`1) = det(d1`3)}]],
            stop_rec: bool, k: nat):
           NOT entry(S)(i, j) = 0 AND NOT i = j AND NOT entry(S)(j, j) = 0
       AND NOT (stop_rec AND k = 0) AND NOT (i = 0 AND j = 0)
       IMPLIES
       (FORALL (pivnum: real):
          pivnum = -entry(S)(i, j) / entry(S)(j, j) IMPLIES
           (NOT stop_rec) IMPLIES
                 upper_triangular?(v(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))`1)
             AND FORALL (k_1: nat):
                   k_1 < rows(T) IMPLIES
                    entry(T)(k_1, k_1) =
                     entry(v(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))`1)
                          (k_1, k_1)
             AND FORALL (k_1: nat, p):
                   k_1 <
                    rows(v(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))`1)
                    AND
                    k_1 <
                     rows(v(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))`1)
                     AND k_1 < p
                    IMPLIES
                    (entry(v(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))`1)
                          (p, p)
                      = 0
                      OR
                      entry(v(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))`1)
                           (k_1, p)
                       = 0)
             AND (comp_matrix IMPLIES
                   v(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))`2
                    * T
                    =
                    v(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))`1
                    AND
                    is_simple_prod?(pn, FALSE, FALSE)
                                   (v(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))`2))
             AND (comp_matrix AND comp_inverse IMPLIES
                   (v(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))`3
                     *
                     v(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))`2
                     = Id(pn)
                     AND
                     v(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))`2
                      *
                      v(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))`3
                      = Id(pn)
                      AND
                      is_simple_prod?(pn, FALSE, FALSE)
                                     (v
                                      (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))`3)))
             AND det(v(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))`1)
                  = det(S));


decl_type: tcc
theory: matrix_diag
library: matrices
signature: nil
location: 1217 0 1237 999
body:
  % Subtype TCC generated (at line 65, column 37) for  entry(S)(j, j)
      % expected type  nznum
  diagonalize_TCC25: OBLIGATION
    FORALL (pn: posnat, comp_matrix, comp_inverse: bool,
            (S: SquareMatrix(pn) | upper_triangular?(S)),
            (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)
                 | upper_triangular?(T) AND
                    (comp_matrix IMPLIES Q * T = S) AND
                     (FORALL (i):
                        i < rows(T) IMPLIES
                         entry(T)(i, i) = entry(S)(i, i))),
            (j: nat | d_point1(S)(j)), (i: nat | d_point2(S, j)(i)),
            stop_rec: bool, k: nat):
           NOT entry(S)(i, j) = 0 AND NOT i = j AND NOT entry(S)(j, j) = 0
       AND NOT (stop_rec AND k = 0) AND NOT (i = 0 AND j = 0)
       IMPLIES entry(S)(j, j) /= 0;


decl_type: tcc
theory: matrix_diag
library: matrices
signature: nil
location: 1239 0 1241 999
body:
  % Subtype TCC generated (at line 74, column 69) for  rows(S)
      % expected type  posnat
  diag_TCC1: OBLIGATION FORALL (S): rows(S) > 0;


decl_type: tcc
theory: matrix_diag
library: matrices
signature: nil
location: 1243 0 1247 999
body:
  % Subtype TCC generated (at line 83, column 77) for  Id(rows(S))
      % expected type  {Q: SquareMatrix(rows(S)) |
                     %          is_simple_prod?(rows(S), FALSE, FALSE)(Q)}
  diag_TCC2: OBLIGATION
    FORALL (S: Square): is_simple_prod?(rows(S), FALSE, FALSE)(Id(rows(S)));


decl_type: tcc
theory: matrix_diag
library: matrices
signature: nil
location: 1249 0 1260 999
body:
  % Subtype TCC generated (at line 83, column 89) for  Id(rows(S))
      % expected type  {R: SquareMatrix(rows(S)) |
                     %          is_simple_prod?(rows(S), FALSE, FALSE)(R) AND
                     %           (comp_matrix AND comp_inverse IMPLIES
                     %             (R * Id(rows(S)) = Id(rows(S)) AND
                     %               Id(rows(S)) * R = Id(rows(S))))}
  diag_TCC3: OBLIGATION
    FORALL (comp_matrix, comp_inverse: bool, S: Square):
      is_simple_prod?(rows(S), FALSE, FALSE)(Id(rows(S))) AND
       (comp_matrix AND comp_inverse IMPLIES
         (Id(rows(S)) * Id(rows(S)) = Id(rows(S)) AND
           Id(rows(S)) * Id(rows(S)) = Id(rows(S))));


decl_type: tcc
theory: matrix_diag
library: matrices
signature: nil
location: 1262 0 1267 999
body:
  % Subtype TCC generated (at line 83, column 101) for  S
      % expected type  {T: SquareMatrix(rows(S)) |
                     %          comp_matrix IMPLIES Id(rows(S)) * T = S}
  diag_TCC4: OBLIGATION
    FORALL (comp_matrix: bool, S: Square):
      comp_matrix IMPLIES Id(rows(S)) * S = S;


decl_type: tcc
theory: matrix_diag
library: matrices
signature: nil
location: 1269 0 1271 999
body:
  % Subtype TCC generated (at line 83, column 103) for  0
      % expected type  {j | ut_point1(S)(j)}
  diag_TCC5: OBLIGATION FORALL (S: Square): ut_point1(S)(0);


decl_type: tcc
theory: matrix_diag
library: matrices
signature: nil
location: 1273 0 1276 999
body:
  % Subtype TCC generated (at line 83, column 105) for  rows(S) - 1
      % expected type  {i | ut_point2(S, 0)(i)}
  diag_TCC6: OBLIGATION
    FORALL (S: Square): rows(S) - 1 >= 0 AND ut_point2(S, 0)(rows(S) - 1);


decl_type: tcc
theory: matrix_diag
library: matrices
signature: nil
location: 1278 0 1298 999
body:
  % Subtype TCC generated (at line 84, column 68) for  S2
      % expected type  {S_1: SquareMatrix(rows(S)) | upper_triangular?(S_1)}
  diag_TCC7: OBLIGATION
    FORALL (comp_matrix, comp_inverse: bool, S: Square,
            S2: SquareMatrix(rows(S)), Q2: SquareMatrix(rows(S)),
            R2: SquareMatrix(rows(S))):
      R2 =
       upper_triangulate(rows(S))
                        (comp_matrix, comp_inverse, S, Id(rows(S)),
                         Id(rows(S)), S, 0, rows(S) - 1, FALSE, 0)`3
       AND
       Q2 =
        upper_triangulate(rows(S))
                         (comp_matrix, comp_inverse, S, Id(rows(S)),
                          Id(rows(S)), S, 0, rows(S) - 1, FALSE, 0)`2
        AND
        S2 =
         upper_triangulate(rows(S))
                          (comp_matrix, comp_inverse, S, Id(rows(S)),
                           Id(rows(S)), S, 0, rows(S) - 1, FALSE, 0)`1
       IMPLIES upper_triangular?(S2);


decl_type: tcc
theory: matrix_diag
library: matrices
signature: nil
location: 1300 0 1328 999
body:
  % Subtype TCC generated (at line 84, column 95) for  S2
      % expected type  {T: SquareMatrix(rows(S)) |
                     %          upper_triangular?(T) AND
                     %           (comp_matrix IMPLIES Id(rows(S)) * T = S2)
                     %            AND
                     %            (FORALL (i):
                     %               i < rows(T) IMPLIES
                     %                entry(T)(i, i) = entry(S2)(i, i))}
  diag_TCC8: OBLIGATION
    FORALL (comp_matrix, comp_inverse: bool, S: Square,
            S2: SquareMatrix(rows(S)), Q2: SquareMatrix(rows(S)),
            R2: SquareMatrix(rows(S))):
      R2 =
       upper_triangulate(rows(S))
                        (comp_matrix, comp_inverse, S, Id(rows(S)),
                         Id(rows(S)), S, 0, rows(S) - 1, FALSE, 0)`3
       AND
       Q2 =
        upper_triangulate(rows(S))
                         (comp_matrix, comp_inverse, S, Id(rows(S)),
                          Id(rows(S)), S, 0, rows(S) - 1, FALSE, 0)`2
        AND
        S2 =
         upper_triangulate(rows(S))
                          (comp_matrix, comp_inverse, S, Id(rows(S)),
                           Id(rows(S)), S, 0, rows(S) - 1, FALSE, 0)`1
       IMPLIES
       upper_triangular?(S2) AND
        (comp_matrix IMPLIES Id(rows(S)) * S2 = S2) AND (FORALL (i): TRUE);


decl_type: tcc
theory: matrix_diag
library: matrices
signature: nil
location: 1330 0 1350 999
body:
  % Subtype TCC generated (at line 84, column 98) for  rows(S) - 1
      % expected type  {j | d_point1(S2)(j)}
  diag_TCC9: OBLIGATION
    FORALL (comp_matrix, comp_inverse: bool, S: Square,
            S2: SquareMatrix(rows(S)), Q2: SquareMatrix(rows(S)),
            R2: SquareMatrix(rows(S))):
      R2 =
       upper_triangulate(rows(S))
                        (comp_matrix, comp_inverse, S, Id(rows(S)),
                         Id(rows(S)), S, 0, rows(S) - 1, FALSE, 0)`3
       AND
       Q2 =
        upper_triangulate(rows(S))
                         (comp_matrix, comp_inverse, S, Id(rows(S)),
                          Id(rows(S)), S, 0, rows(S) - 1, FALSE, 0)`2
        AND
        S2 =
         upper_triangulate(rows(S))
                          (comp_matrix, comp_inverse, S, Id(rows(S)),
                           Id(rows(S)), S, 0, rows(S) - 1, FALSE, 0)`1
       IMPLIES rows(S) - 1 >= 0 AND d_point1(S2)(rows(S) - 1);


decl_type: tcc
theory: matrix_diag
library: matrices
signature: nil
location: 1352 0 1372 999
body:
  % Subtype TCC generated (at line 84, column 108) for  0
      % expected type  {i | d_point2(S2, rows(S) - 1)(i)}
  diag_TCC10: OBLIGATION
    FORALL (comp_matrix, comp_inverse: bool, S: Square,
            S2: SquareMatrix(rows(S)), Q2: SquareMatrix(rows(S)),
            R2: SquareMatrix(rows(S))):
      R2 =
       upper_triangulate(rows(S))
                        (comp_matrix, comp_inverse, S, Id(rows(S)),
                         Id(rows(S)), S, 0, rows(S) - 1, FALSE, 0)`3
       AND
       Q2 =
        upper_triangulate(rows(S))
                         (comp_matrix, comp_inverse, S, Id(rows(S)),
                          Id(rows(S)), S, 0, rows(S) - 1, FALSE, 0)`2
        AND
        S2 =
         upper_triangulate(rows(S))
                          (comp_matrix, comp_inverse, S, Id(rows(S)),
                           Id(rows(S)), S, 0, rows(S) - 1, FALSE, 0)`1
       IMPLIES d_point2(S2, rows(S) - 1)(0);


decl_type: tcc
theory: matrix_diag
library: matrices
signature: nil
location: 1374 0 1414 999
body:
  % Subtype TCC generated (at line 85, column 37) for  R2 * R3
      % expected type  SquareMatrix(rows(S))
  diag_TCC11: OBLIGATION
    FORALL (comp_matrix, comp_inverse: bool, S: Square,
            S2: SquareMatrix(rows(S)), Q2: SquareMatrix(rows(S)),
            R2: SquareMatrix(rows(S))):
      R2 =
       upper_triangulate(rows(S))
                        (comp_matrix, comp_inverse, S, Id(rows(S)),
                         Id(rows(S)), S, 0, rows(S) - 1, FALSE, 0)`3
       AND
       Q2 =
        upper_triangulate(rows(S))
                         (comp_matrix, comp_inverse, S, Id(rows(S)),
                          Id(rows(S)), S, 0, rows(S) - 1, FALSE, 0)`2
        AND
        S2 =
         upper_triangulate(rows(S))
                          (comp_matrix, comp_inverse, S, Id(rows(S)),
                           Id(rows(S)), S, 0, rows(S) - 1, FALSE, 0)`1
       IMPLIES
       (FORALL (S3: SquareMatrix(rows(S)), Q3: SquareMatrix(rows(S)),
                R3: SquareMatrix(rows(S))):
          R3 =
           diagonalize(rows(S))
                      (comp_matrix, comp_inverse, S2, Id(rows(S)),
                       Id(rows(S)), S2, rows(S) - 1, 0, FALSE, 0)`3
           AND
           Q3 =
            diagonalize(rows(S))
                       (comp_matrix, comp_inverse, S2, Id(rows(S)),
                        Id(rows(S)), S2, rows(S) - 1, 0, FALSE, 0)`2
            AND
            S3 =
             diagonalize(rows(S))
                        (comp_matrix, comp_inverse, S2, Id(rows(S)),
                         Id(rows(S)), S2, rows(S) - 1, 0, FALSE, 0)`1
           IMPLIES
           rows(R2 * R3) = rows(S) AND
            rows(R2 * R3) = columns(R2 * R3) AND
             rows(R2 * R3) > 0 AND columns(R2 * R3) > 0);


decl_type: tcc
theory: matrix_diag
library: matrices
signature: nil
location: 1416 0 1456 999
body:
  % Subtype TCC generated (at line 85, column 25) for  Q3 * Q2
      % expected type  SquareMatrix(rows(S))
  diag_TCC12: OBLIGATION
    FORALL (comp_matrix, comp_inverse: bool, S: Square,
            S2: SquareMatrix(rows(S)), Q2: SquareMatrix(rows(S)),
            R2: SquareMatrix(rows(S))):
      R2 =
       upper_triangulate(rows(S))
                        (comp_matrix, comp_inverse, S, Id(rows(S)),
                         Id(rows(S)), S, 0, rows(S) - 1, FALSE, 0)`3
       AND
       Q2 =
        upper_triangulate(rows(S))
                         (comp_matrix, comp_inverse, S, Id(rows(S)),
                          Id(rows(S)), S, 0, rows(S) - 1, FALSE, 0)`2
        AND
        S2 =
         upper_triangulate(rows(S))
                          (comp_matrix, comp_inverse, S, Id(rows(S)),
                           Id(rows(S)), S, 0, rows(S) - 1, FALSE, 0)`1
       IMPLIES
       (FORALL (S3: SquareMatrix(rows(S)), Q3: SquareMatrix(rows(S)),
                R3: SquareMatrix(rows(S))):
          R3 =
           diagonalize(rows(S))
                      (comp_matrix, comp_inverse, S2, Id(rows(S)),
                       Id(rows(S)), S2, rows(S) - 1, 0, FALSE, 0)`3
           AND
           Q3 =
            diagonalize(rows(S))
                       (comp_matrix, comp_inverse, S2, Id(rows(S)),
                        Id(rows(S)), S2, rows(S) - 1, 0, FALSE, 0)`2
            AND
            S3 =
             diagonalize(rows(S))
                        (comp_matrix, comp_inverse, S2, Id(rows(S)),
                         Id(rows(S)), S2, rows(S) - 1, 0, FALSE, 0)`1
           IMPLIES
           rows(Q3 * Q2) = rows(S) AND
            rows(Q3 * Q2) = columns(Q3 * Q2) AND
             rows(Q3 * Q2) > 0 AND columns(Q3 * Q2) > 0);


decl_type: tcc
theory: matrix_diag
library: matrices
signature: nil
location: 1458 0 1551 999
body:
  % Subtype TCC generated (at line 85, column 3) for
      % (# ans := S3, multip := Q3 * Q2, inv := R2 * R3 #)
      % expected type  {SGI:
                     %    [# ans: SquareMatrix(rows(S)),
                     %       multip: SquareMatrix(rows(S)),
                     %       inv: SquareMatrix(rows(S)) #] |
                     %               upper_triangular?(SGI`ans)
                     %           AND (FORALL
                     %                (k, p):
                     %                k < rows(S)
                     %                AND
                     %                p < rows(S)
                     %                AND
                     %                entry(SGI`ans)(k, p) /= 0
                     %                IMPLIES
                     %                (k = p
                     %                 OR
                     %                 (k < p AND entry(SGI`ans)(p, p) = 0)))
                     %           AND (comp_matrix
                     %                IMPLIES
                     %                SGI`multip * S = SGI`ans
                     %                AND
                     %                is_simple_prod?
                     %                (rows(S), FALSE, FALSE)(SGI`multip))
                     %           AND (comp_matrix AND comp_inverse
                     %                IMPLIES
                     %                (SGI`inv * SGI`multip = Id(rows(S))
                     %                 AND
                     %                 SGI`multip * SGI`inv = Id(rows(S))
                     %                 AND
                     %                 is_simple_prod?
                     %                 (rows(S), FALSE, FALSE)(SGI`inv)))
                     %           AND det(SGI`ans) = det(S)
                     %           AND (det(S) /= 0
                     %                IFF
                     %                (FORALL
                     %                 (k, p):
                     %                 k < rows(S) AND p < rows(S)
                     %                 IMPLIES
                     %                 (entry(SGI`ans)(k, p) /= 0
                     %                  IFF
                     %                  k = p)))}
  diag_TCC13: OBLIGATION
    FORALL (comp_matrix, comp_inverse: bool, S: Square,
            S2: SquareMatrix(rows(S)), Q2: SquareMatrix(rows(S)),
            R2: SquareMatrix(rows(S))):
      R2 =
       upper_triangulate(rows(S))
                        (comp_matrix, comp_inverse, S, Id(rows(S)),
                         Id(rows(S)), S, 0, rows(S) - 1, FALSE, 0)`3
       AND
       Q2 =
        upper_triangulate(rows(S))
                         (comp_matrix, comp_inverse, S, Id(rows(S)),
                          Id(rows(S)), S, 0, rows(S) - 1, FALSE, 0)`2
        AND
        S2 =
         upper_triangulate(rows(S))
                          (comp_matrix, comp_inverse, S, Id(rows(S)),
                           Id(rows(S)), S, 0, rows(S) - 1, FALSE, 0)`1
       IMPLIES
       (FORALL (S3: SquareMatrix(rows(S)), Q3: SquareMatrix(rows(S)),
                R3: SquareMatrix(rows(S))):
          R3 =
           diagonalize(rows(S))
                      (comp_matrix, comp_inverse, S2, Id(rows(S)),
                       Id(rows(S)), S2, rows(S) - 1, 0, FALSE, 0)`3
           AND
           Q3 =
            diagonalize(rows(S))
                       (comp_matrix, comp_inverse, S2, Id(rows(S)),
                        Id(rows(S)), S2, rows(S) - 1, 0, FALSE, 0)`2
            AND
            S3 =
             diagonalize(rows(S))
                        (comp_matrix, comp_inverse, S2, Id(rows(S)),
                         Id(rows(S)), S2, rows(S) - 1, 0, FALSE, 0)`1
           IMPLIES
                upper_triangular?(S3)
            AND FORALL (k, p):
                  k < rows(S) AND p < rows(S) AND entry(S3)(k, p) /= 0
                   IMPLIES (k = p OR (k < p AND entry(S3)(p, p) = 0))
            AND (comp_matrix IMPLIES
                  Q3 * Q2 * S = S3 AND
                   is_simple_prod?(rows(S), FALSE, FALSE)(Q3 * Q2))
            AND (comp_matrix AND comp_inverse IMPLIES
                  (R2 * R3 * (Q3 * Q2) = Id(rows(S)) AND
                    Q3 * Q2 * (R2 * R3) = Id(rows(S)) AND
                     is_simple_prod?(rows(S), FALSE, FALSE)(R2 * R3)))
            AND det(S3) = det(S)
            AND (det(S) /= 0 IFF
                  (FORALL (k, p):
                     k < rows(S) AND p < rows(S) IMPLIES
                      (entry(S3)(k, p) /= 0 IFF k = p))));


decl_type: formula
theory: matrix_inv
library: matrices
signature: nil
location: 51 2 55 63
body:
    invertible_rew: LEMMA
      invertible?(SQ) IFF
      (det(SQ)/=0 OR
       (EXISTS (IQ): rows(IQ) = rows(SQ) AND IQ*SQ=Id(rows(SQ))) OR
       (EXISTS (IQ): rows(IQ) = rows(SQ) AND SQ*IQ=Id(rows(SQ))))


decl_type: formula
theory: matrix_inv
library: matrices
signature: nil
location: 67 3 70 47
body:
     inverse_unique: LEMMA rows(IQ)=rows(SQ) AND (IQ*SQ = Id(rows(SQ)) OR 
       SQ*IQ = Id(rows(SQ)))
       IMPLIES (invertible?(SQ) AND det(SQ)/=0 AND IQ=inverse(SQ) AND
       IQ*SQ=Id(rows(SQ)) AND SQ*IQ=Id(rows(SQ)))


decl_type: formula
theory: matrix_inv
library: matrices
signature: nil
location: 74 3 76 39
body:
     invertible_mult: LEMMA rows(S)=rows(R) AND (det(S)/=0 OR invertible?(S)) AND
                         (det(R)/=0 OR invertible?(R)) IMPLIES
       (det(S*R)/=0 AND invertible?(S*R))


decl_type: formula
theory: matrix_inv
library: matrices
signature: nil
location: 78 3 80 41
body:
     inverse_mult: LEMMA rows(S)=rows(R) AND (det(S)/=0 OR invertible?(S)) AND
                         (det(R)/=0 OR invertible?(R)) IMPLIES
       inverse(S*R) = inverse(R)*inverse(S)


decl_type: formula
theory: matrix_inv
library: matrices
signature: nil
location: 95 3 105 9
body:
     mult_induction: LEMMA FORALL (P:[SquareMatrix(rows(S))->bool]):
       (FORALL (i,j,r): i<rows(S) AND j<rows(S) AND i/=j IMPLIES 
         P(Easr(rows(S))(i,j,r))) AND
       (FORALL (i,r): i<rows(S) AND r/=0 IMPLIES 
         P(Esr(rows(S))(i,r))) AND
       P(Id(rows(S))) AND
       (FORALL (Q,R:SquareMatrix(rows(S))): P(Q) AND P(R) 
         IMPLIES P(Q*R)) AND
       det(S)/=0
       IMPLIES
       P(S)


decl_type: function
theory: matrix_inv
library: matrices
signature:
  [S: {S | det(S) /= 0} ->
  {Q: SquareMatrix(rows(S)) | Q * S = Id(rows(S))}]

location: 37 2 41 13
body:
    left_inv(S|det(S)/=0): {Q:SquareMatrix(rows(S))|Q*S=Id(rows(S))} =
      LET dg = diag(true,false,S), R=dg`multip,
          newT = form_matrix(LAMBDA (i,j): IF i/=j OR entry(R*S)(i,i)=0 THEN 0
                                           ELSE 1/entry(R*S)(i,i) ENDIF,rows(S),rows(S))
      IN newT*R


decl_type: function
theory: matrix_inv
library: matrices
signature: [Square -> bool]
location: 47 2 49 51
body:
    invertible?(SQ): bool =
      EXISTS (IQ): rows(IQ) = rows(SQ) AND
        IQ*SQ = Id(rows(SQ)) AND SQ*IQ = Id(rows(SQ))


decl_type: function
theory: matrix_inv
library: matrices
location: 57 2 59 67
signature:
  [SQ: {SQ | det(SQ) /= 0 OR invertible?(SQ)} ->
          {IQ |
                   rows(IQ) = rows(SQ) AND
                    IQ * SQ = Id(rows(SQ)) AND
                     SQ * IQ = Id(rows(SQ))}]

body:
    inverse(SQ|det(SQ)/=0 OR invertible?(SQ)): {IQ |
      rows(IQ) = rows(SQ) AND
        IQ*SQ = Id(rows(SQ)) AND SQ*IQ = Id(rows(SQ))} = left_inv(SQ)


decl_type: function
theory: matrix_inv
library: matrices
signature: [posnat -> Square]
location: 90 3 90 108
body:
     GH(pn:posnat): Square = form_matrix(LAMBDA (i,j): IF i<j THEN i^2+j^3+3 ELSE i*j-2+i^3+0.1^i ENDIF,pn,pn)


decl_type: tcc
theory: matrix_inv
library: matrices
signature: nil
location: 116 0 119 999
body:
  % Subtype TCC generated (at line 37, column 57) for  rows(S)
      % expected type  pm: posnat
  left_inv_TCC1: OBLIGATION
    FORALL (S: Square | det(S) /= 0, Q: SquareMatrix(rows(S))): rows(S) > 0;


decl_type: tcc
theory: matrix_inv
library: matrices
signature: nil
location: 121 0 148 999
body:
  % Subtype TCC generated (at line 40, column 22) for  entry(R * S)(i, i)
      % expected type  nznum
  left_inv_TCC2: OBLIGATION
    FORALL (S: Square | det(S) /= 0,
            dg:
              {SGI:
                 [# ans: SquareMatrix(rows(S)),
                    inv: SquareMatrix(rows(S)),
                    multip: SquareMatrix(rows(S)) #] |
                            upper_triangular?(SGI`ans)
                        AND FORALL (k, p):
                              k < rows(S) AND
                               p < rows(S) AND entry(SGI`ans)(k, p) /= 0
                               IMPLIES
                               (k = p OR (k < p AND entry(SGI`ans)(p, p) = 0))
                        AND SGI`multip * S = SGI`ans
                        AND is_simple_prod?(rows(S), FALSE, FALSE)(SGI`multip)
                        AND det(SGI`ans) = det(S)
                        AND (det(S) /= 0 IFF
                              (FORALL (k, p):
                                 k < rows(S) AND p < rows(S) IMPLIES
                                  (entry(SGI`ans)(k, p) /= 0 IFF k = p)))}):
      dg = diag(TRUE, FALSE, S) IMPLIES
       (FORALL (R: SquareMatrix(rows(S))):
          R = dg`multip IMPLIES
           (FORALL (i: nat, j: nat):
              NOT i /= j AND NOT entry(R * S)(i, i) = 0 IMPLIES
               entry(R * S)(i, i) /= 0));


decl_type: tcc
theory: matrix_inv
library: matrices
signature: nil
location: 150 0 193 999
body:
  % Subtype TCC generated (at line 41, column 7) for  newT * R
      % expected type  {Q: SquareMatrix(rows(S)) | Q * S = Id(rows(S))}
  left_inv_TCC3: OBLIGATION
    FORALL (S: Square | det(S) /= 0,
            dg:
              {SGI:
                 [# ans: SquareMatrix(rows(S)),
                    inv: SquareMatrix(rows(S)),
                    multip: SquareMatrix(rows(S)) #] |
                            upper_triangular?(SGI`ans)
                        AND FORALL (k, p):
                              k < rows(S) AND
                               p < rows(S) AND entry(SGI`ans)(k, p) /= 0
                               IMPLIES
                               (k = p OR (k < p AND entry(SGI`ans)(p, p) = 0))
                        AND SGI`multip * S = SGI`ans
                        AND is_simple_prod?(rows(S), FALSE, FALSE)(SGI`multip)
                        AND det(SGI`ans) = det(S)
                        AND (det(S) /= 0 IFF
                              (FORALL (k, p):
                                 k < rows(S) AND p < rows(S) IMPLIES
                                  (entry(SGI`ans)(k, p) /= 0 IFF k = p)))}):
      dg = diag(TRUE, FALSE, S) IMPLIES
       (FORALL (R: SquareMatrix(rows(S))):
          R = dg`multip IMPLIES
           (FORALL (newT:
                      {M: MatrixMN(rows(S), rows(S)) |
                               FORALL (i_1: below(rows(S)),
                                       j_1: below(rows(S))):
                                 nth[real](row(M)(i_1), j_1) =
                                  IF i_1 /= j_1 OR entry(R * S)(i_1, i_1) = 0
                                    THEN 0
                                  ELSE 1 / entry(R * S)(i_1, i_1)
                                  ENDIF}):
              newT =
               form_matrix(LAMBDA (i, j):
                             IF i /= j OR entry(R * S)(i, i) = 0 THEN 0
                             ELSE 1 / entry(R * S)(i, i)
                             ENDIF,
                           rows(S), rows(S))
               IMPLIES
                    newT * R * S = Id(rows(S)) AND rows(newT * R) = rows(S)
                AND rows(newT * R) = columns(newT * R) AND rows(newT * R) > 0
                AND columns(newT * R) > 0));


decl_type: tcc
theory: matrix_inv
library: matrices
signature: nil
location: 195 0 198 999
body:
  % Subtype TCC generated (at line 45, column 21) for  rows(S)
      % expected type  pm: posnat
  mult_left_inv_right_TCC1: OBLIGATION
    FORALL (S: Square): det(S) /= 0 IMPLIES rows(S) > 0;


decl_type: tcc
theory: matrix_inv
library: matrices
signature: nil
location: 200 0 203 999
body:
  % Subtype TCC generated (at line 49, column 17) for  rows(SQ)
      % expected type  pm: posnat
  invertible?_TCC1: OBLIGATION
    FORALL (SQ: Square, IQ: Square): rows(IQ) = rows(SQ) IMPLIES rows(SQ) > 0;


decl_type: tcc
theory: matrix_inv
library: matrices
signature: nil
location: 205 0 208 999
body:
  % Subtype TCC generated (at line 59, column 64) for  SQ
      % expected type  S: {S | det(S) /= 0}
  inverse_TCC1: OBLIGATION
    FORALL (SQ: Square | det(SQ) /= 0 OR invertible?(SQ)): det(SQ) /= 0;


decl_type: tcc
theory: matrix_inv
library: matrices
signature: nil
location: 210 0 218 999
body:
  % Subtype TCC generated (at line 59, column 55) for  left_inv(SQ)
      % expected type  {IQ |
                     %          rows(IQ) = rows(SQ) AND
                     %           IQ * SQ = Id(rows(SQ)) AND
                     %            SQ * IQ = Id(rows(SQ))}
  inverse_TCC2: OBLIGATION
    FORALL (SQ: Square | det(SQ) /= 0 OR invertible?(SQ)):
      rows(left_inv(SQ)) = rows(SQ) AND
       left_inv(SQ) * SQ = Id(rows(SQ)) AND SQ * left_inv(SQ) = Id(rows(SQ));


decl_type: tcc
theory: matrix_inv
library: matrices
signature: nil
location: 220 0 224 999
body:
  % Subtype TCC generated (at line 62, column 13) for  SQ
      % expected type  SQ: {SQ | det(SQ) /= 0 OR invertible?(SQ)}
  mult_inverse_left_TCC1: OBLIGATION
    FORALL (SQ: Square):
      invertible?(SQ) IMPLIES det(SQ) /= 0 OR invertible?(SQ);


decl_type: tcc
theory: matrix_inv
library: matrices
signature: nil
location: 226 0 229 999
body:
  % Subtype TCC generated (at line 62, column 25) for  rows(SQ)
      % expected type  pm: posnat
  mult_inverse_left_TCC2: OBLIGATION
    FORALL (SQ: Square): invertible?(SQ) IMPLIES rows(SQ) > 0;


decl_type: tcc
theory: matrix_inv
library: matrices
signature: nil
location: 231 0 240 999
body:
  % Subtype TCC generated (at line 76, column 34) for  S * R
      % expected type  Square
  invertible_mult_TCC1: OBLIGATION
    FORALL (R, S: Square):
      (det(R) /= 0 OR invertible?(R)) AND
       (det(S) /= 0 OR invertible?(S)) AND
        rows(S) = rows(R) AND det(S * R) /= 0
       IMPLIES
       rows(S * R) = columns(S * R) AND
        rows(S * R) > 0 AND columns(S * R) > 0;


decl_type: tcc
theory: matrix_inv
library: matrices
signature: nil
location: 242 0 251 999
body:
  % Subtype TCC generated (at line 80, column 13) for  S * R
      % expected type  SQ: {SQ | det(SQ) /= 0 OR invertible?(SQ)}
  inverse_mult_TCC1: OBLIGATION
    FORALL (R, S: Square):
      (det(R) /= 0 OR invertible?(R)) AND
       (det(S) /= 0 OR invertible?(S)) AND rows(S) = rows(R)
       IMPLIES
       (det(S * R) /= 0 OR invertible?(S * R)) AND
        rows(S * R) = columns(S * R) AND
         rows(S * R) > 0 AND columns(S * R) > 0;


decl_type: tcc
theory: matrix_inv
library: matrices
signature: nil
location: 253 0 256 999
body:
  % Subtype TCC generated (at line 83, column 25) for  det(S)
      % expected type  nznum
  det_inverse_TCC1: OBLIGATION
    FORALL (S: Square): det(S) /= 0 OR invertible?(S) IMPLIES det(S) /= 0;


decl_type: tcc
theory: matrix_inv
library: matrices
signature: nil
location: 258 0 263 999
body:
  % Subtype TCC generated (at line 88, column 12) for  inverse(S)
      % expected type  SQ: {SQ | det(SQ) /= 0 OR invertible?(SQ)}
  inverse_inverse_TCC1: OBLIGATION
    FORALL (S: Square):
      det(S) /= 0 OR invertible?(S) IMPLIES
       det(inverse(S)) /= 0 OR invertible?(inverse(S));


decl_type: tcc
theory: matrix_inv
library: matrices
signature: nil
location: 265 0 267 999
body:
  % Subtype TCC generated (at line 90, column 67) for  2
      % expected type  {i_1: int | i /= 0 OR i_1 >= 0}
  GH_TCC1: OBLIGATION FORALL (i: nat, j: nat): i < j IMPLIES i /= 0 OR 2 >= 0;


decl_type: tcc
theory: matrix_inv
library: matrices
signature: nil
location: 269 0 271 999
body:
  % Subtype TCC generated (at line 90, column 71) for  3
      % expected type  {i: int | j /= 0 OR i >= 0}
  GH_TCC2: OBLIGATION FORALL (i: nat, j: nat): i < j IMPLIES j /= 0 OR 3 >= 0;


decl_type: tcc
theory: matrix_inv
library: matrices
signature: nil
location: 273 0 276 999
body:
  % Subtype TCC generated (at line 90, column 88) for  3
      % expected type  {i_1: int | i /= 0 OR i_1 >= 0}
  GH_TCC3: OBLIGATION
    FORALL (i: nat, j: nat): NOT i < j IMPLIES i /= 0 OR 3 >= 0;


decl_type: tcc
theory: matrix_inv
library: matrices
signature: nil
location: 278 0 311 999
body:
  % Subtype TCC generated (at line 90, column 27) for
      % form_matrix(LAMBDA (i, j):
      %               IF i < j THEN i ^ 2 + j ^ 3 + 3
      %               ELSE i * j - 2 + i ^ 3 + 0.1 ^ i
      %               ENDIF,
      %             pn, pn)
      % expected type  Square
  GH_TCC4: OBLIGATION
    FORALL (pn: posnat):
      rows(form_matrix(LAMBDA (i, j):
                         IF i < j THEN i ^ 2 + j ^ 3 + 3
                         ELSE i * j - 2 + i ^ 3 + 0.1 ^ i
                         ENDIF,
                       pn, pn))
       =
       columns(form_matrix(LAMBDA (i, j):
                             IF i < j THEN i ^ 2 + j ^ 3 + 3
                             ELSE i * j - 2 + i ^ 3 + 0.1 ^ i
                             ENDIF,
                           pn, pn))
       AND
       rows(form_matrix(LAMBDA (i, j):
                          IF i < j THEN i ^ 2 + j ^ 3 + 3
                          ELSE i * j - 2 + i ^ 3 + 0.1 ^ i
                          ENDIF,
                        pn, pn))
        > 0
        AND
        columns(form_matrix(LAMBDA (i, j):
                              IF i < j THEN i ^ 2 + j ^ 3 + 3
                              ELSE i * j - 2 + i ^ 3 + 0.1 ^ i
                              ENDIF,
                            pn, pn))
         > 0;


decl_type: tcc
theory: matrix_inv
library: matrices
signature: nil
location: 313 0 317 999
body:
  % Subtype TCC generated (at line 97, column 14) for  rows(S)
      % expected type  pn: posnat
  mult_induction_TCC1: OBLIGATION
    FORALL (S: Square, i: nat, j: nat):
      i < rows(S) AND j < rows(S) AND i /= j IMPLIES rows(S) > 0;


decl_type: tcc
theory: matrix_inv
library: matrices
signature: nil
location: 319 0 328 999
body:
  % Subtype TCC generated (at line 99, column 13) for  rows(S)
      % expected type  pn: posnat
  mult_induction_TCC2: OBLIGATION
    FORALL (S: Square, P: [SquareMatrix(rows(S)) -> bool]):
      (FORALL (i, j, r):
         i < rows(S) AND j < rows(S) AND i /= j IMPLIES
          P(Easr(rows(S))(i, j, r)))
       IMPLIES
       (FORALL (i1: nat, r1: real):
          i1 < rows(S) AND r1 /= 0 IMPLIES rows(S) > 0);


decl_type: tcc
theory: matrix_inv
library: matrices
signature: nil
location: 330 0 339 999
body:
  % Subtype TCC generated (at line 100, column 10) for  rows(S)
      % expected type  pm: posnat
  mult_induction_TCC3: OBLIGATION
    FORALL (S: Square, P: [SquareMatrix(rows(S)) -> bool]):
      ((FORALL (i, r): i < rows(S) AND r /= 0 IMPLIES P(Esr(rows(S))(i, r)))
        AND
        (FORALL (i, j, r):
           i < rows(S) AND j < rows(S) AND i /= j IMPLIES
            P(Easr(rows(S))(i, j, r))))
       IMPLIES rows(S) > 0;


decl_type: tcc
theory: matrix_inv
library: matrices
signature: nil
location: 341 0 356 999
body:
  % Subtype TCC generated (at line 102, column 17) for  Q * R
      % expected type  SquareMatrix(rows(S))
  mult_induction_TCC4: OBLIGATION
    FORALL (S: Square, P: [SquareMatrix(rows(S)) -> bool]):
      (P(Id(rows(S))) AND
        (FORALL (i, r): i < rows(S) AND r /= 0 IMPLIES P(Esr(rows(S))(i, r)))
         AND
         (FORALL (i, j, r):
            i < rows(S) AND j < rows(S) AND i /= j IMPLIES
             P(Easr(rows(S))(i, j, r))))
       IMPLIES
       (FORALL (Q, R: SquareMatrix(rows(S))):
          P(Q) AND P(R) IMPLIES
           rows(Q * R) = rows(S) AND
            rows(Q * R) = columns(Q * R) AND
             rows(Q * R) > 0 AND columns(Q * R) > 0);


decl_type: formula
theory: tensor_product
library: matrices
signature: nil
location: 29 0 30 65
body:
  mod_int: LEMMA FORALL (k:nat, n:posnat): 
                 integer_pred((k-mod(k,n))/n) AND (k-mod(k,n))/n>=0


decl_type: formula
theory: tensor_product
library: matrices
signature: nil
location: 48 0 51 56
body:
  tensor_mult_entry: LEMMA columns(A) = rows(A2) AND columns(B) = rows(B2)
                     IMPLIES entry(tensor_prod(A,B)*tensor_prod(A2, B2))(m1, n1) = 
                     entry(A*A2)((m1-mod(m1, rows(B)))/rows(B), (n1-mod(n1, columns(B2)))/columns(B2))*
                     entry(B*B2)(mod(m1, rows(B)), mod(n1, columns(B2)))


decl_type: formula
theory: tensor_product
library: matrices
signature: nil
location: 54 0 56 86
body:
  invertible_tensor: LEMMA invertible?(AA) AND invertible?(BB) IMPLIES
                     invertible?(tensor_prod(AA,BB)) AND
                     inverse(tensor_prod(AA,BB)) = tensor_prod(inverse(AA), inverse(BB))


decl_type: formula
theory: tensor_product
library: matrices
signature: nil
location: 70 0 71 81
body:
  invertible_tensor_power: LEMMA FORALL(A:Square, n: posnat): invertible?(A) IMPLIES invertible?(tensor_power(A,n)) AND 
                           inverse(tensor_power(A,n)) = tensor_power(inverse(A), n) 


decl_type: formula
theory: tensor_product
library: matrices
signature: nil
location: 73 0 74 54
body:
  tensor_power_rows: LEMMA FORALL(A:PosFullMatrix, n:posnat):
                     rows(A)^n = rows(tensor_power(A,n))


decl_type: formula
theory: tensor_product
library: matrices
signature: nil
location: 76 0 77 48
body:
  tensor_power_columns: LEMMA FORALL(A:PosFullMatrix, n:posnat):
                       columns(A)^n = columns(tensor_power(A,n))


decl_type: formula
theory: tensor_product
library: matrices
signature: nil
location: 82 0 85 25
body:
  mod_eq_lem_alt: LEMMA FORALL (n,m:posnat,i:nat):
            (mod(i,n)+n*mod((i-mod(i,n))/n,m)-
    mod(mod(i,n)+n*mod((i-mod(i,n))/n,m),n))/n
     =mod((i-mod(i,n))/n,m)


decl_type: formula
theory: tensor_product
library: matrices
signature: nil
location: 87 0 88 67
body:
  tensor_prod_assoc: LEMMA FORALL (A,B,C:PosFullMatrix):
    tensor_prod(A,tensor_prod(B,C)) = tensor_prod(tensor_prod(A,B),C)


decl_type: formula
theory: tensor_product
library: matrices
signature: nil
location: 96 0 97 49
body:
  power_assoc: LEMMA FORALL (A:PosFullMatrix, n:posnat): 
               tensor_power(A, n) = tensor_power_alt(A, n) 


decl_type: formula
theory: tensor_product
library: matrices
signature: nil
location: 99 0 100 58
body:
  tensor_power_rows_alt: LEMMA FORALL(A:PosFullMatrix, n:posnat):
                     rows(A)^n = rows(tensor_power_alt(A,n))


decl_type: formula
theory: tensor_product
library: matrices
signature: nil
location: 102 0 103 52
body:
  tensor_power_columns_alt: LEMMA FORALL(A:PosFullMatrix, n:posnat):
                       columns(A)^n = columns(tensor_power_alt(A,n))


decl_type: formula
theory: tensor_product
library: matrices
signature: nil
location: 130 0 131 30
body:
  RowToMat_rows: LEMMA FORALL (M:PosFullMatrix, k:below(rows(M))):
                 rows(RowToMat(M,k))=1


decl_type: formula
theory: tensor_product
library: matrices
signature: nil
location: 133 0 134 42
body:
  RowToMat_columns: LEMMA FORALL (M:PosFullMatrix, k:below(rows(M))):
                 columns(RowToMat(M,k))=columns(M)


decl_type: formula
theory: tensor_product
library: matrices
signature: nil
location: 136 0 137 55
body:
  RowToMat_entry: LEMMA FORALL (M:PosFullMatrix, k:below(rows(M)), n:below(columns(M))):
               entry(RowToMat(M, k))(0,n) = entry(M)(k,n)


decl_type: formula
theory: tensor_product
library: matrices
signature: nil
location: 139 0 141 83
body:
  RowToMat_tensor_prod: LEMMA FORALL(M, N:PosFullMatrix, k:below(rows(M)*rows(N))):
           RowToMat(tensor_prod(M, N), k) = 
           tensor_prod(RowToMat(M, (k-mod(k,rows(N)))/rows(N)), RowToMat(N, mod(k,rows(N))))


decl_type: formula
theory: tensor_product
library: matrices
signature: nil
location: 154 0 155 85
body:
  RowTensors_same: LEMMA FORALL (M:{AA:PosFullMatrix|rows(AA)>1}, n:posnat, k:below(rows(M)^n)):  
                   RowTensor(M, n, base_list(rows(M), k, n)) = RowTensorAlt(M, n, base_n(rows(M), k))


decl_type: formula
theory: tensor_product
library: matrices
signature: nil
location: 157 0 159 86
body:
  RowTensor_is_TensorRow: LEMMA FORALL (M:PosFullMatrix, n:posnat, k:below(rows(M)^n)):
               rows(M)>1 IMPLIES 
               RowToMat(tensor_power_alt(M, n), k) = RowTensor(M, n, base_list(rows(M), k , n))


decl_type: formula
theory: tensor_product
library: matrices
signature: nil
location: 161 0 162 75
body:
  RowTensor_is_TensorRow2: LEMMA FORALL (M:{AA:PosFullMatrix|rows(AA)>1}, n:posnat, k:below(rows(M)^n)):
                           row2mat(tensor_power(M, n), k) = RowTensorAlt(M, n, base_n(rows(M), k))


decl_type: formula
theory: tensor_product
library: matrices
signature: nil
location: 168 0 171 112
body:
  tensor_entry: LEMMA FORALL (A:{M:PosFullMatrix | rows(M)>1 AND columns(M)>1}, n:posnat, k:below(rows(A)^n), m:below(columns(A)^n)):
                LET R = base_n(rows(A), k), 
                    C = base_n(columns(A), m) IN
             entry(tensor_power_alt(A,n))(k,m) = product[nat](0, n-1, entry_pick(n, rows(A), columns(A), A, R, C))   


decl_type: formula
theory: tensor_product
library: matrices
signature: nil
location: 173 0 176 112
body:
  tensor_entry_alt: LEMMA FORALL (A:{M:PosFullMatrix | rows(M)>1 AND columns(M)>1}, n:posnat, k:below(rows(A)^n), m:below(columns(A)^n)):
                LET R = base_n(rows(A), k), 
                    C = base_n(columns(A), m) IN
             entry(tensor_power_alt(A,n))(k,m) = product[nat](0, n-1, entry_pick(n, rows(A), columns(A), A, R, C))  


decl_type: function
theory: tensor_product
library: matrices
signature: [[PosFullMatrix, PosFullMatrix] -> [[nat, nat] -> real]]
location: 32 0 38 18
body:
  tensor_fun(A,B): [[nat,nat]->real] =
                   LAMBDA(i,j:nat): IF i<rows(A)*rows(B) THEN
                                      IF j<columns(A)*columns(B) THEN
                                         entry(A)((i-mod(i, rows(B)))/rows(B), (j-mod(j, columns(B)))/columns(B))*
                                         entry(B)(mod(i, rows(B)), mod(j, columns(B))) 
                                      ELSE 0 ENDIF
                                    ELSE 0 ENDIF


decl_type: function
theory: tensor_product
library: matrices
signature: [[PosFullMatrix, PosFullMatrix] -> PosFullMatrix]
location: 40 0 40 102
body:
  tensor_prod(A,B): PosFullMatrix = form_matrix(tensor_fun(A,B), rows(A)*rows(B), columns(A)*columns(B))


decl_type: function
theory: tensor_product
library: matrices
signature: [[PosFullMatrix, posnat] -> PosFullMatrix]
location: 67 0 68 35
body:
  tensor_power(A:PosFullMatrix,  n:posnat): RECURSIVE PosFullMatrix = IF n=1 THEN A ELSE tensor_prod(A, tensor_power(A, n-1)) ENDIF
                            MEASURE n  


decl_type: function
theory: tensor_product
library: matrices
signature: [[PosFullMatrix, posnat] -> PosFullMatrix]
location: 90 0 91 35
body:
  tensor_power_alt(A:PosFullMatrix, n:posnat):  RECURSIVE PosFullMatrix = IF n=1 THEN A ELSE tensor_prod(tensor_power_alt(A, n-1), A) ENDIF
                            MEASURE n 


decl_type: function
theory: tensor_product
library: matrices
location: 143 0 146 16
signature:
  [[M: PosFullMatrix, n: posnat,
         {LL: list[below(rows(M))] | length(LL) = n}] ->
          PosFullMatrix]

body:
  RowTensor(M:PosFullMatrix, n: posnat, L:{ LL: list[below(rows(M))] | length(LL)=n}): RECURSIVE PosFullMatrix = 
                IF n=1 THEN RowToMat(M, car(L)) 
                ELSE tensor_prod( RowTensor(M, n-1, cdr(L)), RowToMat(M,car(L))) ENDIF
                MEASURE n


decl_type: function
theory: tensor_product
library: matrices
signature:
  [[M: PosFullMatrix, posnat, [nat -> below(rows(M))]] ->
  PosFullMatrix]

location: 148 0 152 16
body:
  RowTensorAlt(M:PosFullMatrix, n:posnat, f:[nat->below(rows(M))]): RECURSIVE PosFullMatrix = 
                IF n=1 THEN row2mat(M, f(0))
                ELSE tensor_prod(RowTensorAlt(M, n-1, LAMBDA(j:nat):f(j+1)), row2mat(M, f(0)))
                ENDIF 
                MEASURE n  


decl_type: function
theory: tensor_product
library: matrices
location: 164 0 166 37
signature:
  [[posnat, rdim: posnat, cdim: posnat,
         {AA: PosFullMatrix | rows(AA) = rdim AND columns(AA) = cdim},
         [nat -> nat], [nat -> nat]] ->
          [nat -> real]]

body:
  entry_pick(n, rdim, cdim:posnat, A:{AA:PosFullMatrix |rows(AA)=rdim AND columns(AA)=cdim},  
                R, C: [nat->nat])(i:nat):
            real = entry(A)(R(i), C(i))  


decl_type: constant
theory: tensor_product
library: matrices
signature: Square
location: 107 0 112 36
body:
  TQXL:    Square = (: (: 1,   1,   1, 0, 0, 0 :), 
                       (: 0,   1,  -1, 0, 0, 0 :), 
                       (: 0,   1,   1, 0, 0, 0 :), 
                       (: 0,  -1,  -1, 1, 0, 0 :), 
                       (:-1,  -1,   0, 0, 1, 0 :), 
                       (:-1,   0,  -1, 0, 0, 1 :) :)


decl_type: constant
theory: tensor_product
library: matrices
signature: Square
location: 114 0 119 36
body:
  TQXLinv: Square = (: (: 1,   0,  -1, 0, 0, 0 :), 
                       (: 0, 1/2, 1/2, 0, 0, 0 :), 
                       (: 0,-1/2, 1/2, 0, 0, 0 :), 
                       (: 0,   0,   1, 1, 0, 0 :), 
                       (: 1, 1/2,-1/2, 0, 1, 0 :), 
                       (: 1,-1/2,-1/2, 0, 0, 1 :) :)


decl_type: tcc
theory: tensor_product
library: matrices
signature: nil
location: 187 0 192 999
body:
  % Subtype TCC generated (at line 36, column 30) for  rows(B)
      % expected type  nonzero_integer
  tensor_fun_TCC1: OBLIGATION
    FORALL (A: PosFullMatrix, B: PosFullMatrix, i, j: nat):
      j < columns(A) * columns(B) AND i < rows(A) * rows(B) IMPLIES
       rows(B) /= 0;


decl_type: tcc
theory: tensor_product
library: matrices
signature: nil
location: 194 0 201 999
body:
  % Subtype TCC generated (at line 36, column 20) for
      % (i - mod(i, rows(B))) / rows(B)
      % expected type  nat
  tensor_fun_TCC2: OBLIGATION
    FORALL (A: PosFullMatrix, B: PosFullMatrix, i, j: nat):
      j < columns(A) * columns(B) AND i < rows(A) * rows(B) IMPLIES
       integer_pred((i - mod(i, rows(B))) / rows(B)) AND
        (i - mod(i, rows(B))) / rows(B) >= 0;


decl_type: tcc
theory: tensor_product
library: matrices
signature: nil
location: 203 0 208 999
body:
  % Subtype TCC generated (at line 36, column 59) for  columns(B)
      % expected type  nonzero_integer
  tensor_fun_TCC3: OBLIGATION
    FORALL (A: PosFullMatrix, B: PosFullMatrix, i, j: nat):
      j < columns(A) * columns(B) AND i < rows(A) * rows(B) IMPLIES
       columns(B) /= 0;


decl_type: tcc
theory: tensor_product
library: matrices
signature: nil
location: 210 0 217 999
body:
  % Subtype TCC generated (at line 36, column 49) for
      % (j - mod(j, columns(B))) / columns(B)
      % expected type  nat
  tensor_fun_TCC4: OBLIGATION
    FORALL (A: PosFullMatrix, B: PosFullMatrix, i, j: nat):
      j < columns(A) * columns(B) AND i < rows(A) * rows(B) IMPLIES
       integer_pred((j - mod(j, columns(B))) / columns(B)) AND
        (j - mod(j, columns(B))) / columns(B) >= 0;


decl_type: tcc
theory: tensor_product
library: matrices
signature: nil
location: 219 0 224 999
body:
  % Subtype TCC generated (at line 37, column 20) for  mod(i, rows(B))
      % expected type  nat
  tensor_fun_TCC5: OBLIGATION
    FORALL (A: PosFullMatrix, B: PosFullMatrix, i, j: nat):
      j < columns(A) * columns(B) AND i < rows(A) * rows(B) IMPLIES
       mod(i, rows(B)) >= 0;


decl_type: tcc
theory: tensor_product
library: matrices
signature: nil
location: 226 0 231 999
body:
  % Subtype TCC generated (at line 37, column 37) for  mod(j, columns(B))
      % expected type  nat
  tensor_fun_TCC6: OBLIGATION
    FORALL (A: PosFullMatrix, B: PosFullMatrix, i, j: nat):
      j < columns(A) * columns(B) AND i < rows(A) * rows(B) IMPLIES
       mod(j, columns(B)) >= 0;


decl_type: tcc
theory: tensor_product
library: matrices
signature: nil
location: 233 0 245 999
body:
  % Subtype TCC generated (at line 41, column 34) for
      % form_matrix(tensor_fun(A, B), rows(A) * rows(B),
      %             columns(A) * columns(B))
      % expected type  PosFullMatrix
  tensor_prod_TCC1: OBLIGATION
    FORALL (A: PosFullMatrix, B: PosFullMatrix):
      rows(form_matrix(tensor_fun(A, B), rows(A) * rows(B),
                       columns(A) * columns(B)))
       > 0
       AND
       columns(form_matrix(tensor_fun(A, B), rows(A) * rows(B),
                           columns(A) * columns(B)))
        > 0;


decl_type: tcc
theory: tensor_product
library: matrices
signature: nil
location: 247 0 251 999
body:
  % Subtype TCC generated (at line 51, column 43) for  rows(B)
      % expected type  nonzero_integer
  tensor_mult_entry_TCC1: OBLIGATION
    FORALL (A, A2, B, B2: PosFullMatrix):
      columns(B) = rows(B2) AND columns(A) = rows(A2) IMPLIES rows(B) /= 0;


decl_type: tcc
theory: tensor_product
library: matrices
signature: nil
location: 253 0 260 999
body:
  % Subtype TCC generated (at line 51, column 31) for
      % (m1 - mod(m1, rows(B))) / rows(B)
      % expected type  nat
  tensor_mult_entry_TCC2: OBLIGATION
    FORALL (A, A2, B, B2: PosFullMatrix, m1: nat):
      columns(B) = rows(B2) AND columns(A) = rows(A2) IMPLIES
       integer_pred((m1 - mod(m1, rows(B))) / rows(B)) AND
        (m1 - mod(m1, rows(B))) / rows(B) >= 0;


decl_type: tcc
theory: tensor_product
library: matrices
signature: nil
location: 262 0 267 999
body:
  % Subtype TCC generated (at line 51, column 74) for  columns(B2)
      % expected type  nonzero_integer
  tensor_mult_entry_TCC3: OBLIGATION
    FORALL (A, A2, B, B2: PosFullMatrix):
      columns(B) = rows(B2) AND columns(A) = rows(A2) IMPLIES
       columns(B2) /= 0;


decl_type: tcc
theory: tensor_product
library: matrices
signature: nil
location: 269 0 276 999
body:
  % Subtype TCC generated (at line 51, column 62) for
      % (n1 - mod(n1, columns(B2))) / columns(B2)
      % expected type  nat
  tensor_mult_entry_TCC4: OBLIGATION
    FORALL (A, A2, B, B2: PosFullMatrix, n1: nat):
      columns(B) = rows(B2) AND columns(A) = rows(A2) IMPLIES
       integer_pred((n1 - mod(n1, columns(B2))) / columns(B2)) AND
        (n1 - mod(n1, columns(B2))) / columns(B2) >= 0;


decl_type: tcc
theory: tensor_product
library: matrices
signature: nil
location: 278 0 283 999
body:
  % Subtype TCC generated (at line 52, column 17) for  mod(m1, rows(B))
      % expected type  nat
  tensor_mult_entry_TCC5: OBLIGATION
    FORALL (A, A2, B, B2: PosFullMatrix, m1: nat):
      columns(B) = rows(B2) AND columns(A) = rows(A2) IMPLIES
       mod(m1, rows(B)) >= 0;


decl_type: tcc
theory: tensor_product
library: matrices
signature: nil
location: 285 0 290 999
body:
  % Subtype TCC generated (at line 52, column 35) for  mod(n1, columns(B2))
      % expected type  nat
  tensor_mult_entry_TCC6: OBLIGATION
    FORALL (A, A2, B, B2: PosFullMatrix, n1: nat):
      columns(B) = rows(B2) AND columns(A) = rows(A2) IMPLIES
       mod(n1, columns(B2)) >= 0;


decl_type: tcc
theory: tensor_product
library: matrices
signature: nil
location: 292 0 297 999
body:
  % Subtype TCC generated (at line 56, column 31) for  tensor_prod(AA, BB)
      % expected type  Square
  invertible_tensor_TCC1: OBLIGATION
    FORALL (AA, BB: Square):
      invertible?(BB) AND invertible?(AA) IMPLIES
       rows(tensor_prod(AA, BB)) = columns(tensor_prod(AA, BB));


decl_type: tcc
theory: tensor_product
library: matrices
signature: nil
location: 299 0 307 999
body:
  % Subtype TCC generated (at line 57, column 27) for  tensor_prod(AA, BB)
      % expected type  SQ: {SQ | det(SQ) /= 0 OR invertible?(SQ)}
  invertible_tensor_TCC2: OBLIGATION
    FORALL (AA, BB: Square):
      invertible?(BB) AND
       invertible?(AA) AND invertible?(tensor_prod(AA, BB))
       IMPLIES
       rows(tensor_prod(AA, BB)) = columns(tensor_prod(AA, BB)) AND
        (det(tensor_prod(AA, BB)) /= 0 OR invertible?(tensor_prod(AA, BB)));


decl_type: tcc
theory: tensor_product
library: matrices
signature: nil
location: 309 0 315 999
body:
  % Subtype TCC generated (at line 57, column 69) for  AA
      % expected type  SQ: {SQ | det(SQ) /= 0 OR invertible?(SQ)}
  invertible_tensor_TCC3: OBLIGATION
    FORALL (AA, BB: Square):
      invertible?(BB) AND
       invertible?(AA) AND invertible?(tensor_prod(AA, BB))
       IMPLIES det(AA) /= 0 OR invertible?(AA);


decl_type: tcc
theory: tensor_product
library: matrices
signature: nil
location: 317 0 323 999
body:
  % Subtype TCC generated (at line 57, column 82) for  BB
      % expected type  SQ: {SQ | det(SQ) /= 0 OR invertible?(SQ)}
  invertible_tensor_TCC4: OBLIGATION
    FORALL (AA, BB: Square):
      invertible?(BB) AND
       invertible?(AA) AND invertible?(tensor_prod(AA, BB))
       IMPLIES det(BB) /= 0 OR invertible?(BB);


decl_type: tcc
theory: tensor_product
library: matrices
signature: nil
location: 325 0 330 999
body:
  % Subtype TCC generated (at line 60, column 18) for  (: 1, 1, 1 :)
      % expected type  list[real]
  TQMat_TCC1: OBLIGATION
    every[number]
        (LAMBDA (x: number): number_field_pred(x) AND real_pred(x))
        ((: 1, 1, 1 :));


decl_type: tcc
theory: tensor_product
library: matrices
signature: nil
location: 332 0 340 999
body:
  % Subtype TCC generated (at line 60, column 29) for
      % (: (: 0, 1, -1 :), (: 0, 1, 1 :) :)
      % expected type  list[list[real]]
  TQMat_TCC2: OBLIGATION
    every[list[number]]
        (LAMBDA (x: list[number]):
           every[number]
               (LAMBDA (x: number): number_field_pred(x) AND real_pred(x))(x))
        ((: (: 0, 1, -1 :), (: 0, 1, 1 :) :));


decl_type: tcc
theory: tensor_product
library: matrices
signature: nil
location: 342 0 364 999
body:
  % Subtype TCC generated (at line 60, column 16) for
      % (: (: 1, 1, 1 :), (: 0, 1, -1 :), (: 0, 1, 1 :) :)
      % expected type  Square
  TQMat_TCC3: OBLIGATION
    (null?[list[real]]((: (: 1, 1, 1 :), (: 0, 1, -1 :), (: 0, 1, 1 :) :)) OR
      (FORALL (i,
               j:
                 below(length[list[real]]
                           ((: (: 1, 1, 1 :), (: 0, 1, -1 :),
                               (: 0, 1, 1 :) :)))):
         length[real]
             (nth[list[real]]
                  ((: (: 1, 1, 1 :), (: 0, 1, -1 :), (: 0, 1, 1 :) :), i))
          =
          length[real]
              (nth[list[real]]
                   ((: (: 1, 1, 1 :), (: 0, 1, -1 :), (: 0, 1, 1 :) :), j))))
     AND
     (rows((: (: 1, 1, 1 :), (: 0, 1, -1 :), (: 0, 1, 1 :) :)) > 0 AND
       columns((: (: 1, 1, 1 :), (: 0, 1, -1 :), (: 0, 1, 1 :) :)) > 0)
      AND
      rows((: (: 1, 1, 1 :), (: 0, 1, -1 :), (: 0, 1, 1 :) :)) =
       columns((: (: 1, 1, 1 :), (: 0, 1, -1 :), (: 0, 1, 1 :) :));


decl_type: tcc
theory: tensor_product
library: matrices
signature: nil
location: 366 0 371 999
body:
  % Subtype TCC generated (at line 62, column 21) for  (: 1, 0, -1 :)
      % expected type  list[real]
  TQMatInv_TCC1: OBLIGATION
    every[number]
        (LAMBDA (x: number): number_field_pred(x) AND real_pred(x))
        ((: 1, 0, -1 :));


decl_type: tcc
theory: tensor_product
library: matrices
signature: nil
location: 373 0 381 999
body:
  % Subtype TCC generated (at line 62, column 33) for
      % (: (: 0, 1 / 2, 1 / 2 :), (: 0, -1 / 2, 1 / 2 :) :)
      % expected type  list[list[real]]
  TQMatInv_TCC2: OBLIGATION
    every[list[number]]
        (LAMBDA (x: list[number]):
           every[number]
               (LAMBDA (x: number): number_field_pred(x) AND real_pred(x))(x))
        ((: (: 0, 1 / 2, 1 / 2 :), (: 0, -1 / 2, 1 / 2 :) :));


decl_type: tcc
theory: tensor_product
library: matrices
signature: nil
location: 383 0 420 999
body:
  % Subtype TCC generated (at line 62, column 19) for
      % (: (: 1, 0, -1 :), (: 0, 1 / 2, 1 / 2 :), (: 0, -1 / 2, 1 / 2 :) :)
      % expected type  Square
  TQMatInv_TCC3: OBLIGATION
    (null?[list[real]]
         ((: (: 1, 0, -1 :), (: 0, 1 / 2, 1 / 2 :),
             (: 0, -1 / 2, 1 / 2 :) :))
      OR
      (FORALL (i,
               j:
                 below(length[list[real]]
                           ((: (: 1, 0, -1 :), (: 0, 1 / 2, 1 / 2 :),
                               (: 0, -1 / 2, 1 / 2 :) :)))):
         length[real]
             (nth[list[real]]
                  ((: (: 1, 0, -1 :), (: 0, 1 / 2, 1 / 2 :),
                      (: 0, -1 / 2, 1 / 2 :) :),
                   i))
          =
          length[real]
              (nth[list[real]]
                   ((: (: 1, 0, -1 :), (: 0, 1 / 2, 1 / 2 :),
                       (: 0, -1 / 2, 1 / 2 :) :),
                    j))))
     AND
     (rows((: (: 1, 0, -1 :), (: 0, 1 / 2, 1 / 2 :),
              (: 0, -1 / 2, 1 / 2 :) :))
       > 0
       AND
       columns((: (: 1, 0, -1 :), (: 0, 1 / 2, 1 / 2 :),
                  (: 0, -1 / 2, 1 / 2 :) :))
        > 0)
      AND
      rows((: (: 1, 0, -1 :), (: 0, 1 / 2, 1 / 2 :),
              (: 0, -1 / 2, 1 / 2 :) :))
       =
       columns((: (: 1, 0, -1 :), (: 0, 1 / 2, 1 / 2 :),
                  (: 0, -1 / 2, 1 / 2 :) :));


decl_type: tcc
theory: tensor_product
library: matrices
signature: nil
location: 422 0 424 999
body:
  % Subtype TCC generated (at line 66, column 24) for  TQMat
      % expected type  SQ: {SQ | det(SQ) /= 0 OR invertible?(SQ)}
  is_invTQ_TCC1: OBLIGATION det(TQMat) /= 0 OR invertible?(TQMat);


decl_type: tcc
theory: tensor_product
library: matrices
signature: nil
location: 426 0 429 999
body:
  % Subtype TCC generated (at line 68, column 118) for  n - 1
      % expected type  posnat
  tensor_power_TCC1: OBLIGATION
    FORALL (n: posnat): NOT n = 1 IMPLIES n - 1 >= 0 AND n - 1 > 0;


decl_type: tcc
theory: tensor_product
library: matrices
signature: nil
location: 431 0 434 999
body:
  % Termination TCC generated (at line 68, column 102) for
      % tensor_power(A, n - 1)
  tensor_power_TCC2: OBLIGATION
    FORALL (n: posnat): NOT n = 1 IMPLIES n - 1 < n;


decl_type: tcc
theory: tensor_product
library: matrices
signature: nil
location: 436 0 441 999
body:
  % Subtype TCC generated (at line 71, column 95) for  tensor_power(A, n)
      % expected type  Square
  invertible_tensor_power_TCC1: OBLIGATION
    FORALL (A: Square, n: posnat):
      invertible?(A) IMPLIES
       rows(tensor_power(A, n)) = columns(tensor_power(A, n));


decl_type: tcc
theory: tensor_product
library: matrices
signature: nil
location: 443 0 449 999
body:
  % Subtype TCC generated (at line 72, column 33) for  tensor_power(A, n)
      % expected type  SQ: {SQ | det(SQ) /= 0 OR invertible?(SQ)}
  invertible_tensor_power_TCC2: OBLIGATION
    FORALL (A: Square, n: posnat):
      invertible?(tensor_power(A, n)) AND invertible?(A) IMPLIES
       rows(tensor_power(A, n)) = columns(tensor_power(A, n)) AND
        (det(tensor_power(A, n)) /= 0 OR invertible?(tensor_power(A, n)));


decl_type: tcc
theory: tensor_product
library: matrices
signature: nil
location: 451 0 456 999
body:
  % Subtype TCC generated (at line 72, column 75) for  A
      % expected type  SQ: {SQ | det(SQ) /= 0 OR invertible?(SQ)}
  invertible_tensor_power_TCC3: OBLIGATION
    FORALL (A: Square, n: posnat):
      invertible?(tensor_power(A, n)) AND invertible?(A) IMPLIES
       det(A) /= 0 OR invertible?(A);


decl_type: tcc
theory: tensor_product
library: matrices
signature: nil
location: 458 0 461 999
body:
  % Subtype TCC generated (at line 75, column 27) for  n
      % expected type  {i: int | rows(A) /= 0 OR i >= 0}
  tensor_power_rows_TCC1: OBLIGATION
    FORALL (A: PosFullMatrix, n: posnat): rows(A) /= 0 OR n >= 0;


decl_type: tcc
theory: tensor_product
library: matrices
signature: nil
location: 463 0 466 999
body:
  % Subtype TCC generated (at line 78, column 18) for  n
      % expected type  {i: int | columns(A) /= 0 OR i >= 0}
  tensor_power_columns_TCC1: OBLIGATION
    FORALL (A: PosFullMatrix, n: posnat): columns(A) /= 0 OR n >= 0;


decl_type: tcc
theory: tensor_product
library: matrices
signature: nil
location: 468 0 471 999
body:
  % Subtype TCC generated (at line 84, column 19) for  (i - mod(i, n)) / n
      % expected type  int
  mod_eq_lem_alt_TCC1: OBLIGATION
    FORALL (n: posnat, i: nat): integer_pred((i - mod(i, n)) / n);


decl_type: tcc
theory: tensor_product
library: matrices
signature: nil
location: 473 0 478 999
body:
  % Subtype TCC generated (at line 108, column 21) for  (: 1, 1, 1, 0, 0, 0 :)
      % expected type  list[real]
  TQXL_TCC1: OBLIGATION
    every[number]
        (LAMBDA (x: number): number_field_pred(x) AND real_pred(x))
        ((: 1, 1, 1, 0, 0, 0 :));


decl_type: tcc
theory: tensor_product
library: matrices
signature: nil
location: 480 0 492 999
body:
  % Subtype TCC generated (at line 109, column 20) for
      % (: (: 0, 1, -1, 0, 0, 0 :), (: 0, 1, 1, 0, 0, 0 :),
      %    (: 0, -1, -1, 1, 0, 0 :), (: -1, -1, 0, 0, 1, 0 :),
      %    (: -1, 0, -1, 0, 0, 1 :) :)
      % expected type  list[list[real]]
  TQXL_TCC2: OBLIGATION
    every[list[number]]
        (LAMBDA (x: list[number]):
           every[number]
               (LAMBDA (x: number): number_field_pred(x) AND real_pred(x))(x))
        ((: (: 0, 1, -1, 0, 0, 0 :), (: 0, 1, 1, 0, 0, 0 :),
            (: 0, -1, -1, 1, 0, 0 :), (: -1, -1, 0, 0, 1, 0 :),
            (: -1, 0, -1, 0, 0, 1 :) :));


decl_type: tcc
theory: tensor_product
library: matrices
signature: nil
location: 494 0 544 999
body:
  % Subtype TCC generated (at line 108, column 18) for
      % (: (: 1, 1, 1, 0, 0, 0 :), (: 0, 1, -1, 0, 0, 0 :),
      %    (: 0, 1, 1, 0, 0, 0 :), (: 0, -1, -1, 1, 0, 0 :),
      %    (: -1, -1, 0, 0, 1, 0 :), (: -1, 0, -1, 0, 0, 1 :) :)
      % expected type  Square
  TQXL_TCC3: OBLIGATION
    (null?[list[real]]
         ((: (: 1, 1, 1, 0, 0, 0 :), (: 0, 1, -1, 0, 0, 0 :),
             (: 0, 1, 1, 0, 0, 0 :), (: 0, -1, -1, 1, 0, 0 :),
             (: -1, -1, 0, 0, 1, 0 :), (: -1, 0, -1, 0, 0, 1 :) :))
      OR
      (FORALL (i,
               j:
                 below(length[list[real]]
                           ((: (: 1, 1, 1, 0, 0, 0 :),
                               (: 0, 1, -1, 0, 0, 0 :),
                               (: 0, 1, 1, 0, 0, 0 :),
                               (: 0, -1, -1, 1, 0, 0 :),
                               (: -1, -1, 0, 0, 1, 0 :),
                               (: -1, 0, -1, 0, 0, 1 :) :)))):
         length[real]
             (nth[list[real]]
                  ((: (: 1, 1, 1, 0, 0, 0 :), (: 0, 1, -1, 0, 0, 0 :),
                      (: 0, 1, 1, 0, 0, 0 :), (: 0, -1, -1, 1, 0, 0 :),
                      (: -1, -1, 0, 0, 1, 0 :), (: -1, 0, -1, 0, 0, 1 :) :),
                   i))
          =
          length[real]
              (nth[list[real]]
                   ((: (: 1, 1, 1, 0, 0, 0 :), (: 0, 1, -1, 0, 0, 0 :),
                       (: 0, 1, 1, 0, 0, 0 :), (: 0, -1, -1, 1, 0, 0 :),
                       (: -1, -1, 0, 0, 1, 0 :), (: -1, 0, -1, 0, 0, 1 :) :),
                    j))))
     AND
     (rows((: (: 1, 1, 1, 0, 0, 0 :), (: 0, 1, -1, 0, 0, 0 :),
              (: 0, 1, 1, 0, 0, 0 :), (: 0, -1, -1, 1, 0, 0 :),
              (: -1, -1, 0, 0, 1, 0 :), (: -1, 0, -1, 0, 0, 1 :) :))
       > 0
       AND
       columns((: (: 1, 1, 1, 0, 0, 0 :), (: 0, 1, -1, 0, 0, 0 :),
                  (: 0, 1, 1, 0, 0, 0 :), (: 0, -1, -1, 1, 0, 0 :),
                  (: -1, -1, 0, 0, 1, 0 :), (: -1, 0, -1, 0, 0, 1 :) :))
        > 0)
      AND
      rows((: (: 1, 1, 1, 0, 0, 0 :), (: 0, 1, -1, 0, 0, 0 :),
              (: 0, 1, 1, 0, 0, 0 :), (: 0, -1, -1, 1, 0, 0 :),
              (: -1, -1, 0, 0, 1, 0 :), (: -1, 0, -1, 0, 0, 1 :) :))
       =
       columns((: (: 1, 1, 1, 0, 0, 0 :), (: 0, 1, -1, 0, 0, 0 :),
                  (: 0, 1, 1, 0, 0, 0 :), (: 0, -1, -1, 1, 0, 0 :),
                  (: -1, -1, 0, 0, 1, 0 :), (: -1, 0, -1, 0, 0, 1 :) :));


decl_type: tcc
theory: tensor_product
library: matrices
signature: nil
location: 546 0 552 999
body:
  % Subtype TCC generated (at line 115, column 21) for
      % (: 1, 0, -1, 0, 0, 0 :)
      % expected type  list[real]
  TQXLinv_TCC1: OBLIGATION
    every[number]
        (LAMBDA (x: number): number_field_pred(x) AND real_pred(x))
        ((: 1, 0, -1, 0, 0, 0 :));


decl_type: tcc
theory: tensor_product
library: matrices
signature: nil
location: 554 0 566 999
body:
  % Subtype TCC generated (at line 116, column 20) for
      % (: (: 0, 1 / 2, 1 / 2, 0, 0, 0 :), (: 0, -1 / 2, 1 / 2, 0, 0, 0 :),
      %    (: 0, 0, 1, 1, 0, 0 :), (: 1, 1 / 2, -1 / 2, 0, 1, 0 :),
      %    (: 1, -1 / 2, -1 / 2, 0, 0, 1 :) :)
      % expected type  list[list[real]]
  TQXLinv_TCC2: OBLIGATION
    every[list[number]]
        (LAMBDA (x: list[number]):
           every[number]
               (LAMBDA (x: number): number_field_pred(x) AND real_pred(x))(x))
        ((: (: 0, 1 / 2, 1 / 2, 0, 0, 0 :), (: 0, -1 / 2, 1 / 2, 0, 0, 0 :),
            (: 0, 0, 1, 1, 0, 0 :), (: 1, 1 / 2, -1 / 2, 0, 1, 0 :),
            (: 1, -1 / 2, -1 / 2, 0, 0, 1 :) :));


decl_type: tcc
theory: tensor_product
library: matrices
signature: nil
location: 568 0 630 999
body:
  % Subtype TCC generated (at line 115, column 18) for
      % (: (: 1, 0, -1, 0, 0, 0 :), (: 0, 1 / 2, 1 / 2, 0, 0, 0 :),
      %    (: 0, -1 / 2, 1 / 2, 0, 0, 0 :), (: 0, 0, 1, 1, 0, 0 :),
      %    (: 1, 1 / 2, -1 / 2, 0, 1, 0 :),
      %    (: 1, -1 / 2, -1 / 2, 0, 0, 1 :) :)
      % expected type  Square
  TQXLinv_TCC3: OBLIGATION
    (null?[list[real]]
         ((: (: 1, 0, -1, 0, 0, 0 :), (: 0, 1 / 2, 1 / 2, 0, 0, 0 :),
             (: 0, -1 / 2, 1 / 2, 0, 0, 0 :), (: 0, 0, 1, 1, 0, 0 :),
             (: 1, 1 / 2, -1 / 2, 0, 1, 0 :),
             (: 1, -1 / 2, -1 / 2, 0, 0, 1 :) :))
      OR
      (FORALL (i,
               j:
                 below(length[list[real]]
                           ((: (: 1, 0, -1, 0, 0, 0 :),
                               (: 0, 1 / 2, 1 / 2, 0, 0, 0 :),
                               (: 0, -1 / 2, 1 / 2, 0, 0, 0 :),
                               (: 0, 0, 1, 1, 0, 0 :),
                               (: 1, 1 / 2, -1 / 2, 0, 1, 0 :),
                               (: 1, -1 / 2, -1 / 2, 0, 0, 1 :) :)))):
         length[real]
             (nth[list[real]]
                  ((: (: 1, 0, -1, 0, 0, 0 :),
                      (: 0, 1 / 2, 1 / 2, 0, 0, 0 :),
                      (: 0, -1 / 2, 1 / 2, 0, 0, 0 :),
                      (: 0, 0, 1, 1, 0, 0 :),
                      (: 1, 1 / 2, -1 / 2, 0, 1, 0 :),
                      (: 1, -1 / 2, -1 / 2, 0, 0, 1 :) :),
                   i))
          =
          length[real]
              (nth[list[real]]
                   ((: (: 1, 0, -1, 0, 0, 0 :),
                       (: 0, 1 / 2, 1 / 2, 0, 0, 0 :),
                       (: 0, -1 / 2, 1 / 2, 0, 0, 0 :),
                       (: 0, 0, 1, 1, 0, 0 :),
                       (: 1, 1 / 2, -1 / 2, 0, 1, 0 :),
                       (: 1, -1 / 2, -1 / 2, 0, 0, 1 :) :),
                    j))))
     AND
     (rows((: (: 1, 0, -1, 0, 0, 0 :), (: 0, 1 / 2, 1 / 2, 0, 0, 0 :),
              (: 0, -1 / 2, 1 / 2, 0, 0, 0 :), (: 0, 0, 1, 1, 0, 0 :),
              (: 1, 1 / 2, -1 / 2, 0, 1, 0 :),
              (: 1, -1 / 2, -1 / 2, 0, 0, 1 :) :))
       > 0
       AND
       columns((: (: 1, 0, -1, 0, 0, 0 :), (: 0, 1 / 2, 1 / 2, 0, 0, 0 :),
                  (: 0, -1 / 2, 1 / 2, 0, 0, 0 :), (: 0, 0, 1, 1, 0, 0 :),
                  (: 1, 1 / 2, -1 / 2, 0, 1, 0 :),
                  (: 1, -1 / 2, -1 / 2, 0, 0, 1 :) :))
        > 0)
      AND
      rows((: (: 1, 0, -1, 0, 0, 0 :), (: 0, 1 / 2, 1 / 2, 0, 0, 0 :),
              (: 0, -1 / 2, 1 / 2, 0, 0, 0 :), (: 0, 0, 1, 1, 0, 0 :),
              (: 1, 1 / 2, -1 / 2, 0, 1, 0 :),
              (: 1, -1 / 2, -1 / 2, 0, 0, 1 :) :))
       =
       columns((: (: 1, 0, -1, 0, 0, 0 :), (: 0, 1 / 2, 1 / 2, 0, 0, 0 :),
                  (: 0, -1 / 2, 1 / 2, 0, 0, 0 :), (: 0, 0, 1, 1, 0, 0 :),
                  (: 1, 1 / 2, -1 / 2, 0, 1, 0 :),
                  (: 1, -1 / 2, -1 / 2, 0, 0, 1 :) :));


decl_type: tcc
theory: tensor_product
library: matrices
signature: nil
location: 632 0 634 999
body:
  % Subtype TCC generated (at line 124, column 26) for  TQXL
      % expected type  SQ: {SQ | det(SQ) /= 0 OR invertible?(SQ)}
  is_invTQXL_TCC1: OBLIGATION det(TQXL) /= 0 OR invertible?(TQXL);


decl_type: tcc
theory: tensor_product
library: matrices
signature: nil
location: 636 0 639 999
body:
  % Subtype TCC generated (at line 124, column 54) for  TQXLinv
      % expected type  SQ: {SQ | det(SQ) /= 0 OR invertible?(SQ)}
  is_invTQXL_TCC2: OBLIGATION
    inverse(TQXL) = TQXLinv IMPLIES det(TQXLinv) /= 0 OR invertible?(TQXLinv);


decl_type: tcc
theory: tensor_product
library: matrices
signature: nil
location: 641 0 649 999
body:
  % Subtype TCC generated (at line 126, column 61) for  (: row(M)(k) :)
      % expected type  PosFullMatrix
  RowToMat_TCC1: OBLIGATION
    FORALL (M: PosFullMatrix, k: below(rows(M))):
      (null?[list[real]]((: row(M)(k) :)) OR
        (FORALL (i, j: below(length[list[real]]((: row(M)(k) :)))):
           length[real](nth[list[real]]((: row(M)(k) :), i)) =
            length[real](nth[list[real]]((: row(M)(k) :), j))))
       AND rows((: row(M)(k) :)) > 0 AND columns((: row(M)(k) :)) > 0;


decl_type: tcc
theory: tensor_product
library: matrices
signature: nil
location: 651 0 655 999
body:
  % Subtype TCC generated (at line 141, column 37) for  k
      % expected type  below(rows(tensor_prod(M, N)))
  RowToMat_tensor_prod_TCC1: OBLIGATION
    FORALL (M, N: PosFullMatrix, k: below(rows(M) * rows(N))):
      k < rows(tensor_prod(M, N));


decl_type: tcc
theory: tensor_product
library: matrices
signature: nil
location: 657 0 660 999
body:
  % Subtype TCC generated (at line 142, column 35) for  rows(N)
      % expected type  nonzero_integer
  RowToMat_tensor_prod_TCC2: OBLIGATION
    FORALL (M, N: PosFullMatrix, k: below(rows(M) * rows(N))): rows(N) /= 0;


decl_type: tcc
theory: tensor_product
library: matrices
signature: nil
location: 662 0 669 999
body:
  % Subtype TCC generated (at line 142, column 26) for
      % (k - mod(k, rows(N))) / rows(N)
      % expected type  below(rows(M))
  RowToMat_tensor_prod_TCC3: OBLIGATION
    FORALL (M, N: PosFullMatrix, k: below(rows(M) * rows(N))):
      integer_pred((k - mod(k, rows(N))) / rows(N)) AND
       (k - mod(k, rows(N))) / rows(N) >= 0 AND
        (k - mod(k, rows(N))) / rows(N) < rows(M);


decl_type: tcc
theory: tensor_product
library: matrices
signature: nil
location: 671 0 675 999
body:
  % Subtype TCC generated (at line 142, column 67) for  mod(k, rows(N))
      % expected type  below(rows(N))
  RowToMat_tensor_prod_TCC4: OBLIGATION
    FORALL (M, N: PosFullMatrix, k: below(rows(M) * rows(N))):
      mod(k, rows(N)) >= 0 AND mod(k, rows(N)) < rows(N);


decl_type: tcc
theory: tensor_product
library: matrices
signature: nil
location: 677 0 682 999
body:
  % Subtype TCC generated (at line 145, column 35) for  L
      % expected type  (cons?[below(rows(M))])
  RowTensor_TCC1: OBLIGATION
    FORALL (M: PosFullMatrix, n: posnat,
            L: {LL: list[below(rows(M))] | length[below(rows(M))](LL) = n}):
      n = 1 IMPLIES cons?[below(rows(M))](L);


decl_type: tcc
theory: tensor_product
library: matrices
signature: nil
location: 684 0 689 999
body:
  % Subtype TCC generated (at line 146, column 47) for  L
      % expected type  (cons?[below(rows(M))])
  RowTensor_TCC2: OBLIGATION
    FORALL (M: PosFullMatrix, n: posnat,
            L: {LL: list[below(rows(M))] | length[below(rows(M))](LL) = n}):
      NOT n = 1 IMPLIES cons?[below(rows(M))](L);


decl_type: tcc
theory: tensor_product
library: matrices
signature: nil
location: 691 0 697 999
body:
  % Subtype TCC generated (at line 146, column 43) for  cdr(L)
      % expected type  {LL: list[below(rows(M))] | length(LL) = n - 1}
  RowTensor_TCC3: OBLIGATION
    FORALL (M: PosFullMatrix, n: posnat,
            L: {LL: list[below(rows(M))] | length[below(rows(M))](LL) = n}):
      NOT n = 1 IMPLIES
       length[below(rows(M))](cdr[below(rows(M))](L)) = n - 1;


decl_type: tcc
theory: tensor_product
library: matrices
signature: nil
location: 699 0 704 999
body:
  % Subtype TCC generated (at line 156, column 29) for  rows(M)
      % expected type  {x: nat | x > 1}
  RowTensors_same_TCC1: OBLIGATION
    FORALL (M: {AA: PosFullMatrix | rows(AA) > 1}, n: posnat,
            k: below(rows(M) ^ n)):
      rows(M) > 1;


decl_type: tcc
theory: tensor_product
library: matrices
signature: nil
location: 706 0 711 999
body:
  % Subtype TCC generated (at line 156, column 66) for  base_n(rows(M), k)
      % expected type  [nat -> below(rows(M))]
  RowTensors_same_TCC2: OBLIGATION
    FORALL (M: {AA: PosFullMatrix | rows(AA) > 1}, n: posnat,
            k: below(rows(M) ^ n)):
      FORALL (x1: nat): base_n(rows(M), k)(x1) < rows(M);


decl_type: tcc
theory: tensor_product
library: matrices
signature: nil
location: 713 0 717 999
body:
  % Subtype TCC generated (at line 160, column 39) for  k
      % expected type  below(rows(tensor_power_alt(M, n)))
  RowTensor_is_TensorRow_TCC1: OBLIGATION
    FORALL (M: PosFullMatrix, n: posnat, k: below(rows(M) ^ n)):
      rows(M) > 1 IMPLIES k < rows(tensor_power_alt(M, n));


decl_type: tcc
theory: tensor_product
library: matrices
signature: nil
location: 719 0 724 999
body:
  % Subtype TCC generated (at line 163, column 32) for  k
      % expected type  below(rows(tensor_power(M, n)))
  RowTensor_is_TensorRow2_TCC1: OBLIGATION
    FORALL (M: {AA: PosFullMatrix | rows(AA) > 1}, n: posnat,
            k: below(rows(M) ^ n)):
      k < rows(tensor_power(M, n));


decl_type: tcc
theory: tensor_product
library: matrices
signature: nil
location: 726 0 731 999
body:
  % Subtype TCC generated (at line 170, column 22) for  rows(A)
      % expected type  {x: nat | x > 1}
  tensor_entry_TCC1: OBLIGATION
    FORALL (A: {M: PosFullMatrix | rows(M) > 1 AND columns(M) > 1},
            n: posnat, k: below(rows(A) ^ n), m: below(columns(A) ^ n)):
      rows(A) > 1;


decl_type: tcc
theory: tensor_product
library: matrices
signature: nil
location: 733 0 739 999
body:
  % Subtype TCC generated (at line 171, column 22) for  columns(A)
      % expected type  {x: nat | x > 1}
  tensor_entry_TCC2: OBLIGATION
    FORALL (A: {M: PosFullMatrix | rows(M) > 1 AND columns(M) > 1},
            n: posnat, k: below(rows(A) ^ n), m: below(columns(A) ^ n),
            R: [nat -> nat]):
      R = base_n(rows(A), k) IMPLIES columns(A) > 1;


decl_type: tcc
theory: tensor_product
library: matrices
signature: nil
location: 741 0 750 999
body:
  % Subtype TCC generated (at line 172, column 63) for  n - 1
      % expected type  T_high[nat]
  tensor_entry_TCC3: OBLIGATION
    FORALL (A: {M: PosFullMatrix | rows(M) > 1 AND columns(M) > 1},
            n: posnat, k: below(rows(A) ^ n), m: below(columns(A) ^ n),
            R: [nat -> nat]):
      R = base_n(rows(A), k) IMPLIES
       (FORALL (C: [nat -> nat]):
          C = base_n(columns(A), m) IMPLIES
           n - 1 >= 0 OR (EXISTS (j: nat): n - 1 <= j));


decl_type: tcc
theory: tensor_product
library: matrices
signature: nil
location: 752 0 760 999
body:
  % Subtype TCC generated (at line 172, column 82) for  rows(A)
      % expected type  posnat
  tensor_entry_TCC4: OBLIGATION
    FORALL (A: {M: PosFullMatrix | rows(M) > 1 AND columns(M) > 1},
            n: posnat, k: below(rows(A) ^ n), m: below(columns(A) ^ n),
            R: [nat -> nat]):
      R = base_n(rows(A), k) IMPLIES
       (FORALL (C: [nat -> nat]):
          C = base_n(columns(A), m) IMPLIES rows(A) > 0);


decl_type: tcc
theory: tensor_product
library: matrices
signature: nil
location: 762 0 770 999
body:
  % Subtype TCC generated (at line 172, column 91) for  columns(A)
      % expected type  posnat
  tensor_entry_TCC5: OBLIGATION
    FORALL (A: {M: PosFullMatrix | rows(M) > 1 AND columns(M) > 1},
            n: posnat, k: below(rows(A) ^ n), m: below(columns(A) ^ n),
            R: [nat -> nat]):
      R = base_n(rows(A), k) IMPLIES
       (FORALL (C: [nat -> nat]):
          C = base_n(columns(A), m) IMPLIES columns(A) > 0);


decl_type: tcc
theory: tensor_product
library: matrices
signature: nil
location: 772 0 782 999
body:
  % Assuming TCC generated (at line 24, column 4) for  reals@product[nat]
      % generated from assumption product.connected_domain
  tensor_entry_TCC6: OBLIGATION
    FORALL (A: {M: PosFullMatrix | rows(M) > 1 AND columns(M) > 1},
            n: posnat, k: below(rows(A) ^ n), m: below(columns(A) ^ n),
            R: [nat -> nat]):
      R = base_n(rows(A), k) IMPLIES
       (FORALL (C: [nat -> nat]):
          C = base_n(columns(A), m) IMPLIES
           (FORALL (x, y: nat), (z: integer):
              x <= z AND z <= y IMPLIES z >= 0));


decl_type: formula
theory: query_coeff
library: matrices
signature: nil
location: 37 0 38 87
body:
  switch_is_with: LEMMA FORALL (L:{ll:list[below(3)]|cons?[below(3)](ll)}, n: below(length(L)), new:below(3), (f|array2list[below(3)](length(L))(f) = L)):
           switch_one_entry(L, n, new) = array2list[below(3)](length(L))(f WITH [n:=new])


decl_type: formula
theory: query_coeff
library: matrices
signature: nil
location: 77 0 78 45
body:
  bump_one_below: LEMMA FORALL (j:posnat, (f| FORALL( k:above(j)): f(k)=0),(i:upto(j+1)), (k:nat)):
            k<i IMPLIES bump_one_ind (j,f,i)(k) = f(k)  


decl_type: formula
theory: query_coeff
library: matrices
signature: nil
location: 80 0 84 9
body:
  bump_one_ind_lem: LEMMA  FORALL(j:posnat, (f| FORALL( k:above(j)): f(k)=0), (i:upto(j+1))):
                    base_n_to_nat(3, bump_one_ind(j,f,i), j+1) = 
                    IF f(i)<2 THEN base_n_to_nat(3, f, j+1) + 3^i
                    ELSE base_n_to_nat(3, bump_one_ind(j, f, i+1), j+1) - f(i)*3^i
                    ENDIF


decl_type: formula
theory: query_coeff
library: matrices
signature: nil
location: 86 0 89 87
body:
  bump_one_ind_lem2: LEMMA  FORALL(j:posnat, (f| FORALL( k:above(j)): f(k)=0), (i:upto(j+1))):
                    (FORALL(m:nat): m<=i IMPLIES f(m) =2) IMPLIES  
                    base_n_to_nat(3, bump_one_ind(j,f,0), j+1) = 
                     base_n_to_nat(3, bump_one_ind(j, f, i+1), j+1) - sigma(0,i, LAMBDA (s:nat): 2*3^s)


decl_type: formula
theory: query_coeff
library: matrices
signature: nil
location: 97 0 99 50
body:
  low2_lem: LEMMA FORALL (j:posnat, (f| FORALL( k:above(j)): f(k)=0), i:{ii:upto(j+1)|f(ii)<2}):
            LET M =  low2(j, f, i) IN 
            f(M)<2 AND (FORALL (m:nat): m<M IMPLIES f(m)=2)


decl_type: formula
theory: query_coeff
library: matrices
signature: nil
location: 103 0 105 35
body:
  bump_one_prep: LEMMA FORALL(j:posnat, (f| FORALL( k:above(j)): f(k)=0)):
                 base_n_to_nat(3, bump_one_ind(j, f, 0), j+1) = 
                 base_n_to_nat(3, f, j+1) +1


decl_type: formula
theory: query_coeff
library: matrices
signature: nil
location: 107 0 108 57
body:
  bump_one_prep2: LEMMA FORALL (k:nat, (f| f=base_n(3,k))): 
                  bump_one_ind(upper_index(3,k)+1, f, 0) = base_n(3, k+1)


decl_type: formula
theory: query_coeff
library: matrices
signature: nil
location: 119 0 121 82
body:
  switch_to_array: LEMMA FORALL (j:posnat, L:listn[below(3)](j+1), (f| FORALL( k:above(j)): f(k)=0), i:upto(j+1)):
         array2list[below(3)](j+1)(f) = L IMPLIES 
         bump_one_ind_list(j, L, i) = array2list[below(3)](j+1)(bump_one_ind(j,f,i))


decl_type: formula
theory: query_coeff
library: matrices
signature: nil
location: 148 0 149 120
body:
  dot_tail_sum_lem: LEMMA FORALL (n:{x:nat|x>1}, F, G: [{ll:list[below(3)]| length(ll)=n}->real], a:real, i:upto(3^n), L:{ll:list[below(3)]| ll = base_list(3, i, n)}):
                    dot_tail_sum2plus(n, F, G, a, i, L) = a+sigma( i, 3^n-1, LAMBDA(j:nat): F(base_list(3, j, n))*G(base_list(3, j, n)))


decl_type: formula
theory: query_coeff
library: matrices
signature: nil
location: 164 0 165 115
body:
  dot_tail_sum_lem2: LEMMA FORALL (n:posnat, F, G: [[nat->below(3)]->real], a:real, i:upto(3^n)):
                    dot_tail_sum2(n, F, G, a, i, base_n(3,i)) = a+sigma( i, 3^n-1, LAMBDA(j:nat): F(base_n(3, j) )*G(base_n(3, j)))


decl_type: function
theory: query_coeff
library: matrices
location: 18 0 25 20
signature:
  [d:
          [j: posnat, {f | FORALL (k: above(j)): f(k) = 0},
           upto(1 + j)] ->
          {ff: [nat -> below(3)] |
                   FORALL (k: above(1 + d`1)): ff(k) = 0}]

body:
  bump_one_ind(j:posnat, (f| FORALL( k:above(j)): f(k)=0), (i:upto(j+1))): 
           RECURSIVE {ff:[nat->below(3)]| FORALL(k:above(j+1)): ff(k) = 0} = 
              IF f(i)<2 THEN
                 f WITH [i:=f(i)+1]
              ELSE 
                 bump_one_ind (j, f,i+1) WITH [i:=0]
              ENDIF
              MEASURE (j+1-i)


decl_type: function
theory: query_coeff
library: matrices
location: 30 0 35 12
signature:
  [d:
          [L: {ll: list[below(3)] | cons?[below(3)](ll)},
           below(length(L)), below(3)] ->
          {ll: list[below(3)] |
                   length(ll) = length(d`1) AND
                    (FORALL (i: below(length(d`1))):
                       i /= d`2 IMPLIES nth(ll, i) = nth(d`1, i))}]

body:
  switch_one_entry(L:{ll:list[below(3)]|cons?[below(3)](ll)}, n: below(length(L)), new:below(3)): RECURSIVE
    {ll:list[below(3)]| length(ll) = length(L) AND FORALL (i:below(length(L))): i/=n IMPLIES nth(ll, i) = nth(L, i)} = 
     IF n=0 THEN cons(new, cdr(L)) 
     ELSE cons(car(L), switch_one_entry(cdr(L), n-1, new))
     ENDIF
     MEASURE n


decl_type: function
theory: query_coeff
library: matrices
signature:
  [d: [j: posnat, listn[below(3)](1 + j), upto(1 + j)] ->
  listn[below(3)](1 + d`1)]

location: 40 0 48 18
body:
  bump_one_ind_list(j:posnat, L:listn[below(3)](j+1), i:upto(j+1)): RECURSIVE listn[below(3)](j+1) = 
              IF i=j+1 THEN L 
              ELSE LET ent = nth(L,i) IN
                   IF ent<2 THEN
                      switch_one_entry(L, i, ent+1)
                   ELSE switch_one_entry(bump_one_ind_list(j, L, i+1), i, 0)
                   ENDIF
              ENDIF
              MEASURE j+1-i


decl_type: function
theory: query_coeff
library: matrices
location: 91 0 95 17
signature:
  [d:
          [j: posnat, f: {f | FORALL (k: above(j)): f(k) = 0},
           {ii: upto(1 + j) | f(ii) < 2}] ->
          {ii: upto(1 + d`1) | d`2(ii) < 2}]

body:
  low2(j:posnat, (f| FORALL( k:above(j)): f(k)=0), i:{ii:upto(j+1)|f(ii)<2} ): RECURSIVE {ii:upto(j+1)|f(ii)<2}= 
                 IF (EXISTS(m:nat): m<i AND f(m)<2) THEN low2(j, f, choose({m:nat| m<i AND f(m)<2}))  
                 ELSE i 
                 ENDIF
                 MEASURE i


decl_type: function
theory: query_coeff
library: matrices
signature:
  [d: [k: nat, {f | f = base_n(3, k)}] ->
  {ff: [nat -> below(3)] | ff = base_n(3, 1 + d`1)}]

location: 112 0 113 43
body:
  bump_one(k:nat, (f| f=base_n(3,k))): {ff:[nat->below(3)]| ff = base_n(3,k+1)} = 
                     bump_one_ind(upper_index(3,k)+1, f, 0)


decl_type: function
theory: query_coeff
library: matrices
location: 123 0 125 35
signature:
  [d:
          [j: posnat, k: below(3 ^ (1 + j)),
           {ll: listn[below(3)](1 + j) | ll = base_list(3, k, 1 + j)}] ->
          {ll: listn[below(3)](1 + d`1) |
                   ll = base_list(3, 1 + d`2, 1 + d`1)}]

body:
  bump_one_list(j:posnat, k:below(3^(j+1)), L:{ll:listn[below(3)](j+1)| ll=base_list(3,k,j+1)}):
      {ll:listn[below(3)](j+1)| ll= base_list(3, k+1, j+1)}  
                       = bump_one_ind_list(j, L, 0) 


decl_type: function
theory: query_coeff
library: matrices
location: 134 0 137 12
signature:
  [d:
          [j: posnat, {ll: list[below(3)] | length(ll) = j},
           [{ll: list[below(3)] | length(ll) = j} -> real],
           [{ll: list[below(3)] | length(ll) = j} -> real]] ->
          {x: real | x = d`3(d`2) * d`4(d`2)}]

body:
  is_nonzero(j:posnat, l:{ll:list[below(3)]| length(ll)=j}, F, G: [{ll:list[below(3)]| length(ll)=j}->real]): {x:real| x = F(l)*G(l)} = 
                       IF F(l) = 0 THEN 0
                       ELSE F(l)*G(l)
                       ENDIF


decl_type: function
theory: query_coeff
library: matrices
location: 141 0 146 15
signature:
  [[n: {x: nat | x > 1},
         [{ll: list[below(3)] | length(ll) = n} -> real],
         [{ll: list[below(3)] | length(ll) = n} -> real], real,
         i: upto(3 ^ n),
         {ll: list[below(3)] | ll = base_list(3, i, n)}] ->
          real]

body:
  dot_tail_sum2plus(n:{x:nat|x>1}, F, G: [{ll:list[below(3)]| length(ll)=n}->real], a:real, i:upto(3^n), L:{ll:list[below(3)]| ll = base_list(3, i, n)}): RECURSIVE real = 
                  IF i=3^n THEN a
                  ELSE LET A = a+ is_nonzero(n, L, F, G) IN 
                      dot_tail_sum2plus(n, F, G, A, i+1, bump_one_list(n-1, i, L))
                  ENDIF
                  MEASURE 3^n-i


decl_type: function
theory: query_coeff
library: matrices
location: 152 0 155 12
signature:
  [d:
          [posnat, [nat -> below(3)], [[nat -> below(3)] -> real],
           [[nat -> below(3)] -> real]] ->
          {x: real | x = d`3(d`2) * d`4(d`2)}]

body:
  is_nz(j:posnat, f, (F,G: [[nat->below(3)]->real])):     {x:real| x = F(f)*G(f)} = 
                       IF F(f) = 0 THEN 0
                       ELSE F(f)*G(f)
                       ENDIF      


decl_type: function
theory: query_coeff
library: matrices
location: 157 0 162 15
signature:
  [[n: posnat, [[nat -> below(3)] -> real],
         [[nat -> below(3)] -> real], real, i: upto(3 ^ n),
         {f | f = base_n(3, i)}] ->
          real]

body:
  dot_tail_sum2(n:posnat,  F,G: [[nat->below(3)]->real], a:real, i:upto(3^n), (f|f=base_n(3,i)) ): RECURSIVE real = 
                  IF i=3^n THEN a
                  ELSE LET A = a+ is_nz(n, f, F, G) IN 
                      dot_tail_sum2(n, F, G, A, i+1, bump_one(i, f))
                  ENDIF
                  MEASURE 3^n-i


decl_type: tcc
theory: query_coeff
library: matrices
signature: nil
location: 174 0 180 999
body:
  % Subtype TCC generated (at line 25, column 14) for  (j + 1 - i)
      % expected type  naturalnumber
  bump_one_ind_TCC1: OBLIGATION
    FORALL (j: posnat,
            (f: [nat -> below(3)] | FORALL (k: above(j)): f(k) = 0),
            (i: upto(j + 1))):
      (j + 1 - i) >= 0;


decl_type: tcc
theory: query_coeff
library: matrices
signature: nil
location: 182 0 188 999
body:
  % Subtype TCC generated (at line 21, column 19) for  f(i) + 1
      % expected type  below(3)
  bump_one_ind_TCC2: OBLIGATION
    FORALL (j: posnat,
            (f: [nat -> below(3)] | FORALL (k: above(j)): f(k) = 0),
            (i: upto(j + 1))):
      f(i) < 2 IMPLIES f(i) + 1 < 3;


decl_type: tcc
theory: query_coeff
library: matrices
signature: nil
location: 190 0 198 999
body:
  % Subtype TCC generated (at line 21, column 8) for  f WITH [i := f(i) + 1]
      % expected type  {ff: [nat -> below(3)] |
                     %          FORALL (k: above(j + 1)): ff(k) = 0}
  bump_one_ind_TCC3: OBLIGATION
    FORALL (j: posnat,
            (f: [nat -> below(3)] | FORALL (k: above(j)): f(k) = 0),
            (i: upto(j + 1))):
      f(i) < 2 IMPLIES
       (FORALL (k: above(j + 1)): (f WITH [i := f(i) + 1])(k) = 0);


decl_type: tcc
theory: query_coeff
library: matrices
signature: nil
location: 200 0 206 999
body:
  % Subtype TCC generated (at line 23, column 27) for  i + 1
      % expected type  upto(1 + j)
  bump_one_ind_TCC4: OBLIGATION
    FORALL (j: posnat,
            (f: [nat -> below(3)] | FORALL (k: above(j)): f(k) = 0),
            (i: upto(j + 1))):
      NOT f(i) < 2 IMPLIES i + 1 <= 1 + j;


decl_type: tcc
theory: query_coeff
library: matrices
signature: nil
location: 208 0 214 999
body:
  % Termination TCC generated (at line 23, column 8) for
      % bump_one_ind(j, f, i + 1)
  bump_one_ind_TCC5: OBLIGATION
    FORALL (j: posnat,
            (f: [nat -> below(3)] | FORALL (k: above(j)): f(k) = 0),
            (i: upto(j + 1))):
      NOT f(i) < 2 IMPLIES (j + 1 - (i + 1)) < (j + 1 - i);


decl_type: tcc
theory: query_coeff
library: matrices
signature: nil
location: 216 0 234 999
body:
  % Subtype TCC generated (at line 23, column 8) for
      % bump_one_ind(j, f, i + 1) WITH [i := 0]
      % expected type  {ff: [nat -> below(3)] |
                     %          FORALL (k: above(j + 1)): ff(k) = 0}
  bump_one_ind_TCC6: OBLIGATION
    FORALL (j: posnat,
            (f: [nat -> below(3)] | FORALL (k: above(j)): f(k) = 0),
            (i: upto(j + 1))):
      NOT f(i) < 2 IMPLIES
       (FORALL (k: above(j + 1)),
               (v:
                  [d1:
                     {z:
                        [j: posnat, {f | FORALL (k: above(j)): f(k) = 0},
                         upto(1 + j)] |
                              (z`1 + 1 - z`3) < (j + 1 - i)} ->
                     {ff: [nat -> below(3)] |
                              FORALL (k: above(1 + d1`1)): ff(k) = 0}]):
          (v(j, f, i + 1) WITH [i := 0])(k) = 0);


decl_type: tcc
theory: query_coeff
library: matrices
signature: nil
location: 236 0 243 999
body:
  % Subtype TCC generated (at line 31, column 99) for  i
      % expected type  below[length[below(3)](ll)]
  switch_one_entry_TCC1: OBLIGATION
    FORALL (L: {ll: list[below(3)] | cons?[below(3)](ll)},
            n: below(length(L)), ll: list[below(3)]):
      length(ll) = length(L) IMPLIES
       (FORALL (i: below(length[below(3)](L))):
          i /= n IMPLIES i < length[below(3)](ll));


decl_type: tcc
theory: query_coeff
library: matrices
signature: nil
location: 245 0 260 999
body:
  % Subtype TCC generated (at line 32, column 15) for  cons(new, cdr(L))
      % expected type  {ll: list[below(3)] |
                     %          length(ll) = length(L) AND
                     %           (FORALL (i: below(length(L))):
                     %              i /= n IMPLIES nth(ll, i) = nth(L, i))}
  switch_one_entry_TCC2: OBLIGATION
    FORALL (L: {ll: list[below(3)] | cons?[below(3)](ll)},
            n: below(length[below(3)](L)), new: below(3)):
      n = 0 IMPLIES
       length[below(3)](cons[below(3)](new, cdr[below(3)](L))) =
        length[below(3)](L)
        AND
        (FORALL (i: below(length[below(3)](L))):
           i /= n IMPLIES
            nth[below(3)](cons[below(3)](new, cdr[below(3)](L)), i) =
             nth[below(3)](L, i));


decl_type: tcc
theory: query_coeff
library: matrices
signature: nil
location: 262 0 267 999
body:
  % Subtype TCC generated (at line 33, column 38) for  cdr(L)
      % expected type  {ll: list[below(3)] | cons?[below(3)](ll)}
  switch_one_entry_TCC3: OBLIGATION
    FORALL (L: {ll: list[below(3)] | cons?[below(3)](ll)},
            n: below(length[below(3)](L)), new: below(3)):
      NOT n = 0 IMPLIES cons?[below(3)](cdr[below(3)](L));


decl_type: tcc
theory: query_coeff
library: matrices
signature: nil
location: 269 0 275 999
body:
  % Subtype TCC generated (at line 33, column 46) for  n - 1
      % expected type  below(length(cdr(L)))
  switch_one_entry_TCC4: OBLIGATION
    FORALL (L: {ll: list[below(3)] | cons?[below(3)](ll)},
            n: below(length[below(3)](L)), new: below(3)):
      NOT n = 0 IMPLIES
       n - 1 >= 0 AND n - 1 < length[below(3)](cdr[below(3)](L));


decl_type: tcc
theory: query_coeff
library: matrices
signature: nil
location: 277 0 282 999
body:
  % Termination TCC generated (at line 33, column 21) for
      % switch_one_entry(cdr(L), n - 1, new)
  switch_one_entry_TCC5: OBLIGATION
    FORALL (L: {ll: list[below(3)] | cons?[below(3)](ll)},
            n: below(length[below(3)](L)), new: below(3)):
      NOT n = 0 IMPLIES n - 1 < n;


decl_type: tcc
theory: query_coeff
library: matrices
signature: nil
location: 284 0 316 999
body:
  % Subtype TCC generated (at line 33, column 8) for
      % cons(car(L), switch_one_entry(cdr(L), n - 1, new))
      % expected type  {ll: list[below(3)] |
                     %          length(ll) = length(L) AND
                     %           (FORALL (i: below(length(L))):
                     %              i /= n IMPLIES nth(ll, i) = nth(L, i))}
  switch_one_entry_TCC6: OBLIGATION
    FORALL (L: {ll: list[below(3)] | cons?[below(3)](ll)},
            n: below(length[below(3)](L)),
            v:
              [d1:
                 {z:
                    [L: {ll: list[below(3)] | cons?[below(3)](ll)},
                     below(length(L)), below(3)] |
                          z`2 < n} ->
                 {ll: list[below(3)] |
                          length(ll) = length(d1`1) AND
                           (FORALL (i: below(length(d1`1))):
                              i /= d1`2 IMPLIES nth(ll, i) = nth(d1`1, i))}],
            new: below(3)):
      NOT n = 0 IMPLIES
       length[below(3)]
           (cons[below(3)]
                (car[below(3)](L), v(cdr[below(3)](L), n - 1, new)))
        = length[below(3)](L)
        AND
        (FORALL (i: below(length[below(3)](L))):
           i /= n IMPLIES
            nth[below(3)]
                (cons[below(3)]
                     (car[below(3)](L), v(cdr[below(3)](L), n - 1, new)),
                 i)
             = nth[below(3)](L, i));


decl_type: tcc
theory: query_coeff
library: matrices
signature: nil
location: 318 0 323 999
body:
  % Existence TCC generated (at line 37, column 111) for  array2list[below(3)]
  switch_is_with_TCC1: OBLIGATION
    FORALL (L: {ll: list[below(3)] | cons?[below(3)](ll)},
            n: below(length[below(3)](L)), new: below(3),
            f: [nat -> below(3)]):
      EXISTS (x: below(3)): TRUE;


decl_type: tcc
theory: query_coeff
library: matrices
signature: nil
location: 325 0 329 999
body:
  % Subtype TCC generated (at line 48, column 13) for  j + 1 - i
      % expected type  naturalnumber
  bump_one_ind_list_TCC1: OBLIGATION
    FORALL (j: posnat, L: listn[below(3)](j + 1), i: upto(j + 1)):
      j + 1 - i >= 0;


decl_type: tcc
theory: query_coeff
library: matrices
signature: nil
location: 331 0 337 999
body:
  % Subtype TCC generated (at line 44, column 23) for  L
      % expected type  {ll: list[below(3)] | cons?[below(3)](ll)}
  bump_one_ind_list_TCC2: OBLIGATION
    FORALL (j: posnat, L: listn[below(3)](j + 1), i: upto(j + 1)):
      NOT i = j + 1 IMPLIES
       (FORALL (ent: below(3)):
          ent < 2 AND ent = nth(L, i) IMPLIES cons?[below(3)](L));


decl_type: tcc
theory: query_coeff
library: matrices
signature: nil
location: 339 0 345 999
body:
  % Subtype TCC generated (at line 44, column 26) for  i
      % expected type  below(length(L))
  bump_one_ind_list_TCC3: OBLIGATION
    FORALL (j: posnat, L: listn[below(3)](j + 1), i: upto(j + 1)):
      NOT i = j + 1 IMPLIES
       (FORALL (ent: below(3)):
          ent < 2 AND ent = nth(L, i) IMPLIES i < length[below(3)](L));


decl_type: tcc
theory: query_coeff
library: matrices
signature: nil
location: 347 0 353 999
body:
  % Subtype TCC generated (at line 44, column 29) for  ent + 1
      % expected type  below(3)
  bump_one_ind_list_TCC4: OBLIGATION
    FORALL (j: posnat, L: listn[below(3)](j + 1), i: upto(j + 1)):
      NOT i = j + 1 IMPLIES
       (FORALL (ent: below(3)):
          ent < 2 AND ent = nth(L, i) IMPLIES ent + 1 < 3);


decl_type: tcc
theory: query_coeff
library: matrices
signature: nil
location: 355 0 363 999
body:
  % Subtype TCC generated (at line 44, column 6) for
      % switch_one_entry(L, i, ent + 1)
      % expected type  listn[below(3)](1 + j)
  bump_one_ind_list_TCC5: OBLIGATION
    FORALL (j: posnat, L: listn[below(3)](j + 1), i: upto(j + 1)):
      NOT i = j + 1 IMPLIES
       (FORALL (ent: below(3)):
          ent < 2 AND ent = nth(L, i) IMPLIES
           length[below(3)](switch_one_entry(L, i, ent + 1)) = 1 + j);


decl_type: tcc
theory: query_coeff
library: matrices
signature: nil
location: 365 0 371 999
body:
  % Subtype TCC generated (at line 45, column 49) for  i + 1
      % expected type  upto(1 + j)
  bump_one_ind_list_TCC6: OBLIGATION
    FORALL (j: posnat, L: listn[below(3)](j + 1), i: upto(j + 1)):
      NOT i = j + 1 IMPLIES
       (FORALL (ent: below(3)):
          NOT ent < 2 AND ent = nth(L, i) IMPLIES i + 1 <= 1 + j);


decl_type: tcc
theory: query_coeff
library: matrices
signature: nil
location: 373 0 380 999
body:
  % Termination TCC generated (at line 45, column 25) for
      % bump_one_ind_list(j, L, i + 1)
  bump_one_ind_list_TCC7: OBLIGATION
    FORALL (j: posnat, L: listn[below(3)](j + 1), i: upto(j + 1)):
      NOT i = j + 1 IMPLIES
       (FORALL (ent: below(3)):
          NOT ent < 2 AND ent = nth(L, i) IMPLIES
           j + 1 - (i + 1) < j + 1 - i);


decl_type: tcc
theory: query_coeff
library: matrices
signature: nil
location: 382 0 395 999
body:
  % Subtype TCC generated (at line 45, column 25) for
      % bump_one_ind_list(j, L, i + 1)
      % expected type  {ll: list[below(3)] | cons?[below(3)](ll)}
  bump_one_ind_list_TCC8: OBLIGATION
    FORALL (j: posnat, L: listn[below(3)](j + 1), i: upto(j + 1),
            v:
              [d1:
                 {z: [j: posnat, listn[below(3)](1 + j), upto(1 + j)] |
                          z`1 + 1 - z`3 < j + 1 - i} ->
                 listn[below(3)](1 + d1`1)]):
      NOT i = j + 1 IMPLIES
       (FORALL (ent: below(3)):
          NOT ent < 2 AND ent = nth(L, i) IMPLIES
           cons?[below(3)](v(j, L, i + 1)));


decl_type: tcc
theory: query_coeff
library: matrices
signature: nil
location: 397 0 409 999
body:
  % Subtype TCC generated (at line 45, column 55) for  i
      % expected type  below(length(bump_one_ind_list(j, L, 1 + i)))
  bump_one_ind_list_TCC9: OBLIGATION
    FORALL (j: posnat, L: listn[below(3)](j + 1), i: upto(j + 1),
            v:
              [d1:
                 {z: [j: posnat, listn[below(3)](1 + j), upto(1 + j)] |
                          z`1 + 1 - z`3 < j + 1 - i} ->
                 listn[below(3)](1 + d1`1)]):
      NOT i = j + 1 IMPLIES
       (FORALL (ent: below(3)):
          NOT ent < 2 AND ent = nth(L, i) IMPLIES
           i < length[below(3)](v(j, L, 1 + i)));


decl_type: tcc
theory: query_coeff
library: matrices
signature: nil
location: 411 0 424 999
body:
  % Subtype TCC generated (at line 45, column 8) for
      % switch_one_entry(bump_one_ind_list(j, L, i + 1), i, 0)
      % expected type  listn[below(3)](1 + j)
  bump_one_ind_list_TCC10: OBLIGATION
    FORALL (j: posnat, L: listn[below(3)](j + 1), i: upto(j + 1),
            v:
              [d1:
                 {z: [j: posnat, listn[below(3)](1 + j), upto(1 + j)] |
                          z`1 + 1 - z`3 < j + 1 - i} ->
                 listn[below(3)](1 + d1`1)]):
      NOT i = j + 1 IMPLIES
       (FORALL (ent: below(3)):
          NOT ent < 2 AND ent = nth(L, i) IMPLIES
           length[below(3)](switch_one_entry(v(j, L, i + 1), i, 0)) = 1 + j);


decl_type: tcc
theory: query_coeff
library: matrices
signature: nil
location: 426 0 430 999
body:
  % Subtype TCC generated (at line 42, column 26) for  i
      % expected type  below[length[below(3)](L)]
  bump_one_ind_list_TCC11: OBLIGATION
    FORALL (j: posnat, L: listn[below(3)](j + 1), i: upto(j + 1)):
      NOT i = j + 1 IMPLIES i < length[below(3)](L);


decl_type: tcc
theory: query_coeff
library: matrices
signature: nil
location: 432 0 438 999
body:
  % Subtype TCC generated (at line 88, column 38) for  0
      % expected type  upto(1 + j)
  bump_one_ind_lem2_TCC1: OBLIGATION
    FORALL (j: posnat,
            (f: [nat -> below(3)] | FORALL (k: above(j)): f(k) = 0),
            (i: upto(j + 1))):
      (FORALL (m: nat): m <= i IMPLIES f(m) = 2) IMPLIES 0 <= 1 + j;


decl_type: tcc
theory: query_coeff
library: matrices
signature: nil
location: 440 0 446 999
body:
  % Subtype TCC generated (at line 89, column 41) for  i + 1
      % expected type  upto(1 + j)
  bump_one_ind_lem2_TCC2: OBLIGATION
    FORALL (j: posnat,
            (f: [nat -> below(3)] | FORALL (k: above(j)): f(k) = 0),
            (i: upto(j + 1))):
      (FORALL (m: nat): m <= i IMPLIES f(m) = 2) IMPLIES i + 1 <= 1 + j;


decl_type: tcc
theory: query_coeff
library: matrices
signature: nil
location: 448 0 455 999
body:
  % Subtype TCC generated (at line 89, column 62) for  i
      % expected type  T_high[nat]
  bump_one_ind_lem2_TCC3: OBLIGATION
    FORALL (j: posnat,
            (f: [nat -> below(3)] | FORALL (k: above(j)): f(k) = 0),
            (i: upto(j + 1))):
      (FORALL (m: nat): m <= i IMPLIES f(m) = 2) IMPLIES
       i >= 0 OR (EXISTS (j_1: nat): i <= j_1);


decl_type: tcc
theory: query_coeff
library: matrices
signature: nil
location: 457 0 465 999
body:
  % Subtype TCC generated (at line 92, column 73) for
      % {m: nat | m < i AND f(m) < 2}
      % expected type  p: (nonempty?[nat])
  low2_TCC1: OBLIGATION
    FORALL (j: posnat,
            (f: [nat -> below(3)] | FORALL (k: above(j)): f(k) = 0),
            i: {ii: upto(j + 1) | f(ii) < 2}):
      (EXISTS (m: nat): m < i AND f(m) < 2) IMPLIES
       nonempty?[nat]({m: nat | m < i AND f(m) < 2});


decl_type: tcc
theory: query_coeff
library: matrices
signature: nil
location: 467 0 476 999
body:
  % Subtype TCC generated (at line 92, column 66) for
      % choose({m: nat | m < i AND f(m) < 2})
      % expected type  {ii: upto(1 + j) | f(ii) < 2}
  low2_TCC2: OBLIGATION
    FORALL (j: posnat,
            (f: [nat -> below(3)] | FORALL (k: above(j)): f(k) = 0),
            i: {ii: upto(j + 1) | f(ii) < 2}):
      (EXISTS (m: nat): m < i AND f(m) < 2) IMPLIES
       choose[nat]({m: nat | m < i AND f(m) < 2}) <= 1 + j AND
        f(choose[nat]({m: nat | m < i AND f(m) < 2})) < 2;


decl_type: tcc
theory: query_coeff
library: matrices
signature: nil
location: 478 0 483 999
body:
  % Subtype TCC generated (at line 104, column 44) for  0
      % expected type  upto(1 + j)
  bump_one_prep_TCC1: OBLIGATION
    FORALL (j: posnat,
            (f: [nat -> below(3)] | FORALL (k: above(j)): f(k) = 0)):
      0 <= 1 + j;


decl_type: tcc
theory: query_coeff
library: matrices
signature: nil
location: 485 0 491 999
body:
  % Subtype TCC generated (at line 108, column 35) for  f
      % expected type  {f |
                     %          FORALL (k_1: above(1 + upper_index(3, k))):
                     %            f(k_1) = 0}
  bump_one_prep2_TCC1: OBLIGATION
    FORALL (k: nat, (f: [nat -> below(3)] | f = base_n(3, k))):
      FORALL (k_1: above(1 + upper_index(3, k))): f(k_1) = 0;


decl_type: tcc
theory: query_coeff
library: matrices
signature: nil
location: 493 0 497 999
body:
  % Subtype TCC generated (at line 108, column 38) for  0
      % expected type  upto(2 + upper_index(3, k))
  bump_one_prep2_TCC2: OBLIGATION
    FORALL (k: nat, (f: [nat -> below(3)] | f = base_n(3, k))):
      0 <= 2 + upper_index(3, k);


decl_type: tcc
theory: query_coeff
library: matrices
signature: nil
location: 499 0 504 999
body:
  % Subtype TCC generated (at line 113, column 5) for
      % bump_one_ind(upper_index(3, k) + 1, f, 0)
      % expected type  {ff: [nat -> below(3)] | ff = base_n(3, 1 + k)}
  bump_one_TCC1: OBLIGATION
    FORALL (k: nat, (f: [nat -> below(3)] | f = base_n(3, k))):
      bump_one_ind(upper_index(3, k) + 1, f, 0) = base_n(3, 1 + k);


decl_type: tcc
theory: query_coeff
library: matrices
signature: nil
location: 506 0 511 999
body:
  % Subtype TCC generated (at line 125, column 33) for  0
      % expected type  upto(1 + j)
  bump_one_list_TCC1: OBLIGATION
    FORALL (j: posnat, k: below(3 ^ (j + 1)),
            L: {ll: listn[below(3)](j + 1) | ll = base_list(3, k, j + 1)}):
      0 <= 1 + j;


decl_type: tcc
theory: query_coeff
library: matrices
signature: nil
location: 513 0 520 999
body:
  % Subtype TCC generated (at line 125, column 9) for
      % bump_one_ind_list(j, L, 0)
      % expected type  {ll: listn[below(3)](j + 1) |
                     %          ll = base_list(3, 1 + k, 1 + j)}
  bump_one_list_TCC2: OBLIGATION
    FORALL (j: posnat, k: below(3 ^ (j + 1)),
            L: {ll: listn[below(3)](j + 1) | ll = base_list(3, k, j + 1)}):
      bump_one_ind_list(j, L, 0) = base_list(3, 1 + k, 1 + j);


decl_type: tcc
theory: query_coeff
library: matrices
signature: nil
location: 522 0 527 999
body:
  % Subtype TCC generated (at line 135, column 24) for  0
      % expected type  {x: real | x = F(l) * G(l)}
  is_nonzero_TCC1: OBLIGATION
    FORALL (j: posnat, l: {ll: list[below(3)] | length[below(3)](ll) = j},
            F, G: [{ll: list[below(3)] | length[below(3)](ll) = j} -> real]):
      F(l) = 0 IMPLIES 0 = F(l) * G(l);


decl_type: tcc
theory: query_coeff
library: matrices
signature: nil
location: 529 0 531 999
body:
  % Subtype TCC generated (at line 141, column 146) for  n
      % expected type  posnat
  dot_tail_sum2plus_TCC1: OBLIGATION FORALL (n: {x: nat | x > 1}): n > 0;


decl_type: tcc
theory: query_coeff
library: matrices
signature: nil
location: 533 0 538 999
body:
  % Subtype TCC generated (at line 146, column 10) for  3 ^ n - i
      % expected type  naturalnumber
  dot_tail_sum2plus_TCC2: OBLIGATION
    FORALL (n: {x: nat | x > 1}, i: upto(3 ^ n),
            L: {ll: list[below(3)] | ll = base_list(3, i, n)}):
      3 ^ n - i >= 0;


decl_type: tcc
theory: query_coeff
library: matrices
signature: nil
location: 540 0 549 999
body:
  % Subtype TCC generated (at line 144, column 36) for  i + 1
      % expected type  upto(3 ^ n)
  dot_tail_sum2plus_TCC3: OBLIGATION
    FORALL (n: {x: nat | x > 1},
            F, G: [{ll: list[below(3)] | length[below(3)](ll) = n} -> real],
            a: real, i: upto(3 ^ n),
            L: {ll: list[below(3)] | ll = base_list(3, i, n)}):
      NOT i = 3 ^ n IMPLIES
       (FORALL (A: real):
          A = a + is_nonzero(n, L, F, G) IMPLIES i + 1 <= 3 ^ n);


decl_type: tcc
theory: query_coeff
library: matrices
signature: nil
location: 551 0 560 999
body:
  % Subtype TCC generated (at line 144, column 55) for  n - 1
      % expected type  posnat
  dot_tail_sum2plus_TCC4: OBLIGATION
    FORALL (n: {x: nat | x > 1},
            F, G: [{ll: list[below(3)] | length[below(3)](ll) = n} -> real],
            a: real, i: upto(3 ^ n),
            L: {ll: list[below(3)] | ll = base_list(3, i, n)}):
      NOT i = 3 ^ n IMPLIES
       (FORALL (A: real):
          A = a + is_nonzero(n, L, F, G) IMPLIES n - 1 >= 0 AND n - 1 > 0);


decl_type: tcc
theory: query_coeff
library: matrices
signature: nil
location: 562 0 570 999
body:
  % Subtype TCC generated (at line 144, column 60) for  i
      % expected type  below(3 ^ n)
  dot_tail_sum2plus_TCC5: OBLIGATION
    FORALL (n: {x: nat | x > 1},
            F, G: [{ll: list[below(3)] | length[below(3)](ll) = n} -> real],
            a: real, i: upto(3 ^ n),
            L: {ll: list[below(3)] | ll = base_list(3, i, n)}):
      NOT i = 3 ^ n IMPLIES
       (FORALL (A: real): A = a + is_nonzero(n, L, F, G) IMPLIES i < 3 ^ n);


decl_type: tcc
theory: query_coeff
library: matrices
signature: nil
location: 572 0 582 999
body:
  % Subtype TCC generated (at line 144, column 63) for  L
      % expected type  {ll: listn[below(3)](n) | ll = base_list(3, i, n)}
  dot_tail_sum2plus_TCC6: OBLIGATION
    FORALL (n: {x: nat | x > 1},
            F, G: [{ll: list[below(3)] | length[below(3)](ll) = n} -> real],
            a: real, i: upto(3 ^ n),
            L: {ll: list[below(3)] | ll = base_list(3, i, n)}):
      NOT i = 3 ^ n IMPLIES
       (FORALL (A: real):
          A = a + is_nonzero(n, L, F, G) IMPLIES
           length[below(3)](L) = n AND L = base_list(3, i, n));


decl_type: tcc
theory: query_coeff
library: matrices
signature: nil
location: 584 0 593 999
body:
  % Termination TCC generated (at line 144, column 6) for
      % dot_tail_sum2plus(n, F, G, A, i + 1, bump_one_list(n - 1, i, L))
  dot_tail_sum2plus_TCC7: OBLIGATION
    FORALL (n: {x: nat | x > 1},
            F, G: [{ll: list[below(3)] | length[below(3)](ll) = n} -> real],
            a: real, i: upto(3 ^ n),
            L: {ll: list[below(3)] | ll = base_list(3, i, n)}):
      NOT i = 3 ^ n IMPLIES
       (FORALL (A: real):
          A = a + is_nonzero(n, L, F, G) IMPLIES 3 ^ n - (i + 1) < 3 ^ n - i);


decl_type: tcc
theory: query_coeff
library: matrices
signature: nil
location: 595 0 600 999
body:
  % Subtype TCC generated (at line 143, column 32) for  L
      % expected type  {ll: list[below(3)] | length(ll) = n}
  dot_tail_sum2plus_TCC8: OBLIGATION
    FORALL (n: {x: nat | x > 1}, i: upto(3 ^ n),
            L: {ll: list[below(3)] | ll = base_list(3, i, n)}):
      NOT i = 3 ^ n IMPLIES length[below(3)](L) = n;


decl_type: tcc
theory: query_coeff
library: matrices
signature: nil
location: 602 0 607 999
body:
  % Subtype TCC generated (at line 149, column 54) for  3 ^ n - 1
      % expected type  T_high[nat]
  dot_tail_sum_lem_TCC1: OBLIGATION
    FORALL (n: {x: nat | x > 1}, i: upto(3 ^ n),
            L: {ll: list[below(3)] | ll = base_list(3, i, n)}):
      3 ^ n - 1 >= 0 OR (EXISTS (j: nat): 3 ^ n - 1 <= j);


decl_type: tcc
theory: query_coeff
library: matrices
signature: nil
location: 609 0 613 999
body:
  % Subtype TCC generated (at line 153, column 24) for  0
      % expected type  {x: real | x = F(f) * G(f)}
  is_nz_TCC1: OBLIGATION
    FORALL (f: [nat -> below(3)], (F, G: [[nat -> below(3)] -> real])):
      F(f) = 0 IMPLIES 0 = F(f) * G(f);


decl_type: tcc
theory: query_coeff
library: matrices
signature: nil
location: 615 0 620 999
body:
  % Subtype TCC generated (at line 162, column 10) for  3 ^ n - i
      % expected type  naturalnumber
  dot_tail_sum2_TCC1: OBLIGATION
    FORALL (n: posnat, i: upto(3 ^ n),
            (f: [nat -> below(3)] | f = base_n(3, i))):
      3 ^ n - i >= 0;


decl_type: tcc
theory: query_coeff
library: matrices
signature: nil
location: 622 0 628 999
body:
  % Subtype TCC generated (at line 160, column 32) for  i + 1
      % expected type  upto(3 ^ n)
  dot_tail_sum2_TCC2: OBLIGATION
    FORALL (n: posnat, F, G: [[nat -> below(3)] -> real], a: real,
            i: upto(3 ^ n), (f: [nat -> below(3)] | f = base_n(3, i))):
      NOT i = 3 ^ n IMPLIES
       (FORALL (A: real): A = a + is_nz(n, f, F, G) IMPLIES i + 1 <= 3 ^ n);


decl_type: tcc
theory: query_coeff
library: matrices
signature: nil
location: 630 0 637 999
body:
  % Termination TCC generated (at line 160, column 6) for
      % dot_tail_sum2(n, F, G, A, i + 1, bump_one(i, f))
  dot_tail_sum2_TCC3: OBLIGATION
    FORALL (n: posnat, F, G: [[nat -> below(3)] -> real], a: real,
            i: upto(3 ^ n), (f: [nat -> below(3)] | f = base_n(3, i))):
      NOT i = 3 ^ n IMPLIES
       (FORALL (A: real):
          A = a + is_nz(n, f, F, G) IMPLIES 3 ^ n - (i + 1) < 3 ^ n - i);


decl_type: tcc
theory: query_coeff
library: matrices
signature: nil
location: 639 0 643 999
body:
  % Subtype TCC generated (at line 165, column 33) for  base_n(3, i)
      % expected type  {f | f = base_n(3, i)}
  dot_tail_sum_lem2_TCC1: OBLIGATION
    FORALL (n: posnat, i: upto(3 ^ n)):
      FORALL (x1: nat): base_n(3, i)(x1) < 3;


decl_type: tcc
theory: query_coeff
library: matrices
signature: nil
location: 645 0 648 999
body:
  % Subtype TCC generated (at line 165, column 60) for  3 ^ n - 1
      % expected type  T_high[nat]
  dot_tail_sum_lem2_TCC2: OBLIGATION
    FORALL (n: posnat): 3 ^ n - 1 >= 0 OR (EXISTS (j: nat): 3 ^ n - 1 <= j);


decl_type: tcc
theory: query_coeff
library: matrices
signature: nil
location: 650 0 653 999
body:
  % Subtype TCC generated (at line 165, column 84) for  base_n(3, j)
      % expected type  [nat -> below(3)]
  dot_tail_sum_lem2_TCC3: OBLIGATION
    FORALL (j: nat): FORALL (x1: nat): base_n(3, j)(x1) < 3;


decl_type: formula
theory: generalized_measure_def
library: measure_integration
signature: nil
location: 73 2 75 78
body:
    measure_disjoint_union: LEMMA
      measure?(f) AND disjoint?(a,b) AND S(union(a,b)) =>
                                            x_eq(f(union(a,b)),x_add(f(a),f(b)))


decl_type: type
theory: generalized_measure_def
library: measure_integration
signature: nil
location: 40 2 41 72
body:
    disjoint_indexed_measurable: TYPE+ = 
         (disjoint_indexed_measurable?) CONTAINING (LAMBDA i: emptyset[T])


decl_type: judgement
theory: generalized_measure_def
library: measure_integration
signature: disjoint_indexed_set[nat, T]
location: 43 2 44 73
body:
    disjoint_indexed_measurable_is_disjoint_indexed_set: JUDGEMENT
         disjoint_indexed_measurable SUBTYPE_OF disjoint_indexed_set[nat,T]


decl_type: judgement
theory: generalized_measure_def
library: measure_integration
signature: measure_type
location: 70 2 71 70
body:
    complete_measure_is_measure:
                  JUDGEMENT complete_measure     SUBTYPE_OF measure_type


decl_type: judgement
theory: generalized_measure_def
library: measure_integration
signature: finite_measure
location: 89 2 90 78
body:
    complete_finite_measure_is_finite_measure:
                     JUDGEMENT complete_finite_measure SUBTYPE_OF finite_measure


decl_type: function
theory: generalized_measure_def
library: measure_integration
signature: [[(S) -> extended_nnreal] -> bool]
location: 51 2 52 63
body:
    measure_countably_additive?(f): bool
      = FORALL X: S(IUnion(X)) => x_eq(x_sum(f o X),f(IUnion(X)))


decl_type: function
theory: generalized_measure_def
library: measure_integration
signature: [[(S) -> extended_nnreal] -> bool]
location: 57 2 58 64
body:
    measure?(f):bool              = measure_empty?(f) AND
                                    measure_countably_additive?(f)


decl_type: function
theory: generalized_measure_def
library: measure_integration
signature: [[(S) -> nnreal] -> bool]
location: 77 2 79 71
body:
    finite_measure?(g):bool
      = g(emptyset[T]) = 0 AND
        FORALL X: S(IUnion(X)) => convergence(series(g o X),g(IUnion(X)))


decl_type: function
theory: generalized_measure_def
library: measure_integration
signature: [[(S) -> nnreal] -> bool]
location: 81 2 82 74
body:
    complete_finite_measure?(g):bool
      = finite_measure?(g) AND FORALL x,a: subset?(x,a) AND g(a) = 0 => S(x)


decl_type: tcc
theory: generalized_measure_def
library: measure_integration
signature: nil
location: 103 0 105 999
body:
  % Subtype TCC generated (at line 41, column 60) for  emptyset[T]
      % expected type  (S)
  disjoint_indexed_measurable_TCC1: OBLIGATION S(emptyset[T]);


decl_type: tcc
theory: generalized_measure_def
library: measure_integration
signature: nil
location: 107 0 110 999
body:
  % Subtype TCC generated (at line 41, column 50) for  (LAMBDA i: emptyset[T])
      % expected type  disjoint_indexed_measurable
  disjoint_indexed_measurable_TCC2: OBLIGATION
    disjoint_indexed_measurable?((LAMBDA i: emptyset[T]));


decl_type: tcc
theory: generalized_measure_def
library: measure_integration
signature: nil
location: 112 0 115 999
body:
  % Judgement subtype TCC generated (at line 44, column 7) for  x
      % expected type  disjoint_indexed_set[nat, T]
  disjoint_indexed_measurable_is_disjoint_indexed_set: OBLIGATION
    FORALL (x: disjoint_indexed_measurable): disjoint?[nat, T](x);


decl_type: tcc
theory: generalized_measure_def
library: measure_integration
signature: nil
location: 117 0 119 999
body:
  % Subtype TCC generated (at line 63, column 67) for  zero_measure
      % expected type  measure_type
  measure_type_TCC1: OBLIGATION measure?(zero_measure);


decl_type: tcc
theory: generalized_measure_def
library: measure_integration
signature: nil
location: 121 0 125 999
body:
  % Subtype TCC generated (at line 66, column 5) for
      % LAMBDA a: IF empty?(a) THEN (TRUE, 0) ELSE (FALSE, 0) ENDIF
      % expected type  measure_type
  trivial_measure_TCC1: OBLIGATION
    measure?(LAMBDA a: IF empty?[T](a) THEN (TRUE, 0) ELSE (FALSE, 0) ENDIF);


decl_type: tcc
theory: generalized_measure_def
library: measure_integration
signature: nil
location: 127 0 129 999
body:
  % Subtype TCC generated (at line 68, column 59) for  trivial_measure
      % expected type  complete_measure
  complete_measure_TCC1: OBLIGATION complete_measure?(trivial_measure);


decl_type: tcc
theory: generalized_measure_def
library: measure_integration
signature: nil
location: 131 0 134 999
body:
  % Judgement subtype TCC generated (at line 71, column 26) for  x
      % expected type  measure_type
  complete_measure_is_measure: OBLIGATION
    FORALL (x: complete_measure): measure?(x);


decl_type: tcc
theory: generalized_measure_def
library: measure_integration
signature: nil
location: 136 0 138 999
body:
  % Subtype TCC generated (at line 86, column 57) for  trivial_finite_measure
      % expected type  finite_measure
  finite_measure_TCC1: OBLIGATION finite_measure?(trivial_finite_measure);


decl_type: tcc
theory: generalized_measure_def
library: measure_integration
signature: nil
location: 140 0 143 999
body:
  % Judgement subtype TCC generated (at line 90, column 29) for  x
      % expected type  finite_measure
  complete_finite_measure_is_finite_measure: OBLIGATION
    FORALL (x: complete_finite_measure): finite_measure?(x);


decl_type: tcc
theory: generalized_measure_def
library: measure_integration
signature: nil
location: 145 0 148 999
body:
  % Subtype TCC generated (at line 92, column 46) for  LAMBDA a: (TRUE, m(a))
      % expected type  measure_type
  to_measure_TCC1: OBLIGATION
    FORALL (m: finite_measure): measure?(LAMBDA a: (TRUE, m(a)));


decl_type: formula
theory: subset_algebra_def
library: measure_integration
signature: nil
location: 65 2 66 59
body:
    generated_sigma_algebra_subset1: LEMMA
                        subset?(X,generated_sigma_algebra(X))


decl_type: formula
theory: subset_algebra_def
library: measure_integration
signature: nil
location: 68 2 70 59
body:
    generated_sigma_algebra_subset2: LEMMA
                    subset?(X,Y) AND sigma_algebra?(Y) =>
                        subset?(generated_sigma_algebra(X),Y)


decl_type: formula
theory: subset_algebra_def
library: measure_integration
signature: nil
location: 74 2 75 69
body:
    intersection_sigma_algebra: LEMMA FORALL (A,B:sigma_algebra):
                                      sigma_algebra?(intersection(A,B))


decl_type: formula
theory: subset_algebra_def
library: measure_integration
signature: nil
location: 89 2 90 60
body:
    generated_subset_algebra_subset1: LEMMA
                        subset?(X,generated_subset_algebra(X))


decl_type: formula
theory: subset_algebra_def
library: measure_integration
signature: nil
location: 92 2 94 60
body:
    generated_subset_algebra_subset2: LEMMA
                    subset?(X,Y) AND subset_algebra?(Y) =>
                        subset?(generated_subset_algebra(X),Y)


decl_type: formula
theory: subset_algebra_def
library: measure_integration
signature: nil
location: 98 2 99 71
body:
    intersection_subset_algebra: LEMMA FORALL (A,B:subset_algebra):
                                       subset_algebra?(intersection(A,B))


decl_type: formula
theory: subset_algebra_def
library: measure_integration
signature: nil
location: 119 2 122 61
body:
    disjoint_algebra_construction: LEMMA                             % SKB 4.6.1
      (FORALL (a,b:(NX)): member(intersection(a,b),NX)) AND
      (FORALL (a:(NX)): finite_disjoint_union?(NX)(complement(a))) =>
      generated_subset_algebra(NX) = finite_disjoint_unions(NX)


decl_type: formula
theory: subset_algebra_def
library: measure_integration
signature: nil
location: 136 2 137 52
body:
    monotone_algebra_is_sigma: LEMMA subset_algebra?(X) AND monotone?(X) =>
                                     sigma_algebra?(X)


decl_type: formula
theory: subset_algebra_def
library: measure_integration
signature: nil
location: 144 2 145 57
body:
    monotone_class: THEOREM                                           % SKB 4.6.6
      subset?(B,C) => subset?(generated_sigma_algebra(B),C)


decl_type: judgement
theory: subset_algebra_def
library: measure_integration
signature: subset_algebra
location: 57 2 58 79
body:
    sigma_algebra_is_subset_algebra:
                                JUDGEMENT sigma_algebra SUBTYPE_OF subset_algebra


decl_type: judgement
theory: subset_algebra_def
library: measure_integration
signature: monotone_class
location: 133 2 134 78
body:
    sigma_algebra_is_monotone_class:
                               JUDGEMENT sigma_algebra SUBTYPE_OF monotone_class


decl_type: function
theory: subset_algebra_def
library: measure_integration
signature: [setofsets[T] -> bool]
location: 29 2 31 52
body:
    subset_algebra?(S):bool = subset_algebra_empty?(S)      AND
                              subset_algebra_complement?(S) AND
                              subset_algebra_union?(S)


decl_type: function
theory: subset_algebra_def
library: measure_integration
signature: [setofsets[T] -> bool]
location: 33 2 35 52
body:
    sigma_algebra_union?(S): bool = FORALL X: is_countable[set[T]](X) AND
                                    (FORALL (x:(X)): member(x,S)) =>
                                    member(Union(X),S)


decl_type: function
theory: subset_algebra_def
library: measure_integration
signature: [setofsets[T] -> bool]
location: 37 2 39 50
body:
    sigma_algebra?(S):bool = subset_algebra_empty?(S)      AND
                             subset_algebra_complement?(S) AND
                             sigma_algebra_union?(S)


decl_type: function
theory: subset_algebra_def
library: measure_integration
signature: [setofsets[T] -> sigma_algebra]
location: 62 2 63 60
body:
    generated_sigma_algebra(X):sigma_algebra
      = Intersection({Y | sigma_algebra?(Y) AND subset?(X,Y)})


decl_type: function
theory: subset_algebra_def
library: measure_integration
signature: [setofsets[T] -> subset_algebra]
location: 86 2 87 61
body:
    generated_subset_algebra(X):subset_algebra
      = Intersection({Y | subset_algebra?(Y) AND subset?(X,Y)})


decl_type: function
theory: subset_algebra_def
library: measure_integration
signature: [setofsets[T] -> [set[T] -> bool]]
location: 105 2 108 54
body:
    finite_disjoint_union?(X)(a):bool
      = EXISTS E,n: disjoint?(E) AND a = IUnion(E) AND
                    (FORALL i: (i < n  => member(E(i),X)) AND
                               (i >= n => empty?(E(i))))


decl_type: function
theory: subset_algebra_def
library: measure_integration
signature: [setofsets[T] -> [set[T] -> [[sequence[set[T]], nat] -> bool]]]
location: 110 2 112 73
body:
    finite_disjoint_union_of?(X)(a)(E,n):bool
      = disjoint?(E) AND a = IUnion(E) AND
        (FORALL i: (i < n  => member(E(i),X)) AND (i >= n => empty?(E(i))))


decl_type: function
theory: subset_algebra_def
library: measure_integration
signature: [[X: setofsets[T], (finite_disjoint_union?(X))] -> nat]
location: 114 2 115 67
body:
    card(X:setofsets[T],a:(finite_disjoint_union?(X))):nat
      = min({n:nat | EXISTS E: finite_disjoint_union_of?(X)(a)(E,n)})


decl_type: function
theory: subset_algebra_def
library: measure_integration
signature: [setofsets[T] -> bool]
location: 124 2 127 64
body:
    monotone?(X):bool
      = FORALL E: (FORALL n: member(E(n),X)) =>                      % SKB 4.6.4
                  ((increasing?(E) => member(IUnion(E),X)) AND
                   (decreasing?(E) => member(IIntersection(E),X)))


decl_type: constant
theory: subset_algebra_def
library: measure_integration
signature: (subset_algebra?)
location: 47 2 48 58
body:
    trivial_subset_algebra:(subset_algebra?)
       = union(singleton(emptyset[T]),singleton(fullset[T]))


decl_type: tcc
theory: subset_algebra_def
library: measure_integration
signature: nil
location: 152 0 158 999
body:
  % Subtype TCC generated (at line 48, column 7) for
      % union(singleton(emptyset[T]), singleton(fullset[T]))
      % expected type  (subset_algebra?)
  trivial_subset_algebra_TCC1: OBLIGATION
    subset_algebra?(union[set[T]]
                        (singleton[set[T]](emptyset[T]),
                         singleton[set[T]](fullset[T])));


decl_type: tcc
theory: subset_algebra_def
library: measure_integration
signature: nil
location: 160 0 162 999
body:
  % Subtype TCC generated (at line 52, column 55) for  trivial_subset_algebra
      % expected type  sigma_algebra
  sigma_algebra_TCC1: OBLIGATION sigma_algebra?(trivial_subset_algebra);


decl_type: tcc
theory: subset_algebra_def
library: measure_integration
signature: nil
location: 164 0 167 999
body:
  % Judgement subtype TCC generated (at line 58, column 40) for  x
      % expected type  subset_algebra
  sigma_algebra_is_subset_algebra: OBLIGATION
    FORALL (x: sigma_algebra): subset_algebra?(x);


decl_type: tcc
theory: subset_algebra_def
library: measure_integration
signature: nil
location: 169 0 176 999
body:
  % Subtype TCC generated (at line 63, column 6) for
      % Intersection({Y | sigma_algebra?(Y) AND subset?(X, Y)})
      % expected type  sigma_algebra
  generated_sigma_algebra_TCC1: OBLIGATION
    FORALL (X: setofsets[T]):
      sigma_algebra?(Intersection[setof[T]]
                         ({Y |
                             sigma_algebra?(Y) AND subset?[setof[T]](X, Y)}));


decl_type: tcc
theory: subset_algebra_def
library: measure_integration
signature: nil
location: 178 0 186 999
body:
  % Subtype TCC generated (at line 87, column 6) for
      % Intersection({Y | subset_algebra?(Y) AND subset?(X, Y)})
      % expected type  subset_algebra
  generated_subset_algebra_TCC1: OBLIGATION
    FORALL (X: setofsets[T]):
      subset_algebra?(Intersection[setof[T]]
                          ({Y |
                              subset_algebra?(Y) AND
                               subset?[setof[T]](X, Y)}));


decl_type: tcc
theory: subset_algebra_def
library: measure_integration
signature: nil
location: 188 0 194 999
body:
  % Subtype TCC generated (at line 115, column 10) for
      % {n: nat | EXISTS E: finite_disjoint_union_of?(X)(a)(E, n)}
      % expected type  S: (nonempty?[nat])
  card_TCC1: OBLIGATION
    FORALL (X: setofsets[T], a: (finite_disjoint_union?(X))):
      nonempty?[nat]
          ({n: nat | EXISTS E: finite_disjoint_union_of?(X)(a)(E, n)});


decl_type: tcc
theory: subset_algebra_def
library: measure_integration
signature: nil
location: 196 0 198 999
body:
  % Subtype TCC generated (at line 129, column 49) for  trivial_subset_algebra
      % expected type  monotone_class
  monotone_class_TCC1: OBLIGATION monotone?(trivial_subset_algebra);


decl_type: tcc
theory: subset_algebra_def
library: measure_integration
signature: nil
location: 200 0 203 999
body:
  % Judgement subtype TCC generated (at line 134, column 39) for  x
      % expected type  monotone_class
  sigma_algebra_is_monotone_class: OBLIGATION
    FORALL (x: sigma_algebra): monotone?(x);


decl_type: tcc
theory: subset_algebra
library: measure_integration
signature: nil
location: 27 0 29 999
body:
  % Judgement subtype TCC generated (at line 15, column 41) for  emptyset[T]
      % expected type  (S)
  subset_algebra_emptyset: OBLIGATION S(emptyset[T]);


decl_type: tcc
theory: subset_algebra
library: measure_integration
signature: nil
location: 31 0 33 999
body:
  % Judgement subtype TCC generated (at line 16, column 41) for  fullset[T]
      % expected type  (S)
  subset_algebra_fullset: OBLIGATION S(fullset[T]);


decl_type: tcc
theory: subset_algebra
library: measure_integration
signature: nil
location: 35 0 37 999
body:
  % Judgement subtype TCC generated (at line 17, column 41) for  complement(x)
      % expected type  (S)
  subset_algebra_complement: OBLIGATION FORALL (x): S(complement[T](x));


decl_type: tcc
theory: subset_algebra
library: measure_integration
signature: nil
location: 39 0 41 999
body:
  % Judgement subtype TCC generated (at line 18, column 41) for  union(x, y)
      % expected type  (S)
  subset_algebra_union: OBLIGATION FORALL (x, y): S(union[T](x, y));


decl_type: tcc
theory: subset_algebra
library: measure_integration
signature: nil
location: 43 0 47 999
body:
  % Judgement subtype TCC generated (at line 19, column 41) for
      % intersection(x, y)
      % expected type  (S)
  subset_algebra_intersection: OBLIGATION
    FORALL (x, y): S(intersection[T](x, y));


decl_type: tcc
theory: subset_algebra
library: measure_integration
signature: nil
location: 49 0 52 999
body:
  % Judgement subtype TCC generated (at line 20, column 41) for
      % difference(x, y)
      % expected type  (S)
  subset_algebra_difference: OBLIGATION FORALL (x, y): S(difference[T](x, y));


decl_type: formula
theory: measure_def
library: measure_integration
signature: nil
location: 61 2 66 66
body:
    measure_def: LEMMA                                 % generalized SKB 2.6 Ex 4
     (measure?(f) <=>
      (measure_empty?(f) AND
       (FORALL (a,b:(S)): disjoint?(a,b)
                              => x_eq(f(union(a,b)),x_add(f(a),f(b)))) AND
       (FORALL X: S(IUnion(X)) => x_le(f(IUnion(X)),x_sum(f o X)))))


decl_type: formula
theory: measure_def
library: measure_integration
signature: nil
location: 68 2 73 55
body:
    finite_measure_def: LEMMA
      finite_measure?(g) <=>
       (g(emptyset[T]) = 0 AND
        (FORALL (a,b:(S)): disjoint?(a,b) => g(union(a,b)) = g(a)+g(b)) AND
        (FORALL X: S(IUnion(X)) AND convergent(series(g o X)) =>
                   g(IUnion(X)) <= limit(series(g o X))))


decl_type: formula
theory: measure_def
library: measure_integration
signature: nil
location: 89 2 91 78
body:
    sigma_finite_def1: LEMMA
      sigma_finite_measure?(f) <=>
      (measure?(f) AND EXISTS X: IUnion(X) = fullset[T] AND FORALL i: f(X(i))`1)


decl_type: formula
theory: measure_def
library: measure_integration
signature: nil
location: 93 2 95 78
body:
    sigma_finite_def2: LEMMA
      sigma_finite_measure?(f) <=>
      (measure?(f) AND EXISTS P: IUnion(P) = fullset[T] AND FORALL i: f(P(i))`1)


decl_type: type
theory: measure_def
library: measure_integration
signature: nil
location: 33 2 34 73
body:
    increasing_indexed_measurable: TYPE+ = 
         (increasing_indexed_measurable?) CONTAINING (LAMBDA i: fullset[T])


decl_type: judgement
theory: measure_def
library: measure_integration
signature: measure_type[T, S]
location: 51 2 52 70
body:
    sigma_finite_measure_is_measure:
                  JUDGEMENT sigma_finite_measure SUBTYPE_OF measure_type


decl_type: judgement
theory: measure_def
library: measure_integration
signature: complete_measure[T, S]
location: 53 2 54 75
body:
    complete_sigma_finite_is_complete_measure:
                  JUDGEMENT complete_sigma_finite SUBTYPE_OF complete_measure


decl_type: judgement
theory: measure_def
library: measure_integration
signature: sigma_finite_measure
location: 55 2 56 79
body:
    complete_sigma_finite_is_sigma_finite_measure:
                  JUDGEMENT complete_sigma_finite SUBTYPE_OF sigma_finite_measure


decl_type: function
theory: measure_def
library: measure_integration
signature: [[(S) -> extended_nnreal] -> bool]
location: 42 2 43 59
body:
    complete_sigma_finite?(f):bool = measure?(f) AND measure_complete?(f) AND
                                     measure_sigma_finite?(f)


decl_type: function
theory: measure_def
library: measure_integration
signature: [sigma_finite_measure -> disjoint_indexed_measurable[T, S]]
location: 75 2 76 66
body:
    A_of(f:sigma_finite_measure):disjoint_indexed_measurable
      = choose({X | IUnion(X) = fullset[T] AND FORALL i: f(X(i))`1})


decl_type: function
theory: measure_def
library: measure_integration
signature: [sigma_finite_measure -> [nat -> (S)]]
location: 78 2 79 72
body:
    P_of(f:sigma_finite_measure)(n):(S)
      = IUnion(lambda i: IF i <= n THEN A_of(f)(i) ELSE emptyset[T] ENDIF)


decl_type: constant
theory: measure_def
library: measure_integration
signature: measure_type[T, S]
location: 48 2 49 74
body:
    discrete_measure:measure_type
     = lambda a: IF is_finite(a) THEN (TRUE,card[T](a)) ELSE (FALSE,0) ENDIF


decl_type: tcc
theory: measure_def
library: measure_integration
signature: nil
location: 102 0 105 999
body:
  % Assuming TCC generated (at line 18, column 12) for
      % generalized_measure_def[T, S]
      % generated from assumption generalized_measure_def.S_empty
  IMP_generalized_measure_def_TCC1: OBLIGATION S(emptyset[T]);


decl_type: tcc
theory: measure_def
library: measure_integration
signature: nil
location: 107 0 110 999
body:
  % Subtype TCC generated (at line 34, column 52) for  (LAMBDA i: fullset[T])
      % expected type  increasing_indexed_measurable
  increasing_indexed_measurable_TCC1: OBLIGATION
    increasing_indexed_measurable?((LAMBDA i: fullset[T]));


decl_type: tcc
theory: measure_def
library: measure_integration
signature: nil
location: 112 0 115 999
body:
  % Subtype TCC generated (at line 45, column 67) for  zero_measure
      % expected type  sigma_finite_measure
  sigma_finite_measure_TCC1: OBLIGATION
    sigma_finite_measure?(zero_measure[T, S]);


decl_type: tcc
theory: measure_def
library: measure_integration
signature: nil
location: 117 0 124 999
body:
  % Subtype TCC generated (at line 49, column 5) for
      % LAMBDA a:
      %   IF is_finite(a) THEN (TRUE, card[T](a)) ELSE (FALSE, 0) ENDIF
      % expected type  measure_type[T, S]
  discrete_measure_TCC1: OBLIGATION
    measure?[T, S]
        (LAMBDA a:
           IF is_finite[T](a) THEN (TRUE, card[T](a)) ELSE (FALSE, 0) ENDIF);


decl_type: tcc
theory: measure_def
library: measure_integration
signature: nil
location: 126 0 129 999
body:
  % Judgement subtype TCC generated (at line 52, column 26) for  x
      % expected type  measure_type[T, S]
  sigma_finite_measure_is_measure: OBLIGATION
    FORALL (x: sigma_finite_measure): measure?[T, S](x);


decl_type: tcc
theory: measure_def
library: measure_integration
signature: nil
location: 131 0 134 999
body:
  % Judgement subtype TCC generated (at line 54, column 26) for  x
      % expected type  complete_measure[T, S]
  complete_sigma_finite_is_complete_measure: OBLIGATION
    FORALL (x: complete_sigma_finite): complete_measure?[T, S](x);


decl_type: tcc
theory: measure_def
library: measure_integration
signature: nil
location: 136 0 139 999
body:
  % Judgement subtype TCC generated (at line 56, column 26) for  x
      % expected type  sigma_finite_measure
  complete_sigma_finite_is_sigma_finite_measure: OBLIGATION
    FORALL (x: complete_sigma_finite): sigma_finite_measure?(x);


decl_type: tcc
theory: measure_def
library: measure_integration
signature: nil
location: 141 0 147 999
body:
  % Subtype TCC generated (at line 76, column 13) for
      % {X | IUnion(X) = fullset[T] AND (FORALL i: f(X(i))`1)}
      % expected type  p: (nonempty?[disjoint_indexed_measurable[T, S]])
  A_of_TCC1: OBLIGATION
    FORALL (f: sigma_finite_measure):
      nonempty?[disjoint_indexed_measurable[T, S]]
          ({X | IUnion[nat, T](X) = fullset[T] AND (FORALL i: f(X(i))`1)});


decl_type: tcc
theory: measure_def
library: measure_integration
signature: nil
location: 149 0 155 999
body:
  % Subtype TCC generated (at line 79, column 6) for
      % IUnion(LAMBDA i: IF i <= n THEN A_of(f)(i) ELSE emptyset[T] ENDIF)
      % expected type  (S)
  P_of_TCC1: OBLIGATION
    FORALL (f: sigma_finite_measure, n: nat):
      S(IUnion[nat, T]
            (LAMBDA i: IF i <= n THEN A_of(f)(i) ELSE emptyset[T] ENDIF));


decl_type: tcc
theory: sigma_algebra
library: measure_integration
signature: nil
location: 43 0 45 999
body:
  % Judgement subtype TCC generated (at line 35, column 45) for  IUnion(SS)
      % expected type  (S)
  sigma_algebra_IUnion_rew: OBLIGATION FORALL (SS): S(IUnion[nat, T](SS));


decl_type: tcc
theory: sigma_algebra
library: measure_integration
signature: nil
location: 47 0 51 999
body:
  % Judgement subtype TCC generated (at line 36, column 45) for
      % IIntersection(SS)
      % expected type  (S)
  sigma_algebra_IIntersection_rew: OBLIGATION
    FORALL (SS): S(IIntersection[nat, T](SS));


decl_type: formula
theory: borel
library: measure_integration
signature: nil
location: 57 2 58 73
body:
    borel_countable_basis: LEMMA is_countable(B) =>
                                        borel? = generated_sigma_algebra(B)


decl_type: tcc
theory: borel
library: measure_integration
signature: nil
location: 65 0 67 999
body:
  % Subtype TCC generated (at line 26, column 37) for  emptyset[T]
      % expected type  borel
  borel_TCC1: OBLIGATION borel?(emptyset[T]);


decl_type: tcc
theory: borel
library: measure_integration
signature: nil
location: 69 0 71 999
body:
  % Judgement subtype TCC generated (at line 48, column 41) for  x
      % expected type  borel
  open_is_borel_judge: OBLIGATION FORALL (x: open): borel?(x);


decl_type: tcc
theory: borel
library: measure_integration
signature: nil
location: 73 0 75 999
body:
  % Judgement subtype TCC generated (at line 49, column 41) for  x
      % expected type  borel
  closed_is_borel_judge: OBLIGATION FORALL (x: closed): borel?(x);


decl_type: formula
theory: real_borel
library: measure_integration
signature: nil
location: 19 2 20 69
body:
    borel_generated_by_rational_open_interval: LEMMA
      borel? = generated_sigma_algebra(fullset[rational_open_interval])


decl_type: formula
theory: real_borel
library: measure_integration
signature: nil
location: 22 2 23 60
body:
    borel_generated_by_open_interval: LEMMA
      borel? = generated_sigma_algebra(fullset[open_interval])


decl_type: formula
theory: real_borel
library: measure_integration
signature: nil
location: 64 2 65 71
body:
    borel_generated_by_left_semiclosed_interval: LEMMA
      borel? = generated_sigma_algebra(fullset[left_semiclosed_interval])


decl_type: formula
theory: real_borel
library: measure_integration
signature: nil
location: 67 2 68 72
body:
    borel_generated_by_right_semiclosed_interval: LEMMA
      borel? = generated_sigma_algebra(fullset[right_semiclosed_interval])


decl_type: judgement
theory: real_borel
library: measure_integration
signature: borel[real, metric_induced_topology]
location: 57 2 58 79
body:
    left_semiclosed_interval_is_borel:
                             JUDGEMENT left_semiclosed_interval  SUBTYPE_OF borel


decl_type: judgement
theory: real_borel
library: measure_integration
signature: borel[real, metric_induced_topology]
location: 59 2 60 79
body:
    right_semiclosed_interval_is_borel:
                             JUDGEMENT right_semiclosed_interval SUBTYPE_OF borel


decl_type: tcc
theory: real_borel
library: measure_integration
signature: nil
location: 75 0 82 999
body:
  % Judgement subtype TCC generated (at line 55, column 38) for  x
      % expected type  borel[real, metric_induced_topology]
  open_interval_is_borel: OBLIGATION
    FORALL (x1: open_interval):
      borel?
          [real,
           metric_induced_topology[real, (LAMBDA (x, y: real): abs(x - y))]]
          (x1);


decl_type: tcc
theory: real_borel
library: measure_integration
signature: nil
location: 84 0 91 999
body:
  % Judgement subtype TCC generated (at line 56, column 38) for  x
      % expected type  borel[real, metric_induced_topology]
  closed_interval_is_borel: OBLIGATION
    FORALL (x1: closed_interval):
      borel?
          [real,
           metric_induced_topology[real, (LAMBDA (x, y: real): abs(x - y))]]
          (x1);


decl_type: tcc
theory: real_borel
library: measure_integration
signature: nil
location: 93 0 100 999
body:
  % Judgement subtype TCC generated (at line 58, column 37) for  x
      % expected type  borel[real, metric_induced_topology]
  left_semiclosed_interval_is_borel: OBLIGATION
    FORALL (x1: left_semiclosed_interval):
      borel?
          [real,
           metric_induced_topology[real, (LAMBDA (x, y: real): abs(x - y))]]
          (x1);


decl_type: tcc
theory: real_borel
library: measure_integration
signature: nil
location: 102 0 109 999
body:
  % Judgement subtype TCC generated (at line 60, column 37) for  x
      % expected type  borel[real, metric_induced_topology]
  right_semiclosed_interval_is_borel: OBLIGATION
    FORALL (x1: right_semiclosed_interval):
      borel?
          [real,
           metric_induced_topology[real, (LAMBDA (x, y: real): abs(x - y))]]
          (x1);


decl_type: formula
theory: measure_space_def
library: measure_integration
signature: nil
location: 66 2 68 63
body:
    measurable_def: LEMMA borel? = generated_sigma_algebra(U) =>
                          (measurable_function?(f) <=>
                           FORALL (X:(U)): S(inverse_image(f,X)))


decl_type: formula
theory: measure_space_def
library: measure_integration
signature: nil
location: 70 2 71 72
body:
    measurable_def2: LEMMA measurable_function?(f) <=> 
                           FORALL (i:open_interval): S(inverse_image(f,i))


decl_type: judgement
theory: measure_space_def
library: measure_integration
signature: measurable_function
location: 61 2 62 79
body:
    constant_is_measurable: JUDGEMENT (constant?[T,real]) SUBTYPE_OF
                                                              measurable_function


decl_type: tcc
theory: measure_space_def
library: measure_integration
signature: nil
location: 93 0 95 999
body:
  % Subtype TCC generated (at line 37, column 55) for  emptyset[T]
      % expected type  measurable_set
  measurable_set_TCC1: OBLIGATION measurable_set?(emptyset[T]);


decl_type: tcc
theory: measure_space_def
library: measure_integration
signature: nil
location: 97 0 99 999
body:
  % Judgement subtype TCC generated (at line 43, column 38) for  emptyset[T]
      % expected type  measurable_set
  measurable_emptyset: OBLIGATION measurable_set?(emptyset[T]);


decl_type: tcc
theory: measure_space_def
library: measure_integration
signature: nil
location: 101 0 103 999
body:
  % Judgement subtype TCC generated (at line 44, column 38) for  fullset[T]
      % expected type  measurable_set
  measurable_fullset: OBLIGATION measurable_set?(fullset[T]);


decl_type: tcc
theory: measure_space_def
library: measure_integration
signature: nil
location: 105 0 108 999
body:
  % Judgement subtype TCC generated (at line 45, column 38) for  complement(a)
      % expected type  measurable_set
  measurable_complement: OBLIGATION
    FORALL (a): measurable_set?(complement[T](a));


decl_type: tcc
theory: measure_space_def
library: measure_integration
signature: nil
location: 110 0 112 999
body:
  % Judgement subtype TCC generated (at line 46, column 38) for  union(a, b)
      % expected type  measurable_set
  measurable_union: OBLIGATION FORALL (a, b): measurable_set?(union[T](a, b));


decl_type: tcc
theory: measure_space_def
library: measure_integration
signature: nil
location: 114 0 118 999
body:
  % Judgement subtype TCC generated (at line 47, column 38) for
      % intersection(a, b)
      % expected type  measurable_set
  measurable_intersection: OBLIGATION
    FORALL (a, b): measurable_set?(intersection[T](a, b));


decl_type: tcc
theory: measure_space_def
library: measure_integration
signature: nil
location: 120 0 124 999
body:
  % Judgement subtype TCC generated (at line 48, column 38) for
      % difference(a, b)
      % expected type  measurable_set
  measurable_difference: OBLIGATION
    FORALL (a, b): measurable_set?(difference[T](a, b));


decl_type: tcc
theory: measure_space_def
library: measure_integration
signature: nil
location: 126 0 129 999
body:
  % Subtype TCC generated (at line 49, column 44) for  M
      % expected type  setofsets[T]
  measurable_Union_TCC1: OBLIGATION
    FORALL (M, x: setof[T]): M(x) IMPLIES (S)(x);


decl_type: tcc
theory: measure_space_def
library: measure_integration
signature: nil
location: 131 0 133 999
body:
  % Judgement subtype TCC generated (at line 49, column 38) for  Union(M)
      % expected type  measurable_set
  measurable_Union: OBLIGATION FORALL (M): measurable_set?(Union[T](M));


decl_type: tcc
theory: measure_space_def
library: measure_integration
signature: nil
location: 135 0 139 999
body:
  % Judgement subtype TCC generated (at line 50, column 38) for
      % Intersection(M)
      % expected type  measurable_set
  measurable_Intersection: OBLIGATION
    FORALL (M): measurable_set?(Intersection[T](M));


decl_type: tcc
theory: measure_space_def
library: measure_integration
signature: nil
location: 141 0 144 999
body:
  % Judgement subtype TCC generated (at line 51, column 38) for  IUnion(SS)
      % expected type  measurable_set
  measurable_IUnion: OBLIGATION
    FORALL (SS): measurable_set?(IUnion[nat, T](SS));


decl_type: tcc
theory: measure_space_def
library: measure_integration
signature: nil
location: 146 0 150 999
body:
  % Judgement subtype TCC generated (at line 52, column 38) for
      % IIntersection(SS)
      % expected type  measurable_set
  measurable_IIntersection: OBLIGATION
    FORALL (SS): measurable_set?(IIntersection[nat, T](SS));


decl_type: tcc
theory: measure_space_def
library: measure_integration
signature: nil
location: 152 0 154 999
body:
  % Subtype TCC generated (at line 56, column 66) for  (LAMBDA x: 0)
      % expected type  measurable_function
  measurable_function_TCC1: OBLIGATION measurable_function?((LAMBDA x: 0));


decl_type: tcc
theory: measure_space_def
library: measure_integration
signature: nil
location: 156 0 159 999
body:
  % Judgement subtype TCC generated (at line 61, column 36) for  x
      % expected type  measurable_function
  constant_is_measurable: OBLIGATION
    FORALL (x: (constant?[T, real])): measurable_function?(x);


decl_type: tcc
theory: measure_space_def
library: measure_integration
signature: nil
location: 161 0 163 999
body:
  % Judgement subtype TCC generated (at line 83, column 30) for  c * g
      % expected type  measurable_function
  scal_measurable: OBLIGATION FORALL (c, g): measurable_function?(*[T](c, g));


decl_type: tcc
theory: measure_space_def
library: measure_integration
signature: nil
location: 165 0 168 999
body:
  % Judgement subtype TCC generated (at line 84, column 30) for  g1 + g2
      % expected type  measurable_function
  sum_measurable: OBLIGATION
    FORALL (g1, g2): measurable_function?((+[T])(g1, g2));


decl_type: tcc
theory: measure_space_def
library: measure_integration
signature: nil
location: 170 0 172 999
body:
  % Judgement subtype TCC generated (at line 85, column 30) for  -g
      % expected type  measurable_function
  opp_measurable: OBLIGATION FORALL (g): measurable_function?(-g);


decl_type: tcc
theory: measure_space_def
library: measure_integration
signature: nil
location: 174 0 177 999
body:
  % Judgement subtype TCC generated (at line 86, column 30) for  g1 - g2
      % expected type  measurable_function
  diff_measurable: OBLIGATION
    FORALL (g1, g2): measurable_function?((-[T])(g1, g2));


decl_type: formula
theory: measure_props
library: measure_integration
signature: nil
location: 41 2 42 67
body:
    m_increasing_convergence: LEMMA increasing?(E) =>                     % 2.6.2
                                    x_converges?(m o E, m(IUnion(E)))


decl_type: formula
theory: measure_props
library: measure_integration
signature: nil
location: 44 2 45 74
body:
    m_decreasing_convergence: LEMMA decreasing?(E) AND mu_fin?(E(0)) =>   % 2.6.3
                                    x_converges?(m o E, m(IIntersection(E)))


decl_type: tcc
theory: measure_props
library: measure_integration
signature: nil
location: 51 0 53 999
body:
  % Subtype TCC generated (at line 31, column 40) for  M
      % expected type  (S)
  mu_fin?_TCC1: OBLIGATION FORALL (M: measurable_set[T, S]): S(M);


decl_type: tcc
theory: measure_props
library: measure_integration
signature: nil
location: 55 0 57 999
body:
  % Subtype TCC generated (at line 32, column 24) for  m
      % expected type  measurable_set[T, S]
  mu_TCC1: OBLIGATION FORALL (m: (S)): measurable_set?[T, S](m);


decl_type: tcc
theory: measure_props
library: measure_integration
signature: nil
location: 59 0 63 999
body:
  % Subtype TCC generated (at line 37, column 50) for  union(a, b)
      % expected type  (S)
  m_disjoint_union_TCC1: OBLIGATION
    FORALL (a, b: measurable_set[T, S]):
      disjoint?(a, b) IMPLIES S(union[T](a, b));


decl_type: tcc
theory: measure_props
library: measure_integration
signature: nil
location: 65 0 68 999
body:
  % Subtype TCC generated (at line 37, column 75) for  b
      % expected type  (S)
  m_disjoint_union_TCC2: OBLIGATION
    FORALL (a, b: measurable_set[T, S]): disjoint?(a, b) IMPLIES S(b);


decl_type: tcc
theory: measure_props
library: measure_integration
signature: nil
location: 70 0 73 999
body:
  % Subtype TCC generated (at line 38, column 53) for  b
      % expected type  (S)
  m_monotone_TCC1: OBLIGATION
    FORALL (a, b: measurable_set[T, S]): subset?(a, b) IMPLIES S(b);


decl_type: tcc
theory: measure_props
library: measure_integration
signature: nil
location: 75 0 78 999
body:
  % Subtype TCC generated (at line 39, column 32) for  union(a, b)
      % expected type  (S)
  m_union_TCC1: OBLIGATION
    FORALL (a, b: measurable_set[T, S]): S(union[T](a, b));


decl_type: tcc
theory: measure_props
library: measure_integration
signature: nil
location: 80 0 84 999
body:
  % Subtype TCC generated (at line 42, column 51) for  E
      % expected type  [nat -> (S)]
  m_increasing_convergence_TCC1: OBLIGATION
    FORALL (E: sequence[measurable_set]):
      increasing?(E) IMPLIES (FORALL (x1: nat): S(E(x1)));


decl_type: tcc
theory: measure_props
library: measure_integration
signature: nil
location: 86 0 90 999
body:
  % Subtype TCC generated (at line 42, column 56) for  IUnion(E)
      % expected type  (S)
  m_increasing_convergence_TCC2: OBLIGATION
    FORALL (E: sequence[measurable_set]):
      increasing?(E) IMPLIES S(IUnion[nat, T](E));


decl_type: tcc
theory: measure_props
library: measure_integration
signature: nil
location: 92 0 96 999
body:
  % Subtype TCC generated (at line 45, column 51) for  E
      % expected type  [nat -> (S)]
  m_decreasing_convergence_TCC1: OBLIGATION
    FORALL (E: sequence[measurable_set]):
      mu_fin?(E(0)) AND decreasing?(E) IMPLIES (FORALL (x1: nat): S(E(x1)));


decl_type: tcc
theory: measure_props
library: measure_integration
signature: nil
location: 98 0 102 999
body:
  % Subtype TCC generated (at line 45, column 56) for  IIntersection(E)
      % expected type  (S)
  m_decreasing_convergence_TCC2: OBLIGATION
    FORALL (E: sequence[measurable_set]):
      mu_fin?(E(0)) AND decreasing?(E) IMPLIES S(IIntersection[nat, T](E));


decl_type: formula
theory: measure_theory
library: measure_integration
signature: nil
location: 41 2 42 64
body:
    negligible_iff_measurable_null: LEMMA
      (negligible_set?(X) AND measurable_set?(X)) <=> null_set?(X)


decl_type: formula
theory: measure_theory
library: measure_integration
signature: nil
location: 53 2 54 39
body:
    null_Union: LEMMA every(null_set?,Z) AND is_countable(Z) =>
                      null_set?(Union(Z))


decl_type: formula
theory: measure_theory
library: measure_integration
signature: nil
location: 61 2 62 52
body:
    negligible_Union:  LEMMA every(negligible_set?,Z) AND is_countable(Z) =>
                             negligible_set?(Union(Z))


decl_type: formula
theory: measure_theory
library: measure_integration
signature: nil
location: 96 2 97 69
body:
    ae_convergence_eq:     LEMMA ae_convergence?(F,f) =>
                                 (ae_convergence?(F,g) <=> ae_eq?(f,g))


decl_type: formula
theory: measure_theory
library: measure_integration
signature: nil
location: 98 2 100 51
body:
    ae_eq_convergence:     LEMMA ae_convergence?(F,f) AND
                                 (FORALL n: ae_eq?(F(n),G(n))) =>
                                 ae_convergence?(G,f)


decl_type: function
theory: measure_theory
library: measure_integration
signature: [set[T] -> [set[T] -> bool]]
location: 66 2 67 64
body:
    ae_in?(P)(X):bool = EXISTS E: FORALL (x:(X)):
                                  (NOT member(x,E)) => member(x,P)


decl_type: function
theory: measure_theory
library: measure_integration
signature: [sequence[[T -> real]] -> bool]
location: 101 2 103 53
body:
    ae_increasing?(F):bool
      = EXISTS E: FORALL x: NOT member(x,E) =>
               FORALL i,j: i <= j => F(i)(x) <= F(j)(x)


decl_type: function
theory: measure_theory
library: measure_integration
signature: [sequence[[T -> real]] -> bool]
location: 105 2 107 53
body:
    ae_decreasing?(F):bool
      = EXISTS E: FORALL x: NOT member(x,E) =>
               FORALL i,j: i <= j => F(j)(x) <= F(i)(x)


decl_type: function
theory: measure_theory
library: measure_integration
signature: [[sequence[[T -> real]], [T -> real]] -> bool]
location: 109 2 110 71
body:
    ae_monotonic_converges?(F,f):bool
      = ae_convergence?(F,f) AND (ae_increasing?(F) OR ae_decreasing?(F))


decl_type: tcc
theory: measure_theory
library: measure_integration
signature: nil
location: 124 0 127 999
body:
  % Subtype TCC generated (at line 29, column 63) for  X
      % expected type  {m1: (S) | mu_fin?(m1)}
  null_set?_TCC1: OBLIGATION
    FORALL (X: set[T]): mu_fin?(X) AND measurable_set?(X) IMPLIES S(X);


decl_type: tcc
theory: measure_theory
library: measure_integration
signature: nil
location: 129 0 131 999
body:
  % Subtype TCC generated (at line 33, column 51) for  emptyset[T]
      % expected type  null_set
  null_set_TCC1: OBLIGATION null_set?(emptyset[T]);


decl_type: tcc
theory: measure_theory
library: measure_integration
signature: nil
location: 133 0 135 999
body:
  % Subtype TCC generated (at line 34, column 51) for  emptyset[T]
      % expected type  negligible
  negligible_TCC1: OBLIGATION negligible_set?(emptyset[T]);


decl_type: tcc
theory: measure_theory
library: measure_integration
signature: nil
location: 137 0 140 999
body:
  % Judgement subtype TCC generated (at line 44, column 36) for  x
      % expected type  measurable_set[T, S]
  null_set_is_measurable: OBLIGATION
    FORALL (x: null_set): measurable_set?[T, S](x);


decl_type: tcc
theory: measure_theory
library: measure_integration
signature: nil
location: 142 0 144 999
body:
  % Judgement subtype TCC generated (at line 45, column 36) for  x
      % expected type  negligible
  null_is_negligible: OBLIGATION FORALL (x: null_set): negligible_set?(x);


decl_type: tcc
theory: measure_theory
library: measure_integration
signature: nil
location: 146 0 148 999
body:
  % Judgement subtype TCC generated (at line 47, column 31) for  emptyset[T]
      % expected type  null_set
  null_emptyset: OBLIGATION null_set?(emptyset[T]);


decl_type: tcc
theory: measure_theory
library: measure_integration
signature: nil
location: 150 0 152 999
body:
  % Judgement subtype TCC generated (at line 48, column 31) for  union(N1, N2)
      % expected type  null_set
  null_union: OBLIGATION FORALL (N1, N2): null_set?(union[T](N1, N2));


decl_type: tcc
theory: measure_theory
library: measure_integration
signature: nil
location: 154 0 158 999
body:
  % Judgement subtype TCC generated (at line 49, column 31) for
      % intersection(N1, N2)
      % expected type  null_set
  null_intersection: OBLIGATION
    FORALL (N1, N2): null_set?(intersection[T](N1, N2));


decl_type: tcc
theory: measure_theory
library: measure_integration
signature: nil
location: 160 0 164 999
body:
  % Judgement subtype TCC generated (at line 50, column 31) for
      % difference(N1, N2)
      % expected type  null_set
  null_difference: OBLIGATION
    FORALL (N1, N2): null_set?(difference[T](N1, N2));


decl_type: tcc
theory: measure_theory
library: measure_integration
signature: nil
location: 166 0 168 999
body:
  % Judgement subtype TCC generated (at line 51, column 31) for  IUnion(NS)
      % expected type  null_set
  null_IUnion: OBLIGATION FORALL (NS): null_set?(IUnion[nat, T](NS));


decl_type: tcc
theory: measure_theory
library: measure_integration
signature: nil
location: 170 0 173 999
body:
  % Judgement subtype TCC generated (at line 57, column 37) for  union(E1, E2)
      % expected type  negligible
  negligible_union: OBLIGATION
    FORALL (E1, E2): negligible_set?(union[T](E1, E2));


decl_type: tcc
theory: measure_theory
library: measure_integration
signature: nil
location: 175 0 179 999
body:
  % Judgement subtype TCC generated (at line 58, column 37) for
      % intersection(E1, E2)
      % expected type  negligible
  negligible_intersection: OBLIGATION
    FORALL (E1, E2): negligible_set?(intersection[T](E1, E2));


decl_type: tcc
theory: measure_theory
library: measure_integration
signature: nil
location: 181 0 184 999
body:
  % Judgement subtype TCC generated (at line 59, column 37) for  IUnion(ES)
      % expected type  negligible
  negligible_IUnion: OBLIGATION
    FORALL (ES): negligible_set?(IUnion[nat, T](ES));


decl_type: formula
theory: pointwise_convergence
library: measure_integration
signature: nil
location: 32 2 34 61
body:
    pointwise_bounded_def: LEMMA pointwise_bounded?(u) <=>
                                  (pointwise_bounded_above?(u) AND
                                   pointwise_bounded_below?(u))


decl_type: formula
theory: pointwise_convergence
library: measure_integration
signature: nil
location: 59 2 61 69
body:
    pointwise_convergence_sum:  LEMMA pointwise_convergence?(u,f0) AND
                                      pointwise_convergence?(v,f1)      =>
                                      pointwise_convergence?(u+v,f0+f1)


decl_type: formula
theory: pointwise_convergence
library: measure_integration
signature: nil
location: 63 2 64 67
body:
    pointwise_convergence_scal: LEMMA pointwise_convergence?(u,f)       =>
                                      pointwise_convergence?(c*u,c*f)


decl_type: formula
theory: pointwise_convergence
library: measure_integration
signature: nil
location: 66 2 67 65
body:
    pointwise_convergence_opp:  LEMMA pointwise_convergence?(u,f)       =>
                                      pointwise_convergence?(-u,-f)


decl_type: formula
theory: pointwise_convergence
library: measure_integration
signature: nil
location: 69 2 71 69
body:
    pointwise_convergence_diff: LEMMA pointwise_convergence?(u,f0) AND
                                      pointwise_convergence?(v,f1)      =>
                                      pointwise_convergence?(u-v,f0-f1)


decl_type: formula
theory: pointwise_convergence
library: measure_integration
signature: nil
location: 92 2 95 47
body:
    plus_minus_pointwise_convergence: LEMMA
      pointwise_convergence?(u,f)                    <=>
      (pointwise_convergence?(plus(u), plus(f))  AND 
       pointwise_convergence?(minus(u),minus(f)))


decl_type: formula
theory: pointwise_convergence
library: measure_integration
signature: nil
location: 111 2 112 68
body:
    inf_pointwise_le:         LEMMA pointwise_convergence?(p,f)        =>
                                    (FORALL n,x: inf(p)(n)(x) <= f(x))


decl_type: formula
theory: pointwise_convergence
library: measure_integration
signature: nil
location: 116 2 117 75
body:
    inf_pointwise_convergence_upto: LEMMA pointwise_convergence?(p,f) =>
                                          pointwise_converges_upto?(inf(p),f)


decl_type: formula
theory: pointwise_convergence
library: measure_integration
signature: nil
location: 119 2 122 57
body:
    pointwise_convergence_plus_minus_def: LEMMA
      pointwise_convergence?(u,f)                               =>
       (pointwise_converges_upto?(inf(plus(u)),  plus(f))   AND
        pointwise_converges_upto?(inf(minus(u)), minus(f)))


decl_type: judgement
theory: pointwise_convergence
library: measure_integration
signature: pointwise_bounded_above
location: 40 2 41 77
body:
    pointwise_bounded_is_bounded_above:
          JUDGEMENT pointwise_bounded        SUBTYPE_OF pointwise_bounded_above


decl_type: judgement
theory: pointwise_convergence
library: measure_integration
signature: pointwise_bounded_below
location: 42 2 43 77
body:
    pointwise_bounded_is_bounded_below:
          JUDGEMENT pointwise_bounded        SUBTYPE_OF pointwise_bounded_below


decl_type: judgement
theory: pointwise_convergence
library: measure_integration
signature: pointwise_bounded
location: 80 2 81 79
body:
    pointwise_convergent_is_pointwise_bounded:
                      JUDGEMENT pointwise_convergent SUBTYPE_OF pointwise_bounded


decl_type: function
theory: pointwise_convergence
library: measure_integration
signature: [[sequence[[T -> real]], [T -> real]] -> bool]
location: 86 2 87 69
body:
    pointwise_converges_upto?(u,f):bool
             = pointwise_convergence?(u,f) AND pointwise_increasing?(u)


decl_type: function
theory: pointwise_convergence
library: measure_integration
signature: [[sequence[[T -> real]], [T -> real]] -> bool]
location: 89 2 90 69
body:
    pointwise_converges_downto?(u,f):bool
             = pointwise_convergence?(u,f) AND pointwise_decreasing?(u)


decl_type: tcc
theory: pointwise_convergence
library: measure_integration
signature: nil
location: 129 0 131 999
body:
  % Subtype TCC generated (at line 36, column 71) for  zero_seq
      % expected type  pointwise_bounded_above
  pointwise_bounded_above_TCC1: OBLIGATION pointwise_bounded_above?(zero_seq);


decl_type: tcc
theory: pointwise_convergence
library: measure_integration
signature: nil
location: 133 0 135 999
body:
  % Subtype TCC generated (at line 37, column 71) for  zero_seq
      % expected type  pointwise_bounded_below
  pointwise_bounded_below_TCC1: OBLIGATION pointwise_bounded_below?(zero_seq);


decl_type: tcc
theory: pointwise_convergence
library: measure_integration
signature: nil
location: 137 0 139 999
body:
  % Subtype TCC generated (at line 38, column 71) for  zero_seq
      % expected type  pointwise_bounded
  pointwise_bounded_TCC1: OBLIGATION pointwise_bounded?(zero_seq);


decl_type: tcc
theory: pointwise_convergence
library: measure_integration
signature: nil
location: 141 0 144 999
body:
  % Judgement subtype TCC generated (at line 41, column 18) for  x
      % expected type  pointwise_bounded_above
  pointwise_bounded_is_bounded_above: OBLIGATION
    FORALL (x: pointwise_bounded): pointwise_bounded_above?(x);


decl_type: tcc
theory: pointwise_convergence
library: measure_integration
signature: nil
location: 146 0 149 999
body:
  % Judgement subtype TCC generated (at line 43, column 18) for  x
      % expected type  pointwise_bounded_below
  pointwise_bounded_is_bounded_below: OBLIGATION
    FORALL (x: pointwise_bounded): pointwise_bounded_below?(x);


decl_type: tcc
theory: pointwise_convergence
library: measure_integration
signature: nil
location: 151 0 153 999
body:
  % Subtype TCC generated (at line 48, column 70) for  zero_seq
      % expected type  pointwise_convergent
  pointwise_convergent_TCC1: OBLIGATION pointwise_convergent?(zero_seq);


decl_type: tcc
theory: pointwise_convergence
library: measure_integration
signature: nil
location: 155 0 158 999
body:
  % Judgement subtype TCC generated (at line 75, column 39) for  w0 + w1
      % expected type  pointwise_convergent
  pointwise_convergent_sum: OBLIGATION
    FORALL (w0, w1): pointwise_convergent?(w0 + w1);


decl_type: tcc
theory: pointwise_convergence
library: measure_integration
signature: nil
location: 160 0 163 999
body:
  % Judgement subtype TCC generated (at line 76, column 39) for  c * w
      % expected type  pointwise_convergent
  pointwise_convergent_scal: OBLIGATION
    FORALL (c, w): pointwise_convergent?(c * w);


decl_type: tcc
theory: pointwise_convergence
library: measure_integration
signature: nil
location: 165 0 167 999
body:
  % Judgement subtype TCC generated (at line 77, column 39) for  -w
      % expected type  pointwise_convergent
  pointwise_convergent_opp: OBLIGATION FORALL (w): pointwise_convergent?(-w);


decl_type: tcc
theory: pointwise_convergence
library: measure_integration
signature: nil
location: 169 0 172 999
body:
  % Judgement subtype TCC generated (at line 78, column 39) for  w0 - w1
      % expected type  pointwise_convergent
  pointwise_convergent_diff: OBLIGATION
    FORALL (w0, w1): pointwise_convergent?(w0 - w1);


decl_type: tcc
theory: pointwise_convergence
library: measure_integration
signature: nil
location: 174 0 177 999
body:
  % Judgement subtype TCC generated (at line 81, column 30) for  x
      % expected type  pointwise_bounded
  pointwise_convergent_is_pointwise_bounded: OBLIGATION
    FORALL (x: pointwise_convergent): pointwise_bounded?(x);


decl_type: tcc
theory: pointwise_convergence
library: measure_integration
signature: nil
location: 179 0 185 999
body:
  % Subtype TCC generated (at line 101, column 26) for
      % image[nat, real](LAMBDA m: p(m)(x), {m | m >= n})
      % expected type  Sl: inf_set[real]
  inf_TCC1: OBLIGATION
    FORALL (p: pointwise_bounded_below, n: nat, x: T):
      nonempty?[real](image[nat, real](LAMBDA m: p(m)(x), {m | m >= n})) AND
       below_bounded[real](image[nat, real](LAMBDA m: p(m)(x), {m | m >= n}));


decl_type: tcc
theory: pointwise_convergence
library: measure_integration
signature: nil
location: 187 0 195 999
body:
  % Subtype TCC generated (at line 102, column 26) for
      % image[nat, real](LAMBDA m: inf(b)(m)(x), fullset[nat])
      % expected type  Su: sup_set[real]
  limsup_TCC1: OBLIGATION
    FORALL (b: pointwise_bounded, x: T):
      nonempty?[real](image[nat, real](LAMBDA m: inf(b)(m)(x), fullset[nat]))
       AND
       above_bounded[real]
           (image[nat, real](LAMBDA m: inf(b)(m)(x), fullset[nat]));


decl_type: tcc
theory: pointwise_convergence
library: measure_integration
signature: nil
location: 197 0 203 999
body:
  % Subtype TCC generated (at line 103, column 26) for
      % image[nat, real](LAMBDA m: a(m)(x), {m | m >= n})
      % expected type  Su: sup_set[real]
  sup_TCC1: OBLIGATION
    FORALL (a: pointwise_bounded_above, n: nat, x: T):
      nonempty?[real](image[nat, real](LAMBDA m: a(m)(x), {m | m >= n})) AND
       above_bounded[real](image[nat, real](LAMBDA m: a(m)(x), {m | m >= n}));


decl_type: tcc
theory: pointwise_convergence
library: measure_integration
signature: nil
location: 205 0 213 999
body:
  % Subtype TCC generated (at line 104, column 26) for
      % image[nat, real](LAMBDA m: sup(b)(m)(x), fullset[nat])
      % expected type  Sl: inf_set[real]
  liminf_TCC1: OBLIGATION
    FORALL (b: pointwise_bounded, x: T):
      nonempty?[real](image[nat, real](LAMBDA m: sup(b)(m)(x), fullset[nat]))
       AND
       below_bounded[real]
           (image[nat, real](LAMBDA m: sup(b)(m)(x), fullset[nat]));


decl_type: tcc
theory: pointwise_convergence
library: measure_integration
signature: nil
location: 215 0 218 999
body:
  % Subtype TCC generated (at line 106, column 44) for  -a
      % expected type  pointwise_bounded_below
  sup_inf_def_TCC1: OBLIGATION
    FORALL (a: pointwise_bounded_above): pointwise_bounded_below?(-a);


decl_type: tcc
theory: pointwise_convergence
library: measure_integration
signature: nil
location: 220 0 223 999
body:
  % Subtype TCC generated (at line 107, column 47) for  -b
      % expected type  pointwise_bounded
  liminf_limsup_def_TCC1: OBLIGATION
    FORALL (b: pointwise_bounded): pointwise_bounded?(-b);


decl_type: tcc
theory: pointwise_convergence
library: measure_integration
signature: nil
location: 225 0 229 999
body:
  % Subtype TCC generated (at line 121, column 36) for  plus(u)
      % expected type  pointwise_bounded_below
  pointwise_convergence_plus_minus_def_TCC1: OBLIGATION
    FORALL (f: [T -> real], u: sequence[[T -> real]]):
      pointwise_convergence?(u, f) IMPLIES pointwise_bounded_below?(plus(u));


decl_type: tcc
theory: pointwise_convergence
library: measure_integration
signature: nil
location: 231 0 237 999
body:
  % Subtype TCC generated (at line 122, column 36) for  minus(u)
      % expected type  pointwise_bounded_below
  pointwise_convergence_plus_minus_def_TCC2: OBLIGATION
    FORALL (f: [T -> real], u: sequence[[T -> real]]):
      pointwise_convergence?(u, f) AND
       pointwise_converges_upto?(inf(plus(u)), plus(f))
       IMPLIES pointwise_bounded_below?(minus(u));


decl_type: formula
theory: sup_norm
library: measure_integration
signature: nil
location: 44 2 46 65
body:
    sup_norm_prop: LEMMA
         (FORALL x: abs(f(x)) <= sup_norm(f)) AND
         (FORALL c: (FORALL x: abs(f(x)) <= c) => sup_norm(f) <= c)


decl_type: formula
theory: sup_norm
library: measure_integration
signature: nil
location: 63 2 64 63
body:
    sup_norm_converges_to_pointwise_convergence: LEMMA
       sup_norm_converges_to?(u,f) => pointwise_convergence?(u,f)


decl_type: type
theory: sup_norm
library: measure_integration
signature: nil
location: 55 2 56 59
body:
    sup_norm_convergent: TYPE+ = (sup_norm_convergent?) CONTAINING
                                      (LAMBDA n: LAMBDA x: 0)


decl_type: judgement
theory: sup_norm
library: measure_integration
signature: pointwise_convergent[T]
location: 60 2 61 79
body:
    sup_norm_convergent_is_pointwise_convergent: JUDGEMENT
                              sup_norm_convergent SUBTYPE_OF pointwise_convergent


decl_type: function
theory: sup_norm
library: measure_integration
signature: [bounded -> nnreal]
location: 37 2 38 53
body:
    sup_norm(f):nnreal = IF EXISTS x: TRUE THEN sup({c | EXISTS x: abs(f(x))=c})
                                           ELSE 0 ENDIF


decl_type: function
theory: sup_norm
library: measure_integration
signature: [[sequence[bounded], bounded] -> bool]
location: 50 2 51 78
body:
    sup_norm_converges_to?(u,f):bool
      = FORALL epsilon: EXISTS n: FORALL i: i >= n => sup_norm(u(i)-f) < epsilon


decl_type: tcc
theory: sup_norm
library: measure_integration
signature: nil
location: 71 0 73 999
body:
  % Subtype TCC generated (at line 28, column 42) for  (LAMBDA x: 0)
      % expected type  bounded
  bounded_TCC1: OBLIGATION bounded?((LAMBDA x: 0));


decl_type: tcc
theory: sup_norm
library: measure_integration
signature: nil
location: 75 0 77 999
body:
  % Judgement subtype TCC generated (at line 32, column 26) for  f1 + f2
      % expected type  bounded
  bounded_add: OBLIGATION FORALL (f1, f2): bounded?((+[T])(f1, f2));


decl_type: tcc
theory: sup_norm
library: measure_integration
signature: nil
location: 79 0 81 999
body:
  % Judgement subtype TCC generated (at line 33, column 26) for  y * f
      % expected type  bounded
  bounded_scal: OBLIGATION FORALL (f, y): bounded?(*[T](y, f));


decl_type: tcc
theory: sup_norm
library: measure_integration
signature: nil
location: 83 0 85 999
body:
  % Judgement subtype TCC generated (at line 34, column 26) for  -f
      % expected type  bounded
  bounded_opp: OBLIGATION FORALL (f): bounded?(-f);


decl_type: tcc
theory: sup_norm
library: measure_integration
signature: nil
location: 87 0 89 999
body:
  % Judgement subtype TCC generated (at line 35, column 26) for  f1 - f2
      % expected type  bounded
  bounded_diff: OBLIGATION FORALL (f1, f2): bounded?((-[T])(f1, f2));


decl_type: tcc
theory: sup_norm
library: measure_integration
signature: nil
location: 91 0 102 999
body:
  % Subtype TCC generated (at line 37, column 50) for
      % extend[real, nnreal, bool, FALSE]({c | EXISTS x: abs(f(x)) = c})
      % expected type  Su: sup_set[real]
  sup_norm_TCC1: OBLIGATION
    FORALL (f: bounded):
      (EXISTS x: TRUE) IMPLIES
       nonempty?[real]
           (extend[real, nnreal, bool, FALSE]({c | EXISTS x: abs(f(x)) = c}))
        AND
        above_bounded[real]
            (extend[real, nnreal, bool, FALSE]
                 ({c | EXISTS x: abs(f(x)) = c}));


decl_type: tcc
theory: sup_norm
library: measure_integration
signature: nil
location: 104 0 112 999
body:
  % Subtype TCC generated (at line 37, column 46) for
      % sup(extend[real, nnreal, bool, FALSE]({c | EXISTS x: abs(f(x)) = c}))
      % expected type  nnreal
  sup_norm_TCC2: OBLIGATION
    FORALL (f: bounded):
      (EXISTS x: TRUE) IMPLIES
       sup[real]
           (extend[real, nnreal, bool, FALSE]({c | EXISTS x: abs(f(x)) = c}))
        >= 0;


decl_type: tcc
theory: sup_norm
library: measure_integration
signature: nil
location: 114 0 117 999
body:
  % Subtype TCC generated (at line 56, column 37) for  (LAMBDA n: LAMBDA x: 0)
      % expected type  sup_norm_convergent
  sup_norm_convergent_TCC1: OBLIGATION
    sup_norm_convergent?((LAMBDA n: LAMBDA x: 0));


decl_type: tcc
theory: sup_norm
library: measure_integration
signature: nil
location: 119 0 122 999
body:
  % Judgement subtype TCC generated (at line 61, column 28) for  x
      % expected type  pointwise_convergent[T]
  sup_norm_convergent_is_pointwise_convergent: OBLIGATION
    FORALL (x: sup_norm_convergent): pointwise_convergent?[T](x);


decl_type: type
theory: partitions
library: measure_integration
signature: nil
location: 27 2 28 77
body:
    partition: TYPE+ = (LAMBDA A: partition?(A,fullset[T])) CONTAINING
                                                  singleton[set[T]](fullset[T])


decl_type: type
theory: partitions
library: measure_integration
signature: nil
location: 30 2 31 72
body:
    finite_partition: TYPE+ = (LAMBDA A: finite_partition?(A,fullset[T]))
                                  CONTAINING singleton[set[T]](fullset[T])


decl_type: tcc
theory: partitions
library: measure_integration
signature: nil
location: 45 0 49 999
body:
  % Subtype TCC generated (at line 28, column 48) for
      % singleton[set[T]](fullset[T])
      % expected type  partition
  partition_TCC1: OBLIGATION
    partition?(singleton[set[T]](fullset[T]), fullset[T]);


decl_type: tcc
theory: partitions
library: measure_integration
signature: nil
location: 51 0 55 999
body:
  % Subtype TCC generated (at line 31, column 43) for
      % singleton[set[T]](fullset[T])
      % expected type  finite_partition
  finite_partition_TCC1: OBLIGATION
    finite_partition?(singleton[set[T]](fullset[T]), fullset[T]);


decl_type: tcc
theory: partitions
library: measure_integration
signature: nil
location: 57 0 65 999
body:
  % Subtype TCC generated (at line 38, column 6) for
      % {a | EXISTS (a1: (p1), a2: (p2)): a = intersection(a1, a2)}
      % expected type  finite_partition
  join_TCC1: OBLIGATION
    FORALL (p1: finite_partition, p2: finite_partition):
      finite_partition?({a |
                           EXISTS (a1: (p1), a2: (p2)):
                             a = intersection[T](a1, a2)},
                        fullset[T]);


decl_type: formula
theory: borel_functions
library: measure_integration
signature: nil
location: 26 2 27 77
body:
    borel_function_def: LEMMA borel_function?(f) IFF
                              FORALL X: borel?[T1,S](inverse_image[T1,T2](f,X))


decl_type: tcc
theory: borel_functions
library: measure_integration
signature: nil
location: 40 0 42 999
body:
  % Judgement subtype TCC generated (at line 33, column 33) for  x
      % expected type  borel_function
  continuous_is_borel: OBLIGATION FORALL (x: continuous): borel_function?(x);


decl_type: formula
theory: measure_space
library: measure_integration
signature: nil
location: 72 2 75 55
body:
    measurable_plus_minus: LEMMA
         measurable_function?[T,S](f) <=>
                    (measurable_function?[T,S](plus(f)) AND
                     measurable_function?[T,S](minus(f)))            % SKB 4.1.15


decl_type: formula
theory: measure_space
library: measure_integration
signature: nil
location: 101 2 102 60
body:
    inf_measurable: LEMMA FORALL (u:measurable_bounded_below):
                          measurable_function?[T,S](inf(u)(n))


decl_type: formula
theory: measure_space
library: measure_integration
signature: nil
location: 104 2 105 60
body:
    sup_measurable: LEMMA FORALL (u:measurable_bounded_above):
                          measurable_function?[T,S](sup(u)(n))       % SKB 4.1.19


decl_type: formula
theory: measure_space
library: measure_integration
signature: nil
location: 107 2 108 79
body:
    pointwise_measurable: LEMMA pointwise_convergence?(u,f) =>       % SKB 4.1.20
                                                     measurable_function?[T,S](f)


decl_type: formula
theory: measure_space
library: measure_integration
signature: nil
location: 151 2 153 75
body:
    simple_def1: LEMMA simple?(f) <=>                                % SKB 4.1.23
        (is_finite(image(f,fullset[T])) AND
         (FORALL (y:(image(f,fullset[T]))): measurable_set?({x | y = f(x)})))


decl_type: formula
theory: measure_space
library: measure_integration
signature: nil
location: 157 2 158 72
body:
    simple_def2: LEMMA simple?(f) <=>
                       EXISTS P: every(S,P) AND every(constant_over?(f),P)


decl_type: formula
theory: measure_space
library: measure_integration
signature: nil
location: 191 2 192 65
body:
    sup_norm_simple: LEMMA EXISTS h: (forall x: 0 <= h(x) & h(x) <= p(x)) AND
                                     sup_norm(p-h) <= sup_norm(p)/2  % SKB 4.1.24


decl_type: formula
theory: measure_space
library: measure_integration
signature: nil
location: 206 2 207 66
body:
    nn_bounded_measurable_as_increasing_simple_sequence:             % SKB 4.1.25
                         LEMMA EXISTS w: sup_norm_converges_to?(w,p)


decl_type: formula
theory: measure_space
library: measure_integration
signature: nil
location: 209 2 210 77
body:
    nn_bounded_measurable_as_sequence_prop: LEMMA sup_norm_converges_to?(w,p) =>
                                                  (FORALL n,x: w(n)(x) <= p(x))


decl_type: formula
theory: measure_space
library: measure_integration
signature: nil
location: 212 2 213 67
body:
    bounded_measurable_as_increasing_sequence: LEMMA                 % SKB 4.1.25
      bounded_measurable?(f) => EXISTS v: sup_norm_converges_to?(v,f)


decl_type: formula
theory: measure_space
library: measure_integration
signature: nil
location: 215 2 216 74
body:
    nn_measurable_def: LEMMA (FORALL x: 0 <= f(x)) =>                % SKB 4.1.26
      (measurable_function?(f) <=> EXISTS w: pointwise_converges_upto?(w,f))


decl_type: formula
theory: measure_space
library: measure_integration
signature: nil
location: 218 2 219 69
body:
    measurable_as_limit_simple_def: LEMMA                            % SKB 4.1.26
      measurable_function?(f) <=> EXISTS v: pointwise_convergence?(v,f)


decl_type: type
theory: measure_space
library: measure_integration
signature: nil
location: 82 2 83 79
body:
    measurable_bounded_above: TYPE+ = (measurable_bounded_above?)
                                               CONTAINING (lambda n: lambda x: 0)


decl_type: type
theory: measure_space
library: measure_integration
signature: nil
location: 84 2 85 79
body:
    measurable_bounded_below: TYPE+ = (measurable_bounded_below?)
                                               CONTAINING (lambda n: lambda x: 0)


decl_type: type
theory: measure_space
library: measure_integration
signature: nil
location: 86 2 87 79
body:
    measurable_bounded:       TYPE+ = (measurable_bounded?)
                                               CONTAINING (lambda n: lambda x: 0)


decl_type: type
theory: measure_space
library: measure_integration
signature: nil
location: 176 2 177 66
body:
    nn_bounded_measurable: TYPE+ = (nn_bounded_measurable?)
                                            CONTAINING (lambda x: 0)


decl_type: type
theory: measure_space
library: measure_integration
signature: nil
location: 185 2 186 79
body:
    increasing_nn_simple: TYPE+ = (increasing_nn_simple?)
                                               CONTAINING (lambda n: lambda x: 0)


decl_type: judgement
theory: measure_space
library: measure_integration
signature: measurable_function[T, S]
location: 47 2 48 59
body:
    borel_comp_measurable_is_measurable:
         JUDGEMENT o(phi,g) HAS_TYPE measurable_function[T,S]        % SKB 4.1.12


decl_type: judgement
theory: measure_space
library: measure_integration
signature: measurable_function[T, S]
location: 55 2 56 74
body:
    nn_measurable_is_measurable:
                      JUDGEMENT nn_measurable SUBTYPE_OF measurable_function


decl_type: judgement
theory: measure_space
library: measure_integration
signature: measurable_function[T, S]
location: 68 2 69 79
body:
    expt_measurable:     JUDGEMENT ^(g:nn_measurable,a)
                                                HAS_TYPE measurable_function[T,S]


decl_type: judgement
theory: measure_space
library: measure_integration
signature: pointwise_bounded_above[T]
location: 90 2 91 77
body:
    measurable_bounded_above_is_bounded_above:
          JUDGEMENT measurable_bounded_above SUBTYPE_OF pointwise_bounded_above


decl_type: judgement
theory: measure_space
library: measure_integration
signature: pointwise_bounded_below[T]
location: 92 2 93 77
body:
    measurable_bounded_below_is_bounded_below:
          JUDGEMENT measurable_bounded_below SUBTYPE_OF pointwise_bounded_below


decl_type: judgement
theory: measure_space
library: measure_integration
signature: measurable_bounded_above
location: 94 2 95 78
body:
    measurable_bounded_is_measurable_bounded_above:
          JUDGEMENT measurable_bounded       SUBTYPE_OF measurable_bounded_above


decl_type: judgement
theory: measure_space
library: measure_integration
signature: measurable_bounded_below
location: 96 2 97 78
body:
    measurable_bounded_is_measurable_bounded_below:
          JUDGEMENT measurable_bounded       SUBTYPE_OF measurable_bounded_below


decl_type: judgement
theory: measure_space
library: measure_integration
signature: pointwise_bounded[T]
location: 98 2 99 71
body:
    measurable_bounded_is_bounded:
          JUDGEMENT measurable_bounded       SUBTYPE_OF pointwise_bounded


decl_type: judgement
theory: measure_space
library: measure_integration
signature: bounded[T]
location: 167 2 168 67
body:
    bounded_measurable_is_bounded:
                      JUDGEMENT bounded_measurable SUBTYPE_OF bounded


decl_type: judgement
theory: measure_space
library: measure_integration
signature: measurable_function[T, S]
location: 169 2 170 79
body:
    bounded_measurable_is_measurable:
                      JUDGEMENT bounded_measurable SUBTYPE_OF measurable_function


decl_type: judgement
theory: measure_space
library: measure_integration
signature: bounded_measurable
location: 171 2 172 78
body:
    simple_is_bounded_measurable:
                      JUDGEMENT simple             SUBTYPE_OF bounded_measurable


decl_type: judgement
theory: measure_space
library: measure_integration
signature: bounded_measurable
location: 179 2 180 79
body:
    nn_bounded_measurable_is_bounded_measurable:
                    JUDGEMENT nn_bounded_measurable SUBTYPE_OF bounded_measurable


decl_type: function
theory: measure_space
library: measure_integration
signature: [[T -> real] -> bool]
location: 110 2 111 50
body:
    simple?(f):bool = measurable_function?[T,S](f) AND
                      is_finite(image(f,fullset[T]))                 % SKB 4.1.21


decl_type: function
theory: measure_space
library: measure_integration
signature: [sequence[measurable_function[T, S]] -> bool]
location: 182 2 183 58
body:
    increasing_nn_simple?(u):bool = (FORALL n: nn_simple?(u(n))) AND 
                                    pointwise_increasing?(u)


decl_type: function
theory: measure_space
library: measure_integration
signature: [nn_bounded_measurable -> nn_simple]
location: 194 2 196 63
body:
    nn_simple_approx(p):nn_simple
      = choose({h | (forall x: 0 <= h(x) & h(x) <= p(x)) AND
                                 sup_norm(p-h) <= sup_norm(p)/2})


decl_type: function
theory: measure_space
library: measure_integration
signature:
  [p: nn_bounded_measurable ->
  [nat -> {h | FORALL x: 0 <= h(x) & h(x) <= p(x)}]]

location: 201 2 204 37
body:
    nn_simple_sequence(p)(n): RECURSIVE {h | forall x: 0 <= h(x) & h(x) <= p(x)}
      = IF n = 0 THEN nn_simple_approx(p)
                 ELSE nn_simple_sequence(p-nn_simple_approx(p))(n-1) ENDIF
        MEASURE (lambda p: lambda n: n)


decl_type: tcc
theory: measure_space
library: measure_integration
signature: nil
location: 226 0 230 999
body:
  % Subtype TCC generated (at line 26, column 42) for
      % (LAMBDA (x, y: real): abs(x - y))
      % expected type  metric[real]
  IMP_metric_continuity_TCC1: OBLIGATION
    metric?[real]((LAMBDA (x, y: real): abs(x - y)));


decl_type: tcc
theory: measure_space
library: measure_integration
signature: nil
location: 232 0 235 999
body:
  % Judgement subtype TCC generated (at line 48, column 17) for  phi o g
      % expected type  measurable_function[T, S]
  borel_comp_measurable_is_measurable: OBLIGATION
    FORALL (g, phi): measurable_function?[T, S](o[T, real, real](phi, g));


decl_type: tcc
theory: measure_space
library: measure_integration
signature: nil
location: 237 0 239 999
body:
  % Subtype TCC generated (at line 53, column 54) for  (LAMBDA x: 0)
      % expected type  nn_measurable
  nn_measurable_TCC1: OBLIGATION nn_measurable?((LAMBDA x: 0));


decl_type: tcc
theory: measure_space
library: measure_integration
signature: nil
location: 241 0 244 999
body:
  % Judgement subtype TCC generated (at line 56, column 30) for  x
      % expected type  measurable_function[T, S]
  nn_measurable_is_measurable: OBLIGATION
    FORALL (x: nn_measurable): measurable_function?[T, S](x);


decl_type: tcc
theory: measure_space
library: measure_integration
signature: nil
location: 246 0 249 999
body:
  % Judgement subtype TCC generated (at line 58, column 33) for  abs(g)
      % expected type  measurable_function[T, S]
  abs_measurable: OBLIGATION
    FORALL (g): measurable_function?[T, S](abs[T](g));


decl_type: tcc
theory: measure_space
library: measure_integration
signature: nil
location: 251 0 254 999
body:
  % Judgement subtype TCC generated (at line 59, column 33) for  expt(g, n)
      % expected type  measurable_function[T, S]
  expt_nat_measurable: OBLIGATION
    FORALL (g, n): measurable_function?[T, S](expt[T](g, n));


decl_type: tcc
theory: measure_space
library: measure_integration
signature: nil
location: 256 0 258 999
body:
  % Judgement subtype TCC generated (at line 60, column 33) for  sq(g)
      % expected type  measurable_function[T, S]
  sq_measurable: OBLIGATION FORALL (g): measurable_function?[T, S](sq[T](g));


decl_type: tcc
theory: measure_space
library: measure_integration
signature: nil
location: 260 0 263 999
body:
  % Judgement subtype TCC generated (at line 61, column 33) for  min(g1, g2)
      % expected type  measurable_function[T, S]
  min_measurable: OBLIGATION
    FORALL (g1, g2): measurable_function?[T, S](min[T](g1, g2));


decl_type: tcc
theory: measure_space
library: measure_integration
signature: nil
location: 265 0 268 999
body:
  % Judgement subtype TCC generated (at line 62, column 33) for  max(g1, g2)
      % expected type  measurable_function[T, S]
  max_measurable: OBLIGATION
    FORALL (g1, g2): measurable_function?[T, S](max[T](g1, g2));


decl_type: tcc
theory: measure_space
library: measure_integration
signature: nil
location: 270 0 273 999
body:
  % Judgement subtype TCC generated (at line 63, column 33) for  minimum(u, n)
      % expected type  measurable_function[T, S]
  minimum_measurable: OBLIGATION
    FORALL (n, u): measurable_function?[T, S](minimum[T](u, n));


decl_type: tcc
theory: measure_space
library: measure_integration
signature: nil
location: 275 0 278 999
body:
  % Judgement subtype TCC generated (at line 64, column 33) for  maximum(u, n)
      % expected type  measurable_function[T, S]
  maximum_measurable: OBLIGATION
    FORALL (n, u): measurable_function?[T, S](maximum[T](u, n));


decl_type: tcc
theory: measure_space
library: measure_integration
signature: nil
location: 280 0 283 999
body:
  % Judgement subtype TCC generated (at line 65, column 33) for  plus(g)
      % expected type  measurable_function[T, S]
  plus_measurable: OBLIGATION
    FORALL (g): measurable_function?[T, S](plus[T](g));


decl_type: tcc
theory: measure_space
library: measure_integration
signature: nil
location: 285 0 288 999
body:
  % Judgement subtype TCC generated (at line 66, column 33) for  minus(g)
      % expected type  measurable_function[T, S]
  minus_measurable: OBLIGATION
    FORALL (g): measurable_function?[T, S](minus[T](g));


decl_type: tcc
theory: measure_space
library: measure_integration
signature: nil
location: 290 0 293 999
body:
  % Judgement subtype TCC generated (at line 67, column 33) for  g1 * g2
      % expected type  measurable_function[T, S]
  prod_measurable: OBLIGATION
    FORALL (g1, g2): measurable_function?[T, S](*[T](g1, g2));


decl_type: tcc
theory: measure_space
library: measure_integration
signature: nil
location: 295 0 298 999
body:
  % Subtype TCC generated (at line 68, column 35) for  g
      % expected type  [T -> nnreal]
  expt_measurable_TCC1: OBLIGATION
    FORALL (g: nn_measurable, x1: T): g(x1) >= 0;


decl_type: tcc
theory: measure_space
library: measure_integration
signature: nil
location: 300 0 303 999
body:
  % Judgement subtype TCC generated (at line 68, column 33) for  g ^ a
      % expected type  measurable_function[T, S]
  expt_measurable: OBLIGATION
    FORALL (a, g: nn_measurable): measurable_function?[T, S](^[T](g, a));


decl_type: tcc
theory: measure_space
library: measure_integration
signature: nil
location: 305 0 308 999
body:
  % Subtype TCC generated (at line 83, column 67) for  LAMBDA x: 0
      % expected type  measurable_function[T, S]
  measurable_bounded_above_TCC1: OBLIGATION
    measurable_function?[T, S](LAMBDA x: 0);


decl_type: tcc
theory: measure_space
library: measure_integration
signature: nil
location: 310 0 313 999
body:
  % Subtype TCC generated (at line 83, column 57) for  (LAMBDA n: LAMBDA x: 0)
      % expected type  measurable_bounded_above
  measurable_bounded_above_TCC2: OBLIGATION
    measurable_bounded_above?((LAMBDA n: LAMBDA x: 0));


decl_type: tcc
theory: measure_space
library: measure_integration
signature: nil
location: 315 0 318 999
body:
  % Subtype TCC generated (at line 85, column 57) for  (LAMBDA n: LAMBDA x: 0)
      % expected type  measurable_bounded_below
  measurable_bounded_below_TCC1: OBLIGATION
    measurable_bounded_below?((LAMBDA n: LAMBDA x: 0));


decl_type: tcc
theory: measure_space
library: measure_integration
signature: nil
location: 320 0 323 999
body:
  % Subtype TCC generated (at line 87, column 57) for  (LAMBDA n: LAMBDA x: 0)
      % expected type  measurable_bounded
  measurable_bounded_TCC1: OBLIGATION
    measurable_bounded?((LAMBDA n: LAMBDA x: 0));


decl_type: tcc
theory: measure_space
library: measure_integration
signature: nil
location: 325 0 328 999
body:
  % Judgement subtype TCC generated (at line 91, column 18) for  x
      % expected type  pointwise_bounded_above[T]
  measurable_bounded_above_is_bounded_above: OBLIGATION
    FORALL (x: measurable_bounded_above): pointwise_bounded_above?[T](x);


decl_type: tcc
theory: measure_space
library: measure_integration
signature: nil
location: 330 0 333 999
body:
  % Judgement subtype TCC generated (at line 93, column 18) for  x
      % expected type  pointwise_bounded_below[T]
  measurable_bounded_below_is_bounded_below: OBLIGATION
    FORALL (x: measurable_bounded_below): pointwise_bounded_below?[T](x);


decl_type: tcc
theory: measure_space
library: measure_integration
signature: nil
location: 335 0 338 999
body:
  % Judgement subtype TCC generated (at line 95, column 18) for  x
      % expected type  measurable_bounded_above
  measurable_bounded_is_measurable_bounded_above: OBLIGATION
    FORALL (x: measurable_bounded): measurable_bounded_above?(x);


decl_type: tcc
theory: measure_space
library: measure_integration
signature: nil
location: 340 0 343 999
body:
  % Judgement subtype TCC generated (at line 97, column 18) for  x
      % expected type  measurable_bounded_below
  measurable_bounded_is_measurable_bounded_below: OBLIGATION
    FORALL (x: measurable_bounded): measurable_bounded_below?(x);


decl_type: tcc
theory: measure_space
library: measure_integration
signature: nil
location: 345 0 348 999
body:
  % Judgement subtype TCC generated (at line 99, column 18) for  x
      % expected type  pointwise_bounded[T]
  measurable_bounded_is_bounded: OBLIGATION
    FORALL (x: measurable_bounded): pointwise_bounded?[T](x);


decl_type: tcc
theory: measure_space
library: measure_integration
signature: nil
location: 350 0 352 999
body:
  % Subtype TCC generated (at line 113, column 40) for  (LAMBDA x: 0)
      % expected type  simple
  simple_TCC1: OBLIGATION simple?((LAMBDA x: 0));


decl_type: tcc
theory: measure_space
library: measure_integration
signature: nil
location: 354 0 357 999
body:
  % Judgement subtype TCC generated (at line 115, column 34) for  x
      % expected type  measurable_function[T, S]
  simple_is_measurable: OBLIGATION
    FORALL (x: simple): measurable_function?[T, S](x);


decl_type: tcc
theory: measure_space
library: measure_integration
signature: nil
location: 359 0 361 999
body:
  % Subtype TCC generated (at line 119, column 46) for  (LAMBDA x: 0)
      % expected type  nn_simple
  nn_simple_TCC1: OBLIGATION nn_simple?((LAMBDA x: 0));


decl_type: tcc
theory: measure_space
library: measure_integration
signature: nil
location: 363 0 365 999
body:
  % Judgement subtype TCC generated (at line 121, column 33) for  x
      % expected type  simple
  nn_simple_is_simple: OBLIGATION FORALL (x: nn_simple): simple?(x);


decl_type: tcc
theory: measure_space
library: measure_integration
signature: nil
location: 367 0 369 999
body:
  % Judgement subtype TCC generated (at line 126, column 29) for  sq(h)
      % expected type  simple
  simple_sq: OBLIGATION FORALL (h): simple?(sq[T](h));


decl_type: tcc
theory: measure_space
library: measure_integration
signature: nil
location: 371 0 373 999
body:
  % Judgement subtype TCC generated (at line 127, column 29) for  h1 + h2
      % expected type  simple
  simple_add: OBLIGATION FORALL (h1, h2): simple?((+[T])(h1, h2));


decl_type: tcc
theory: measure_space
library: measure_integration
signature: nil
location: 375 0 377 999
body:
  % Judgement subtype TCC generated (at line 128, column 29) for  c * h
      % expected type  simple
  simple_scal: OBLIGATION FORALL (c, h): simple?(*[T](c, h));


decl_type: tcc
theory: measure_space
library: measure_integration
signature: nil
location: 379 0 381 999
body:
  % Judgement subtype TCC generated (at line 129, column 29) for  -h
      % expected type  simple
  simple_neg: OBLIGATION FORALL (h): simple?(-h);


decl_type: tcc
theory: measure_space
library: measure_integration
signature: nil
location: 383 0 385 999
body:
  % Judgement subtype TCC generated (at line 130, column 29) for  h1 - h2
      % expected type  simple
  simple_diff: OBLIGATION FORALL (h1, h2): simple?((-[T])(h1, h2));


decl_type: tcc
theory: measure_space
library: measure_integration
signature: nil
location: 387 0 389 999
body:
  % Judgement subtype TCC generated (at line 131, column 29) for  abs(h)
      % expected type  simple
  simple_abs: OBLIGATION FORALL (h): simple?(abs[T](h));


decl_type: tcc
theory: measure_space
library: measure_integration
signature: nil
location: 391 0 393 999
body:
  % Judgement subtype TCC generated (at line 132, column 29) for  min(h1, h2)
      % expected type  simple
  simple_min: OBLIGATION FORALL (h1, h2): simple?(min[T](h1, h2));


decl_type: tcc
theory: measure_space
library: measure_integration
signature: nil
location: 395 0 397 999
body:
  % Judgement subtype TCC generated (at line 133, column 29) for  max(h1, h2)
      % expected type  simple
  simple_max: OBLIGATION FORALL (h1, h2): simple?(max[T](h1, h2));


decl_type: tcc
theory: measure_space
library: measure_integration
signature: nil
location: 399 0 401 999
body:
  % Judgement subtype TCC generated (at line 134, column 29) for  maximum(v, n)
      % expected type  simple
  simple_maximum: OBLIGATION FORALL (n, v): simple?(maximum[T](v, n));


decl_type: tcc
theory: measure_space
library: measure_integration
signature: nil
location: 403 0 405 999
body:
  % Judgement subtype TCC generated (at line 135, column 29) for  minimum(v, n)
      % expected type  simple
  simple_minimum: OBLIGATION FORALL (n, v): simple?(minimum[T](v, n));


decl_type: tcc
theory: measure_space
library: measure_integration
signature: nil
location: 407 0 409 999
body:
  % Judgement subtype TCC generated (at line 136, column 29) for  plus(h)
      % expected type  simple
  simple_plus: OBLIGATION FORALL (h): simple?(plus[T](h));


decl_type: tcc
theory: measure_space
library: measure_integration
signature: nil
location: 411 0 413 999
body:
  % Judgement subtype TCC generated (at line 137, column 29) for  minus(h)
      % expected type  simple
  simple_minus: OBLIGATION FORALL (h): simple?(minus[T](h));


decl_type: tcc
theory: measure_space
library: measure_integration
signature: nil
location: 415 0 417 999
body:
  % Judgement subtype TCC generated (at line 138, column 29) for  h1 * h2
      % expected type  simple
  simple_times: OBLIGATION FORALL (h1, h2): simple?(*[T](h1, h2));


decl_type: tcc
theory: measure_space
library: measure_integration
signature: nil
location: 419 0 421 999
body:
  % Judgement subtype TCC generated (at line 139, column 29) for  expt(h, n)
      % expected type  simple
  simple_expt_nat: OBLIGATION FORALL (h, n): simple?(expt[T](h, n));


decl_type: tcc
theory: measure_space
library: measure_integration
signature: nil
location: 423 0 425 999
body:
  % Subtype TCC generated (at line 140, column 31) for  h
      % expected type  [T -> nnreal]
  simple_expt_TCC1: OBLIGATION FORALL (h: nn_simple, x1: T): h(x1) >= 0;


decl_type: tcc
theory: measure_space
library: measure_integration
signature: nil
location: 427 0 429 999
body:
  % Judgement subtype TCC generated (at line 140, column 29) for  h ^ a
      % expected type  simple
  simple_expt: OBLIGATION FORALL (a, h: nn_simple): simple?(^[T](h, a));


decl_type: tcc
theory: measure_space
library: measure_integration
signature: nil
location: 431 0 433 999
body:
  % Judgement subtype TCC generated (at line 144, column 27) for  phi(X)
      % expected type  simple
  phi_is_simple: OBLIGATION FORALL (X: (S)): simple?(phi(X));


decl_type: tcc
theory: measure_space
library: measure_integration
signature: nil
location: 435 0 437 999
body:
  % Subtype TCC generated (at line 165, column 64) for  (LAMBDA x: 0)
      % expected type  bounded_measurable
  bounded_measurable_TCC1: OBLIGATION bounded_measurable?((LAMBDA x: 0));


decl_type: tcc
theory: measure_space
library: measure_integration
signature: nil
location: 439 0 442 999
body:
  % Judgement subtype TCC generated (at line 168, column 30) for  x
      % expected type  bounded[T]
  bounded_measurable_is_bounded: OBLIGATION
    FORALL (x: bounded_measurable): bounded?[T](x);


decl_type: tcc
theory: measure_space
library: measure_integration
signature: nil
location: 444 0 447 999
body:
  % Judgement subtype TCC generated (at line 170, column 30) for  x
      % expected type  measurable_function[T, S]
  bounded_measurable_is_measurable: OBLIGATION
    FORALL (x: bounded_measurable): measurable_function?[T, S](x);


decl_type: tcc
theory: measure_space
library: measure_integration
signature: nil
location: 449 0 452 999
body:
  % Judgement subtype TCC generated (at line 172, column 30) for  x
      % expected type  bounded_measurable
  simple_is_bounded_measurable: OBLIGATION
    FORALL (x: simple): bounded_measurable?(x);


decl_type: tcc
theory: measure_space
library: measure_integration
signature: nil
location: 454 0 457 999
body:
  % Subtype TCC generated (at line 177, column 54) for  (LAMBDA x: 0)
      % expected type  nn_bounded_measurable
  nn_bounded_measurable_TCC1: OBLIGATION
    nn_bounded_measurable?((LAMBDA x: 0));


decl_type: tcc
theory: measure_space
library: measure_integration
signature: nil
location: 459 0 462 999
body:
  % Judgement subtype TCC generated (at line 180, column 28) for  x
      % expected type  bounded_measurable
  nn_bounded_measurable_is_bounded_measurable: OBLIGATION
    FORALL (x: nn_bounded_measurable): bounded_measurable?(x);


decl_type: tcc
theory: measure_space
library: measure_integration
signature: nil
location: 464 0 468 999
body:
  % Subtype TCC generated (at line 186, column 57) for
      % (LAMBDA n: LAMBDA x: 0)
      % expected type  increasing_nn_simple
  increasing_nn_simple_TCC1: OBLIGATION
    increasing_nn_simple?((LAMBDA n: LAMBDA x: 0));


decl_type: tcc
theory: measure_space
library: measure_integration
signature: nil
location: 470 0 480 999
body:
  % Subtype TCC generated (at line 195, column 13) for
      % {h |
      %    (FORALL x: 0 <= h(x) & h(x) <= p(x)) AND
      %     sup_norm(p - h) <= sup_norm(p) / 2}
      % expected type  p: (nonempty?[simple])
  nn_simple_approx_TCC1: OBLIGATION
    FORALL (p: nn_bounded_measurable):
      nonempty?[simple]
          ({h |
              (FORALL x: 0 <= h(x) & h(x) <= p(x)) AND
               sup_norm[T]((-[T])(p, h)) <= sup_norm[T](p) / 2});


decl_type: tcc
theory: measure_space
library: measure_integration
signature: nil
location: 482 0 492 999
body:
  % Subtype TCC generated (at line 195, column 6) for
      % choose({h |
      %           (FORALL x: 0 <= h(x) & h(x) <= p(x)) AND
      %            sup_norm(p - h) <= sup_norm(p) / 2})
      % expected type  nn_simple
  nn_simple_approx_TCC2: OBLIGATION
    FORALL (p: nn_bounded_measurable):
      nn_simple?(choose[simple]
                     ({h |
                         (FORALL x: 0 <= h(x) & h(x) <= p(x)) AND
                          sup_norm[T]((-[T])(p, h)) <= sup_norm[T](p) / 2}));


decl_type: tcc
theory: measure_space
library: measure_integration
signature: nil
location: 494 0 500 999
body:
  % Subtype TCC generated (at line 202, column 20) for  nn_simple_approx(p)
      % expected type  {h | FORALL x: 0 <= h(x) & h(x) <= p(x)}
  nn_simple_sequence_TCC1: OBLIGATION
    FORALL (p: nn_bounded_measurable, n: nat):
      n = 0 IMPLIES
       (FORALL x:
          0 <= nn_simple_approx(p)(x) & nn_simple_approx(p)(x) <= p(x));


decl_type: tcc
theory: measure_space
library: measure_integration
signature: nil
location: 502 0 508 999
body:
  % Subtype TCC generated (at line 203, column 39) for
      % p - nn_simple_approx(p)
      % expected type  p: nn_bounded_measurable
  nn_simple_sequence_TCC2: OBLIGATION
    FORALL (p: nn_bounded_measurable, n: nat):
      NOT n = 0 IMPLIES
       nn_bounded_measurable?((-[T])(p, nn_simple_approx(p)));


decl_type: tcc
theory: measure_space
library: measure_integration
signature: nil
location: 510 0 513 999
body:
  % Subtype TCC generated (at line 203, column 62) for  n - 1
      % expected type  nat
  nn_simple_sequence_TCC3: OBLIGATION
    FORALL (n: nat): NOT n = 0 IMPLIES n - 1 >= 0;


decl_type: tcc
theory: measure_space
library: measure_integration
signature: nil
location: 515 0 518 999
body:
  % Termination TCC generated (at line 203, column 20) for
      % nn_simple_sequence(p - nn_simple_approx(p))(n - 1)
  nn_simple_sequence_TCC4: OBLIGATION
    FORALL (n: nat): NOT n = 0 IMPLIES n - 1 < n;


decl_type: tcc
theory: measure_space
library: measure_integration
signature: nil
location: 520 0 532 999
body:
  % Subtype TCC generated (at line 203, column 20) for
      % nn_simple_sequence(p - nn_simple_approx(p))(n - 1)
      % expected type  {h | FORALL x: 0 <= h(x) & h(x) <= p(x)}
  nn_simple_sequence_TCC5: OBLIGATION
    FORALL (p: nn_bounded_measurable, n: nat):
      NOT n = 0 IMPLIES
       (FORALL x,
               (v:
                  [p1: nn_bounded_measurable ->
                     [{z: nat | z < n} ->
                        {h | FORALL x: 0 <= h(x) & h(x) <= p1(x)}]]):
          0 <= v((-[T])(p, nn_simple_approx(p)))(n - 1)(x) &
           v((-[T])(p, nn_simple_approx(p)))(n - 1)(x) <= p(x));


decl_type: tcc
theory: measure_space
library: measure_integration
signature: nil
location: 534 0 537 999
body:
  % Subtype TCC generated (at line 207, column 62) for  w
      % expected type  sequence[bounded[T]]
  nn_bounded_measurable_as_increasing_simple_sequence_TCC1: OBLIGATION
    FORALL (w): FORALL (x1: nat): bounded?[T](w(x1));


decl_type: tcc
theory: measure_space
library: measure_integration
signature: nil
location: 539 0 542 999
body:
  % Subtype TCC generated (at line 213, column 65) for  f
      % expected type  bounded[T]
  bounded_measurable_as_increasing_sequence_TCC1: OBLIGATION
    FORALL (f: [T -> real]): bounded_measurable?(f) IMPLIES bounded?[T](f);


decl_type: formula
theory: isf
library: measure_integration
signature: nil
location: 74 2 76 30
body:
    isf_induction: LEMMA (P(lambda x: 0) AND
                          (FORALL c,E,i: P(i) => P(c*phi(E)+i)))
                         => P(i)


decl_type: formula
theory: isf
library: measure_integration
signature: nil
location: 96 2 100 29
body:
    isf_integral_def: LEMMA finite_partition_of?(i)(p) =>            % 4.3.7
      isf_integral(i)
        = LET f = LAMBDA Y: IF (NOT p(Y)) OR empty?(Y) OR i(choose[T](Y)) = 0
                            THEN 0 ELSE i(choose[T](Y)) * mu(Y) ENDIF
          IN sigma[set[T]](p,f)


decl_type: formula
theory: isf
library: measure_integration
signature: nil
location: 109 2 110 62
body:
    isf_integral_le: LEMMA (FORALL x: i1(x) <= i2(x)) =>
                            isf_integral(i1) <= isf_integral(i2)


decl_type: formula
theory: isf
library: measure_integration
signature: nil
location: 114 2 115 79
body:
    isf_integral_bound: LEMMA (FORALL x: abs(i(x)) <= nnx) =>       % 4.3.12
                                isf_integral(abs(i)) <= nnx * mu(nonzero_set?(i))


decl_type: formula
theory: isf
library: measure_integration
signature: nil
location: 117 2 118 57
body:
    isf_ae_0: LEMMA (simple?(f) AND ae_0?(f)) <=>                        % 4.3.13
                    (isf?(f) AND  isf_integral(abs(f)) = 0)


decl_type: formula
theory: isf
library: measure_integration
signature: nil
location: 128 2 129 76
body:
    isf_convergence: LEMMA pointwise_converges_upto?(u,i) =>             % 4.3.15
                           converges_upto?((isf_integral o u),isf_integral(i))


decl_type: function
theory: isf
library: measure_integration
signature: [[T -> real] -> [finite_partition[T] -> bool]]
location: 80 2 82 67
body:
    finite_partition_of?(f)(p):bool
      = FORALL (E:(p)): S(E) AND constant_over?(f)(E) AND
                        (empty?(E) OR f(choose(E)) = 0 OR mu_fin?(E))


decl_type: function
theory: isf
library: measure_integration
signature: [isf -> real]
location: 88 2 91 79
body:
    isf_integral(i):real                                                  % 4.3.9
      = sigma[real](image[T,real](i,fullset[T]),
          LAMBDA c: IF c = 0 THEN 0
                    ELSE c*mu(inverse_image[T,real](i,singleton[real](c))) ENDIF)


decl_type: tcc
theory: isf
library: measure_integration
signature: nil
location: 136 0 140 999
body:
  % Subtype TCC generated (at line 37, column 40) for  nonzero_set?(f)
      % expected type  measurable_set[T, S]
  isf?_TCC1: OBLIGATION
    FORALL (f: [T -> real]):
      simple?(f) IMPLIES measurable_set?[T, S](nonzero_set?(f));


decl_type: tcc
theory: isf
library: measure_integration
signature: nil
location: 142 0 144 999
body:
  % Subtype TCC generated (at line 41, column 34) for  (LAMBDA x: 0)
      % expected type  isf
  isf_TCC1: OBLIGATION isf?((LAMBDA x: 0));


decl_type: tcc
theory: isf
library: measure_integration
signature: nil
location: 146 0 148 999
body:
  % Judgement subtype TCC generated (at line 43, column 27) for  x
      % expected type  simple[T, S]
  isf_is_simple: OBLIGATION FORALL (x: isf): simple?[T, S](x);


decl_type: tcc
theory: isf
library: measure_integration
signature: nil
location: 150 0 152 999
body:
  % Judgement subtype TCC generated (at line 54, column 25) for  i1 + i2
      % expected type  isf
  isf_add: OBLIGATION FORALL (i1, i2): isf?((+[T])(i1, i2));


decl_type: tcc
theory: isf
library: measure_integration
signature: nil
location: 154 0 156 999
body:
  % Judgement subtype TCC generated (at line 55, column 25) for  c * i
      % expected type  isf
  isf_scal: OBLIGATION FORALL (c, i): isf?(*[T](c, i));


decl_type: tcc
theory: isf
library: measure_integration
signature: nil
location: 158 0 160 999
body:
  % Judgement subtype TCC generated (at line 56, column 25) for  -i
      % expected type  isf
  isf_opp: OBLIGATION FORALL (i): isf?(-i);


decl_type: tcc
theory: isf
library: measure_integration
signature: nil
location: 162 0 164 999
body:
  % Judgement subtype TCC generated (at line 57, column 25) for  i1 - i2
      % expected type  isf
  isf_diff: OBLIGATION FORALL (i1, i2): isf?((-[T])(i1, i2));


decl_type: tcc
theory: isf
library: measure_integration
signature: nil
location: 166 0 168 999
body:
  % Judgement subtype TCC generated (at line 58, column 25) for  abs(i)
      % expected type  isf
  isf_abs: OBLIGATION FORALL (i): isf?(abs[T](i));


decl_type: tcc
theory: isf
library: measure_integration
signature: nil
location: 170 0 172 999
body:
  % Judgement subtype TCC generated (at line 59, column 25) for  min(i1, i2)
      % expected type  isf
  isf_min: OBLIGATION FORALL (i1, i2): isf?(min[T](i1, i2));


decl_type: tcc
theory: isf
library: measure_integration
signature: nil
location: 174 0 176 999
body:
  % Judgement subtype TCC generated (at line 60, column 25) for  max(i1, i2)
      % expected type  isf
  isf_max: OBLIGATION FORALL (i1, i2): isf?(max[T](i1, i2));


decl_type: tcc
theory: isf
library: measure_integration
signature: nil
location: 178 0 180 999
body:
  % Judgement subtype TCC generated (at line 61, column 25) for  minimum(w, n)
      % expected type  isf
  isf_minimum: OBLIGATION FORALL (n, w): isf?(minimum[T](w, n));


decl_type: tcc
theory: isf
library: measure_integration
signature: nil
location: 182 0 184 999
body:
  % Judgement subtype TCC generated (at line 62, column 25) for  maximum(w, n)
      % expected type  isf
  isf_maximum: OBLIGATION FORALL (n, w): isf?(maximum[T](w, n));


decl_type: tcc
theory: isf
library: measure_integration
signature: nil
location: 186 0 188 999
body:
  % Judgement subtype TCC generated (at line 63, column 25) for  plus(i)
      % expected type  isf
  isf_plus: OBLIGATION FORALL (i): isf?(plus[T](i));


decl_type: tcc
theory: isf
library: measure_integration
signature: nil
location: 190 0 192 999
body:
  % Judgement subtype TCC generated (at line 64, column 25) for  minus(i)
      % expected type  isf
  isf_minus: OBLIGATION FORALL (i): isf?(minus[T](i));


decl_type: tcc
theory: isf
library: measure_integration
signature: nil
location: 194 0 196 999
body:
  % Judgement subtype TCC generated (at line 65, column 25) for  sq(i)
      % expected type  isf
  isf_sq: OBLIGATION FORALL (i): isf?(sq[T](i));


decl_type: tcc
theory: isf
library: measure_integration
signature: nil
location: 198 0 200 999
body:
  % Judgement subtype TCC generated (at line 66, column 25) for  i1 * i2
      % expected type  isf
  isf_prod: OBLIGATION FORALL (i1, i2): isf?(*[T](i1, i2));


decl_type: tcc
theory: isf
library: measure_integration
signature: nil
location: 202 0 204 999
body:
  % Judgement subtype TCC generated (at line 67, column 25) for  phi(E)
      % expected type  isf
  isf_phi: OBLIGATION FORALL (E): isf?(phi[T, S](E));


decl_type: tcc
theory: isf
library: measure_integration
signature: nil
location: 206 0 208 999
body:
  % Judgement subtype TCC generated (at line 68, column 25) for  expt(i, pn)
      % expected type  isf
  isf_expt: OBLIGATION FORALL (i, pn): isf?(expt[T](i, pn));


decl_type: tcc
theory: isf
library: measure_integration
signature: nil
location: 210 0 212 999
body:
  % Judgement subtype TCC generated (at line 70, column 37) for  i * h
      % expected type  isf
  isf_times_simple_is_isf: OBLIGATION FORALL (h, i): isf?(*[T](i, h));


decl_type: tcc
theory: isf
library: measure_integration
signature: nil
location: 214 0 218 999
body:
  % Subtype TCC generated (at line 82, column 45) for  E
      % expected type  p: (nonempty?[T])
  finite_partition_of?_TCC1: OBLIGATION
    FORALL (f: [T -> real], p: finite_partition[T], E: (p)):
      NOT empty?(E) AND constant_over?(f)(E) AND S(E) IMPLIES nonempty?[T](E);


decl_type: tcc
theory: isf
library: measure_integration
signature: nil
location: 220 0 226 999
body:
  % Subtype TCC generated (at line 82, column 64) for  E
      % expected type  measurable_set[T, S]
  finite_partition_of?_TCC2: OBLIGATION
    FORALL (f: [T -> real], p: finite_partition[T], E: (p)):
      NOT f(choose(E)) = 0 AND
       NOT empty?(E) AND constant_over?(f)(E) AND S(E)
       IMPLIES measurable_set?[T, S](E);


decl_type: tcc
theory: isf
library: measure_integration
signature: nil
location: 228 0 232 999
body:
  % Subtype TCC generated (at line 89, column 18) for
      % image[T, real](i, fullset[T])
      % expected type  countable_set[real]
  isf_integral_TCC1: OBLIGATION
    FORALL (i: isf): is_countable[real](image[T, real](i, fullset[T]));


decl_type: tcc
theory: isf
library: measure_integration
signature: nil
location: 234 0 241 999
body:
  % Subtype TCC generated (at line 91, column 28) for
      % inverse_image[T, real](i, singleton[real](c))
      % expected type  {m1: (S) | mu_fin?(m1)}
  isf_integral_TCC2: OBLIGATION
    FORALL (i: isf, c):
      NOT c = 0 IMPLIES
       S(inverse_image[T, real](i, singleton[real](c))) AND
        mu_fin?[T, S, m](inverse_image[T, real](i, singleton[real](c)));


decl_type: tcc
theory: isf
library: measure_integration
signature: nil
location: 243 0 257 999
body:
  % Subtype TCC generated (at line 90, column 8) for
      % LAMBDA c:
      %   IF c = 0 THEN 0
      %   ELSE c * mu(inverse_image[T, real](i, singleton[real](c)))
      %   ENDIF
      % expected type  (convergent?(image[T, real](i, fullset[T])))
  isf_integral_TCC3: OBLIGATION
    FORALL (i: isf):
      convergent?[real]
          (image[T, real](i, fullset[T]))
          (LAMBDA c:
             IF c = 0 THEN 0
             ELSE c *
                   mu[T, S, m](inverse_image[T, real](i, singleton[real](c)))
             ENDIF);


decl_type: tcc
theory: isf
library: measure_integration
signature: nil
location: 259 0 262 999
body:
  % Subtype TCC generated (at line 93, column 57) for  E
      % expected type  {m1: (S) | mu_fin?(m1)}
  isf_integral_phi_TCC1: OBLIGATION
    FORALL (E: (mu_fin?)): S(E) AND mu_fin?[T, S, m](E);


decl_type: tcc
theory: isf
library: measure_integration
signature: nil
location: 264 0 269 999
body:
  % Subtype TCC generated (at line 98, column 68) for  Y
      % expected type  p: (nonempty?[T])
  isf_integral_def_TCC1: OBLIGATION
    FORALL (i: isf, p: finite_partition[T]):
      finite_partition_of?(i)(p) IMPLIES
       (FORALL (Y): NOT empty?(Y) AND p(Y) IMPLIES nonempty?[T](Y));


decl_type: tcc
theory: isf
library: measure_integration
signature: nil
location: 271 0 278 999
body:
  % Subtype TCC generated (at line 99, column 59) for  Y
      % expected type  {m1: (S) | mu_fin?(m1)}
  isf_integral_def_TCC2: OBLIGATION
    FORALL (i: isf, p: finite_partition[T]):
      finite_partition_of?(i)(p) IMPLIES
       (FORALL (Y):
          p(Y) AND NOT empty?(Y) AND NOT i(choose[T](Y)) = 0 IMPLIES
           S(Y) AND mu_fin?[T, S, m](Y));


decl_type: tcc
theory: isf
library: measure_integration
signature: nil
location: 280 0 291 999
body:
  % Subtype TCC generated (at line 100, column 25) for  p
      % expected type  countable_set[set[T]]
  isf_integral_def_TCC3: OBLIGATION
    FORALL (i: isf, p: finite_partition[T]):
      finite_partition_of?(i)(p) IMPLIES
       (FORALL (f: [set[T] -> real]):
          (f =
            (LAMBDA Y:
               IF (NOT p(Y)) OR empty?(Y) OR i(choose[T](Y)) = 0 THEN 0
               ELSE i(choose[T](Y)) * mu(Y)
               ENDIF))
           IMPLIES is_countable[set[T]](p));


decl_type: tcc
theory: isf
library: measure_integration
signature: nil
location: 293 0 304 999
body:
  % Subtype TCC generated (at line 100, column 27) for  f
      % expected type  (convergent?(p))
  isf_integral_def_TCC4: OBLIGATION
    FORALL (i: isf, p: finite_partition[T]):
      finite_partition_of?(i)(p) IMPLIES
       (FORALL (f: [set[T] -> real]):
          (f =
            (LAMBDA Y:
               IF (NOT p(Y)) OR empty?(Y) OR i(choose[T](Y)) = 0 THEN 0
               ELSE i(choose[T](Y)) * mu(Y)
               ENDIF))
           IMPLIES convergent?[set[T]](p)(f));


decl_type: tcc
theory: isf
library: measure_integration
signature: nil
location: 306 0 311 999
body:
  % Subtype TCC generated (at line 115, column 63) for  nonzero_set?(i)
      % expected type  {m1: (S) | mu_fin?(m1)}
  isf_integral_bound_TCC1: OBLIGATION
    FORALL (i: isf, nnx: nnreal):
      (FORALL x: abs(i(x)) <= nnx) IMPLIES
       S(nonzero_set?(i)) AND mu_fin?[T, S, m](nonzero_set?(i));


decl_type: tcc
theory: isf
library: measure_integration
signature: nil
location: 313 0 316 999
body:
  % Subtype TCC generated (at line 118, column 45) for  abs(f)
      % expected type  isf
  isf_ae_0_TCC1: OBLIGATION
    FORALL (f: [T -> real]): isf?(f) IMPLIES isf?(abs[T](f));


decl_type: tcc
theory: isf
library: measure_integration
signature: nil
location: 318 0 322 999
body:
  % Subtype TCC generated (at line 129, column 57) for  u
      % expected type  [nat -> isf]
  isf_convergence_TCC1: OBLIGATION
    FORALL (i: isf, u: increasing_nn_simple[T, S]):
      pointwise_converges_upto?(u, i) IMPLIES (FORALL (x1: nat): isf?(u(x1)));


decl_type: formula
theory: nn_integral
library: measure_integration
signature: nil
location: 65 2 69 76
body:
    nn_convergence: LEMMA pointwise_convergence?(u1,f) AND                % 4.4.2
                          pointwise_convergence?(u2,f) AND
                          convergent?(isf_integral o u1) =>
                          (convergent?(isf_integral o u2) AND
                          limit(isf_integral o u1) = limit(isf_integral o u2))


decl_type: formula
theory: nn_integral
library: measure_integration
signature: nil
location: 80 2 82 60
body:
    nn_integrable_le: LEMMA (FORALL x: 0 <= g(x) AND g(x) <= f(x)) =>     % 4.4.5
                            (nn_integrable?(g) AND
                             nn_integral(g) <= nn_integral(f))


decl_type: formula
theory: nn_integral
library: measure_integration
signature: nil
location: 95 2 97 61
body:
    nn_integral_def: LEMMA
       EXISTS u: pointwise_convergence?(u,f) AND
                 convergence?(isf_integral o u, nn_integral(f))


decl_type: type
theory: nn_integral
library: measure_integration
signature: nil
location: 46 2 47 70
body:
    increasing_nn_isf: TYPE+ = (increasing_nn_isf?) CONTAINING 
                                                 (lambda n: lambda x: 0)


decl_type: judgement
theory: nn_integral
library: measure_integration
signature: measurable_function[T, S]
location: 62 2 63 71
body:
    nn_integrable_is_measurable:
                   JUDGEMENT nn_integrable SUBTYPE_OF measurable_function % 4.4.1


decl_type: function
theory: nn_integral
library: measure_integration
signature: [[T -> nnreal] -> bool]
location: 51 2 52 77
body:
    nn_integrable?(g:[T->nnreal]):bool                                    % 4.4.1
      = EXISTS u: pointwise_convergence?(u,g) AND convergent?(isf_integral o u)


decl_type: function
theory: nn_integral
library: measure_integration
signature: [nn_integrable -> nnreal]
location: 71 2 72 69
body:
    nn_integral(f):nnreal                                                 % 4.4.3
      = limit(isf_integral o choose({u | pointwise_convergence?(u,f)}))


decl_type: tcc
theory: nn_integral
library: measure_integration
signature: nil
location: 104 0 107 999
body:
  % Subtype TCC generated (at line 39, column 40) for  (LAMBDA x: 0)
      % expected type  nn_isf
  nn_isf_TCC1: OBLIGATION
    isf?[T, S, m]((LAMBDA x: 0)) AND nn_isf?((LAMBDA x: 0));


decl_type: tcc
theory: nn_integral
library: measure_integration
signature: nil
location: 109 0 112 999
body:
  % Subtype TCC generated (at line 47, column 48) for  (LAMBDA n: LAMBDA x: 0)
      % expected type  increasing_nn_isf
  increasing_nn_isf_TCC1: OBLIGATION
    increasing_nn_isf?((LAMBDA n: LAMBDA x: 0));


decl_type: tcc
theory: nn_integral
library: measure_integration
signature: nil
location: 114 0 116 999
body:
  % Subtype TCC generated (at line 56, column 54) for  (LAMBDA x: 0)
      % expected type  nn_integrable
  nn_integrable_TCC1: OBLIGATION nn_integrable?((LAMBDA x: 0));


decl_type: tcc
theory: nn_integral
library: measure_integration
signature: nil
location: 118 0 121 999
body:
  % Judgement subtype TCC generated (at line 63, column 27) for  x
      % expected type  measurable_function[T, S]
  nn_integrable_is_measurable: OBLIGATION
    FORALL (x: nn_integrable): measurable_function?[T, S](x);


decl_type: tcc
theory: nn_integral
library: measure_integration
signature: nil
location: 123 0 128 999
body:
  % Subtype TCC generated (at line 72, column 34) for
      % {u | pointwise_convergence?(u, f)}
      % expected type  p: (nonempty?[increasing_nn_isf])
  nn_integral_TCC1: OBLIGATION
    FORALL (f: nn_integrable):
      nonempty?[increasing_nn_isf]({u | pointwise_convergence?[T](u, f)});


decl_type: tcc
theory: nn_integral
library: measure_integration
signature: nil
location: 130 0 141 999
body:
  % Subtype TCC generated (at line 72, column 12) for
      % isf_integral o choose({u | pointwise_convergence?(u, f)})
      % expected type  convergent[real, (metric_induced_topology)]
  nn_integral_TCC2: OBLIGATION
    FORALL (f: nn_integrable):
      convergent?
          [real,
           (metric_induced_topology[real, (LAMBDA (x, y: real): abs(x - y))])]
          (o[nat, isf[T, S, m], real]
               (isf_integral[T, S, m],
                choose[increasing_nn_isf]
                    ({u | pointwise_convergence?[T](u, f)})));


decl_type: tcc
theory: nn_integral
library: measure_integration
signature: nil
location: 143 0 152 999
body:
  % Subtype TCC generated (at line 72, column 6) for
      % limit(isf_integral o choose({u | pointwise_convergence?(u, f)}))
      % expected type  nnreal
  nn_integral_TCC3: OBLIGATION
    FORALL (f: nn_integrable):
      limit(o[nat, isf[T, S, m], real]
                (isf_integral[T, S, m],
                 choose[increasing_nn_isf]
                     ({u | pointwise_convergence?[T](u, f)})))
       >= 0;


decl_type: tcc
theory: nn_integral
library: measure_integration
signature: nil
location: 154 0 159 999
body:
  % Judgement subtype TCC generated (at line 74, column 37) for  f1 + f2
      % expected type  nn_integrable
  nn_integrable_add: OBLIGATION
    FORALL (f1, f2):
      (FORALL (x1: T): ((+[T])(f1, f2))(x1) >= 0) AND
       nn_integrable?((+[T])(f1, f2));


decl_type: tcc
theory: nn_integral
library: measure_integration
signature: nil
location: 161 0 165 999
body:
  % Judgement subtype TCC generated (at line 75, column 37) for  c * f
      % expected type  nn_integrable
  nn_integrable_scal: OBLIGATION
    FORALL (c, f):
      (FORALL (x1: T): (*[T](c, f))(x1) >= 0) AND nn_integrable?(*[T](c, f));


decl_type: tcc
theory: nn_integral
library: measure_integration
signature: nil
location: 167 0 170 999
body:
  % Judgement subtype TCC generated (at line 76, column 37) for  x
      % expected type  nn_integrable
  nn_isf_is_nn_integrable: OBLIGATION
    FORALL (x: nn_isf): (FORALL (x1: T): x(x1) >= 0) AND nn_integrable?(x);


decl_type: tcc
theory: nn_integral
library: measure_integration
signature: nil
location: 172 0 177 999
body:
  % Subtype TCC generated (at line 81, column 42) for  g
      % expected type  [T -> nnreal]
  nn_integrable_le_TCC1: OBLIGATION
    FORALL (f: nn_integrable, g: measurable_function[T, S]):
      (FORALL x: 0 <= g(x) AND g(x) <= f(x)) IMPLIES
       (FORALL (x1: T): g(x1) >= 0);


decl_type: tcc
theory: nn_integral
library: measure_integration
signature: nil
location: 179 0 182 999
body:
  % Subtype TCC generated (at line 85, column 37) for  phi(F)
      % expected type  nn_integrable
  nn_integral_phi_TCC1: OBLIGATION
    FORALL (F: (mu_fin?)): nn_integrable?(phi[T, S](F));


decl_type: tcc
theory: nn_integral
library: measure_integration
signature: nil
location: 184 0 187 999
body:
  % Subtype TCC generated (at line 85, column 50) for  F
      % expected type  {m1: (S) | mu_fin?(m1)}
  nn_integral_phi_TCC2: OBLIGATION
    FORALL (F: (mu_fin?)): S(F) AND mu_fin?[T, S, m](F);


decl_type: tcc
theory: nn_integral
library: measure_integration
signature: nil
location: 189 0 193 999
body:
  % Judgement subtype TCC generated (at line 89, column 35) for  f * h
      % expected type  nn_integrable
  nn_integrable_prod: OBLIGATION
    FORALL (f, h):
      (FORALL (x1: T): (*[T](f, h))(x1) >= 0) AND nn_integrable?(*[T](f, h));


decl_type: tcc
theory: nn_integral
library: measure_integration
signature: nil
location: 195 0 199 999
body:
  % Subtype TCC generated (at line 91, column 49) for  phi(E) * f
      % expected type  [T -> nnreal]
  nn_indefinite_integrable_TCC1: OBLIGATION
    FORALL (E: measurable_set[T, S], f: nn_integrable, x1: T):
      (*[T](phi[T, S](E), f))(x1) >= 0;


decl_type: formula
theory: integral
library: measure_integration
signature: nil
location: 50 2 52 66
body:
    integrable_equiv: LEMMA g1 - g3 = g2 - g4 =>                    % 4.4.8
                            nn_integral(g1) - nn_integral(g3) =
                                   nn_integral(g2) - nn_integral(g4)


decl_type: formula
theory: integral
library: measure_integration
signature: nil
location: 70 2 71 74
body:
    nn_integrable_is_nn_integrable:
                            LEMMA (FORALL x: f(x) >= 0) => nn_integrable?(f)


decl_type: formula
theory: integral
library: measure_integration
signature: nil
location: 89 2 90 78
body:
    integrable_pm_def:  LEMMA integrable?(f0) <=>                        % 4.4.12
                              (integrable?(plus(f0)) AND integrable?(minus(f0)))


decl_type: formula
theory: integral
library: measure_integration
signature: nil
location: 94 2 96 59
body:
    integrable_nz_finite: LEMMA                                          % 4.4.14
                          measurable_set?({x | abs(f(x)) >= epsilon}) AND
                          mu_fin?({x | abs(f(x)) >= epsilon})


decl_type: formula
theory: integral
library: measure_integration
signature: nil
location: 100 2 101 70
body:
    integral_ae_eq: LEMMA ae_eq?(f,h) =>                                 % 4.4.16
                          (integrable?(h) AND integral(f) = integral(h))


decl_type: formula
theory: integral
library: measure_integration
signature: nil
location: 103 2 105 70
body:
    integral_prod:  LEMMA ae_le?(abs(h),lambda x: nnc) =>                % 4.4.17
                          (integrable?(f*h) AND
                           integral(abs(f*h)) <= nnc * integral(abs(f)))


decl_type: formula
theory: integral
library: measure_integration
signature: nil
location: 109 2 110 53
body:
    integral_ae_le:  LEMMA ae_le?(f1,f2) =>                              % 4.4.19
                           integral(f1) <= integral(f2)


decl_type: formula
theory: integral
library: measure_integration
signature: nil
location: 112 2 114 63
body:
    integral_ae_abs: LEMMA ae_le?(abs(h),abs(f)) =>                      % 4.4.20
                           (integrable?(h) AND
                            abs(integral(h)) <= integral(abs(f)))


decl_type: formula
theory: integral
library: measure_integration
signature: nil
location: 116 2 119 61
body:
    bounded_is_indefinite_integrable: LEMMA
        bounded?(phi(F)*h) =>
          (integrable?(phi(F)*h) AND
           abs(integral(phi(F)*h)) <= mu(F)*sup_norm(phi(F)*h))


decl_type: formula
theory: integral
library: measure_integration
signature: nil
location: 122 2 123 62
body:
    measurable_ae_0:  LEMMA ae_0?(h) =>
                            (integrable?(h) AND integral(h) = 0)


decl_type: formula
theory: integral
library: measure_integration
signature: nil
location: 129 2 131 70
body:
    integrable_split: LEMMA FORALL (h:[T->real]):
      integrable?(h) <=>
             integrable?(phi(E)*h) AND integrable?(phi(complement(E))*h)


decl_type: judgement
theory: integral
library: measure_integration
signature: integrable
location: 31 2 32 60
body:
    nn_integrable_is_integrable:
                 JUDGEMENT nn_integrable SUBTYPE_OF integrable           % 4.4.10


decl_type: judgement
theory: integral
library: measure_integration
signature: integrable
location: 33 2 34 60
body:
    isf_is_integrable:
                 JUDGEMENT isf           SUBTYPE_OF integrable           % 4.4.15


decl_type: function
theory: integral
library: measure_integration
signature: [integrable -> set[real]]
location: 61 2 63 74
body:
    integrals(f):set[real]
      = {c| EXISTS (g,h:nn_integrable): f = g-h AND
                                        c = nn_integral(g) - nn_integral(h)}


decl_type: tcc
theory: integral
library: measure_integration
signature: nil
location: 141 0 143 999
body:
  % Subtype TCC generated (at line 29, column 48) for  (LAMBDA x: 0)
      % expected type  integrable
  integrable_TCC1: OBLIGATION integrable?((LAMBDA x: 0));


decl_type: tcc
theory: integral
library: measure_integration
signature: nil
location: 145 0 148 999
body:
  % Judgement subtype TCC generated (at line 32, column 25) for  x
      % expected type  integrable
  nn_integrable_is_integrable: OBLIGATION
    FORALL (x: nn_integrable): integrable?(x);


decl_type: tcc
theory: integral
library: measure_integration
signature: nil
location: 150 0 152 999
body:
  % Judgement subtype TCC generated (at line 34, column 25) for  x
      % expected type  integrable
  isf_is_integrable: OBLIGATION FORALL (x: isf): integrable?(x);


decl_type: tcc
theory: integral
library: measure_integration
signature: nil
location: 154 0 157 999
body:
  % Judgement subtype TCC generated (at line 36, column 25) for  x
      % expected type  measurable_function[T, S]
  integrable_is_measurable: OBLIGATION
    FORALL (x: integrable): measurable_function?[T, S](x);


decl_type: tcc
theory: integral
library: measure_integration
signature: nil
location: 159 0 161 999
body:
  % Judgement subtype TCC generated (at line 54, column 29) for  f1 + f2
      % expected type  integrable
  integrable_add: OBLIGATION FORALL (f1, f2): integrable?((+[T])(f1, f2));


decl_type: tcc
theory: integral
library: measure_integration
signature: nil
location: 163 0 165 999
body:
  % Judgement subtype TCC generated (at line 55, column 29) for  c * f
      % expected type  integrable
  integrable_scal: OBLIGATION FORALL (c, f): integrable?(*[T](c, f));


decl_type: tcc
theory: integral
library: measure_integration
signature: nil
location: 167 0 169 999
body:
  % Judgement subtype TCC generated (at line 56, column 29) for  -f
      % expected type  integrable
  integrable_opp: OBLIGATION FORALL (f): integrable?(-f);


decl_type: tcc
theory: integral
library: measure_integration
signature: nil
location: 171 0 173 999
body:
  % Judgement subtype TCC generated (at line 57, column 29) for  f1 - f2
      % expected type  integrable
  integrable_diff: OBLIGATION FORALL (f1, f2): integrable?((-[T])(f1, f2));


decl_type: tcc
theory: integral
library: measure_integration
signature: nil
location: 175 0 178 999
body:
  % Subtype TCC generated (at line 68, column 34) for  integrals(f)
      % expected type  p: (nonempty?)
  integral_TCC1: OBLIGATION
    FORALL (f: integrable): nonempty?[real](integrals(f));


decl_type: tcc
theory: integral
library: measure_integration
signature: nil
location: 180 0 183 999
body:
  % Subtype TCC generated (at line 75, column 47) for  F
      % expected type  {m1: (S) | mu_fin?(m1)}
  integral_phi_TCC1: OBLIGATION
    FORALL (F: (mu_fin?)): S(F) AND mu_fin?[T, S, m](F);


decl_type: tcc
theory: integral
library: measure_integration
signature: nil
location: 185 0 187 999
body:
  % Judgement subtype TCC generated (at line 82, column 30) for  abs(f)
      % expected type  integrable
  integrable_abs: OBLIGATION FORALL (f): integrable?(abs[T](f));


decl_type: tcc
theory: integral
library: measure_integration
signature: nil
location: 189 0 191 999
body:
  % Judgement subtype TCC generated (at line 83, column 30) for  max(f1, f2)
      % expected type  integrable
  integrable_max: OBLIGATION FORALL (f1, f2): integrable?(max[T](f1, f2));


decl_type: tcc
theory: integral
library: measure_integration
signature: nil
location: 193 0 195 999
body:
  % Judgement subtype TCC generated (at line 84, column 30) for  min(f1, f2)
      % expected type  integrable
  integrable_min: OBLIGATION FORALL (f1, f2): integrable?(min[T](f1, f2));


decl_type: tcc
theory: integral
library: measure_integration
signature: nil
location: 197 0 199 999
body:
  % Judgement subtype TCC generated (at line 85, column 30) for  plus(f)
      % expected type  integrable
  integrable_plus: OBLIGATION FORALL (f): integrable?(plus[T](f));


decl_type: tcc
theory: integral
library: measure_integration
signature: nil
location: 201 0 203 999
body:
  % Judgement subtype TCC generated (at line 86, column 30) for  minus(f)
      % expected type  integrable
  integrable_minus: OBLIGATION FORALL (f): integrable?(minus[T](f));


decl_type: tcc
theory: integral
library: measure_integration
signature: nil
location: 205 0 210 999
body:
  % Subtype TCC generated (at line 105, column 34) for  abs(f * h)
      % expected type  integrable
  integral_prod_TCC1: OBLIGATION
    FORALL (f: integrable, h: measurable_function[T, S], nnc: nnreal):
      ae_le?(abs(h), LAMBDA x: nnc) AND integrable?(f * h) IMPLIES
       integrable?(abs[T](*[T](f, h)));


decl_type: tcc
theory: integral
library: measure_integration
signature: nil
location: 212 0 214 999
body:
  % Judgement subtype TCC generated (at line 126, column 34) for  maximum(w, n)
      % expected type  integrable
  integrable_maximum: OBLIGATION FORALL (n, w): integrable?(maximum[T](w, n));


decl_type: tcc
theory: integral
library: measure_integration
signature: nil
location: 216 0 218 999
body:
  % Judgement subtype TCC generated (at line 127, column 34) for  minimum(w, n)
      % expected type  integrable
  integrable_minimum: OBLIGATION FORALL (n, w): integrable?(minimum[T](w, n));


decl_type: tcc
theory: integral
library: measure_integration
signature: nil
location: 220 0 224 999
body:
  % Subtype TCC generated (at line 134, column 27) for  phi(E) * f
      % expected type  integrable
  integral_split_TCC1: OBLIGATION
    FORALL (E: measurable_set[T, S], f: integrable):
      integrable?(*[T](phi[T, S](E), f));


decl_type: tcc
theory: integral
library: measure_integration
signature: nil
location: 226 0 230 999
body:
  % Subtype TCC generated (at line 134, column 48) for  phi(complement(E)) * f
      % expected type  integrable
  integral_split_TCC2: OBLIGATION
    FORALL (E: measurable_set[T, S], f: integrable):
      integrable?(*[T](phi[T, S](complement[T](E)), f));


decl_type: formula
theory: integral_convergence_scaf
library: measure_integration
signature: nil
location: 25 2 27 70
body:
    monotone_convergence_scaf: LEMMA                                      % 4.5.1
       pointwise_converges_upto?(F,f) AND bounded?(integral o F) =>
       (integrable?(f) AND converges_upto?((integral o F), integral(f)))


decl_type: formula
theory: integral_convergence
library: measure_integration
signature: nil
location: 26 2 30 62
body:
    monotone_convergence: THEOREM                                         % 4.5.3
        ae_increasing?(F) =>
        (((EXISTS f: ae_convergence?(F,f)) <=> bounded?(integral o F)) AND
         FORALL f: ae_convergence?(F,f) =>
                   converges_upto?((integral o F), integral(f)))


decl_type: formula
theory: integral_convergence
library: measure_integration
signature: nil
location: 32 2 34 79
body:
    dominated_convergence: THEOREM                                        % 4.5.4
      (FORALL n: ae_le?(abs(F(n)),f)) AND ae_convergent?(F) =>
       EXISTS g: ae_convergence?(F,g) AND convergence?(integral o F, integral(g))


decl_type: formula
theory: measure_equality
library: measure_integration
signature: nil
location: 29 2 30 65
body:
    measure_eq_isf?: LEMMA (FORALL E: x_eq(mu(E),nu(E))) =>
                              (isf?[T,S,mu](f) <=> isf?[T,S,nu](f))


decl_type: formula
theory: measure_equality
library: measure_integration
signature: nil
location: 32 2 34 79
body:
    measure_eq_isf:  LEMMA (FORALL E: x_eq(mu(E),nu(E))) AND
                              (isf?[T,S,mu](f) OR isf?[T,S,nu](f)) =>
                              (isf_integral[T,S,mu](f) = isf_integral[T,S,nu](f))


decl_type: formula
theory: measure_equality
library: measure_integration
signature: nil
location: 36 2 38 61
body:
    measure_eq_nn_integrable?: LEMMA
      (FORALL E: x_eq(mu(E),nu(E))) =>
      (nn_integrable?[T,S,mu](g) <=> nn_integrable?[T,S,nu](g))


decl_type: formula
theory: measure_equality
library: measure_integration
signature: nil
location: 40 2 43 53
body:
    measure_eq_nn_integral:  LEMMA
      (FORALL E: x_eq(mu(E),nu(E))) AND
      (nn_integrable?[T,S,mu](g) OR nn_integrable?[T,S,nu](g)) =>
      (nn_integral[T,S,mu](g) = nn_integral[T,S,nu](g))


decl_type: formula
theory: measure_equality
library: measure_integration
signature: nil
location: 45 2 47 55
body:
    measure_eq_integrable?: LEMMA
      (FORALL E: x_eq(mu(E),nu(E))) =>
      (integrable?[T,S,mu](f) <=> integrable?[T,S,nu](f))


decl_type: formula
theory: measure_equality
library: measure_integration
signature: nil
location: 49 2 52 47
body:
    measure_eq_integral:  LEMMA
      (FORALL E: x_eq(mu(E),nu(E))) AND
      (integrable?[T,S,mu](f) OR integrable?[T,S,nu](f)) =>
      (integral[T,S,mu](f) = integral[T,S,nu](f))


decl_type: tcc
theory: measure_equality
library: measure_integration
signature: nil
location: 59 0 65 999
body:
  % Subtype TCC generated (at line 34, column 50) for  f
      % expected type  isf[T, S, mu]
  measure_eq_isf_TCC1: OBLIGATION
    FORALL (f: [T -> real], mu, nu: measure_type[T, S]):
      ((isf?[T, S, mu](f) OR isf?[T, S, nu](f)) AND
        (FORALL E: x_eq(mu(E), nu(E))))
       IMPLIES isf?[T, S, mu](f);


decl_type: tcc
theory: measure_equality
library: measure_integration
signature: nil
location: 67 0 73 999
body:
  % Subtype TCC generated (at line 34, column 76) for  f
      % expected type  isf[T, S, nu]
  measure_eq_isf_TCC2: OBLIGATION
    FORALL (f: [T -> real], mu, nu: measure_type[T, S]):
      ((isf?[T, S, mu](f) OR isf?[T, S, nu](f)) AND
        (FORALL E: x_eq(mu(E), nu(E))))
       IMPLIES isf?[T, S, nu](f);


decl_type: tcc
theory: measure_equality
library: measure_integration
signature: nil
location: 75 0 81 999
body:
  % Subtype TCC generated (at line 43, column 25) for  g
      % expected type  nn_integrable[T, S, mu]
  measure_eq_nn_integral_TCC1: OBLIGATION
    FORALL (g: [T -> nnreal], mu, nu: measure_type[T, S]):
      ((nn_integrable?[T, S, mu](g) OR nn_integrable?[T, S, nu](g)) AND
        (FORALL E: x_eq(mu(E), nu(E))))
       IMPLIES nn_integrable?[T, S, mu](g);


decl_type: tcc
theory: measure_equality
library: measure_integration
signature: nil
location: 83 0 89 999
body:
  % Subtype TCC generated (at line 43, column 50) for  g
      % expected type  nn_integrable[T, S, nu]
  measure_eq_nn_integral_TCC2: OBLIGATION
    FORALL (g: [T -> nnreal], mu, nu: measure_type[T, S]):
      ((nn_integrable?[T, S, mu](g) OR nn_integrable?[T, S, nu](g)) AND
        (FORALL E: x_eq(mu(E), nu(E))))
       IMPLIES nn_integrable?[T, S, nu](g);


decl_type: tcc
theory: measure_equality
library: measure_integration
signature: nil
location: 91 0 97 999
body:
  % Subtype TCC generated (at line 52, column 22) for  f
      % expected type  integrable[T, S, mu]
  measure_eq_integral_TCC1: OBLIGATION
    FORALL (f: [T -> real], mu, nu: measure_type[T, S]):
      ((integrable?[T, S, mu](f) OR integrable?[T, S, nu](f)) AND
        (FORALL E: x_eq(mu(E), nu(E))))
       IMPLIES integrable?[T, S, mu](f);


decl_type: tcc
theory: measure_equality
library: measure_integration
signature: nil
location: 99 0 105 999
body:
  % Subtype TCC generated (at line 52, column 44) for  f
      % expected type  integrable[T, S, nu]
  measure_eq_integral_TCC2: OBLIGATION
    FORALL (f: [T -> real], mu, nu: measure_type[T, S]):
      ((integrable?[T, S, mu](f) OR integrable?[T, S, nu](f)) AND
        (FORALL E: x_eq(mu(E), nu(E))))
       IMPLIES integrable?[T, S, nu](f);


decl_type: formula
theory: indefinite_integral
library: measure_integration
signature: nil
location: 43 2 46 51
body:
    indefinite_eq_0: LEMMA FORALL (E:measurable_set,f:(integrable?(E))): % 4.4.23
                           ae_in?(LAMBDA x: f(x) > 0)(E) AND
                           integral(phi(E)*f) = 0 =>
                           (mu_fin?(E) AND mu(E) = 0)


decl_type: formula
theory: indefinite_integral
library: measure_integration
signature: nil
location: 48 2 49 38
body:
    indefinite_eq:   LEMMA (FORALL E: integral(E,f1) = integral(E,f2)) =>
                           ae_eq?(f1,f2)                                 % 4.4.24


decl_type: formula
theory: indefinite_integral
library: measure_integration
signature: nil
location: 53 2 54 76
body:
    indefinite_add:  LEMMA FORALL (E:measurable_set,f1,f2:(integrable?(E))):
                           integral(E,f1+f2) = integral(E,f1) + integral(E,f2)


decl_type: formula
theory: indefinite_integral
library: measure_integration
signature: nil
location: 55 2 56 60
body:
    indefinite_scal: LEMMA FORALL (E:measurable_set,f:(integrable?(E))):
                           integral(E,(c*f)) = c*integral(E,f)


decl_type: formula
theory: indefinite_integral
library: measure_integration
signature: nil
location: 57 2 58 59
body:
    indefinite_opp:  LEMMA FORALL (E:measurable_set,f:(integrable?(E))):
                           integral(E,-f)    = -integral(E,f)


decl_type: formula
theory: indefinite_integral
library: measure_integration
signature: nil
location: 59 2 60 76
body:
    indefinite_diff: LEMMA FORALL (E:measurable_set,f1,f2:(integrable?(E))):
                           integral(E,f1-f2) = integral(E,f1) - integral(E,f2)


decl_type: formula
theory: indefinite_integral
library: measure_integration
signature: nil
location: 62 2 64 58
body:
    indefinite_ae_eq:LEMMA
                   ae_eq?(f1,f2) <=>
                   (FORALL E: integral(E,f1)=integral(E,f2))


decl_type: formula
theory: indefinite_integral
library: measure_integration
signature: nil
location: 67 2 68 79
body:
    indefinite_le:   LEMMA
                   ae_le?(f1,f2) <=> (FORALL E: integral(E,f1) <= integral(E,f2))


decl_type: formula
theory: indefinite_integral
library: measure_integration
signature: nil
location: 69 2 70 75
body:
    indefinite_pm:   LEMMA FORALL (E:measurable_set,f:(integrable?(E))):
                   integral(E,f) = integral(E,plus(f)) - integral(E,minus(f))


decl_type: formula
theory: indefinite_integral
library: measure_integration
signature: nil
location: 72 2 75 62
body:
    indefinite_union: LEMMA FORALL (E1,E2:measurable_set,
                                    f:(integrable?(union(E1,E2)))):
      disjoint?(E1,E2) =>
      integral(union(E1,E2),f) = integral(E1,f) + integral(E2,f)


decl_type: formula
theory: indefinite_integral
library: measure_integration
signature: nil
location: 77 2 79 59
body:
    indefinite_subset: LEMMA FORALL (E1,E2:measurable_set,f:(integrable?(E2))):
                             subset?(E1,E2) AND ae_nonneg?(f) =>
                             integral(E1,f) <= integral(E2,f)


decl_type: formula
theory: indefinite_integral
library: measure_integration
signature: nil
location: 83 2 84 77
body:
    indefinite_countably_additive: LEMMA                                  % 4.7.3
      convergence?(series(lambda n: integral(DX(n),f)), integral(IUnion(DX),f))


decl_type: tcc
theory: indefinite_integral
library: measure_integration
signature: nil
location: 91 0 95 999
body:
  % Subtype TCC generated (at line 37, column 64) for  phi(E) * f
      % expected type  integrable[T, S, m]
  integral_TCC1: OBLIGATION
    FORALL (E: measurable_set[T, S], f: (integrable?(E))):
      integrable?[T, S, m](*[T](phi[T, S](E), f));


decl_type: tcc
theory: indefinite_integral
library: measure_integration
signature: nil
location: 97 0 100 999
body:
  % Subtype TCC generated (at line 40, column 47) for  g
      % expected type  (integrable?(emptyset))
  indefinite_emptyset_TCC1: OBLIGATION
    FORALL (g: [T -> real]): integrable?(emptyset[T])(g);


decl_type: tcc
theory: indefinite_integral
library: measure_integration
signature: nil
location: 102 0 105 999
body:
  % Subtype TCC generated (at line 41, column 46) for  f
      % expected type  (integrable?(fullset))
  indefinite_fullset_TCC1: OBLIGATION
    FORALL (f: integrable[T, S, m]): integrable?(fullset[T])(f);


decl_type: tcc
theory: indefinite_integral
library: measure_integration
signature: nil
location: 107 0 113 999
body:
  % Subtype TCC generated (at line 46, column 44) for  E
      % expected type  {m1: (S) | mu_fin?(m1)}
  indefinite_eq_0_TCC1: OBLIGATION
    FORALL (E: measurable_set[T, S], f: (integrable?(E))):
      mu_fin?(E) AND
       ae_in?(LAMBDA x: f(x) > 0)(E) AND integral(phi(E) * f) = 0
       IMPLIES S(E);


decl_type: tcc
theory: indefinite_integral
library: measure_integration
signature: nil
location: 115 0 118 999
body:
  % Subtype TCC generated (at line 48, column 47) for  f1
      % expected type  (integrable?(E))
  indefinite_eq_TCC1: OBLIGATION
    FORALL (f1: integrable[T, S, m], E): integrable?(E)(f1);


decl_type: tcc
theory: indefinite_integral
library: measure_integration
signature: nil
location: 120 0 124 999
body:
  % Subtype TCC generated (at line 51, column 36) for  phi(F)
      % expected type  (integrable?(E))
  indefinite_phi_TCC1: OBLIGATION
    FORALL (E: measurable_set[T, S], F: (mu_fin?)):
      integrable?(E)(phi[T, S](F));


decl_type: tcc
theory: indefinite_integral
library: measure_integration
signature: nil
location: 126 0 130 999
body:
  % Subtype TCC generated (at line 51, column 49) for  intersection(E, F)
      % expected type  {m1: (S) | mu_fin?(m1)}
  indefinite_phi_TCC2: OBLIGATION
    FORALL (E: measurable_set[T, S], F: (mu_fin?)):
      S(intersection[T](E, F)) AND mu_fin?[T, S, m](intersection[T](E, F));


decl_type: tcc
theory: indefinite_integral
library: measure_integration
signature: nil
location: 132 0 136 999
body:
  % Subtype TCC generated (at line 54, column 36) for  f1 + f2
      % expected type  (integrable?(E))
  indefinite_add_TCC1: OBLIGATION
    FORALL (E: measurable_set[T, S], f1, f2: (integrable?(E))):
      integrable?(E)((+[T])(f1, f2));


decl_type: tcc
theory: indefinite_integral
library: measure_integration
signature: nil
location: 138 0 142 999
body:
  % Subtype TCC generated (at line 56, column 37) for  (c * f)
      % expected type  (integrable?(E))
  indefinite_scal_TCC1: OBLIGATION
    FORALL (c: real, E: measurable_set[T, S], f: (integrable?(E))):
      integrable?(E)((*[T](c, f)));


decl_type: tcc
theory: indefinite_integral
library: measure_integration
signature: nil
location: 144 0 147 999
body:
  % Subtype TCC generated (at line 58, column 36) for  -f
      % expected type  (integrable?(E))
  indefinite_opp_TCC1: OBLIGATION
    FORALL (E: measurable_set[T, S], f: (integrable?(E))): integrable?(E)(-f);


decl_type: tcc
theory: indefinite_integral
library: measure_integration
signature: nil
location: 149 0 153 999
body:
  % Subtype TCC generated (at line 60, column 36) for  f1 - f2
      % expected type  (integrable?(E))
  indefinite_diff_TCC1: OBLIGATION
    FORALL (E: measurable_set[T, S], f1, f2: (integrable?(E))):
      integrable?(E)((-[T])(f1, f2));


decl_type: tcc
theory: indefinite_integral
library: measure_integration
signature: nil
location: 155 0 159 999
body:
  % Subtype TCC generated (at line 70, column 44) for  plus(f)
      % expected type  (integrable?(E))
  indefinite_pm_TCC1: OBLIGATION
    FORALL (E: measurable_set[T, S], f: (integrable?(E))):
      integrable?(E)(plus[T](f));


decl_type: tcc
theory: indefinite_integral
library: measure_integration
signature: nil
location: 161 0 165 999
body:
  % Subtype TCC generated (at line 70, column 66) for  minus(f)
      % expected type  (integrable?(E))
  indefinite_pm_TCC2: OBLIGATION
    FORALL (E: measurable_set[T, S], f: (integrable?(E))):
      integrable?(E)(minus[T](f));


decl_type: tcc
theory: indefinite_integral
library: measure_integration
signature: nil
location: 167 0 172 999
body:
  % Subtype TCC generated (at line 75, column 43) for  f
      % expected type  (integrable?(E1))
  indefinite_union_TCC1: OBLIGATION
    FORALL (E1, E2: measurable_set[T, S],
            f: (integrable?(union[T](E1, E2)))):
      disjoint?(E1, E2) IMPLIES integrable?(E1)(f);


decl_type: tcc
theory: indefinite_integral
library: measure_integration
signature: nil
location: 174 0 179 999
body:
  % Subtype TCC generated (at line 75, column 60) for  f
      % expected type  (integrable?(E2))
  indefinite_union_TCC2: OBLIGATION
    FORALL (E1, E2: measurable_set[T, S],
            f: (integrable?(union[T](E1, E2)))):
      disjoint?(E1, E2) IMPLIES integrable?(E2)(f);


decl_type: tcc
theory: indefinite_integral
library: measure_integration
signature: nil
location: 181 0 185 999
body:
  % Subtype TCC generated (at line 79, column 39) for  f
      % expected type  (integrable?(E1))
  indefinite_subset_TCC1: OBLIGATION
    FORALL (E1, E2: measurable_set[T, S], f: (integrable?(E2))):
      subset?(E1, E2) AND ae_nonneg?(f) IMPLIES integrable?(E1)(f);


decl_type: tcc
theory: indefinite_integral
library: measure_integration
signature: nil
location: 187 0 191 999
body:
  % Subtype TCC generated (at line 81, column 36) for  h
      % expected type  (integrable?(N))
  indefinite_null_TCC1: OBLIGATION
    FORALL (N: null_set[T, S, m], h: measurable_function[T, S]):
      integrable?(N)(h);


decl_type: tcc
theory: indefinite_integral
library: measure_integration
signature: nil
location: 193 0 197 999
body:
  % Subtype TCC generated (at line 84, column 43) for  DX(n)
      % expected type  measurable_set[T, S]
  indefinite_countably_additive_TCC1: OBLIGATION
    FORALL (DX: disjoint_indexed_measurable[T, S], n):
      measurable_set?[T, S](DX(n));


decl_type: tcc
theory: indefinite_integral
library: measure_integration
signature: nil
location: 199 0 204 999
body:
  % Subtype TCC generated (at line 84, column 49) for  f
      % expected type  (integrable?(DX(n)))
  indefinite_countably_additive_TCC2: OBLIGATION
    FORALL (DX: disjoint_indexed_measurable[T, S], f: integrable[T, S, m],
            n):
      integrable?(DX(n))(f);


decl_type: tcc
theory: indefinite_integral
library: measure_integration
signature: nil
location: 206 0 210 999
body:
  % Subtype TCC generated (at line 84, column 63) for  IUnion(DX)
      % expected type  measurable_set[T, S]
  indefinite_countably_additive_TCC3: OBLIGATION
    FORALL (DX: disjoint_indexed_measurable[T, S]):
      measurable_set?[T, S](IUnion[nat, T](DX));


decl_type: tcc
theory: indefinite_integral
library: measure_integration
signature: nil
location: 212 0 216 999
body:
  % Subtype TCC generated (at line 84, column 74) for  f
      % expected type  (integrable?(IUnion(DX)))
  indefinite_countably_additive_TCC4: OBLIGATION
    FORALL (DX: disjoint_indexed_measurable[T, S], f: integrable[T, S, m]):
      integrable?(IUnion[nat, T](DX))(f);


decl_type: formula
theory: measure_contraction
library: measure_integration
signature: nil
location: 35 2 36 73
body:
    sigma_finite_contraction_def: LEMMA
      x_eq(nu(E),x_sum(LAMBDA i: (TRUE,fm_contraction(nu,A_of(nu)(i))(E))))


decl_type: formula
theory: measure_contraction
library: measure_integration
signature: nil
location: 47 2 48 66
body:
    contraction_isf: LEMMA FORALL (f:simple):
      isf?[T,S,contraction(mu,A)](f) <=> isf?[T,S,mu](phi[T,S](A)*f)


decl_type: formula
theory: measure_contraction
library: measure_integration
signature: nil
location: 50 2 53 45
body:
    contraction_isf_integral: LEMMA
      FORALL (f:isf[T,S,contraction(mu,A)]):
        isf_integral[T,S,contraction(mu,A)](f)
          = isf_integral[T,S,mu](phi[T,S](A)*f)


decl_type: formula
theory: measure_contraction
library: measure_integration
signature: nil
location: 55 2 57 41
body:
    contraction_nn_integrable: LEMMA FORALL (f:nn_measurable):
      nn_integrable?[T,S,contraction(mu,A)](f) <=>
      nn_integrable?[T,S,mu](phi[T,S](A)*f)


decl_type: formula
theory: measure_contraction
library: measure_integration
signature: nil
location: 59 2 61 78
body:
    contraction_nn_integral: LEMMA
      FORALL (f:nn_integrable[T,S,contraction(mu,A)]):
      nn_integral[T,S,contraction(mu,A)](f) = nn_integral[T,S,mu](phi[T,S](A)*f)


decl_type: formula
theory: measure_contraction
library: measure_integration
signature: nil
location: 63 2 65 44
body:
    contraction_integrable: LEMMA                                     % SKB 7.4.4
      integrable?[T,S,contraction(mu,A)](f)
        <=> integrable?[T,S,mu](phi[T,S](A)*f)


decl_type: formula
theory: measure_contraction
library: measure_integration
signature: nil
location: 67 2 69 72
body:
    contraction_integral:   LEMMA                                     % SKB 7.4.4
      FORALL (f:integrable[T,S,contraction(mu,A)]):
      integral[T,S,contraction(mu,A)](f) = integral[T,S,mu](phi[T,S](A)*f)


decl_type: judgement
theory: measure_contraction
library: measure_integration
signature: sigma_finite_measure[T, S]
location: 44 2 45 79
body:
    contraction_is_sigma_finite:
                        JUDGEMENT contraction(nu,A) HAS_TYPE sigma_finite_measure


decl_type: function
theory: measure_contraction
library: measure_integration
signature: [[mu: measure_type, {E | mu(E)`1}] -> finite_measure[T, S]]
location: 32 2 33 39
body:
    fm_contraction(mu:measure_type,A:{E | mu(E)`1}):finite_measure
      = lambda E: mu(intersection(A,E))`2


decl_type: tcc
theory: measure_contraction
library: measure_integration
signature: nil
location: 76 0 79 999
body:
  % Subtype TCC generated (at line 30, column 48) for  intersection(A, E)
      % expected type  (S)
  contraction_TCC1: OBLIGATION
    FORALL (A: measurable_set[T, S], E): S(intersection[T](A, E));


decl_type: tcc
theory: measure_contraction
library: measure_integration
signature: nil
location: 81 0 85 999
body:
  % Subtype TCC generated (at line 30, column 35) for
      % LAMBDA E: mu(intersection(A, E))
      % expected type  measure_type[T, S]
  contraction_TCC2: OBLIGATION
    FORALL (x: set[T]): measurable_set?[T, S](x) IFF S(x);


decl_type: tcc
theory: measure_contraction
library: measure_integration
signature: nil
location: 87 0 92 999
body:
  % Subtype TCC generated (at line 30, column 35) for
      % LAMBDA E: mu(intersection(A, E))
      % expected type  measure_type[T, S]
  contraction_TCC3: OBLIGATION
    FORALL (mu: measure_type[T, S], A: measurable_set[T, S]):
      measure?[T, S](LAMBDA E: mu(intersection[T](A, E)));


decl_type: tcc
theory: measure_contraction
library: measure_integration
signature: nil
location: 94 0 96 999
body:
  % Subtype TCC generated (at line 32, column 43) for  E
      % expected type  (S)
  fm_contraction_TCC1: OBLIGATION FORALL (E: measurable_set[T, S]): S(E);


decl_type: tcc
theory: measure_contraction
library: measure_integration
signature: nil
location: 98 0 103 999
body:
  % Subtype TCC generated (at line 33, column 6) for
      % LAMBDA E: mu(intersection(A, E))`2
      % expected type  finite_measure[T, S]
  fm_contraction_TCC2: OBLIGATION
    FORALL (mu: measure_type[T, S], A: {E | mu(E)`1}):
      finite_measure?[T, S](LAMBDA E: mu(intersection[T](A, E))`2);


decl_type: tcc
theory: measure_contraction
library: measure_integration
signature: nil
location: 105 0 109 999
body:
  % Subtype TCC generated (at line 36, column 55) for  A_of(nu)(i)
      % expected type  {E | nu(E)`1}
  sigma_finite_contraction_def_TCC1: OBLIGATION
    FORALL (nu: sigma_finite_measure[T, S], i):
      measurable_set?[T, S](A_of[T, S](nu)(i)) AND nu(A_of[T, S](nu)(i))`1;


decl_type: tcc
theory: measure_contraction
library: measure_integration
signature: nil
location: 111 0 115 999
body:
  % Judgement subtype TCC generated (at line 45, column 32) for
      % contraction(nu, A)
      % expected type  sigma_finite_measure[T, S]
  contraction_is_sigma_finite: OBLIGATION
    FORALL (A, nu): sigma_finite_measure?[T, S](contraction(nu, A));


decl_type: tcc
theory: measure_contraction
library: measure_integration
signature: nil
location: 117 0 123 999
body:
  % Subtype TCC generated (at line 22, column 42) for
      % ((reals@real_fun_ops[T].*)(phi[T, S](A), f))
      % expected type  isf[T, S, mu]
  contraction_isf_integral_TCC1: OBLIGATION
    FORALL (A: measurable_set[T, S], mu: measure_type[T, S],
            f: isf[T, S, contraction(mu, A)]):
      isf?[T, S, mu](((reals@real_fun_ops[T].*)(phi[T, S](A), f)));


decl_type: tcc
theory: measure_contraction
library: measure_integration
signature: nil
location: 125 0 128 999
body:
  % Subtype TCC generated (at line 56, column 42) for  f
      % expected type  [T -> nnreal]
  contraction_nn_integrable_TCC1: OBLIGATION
    FORALL (f: nn_measurable[T, S]): FORALL (x1: T): f(x1) >= 0;


decl_type: tcc
theory: measure_contraction
library: measure_integration
signature: nil
location: 130 0 135 999
body:
  % Subtype TCC generated (at line 22, column 42) for
      % ((reals@real_fun_ops[T].*)(phi[T, S](A), f))
      % expected type  [T -> nnreal]
  contraction_nn_integrable_TCC2: OBLIGATION
    FORALL (A: measurable_set[T, S], f: nn_measurable[T, S]):
      FORALL (x1: T): ((reals@real_fun_ops[T].*)(phi[T, S](A), f))(x1) >= 0;


decl_type: tcc
theory: measure_contraction
library: measure_integration
signature: nil
location: 137 0 145 999
body:
  % Subtype TCC generated (at line 22, column 42) for
      % ((reals@real_fun_ops[T].*)(phi[T, S](A), f))
      % expected type  nn_integrable[T, S, mu]
  contraction_nn_integral_TCC1: OBLIGATION
    FORALL (A: measurable_set[T, S], mu: measure_type[T, S],
            f: nn_integrable[T, S, contraction(mu, A)]):
      (FORALL (x1: T): ((reals@real_fun_ops[T].*)(phi[T, S](A), f))(x1) >= 0)
       AND
       nn_integrable?[T, S, mu](((reals@real_fun_ops[T].*)(phi[T, S](A), f)));


decl_type: tcc
theory: measure_contraction
library: measure_integration
signature: nil
location: 147 0 153 999
body:
  % Subtype TCC generated (at line 22, column 42) for
      % ((reals@real_fun_ops[T].*)(phi[T, S](A), f))
      % expected type  integrable[T, S, mu]
  contraction_integral_TCC1: OBLIGATION
    FORALL (A: measurable_set[T, S], mu: measure_type[T, S],
            f: integrable[T, S, contraction(mu, A)]):
      integrable?[T, S, mu](((reals@real_fun_ops[T].*)(phi[T, S](A), f)));


decl_type: formula
theory: measure_contraction_props
library: measure_integration
signature: nil
location: 29 2 34 76
body:
    contraction_integrable_def: LEMMA
      IUnion(A) = fullset[T] AND
      (FORALL x:  h(x) >= 0) =>
      (integrable?[T,S,mu](h) <=>
       ((FORALL n: integrable?[T,S,contraction(mu,A(n))](h)) AND
        convergent?(series(lambda n: integral[T,S,contraction(mu,A(n))](h)))))


decl_type: tcc
theory: measure_contraction_props
library: measure_integration
signature: nil
location: 41 0 47 999
body:
  % Subtype TCC generated (at line 33, column 48) for  A(n)
      % expected type  measurable_set[T, S]
  contraction_integrable_def_TCC1: OBLIGATION
    FORALL (A: disjoint_indexed_measurable[T, S],
            h: measurable_function[T, S]):
      (FORALL x: h(x) >= 0) AND IUnion(A) = fullset[T] IMPLIES
       (FORALL (n): measurable_set?[T, S](A(n)));


decl_type: tcc
theory: measure_contraction_props
library: measure_integration
signature: nil
location: 49 0 58 999
body:
  % Subtype TCC generated (at line 34, column 70) for  h
      % expected type  integrable[T, S, contraction(mu, A(n))]
  contraction_integrable_def_TCC2: OBLIGATION
    FORALL (A: disjoint_indexed_measurable[T, S],
            h: measurable_function[T, S]):
      ((FORALL x: h(x) >= 0) AND
        IUnion(A) = fullset[T] AND
         (FORALL n: integrable?[T, S, contraction(mu, A(n))](h)))
       IMPLIES
       (FORALL (n1): integrable?[T, S, contraction[T, S](mu, A(n1))](h));


decl_type: formula
theory: sigma_finite_measure_props
library: measure_integration
signature: nil
location: 31 2 35 30
body:
    sfm_integrable: LEMMA
      ((FORALL n: integrable?[T,S,contraction(mu,A_of(mu)(n))](h)) AND
       convergent?(series(lambda n:
                            integral[T,S,contraction(mu,A_of(mu)(n))](h))))
      <=> integrable?[T,S,mu](h)


decl_type: formula
theory: sigma_finite_measure_props
library: measure_integration
signature: nil
location: 37 2 39 36
body:
    sfm_integral: LEMMA
     convergence?(series(lambda n: integral[T,S,contraction(mu,A_of(mu)(n))](f)),
                  integral[T,S,mu](f))


decl_type: formula
theory: sigma_finite_measure_props
library: measure_integration
signature: nil
location: 41 2 42 62
body:
    sfm_component_eq: LEMMA x_eq(to_measure(fm_contraction(mu,A_of(mu)(n)))(A),
                                 contraction(mu,A_of(mu)(n))(A))


decl_type: formula
theory: sigma_finite_measure_props
library: measure_integration
signature: nil
location: 46 2 57 79
body:
    sfm_monotone_convergence: LEMMA                                       % 7.4.5
      ae_increasing?(F) AND
      (FORALL n,x: F(n)(x) >= 0) AND
      (FORALL n: integrable?[T,S,contraction(mu,P_of(mu)(n))](F(n))) =>
      (((EXISTS g:
           ae_convergence?(F,g)) <=>
           bounded?(lambda n: integral[T,S,contraction(mu,P_of(mu)(n))](F(n))))
                                                                              AND
         FORALL g:
           ae_convergence?(F,g) =>
           converges_upto?(lambda n:
                   integral[T,S,contraction(mu,P_of(mu)(n))](F(n)), integral(g)))


decl_type: tcc
theory: sigma_finite_measure_props
library: measure_integration
signature: nil
location: 64 0 67 999
body:
  % Subtype TCC generated (at line 32, column 47) for  A_of(mu)(n)
      % expected type  measurable_set[T, S]
  sfm_integrable_TCC1: OBLIGATION
    FORALL (n): measurable_set?[T, S](A_of[T, S](mu)(n));


decl_type: tcc
theory: sigma_finite_measure_props
library: measure_integration
signature: nil
location: 69 0 75 999
body:
  % Subtype TCC generated (at line 34, column 68) for  h
      % expected type  integrable[T, S, contraction(mu, A_of(mu)(n))]
  sfm_integrable_TCC2: OBLIGATION
    FORALL (h: nn_measurable[T, S]):
      (FORALL n: integrable?[T, S, contraction(mu, A_of(mu)(n))](h)) IMPLIES
       (FORALL (n1):
          integrable?[T, S, contraction[T, S](mu, A_of[T, S](mu)(n1))](h));


decl_type: tcc
theory: sigma_finite_measure_props
library: measure_integration
signature: nil
location: 77 0 81 999
body:
  % Subtype TCC generated (at line 38, column 75) for  f
      % expected type  integrable[T, S, contraction(mu, A_of(mu)(n))]
  sfm_integral_TCC1: OBLIGATION
    FORALL (f: nn_integrable[T, S, mu], n):
      integrable?[T, S, contraction[T, S](mu, A_of[T, S](mu)(n))](f);


decl_type: tcc
theory: sigma_finite_measure_props
library: measure_integration
signature: nil
location: 83 0 87 999
body:
  % Subtype TCC generated (at line 41, column 60) for  A_of(mu)(n)
      % expected type  {E | mu(E)`1}
  sfm_component_eq_TCC1: OBLIGATION
    FORALL (n: nat):
      measurable_set?[T, S](A_of[T, S](mu)(n)) AND mu(A_of[T, S](mu)(n))`1;


decl_type: tcc
theory: sigma_finite_measure_props
library: measure_integration
signature: nil
location: 89 0 94 999
body:
  % Subtype TCC generated (at line 49, column 46) for  P_of(mu)(n)
      % expected type  measurable_set[T, S]
  sfm_monotone_convergence_TCC1: OBLIGATION
    FORALL (F: sequence[[T -> real]]):
      (ae_increasing?(F) AND (FORALL n, x: F(n)(x) >= 0)) IMPLIES
       (FORALL (n1): measurable_set?[T, S](P_of[T, S](mu)(n1)));


decl_type: tcc
theory: sigma_finite_measure_props
library: measure_integration
signature: nil
location: 96 0 105 999
body:
  % Subtype TCC generated (at line 52, column 70) for  F(n)
      % expected type  integrable[T, S, contraction(mu, P_of(mu)(n))]
  sfm_monotone_convergence_TCC2: OBLIGATION
    FORALL (F: sequence[[T -> real]]):
      (FORALL n: integrable?[T, S, contraction(mu, P_of(mu)(n))](F(n))) AND
       (FORALL n, x: F(n)(x) >= 0) AND ae_increasing?(F)
       IMPLIES
       (FORALL (n1):
          integrable?[T, S, contraction[T, S](mu, P_of[T, S](mu)(n1))]
              (F(n1)));


decl_type: formula
theory: product_integral_def
library: measure_integration
signature: nil
location: 70 2 74 42
body:
    null_integral1_def: LEMMA
        (N1,f) = null_integrable1(h1) AND
        (NOT member(x,N1)) =>
        (integrable?(lambda y: h1(x,y)) AND
         integral(lambda y: h1(x,y)) = f(x))


decl_type: formula
theory: product_integral_def
library: measure_integration
signature: nil
location: 76 2 80 42
body:
    null_integral2_def: LEMMA
        (N2,g) = null_integrable2(h2) AND
        (NOT member(y,N2)) =>
        (integrable?(lambda x: h2(x,y)) AND
         integral(lambda x: h2(x,y)) = g(y))


decl_type: function
theory: product_integral_def
library: measure_integration
signature: [[[T1, T2] -> real] -> bool]
location: 32 2 35 52
body:
    integrable1?(h):bool
      = EXISTS N1,f: FORALL x: NOT member(x,N1) =>
                     integrable?(lambda y: h(x,y)) AND
                     integral(lambda y: h(x,y)) = f(x)


decl_type: function
theory: product_integral_def
library: measure_integration
signature: [[[T1, T2] -> real] -> bool]
location: 37 2 40 52
body:
    integrable2?(h):bool
      = EXISTS N2,g: FORALL y: NOT member(y,N2) =>
                     integrable?(lambda x: h(x,y)) AND
                     integral(lambda x: h(x,y)) = g(y)


decl_type: function
theory: product_integral_def
library: measure_integration
signature: [integrable1 -> [null_set[T1, S1, mu], integrable[T1, S1, mu]]]
location: 60 2 63 59
body:
    null_integrable1(h1):[null_set[T1,S1,mu],integrable[T1,S1,mu]]
      = choose({(N1,f) | FORALL x: NOT member(x,N1) =>
                         integrable?(lambda y: h1(x,y)) AND
                         integral(lambda y: h1(x,y)) = f(x)})


decl_type: function
theory: product_integral_def
library: measure_integration
signature: [integrable2 -> [null_set[T2, S2, nu], integrable[T2, S2, nu]]]
location: 65 2 68 59
body:
    null_integrable2(h2):[null_set[T2,S2,nu],integrable[T2,S2,nu]]
      = choose({(N2,g) | FORALL y: NOT member(y,N2) =>
                         integrable?(lambda x: h2(x,y)) AND
                         integral(lambda x: h2(x,y)) = g(y)})


decl_type: function
theory: product_integral_def
library: measure_integration
signature: [integrable1 -> integrable[T1, S1, mu]]
location: 82 2 84 54
body:
    integral1(h1): integrable[T1,S1,mu]
      = lambda x: LET (N1,f) = null_integrable1(h1) IN
                  IF member(x,N1) THEN 0 ELSE f(x) ENDIF


decl_type: function
theory: product_integral_def
library: measure_integration
signature: [integrable2 -> integrable[T2, S2, nu]]
location: 86 2 88 54
body:
    integral2(h2): integrable[T2,S2,nu]
      = lambda y: LET (N2,g) = null_integrable2(h2) IN
                  IF member(y,N2) THEN 0 ELSE g(y) ENDIF


decl_type: tcc
theory: product_integral_def
library: measure_integration
signature: nil
location: 107 0 109 999
body:
  % Assuming TCC generated (at line 15, column 10) for  measure_type[T1, S1]
      % generated from assumption generalized_measure_def.S_empty
  mu_TCC1: OBLIGATION S1(emptyset[T1]);


decl_type: tcc
theory: product_integral_def
library: measure_integration
signature: nil
location: 111 0 113 999
body:
  % Assuming TCC generated (at line 15, column 34) for  measure_type[T2, S2]
      % generated from assumption generalized_measure_def.S_empty
  nu_TCC1: OBLIGATION S2(emptyset[T2]);


decl_type: tcc
theory: product_integral_def
library: measure_integration
signature: nil
location: 115 0 117 999
body:
  % Subtype TCC generated (at line 42, column 51) for  (LAMBDA x, y: 0)
      % expected type  integrable1
  integrable1_TCC1: OBLIGATION integrable1?((LAMBDA x, y: 0));


decl_type: tcc
theory: product_integral_def
library: measure_integration
signature: nil
location: 119 0 121 999
body:
  % Subtype TCC generated (at line 43, column 51) for  (LAMBDA x, y: 0)
      % expected type  integrable2
  integrable2_TCC1: OBLIGATION integrable2?((LAMBDA x, y: 0));


decl_type: tcc
theory: product_integral_def
library: measure_integration
signature: nil
location: 123 0 126 999
body:
  % Judgement subtype TCC generated (at line 49, column 30) for  g1 + h1
      % expected type  integrable1
  integrable1_add: OBLIGATION
    FORALL (g1, h1): integrable1?((+[[T1, T2]])(g1, h1));


decl_type: tcc
theory: product_integral_def
library: measure_integration
signature: nil
location: 128 0 131 999
body:
  % Judgement subtype TCC generated (at line 50, column 30) for  c * h1
      % expected type  integrable1
  integrable1_scal: OBLIGATION
    FORALL (c, h1): integrable1?(*[[T1, T2]](c, h1));


decl_type: tcc
theory: product_integral_def
library: measure_integration
signature: nil
location: 133 0 135 999
body:
  % Judgement subtype TCC generated (at line 51, column 30) for  -h1
      % expected type  integrable1
  integrable1_opp: OBLIGATION FORALL (h1): integrable1?(-h1);


decl_type: tcc
theory: product_integral_def
library: measure_integration
signature: nil
location: 137 0 140 999
body:
  % Judgement subtype TCC generated (at line 52, column 30) for  g1 - h1
      % expected type  integrable1
  integrable1_diff: OBLIGATION
    FORALL (g1, h1): integrable1?((-[[T1, T2]])(g1, h1));


decl_type: tcc
theory: product_integral_def
library: measure_integration
signature: nil
location: 142 0 145 999
body:
  % Judgement subtype TCC generated (at line 55, column 30) for  g2 + h2
      % expected type  integrable2
  integrable2_add: OBLIGATION
    FORALL (g2, h2): integrable2?((+[[T1, T2]])(g2, h2));


decl_type: tcc
theory: product_integral_def
library: measure_integration
signature: nil
location: 147 0 150 999
body:
  % Judgement subtype TCC generated (at line 56, column 30) for  c * h2
      % expected type  integrable2
  integrable2_scal: OBLIGATION
    FORALL (c, h2): integrable2?(*[[T1, T2]](c, h2));


decl_type: tcc
theory: product_integral_def
library: measure_integration
signature: nil
location: 152 0 154 999
body:
  % Judgement subtype TCC generated (at line 57, column 30) for  -h2
      % expected type  integrable2
  integrable2_opp: OBLIGATION FORALL (h2): integrable2?(-h2);


decl_type: tcc
theory: product_integral_def
library: measure_integration
signature: nil
location: 156 0 159 999
body:
  % Judgement subtype TCC generated (at line 58, column 30) for  g2 - h2
      % expected type  integrable2
  integrable2_diff: OBLIGATION
    FORALL (g2, h2): integrable2?((-[[T1, T2]])(g2, h2));


decl_type: tcc
theory: product_integral_def
library: measure_integration
signature: nil
location: 161 0 178 999
body:
  % Subtype TCC generated (at line 61, column 13) for
      % {N1, f |
      %    FORALL x:
      %      NOT member(x, N1) =>
      %       integrable?(LAMBDA y: h1(x, y)) AND
      %        integral(LAMBDA y: h1(x, y)) = f(x)}
      % expected type  p:
                     %   (nonempty?
                     %        [[null_set[T1, S1, mu],
                     %          integrable[T1, S1, mu]]])
  null_integrable1_TCC1: OBLIGATION
    FORALL (h1: integrable1):
      nonempty?[[null_set[T1, S1, mu], integrable[T1, S1, mu]]]
          ({N1, f |
              FORALL x:
                NOT member[T1](x, N1) =>
                 integrable?[T2, S2, nu](LAMBDA y: h1(x, y)) AND
                  integral[T2, S2, nu](LAMBDA y: h1(x, y)) = f(x)});


decl_type: tcc
theory: product_integral_def
library: measure_integration
signature: nil
location: 180 0 197 999
body:
  % Subtype TCC generated (at line 66, column 13) for
      % {N2, g |
      %    FORALL y:
      %      NOT member(y, N2) =>
      %       integrable?(LAMBDA x: h2(x, y)) AND
      %        integral(LAMBDA x: h2(x, y)) = g(y)}
      % expected type  p:
                     %   (nonempty?
                     %        [[null_set[T2, S2, nu],
                     %          integrable[T2, S2, nu]]])
  null_integrable2_TCC1: OBLIGATION
    FORALL (h2: integrable2):
      nonempty?[[null_set[T2, S2, nu], integrable[T2, S2, nu]]]
          ({N2, g |
              FORALL y:
                NOT member[T2](y, N2) =>
                 integrable?[T1, S1, mu](LAMBDA x: h2(x, y)) AND
                  integral[T1, S1, mu](LAMBDA x: h2(x, y)) = g(y)});


decl_type: tcc
theory: product_integral_def
library: measure_integration
signature: nil
location: 199 0 209 999
body:
  % Subtype TCC generated (at line 83, column 6) for
      % LAMBDA x:
      %   LET (N1, f) = null_integrable1(h1) IN
      %     IF member(x, N1) THEN 0 ELSE f(x) ENDIF
      % expected type  integrable[T1, S1, mu]
  integral1_TCC1: OBLIGATION
    FORALL (h1: integrable1):
      integrable?[T1, S1, mu]
          (LAMBDA x:
             LET (N1, f) = null_integrable1(h1) IN
               IF member[T1](x, N1) THEN 0 ELSE f(x) ENDIF);


decl_type: tcc
theory: product_integral_def
library: measure_integration
signature: nil
location: 211 0 221 999
body:
  % Subtype TCC generated (at line 87, column 6) for
      % LAMBDA y:
      %   LET (N2, g) = null_integrable2(h2) IN
      %     IF member(y, N2) THEN 0 ELSE g(y) ENDIF
      % expected type  integrable[T2, S2, nu]
  integral2_TCC1: OBLIGATION
    FORALL (h2: integrable2):
      integrable?[T2, S2, nu]
          (LAMBDA y:
             LET (N2, g) = null_integrable2(h2) IN
               IF member[T2](y, N2) THEN 0 ELSE g(y) ENDIF);


decl_type: tcc
theory: finite_integral
library: measure_integration
signature: nil
location: 31 0 34 999
body:
  % Judgement subtype TCC generated (at line 24, column 15) for  x
      % expected type  integrable[T, S, to_measure(mu)]
  bounded_measurable_is_integrable: OBLIGATION
    FORALL (x: bounded_measurable): integrable?[T, S, to_measure(mu)](x);


decl_type: formula
theory: monotone_classes
library: measure_integration
signature: nil
location: 25 2 29 31
body:
    monotone_finite_measures: COROLLARY FORALL (nu,mu:finite_measure):    % 4.6.7
      (FORALL a,b: member(intersection(a,b),C))              AND
      (FORALL a:   finite_disjoint_union?(C)(complement(a))) AND
      (FORALL a:   mu(a) = nu(a))                            =>
      (FORALL x:   mu(x) = nu(x))


decl_type: tcc
theory: monotone_classes
library: measure_integration
signature: nil
location: 36 0 41 999
body:
  % Subtype TCC generated (at line 28, column 20) for  a
      % expected type  (generated_sigma_algebra(C))
  monotone_finite_measures_TCC1: OBLIGATION
    (FORALL a: finite_disjoint_union?(C)(complement(a))) AND
     (FORALL a, b: member(intersection(a, b), C))
     IMPLIES (FORALL (a1): generated_sigma_algebra[T](C)(a1));


decl_type: formula
theory: sets_lemmas_aux
library: measure_integration
signature: nil
location: 21 2 22 78
body:
    disjoint_member:         LEMMA disjoint?(a,b) AND member(x,a) IMPLIES
                                                                 NOT member(x,b)


decl_type: formula
theory: finite_measure
library: measure_integration
signature: nil
location: 27 2 28 76
body:
    fm_convergence:   LEMMA disjoint?(X)
                                 => convergence(series(mu o X), mu(IUnion(X)))


decl_type: formula
theory: finite_measure
library: measure_integration
signature: nil
location: 31 2 32 79
body:
    fm_union:         LEMMA mu(union(A,B))
                                          = mu(A) + mu(B) - mu(intersection(A,B))


decl_type: formula
theory: finite_measure
library: measure_integration
signature: nil
location: 33 2 34 72
body:
    fm_intersection:  LEMMA mu(intersection(A,B))
                                          = mu(A) + mu(B) - mu(union(A,B))


decl_type: formula
theory: finite_measure
library: measure_integration
signature: nil
location: 35 2 36 77
body:
    fm_difference:    LEMMA mu(difference(A,B))
                                          = mu(A) - mu(B) + mu(difference(B,A))


decl_type: formula
theory: finite_measure
library: measure_integration
signature: nil
location: 41 2 42 75
body:
    fm_IIntersection: LEMMA decreasing?(X)
                                 => convergence(mu o X, mu(IIntersection(X)))


decl_type: tcc
theory: finite_measure
library: measure_integration
signature: nil
location: 53 0 55 999
body:
  % Subtype TCC generated (at line 46, column 30) for  LAMBDA A: (TRUE, mu(A))
      % expected type  measure_type[T, S]
  measure_from_TCC1: OBLIGATION measure?[T, S](LAMBDA A: (TRUE, mu(A)));


decl_type: formula
theory: product_sections
library: measure_integration
signature: nil
location: 27 2 29 51
body:
    x_section_intersection: LEMMA
      x_section(intersection(X,Y),a)
        = intersection(x_section(X,a),x_section(Y,a))


decl_type: formula
theory: product_sections
library: measure_integration
signature: nil
location: 38 2 40 51
body:
    y_section_intersection: LEMMA
      y_section(intersection(X,Y),b)
        = intersection(y_section(X,b),y_section(Y,b))


decl_type: formula
theory: product_sigma_def
library: measure_integration
signature: nil
location: 43 2 44 57
body:
    x_section_measurable:   LEMMA member(Z,sigma_times(S1,S2)) =>
                                  member(x_section(Z,x),S2)


decl_type: formula
theory: product_sigma_def
library: measure_integration
signature: nil
location: 45 2 46 57
body:
    y_section_measurable:   LEMMA member(Z,sigma_times(S1,S2)) =>
                                  member(y_section(Z,y),S1)


decl_type: formula
theory: product_sigma_def
library: measure_integration
signature: nil
location: 48 2 50 38
body:
    sigma_cross_projection: LEMMA                                         % 7.2.7
       member(cross_product(NX,NY),sigma_times(S1,S2)) =>
       (member(NX,S1) AND member(NY,S2))


decl_type: type
theory: product_sigma_def
library: measure_integration
signature: nil
location: 36 2 37 78
body:
    measurable_rectangle(S1,S2): TYPE+ = (measurable_rectangle?(S1,S2))
                                                             CONTAINING emptyset


decl_type: function
theory: product_sigma_def
library: measure_integration
signature:
  [[sigma_algebra[T1], sigma_algebra[T2]] ->
  sigma_algebra[[T1, T2]]]

location: 40 2 41 67
body:
    sigma_times(S1,S2):sigma_algebra[[T1,T2]]
      = generated_sigma_algebra(fullset[measurable_rectangle(S1,S2)])


decl_type: tcc
theory: product_sigma_def
library: measure_integration
signature: nil
location: 57 0 61 999
body:
  % Subtype TCC generated (at line 37, column 70) for  emptyset
      % expected type  measurable_rectangle(S1, S2)
  measurable_rectangle_TCC1: OBLIGATION
    FORALL (S1: sigma_algebra[T1], S2: sigma_algebra[T2]):
      measurable_rectangle?(S1, S2)(emptyset[[T1, T2]]);


decl_type: formula
theory: product_sigma
library: measure_integration
signature: nil
location: 37 2 39 69
body:
    rectangle_algebra_aux: LEMMA
      generated_subset_algebra[[T1,T2]](measurable_rectangle?(S1,S2))
        = finite_disjoint_unions[[T1,T2]](measurable_rectangle?(S1,S2))


