merged
authornipkow
Tue Jun 12 19:37:47 2018 +0200 (11 months ago)
changeset 684326f3bd27ba389
parent 68430 b0eb6a91924d
parent 68431 b294e095f64c
child 68433 f396f5490a8c
merged
     1.1 --- a/src/HOL/Data_Structures/AA_Map.thy	Tue Jun 12 19:32:42 2018 +0200
     1.2 +++ b/src/HOL/Data_Structures/AA_Map.thy	Tue Jun 12 19:37:47 2018 +0200
     1.3 @@ -207,10 +207,10 @@
     1.4                post_split_max post_delete split_maxD split: prod.splits)
     1.5  
     1.6  interpretation I: Map_by_Ordered
     1.7 -where empty = Leaf and lookup = lookup and update = update and delete = delete
     1.8 +where empty = empty and lookup = lookup and update = update and delete = delete
     1.9  and inorder = inorder and inv = invar
    1.10  proof (standard, goal_cases)
    1.11 -  case 1 show ?case by simp
    1.12 +  case 1 show ?case by (simp add: empty_def)
    1.13  next
    1.14    case 2 thus ?case by(simp add: lookup_map_of)
    1.15  next
    1.16 @@ -218,7 +218,7 @@
    1.17  next
    1.18    case 4 thus ?case by(simp add: inorder_delete)
    1.19  next
    1.20 -  case 5 thus ?case by(simp)
    1.21 +  case 5 thus ?case by(simp add: empty_def)
    1.22  next
    1.23    case 6 thus ?case by(simp add: invar_update)
    1.24  next
     2.1 --- a/src/HOL/Data_Structures/AA_Set.thy	Tue Jun 12 19:32:42 2018 +0200
     2.2 +++ b/src/HOL/Data_Structures/AA_Set.thy	Tue Jun 12 19:37:47 2018 +0200
     2.3 @@ -12,6 +12,9 @@
     2.4  
     2.5  type_synonym 'a aa_tree = "('a,nat) tree"
     2.6  
     2.7 +definition empty :: "'a aa_tree" where
     2.8 +"empty = Leaf"
     2.9 +
    2.10  fun lvl :: "'a aa_tree \<Rightarrow> nat" where
    2.11  "lvl Leaf = 0" |
    2.12  "lvl (Node _ _ lv _) = lv"
    2.13 @@ -483,10 +486,10 @@
    2.14                post_split_max post_delete split_maxD split: prod.splits)
    2.15  
    2.16  interpretation I: Set_by_Ordered
    2.17 -where empty = Leaf and isin = isin and insert = insert and delete = delete
    2.18 +where empty = empty and isin = isin and insert = insert and delete = delete
    2.19  and inorder = inorder and inv = invar
    2.20  proof (standard, goal_cases)
    2.21 -  case 1 show ?case by simp
    2.22 +  case 1 show ?case by (simp add: empty_def)
    2.23  next
    2.24    case 2 thus ?case by(simp add: isin_set_inorder)
    2.25  next
    2.26 @@ -494,7 +497,7 @@
    2.27  next
    2.28    case 4 thus ?case by(simp add: inorder_delete)
    2.29  next
    2.30 -  case 5 thus ?case by(simp)
    2.31 +  case 5 thus ?case by(simp add: empty_def)
    2.32  next
    2.33    case 6 thus ?case by(simp add: invar_insert)
    2.34  next
     3.1 --- a/src/HOL/Data_Structures/AVL_Map.thy	Tue Jun 12 19:32:42 2018 +0200
     3.2 +++ b/src/HOL/Data_Structures/AVL_Map.thy	Tue Jun 12 19:37:47 2018 +0200
     3.3 @@ -25,12 +25,12 @@
     3.4  
     3.5  subsection \<open>Functional Correctness\<close>
     3.6  
     3.7 -theorem inorder_update:
     3.8 +theorem inorder_update_avl:
     3.9    "sorted1(inorder t) \<Longrightarrow> inorder(update x y t) = upd_list x y (inorder t)"
    3.10  by (induct t) (auto simp: upd_list_simps inorder_balL inorder_balR)
    3.11  
    3.12  
    3.13 -theorem inorder_delete:
    3.14 +theorem inorder_delete_avl:
    3.15    "sorted1(inorder t) \<Longrightarrow> inorder (delete x t) = del_list x (inorder t)"
    3.16  by(induction t)
    3.17    (auto simp: del_list_simps inorder_balL inorder_balR
    3.18 @@ -181,18 +181,18 @@
    3.19  
    3.20  
    3.21  interpretation Map_by_Ordered
    3.22 -where empty = Leaf and lookup = lookup and update = update and delete = delete
    3.23 +where empty = empty and lookup = lookup and update = update and delete = delete
    3.24  and inorder = inorder and inv = avl
    3.25  proof (standard, goal_cases)
    3.26 -  case 1 show ?case by simp
    3.27 +  case 1 show ?case by (simp add: empty_def)
    3.28  next
    3.29    case 2 thus ?case by(simp add: lookup_map_of)
    3.30  next
    3.31 -  case 3 thus ?case by(simp add: inorder_update)
    3.32 +  case 3 thus ?case by(simp add: inorder_update_avl)
    3.33  next
    3.34 -  case 4 thus ?case by(simp add: inorder_delete)
    3.35 +  case 4 thus ?case by(simp add: inorder_delete_avl)
    3.36  next
    3.37 -  case 5 show ?case by simp
    3.38 +  case 5 show ?case by (simp add: empty_def)
    3.39  next
    3.40    case 6 thus ?case by(simp add: avl_update(1))
    3.41  next
     4.1 --- a/src/HOL/Data_Structures/AVL_Set.thy	Tue Jun 12 19:32:42 2018 +0200
     4.2 +++ b/src/HOL/Data_Structures/AVL_Set.thy	Tue Jun 12 19:37:47 2018 +0200
     4.3 @@ -14,6 +14,9 @@
     4.4  
     4.5  type_synonym 'a avl_tree = "('a,nat) tree"
     4.6  
     4.7 +definition empty :: "'a avl_tree" where
     4.8 +"empty = Leaf"
     4.9 +
    4.10  text \<open>Invariant:\<close>
    4.11  
    4.12  fun avl :: "'a avl_tree \<Rightarrow> bool" where
    4.13 @@ -421,10 +424,10 @@
    4.14  subsection "Overall correctness"
    4.15  
    4.16  interpretation Set_by_Ordered
    4.17 -where empty = Leaf and isin = isin and insert = insert and delete = delete
    4.18 +where empty = empty and isin = isin and insert = insert and delete = delete
    4.19  and inorder = inorder and inv = avl
    4.20  proof (standard, goal_cases)
    4.21 -  case 1 show ?case by simp
    4.22 +  case 1 show ?case by (simp add: empty_def)
    4.23  next
    4.24    case 2 thus ?case by(simp add: isin_set_inorder)
    4.25  next
    4.26 @@ -432,7 +435,7 @@
    4.27  next
    4.28    case 4 thus ?case by(simp add: inorder_delete)
    4.29  next
    4.30 -  case 5 thus ?case by simp
    4.31 +  case 5 thus ?case by (simp add: empty_def)
    4.32  next
    4.33    case 6 thus ?case by (simp add: avl_insert(1))
    4.34  next
     5.1 --- a/src/HOL/Data_Structures/Brother12_Map.thy	Tue Jun 12 19:32:42 2018 +0200
     5.2 +++ b/src/HOL/Data_Structures/Brother12_Map.thy	Tue Jun 12 19:37:47 2018 +0200
     5.3 @@ -192,7 +192,7 @@
     5.4  subsection "Overall correctness"
     5.5  
     5.6  interpretation Map_by_Ordered
     5.7 -where empty = N0 and lookup = lookup and update = update.update
     5.8 +where empty = empty and lookup = lookup and update = update.update
     5.9  and delete = delete.delete and inorder = inorder and inv = "\<lambda>t. \<exists>h. t \<in> B h"
    5.10  proof (standard, goal_cases)
    5.11    case 2 thus ?case by(auto intro!: lookup_map_of)
    5.12 @@ -204,6 +204,6 @@
    5.13    case 6 thus ?case using update.update_type by (metis Un_iff)
    5.14  next
    5.15    case 7 thus ?case using delete.delete_type by blast
    5.16 -qed auto
    5.17 +qed (auto simp: empty_def)
    5.18  
    5.19  end
     6.1 --- a/src/HOL/Data_Structures/Brother12_Set.thy	Tue Jun 12 19:32:42 2018 +0200
     6.2 +++ b/src/HOL/Data_Structures/Brother12_Set.thy	Tue Jun 12 19:37:47 2018 +0200
     6.3 @@ -19,6 +19,9 @@
     6.4    L2 'a |
     6.5    N3 "'a bro" 'a "'a bro" 'a "'a bro"
     6.6  
     6.7 +definition empty :: "'a bro" where
     6.8 +"empty = N0"
     6.9 +
    6.10  fun inorder :: "'a bro \<Rightarrow> 'a list" where
    6.11  "inorder N0 = []" |
    6.12  "inorder (N1 t) = inorder t" |
    6.13 @@ -465,7 +468,7 @@
    6.14  subsection "Overall correctness"
    6.15  
    6.16  interpretation Set_by_Ordered
    6.17 -where empty = N0 and isin = isin and insert = insert.insert
    6.18 +where empty = empty and isin = isin and insert = insert.insert
    6.19  and delete = delete.delete and inorder = inorder and inv = "\<lambda>t. \<exists>h. t \<in> B h"
    6.20  proof (standard, goal_cases)
    6.21    case 2 thus ?case by(auto intro!: isin_set)
    6.22 @@ -477,7 +480,7 @@
    6.23    case 6 thus ?case using insert.insert_type by blast
    6.24  next
    6.25    case 7 thus ?case using delete.delete_type by blast
    6.26 -qed auto
    6.27 +qed (auto simp: empty_def)
    6.28  
    6.29  
    6.30  subsection \<open>Height-Size Relation\<close>
     7.1 --- a/src/HOL/Data_Structures/Map_Specs.thy	Tue Jun 12 19:32:42 2018 +0200
     7.2 +++ b/src/HOL/Data_Structures/Map_Specs.thy	Tue Jun 12 19:37:47 2018 +0200
     7.3 @@ -31,36 +31,41 @@
     7.4  fixes lookup :: "'t \<Rightarrow> 'a \<Rightarrow> 'b option"
     7.5  fixes inorder :: "'t \<Rightarrow> ('a * 'b) list"
     7.6  fixes inv :: "'t \<Rightarrow> bool"
     7.7 -assumes empty: "inorder empty = []"
     7.8 -and lookup: "inv t \<and> sorted1 (inorder t) \<Longrightarrow>
     7.9 +assumes inorder_empty: "inorder empty = []"
    7.10 +and inorder_lookup: "inv t \<and> sorted1 (inorder t) \<Longrightarrow>
    7.11    lookup t a = map_of (inorder t) a"
    7.12 -and update: "inv t \<and> sorted1 (inorder t) \<Longrightarrow>
    7.13 +and inorder_update: "inv t \<and> sorted1 (inorder t) \<Longrightarrow>
    7.14    inorder(update a b t) = upd_list a b (inorder t)"
    7.15 -and delete: "inv t \<and> sorted1 (inorder t) \<Longrightarrow>
    7.16 +and inorder_delete: "inv t \<and> sorted1 (inorder t) \<Longrightarrow>
    7.17    inorder(delete a t) = del_list a (inorder t)"
    7.18 -and inv_empty:  "inv empty"
    7.19 -and inv_update: "inv t \<and> sorted1 (inorder t) \<Longrightarrow> inv(update a b t)"
    7.20 -and inv_delete: "inv t \<and> sorted1 (inorder t) \<Longrightarrow> inv(delete a t)"
    7.21 +and inorder_inv_empty:  "inv empty"
    7.22 +and inorder_inv_update: "inv t \<and> sorted1 (inorder t) \<Longrightarrow> inv(update a b t)"
    7.23 +and inorder_inv_delete: "inv t \<and> sorted1 (inorder t) \<Longrightarrow> inv(delete a t)"
    7.24  begin
    7.25  
    7.26  text \<open>It implements the traditional specification:\<close>
    7.27  
    7.28 +definition invar :: "'t \<Rightarrow> bool" where
    7.29 +"invar t == inv t \<and> sorted1 (inorder t)"
    7.30 +
    7.31  sublocale Map
    7.32 -  empty update delete lookup "\<lambda>t. inv t \<and> sorted1 (inorder t)"
    7.33 +  empty update delete lookup invar
    7.34  proof(standard, goal_cases)
    7.35 -  case 1 show ?case by (auto simp: lookup empty inv_empty)
    7.36 +  case 1 show ?case by (auto simp: inorder_lookup inorder_empty inorder_inv_empty)
    7.37  next
    7.38    case 2 thus ?case
    7.39 -    by(simp add: fun_eq_iff update inv_update map_of_ins_list lookup sorted_upd_list)
    7.40 +    by(simp add: fun_eq_iff inorder_update inorder_inv_update map_of_ins_list inorder_lookup
    7.41 +         sorted_upd_list invar_def)
    7.42  next
    7.43    case 3 thus ?case
    7.44 -    by(simp add: fun_eq_iff delete inv_delete map_of_del_list lookup sorted_del_list)
    7.45 -next
    7.46 -  case 4 thus ?case by(simp add: empty inv_empty)
    7.47 +    by(simp add: fun_eq_iff inorder_delete inorder_inv_delete map_of_del_list inorder_lookup
    7.48 +         sorted_del_list invar_def)
    7.49  next
    7.50 -  case 5 thus ?case by(simp add: update inv_update sorted_upd_list)
    7.51 +  case 4 thus ?case by(simp add: inorder_empty inorder_inv_empty invar_def)
    7.52  next
    7.53 -  case 6 thus ?case by (auto simp: delete inv_delete sorted_del_list)
    7.54 +  case 5 thus ?case by(simp add: inorder_update inorder_inv_update sorted_upd_list invar_def)
    7.55 +next
    7.56 +  case 6 thus ?case by (auto simp: inorder_delete inorder_inv_delete sorted_del_list invar_def)
    7.57  qed
    7.58  
    7.59  end
     8.1 --- a/src/HOL/Data_Structures/RBT_Map.thy	Tue Jun 12 19:32:42 2018 +0200
     8.2 +++ b/src/HOL/Data_Structures/RBT_Map.thy	Tue Jun 12 19:37:47 2018 +0200
     8.3 @@ -42,7 +42,7 @@
     8.4  by(induction x y t rule: upd.induct)
     8.5    (auto simp: upd_list_simps inorder_baliL inorder_baliR)
     8.6  
     8.7 -lemma inorder_update:
     8.8 +lemma inorder_update_rbt:
     8.9    "sorted1(inorder t) \<Longrightarrow> inorder(update x y t) = upd_list x y (inorder t)"
    8.10  by(simp add: update_def inorder_upd inorder_paint)
    8.11  
    8.12 @@ -51,7 +51,7 @@
    8.13  by(induction x t rule: del.induct)
    8.14    (auto simp: del_list_simps inorder_combine inorder_baldL inorder_baldR)
    8.15  
    8.16 -lemma inorder_delete:
    8.17 +lemma inorder_delete_rbt:
    8.18    "sorted1(inorder t) \<Longrightarrow> inorder(delete x t) = del_list x (inorder t)"
    8.19  by(simp add: delete_def inorder_del inorder_paint)
    8.20  
    8.21 @@ -105,18 +105,18 @@
    8.22  by (metis delete_def rbt_def color_paint_Black del_invc_invh invc_paint_Black invc2I invh_paint)
    8.23  
    8.24  interpretation Map_by_Ordered
    8.25 -where empty = Leaf and lookup = lookup and update = update and delete = delete
    8.26 +where empty = empty and lookup = lookup and update = update and delete = delete
    8.27  and inorder = inorder and inv = rbt
    8.28  proof (standard, goal_cases)
    8.29 -  case 1 show ?case by simp
    8.30 +  case 1 show ?case by (simp add: empty_def)
    8.31  next
    8.32    case 2 thus ?case by(simp add: lookup_map_of)
    8.33  next
    8.34 -  case 3 thus ?case by(simp add: inorder_update)
    8.35 +  case 3 thus ?case by(simp add: inorder_update_rbt)
    8.36  next
    8.37 -  case 4 thus ?case by(simp add: inorder_delete)
    8.38 +  case 4 thus ?case by(simp add: inorder_delete_rbt)
    8.39  next
    8.40 -  case 5 thus ?case by (simp add: rbt_Leaf) 
    8.41 +  case 5 thus ?case by (simp add: rbt_def empty_def) 
    8.42  next
    8.43    case 6 thus ?case by (simp add: rbt_update) 
    8.44  next
     9.1 --- a/src/HOL/Data_Structures/RBT_Set.thy	Tue Jun 12 19:32:42 2018 +0200
     9.2 +++ b/src/HOL/Data_Structures/RBT_Set.thy	Tue Jun 12 19:37:47 2018 +0200
     9.3 @@ -10,6 +10,9 @@
     9.4    Isin2
     9.5  begin
     9.6  
     9.7 +definition empty :: "'a rbt" where
     9.8 +"empty = Leaf"
     9.9 +
    9.10  fun ins :: "'a::linorder \<Rightarrow> 'a rbt \<Rightarrow> 'a rbt" where
    9.11  "ins x Leaf = R Leaf x Leaf" |
    9.12  "ins x (B l a r) =
    9.13 @@ -121,9 +124,6 @@
    9.14  lemma color_paint_Black: "color (paint Black t) = Black"
    9.15  by (cases t) auto
    9.16  
    9.17 -theorem rbt_Leaf: "rbt Leaf"
    9.18 -by (simp add: rbt_def)
    9.19 -
    9.20  lemma paint_invc2: "invc2 t \<Longrightarrow> invc2 (paint c t)"
    9.21  by (cases t) auto
    9.22  
    9.23 @@ -257,10 +257,10 @@
    9.24  text \<open>Overall correctness:\<close>
    9.25  
    9.26  interpretation Set_by_Ordered
    9.27 -where empty = Leaf and isin = isin and insert = insert and delete = delete
    9.28 +where empty = empty and isin = isin and insert = insert and delete = delete
    9.29  and inorder = inorder and inv = rbt
    9.30  proof (standard, goal_cases)
    9.31 -  case 1 show ?case by simp
    9.32 +  case 1 show ?case by (simp add: empty_def)
    9.33  next
    9.34    case 2 thus ?case by(simp add: isin_set_inorder)
    9.35  next
    9.36 @@ -268,7 +268,7 @@
    9.37  next
    9.38    case 4 thus ?case by(simp add: inorder_delete)
    9.39  next
    9.40 -  case 5 thus ?case by (simp add: rbt_Leaf) 
    9.41 +  case 5 thus ?case by (simp add: rbt_def empty_def) 
    9.42  next
    9.43    case 6 thus ?case by (simp add: rbt_insert) 
    9.44  next
    10.1 --- a/src/HOL/Data_Structures/Tree234_Map.thy	Tue Jun 12 19:32:42 2018 +0200
    10.2 +++ b/src/HOL/Data_Structures/Tree234_Map.thy	Tue Jun 12 19:37:47 2018 +0200
    10.3 @@ -123,7 +123,7 @@
    10.4  by(induction t)
    10.5    (auto simp: upd_list_simps, auto simp: upd_list_simps split: up\<^sub>i.splits)
    10.6  
    10.7 -lemma inorder_update:
    10.8 +lemma inorder_update_234:
    10.9    "sorted1(inorder t) \<Longrightarrow> inorder(update a b t) = upd_list a b (inorder t)"
   10.10  by(simp add: update_def inorder_upd)
   10.11  
   10.12 @@ -133,7 +133,7 @@
   10.13    (auto simp: del_list_simps inorder_nodes split_minD split!: if_splits prod.splits)
   10.14  (* 30 secs (2016) *)
   10.15  
   10.16 -lemma inorder_delete: "\<lbrakk> bal t ; sorted1(inorder t) \<rbrakk> \<Longrightarrow>
   10.17 +lemma inorder_delete_234: "\<lbrakk> bal t ; sorted1(inorder t) \<rbrakk> \<Longrightarrow>
   10.18    inorder(delete x t) = del_list x (inorder t)"
   10.19  by(simp add: delete_def inorder_del)
   10.20  
   10.21 @@ -161,18 +161,18 @@
   10.22  subsection \<open>Overall Correctness\<close>
   10.23  
   10.24  interpretation Map_by_Ordered
   10.25 -where empty = Leaf and lookup = lookup and update = update and delete = delete
   10.26 +where empty = empty and lookup = lookup and update = update and delete = delete
   10.27  and inorder = inorder and inv = bal
   10.28  proof (standard, goal_cases)
   10.29    case 2 thus ?case by(simp add: lookup_map_of)
   10.30  next
   10.31 -  case 3 thus ?case by(simp add: inorder_update)
   10.32 +  case 3 thus ?case by(simp add: inorder_update_234)
   10.33  next
   10.34 -  case 4 thus ?case by(simp add: inorder_delete)
   10.35 +  case 4 thus ?case by(simp add: inorder_delete_234)
   10.36  next
   10.37    case 6 thus ?case by(simp add: bal_update)
   10.38  next
   10.39    case 7 thus ?case by(simp add: bal_delete)
   10.40 -qed simp+
   10.41 +qed (simp add: empty_def)+
   10.42  
   10.43  end
    11.1 --- a/src/HOL/Data_Structures/Tree234_Set.thy	Tue Jun 12 19:32:42 2018 +0200
    11.2 +++ b/src/HOL/Data_Structures/Tree234_Set.thy	Tue Jun 12 19:37:47 2018 +0200
    11.3 @@ -13,6 +13,9 @@
    11.4  
    11.5  subsection \<open>Set operations on 2-3-4 trees\<close>
    11.6  
    11.7 +definition empty :: "'a tree234" where
    11.8 +"empty = Leaf"
    11.9 +
   11.10  fun isin :: "'a::linorder tree234 \<Rightarrow> 'a \<Rightarrow> bool" where
   11.11  "isin Leaf x = False" |
   11.12  "isin (Node2 l a r) x =
   11.13 @@ -502,7 +505,7 @@
   11.14  subsection \<open>Overall Correctness\<close>
   11.15  
   11.16  interpretation Set_by_Ordered
   11.17 -where empty = Leaf and isin = isin and insert = insert and delete = delete
   11.18 +where empty = empty and isin = isin and insert = insert and delete = delete
   11.19  and inorder = inorder and inv = bal
   11.20  proof (standard, goal_cases)
   11.21    case 2 thus ?case by(simp add: isin_set)
   11.22 @@ -514,6 +517,6 @@
   11.23    case 6 thus ?case by(simp add: bal_insert)
   11.24  next
   11.25    case 7 thus ?case by(simp add: bal_delete)
   11.26 -qed simp+
   11.27 +qed (simp add: empty_def)+
   11.28  
   11.29  end
    12.1 --- a/src/HOL/Data_Structures/Tree23_Map.thy	Tue Jun 12 19:32:42 2018 +0200
    12.2 +++ b/src/HOL/Data_Structures/Tree23_Map.thy	Tue Jun 12 19:37:47 2018 +0200
    12.3 @@ -81,7 +81,7 @@
    12.4    "sorted1(inorder t) \<Longrightarrow> inorder(tree\<^sub>i(upd x y t)) = upd_list x y (inorder t)"
    12.5  by(induction t) (auto simp: upd_list_simps split: up\<^sub>i.splits)
    12.6  
    12.7 -corollary inorder_update:
    12.8 +corollary inorder_update_23:
    12.9    "sorted1(inorder t) \<Longrightarrow> inorder(update x y t) = upd_list x y (inorder t)"
   12.10  by(simp add: update_def inorder_upd)
   12.11  
   12.12 @@ -91,7 +91,7 @@
   12.13  by(induction t rule: del.induct)
   12.14    (auto simp: del_list_simps inorder_nodes split_minD split!: if_split prod.splits)
   12.15  
   12.16 -corollary inorder_delete: "\<lbrakk> bal t ; sorted1(inorder t) \<rbrakk> \<Longrightarrow>
   12.17 +corollary inorder_delete_23: "\<lbrakk> bal t ; sorted1(inorder t) \<rbrakk> \<Longrightarrow>
   12.18    inorder(delete x t) = del_list x (inorder t)"
   12.19  by(simp add: delete_def inorder_del)
   12.20  
   12.21 @@ -120,18 +120,22 @@
   12.22  subsection \<open>Overall Correctness\<close>
   12.23  
   12.24  interpretation Map_by_Ordered
   12.25 -where empty = Leaf and lookup = lookup and update = update and delete = delete
   12.26 +where empty = empty and lookup = lookup and update = update and delete = delete
   12.27  and inorder = inorder and inv = bal
   12.28  proof (standard, goal_cases)
   12.29 +  case 1 thus ?case by(simp add: empty_def)
   12.30 +next
   12.31    case 2 thus ?case by(simp add: lookup_map_of)
   12.32  next
   12.33 -  case 3 thus ?case by(simp add: inorder_update)
   12.34 +  case 3 thus ?case by(simp add: inorder_update_23)
   12.35  next
   12.36 -  case 4 thus ?case by(simp add: inorder_delete)
   12.37 +  case 4 thus ?case by(simp add: inorder_delete_23)
   12.38 +next
   12.39 +  case 5 thus ?case by(simp add: empty_def)
   12.40  next
   12.41    case 6 thus ?case by(simp add: bal_update)
   12.42  next
   12.43    case 7 thus ?case by(simp add: bal_delete)
   12.44 -qed simp+
   12.45 +qed
   12.46  
   12.47  end
    13.1 --- a/src/HOL/Data_Structures/Tree23_Set.thy	Tue Jun 12 19:32:42 2018 +0200
    13.2 +++ b/src/HOL/Data_Structures/Tree23_Set.thy	Tue Jun 12 19:37:47 2018 +0200
    13.3 @@ -11,6 +11,9 @@
    13.4  
    13.5  declare sorted_wrt.simps(2)[simp del]
    13.6  
    13.7 +definition empty :: "'a tree23" where
    13.8 +"empty = Leaf"
    13.9 +
   13.10  fun isin :: "'a::linorder tree23 \<Rightarrow> 'a \<Rightarrow> bool" where
   13.11  "isin Leaf x = False" |
   13.12  "isin (Node2 l a r) x =
   13.13 @@ -377,7 +380,7 @@
   13.14  subsection \<open>Overall Correctness\<close>
   13.15  
   13.16  interpretation Set_by_Ordered
   13.17 -where empty = Leaf and isin = isin and insert = insert and delete = delete
   13.18 +where empty = empty and isin = isin and insert = insert and delete = delete
   13.19  and inorder = inorder and inv = bal
   13.20  proof (standard, goal_cases)
   13.21    case 2 thus ?case by(simp add: isin_set)
   13.22 @@ -389,6 +392,6 @@
   13.23    case 6 thus ?case by(simp add: bal_insert)
   13.24  next
   13.25    case 7 thus ?case by(simp add: bal_delete)
   13.26 -qed simp+
   13.27 +qed (simp add: empty_def)+
   13.28  
   13.29  end
    14.1 --- a/src/HOL/Data_Structures/Tree_Map.thy	Tue Jun 12 19:32:42 2018 +0200
    14.2 +++ b/src/HOL/Data_Structures/Tree_Map.thy	Tue Jun 12 19:37:47 2018 +0200
    14.3 @@ -34,25 +34,25 @@
    14.4    "sorted1(inorder t) \<Longrightarrow> lookup t x = map_of (inorder t) x"
    14.5  by (induction t) (auto simp: map_of_simps split: option.split)
    14.6  
    14.7 -lemma inorder_update:
    14.8 +lemma inorder_update_tree:
    14.9    "sorted1(inorder t) \<Longrightarrow> inorder(update a b t) = upd_list a b (inorder t)"
   14.10  by(induction t) (auto simp: upd_list_simps)
   14.11  
   14.12 -lemma inorder_delete:
   14.13 +lemma inorder_delete_tree:
   14.14    "sorted1(inorder t) \<Longrightarrow> inorder(delete x t) = del_list x (inorder t)"
   14.15  by(induction t) (auto simp: del_list_simps split_minD split: prod.splits)
   14.16  
   14.17  interpretation Map_by_Ordered
   14.18 -where empty = Leaf and lookup = lookup and update = update and delete = delete
   14.19 +where empty = empty and lookup = lookup and update = update and delete = delete
   14.20  and inorder = inorder and inv = "\<lambda>_. True"
   14.21  proof (standard, goal_cases)
   14.22 -  case 1 show ?case by simp
   14.23 +  case 1 show ?case by (simp add: empty_def)
   14.24  next
   14.25    case 2 thus ?case by(simp add: lookup_map_of)
   14.26  next
   14.27 -  case 3 thus ?case by(simp add: inorder_update)
   14.28 +  case 3 thus ?case by(simp add: inorder_update_tree)
   14.29  next
   14.30 -  case 4 thus ?case by(simp add: inorder_delete)
   14.31 +  case 4 thus ?case by(simp add: inorder_delete_tree)
   14.32  qed auto
   14.33  
   14.34  end
    15.1 --- a/src/HOL/Data_Structures/Tree_Set.thy	Tue Jun 12 19:32:42 2018 +0200
    15.2 +++ b/src/HOL/Data_Structures/Tree_Set.thy	Tue Jun 12 19:37:47 2018 +0200
    15.3 @@ -9,6 +9,9 @@
    15.4    Set_Specs
    15.5  begin
    15.6  
    15.7 +definition empty :: "'a tree" where
    15.8 +"empty == Leaf"
    15.9 +
   15.10  fun isin :: "'a::linorder tree \<Rightarrow> 'a \<Rightarrow> bool" where
   15.11  "isin Leaf x = False" |
   15.12  "isin (Node l a r) x =
   15.13 @@ -60,10 +63,10 @@
   15.14  by(induction t) (auto simp: del_list_simps split_minD split: prod.splits)
   15.15  
   15.16  interpretation Set_by_Ordered
   15.17 -where empty = Leaf and isin = isin and insert = insert and delete = delete
   15.18 +where empty = empty and isin = isin and insert = insert and delete = delete
   15.19  and inorder = inorder and inv = "\<lambda>_. True"
   15.20  proof (standard, goal_cases)
   15.21 -  case 1 show ?case by simp
   15.22 +  case 1 show ?case by (simp add: empty_def)
   15.23  next
   15.24    case 2 thus ?case by(simp add: isin_set)
   15.25  next