Conversation
Due to the argument order of `_⊙_`, the children got merged in the wrong
order. Hence, the merge order of the children kind of reversed after
each level. Notice that the new argument order agrees with the usual
`List.foldl` argument order.
Example of what changed:
Previously, we had
((0 -< rose-leaf 1 ∷ [] >- ∷ []) ⊕ (0 -< rose-leaf 2 ∷ [] >- ∷ []))
≡ (0 -< rose-leaf 2 ∷ rose-leaf 1 ∷ [] >- ∷ [])
and
((0 -< 1 -< rose-leaf 2 ∷ [] >- ∷ [] >- ∷ []) ⊕ (0 -< 1 -< rose-leaf 3 ∷ [] >- ∷ [] >- ∷ []))
≡ (0 -< 1 -< rose-leaf 2 ∷ rose-leaf 3 ∷ [] >- ∷ [] >- ∷ [])
now we have
((0 -< rose-leaf 1 ∷ [] >- ∷ []) ⊕ (0 -< rose-leaf 2 ∷ [] >- ∷ []))
≡ (0 -< rose-leaf 1 ∷ rose-leaf 2 ∷ [] >- ∷ [])
and
((0 -< 1 -< rose-leaf 2 ∷ [] >- ∷ [] >- ∷ []) ⊕ (0 -< 1 -< rose-leaf 3 ∷ [] >- ∷ [] >- ∷ []))
≡ (0 -< 1 -< rose-leaf 2 ∷ rose-leaf 3 ∷ [] >- ∷ [] >- ∷ [])
In the paper, we do not presume the standard library so we define `_⊕'_` without `foldl`.
The `FeatureAlgebra` concept is based on the paper "An algebraic foundation for automatic feature-based program synthesis" by Apel et. al. which is a little vague and inconsistent with the order of their composition operator. While discussing the buggy children order fixed in f3ccb0f, we discovered that the distant idempotence law is dictated by the order during composition. Using our current definition of `_⊕_`, we have ((0 -< rose-leaf 1 ∷ [] >- ∷ []) ⊕ (0 -< rose-leaf 2 ∷ rose-leaf 3 ∷ [] >- ∷ [])) ≡ (0 -< rose-leaf 1 ∷ rose-leaf 2 ∷ rose-leaf 3 ∷ [] >- ∷ []) which gives rise to the law i₁ ⊕ i₂ ⊕ i₁ ≡ i₁ ⊕ i₂ In contrast, with the alternative definition of `_⊕_`, with swapped composition order, we have ((0 -< rose-leaf 1 ∷ [] >- ∷ []) ⊕ (0 -< rose-leaf 2 ∷ rose-leaf 3 ∷ [] >- ∷ [])) ≡ (0 -< rose-leaf 2 ∷ rose-leaf 3 ∷ rose-leaf 1 ∷ [] >- ∷ []) which gives rise to the law i₂ ⊕ i₁ ⊕ i₂ ≡ i₁ ⊕ i₂ Although Apel et. al. state the distant idempotence law as i₂ ⊕ i₁ ⊕ i₂ ≡ i₁ ⊕ i₂ we decided to use the more intuitive composition order.
Member
|
I love how this PR did not have to touch any of the existing proofs on FSTs, which we just merged. 🚀 |
Member
|
I am beginning to review in-file this time. |
pmbittner
requested changes
May 28, 2024
Member
pmbittner
left a comment
There was a problem hiding this comment.
I just pushed my review. I also integrated some minor improvements myself, including enhanced documentation and extraction of some utility lemmas.
Collaborator
Author
|
Nice! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.