Skip to content

Instantly share code, notes, and snippets.

View marijnvanwezel's full-sized avatar

Marijn van Wezel marijnvanwezel

View GitHub Profile
@marijnvanwezel
marijnvanwezel / proofscript.ts
Created February 23, 2025 16:24
TypeScript as a proof assistant
// TypeScript can be used just like a proof assistant (for intuitionistic propositional logic)!
//
// Inspired by: https://www.youtube.com/watch?v=i-hRpYiNwBw
// We can encode False as the following recursive type, which can never
// be constructed (e.g. you would need { false: { false: { false: ... }}}).
type False = { false: False };
// True can be encoded as the inhabited singleton type "I", which
// has as its only inhabitant the string "I".