Skip to content

WIP: parameterise operators with boolean result by the result integer type

Lennard Gäher requested to merge lang-bool-param into master

This PR parameterises Caesium's operators with a "boolean" result (i.e. the comparison operators as well as the derived && and || operators) by a result integer type (which was hard-coded before to i32) as a step to use Caesium for modelling other C-like languages with different modelling of boolean results (e.g. Rust, which uses single-byte booleans).

Concretely, the changes can be summarised as:

  • add a parameter rit to the affected operators and use that for the operational semantics of these operators, replacing the i32 used before.
  • adapt the existing notations for these operators to reflect this.
  • add new derived notations in lang/c_notations.v that instantiate the operators with i32 so that the codegen for RefinedC does not need to be changed much, and change the Coq codegen to also import this new file.
  • adapt the typing proofs to work for the changed operators instantiated to i32. Possibly, it might be desirable to support other result types even for C and to generalize the proofs accordingly, but I'm not sure.

The existing examples in the repo compile with these changes, but I haven't tested more exhaustively yet.

Merge request reports