-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathFormula.java
More file actions
182 lines (141 loc) · 3.98 KB
/
Formula.java
File metadata and controls
182 lines (141 loc) · 3.98 KB
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
import java.util.List;
import java.util.Set;
class Constant {
String name;
public Constant(String name) {
this.name = name;
}
public String name() {
return this.name;
}
public String eval(Structure m) {
return m.iC(name());
}
@Override
public String toString() {
return name();
}
@Override
public boolean equals(Object other) {
if (this == other) return true;
if (other == null) return false;
if (getClass() != other.getClass()) return false;
Constant otherC = (Constant) other;
return name().equals(otherC.name());
}
@Override
public int hashCode() {
return toString().hashCode();
}
}
class Formula {
public List<Formula> subfs() {
throw new RuntimeException("Not implemented");
}
@Override
public String toString() {
throw new RuntimeException("Not implemented");
}
@Override
public boolean equals(Object other) {
throw new RuntimeException("Not implemented");
}
@Override
public int hashCode() {
return toString().hashCode();
}
public int deg() {
throw new RuntimeException("Not implemented");
}
public Set<AtomicFormula> atoms() {
throw new RuntimeException("Not implemented");
}
public Set<String> constants() {
throw new RuntimeException("Not implemented");
}
public Set<String> predicates() {
throw new RuntimeException("Not implemented");
}
public boolean isTrue(Structure m) {
throw new RuntimeException("Not implemented");
}
/**
* Convert this formula to CNF.
*
* Note: the result of calling this method on a formula that is not in NNF is unspecified!
*
* @return a formula in CNF form that is equivalent / equisatisfiable to this formula.
*/
public final Cnf toCnf() {
return toNnf().nnfToCnf();
}
/**
* Convert this formula to CNF.
*
* Note: the result of calling this method on a formula that is not in NNF is unspecified!
*
* @return a formula in CNF form that is equivalent / equisatisfiable to this formula.
*/
public Cnf nnfToCnf() {
throw new RuntimeException("Not implemented");
}
/**
* Convert this formula to nnf.
* @return a formula in NNF
*/
public Formula toNnf() {
throw new RuntimeException("Not implemented");
}
}
class AtomicFormula extends Formula {
}
class PredicateAtom extends AtomicFormula {
PredicateAtom(String name, List<Constant> args) {
throw new RuntimeException("Not implemented");
}
String name() {
throw new RuntimeException("Not implemented");
}
List<Constant> arguments() {
throw new RuntimeException("Not implemented");
}
}
class Negation extends Formula {
Negation(Formula originalFormula) {
throw new RuntimeException("Not implemented");
}
public Formula originalFormula() {
throw new RuntimeException("Not implemented");
}
}
class Disjunction extends Formula {
Disjunction(List<Formula> disjuncts) {
throw new RuntimeException("Not implemented");
}
}
class Conjunction extends Formula {
Conjunction(List<Formula> conjuncts) {
throw new RuntimeException("Not implemented");
}
}
class BinaryFormula extends Formula {
BinaryFormula(Formula leftSide, Formula rightSide, String connective) {
throw new RuntimeException("Not implemented");
}
public Formula leftSide() {
throw new RuntimeException("Not implemented");
}
public Formula rightSide() {
throw new RuntimeException("Not implemented");
}
}
class Implication extends BinaryFormula {
Implication(Formula leftSide, Formula rightSide) {
super(leftSide, rightSide, "->");
}
}
class Equivalence extends BinaryFormula {
Equivalence(Formula leftSide, Formula rightSide) {
super(leftSide, rightSide, "<->");
}
}