| 1 | /* This file is part of the FaCT++ DL reasoner |
| 2 | Copyright (C) 2003-2015 Dmitry Tsarkov and The University of Manchester |
| 3 | Copyright (C) 2015-2017 Dmitry Tsarkov |
| 4 | |
| 5 | This library is free software; you can redistribute it and/or |
| 6 | modify it under the terms of the GNU Lesser General Public |
| 7 | License as published by the Free Software Foundation; either |
| 8 | version 2.1 of the License, or (at your option) any later version. |
| 9 | |
| 10 | This library 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 GNU |
| 13 | Lesser General Public License for more details. |
| 14 | |
| 15 | You should have received a copy of the GNU Lesser General Public |
| 16 | License along with this library; if not, write to the Free Software |
| 17 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 18 | */ |
| 19 | |
| 20 | #include "globaldef.h"cxx . . $ `<file>/Kernel/globaldef.h`/ |
| 21 | |
| 22 | #include <algorithm> // for std::sort |
| 23 | |
| 24 | #include "Reasoner.h"cxx . . $ `<file>/Kernel/Reasoner.h`/ |
| 25 | #include "logging.h"cxx . . $ `<file>/Kernel/logging.h`/ |
| 26 | |
| 27 | #define switchResultcxx . . $ `Kernel/Tactic.cpp:27:9`!(expr)\ |
| 28 | do { if (unlikelycxx . . $ `Kernel/globaldef.h:29:10`!(expr)) return true; } while (false) |
| 29 | |
| 30 | /******************************************************************************** |
| 31 | * Tactics section; |
| 32 | * |
| 33 | * Each Tactic should have a (small) Usability function <name> |
| 34 | * and a Real tactic function <name>Body |
| 35 | * |
| 36 | * Each tactic returns: |
| 37 | * - true - if expansion of CUR lead to clash |
| 38 | * - false - otherwise |
| 39 | * |
| 40 | ******************************************************************************/ |
| 41 | |
| 42 | // main local Tactic |
| 43 | bool DlSatTestercxx . . $ DlSatTester# :: commonTacticcxx . . $ DlSatTester#commonTactic(c9857a73d68e59ba). ( void ) |
| 44 | { |
| 45 | #ifdef ENABLE_CHECKING |
| 46 | fpp_assert ( curConcept.bp() != bpINVALID ); |
| 47 | #endif |
| 48 | |
| 49 | // check if Node is cached and we tries to expand existing result |
| 50 | // also don't do anything for p-blocked nodes (can't be unblocked) |
| 51 | if ( curNodecxx . . $ DlSatTester#curNode.->isCachedcxx . . $ DlCompletionTree#isCached(50ce9a9e25b4a850).() || curNodecxx . . $ DlSatTester#curNode.->isPBlockedcxx . . $ DlCompletionTree#isPBlocked(50ce9a9e25b4a850).() ) |
| 52 | return false; |
| 53 | |
| 54 | // informs about starting calculations... |
| 55 | if ( LLMcxx . . $ LLM..isWritablecxx . . $ LeveLogger#isWritable(8de63fdb265b07c1).(llGTAcxx . . $ llGTA.) ) |
| 56 | logStartEntrycxx . . $ DlSatTester#logStartEntry(83f5f38750778ac8).(); |
| 57 | |
| 58 | bool ret = false; |
| 59 | |
| 60 | // apply tactic only if Node is not an i-blocked |
| 61 | if ( !isIBlockedcxx . . $ DlSatTester#isIBlocked(50ce9a9e25b4a850).() ) |
| 62 | ret = commonTacticBodycxx . . $ DlSatTester#commonTacticBody(eb1459783ad55ca9). ( DLHeapcxx . . $ DlSatTester#DLHeap.[cxx . . $ DLDag#`operator[]`(b4043884e5934906).curConceptcxx . . $ DlSatTester#curConcept.] ); |
| 63 | |
| 64 | if ( LLMcxx . . $ LLM..isWritablecxx . . $ LeveLogger#isWritable(8de63fdb265b07c1).(llGTAcxx . . $ llGTA.) ) |
| 65 | logFinishEntrycxx . . $ DlSatTester#logFinishEntry(a85845bc2b7828e2).(ret); |
| 66 | |
| 67 | return ret; |
| 68 | } |
| 69 | |
| 70 | //------------------------------------------------------------------------------- |
| 71 | // Simple tactics |
| 72 | //------------------------------------------------------------------------------- |
| 73 | |
| 74 | bool DlSatTestercxx . . $ DlSatTester# :: commonTacticBodycxx . . $ DlSatTester#commonTacticBody(eb1459783ad55ca9). ( const DLVertexcxx . . $ DLVertex#& cur ) |
| 75 | { |
| 76 | // show DAG usage |
| 77 | #ifdef RKG_PRINT_DAG_USAGE |
| 78 | const_cast<DLVertex&>(cur).incUsage(isPositive(curConcept.bp())); |
| 79 | #endif |
| 80 | incStatcxx . . $ `Kernel/Reasoner.h:341:10`!(nTacticCalls); |
| 81 | |
| 82 | // call proper tactic |
| 83 | switch ( cur.Typecxx . . $ DLVertexTagDFS#Type(d9c59f5f195b46b8).() ) |
| 84 | { |
| 85 | case dtTopcxx . . $ dtTop.: |
| 86 | fpp_unreachablecxx . . $ `Kernel/fpp_assert.h:49:9`!(); // can't appear here; addToDoEntry deals with constants |
| 87 | return false; |
| 88 | |
| 89 | case dtDataTypecxx . . $ dtDataType.: // data things are checked by data inferer |
| 90 | case dtDataValuecxx . . $ dtDataValue.: |
| 91 | incStatcxx . . $ `Kernel/Reasoner.h:341:10`!(nUseless); |
| 92 | return false; |
| 93 | |
| 94 | case dtPSingletoncxx . . $ dtPSingleton.: |
| 95 | case dtNSingletoncxx . . $ dtNSingleton.: |
| 96 | if ( isPositivecxx . . $ isPositive(83c267b20bac841a). (curConceptcxx . . $ DlSatTester#curConcept..bpcxx . . $ ConceptWDep#bp(455f465bc33b4cdf).()) ) // real singleton |
| 97 | return commonTacticBodySingletoncxx . . $ DlSatTester#commonTacticBodySingleton(eb1459783ad55ca9).(cur); |
| 98 | else // negated singleton -- nothing to do with. |
| 99 | return commonTacticBodyIdcxx . . $ DlSatTester#commonTacticBodyId(eb1459783ad55ca9).(cur); |
| 100 | |
| 101 | case dtNConceptcxx . . $ dtNConcept.: |
| 102 | case dtPConceptcxx . . $ dtPConcept.: |
| 103 | return commonTacticBodyIdcxx . . $ DlSatTester#commonTacticBodyId(eb1459783ad55ca9).(cur); |
| 104 | |
| 105 | case dtAndcxx . . $ dtAnd.: |
| 106 | if ( isPositivecxx . . $ isPositive(83c267b20bac841a). (curConceptcxx . . $ DlSatTester#curConcept..bpcxx . . $ ConceptWDep#bp(455f465bc33b4cdf).()) ) // this is AND vertex |
| 107 | return commonTacticBodyAndcxx . . $ DlSatTester#commonTacticBodyAnd(eb1459783ad55ca9).(cur); |
| 108 | else // OR |
| 109 | return commonTacticBodyOrcxx . . $ DlSatTester#commonTacticBodyOr(eb1459783ad55ca9).(cur); |
| 110 | |
| 111 | case dtForallcxx . . $ dtForall.: |
| 112 | if ( isNegativecxx . . $ isNegative(83c267b20bac841a).(curConceptcxx . . $ DlSatTester#curConcept..bpcxx . . $ ConceptWDep#bp(455f465bc33b4cdf).()) ) // SOME vertex |
| 113 | return commonTacticBodySomecxx . . $ DlSatTester#commonTacticBodySome(eb1459783ad55ca9).(cur); |
| 114 | |
| 115 | // ALL vertex |
| 116 | return commonTacticBodyAllcxx . . $ DlSatTester#commonTacticBodyAll(eb1459783ad55ca9).(cur); |
| 117 | |
| 118 | case dtIrrcxx . . $ dtIrr.: |
| 119 | if ( isNegativecxx . . $ isNegative(83c267b20bac841a).(curConceptcxx . . $ DlSatTester#curConcept..bpcxx . . $ ConceptWDep#bp(455f465bc33b4cdf).()) ) // SOME R.Self vertex |
| 120 | return commonTacticBodySomeSelfcxx . . $ DlSatTester#commonTacticBodySomeSelf(f4c3e7633be50e77).(cur.getRolecxx . . $ DLVertex#getRole(69f26110a94b259f).()); |
| 121 | else // don't need invalidate cache, as IRREFL can only lead to CLASH |
| 122 | return commonTacticBodyIrreflcxx . . $ DlSatTester#commonTacticBodyIrrefl(f4c3e7633be50e77).(cur.getRolecxx . . $ DLVertex#getRole(69f26110a94b259f).()); |
| 123 | |
| 124 | case dtLEcxx . . $ dtLE.: |
| 125 | if ( isNegativecxx . . $ isNegative(83c267b20bac841a). (curConceptcxx . . $ DlSatTester#curConcept..bpcxx . . $ ConceptWDep#bp(455f465bc33b4cdf).()) ) // >= vertex |
| 126 | return commonTacticBodyGEcxx . . $ DlSatTester#commonTacticBodyGE(eb1459783ad55ca9).(cur); |
| 127 | |
| 128 | // <= vertex |
| 129 | if ( isFunctionalVertexcxx . . $ DlSatTester#isFunctionalVertex(eb1459783ad55ca9).(cur) ) |
| 130 | return commonTacticBodyFunccxx . . $ DlSatTester#commonTacticBodyFunc(eb1459783ad55ca9).(cur); |
| 131 | else |
| 132 | return commonTacticBodyLEcxx . . $ DlSatTester#commonTacticBodyLE(eb1459783ad55ca9).(cur); |
| 133 | |
| 134 | case dtProjcxx . . $ dtProj.: |
| 135 | fpp_assertcxx . . $ `Kernel/fpp_assert.h:46:10`! ( isPositive (curConcept.bp()) ); |
| 136 | return commonTacticBodyProjcxx . . $ DlSatTester#commonTacticBodyProj(61818a0a3dc494fb). ( cur.getRolecxx . . $ DLVertex#getRole(69f26110a94b259f).(), cur.getCcxx . . $ DLVertex#getC(455f465bc33b4cdf).(), cur.getProjRolecxx . . $ DLVertex#getProjRole(69f26110a94b259f).() ); |
| 137 | |
| 138 | case dtChoosecxx . . $ dtChoose.: |
| 139 | fpp_assertcxx . . $ `Kernel/fpp_assert.h:46:10`! ( isPositive (curConcept.bp()) ); |
| 140 | return applyChooseRulecxx . . $ DlSatTester#applyChooseRule(313c71cfc95746d6). ( curNodecxx . . $ DlSatTester#curNode., cur.getCcxx . . $ DLVertex#getC(455f465bc33b4cdf).() ); |
| 141 | |
| 142 | default: |
| 143 | fpp_unreachablecxx . . $ `Kernel/fpp_assert.h:49:9`!(); |
| 144 | return false; |
| 145 | } |
| 146 | } |
| 147 | |
| 148 | bool DlSatTestercxx . . $ DlSatTester# :: commonTacticBodyIdcxx . . $ DlSatTester#commonTacticBodyId(eb1459783ad55ca9). ( const DLVertexcxx . . $ DLVertex#& cur ) |
| 149 | { |
| 150 | #ifdef ENABLE_CHECKING |
| 151 | fpp_assert ( isCNameTag(cur.Type()) ); // safety check |
| 152 | #endif |
| 153 | |
| 154 | incStatcxx . . $ `Kernel/Reasoner.h:341:10`!(nIdCalls); |
| 155 | const DepSetcxx . . $ DepSet#& dep = curConceptcxx . . $ DlSatTester#curConcept..getDepcxx . . $ ConceptWDep#getDep(bce6462a16d96b29).(); |
| 156 | |
| 157 | #ifdef RKG_USE_SIMPLE_RULES |
| 158 | // check if we have some simple rules |
| 159 | if ( isPositive(curConcept.bp()) ) |
| 160 | switchResult ( applyExtraRulesIf(static_cast<const TConcept*>(cur.getConcept())) ); |
| 161 | #endif |
| 162 | |
| 163 | // get either body(p) or inverse(body(p)), depends on sign of current ID |
| 164 | BipolarPointercxx . . $ BipolarPointer# C = isPositivecxx . . $ isPositive(83c267b20bac841a).(curConceptcxx . . $ DlSatTester#curConcept..bpcxx . . $ ConceptWDep#bp(455f465bc33b4cdf).()) ? cur.getCcxx . . $ DLVertex#getC(455f465bc33b4cdf).() : inversecxx . . $ inverse(7864480464b09eea).(cur.getCcxx . . $ DLVertex#getC(455f465bc33b4cdf).()); |
| 165 | return addToDoEntrycxx . . $ DlSatTester#addToDoEntry(50176c0f88cf3d4f). ( curNodecxx . . $ DlSatTester#curNode., C, dep ); |
| 166 | } |
| 167 | |
| 168 | /// @return true if the rule is applicable; set the dep-set accordingly |
| 169 | bool |
| 170 | DlSatTestercxx . . $ DlSatTester# :: applicablecxx . . $ DlSatTester#applicable(960c6c35cf19a11a). ( const TBoxcxx . . $ TBox#::TSimpleRulecxx . . $ TBox#TSimpleRule#& rule ) |
| 171 | { |
| 172 | BipolarPointercxx . . $ BipolarPointer# bp = curConceptcxx . . $ DlSatTester#curConcept..bpcxx . . $ ConceptWDep#bp(455f465bc33b4cdf).(); |
| 173 | const CWDArraycxx . . $ CWDArray#& lab = curNodecxx . . $ DlSatTester#curNode.->labelcxx . . $ DlCompletionTree#label(d7a009c437cd4657).().getLabelcxx . . $ CGLabel#getLabel(ad96fabd6ffb3e80).(/*isComplex=*/false); |
| 174 | // dep-set to keep track for all the concepts in a rule-head |
| 175 | DepSetcxx . . $ DepSet# dep = curConceptcxx . . $ TDepSet#TDepSet(d0e32107376501c0)..getDepcxx . . $ ConceptWDep#getDep(bce6462a16d96b29).(); |
| 176 | |
| 177 | for ( const auto& atom: rule.Bodycxx . . $ TBox#TSimpleRule#Body. ) |
| 178 | { |
| 179 | if ( atom->pNamecxx . . $ TConcept#pName. == bp ) |
| 180 | continue; |
| 181 | // FIXME!! double check that's correct (no need to negate pName) |
| 182 | if ( findConceptClashcxx . . $ DlSatTester#findConceptClash(770c5e45e3d3d307). ( lab, atom->pNamecxx . . $ TConcept#pName., dep ) ) |
| 183 | dep =cxx . . $ TDepSet#`operator=`(6a948e2ed08fa462). getClashSetcxx . . $ DlSatTester#getClashSet(bce6462a16d96b29).(); // such a concept exists -- remember clash set |
| 184 | else // no such concept -- can not fire a rule |
| 185 | return false; |
| 186 | } |
| 187 | |
| 188 | // rule will be fired -- set the dep-set |
| 189 | setClashSetcxx . . $ DlSatTester#setClashSet(d0e32107376501c0).(dep); |
| 190 | return true; |
| 191 | } |
| 192 | |
| 193 | bool |
| 194 | DlSatTestercxx . . $ DlSatTester# :: applyExtraRulescxx . . $ DlSatTester#applyExtraRules(15d44b555a30180e). ( const TConceptcxx . . $ TConcept#* C ) |
| 195 | { |
| 196 | for ( auto p = C->er_begincxx . . $ TConcept#er_begin(f9318f544f1b9b20).(), p_end = C->er_endcxx . . $ TConcept#er_end(f9318f544f1b9b20).(); p !=cxx . . $ __gnu_cxx/`operator!=`(ef3c5749062e825c). p_end; ++cxx . . $ __gnu_cxx/__normal_iterator#operator++(93f2e9c3bc4efc49).p ) |
| 197 | { |
| 198 | auto rule = tBoxcxx . . $ DlSatTester#tBox..getSimpleRulecxx . . $ TBox#getSimpleRule(5b04ea8eb21e8d6c).(*cxx . . $ __gnu_cxx/__normal_iterator#`operator*`(c076846f881f3e7e).p); |
| 199 | incStatcxx . . $ `Kernel/Reasoner.h:341:10`!(nSRuleAdd); |
| 200 | if ( applicablecxx . . $ DlSatTester#applicable(960c6c35cf19a11a).(*rule) ) // apply the rule's head |
| 201 | { |
| 202 | incStatcxx . . $ `Kernel/Reasoner.h:341:10`!(nSRuleFire); |
| 203 | switchResultcxx . . $ `Kernel/Tactic.cpp:27:9`! ( addToDoEntry ( curNode, rule->bpHead, getClashSet() ) ); |
| 204 | } |
| 205 | } |
| 206 | |
| 207 | return false; |
| 208 | } |
| 209 | |
| 210 | /// add C to a set of session GCIs; init all nodes with (C,dep) |
| 211 | bool |
| 212 | DlSatTestercxx . . $ DlSatTester# :: addSessionGCIcxx . . $ DlSatTester#addSessionGCI(cbd92d0fb85c8e0). ( BipolarPointercxx . . $ BipolarPointer# C, const DepSetcxx . . $ DepSet#& dep ) |
| 213 | { |
| 214 | SessionGCIscxx . . $ DlSatTester#SessionGCIs..push_backcxx . . $ std/vector#push_back(77d9f17553126ecb).(C); |
| 215 | for ( auto& node: CGraphcxx . . $ DlSatTester#CGraph. ) |
| 216 | if ( isNodeGloballyUsedcxx . . $ DlSatTester#isNodeGloballyUsed(e2c3b6f64f9879b7).(node) && addToDoEntrycxx . . $ DlSatTester#addToDoEntry(50176c0f88cf3d4f). ( node, C, dep, "sg" ) ) |
| 217 | return true; |
| 218 | return false; |
| 219 | } |
| 220 | |
| 221 | bool DlSatTestercxx . . $ DlSatTester# :: commonTacticBodySingletoncxx . . $ DlSatTester#commonTacticBodySingleton(eb1459783ad55ca9). ( const DLVertexcxx . . $ DLVertex#& cur ) |
| 222 | { |
| 223 | #ifdef ENABLE_CHECKING |
| 224 | fpp_assert ( cur.Type() == dtPSingleton || cur.Type() == dtNSingleton ); // safety check |
| 225 | #endif |
| 226 | |
| 227 | incStatcxx . . $ `Kernel/Reasoner.h:341:10`!(nSingletonCalls); |
| 228 | |
| 229 | // can use this rule only in the Nominal reasoner |
| 230 | fpp_assertcxx . . $ `Kernel/fpp_assert.h:46:10`! ( hasNominals() ); |
| 231 | |
| 232 | // if the test REALLY uses nominals, remember this |
| 233 | encounterNominalcxx . . $ DlSatTester#encounterNominal. = true; |
| 234 | |
| 235 | const TIndividualcxx . . $ TIndividual#* C = static_cast<const TIndividualcxx . . $ TIndividual#*>(cur.getConceptcxx . . $ DLVertex#getConcept(1867504d72698304).()); |
| 236 | fpp_assertcxx . . $ `Kernel/fpp_assert.h:46:10`! ( C->node != nullptr ); |
| 237 | |
| 238 | // if node for C was purged due to merge -- find proper one |
| 239 | DepSetcxx . . $ DepSet# dep = curConceptcxx . . $ TDepSet#TDepSet(d0e32107376501c0)..getDepcxx . . $ ConceptWDep#getDep(bce6462a16d96b29).(); |
| 240 | DlCompletionTreecxx . . $ DlCompletionTree#* realNode = C->nodecxx . . $ TIndividual#node.->resolvePBlockercxx . . $ DlCompletionTree#resolvePBlocker(9c33c38202537177).(dep); |
| 241 | |
| 242 | if ( realNode != curNodecxx . . $ DlSatTester#curNode. ) // check if o-rule is applicable |
| 243 | // apply o-rule: merge 2 nodes |
| 244 | // don't need to actually expand P: it was/will be done in C->node |
| 245 | return Mergecxx . . $ DlSatTester#Merge(9805cd4076885613). ( curNodecxx . . $ DlSatTester#curNode., realNode, dep ); |
| 246 | |
| 247 | // singleton behaves as a general named concepts besides nominal cloud |
| 248 | return commonTacticBodyIdcxx . . $ DlSatTester#commonTacticBodyId(eb1459783ad55ca9).(cur); |
| 249 | } |
| 250 | |
| 251 | //------------------------------------------------------------------------------- |
| 252 | // AND/OR processing |
| 253 | //------------------------------------------------------------------------------- |
| 254 | |
| 255 | bool DlSatTestercxx . . $ DlSatTester# :: commonTacticBodyAndcxx . . $ DlSatTester#commonTacticBodyAnd(eb1459783ad55ca9). ( const DLVertexcxx . . $ DLVertex#& cur ) |
| 256 | { |
| 257 | #ifdef ENABLE_CHECKING |
| 258 | fpp_assert ( isPositive(curConcept.bp()) && ( cur.Type() == dtAnd ) ); // safety check |
| 259 | #endif |
| 260 | |
| 261 | incStatcxx . . $ `Kernel/Reasoner.h:341:10`!(nAndCalls); |
| 262 | |
| 263 | const DepSetcxx . . $ DepSet#& dep = curConceptcxx . . $ DlSatTester#curConcept..getDepcxx . . $ ConceptWDep#getDep(bce6462a16d96b29).(); |
| 264 | |
| 265 | // FIXME!! I don't know why, but performance is usually BETTER if using r-iters. |
| 266 | // It's their only usage, so after investigation they can be dropped |
| 267 | for ( DLVertexcxx . . $ DLVertex#::const_reverse_iteratorcxx . . $ DLVertex#const_reverse_iterator# q = curcxx . . $ std/reverse_iterator#reverse_iterator(e2d883c4bd185f58)..rbegincxx . . $ DLVertex#rbegin(58c1148bcabf3013).(); q !=cxx . . $ std/`operator!=`(c2ad8cf295ccec45). cur.rendcxx . . $ DLVertex#rend(58c1148bcabf3013).(); ++cxx . . $ std/reverse_iterator#operator++(b4fad7494eaaab68).q ) |
| 268 | switchResultcxx . . $ `Kernel/Tactic.cpp:27:9`! ( addToDoEntry ( curNode, *q, dep ) ); |
| 269 | |
| 270 | return false; |
| 271 | } |
| 272 | |
| 273 | bool DlSatTestercxx . . $ DlSatTester# :: commonTacticBodyOrcxx . . $ DlSatTester#commonTacticBodyOr(eb1459783ad55ca9). ( const DLVertexcxx . . $ DLVertex#& cur ) // for C \or D concepts |
| 274 | { |
| 275 | #ifdef ENABLE_CHECKING |
| 276 | fpp_assert ( isNegative(curConcept.bp()) && cur.Type() == dtAnd ); // safety check |
| 277 | #endif |
| 278 | |
| 279 | incStatcxx . . $ `Kernel/Reasoner.h:341:10`!(nOrCalls); |
| 280 | |
| 281 | if ( isFirstBranchCallcxx . . $ DlSatTester#isFirstBranchCall(50ce9a9e25b4a850).() ) // check the structure of OR operation (number of applicable concepts) |
| 282 | { |
| 283 | DepSetcxx . . $ DepSet# depcxx . . $ TDepSet#TDepSet(49f6e7a06ebc5aa8).; |
| 284 | if ( planOrProcessingcxx . . $ DlSatTester#planOrProcessing(161d161df85261e4). ( cur, dep ) ) |
| 285 | { // found existing component |
| 286 | if ( LLMcxx . . $ LLM..isWritablecxx . . $ LeveLogger#isWritable(8de63fdb265b07c1).(llGTAcxx . . $ llGTA.) ) |
| 287 | LLcxx . . $ LL. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " E(" <<cxx . . $ std/basic_ostream#`operator<<`(23b6575433a77e57). OrConceptsToTestcxx . . $ DlSatTester#OrConceptsToTest..backcxx . . $ std/vector#back(feee51535944b307).() <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). ")"; |
| 288 | return false; |
| 289 | } |
| 290 | if ( OrConceptsToTestcxx . . $ DlSatTester#OrConceptsToTest..emptycxx . . $ std/vector#empty(50ce9a9e25b4a850).() ) |
| 291 | { // no more applicable concepts: |
| 292 | // set global dep-set using accumulated deps |
| 293 | setClashSetcxx . . $ DlSatTester#setClashSet(d0e32107376501c0).(dep); |
| 294 | return true; |
| 295 | } |
| 296 | // not a branching: just add a single concept |
| 297 | if ( OrConceptsToTestcxx . . $ DlSatTester#OrConceptsToTest..sizecxx . . $ std/vector#size(fe4d2d262d4164a8).() == 1 ) |
| 298 | { |
| 299 | BipolarPointercxx . . $ BipolarPointer# C = OrConceptsToTestcxx . . $ DlSatTester#OrConceptsToTest..backcxx . . $ std/vector#back(feee51535944b307).(); |
| 300 | return insertToDoEntrycxx . . $ DlSatTester#insertToDoEntry(47bd769b3ba2342c). ( curNodecxx . . $ DlSatTester#curNode., ConceptWDepcxx . . $ ConceptWDep#ConceptWDep(12a183a495b39f91).(C,dep), DLHeapcxx . . $ DlSatTester#DLHeap.[cxx . . $ DLDag#`operator[]`(e265d70853dfed20).C].Typecxx . . $ DLVertexTagDFS#Type(d9c59f5f195b46b8).(), "bcp" ); |
| 301 | } |
| 302 | |
| 303 | // more than one alternative: use branching context |
| 304 | createBCOrcxx . . $ DlSatTester#createBCOr(49f6e7a06ebc5aa8).(); |
| 305 | bContextcxx . . $ DlSatTester#bContext.->branchDepcxx . . $ BranchingContext#branchDep. =cxx . . $ TDepSet#`operator=`(6a948e2ed08fa462). dep; |
| 306 | static_cast<BCOrcxx . . $ BCOr#*>(bContextcxx . . $ DlSatTester#bContext.)->applicableOrEntriescxx . . $ BCOr#applicableOrEntries..swapcxx . . $ std/vector#swap(a8be04fc17cbdf49).(OrConceptsToTestcxx . . $ DlSatTester#OrConceptsToTest.); |
| 307 | } |
| 308 | |
| 309 | // now it is OR case with 1 or more applicable concepts |
| 310 | return processOrEntrycxx . . $ DlSatTester#processOrEntry(c9857a73d68e59ba).(); |
| 311 | } |
| 312 | |
| 313 | bool DlSatTestercxx . . $ DlSatTester# :: planOrProcessingcxx . . $ DlSatTester#planOrProcessing(161d161df85261e4). ( const DLVertexcxx . . $ DLVertex#& cur, DepSetcxx . . $ DepSet#& dep ) |
| 314 | { |
| 315 | OrConceptsToTestcxx . . $ DlSatTester#OrConceptsToTest..clearcxx . . $ std/vector#clear(49f6e7a06ebc5aa8).(); |
| 316 | dep =cxx . . $ TDepSet#`operator=`(6a948e2ed08fa462). curConceptcxx . . $ DlSatTester#curConcept..getDepcxx . . $ ConceptWDep#getDep(bce6462a16d96b29).(); |
| 317 | DepSetcxx . . $ DepSet# dummycxx . . $ TDepSet#TDepSet(49f6e7a06ebc5aa8).; |
| 318 | |
| 319 | // check all OR components for the clash |
| 320 | const CGLabelcxx . . $ CGLabel#& lab = curNodecxx . . $ DlSatTester#curNode.->labelcxx . . $ DlCompletionTree#label(d7a009c437cd4657).(); |
| 321 | for ( DLVertexcxx . . $ DLVertex#::const_iteratorcxx . . $ DLVertex#const_iterator# q = cur.begincxx . . $ DLVertex#begin(d2502ee2ca3b883a).(), q_end = cur.endcxx . . $ DLVertex#end(d2502ee2ca3b883a).(); q <cxx . . $ __gnu_cxx/`operator<`(ef3c5749062e825c). q_end; ++cxx . . $ __gnu_cxx/__normal_iterator#operator++(93f2e9c3bc4efc49).q ) |
| 322 | { |
| 323 | BipolarPointercxx . . $ BipolarPointer# C = inversecxx . . $ inverse(7864480464b09eea).(*cxx . . $ __gnu_cxx/__normal_iterator#`operator*`(c076846f881f3e7e).q); |
| 324 | switch ( tryAddConceptcxx . . $ DlSatTester#tryAddConcept(64ab7a30545240e0). ( lab.getLabelcxx . . $ CGLabel#getLabel(b736cd54e89c5a41).(DLHeapcxx . . $ DlSatTester#DLHeap.[cxx . . $ DLDag#`operator[]`(e265d70853dfed20).C].Typecxx . . $ DLVertexTagDFS#Type(d9c59f5f195b46b8).()), C, dummy ) ) |
| 325 | { |
| 326 | case acrClashcxx . . $ acrClash.: // clash found -- OK |
| 327 | dep.addcxx . . $ TDepSet#add(d0e32107376501c0).(getClashSetcxx . . $ DlSatTester#getClashSet(bce6462a16d96b29).()); |
| 328 | continue; |
| 329 | case acrExistcxx . . $ acrExist.: // already have such concept -- save it to the 1st position |
| 330 | OrConceptsToTestcxx . . $ DlSatTester#OrConceptsToTest..resizecxx . . $ std/vector#resize(2c44cd906ae4e829).(1); |
| 331 | OrConceptsToTestcxx . . $ DlSatTester#OrConceptsToTest.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).0] = C; |
| 332 | return true; |
| 333 | case acrDonecxx . . $ acrDone.: |
| 334 | OrConceptsToTestcxx . . $ DlSatTester#OrConceptsToTest..push_backcxx . . $ std/vector#push_back(77d9f17553126ecb).(C); |
| 335 | continue; |
| 336 | default: // safety check |
| 337 | fpp_unreachablecxx . . $ `Kernel/fpp_assert.h:49:9`!(); |
| 338 | } |
| 339 | } |
| 340 | |
| 341 | return false; |
| 342 | } |
| 343 | |
| 344 | bool DlSatTestercxx . . $ DlSatTester# :: processOrEntrycxx . . $ DlSatTester#processOrEntry(c9857a73d68e59ba). ( void ) |
| 345 | { |
| 346 | // save the context here as after save() it would be lost |
| 347 | const BCOrcxx . . $ BCOr#* bcOr = static_cast<BCOrcxx . . $ BCOr#*>(bContextcxx . . $ DlSatTester#bContext.); |
| 348 | BCOrcxx . . $ BCOr#::or_iteratorcxx . . $ BCOr#or_iterator# p = bcOr->orBegcxx . . $ BCOr#orBeg(d2502ee2ca3b883a).(), p_end = bcOr->orCurcxx . . $ BCOr#orCur(d2502ee2ca3b883a).(); |
| 349 | BipolarPointercxx . . $ BipolarPointer# C = *cxx . . $ __gnu_cxx/__normal_iterator#`operator*`(c076846f881f3e7e).p_end; |
| 350 | const char* reason = nullptr; |
| 351 | DepSetcxx . . $ DepSet# depcxx . . $ TDepSet#TDepSet(49f6e7a06ebc5aa8).; |
| 352 | |
| 353 | if ( bcOr->isLastOrEntrycxx . . $ BCOr#isLastOrEntry(50ce9a9e25b4a850).() ) |
| 354 | { |
| 355 | // cumulative dep-set will be used |
| 356 | prepareBranchDepcxx . . $ DlSatTester#prepareBranchDep(49f6e7a06ebc5aa8).(); |
| 357 | dep =cxx . . $ TDepSet#`operator=`(6a948e2ed08fa462). getBranchDepcxx . . $ DlSatTester#getBranchDep(595707e528a7237f).(); |
| 358 | // no more branching decisions |
| 359 | determiniseBranchingOpcxx . . $ DlSatTester#determiniseBranchingOp(49f6e7a06ebc5aa8).(); |
| 360 | reason = "bcp"; |
| 361 | } |
| 362 | else |
| 363 | { |
| 364 | // save current state |
| 365 | savecxx . . $ DlSatTester#save(49f6e7a06ebc5aa8).(); |
| 366 | // new (just branched) dep-set |
| 367 | dep =cxx . . $ TDepSet#`operator=`(6a948e2ed08fa462). getCurDepSetcxx . . $ DlSatTester#getCurDepSet(6e9566718b894103).(); |
| 368 | incStatcxx . . $ `Kernel/Reasoner.h:341:10`!(nOrBrCalls); |
| 369 | } |
| 370 | |
| 371 | // if semantic branching is in use -- add previous entries to the label |
| 372 | if ( useSemanticBranchingcxx . . $ DlSatTester#useSemanticBranching(50ce9a9e25b4a850).() ) |
| 373 | for ( ; p <cxx . . $ __gnu_cxx/`operator<`(ef3c5749062e825c). p_end; ++cxx . . $ __gnu_cxx/__normal_iterator#operator++(93f2e9c3bc4efc49).p ) |
| 374 | if ( addToDoEntrycxx . . $ DlSatTester#addToDoEntry(14ef716f111d87ae). ( curNodecxx . . $ DlSatTester#curNode., ConceptWDepcxx . . $ ConceptWDep#ConceptWDep(12a183a495b39f91).(inversecxx . . $ inverse(7864480464b09eea).(*cxx . . $ __gnu_cxx/__normal_iterator#`operator*`(c076846f881f3e7e).p),dep), "sb" ) ) |
| 375 | fpp_unreachablecxx . . $ `Kernel/fpp_assert.h:49:9`!(); // Both Exists and Clash are errors |
| 376 | |
| 377 | // add new entry to current node |
| 378 | if ( RKG_USE_DYNAMIC_BACKJUMPINGcxx . . $ `Kernel/globaldef.h:52:10`! ) |
| 379 | return addToDoEntrycxx . . $ DlSatTester#addToDoEntry(14ef716f111d87ae). ( curNodecxx . . $ DlSatTester#curNode., ConceptWDepcxx . . $ ConceptWDep#ConceptWDep(12a183a495b39f91).(C,dep), reason ); |
| 380 | else // we know the result would be DONE |
| 381 | return insertToDoEntrycxx . . $ DlSatTester#insertToDoEntry(47bd769b3ba2342c). ( curNodecxx . . $ DlSatTester#curNode., ConceptWDepcxx . . $ ConceptWDep#ConceptWDep(12a183a495b39f91).(C,dep), DLHeapcxx . . $ DlSatTester#DLHeap.[cxx . . $ DLDag#`operator[]`(e265d70853dfed20).C].Typecxx . . $ DLVertexTagDFS#Type(d9c59f5f195b46b8).(), reason ); |
| 382 | } |
| 383 | |
| 384 | //------------------------------------------------------------------------------- |
| 385 | // ALL processing |
| 386 | //------------------------------------------------------------------------------- |
| 387 | |
| 388 | bool DlSatTestercxx . . $ DlSatTester# :: commonTacticBodyAllComplexcxx . . $ DlSatTester#commonTacticBodyAllComplex(eb1459783ad55ca9). ( const DLVertexcxx . . $ DLVertex#& cur ) |
| 389 | { |
| 390 | const DepSetcxx . . $ DepSet#& dep = curConceptcxx . . $ DlSatTester#curConcept..getDepcxx . . $ ConceptWDep#getDep(bce6462a16d96b29).(); |
| 391 | unsigned int state = cur.getStatecxx . . $ DLVertex#getState(ddd8539a2fcdd4ce).(); |
| 392 | BipolarPointercxx . . $ BipolarPointer# C = curConceptcxx . . $ DlSatTester#curConcept..bpcxx . . $ ConceptWDep#bp(455f465bc33b4cdf).()-(BipolarPointercxx . . $ BipolarPointer#)state; // corresponds to AR{0}.X |
| 393 | auto& RST = cur.getRolecxx . . $ DLVertex#getRole(69f26110a94b259f).()->getAutomatoncxx . . $ TRole#getAutomaton(63b0d77ccf579a4).()[cxx . . $ RoleAutomaton#`operator[]`(49d1c2a99a57610b).state]; |
| 394 | |
| 395 | // apply all empty transitions |
| 396 | if ( RST.hasEmptyTransitioncxx . . $ RAStateTransitions#hasEmptyTransition(50ce9a9e25b4a850).() ) |
| 397 | for ( const auto& trans: RST ) |
| 398 | { |
| 399 | incStatcxx . . $ `Kernel/Reasoner.h:341:10`!(nAutoEmptyLookups); |
| 400 | |
| 401 | if ( trans.emptycxx . . $ RATransition#empty(50ce9a9e25b4a850).() ) |
| 402 | switchResultcxx . . $ `Kernel/Tactic.cpp:27:9`! ( addToDoEntry ( curNode, C+BipolarPointer(trans.final()), dep, "e" ) ); |
| 403 | } |
| 404 | |
| 405 | // apply all top-role transitions |
| 406 | if ( unlikelycxx . . $ `Kernel/globaldef.h:29:10`!(RST.hasTopTransition()) ) |
| 407 | for ( const auto& trans: RST ) |
| 408 | { |
| 409 | if ( trans.isTopcxx . . $ RATransition#isTop(50ce9a9e25b4a850).() ) |
| 410 | switchResultcxx . . $ `Kernel/Tactic.cpp:27:9`! ( addSessionGCI ( C+BipolarPointer(trans.final()), dep ) ); |
| 411 | } |
| 412 | |
| 413 | // apply final-state rule |
| 414 | if ( state == 1 ) |
| 415 | switchResultcxx . . $ `Kernel/Tactic.cpp:27:9`! ( addToDoEntry ( curNode, cur.getC(), dep ) ); |
| 416 | |
| 417 | // check whether automaton applicable to any edges |
| 418 | incStatcxx . . $ `Kernel/Reasoner.h:341:10`!(nAllCalls); |
| 419 | |
| 420 | // check all neighbours |
| 421 | for ( const auto& neighbour: *curNodecxx . . $ DlSatTester#curNode. ) |
| 422 | { |
| 423 | if ( RST.recognisecxx . . $ RAStateTransitions#recognise(81d69a9c8508a392).(neighbour->getRolecxx . . $ DlCompletionTreeArc#getRole(69f26110a94b259f).()) ) |
| 424 | switchResultcxx . . $ `Kernel/Tactic.cpp:27:9`! ( applyTransitions ( neighbour, RST, C, dep+neighbour->getDep() ) ); |
| 425 | } |
| 426 | |
| 427 | return false; |
| 428 | } |
| 429 | |
| 430 | bool DlSatTestercxx . . $ DlSatTester# :: commonTacticBodyAllSimplecxx . . $ DlSatTester#commonTacticBodyAllSimple(eb1459783ad55ca9). ( const DLVertexcxx . . $ DLVertex#& cur ) |
| 431 | { |
| 432 | const RAStateTransitionscxx . . $ RAStateTransitions#& RST = cur.getRolecxx . . $ DLVertex#getRole(69f26110a94b259f).()->getAutomatoncxx . . $ TRole#getAutomaton(63b0d77ccf579a4).()[cxx . . $ RoleAutomaton#`operator[]`(49d1c2a99a57610b).0]; |
| 433 | const DepSetcxx . . $ DepSet#& dep = curConceptcxx . . $ DlSatTester#curConcept..getDepcxx . . $ ConceptWDep#getDep(bce6462a16d96b29).(); |
| 434 | BipolarPointercxx . . $ BipolarPointer# C = cur.getCcxx . . $ DLVertex#getC(455f465bc33b4cdf).(); |
| 435 | |
| 436 | // check whether automaton applicable to any edges |
| 437 | incStatcxx . . $ `Kernel/Reasoner.h:341:10`!(nAllCalls); |
| 438 | |
| 439 | // check all neighbours; as the role is simple then recognise() == applicable() |
| 440 | for ( const auto& neighbour: *curNodecxx . . $ DlSatTester#curNode. ) |
| 441 | { |
| 442 | if ( RST.recognisecxx . . $ RAStateTransitions#recognise(81d69a9c8508a392).(neighbour->getRolecxx . . $ DlCompletionTreeArc#getRole(69f26110a94b259f).()) ) |
| 443 | switchResultcxx . . $ `Kernel/Tactic.cpp:27:9`! ( addToDoEntry ( neighbour->getArcEnd(), C, dep+neighbour->getDep() ) ); |
| 444 | } |
| 445 | |
| 446 | return false; |
| 447 | } |
| 448 | |
| 449 | //------------------------------------------------------------------------------- |
| 450 | // Support for ALL processing |
| 451 | //------------------------------------------------------------------------------- |
| 452 | |
| 453 | /** Perform expansion of (C=\AR{state}.X).DEP to an EDGE with a given reason */ |
| 454 | bool DlSatTestercxx . . $ DlSatTester# :: applyTransitionscxx . . $ DlSatTester#applyTransitions(f4a06eb45cd3fe17). ( const DlCompletionTreeArccxx . . $ DlCompletionTreeArc#* edge, |
| 455 | const RAStateTransitionscxx . . $ RAStateTransitions#& RST, |
| 456 | BipolarPointercxx . . $ BipolarPointer# C, |
| 457 | const DepSetcxx . . $ DepSet#& dep, const char* reason ) |
| 458 | { |
| 459 | DlCompletionTreecxx . . $ DlCompletionTree#* node = edge->getArcEndcxx . . $ DlCompletionTreeArc#getArcEnd(1b0634bb62d2788b).(); |
| 460 | // fast lane: the single transition which is applicable |
| 461 | if ( RST.isSingletoncxx . . $ RAStateTransitions#isSingleton(50ce9a9e25b4a850).() ) |
| 462 | return addToDoEntrycxx . . $ DlSatTester#addToDoEntry(50176c0f88cf3d4f). ( node, C+(BipolarPointercxx . . $ BipolarPointer#)RST.getTransitionEndcxx . . $ RAStateTransitions#getTransitionEnd(ddd8539a2fcdd4ce).(), dep, reason ); |
| 463 | |
| 464 | const TRolecxx . . $ TRole#* R = edge->getRolecxx . . $ DlCompletionTreeArc#getRole(69f26110a94b259f).(); |
| 465 | |
| 466 | // try to apply all transitions to edge |
| 467 | for ( const auto& trans: RST ) |
| 468 | { |
| 469 | incStatcxx . . $ `Kernel/Reasoner.h:341:10`!(nAutoTransLookups); |
| 470 | if ( trans.applicablecxx . . $ RATransition#applicable(81d69a9c8508a392).(R) ) |
| 471 | switchResultcxx . . $ `Kernel/Tactic.cpp:27:9`! ( addToDoEntry ( node, C+BipolarPointer(trans.final()), dep, reason ) ); |
| 472 | } |
| 473 | |
| 474 | return false; |
| 475 | } |
| 476 | |
| 477 | //------------------------------------------------------------------------------- |
| 478 | // SOME processing |
| 479 | //------------------------------------------------------------------------------- |
| 480 | |
| 481 | bool DlSatTestercxx . . $ DlSatTester# :: commonTacticBodySomecxx . . $ DlSatTester#commonTacticBodySome(eb1459783ad55ca9). ( const DLVertexcxx . . $ DLVertex#& cur ) // for ER.C concepts |
| 482 | { |
| 483 | #ifdef ENABLE_CHECKING |
| 484 | fpp_assert ( isNegative(curConcept.bp()) && cur.Type() == dtForall ); |
| 485 | #endif |
| 486 | |
| 487 | const DepSetcxx . . $ DepSet#& dep = curConceptcxx . . $ DlSatTester#curConcept..getDepcxx . . $ ConceptWDep#getDep(bce6462a16d96b29).(); |
| 488 | const TRolecxx . . $ TRole#* R = cur.getRolecxx . . $ DLVertex#getRole(69f26110a94b259f).(); |
| 489 | BipolarPointercxx . . $ BipolarPointer# C = inversecxx . . $ inverse(7864480464b09eea).(cur.getCcxx . . $ DLVertex#getC(455f465bc33b4cdf).()); |
| 490 | |
| 491 | if ( unlikelycxx . . $ `Kernel/globaldef.h:29:10`!(R->isTop()) ) |
| 492 | return commonTacticBodySomeUnivcxx . . $ DlSatTester#commonTacticBodySomeUniv(eb1459783ad55ca9).(cur); |
| 493 | |
| 494 | // check if we already have R-neighbour labeled with C |
| 495 | if ( isSomeExistscxx . . $ DlSatTester#isSomeExists(e3f7d912c5a8ce7d). ( R, C ) ) |
| 496 | return false; |
| 497 | // try to check the case (some R (or C D)), where C is in the label of an R-neighbour |
| 498 | if ( isNegativecxx . . $ isNegative(83c267b20bac841a).(C) && DLHeapcxx . . $ DlSatTester#DLHeap.[cxx . . $ DLDag#`operator[]`(e265d70853dfed20).C].Typecxx . . $ DLVertexTagDFS#Type(d9c59f5f195b46b8).() == dtAndcxx . . $ dtAnd. ) |
| 499 | for ( const auto& arg: DLHeapcxx . . $ DlSatTester#DLHeap.[cxx . . $ DLDag#`operator[]`(e265d70853dfed20).C] ) |
| 500 | if ( isSomeExistscxx . . $ DlSatTester#isSomeExists(e3f7d912c5a8ce7d). ( R, inversecxx . . $ inverse(7864480464b09eea).(arg) ) ) |
| 501 | return false; |
| 502 | |
| 503 | // check for the case \ER.{o} |
| 504 | if ( tBoxcxx . . $ DlSatTester#tBox..testHasNominalscxx . . $ TBox#testHasNominals(50ce9a9e25b4a850).() && isPositivecxx . . $ isPositive(83c267b20bac841a).(C) ) |
| 505 | { |
| 506 | const DLVertexcxx . . $ DLVertex#& nom = DLHeapcxx . . $ DlSatTester#DLHeap.[cxx . . $ DLDag#`operator[]`(e265d70853dfed20).C]; |
| 507 | if ( nom.Typecxx . . $ DLVertexTagDFS#Type(d9c59f5f195b46b8).() == dtPSingletoncxx . . $ dtPSingleton. || nom.Typecxx . . $ DLVertexTagDFS#Type(d9c59f5f195b46b8).() == dtNSingletoncxx . . $ dtNSingleton. ) |
| 508 | return commonTacticBodyValuecxx . . $ DlSatTester#commonTacticBodyValue(4b2f14765f8633dd). ( R, static_cast<const TIndividualcxx . . $ TIndividual#*>(nom.getConceptcxx . . $ DLVertex#getConcept(1867504d72698304).()) ); |
| 509 | } |
| 510 | |
| 511 | incStatcxx . . $ `Kernel/Reasoner.h:341:10`!(nSomeCalls); |
| 512 | |
| 513 | // check if we have functional role |
| 514 | if ( R->isFunctionalcxx . . $ TRole#isFunctional(50ce9a9e25b4a850).() ) |
| 515 | for ( const auto& topf: R->topfuncscxx . . $ TRole#topfuncs(5c1fd3e4e1fb59f2).() ) |
| 516 | switch ( tryAddConceptcxx . . $ DlSatTester#tryAddConcept(64ab7a30545240e0). ( curNodecxx . . $ DlSatTester#curNode.->labelcxx . . $ DlCompletionTree#label(d7a009c437cd4657).().getLabelcxx . . $ CGLabel#getLabel(ad96fabd6ffb3e80).(/*isComplex=*/true), topf->getFunctionalcxx . . $ TRole#getFunctional(455f465bc33b4cdf).(), dep ) ) |
| 517 | { |
| 518 | case acrClashcxx . . $ acrClash.: // addition leads to clash |
| 519 | return true; |
| 520 | case acrDonecxx . . $ acrDone.: // should be add to a label |
| 521 | { |
| 522 | // we are changing current Node => save it |
| 523 | updateLevelcxx . . $ DlSatTester#updateLevel(745f507b4f58d579). ( curNodecxx . . $ DlSatTester#curNode., dep ); |
| 524 | |
| 525 | ConceptWDepcxx . . $ ConceptWDep# rFuncRestrictioncxx . . $ ConceptWDep#ConceptWDep(12a183a495b39f91). ( topf->getFunctionalcxx . . $ TRole#getFunctional(455f465bc33b4cdf).(), dep ); |
| 526 | // NOTE! not added into TODO (because will be checked right now) |
| 527 | CGraphcxx . . $ DlSatTester#CGraph..addConceptToNodecxx . . $ DlCompletionGraph#addConceptToNode(df4560871dbcb770). ( curNodecxx . . $ DlSatTester#curNode., rFuncRestriction, /*isComplex=*/true ); |
| 528 | setUsedcxx . . $ DlSatTester#setUsed(d4f767463ce0a6b3).(rFuncRestriction.bpcxx . . $ ConceptWDep#bp(455f465bc33b4cdf).()); |
| 529 | |
| 530 | if ( LLMcxx . . $ LLM..isWritablecxx . . $ LeveLogger#isWritable(8de63fdb265b07c1).(llGTAcxx . . $ llGTA.) ) |
| 531 | LLcxx . . $ LL. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " nf(" <<cxx . . $ `operator<<`(658aaef1ace96007). rFuncRestriction <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). ")"; |
| 532 | } |
| 533 | break; |
| 534 | case acrExistcxx . . $ acrExist.: // already exists |
| 535 | break; |
| 536 | default: // safety check |
| 537 | fpp_unreachablecxx . . $ `Kernel/fpp_assert.h:49:9`!(); |
| 538 | } |
| 539 | |
| 540 | |
| 541 | bool rFunc = false; // flag is true if we have functional restriction with this Role name |
| 542 | const TRolecxx . . $ TRole#* RF = R; // most general functional super-role of given one |
| 543 | ConceptWDepcxx . . $ ConceptWDep# rFuncRestrictioncxx . . $ ConceptWDep#ConceptWDep(49f6e7a06ebc5aa8).; // role's functional restriction w/dep |
| 544 | |
| 545 | // set up rFunc; rfRole contains more generic functional superrole of rName |
| 546 | for ( DlCompletionTreecxx . . $ DlCompletionTree#::const_label_iteratorcxx . . $ DlCompletionTree#const_label_iterator# pc = curNodecxx . . $ DlSatTester#curNode.->beginl_cccxx . . $ DlCompletionTree#beginl_cc(e55d760a93e9f197).(); pc !=cxx . . $ __gnu_cxx/`operator!=`(ef3c5749062e825c). curNodecxx . . $ DlSatTester#curNode.->endl_cccxx . . $ DlCompletionTree#endl_cc(e55d760a93e9f197).(); ++cxx . . $ __gnu_cxx/__normal_iterator#operator++(93f2e9c3bc4efc49).pc ) |
| 547 | { // found such vertex (<=1 R) |
| 548 | const ConceptWDepcxx . . $ ConceptWDep#& LC = *cxx . . $ __gnu_cxx/__normal_iterator#`operator*`(c076846f881f3e7e).pc; |
| 549 | const DLVertexcxx . . $ DLVertex#& ver = DLHeapcxx . . $ DlSatTester#DLHeap.[cxx . . $ DLDag#`operator[]`(b4043884e5934906).LC]; |
| 550 | |
| 551 | if ( isPositivecxx . . $ isPositive(83c267b20bac841a).(LC.bpcxx . . $ ConceptWDep#bp(455f465bc33b4cdf).()) && isFunctionalVertexcxx . . $ DlSatTester#isFunctionalVertex(eb1459783ad55ca9).(ver) && *ver.getRolecxx . . $ DLVertex#getRole(69f26110a94b259f).() >=cxx . . $ TRole#`operator>=`(f855a32f4b5dce26). *R ) |
| 552 | if ( !rFunc || // 1st functional restriction found or another one... |
| 553 | *ver.getRolecxx . . $ DLVertex#getRole(69f26110a94b259f).() >=cxx . . $ TRole#`operator>=`(f855a32f4b5dce26). *RF ) // ... with more generic role |
| 554 | { |
| 555 | rFunc = true; |
| 556 | RF = ver.getRolecxx . . $ DLVertex#getRole(69f26110a94b259f).(); |
| 557 | rFuncRestriction =cxx . . $ ConceptWDep#`operator=`(53d048f7c804eb56). LC; |
| 558 | } |
| 559 | } |
| 560 | |
| 561 | if ( rFunc ) // functional role found => add new concept to existing node |
| 562 | { |
| 563 | const DlCompletionTreeArccxx . . $ DlCompletionTreeArc#* functionalArc = nullptr; |
| 564 | |
| 565 | // check if we have an (R)-successor or (R-)-predecessor |
| 566 | for ( const auto& edge: *curNodecxx . . $ DlSatTester#curNode. ) |
| 567 | if ( edge->isNeighbourcxx . . $ DlCompletionTreeArc#isNeighbour(81d69a9c8508a392). (RF) ) |
| 568 | { |
| 569 | functionalArc = edge; |
| 570 | break; |
| 571 | } |
| 572 | |
| 573 | // perform actions if such arc was found |
| 574 | if ( functionalArc != nullptr ) |
| 575 | { |
| 576 | if ( LLMcxx . . $ LLM..isWritablecxx . . $ LeveLogger#isWritable(8de63fdb265b07c1).(llGTAcxx . . $ llGTA.) ) |
| 577 | LLcxx . . $ LL. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " f(" <<cxx . . $ `operator<<`(658aaef1ace96007). rFuncRestriction <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "):"; |
| 578 | |
| 579 | DlCompletionTreecxx . . $ DlCompletionTree#* succ = functionalArc->getArcEndcxx . . $ DlCompletionTreeArc#getArcEnd(1b0634bb62d2788b).(); |
| 580 | |
| 581 | // add current dependencies (from processed entry) |
| 582 | DepSetcxx . . $ DepSet# newDep = {cxx . . $ TDepSet#TDepSet(d0e32107376501c0). functionalArc->getDepcxx . . $ DlCompletionTreeArc#getDep(bce6462a16d96b29).() }; |
| 583 | newDep.addcxx . . $ TDepSet#add(d0e32107376501c0).(dep); |
| 584 | |
| 585 | // check if merging will lead to clash because of disjoint roles |
| 586 | if ( R->isDisjointcxx . . $ TRole#isDisjoint(50ce9a9e25b4a850).() && checkDisjointRoleClashcxx . . $ DlSatTester#checkDisjointRoleClash(e9490775c569687e). ( curNodecxx . . $ DlSatTester#curNode., succ, R, newDep ) ) |
| 587 | return true; |
| 588 | |
| 589 | // add current role label (to both arc and its reverse) |
| 590 | functionalArc = CGraphcxx . . $ DlSatTester#CGraph..addRoleLabelcxx . . $ DlCompletionGraph#addRoleLabel(2369b4bf26f5db64). ( curNodecxx . . $ DlSatTester#curNode., succ, functionalArc->isPredEdgecxx . . $ DlCompletionTreeArc#isPredEdge(50ce9a9e25b4a850).(), R, newDep ); |
| 591 | |
| 592 | // adds concept to the end of arc |
| 593 | switchResultcxx . . $ `Kernel/Tactic.cpp:27:9`! ( addToDoEntry ( succ, C, newDep ) ); |
| 594 | |
| 595 | // if new role label was added... |
| 596 | if ( RF != R ) |
| 597 | { |
| 598 | // add Range and Domain of a new role; this includes functional, so remove it from the latter |
| 599 | switchResultcxx . . $ `Kernel/Tactic.cpp:27:9`! ( initHeadOfNewEdge ( curNode, R, newDep, "RD" ) ); |
| 600 | switchResultcxx . . $ `Kernel/Tactic.cpp:27:9`! ( initHeadOfNewEdge ( succ, R->inverse(), newDep, "RR" ) ); |
| 601 | |
| 602 | // check AR.C in both sides of functionalArc |
| 603 | // FIXME!! for simplicity, check the functionality here (see bEx017). It seems |
| 604 | // only necessary when R has several functional super-roles, so the condition |
| 605 | // can be simplified |
| 606 | switchResultcxx . . $ `Kernel/Tactic.cpp:27:9`! ( applyUniversalNR ( curNode, functionalArc, newDep, redoForall | redoFunc ) ); |
| 607 | // if new role label was added to a functionalArc, some functional restrictions |
| 608 | // in the SUCC node might became applicable. See bFunctional1x test |
| 609 | switchResultcxx . . $ `Kernel/Tactic.cpp:27:9`! ( applyUniversalNR ( succ, functionalArc->getReverse(), newDep, |
| 610 | redoForall | redoFunc | redoAtMost ) ); |
| 611 | } |
| 612 | |
| 613 | return false; |
| 614 | } |
| 615 | } |
| 616 | |
| 617 | //------------------------------------------------ |
| 618 | // no functional role or 1st arc -- create new arc |
| 619 | //------------------------------------------------ |
| 620 | |
| 621 | // there no such neighbour - create new successor |
| 622 | // all FUNCs are already checked; no (new) irreflexivity possible |
| 623 | return createNewEdgecxx . . $ DlSatTester#createNewEdge(bffb270855f01a8f). ( cur.getRolecxx . . $ DLVertex#getRole(69f26110a94b259f).(), C, redoForallcxx . . $ DlSatTester#redoForall.|redoAtMostcxx . . $ DlSatTester#redoAtMost. ); |
| 624 | } |
| 625 | |
| 626 | /// expansion rule for existential quantifier in the form ER {o} |
| 627 | bool DlSatTestercxx . . $ DlSatTester# :: commonTacticBodyValuecxx . . $ DlSatTester#commonTacticBodyValue(4b2f14765f8633dd). ( const TRolecxx . . $ TRole#* R, const TIndividualcxx . . $ TIndividual#* nom ) |
| 628 | { |
| 629 | DepSetcxx . . $ DepSet# depcxx . . $ TDepSet#TDepSet(d0e32107376501c0).(curConceptcxx . . $ DlSatTester#curConcept..getDepcxx . . $ ConceptWDep#getDep(bce6462a16d96b29).()); |
| 630 | |
| 631 | // check blocking conditions |
| 632 | if ( isCurNodeBlockedcxx . . $ DlSatTester#isCurNodeBlocked(c9857a73d68e59ba).() ) |
| 633 | return false; |
| 634 | |
| 635 | incStatcxx . . $ `Kernel/Reasoner.h:341:10`!(nSomeCalls); |
| 636 | |
| 637 | fpp_assertcxx . . $ `Kernel/fpp_assert.h:46:10`! ( nom->node != nullptr ); |
| 638 | |
| 639 | // if node for NOM was purged due to merge -- find proper one |
| 640 | DlCompletionTreecxx . . $ DlCompletionTree#* realNode = nom->nodecxx . . $ TIndividual#node.->resolvePBlockercxx . . $ DlCompletionTree#resolvePBlocker(9c33c38202537177).(dep); |
| 641 | |
| 642 | // check if merging will lead to clash because of disjoint roles |
| 643 | if ( R->isDisjointcxx . . $ TRole#isDisjoint(50ce9a9e25b4a850).() && checkDisjointRoleClashcxx . . $ DlSatTester#checkDisjointRoleClash(e9490775c569687e). ( curNodecxx . . $ DlSatTester#curNode., realNode, R, dep ) ) |
| 644 | return true; |
| 645 | |
| 646 | // here we are sure that there is a nominal connected to a root node |
| 647 | encounterNominalcxx . . $ DlSatTester#encounterNominal. = true; |
| 648 | |
| 649 | // create new edge between curNode and the given nominal node |
| 650 | DlCompletionTreeArccxx . . $ DlCompletionTreeArc#* edge = |
| 651 | CGraphcxx . . $ DlSatTester#CGraph..addRoleLabelcxx . . $ DlCompletionGraph#addRoleLabel(2369b4bf26f5db64). ( curNodecxx . . $ DlSatTester#curNode., realNode, /*linkToParent=*/false, R, dep ); |
| 652 | |
| 653 | // add all necessary concepts to both ends of the edge |
| 654 | return setupEdgecxx . . $ DlSatTester#setupEdge(4031d85ce7510aa7). ( edge, dep, redoEverythingcxx . . $ DlSatTester#redoEverything. ); |
| 655 | } |
| 656 | |
| 657 | bool |
| 658 | DlSatTestercxx . . $ DlSatTester# :: commonTacticBodySomeUnivcxx . . $ DlSatTester#commonTacticBodySomeUniv(eb1459783ad55ca9). ( const DLVertexcxx . . $ DLVertex#& cur ) |
| 659 | { |
| 660 | // check blocking conditions |
| 661 | if ( isCurNodeBlockedcxx . . $ DlSatTester#isCurNodeBlocked(c9857a73d68e59ba).() ) |
| 662 | return false; |
| 663 | |
| 664 | incStatcxx . . $ `Kernel/Reasoner.h:341:10`!(nSomeCalls); |
| 665 | |
| 666 | BipolarPointercxx . . $ BipolarPointer# C = inversecxx . . $ inverse(7864480464b09eea).(cur.getCcxx . . $ DLVertex#getC(455f465bc33b4cdf).()); |
| 667 | // check whether C is already in CGraph |
| 668 | for ( const auto& node: CGraphcxx . . $ DlSatTester#CGraph. ) |
| 669 | if ( isObjectNodeUnblockedcxx . . $ DlSatTester#isObjectNodeUnblocked(e2c3b6f64f9879b7).(node) && node->labelcxx . . $ DlCompletionTree#label(d7a009c437cd4657).().containscxx . . $ CGLabel#contains(4a668f6de69bf818).(C) ) |
| 670 | return false; |
| 671 | // make new node labeled with C |
| 672 | return initNewNodecxx . . $ DlSatTester#initNewNode(96e59f80c609b310). ( CGraphcxx . . $ DlSatTester#CGraph..getNewNodecxx . . $ DlCompletionGraph#getNewNode(8f504d760f19febe).(), curConceptcxx . . $ DlSatTester#curConcept..getDepcxx . . $ ConceptWDep#getDep(bce6462a16d96b29).(), C ); |
| 673 | } |
| 674 | |
| 675 | //------------------------------------------------------------------------------- |
| 676 | // Support for SOME processing |
| 677 | //------------------------------------------------------------------------------- |
| 678 | |
| 679 | bool DlSatTestercxx . . $ DlSatTester# :: createNewEdgecxx . . $ DlSatTester#createNewEdge(bffb270855f01a8f). ( const TRolecxx . . $ TRole#* R, BipolarPointercxx . . $ BipolarPointer# C, unsigned int redoFlags ) |
| 680 | { |
| 681 | const DepSetcxx . . $ DepSet#& dep = curConceptcxx . . $ DlSatTester#curConcept..getDepcxx . . $ ConceptWDep#getDep(bce6462a16d96b29).(); |
| 682 | |
| 683 | // check blocking conditions |
| 684 | if ( isCurNodeBlockedcxx . . $ DlSatTester#isCurNodeBlocked(c9857a73d68e59ba).() ) |
| 685 | { |
| 686 | incStatcxx . . $ `Kernel/Reasoner.h:341:10`!(nUseless); |
| 687 | return false; |
| 688 | } |
| 689 | |
| 690 | DlCompletionTreeArccxx . . $ DlCompletionTreeArc#* pA = createOneNeighbourcxx . . $ DlSatTester#createOneNeighbour(38b471ae92c362df). ( R, dep ); |
| 691 | |
| 692 | // add necessary label |
| 693 | return initNewNodecxx . . $ DlSatTester#initNewNode(96e59f80c609b310). ( pA->getArcEndcxx . . $ DlCompletionTreeArc#getArcEnd(1b0634bb62d2788b).(), dep, C ) || setupEdgecxx . . $ DlSatTester#setupEdge(4031d85ce7510aa7). ( pA, dep, redoFlags ); |
| 694 | } |
| 695 | |
| 696 | /// create new ROLE-neighbour to curNode; return edge to it |
| 697 | DlCompletionTreeArccxx . . $ DlCompletionTreeArc#* DlSatTestercxx . . $ DlSatTester# :: createOneNeighbourcxx . . $ DlSatTester#createOneNeighbour(38b471ae92c362df). ( const TRolecxx . . $ TRole#* R, const DepSetcxx . . $ DepSet#& dep, CTNominalLevelcxx . . $ CTNominalLevel# level ) |
| 698 | { |
| 699 | // check whether is called from NN-rule |
| 700 | bool forNN = level != BlockableLevelcxx . . $ BlockableLevel.; |
| 701 | |
| 702 | // create a proper neighbour |
| 703 | DlCompletionTreeArccxx . . $ DlCompletionTreeArc#* pA = CGraphcxx . . $ DlSatTester#CGraph..createNeighbourcxx . . $ DlCompletionGraph#createNeighbour(3da37b6609f7179c). ( curNodecxx . . $ DlSatTester#curNode., /*isPredEdge=*/forNN, R, dep ); |
| 704 | DlCompletionTreecxx . . $ DlCompletionTree#* node = pA->getArcEndcxx . . $ DlCompletionTreeArc#getArcEnd(1b0634bb62d2788b).(); |
| 705 | |
| 706 | // set nominal node's level if necessary |
| 707 | if ( forNN ) |
| 708 | node->setNominalLevelcxx . . $ DlCompletionTree#setNominalLevel(ed53e3bbd3fa2f69).(level); |
| 709 | |
| 710 | // check whether created node is data node |
| 711 | if ( R->isDataRolecxx . . $ TRole#isDataRole(50ce9a9e25b4a850).() ) |
| 712 | node->setDataNodecxx . . $ DlCompletionTree#setDataNode(49f6e7a06ebc5aa8).(); |
| 713 | |
| 714 | // log newly created node |
| 715 | CHECK_LL_RETURN_VALUEcxx . . $ `Kernel/LeveLogger.h:64:9`!(llGTA,pA); |
| 716 | |
| 717 | if ( R->isDataRolecxx . . $ TRole#isDataRole(50ce9a9e25b4a850).() ) |
| 718 | LLcxx . . $ LL. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " DN("; |
| 719 | else |
| 720 | LLcxx . . $ LL. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " cn("; |
| 721 | LLcxx . . $ LL. <<cxx . . $ std/basic_ostream#`operator<<`(b4c055c363850233). node->getIdcxx . . $ DlCompletionTree#getId(ddd8539a2fcdd4ce).() <<cxx . . $ `operator<<`(8df530197ee94a2e). dep <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). ")"; |
| 722 | |
| 723 | return pA; |
| 724 | } |
| 725 | |
| 726 | bool DlSatTestercxx . . $ DlSatTester# :: isCurNodeBlockedcxx . . $ DlSatTester#isCurNodeBlocked(c9857a73d68e59ba). ( void ) |
| 727 | { |
| 728 | // for non-lazy blocking blocked status is correct |
| 729 | if ( !useLazyBlockingcxx . . $ DlSatTester#useLazyBlocking(50ce9a9e25b4a850).() ) |
| 730 | return curNodecxx . . $ DlSatTester#curNode.->isBlockedcxx . . $ DlCompletionTree#isBlocked(50ce9a9e25b4a850).(); |
| 731 | |
| 732 | // update node's blocked status |
| 733 | if ( !curNodecxx . . $ DlSatTester#curNode.->isBlockedcxx . . $ DlCompletionTree#isBlocked(50ce9a9e25b4a850).() && curNodecxx . . $ DlSatTester#curNode.->isAffectedcxx . . $ DlCompletionTree#isAffected(50ce9a9e25b4a850).() ) |
| 734 | { |
| 735 | updateLevelcxx . . $ DlSatTester#updateLevel(745f507b4f58d579). ( curNodecxx . . $ DlSatTester#curNode., curConceptcxx . . $ DlSatTester#curConcept..getDepcxx . . $ ConceptWDep#getDep(bce6462a16d96b29).() ); |
| 736 | CGraphcxx . . $ DlSatTester#CGraph..detectBlockedStatuscxx . . $ DlCompletionGraph#detectBlockedStatus(3bf754c9a531d7e6).(curNodecxx . . $ DlSatTester#curNode.); |
| 737 | } |
| 738 | |
| 739 | return curNodecxx . . $ DlSatTester#curNode.->isBlockedcxx . . $ DlCompletionTree#isBlocked(50ce9a9e25b4a850).(); |
| 740 | } |
| 741 | |
| 742 | void |
| 743 | DlSatTestercxx . . $ DlSatTester# :: applyAllGeneratingRulescxx . . $ DlSatTester#applyAllGeneratingRules(3bf754c9a531d7e6). ( DlCompletionTreecxx . . $ DlCompletionTree#* node ) |
| 744 | { |
| 745 | const CGLabelcxx . . $ CGLabel#& label = node->labelcxx . . $ DlCompletionTree#label(d7a009c437cd4657).(); |
| 746 | for ( CGLabelcxx . . $ CGLabel#::const_iteratorcxx . . $ CGLabel#const_iterator# p = label.begin_cccxx . . $ CGLabel#begin_cc(e55d760a93e9f197).(), p_end = label.end_cccxx . . $ CGLabel#end_cc(e55d760a93e9f197).(); p !=cxx . . $ __gnu_cxx/`operator!=`(ef3c5749062e825c). p_end; ++cxx . . $ __gnu_cxx/__normal_iterator#operator++(93f2e9c3bc4efc49).p ) |
| 747 | { |
| 748 | // need only ER.C or >=nR.C concepts |
| 749 | if ( isPositivecxx . . $ isPositive(83c267b20bac841a).(p->cxx . . $ __gnu_cxx/__normal_iterator#`operator->`(a68f0626e749d9f6).bpcxx . . $ ConceptWDep#bp(455f465bc33b4cdf).()) ) |
| 750 | continue; |
| 751 | |
| 752 | switch ( DLHeapcxx . . $ DlSatTester#DLHeap.[cxx . . $ DLDag#`operator[]`(b4043884e5934906).*cxx . . $ __gnu_cxx/__normal_iterator#`operator*`(c076846f881f3e7e).p].Typecxx . . $ DLVertexTagDFS#Type(d9c59f5f195b46b8).() ) |
| 753 | { |
| 754 | case dtForallcxx . . $ dtForall.: |
| 755 | case dtLEcxx . . $ dtLE.: |
| 756 | addExistingToDoEntrycxx . . $ DlSatTester#addExistingToDoEntry(9ebb2e7de5f347be). ( node, label.getCCOffsetcxx . . $ CGLabel#getCCOffset(f30316450779e1c3).(p), "ubd" ); |
| 757 | break; |
| 758 | |
| 759 | default: |
| 760 | break; |
| 761 | } |
| 762 | } |
| 763 | } |
| 764 | |
| 765 | bool |
| 766 | DlSatTestercxx . . $ DlSatTester# :: setupEdgecxx . . $ DlSatTester#setupEdge(4031d85ce7510aa7). ( DlCompletionTreeArccxx . . $ DlCompletionTreeArc#* pA, const DepSetcxx . . $ DepSet#& dep, unsigned int redoFlags ) |
| 767 | { |
| 768 | DlCompletionTreecxx . . $ DlCompletionTree#* child = pA->getArcEndcxx . . $ DlCompletionTreeArc#getArcEnd(1b0634bb62d2788b).(); |
| 769 | DlCompletionTreecxx . . $ DlCompletionTree#* from = pA->getReversecxx . . $ DlCompletionTreeArc#getReverse(96bc8dcf80af44db).()->getArcEndcxx . . $ DlCompletionTreeArc#getArcEnd(1b0634bb62d2788b).(); |
| 770 | |
| 771 | // adds Range and Domain |
| 772 | switchResultcxx . . $ `Kernel/Tactic.cpp:27:9`! ( initHeadOfNewEdge ( from, pA->getRole(), dep, "RD" ) ); |
| 773 | switchResultcxx . . $ `Kernel/Tactic.cpp:27:9`! ( initHeadOfNewEdge ( child, pA->getReverse()->getRole(), dep, "RR" ) ); |
| 774 | |
| 775 | // check if we have any AR.X concepts in current node |
| 776 | if ( redoFlags != 0 ) |
| 777 | switchResultcxx . . $ `Kernel/Tactic.cpp:27:9`! ( applyUniversalNR ( from, pA, dep, redoFlags ) ); |
| 778 | |
| 779 | // for nominal children and loops -- just apply things for the inverses |
| 780 | if ( pA->isPredEdgecxx . . $ DlCompletionTreeArc#isPredEdge(50ce9a9e25b4a850).() || child->isNominalNodecxx . . $ DlCompletionTree#isNominalNode(50ce9a9e25b4a850).() || child == from ) |
| 781 | { |
| 782 | if ( redoFlags != 0 ) |
| 783 | switchResultcxx . . $ `Kernel/Tactic.cpp:27:9`! ( applyUniversalNR ( child, pA->getReverse(), dep, redoFlags ) ); |
| 784 | } |
| 785 | else |
| 786 | { |
| 787 | if ( child->isDataNodecxx . . $ DlCompletionTree#isDataNode(50ce9a9e25b4a850).() ) |
| 788 | { |
| 789 | checkDataNodecxx . . $ DlSatTester#checkDataNode. = true; |
| 790 | switchResultcxx . . $ `Kernel/Tactic.cpp:27:9`! ( checkDataClash(child) ); |
| 791 | } |
| 792 | else // check if it is possible to use cache for new node |
| 793 | switchResultcxx . . $ `Kernel/Tactic.cpp:27:9`! ( usageByState(tryCacheNode(child)) ); |
| 794 | } |
| 795 | |
| 796 | // all done |
| 797 | return false; |
| 798 | } |
| 799 | |
| 800 | bool DlSatTestercxx . . $ DlSatTester# :: applyUniversalNRcxx . . $ DlSatTester#applyUniversalNR(c075c0126f93693d). ( DlCompletionTreecxx . . $ DlCompletionTree#* Node, |
| 801 | const DlCompletionTreeArccxx . . $ DlCompletionTreeArc#* arcSample, |
| 802 | const DepSetcxx . . $ DepSet#& dep_, unsigned int redoFlags ) |
| 803 | { |
| 804 | // check whether a flag is set |
| 805 | if ( redoFlags == 0 ) |
| 806 | return false; |
| 807 | |
| 808 | const TRolecxx . . $ TRole#* R = arcSample->getRolecxx . . $ DlCompletionTreeArc#getRole(69f26110a94b259f).(); |
| 809 | DepSetcxx . . $ DepSet# dep = dep_cxx . . $ TDepSet#TDepSet(d0e32107376501c0). +cxx . . $ operator+(a79ac10aefecd7d4). arcSample->getDepcxx . . $ DlCompletionTreeArc#getDep(bce6462a16d96b29).(); |
| 810 | |
| 811 | for ( DlCompletionTreecxx . . $ DlCompletionTree#::const_label_iteratorcxx . . $ DlCompletionTree#const_label_iterator# |
| 812 | p = Node->beginl_cccxx . . $ DlCompletionTree#beginl_cc(e55d760a93e9f197).(), p_end = Node->endl_cccxx . . $ DlCompletionTree#endl_cc(e55d760a93e9f197).(); p !=cxx . . $ __gnu_cxx/`operator!=`(ef3c5749062e825c). p_end; ++cxx . . $ __gnu_cxx/__normal_iterator#operator++(93f2e9c3bc4efc49).p ) |
| 813 | { |
| 814 | // need only AR.C concepts where ARC is labelled with R |
| 815 | if ( isNegativecxx . . $ isNegative(83c267b20bac841a).(p->cxx . . $ __gnu_cxx/__normal_iterator#`operator->`(a68f0626e749d9f6).bpcxx . . $ ConceptWDep#bp(455f465bc33b4cdf).()) ) |
| 816 | continue; |
| 817 | |
| 818 | const DLVertexcxx . . $ DLVertex#& v = DLHeapcxx . . $ DlSatTester#DLHeap.[cxx . . $ DLDag#`operator[]`(b4043884e5934906).*cxx . . $ __gnu_cxx/__normal_iterator#`operator*`(c076846f881f3e7e).p]; |
| 819 | const TRolecxx . . $ TRole#* vR = v.getRolecxx . . $ DLVertex#getRole(69f26110a94b259f).(); |
| 820 | |
| 821 | switch ( v.Typecxx . . $ DLVertexTagDFS#Type(d9c59f5f195b46b8).() ) |
| 822 | { |
| 823 | case dtIrrcxx . . $ dtIrr.: |
| 824 | if ( redoFlags & redoIrrcxx . . $ DlSatTester#redoIrr. ) |
| 825 | switchResultcxx . . $ `Kernel/Tactic.cpp:27:9`! ( checkIrreflexivity ( arcSample, vR, dep ) ); |
| 826 | break; |
| 827 | |
| 828 | case dtForallcxx . . $ dtForall.: |
| 829 | { |
| 830 | if ( (redoFlags & redoForallcxx . . $ DlSatTester#redoForall.) == 0 ) |
| 831 | break; |
| 832 | if ( unlikelycxx . . $ `Kernel/globaldef.h:29:10`!(vR->isTop()) ) |
| 833 | break; |
| 834 | |
| 835 | /// check whether transition is possible |
| 836 | const RAStateTransitionscxx . . $ RAStateTransitions#& RST = vR->getAutomatoncxx . . $ TRole#getAutomaton(63b0d77ccf579a4).()[cxx . . $ RoleAutomaton#`operator[]`(49d1c2a99a57610b).v.getStatecxx . . $ DLVertex#getState(ddd8539a2fcdd4ce).()]; |
| 837 | if ( !RST.recognisecxx . . $ RAStateTransitions#recognise(81d69a9c8508a392).(R) ) |
| 838 | break; |
| 839 | |
| 840 | if ( vR->isSimplecxx . . $ TRole#isSimple(50ce9a9e25b4a850).() ) // R is recognised so just add the final state! |
| 841 | switchResultcxx . . $ `Kernel/Tactic.cpp:27:9`! ( addToDoEntry ( arcSample->getArcEnd(), v.getC(), dep+p->getDep(), "ae" ) ); |
| 842 | else |
| 843 | switchResultcxx . . $ `Kernel/Tactic.cpp:27:9`! ( applyTransitions ( arcSample, RST, p->bp()-(BipolarPointer)v.getState(), dep+p->getDep(), "ae" ) ); |
| 844 | break; |
| 845 | } |
| 846 | |
| 847 | case dtLEcxx . . $ dtLE.: |
| 848 | if ( isFunctionalVertexcxx . . $ DlSatTester#isFunctionalVertex(eb1459783ad55ca9).(v) ) |
| 849 | { |
| 850 | if ( (redoFlags & redoFunccxx . . $ DlSatTester#redoFunc.) && (*vR >=cxx . . $ TRole#`operator>=`(f855a32f4b5dce26). *R) ) |
| 851 | addExistingToDoEntrycxx . . $ DlSatTester#addExistingToDoEntry(9ebb2e7de5f347be). ( Node, Node->labelcxx . . $ DlCompletionTree#label(d7a009c437cd4657).().getCCOffsetcxx . . $ CGLabel#getCCOffset(f30316450779e1c3).(p), "f" ); |
| 852 | } |
| 853 | else |
| 854 | if ( (redoFlags & redoAtMostcxx . . $ DlSatTester#redoAtMost.) && (*vR >=cxx . . $ TRole#`operator>=`(f855a32f4b5dce26). *R) ) |
| 855 | addExistingToDoEntrycxx . . $ DlSatTester#addExistingToDoEntry(9ebb2e7de5f347be). ( Node, Node->labelcxx . . $ DlCompletionTree#label(d7a009c437cd4657).().getCCOffsetcxx . . $ CGLabel#getCCOffset(f30316450779e1c3).(p), "le" ); |
| 856 | break; |
| 857 | |
| 858 | default: |
| 859 | break; |
| 860 | } |
| 861 | } |
| 862 | |
| 863 | return false; |
| 864 | } |
| 865 | |
| 866 | /// add necessary concepts to the head of the new EDGE |
| 867 | bool |
| 868 | DlSatTestercxx . . $ DlSatTester# :: initHeadOfNewEdgecxx . . $ DlSatTester#initHeadOfNewEdge(d1200003e7ec4530). ( DlCompletionTreecxx . . $ DlCompletionTree#* node, const TRolecxx . . $ TRole#* R, const DepSetcxx . . $ DepSet#& dep, const char* reason ) |
| 869 | { |
| 870 | // if R is functional, then add FR with given DEP-set to NODE |
| 871 | if ( R->isFunctionalcxx . . $ TRole#isFunctional(50ce9a9e25b4a850).() ) |
| 872 | for ( const auto& topf: R->topfuncscxx . . $ TRole#topfuncs(5c1fd3e4e1fb59f2).() ) |
| 873 | switchResultcxx . . $ `Kernel/Tactic.cpp:27:9`! ( addToDoEntry ( node, topf->getFunctional(), dep, "fr" ) ); |
| 874 | |
| 875 | // setup Domain for R |
| 876 | switchResultcxx . . $ `Kernel/Tactic.cpp:27:9`! ( addToDoEntry ( node, R->getBPDomain(), dep, reason ) ); |
| 877 | |
| 878 | if ( !RKG_UPDATE_RND_FROM_SUPERROLEScxx . . $ `Kernel/globaldef.h:57:10`! ) |
| 879 | for ( const auto& sup: R->ancestorscxx . . $ TRole#ancestors(5c1fd3e4e1fb59f2).() ) |
| 880 | switchResultcxx . . $ `Kernel/Tactic.cpp:27:9`! ( addToDoEntry ( node, sup->getBPDomain(), dep, reason ) ); |
| 881 | |
| 882 | return false; |
| 883 | } |
| 884 | |
| 885 | //------------------------------------------------------------------------------- |
| 886 | // Func/LE/GE processing |
| 887 | //------------------------------------------------------------------------------- |
| 888 | |
| 889 | bool DlSatTestercxx . . $ DlSatTester# :: commonTacticBodyFunccxx . . $ DlSatTester#commonTacticBodyFunc(eb1459783ad55ca9). ( const DLVertexcxx . . $ DLVertex#& cur ) // for <=1 R concepts |
| 890 | { |
| 891 | #ifdef ENABLE_CHECKING |
| 892 | fpp_assert ( isPositive(curConcept.bp()) && isFunctionalVertex(cur) ); |
| 893 | #endif |
| 894 | |
| 895 | const TRolecxx . . $ TRole#* R = cur.getRolecxx . . $ DLVertex#getRole(69f26110a94b259f).(); |
| 896 | |
| 897 | if ( unlikelycxx . . $ `Kernel/globaldef.h:29:10`!(R->isTop()) ) |
| 898 | return processTopRoleFunccxx . . $ DlSatTester#processTopRoleFunc(eb1459783ad55ca9).(cur); |
| 899 | |
| 900 | // check whether we need to apply NN rule first |
| 901 | if ( isNNApplicablecxx . . $ DlSatTester#isNNApplicable(95e2d485c042ad5a). ( R, bpTOPcxx . . $ bpTOP., curConceptcxx . . $ DlSatTester#curConcept..bpcxx . . $ ConceptWDep#bp(455f465bc33b4cdf).()+1 ) ) |
| 902 | return commonTacticBodyNNcxx . . $ DlSatTester#commonTacticBodyNN(eb1459783ad55ca9).(cur); // after application func-rule would be checked again |
| 903 | |
| 904 | incStatcxx . . $ `Kernel/Reasoner.h:341:10`!(nFuncCalls); |
| 905 | |
| 906 | if ( isQuickClashLEcxx . . $ DlSatTester#isQuickClashLE(eb1459783ad55ca9).(cur) ) |
| 907 | return true; |
| 908 | |
| 909 | // locate all R-neighbours of curNode |
| 910 | DepSetcxx . . $ DepSet# dummycxx . . $ TDepSet#TDepSet(49f6e7a06ebc5aa8).; // not used |
| 911 | findNeighbourscxx . . $ DlSatTester#findNeighbours(64c329be3c32769c). ( R, bpTOPcxx . . $ bpTOP., dummy ); |
| 912 | |
| 913 | // check if we have nodes to merge |
| 914 | if ( EdgesToMergecxx . . $ DlSatTester#EdgesToMerge..sizecxx . . $ std/vector#size(fe4d2d262d4164a8).() < 2 ) |
| 915 | return false; |
| 916 | |
| 917 | // merge all nodes to the first (the least wrt nominal hierarchy) found node |
| 918 | EdgeVectorcxx . . $ DlSatTester#EdgeVector#::iteratorcxx . . $ std/vector#iterator# q = EdgesToMergecxx . . $ DlSatTester#EdgesToMerge..begincxx . . $ std/vector#begin(33b10a496a38335b).(), q_end = EdgesToMergecxx . . $ DlSatTester#EdgesToMerge..endcxx . . $ std/vector#end(33b10a496a38335b).(); |
| 919 | DlCompletionTreecxx . . $ DlCompletionTree#* sample = (*cxx . . $ __gnu_cxx/__normal_iterator#`operator*`(c076846f881f3e7e).q)->getArcEndcxx . . $ DlCompletionTreeArc#getArcEnd(1b0634bb62d2788b).(); |
| 920 | DepSetcxx . . $ DepSet# depFcxx . . $ TDepSet#TDepSet(d0e32107376501c0). (curConceptcxx . . $ DlSatTester#curConcept..getDepcxx . . $ ConceptWDep#getDep(bce6462a16d96b29).()); // dep-set for merging |
| 921 | depF.addcxx . . $ TDepSet#add(d0e32107376501c0).((*cxx . . $ __gnu_cxx/__normal_iterator#`operator*`(c076846f881f3e7e).q)->getDepcxx . . $ DlCompletionTreeArc#getDep(bce6462a16d96b29).()); |
| 922 | |
| 923 | // merge all elements to sample (sample wouldn't be merge) |
| 924 | while ( ++cxx . . $ __gnu_cxx/__normal_iterator#operator++(93f2e9c3bc4efc49).q !=cxx . . $ __gnu_cxx/`operator!=`(ef3c5749062e825c). q_end ) |
| 925 | // during merge EdgesToMerge may became purged (see Nasty4) => check this |
| 926 | if ( !(*cxx . . $ __gnu_cxx/__normal_iterator#`operator*`(c076846f881f3e7e).q)->getArcEndcxx . . $ DlCompletionTreeArc#getArcEnd(1b0634bb62d2788b).()->isPBlockedcxx . . $ DlCompletionTree#isPBlocked(50ce9a9e25b4a850).() ) |
| 927 | switchResultcxx . . $ `Kernel/Tactic.cpp:27:9`! ( Merge ( (*q)->getArcEnd(), sample, depF+(*q)->getDep() ) ); |
| 928 | |
| 929 | return false; |
| 930 | } |
| 931 | |
| 932 | |
| 933 | bool DlSatTestercxx . . $ DlSatTester# :: commonTacticBodyLEcxx . . $ DlSatTester#commonTacticBodyLE(eb1459783ad55ca9). ( const DLVertexcxx . . $ DLVertex#& cur ) // for <=nR.C concepts |
| 934 | { |
| 935 | #ifdef ENABLE_CHECKING |
| 936 | fpp_assert ( isPositive(curConcept.bp()) && ( cur.Type() == dtLE ) ); |
| 937 | #endif |
| 938 | |
| 939 | incStatcxx . . $ `Kernel/Reasoner.h:341:10`!(nLeCalls); |
| 940 | const TRolecxx . . $ TRole#* R = cur.getRolecxx . . $ DLVertex#getRole(69f26110a94b259f).(); |
| 941 | |
| 942 | if ( unlikelycxx . . $ `Kernel/globaldef.h:29:10`!(R->isTop()) ) |
| 943 | return processTopRoleLEcxx . . $ DlSatTester#processTopRoleLE(eb1459783ad55ca9).(cur); |
| 944 | |
| 945 | BipolarPointercxx . . $ BipolarPointer# C = cur.getCcxx . . $ DLVertex#getC(455f465bc33b4cdf).(); |
| 946 | bool needInit = true; |
| 947 | |
| 948 | if ( !isFirstBranchCallcxx . . $ DlSatTester#isFirstBranchCall(50ce9a9e25b4a850).() ) |
| 949 | { |
| 950 | if ( dynamic_cast<BCNNcxx . . $ BCNN#*>(bContextcxx . . $ DlSatTester#bContext.) != nullptr ) |
| 951 | return commonTacticBodyNNcxx . . $ DlSatTester#commonTacticBodyNN(eb1459783ad55ca9).(cur); // after application <=-rule would be checked again |
| 952 | if ( dynamic_cast<BCLEcxx . . $ BCLE#<DlCompletionTreeArccxx . . $ DlCompletionTreeArc#>*>(bContextcxx . . $ DlSatTester#bContext.) != nullptr ) |
| 953 | needInit = false; // clash in LE-rule: skip the initial checks |
| 954 | else // the only possible case is choose-rule; in this case just continue |
| 955 | fpp_assertcxx . . $ `Kernel/fpp_assert.h:46:10`! ( dynamic_cast<BCChoose*>(bContext) != nullptr ); |
| 956 | } |
| 957 | else // if we are here that it IS first LE call |
| 958 | if ( isQuickClashLEcxx . . $ DlSatTester#isQuickClashLE(eb1459783ad55ca9).(cur) ) |
| 959 | return true; |
| 960 | |
| 961 | // initial phase: choose-rule, NN-rule |
| 962 | if ( needInit ) |
| 963 | { |
| 964 | // check if we have Qualified NR |
| 965 | if ( C != bpTOPcxx . . $ bpTOP. ) |
| 966 | switchResultcxx . . $ `Kernel/Tactic.cpp:27:9`! ( commonTacticBodyChoose ( R, C ) ); |
| 967 | |
| 968 | // check whether we need to apply NN rule first |
| 969 | if ( isNNApplicablecxx . . $ DlSatTester#isNNApplicable(95e2d485c042ad5a). ( R, C, /*stopper=*/curConceptcxx . . $ DlSatTester#curConcept..bpcxx . . $ ConceptWDep#bp(455f465bc33b4cdf).()+(BipolarPointercxx . . $ BipolarPointer#)cur.getNumberLEcxx . . $ DLVertex#getNumberLE(ddd8539a2fcdd4ce).() ) ) |
| 970 | return commonTacticBodyNNcxx . . $ DlSatTester#commonTacticBodyNN(eb1459783ad55ca9).(cur); // after application <=-rule would be checked again |
| 971 | } |
| 972 | |
| 973 | // we need to repeat merge until there will be necessary amount of edges |
| 974 | for (;;) |
| 975 | { |
| 976 | if ( isFirstBranchCallcxx . . $ DlSatTester#isFirstBranchCall(50ce9a9e25b4a850).() ) |
| 977 | if ( initLEProcessingcxx . . $ DlSatTester#initLEProcessing(eb1459783ad55ca9).(cur) ) |
| 978 | return false; |
| 979 | |
| 980 | BCLEcxx . . $ BCLE#<DlCompletionTreeArccxx . . $ DlCompletionTreeArc#>* bcLE = static_cast<BCLEcxx . . $ BCLE#<DlCompletionTreeArccxx . . $ DlCompletionTreeArc#>*>(bContextcxx . . $ DlSatTester#bContext.); |
| 981 | |
| 982 | if ( bcLE->noMoreLEOptionscxx . . $ BCLE#noMoreLEOptions(50ce9a9e25b4a850).() ) |
| 983 | { // set global clashset to cumulative one from previous branch failures |
| 984 | useBranchDepcxx . . $ DlSatTester#useBranchDep(49f6e7a06ebc5aa8).(); |
| 985 | return true; |
| 986 | } |
| 987 | |
| 988 | // get from- and to-arcs using corresponding indexes in Edges |
| 989 | DlCompletionTreeArccxx . . $ DlCompletionTreeArc#* fromArc = bcLE->getFromcxx . . $ BCLE#getFrom(5a2a78a048fb49a8).(); |
| 990 | DlCompletionTreeArccxx . . $ DlCompletionTreeArc#* toArc = bcLE->getTocxx . . $ BCLE#getTo(5a2a78a048fb49a8).(); |
| 991 | DlCompletionTreecxx . . $ DlCompletionTree#* from = fromArc->getArcEndcxx . . $ DlCompletionTreeArc#getArcEnd(1b0634bb62d2788b).(); |
| 992 | DlCompletionTreecxx . . $ DlCompletionTree#* to = toArc->getArcEndcxx . . $ DlCompletionTreeArc#getArcEnd(1b0634bb62d2788b).(); |
| 993 | |
| 994 | DepSetcxx . . $ DepSet# depcxx . . $ TDepSet#TDepSet(49f6e7a06ebc5aa8).; // empty dep-set |
| 995 | // fast check for FROM =/= TO |
| 996 | if ( CGraphcxx . . $ DlSatTester#CGraph..nonMergeablecxx . . $ DlCompletionGraph#nonMergeable(3cd92906c32a9a0b). ( from, to, dep ) ) |
| 997 | { |
| 998 | // need this for merging two nominal nodes |
| 999 | dep.addcxx . . $ TDepSet#add(d0e32107376501c0).(fromArc->getDepcxx . . $ DlCompletionTreeArc#getDep(bce6462a16d96b29).()); |
| 1000 | dep.addcxx . . $ TDepSet#add(d0e32107376501c0).(toArc->getDepcxx . . $ DlCompletionTreeArc#getDep(bce6462a16d96b29).()); |
| 1001 | // add dep-set from labels |
| 1002 | if ( C == bpTOPcxx . . $ bpTOP. ) // dep-set is known now |
| 1003 | setClashSetcxx . . $ DlSatTester#setClashSet(d0e32107376501c0).(dep); |
| 1004 | else // QCR: update dep-set wrt C |
| 1005 | { |
| 1006 | // here we know that C is in both labels; set a proper clash-set |
| 1007 | bool isComplex = CGLabelcxx . . $ CGLabel#::isComplexConceptcxx . . $ CGLabel#isComplexConcept(7b512e7165d9f2af).(DLHeapcxx . . $ DlSatTester#DLHeap.[cxx . . $ DLDag#`operator[]`(e265d70853dfed20).C].Typecxx . . $ DLVertexTagDFS#Type(d9c59f5f195b46b8).()); |
| 1008 | bool test {false}; |
| 1009 | |
| 1010 | // here dep contains the clash-set |
| 1011 | test = findConceptClashcxx . . $ DlSatTester#findConceptClash(770c5e45e3d3d307). ( from->labelcxx . . $ DlCompletionTree#label(d7a009c437cd4657).().getLabelcxx . . $ CGLabel#getLabel(ad96fabd6ffb3e80).(isComplex), C, dep ); |
| 1012 | fpp_assertcxx . . $ `Kernel/fpp_assert.h:46:10`!(test); |
| 1013 | dep +=cxx . . $ TDepSet#`operator+=`(6a948e2ed08fa462). getClashSetcxx . . $ DlSatTester#getClashSet(bce6462a16d96b29).(); // save new dep-set |
| 1014 | |
| 1015 | test = findConceptClashcxx . . $ DlSatTester#findConceptClash(770c5e45e3d3d307). ( to->labelcxx . . $ DlCompletionTree#label(d7a009c437cd4657).().getLabelcxx . . $ CGLabel#getLabel(ad96fabd6ffb3e80).(isComplex), C, dep ); |
| 1016 | fpp_assertcxx . . $ `Kernel/fpp_assert.h:46:10`!(test); |
| 1017 | // both clash-sets are now in common clash-set |
| 1018 | } |
| 1019 | |
| 1020 | nextBranchingOptioncxx . . $ DlSatTester#nextBranchingOption(49f6e7a06ebc5aa8).(); |
| 1021 | fpp_assertcxx . . $ `Kernel/fpp_assert.h:46:10`!(!isFirstBranchCall()); |
| 1022 | continue; |
| 1023 | } |
| 1024 | |
| 1025 | savecxx . . $ DlSatTester#save(49f6e7a06ebc5aa8).(); |
| 1026 | |
| 1027 | // add depset from current level and FROM arc and to current dep.set |
| 1028 | DepSetcxx . . $ DepSet# curDepcxx . . $ TDepSet#TDepSet(d0e32107376501c0).(getCurDepSetcxx . . $ DlSatTester#getCurDepSet(6e9566718b894103).()); |
| 1029 | curDep.addcxx . . $ TDepSet#add(d0e32107376501c0).(fromArc->getDepcxx . . $ DlCompletionTreeArc#getDep(bce6462a16d96b29).()); |
| 1030 | |
| 1031 | switchResultcxx . . $ `Kernel/Tactic.cpp:27:9`! ( Merge ( from, to, curDep ) ); |
| 1032 | // it might be the case (see bIssue28) that after the merge there is an R-neighbour |
| 1033 | // that have neither C or ~C in its label (it was far in the nominal cloud) |
| 1034 | if ( C != bpTOPcxx . . $ bpTOP. ) |
| 1035 | switchResultcxx . . $ `Kernel/Tactic.cpp:27:9`! ( commonTacticBodyChoose ( R, C ) ); |
| 1036 | } |
| 1037 | } |
| 1038 | |
| 1039 | bool |
| 1040 | DlSatTestercxx . . $ DlSatTester# :: initLEProcessingcxx . . $ DlSatTester#initLEProcessing(eb1459783ad55ca9). ( const DLVertexcxx . . $ DLVertex#& cur ) |
| 1041 | { |
| 1042 | DepSetcxx . . $ DepSet# depcxx . . $ TDepSet#TDepSet(49f6e7a06ebc5aa8).; |
| 1043 | // check the amount of neighbours we have |
| 1044 | findNeighbourscxx . . $ DlSatTester#findNeighbours(64c329be3c32769c). ( cur.getRolecxx . . $ DLVertex#getRole(69f26110a94b259f).(), cur.getCcxx . . $ DLVertex#getC(455f465bc33b4cdf).(), dep ); |
| 1045 | |
| 1046 | // if the number of R-neighbours satisfies condition -- nothing to do |
| 1047 | if ( EdgesToMergecxx . . $ DlSatTester#EdgesToMerge..sizecxx . . $ std/vector#size(fe4d2d262d4164a8).() <= cur.getNumberLEcxx . . $ DLVertex#getNumberLE(ddd8539a2fcdd4ce).() ) |
| 1048 | return true; |
| 1049 | |
| 1050 | // init context |
| 1051 | createBCLEcxx . . $ DlSatTester#createBCLE(49f6e7a06ebc5aa8).(); |
| 1052 | bContextcxx . . $ DlSatTester#bContext.->branchDepcxx . . $ BranchingContext#branchDep. +=cxx . . $ TDepSet#`operator+=`(6a948e2ed08fa462). dep; |
| 1053 | |
| 1054 | // setup BCLE |
| 1055 | BCLEcxx . . $ BCLE#<DlCompletionTreeArccxx . . $ DlCompletionTreeArc#>* bcLE = static_cast<BCLEcxx . . $ BCLE#<DlCompletionTreeArccxx . . $ DlCompletionTreeArc#>*>(bContextcxx . . $ DlSatTester#bContext.); |
| 1056 | |
| 1057 | bcLE->ItemsToMergecxx . . $ BCLE#ItemsToMerge..swapcxx . . $ std/vector#swap(a8be04fc17cbdf49).(EdgesToMergecxx . . $ DlSatTester#EdgesToMerge.); |
| 1058 | bcLE->resetMCIcxx . . $ BCLE#resetMCI(49f6e7a06ebc5aa8).(); |
| 1059 | return false; |
| 1060 | } |
| 1061 | |
| 1062 | |
| 1063 | bool DlSatTestercxx . . $ DlSatTester# :: commonTacticBodyGEcxx . . $ DlSatTester#commonTacticBodyGE(eb1459783ad55ca9). ( const DLVertexcxx . . $ DLVertex#& cur ) // for >=nR.C concepts |
| 1064 | { |
| 1065 | #ifdef ENABLE_CHECKING |
| 1066 | fpp_assert ( isNegative(curConcept.bp()) && cur.Type() == dtLE ); |
| 1067 | #endif |
| 1068 | |
| 1069 | // check blocking conditions |
| 1070 | if ( isCurNodeBlockedcxx . . $ DlSatTester#isCurNodeBlocked(c9857a73d68e59ba).() ) |
| 1071 | return false; |
| 1072 | |
| 1073 | const TRolecxx . . $ TRole#* R = cur.getRolecxx . . $ DLVertex#getRole(69f26110a94b259f).(); |
| 1074 | |
| 1075 | if ( unlikelycxx . . $ `Kernel/globaldef.h:29:10`!(R->isTop()) ) |
| 1076 | return processTopRoleGEcxx . . $ DlSatTester#processTopRoleGE(eb1459783ad55ca9).(cur); |
| 1077 | |
| 1078 | incStatcxx . . $ `Kernel/Reasoner.h:341:10`!(nGeCalls); |
| 1079 | |
| 1080 | if ( isQuickClashGEcxx . . $ DlSatTester#isQuickClashGE(eb1459783ad55ca9).(cur) ) |
| 1081 | return true; |
| 1082 | |
| 1083 | // create N new different edges |
| 1084 | return createDifferentNeighbourscxx . . $ DlSatTester#createDifferentNeighbours(57e1dd464b08be9). ( R, cur.getCcxx . . $ DLVertex#getC(455f465bc33b4cdf).(), curConceptcxx . . $ DlSatTester#curConcept..getDepcxx . . $ ConceptWDep#getDep(bce6462a16d96b29).(), cur.getNumberGEcxx . . $ DLVertex#getNumberGE(ddd8539a2fcdd4ce).(), BlockableLevelcxx . . $ BlockableLevel. ); |
| 1085 | } |
| 1086 | |
| 1087 | //------------------------------------------------------------------------------- |
| 1088 | // Func/LE/GE with top role processing |
| 1089 | //------------------------------------------------------------------------------- |
| 1090 | |
| 1091 | bool |
| 1092 | DlSatTestercxx . . $ DlSatTester# :: processTopRoleFunccxx . . $ DlSatTester#processTopRoleFunc(eb1459783ad55ca9). ( const DLVertexcxx . . $ DLVertex#& cur ) // for <=1 R concepts |
| 1093 | { |
| 1094 | #ifdef ENABLE_CHECKING |
| 1095 | fpp_assert ( isPositive(curConcept.bp()) && isFunctionalVertex(cur) ); |
| 1096 | #endif |
| 1097 | |
| 1098 | incStatcxx . . $ `Kernel/Reasoner.h:341:10`!(nFuncCalls); |
| 1099 | |
| 1100 | if ( isQuickClashLEcxx . . $ DlSatTester#isQuickClashLE(eb1459783ad55ca9).(cur) ) |
| 1101 | return true; |
| 1102 | |
| 1103 | // locate all R-neighbours of curNode |
| 1104 | DepSetcxx . . $ DepSet# dummycxx . . $ TDepSet#TDepSet(49f6e7a06ebc5aa8).; // not used |
| 1105 | findCLabelledNodescxx . . $ DlSatTester#findCLabelledNodes(cfc3f78a9b546f1d). ( bpTOPcxx . . $ bpTOP., dummy ); |
| 1106 | |
| 1107 | // check if we have nodes to merge |
| 1108 | if ( NodesToMergecxx . . $ DlSatTester#NodesToMerge..sizecxx . . $ std/vector#size(fe4d2d262d4164a8).() < 2 ) |
| 1109 | return false; |
| 1110 | |
| 1111 | // merge all nodes to the first (the least wrt nominal hierarchy) found node |
| 1112 | NodeVectorcxx . . $ DlSatTester#NodeVector#::iteratorcxx . . $ std/vector#iterator# q = NodesToMergecxx . . $ DlSatTester#NodesToMerge..begincxx . . $ std/vector#begin(33b10a496a38335b).(), q_end = NodesToMergecxx . . $ DlSatTester#NodesToMerge..endcxx . . $ std/vector#end(33b10a496a38335b).(); |
| 1113 | DlCompletionTreecxx . . $ DlCompletionTree#* sample = *cxx . . $ __gnu_cxx/__normal_iterator#`operator*`(c076846f881f3e7e).q; |
| 1114 | DepSetcxx . . $ DepSet# depcxx . . $ TDepSet#TDepSet(d0e32107376501c0). (curConceptcxx . . $ DlSatTester#curConcept..getDepcxx . . $ ConceptWDep#getDep(bce6462a16d96b29).()); // dep-set for merging |
| 1115 | |
| 1116 | // merge all elements to sample (sample wouldn't be merge) |
| 1117 | while ( ++cxx . . $ __gnu_cxx/__normal_iterator#operator++(93f2e9c3bc4efc49).q !=cxx . . $ __gnu_cxx/`operator!=`(ef3c5749062e825c). q_end ) |
| 1118 | // during merge EdgesToMerge may became purged (see Nasty4) => check this |
| 1119 | if ( !(*cxx . . $ __gnu_cxx/__normal_iterator#`operator*`(c076846f881f3e7e).q)->isPBlockedcxx . . $ DlCompletionTree#isPBlocked(50ce9a9e25b4a850).() ) |
| 1120 | switchResultcxx . . $ `Kernel/Tactic.cpp:27:9`! ( Merge ( *q, sample, dep ) ); |
| 1121 | |
| 1122 | return false; |
| 1123 | } |
| 1124 | |
| 1125 | bool |
| 1126 | DlSatTestercxx . . $ DlSatTester# :: processTopRoleLEcxx . . $ DlSatTester#processTopRoleLE(eb1459783ad55ca9). ( const DLVertexcxx . . $ DLVertex#& cur ) // for <=nR.C concepts |
| 1127 | { |
| 1128 | #ifdef ENABLE_CHECKING |
| 1129 | fpp_assert ( isPositive(curConcept.bp()) && ( cur.Type() == dtLE ) ); |
| 1130 | #endif |
| 1131 | |
| 1132 | BipolarPointercxx . . $ BipolarPointer# C = cur.getCcxx . . $ DLVertex#getC(455f465bc33b4cdf).(); |
| 1133 | bool needInit = true; |
| 1134 | |
| 1135 | if ( !isFirstBranchCallcxx . . $ DlSatTester#isFirstBranchCall(50ce9a9e25b4a850).() ) |
| 1136 | { |
| 1137 | if ( dynamic_cast<BCLEcxx . . $ BCLE#<DlCompletionTreecxx . . $ DlCompletionTree#>*>(bContextcxx . . $ DlSatTester#bContext.) != nullptr ) |
| 1138 | needInit = false; // clash in LE-rule: skip the initial checks |
| 1139 | else // the only possible case is choose-rule; in this case just continue |
| 1140 | fpp_assertcxx . . $ `Kernel/fpp_assert.h:46:10`! ( dynamic_cast<BCChoose*>(bContext) != nullptr ); |
| 1141 | } |
| 1142 | else // if we are here that it IS first LE call |
| 1143 | if ( isQuickClashLEcxx . . $ DlSatTester#isQuickClashLE(eb1459783ad55ca9).(cur) ) |
| 1144 | return true; |
| 1145 | |
| 1146 | // initial phase: choose-rule, NN-rule |
| 1147 | if ( needInit ) |
| 1148 | { |
| 1149 | // check if we have Qualified NR |
| 1150 | if ( C != bpTOPcxx . . $ bpTOP. ) |
| 1151 | switchResultcxx . . $ `Kernel/Tactic.cpp:27:9`! ( applyChooseRuleGlobally(C) ); |
| 1152 | } |
| 1153 | |
| 1154 | // we need to repeat merge until there will be necessary amount of edges |
| 1155 | for (;;) |
| 1156 | { |
| 1157 | if ( isFirstBranchCallcxx . . $ DlSatTester#isFirstBranchCall(50ce9a9e25b4a850).() ) |
| 1158 | if ( initTopLEProcessingcxx . . $ DlSatTester#initTopLEProcessing(eb1459783ad55ca9).(cur) ) |
| 1159 | return false; |
| 1160 | |
| 1161 | BCLEcxx . . $ BCLE#<DlCompletionTreecxx . . $ DlCompletionTree#>* bcLE = static_cast<BCLEcxx . . $ BCLE#<DlCompletionTreecxx . . $ DlCompletionTree#>*>(bContextcxx . . $ DlSatTester#bContext.); |
| 1162 | |
| 1163 | if ( bcLE->noMoreLEOptionscxx . . $ BCLE#noMoreLEOptions(50ce9a9e25b4a850).() ) |
| 1164 | { // set global clashset to cumulative one from previous branch failures |
| 1165 | useBranchDepcxx . . $ DlSatTester#useBranchDep(49f6e7a06ebc5aa8).(); |
| 1166 | return true; |
| 1167 | } |
| 1168 | |
| 1169 | // get from- and to-arcs using corresponding indexes in Edges |
| 1170 | DlCompletionTreecxx . . $ DlCompletionTree#* from = bcLE->getFromcxx . . $ BCLE#getFrom(5a2a78a048fb49a8).(); |
| 1171 | DlCompletionTreecxx . . $ DlCompletionTree#* to = bcLE->getTocxx . . $ BCLE#getTo(5a2a78a048fb49a8).(); |
| 1172 | |
| 1173 | DepSetcxx . . $ DepSet# depcxx . . $ TDepSet#TDepSet(49f6e7a06ebc5aa8).; // empty dep-set |
| 1174 | // fast check for FROM =/= TO |
| 1175 | if ( CGraphcxx . . $ DlSatTester#CGraph..nonMergeablecxx . . $ DlCompletionGraph#nonMergeable(3cd92906c32a9a0b). ( from, to, dep ) ) |
| 1176 | { |
| 1177 | // add dep-set from labels |
| 1178 | if ( C == bpTOPcxx . . $ bpTOP. ) // dep-set is known now |
| 1179 | setClashSetcxx . . $ DlSatTester#setClashSet(d0e32107376501c0).(dep); |
| 1180 | else // QCR: update dep-set wrt C |
| 1181 | { |
| 1182 | // here we know that C is in both labels; set a proper clash-set |
| 1183 | bool isComplex = CGLabelcxx . . $ CGLabel#::isComplexConceptcxx . . $ CGLabel#isComplexConcept(7b512e7165d9f2af).(DLHeapcxx . . $ DlSatTester#DLHeap.[cxx . . $ DLDag#`operator[]`(e265d70853dfed20).C].Typecxx . . $ DLVertexTagDFS#Type(d9c59f5f195b46b8).()); |
| 1184 | bool test {false}; |
| 1185 | |
| 1186 | // here dep contains the clash-set |
| 1187 | test = findConceptClashcxx . . $ DlSatTester#findConceptClash(770c5e45e3d3d307). ( from->labelcxx . . $ DlCompletionTree#label(d7a009c437cd4657).().getLabelcxx . . $ CGLabel#getLabel(ad96fabd6ffb3e80).(isComplex), C, dep ); |
| 1188 | fpp_assertcxx . . $ `Kernel/fpp_assert.h:46:10`!(test); |
| 1189 | dep +=cxx . . $ TDepSet#`operator+=`(6a948e2ed08fa462). getClashSetcxx . . $ DlSatTester#getClashSet(bce6462a16d96b29).(); // save new dep-set |
| 1190 | |
| 1191 | test = findConceptClashcxx . . $ DlSatTester#findConceptClash(770c5e45e3d3d307). ( to->labelcxx . . $ DlCompletionTree#label(d7a009c437cd4657).().getLabelcxx . . $ CGLabel#getLabel(ad96fabd6ffb3e80).(isComplex), C, dep ); |
| 1192 | fpp_assertcxx . . $ `Kernel/fpp_assert.h:46:10`!(test); |
| 1193 | // both clash-sets are now in common clash-set |
| 1194 | } |
| 1195 | |
| 1196 | nextBranchingOptioncxx . . $ DlSatTester#nextBranchingOption(49f6e7a06ebc5aa8).(); |
| 1197 | fpp_assertcxx . . $ `Kernel/fpp_assert.h:46:10`!(!isFirstBranchCall()); |
| 1198 | continue; |
| 1199 | } |
| 1200 | |
| 1201 | savecxx . . $ DlSatTester#save(49f6e7a06ebc5aa8).(); |
| 1202 | |
| 1203 | // add depset from current level and FROM arc and to current dep.set |
| 1204 | DepSetcxx . . $ DepSet# curDepcxx . . $ TDepSet#TDepSet(d0e32107376501c0).(getCurDepSetcxx . . $ DlSatTester#getCurDepSet(6e9566718b894103).()); |
| 1205 | |
| 1206 | switchResultcxx . . $ `Kernel/Tactic.cpp:27:9`! ( Merge ( from, to, curDep ) ); |
| 1207 | } |
| 1208 | } |
| 1209 | |
| 1210 | bool |
| 1211 | DlSatTestercxx . . $ DlSatTester# :: processTopRoleGEcxx . . $ DlSatTester#processTopRoleGE(eb1459783ad55ca9). ( const DLVertexcxx . . $ DLVertex#& cur ) // for >=nR.C concepts |
| 1212 | { |
| 1213 | #ifdef ENABLE_CHECKING |
| 1214 | fpp_assert ( isNegative(curConcept.bp()) && cur.Type() == dtLE ); |
| 1215 | fpp_assert ( !isCurNodeBlocked() ); |
| 1216 | #endif |
| 1217 | |
| 1218 | incStatcxx . . $ `Kernel/Reasoner.h:341:10`!(nGeCalls); |
| 1219 | |
| 1220 | if ( isQuickClashGEcxx . . $ DlSatTester#isQuickClashGE(eb1459783ad55ca9).(cur) ) |
| 1221 | return true; |
| 1222 | |
| 1223 | // create N new different edges |
| 1224 | // FIXME!! for now |
| 1225 | return createDifferentNeighbourscxx . . $ DlSatTester#createDifferentNeighbours(57e1dd464b08be9). ( cur.getRolecxx . . $ DLVertex#getRole(69f26110a94b259f).(), cur.getCcxx . . $ DLVertex#getC(455f465bc33b4cdf).(), curConceptcxx . . $ DlSatTester#curConcept..getDepcxx . . $ ConceptWDep#getDep(bce6462a16d96b29).(), cur.getNumberGEcxx . . $ DLVertex#getNumberGE(ddd8539a2fcdd4ce).(), BlockableLevelcxx . . $ BlockableLevel. ); |
| 1226 | } |
| 1227 | |
| 1228 | bool |
| 1229 | DlSatTestercxx . . $ DlSatTester# :: initTopLEProcessingcxx . . $ DlSatTester#initTopLEProcessing(eb1459783ad55ca9). ( const DLVertexcxx . . $ DLVertex#& cur ) |
| 1230 | { |
| 1231 | DepSetcxx . . $ DepSet# depcxx . . $ TDepSet#TDepSet(49f6e7a06ebc5aa8).; |
| 1232 | // check the amount of neighbours we have |
| 1233 | findCLabelledNodescxx . . $ DlSatTester#findCLabelledNodes(cfc3f78a9b546f1d). ( cur.getCcxx . . $ DLVertex#getC(455f465bc33b4cdf).(), dep ); |
| 1234 | |
| 1235 | // if the number of R-neighbours satisfies condition -- nothing to do |
| 1236 | if ( NodesToMergecxx . . $ DlSatTester#NodesToMerge..sizecxx . . $ std/vector#size(fe4d2d262d4164a8).() <= cur.getNumberLEcxx . . $ DLVertex#getNumberLE(ddd8539a2fcdd4ce).() ) |
| 1237 | return true; |
| 1238 | |
| 1239 | // init context |
| 1240 | createBCTopLEcxx . . $ DlSatTester#createBCTopLE(49f6e7a06ebc5aa8).(); |
| 1241 | bContextcxx . . $ DlSatTester#bContext.->branchDepcxx . . $ BranchingContext#branchDep. +=cxx . . $ TDepSet#`operator+=`(6a948e2ed08fa462). dep; |
| 1242 | |
| 1243 | // setup BCLE |
| 1244 | BCLEcxx . . $ BCLE#<DlCompletionTreecxx . . $ DlCompletionTree#>* bcLE = static_cast<BCLEcxx . . $ BCLE#<DlCompletionTreecxx . . $ DlCompletionTree#>*>(bContextcxx . . $ DlSatTester#bContext.); |
| 1245 | |
| 1246 | bcLE->ItemsToMergecxx . . $ BCLE#ItemsToMerge..swapcxx . . $ std/vector#swap(a8be04fc17cbdf49).(NodesToMergecxx . . $ DlSatTester#NodesToMerge.); |
| 1247 | bcLE->resetMCIcxx . . $ BCLE#resetMCI(49f6e7a06ebc5aa8).(); |
| 1248 | return false; |
| 1249 | } |
| 1250 | |
| 1251 | |
| 1252 | //------------------------------------------------------------------------------- |
| 1253 | // Support for Func/LE/GE processing |
| 1254 | //------------------------------------------------------------------------------- |
| 1255 | |
| 1256 | /// create N R-neighbours of curNode with given Nominal LEVEL labelled with C |
| 1257 | bool DlSatTestercxx . . $ DlSatTester# :: createDifferentNeighbourscxx . . $ DlSatTester#createDifferentNeighbours(57e1dd464b08be9). ( const TRolecxx . . $ TRole#* R, BipolarPointercxx . . $ BipolarPointer# C, const DepSetcxx . . $ DepSet#& dep, |
| 1258 | unsigned int n, CTNominalLevelcxx . . $ CTNominalLevel# level ) |
| 1259 | { |
| 1260 | // create N new edges with the same IR |
| 1261 | DlCompletionTreeArccxx . . $ DlCompletionTreeArc#* pA = nullptr; |
| 1262 | CGraphcxx . . $ DlSatTester#CGraph..initIRcxx . . $ DlCompletionGraph#initIR(49f6e7a06ebc5aa8).(); |
| 1263 | for ( unsigned int i = 0; i < n; ++i ) |
| 1264 | { |
| 1265 | pA = createOneNeighbourcxx . . $ DlSatTester#createOneNeighbour(38b471ae92c362df). ( R, dep, level ); |
| 1266 | DlCompletionTreecxx . . $ DlCompletionTree#* child = pA->getArcEndcxx . . $ DlCompletionTreeArc#getArcEnd(1b0634bb62d2788b).(); |
| 1267 | |
| 1268 | // make CHILD different from other created nodes |
| 1269 | // don't care about return value as clash can't occur |
| 1270 | CGraphcxx . . $ DlSatTester#CGraph..setCurIRcxx . . $ DlCompletionGraph#setCurIR(9c3f4bbfaa7a98e6). ( child, dep ); |
| 1271 | |
| 1272 | // add necessary new node labels and setup new edge |
| 1273 | switchResultcxx . . $ `Kernel/Tactic.cpp:27:9`! ( initNewNode ( child, dep, C ) ); |
| 1274 | switchResultcxx . . $ `Kernel/Tactic.cpp:27:9`! ( setupEdge ( pA, dep, redoForall ) ); |
| 1275 | } |
| 1276 | CGraphcxx . . $ DlSatTester#CGraph..finiIRcxx . . $ DlCompletionGraph#finiIR(49f6e7a06ebc5aa8).(); |
| 1277 | |
| 1278 | // re-apply all <= NR in curNode; do it only once for all created nodes; no need for Irr |
| 1279 | return applyUniversalNRcxx . . $ DlSatTester#applyUniversalNR(c075c0126f93693d). ( curNodecxx . . $ DlSatTester#curNode., pA, dep, redoFunccxx . . $ DlSatTester#redoFunc.|redoAtMostcxx . . $ DlSatTester#redoAtMost. ); |
| 1280 | } |
| 1281 | |
| 1282 | /// check if ATLEAST and ATMOST restrictions are in clash; setup depset from CUR |
| 1283 | bool DlSatTestercxx . . $ DlSatTester# :: isNRClashcxx . . $ DlSatTester#isNRClash(8d4f16609c5957f). ( const DLVertexcxx . . $ DLVertex#& atleast, const DLVertexcxx . . $ DLVertex#& atmost, const ConceptWDepcxx . . $ ConceptWDep#& reason ) |
| 1284 | { |
| 1285 | if ( atmost.Typecxx . . $ DLVertexTagDFS#Type(d9c59f5f195b46b8).() != dtLEcxx . . $ dtLE. || atleast.Typecxx . . $ DLVertexTagDFS#Type(d9c59f5f195b46b8).() != dtLEcxx . . $ dtLE. ) |
| 1286 | return false; |
| 1287 | if ( !checkNRclashcxx . . $ DlSatTester#checkNRclash(17a20583008e8ff). ( atleast, atmost ) ) // no clash between them |
| 1288 | return false; |
| 1289 | |
| 1290 | // clash exists: create dep-set |
| 1291 | setClashSetcxx . . $ DlSatTester#setClashSet(d0e32107376501c0). ( curConceptcxx . . $ DlSatTester#curConcept..getDepcxx . . $ ConceptWDep#getDep(bce6462a16d96b29).() +cxx . . $ operator+(a79ac10aefecd7d4). reason.getDepcxx . . $ ConceptWDep#getDep(bce6462a16d96b29).() ); |
| 1292 | |
| 1293 | // log clash reason |
| 1294 | if ( LLMcxx . . $ LLM..isWritablecxx . . $ LeveLogger#isWritable(8de63fdb265b07c1).(llGTAcxx . . $ llGTA.) ) |
| 1295 | logClashcxx . . $ DlSatTester#logClash(a520327312b37f83). ( curNodecxx . . $ DlSatTester#curNode., reason ); |
| 1296 | |
| 1297 | return true; |
| 1298 | } |
| 1299 | |
| 1300 | /// aux method that checks whether clash occurs during the merge of labels |
| 1301 | bool |
| 1302 | DlSatTestercxx . . $ DlSatTester# :: checkMergeClashcxx . . $ DlSatTester#checkMergeClash(8f3204f21abf4ab4). ( const CGLabelcxx . . $ CGLabel#& from, const CGLabelcxx . . $ CGLabel#& to, const DepSetcxx . . $ DepSet#& dep, unsigned int nodeId ) |
| 1303 | { |
| 1304 | CGLabelcxx . . $ CGLabel#::const_iteratorcxx . . $ CGLabel#const_iterator# pcxx . . $ __gnu_cxx/__normal_iterator#__normal_iterator(49f6e7a06ebc5aa8)., p_endcxx . . $ __gnu_cxx/__normal_iterator#__normal_iterator(49f6e7a06ebc5aa8).; |
| 1305 | DepSetcxx . . $ DepSet# clashDepcxx . . $ TDepSet#TDepSet(d0e32107376501c0).(dep); |
| 1306 | bool clash = false; |
| 1307 | for ( p =cxx . . $ __gnu_cxx/__normal_iterator#`operator=`(8a166801ba8fe87b). from.begin_sccxx . . $ CGLabel#begin_sc(e55d760a93e9f197).(), p_end =cxx . . $ __gnu_cxx/__normal_iterator#`operator=`(8a166801ba8fe87b). from.end_sccxx . . $ CGLabel#end_sc(e55d760a93e9f197).(); p <cxx . . $ __gnu_cxx/`operator<`(ef3c5749062e825c). p_end; ++cxx . . $ __gnu_cxx/__normal_iterator#operator++(93f2e9c3bc4efc49).p ) |
| 1308 | if ( isUsedcxx . . $ DlSatTester#isUsed(4a668f6de69bf818).(inversecxx . . $ inverse(7864480464b09eea).(p->cxx . . $ __gnu_cxx/__normal_iterator#`operator->`(a68f0626e749d9f6).bpcxx . . $ ConceptWDep#bp(455f465bc33b4cdf).())) |
| 1309 | && findConceptClashcxx . . $ DlSatTester#findConceptClash(baf284e062705c9d). ( to.getLabelcxx . . $ CGLabel#getLabel(ca01410c9270c655).(/*isComplex=*/false), inversecxx . . $ inverse(2a1413093fe85b90).(*cxx . . $ __gnu_cxx/__normal_iterator#`operator*`(c076846f881f3e7e).p) ) ) |
| 1310 | { |
| 1311 | clash = true; |
| 1312 | clashDep.addcxx . . $ TDepSet#add(d0e32107376501c0).(getClashSetcxx . . $ DlSatTester#getClashSet(bce6462a16d96b29).()); |
| 1313 | // log the clash |
| 1314 | if ( LLMcxx . . $ LLM..isWritablecxx . . $ LeveLogger#isWritable(8de63fdb265b07c1).(llGTAcxx . . $ llGTA.) ) |
| 1315 | LLcxx . . $ LL. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " x(" <<cxx . . $ std/basic_ostream#`operator<<`(b4c055c363850233). nodeId <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "," <<cxx . . $ std/basic_ostream#`operator<<`(23b6575433a77e57). p->cxx . . $ __gnu_cxx/__normal_iterator#`operator->`(a68f0626e749d9f6).bpcxx . . $ ConceptWDep#bp(455f465bc33b4cdf).() <<cxx . . $ `operator<<`(8df530197ee94a2e). getClashSetcxx . . $ DlSatTester#getClashSet(bce6462a16d96b29).()+cxx . . $ operator+(a79ac10aefecd7d4).dep <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). ")"; |
| 1316 | } |
| 1317 | for ( p =cxx . . $ __gnu_cxx/__normal_iterator#`operator=`(8a166801ba8fe87b). from.begin_cccxx . . $ CGLabel#begin_cc(e55d760a93e9f197).(), p_end =cxx . . $ __gnu_cxx/__normal_iterator#`operator=`(8a166801ba8fe87b). from.end_cccxx . . $ CGLabel#end_cc(e55d760a93e9f197).(); p <cxx . . $ __gnu_cxx/`operator<`(ef3c5749062e825c). p_end; ++cxx . . $ __gnu_cxx/__normal_iterator#operator++(93f2e9c3bc4efc49).p ) |
| 1318 | if ( isUsedcxx . . $ DlSatTester#isUsed(4a668f6de69bf818).(inversecxx . . $ inverse(7864480464b09eea).(p->cxx . . $ __gnu_cxx/__normal_iterator#`operator->`(a68f0626e749d9f6).bpcxx . . $ ConceptWDep#bp(455f465bc33b4cdf).())) |
| 1319 | && findConceptClashcxx . . $ DlSatTester#findConceptClash(baf284e062705c9d). ( to.getLabelcxx . . $ CGLabel#getLabel(ca01410c9270c655).(/*isComplex=*/true), inversecxx . . $ inverse(2a1413093fe85b90).(*cxx . . $ __gnu_cxx/__normal_iterator#`operator*`(c076846f881f3e7e).p) ) ) |
| 1320 | { |
| 1321 | clash = true; |
| 1322 | clashDep.addcxx . . $ TDepSet#add(d0e32107376501c0).(getClashSetcxx . . $ DlSatTester#getClashSet(bce6462a16d96b29).()); |
| 1323 | // log the clash |
| 1324 | if ( LLMcxx . . $ LLM..isWritablecxx . . $ LeveLogger#isWritable(8de63fdb265b07c1).(llGTAcxx . . $ llGTA.) ) |
| 1325 | LLcxx . . $ LL. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " x(" <<cxx . . $ std/basic_ostream#`operator<<`(b4c055c363850233). nodeId <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "," <<cxx . . $ std/basic_ostream#`operator<<`(23b6575433a77e57). p->cxx . . $ __gnu_cxx/__normal_iterator#`operator->`(a68f0626e749d9f6).bpcxx . . $ ConceptWDep#bp(455f465bc33b4cdf).() <<cxx . . $ `operator<<`(8df530197ee94a2e). getClashSetcxx . . $ DlSatTester#getClashSet(bce6462a16d96b29).()+cxx . . $ operator+(a79ac10aefecd7d4).dep <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). ")"; |
| 1326 | } |
| 1327 | if ( clash ) |
| 1328 | setClashSetcxx . . $ DlSatTester#setClashSet(d0e32107376501c0).(clashDep); |
| 1329 | return clash; |
| 1330 | } |
| 1331 | |
| 1332 | bool DlSatTestercxx . . $ DlSatTester# :: mergeLabelscxx . . $ DlSatTester#mergeLabels(eda12b98be57c15d). ( const CGLabelcxx . . $ CGLabel#& from, DlCompletionTreecxx . . $ DlCompletionTree#* to, const DepSetcxx . . $ DepSet#& dep ) |
| 1333 | { |
| 1334 | CGLabelcxx . . $ CGLabel#::const_iteratorcxx . . $ CGLabel#const_iterator# pcxx . . $ __gnu_cxx/__normal_iterator#__normal_iterator(49f6e7a06ebc5aa8)., p_endcxx . . $ __gnu_cxx/__normal_iterator#__normal_iterator(49f6e7a06ebc5aa8).; |
| 1335 | CGLabelcxx . . $ CGLabel#& lab(to->labelcxx . . $ DlCompletionTree#label(d7a009c437cd4657).()); |
| 1336 | // arrays for simple- and complex concepts in the merged-to vector |
| 1337 | CWDArraycxx . . $ CWDArray#& sc(lab.getLabelcxx . . $ CGLabel#getLabel(ad96fabd6ffb3e80).(/*isComplex=*/false)); |
| 1338 | CWDArraycxx . . $ CWDArray#& cc(lab.getLabelcxx . . $ CGLabel#getLabel(ad96fabd6ffb3e80).(/*isComplex=*/true)); |
| 1339 | |
| 1340 | // due to merging, all the concepts in the TO label |
| 1341 | // should be updated to the new dep-set DEP |
| 1342 | // TODO!! check whether this is really necessary |
| 1343 | for ( p =cxx . . $ __gnu_cxx/__normal_iterator#`operator=`(8a166801ba8fe87b). sc.begincxx . . $ CWDArray#begin(e55d760a93e9f197).(), p_end =cxx . . $ __gnu_cxx/__normal_iterator#`operator=`(8a166801ba8fe87b). sc.endcxx . . $ CWDArray#end(e55d760a93e9f197).(); p <cxx . . $ __gnu_cxx/`operator<`(ef3c5749062e825c). p_end; ++cxx . . $ __gnu_cxx/__normal_iterator#operator++(93f2e9c3bc4efc49).p ) |
| 1344 | CGraphcxx . . $ DlSatTester#CGraph..saveRareCondcxx . . $ DlCompletionGraph#saveRareCond(1cbbef85a2ba1293). ( sc.updateDepSetcxx . . $ CWDArray#updateDepSet(a14715da98a4ac7b). ( p->cxx . . $ __gnu_cxx/__normal_iterator#`operator->`(a68f0626e749d9f6).bpcxx . . $ ConceptWDep#bp(455f465bc33b4cdf).(), dep ) ); |
| 1345 | for ( p =cxx . . $ __gnu_cxx/__normal_iterator#`operator=`(8a166801ba8fe87b). cc.begincxx . . $ CWDArray#begin(e55d760a93e9f197).(), p_end =cxx . . $ __gnu_cxx/__normal_iterator#`operator=`(8a166801ba8fe87b). cc.endcxx . . $ CWDArray#end(e55d760a93e9f197).(); p <cxx . . $ __gnu_cxx/`operator<`(ef3c5749062e825c). p_end; ++cxx . . $ __gnu_cxx/__normal_iterator#operator++(93f2e9c3bc4efc49).p ) |
| 1346 | CGraphcxx . . $ DlSatTester#CGraph..saveRareCondcxx . . $ DlCompletionGraph#saveRareCond(1cbbef85a2ba1293). ( cc.updateDepSetcxx . . $ CWDArray#updateDepSet(a14715da98a4ac7b). ( p->cxx . . $ __gnu_cxx/__normal_iterator#`operator->`(a68f0626e749d9f6).bpcxx . . $ ConceptWDep#bp(455f465bc33b4cdf).(), dep ) ); |
| 1347 | |
| 1348 | // if the concept is already exists in the node label -- |
| 1349 | // we still need to update it with a new dep-set (due to merging) |
| 1350 | // note that DEP is already there |
| 1351 | for ( p =cxx . . $ __gnu_cxx/__normal_iterator#`operator=`(8a166801ba8fe87b). from.begin_sccxx . . $ CGLabel#begin_sc(e55d760a93e9f197).(), p_end =cxx . . $ __gnu_cxx/__normal_iterator#`operator=`(8a166801ba8fe87b). from.end_sccxx . . $ CGLabel#end_sc(e55d760a93e9f197).(); p <cxx . . $ __gnu_cxx/`operator<`(ef3c5749062e825c). p_end; ++cxx . . $ __gnu_cxx/__normal_iterator#operator++(93f2e9c3bc4efc49).p ) |
| 1352 | if ( findConceptcxx . . $ DlSatTester#findConcept(baf284e062705c9d). ( sc, *cxx . . $ __gnu_cxx/__normal_iterator#`operator*`(c076846f881f3e7e).p ) ) |
| 1353 | CGraphcxx . . $ DlSatTester#CGraph..saveRareCondcxx . . $ DlCompletionGraph#saveRareCond(1cbbef85a2ba1293). ( sc.updateDepSetcxx . . $ CWDArray#updateDepSet(a14715da98a4ac7b). ( p->cxx . . $ __gnu_cxx/__normal_iterator#`operator->`(a68f0626e749d9f6).bpcxx . . $ ConceptWDep#bp(455f465bc33b4cdf).(), p->cxx . . $ __gnu_cxx/__normal_iterator#`operator->`(a68f0626e749d9f6).getDepcxx . . $ ConceptWDep#getDep(bce6462a16d96b29).() ) ); |
| 1354 | else |
| 1355 | switchResultcxx . . $ `Kernel/Tactic.cpp:27:9`! ( insertToDoEntry ( to, ConceptWDep(*p,dep), DLHeap[*p].Type(), "M" ) ); |
| 1356 | for ( p =cxx . . $ __gnu_cxx/__normal_iterator#`operator=`(8a166801ba8fe87b). from.begin_cccxx . . $ CGLabel#begin_cc(e55d760a93e9f197).(), p_end =cxx . . $ __gnu_cxx/__normal_iterator#`operator=`(8a166801ba8fe87b). from.end_cccxx . . $ CGLabel#end_cc(e55d760a93e9f197).(); p <cxx . . $ __gnu_cxx/`operator<`(ef3c5749062e825c). p_end; ++cxx . . $ __gnu_cxx/__normal_iterator#operator++(93f2e9c3bc4efc49).p ) |
| 1357 | if ( findConceptcxx . . $ DlSatTester#findConcept(baf284e062705c9d). ( cc, *cxx . . $ __gnu_cxx/__normal_iterator#`operator*`(c076846f881f3e7e).p ) ) |
| 1358 | CGraphcxx . . $ DlSatTester#CGraph..saveRareCondcxx . . $ DlCompletionGraph#saveRareCond(1cbbef85a2ba1293). ( cc.updateDepSetcxx . . $ CWDArray#updateDepSet(a14715da98a4ac7b). ( p->cxx . . $ __gnu_cxx/__normal_iterator#`operator->`(a68f0626e749d9f6).bpcxx . . $ ConceptWDep#bp(455f465bc33b4cdf).(), p->cxx . . $ __gnu_cxx/__normal_iterator#`operator->`(a68f0626e749d9f6).getDepcxx . . $ ConceptWDep#getDep(bce6462a16d96b29).() ) ); |
| 1359 | else |
| 1360 | switchResultcxx . . $ `Kernel/Tactic.cpp:27:9`! ( insertToDoEntry ( to, ConceptWDep(*p,dep), DLHeap[*p].Type(), "M" ) ); |
| 1361 | |
| 1362 | return false; |
| 1363 | } |
| 1364 | |
| 1365 | bool DlSatTestercxx . . $ DlSatTester# :: Mergecxx . . $ DlSatTester#Merge(9805cd4076885613). ( DlCompletionTreecxx . . $ DlCompletionTree#* from, DlCompletionTreecxx . . $ DlCompletionTree#* to, const DepSetcxx . . $ DepSet#& depF ) |
| 1366 | { |
| 1367 | // if node is already purged -- nothing to do |
| 1368 | fpp_assertcxx . . $ `Kernel/fpp_assert.h:46:10`! ( !from->isPBlocked() ); |
| 1369 | |
| 1370 | // prevent node to be merged to itself |
| 1371 | fpp_assertcxx . . $ `Kernel/fpp_assert.h:46:10`! ( from != to ); |
| 1372 | |
| 1373 | // never merge nominal node to blockable one |
| 1374 | fpp_assertcxx . . $ `Kernel/fpp_assert.h:46:10`! ( to->getNominalLevel() <= from->getNominalLevel() ); |
| 1375 | |
| 1376 | if ( LLMcxx . . $ LLM..isWritablecxx . . $ LeveLogger#isWritable(8de63fdb265b07c1).(llGTAcxx . . $ llGTA.) ) |
| 1377 | LLcxx . . $ LL. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " m(" <<cxx . . $ std/basic_ostream#`operator<<`(b4c055c363850233). from->getIdcxx . . $ DlCompletionTree#getId(ddd8539a2fcdd4ce).() <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "->" <<cxx . . $ std/basic_ostream#`operator<<`(b4c055c363850233). to->getIdcxx . . $ DlCompletionTree#getId(ddd8539a2fcdd4ce).() <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). ")"; |
| 1378 | |
| 1379 | incStatcxx . . $ `Kernel/Reasoner.h:341:10`!(nMergeCalls); |
| 1380 | |
| 1381 | // can't merge 2 nodes which are in inequality relation |
| 1382 | DepSetcxx . . $ DepSet# depcxx . . $ TDepSet#TDepSet(d0e32107376501c0).(depF); |
| 1383 | if ( CGraphcxx . . $ DlSatTester#CGraph..nonMergeablecxx . . $ DlCompletionGraph#nonMergeable(3cd92906c32a9a0b). ( from, to, dep ) ) |
| 1384 | { |
| 1385 | setClashSetcxx . . $ DlSatTester#setClashSet(d0e32107376501c0).(dep); |
| 1386 | return true; |
| 1387 | } |
| 1388 | |
| 1389 | // check for the clash before doing anything else |
| 1390 | if ( checkMergeClashcxx . . $ DlSatTester#checkMergeClash(8f3204f21abf4ab4). ( from->labelcxx . . $ DlCompletionTree#label(d7a009c437cd4657).(), to->labelcxx . . $ DlCompletionTree#label(d7a009c437cd4657).(), depF, to->getIdcxx . . $ DlCompletionTree#getId(ddd8539a2fcdd4ce).() ) ) |
| 1391 | return true; |
| 1392 | |
| 1393 | // copy all node labels |
| 1394 | switchResultcxx . . $ `Kernel/Tactic.cpp:27:9`! ( mergeLabels ( from->label(), to, depF ) ); |
| 1395 | |
| 1396 | // correct graph structure |
| 1397 | typedef stdcxx . . $ std/::vectorcxx . . $ std/vector#<DlCompletionTreeArccxx . . $ DlCompletionTreeArc#*> edgeVectorcxx . . $ DlSatTester#Merge(9805cd4076885613).edgeVector#; |
| 1398 | edgeVectorcxx . . $ DlSatTester#Merge(9805cd4076885613).edgeVector# edgescxx . . $ std/vector#vector(49f6e7a06ebc5aa8).; |
| 1399 | CGraphcxx . . $ DlSatTester#CGraph..Mergecxx . . $ DlCompletionGraph#Merge(e2735435d305419c). ( from, to, depF, edges ); |
| 1400 | |
| 1401 | // check whether a disjoint roles lead to clash |
| 1402 | for ( const auto& edge: edges ) |
| 1403 | if ( edge->getRolecxx . . $ DlCompletionTreeArc#getRole(69f26110a94b259f).()->isDisjointcxx . . $ TRole#isDisjoint(50ce9a9e25b4a850).() && |
| 1404 | checkDisjointRoleClashcxx . . $ DlSatTester#checkDisjointRoleClash(e9490775c569687e). ( edge->getReversecxx . . $ DlCompletionTreeArc#getReverse(96bc8dcf80af44db).()->getArcEndcxx . . $ DlCompletionTreeArc#getArcEnd(1b0634bb62d2788b).(), edge->getArcEndcxx . . $ DlCompletionTreeArc#getArcEnd(1b0634bb62d2788b).(), edge->getRolecxx . . $ DlCompletionTreeArc#getRole(69f26110a94b259f).(), depF ) ) |
| 1405 | return true; |
| 1406 | |
| 1407 | // nothing more to do with data nodes |
| 1408 | if ( to->isDataNodecxx . . $ DlCompletionTree#isDataNode(50ce9a9e25b4a850).() ) // data concept -- run data center for it |
| 1409 | return checkDataClashcxx . . $ DlSatTester#checkDataClash(6c1e73ffdfd78b24).(to); |
| 1410 | |
| 1411 | // for every node added to TO, every ALL, Irr and <=-node should be checked |
| 1412 | for ( const auto& edge: edges ) |
| 1413 | switchResultcxx . . $ `Kernel/Tactic.cpp:27:9`! ( applyUniversalNR ( to, edge, depF, redoEverything ) ); |
| 1414 | |
| 1415 | // we do real action here, so the return value |
| 1416 | return false; |
| 1417 | } |
| 1418 | |
| 1419 | bool |
| 1420 | DlSatTestercxx . . $ DlSatTester# :: checkDisjointRoleClashcxx . . $ DlSatTester#checkDisjointRoleClash(e9490775c569687e). ( const DlCompletionTreecxx . . $ DlCompletionTree#* from, const DlCompletionTreecxx . . $ DlCompletionTree#* to, |
| 1421 | const TRolecxx . . $ TRole#* R, const DepSetcxx . . $ DepSet#& dep ) |
| 1422 | { |
| 1423 | // try to check whether link from->to labelled with something disjoint with R |
| 1424 | for ( const auto& edge: *from ) |
| 1425 | if ( checkDisjointRoleClashcxx . . $ DlSatTester#checkDisjointRoleClash(22c7de14146f1c24). ( edge, to, R, dep ) ) |
| 1426 | return true; |
| 1427 | return false; |
| 1428 | } |
| 1429 | |
| 1430 | // compare 2 CT edges wrt blockable/nominal nodes at their ends |
| 1431 | class EdgeComparecxx . . $ EdgeCompare# |
| 1432 | { |
| 1433 | public: |
| 1434 | bool operatorcxx . . $ EdgeCompare#`operator()`(71f08801de6a9e89).() ( DlCompletionTreeArccxx . . $ DlCompletionTreeArc#* pa, DlCompletionTreeArccxx . . $ DlCompletionTreeArc#* qa ) const |
| 1435 | { return *(pa)->getArcEndcxx . . $ DlCompletionTreeArc#getArcEnd(1b0634bb62d2788b).() <cxx . . $ DlCompletionTree#`operator<`(306fae7647cf32c9). *(qa)->getArcEndcxx . . $ DlCompletionTreeArc#getArcEnd(1b0634bb62d2788b).(); } |
| 1436 | }; // EdgeCompare |
| 1437 | |
| 1438 | /// aux method to check whether edge ended to NODE should be added to EdgesToMerge |
| 1439 | template <typename Iterator> |
| 1440 | bool isNewEdgecxx . . $ isNewEdge(d0e2756ad4ab85d4). ( const DlCompletionTreecxx . . $ DlCompletionTree#* node, Iterator begin, Iterator end ) |
| 1441 | { |
| 1442 | for ( Iterator q = begin; q != end; ++q ) |
| 1443 | if ( (*q)->getArcEnd() == node ) // skip edges to the same node |
| 1444 | return false; |
| 1445 | |
| 1446 | return true; |
| 1447 | } |
| 1448 | |
| 1449 | void |
| 1450 | DlSatTestercxx . . $ DlSatTester# :: findNeighbourscxx . . $ DlSatTester#findNeighbours(64c329be3c32769c). ( const TRolecxx . . $ TRole#* Role, BipolarPointercxx . . $ BipolarPointer# C, DepSetcxx . . $ DepSet#& Dep ) |
| 1451 | { |
| 1452 | EdgesToMergecxx . . $ DlSatTester#EdgesToMerge..clearcxx . . $ std/vector#clear(49f6e7a06ebc5aa8).(); |
| 1453 | bool isComplex = CGLabelcxx . . $ CGLabel#::isComplexConceptcxx . . $ CGLabel#isComplexConcept(7b512e7165d9f2af).(DLHeapcxx . . $ DlSatTester#DLHeap.[cxx . . $ DLDag#`operator[]`(e265d70853dfed20).C].Typecxx . . $ DLVertexTagDFS#Type(d9c59f5f195b46b8).()); |
| 1454 | |
| 1455 | for ( auto& edge: *curNodecxx . . $ DlSatTester#curNode. ) |
| 1456 | if ( edge->isNeighbourcxx . . $ DlCompletionTreeArc#isNeighbour(81d69a9c8508a392).(Role) |
| 1457 | && isNewEdgecxx . . $ isNewEdge(d0e2756ad4ab85d4). ( edge->getArcEndcxx . . $ DlCompletionTreeArc#getArcEnd(1b0634bb62d2788b).(), EdgesToMergecxx . . $ DlSatTester#EdgesToMerge..begincxx . . $ std/vector#begin(33b10a496a38335b).(), EdgesToMergecxx . . $ DlSatTester#EdgesToMerge..endcxx . . $ std/vector#end(33b10a496a38335b).() ) |
| 1458 | && findChooseRuleConceptcxx . . $ DlSatTester#findChooseRuleConcept(1f424839d3fe8655). ( edge->getArcEndcxx . . $ DlCompletionTreeArc#getArcEnd(1b0634bb62d2788b).()->labelcxx . . $ DlCompletionTree#label(d7a009c437cd4657).().getLabelcxx . . $ CGLabel#getLabel(ad96fabd6ffb3e80).(isComplex), C, Dep ) ) |
| 1459 | EdgesToMergecxx . . $ DlSatTester#EdgesToMerge..push_backcxx . . $ std/vector#push_back(77d9f17553126ecb).(edge); |
| 1460 | |
| 1461 | // sort EdgesToMerge: From named nominals to generated nominals to blockable nodes |
| 1462 | stdcxx . . $ std/::sortcxx . . $ std/sort(4d3091562df4e52e). ( EdgesToMergecxx . . $ DlSatTester#EdgesToMerge..begincxx . . $ std/vector#begin(33b10a496a38335b).(), EdgesToMergecxx . . $ DlSatTester#EdgesToMerge..endcxx . . $ std/vector#end(33b10a496a38335b).(), EdgeComparecxx . . $ EdgeCompare#() ); |
| 1463 | } |
| 1464 | |
| 1465 | class NodeComparecxx . . $ NodeCompare# |
| 1466 | { |
| 1467 | public: |
| 1468 | bool operatorcxx . . $ NodeCompare#`operator()`(be5d6c9b2b15e92).() ( DlCompletionTreecxx . . $ DlCompletionTree#* p, DlCompletionTreecxx . . $ DlCompletionTree#* q ) const { return *p <cxx . . $ DlCompletionTree#`operator<`(306fae7647cf32c9). *q; } |
| 1469 | }; |
| 1470 | |
| 1471 | void |
| 1472 | DlSatTestercxx . . $ DlSatTester# :: findCLabelledNodescxx . . $ DlSatTester#findCLabelledNodes(cfc3f78a9b546f1d). ( BipolarPointercxx . . $ BipolarPointer# C, DepSetcxx . . $ DepSet#& Dep ) |
| 1473 | { |
| 1474 | NodesToMergecxx . . $ DlSatTester#NodesToMerge..clearcxx . . $ std/vector#clear(49f6e7a06ebc5aa8).(); |
| 1475 | bool isComplex = CGLabelcxx . . $ CGLabel#::isComplexConceptcxx . . $ CGLabel#isComplexConcept(7b512e7165d9f2af).(DLHeapcxx . . $ DlSatTester#DLHeap.[cxx . . $ DLDag#`operator[]`(e265d70853dfed20).C].Typecxx . . $ DLVertexTagDFS#Type(d9c59f5f195b46b8).()); |
| 1476 | |
| 1477 | // FIXME!! do we need this for d-blocked nodes? |
| 1478 | for ( auto& node: CGraphcxx . . $ DlSatTester#CGraph. ) |
| 1479 | if ( isNodeGloballyUsedcxx . . $ DlSatTester#isNodeGloballyUsed(e2c3b6f64f9879b7).(node) && findChooseRuleConceptcxx . . $ DlSatTester#findChooseRuleConcept(1f424839d3fe8655). ( node->labelcxx . . $ DlCompletionTree#label(d7a009c437cd4657).().getLabelcxx . . $ CGLabel#getLabel(ad96fabd6ffb3e80).(isComplex), C, Dep ) ) |
| 1480 | NodesToMergecxx . . $ DlSatTester#NodesToMerge..push_backcxx . . $ std/vector#push_back(77d9f17553126ecb).(node); |
| 1481 | |
| 1482 | // sort EdgesToMerge: From named nominals to generated nominals to blockable nodes |
| 1483 | stdcxx . . $ std/::sortcxx . . $ std/sort(4d3091562df4e52e). ( NodesToMergecxx . . $ DlSatTester#NodesToMerge..begincxx . . $ std/vector#begin(33b10a496a38335b).(), NodesToMergecxx . . $ DlSatTester#NodesToMerge..endcxx . . $ std/vector#end(33b10a496a38335b).(), NodeComparecxx . . $ NodeCompare#() ); |
| 1484 | } |
| 1485 | |
| 1486 | |
| 1487 | //------------------------------------------------------------------------------- |
| 1488 | // Choose-rule processing |
| 1489 | //------------------------------------------------------------------------------- |
| 1490 | |
| 1491 | bool DlSatTestercxx . . $ DlSatTester# :: commonTacticBodyChoosecxx . . $ DlSatTester#commonTacticBodyChoose(dc9af82091734e92). ( const TRolecxx . . $ TRole#* R, BipolarPointercxx . . $ BipolarPointer# C ) |
| 1492 | { |
| 1493 | // apply choose-rule for every R-neighbour |
| 1494 | for ( auto& edge: *curNodecxx . . $ DlSatTester#curNode. ) |
| 1495 | { |
| 1496 | if ( edge->isNeighbourcxx . . $ DlCompletionTreeArc#isNeighbour(81d69a9c8508a392).(R) ) |
| 1497 | switchResultcxx . . $ `Kernel/Tactic.cpp:27:9`! ( applyChooseRule ( edge->getArcEnd(), C ) ); |
| 1498 | } |
| 1499 | |
| 1500 | return false; |
| 1501 | } |
| 1502 | |
| 1503 | /// apply choose-rule for all vertices (necessary for Top role in QCR) |
| 1504 | bool |
| 1505 | DlSatTestercxx . . $ DlSatTester# :: applyChooseRuleGloballycxx . . $ DlSatTester#applyChooseRuleGlobally(83c267b20bac841a). ( BipolarPointercxx . . $ BipolarPointer# C ) |
| 1506 | { |
| 1507 | for ( auto& node: CGraphcxx . . $ DlSatTester#CGraph. ) |
| 1508 | { |
| 1509 | if ( isObjectNodeUnblockedcxx . . $ DlSatTester#isObjectNodeUnblocked(e2c3b6f64f9879b7).(node) ) // FIXME!! think about d-blocked nodes |
| 1510 | switchResultcxx . . $ `Kernel/Tactic.cpp:27:9`! ( applyChooseRule ( node, C ) ); |
| 1511 | } |
| 1512 | |
| 1513 | return false; |
| 1514 | } |
| 1515 | |
| 1516 | //------------------------------------------------------------------------------- |
| 1517 | // Support for choose-rule processing |
| 1518 | //------------------------------------------------------------------------------- |
| 1519 | |
| 1520 | /// apply choose-rule to given node |
| 1521 | bool DlSatTestercxx . . $ DlSatTester# :: applyChooseRulecxx . . $ DlSatTester#applyChooseRule(313c71cfc95746d6). ( DlCompletionTreecxx . . $ DlCompletionTree#* node, BipolarPointercxx . . $ BipolarPointer# C ) |
| 1522 | { |
| 1523 | if ( node->isLabelledBycxx . . $ DlCompletionTree#isLabelledBy(4a668f6de69bf818).(C) || node->isLabelledBycxx . . $ DlCompletionTree#isLabelledBy(4a668f6de69bf818).(inversecxx . . $ inverse(7864480464b09eea).(C)) ) |
| 1524 | return false; |
| 1525 | |
| 1526 | // now node will be labelled with ~C or C |
| 1527 | if ( isFirstBranchCallcxx . . $ DlSatTester#isFirstBranchCall(50ce9a9e25b4a850).() ) |
| 1528 | { |
| 1529 | createBCChcxx . . $ DlSatTester#createBCCh(49f6e7a06ebc5aa8).(); |
| 1530 | // save current state |
| 1531 | savecxx . . $ DlSatTester#save(49f6e7a06ebc5aa8).(); |
| 1532 | |
| 1533 | return addToDoEntrycxx . . $ DlSatTester#addToDoEntry(50176c0f88cf3d4f). ( node, inversecxx . . $ inverse(7864480464b09eea).(C), getCurDepSetcxx . . $ DlSatTester#getCurDepSet(6e9566718b894103).(), "cr0" ); |
| 1534 | } |
| 1535 | else |
| 1536 | { |
| 1537 | prepareBranchDepcxx . . $ DlSatTester#prepareBranchDep(49f6e7a06ebc5aa8).(); |
| 1538 | DepSetcxx . . $ DepSet# depcxx . . $ TDepSet#TDepSet(d0e32107376501c0).(getBranchDepcxx . . $ DlSatTester#getBranchDep(595707e528a7237f).()); |
| 1539 | determiniseBranchingOpcxx . . $ DlSatTester#determiniseBranchingOp(49f6e7a06ebc5aa8).(); |
| 1540 | return addToDoEntrycxx . . $ DlSatTester#addToDoEntry(50176c0f88cf3d4f). ( node, C, dep, "cr1" ); |
| 1541 | } |
| 1542 | } |
| 1543 | |
| 1544 | //------------------------------------------------------------------------------- |
| 1545 | // NN rule processing |
| 1546 | //------------------------------------------------------------------------------- |
| 1547 | |
| 1548 | bool DlSatTestercxx . . $ DlSatTester# :: commonTacticBodyNNcxx . . $ DlSatTester#commonTacticBodyNN(eb1459783ad55ca9). ( const DLVertexcxx . . $ DLVertex#& cur ) // NN-rule |
| 1549 | { |
| 1550 | // here we KNOW that NN-rule is applicable, so skip some tests |
| 1551 | incStatcxx . . $ `Kernel/Reasoner.h:341:10`!(nNNCalls); |
| 1552 | |
| 1553 | if ( isFirstBranchCallcxx . . $ DlSatTester#isFirstBranchCall(50ce9a9e25b4a850).() ) |
| 1554 | createBCNNcxx . . $ DlSatTester#createBCNN(49f6e7a06ebc5aa8).(); |
| 1555 | |
| 1556 | const BCNNcxx . . $ BCNN#* bcNN = static_cast<BCNNcxx . . $ BCNN#*>(bContextcxx . . $ DlSatTester#bContext.); |
| 1557 | |
| 1558 | // check whether we did all possible tries |
| 1559 | if ( bcNN->noMoreNNOptionscxx . . $ BCNN#noMoreNNOptions(8de63fdb265b07c1).(cur.getNumberLEcxx . . $ DLVertex#getNumberLE(ddd8539a2fcdd4ce).()) ) |
| 1560 | { // set global clashset to cumulative one from previous branch failures |
| 1561 | useBranchDepcxx . . $ DlSatTester#useBranchDep(49f6e7a06ebc5aa8).(); |
| 1562 | return true; |
| 1563 | } |
| 1564 | |
| 1565 | // take next NN number; save it as SAVE() will reset it to 0 |
| 1566 | unsigned int NN = bcNN->valuecxx . . $ BCNN#value.; |
| 1567 | |
| 1568 | // prepare to addition to the label |
| 1569 | savecxx . . $ DlSatTester#save(49f6e7a06ebc5aa8).(); |
| 1570 | |
| 1571 | // new (just branched) dep-set |
| 1572 | const DepSetcxx . . $ DepSet# curDepcxx . . $ TDepSet#TDepSet(d0e32107376501c0).(getCurDepSetcxx . . $ DlSatTester#getCurDepSet(6e9566718b894103).()); |
| 1573 | |
| 1574 | // make a stopper to mark that NN-rule is applied |
| 1575 | switchResultcxx . . $ `Kernel/Tactic.cpp:27:9`! ( addToDoEntry ( curNode, curConcept.bp() + (BipolarPointer)cur.getNumberLE(), DepSet(), "NNs" ) ); |
| 1576 | |
| 1577 | // create curNN new different edges |
| 1578 | switchResultcxx . . $ `Kernel/Tactic.cpp:27:9`! ( createDifferentNeighbours ( cur.getRole(), cur.getC(), curDep, NN, curNode->getNominalLevel()+1 ) ); |
| 1579 | |
| 1580 | // now remember NR we just created: it is (<= curNN R), so have to find it |
| 1581 | return addToDoEntrycxx . . $ DlSatTester#addToDoEntry(50176c0f88cf3d4f). ( curNodecxx . . $ DlSatTester#curNode., curConceptcxx . . $ DlSatTester#curConcept..bpcxx . . $ ConceptWDep#bp(455f465bc33b4cdf).() + (BipolarPointercxx . . $ BipolarPointer#)(cur.getNumberLEcxx . . $ DLVertex#getNumberLE(ddd8539a2fcdd4ce).()-NN), curDep, "NN" ); |
| 1582 | } |
| 1583 | |
| 1584 | //------------------------------------------------------------------------------- |
| 1585 | // Support for NN rule processing |
| 1586 | //------------------------------------------------------------------------------- |
| 1587 | |
| 1588 | /// @return true iff NN-rule wrt (<= R) is applicable to the curNode |
| 1589 | bool DlSatTestercxx . . $ DlSatTester# :: isNNApplicablecxx . . $ DlSatTester#isNNApplicable(95e2d485c042ad5a). ( const TRolecxx . . $ TRole#* r, BipolarPointercxx . . $ BipolarPointer# C, BipolarPointercxx . . $ BipolarPointer# stopper ) const |
| 1590 | { |
| 1591 | // NN rule is only applicable to nominal nodes |
| 1592 | if ( !curNodecxx . . $ DlSatTester#curNode.->isNominalNodecxx . . $ DlCompletionTree#isNominalNode(50ce9a9e25b4a850).() ) |
| 1593 | return false; |
| 1594 | |
| 1595 | // check whether the NN-rule was already applied here for a given concept |
| 1596 | if ( isUsedcxx . . $ DlSatTester#isUsed(4a668f6de69bf818).(stopper) && curNodecxx . . $ DlSatTester#curNode.->isLabelledBycxx . . $ DlCompletionTree#isLabelledBy(4a668f6de69bf818).(stopper) ) |
| 1597 | return false; |
| 1598 | |
| 1599 | // check for the real applicability of the NN-rule here |
| 1600 | for ( const auto& edge: *curNodecxx . . $ DlSatTester#curNode. ) |
| 1601 | { |
| 1602 | const DlCompletionTreecxx . . $ DlCompletionTree#* suspect = edge->getArcEndcxx . . $ DlCompletionTreeArc#getArcEnd(1b0634bb62d2788b).(); |
| 1603 | |
| 1604 | // if there is an edge that require to run the rule, then we need it |
| 1605 | if ( edge->isPredEdgecxx . . $ DlCompletionTreeArc#isPredEdge(50ce9a9e25b4a850).() && suspect->isBlockableNodecxx . . $ DlCompletionTree#isBlockableNode(50ce9a9e25b4a850).() && edge->isNeighbourcxx . . $ DlCompletionTreeArc#isNeighbour(81d69a9c8508a392).(r) && suspect->isLabelledBycxx . . $ DlCompletionTree#isLabelledBy(4a668f6de69bf818).(C) ) |
| 1606 | { |
| 1607 | if ( LLMcxx . . $ LLM..isWritablecxx . . $ LeveLogger#isWritable(8de63fdb265b07c1).(llGTAcxx . . $ llGTA.) ) |
| 1608 | LLcxx . . $ LL. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " NN(" <<cxx . . $ std/basic_ostream#`operator<<`(b4c055c363850233). suspect->getIdcxx . . $ DlCompletionTree#getId(ddd8539a2fcdd4ce).() <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). ")"; |
| 1609 | |
| 1610 | return true; |
| 1611 | } |
| 1612 | } |
| 1613 | |
| 1614 | // can't apply NN-rule |
| 1615 | return false; |
| 1616 | } |
| 1617 | |
| 1618 | //------------------------------------------------------------------------------- |
| 1619 | // Support for (\neg) \E R.Self |
| 1620 | //------------------------------------------------------------------------------- |
| 1621 | |
| 1622 | bool DlSatTestercxx . . $ DlSatTester# :: commonTacticBodySomeSelfcxx . . $ DlSatTester#commonTacticBodySomeSelf(f4c3e7633be50e77). ( const TRolecxx . . $ TRole#* R ) |
| 1623 | { |
| 1624 | // check blocking conditions |
| 1625 | if ( isCurNodeBlockedcxx . . $ DlSatTester#isCurNodeBlocked(c9857a73d68e59ba).() ) |
| 1626 | return false; |
| 1627 | |
| 1628 | // nothing to do if R-loop already exists |
| 1629 | for ( const auto& edge: *curNodecxx . . $ DlSatTester#curNode. ) |
| 1630 | if ( edge->getArcEndcxx . . $ DlCompletionTreeArc#getArcEnd(1b0634bb62d2788b).() == curNodecxx . . $ DlSatTester#curNode. && edge->isNeighbourcxx . . $ DlCompletionTreeArc#isNeighbour(81d69a9c8508a392).(R) ) |
| 1631 | return false; |
| 1632 | |
| 1633 | // create an R-loop through curNode |
| 1634 | const DepSetcxx . . $ DepSet#& dep = curConceptcxx . . $ DlSatTester#curConcept..getDepcxx . . $ ConceptWDep#getDep(bce6462a16d96b29).(); |
| 1635 | DlCompletionTreeArccxx . . $ DlCompletionTreeArc#* pA = CGraphcxx . . $ DlSatTester#CGraph..createLoopcxx . . $ DlCompletionGraph#createLoop(882ef0e58548cfd4). ( curNodecxx . . $ DlSatTester#curNode., R, dep ); |
| 1636 | return setupEdgecxx . . $ DlSatTester#setupEdge(4031d85ce7510aa7). ( pA, dep, redoEverythingcxx . . $ DlSatTester#redoEverything. ); |
| 1637 | } |
| 1638 | |
| 1639 | bool DlSatTestercxx . . $ DlSatTester# :: commonTacticBodyIrreflcxx . . $ DlSatTester#commonTacticBodyIrrefl(f4c3e7633be50e77). ( const TRolecxx . . $ TRole#* R ) |
| 1640 | { |
| 1641 | // return clash if R-loop is found |
| 1642 | for ( const auto& edge: *curNodecxx . . $ DlSatTester#curNode. ) |
| 1643 | if ( checkIrreflexivitycxx . . $ DlSatTester#checkIrreflexivity(cfccf941f2df725f). ( edge, R, curConceptcxx . . $ DlSatTester#curConcept..getDepcxx . . $ ConceptWDep#getDep(bce6462a16d96b29).() ) ) |
| 1644 | return true; |
| 1645 | |
| 1646 | return false; |
| 1647 | } |
| 1648 | |
| 1649 | //------------------------------------------------------------------------------- |
| 1650 | // Support for projection R\C -> P |
| 1651 | //------------------------------------------------------------------------------- |
| 1652 | |
| 1653 | bool DlSatTestercxx . . $ DlSatTester# :: commonTacticBodyProjcxx . . $ DlSatTester#commonTacticBodyProj(61818a0a3dc494fb). ( const TRolecxx . . $ TRole#* R, BipolarPointercxx . . $ BipolarPointer# C, const TRolecxx . . $ TRole#* ProjR ) |
| 1654 | { |
| 1655 | // find an R-edge, try to apply projection-rule to it |
| 1656 | |
| 1657 | // if ~C is in the label of curNode, do nothing |
| 1658 | if ( curNodecxx . . $ DlSatTester#curNode.->isLabelledBycxx . . $ DlCompletionTree#isLabelledBy(4a668f6de69bf818).(inversecxx . . $ inverse(7864480464b09eea).(C)) ) |
| 1659 | return false; |
| 1660 | |
| 1661 | // checkProjection() might change curNode's edge vector and thus invalidate iterators |
| 1662 | DlCompletionTreecxx . . $ DlCompletionTree#::const_edge_iteratorcxx . . $ DlCompletionTree#const_edge_iterator# p = curNodecxx . . $ __gnu_cxx/__normal_iterator#__normal_iterator(ea0f1a22ba5f21a0).->begincxx . . $ DlCompletionTree#begin(de7d1c517ae77062).(), p_end = curNodecxx . . $ __gnu_cxx/__normal_iterator#__normal_iterator(ea0f1a22ba5f21a0).->endcxx . . $ DlCompletionTree#end(de7d1c517ae77062).(); |
| 1663 | |
| 1664 | for ( stdcxx . . $ std/::ptrdiff_tcxx . . $ std/ptrdiff_t# i = 0, n = p_end -cxx . . $ __gnu_cxx/operator-(a40477c209547c13). p; i < n; ++i ) |
| 1665 | { |
| 1666 | p =cxx . . $ __gnu_cxx/__normal_iterator#`operator=`(6ed9f5e851ea08da). curNodecxx . . $ __gnu_cxx/__normal_iterator#__normal_iterator(ea0f1a22ba5f21a0).->begincxx . . $ DlCompletionTree#begin(de7d1c517ae77062).() +cxx . . $ __gnu_cxx/__normal_iterator#operator+(d0cb2d2ebd313f38). i; |
| 1667 | if ( (*cxx . . $ __gnu_cxx/__normal_iterator#`operator*`(c076846f881f3e7e).p)->isNeighbourcxx . . $ DlCompletionTreeArc#isNeighbour(81d69a9c8508a392).(R) ) |
| 1668 | switchResultcxx . . $ `Kernel/Tactic.cpp:27:9`! ( checkProjection ( *p, C, ProjR ) ); |
| 1669 | } |
| 1670 | |
| 1671 | return false; |
| 1672 | } |
| 1673 | |
| 1674 | bool DlSatTestercxx . . $ DlSatTester# :: checkProjectioncxx . . $ DlSatTester#checkProjection(9b792ef1469f2519). ( DlCompletionTreeArccxx . . $ DlCompletionTreeArc#* pA, BipolarPointercxx . . $ BipolarPointer# C, const TRolecxx . . $ TRole#* ProjR ) |
| 1675 | { |
| 1676 | // nothing to do if pA is labelled by ProjR as well |
| 1677 | if ( pA->isNeighbourcxx . . $ DlCompletionTreeArc#isNeighbour(81d69a9c8508a392).(ProjR) ) |
| 1678 | return false; |
| 1679 | // if ~C is in the label of curNode, do nothing |
| 1680 | if ( curNodecxx . . $ DlSatTester#curNode.->isLabelledBycxx . . $ DlCompletionTree#isLabelledBy(4a668f6de69bf818).(inversecxx . . $ inverse(7864480464b09eea).(C)) ) |
| 1681 | return false; |
| 1682 | |
| 1683 | // neither C nor ~C are in the label: make a choice |
| 1684 | DepSetcxx . . $ DepSet# depcxx . . $ TDepSet#TDepSet(d0e32107376501c0).(curConceptcxx . . $ DlSatTester#curConcept..getDepcxx . . $ ConceptWDep#getDep(bce6462a16d96b29).()); |
| 1685 | dep.addcxx . . $ TDepSet#add(d0e32107376501c0).(pA->getDepcxx . . $ DlCompletionTreeArc#getDep(bce6462a16d96b29).()); |
| 1686 | |
| 1687 | if ( !curNodecxx . . $ DlSatTester#curNode.->isLabelledBycxx . . $ DlCompletionTree#isLabelledBy(4a668f6de69bf818).(C) ) |
| 1688 | { |
| 1689 | if ( isFirstBranchCallcxx . . $ DlSatTester#isFirstBranchCall(50ce9a9e25b4a850).() ) |
| 1690 | { |
| 1691 | createBCChcxx . . $ DlSatTester#createBCCh(49f6e7a06ebc5aa8).(); |
| 1692 | // save current state |
| 1693 | savecxx . . $ DlSatTester#save(49f6e7a06ebc5aa8).(); |
| 1694 | |
| 1695 | return addToDoEntrycxx . . $ DlSatTester#addToDoEntry(50176c0f88cf3d4f). ( curNodecxx . . $ DlSatTester#curNode., inversecxx . . $ inverse(7864480464b09eea).(C), getCurDepSetcxx . . $ DlSatTester#getCurDepSet(6e9566718b894103).(), "cr0" ); |
| 1696 | } |
| 1697 | else |
| 1698 | { |
| 1699 | prepareBranchDepcxx . . $ DlSatTester#prepareBranchDep(49f6e7a06ebc5aa8).(); |
| 1700 | dep.addcxx . . $ TDepSet#add(d0e32107376501c0).(getBranchDepcxx . . $ DlSatTester#getBranchDep(595707e528a7237f).()); |
| 1701 | determiniseBranchingOpcxx . . $ DlSatTester#determiniseBranchingOp(49f6e7a06ebc5aa8).(); |
| 1702 | switchResultcxx . . $ `Kernel/Tactic.cpp:27:9`! ( addToDoEntry ( curNode, C, dep, "cr1" ) ); |
| 1703 | } |
| 1704 | } |
| 1705 | // here C is in the label of curNode: add ProjR to the edge if necessary |
| 1706 | DlCompletionTreecxx . . $ DlCompletionTree#* child = pA->getArcEndcxx . . $ DlCompletionTreeArc#getArcEnd(1b0634bb62d2788b).(); |
| 1707 | pA = CGraphcxx . . $ DlSatTester#CGraph..addRoleLabelcxx . . $ DlCompletionGraph#addRoleLabel(2369b4bf26f5db64). ( curNodecxx . . $ DlSatTester#curNode., child, pA->isPredEdgecxx . . $ DlCompletionTreeArc#isPredEdge(50ce9a9e25b4a850).(), ProjR, dep ); |
| 1708 | return setupEdgecxx . . $ DlSatTester#setupEdge(4031d85ce7510aa7). ( pA, dep, redoEverythingcxx . . $ DlSatTester#redoEverything. ); |
| 1709 | } |