<<

Introduction to Formal Syntax

Greg O’Keefe 15th January 2007

This handout gives a summary and example exercises for the technical content of the first part of the course: syntax of PL and QL, and translation between English and these formal languages. This little note is not a substitute for the relevant sections of course text Logic by Paul Tomassi [Tom99]. This is just to emphasise the main points, and give a written form of my examples and explanations from the lectures. The first section outlines the syntax of propositional logic PL. The second discusses formal syntax more generally, and the third section introduces the syntax of quantified logic QL.

1 PL and Compound Statements in English

Some English statements are made up of smaller English statements joined by words or phrases such as “and,” “or,” “if ... then ...” and “It is not the case that ...”. Sometimes the same logical structure is expressed less directly. For example, we would say “My car is not red” rather than “It is not the case that my car is red” and we might say “I have one but she has three” rather than “I have one and she has three.” The language of PL models the structure of these compound statements. The connectives of PL and their intuitive meaning are shown in Table 1.

A & BA and B A ∨ BA or B A → B If A then B A ↔ BA if and only if B ∼A It is not the case that A

Table 1: Connectives of PL Note that A and B here are not letters, but metalinguistic variables which stand for complete PL formulae. To translate some English statements into PL, we first identify the smallest com- plete statements within the text, we assign letters P , Q, R, ... to these state- ments, then use the PL connectives to build the same structure as the English. Often

1 the smallest complete statements are not explicit in the text, because they inherit some information from their context. In these cases, we must paraphrase to make the sub- statements explicit. Consider the following example.

If you go to university and do not study logic, then you are either foolish or ignorant.

“You are either foolish or ignorant” is one sub-statement here connected by an “if ... then ...”, but we should be able to decompose it further. We paraphrase it (preserving the meaning) to “You are foolish or you are ignorant” and now we have two complete statements connected by an “or”. We therefore see that a translation into PL is as shown in Table 2. Key: U = You go to university. L = You study logic. F = You are foolish. I = You are ignorant.

Formula: (U & ∼L) → (F ∨ I)

Table 2: PL translation example

Notice that we use letters which suggest the English sentences they stand for. This helps to make the formula readable. As with computer programming, the readabil- ity of the code or formula can be as important as its formal correctness in practical applications.

2 Formal Syntax in General

Syntax is just another word for grammar. Grammar describes the rules for making sentences, but grammars for natural languages such as English are debatable and vague. The syntax for a is perfectly precise what the formulae are, and what their structure is. Definition of a formal language begins with a collection of symbols. For PL it is the statement letters P, Q, R, S, ... the connectives & , ∨ , →, ↔ and ∼, and the brackets ( and ). Notice that each formula P → (Q ∨ R), (Q & ∼Q) ∨ S, . . . , is a string, that is, a list of these symbols, but not every string of these symbols is a formula: )& P QR, ∼QR∨, . . . . That is, the formulae of a language are a of the strings of the languages symbols. The formulae are defined by a collection of formation rules. Usually there will be base rules, which say that certain strings are formulae, and recursive rules which make new formulae out of existing ones. For example, in PL, the base rule says that the

2 sentence letters P, Q, R, S, ... are formulae. Each connective has a recursive rule, so that for example, if A and B are formulae, then so is A & B. In fact, the language of PL is very similar to the expressions of ordinary arithmetic. In arithmetic, we have atomic expressions, the numerals, we have a unary connective, -, and we have several binary connectives, + × . . . . (The - is both a unary and binary connective, but we can determine which is intended from the context.) The formula (P & Q) ∨ (∼P ∨ ∼Q) has the same structure as (3 × 5) + (−3 + −5) . When we look at a formula, we can see which rules have been used to form it. This is the same as seeing what order to perform the operations to evaluate the . This structure is sometimes represented as a syntax tree. The structure of the formula determines how its meaning is built up from that of its basic elements, and determines which rules apply to it when doing deduction or semantic analysis. Do not panic about this. If you are able to evaluate the arithtmetic expression above, then you already have an intuitive understanding of the structure of the PL formula. The main connective is the symbol introduced in the last step of formation, or equivalently, the connective that you would evaluate last. In the formula above, the ∨ between the ) and the ( is the main connective. The scope of a connective is that connective and the formulae it connects. So, for example, the scope of the other ∨ (not the main connective) in the above formula is (∼P ∨ ∼Q).

3 QL and the Analysis of English Statements

In PL, the simplest formulae are the statement letters, which stand for complete English statements. It is often necessary to analyse these sentences to show that an is valid. For example, in , we discussed the argument in Figure 1.

The drums are louder than the bass. The guitar is louder than the drums. Therefore, the guitar is louder than the bass.

Figure 1: An example argument

We agreed that the argument was valid, however, if we translate it into the lan- guage of PL, we obtain the sequent P,Q : R, which is clearly not valid, because P = true, Q = true, R = false is a counter-example. The of the English argument lies in details overlooked by PL. The language of QL allows us to exhibit the internal structure of sentences in terms of what individuals we are talking about, and what properties or relations are being asserted about them. A domain specific vocabulary, or key, for PL consists of assigning a sentence letter to each of the smallest complete sentences in the text we are translating. With QL, a key consists of three things:

3 • the domain - a of the collection of individuals being discussed • letters from a, b, c, ..., each assigned to an individual from the domain • Property and Relation letters P, Q, R, ..., each assigned to a property or relation used in the text

Thus, we begin a translation into QL by identifying the kind of individuals be- ing talked about, the particular individuals named in the text, and the properties and relationships being asserted about them. In this example, the domain is the musical instraments in a band. The named individuals are the drums, the bass and the guitar. The only property or relation used is the relation “... is louder than ...” This is a two- place relation, or in other words, it is a statement with two holes in it, where must be inserted. Each property and relation letter has a fixed arity, that is number of . You must write exactly this number of names after it to make a well formed formula. A key for this translation is shown in Table 2.

Domain = musical instruments in a band d = the drums b = the bass g = the guitar Lxy = x is louder than y

Figure 2: Key for translation of the band example

Given this key, the argument can be represented by the sequent Ldb, Lgd : Lgb. We do not yet have a clear enough notion of the of QL to assess the validity of this sequent. In fact it is not valid until we add further about the relation “... is louder than ...” This is as we should expect. To see this, consider the argument of the same form: Dianne loves Bill; George loves Dianne; Therefore George loves Bill. This one is not valid, because the relation is different. We will study properties of relations later in the course. The “Q” in QL stands for quantification, which means like “some” and “all.” Let’s use an alternative key, as we did above with our “George loves Bill” argument. The domain is people, and L represents ...loves..., and b stands for “Bill.” Then we write “everybody loves Bill” as ∀x[Lxb]. Inside the square brackets, we have an unquantified formula, with a (x, y, z, ...) in place of a name. We could re- paraphrase the full formula into English as “For each person, that person loves Bill” or “For each person, who we temporarily name x, x loves Bill”. We can have compound formula inside the square brackets, and the variable can occur more than once. For example, if Gx means “x is a girl,” then we may write “All the girls love Bill” as ∀x[Gx → Lxb]. Translating this back into English, we get the awkward but equivalent statement “For each person, if that person is a girl then she loves Bill.” Formulae like this occur often, because we quite often make statements of the form “every something-or-other is a what-do-you-call-it.”

4 There is also an existential quantifier, which we use to formulate statements about “some” things, or “there exists” a such-and-such. We can write “Somebody loves Bill” as ∃x[Lxb] and “Somebody loves Bill, but no girls love Bill” as

∃x[Lxb]& ∼∃x[Gx & Lxb] .

A quantifier with the variable it binds (eg ∀x) is considered to be a connective. It can be the main connective of a formula, and it has a scope. The scope is particularly important for quantified variables, because this is where the quantifier has control of that variable. For example, we might write “Somebody is a girl, but not everybody is a girl” as ∃x[Gx]& ∼∀x[Gx]. There is no confusion or ambiguity here, because each of the x’s in a Gx is within the scope of a different quantifier. Although it is formally equivalent, it would be better to write ∃x[Gx]& ∼∀y[Gy], because it would be less likely to confuse human readers. Finally, returning to our rock-band theme, we translate a famous saying of Lemmy Kilmister, the singer songwriter and bass player of Motorhead.¨ Lemmy once famously instructed his sound engineer to make everything louder than everything else. We use the key given above, and introduce the final symbol of QL, the = sign, in our translation of the English statement “Everthing is louder than everything else.”

∀x[∀y[∼(x = y) → Lxy]] In English, this says “For any two instruments x and y, if they are not the same, then x is louder thany.” We will study this formula further when we look at formal semantics and the properties of relations.

4 Conclusion

At the end of this first part of the course, you should be able to translate between English and the formal languages PL and QL. You should be able to recognise whether or not a given string of symbols is a well formed formula of these languages, and if so, represent it as a syntax tree. You should be able to identify the main connective of a formula, and the scope of each connective of a formula.

References

[Tom99] Paul Tomassi. Logic. Routledge, 1999.

5