Skip to content

Commit

Permalink
removed copy because all are immutable objects
Browse files Browse the repository at this point in the history
and ~(~x) simplification at construction step
  • Loading branch information
Vipul-Cariappa committed Oct 23, 2023
1 parent 8d267d5 commit 985de5f
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions logic/proposition.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from typing import Any, TypeAlias
from copy import copy
from abc import ABC, abstractmethod
from warnings import warn
from dataclasses import dataclass
Expand Down Expand Up @@ -38,8 +37,6 @@ def __or__(self, other: Any) -> StatementT:
return CompositePropositionOR(self, other)

def __invert__(self) -> StatementT:
if isinstance(self, CompositePropositionNOT):
return copy(self.statement)
return CompositePropositionNOT(self)


Expand All @@ -49,10 +46,10 @@ class Proposition(Statement):
statement: str = ""

def remove_conditionals(self) -> StatementT:
return copy(self)
return self

def simplify(self) -> StatementT:
return copy(self)
return self

def extract(self) -> list[PropositionT]:
return [self]
Expand Down Expand Up @@ -83,7 +80,7 @@ def __eq__(self, other: Any) -> bool:
class CompositeProposition(Statement):
def simplify(self) -> StatementT:
warn("Not Implemented")
return copy(self)
return self


@dataclass(frozen=True)
Expand Down

0 comments on commit 985de5f

Please sign in to comment.