|
| 1 | +Notes and questions on the ongoing implementation of `agda2lambox`. |
| 2 | + |
| 3 | +- MetaCoq's λ□ programs can be well-formed in different ways |
| 4 | + --- [parametrized by `EEnvFlags`][envflags]. |
| 5 | + |
| 6 | + However, CertiCoq seems to expect a specific kind of λ□ programs, in |
| 7 | + particular as input to the translation to λ□-Mut. I've inferred that: |
| 8 | + |
| 9 | + - Constructors should be fully-applied (and thus eta-expanded). |
| 10 | + - There should be *no projections* remaining. |
| 11 | + - Datatypes and record types should not be parametrized. |
| 12 | + |
| 13 | + Is this correct? Where exactly is this requirement stated? |
| 14 | + |
| 15 | +- As `agda2lambox` is *not* going to be verified, it should strive to be |
| 16 | + as straightforward as possible. |
| 17 | + Currently I had to implement eta-expansion of constructors to comply to what |
| 18 | + *I think* CertiCoq expects (See `Agda.Utils (etaExpandCtor)`). |
| 19 | + The code isn't very complex and I'm almost convinced it's correct, |
| 20 | + but to me it falls in the category of transformations that should happen |
| 21 | + on the Coq side. |
| 22 | + |
| 23 | + Conveniently, MetaCoq already provides a verified *transformation* on λ□ |
| 24 | + to perform this eta-expansion of constructors. |
| 25 | + See [`EConstructorsAsBlocks`][ctorblocks]. |
| 26 | + |
| 27 | + *However*, this transformation is implemented on `eprogram`, |
| 28 | + which is a slightly more efficient way to encode programs (where the |
| 29 | + environment is not a flat association list anymore). |
| 30 | + *But* CertiCoq's pipeline ony wants regular `program`s. |
| 31 | + |
| 32 | + - Is there a way to convert a `program` to an `eprogram`? |
| 33 | + - Is there a way to get CertiCoq to work on `eprograms`s? |
| 34 | + |
| 35 | +- How would we go about making the backend incremental? |
| 36 | + |
| 37 | +- Is it reasonnable to pack all the Agda codebase into a single output `.v` |
| 38 | + file? |
| 39 | + |
| 40 | +- Can CertiCoq generate multiple files of Rust? Mutiple blobs of WASM? |
| 41 | + |
| 42 | +- How does CertiCoq handles primitives/axioms? How does it work for types? |
| 43 | + |
| 44 | +- How would we make it easier to do the plumbing from inside Agda? |
| 45 | + |
| 46 | +[ctorblocks]: https://github.com/MetaCoq/metacoq/blob/v1.3.1-8.19/erasure/theories/EConstructorsAsBlocks.v |
| 47 | +[envflags]: https://github.com/MetaCoq/metacoq/blob/ea3ed3c4b0d05508ce744f17a56c880c5f47c816/erasure/theories/EWellformed.v#L55 |
| 48 | + |
0 commit comments