argumentcomputer / yatima

A zero-knowledge Lean4 compiler and kernel
MIT License
122 stars 9 forks source link

Use primitive representations of `Nat/Char/String` #169

Closed winston-h-zhang closed 2 years ago

winston-h-zhang commented 2 years ago

Why

The inductive representation of Nat is problematic because a + b will be computed through recursion. Currently, computing 2 + 2 in the inductive representation takes around 23k iterations. Computing 2 + 2 natively takes 3 iterations. For small values, the inductive representation is still acceptable. However, the definition of Char encodes Nat values >50k. And we have native chars in Lurk! Hence it makes the most sense to replace Nat/Char/String with Lurk primitives.

How