-
Notifications
You must be signed in to change notification settings - Fork 2
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
[Circuit monad] Proper soundness using env function #31
Conversation
Clean/Circuit/Circuit.lean
Outdated
-- we use a trick to get Lean to display the actual parts of `h_holds` for us! | ||
have h_holds: _ ∧ _ ∧ _ := h_holds |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is the trick I was missing before this PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, just using
dsimp [Adversarial.constraints_hold] at h_holds
simplifies things nicely and works as intended
Clean/Circuit/Circuit.lean
Outdated
-- simplify constraints hypothesis | ||
-- we know it must be just the `subcircuit_soundness` of `Add8Full.circuit` | ||
-- so it has an implication form | ||
have h_holds : _ → _ := h_holds |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
another example of the same trick
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same thing, just doing
dsimp [Adversarial.constraints_hold] at h_holds
works 🙂
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wait what, am I crazy
thanks @gio54321 :D I pushed an update |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm, nice!
I wonder if with the new env
we can remove the Provable.eval_env env b_var = b
assumption. We could quantify only over all possible beta.var
and then introduce in the proofs the values that are the evaluation of those vars, since the env maps every var to a field element. Something like this (not really deeply tested)
soundness:
-- for all environments that determine witness generation
∀ env: ℕ → F,
-- for all inputs that satisfy the assumptions
∀ b_var : β.var,
let b := Provable.eval_env env b_var
assumptions b →
-- if the constraints hold
Adversarial.constraints_hold env (main b_var) →
-- the spec holds on the input and output
let a := Provable.eval_env env (output (main b_var))
spec b a
I thought it's a good idea and tried it. So far it made the introduction of variables a bit more complicated though, because I still need the same equality assumption and need to introduce it manually (see screenshot). Maybe you can come up with a better way to handle this later |
env: Nat -> F
to determine assignment of values to variablesSubCircuit
structure to a form which I think will stand the test of timeFormalCircuit
as aSubCircuit
to the equivalence of flattened and nested constraints