parity: add spot::change_parity()
This function changes the parity acceptance of an automaton.
* spot/twaalgos/parity.cc, spot/twaalgos/parity.hh: Here
* python/spot/impl.i: Add spot/twaalgos/parity.hh
* spot/twaalgos/Makefile.am: Add spot/twaalgos/parity.{cc,hh}
* tests/core/parity.cc, tests/core/parity.test: Add
spot::change_parity() tests
* tests/python/parity.ipynb: Add documentation about
spot::change_parity()
* tests/Makefile.am: Add tests/core/parity.{cc,hh} and
tests/python/parity.ipynb
* doc/org/tut.org: Add the html page of tests/python/parity.ipynb
This commit is contained in:
parent
b7ef7c55d7
commit
27982fb80f
9 changed files with 1916 additions and 1 deletions
91
spot/twaalgos/parity.hh
Normal file
91
spot/twaalgos/parity.hh
Normal file
|
|
@ -0,0 +1,91 @@
|
|||
// -*- coding: utf-8 -*-
|
||||
// Copyright (C) 2016 Laboratoire de Recherche et Développement
|
||||
// de l'Epita (LRDE).
|
||||
//
|
||||
// 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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <spot/misc/common.hh>
|
||||
#include <spot/twa/fwd.hh>
|
||||
|
||||
namespace spot
|
||||
{
|
||||
/// \addtogroup parity_algorithms Parity algorithms
|
||||
/// \ingroup twa_algorithms
|
||||
/// @{
|
||||
/// \brief Parity kind type
|
||||
enum parity_kind
|
||||
{
|
||||
/// The new acceptance will be a parity max
|
||||
parity_kind_max,
|
||||
/// The new acceptance will be a parity min
|
||||
parity_kind_min,
|
||||
/// The new acceptance will keep the kind
|
||||
parity_kind_same,
|
||||
/// The new acceptance may change the kind
|
||||
parity_kind_any
|
||||
};
|
||||
|
||||
/// \brief Parity style type
|
||||
enum parity_style
|
||||
{
|
||||
/// The new acceptance will be a parity odd
|
||||
parity_style_odd,
|
||||
/// The new acceptance will be a parity even
|
||||
parity_style_even,
|
||||
/// The new acceptance will keep the style
|
||||
parity_style_same,
|
||||
/// The new acceptance may change the style
|
||||
parity_style_any
|
||||
};
|
||||
|
||||
/// \brief Change the parity acceptance of an automaton
|
||||
///
|
||||
/// The parity acceptance condition of an automaton is characterized by
|
||||
/// - The kind of the acceptance (min or max).
|
||||
/// - The parity style, i.e., parity of the sets seen infinitely often
|
||||
/// (odd or even).
|
||||
/// - The number of acceptance sets.
|
||||
///
|
||||
/// The output will be an equivalent automaton with the new parity acceptance.
|
||||
/// The number of acceptance sets may be increased by one. Every transition
|
||||
/// will belong to at most one acceptance set. The automaton must have a
|
||||
/// parity acceptance, otherwise an invalid_argument exception is thrown.
|
||||
///
|
||||
/// The parity kind is defined only if the number of acceptance sets
|
||||
/// is strictly greater than 1. The parity_style is defined only if the number
|
||||
/// of acceptance sets is non-zero. Some values of kind and style may result
|
||||
/// in equivalent outputs if the number of acceptance sets of the input
|
||||
/// automaton is not great enough.
|
||||
///
|
||||
/// \param aut the input automaton
|
||||
///
|
||||
/// \param kind the parity kind of the output automaton
|
||||
///
|
||||
/// \param style the parity style of the output automaton
|
||||
///
|
||||
/// \return the automaton with the new acceptance
|
||||
/// @{
|
||||
SPOT_API twa_graph_ptr
|
||||
change_parity(const const_twa_graph_ptr& aut,
|
||||
parity_kind kind, parity_style style);
|
||||
|
||||
SPOT_API twa_graph_ptr
|
||||
change_parity_here(twa_graph_ptr aut, parity_kind kind, parity_style style);
|
||||
/// @}
|
||||
/// @}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue