Skip to content

Add BTOR2 Frontend#74

Merged
ahmed-irfan merged 14 commits intoSRI-CSL:masterfrom
cgjohannsen:btor2
Jun 29, 2025
Merged

Add BTOR2 Frontend#74
ahmed-irfan merged 14 commits intoSRI-CSL:masterfrom
cgjohannsen:btor2

Conversation

@cgjohannsen
Copy link
Contributor

@cgjohannsen cgjohannsen commented May 30, 2025

Adds a BTOR2 frontend using the btor2tools parsing library.

// Transition formula
expr::term_ref transition_formula = ts->get_transition_relation();

// Invariant formula
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why this change?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Invariants were actually never implemented before. Transition systems had methods for adding invariants, but these were never used nor accessed. This change (and to the other engines) actually implements invariants properly.

The only caveat is that I didn't implement them for the pdkind engine, so I will take a look at that.

// Transition formula
expr::term_ref transition_formula = ts->get_transition_relation();

// Invariant formula
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why this change?
Was there a bug before?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comment on bmc_engine

// Transition formula
expr::term_ref transition_formula = ts->get_transition_relation();

// Invariant formula
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comment on bmc_engine

bad_children.push_back(bad);
}
// FIXME: Don't think this works for more than one child --
// 'property' is a bool, but then the next line compares it to bv 0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that this might because there is no Boolean type in BTOR. Instead a BV of 1 bit is used for true/false.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is incorrect though, because property is of type Boolean (since it's an OR), but then is compared to the bit-vector zero (so there is a type mismatch). I would need to test this out to see what happens though.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would you test in this PR?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed this in 5a850c6

}
d_transition_systems.get_entry(id)->add_invariant(sf);
}
// void context::add_invariant_to(std::string id, state_formula* sf) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it not used?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was not used by any module -- I can remove this since now the invariant is just a single formula.

@cgjohannsen
Copy link
Contributor Author

I'll add invariant support to the pdkind engine.

@cgjohannsen
Copy link
Contributor Author

@ahmed-irfan This should be ready to review/merge

Copy link
Member

@ahmed-irfan ahmed-irfan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left one comment.

Rest LGTM

Copy link
Member

@ahmed-irfan ahmed-irfan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ahmed-irfan ahmed-irfan merged commit bfb2379 into SRI-CSL:master Jun 29, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants