1
$\begingroup$

How do I pick a single element from a set that satisfies a property? For instance, I want to write something like this:

$$S = S - \{s \in S \ | \ s \text{ is pretty}\}$$

But with $\{s \in S \ | \ s \text{ is pretty}\}$ I want to pick a single element (any of the pretty ones).

Edit: If possible, the answer should be in a syntax similar to the definition of a set.

$\endgroup$
6
  • 1
    $\begingroup$ Your question is not clear, at all. If $S$ is equal to $S$ without a subset of $S$ then that subset was empty, in particular this means that there are not "pretty" $s$ in $S$. $\endgroup$
    – Asaf Karagila
    May 3, 2012 at 14:20
  • $\begingroup$ It would help if you specified the situation a bit more. I'm guessing that what you are doing is writing a program, in which case Mark's answer might not be exactly what you are looking for. If you let us know exactly what you're trying to do, we can probably help. $\endgroup$
    – Tara B
    May 3, 2012 at 14:31
  • $\begingroup$ On the other hand, if you're trying to write English rather than a program, Mark's answer is good. $\endgroup$
    – Tara B
    May 3, 2012 at 14:32
  • $\begingroup$ Thank you for the comments. Please, assume = is an assignment. In that case, S will be the result of S minus one of its pretty elements. After that being "processed", the resulting |S| (size of S) will be the former |S| - 1. I am looking for a formal way to describe that. $\endgroup$
    – freitass
    May 3, 2012 at 15:42
  • $\begingroup$ @freitass: So you are writing a program? $\endgroup$
    – Tara B
    May 3, 2012 at 16:38

2 Answers 2

7
$\begingroup$

You say "Let $p$ be a pretty element of $S$, and let $S' = S - \{p\}$".

Of course you have to show first that $S$ does have at least one pretty element.

$\endgroup$
12
  • $\begingroup$ You are on the right path @Mark Dominus! Is there a shorter (leaner) way to describe that? $\endgroup$
    – freitass
    May 3, 2012 at 15:44
  • $\begingroup$ @freitass: This is a perfectly good answer to your question as asked. If you want something different, you should edit the question to explain what you're looking for. $\endgroup$
    – Tara B
    May 3, 2012 at 16:37
  • $\begingroup$ @freitass: This is about as short and simple as you can make it. $\endgroup$ May 3, 2012 at 17:02
  • 3
    $\begingroup$ @freitass: Why on earth would you want to do that if you're writing mathematics? It might make sense if you're doing some kind of programming, but then you need to tell us what the context is. $\endgroup$ May 3, 2012 at 19:42
  • 1
    $\begingroup$ How about this: "Let$p$beaprettyelementof$S$andlet$S^\prime\!\!=\!\!S\!\!−\!\!\{\!p\!\}$" $\endgroup$
    – MJD
    May 3, 2012 at 21:12
3
$\begingroup$

I'm still not entirely sure just what you want, but perhaps you could define an operator Arb on sets such that Arb(S) returns an arbitrary member of $S$ if $S\ne\varnothing$; then you can have assignments like $$S'=S\setminus\Big\{\operatorname{Arb}\{s\in S:s\text{ is pretty}\}\Big\}\;.$$

$\endgroup$
1
  • $\begingroup$ Just one thing. What is this "\"? Does it have the same effect as a "-"? $\endgroup$
    – freitass
    May 4, 2012 at 13:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .