-
Notifications
You must be signed in to change notification settings - Fork 1
/
TLFormulaEQUIVALENT.cpp
63 lines (46 loc) · 1.59 KB
/
TLFormulaEQUIVALENT.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/*
* File: TLFormulaEQUIVALENT.cc
* Project: QUEST
* Author: Marc Diefenbruch, Axel M. Hirche
* Date: (C) 1997, 1998 University of Essen, Germany
*/
#include "TLFormulaEQUIVALENT.h"
#include "TLFormulaOR.h"
#include "TLFormulaNOT.h"
#include "TLFormulaAND.h"
#if _SC_DMALLOC
#include <dmalloc.h>
#endif
#if _TL_INLINING_ == 0
#include "TLFormulaEQUIVALENT.inl.h"
#endif
TLFormulaEQUIVALENT::~TLFormulaEQUIVALENT (void)
{
/* void */
}
TLFormula* TLFormulaEQUIVALENT::GetCopy (void) const
{
return new TLFormulaEQUIVALENT (this);
}
TLFormula* TLFormulaEQUIVALENT::Rewrite (void) const
{
TLFormulaAND* tmpLeft = new TLFormulaAND (leftOperand->Rewrite(),
rightOperand->Rewrite());
TLFormulaAND* tmpRight = new TLFormulaAND (new TLFormulaNOT (leftOperand->Rewrite(), false),
new TLFormulaNOT (rightOperand->Rewrite(), false));
// Don't try to optimize by using
// temps that do the rewrite once!
// We HAVE to keep it a tree, not
//a graph!!!
return new TLFormulaOR (tmpLeft,
tmpRight); // a <=> b --> (a && b) || (!a && !b)
}
TLFormula* TLFormulaEQUIVALENT::PushNegations (SCBoolean) const
{
TLAssert (false, "Operator EQUIVALENT not allowed here.");
return NULL;
}
SCNatural TLFormulaEQUIVALENT::GetPrecedenceLevel (void) const
{
return PREC_LEVEL_1;
}