{ "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.5.3" }, "name": "" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "This example is the left part of Fig.2 in our ATVA'16 paper titled \"*Spot 2.0 \u2014 a framework for LTL and \u03c9-automata manipulation*\"." ] }, { "cell_type": "code", "collapsed": true, "input": [ "import spot\n", "spot.setup(show_default='.abr')" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 1 }, { "cell_type": "code", "collapsed": false, "input": [ "f = spot.formula('GFa <-> GFb'); f" ], "language": "python", "metadata": {}, "outputs": [ { "latex": [ "$\\mathsf{G} \\mathsf{F} a \\leftrightarrow \\mathsf{G} \\mathsf{F} b$" ], "metadata": {}, "output_type": "pyout", "prompt_number": 2, "text": [ "GFa <-> GFb" ] } ], "prompt_number": 2 }, { "cell_type": "code", "collapsed": false, "input": [ "f.translate()" ], "language": "python", "metadata": {}, "outputs": [ { "metadata": {}, "output_type": "pyout", "prompt_number": 3, "svg": [ "\n", "\n", "\n", "\n", "\n", "\n", "G\n", "\n", "Inf(\n", "\u24ff\n", ")&Inf(\n", "\u2776\n", ")\n", "\n", "\n", "1\n", "\n", "1\n", "\n", "\n", "I->1\n", "\n", "\n", "\n", "\n", "1->1\n", "\n", "\n", "1\n", "\n", "\n", "0\n", "\n", "0\n", "\n", "\n", "1->0\n", "\n", "\n", "!a & !b\n", "\n", "\n", "2\n", "\n", "2\n", "\n", "\n", "1->2\n", "\n", "\n", "a | b\n", "\n", "\n", "0->0\n", "\n", "\n", "!a & !b\n", "\u24ff\n", "\u2776\n", "\n", "\n", "2->2\n", "\n", "\n", "!a & b\n", "\u2776\n", "\n", "\n", "2->2\n", "\n", "\n", "!a & !b\n", "\n", "\n", "2->2\n", "\n", "\n", "a & b\n", "\u24ff\n", "\u2776\n", "\n", "\n", "2->2\n", "\n", "\n", "a & !b\n", "\u24ff\n", "\n", "\n", "\n" ], "text": [ " *' at 0x7f79506d2900> >" ] } ], "prompt_number": 3 }, { "cell_type": "code", "collapsed": true, "input": [ "def implies(f, g):\n", " f = spot.formula(f)\n", " g = spot.formula_Not(spot.formula(g))\n", " return spot.product(f.translate(), g.translate()).is_empty()\n", "def equiv(f, g):\n", " return implies(f, g) and implies(g, f)" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 4 }, { "cell_type": "code", "collapsed": false, "input": [ "equiv('a U (b U a)', 'b U a')" ], "language": "python", "metadata": {}, "outputs": [ { "metadata": {}, "output_type": "pyout", "prompt_number": 5, "text": [ "True" ] } ], "prompt_number": 5 }, { "cell_type": "code", "collapsed": false, "input": [ "equiv('!(a U b)', '!a U !b')" ], "language": "python", "metadata": {}, "outputs": [ { "metadata": {}, "output_type": "pyout", "prompt_number": 6, "text": [ "False" ] } ], "prompt_number": 6 } ], "metadata": {} } ] }