let ltsmin.model.kripke() take the output of atomic_prop_collect()
Fixes #160. * spot/tl/formula.hh (formula::ap): New specialization. * tests/python/ltsmin.ipynb: Test it.
This commit is contained in:
parent
a4f111f342
commit
ed3b58c99c
2 changed files with 55 additions and 6 deletions
|
|
@ -799,6 +799,20 @@ namespace spot
|
||||||
return formula(fnode::ap(name));
|
return formula(fnode::ap(name));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// \brief Build an atomic proposition from... an atomic proposition.
|
||||||
|
///
|
||||||
|
/// The only practical interest of this methods is for the Python
|
||||||
|
/// bindings, where ap() can therefore work both from string or
|
||||||
|
/// atomic propositions.
|
||||||
|
static formula ap(const formula& a)
|
||||||
|
{
|
||||||
|
if (a.kind() == op::ap)
|
||||||
|
return a;
|
||||||
|
else
|
||||||
|
throw std::invalid_argument("atomic propositions cannot be "
|
||||||
|
"constructed from arbitrary formulas");
|
||||||
|
}
|
||||||
|
|
||||||
/// \brief Build a unary operator.
|
/// \brief Build a unary operator.
|
||||||
/// \pre \a o should be one of op::Not, op::X, op::F, op::G,
|
/// \pre \a o should be one of op::Not, op::X, op::F, op::G,
|
||||||
/// op::Closure, op::NegClosure, op::NegClosureMarked.
|
/// op::Closure, op::NegClosure, op::NegClosureMarked.
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@
|
||||||
"version": "3.5.1"
|
"version": "3.5.1"
|
||||||
},
|
},
|
||||||
"name": "",
|
"name": "",
|
||||||
"signature": "sha256:0c10865a9a58374d983e19129ce565c14e590067c1eedf4f12dfe62fa3f58a02"
|
"signature": "sha256:d1444ee3c1e56aaa453ac171d129f0ba4486e1e194debc51965d45429a844334"
|
||||||
},
|
},
|
||||||
"nbformat": 3,
|
"nbformat": 3,
|
||||||
"nbformat_minor": 0,
|
"nbformat_minor": 0,
|
||||||
|
|
@ -447,7 +447,7 @@
|
||||||
"</svg>\n"
|
"</svg>\n"
|
||||||
],
|
],
|
||||||
"text": [
|
"text": [
|
||||||
"<spot.impl.kripke; proxy of <Swig Object of type 'std::shared_ptr< spot::kripke > *' at 0x7fda50a73c90> >"
|
"<spot.impl.kripke; proxy of <Swig Object of type 'std::shared_ptr< spot::kripke > *' at 0x7f7b280d08a0> >"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
@ -726,7 +726,7 @@
|
||||||
"</svg>"
|
"</svg>"
|
||||||
],
|
],
|
||||||
"text": [
|
"text": [
|
||||||
"<IPython.core.display.SVG at 0x7fda50a09710>"
|
"<IPython.core.display.SVG at 0x7f7b280dd630>"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
@ -1082,7 +1082,7 @@
|
||||||
"</svg>"
|
"</svg>"
|
||||||
],
|
],
|
||||||
"text": [
|
"text": [
|
||||||
"<IPython.core.display.SVG at 0x7fda58a31940>"
|
"<IPython.core.display.SVG at 0x7f7b110b9c50>"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
@ -1152,7 +1152,7 @@
|
||||||
"</svg>\n"
|
"</svg>\n"
|
||||||
],
|
],
|
||||||
"text": [
|
"text": [
|
||||||
"<spot.impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7fda58aa2270> >"
|
"<spot.impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f7b2fcf8090> >"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
@ -1314,11 +1314,46 @@
|
||||||
"</svg>\n"
|
"</svg>\n"
|
||||||
],
|
],
|
||||||
"text": [
|
"text": [
|
||||||
"<spot.impl.twa_product; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_product > *' at 0x7fda50a736f0> >"
|
"<spot.impl.twa_product; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_product > *' at 0x7f7b280d08d0> >"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"prompt_number": 13
|
"prompt_number": 13
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"collapsed": false,
|
||||||
|
"input": [
|
||||||
|
"def model_check(f, m):\n",
|
||||||
|
" f = spot.formula(f)\n",
|
||||||
|
" ss = m.kripke(spot.atomic_prop_collect(f))\n",
|
||||||
|
" nf = spot.formula_Not(f).translate()\n",
|
||||||
|
" return spot.otf_product(ss, nf).is_empty() "
|
||||||
|
],
|
||||||
|
"language": "python",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"prompt_number": 14
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"collapsed": false,
|
||||||
|
"input": [
|
||||||
|
"model_check('\"a<1\" R \"b > 1\"', m)"
|
||||||
|
],
|
||||||
|
"language": "python",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"metadata": {},
|
||||||
|
"output_type": "pyout",
|
||||||
|
"prompt_number": 15,
|
||||||
|
"text": [
|
||||||
|
"False"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"prompt_number": 15
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"metadata": {}
|
"metadata": {}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue