runtimeverification / runtimeverification/mir-semantics

Inline Ty indices: replace ty(Int) references with actual type data

Open
#991 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area:semantics area:types priority:p2 status:triage type:feature
Dominant language
Python
Stars
52
Forks
5
PR merge metrics
No merged PRs in 30d

Description

Problem

Type information in the K semantics is accessed indirectly through Ty indices (ty(Int)). Every time type data is needed, a lookupTy(TY) call retrieves it from the type table.

This indirection:

  • Adds complexity and reduces readability of semantic rules
  • Creates extra simplification overhead for the Haskell backend

Proposal

Inline all Ty indices to actual type data, eliminating the lookupTy indirection layer.

The inlining could be done at the Python layer or at the stable-mir-json level. Recursive types (e.g., self-referential structs) are not a blocker — the current system already has mechanisms like typeof to express them.

Scope

TY / lookupTy appears ~81 times across the semantics files, primarily in:

  • rt/data.md, rt/types.md, rt/value.md
  • kmir.md, intrinsics.md

Acceptance Criteria

  • All lookupTy(TY) calls eliminated or replaced with direct type data
  • Existing tests pass

Contributor guide

No contributing guide indexed for this repository

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 by tracing TY and lookupTy across rt/data.md, rt/types.md, rt/value.md, kmir.md, and intrinsics.md, then determine whether inlining belongs at the Python layer or stable-mir-json level. Account for recursive types using the existing typeof mechanisms, and run the existing tests to verify that all lookupTy(TY) calls are eliminated or replaced while behavior remains intact.

Written by the indexing model from the issue text.

Assessment

Tech stack
haskell, python
Domain
compilers
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.