Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Light weight syntax for circuits, types, and publicity #9

Open
mariari opened this issue Apr 19, 2022 · 0 comments
Open

Light weight syntax for circuits, types, and publicity #9

mariari opened this issue Apr 19, 2022 · 0 comments

Comments

@mariari
Copy link
Member

mariari commented Apr 19, 2022

We should have light weight syntax for defining circuits along with privacy and type information.

Currently we do everything in defcircuit but most functions are not the entry point and thus the publicity of the arguments go ignored.

Further it would be nice to declare types in a separate call if need be. Thus I propose a few abstractions

sig

I believe we should have a sig macro that updates the type signature of the circuit. This should not be redefined by the circuit unless it has explicit type signatures on the form.

Sig should look like

(sig constrain (-> nested bool))

where -> is the function syntax.

defgate

Defgate allows us to not include the privacy information when declaring a circuit. Like defcircuit, types are needed but they can be deferred to a sig call.

(sig constrain (-> nested bool))
(defgate constrain (nest)
  (def ((plane (plane nest))
        (time  (time nest)))
    (= (* (x plane)
          (y plane))
       (* (x time)
          (y time)))))

(defgate constrain ((nest nested) &out bool)
  (def ((plane (plane nest))
        (time  (time nest)))
    (= (* (x plane)
          (y plane))
       (* (x time)
          (y time)))))

public

We should be able to declare parameters public, making them private by default for defgate, if we wish for a defgate to be the real entry point to the circuit.

(public constrain nest)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant