runtimeverification / runtimeverification/wasm-semantics

Make functions in `numeric.md` total `functional`

Open
#317 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
WebAssembly
Stars
106
Forks
24
PR merge metrics
No merged PRs in 30d

Description

Right now there are #Ceil side-condition generated by the backend for the operators defined in numeric.md:

    syntax Val ::= IValType "." IUnOp Int   [klabel(intUnOp)  , function] 
                 | FValType "." FUnOp Float [klabel(floatUnOp), function] 
 // --------------------------------------------------------------------- 
    syntax Val ::= IValType "." IBinOp Int   Int   [klabel(intBinOp)  , function] 
                 | FValType "." FBinOp Float Float [klabel(floatBinOp), function] 
 // ----------------------------------------------------------------------------- 
    syntax Val ::= IValType "." TestOp Int [klabel(intTestOp), function] 
 // -------------------------------------------------------------------- 
    syntax Val ::= IValType "." IRelOp Int   Int   [klabel(intRelOp)  , function] 
                 | FValType "." FRelOp Float Float [klabel(floatRelOp), function] 
 // ----------------------------------------------------------------------------- 
    syntax Val ::= AValType "." CvtOp Number [klabel(numberCvtOp), function] 
 // ------------------------------------------------------------------------ 

I'm pretty sure these all can be made functional, with the appropriate changes to the helper functions they use.

For example:

  • The functions #minWidth, #ctz, #popcnt, #round, #signed, #unsigned, #isInfinityOrNan, and truncFloat need to be made total.
  • rule FTYPE . sqrt => ... needs to either have (i) sqrtFloat be made functional in domains.k, or (ii) explicitely handle the cases that sqrtFloat does not.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in numeric.md, reviewing the listed operator definitions and helper functions such as #minWidth, #ctz, #popcnt, #round, #signed, #unsigned, #isInfinityOrNan, and truncFloat. Then inspect domains.k for sqrtFloat and determine whether it can be made functional or whether sqrt's unsupported cases need explicit handling; done means the operators no longer generate #Ceil side conditions.

Written by the indexing model from the issue text.

Assessment

Tech stack
wasm
Domain
compilers
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.