3156 |
3156 |
3157 datatype nibble = |
3157 datatype nibble = |
3158 Nibble0 | Nibble1 | Nibble2 | Nibble3 | Nibble4 | Nibble5 | Nibble6 | Nibble7 |
3158 Nibble0 | Nibble1 | Nibble2 | Nibble3 | Nibble4 | Nibble5 | Nibble6 | Nibble7 |
3159 | Nibble8 | Nibble9 | NibbleA | NibbleB | NibbleC | NibbleD | NibbleE | NibbleF |
3159 | Nibble8 | Nibble9 | NibbleA | NibbleB | NibbleC | NibbleD | NibbleE | NibbleF |
3160 |
3160 |
|
3161 lemma UNIV_nibble: |
|
3162 "UNIV = {Nibble0, Nibble1, Nibble2, Nibble3, Nibble4, Nibble5, Nibble6, Nibble7, |
|
3163 Nibble8, Nibble9, NibbleA, NibbleB, NibbleC, NibbleD, NibbleE, NibbleF}" (is "_ = ?A") |
|
3164 proof (rule UNIV_eq_I) |
|
3165 fix x show "x \<in> ?A" by (cases x) simp_all |
|
3166 qed |
|
3167 |
|
3168 instance nibble :: finite |
|
3169 by default (simp add: UNIV_nibble) |
|
3170 |
|
3171 declare UNIV_nibble [code func] |
|
3172 |
3161 datatype char = Char nibble nibble |
3173 datatype char = Char nibble nibble |
3162 -- "Note: canonical order of character encoding coincides with standard term ordering" |
3174 -- "Note: canonical order of character encoding coincides with standard term ordering" |
|
3175 |
|
3176 lemma UNIV_char: |
|
3177 "UNIV = image (split Char) (UNIV \<times> UNIV)" |
|
3178 proof (rule UNIV_eq_I) |
|
3179 fix x show "x \<in> image (split Char) (UNIV \<times> UNIV)" by (cases x) auto |
|
3180 qed |
|
3181 |
|
3182 instance char :: finite |
|
3183 by default (simp add: UNIV_char) |
3163 |
3184 |
3164 types string = "char list" |
3185 types string = "char list" |
3165 |
3186 |
3166 syntax |
3187 syntax |
3167 "_Char" :: "xstr => char" ("CHR _") |
3188 "_Char" :: "xstr => char" ("CHR _") |