-
Notifications
You must be signed in to change notification settings - Fork 0
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
Choices translations #16
Conversation
Hi Benjamin, awesome! Thank you so much. <3 Here is instructions for integrating your changes into the framework:
Using this opportunity to also simplify names sounds great to me. Currently, some names (e.g., for config translations) are very long and that makes everything harder to read. If you have remarks or ideas on how to better structure the framework here, I am happy to discuss. |
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.
Here are some first general comments. I did not look into the actual choice proofs yet. I will do this next week in Emacs.
I just had a quick, superficial look at the choice file. I pushed some comments. Feel free to revert/drop/squash/whatever the commit. |
d07010c
to
c5065f7
Compare
I have mostly integrated the translation into the current framework. The only thing which doesn't quite fit is the ⟦ compile t (Standard-Semantics chc (extract i)) ⟧₂ (conf t (Standard-Semantics chc (extract i))
≡⟨ ? ⟩
⟦ compile t (Standard-Semantics chc (extract i)) ⟧₂ (conf t (cons Choice∈Γ₁ chc) i) My current TODO list looks like this:
|
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.
Hi Benjamin. The reintegration looks fine to me. :) I added some comments. Let's discuss your changes this week. We can then also have a look at the necessary changes within the framework. If you need help or advice for resolving the remaining compiler errors, let me know.
src/Translation/Lang/FCC-to-FCC.agda
Outdated
preserves : {i : Size} → {D A : Set} → (n m : ℕ≥ 2) → (expr : FCC n D i A) → ⟦ translate n m expr ⟧ₙ ≅[ fnoc n m ][ conf n m ] ⟦ expr ⟧ₙ | ||
preserves (sucs n) (sucs m) expr = ≅[]-trans (IncreaseArity.preserves (sucs m) (DecreaseArity.translate (sucs n) expr)) (DecreaseArity.preserves (sucs n) expr) | ||
|
||
languageCompiler : {i : Size} → {D : Set} → (n m : ℕ≥ 2) → LanguageCompiler (FCCL n D Variant Artifact∈ₛVariant {i}) (FCCL m (IndexedDimension D n) Variant Artifact∈ₛVariant) |
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.
So this reduces an FCC n
expression to a FCC 2
expression and then saturates it to a FCC m
expression? :)
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.
Exactly.
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.
We should probably document this somewhen.
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 actually is currently documented.
Answer to your previous comment: I see the problem with a generalised LanguageCompiler to break existing proofs. Thank you for pointing out the little playground with this problem. I am not 100% sure yet whether Your Todolist looks good. I added some comments, mostly concerned with more documentation. Thank you for all your effort. The results look really great and I am still surprised how extensive these proofs became. This clears our a big chunk from our TODO list from our paper. |
513f6e4
to
a6f7307
Compare
a6f7307
to
1fea5fc
Compare
One other half of a preservation proof can be constructed if given one direction of a translation preservation proof and a proof that the configuration translations are inverses to each other. However, this is only useful if the translation functions are extensionally equal to each other. Hence, in most cases, using this theorem will require function extensionally.
Before the translation was from `CCC` to `FCC (sucs zero)`
This makes it consistent with all other choice translations and prevents a lot of unsolved metas.
Unfortunately, this breaks `ConstructFunctor` and all code associated with it. However, the benefits of having `LanguageCompiler`s for more languages outweighs the benefits of `ConstructFunctor` because `ConstructFunctor` is hard to use and hasn't yet proved itself worth yet.
The ˡ suffix is superfluous and _⊕_ is already unambiguous in this code base.
A separate, named function makes the behaviour more clear than the expression `_∘ f`.
`ListChoiceLengthLimit-⊔-comm` is just a special case of `ListChoiceLengthLimit-⊔` and is actually only needed because `ListChoiceLengthLimit-⊔` isn't flexible enough.
This makes it obvious what this lemmas are about and keeps them from polluting the namespace.
Having a consistent naming convention which works in every case is very useful.
We need a symbol in the paper.
1fea5fc
to
c755f84
Compare
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.
Great work! Some last nitpicky comments, which we can have a look at later, potentially in a revision of the entire code base at a later stage.
open import Data.Vec using (Vec; lookup; toList) renaming (map to map-vec) | ||
open import Data.Vec.Properties using (lookup-map) | ||
|
||
record Syntax (n : ℕ) (Q : Set) (A : Set) : Set where | ||
record Syntax (n : ℕ≥ 2) (Q : Set) (A : Set) : Set where |
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.
Good catch. The previous definition allowed zero
which was in fact illegal. Only very indirectly via the existence of a configuration, the case Syntax zero
was forbidden. Took me quite a while to find that. Good that you fixed it here and made it explicit.... although an unary choice would have been fine too. ;)
|
||
## Module | ||
|
||
It's required that arity is at least one to have a semantic. However, we require |
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.
I do not think semantics has a singular.
```agda | ||
data NCC : Size → 𝔼 where | ||
atom : ∀ {i A} → Artifact (NCC i) A → NCC (↑ i) A | ||
chc : ∀ {i A} → VLNChoice.Syntax n Dimension (NCC i) A → NCC (↑ i) A |
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.
Maybe it would be simpler to use NChoice
directly here instead of VLNChoice
? VLNChoice
is mostly a proof that choices can be modelled in the framework.
open Data.List using (concatMap) renaming (_++_ to _++l_) | ||
import Data.Vec as Vec | ||
|
||
-- get all dimensions used in a binary CC expression |
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.
comment outdated
Translations (with preservation proofs) of different choice language variants (n-ary, 2-ary, arbitrary) into each other. All proofs are finished.
Note that the first commit is a result I stumbled upon during this work. It could be used to eliminate one half of each preservation proof and replace it by a possibly shorter proof that the config translations are inverses. However, this lemma will need extensionality most of the time. Hence, I avoided it for now.
There is potential to generalize the version I used here, if you ever see a dependent
zipWith
somewhere. I also noticed that the functioncappedFin
implements the same semantics asclamp
, except it's defined recursively. Hence, it's easier to proof properties about it.This is currently almost completely independent of the current code base. How do we want to integrate this?
There is a
Lang.CCC
module whose constructors I could reuse. However, there is no arbitrary choice language, only an arbitrary choice constructor.Furthermore, all of this is currently in one file. Should we split all of this up into multiple modules, multiple files or keep it that way? If we split it up, we could shorten the names (e.g. to
translate
,conf
andfnoc
)?