-
Notifications
You must be signed in to change notification settings - Fork 0
Formalization of Succinctness #98
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
base: main
Are you sure you want to change the base?
Conversation
This is the first definition has come to my mind. It works at least for ADT < CCC intuitively.
I expect `2CC < CCC` so `ADT < CCC` should follow using transitivity.
As ≤Size is not total, <Size is not transitive without requiring ≤Size. Moreover, ≱Size is not antisymmetric. Note that ≱Size is ¬ ≤Size with the arguments flipped and the negation moved inside.
This makes it easier to use because the artifact type doesn't need to be applied when invoking `≤Size`. Furthermore, this enables proofs of `≱Size` to fix a single artifact type, for example the natural numbers, and automatically have the inhabitants it needs. The order between the quantifier over `n` and `A` doesn't have a big impact. On the one hand, the chosen order allows `≱Size` to use different artifact types for each `n`. However, it doesn't change the relation inhabitants if they are swapped because there exists a type with enough elements (i.e., union of all `A` ranging all `n`s) that can be fixed and then only a subset of the artifacts can be used for a specific `n`. On the other hand, `≤Size` is a `Set` and, thus, can't be inspected if the order is changed. This specific order is chosen purely as it's more convenient for pattern matching (e.g., one less `with` clause in case of `≤Size`).
Previously, these where not inferred correctly, but now it works™.
This reduces duplication and allows refactoring of 𝔸.
This allows to easily add more fields.
The designed succinctness definition includes a translatable constraint that the old definition was missing. This gets rid of the unfortunate `¬Compiler→¬≤` and `¬Compiler→≤` properties. A drawback of this new definition is that it breaks transitivity. Consider some languages L1 and L3 that are complete and a language L2 that is incomplete. There is an expression e in L1 that cannot be translated to L2. If we have L1 <= L2 and L2 <= L3 we cannot conclude L1 <= L3 because we know nothing about the size of e translated to L3 because we just proved that there exists no translation to L2. Note that the order of `∀ (A : 𝔸)` and `Σ[ m ∈ ℕ ]` was changed. Due to parametricity (type parameters cannot be inspected) this does not change the actual semantics of the definitions. However, it does simplify the proofs by being friendlier to pattern matching and `with` clauses avoiding additional helper functions in many cases.
This makes the names consistent with the symbol that is used now.
This merge introduces succinctness as explored in my master thesis "On the Succinctness of Languages for Static Variability."
pmbittner
left a comment
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 @ibbem
thank you for the PR. As always, it would be great to have some documentation here and there. I leave it up to you to decide how much time you want to invest. I have some comments below but would be willing to merge in any case.
| atoms : 𝔸 → Set | ||
| atoms = proj₁ | ||
| record 𝔸 : Set₁ where | ||
| no-eta-equality |
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 you could document here why eta equality must be forbidden?
| open import Data.Nat using (ℕ; _≟_) | ||
| NAT : 𝔸 | ||
| NAT = record | ||
| { atoms = ℕ × ℕ |
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.
Could you document why there are two natural numbers? What is each number supposed to mean?
| → (vs : List (Rose ∞ A)) | ||
| → AllPairs (_≉_) vs | ||
| → All (_∈ ⟦ e ⟧) vs | ||
| → List.sum (List.map sizeRose vs) ≤ size2CC e |
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 seems rather counter-intuitive. A plain enumeration of trees is smaller absolute size than a single 2CC expression which potentially reduces duplication? Am I misreading this theorem? Could you add some documentation?
| does-not-describe-variant (e , variant⊆e , e⊆variant) | zero , e≡variant | a , e≡empty | () | ||
|
|
||
| FST-is-incomplete : Incomplete (Rose ∞) (FST.FSTL F) | ||
| FST-is-incomplete complete = does-not-describe-variant (Prod.map₂ (≅-sym) (complete variantGenerator)) |
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 you could add a sentence of documentation to this module what the main insight is here. Is this the first (direct) proof of FST incompleteness?
| open import Vatras.Lang.OC F using (OC; _-<_>-; _❲_❳; Configuration; ⟦_⟧ₒ) | ||
| open import Vatras.Lang.OC.Util using (all-oc) | ||
|
|
||
| data RestrictOptions {A : 𝔸} : {i : Size} → List F → OC i A → 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.
What does this do? Restrict options to not be in a given environment (i.e., list of options)?
| where | ||
| open Eq.≡-Reasoning | ||
|
|
||
| todo5 : |
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.
Should we keep these todo... names? Looks like you wanted to give hem a name?
| @@ -0,0 +1,153 @@ | |||
| module Vatras.Succinctness.Relations.2CC=2CC 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.
A short note what this module is about? The name is rather irritating :D
| open import Data.Product using (_,_; Σ-syntax) | ||
| open import Function using (id) | ||
| import Relation.Binary.PropositionalEquality as Eq | ||
| open import Relation.Unary using (_∈_) |
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 believe this module is more than just utility isn't it? Would it make sense to move it to the Succinctness module? What do you think? In any case, we can leave it here of course to save some work.
| @@ -0,0 +1,214 @@ | |||
| {-# OPTIONS --allow-unsolved-metas #-} | |||
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.
unsolved-metas still necessary?
|
|
||
| import Vatras.Util.List as List | ||
|
|
||
| diagonalization : ℕ × ℕ → ℕ |
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.
Can you add some documentation of what this diagonalization module is doing?
This is the formalization of succinctness as advertised in my master thesis "On the Succinctness of
Languages for Static Variability".
Note that there are merge conflicts between
thesis_bmandmain. Hence, this branch already includes the merge tomainand should be merged using a fast-forward merge.