Skip to content

Commit 0e956ca

Browse files
committed
Remove a few subst proofs
1 parent e76559e commit 0e956ca

2 files changed

Lines changed: 39 additions & 33 deletions

File tree

List_Extra.thy

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -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

281281
lemma 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

292292
lemma 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)"
@@ -477,8 +477,8 @@ qed
477477
lemma 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
949949
lemma 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

959962
lemma 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 <
11761179
lemma 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

11811184
lemma not_less_Nil [simp]: "\<not> x <\<^sub>l []"
11821185
by (simp add: list_lex_less_def)
@@ -1259,15 +1262,15 @@ qed
12591262

12601263
lemma 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 []"
12941297
lemma 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

13051308
subsection \<open> Code Generation \<close>
13061309

13071310
lemma 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

Partial_Fun.thy

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ lemma pfun_compat_addI: "\<lbrakk> (P :: 'a \<Zpfun> 'b) ## Q; P ## R; Q ## R \<
273273
apply (simp add: compatible_pfun_def oplus_pfun_def)
274274
apply (transfer)
275275
apply (auto simp add: restrict_map_def fun_eq_iff dom_def map_add_def option.case_eq_if)
276-
apply (metis option.inject)+
276+
apply (metis option.inject)+
277277
done
278278

279279
instance proof
@@ -483,7 +483,7 @@ lemma pdom_plus [simp]: "pdom (f \<oplus> g) = pdom f \<union> pdom g"
483483

484484
lemma pdom_minus [simp]: "g \<le> f \<Longrightarrow> pdom (f - g) = pdom f - pdom g"
485485
apply (transfer, auto simp add: map_minus_def)
486-
apply (meson option.distinct(1))
486+
apply (meson option.distinct(1))
487487
apply (metis domIff map_le_def option.simps(3))
488488
done
489489

@@ -943,11 +943,14 @@ text \<open> This rule can perhaps be simplified \<close>
943943
lemma pcomp_pabs:
944944
"(\<lambda> x \<in> A | P x \<bullet> f x) \<circ>\<^sub>p (\<lambda> x \<in> B | Q x \<bullet> g x)
945945
= (\<lambda> x \<in> pdom (pabs B Q g \<rhd>\<^sub>p (A \<inter> Collect P)) \<bullet> (f (g x)))"
946-
apply (subst pabs_eta[THEN sym, of "(\<lambda> x \<in> A | P x \<bullet> f x) \<circ>\<^sub>p (\<lambda> x \<in> B | Q x \<bullet> g x)"])
947-
apply (simp)
948-
apply (simp add: pabs_def)
949-
apply (transfer, auto simp add: restrict_map_def map_comp_def ran_restrict_map_def fun_eq_iff)
950-
done
946+
proof -
947+
have "pabs A P f \<circ>\<^sub>p pabs B Q g = (\<lambda> x \<in> pdom (pabs A P f \<circ>\<^sub>p pabs B Q g) \<bullet> (pfun_app (pabs A P f \<circ>\<^sub>p pabs B Q g)) x)"
948+
by (rule pabs_eta[THEN sym, of "(\<lambda> x \<in> A | P x \<bullet> f x) \<circ>\<^sub>p (\<lambda> x \<in> B | Q x \<bullet> g x)"])
949+
also have "... = (\<lambda> x \<in> pdom (pabs B Q g \<rhd>\<^sub>p (A \<inter> Collect P)) \<bullet> (f (g x)))"
950+
unfolding pabs_def
951+
by (transfer, auto simp add: restrict_map_def map_comp_def ran_restrict_map_def fun_eq_iff)
952+
finally show ?thesis .
953+
qed
951954

952955
lemma pabs_rres [simp]: "pabs A P f \<rhd>\<^sub>p B = pabs A (\<lambda> x. P x \<and> f x \<in> B) f"
953956
by (simp add: pabs_def, transfer, auto simp add: ran_restrict_map_def restrict_map_def)
@@ -981,7 +984,7 @@ definition dest_pfsingle :: "('a \<Zpfun> 'b) \<Rightarrow> 'a \<times> 'b" wher
981984

982985
lemma dest_pfsingle_maplet [simp]: "dest_pfsingle {k \<mapsto> v}\<^sub>p = (k, v)"
983986
apply (auto intro!:the_equality simp add: dest_pfsingle_def)
984-
apply (metis pdom_upd pdom_zero singleton_insert_inj_eq)
987+
apply (metis pdom_upd pdom_zero singleton_insert_inj_eq)
985988
apply (metis pdom_upd pdom_zero pfun_app_upd_1 singleton_insert_inj_eq)
986989
done
987990

@@ -1029,18 +1032,18 @@ lemma pfun_sum_pdom_res:
10291032
proof -
10301033
have 1:"A \<inter> pdom(f) = pdom(f) - (pdom(f) - A)"
10311034
by (auto)
1035+
have 2: "sum (pfun_app f) (pdom f) - sum (pfun_app f) (pdom f - A) =
1036+
sum (pfun_app f) (pdom f) - sum (pfun_app f) (- A \<inter> pdom f)"
1037+
by (auto simp add: sum_diff Int_commute boolean_algebra_class.diff_eq assms)
10321038
show ?thesis
1033-
apply (simp add: pfun_sum_def)
1034-
apply (subst 1)
1035-
apply (subst sum_diff)
1036-
apply (auto simp add: sum_diff Int_commute boolean_algebra_class.diff_eq assms)
1037-
done
1039+
by (simp add: pfun_sum_def 1 2 sum_diff assms)
10381040
qed
10391041

10401042
lemma pfun_sum_pdom_antires [simp]:
10411043
fixes f :: "('a,'b::ab_group_add) pfun"
10421044
assumes "finite(pdom f)"
10431045
shows "pfun_sum ((- A) \<lhd>\<^sub>p f) = pfun_sum f - pfun_sum (A \<lhd>\<^sub>p f)"
1046+
using assms
10441047
by (subst pfun_sum_pdom_res, simp_all add: assms)
10451048

10461049
subsection \<open> Conversions \<close>

0 commit comments

Comments
 (0)