Skip to content

Language

Pedro Fanha edited this page Jan 17, 2019 · 79 revisions
  • Grammar, terminology, and semantics all come from the book "Meaning and Argument: An Introduction To Logic Through Language", with the exception of a few conventions, but it is made clear throughout this page which ones these are. I try to introduce as little new grammar or terminology to the book as possible, but there are certain fundamental terms behind what is explained that are not so well-defined or obvious to the reader; most of what I added (tokens, types, terms, well-formed formulas, bound/unbound relations) is likely less 'general' than what someone more knowledgeable of logic might come up with (and maybe even flat-out wrong!), but it does the job (they're internal to the language). Semantics are for the most part not discussed here since they are not modified from this book and are not specific to it either. Unicode tokens, like the book uses, are accepted.

Here are listed all the rules adopted from the book that are necessary to write the interpreter and write valid RPL formulas. The development ABNF grammar can be found here. The simplified ABNF grammar can be found here (this page is up-to-date with commit: xxx).

Propositional Logic Grammar

The following rules are based off the book but not fully from it:

  1. A token is any occurrence of a type.

  2. A type is any instantiation of a well-formed expression.

  3. A well-formed expression is any character or string of characters with a well-defined meaning, e.g. a statement or a connective (ANYTHING that has any grammatical meaning is an expression).

  4. The instantiation of a symbol is the symbol itself.

  5. An atomic formula is any well-formed expression which is interpreted as an unit, with no deeper structures.

  6. White spaces/return are allowed between any token, except in atomic formulas.

  7. A statement set is delimited by curly brackets: '{' (opening) and '}' (closing). Between each bracket, there can be one or more statements separated by a comma ','.

  8. An argument is composed of one or more premises (a statement), each separated from the other by a comma ',', and a conclusion (also a statement), indicated by the token '.:.' (dot colon dot). The conclusion must follow after the premises. There is no comma between the last premise and the conclusion.

  1. A simple statement is a kind of statement which is symbolized by a single capital block letter from the alphabet ('A', 'B', 'C', 'D',...,'Z'), with the option of adding a subscript to them, as in 'A1', 'A2',...,'An' (only positive integers are allowed as subscripts; leading zeros are not allowed). Each different combination of letter/subscript is an instantiation of a simple statement, and thus a single token. If multiple tokens of the same combination appear, it is assumed that it is meant to be the same type.

  2. A logical conjunction is a kind of statement which is symbolized by the connective '&' (the ampersand). It takes two conjuncts, one on each side of the symbol, which must both be statements. That is, if α and β are statements, then so is '(α & β)'.

  3. A logical negation is a kind of statement which is symbolized by the connective '~' (the tilde). It takes one conjunct, at the right of the symbol, which must be a statement. That is, if α is a statement, then so is '~α'.

  4. A logical disjunction is a kind of statement which is symbolized by the connective '∨' (the vel; kind of incorrectly called wedge throughout the book?). It takes two conjuncts, one on each side of the symbol, which must both be statements. That is, if α and β are statements, then so is '(α ∨ β)'.

  5. A logical conditional is a kind of statement which is symbolized by the connective '⊃' (the horseshoe). It takes two conjuncts, one on each side of the symbol, which must both be statements. That is, if α and β are statements, then so is '(α ⊃ β)'.

  6. A statement can have only one main connective (a main connective is such connective that has the widest scope in the statement; connectives are the tokens of symbols that represent each complex statement). In the book, an exception is made to the use of groupers where the resulting expression is unambiguous. Here, I'll allow groupers to be used, but will implement operator precedence as well for readability.

  7. Only logical conjunctions, logical negations, logical disjunctions, and logical conditionals are complex statements.

  8. Only simple and complex statements are well-formed formulas.

  9. Only simple and complex statements are statements.

Property Predicate Logic Grammar (all rules of PL apply except where explicitly said otherwise)

  1. A singular term is symbolized by a single lower case letter from the alphabet ('a', 'b', 'c',...,'w'). As with statement letters (the symbolization of a simple statement), singular terms can be subscripted as well, as in 'a1'. 'x', 'y', and 'z' are reserved for use as variables in RPL. Each different combination of letter/subscript is an instantiation of a singular term. If multiple tokens of the same combination appear, it is assumed that it is meant to be the same type.

  2. Singular terms are terms.

  3. Property predicates are symbolized by capital letters superscripted with the numeral '1' (the degree of the predicate), as in 'A1', 'B1', 'C1',...,'Z1'. These can also be subscripted, as in 'A11', 'A21', 'Bn1'. Each different combination of letter/subscript with degree one is an instantiation of a property predicate, and thus a single token. If multiple tokens of the same combination appear, it is assumed that it is meant to be the same type.

  4. Property predicates can be followed by a single token of a singular term type, without any spaces between them, as in 'A1b', where 'A1' is a property predicate and 'b' is a token of a singular term type, forming singular subject-predicate statements. Such expressions are atomic formulas.

  5. Singular subject-predicate statements are a kind of simple statement.

  6. Predicates can be either simple or compound. A simple predicate is simply a property predicate. A compound predicate is composed of other predicates joined together by one or more of the four connectives from PL: '&', '~', '∨', and '⊃', as in '(P1 & M1)'. Because the four connectives from PL only worked with statements, it begs for 7.

  7. When any one of the four connectives from PL ('&', '~', '∨', and '⊃') are used in the case specified in 6. (forming a compound predicate), the resulting expression is not a statement but a predicate, and hence, holds no truth-value. The meaning of the connective holds only when considered in a quantifier statement.

  8. Both simple predicates with terms attached and compound predicates are well-formed formulas.

  9. An existential quantifier statement is a kind of statement which is symbolized by the symbol '∃' (backwards 'E'), followed by a predicate, either simple or compound.

  10. An universal quantifier statement is a kind of statement which is symbolized by the symbol '∀' (upside-down 'A'), followed by a predicate, either simple or compound.

  11. Both existential and universal quantifier statements are kinds of complex statements.

Relational Predicate Logic Grammar (all rules of PPL apply except where explicitly said otherwise)

  1. Simple predicates, namely property predicates, are extended to work with any degree >=1. Predicates are renamed to 'relations' (although the name 'predicate' also applies). Relations are symbolized as 'An', 'Bn', and so on, where 'n' is the degree of the predicate. Any other rule that applies to property predicates also applies to relations (namely, rule 4 and rule 3 from PPL grammar with the exceptions from here). The degree of a predicate does not serve as a factor of distinction between types. If predicate 'A1' appears in one statement, 'A2' cannot appear anywhere else, since 'A' either is an instantiation of a predicate of degree one, or an instantiation of a predicate of degree two. Relations can be bound or unbound. If they're bound, they form a statement. If they're not, then they have at least one place that is either empty or bound to a variable. Bound predicates are atomic formulas, and also singular statements (by the rule 4 from PPL).

  2. The set of tokens of terms that appear attached to predicates is always interpreted in the same order.

  3. A variable is symbolized by a single lower case letter from 'x' to 'z', and can be subscripted as well, as in 'x1', 'y2', etc.

  4. Variables are terms.

  5. Quantifiers must always bind to a variable, and from that it follows that the subject of a quantifier statement (the predicate) must bind to a variable as well (a simple predicate that binds only to singular terms forms a statement, but the subject of a quantifier must be a predicate; compound predicates, as well, can't be formed out of statements).

This is the syntax for RPL for now.

Interpreter-specific Grammar (all other rules apply)

  1. Groupers are used to specify precedence/scope. They are symbolized by the tokens '(' (opening) and ')' (closing), and a well-formed formula sits in between them. Groupers are optional whenever it is not specified that groupers are required. In any case where groupers don't appear, operator precedence takes over.

Restrictions

  1. The input can only be either a statement set or an argument.
Clone this wiki locally