python: more conventional __repr__ for several types

* NEWS: Mention the change.
* python/spot/__init__.py: Add _repr_latex_ for twa_word, and
remove __repr__ and __str__ for atomic_prop_set.
* python/spot/impl.i: Implement __repr__ and __str__ for
atomic_prop_set.  Fix __repr__ for trival, acc_code, acc_cond,
mark_t.  Remove __repr__ for twa_run and twa_word.
* tests/python/acc_cond.ipynb, tests/python/accparse.ipynb,
tests/python/atva16-fig2a.ipynb, tests/python/automata.ipynb,
tests/python/bdditer.py, tests/python/contains.ipynb,
tests/python/gen.ipynb, tests/python/highlighting.ipynb,
tests/python/ltlsimple.py, tests/python/ltsmin-dve.ipynb,
tests/python/product.ipynb, tests/python/relabel.py,
tests/python/satmin.ipynb tests/python/stutter-inv.ipynb,
tests/python/word.ipynb: Adjust test cases.
* tests/python/formulas.ipynb: Add test for atomic_prop_set.
This commit is contained in:
Alexandre Duret-Lutz 2018-11-02 17:18:42 +01:00
parent c3b7a691e4
commit 60296317c7
19 changed files with 686 additions and 700 deletions

View file

@ -42,7 +42,7 @@
"$\\mathsf{G} \\mathsf{F} (a \\leftrightarrow \\mathsf{X} \\mathsf{X} b)$"
],
"text/plain": [
"GF(a <-> XXb)"
"spot.formula(\"GF(a <-> XXb)\")"
]
},
"execution_count": 2,
@ -256,7 +256,7 @@
"</svg>\n"
],
"text/plain": [
"<spot.impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f79c85a5150> >"
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f3f787b3690> >"
]
},
"execution_count": 3,
@ -444,7 +444,7 @@
"</svg>\n"
],
"text/plain": [
"<spot.impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f79c857fb40> >"
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f3f78fcd840> >"
]
},
"execution_count": 4,
@ -680,7 +680,7 @@
"</svg>\n"
],
"text/plain": [
"<spot.impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f79c85d20f0> >"
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f3f78761300> >"
]
},
"execution_count": 5,
@ -913,7 +913,7 @@
"</svg>\n"
],
"text/plain": [
"<spot.impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f79c857f5d0> >"
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f3f78761db0> >"
]
},
"execution_count": 6,
@ -938,7 +938,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"It can be minimized as a 2-state transition-based Rabin:"
"It can be minimized as a 2-state transition-based Rabin automaton:"
]
},
{
@ -1061,7 +1061,7 @@
"</svg>\n"
],
"text/plain": [
"<spot.impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f79c857fc00> >"
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f3f78761ba0> >"
]
},
"execution_count": 7,
@ -1077,12 +1077,12 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Or as a 4-state state-based Rabin:"
"Or as a 4-state state-based Rabin automaton:"
]
},
{
"cell_type": "code",
"execution_count": 8,
"execution_count": 9,
"metadata": {},
"outputs": [
{
@ -1233,10 +1233,10 @@
"</svg>\n"
],
"text/plain": [
"<spot.impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f79c857f9c0> >"
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f3f78761b70> >"
]
},
"execution_count": 8,
"execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
@ -1254,7 +1254,7 @@
},
{
"cell_type": "code",
"execution_count": 9,
"execution_count": 10,
"metadata": {},
"outputs": [
{
@ -1392,10 +1392,10 @@
"</svg>\n"
],
"text/plain": [
"<spot.impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f79c851b090> >"
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f3f787b3720> >"
]
},
"execution_count": 9,
"execution_count": 10,
"metadata": {},
"output_type": "execute_result"
}
@ -1417,7 +1417,7 @@
},
{
"cell_type": "code",
"execution_count": 10,
"execution_count": 11,
"metadata": {},
"outputs": [
{
@ -1478,9 +1478,9 @@
" <td>40</td>\n",
" <td>2760</td>\n",
" <td>224707</td>\n",
" <td>9</td>\n",
" <td>8</td>\n",
" <td>0</td>\n",
" <td>6</td>\n",
" <td>7</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
@ -1494,7 +1494,7 @@
" <td>155020</td>\n",
" <td>6</td>\n",
" <td>0</td>\n",
" <td>7</td>\n",
" <td>5</td>\n",
" <td>0</td>\n",
" </tr>\n",
" </tbody>\n",
@ -1509,8 +1509,8 @@
"\n",
" clauses enc.user enc.sys sat.user sat.sys \n",
"0 48806 2 0 1 0 \n",
"1 224707 9 0 6 0 \n",
"2 155020 6 0 7 0 "
"1 224707 8 0 7 0 \n",
"2 155020 6 0 5 0 "
]
},
"metadata": {},
@ -1651,10 +1651,10 @@
"</svg>\n"
],
"text/plain": [
"<spot.impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f79cdb10330> >"
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f3f5be97960> >"
]
},
"execution_count": 10,
"execution_count": 11,
"metadata": {},
"output_type": "execute_result"
}
@ -1672,7 +1672,7 @@
},
{
"cell_type": "code",
"execution_count": 11,
"execution_count": 12,
"metadata": {},
"outputs": [
{
@ -1733,9 +1733,9 @@
" <td>32</td>\n",
" <td>960</td>\n",
" <td>71987</td>\n",
" <td>3</td>\n",
" <td>4</td>\n",
" <td>0</td>\n",
" <td>2</td>\n",
" <td>1</td>\n",
" <td>0</td>\n",
" </tr>\n",
" </tbody>\n",
@ -1749,7 +1749,7 @@
"\n",
" clauses enc.user enc.sys sat.user sat.sys \n",
"0 15542 1 0 0 0 \n",
"1 71987 3 0 2 0 "
"1 71987 4 0 1 0 "
]
},
"metadata": {},
@ -1883,10 +1883,10 @@
"</svg>\n"
],
"text/plain": [
"<spot.impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f79cdb107b0> >"
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f3f5bdc5cc0> >"
]
},
"execution_count": 11,
"execution_count": 12,
"metadata": {},
"output_type": "execute_result"
}
@ -1906,7 +1906,7 @@
},
{
"cell_type": "code",
"execution_count": 12,
"execution_count": 13,
"metadata": {},
"outputs": [
{
@ -1954,8 +1954,8 @@
" <td>2300</td>\n",
" <td>285287</td>\n",
" <td>13</td>\n",
" <td>0</td>\n",
" <td>9</td>\n",
" <td>1</td>\n",
" <td>10</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
@ -1981,7 +1981,7 @@
" <td>NaN</td>\n",
" <td>92</td>\n",
" <td>2193</td>\n",
" <td>0</td>\n",
" <td>1</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
@ -1997,9 +1997,9 @@
"2 2 1 NaN NaN NaN 92 \n",
"\n",
" clauses enc.user enc.sys sat.user sat.sys \n",
"0 285287 13 0 9 0 \n",
"0 285287 13 1 10 0 \n",
"1 17993 1 0 0 0 \n",
"2 2193 0 0 0 0 "
"2 2193 1 0 0 0 "
]
},
"metadata": {},
@ -2097,10 +2097,10 @@
"</svg>\n"
],
"text/plain": [
"<spot.impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f79cdb108d0> >"
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f3f78761d20> >"
]
},
"execution_count": 12,
"execution_count": 13,
"metadata": {},
"output_type": "execute_result"
}
@ -2118,7 +2118,7 @@
},
{
"cell_type": "code",
"execution_count": 13,
"execution_count": 14,
"metadata": {},
"outputs": [
{
@ -2165,9 +2165,9 @@
" <td>40</td>\n",
" <td>2742</td>\n",
" <td>173183</td>\n",
" <td>6</td>\n",
" <td>7</td>\n",
" <td>0</td>\n",
" <td>3</td>\n",
" <td>2</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
@ -2209,7 +2209,7 @@
"2 4 3 NaN NaN NaN 363 \n",
"\n",
" clauses enc.user enc.sys sat.user sat.sys \n",
"0 173183 6 0 3 0 \n",
"0 173183 7 0 2 0 \n",
"1 45412 2 0 0 0 \n",
"2 10496 1 0 0 0 "
]
@ -2348,10 +2348,10 @@
"</svg>\n"
],
"text/plain": [
"<spot.impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f79c857fba0> >"
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f3f5bdc5d20> >"
]
},
"execution_count": 13,
"execution_count": 14,
"metadata": {},
"output_type": "execute_result"
}
@ -2382,7 +2382,7 @@
},
{
"cell_type": "code",
"execution_count": 14,
"execution_count": 15,
"metadata": {},
"outputs": [
{
@ -2429,9 +2429,9 @@
" <td>NaN</td>\n",
" <td>2747</td>\n",
" <td>173427</td>\n",
" <td>6</td>\n",
" <td>7</td>\n",
" <td>0</td>\n",
" <td>1</td>\n",
" <td>2</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
@ -2445,7 +2445,7 @@
" <td>173427</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>1</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
@ -2473,8 +2473,8 @@
"2 6 4 4 12 32 2747 \n",
"\n",
" clauses enc.user enc.sys sat.user sat.sys \n",
"0 173427 6 0 1 0 \n",
"1 173427 0 0 1 0 \n",
"0 173427 7 0 2 0 \n",
"1 173427 0 0 0 0 \n",
"2 173427 0 0 0 0 "
]
},
@ -2619,10 +2619,10 @@
"</svg>\n"
],
"text/plain": [
"<spot.impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f79cdb10b10> >"
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f3f5bdc5f00> >"
]
},
"execution_count": 14,
"execution_count": 15,
"metadata": {},
"output_type": "execute_result"
}
@ -2642,7 +2642,7 @@
},
{
"cell_type": "code",
"execution_count": 15,
"execution_count": 16,
"metadata": {},
"outputs": [
{
@ -2691,7 +2691,7 @@
" <td>173183</td>\n",
" <td>6</td>\n",
" <td>0</td>\n",
" <td>3</td>\n",
" <td>2</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
@ -2704,7 +2704,7 @@
" <td>2742</td>\n",
" <td>173279</td>\n",
" <td>0</td>\n",
" <td>1</td>\n",
" <td>0</td>\n",
" <td>1</td>\n",
" <td>0</td>\n",
" </tr>\n",
@ -2733,8 +2733,8 @@
"2 4 3 NaN NaN NaN 2742 \n",
"\n",
" clauses enc.user enc.sys sat.user sat.sys \n",
"0 173183 6 0 3 0 \n",
"1 173279 0 1 1 0 \n",
"0 173183 6 0 2 0 \n",
"1 173279 0 0 1 0 \n",
"2 173327 0 0 0 0 "
]
},
@ -2879,10 +2879,10 @@
"</svg>\n"
],
"text/plain": [
"<spot.impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f79cdb10c30> >"
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f3f78fcd630> >"
]
},
"execution_count": 15,
"execution_count": 16,
"metadata": {},
"output_type": "execute_result"
}
@ -2904,7 +2904,7 @@
},
{
"cell_type": "code",
"execution_count": 16,
"execution_count": 17,
"metadata": {},
"outputs": [
{
@ -3045,7 +3045,7 @@
"</svg>\n"
],
"text/plain": [
"<spot.impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f79cdb109f0> >"
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f3f5bd9e060> >"
]
},
"metadata": {},
@ -3098,7 +3098,7 @@
" <td>173183</td>\n",
" <td>7</td>\n",
" <td>0</td>\n",
" <td>3</td>\n",
" <td>2</td>\n",
" <td>0</td>\n",
" <td>HOA: v1 States: 5 Start: 0 AP: 3 \"a\" \"c\" \"b\" a...</td>\n",
" </tr>\n",
@ -3143,7 +3143,7 @@
"2 4 3 NaN NaN NaN 2742 \n",
"\n",
" clauses enc.user enc.sys sat.user sat.sys \\\n",
"0 173183 7 0 3 0 \n",
"0 173183 7 0 2 0 \n",
"1 173279 0 0 1 0 \n",
"2 173327 0 0 0 0 \n",
"\n",
@ -3172,7 +3172,7 @@
},
{
"cell_type": "code",
"execution_count": 17,
"execution_count": 18,
"metadata": {},
"outputs": [
{
@ -3333,7 +3333,7 @@
"</svg>\n"
],
"text/plain": [
"<spot.impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f79cdb10a80> >"
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f3f5bd9e0c0> >"
]
},
"metadata": {},
@ -3484,7 +3484,7 @@
"</svg>\n"
],
"text/plain": [
"<spot.impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f79cdb10e40> >"
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f3f5bd9e150> >"
]
},
"metadata": {},
@ -3511,7 +3511,7 @@
},
{
"cell_type": "code",
"execution_count": 18,
"execution_count": 19,
"metadata": {},
"outputs": [
{
@ -3716,10 +3716,10 @@
"</svg>\n"
],
"text/plain": [
"<spot.impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f79c857f5d0> >"
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f3f78761db0> >"
]
},
"execution_count": 18,
"execution_count": 19,
"metadata": {},
"output_type": "execute_result"
}
@ -3737,7 +3737,7 @@
},
{
"cell_type": "code",
"execution_count": 19,
"execution_count": 20,
"metadata": {},
"outputs": [
{
@ -3958,10 +3958,10 @@
"</svg>\n"
],
"text/plain": [
"<spot.impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f79cdb10e40> >"
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f3f5bd9e180> >"
]
},
"execution_count": 19,
"execution_count": 20,
"metadata": {},
"output_type": "execute_result"
}
@ -3973,7 +3973,7 @@
},
{
"cell_type": "code",
"execution_count": 20,
"execution_count": 21,
"metadata": {},
"outputs": [
{
@ -4023,7 +4023,7 @@
" <td>2</td>\n",
" <td>0</td>\n",
" <td>1</td>\n",
" <td>1</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
@ -4034,7 +4034,7 @@
" <td>NaN</td>\n",
" <td>162</td>\n",
" <td>3129</td>\n",
" <td>0</td>\n",
" <td>1</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
@ -4048,7 +4048,7 @@
" <td>NaN</td>\n",
" <td>363</td>\n",
" <td>10496</td>\n",
" <td>1</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
@ -4064,9 +4064,9 @@
"2 4 3 NaN NaN NaN 363 \n",
"\n",
" clauses enc.user enc.sys sat.user sat.sys \n",
"0 51612 2 0 1 1 \n",
"1 3129 0 0 0 0 \n",
"2 10496 1 0 0 0 "
"0 51612 2 0 1 0 \n",
"1 3129 1 0 0 0 \n",
"2 10496 0 0 0 0 "
]
},
"metadata": {},
@ -4210,10 +4210,10 @@
"</svg>\n"
],
"text/plain": [
"<spot.impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f79cdae52a0> >"
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f3f5bdc5ea0> >"
]
},
"execution_count": 20,
"execution_count": 21,
"metadata": {},
"output_type": "execute_result"
}
@ -4234,7 +4234,7 @@
},
{
"cell_type": "code",
"execution_count": 21,
"execution_count": 22,
"metadata": {},
"outputs": [
{
@ -4281,9 +4281,9 @@
" <td>56</td>\n",
" <td>1379</td>\n",
" <td>87992</td>\n",
" <td>4</td>\n",
" <td>3</td>\n",
" <td>0</td>\n",
" <td>1</td>\n",
" <td>2</td>\n",
" <td>0</td>\n",
" </tr>\n",
" </tbody>\n",
@ -4295,7 +4295,7 @@
"0 2 7 7 22 56 1379 \n",
"\n",
" clauses enc.user enc.sys sat.user sat.sys \n",
"0 87992 4 0 1 0 "
"0 87992 3 0 2 0 "
]
},
"metadata": {},
@ -4529,10 +4529,10 @@
"</svg>\n"
],
"text/plain": [
"<spot.impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f79cdae5270> >"
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f3f5bdc5f30> >"
]
},
"execution_count": 21,
"execution_count": 22,
"metadata": {},
"output_type": "execute_result"
}
@ -4540,13 +4540,6 @@
"source": [
"spot.sat_minimize(small, acc=\"co-Buchi\", states=7, state_based=True, display_log=True)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
@ -4565,7 +4558,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.5+"
"version": "3.6.7"
}
},
"nbformat": 4,