-
Notifications
You must be signed in to change notification settings - Fork 17
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
Proof that subst preserves errors #368
Conversation
Signed-off-by: Craig Disselkoen <cdiss@amazon.com>
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.
Overall structure and theorem statement seems fine to me. Approving as-is, though I imagine you'll still do some hacking on the proofs (e.g., normalizing simp
s)
If partial evaluation returns ok after any substitution of unknowns, | ||
then it must return ok before that substitution | ||
-/ | ||
theorem subst_preserves_errors_mt {expr : Partial.Expr} {req req' : Partial.Request} {entities : Partial.Entities} {subsmap : Subsmap} |
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.
Why _mt
?
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.
From the Latin "modus tollens", which in formal logic is the rule for contrapositives. I named this in analogue to Lean's use of mp
(from the Latin "modus ponens") to mean the forward direction of an implication. Suggestions for a different name? I suppose _contrapositive
?
Signed-off-by: Craig Disselkoen <cdiss@amazon.com>
Signed-off-by: Craig Disselkoen <cdiss@amazon.com>
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.
Looks good to me.
The next lemma required for PE soundness. We already have a lemma stating that "if partial evaluation returns a concrete value, then it returns the same concrete value after any substitution of unknowns [in the original expression/request/entity store]". This is the counterpart for when partial evaluation returns an error.
Notably, the statement is not that partial evaluation must return the same error after any substitution of unknowns; that doesn't hold (one of many counterexamples:
principal.foo + false
where the principal is initially unknown, but the substitution maps it to some entity which doesn't have afoo
attribute. This gives a type error before substitution, but an attrDoesNotExist error after substitution.) Instead, the statement is that partial evaluation must return some error (not necessarily the same error) after any substitution of unknowns.As of this writing, I have not yet normalized the
simp
s in this PR.