code
stringlengths 26
870k
| docstring
stringlengths 1
65.6k
| func_name
stringlengths 1
194
| language
stringclasses 1
value | repo
stringlengths 8
68
| path
stringlengths 5
194
| url
stringlengths 46
254
| license
stringclasses 4
values |
---|---|---|---|---|---|---|---|
def subsorts(self, sort: KSort) -> frozenset[KSort]:
"""Return all subsorts of a given `KSort` by inspecting the definition."""
return self.subsort_table.get(sort, frozenset()) | Return all subsorts of a given `KSort` by inspecting the definition. | subsorts | python | runtimeverification/k | pyk/src/pyk/kast/outer.py | https://github.com/runtimeverification/k/blob/master/pyk/src/pyk/kast/outer.py | BSD-3-Clause |
def overloads(self) -> FrozenDict[str, frozenset[str]]:
"""Return a mapping from symbols to the sets of symbols that overload them."""
def lt(overloader: KProduction, overloaded: KProduction) -> bool:
assert overloader.klabel
assert overloaded.klabel
assert overloader.klabel.name != overloaded.klabel.name
assert Atts.OVERLOAD in overloader.att
assert Atts.OVERLOAD in overloaded.att
assert overloader.att[Atts.OVERLOAD] == overloaded.att[Atts.OVERLOAD]
overloader_sorts = [overloader.sort] + overloader.argument_sorts
overloaded_sorts = [overloaded.sort] + overloaded.argument_sorts
if len(overloader_sorts) != len(overloaded_sorts):
return False
less = False
for overloader_sort, overloaded_sort in zip(overloader_sorts, overloaded_sorts, strict=True):
if overloader_sort == overloaded_sort:
continue
if overloader_sort in self.subsorts(overloaded_sort):
less = True
continue
return False
return less
symbols_by_overload: dict[str, list[str]] = {}
for symbol in self.symbols:
prod = self.symbols[symbol]
if Atts.OVERLOAD in prod.att:
symbols_by_overload.setdefault(prod.att[Atts.OVERLOAD], []).append(symbol)
overloads: dict[str, list[str]] = {}
for _, symbols in symbols_by_overload.items():
for overloader in symbols:
for overloaded in symbols:
if overloader == overloaded:
continue
if lt(overloader=self.symbols[overloader], overloaded=self.symbols[overloaded]):
# Index by overloaded symbol, this way it is easy to look them up
overloads.setdefault(overloaded, []).append(overloader)
return FrozenDict({key: frozenset(values) for key, values in overloads.items()}) | Return a mapping from symbols to the sets of symbols that overload them. | overloads | python | runtimeverification/k | pyk/src/pyk/kast/outer.py | https://github.com/runtimeverification/k/blob/master/pyk/src/pyk/kast/outer.py | BSD-3-Clause |
def priorities(self) -> FrozenDict[str, frozenset[str]]:
"""Return a mapping from symbols to the sets of symbols with lower priority."""
syntax_priorities = (
sent for module in self.modules for sent in module.sentences if isinstance(sent, KSyntaxPriority)
)
relation = tuple(
pair
for syntax_priority in syntax_priorities
for highers, lowers in pairwise(syntax_priority.priorities)
for pair in product(highers, lowers)
)
return POSet(relation).image | Return a mapping from symbols to the sets of symbols with lower priority. | priorities | python | runtimeverification/k | pyk/src/pyk/kast/outer.py | https://github.com/runtimeverification/k/blob/master/pyk/src/pyk/kast/outer.py | BSD-3-Clause |
def sort(self, kast: KInner) -> KSort | None:
"""Compute the sort of a given term using best-effort simple sorting algorithm, returns `None` on algorithm failure."""
match kast:
case KToken(_, sort) | KVariable(_, sort):
return sort
case KRewrite(lhs, rhs):
lhs_sort = self.sort(lhs)
rhs_sort = self.sort(rhs)
if lhs_sort and rhs_sort:
return self.least_common_supersort(lhs_sort, rhs_sort)
return None
case KSequence(_):
return KSort('K')
case KApply(label, _):
sort, _ = self.resolve_sorts(label)
return sort
case _:
return None | Compute the sort of a given term using best-effort simple sorting algorithm, returns `None` on algorithm failure. | sort | python | runtimeverification/k | pyk/src/pyk/kast/outer.py | https://github.com/runtimeverification/k/blob/master/pyk/src/pyk/kast/outer.py | BSD-3-Clause |
def sort_strict(self, kast: KInner) -> KSort:
"""Compute the sort of a given term using best-effort simple sorting algorithm, dies on algorithm failure."""
sort = self.sort(kast)
if sort is None:
raise ValueError(f'Could not determine sort of term: {kast}')
return sort | Compute the sort of a given term using best-effort simple sorting algorithm, dies on algorithm failure. | sort_strict | python | runtimeverification/k | pyk/src/pyk/kast/outer.py | https://github.com/runtimeverification/k/blob/master/pyk/src/pyk/kast/outer.py | BSD-3-Clause |
def resolve_sorts(self, label: KLabel) -> tuple[KSort, tuple[KSort, ...]]:
"""Compute the result and argument sorts for a given production based on a `KLabel`."""
prod = self.symbols[label.name]
sorts = dict(zip(prod.params, label.params, strict=True))
def resolve(sort: KSort) -> KSort:
return sorts.get(sort, sort)
return resolve(prod.sort), tuple(resolve(sort) for sort in prod.argument_sorts) | Compute the result and argument sorts for a given production based on a `KLabel`. | resolve_sorts | python | runtimeverification/k | pyk/src/pyk/kast/outer.py | https://github.com/runtimeverification/k/blob/master/pyk/src/pyk/kast/outer.py | BSD-3-Clause |
def least_common_supersort(self, sort1: KSort, sort2: KSort) -> KSort | None:
"""Compute the lowest-upper-bound of two sorts in the sort lattice using very simple approach, returning `None` on failure (not necessarily meaning there isn't a lub)."""
if sort1 == sort2:
return sort1
if sort1 in self.subsorts(sort2):
return sort2
if sort2 in self.subsorts(sort1):
return sort1
# Computing least common supersort is not currently supported if sort1 is not a subsort of sort2 or
# vice versa. In that case there may be more than one LCS.
return None | Compute the lowest-upper-bound of two sorts in the sort lattice using very simple approach, returning `None` on failure (not necessarily meaning there isn't a lub). | least_common_supersort | python | runtimeverification/k | pyk/src/pyk/kast/outer.py | https://github.com/runtimeverification/k/blob/master/pyk/src/pyk/kast/outer.py | BSD-3-Clause |
def greatest_common_subsort(self, sort1: KSort, sort2: KSort) -> KSort | None:
"""Compute the greatest-lower-bound of two sorts in the sort lattice using very simple approach, returning `None` on failure (not necessarily meaning there isn't a glb)."""
if sort1 == sort2:
return sort1
if sort1 in self.subsorts(sort2):
return sort1
if sort2 in self.subsorts(sort1):
return sort2
# Computing greatest common subsort is not currently supported if sort1 is not a subsort of sort2 or
# vice versa. In that case there may be more than one GCS.
return None | Compute the greatest-lower-bound of two sorts in the sort lattice using very simple approach, returning `None` on failure (not necessarily meaning there isn't a glb). | greatest_common_subsort | python | runtimeverification/k | pyk/src/pyk/kast/outer.py | https://github.com/runtimeverification/k/blob/master/pyk/src/pyk/kast/outer.py | BSD-3-Clause |
def add_ksequence_under_k_productions(self, kast: KInner) -> KInner:
"""Inject a `KSequence` under the given term if it's a subsort of `K` and is being used somewhere that sort `K` is expected (determined by inspecting the definition)."""
def _add_ksequence_under_k_productions(_kast: KInner) -> KInner:
if type(_kast) is not KApply:
return _kast
prod = self.symbols[_kast.label.name]
return KApply(
_kast.label,
[
KSequence(arg) if sort.name == 'K' and not self.sort(arg) == KSort('K') else arg
for arg, sort in zip(_kast.args, prod.argument_sorts, strict=True)
],
)
return top_down(_add_ksequence_under_k_productions, kast) | Inject a `KSequence` under the given term if it's a subsort of `K` and is being used somewhere that sort `K` is expected (determined by inspecting the definition). | add_ksequence_under_k_productions | python | runtimeverification/k | pyk/src/pyk/kast/outer.py | https://github.com/runtimeverification/k/blob/master/pyk/src/pyk/kast/outer.py | BSD-3-Clause |
def sort_vars(self, kast: KInner, sort: KSort | None = None) -> KInner:
"""Return the original term with all the variables having the sorts added or specialized, failing if recieving conflicting sorts for a given variable."""
if type(kast) is KVariable and kast.sort is None and sort is not None:
return kast.let(sort=sort)
def get_quantifier_variable(q: KApply) -> KVariable:
if q.arity != 2:
raise ValueError(f'Expected a quantifier to have 2 children, got {q.arity}.')
var = q.args[0]
if not isinstance(var, KVariable):
raise ValueError(f"Expected a quantifier's first child to be a variable, got {type(var)}.")
return var
def merge_variables(
term: KInner, occurrences_list: list[dict[str, list[KVariable]]]
) -> dict[str, list[KVariable]]:
result: dict[str, list[KVariable]] = defaultdict(list)
for occurrences in occurrences_list:
assert isinstance(occurrences, dict), type(occurrences)
for key, value in occurrences.items():
result[key] += value
if isinstance(term, KVariable):
result[term.name].append(term)
elif isinstance(term, KApply):
if term.label.name in ML_QUANTIFIERS:
var = get_quantifier_variable(term)
result[var.name].append(var)
return result
def add_var_to_subst(vname: str, vars: list[KVariable], subst: dict[str, KVariable]) -> None:
vsorts = list(unique(v.sort for v in vars if v.sort is not None))
if len(vsorts) > 0:
vsort = vsorts[0]
for s in vsorts[1:]:
_vsort = self.greatest_common_subsort(vsort, s)
if _vsort is None:
raise ValueError(f'Cannot compute greatest common subsort of {vname}: {(vsort, s)}')
vsort = _vsort
subst[vname] = KVariable(vname, sort=vsort)
def transform(
term: KInner, child_variables: list[dict[str, list[KVariable]]]
) -> tuple[KInner, dict[str, list[KVariable]]]:
occurrences = merge_variables(term, child_variables)
if isinstance(term, KApply):
if term.label.name in ML_QUANTIFIERS:
var = get_quantifier_variable(term)
subst: dict[str, KVariable] = {}
add_var_to_subst(var.name, occurrences[var.name], subst)
del occurrences[var.name]
return (Subst(subst)(term), occurrences)
else:
prod = self.symbols[term.label.name]
if len(prod.params) == 0:
for t, a in zip(prod.argument_sorts, term.args, strict=True):
if type(a) is KVariable:
occurrences[a.name].append(a.let_sort(t))
elif isinstance(term, KSequence) and term.arity > 0:
for a in term.items[0:-1]:
if type(a) is KVariable:
occurrences[a.name].append(a.let_sort(KSort('KItem')))
last_a = term.items[-1]
if type(last_a) is KVariable:
occurrences[last_a.name].append(last_a.let_sort(KSort('K')))
return (term, occurrences)
(new_term, var_occurrences) = bottom_up_with_summary(transform, kast)
subst: dict[str, KVariable] = {}
for vname, occurrences in var_occurrences.items():
add_var_to_subst(vname, occurrences, subst)
return Subst(subst)(new_term) | Return the original term with all the variables having the sorts added or specialized, failing if recieving conflicting sorts for a given variable. | sort_vars | python | runtimeverification/k | pyk/src/pyk/kast/outer.py | https://github.com/runtimeverification/k/blob/master/pyk/src/pyk/kast/outer.py | BSD-3-Clause |
def add_sort_params(self, kast: KInner) -> KInner:
"""Return a given term with the sort parameters on the `KLabel` filled in (which may be missing because of how the frontend works), best effort."""
def _add_sort_params(_k: KInner) -> KInner:
if type(_k) is KApply:
prod = self.symbols[_k.label.name]
if len(_k.label.params) == 0 and len(prod.params) > 0:
sort_dict: dict[KSort, KSort] = {}
for psort, asort in zip(prod.argument_sorts, map(self.sort, _k.args), strict=True):
if asort is None:
_LOGGER.warning(
f'Failed to add sort parameter, unable to determine sort for argument in production: {(prod, psort, asort)}'
)
return _k
if psort in prod.params:
if psort in sort_dict and sort_dict[psort] != asort:
_LOGGER.warning(
f'Failed to add sort parameter, sort mismatch between different occurances of sort parameter: {(prod, psort, sort_dict[psort], asort)}'
)
return _k
elif psort not in sort_dict:
sort_dict[psort] = asort
if all(p in sort_dict for p in prod.params):
return _k.let(label=KLabel(_k.label.name, [sort_dict[p] for p in prod.params]))
return _k
return bottom_up(_add_sort_params, kast) | Return a given term with the sort parameters on the `KLabel` filled in (which may be missing because of how the frontend works), best effort. | add_sort_params | python | runtimeverification/k | pyk/src/pyk/kast/outer.py | https://github.com/runtimeverification/k/blob/master/pyk/src/pyk/kast/outer.py | BSD-3-Clause |
def add_cell_map_items(self, kast: KInner) -> KInner:
"""Wrap cell-map items in the syntactical wrapper that the frontend generates for them (see `KDefinition.remove_cell_map_items`)."""
# example:
# syntax AccountCellMap [cellCollection, hook(MAP.Map)]
# syntax AccountCellMap ::= AccountCellMap AccountCellMap [assoc, avoid, cellCollection, comm, element(AccountCellMapItem), function, hook(MAP.concat), unit(.AccountCellMap), wrapElement(<account>)]
cell_wrappers = {}
for ccp in self.cell_collection_productions:
if Atts.ELEMENT in ccp.att and Atts.WRAP_ELEMENT in ccp.att:
cell_wrappers[ccp.att[Atts.WRAP_ELEMENT]] = ccp.att[Atts.ELEMENT]
def _wrap_elements(_k: KInner) -> KInner:
if type(_k) is KApply and _k.label.name in cell_wrappers:
return KApply(cell_wrappers[_k.label.name], [_k.args[0], _k])
return _k
# To ensure we don't get duplicate wrappers.
_kast = self.remove_cell_map_items(kast)
return bottom_up(_wrap_elements, _kast) | Wrap cell-map items in the syntactical wrapper that the frontend generates for them (see `KDefinition.remove_cell_map_items`). | add_cell_map_items | python | runtimeverification/k | pyk/src/pyk/kast/outer.py | https://github.com/runtimeverification/k/blob/master/pyk/src/pyk/kast/outer.py | BSD-3-Clause |
def remove_cell_map_items(self, kast: KInner) -> KInner:
"""Remove cell-map syntactical wrapper items that the frontend generates (see `KDefinition.add_cell_map_items`)."""
# example:
# syntax AccountCellMap [cellCollection, hook(MAP.Map)]
# syntax AccountCellMap ::= AccountCellMap AccountCellMap [assoc, avoid, cellCollection, comm, element(AccountCellMapItem), function, hook(MAP.concat), unit(.AccountCellMap), wrapElement(<account>)]
cell_wrappers = {}
for ccp in self.cell_collection_productions:
if Atts.ELEMENT in ccp.att and Atts.WRAP_ELEMENT in ccp.att:
cell_wrappers[ccp.att[Atts.ELEMENT]] = ccp.att[Atts.WRAP_ELEMENT]
def _wrap_elements(_k: KInner) -> KInner:
if (
type(_k) is KApply
and _k.label.name in cell_wrappers
and len(_k.args) == 2
and type(_k.args[1]) is KApply
and _k.args[1].label.name == cell_wrappers[_k.label.name]
):
return _k.args[1]
return _k
return bottom_up(_wrap_elements, kast) | Remove cell-map syntactical wrapper items that the frontend generates (see `KDefinition.add_cell_map_items`). | remove_cell_map_items | python | runtimeverification/k | pyk/src/pyk/kast/outer.py | https://github.com/runtimeverification/k/blob/master/pyk/src/pyk/kast/outer.py | BSD-3-Clause |
def empty_config(self, sort: KSort) -> KInner:
"""Given a cell-sort, compute an "empty" configuration for it (all the constructor structure of the configuration in place, but variables in cell positions)."""
if sort not in self._empty_config:
self._empty_config[sort] = self._compute_empty_config(sort)
return self._empty_config[sort] | Given a cell-sort, compute an "empty" configuration for it (all the constructor structure of the configuration in place, but variables in cell positions). | empty_config | python | runtimeverification/k | pyk/src/pyk/kast/outer.py | https://github.com/runtimeverification/k/blob/master/pyk/src/pyk/kast/outer.py | BSD-3-Clause |
def instantiate_cell_vars(self, term: KInner) -> KInner:
"""Given a partially-complete configuration, find positions where there could be more cell structure but instead there are variables and instantiate more cell structure."""
def _cell_vars_to_labels(_kast: KInner) -> KInner:
if type(_kast) is KApply and _kast.is_cell:
production = self.symbols[_kast.label.name]
production_arity = [item.sort for item in production.non_terminals]
new_args = []
for sort, arg in zip(production_arity, _kast.args, strict=True):
if sort.name.endswith('Cell') and type(arg) is KVariable:
new_args.append(self.empty_config(sort))
else:
new_args.append(arg)
return KApply(_kast.label, new_args)
return _kast
return bottom_up(_cell_vars_to_labels, term) | Given a partially-complete configuration, find positions where there could be more cell structure but instead there are variables and instantiate more cell structure. | instantiate_cell_vars | python | runtimeverification/k | pyk/src/pyk/kast/outer.py | https://github.com/runtimeverification/k/blob/master/pyk/src/pyk/kast/outer.py | BSD-3-Clause |
def init_config(self, sort: KSort) -> KInner:
"""Return an initialized configuration as the user declares it in the semantics, complete with configuration variables in place."""
if sort not in self._init_config:
self._init_config[sort] = self._compute_init_config(sort)
return self._init_config[sort] | Return an initialized configuration as the user declares it in the semantics, complete with configuration variables in place. | init_config | python | runtimeverification/k | pyk/src/pyk/kast/outer.py | https://github.com/runtimeverification/k/blob/master/pyk/src/pyk/kast/outer.py | BSD-3-Clause |
def read_kast_definition(path: str | PathLike) -> KDefinition:
"""Read a `KDefinition` from disk, failing if it's not actually a `KDefinition`."""
with open(path) as f:
_LOGGER.info(f'Loading JSON definition: {path}')
json_defn = json.load(f)
_LOGGER.info(f'Converting JSON definition to Kast: {path}')
return KDefinition.from_dict(kast_term(json_defn)) | Read a `KDefinition` from disk, failing if it's not actually a `KDefinition`. | read_kast_definition | python | runtimeverification/k | pyk/src/pyk/kast/outer.py | https://github.com/runtimeverification/k/blob/master/pyk/src/pyk/kast/outer.py | BSD-3-Clause |
def print(self, kast: KAst) -> str:
"""Print out KAST terms/outer syntax.
Args:
kast: KAST term to print.
Returns:
Best-effort string representation of KAST term.
"""
_LOGGER.debug(f'Unparsing: {kast}')
if type(kast) is KAtt:
return self._print_katt(kast)
if type(kast) is KSort:
return self._print_ksort(kast)
if type(kast) is KLabel:
return self._print_klabel(kast)
elif isinstance(kast, KOuter):
return self._print_kouter(kast)
elif isinstance(kast, KInner):
if self._unalias:
kast = undo_aliases(self.definition, kast)
if self._sort_collections:
kast = sort_ac_collections(kast)
return self._print_kinner(kast)
raise AssertionError(f'Error unparsing: {kast}') | Print out KAST terms/outer syntax.
Args:
kast: KAST term to print.
Returns:
Best-effort string representation of KAST term. | print | python | runtimeverification/k | pyk/src/pyk/kast/pretty.py | https://github.com/runtimeverification/k/blob/master/pyk/src/pyk/kast/pretty.py | BSD-3-Clause |
def _print_kast_bool(self, kast: KAst) -> str:
"""Print out KAST requires/ensures clause.
Args:
kast: KAST Bool for requires/ensures clause.
Returns:
Best-effort string representation of KAST term.
"""
_LOGGER.debug(f'_print_kast_bool: {kast}')
if type(kast) is KApply and kast.label.name in ['_andBool_', '_orBool_']:
clauses = [self._print_kast_bool(c) for c in flatten_label(kast.label.name, kast)]
head = kast.label.name.replace('_', ' ')
if head == ' orBool ':
head = ' orBool '
separator = ' ' * (len(head) - 7)
spacer = ' ' * len(head)
def join_sep(s: str) -> str:
return ('\n' + separator).join(s.split('\n'))
clauses = (
['( ' + join_sep(clauses[0])]
+ [head + '( ' + join_sep(c) for c in clauses[1:]]
+ [spacer + (')' * len(clauses))]
)
return '\n'.join(clauses)
else:
return self.print(kast) | Print out KAST requires/ensures clause.
Args:
kast: KAST Bool for requires/ensures clause.
Returns:
Best-effort string representation of KAST term. | _print_kast_bool | python | runtimeverification/k | pyk/src/pyk/kast/pretty.py | https://github.com/runtimeverification/k/blob/master/pyk/src/pyk/kast/pretty.py | BSD-3-Clause |
def build_symbol_table(
definition: KDefinition,
extra_modules: Iterable[KFlatModule] = (),
opinionated: bool = False,
) -> SymbolTable:
"""Build the unparsing symbol table given a JSON encoded definition.
Args:
definition: JSON encoded K definition.
Returns:
Python dictionary mapping klabels to automatically generated unparsers.
"""
symbol_table = {}
all_modules = list(definition.all_modules) + ([] if extra_modules is None else list(extra_modules))
for module in all_modules:
for prod in module.syntax_productions:
assert prod.klabel
label = prod.klabel.name
unparser = unparser_for_production(prod)
symbol_table[label] = unparser
if Atts.SYMBOL in prod.att:
symbol_table[prod.att[Atts.SYMBOL]] = unparser
if opinionated:
symbol_table['#And'] = lambda c1, c2: c1 + '\n#And ' + c2
symbol_table['#Or'] = lambda c1, c2: c1 + '\n#Or\n' + indent(c2, size=4)
return symbol_table | Build the unparsing symbol table given a JSON encoded definition.
Args:
definition: JSON encoded K definition.
Returns:
Python dictionary mapping klabels to automatically generated unparsers. | build_symbol_table | python | runtimeverification/k | pyk/src/pyk/kast/pretty.py | https://github.com/runtimeverification/k/blob/master/pyk/src/pyk/kast/pretty.py | BSD-3-Clause |
def parse_rule_applications(haskell_backend_oneline_log_file: Path) -> dict[HaskellLogEntry, dict[str, int]]:
"""Process a one-line log file produced by K's Haskell backend.
Extracts information about:
- Applied rewrites (DebugAppliedRewriteRules).
- Applied simplifications (DEBUG_APPLY_EQUATION).
Note:
Haskell backend logs often contain rule applications with empty locations.
It seems likely that those are generated projection rules.
We report their applications in bulk with UNKNOWN location.
"""
rewrites: dict[str, int] = defaultdict(int)
simplifications: dict[str, int] = defaultdict(int)
log_entries = haskell_backend_oneline_log_file.read_text().splitlines()
for log_entry in log_entries:
parsed = _parse_haskell_oneline_log(log_entry)
if parsed:
entry_type, location_str = parsed
else:
_LOGGER.warning(f'Skipping log entry, failed to parse: {log_entry}')
continue
if location_str == '':
location_str = 'UNKNOWN'
if entry_type == HaskellLogEntry.DEBUG_APPLIED_REWRITE_RULES:
rewrites[location_str] += 1
else:
assert entry_type == HaskellLogEntry.DEBUG_APPLY_EQUATION
simplifications[location_str] += 1
return {
HaskellLogEntry.DEBUG_APPLIED_REWRITE_RULES: rewrites,
HaskellLogEntry.DEBUG_APPLY_EQUATION: simplifications,
} | Process a one-line log file produced by K's Haskell backend.
Extracts information about:
- Applied rewrites (DebugAppliedRewriteRules).
- Applied simplifications (DEBUG_APPLY_EQUATION).
Note:
Haskell backend logs often contain rule applications with empty locations.
It seems likely that those are generated projection rules.
We report their applications in bulk with UNKNOWN location. | parse_rule_applications | python | runtimeverification/k | pyk/src/pyk/kore_exec_covr/kore_exec_covr.py | https://github.com/runtimeverification/k/blob/master/pyk/src/pyk/kore_exec_covr/kore_exec_covr.py | BSD-3-Clause |
def _parse_haskell_oneline_log(log_entry: str) -> tuple[HaskellLogEntry, str] | None:
"""Attempt to parse a one-line log string emmitted by K's Haskell backend."""
matches = _HASKELL_LOG_ENTRY_REGEXP.match(log_entry)
try:
assert matches
entry = matches.groups()[1]
location_str = matches.groups()[2].strip()
return HaskellLogEntry(entry), location_str
except (AssertionError, KeyError, ValueError):
return None | Attempt to parse a one-line log string emmitted by K's Haskell backend. | _parse_haskell_oneline_log | python | runtimeverification/k | pyk/src/pyk/kore_exec_covr/kore_exec_covr.py | https://github.com/runtimeverification/k/blob/master/pyk/src/pyk/kore_exec_covr/kore_exec_covr.py | BSD-3-Clause |
def build_rule_dict(
definition: KDefinition, *, skip_projections: bool = True, skip_initializers: bool = True
) -> dict[str, KRule]:
"""Traverse the kompiled definition and build a dictionary mapping str(file:location) to KRule."""
rule_dict: dict[str, KRule] = {}
for rule in definition.rules:
if skip_projections and Atts.PROJECTION in rule.att:
continue
if skip_initializers and Atts.INITIALIZER in rule.att:
continue
try:
rule_source = rule.att[Atts.SOURCE]
rule_location = rule.att[Atts.LOCATION]
except KeyError:
_LOGGER.warning(f'Skipping rule with no location information {str(rule.body):.100}...<truncated>')
rule_source = None
rule_location = None
continue
if rule_source and rule_location:
rule_dict[f'{rule_source}:{_location_tuple_to_str(rule_location)}'] = rule
else:
raise ValueError(str(rule.body))
return rule_dict | Traverse the kompiled definition and build a dictionary mapping str(file:location) to KRule. | build_rule_dict | python | runtimeverification/k | pyk/src/pyk/kore_exec_covr/kore_exec_covr.py | https://github.com/runtimeverification/k/blob/master/pyk/src/pyk/kore_exec_covr/kore_exec_covr.py | BSD-3-Clause |
def do_analyze(definition_dir: Path, input_file: Path) -> None:
"""Analyze log file.
Args:
definition_dir: Definition kompiled with ``kompile --backend haskell --emit-json``.
input_file: Log file produced with
``KORE_EXEC_OPTS='--log-format oneline --log-entries DebugAppliedRewriteRules,DebugApplyEquation'``.
Returns:
Human-readable report of applied rewrite and simplification rules,
with labels (if declared) and locations.
"""
definition = read_kast_definition(definition_dir / 'compiled.json')
print(f'Discovering rewrite and simplification rules in {definition_dir}')
rule_dict = build_rule_dict(definition)
defined_rewrites: dict[str, int] = {
key: 0 for key, rule in rule_dict.items() if not Atts.SIMPLIFICATION in rule.att
}
defined_simplifications: dict[str, int] = {
key: 0 for key, rule in rule_dict.items() if Atts.SIMPLIFICATION in rule.att
}
print(f' Found {len(defined_rewrites)} rewrite rules availible for {definition.main_module_name}')
print(f' Found {len(defined_simplifications)} simplification rules availible for {definition.main_module_name}')
parsed_rule_applictions = parse_rule_applications(input_file)
applied_rewrites = parsed_rule_applictions[HaskellLogEntry.DEBUG_APPLIED_REWRITE_RULES]
applied_simplifications = parsed_rule_applictions[HaskellLogEntry.DEBUG_APPLY_EQUATION]
print('=================================')
print('=== REWRITES ====================')
print('=================================')
for location_str, hits in applied_rewrites.items():
rule_label_str = ''
if location_str in rule_dict and Atts.LABEL in rule_dict[location_str].att:
rule_label_str = f'[{rule_dict[location_str].att[Atts.LABEL]}]'
if hits > 0:
print(f' {hits} applications of rule {rule_label_str} defined at {location_str}')
total_rewrites = sum([v for v in applied_rewrites.values() if v > 0])
print(f'Total rewrites applied: {total_rewrites}')
print('=================================')
print('=== SIMPLIFICATIONS =============')
print('=================================')
for location_str, hits in applied_simplifications.items():
rule_label_str = ''
if location_str in rule_dict and Atts.SYMBOL in rule_dict[location_str].att:
rule_label_str = f'[{rule_dict[location_str].att[Atts.SYMBOL]}]'
if hits > 0:
print(f' {hits} applications of rule {rule_label_str} defined at {location_str}')
total_simplifications = sum([v for v in applied_simplifications.values() if v > 0])
print(f'Total applied simplifications: {total_simplifications}') | Analyze log file.
Args:
definition_dir: Definition kompiled with ``kompile --backend haskell --emit-json``.
input_file: Log file produced with
``KORE_EXEC_OPTS='--log-format oneline --log-entries DebugAppliedRewriteRules,DebugApplyEquation'``.
Returns:
Human-readable report of applied rewrite and simplification rules,
with labels (if declared) and locations. | do_analyze | python | runtimeverification/k | pyk/src/pyk/kore_exec_covr/__main__.py | https://github.com/runtimeverification/k/blob/master/pyk/src/pyk/kore_exec_covr/__main__.py | BSD-3-Clause |
def rule_ordinal(self) -> int:
"""Return the axiom ordinal number of the rewrite rule.
The rule ordinal represents the `nth` axiom in the kore definition.
"""
... | Return the axiom ordinal number of the rewrite rule.
The rule ordinal represents the `nth` axiom in the kore definition. | rule_ordinal | python | runtimeverification/k | pyk/src/pyk/kllvm/hints/prooftrace.py | https://github.com/runtimeverification/k/blob/master/pyk/src/pyk/kllvm/hints/prooftrace.py | BSD-3-Clause |
def substitution(self) -> dict[str, Pattern]:
"""Returns the substitution dictionary used to perform the rewrite represented by this event."""
... | Returns the substitution dictionary used to perform the rewrite represented by this event. | substitution | python | runtimeverification/k | pyk/src/pyk/kllvm/hints/prooftrace.py | https://github.com/runtimeverification/k/blob/master/pyk/src/pyk/kllvm/hints/prooftrace.py | BSD-3-Clause |
def __init__(self, rule_event: llvm_rule_event) -> None:
"""Initialize a new instance of the LLVMRuleEvent class.
Args:
rule_event (llvm_rule_event): The LLVM rule event object.
"""
self._rule_event = rule_event | Initialize a new instance of the LLVMRuleEvent class.
Args:
rule_event (llvm_rule_event): The LLVM rule event object. | __init__ | python | runtimeverification/k | pyk/src/pyk/kllvm/hints/prooftrace.py | https://github.com/runtimeverification/k/blob/master/pyk/src/pyk/kllvm/hints/prooftrace.py | BSD-3-Clause |
def __repr__(self) -> str:
"""Return a string representation of the object.
Returns:
A string representation of the LLVMRuleEvent object using the AST printing method.
"""
return self._rule_event.__repr__() | Return a string representation of the object.
Returns:
A string representation of the LLVMRuleEvent object using the AST printing method. | __repr__ | python | runtimeverification/k | pyk/src/pyk/kllvm/hints/prooftrace.py | https://github.com/runtimeverification/k/blob/master/pyk/src/pyk/kllvm/hints/prooftrace.py | BSD-3-Clause |
def rule_ordinal(self) -> int:
"""Returns the axiom ordinal number of the rule event."""
return self._rule_event.rule_ordinal | Returns the axiom ordinal number of the rule event. | rule_ordinal | python | runtimeverification/k | pyk/src/pyk/kllvm/hints/prooftrace.py | https://github.com/runtimeverification/k/blob/master/pyk/src/pyk/kllvm/hints/prooftrace.py | BSD-3-Clause |
def substitution(self) -> dict[str, Pattern]:
"""Returns the substitution dictionary used to perform the rewrite represented by this rule event."""
return {k: v[0] for k, v in self._rule_event.substitution.items()} | Returns the substitution dictionary used to perform the rewrite represented by this rule event. | substitution | python | runtimeverification/k | pyk/src/pyk/kllvm/hints/prooftrace.py | https://github.com/runtimeverification/k/blob/master/pyk/src/pyk/kllvm/hints/prooftrace.py | BSD-3-Clause |
def __init__(self, side_condition_event: llvm_side_condition_event) -> None:
"""Initialize a new instance of the LLVMSideConditionEventEnter class.
Args:
side_condition_event (llvm_side_condition_event): The LLVM side condition event object.
"""
self._side_condition_event = side_condition_event | Initialize a new instance of the LLVMSideConditionEventEnter class.
Args:
side_condition_event (llvm_side_condition_event): The LLVM side condition event object. | __init__ | python | runtimeverification/k | pyk/src/pyk/kllvm/hints/prooftrace.py | https://github.com/runtimeverification/k/blob/master/pyk/src/pyk/kllvm/hints/prooftrace.py | BSD-3-Clause |
def __repr__(self) -> str:
"""Return a string representation of the object.
Returns:
A string representation of the LLVMSideConditionEventEnter object using the AST printing method.
"""
return self._side_condition_event.__repr__() | Return a string representation of the object.
Returns:
A string representation of the LLVMSideConditionEventEnter object using the AST printing method. | __repr__ | python | runtimeverification/k | pyk/src/pyk/kllvm/hints/prooftrace.py | https://github.com/runtimeverification/k/blob/master/pyk/src/pyk/kllvm/hints/prooftrace.py | BSD-3-Clause |
def rule_ordinal(self) -> int:
"""Returns the axiom ordinal number associated with the side condition event."""
return self._side_condition_event.rule_ordinal | Returns the axiom ordinal number associated with the side condition event. | rule_ordinal | python | runtimeverification/k | pyk/src/pyk/kllvm/hints/prooftrace.py | https://github.com/runtimeverification/k/blob/master/pyk/src/pyk/kllvm/hints/prooftrace.py | BSD-3-Clause |
def substitution(self) -> dict[str, Pattern]:
"""Returns the substitution dictionary used to perform the rewrite represented by this side condition event."""
return {k: v[0] for k, v in self._side_condition_event.substitution.items()} | Returns the substitution dictionary used to perform the rewrite represented by this side condition event. | substitution | python | runtimeverification/k | pyk/src/pyk/kllvm/hints/prooftrace.py | https://github.com/runtimeverification/k/blob/master/pyk/src/pyk/kllvm/hints/prooftrace.py | BSD-3-Clause |
def __init__(self, side_condition_end_event: llvm_side_condition_end_event) -> None:
"""Initialize a new instance of the LLVMSideConditionEventExit class.
Args:
side_condition_end_event (llvm_side_condition_end_event): The LLVM side condition end event object.
"""
self._side_condition_end_event = side_condition_end_event | Initialize a new instance of the LLVMSideConditionEventExit class.
Args:
side_condition_end_event (llvm_side_condition_end_event): The LLVM side condition end event object. | __init__ | python | runtimeverification/k | pyk/src/pyk/kllvm/hints/prooftrace.py | https://github.com/runtimeverification/k/blob/master/pyk/src/pyk/kllvm/hints/prooftrace.py | BSD-3-Clause |
def __repr__(self) -> str:
"""Return a string representation of the object.
Returns:
A string representation of the LLVMSideConditionEventExit object using the AST printing method.
"""
return self._side_condition_end_event.__repr__() | Return a string representation of the object.
Returns:
A string representation of the LLVMSideConditionEventExit object using the AST printing method. | __repr__ | python | runtimeverification/k | pyk/src/pyk/kllvm/hints/prooftrace.py | https://github.com/runtimeverification/k/blob/master/pyk/src/pyk/kllvm/hints/prooftrace.py | BSD-3-Clause |
def rule_ordinal(self) -> int:
"""Return the axiom ordinal number associated with the side condition event."""
return self._side_condition_end_event.rule_ordinal | Return the axiom ordinal number associated with the side condition event. | rule_ordinal | python | runtimeverification/k | pyk/src/pyk/kllvm/hints/prooftrace.py | https://github.com/runtimeverification/k/blob/master/pyk/src/pyk/kllvm/hints/prooftrace.py | BSD-3-Clause |
def check_result(self) -> bool:
"""Return the boolean result of the evaluation of the side condition that corresponds to this event."""
return self._side_condition_end_event.check_result | Return the boolean result of the evaluation of the side condition that corresponds to this event. | check_result | python | runtimeverification/k | pyk/src/pyk/kllvm/hints/prooftrace.py | https://github.com/runtimeverification/k/blob/master/pyk/src/pyk/kllvm/hints/prooftrace.py | BSD-3-Clause |
def __init__(self, pattern_matching_failure_event: llvm_pattern_matching_failure_event) -> None:
"""Initialize a new instance of the LLVMPatternMatchingFailureEvent class.
Args:
pattern_matching_failure_event (llvm_pattern_matching_failure_event): The LLVM pattern matching failure event object.
"""
self._pattern_matching_failure_event = pattern_matching_failure_event | Initialize a new instance of the LLVMPatternMatchingFailureEvent class.
Args:
pattern_matching_failure_event (llvm_pattern_matching_failure_event): The LLVM pattern matching failure event object. | __init__ | python | runtimeverification/k | pyk/src/pyk/kllvm/hints/prooftrace.py | https://github.com/runtimeverification/k/blob/master/pyk/src/pyk/kllvm/hints/prooftrace.py | BSD-3-Clause |
def __repr__(self) -> str:
"""Return a string representation of the object.
Returns:
A string representation of the LLVMPatternMatchingFailureEvent object using the AST printing method.
"""
return self._pattern_matching_failure_event.__repr__() | Return a string representation of the object.
Returns:
A string representation of the LLVMPatternMatchingFailureEvent object using the AST printing method. | __repr__ | python | runtimeverification/k | pyk/src/pyk/kllvm/hints/prooftrace.py | https://github.com/runtimeverification/k/blob/master/pyk/src/pyk/kllvm/hints/prooftrace.py | BSD-3-Clause |
def function_name(self) -> str:
"""Return the name of the function that failed to match the pattern."""
return self._pattern_matching_failure_event.function_name | Return the name of the function that failed to match the pattern. | function_name | python | runtimeverification/k | pyk/src/pyk/kllvm/hints/prooftrace.py | https://github.com/runtimeverification/k/blob/master/pyk/src/pyk/kllvm/hints/prooftrace.py | BSD-3-Clause |
def __init__(self, function_event: llvm_function_event) -> None:
"""Initialize a new instance of the LLVMFunctionEvent class.
Args:
function_event (llvm_function_event): The LLVM function event object.
"""
self._function_event = function_event | Initialize a new instance of the LLVMFunctionEvent class.
Args:
function_event (llvm_function_event): The LLVM function event object. | __init__ | python | runtimeverification/k | pyk/src/pyk/kllvm/hints/prooftrace.py | https://github.com/runtimeverification/k/blob/master/pyk/src/pyk/kllvm/hints/prooftrace.py | BSD-3-Clause |
def __repr__(self) -> str:
"""Return a string representation of the object.
Returns:
A string representation of the LLVMFunctionEvent object using the AST printing method.
"""
return self._function_event.__repr__() | Return a string representation of the object.
Returns:
A string representation of the LLVMFunctionEvent object using the AST printing method. | __repr__ | python | runtimeverification/k | pyk/src/pyk/kllvm/hints/prooftrace.py | https://github.com/runtimeverification/k/blob/master/pyk/src/pyk/kllvm/hints/prooftrace.py | BSD-3-Clause |
def name(self) -> str:
"""Return the name of the LLVM function as a KORE Symbol Name."""
return self._function_event.name | Return the name of the LLVM function as a KORE Symbol Name. | name | python | runtimeverification/k | pyk/src/pyk/kllvm/hints/prooftrace.py | https://github.com/runtimeverification/k/blob/master/pyk/src/pyk/kllvm/hints/prooftrace.py | BSD-3-Clause |
def relative_position(self) -> str:
"""Return the relative position of the LLVM function event in the proof trace."""
return self._function_event.relative_position | Return the relative position of the LLVM function event in the proof trace. | relative_position | python | runtimeverification/k | pyk/src/pyk/kllvm/hints/prooftrace.py | https://github.com/runtimeverification/k/blob/master/pyk/src/pyk/kllvm/hints/prooftrace.py | BSD-3-Clause |
def args(self) -> list[LLVMArgument]:
"""Return a list of LLVMArgument objects representing the arguments of the LLVM function."""
return [LLVMArgument(arg) for arg in self._function_event.args] | Return a list of LLVMArgument objects representing the arguments of the LLVM function. | args | python | runtimeverification/k | pyk/src/pyk/kllvm/hints/prooftrace.py | https://github.com/runtimeverification/k/blob/master/pyk/src/pyk/kllvm/hints/prooftrace.py | BSD-3-Clause |
def __init__(self, function_exit_event: llvm_function_exit_event) -> None:
"""Initialize a new instance of the LLVMFunctionExitEvent class.
Args:
function_exit_event (llvm_function_exit_event): The LLVM function exit event object.
"""
self._function_exit_event = function_exit_event | Initialize a new instance of the LLVMFunctionExitEvent class.
Args:
function_exit_event (llvm_function_exit_event): The LLVM function exit event object. | __init__ | python | runtimeverification/k | pyk/src/pyk/kllvm/hints/prooftrace.py | https://github.com/runtimeverification/k/blob/master/pyk/src/pyk/kllvm/hints/prooftrace.py | BSD-3-Clause |
def __repr__(self) -> str:
"""Return a string representation of the object.
Returns:
A string representation of the LLVMFunctionExitEvent object using the AST printing method.
"""
return self._function_exit_event.__repr__() | Return a string representation of the object.
Returns:
A string representation of the LLVMFunctionExitEvent object using the AST printing method. | __repr__ | python | runtimeverification/k | pyk/src/pyk/kllvm/hints/prooftrace.py | https://github.com/runtimeverification/k/blob/master/pyk/src/pyk/kllvm/hints/prooftrace.py | BSD-3-Clause |
def rule_ordinal(self) -> int:
"""Return the axiom ordinal number associated with the function exit event."""
return self._function_exit_event.rule_ordinal | Return the axiom ordinal number associated with the function exit event. | rule_ordinal | python | runtimeverification/k | pyk/src/pyk/kllvm/hints/prooftrace.py | https://github.com/runtimeverification/k/blob/master/pyk/src/pyk/kllvm/hints/prooftrace.py | BSD-3-Clause |
def is_tail(self) -> bool:
"""Return True if the function exit event is a tail call."""
return self._function_exit_event.is_tail | Return True if the function exit event is a tail call. | is_tail | python | runtimeverification/k | pyk/src/pyk/kllvm/hints/prooftrace.py | https://github.com/runtimeverification/k/blob/master/pyk/src/pyk/kllvm/hints/prooftrace.py | BSD-3-Clause |
def __init__(self, hook_event: llvm_hook_event) -> None:
"""Initialize a new instance of the LLVMHookEvent class.
Args:
hook_event (llvm_hook_event): The LLVM hook event object.
"""
self._hook_event = hook_event | Initialize a new instance of the LLVMHookEvent class.
Args:
hook_event (llvm_hook_event): The LLVM hook event object. | __init__ | python | runtimeverification/k | pyk/src/pyk/kllvm/hints/prooftrace.py | https://github.com/runtimeverification/k/blob/master/pyk/src/pyk/kllvm/hints/prooftrace.py | BSD-3-Clause |
def __repr__(self) -> str:
"""Return a string representation of the object.
Returns:
A string representation of the LLVMHookEvent object using the AST printing method.
"""
return self._hook_event.__repr__() | Return a string representation of the object.
Returns:
A string representation of the LLVMHookEvent object using the AST printing method. | __repr__ | python | runtimeverification/k | pyk/src/pyk/kllvm/hints/prooftrace.py | https://github.com/runtimeverification/k/blob/master/pyk/src/pyk/kllvm/hints/prooftrace.py | BSD-3-Clause |
def name(self) -> str:
"""Return the attribute name of the hook event. Ex.: "INT.add"."""
return self._hook_event.name | Return the attribute name of the hook event. Ex.: "INT.add". | name | python | runtimeverification/k | pyk/src/pyk/kllvm/hints/prooftrace.py | https://github.com/runtimeverification/k/blob/master/pyk/src/pyk/kllvm/hints/prooftrace.py | BSD-3-Clause |
def relative_position(self) -> str:
"""Return the relative position of the hook event in the proof trace."""
return self._hook_event.relative_position | Return the relative position of the hook event in the proof trace. | relative_position | python | runtimeverification/k | pyk/src/pyk/kllvm/hints/prooftrace.py | https://github.com/runtimeverification/k/blob/master/pyk/src/pyk/kllvm/hints/prooftrace.py | BSD-3-Clause |
def args(self) -> list[LLVMArgument]:
"""Return a list of LLVMArgument objects representing the arguments of the hook event."""
return [LLVMArgument(arg) for arg in self._hook_event.args] | Return a list of LLVMArgument objects representing the arguments of the hook event. | args | python | runtimeverification/k | pyk/src/pyk/kllvm/hints/prooftrace.py | https://github.com/runtimeverification/k/blob/master/pyk/src/pyk/kllvm/hints/prooftrace.py | BSD-3-Clause |
def result(self) -> Pattern:
"""Return the result pattern of the hook event evaluation."""
return self._hook_event.result | Return the result pattern of the hook event evaluation. | result | python | runtimeverification/k | pyk/src/pyk/kllvm/hints/prooftrace.py | https://github.com/runtimeverification/k/blob/master/pyk/src/pyk/kllvm/hints/prooftrace.py | BSD-3-Clause |
def __init__(self, argument: Argument) -> None:
"""Initialize the LLVMArgument object.
Args:
argument (Argument): The Argument object.
"""
self._argument = argument | Initialize the LLVMArgument object.
Args:
argument (Argument): The Argument object. | __init__ | python | runtimeverification/k | pyk/src/pyk/kllvm/hints/prooftrace.py | https://github.com/runtimeverification/k/blob/master/pyk/src/pyk/kllvm/hints/prooftrace.py | BSD-3-Clause |
def __repr__(self) -> str:
"""Return a string representation of the object.
Returns:
Returns a string representation of the LLVMArgument object using the AST printing method.
"""
return self._argument.__repr__() | Return a string representation of the object.
Returns:
Returns a string representation of the LLVMArgument object using the AST printing method. | __repr__ | python | runtimeverification/k | pyk/src/pyk/kllvm/hints/prooftrace.py | https://github.com/runtimeverification/k/blob/master/pyk/src/pyk/kllvm/hints/prooftrace.py | BSD-3-Clause |
def step_event(self) -> LLVMStepEvent:
"""Returns the LLVMStepEvent associated with the argument if any."""
if isinstance(self._argument.step_event, llvm_rule_event):
return LLVMRuleEvent(self._argument.step_event)
elif isinstance(self._argument.step_event, llvm_side_condition_event):
return LLVMSideConditionEventEnter(self._argument.step_event)
elif isinstance(self._argument.step_event, llvm_side_condition_end_event):
return LLVMSideConditionEventExit(self._argument.step_event)
elif isinstance(self._argument.step_event, llvm_function_event):
return LLVMFunctionEvent(self._argument.step_event)
elif isinstance(self._argument.step_event, llvm_function_exit_event):
return LLVMFunctionExitEvent(self._argument.step_event)
elif isinstance(self._argument.step_event, llvm_hook_event):
return LLVMHookEvent(self._argument.step_event)
elif isinstance(self._argument.step_event, llvm_pattern_matching_failure_event):
return LLVMPatternMatchingFailureEvent(self._argument.step_event)
else:
raise AssertionError() | Returns the LLVMStepEvent associated with the argument if any. | step_event | python | runtimeverification/k | pyk/src/pyk/kllvm/hints/prooftrace.py | https://github.com/runtimeverification/k/blob/master/pyk/src/pyk/kllvm/hints/prooftrace.py | BSD-3-Clause |
def kore_pattern(self) -> Pattern:
"""Return the KORE Pattern associated with the argument if any."""
assert isinstance(self._argument.kore_pattern, Pattern)
return self._argument.kore_pattern | Return the KORE Pattern associated with the argument if any. | kore_pattern | python | runtimeverification/k | pyk/src/pyk/kllvm/hints/prooftrace.py | https://github.com/runtimeverification/k/blob/master/pyk/src/pyk/kllvm/hints/prooftrace.py | BSD-3-Clause |
def is_kore_pattern(self) -> bool:
"""Check if the argument is a KORE Pattern."""
return self._argument.is_kore_pattern() | Check if the argument is a KORE Pattern. | is_kore_pattern | python | runtimeverification/k | pyk/src/pyk/kllvm/hints/prooftrace.py | https://github.com/runtimeverification/k/blob/master/pyk/src/pyk/kllvm/hints/prooftrace.py | BSD-3-Clause |
def is_step_event(self) -> bool:
"""Check if the argument is a step event."""
return self._argument.is_step_event() | Check if the argument is a step event. | is_step_event | python | runtimeverification/k | pyk/src/pyk/kllvm/hints/prooftrace.py | https://github.com/runtimeverification/k/blob/master/pyk/src/pyk/kllvm/hints/prooftrace.py | BSD-3-Clause |
def __init__(self, rewrite_trace: llvm_rewrite_trace) -> None:
"""Initialize a new instance of the LLVMRewriteTrace class.
Args:
rewrite_trace (llvm_rewrite_trace): The LLVM rewrite trace object.
"""
self._rewrite_trace = rewrite_trace | Initialize a new instance of the LLVMRewriteTrace class.
Args:
rewrite_trace (llvm_rewrite_trace): The LLVM rewrite trace object. | __init__ | python | runtimeverification/k | pyk/src/pyk/kllvm/hints/prooftrace.py | https://github.com/runtimeverification/k/blob/master/pyk/src/pyk/kllvm/hints/prooftrace.py | BSD-3-Clause |
def __repr__(self) -> str:
"""Return a string representation of the object.
Returns:
A string representation of the LLVMRewriteTrace object using the AST printing method.
"""
return self._rewrite_trace.__repr__() | Return a string representation of the object.
Returns:
A string representation of the LLVMRewriteTrace object using the AST printing method. | __repr__ | python | runtimeverification/k | pyk/src/pyk/kllvm/hints/prooftrace.py | https://github.com/runtimeverification/k/blob/master/pyk/src/pyk/kllvm/hints/prooftrace.py | BSD-3-Clause |
def version(self) -> int:
"""Returns the version of the binary hints format used by this trace."""
return self._rewrite_trace.version | Returns the version of the binary hints format used by this trace. | version | python | runtimeverification/k | pyk/src/pyk/kllvm/hints/prooftrace.py | https://github.com/runtimeverification/k/blob/master/pyk/src/pyk/kllvm/hints/prooftrace.py | BSD-3-Clause |
def pre_trace(self) -> list[LLVMArgument]:
"""Returns a list of events that occurred before the initial configuration was constructed."""
return [LLVMArgument(event) for event in self._rewrite_trace.pre_trace] | Returns a list of events that occurred before the initial configuration was constructed. | pre_trace | python | runtimeverification/k | pyk/src/pyk/kllvm/hints/prooftrace.py | https://github.com/runtimeverification/k/blob/master/pyk/src/pyk/kllvm/hints/prooftrace.py | BSD-3-Clause |
def initial_config(self) -> LLVMArgument:
"""Returns the initial configuration as an LLVMArgument object."""
return LLVMArgument(self._rewrite_trace.initial_config) | Returns the initial configuration as an LLVMArgument object. | initial_config | python | runtimeverification/k | pyk/src/pyk/kllvm/hints/prooftrace.py | https://github.com/runtimeverification/k/blob/master/pyk/src/pyk/kllvm/hints/prooftrace.py | BSD-3-Clause |
def trace(self) -> list[LLVMArgument]:
"""Returns the trace.
The trace is the list of events that occurred after the initial configurarion was constructed until the end of the
proof trace when the final configuration is reached.
"""
return [LLVMArgument(event) for event in self._rewrite_trace.trace] | Returns the trace.
The trace is the list of events that occurred after the initial configurarion was constructed until the end of the
proof trace when the final configuration is reached. | trace | python | runtimeverification/k | pyk/src/pyk/kllvm/hints/prooftrace.py | https://github.com/runtimeverification/k/blob/master/pyk/src/pyk/kllvm/hints/prooftrace.py | BSD-3-Clause |
def parse(trace: bytes, header: KoreHeader) -> LLVMRewriteTrace:
"""Parse the given proof hints byte string using the given kore_header object."""
return LLVMRewriteTrace(llvm_rewrite_trace.parse(trace, header._kore_header)) | Parse the given proof hints byte string using the given kore_header object. | parse | python | runtimeverification/k | pyk/src/pyk/kllvm/hints/prooftrace.py | https://github.com/runtimeverification/k/blob/master/pyk/src/pyk/kllvm/hints/prooftrace.py | BSD-3-Clause |
def __init__(self, kore_header: kore_header) -> None:
"""Initialize a new instance of the KoreHeader class.
Args:
kore_header (kore_header): The KORE Header object.
"""
self._kore_header = kore_header | Initialize a new instance of the KoreHeader class.
Args:
kore_header (kore_header): The KORE Header object. | __init__ | python | runtimeverification/k | pyk/src/pyk/kllvm/hints/prooftrace.py | https://github.com/runtimeverification/k/blob/master/pyk/src/pyk/kllvm/hints/prooftrace.py | BSD-3-Clause |
def create(header_path: Path) -> KoreHeader:
"""Create a new KoreHeader object from the given header file path."""
return KoreHeader(kore_header(str(header_path))) | Create a new KoreHeader object from the given header file path. | create | python | runtimeverification/k | pyk/src/pyk/kllvm/hints/prooftrace.py | https://github.com/runtimeverification/k/blob/master/pyk/src/pyk/kllvm/hints/prooftrace.py | BSD-3-Clause |
def __init__(self, event_type: EventType) -> None:
"""Initialize a new instance of the LLVMEventType class.
Args:
event_type (EventType): The EventType object.
"""
self._event_type = event_type | Initialize a new instance of the LLVMEventType class.
Args:
event_type (EventType): The EventType object. | __init__ | python | runtimeverification/k | pyk/src/pyk/kllvm/hints/prooftrace.py | https://github.com/runtimeverification/k/blob/master/pyk/src/pyk/kllvm/hints/prooftrace.py | BSD-3-Clause |
def is_pre_trace(self) -> bool:
"""Checks if the event type is a pre-trace event."""
return self._event_type == EventType.PreTrace | Checks if the event type is a pre-trace event. | is_pre_trace | python | runtimeverification/k | pyk/src/pyk/kllvm/hints/prooftrace.py | https://github.com/runtimeverification/k/blob/master/pyk/src/pyk/kllvm/hints/prooftrace.py | BSD-3-Clause |
def is_initial_config(self) -> bool:
"""Checks if the event type is an initial configuration event."""
return self._event_type == EventType.InitialConfig | Checks if the event type is an initial configuration event. | is_initial_config | python | runtimeverification/k | pyk/src/pyk/kllvm/hints/prooftrace.py | https://github.com/runtimeverification/k/blob/master/pyk/src/pyk/kllvm/hints/prooftrace.py | BSD-3-Clause |
def is_trace(self) -> bool:
"""Checks if the event type is a trace event."""
return self._event_type == EventType.Trace | Checks if the event type is a trace event. | is_trace | python | runtimeverification/k | pyk/src/pyk/kllvm/hints/prooftrace.py | https://github.com/runtimeverification/k/blob/master/pyk/src/pyk/kllvm/hints/prooftrace.py | BSD-3-Clause |
def __init__(self, annotated_llvm_event: annotated_llvm_event) -> None:
"""Initialize a new instance of the LLVMEventAnnotated class.
Args:
annotated_llvm_event (annotated_llvm_event): The annotated LLVM event object.
"""
self._annotated_llvm_event = annotated_llvm_event | Initialize a new instance of the LLVMEventAnnotated class.
Args:
annotated_llvm_event (annotated_llvm_event): The annotated LLVM event object. | __init__ | python | runtimeverification/k | pyk/src/pyk/kllvm/hints/prooftrace.py | https://github.com/runtimeverification/k/blob/master/pyk/src/pyk/kllvm/hints/prooftrace.py | BSD-3-Clause |
def type(self) -> LLVMEventType:
"""Returns the LLVM event type."""
return LLVMEventType(self._annotated_llvm_event.type) | Returns the LLVM event type. | type | python | runtimeverification/k | pyk/src/pyk/kllvm/hints/prooftrace.py | https://github.com/runtimeverification/k/blob/master/pyk/src/pyk/kllvm/hints/prooftrace.py | BSD-3-Clause |
def event(self) -> LLVMArgument:
"""Returns the LLVM event as an LLVMArgument object."""
return LLVMArgument(self._annotated_llvm_event.event) | Returns the LLVM event as an LLVMArgument object. | event | python | runtimeverification/k | pyk/src/pyk/kllvm/hints/prooftrace.py | https://github.com/runtimeverification/k/blob/master/pyk/src/pyk/kllvm/hints/prooftrace.py | BSD-3-Clause |
def __init__(self, rewrite_trace_iterator: llvm_rewrite_trace_iterator) -> None:
"""Initialize a new instance of the LLVMRewriteTraceIterator class.
Args:
rewrite_trace_iterator (llvm_rewrite_trace_iterator): The LLVM rewrite trace iterator object.
"""
self._rewrite_trace_iterator = rewrite_trace_iterator | Initialize a new instance of the LLVMRewriteTraceIterator class.
Args:
rewrite_trace_iterator (llvm_rewrite_trace_iterator): The LLVM rewrite trace iterator object. | __init__ | python | runtimeverification/k | pyk/src/pyk/kllvm/hints/prooftrace.py | https://github.com/runtimeverification/k/blob/master/pyk/src/pyk/kllvm/hints/prooftrace.py | BSD-3-Clause |
def __repr__(self) -> str:
"""Return a string representation of the object.
Returns:
A string representation of the LLVMRewriteTraceIterator object using the AST printing method.
"""
return self._rewrite_trace_iterator.__repr__() | Return a string representation of the object.
Returns:
A string representation of the LLVMRewriteTraceIterator object using the AST printing method. | __repr__ | python | runtimeverification/k | pyk/src/pyk/kllvm/hints/prooftrace.py | https://github.com/runtimeverification/k/blob/master/pyk/src/pyk/kllvm/hints/prooftrace.py | BSD-3-Clause |
def __iter__(self) -> Generator[LLVMEventAnnotated, None, None]:
"""Yield LLVMEventAnnotated options.
This method is an iterator that yields LLVMEventAnnotated options.
It iterates over the events in the trace and returns the next event as an LLVMEventAnnotated object.
Yields:
LLVMEventAnnotated: The next LLVMEventAnnotated option.
"""
while True:
next_event = self._rewrite_trace_iterator.get_next_event()
if next_event is None:
return
else:
yield LLVMEventAnnotated(next_event) | Yield LLVMEventAnnotated options.
This method is an iterator that yields LLVMEventAnnotated options.
It iterates over the events in the trace and returns the next event as an LLVMEventAnnotated object.
Yields:
LLVMEventAnnotated: The next LLVMEventAnnotated option. | __iter__ | python | runtimeverification/k | pyk/src/pyk/kllvm/hints/prooftrace.py | https://github.com/runtimeverification/k/blob/master/pyk/src/pyk/kllvm/hints/prooftrace.py | BSD-3-Clause |
def __next__(self) -> LLVMEventAnnotated:
"""Yield the next LLVMEventAnnotated object from the iterator.
Returns:
LLVMEventAnnotated: The next LLVMEventAnnotated object.
Raises:
StopIteration: If there are no more events in the iterator.
"""
next_event = self._rewrite_trace_iterator.get_next_event()
if next_event is not None:
return LLVMEventAnnotated(next_event)
else:
raise StopIteration | Yield the next LLVMEventAnnotated object from the iterator.
Returns:
LLVMEventAnnotated: The next LLVMEventAnnotated object.
Raises:
StopIteration: If there are no more events in the iterator. | __next__ | python | runtimeverification/k | pyk/src/pyk/kllvm/hints/prooftrace.py | https://github.com/runtimeverification/k/blob/master/pyk/src/pyk/kllvm/hints/prooftrace.py | BSD-3-Clause |
def version(self) -> int:
"""Return the version of the HINTS format."""
return self._rewrite_trace_iterator.version | Return the version of the HINTS format. | version | python | runtimeverification/k | pyk/src/pyk/kllvm/hints/prooftrace.py | https://github.com/runtimeverification/k/blob/master/pyk/src/pyk/kllvm/hints/prooftrace.py | BSD-3-Clause |
def from_file(trace_path: Path, header: KoreHeader) -> LLVMRewriteTraceIterator:
"""Create a new LLVMRewriteTraceIterator object from the given trace and header file paths."""
return LLVMRewriteTraceIterator(llvm_rewrite_trace_iterator.from_file(str(trace_path), header._kore_header)) | Create a new LLVMRewriteTraceIterator object from the given trace and header file paths. | from_file | python | runtimeverification/k | pyk/src/pyk/kllvm/hints/prooftrace.py | https://github.com/runtimeverification/k/blob/master/pyk/src/pyk/kllvm/hints/prooftrace.py | BSD-3-Clause |
def _extra_args(self) -> list[str]:
"""Command line arguments that are intended to be included in the bug report."""
smt_server_args = []
if self._smt_timeout is not None:
smt_server_args += ['--smt-timeout', str(self._smt_timeout)]
if self._smt_retry_limit is not None:
smt_server_args += ['--smt-retry-limit', str(self._smt_retry_limit)]
if self._smt_reset_interval is not None:
smt_server_args += ['--smt-reset-interval', str(self._smt_reset_interval)]
if self._smt_tactic is not None:
smt_server_args += ['--smt-tactic', self._smt_tactic]
if self._log_axioms_file is not None:
haskell_log_args = [
'--log',
str(self._log_axioms_file),
'--log-format',
self._haskell_log_format.value,
'--log-entries',
','.join(self._haskell_log_entries),
]
else:
haskell_log_args = []
return smt_server_args + haskell_log_args | Command line arguments that are intended to be included in the bug report. | _extra_args | python | runtimeverification/k | pyk/src/pyk/kore/rpc.py | https://github.com/runtimeverification/k/blob/master/pyk/src/pyk/kore/rpc.py | BSD-3-Clause |
def collect_symbols(pattern: Pattern) -> set[str]:
"""Return the set of all symbols referred to in a pattern.
Args:
pattern: Pattern to collect symbols from.
"""
res: set[str] = set()
def add_symbol(pattern: Pattern) -> None:
match pattern:
case App(symbol):
res.add(symbol)
pattern.collect(add_symbol)
return res | Return the set of all symbols referred to in a pattern.
Args:
pattern: Pattern to collect symbols from. | collect_symbols | python | runtimeverification/k | pyk/src/pyk/kore/manip.py | https://github.com/runtimeverification/k/blob/master/pyk/src/pyk/kore/manip.py | BSD-3-Clause |
def filter_rewrites(self, labels: Iterable[str]) -> KoreDefn:
"""Keep only rewrite rules with certain labels in the definition."""
should_keep = set(labels)
return self.let(rewrites=tuple(rewrite for rewrite in self.rewrites if rewrite.label in should_keep)) | Keep only rewrite rules with certain labels in the definition. | filter_rewrites | python | runtimeverification/k | pyk/src/pyk/kore/internal.py | https://github.com/runtimeverification/k/blob/master/pyk/src/pyk/kore/internal.py | BSD-3-Clause |
def project_to_symbols(self) -> KoreDefn:
"""Project definition to symbols present in the definition."""
functions: FrozenDict[str, tuple[FunctionRule, ...]] = FrozenDict(
(function, rules) for function, rules in self.functions.items() if function in self.symbols
)
_sorts: set[str] = set()
_sorts.update(sort for symbol in self.symbols for sort in self._symbol_sorts(symbol))
_sorts.update(sort for rules in functions.values() for rule in rules for sort in self._arg_subsorts(rule))
sorts: FrozenDict[str, SortDecl] = FrozenDict(
(sort, decl) for sort, decl in self.sorts.items() if sort in _sorts
)
subsorts: FrozenDict[str, frozenset[str]] = FrozenDict(
(supersort, frozenset(subsort for subsort in subsorts if subsort in sorts))
for supersort, subsorts in self.subsorts.items()
if supersort in sorts
)
return self.let(
sorts=sorts,
subsorts=subsorts,
functions=functions,
) | Project definition to symbols present in the definition. | project_to_symbols | python | runtimeverification/k | pyk/src/pyk/kore/internal.py | https://github.com/runtimeverification/k/blob/master/pyk/src/pyk/kore/internal.py | BSD-3-Clause |
def project_to_rewrites(self) -> KoreDefn:
"""Project definition to symbols that are part of the configuration or are (transitively) referred to from rewrite axioms."""
_symbols = set()
_symbols.update(self._config_symbols())
_symbols.update(self._rewrite_symbols())
symbols: FrozenDict[str, SymbolDecl] = FrozenDict(
(symbol, decl) for symbol, decl in self.symbols.items() if symbol in _symbols
)
return self.let(symbols=symbols).project_to_symbols() | Project definition to symbols that are part of the configuration or are (transitively) referred to from rewrite axioms. | project_to_rewrites | python | runtimeverification/k | pyk/src/pyk/kore/internal.py | https://github.com/runtimeverification/k/blob/master/pyk/src/pyk/kore/internal.py | BSD-3-Clause |
def _arg_subsorts(self, rule: FunctionRule) -> set[str]:
"""Collect the from-sorts of injections on the LHS of a function rule.
These potentially indicate matching on a subsort of a certain sort, e.g.
rule isKResult(inj{KResult,KItem}(KResult)) => true
"""
res = set()
def from_sort(pattern: Pattern) -> None:
match pattern:
case App('inj', (SortApp(sort), _), _):
res.add(sort)
rule.lhs.collect(from_sort)
return res | Collect the from-sorts of injections on the LHS of a function rule.
These potentially indicate matching on a subsort of a certain sort, e.g.
rule isKResult(inj{KResult,KItem}(KResult)) => true | _arg_subsorts | python | runtimeverification/k | pyk/src/pyk/kore/internal.py | https://github.com/runtimeverification/k/blob/master/pyk/src/pyk/kore/internal.py | BSD-3-Clause |
def _config_symbols(self) -> set[str]:
"""Return the set of symbols that constitute a configuration."""
res: set[str] = set()
done = set()
pending = ['SortGeneratedTopCell']
while pending:
sort = pending.pop()
if sort in done:
continue
done.add(sort)
symbols: list[str] = []
if sort in self.collections:
coll = self.collections[sort]
symbols += [coll.concat, coll.element, coll.unit]
symbols += self.constructors.get(sort, ())
pending.extend(sort for symbol in symbols for sort in self._symbol_sorts(symbol))
res.update(symbols)
return res | Return the set of symbols that constitute a configuration. | _config_symbols | python | runtimeverification/k | pyk/src/pyk/kore/internal.py | https://github.com/runtimeverification/k/blob/master/pyk/src/pyk/kore/internal.py | BSD-3-Clause |
def _rewrite_symbols(self) -> set[str]:
"""Return the set of symbols reffered to in rewrite rules."""
res = set()
# Symbols appearing in rewrite rules are relevant
pending = {
symbol for rewrite_rule in self.rewrites for symbol in collect_symbols(rewrite_rule.to_axiom().pattern)
}
while pending:
symbol = pending.pop()
if symbol in res:
continue
res.add(symbol)
# Symbols appearing in function rules of a releveant symbol are relevant
pending.update(
symbol
for function_rule in self.functions.get(symbol, ())
for symbol in collect_symbols(function_rule.to_axiom().pattern)
)
# If the symbol consumes or produces a collection, collection function symbols are relevant
for sort in self._symbol_sorts(symbol):
if sort in self.collections:
coll = self.collections[sort]
pending.update([coll.concat, coll.element, coll.unit])
return res | Return the set of symbols reffered to in rewrite rules. | _rewrite_symbols | python | runtimeverification/k | pyk/src/pyk/kore/internal.py | https://github.com/runtimeverification/k/blob/master/pyk/src/pyk/kore/internal.py | BSD-3-Clause |
def ctor_patterns(self) -> tuple[Pattern, ...]:
"""Return patterns used to construct the term with `of`.
Except for `DV`, `MLFixpoint` and `MLQuant` this coincides with `patterns`.
"""
return self.patterns | Return patterns used to construct the term with `of`.
Except for `DV`, `MLFixpoint` and `MLQuant` this coincides with `patterns`. | ctor_patterns | python | runtimeverification/k | pyk/src/pyk/kore/syntax.py | https://github.com/runtimeverification/k/blob/master/pyk/src/pyk/kore/syntax.py | BSD-3-Clause |
def _sort_block(self, sorts: list[str]) -> Command | None:
"""Return an optional mutual block or declaration."""
commands: tuple[Command, ...] = tuple(
self._transform_sort(sort) for sort in sorts if sort not in _PRELUDE_SORTS
)
if not commands:
return None
if len(commands) == 1:
(command,) = commands
return command
return Mutual(commands=commands) | Return an optional mutual block or declaration. | _sort_block | python | runtimeverification/k | pyk/src/pyk/klean/k2lean4.py | https://github.com/runtimeverification/k/blob/master/pyk/src/pyk/klean/k2lean4.py | BSD-3-Clause |
def _elim_fun_apps(self, pattern: Pattern, free: Iterator[str]) -> tuple[Pattern, dict[str, Pattern]]:
"""Replace ``foo(bar(x))`` with ``z`` and return mapping ``{y: bar(x), z: foo(y)}`` with ``y``, ``z`` fresh variables."""
defs: dict[str, Pattern] = {}
def abstract_funcs(pattern: Pattern) -> Pattern:
if isinstance(pattern, App) and pattern.symbol in self.defn.functions:
name = next(free)
ident = _var_ident(name)
defs[ident] = pattern
sort = self.symbol_table.infer_sort(pattern)
return EVar(name, sort)
return pattern
return pattern.bottom_up(abstract_funcs), defs | Replace ``foo(bar(x))`` with ``z`` and return mapping ``{y: bar(x), z: foo(y)}`` with ``y``, ``z`` fresh variables. | _elim_fun_apps | python | runtimeverification/k | pyk/src/pyk/klean/k2lean4.py | https://github.com/runtimeverification/k/blob/master/pyk/src/pyk/klean/k2lean4.py | BSD-3-Clause |
def _sort_dependencies(defn: KoreDefn) -> dict[str, set[str]]:
"""Transitively closed sort dependency graph."""
sorts = defn.sorts
deps: list[tuple[str, str]] = []
for sort in sorts:
# A sort depends on its subsorts (due to inj_{subsort} constructors)
deps.extend((sort, subsort) for subsort in defn.subsorts.get(sort, []))
# A sort depends on the parameter sorts of all its constructors
deps.extend(
(sort, param_sort)
for ctor in defn.constructors.get(sort, [])
for param_sort in _param_sorts(defn.symbols[ctor])
)
# If the sort is a collection, the element function parameters are dependencies
if sort in defn.collections:
coll = defn.collections[sort]
elem = defn.symbols[coll.element]
deps.extend((sort, param_sort) for param_sort in _param_sorts(elem))
closed = POSet(deps).image # TODO POSet should be called "transitively closed relation" or similar
return {
sort: set(closed.get(sort, [])) for sort in sorts
} # Ensure that sorts without dependencies are also represented | Transitively closed sort dependency graph. | _sort_dependencies | python | runtimeverification/k | pyk/src/pyk/klean/k2lean4.py | https://github.com/runtimeverification/k/blob/master/pyk/src/pyk/klean/k2lean4.py | BSD-3-Clause |
def do_load(self, args: Any) -> bool | None: # Leaky abstraction - make extension mechanism more robust
"""Set up the interpreter.
Subclasses are expected to
- Decorate the method with `with_argparser` to ensure the right set of arguments is parsed.
- Instantiate an `Interpreter[T]` based on `args`, then set `self.interpreter`.
- Set `self.state` to `self.interpreter.init_state()`.
"""
... | Set up the interpreter.
Subclasses are expected to
- Decorate the method with `with_argparser` to ensure the right set of arguments is parsed.
- Instantiate an `Interpreter[T]` based on `args`, then set `self.interpreter`.
- Set `self.state` to `self.interpreter.init_state()`. | do_load | python | runtimeverification/k | pyk/src/pyk/krepl/repl.py | https://github.com/runtimeverification/k/blob/master/pyk/src/pyk/krepl/repl.py | BSD-3-Clause |
def commit(self, result: SR) -> None:
"""Apply the step result of type `SR` to `self`, modifying `self`."""
... | Apply the step result of type `SR` to `self`, modifying `self`. | commit | python | runtimeverification/k | pyk/src/pyk/proof/proof.py | https://github.com/runtimeverification/k/blob/master/pyk/src/pyk/proof/proof.py | BSD-3-Clause |
def up_to_date(self) -> bool:
"""Check that the proof's representation on disk is up-to-date."""
if self.proof_dir is None:
raise ValueError(f'Cannot check if proof {self.id} with no proof_dir is up-to-date')
proof_path = self.proof_dir / f'{hash_str(id)}.json'
if proof_path.exists() and proof_path.is_file():
return self.digest == hash_file(proof_path)
else:
return False | Check that the proof's representation on disk is up-to-date. | up_to_date | python | runtimeverification/k | pyk/src/pyk/proof/proof.py | https://github.com/runtimeverification/k/blob/master/pyk/src/pyk/proof/proof.py | BSD-3-Clause |
def fetch_subproof(
self, proof_id: str, force_reread: bool = False, uptodate_check_method: str = 'timestamp'
) -> Proof:
"""Get a subproof, re-reading from disk if it's not up-to-date."""
if self.proof_dir is not None and (force_reread or not self._subproofs[proof_id].up_to_date):
updated_subproof = Proof.read_proof(proof_id, self.proof_dir)
self._subproofs[proof_id] = updated_subproof
return updated_subproof
else:
return self._subproofs[proof_id] | Get a subproof, re-reading from disk if it's not up-to-date. | fetch_subproof | python | runtimeverification/k | pyk/src/pyk/proof/proof.py | https://github.com/runtimeverification/k/blob/master/pyk/src/pyk/proof/proof.py | BSD-3-Clause |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.