10 "HOL-Library.Permutations" |
10 "HOL-Library.Permutations" |
11 begin |
11 begin |
12 |
12 |
13 subsection \<open>Trace\<close> |
13 subsection \<open>Trace\<close> |
14 |
14 |
15 definition%important trace :: "'a::semiring_1^'n^'n \<Rightarrow> 'a" |
15 definition\<^marker>\<open>tag important\<close> trace :: "'a::semiring_1^'n^'n \<Rightarrow> 'a" |
16 where "trace A = sum (\<lambda>i. ((A$i)$i)) (UNIV::'n set)" |
16 where "trace A = sum (\<lambda>i. ((A$i)$i)) (UNIV::'n set)" |
17 |
17 |
18 lemma trace_0: "trace (mat 0) = 0" |
18 lemma trace_0: "trace (mat 0) = 0" |
19 by (simp add: trace_def mat_def) |
19 by (simp add: trace_def mat_def) |
20 |
20 |
31 apply (simp add: trace_def matrix_matrix_mult_def) |
31 apply (simp add: trace_def matrix_matrix_mult_def) |
32 apply (subst sum.swap) |
32 apply (subst sum.swap) |
33 apply (simp add: mult.commute) |
33 apply (simp add: mult.commute) |
34 done |
34 done |
35 |
35 |
36 subsubsection%important \<open>Definition of determinant\<close> |
36 subsubsection\<^marker>\<open>tag important\<close> \<open>Definition of determinant\<close> |
37 |
37 |
38 definition%important det:: "'a::comm_ring_1^'n^'n \<Rightarrow> 'a" where |
38 definition\<^marker>\<open>tag important\<close> det:: "'a::comm_ring_1^'n^'n \<Rightarrow> 'a" where |
39 "det A = |
39 "det A = |
40 sum (\<lambda>p. of_int (sign p) * prod (\<lambda>i. A$i$p i) (UNIV :: 'n set)) |
40 sum (\<lambda>p. of_int (sign p) * prod (\<lambda>i. A$i$p i) (UNIV :: 'n set)) |
41 {p. p permutes (UNIV :: 'n set)}" |
41 {p. p permutes (UNIV :: 'n set)}" |
42 |
42 |
43 text \<open>Basic determinant properties\<close> |
43 text \<open>Basic determinant properties\<close> |
774 fixes A :: "real^'n^'n" |
774 fixes A :: "real^'n^'n" |
775 shows "det A = 0 \<longleftrightarrow> rank A < CARD('n)" |
775 shows "det A = 0 \<longleftrightarrow> rank A < CARD('n)" |
776 using invertible_det_nz [of A] |
776 using invertible_det_nz [of A] |
777 by (auto simp: matrix_left_invertible_injective invertible_left_inverse less_rank_noninjective) |
777 by (auto simp: matrix_left_invertible_injective invertible_left_inverse less_rank_noninjective) |
778 |
778 |
779 subsubsection%important \<open>Invertibility of matrices and corresponding linear functions\<close> |
779 subsubsection\<^marker>\<open>tag important\<close> \<open>Invertibility of matrices and corresponding linear functions\<close> |
780 |
780 |
781 lemma matrix_left_invertible_gen: |
781 lemma matrix_left_invertible_gen: |
782 fixes f :: "'a::field^'m \<Rightarrow> 'a::field^'n" |
782 fixes f :: "'a::field^'m \<Rightarrow> 'a::field^'n" |
783 assumes "Vector_Spaces.linear (*s) (*s) f" |
783 assumes "Vector_Spaces.linear (*s) (*s) f" |
784 shows "((\<exists>B. B ** matrix f = mat 1) \<longleftrightarrow> (\<exists>g. Vector_Spaces.linear (*s) (*s) g \<and> g \<circ> f = id))" |
784 shows "((\<exists>B. B ** matrix f = mat 1) \<longleftrightarrow> (\<exists>g. Vector_Spaces.linear (*s) (*s) g \<and> g \<circ> f = id))" |
992 qed |
992 qed |
993 |
993 |
994 proposition orthogonal_transformation_det [simp]: |
994 proposition orthogonal_transformation_det [simp]: |
995 fixes f :: "real^'n \<Rightarrow> real^'n" |
995 fixes f :: "real^'n \<Rightarrow> real^'n" |
996 shows "orthogonal_transformation f \<Longrightarrow> \<bar>det (matrix f)\<bar> = 1" |
996 shows "orthogonal_transformation f \<Longrightarrow> \<bar>det (matrix f)\<bar> = 1" |
997 using%unimportant det_orthogonal_matrix orthogonal_transformation_matrix by fastforce |
997 using det_orthogonal_matrix orthogonal_transformation_matrix by fastforce |
998 |
998 |
999 subsection \<open>Rotation, reflection, rotoinversion\<close> |
999 subsection \<open>Rotation, reflection, rotoinversion\<close> |
1000 |
1000 |
1001 definition%important "rotation_matrix Q \<longleftrightarrow> orthogonal_matrix Q \<and> det Q = 1" |
1001 definition\<^marker>\<open>tag important\<close> "rotation_matrix Q \<longleftrightarrow> orthogonal_matrix Q \<and> det Q = 1" |
1002 definition%important "rotoinversion_matrix Q \<longleftrightarrow> orthogonal_matrix Q \<and> det Q = - 1" |
1002 definition\<^marker>\<open>tag important\<close> "rotoinversion_matrix Q \<longleftrightarrow> orthogonal_matrix Q \<and> det Q = - 1" |
1003 |
1003 |
1004 lemma orthogonal_rotation_or_rotoinversion: |
1004 lemma orthogonal_rotation_or_rotoinversion: |
1005 fixes Q :: "'a::linordered_idom^'n^'n" |
1005 fixes Q :: "'a::linordered_idom^'n^'n" |
1006 shows " orthogonal_matrix Q \<longleftrightarrow> rotation_matrix Q \<or> rotoinversion_matrix Q" |
1006 shows " orthogonal_matrix Q \<longleftrightarrow> rotation_matrix Q \<or> rotoinversion_matrix Q" |
1007 by (metis rotoinversion_matrix_def rotation_matrix_def det_orthogonal_matrix) |
1007 by (metis rotoinversion_matrix_def rotation_matrix_def det_orthogonal_matrix) |