PHP program to parse 1st Order Predicate Calculus (FOL) Wffs
Budget: $25 – $100 USD
One function would translate from the readable string to an internal representation or an error type and the point at which it was encountered. Processing stops when any error is encountered.
Another function would be the inverse.
Simple PHP functions (no classes or libraries etc.) I use PHP 7.2.34
A table of the constant relations has the number of components of each constant relation and is passed to both functions.
Constant relation names contain lower and upper case letters, digits and underscores e.g. ADD_2
A relation with zero components can optionally omit the ().
P1, P2, P3, . . . and abbreviations P == P1, Q == P2, R == P3 are variable relations that can have any number of components, just be consistent within a wff.
Logical Operators:
~ = not (1 argument)
^ = and (2 arguments)
v = or (2 arguments)
Components are:
1. Quantified variables: A1, A2, A3, . . . and abbreviations A==A1, B==A2, C==A3
No variable can be quantified more than once within a wff.
2. Special variables type I: I1, I2, I3, . . . and abbreviations I==I1, J==I2, K==I3
3. Special variables type x: x1, x2, x3, . . and abbreviations x==x1, y==x2, z==x3
4. Special variables type a: a1, a2, a3, . . and abbreviations a==a1, b==a2, c==a3
5. Natural numbers: 0, 1, 2, 3, . . .
6. String literals containing letters, digits and underscores: “aAbC”, “A_B_cd”, “A1_B2” . . .
It cannot contain only digits e.g. “123” or “”.
References to quantified variable names that are not quantified to the left of that point are an error e.g. (eA)P(A,B)^(eB)Q(B,A).
Optional spaces can exist for clarity and are removed for parsing with their removal not changing the wff.
Example:
(aB)ZERO(B)v(eA)SUC(A,B)
(aA1)ZERO(A1)v(eA2)SUC(A2,A1)
~(eA)LT(A,0)
(eA) P(A) v ~(aB) ( LT(A,123) ^ (eC) ~Q(C,A) )
There must be profuse comments and a document explaining the code and variables in detail.
Also please comment on the possibility of a second project to transform a wff into all possible (up to a limited size) equivalent ones e.g. commutative, associative, DeMorgan's, double negation, quantifier definition.
There is no deadline but more than a month would require explanation.
Charlie
Another function would be the inverse.
Simple PHP functions (no classes or libraries etc.) I use PHP 7.2.34
A table of the constant relations has the number of components of each constant relation and is passed to both functions.
Constant relation names contain lower and upper case letters, digits and underscores e.g. ADD_2
A relation with zero components can optionally omit the ().
P1, P2, P3, . . . and abbreviations P == P1, Q == P2, R == P3 are variable relations that can have any number of components, just be consistent within a wff.
Logical Operators:
~ = not (1 argument)
^ = and (2 arguments)
v = or (2 arguments)
Components are:
1. Quantified variables: A1, A2, A3, . . . and abbreviations A==A1, B==A2, C==A3
No variable can be quantified more than once within a wff.
2. Special variables type I: I1, I2, I3, . . . and abbreviations I==I1, J==I2, K==I3
3. Special variables type x: x1, x2, x3, . . and abbreviations x==x1, y==x2, z==x3
4. Special variables type a: a1, a2, a3, . . and abbreviations a==a1, b==a2, c==a3
5. Natural numbers: 0, 1, 2, 3, . . .
6. String literals containing letters, digits and underscores: “aAbC”, “A_B_cd”, “A1_B2” . . .
It cannot contain only digits e.g. “123” or “”.
References to quantified variable names that are not quantified to the left of that point are an error e.g. (eA)P(A,B)^(eB)Q(B,A).
Optional spaces can exist for clarity and are removed for parsing with their removal not changing the wff.
Example:
(aB)ZERO(B)v(eA)SUC(A,B)
(aA1)ZERO(A1)v(eA2)SUC(A2,A1)
~(eA)LT(A,0)
(eA) P(A) v ~(aB) ( LT(A,123) ^ (eC) ~Q(C,A) )
There must be profuse comments and a document explaining the code and variables in detail.
Also please comment on the possibility of a second project to transform a wff into all possible (up to a limited size) equivalent ones e.g. commutative, associative, DeMorgan's, double negation, quantifier definition.
There is no deadline but more than a month would require explanation.
Charlie