Adding function to canonicalize an automaton.
* src/tgbaalgos/are_isomorphic.cc, src/tgbaalgos/are_isomorphic.hh, src/bin/autfilt.cc: are_isomorphic now uses canonicalize. It returns a bool, because the mapping cannot be deduced easily from the canonicalized automaton. * src/graph/graph.hh: Add equality operator to trans_storage_t for easy comparison of transition vectors. * src/tgba/tgbagraph.hh: Add equality operator to tgba_graph_trans_data and to tgba_digraph. * src/tgbaalgos/canonicalize.cc, src/tgbaalgos/canonicalize.hh: New files. * src/tgbaalgos/Makefile.am: Add them. * src/tgbatest/isomorph.test: Test them.
This commit is contained in:
parent
b83d6d7f29
commit
1995602df5
9 changed files with 271 additions and 187 deletions
|
|
@ -23,7 +23,7 @@
|
|||
set -e
|
||||
|
||||
for i in 0 1 2 3 4; do
|
||||
../../bin/randaut a --seed=$i -S4 --hoa >iso$i
|
||||
../../bin/randaut a b --seed=$i -S10 --hoa >iso$i
|
||||
../../bin/autfilt iso$i --randomize --hoa >aut$i
|
||||
done
|
||||
|
||||
|
|
@ -32,3 +32,73 @@ cat aut0 aut1 aut2 aut3 aut4 > all
|
|||
run 0 ../../bin/autfilt all --are-isomorphic iso$i --hoa
|
||||
done) > output
|
||||
diff all output
|
||||
|
||||
# Test if two isomorphic automata with different initial states are detected.
|
||||
cat >aut1 <<EOF
|
||||
HOA: v1
|
||||
name: "1"
|
||||
States: 4
|
||||
Start: 1
|
||||
AP: 0
|
||||
acc-name: all
|
||||
Acceptance: 0 t
|
||||
properties: trans-labels explicit-labels state-acc complete
|
||||
--BODY--
|
||||
State: 0 [t] 1 [t] 1
|
||||
State: 1 [t] 2 [t] 2
|
||||
State: 2 [t] 3 [t] 3
|
||||
State: 3 [t] 0 [t] 0
|
||||
--END--
|
||||
EOF
|
||||
|
||||
cat >aut2 <<EOF
|
||||
HOA: v1
|
||||
name: "1"
|
||||
States: 4
|
||||
Start: 0
|
||||
AP: 0
|
||||
acc-name: all
|
||||
Acceptance: 0 t
|
||||
properties: trans-labels explicit-labels state-acc complete
|
||||
--BODY--
|
||||
State: 0 [t] 1 [t] 1
|
||||
State: 1 [t] 3 [t] 3
|
||||
State: 3 [t] 2 [t] 2
|
||||
State: 2 [t] 0 [t] 0
|
||||
--END--
|
||||
EOF
|
||||
|
||||
# Check that the number of ingoing and outgoing transitions of a state matters,
|
||||
# even if they behave similarly.
|
||||
cat >aut3 <<EOF
|
||||
HOA: v1
|
||||
States: 3
|
||||
Start: 0
|
||||
AP: 0
|
||||
acc-name: all
|
||||
Acceptance: 0 t
|
||||
properties: trans-labels explicit-labels state-acc complete
|
||||
--BODY--
|
||||
State: 0 [t] 1 [t] 2
|
||||
State: 1 [t] 1 [t] 1
|
||||
State: 2 [t] 2
|
||||
--END--
|
||||
EOF
|
||||
|
||||
cat >aut4 <<EOF
|
||||
HOA: v1
|
||||
States: 3
|
||||
Start: 0
|
||||
AP: 0
|
||||
acc-name: all
|
||||
Acceptance: 0 t
|
||||
properties: trans-labels explicit-labels state-acc complete
|
||||
--BODY--
|
||||
State: 0 [t] 1 [t] 2
|
||||
State: 1 [t] 1
|
||||
State: 2 [t] 2 [t] 2
|
||||
--END--
|
||||
EOF
|
||||
|
||||
run 0 ../../bin/autfilt aut1 --are-isomorphic aut2
|
||||
run 0 ../../bin/autfilt aut3 --are-isomorphic aut4
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue