Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Elimination rules throw exceptions when setting both the operator and the variable(s) #684

Open
charlestian23 opened this issue Nov 7, 2023 · 2 comments
Labels
bug Something isn't working short truth table

Comments

@charlestian23
Copy link
Collaborator

charlestian23 commented Nov 7, 2023

Description

Consider the following example for Not Elimination:
image
When trying to set both not and A to any combination of true or false and then selecting "Not Elimination", the following happens:
image
And the following errors show up in the terminal:

Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
	at edu.rpi.legup.puzzle.shorttruthtable.rules.basic.DirectRule_Generic.checkRuleRawAt(DirectRule_Generic.java:43)
	at edu.rpi.legup.model.rules.DirectRule.checkRuleAt(DirectRule.java:82)
	at edu.rpi.legup.model.rules.DirectRule.checkRuleRaw(DirectRule.java:52)
	at edu.rpi.legup.model.rules.DirectRule.checkRule(DirectRule.java:37)
	at edu.rpi.legup.model.tree.TreeTransition.isCorrect(TreeTransition.java:337)
	at edu.rpi.legup.model.tree.TreeTransition.isContradictoryBranch(TreeTransition.java:221)
	at edu.rpi.legup.model.tree.TreeNode.isContradictoryBranch(TreeNode.java:36)
	at edu.rpi.legup.ui.proofeditorui.treeview.TreeNodeView.draw(TreeNodeView.java:77)
	at edu.rpi.legup.ui.proofeditorui.treeview.TreeView.redrawTree(TreeView.java:241)
	at edu.rpi.legup.ui.proofeditorui.treeview.TreeView.drawTree(TreeView.java:424)
	at edu.rpi.legup.ui.proofeditorui.treeview.TreeView.draw(TreeView.java:222)
	at edu.rpi.legup.ui.ZoomablePane.paint(ZoomablePane.java:28)
	at java.desktop/javax.swing.JComponent.paintChildren(JComponent.java:907)
	at java.desktop/javax.swing.JComponent.paint(JComponent.java:1083)
	at java.desktop/javax.swing.JViewport.paint(JViewport.java:737)
	at java.desktop/javax.swing.JComponent.paintChildren(JComponent.java:907)
	at java.desktop/javax.swing.JComponent.paint(JComponent.java:1083)
	at java.desktop/javax.swing.JComponent.paintToOffscreen(JComponent.java:5255)
	at java.desktop/javax.swing.RepaintManager$PaintManager.paintDoubleBufferedFPScales(RepaintManager.java:1707)
	at java.desktop/javax.swing.RepaintManager$PaintManager.paintDoubleBuffered(RepaintManager.java:1616)
	at java.desktop/javax.swing.RepaintManager$PaintManager.paint(RepaintManager.java:1556)
	at java.desktop/javax.swing.RepaintManager.paint(RepaintManager.java:1323)
	at java.desktop/javax.swing.JComponent._paintImmediately(JComponent.java:5203)
	at java.desktop/javax.swing.JComponent.paintImmediately(JComponent.java:5013)
	at java.desktop/javax.swing.RepaintManager$4.run(RepaintManager.java:865)
	at java.desktop/javax.swing.RepaintManager$4.run(RepaintManager.java:848)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
	at java.desktop/javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:848)
	at java.desktop/javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:823)
	at java.desktop/javax.swing.RepaintManager.prePaintDirtyRegions(RepaintManager.java:772)
	at java.desktop/javax.swing.RepaintManager$ProcessingRunnable.run(RepaintManager.java:1890)
	at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:313)
	at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:770)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:715)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
	at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:740)
	at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
	at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)

Note that this also occurs for other elimination rules. See this screenshot for And Elimination:
image

Steps to Reproduce

  1. Download BlankNot.zip
  2. Unzip the file and open it in the proof editor
  3. Set not and A to any combination of true or false
  4. Attempt to justify this step with Not Elimination
  5. See a new node not appear, and there should be an exception thrown in the terminal

Expected Behavior

A new node should appear with a red transition arrow, as this is not a valid application of Not Elimination.

Screenshots

No response

Puzzle Files

BlankNot.zip

Additional Context

Note that once this issue is fixed, the CannotSetBothAtOnceTest in src/test/java/puzzles/shorttruthtable/rules/NotEliminationTest.java should be uncommented. Additionally, it might be useful to generalize that test case for all Elimination rules.

@charlestian23 charlestian23 added bug Something isn't working short truth table labels Nov 7, 2023
@charlestian23 charlestian23 changed the title [BUG] Not Elimination throws exception when setting both not and the variable [BUG] Elimination rules throw exceptions when setting both the operator and the variable(s) Nov 7, 2023
@charlestian23
Copy link
Collaborator Author

Updated the description and title after doing some testing with Chase, this seems to be an issue across all Elimination rules.

@charlestian23
Copy link
Collaborator Author

Whoever works on this bug should uncomment the test case noted in #675.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working short truth table
Projects
None yet
Development

No branches or pull requests

1 participant