Project ideas
What is a good class project? It’s hard to make the right size, given the unknown competence of AI.
Consequently, I suggest starting with a small project that might take perhaps an hour, and maybe do a few such projects to help understand some PL theory and how to best use AI. Upon completion have AI produce a nice slide deck that you can use to audit that the definitions & theorem statements are correct. Your input to AI could be very specific (eg a bunch of (hand-written?) inference rules defining a type system) or looser (eg “take the simply typed lambda calculus and …”).
Ideally an LLM writes most of the code and proofs; you own the specification and argue that it is right.
- Brainstorm!: Around any programming language (eg While or the lambda calculus) we can have a bunch of definitions:
- evaluator
- small-step semantics
- big-step semantics
- Hoare logic
- weakest preconditions
- type rules
- type checker
- program analysis
- type inference algorithm
- refinement type system
and a bunch of ways to translate into another program in the same/different language:
- compile
- LLM translation
- manual porting
- refactoring or optimizing
and the target language also has a bunch of associated definitions (ie its own eval function). Brainstorm interesting theorems we might write in this space (some of which are outlined below).
-
Prove Hoare Logic is sound with respect to an evaluator. Prove WP is sound/complete with respect to Hoare logic. Implement WP. Use it to prove some properties of a small program. You will need to identify a logic language for use in specs, and interpret it in lean.
-
Compiler correctness: define a language L with an
evalfunction for L, a compiler to a target language T, and arunfunction for T. Prove that for all p in L,eval(p) = run(compile(p)). Example:cormac/stack-compiler. -
Translation validation: given a program p in a language L with an
evalfunction, and a target language T with arunfunction, have an LLM translate p to c ∈ T and produce a proof thateval(p) = run(c). This would verify LLM translations one program at a time. Can we do this when L is a real language, e.g. C? -
Type soundness: define a typed language with a small-step semantics and a type system, and prove that well-typed programs do not go wrong (progress and preservation). Example:
cormac/while. Extend it with something that makes the proof harder: division (a run-time error types cannot rule out), references, functions, or polymorphism. -
Type checker correctness: implement a type checker
check : L → Option Typeand prove it sound and complete with respect to the typing rules:check e = some Texactly when the rules derivee : T. A checker that rejects everything is sound, so completeness matters. -
A checker for Lean itself: Lean’s guarantee rests on a small kernel that type-checks every proof, and anyone can write an independent checker for the same logic (de Moura’s talk on the videos page mentions one written in a week). Write a type checker for Lean’s dependent type theory that reads definitions and proofs exported with
lean4exportand accepts or rejects them. Grow it in stages: the simply typed λ-calculus, then dependent functions and universes, then definitional unfolding, then inductive types and their recursors. Test it on the example projects, and on deliberately broken proofs it must reject. Existing checkers to compare with includelean4lean(the kernel written in Lean; see the paper Lean4Lean: Verifying a Typechecker for Lean, in Lean) andnanoda(in Rust). Going further: prove parts of your checker correct with respect to the typing rules. -
Interpreter correctness: write an executable interpreter for a language given by a step relation and prove they agree. For example, prove that the
runfunction incormac/whileagrees withStepswhenever it returns a result. -
A verified program logic: define a Hoare logic or a weakest-precondition calculus for a While language, prove it sound against the operational semantics, then use it to verify a few small programs. Going further: a verification-condition generator that takes a program annotated with loop invariants, proved sound, so that verifying a program reduces to proving its conditions.
-
Denotational semantics: give While (or a λ-calculus) a compositional meaning, for example a store transformer defined by recursion on the program, and prove it agrees with the operational semantics. Loops need a fixed point, or fuel. Compare
cormac/small-big, which proves big-step and small-step semantics agree. -
A verified abstract interpreter: define an abstract domain (signs, then intervals) with a concretization function, write an abstract interpreter for While, and prove it sound: every concrete run ends in a state the abstract result describes. Intervals need widening to terminate on loops.
-
A verified model checker: define transition systems and safety properties, write an explicit-state model checker (breadth-first search over reachable states, bounded or exhaustive), and prove it correct: it reports a violation exactly when a bad state is reachable. Use it on a small protocol, or prove an inductive invariant directly.
-
Ship a verified Lean component: write a small, useful piece of software in Lean (a parser, validator, or policy evaluator), prove it meets a spec, compile it, and call it from another language through the C FFI. Say what the proof assumes about the compiler, runtime and FFI.
-
Verified migration: the old program is the spec. Port a 100–200 line module (e.g. Python) to Lean and prove the port equivalent to a Lean model of the original, with differential testing as a cross-check. Where does “behaves like the old code” get hard to state: I/O, errors, performance?
-
Data structure refinement: implement a heap, balanced tree or interval map and prove it refines a simple model (a list or set): every operation does what the model’s operation does.
-
Round-trip properties: write a serializer and parser for a small format and prove
parse (print x) = x. Then ask what that theorem misses. - Mechanize something: Eg a chapter or homework from one of the books
- Types and Programming Languages,
- Certified Programming with Dependent Types,
- or the Software Foundations series
- a POPL paper, etc
-
Where does the one-liner stop working? Start from something an LLM mechanizes in one request (e.g. a TAPL chapter) and add features (references, subtyping, polymorphism, concurrency) until it needs real human help. Report where that happened, and why.
-
Spec validation study: take a set of LLM-produced mechanizations and attack their specs: mutate definitions, look for vacuous or weakened statements, and compare against the source. How often is a checked proof proving the wrong thing?
-
Shared class toolchain: the class builds one verified toolchain for a small language (type checker, evaluator, compiler, WP calculus), one team per component, with an end-to-end theorem connecting them. Shared definitions must be frozen early.
- Python Formalization in Lean: They translated the whole CPython Implementation into Lean.