这不仅仅是设计自己的算法,而是数学模型查找器的任务。对于这项任务,我特别推荐LADR 库的mace4
哪个部分。它专门针对这样的代数问题进行了调整。输入(让我们命名)看起来像:semigroups.in
formulas(sos).
(x * y) * z = x * (y * z).
end_of_list.
然后运行它mace4 -n 4 -N 4 -m 10000 <semigroup.in
(找到所有 4 元素模型并打印多达 10000 个)会产生一个长输出,例如
...
============================== MODEL =================================
interpretation( 4, [number=2331, seconds=0], [
function(*(_,_), [
1, 2, 3, 3,
2, 3, 3, 3,
3, 3, 3, 3,
3, 3, 3, 3 ])
]).
============================== end of model ==========================
============================== STATISTICS ============================
For domain size 4.
Current CPU time: 0.00 seconds (total CPU time: 0.11 seconds).
Ground clauses: seen=64, kept=64.
Selections=2132, assignments=8520, propagations=6194, current_models=2331.
Rewrite_terms=210696, rewrite_bools=65151, indexes=11452.
Rules_from_neg_clauses=586, cross_offs=3767.
============================== end of statistics =====================
User_CPU=0.11, System_CPU=0.26, Wall_clock=0.
Exiting with 2331 models.
如您所见,它非常快。
该库包含许多其他工具,例如isofilter
允许您过滤代数的同构变体等。