I have some dictionary e.g. of form:
my_dictionary = {'A': '¬(p)', 'B': '→(q, ∧(¬(p), ∨(y, z)))', 'Aim': ['p', '→(p, q)']}
Is their a simple way to replace all strings appearing in the dictionary values of form →(q, ∧(¬(p), ∨(y, z))) or →(p, q) by (q→(¬(p)∧(y∨z))) or (p→q)?
I found some solution by my own using some prolog:
Prolog-file (called "logic.pl") has to contain the following code:
Now we can define some function:
With that background its possible to normalize the dictionary very easy:
Output:
Only problem, for some reason I cant use ¬ instead of ~ with pyswip library (Version: 0.2.11), cause with ¬ I get the curios error:
whereby ¬ has unicode U+00AC ..