github.com/aakash4dev/cometbft@v0.38.2/spec/mempool/quint/Spells.qnt (about) 1 // -*- mode: Bluespec; -*- 2 module Spells{ 3 pure def require(cond: bool): bool = cond 4 5 pure def setEqualsOrOneEmpty(s: Set[x], t: Set[x]): bool = { 6 (s.size()==0 or t.size()==0) or s == t 7 } 8 9 pure def setSubsetOfAtMost(s: Set[x], max: int): Set[x] = { 10 if (max>=size(s)) s else oneOf(s.powerset().filter(u => size(u)==max)) 11 } 12 13 pure def mapValues(m: x -> y): Set[y] = { 14 m.keys().fold(Set(), (s, i) => s.union(Set(m.get(i)))) 15 } 16 17 pure def setChooseSome(s: Set[x]): x = { 18 head(s.fold(List(), (t,x) => t.append(x))) 19 } 20 21 pure def nonEmptyPowerset(s: Set[x]): Set[Set[x]] = { 22 s.powerset().exclude(Set(Set())) 23 } 24 25 }