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