equal
deleted
inserted
replaced
65 "map f dxs = Dlist (remdups (List.map f (list_of_dlist dxs)))" |
65 "map f dxs = Dlist (remdups (List.map f (list_of_dlist dxs)))" |
66 |
66 |
67 qualified definition filter :: "('a \<Rightarrow> bool) \<Rightarrow> 'a dlist \<Rightarrow> 'a dlist" where |
67 qualified definition filter :: "('a \<Rightarrow> bool) \<Rightarrow> 'a dlist \<Rightarrow> 'a dlist" where |
68 "filter P dxs = Dlist (List.filter P (list_of_dlist dxs))" |
68 "filter P dxs = Dlist (List.filter P (list_of_dlist dxs))" |
69 |
69 |
|
70 qualified definition rotate :: "nat \<Rightarrow> 'a dlist \<Rightarrow> 'a dlist" where |
|
71 "rotate n dxs = Dlist (List.rotate n (list_of_dlist dxs))" |
|
72 |
70 end |
73 end |
71 |
74 |
72 |
75 |
73 text \<open>Derived operations:\<close> |
76 text \<open>Derived operations:\<close> |
74 |
77 |
112 by (simp add: Dlist.map_def) |
115 by (simp add: Dlist.map_def) |
113 |
116 |
114 lemma list_of_dlist_filter [simp, code abstract]: |
117 lemma list_of_dlist_filter [simp, code abstract]: |
115 "list_of_dlist (Dlist.filter P dxs) = List.filter P (list_of_dlist dxs)" |
118 "list_of_dlist (Dlist.filter P dxs) = List.filter P (list_of_dlist dxs)" |
116 by (simp add: Dlist.filter_def) |
119 by (simp add: Dlist.filter_def) |
|
120 |
|
121 lemma list_of_dlist_rotate [simp, code abstract]: |
|
122 "list_of_dlist (Dlist.rotate n dxs) = List.rotate n (list_of_dlist dxs)" |
|
123 by (simp add: Dlist.rotate_def) |
117 |
124 |
118 |
125 |
119 text \<open>Explicit executable conversion\<close> |
126 text \<open>Explicit executable conversion\<close> |
120 |
127 |
121 definition dlist_of_list [simp]: |
128 definition dlist_of_list [simp]: |