Skip to content

Commit 2cbb496

Browse files
committed
fix natural deduction rules
1 parent 8810693 commit 2cbb496

1 file changed

Lines changed: 11 additions & 22 deletions

File tree

  • mathesis/deduction/natural_deduction

‎mathesis/deduction/natural_deduction/rules.py‎

Lines changed: 11 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,6 @@ def apply(self, target: SequentItem, counter=count(1)):
188188
subfml = target.fml.sub
189189

190190
# Find on the left side
191-
print(subfml)
192191
nonneg_item = next(
193192
filter(
194193
lambda x: str(x.fml) == str(subfml),
@@ -455,17 +454,18 @@ def apply(self, target: SequentItem, counter=count(1)):
455454
n=next(counter),
456455
)
457456

457+
sq = _apply(target, [antec, conseq], counter, preserve_target=False)
458+
458459
conseq.subproof = NDSubproof(
459460
conseq,
461+
parent=target.subproof,
460462
)
461463
antec.subproof = NDSubproof(
462464
antec,
463-
parent=conseq.subproof,
465+
# parent=conseq.subproof,
464466
)
465467
antec.subproof.hyp = True
466468

467-
sq = _apply(target, [antec, conseq], counter, preserve_target=False)
468-
469469
if sq.tautology():
470470
left_item = next(
471471
filter(
@@ -586,27 +586,16 @@ def apply(self, target: SequentItem, counter=count(1)):
586586
sign=sign.NEGATIVE,
587587
n=next(counter),
588588
)
589-
instantiated_item.subproof = NDSubproof(
590-
instantiated_item,
591-
children=[target.subproof],
592-
)
593589

594590
sequent = _apply(
595591
target, [instantiated_item], counter, preserve_target=False
596592
)
597593

598-
# if sequent.tautology():
599-
# left_item = next(
600-
# filter(
601-
# lambda x: str(x.fml) == str(instantiated_item.fml),
602-
# sequent.left,
603-
# ),
604-
# None,
605-
# )
606-
# if left_item is not None:
607-
# instantiated_item.subproof.children = left_item.subproof.children
608-
609-
# target.subproof.children = [deepcopy(instantiated_item.subproof)]
594+
instantiated_item.subproof = NDSubproof(
595+
instantiated_item,
596+
children=[],
597+
parent=target.subproof,
598+
)
610599

611600
return {
612601
"queue_items": [sequent],
@@ -634,15 +623,15 @@ def apply(self, target: SequentItem, counter=count(1)):
634623
n=next(counter),
635624
)
636625

626+
sequent, target = _apply(target, [instantiated_item], counter)
627+
637628
instantiated_item.subproof = NDSubproof(
638629
instantiated_item,
639630
children=[target.subproof],
640631
parent=target.sequent.right[0].subproof,
641632
)
642633
instantiated_item.subproof.derived_by = self
643634

644-
sequent, target = _apply(target, [instantiated_item], counter)
645-
646635
return {
647636
"queue_items": [sequent],
648637
"counter": counter,

0 commit comments

Comments
 (0)