This repository describes a formalization of the static and dynamic semantics of the language C0 (http://c0.typesafety.net/). Future plans for this repository include a verified compiler for the language. At present it contains:
c0/ast.lean
: The AST of a parsed C0 program. (The parser is not formalized.)c0/ast_ok.lean
: Static typing for valid ASTs. This is the property that is checked by thecc0
compiler; if it fails to hold then a compile error is produced.c0/dyn.lean
: Dynamic semantics of running C0 programs. This is a specification for the execution behavior of the program, as a small step relation.c0/dyn_ok.lean
: Type correctness of states. This is not checked by the compiler, but rather is the set of invariants that hold throughout the execution of a valid program.
The main theorems proven are:
vc0/preservation.lean
: Ifs
is a valid state, ands
steps tos'
, thens'
is also a valid state.vc0/progress.lean
: Ifs
is a valid state, then eithers
is a final state, ors
steps to somes'
.vc0/determ.lean
: Ifs
steps tos'
ands
also steps tos''
, thens' = s''
(determinism).