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

2CC Idempotency Elimination #75

Merged
merged 3 commits into from
Sep 26, 2024
Merged

2CC Idempotency Elimination #75

merged 3 commits into from
Sep 26, 2024

Conversation

ibbem
Copy link
Collaborator

@ibbem ibbem commented Sep 26, 2024

Create a compiler to eliminate indifferent choices from 2CC

An indifferent choice is a choice like D ⟨ l , l ⟩ where both alternatives are the same. Such choices are often created by compiling CCC→NCC→2CC.
Note about naming: The name redundancy elimination is already taken by the transformation which removed nested choices deciding on the same feature.

An indifferent choice is a choice like `D ⟨ l , l ⟩` where both
alternatives are the same. Such choices are often created by compiling
CCC→NCC→2CC.
@ibbem ibbem requested a review from pmbittner September 26, 2024 11:28
@pmbittner
Copy link
Member

pmbittner commented Sep 26, 2024

Maybe, a fitting name would also be idempotence. That is the name of the choice transformation rule D ⟨ l , l ⟩ -> l. I think I would prefer that name for consistency.

{-|
A choice between two equal alternatives is no choice.
No matter how we configure the choice, the result stays the same.
-}
choice-idempotency : ∀ {D} {e : 2CC Dimension ∞ A}
---------------------------------
→ 2CCL Dimension ⊢ D ⟨ e , e ⟩ ≣₁ e
choice-idempotency {D} {e} c with c D
... | false = refl
... | true = refl

Copy link
Member

@pmbittner pmbittner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great! Thank you!

@pmbittner pmbittner added the enhancement New feature or request label Sep 26, 2024
This makes the naming consistent with the preexisting rule names for the
2CC algebra (`Vatras.Lang.2CC.Properties.choice-idempotency`).
@pmbittner pmbittner changed the title 2CC indifferent elimination 2CC Idempotency Elimination Sep 26, 2024
@pmbittner pmbittner merged commit 81a5256 into main Sep 26, 2024
1 check passed
@pmbittner pmbittner deleted the 2CC-indifferent-elimination branch October 16, 2024 14:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants