src/HOL/Matrix/Matrix.thy
changeset 23477 f4b83f03cac9
parent 22452 8a86fd2a1bf0
child 23879 4776af8be741
equal deleted inserted replaced
23476:839db6346cc8 23477:f4b83f03cac9
    57 proof
    57 proof
    58   fix A B C :: "('a :: lordered_ring) matrix"
    58   fix A B C :: "('a :: lordered_ring) matrix"
    59   show "A * B * C = A * (B * C)"
    59   show "A * B * C = A * (B * C)"
    60     apply (simp add: times_matrix_def)
    60     apply (simp add: times_matrix_def)
    61     apply (rule mult_matrix_assoc)
    61     apply (rule mult_matrix_assoc)
    62     apply (simp_all add: associative_def ring_eq_simps)
    62     apply (simp_all add: associative_def ring_simps)
    63     done
    63     done
    64   show "(A + B) * C = A * C + B * C"
    64   show "(A + B) * C = A * C + B * C"
    65     apply (simp add: times_matrix_def plus_matrix_def)
    65     apply (simp add: times_matrix_def plus_matrix_def)
    66     apply (rule l_distributive_matrix[simplified l_distributive_def, THEN spec, THEN spec, THEN spec])
    66     apply (rule l_distributive_matrix[simplified l_distributive_def, THEN spec, THEN spec, THEN spec])
    67     apply (simp_all add: associative_def commutative_def ring_eq_simps)
    67     apply (simp_all add: associative_def commutative_def ring_simps)
    68     done
    68     done
    69   show "A * (B + C) = A * B + A * C"
    69   show "A * (B + C) = A * B + A * C"
    70     apply (simp add: times_matrix_def plus_matrix_def)
    70     apply (simp add: times_matrix_def plus_matrix_def)
    71     apply (rule r_distributive_matrix[simplified r_distributive_def, THEN spec, THEN spec, THEN spec])
    71     apply (rule r_distributive_matrix[simplified r_distributive_def, THEN spec, THEN spec, THEN spec])
    72     apply (simp_all add: associative_def commutative_def ring_eq_simps)
    72     apply (simp_all add: associative_def commutative_def ring_simps)
    73     done  
    73     done  
    74   show "abs A = sup A (-A)" 
    74   show "abs A = sup A (-A)" 
    75     by (simp add: abs_matrix_def)
    75     by (simp add: abs_matrix_def)
    76   assume a: "A \<le> B"
    76   assume a: "A \<le> B"
    77   assume b: "0 \<le> C"
    77   assume b: "0 \<le> C"
   262 constdefs
   262 constdefs
   263   scalar_mult :: "('a::lordered_ring) \<Rightarrow> 'a matrix \<Rightarrow> 'a matrix"
   263   scalar_mult :: "('a::lordered_ring) \<Rightarrow> 'a matrix \<Rightarrow> 'a matrix"
   264   "scalar_mult a m == apply_matrix (op * a) m"
   264   "scalar_mult a m == apply_matrix (op * a) m"
   265 
   265 
   266 lemma scalar_mult_zero[simp]: "scalar_mult y 0 = 0" 
   266 lemma scalar_mult_zero[simp]: "scalar_mult y 0 = 0" 
   267   by (simp add: scalar_mult_def)
   267 by (simp add: scalar_mult_def)
   268 
   268 
   269 lemma scalar_mult_add: "scalar_mult y (a+b) = (scalar_mult y a) + (scalar_mult y b)"
   269 lemma scalar_mult_add: "scalar_mult y (a+b) = (scalar_mult y a) + (scalar_mult y b)"
   270   by (simp add: scalar_mult_def apply_matrix_add ring_eq_simps)
   270 by (simp add: scalar_mult_def apply_matrix_add ring_simps)
   271 
   271 
   272 lemma Rep_scalar_mult[simp]: "Rep_matrix (scalar_mult y a) j i = y * (Rep_matrix a j i)" 
   272 lemma Rep_scalar_mult[simp]: "Rep_matrix (scalar_mult y a) j i = y * (Rep_matrix a j i)" 
   273   by (simp add: scalar_mult_def)
   273 by (simp add: scalar_mult_def)
   274 
   274 
   275 lemma scalar_mult_singleton[simp]: "scalar_mult y (singleton_matrix j i x) = singleton_matrix j i (y * x)"
   275 lemma scalar_mult_singleton[simp]: "scalar_mult y (singleton_matrix j i x) = singleton_matrix j i (y * x)"
   276   apply (subst Rep_matrix_inject[symmetric])
   276 apply (subst Rep_matrix_inject[symmetric])
   277   apply (rule ext)+
   277 apply (rule ext)+
   278   apply (auto)
   278 apply (auto)
   279   done
   279 done
   280 
   280 
   281 lemma Rep_minus[simp]: "Rep_matrix (-(A::_::lordered_ab_group)) x y = - (Rep_matrix A x y)"
   281 lemma Rep_minus[simp]: "Rep_matrix (-(A::_::lordered_ab_group)) x y = - (Rep_matrix A x y)"
   282   by (simp add: minus_matrix_def)
   282 by (simp add: minus_matrix_def)
   283 
   283 
   284 lemma Rep_abs[simp]: "Rep_matrix (abs (A::_::lordered_ring)) x y = abs (Rep_matrix A x y)"
   284 lemma Rep_abs[simp]: "Rep_matrix (abs (A::_::lordered_ring)) x y = abs (Rep_matrix A x y)"
   285   by (simp add: abs_lattice sup_matrix_def)
   285 by (simp add: abs_lattice sup_matrix_def)
   286 
   286 
   287 end
   287 end