835 |
835 |
836 lemma orthogonal_transformation: "orthogonal_transformation f \<longleftrightarrow> linear f \<and> (\<forall>(v::real ^_). norm (f v) = norm v)" |
836 lemma orthogonal_transformation: "orthogonal_transformation f \<longleftrightarrow> linear f \<and> (\<forall>(v::real ^_). norm (f v) = norm v)" |
837 unfolding orthogonal_transformation_def |
837 unfolding orthogonal_transformation_def |
838 apply auto |
838 apply auto |
839 apply (erule_tac x=v in allE)+ |
839 apply (erule_tac x=v in allE)+ |
840 apply (simp add: real_vector_norm_def) |
840 apply (simp add: norm_eq_sqrt_inner) |
841 by (simp add: dot_norm linear_add[symmetric]) |
841 by (simp add: dot_norm linear_add[symmetric]) |
842 |
842 |
843 definition "orthogonal_matrix (Q::'a::semiring_1^'n^'n) \<longleftrightarrow> transpose Q ** Q = mat 1 \<and> Q ** transpose Q = mat 1" |
843 definition "orthogonal_matrix (Q::'a::semiring_1^'n^'n) \<longleftrightarrow> transpose Q ** Q = mat 1 \<and> Q ** transpose Q = mat 1" |
844 |
844 |
845 lemma orthogonal_matrix: "orthogonal_matrix (Q:: real ^'n^'n) \<longleftrightarrow> transpose Q ** Q = mat 1" |
845 lemma orthogonal_matrix: "orthogonal_matrix (Q:: real ^'n^'n) \<longleftrightarrow> transpose Q ** Q = mat 1" |
877 have th0: "\<And>b (x::'a::comm_ring_1). (if b then 1 else 0)*x = (if b then x else 0)" |
877 have th0: "\<And>b (x::'a::comm_ring_1). (if b then 1 else 0)*x = (if b then x else 0)" |
878 "\<And>b (x::'a::comm_ring_1). x*(if b then 1 else 0) = (if b then x else 0)" |
878 "\<And>b (x::'a::comm_ring_1). x*(if b then 1 else 0) = (if b then x else 0)" |
879 by simp_all |
879 by simp_all |
880 from fd[rule_format, of "basis i" "basis j", unfolded matrix_works[OF lf, symmetric] dot_matrix_vector_mul] |
880 from fd[rule_format, of "basis i" "basis j", unfolded matrix_works[OF lf, symmetric] dot_matrix_vector_mul] |
881 have "?A$i$j = ?m1 $ i $ j" |
881 have "?A$i$j = ?m1 $ i $ j" |
882 by (simp add: dot_def matrix_matrix_mult_def columnvector_def rowvector_def basis_def th0 setsum_delta[OF fU] mat_def)} |
882 by (simp add: inner_vector_def matrix_matrix_mult_def columnvector_def rowvector_def basis_def th0 setsum_delta[OF fU] mat_def)} |
883 hence "orthogonal_matrix ?mf" unfolding orthogonal_matrix by vector |
883 hence "orthogonal_matrix ?mf" unfolding orthogonal_matrix by vector |
884 with lf have ?rhs by blast} |
884 with lf have ?rhs by blast} |
885 moreover |
885 moreover |
886 {assume lf: "linear f" and om: "orthogonal_matrix ?mf" |
886 {assume lf: "linear f" and om: "orthogonal_matrix ?mf" |
887 from lf om have ?lhs |
887 from lf om have ?lhs |
927 note th0 = this |
927 note th0 = this |
928 have "f v \<bullet> f w = c^2 * (v \<bullet> w)" |
928 have "f v \<bullet> f w = c^2 * (v \<bullet> w)" |
929 unfolding dot_norm_neg dist_norm[symmetric] |
929 unfolding dot_norm_neg dist_norm[symmetric] |
930 unfolding th0 fd[rule_format] by (simp add: power2_eq_square field_simps)} |
930 unfolding th0 fd[rule_format] by (simp add: power2_eq_square field_simps)} |
931 note fc = this |
931 note fc = this |
932 show ?thesis unfolding linear_def vector_eq |
932 show ?thesis unfolding linear_def vector_eq smult_conv_scaleR by (simp add: inner_simps fc ring_simps) |
933 by (simp add: dot_lmult dot_ladd dot_rmult dot_radd fc ring_simps) |
|
934 qed |
933 qed |
935 |
934 |
936 lemma isometry_linear: |
935 lemma isometry_linear: |
937 "f (0:: real^'n) = (0:: real^'n) \<Longrightarrow> \<forall>x y. dist(f x) (f y) = dist x y |
936 "f (0:: real^'n) = (0:: real^'n) \<Longrightarrow> \<forall>x y. dist(f x) (f y) = dist x y |
938 \<Longrightarrow> linear f" |
937 \<Longrightarrow> linear f" |
970 {fix x y x' y' x0 y0 x0' y0' :: "real ^'n" |
969 {fix x y x' y' x0 y0 x0' y0' :: "real ^'n" |
971 assume H: "x = norm x *s x0" "y = norm y *s y0" |
970 assume H: "x = norm x *s x0" "y = norm y *s y0" |
972 "x' = norm x *s x0'" "y' = norm y *s y0'" |
971 "x' = norm x *s x0'" "y' = norm y *s y0'" |
973 "norm x0 = 1" "norm x0' = 1" "norm y0 = 1" "norm y0' = 1" |
972 "norm x0 = 1" "norm x0' = 1" "norm y0 = 1" "norm y0' = 1" |
974 "norm(x0' - y0') = norm(x0 - y0)" |
973 "norm(x0' - y0') = norm(x0 - y0)" |
975 |
974 hence *:"x0 \<bullet> y0 = x0' \<bullet> y0' + y0' \<bullet> x0' - y0 \<bullet> x0 " by(simp add: norm_eq norm_eq_1 inner_simps) |
976 have "norm(x' - y') = norm(x - y)" |
975 have "norm(x' - y') = norm(x - y)" |
977 apply (subst H(1)) |
976 apply (subst H(1)) |
978 apply (subst H(2)) |
977 apply (subst H(2)) |
979 apply (subst H(3)) |
978 apply (subst H(3)) |
980 apply (subst H(4)) |
979 apply (subst H(4)) |
981 using H(5-9) |
980 using H(5-9) |
982 apply (simp add: norm_eq norm_eq_1) |
981 apply (simp add: norm_eq norm_eq_1) |
983 apply (simp add: dot_lsub dot_rsub dot_lmult dot_rmult) |
982 apply (simp add: inner_simps smult_conv_scaleR) unfolding * |
984 apply (simp add: ring_simps) |
983 by (simp add: ring_simps) } |
985 by (simp only: right_distrib[symmetric])} |
|
986 note th0 = this |
984 note th0 = this |
987 let ?g = "\<lambda>x. if x = 0 then 0 else norm x *s f (inverse (norm x) *s x)" |
985 let ?g = "\<lambda>x. if x = 0 then 0 else norm x *s f (inverse (norm x) *s x)" |
988 {fix x:: "real ^'n" assume nx: "norm x = 1" |
986 {fix x:: "real ^'n" assume nx: "norm x = 1" |
989 have "?g x = f x" using nx by auto} |
987 have "?g x = f x" using nx by auto} |
990 hence thfg: "\<forall>x. norm x = 1 \<longrightarrow> ?g x = f x" by blast |
988 hence thfg: "\<forall>x. norm x = 1 \<longrightarrow> ?g x = f x" by blast |