added tree lemmas
authornipkow
Fri, 18 Mar 2016 10:14:56 +0100
changeset 62650 7e6bb43e7217
parent 62649 d23be25c0835
child 62651 66568c9b8216
added tree lemmas
src/HOL/Data_Structures/Tree2.thy
src/HOL/Library/Tree.thy
--- a/src/HOL/Data_Structures/Tree2.thy	Fri Mar 18 08:32:37 2016 +0100
+++ b/src/HOL/Data_Structures/Tree2.thy	Fri Mar 18 10:14:56 2016 +0100
@@ -14,4 +14,15 @@
 "height Leaf = 0" |
 "height (Node _ l a r) = max (height l) (height r) + 1"
 
+definition size1 :: "('a,'b) tree \<Rightarrow> nat" where
+"size1 t = size t + 1"
+
+lemma size1_simps[simp]:
+  "size1 \<langle>\<rangle> = 1"
+  "size1 \<langle>u, l, x, r\<rangle> = size1 l + size1 r"
+by (simp_all add: size1_def)
+
+lemma size1_ge0[simp]: "0 < size1 t"
+by (simp add: size1_def)
+
 end
--- a/src/HOL/Library/Tree.thy	Fri Mar 18 08:32:37 2016 +0100
+++ b/src/HOL/Library/Tree.thy	Fri Mar 18 10:14:56 2016 +0100
@@ -24,6 +24,9 @@
   "size1 \<langle>l, x, r\<rangle> = size1 l + size1 r"
 by (simp_all add: size1_def)
 
+lemma size1_ge0[simp]: "0 < size1 t"
+by (simp add: size1_def)
+
 lemma size_0_iff_Leaf: "size t = 0 \<longleftrightarrow> t = Leaf"
 by(cases t) auto