Skip to content

Commit

Permalink
Add support for is_valid_before.
Browse files Browse the repository at this point in the history
Signed-off-by: Alan Jowett <[email protected]>
  • Loading branch information
Alan-Jowett committed Jan 16, 2025
1 parent c752a2e commit c861682
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/crab_verifier.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ bool Invariants::is_valid_after(const label_t& label, const string_invariant& st
return abstract_state <= invariants.at(label).post;
}

bool Invariants::is_valid_before(const label_t& label, const string_invariant& state) const {
const ebpf_domain_t abstract_state =
ebpf_domain_t::from_constraints(state.value(), thread_local_options.setup_constraints);
return abstract_state <= invariants.at(label).pre;
}

string_invariant Invariants::invariant_at(const label_t& label) const { return invariants.at(label).post.to_set(); }

crab::interval_t Invariants::exit_value() const { return invariants.at(label_t::exit).post.get_r0(); }
Expand Down
1 change: 1 addition & 0 deletions src/crab_verifier.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ class Invariants final {
Invariants(const Invariants& invariants) = default;

bool is_valid_after(const label_t& label, const string_invariant& state) const;
bool is_valid_before(const label_t& label, const string_invariant& state) const;

string_invariant invariant_at(const label_t& label) const;

Expand Down

0 comments on commit c861682

Please sign in to comment.