Skip to content

Fix simplification rule for nested type-level exponentiation#1800

Merged
RyanGlScott merged 2 commits intomasterfrom
T1799-fix-incorrect-exp-simplifications
Feb 11, 2025
Merged

Fix simplification rule for nested type-level exponentiation#1800
RyanGlScott merged 2 commits intomasterfrom
T1799-fix-incorrect-exp-simplifications

Conversation

@RyanGlScott
Copy link
Contributor

Previously, Cryptol.TypeCheck.SimpType.tExp would attempt to simplify a ^^ (x ^^ y) to a ^^ (x * y) at the type level, which was blatantly wrong. I have changed this to a similar (but actually valid) rule that simplified (a ^^ x) ^^ y to a ^^ (x * y). (This law is normally stated with the condition that a != 0, but this law even works in Cryptol when a == 0 due to the fact that 0 ^^ 0 == 1 in Cryptol.)

Fixes #1799.

Previously, `Cryptol.TypeCheck.SimpType.tExp` would attempt to simplify `a ^^
(x ^^ y)` to `a ^^ (x * y)` at the type level, which was blatantly wrong. I
have changed this to a similar (but actually valid) rule that simplified `(a ^^
x) ^^ y` to `a ^^ (x * y)`. (This law is normally stated with the condition
that `a != 0`, but this law even works in Cryptol when `a == 0` due to the fact
that `0 ^^ 0 == 1` in Cryptol.)

Fixes #1799.
@RyanGlScott RyanGlScott merged commit 593a475 into master Feb 11, 2025
50 checks passed
@RyanGlScott RyanGlScott deleted the T1799-fix-incorrect-exp-simplifications branch February 11, 2025 17:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Instantiating a parameterized module results in incorrect operator precedence

3 participants