rzach / multlog

M. Ultlog, the genius many-valued logic expert
https://logic.at/multlog
8 stars 1 forks source link

Improve isCong congruence testing #18

Open rzach opened 3 years ago

rzach commented 3 years ago

In ml_interactive, the predicate isCong will find all strong congruences of a logic. The way it does that is by listing all partitions of the designated and undesignated truth values and checking if such a partition is a congruence (all operators respect it).

a) I am not perfectly confident the implementation is correct and complete. So testing and inspection is needed.

b) Improve speed, especially the speed with which an optimal (smallest) solution is found: There are two places to look for improvements: cut down on the number of partitions tested (or test better candidates first), and speed up the testing of the individual partitions.

rzach commented 3 years ago

Better idea: generate partial congruences (i.e., partitions of just n truth values). If a partial partition fails the congruence test (e.g., a,b in same class but ~a, ~b not in same class) then no partition containing this partial partition can be a congruence, so if we fail on this partition, we cut off a large chunk of the search tree (larger, in any case, than just the single partition we eliminate if we naively enumerate every partition and test it). So start with small partitions, fail if it fails the congruence test, then add another element and construct all partial partitions also involving the new element (ie, new element can be a singleton class by itself or be added to any existing class).