liveBook · Manning

Curry-Howard correspondence

As explained in Data-Oriented Programming in Java

The Curry-Howard correspondence is a relationship between formal logic and computation in which propositions correspond to types and proofs correspond to values or programs satisfying them.

The Curry-Howard correspondence connects logic and computation through data types: a data type acts as an assertion, while an instance proves that the assertion has been satisfied. In practical Java design, this turns invariants into compiler-visible boundaries rather than leaving them as assumptions. section 9.3.2

A proof-carrying type can guard any point in an application, not merely an interface or architectural layer. Code that accepts ValidCart instead of Cart demands evidence that validation and required construction steps have already succeeded. section 9.3.2 section 9.6

Guarding checkout with ValidCart

A cart endpoint can load and validate a cart, add items, and establish a boundary by constructing ValidCart. Subsequent operations—computing subtotals, checking free-shipping progress, and retrieving recommendations—accept only that stronger type. Each function therefore works from concrete knowledge instead of repeating assumptions about cart state. section 9.3.2

Applying the correspondence to legacy code means:

  • Work backward from required invariants rather than beginning with object responsibilities or architectural layers. section 9.3.2
  • Use constructors and dedicated data types to prevent invalid or partially validated states from spreading. section 9.6

How Data-Oriented Programming in Java covers it

How deep it goes
Defines assertions and proofs, then works through boundary placement and incremental Java refactoring without formal logical derivations.
Examples
Uses ValidCart, cart validation, subtotal computation, shipping eligibility, and recommended-item retrieval as proof-carrying examples.
What it assumes
Assumes familiarity with data modeling and Java code, while teaching how to translate informal invariants into enforced types.
What you can do after
Apply it via dedicated data types to move invariants into compiler-enforced boundaries and refactor unsafe code incrementally.
How it connects
Connects data types with invariants, validation, constructors, boundaries, and refactoring legacy code.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Data-Oriented Programming in Java. The section links point to the parts of the book it draws on.