diff --git a/LICENSE b/LICENSE index 102126f..510a6d6 100644 --- a/LICENSE +++ b/LICENSE @@ -1,30 +1,21 @@ -Copyright Author name here (c) 2019 +MIT License -All rights reserved. +Copyright (c) 2019 Garmelon -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. - * Redistributions in binary form must reproduce the above - copyright notice, this list of conditions and the following - disclaimer in the documentation and/or other materials provided - with the distribution. - - * Neither the name of Author name here nor the names of other - contributors may be used to endorse or promote products derived - from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md index c564de6..1dfbd7b 100644 --- a/README.md +++ b/README.md @@ -1 +1,36 @@ # rextra + +At the moment, rextra can display DFAs and NFAs using Graphviz, +convert between NFAs and DFAs, and minimize DFAs. + +The representation of DFAs and NFAs assumes an infinite alphabet: + +DFA states always contain a default transition (marked with `*` in the +visualisations), which is taken if the current token doesn't appear in +any of the other transitions. + +NFA transitions either apply to a set of tokens, or to all tokens +*except* a specified set. In the visualisation, the character `Σ` +denotes the alphabet of tokens. + +## Example + +This example minimizes the DFA shown on the +[wikipedia article about DFA minimization](https://en.wikipedia.org/wiki/DFA_minimization). + +Transitions for the token `1` are specified explicitly (where +necessary), while transitions for the token `0` are represented by the +default transition marked with `*`. + +This ghci session shows the minimization of the DFA mentioned above. + +``` haskell +>>> Just a = dfa [ ("a",[('1',"c")],"b"), ("b",[('1',"d")],"a"), ("c",[('1',"f")],"e"), ("d",[('1',"f")],"e"), ("e",[('1',"f")],"e"), ("f",[],"f") ] "a" ["c","d","e"] +>>> saveDotAsPng "dfa.png" $ dfaToDot a +``` +![](resources/minimization_example_dfa.png) +``` haskell +>>> saveDotAsPng "dfa_minimized.png" $ dfaToDot $ minimizeDfa a +``` +![](resources/minimization_example_dfa_minimized.png) + diff --git a/package.yaml b/package.yaml index e2da93f..1b3ad81 100644 --- a/package.yaml +++ b/package.yaml @@ -1,10 +1,10 @@ name: rextra version: 0.1.0.0 github: "Garmelon/rextra" -license: BSD3 -author: "Author name here" -maintainer: "example@example.com" -copyright: "2019 Author name here" +license: MIT +author: "Garmelon" +maintainer: "joscha@plugh.de" +copyright: "2019 Garmelon" extra-source-files: - README.md @@ -23,8 +23,6 @@ dependencies: - transformers >= 0.5.6 && < 0.6 - containers >= 0.6 && < 0.7 - graphviz >= 2999.20 && < 2999.21 -- fgl >= 5.7 && < 5.8 -# algebraic-graphs >= 0.4 && < 0.5 library: source-dirs: src diff --git a/resources/minimization_example_dfa.png b/resources/minimization_example_dfa.png new file mode 100644 index 0000000..32eec05 Binary files /dev/null and b/resources/minimization_example_dfa.png differ diff --git a/resources/minimization_example_dfa_minimized.png b/resources/minimization_example_dfa_minimized.png new file mode 100644 index 0000000..464f58e Binary files /dev/null and b/resources/minimization_example_dfa_minimized.png differ