001/* Copyright (C) 2013 TU Dortmund
002 * This file is part of LearnLib, http://www.learnlib.de/.
003 * 
004 * LearnLib is free software; you can redistribute it and/or
005 * modify it under the terms of the GNU Lesser General Public
006 * License version 3.0 as published by the Free Software Foundation.
007 * 
008 * LearnLib is distributed in the hope that it will be useful,
009 * but WITHOUT ANY WARRANTY; without even the implied warranty of
010 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
011 * Lesser General Public License for more details.
012 * 
013 * You should have received a copy of the GNU Lesser General Public
014 * License along with LearnLib; if not, see
015 * <http://www.gnu.de/documents/lgpl.en.html>.
016 */
017package de.learnlib.counterexamples;
018
019import java.util.List;
020
021import net.automatalib.automata.concepts.SuffixOutput;
022import net.automatalib.words.Word;
023import de.learnlib.api.AccessSequenceTransformer;
024import de.learnlib.api.LearningAlgorithm;
025import de.learnlib.api.MembershipOracle;
026import de.learnlib.api.Query;
027
028/**
029 * Interface for a global suffix finder. A global suffix finder takes a counterexample
030 * (plus other supplemental information), and returns a list of words that, when used
031 * as distinguishing suffixes, will expose at least one additional state in the hypothesis.
032 * <p>
033 * Please note that the type parameters of these class only constitute <i>upper</i> bounds
034 * for the respective input symbol and output classes, denoting the requirements of the
035 * process in general. A suffix finder which does not
036 * exploit any properties of the used classes will implement this interface with
037 * <tt>&lt;Object,Object&gt;</tt> generic arguments only. The genericity is still maintained
038 * due to the <tt>RI</tt> and <tt>RO</tt> generic parameters in the
039 * {@link #findSuffixIndex(Query, AccessSequenceTransformer, SuffixOutput, MembershipOracle)}
040 * method.
041 * 
042 * @author Malte Isberner <malte.isberner@gmail.com>
043 *
044 * @param <I> input symbol class upper bound
045 * @param <O> output class upper bound
046 */
047public interface GlobalSuffixFinder<I,O> {
048        
049        /**
050         * Finds a set of distinguishing suffixes which will allow to expose at least one additional
051         * state in the hypothesis.
052         * @param <RI> real input symbol class used for *this* counterexample analysis
053         * @param <RO> real output class used for *this* counterexample analysis
054         * @param ceQuery the counterexample query that triggered the refinement. Note that the same
055         * restrictions as in {@link LearningAlgorithm#refineHypothesis(de.learnlib.oracles.DefaultQuery)}
056         * apply.
057         * @param asTransformer an {@link AccessSequenceTransformer} used for access sequence transformation,
058         * if applicable.
059         * @param hypOutput interface to the output generation of the hypothesis, with the aim of
060         * comparing outputs of the hypothesis and the SUL.
061         * @param oracle interface to the System Under Learning (SUL).
062         * @return a set of distinguishing suffixes, or the empty set if the counterexample
063         * could not be analyzed.
064         */
065        public <RI extends I,RO extends O>
066        List<Word<RI>> findSuffixes(Query<RI,RO> ceQuery,
067                        AccessSequenceTransformer<RI> asTransformer,
068                        SuffixOutput<RI,RO> hypOutput,
069                        MembershipOracle<RI,RO> oracle);
070        
071}