Skip to content

Commit

Permalink
Merge branch 'merge-node' of https://github.com/runtimeverification/k
Browse files Browse the repository at this point in the history
…into merge-node
  • Loading branch information
Stevengre committed Aug 1, 2024
2 parents e339253 + 98f9d26 commit b3e5eb6
Show file tree
Hide file tree
Showing 10 changed files with 63 additions and 10 deletions.
2 changes: 1 addition & 1 deletion deps/haskell-backend_release
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v0.1.49
v0.1.51
8 changes: 4 additions & 4 deletions flake.lock

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

2 changes: 1 addition & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
inputs = {
llvm-backend.url = "github:runtimeverification/llvm-backend/v0.1.64";
haskell-backend = {
url = "github:runtimeverification/haskell-backend/v0.1.49";
url = "github:runtimeverification/haskell-backend/v0.1.51";
inputs.rv-utils.follows = "llvm-backend/rv-utils";
inputs.nixpkgs.follows = "llvm-backend/nixpkgs";
};
Expand Down
2 changes: 1 addition & 1 deletion k-distribution/src/main/scripts/bin/krun
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ filterSubst=

if [[ "$OSTYPE" == "darwin"* ]]; then
LLDB_FILE="$(dirname "$0")/../lib/kllvm/lldb/k_lldb_path"
if [ -f "$LLDB_FILE" ]; then
if [[ -f "$LLDB_FILE" && -f "$(cat "$LLDB_FILE")" ]]; then
DBG_EXE="$(cat "$LLDB_FILE")"
else
DBG_EXE="lldb"
Expand Down
7 changes: 7 additions & 0 deletions k-distribution/tests/regression-new/mint-llvm-2/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
DEF=test
EXT=test
TESTDIR=.
KOMPILE_BACKEND=llvm
KOMPILE_FLAGS=--syntax-module TEST

include ../../../include/kframework/ktest.mak
12 changes: 12 additions & 0 deletions k-distribution/tests/regression-new/mint-llvm-2/test.k
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
module TEST
imports BOOL
imports MINT

syntax MInt{64}
syntax MInt{32}

syntax MInt{32} ::= m32() [function]
syntax MInt{64} ::= m64() [function]
rule m64() => 0p64
rule m32() => 0p32
endmodule
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,12 @@ private static Sort lub(
}

Set<Sort> nonParametric =
filteredEntries.stream().filter(s -> s.params().isEmpty()).collect(Collectors.toSet());
filteredEntries.stream()
.filter(
s ->
s.params().isEmpty()
|| stream(s.params()).allMatch(p -> mod.allSorts().contains(p)))
.collect(Collectors.toSet());
Set<Sort> bounds = mod.subsorts().upperBounds(nonParametric);
// Anything less than KBott or greater than K is a syntactic sort from kast.md which should not
// be considered
Expand Down
17 changes: 16 additions & 1 deletion pyk/src/pyk/proof/proof.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,10 @@ def lines(self) -> list[str]:
subproofs_summaries = [subproof.summary for subproof in self.subproofs]
return CompositeSummary([BaseSummary(self.id, self.status), *subproofs_summaries])

@property
def one_line_summary(self) -> str:
return self.status.name

@abstractmethod
def get_steps(self) -> Iterable[PS]:
"""Return all currently available steps associated with this Proof. Should not modify `self`."""
Expand Down Expand Up @@ -321,6 +325,7 @@ def parallel_advance_proof(
max_iterations: int | None = None,
fail_fast: bool = False,
max_workers: int = 1,
callback: Callable[[P], None] = (lambda x: None),
) -> None:
"""Advance proof with multithreaded strategy.
Expand All @@ -342,6 +347,7 @@ def parallel_advance_proof(
fail_fast: If the proof is failing after finishing a step,
halt execution even if there are still available steps.
max_workers: Maximum number of worker threads the pool can spawn.
callback: Callable to run in between each completed step, useful for getting real-time information about the proof.
"""
pending: set[Future[Any]] = set()
explored: set[PS] = set()
Expand Down Expand Up @@ -371,6 +377,7 @@ def submit_steps(_steps: Iterable[PS]) -> None:
for result in proof_results:
proof.commit(result)
proof.write_proof_data()
callback(proof)
iterations += 1
if max_iterations is not None and max_iterations <= iterations:
break
Expand Down Expand Up @@ -489,7 +496,13 @@ def init_proof(self, proof: P) -> None:
"""
...

def advance_proof(self, proof: P, max_iterations: int | None = None, fail_fast: bool = False) -> None:
def advance_proof(
self,
proof: P,
max_iterations: int | None = None,
fail_fast: bool = False,
callback: Callable[[P], None] = (lambda x: None),
) -> None:
"""Advance a proof.
Performs loop `Proof.get_steps()` -> `Prover.step_proof()` -> `Proof.commit()`.
Expand All @@ -499,6 +512,7 @@ def advance_proof(self, proof: P, max_iterations: int | None = None, fail_fast:
max_iterations (optional): Maximum number of steps to take.
fail_fast: If the proof is failing after finishing a step,
halt execution even if there are still available steps.
callback: Callable to run in between each completed step, useful for getting real-time information about the proof.
"""
iterations = 0
_LOGGER.info(f'Initializing proof: {proof.id}')
Expand All @@ -520,5 +534,6 @@ def advance_proof(self, proof: P, max_iterations: int | None = None, fail_fast:
for result in results:
proof.commit(result)
proof.write_proof_data()
callback(proof)
if proof.failed:
proof.failure_info = self.failure_info(proof)
14 changes: 14 additions & 0 deletions pyk/src/pyk/proof/reachability.py
Original file line number Diff line number Diff line change
Expand Up @@ -503,6 +503,20 @@ def summary(self) -> CompositeSummary:
]
)

@property
def one_line_summary(self) -> str:
nodes = len(self.kcfg.nodes)
pending = len(self.pending)
failing = len(self.failing)
branches = len(self.kcfg.ndbranches()) + len(self.kcfg.splits())
vacuous = len(self.kcfg.vacuous)
stuck = len(self.kcfg.stuck)
passed = len([cover for cover in self.kcfg.covers() if cover.target.id == self.target])
return (
super().one_line_summary
+ f'/{nodes} nodes/{pending} pending/{passed} passed/{failing} failing/{branches} branches/{vacuous} vacuous/{stuck} stuck'
)

def get_refutation_id(self, node_id: int) -> str:
return f'{self.id}.node-infeasible-{node_id}'

Expand Down

0 comments on commit b3e5eb6

Please sign in to comment.