| author | paulson <lp15@cam.ac.uk> | 
| Sun, 06 May 2018 11:33:40 +0100 | |
| changeset 68095 | 4fa3e63ecc7e | 
| parent 63462 | c1fe30f2bc32 | 
| child 69593 | 3dda49e08b9d | 
| permissions | -rw-r--r-- | 
| 41959 | 1 | (* Title: HOL/Library/Bit.thy | 
| 2 | Author: Brian Huffman | |
| 29994 
6ca6b6bd6e15
add formalization of a type of integers mod 2 to Library
 huffman parents: diff
changeset | 3 | *) | 
| 
6ca6b6bd6e15
add formalization of a type of integers mod 2 to Library
 huffman parents: diff
changeset | 4 | |
| 60500 | 5 | section \<open>The Field of Integers mod 2\<close> | 
| 29994 
6ca6b6bd6e15
add formalization of a type of integers mod 2 to Library
 huffman parents: diff
changeset | 6 | |
| 
6ca6b6bd6e15
add formalization of a type of integers mod 2 to Library
 huffman parents: diff
changeset | 7 | theory Bit | 
| 
6ca6b6bd6e15
add formalization of a type of integers mod 2 to Library
 huffman parents: diff
changeset | 8 | imports Main | 
| 
6ca6b6bd6e15
add formalization of a type of integers mod 2 to Library
 huffman parents: diff
changeset | 9 | begin | 
| 
6ca6b6bd6e15
add formalization of a type of integers mod 2 to Library
 huffman parents: diff
changeset | 10 | |
| 60500 | 11 | subsection \<open>Bits as a datatype\<close> | 
| 29994 
6ca6b6bd6e15
add formalization of a type of integers mod 2 to Library
 huffman parents: diff
changeset | 12 | |
| 53063 
8f7ac535892f
explicit conversion from and to bool, and into algebraic structures with 0 and 1
 haftmann parents: 
49834diff
changeset | 13 | typedef bit = "UNIV :: bool set" | 
| 63462 | 14 | morphisms set Bit .. | 
| 29994 
6ca6b6bd6e15
add formalization of a type of integers mod 2 to Library
 huffman parents: diff
changeset | 15 | |
| 
6ca6b6bd6e15
add formalization of a type of integers mod 2 to Library
 huffman parents: diff
changeset | 16 | instantiation bit :: "{zero, one}"
 | 
| 
6ca6b6bd6e15
add formalization of a type of integers mod 2 to Library
 huffman parents: diff
changeset | 17 | begin | 
| 
6ca6b6bd6e15
add formalization of a type of integers mod 2 to Library
 huffman parents: diff
changeset | 18 | |
| 63462 | 19 | definition zero_bit_def: "0 = Bit False" | 
| 29994 
6ca6b6bd6e15
add formalization of a type of integers mod 2 to Library
 huffman parents: diff
changeset | 20 | |
| 63462 | 21 | definition one_bit_def: "1 = Bit True" | 
| 29994 
6ca6b6bd6e15
add formalization of a type of integers mod 2 to Library
 huffman parents: diff
changeset | 22 | |
| 
6ca6b6bd6e15
add formalization of a type of integers mod 2 to Library
 huffman parents: diff
changeset | 23 | instance .. | 
| 
6ca6b6bd6e15
add formalization of a type of integers mod 2 to Library
 huffman parents: diff
changeset | 24 | |
| 
6ca6b6bd6e15
add formalization of a type of integers mod 2 to Library
 huffman parents: diff
changeset | 25 | end | 
| 
6ca6b6bd6e15
add formalization of a type of integers mod 2 to Library
 huffman parents: diff
changeset | 26 | |
| 58306 
117ba6cbe414
renamed 'rep_datatype' to 'old_rep_datatype' (HOL)
 blanchet parents: 
55416diff
changeset | 27 | old_rep_datatype "0::bit" "1::bit" | 
| 29994 
6ca6b6bd6e15
add formalization of a type of integers mod 2 to Library
 huffman parents: diff
changeset | 28 | proof - | 
| 63462 | 29 | fix P :: "bit \<Rightarrow> bool" | 
| 30 | fix x :: bit | |
| 31 | assume "P 0" and "P 1" | |
| 53063 
8f7ac535892f
explicit conversion from and to bool, and into algebraic structures with 0 and 1
 haftmann parents: 
49834diff
changeset | 32 | then have "\<forall>b. P (Bit b)" | 
| 29994 
6ca6b6bd6e15
add formalization of a type of integers mod 2 to Library
 huffman parents: diff
changeset | 33 | unfolding zero_bit_def one_bit_def | 
| 
6ca6b6bd6e15
add formalization of a type of integers mod 2 to Library
 huffman parents: diff
changeset | 34 | by (simp add: all_bool_eq) | 
| 
6ca6b6bd6e15
add formalization of a type of integers mod 2 to Library
 huffman parents: diff
changeset | 35 | then show "P x" | 
| 
6ca6b6bd6e15
add formalization of a type of integers mod 2 to Library
 huffman parents: diff
changeset | 36 | by (induct x) simp | 
| 
6ca6b6bd6e15
add formalization of a type of integers mod 2 to Library
 huffman parents: diff
changeset | 37 | next | 
| 
6ca6b6bd6e15
add formalization of a type of integers mod 2 to Library
 huffman parents: diff
changeset | 38 | show "(0::bit) \<noteq> (1::bit)" | 
| 
6ca6b6bd6e15
add formalization of a type of integers mod 2 to Library
 huffman parents: diff
changeset | 39 | unfolding zero_bit_def one_bit_def | 
| 53063 
8f7ac535892f
explicit conversion from and to bool, and into algebraic structures with 0 and 1
 haftmann parents: 
49834diff
changeset | 40 | by (simp add: Bit_inject) | 
| 29994 
6ca6b6bd6e15
add formalization of a type of integers mod 2 to Library
 huffman parents: diff
changeset | 41 | qed | 
| 
6ca6b6bd6e15
add formalization of a type of integers mod 2 to Library
 huffman parents: diff
changeset | 42 | |
| 63462 | 43 | lemma Bit_set_eq [simp]: "Bit (set b) = b" | 
| 53063 
8f7ac535892f
explicit conversion from and to bool, and into algebraic structures with 0 and 1
 haftmann parents: 
49834diff
changeset | 44 | by (fact set_inverse) | 
| 63462 | 45 | |
| 46 | lemma set_Bit_eq [simp]: "set (Bit P) = P" | |
| 53063 
8f7ac535892f
explicit conversion from and to bool, and into algebraic structures with 0 and 1
 haftmann parents: 
49834diff
changeset | 47 | by (rule Bit_inverse) rule | 
| 
8f7ac535892f
explicit conversion from and to bool, and into algebraic structures with 0 and 1
 haftmann parents: 
49834diff
changeset | 48 | |
| 63462 | 49 | lemma bit_eq_iff: "x = y \<longleftrightarrow> (set x \<longleftrightarrow> set y)" | 
| 53063 
8f7ac535892f
explicit conversion from and to bool, and into algebraic structures with 0 and 1
 haftmann parents: 
49834diff
changeset | 50 | by (auto simp add: set_inject) | 
| 
8f7ac535892f
explicit conversion from and to bool, and into algebraic structures with 0 and 1
 haftmann parents: 
49834diff
changeset | 51 | |
| 63462 | 52 | lemma Bit_inject [simp]: "Bit P = Bit Q \<longleftrightarrow> (P \<longleftrightarrow> Q)" | 
| 53 | by (auto simp add: Bit_inject) | |
| 53063 
8f7ac535892f
explicit conversion from and to bool, and into algebraic structures with 0 and 1
 haftmann parents: 
49834diff
changeset | 54 | |
| 
8f7ac535892f
explicit conversion from and to bool, and into algebraic structures with 0 and 1
 haftmann parents: 
49834diff
changeset | 55 | lemma set [iff]: | 
| 
8f7ac535892f
explicit conversion from and to bool, and into algebraic structures with 0 and 1
 haftmann parents: 
49834diff
changeset | 56 | "\<not> set 0" | 
| 
8f7ac535892f
explicit conversion from and to bool, and into algebraic structures with 0 and 1
 haftmann parents: 
49834diff
changeset | 57 | "set 1" | 
| 
8f7ac535892f
explicit conversion from and to bool, and into algebraic structures with 0 and 1
 haftmann parents: 
49834diff
changeset | 58 | by (simp_all add: zero_bit_def one_bit_def Bit_inverse) | 
| 
8f7ac535892f
explicit conversion from and to bool, and into algebraic structures with 0 and 1
 haftmann parents: 
49834diff
changeset | 59 | |
| 
8f7ac535892f
explicit conversion from and to bool, and into algebraic structures with 0 and 1
 haftmann parents: 
49834diff
changeset | 60 | lemma [code]: | 
| 
8f7ac535892f
explicit conversion from and to bool, and into algebraic structures with 0 and 1
 haftmann parents: 
49834diff
changeset | 61 | "set 0 \<longleftrightarrow> False" | 
| 
8f7ac535892f
explicit conversion from and to bool, and into algebraic structures with 0 and 1
 haftmann parents: 
49834diff
changeset | 62 | "set 1 \<longleftrightarrow> True" | 
| 
8f7ac535892f
explicit conversion from and to bool, and into algebraic structures with 0 and 1
 haftmann parents: 
49834diff
changeset | 63 | by simp_all | 
| 29994 
6ca6b6bd6e15
add formalization of a type of integers mod 2 to Library
 huffman parents: diff
changeset | 64 | |
| 63462 | 65 | lemma set_iff: "set b \<longleftrightarrow> b = 1" | 
| 53063 
8f7ac535892f
explicit conversion from and to bool, and into algebraic structures with 0 and 1
 haftmann parents: 
49834diff
changeset | 66 | by (cases b) simp_all | 
| 
8f7ac535892f
explicit conversion from and to bool, and into algebraic structures with 0 and 1
 haftmann parents: 
49834diff
changeset | 67 | |
| 
8f7ac535892f
explicit conversion from and to bool, and into algebraic structures with 0 and 1
 haftmann parents: 
49834diff
changeset | 68 | lemma bit_eq_iff_set: | 
| 
8f7ac535892f
explicit conversion from and to bool, and into algebraic structures with 0 and 1
 haftmann parents: 
49834diff
changeset | 69 | "b = 0 \<longleftrightarrow> \<not> set b" | 
| 
8f7ac535892f
explicit conversion from and to bool, and into algebraic structures with 0 and 1
 haftmann parents: 
49834diff
changeset | 70 | "b = 1 \<longleftrightarrow> set b" | 
| 
8f7ac535892f
explicit conversion from and to bool, and into algebraic structures with 0 and 1
 haftmann parents: 
49834diff
changeset | 71 | by (simp_all add: bit_eq_iff) | 
| 
8f7ac535892f
explicit conversion from and to bool, and into algebraic structures with 0 and 1
 haftmann parents: 
49834diff
changeset | 72 | |
| 
8f7ac535892f
explicit conversion from and to bool, and into algebraic structures with 0 and 1
 haftmann parents: 
49834diff
changeset | 73 | lemma Bit [simp, code]: | 
| 
8f7ac535892f
explicit conversion from and to bool, and into algebraic structures with 0 and 1
 haftmann parents: 
49834diff
changeset | 74 | "Bit False = 0" | 
| 
8f7ac535892f
explicit conversion from and to bool, and into algebraic structures with 0 and 1
 haftmann parents: 
49834diff
changeset | 75 | "Bit True = 1" | 
| 
8f7ac535892f
explicit conversion from and to bool, and into algebraic structures with 0 and 1
 haftmann parents: 
49834diff
changeset | 76 | by (simp_all add: zero_bit_def one_bit_def) | 
| 29994 
6ca6b6bd6e15
add formalization of a type of integers mod 2 to Library
 huffman parents: diff
changeset | 77 | |
| 63462 | 78 | lemma bit_not_0_iff [iff]: "x \<noteq> 0 \<longleftrightarrow> x = 1" for x :: bit | 
| 53063 
8f7ac535892f
explicit conversion from and to bool, and into algebraic structures with 0 and 1
 haftmann parents: 
49834diff
changeset | 79 | by (simp add: bit_eq_iff) | 
| 29994 
6ca6b6bd6e15
add formalization of a type of integers mod 2 to Library
 huffman parents: diff
changeset | 80 | |
| 63462 | 81 | lemma bit_not_1_iff [iff]: "x \<noteq> 1 \<longleftrightarrow> x = 0" for x :: bit | 
| 53063 
8f7ac535892f
explicit conversion from and to bool, and into algebraic structures with 0 and 1
 haftmann parents: 
49834diff
changeset | 82 | by (simp add: bit_eq_iff) | 
| 
8f7ac535892f
explicit conversion from and to bool, and into algebraic structures with 0 and 1
 haftmann parents: 
49834diff
changeset | 83 | |
| 
8f7ac535892f
explicit conversion from and to bool, and into algebraic structures with 0 and 1
 haftmann parents: 
49834diff
changeset | 84 | lemma [code]: | 
| 
8f7ac535892f
explicit conversion from and to bool, and into algebraic structures with 0 and 1
 haftmann parents: 
49834diff
changeset | 85 | "HOL.equal 0 b \<longleftrightarrow> \<not> set b" | 
| 
8f7ac535892f
explicit conversion from and to bool, and into algebraic structures with 0 and 1
 haftmann parents: 
49834diff
changeset | 86 | "HOL.equal 1 b \<longleftrightarrow> set b" | 
| 63462 | 87 | by (simp_all add: equal set_iff) | 
| 53063 
8f7ac535892f
explicit conversion from and to bool, and into algebraic structures with 0 and 1
 haftmann parents: 
49834diff
changeset | 88 | |
| 63462 | 89 | |
| 60500 | 90 | subsection \<open>Type @{typ bit} forms a field\<close>
 | 
| 29994 
6ca6b6bd6e15
add formalization of a type of integers mod 2 to Library
 huffman parents: diff
changeset | 91 | |
| 59867 
58043346ca64
given up separate type classes demanding `inverse 0 = 0`
 haftmann parents: 
58881diff
changeset | 92 | instantiation bit :: field | 
| 29994 
6ca6b6bd6e15
add formalization of a type of integers mod 2 to Library
 huffman parents: diff
changeset | 93 | begin | 
| 
6ca6b6bd6e15
add formalization of a type of integers mod 2 to Library
 huffman parents: diff
changeset | 94 | |
| 63462 | 95 | definition plus_bit_def: "x + y = case_bit y (case_bit 1 0 y) x" | 
| 29994 
6ca6b6bd6e15
add formalization of a type of integers mod 2 to Library
 huffman parents: diff
changeset | 96 | |
| 63462 | 97 | definition times_bit_def: "x * y = case_bit 0 y x" | 
| 29994 
6ca6b6bd6e15
add formalization of a type of integers mod 2 to Library
 huffman parents: diff
changeset | 98 | |
| 63462 | 99 | definition uminus_bit_def [simp]: "- x = x" for x :: bit | 
| 29994 
6ca6b6bd6e15
add formalization of a type of integers mod 2 to Library
 huffman parents: diff
changeset | 100 | |
| 63462 | 101 | definition minus_bit_def [simp]: "x - y = x + y" for x y :: bit | 
| 29994 
6ca6b6bd6e15
add formalization of a type of integers mod 2 to Library
 huffman parents: diff
changeset | 102 | |
| 63462 | 103 | definition inverse_bit_def [simp]: "inverse x = x" for x :: bit | 
| 29994 
6ca6b6bd6e15
add formalization of a type of integers mod 2 to Library
 huffman parents: diff
changeset | 104 | |
| 63462 | 105 | definition divide_bit_def [simp]: "x div y = x * y" for x y :: bit | 
| 29994 
6ca6b6bd6e15
add formalization of a type of integers mod 2 to Library
 huffman parents: diff
changeset | 106 | |
| 
6ca6b6bd6e15
add formalization of a type of integers mod 2 to Library
 huffman parents: diff
changeset | 107 | lemmas field_bit_defs = | 
| 
6ca6b6bd6e15
add formalization of a type of integers mod 2 to Library
 huffman parents: diff
changeset | 108 | plus_bit_def times_bit_def minus_bit_def uminus_bit_def | 
| 
6ca6b6bd6e15
add formalization of a type of integers mod 2 to Library
 huffman parents: diff
changeset | 109 | divide_bit_def inverse_bit_def | 
| 
6ca6b6bd6e15
add formalization of a type of integers mod 2 to Library
 huffman parents: diff
changeset | 110 | |
| 60679 | 111 | instance | 
| 112 | by standard (auto simp: field_bit_defs split: bit.split) | |
| 29994 
6ca6b6bd6e15
add formalization of a type of integers mod 2 to Library
 huffman parents: diff
changeset | 113 | |
| 
6ca6b6bd6e15
add formalization of a type of integers mod 2 to Library
 huffman parents: diff
changeset | 114 | end | 
| 
6ca6b6bd6e15
add formalization of a type of integers mod 2 to Library
 huffman parents: diff
changeset | 115 | |
| 63462 | 116 | lemma bit_add_self: "x + x = 0" for x :: bit | 
| 30129 | 117 | unfolding plus_bit_def by (simp split: bit.split) | 
| 29994 
6ca6b6bd6e15
add formalization of a type of integers mod 2 to Library
 huffman parents: diff
changeset | 118 | |
| 63462 | 119 | lemma bit_mult_eq_1_iff [simp]: "x * y = 1 \<longleftrightarrow> x = 1 \<and> y = 1" for x y :: bit | 
| 29994 
6ca6b6bd6e15
add formalization of a type of integers mod 2 to Library
 huffman parents: diff
changeset | 120 | unfolding times_bit_def by (simp split: bit.split) | 
| 
6ca6b6bd6e15
add formalization of a type of integers mod 2 to Library
 huffman parents: diff
changeset | 121 | |
| 60500 | 122 | text \<open>Not sure whether the next two should be simp rules.\<close> | 
| 29994 
6ca6b6bd6e15
add formalization of a type of integers mod 2 to Library
 huffman parents: diff
changeset | 123 | |
| 63462 | 124 | lemma bit_add_eq_0_iff: "x + y = 0 \<longleftrightarrow> x = y" for x y :: bit | 
| 29994 
6ca6b6bd6e15
add formalization of a type of integers mod 2 to Library
 huffman parents: diff
changeset | 125 | unfolding plus_bit_def by (simp split: bit.split) | 
| 
6ca6b6bd6e15
add formalization of a type of integers mod 2 to Library
 huffman parents: diff
changeset | 126 | |
| 63462 | 127 | lemma bit_add_eq_1_iff: "x + y = 1 \<longleftrightarrow> x \<noteq> y" for x y :: bit | 
| 29994 
6ca6b6bd6e15
add formalization of a type of integers mod 2 to Library
 huffman parents: diff
changeset | 128 | unfolding plus_bit_def by (simp split: bit.split) | 
| 
6ca6b6bd6e15
add formalization of a type of integers mod 2 to Library
 huffman parents: diff
changeset | 129 | |
| 
6ca6b6bd6e15
add formalization of a type of integers mod 2 to Library
 huffman parents: diff
changeset | 130 | |
| 60500 | 131 | subsection \<open>Numerals at type @{typ bit}\<close>
 | 
| 29994 
6ca6b6bd6e15
add formalization of a type of integers mod 2 to Library
 huffman parents: diff
changeset | 132 | |
| 60500 | 133 | text \<open>All numerals reduce to either 0 or 1.\<close> | 
| 29994 
6ca6b6bd6e15
add formalization of a type of integers mod 2 to Library
 huffman parents: diff
changeset | 134 | |
| 54489 
03ff4d1e6784
eliminiated neg_numeral in favour of - (numeral _)
 haftmann parents: 
53063diff
changeset | 135 | lemma bit_minus1 [simp]: "- 1 = (1 :: bit)" | 
| 
03ff4d1e6784
eliminiated neg_numeral in favour of - (numeral _)
 haftmann parents: 
53063diff
changeset | 136 | by (simp only: uminus_bit_def) | 
| 47108 
2a1953f0d20d
merged fork with new numeral representation (see NEWS)
 huffman parents: 
45701diff
changeset | 137 | |
| 54489 
03ff4d1e6784
eliminiated neg_numeral in favour of - (numeral _)
 haftmann parents: 
53063diff
changeset | 138 | lemma bit_neg_numeral [simp]: "(- numeral w :: bit) = numeral w" | 
| 
03ff4d1e6784
eliminiated neg_numeral in favour of - (numeral _)
 haftmann parents: 
53063diff
changeset | 139 | by (simp only: uminus_bit_def) | 
| 29995 | 140 | |
| 47108 
2a1953f0d20d
merged fork with new numeral representation (see NEWS)
 huffman parents: 
45701diff
changeset | 141 | lemma bit_numeral_even [simp]: "numeral (Num.Bit0 w) = (0 :: bit)" | 
| 
2a1953f0d20d
merged fork with new numeral representation (see NEWS)
 huffman parents: 
45701diff
changeset | 142 | by (simp only: numeral_Bit0 bit_add_self) | 
| 29994 
6ca6b6bd6e15
add formalization of a type of integers mod 2 to Library
 huffman parents: diff
changeset | 143 | |
| 47108 
2a1953f0d20d
merged fork with new numeral representation (see NEWS)
 huffman parents: 
45701diff
changeset | 144 | lemma bit_numeral_odd [simp]: "numeral (Num.Bit1 w) = (1 :: bit)" | 
| 
2a1953f0d20d
merged fork with new numeral representation (see NEWS)
 huffman parents: 
45701diff
changeset | 145 | by (simp only: numeral_Bit1 bit_add_self add_0_left) | 
| 29994 
6ca6b6bd6e15
add formalization of a type of integers mod 2 to Library
 huffman parents: diff
changeset | 146 | |
| 53063 
8f7ac535892f
explicit conversion from and to bool, and into algebraic structures with 0 and 1
 haftmann parents: 
49834diff
changeset | 147 | |
| 60500 | 148 | subsection \<open>Conversion from @{typ bit}\<close>
 | 
| 53063 
8f7ac535892f
explicit conversion from and to bool, and into algebraic structures with 0 and 1
 haftmann parents: 
49834diff
changeset | 149 | |
| 
8f7ac535892f
explicit conversion from and to bool, and into algebraic structures with 0 and 1
 haftmann parents: 
49834diff
changeset | 150 | context zero_neq_one | 
| 
8f7ac535892f
explicit conversion from and to bool, and into algebraic structures with 0 and 1
 haftmann parents: 
49834diff
changeset | 151 | begin | 
| 
8f7ac535892f
explicit conversion from and to bool, and into algebraic structures with 0 and 1
 haftmann parents: 
49834diff
changeset | 152 | |
| 
8f7ac535892f
explicit conversion from and to bool, and into algebraic structures with 0 and 1
 haftmann parents: 
49834diff
changeset | 153 | definition of_bit :: "bit \<Rightarrow> 'a" | 
| 63462 | 154 | where "of_bit b = case_bit 0 1 b" | 
| 53063 
8f7ac535892f
explicit conversion from and to bool, and into algebraic structures with 0 and 1
 haftmann parents: 
49834diff
changeset | 155 | |
| 
8f7ac535892f
explicit conversion from and to bool, and into algebraic structures with 0 and 1
 haftmann parents: 
49834diff
changeset | 156 | lemma of_bit_eq [simp, code]: | 
| 
8f7ac535892f
explicit conversion from and to bool, and into algebraic structures with 0 and 1
 haftmann parents: 
49834diff
changeset | 157 | "of_bit 0 = 0" | 
| 
8f7ac535892f
explicit conversion from and to bool, and into algebraic structures with 0 and 1
 haftmann parents: 
49834diff
changeset | 158 | "of_bit 1 = 1" | 
| 
8f7ac535892f
explicit conversion from and to bool, and into algebraic structures with 0 and 1
 haftmann parents: 
49834diff
changeset | 159 | by (simp_all add: of_bit_def) | 
| 
8f7ac535892f
explicit conversion from and to bool, and into algebraic structures with 0 and 1
 haftmann parents: 
49834diff
changeset | 160 | |
| 63462 | 161 | lemma of_bit_eq_iff: "of_bit x = of_bit y \<longleftrightarrow> x = y" | 
| 162 | by (cases x) (cases y; simp)+ | |
| 53063 
8f7ac535892f
explicit conversion from and to bool, and into algebraic structures with 0 and 1
 haftmann parents: 
49834diff
changeset | 163 | |
| 29994 
6ca6b6bd6e15
add formalization of a type of integers mod 2 to Library
 huffman parents: diff
changeset | 164 | end | 
| 53063 
8f7ac535892f
explicit conversion from and to bool, and into algebraic structures with 0 and 1
 haftmann parents: 
49834diff
changeset | 165 | |
| 63462 | 166 | lemma (in semiring_1) of_nat_of_bit_eq: "of_nat (of_bit b) = of_bit b" | 
| 53063 
8f7ac535892f
explicit conversion from and to bool, and into algebraic structures with 0 and 1
 haftmann parents: 
49834diff
changeset | 167 | by (cases b) simp_all | 
| 
8f7ac535892f
explicit conversion from and to bool, and into algebraic structures with 0 and 1
 haftmann parents: 
49834diff
changeset | 168 | |
| 63462 | 169 | lemma (in ring_1) of_int_of_bit_eq: "of_int (of_bit b) = of_bit b" | 
| 170 | by (cases b) simp_all | |
| 53063 
8f7ac535892f
explicit conversion from and to bool, and into algebraic structures with 0 and 1
 haftmann parents: 
49834diff
changeset | 171 | |
| 
8f7ac535892f
explicit conversion from and to bool, and into algebraic structures with 0 and 1
 haftmann parents: 
49834diff
changeset | 172 | hide_const (open) set | 
| 
8f7ac535892f
explicit conversion from and to bool, and into algebraic structures with 0 and 1
 haftmann parents: 
49834diff
changeset | 173 | |
| 
8f7ac535892f
explicit conversion from and to bool, and into algebraic structures with 0 and 1
 haftmann parents: 
49834diff
changeset | 174 | end |