|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
UnaryModel | Line # 29 | 63 | 19 | 95.3% |
0.9529412
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||
(49) | |||
Result | |||
0.90588236
|
org.qedeq.kernel.bo.service.heuristic.HeuristicCheckerPluginTest.testQedeqLogicScript2 org.qedeq.kernel.bo.service.heuristic.HeuristicCheckerPluginTest.testQedeqLogicScript2 | 1 PASS | |
0.8235294
|
org.qedeq.kernel.bo.service.heuristic.HeuristicCheckerPluginTest.testQedeqSetTheoryScript2 org.qedeq.kernel.bo.service.heuristic.HeuristicCheckerPluginTest.testQedeqSetTheoryScript2 | 1 PASS | |
0.34117648
|
org.qedeq.kernel.bo.logic.model.CalculateTruthTestCase.testTautology40 org.qedeq.kernel.bo.logic.model.CalculateTruthTestCase.testTautology40 | 1 PASS | |
0.34117648
|
org.qedeq.kernel.bo.logic.model.CalculateTruthUnaryModelTest.testTautology31 org.qedeq.kernel.bo.logic.model.CalculateTruthUnaryModelTest.testTautology31 | 1 PASS | |
0.34117648
|
org.qedeq.kernel.bo.logic.model.CalculateTruthUnaryModelTest.testTautology19 org.qedeq.kernel.bo.logic.model.CalculateTruthUnaryModelTest.testTautology19 | 1 PASS | |
0.34117648
|
org.qedeq.kernel.bo.logic.model.CalculateTruthUnaryModelTest.testTautology20 org.qedeq.kernel.bo.logic.model.CalculateTruthUnaryModelTest.testTautology20 | 1 PASS | |
0.34117648
|
org.qedeq.kernel.bo.logic.model.CalculateTruthTestCase.testTautology30 org.qedeq.kernel.bo.logic.model.CalculateTruthTestCase.testTautology30 | 1 PASS | |
0.34117648
|
org.qedeq.kernel.bo.logic.model.CalculateTruthTestCase.testTautology18 org.qedeq.kernel.bo.logic.model.CalculateTruthTestCase.testTautology18 | 1 PASS | |
0.34117648
|
org.qedeq.kernel.bo.logic.model.CalculateTruthTestCase.testTautology29 org.qedeq.kernel.bo.logic.model.CalculateTruthTestCase.testTautology29 | 1 PASS | |
0.27058825
|
org.qedeq.kernel.bo.logic.model.CalculateTruthTestCase.testTautology45 org.qedeq.kernel.bo.logic.model.CalculateTruthTestCase.testTautology45 | 1 PASS | |
0.22352941
|
org.qedeq.kernel.bo.logic.model.CalculateTruthTestCase.testTautology38 org.qedeq.kernel.bo.logic.model.CalculateTruthTestCase.testTautology38 | 1 PASS | |
0.22352941
|
org.qedeq.kernel.bo.logic.model.CalculateTruthTestCase.testTautology47 org.qedeq.kernel.bo.logic.model.CalculateTruthTestCase.testTautology47 | 1 PASS | |
0.22352941
|
org.qedeq.kernel.bo.logic.model.CalculateTruthTestCase.testTautology44 org.qedeq.kernel.bo.logic.model.CalculateTruthTestCase.testTautology44 | 1 PASS | |
0.22352941
|
org.qedeq.kernel.bo.logic.model.CalculateTruthUnaryModelTest.testTautology37 org.qedeq.kernel.bo.logic.model.CalculateTruthUnaryModelTest.testTautology37 | 1 PASS | |
0.22352941
|
org.qedeq.kernel.bo.logic.model.CalculateTruthTestCase.testTautology46 org.qedeq.kernel.bo.logic.model.CalculateTruthTestCase.testTautology46 | 1 PASS | |
0.22352941
|
org.qedeq.kernel.bo.logic.model.CalculateTruthTestCase.testTautology36 org.qedeq.kernel.bo.logic.model.CalculateTruthTestCase.testTautology36 | 1 PASS | |
0.1764706
|
org.qedeq.kernel.bo.logic.model.CalculateTruthUnaryModelTest.testTautology41 org.qedeq.kernel.bo.logic.model.CalculateTruthUnaryModelTest.testTautology41 | 1 PASS | |
0.1764706
|
org.qedeq.kernel.bo.logic.model.CalculateTruthTestCase.testTautology26 org.qedeq.kernel.bo.logic.model.CalculateTruthTestCase.testTautology26 | 1 PASS | |
0.1764706
|
org.qedeq.kernel.bo.logic.model.CalculateTruthTestCase.testTautology32 org.qedeq.kernel.bo.logic.model.CalculateTruthTestCase.testTautology32 | 1 PASS | |
0.1764706
|
org.qedeq.kernel.bo.logic.model.CalculateTruthTestCase.testTautology23 org.qedeq.kernel.bo.logic.model.CalculateTruthTestCase.testTautology23 | 1 PASS | |
0.1764706
|
org.qedeq.kernel.bo.logic.model.CalculateTruthUnaryModelTest.testTautology28 org.qedeq.kernel.bo.logic.model.CalculateTruthUnaryModelTest.testTautology28 | 1 PASS | |
0.1764706
|
org.qedeq.kernel.bo.logic.model.CalculateTruthTestCase.testTautology43 org.qedeq.kernel.bo.logic.model.CalculateTruthTestCase.testTautology43 | 1 PASS | |
0.1764706
|
org.qedeq.kernel.bo.logic.model.CalculateTruthTestCase.testTautology42 org.qedeq.kernel.bo.logic.model.CalculateTruthTestCase.testTautology42 | 1 PASS | |
0.1764706
|
org.qedeq.kernel.bo.logic.model.CalculateTruthUnaryModelTest.testTautology21 org.qedeq.kernel.bo.logic.model.CalculateTruthUnaryModelTest.testTautology21 | 1 PASS | |
0.1764706
|
org.qedeq.kernel.bo.logic.model.CalculateTruthTestCase.testTautology27 org.qedeq.kernel.bo.logic.model.CalculateTruthTestCase.testTautology27 | 1 PASS | |
0.1764706
|
org.qedeq.kernel.bo.logic.model.CalculateTruthTestCase.testTautology22 org.qedeq.kernel.bo.logic.model.CalculateTruthTestCase.testTautology22 | 1 PASS | |
0.15294118
|
org.qedeq.kernel.bo.logic.model.CalculateTruthTestCase.testTautology33 org.qedeq.kernel.bo.logic.model.CalculateTruthTestCase.testTautology33 | 1 PASS | |
0.15294118
|
org.qedeq.kernel.bo.logic.model.CalculateTruthTestCase.testTautology35 org.qedeq.kernel.bo.logic.model.CalculateTruthTestCase.testTautology35 | 1 PASS | |
0.15294118
|
org.qedeq.kernel.bo.logic.model.CalculateTruthUnaryModelTest.testTautology34 org.qedeq.kernel.bo.logic.model.CalculateTruthUnaryModelTest.testTautology34 | 1 PASS | |
0.15294118
|
org.qedeq.kernel.bo.logic.model.CalculateTruthTestCase.testTautology39 org.qedeq.kernel.bo.logic.model.CalculateTruthTestCase.testTautology39 | 1 PASS | |
0.12941177
|
org.qedeq.kernel.bo.logic.model.CalculateTruthTestCase.testTautology12 org.qedeq.kernel.bo.logic.model.CalculateTruthTestCase.testTautology12 | 1 PASS | |
0.12941177
|
org.qedeq.kernel.bo.logic.model.CalculateTruthTestCase.testTautology11 org.qedeq.kernel.bo.logic.model.CalculateTruthTestCase.testTautology11 | 1 PASS | |
0.12941177
|
org.qedeq.kernel.bo.logic.model.CalculateTruthTestCase.testTautology04 org.qedeq.kernel.bo.logic.model.CalculateTruthTestCase.testTautology04 | 1 PASS | |
0.12941177
|
org.qedeq.kernel.bo.logic.model.CalculateTruthTestCase.testTautology06 org.qedeq.kernel.bo.logic.model.CalculateTruthTestCase.testTautology06 | 1 PASS | |
0.12941177
|
org.qedeq.kernel.bo.logic.model.CalculateTruthTestCase.testTautology15 org.qedeq.kernel.bo.logic.model.CalculateTruthTestCase.testTautology15 | 1 PASS | |
0.12941177
|
org.qedeq.kernel.bo.logic.model.CalculateTruthTestCase.testTautology14 org.qedeq.kernel.bo.logic.model.CalculateTruthTestCase.testTautology14 | 1 PASS | |
0.12941177
|
org.qedeq.kernel.bo.logic.model.CalculateTruthTestCase.testTautology10 org.qedeq.kernel.bo.logic.model.CalculateTruthTestCase.testTautology10 | 1 PASS | |
0.12941177
|
org.qedeq.kernel.bo.logic.model.CalculateTruthTestCase.testTautology16 org.qedeq.kernel.bo.logic.model.CalculateTruthTestCase.testTautology16 | 1 PASS | |
0.12941177
|
org.qedeq.kernel.bo.logic.model.CalculateTruthTestCase.testTautology13 org.qedeq.kernel.bo.logic.model.CalculateTruthTestCase.testTautology13 | 1 PASS | |
0.12941177
|
org.qedeq.kernel.bo.logic.model.CalculateTruthTestCase.testTautology24 org.qedeq.kernel.bo.logic.model.CalculateTruthTestCase.testTautology24 | 1 PASS | |
0.12941177
|
org.qedeq.kernel.bo.logic.model.CalculateTruthTestCase.testTautology02 org.qedeq.kernel.bo.logic.model.CalculateTruthTestCase.testTautology02 | 1 PASS | |
0.12941177
|
org.qedeq.kernel.bo.logic.model.CalculateTruthTestCase.testTautology17 org.qedeq.kernel.bo.logic.model.CalculateTruthTestCase.testTautology17 | 1 PASS | |
0.12941177
|
org.qedeq.kernel.bo.logic.model.CalculateTruthTestCase.testTautology25 org.qedeq.kernel.bo.logic.model.CalculateTruthTestCase.testTautology25 | 1 PASS | |
0.12941177
|
org.qedeq.kernel.bo.logic.model.CalculateTruthTestCase.testTautology07 org.qedeq.kernel.bo.logic.model.CalculateTruthTestCase.testTautology07 | 1 PASS | |
0.12941177
|
org.qedeq.kernel.bo.logic.model.CalculateTruthTestCase.testTautology09 org.qedeq.kernel.bo.logic.model.CalculateTruthTestCase.testTautology09 | 1 PASS | |
0.12941177
|
org.qedeq.kernel.bo.logic.model.CalculateTruthTestCase.testTautology08 org.qedeq.kernel.bo.logic.model.CalculateTruthTestCase.testTautology08 | 1 PASS | |
0.05882353
|
org.qedeq.kernel.bo.logic.model.CalculateTruthTestCase.testTautology05 org.qedeq.kernel.bo.logic.model.CalculateTruthTestCase.testTautology05 | 1 PASS | |
0.05882353
|
org.qedeq.kernel.bo.logic.model.CalculateTruthTestCase.testTautology03 org.qedeq.kernel.bo.logic.model.CalculateTruthTestCase.testTautology03 | 1 PASS | |
0.05882353
|
org.qedeq.kernel.bo.logic.model.CalculateTruthTestCase.testTautology01 org.qedeq.kernel.bo.logic.model.CalculateTruthTestCase.testTautology01 | 1 PASS | |
1 | /* This file is part of the project "Hilbert II" - http://www.qedeq.org | |
2 | * | |
3 | * Copyright 2000-2013, Michael Meyling <mime@qedeq.org>. | |
4 | * | |
5 | * "Hilbert II" is free software; you can redistribute | |
6 | * it and/or modify it under the terms of the GNU General Public | |
7 | * License as published by the Free Software Foundation; either | |
8 | * version 2 of the License, or (at your option) any later version. | |
9 | * | |
10 | * This program is distributed in the hope that it will be useful, | |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | * GNU General Public License for more details. | |
14 | */ | |
15 | ||
16 | package org.qedeq.kernel.bo.logic.model; | |
17 | ||
18 | import java.util.ArrayList; | |
19 | import java.util.HashMap; | |
20 | import java.util.List; | |
21 | import java.util.Map; | |
22 | ||
23 | ||
24 | /** | |
25 | * A model for our mathematical world. It has only one entity. | |
26 | * | |
27 | * @author Michael Meyling | |
28 | */ | |
29 | public final class UnaryModel implements Model { | |
30 | ||
31 | /** "Zero" or empty class. */ | |
32 | public static final Entity ZERO = new Entity(0, "0", "{} or empty set"); | |
33 | ||
34 | /** Map to zero. */ | |
35 | public static final Function FUNCTION_ZERO = new Function(0, 99, "->0", "always 0") { | |
36 | 277 | public Entity map(final Entity[] entities) { |
37 | 277 | return ZERO; |
38 | } | |
39 | }; | |
40 | ||
41 | /** Always return false. */ | |
42 | public static final Predicate FALSE = new Predicate(0, 99, "F", "always false") { | |
43 | 8987 | public boolean calculate(final Entity[] entities) { |
44 | 8987 | return false; |
45 | } | |
46 | }; | |
47 | ||
48 | /** Always return true. */ | |
49 | public static final Predicate TRUE = new Predicate(0, 99, "T", "always true") { | |
50 | 8871 | public boolean calculate(final Entity[] entities) { |
51 | 8871 | return true; |
52 | } | |
53 | }; | |
54 | ||
55 | /** Are the entities ordered by < ? */ | |
56 | public static final Predicate LESS = new Predicate(0, 99, "<", "less") { | |
57 | 76 | public boolean calculate(final Entity[] entities) { |
58 | 76 | boolean result = true; |
59 | 152 | for (int i = 0; i < entities.length - 1; i++) { |
60 | 76 | result &= entities[i].getValue() < entities[i + 1].getValue(); |
61 | } | |
62 | 76 | return result; |
63 | } | |
64 | }; | |
65 | ||
66 | /** Are the entities not ordered by < ? */ | |
67 | public static final Predicate NOT_LESS = Predicate.not(LESS); | |
68 | ||
69 | /** Are the entities are all the same? */ | |
70 | public static final Predicate EQUAL = new Predicate(0, 99, "=", "equal") { | |
71 | 224 | public boolean calculate(final Entity[] entities) { |
72 | 224 | boolean result = true; |
73 | 448 | for (int i = 0; i < entities.length - 1; i++) { |
74 | 224 | result &= entities[i].getValue() == entities[i + 1].getValue(); |
75 | } | |
76 | 224 | return result; |
77 | } | |
78 | }; | |
79 | ||
80 | /** Are the entities are not all the same? */ | |
81 | public static final Predicate NOT_EQUAL = Predicate.not(EQUAL); | |
82 | ||
83 | /** List of all entities in this model. */ | |
84 | private final List entities; | |
85 | ||
86 | /** List of functions for different argument numbers. */ | |
87 | private final List functionPool; | |
88 | ||
89 | /** List of predicates for different argument numbers. */ | |
90 | private final List predicatePool; | |
91 | ||
92 | /** Map of predicate constants. */ | |
93 | private final Map predicateConstants; | |
94 | ||
95 | /** | |
96 | * Constructor. | |
97 | */ | |
98 | 51 | public UnaryModel() { |
99 | 51 | entities = new ArrayList(); |
100 | 51 | entities.add(ZERO); |
101 | ||
102 | 51 | functionPool = new ArrayList(); |
103 | ||
104 | 51 | final List function0 = new ArrayList(); |
105 | 51 | functionPool.add(function0); |
106 | 51 | function0.add(FUNCTION_ZERO); |
107 | ||
108 | 51 | final List function1 = new ArrayList(); |
109 | 51 | functionPool.add(function1); |
110 | 51 | function1.add(FUNCTION_ZERO); |
111 | ||
112 | 51 | final List function2 = new ArrayList(); |
113 | 51 | functionPool.add(function2); |
114 | 51 | function2.add(FUNCTION_ZERO); |
115 | ||
116 | 51 | predicatePool = new ArrayList(); |
117 | ||
118 | 51 | final List predicate0 = new ArrayList(); |
119 | 51 | predicatePool.add(predicate0); |
120 | 51 | predicate0.add(FALSE); |
121 | 51 | predicate0.add(TRUE); |
122 | ||
123 | 51 | final List predicate1 = new ArrayList(); |
124 | 51 | predicatePool.add(predicate1); |
125 | 51 | predicate1.add(FALSE); |
126 | 51 | predicate1.add(TRUE); |
127 | ||
128 | 51 | final List predicate2 = new ArrayList(); |
129 | 51 | predicatePool.add(predicate2); |
130 | 51 | predicate2.add(FALSE); |
131 | 51 | predicate2.add(TRUE); |
132 | 51 | predicate2.add(LESS); |
133 | 51 | predicate2.add(EQUAL); |
134 | ||
135 | 51 | predicateConstants = new HashMap(); |
136 | 51 | predicateConstants.put(new ModelPredicateConstant("TRUE", 0), TRUE); |
137 | 51 | predicateConstants.put(new ModelPredicateConstant("FALSE", 0), FALSE); |
138 | 51 | predicateConstants.put(new ModelPredicateConstant("equal", 2), EQUAL); |
139 | 51 | predicateConstants.put(new ModelPredicateConstant("notEqual", 2), NOT_EQUAL); |
140 | 51 | predicateConstants.put(new ModelPredicateConstant("in", 2), FALSE); |
141 | 51 | predicateConstants.put(new ModelPredicateConstant("notIn", 2), TRUE); |
142 | 51 | predicateConstants.put(new ModelPredicateConstant("isSet", 1), FALSE); |
143 | 51 | predicateConstants.put(new ModelPredicateConstant("subclass", 2), TRUE); |
144 | 51 | predicateConstants.put(new ModelPredicateConstant("isOrderedPair", 1), TRUE); |
145 | 51 | predicateConstants.put(new ModelPredicateConstant("isRelation", 1), TRUE); |
146 | 51 | predicateConstants.put(new ModelPredicateConstant("isFunction", 1), TRUE); |
147 | ||
148 | } | |
149 | ||
150 | 0 | public String getDescription() { |
151 | 0 | return "This model has only one entity. The \" is element of\" relation is never fullfilled."; |
152 | } | |
153 | ||
154 | 4581 | public int getEntitiesSize() { |
155 | 4581 | return entities.size(); |
156 | } | |
157 | ||
158 | 4110 | public Entity getEntity(final int number) { |
159 | 4110 | return (Entity) entities.get(number); |
160 | } | |
161 | ||
162 | 2359 | public int getPredicateSize(final int size) { |
163 | 2359 | if (predicatePool.size() <= size) { |
164 | 0 | return 0; |
165 | } | |
166 | 2359 | return ((List) predicatePool.get(size)).size(); |
167 | } | |
168 | ||
169 | 17423 | public Predicate getPredicate(final int size, final int number) { |
170 | 17423 | final List predicateForSize = (List) predicatePool.get(size); |
171 | 17423 | return (Predicate) predicateForSize.get(number); |
172 | } | |
173 | ||
174 | 779 | public Predicate getPredicateConstant(final ModelPredicateConstant con) { |
175 | 779 | return (Predicate) predicateConstants.get(con); |
176 | } | |
177 | ||
178 | 4 | public int getFunctionSize(final int size) { |
179 | 4 | return 1; |
180 | } | |
181 | ||
182 | 8 | public Function getFunction(final int size, final int number) { |
183 | 8 | return FUNCTION_ZERO; |
184 | } | |
185 | ||
186 | 285 | public Function getFunctionConstant(final ModelFunctionConstant con) { |
187 | 285 | return FUNCTION_ZERO; |
188 | } | |
189 | ||
190 | 83 | public Entity comprehension(final Entity[] array) { |
191 | 83 | return ZERO; |
192 | } | |
193 | ||
194 | } |
|