Skip to content

Commit 963a3fc

Browse files
committed
refactor: necessary rule -> per branch behavior
1 parent 2059a06 commit 963a3fc

3 files changed

Lines changed: 11 additions & 6 deletions

File tree

‎prover/src/formula/to_string.rs‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ impl FormulaFormatOptions
4949
return FormulaFormatOptions
5050
{
5151
notations: *default_notations.borrow(),
52-
should_show_possible_worlds: false,
52+
//todo should_show_possible_worlds: false,
53+
should_show_possible_worlds: true,
5354
should_show_sign: false,
5455
should_show_fuzzy_tags: false,
5556
}

‎prover/src/logic/common_modal_logic.rs‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -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
{

‎prover/src/tree/path.rs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,11 +107,11 @@ impl Display for ProofTreePath
107107
{
108108
if index < last_index
109109
{
110-
write!(f, "{} -> ", node.formula).unwrap();
110+
write!(f, "{} -> ", node.formula)?;
111111
}
112112
else
113113
{
114-
write!(f, "{}", node.formula).unwrap();
114+
write!(f, "{}", node.formula)?;
115115
}
116116
}
117117

0 commit comments

Comments
 (0)