CSU-CS-Melange / alpha-language

Forked from Inria gitlab
MIT License
0 stars 0 forks source link

Normalize: Case Expression on the RHS of a Binary Expression #72

Closed ryanjob42 closed 5 months ago

ryanjob42 commented 5 months ago

Case expressions on the right-hand side of binary expressions don't get normalized.

For example: if we apply Normalize to the following:

affine test [N]->{:N>0}
    inputs X: {[i]: 0<=i<=N}
    outputs Y: {[i]: 0<=i<=2N}
    let Y[i] = 1[] + case{
        {:i<=N}: X[i];
        {:i>N}: X[i-N];
    };
.

We would expect to get this:

affine test [N]->{:N>0}
    inputs X: {[i]: 0<=i<=N}
    outputs Y: {[i]: 0<=i<=2N}
    let Y[i] = case{
        {:i<=N}: 1[] + X[i];
        {:i>N}: 1[] + X[i-N];
    };
.

However, Normalize wouldn't do anything at all.