<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="../../../xsl/unit.xsl"?>
<KIVSPEC name="matrix"><SPECBODY>generic specification
   parameter elem
   using <a href="../../../specs/nat/export/unit.xml">nat</a>
target
   sorts matrix;
   functions 
       mkmatrix : nat × nat × elem → matrix;
       &#35;r . : matrix → nat;
       &#35;c . : matrix → nat;
   
   variables 
       mx : matrix;
       r : nat;
       c : nat;
       a : elem;
   
   partial functions 
       . [ . ] : matrix × nat × nat → elem with λ mx, r, c. r &lt; &#35;r mx ∧ c &lt; &#35;c mx;
       . [ . ] : matrix × nat × nat × elem → matrix with λ mx, r, c, a. r &lt; &#35;r mx ∧ c &lt; &#35;c mx;
   
   
   induction 
      matrix generated by mkmatrix, [ ];
   
   axioms 
      extension: 
      mx1 = mx2 ↔ &#35;r mx1 = &#35;r mx2 ∧ &#35;c mx1 = &#35;c mx2 ∧ (∀ r, c. r &lt; &#35;r mx1 ∧ c &lt; &#35;c mx1 → mx1[r, c] = mx2[r, c]);
      used for: ls;
      
      rowno-mkmatrix: &#35;r mkmatrix(r, c, a) = r;
      used for: s, ls;
      
      colno-mkmatrix: &#35;c mkmatrix(r, c, a) = c;
      used for: s, ls;
      
      get-mkmatrix: r &lt; r0 ∧ c &lt; c0 → mkmatrix(r0, c0, a)[r, c] = a;
      used for: s, ls;
      
      rowno-put: &#35;r mx[r, c, a] = &#35;r mx;
      used for: s, ls;
      
      colno-put: &#35;c mx[r, c, a] = &#35;c mx;
      used for: s, ls;
      
      put-same: r &lt; &#35;r mx ∧ c &lt; &#35;c mx → mx[r, c, a][r, c] = a;
      used for: s, ls, lc;
      
      put-otherrow: r ≠ r0 → mx[r, c, a][r0, c0] = mx[r0, c0];
      used for: s, ls, lc;
      
      put-othercol: c ≠ c0 → mx[r, c, a][r0, c0] = mx[r0, c0];
      used for: s, ls, lc;
   
   
end generic specification</SPECBODY></KIVSPEC>