15-122 Principles of Imperative Computation
Lecture 2: Contracts
In this lecture we first introduce some of the structure of the C0
language. We then discuss the notion of a contract, which
formalizes what a function requires of its arguments and what
it ensures about its results. To show that a function satisfies
its contracts it is necessary to reason with loop
invariants, and we describe how to do so.
- Reading: 02-contracts.pdf
- Code: solution2.c0,
code directory
- Concepts:
- Functions, statements, expressions, types
- Assignments, variable declarations, conditionals, loops
- Syntax description
- Pre- and post-condition
- Loop invariants
- Assertions
- Previous lecture: Overview
- Next lecture: Ints
[ Home
| Schedule
| Assignments
| Resources
]
[
Blackboard
| academic.cs.15-122
]
fp@cs
Frank Pfenning
|