Skip to content

Commit

Permalink
Merge branch 'main' into gabriela/counting-witnesses
Browse files Browse the repository at this point in the history
  • Loading branch information
bugarela authored Dec 16, 2024
2 parents 62ab7b8 + acdd6fb commit 1624048
Show file tree
Hide file tree
Showing 9 changed files with 50 additions and 9 deletions.
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed
### Security

## v0.22.4 -- 2024-11-19

### Added
### Changed
### Deprecated
### Removed
### Fixed

- Fixed a problem where traces other than the first one when `--n-traces` > 1
and `--mbt` is true had the incorrect `action_taken` and `nondet_picks` values
(#1553).

### Security

## v0.22.3 -- 2024-10-28

### Added
Expand Down
2 changes: 1 addition & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

- [Language tutorials](../tutorials/README.md)
- [Syntax specification](./lang.md)
- [Cheatsheet](./quint-cheatsheet.pdf)
- [Cheatsheet](./public/quint-cheatsheet.pdf)
- [API documentation for built-in operators](./builtin.md)

## Tooling
Expand Down
4 changes: 3 additions & 1 deletion quint/io-cli-tests.md
Original file line number Diff line number Diff line change
Expand Up @@ -894,14 +894,16 @@ rm out-itf-example.itf.json

<!-- !test in run with n-traces itf -->
```
quint run --out-itf=out-itf-example.itf.json --n-traces=3 --max-steps=5 --seed=123 ../examples/tutorials/coin.qnt
quint run --out-itf=out-itf-example.itf.json --n-traces=3 --mbt --max-steps=5 --seed=123 ../examples/tutorials/coin.qnt
cat out-itf-example0.itf.json | jq '.["#meta"].status'
cat out-itf-example1.itf.json | jq '.states[0].action_taken'
rm out-itf-example*.itf.json
```

<!-- !test out run with n-traces itf -->
```
"ok"
"init"
```

### Run to generate multiple ITF traces with violation
Expand Down
4 changes: 2 additions & 2 deletions quint/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion quint/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@informalsystems/quint",
"version": "0.22.3",
"version": "0.22.4",
"description": "Core tool for the Quint specification language",
"keywords": [
"temporal",
Expand Down
6 changes: 6 additions & 0 deletions quint/src/runtime/impl/VarStorage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,12 @@ export class VarStorage {
reset() {
this.vars.forEach(reg => (reg.value = initialRegisterValue(reg.name)))
this.nextVars.forEach(reg => (reg.value = initialRegisterValue(reg.name)))
if (this.storeMetadata) {
this.actionTaken = undefined
this.nondetPicks.forEach((_, key) => {
this.nondetPicks.set(key, undefined)
})
}
}

/**
Expand Down
19 changes: 16 additions & 3 deletions quint/src/runtime/impl/runtimeValue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1475,10 +1475,18 @@ class RuntimeValueMapSet extends RuntimeValueBase implements RuntimeValue {
const nindices = domainArr.length
const nvalues = rangeArr.length
function* gen() {
if (domainArr.length === 0 || rangeArr.length === 0) {
// yield nothing as an empty set produces the empty product
if (domainArr.length === 0) {
// To reflect the behaviour of TLC, an empty domain needs to give Set(Map())
yield rv.mkMap([])
return
}

if (rangeArr.length === 0) {
// To reflect the behaviour of TLC, an empty range needs to give Set()
// yields nothing
return
}

// generate `nmaps` maps by using number increments
const nmaps = nvalues ** nindices
for (let i = 0; i < nmaps; i++) {
Expand Down Expand Up @@ -1539,7 +1547,12 @@ class RuntimeValueMapSet extends RuntimeValueBase implements RuntimeValue {
}

const domainSize = domainSizeResult.value
if (domainSize === 0n || (rangeSizeResult.isRight() && rangeSizeResult.value === 0n)) {
if (domainSize === 0n) {
// To reflect the behaviour of TLC, an empty domain needs to give Set(Map())
return right(rv.mkMap([]))
}

if (rangeSizeResult.isRight() && rangeSizeResult.value === 0n) {
// the set of maps is empty, no way to pick a value
return left({ code: 'QNT501', message: 'Empty set of maps' })
}
Expand Down
2 changes: 1 addition & 1 deletion quint/src/version.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
// Generated by genversion.
export const version = '0.22.3'
export const version = '0.22.4'
6 changes: 6 additions & 0 deletions quint/test/runtime/compile.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -898,6 +898,12 @@ describe('compiling specs to runtime values', () => {
Map(2 -> 6, 3 -> 6))`,
'true'
)
assertResultAsString('Set().setOfMaps(Set(3, 5))', 'Set(Map())')

assertResultAsString('Set().setOfMaps(Set())', 'Set(Map())')

assertResultAsString('Set(1, 2).setOfMaps(Set())', 'Set()')

assertResultAsString('Set(2).setOfMaps(5.to(6))', 'Set(Map(Tup(2, 5)), Map(Tup(2, 6)))')
assertResultAsString('2.to(3).setOfMaps(Set(5))', 'Set(Map(Tup(2, 5), Tup(3, 5)))')
assertResultAsString('2.to(4).setOfMaps(5.to(8)).size()', '64')
Expand Down

0 comments on commit 1624048

Please sign in to comment.