src/HOL/Matrix_LP/Matrix.thy
changeset 61945 1135b8de26c3
parent 61824 dcbe9f756ae0
child 62390 842917225d56
equal deleted inserted replaced
61944:5d06ecfdb472 61945:1135b8de26c3
   916   "Rep_matrix (move_matrix A y x) j i =
   916   "Rep_matrix (move_matrix A y x) j i =
   917   (if (((int j)-y) < 0) | (((int i)-x) < 0) then 0 else Rep_matrix A (nat((int j)-y)) (nat((int i)-x)))"
   917   (if (((int j)-y) < 0) | (((int i)-x) < 0) then 0 else Rep_matrix A (nat((int j)-y)) (nat((int i)-x)))"
   918 apply (simp add: move_matrix_def)
   918 apply (simp add: move_matrix_def)
   919 apply (auto)
   919 apply (auto)
   920 by (subst RepAbs_matrix,
   920 by (subst RepAbs_matrix,
   921   rule exI[of _ "(nrows A)+(nat (abs y))"], auto, rule nrows, arith,
   921   rule exI[of _ "(nrows A)+(nat \<bar>y\<bar>)"], auto, rule nrows, arith,
   922   rule exI[of _ "(ncols A)+(nat (abs x))"], auto, rule ncols, arith)+
   922   rule exI[of _ "(ncols A)+(nat \<bar>x\<bar>)"], auto, rule ncols, arith)+
   923 
   923 
   924 lemma move_matrix_0_0[simp]: "move_matrix A 0 0 = A"
   924 lemma move_matrix_0_0[simp]: "move_matrix A 0 0 = A"
   925 by (simp add: move_matrix_def)
   925 by (simp add: move_matrix_def)
   926 
   926 
   927 lemma move_matrix_ortho: "move_matrix A j i = move_matrix (move_matrix A j 0) 0 i"
   927 lemma move_matrix_ortho: "move_matrix A j i = move_matrix (move_matrix A j 0) 0 i"
  1494 
  1494 
  1495 instantiation matrix :: ("{lattice, uminus, zero}") abs
  1495 instantiation matrix :: ("{lattice, uminus, zero}") abs
  1496 begin
  1496 begin
  1497 
  1497 
  1498 definition
  1498 definition
  1499   abs_matrix_def: "abs (A :: 'a matrix) = sup A (- A)"
  1499   abs_matrix_def: "\<bar>A :: 'a matrix\<bar> = sup A (- A)"
  1500 
  1500 
  1501 instance ..
  1501 instance ..
  1502 
  1502 
  1503 end
  1503 end
  1504 
  1504 
  1611 qed
  1611 qed
  1612 
  1612 
  1613 instance matrix :: (lattice_ring) lattice_ring
  1613 instance matrix :: (lattice_ring) lattice_ring
  1614 proof
  1614 proof
  1615   fix A B C :: "('a :: lattice_ring) matrix"
  1615   fix A B C :: "('a :: lattice_ring) matrix"
  1616   show "abs A = sup A (-A)" 
  1616   show "\<bar>A\<bar> = sup A (-A)" 
  1617     by (simp add: abs_matrix_def)
  1617     by (simp add: abs_matrix_def)
  1618 qed
  1618 qed
  1619 
  1619 
  1620 lemma Rep_matrix_add[simp]:
  1620 lemma Rep_matrix_add[simp]:
  1621   "Rep_matrix ((a::('a::monoid_add)matrix)+b) j i  = (Rep_matrix a j i) + (Rep_matrix b j i)"
  1621   "Rep_matrix ((a::('a::monoid_add)matrix)+b) j i  = (Rep_matrix a j i) + (Rep_matrix b j i)"
  1812 done
  1812 done
  1813 
  1813 
  1814 lemma Rep_minus[simp]: "Rep_matrix (-(A::_::group_add)) x y = - (Rep_matrix A x y)"
  1814 lemma Rep_minus[simp]: "Rep_matrix (-(A::_::group_add)) x y = - (Rep_matrix A x y)"
  1815 by (simp add: minus_matrix_def)
  1815 by (simp add: minus_matrix_def)
  1816 
  1816 
  1817 lemma Rep_abs[simp]: "Rep_matrix (abs (A::_::lattice_ab_group_add)) x y = abs (Rep_matrix A x y)"
  1817 lemma Rep_abs[simp]: "Rep_matrix \<bar>A::_::lattice_ab_group_add\<bar> x y = \<bar>Rep_matrix A x y\<bar>"
  1818 by (simp add: abs_lattice sup_matrix_def)
  1818 by (simp add: abs_lattice sup_matrix_def)
  1819 
  1819 
  1820 end
  1820 end