@@ -276,7 +276,7 @@ lemma dropWhile_sorted_le_above:
276276 apply ( rename_tac a xs )
277277 apply ( case_tac "a \<le> n" )
278278 apply ( auto )
279- done
279+ done
280280
281281lemma set_dropWhile_le :
282282 "sorted xs \<Longrightarrow> set (dropWhile (\<lambda> x. x \<le> n) xs) = {x\<in>set xs. x > n}"
@@ -287,7 +287,7 @@ lemma set_dropWhile_le:
287287 apply ( simp )
288288 apply ( safe )
289289 apply ( auto )
290- done
290+ done
291291
292292lemma set_takeWhile_less_sorted :
293293 "\<lbrakk> sorted I; x \<in> set I; x < n \<rbrakk> \<Longrightarrow> x \<in> set (takeWhile (\<lambda>x. x < n) I)"
477477lemma list_prefix_iff :
478478 "(prefix xs ys \<longleftrightarrow> (length xs \<le> length ys \<and> (\<forall> i<length xs. xs!i = ys!i)))"
479479 apply ( auto )
480- apply ( simp add : prefix_imp_length_lteq )
481- apply ( metis nth_append prefix_def )
480+ apply ( simp add : prefix_imp_length_lteq )
481+ apply ( metis nth_append prefix_def )
482482 apply ( metis nth_take_lemma order_refl take_all take_is_prefix )
483483 done
484484
@@ -949,12 +949,15 @@ lemma nths_list_update_out: "k \<notin> A \<Longrightarrow> nths (list_update xs
949949lemma nths_list_augment_out : "\<lbrakk> k < length xs; k \<notin> A \<rbrakk> \<Longrightarrow> nths (list_augment xs k x) A = nths xs A"
950950 by ( simp add : list_augment_as_update nths_list_update_out )
951951
952- lemma nths_none : "\<forall>i \<in> I. i \<ge> length xs \<Longrightarrow> nths xs I = []"
953- apply ( simp add : nths_def )
954- apply ( subst filter_False )
955- apply ( metis atLeastLessThan_iff in_set_zip leD nth_mem set_upt )
956- apply simp
957- done
952+ lemma nths_none :
953+ assumes "\<forall>i \<in> I. i \<ge> length xs"
954+ shows "nths xs I = []"
955+ proof -
956+ from assms have "\<forall>x\<in>set (zip xs [0..<length xs]). snd x \<notin> I"
957+ by ( metis atLeastLessThan_iff in_set_zip leD nth_mem set_upt )
958+ thus ?thesis
959+ by ( simp add : nths_def )
960+ qed
958961
959962lemma nths_uptoLessThan :
960963 "\<lbrakk> m \<le> n; n < length xs \<rbrakk> \<Longrightarrow> nths xs {m..n} = xs ! m # nths xs {Suc m..n}"
@@ -1176,7 +1179,7 @@ where "xs <\<^sub>l ys \<longleftrightarrow> (xs, ys) \<in> lexord {(u, v). u <
11761179lemma list_lex_less_neq [ simp ]: "x <\<^sub>l y \<Longrightarrow> x \<noteq> y"
11771180 apply ( simp add : list_lex_less_def )
11781181 apply ( meson case_prodD less_irrefl lexord_irreflexive mem_Collect_eq )
1179- done
1182+ done
11801183
11811184lemma not_less_Nil [ simp ]: "\<not> x <\<^sub>l []"
11821185 by ( simp add : list_lex_less_def )
@@ -1259,15 +1262,15 @@ qed
12591262
12601263lemma distinct_b_lists : "distinct xs \<Longrightarrow> distinct (b_lists n xs)"
12611264 apply ( cases "xs = []" )
1262- apply ( simp )
1265+ apply ( simp )
12631266 apply ( auto simp add : b_lists_def )
12641267 apply ( rule distinct_concat )
1265- apply ( simp add : distinct_map )
1266- apply ( simp add : inj_onI n_lists_inj )
1268+ apply ( simp add : distinct_map )
1269+ apply ( simp add : inj_onI n_lists_inj )
12671270 using distinct_n_lists apply auto [ 1 ]
1268- apply ( auto )
1271+ apply ( auto )
12691272 using length_n_lists_elem apply blast
1270- apply ( simp add : distinct_n_lists )
1273+ apply ( simp add : distinct_n_lists )
12711274 using length_n_lists_elem apply blast
12721275 done
12731276
@@ -1294,20 +1297,20 @@ lemma list_disjoint_Nil [simp]: "list_disjoint []"
12941297lemma list_disjoint_Cons [ simp ]: "list_disjoint (A # Bs) = ((\<forall> B \<in> set Bs. A \<inter> B = {}) \<and> list_disjoint Bs)"
12951298 apply ( simp add : list_disjoint_def disjoint_iff )
12961299 apply ( auto )
1297- apply ( metis Suc_less_eq in_set_conv_nth nat.distinct ( 1 ) neq0_conv nth_Cons_0 nth_Cons_Suc )
1300+ apply ( metis Suc_less_eq in_set_conv_nth nat.distinct ( 1 ) neq0_conv nth_Cons_0 nth_Cons_Suc )
12981301 apply ( metis lessI lift_Suc_mono_less_iff nat.inject nth_Cons_Suc )
12991302 apply ( rename_tac i j x )
13001303 apply ( case_tac i )
1301- apply ( simp_all )
1304+ apply ( simp_all )
13021305 apply ( metis less_Suc_eq_0_disj list.sel ( 3 ) nth_Cons' nth_mem nth_tl )
13031306 done
13041307
13051308subsection \<open> Code Generation \<close>
13061309
13071310lemma set_singleton_iff : "set xs = {x} \<longleftrightarrow> remdups xs = [x]"
13081311 apply ( auto )
1309- apply ( metis card_set empty_set insert_not_empty length_0_conv length_Suc_conv list.simps ( 15 ) remdups.simps ( 1 ) remdups.simps ( 2 ) set_remdups the_elem_set )
1310- apply ( metis empty_iff empty_set set_ConsD set_remdups )
1312+ apply ( metis card_set empty_set insert_not_empty length_0_conv length_Suc_conv list.simps ( 15 ) remdups.simps ( 1 ) remdups.simps ( 2 ) set_remdups the_elem_set )
1313+ apply ( metis empty_iff empty_set set_ConsD set_remdups )
13111314 apply ( metis list.set_intros ( 1 ) set_remdups )
13121315 done
13131316
0 commit comments