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

Some class parameters are incorrectly passed #719

Closed
mamonet opened this issue Jun 14, 2024 · 5 comments · Fixed by #726 or #751
Closed

Some class parameters are incorrectly passed #719

mamonet opened this issue Jun 14, 2024 · 5 comments · Fixed by #726 or #751
Assignees
Labels
engine Issue in the engine f* F* backend

Comments

@mamonet
Copy link
Collaborator

mamonet commented Jun 14, 2024

In some extracted F* files in libcrux-ml-kem, arguments for classes are passed as explicit parameters. For example, v_K variable here is supposed to be ghost parameter https://github.com/cryspen/libcrux/blob/dev/libcrux-ml-kem/proofs/fstar/extraction/Libcrux_ml_kem.Ind_cca.fst#L89

It's fixed manually in dev_ml_kem_lax branch https://github.com/cryspen/libcrux/blob/dev_ml_kem_lax/libcrux-ml-kem/proofs/fstar/extraction/Libcrux_ml_kem.Ind_cca.fst#L89

W95Psp pushed a commit that referenced this issue Jun 20, 2024
W95Psp pushed a commit that referenced this issue Jun 20, 2024
W95Psp pushed a commit that referenced this issue Jun 20, 2024
@W95Psp W95Psp self-assigned this Jun 21, 2024
@W95Psp W95Psp added engine Issue in the engine f* F* backend labels Jun 21, 2024
@mamonet
Copy link
Collaborator Author

mamonet commented Jun 24, 2024

Thanks for fixing this, Lucas.

@mamonet
Copy link
Collaborator Author

mamonet commented Jun 25, 2024

I will reopen this issue because hax mainstream seems to produce the same kind of error for different modules in libcrux-ml-kem

For example here the parameter of t_Operations is supposed to be passed implicitly
https://github.com/cryspen/libcrux/blob/dev_ml_kem_lax/libcrux-ml-kem/proofs/fstar/extraction/Libcrux_ml_kem.Vector.Traits.fsti#L192
and
https://github.com/cryspen/libcrux/blob/dev_ml_kem_lax/libcrux-ml-kem/proofs/fstar/extraction/Libcrux_ml_kem.Polynomial.fsti#L36

@mamonet
Copy link
Collaborator Author

mamonet commented Jun 26, 2024

The old problems seem to be fixed with this PR #738 but now I got implicit parameters that are supposed to be passed explicitly, here's an example
https://github.com/cryspen/libcrux/blob/dev_ml_kem_lax/libcrux-ml-kem/proofs/fstar/extraction/Libcrux_ml_kem.Vector.Traits.fsti#L7-L8

@mamonet
Copy link
Collaborator Author

mamonet commented Jun 26, 2024

W95Psp added a commit that referenced this issue Jul 8, 2024
This PR separates method generic args and trait generic args of the
`call` nodes of THIR expressions.

Consider the following example:
```rust
trait MyTrait<TraitType> {
  fn meth<MethType>(...) {...}
}
fn example_call<TraitType, SelfType: MyTrait<TraitType>>(x: SelfType) {
  x.meth::<String>(...)
}
```

Before this commit, the call `x.meth::<String>` produced a `Call` node
whose field `generic_args` was `[SelfType, TraitType, String]`.

Now, that `Call` node has a trait-specific generic arguments field
`[SelfType, TraitType]` and a method/function-specific generic
arguments field `[String].`

This commit does no change to the engine, that will be for a
subsequent PR.

This PR is related to #719.
W95Psp added a commit that referenced this issue Jul 8, 2024
This PR separates method generic args and trait generic args of the
`call` nodes of THIR expressions.

Consider the following example:
```rust
trait MyTrait<TraitType> {
  fn meth<MethType>(...) {...}
}
fn example_call<TraitType, SelfType: MyTrait<TraitType>>(x: SelfType) {
  x.meth::<String>(...)
}
```

Before this commit, the call `x.meth::<String>` produced a `Call` node
whose field `generic_args` was `[SelfType, TraitType, String]`.

Now, that `Call` node has a trait-specific generic arguments field
`[SelfType, TraitType]` and a method/function-specific generic
arguments field `[String].`

This commit does no change to the engine, that will be for a
subsequent PR.

This PR is related to #719.
W95Psp added a commit that referenced this issue Jul 8, 2024
This PR separates method generic args and trait generic args of the
`call` nodes of THIR expressions.

Consider the following example:
```rust
trait MyTrait<TraitType> {
  fn meth<MethType>(...) {...}
}
fn example_call<TraitType, SelfType: MyTrait<TraitType>>(x: SelfType) {
  x.meth::<String>(...)
}
```

Before this commit, the call `x.meth::<String>` produced a `Call` node
whose field `generic_args` was `[SelfType, TraitType, String]`.

Now, that `Call` node has a trait-specific generic arguments field
`[SelfType, TraitType]` and a method/function-specific generic
arguments field `[String].`

This commit does no change to the engine, that will be for a
subsequent PR.

This PR is related to #719.
@W95Psp
Copy link
Collaborator

W95Psp commented Jul 8, 2024

Update: I almost fixed it, but got distracted with other things, I will finish that tomorrow morning.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
engine Issue in the engine f* F* backend
Projects
No open projects
Status: Done
2 participants