57 rewrites "carrier \<Z> = UNIV" |
57 rewrites "carrier \<Z> = UNIV" |
58 and "mult \<Z> x y = x * y" |
58 and "mult \<Z> x y = x * y" |
59 and "one \<Z> = 1" |
59 and "one \<Z> = 1" |
60 and "pow \<Z> x n = x^n" |
60 and "pow \<Z> x n = x^n" |
61 proof - |
61 proof - |
62 \<comment> "Specification" |
62 \<comment> \<open>Specification\<close> |
63 show "monoid \<Z>" by standard auto |
63 show "monoid \<Z>" by standard auto |
64 then interpret int: monoid \<Z> . |
64 then interpret int: monoid \<Z> . |
65 |
65 |
66 \<comment> "Carrier" |
66 \<comment> \<open>Carrier\<close> |
67 show "carrier \<Z> = UNIV" by simp |
67 show "carrier \<Z> = UNIV" by simp |
68 |
68 |
69 \<comment> "Operations" |
69 \<comment> \<open>Operations\<close> |
70 { fix x y show "mult \<Z> x y = x * y" by simp } |
70 { fix x y show "mult \<Z> x y = x * y" by simp } |
71 show "one \<Z> = 1" by simp |
71 show "one \<Z> = 1" by simp |
72 show "pow \<Z> x n = x^n" by (induct n) simp_all |
72 show "pow \<Z> x n = x^n" by (induct n) simp_all |
73 qed |
73 qed |
74 |
74 |
75 interpretation int: comm_monoid \<Z> |
75 interpretation int: comm_monoid \<Z> |
76 rewrites "finprod \<Z> f A = prod f A" |
76 rewrites "finprod \<Z> f A = prod f A" |
77 proof - |
77 proof - |
78 \<comment> "Specification" |
78 \<comment> \<open>Specification\<close> |
79 show "comm_monoid \<Z>" by standard auto |
79 show "comm_monoid \<Z>" by standard auto |
80 then interpret int: comm_monoid \<Z> . |
80 then interpret int: comm_monoid \<Z> . |
81 |
81 |
82 \<comment> "Operations" |
82 \<comment> \<open>Operations\<close> |
83 { fix x y have "mult \<Z> x y = x * y" by simp } |
83 { fix x y have "mult \<Z> x y = x * y" by simp } |
84 note mult = this |
84 note mult = this |
85 have one: "one \<Z> = 1" by simp |
85 have one: "one \<Z> = 1" by simp |
86 show "finprod \<Z> f A = prod f A" |
86 show "finprod \<Z> f A = prod f A" |
87 by (induct A rule: infinite_finite_induct, auto) |
87 by (induct A rule: infinite_finite_induct, auto) |
91 rewrites int_carrier_eq: "carrier \<Z> = UNIV" |
91 rewrites int_carrier_eq: "carrier \<Z> = UNIV" |
92 and int_zero_eq: "zero \<Z> = 0" |
92 and int_zero_eq: "zero \<Z> = 0" |
93 and int_add_eq: "add \<Z> x y = x + y" |
93 and int_add_eq: "add \<Z> x y = x + y" |
94 and int_finsum_eq: "finsum \<Z> f A = sum f A" |
94 and int_finsum_eq: "finsum \<Z> f A = sum f A" |
95 proof - |
95 proof - |
96 \<comment> "Specification" |
96 \<comment> \<open>Specification\<close> |
97 show "abelian_monoid \<Z>" by standard auto |
97 show "abelian_monoid \<Z>" by standard auto |
98 then interpret int: abelian_monoid \<Z> . |
98 then interpret int: abelian_monoid \<Z> . |
99 |
99 |
100 \<comment> "Carrier" |
100 \<comment> \<open>Carrier\<close> |
101 show "carrier \<Z> = UNIV" by simp |
101 show "carrier \<Z> = UNIV" by simp |
102 |
102 |
103 \<comment> "Operations" |
103 \<comment> \<open>Operations\<close> |
104 { fix x y show "add \<Z> x y = x + y" by simp } |
104 { fix x y show "add \<Z> x y = x + y" by simp } |
105 note add = this |
105 note add = this |
106 show zero: "zero \<Z> = 0" |
106 show zero: "zero \<Z> = 0" |
107 by simp |
107 by simp |
108 show "finsum \<Z> f A = sum f A" |
108 show "finsum \<Z> f A = sum f A" |
119 and "add \<Z> x y = x + y" |
119 and "add \<Z> x y = x + y" |
120 and "finsum \<Z> f A = sum f A" |
120 and "finsum \<Z> f A = sum f A" |
121 and int_a_inv_eq: "a_inv \<Z> x = - x" |
121 and int_a_inv_eq: "a_inv \<Z> x = - x" |
122 and int_a_minus_eq: "a_minus \<Z> x y = x - y" |
122 and int_a_minus_eq: "a_minus \<Z> x y = x - y" |
123 proof - |
123 proof - |
124 \<comment> "Specification" |
124 \<comment> \<open>Specification\<close> |
125 show "abelian_group \<Z>" |
125 show "abelian_group \<Z>" |
126 proof (rule abelian_groupI) |
126 proof (rule abelian_groupI) |
127 fix x |
127 fix x |
128 assume "x \<in> carrier \<Z>" |
128 assume "x \<in> carrier \<Z>" |
129 then show "\<exists>y \<in> carrier \<Z>. y \<oplus>\<^bsub>\<Z>\<^esub> x = \<zero>\<^bsub>\<Z>\<^esub>" |
129 then show "\<exists>y \<in> carrier \<Z>. y \<oplus>\<^bsub>\<Z>\<^esub> x = \<zero>\<^bsub>\<Z>\<^esub>" |
130 by simp arith |
130 by simp arith |
131 qed auto |
131 qed auto |
132 then interpret int: abelian_group \<Z> . |
132 then interpret int: abelian_group \<Z> . |
133 \<comment> "Operations" |
133 \<comment> \<open>Operations\<close> |
134 { fix x y have "add \<Z> x y = x + y" by simp } |
134 { fix x y have "add \<Z> x y = x + y" by simp } |
135 note add = this |
135 note add = this |
136 have zero: "zero \<Z> = 0" by simp |
136 have zero: "zero \<Z> = 0" by simp |
137 { |
137 { |
138 fix x |
138 fix x |