
diff -r 8798edfc61ef -r 527088d4a89b src/HOL/Finite_Set.thy
--- a/src/HOL/Finite_Set.thy	Tue Aug 31 13:54:31 2021 +0200
+++ b/src/HOL/Finite_Set.thy	Fri Sep 03 18:20:13 2021 +0100
@@ -1601,15 +1601,20 @@
   using assms
   by (cases "finite y") (auto simp: card_insert_if)
 
-lemma card_Diff_singleton: "finite A \<Longrightarrow> x \<in> A \<Longrightarrow> card (A - {x}) = card A - 1"
-  by (simp add: card_Suc_Diff1 [symmetric])
+lemma card_Diff_singleton:
+  assumes "x \<in> A" shows "card (A - {x}) = card A - 1"
+proof (cases "finite A")
+  case True
+  with assms show ?thesis
+    by (simp add: card_Suc_Diff1 [symmetric])
+qed auto
 
 lemma card_Diff_singleton_if:
-  "finite A \<Longrightarrow> card (A - {x}) = (if x \<in> A then card A - 1 else card A)"
+  "card (A - {x}) = (if x \<in> A then card A - 1 else card A)"
   by (simp add: card_Diff_singleton)
 
 lemma card_Diff_insert[simp]:
-  assumes "finite A" and "a \<in> A" and "a \<notin> B"
+  assumes "a \<in> A" and "a \<notin> B"
   shows "card (A - insert a B) = card (A - B) - 1"
 proof -
   have "A - insert a B = (A - B) - {a}"
@@ -1618,8 +1623,11 @@
     using assms by (simp add: card_Diff_singleton)
 qed
 
-lemma card_insert_le: "finite A \<Longrightarrow> card A \<le> card (insert x A)"
-  by (simp add: card_insert_if)
+lemma card_insert_le: "card A \<le> card (insert x A)"
+proof (cases "finite A")
+  case True
+  then show ?thesis   by (simp add: card_insert_if)
+qed auto
 
 lemma card_Collect_less_nat[simp]: "card {i::nat. i < n} = n"
   by (induct n) (simp_all add:less_Suc_eq Collect_disj_eq)
@@ -1775,8 +1783,12 @@
     by (blast intro: less_trans)
 qed
 
-lemma card_Diff1_le: "finite A \<Longrightarrow> card (A - {x}) \<le> card A"
-  by (cases "x \<in> A") (simp_all add: card_Diff1_less less_imp_le)
+lemma card_Diff1_le: "card (A - {x}) \<le> card A"
+proof (cases "finite A")
+  case True
+  then show ?thesis  
+    by (cases "x \<in> A") (simp_all add: card_Diff1_less less_imp_le)
+qed auto
 
 lemma card_psubset: "finite B \<Longrightarrow> A \<subseteq> B \<Longrightarrow> card A < card B \<Longrightarrow> A < B"
   by (erule psubsetI) blast
@@ -1833,7 +1845,7 @@
 
 lemma insert_partition:
   "x \<notin> F \<Longrightarrow> \<forall>c1 \<in> insert x F. \<forall>c2 \<in> insert x F. c1 \<noteq> c2 \<longrightarrow> c1 \<inter> c2 = {} \<Longrightarrow> x \<inter> \<Union>F = {}"
-  by auto  (* somewhat slow *)
+  by auto
 
 lemma finite_psubset_induct [consumes 1, case_names psubset]:
   assumes finite: "finite A"




