@@ -169,7 +169,7 @@ impl <LOGIC : Logic> Modality<LOGIC>
169169 already_iterated_possible_worlds : BTreeSet :: new ( ) ,
170170 } ;
171171
172- let result = self . reapply_necessity ( factory, & mut reapplication_data, PossibleWorld :: zero ( ) ) ;
172+ let result = self . reapply_necessity ( factory, & mut reapplication_data, None , PossibleWorld :: zero ( ) ) ;
173173 factory. push_necessity_reapplication ( reapplication_data) ;
174174
175175 return result;
@@ -190,7 +190,7 @@ impl <LOGIC : Logic> Modality<LOGIC>
190190 //necessary reapplication should happen only if we're on one of some specific paths
191191 if reapplication. input_leafs_node_ids . iter ( ) . any ( |leaf_node_id| path. contains_node_with_id ( * leaf_node_id) )
192192 {
193- let output_from_necessity = self . reapply_necessity ( factory, & mut reapplication, forked_world) ;
193+ let output_from_necessity = self . reapply_necessity ( factory, & mut reapplication, Some ( node ) , forked_world) ;
194194 output_results. push ( output_from_necessity) ;
195195 }
196196 }
@@ -204,6 +204,7 @@ impl <LOGIC : Logic> Modality<LOGIC>
204204 fn reapply_necessity ( & self ,
205205 factory : & mut RuleApplyFactory ,
206206 reapplication_data : & mut NecessityReapplicationData ,
207+ possibility_node : Option < & ProofTreeNode > ,
207208 forked_world : PossibleWorld ,
208209 ) -> LogicRuleResult
209210 {
@@ -232,7 +233,10 @@ impl <LOGIC : Logic> Modality<LOGIC>
232233 . map ( |node| node. formula . get_possible_world ( ) )
233234 . collect :: < BTreeSet < PossibleWorld > > ( ) ;
234235
235- possible_worlds_on_path. insert ( forked_world) ;
236+ if let Some ( node) = possibility_node && path. contains ( node)
237+ {
238+ possible_worlds_on_path. insert ( forked_world) ;
239+ }
236240
237241 for formula in & output_formulas
238242 {
0 commit comments