# HG changeset patch # User nipkow # Date 1607704182 -3600 # Node ID 4e6dc2868d5f1cf2c0b10b73861ff58d3e7d5d14 # Parent a7fa680d82774eae30750bea7ee7a628b0817574 tuned diff -r a7fa680d8277 -r 4e6dc2868d5f src/HOL/Data_Structures/Set2_Join.thy --- a/src/HOL/Data_Structures/Set2_Join.thy Wed Dec 09 23:30:12 2020 +0100 +++ b/src/HOL/Data_Structures/Set2_Join.thy Fri Dec 11 17:29:42 2020 +0100 @@ -88,17 +88,17 @@ GT \ let (r1,b,r2) = split r x in (join l a r1, b, r2) | EQ \ (l, True, r))" -lemma split: "split t x = (l,xin,r) \ bst t \ +lemma split: "split t x = (l,b,r) \ bst t \ set_tree l = {a \ set_tree t. a < x} \ set_tree r = {a \ set_tree t. x < a} - \ (xin = (x \ set_tree t)) \ bst l \ bst r" -proof(induction t arbitrary: l xin r rule: tree2_induct) + \ (b = (x \ set_tree t)) \ bst l \ bst r" +proof(induction t arbitrary: l b r rule: tree2_induct) case Leaf thus ?case by simp next case Node thus ?case by(force split!: prod.splits if_splits intro!: bst_join) qed -lemma split_inv: "split t x = (l,xin,r) \ inv t \ inv l \ inv r" -proof(induction t arbitrary: l xin r rule: tree2_induct) +lemma split_inv: "split t x = (l,b,r) \ inv t \ inv l \ inv r" +proof(induction t arbitrary: l b r rule: tree2_induct) case Leaf thus ?case by simp next case Node @@ -181,9 +181,9 @@ (if t1 = Leaf then Leaf else if t2 = Leaf then Leaf else case t1 of Node l1 (a, _) r1 \ - let (l2,ain,r2) = split t2 a; + let (l2,b,r2) = split t2 a; l' = inter l1 l2; r' = inter r1 r2 - in if ain then join l' a r' else join2 l' r')" + in if b then join l' a r' else join2 l' r')" declare inter.simps [simp del] @@ -203,8 +203,8 @@ case False let ?L1 = "set_tree l1" let ?R1 = "set_tree r1" have *: "a \ ?L1 \ ?R1" using \bst t1\ by (fastforce) - obtain l2 ain r2 where sp: "split t2 a = (l2,ain,r2)" using prod_cases3 by blast - let ?L2 = "set_tree l2" let ?R2 = "set_tree r2" let ?A = "if ain then {a} else {}" + obtain l2 b r2 where sp: "split t2 a = (l2,b,r2)" using prod_cases3 by blast + let ?L2 = "set_tree l2" let ?R2 = "set_tree r2" let ?A = "if b then {a} else {}" have t2: "set_tree t2 = ?L2 \ ?R2 \ ?A" and **: "?L2 \ ?R2 = {}" "a \ ?L2 \ ?R2" "?L1 \ ?R2 = {}" "?L2 \ ?R1 = {}" using split[OF sp] \bst t1\ \bst t2\ by (force, force, force, force, force) @@ -267,8 +267,8 @@ next case False let ?L2 = "set_tree l2" let ?R2 = "set_tree r2" - obtain l1 ain r1 where sp: "split t1 a = (l1,ain,r1)" using prod_cases3 by blast - let ?L1 = "set_tree l1" let ?R1 = "set_tree r1" let ?A = "if ain then {a} else {}" + obtain l1 b r1 where sp: "split t1 a = (l1,b,r1)" using prod_cases3 by blast + let ?L1 = "set_tree l1" let ?R1 = "set_tree r1" let ?A = "if b then {a} else {}" have t1: "set_tree t1 = ?L1 \ ?R1 \ ?A" and **: "a \ ?L1 \ ?R1" "?L1 \ ?R2 = {}" "?L2 \ ?R1 = {}" using split[OF sp] \bst t1\ \bst t2\ by (force, force, force, force)