Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extending the AFA-bits Format for Formulae in General Form? #445

Open
jn1z opened this issue Oct 21, 2024 · 4 comments
Open

Extending the AFA-bits Format for Formulae in General Form? #445

jn1z opened this issue Oct 21, 2024 · 4 comments
Labels
For:library The issue is related to library (c++ implementation) Type:discussion A discussion of some particular topic in wider audience

Comments

@jn1z
Copy link

jn1z commented Oct 21, 2024

This is separate from the high-memory issue; these fail pretty much immediately.

./build/examples/example06-mintermization automata-bench/bench2/ltl_afa/created_ltl/LTLf-specific/Response/N360.mata
... (outputs original file)...
Segmentation fault (core dumped)

@jn1z
Copy link
Author

jn1z commented Oct 21, 2024

This is happening on line 101 of mintermization.cc:
"if (bdd.val.IsZero())" is crashing.
Printing out the value of bdd.val gives "libMATA error: empty DD."

@Adda0
Copy link
Collaborator

Adda0 commented Oct 21, 2024

Thid will be of great help when debugging the issue. Thank you for the reports.

@koniksedy koniksedy self-assigned this Nov 1, 2024
@koniksedy koniksedy changed the title Core dump on mintermizing of several files Extending the AFA-bits Format for Formulae in General Form? Nov 17, 2024
@koniksedy
Copy link
Collaborator

koniksedy commented Nov 17, 2024

The Bug

The execution fails on line 101 because the previous assertion on line 100 is turned off by the release compilation. This assertion would normally be triggered when bdd.type equals OptionalBdd::TYPE::NOTHING_E.

mata/src/mintermization.cc

Lines 94 to 106 in 8b885af

// Foreach disjunct create a BDD
for (const DisjunctStatesPair& ds_pair : lhs_to_disjuncts_and_states[&trans.first]) {
// create bdd for the whole disjunct
const auto bdd = (ds_pair.first == ds_pair.second) ? // disjunct contains only states
OptionalBdd(bdd_mng.bddOne()) : // transition from state to states -> add true as symbol
graph_to_bdd_afa(*ds_pair.first);
assert(bdd.type == OptionalBdd::TYPE::BDD_E);
if (bdd.val.IsZero())
continue;
trans_to_bddvar[ds_pair.first] = bdd.val;
bdds.insert(bdd.val);
}
}

Is It Really a Bug?

As can be inferred from the comments and variable names in the for-loop, it deals with some kind of disjuncts (lhs_to_disjuncts_and_states). The variable ds_pair is even of the type DisjunctStatePairs, defined as:

using DisjunctStatesPair = std::pair<const FormulaGraph *, const FormulaGraph *>;

This, along with the fact that the automaton:

@AFA-bits
%Initial qOR2
%Final qI & qOR2
qI \true
qOL1 aV1
qOL2 aV2
qOR2 (qOL1 | qOL2) & qI

leads to an assertion failure on line 100, whereas the automaton:

@AFA-bits
%Initial qOR2
%Final qI & qOR2
qI \true
qOL1 aV1
qOL2 aV2
qOR2 (qOL1 & qI) | (qOL2 & qI)

passes without any problem, suggests that the official automata format accepts formulae only in Disjunctive Normal Form (DNF).

Should We Extend AFA-bits for Formulae in General Form?

This observation raises the question of whether we should extend the AFA-bits automaton format to support transition formulae in general form (not limited to DNF) or leave it as it is.

What to Do Now?

If you need the AFA-bits format immediately, I suggest manually transforming all transition formulae into DNF. Mentioned automaton ltl_afa/created_ltl/LTLf-specific/Response/N360.mata loads perfectly after this transformation.

@Adda0 Adda0 added For:library The issue is related to library (c++ implementation) Type:discussion A discussion of some particular topic in wider audience labels Nov 18, 2024
@jn1z
Copy link
Author

jn1z commented Nov 18, 2024

Thank you for tracking this down! I doubt I'll be manually transforming all of the transition formulae of Automata-Bench, but this is useful.

"Is It Really a Bug?"

Er... yes! :-)

Either:

  1. This is not the "official automata format", in which case the Verifit Automata-Bench library, https://github.com/VeriFIT/automata-bench, has a bug (or several, depending on your definition).
  2. The Mata library is not parsing the "official automata format" correctly.

However, in either case, Mata shouldn't be seg-faulting on these files. A user isn't going to be able to figure out the necessary format change (converting to DNF) from the seen behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
For:library The issue is related to library (c++ implementation) Type:discussion A discussion of some particular topic in wider audience
Projects
None yet
Development

No branches or pull requests

3 participants