diff options
| author | Akshay Nair <phenax5@gmail.com> | 2023-12-12 17:58:46 +0530 |
|---|---|---|
| committer | Akshay Nair <phenax5@gmail.com> | 2023-12-12 18:03:08 +0530 |
| commit | ade99f3f1fc2da1d51a82f1376c61ad609d60ff1 (patch) | |
| tree | 1b0a5a092baae86df93112b76bad948d72bb7df7 /src/nat.ts | |
| parent | 60331b72ab37e581b0fb405c2eff862e16b52ac2 (diff) | |
| download | ts-theorem-provinator-ade99f3f1fc2da1d51a82f1376c61ad609d60ff1.tar.gz ts-theorem-provinator-ade99f3f1fc2da1d51a82f1376c61ad609d60ff1.zip | |
feat: associativity and commutativity for addition
Diffstat (limited to '')
| -rw-r--r-- | src/nat.ts | 15 |
1 files changed, 4 insertions, 11 deletions
@@ -1,16 +1,9 @@ -declare const prev: unique symbol +import { Op } from "./util"; -export type _nat = number & { [prev]: _nat | null } -export type Succ<n extends _nat> = number & { [prev]: n } -export type Pred<n extends _nat> = n extends _0 ? n : n[typeof prev] -export type Nat = _0 | Succ<_nat> +export type Add<A extends Op, B extends Op> = { op: '+'; a: A; b: B }; +export type Succ<A extends Op> = Add<'1', A>; -export type _0 = 0 & { [prev]: null } +export type _0 = '0' export type _1 = Succ<_0> export type _2 = Succ<_1> export type _3 = Succ<_2> -export type _4 = Succ<_3> -export type _5 = Succ<_4> -export type _6 = Succ<_5> -export type _7 = Succ<_6> -export type _8 = Succ<_7> |
