equal
deleted
inserted
replaced
128 fun T_leaves :: "'a list \<Rightarrow> nat" where |
128 fun T_leaves :: "'a list \<Rightarrow> nat" where |
129 "T_leaves [] = 1" | |
129 "T_leaves [] = 1" | |
130 "T_leaves (a # as) = T_leaves as + 1" |
130 "T_leaves (a # as) = T_leaves as + 1" |
131 |
131 |
132 definition T_tree23_of_list :: "'a list \<Rightarrow> nat" where |
132 definition T_tree23_of_list :: "'a list \<Rightarrow> nat" where |
133 "T_tree23_of_list as = T_leaves as + T_join_all(leaves as) + 1" |
133 "T_tree23_of_list as = T_leaves as + T_join_all(leaves as)" |
134 |
134 |
135 lemma T_join_adj: "not_T ts \<Longrightarrow> T_join_adj ts \<le> len ts div 2" |
135 lemma T_join_adj: "not_T ts \<Longrightarrow> T_join_adj ts \<le> len ts div 2" |
136 by(induction ts rule: T_join_adj.induct) auto |
136 by(induction ts rule: T_join_adj.induct) auto |
137 |
137 |
138 lemma len_ge_1: "len ts \<ge> 1" |
138 lemma len_ge_1: "len ts \<ge> 1" |
160 by(induction as) auto |
160 by(induction as) auto |
161 |
161 |
162 lemma len_leaves: "len(leaves as) = length as + 1" |
162 lemma len_leaves: "len(leaves as) = length as + 1" |
163 by(induction as) auto |
163 by(induction as) auto |
164 |
164 |
165 lemma T_tree23_of_list: "T_tree23_of_list as \<le> 3*(length as) + 4" |
165 lemma T_tree23_of_list: "T_tree23_of_list as \<le> 3*(length as) + 3" |
166 using T_join_all[of "leaves as"] by(simp add: T_tree23_of_list_def T_leaves len_leaves) |
166 using T_join_all[of "leaves as"] by(simp add: T_tree23_of_list_def T_leaves len_leaves) |
167 |
167 |
168 end |
168 end |