Skip to content

Enforce selector rules for match statements #428

@Leo-Besancon

Description

@Leo-Besancon

AirScript documentation states the following constraints regarding selectors in match statements:

AirScript makes the following assumptions about selector expressions, which are not yet enforced by the language:

  1. All selector expressions are based on binary values. To enforce these, we must manually add constraints of the form x^2=x for all values involved in selector expressions.
  2. All selector expressions are mutually exclusive. That is, for a given set of inputs, only one of the selector expressions in an enf > match statement can evaluate to 1, and all other selectors must evaluate to 0. Note: it is OK if all selector expressions evaluate to 0.

We should enforce it in the language: following PRs #413 and #423, we should be able to enforce that selectors are composed of binary expressions, and we could try all possible evaluations of the truth table to check by bruteforce it holds.

If the requirements do not hold, we should fail the compilation with an error message.

Originally posted by @Leo-Besancon in #413 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions