diff -r bd3685e5f883 -r 04e7c2566f7e src/HOL/Set.thy --- a/src/HOL/Set.thy Wed Jul 23 13:22:58 2025 +0200 +++ b/src/HOL/Set.thy Thu Jul 24 16:44:52 2025 +0200 @@ -1825,6 +1825,10 @@ lemma is_singletonE: "is_singleton A \ (\x. A = {x} \ P) \ P" unfolding is_singleton_def by blast +lemma is_singleton_iff_ex1: + \is_singleton A \ (\!x. x \ A)\ + by (auto simp add: is_singleton_def) + subsubsection \Getting the contents of a singleton set\ @@ -1896,6 +1900,10 @@ qualified definition can_select :: "('a \ bool) \ 'a set \ bool" \ \only for code generation\ where can_select_iff [code_abbrev, simp]: "can_select P A = (\!x\A. P x)" +qualified lemma can_select_iff_is_singleton: + \Set.can_select P A \ is_singleton (Set.filter P A)\ + by (simp add: is_singleton_iff_ex1) + end instantiation set :: (equal) equal