src/HOL/Matrix/Matrix.thy
changeset 14738 83f1a514dcb4
parent 14724 021264410f87
child 14940 b9ab8babd8b3
equal deleted inserted replaced
14737:77ea79aed99d 14738:83f1a514dcb4
   193 lemma ncols_mult: "ncols ((A::('a::matrix_element) matrix) * B) <= ncols B"
   193 lemma ncols_mult: "ncols ((A::('a::matrix_element) matrix) * B) <= ncols B"
   194 by (simp add: times_matrix_def mult_ncols)
   194 by (simp add: times_matrix_def mult_ncols)
   195 
   195 
   196 (*
   196 (*
   197 constdefs
   197 constdefs
   198   one_matrix :: "nat \<Rightarrow> ('a::semiring) matrix"
   198   one_matrix :: "nat \<Rightarrow> ('a::comm_semiring_1_cancel) matrix"
   199   "one_matrix n == Abs_matrix (% j i. if j = i & j < n then 1 else 0)"
   199   "one_matrix n == Abs_matrix (% j i. if j = i & j < n then 1 else 0)"
   200 
   200 
   201 lemma Rep_one_matrix[simp]: "Rep_matrix (one_matrix n) j i = (if (j = i & j < n) then 1 else 0)"
   201 lemma Rep_one_matrix[simp]: "Rep_matrix (one_matrix n) j i = (if (j = i & j < n) then 1 else 0)"
   202 apply (simp add: one_matrix_def)
   202 apply (simp add: one_matrix_def)
   203 apply (subst RepAbs_matrix)
   203 apply (subst RepAbs_matrix)
   233 apply (rule_tac j1="x" in ssubst[OF foldseq_almostzero])
   233 apply (rule_tac j1="x" in ssubst[OF foldseq_almostzero])
   234 apply (simp_all)
   234 apply (simp_all)
   235 by (simp add: max_def nrows)
   235 by (simp add: max_def nrows)
   236 
   236 
   237 constdefs
   237 constdefs
   238   right_inverse_matrix :: "('a::semiring) matrix \<Rightarrow> 'a matrix \<Rightarrow> bool"
   238   right_inverse_matrix :: "('a::comm_semiring_1_cancel) matrix \<Rightarrow> 'a matrix \<Rightarrow> bool"
   239   "right_inverse_matrix A X == (A * X = one_matrix (max (nrows A) (ncols X)))"
   239   "right_inverse_matrix A X == (A * X = one_matrix (max (nrows A) (ncols X)))"
   240   inverse_matrix :: "('a::semiring) matrix \<Rightarrow> 'a matrix \<Rightarrow> bool"
   240   inverse_matrix :: "('a::comm_semiring_1_cancel) matrix \<Rightarrow> 'a matrix \<Rightarrow> bool"
   241   "inverse_matrix A X == (right_inverse_matrix A X) \<and> (right_inverse_matrix X A)"
   241   "inverse_matrix A X == (right_inverse_matrix A X) \<and> (right_inverse_matrix X A)"
   242 
   242 
   243 lemma right_inverse_matrix_dim: "right_inverse_matrix A X \<Longrightarrow> nrows A = ncols X"
   243 lemma right_inverse_matrix_dim: "right_inverse_matrix A X \<Longrightarrow> nrows A = ncols X"
   244 apply (insert ncols_mult[of A X], insert nrows_mult[of A X])
   244 apply (insert ncols_mult[of A X], insert nrows_mult[of A X])
   245 by (simp add: right_inverse_matrix_def)
   245 by (simp add: right_inverse_matrix_def)