|Version 3 (modified by diatchki, 5 years ago) (diff)|
(NOTE: This is work in progress)
These axioms are used by GHC's solver to construct proofs/evidence for various predicates involving type-level naturals.
The actual algorithm for constructing the evidence is described as set of rules (interactions) which are described separately.
The "*Def" axioms bellow look a bit odd but all they are saying is that the predicates which are being defined behave like their corresponding mathematical operations.
k,m,n: literals of kind Nat r,s,t: arbitrary terms of kind Nat
leqDef: m <= n -- if "m <= n" leqLeast: 0 <= t leqRefl: t <= t leqTrans: (r <= s, s <= t) => r <= t
addDef: m + n ~ k -- if "m + n == k" addUnit: 0 + t ~ t addAssoc: (r + s) + t ~ r + (s + t) addCommutes: t + s ~ s + t addCancel: (r + s ~ r + t) => s ~ t
mulDef: m * n ~ k -- if "m * n == k" mulUnit: 1 * t ~ t mulAssoc: (r * s) * t ~ r * (s * t) mulCommutes: t * s ~ s * t mulCancel: (r * s ~ r * t, 1 <= r) => s ~ t
addMulDistr: r * (s + t) = (r * s) + (r * t)