src/HOL/Library/DAList.thy
author bulwahn
Wed, 28 Mar 2012 10:02:22 +0200
changeset 47178 2ae2b6fa9c84
parent 47143 212f7a975d49
child 47308 9caab698dbe4
permissions -rw-r--r--
removing now redundant impl_of theorems in DAList
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
46237
99c80c2f841a renamed theory AList to DAList
bulwahn
parents: 46171
diff changeset
     1
(*  Title:      HOL/Library/DAList.thy
46167
25eba8a5d7d0 adding theory association lists with invariant
bulwahn
parents:
diff changeset
     2
    Author:     Lukas Bulwahn, TU Muenchen *)
25eba8a5d7d0 adding theory association lists with invariant
bulwahn
parents:
diff changeset
     3
25eba8a5d7d0 adding theory association lists with invariant
bulwahn
parents:
diff changeset
     4
header {* Abstract type of association lists with unique keys *}
25eba8a5d7d0 adding theory association lists with invariant
bulwahn
parents:
diff changeset
     5
46237
99c80c2f841a renamed theory AList to DAList
bulwahn
parents: 46171
diff changeset
     6
theory DAList
46238
9ace9e5b79be renaming theory AList_Impl back to AList (reverting 1fec5b365f9b; AList with distinct key invariant is called DAList)
bulwahn
parents: 46237
diff changeset
     7
imports AList
46167
25eba8a5d7d0 adding theory association lists with invariant
bulwahn
parents:
diff changeset
     8
begin
25eba8a5d7d0 adding theory association lists with invariant
bulwahn
parents:
diff changeset
     9
25eba8a5d7d0 adding theory association lists with invariant
bulwahn
parents:
diff changeset
    10
text {* This was based on some existing fragments in the AFP-Collection framework. *}
25eba8a5d7d0 adding theory association lists with invariant
bulwahn
parents:
diff changeset
    11
47143
212f7a975d49 association lists with distinct keys uses the quotient infrastructure to obtain code certificates;
bulwahn
parents: 46507
diff changeset
    12
subsection {* Preliminaries *}
212f7a975d49 association lists with distinct keys uses the quotient infrastructure to obtain code certificates;
bulwahn
parents: 46507
diff changeset
    13
212f7a975d49 association lists with distinct keys uses the quotient infrastructure to obtain code certificates;
bulwahn
parents: 46507
diff changeset
    14
lemma distinct_map_fst_filter:
212f7a975d49 association lists with distinct keys uses the quotient infrastructure to obtain code certificates;
bulwahn
parents: 46507
diff changeset
    15
   "distinct (map fst xs) ==> distinct (map fst (List.filter P xs))"
212f7a975d49 association lists with distinct keys uses the quotient infrastructure to obtain code certificates;
bulwahn
parents: 46507
diff changeset
    16
by (induct xs) auto
212f7a975d49 association lists with distinct keys uses the quotient infrastructure to obtain code certificates;
bulwahn
parents: 46507
diff changeset
    17
46167
25eba8a5d7d0 adding theory association lists with invariant
bulwahn
parents:
diff changeset
    18
subsection {* Type @{text "('key, 'value) alist" } *}
25eba8a5d7d0 adding theory association lists with invariant
bulwahn
parents:
diff changeset
    19
47143
212f7a975d49 association lists with distinct keys uses the quotient infrastructure to obtain code certificates;
bulwahn
parents: 46507
diff changeset
    20
typedef (open) ('key, 'value) alist = "{xs :: ('key \<times> 'value) list. (distinct o map fst) xs}"
46507
1b24c24017dd tuned proofs;
wenzelm
parents: 46238
diff changeset
    21
  morphisms impl_of Alist
1b24c24017dd tuned proofs;
wenzelm
parents: 46238
diff changeset
    22
proof
47143
212f7a975d49 association lists with distinct keys uses the quotient infrastructure to obtain code certificates;
bulwahn
parents: 46507
diff changeset
    23
  show "[] \<in> {xs. (distinct o map fst) xs}" by simp
46507
1b24c24017dd tuned proofs;
wenzelm
parents: 46238
diff changeset
    24
qed
46167
25eba8a5d7d0 adding theory association lists with invariant
bulwahn
parents:
diff changeset
    25
47143
212f7a975d49 association lists with distinct keys uses the quotient infrastructure to obtain code certificates;
bulwahn
parents: 46507
diff changeset
    26
setup_lifting type_definition_alist
212f7a975d49 association lists with distinct keys uses the quotient infrastructure to obtain code certificates;
bulwahn
parents: 46507
diff changeset
    27
46167
25eba8a5d7d0 adding theory association lists with invariant
bulwahn
parents:
diff changeset
    28
lemma alist_ext: "impl_of xs = impl_of ys \<Longrightarrow> xs = ys"
25eba8a5d7d0 adding theory association lists with invariant
bulwahn
parents:
diff changeset
    29
by(simp add: impl_of_inject)
25eba8a5d7d0 adding theory association lists with invariant
bulwahn
parents:
diff changeset
    30
25eba8a5d7d0 adding theory association lists with invariant
bulwahn
parents:
diff changeset
    31
lemma alist_eq_iff: "xs = ys \<longleftrightarrow> impl_of xs = impl_of ys"
25eba8a5d7d0 adding theory association lists with invariant
bulwahn
parents:
diff changeset
    32
by(simp add: impl_of_inject)
25eba8a5d7d0 adding theory association lists with invariant
bulwahn
parents:
diff changeset
    33
25eba8a5d7d0 adding theory association lists with invariant
bulwahn
parents:
diff changeset
    34
lemma impl_of_distinct [simp, intro]: "distinct (map fst (impl_of xs))"
25eba8a5d7d0 adding theory association lists with invariant
bulwahn
parents:
diff changeset
    35
using impl_of[of xs] by simp
25eba8a5d7d0 adding theory association lists with invariant
bulwahn
parents:
diff changeset
    36
25eba8a5d7d0 adding theory association lists with invariant
bulwahn
parents:
diff changeset
    37
lemma Alist_impl_of [code abstype]: "Alist (impl_of xs) = xs"
25eba8a5d7d0 adding theory association lists with invariant
bulwahn
parents:
diff changeset
    38
by(rule impl_of_inverse)
25eba8a5d7d0 adding theory association lists with invariant
bulwahn
parents:
diff changeset
    39
25eba8a5d7d0 adding theory association lists with invariant
bulwahn
parents:
diff changeset
    40
subsection {* Primitive operations *}
25eba8a5d7d0 adding theory association lists with invariant
bulwahn
parents:
diff changeset
    41
47143
212f7a975d49 association lists with distinct keys uses the quotient infrastructure to obtain code certificates;
bulwahn
parents: 46507
diff changeset
    42
(* FIXME: improve quotient_definition so that type annotations on the right hand sides can be removed *) 
212f7a975d49 association lists with distinct keys uses the quotient infrastructure to obtain code certificates;
bulwahn
parents: 46507
diff changeset
    43
212f7a975d49 association lists with distinct keys uses the quotient infrastructure to obtain code certificates;
bulwahn
parents: 46507
diff changeset
    44
quotient_definition lookup :: "('key, 'value) alist \<Rightarrow> 'key \<Rightarrow> 'value option"
212f7a975d49 association lists with distinct keys uses the quotient infrastructure to obtain code certificates;
bulwahn
parents: 46507
diff changeset
    45
where "lookup" is "map_of :: ('key * 'value) list \<Rightarrow> 'key \<Rightarrow> 'value option" ..
46167
25eba8a5d7d0 adding theory association lists with invariant
bulwahn
parents:
diff changeset
    46
47143
212f7a975d49 association lists with distinct keys uses the quotient infrastructure to obtain code certificates;
bulwahn
parents: 46507
diff changeset
    47
quotient_definition empty :: "('key, 'value) alist"
212f7a975d49 association lists with distinct keys uses the quotient infrastructure to obtain code certificates;
bulwahn
parents: 46507
diff changeset
    48
where "empty" is "[] :: ('key * 'value) list" by simp
46167
25eba8a5d7d0 adding theory association lists with invariant
bulwahn
parents:
diff changeset
    49
47143
212f7a975d49 association lists with distinct keys uses the quotient infrastructure to obtain code certificates;
bulwahn
parents: 46507
diff changeset
    50
quotient_definition update :: "'key \<Rightarrow> 'value \<Rightarrow> ('key, 'value) alist \<Rightarrow> ('key, 'value) alist"
212f7a975d49 association lists with distinct keys uses the quotient infrastructure to obtain code certificates;
bulwahn
parents: 46507
diff changeset
    51
where "update" is "AList.update :: 'key \<Rightarrow> 'value \<Rightarrow> ('key * 'value) list \<Rightarrow> ('key * 'value) list"
212f7a975d49 association lists with distinct keys uses the quotient infrastructure to obtain code certificates;
bulwahn
parents: 46507
diff changeset
    52
by (simp add: distinct_update)
46167
25eba8a5d7d0 adding theory association lists with invariant
bulwahn
parents:
diff changeset
    53
25eba8a5d7d0 adding theory association lists with invariant
bulwahn
parents:
diff changeset
    54
(* FIXME: we use an unoptimised delete operation. *)
47143
212f7a975d49 association lists with distinct keys uses the quotient infrastructure to obtain code certificates;
bulwahn
parents: 46507
diff changeset
    55
quotient_definition delete :: "'key \<Rightarrow> ('key, 'value) alist \<Rightarrow> ('key, 'value) alist"
212f7a975d49 association lists with distinct keys uses the quotient infrastructure to obtain code certificates;
bulwahn
parents: 46507
diff changeset
    56
where "delete" is "AList.delete :: 'key \<Rightarrow> ('key * 'value) list \<Rightarrow> ('key * 'value) list"
212f7a975d49 association lists with distinct keys uses the quotient infrastructure to obtain code certificates;
bulwahn
parents: 46507
diff changeset
    57
by (simp add: distinct_delete)
46167
25eba8a5d7d0 adding theory association lists with invariant
bulwahn
parents:
diff changeset
    58
47143
212f7a975d49 association lists with distinct keys uses the quotient infrastructure to obtain code certificates;
bulwahn
parents: 46507
diff changeset
    59
quotient_definition map_entry :: "'key \<Rightarrow> ('value \<Rightarrow> 'value) \<Rightarrow> ('key, 'value) alist \<Rightarrow> ('key, 'value) alist"
212f7a975d49 association lists with distinct keys uses the quotient infrastructure to obtain code certificates;
bulwahn
parents: 46507
diff changeset
    60
where "map_entry" is "AList.map_entry :: 'key \<Rightarrow> ('value \<Rightarrow> 'value) \<Rightarrow> ('key * 'value) list \<Rightarrow> ('key * 'value) list"
212f7a975d49 association lists with distinct keys uses the quotient infrastructure to obtain code certificates;
bulwahn
parents: 46507
diff changeset
    61
by (simp add: distinct_map_entry)
46167
25eba8a5d7d0 adding theory association lists with invariant
bulwahn
parents:
diff changeset
    62
47143
212f7a975d49 association lists with distinct keys uses the quotient infrastructure to obtain code certificates;
bulwahn
parents: 46507
diff changeset
    63
quotient_definition filter :: "('key \<times> 'value \<Rightarrow> bool) \<Rightarrow> ('key, 'value) alist \<Rightarrow> ('key, 'value) alist"
212f7a975d49 association lists with distinct keys uses the quotient infrastructure to obtain code certificates;
bulwahn
parents: 46507
diff changeset
    64
where "filter" is "List.filter :: ('key \<times> 'value \<Rightarrow> bool) \<Rightarrow> ('key * 'value) list \<Rightarrow> ('key * 'value) list"
212f7a975d49 association lists with distinct keys uses the quotient infrastructure to obtain code certificates;
bulwahn
parents: 46507
diff changeset
    65
by (simp add: distinct_map_fst_filter)
46167
25eba8a5d7d0 adding theory association lists with invariant
bulwahn
parents:
diff changeset
    66
47143
212f7a975d49 association lists with distinct keys uses the quotient infrastructure to obtain code certificates;
bulwahn
parents: 46507
diff changeset
    67
quotient_definition map_default :: "'key => 'value => ('value => 'value) => ('key, 'value) alist => ('key, 'value) alist"
212f7a975d49 association lists with distinct keys uses the quotient infrastructure to obtain code certificates;
bulwahn
parents: 46507
diff changeset
    68
where "map_default" is "AList.map_default :: 'key => 'value => ('value => 'value) => ('key * 'value) list => ('key * 'value) list"
212f7a975d49 association lists with distinct keys uses the quotient infrastructure to obtain code certificates;
bulwahn
parents: 46507
diff changeset
    69
by (simp add: distinct_map_default)
46167
25eba8a5d7d0 adding theory association lists with invariant
bulwahn
parents:
diff changeset
    70
25eba8a5d7d0 adding theory association lists with invariant
bulwahn
parents:
diff changeset
    71
subsection {* Abstract operation properties *}
25eba8a5d7d0 adding theory association lists with invariant
bulwahn
parents:
diff changeset
    72
25eba8a5d7d0 adding theory association lists with invariant
bulwahn
parents:
diff changeset
    73
(* FIXME: to be completed *)
25eba8a5d7d0 adding theory association lists with invariant
bulwahn
parents:
diff changeset
    74
25eba8a5d7d0 adding theory association lists with invariant
bulwahn
parents:
diff changeset
    75
lemma lookup_empty [simp]: "lookup empty k = None"
25eba8a5d7d0 adding theory association lists with invariant
bulwahn
parents:
diff changeset
    76
by(simp add: empty_def lookup_def Alist_inverse)
25eba8a5d7d0 adding theory association lists with invariant
bulwahn
parents:
diff changeset
    77
25eba8a5d7d0 adding theory association lists with invariant
bulwahn
parents:
diff changeset
    78
lemma lookup_delete [simp]: "lookup (delete k al) = (lookup al)(k := None)"
25eba8a5d7d0 adding theory association lists with invariant
bulwahn
parents:
diff changeset
    79
by (simp add: lookup_def delete_def Alist_inverse distinct_delete delete_conv')
25eba8a5d7d0 adding theory association lists with invariant
bulwahn
parents:
diff changeset
    80
25eba8a5d7d0 adding theory association lists with invariant
bulwahn
parents:
diff changeset
    81
subsection {* Further operations *}
25eba8a5d7d0 adding theory association lists with invariant
bulwahn
parents:
diff changeset
    82
25eba8a5d7d0 adding theory association lists with invariant
bulwahn
parents:
diff changeset
    83
subsubsection {* Equality *}
25eba8a5d7d0 adding theory association lists with invariant
bulwahn
parents:
diff changeset
    84
25eba8a5d7d0 adding theory association lists with invariant
bulwahn
parents:
diff changeset
    85
instantiation alist :: (equal, equal) equal begin
25eba8a5d7d0 adding theory association lists with invariant
bulwahn
parents:
diff changeset
    86
25eba8a5d7d0 adding theory association lists with invariant
bulwahn
parents:
diff changeset
    87
definition "HOL.equal (xs :: ('a, 'b) alist) ys == impl_of xs = impl_of ys"
25eba8a5d7d0 adding theory association lists with invariant
bulwahn
parents:
diff changeset
    88
25eba8a5d7d0 adding theory association lists with invariant
bulwahn
parents:
diff changeset
    89
instance
25eba8a5d7d0 adding theory association lists with invariant
bulwahn
parents:
diff changeset
    90
proof
25eba8a5d7d0 adding theory association lists with invariant
bulwahn
parents:
diff changeset
    91
qed (simp add: equal_alist_def impl_of_inject)
25eba8a5d7d0 adding theory association lists with invariant
bulwahn
parents:
diff changeset
    92
25eba8a5d7d0 adding theory association lists with invariant
bulwahn
parents:
diff changeset
    93
end
25eba8a5d7d0 adding theory association lists with invariant
bulwahn
parents:
diff changeset
    94
25eba8a5d7d0 adding theory association lists with invariant
bulwahn
parents:
diff changeset
    95
subsubsection {* Size *}
25eba8a5d7d0 adding theory association lists with invariant
bulwahn
parents:
diff changeset
    96
25eba8a5d7d0 adding theory association lists with invariant
bulwahn
parents:
diff changeset
    97
instantiation alist :: (type, type) size begin
25eba8a5d7d0 adding theory association lists with invariant
bulwahn
parents:
diff changeset
    98
25eba8a5d7d0 adding theory association lists with invariant
bulwahn
parents:
diff changeset
    99
definition "size (al :: ('a, 'b) alist) = length (impl_of al)"
25eba8a5d7d0 adding theory association lists with invariant
bulwahn
parents:
diff changeset
   100
25eba8a5d7d0 adding theory association lists with invariant
bulwahn
parents:
diff changeset
   101
instance ..
25eba8a5d7d0 adding theory association lists with invariant
bulwahn
parents:
diff changeset
   102
25eba8a5d7d0 adding theory association lists with invariant
bulwahn
parents:
diff changeset
   103
end
25eba8a5d7d0 adding theory association lists with invariant
bulwahn
parents:
diff changeset
   104
25eba8a5d7d0 adding theory association lists with invariant
bulwahn
parents:
diff changeset
   105
subsection {* Quickcheck generators *}
25eba8a5d7d0 adding theory association lists with invariant
bulwahn
parents:
diff changeset
   106
25eba8a5d7d0 adding theory association lists with invariant
bulwahn
parents:
diff changeset
   107
notation fcomp (infixl "\<circ>>" 60)
25eba8a5d7d0 adding theory association lists with invariant
bulwahn
parents:
diff changeset
   108
notation scomp (infixl "\<circ>\<rightarrow>" 60)
25eba8a5d7d0 adding theory association lists with invariant
bulwahn
parents:
diff changeset
   109
25eba8a5d7d0 adding theory association lists with invariant
bulwahn
parents:
diff changeset
   110
definition (in term_syntax)
25eba8a5d7d0 adding theory association lists with invariant
bulwahn
parents:
diff changeset
   111
  valterm_empty :: "('key :: typerep, 'value :: typerep) alist \<times> (unit \<Rightarrow> Code_Evaluation.term)"
25eba8a5d7d0 adding theory association lists with invariant
bulwahn
parents:
diff changeset
   112
where
25eba8a5d7d0 adding theory association lists with invariant
bulwahn
parents:
diff changeset
   113
  "valterm_empty = Code_Evaluation.valtermify empty"
25eba8a5d7d0 adding theory association lists with invariant
bulwahn
parents:
diff changeset
   114
25eba8a5d7d0 adding theory association lists with invariant
bulwahn
parents:
diff changeset
   115
definition (in term_syntax)
25eba8a5d7d0 adding theory association lists with invariant
bulwahn
parents:
diff changeset
   116
  valterm_update :: "'key :: typerep \<times> (unit \<Rightarrow> Code_Evaluation.term) \<Rightarrow>
25eba8a5d7d0 adding theory association lists with invariant
bulwahn
parents:
diff changeset
   117
  'value :: typerep \<times> (unit \<Rightarrow> Code_Evaluation.term) \<Rightarrow>
25eba8a5d7d0 adding theory association lists with invariant
bulwahn
parents:
diff changeset
   118
  ('key, 'value) alist \<times> (unit \<Rightarrow> Code_Evaluation.term) \<Rightarrow>
25eba8a5d7d0 adding theory association lists with invariant
bulwahn
parents:
diff changeset
   119
  ('key, 'value) alist \<times> (unit \<Rightarrow> Code_Evaluation.term)" where
25eba8a5d7d0 adding theory association lists with invariant
bulwahn
parents:
diff changeset
   120
  [code_unfold]: "valterm_update k v a = Code_Evaluation.valtermify update {\<cdot>} k {\<cdot>} v {\<cdot>}a"
25eba8a5d7d0 adding theory association lists with invariant
bulwahn
parents:
diff changeset
   121
25eba8a5d7d0 adding theory association lists with invariant
bulwahn
parents:
diff changeset
   122
fun (in term_syntax) random_aux_alist 
25eba8a5d7d0 adding theory association lists with invariant
bulwahn
parents:
diff changeset
   123
where
25eba8a5d7d0 adding theory association lists with invariant
bulwahn
parents:
diff changeset
   124
  "random_aux_alist i j = (if i = 0 then Pair valterm_empty else Quickcheck.collapse (Random.select_weight [(i, Quickcheck.random j \<circ>\<rightarrow> (%k. Quickcheck.random j \<circ>\<rightarrow> (%v. random_aux_alist (i - 1) j \<circ>\<rightarrow> (%a. Pair (valterm_update k v a))))), (1, Pair valterm_empty)]))"
25eba8a5d7d0 adding theory association lists with invariant
bulwahn
parents:
diff changeset
   125
25eba8a5d7d0 adding theory association lists with invariant
bulwahn
parents:
diff changeset
   126
instantiation alist :: (random, random) random
25eba8a5d7d0 adding theory association lists with invariant
bulwahn
parents:
diff changeset
   127
begin
25eba8a5d7d0 adding theory association lists with invariant
bulwahn
parents:
diff changeset
   128
25eba8a5d7d0 adding theory association lists with invariant
bulwahn
parents:
diff changeset
   129
definition random_alist
25eba8a5d7d0 adding theory association lists with invariant
bulwahn
parents:
diff changeset
   130
where
25eba8a5d7d0 adding theory association lists with invariant
bulwahn
parents:
diff changeset
   131
  "random_alist i = random_aux_alist i i"
25eba8a5d7d0 adding theory association lists with invariant
bulwahn
parents:
diff changeset
   132
 
25eba8a5d7d0 adding theory association lists with invariant
bulwahn
parents:
diff changeset
   133
instance ..
25eba8a5d7d0 adding theory association lists with invariant
bulwahn
parents:
diff changeset
   134
25eba8a5d7d0 adding theory association lists with invariant
bulwahn
parents:
diff changeset
   135
end
25eba8a5d7d0 adding theory association lists with invariant
bulwahn
parents:
diff changeset
   136
25eba8a5d7d0 adding theory association lists with invariant
bulwahn
parents:
diff changeset
   137
no_notation fcomp (infixl "\<circ>>" 60)
25eba8a5d7d0 adding theory association lists with invariant
bulwahn
parents:
diff changeset
   138
no_notation scomp (infixl "\<circ>\<rightarrow>" 60)
25eba8a5d7d0 adding theory association lists with invariant
bulwahn
parents:
diff changeset
   139
25eba8a5d7d0 adding theory association lists with invariant
bulwahn
parents:
diff changeset
   140
instantiation alist :: (exhaustive, exhaustive) exhaustive
25eba8a5d7d0 adding theory association lists with invariant
bulwahn
parents:
diff changeset
   141
begin
25eba8a5d7d0 adding theory association lists with invariant
bulwahn
parents:
diff changeset
   142
25eba8a5d7d0 adding theory association lists with invariant
bulwahn
parents:
diff changeset
   143
fun exhaustive_alist :: "(('a, 'b) alist => (bool * term list) option) => code_numeral => (bool * term list) option"
25eba8a5d7d0 adding theory association lists with invariant
bulwahn
parents:
diff changeset
   144
where
25eba8a5d7d0 adding theory association lists with invariant
bulwahn
parents:
diff changeset
   145
  "exhaustive_alist f i = (if i = 0 then None else case f empty of Some ts => Some ts | None =>
25eba8a5d7d0 adding theory association lists with invariant
bulwahn
parents:
diff changeset
   146
     exhaustive_alist (%a. Quickcheck_Exhaustive.exhaustive (%k. Quickcheck_Exhaustive.exhaustive (%v. f (update k v a)) (i - 1)) (i - 1)) (i - 1))"
25eba8a5d7d0 adding theory association lists with invariant
bulwahn
parents:
diff changeset
   147
25eba8a5d7d0 adding theory association lists with invariant
bulwahn
parents:
diff changeset
   148
instance ..
25eba8a5d7d0 adding theory association lists with invariant
bulwahn
parents:
diff changeset
   149
25eba8a5d7d0 adding theory association lists with invariant
bulwahn
parents:
diff changeset
   150
end
25eba8a5d7d0 adding theory association lists with invariant
bulwahn
parents:
diff changeset
   151
25eba8a5d7d0 adding theory association lists with invariant
bulwahn
parents:
diff changeset
   152
instantiation alist :: (full_exhaustive, full_exhaustive) full_exhaustive
25eba8a5d7d0 adding theory association lists with invariant
bulwahn
parents:
diff changeset
   153
begin
25eba8a5d7d0 adding theory association lists with invariant
bulwahn
parents:
diff changeset
   154
25eba8a5d7d0 adding theory association lists with invariant
bulwahn
parents:
diff changeset
   155
fun full_exhaustive_alist :: "(('a, 'b) alist * (unit => term) => (bool * term list) option) => code_numeral => (bool * term list) option"
25eba8a5d7d0 adding theory association lists with invariant
bulwahn
parents:
diff changeset
   156
where
25eba8a5d7d0 adding theory association lists with invariant
bulwahn
parents:
diff changeset
   157
  "full_exhaustive_alist f i = (if i = 0 then None else case f valterm_empty of Some ts => Some ts | None =>
25eba8a5d7d0 adding theory association lists with invariant
bulwahn
parents:
diff changeset
   158
     full_exhaustive_alist (%a. Quickcheck_Exhaustive.full_exhaustive (%k. Quickcheck_Exhaustive.full_exhaustive (%v. f (valterm_update k v a)) (i - 1)) (i - 1)) (i - 1))"
25eba8a5d7d0 adding theory association lists with invariant
bulwahn
parents:
diff changeset
   159
25eba8a5d7d0 adding theory association lists with invariant
bulwahn
parents:
diff changeset
   160
instance ..
25eba8a5d7d0 adding theory association lists with invariant
bulwahn
parents:
diff changeset
   161
25eba8a5d7d0 adding theory association lists with invariant
bulwahn
parents:
diff changeset
   162
end
25eba8a5d7d0 adding theory association lists with invariant
bulwahn
parents:
diff changeset
   163
25eba8a5d7d0 adding theory association lists with invariant
bulwahn
parents:
diff changeset
   164
hide_const valterm_empty valterm_update random_aux_alist
25eba8a5d7d0 adding theory association lists with invariant
bulwahn
parents:
diff changeset
   165
46171
19f68d7671f0 proper hiding of facts and constants in AList_Impl and AList theory
bulwahn
parents: 46167
diff changeset
   166
hide_fact (open) lookup_def empty_def update_def delete_def map_entry_def filter_def map_default_def
46167
25eba8a5d7d0 adding theory association lists with invariant
bulwahn
parents:
diff changeset
   167
hide_const (open) impl_of lookup empty update delete map_entry filter map_default 
25eba8a5d7d0 adding theory association lists with invariant
bulwahn
parents:
diff changeset
   168
46238
9ace9e5b79be renaming theory AList_Impl back to AList (reverting 1fec5b365f9b; AList with distinct key invariant is called DAList)
bulwahn
parents: 46237
diff changeset
   169
end