coli-saar / alto

Alto, the Algebraic Language Toolkit
Other
16 stars 2 forks source link

Bug with AMDecompositionAutomaton/ruleStore/countRules #52

Open jgroschwitz opened 4 years ago

jgroschwitz commented 4 years ago

This looks like a very specific bug at first, but might be indicative of serious underlying issues in the TreeAutomaton class.

Here's the situation: AMDecompositonAutomaton does not inherently support top-down queries. In the (faulty) implementation in the bug_AM_ruleStore_countTrees branch, for a top-down query with label l and parent p, it simply returns all rules previously seen in a bottom-up query that have label l and parent p. The expected problem is that if not all rules have been explored yet, this will return a set of rules that is too small. This also still exists in the main branch, I will update it soon to make all rules explicit first.

This bug is about an unexpected problem: In some cases, getRulesTopDown seems to return too many rules. To replicate, check out the bug_AM_ruleStore_countTrees branch and run the main of de.up.ling.irtg.algebra.graph.ApplyModifyAlgebra. In that example, after running two specific functions on one such decomposition automaton, the language size returned by countRules() is 5 instead of 3. I suspect it is a problem with the RuleStore class, but I'm not sure.