# How to compactly write a simple set for 2 variables when second variable may have same properties as first or it may optionally be positive infinity?

A Little Bit of Background (May Be Skipped)

It's been about 40 years since learning higher math like partial differential equation and linear algebra including simple tensors but never needed much of it. Now I'm working on a Wolfram Mathematica programming project that also requires describing solution sets in set builder notation. Below is what I have come up with and I am not even sure if I used all math symbols correctly.

For example at first I was not certain if I had used the correct symbol for And (in programming && means And) or Or (in programming || means Or) which is how I would have written these two symbols if I had not researched them first. Although I know all Tex symbols are rendering correctly I do not really know if I am using any math symbols (probably learned before you were born) that are now considered deprecated or were never in the official standard. For example throughout high school and most of my college years and even in textbooks $$\mathbb{I}$$ was used for the set of all integers. It wasn't until my final college year that I discovered the correct form is $$\mathbb{Z}$$.

One more example of how set builder notation has changed. In my youth the preference was the tall upright bar $$|$$ for such that but since then I have also seen $$:$$ and $$\ni$$. I still prefer the bar because it stands out but takes almost no space and it is very clear from the context that it cannot be other similar symbols.

Why I Believe Sometimes Set Builder Notation Can Be Abbreviated (May Be Skipped)

However I prefer not to use such that $$|$$ if possible. The reason that I might for example write a compacted set as $$\{x,y,z \in \mathbb{R} \geq 1\}$$ instead of the longer more proper form $$\{\{x,y,z\} \in \mathbb{R} |\{x,y,z\} \geq 1\}$$ is that the longer form is often redundant and unnecessary. It should be clear that an ungrouped (no brackets) sequence of variables not yet defined will all take on the same definition that immediately follows the last variable. The such that $$|$$ step can be omitted when it is clear from the context of the problem that all values that all variables can take on are also an infinite set.

This is done all the time in computer science especially when writing programs. However I can only defend this if I know I can write the set in proper form which is why I ask for this first. One final caveat: I have not lost any respect for mathematics. I would never do this for writing proofs or formal papers or in teaching.

Finally The Problem at Hand (edited)

Note: this section was edited after noticing that Eike Schulte very generously left a very thoughtful Answer showing a long list of everything wrong with my first attempt but before actually reading it. It motivated me to rewrite it as a test to myself because I knew I could do better.

Set $$A$$ is my second original set in what I believe is close to proper set notation...

$$A: \{\{n,h\} \in \mathbb{Z}|\{n,h\} \geq 0 \lor n \in \mathbb{Z}|n \geq 0 \land h = +\infty\}$$

Set $$B$$ is my best attempt to compact $$A$$ in proper set notation (I think?)...

$$B: \{n \in \mathbb{Z} | n\geq 0, h \in \{n, +\infty\}\}$$

In summary you may help by...

(1.) Validate that sets $$A$$ and $$B$$ are both written correctly by most current standards or practices and if both sets are equivalent. I do not believe either set is correct. Next I ask how to correct $$B$$ (and $$A$$ if you have time) for the shortest correctly written set (less is more) without losing definition. Pease comment below validating this or suggesting edits. Thank you for sharing your expertise. Item 2 may be ignored but I leave it as a reference to myself.

(2.) Why is my fat Z (written as $$\Z$$) for the set of all Integers not rendering correctly? I used a Latex source for that. Should I have instead referenced a Tex source? Nevermind I figured out how to write $$\mathbb{Z}$$ and found the greatest tutorial right here in SE Math Meta MathJax

Neither of your sets is written correctly. Mathematical notation is not a shorthand for English text and therefore, different rules apply:

1. $$n, h \in \mathbb Z \geq 0$$” does not make sense. When a statement contains several relation symbols (like $$\in$$ and $$\geq$$ in this case), the normal way to interpret this is as two separate statements like this: $$n, h \in \mathbb Z$$ (which makes sense) and $$\mathbb Z \geq 0$$ (which does not). [Technically, even something like $$a < b < c$$ is abuse of notation. In this case, however, it stands for $$a < b$$ and $$b < c$$ which are both sensible on their own and together they imply $$a < c$$, so there really isn’t any room for confusion.]

2. Writing “$$h \to +\infty$$” makes no sense. This $$\to$$-notation always needs a partner, i.e. “$$h \to +\infty$$ as $$x \to 0$$” (where presumably $$h$$ would depend on $$x$$ in some way). A variable cannot go off to infinity on its own, it always needs to do so in response to some other change. If you want to include a formal symbol “$$\infty$$” in your set, that is fine.

3. Writing “$$h \in \mathbb Z \geq 0 \vee {}\to + \infty$$” makes even less sense. I think that you intend to say that $$h$$ is an integer greater than or equal $$0$$ or goes to infinity; however, unlike in English, “or” (i.e. “$$\vee$$”) can only connect complete statements which “goes to infinity” is not. In English, we essentially mentally insert a copy of the subject of the sentence (here “$$h$$”) after the “or”, in mathematical notation you need to be explicit. [There are only very few cases where something like this is allowed, most importantly when writing $$n, h \in \mathbb Z$$ instead of $$n \in \mathbb Z \wedge h \in \mathbb Z$$.]

4. You seem to want to use set-builder notation which always requires you to have two parts between $$\{$$ and $$\}$$: First, the variable you want to use in your description and second (after a “$$|$$” or “$$:$$”, or rarer, “$$;$$” or “$$,$$”), the conditions the elements need to fulfill. [For set-theoretic reasons that I don’t want to go into right now, the base set your objects come from is usually placed in the first part but not doing so is generally acceptable.] It is also okay to “destructure” your elements in the first part, so if you want to have a set of pairs, you can write $$\{ (a, b) | \dots \}$$ instead of $$\{ x | x = (a, b), \dots \}$$.

Putting all of these corrections together, we get $$A = \{ (n, h) | n \in \mathbb Z \wedge (h \in \mathbb Z \vee h = +\infty) \}$$ or maybe $$A = \mathbb Z^2 \cup \{ (n, +\infty) | n \in \mathbb Z \}.$$

• PART 1: thank you for your very detailed and insightful answer, you are absolutely correct on every point, i cannot defend my shorthand without breaking standards. best i can do is explain why non-mathematicians like programmers and engineers often use it. we use it to express what properties function arguments are valid for and only amongst each one another. For example in Mathematica (MMA) we can make several definitions for a single function and MMA will find and use only that definition it matches inputs. For the example given we might filter arguments... (please go to PART 2) Dec 26, 2021 at 0:41
• PART2: with this pattern cpat = _Integer?(# >= 0 &) | Infinity which looks a lot like my shorthand. notice no "suchthat" bar and names of variables arent even mentioned in pattern that checks types, domain, values, etc. when defining a function a pattern might be applied like this: fn[x:cpat, y:cpat]:=(do transformation valid for non-negative integers or infinity). after your detailed answer i rewrote my own answer before reading your answer (as a test to myself) because i knew i could do better. please have another look. Your input is most graciously appreciated. Dec 26, 2021 at 1:01
• PART3 just wish to add that the vertical bar in the example pattern given means OR not suchthat. Dec 26, 2021 at 15:43