src/HOL/Library/Enum.thy
author haftmann
Thu Mar 27 19:04:38 2008 +0100 (2008-03-27)
changeset 26444 6a5faa5bcf19
parent 26348 0f8e23edd357
child 26513 6f306c8c2c54
permissions -rw-r--r--
instance for functions, explicit characters
haftmann@26348
     1
(*  Title:      HOL/Library/Enum.thy
haftmann@26348
     2
    ID:         $Id$
haftmann@26348
     3
    Author:     Florian Haftmann, TU Muenchen
haftmann@26348
     4
*)
haftmann@26348
     5
haftmann@26348
     6
header {* Finite types as explicit enumerations *}
haftmann@26348
     7
haftmann@26348
     8
theory Enum
haftmann@26348
     9
imports Main
haftmann@26348
    10
begin
haftmann@26348
    11
haftmann@26348
    12
subsection {* Class @{text enum} *}
haftmann@26348
    13
haftmann@26444
    14
class enum = itself +
haftmann@26348
    15
  fixes enum :: "'a list"
haftmann@26444
    16
  assumes UNIV_enum [code func]: "UNIV = set enum"
haftmann@26444
    17
    and enum_distinct: "distinct enum"
haftmann@26348
    18
begin
haftmann@26348
    19
haftmann@26444
    20
lemma finite_enum: "finite (UNIV \<Colon> 'a set)"
haftmann@26444
    21
  unfolding UNIV_enum ..
haftmann@26444
    22
haftmann@26444
    23
lemma enum_all: "set enum = UNIV" unfolding UNIV_enum ..
haftmann@26444
    24
haftmann@26348
    25
lemma in_enum [intro]: "x \<in> set enum"
haftmann@26348
    26
  unfolding enum_all by auto
haftmann@26348
    27
haftmann@26348
    28
lemma enum_eq_I:
haftmann@26348
    29
  assumes "\<And>x. x \<in> set xs"
haftmann@26348
    30
  shows "set enum = set xs"
haftmann@26348
    31
proof -
haftmann@26348
    32
  from assms UNIV_eq_I have "UNIV = set xs" by auto
haftmann@26348
    33
  with enum_all show ?thesis by simp
haftmann@26348
    34
qed
haftmann@26348
    35
haftmann@26348
    36
end
haftmann@26348
    37
haftmann@26348
    38
haftmann@26348
    39
subsection {* Equality and order on functions *}
haftmann@26348
    40
haftmann@26348
    41
instance "fun" :: (enum, eq) eq ..
haftmann@26348
    42
haftmann@26348
    43
lemma eq_fun [code func]:
haftmann@26348
    44
  fixes f g :: "'a\<Colon>enum \<Rightarrow> 'b\<Colon>eq"
haftmann@26348
    45
  shows "f = g \<longleftrightarrow> (\<forall>x \<in> set enum. f x = g x)"
haftmann@26348
    46
  by (simp add: enum_all expand_fun_eq)
haftmann@26348
    47
haftmann@26348
    48
lemma order_fun [code func]:
haftmann@26348
    49
  fixes f g :: "'a\<Colon>enum \<Rightarrow> 'b\<Colon>order"
haftmann@26348
    50
  shows "f \<le> g \<longleftrightarrow> (\<forall>x \<in> set enum. f x \<le> g x)"
haftmann@26348
    51
    and "f < g \<longleftrightarrow> f \<le> g \<and> (\<exists>x \<in> set enum. f x \<noteq> g x)"
haftmann@26348
    52
  by (simp_all add: enum_all expand_fun_eq le_fun_def less_fun_def order_less_le)
haftmann@26348
    53
haftmann@26348
    54
haftmann@26348
    55
subsection {* Default instances *}
haftmann@26348
    56
haftmann@26444
    57
primrec n_lists :: "nat \<Rightarrow> 'a list \<Rightarrow> 'a list list" where
haftmann@26444
    58
  "n_lists 0 xs = [[]]"
haftmann@26444
    59
  | "n_lists (Suc n) xs = concat (map (\<lambda>ys. map (\<lambda>y. y # ys) xs) (n_lists n xs))"
haftmann@26444
    60
haftmann@26444
    61
lemma n_lists_Nil [simp]: "n_lists n [] = (if n = 0 then [[]] else [])"
haftmann@26444
    62
  by (induct n) simp_all
haftmann@26444
    63
haftmann@26444
    64
lemma length_n_lists: "length (n_lists n xs) = length xs ^ n"
haftmann@26444
    65
  by (induct n) (auto simp add: length_concat map_compose [symmetric] o_def listsum_triv)
haftmann@26444
    66
haftmann@26444
    67
lemma length_n_lists_elem: "ys \<in> set (n_lists n xs) \<Longrightarrow> length ys = n"
haftmann@26444
    68
  by (induct n arbitrary: ys) auto
haftmann@26444
    69
haftmann@26444
    70
lemma set_n_lists: "set (n_lists n xs) = {ys. length ys = n \<and> set ys \<subseteq> set xs}"
haftmann@26444
    71
proof (rule set_ext)
haftmann@26444
    72
  fix ys :: "'a list"
haftmann@26444
    73
  show "ys \<in> set (n_lists n xs) \<longleftrightarrow> ys \<in> {ys. length ys = n \<and> set ys \<subseteq> set xs}"
haftmann@26444
    74
  proof -
haftmann@26444
    75
    have "ys \<in> set (n_lists n xs) \<Longrightarrow> length ys = n"
haftmann@26444
    76
      by (induct n arbitrary: ys) auto
haftmann@26444
    77
    moreover have "\<And>x. ys \<in> set (n_lists n xs) \<Longrightarrow> x \<in> set ys \<Longrightarrow> x \<in> set xs"
haftmann@26444
    78
      by (induct n arbitrary: ys) auto
haftmann@26444
    79
    moreover have "set ys \<subseteq> set xs \<Longrightarrow> ys \<in> set (n_lists (length ys) xs)"
haftmann@26444
    80
      by (induct ys) auto
haftmann@26444
    81
    ultimately show ?thesis by auto
haftmann@26444
    82
  qed
haftmann@26444
    83
qed
haftmann@26444
    84
haftmann@26444
    85
lemma distinct_n_lists:
haftmann@26444
    86
  assumes "distinct xs"
haftmann@26444
    87
  shows "distinct (n_lists n xs)"
haftmann@26444
    88
proof (rule card_distinct)
haftmann@26444
    89
  from assms have card_length: "card (set xs) = length xs" by (rule distinct_card)
haftmann@26444
    90
  have "card (set (n_lists n xs)) = card (set xs) ^ n"
haftmann@26444
    91
  proof (induct n)
haftmann@26444
    92
    case 0 then show ?case by simp
haftmann@26444
    93
  next
haftmann@26444
    94
    case (Suc n)
haftmann@26444
    95
    moreover have "card (\<Union>ys\<in>set (n_lists n xs). (\<lambda>y. y # ys) ` set xs)
haftmann@26444
    96
      = (\<Sum>ys\<in>set (n_lists n xs). card ((\<lambda>y. y # ys) ` set xs))"
haftmann@26444
    97
      by (rule card_UN_disjoint) auto
haftmann@26444
    98
    moreover have "\<And>ys. card ((\<lambda>y. y # ys) ` set xs) = card (set xs)"
haftmann@26444
    99
      by (rule card_image) (simp add: inj_on_def)
haftmann@26444
   100
    ultimately show ?case by auto
haftmann@26444
   101
  qed
haftmann@26444
   102
  also have "\<dots> = length xs ^ n" by (simp add: card_length)
haftmann@26444
   103
  finally show "card (set (n_lists n xs)) = length (n_lists n xs)"
haftmann@26444
   104
    by (simp add: length_n_lists)
haftmann@26444
   105
qed
haftmann@26444
   106
haftmann@26444
   107
lemma map_of_zip_map:
haftmann@26444
   108
  fixes f :: "'a\<Colon>enum \<Rightarrow> 'b\<Colon>enum"
haftmann@26444
   109
  shows "map_of (zip xs (map f xs)) = (\<lambda>x. if x \<in> set xs then Some (f x) else None)"
haftmann@26444
   110
  by (induct xs) (simp_all add: expand_fun_eq)
haftmann@26444
   111
haftmann@26444
   112
lemma map_of_zip_enum_is_Some:
haftmann@26444
   113
  assumes "length ys = length (enum \<Colon> 'a\<Colon>enum list)"
haftmann@26444
   114
  shows "\<exists>y. map_of (zip (enum \<Colon> 'a\<Colon>enum list) ys) x = Some y"
haftmann@26444
   115
proof -
haftmann@26444
   116
  from assms have "x \<in> set (enum \<Colon> 'a\<Colon>enum list) \<longleftrightarrow>
haftmann@26444
   117
    (\<exists>y. map_of (zip (enum \<Colon> 'a\<Colon>enum list) ys) x = Some y)"
haftmann@26444
   118
    by (auto intro!: map_of_zip_is_Some)
haftmann@26444
   119
  then show ?thesis using enum_all by auto
haftmann@26444
   120
qed
haftmann@26444
   121
haftmann@26444
   122
lemma map_of_zip_enum_inject:
haftmann@26444
   123
  fixes xs ys :: "'b\<Colon>enum list"
haftmann@26444
   124
  assumes length: "length xs = length (enum \<Colon> 'a\<Colon>enum list)"
haftmann@26444
   125
      "length ys = length (enum \<Colon> 'a\<Colon>enum list)"
haftmann@26444
   126
    and map_of: "the \<circ> map_of (zip (enum \<Colon> 'a\<Colon>enum list) xs) = the \<circ> map_of (zip (enum \<Colon> 'a\<Colon>enum list) ys)"
haftmann@26444
   127
  shows "xs = ys"
haftmann@26444
   128
proof -
haftmann@26444
   129
  have "map_of (zip (enum \<Colon> 'a list) xs) = map_of (zip (enum \<Colon> 'a list) ys)"
haftmann@26444
   130
  proof
haftmann@26444
   131
    fix x :: 'a
haftmann@26444
   132
    from length map_of_zip_enum_is_Some obtain y1 y2
haftmann@26444
   133
      where "map_of (zip (enum \<Colon> 'a list) xs) x = Some y1"
haftmann@26444
   134
        and "map_of (zip (enum \<Colon> 'a list) ys) x = Some y2" by blast
haftmann@26444
   135
    moreover from map_of have "the (map_of (zip (enum \<Colon> 'a\<Colon>enum list) xs) x) = the (map_of (zip (enum \<Colon> 'a\<Colon>enum list) ys) x)"
haftmann@26444
   136
      by (auto dest: fun_cong)
haftmann@26444
   137
    ultimately show "map_of (zip (enum \<Colon> 'a\<Colon>enum list) xs) x = map_of (zip (enum \<Colon> 'a\<Colon>enum list) ys) x"
haftmann@26444
   138
      by simp
haftmann@26444
   139
  qed
haftmann@26444
   140
  with length enum_distinct show "xs = ys" by (rule map_of_zip_inject)
haftmann@26444
   141
qed
haftmann@26444
   142
haftmann@26444
   143
instantiation "fun" :: (enum, enum) enum
haftmann@26444
   144
begin
haftmann@26444
   145
haftmann@26444
   146
definition
haftmann@26444
   147
  [code func del]: "enum = map (\<lambda>ys. the o map_of (zip (enum\<Colon>'a list) ys)) (n_lists (length (enum\<Colon>'a\<Colon>enum list)) enum)"
haftmann@26444
   148
haftmann@26444
   149
instance proof
haftmann@26444
   150
  show "UNIV = set (enum \<Colon> ('a \<Rightarrow> 'b) list)"
haftmann@26444
   151
  proof (rule UNIV_eq_I)
haftmann@26444
   152
    fix f :: "'a \<Rightarrow> 'b"
haftmann@26444
   153
    have "f = the \<circ> map_of (zip (enum \<Colon> 'a\<Colon>enum list) (map f enum))"
haftmann@26444
   154
      by (auto simp add: map_of_zip_map expand_fun_eq)
haftmann@26444
   155
    then show "f \<in> set enum"
haftmann@26444
   156
      by (auto simp add: enum_fun_def set_n_lists)
haftmann@26444
   157
  qed
haftmann@26444
   158
next
haftmann@26444
   159
  from map_of_zip_enum_inject
haftmann@26444
   160
  show "distinct (enum \<Colon> ('a \<Rightarrow> 'b) list)"
haftmann@26444
   161
    by (auto intro!: inj_onI simp add: enum_fun_def
haftmann@26444
   162
      distinct_map distinct_n_lists enum_distinct set_n_lists enum_all)
haftmann@26444
   163
qed
haftmann@26444
   164
haftmann@26444
   165
end
haftmann@26444
   166
haftmann@26444
   167
lemma [code func]:
haftmann@26444
   168
  "enum = map (\<lambda>ys. the o map_of (zip (enum\<Colon>('a\<Colon>{enum, eq}) list) ys)) (n_lists (length (enum\<Colon>'a\<Colon>{enum, eq} list)) enum)"
haftmann@26444
   169
  unfolding enum_fun_def ..
haftmann@26444
   170
haftmann@26348
   171
instantiation unit :: enum
haftmann@26348
   172
begin
haftmann@26348
   173
haftmann@26348
   174
definition
haftmann@26348
   175
  "enum = [()]"
haftmann@26348
   176
haftmann@26348
   177
instance by default
haftmann@26444
   178
  (simp_all add: enum_unit_def UNIV_unit)
haftmann@26348
   179
haftmann@26348
   180
end
haftmann@26348
   181
haftmann@26348
   182
instantiation bool :: enum
haftmann@26348
   183
begin
haftmann@26348
   184
haftmann@26348
   185
definition
haftmann@26348
   186
  "enum = [False, True]"
haftmann@26348
   187
haftmann@26348
   188
instance by default
haftmann@26444
   189
  (simp_all add: enum_bool_def UNIV_bool)
haftmann@26348
   190
haftmann@26348
   191
end
haftmann@26348
   192
haftmann@26348
   193
primrec product :: "'a list \<Rightarrow> 'b list \<Rightarrow> ('a \<times> 'b) list" where
haftmann@26348
   194
  "product [] _ = []"
haftmann@26348
   195
  | "product (x#xs) ys = map (Pair x) ys @ product xs ys"
haftmann@26348
   196
haftmann@26348
   197
lemma product_list_set:
haftmann@26348
   198
  "set (product xs ys) = set xs \<times> set ys"
haftmann@26348
   199
  by (induct xs) auto
haftmann@26348
   200
haftmann@26444
   201
lemma distinct_product:
haftmann@26444
   202
  assumes "distinct xs" and "distinct ys"
haftmann@26444
   203
  shows "distinct (product xs ys)"
haftmann@26444
   204
  using assms by (induct xs)
haftmann@26444
   205
    (auto intro: inj_onI simp add: product_list_set distinct_map)
haftmann@26444
   206
haftmann@26348
   207
instantiation * :: (enum, enum) enum
haftmann@26348
   208
begin
haftmann@26348
   209
haftmann@26348
   210
definition
haftmann@26348
   211
  "enum = product enum enum"
haftmann@26348
   212
haftmann@26348
   213
instance by default
haftmann@26444
   214
  (simp_all add: enum_prod_def product_list_set distinct_product enum_all enum_distinct)
haftmann@26348
   215
haftmann@26348
   216
end
haftmann@26348
   217
haftmann@26348
   218
instantiation "+" :: (enum, enum) enum
haftmann@26348
   219
begin
haftmann@26348
   220
haftmann@26348
   221
definition
haftmann@26348
   222
  "enum = map Inl enum @ map Inr enum"
haftmann@26348
   223
haftmann@26348
   224
instance by default
haftmann@26444
   225
  (auto simp add: enum_all enum_sum_def, case_tac x, auto intro: inj_onI simp add: distinct_map enum_distinct)
haftmann@26348
   226
haftmann@26348
   227
end
haftmann@26348
   228
haftmann@26348
   229
primrec sublists :: "'a list \<Rightarrow> 'a list list" where
haftmann@26348
   230
  "sublists [] = [[]]"
haftmann@26348
   231
  | "sublists (x#xs) = (let xss = sublists xs in map (Cons x) xss @ xss)"
haftmann@26348
   232
haftmann@26444
   233
lemma length_sublists:
haftmann@26444
   234
  "length (sublists xs) = Suc (Suc (0\<Colon>nat)) ^ length xs"
haftmann@26444
   235
  by (induct xs) (simp_all add: Let_def)
haftmann@26444
   236
haftmann@26348
   237
lemma sublists_powset:
haftmann@26444
   238
  "set ` set (sublists xs) = Pow (set xs)"
haftmann@26348
   239
proof -
haftmann@26348
   240
  have aux: "\<And>x A. set ` Cons x ` A = insert x ` set ` A"
haftmann@26348
   241
    by (auto simp add: image_def)
haftmann@26444
   242
  have "set (map set (sublists xs)) = Pow (set xs)"
haftmann@26348
   243
    by (induct xs)
haftmann@26444
   244
      (simp_all add: aux Let_def Pow_insert Un_commute)
haftmann@26444
   245
  then show ?thesis by simp
haftmann@26444
   246
qed
haftmann@26444
   247
haftmann@26444
   248
lemma distinct_set_sublists:
haftmann@26444
   249
  assumes "distinct xs"
haftmann@26444
   250
  shows "distinct (map set (sublists xs))"
haftmann@26444
   251
proof (rule card_distinct)
haftmann@26444
   252
  have "finite (set xs)" by rule
haftmann@26444
   253
  then have "card (Pow (set xs)) = Suc (Suc 0) ^ card (set xs)" by (rule card_Pow)
haftmann@26444
   254
  with assms distinct_card [of xs]
haftmann@26444
   255
    have "card (Pow (set xs)) = Suc (Suc 0) ^ length xs" by simp
haftmann@26444
   256
  then show "card (set (map set (sublists xs))) = length (map set (sublists xs))"
haftmann@26444
   257
    by (simp add: sublists_powset length_sublists)
haftmann@26348
   258
qed
haftmann@26348
   259
haftmann@26348
   260
instantiation set :: (enum) enum
haftmann@26348
   261
begin
haftmann@26348
   262
haftmann@26348
   263
definition
haftmann@26348
   264
  "enum = map set (sublists enum)"
haftmann@26348
   265
haftmann@26348
   266
instance by default
haftmann@26444
   267
  (simp_all add: enum_set_def enum_all sublists_powset distinct_set_sublists enum_distinct)
haftmann@26348
   268
haftmann@26348
   269
end
haftmann@26348
   270
haftmann@26348
   271
instantiation nibble :: enum
haftmann@26348
   272
begin
haftmann@26348
   273
haftmann@26348
   274
definition
haftmann@26348
   275
  "enum = [Nibble0, Nibble1, Nibble2, Nibble3, Nibble4, Nibble5, Nibble6, Nibble7,
haftmann@26348
   276
    Nibble8, Nibble9, NibbleA, NibbleB, NibbleC, NibbleD, NibbleE, NibbleF]"
haftmann@26348
   277
haftmann@26348
   278
instance by default
haftmann@26444
   279
  (simp_all add: enum_nibble_def UNIV_nibble)
haftmann@26348
   280
haftmann@26348
   281
end
haftmann@26348
   282
haftmann@26348
   283
instantiation char :: enum
haftmann@26348
   284
begin
haftmann@26348
   285
haftmann@26348
   286
definition
haftmann@26444
   287
  [code func del]: "enum = map (split Char) (product enum enum)"
haftmann@26444
   288
haftmann@26444
   289
lemma enum_char [code func]:
haftmann@26444
   290
  "enum = [Char Nibble0 Nibble0, Char Nibble0 Nibble1, Char Nibble0 Nibble2,
haftmann@26444
   291
  Char Nibble0 Nibble3, Char Nibble0 Nibble4, Char Nibble0 Nibble5,
haftmann@26444
   292
  Char Nibble0 Nibble6, Char Nibble0 Nibble7, Char Nibble0 Nibble8,
haftmann@26444
   293
  Char Nibble0 Nibble9, Char Nibble0 NibbleA, Char Nibble0 NibbleB,
haftmann@26444
   294
  Char Nibble0 NibbleC, Char Nibble0 NibbleD, Char Nibble0 NibbleE,
haftmann@26444
   295
  Char Nibble0 NibbleF, Char Nibble1 Nibble0, Char Nibble1 Nibble1,
haftmann@26444
   296
  Char Nibble1 Nibble2, Char Nibble1 Nibble3, Char Nibble1 Nibble4,
haftmann@26444
   297
  Char Nibble1 Nibble5, Char Nibble1 Nibble6, Char Nibble1 Nibble7,
haftmann@26444
   298
  Char Nibble1 Nibble8, Char Nibble1 Nibble9, Char Nibble1 NibbleA,
haftmann@26444
   299
  Char Nibble1 NibbleB, Char Nibble1 NibbleC, Char Nibble1 NibbleD,
haftmann@26444
   300
  Char Nibble1 NibbleE, Char Nibble1 NibbleF, CHR '' '', CHR ''!'',
haftmann@26444
   301
  Char Nibble2 Nibble2, CHR ''#'', CHR ''$'', CHR ''%'', CHR ''&'',
haftmann@26444
   302
  Char Nibble2 Nibble7, CHR ''('', CHR '')'', CHR ''*'', CHR ''+'', CHR '','',
haftmann@26444
   303
  CHR ''-'', CHR ''.'', CHR ''/'', CHR ''0'', CHR ''1'', CHR ''2'', CHR ''3'',
haftmann@26444
   304
  CHR ''4'', CHR ''5'', CHR ''6'', CHR ''7'', CHR ''8'', CHR ''9'', CHR '':'',
haftmann@26444
   305
  CHR '';'', CHR ''<'', CHR ''='', CHR ''>'', CHR ''?'', CHR ''@'', CHR ''A'',
haftmann@26444
   306
  CHR ''B'', CHR ''C'', CHR ''D'', CHR ''E'', CHR ''F'', CHR ''G'', CHR ''H'',
haftmann@26444
   307
  CHR ''I'', CHR ''J'', CHR ''K'', CHR ''L'', CHR ''M'', CHR ''N'', CHR ''O'',
haftmann@26444
   308
  CHR ''P'', CHR ''Q'', CHR ''R'', CHR ''S'', CHR ''T'', CHR ''U'', CHR ''V'',
haftmann@26444
   309
  CHR ''W'', CHR ''X'', CHR ''Y'', CHR ''Z'', CHR ''['', Char Nibble5 NibbleC,
haftmann@26444
   310
  CHR '']'', CHR ''^'', CHR ''_'', Char Nibble6 Nibble0, CHR ''a'', CHR ''b'',
haftmann@26444
   311
  CHR ''c'', CHR ''d'', CHR ''e'', CHR ''f'', CHR ''g'', CHR ''h'', CHR ''i'',
haftmann@26444
   312
  CHR ''j'', CHR ''k'', CHR ''l'', CHR ''m'', CHR ''n'', CHR ''o'', CHR ''p'',
haftmann@26444
   313
  CHR ''q'', CHR ''r'', CHR ''s'', CHR ''t'', CHR ''u'', CHR ''v'', CHR ''w'',
haftmann@26444
   314
  CHR ''x'', CHR ''y'', CHR ''z'', CHR ''{'', CHR ''|'', CHR ''}'', CHR ''~'',
haftmann@26444
   315
  Char Nibble7 NibbleF, Char Nibble8 Nibble0, Char Nibble8 Nibble1,
haftmann@26444
   316
  Char Nibble8 Nibble2, Char Nibble8 Nibble3, Char Nibble8 Nibble4,
haftmann@26444
   317
  Char Nibble8 Nibble5, Char Nibble8 Nibble6, Char Nibble8 Nibble7,
haftmann@26444
   318
  Char Nibble8 Nibble8, Char Nibble8 Nibble9, Char Nibble8 NibbleA,
haftmann@26444
   319
  Char Nibble8 NibbleB, Char Nibble8 NibbleC, Char Nibble8 NibbleD,
haftmann@26444
   320
  Char Nibble8 NibbleE, Char Nibble8 NibbleF, Char Nibble9 Nibble0,
haftmann@26444
   321
  Char Nibble9 Nibble1, Char Nibble9 Nibble2, Char Nibble9 Nibble3,
haftmann@26444
   322
  Char Nibble9 Nibble4, Char Nibble9 Nibble5, Char Nibble9 Nibble6,
haftmann@26444
   323
  Char Nibble9 Nibble7, Char Nibble9 Nibble8, Char Nibble9 Nibble9,
haftmann@26444
   324
  Char Nibble9 NibbleA, Char Nibble9 NibbleB, Char Nibble9 NibbleC,
haftmann@26444
   325
  Char Nibble9 NibbleD, Char Nibble9 NibbleE, Char Nibble9 NibbleF,
haftmann@26444
   326
  Char NibbleA Nibble0, Char NibbleA Nibble1, Char NibbleA Nibble2,
haftmann@26444
   327
  Char NibbleA Nibble3, Char NibbleA Nibble4, Char NibbleA Nibble5,
haftmann@26444
   328
  Char NibbleA Nibble6, Char NibbleA Nibble7, Char NibbleA Nibble8,
haftmann@26444
   329
  Char NibbleA Nibble9, Char NibbleA NibbleA, Char NibbleA NibbleB,
haftmann@26444
   330
  Char NibbleA NibbleC, Char NibbleA NibbleD, Char NibbleA NibbleE,
haftmann@26444
   331
  Char NibbleA NibbleF, Char NibbleB Nibble0, Char NibbleB Nibble1,
haftmann@26444
   332
  Char NibbleB Nibble2, Char NibbleB Nibble3, Char NibbleB Nibble4,
haftmann@26444
   333
  Char NibbleB Nibble5, Char NibbleB Nibble6, Char NibbleB Nibble7,
haftmann@26444
   334
  Char NibbleB Nibble8, Char NibbleB Nibble9, Char NibbleB NibbleA,
haftmann@26444
   335
  Char NibbleB NibbleB, Char NibbleB NibbleC, Char NibbleB NibbleD,
haftmann@26444
   336
  Char NibbleB NibbleE, Char NibbleB NibbleF, Char NibbleC Nibble0,
haftmann@26444
   337
  Char NibbleC Nibble1, Char NibbleC Nibble2, Char NibbleC Nibble3,
haftmann@26444
   338
  Char NibbleC Nibble4, Char NibbleC Nibble5, Char NibbleC Nibble6,
haftmann@26444
   339
  Char NibbleC Nibble7, Char NibbleC Nibble8, Char NibbleC Nibble9,
haftmann@26444
   340
  Char NibbleC NibbleA, Char NibbleC NibbleB, Char NibbleC NibbleC,
haftmann@26444
   341
  Char NibbleC NibbleD, Char NibbleC NibbleE, Char NibbleC NibbleF,
haftmann@26444
   342
  Char NibbleD Nibble0, Char NibbleD Nibble1, Char NibbleD Nibble2,
haftmann@26444
   343
  Char NibbleD Nibble3, Char NibbleD Nibble4, Char NibbleD Nibble5,
haftmann@26444
   344
  Char NibbleD Nibble6, Char NibbleD Nibble7, Char NibbleD Nibble8,
haftmann@26444
   345
  Char NibbleD Nibble9, Char NibbleD NibbleA, Char NibbleD NibbleB,
haftmann@26444
   346
  Char NibbleD NibbleC, Char NibbleD NibbleD, Char NibbleD NibbleE,
haftmann@26444
   347
  Char NibbleD NibbleF, Char NibbleE Nibble0, Char NibbleE Nibble1,
haftmann@26444
   348
  Char NibbleE Nibble2, Char NibbleE Nibble3, Char NibbleE Nibble4,
haftmann@26444
   349
  Char NibbleE Nibble5, Char NibbleE Nibble6, Char NibbleE Nibble7,
haftmann@26444
   350
  Char NibbleE Nibble8, Char NibbleE Nibble9, Char NibbleE NibbleA,
haftmann@26444
   351
  Char NibbleE NibbleB, Char NibbleE NibbleC, Char NibbleE NibbleD,
haftmann@26444
   352
  Char NibbleE NibbleE, Char NibbleE NibbleF, Char NibbleF Nibble0,
haftmann@26444
   353
  Char NibbleF Nibble1, Char NibbleF Nibble2, Char NibbleF Nibble3,
haftmann@26444
   354
  Char NibbleF Nibble4, Char NibbleF Nibble5, Char NibbleF Nibble6,
haftmann@26444
   355
  Char NibbleF Nibble7, Char NibbleF Nibble8, Char NibbleF Nibble9,
haftmann@26444
   356
  Char NibbleF NibbleA, Char NibbleF NibbleB, Char NibbleF NibbleC,
haftmann@26444
   357
  Char NibbleF NibbleD, Char NibbleF NibbleE, Char NibbleF NibbleF]"
haftmann@26444
   358
  unfolding enum_char_def enum_nibble_def by simp
haftmann@26348
   359
haftmann@26348
   360
instance by default
haftmann@26444
   361
  (auto intro: char.exhaust injI simp add: enum_char_def product_list_set enum_all full_SetCompr_eq [symmetric]
haftmann@26444
   362
    distinct_map distinct_product enum_distinct)
haftmann@26348
   363
haftmann@26348
   364
end
haftmann@26348
   365
haftmann@26348
   366
end