1543 by (simp add: plus_matrix_def minus_matrix_def Rep_matrix_inject[symmetric] ext) |
1543 by (simp add: plus_matrix_def minus_matrix_def Rep_matrix_inject[symmetric] ext) |
1544 show "A - B = A + - B" |
1544 show "A - B = A + - B" |
1545 by (simp add: plus_matrix_def diff_matrix_def minus_matrix_def Rep_matrix_inject[symmetric] ext) |
1545 by (simp add: plus_matrix_def diff_matrix_def minus_matrix_def Rep_matrix_inject[symmetric] ext) |
1546 qed |
1546 qed |
1547 |
1547 |
1548 instance matrix :: (pordered_ab_group_add) pordered_ab_group_add |
1548 instance matrix :: (ordered_ab_group_add) ordered_ab_group_add |
1549 proof |
1549 proof |
1550 fix A B C :: "'a matrix" |
1550 fix A B C :: "'a matrix" |
1551 assume "A <= B" |
1551 assume "A <= B" |
1552 then show "C + A <= C + B" |
1552 then show "C + A <= C + B" |
1553 apply (simp add: plus_matrix_def) |
1553 apply (simp add: plus_matrix_def) |
1554 apply (rule le_left_combine_matrix) |
1554 apply (rule le_left_combine_matrix) |
1555 apply (simp_all) |
1555 apply (simp_all) |
1556 done |
1556 done |
1557 qed |
1557 qed |
1558 |
1558 |
1559 instance matrix :: (lordered_ab_group_add) lordered_ab_group_add_meet .. |
1559 instance matrix :: (lattice_ab_group_add) semilattice_inf_ab_group_add .. |
1560 instance matrix :: (lordered_ab_group_add) lordered_ab_group_add_join .. |
1560 instance matrix :: (lattice_ab_group_add) semilattice_sup_ab_group_add .. |
1561 |
1561 |
1562 instance matrix :: (semiring_0) semiring_0 |
1562 instance matrix :: (semiring_0) semiring_0 |
1563 proof |
1563 proof |
1564 fix A B C :: "'a matrix" |
1564 fix A B C :: "'a matrix" |
1565 show "A * B * C = A * (B * C)" |
1565 show "A * B * C = A * (B * C)" |
1581 show "A * 0 = 0" by (simp add: times_matrix_def) |
1581 show "A * 0 = 0" by (simp add: times_matrix_def) |
1582 qed |
1582 qed |
1583 |
1583 |
1584 instance matrix :: (ring) ring .. |
1584 instance matrix :: (ring) ring .. |
1585 |
1585 |
1586 instance matrix :: (pordered_ring) pordered_ring |
1586 instance matrix :: (ordered_ring) ordered_ring |
1587 proof |
1587 proof |
1588 fix A B C :: "'a matrix" |
1588 fix A B C :: "'a matrix" |
1589 assume a: "A \<le> B" |
1589 assume a: "A \<le> B" |
1590 assume b: "0 \<le> C" |
1590 assume b: "0 \<le> C" |
1591 from a b show "C * A \<le> C * B" |
1591 from a b show "C * A \<le> C * B" |
1598 apply (rule le_right_mult) |
1598 apply (rule le_right_mult) |
1599 apply (simp_all add: add_mono mult_right_mono) |
1599 apply (simp_all add: add_mono mult_right_mono) |
1600 done |
1600 done |
1601 qed |
1601 qed |
1602 |
1602 |
1603 instance matrix :: (lordered_ring) lordered_ring |
1603 instance matrix :: (lattice_ring) lattice_ring |
1604 proof |
1604 proof |
1605 fix A B C :: "('a :: lordered_ring) matrix" |
1605 fix A B C :: "('a :: lattice_ring) matrix" |
1606 show "abs A = sup A (-A)" |
1606 show "abs A = sup A (-A)" |
1607 by (simp add: abs_matrix_def) |
1607 by (simp add: abs_matrix_def) |
1608 qed |
1608 qed |
1609 |
1609 |
1610 lemma Rep_matrix_add[simp]: |
1610 lemma Rep_matrix_add[simp]: |
1736 |
1736 |
1737 lemma zero_imp_mult_zero: "(a::'a::semiring_0) = 0 | b = 0 \<Longrightarrow> a * b = 0" |
1737 lemma zero_imp_mult_zero: "(a::'a::semiring_0) = 0 | b = 0 \<Longrightarrow> a * b = 0" |
1738 by auto |
1738 by auto |
1739 |
1739 |
1740 lemma Rep_matrix_zero_imp_mult_zero: |
1740 lemma Rep_matrix_zero_imp_mult_zero: |
1741 "! j i k. (Rep_matrix A j k = 0) | (Rep_matrix B k i) = 0 \<Longrightarrow> A * B = (0::('a::lordered_ring) matrix)" |
1741 "! j i k. (Rep_matrix A j k = 0) | (Rep_matrix B k i) = 0 \<Longrightarrow> A * B = (0::('a::lattice_ring) matrix)" |
1742 apply (subst Rep_matrix_inject[symmetric]) |
1742 apply (subst Rep_matrix_inject[symmetric]) |
1743 apply (rule ext)+ |
1743 apply (rule ext)+ |
1744 apply (auto simp add: Rep_matrix_mult foldseq_zero zero_imp_mult_zero) |
1744 apply (auto simp add: Rep_matrix_mult foldseq_zero zero_imp_mult_zero) |
1745 done |
1745 done |
1746 |
1746 |