1.3.1 Exercises 1. in A Friendly Introduction to Mathematical Logic 
Suppose that the language $\mathcal{L}$ consists of two constant symbols, $\Diamond$ and $\heartsuit$, a unary relation symbol $\yen$, a binary function symbol $\flat$, and a $3$-ary function $\#$. Write down at least three distinct terms of the language $\mathcal{L}$. Write down a couple of nonterms that look like they might be terms and explain why they are not terms. Write a couple of formulas and a couple of nonformulas that look like they ought to be formulas.
(From $1.3.1$ Exercises $1.$ in A Friendly Introduction to Mathematical Logic)


My attempts:

*

*Some terms of the language $\mathcal{L}$


*

*$\Diamond$

*$\heartsuit$

*$\yen\Diamond$


*

*Looks like might be term but not term, and explaination


*

*$\flat\Diamond\heartsuit$
Explaination: Since $\flat$ is a binary function symbol, with two inputs of constant symbols looks just perfectly fine.
However, one could argue that this is a string of function $\flat$ taking only one input of $\Diamond$ and follows with a constant symbol $\heartsuit$, which is not a term in $\mathcal{L}$. As this string don't have unique readability.
Similar argument could also apply to $\yen\Diamond$, so I'm not sure about this.

*

*Some formulas of the language $\mathcal{L}$


*

*$=\Diamond\heartsuit$

*$\lnot(=\Diamond\heartsuit)$

*$=\Diamond\heartsuit\lor\lnot(=\Diamond\heartsuit)$


*

*Looks like might be formula but not formula, and explaination


*

*$=\Diamond\yen\Diamond$
Explaination: If we read this as $=\Diamond(\yen\Diamond)$, it's a formula. However, $=(\Diamond\yen)\Diamond$ is not.

Other doubts

*

*What's the domain and codomain of $\yen,\flat,\#$, for $\yen$ is it the union of constant symbols and variables i.e. in this case $\{\Diamond,\heartsuit\}$; and $\flat:\{\Diamond,\heartsuit\}^2\to\{\Diamond,\heartsuit\}^2,\#:\{\Diamond,\heartsuit\}^3\to\{\Diamond,\heartsuit\}^3$?


*If $x$ is a term/formula, then $(x)$ is also a term/formula ?
 A: First, note that "$\yen$" is a relation symbol, not a function. So e.g. "$\yen\Diamond$" is not a term, but rather a formula. Similarly, "$=\Diamond\yen\Diamond$" is not a formula, but something like "$=\Diamond\flat\Diamond\Diamond$" would be (the point being that "$\flat\Diamond\Diamond$" is actually a term, unlike "$\yen\Diamond$").

More seriously, you seem to be misconstruing unique readability. An expression like "$\flat\Diamond\heartsuit$" is uniquely readable: when we say a string is uniquely readable we just mean that there is exactly one way to parse it as a grammatically correct expression. The fact that there are other ways to parse it which don't follow the rules isn't relevant: yes, sticking parentheses in "$\flat\Diamond\Diamond$" to form "$(\flat\Diamond)\Diamond$" is one way of inserting parentheses which is different from "$\flat(\Diamond\Diamond)$," but since it doesn't follow the basic rules we don't care. To see an example of a non-uniquely-readable string we need to turn to infix notation: does "$a+ b- c$" mean "$(a+ b)- c$" or "$a+ (b- c)$?" We either need an additional parsing rule (e.g. PEMDAS in this case) or some explicit parentheses in order to give the expression "$a+b-c$" a unique meaningful interpretation.
(This is one advantage of using Polish notation throughout: if everything is in Polish notation, we don't need parentheses or conventions to get unique readability. However, in practice Polish notation is generally harder to read than infix notation, so we usually just use infix notation with parentheses to keep everything nice and clear.)
To summarize:

*

*Contra your claims, "$\yen\Diamond$" is not a term and "$\flat\Diamond\heartsuit$" is a term. Meanwhile you are correct that "$=\Diamond\yen\Diamond$" is not a formula, but your justification is incorrect.


As to your other doubts:

*

*It doesn't really make sense to talk about the domain/codomain of a function/relation symbol $\sigma$; only actual functions/relations have domains/codomains. The symbol $\sigma$ is just a tool for transforming (tuples of) terms into terms or transforming (tuples of) terms into formulas, depending on whether $\sigma$ is a function or relation symbol.$^1$


*Your book should have precise rules about what is and what is not a term. Remember that the definition of "term" (and "formula," and many other things in this context) is inductive: it gives a few rules we can use to form terms and then says that nothing that isn't explicitly required to be a term by those rules is a term. (See here for more on this.)

*

*That said, I've never seen a system according to which "$(x)$" is a term, so I'll bet all the money in my pockets that the answer is no.




$^1$OK, fine: if we want we can say that there is a genuine function $A_\sigma$ corresponding to any function or relation symbol $\sigma$, namely the function which takes in appropriate tuples of terms and spits out the corresponding term or formula build from those inputs by $\sigma$. For example:

*

*$A_\yen$ is the function sending a term $t$ to the formula "$\yen t$."


*$A_\Diamond$ is the nullary function symbol outputting the term "$\Diamond$." (I'm taking the approach here that a constant symbol is really just a nullary function symbol; this often makes things a bit cleaner by having only two types of symbol to consider. It's a good exercise to convince yourself that $(i)$ nullary relation symbols make perfect sense, even if we don't allow them in a given presentation of first-order logic, but $(ii)$ they're pretty stupid.)


*$A_\flat$ is the binary function taking in a pair of terms $(t_1,t_2)$ and outputting the term "$\flat t_1t_2$."
As such, the domain of $A_\sigma$ for $\sigma$ an $n$-ary function or relation symbol is $\mathsf{Term}^n$, where $\mathsf{Term}$ is the set of all terms in our language, and the codomain is $\mathsf{Term}$ or $\mathsf{Form}$ (the latter being the set of all formulas in our language) depending on whether $\sigma$ is a function or relation symbol. For introductory logic this line of thought is rather silly, but it becomes serious down the road (e.g. in algebraic logic).
It should be noted that the notation I've used in this footnote is not standard, it's just me making things up. As far as I know there is no standard notation for this, and indeed - as mathematicians are wont to do - an abuse of notation is often employed here in conflating $\sigma$ and $A_\sigma$ once the basics have been established.
