equal
deleted
inserted
replaced
85 "HOL.equal 0 b \<longleftrightarrow> \<not> set b" |
85 "HOL.equal 0 b \<longleftrightarrow> \<not> set b" |
86 "HOL.equal 1 b \<longleftrightarrow> set b" |
86 "HOL.equal 1 b \<longleftrightarrow> set b" |
87 by (simp_all add: equal set_iff) |
87 by (simp_all add: equal set_iff) |
88 |
88 |
89 |
89 |
90 subsection \<open>Type @{typ bit} forms a field\<close> |
90 subsection \<open>Type \<^typ>\<open>bit\<close> forms a field\<close> |
91 |
91 |
92 instantiation bit :: field |
92 instantiation bit :: field |
93 begin |
93 begin |
94 |
94 |
95 definition plus_bit_def: "x + y = case_bit y (case_bit 1 0 y) x" |
95 definition plus_bit_def: "x + y = case_bit y (case_bit 1 0 y) x" |
126 |
126 |
127 lemma bit_add_eq_1_iff: "x + y = 1 \<longleftrightarrow> x \<noteq> y" for x y :: bit |
127 lemma bit_add_eq_1_iff: "x + y = 1 \<longleftrightarrow> x \<noteq> y" for x y :: bit |
128 unfolding plus_bit_def by (simp split: bit.split) |
128 unfolding plus_bit_def by (simp split: bit.split) |
129 |
129 |
130 |
130 |
131 subsection \<open>Numerals at type @{typ bit}\<close> |
131 subsection \<open>Numerals at type \<^typ>\<open>bit\<close>\<close> |
132 |
132 |
133 text \<open>All numerals reduce to either 0 or 1.\<close> |
133 text \<open>All numerals reduce to either 0 or 1.\<close> |
134 |
134 |
135 lemma bit_minus1 [simp]: "- 1 = (1 :: bit)" |
135 lemma bit_minus1 [simp]: "- 1 = (1 :: bit)" |
136 by (simp only: uminus_bit_def) |
136 by (simp only: uminus_bit_def) |
143 |
143 |
144 lemma bit_numeral_odd [simp]: "numeral (Num.Bit1 w) = (1 :: bit)" |
144 lemma bit_numeral_odd [simp]: "numeral (Num.Bit1 w) = (1 :: bit)" |
145 by (simp only: numeral_Bit1 bit_add_self add_0_left) |
145 by (simp only: numeral_Bit1 bit_add_self add_0_left) |
146 |
146 |
147 |
147 |
148 subsection \<open>Conversion from @{typ bit}\<close> |
148 subsection \<open>Conversion from \<^typ>\<open>bit\<close>\<close> |
149 |
149 |
150 context zero_neq_one |
150 context zero_neq_one |
151 begin |
151 begin |
152 |
152 |
153 definition of_bit :: "bit \<Rightarrow> 'a" |
153 definition of_bit :: "bit \<Rightarrow> 'a" |