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

feat(engine) Extract vals for trait impls in interface only mode. #1114

Merged
merged 5 commits into from
Nov 14, 2024

Conversation

maximebuyse
Copy link
Contributor

Implements the action plan in #1113

@maximebuyse
Copy link
Contributor Author

@karthikbhargavan You can test this branch and see if it solves your problem.

@karthikbhargavan
Copy link
Contributor

We seem to be dropping generic arguments in the val, we should keep them (e.g. v_SIZE below):

 [@@ FStar.Tactics.Typeclasses.tcinstance]
-let impl_2 (v_SIZE: usize) : Core.Convert.t_From (t_MlKemCiphertext v_SIZE) (t_Array u8 v_SIZE) =
-  {
-    f_from_pre = (fun (value: t_Array u8 v_SIZE) -> true);
-    f_from_post = (fun (value: t_Array u8 v_SIZE) (out: t_MlKemCiphertext v_SIZE) -> true);
-    f_from = fun (value: t_Array u8 v_SIZE) -> { f_value = value } <: t_MlKemCiphertext v_SIZE
-  }
+val impl_2:Core.Convert.t_From (t_MlKemCiphertext v_SIZE) (t_Array u8 v_SIZE)

@maximebuyse
Copy link
Contributor Author

We seem to be dropping generic arguments in the val, we should keep them (e.g. v_SIZE below):

 [@@ FStar.Tactics.Typeclasses.tcinstance]
-let impl_2 (v_SIZE: usize) : Core.Convert.t_From (t_MlKemCiphertext v_SIZE) (t_Array u8 v_SIZE) =
-  {
-    f_from_pre = (fun (value: t_Array u8 v_SIZE) -> true);
-    f_from_post = (fun (value: t_Array u8 v_SIZE) (out: t_MlKemCiphertext v_SIZE) -> true);
-    f_from = fun (value: t_Array u8 v_SIZE) -> { f_value = value } <: t_MlKemCiphertext v_SIZE
-  }
+val impl_2:Core.Convert.t_From (t_MlKemCiphertext v_SIZE) (t_Array u8 v_SIZE)

I pushed a fix

Copy link
Contributor

@karthikbhargavan karthikbhargavan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested on ml-kem, works, at least for lax checking,.

@karthikbhargavan karthikbhargavan added this pull request to the merge queue Nov 14, 2024
Merged via the queue into main with commit 63432cf Nov 14, 2024
15 checks passed
@karthikbhargavan karthikbhargavan deleted the val-instance branch November 14, 2024 14:14
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

Successfully merging this pull request may close these issues.

2 participants