diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index ab06878a..817ad8a2 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -5,8 +5,11 @@
+
-
+
+
+
@@ -199,7 +202,7 @@
"Python tests.pytest for test_axiomatic_system_1.TestVariable.test_variable.executor": "Debug",
"Python tests.pytest for test_axiomatic_system_1.test_is_extension.executor": "Run",
"Python tests.pytest for test_fl1.TestFormalObject.test_formal_object.executor": "Run",
- "Python tests.pytest for test_formula.TestFormula.test_formula.executor": "Run",
+ "Python tests.pytest for test_formula.TestFormula.test_formula.executor": "Debug",
"Python tests.pytest for test_formula_notations.TestFormulaNotations.test_formula_notation.executor": "Run",
"Python tests.pytest for test_formula_notations.TestFormulaNotations.test_formula_notations.executor": "Run",
"Python tests.pytest for test_formula_notations.TestFormulaNotations.test_infix_notation.executor": "Run",
@@ -383,7 +386,7 @@
"Shell Script.build_docs.sh.executor": "Run",
"git-widget-placeholder": "master",
"ignore.virus.scanning.warn.message": "true",
- "last_opened_file_path": "/Users/daviddoret/PycharmProjects/punctilious/tests",
+ "last_opened_file_path": "/Users/daviddoret/PycharmProjects/punctilious/src/punctilious",
"settings.editor.selected.configurable": "preferences.pluginManager",
"timeTracker.activityTracker": "null",
"timeTracker.comment": "",
@@ -447,10 +450,10 @@
+
-
@@ -461,7 +464,7 @@
-
+
@@ -668,7 +671,7 @@
-
+
@@ -681,7 +684,7 @@
-
+
@@ -798,7 +801,7 @@
-
+
@@ -809,11 +812,11 @@
-
+
+
-
@@ -833,14 +836,6 @@
1687980987309
-
-
- 1733644925706
-
-
-
- 1733644925706
-
1733645125055
@@ -1225,7 +1220,15 @@
1734726097638
-
+
+
+ 1734726646132
+
+
+
+ 1734726646132
+
+
random
@@ -1401,6 +1404,26 @@
15
+
+ file://$PROJECT_DIR$/tests/test_formula.py
+ 17
+
+
+
+ file://$PROJECT_DIR$/src/punctilious/__init__.py
+ 43
+
+
+
+ file://$PROJECT_DIR$/src/punctilious/_operators_1_representations.py
+ 13
+
+
+
+ file://$PROJECT_DIR$/src/punctilious/_bundling.py
+ 272
+
+
diff --git a/src/punctilious/__init__.py b/src/punctilious/__init__.py
index 1d5b6d21..2b7a8700 100644
--- a/src/punctilious/__init__.py
+++ b/src/punctilious/__init__.py
@@ -21,6 +21,7 @@
import _latin_alphabet_uppercase_serif_italic
# import _latin_alphabet_lowercase_serif_roman
import _operators_1
+import _operators_1_representations
# import _propositional_logic_1
# import _tao_analysis_1_2006
@@ -34,7 +35,10 @@
greek_alphabet_uppercase_serif_italic = _greek_alphabet_uppercase_serif_italic.GreekAlphabetUppercaseSerifItalic()
latin_alphabet_lowercase_serif_italic = _latin_alphabet_lowercase_serif_italic.LatinAlphabetLowercaseSerifItalic()
latin_alphabet_uppercase_serif_italic = _latin_alphabet_uppercase_serif_italic.LatinAlphabetUppercaseSerifItalic()
+
operators_1 = _operators_1.Operators1()
+# TODO: Resume here to assure operators are enriched with representations.
+operators_1_representations = _operators_1_representations.Operators1Representations()
# tao_analysis_1_2006 = _tao_analysis_1_2006.TaoAnalysis12006()
pass
diff --git a/src/punctilious/__pycache__/__init__.cpython-312.pyc b/src/punctilious/__pycache__/__init__.cpython-312.pyc
index 07f974df..dee4e677 100644
Binary files a/src/punctilious/__pycache__/__init__.cpython-312.pyc and b/src/punctilious/__pycache__/__init__.cpython-312.pyc differ
diff --git a/src/punctilious/__pycache__/_formal_language.cpython-312.pyc b/src/punctilious/__pycache__/_formal_language.cpython-312.pyc
index 08ad1dd3..b1cfce62 100644
Binary files a/src/punctilious/__pycache__/_formal_language.cpython-312.pyc and b/src/punctilious/__pycache__/_formal_language.cpython-312.pyc differ
diff --git a/src/punctilious/__pycache__/_operators_1_representations.cpython-312.pyc b/src/punctilious/__pycache__/_operators_1_representations.cpython-312.pyc
new file mode 100644
index 00000000..05a5b689
Binary files /dev/null and b/src/punctilious/__pycache__/_operators_1_representations.cpython-312.pyc differ
diff --git a/src/punctilious/_formal_language.py b/src/punctilious/_formal_language.py
index ac0eb7fd..6bd5ab45 100644
--- a/src/punctilious/_formal_language.py
+++ b/src/punctilious/_formal_language.py
@@ -57,7 +57,7 @@ def __repr__(self):
return self.connector.__str__() + self.arguments.__str__()
def __str__(self):
- return self.connector.__str__() + self.arguments.__str__()
+ return self.represent()
@property
def arguments(self) -> FormulaArguments:
@@ -67,7 +67,6 @@ def arguments(self) -> FormulaArguments:
def connector(self) -> Connector:
return self[0]
- @property
def represent(self):
return self.connector.rep_formula(argument=self.arguments)
@@ -428,9 +427,11 @@ def rep_formula(self, argument: FormulaArguments | None = None):
- a1, a2, ..., an are the formula arguments.
"""
if self.formula_representation is None:
- raise ValueError(f'Connector {self.slug} has no formula representation.')
+ raise ValueError(f'Connector {self.uid} has no formula representation.')
+ connector: str = self.rep()
argument = ensure_formula_arguments(argument)
- variables = {'connector': self, 'argument': argument}
+ argument_representations = tuple(a.represent() for a in argument)
+ variables = {'connector': connector, 'argument': argument_representations}
return self.formula_representation.rep(variables=variables)
@property
diff --git a/src/punctilious/_operators_1_representations.py b/src/punctilious/_operators_1_representations.py
new file mode 100644
index 00000000..1837221e
--- /dev/null
+++ b/src/punctilious/_operators_1_representations.py
@@ -0,0 +1,24 @@
+import _util
+import _representation
+import _formal_language
+import _bundling
+
+
+class Operators1Representations(_bundling.YamlFileBundle):
+ """A punctilious package of well-known mathematical operators."""
+ _singleton = None
+ _singleton_initialized = None
+
+ def __init__(self):
+ if self.__class__._singleton_initialized is None:
+ path = 'data.representations'
+ resource = 'operators_1.yaml'
+ super().__init__(path=path, resource=resource)
+ self.__class__._singleton_initialized = True
+ _util.get_logger().debug(
+ f'Operators1Representations 1 singleton ({id(self)}) initialized.')
+
+ def __new__(cls, *args, **kwargs):
+ if cls._singleton is None:
+ cls._singleton = super(Operators1Representations, cls).__new__(cls)
+ return cls._singleton
diff --git a/tests/__pycache__/test_formula.cpython-312-pytest-8.3.2.pyc b/tests/__pycache__/test_formula.cpython-312-pytest-8.3.2.pyc
index 19d50fa2..cf4e12b5 100644
Binary files a/tests/__pycache__/test_formula.cpython-312-pytest-8.3.2.pyc and b/tests/__pycache__/test_formula.cpython-312-pytest-8.3.2.pyc differ
diff --git a/tests/__pycache__/test_shared_library.cpython-312-pytest-8.3.2.pyc b/tests/__pycache__/test_shared_library.cpython-312-pytest-8.3.2.pyc
index 9961a3f6..22ed9d60 100644
Binary files a/tests/__pycache__/test_shared_library.cpython-312-pytest-8.3.2.pyc and b/tests/__pycache__/test_shared_library.cpython-312-pytest-8.3.2.pyc differ
diff --git a/tests/test_formula.py b/tests/test_formula.py
index ef470236..df6d9603 100644
--- a/tests/test_formula.py
+++ b/tests/test_formula.py
@@ -11,15 +11,14 @@ def test_formula(self):
p = create_atomic_connector('P')
q = create_atomic_connector('Q')
r = create_atomic_connector('R')
- lnot = create_function('not')
- land = create_function('and')
- is_a_proposition = create_function('is-a-proposition')
+ land = pu.operators_1.conjunction
+ lnot = pu.operators_1.negation
phi1 = pu.Formula(p)
- assert str(phi1) == 'P()'
+ assert str(phi1) == 'P'
phi2 = pu.Formula(land, (p, q,))
- assert str(phi2) == 'and(P(), Q())'
+ assert str(phi2) == 'and(P, Q)'
phi3 = pu.Formula(lnot, (p,))
assert str(phi3) == 'not(P())'