# HG changeset patch # User nipkow # Date 1491026740 -7200 # Node ID 8ec91f7eca37e1d0675f498dc393a55136ad0dce # Parent c4531ddafe7253be146086b57479d72ec7fd1c08 tuned diff -r c4531ddafe72 -r 8ec91f7eca37 src/HOL/Library/Tree.thy --- a/src/HOL/Library/Tree.thy Fri Mar 31 17:21:36 2017 +0200 +++ b/src/HOL/Library/Tree.thy Sat Apr 01 08:05:40 2017 +0200 @@ -95,10 +95,10 @@ subsection \@{const map_tree}\ -lemma map_tree_Leaf[simp]: "map_tree f t = Leaf \ t = Leaf" +lemma eq_map_tree_Leaf[simp]: "map_tree f t = Leaf \ t = Leaf" by (rule tree.map_disc_iff) -lemma Leaf_map_tree[simp]: "Leaf = map_tree f t \ t = Leaf" +lemma eq_Leaf_map_tree[simp]: "Leaf = map_tree f t \ t = Leaf" by (cases t) auto @@ -112,10 +112,10 @@ lemma size1_ge0[simp]: "0 < size1 t" by (simp add: size1_def) -lemma size_0_iff_Leaf[simp]: "size t = 0 \ t = Leaf" +lemma eq_size_0[simp]: "size t = 0 \ t = Leaf" by(cases t) auto -lemma Z_size_iff_Leaf[simp]: "0 = size t \ t = Leaf" +lemma eq_0_size[simp]: "0 = size t \ t = Leaf" by(cases t) auto lemma neq_Leaf_iff: "(t \ \\) = (\l a r. t = \l, a, r\)" @@ -130,10 +130,10 @@ subsection \@{const set_tree}\ -lemma set_tree_empty[simp]: "set_tree t = {} \ t = Leaf" +lemma eq_set_tree_empty[simp]: "set_tree t = {} \ t = Leaf" by (cases t) auto -lemma empty_set_tree[simp]: "{} = set_tree t \ t = Leaf" +lemma eq_empty_set_tree[simp]: "{} = set_tree t \ t = Leaf" by (cases t) auto lemma finite_set_tree[simp]: "finite(set_tree t)" @@ -142,6 +142,12 @@ subsection \@{const subtrees}\ +lemma neq_subtrees_empty[simp]: "subtrees t \ {}" +by (cases t)(auto) + +lemma neq_empty_subtrees[simp]: "{} \ subtrees t" +by (cases t)(auto) + lemma set_treeE: "a \ set_tree t \ \l r. \l, a, r\ \ subtrees t" by (induction t)(auto) @@ -154,10 +160,10 @@ subsection \@{const height} and @{const min_height}\ -lemma height_0_iff_Leaf[simp]: "height t = 0 \ t = Leaf" +lemma eq_height_0[simp]: "height t = 0 \ t = Leaf" by(cases t) auto -lemma Z_height_iff_Leaf[simp]: "0 = height t \ t = Leaf" +lemma eq_0_height[simp]: "0 = height t \ t = Leaf" by(cases t) auto lemma height_map_tree[simp]: "height (map_tree f t) = height t" @@ -226,7 +232,7 @@ lemma complete_if_size1_height: "size1 t = 2 ^ height t \ complete t" proof (induct "height t" arbitrary: t) - case 0 thus ?case by (simp add: height_0_iff_Leaf) + case 0 thus ?case by (simp) next case (Suc h) hence "t \ Leaf" by auto @@ -271,7 +277,7 @@ lemma complete_if_size1_min_height: "size1 t = 2 ^ min_height t \ complete t" proof (induct "min_height t" arbitrary: t) - case 0 thus ?case by (simp add: size_0_iff_Leaf size1_def) + case 0 thus ?case by (simp add: size1_def) next case (Suc h) hence "t \ Leaf" by auto @@ -394,10 +400,10 @@ subsection "List of entries" -lemma inorder_Nil_iff[simp]: "inorder t = [] \ t = Leaf" +lemma eq_inorder_Nil[simp]: "inorder t = [] \ t = Leaf" by (cases t) auto -lemma Nil_inorder_iff[simp]: "[] = inorder t \ t = Leaf" +lemma eq_Nil_inorder[simp]: "[] = inorder t \ t = Leaf" by (cases t) auto lemma set_inorder[simp]: "set (inorder t) = set_tree t"