diff --git a/docs/MTLFormula_8h_source.html b/docs/MTLFormula_8h_source.html index f94929df..a1e350b6 100644 --- a/docs/MTLFormula_8h_source.html +++ b/docs/MTLFormula_8h_source.html @@ -385,7 +385,7 @@
tacos::logic::MTLFormula
Class representing an MTL-formula with the usual operators.
Definition: MTLFormula.h:140
tacos::logic::MTLFormula::get_operands
const std::vector< MTLFormula > & get_operands() const
getter for operands
Definition: MTLFormula.h:260
tacos::logic::MTLFormula::get_operator
LOP get_operator() const
getter for the logical operator
Definition: MTLFormula.h:266
-
tacos::logic::MTLFormula::to_positive_normal_form
MTLFormula to_positive_normal_form() const
Returns normalized formula (positive normal form)
Definition: MTLFormula.hpp:267
+
tacos::logic::MTLFormula::to_positive_normal_form
MTLFormula to_positive_normal_form() const
Returns normalized formula (positive normal form)
Definition: MTLFormula.hpp:263
tacos::logic::MTLFormula::operator||
MTLFormula operator||(const MTLFormula &rhs) const
Boolean-OR operator.
Definition: MTLFormula.hpp:201
tacos::logic::MTLFormula::operator<
bool operator<(const MTLFormula &rhs) const
less operator
Definition: MTLFormula.hpp:233
tacos::logic::MTLFormula::operator>
bool operator>(const MTLFormula &rhs) const
larger operator
Definition: MTLFormula.h:214
@@ -400,11 +400,11 @@
tacos::logic::MTLFormula::MTLFormula
MTLFormula(MTLFormula &&)=default
tacos::logic::MTLFormula::get_maximal_region_index
std::size_t get_maximal_region_index() const
Definition: MTLFormula.h:299
tacos::logic::MTLFormula::get_atomicProposition
AtomicProposition< APType > get_atomicProposition() const
getter for the atomic proposition
Definition: MTLFormula.h:287
-
tacos::logic::MTLFormula::get_alphabet
std::set< AtomicProposition< APType > > get_alphabet() const
collects all used atomic propositions of the formula
Definition: MTLFormula.hpp:323
+
tacos::logic::MTLFormula::get_alphabet
std::set< AtomicProposition< APType > > get_alphabet() const
collects all used atomic propositions of the formula
Definition: MTLFormula.hpp:319
tacos::logic::MTLFormula::FALSE
static MTLFormula FALSE()
Get a formula that is always false.
Definition: MTLFormula.h:169
tacos::logic::MTLFormula::get_interval
TimeInterval get_interval() const
getter for the duration
Definition: MTLFormula.h:276
-
tacos::logic::MTLFormula::get_subformulas_of_type
std::set< MTLFormula< APType > > get_subformulas_of_type(LOP op) const
collects all subformulas of a specific type
Definition: MTLFormula.hpp:336
-
tacos::logic::MTLFormula::get_largest_constant
Endpoint get_largest_constant() const
Definition: MTLFormula.hpp:354
+
tacos::logic::MTLFormula::get_subformulas_of_type
std::set< MTLFormula< APType > > get_subformulas_of_type(LOP op) const
collects all subformulas of a specific type
Definition: MTLFormula.hpp:332
+
tacos::logic::MTLFormula::get_largest_constant
Endpoint get_largest_constant() const
Definition: MTLFormula.hpp:350
tacos::logic::MTLFormula::MTLFormula
MTLFormula(const MTLFormula &)=default
Copy-constructor.
tacos::logic::MTLFormula::operator>=
bool operator>=(const MTLFormula &rhs) const
larger-equal operator
Definition: MTLFormula.h:227
tacos::logic::MTLFormula::create_conjunction
static MTLFormula create_conjunction(const std::vector< MTLFormula > &conjuncts)
Definition: MTLFormula.h:179
diff --git a/docs/MTLFormula_8hpp_source.html b/docs/MTLFormula_8hpp_source.html index 62752129..81a01ff1 100644 --- a/docs/MTLFormula_8hpp_source.html +++ b/docs/MTLFormula_8hpp_source.html @@ -322,161 +322,157 @@
243 return this->get_atomicProposition() < rhs.get_atomicProposition();
244 }
245
-
246 // compare subformulas
-
247 // Note: since the operators are the same, the size of operands needs to be the same
-
248 assert(this->get_operands().size() == rhs.get_operands().size());
-
249
-
250 // Compare intervals before operands.
-
251 if (operator_ == LOP::LUNTIL || operator_ == LOP::LDUNTIL) {
-
252 if (duration_ < rhs.duration_) {
-
253 return true;
-
254 }
-
255 if (rhs.duration_ < duration_) {
-
256 return false;
-
257 }
-
258 }
-
259
-
260 return std::lexicographical_compare(this->get_operands().begin(),
-
261 this->get_operands().end(),
-
262 rhs.get_operands().begin(),
-
263 rhs.get_operands().end());
-
264}
-
265template <typename APType>
-
266MTLFormula<APType>
-
267MTLFormula<APType>::to_positive_normal_form() const
-
268{
-
269 switch (operator_) {
-
270 case LOP::TRUE:
-
271 case LOP::FALSE:
-
272 case LOP::AP: return *this; break;
-
273 case LOP::LNEG: {
-
274 switch (operands_.front().get_operator()) {
-
275 case LOP::TRUE:
-
276 case LOP::FALSE:
-
277 case LOP::AP: return *this; break; // negation in front of ap is conformant
-
278 case LOP::LNEG:
-
279 return MTLFormula(operands_.front().get_operands().front())
-
280 .to_positive_normal_form(); // remove duplicate negations
-
281 break;
-
282 case LOP::LAND:
-
283 case LOP::LOR: {
-
284 std::vector<MTLFormula<APType>> normalized;
-
285 for (const auto &op : operands_.front().get_operands()) {
-
286 normalized.push_back(MTLFormula(LOP::LNEG, {op}).to_positive_normal_form());
-
287 }
-
288 return MTLFormula(dual(operands_.front().get_operator()),
-
289 std::begin(normalized),
-
290 std::end(normalized));
-
291 } break;
-
292 case LOP::LUNTIL:
-
293 case LOP::LDUNTIL: {
-
294 // binary operators: negate operands, use dual operator
-
295 auto neglhs =
-
296 MTLFormula(LOP::LNEG, {operands_.front().get_operands().front()}).to_positive_normal_form();
-
297 auto negrhs =
-
298 MTLFormula(LOP::LNEG, {operands_.front().get_operands().back()}).to_positive_normal_form();
-
299 return MTLFormula(dual(operands_.front().get_operator()),
-
300 {neglhs, negrhs},
-
301 operands_.front().get_interval());
-
302 } break;
-
303 }
-
304 } break;
-
305 case LOP::LAND:
-
306 case LOP::LOR:
-
307 case LOP::LUNTIL:
-
308 case LOP::LDUNTIL: {
-
309 std::vector<MTLFormula<APType>> normalized;
-
310 for (const auto &op : operands_) {
-
311 normalized.push_back(op.to_positive_normal_form());
-
312 }
-
313 auto res = MTLFormula(operator_, std::begin(normalized), std::end(normalized));
-
314 res.duration_ = duration_;
-
315 return res;
-
316 } break;
-
317 }
-
318 throw std::logic_error("Error in to_positive_normal_form: should have returned.");
-
319}
-
320
-
321template <typename APType>
-
322std::set<AtomicProposition<APType>>
-
323MTLFormula<APType>::get_alphabet() const
-
324{
-
325 std::set<MTLFormula> aps = get_subformulas_of_type(LOP::AP);
-
326 std::set<logic::AtomicProposition<APType>> res;
-
327
-
328 for (const auto &sf : aps) {
-
329 res.insert(sf.get_atomicProposition());
-
330 }
-
331 return res;
-
332}
-
333
-
334template <typename APType>
-
335std::set<MTLFormula<APType>>
-
336MTLFormula<APType>::get_subformulas_of_type(LOP op) const
-
337{
-
338 std::set<MTLFormula> res;
+
246 // Compare intervals before operands.
+
247 if (operator_ == LOP::LUNTIL || operator_ == LOP::LDUNTIL) {
+
248 if (duration_ < rhs.duration_) {
+
249 return true;
+
250 }
+
251 if (rhs.duration_ < duration_) {
+
252 return false;
+
253 }
+
254 }
+
255
+
256 return std::lexicographical_compare(this->get_operands().begin(),
+
257 this->get_operands().end(),
+
258 rhs.get_operands().begin(),
+
259 rhs.get_operands().end());
+
260}
+
261template <typename APType>
+
262MTLFormula<APType>
+
263MTLFormula<APType>::to_positive_normal_form() const
+
264{
+
265 switch (operator_) {
+
266 case LOP::TRUE:
+
267 case LOP::FALSE:
+
268 case LOP::AP: return *this; break;
+
269 case LOP::LNEG: {
+
270 switch (operands_.front().get_operator()) {
+
271 case LOP::TRUE:
+
272 case LOP::FALSE:
+
273 case LOP::AP: return *this; break; // negation in front of ap is conformant
+
274 case LOP::LNEG:
+
275 return MTLFormula(operands_.front().get_operands().front())
+
276 .to_positive_normal_form(); // remove duplicate negations
+
277 break;
+
278 case LOP::LAND:
+
279 case LOP::LOR: {
+
280 std::vector<MTLFormula<APType>> normalized;
+
281 for (const auto &op : operands_.front().get_operands()) {
+
282 normalized.push_back(MTLFormula(LOP::LNEG, {op}).to_positive_normal_form());
+
283 }
+
284 return MTLFormula(dual(operands_.front().get_operator()),
+
285 std::begin(normalized),
+
286 std::end(normalized));
+
287 } break;
+
288 case LOP::LUNTIL:
+
289 case LOP::LDUNTIL: {
+
290 // binary operators: negate operands, use dual operator
+
291 auto neglhs =
+
292 MTLFormula(LOP::LNEG, {operands_.front().get_operands().front()}).to_positive_normal_form();
+
293 auto negrhs =
+
294 MTLFormula(LOP::LNEG, {operands_.front().get_operands().back()}).to_positive_normal_form();
+
295 return MTLFormula(dual(operands_.front().get_operator()),
+
296 {neglhs, negrhs},
+
297 operands_.front().get_interval());
+
298 } break;
+
299 }
+
300 } break;
+
301 case LOP::LAND:
+
302 case LOP::LOR:
+
303 case LOP::LUNTIL:
+
304 case LOP::LDUNTIL: {
+
305 std::vector<MTLFormula<APType>> normalized;
+
306 for (const auto &op : operands_) {
+
307 normalized.push_back(op.to_positive_normal_form());
+
308 }
+
309 auto res = MTLFormula(operator_, std::begin(normalized), std::end(normalized));
+
310 res.duration_ = duration_;
+
311 return res;
+
312 } break;
+
313 }
+
314 throw std::logic_error("Error in to_positive_normal_form: should have returned.");
+
315}
+
316
+
317template <typename APType>
+
318std::set<AtomicProposition<APType>>
+
319MTLFormula<APType>::get_alphabet() const
+
320{
+
321 std::set<MTLFormula> aps = get_subformulas_of_type(LOP::AP);
+
322 std::set<logic::AtomicProposition<APType>> res;
+
323
+
324 for (const auto &sf : aps) {
+
325 res.insert(sf.get_atomicProposition());
+
326 }
+
327 return res;
+
328}
+
329
+
330template <typename APType>
+
331std::set<MTLFormula<APType>>
+
332MTLFormula<APType>::get_subformulas_of_type(LOP op) const
+
333{
+
334 std::set<MTLFormula> res;
+
335
+
336 if (get_operator() == op) {
+
337 res.insert(*this);
+
338 }
339
-
340 if (get_operator() == op) {
-
341 res.insert(*this);
-
342 }
-
343
-
344 std::for_each(operands_.begin(), operands_.end(), [&res, op](const MTLFormula &o) {
-
345 auto tmp = o.get_subformulas_of_type(op);
-
346 res.insert(tmp.begin(), tmp.end());
-
347 });
-
348
-
349 return res;
-
350}
-
351
-
352template <typename APType>
-
353Endpoint
-
354MTLFormula<APType>::get_largest_constant() const
-
355{
-
356 Endpoint largest_constant = 0;
-
357 switch (operator_) {
-
358 case LOP::AP:
-
359 case LOP::TRUE:
-
360 case LOP::FALSE: largest_constant = 0; break;
-
361 case LOP::LNEG: largest_constant = operands_[0].get_largest_constant(); break;
-
362 case LOP::LAND:
-
363 case LOP::LOR:
-
364 for (const auto &sub_formula : operands_) {
-
365 largest_constant = std::max(0u, sub_formula.get_largest_constant());
-
366 }
-
367 break;
-
368 case LOP::LUNTIL:
-
369 case LOP::LDUNTIL: {
-
370 if (duration_) {
-
371 if (duration_->upperBoundType() != utilities::arithmetic::BoundType::INFTY) {
-
372 largest_constant = std::max(largest_constant, duration_->upper());
-
373 }
-
374 if (duration_->lowerBoundType() != utilities::arithmetic::BoundType::INFTY) {
-
375 largest_constant = std::max(largest_constant, duration_->lower());
-
376 }
-
377 }
-
378 largest_constant = std::max(
-
379 {largest_constant, operands_[0].get_largest_constant(), operands_[1].get_largest_constant()});
-
380 break;
-
381 }
-
382 }
-
383 return largest_constant;
-
384}
-
385
-
386} // namespace tacos::logic
+
340 std::for_each(operands_.begin(), operands_.end(), [&res, op](const MTLFormula &o) {
+
341 auto tmp = o.get_subformulas_of_type(op);
+
342 res.insert(tmp.begin(), tmp.end());
+
343 });
+
344
+
345 return res;
+
346}
+
347
+
348template <typename APType>
+
349Endpoint
+
350MTLFormula<APType>::get_largest_constant() const
+
351{
+
352 Endpoint largest_constant = 0;
+
353 switch (operator_) {
+
354 case LOP::AP:
+
355 case LOP::TRUE:
+
356 case LOP::FALSE: largest_constant = 0; break;
+
357 case LOP::LNEG: largest_constant = operands_[0].get_largest_constant(); break;
+
358 case LOP::LAND:
+
359 case LOP::LOR:
+
360 for (const auto &sub_formula : operands_) {
+
361 largest_constant = std::max(0u, sub_formula.get_largest_constant());
+
362 }
+
363 break;
+
364 case LOP::LUNTIL:
+
365 case LOP::LDUNTIL: {
+
366 if (duration_) {
+
367 if (duration_->upperBoundType() != utilities::arithmetic::BoundType::INFTY) {
+
368 largest_constant = std::max(largest_constant, duration_->upper());
+
369 }
+
370 if (duration_->lowerBoundType() != utilities::arithmetic::BoundType::INFTY) {
+
371 largest_constant = std::max(largest_constant, duration_->lower());
+
372 }
+
373 }
+
374 largest_constant = std::max(
+
375 {largest_constant, operands_[0].get_largest_constant(), operands_[1].get_largest_constant()});
+
376 break;
+
377 }
+
378 }
+
379 return largest_constant;
+
380}
+
381
+
382} // namespace tacos::logic
tacos::logic::MTLFormula
Class representing an MTL-formula with the usual operators.
Definition: MTLFormula.h:140
tacos::logic::MTLFormula::get_operands
const std::vector< MTLFormula > & get_operands() const
getter for operands
Definition: MTLFormula.h:260
tacos::logic::MTLFormula::get_operator
LOP get_operator() const
getter for the logical operator
Definition: MTLFormula.h:266
-
tacos::logic::MTLFormula::to_positive_normal_form
MTLFormula to_positive_normal_form() const
Returns normalized formula (positive normal form)
Definition: MTLFormula.hpp:267
+
tacos::logic::MTLFormula::to_positive_normal_form
MTLFormula to_positive_normal_form() const
Returns normalized formula (positive normal form)
Definition: MTLFormula.hpp:263
tacos::logic::MTLFormula::operator||
MTLFormula operator||(const MTLFormula &rhs) const
Boolean-OR operator.
Definition: MTLFormula.hpp:201
tacos::logic::MTLFormula::operator<
bool operator<(const MTLFormula &rhs) const
less operator
Definition: MTLFormula.hpp:233
tacos::logic::MTLFormula::dual_until
MTLFormula dual_until(const MTLFormula &rhs, const TimeInterval &duration=TimeInterval()) const
timed dual_until operator (binary)
Definition: MTLFormula.hpp:225
tacos::logic::MTLFormula::operator!
MTLFormula operator!() const
Boolean negation operator.
Definition: MTLFormula.hpp:209
tacos::logic::MTLFormula::operator&&
MTLFormula operator&&(const MTLFormula &rhs) const
Boolean-AND operator.
Definition: MTLFormula.hpp:193
tacos::logic::MTLFormula::get_atomicProposition
AtomicProposition< APType > get_atomicProposition() const
getter for the atomic proposition
Definition: MTLFormula.h:287
-
tacos::logic::MTLFormula::get_alphabet
std::set< AtomicProposition< APType > > get_alphabet() const
collects all used atomic propositions of the formula
Definition: MTLFormula.hpp:323
+
tacos::logic::MTLFormula::get_alphabet
std::set< AtomicProposition< APType > > get_alphabet() const
collects all used atomic propositions of the formula
Definition: MTLFormula.hpp:319
tacos::logic::MTLFormula::get_interval
TimeInterval get_interval() const
getter for the duration
Definition: MTLFormula.h:276
-
tacos::logic::MTLFormula::get_subformulas_of_type
std::set< MTLFormula< APType > > get_subformulas_of_type(LOP op) const
collects all subformulas of a specific type
Definition: MTLFormula.hpp:336
-
tacos::logic::MTLFormula::get_largest_constant
Endpoint get_largest_constant() const
Definition: MTLFormula.hpp:354
+
tacos::logic::MTLFormula::get_subformulas_of_type
std::set< MTLFormula< APType > > get_subformulas_of_type(LOP op) const
collects all subformulas of a specific type
Definition: MTLFormula.hpp:332
+
tacos::logic::MTLFormula::get_largest_constant
Endpoint get_largest_constant() const
Definition: MTLFormula.hpp:350
tacos::logic::MTLFormula::until
MTLFormula until(const MTLFormula &rhs, const TimeInterval &duration=TimeInterval()) const
timed-until operator (binary)
Definition: MTLFormula.hpp:217
tacos::logic::MTLWord::satisfies
bool satisfies(const MTLFormula< APType > &phi) const
Checks satisfaction at pos 0.
Definition: MTLFormula.hpp:180
tacos::logic::MTLWord::satisfies_at
bool satisfies_at(const MTLFormula< APType > &phi, std::size_t i) const
Checks satisfaction at a certain position.
Definition: MTLFormula.hpp:111
diff --git a/docs/translator_8hpp_source.html b/docs/translator_8hpp_source.html index 7a3fde40..f9219df8 100644 --- a/docs/translator_8hpp_source.html +++ b/docs/translator_8hpp_source.html @@ -429,9 +429,9 @@
tacos::logic::MTLFormula
Class representing an MTL-formula with the usual operators.
Definition: MTLFormula.h:140
tacos::logic::MTLFormula::get_operands
const std::vector< MTLFormula > & get_operands() const
getter for operands
Definition: MTLFormula.h:260
tacos::logic::MTLFormula::get_operator
LOP get_operator() const
getter for the logical operator
Definition: MTLFormula.h:266
-
tacos::logic::MTLFormula::to_positive_normal_form
MTLFormula to_positive_normal_form() const
Returns normalized formula (positive normal form)
Definition: MTLFormula.hpp:267
+
tacos::logic::MTLFormula::to_positive_normal_form
MTLFormula to_positive_normal_form() const
Returns normalized formula (positive normal form)
Definition: MTLFormula.hpp:263
tacos::logic::MTLFormula::get_atomicProposition
AtomicProposition< APType > get_atomicProposition() const
getter for the atomic proposition
Definition: MTLFormula.h:287
-
tacos::logic::MTLFormula::get_subformulas_of_type
std::set< MTLFormula< APType > > get_subformulas_of_type(LOP op) const
collects all subformulas of a specific type
Definition: MTLFormula.hpp:336
+
tacos::logic::MTLFormula::get_subformulas_of_type
std::set< MTLFormula< APType > > get_subformulas_of_type(LOP op) const
collects all subformulas of a specific type
Definition: MTLFormula.hpp:332
tacos::automata::ata::create_disjunction
std::unique_ptr< Formula< LocationT > > create_disjunction(std::unique_ptr< Formula< LocationT > > disjunct1, std::unique_ptr< Formula< LocationT > > disjunct2)
Create a disjunction of two formulas. If possible, the formula will be immediately simplified.
Definition: ata_formula.hpp:317
tacos::automata::ata::create_conjunction
std::unique_ptr< Formula< LocationT > > create_conjunction(std::unique_ptr< Formula< LocationT > > conjunct1, std::unique_ptr< Formula< LocationT > > conjunct2)
Create a conjunction of two formulas. If possible, the formula will be immediately simplified.
Definition: ata_formula.hpp:299
tacos::logic::TimeInterval
utilities::arithmetic::Interval< Endpoint > TimeInterval
An interval used for constrained until and dual until operators.
Definition: MTLFormula.h:30