Skip to content

Conversation

jberthold
Copy link
Member

@jberthold jberthold commented Oct 15, 2025

Pervasive changes to the semantics and python client code to replace the lookup tables in the config (memory, functions, types) by lookup functions whose equations are generated from the SMIRInfo i.e., from the SMIR JSON , for each program.

Previously we had Map-sorted config cells functions, types and memory, which are now functions instead. The function equations have to be added and then compiled with the LLVM backend for it to work, but the configuration is much smaller and does not have any static data any more.

…g-to-K

* removed ADT Map
* followed decoding.md and kmir.py changes
@jberthold jberthold force-pushed the EXPERIMENT-compiling-to-K-generating-kore branch from 9ca31ce to 56ddf51 Compare October 17, 2025 00:12
Comment on lines -338 to +340
spec_file = tmp_path / f'{testname}.k'
gen_opts = GenSpecOpts(smir_json, spec_file, 'main')

proof_dir = tmp_path / 'proof'
prove_opts = ProveRawOpts(spec_file, proof_dir=proof_dir)

_kmir_gen_spec(gen_opts)
_kmir_prove_raw(prove_opts)

claim_labels = kmir.get_claim_index(spec_file).labels()
for label in claim_labels:
proof = Proof.read_proof_data(proof_dir, label)
assert proof.passed

prove_rs_opts = ProveRSOpts(rs_file=smir_json, smir=True)

PROVING_DIR = (Path(__file__).parent / 'data' / 'proving').resolve(strict=True)
PROVING_FILES = list(PROVING_DIR.glob('*-spec.k'))


@pytest.mark.parametrize(
'spec',
PROVING_FILES,
ids=[spec.stem for spec in PROVING_FILES],
)
def test_prove(spec: Path, tmp_path: Path, kmir: KMIR) -> None:
proof_dir = tmp_path / (spec.stem + 'proofs')
prove_opts = ProveRawOpts(spec, proof_dir=proof_dir)
_kmir_prove_raw(prove_opts)

claim_labels = kmir.get_claim_index(spec).labels()
for label in claim_labels:
proof = Proof.read_proof_data(proof_dir, label)
assert proof.passed
proof = KMIR.prove_rs(prove_rs_opts)
assert proof.passed
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have removed the single test that we had which was based on gen-spec and prove-raw, as well as switching the test_prove_termination suite to using prove_rs. This means the gen-spec and prove-raw commands are now untested. I would suggest removing them because they don't fit well with the changed execution in this PR.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, we should focus on features that are necessary to complete the proofs. Legacy and untested code should be removed.

Can you open an issue for tracking features that we should remove?

@jberthold jberthold changed the title Draft code for compiling SMIR JSON to kore Compiling SMIR JSON to kore to avoid static data in config Oct 17, 2025
Comment on lines -1365 to +1320
<memory> ALLOCMAP </memory>
requires ALLOC_ID in_keys(ALLOCMAP)
andBool lengthBytes(BYTES) ==Int 16 // fat pointer (assumes usize == u64)
requires isValue(lookupAlloc(ALLOC_ID))
andBool lengthBytes(BYTES) ==Int 16 // fat pointer (assumes usize == u64)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is now thunking instead of creating an AllocRef to data that could not be decoded.
Expected output for enum-two-refs-fail changes because of this.

@jberthold jberthold marked this pull request as ready for review October 17, 2025 05:52
Copy link
Contributor

@Stevengre Stevengre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! But I need to left some information in case I forgot the key point for this pr. The key changes in this pr:

  1. new functions in value.md to replace the original static configuration
  2. function rule generation in kmir.py

@jberthold
Copy link
Member Author

LGTM! But I need to left some information in case I forgot the key point for this pr. The key changes in this pr:

  1. new functions in value.md to replace the original static configuration
  2. function rule generation in kmir.py

I removed the notes file that had some explanations, but yes, that's exactly it.
Previously we had Map-sorted config cells functions, types and memory, which are now functions instead. The function equations have to be added and then compiled with the LLVM backend for it to work, but the configuration is much smaller and does not have any static data any more.

@jberthold jberthold merged commit f741dfd into master Oct 17, 2025
7 checks passed
@jberthold jberthold deleted the EXPERIMENT-compiling-to-K-generating-kore branch October 17, 2025 08:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants