# HG changeset patch # User nipkow # Date 1605181457 -3600 # Node ID e3ba2578ad9dd69a8865b5bfe9e0cae143a18603 # Parent 4ea19e5dc67e591c7f310baac8643d24c298434d tuned diff -r 4ea19e5dc67e -r e3ba2578ad9d src/HOL/Data_Structures/Interval_Tree.thy --- a/src/HOL/Data_Structures/Interval_Tree.thy Thu Oct 22 15:18:08 2020 +0200 +++ b/src/HOL/Data_Structures/Interval_Tree.thy Thu Nov 12 12:44:17 2020 +0100 @@ -78,7 +78,7 @@ fun inv_max_hi :: "('a::{linorder,order_bot}) ivl_tree \ bool" where "inv_max_hi Leaf \ True" | -"inv_max_hi (Node l (a, m) r) \ (inv_max_hi l \ inv_max_hi r \ m = max3 a (max_hi l) (max_hi r))" +"inv_max_hi (Node l (a, m) r) \ (m = max3 a (max_hi l) (max_hi r) \ inv_max_hi l \ inv_max_hi r)" lemma max_hi_is_max: "inv_max_hi t \ a \ set_tree t \ high a \ max_hi t" diff -r 4ea19e5dc67e -r e3ba2578ad9d src/HOL/Data_Structures/RBT_Set.thy --- a/src/HOL/Data_Structures/RBT_Set.thy Thu Oct 22 15:18:08 2020 +0200 +++ b/src/HOL/Data_Structures/RBT_Set.thy Thu Nov 12 12:44:17 2020 +0100 @@ -108,7 +108,7 @@ fun invc :: "'a rbt \ bool" where "invc Leaf = True" | "invc (Node l (a,c) r) = - (invc l \ invc r \ (c = Red \ color l = Black \ color r = Black))" + ((c = Red \ color l = Black \ color r = Black) \ invc l \ invc r)" text \Weaker version:\ abbreviation invc2 :: "'a rbt \ bool" where @@ -116,7 +116,7 @@ fun invh :: "'a rbt \ bool" where "invh Leaf = True" | -"invh (Node l (x, c) r) = (invh l \ invh r \ bheight l = bheight r)" +"invh (Node l (x, c) r) = (bheight l = bheight r \ invh l \ invh r)" lemma invc2I: "invc t \ invc2 t" by (cases t rule: tree2_cases) simp+ diff -r 4ea19e5dc67e -r e3ba2578ad9d src/HOL/Data_Structures/Tree2.thy --- a/src/HOL/Data_Structures/Tree2.thy Thu Oct 22 15:18:08 2020 +0200 +++ b/src/HOL/Data_Structures/Tree2.thy Thu Nov 12 12:44:17 2020 +0100 @@ -21,11 +21,11 @@ fun set_tree :: "('a*'b) tree \ 'a set" where "set_tree Leaf = {}" | -"set_tree (Node l (a,_) r) = Set.insert a (set_tree l \ set_tree r)" +"set_tree (Node l (a,_) r) = {a} \ set_tree l \ set_tree r" fun bst :: "('a::linorder*'b) tree \ bool" where "bst Leaf = True" | -"bst (Node l (a, _) r) = (bst l \ bst r \ (\x \ set_tree l. x < a) \ (\x \ set_tree r. a < x))" +"bst (Node l (a, _) r) = ((\x \ set_tree l. x < a) \ (\x \ set_tree r. a < x) \ bst l \ bst r)" lemma finite_set_tree[simp]: "finite(set_tree t)" by(induction t) auto diff -r 4ea19e5dc67e -r e3ba2578ad9d src/HOL/Data_Structures/Tree23.thy --- a/src/HOL/Data_Structures/Tree23.thy Thu Oct 22 15:18:08 2020 +0200 +++ b/src/HOL/Data_Structures/Tree23.thy Thu Nov 12 12:44:17 2020 +0100 @@ -36,9 +36,9 @@ fun complete :: "'a tree23 \ bool" where "complete Leaf = True" | -"complete (Node2 l _ r) = (complete l & complete r & height l = height r)" | +"complete (Node2 l _ r) = (height l = height r \ complete l & complete r)" | "complete (Node3 l _ m _ r) = - (complete l & complete m & complete r & height l = height m & height m = height r)" + (height l = height m & height m = height r & complete l & complete m & complete r)" lemma ht_sz_if_complete: "complete t \ 2 ^ height t \ size t + 1" by (induction t) auto diff -r 4ea19e5dc67e -r e3ba2578ad9d src/HOL/Library/Tree.thy --- a/src/HOL/Library/Tree.thy Thu Oct 22 15:18:08 2020 +0200 +++ b/src/HOL/Library/Tree.thy Thu Nov 12 12:44:17 2020 +0100 @@ -28,7 +28,7 @@ fun subtrees :: "'a tree \ 'a tree set" where "subtrees \\ = {\\}" | -"subtrees (\l, a, r\) = insert \l, a, r\ (subtrees l \ subtrees r)" +"subtrees (\l, a, r\) = {\l, a, r\} \ subtrees l \ subtrees r" fun mirror :: "'a tree \ 'a tree" where "mirror \\ = Leaf" | @@ -53,7 +53,7 @@ fun complete :: "'a tree \ bool" where "complete Leaf = True" | -"complete (Node l x r) = (complete l \ complete r \ height l = height r)" +"complete (Node l x r) = (height l = height r \ complete l \ complete r)" text \Almost complete:\ definition acomplete :: "'a tree \ bool" where @@ -90,7 +90,7 @@ fun bst_wrt :: "('a \ 'a \ bool) \ 'a tree \ bool" where "bst_wrt P \\ \ True" | "bst_wrt P \l, a, r\ \ - bst_wrt P l \ bst_wrt P r \ (\x\set_tree l. P x a) \ (\x\set_tree r. P a x)" + (\x\set_tree l. P x a) \ (\x\set_tree r. P a x) \ bst_wrt P l \ bst_wrt P r" abbreviation bst :: "('a::linorder) tree \ bool" where "bst \ bst_wrt (<)" @@ -98,7 +98,7 @@ fun (in linorder) heap :: "'a tree \ bool" where "heap Leaf = True" | "heap (Node l m r) = - (heap l \ heap r \ (\x \ set_tree l \ set_tree r. m \ x))" + ((\x \ set_tree l \ set_tree r. m \ x) \ heap l \ heap r)" subsection \\<^const>\map_tree\\