From a8e8dbdcda173caa790726d6c30bd75e7cc79472 Mon Sep 17 00:00:00 2001 From: Akshay Nair Date: Tue, 12 Dec 2023 23:55:06 +0530 Subject: Update README.md --- README.md | 37 ++++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index ee7b099..9441dd4 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,37 @@ # Theorem prover in ts types -Experiment to use typescript's type system for theorem proving +Experiment to use typescript's type system to make a shitty theorem prover. + + +### Commutativity of addition in ts types or something? + +```typescript +export type Commutativity = Rewrite, Add>; + +export interface Comm_Base_Proof { + type: 'rewrite', + left: Equation, Add>; // 0 + b = b + 0 + right: ChainRewrites<[ + IdentityR, // b = b + 0 + Sym>, // b + 0 = b + 0 + Refl>, // true + ], this['left']>; +}; + +export interface Comm_Inductive_Proof { + type: 'rewrite', + left: Equation, B>, Add>>; // succ(a) + b = b + succ(a) + right: ChainRewrites<[ + SumSucc, // succ(a + b) = b + succ(a) + Commutativity, // succ(b + a) = b + succ(a) + SumSuccR, // succ(b + a) = succ(b + a) + Refl>>, // true + ], this['left']>; +}; + +export namespace spec { + export type commutativity = [ + assert>>, + assert>>, + ] +} +``` -- cgit v1.3.1