|
20 | 20 | FroidurePinKEString, |
21 | 21 | FroidurePinKEWord, |
22 | 22 | FroidurePinTCE, |
| 23 | + PresentationStrings, |
| 24 | + PresentationWords, |
23 | 25 | ) |
24 | 26 |
|
25 | 27 | from libsemigroups_pybind11 import ( |
@@ -101,26 +103,32 @@ def check_cong_to_froidure_pin(Type, Word, **kwargs): |
101 | 103 |
|
102 | 104 | def check_cong_to_todd_coxeter(Type, Word, **kwargs): |
103 | 105 | thing = cong_from_sample_pres(Type, Word, **kwargs) |
104 | | - tc = to(congruence_kind.twosided, thing, Return=ToddCoxeter) |
| 106 | + tc = to(congruence_kind.twosided, thing, Return=(ToddCoxeter,)) |
105 | 107 | tc.run() |
106 | 108 | assert tc.number_of_classes() == 3 |
107 | 109 | return tc |
108 | 110 |
|
109 | 111 |
|
110 | | -def check_knuth_bendix_to_pres(Word, Rewriter): |
111 | | - p = sample_pres(Word) |
| 112 | +def check_knuth_bendix_to_pres(WordIn, WordOut, Rewriter): |
| 113 | + p = sample_pres(WordIn) |
112 | 114 | kb = KnuthBendix(congruence_kind.twosided, p, Rewriter=Rewriter) |
113 | | - q = to(kb, Return=Presentation) |
114 | | - |
115 | | - assert isinstance(q, type(p)) |
116 | | - |
117 | | - presentation.sort_each_rule(p) |
118 | | - presentation.sort_each_rule(q) |
119 | | - presentation.sort_rules(p) |
120 | | - presentation.sort_rules(q) |
121 | | - |
122 | | - # This is because sample_pres is already confluent |
123 | | - assert p == q |
| 115 | + q = to(kb, Return=(Presentation, WordOut)) |
| 116 | + |
| 117 | + if WordOut is str: |
| 118 | + assert isinstance(to_cxx(q), PresentationStrings) |
| 119 | + else: |
| 120 | + assert isinstance(to_cxx(q), PresentationWords) |
| 121 | + |
| 122 | + assert len(q.rules) == kb.number_of_active_rules() * 2 |
| 123 | + |
| 124 | + if WordIn is WordOut: |
| 125 | + assert q == to(kb, Return=(Presentation,)) |
| 126 | + presentation.sort_each_rule(p) |
| 127 | + presentation.sort_each_rule(q) |
| 128 | + presentation.sort_rules(p) |
| 129 | + presentation.sort_rules(q) |
| 130 | + # This is because sample_pres is already confluent |
| 131 | + assert p == q |
124 | 132 |
|
125 | 133 |
|
126 | 134 | def check_froidure_pin_to_pres(Word): |
|
0 commit comments