Book contents
- Frontmatter
- Contents
- Preface
- 1 Predicate Logic
- 2 The Simple Imperative Language
- 3 Program Specifications and Their Proofs
- 4 Arrays
- 5 Failure, Input-Output, and Continuations
- 6 Transition Semantics
- 7 Nondeterminism and Guarded Commands
- 8 Shared-Variable Concurrency
- 9 Communicating Sequential Processes
- 10 The Lambda Calculus
- 11 An Eager Functional Language
- 12 Continuations in a Functional Language
- 13 Iswim-like Languages
- 14 A Normal-Order Language
- 15 The Simple Type System
- 16 Subtypes and Intersection Types
- 17 Polymorphism
- 18 Module Specification
- 19 Algol-like Languages
- Appendix: Mathematical Background
- Bibliography
- Index
1 - Predicate Logic
Published online by Cambridge University Press: 28 January 2010
- Frontmatter
- Contents
- Preface
- 1 Predicate Logic
- 2 The Simple Imperative Language
- 3 Program Specifications and Their Proofs
- 4 Arrays
- 5 Failure, Input-Output, and Continuations
- 6 Transition Semantics
- 7 Nondeterminism and Guarded Commands
- 8 Shared-Variable Concurrency
- 9 Communicating Sequential Processes
- 10 The Lambda Calculus
- 11 An Eager Functional Language
- 12 Continuations in a Functional Language
- 13 Iswim-like Languages
- 14 A Normal-Order Language
- 15 The Simple Type System
- 16 Subtypes and Intersection Types
- 17 Polymorphism
- 18 Module Specification
- 19 Algol-like Languages
- Appendix: Mathematical Background
- Bibliography
- Index
Summary
In this chapter, we introduce four concepts that pervade the study of programming languages: abstract syntax, denotational semantics, inference rules, and binding. These concepts are illustrated by using them to describe a formal language that is not a programming language: predicate logic.
There are three reasons for the oddity of starting a book about programming languages by defining a logic. First, predicate logic is close enough to conventional mathematical notation that the reader's intuitive understanding is likely to be accurate; thus we will be illustrating novel concepts in a familiar setting. Second, since predicate logic has no concept of nontermination, we will be able to define its denotations in terms of ordinary sets, and postpone the more subtle topic of domains until Chapter 2. Finally, as we will see in Chapter 3, predicate logic plays a pivotal role in the formal specification of simple imperative programs.
Although the syntax and semantics of predicate logic are standard topics in logic, we will describe them in the terminology of programming languages: The types of phrases that a logician would call “terms” and “well-formed formulas” we will call “integer expressions” (abbreviated by “intexp”) and “assertions” (abbreviated by “assert”) respectively. Similarly, “assignments” will be called “states”. Moreover, we will usually interpret the operators used to construct terms in a fixed way, as the familiar operations of integer arithmetic.
Abstract Syntax
It is possible to specify the syntax of a formal language, such as predicate logic or a programming language, by using a context-free grammar (often called BNF or Backus-Naur form) and to define the semantics of the language by a function on the set of strings generated by this grammar.
- Type
- Chapter
- Information
- Theories of Programming Languages , pp. 1 - 23Publisher: Cambridge University PressPrint publication year: 1998