# Proofs

proof_type: f_proof
decl_type: formula
library: matrices
theory: matrix_props
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skeep)
   (lemma "full_matrix_eq")
   (inst?)
   (assert)
   (hide 2)
   (skosimp*)
   (typepred "i!1")
   (typepred "j!1")
   (typepred "swap(i, j)(swap(i, j)(D))")
   (hide (-1 -2 -3 -4 -7))
   (copy -3)
   (copy -5)
   (replace -4)
   (replace -3)
   (typepred "swap(i,j)(D)")
   (hide (-1 -2 -3 -4 -7))
   (copy -3)
   (copy -5)
   (replace -4)
   (replace -3)
   (assert)
   (typepred "swap(i, j)(swap(i, j)(D))")
   (hide (-1 -2 -3 -4 -5 -6))
   (inst - "i!1" "j!1")
   (invoke (case "%1") (! -1 1))
   (("1"
     (flatten)
     (assert)
     (replaces -3 +)
     (assert)
     (lift-if)
     (ground)
     (("1"
       (replaces -1)
       (typepred "swap(i,j)(D)")
       (hide (-1 -2 -3 -4 -5 -6))
       (inst - "j" "j!1")
       (assert)
       (replaces -1)
       (lift-if)
       (ground))
      ("2"
       (typepred "swap(i,j)(D)")
       (hide (-1 -2 -3 -4 -5 -6))
       (inst - "i" "j!1")
       (ground))
      ("3"
       (typepred "swap(i,j)(D)")
       (hide (-1 -2 -3 -4 -5 -6))
       (inst - "i!1" "j!1")
       (ground))))
    ("2" (split 1) (("1" (assert)) ("2" (assert))))))


proof_type: f_proof
decl_type: formula
library: matrices
theory: matrix_props
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skeep)
   (rewrite "full_matrix_eq")
   (assert)
   (skosimp*)
   (expand "swap" + 1)
   (rewrite "entry_form_matrix")
   (expand "swap" + 2)
   (rewrite "entry_form_matrix")
   (expand "swap" + 3)
   (expand "swap" + 1)
   (expand "swap" + 1)
   (assert)
   (lift-if)
   (lift-if)
   (lift-if)
   (lift-if)
   (ground)
   (("1"
     (rewrite "entry_form_matrix")
     (expand "swap" + 1)
     (ground)
     (expand "swap" + 1)
     (rewrite "entry_form_matrix")
     (expand "swap" +)
     (propax))
    ("2"
     (expand "swap" + 1)
     (rewrite "entry_form_matrix")
     (expand "swap" +)
     (rewrite "entry_form_matrix")
     (expand "swap" +)
     (propax))
    ("3"
     (rewrite "entry_form_matrix")
     (expand "swap" +)
     (rewrite "entry_form_matrix")
     (expand "swap" +)
     (assert))
    ("4"
     (rewrite "entry_form_matrix")
     (expand "swap" +)
     (rewrite "entry_form_matrix")
     (expand "swap" +)
     (propax))))


proof_type: f_proof
decl_type: formula
library: matrices
theory: matrix_props
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (case "FORALL (D: PosFullMatrix, i, j, n: nat):
                                      i < j AND i < rows(D) AND j < rows(D) AND rows(D)=columns(D) AND rows(D)=n+2 IMPLIES
                                       det(swap(i, j)(D)) = -det(D)")
   (("1"
     (skeep)
     (case "rows(D)/=columns(D)")
     (("1" (flatten) (assert) (expand "det" +) (propax))
      ("2"
       (flatten)
       (case "i < j")
       (("1"
         (inst - "D" "i" "j" "rows(D)-2")
         (("1" (assert)) ("2" (assert))))
        ("2"
         (inst - "D" "j" "i" "rows(D)-2")
         (("1" (assert) (rewrite "swap_sym" -)) ("2" (assert))))))))
    ("2"
     (hide 2)
     (induct "n")
     (("1" (skeep) (assert) (lemma "det_swap_0_1") (inst - "D") (assert))
      ("2"
       (skolem 1 "n")
       (flatten)
       (assert)
       (case "NOT FORALL (D: PosFullMatrix, i, j: nat):
                          1<=i AND i < j AND i < rows(D) AND j < rows(D) AND rows(D) = columns(D)
                      AND rows(D) = 3 + n
                      IMPLIES det(swap(i, j)(D)) = -det(D)")
       (("1"
         (hide 2)
         (skeep)
         (expand "det" +)
         (lift-if)
         (lift-if)
         (lift-if)
         (lift-if)
         (assert)
         (assert)
         (ground)
         (("1"
           (typepred "swap(i,j)(D)")
           (expand "rows")
           (expand "length")
           (assert))
          ("2" (typepred "D") (expand "rows") (expand "length") (assert))
          ("3"
           (case "FORALL (rr:real): -rr=(-1)*rr")
           (("1"
             (invoke (inst - "%1") (! 2 2 1))
             (replaces -1)
             (rewrite "sigma_scal" :dir rl)
             (typepred "swap(i,j)(D)")
             (hide (-1 -2 -3 -4 -5 -7))
             (replaces -1)
             (assert)
             (rewrite "sigma_eq" 2)
             (hide 3)
             (skosimp*)
             (case "entry(swap(i, j)(D))(0, n!1) = entry(D)(0, n!1)")
             (("1"
               (replaces -1)
               (assert)
               (case "remove(swap(i, j)(D), 0, n!1) = swap(i-1,j-1)(remove(D,0,n!1))")
               (("1"
                 (replaces -1)
                 (inst?)
                 (assert)
                 (typepred "remove(D,0,n!1)")
                 (assert)
                 (flatten)
                 (assert))
                ("2" (hide 2) (hide -1) (rewrite "remove_swap_2"))
                ("3"
                 (assert)
                 (hide 2)
                 (typepred "remove(D,0,n!1)")
                 (assert)
                 (flatten)
                 (assert))))
              ("2" (typepred "swap(i,j)(D)") (rewrite -7))))
            ("2" (assert))))))
        ("2"
         (skeep)
         (case "NOT i = 0")
         (("1" (inst - "D" "i" "j") (assert))
          ("2"
           (replaces -1)
           (assert)
           (lemma "swap_similar")
           (inst - "D" "1" "j" "0")
           (assert)
           (case "j = 1")
           (("1" (hide -2) (lemma "det_swap_0_1") (inst?) (assert))
            ("2"
             (assert)
             (replaces -1 +)
             (inst-cp - "swap(0, 1)(swap(1, j)(D))" "1" "j")
             (assert)
             (replaces -2)
             (rewrite "det_swap_0_1" +)
             (inst - "D" "1" "j")
             (assert))))))))))))


proof_type: f_proof
decl_type: formula
library: matrices
theory: matrix_props
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skeep)
   (rewrite "list_extensionality[real]")
   (split)
   (("1"
     (rewrite "length_row")
     (rewrite "length_row")
     (rewrite "length_row")
     (rewrite "length_row")
     (lift-if)
     (assert))
    ("2"
     (skeep)
     (lemma "entry_swap")
     (inst - "D" "i" "j" "k" "n")
     (expand "entry")
     (expand "access" -1)
     (replaces -1)
     (expand "swap")
     (lift-if)
     (lift-if)
     (assert)
     (rewrite "length_row")
     (rewrite "length_row")
     (rewrite "length_row")
     (assert)
     (ground)
     (("1"
       (expand "row" 2)
       (expand "rows")
       (assert)
       (typepred "n")
       (rewrite "length_row")
       (assert))
      ("2" (typepred "n") (rewrite "length_row") (assert))
      ("3" (typepred "n") (rewrite "length_row") (assert))
      ("4" (typepred "n") (rewrite "length_row") (lift-if) (ground))))))


proof_type: f_proof
decl_type: formula
library: matrices
theory: matrix_props
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skeep)
   (lemma "full_matrix_eq")
   (inst?)
   (assert)
   (skosimp*)
   (typepred "swap(i,i)(D)")
   (hide (-1 -2 -3 -4 -5 -6))
   (inst - "i!1" "j!1")
   (assert)
   (case "i < rows(D)")
   (("1" (assert) (replaces -2) (assert) (lift-if) (ground))
    ("2"
     (hide -)
     (expand "swap")
     (rewrite "entry_form_matrix")
     (expand "swap" 2)
     (lift-if)
     (ground))))


proof_type: f_proof
decl_type: formula
library: matrices
theory: matrix_props
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skeep)
   (rewrite "full_matrix_eq")
   (split)
   (("1" (assert)) ("2" (assert))
    ("3"
     (skosimp*)
     (rewrite "entry_swap")
     (expand "swap")
     (expand "entry")
     (lift-if)
     (ground))))


proof_type: f_proof
decl_type: formula
library: matrices
theory: matrix_props
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skeep)
   (rewrite "full_matrix_eq")
   (split)
   (("1"
     (rewrite "rows_remove")
     (assert)
     (rewrite "rows_remove")
     (assert))
    ("2"
     (rewrite "columns_remove")
     (rewrite "columns_remove")
     (lift-if)
     (lift-if)
     (lift-if)
     (ground))
    ("3"
     (skosimp*)
     (rewrite "entry_remove")
     (rewrite "entry_remove")
     (rewrite "entry_replace_row")
     (assert)
     (lift-if)
     (lift-if)
     (assert)
     (lift-if)
     (lift-if)
     (lift-if)
     (lift-if)
     (lift-if)
     (lift-if)
     (assert)
     (lift-if)
     (ground))))


proof_type: f_proof
decl_type: formula
library: matrices
theory: matrix_props
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skeep)
   (lift-if)
   (ground)
   (("1"
     (replaces -1)
     (assert)
     (rewrite "full_matrix_eq")
     (skosimp*)
     (typepred "replace_row(j, v)(swap(k, j)(D))")
     (inst? -8)
     (replace -8)
     (hide (-1 -2 -3 -4 -5 -6 -7 -8))
     (lift-if)
     (split +)
     (("1"
       (flatten)
       (replace -2)
       (assert)
       (typepred "swap(k, j)(replace_row(k, v)(D))")
       (assert)
       (inst? -7)
       (replace -7)
       (hide (-1 -2 -3 -4 -5 -6 -7))
       (assert)
       (lift-if)
       (split +)
       (("1"
         (flatten)
         (typepred "replace_row(k, v)(D)")
         (inst? -8)
         (replace -8)
         (lift-if)
         (assert))
        ("2"
         (flatten)
         (typepred "replace_row(k, v)(D)")
         (inst? -8)
         (assert))))
      ("2"
       (flatten)
       (assert)
       (typepred "swap(k, j)(replace_row(k, v)(D))")
       (assert)
       (inst? -7)
       (replace -7)
       (assert)
       (lift-if)
       (split +)
       (("1"
         (flatten)
         (assert)
         (typepred "replace_row(k, v)(D)")
         (inst? -8)
         (assert)
         (replace -8)
         (typepred "swap(k,j)(D)")
         (inst? -7)
         (assert))
        ("2"
         (flatten)
         (assert)
         (typepred "replace_row(k, v)(D)")
         (inst? -8)
         (assert)
         (replace -8)
         (typepred "swap(k,j)(D)")
         (inst? -7)
         (assert))))))
    ("2"
     (replaces -1)
     (assert)
     (rewrite "full_matrix_eq")
     (skosimp*)
     (typepred "replace_row(i, v)(swap(i,k)(D))")
     (inst? -8)
     (replace -8)
     (hide (-1 -2 -3 -4 -5 -6 -7 -8))
     (lift-if)
     (split +)
     (("1"
       (flatten)
       (replace -2)
       (assert)
       (typepred "swap(i, k)(replace_row(k, v)(D))")
       (assert)
       (inst? -7)
       (replace -7)
       (hide (-1 -2 -3 -4 -5 -6 -7))
       (assert)
       (typepred "replace_row(k, v)(D)")
       (inst? -8)
       (replace -8)
       (lift-if)
       (assert))
      ("2"
       (flatten)
       (typepred "replace_row(k, v)(D)")
       (inst? -8)
       (assert)
       (typepred "swap(i,k)(replace_row(k, v)(D))")
       (assert)
       (inst? -7)
       (replace -7)
       (assert)
       (lift-if)
       (split +)
       (("1"
         (flatten)
         (assert)
         (typepred "replace_row(k, v)(D)")
         (inst? -8)
         (assert)
         (replace -8)
         (typepred "swap(i,k)(D)")
         (inst? -7)
         (assert))
        ("2"
         (flatten)
         (assert)
         (typepred "replace_row(k, v)(D)")
         (inst? -8)
         (assert)
         (replace -8)
         (typepred "swap(i,k)(D)")
         (inst? -7)
         (assert))))))
    ("3"
     (rewrite "full_matrix_eq")
     (skosimp*)
     (typepred "replace_row(k, v)(swap(i,j)(D))")
     (inst? -8)
     (replace -8)
     (hide (-1 -2 -3 -4 -5 -6 -7 -8))
     (lift-if)
     (split +)
     (("1"
       (flatten)
       (replace -2)
       (assert)
       (typepred "swap(i, j)(replace_row(k, v)(D))")
       (assert)
       (inst? -7)
       (replace -7)
       (hide (-1 -2 -3 -4 -5 -6 -7))
       (assert)
       (typepred "replace_row(k, v)(D)")
       (inst? -8)
       (replace -8)
       (lift-if)
       (assert))
      ("2"
       (flatten)
       (typepred "replace_row(k, v)(D)")
       (inst? -8)
       (assert)
       (typepred "swap(i,j)(replace_row(k, v)(D))")
       (assert)
       (inst? -7)
       (replace -7)
       (assert)
       (lift-if)
       (split +)
       (("1"
         (flatten)
         (assert)
         (typepred "replace_row(k, v)(D)")
         (inst? -8)
         (assert)
         (replace -8)
         (typepred "swap(i,j)(D)")
         (inst? -7)
         (assert))
        ("2"
         (flatten)
         (assert)
         (split +)
         (("1"
           (flatten)
           (typepred "replace_row(k, v)(D)")
           (inst? -8)
           (assert)
           (replace -8)
           (typepred "swap(i,j)(D)")
           (inst? -7)
           (assert))
          ("2"
           (flatten)
           (assert)
           (typepred "replace_row(k, v)(D)")
           (inst? -8)
           (assert)
           (replace -8)
           (typepred "swap(i,j)(D)")
           (inst? -7)
           (assert))))))))))


proof_type: f_proof
decl_type: formula
library: matrices
theory: matrix_props
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skeep)
   (rewrite "full_matrix_eq")
   (split)
   (("1" (rewrite "rows_remove") (rewrite "rows_remove") (assert))
    ("2"
     (rewrite "columns_remove")
     (rewrite "columns_remove")
     (lift-if)
     (lift-if)
     (lift-if)
     (ground))
    ("3"
     (skosimp*)
     (rewrite "entry_remove")
     (rewrite "entry_remove")
     (rewrite "entry_replace_row")
     (lift-if)
     (lift-if)
     (lift-if)
     (lift-if)
     (lift-if)
     (lift-if)
     (assert)
     (lift-if)
     (lift-if)
     (lift-if)
     (lift-if)
     (lift-if)
     (lift-if)
     (lift-if)
     (assert)
     (ground))))


proof_type: f_proof
decl_type: formula
library: matrices
theory: matrix_props
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (case "FORALL (D: PosFullMatrix, i: nat, v1, v2: Vector):
                               length(v1) = length(v2) AND columns(D) = length(v1) IMPLIES
                                det(replace_row(0, v1 + v2)(D)) =
                                 det(replace_row(0, v1)(D)) + det(replace_row(0, v2)(D))")
   (("1"
     (skeep)
     (case "i = 0")
     (("1" (inst - "D" "0" "v1" "v2") (assert))
      ("2"
       (case "i<rows(D)")
       (("1"
         (lemma "det_swap")
         (inst - "replace_row(i,v1+v2)(D)" "i" "0")
         (assert)
         (neg-formula -1)
         (replace -1 :dir rl)
         (hide -1)
         (lemma "det_swap")
         (inst - "replace_row(i,v1)(D)" "i" "0")
         (assert)
         (neg-formula -1)
         (replace -1 :dir rl)
         (hide -1)
         (lemma "det_swap")
         (inst - "replace_row(i,v2)(D)" "i" "0")
         (assert)
         (neg-formula -1)
         (replace -1 :dir rl)
         (hide -1)
         (rewrite "swap_replace_row")
         (("1"
           (rewrite "swap_replace_row")
           (rewrite "swap_replace_row")
           (inst - "swap(i,0)(D)" "0" "v1" "v2")
           (assert))
          ("2" (hide 3) (typepred "v1+v2") (expand "max") (assert))))
        ("2" (propax))))))
    ("2"
     (hide 2)
     (skeep)
     (case "rows(D)/=columns(D)")
     (("1"
       (flatten)
       (rewrite "det_size_noteq")
       (rewrite "det_size_noteq")
       (rewrite "det_size_noteq"))
      ("2"
       (flatten)
       (expand "det" 1 1)
       (lift-if)
       (split +)
       (("1"
         (flatten)
         (typepred "replace_row(0,v1+v2)(D)")
         (("1" (grind))
          ("2" (typepred "v1+v2") (expand "max") (assert))))
        ("2"
         (flatten)
         (split +)
         (("1"
           (flatten)
           (expand "det" 1 1)
           (lift-if)
           (split +)
           (("1"
             (flatten)
             (hide-all-but (-1 -4))
             (typepred "replace_row(0,v1)(D)")
             (("1"
               (hide (-1 -2 -7 -8))
               (split -)
               (("1" (grind)) ("2" (ground))))
              ("2"
               (typepred "D")
               (assert)
               (split -)
               (("1" (grind))
                ("2"
                 (split -)
                 (("1" (grind)) ("2" (flatten) (assert))))))))
            ("2"
             (flatten)
             (split +)
             (("1"
               (flatten)
               (assert)
               (expand "det" +)
               (lift-if)
               (split +)
               (("1" (flatten) (assert) (grind))
                ("2"
                 (flatten)
                 (rewrite "entry_replace_row" +)
                 (("1"
                   (rewrite "entry_replace_row" +)
                   (rewrite "entry_replace_row" +)
                   (expand "access" +)
                   (assert)
                   (lift-if)
                   (split +)
                   (("1"
                     (flatten)
                     (expand "+" 1)
                     (expand "add" 1)
                     (lift-if)
                     (ground)
                     (("1" (grind)) ("2" (grind))
                      ("3" (expand "nth" 2) (propax))))
                    ("2" (flatten) (grind))))
                  ("2" (grind))))))
              ("2" (flatten) (hide 2) (grind))))))
          ("2"
           (flatten)
           (rewrite "columns_replace_row" +)
           (("1"
             (name "FF"
                   "LAMBDA (k):
                                                  det(remove(replace_row(0, v1 + v2)(D), 0, k)) *
                                                   entry(replace_row(0, v1 + v2)(D))(0, k)
                                                   * (-1) ^ k")
             (name "F1"
                   "LAMBDA (k):
                                                  det(remove(replace_row(0, v1)(D), 0, k)) *
                                                   entry(replace_row(0, v1)(D))(0, k)
                                                   * (-1) ^ k")
             (name "F2"
                   "LAMBDA (k):
                                                  det(remove(replace_row(0, v2)(D), 0, k)) *
                                                   entry(replace_row(0, v2)(D))(0, k)
                                                   * (-1) ^ k")
             (case "FF = F1 + F2")
             (("1"
               (replace -4)
               (replace -1 +)
               (expand "+" 2 1)
               (rewrite "sigma_sum" :dir rl)
               (case "FORALL (a,b,c,d:real): a=c AND b=d IMPLIES a+b=c+d")
               (("1"
                 (rewrite -1 2)
                 (("1"
                   (hide (-1 2 3))
                   (expand "det" 1)
                   (lift-if)
                   (ground)
                   (hide-all-but (-1 2))
                   (typepred "replace_row(0,v1)(D)")
                   (typepred "replace_row(0,v1+v2)(D)")
                   (expand "rows")
                   (expand "length")
                   (assert))
                  ("2"
                   (hide 3)
                   (expand "det" 1)
                   (lift-if)
                   (ground)
                   (hide-all-but (-1 3))
                   (typepred "replace_row(0,v1+v2)(D)")
                   (typepred "replace_row(0,v2)(D)")
                   (expand "rows")
                   (expand "length")
                   (assert))))
                ("2" (hide-all-but 1) (grind))))
              ("2"
               (hide 3)
               (decompose-equality 1)
               (case "FORALL (vvv:Vector): length(vvv)=columns(D) IMPLIES remove(replace_row(0, vvv)(D), 0, x!1)=remove(replace_row(0, v2)(D), 0, x!1)")
               (("1"
                 (hide (-2 -3 -4))
                 (expand "FF" 1)
                 (expand "F1" 1)
                 (expand "F2" 1)
                 (expand "+")
                 (inst-cp - "v1")
                 (assert)
                 (replaces -2)
                 (inst-cp - "add(v1,v2)")
                 (assert)
                 (split -2)
                 (("1"
                   (replaces -1)
                   (assert)
                   (case "entry(replace_row(0, add(v1, v2))(D))(0, x!1)
                                                     =
                                                      entry(replace_row(0, v1)(D))(0, x!1)+
                                                       entry(replace_row(0, v2)(D))(0, x!1)")
                   (("1" (assert))
                    ("2"
                     (hide 2)
                     (rewrite "entry_replace_row" +)
                     (("1"
                       (rewrite "entry_replace_row" +)
                       (rewrite "entry_replace_row" +)
                       (lemma "access_sum")
                       (expand "+" -1)
                       (rewrite -1))
                      ("2"
                       (hide 2)
                       (typepred "add(v1,v2)")
                       (expand "max")
                       (assert))))))
                  ("2" (typepred "add(v1,v2)") (expand "max") (assert))))
                ("2"
                 (skeep)
                 (rewrite "remove_replace_row" 1)
                 (rewrite "remove_replace_row" 1))
                ("3" (assert) (skeep) (assert))))))
            ("2" (typepred "v1+v2") (expand "max") (assert))))))))))
    ("3" (hide 2) (skosimp*) (assert))
    ("4"
     (hide 2)
     (skosimp*)
     (typepred "v1!1+v2!1")
     (expand "max")
     (assert))))


proof_type: f_proof
decl_type: formula
library: matrices
theory: matrix_props
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (case "FORALL (D: PosFullMatrix, i: nat, r: real, v: Vector):
                                                           columns(D) = length(v) AND 0 < rows(D) IMPLIES
                                                            det(replace_row(0, r * v)(D)) = r * det(replace_row(0,v)(D))")
   (("1"
     (skeep)
     (lemma "det_swap")
     (inst-cp - "replace_row(i,r*v)(D)" "i" "0")
     (inst - "replace_row(i,v)(D)" "i" "0")
     (assert)
     (case "i = 0")
     (("1" (hide -2) (inst - "D" "i" "r" "v") (assert))
      ("2"
       (assert)
       (neg-formula -1)
       (neg-formula -2)
       (replace -1 :dir rl)
       (replace -2 :dir rl)
       (rewrite "swap_replace_row")
       (rewrite "swap_replace_row")
       (assert)
       (inst - "swap(i,0)(D)" "0" "r" "v")
       (assert))))
    ("2"
     (hide 2)
     (skeep)
     (expand "det")
     (lift-if)
     (lift-if)
     (lift-if)
     (lift-if)
     (assert)
     (ground)
     (("1" (grind))
      ("2"
       (typepred "replace_row(0,r*v)(D)")
       (typepred "replace_row(0,v)(D)")
       (expand "rows")
       (expand "length")
       (assert))
      ("3" (grind))
      ("4"
       (rewrite "entry_replace_row")
       (rewrite "entry_replace_row")
       (rewrite "access_scal"))
      ("5"
       (typepred "replace_row(0,r*v)(D)")
       (typepred "replace_row(0,v)(D)")
       (expand "rows")
       (expand "length")
       (assert))
      ("6"
       (rewrite "sigma_scal" :dir rl)
       (typepred "replace_row(0,r*v)(D)")
       (replace -6)
       (typepred "replace_row(0,v)(D)")
       (replace -6)
       (assert)
       (rewrite "sigma_eq" +)
       (hide 3)
       (skosimp*)
       (rewrite "remove_replace_row_eq")
       (rewrite "remove_replace_row_eq")
       (rewrite "entry_replace_row" +)
       (rewrite "entry_replace_row" +)
       (rewrite "access_scal")
       (assert))))
    ("3" (hide 2) (skeep) (assert))))


proof_type: f_proof
decl_type: formula
library: matrices
theory: matrix_props
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skeep)
   (case "i < rows(D)")
   (("1"
     (rewrite "full_matrix_eq")
     (split)
     (("1" (assert)) ("2" (assert))
      ("3"
       (skosimp*)
       (rewrite "entry_replace_row")
       (("1" (expand "entry") (lift-if) (ground))
        ("2" (hide 2) (rewrite "length_row"))))))
    ("2" (propax))))


proof_type: f_proof
decl_type: formula
library: matrices
theory: matrix_props
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skeep)
   (rewrite "det_replace_row_sum")
   (("1"
     (rewrite "det_replace_row_scal")
     (("1"
       (lemma "det_rows_eq_0")
       (inst - "replace_row(i,row(D)(j))(D)" "i" "j")
       (assert)
       (split -1)
       (("1" (replaces -1) (rewrite "replace_row_id") (assert))
        ("2"
         (hide 3)
         (rewrite "row_replace_row")
         (("1" (rewrite "row_replace_row") (rewrite "length_row"))
          ("2" (rewrite "length_row"))))))
      ("2" (rewrite "length_row"))))
    ("2"
     (rewrite "length_row")
     (assert)
     (lemma "length_row")
     (inst - "D" "j")
     (assert))
    ("3" (rewrite "length_row"))))


proof_type: f_proof
decl_type: formula
library: matrices
theory: matrix_props
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (case "FORALL (n: nat): det(Id(n+1)) = 1")
   (("1" (skeep) (inst - "pn-1") (assert))
    ("2"
     (hide 2)
     (induct "n")
     (("1" (assert) (grind))
      ("2"
       (skeep)
       (assert)
       (expand "det" +)
       (assert)
       (lift-if)
       (ground)
       (("1"
         (typepred "Id(2+j)")
         (expand "rows")
         (expand "length")
         (assert))
        ("2"
         (lemma "sigma_eq_one_arg2")
         (inst?)
         (inst - "0")
         (assert)
         (split -)
         (("1"
           (replaces -1)
           (rewrite "remove_Id_0_0")
           (replaces -1)
           (assert)
           (rewrite "entry_Id")
           (grind))
          ("2" (hide 3) (skosimp*) (rewrite "entry_Id") (assert))))))))))


proof_type: f_proof
decl_type: formula
library: matrices
theory: matrix_props
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (case "FORALL (D: PosFullMatrix,kz:nat): kz+1=rows(D) AND
                        (FORALL (i): i < rows(D) IMPLIES entry(D)(i, 0) = 0) IMPLIES
                         det(D) = 0")
   (("1" (skeep) (inst - "D" "rows(D)-1") (assert))
    ("2"
     (hide 2)
     (induct "kz")
     (("1"
       (skeep)
       (assert)
       (expand "det" 1)
       (assert)
       (lift-if)
       (ground)
       (inst - "0")
       (assert))
      ("2"
       (skeep)
       (assert)
       (skeep)
       (assert)
       (expand "det" +)
       (lift-if)
       (ground)
       (rewrite "sigma_restrict_eq_0" 2)
       (hide 3)
       (skeep)
       (typepred "i")
       (case "i = 0")
       (("1" (inst -7 "0") (assert))
        ("2"
         (inst - "remove(D,0,i)")
         (("1"
           (assert)
           (split +)
           (("1" (rewrite "rows_remove") (assert))
            ("2"
             (skosimp*)
             (rewrite "entry_remove")
             (inst - "1+i!1")
             (assert)
             (rewrite "rows_remove")
             (assert))))
          ("2"
           (rewrite "rows_remove")
           (assert)
           (rewrite "columns_remove")
           (assert))))))))))


proof_type: f_proof
decl_type: formula
library: matrices
theory: matrix_props
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skeep)
   (rewrite "full_matrix_eq")
   (case "NOT ( (rows(remove(transpose(D), i, j)) = rows(transpose(remove(D, j, i)))
                 AND
                 columns(remove(transpose(D), i, j)) =
                  columns(transpose(remove(D, j, i)))))")
   (("1"
     (hide 2)
     (split)
     (("1"
       (rewrite "rows_remove")
       (rewrite "rows_transpose")
       (rewrite "rows_transpose")
       (rewrite "columns_remove")
       (assert))
      ("2"
       (rewrite "columns_remove")
       (assert)
       (rewrite "rows_transpose")
       (assert)
       (rewrite "columns_transpose")
       (rewrite "columns_transpose")
       (rewrite "rows_remove"))))
    ("2"
     (flatten)
     (assert)
     (skosimp*)
     (rewrite "entry_remove")
     (rewrite "rows_transpose" +)
     (rewrite "columns_transpose" +)
     (assert)
     (rewrite "entry_transpose" +)
     (rewrite "entry_transpose" +)
     (rewrite "entry_remove" +))
    ("3"
     (hide 2)
     (flatten)
     (rewrite "rows_remove" +)
     (rewrite "columns_remove" +)
     (assert))
    ("4"
     (hide 2)
     (rewrite "rows_remove" +)
     (rewrite "columns_remove" +)
     (assert))))


proof_type: t_proof
decl_type: tcc
library: matrices
theory: matrix_props
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skeep)
   (ground)
   (("1" (grind))
    ("2"
     (skeep 1)
     (rewrite "columns_0_entry")
     (("1" (rewrite "columns_0_entry"))
      ("2" (expand "columns" 1) (propax))))))


proof_type: t_proof
decl_type: tcc
library: matrices
theory: matrix_props
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skeep)
   (assert)
   (ground)
   (("1" (rewrite "rows_form_matrix" 1))
    ("2" (lemma "columns_form_matrix") (inst?) (assert))
    ("3"
     (skosimp*)
     (rewrite "entry_form_matrix")
     (lift-if)
     (split)
     (("1" (propax))
      ("2"
       (flatten)
       (rewrite "entry_eq_0")
       (lift-if)
       (lift-if)
       (lift-if)
       (assert)
       (ground))))))


proof_type: j_proof
decl_type: tcc
library: matrices
theory: matrix_props
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skeep)
   (skosimp*)
   (name "R" "remove(D,i,j)")
   (replace -1)
   (assert)
   (expand "remove" -1)
   (invoke (name "FZ" "%1") (! -1 1))
   (replaces -1)
   (typepred "FZ")
   (assert)
   (copy -5)
   (inst - "i!1" "j!1")
   (assert))


proof_type: t_proof
decl_type: tcc
library: matrices
theory: matrix_props
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skeep)
   (skeep)
   (typepred "remove(M,0,k)")
   (case "rows(M)=0")
   (("1" (hide-all-but (-1 2)) (grind))
    ("2" (hide -1) (assert) (flatten) (expand "rows") (assert))))


proof_type: t_proof
decl_type: tcc
library: matrices
theory: matrix_props
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skeep)
   (assert)
   (rewrite "rows_form_matrix")
   (assert)
   (lemma "columns_form_matrix")
   (inst?)
   (assert)
   (name "FM" "form_matrix(swap(i, j)(entry(D)), rows(D), columns(D))")
   (replaces -1)
   (skeep)
   (expand "FM" 1)
   (rewrite "entry_form_matrix")
   (lift-if)
   (lift-if)
   (lift-if)
   (assert)
   (expand "swap" 1)
   (lemma "entry_eq_0")
   (inst-cp - "D" "k" "p")
   (assert)
   (inst-cp - "D" "i" "p")
   (inst-cp - "D" "j" "p")
   (ground))


proof_type: t_proof
decl_type: tcc
library: matrices
theory: matrix_props
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skeep)
   (replace -1)
   (assert)
   (split)
   (("1"
     (skosimp*)
     (expand "nth")
     (lift-if)
     (lift-if)
     (lift-if)
     (ground)
     (("1"
       (replaces -1)
       (typepred "D")
       (assert)
       (split -)
       (("1" (grind))
        ("2"
         (typepred "columns(D)")
         (assert)
         (skosimp*)
         (inst - "i!2" "j!1")
         (("1" (expand "nth" -3 2) (assert))
          ("2"
           (typepred "j!1")
           (expand "length" -1)
           (expand "length" 1)
           (assert)
           (lift-if)
           (ground)
           (grind))))))
      ("2"
       (typepred "columns(D)")
       (ground)
       (skosimp*)
       (typepred "D")
       (ground)
       (("1" (grind))
        ("2"
         (inst - "i!1" "i!2")
         (("1"
           (expand "nth" -1)
           (lift-if)
           (ground)
           (("1"
             (case "length(car(D)) = columns(D)")
             (("1" (assert))
              ("2"
               (typepred "D")
               (ground)
               (("1" (grind))
                ("2" (inst - "0" "i!2") (expand "nth" -1 1) (assert))))))
            ("2" (expand "length" -6) (lift-if) (ground) (grind))))
          ("2"
           (typepred "i!1")
           (expand "length" -1)
           (expand "length" 1)
           (lift-if)
           (ground)
           (grind))))))
      ("3"
       (typepred "D")
       (ground)
       (("1" (grind))
        ("2"
         (inst - "i!1" "j!1")
         (("1" (assert) (expand "nth" -1) (propax))
          ("2"
           (typepred "j!1")
           (expand "length" (-1 1))
           (lift-if)
           (ground)
           (grind))
          ("3"
           (typepred "i!1")
           (expand "length" (-1 1))
           (lift-if)
           (ground)
           (grind))))))))
    ("2" (grind)) ("3" (grind))
    ("4" (grind) (expand "length" 1 2) (lift-if) (ground))
    ("5"
     (name "KD" "cons[Vector](v, cdr[list[real]](D))")
     (replace -1)
     (typepred "columns(KD)")
     (ground)
     (("1" (grind))
      ("2"
       (skosimp*)
       (replaces -1 1 :dir rl)
       (typepred "columns(D)")
       (ground)
       (skosimp*)
       (replace -1 :dir rl)
       (case "i!1 = 0")
       (("1" (replaces -1) (expand "nth" 1 1) (expand "KD" 1) (assert))
        ("2"
         (typepred "D")
         (ground)
         (("1" (grind))
          ("2"
           (inst - "i!1" "i!2")
           (("1"
             (expand "KD" 2)
             (expand "nth" + 1)
             (replaces -1 :dir rl)
             (expand "nth" + 2)
             (propax))
            ("2"
             (typepred "i!1")
             (assert)
             (expand "KD" -1)
             (expand "length" -1)
             (expand "length" 1)
             (lift-if)
             (ground)
             (grind))))))))))
    ("6"
     (skosimp*)
     (expand "row" 1 1)
     (lift-if)
     (lift-if)
     (lift-if)
     (assert)
     (ground)
     (("1" (grind)) ("2" (grind))
      ("3"
       (expand "row")
       (lift-if)
       (ground)
       (expand "length" -1 1)
       (expand "length" 1)
       (lift-if)
       (ground))
      ("4" (expand "nth") (propax))
      ("5"
       (expand "rows")
       (expand "length" (1 3))
       (lift-if)
       (ground)
       (grind))
      ("6"
       (expand "nth" 2)
       (expand "row" 2)
       (lift-if)
       (ground)
       (("1" (expand "length" (-1 3)) (lift-if) (ground) (grind))
        ("2" (expand "nth" 2 2) (propax))))))
    ("7"
     (assert)
     (skeep)
     (expand "entry")
     (expand "row")
     (expand "access")
     (lift-if)
     (lift-if)
     (lift-if)
     (lift-if)
     (lift-if)
     (assert)
     (case "null?(D)")
     (("1" (hide 1) (grind))
      ("2"
       (assert)
       (case "null?(v)")
       (("1" (hide 2) (typepred "D") (grind))
        ("2"
         (ground)
         (("1"
           (expand "length" -4)
           (expand "rows" -2)
           (expand "length" -2)
           (assert))
          ("2" (expand "length" -2) (expand "length" 2) (propax))
          ("3" (expand "length" (-2 2)) (propax))
          ("4" (expand "nth" + 2) (propax))
          ("5" (expand "nth" -3 1) (propax))
          ("6" (expand "length" (-1 3)) (propax))
          ("7" (expand "rows" +) (assert))
          ("8" (expand "rows" +) (assert)) ("9" (grind)) ("10" (grind))
          ("11" (grind)) ("12" (grind)) ("13" (grind))
          ("14" (grind))))))))))


proof_type: t_proof
decl_type: tcc
library: matrices
theory: matrix_props
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skeep)
   (assert)
   (ground)
   (("1"
     (skosimp*)
     (typepred "D")
     (ground)
     (("1" (grind))
      ("2"
       (inst - "i!1+1" "j!1+1")
       (("1" (expand "nth" -) (propax))
        ("2"
         (typepred "j!1")
         (expand "length" 1)
         (lift-if)
         (ground)
         (grind))
        ("3"
         (typepred "i!1")
         (expand "length" 1)
         (lift-if)
         (ground)
         (grind))))))
    ("2"
     (expand "rows" (3 4))
     (expand "length" +)
     (lift-if)
     (ground)
     (grind))
    ("3" (lemma "columns_cdr") (inst?) (assert))
    ("4" (lemma "columns_cdr") (inst?) (assert))))


proof_type: t_proof
decl_type: tcc
library: matrices
theory: matrix_props
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skeep)
   (case "null?(D)")
   (("1" (grind))
    ("2"
     (assert)
     (name "W" "v1(i-1,v)(cdr[list[real]](D))")
     (("1"
       (replace -1)
       (name "KD" "cons[list[real]](car[list[real]](D), W)")
       (replace -1)
       (case "NOT length(KD) = length(D)")
       (("1"
         (hide 6)
         (expand "KD" 1)
         (expand "length" 1)
         (assert)
         (typepred "W")
         (expand "rows")
         (propax))
        ("2"
         (assert)
         (ground)
         (("1"
           (skosimp*)
           (expand "KD" +)
           (expand "nth" +)
           (lift-if)
           (lift-if)
           (lift-if)
           (ground)
           (("1"
             (lemma "length_nth_row")
             (inst - "W" "j!1-1")
             (assert)
             (split -)
             (("1"
               (replaces -1)
               (typepred "W")
               (replace -6 +)
               (rewrite "columns_cdr" +)
               (lemma "length_nth_row")
               (inst - "D" "0")
               (assert)
               (expand "nth" -1)
               (propax))
              ("2" (typepred "j!1") (expand "length" -1) (assert))))
            ("2"
             (lemma "length_nth_row")
             (inst - "W" "i!1-1")
             (assert)
             (split -)
             (("1"
               (replaces -1)
               (typepred "W")
               (replace -6 +)
               (rewrite "columns_cdr" +)
               (assert)
               (lemma "length_nth_row")
               (inst - "D" "0")
               (assert)
               (split -)
               (("1" (assert) (grind)) ("2" (expand "nth" -2) (assert))))
              ("2" (typepred "i!1") (expand "length" -1) (assert))))
            ("3"
             (lemma "length_nth_row")
             (inst-cp - "W" "i!1-1")
             (assert)
             (inst-cp - "W" "j!1-1")
             (ground)
             (("1" (typepred "i!1") (expand "length" -1) (assert))
              ("2" (typepred "j!1") (expand "length" -1) (assert))
              ("3" (typepred "j!1") (expand "length" -1) (assert))))))
          ("2"
           (expand "KD" 1)
           (expand "rows" 1)
           (expand "length" 1)
           (assert))
          ("3"
           (expand "KD" 1)
           (rewrite "columns_cons" 1)
           (hide -)
           (grind))
          ("4"
           (expand "KD" 1)
           (expand "rows" 1)
           (expand "length" 1 1)
           (typepred "W")
           (expand "rows")
           (replace -5)
           (expand "length" + 2)
           (propax))
          ("5"
           (expand "KD" 1)
           (rewrite "columns_cons" 1)
           (hide -)
           (expand "max")
           (lift-if)
           (ground)
           (("1" (typepred "W") (replace -6) (rewrite "columns_cdr" 1))
            ("2"
             (lemma "length_nth_row")
             (inst - "D" "0")
             (split -)
             (("1" (expand "nth") (propax)) ("2" (grind))))))
          ("6"
           (skeep)
           (expand "row")
           (expand "rows")
           (lift-if)
           (lift-if)
           (lift-if)
           (assert)
           (ground)
           (("1"
             (expand "KD" 1)
             (expand "nth" 1)
             (typepred "W")
             (inst - "j-1")
             (expand "row" -7)
             (assert)
             (lift-if)
             (lift-if)
             (lift-if)
             (split -2)
             (("1" (grind))
              ("2"
               (ground)
               (("1" (grind)) ("2" (grind)) ("3" (grind)) ("4" (grind))
                ("5" (grind))))))
            ("2"
             (expand "KD" 2)
             (expand "nth" 2 1)
             (lift-if)
             (ground)
             (("1" (expand "nth" 1) (propax))
              ("2"
               (typepred "W")
               (inst - "j-1")
               (split -2)
               (("1" (grind))
                ("2"
                 (expand "row" -7)
                 (lift-if)
                 (lift-if)
                 (lift-if)
                 (ground)
                 (("1" (expand "length" -10 2) (assert))
                  ("2" (expand "rows") (assert))
                  ("3" (expand "rows") (assert))
                  ("4"
                   (replace -1 +)
                   (expand "nth" 4 2)
                   (propax))))))))))
          ("7"
           (skeep)
           (expand "entry" 1)
           (lift-if)
           (ground)
           (("1"
             (case "row(KD)(j) = v")
             (("1" (assert))
              ("2"
               (hide 2)
               (expand "KD" 1)
               (expand "row" 1)
               (lift-if)
               (ground)
               (("1" (expand "length" -1) (expand "rows" -2) (assert))
                ("2"
                 (expand "nth" 2)
                 (typepred "W")
                 (hide -2)
                 (inst - "j-1")
                 (lift-if)
                 (ground)
                 (("1"
                   (expand "row" -3)
                   (lift-if)
                   (ground)
                   (expand "rows")
                   (assert))
                  ("2"
                   (expand "length" 2)
                   (expand "rows" 1)
                   (assert)
                   (typepred "W")
                   (expand "rows")
                   (assert))))))))
            ("2" (expand "row" 2) (expand "rows" 1) (assert))
            ("3"
             (expand "KD" +)
             (expand "row")
             (lift-if)
             (lift-if)
             (lift-if)
             (assert)
             (ground)
             (expand "nth" + 1)
             (lift-if)
             (ground)
             (("1" (replaces -1) (assert) (expand "nth" 1) (propax))
              ("2"
               (typepred "W")
               (hide -2)
               (inst - "j-1")
               (lift-if)
               (ground)
               (("1"
                 (expand "row" -1)
                 (lift-if)
                 (lift-if)
                 (lift-if)
                 (assert)
                 (split -1)
                 (("1" (flatten) (assert) (expand "length" 4) (assert))
                  ("2"
                   (expand "length" 4)
                   (assert)
                   (typepred "W")
                   (expand "rows")
                   (assert))))
                ("2"
                 (expand "row" -1 1)
                 (lift-if)
                 (assert)
                 (split -)
                 (("1" (flatten) (expand "length" 4) (assert))
                  ("2"
                   (flatten)
                   (replace -1)
                   (expand "row" 4)
                   (assert)
                   (lift-if)
                   (split +)
                   (("1"
                     (flatten)
                     (typepred "W")
                     (expand "rows")
                     (assert))
                    ("2"
                     (flatten)
                     (expand "nth" + 2)
                     (propax))))))))))))))))
      ("2"
       (hide 6)
       (split)
       (("1"
         (flatten)
         (skosimp*)
         (lemma "length_nth_row")
         (inst-cp - "D" "i!1+1")
         (inst - "D" "j!1+1")
         (assert)
         (ground)
         (("1" (expand "nth" -) (assert))
          ("2" (typepred "i!1") (expand "length" 1) (assert))
          ("3" (expand "length" 1) (assert))
          ("4" (expand "length" 1) (assert))))
        ("2" (rewrite "columns_cdr") (assert))
        ("3" (expand "rows") (expand "length" 1 2) (assert))))))))


proof_type: t_proof
decl_type: tcc
library: matrices
theory: matrix_props
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skeep)
   (typepred "row(D)(i) + r*row(D)(j)")
   (expand "max")
   (lift-if)
   (ground)
   (("1"
     (replaces -2)
     (typepred "r*row(D)(j)")
     (replace -2)
     (rewrite "length_row"))
    ("2" (replace -1) (rewrite "length_row"))))


proof_type: t_proof
decl_type: tcc
library: matrices
theory: matrix_props
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skeep)
   (rewrite "length_add_vect")
   (rewrite "length_row")
   (rewrite "length_row")
   (expand "max")
   (lift-if)
   (lift-if)
   (lift-if)
   (lift-if)
   (assert))


proof_type: t_proof
decl_type: tcc
library: matrices
theory: matrix_props
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skeep)
   (rewrite "length_add_vect")
   (rewrite "length_scal_vect")
   (rewrite "length_row")
   (rewrite "length_row")
   (expand "max")
   (assert))


proof_type: f_proof
decl_type: formula
library: matrices
theory: matrix_det
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skeep)
   (expand "Esr")
   (rewrite "entry_form_matrix")
   (lift-if)
   (lift-if)
   (lift-if)
   (lift-if)
   (lift-if)
   (ground))


proof_type: f_proof
decl_type: formula
library: matrices
theory: matrix_det
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skeep)
   (lemma "det_replace_row_scal")
   (inst - "Id(pn)" "i" "r" "row(Id(pn))(i)")
   (assert)
   (split -)
   (("1"
     (rewrite "replace_row_id")
     (rewrite "det_Id")
     (assert)
     (case "replace_row(i, r * row(Id(pn))(i))(Id(pn)) = Esr(pn)(i,r)")
     (("1" (assert))
      ("2"
       (hide (-1 2))
       (rewrite "full_matrix_eq")
       (skosimp*)
       (rewrite "entry_replace_row")
       (("1"
         (rewrite "entry_Esr")
         (rewrite "entry_Id")
         (rewrite "access_scal")
         (lemma "entry_Id")
         (inst - "i" "j!1" "pn")
         (expand "entry" -1)
         (assert)
         (replaces -1)
         (lift-if)
         (lift-if)
         (lift-if)
         (lift-if)
         (ground))
        ("2"
         (rewrite "columns_Id")
         (typepred "r*row(Id(pn))(i)")
         (replaces -2)
         (rewrite "length_row")
         (assert))))))
    ("2" (rewrite "length_row")) ("3" (assert))))


proof_type: f_proof
decl_type: formula
library: matrices
theory: matrix_det
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skeep)
   (rewrite "full_matrix_eq")
   (split)
   (("1" (rewrite "rows_transpose") (assert))
    ("2" (rewrite "columns_transpose" +) (assert))
    ("3"
     (skosimp*)
     (rewrite "entry_transpose")
     (rewrite "entry_Esr")
     (rewrite "entry_Esr")
     (lift-if)
     (lift-if)
     (lift-if)
     (lift-if)
     (ground))))


proof_type: f_proof
decl_type: formula
library: matrices
theory: matrix_det
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skeep)
   (rewrite "full_matrix_eq")
   (split)
   (("1"
     (rewrite "rows_mult")
     (rewrite "rows_Esr")
     (rewrite "rows_replace_row")
     (assert))
    ("2" (lemma "columns_mult") (inst?) (assert) (hide 1) (grind))
    ("3"
     (skosimp*)
     (rewrite "entry_mult")
     (assert)
     (expand "*" + 1)
     (lift-if)
     (ground)
     (("1"
       (lemma "rows_Esr")
       (inst?)
       (rewrite "entry_replace_row")
       (("1"
         (lift-if)
         (ground)
         (("1"
           (rewrite "dot_eq_sigma")
           (rewrite "length_row")
           (rewrite "length_col")
           (rewrite "columns_Esr")
           (expand "min")
           (lemma "sigma_eq_one_arg")
           (inst?)
           (inst - "i!1")
           (assert)
           (split -)
           (("1"
             (replaces -1)
             (rewrite "access_scal")
             (lemma "entry_Esr")
             (inst?)
             (inst - "i!1" "i!1")
             (assert)
             (expand "entry" -1)
             (replaces -1)
             (rewrite "access_col")
             (assert))
            ("2"
             (skosimp*)
             (hide 2)
             (lemma "entry_Esr")
             (inst - "i" "i!2" "i!1" "pn" "r")
             (assert)
             (expand "entry" -1)
             (assert))
            ("3"
             (hide 2)
             (skosimp*)
             (lemma "entry_Esr")
             (inst - "i" "i!2" "i!1" "pn" "r")
             (assert)
             (expand "entry" -1)
             (assert))))
          ("2"
           (rewrite "dot_eq_sigma")
           (rewrite "length_row")
           (rewrite "length_col")
           (rewrite "columns_Esr")
           (replace -4)
           (assert)
           (expand "min")
           (lemma "sigma_eq_one_arg")
           (inst?)
           (inst - "i!1")
           (assert)
           (split -)
           (("1"
             (replaces -1)
             (lemma "entry_Esr")
             (inst?)
             (inst - "i!1" "i!1")
             (assert)
             (expand "entry" -1)
             (replaces -1)
             (rewrite "access_col")
             (expand "entry")
             (propax))
            ("2"
             (hide 3)
             (skosimp*)
             (lemma "entry_Esr")
             (inst - "i" "i!2" "i!1" "pn" "r")
             (assert)
             (expand "entry")
             (assert))
            ("3"
             (hide 3)
             (skosimp*)
             (lemma "entry_Esr")
             (inst - "i" "i!2" "i!1" "pn" "r")
             (assert)
             (expand "entry")
             (assert))))))
        ("2"
         (hide 2)
         (typepred "r*row(D)(i)")
         (replaces -2)
         (rewrite "length_row"))))
      ("2"
       (rewrite "rows_Esr")
       (rewrite "entry_replace_row")
       (("1"
         (expand "entry")
         (expand "row")
         (lift-if)
         (ground)
         (("1"
           (expand "rows")
           (assert)
           (expand "access")
           (lift-if)
           (grind))
          ("2" (expand "rows") (assert))))
        ("2"
         (typepred "r*row(D)(i)")
         (replace -2)
         (rewrite "length_row"))))
      ("3"
       (typepred "j!1")
       (lemma "columns_mult")
       (inst?)
       (assert)
       (typepred "Esr(pn)(i,r)")
       (expand "rows")
       (expand "length")
       (assert))))))


proof_type: f_proof
decl_type: formula
library: matrices
theory: matrix_det
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skeep)
   (rewrite "mult_Esr_left")
   (rewrite "full_matrix_eq")
   (split)
   (("1"
     (rewrite "rows_replace_row")
     (rewrite "rows_Esr")
     (rewrite "rows_Id"))
    ("2"
     (rewrite "columns_replace_row")
     (rewrite "columns_Esr")
     (rewrite "columns_Id"))
    ("3"
     (skosimp*)
     (rewrite "entry_replace_row")
     (("1"
       (rewrite "entry_Id")
       (rewrite "access_scal")
       (lemma "entry_Esr")
       (inst - "i" "j!1" "i" "pn" "1/r")
       (("1"
         (assert)
         (expand "entry" -1)
         (replaces -1)
         (rewrite "entry_Esr")
         (lift-if)
         (lift-if)
         (lift-if)
         (ground))
        ("2" (assert))))
      ("2"
       (rewrite "columns_Esr")
       (typepred "r * row(Esr(pn)(i, 1 / r))(i)")
       (replace -2)
       (rewrite "length_row")
       (assert))))))


proof_type: f_proof
decl_type: formula
library: matrices
theory: matrix_det
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skeep)
   (expand "Ers")
   (rewrite "entry_form_matrix")
   (lift-if)
   (lift-if)
   (lift-if)
   (lift-if)
   (lift-if)
   (assert)
   (ground))


proof_type: f_proof
decl_type: formula
library: matrices
theory: matrix_det
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skeep)
   (rewrite "full_matrix_eq")
   (split)
   (("1" (assert) (rewrite "rows_mult") (rewrite "rows_Ers") (assert))
    ("2" (lemma "columns_mult") (inst?) (assert) (grind))
    ("3"
     (skosimp*)
     (rewrite "entry_mult")
     (lift-if)
     (ground)
     (("1"
       (rewrite "entry_swap")
       (expand "swap")
       (lift-if)
       (ground)
       (("1"
         (expand "*")
         (rewrite "dot_eq_sigma")
         (rewrite "length_row")
         (rewrite "length_col")
         (rewrite "columns_Ers")
         (replace -4)
         (expand "min")
         (lemma "sigma_eq_one_arg")
         (inst?)
         (inst - "j")
         (assert)
         (split -)
         (("1"
           (replace -1)
           (rewrite "access_col")
           (expand "entry" +)
           (replace -2)
           (lemma "entry_Ers")
           (inst - "i" "j" "i" "j" "pn")
           (expand "entry" -1)
           (replace -1)
           (ground))
          ("2"
           (hide 2)
           (skosimp*)
           (lemma "entry_Ers")
           (inst - "i" "j" "i!1" "i!2" "pn")
           (expand "entry" -1)
           (assert)
           (replace -1)
           (lift-if)
           (ground))
          ("3"
           (hide 2)
           (skosimp*)
           (lemma "entry_Ers")
           (inst - "i" "j" "i!1" "i!2" "pn")
           (expand "entry" -1)
           (replace -1)
           (lift-if)
           (ground))))
        ("2"
         (expand "*")
         (rewrite "dot_eq_sigma")
         (rewrite "length_row")
         (rewrite "length_col")
         (rewrite "columns_Ers")
         (replace -4)
         (expand "min")
         (lemma "sigma_eq_one_arg")
         (inst?)
         (inst - "i")
         (assert)
         (split -)
         (("1"
           (replaces -1)
           (lemma "entry_Ers")
           (inst - "i" "j" "i!1" "i" "pn")
           (assert)
           (expand "entry" -1)
           (assert)
           (replace -1)
           (expand "entry" 1)
           (rewrite "access_col"))
          ("2"
           (hide 2)
           (skosimp*)
           (lemma "entry_Ers")
           (inst - "i" "j" "i!1" "i!2" "pn")
           (assert)
           (expand "entry" -1)
           (assert))
          ("3"
           (hide 2)
           (skosimp*)
           (lemma "entry_Ers")
           (inst - "i" "j" "i!1" "i!2" "pn")
           (assert)
           (expand "entry" -1)
           (assert))))
        ("3"
         (expand "*")
         (rewrite "dot_eq_sigma")
         (rewrite "length_row")
         (rewrite "length_col")
         (rewrite "columns_Ers")
         (expand "min")
         (assert)
         (lemma "sigma_eq_one_arg")
         (inst?)
         (inst - "i!1")
         (assert)
         (split -)
         (("1"
           (replaces -1)
           (lemma "entry_Ers")
           (inst - "i" "j" "i!1" "i!1" "pn")
           (assert)
           (expand "entry" -1)
           (replaces -1)
           (rewrite "access_col")
           (expand "entry")
           (propax))
          ("2"
           (hide 3)
           (skosimp*)
           (lemma "entry_Ers")
           (inst - "i" "j" "i!1" "i!2" "pn")
           (assert)
           (expand "entry" -1)
           (assert))
          ("3"
           (hide 3)
           (skosimp*)
           (lemma "entry_Ers")
           (inst - "i" "j" "i!1" "i!2" "pn")
           (assert)
           (expand "entry" -1)
           (assert))))))
      ("2" (typepred "i!1") (rewrite "rows_mult"))
      ("3"
       (typepred "j!1")
       (lemma "columns_mult")
       (inst?)
       (assert)
       (typepred "Ers(pn)(i,j)")
       (expand "rows")
       (expand "length")
       (assert))))))


proof_type: f_proof
decl_type: formula
library: matrices
theory: matrix_det
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skeep)
   (rewrite "full_matrix_eq")
   (split)
   (("1" (rewrite "rows_transpose") (assert))
    ("2" (rewrite "columns_transpose") (assert))
    ("3"
     (skosimp*)
     (rewrite "entry_transpose")
     (rewrite "entry_Ers")
     (rewrite "entry_Ers")
     (lift-if)
     (lift-if)
     (lift-if)
     (lift-if)
     (assert)
     (lift-if)
     (assert)
     (ground))))


proof_type: f_proof
decl_type: formula
library: matrices
theory: matrix_det
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skeep)
   (lift-if)
   (ground)
   (("1"
     (replaces -1)
     (assert)
     (typepred "Ers(pn)(j,j)")
     (replaces -7)
     (rewrite "swap_id")
     (rewrite "det_Id"))
    ("2"
     (typepred "Ers(pn)(i,j)")
     (replaces -7)
     (rewrite "det_swap")
     (rewrite "det_Id"))))


proof_type: f_proof
decl_type: formula
library: matrices
theory: matrix_det
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skeep)
   (rewrite "mult_Ers_left")
   (rewrite "full_matrix_eq")
   (split)
   (("1" (rewrite "rows_swap") (rewrite "rows_Ers") (rewrite "rows_Id"))
    ("2"
     (rewrite "columns_swap")
     (rewrite "columns_Ers")
     (rewrite "columns_Id"))
    ("3"
     (skosimp*)
     (rewrite "entry_swap")
     (rewrite "entry_Id")
     (expand "swap")
     (rewrite "entry_Ers")
     (rewrite "entry_Ers")
     (rewrite "entry_Ers")
     (lift-if)
     (lift-if)
     (lift-if)
     (assert))))


proof_type: f_proof
decl_type: formula
library: matrices
theory: matrix_det
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skeep)
   (expand "Easr")
   (rewrite "entry_form_matrix")
   (lift-if)
   (assert)
   (lift-if)
   (assert)
   (lift-if)
   (assert)
   (ground))


proof_type: f_proof
decl_type: formula
library: matrices
theory: matrix_det
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skeep)
   (rewrite "full_matrix_eq")
   (split)
   (("1"
     (rewrite "rows_mult")
     (rewrite "rows_Easr")
     (rewrite "rows_replace_row")
     (assert))
    ("2"
     (lemma "columns_mult")
     (inst?)
     (assert)
     (lemma "rows_Easr")
     (inst?)
     (assert)
     (expand "rows")
     (expand "length")
     (assert))
    ("3"
     (skosimp*)
     (rewrite "entry_mult")
     (rewrite "rows_Easr")
     (rewrite "entry_replace_row")
     (("1"
       (lift-if)
       (lift-if)
       (lift-if)
       (assert)
       (ground)
       (("1"
         (expand "*" + 1)
         (rewrite "dot_eq_sigma")
         (rewrite "length_row")
         (rewrite "columns_Easr")
         (rewrite "length_col")
         (expand "min")
         (case "i = j")
         (("1"
           (lemma "sigma_eq_one_arg2")
           (inst?)
           (inst - "i")
           (assert)
           (split -)
           (("1"
             (replaces -1)
             (lemma "entry_Easr")
             (inst?)
             (inst - "i!1" "i")
             (replace -3)
             (assert)
             (expand "entry" -1)
             (replaces -1)
             (rewrite "access_sum")
             (rewrite "access_scal")
             (rewrite "access_col")
             (assert))
            ("2"
             (hide 2)
             (skosimp*)
             (lemma "entry_Easr")
             (inst?)
             (inst - "i!1" "i!2")
             (assert)
             (expand "entry" -1)
             (assert))))
          ("2"
           (lemma "sigma_eq_two_args")
           (inst?)
           (inst - "i" "j")
           (assert)
           (split -)
           (("1"
             (replaces -1)
             (lemma "entry_Easr")
             (replace -2)
             (inst?)
             (inst-cp - "i" "i")
             (assert)
             (inst - "i" "j")
             (assert)
             (expand "entry")
             (replaces -1)
             (replaces -1)
             (rewrite "access_sum")
             (rewrite "access_scal")
             (assert)
             (rewrite "access_col")
             (rewrite "access_col"))
            ("2"
             (hide 3)
             (assert)
             (skosimp*)
             (lemma "entry_Easr")
             (inst?)
             (inst - "i!1" "i!2")
             (assert)
             (expand "entry")
             (assert))))))
        ("2"
         (expand "*")
         (rewrite "dot_eq_sigma")
         (rewrite "length_row")
         (rewrite "columns_Easr")
         (rewrite "length_col")
         (expand "min")
         (assert)
         (lemma "sigma_eq_one_arg2")
         (inst?)
         (assert)
         (inst - "i!1")
         (assert)
         (split -)
         (("1"
           (replaces -1)
           (lemma "entry_Easr")
           (inst?)
           (inst - "i!1" "i!1")
           (assert)
           (expand "entry")
           (replaces -1)
           (rewrite "access_col"))
          ("2"
           (hide 3)
           (skosimp*)
           (lemma "entry_Easr")
           (inst?)
           (inst - "i!1" "i!2")
           (assert)
           (expand "entry")
           (assert))))
        ("3" (rewrite "entry_eq_0")) ("4" (rewrite "entry_eq_0"))
        ("5"
         (expand "access")
         (lift-if)
         (ground)
         (typepred "row(D)(i)+r*row(D)(j)")
         (replaces -2)
         (expand "max")
         (assert)
         (lift-if)
         (ground)
         (("1" (typepred "r*row(D)(j)") (rewrite "length_row") (assert))
          ("2" (rewrite "length_row"))))
        ("6" (rewrite "entry_eq_0")) ("7" (rewrite "entry_eq_0"))))
      ("2"
       (hide 2)
       (typepred "row(D)(i)+r*row(D)(j)")
       (replace -2)
       (expand "max")
       (lift-if)
       (ground)
       (("1" (typepred "r*row(D)(j)") (rewrite "length_row") (assert))
        ("2" (rewrite "length_row"))))))))


proof_type: f_proof
decl_type: formula
library: matrices
theory: matrix_det
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skeep)
   (rewrite "full_matrix_eq")
   (split)
   (("1" (rewrite "rows_transpose") (assert))
    ("2" (rewrite "columns_transpose") (assert))
    ("3"
     (skosimp*)
     (rewrite "entry_transpose")
     (rewrite "entry_Easr")
     (rewrite "entry_Easr")
     (lift-if)
     (assert)
     (lift-if)
     (assert)
     (lift-if)
     (assert)
     (lift-if)
     (assert)
     (ground))))


proof_type: f_proof
decl_type: formula
library: matrices
theory: matrix_det
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skeep)
   (lift-if)
   (ground)
   (("1"
     (case "Easr(pn)(i,j,r)=Esr(pn)(i,1+r)")
     (("1" (replaces -1) (rewrite "det_Esr"))
      ("2"
       (hide 2)
       (rewrite "full_matrix_eq")
       (split)
       (("1" (rewrite "rows_Easr") (rewrite "rows_Esr"))
        ("2" (rewrite "columns_Easr") (rewrite "columns_Esr"))
        ("3"
         (skosimp*)
         (rewrite "entry_Easr")
         (rewrite "entry_Esr")
         (lift-if)
         (lift-if)
         (lift-if)
         (lift-if)
         (lift-if)
         (ground))))))
    ("2"
     (lemma "det_replace_row_sum_scal")
     (inst - "Id(pn)" "i" "j" "r")
     (assert)
     (rewrite "rows_Id")
     (assert)
     (rewrite "det_Id")
     (case "Easr(pn)(i,j,r)=replace_row(i, row(Id(pn))(i) + r * row(Id(pn))(j))(Id(pn))")
     (("1" (assert))
      ("2"
       (hide (-1 3))
       (rewrite "full_matrix_eq")
       (split)
       (("1"
         (rewrite "rows_Easr")
         (rewrite "rows_replace_row")
         (rewrite "rows_Id"))
        ("2"
         (rewrite "columns_Easr")
         (rewrite "columns_replace_row")
         (rewrite "columns_Id"))
        ("3"
         (skosimp*)
         (rewrite "entry_Easr")
         (rewrite "entry_replace_row")
         (("1"
           (rewrite "access_sum")
           (rewrite "access_scal")
           (rewrite "entry_Id")
           (assert)
           (lemma "entry_Id")
           (inst-cp - "i" "j!1" "pn")
           (inst - "j" "j!1" "pn")
           (assert)
           (expand "entry")
           (replaces -1)
           (replaces -1)
           (assert)
           (lift-if)
           (lift-if)
           (lift-if)
           (lift-if)
           (lift-if)
           (lift-if)
           (lift-if)
           (lift-if)
           (lift-if)
           (lift-if)
           (lift-if)
           (lift-if)
           (ground))
          ("2"
           (hide 2)
           (rewrite "columns_Id")
           (typepred "row(Id(pn))(i) + r * row(Id(pn))(j)")
           (replaces -2)
           (rewrite "length_row")
           (typepred "r*row(Id(pn))(j)")
           (replaces -2)
           (rewrite "length_row")
           (expand "max")
           (assert))))))))))


proof_type: f_proof
decl_type: formula
library: matrices
theory: matrix_det
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skeep)
   (rewrite "mult_Easr_left")
   (rewrite "full_matrix_eq")
   (split)
   (("1"
     (rewrite "rows_replace_row")
     (rewrite "rows_Easr")
     (rewrite "rows_Id"))
    ("2"
     (rewrite "columns_replace_row")
     (rewrite "columns_Easr")
     (rewrite "columns_Id"))
    ("3"
     (skosimp*)
     (rewrite "entry_replace_row")
     (("1"
       (rewrite "entry_Id")
       (rewrite "entry_Easr")
       (lemma "entry_Easr")
       (rewrite "access_sum")
       (rewrite "access_scal")
       (inst-cp - "i" "j" "i" "j!1" "pn" "-r")
       (inst-cp - "i" "j" "j" "j!1" "pn" "-r")
       (hide -1)
       (expand "entry" -)
       (assert)
       (replaces -1)
       (replaces -1)
       (lift-if)
       (lift-if)
       (lift-if)
       (assert))
      ("2"
       (rewrite "columns_Easr")
       (invoke (typepred "%1") (! 1 2 1))
       (replaces -2)
       (rewrite "length_row")
       (invoke (typepred "%1") (! 1 2 2 1))
       (replace -2)
       (rewrite "length_row" +)
       (expand "max")
       (assert))))))


proof_type: f_proof
decl_type: formula
library: matrices
theory: matrix_det
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (case " FORALL (S: Square, k: nat):
                 k + 1 < rows(S) AND rows(S)-k-2>=0 IMPLIES
                  prod_diag(remove(S, 0, 0), rows(S)-k-2) = prod_diag(S, rows(S)-k-1)")
   (("1"
     (skeep)
     (inst - "S" "rows(S)-k-2")
     (("1" (assert)) ("2" (assert))))
    ("2"
     (hide 2)
     (induct "k")
     (("1"
       (skeep)
       (assert)
       (expand "prod_diag")
       (rewrite "rows_remove")
       (assert)
       (rewrite "entry_remove"))
      ("2"
       (skeep)
       (assert)
       (skeep)
       (assert)
       (expand "prod_diag" +)
       (assert)
       (lift-if)
       (rewrite "rows_remove")
       (assert)
       (inst - "S")
       (assert)
       (replaces -1)
       (rewrite "entry_remove"))
      ("3" (hide 2) (skosimp*) (assert))
      ("4" (skosimp*) (rewrite "rows_remove") (assert))))
    ("3" (hide 2) (skosimp*) (assert))
    ("4" (hide 2) (skeep) (rewrite "rows_remove") (assert))))


proof_type: f_proof
decl_type: formula
library: matrices
theory: matrix_det
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skeep)
   (expand "upper_triangular?")
   (expand "diagonal?")
   (skeep)
   (inst - "i" "j")
   (assert))


proof_type: f_proof
decl_type: formula
library: matrices
theory: matrix_det
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (case "FORALL (S: Square,k:nat):rows(S)=k+1 AND
                               upper_triangular?(S) IMPLIES det(S) = prod_diag(S, 0)")
   (("1" (skeep) (inst - "S" "rows(S)-1") (assert))
    ("2"
     (hide 2)
     (induct "k")
     (("1"
       (assert)
       (skeep)
       (expand "det")
       (assert)
       (lift-if)
       (ground)
       (("1" (expand "rows") (expand "length") (assert))
        ("2" (expand "prod_diag") (assert))))
      ("2"
       (skeep)
       (skeep)
       (assert)
       (expand "det" + 1)
       (lift-if)
       (ground)
       (("1" (expand "rows") (expand "length") (assert))
        ("2"
         (lemma "sigma_eq_one_arg2")
         (inst?)
         (inst - "0")
         (assert)
         (split -)
         (("1"
           (replaces -1)
           (inst - "remove(S,0,0)")
           (("1"
             (assert)
             (split -1)
             (("1"
               (replaces -1)
               (expand "^")
               (expand "expt")
               (expand "prod_diag" + 2)
               (rewrite "prod_diag_remove_0_0"))
              ("2" (rewrite "rows_remove") (assert))
              ("3"
               (hide 3)
               (expand "upper_triangular?")
               (skeep)
               (rewrite "rows_remove")
               (rewrite "entry_remove")
               (inst?)
               (assert))))
            ("2"
             (rewrite "rows_remove")
             (rewrite "columns_remove")
             (assert))))
          ("2"
           (hide 3)
           (hide -1)
           (skeep)
           (lemma "det_first_column_zero")
           (inst?)
           (("1"
             (assert)
             (skosimp*)
             (rewrite "rows_remove")
             (rewrite "entry_remove")
             (expand "upper_triangular?")
             (inst?)
             (assert))
            ("2"
             (rewrite "rows_remove")
             (rewrite "columns_remove")
             (assert))))))))))))


proof_type: f_proof
decl_type: formula
library: matrices
theory: matrix_det
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skeep)
   (lemma "det_upper_triangular")
   (inst?)
   (assert)
   (replaces -1)
   (case "FORALL (k:nat): rows(S)-1-k>=0 IMPLIES (prod_diag(S, rows(S)-1-k) = 0 IFF
                 (EXISTS (i): i <=k AND entry(S)(rows(S)-1-i,rows(S)-1-i) = 0))")
   (("1"
     (inst - "rows(S)-1")
     (assert)
     (replaces -1)
     (ground)
     (("1" (skeep) (inst?) (("1" (assert)) ("2" (assert))))
      ("2"
       (skeep)
       (inst + "rows(S)-1-i")
       (("1" (assert)) ("2" (assert))))))
    ("2"
     (hide 2)
     (induct "k")
     (("1"
       (assert)
       (expand "prod_diag")
       (ground)
       (("1" (inst + "0") (assert)) ("2" (skosimp*) (assert))))
      ("2"
       (skeep)
       (assert)
       (expand "prod_diag" +)
       (assert)
       (ground)
       (("1" (skosimp*) (inst + "i!1") (assert))
        ("2"
         (lemma "nzreal_times_nzreal_is_nzreal")
         (inst?)
         (("1" (assert))
          ("2" (flatten) (hide -2) (inst + "j+1") (assert))))
        ("3" (skosimp*) (inst + "i!1") (assert))))
      ("3" (skosimp*) (assert)) ("4" (skosimp*) (assert))))
    ("3" (skosimp*) (assert))))


proof_type: f_proof
decl_type: formula
library: matrices
theory: matrix_det
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skeep)
   (expand "upper_triangular?")
   (skeep)
   (rewrite "entry_mult")
   (lift-if)
   (ground)
   (expand "*" 1)
   (rewrite "dot_eq_sigma")
   (rewrite "length_row")
   (rewrite "length_col")
   (rewrite "sigma_restrict_eq_0")
   (hide 2)
   (skosimp*)
   (rewrite "access_row")
   (rewrite "access_col")
   (rewrite "access_row")
   (inst - "i" "i!1")
   (inst - "i!1" "j")
   (ground))


proof_type: f_proof
decl_type: formula
library: matrices
theory: matrix_det
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skeep)
   (expand "lower_triangular?")
   (skeep)
   (rewrite "entry_mult")
   (lift-if)
   (ground)
   (expand "*" 1)
   (rewrite "dot_eq_sigma")
   (rewrite "length_row")
   (rewrite "length_col")
   (rewrite "sigma_restrict_eq_0")
   (hide 2)
   (skosimp*)
   (rewrite "access_row")
   (rewrite "access_col")
   (rewrite "access_row")
   (inst - "i" "i!1")
   (inst - "i!1" "j")
   (ground))


proof_type: f_proof
decl_type: formula
library: matrices
theory: matrix_det
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skeep)
   (expand "lower_triangular?")
   (skosimp*)
   (rewrite "entry_Id")
   (lift-if)
   (ground))


proof_type: f_proof
decl_type: formula
library: matrices
theory: matrix_det
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skeep)
   (expand "upper_triangular?")
   (skosimp*)
   (rewrite "entry_Easr")
   (lift-if)
   (lift-if)
   (lift-if)
   (lift-if)
   (ground))


proof_type: f_proof
decl_type: formula
library: matrices
theory: matrix_det
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skeep)
   (expand "lower_triangular?")
   (skosimp*)
   (rewrite "entry_Easr")
   (lift-if)
   (lift-if)
   (lift-if)
   (lift-if)
   (ground))


proof_type: f_proof
decl_type: formula
library: matrices
theory: matrix_det
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (induct "k")
   (("1" (grind))
    ("2"
     (skeep)
     (skeep)
     (inst - "pn" "FM" "GM")
     (assert)
     (split -)
     (("1" (expand "prod_mat" +) (inst - "1+j") (assert))
      ("2" (skeep) (inst - "i") (assert))))))


proof_type: f_proof
decl_type: formula
library: matrices
theory: matrix_det
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (induct "p")
   (("1"
     (skeep)
     (assert)
     (expand "prod_mat" + 2)
     (expand "prod_mat" + 2)
     (assert)
     (lemma "prod_mat_eq")
     (inst?)
     (inst -
      "LAMBDA (i: nat):
                        IF i <= k THEN FM(i) ELSE GM(i - 1 - k) ENDIF")
     (("1" (assert) (skosimp*) (assert)) ("2" (skosimp*) (assert))))
    ("2"
     (skosimp*)
     (assert)
     (inst?)
     (expand "prod_mat" + 2)
     (expand "prod_mat" + 3)
     (assert)
     (rewrite "matrix_mult_assoc" 1 :dir rl)
     (("1" (assert))
      ("2"
       (hide (-2 1))
       (typepred "prod_mat(pn!1)(GM!1,j!1)")
       (expand "rows")
       (expand "length")
       (assert))))
    ("3" (hide 2) (skosimp*) (assert))))


proof_type: f_proof
decl_type: formula
library: matrices
theory: matrix_det
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (case "FORALL (k: nat, pn: posnat, FM: [nat -> SquareMatrix(pn)]):
                  prod_mat(pn)(FM, k+1) =
                   FM(0) * prod_mat(pn)(LAMBDA (i): FM(i + 1), k)")
   (("1"
     (skeep)
     (inst - "k-1" "pn" "FM")
     (("1" (assert)) ("2" (assert))))
    ("2"
     (hide 2)
     (induct "k")
     (("1"
       (skeep)
       (assert)
       (expand "prod_mat")
       (expand "prod_mat")
       (propax))
      ("2"
       (skeep)
       (skeep)
       (assert)
       (inst - "pn" "FM")
       (assert)
       (expand "prod_mat" +)
       (rewrite "matrix_mult_assoc" :dir rl)
       (("1" (assert))
        ("2"
         (typepred "prod_mat(pn)(LAMBDA (i): FM(1 + i), j)")
         (expand "rows" -3)
         (expand "length")
         (assert))))))))


proof_type: f_proof
decl_type: formula
library: matrices
theory: matrix_det
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (induct "k")
   (("1" (skeep) (expand "prod_mat") (propax))
    ("2"
     (skeep)
     (skeep)
     (assert)
     (lemma "prod_mat_expand_left")
     (inst - "1+j" "pn"
      "LAMBDA (i):
                        IF i <= 1 + j THEN transpose(FM(1 - i + j))
                        ELSE FM(i)
                        ENDIF")
     (("1"
       (assert)
       (replaces -1)
       (expand "prod_mat" + 1)
       (rewrite "transpose_mult")
       (inst - "pn" "FM")
       (assert)
       (lemma "prod_mat_eq")
       (inst - "j" "pn"
        "LAMBDA (i):
                          IF i <= j THEN transpose(FM(j - i)) ELSE FM(i) ENDIF"
        "LAMBDA (i_1: nat):
                           IF 1 + i_1 <= 1 + j THEN transpose(FM(j - i_1))
                           ELSE FM(1 + i_1)
                           ENDIF")
       (("1"
         (split -)
         (("1" (assert))
          ("2" (hide-all-but 1) (skosimp*) (lift-if) (assert))))
        ("2"
         (hide 2)
         (skosimp*)
         (rewrite "rows_transpose")
         (rewrite "columns_transpose")
         (assert))
        ("3" (hide 2) (skosimp*) (assert))
        ("4"
         (hide 2)
         (skosimp*)
         (rewrite "rows_transpose")
         (rewrite "columns_transpose")
         (assert))
        ("5" (hide 2) (skosimp*) (assert))))
      ("2"
       (hide-all-but 1)
       (skosimp*)
       (rewrite "rows_transpose")
       (rewrite "columns_transpose")
       (assert))
      ("3" (hide-all-but 1) (skosimp*) (assert))))
    ("3"
     (hide-all-but 1)
     (skosimp*)
     (rewrite "rows_transpose")
     (rewrite "columns_transpose")
     (assert))
    ("4" (hide-all-but 1) (skosimp*) (assert))))


proof_type: f_proof
decl_type: formula
library: matrices
theory: matrix_det
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skeep)
   (expand "is_simple_prod?")
   (skolem - ("FM" "k"))
   (skolem - ("GM" "p"))
   (assert)
   (flatten)
   (replace -2 +)
   (replace -4 +)
   (rewrite "mult_prod_mat" +)
   (inst +
    "LAMBDA (i: nat):
                        IF i <= k THEN FM(i) ELSE GM(i - 1 - k) ENDIF"
    "1+k+p")
   (("1"
     (assert)
     (expand "is_simple_seq?")
     (skeep)
     (lift-if)
     (split 1)
     (("1" (flatten) (assert) (inst - "p!1") (assert) (ground))
      ("2"
       (flatten)
       (inst -3 "p!1-1-k")
       (("1" (assert) (ground)) ("2" (assert))))))
    ("2" (skosimp*) (assert))))


proof_type: f_proof
decl_type: formula
library: matrices
theory: matrix_det
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skeep)
   (expand "is_simple_prod?")
   (inst + "LAMBDA (i): Id(pn)" "0")
   (split)
   (("1" (expand "is_simple_seq?") (propax))
    ("2" (expand "prod_mat") (propax))))


proof_type: f_proof
decl_type: formula
library: matrices
theory: matrix_det
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skeep)
   (expand "is_simple_prod?")
   (inst + "LAMBDA (j:nat): Esr(pn)(i,r)" "0")
   (split)
   (("1" (expand "is_simple_seq?") (skeep) (assert) (inst 4 "i" "r"))
    ("2" (expand "prod_mat") (propax))))


proof_type: f_proof
decl_type: formula
library: matrices
theory: matrix_det
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skeep)
   (expand "is_simple_prod?")
   (inst + "LAMBDA (p:nat): Ers(pn)(i,j)" "0")
   (split)
   (("1"
     (expand "is_simple_seq?")
     (skeep)
     (assert)
     (inst + "i" "j")
     (assert))
    ("2" (expand "prod_mat") (propax))))


proof_type: f_proof
decl_type: formula
library: matrices
theory: matrix_det
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skeep)
   (expand "is_simple_prod?")
   (inst + "LAMBDA (p:nat): Easr(pn)(i,j,r)" "0")
   (split)
   (("1" (expand "is_simple_seq?") (skeep) (inst 3 "i" "j" "r") (assert))
    ("2" (expand "prod_mat") (propax))))


proof_type: f_proof
decl_type: formula
library: matrices
theory: matrix_det
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (expand "is_simple_prod?")
   (case "FORALL (pn: posnat, S: SquareMatrix(pn),k):
                        (EXISTS (FM: [nat -> SquareMatrix(pn)]):
                           is_simple_seq?(pn)(FM, k, FALSE,false) AND S = prod_mat(pn)(FM, k))
                         IMPLIES det(S) = 1")
   (("1"
     (skeep)
     (skeep)
     (inst - "pn" "S" "k")
     (assert)
     (inst + "FM")
     (assert))
    ("2"
     (hide 2)
     (induct "k")
     (("1"
       (skeep)
       (skeep)
       (assert)
       (replace -2)
       (expand "prod_mat")
       (expand "is_simple_seq?")
       (inst - "0")
       (assert)
       (ground)
       (("1" (replaces -1) (rewrite "det_Id"))
        ("2" (skeep) (replace -3) (rewrite "det_Easr") (assert))))
      ("2"
       (skeep)
       (assert)
       (skeep)
       (assert)
       (skeep)
       (replace -3 +)
       (rewrite "prod_mat_expand_left" 1)
       (inst - "pn" "prod_mat(pn)(LAMBDA (i): FM(1 + i), j)")
       (assert)
       (split -1)
       (("1"
         (expand "is_simple_seq?")
         (inst - "0")
         (assert)
         (split -)
         (("1" (replaces -1) (rewrite "mult_Id_left"))
          ("2"
           (skosimp*)
           (replace -3)
           (name "GV" "prod_mat(pn)(LAMBDA (i): FM(1 + i), j)")
           (replace -1)
           (assert)
           (rewrite "mult_Easr_left" +)
           (rewrite "det_replace_row_sum_scal"))))
        ("2"
         (hide 2)
         (inst + "LAMBDA (i): FM(1+i)")
         (assert)
         (expand "is_simple_seq?")
         (skeep)
         (inst - "1+p")
         (assert))))))))


proof_type: f_proof
decl_type: formula
library: matrices
theory: matrix_det
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (expand "is_simple_prod?")
   (case " FORALL (pn: posnat, S, R: SquareMatrix(pn),Kz:nat,k:nat):k<=Kz AND
                        (EXISTS (FM: [nat -> SquareMatrix(pn)]):
                           is_simple_seq?(pn)(FM, k, FALSE, FALSE) AND
                            S = prod_mat(pn)(FM, k))
                         IMPLIES det(S * R) = det(R)")
   (("1"
     (skeep)
     (skeep)
     (inst - "pn" "S" "R" "k" "k")
     (assert)
     (inst + "FM")
     (assert))
    ("2"
     (hide 2)
     (induct "Kz")
     (("1"
       (skeep)
       (case "k = 0")
       (("1"
         (replaces -1)
         (hide -1)
         (assert)
         (skeep)
         (expand "is_simple_seq?")
         (inst - "0")
         (expand "prod_mat")
         (replace -2 :dir rl)
         (ground)
         (("1" (replaces -1) (rewrite "mult_Id_left"))
          ("2"
           (skeep)
           (replace -3 +)
           (rewrite "mult_Easr_left" +)
           (rewrite "det_replace_row_sum_scal"))))
        ("2" (skeep) (replace -3) (assert))))
      ("2"
       (skeep)
       (skeep)
       (skeep)
       (case "NOT k = j+1")
       (("1" (inst - "pn" "S" "R" "k") (assert) (inst + "FM") (assert))
        ("2"
         (replace -1)
         (hide -3)
         (assert)
         (replace -4 +)
         (expand "prod_mat" +)
         (rewrite "matrix_mult_assoc")
         (("1"
           (inst-cp - "pn" "prod_mat(pn)(FM,j)" "FM(1+j)*R" "j")
           (("1"
             (assert)
             (split -)
             (("1"
               (replace -1)
               (assert)
               (inst - "pn" "FM(1+j)" "R" "0")
               (assert)
               (inst + "LaMBDA (p:nat): FM(1+j)")
               (split)
               (("1"
                 (expand "is_simple_seq?")
                 (skosimp*)
                 (inst - "1+j")
                 (assert))
                ("2" (expand "prod_mat") (propax))))
              ("2"
               (inst + "FM")
               (hide -2)
               (expand "is_simple_seq?")
               (propax))))
            ("2"
             (rewrite "rows_mult")
             (rewrite "columns_mult")
             (("1" (assert))
              ("2"
               (typepred "FM(1+j)")
               (expand "rows")
               (expand "length")
               (assert))))))
          ("2"
           (typepred "FM(1+j)")
           (expand "rows")
           (expand "length")
           (assert))))))))))


proof_type: f_proof
decl_type: formula
library: matrices
theory: matrix_det
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (case "FORALL (include_scals, include_swaps: bool, pn: posnat,
                                     S: SquareMatrix(pn)):
                               is_simple_prod?(pn, include_scals, include_swaps)(S) IMPLIES
                                is_simple_prod?(pn, include_scals, include_swaps)(transpose(S))")
   (("1"
     (skeep)
     (ground)
     (("1" (inst?) (assert))
      ("2"
       (inst - _ _ "pn" "transpose(S)")
       (inst?)
       (assert)
       (rewrite "transpose_transpose"))))
    ("2"
     (hide 2)
     (skeep)
     (expand "is_simple_prod?")
     (skeep)
     (inst +
      "LAMBDA (i): IF i<=k THEN transpose(FM(k-i)) ELSE FM(i) ENDIF" "k")
     (("1"
       (lemma "transpose_prod_mat")
       (inst?)
       (replace -3 +)
       (replace -1)
       (expand "is_simple_seq?")
       (skeep)
       (case "p>k")
       (("1" (assert) (inst - "p") (ground))
        ("2"
         (assert)
         (inst - "k-p")
         (split -)
         (("1" (replaces -1) (rewrite "transpose_Id"))
          ("2"
           (flatten)
           (assert)
           (skeep)
           (lemma "transpose_Ers")
           (inst?)
           (replace -5)
           (replace -1)
           (inst + "j" "i")
           (assert))
          ("3"
           (skeep)
           (lemma "transpose_Easr")
           (inst?)
           (replace -4)
           (replace -1)
           (assert)
           (inst + "j" "i" "r")
           (assert))
          ("4"
           (flatten)
           (assert)
           (skeep)
           (lemma "transpose_Esr")
           (inst?)
           (inst 5 "i" "r")
           (assert))))))
      ("2"
       (hide-all-but 1)
       (skosimp*)
       (rewrite "rows_transpose")
       (rewrite "columns_transpose")
       (assert))
      ("3" (hide-all-but 1) (skosimp*) (assert))))
    ("3"
     (hide-all-but 1)
     (skosimp*)
     (rewrite "rows_transpose")
     (rewrite "columns_transpose")
     (assert))))


proof_type: f_proof
decl_type: formula
library: matrices
theory: matrix_det
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skeep)
   (name "GZ"
         "LAMBDA (k): form_matrix(lambda (i,j): IF i<=k AND i=j THEN entry(S)(i,j) ELSIF i=j THEN 1 ELSE 0 ENDIF,pn,pn)")
   (case "FORALL (k): k<pn IMPLIES is_simple_prod?(pn,true,include_swaps)(GZ(k))")
   (("1"
     (case "S = GZ(pn-1)")
     (("1" (inst - "pn-1") (assert) (assert))
      ("2"
       (hide (-1 2))
       (rewrite "full_matrix_eq")
       (("1"
         (split +)
         (("1" (expand "GZ" 1) (rewrite "rows_form_matrix") (assert))
          ("2"
           (expand "GZ" 1)
           (lemma "columns_form_matrix")
           (inst?)
           (assert))
          ("3"
           (skosimp*)
           (expand "GZ" +)
           (rewrite "entry_form_matrix")
           (lift-if)
           (assert)
           (ground)
           (typepred "i!1")
           (typepred "j!1")
           (expand "diagonal?")
           (inst - "i!1" "j!1")
           (assert))))
        ("2"
         (flatten)
         (lemma "form_matrix_square")
         (inst -
          "LAMBDA (i, j):
                                 IF i <= pn-1 AND i = j THEN entry(S)(i, j)
                                 ELSIF i = j THEN 1
                                 ELSE 0
                                 ENDIF"
          "pn" "pn")
         (skosimp*)
         (assert)
         (expand "GZ" +)
         (assert)
         (inst - "i!1" "j!1"))))))
    ("2"
     (hide (-1 2))
     (induct "k")
     (("1"
       (flatten)
       (assert)
       (hide -2)
       (expand "is_simple_prod?")
       (inst + "LAMBDA (i): GZ(0)" "0")
       (("1"
         (split)
         (("1"
           (expand "is_simple_seq?")
           (skeep)
           (inst 4 "0" "entry(S)(0,0)")
           (assert)
           (hide (2 3))
           (rewrite "full_matrix_eq" 2)
           (("1"
             (split)
             (("1" (expand "GZ") (rewrite "rows_form_matrix") (assert))
              ("2"
               (expand "GZ" 1)
               (lemma "columns_form_matrix")
               (inst?)
               (assert))
              ("3"
               (skeep)
               (typepred "i")
               (typepred "j")
               (expand "GZ")
               (hide 2)
               (rewrite "entry_form_matrix")
               (assert)
               (rewrite "entry_Esr")
               (lift-if)
               (lift-if)
               (lift-if)
               (assert)
               (lift-if)
               (ground))))
            ("2"
             (flatten)
             (skosimp*)
             (lemma "form_matrix_square")
             (expand "GZ" 2)
             (inst?)
             (assert)
             (split -)
             (("1" (expand "GZ" 1) (propax))
              ("2" (inst - "i!1" "j!1"))))))
          ("2" (expand "prod_mat") (propax))))
        ("2"
         (split +)
         (("1"
           (flatten)
           (lemma "form_matrix_square")
           (expand "GZ")
           (inst?)
           (assert)
           (skosimp*)
           (inst - "i!1" "j!1"))
          ("2" (expand "GZ") (rewrite "rows_form_matrix") (assert))
          ("3"
           (lemma "columns_form_matrix")
           (expand "GZ")
           (inst?)
           (assert))
          ("4"
           (expand "GZ")
           (rewrite "rows_form_matrix")
           (lemma "columns_form_matrix")
           (inst?)
           (assert))
          ("5" (expand "GZ") (rewrite "rows_form_matrix"))))))
      ("2"
       (skeep)
       (case "GZ(j+1) = GZ(j)*Esr(pn)(j+1,entry(S)(j+1,j+1))")
       (("1"
         (replaces -1)
         (rewrite "mult_simple_prod")
         (("1" (hide 2) (rewrite "Esr_simple_prod"))
          ("2"
           (assert)
           (expand "is_simple_prod?")
           (skeep)
           (assert)
           (flatten)
           (replace -2)
           (assert)
           (typepred "prod_mat(pn)(FM,k)")
           (assert)
           (skosimp*)
           (inst - "i!1" "j!1"))))
        ("2"
         (assert)
         (hide (-1 2))
         (expand "GZ")
         (expand "Esr")
         (rewrite "form_matrix_mult")
         (rewrite "full_matrix_eq")
         (split)
         (("1" (rewrite "rows_form_matrix") (rewrite "rows_form_matrix"))
          ("2"
           (lemma "columns_form_matrix")
           (inst?)
           (assert)
           (replaces -1)
           (lemma "columns_form_matrix")
           (inst?)
           (assert))
          ("3"
           (skosimp*)
           (rewrite "entry_form_matrix")
           (rewrite "entry_form_matrix")
           (assert)
           (lift-if)
           (split 1)
           (("1"
             (flatten)
             (assert)
             (split 1)
             (("1"
               (flatten)
               (assert)
               (replace -2)
               (assert)
               (lemma "sigma_eq_one_arg2")
               (inst?)
               (inst - "j!1")
               (assert)
               (split -)
               (("1"
                 (replaces -1)
                 (assert)
                 (lift-if)
                 (lift-if)
                 (lift-if)
                 (ground))
                ("2"
                 (hide 2)
                 (skosimp*)
                 (expand "diagonal?")
                 (lift-if)
                 (lift-if)
                 (lift-if)
                 (lift-if)
                 (lift-if)
                 (lift-if)
                 (lift-if)
                 (lift-if)
                 (assert))))
              ("2"
               (flatten)
               (split 2)
               (("1"
                 (flatten)
                 (replaces -1)
                 (assert)
                 (lemma "sigma_eq_one_arg2")
                 (inst?)
                 (inst - "j!1")
                 (assert)
                 (skosimp*)
                 (lift-if)
                 (lift-if)
                 (lift-if)
                 (ground))
                ("2"
                 (flatten)
                 (rewrite "sigma_restrict_eq_0")
                 (hide 3)
                 (skosimp*)
                 (expand "diagonal?")
                 (inst-cp - "i!1" "i!2")
                 (lift-if)
                 (assert)
                 (lift-if)
                 (assert))))))
            ("2" (propax))))))))
      ("3"
       (hide 2)
       (skeep)
       (assert)
       (split)
       (("1"
         (lemma "form_matrix_square")
         (expand "GZ")
         (inst -
          "LAMBDA (i, j):
                                            IF i <= k AND i = j THEN entry(S)(i, j)
                                            ELSIF i = j THEN 1
                                            ELSE 0
                                            ENDIF"
          "pn" "pn")
         (assert)
         (flatten)
         (assert)
         (skosimp*)
         (inst - "i!1" "j!1"))
        ("2"
         (assert)
         (expand "GZ")
         (rewrite "rows_form_matrix")
         (assert))
        ("3"
         (expand "GZ")
         (lemma "columns_form_matrix")
         (inst?)
         (assert))
        ("4"
         (expand "GZ")
         (rewrite "rows_form_matrix")
         (lemma "columns_form_matrix")
         (inst?)
         (assert))
        ("5" (expand "GZ") (rewrite "rows_form_matrix"))))))
    ("3"
     (hide 2)
     (skeep)
     (assert)
     (split)
     (("1"
       (flatten)
       (expand "GZ")
       (lemma "form_matrix_square")
       (inst?)
       (assert)
       (skosimp*)
       (inst - "i!1" "j!1"))
      ("2" (expand "GZ") (rewrite "rows_form_matrix") (assert))
      ("3" (expand "GZ") (lemma "columns_form_matrix") (inst?) (assert))
      ("4"
       (expand "GZ")
       (rewrite "rows_form_matrix")
       (lemma "columns_form_matrix")
       (inst?)
       (assert))
      ("5" (expand "GZ") (rewrite "rows_form_matrix"))))))


proof_type: f_proof
decl_type: formula
library: matrices
theory: matrix_det
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skeep)
   (expand "is_simple_prod?")
   (skeep)
   (inst + "FM" "k")
   (assert)
   (expand "is_simple_seq?")
   (skeep)
   (inst - "p")
   (ground))


proof_type: t_proof
decl_type: tcc
library: matrices
theory: matrix_det
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skeep)
   (assert)
   (split)
   (("1" (rewrite "rows_form_matrix"))
    ("2"
     (lemma "columns_form_matrix")
     (assert)
     (inst?)
     (assert)
     (rewrite "rows_form_matrix")
     (assert))
    ("3" (rewrite "rows_form_matrix") (assert))
    ("4" (lemma "columns_form_matrix") (inst?) (assert))))


proof_type: t_proof
decl_type: tcc
library: matrices
theory: matrix_det
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skeep)
   (typepred "r*row(D)(i)")
   (replace -2)
   (rewrite "length_row" 1)
   (assert)
   (lift-if)
   (ground)
   (postpone))


proof_type: t_proof
decl_type: tcc
library: matrices
theory: matrix_det
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skeep)
   (name "FM"
         "form_matrix(LAMBDA (k, p: nat):
                                                  IF k = i AND p = j THEN 1
                                                  ELSIF k = j AND p = i THEN 1
                                                  ELSIF k /= i AND k /= j AND k = p THEN 1
                                                  ELSE 0
                                                  ENDIF,
                                                pn, pn)")
   (replace -1)
   (split)
   (("1"
     (rewrite "full_matrix_eq")
     (split)
     (("1" (expand "FM" 1) (rewrite "rows_form_matrix") (assert))
      ("2"
       (expand "FM" 1)
       (lemma "columns_form_matrix")
       (inst?)
       (assert))
      ("3"
       (skosimp*)
       (expand "FM" 1)
       (rewrite "entry_form_matrix")
       (rewrite "entry_swap")
       (expand "swap")
       (lift-if)
       (lift-if)
       (lift-if)
       (lift-if)
       (lift-if)
       (lift-if)
       (assert)
       (expand "Id" +)
       (rewrite -1)
       (rewrite "entry_form_matrix")
       (rewrite "entry_form_matrix")
       (rewrite "entry_form_matrix")
       (assert)
       (rewrite "rows_form_matrix")
       (lemma "columns_form_matrix")
       (inst?)
       (assert)
       (replaces -1)
       (lift-if)
       (lift-if)
       (lift-if)
       (lift-if)
       (lift-if)
       (lift-if)
       (assert)
       (ground))))
    ("2" (expand "FM") (rewrite "rows_form_matrix"))
    ("3"
     (assert)
     (expand "FM")
     (rewrite "rows_form_matrix")
     (lemma "columns_form_matrix")
     (inst?)
     (assert))
    ("4" (expand "FM" 1) (rewrite "rows_form_matrix") (assert))
    ("5" (expand "FM" 1) (lemma "columns_form_matrix") (inst?) (assert))))


proof_type: t_proof
decl_type: tcc
library: matrices
theory: matrix_det
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skeep)
   (name "FM"
         "form_matrix(LAMBDA (k, p: nat):
                                              IF k = i
                                                THEN (IF j = i AND p = i
                                                      THEN 1 + r
                                                      ELSIF p = i
                                                      THEN 1
                                                      ELSIF p = j
                                                      THEN r
                                                      ELSE 0
                                                      ENDIF)
                                              ELSIF k = p THEN 1
                                              ELSE 0
                                              ENDIF,
                                            pn, pn)")
   (replace -1)
   (split +)
   (("1" (expand "FM" 1) (rewrite "rows_form_matrix"))
    ("2"
     (assert)
     (expand "FM" 1)
     (rewrite "rows_form_matrix")
     (lemma "columns_form_matrix")
     (inst?)
     (assert))
    ("3" (expand "FM" 1) (rewrite "rows_form_matrix") (assert))
    ("4" (lemma "columns_form_matrix") (expand "FM" 1) (inst?) (assert))))


proof_type: t_proof
decl_type: tcc
library: matrices
theory: matrix_det
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skeep)
   (typepred "row(D)(i)+r*row(D)(j)")
   (replaces -2)
   (expand "max")
   (lift-if)
   (ground)
   (("1" (typepred "r*row(D)(j)") (rewrite "length_row") (assert))
    ("2" (rewrite "length_row"))))


proof_type: t_proof
decl_type: tcc
library: matrices
theory: matrix_det
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skeep)
   (name "FM" "form_matrix(LAMbDA (i,j): 0,pn,pn)")
   (replaces -1)
   (split +)
   (("1" (expand "FM") (rewrite "rows_form_matrix"))
    ("2"
     (assert)
     (expand "FM")
     (rewrite "rows_form_matrix")
     (lemma "columns_form_matrix")
     (inst?)
     (assert))
    ("3" (expand "FM") (rewrite "rows_form_matrix") (assert))
    ("4" (expand "FM") (lemma "columns_form_matrix") (inst?) (assert))))


proof_type: t_proof
decl_type: tcc
library: matrices
theory: matrix_det
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skeep)
   (name "GG" "v(pn)(FM,k-1)")
   (("1"
     (replace -1)
     (hide -1)
     (typepred "GG")
     (rewrite "rows_mult" +)
     (rewrite "columns_mult" +)
     (("1" (assert)) ("2" (expand "rows") (expand "length") (assert))))
    ("2" (assert))))


proof_type: t_proof
decl_type: tcc
library: matrices
theory: matrix_det
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skeep)
   (rewrite "rows_mult")
   (rewrite "columns_mult")
   (("1" (assert))
    ("2" (typepred "R") (expand "rows") (expand "length") (assert))))


proof_type: t_proof
decl_type: tcc
library: matrices
theory: matrix_upper_triang
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skeep)
   (assert)
   (flatten)
   (split)
   (("1"
     (expand "upper_triangular?")
     (skeep)
     (typepred "j")
     (expand "ut_point1")
     (assert)
     (inst - "i!1" "j!1")
     (assert))
    ("2" (typepred "T") (propax)) ("3" (typepred "R") (propax))
    ("4" (typepred "R") (propax)) ("5" (typepred "Q") (propax))))


proof_type: t_proof
decl_type: tcc
library: matrices
theory: matrix_upper_triang
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skeep)
   (assert)
   (expand "ut_point1")
   (assert)
   (case "j = pn-1")
   (("1" (assert))
    ("2"
     (assert)
     (hide 3)
     (split 3)
     (("1" (typepred "j") (expand "ut_point1") (flatten) (assert))
      ("2"
       (skeep)
       (case "p = j")
       (("1"
         (typepred "i")
         (expand "ut_point2")
         (flatten)
         (inst - "k!1")
         (assert))
        ("2"
         (typepred "j")
         (expand "ut_point1")
         (flatten)
         (inst - "k!1" "p")
         (assert))))))))


proof_type: t_proof
decl_type: tcc
library: matrices
theory: matrix_upper_triang
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skeep)
   (assert)
   (case "j = pn-1")
   (("1" (assert))
    ("2"
     (hide 3)
     (expand "ut_point2")
     (assert)
     (split 3)
     (("1" (typepred "j") (expand "ut_point1") (flatten) (assert))
      ("2" (skeep) (assert))))))


proof_type: t_proof
decl_type: tcc
library: matrices
theory: matrix_upper_triang
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skeep)
   (typepred "i")
   (expand "ut_point2")
   (flatten)
   (assert)
   (skeep)
   (inst - "k!1")
   (ground))


proof_type: t_proof
decl_type: tcc
library: matrices
theory: matrix_upper_triang
signature: nil
run_date: Unknown date
run_time: ----
status: proved-incomplete
description: nil
script:
  (""
   (skeep)
   (lemma "lex3_lt_2")
   (inst?)
   (("1" (replace 4) (assert))
    ("2" (assert) (typepred "i") (expand "ut_point2") (propax))
    ("3" (assert) (typepred "j") (expand "ut_point1") (propax))))


proof_type: t_proof
decl_type: tcc
library: matrices
theory: matrix_upper_triang
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skeep)
   (typepred "row(S)(j) + row(S)(i)")
   (replaces -2)
   (rewrite "matrix_props.length_row")
   (rewrite "matrix_props.length_row")
   (assert)
   (lift-if)
   (lift-if)
   (lift-if)
   (typepred "i")
   (typepred "j")
   (expand "ut_point2")
   (expand "ut_point1")
   (flatten)
   (assert)
   (expand "max")
   (propax))


proof_type: t_proof
decl_type: tcc
library: matrices
theory: matrix_upper_triang
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skeep)
   (rewrite "rows_replace_row")
   (("1" (rewrite "columns_replace_row") (assert))
    ("2"
     (typepred "row(S)(j) + row(S)(i)")
     (replaces -2)
     (rewrite "matrix_props.length_row")
     (rewrite "matrix_props.length_row")
     (typepred "i")
     (typepred "j")
     (expand "ut_point2")
     (expand "ut_point1")
     (ground))))


proof_type: t_proof
decl_type: tcc
library: matrices
theory: matrix_upper_triang
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skeep)
   (typepred "row(Q)(j) + row(Q)(i)")
   (replaces -2)
   (rewrite "matrix_props.length_row")
   (rewrite "matrix_props.length_row")
   (typepred "i")
   (typepred "j")
   (expand "ut_point1")
   (expand "ut_point2")
   (flatten)
   (assert)
   (expand "max")
   (propax))


proof_type: t_proof
decl_type: tcc
library: matrices
theory: matrix_upper_triang
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skeep)
   (rewrite "rows_replace_row")
   (("1"
     (rewrite "columns_replace_row")
     (("1"
       (assert)
       (rewrite "replace_row_sum_to_scal")
       (("1"
         (lemma "mult_Easr_left")
         (inst?)
         (inst - "pn")
         (assert)
         (case "j < pn AND i < pn")
         (("1"
           (flatten)
           (assert)
           (replace -3 :dir rl)
           (split 5)
           (("1"
             (rewrite "mult_simple_prod")
             (rewrite "Easr_simple_prod"))
            ("2"
             (rewrite "upper_triangular_mult")
             (rewrite "upper_triangular_Easr")
             (typepred "i")
             (expand "ut_point2")
             (propax))))
          ("2"
           (typepred "i")
           (typepred "j")
           (expand "ut_point2")
           (expand "ut_point1")
           (ground))))
        ("2" (assert) (typepred "j") (expand "ut_point1") (propax))
        ("3"
         (typepred "i")
         (typepred "j")
         (expand "ut_point2")
         (propax))))
      ("2"
       (rewrite "length_add_vect")
       (rewrite "length_row")
       (("1"
         (rewrite "length_row")
         (("1" (expand "max") (propax))
          ("2"
           (typepred "i")
           (typepred "j")
           (expand "ut_point2")
           (flatten)
           (assert)
           (typepred "Q")
           (expand "rows")
           (assert))))
        ("2"
         (typepred "Q")
         (expand "rows")
         (assert)
         (typepred "j")
         (expand "ut_point1")
         (propax))))))
    ("2"
     (rewrite "length_add_vect")
     (rewrite "length_row")
     (("1"
       (rewrite "length_row")
       (("1" (expand "max") (propax))
        ("2"
         (typepred "Q")
         (expand "rows")
         (assert)
         (typepred "i")
         (expand "ut_point2")
         (propax))))
      ("2"
       (typepred "Q")
       (expand "rows")
       (assert)
       (typepred "j")
       (expand "ut_point1")
       (propax))))))


proof_type: t_proof
decl_type: tcc
library: matrices
theory: matrix_upper_triang
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skeep)
   (case "null?(R) OR null?(S) OR null?(Q)")
   (("1"
     (split -1)
     (("1" (typepred "R") (expand "rows") (expand "length") (assert))
      ("2" (typepred "S") (expand "rows") (expand "length") (assert))
      ("3" (typepred "Q") (expand "rows") (expand "length") (assert))))
    ("2"
     (flatten)
     (case "i < pn AND j < pn AND i>j")
     (("1"
       (flatten)
       (assert)
       (split 8)
       (("1" (rewrite "mult_simple_prod") (rewrite "Easr_simple_prod"))
        ("2"
         (rewrite "replace_row_sum_to_scal")
         (lemma "mult_Easr_left")
         (inst - _ _ _ _ "1")
         (inst?)
         (inst - "pn")
         (assert)
         (replaces -1 :dir rl)
         (rewrite "matrix_mult_assoc")
         (("1"
           (rewrite "matrix_mult_assoc" :dir rl)
           (("1"
             (rewrite "mult_Easr_Easr_inv")
             (rewrite "mult_Id_left")
             (assert)
             (typepred "R")
             (assert))
            ("2" (rewrite "Easr_null"))))
          ("2" (rewrite "Easr_null"))))
        ("3"
         (rewrite "replace_row_sum_to_scal")
         (lemma "mult_Easr_left")
         (inst - _ _ _ _ "1")
         (inst?)
         (inst?)
         (assert)
         (replaces -1 :dir rl)
         (rewrite "matrix_mult_assoc")
         (rewrite "matrix_mult_assoc" :dir rl)
         (typepred "R")
         (assert)
         (flatten)
         (assert)
         (replace -9)
         (rewrite "mult_Id_left")
         (rewrite "mult_Easr_Easr_inv"))
        ("4" (rewrite "rows_mult") (assert))
        ("5"
         (assert)
         (rewrite "rows_mult")
         (rewrite "columns_mult")
         (assert))
        ("6" (rewrite "rows_mult") (assert))
        ("7" (rewrite "columns_mult") (assert))))
      ("2"
       (typepred "i")
       (typepred "j")
       (expand "ut_point2")
       (expand "ut_point1")
       (hide 9)
       (flatten)
       (assert))))))


proof_type: t_proof
decl_type: tcc
library: matrices
theory: matrix_upper_triang
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skeep)
   (case "NOT (i < pn AND j<pn)")
   (("1"
     (typepred "i")
     (typepred "j")
     (expand "ut_point2")
     (expand "ut_point1")
     (ground))
    ("2"
     (flatten)
     (assert)
     (typepred "T")
     (assert)
     (replace -7 + :dir rl)
     (lemma "vect_scal_1")
     (inst - "row(Q)(i)")
     (replaces -1 :dir rl)
     (lemma "vect_scal_1")
     (inst - "row(Q*T)(i)")
     (replaces -1 :dir rl)
     (assert)
     (lemma "mult_Easr_left")
     (inst?)
     (inst - "pn")
     (assert)
     (replaces -1 :dir rl)
     (lemma "mult_Easr_left")
     (inst - "Q*T" "j" "i" "pn" "1")
     (assert)
     (replaces -1 :dir rl)
     (lemma "matrix_mult_assoc")
     (inst?)
     (assert)
     (typepred "Q")
     (expand "rows")
     (expand "length")
     (assert))))


proof_type: t_proof
decl_type: tcc
library: matrices
theory: matrix_upper_triang
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skeep)
   (case "NOT i>j")
   (("1" (typepred "i") (expand "ut_point2") (ground))
    ("2"
     (assert)
     (hide 4)
     (hide 3)
     (hide 2)
     (case "NOT (i < pn AND j<pn)")
     (("1"
       (typepred "i")
       (typepred "j")
       (expand "ut_point1")
       (expand "ut_point2")
       (ground))
      ("2"
       (flatten)
       (expand "ut_point1")
       (split +)
       (("1" (rewrite "rows_replace_row") (assert))
        ("2"
         (skeep)
         (rewrite "entry_replace_row")
         (("1"
           (assert)
           (lift-if)
           (split 1)
           (("1"
             (flatten)
             (replace -1)
             (assert)
             (typepred "j")
             (expand "ut_point1")
             (inst-cp - "j" "p")
             (assert)
             (inst - "i" "p")
             (assert)
             (rewrite "access_sum")
             (expand "entry")
             (assert))
            ("2"
             (flatten)
             (typepred "k!1")
             (typepred "j")
             (expand "ut_point1")
             (inst-cp - "k!1" "p")
             (assert))))
          ("2"
           (typepred "row(S)(j) + row(S)(i)")
           (replace -2)
           (rewrite "matrix_props.length_row")
           (rewrite "matrix_props.length_row")
           (expand "max" 1)
           (propax))))))))))


proof_type: t_proof
decl_type: tcc
library: matrices
theory: matrix_upper_triang
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skeep)
   (assert)
   (case "NOT (i < pn AND j<pn)")
   (("1"
     (typepred "i")
     (typepred "j")
     (expand "ut_point2")
     (expand "ut_point1")
     (ground))
    ("2"
     (flatten)
     (expand "ut_point2")
     (hide 4)
     (assert)
     (case "NOT i > j")
     (("1" (typepred "i") (expand "ut_point2") (ground))
      ("2"
       (assert)
       (hide 3)
       (skeep)
       (rewrite "entry_replace_row")
       (("1"
         (lift-if)
         (ground)
         (typepred "i")
         (expand "ut_point2")
         (inst - "k!1")
         (assert))
        ("2"
         (typepred "row(S)(j) + row(S)(i)")
         (replaces -2)
         (rewrite "matrix_props.length_row")
         (rewrite "matrix_props.length_row")
         (expand "max" 1)
         (propax))))))))


proof_type: t_proof
decl_type: tcc
library: matrices
theory: matrix_upper_triang
signature: nil
run_date: Unknown date
run_time: ----
status: proved-incomplete
description: nil
script:
  (""
   (skeep)
   (case "NOT (i < pn AND j<pn)")
   (("1"
     (typepred "i")
     (typepred "j")
     (expand "ut_point1")
     (expand "ut_point2")
     (ground))
    ("2"
     (flatten)
     (lemma "lex3_lt_2")
     (inst?)
     (("1"
       (replace 5)
       (assert)
       (hide 6)
       (lift-if)
       (hide (4 5))
       (split +)
       (("1"
         (flatten)
         (rewrite "entry_replace_row")
         (("1"
           (rewrite "entry_replace_row")
           (("1"
             (assert)
             (rewrite "access_sum")
             (rewrite "access_row")
             (rewrite "access_row")
             (assert))
            ("2"
             (typepred "row(S)(j) + row(S)(i)")
             (replace -2)
             (rewrite "matrix_props.length_row")
             (rewrite "matrix_props.length_row")
             (expand "max" 1)
             (propax))))
          ("2"
           (typepred "row(S)(j) + row(S)(i)")
           (replace -2)
           (rewrite "matrix_props.length_row")
           (rewrite "matrix_props.length_row")
           (expand "max" 1)
           (propax))))
        ("2" (ground))))
      ("2"
       (hide 6)
       (flatten)
       (typepred "row(S)(j) + row(S)(i)")
       (replace -2)
       (rewrite "matrix_props.length_row")
       (rewrite "matrix_props.length_row")
       (assert)
       (expand "max")
       (propax))
      ("3"
       (typepred "row(S)(j) + row(S)(i)")
       (replace -2)
       (rewrite "matrix_props.length_row")
       (rewrite "matrix_props.length_row")
       (expand "max" 1)
       (assert))
      ("4" (assert))))))


proof_type: t_proof
decl_type: tcc
library: matrices
theory: matrix_upper_triang
signature: nil
run_date: Unknown date
run_time: ----
status: proved-incomplete
description: nil
script:
  (""
   (skeep)
   (case "i < pn AND j < pn AND i>j")
   (("1"
     (case "NOT (null?(Q) OR null?(R) OR null?(S))")
     (("1"
       (flatten)
       (case "length[real](row(S)(j) + 1 * row(S)(i)) = pn")
       (("1"
         (case "columns(S)=pn")
         (("1"
           (name "GG"
                 "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"
             (replaces -1)
             (assert)
             (typepred "GG")
             (assert)
             (flatten)
             (assert)
             (split 9)
             (("1" (propax)) ("2" (propax))
              ("3"
               (assert)
               (replace -4 1)
               (rewrite "replace_row_sum_to_scal")
               (rewrite "det_replace_row_sum_scal"))))
            ("2"
             (hide 10)
             (rewrite "replace_row_sum_to_scal")
             (rewrite "lex3_lt_2")
             (lift-if)
             (lift-if)
             (lift-if)
             (rewrite "entry_replace_row")
             (rewrite "entry_replace_row")
             (assert)
             (split 1)
             (("1"
               (rewrite "access_sum")
               (rewrite "access_scal")
               (rewrite "access_row")
               (rewrite "access_row")
               (assert))
              ("2" (propax))))
            ("3" (hide 10) (assert))
            ("4"
             (hide 10)
             (typepred "i")
             (typepred "j")
             (expand "ut_point1")
             (expand "ut_point2")
             (flatten)
             (assert)
             (rewrite "rows_replace_row")
             (assert)
             (skeep)
             (rewrite "entry_replace_row")
             (lift-if)
             (assert)
             (inst - "k!1" "j")
             (inst - "k!1")
             (assert))
            ("5"
             (hide 10)
             (typepred "j")
             (typepred "i")
             (expand "ut_point1")
             (expand "ut_point2")
             (flatten)
             (rewrite "rows_replace_row")
             (assert)
             (skeep)
             (rewrite "entry_replace_row")
             (lift-if)
             (assert)
             (split 1)
             (("1"
               (flatten)
               (rewrite "access_sum")
               (rewrite "access_row")
               (rewrite "access_row")
               (assert)
               (inst - "i")
               (inst-cp - "i" "p")
               (inst - "j" "p")
               (assert))
              ("2" (flatten) (inst - "k!1" "p") (assert))))
            ("6"
             (hide 10)
             (flatten)
             (assert)
             (lemma "mult_Easr_left")
             (inst-cp - "Q" "j" "i" "pn" "1")
             (inst - "S" "j" "i" "pn" "1")
             (rewrite "replace_row_sum_to_scal")
             (rewrite "replace_row_sum_to_scal")
             (assert)
             (replaces -1 :dir rl)
             (replaces -1 :dir rl)
             (rewrite "matrix_mult_assoc")
             (typepred "Q")
             (assert)
             (typepred "T")
             (assert))
            ("7"
             (hide 10)
             (flatten)
             (assert)
             (replace 1)
             (rewrite "Id_simple_prod"))
            ("8"
             (hide 10)
             (flatten)
             (assert)
             (assert)
             (split 1)
             (("1"
               (rewrite "mult_simple_prod")
               (rewrite "Easr_simple_prod"))
              ("2"
               (rewrite "replace_row_sum_to_scal")
               (lemma "mult_Easr_left")
               (inst - "Q" "j" "i" "pn" "1")
               (assert)
               (replaces -1 :dir rl)
               (rewrite "matrix_mult_assoc")
               (("1"
                 (rewrite "matrix_mult_assoc" :dir rl)
                 (("1"
                   (rewrite "mult_Easr_Easr_inv")
                   (rewrite "mult_Id_left")
                   (assert)
                   (typepred "R")
                   (assert))
                  ("2" (rewrite "Easr_null"))))
                ("2" (rewrite "Easr_null"))))
              ("3"
               (rewrite "replace_row_sum_to_scal")
               (lemma "mult_Easr_left")
               (inst - "Q" "j" "i" "pn" "1")
               (assert)
               (replaces -1 :dir rl)
               (rewrite "matrix_mult_assoc")
               (rewrite "matrix_mult_assoc" :dir rl)
               (typepred "R")
               (assert)
               (flatten)
               (replace -9)
               (rewrite "mult_Id_left")
               (rewrite "mult_Easr_Easr_inv"))
              ("4" (rewrite "rows_mult") (assert))
              ("5"
               (rewrite "rows_mult")
               (rewrite "columns_mult")
               (rewrite "columns_Easr")
               (assert))
              ("6" (rewrite "rows_mult") (assert))
              ("7"
               (rewrite "columns_mult")
               (rewrite "columns_Easr")
               (assert))))
            ("9" (hide 10) (flatten) (assert) (rewrite "Id_simple_prod"))
            ("10"
             (hide 10)
             (flatten)
             (assert)
             (split 1)
             (("1"
               (rewrite "rows_replace_row")
               (rewrite "columns_replace_row")
               (assert))
              ("2" (rewrite "rows_replace_row") (assert))
              ("3"
               (rewrite "replace_row_sum_to_scal")
               (lemma "mult_Easr_left")
               (inst - "Q" "j" "i" "pn" "1")
               (assert)
               (replaces -1 :dir rl)
               (rewrite "mult_simple_prod")
               (rewrite "Easr_simple_prod"))))
            ("11"
             (hide 10)
             (flatten)
             (assert)
             (rewrite "length_add_vect")
             (rewrite "length_row")
             (("1"
               (rewrite "length_row")
               (("1" (expand "max") (propax))
                ("2" (typepred "Q") (expand "rows") (assert))))
              ("2" (typepred "Q") (expand "rows") (assert))))
            ("12"
             (hide 10)
             (rewrite "rows_replace_row")
             (rewrite "columns_replace_row")
             (assert))
            ("13" (hide 10) (lemma "vect_scal_1") (inst?) (assert))))
          ("2" (hide 10) (assert))))
        ("2"
         (hide 10)
         (assert)
         (rewrite "length_add_vect")
         (rewrite "length_scal_vect")
         (rewrite "length_row")
         (("1"
           (rewrite "length_row")
           (("1" (expand "max") (assert))
            ("2" (typepred "S") (expand "rows") (assert))))
          ("2" (typepred "S") (expand "rows") (assert))))))
      ("2"
       (hide 6)
       (split -)
       (("1" (typepred "Q") (expand "rows") (expand "length") (assert))
        ("2" (typepred "R") (expand "rows") (expand "length") (assert))
        ("3"
         (typepred "S")
         (expand "rows")
         (expand "length")
         (assert))))))
    ("2"
     (hide 7)
     (typepred "i")
     (typepred "j")
     (expand "ut_point1")
     (expand "ut_point2")
     (flatten)
     (assert))))


proof_type: t_proof
decl_type: tcc
library: matrices
theory: matrix_upper_triang
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skeep)
   (skeep)
   (typepred "row(S)(i) + pivnum * row(S)(j)")
   (replaces -2)
   (expand "max")
   (lift-if)
   (split 6)
   (("1"
     (flatten)
     (typepred "pivnum * row(S)(j)")
     (replaces -2)
     (assert)
     (rewrite "matrix_props.length_row" 1)
     (lift-if)
     (ground))
    ("2"
     (flatten)
     (rewrite "matrix_props.length_row" 2)
     (lift-if)
     (hide 1)
     (split 1)
     (("1" (flatten) (typepred "i") (expand "ut_point2") (ground))
      ("2" (propax))))))


proof_type: t_proof
decl_type: tcc
library: matrices
theory: matrix_upper_triang
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skeep)
   (skeep)
   (split 6)
   (("1"
     (rewrite "rows_replace_row")
     (rewrite "columns_replace_row")
     (assert))
    ("2" (rewrite "rows_replace_row") (assert))))


proof_type: t_proof
decl_type: tcc
library: matrices
theory: matrix_upper_triang
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skeep)
   (skeep)
   (rewrite "length_add_vect_same")
   (("1"
     (rewrite "matrix_props.length_row")
     (typepred "i")
     (expand "ut_point2")
     (flatten)
     (assert))
    ("2"
     (rewrite "matrix_props.length_row")
     (typepred "i")
     (expand "ut_point2")
     (flatten)
     (assert)
     (rewrite "length_scal_vect")
     (rewrite "matrix_props.length_row"))))


proof_type: t_proof
decl_type: tcc
library: matrices
theory: matrix_upper_triang
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skeep)
   (case "i<pn aND j<pn")
   (("1"
     (flatten)
     (skeep)
     (assert)
     (rewrite "rows_replace_row")
     (("1"
       (lemma "mult_Easr_left")
       (inst?)
       (inst - "pn")
       (assert)
       (replaces -1 :dir rl)
       (rewrite "mult_simple_prod")
       (rewrite "Easr_simple_prod"))
      ("2"
       (rewrite "length_add_vect")
       (rewrite "length_scal_vect")
       (rewrite "length_row")
       (("1"
         (rewrite "length_row")
         (("1" (expand "max") (propax))
          ("2" (typepred "Q") (expand "rows") (assert))))
        ("2" (rewrite "length_rows") (assert))))))
    ("2"
     (typepred "i")
     (typepred "j")
     (expand "ut_point2")
     (expand "ut_point1")
     (flatten)
     (assert))))


proof_type: t_proof
decl_type: tcc
library: matrices
theory: matrix_upper_triang
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skeep)
   (skeep)
   (assert)
   (case "NOT (i<pn AND j<pn AND i>j)")
   (("1"
     (typepred "i")
     (typepred "j")
     (expand "ut_point2")
     (expand "ut_point1")
     (flatten)
     (assert))
    ("2"
     (flatten)
     (assert)
     (split 6)
     (("1" (rewrite "mult_simple_prod") (rewrite "Easr_simple_prod"))
      ("2"
       (lemma "mult_Easr_left")
       (inst - "Q" "i" "j" "pn" "pivnum")
       (assert)
       (replaces -1 :dir rl)
       (rewrite "matrix_mult_assoc")
       (("1"
         (rewrite "matrix_mult_assoc" :dir rl)
         (("1"
           (rewrite "mult_Easr_Easr_inv")
           (rewrite "mult_Id_left")
           (typepred "R")
           (assert))
          ("2" (rewrite "Easr_null"))))
        ("2" (rewrite "Easr_null"))))
      ("3"
       (lemma "mult_Easr_left")
       (inst - "Q" "i" "j" "pn" "pivnum")
       (assert)
       (replaces -1 :dir rl)
       (rewrite "matrix_mult_assoc")
       (("1"
         (rewrite "matrix_mult_assoc" :dir rl)
         (("1"
           (typepred "R")
           (assert)
           (flatten)
           (replace -9)
           (rewrite "mult_Id_left")
           (rewrite "mult_Easr_Easr_inv"))
          ("2"
           (typepred "R")
           (expand "rows")
           (expand "length")
           (assert))))
        ("2" (typepred "Q") (expand "rows") (expand "length") (assert))))
      ("4" (rewrite "rows_mult") (assert))
      ("5"
       (rewrite "rows_mult")
       (rewrite "columns_mult")
       (("1" (assert))
        ("2" (typepred "R") (expand "rows") (expand "length") (assert))))
      ("6" (rewrite "rows_mult") (assert))
      ("7"
       (rewrite "columns_mult")
       (("1" (assert))
        ("2"
         (typepred "R")
         (expand "rows")
         (expand "length")
         (assert))))))))


proof_type: t_proof
decl_type: tcc
library: matrices
theory: matrix_upper_triang
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skeep)
   (assert)
   (skeep)
   (assert)
   (lemma "mult_Easr_left")
   (inst?)
   (inst - "pn")
   (assert)
   (split -)
   (("1"
     (replaces -1 :dir rl)
     (rewrite "matrix_mult_assoc")
     (("1"
       (lemma "mult_Easr_left")
       (inst - "S" _ _ _ _)
       (inst?)
       (assert)
       (split -1)
       (("1" (replaces -1 :dir rl) (assert) (typepred "T") (assert))
        ("2"
         (typepred "i")
         (typepred "j")
         (expand "ut_point1")
         (expand "ut_point2")
         (flatten)
         (assert))
        ("3"
         (typepred "i")
         (typepred "j")
         (expand "ut_point1")
         (expand "ut_point2")
         (flatten)
         (assert))))
      ("2" (typepred "Q") (grind))))
    ("2"
     (typepred "i")
     (typepred "j")
     (expand "ut_point1")
     (expand "ut_point2")
     (flatten)
     (assert))
    ("3"
     (typepred "i")
     (typepred "j")
     (expand "ut_point1")
     (expand "ut_point2")
     (flatten)
     (assert))))


proof_type: t_proof
decl_type: tcc
library: matrices
theory: matrix_upper_triang
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skeep)
   (skeep)
   (assert)
   (typepred "j")
   (expand "ut_point1")
   (flatten)
   (assert)
   (skeep 6)
   (inst-cp - "k!1" "p")
   (assert)
   (rewrite "entry_replace_row" +)
   (("1"
     (assert)
     (lift-if)
     (split 6)
     (("1"
       (flatten)
       (replace -1)
       (assert)
       (rewrite "access_sum")
       (rewrite "access_scal")
       (rewrite "access_row")
       (rewrite "access_row")
       (inst - "j" "p")
       (assert)
       (assert))
      ("2" (flatten))))
    ("2"
     (rewrite "length_add_vect_same")
     (("1"
       (rewrite "matrix_props.length_row")
       (typepred "i")
       (typepred "j")
       (expand "ut_point1")
       (expand "ut_point2")
       (flatten)
       (assert))
      ("2"
       (rewrite "length_scal_vect")
       (rewrite "matrix_props.length_row")
       (rewrite "matrix_props.length_row")
       (typepred "i")
       (typepred "j")
       (expand "ut_point1")
       (expand "ut_point2")
       (flatten)
       (assert))))))


proof_type: t_proof
decl_type: tcc
library: matrices
theory: matrix_upper_triang
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skeep)
   (skeep)
   (case "i = 0")
   (("1" (typepred "i") (expand "ut_point2") (ground))
    ("2"
     (assert)
     (typepred "i")
     (expand "ut_point2")
     (assert)
     (flatten)
     (assert)
     (skeep)
     (rewrite "entry_replace_row" +)
     (("1"
       (lift-if)
       (split 6)
       (("1"
         (flatten)
         (assert)
         (rewrite "access_sum")
         (rewrite "access_scal")
         (rewrite "access_row")
         (rewrite "access_row")
         (inst-cp - "i")
         (inst - "j")
         (assert))
        ("2" (flatten) (assert) (inst - "k!1") (assert))))
      ("2"
       (rewrite "length_add_vect_same")
       (("1" (rewrite "matrix_props.length_row"))
        ("2"
         (rewrite "length_scal_vect")
         (rewrite "matrix_props.length_row" 1)
         (rewrite "matrix_props.length_row" 1))))))))


proof_type: t_proof
decl_type: tcc
library: matrices
theory: matrix_upper_triang
signature: nil
run_date: Unknown date
run_time: ----
status: proved-incomplete
description: nil
script:
  (""
   (skeep)
   (skeep)
   (rewrite "lex3_lt_2")
   (("1"
     (hide 7)
     (flatten)
     (rewrite "length_add_vect_same")
     (("1"
       (rewrite "matrix_props.length_row")
       (typepred "i")
       (typepred "j")
       (expand "ut_point1")
       (expand "ut_point2")
       (flatten)
       (assert))
      ("2"
       (rewrite "length_scal_vect")
       (rewrite "matrix_props.length_row")
       (rewrite "matrix_props.length_row")
       (typepred "i")
       (typepred "j")
       (expand "ut_point1")
       (expand "ut_point2")
       (flatten)
       (assert))))
    ("2"
     (rewrite "length_add_vect_same")
     (("1"
       (rewrite "matrix_props.length_row")
       (typepred "i")
       (typepred "j")
       (expand "ut_point1")
       (expand "ut_point2")
       (flatten)
       (assert))
      ("2"
       (rewrite "length_scal_vect")
       (rewrite "matrix_props.length_row")
       (rewrite "matrix_props.length_row")
       (typepred "i")
       (typepred "j")
       (expand "ut_point1")
       (expand "ut_point2")
       (flatten)
       (assert))))
    ("3"
     (assert)
     (case "i = 0")
     (("1" (typepred "i") (expand "ut_point2") (propax)) ("2" (assert))))
    ("4" (typepred "j") (assert) (expand "ut_point1") (propax))))


proof_type: t_proof
decl_type: tcc
library: matrices
theory: matrix_upper_triang
signature: nil
run_date: Unknown date
run_time: ----
status: proved-incomplete
description: nil
script:
  (""
   (skeep)
   (case "i<pn aND j<pn AND i>j")
   (("1"
     (flatten)
     (case "NOT (null?(S) OR null?(Q) OR null?(R))")
     (("1"
       (flatten)
       (skeep)
       (case "NOT length(row(S)(i) + pivnum * row(S)(j)) = pn")
       (("1"
         (hide 11)
         (rewrite "length_add_vect")
         (rewrite "length_scal_vect")
         (rewrite "length_row")
         (("1"
           (rewrite "length_row")
           (("1" (expand "max") (assert))
            ("2" (rewrite "length_rows") (assert))))
          ("2" (rewrite "length_rows") (assert))))
        ("2"
         (case "NOT length(row(Q)(i) + pivnum * row(Q)(j)) = pn")
         (("1"
           (hide 11)
           (rewrite "length_add_vect")
           (rewrite "length_scal_vect")
           (rewrite "length_row")
           (("1"
             (rewrite "length_row")
             (("1" (expand "max") (assert))
              ("2" (rewrite "length_rows") (assert))))
            ("2" (rewrite "length_rows") (assert))))
          ("2"
           (name "GG"
                 "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"
             (replaces -1)
             (typepred "GG")
             (assert)
             (flatten)
             (assert)
             (split 10)
             (("1" (propax)) ("2" (propax))
              ("3" (replace -4) (rewrite "det_replace_row_sum_scal"))))
            ("2" (hide 11) (rewrite "lex3_lt_2"))
            ("3" (hide 11) (assert))
            ("4"
             (hide 11)
             (assert)
             (typepred "i")
             (typepred "j")
             (expand "ut_point1")
             (expand "ut_point2")
             (assert)
             (rewrite "rows_replace_row")
             (assert)
             (skeep)
             (rewrite "entry_replace_row")
             (lift-if)
             (assert)
             (split 1)
             (("1"
               (flatten)
               (rewrite "access_sum")
               (rewrite "access_scal")
               (rewrite "access_row")
               (rewrite "access_row")
               (inst-cp - "i" "j")
               (inst - "j")
               (assert))
              ("2"
               (flatten)
               (inst - "k!1" "j")
               (inst - "k!1")
               (assert))))
            ("5"
             (hide 11)
             (typepred "j")
             (typepred "i")
             (expand "ut_point1")
             (expand "ut_point2")
             (flatten)
             (assert)
             (rewrite "rows_replace_row")
             (assert)
             (skeep)
             (rewrite "entry_replace_row")
             (lift-if)
             (split 1)
             (("1"
               (flatten)
               (rewrite "access_sum")
               (rewrite "access_scal")
               (rewrite "access_row")
               (rewrite "access_row")
               (assert)
               (inst-cp - "i" "p")
               (inst - "j" "p")
               (assert)
               (inst - "i")
               (assert))
              ("2" (flatten) (inst - "k!1" "p") (assert))))
            ("6"
             (hide 11)
             (flatten)
             (assert)
             (lemma "mult_Easr_left")
             (inst - "Q" "i" "j" "pn" "pivnum")
             (assert)
             (replaces -1 :dir rl)
             (lemma "mult_Easr_left")
             (inst - "S" "i" "j" "pn" "pivnum")
             (assert)
             (replaces -1 :dir rl)
             (rewrite "matrix_mult_assoc")
             (typepred "T")
             (assert))
            ("7"
             (hide 11)
             (flatten)
             (assert)
             (replace 1)
             (rewrite "Id_simple_prod"))
            ("8"
             (hide 11)
             (flatten)
             (assert)
             (split 1)
             (("1"
               (rewrite "mult_simple_prod")
               (rewrite "Easr_simple_prod"))
              ("2"
               (lemma "mult_Easr_left")
               (inst - "Q" "i" "j" "pn" "pivnum")
               (assert)
               (replaces -1 :dir rl)
               (rewrite "matrix_mult_assoc")
               (("1"
                 (rewrite "matrix_mult_assoc" :dir rl)
                 (("1"
                   (rewrite "mult_Easr_Easr_inv")
                   (rewrite "mult_Id_left")
                   (typepred "R")
                   (assert))
                  ("2" (rewrite "Easr_null"))))
                ("2" (rewrite "Easr_null"))))
              ("3"
               (lemma "mult_Easr_left")
               (inst - "Q" "i" "j" "pn" "pivnum")
               (assert)
               (replaces -1 :dir rl)
               (rewrite "matrix_mult_assoc")
               (rewrite "matrix_mult_assoc" :dir rl)
               (typepred "R")
               (assert)
               (flatten)
               (replace -9)
               (rewrite "mult_Id_left")
               (rewrite "mult_Easr_Easr_inv"))
              ("4" (rewrite "rows_mult") (assert))
              ("5"
               (rewrite "rows_mult")
               (rewrite "columns_mult")
               (assert))
              ("6" (rewrite "rows_mult") (assert))
              ("7" (rewrite "columns_mult") (assert))))
            ("9" (hide 11) (flatten) (rewrite "Id_simple_prod"))
            ("10"
             (hide 11)
             (flatten)
             (assert)
             (rewrite "rows_replace_row")
             (rewrite "columns_replace_row")
             (assert)
             (lemma "mult_Easr_left")
             (inst?)
             (inst - "pn")
             (assert)
             (replaces -1 :dir rl)
             (rewrite "mult_simple_prod")
             (rewrite "Easr_simple_prod"))
            ("11" (hide 11) (assert))
            ("12"
             (hide 11)
             (rewrite "rows_replace_row")
             (rewrite "columns_replace_row")
             (assert))
            ("13" (hide 11) (assert))))))))
      ("2"
       (hide 6)
       (label "igz" -1)
       (typepred "S")
       (typepred "Q")
       (typepred "R")
       (expand "rows")
       (expand "length")
       (split "igz")
       (("1" (assert)) ("2" (assert)) ("3" (assert))))))
    ("2"
     (hide 7)
     (typepred "i")
     (typepred "j")
     (expand "ut_point2")
     (expand "ut_point1")
     (flatten)
     (assert))))


proof_type: f_proof
decl_type: formula
library: matrices
theory: linear_dependence
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skeep)
   (split 1)
   (("1" (expand "rows") (ground) (grind))
    ("2" (expand "zerow") (grind))))


proof_type: f_proof
decl_type: formula
library: matrices
theory: linear_dependence
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skeep)
   (expand "zecolumn")
   (rewrite "rows_transpose")
   (rewrite "columns_transpose")
   (lemma "zerow_dim")
   (inst?)
   (ground))


proof_type: f_proof
decl_type: formula
library: matrices
theory: linear_dependence
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skeep)
   (typepred (A))
   (split 1)
   (("1" (grind))
    ("2"
     (typepred "row2mat(A, j)")
     (lemma "matrices.length_row")
     (inst-cp -1 "A" "j")
     (split -2)
     (("1"
       (replace -1 :dir rl)
       (typepred "columns(row2mat(A,j))")
       (split -2)
       (("1" (flatten) (ground))
        ("2"
         (skeep)
         (case "i=0")
         (("1" (replace -1) (replace -2 :dir rl) (grind))
          ("2" (typepred (i)) (hide-all-but (-1 1)) (ground) (grind))))))
      ("2" (typepred (j)) (hide-all-but (-1 1)) (grind))))))


proof_type: f_proof
decl_type: formula
library: matrices
theory: linear_dependence
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: alt-proof
script:
  (""
   (case "FORALL (n:nat, A,M: PosFullMatrix, f, g: [nat -> real], j: below(rows(A))):
                                      n=j IMPLIES ((FORALL (k: subrange(0, j)): f(k) = g(k)) IMPLIES
                                       sum_rows(A, f, j, M) =
                                        sum_rows(A, g, j, M))")
   (("1"
     (skeep)
     (inst -1 "j" "A" "M" "f" "g" "j")
     (split -1)
     (("1" (propax)) ("2" (propax))))
    ("2"
     (hide 2)
     (induct "n")
     (("1"
       (skeep)
       (replace -1 :dir rl)
       (expand "sum_rows")
       (inst -2 "0")
       (replace -2)
       (propax))
      ("2"
       (skeep)
       (skeep)
       (expand "sum_rows" 1)
       (lift-if 1)
       (split 1)
       (("1" (flatten) (inst -4 "j") (replace -4) (propax))
        ("2"
         (flatten)
         (inst-cp -3 "j")
         (replace -4)
         (inst -1 "A" "M + g(j) * row2mat(A, j)" "f" "g" "j-1")
         (("1"
           (split -1)
           (("1" (propax)) ("2" (skeep) (inst -2 "k")) ("3" (ground))))
          ("2" (ground))))))))))


proof_type: f_proof
decl_type: formula
library: matrices
theory: linear_dependence
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (case "FORALL (n:nat, A, M, N: PosFullMatrix, f: [nat -> real], j: below(rows(A))):
                 n=j IMPLIES
                 sum_rows(A, f, j, M + N) = sum_rows(A, f, j, M) + N")
   (("1" (skeep) (inst -1 "j" "A" "M" "N" "f" "j"))
    ("2"
     (hide 2)
     (induct "n")
     (("1"
       (skeep)
       (replace -1 :dir rl)
       (expand "sum_rows")
       (ground)
       (lemma "matrix_add_comm")
       (inst -1 "N" "f(0) * row2mat(A, 0)")
       (ground)
       (rewrite "matrix_add_assoc" 1)
       (rewrite "matrix_add_assoc" 1)
       (ground))
      ("2"
       (skeep)
       (skeep)
       (expand "sum_rows" 1)
       (lift-if 1)
       (split 1)
       (("1" (flatten) (ground))
        ("2"
         (flatten)
         (hide -2)
         (rewrite "matrix_add_assoc" 2)
         (rewrite "matrix_add_comm" (2 2))
         (rewrite "matrix_add_assoc" 2 :dir rl)
         (inst -1 "A" "M + f(j) * row2mat(A, j)" "N" "f" "j-1")
         (("1" (split -1) (("1" (propax)) ("2" (reveal -2) (ground))))
          ("2" (ground))))))
      ("3"
       (hide 2)
       (skeep)
       (splash +)
       (("1" (rewrite "columns_add") (ground))
        ("2" (rewrite "rows_add") (ground))
        ("3"
         (flatten)
         (skeep)
         (typepred "M+N")
         (inst-cp - "i")
         (inst - "j_1")
         (ground))))))
    ("3"
     (skeep)
     (typepred "M + N")
     (split 1)
     (("1" (flatten) (skeep) (inst-cp -3 "i") (inst-cp - "j_1") (ground))
      ("2" (ground) (rewrite "rows_add") (ground))
      ("3" (rewrite "columns_add") (ground))))))


proof_type: f_proof
decl_type: formula
library: matrices
theory: linear_dependence
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skeep)
   (typepred "f(j) * row2mat(A, j) - f(j) * row2mat(A, j)")
   (typepred "0 * row2mat(A, j)")
   (lemma "matrix2array" ("SM" "0*row2mat(A,j)"))
   (("1"
     (replace -1 1)
     (hide -1)
     (lemma "matrix2array"
      ("SM" "(f(j) * row2mat(A, j) - f(j) * row2mat(A, j))"))
     (("1"
       (replace -1 1)
       (hide -1)
       (rewrite "rows_sub")
       (rewrite "columns_sub")
       (expand "max")
       (rewrite "rows_scal")
       (rewrite "rows_scal")
       (rewrite "columns_scal")
       (rewrite "columns_scal")
       (lemma "form_matrix_eq")
       (inst?)
       (flatten)
       (hide -1)
       (split -1)
       (("1" (propax))
        ("2" (skeep) (inst -6 "i" "j_1") (inst -10 "i" "j_1") (ground))))
      ("2" (flatten) (skeep) (inst-cp -7 "i") (inst -7 "j_1") (ground))))
    ("2"
     (flatten)
     (ground)
     (skeep)
     (inst-cp -3 "i")
     (inst -3 "j_1")
     (ground))))


proof_type: f_proof
decl_type: formula
library: matrices
theory: linear_dependence
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (case "FORALL (n:nat, A, M: PosFullMatrix, f: [nat -> real], j: below(rows(A)),
                       k: below(1 + j)):
                 n=j IMPLIES
                 sum_rows(A, f WITH [k := 0], j, M) =
                  sum_rows(A, f, j, M) - f(k) * row2mat(A, k)")
   (("1" (skeep) (inst -1 "j" "A" "M" "f" "j" "k"))
    ("2"
     (hide 2)
     (induct "n")
     (("1"
       (skeep)
       (replace -1 :dir rl)
       (expand "sum_rows")
       (typepred (k))
       (case-replace "k=0")
       (("1"
         (simplify 1)
         (expand "-")
         (expand "sub")
         (rewrite "matrix_add_assoc" 1)
         (lemma "subtract_same_scal")
         (inst?)
         (expand "-")
         (expand "sub")
         (ground))
        ("2" (ground))))
      ("2"
       (skeep)
       (skeep)
       (expand "sum_rows" 1)
       (lift-if 1)
       (split 1)
       (("1" (flatten) (ground))
        ("2"
         (flatten)
         (split 2)
         (("1"
           (flatten)
           (lemma "sum_rows_eq")
           (inst -1 "A" "M + 0 * row2mat(A, j)" "f WITH [k := 0]" "f"
            "j-1")
           (("1"
             (split -1)
             (("1"
               (replace -1)
               (replace -2 1 :dir rl)
               (expand "-" 1)
               (expand "sub")
               (rewrite "sum_rows_add_start" 1 :dir rl)
               (("1"
                 (rewrite "matrix_add_assoc" 1)
                 (lemma "subtract_same_scal")
                 (inst -1 "A" "f" "j")
                 (expand "-")
                 (expand "sub")
                 (replace -1)
                 (propax))
                ("2"
                 (hide (2 3))
                 (splash +)
                 (("1"
                   (flatten)
                   (typepred "-1 * (f(j) * row2mat(A, j))")
                   (skeep)
                   (inst-cp - "i")
                   (inst - "j_1!1")
                   (ground))
                  ("2"
                   (rewrite "columns_scal")
                   (rewrite "columns_scal")
                   (lemma "row2mat_dim")
                   (inst?)
                   (ground))
                  ("3"
                   (rewrite "rows_scal")
                   (rewrite "rows_scal")
                   (lemma "row2mat_dim")
                   (inst?)
                   (ground))
                  ("4"
                   (flatten)
                   (typepred "-1 * (f(j) * row2mat(A, j))")
                   (skeep)
                   (inst-cp - "i")
                   (inst - "j_1!1")
                   (ground))))))
              ("2"
               (skeep)
               (typepred (k_1))
               (ground)
               (replace -3)
               (ground))))
            ("2" (ground))))
          ("2"
           (flatten)
           (inst?)
           (("1" (split -1) (("1" (propax)) ("2" (ground))))
            ("2" (ground)) ("3" (ground))))))))))))


proof_type: f_proof
decl_type: formula
library: matrices
theory: linear_dependence
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (expand "sum_rows")
   (skeep)
   (lemma "sum_lem_prep")
   (inst -1 "A" "zerow(columns(A))" "f" "rows(A)-1" "j"))


proof_type: f_proof
decl_type: formula
library: matrices
theory: linear_dependence
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skeep)
   (expand "row_dependent")
   (rewrite "sum_lem")
   (typepred (f))
   (replace -1)
   (replace -2)
   (typepred "(zerow(columns(A)) - -1 * row2mat(A, j))")
   (case-replace
    "(zerow(columns(A)) - -1 * row2mat(A, j)) = row2mat(A,j)")
   (hide 2)
   (lemma "matrix2array"
    ("SM" "(zerow(columns(A)) - -1 * row2mat(A, j))"))
   (("1"
     (replace -1 1)
     (hide -1)
     (lemma "matrix2array" ("SM" "row2mat(A,j)"))
     (name-replace "FMB"
      "form_matrix(entry((zerow(columns(A)) - -1 * row2mat(A, j))),
                        rows((zerow(columns(A)) - -1 * row2mat(A, j))),
                        columns((zerow(columns(A)) - -1 * row2mat(A, j))))")
     (replace -1 1)
     (hide -1)
     (expand "FMB")
     (rewrite "rows_sub")
     (rewrite "columns_sub")
     (rewrite "rows_scal")
     (rewrite "columns_scal")
     (lemma "zerow_dim")
     (inst -1 "columns(A)")
     (flatten)
     (replace -1)
     (replace -2)
     (lemma "row2mat_dim")
     (inst -1 "A" "j")
     (flatten)
     (replace -1)
     (replace -2)
     (expand "max" 1)
     (rewrite "form_matrix_eq")
     (skeep)
     (inst -10 "i" "j_1")
     (replace -10)
     (case-replace "entry(zerow(columns(A)))(i,j_1) = 0")
     (("1"
       (simplify 1)
       (typepred "-1 * entry(-1 * row2mat(A, j))(i, j_1)")
       (typepred "-1 * row2mat(A, j)")
       (inst -4 "i" "j_1")
       (replace -4)
       (ground))
      ("2"
       (hide 2)
       (case-replace "i=0")
       (("1"
         (case "row(zerow(columns(A)))(0) = zero(columns(A))")
         (("1" (expand "entry") (replace -1) (rewrite "access_zero"))
          ("2"
           (expand "row")
           (expand "zerow")
           (lift-if 1)
           (split 1)
           (("1" (flatten) (ground))
            ("2" (flatten) (ground) (expand "nth") (propax))))))
        ("2" (ground))))))
    ("2"
     (flatten)
     (ground)
     (skeep)
     (inst-cp -3 "i")
     (inst -3 "j_1")
     (ground))))


proof_type: t_proof
decl_type: tcc
library: matrices
theory: linear_dependence
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skeep)
   (splash +)
   (("1" (grind)) ("2" (grind))
    ("3"
     (flatten)
     (skeep)
     (case "i=0")
     (("1" (case "j=0") (("1" (grind)) ("2" (typepred (j)) (grind))))
      ("2" (grind) (typepred (i)) (grind))))))


proof_type: t_proof
decl_type: tcc
library: matrices
theory: linear_dependence
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skeep)
   (splash)
   (("1"
     (typepred (A))
     (expand "columns")
     (ground)
     (expand "columns")
     (ground)
     (case "length(row(A)(j)) = columns(A)")
     (("1" (ground))
      ("2"
       (ground)
       (rewrite "length_row")
       (typepred (j))
       (expand "rows")
       (propax))))
    ("2" (ground) (grind))
    ("3"
     (flatten)
     (skeep)
     (case "i=0")
     (("1"
       (case-replace "j_1=0")
       (("1" (replace -2) (propax)) ("2" (typepred (j_1)) (ground))))
      ("2" (typepred (i)) (ground))))))


proof_type: t_proof
decl_type: tcc
library: matrices
theory: linear_dependence
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skeep)
   (splash +)
   (("1" (rewrite "columns_add") (rewrite "columns_scal") (ground))
    ("2" (rewrite "rows_add") (rewrite "rows_scal") (ground))
    ("3"
     (flatten)
     (typepred "(M + f(j) * row2mat(A, j))")
     (skeep)
     (inst-cp - "i")
     (inst - "j_1")
     (ground))))


proof_type: t_proof
decl_type: tcc
library: matrices
theory: linear_dependence
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skeep)
   (splash +)
   (("1" (rewrite "columns_add") (ground))
    ("2" (rewrite "rows_add") (ground))
    ("3"
     (flatten)
     (typepred "(M + N)")
     (skeep)
     (inst-cp - "i")
     (inst - "j_1")
     (ground))))


proof_type: f_proof
decl_type: formula
library: matrices
theory: matrix_diag
signature: nil
run_date: Unknown date
run_time: ----
status: proved-incomplete
description: nil
script:
  (""
   (skeep)
   (name "DD" "diag(comp_matrix, comp_inverse, S)")
   (replaces -1)
   (typepred "DD")
   (assert)
   (hide -6)
   (name "AA" "DD`ans")
   (replaces -1)
   (name "QQ" "DD`multip")
   (replaces -1)
   (assert)
   (lemma "det_upper_triangular_zero")
   (inst - "AA")
   (assert)
   (case "EXISTS (i): i<rows(AA) AND entry(AA)(i,i)=0 AND (FORALL (j): j<rows(AA) AND j>i IMPLIES entry(AA)(j,j)/=0)")
   (("1"
     (hide -2)
     (skeep -1)
     (inst + "i")
     (assert)
     (skeep 2)
     (case "NOT j < rows(S)")
     (("1" (assert) (rewrite "entry_eq_0" 3))
      ("2"
       (assert)
       (case "j = i")
       (("1" (assert))
        ("2"
         (case "j < i")
         (("1" (expand "upper_triangular?") (inst - "i" "j") (assert))
          ("2"
           (inst - "j")
           (assert)
           (flatten)
           (inst - "i" "j")
           (assert))))))))
    ("2"
     (hide (2 3))
     (case "FORALL (k): LET z = rows(AA)-1-k IN (k<=rows(AA)-1 AND (EXISTS (i): i<rows(AA) AND i>=z AND entry(AA)(i,i)=0)) IMPLIES (EXISTS (i): i<rows(AA) AND i>=z AND entry(AA)(i,i)=0 AND (FORALL (j): j<rows(AA) AND j>i IMPLIES entry(AA)(j,j)/=0))")
     (("1" (inst - "rows(AA)-1") (assert) (replace -2) (propax))
      ("2"
       (hide 2)
       (hide -1)
       (induct "k")
       (("1" (assert) (ground)) ("2" (assert)) ("3" (assert) (ground))
        ("4" (assert))
        ("5" (skosimp*) (inst + "i!1") (assert) (skosimp*) (assert))
        ("6"
         (skolem 1 "k")
         (assert)
         (flatten)
         (assert)
         (skosimp*)
         (case "NOT i!1 = rows(AA)-2-k")
         (("1"
           (split -1)
           (("1" (assert) (skosimp*) (inst + "i!2") (assert))
            ("2" (hide 3) (inst + "i!1") (assert))))
          ("2"
           (case "(EXISTS (i):
                                         i < rows(AA) AND i >= rows(AA) - 1 - k AND entry(AA)(i, i) = 0)")
           (("1"
             (assert)
             (replace -1)
             (assert)
             (skosimp -3)
             (inst + "i!2")
             (assert))
            ("2"
             (inst 2 "i!1")
             (assert)
             (skosimp 2)
             (inst + "j!1")
             (assert))))))))))))


proof_type: f_proof
decl_type: formula
library: matrices
theory: matrix_diag
signature: nil
run_date: Unknown date
run_time: ----
status: proved-incomplete
description: nil
script:
  (""
   (skeep)
   (name "DD" "diag(true, true, S)")
   (label "DDname" -1)
   (typepred "DD")
   (name "QQ" "DD`multip")
   (replaces -1)
   (assert)
   (name "AA" "DD`ans")
   (lemma "diag_det_zero_row")
   (inst - "S" "true" "true")
   (replace -2)
   (assert)
   (replace "DDname")
   (replace -2)
   (label "sz" -1)
   (hide "sz")
   (hide -1)
   (name "II" "DD`inv")
   (replaces -1)
   (case "NOT S = II*AA")
   (("1"
     (case "NOT II*(QQ*S)=II*AA")
     (("1" (assert))
      ("2"
       (rewrite "matrix_mult_assoc" -1 :dir rl)
       (("1" (replace -6) (rewrite "mult_Id_left"))
        ("2"
         (typepred "QQ")
         (expand "rows")
         (expand "length")
         (assert))))))
    ("2"
     (case "det(AA*R)=det(AA)*det(R)")
     (("1"
       (replace -2 1)
       (rewrite "matrix_mult_assoc" 1)
       (("1"
         (rewrite "det_mult_simple_prod_left" 1)
         (("1"
           (lemma "det_mult_simple_prod_left")
           (inst - "rows(S)" "II" "AA")
           (assert))
          ("2"
           (rewrite "rows_mult")
           (rewrite "columns_mult")
           (("1" (assert))
            ("2"
             (typepred "AA")
             (expand "rows")
             (expand "length")
             (assert))))))
        ("2"
         (typepred "AA")
         (expand "rows")
         (expand "length")
         (assert))))
      ("2"
       (hide 2)
       (case "det(AA)=0")
       (("1"
         (replace -1)
         (assert)
         (hide 2)
         (reveal "sz")
         (assert)
         (lemma "det_replace_row_scal")
         (skeep -2)
         (inst - "AA*R" "i" "0" "zero(rows(S))")
         (("1"
           (case "AA*R = replace_row(i, 0 * zero(rows(S)))(AA * R)")
           (("1"
             (assert)
             (rewrite "columns_mult" 1)
             (("1" (assert) (rewrite "rows_mult" 1) (assert))
              ("2"
               (typepred "AA")
               (expand "rows")
               (expand "length")
               (assert))))
            ("2"
             (assert)
             (hide -1)
             (rewrite "full_matrix_eq" 1)
             (skosimp*)
             (case "NOT (i!1 < rows(S) AND j!1 < rows(S))")
             (("1"
               (typepred "i!1")
               (typepred "j!1")
               (rewrite "columns_mult")
               (("1" (rewrite "rows_mult") (assert))
                ("2"
                 (typepred "AA")
                 (expand "rows")
                 (expand "length")
                 (assert))))
              ("2"
               (flatten)
               (rewrite "entry_replace_row")
               (("1"
                 (lift-if)
                 (split 1)
                 (("1"
                   (flatten)
                   (replace -1)
                   (assert)
                   (rewrite "access_scal")
                   (assert)
                   (case "FORALL (rrrrr:real): 0*rrrrr=0")
                   (("1"
                     (rewrite -1)
                     (hide -1)
                     (rewrite "entry_mult" 1)
                     (expand "*" +)
                     (rewrite "dot_eq_sigma" 1)
                     (rewrite "sigma_restrict_eq_0")
                     (hide 2)
                     (skosimp*)
                     (rewrite "access_row")
                     (inst - "i!2")
                     (assert))
                    ("2" (assert))))
                  ("2" (propax))))
                ("2"
                 (rewrite "columns_mult")
                 (("1" (rewrite "length_scal_vect") (assert))
                  ("2"
                   (typepred "AA")
                   (expand "rows")
                   (expand "length")
                   (assert))))))))
            ("3"
             (rewrite "columns_mult" 1)
             (("1" (rewrite "rows_mult" 1) (assert))
              ("2"
               (typepred "AA")
               (expand "rows")
               (expand "length")
               (assert))))))
          ("2"
           (rewrite "rows_mult")
           (rewrite "columns_mult")
           (("1" (assert))
            ("2"
             (typepred "AA")
             (expand "rows")
             (expand "length")
             (assert))))))
        ("2"
         (name "isdiag"
               "LAMBDA (k): (LAMBDA (SQ): (FORALL (i): i<rows(SQ) AND i>=k IMPLIES entry(SQ)(i,i)=1) AND (FORALL (i,j): i<rows(SQ) AND j<rows(SQ) AND entry(SQ)(i,j)/=0 IMPLIES i=j))")
         (case "FORALL (k,SQ,DQ): k<=rows(SQ) AND isdiag(k)(SQ) AND rows(SQ)=rows(DQ) IMPLIES det(SQ*DQ)=det(SQ)*det(DQ)")
         (("1"
           (inst - "rows(AA)" "AA" "R")
           (assert)
           (hide -1)
           (expand "isdiag")
           (split 1)
           (("1" (skosimp*) (assert))
            ("2"
             (skeep)
             (lemma "det_upper_triangular_zero")
             (inst - "AA")
             (assert)
             (inst - "i" "j")
             (assert)
             (flatten)
             (inst + "j")
             (assert))))
          ("2"
           (hide-all-but 1)
           (induct "k")
           (("1"
             (skeep)
             (case "SQ = Id(rows(SQ))")
             (("1"
               (replace -1)
               (rewrite "mult_Id_left")
               (rewrite "det_Id")
               (assert))
              ("2"
               (rewrite "full_matrix_eq")
               (assert)
               (skeep)
               (typepred "i")
               (typepred "j")
               (assert)
               (rewrite "entry_Id")
               (expand "isdiag")
               (flatten)
               (lift-if)
               (split 1)
               (("1" (flatten) (inst - "i" "j") (assert))
                ("2" (flatten) (inst - "i") (assert))))))
            ("2"
             (skeep)
             (assert)
             (skeep)
             (assert)
             (name "rr" "entry(SQ)(j,j)")
             (name "newSQ"
                   "form_matrix(lambda (k,p): IF k=p AND k<j THEN entry(SQ)(k,k) ELSIF k=p THEN 1 ELSE 0 ENDIF,rows(SQ),columns(SQ))")
             (case "SQ = Esr(rows(SQ))(j,rr)*newSQ")
             (("1"
               (replace -1 +)
               (rewrite "matrix_mult_assoc")
               (("1"
                 (rewrite "mult_Esr_left")
                 (("1"
                   (rewrite "mult_Esr_left")
                   (("1"
                     (rewrite "det_replace_row_scal")
                     (("1"
                       (rewrite "det_replace_row_scal")
                       (("1"
                         (rewrite "replace_row_id")
                         (("1"
                           (rewrite "replace_row_id")
                           (inst - "newSQ" "DQ")
                           (("1"
                             (assert)
                             (hide 2)
                             (expand "isdiag")
                             (flatten)
                             (case "rows(newSQ)=rows(SQ) AND columns(newSQ)=columns(SQ)")
                             (("1"
                               (flatten)
                               (assert)
                               (split +)
                               (("1"
                                 (skeep)
                                 (expand "newSQ" +)
                                 (rewrite "entry_form_matrix")
                                 (assert))
                                ("2"
                                 (skosimp*)
                                 (expand "newSQ" 1)
                                 (rewrite "entry_form_matrix")
                                 (assert))))
                              ("2" (hide 2) (expand "newSQ") (propax))))
                            ("2" (assert))))
                          ("2" (rewrite "rows_mult" 1) (assert))))
                        ("2" (rewrite "length_row"))))
                      ("2"
                       (rewrite "length_row")
                       (rewrite "columns_mult")
                       (("1" (rewrite "rows_mult") (assert))
                        ("2"
                         (typepred "newSQ")
                         (expand "rows")
                         (propax))))
                      ("3" (rewrite "rows_mult") (assert))))
                    ("2" (rewrite "rows_mult") (assert))
                    ("3"
                     (rewrite "rows_mult")
                     (rewrite "columns_mult")
                     (("1" (assert))
                      ("2"
                       (typepred "newSQ")
                       (lemma "rows_form_matrix")
                       (inst?)
                       (expand "rows" -1 1)
                       (assert)
                       (case "NOT rows(SQ) = 0")
                       (("1" (replace -8) (expand "length" -3) (assert))
                        ("2" (assert))))))))
                  ("2" (expand "newSQ") (rewrite "rows_form_matrix"))
                  ("3"
                   (split 1)
                   (("1"
                     (assert)
                     (expand "newSQ" 1)
                     (rewrite "rows_form_matrix")
                     (assert))
                    ("2"
                     (expand "newSQ" 1)
                     (assert)
                     (lemma "columns_form_matrix")
                     (inst?)
                     (assert))))))
                ("2"
                 (typepred "newSQ")
                 (lemma "rows_form_matrix")
                 (inst?)
                 (expand "length" -3 1)
                 (assert))))
              ("2"
               (hide -1)
               (rewrite "full_matrix_eq" 1)
               (assert)
               (split 1)
               (("1" (rewrite "rows_mult") (rewrite "rows_Esr"))
                ("2"
                 (rewrite "columns_mult")
                 (("1"
                   (expand "newSQ" 1)
                   (lemma "columns_form_matrix")
                   (inst?)
                   (assert))
                  ("2"
                   (typepred "Esr(rows(SQ))(j,rr)")
                   (expand "rows" -3 1)
                   (expand "length")
                   (assert))))
                ("3"
                 (skosimp*)
                 (rewrite "mult_Esr_left")
                 (("1"
                   (rewrite "entry_replace_row")
                   (("1"
                     (rewrite "access_scal")
                     (lift-if)
                     (split 1)
                     (("1"
                       (flatten)
                       (replace -2)
                       (assert)
                       (rewrite "access_row")
                       (expand "newSQ" 1)
                       (rewrite "entry_form_matrix")
                       (assert)
                       (copy -6)
                       (expand "isdiag" -1)
                       (flatten)
                       (lift-if)
                       (split 1)
                       (("1" (flatten) (replace -1 :dir rl) (assert))
                        ("2" (flatten) (inst - "j" "j!1") (assert))))
                      ("2"
                       (flatten)
                       (expand "newSQ" +)
                       (rewrite "rows_form_matrix")
                       (rewrite "entry_form_matrix")
                       (lift-if)
                       (lift-if)
                       (lift-if)
                       (assert)
                       (split 2)
                       (("1" (propax))
                        ("2"
                         (flatten)
                         (split 2)
                         (("1"
                           (flatten)
                           (replaces -1)
                           (assert)
                           (copy -4)
                           (expand "isdiag" -1)
                           (flatten)
                           (inst - "j!1")
                           (assert))
                          ("2"
                           (flatten)
                           (copy -4)
                           (expand "isdiag" -1)
                           (flatten)
                           (inst - "i!1" "j!1")
                           (assert))))))))
                    ("2"
                     (expand "newSQ" 1)
                     (lemma "columns_form_matrix")
                     (inst?)
                     (assert)
                     (replaces -1)
                     (rewrite "length_scal_vect")
                     (rewrite "length_row")
                     (rewrite "rows_form_matrix")
                     (assert))))
                  ("2" (expand "newSQ" 1) (rewrite "rows_form_matrix"))
                  ("3"
                   (expand "newSQ" 1)
                   (rewrite "rows_form_matrix")
                   (assert)
                   (lemma "columns_form_matrix")
                   (inst?)
                   (assert))))))))))))))))))


proof_type: t_proof
decl_type: tcc
library: matrices
theory: matrix_diag
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skeep)
   (assert)
   (split +)
   (("1" (typepred "T") (propax))
    ("2"
     (flatten)
     (typepred "i")
     (typepred "j")
     (expand "d_point2")
     (flatten)
     (expand "d_point1")
     (flatten)
     (replace -6)
     (replace -7)
     (assert)
     (skosimp*)
     (inst - "k!1" "p!1")
     (ground))
    ("3" (typepred "T") (propax)) ("4" (typepred "R") (propax))
    ("5" (typepred "R") (propax)) ("6" (typepred "Q") (propax))))


proof_type: t_proof
decl_type: tcc
library: matrices
theory: matrix_diag
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skeep)
   (case "i = j")
   (("1"
     (hide -2)
     (case "j = 0")
     (("1" (ground))
      ("2"
       (assert)
       (typepred "j")
       (expand "d_point1")
       (hide 3)
       (flatten)
       (assert)
       (skeep)
       (case "NOT p = j")
       (("1" (assert) (inst - "k!1" "p") (ground))
        ("2"
         (assert)
         (replace -1)
         (assert)
         (typepred "i")
         (expand "d_point2")
         (inst - "k!1")
         (ground))))))
    ("2"
     (assert)
     (case "j = 0")
     (("1"
       (replace -1)
       (assert)
       (typepred "i")
       (expand "d_point2")
       (propax))
      ("2"
       (assert)
       (expand "d_point1")
       (typepred "j")
       (expand "d_point1")
       (flatten)
       (assert)
       (skeep)
       (case "NOT k!1 = p")
       (("1" (inst - "k!1" "p") (ground))
        ("2" (replace -1) (assert))))))))


proof_type: t_proof
decl_type: tcc
library: matrices
theory: matrix_diag
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skeep)
   (typepred "j")
   (typepred "i")
   (expand "d_point2")
   (assert)
   (typepred "i")
   (expand "d_point2")
   (propax))


proof_type: t_proof
decl_type: tcc
library: matrices
theory: matrix_diag
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skeep)
   (rewrite "lex2_lt")
   (("1" (typepred "i") (expand "d_point2") (propax))
    ("2"
     (assert)
     (typepred "j")
     (typepred "i")
     (expand "d_point2")
     (propax))))


proof_type: t_proof
decl_type: tcc
library: matrices
theory: matrix_diag
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skeep)
   (typepred "i")
   (expand "d_point2")
   (assert)
   (flatten)
   (assert)
   (case "i = rows(S)-1")
   (("1"
     (typepred "i")
     (typepred "j")
     (expand "d_point2")
     (expand "d_point1")
     (ground))
    ("2"
     (assert)
     (skeep)
     (case "NOT k!1 = i")
     (("1" (inst - "k!1") (assert)) ("2" (assert))))))


proof_type: t_proof
decl_type: tcc
library: matrices
theory: matrix_diag
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skeep)
   (assert)
   (rewrite "lex2_lt")
   (("1" (typepred "i") (expand "d_point2") (propax))
    ("2" (typepred "i") (expand "d_point2") (propax))))


proof_type: t_proof
decl_type: tcc
library: matrices
theory: matrix_diag
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skeep)
   (skeep)
   (rewrite "length_add_vect_same")
   (("1"
     (rewrite "length_row")
     (typepred "i")
     (typepred "j")
     (expand "d_point1")
     (expand "d_point2")
     (flatten)
     (assert))
    ("2"
     (rewrite "length_scal_vect")
     (rewrite "length_row")
     (rewrite "length_row")
     (typepred "i")
     (typepred "j")
     (expand "d_point1")
     (expand "d_point2")
     (flatten)
     (assert))))


proof_type: t_proof
decl_type: tcc
library: matrices
theory: matrix_diag
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skeep)
   (skeep)
   (rewrite "rows_replace_row")
   (("1"
     (rewrite "columns_replace_row")
     (("1"
       (assert)
       (expand "upper_triangular?")
       (skosimp*)
       (copy -3)
       (label "igz" -1)
       (hide "igz")
       (rewrite "rows_replace_row")
       (("1"
         (reveal "igz")
         (rewrite "entry_replace_row")
         (("1"
           (lift-if)
           (assert)
           (split 6)
           (("1"
             (flatten)
             (replace -1)
             (typepred "S")
             (hide -2)
             (expand "upper_triangular?")
             (rewrite "access_sum")
             (rewrite "access_scal")
             (rewrite "access_row")
             (rewrite "access_row")
             (inst-cp - "i" "j!1")
             (inst - "j" "j!1")
             (assert)
             (assert)
             (typepred "i")
             (typepred "j")
             (expand "d_point1")
             (expand "d_point2")
             (flatten)
             (assert))
            ("2"
             (flatten)
             (typepred "S")
             (expand "upper_triangular?")
             (inst - "i!1" "j!1")
             (assert))))
          ("2"
           (rewrite "length_add_vect_same")
           (("1"
             (rewrite "length_row")
             (typepred "i")
             (typepred "j")
             (expand "d_point1")
             (expand "d_point2")
             (flatten)
             (assert))
            ("2"
             (rewrite "length_scal_vect")
             (rewrite "length_row")
             (rewrite "length_row")
             (typepred "i")
             (typepred "j")
             (expand "d_point1")
             (expand "d_point2")
             (flatten)
             (assert))))))
        ("2"
         (rewrite "length_add_vect_same")
         (("1"
           (rewrite "length_row")
           (typepred "i")
           (typepred "j")
           (expand "d_point1")
           (expand "d_point2")
           (flatten)
           (assert))
          ("2"
           (rewrite "length_scal_vect")
           (rewrite "length_row")
           (rewrite "length_row")
           (typepred "i")
           (typepred "j")
           (expand "d_point1")
           (expand "d_point2")
           (flatten)
           (assert))))))
      ("2"
       (rewrite "length_add_vect_same")
       (("1"
         (rewrite "length_row")
         (typepred "i")
         (typepred "j")
         (expand "d_point1")
         (expand "d_point2")
         (flatten)
         (assert))
        ("2"
         (rewrite "length_scal_vect")
         (rewrite "length_row")
         (rewrite "length_row")
         (typepred "i")
         (typepred "j")
         (expand "d_point1")
         (expand "d_point2")
         (flatten)
         (assert))))))
    ("2"
     (rewrite "length_add_vect_same")
     (("1"
       (rewrite "length_row")
       (typepred "i")
       (typepred "j")
       (expand "d_point1")
       (expand "d_point2")
       (flatten)
       (assert))
      ("2"
       (rewrite "length_scal_vect")
       (rewrite "length_row")
       (rewrite "length_row")
       (typepred "i")
       (typepred "j")
       (expand "d_point1")
       (expand "d_point2")
       (flatten)
       (assert))))))


proof_type: t_proof
decl_type: tcc
library: matrices
theory: matrix_diag
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skeep)
   (case "i<pn anD j < pn AND i<j")
   (("1"
     (flatten)
     (skeep)
     (case "length(row(Q)(i) + pivnum*row(Q)(j)) = rows(S)")
     (("1"
       (rewrite "rows_replace_row")
       (assert)
       (rewrite "columns_replace_row")
       (assert)
       (lemma "mult_Easr_left")
       (inst?)
       (assert)
       (inst?)
       (assert)
       (replaces -1 :dir rl)
       (rewrite "mult_simple_prod")
       (rewrite "Easr_simple_prod"))
      ("2"
       (assert)
       (hide 7)
       (rewrite "length_add_vect")
       (rewrite "length_scal_vect")
       (rewrite "length_row")
       (rewrite "length_row")
       (expand "max")
       (assert))))
    ("2"
     (hide 7)
     (typepred "i")
     (typepred "j")
     (expand "d_point1")
     (expand "d_point2")
     (flatten)
     (assert))))


proof_type: t_proof
decl_type: tcc
library: matrices
theory: matrix_diag
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skeep)
   (assert)
   (case "i<pn anD j < pn AND i<j")
   (("1"
     (flatten)
     (case "NOT (null?(R) OR null?(S) OR null?(Q))")
     (("1"
       (flatten)
       (assert)
       (skeep)
       (case "length(row(Q)(i) + pivnum*row(Q)(j)) = pn")
       (("1"
         (assert)
         (split 9)
         (("1" (rewrite "mult_simple_prod") (rewrite "Easr_simple_prod"))
          ("2"
           (lemma "mult_Easr_left")
           (inst - "Q" "i" "j" "pn" "pivnum")
           (assert)
           (replaces -1 :dir rl)
           (rewrite "matrix_mult_assoc")
           (("1"
             (rewrite "matrix_mult_assoc" :dir rl)
             (("1"
               (rewrite "mult_Easr_Easr_inv")
               (rewrite "mult_Id_left")
               (assert)
               (typepred "R")
               (assert))
              ("2" (rewrite "Easr_null"))))
            ("2" (rewrite "Easr_null"))))
          ("3"
           (lemma "mult_Easr_left")
           (inst - "Q" "i" "j" "pn" "pivnum")
           (assert)
           (replaces -1 :dir rl)
           (rewrite "matrix_mult_assoc")
           (rewrite "matrix_mult_assoc" :dir rl)
           (typepred "R")
           (assert)
           (flatten)
           (replace -9)
           (rewrite "mult_Id_left")
           (rewrite "mult_Easr_Easr_inv"))
          ("4" (rewrite "rows_mult") (assert))
          ("5" (rewrite "rows_mult") (rewrite "columns_mult") (assert))
          ("6" (rewrite "rows_mult") (assert))
          ("7" (rewrite "columns_mult") (assert))))
        ("2"
         (hide 10)
         (rewrite "length_add_vect")
         (rewrite "length_scal_vect")
         (rewrite "length_row")
         (rewrite "length_row")
         (expand "max")
         (assert))))
      ("2"
       (hide 6)
       (label "igz" -1)
       (typepred "R")
       (typepred "S")
       (typepred "Q")
       (expand "rows")
       (expand "length")
       (split "igz")
       (("1" (assert)) ("2" (assert)) ("3" (assert))))))
    ("2"
     (hide 7)
     (typepred "i")
     (typepred "j")
     (expand "d_point2")
     (expand "d_point1")
     (flatten)
     (assert))))


proof_type: t_proof
decl_type: tcc
library: matrices
theory: matrix_diag
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skeep)
   (skeep)
   (assert)
   (split 6)
   (("1"
     (flatten)
     (assert)
     (lemma "mult_Easr_left")
     (inst-cp - "Q" "i" "j" "pn" "pivnum")
     (inst - "S" "i" "j" "pn" "pivnum")
     (assert)
     (case "i < pn AND j < pn")
     (("1"
       (flatten)
       (assert)
       (replaces -3 :dir rl)
       (replaces -3 :dir rl)
       (rewrite "matrix_mult_assoc")
       (("1" (typepred "T") (assert))
        ("2" (typepred "Q") (expand "rows") (expand "length") (assert))))
      ("2"
       (typepred "i")
       (typepred "j")
       (expand "d_point1")
       (expand "d_point2")
       (flatten)
       (assert))))
    ("2"
     (skosimp*)
     (rewrite "entry_replace_row")
     (("1"
       (lift-if)
       (split 1)
       (("1"
         (flatten)
         (rewrite "access_sum")
         (rewrite "access_scal")
         (assert)
         (typepred "T")
         (inst-cp - "i!1")
         (assert)
         (rewrite "access_row")
         (rewrite "access_row")
         (assert)
         (typepred "S")
         (expand "upper_triangular?")
         (inst - "j" "i!1")
         (assert)
         (typepred "i")
         (expand "d_point2")
         (flatten)
         (assert)
         (case "j < rows(S)")
         (("1" (assert) (assert))
          ("2"
           (hide-all-but 1)
           (typepred "j")
           (expand "d_point1")
           (ground))))
        ("2" (flatten) (typepred "T") (inst - "i!1") (assert))))
      ("2"
       (rewrite "length_add_vect_same")
       (("1"
         (rewrite "length_row")
         (typepred "i")
         (typepred "j")
         (expand "d_point1")
         (expand "d_point2")
         (flatten)
         (assert))
        ("2"
         (rewrite "length_scal_vect")
         (rewrite "length_row")
         (rewrite "length_row")
         (typepred "i")
         (typepred "j")
         (expand "d_point1")
         (expand "d_point2")
         (flatten)
         (assert))))))))


proof_type: t_proof
decl_type: tcc
library: matrices
theory: matrix_diag
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skeep)
   (assert)
   (skeep)
   (typepred "j")
   (expand "d_point1")
   (assert)
   (flatten)
   (assert)
   (skeep)
   (rewrite "entry_replace_row")
   (("1"
     (rewrite "entry_replace_row")
     (("1"
       (lift-if)
       (split 6)
       (("1"
         (assert)
         (flatten)
         (assert)
         (rewrite "access_sum")
         (rewrite "access_scal")
         (rewrite "access_row")
         (rewrite "access_row")
         (inst - "k!1" "p")
         (assert)
         (replace -2)
         (replace -4)
         (assert)
         (typepred "i")
         (expand "d_point2")
         (propax))
        ("2"
         (flatten)
         (assert)
         (split 8)
         (("1"
           (flatten)
           (replace -1)
           (assert)
           (rewrite "access_sum")
           (rewrite "access_scal")
           (rewrite "access_row")
           (rewrite "access_row")
           (assert)
           (inst - "i" "p")
           (assert)
           (replace -3)
           (assert)
           (typepred "j")
           (expand "d_point1")
           (inst - "j" "p")
           (assert)
           (assert))
          ("2"
           (flatten)
           (typepred "j")
           (expand "d_point1")
           (inst - "k!1" "p")
           (assert))))))
      ("2"
       (rewrite "length_add_vect_same")
       (("1"
         (rewrite "length_row")
         (typepred "i")
         (typepred "j")
         (expand "d_point1")
         (expand "d_point2")
         (flatten)
         (assert))
        ("2"
         (rewrite "length_scal_vect")
         (rewrite "length_row")
         (rewrite "length_row")
         (typepred "i")
         (typepred "j")
         (expand "d_point1")
         (expand "d_point2")
         (flatten)
         (assert))))))
    ("2"
     (rewrite "length_add_vect_same")
     (("1"
       (rewrite "length_row")
       (typepred "i")
       (typepred "j")
       (expand "d_point1")
       (expand "d_point2")
       (flatten)
       (assert))
      ("2"
       (rewrite "length_scal_vect")
       (rewrite "length_row")
       (rewrite "length_row")
       (typepred "i")
       (typepred "j")
       (expand "d_point1")
       (expand "d_point2")
       (flatten)
       (assert))))))


proof_type: t_proof
decl_type: tcc
library: matrices
theory: matrix_diag
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skeep)
   (skeep)
   (typepred "i")
   (expand "d_point2")
   (flatten)
   (assert)
   (assert)
   (case "NOT j < pn")
   (("1" (typepred "j") (expand "d_point1") (flatten) (assert))
    ("2"
     (split 6)
     (("1" (rewrite "rows_replace_row") (assert))
      ("2"
       (skeep)
       (case "NOT k!1 = i")
       (("1"
         (inst - "k!1")
         (assert)
         (rewrite "entry_replace_row")
         (("1"
           (rewrite "entry_replace_row" 3)
           (rewrite "length_add_vect_same" 1)
           (("1" (rewrite "length_row"))
            ("2"
             (rewrite "length_scal_vect" 1)
             (rewrite "length_row")
             (rewrite "length_row"))))
          ("2"
           (rewrite "length_add_vect_same" 1)
           (("1" (rewrite "length_row"))
            ("2"
             (rewrite "length_scal_vect" 1)
             (rewrite "length_row")
             (rewrite "length_row"))))))
        ("2"
         (assert)
         (replace -1)
         (assert)
         (rewrite "entry_replace_row" 1)
         (("1"
           (rewrite "entry_replace_row" 2)
           (("1"
             (rewrite "access_sum")
             (rewrite "access_scal")
             (rewrite "access_row")
             (rewrite "access_row")
             (assert))
            ("2"
             (rewrite "length_add_vect_same" 1)
             (("1" (rewrite "length_row"))
              ("2"
               (rewrite "length_scal_vect" 1)
               (rewrite "length_row")
               (rewrite "length_row"))))))
          ("2"
           (rewrite "length_add_vect_same" 1)
           (("1" (rewrite "length_row"))
            ("2"
             (rewrite "length_scal_vect" 1)
             (rewrite "length_row")
             (rewrite "length_row"))))))))))))


proof_type: t_proof
decl_type: tcc
library: matrices
theory: matrix_diag
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skeep)
   (skeep)
   (assert)
   (rewrite "lex2_lt")
   (("1" (typepred "i") (expand "d_point2") (propax))
    ("2" (typepred "i") (expand "d_point2") (propax))))


proof_type: t_proof
decl_type: tcc
library: matrices
theory: matrix_diag
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skeep)
   (label "answ" 6)
   (hide "answ")
   (case "NOT (i<pn AND j < pn AND i<j)")
   (("1"
     (typepred "j")
     (typepred "i")
     (expand "d_point1")
     (expand "d_point2")
     (flatten)
     (assert))
    ("2"
     (flatten)
     (case "(null?(R) OR null?(S) OR null?(Q))")
     (("1"
       (label "igz" -1)
       (typepred "R")
       (typepred "S")
       (typepred "Q")
       (expand "rows")
       (expand "length")
       (split "igz")
       (("1" (assert)) ("2" (assert)) ("3" (assert))))
      ("2"
       (flatten)
       (reveal "answ")
       (skeep)
       (hide "answ")
       (case "NOT length(row(S)(i) + pivnum * row(S)(j)) = pn")
       (("1"
         (rewrite "length_add_vect")
         (rewrite "length_scal_vect")
         (rewrite "length_row")
         (rewrite "length_row")
         (assert)
         (expand "max")
         (assert))
        ("2"
         (case "NOT length(row(Q)(i) + pivnum * row(Q)(j)) = pn")
         (("1"
           (assert)
           (rewrite "length_add_vect")
           (rewrite "length_scal_vect")
           (rewrite "length_row")
           (rewrite "length_row")
           (expand "max")
           (assert))
          ("2"
           (assert)
           (reveal "answ")
           (name "GG"
                 "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"
             (replaces -1)
             (hide 3)
             (typepred "GG")
             (assert)
             (flatten)
             (assert)
             (split +)
             (("1" (propax)) ("2" (propax)) ("3" (propax)) ("4" (propax))
              ("5" (replace -6) (rewrite "det_replace_row_sum_scal"))))
            ("2" (hide 4) (hide 3) (rewrite "lex2_lt"))
            ("3" (hide (3 4)) (assert))
            ("4"
             (hide (3 4))
             (assert)
             (typepred "i")
             (typepred "j")
             (expand "d_point2")
             (expand "d_point1")
             (assert)
             (rewrite "rows_replace_row")
             (assert)
             (skeep)
             (rewrite "entry_replace_row")
             (rewrite "entry_replace_row")
             (lift-if)
             (assert)
             (split +)
             (("1"
               (flatten)
               (rewrite "access_sum")
               (rewrite "access_scal")
               (rewrite "access_row")
               (rewrite "access_row")
               (inst-cp - "i" "j")
               (inst - "j")
               (assert))
              ("2"
               (flatten)
               (inst - "k!1" "j")
               (assert)
               (inst - "k!1")
               (assert))))
            ("5"
             (hide (3 4))
             (typepred "i")
             (typepred "j")
             (expand "d_point2")
             (expand "d_point1")
             (rewrite "rows_replace_row")
             (assert)
             (skeep)
             (rewrite "entry_replace_row")
             (rewrite "entry_replace_row")
             (assert)
             (lift-if)
             (split +)
             (("1"
               (flatten)
               (replace -1)
               (assert)
               (rewrite "access_sum")
               (rewrite "access_scal")
               (rewrite "access_row")
               (rewrite "access_row")
               (assert)
               (inst-cp - "i" "p")
               (inst - "j" "p")
               (assert)
               (inst - "i")
               (assert))
              ("2" (flatten) (inst - "k!1" "p") (assert))))
            ("6"
             (hide (3 4))
             (assert)
             (split 1)
             (("1"
               (flatten)
               (assert)
               (lemma "mult_Easr_left")
               (inst - "Q" "i" "j" "pn" "pivnum")
               (assert)
               (replaces -1 :dir rl)
               (lemma "mult_Easr_left")
               (inst - "S" "i" "j" "pn" "pivnum")
               (assert)
               (replaces -1 :dir rl)
               (rewrite "matrix_mult_assoc")
               (typepred "T")
               (assert))
              ("2"
               (skeep)
               (rewrite "entry_replace_row")
               (assert)
               (lift-if)
               (typepred "T")
               (split 1)
               (("1"
                 (flatten)
                 (replaces -1)
                 (assert)
                 (rewrite "access_sum")
                 (rewrite "access_scal")
                 (rewrite "access_row")
                 (rewrite "access_row")
                 (typepred "S")
                 (expand "upper_triangular?")
                 (inst - "j" "i")
                 (inst - "i")
                 (assert))
                ("2" (flatten) (inst - "i_1") (assert))))))
            ("7"
             (hide (3 4))
             (flatten)
             (replace 1)
             (rewrite "Id_simple_prod"))
            ("8"
             (hide (3 4))
             (flatten)
             (assert)
             (lemma "mult_Easr_left")
             (inst - "Q" "i" "j" "pn" "pivnum")
             (assert)
             (replaces -1 :dir rl)
             (assert)
             (split +)
             (("1"
               (rewrite "mult_simple_prod")
               (rewrite "Easr_simple_prod"))
              ("2"
               (rewrite "matrix_mult_assoc")
               (("1"
                 (rewrite "matrix_mult_assoc" :dir rl)
                 (("1"
                   (rewrite "mult_Easr_Easr_inv")
                   (rewrite "mult_Id_left")
                   (typepred "R")
                   (assert))
                  ("2" (rewrite "Easr_null"))))
                ("2" (rewrite "Easr_null"))))
              ("3"
               (rewrite "matrix_mult_assoc")
               (rewrite "matrix_mult_assoc" :dir rl)
               (typepred "R")
               (assert)
               (flatten)
               (replace -9)
               (rewrite "mult_Id_left")
               (assert)
               (rewrite "mult_Easr_Easr_inv"))
              ("4" (rewrite "rows_mult") (assert))
              ("5"
               (rewrite "rows_mult")
               (assert)
               (rewrite "columns_mult")
               (assert))
              ("6" (rewrite "rows_mult") (assert))
              ("7" (rewrite "columns_mult") (assert))))
            ("9" (hide (3 4)) (flatten) (rewrite "Id_simple_prod"))
            ("10"
             (hide (3 4))
             (flatten)
             (assert)
             (rewrite "rows_replace_row")
             (rewrite "columns_replace_row")
             (assert)
             (lemma "mult_Easr_left")
             (inst - "Q" "i" "j" "pn" "pivnum")
             (assert)
             (replaces -1 :dir rl)
             (rewrite "mult_simple_prod")
             (rewrite "Easr_simple_prod"))
            ("11"
             (hide (3 4))
             (rewrite "rows_replace_row")
             (rewrite "columns_replace_row")
             (assert)
             (lemma "mult_Easr_left")
             (inst - "S" "i" "j" "pn" "pivnum")
             (assert)
             (replaces -1 :dir rl)
             (rewrite "upper_triangular_mult")
             (rewrite "upper_triangular_Easr"))))))))))))


proof_type: t_proof
decl_type: tcc
library: matrices
theory: matrix_diag
signature: nil
run_date: Unknown date
run_time: ----
status: proved-incomplete
description: nil
script:
  (""
   (skeep)
   (name "ut"
         "upper_triangulate(rows(S))
                                 (comp_matrix, comp_inverse, S, Id(rows(S)),
                                  Id(rows(S)), S, 0, rows(S) - 1, FALSE, 0)")
   (replaces -1)
   (typepred "ut")
   (ground)
   (("1" (rewrite "mult_Id_left")) ("2" (rewrite "mult_Id_left"))))


proof_type: t_proof
decl_type: tcc
library: matrices
theory: matrix_diag
signature: nil
run_date: Unknown date
run_time: ----
status: proved-incomplete
description: nil
script:
  (""
   (skeep)
   (assert)
   (hide -)
   (typepred "S2")
   (expand "d_point1")
   (skosimp*)
   (rewrite "entry_eq_0" 1))


proof_type: t_proof
decl_type: tcc
library: matrices
theory: matrix_diag
signature: nil
run_date: Unknown date
run_time: ----
status: proved-incomplete
description: nil
script:
  (""
   (skeep)
   (skeep)
   (assert)
   (rewrite "rows_mult")
   (rewrite "columns_mult")
   (("1" (assert))
    ("2" (typepred "R2") (expand "rows") (expand "length") (assert))))


proof_type: t_proof
decl_type: tcc
library: matrices
theory: matrix_diag
signature: nil
run_date: Unknown date
run_time: ----
status: proved-incomplete
description: nil
script:
  (""
   (skeep)
   (skeep)
   (rewrite "rows_mult")
   (rewrite "columns_mult")
   (("1" (assert))
    ("2" (typepred "Q3") (expand "rows") (expand "length") (assert))))


proof_type: t_proof
decl_type: tcc
library: matrices
theory: matrix_diag
signature: nil
run_date: Unknown date
run_time: ----
status: proved-incomplete
description: nil
script:
  (""
   (skeep)
   (skeep)
   (name "ut"
         "upper_triangulate(rows(S))
                                               (comp_matrix, comp_inverse, S, Id(rows(S)),
                                                Id(rows(S)), S, 0, rows(S) - 1, FALSE, 0)")
   (replace -1)
   (name "dt"
         "diagonalize(rows(S))
                                         (comp_matrix, comp_inverse, S2, Id(rows(S)), Id(rows(S)),
                                          S2, rows(S) - 1, 0, FALSE, 0)")
   (replaces -1)
   (hide -1)
   (assert)
   (typepred "ut")
   (typepred "dt")
   (assert)
   (replace -11 :dir rl)
   (replace -12 :dir rl)
   (replace -13 :dir rl)
   (replace -14 :dir rl)
   (replace -15 :dir rl)
   (replace -16 :dir rl)
   (split +)
   (("1"
     (assert)
     (skeep)
     (assert)
     (inst - "k" "p")
     (assert)
     (case "k < p")
     (("1" (assert))
      ("2" (expand "upper_triangular?") (inst - "k" "p") (assert))))
    ("2"
     (flatten)
     (assert)
     (split 1)
     (("1"
       (rewrite "matrix_mult_assoc")
       (("1" (assert) (flatten) (assert))
        ("2"
         (typepred "Q2")
         (expand "rows")
         (expand "length")
         (assert))))
      ("2" (assert) (rewrite "mult_simple_prod"))))
    ("3"
     (flatten)
     (assert)
     (rewrite "matrix_mult_assoc")
     (("1"
       (rewrite "matrix_mult_assoc")
       (("1"
         (rewrite "matrix_mult_assoc" :dir rl)
         (("1"
           (flatten)
           (replace -8)
           (rewrite "mult_Id_left")
           (rewrite "matrix_mult_assoc" :dir rl)
           (("1"
             (replace -16)
             (rewrite "mult_Id_left")
             (assert)
             (rewrite "mult_simple_prod"))
            ("2"
             (typepred "R2")
             (expand "rows")
             (expand "length")
             (assert))))
          ("2"
           (typepred "Q3")
           (expand "rows")
           (expand "length")
           (assert))))
        ("2"
         (typepred "Q2")
         (expand "rows")
         (expand "length")
         (assert))))
      ("2" (typepred "R3") (expand "rows") (expand "length") (assert))))
    ("4"
     (flatten)
     (assert)
     (skeep)
     (assert)
     (split +)
     (("1"
       (flatten)
       (lemma "det_upper_triangular_zero")
       (inst - "S3")
       (assert)
       (inst + "p")
       (assert)
       (inst - "k" "p")
       (assert)
       (expand "upper_triangular?")
       (inst - "k" "p")
       (assert))
      ("2"
       (flatten)
       (lemma "det_upper_triangular_zero")
       (inst - "S3")
       (assert)
       (inst + "k")
       (assert))))
    ("5"
     (flatten)
     (lemma "det_upper_triangular_zero")
     (inst - "S3")
     (assert)
     (skosimp*)
     (inst - "i!1" "i!1")
     (assert))))


proof_type: f_proof
decl_type: formula
library: matrices
theory: matrix_inv
signature: nil
run_date: Unknown date
run_time: ----
status: proved-incomplete
description: nil
script:
  (""
   (skeep)
   (typepred "left_inv(S)")
   (case "NOT (left_inv(S) * S)*left_inv(S) = Id(rows(S))*left_inv(S)")
   (("1" (assert))
    ("2"
     (rewrite "mult_Id_left")
     (rewrite "matrix_mult_assoc")
     (("1"
       (case "NOT det(left_inv(S))/=0")
       (("1"
         (flatten)
         (case "NOT det(left_inv(S)*S) = det(Id(rows(S)))")
         (("1" (assert))
          ("2" (rewrite "det_mult") (rewrite "det_Id") (assert))))
        ("2"
         (flatten)
         (case "NOT left_inv(left_inv(S))*(left_inv(S) * (S * left_inv(S))) = left_inv(left_inv(S))*left_inv(S)")
         (("1" (assert))
          ("2"
           (lemma "matrix_mult_assoc")
           (inst - "S*left_inv(S)" "left_inv(left_inv(S))" "left_inv(S)")
           (assert)
           (split -1)
           (("1"
             (replaces -1 :dir rl)
             (typepred "left_inv(left_inv(S))")
             (replace -7)
             (rewrite "mult_Id_left")
             (("1" (assert)) ("2" (rewrite "rows_mult") (assert))
              ("3"
               (rewrite "rows_mult")
               (assert)
               (rewrite "columns_mult")
               (typepred "S")
               (expand "rows")
               (assert)
               (expand "length")
               (assert))))
            ("2"
             (typepred "left_inv(S)")
             (expand "rows")
             (expand "length")
             (assert))))
          ("3" (assert))))))
      ("2" (typepred "S") (expand "rows") (expand "length") (assert))))))


proof_type: f_proof
decl_type: formula
library: matrices
theory: matrix_inv
signature: nil
run_date: Unknown date
run_time: ----
status: proved-incomplete
description: nil
script:
  (""
   (skeep)
   (expand "invertible?")
   (ground)
   (("1" (skosimp*) (inst + "IQ!1") (assert))
    ("2"
     (inst + "left_inv(SQ)")
     (assert)
     (typepred "left_inv(SQ)")
     (assert)
     (rewrite "mult_left_inv_right"))
    ("3"
     (skosimp*)
     (inst + "IQ!1")
     (assert)
     (case "IQ!1 = left_inv(SQ)")
     (("1"
       (replaces -1)
       (rewrite "mult_left_inv_right")
       (flatten)
       (lemma "det_mult")
       (inst - "SQ" "left_inv(SQ)")
       (assert)
       (typepred "left_inv(SQ)")
       (replace -7)
       (rewrite "det_Id")
       (assert))
      ("2"
       (case "NOT (IQ!1 * SQ)*left_inv(SQ) = Id(rows(SQ))*left_inv(SQ)")
       (("1" (assert))
        ("2"
         (rewrite "matrix_mult_assoc" -1)
         (("1"
           (rewrite "mult_left_inv_right")
           (("1" (rewrite "mult_Id_left") (rewrite "mult_Id_right"))
            ("2"
             (flatten)
             (lemma "det_mult")
             (inst - "SQ" "IQ!1")
             (assert)
             (lemma "det_Id")
             (inst?)
             (assert))))
          ("2"
           (typepred "SQ")
           (expand "rows")
           (expand "length")
           (assert))))))
      ("3"
       (flatten)
       (lemma "det_mult")
       (inst - "SQ" "IQ!1")
       (assert)
       (lemma "det_Id")
       (inst?)
       (assert))))
    ("4"
     (skeep)
     (inst + "IQ")
     (assert)
     (case "det(IQ)=0")
     (("1"
       (assert)
       (lemma "det_mult")
       (inst - "IQ" "SQ")
       (assert)
       (lemma "det_Id")
       (inst?)
       (assert))
      ("2"
       (case "SQ = left_inv(IQ)")
       (("1" (replaces -1) (rewrite "mult_left_inv_right") (assert))
        ("2"
         (case "NOT left_inv(SQ)*(SQ*IQ) = left_inv(SQ)*Id(rows(SQ))")
         (("1" (assert))
          ("2"
           (rewrite "matrix_mult_assoc" :dir rl)
           (("1"
             (typepred "left_inv(SQ)")
             (replace -7)
             (rewrite "mult_Id_left")
             (rewrite "mult_Id_right")
             (assert))
            ("2"
             (typepred "SQ")
             (expand "rows")
             (expand "length")
             (assert))))
          ("3"
           (flatten)
           (assert)
           (lemma "det_mult")
           (inst - "IQ" "SQ")
           (assert)
           (lemma "det_Id")
           (inst?)
           (assert))))
        ("3" (assert))))))))


proof_type: f_proof
decl_type: formula
library: matrices
theory: matrix_inv
signature: nil
run_date: Unknown date
run_time: ----
status: proved-incomplete
description: nil
script:
  (""
   (skeep)
   (assert)
   (rewrite "invertible_rew")
   (ground)
   (("1" (inst + "IQ") (assert))
    ("2"
     (lemma "det_mult")
     (inst - "SQ" "IQ")
     (assert)
     (lemma "det_Id")
     (inst?)
     (assert))
    ("3"
     (case "NOT (IQ*SQ)*inverse(SQ)=Id(rows(SQ))*inverse(SQ)")
     (("1" (assert))
      ("2"
       (rewrite "matrix_mult_assoc")
       (("1"
         (rewrite "mult_inverse_right")
         (("1" (rewrite "mult_Id_right") (rewrite "mult_Id_left"))
          ("2"
           (rewrite "invertible_rew")
           (flatten)
           (inst + "IQ")
           (assert))))
        ("2"
         (typepred "SQ")
         (expand "rows")
         (expand "length")
         (assert))))))
    ("4"
     (case "NOT (IQ*SQ)*inverse(SQ) = Id(rows(SQ))*inverse(SQ)")
     (("1" (assert))
      ("2"
       (rewrite "matrix_mult_assoc")
       (("1"
         (rewrite "mult_inverse_right")
         (("1"
           (rewrite "mult_Id_right")
           (rewrite "mult_Id_left")
           (replaces -1)
           (rewrite "mult_inverse_right"))
          ("2"
           (rewrite "invertible_rew")
           (flatten)
           (inst + "IQ")
           (assert))))
        ("2"
         (typepred "SQ")
         (expand "rows")
         (expand "length")
         (assert))))
      ("3"
       (flatten)
       (assert)
       (lemma "det_mult")
       (inst - "SQ" "IQ")
       (assert)
       (lemma "det_Id")
       (inst?)
       (assert))))
    ("5"
     (lemma "det_mult")
     (inst - "IQ" "SQ")
     (assert)
     (lemma "det_Id")
     (inst?)
     (assert))
    ("6"
     (lemma "det_mult")
     (inst - "IQ" "SQ")
     (assert)
     (lemma "det_Id")
     (inst?)
     (assert))
    ("7"
     (case "NOT inverse(SQ)*(SQ*IQ)=inverse(SQ)*Id(rows(SQ))")
     (("1" (assert))
      ("2"
       (rewrite "matrix_mult_assoc" :dir rl)
       (("1"
         (rewrite "mult_inverse_left")
         (("1" (rewrite "mult_Id_left") (rewrite "mult_Id_right"))
          ("2"
           (rewrite "invertible_rew")
           (flatten)
           (inst 2 "IQ")
           (assert))))
        ("2"
         (typepred "SQ")
         (expand "rows")
         (expand "length")
         (assert))))))
    ("8"
     (case "det(SQ) = 0")
     (("1"
       (lemma "det_mult")
       (inst - "IQ" "SQ")
       (assert)
       (lemma "det_Id")
       (inst?)
       (assert))
      ("2"
       (case "NOT inverse(SQ)*(SQ*IQ)=inverse(SQ)*Id(rows(SQ))")
       (("1" (assert))
        ("2"
         (rewrite "matrix_mult_assoc" :dir rl)
         (("1"
           (rewrite "mult_Id_right")
           (rewrite "mult_inverse_left")
           (("1"
             (rewrite "mult_Id_left")
             (replace -1)
             (rewrite "mult_inverse_left"))
            ("2" (rewrite "invertible_rew"))))
          ("2"
           (typepred "SQ")
           (expand "rows")
           (expand "length")
           (assert))))
        ("3" (assert))))))))


proof_type: f_proof
decl_type: formula
library: matrices
theory: matrix_inv
signature: nil
run_date: Unknown date
run_time: ----
status: proved-incomplete
description: nil
script:
  (""
   (skeep)
   (rewrite "invertible_rew")
   (ground)
   (("1"
     (skeep)
     (lemma "det_mult")
     (inst?)
     (assert)
     (lemma "det_Id")
     (inst?)
     (assert))
    ("2"
     (skeep)
     (lemma "det_mult")
     (inst?)
     (assert)
     (lemma "det_Id")
     (inst?)
     (assert))))


proof_type: f_proof
decl_type: formula
library: matrices
theory: matrix_inv
signature: nil
run_date: Unknown date
run_time: ----
status: proved-incomplete
description: nil
script:
  (""
   (skeep)
   (rewrite "det_mult")
   (lemma "nzreal_times_nzreal_is_nzreal")
   (case "FORALL (rr,ss:real): rr*ss=0 IFF (rr=0 OR ss=0)")
   (("1"
     (inst?)
     (hide -2)
     (lemma "invertible_det")
     (inst-cp - "S")
     (inst - "R")
     (lemma "invertible_det")
     (inst - "S*R")
     (("1" (lemma "det_mult") (inst?) (assert) (ground))
      ("2"
       (rewrite "rows_mult")
       (rewrite "columns_mult")
       (("1" (assert))
        ("2"
         (typepred "S")
         (expand "rows")
         (expand "length")
         (assert))))))
    ("2" (hide-all-but 1) (grind-reals))))


proof_type: f_proof
decl_type: formula
library: matrices
theory: matrix_inv
signature: nil
run_date: Unknown date
run_time: ----
status: proved-incomplete
description: nil
script:
  (""
   (skeep)
   (lemma "inverse_unique")
   (inst - "inverse(R)*inverse(S)" "S*R")
   (("1"
     (assert)
     (hide 2)
     (rewrite "rows_mult")
     (rewrite "rows_mult")
     (assert)
     (rewrite "matrix_mult_assoc" :dir rl)
     (("1"
       (rewrite "matrix_mult_assoc")
       (("1"
         (rewrite "mult_inverse_left")
         (("1"
           (rewrite "mult_Id_right")
           (rewrite "mult_inverse_left")
           (assert))
          ("2" (rewrite "invertible_det" 1))))
        ("2"
         (typepred "inverse(S)")
         (expand "rows")
         (expand "length")
         (assert))))
      ("2" (typepred "S") (expand "rows") (expand "length") (assert))))
    ("2"
     (assert)
     (rewrite "rows_mult")
     (rewrite "columns_mult")
     (("1" (assert))
      ("2"
       (typepred "inverse(R)")
       (expand "rows")
       (expand "length")
       (assert))))))


proof_type: f_proof
decl_type: formula
library: matrices
theory: matrix_inv
signature: nil
run_date: Unknown date
run_time: ----
status: proved-incomplete
description: nil
script:
  (""
   (skeep)
   (lemma "mult_inverse_left")
   (inst?)
   (split -1)
   (("1"
     (assert)
     (lemma "det_mult")
     (inst?)
     (assert)
     (lemma "det_Id")
     (inst?)
     (assert))
    ("2" (assert) (rewrite "invertible_det"))))


proof_type: f_proof
decl_type: formula
library: matrices
theory: matrix_inv
signature: nil
run_date: Unknown date
run_time: ----
status: proved-incomplete
description: nil
script:
  (""
   (skeep)
   (lemma "inverse_inverse")
   (inst?)
   (assert)
   (expand "inverse" -1 1)
   (expand "left_inv")
   (case "FORALL (i:nat): i<rows(S) IMPLIES entry(diag(TRUE, FALSE, inverse(S))`multip *
                                                                                           inverse(S))
                                                                                         (i, i)/=0")
   (("1"
     (name "FG"
           "LAMBDA (FF:[nat->real]): (LAMBDA (i,j:nat): IF i/=j THEN 0 ELSE FF(i) ENDIF)")
     (case "FORALL (FF:[nat->real],n:nat): (FORALL (i:nat): i<n+1 IMPLIES FF(i)/=0) IMPLIES is_simple_prod?(n+1,TRUE,FALSE)(form_matrix(FG(FF),n+1,n+1))")
     (("1"
       (name "FFZ"
             "LAMBDA (i:nat): IF i>=rows(S) OR entry(diag(TRUE, FALSE, inverse(S))`multip *
                                                                                                                inverse(S))(i,i)=0 THEN 0 ELSE 1/entry(diag(TRUE, FALSE, inverse(S))`multip *
                                                                                                                inverse(S))(i,i) ENDIF")
       (("1"
         (name "G5" "FG(FFZ)")
         (case "(LAMBDA (i, j):
                                                                                                                 IF i /= j OR
                                                                                                                     entry(diag(TRUE, FALSE, inverse(S))`multip *
                                                                                                                            inverse(S))
                                                                                                                          (i, i)
                                                                                                                      = 0
                                                                                                                   THEN 0
                                                                                                                 ELSE 1 /
                                                                                                                       entry(diag(TRUE, FALSE, inverse(S))`multip *
                                                                                                                              inverse(S))
                                                                                                                            (i, i)
                                                                                                                 ENDIF) = G5")
         (("1"
           (replace -1)
           (replace -7 2 :dir rl)
           (rewrite "mult_simple_prod")
           (("1"
             (hide 3)
             (rewrite "rows_mult" 1)
             (rewrite "rows_form_matrix")
             (expand "G5" 1)
             (rewrite -4 1)
             (hide 2)
             (skosimp*)
             (expand "FFZ" -2)
             (assert)
             (inst -8 "i!1")
             (assert)
             (assert))
            ("2"
             (hide 3)
             (rewrite "rows_mult")
             (rewrite "rows_form_matrix")
             (typepred "diag(true,false,inverse(S))")
             (assert)
             (hide-all-but (-4 1))
             (lemma "is_simple_prod_implic")
             (inst - "false" "false" "rows(inverse(S))"
              "diag(TRUE, FALSE, inverse(S))`multip" "true" "false")
             (assert))
            ("3"
             (hide 3)
             (rewrite "rows_form_matrix")
             (assert)
             (lemma "columns_form_matrix")
             (inst?)
             (assert))))
          ("2"
           (decompose-equality 1)
           (("1"
             (expand "G5")
             (expand "FG" 1)
             (expand "FFZ" 1)
             (lift-if)
             (assert)
             (lift-if)
             (assert)
             (lift-if)
             (inst -5 "x!1")
             (assert)
             (case "x!1/=x!2")
             (("1" (assert))
              ("2"
               (flatten)
               (assert)
               (ground)
               (("1"
                 (rewrite "entry_eq_0" 1)
                 (flatten)
                 (rewrite "rows_mult")
                 (assert))
                ("2"
                 (rewrite "entry_eq_0" 2)
                 (flatten)
                 (rewrite "rows_mult")
                 (assert))))))
            ("2" (skosimp*))))
          ("3" (skosimp*))))
        ("2" (skosimp*))))
      ("2"
       (hide-all-but 1)
       (assert)
       (skeep)
       (expand "is_simple_prod?")
       (name "FMG" "LAMBDA (i:nat): Esr(1+n)(i,FF(i))")
       (inst + "FMG" "n")
       (assert)
       (split 1)
       (("1"
         (expand "is_simple_seq?")
         (skeep)
         (inst + "p" "FF(p)")
         (assert)
         (expand "FMG" 1)
         (case "p < 1+n")
         (("1" (assert) (expand "FMG" 3) (propax))
          ("2"
           (assert)
           (rewrite "full_matrix_eq" 2)
           (skosimp*)
           (rewrite "entry_Esr")
           (rewrite "entry_Id"))))
        ("2"
         (rewrite "full_matrix_eq" 1)
         (split)
         (("1" (rewrite "rows_form_matrix") (assert))
          ("2" (lemma "columns_form_matrix") (inst?) (assert))
          ("3"
           (skosimp*)
           (case "FORALL (k:nat): FORALL (ii,jj:nat): ii<1+n AND jj<1+n AND k<=n IMPLIES entry(prod_mat(1+n)(FMG,k))(ii,jj) = IF ii=jj AND ii<=k THEN FF(ii) ELSIF ii=jj THEN 1 ELSE 0 ENDIF")
           (("1"
             (inst - "n")
             (inst?)
             (assert)
             (split -1)
             (("1"
               (replaces -1)
               (rewrite "entry_form_matrix")
               (expand "FG" 1)
               (lift-if)
               (assert)
               (lift-if)
               (assert)
               (lift-if)
               (assert)
               (ground)
               (("1" (typepred "i!1") (rewrite "rows_form_matrix"))
                ("2"
                 (typepred "i!1")
                 (rewrite "rows_form_matrix")
                 (assert))))
              ("2" (typepred "i!1") (rewrite "rows_form_matrix"))
              ("3"
               (assert)
               (typepred "j!1")
               (lemma "columns_form_matrix")
               (inst?)
               (assert))))
            ("2"
             (hide 2)
             (induct "k")
             (("1"
               (skeep)
               (assert)
               (expand "prod_mat" 1)
               (expand "FMG" 1)
               (rewrite "entry_Esr")
               (lift-if)
               (assert))
              ("2"
               (skeep)
               (skeep)
               (assert)
               (expand "prod_mat" +)
               (rewrite "entry_mult")
               (assert)
               (expand "*" + 1)
               (rewrite "dot_eq_sigma")
               (rewrite "length_row")
               (("1"
                 (rewrite "length_col")
                 (assert)
                 (expand "FMG" 1 1)
                 (assert)
                 (typepred
                  "prod_mat(1 + n)
                                                  (LAMBDA (i: nat): Esr(1 + n)(i, FF(i)), j)")
                 (hide (-1 -2))
                 (replace -3 :dir rl)
                 (replace -4)
                 (assert)
                 (expand "FMG" 1 1)
                 (rewrite "rows_Esr")
                 (assert)
                 (expand "min")
                 (lift-if)
                 (split 1)
                 (("1"
                   (flatten)
                   (lemma "sigma_eq_one_arg2")
                   (inst?)
                   (inst - "ii")
                   (assert)
                   (split -1)
                   (("1"
                     (replaces -1)
                     (rewrite "access_row")
                     (rewrite "access_col")
                     (inst - "ii" "ii")
                     (assert)
                     (replaces -7 1)
                     (expand "FMG" 1)
                     (rewrite "entry_Esr" 1)
                     (lift-if)
                     (assert))
                    ("2"
                     (hide 2)
                     (skosimp*)
                     (rewrite "access_row")
                     (inst - "ii" "i!2")
                     (assert))))
                  ("2"
                   (flatten)
                   (split 2)
                   (("1"
                     (flatten)
                     (assert)
                     (lift-if)
                     (split 1)
                     (("1" (flatten))
                      ("2"
                       (flatten)
                       (assert)
                       (lemma "sigma_eq_one_arg2")
                       (inst?)
                       (inst - "ii")
                       (assert)
                       (split -1)
                       (("1"
                         (replaces -1)
                         (rewrite "access_row")
                         (rewrite "access_col")
                         (inst - "ii" "ii")
                         (assert)
                         (replaces -1)
                         (replaces -5)
                         (expand "FMG" +)
                         (rewrite "entry_Esr"))
                        ("2"
                         (skosimp*)
                         (rewrite "access_row")
                         (inst - "ii" "i!2")
                         (assert))))))
                    ("2"
                     (flatten)
                     (lift-if)
                     (assert)
                     (rewrite "sigma_restrict_eq_0")
                     (skosimp*)
                     (rewrite "access_row")
                     (rewrite "access_col")
                     (assert)
                     (inst - "ii" "i!2")
                     (assert)
                     (replace -5)
                     (lift-if)
                     (split 1)
                     (("1"
                       (flatten)
                       (assert)
                       (expand "FMG" 1)
                       (rewrite "entry_Esr")
                       (assert))
                      ("2"
                       (flatten)
                       (split 2)
                       (("1"
                         (flatten)
                         (assert)
                         (assert)
                         (expand "FMG" 1)
                         (rewrite "entry_Esr"))
                        ("2" (flatten) (assert))))))))))
                ("2"
                 (typepred "prod_mat(1+n)(FMG,j)")
                 (assert)
                 (expand "rows")
                 (assert))))))))))))
      ("3"
       (skeep)
       (rewrite "rows_form_matrix")
       (assert)
       (lemma "columns_form_matrix")
       (inst?)
       (assert))))
    ("2"
     (skeep)
     (lemma "det_inverse")
     (inst - "S")
     (assert)
     (case "det(inverse(S))=0")
     (("1" (assert))
      ("2"
       (assert)
       (typepred "diag(TRUE, FALSE, inverse(S))")
       (replace -3)
       (assert)
       (inst -6 "i" "i")
       (assert))))))


proof_type: f_proof
decl_type: formula
library: matrices
theory: matrix_inv
signature: nil
run_date: Unknown date
run_time: ----
status: proved-incomplete
description: nil
script:
  (""
   (skeep)
   (lemma "det_nonzero_simple_prod")
   (inst?)
   (assert)
   (expand "is_simple_prod?")
   (skeep)
   (case "EXISTS (z:nat): z<=k AND det(FM(z)) = 0")
   (("1"
     (skeep)
     (case "FORALL (j:nat): z+j<=k IMPLIES det(prod_mat(rows(S))(FM,z+j)) = 0")
     (("1" (inst - "k-z") (("1" (assert)) ("2" (assert))))
      ("2"
       (induct "j")
       (("1"
         (assert)
         (expand "prod_mat" +)
         (lift-if)
         (ground)
         (rewrite "det_mult")
         (assert))
        ("2"
         (skosimp*)
         (assert)
         (expand "prod_mat" +)
         (rewrite "det_mult")
         (assert))))))
    ("2"
     (case "FORALL (z:nat): z<=k IMPLIES P(prod_mat(rows(S))(FM,z))")
     (("1" (inst - "k") (assert))
      ("2"
       (induct "z")
       (("1"
         (assert)
         (expand "prod_mat" +)
         (expand "is_simple_seq?")
         (assert)
         (inst - "0")
         (assert)
         (split -)
         (("1" (skeep) (inst - "i" "j" "r") (assert))
          ("2"
           (skeep)
           (inst - "i" "r")
           (assert)
           (flatten)
           (replace -5)
           (inst + "0")
           (assert)
           (replace -2)
           (rewrite "det_Esr"))))
        ("2"
         (skeep)
         (expand "prod_mat" +)
         (rewrite -8 1)
         (expand "is_simple_seq?")
         (inst - "1+j")
         (assert)
         (split -)
         (("1" (skosimp*) (inst - "i!1" "j!1" "r!1") (assert))
          ("2"
           (skeep)
           (inst - "i" "r")
           (assert)
           (flatten)
           (replace -7)
           (replace -2)
           (inst + "1+j")
           (replace -2)
           (assert)
           (rewrite "det_Esr"))))))))))


proof_type: f_proof
decl_type: formula
library: matrices
theory: matrix_inv
signature: nil
run_date: Unknown date
run_time: ----
status: proved-incomplete
description: nil
script:
  (""
   (skeep)
   (case "rows(SM)/=columns(SM) OR rows(transpose(SM))/=columns(transpose(SM)) OR rows(transpose(SM))/=columns(SM)")
   (("1"
     (case "rows(SM)/=columns(SM)")
     (("1"
       (hide -2)
       (flatten)
       (expand "det" 2)
       (assert)
       (lift-if)
       (ground)
       (("1"
         (rewrite "rows_transpose")
         (rewrite "columns_transpose")
         (assert))
        ("2"
         (rewrite "rows_transpose")
         (rewrite "columns_transpose")
         (assert))))
      ("2"
       (rewrite "rows_transpose")
       (rewrite "columns_transpose")
       (ground))))
    ("2"
     (flatten)
     (case "det(SM)/=0")
     (("1"
       (flatten)
       (lemma "mult_induction")
       (inst - "SM"
        "LAMBDA (KV:SquareMatrix(rows(SM))): det(transpose(KV)) = det(KV)")
       (assert)
       (split)
       (("1"
         (skeep)
         (rewrite "transpose_Easr")
         (rewrite "det_Easr")
         (rewrite "det_Easr")
         (lift-if)
         (ground))
        ("2" (skeep) (rewrite "transpose_Esr"))
        ("3" (rewrite "transpose_Id"))
        ("4"
         (skeep)
         (rewrite "transpose_mult")
         (rewrite "det_mult")
         (("1" (rewrite "det_mult") (assert))
          ("2"
           (rewrite "rows_transpose")
           (rewrite "rows_transpose")
           (assert))
          ("3"
           (rewrite "rows_transpose")
           (rewrite "columns_transpose")
           (assert))
          ("4"
           (rewrite "rows_transpose")
           (rewrite "columns_transpose")
           (assert))))))
      ("2"
       (flatten)
       (lemma "mult_inverse_right")
       (inst - "transpose(SM)")
       (split -1)
       (("1"
         (case "NOT det(transpose(transpose(SM) * inverse(transpose(SM)))) = det(transpose(Id(rows(transpose(SM)))))")
         (("1" (assert))
          ("2"
           (rewrite "transpose_mult")
           (rewrite "transpose_transpose")
           (rewrite "transpose_Id")
           (rewrite "det_Id")
           (rewrite "det_mult")
           (("1" (assert)) ("2" (rewrite "rows_transpose") (assert))
            ("3"
             (rewrite "rows_transpose")
             (rewrite "columns_transpose")
             (assert))))
          ("3" (rewrite "rows_mult") (assert))))
        ("2" (lemma "invertible_rew") (inst?) (assert))))))))


proof_type: t_proof
decl_type: tcc
library: matrices
theory: matrix_inv
signature: nil
run_date: Unknown date
run_time: ----
status: proved-incomplete
description: nil
script:
  (""
   (skeep)
   (skeep)
   (case "diagonal?(dg`ans)")
   (("1"
     (label "idz" -1)
     (hide "idz")
     (skeep)
     (case "NOT diagonal?(newT)")
     (("1"
       (hide 2)
       (replace -3 +)
       (expand "diagonal?")
       (skosimp*)
       (rewrite "entry_form_matrix")
       (("1" (lift-if) (assert)) ("2" (hide 3) (skosimp*))))
      ("2"
       (lemma "diagonal_simple_prod")
       (inst - "false" "rows(S)" "newT")
       (("1"
         (assert)
         (split)
         (("1"
           (case "rows(newT) = rows(S) AND columns(newT) = rows(S)")
           (("1"
             (flatten)
             (assert)
             (rewrite "matrix_mult_assoc")
             (("1"
               (rewrite "full_matrix_eq")
               (split)
               (("1" (rewrite "rows_mult") (assert))
                ("2"
                 (rewrite "columns_mult")
                 (("1"
                   (assert)
                   (rewrite "columns_mult")
                   (("1" (assert))
                    ("2"
                     (typepred "R")
                     (expand "rows")
                     (expand "length")
                     (assert))))
                  ("2"
                   (expand "rows")
                   (expand "length" -2 1)
                   (rewrite "length_rows" -2)
                   (assert))))
                ("3"
                 (skosimp*)
                 (rewrite "entry_mult")
                 (lift-if)
                 (split 1)
                 (("1"
                   (flatten)
                   (expand "*" + 1)
                   (rewrite "dot_eq_sigma")
                   (rewrite "length_row")
                   (replace -4)
                   (rewrite "length_col")
                   (rewrite "rows_mult")
                   (expand "min" 1)
                   (rewrite "entry_Id")
                   (assert)
                   (rewrite "columns_mult" -2)
                   (("1"
                     (assert)
                     (lift-if)
                     (split 1)
                     (("1"
                       (flatten)
                       (rewrite "sigma_restrict_eq_0")
                       (hide 3)
                       (skosimp*)
                       (rewrite "access_row")
                       (rewrite "access_col")
                       (case "i!1 = i!2")
                       (("1"
                         (typepred "dg")
                         (assert)
                         (replace -16 :dir rl)
                         (replace -3)
                         (reveal "idz")
                         (expand "diagonal?")
                         (inst - "i!2" "j!1")
                         (assert))
                        ("2"
                         (expand "diagonal?")
                         (inst - "i!1" "i!2")
                         (assert))))
                      ("2"
                       (flatten)
                       (replaces -1)
                       (lemma "sigma_eq_one_arg2")
                       (inst?)
                       (inst - "j!1")
                       (assert)
                       (split -1)
                       (("1"
                         (replaces -1)
                         (rewrite "access_row")
                         (rewrite "access_col")
                         (typepred "dg")
                         (assert)
                         (replace -16 1)
                         (rewrite "entry_form_matrix")
                         (("1"
                           (assert)
                           (lift-if)
                           (split +)
                           (("1"
                             (flatten)
                             (lemma "det_upper_triangular_zero")
                             (inst - "R*S")
                             (assert)
                             (inst + "j!1")
                             (assert))
                            ("2" (flatten) (assert))))
                          ("2" (skosimp*))))
                        ("2"
                         (hide 2)
                         (skosimp*)
                         (rewrite "access_row")
                         (rewrite "access_col")
                         (typepred "dg")
                         (reveal "idz")
                         (expand "diagonal?")
                         (inst - "i!2" "j!1")
                         (assert))))))
                    ("2"
                     (typepred "R")
                     (expand "rows")
                     (expand "length")
                     (assert))))
                  ("2"
                   (flatten)
                   (rewrite "columns_mult" 1)
                   (("1" (assert) (rewrite "entry_eq_0") (ground))
                    ("2"
                     (typepred "R")
                     (expand "rows")
                     (expand "length")
                     (assert))))))))
              ("2"
               (typepred "R")
               (expand "rows")
               (expand "length")
               (assert))))
            ("2"
             (assert)
             (replace -5 1)
             (rewrite "rows_form_matrix")
             (("1"
               (lemma "columns_form_matrix")
               (inst?)
               (("1" (assert)) ("2" (skosimp*))))
              ("2" (skosimp*))))))
          ("2"
           (rewrite "rows_mult")
           (assert)
           (replace -5 1)
           (rewrite "rows_form_matrix")
           (skosimp*))
          ("3"
           (rewrite "rows_mult")
           (rewrite "columns_mult" 1)
           (("1"
             (replace -5 1)
             (rewrite "rows_form_matrix")
             (("1" (assert)) ("2" (skosimp*))))
            ("2"
             (typepred "newT")
             (expand "rows")
             (lemma "rows_form_matrix")
             (inst?)
             (("1"
               (assert)
               (expand "rows" -1)
               (expand "length" -1 1)
               (rewrite "length_rows" -1)
               (assert))
              ("2" (skosimp*))))))
          ("4"
           (rewrite "rows_mult")
           (replace -5)
           (rewrite "rows_form_matrix")
           (("1" (assert)) ("2" (skosimp*))))
          ("5"
           (rewrite "columns_mult" 1)
           (("1" (assert))
            ("2"
             (lemma "rows_form_matrix")
             (inst?)
             (("1"
               (assert)
               (expand "rows" -1 1)
               (expand "length" -1)
               (assert))
              ("2" (skosimp*))))))))
        ("2"
         (hide 2)
         (case "rows(newT) = rows(S)")
         (("1"
           (case "columns(newT) = rows(S)")
           (("1"
             (assert)
             (flatten)
             (lemma "form_matrix_square")
             (inst?)
             (("1" (assert) (skosimp*) (inst - "i!1" "j!1") (assert))
              ("2" (skosimp*))))
            ("2"
             (hide 2)
             (replace -5 +)
             (lemma "columns_form_matrix")
             (inst?)
             (("1" (assert)) ("2" (skosimp*))))))
          ("2"
           (replace -4 1)
           (rewrite "rows_form_matrix")
           (skosimp*))))))))
    ("2"
     (hide 2)
     (typepred "dg")
     (assert)
     (expand "diagonal?")
     (skosimp*)
     (inst - "i!1" "j!1")
     (inst - "i!1" "j!1")
     (assert)
     (rewrite "entry_eq_0" 3)
     (ground))))


proof_type: t_proof
decl_type: tcc
library: matrices
theory: matrix_inv
signature: nil
run_date: Unknown date
run_time: ----
status: proved-incomplete
description: nil
script:
  (""
   (skeep)
   (typepred "SQ")
   (assert)
   (expand "invertible?")
   (skeep)
   (lemma "det_mult")
   (inst - "IQ" "SQ")
   (assert)
   (lemma "det_Id")
   (inst?)
   (assert))


proof_type: t_proof
decl_type: tcc
library: matrices
theory: matrix_inv
signature: nil
run_date: Unknown date
run_time: ----
status: proved-incomplete
description: nil
script:
  (""
   (skeep)
   (assert)
   (typepred "left_inv(SQ)")
   (("1"
     (assert)
     (rewrite "mult_left_inv_right")
     (typepred "SQ")
     (assert)
     (expand "invertible?")
     (skeep)
     (assert)
     (lemma "det_mult")
     (assert)
     (inst - "IQ" "SQ")
     (assert)
     (lemma "det_Id")
     (inst?)
     (assert))
    ("2"
     (hide 2)
     (typepred "SQ")
     (assert)
     (expand "invertible?")
     (skeep)
     (lemma "det_mult")
     (inst - "IQ" "SQ")
     (assert)
     (lemma "det_Id")
     (inst?)
     (assert))))


proof_type: t_proof
decl_type: tcc
library: matrices
theory: matrix_inv
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skeep)
   (rewrite "rows_mult")
   (rewrite "columns_mult")
   (("1" (assert))
    ("2" (typepred "S") (expand "rows") (expand "length") (assert))))


proof_type: t_proof
decl_type: tcc
library: matrices
theory: matrix_inv
signature: nil
run_date: Unknown date
run_time: ----
status: proved-incomplete
description: nil
script:
  (""
   (skeep)
   (assert)
   (lemma "det_mult")
   (inst - "R" "S")
   (assert)
   (rewrite "invertible_det")
   (rewrite "invertible_det")
   (rewrite "invertible_det")
   (("1"
     (assert)
     (case "FORALL (izb:bool): (izb OR izb) = izb")
     (("1"
       (rewrite -1)
       (rewrite -1)
       (rewrite -1)
       (hide -1)
       (lemma "nzreal_times_nzreal_is_nzreal")
       (inst - "det(S)" "det(R)")
       (rewrite "rows_mult")
       (rewrite "columns_mult")
       (("1" (assert))
        ("2" (typepred "S") (expand "rows") (expand "length") (assert))))
      ("2" (hide 2) (skosimp*) (iff) (ground))))
    ("2"
     (hide 2)
     (rewrite "rows_mult")
     (rewrite "columns_mult")
     (("1" (assert))
      ("2" (typepred "S") (expand "rows") (expand "length") (assert))))))


proof_type: t_proof
decl_type: tcc
library: matrices
theory: matrix_inv
signature: nil
run_date: Unknown date
run_time: ----
status: proved-incomplete
description: nil
script:
  (""
   (skeep)
   (rewrite "invertible_det")
   (rewrite "invertible_det")
   (rewrite "det_inverse")
   (("1" (ground)) ("2" (ground))))


proof_type: t_proof
decl_type: tcc
library: matrices
theory: matrix_inv
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skeep)
   (skeep)
   (rewrite "rows_mult")
   (rewrite "columns_mult")
   (("1" (assert))
    ("2" (typepred "Q") (expand "rows") (expand "length") (assert))))


proof_type: f_proof
decl_type: formula
library: matrices
theory: tensor_product
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skeep)
   (expand "tensor_prod")
   (decompose-equality)
   (rewrite "entry_form_matrix")
   (lift-if)
   (ground)
   (("1" (expand "tensor_fun") (propax))
    ("2" (expand "tensor_fun") (propax))))


proof_type: f_proof
decl_type: formula
library: matrices
theory: tensor_product
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skosimp*)
   (lemma "rows_form_matrix")
   (inst -1 "rows(A!1) * rows(B!1)" "columns(A!1) * columns(B!1)"
    "tensor_fun(A!1, B!1)")
   (expand "tensor_prod")
   (propax))


proof_type: f_proof
decl_type: formula
library: matrices
theory: tensor_product
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skosimp*)
   (lemma "columns_form_matrix")
   (expand "tensor_prod")
   (inst -1 "rows(A!1)*rows(B!1)" "columns(A!1)*columns(B!1)"
    "tensor_fun(A!1, B!1)")
   (split)
   (("1"
     (lemma "zero_times3")
     (inst -1 "rows(A!1)" "rows(B!1)")
     (flatten)
     (hide -2)
     (prop)
     (("1" (typepred (A!1)) (ground)) ("2" (typepred (B!1)) (ground))))
    ("2" (propax))))


proof_type: f_proof
decl_type: formula
library: matrices
theory: tensor_product
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skeep)
   (lemma "entry_mult")
   (inst-cp -1 "tensor_prod(A,B)" "tensor_prod(A2, B2)" "m1" "n1")
   (case "m1<rows(tensor_prod(A,B)) AND n1<columns(tensor_prod(A2, B2))")
   (("1"
     (lift-if -3)
     (split -3)
     (("1"
       (flatten)
       (hide (-1 -2))
       (lemma "form_matrix_mult")
       (inst -1 "tensor_fun(A,B)" "tensor_fun(A2, B2)" "rows(A)*rows(B)"
        "columns(A)*columns(B)" "columns(A2)*columns(B2)")
       (expand "tensor_prod" 1)
       (replace -6 1 :dir rl)
       (replace -7 1 :dir rl)
       (split -1)
       (("1"
         (replace -1)
         (lemma "entry_form_matrix")
         (inst -1
          "LAMBDA (i, j: nat):
                                    IF i > rows(A) * rows(B) OR
                                        j > columns(A2) * columns(B2)
                                      THEN 0
                                    ELSE sigma(0,
                                               columns(A) * columns(B) - 1,
                                               LAMBDA
                                               (d: nat):
                                               tensor_fun(A, B)(i, d)
                                               *
                                               tensor_fun(A2, B2)(d, j))
                                    ENDIF"
          "m1" "n1" "rows(A)*rows(B)" "columns(A2)*columns(B2)")
         (("1"
           (lemma "tensor_rows")
           (inst -1 "A" "B")
           (lemma "tensor_cols")
           (inst -1 "A2" "B2")
           (replace -2 -6)
           (replace -1 -7)
           (case-replace
            "IF m1 < rows(A) * rows(B) AND n1 < columns(A2) * columns(B2)
                     THEN IF m1 > rows(A) * rows(B) OR n1 > columns(A2) * columns(B2)
                            THEN 0
                          ELSE sigma(0, columns(A) * columns(B) - 1,
                                     LAMBDA (d: nat):
                                       tensor_fun(A, B)(m1, d) *
                                        tensor_fun(A2, B2)(d, n1))
                          ENDIF
                   ELSE 0
                   ENDIF = sigma(0, columns(A) * columns(B) - 1,
                                     LAMBDA (d: nat):
                                       tensor_fun(A, B)(m1, d) *
                                        tensor_fun(A2, B2)(d, n1))")
           (("1"
             (replace -4)
             (hide (-1 -4 -5))
             (expand "tensor_fun")
             (lemma "sigma_eq")
             (inst -1
              "LAMBDA (d: nat):
                            IF m1 < rows(A) * rows(B)
                              THEN IF d < columns(A) * columns(B)
                                     THEN entry(A)
                                               ((m1 - mod(m1, rows(B))) / rows(B),
                                                (d - mod(d, columns(B))) / columns(B))
                                           *
                                           entry(B)(mod(m1, rows(B)), mod(d, columns(B)))
                                   ELSE 0
                                   ENDIF
                            ELSE 0
                            ENDIF
                             *
                             IF d < rows(A2) * rows(B2)
                               THEN IF n1 < columns(A2) * columns(B2)
                                      THEN entry(A2)
                                                ((d - mod(d, rows(B2))) / rows(B2),
                                                 (n1 - mod(n1, columns(B2))) /
                                                  columns(B2))
                                            *
                                            entry(B2)
                                                 (mod(d, rows(B2)), mod(n1, columns(B2)))
                                    ELSE 0
                                    ENDIF
                             ELSE 0
                             ENDIF"
              "LAMBDA (d: nat):
                             entry(A)
                                               ((m1 - mod(m1, rows(B))) / rows(B),
                                                (d - mod(d, columns(B))) / columns(B))
                                           *
                                           entry(B)(mod(m1, rows(B)), mod(d, columns(B)))

                             *
                              entry(A2)
                                                ((d - mod(d, rows(B2))) / rows(B2),
                                                 (n1 - mod(n1, columns(B2))) /
                                                  columns(B2))
                                            *
                                            entry(B2)
                                                 (mod(d, rows(B2)), mod(n1, columns(B2)))
                                    "
              "columns(A)*columns(B)-1" "0")
             (("1"
               (split -1)
               (("1"
                 (replace -1)
                 (lemma "sigma_product2")
                 (hide -2)
                 (replace -9 1 :dir rl)
                 (inst -1
                  "LAMBDA (d:nat): entry(A)
                                     ((m1 - mod(m1, rows(B))) / rows(B),
                                      d)* entry(A2)
                                      (d,
                                       (n1 - mod(n1, columns(B2))) / columns(B2))"
                  "LAMBDA (d:nat):
                   entry(B)(mod(m1, rows(B)), d)*entry(B2)(d, mod(n1, columns(B2)))"
                  "columns(A)" "columns(B)")
                 (("1"
                   (replace -1 :dir rl)
                   (lemma "matrix2array")
                   (case "FORALL (M, M2: PosFullMatrix, r, c:nat): columns(M) =rows(M2) AND r<rows(M) AND c<columns(M2) IMPLIES
                                       entry(M*M2)(r,c) = sigma(0, columns(M)-1, LAMBDA(d:nat): entry(M)(r,d)*entry(M2)(d, c))")
                   (("1"
                     (inst -1 "A" "A2"
                      "(m1 - mod(m1, rows(B))) / rows(B)"
                      "             (n1 - mod(n1, columns(B2))) / columns(B2)")
                     (("1"
                       (split -1)
                       (("1"
                         (replace -1)
                         (hide (-1 -3 -9))
                         (reveal -4)
                         (inst -1 "B" "B2" "mod(m1, rows(B))"
                          "mod(n1, columns(B2))")
                         (("1"
                           (split -1)
                           (("1" (replace -1) (propax)) ("2" (propax))
                            ("3"
                             (lemma "mod_pos")
                             (inst -1 "m1" "rows(B)")
                             (ground))
                            ("4"
                             (lemma "mod_pos")
                             (inst -1 "n1" "columns(B2)")
                             (ground))))
                          ("2"
                           (lemma "mod_pos")
                           (inst -1 "n1" "columns(B2)")
                           (ground))
                          ("3"
                           (lemma "mod_pos")
                           (inst -1 "m1" "rows(B)")
                           (ground))))
                        ("2" (propax))
                        ("3"
                         (hide-all-but (1 -6))
                         (lemma "mod_pos")
                         (inst -1 "m1" "rows(B)")
                         (ground)
                         (cross-mult 1))
                        ("4"
                         (hide-all-but (1 -7))
                         (cross-mult 1)
                         (lemma "mod_pos")
                         (inst -1 "n1" "columns(B2)")
                         (ground))))
                      ("2"
                       (hide-all-but 1)
                       (grind)
                       (case "n1/columns(B2)>=0")
                       (("1" (cross-mult 1) (grind))
                        ("2" (cross-mult 1))))
                      ("3"
                       (hide-all-but 1)
                       (grind)
                       (case "m1/rows(B)>=0")
                       (("1" (cross-mult 1) (grind)) ("2" (cross-mult 1))
                        ("3" (cross-mult 1) (grind))))))
                    ("2"
                     (hide-all-but (-1 1))
                     (skeep)
                     (inst-cp -4 "M")
                     (inst -4 "M2")
                     (case-replace
                      "M*M2 = form_matrix(entry(M), rows(M), columns(M))* form_matrix(entry(M2), rows(M2), columns(M2))")
                     (("1"
                       (lemma "form_matrix_mult")
                       (inst -1 "entry(M)" "entry(M2)" "rows(M)"
                        "columns(M)" "columns(M2)")
                       (split -1)
                       (("1"
                         (replace -3)
                         (replace -1)
                         (lemma "entry_form_matrix2")
                         (inst -1
                          "LAMBDA (i, j: nat):
                                                    IF i > rows(M) OR j > columns(M2) THEN 0
                                                    ELSE sigma(0,
                                                               rows(M2) - 1,
                                                               LAMBDA
                                                               (d: nat):
                                                               entry(M)(i, d) * entry(M2)(d, j))
                                                    ENDIF"
                          "r" "c" "rows(M)" "columns(M2)")
                         (hide (-2 -3))
                         (prop)
                         (lift-if -1)
                         (prop)
                         (("1" (ground)) ("2" (ground))))
                        ("2" (ground)) ("3" (ground))))
                      ("2" (ground))))))
                  ("2"
                   (hide-all-but 1)
                   (lemma "mod_pos")
                   (inst -1 "n1" "columns(B2)")
                   (ground))
                  ("3"
                   (hide-all-but 1)
                   (lemma "mod_pos")
                   (inst -1 "m1" "rows(B)")
                   (ground))
                  ("4"
                   (hide-all-but 1)
                   (grind)
                   (case "n1/columns(B2)>=0")
                   (("1" (cross-mult 1) (grind)) ("2" (cross-mult 1))))
                  ("5"
                   (hide-all-but 1)
                   (grind)
                   (case "m1/rows(B)>=0")
                   (("1" (cross-mult 1) (grind)) ("2" (cross-mult 1))
                    ("3" (cross-mult 1) (grind))))))
                ("2"
                 (hide 2)
                 (skeep)
                 (typepred (n))
                 (case "n<columns(A)*columns(B) AND n<rows(A2)*rows(B2)")
                 (("1" (lift-if 1) (prop) (lift-if 1) (prop) (ground))
                  ("2" (hide (-3 -4 -5 -8 2)) (grind))))))
              ("2"
               (lemma "mod_pos")
               (inst -1 "n1" "columns(B2)")
               (ground))
              ("3"
               (skeep)
               (lemma "mod_pos")
               (inst -1 "d" "rows(B2)")
               (ground))
              ("4"
               (hide-all-but 1)
               (grind)
               (cross-mult)
               (case "n1/columns(B2)>=0")
               (("1" (ground)) ("2" (grind) (cross-mult 1))))
              ("5"
               (hide-all-but 1)
               (skeep)
               (grind)
               (case "d/rows(B2)>=0")
               (("1" (cross-mult 1) (grind)) ("2" (cross-mult 1))
                ("3" (cross-mult 1) (grind))))
              ("6"
               (hide-all-but 1)
               (skeep)
               (lemma "mod_pos")
               (inst -1 "d" "columns(B)")
               (ground))
              ("7"
               (hide-all-but 1)
               (lemma "mod_pos")
               (inst -1 "m1" "rows(B)")
               (ground))
              ("8"
               (hide-all-but 1)
               (skeep)
               (grind)
               (case "d/columns(B)>=0")
               (("1" (cross-mult 1) (grind)) ("2" (cross-mult 1))))
              ("9"
               (hide-all-but 1)
               (grind)
               (case "m1/rows(B)>=0")
               (("1" (cross-mult 1) (grind)) ("2" (cross-mult 1))
                ("3" (cross-mult 1) (grind))))
              ("10"
               (hide-all-but 1)
               (skeep)
               (lemma "mod_pos")
               (inst -1 "n1" "columns(B2)")
               (ground))
              ("11"
               (hide-all-but 1)
               (skeep)
               (lemma "mod_pos")
               (inst -1 "d" "rows(B2)")
               (ground))
              ("12"
               (hide-all-but 1)
               (skeep)
               (grind)
               (case "n1/columns(B2)>=0")
               (("1" (cross-mult 1) (grind)) ("2" (cross-mult 1))))
              ("13"
               (hide-all-but 1)
               (skeep)
               (grind)
               (case "d/rows(B2)>=0")
               (("1" (cross-mult 1) (grind)) ("2" (cross-mult 1))))
              ("14"
               (hide-all-but 1)
               (skeep)
               (lemma "mod_pos")
               (inst -1 "d" "columns(B)")
               (ground))
              ("15"
               (hide-all-but 1)
               (skeep)
               (lemma "mod_pos")
               (inst -1 "m1" "rows(B)")
               (ground))
              ("16"
               (hide-all-but 1)
               (skeep)
               (grind)
               (case "d/columns(B)>=0")
               (("1" (cross-mult 1) (grind)) ("2" (cross-mult 1))))
              ("17"
               (hide-all-but 1)
               (skeep)
               (grind)
               (case "m1/rows(B)>=0")
               (("1" (cross-mult 1) (grind)) ("2" (cross-mult 1))))))
            ("2" (hide-all-but (-6 -7 1)) (ground))
            ("3"
             (hide-all-but 1)
             (typepred (A))
             (typepred (B))
             (mult-ineq -4 -8)
             (ground))
            ("4"
             (hide-all-but 1)
             (typepred (A))
             (typepred (B))
             (mult-ineq -4 -8)
             (ground))))
          ("2"
           (hide-all-but 1)
           (skeep)
           (typepred (B))
           (typepred (A))
           (mult-ineq -4 -8)
           (hide-all-but (-1 3))
           (ground))))
        ("2"
         (hide-all-but 1)
         (grind)
         (typepred (A))
         (typepred (B))
         (hide-all-but (-4 -8 1))
         (mult-ineq -1 -2)
         (ground))
        ("3"
         (hide-all-but 1)
         (typepred (A))
         (typepred (B))
         (hide-all-but (-3 -7 1))
         (mult-ineq -1 -2)
         (ground))))
      ("2" (flatten) (ground))))
    ("2"
     (lift-if -2)
     (split -2)
     (("1" (flatten) (ground))
      ("2"
       (flatten)
       (replace -1)
       (hide 2)
       (split 1)
       (("1"
         (inst -2 "A" "A2" "(m1 - mod(m1, rows(B))) / rows(B)"
          "             (n1 - mod(n1, columns(B2))) / columns(B2)")
         (("1"
           (lift-if -2)
           (split -2)
           (("1"
             (flatten)
             (hide-all-but (1 -1))
             (lemma "tensor_rows")
             (inst -1 "A" "B")
             (replace -1)
             (hide -1)
             (case "FORALL (a,b:nat): a<b IMPLIES a<=b-1")
             (("1"
               (inst -1 "(m1 - mod(m1, rows(B))) / rows(B)" "rows(A)")
               (("1"
                 (prop)
                 (cross-mult -1)
                 (lemma "mod_pos")
                 (inst -1 "m1" "rows(B)")
                 (flatten)
                 (grind))
                ("2"
                 (hide-all-but 1)
                 (grind)
                 (case "m1/rows(B)>=0")
                 (("1" (cross-mult 1) (grind)) ("2" (cross-mult 1))
                  ("3" (cross-mult 1) (grind))))))
              ("2" (hide-all-but 1) (skeep) (grind))))
            ("2" (flatten) (replace -1) (ground))))
          ("2"
           (typepred (B2))
           (lemma "mod_pos")
           (inst -1 "n1" "columns(B2)")
           (flatten)
           (hide-all-but 1)
           (grind)
           (case "n1/columns(B2)>=0")
           (("1" (cross-mult 1) (grind)) ("2" (cross-mult 1))))
          ("3"
           (hide-all-but 1)
           (grind)
           (case "m1/rows(B)>=0")
           (("1" (cross-mult 1) (grind)) ("2" (cross-mult 1))
            ("3" (cross-mult 1) (grind))))))
        ("2"
         (inst -2 "A" "A2" "(m1 - mod(m1, rows(B))) / rows(B)"
          "             (n1 - mod(n1, columns(B2))) / columns(B2)")
         (("1"
           (lift-if -2)
           (split -2)
           (("1"
             (flatten)
             (hide-all-but (-2 1))
             (case "FORALL (a,b:nat): a<b IMPLIES a<=b-1")
             (("1"
               (inst -1 "(n1 - mod(n1, columns(B2))) / columns(B2) "
                " columns(A2)")
               (("1"
                 (prop)
                 (lemma "tensor_cols")
                 (inst -1 "A2" "B2")
                 (replace -1)
                 (cross-mult -2)
                 (lemma "mod_pos")
                 (inst -1 "n1" "columns(B2)")
                 (flatten)
                 (hide -3)
                 (grind))
                ("2"
                 (hide-all-but 1)
                 (grind)
                 (case "n1/columns(B2)>=0")
                 (("1" (cross-mult 1) (grind)) ("2" (cross-mult 1))))))
              ("2" (hide-all-but 1) (skeep) (grind))))
            ("2" (flatten) (replace -1) (ground))))
          ("2"
           (hide-all-but 1)
           (grind)
           (case "n1/columns(B2)>=0")
           (("1" (cross-mult 1) (grind)) ("2" (cross-mult 1))))
          ("3"
           (hide-all-but 1)
           (grind)
           (case "m1/rows(B)>=0")
           (("1" (cross-mult 1) (grind)) ("2" (cross-mult 1))
            ("3" (cross-mult 1) (grind))))))))))))


proof_type: f_proof
decl_type: formula
library: matrices
theory: tensor_product
signature: nil
run_date: Unknown date
run_time: ----
status: proved-incomplete
description: nil
script:
  (""
   (skeep)
   (expand "invertible?")
   (skolem -1 "AAinv")
   (skolem -2 "BBinv")
   (lemma "inverse_unique")
   (inst-cp -1 "AAinv" "AA")
   (inst -1 "BBinv" "BB")
   (lemma "inverse_unique")
   (flatten)
   (split -2)
   (("1"
     (flatten)
     (replace -2 :dir rl)
     (split -6)
     (("1"
       (flatten)
       (replace -2 :dir rl)
       (inst -9 "tensor_prod(AAinv, BBinv)" "tensor_prod(AA, BB)")
       (("1"
         (split -9)
         (("1"
           (flatten)
           (replace -2 :dir rl)
           (expand "invertible?")
           (propax))
          ("2"
           (hide 4)
           (rewrite "tensor_rows")
           (rewrite "tensor_rows")
           (ground))
          ("3"
           (hide 4)
           (case "tensor_prod(AA, BB) * tensor_prod(AAinv, BBinv) =
                                                      Id(rows(tensor_prod(AA, BB)))")
           (("1" (ground))
            ("2"
             (hide 2)
             (lemma "full_matrix_eq")
             (inst -1 "tensor_prod(AA, BB) * tensor_prod(AAinv, BBinv) "
              "       Id(rows(tensor_prod(AA, BB)))")
             (flatten)
             (hide -1)
             (lemma "rows_mult")
             (inst -1 "tensor_prod(AA, BB) "
              " tensor_prod(AAinv, BBinv)")
             (replace -1)
             (lemma "rows_Id")
             (inst -1 "rows(tensor_prod(AA,BB))")
             (replace -1)
             (hide (-1 -2))
             (lemma "columns_mult")
             (inst -1 "tensor_prod(AA, BB) "
              " tensor_prod(AAinv, BBinv)")
             (split -1)
             (("1"
               (lemma "columns_Id")
               (inst -1 "rows(tensor_prod(AA,BB))")
               (replace -1)
               (replace -2)
               (lemma "tensor_cols")
               (inst -1 "AAinv" "BBinv")
               (typepred (AAinv))
               (replace -5 :dir rl)
               (hide (-1 -2 -3 -4 -5))
               (typepred (BBinv))
               (replace -5 :dir rl)
               (hide (-1 -2 -3 -4 -5))
               (lemma "tensor_rows")
               (inst? -1)
               (replace -14)
               (replace -17)
               (replace -1)
               (replace -2)
               (split -5)
               (("1" (propax))
                ("2"
                 (skeep)
                 (lemma "tensor_mult_entry")
                 (inst -1 "AA" "AAinv" "BB" "BBinv" "i" "j")
                 (typepred (AA))
                 (replace -5 -6 :dir rl)
                 (hide (-1 -2 -3 -4 -5))
                 (typepred (BB))
                 (replace -5 -6 :dir rl)
                 (hide (-1 -2 -3 -4 -5))
                 (split -1)
                 (("1"
                   (replace -1 1)
                   (typepred (BBinv))
                   (replace -5 1 :dir rl)
                   (hide (-1 -2 -3 -4 -5))
                   (replace -17 1)
                   (replace -9 1)
                   (replace -13 1)
                   (lemma "entry_Id")
                   (inst-cp -1 "i" "j" "rows(AA)*rows(BB)")
                   (inst-cp -1 "(i - mod(i, rows(BB))) / rows(BB)"
                    "(j - mod(j, rows(BB))) / rows(BB)" "rows(AA)")
                   (("1"
                     (inst -1 "mod(i, rows(BB))" "mod(j, rows(BB))"
                      "rows(BB)")
                     (("1"
                       (case "mod(i, rows(BB))<rows(BB) AND mod(j, rows(BB))<rows(BB)")
                       (("1"
                         (case "(i - mod(i, rows(BB))) / rows(BB) < rows(AA) AND (j - mod(j, rows(BB))) / rows(BB) < rows(AA)")
                         (("1"
                           (case-replace
                            "mod(i, rows(BB)) = mod(j, rows(BB))")
                           (("1"
                             (case-replace "i=j")
                             (("1"
                               (lift-if -4)
                               (split -4)
                               (("1"
                                 (flatten)
                                 (split -1)
                                 (("1" (ground))
                                  ("2" (ground))
                                  ("3" (ground))))
                                ("2"
                                 (flatten)
                                 (replace -2)
                                 (lift-if -8)
                                 (split -8)
                                 (("1"
                                   (flatten)
                                   (split -1)
                                   (("1" (ground))
                                    ("2" (ground))
                                    ("3" (ground))))
                                  ("2"
                                   (flatten)
                                   (replace -2)
                                   (lift-if -8)
                                   (split -8)
                                   (("1"
                                     (flatten)
                                     (split -1)
                                     (("1" (ground))
                                      ("2" (ground))
                                      ("3" (ground))))
                                    ("2"
                                     (flatten)
                                     (replace -2)
                                     (propax))))))))
                              ("2"
                               (case "(i - mod(j, rows(BB))) / rows(BB) /= (j - mod(j, rows(BB))) / rows(BB)")
                               (("1"
                                 (lift-if -5)
                                 (split -5)
                                 (("1"
                                   (flatten)
                                   (split -1)
                                   (("1" (ground))
                                    ("2" (ground))
                                    ("3" (ground))))
                                  ("2"
                                   (flatten)
                                   (replace -2)
                                   (lift-if -8)
                                   (split -8)
                                   (("1"
                                     (flatten)
                                     (split -1)
                                     (("1" (ground))
                                      ("2" (ground))
                                      ("3"
                                       (replace -2)
                                       (lift-if -9)
                                       (split -9)
                                       (("1"
                                         (flatten)
                                         (split -1)
                                         (("1" (ground))
                                          ("2" (ground))
                                          ("3" (replace -2) (propax))))
                                        ("2" (flatten))))))
                                    ("2" (flatten))))))
                                ("2"
                                 (hide (-4 -5 -6))
                                 (simplify 1)
                                 (expand "/=")
                                 (cross-mult -1)
                                 (cancel-by -1 "rows(BB)"))))))
                            ("2"
                             (lift-if -3)
                             (split -3)
                             (("1"
                               (flatten)
                               (split -1)
                               (("1" (ground)) ("2" (ground))
                                ("3"
                                 (replace -2)
                                 (case "i/=j")
                                 (("1"
                                   (lift-if -9)
                                   (split -9)
                                   (("1"
                                     (flatten)
                                     (split -1)
                                     (("1" (ground))
                                      ("2" (ground))
                                      ("3"
                                       (replace -2)
                                       (simplify 4)
                                       (propax))))
                                    ("2" (flatten))))
                                  ("2"
                                   (expand "/=")
                                   (replace -1)
                                   (propax))))))
                              ("2" (flatten))))))
                          ("2"
                           (split 1)
                           (("1"
                             (typepred (i))
                             (lemma "rows_mult")
                             (inst -1 "tensor_prod(AA, BB)"
                              "tensor_prod(AAinv, BBinv)")
                             (replace -1)
                             (replace -8 -2)
                             (cross-mult 1)
                             (lemma "mod_pos")
                             (inst -1 "i" "rows(BB)")
                             (flatten)
                             (hide-all-but (-1 -2 -4 1))
                             (ground))
                            ("2"
                             (typepred (j))
                             (replace -10 -1)
                             (lemma "mod_pos")
                             (inst -1 "j" "rows(BB)")
                             (flatten)
                             (hide-all-but (-1 -2 -3 1))
                             (cross-mult 1)
                             (ground))))))
                        ("2"
                         (lemma "mod_pos")
                         (split 1)
                         (("1" (inst -1 "i" "rows(BB)") (flatten))
                          ("2" (inst -1 "j" "rows(BB)") (flatten))))))
                      ("2"
                       (lemma "mod_pos")
                       (inst -1 "j" "rows(BB)")
                       (flatten))
                      ("3"
                       (lemma "mod_pos")
                       (inst -1 "i" "rows(BB)")
                       (flatten))))
                    ("2"
                     (hide (-1 -2 2 3 4))
                     (typepred (j))
                     (replace -5)
                     (lemma "mod_pos")
                     (inst -1 "j" "rows(BB)")
                     (flatten)
                     (hide-all-but (-1 -2 -3 1))
                     (split)
                     (("1" (grind))
                      ("2"
                       (cross-mult)
                       (expand "mod")
                       (case "j>=0")
                       (("1"
                         (div-by -1 "rows(BB)")
                         (ground)
                         (typepred ("rows(BB)"))
                         (case "floor(j/rows(BB))>=0")
                         (("1" (mult-ineq -1 -2) (ground))
                          ("2" (grind))))
                        ("2" (ground))))))
                    ("3"
                     (lemma "mod_pos")
                     (inst -1 "i" "rows(BB)")
                     (typepred (i))
                     (reveal -18)
                     (replace -1)
                     (hide-all-but (-2 -3 1))
                     (flatten)
                     (split)
                     (("1" (grind))
                      ("2"
                       (case "i>=0")
                       (("1"
                         (expand "mod")
                         (cross-mult 1)
                         (typepred ("rows(BB)"))
                         (div-by -2 "rows(BB)")
                         (case "floor(i/rows(BB))>=0")
                         (("1" (mult-ineq -1 -2) (grind))
                          ("2"
                           (case "i/rows(BB)>=0")
                           (("1" (ground)) ("2" (ground))))))
                        ("2" (ground))))))))
                  ("2" (ground)) ("3" (ground))))))
              ("2"
               (case "nonempty?(tensor_prod(AA, BB))")
               (("1"
                 (name-replace "TP" "tensor_prod(AA, BB)")
                 (hide-all-but (-1 -2))
                 (grind))
                ("2"
                 (lemma "tensor_rows")
                 (inst? -1)
                 (typepred (AA))
                 (typepred (BB))
                 (hide (-1 -2 -6 -7))
                 (lemma "tensor_cols")
                 (inst? -1)
                 (mult-ineq -6 -3)
                 (mult-ineq -6 -3)
                 (expand "nonempty?")
                 (replace -3)
                 (replace -10)
                 (hide-all-but (-1 -2 1))
                 (grind))))))))))
        ("2"
         (hide-all-but 1)
         (lemma "tensor_rows")
         (inst?)
         (replace -1)
         (lemma "tensor_cols")
         (inst?)
         (replace -1)
         (typepred (AA))
         (replace -5)
         (hide -)
         (typepred (BB))
         (replace -5)
         (propax))
        ("3"
         (hide-all-but 1)
         (lemma "tensor_rows")
         (inst?)
         (replace -1)
         (lemma "tensor_cols")
         (inst?)
         (replace -1)
         (typepred (AAinv))
         (replace -5)
         (hide -)
         (typepred (BBinv))
         (replace -5)
         (propax))))
      ("2" (propax)) ("3" (ground))))
    ("2" (propax)) ("3" (ground))))


proof_type: f_proof
decl_type: formula
library: matrices
theory: tensor_product
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (expand "invertible?")
   (inst 1 "TQMatInv")
   (split)
   (("1" (grind)) ("2" (grind)) ("3" (grind))))


proof_type: f_proof
decl_type: formula
library: matrices
theory: tensor_product
signature: nil
run_date: Unknown date
run_time: ----
status: proved-incomplete
description: nil
script:
  (""
   (lemma "inverse_unique")
   (case "TQMat*TQMatInv = Id(rows(TQMat))")
   (("1"
     (inst -2 "TQMatInv" "TQMat")
     (split -2)
     (("1" (flatten) (ground)) ("2" (hide (-1 2)) (grind))
      ("3" (ground))))
    ("2" (hide (-1 2)) (grind)) ("3" (hide (-1 2)) (grind))))


proof_type: f_proof
decl_type: formula
library: matrices
theory: tensor_product
signature: nil
run_date: Unknown date
run_time: ----
status: proved-incomplete
description: nil
script:
  (""
   (induct "n")
   (("1" (ground)) ("2" (ground))
    ("3"
     (skeep)
     (case-replace "j=0")
     (("1" (skeep) (expand "tensor_power") (propax))
      ("2"
       (skeep)
       (case-replace
        "tensor_power(A, j+1) = tensor_prod(A, tensor_power(A, j))")
       (("1"
         (case-replace
          "tensor_power(inverse(A), j+1) = tensor_prod(inverse(A), tensor_power(inverse(A), j))")
         (("1"
           (case "invertible?(inverse(A))")
           (("1"
             (split -4)
             (("1"
               (inst-cp -1 "A")
               (split -2)
               (("1"
                 (flatten)
                 (replace -2 :dir rl)
                 (lemma "invertible_tensor")
                 (inst -1 "A" "tensor_power(A, j)")
                 (ground))
                ("2" (propax))))
              ("2" (ground))))
            ("2"
             (expand "invertible?" 1)
             (expand "invertible?")
             (skeep -5)
             (case "IQ= inverse(A)")
             (("1" (inst 1 "A") (replace -1) (ground))
              ("2"
               (lemma "inverse_unique")
               (inst -1 "IQ" "A")
               (ground))))))
          ("2"
           (name-replace "TP" "tensor_power(inverse(A),j)")
           (expand "tensor_power")
           (lift-if 1)
           (split 1)
           (("1" (flatten)) ("2" (flatten) (expand "TP") (propax))))
          ("3" (ground))))
        ("2"
         (name-replace "TP" "tensor_power(A,j)")
         (expand "tensor_power")
         (lift-if 1)
         (split 1)
         (("1" (ground))
          ("2"
           (ground)
           (("1" (expand "TP") (propax)) ("2" (expand "TP") (propax))))))
        ("3" (ground))))))
    ("4" (skeep) (skeep))
    ("5" (lemma "invertible_tensor_power_TCC2") (skeep) (inst?))
    ("6" (lemma "invertible_tensor_power_TCC1") (skeep) (inst?))))


proof_type: f_proof
decl_type: formula
library: matrices
theory: tensor_product
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skolem 1 ("A" "_"))
   (induct "n")
   (("1" (ground)) ("2" (flatten) (ground))
    ("3"
     (skeep)
     (split -1)
     (("1"
       (expand "tensor_power" 1)
       (lift-if 1)
       (split 1)
       (("1" (flatten) (ground) (grind))
        ("2"
         (flatten)
         (rewrite "tensor_rows")
         (expand "^")
         (expand "expt" 2)
         (ground))))
      ("2"
       (case-replace "j=0")
       (("1"
         (expand "tensor_power")
         (expand "^")
         (expand "expt")
         (expand "expt")
         (propax))
        ("2"
         (expand "tensor_power")
         (lift-if 3)
         (split 3)
         (("1" (flatten)) ("2" (flatten) (ground))))))))))


proof_type: f_proof
decl_type: formula
library: matrices
theory: tensor_product
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skolem 1 ("A" "_"))
   (induct "n")
   (("1" (ground)) ("2" (flatten) (ground))
    ("3"
     (skeep)
     (split -1)
     (("1"
       (expand "tensor_power" 1)
       (lift-if 1)
       (split 1)
       (("1" (flatten) (ground) (grind))
        ("2"
         (flatten)
         (rewrite "tensor_cols")
         (expand "^")
         (expand "expt" 2)
         (ground))))
      ("2"
       (case-replace "j=0")
       (("1"
         (expand "tensor_power")
         (expand "^")
         (expand "expt")
         (expand "expt")
         (propax))
        ("2"
         (expand "tensor_power")
         (lift-if 3)
         (split 3)
         (("1" (flatten)) ("2" (flatten) (ground))))))))))


proof_type: f_proof
decl_type: formula
library: matrices
theory: tensor_product
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skeep)
   (lemma "mod_sum")
   (inst - "mod(i,n)" "n" "mod((i - mod(i, n)) / n, m)")
   (("1"
     (replaces -1)
     (assert)
     (assert)
     (case "mod(mod(i,n),n) = mod(i,n)")
     (("1" (assert))
      ("2" (hide 2) (lemma "mod_of_mod") (inst - "0" "i" "n") (assert))))
    ("2" (hide 2) (lemma "mod_int_quot") (inst?) (assert))))


proof_type: f_proof
decl_type: formula
library: matrices
theory: tensor_product
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skeep)
   (rewrite "full_matrix_eq")
   (case "NOT (rows(tensor_prod(A, tensor_prod(B, C))) =
                        rows(tensor_prod(tensor_prod(A, B), C))
                        AND
                        columns(tensor_prod(A, tensor_prod(B, C))) =
                         columns(tensor_prod(tensor_prod(A, B), C)))")
   (("1"
     (hide 2)
     (split)
     (("1"
       (rewrite "tensor_rows")
       (rewrite "tensor_rows")
       (rewrite "tensor_rows")
       (rewrite "tensor_rows")
       (assert))
      ("2"
       (rewrite "tensor_cols")
       (rewrite "tensor_cols")
       (rewrite "tensor_cols")
       (rewrite "tensor_cols")
       (assert))))
    ("2"
     (flatten)
     (assert)
     (skeep)
     (rewrite "entry_tensor_prod")
     (rewrite "entry_tensor_prod")
     (typepred "i")
     (typepred "j")
     (copy -2)
     (copy -2)
     (rewrite "tensor_cols" -1)
     (rewrite "tensor_cols" -1)
     (rewrite "tensor_rows" -2)
     (rewrite "tensor_rows" -2)
     (assert)
     (expand "tensor_fun" +)
     (rewrite "tensor_rows" 1)
     (rewrite "tensor_rows" 1)
     (rewrite "tensor_cols" 1)
     (rewrite "tensor_cols" 1)
     (assert)
     (rewrite "entry_tensor_prod" 1)
     (rewrite "entry_tensor_prod" 1)
     (expand "tensor_fun" +)
     (label "igz" 1)
     (hide "igz")
     (case "NOT FORALL (MN:Matrix,ii,jj,kk,pp:nat): (ii=kk AND jj=pp) IMPLIES entry(MN)(ii,jj) = entry(MN)(kk,pp)")
     (("1" (skeep) (assert))
      ("2"
       (case "NOT FORALL (aa,bb,cc,dd,ee,ff:real): (aa=dd AND bb=ee AND cc=ff) IMPLIES aa*(bb*cc)=(dd*ee)*ff")
       (("1" (skeep) (assert))
        ("2"
         (label "ski" -1)
         (reveal "igz")
         (lift-if)
         (assert)
         (lift-if)
         (lift-if)
         (assert)
         (lift-if)
         (assert)
         (ground)
         (("1"
           (rewrite "ski" 1)
           (("1"
             (hide 2)
             (copy -6)
             (inst? -1)
             (("1"
               (assert)
               (hide 2)
               (split 1)
               (("1" (rewrite "mod_mult_quot") (assert))
                ("2" (rewrite "mod_mult_quot") (assert))))
              ("2"
               (hide 2)
               (lemma "mod_int_quot")
               (rewrite -1 1)
               (rewrite "mod_int_quot" 1))
              ("3" (lemma "mod_int_quot") (inst?) (assert))
              ("4"
               (hide 2)
               (rewrite "mod_int_quot" 1)
               (rewrite "mod_int_quot" 1))
              ("5" (lemma "mod_int_quot") (inst?) (assert))
              ("6" (rewrite "mod_int_quot" 1))
              ("7" (rewrite "mod_int_quot" 1))))
            ("2"
             (hide 2)
             (copy -6)
             (inst? -1)
             (("1"
               (assert)
               (hide 2)
               (split 1)
               (("1"
                 (rewrite "mod_mult_quot")
                 (assert)
                 (rewrite "mod_eq_lem_alt"))
                ("2"
                 (rewrite "mod_mult_quot" 1)
                 (assert)
                 (rewrite "mod_eq_lem_alt"))))
              ("2"
               (hide 2)
               (lemma "mod_int_quot")
               (inst?)
               (assert)
               (flatten)
               (assert)
               (lemma "mod_pos")
               (inst?)
               (assert))
              ("3" (hide 2) (lemma "mod_int_quot") (inst?) (assert))
              ("4"
               (hide 2)
               (lemma "mod_pos")
               (inst?)
               (("1" (assert))
                ("2" (lemma "mod_int_quot") (inst?) (assert))))
              ("5" (hide 2) (lemma "mod_int_quot") (inst?) (assert))
              ("6"
               (rewrite "mod_int_quot")
               (lemma "mod_pos")
               (inst?)
               (("1" (assert)) ("2" (assert))))
              ("7"
               (rewrite "mod_int_quot")
               (lemma "mod_pos")
               (inst?)
               (("1" (assert)) ("2" (assert))))))
            ("3"
             (hide 2)
             (copy -6)
             (inst? -1)
             (("1"
               (assert)
               (hide 2)
               (split)
               (("1"
                 (rewrite "mod_mult_quot")
                 (lemma "mod_sum")
                 (inst - "mod(i,rows(C))" "rows(C)"
                  "mod((i - mod(i, rows(C))) / rows(C), rows(B))")
                 (("1"
                   (replaces -1)
                   (lemma "mod_of_mod")
                   (inst - "0" "i" "rows(C)")
                   (assert))
                  ("2" (lemma "mod_int_quot") (inst?) (assert))))
                ("2"
                 (rewrite "mod_mult_quot")
                 (lemma "mod_sum")
                 (inst - "mod(j,columns(C))" "columns(C)"
                  "mod((j - mod(j, columns(C))) / columns(C), columns(B))")
                 (("1"
                   (replaces -1)
                   (lemma "mod_of_mod")
                   (inst - "0" "j" "columns(C)")
                   (assert))
                  ("2" (lemma "mod_int_quot") (inst?) (assert))))))
              ("2" (lemma "mod_pos") (inst?) (assert))
              ("3" (lemma "mod_pos") (inst?) (assert))
              ("4" (lemma "mod_pos") (inst?) (assert))
              ("5" (lemma "mod_pos") (inst?) (assert))))
            ("4" (hide 2) (lemma "mod_pos") (inst?) (assert))
            ("5" (lemma "mod_pos") (inst?) (assert))
            ("6"
             (lemma "mod_pos")
             (inst?)
             (("1" (assert))
              ("2" (lemma "mod_int_quot") (inst?) (assert))))
            ("7"
             (lemma "mod_pos")
             (inst?)
             (("1" (assert))
              ("2" (lemma "mod_int_quot") (inst?) (assert))))
            ("8"
             (lemma "mod_int_quot")
             (inst?)
             (lemma "mod_int_quot")
             (inst?))
            ("9" (assert) (lemma "mod_int_quot") (inst?) (assert))
            ("10" (rewrite "mod_int_quot") (rewrite "mod_int_quot"))
            ("11" (lemma "mod_int_quot") (inst?) (assert))
            ("12" (hide 2) (lemma "mod_pos") (inst?) (assert))
            ("13" (hide 2) (lemma "mod_pos") (inst?) (assert))
            ("14"
             (hide 2)
             (rewrite "mod_int_quot")
             (lemma "mod_pos")
             (inst?)
             (("1" (assert)) ("2" (assert))))
            ("15"
             (hide 2)
             (rewrite "mod_int_quot")
             (lemma "mod_pos")
             (inst?)
             (("1" (assert)) ("2" (assert))))
            ("16" (hide 2) (rewrite "mod_int_quot"))
            ("17" (hide 2) (rewrite "mod_int_quot"))))
          ("2"
           (hide 2)
           (cross-mult 1)
           (lemma "mod_pos")
           (inst?)
           (assert))
          ("3"
           (hide 2)
           (cross-mult 1)
           (lemma "mod_pos")
           (inst?)
           (flatten)
           (assert))
          ("4"
           (hide 1)
           (lemma "mod_pos")
           (inst - "j" "columns(B)*columns(C)")
           (("1" (assert)) ("2" (assert))))
          ("5"
           (hide 1)
           (lemma "mod_pos")
           (hide-all-but (-1 1))
           (inst?)
           (("1" (assert))
            ("2"
             (assert)
             (lemma "posreal_times_posreal_is_posreal")
             (inst?))))))))))))


proof_type: f_proof
decl_type: formula
library: matrices
theory: tensor_product
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (case "FORALL (A: PosFullMatrix, k,i:nat):i<=k IMPLIES
                 tensor_power(A, i+1) = tensor_power_alt(A, i+1)")
   (("1" (skeep) (inst - "A" "n-1" "n-1") (assert))
    ("2"
     (hide 2)
     (induct "k")
     (("1"
       (assert)
       (skeep)
       (case "NOT i = 0")
       (("1" (assert))
        ("2"
         (replaces -1)
         (assert)
         (assert)
         (hide -1)
         (expand "tensor_power")
         (expand "tensor_power_alt")
         (propax))))
      ("2"
       (skeep)
       (case "j = 0")
       (("1"
         (assert)
         (skeep)
         (case "i = 0")
         (("1" (inst - "A" "0") (assert))
          ("2"
           (case "NOT i = 1")
           (("1" (assert))
            ("2"
             (replace -1)
             (assert)
             (inst - "A" "0")
             (assert)
             (hide (-1 -2))
             (hide 1)
             (expand "tensor_power_alt")
             (expand "tensor_power_alt")
             (expand "tensor_power")
             (expand "tensor_power")
             (propax))))))
        ("2"
         (skeep)
         (case "NOT i = j+1")
         (("1" (assert) (inst - "A" "i") (assert))
          ("2"
           (replace -1)
           (assert)
           (expand "tensor_power" +)
           (inst-cp - "A" "j")
           (assert)
           (replace -3 +)
           (expand "tensor_power_alt" + 1)
           (inst-cp - "A" "j-1")
           (assert)
           (replace -3 + :dir rl)
           (expand "tensor_power_alt" +)
           (replace -4 + :dir rl)
           (expand "tensor_power" + 2)
           (rewrite "tensor_prod_assoc"))))))))))


proof_type: f_proof
decl_type: formula
library: matrices
theory: tensor_product
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skeep)
   (lemma "power_assoc" ("A" "A" "n" "n"))
   (replace -1 :dir rl)
   (rewrite "tensor_power_rows"))


proof_type: f_proof
decl_type: formula
library: matrices
theory: tensor_product
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skeep)
   (lemma "power_assoc" ("A" "A" "n" "n"))
   (replace -1 :dir rl)
   (rewrite "tensor_power_columns"))


proof_type: f_proof
decl_type: formula
library: matrices
theory: tensor_product
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (split)
   (("1" (expand "invertible?") (inst 1 "TQXLinv") (eval-formula))
    ("2" (expand "invertible?") (inst 1 "TQXL") (eval-formula))))


proof_type: f_proof
decl_type: formula
library: matrices
theory: tensor_product
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skeep)
   (typepred (k))
   (grind)
   (lemma "matrices.length_row")
   (inst -1 "M" "k")
   (split -1)
   (("1" (expand "row") (propax)) ("2" (propax))))


proof_type: f_proof
decl_type: formula
library: matrices
theory: tensor_product
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skeep)
   (expand "entry")
   (expand "access")
   (lemma "RowToMat_columns")
   (lemma "RowToMat_rows")
   (inst -2 "M" "k")
   (lift-if 1)
   (lift-if 1)
   (lift-if 1)
   (split 1)
   (("1"
     (flatten)
     (split 1)
     (("1"
       (flatten)
       (name-replace "RK" "row(M)(k)")
       (expand "RowToMat")
       (expand "row")
       (lift-if 1)
       (split 1)
       (("1"
         (flatten)
         (lift-if 1)
         (split 1)
         (("1" (flatten) (ground))
          ("2"
           (flatten)
           (ground)
           (typepred (k))
           (ground)
           (expand "rows")
           (ground))))
        ("2"
         (flatten)
         (lift-if 2)
         (split 2)
         (("1" (flatten) (ground))
          ("2"
           (flatten)
           (case-replace "nth((: nth(M, k) :), 0) = nth(M,k)")
           (("1"
             (expand "RK")
             (expand "row")
             (lift-if 2)
             (split 2)
             (("1" (flatten)) ("2" (propax))))
            ("2"
             (ground)
             (typepred (n))
             (name-replace "NMK" "nth(M, k)")
             (expand "nth")
             (propax))))))))
      ("2"
       (flatten)
       (rewrite "length_row" -1)
       (("1"
         (rewrite "length_row" 1)
         (("1" (ground)) ("2" (typepred (k)) (expand "rows") (propax))))
        ("2" (inst?) (expand "rows") (ground))))))
    ("2"
     (flatten)
     (split 2)
     (("1"
       (flatten)
       (rewrite "length_row" 2)
       (("1" (rewrite "length_row" -1) (ground))
        ("2" (inst?) (ground) (expand "rows") (ground))))
      ("2" (propax))))))


proof_type: f_proof
decl_type: formula
library: matrices
theory: tensor_product
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skeep)
   (lemma "more_list_props[list[real]].list_extensionality")
   (inst?)
   (("1"
     (flatten)
     (hide -1)
     (split -1)
     (("1" (propax))
      ("2"
       (lemma "tensor_rows")
       (inst -1 "RowToMat(M, (k - mod(k, rows(N))) / rows(N))"
        "                          RowToMat(N, mod(k, rows(N)))")
       (("1"
         (expand "rows")
         (replace -1)
         (case "FORALL (A:PosFullMatrix, kk:below(rows(A))): length(RowToMat(A, kk))=1")
         (("1"
           (inst-cp -1 "tensor_prod(M, N)" " k")
           (inst-cp -1 "M" " (k - mod(k, length(N))) / length(N)")
           (("1"
             (inst -1 "N" " mod(k, length(N))")
             (("1" (ground))
              ("2"
               (lemma "mod_pos")
               (inst?)
               (("1" (flatten))
                ("2" (typepred (N)) (expand "rows") (propax))))))
            ("2"
             (lemma "mod_int" ("k" "k" "n" "rows(N)"))
             (expand "rows")
             (propax))))
          ("2" (hide-all-but 1) (skeep) (grind))))
        ("2" (lemma "mod_pos" ("i" "k" "m" "rows(N)")) (flatten))
        ("3" (lemma "mod_int" ("k" "k" "n" "rows(N)")) (propax))))
      ("3"
       (skeep)
       (typepred (n))
       (case-replace "length(RowToMat(tensor_prod(M, N), k))=1")
       (("1"
         (case-replace "n=0")
         (("1"
           (expand "nth")
           (case "FORALL(A:PosFullMatrix, kk:below(rows(A))): rows(RowToMat(A, kk)) = 1")
           (("1"
             (case "rows(tensor_prod(RowToMat(M, (k - mod(k, rows(N))) / rows(N)),
                                          RowToMat(N, mod(k, rows(N))))) = 1")
             (("1"
               (hide 2)
               (inst -2 "tensor_prod(M,N)" "k")
               (expand "rows")
               (lemma "more_list_props[real].list_extensionality")
               (inst?)
               (("1"
                 (flatten)
                 (hide -1)
                 (split -1)
                 (("1" (propax))
                  ("2"
                   (hide 2)
                   (lemma "tensor_cols")
                   (inst -1
                    "RowToMat(M,
                                                           (k - mod(k, length(N)))
                                                           /
                                                           length(N))"
                    "                              RowToMat(N, mod(k, length(N)))")
                   (("1"
                     (case-replace
                      "length(car(RowToMat(tensor_prod(M, N), k))) = columns(RowToMat(tensor_prod(M, N), k))")
                     (("1"
                       (rewrite "RowToMat_columns")
                       (rewrite "RowToMat_columns")
                       (("1"
                         (rewrite "RowToMat_columns")
                         (("1"
                           (case "FORALL (A:PosFullMatrix, kk:below(rows(A))): length(car(A)) = columns(A)")
                           (("1"
                             (inst -1
                              "tensor_prod(RowToMat(M,
                                                                     (k - mod(k, length(N)))
                                                                     /
                                                                     length(N)),
                                                            RowToMat(N, mod(k, length(N))))"
                              "0")
                             (("1"
                               (replace -1)
                               (replace -3)
                               (rewrite "tensor_cols"))
                              ("2" (ground))
                              ("3"
                               (lemma "mod_pos"
                                ("i" "k" "m" "length[list[real]](N)"))
                               (("1" (typepred (N)) (grind))
                                ("2" (typepred (N)) (grind))))
                              ("4"
                               (lemma "mod_int"
                                ("k" "k" "n" "length[list[real]](N)"))
                               (("1" (propax)) ("2" (grind))))))
                            ("2"
                             (skeep)
                             (lemma "matrices.length_row")
                             (inst -1 "A" "0")
                             (split -1)
                             (("1"
                               (replace -1 :dir rl)
                               (expand "row")
                               (lift-if 1)
                               (split 1)
                               (("1" (flatten) (ground))
                                ("2"
                                 (flatten)
                                 (ground)
                                 (expand "nth")
                                 (propax))))
                              ("2"
                               (ground)
                               (typepred (A))
                               (expand "rows")
                               (ground))))
                            ("3"
                             (skeep)
                             (typepred (A))
                             (ground)
                             (("1" (grind)) ("2" (grind))))))
                          ("2"
                           (lemma "mod_pos"
                            ("i" "k" "m" "length[list[real]](N)"))
                           (("1" (flatten))
                            ("2"
                             (ground)
                             (typepred (N))
                             (ground)
                             (("1" (grind)) ("2" (grind))))))))
                        ("2"
                         (lemma "mod_int"
                          ("k" "k" "n" "length[list[real]](N)"))
                         (("1" (propax)) ("2" (typepred (N)) (grind))))))
                      ("2"
                       (hide (-1 2))
                       (expand "columns")
                       (lift-if)
                       (split)
                       (("1"
                         (flatten)
                         (ground)
                         (expand "RowToMat")
                         (propax))
                        ("2"
                         (flatten)
                         (expand "RowToMat")
                         (expand "columns")
                         (expand "max")
                         (lift-if 2)
                         (split 2)
                         (("1" (flatten) (ground)) ("2" (propax))))))))
                    ("2"
                     (lemma "mod_pos" ("i" "k" "m" "rows(N)"))
                     (flatten)
                     (expand "rows")
                     (propax))
                    ("3"
                     (lemma "mod_int" ("k" "k" "n" "rows(N)"))
                     (expand "rows")
                     (propax))))
                  ("3"
                   (skeep)
                   (case "FORALL (A:PosFullMatrix, n:below(columns(A))):
                                      nth(car(A), n) = entry(A)(0,n)")
                   (("1"
                     (case "FORALL (A:PosFullMatrix): columns(A) = length(car(A))")
                     (("1"
                       (inst-cp -2 "RowToMat(tensor_prod(M, N), k)"
                        " n!1")
                       (("1"
                         (inst-cp -2
                          "tensor_prod(RowToMat(M,
                                                              (k - mod(k, length(N))) / length(N)),
                                                     RowToMat(N, mod(k, length(N))))"
                          "           n!1")
                         (("1"
                           (replace -3)
                           (replace -4)
                           (hide 2)
                           (rewrite "RowToMat_entry")
                           (("1"
                             (hide (-3 -4 -6 -7 -8 -9))
                             (expand "tensor_prod")
                             (rewrite "entry_form_matrix2")
                             (("1"
                               (lemma "mod_pos"
                                ("i" "k" "m" "length(N)"))
                               (("1"
                                 (lemma
                                  "mod_int"
                                  ("k" "k" "n" "length(N)"))
                                 (rewrite "entry_form_matrix2")
                                 (("1"
                                   (expand "tensor_fun")
                                   (case-replace
                                    "(n!1<columns(M)*columns(N)) = TRUE")
                                   (("1"
                                     (case-replace
                                      "(0 <
                                                 rows(RowToMat(M, (k - mod(k, length(N))) / length(N))) *
                                                  rows(RowToMat(N, mod(k, length(N))))) = TRUE")
                                     (("1"
                                       (case-replace
                                        "(n!1 <
                                                   columns(RowToMat(M, (k - mod(k, length(N))) / length(N))) *
                                                    columns(RowToMat(N, mod(k, length(N))))) = TRUE")
                                       (("1"
                                         (rewrite "mod_zero")
                                         (rewrite "RowToMat_columns" 1)
                                         (case-replace
                                          "-1 * 0 / rows(RowToMat(N, mod(k, length(N)))) = 0")
                                         (("1"
                                           (rewrite "RowToMat_entry")
                                           (("1"
                                             (rewrite "RowToMat_entry")
                                             (("1"
                                               (expand "rows")
                                               (propax))
                                              ("2"
                                               (lemma
                                                "mod_pos"
                                                ("i"
                                                 "n!1"
                                                 "m"
                                                 "columns(N)"))
                                               (propax))))
                                            ("2"
                                             (lemma
                                              "mod_int"
                                              ("k"
                                               "n!1"
                                               "n"
                                               "columns(N)"))
                                             (lemma
                                              "mod_int"
                                              ("k"
                                               "n!1"
                                               "n"
                                               "columns(N)"))
                                             (ground)
                                             (cross-mult 1)
                                             (lemma
                                              "mod_pos"
                                              ("i"
                                               "n!1"
                                               "m"
                                               "columns(N)"))
                                             (flatten)
                                             (ground))))
                                          ("2" (ground))
                                          ("3" (ground))))
                                        ("2"
                                         (hide (-7 2))
                                         (rewrite "RowToMat_columns" 1)
                                         (rewrite "RowToMat_columns" 1))
                                        ("3" (ground))))
                                      ("2"
                                       (ground)
                                       (typepred
                                        "RowToMat(M, (k - mod(k, length(N))) / length(N))")
                                       (typepred
                                        "RowToMat(N, mod(k, length(N)))")
                                       (mult-ineq -7 -3)
                                       (ground))
                                      ("3" (ground))))
                                    ("2"
                                     (hide (-5 2))
                                     (typepred (n!1))
                                     (inst
                                      -4
                                      "RowToMat(tensor_prod(M, N), k)")
                                     (replace -4 :dir rl)
                                     (rewrite "RowToMat_columns")
                                     (rewrite "tensor_cols"))))
                                  ("2"
                                   (rewrite "RowToMat_columns")
                                   (rewrite "RowToMat_columns")
                                   (typepred (n!1))
                                   (inst
                                    -4
                                    "RowToMat(tensor_prod(M, N), k)")
                                   (replace -4 :dir rl)
                                   (rewrite "RowToMat_columns")
                                   (rewrite "tensor_cols"))))
                                ("2"
                                 (typepred (N))
                                 (expand "rows")
                                 (propax))))
                              ("2"
                               (typepred (n!1))
                               (inst -2 "RowToMat(tensor_prod(M, N), k)")
                               (replace -2 :dir rl)
                               (rewrite "RowToMat_columns")
                               (rewrite "tensor_cols"))))
                            ("2"
                             (typepred (n!1))
                             (inst -2 "RowToMat(tensor_prod(M,N), k)")
                             (replace -2 :dir rl)
                             (rewrite "RowToMat_columns" -1))))
                          ("2"
                           (typepred (n!1))
                           (inst -2 "RowToMat(tensor_prod(M, N), k)")
                           (replace -2 :dir rl)
                           (rewrite "RowToMat_columns" -1)
                           (hide (2 3))
                           (rewrite "tensor_cols" 1)
                           (("1"
                             (rewrite "RowToMat_columns" 1)
                             (("1"
                               (rewrite "RowToMat_columns" 1)
                               (("1" (rewrite "tensor_cols" -1))
                                ("2"
                                 (lemma "mod_pos")
                                 (inst?)
                                 (("1" (flatten))
                                  ("2"
                                   (ground)
                                   (typepred (N))
                                   (ground)
                                   (("1" (expand "rows") (propax))
                                    ("2" (expand "rows") (propax))))))))
                              ("2"
                               (lemma "mod_int")
                               (inst?)
                               (typepred (N))
                               (expand "rows")
                               (propax))))
                            ("2"
                             (lemma "mod_pos")
                             (inst?)
                             (("1" (flatten))
                              ("2"
                               (ground)
                               (typepred (N))
                               (expand "rows")
                               (propax))))
                            ("3"
                             (lemma "mod_int")
                             (inst?)
                             (typepred (N))
                             (expand "rows")
                             (propax))))
                          ("3"
                           (lemma "mod_pos")
                           (inst?)
                           (("1" (flatten))
                            ("2"
                             (ground)
                             (typepred (N))
                             (expand "rows")
                             (propax))))
                          ("4"
                           (lemma "mod_int")
                           (inst?)
                           (typepred (N))
                           (expand "rows")
                           (propax))))
                        ("2" (typepred (n!1)) (inst?) (ground))))
                      ("2"
                       (hide-all-but 1)
                       (skeep)
                       (lemma "columns_mn")
                       (inst -1 "rows(A)" "length(car(A))" "A")
                       (typepred (A))
                       (split 1)
                       (("1"
                         (ground)
                         (("1" (expand "rows") (propax))
                          ("2" (expand "rows") (propax))))
                        ("2"
                         (split -2)
                         (("1" (grind))
                          ("2"
                           (inst -1 "_" "0")
                           (("1" (ground) (grind)) ("2" (grind))))))))
                      ("3"
                       (hide-all-but 1)
                       (skeep)
                       (typepred (A))
                       (grind))))
                    ("2"
                     (hide (2 3))
                     (hide -)
                     (skeep)
                     (expand "entry")
                     (expand "row")
                     (lift-if 1)
                     (split 1)
                     (("1"
                       (flatten)
                       (typepred (A))
                       (ground)
                       (("1" (grind)) ("2" (expand "rows") (ground))))
                      ("2"
                       (flatten)
                       (expand "access")
                       (lift-if 2)
                       (split 2)
                       (("1" (flatten) (ground) (grind))
                        ("2"
                         (flatten)
                         (typepred (n!2))
                         (ground)
                         (grind)
                         (lemma "columns_mn")
                         (inst -1 "rows(A)" "length(car(A))" "A")
                         (("1" (ground))
                          ("2"
                           (typepred (A))
                           (split -2)
                           (("1" (ground))
                            ("2" (inst -1 "_" "0") (ground))))))))))
                    ("3"
                     (hide-all-but 1)
                     (skeep)
                     (typepred (A))
                     (typepred (n!2))
                     (lemma "columns_mn")
                     (inst -1 "rows(A)" "length(car(A))" "A")
                     (("1"
                       (case-replace
                        "length[real](car[list[real]](A)) = length(car(A))")
                       (ground))
                      ("2"
                       (split 1)
                       (("1"
                         (ground)
                         (("1" (expand "rows") (propax))
                          ("2" (expand "rows") (propax))))
                        ("2"
                         (split -3)
                         (("1" (ground) (grind))
                          ("2"
                           (inst -1 "_" "0")
                           (("1" (expand "nth") (propax))
                            ("2" (ground) (grind))))))))))
                    ("4"
                     (skeep)
                     (ground)
                     (hide (2 3))
                     (hide (-1 -2 -4))
                     (grind)
                     (typepred (A))
                     (ground))))))
                ("2"
                 (lemma "mod_pos" ("i" "k" "m" "rows(N)"))
                 (flatten)
                 (expand "rows")
                 (propax))
                ("3"
                 (lemma "mod_int" ("k" "k" "n" "rows(N)"))
                 (expand "rows")
                 (propax))))
              ("2"
               (rewrite "tensor_rows")
               (inst-cp -1 "M" " (k - mod(k, rows(N))) / rows(N)")
               (("1"
                 (inst -1 "N" " mod(k, rows(N))")
                 (("1" (ground))
                  ("2"
                   (lemma "mod_pos" ("i" "k" "m" "rows(N)"))
                   (flatten))))
                ("2"
                 (lemma "mod_int" ("k" "k" "n" "rows(N)"))
                 (propax))))
              ("3" (lemma "mod_pos" ("i" "k" "m" "rows(N)")) (flatten))
              ("4" (lemma "mod_int" ("k" "k" "n" "rows(N)")) (propax))))
            ("2" (hide-all-but 1) (skeep) (grind))))
          ("2" (ground))))
        ("2" (hide (2 3)) (ground) (expand "RowToMat") (ground))))))
    ("2" (lemma "mod_pos" ("i" "k" "m" "rows(N)")) (flatten))
    ("3" (lemma "mod_int" ("k" "k" "n" "rows(N)")) (propax))))


proof_type: f_proof
decl_type: formula
library: matrices
theory: tensor_product
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (induct "n")
   (("1" (ground)) ("2" (ground))
    ("3"
     (skeep)
     (skeep)
     (expand "RowTensor" 1)
     (expand "RowTensorAlt" 1)
     (lift-if 1)
     (split 1)
     (("1"
       (flatten)
       (rewrite "RtM" 1)
       (case "car(base_list(rows(M), k, 1 + j)) = base_n(rows(M), k)(0)")
       (("1" (ground)) ("2" (hide 2) (grind))))
      ("2"
       (flatten)
       (case-replace
        "car(base_list(rows(M), k, 1 + j)) = base_n(rows(M), k)(0)")
       (("1"
         (rewrite "base_list_cdr")
         (expand "base_n" 2 2)
         (case-replace
          "(LAMBDA (j_1: nat):
                                                    IF k < rows(M) THEN 0
                                                    ELSE base_n
                                                         (rows(M),
                                                          (k - mod(k, rows(M))) / rows(M))
                                                         (j_1)
                                                    ENDIF) = base_n
                                                         (rows(M),
                                                          (k - mod(k, rows(M))) / rows(M))")
         (("1"
           (split -3)
           (("1"
             (inst -1 "M" "(k-mod(k, rows(M)))/rows(M)")
             (("1" (ground) (rewrite "RtM" 2) (replace -1) (propax))
              ("2"
               (hide 3)
               (lemma "mod_int")
               (inst?)
               (ground)
               (cross-mult 1)
               (lemma "mod_pos")
               (inst?)
               (typepred (k))
               (expand "^")
               (expand "expt" -1)
               (ground))))
            ("2" (ground))))
          ("2"
           (hide 3)
           (hide (-1 -2))
           (case-replace "(k<rows(M)) = TRUE")
           (("1"
             (simplify -1)
             (lemma "mod_int")
             (inst?)
             (case-replace "(k - mod(k, rows(M))) / rows(M) =0")
             (("1" (expand "base_n") (propax))
              ("2"
               (div-by -2 "rows(M)")
               (expand "mod")
               (flatten)
               (ground))))
            ("2"
             (ground)
             (decompose-equality 2)
             (lemma "mod_int")
             (inst?))))
          ("3" (lemma "mod_int") (inst?))
          ("4" (lemma "mod_int") (inst?) (ground))))
        ("2" (hide 3) (grind))))))
    ("4" (skeep) (skeep) (skeep) (rewrite "base_n_lt_n"))))


proof_type: f_proof
decl_type: formula
library: matrices
theory: tensor_product
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skolem 1 ("M" "_" "_"))
   (induct "n")
   (("1" (ground)) ("2" (flatten) (ground))
    ("3"
     (skeep)
     (case-replace "j=0")
     (("1"
       (hide -2)
       (skeep)
       (expand "tensor_power_alt")
       (expand "RowTensor")
       (case-replace "base_list(rows(M), k, 1) = (: k :)")
       (("1" (case-replace "car((: k :)) = k") (ground))
        ("2"
         (hide 2)
         (expand "base_list")
         (expand "base_n")
         (expand "array2list")
         (expand "array2list_it")
         (lift-if 1)
         (split 1)
         (("1" (flatten) (ground) (expand "array2list_it") (propax))
          ("2"
           (flatten)
           (expand "array2list_it")
           (expand "mod")
           (typepred (k))
           (replace -2)
           (expand "^")
           (expand "expt")
           (expand "expt")
           (propax))))))
      ("2"
       (skeep)
       (expand "RowTensor" 2)
       (lift-if 2)
       (split 2)
       (("1" (flatten))
        ("2"
         (flatten)
         (case-replace
          "car(base_list(rows(M), k, 1+j)) = mod(k, rows(M))")
         (("1"
           (rewrite "base_list_cdr")
           (expand "tensor_power_alt" 2)
           (lift-if 2)
           (split 2)
           (("1" (flatten))
            ("2"
             (flatten)
             (rewrite "RowToMat_tensor_prod")
             (("1"
               (split -2)
               (("1"
                 (inst -1 "(k - mod(k, rows(M))) / rows(M)")
                 (("1" (prop) (replace -1) (propax))
                  ("2"
                   (lemma "mod_int" ("k" "k" "n" "rows(M)"))
                   (typepred (k))
                   (lemma "mod_pos" ("i" "k" "m" "rows(M)"))
                   (ground)
                   (cross-mult 1)
                   (expand "^")
                   (expand "expt" -3)
                   (ground))))
                ("2" (ground))))
              ("2"
               (lemma "tensor_power_rows_alt" ("A" "M" "n" "j"))
               (replace -1 :dir rl)
               (typepred (k))
               (expand "^")
               (expand "expt" -1)
               (ground))))))
          ("2"
           (expand "base_list")
           (hide 3)
           (hide -1)
           (expand "base_n")
           (expand "array2list")
           (expand "array2list_it")
           (lift-if 1)
           (split 1)
           (("1"
             (flatten)
             (expand "mod")
             (ground)
             (cancel-by 1 "rows(M)")
             (ground)
             (div-by -1 "rows(M)")
             (ground)
             (case "k/rows(M)>=0")
             (("1"
               (lemma "floor_0")
               (inst?)
               (flatten)
               (split -2)
               (("1" (ground)) ("2" (ground)) ("3" (propax))))
              ("2" (cross-mult))))
            ("2" (propax))))))))))
    ("4"
     (skeep)
     (skeep)
     (lemma "tensor_power_rows_alt")
     (inst -1 "M" "n")
     (replace -1 :dir rl)
     (ground))))


proof_type: f_proof
decl_type: formula
library: matrices
theory: tensor_product
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skeep)
   (rewrite "power_assoc")
   (rewrite "RtM" :dir rl)
   (rewrite "RowTensor_is_TensorRow")
   (rewrite "RowTensors_same"))


proof_type: f_proof
decl_type: formula
library: matrices
theory: tensor_product
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skolem 1 ("A" "_" "_" "_"))
   (induct "n" 1 NAT_induction)
   (("1" (ground)) ("2" (ground))
    ("3"
     (skeep)
     (skeep)
     (expand "tensor_power_alt" 1)
     (lift-if 1)
     (split 1)
     (("1"
       (flatten)
       (replace -1)
       (simplify 1)
       (rewrite "product_eq_arg[nat]")
       (expand "entry_pick")
       (expand "base_n")
       (typepred (k))
       (typepred (m))
       (replace -3)
       (expand "^")
       (hide -4)
       (expand "expt")
       (expand "expt")
       (ground))
      ("2"
       (flatten)
       (rewrite "entry_tensor_prod")
       (expand "tensor_fun")
       (rewrite "tensor_power_rows_alt" :dir rl)
       (rewrite "tensor_power_columns_alt" :dir rl)
       (typepred (k))
       (typepred (m))
       (case "(rows(A) ^ (j - 1)) * rows(A) = rows(A)^j AND (columns(A) ^ (j - 1)) * columns(A) = columns(A)^j")
       (("1"
         (flatten)
         (replace -1)
         (replace -2)
         (lift-if 2)
         (split 2)
         (("1"
           (flatten)
           (split 1)
           (("1"
             (flatten)
             (rewrite "product_first")
             (expand "entry_pick")
             (case-replace
              "entry(A)(mod(k, rows(A)), mod(m, columns(A)))
                     =
                     entry(A)(base_n(rows(A), k)(0), base_n(columns(A), m)(0))")
             (("1"
               (cancel-by 1
                "entry(A)(base_n(rows(A), k)(0), base_n(columns(A), m)(0))")
               (hide -1)
               (lemma "product_shift_T[nat]")
               (inst -1
                "LAMBDA (i: nat):
                                  entry(A)
                                       (base_n(rows(A), k)(i), base_n(columns(A), m)(i))"
                "j-2" "0" "1")
               (("1"
                 (split -1)
                 (("1"
                   (replace -1)
                   (hide 1)
                   (expand "base_n" 1)
                   (case "FORALL (kk:nat, nn:posnat): kk<nn IMPLIES (kk-mod(kk, nn))/nn = 0")
                   (("1"
                     (inst -9 "j-1")
                     (("1"
                       (hide (-2 -3 -4))
                       (split -6)
                       (("1"
                         (inst -1 "(k - mod(k, rows(A))) / rows(A)"
                          "(m - mod(m, columns(A))) / columns(A)")
                         (("1"
                           (replace -1)
                           (rewrite "product_eq")
                           (("1"
                             (hide 2)
                             (skeep)
                             (lift-if 1)
                             (case "FORALL (nn:nat, mm: {x:nat | x>1}): base_n(mm, 0)(nn) = 0")
                             (("1"
                               (split 1)
                               (("1"
                                 (flatten)
                                 (lift-if 1)
                                 (split 1)
                                 (("1"
                                   (flatten)
                                   (inst-cp -5 "k" "rows(A)")
                                   (inst -5 "m" "columns(A)")
                                   (inst-cp -3 "n" "rows(A)")
                                   (inst -3 "n" "columns(A)")
                                   (ground))
                                  ("2"
                                   (ground)
                                   (inst -4 "k" "rows(A)")
                                   (inst -2 "n" "rows(A)")
                                   (ground))))
                                ("2"
                                 (flatten)
                                 (lift-if 2)
                                 (split 2)
                                 (("1"
                                   (flatten)
                                   (inst -4 "m" "columns(A)")
                                   (inst -2 "n" "columns(A)")
                                   (ground))
                                  ("2" (propax))))))
                              ("2"
                               (hide-all-but 1)
                               (skolem 1 ("_" "mm"))
                               (induct "nn" 1)
                               (("1" (expand "base_n") (propax))
                                ("2"
                                 (skeep)
                                 (expand "base_n" 1)
                                 (propax))))))
                            ("2"
                             (flatten)
                             (lemma "mod_int" ("k" "m" "n" "columns(A)"))
                             (propax))
                            ("3"
                             (flatten)
                             (lemma "mod_int" ("k" "k" "n" "rows(A)"))
                             (propax))
                            ("4"
                             (lemma "mod_int" ("k" "m" "n" "columns(A)"))
                             (propax))
                            ("5"
                             (lemma "mod_int" ("k" "k" "n" "rows(A)"))
                             (propax))))
                          ("2"
                           (lemma "mod_int")
                           (inst -1 "m" "columns(A)")
                           (ground)
                           (cross-mult 1)
                           (lemma "mod_pos")
                           (inst -1 "m" "columns(A)")
                           (flatten)
                           (ground))
                          ("3"
                           (lemma "mod_int" ("k" "k" "n" "rows(A)"))
                           (ground)
                           (cross-mult 1)
                           (lemma "mod_pos" ("i" "k" "m" "rows(A)"))
                           (ground))))
                        ("2" (ground)) ("3" (ground))))
                      ("2" (ground))))
                    ("2"
                     (hide (2 -8))
                     (skeep)
                     (cross-mult 1)
                     (expand "mod")
                     (cancel-by 1 "nn")
                     (div-by -1 "nn")
                     (case "kk/nn>=0")
                     (("1" (ground)) ("2" (cross-mult 1))))))
                  ("2" (skeep) (ground))))
                ("2" (flatten) (ground))))
              ("2"
               (hide (-7 2))
               (expand "base_n")
               (lift-if 1)
               (split 1)
               (("1"
                 (flatten)
                 (lift-if 1)
                 (split 1)
                 (("1"
                   (flatten)
                   (expand "mod")
                   (ground)
                   (div-by -1 "columns(A)")
                   (div-by -2 "rows(A)")
                   (ground)
                   (case-replace "floor(k / rows(A)) = 0")
                   (("1"
                     (case-replace "floor(m / columns(A)) = 0")
                     (("1" (ground))
                      ("2"
                       (ground)
                       (typepred (k))
                       (typepred (m))
                       (hide 2)
                       (case "m/columns(A)>=0")
                       (("1" (ground)) ("2" (ground) (cross-mult 1))))))
                    ("2"
                     (case "k/rows(A)>=0")
                     (("1" (ground)) ("2" (cross-mult 1))))))
                  ("2"
                   (flatten)
                   (case-replace "mod(k, rows(A)) = k")
                   (hide 3)
                   (expand "mod")
                   (div-by -1 "rows(A)")
                   (case "k/rows(A)>=0")
                   (("1" (ground)) ("2" (cross-mult 1))))))
                ("2"
                 (flatten)
                 (lift-if 2)
                 (split 2)
                 (("1"
                   (flatten)
                   (case-replace "mod(m, columns(A)) = m")
                   (expand "mod")
                   (div-by -1 "columns(A)")
                   (case "m/columns(A)>=0")
                   (("1" (ground)) ("2" (cross-mult 1))))
                  ("2" (propax))))))
              ("3" (lemma "mod_pos") (inst?) (ground))
              ("4" (lemma "mod_pos") (inst?) (ground))))
            ("2" (flatten))))
          ("2" (flatten))))
        ("2"
         (hide-all-but (-4 2 1))
         (expand "^")
         (lift-if)
         (split 1)
         (("1"
           (flatten)
           (split 1)
           (("1"
             (expand "expt" 1 2)
             (lift-if 1)
             (split 1)
             (("1" (flatten) (ground)) ("2" (flatten) (ground))))
            ("2"
             (expand "expt" 1 2)
             (lift-if)
             (split)
             (("1" (flatten) (ground)) ("2" (flatten) (ground))))))
          ("2" (flatten) (ground))))))))
    ("4" (skeep) (skeep) (skeep) (ground))))


proof_type: t_proof
decl_type: tcc
library: matrices
theory: tensor_product
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skosimp*)
   (expand "mod")
   (case-replace
    "rows(B!1) * floor(i!1 / rows(B!1)) / rows(B!1) = floor(i!1 / rows(B!1))")
   (("1"
     (split 1)
     (("1" (ground))
      ("2" (ground) (typepred (i!1)) (div-by -1 "rows(B!1)") (ground))))
    ("2" (cross-mult 1)) ("3" (ground))))


proof_type: t_proof
decl_type: tcc
library: matrices
theory: tensor_product
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skosimp*)
   (expand "mod")
   (case-replace
    "columns(B!1) * floor(j!1 / columns(B!1)) / columns(B!1) = floor(j!1 / columns(B!1))")
   (("1"
     (split 1)
     (("1" (ground))
      ("2"
       (ground)
       (typepred (j!1))
       (div-by -1 "columns(B!1)")
       (ground))))
    ("2" (cross-mult 1)) ("3" (ground))))


proof_type: t_proof
decl_type: tcc
library: matrices
theory: tensor_product
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skeep)
   (rewrite "rows_form_matrix")
   (lemma "columns_form_matrix")
   (inst?)
   (typepred (A))
   (typepred (B))
   (mult-ineq -7 -3)
   (mult-ineq -9 -5)
   (ground))


proof_type: t_proof
decl_type: tcc
library: matrices
theory: tensor_product
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skeep)
   (grind)
   (case "m1/rows(B)>=0")
   (("1" (cross-mult 1) (grind)) ("2" (cross-mult 1))
    ("3" (cross-mult 1) (grind))))


proof_type: t_proof
decl_type: tcc
library: matrices
theory: tensor_product
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skeep)
   (grind)
   (case "n1/columns(B2)>=0")
   (("1" (cross-mult 1) (grind)) ("2" (cross-mult 1))))


proof_type: t_proof
decl_type: tcc
library: matrices
theory: tensor_product
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skeep)
   (lemma "tensor_rows")
   (inst?)
   (replace -1)
   (lemma "tensor_cols")
   (inst?)
   (replace -1)
   (typepred (AA))
   (replace -5)
   (typepred (BB))
   (replace -5)
   (propax))


proof_type: t_proof
decl_type: tcc
library: matrices
theory: tensor_product
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skeep)
   (split 1)
   (("1"
     (lemma "tensor_rows" ("A" "AA" "B" "BB"))
     (lemma "tensor_cols" ("A" "AA" "B" "BB"))
     (typepred (AA))
     (replace -5)
     (typepred (BB))
     (replace -5)
     (replace -11)
     (propax))
    ("2" (ground))))


proof_type: t_proof
decl_type: tcc
library: matrices
theory: tensor_product
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (split)
   (("1"
     (flatten)
     (eval-formula)
     (skeep)
     (case "(i=0 OR i=1 OR i=2) AND (j=0 OR j=1 OR j=2)")
     (("1"
       (ground)
       (("1" (replaces -1) (replaces -1) (grind)) ("2" (grind))
        ("3" (grind)) ("4" (grind)) ("5" (grind)) ("6" (grind))))
      ("2" (hide (2 3)) (typepred "i") (typepred "j") (grind))))
    ("2" (ground) (grind)) ("3" (grind)) ("4" (grind))))


proof_type: t_proof
decl_type: tcc
library: matrices
theory: tensor_product
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (split)
   (("1"
     (flatten)
     (skeep)
     (case "(i=0 OR i=1 OR i=2) AND (j=0 OR j=1 OR j=2)")
     (("1" (flatten) (grind))
      ("2" (typepred "j") (typepred "i") (grind))))
    ("2" (grind)) ("3" (grind)) ("4" (grind))))


proof_type: t_proof
decl_type: tcc
library: matrices
theory: tensor_product
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (flatten)
   (expand "invertible?")
   (inst 1 "TQMatInv")
   (split)
   (("1" (grind)) ("2" (grind)) ("3" (grind))))


proof_type: t_proof
decl_type: tcc
library: matrices
theory: tensor_product
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (induct "n")
   (("1" (ground)) ("2" (flatten) (ground))
    ("3"
     (skeep)
     (skeep)
     (case-replace "j=0")
     (("1" (expand "tensor_power") (typepred (A)) (propax))
      ("2"
       (case-replace
        "tensor_power(A, j+1) = tensor_prod(A, tensor_power(A,j))")
       (("1"
         (rewrite "tensor_rows")
         (rewrite "tensor_cols")
         (split -2)
         (("1" (inst?) (prop) (typepred (A)) (ground)) ("2" (ground))))
        ("2"
         (hide (-1 3))
         (name-replace "TPj" "tensor_power(A, j)")
         (expand "tensor_power")
         (lift-if)
         (split)
         (("1" (flatten))
          ("2" (flatten) (ground) (expand "TPj") (propax))))
        ("3" (ground))))))))


proof_type: t_proof
decl_type: tcc
library: matrices
theory: tensor_product
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skeep)
   (split)
   (("1"
     (flatten)
     (case "length[list[real]]((: row(M)(k) :)) = 1")
     (("1"
       (skeep)
       (case-replace "i=0")
       (("1" (case-replace "j=0") (typepred (j)) (ground))
        ("2" (typepred (i)) (ground))))
      ("2" (ground))))
    ("2" (ground) (expand "rows") (ground))
    ("3"
     (case-replace "columns((: row(M)(k) :)) = columns(M)")
     (("1" (typepred (M)) (propax))
      ("2"
       (lemma "matrices.length_row")
       (inst-cp -1 "M" "k")
       (split -2)
       (("1"
         (replace -1 :dir rl)
         (inst -2 "(: row(M)(k) :)" "0")
         (("1"
           (split -2)
           (("1"
             (case-replace "row((: row(M)(k) :))(0) = row(M)(k)")
             (("1" (replace -2 :dir rl) (propax))
              ("2" (hide-all-but 1) (grind))))
            ("2" (ground))))
          ("2"
           (case-replace "length[list[real]]((: row(M)(k) :)) = 1")
           (("1"
             (skeep)
             (case-replace "i=0")
             (("1" (case-replace "j=0") (typepred (j)) (ground))
              ("2" (typepred (i)) (ground))))
            ("2" (ground))))))
        ("2" (typepred (k)) (expand "rows") (propax))))))))


proof_type: t_proof
decl_type: tcc
library: matrices
theory: tensor_product
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skeep)
   (lemma "mod_int" ("k" "k" "n" "rows(N)"))
   (prop)
   (cross-mult 1)
   (typepred (k))
   (lemma "mod_pos")
   (inst?)
   (flatten)
   (ground))


proof_type: f_proof
decl_type: formula
library: matrices
theory: query_coeff
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (case " FORALL (nn:posnat, L: list[below(3)], n: below(length(L)), new: below(3),
                              (f: [nat -> below(3)]
                                   | array2list[below(3)](length(L))(f) = L)):
                        nn = length(L) IMPLIES switch_one_entry(L, n, new) =
                         array2list[below(3)](length(L))(f WITH [n := new])")
   (("1" (skeep) (inst?) (inst -1 "length(L)"))
    ("2"
     (hide 2)
     (induct "nn")
     (("1" (ground)) ("2" (ground))
      ("3"
       (skeep)
       (skeep)
       (case-replace "j=0")
       (("1"
         (expand "switch_one_entry")
         (hide -2)
         (typepred (n))
         (ground)
         (replace -4 :dir rl)
         (case-replace "n=0")
         (("1"
           (grind)
           (case "cdr(L) = null")
           (("1" (ground))
            ("2" (grind) (expand "length") (ground) (grind))))
          ("2" (ground))))
        ("2"
         (case "n=0")
         (("1"
           (expand "switch_one_entry" 2)
           (ground)
           (expand "array2list" 2)
           (expand "array2list_it")
           (case-replace
            "cdr(L) = array2list_it(f WITH [n := new], length(L), 1)")
           (hide 3)
           (lemma "list_extensionality[below(3)]")
           (inst -1 "cdr(L)"
            " array2list_it(f WITH [n := new], length(L), 1)")
           (flatten)
           (hide -1)
           (split -1)
           (("1" (propax))
            ("2"
             (typepred "array2list_it(f WITH [n := new], length(L), 1)")
             (replace -2)
             (ground)
             (typepred "cdr(L)")
             (expand "length" 1 2)
             (lift-if 1)
             (ground)
             (typepred (L))
             (expand "length")
             (ground))
            ("3"
             (skeep)
             (typepred "array2list_it(f WITH [n := new], length(L), 1)")
             (typepred (n_1))
             (inst -4 "n_1+1")
             (("1"
               (replace -6)
               (ground)
               (replace -4 :dir rl)
               (typepred (f))
               (case-replace "nth(cdr(L), n_1) = nth(L, n_1+1)")
               (("1"
                 (replace -2 :dir rl)
                 (hide 2)
                 (typepred "array2list[below(3)](length(L))(f)")
                 (inst -3 "n_1+1")
                 (("1" (ground))
                  ("2"
                   (ground)
                   (expand "length" 1)
                   (lift-if 1)
                   (split 1)
                   (("1" (flatten) (expand "length") (ground))
                    ("2" (ground))))))
                ("2" (expand "nth" 1 2) (propax))
                ("3"
                 (expand "length" 1)
                 (lift-if 1)
                 (split 1)
                 (("1" (flatten) (expand "length") (ground))
                  ("2" (ground))))))
              ("2"
               (expand "length" 1)
               (lift-if 1)
               (split 1)
               (("1" (flatten) (expand "length") (ground))
                ("2" (flatten) (ground))))))))
          ("2"
           (expand "switch_one_entry" 3)
           (ground)
           (expand "array2list" 3)
           (expand "array2list_it")
           (typepred (f))
           (case-replace "f(0) = car(L)")
           (("1"
             (case-replace
              "switch_one_entry(cdr(L), n - 1, new) = array2list_it(f WITH [n := new], length(L), 1)")
             (hide 4)
             (lemma "list_extensionality[below(3)]")
             (hide -2)
             (inst?)
             (flatten)
             (hide -1)
             (split -1)
             (("1" (propax))
              ("2"
               (typepred "array2list_it(f WITH [n:=new], length(L), 1)")
               (replace -2)
               (hide 2)
               (expand "length" 1 2)
               (lift-if)
               (split 1)
               (("1" (flatten) (ground) (expand "length") (ground))
                ("2" (flatten) (ground))))
              ("3"
               (typepred
                "array2list_it(f WITH [n := new], length(L), 1)")
               (skeep)
               (inst -3 "n_1+1")
               (("1"
                 (replace -3 :dir rl)
                 (typepred "switch_one_entry(cdr(L), n - 1, new)")
                 (inst -3 "n_1")
                 (typepred (n_1))
                 (case "n_1/=n-1")
                 (("1"
                   (ground)
                   (replace -1)
                   (typepred (f))
                   (case-replace "nth(cdr(L), n_1) = nth(L, n_1+1)")
                   (("1"
                     (typepred (n_1))
                     (typepred "array2list[below(3)](length(L))(f)")
                     (inst -3 "n_1+1")
                     (replace -6)
                     (ground))
                    ("2" (expand "nth" 1 2) (propax))
                    ("3"
                     (expand "length" 1)
                     (lift-if 1)
                     (split 1)
                     (("1" (flatten) (expand "length") (ground))
                      ("2" (ground))))))
                  ("2"
                   (hide -4)
                   (ground)
                   (replace -1)
                   (case "FORALL (mm:posnat, ll:{lll:list[below(3)]|cons?(lll) AND length(lll) =mm}, m:below(mm)):
                                 nth(switch_one_entry(ll, m, new), m) = new")
                   (("1" (inst -1 "length(cdr(L))" "cdr(L)" "n-1"))
                    ("2"
                     (hide-all-but 1)
                     (induct "mm")
                     (("1" (ground)) ("2" (ground))
                      ("3"
                       (skeep)
                       (skeep)
                       (case "j!1=0")
                       (("1"
                         (case-replace "m=0")
                         (("1"
                           (expand "switch_one_entry")
                           (expand "nth")
                           (propax))
                          ("2" (typepred (m)) (ground))))
                        ("2"
                         (case "m=0")
                         (("1"
                           (replace -1)
                           (expand "switch_one_entry")
                           (expand "nth")
                           (propax))
                          ("2"
                           (expand "switch_one_entry" 3)
                           (ground)
                           (expand "nth" 3)
                           (inst -1 "cdr(ll)" "m-1")
                           (typepred (ll))
                           (expand "length" -3)
                           (ground)
                           (expand "length")
                           (ground))))))
                      ("4"
                       (skeep)
                       (skeep)
                       (typepred (ll))
                       (typepred "switch_one_entry(ll, m, new)")
                       (ground))))
                    ("3"
                     (hide -)
                     (skeep)
                     (typepred (m))
                     (typepred "mm")
                     (typepred (ll))
                     (typepred "switch_one_entry(ll, m, new)")
                     (ground))))))
                ("2"
                 (expand "length")
                 (lift-if)
                 (split)
                 (("1" (flatten) (ground))
                  ("2" (flatten) (typepred (n_1)) (ground))))))))
            ("2"
             (hide 4)
             (typepred "array2list[below(3)](length(L))(f)")
             (inst -3 "0")
             (ground)
             (replace -4)
             (expand "nth")
             (propax))))))))
      ("4" (skeep) (skeep) (grind))))
    ("3" (skeep) (ground) (grind))))


proof_type: f_proof
decl_type: formula
library: matrices
theory: query_coeff
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skolem 1 ("j" "_" "_" "_"))
   (case "FORALL (n:nat,
                       (f: [nat -> below(3)] | FORALL (k: above(j)): f(k) = 0),
                       (i: upto(j + 1)), (k: nat)): (n=j+1-i) IMPLIES (
                 k < i IMPLIES bump_one_ind(j, f, i)(k) = f(k))")
   (("1"
     (skeep)
     (inst?)
     (inst -1 "j+1-i")
     (split -1)
     (("1" (propax)) ("2" (propax))))
    ("2"
     (hide 2)
     (induct "n")
     (("1"
       (skeep)
       (typepred (f))
       (inst -1 "i")
       (("1"
         (expand "bump_one_ind")
         (lift-if 1)
         (split 1)
         (("1"
           (flatten)
           (split 1)
           (("1" (flatten) (ground)) ("2" (propax))))
          ("2" (flatten) (ground))))
        ("2" (ground))))
      ("2"
       (skeep)
       (simplify)
       (skeep)
       (expand "bump_one_ind" 1)
       (lift-if 1)
       (split 1)
       (("1" (flatten) (ground))
        ("2"
         (flatten)
         (split 2)
         (("1" (flatten) (ground))
          ("2"
           (flatten)
           (inst -1 "f" "i+1" "k")
           (("1"
             (split -1)
             (("1" (ground)) ("2" (ground)) ("3" (ground))))
            ("2" (ground))))))))))))


proof_type: f_proof
decl_type: formula
library: matrices
theory: query_coeff
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skeep)
   (lift-if 1)
   (split 1)
   (("1"
     (expand "base_n_to_nat")
     (lemma "sigma_with")
     (expand "bump_one_ind")
     (flatten)
     (case-replace
      "(LAMBDA (s: nat):
                        3 ^ s *
                         IF f(i) < 2 THEN f WITH [i := 1 + f(i)](s)
                         ELSE bump_one_ind(j, f, 1 + i) WITH [i := 0](s)
                         ENDIF) =  (LAMBDA (s: nat): 3 ^ s * f(s)) WITH [i:= 3^i*(1+f(i))]")
     (("1"
       (inst -2
        "(LAMBDA (s: nat): 3 ^ s * f(s)) WITH [i := 3 ^ i * (1 + f(i))]"
        "LAMBDA (s: nat): 3 ^ s * f(s)" "3 ^ i * (1 + f(i))" "1+j" "i"
        "0")
       (split -2)
       (("1" (ground)) ("2" (ground)) ("3" (ground))))
      ("2"
       (hide 2)
       (decompose-equality 1)
       (ground)
       (case "i=x!1")
       (("1" (ground)) ("2" (ground))))
      ("3" (flatten))))
    ("2"
     (flatten)
     (expand "base_n_to_nat")
     (expand "bump_one_ind" 2 1)
     (lemma "sigma_with")
     (inst -1
      "LAMBDA (s: nat):
                    3 ^ s *
                     IF f(i) < 2 THEN f WITH [i := 1 + f(i)](s)
                     ELSE bump_one_ind(j, f, 1 + i) WITH [i := 0](s)
                     ENDIF "
      " LAMBDA (s: nat): 3 ^ s * bump_one_ind(j, f, 1 + i)(s)" "0" "j+1"
      "i" "0")
     (("1"
       (split -1)
       (("1"
         (ground)
         (case "i+1<=j+1")
         (("1"
           (ground)
           (replace -2)
           (case-replace "bump_one_ind(j, f, 1 + i)(i) = f(i)")
           (("1" (ground))
            ("2" (lemma "bump_one_below") (inst?) (ground))))
          ("2"
           (hide (-1 3))
           (typepred (f))
           (typepred (i))
           (case "i<1+j")
           (("1" (ground))
            ("2"
             (case "i=1+j")
             (("1" (inst -3 "i") (("1" (ground)) ("2" (ground))))
              ("2" (ground))))))))
        ("2" (ground)) ("3" (ground))
        ("4"
         (hide 3)
         (decompose-equality 1)
         (("1" (case "x!1 = i") (("1" (ground)) ("2" (ground))))
          ("2"
           (typepred (f))
           (typepred (i))
           (case "i<1+j")
           (("1" (ground))
            ("2"
             (case "i=1+j")
             (("1" (inst -3 "i") (ground)) ("2" (ground))))))
          ("3"
           (typepred (f))
           (typepred (i))
           (case "i<1+j")
           (("1" (ground))
            ("2"
             (case "i=1+j")
             (("1" (inst -3 "i") (ground)) ("2" (ground))))))))))
      ("2"
       (typepred (f))
       (typepred (i))
       (case "i<1+j")
       (("1" (ground))
        ("2"
         (case "i=1+j")
         (("1" (inst -3 "i") (("1" (ground)) ("2" (ground))))
          ("2" (ground))))))
      ("3"
       (flatten)
       (typepred (f))
       (typepred (i))
       (case "i<1+j")
       (("1" (ground))
        ("2"
         (case "i=1+j")
         (("1" (inst -3 "i") (("1" (ground)) ("2" (ground))))
          ("2" (ground))))))))))


proof_type: f_proof
decl_type: formula
library: matrices
theory: query_coeff
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skolem 1 ("j" "_" "_"))
   (case "FORALL (n:nat, (f: [nat -> below(3)] | FORALL (k: above(j)): f(k) = 0),
                              (i: upto(1 + j))): n=i IMPLIES
                        (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)")
   (("1"
     (skeep)
     (inst?)
     (inst -1 "i")
     (split -1)
     (("1" (propax)) ("2" (propax))))
    ("2"
     (hide 2)
     (induct "n")
     (("1"
       (skeep)
       (replace -1 :dir rl)
       (simplify)
       (rewrite "sigma_eq_arg")
       (expand "bump_one_ind" 1 1)
       (inst -2 "0")
       (split -2)
       (("1"
         (ground)
         (expand "base_n_to_nat")
         (lemma "sigma_with")
         (inst -1
          "LAMBDA (s: nat):
                        3 ^ s * bump_one_ind(j, f, 1) WITH [(0) := 0](s)"
          "LAMBDA (s: nat): 3 ^ s * bump_one_ind(j, f, 1)(s)" "0" "j+1"
          "0" "0")
         (split -1)
         (("1"
           (rewrite "bump_one_below")
           (ground)
           (replace -2)
           (ground)
           (expand "*")
           (ground)
           (case-replace
            "(LAMBDA (s: nat):
                          (LAMBDA (x: nat): 3 ^ s * bump_one_ind(j, f, 1)(x))
                            WITH [(0) := 0]
                              (s)) = LAMBDA (s: nat):
                          3 ^ s * (bump_one_ind(j, f, 1) WITH [(0) := 0])(s)")
           (decompose-equality 1)
           (hide (-1 2))
           (grind))
          ("2" (ground)) ("3" (ground))
          ("4" (hide 2) (decompose-equality 1) (grind))))
        ("2" (ground))))
      ("2"
       (skeep)
       (skeep)
       (inst -1 "f" "i-1")
       (("1"
         (split -1)
         (("1"
           (simplify -1)
           (lemma "bump_one_ind_lem")
           (inst -1 "j" "f" "i")
           (lift-if -1)
           (inst-cp -4 "i")
           (split -5)
           (("1"
             (ground)
             (replace -3)
             (replace -1)
             (simplify 2)
             (both-sides "*" "-1" 2)
             (simplify 2)
             (replace -2)
             (expand "sigma" 2 2)
             (propax))
            ("2" (ground))))
          ("2" (skeep) (inst -3 "m") (ground)) ("3" (ground))))
        ("2" (ground))))
      ("3"
       (skeep)
       (hide 2)
       (typepred (f))
       (typepred (i))
       (inst -3 "i")
       (inst -2 "i")
       (("1" (ground)) ("2" (ground))))))
    ("3"
     (hide 2)
     (skeep)
     (typepred (f))
     (typepred (j))
     (typepred (i))
     (inst -4 "i")
     (inst -3 "i")
     (("1" (ground)) ("2" (ground))))))


proof_type: f_proof
decl_type: formula
library: matrices
theory: query_coeff
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skolem 1 ("j" "f" "_"))
   (case "FORALL (n:nat, i: {ii: upto(1 + j) | f(ii) < 2}):
                        LET M = low2(j, f, i) IN
                        n=i IMPLIES (
                          f(M) < 2 AND (FORALL (m: nat): m < M IMPLIES f(m) = 2))")
   (("1" (skeep) (inst -1 "i" "i"))
    ("2"
     (hide 2)
     (induct "n" 1 "NAT_induction")
     (("1" (ground))
      ("2"
       (skeep)
       (ground)
       (skeep)
       (expand "low2" 1)
       (lift-if 1)
       (split 1)
       (("1"
         (flatten)
         (inst -2 "choose({m: nat | m < i AND f(m) < 2}) ")
         (("1"
           (split -2)
           (("1"
             (inst -1 "choose({m: nat | m < i AND f(m) < 2}) ")
             (("1" (ground))
              ("2"
               (expand "nonempty?")
               (expand "empty?")
               (skeep -2)
               (inst -1 "m")
               (ground)
               (expand "member")
               (propax))))
            ("2" (ground))))
          ("2"
           (expand "nonempty?")
           (expand "empty?")
           (skeep -2)
           (inst -1 "m")
           (ground)
           (expand "member")
           (propax))))
        ("2"
         (flatten)
         (typepred (i))
         (ground)
         (case "nonempty?({m:nat| m<i AND f(m)<2})")
         (("1"
           (expand "nonempty?")
           (expand "empty?")
           (skeep)
           (expand "member")
           (inst 2 "x"))
          ("2"
           (expand "nonempty?")
           (skeep)
           (expand "empty?")
           (ground)
           (grind))))))))))


proof_type: f_proof
decl_type: formula
library: matrices
theory: query_coeff
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (case "FORALL (j: posnat,
                              (f: [nat -> below(3)] | FORALL (k: above(j)): f(k) = 0), n:{nn:upto(j+1)|f(nn)<2 AND (FORALL (m:nat):m<nn IMPLIES f(m) = 2 )}):
                        base_n_to_nat(3, bump_one_ind(j, f, 0), j + 1) =
                         base_n_to_nat(3, f, j + 1) + 1")
   (("1"
     (skeep)
     (case "EXISTS (nn:upto(j+1)): f(nn) < 2 AND
                                              (FORALL (m: nat): m < nn IMPLIES f(m) = 2)")
     (("1" (skeep) (inst? -3) (inst -3 "nn") (ground))
      ("2"
       (hide (-1 2))
       (typepred (f))
       (ground)
       (inst 1 " low2(j, f, j+1)")
       (("1"
         (lemma "low2_lem")
         (inst -1 "j" "f" "j+1")
         (("1" (ground)) ("2" (inst -1 "j+1") (ground))))
        ("2" (inst -1 "j+1") (ground))))))
    ("2"
     (hide 2)
     (skeep)
     (typepred (n))
     (lemma "bump_one_ind_lem2")
     (inst?)
     (case-replace "n=0")
     (("1"
       (typepred (j))
       (lemma "bump_one_ind_lem")
       (inst -1 "j" "f" "0")
       (ground)
       (expand "^")
       (expand "expt")
       (propax))
      ("2"
       (inst -1 "n-1")
       (("1"
         (split -1)
         (("1"
           (simplify -1)
           (lemma "bump_one_ind_lem")
           (inst -1 "j" "f" "n")
           (ground)
           (replace -1)
           (replace -2)
           (simplify 2)
           (rewrite "sigma_scal")
           (lemma "sigma_geometric")
           (inst -1 "n-1" "0" "3")
           (split -1)
           (("1"
             (replace -1)
             (simplify 2)
             (ground)
             (case-replace "2 * ((3 ^ 0 - 3 ^ n) / (-2)) = - (3^0-3^n)")
             (("1"
               (ground)
               (case "forall(a,b:real): a - (-b) = a+b")
               (("1"
                 (inst -1 "3^n" "(3 ^ 0 - 3 ^ n)")
                 (ground)
                 (replace -1)
                 (expand "^")
                 (expand "expt")
                 (propax))
                ("2" (hide-all-but 1) (skeep) (ground))))
              ("2" (hide-all-but 1) (cross-mult))))
            ("2" (ground)) ("3" (ground))))
          ("2" (ground) (skeep) (inst?) (ground))))
        ("2" (ground))))))))


proof_type: f_proof
decl_type: formula
library: matrices
theory: query_coeff
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skeep)
   (lemma "bump_one_prep")
   (inst?)
   (lemma "base_n_unique")
   (typepred (f))
   (replace -1)
   (lemma "base_n_is_n_alt")
   (inst -1 "3" "k" "upper_index(3, k) +2")
   (split -1)
   (("1"
     (replace -1 :dir rl)
     (inst -3 "upper_index(3,k)+2 " "3"
      "bump_one_ind(upper_index(3, k) + 1, base_n(3, k), 0)")
     (expand "base_n_to_nat" -4)
     (ground)
     (decompose-equality 1)
     (("1"
       (typepred "bump_one_ind(1 + upper_index(3, k), base_n(3, k), 0)")
       (case "x!1>2+upper_index(3,k)")
       (("1"
         (inst -2 "x!1")
         (lemma "upper_is_bound")
         (inst -1 "3" "k+1" "x!1")
         (split -1)
         (("1" (ground))
          ("2"
           (hide (2 -6 -2 -6))
           (hide -4)
           (expand "upper_index")
           (lift-if -1)
           (split -1)
           (("1"
             (flatten)
             (lemma "log_nat_incr")
             (replace -2)
             (expand "log_nat")
             (ground))
            ("2"
             (flatten)
             (lemma "log_nat_incr")
             (expand "log_nat" 2)
             (lift-if 2)
             (split 2)
             (("1" (flatten) (ground))
              ("2"
               (flatten)
               (flip-ineq 1)
               (expand "log_nat" 1)
               (lift-if 1)
               (split 1)
               (("1" (flatten) (ground))
                ("2"
                 (flatten)
                 (simplify 2)
                 (inst -2 "3" "(1 + k) / 3 / 3" "k")
                 (split -2)
                 (("1" (ground))
                  ("2" (hide (-3 -4 -2 3)) (grind-reals))))))))))))
        ("2"
         (inst -4 "x!1")
         (split -4)
         (("1" (ground)) ("2" (ground))))))
      ("2" (skeep) (rewrite "base_n_lt_n"))))
    ("2"
     (hide-all-but 1)
     (expand "upper_index")
     (lift-if 1)
     (split 1)
     (("1" (grind))
      ("2"
       (flatten)
       (lemma "log_nat_bounds")
       (inst -1 "3" "k")
       (ground)
       (flatten)
       (expand "^")
       (expand "expt" 2)
       (expand "expt" 2)
       (ground))))))


proof_type: f_proof
decl_type: formula
library: matrices
theory: query_coeff
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (case "FORALL (nn:nat, j: posnat, L: listn[below(3)](j + 1),
                       (f: [nat -> below(3)] | FORALL (k: above(j)): f(k) = 0),
                       i: upto(j + 1)): nn = j+1-i IMPLIES
                 ( 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)))")
   (("1" (skeep) (inst?) (inst -1 "j+1-i") (ground))
    ("2"
     (hide 2)
     (induct "nn")
     (("1"
       (skeep)
       (both-sides "+" "i" -1)
       (("1"
         (simplify)
         (expand "bump_one_ind_list")
         (lift-if 1)
         (ground)
         (lemma "bump_one_below")
         (lemma "list_extensionality[below(3)]")
         (inst?)
         (flatten)
         (hide -1)
         (typepred "array2list[below(3)](1 + j)(bump_one_ind(j, f, i))")
         (replace -2)
         (split -4)
         (("1" (propax)) ("2" (typepred (L)) (propax))
          ("3"
           (skeep)
           (inst -3 "n")
           (replace -3 :dir rl)
           (inst -4 "j" "f" "i" "n")
           (typepred (n))
           (ground)
           (replace -1)
           (typepred (f))
           (typepred (L))
           (replace -11 :dir rl)
           (hide 2)
           (typepred "array2list[below(3)](1 + j)(f)")
           (inst -3 "n")
           (ground))))
        ("2" (ground))))
      ("2"
       (skeep)
       (skeep)
       (case "nth(L,i) = f(i)")
       (("1"
         (case "f(i)<2")
         (("1"
           (expand "bump_one_ind_list")
           (expand "bump_one_ind")
           (hide -3)
           (ground)
           (lemma "switch_is_with")
           (inst -1 "L" "i" "1+f(i)" "f")
           (ground))
          ("2"
           (expand "bump_one_ind" 2)
           (expand "bump_one_ind_list" 2)
           (ground)
           (lemma "switch_is_with")
           (inst -1 "bump_one_ind_list(j, L, 1 + i)" "i" "0"
            "bump_one_ind(j, f, 1 + i)")
           (("1" (ground))
            ("2"
             (hide 3)
             (inst -2 "j" "L" "f" "i+1")
             (split -2)
             (("1" (ground)) ("2" (propax)) ("3" (ground))))))))
        ("2"
         (replace -3 :dir rl)
         (typepred "array2list[below(3)](j + 1)(f)")
         (inst -3 "i")
         (("1" (ground)) ("2" (ground))))
        ("3" (ground))))))))


proof_type: f_proof
decl_type: formula
library: matrices
theory: query_coeff
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (case "FORALL (nn:nat, 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)}):
                        nn = 3^n-i IMPLIES
                        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)))")
   (("1" (skeep) (inst?) (inst -1 "3^n-i"))
    ("2"
     (hide 2)
     (skolem 1 ("_" "n" "F" "G" "_" "_" "_"))
     (induct "nn")
     (("1"
       (skeep)
       (both-sides "+" "i" -1)
       (simplify -1)
       (replace -1)
       (expand "dot_tail_sum2plus")
       (expand "sigma")
       (propax))
      ("2"
       (skeep)
       (skeep)
       (expand "dot_tail_sum2plus" 1)
       (lift-if 1)
       (split 1)
       (("1" (flatten) (ground))
        ("2"
         (flatten)
         (inst -1 "is_nonzero(n, L, F, G) + a" "i+1"
          "bump_one_list(n - 1, i, L)")
         (("1"
           (split -1)
           (("1"
             (replace -1)
             (swap-rel 2)
             (rewrite "sigma_first" (2 2))
             (simplify 2)
             (typepred "is_nonzero(n, L, F, G)")
             (typepred (L))
             (ground))
            ("2" (ground))))
          ("2" (ground))))))
      ("3" (skeep) (ground))))
    ("3" (skeep) (ground))))


proof_type: f_proof
decl_type: formula
library: matrices
theory: query_coeff
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skolem 1 ("n" "F" "G" "_" "_"))
   (case "FORALL (nn:nat, a: real, i: upto(3 ^ n)): nn=3^n-i IMPLIES
                 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))) ")
   (("1" (skeep) (inst?) (inst -1 "3^n-i"))
    ("2"
     (hide 2)
     (induct "nn")
     (("1"
       (skeep)
       (both-sides "+" "i" -1)
       (simplify -1)
       (replace -1)
       (expand "dot_tail_sum2")
       (expand "sigma")
       (propax))
      ("2"
       (skeep)
       (skeep)
       (expand "dot_tail_sum2" 1)
       (lift-if 1)
       (split 1)
       (("1" (flatten) (ground))
        ("2"
         (flatten)
         (inst -1 "is_nz(n, base_n(3, i), F, G) + a " "1 + i")
         (split -1)
         (("1"
           (typepred "bump_one(i, base_n(3, i))")
           (replace -1)
           (replace -2)
           (swap-rel 2)
           (("1"
             (rewrite "sigma_first" 2)
             (("1" (typepred "is_nz(n, base_n(3, i), F, G)") (ground))
              ("2" (skeep) (skeep) (rewrite "base_n_lt_n"))))
            ("2" (skeep) (skeep) (rewrite "base_n_lt_n"))))
          ("2" (ground))))))
      ("3" (skeep) (skeep) (skeep) (skeep) (rewrite "base_n_lt_n"))
      ("4" (skeep) (ground))
      ("5" (skeep) (skeep) (skeep) (rewrite "base_n_lt_n"))))
    ("3" (skeep) (skeep) (skeep) (skeep) (rewrite "base_n_lt_n"))
    ("4" (skeep) (ground))
    ("5" (skeep) (skeep) (skeep) (rewrite "base_n_lt_n"))))


proof_type: t_proof
decl_type: tcc
library: matrices
theory: query_coeff
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skeep)
   (skeep)
   (typepred " v(j, f, i + 1)")
   (("1" (typepred (k)) (inst -2 "k") (ground))
    ("2"
     (typepred (i))
     (case "i<1+j")
     (("1" (ground))
      ("2"
       (case "i=1+j")
       (("1" (ground) (typepred (f)) (inst -1 "i") (ground))
        ("2" (ground))))))))


proof_type: t_proof
decl_type: tcc
library: matrices
theory: query_coeff
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skeep)
   (split 2)
   (("1" (grind))
    ("2"
     (skeep)
     (typepred "v(cdr[below(3)](L), n-1, new)")
     (("1"
       (inst -3 "i-1")
       (("1"
         (grind)
         (expand "nth" 2 1)
         (lift-if 2)
         (split 2)
         (("1" (flatten) (ground)) ("2" (flatten) (ground))))
        ("2" (grind) (typepred (L)) (typepred (i)) (grind))))
      ("2" (typepred (n)) (grind)) ("3" (typepred (n)) (grind))))))


proof_type: t_proof
decl_type: tcc
library: matrices
theory: query_coeff
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skeep)
   (typepred (j))
   (lemma "expt_ge1")
   (inst -1 "3" "j+1")
   (ground)
   (skeep)
   (grind)
   (typepred (L))
   (grind))


proof_type: t_proof
decl_type: tcc
library: matrices
theory: query_coeff
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skeep)
   (skeep)
   (typepred "v(j, L, i + 1)")
   (("1" (ground) (grind)) ("2" (typepred (L)) (ground))))


proof_type: t_proof
decl_type: tcc
library: matrices
theory: query_coeff
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skeep)
   (typepred (i))
   (case "i=j+1")
   (("1"
     (typepred (f))
     (inst -1 "i")
     (("1" (inst -4 "i") (ground)) ("2" (ground))))
    ("2" (ground))))


proof_type: t_proof
decl_type: tcc
library: matrices
theory: query_coeff
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skeep)
   (skeep)
   (typepred (f))
   (typepred (k_1))
   (lemma "upper_is_bound")
   (inst?)
   (inst -1 "k_1")
   (ground))


proof_type: t_proof
decl_type: tcc
library: matrices
theory: query_coeff
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skeep)
   (lemma "switch_to_array")
   (inst -1 "j" "L" "base_n(3,k)" "0")
   (("1"
     (typepred (L))
     (split -4)
     (("1"
       (replace -1)
       (expand "base_list")
       (case-replace
        "bump_one_ind(j, base_n(3, k), 0) = base_n(3, 1 + k)")
       (hide -)
       (hide 2)
       (lemma "bump_one_prep")
       (inst -1 "j" " base_n(3, k)")
       (lemma "base_n_is_n_alt")
       (inst -1 "3" "k" "j+1")
       (typepred (k))
       (split -2)
       (("1"
         (replace -1 :dir rl)
         (lemma "base_n_to_nat_unique")
         (inst -1 "3" "k" "j+1" "bump_one_ind(j, base_n(3, k), 0)"
          " base_n(3, k+1)")
         (split -1)
         (("1"
           (decompose-equality 1)
           (("1"
             (typepred "bump_one_ind(j, base_n(3, k), 0)")
             (case "x!1 >1+j")
             (("1"
               (inst -2 "x!1")
               (lemma "base_n_0")
               (inst -1 "3 " "1+k" "x!1")
               (split -1)
               (("1" (ground))
                ("2"
                 (typepred (k))
                 (case "k=0")
                 (("1"
                   (replace -1)
                   (lemma "both_sides_expt_gt1_gt")
                   (inst -1 "3" "x!1" "1+j")
                   (ground)
                   (case "forall (a,b:nat): a<b IMPLIES a+1<=b")
                   (("1" (inst -1 "0" "3^(1+j)") (ground))
                    ("2" (skeep) (ground))))
                  ("2"
                   (case "k+1<=3^(1+j)")
                   (("1"
                     (lemma "both_sides_expt_gt1_gt")
                     (inst -1 "3" "x!1" "1+j")
                     (flatten)
                     (ground))
                    ("2"
                     (ground)
                     (case "forall (a,b:nat): a<b IMPLIES a+1<=b")
                     (("1" (inst -1 "k" "3^(1+j)") (ground))
                      ("2" (skeep) (ground))))))))))
              ("2" (inst -2 "x!1") (ground))))
            ("2" (skeep) (rewrite "base_n_lt_n"))))
          ("2"
           (skeep)
           (rewrite "base_n_lt_n")
           (typepred "bump_one_ind(j, base_n(3, k), 0)")
           (ground))
          ("3"
           (replace -3)
           (lemma "base_n_is_n_alt")
           (inst -1 "3" "k+1" "j+1")
           (split -1)
           (("1" (propax))
            ("2"
             (case "forall (a,b:nat): a<b IMPLIES a+1<=b")
             (("1"
               (inst -1 "k" "3^(1+j)")
               (ground)
               (lemma "both_sides_expt_gt1_gt")
               (inst -1 "3" "j+2" "j+1")
               (ground))
              ("2" (skeep) (ground))))))))
        ("2"
         (expand "^")
         (expand "expt" 1)
         (case "1<3")
         (("1" (mult-ineq -1 -2) (ground)) ("2" (ground))))))
      ("2" (expand "base_list") (ground))))
    ("2"
     (split 1)
     (("1" (skeep) (rewrite "base_n_lt_n"))
      ("2"
       (skeep)
       (typepred (k_1))
       (typepred (k))
       (lemma "base_n_0")
       (inst -1 "3" "k" "k_1")
       (case "k_1>=j+1")
       (("1"
         (lemma "both_sides_expt_gt1_ge")
         (inst -1 "3" "k_1" "j+1")
         (flatten)
         (hide -1)
         (ground))
        ("2" (ground))))))))


proof_type: t_proof
decl_type: tcc
library: matrices
theory: query_coeff
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skeep)
   (skeep)
   (ground)
   (typepred (i))
   (ground)
   (case "forall (a, b:nat): a<b IMPLIES a+1<=b")
   (("1" (inst -1 "i" "3^n") (ground)) ("2" (skeep) (ground))))


proof_type: t_proof
decl_type: tcc
library: matrices
theory: query_coeff
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skeep)
   (skeep)
   (typepred (i))
   (ground)
   (case "forall (k, l:nat): k<l IMPLIES k+1<=l")
   (("1" (inst -1 "i" "3^n") (ground))
    ("2" (hide-all-but 1) (skeep) (ground))))


proof_type: t_proof
decl_type: tcc
library: matrices
theory: query_coeff
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skeep)
   (skeep)
   (typepred (i))
   (case "forall (a, b:nat): a<b IMPLIES a+1<=b")
   (("1" (inst -1 "i" "3^n") (ground)) ("2" (skeep) (ground))))


proof_type: f_proof
decl_type: formula
library: measure_integration
theory: generalized_measure_def
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skosimp)
   (expand "measure?")
   (flatten)
   (expand "measure_countably_additive?")
   (inst -
    "lambda (i:nat): if i=0 then a!1 elsif i=1 then b!1 else emptyset endif")
   (("1"
     (case-replace
      "IUnion(LAMBDA (i: nat):
                               IF i = 0 THEN a!1
                               ELSIF i = 1 THEN b!1
                               ELSE emptyset
                               ENDIF)=union(a!1, b!1)")
     (("1"
       (assert)
       (hide -1)
       (expand "o")
       (case "x_eq(x_add(f!1(a!1), f!1(b!1)),x_sum(LAMBDA (x: nat):
                                IF x = 0 THEN f!1(a!1)
                                ELSE IF x = 1 THEN f!1(b!1) ELSE f!1(emptyset) ENDIF
                                ENDIF))")
       (("1"
         (name-replace "LHS" "f!1(union(a!1, b!1))")
         (name-replace "RHS" "x_add(f!1(a!1), f!1(b!1))")
         (expand "x_eq")
         (flatten)
         (assert)
         (flatten)
         (assert))
        ("2"
         (hide -2 2)
         (expand "measure_empty?")
         (replace -1)
         (expand "x_eq")
         (expand "x_add")
         (expand "x_sum")
         (case-replace "f!1(a!1)`1 AND f!1(b!1)`1")
         (("1"
           (flatten)
           (replace -1)
           (replace -2)
           (assert)
           (lemma "zero_tail_series_conv"
            ("a"
             "LAMBDA (i:nat):
                                          IF i = 0 THEN f!1(a!1)`2
                                          ELSE IF i = 1 THEN f!1(b!1)`2 ELSE 0 ENDIF
                                          ENDIF"
             "n"
             "1"))
           (lemma "zero_tail_series_limit"
            ("a"
             "LAMBDA (i:nat):
                                          IF i = 0 THEN f!1(a!1)`2
                                          ELSE IF i = 1 THEN f!1(b!1)`2 ELSE 0 ENDIF
                                          ENDIF"
             "n"
             "1"))
           (case-replace
            "FORALL (m:nat):
                     1 < m =>
                      (LAMBDA (i: nat):
                         IF i = 0 THEN f!1(a!1)`2
                         ELSE IF i = 1 THEN f!1(b!1)`2 ELSE 0 ENDIF
                         ENDIF)
                          (m)
                       = 0")
           (("1"
             (replace -3)
             (replace -2)
             (hide-all-but 1)
             (expand "series")
             (expand "sigma")
             (expand "sigma")
             (expand "sigma")
             (assert))
            ("2" (hide -1 -2 2) (skosimp) (assert))))
          ("2"
           (replace 1)
           (assert)
           (case-replace "f!1(a!1)`1")
           (("1" (assert) (prop) (inst - "1") (assert))
            ("2" (assert) (hide 2) (prop) (inst - "0"))))))
        ("3" (skosimp) (rewrite "S_empty"))))
      ("2"
       (hide-all-but 1)
       (apply-extensionality :hide? t)
       (expand "union")
       (expand "member")
       (expand "IUnion")
       (expand "emptyset")
       (case-replace "a!1(x!1)")
       (("1" (inst + "0"))
        ("2"
         (case-replace "b!1(x!1)")
         (("1" (inst + "1") (assert)) ("2" (assert))))))))
    ("2"
     (hide-all-but (-1 -2 1))
     (expand "disjoint_indexed_measurable?")
     (expand "disjoint?")
     (hide -1)
     (skosimp)
     (case-replace "i!1=0")
     (("1"
       (case-replace "j!1=1")
       (("1" (assert) (expand "disjoint?") (propax))
        ("2" (assert) (expand "disjoint?") (hide-all-but 3) (grind))))
      ("2"
       (assert)
       (case-replace "i!1=1")
       (("1"
         (case-replace "j!1=0")
         (("1"
           (hide-all-but (-3 3))
           (expand "disjoint?")
           (expand "intersection")
           (expand "empty?")
           (expand "member")
           (skosimp)
           (inst - "x!1")
           (assert))
          ("2" (assert) (hide-all-but 4) (grind))))
        ("2" (assert) (hide-all-but 4) (grind))))))
    ("3" (skosimp) (rewrite "S_empty"))))


proof_type: f_proof
decl_type: formula
library: measure_integration
theory: generalized_measure_def
signature: nil
run_date: Unknown date
run_time: ----
status: proved-incomplete
description: nil
script:
  (""
   (skosimp)
   (expand "measure?")
   (split)
   (("1"
     (expand "measure_empty?")
     (expand "x_sum")
     (case-replace "FORALL (i_1: nat): F!1(i_1)(emptyset[T]) = (TRUE,0)")
     (("1"
       (case-replace "FORALL (i_1: nat): F!1(i_1)(emptyset[T])`1")
       (("1"
         (hide -1)
         (case-replace
          "(LAMBDA (i_1: nat): F!1(i_1)(emptyset[T])`2)=lambda i: 0")
         (("1"
           (hide -1 -2)
           (rewrite "zero_series_conv")
           (rewrite "zero_series_limit"))
          ("2"
           (hide 2)
           (apply-extensionality :hide? t)
           (("1" (inst - "x!1") (assert) (replace -1) (assert))
            ("2" (rewrite "S_empty"))))
          ("3" (rewrite "S_empty"))))
        ("2" (hide 2) (skosimp) (inst - "i!1") (assert))
        ("3" (rewrite "S_empty"))))
      ("2"
       (hide 2)
       (skosimp)
       (typepred "F!1(i!1)")
       (expand "measure?")
       (expand "measure_empty?")
       (flatten))
      ("3" (rewrite "S_empty"))))
    ("2"
     (expand "measure_countably_additive?")
     (skosimp)
     (case "forall i: measure?(F!1(i))")
     (("1"
       (expand "measure?")
       (expand "measure_countably_additive?")
       (case "forall i: x_eq(x_sum(F!1(i) o X!1), F!1(i)(IUnion(X!1)))")
       (("1"
         (name-replace "AA" "IUnion(X!1)")
         (hide -2)
         (expand "o ")
         (lemma "double_x_sum_eq"
          ("U" "LAMBDA (i,j:nat): F!1(j)(X!1(i))"))
         (assert)
         (name-replace "LHS"
          "x_sum(LAMBDA (x: nat): (x_sum(LAMBDA i: F!1(i)(X!1(x)))))")
         (case "x_eq(x_sum(LAMBDA (j_1: nat):
                                  x_sum(LAMBDA (i_1: nat): F!1(j_1)(X!1(i_1)))),x_sum(LAMBDA i: F!1(i)(AA)))")
         (("1"
           (hide -3)
           (expand "x_eq")
           (flatten)
           (assert)
           (flatten)
           (assert))
          ("2"
           (hide 2 -1)
           (lemma "x_sum_eq"
            ("S"
             "LAMBDA (j_1: nat):
                                x_sum(LAMBDA (i_1: nat): F!1(j_1)(X!1(i_1)))"
             "T"
             "LAMBDA i: F!1(i)(AA)"))
           (split -1)
           (("1" (propax)) ("2" (hide 2) (skosimp) (inst - "i!1"))))))
        ("2"
         (hide 2)
         (skosimp)
         (inst - "i!1")
         (flatten)
         (inst - "X!1")
         (assert))
        ("3" (propax))))
      ("2" (hide 2) (skosimp) (assert))))))


proof_type: t_proof
decl_type: tcc
library: measure_integration
theory: generalized_measure_def
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (expand "zero_measure")
   (expand "measure?")
   (expand "measure_empty?")
   (expand "measure_countably_additive?")
   (skosimp)
   (expand "o ")
   (expand "x_sum")
   (expand "x_eq")
   (rewrite "zero_series_conv")
   (rewrite "zero_series_limit"))


proof_type: t_proof
decl_type: tcc
library: measure_integration
theory: generalized_measure_def
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (expand "measure?")
   (split)
   (("1" (expand "measure_empty?") (lift-if) (assert) (grind))
    ("2"
     (expand "measure_countably_additive?")
     (skosimp*)
     (expand "o")
     (case-replace "empty?[T](IUnion(X!1))")
     (("1"
       (expand "x_eq")
       (case-replace
        "(LAMBDA (x: nat):
                      IF empty?[T](X!1(x)) THEN (TRUE, 0) ELSE (FALSE, 0) ENDIF) = lambda (n:nat): (TRUE, 0)")
       (("1"
         (hide -1)
         (expand "x_sum")
         (rewrite "zero_series_conv")
         (rewrite "zero_series_limit"))
        ("2"
         (hide 2 -2)
         (apply-extensionality :hide? t)
         (lift-if)
         (prop)
         (hide 2)
         (expand "empty?")
         (skosimp)
         (inst - "x!2")
         (expand "member")
         (expand "IUnion")
         (inst + "x!1"))))
      ("2"
       (assert)
       (expand "x_eq")
       (expand "x_sum")
       (case-replace
        "FORALL i: IF empty?[T](X!1(i)) THEN TRUE ELSE FALSE ENDIF")
       (("1"
         (hide -2)
         (expand "empty?")
         (expand "IUnion")
         (expand "member")
         (skosimp)
         (skosimp*)
         (inst - "i!1")
         (prop)
         (("1" (inst - "x!1")) ("2" (inst - "x!1"))))
        ("2" (replace 1 3) (propax))))))))


proof_type: t_proof
decl_type: tcc
library: measure_integration
theory: generalized_measure_def
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (expand "complete_measure?")
   (expand "trivial_measure")
   (expand "measure_complete?")
   (skosimp*)
   (lift-if)
   (assert)
   (prop)
   (rewrite "emptyset_is_empty?")
   (replace -1)
   (hide -1)
   (expand "subset?")
   (expand "emptyset")
   (expand "member")
   (case-replace "x!1=emptyset[T]")
   (("1" (hide -1 -2) (assert) (rewrite "S_empty"))
    ("2"
     (hide 2)
     (apply-extensionality :hide? t)
     (expand "emptyset")
     (inst - "x!2"))))


proof_type: t_proof
decl_type: tcc
library: measure_integration
theory: generalized_measure_def
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (expand "trivial_finite_measure")
   (expand "finite_measure?")
   (skosimp)
   (expand "o ")
   (lemma "single_nz_series" ("a" "(LAMBDA (x: nat): 0)" "n" "0"))
   (split -1)
   (("1"
     (assert)
     (expand "series")
     (hide -1)
     (expand "convergence")
     (skosimp)
     (inst + "0")
     (skosimp)
     (rewrite "sigma_zero")
     (expand "abs")
     (assert))
    ("2" (hide-all-but 1) (skosimp))))


proof_type: t_proof
decl_type: tcc
library: measure_integration
theory: generalized_measure_def
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skosimp)
   (typepred "m!1")
   (expand "finite_measure?")
   (expand "measure?")
   (flatten)
   (split)
   (("1" (expand "measure_empty?") (propax))
    ("2"
     (expand "measure_countably_additive?")
     (skosimp)
     (inst - "X!1")
     (assert)
     (expand "o ")
     (expand "x_sum")
     (expand "x_eq")
     (lift-if)
     (assert)
     (case-replace
      "convergence_sequences.convergent?(series(LAMBDA i: m!1(X!1(i))))")
     (("1" (rewrite "convergence_sequences.limit_def"))
      ("2" (expand "convergent?") (inst + "m!1(IUnion(X!1))"))))))


proof_type: f_proof
decl_type: formula
library: measure_integration
theory: subset_algebra_def
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (expand "subset_algebra_union?")
   (expand "sigma_algebra_union?")
   (skosimp*)
   (typepred "x!1")
   (typepred "y!1")
   (name "U" "union(singleton(x!1),singleton(y!1))")
   (inst - "U")
   (case-replace
    "(FORALL (x: (extend[setof[T], (S!1), bool, FALSE](U))):
               member(x, S!1))")
   (("1"
     (split -5)
     (("1"
       (expand "member")
       (expand "extend")
       (expand "Union")
       (expand "union")
       (assert)
       (case-replace
        "{x: T |
                     EXISTS (a:
                               (LAMBDA (t: setof[T]):
                                  IF (S!1)(t) THEN U(t) ELSE FALSE ENDIF)):
                       a(x)} = {x: T | member(x, x!1) OR member(x, y!1)}")
       (hide 2)
       (apply-extensionality 1 :hide? t)
       (expand "member")
       (case-replace "x!1(x!2)")
       (("1"
         (inst + "x!1")
         (expand "U")
         (expand "singleton")
         (expand "union")
         (expand "member")
         (propax))
        ("2"
         (assert)
         (case-replace "y!1(x!2)")
         (("1"
           (inst + "y!1")
           (expand "U")
           (expand "singleton")
           (expand "union")
           (expand "member")
           (propax))
          ("2"
           (assert)
           (skosimp)
           (typepred "a!1")
           (assert)
           (expand "U" -1)
           (expand "singleton")
           (expand "union")
           (expand "member")
           (propax))))))
      ("2"
       (hide 2)
       (expand "extend")
       (expand "is_countable[set[T]]")
       (inst + "lambda (x:setof[T]): IF x = x!1 THEN 0 ELSE 1 ENDIF")
       (expand "injective?")
       (skosimp*)
       (expand "restrict")
       (typepred "x1!1")
       (typepred "x2!1")
       (assert)
       (expand "U")
       (expand "singleton")
       (expand "union")
       (expand "member")
       (hide-all-but (-1 -3 -5 1))
       (split -1)
       (("1" (split -2) (("1" (assert)) ("2" (assert))))
        ("2" (split -2) (("1" (assert)) ("2" (assert))))))))
    ("2"
     (hide 2)
     (skosimp*)
     (typepred "x!2")
     (expand "extend")
     (case-replace "S!1(x!2)")
     (("1" (expand "member") (propax)) ("2" (assert))))))


proof_type: f_proof
decl_type: formula
library: measure_integration
theory: subset_algebra_def
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skosimp*)
   (expand "sigma_algebra?")
   (expand "subset_algebra?")
   (flatten)
   (assert)
   (rewrite "sigma_union_implies_subset_union"))


proof_type: f_proof
decl_type: formula
library: measure_integration
theory: subset_algebra_def
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (expand "sigma_algebra?")
   (split)
   (("1" (expand "subset_algebra_empty?") (grind)) ("2" (grind))
    ("3" (grind))))


proof_type: f_proof
decl_type: formula
library: measure_integration
theory: subset_algebra_def
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skosimp)
   (expand "generated_sigma_algebra")
   (expand "subset?")
   (expand "Intersection")
   (expand "member")
   (skosimp*)
   (typepred "a!1")
   (inst - "x!1")
   (expand "member")
   (assert))


proof_type: f_proof
decl_type: formula
library: measure_integration
theory: subset_algebra_def
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skosimp)
   (expand "generated_sigma_algebra")
   (expand "Intersection")
   (expand "subset?" 1 1)
   (expand "member")
   (skosimp)
   (inst - "Y!1")
   (assert))


proof_type: f_proof
decl_type: formula
library: measure_integration
theory: subset_algebra_def
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skosimp)
   (lemma "generated_sigma_algebra_subset2" ("X" "A!1" "Y" "A!1"))
   (assert)
   (rewrite "subset_reflexive")
   (lemma "generated_sigma_algebra_subset1" ("X" "A!1"))
   (lemma "subset_antisymmetric"
    ("a" "generated_sigma_algebra(A!1)" "b" "A!1"))
   (assert))


proof_type: f_proof
decl_type: formula
library: measure_integration
theory: subset_algebra_def
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skosimp)
   (typepred "A!1")
   (typepred "B!1")
   (expand "intersection")
   (expand "sigma_algebra?")
   (flatten)
   (expand "member")
   (split)
   (("1" (expand "subset_algebra_empty?") (expand "member") (assert))
    ("2"
     (expand "subset_algebra_complement?")
     (skosimp)
     (typepred "x!1")
     (inst - "x!1")
     (inst - "x!1")
     (expand "member")
     (assert))
    ("3"
     (expand "sigma_algebra_union?")
     (skosimp)
     (expand "member")
     (inst -5 "X!1")
     (inst -8 "X!1")
     (assert)
     (split -5)
     (("1"
       (split -8)
       (("1" (assert)) ("2" (skosimp) (inst - "x!1") (flatten))))
      ("2" (skosimp) (inst - "x!1") (flatten))))))


proof_type: f_proof
decl_type: formula
library: measure_integration
theory: subset_algebra_def
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (expand "member")
   (skosimp)
   (expand "sigma")
   (expand "extend")
   (expand "Union")
   (expand "generated_sigma_algebra")
   (expand "Intersection")
   (expand "subset?")
   (expand "member")
   (skosimp*)
   (typepred "a!1")
   (expand "subset?")
   (expand "member")
   (inst - "x!1")
   (split -2)
   (("1" (propax)) ("2" (inst + "A!1"))))


proof_type: f_proof
decl_type: formula
library: measure_integration
theory: subset_algebra_def
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (lemma "powerset_is_sigma_algebra")
   (lemma "sigma_algebra_is_subset_algebra")
   (inst - "powerset(fullset[T])"))


proof_type: f_proof
decl_type: formula
library: measure_integration
theory: subset_algebra_def
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skosimp)
   (expand "subset?")
   (expand "member")
   (skosimp)
   (expand "generated_subset_algebra")
   (expand "Intersection")
   (skosimp)
   (typepred "a!1")
   (expand "subset?")
   (inst - "x!1")
   (expand "member")
   (assert))


proof_type: f_proof
decl_type: formula
library: measure_integration
theory: subset_algebra_def
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skosimp)
   (expand "subset?" +)
   (expand "member")
   (skosimp)
   (expand "generated_subset_algebra")
   (expand "Intersection")
   (inst - "Y!1")
   (assert))


proof_type: f_proof
decl_type: formula
library: measure_integration
theory: subset_algebra_def
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skosimp)
   (typepred "B!1")
   (lemma "generated_subset_algebra_subset1" ("X" "B!1"))
   (lemma "generated_subset_algebra_subset2" ("X" "B!1" "Y" "B!1"))
   (assert)
   (rewrite "subset_reflexive")
   (lemma "subset_antisymmetric"
    ("a" "generated_subset_algebra(B!1)" "b" "B!1"))
   (assert))


proof_type: f_proof
decl_type: formula
library: measure_integration
theory: subset_algebra_def
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skosimp)
   (typepred "A!1")
   (typepred "B!1")
   (expand "subset_algebra?")
   (flatten)
   (split)
   (("1"
     (expand "subset_algebra_empty?")
     (expand "member")
     (expand "intersection")
     (expand "member")
     (assert))
    ("2"
     (expand "subset_algebra_complement?")
     (skosimp)
     (expand "complement")
     (expand "member")
     (expand "intersection")
     (expand "member")
     (inst - "x!1")
     (("1"
       (inst - "x!1")
       (("1" (assert))
        ("2"
         (typepred "x!1")
         (expand "intersection")
         (flatten)
         (expand "member")
         (propax))))
      ("2"
       (typepred "x!1")
       (expand "intersection")
       (expand "member")
       (flatten))))
    ("3"
     (expand "subset_algebra_union?")
     (skosimp)
     (typepred "x!1")
     (typepred "y!1")
     (expand "intersection")
     (expand "member")
     (flatten)
     (inst - "x!1" "y!1")
     (inst - "x!1" "y!1")
     (assert))))


proof_type: f_proof
decl_type: formula
library: measure_integration
theory: subset_algebra_def
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skosimp)
   (expand "subset?")
   (skosimp)
   (expand "member")
   (expand "subset")
   (expand "generated_subset_algebra")
   (expand "Intersection")
   (skosimp)
   (typepred "a!1")
   (expand "subset?")
   (expand "member")
   (inst - "x!1")
   (assert)
   (hide 2)
   (expand "extend")
   (expand "Union")
   (inst + "B!1"))


proof_type: f_proof
decl_type: formula
library: measure_integration
theory: subset_algebra_def
signature: nil
run_date: Unknown date
run_time: ----
status: proved-complete
description: nil
script:
  (""
   (skosimp*)
   (case "subset?(finite_disjoint_unions(NX!1),generated_subset_algebra(NX!1))")
   (("1"
     (lemma "generated_subset_algebra_subset2"
      ("X" "NX!1" "Y" "finite_disjoint_unions(NX!1)"))
     (split -1)
     (("1"
       (lemma "subset_antisymmetric"
        ("a"
         "generated_subset_algebra(NX!1)"
         "b"
         "finite_disjoint_unions(NX!1)"))
       (assert))
      ("2"
       (hide-all-but 1)
       (expand "finite_disjoint_unions")
       (expand "fullset")
       (expand "extend")
       (expand "subset?")
       (expand "member")
       (skosimp)
       (assert)
       (prop)
       (expand "finite_disjoint_union?")
       (inst + "lambda n: if n=0 then x!1 else emptyset[T] endif" "1")
       (split)
       (("1"
         (expand "disjoint?")
         (expand "emptyset")
         (expand "disjoint?")
         (expand "intersection")
         (expand "empty?")
         (expand "member")
         (skosimp)
         (skosimp)
         (assert)
         (grind))
        ("2"
         (apply-extensionality :hide? t)
         (expand "emptyset")
         (expand "IUnion")
         (case-replace "x!1(x!2)")
         (("1" (inst + "0")) ("2" (assert))))
        ("3"
         (skosimp)
         (expand "member")
         (rewrite "emptyset_is_empty?")
         (rewrite "emptyset_is_empty?")
         (case-replace "i!1 < 1")
         (("1" (assert)) ("2" (assert))))))
      ("3"
       (hide 2)
       (hide -1)
       (case "forall (a,b:(finite_disjoint_unions(NX!1))): finite_disjoint_unions(NX!1)(intersection(a,b))")
       (("1"
         (case "finite_disjoint_unions(NX!1)(emptyset)")
         (("1"
           (case "FORALL (a: (finite_disjoint_unions(NX!1))):
                         finite_disjoint_unions(NX!1)(complement(a))")
           (("1"
             (expand "subset_algebra?")
             (split)
             (("1"
               (expand "subset_algebra_empty?")
               (expand "member")
               (propax))
              ("2"
               (expand "subset_algebra_complement?")
               (skosimp)
               (expand "member")
               (inst - "x!1"))
              ("3"
               (expand "subset_algebra_union?")
               (expand "member")
               (skosimp)
               (inst-cp - "y!1")
               (inst-cp - "x!1")
               (inst - "complement(x!1)" "complement(y!1)")
               (rewrite "demorgan1" -5 :dir rl)
               (inst - "complement(union(x!1, y!1))")
               (rewrite "complement_complement"))))
            ("2"
             (hide 2)
             (skosimp)
             (typepred "a!1")
             (expand "finite_disjoint_unions" -1)
             (expand "fullset")
             (expand "extend")
             (prop)
             (expand "finite_disjoint_union?" -1)
             (skosimp)
             (expand "member")
             (case-replace "n!1=0")
             (("1"
               (assert)
               (case-replace "a!1=emptyset")
               (("1"
                 (rewrite "complement_emptyset" 1)
                 (hide -1 -2 -3 -4 -5)
                 (typepred "NX!1")
                 (expand "nonempty?")
                 (expand "empty?" 1)
                 (skosimp)
                 (expand "member")
                 (inst -5 "x!1")
                 (expand "finite_disjoint_union?" -5)
                 (skosimp)
                 (expand "member")
                 (expand "finite_disjoint_unions" 1)
                 (expand "fullset" 1 1)
                 (expand "extend")
                 (prop)
                 (expand "finite_disjoint_union?")
                 (inst +
                  "lambda i: if i = 0 then x!1 else E!2(i-1) endif"
                  "n!2+1")
                 (("1"
                   (split)
                   (("1"
                     (hide-all-but (-6 -5 1))
                     (expand "disjoint?")
                     (expand "disjoint?")
                     (expand "intersection")
                     (expand "member")
                     (expand "empty?")
                     (expand "member")
                     (skosimp*)
                     (case-replace "i!1=0")
                     (("1"
                       (assert)
                       (lemma "extensionality_postulate"
                        ("f" "complement(x!1)" "g" "IUnion(E!2)"))
                       (flatten -1)
                       (hide -1)
                       (split -1)
                       (("1"
                         (hide -6)
                         (inst - "x!2")
                         (expand "complement")
                         (expand "member")
                         (expand "IUnion")
                         (inst + "j!1-1"))
                        ("2" (propax))))
                      ("2"
                       (assert)
                       (case-replace "j!1=0")
                       (("1"
                         (lemma "extensionality_postulate"
                          ("f" "complement(x!1)" "g" "IUnion(E!2)"))
                         (flatten -1)
                         (hide -1)
                         (split)
                         (("1"
                           (inst - "x!2")
                           (expand "complement")
                           (expand "member")
                           (assert)
                           (replace -4 -1)
                           (assert)
                           (expand "IUnion")
                           (inst + "i!1-1"))
                          ("2" (propax))))
                        ("2"
                         (assert)
                         (inst - "i!1 - 1" "j!1-1")
                         (assert)
                         (inst - "x!2")
                         (assert))))))
                    ("2"
                     (apply-extensionality 1 :hide? t)
                     (("1"
                       (expand "fullset" 1)
                       (expand "IUnion")
                       (expand "complement")
                       (expand "member")
                       (lemma "extensionality_postulate"
                        ("f" "complement(x!1)" "g" "IUnion(E!2)"))
                       (flatten -1)
                       (hide -1)
                       (split -1)
                       (("1"
                         (inst - "x!2")
                         (hide -7)
                         (expand "complement")
                         (expand "member")
                         (case-replace "x!1(x!2)")
                         (("1" (assert) (inst + "0"))
                          ("2"
                           (assert)
                           (expand "IUnion")
                           (skosimp)
                           (inst + "i!1+1")
                           (assert))))
                        ("2"
                         (expand "IUnion")
                         (expand "complement")
                         (expand "member")
                         (propax))))
                      ("2" (skosimp) (assert))))
                    ("3"
                     (skosimp*)
                     (expand "member")
                     (assert)
                     (case-replace "i!1=0")
                     (("1" (assert))
                      ("2"
                       (assert)
                       (inst -7 "i!1-1")
                       (flatten)
                       (assert)
                       (split)
                       (("1" (flatten) (assert))
                        ("2" (flatten) (assert))))))))
                  ("2" (skosimp) (assert))))
                ("2"
                 (apply-extensionality 1 :hide? t)
                 (expand "emptyset")
                 (replace -4 -1)
                 (expand "IUnion")
                 (skosimp)
                 (inst -5 "i!1")
                 (expand "empty?")
                 (inst -5 "x!1")
                 (assert)
                 (expand "member")
                 (propax))))
              ("2"
               (case "n!1>0")
               (("1"
                 (hide 1)
                 (name "FF" "IComplement(E!1)")
                 (name "F" "lambda n: Intersection(image(FF,{i| i<=n}))")
                 (case "F(0) = complement(E!1(0))")
                 (("1"
                   (case "forall n: F(n+1)=intersection(F(n),complement(E!1(n+1)))")
                   (("1"
                     (case "FORALL n: n < n!1 => finite_disjoint_unions(NX!1)(F(n))")
                     (("1"
                       (replace -8 1)
                       (lemma "IDemorgan1")
                       (inst - "E!1")
                       (replace -1 1)
                       (hide -1)
                       (case "IIntersection(IComplement(E!1))=F(n!1-1)")
                       (("1"
                         (replace -1)
                         (inst - "n!1-1")
                         (("1" (assert)) ("2" (assert))))
                        ("2"
                         (hide 2)
                         (apply-extensionality :hide? t)
                         (expand "IComplement")
                         (expand "IIntersection")
                         (case-replace
                          "FORALL (i_1: nat): complement(E!1(i_1))(x!1)")
                         (("1"
                           (expand "F" 1)
                           (expand "FF")
                           (expand "IComplement")
                           (expand "image")
                           (expand "Intersection")
                           (skosimp)
                           (typepred "a!2")
                           (skosimp)
                           (typepred "x!2")
                           (replace -2)
                           (inst -3 "x!2"))
                          ("2"
                           (replace 1 2)
                           (assert)
                           (skosimp)
                           (inst -10 "i!1")
                           (flatten)
                           (case "i!1<n!1")
                           (("1"
                             (assert)
                             (expand "F" -2)
                             (expand "Intersection")
                             (inst -2 "complement(E!1(i!1))")
                             (expand "FF")
                             (expand "image")
                             (expand "IComplement")
                             (inst + "i!1"))
                            ("2"
                             (assert)
                             (expand "complement")
                             (expand "member")
                             (expand "empty?" -12)
                             (inst -12 "x!1")
                             (expand "member")
                             (propax))))))
                        ("3" (assert))))
                      ("2"
                       (hide 2)
                       (induct "n")
                       (("1"
                         (flatten)
                         (replace -3)
                         (inst -9 "0")
                         (assert)
                         (inst -13 "E!1(0)")
                         (expand "finite_disjoint_unions")
                         (expand "fullset")
                         (expand "extend")
                         (prop))
                        ("2"
                         (skosimp)
                         (assert)
                         (inst -3 "j!1")
                         (replace -3)
                         (inst -10 "1+j!1")
                         (assert)
                         (inst -14 "E!1(1+j!1)")
                         (inst -12 "F(j!1)" "complement(E!1(1 + j!1))")
                         (hide-all-but (-13 1))
                         (expand "finite_disjoint_unions")
                         (expand "fullset")
                         (expand "extend")
                         (assert))))))
                    ("2"
                     (hide-all-but 1)
                     (skosimp)
                     (apply-extensionality :hide? t)
                     (expand "F")
                     (expand "FF")
                     (expand "IComplement")
                     (expand "complement")
                     (expand "image")
                     (expand "Intersection")
                     (expand "intersection")
                     (expand "member")
                     (case-replace "E!1(1 + n!2)(x!1)")
                     (("1"
                       (assert)
                       (inst - "complement(E!1(1+n!2))")
                       (("1"
                         (expand "complement")
                         (expand "member")
                         (propax))
                        ("2"
                         (inst + "1+n!2")
                         (apply-extensionality :hide? t)
                         (expand "complement")
                         (propax))))
                      ("2"
                       (assert)
                       (case-replace
                        "FORALL (a:
                                         ({y: set[T] |
                                             EXISTS (x_1: ({i | i <= 1 + n!2})):
                                               y = ({x: T | NOT member(x, E!1(x_1))})})):
                                 a(x!1)")
                       (("1"
                         (skosimp)
                         (typepred "a!2")
                         (skosimp)
                         (inst - "a!2")
                         (inst + "x!2"))
                        ("2"
                         (replace 1 3)
                         (assert)
                         (skosimp)
                         (typepred "a!2")
                         (skosimp)
                         (typepred "x!2")
                         (expand "<=" -1)
                         (split -1)
                         (("1"
                           (inst - "a!2")
                           (inst + "x!2")
                           (expand "member")
                           (replace -2)
                           (assert))
                          ("2"
                           (inst - "E!1(1+n!2)")
                           (replace -2 2)
                           (assert)
                           (expand "member")
                           (assert))))))))))
                  ("2"
                   (hide-all-but (-3 1))
                   (expand "F")
                   (expand "FF")
                   (expand "IComplement")
                   (expand "image")
                   (expand "complement")
                   (expand "member")
                   (apply-extensionality :hide? t)
                   (expand "Intersection")
                   (case-replace "E!1(0)(x!1)")
                   (("1"
                     (assert)
                     (inst - "complement(E!1(0))")
                     (("1"
                       (expand "complement")
                       (expand "member")
                       (propax))
                      ("2"
                       (inst + "0")
                       (expand "complement")
                       (expand "member")
                       (propax))))
                    ("2"
                     (assert)
                     (skosimp)
                     (typepred "a!2")
                     (skosimp)
                     (replace -1)
                     (assert))))))
                ("2" (assert))))))))
          ("2"
           (hide 2)
           (expand "finite_disjoint_unions" 1)
           (expand "fullset")
           (expand "extend")
           (prop)
           (expand "finite_disjoint_union?")
           (inst + "lambda i: emptyset[T]" "0")
           (split 1)
           (("1" (hide-all-but 1) (grind))
            ("2"
             (apply-extensionality :hide? t)
             (hide-all-but 1)
             (grind))
            ("3" (skosimp) (assert) (rewrite "emptyset_is_empty?"))))))
        ("2"
         (hide 2)
         (skosimp)
         (typepred "b!1")
         (typepred "a!1")
         (expand "finite_disjoint_unions" (-1 -2 1))
         (expand "fullset")
         (expand "extend")
         (prop)
         (expand "finite_disjoint_union?" (-1 -2 1))
         (skolem - ("AA" "mm"))
         (skolem - ("BB" "nn"))
         (flatten)
         (expand "member")
         (case-replace "mm=0")
         (("1"
           (assert)
           (inst + "lambda i: emptyset" "0")
           (split)
           (("1" (hide-all-but 1) (grind))
            ("2"
             (apply-extensionality :hide? t)
             (expand "intersection")
             (expand "IUnion")
             (expand "emptyset")
             (expand "member")
             (flatten)
             (replace -5)
             (assert)
             (skosimp)
             (inst -6 "i!1")
             (expand "empty?")
             (expand "member")
             (inst -6 "x!1"))
            ("3" (skosimp) (assert) (rewrite "emptyset_is_empty?"))))
          ("2"
           (case "mm>0")
           (("1"
             (hide 1)
             (case-replace "nn=0")
             (("1"
               (inst + "lambda i: emptyset" "0")
               (split)
               (("1" (hide-all-but 1) (grind))
                ("2"
                 (apply-extensionality :hide? t)
                 (expand "intersection")
                 (expand "member")
                 (expand "IUnion")
                 (expand "emptyset")
                 (flatten)
                 (replace -9 -1)
                 (assert)
                 (skosimp)
                 (inst -10 "i!1")
                 (expand "empty?")
                 (inst -10 "x!1")
                 (expand "member")
                 (propax))
                ("3" (skosimp) (assert) (rewrite "emptyset_is_empty?"))))
              ("2"
               (case "nn>0")
               (("1"
                 (hide 1)
                 (inst +
                  "lambda i: let n = ndiv(i,nn) in intersection(AA(n),BB(rem(nn)(i)))"
                  "nn*mm")
                 (("1"
                   (split)
                   (("1"
                     (expand "disjoint?")
                     (expand "intersection")
                     (expand "disjoint?")
                     (expand "intersection")
                     (expand "empty?")
                     (expand "member")
                     (skosimp*)
                     (inst -7 "ndiv(i!1, nn)" "ndiv(j!1, nn)")
                     (inst -10 "rem(nn)(i!1)" "rem(nn)(j!1)")
                     (expand "/=")
                     (case "rem(nn)(i!1) = rem(nn)(j!1)")
                     (("1"
                       (assert)
                       (hide -3 -5)
                       (typepred "ndiv(i!1, nn)")
                       (typepred "ndiv(j!1, nn)")
                       (replace -1 1)
                       (replace -3 1)
                       (assert)
                       (replace -5 1)
                       (assert)
                       (inst -10 "x!1")
                       (assert))
                      ("2" (assert) (inst -10 "x!1") (assert))))
                    ("2"
                     (apply-extensionality 1 :hide? t)
                     (("1"
                       (expand "IUnion")
                       (expand "intersection")
                       (expand "member")
                       (case-replace "a!1(x!1) AND b!1(x!1)")
                       (("1"
                         (flatten)
                         (replace -9 -1)
                         (replace -6 -2)
                         (assert)
                         (skosimp*)
                         (inst + "i!2*nn+i!1")
                         (typepred "ndiv(i!2 * nn + i!1, nn)")
                         (case "i!1<nn")
                         (("1"
                           (case "i!2<mm")
                           (("1"
                             (case-replace
                              "rem(nn)(i!2 * nn + i!1) = i!1")
                             (("1"
                               (replace -6)
                               (assert)
                               (case-replace
                                "ndiv(i!2 * nn + i!1, nn)=i!2")
                               (hide 2)
                               (lemma "both_sides_times1")
                               (inst - "nn" "ndiv(i!2 * nn + i!1, nn)"
                                "i!2")
                               (assert))
                              ("2"
                               (hide 2)
                               (rewrite "rem_def" 1)
                               (inst + "i!2")
                               (assert))))
                            ("2"
                             (inst -10 "i!2")
                             (assert)
                             (expand "empty?")
                             (expand "member")
                             (inst -10 "x!1"))))
                          ("2"
                           (inst -12 "i!1")
                           (expand "empty?")
                           (expand "member")
                           (assert)
                           (inst -12 "x!1"))))
                        ("2"
                         (replace 1 2)
                         (assert)
                         (skosimp)
                         (replace -6 1)
                         (replace -9 1)
                         (split)
                         (("1" (assert) (inst + "rem(nn)(i!1)"))
                          ("2" (assert) (inst + "ndiv(i!1,nn)"))))))
                      ("2" (hide 2) (skosimp) (assert))))
                    ("3"
                     (skosimp)
                     (case "rem(nn)(i!1)<nn")
                     (("1"
                       (case "nn*ndiv(i!1, nn) +rem(nn)(i!1) = i!1")
                       (("1"
                         (assert)
                         (case "ndiv(i!1, nn)<mm")
                         (("1"
                           (lemma "both_sides_times_pos_le1"
                            ("pz" "nn" "x" "ndiv(i!1, nn)" "y" "mm-1"))
                           (assert)
                           (case "i!1<mm*nn")
                           (("1"
                             (inst -10 "ndiv(i!1, nn)")
                             (flatten)
                             (assert)
                             (hide -11)
                             (inst -13 "rem(nn)(i!1)")
                             (flatten)
                             (assert)
                             (hide -14)
                             (inst -14 "AA(ndiv(i!1, nn))"
                              "BB(rem(nn)(i!1))"))
                            ("2" (assert))))
                          ("2"
                           (assert)
                           (lemma "both_sides_times_pos_le1"
                            ("pz" "nn" "x" "mm" "y" "ndiv(i!1, nn)"))
                           (assert)
                           (inst -8 "ndiv(i!1, nn)")
                           (assert)
                           (hide-all-but (-8 2))
                           (expand "empty?")
                           (expand "intersection")
                           (expand "member")
                           (skosimp)
                           (inst - "x!1"))))
                        ("2"
                         (hide-all-but (-1 -2 -3 1))
                         (typepred "ndiv(i!1, nn)")
                         (assert))))
                      ("2" (typepred "rem(nn)(i!1)") (propax))
                      ("3" (propax))))))
                  ("2"
                   (lemma "le_times_le_pos"
                    ("nnx" "0" "y" "nn-1" "nnz" "0" "w" "mm-1"))
                   (assert))
                  ("3" (skosimp) (assert))))
                ("2" (assert))))))
            ("2" (assert))))))))))
    ("2"
     (hide 2)
     (expand "finite_disjoint_unions")
     (expand "fullset")
     (expand "extend")
     (expand "subset?")
     (expand "member")
     (skosimp*)
     (prop)
     (expand "generated_subset_algebra")
     (expand "Intersection")
     (skosimp)
     (typepred "a!1")
     (expand "finite_disjoint_union?" -3)
     (skosimp)
     (expand "member")
     (case "forall i: a!1(E!1(i))")
     (("1"
       (name "F" "lambda n: Union(image[nat,set[T]](E!1,{i | i <= n}))")
       (case "forall n: F(n+1) = union(F(n),E!1(n+1))")
       (("1"
         (case "IUnion(E!1) = F(n!1)")
         (("1"
           (case "forall n: a!1(F(n))")
           (("1" (inst - "n!1") (assert))
            ("2"
             (hide-all-but (1 -2 -4 -5 -9))
             (induct "n")
             (("1"
               (hide -1)
               (case-replace "F(0)=E!1(0)")
               (("1" (inst - "0"))
                ("2"
                 (hide 2)
                 (expand "F")
                 (apply-extensionality :hide? t)
                 (case-replace "E!1(0)(x!2)")
                 (("1"
                   (expand "image")
                   (expand "Union")
                   (inst + "E!1(0)")
                   (inst + "0"))
                  ("2"
                   (assert)
                   (expand "image")
                   (expand "Union")
                   (skosimp)
                   (typepred "a!2")
                   (skosimp)
                   (typepred "x!3")
                   (assert))))))
              ("2"
               (skosimp)
               (inst - "j!1")
               (replace -2)
               (hide -2)
               (expand "subset_algebra?")
               (flatten)
               (expand "subset_algebra_union?")
               (expand "member")
               (inst -2 "j!1+1")
               (inst -5 "F(j!1)" "E!1(j!1 + 1)")
               (assert))))))
          ("2"
           (hide-all-but (-8 1))
           (apply-extensionality :hide? t)
           (expand "F")
           (expand "image")
           (expand "Union")
           (expand "IUnion")
           (case-replace "EXISTS (i: nat): E!1(i)(x!2)")
           (("1"
             (skosimp)
             (inst - "i!1")
             (flatten)
             (rewrite "emptyset_is_empty?")
             (lemma "trich_lt" ("x" "i!1" "y" "n!1"))
             (split)
             (("1" (assert) (inst + "E!1(i!1)") (inst + "i!1"))
              ("2" (assert) (replace -4 -2) (expand "emptyset") (propax))
              ("3"
               (assert)
               (replace -4 -2)
               (expand "emptyset")
               (propax))))
            ("2"
             (replace 1 2)
             (assert)
             (skosimp)
             (typepred "a!2")
             (skosimp)
             (inst + "x!3")
             (assert))))))
        ("2"
         (hide-all-but 1)
         (skosimp)
         (apply-extensionality :hide? t)
         (expand "union")
         (expand "F")
         (expand "member")
         (expand "image")
         (expand "Union")
         (case-replace "E!1(1 + n!2)(x!2)")
         (("1" (inst + "E!1(1+n!2)") (inst + "1+n!2"))
          ("2"
           (assert)
           (case-replace
            "EXISTS (a:
                             ({y: set[T] |
                                 EXISTS (x: ({i | i <= 1 + n!2})): y = E!1(x)})):
                     a(x!2)")
           (("1"
             (skosimp)
             (typepred "a!2")
             (skosimp)
             (typepred "x!3")
             (expand "<=" -1)
             (split)
             (("1"
               (inst + "E!1(x!3)")
               (("1" (assert)) ("2" (inst + "x!3") (assert))))
              ("2" (assert))))
            ("2"
             (replace 1 3)
             (assert)
             (skosimp)
             (typepred "a!2")
             (skosimp)
             (inst + "E!1(x!3)")
             (("1" (assert)) ("2" (inst + "x!3"))))))))))
      ("2"
       (hide-all-but (1 -2 -1 -5))
       (skosimp)
       (inst - "i!1")
       (flatten)
       (expand "subset?")
       (inst - "E!1(i!1)")
       (expand "member")
       (expand "subset_algebra?")
       (flatten)
       (expand "subset_algebra_empty?")
       (expand "member")
       (rewrite "emptyset_is_empty?")
       (case-replace "i!1 < n!1")
       (("1" (assert)) ("2" (assert))))))))


