-
Notifications
You must be signed in to change notification settings - Fork 147
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
Add some instructions in preparation for reifying barrett #350
Conversation
…reparation for reifying barrett; tweaked definition of cc_l
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 modulo the minor change requests I mentioned
=> λ (xyk : | ||
(* ignore this line; it's to work around lack of fixpoint refolding in type inference *) var (type.Z * type.Z * type.Z * ((type.Z * type.Z) -> R))%ctype) , | ||
(ident.snd @@ (Var xyk)) | ||
@ ((idc : default.ident _ (type.Z * type.Z)) | ||
@@ (ident.fst @@ (Var xyk))) | ||
| ident.Z_rshi_concrete _ _ as idc |
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 has type Z * Z -> Z
, and belongs in the same block as ident.Z_div
, ident.Z_cc_m
, etc. Please move it there rather than introducing a new case.
@@ -5160,6 +5240,25 @@ Module Compilers. | |||
=> default_interp (ident.Z.mul_split_concrete x) (inr (y, z)) | |||
| _ => default_interp idc x_y_z | |||
end | |||
| ident.Z_rshi as idc | |||
=> fun (x_y_z_a : (_ * expr (_ * _ * _ * _) + |
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.
please put the type signature all on one line, or, better, on a separate line like
(x_y_z_a :
(* ignore this line, it's for issues with type inference / fixpoint refolding *) ...)
@@ -5219,6 +5318,19 @@ Module Compilers. | |||
=> default_interp (ident.Z.sub_get_borrow_concrete x) (inr (y, z)) | |||
| _ => default_interp idc x_y_z | |||
end | |||
| ident.Z_sub_with_get_borrow as idc | |||
=> fun (x_y_z_a : (_ * expr (_ * _ * _ * _) + |
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 comment as above about type signature
(_ * expr _ + type.interp _)) * (_ * expr _ + type.interp _))%type) | ||
=> match x_y_z_a return (_ * expr _ + (_ * expr _ + type.interp _) * (_ * expr _ + type.interp _)) with | ||
| inr (inr (inr (inr x, inr y), inr z), inr a) => | ||
let result := ident.interp idc (x, y, z, a) in |
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.
Any reason not to use let '(_, _) := ... in ...
rather than fst
and snd
?
Unable to unify: [inr [351, 349, 350]] == [inr [103, 108, 110]] Could not unify the values at index 0: [mit-plv#351, mit-plv#349, mit-plv#350] != [mit-plv#103, mit-plv#108, mit-plv#110] index 0: mit-plv#351 != mit-plv#103 (slice 0 44, [mit-plv#345]) != (slice 0 44, [mit-plv#100]) index 0: mit-plv#345 != mit-plv#100 (add 64, [mit-plv#58, mit-plv#95, mit-plv#343]) != (add 64, [mit-plv#58, mit-plv#98]) (add 64, [mit-plv#95, mit-plv#343]) != (add 64, [mit-plv#98]) (add 64, [mit-plv#95, (mul 64, [mit-plv#95, mit-plv#331])]) != (add 64, [(mul 64, [#3, mit-plv#95])]) (add 64, [mit-plv#95, (mul 64, [mit-plv#95, (const 4, [])])]) != (add 64, [(mul 64, [#3, mit-plv#95])]) (add 64, [(or 64, [mit-plv#91, mit-plv#93]), (mul 64, [(or 64, [mit-plv#91, mit-plv#93]), (const 4, [])])]) != (add 64, [(mul 64, [(const 5, []), (or 64, [mit-plv#91, mit-plv#93])])])
Unable to unify: [inr [351, 349, 350]] == [inr [103, 108, 110]] Could not unify the values at index 0: [mit-plv#351, mit-plv#349, mit-plv#350] != [mit-plv#103, mit-plv#108, mit-plv#110] index 0: mit-plv#351 != mit-plv#103 (slice 0 44, [mit-plv#345]) != (slice 0 44, [mit-plv#100]) index 0: mit-plv#345 != mit-plv#100 (add 64, [mit-plv#58, mit-plv#95, mit-plv#343]) != (add 64, [mit-plv#58, mit-plv#98]) (add 64, [mit-plv#95, mit-plv#343]) != (add 64, [mit-plv#98]) (add 64, [mit-plv#95, (mul 64, [mit-plv#95, mit-plv#331])]) != (add 64, [(mul 64, [#3, mit-plv#95])]) (add 64, [mit-plv#95, (mul 64, [mit-plv#95, (const 4, [])])]) != (add 64, [(mul 64, [#3, mit-plv#95])]) (add 64, [(or 64, [mit-plv#91, mit-plv#93]), (mul 64, [(or 64, [mit-plv#91, mit-plv#93]), (const 4, [])])]) != (add 64, [(mul 64, [(const 5, []), (or 64, [mit-plv#91, mit-plv#93])])])
Unable to unify: [inr [351, 349, 350]] == [inr [103, 108, 110]] Could not unify the values at index 0: [#351, #349, #350] != [#103, #108, #110] index 0: #351 != #103 (slice 0 44, [#345]) != (slice 0 44, [#100]) index 0: #345 != #100 (add 64, [#58, #95, #343]) != (add 64, [#58, #98]) (add 64, [#95, #343]) != (add 64, [#98]) (add 64, [#95, (mul 64, [#95, #331])]) != (add 64, [(mul 64, [#3, #95])]) (add 64, [#95, (mul 64, [#95, (const 4, [])])]) != (add 64, [(mul 64, [#3, #95])]) (add 64, [(or 64, [#91, #93]), (mul 64, [(or 64, [#91, #93]), (const 4, [])])]) != (add 64, [(mul 64, [(const 5, []), (or 64, [#91, #93])])])
I reprinted the code for Montgomery and X25519_64, and nothing is affected. This should be pretty mechanical, but I'll make a PR to pass it under @JasonGross's sanity check.