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.

  • 1
    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$.2012-05-03
  • 0
    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.2012-05-03
  • 0
    On the other hand, if you're trying to write English rather than a program, Mark's answer is good.2012-05-03
  • 0
    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.2012-05-03
  • 0
    @freitass: So you are writing a program?2012-05-03
  • 0
    @TaraB: yes, a pseudo-algorithm.2012-05-03

2 Answers 2

7

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.

  • 0
    You are on the right path @Mark Dominus! Is there a shorter (leaner) way to describe that?2012-05-03
  • 0
    @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.2012-05-03
  • 0
    @freitass: This is about as short and simple as you can make it.2012-05-03
  • 0
    @BrianM.Scott: I just don't know how to express that. I would like it in a syntax similar to the definition of a set, if possible.2012-05-03
  • 0
    @freitass: I don't think that it is possible. I don't understand what you mean by your first sentence: Mark's answer is precisely how I would express it.2012-05-03
  • 0
    @BrianM.Scott: I will put it in an example: instead of "Let _p_ be ..." one could write "_p_ <- ..." (where <- is an assignment of "..." to _p_)2012-05-03
  • 3
    @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.2012-05-03
  • 1
    How about this: "Let$p$beaprettyelementof$S$andlet$S^\prime\!\!=\!\!S\!\!−\!\!\{\!p\!\}$"2012-05-03
  • 0
    @BrianM.Scott: Yes, I am writting a program (in a pseudo-algorithm).2012-05-03
  • 0
    @freitass: 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 $$S'=S\setminus\Big\{\operatorname{Arb}\{s\in S:s\text{ is pretty}\}\Big\}\;.$$2012-05-03
  • 0
    @BrianM.Scott: You might as well put that as an answer, since I think it's along the lines of what freitass is looking for.2012-05-04
  • 0
    @Tara: Done!$\quad$2012-05-04
3

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\}\;.$$

  • 0
    Just one thing. What is this "\"? Does it have the same effect as a "-"?2012-05-04