#!/bin/sh # -*- coding: utf-8 -*- # Copyright (C) 2009, 2010, 2012, 2014, 2015 Laboratoire de Recherche # et Développement de l'Epita (LRDE). # Copyright (C) 2003, 2004 Laboratoire d'Informatique de Paris 6 (LIP6), # département Systèmes Répartis Coopératifs (SRC), Université Pierre # et Marie Curie. # # This file is part of Spot, a model checking library. # # Spot is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # Spot is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public # License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . . ./defs set -e autfilt=../../bin/autfilt ltl2tgba=../../bin/ltl2tgba randltl=../../bin/randltl cat >input <<\EOF HOA: v1 States: 3 Start: 0 AP: 3 "a" "b" "F\\G" acc-name: generalized-Buchi 2 Acceptance: 2 Inf(0)&Inf(1) properties: trans-labels explicit-labels state-acc deterministic --BODY-- State: 0 {0 1} [0&!1] 1 State: 1 {0} [2] 2 State: 2 [t] 0 --END-- EOF run 0 $autfilt --hoa input > stdout diff stdout input # Transition merging cat >input <<\EOF HOA: v1 States: 2 Start: 0 AP: 2 "a" "b" acc-name: Buchi Acceptance: 1 Inf(0) properties: trans-labels explicit-labels trans-acc --BODY-- State: 0 [0&1] 1 {0} [!1] 1 [0&!1] 1 {0} State: 1 [!1] 0 [1&0] 0 {0} [0&!1] 0 {0} --END-- EOF cat >expected <<\EOF HOA: v1 States: 2 Start: 0 AP: 2 "a" "b" acc-name: Buchi Acceptance: 1 Inf(0) properties: trans-labels explicit-labels trans-acc --BODY-- State: 0 [!1] 1 [0] 1 {0} State: 1 [!1] 0 [0] 0 {0} --END-- EOF run 0 ../../bin/autfilt --merge-transitions --hoa input > stdout cat stdout run 0 ../../bin/autfilt -F stdout --isomorph expected # Likewise, with a randomly generated TGBA. run 0 ../../bin/randaut -S 20 a b -d 0.2 -a 0.2 -A 2 --hoa | tee input # the first read-write can renumber the states run 0 $autfilt --hoa --merge-transitions input > stdout run 0 ../../bin/autfilt -F input --isomorph stdout # But this second output should be the same as the first run 0 $autfilt --hoa stdout > stdout2 diff stdout stdout2 # Find formula that can be translated into a 3-state automaton, and # exercise both %M and %m. The nonexistant file should never be # open, because the input stream is infinite and autfilt should # stop after 10 automata. $randltl -n -1 a b | $ltl2tgba -H -F - | $autfilt -F- -F nonexistant --states=3 --edges=..10 --acc-sets=1.. \ --name='%M, %S states' --stats='<%m>, %e, %a' -n 10 > output cat >expected <, 6, 1 , 4, 1 , 4, 1 , 4, 1 , 6, 1 , 6, 1 , 5, 1 , 4, 1 , 4, 1 , 7, 1 EOF diff output expected cat >input <expected <32 edges, 64->33 transitions" States: 10 Start: 0 AP: 1 "a" acc-name: generalized-Buchi 3 Acceptance: 3 Inf(0)&Inf(1)&Inf(2) properties: trans-labels explicit-labels --BODY-- State: 0 [t] 0 {0} [!0] 1 {0} [!0] 2 {0 2} [0] 3 {0 2} [!0] 4 {0 1} [!0] 5 {0 1} [!0] 6 {0 1 2} [!0] 7 {0 1} [!0] 8 {0 1} [!0] 9 {0 1 2} State: 1 {0 2} [0] 3 State: 2 [!0] 2 {0 2} [!0] 6 {0 1 2} [!0] 9 {0 1 2} State: 3 [!0] 1 {0 2} [!0] 2 {0 2} [0] 3 {0 2} [!0] 5 {0 1 2} [!0] 6 {0 1 2} [!0] 8 {0 1 2} [!0] 9 {0 1 2} State: 4 [!0] 4 {1} [!0] 5 {1} [!0] 6 {1 2} [!0] 7 {1} [!0] 8 {1} [!0] 9 {1 2} State: 5 State: 6 {1 2} [!0] 6 [!0] 9 State: 7 [0] 0 {0} [0] 3 {0 2} State: 8 {0 2} [0] 3 State: 9 --END-- EOF $autfilt --merge -Hm input --name="%E->%e edges, %T->%t transitions" > output diff output expected cat < tmp.hoa a U b false !b && Xb && GFa EOF $autfilt output cat >expected <input <output cat >expected < 3 subgraph cluster_0 { label="" 1 [label="s1", peripheries=2] } subgraph cluster_1 { label="" 0 [label="s0", peripheries=2] } subgraph cluster_2 { label="" 3 [label="s3"] } 0 -> 0 [label="b"] 1 -> 1 [label="a"] 2 [label="s2"] 2 -> 0 [label="b"] 3 -> 1 [label="a"] 3 -> 0 [label="b"] } EOF diff output expected test 1 = `$autfilt -H input --complete | $autfilt --is-complete --count`