class CommutativeMatcher121782(CommutativeMatcher): _instance = None patterns = { 0: (0, Multiset({}), [(VariableWithCount('i2.2.1.0', 1, 1, None), Mul), (VariableWithCount('i2.3.1.0', 1, 1, S(1)), Mul)]), 1: (1, Multiset({0: 1}), [(VariableWithCount('i2.3.1.0', 1, 1, S(1)), Mul)]), 2: (2, Multiset({1: 1}), [(VariableWithCount('i2.3.1.0', 1, 1, S(1)), Mul)]), 3: (3, Multiset({}), [(VariableWithCount('i2.3.1.0', 1, 1, None), Mul), (VariableWithCount('i2.3.1.0_1', 1, 1, S(1)), Mul)]), 4: (4, Multiset({2: 1}), [(VariableWithCount('i2.3.1.0', 1, 1, S(1)), Mul)]), 5: (5, Multiset({3: 1}), [(VariableWithCount('i2.3.1.0', 1, 1, S(1)), Mul)]) } subjects = {} subjects_by_id = {} bipartite = BipartiteGraph() associative = Mul max_optional_count = 1 anonymous_patterns = set() def __init__(self): self.add_subject(None) @staticmethod def get(): if CommutativeMatcher121782._instance is None: CommutativeMatcher121782._instance = CommutativeMatcher121782() return CommutativeMatcher121782._instance @staticmethod def get_match_iter(subject): subjects = deque([subject]) if subject is not None else deque() subst0 = Substitution() # State 121781 if len(subjects) >= 1 and isinstance(subjects[0], Pow): tmp1 = subjects.popleft() subjects2 = deque(tmp1._args) # State 124561 if len(subjects2) >= 1: tmp3 = subjects2.popleft() subst1 = Substitution(subst0) try: subst1.try_add_variable('i2.3.1.1', tmp3) except ValueError: pass else: pass # State 124562 if len(subjects2) >= 1: tmp5 = subjects2.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.3.1.2', tmp5) except ValueError: pass else: pass # State 124563 if len(subjects2) == 0: pass # State 124564 if len(subjects) == 0: pass # 0: x**n yield 0, subst2 subjects2.appendleft(tmp5) subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.3.1.2', 1) except ValueError: pass else: pass # State 125493 if len(subjects2) == 0: pass # State 125494 if len(subjects) == 0: pass # 1: x**n yield 1, subst2 if len(subjects2) >= 1: tmp8 = subjects2.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.3.1.2', tmp8) except ValueError: pass else: pass # State 125493 if len(subjects2) == 0: pass # State 125494 if len(subjects) == 0: pass # 1: x**n yield 1, subst2 subjects2.appendleft(tmp8) subjects2.appendleft(tmp3) if len(subjects2) >= 1 and isinstance(subjects2[0], Add): tmp10 = subjects2.popleft() associative1 = tmp10 associative_type1 = type(tmp10) subjects11 = deque(tmp10._args) matcher = CommutativeMatcher137084.get() tmp12 = subjects11 subjects11 = [] for s in tmp12: matcher.add_subject(s) for pattern_index, subst1 in matcher.match(tmp12, subst0): pass if pattern_index == 0: pass # State 137090 if len(subjects2) >= 1: tmp13 = [] tmp13.append(subjects2.popleft()) while True: if len(tmp13) > 1: tmp14 = create_operation_expression( associative1, tmp13) elif len(tmp13) == 1: tmp14 = tmp13[0] else: assert False, "Unreachable" subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.3.1.2', tmp14) except ValueError: pass else: pass # State 137091 if len(subjects2) == 0: pass # State 137092 if len(subjects) == 0: pass # 3: (x*d + c)**n yield 3, subst2 if len(subjects2) == 0: break tmp13.append(subjects2.popleft()) subjects2.extendleft(reversed(tmp13)) subjects2.appendleft(tmp10) subjects.appendleft(tmp1) subst1 = Substitution(subst0) try: subst1.try_add_variable('i2.3.1.2', S(1)) except ValueError: pass else: pass # State 125491 if len(subjects) >= 1: tmp17 = subjects.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.3.1.1', tmp17) except ValueError: pass else: pass # State 125492 if len(subjects) == 0: pass # 1: x**n yield 1, subst2 subjects.appendleft(tmp17) if len(subjects) >= 1 and isinstance(subjects[0], log): tmp19 = subjects.popleft() subjects20 = deque(tmp19._args) # State 134195 subst1 = Substitution(subst0) try: subst1.try_add_variable('i2.3.1.2.0', S(1)) except ValueError: pass else: pass # State 134196 subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.3.1.2.2', S(1)) except ValueError: pass else: pass # State 134197 if len(subjects20) >= 1: tmp23 = subjects20.popleft() subst3 = Substitution(subst2) try: subst3.try_add_variable('i2.3.1.2.1', tmp23) except ValueError: pass else: pass # State 134198 if len(subjects20) == 0: pass # State 134199 if len(subjects) == 0: pass # 2: log(c*x**n) yield 2, subst3 subjects20.appendleft(tmp23) if len(subjects20) >= 1 and isinstance(subjects20[0], Pow): tmp25 = subjects20.popleft() subjects26 = deque(tmp25._args) # State 134200 if len(subjects26) >= 1: tmp27 = subjects26.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.3.1.2.1', tmp27) except ValueError: pass else: pass # State 134201 subst3 = Substitution(subst2) try: subst3.try_add_variable('i2.3.1.2.2', 1) except ValueError: pass else: pass # State 134202 if len(subjects26) == 0: pass # State 134203 if len(subjects20) == 0: pass # State 134204 if len(subjects) == 0: pass # 2: log(c*x**n) yield 2, subst3 if len(subjects26) >= 1: tmp30 = subjects26.popleft() subst3 = Substitution(subst2) try: subst3.try_add_variable( 'i2.3.1.2.2', tmp30) except ValueError: pass else: pass # State 134202 if len(subjects26) == 0: pass # State 134203 if len(subjects20) == 0: pass # State 134204 if len(subjects) == 0: pass # 2: log(c*x**n) yield 2, subst3 subjects26.appendleft(tmp30) subjects26.appendleft(tmp27) subjects20.appendleft(tmp25) if len(subjects20) >= 1 and isinstance(subjects20[0], Mul): tmp32 = subjects20.popleft() associative1 = tmp32 associative_type1 = type(tmp32) subjects33 = deque(tmp32._args) matcher = CommutativeMatcher134206.get() tmp34 = subjects33 subjects33 = [] for s in tmp34: matcher.add_subject(s) for pattern_index, subst1 in matcher.match(tmp34, subst0): pass if pattern_index == 0: pass # State 134213 if len(subjects20) == 0: pass # State 134214 if len(subjects) == 0: pass # 2: log(c*x**n) yield 2, subst1 subjects20.appendleft(tmp32) subjects.appendleft(tmp19) return yield
class CommutativeMatcher14154(CommutativeMatcher): _instance = None patterns = { 0: (0, Multiset({0: 1}), [ (VariableWithCount('i2.2.1.1.2.0', 1, 1, None), Add) ]) } subjects = {} subjects_by_id = {} bipartite = BipartiteGraph() associative = Add max_optional_count = 0 anonymous_patterns = set() def __init__(self): self.add_subject(None) @staticmethod def get(): if CommutativeMatcher14154._instance is None: CommutativeMatcher14154._instance = CommutativeMatcher14154() return CommutativeMatcher14154._instance @staticmethod def get_match_iter(subject): subjects = deque([subject]) if subject is not None else deque() subst0 = Substitution() # State 14153 subst1 = Substitution(subst0) try: subst1.try_add_variable('i2.2.1.1.2.1.0', S(1)) except ValueError: pass else: pass # State 14155 if len(subjects) >= 1 and isinstance(subjects[0], Pow): tmp2 = subjects.popleft() subjects3 = deque(tmp2._args) # State 14156 if len(subjects3) >= 1: tmp4 = subjects3.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.1.1.2.1.1', tmp4) except ValueError: pass else: pass # State 14157 if len(subjects3) >= 1 and subjects3[0] == Integer(2): tmp6 = subjects3.popleft() # State 14158 if len(subjects3) == 0: pass # State 14159 if len(subjects) == 0: pass # 0: d*x**2 yield 0, subst2 subjects3.appendleft(tmp6) subjects3.appendleft(tmp4) subjects.appendleft(tmp2) if len(subjects) >= 1 and isinstance(subjects[0], Mul): tmp7 = subjects.popleft() associative1 = tmp7 associative_type1 = type(tmp7) subjects8 = deque(tmp7._args) matcher = CommutativeMatcher14161.get() tmp9 = subjects8 subjects8 = [] for s in tmp9: matcher.add_subject(s) for pattern_index, subst1 in matcher.match(tmp9, subst0): pass if pattern_index == 0: pass # State 14166 if len(subjects) == 0: pass # 0: d*x**2 yield 0, subst1 subjects.appendleft(tmp7) return yield
class CommutativeMatcher33561(CommutativeMatcher): _instance = None patterns = { 0: (0, Multiset({0: 1}), [ (VariableWithCount('i2.2.1.2.2.2.1.0', 1, 1, None), Add) ]) } subjects = {} subjects_by_id = {} bipartite = BipartiteGraph() associative = Add max_optional_count = 0 anonymous_patterns = set() def __init__(self): self.add_subject(None) @staticmethod def get(): if CommutativeMatcher33561._instance is None: CommutativeMatcher33561._instance = CommutativeMatcher33561() return CommutativeMatcher33561._instance @staticmethod def get_match_iter(subject): subjects = deque([subject]) if subject is not None else deque() subst0 = Substitution() # State 33560 subst1 = Substitution(subst0) try: subst1.try_add_variable('i2.2.1.2.2.2.1.1.0', S(1)) except ValueError: pass else: pass # State 33562 subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.1.2.2.2.1.1.2', S(1)) except ValueError: pass else: pass # State 33563 if len(subjects) >= 1: tmp3 = subjects.popleft() subst3 = Substitution(subst2) try: subst3.try_add_variable('i2.2.1.2.2.2.1', tmp3) except ValueError: pass else: pass # State 33564 if len(subjects) == 0: pass # 0: e*x**r yield 0, subst3 subjects.appendleft(tmp3) if len(subjects) >= 1 and isinstance(subjects[0], Pow): tmp5 = subjects.popleft() subjects6 = deque(tmp5._args) # State 33565 if len(subjects6) >= 1: tmp7 = subjects6.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.1.2.2.2.1', tmp7) except ValueError: pass else: pass # State 33566 subst3 = Substitution(subst2) try: subst3.try_add_variable('i2.2.1.2.2.2.1.1.2', 1) except ValueError: pass else: pass # State 33567 if len(subjects6) == 0: pass # State 33568 if len(subjects) == 0: pass # 0: e*x**r yield 0, subst3 if len(subjects6) >= 1: tmp10 = subjects6.popleft() subst3 = Substitution(subst2) try: subst3.try_add_variable('i2.2.1.2.2.2.1.1.2', tmp10) except ValueError: pass else: pass # State 33567 if len(subjects6) == 0: pass # State 33568 if len(subjects) == 0: pass # 0: e*x**r yield 0, subst3 subjects6.appendleft(tmp10) subjects6.appendleft(tmp7) subjects.appendleft(tmp5) if len(subjects) >= 1 and isinstance(subjects[0], Mul): tmp12 = subjects.popleft() associative1 = tmp12 associative_type1 = type(tmp12) subjects13 = deque(tmp12._args) matcher = CommutativeMatcher33570.get() tmp14 = subjects13 subjects13 = [] for s in tmp14: matcher.add_subject(s) for pattern_index, subst1 in matcher.match(tmp14, subst0): pass if pattern_index == 0: pass # State 33577 if len(subjects) == 0: pass # 0: e*x**r yield 0, subst1 subjects.appendleft(tmp12) return yield
class CommutativeMatcher127509(CommutativeMatcher): _instance = None patterns = { 0: (0, Multiset({0: 1}), [(VariableWithCount('i2.2.1.2.0', 1, 1, S(0)), Add)]) } subjects = {} subjects_by_id = {} bipartite = BipartiteGraph() associative = Add max_optional_count = 1 anonymous_patterns = set() def __init__(self): self.add_subject(None) @staticmethod def get(): if CommutativeMatcher127509._instance is None: CommutativeMatcher127509._instance = CommutativeMatcher127509() return CommutativeMatcher127509._instance @staticmethod def get_match_iter(subject): subjects = deque([subject]) if subject is not None else deque() subst0 = Substitution() # State 127508 subst1 = Substitution(subst0) try: subst1.try_add_variable('i2.2.1.2.1.0', S(1)) except ValueError: pass else: pass # State 127510 if len(subjects) >= 1 and isinstance(subjects[0], Pow): tmp2 = subjects.popleft() subjects3 = deque(tmp2._args) # State 127511 if len(subjects3) >= 1: tmp4 = subjects3.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.1.2.1.1', tmp4) except ValueError: pass else: pass # State 127512 if len(subjects3) >= 1: tmp6 = subjects3.popleft() subst3 = Substitution(subst2) try: subst3.try_add_variable('i2.2.1.2.1.2', tmp6) except ValueError: pass else: pass # State 127513 if len(subjects3) == 0: pass # State 127514 if len(subjects) == 0: pass # 0: d*x**n yield 0, subst3 subjects3.appendleft(tmp6) subjects3.appendleft(tmp4) subjects.appendleft(tmp2) if len(subjects) >= 1 and isinstance(subjects[0], Mul): tmp8 = subjects.popleft() associative1 = tmp8 associative_type1 = type(tmp8) subjects9 = deque(tmp8._args) matcher = CommutativeMatcher127516.get() tmp10 = subjects9 subjects9 = [] for s in tmp10: matcher.add_subject(s) for pattern_index, subst1 in matcher.match(tmp10, subst0): pass if pattern_index == 0: pass # State 127521 if len(subjects) == 0: pass # 0: d*x**n yield 0, subst1 subjects.appendleft(tmp8) return yield
class CommutativeMatcher49710(CommutativeMatcher): _instance = None patterns = { 0: (0, Multiset({0: 1}), [(VariableWithCount('i2.1.1.2.2.1.0', 1, 1, S(1)), Mul)]), 1: (1, Multiset({1: 1}), [(VariableWithCount('i2.1.1.2.2.1.0', 1, 1, S(1)), Mul)]), 2: (2, Multiset({2: 1}), [(VariableWithCount('i2.1.1.2.2.1.0', 1, 1, S(1)), Mul)]) } subjects = {} subjects_by_id = {} bipartite = BipartiteGraph() associative = Mul max_optional_count = 1 anonymous_patterns = set() def __init__(self): self.add_subject(None) @staticmethod def get(): if CommutativeMatcher49710._instance is None: CommutativeMatcher49710._instance = CommutativeMatcher49710() return CommutativeMatcher49710._instance @staticmethod def get_match_iter(subject): subjects = deque([subject]) if subject is not None else deque() subst0 = Substitution() # State 49709 if len(subjects) >= 1 and isinstance(subjects[0], Pow): tmp1 = subjects.popleft() subjects2 = deque(tmp1._args) # State 49711 if len(subjects2) >= 1: tmp3 = subjects2.popleft() subst1 = Substitution(subst0) try: subst1.try_add_variable('i2.2.1.0', tmp3) except ValueError: pass else: pass # State 49712 if len(subjects2) >= 1: tmp5 = subjects2.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.1.1.2.2.1.2', tmp5) except ValueError: pass else: pass # State 49713 if len(subjects2) == 0: pass # State 49714 if len(subjects) == 0: pass # 0: x**n yield 0, subst2 subjects2.appendleft(tmp5) subjects2.appendleft(tmp3) if len(subjects2) >= 1: tmp7 = subjects2.popleft() subst1 = Substitution(subst0) try: subst1.try_add_variable('i2.3.1.0', tmp7) except ValueError: pass else: pass # State 50148 if len(subjects2) >= 1: tmp9 = subjects2.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.1.1.2.2.1.2', tmp9) except ValueError: pass else: pass # State 50149 if len(subjects2) == 0: pass # State 50150 if len(subjects) == 0: pass # 1: x**n yield 1, subst2 subjects2.appendleft(tmp9) subjects2.appendleft(tmp7) if len(subjects2) >= 1: tmp11 = subjects2.popleft() subst1 = Substitution(subst0) try: subst1.try_add_variable('i2.2.1.1', tmp11) except ValueError: pass else: pass # State 50474 if len(subjects2) >= 1 and subjects2[0] == Integer(2): tmp13 = subjects2.popleft() # State 50475 if len(subjects2) == 0: pass # State 50476 if len(subjects) == 0: pass # 2: x**2 yield 2, subst1 subjects2.appendleft(tmp13) subjects2.appendleft(tmp11) subjects.appendleft(tmp1) return yield
class CommutativeMatcher56271(CommutativeMatcher): _instance = None patterns = { 0: (0, Multiset({0: 1}), [(VariableWithCount('i2.2.0', 1, 1, S(0)), Add)]), 1: (1, Multiset({1: 1}), [(VariableWithCount('i2.2.0', 1, 1, S(0)), Add)]), 2: (2, Multiset({2: 1}), [(VariableWithCount('i2.2.1.2.0', 1, 1, S(0)), Add)]), 3: (3, Multiset({3: 1}), [(VariableWithCount('i2.2.0_1', 1, 1, S(0)), Add)]), 4: (4, Multiset({4: 1}), [(VariableWithCount('i2.2.0_1', 1, 1, S(0)), Add)]), 5: (5, Multiset({5: 1}), [(VariableWithCount('i2.2.0_3', 1, 1, S(0)), Add)]), 6: (6, Multiset({6: 1}), [(VariableWithCount('i2.2.0', 1, 1, None), Add)]), 7: (7, Multiset({6: 1}), [(VariableWithCount('i2.2.0', 1, 1, S(0)), Add)]), 8: (8, Multiset({7: 1}), [(VariableWithCount('i2.2.0_2', 1, 1, S(0)), Add)]), 9: (9, Multiset({8: 1}), [(VariableWithCount('i2.3.0', 1, 1, S(0)), Add)]), 10: (10, Multiset({ 9: 1, 10: 1 }), [(VariableWithCount('i2.2.0', 1, 1, S(0)), Add)]), 11: (11, Multiset({ 11: 1, 12: 1 }), [(VariableWithCount('i2.2.0_1', 1, 1, S(0)), Add)]), 12: (12, Multiset({13: 1}), [(VariableWithCount('i2.2.3.0', 1, 1, S(0)), Add)]), 13: (13, Multiset({14: 1}), [(VariableWithCount('i2.2.1.3.0', 1, 1, S(0)), Add)]), 14: (14, Multiset({15: 1}), [(VariableWithCount('i2.4.0', 1, 1, S(0)), Add)]), 15: (15, Multiset({16: 1}), [(VariableWithCount('i2.2.0_1', 1, 1, S(0)), Add)]), 16: (16, Multiset({17: 1}), [(VariableWithCount('i2.2.0', 1, 1, S(0)), Add)]), 17: (17, Multiset({18: 1}), [(VariableWithCount('i2.3.0', 1, 1, S(0)), Add)]), 18: (18, Multiset({19: 1}), [(VariableWithCount('i2.2.0', 1, 1, S(0)), Add)]), 19: (19, Multiset({20: 1}), [(VariableWithCount('i2.2.0', 1, 1, S(0)), Add)]) } subjects = {} subjects_by_id = {} bipartite = BipartiteGraph() associative = Add max_optional_count = 1 anonymous_patterns = set() def __init__(self): self.add_subject(None) @staticmethod def get(): if CommutativeMatcher56271._instance is None: CommutativeMatcher56271._instance = CommutativeMatcher56271() return CommutativeMatcher56271._instance @staticmethod def get_match_iter(subject): subjects = deque([subject]) if subject is not None else deque() subst0 = Substitution() # State 56270 subst1 = Substitution(subst0) try: subst1.try_add_variable('i2.2.1.0_1', S(1)) except ValueError: pass else: pass # State 56272 if len(subjects) >= 1: tmp2 = subjects.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.1.0', tmp2) except ValueError: pass else: pass # State 56273 if len(subjects) == 0: pass # 0: x*f yield 0, subst2 subjects.appendleft(tmp2) if len(subjects) >= 1: tmp4 = subjects.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.1.1', tmp4) except ValueError: pass else: pass # State 72420 if len(subjects) == 0: pass # 4: d*x yield 4, subst2 subjects.appendleft(tmp4) if len(subjects) >= 1: tmp6 = subjects.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.0', tmp6) except ValueError: pass else: pass # State 72471 if len(subjects) == 0: pass # 5: x*d yield 5, subst2 subjects.appendleft(tmp6) if len(subjects) >= 1: tmp8 = subjects.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.1.1.0', tmp8) except ValueError: pass else: pass # State 75715 if len(subjects) == 0: pass # 10: x*b yield 10, subst2 subjects.appendleft(tmp8) subst1 = Substitution(subst0) try: subst1.try_add_variable('i2.2.1.0', S(1)) except ValueError: pass else: pass # State 56308 if len(subjects) >= 1: tmp11 = subjects.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.1', tmp11) except ValueError: pass else: pass # State 56309 if len(subjects) == 0: pass # 1: x*b yield 1, subst2 subjects.appendleft(tmp11) if len(subjects) >= 1: tmp13 = subjects.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.2.1.0', tmp13) except ValueError: pass else: pass # State 101021 if len(subjects) == 0: pass # 16: b*x yield 16, subst2 subjects.appendleft(tmp13) if len(subjects) >= 1: tmp15 = subjects.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.3.1.0', tmp15) except ValueError: pass else: pass # State 101055 if len(subjects) == 0: pass # 17: b*x yield 17, subst2 subjects.appendleft(tmp15) if len(subjects) >= 1: tmp17 = subjects.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.3.1.1.0', tmp17) except ValueError: pass else: pass # State 103821 if len(subjects) == 0: pass # 19: e*x yield 19, subst2 subjects.appendleft(tmp17) if len(subjects) >= 1 and isinstance(subjects[0], Pow): tmp19 = subjects.popleft() subjects20 = deque(tmp19._args) # State 73604 if len(subjects20) >= 1: tmp21 = subjects20.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.1', tmp21) except ValueError: pass else: pass # State 73605 if len(subjects20) >= 1: tmp23 = subjects20.popleft() subst3 = Substitution(subst2) try: subst3.try_add_variable('i2.2.1.2', tmp23) except ValueError: pass else: pass # State 73606 if len(subjects20) == 0: pass # State 73607 if len(subjects) == 0: pass # 6: x**n*d yield 6, subst3 subjects20.appendleft(tmp23) subjects20.appendleft(tmp21) if len(subjects20) >= 1: tmp25 = subjects20.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.0', tmp25) except ValueError: pass else: pass # State 74558 if len(subjects20) >= 1: tmp27 = subjects20.popleft() subst3 = Substitution(subst2) try: subst3.try_add_variable('i2.2.1.2', tmp27) except ValueError: pass else: pass # State 74559 if len(subjects20) == 0: pass # State 74560 if len(subjects) == 0: pass # 7: x**n*b yield 7, subst3 subjects20.appendleft(tmp27) subjects20.appendleft(tmp25) if len(subjects20) >= 1: tmp29 = subjects20.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.1.1.0', tmp29) except ValueError: pass else: pass # State 75708 if len(subjects20) >= 1 and subjects20[0] == Integer( 2): tmp31 = subjects20.popleft() # State 75709 if len(subjects20) == 0: pass # State 75710 if len(subjects) == 0: pass # 9: x**2*c yield 9, subst2 subjects20.appendleft(tmp31) subjects20.appendleft(tmp29) subjects.appendleft(tmp19) if len(subjects) >= 1 and isinstance(subjects[0], log): tmp32 = subjects.popleft() subjects33 = deque(tmp32._args) # State 105391 subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.1.2.0', S(1)) except ValueError: pass else: pass # State 105392 subst3 = Substitution(subst2) try: subst3.try_add_variable('i2.2.1.2.2', S(1)) except ValueError: pass else: pass # State 105393 if len(subjects33) >= 1: tmp36 = subjects33.popleft() subst4 = Substitution(subst3) try: subst4.try_add_variable('i2.1', tmp36) except ValueError: pass else: pass # State 105394 if len(subjects33) == 0: pass # State 105395 if len(subjects) == 0: pass # 20: b*log(x**n*c) yield 20, subst4 subjects33.appendleft(tmp36) if len(subjects33) >= 1 and isinstance(subjects33[0], Pow): tmp38 = subjects33.popleft() subjects39 = deque(tmp38._args) # State 105396 if len(subjects39) >= 1: tmp40 = subjects39.popleft() subst3 = Substitution(subst2) try: subst3.try_add_variable('i2.1', tmp40) except ValueError: pass else: pass # State 105397 subst4 = Substitution(subst3) try: subst4.try_add_variable('i2.2.1.2.2', 1) except ValueError: pass else: pass # State 105398 if len(subjects39) == 0: pass # State 105399 if len(subjects33) == 0: pass # State 105400 if len(subjects) == 0: pass # 20: b*log(x**n*c) yield 20, subst4 if len(subjects39) >= 1: tmp43 = subjects39.popleft() subst4 = Substitution(subst3) try: subst4.try_add_variable( 'i2.2.1.2.2', tmp43) except ValueError: pass else: pass # State 105398 if len(subjects39) == 0: pass # State 105399 if len(subjects33) == 0: pass # State 105400 if len(subjects) == 0: pass # 20: b*log(x**n*c) yield 20, subst4 subjects39.appendleft(tmp43) subjects39.appendleft(tmp40) subjects33.appendleft(tmp38) if len(subjects33) >= 1 and isinstance(subjects33[0], Mul): tmp45 = subjects33.popleft() associative1 = tmp45 associative_type1 = type(tmp45) subjects46 = deque(tmp45._args) matcher = CommutativeMatcher105402.get() tmp47 = subjects46 subjects46 = [] for s in tmp47: matcher.add_subject(s) for pattern_index, subst2 in matcher.match(tmp47, subst1): pass if pattern_index == 0: pass # State 105409 if len(subjects33) == 0: pass # State 105410 if len(subjects) == 0: pass # 20: b*log(x**n*c) yield 20, subst2 subjects33.appendleft(tmp45) subjects.appendleft(tmp32) subst1 = Substitution(subst0) try: subst1.try_add_variable('i2.2.1.2.1.0_1', S(1)) except ValueError: pass else: pass # State 62185 if len(subjects) >= 1: tmp49 = subjects.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.1.2.1.0', tmp49) except ValueError: pass else: pass # State 62186 if len(subjects) == 0: pass # 2: x*d yield 2, subst2 subjects.appendleft(tmp49) subst1 = Substitution(subst0) try: subst1.try_add_variable('i2.2.1.0_2', S(1)) except ValueError: pass else: pass # State 71985 if len(subjects) >= 1: tmp52 = subjects.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.1.0', tmp52) except ValueError: pass else: pass # State 71986 if len(subjects) == 0: pass # 3: x*f yield 3, subst2 subjects.appendleft(tmp52) if len(subjects) >= 1 and isinstance(subjects[0], Pow): tmp54 = subjects.popleft() subjects55 = deque(tmp54._args) # State 75746 if len(subjects55) >= 1: tmp56 = subjects55.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.1.0', tmp56) except ValueError: pass else: pass # State 75747 if len(subjects55) >= 1 and subjects55[0] == Integer( 2): tmp58 = subjects55.popleft() # State 75748 if len(subjects55) == 0: pass # State 75749 if len(subjects) == 0: pass # 11: v**2*c yield 11, subst2 subjects55.appendleft(tmp58) subjects55.appendleft(tmp56) subjects.appendleft(tmp54) subst1 = Substitution(subst0) try: subst1.try_add_variable('i2.3.1.0', S(1)) except ValueError: pass else: pass # State 75606 subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.3.1.2', S(1)) except ValueError: pass else: pass # State 75607 if len(subjects) >= 1: tmp61 = subjects.popleft() subst3 = Substitution(subst2) try: subst3.try_add_variable('i2.3.1.1', tmp61) except ValueError: pass else: pass # State 75608 if len(subjects) == 0: pass # 8: b*x**n yield 8, subst3 subjects.appendleft(tmp61) if len(subjects) >= 1: tmp63 = subjects.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.1.0', tmp63) except ValueError: pass else: pass # State 103459 if len(subjects) == 0: pass # 18: x*f yield 18, subst2 subjects.appendleft(tmp63) if len(subjects) >= 1 and isinstance(subjects[0], Pow): tmp65 = subjects.popleft() subjects66 = deque(tmp65._args) # State 75609 if len(subjects66) >= 1: tmp67 = subjects66.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.3.1.1', tmp67) except ValueError: pass else: pass # State 75610 subst3 = Substitution(subst2) try: subst3.try_add_variable('i2.3.1.2', 1) except ValueError: pass else: pass # State 75611 if len(subjects66) == 0: pass # State 75612 if len(subjects) == 0: pass # 8: b*x**n yield 8, subst3 if len(subjects66) >= 1: tmp70 = subjects66.popleft() subst3 = Substitution(subst2) try: subst3.try_add_variable('i2.3.1.2', tmp70) except ValueError: pass else: pass # State 75611 if len(subjects66) == 0: pass # State 75612 if len(subjects) == 0: pass # 8: b*x**n yield 8, subst3 subjects66.appendleft(tmp70) subjects66.appendleft(tmp67) subjects.appendleft(tmp65) subst1 = Substitution(subst0) try: subst1.try_add_variable('i2.2.1.0_3', S(1)) except ValueError: pass else: pass # State 75754 if len(subjects) >= 1: tmp73 = subjects.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.1.0', tmp73) except ValueError: pass else: pass # State 75755 if len(subjects) == 0: pass # 12: x*b yield 12, subst2 subjects.appendleft(tmp73) subst1 = Substitution(subst0) try: subst1.try_add_variable('i2.2.3.1.0_1', S(1)) except ValueError: pass else: pass # State 76641 if len(subjects) >= 1: tmp76 = subjects.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.3.1.0', tmp76) except ValueError: pass else: pass # State 76642 if len(subjects) == 0: pass # 13: x*f yield 13, subst2 subjects.appendleft(tmp76) subst1 = Substitution(subst0) try: subst1.try_add_variable('i2.2.1.3.1.0_1', S(1)) except ValueError: pass else: pass # State 90725 if len(subjects) >= 1: tmp79 = subjects.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.1.3.1.0', tmp79) except ValueError: pass else: pass # State 90726 if len(subjects) == 0: pass # 14: x*f yield 14, subst2 subjects.appendleft(tmp79) subst1 = Substitution(subst0) try: subst1.try_add_variable('i2.4.1.0', S(1)) except ValueError: pass else: pass # State 99512 subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.4.1.2', S(1)) except ValueError: pass else: pass # State 99513 if len(subjects) >= 1: tmp83 = subjects.popleft() subst3 = Substitution(subst2) try: subst3.try_add_variable('i2.4.1.1', tmp83) except ValueError: pass else: pass # State 99514 if len(subjects) == 0: pass # 15: b*x**n yield 15, subst3 subjects.appendleft(tmp83) if len(subjects) >= 1 and isinstance(subjects[0], Pow): tmp85 = subjects.popleft() subjects86 = deque(tmp85._args) # State 99515 if len(subjects86) >= 1: tmp87 = subjects86.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.4.1.1', tmp87) except ValueError: pass else: pass # State 99516 subst3 = Substitution(subst2) try: subst3.try_add_variable('i2.4.1.2', 1) except ValueError: pass else: pass # State 99517 if len(subjects86) == 0: pass # State 99518 if len(subjects) == 0: pass # 15: b*x**n yield 15, subst3 if len(subjects86) >= 1: tmp90 = subjects86.popleft() subst3 = Substitution(subst2) try: subst3.try_add_variable('i2.4.1.2', tmp90) except ValueError: pass else: pass # State 99517 if len(subjects86) == 0: pass # State 99518 if len(subjects) == 0: pass # 15: b*x**n yield 15, subst3 subjects86.appendleft(tmp90) subjects86.appendleft(tmp87) subjects.appendleft(tmp85) if len(subjects) >= 1 and isinstance(subjects[0], Mul): tmp92 = subjects.popleft() associative1 = tmp92 associative_type1 = type(tmp92) subjects93 = deque(tmp92._args) matcher = CommutativeMatcher56275.get() tmp94 = subjects93 subjects93 = [] for s in tmp94: matcher.add_subject(s) for pattern_index, subst1 in matcher.match(tmp94, subst0): pass if pattern_index == 0: pass # State 56276 if len(subjects) == 0: pass # 0: x*f yield 0, subst1 if pattern_index == 1: pass # State 56310 if len(subjects) == 0: pass # 1: x*b yield 1, subst1 if pattern_index == 2: pass # State 62187 if len(subjects) == 0: pass # 2: x*d yield 2, subst1 if pattern_index == 3: pass # State 71987 if len(subjects) == 0: pass # 3: x*f yield 3, subst1 if pattern_index == 4: pass # State 72421 if len(subjects) == 0: pass # 4: d*x yield 4, subst1 if pattern_index == 5: pass # State 72472 if len(subjects) == 0: pass # 5: x*d yield 5, subst1 if pattern_index == 6: pass # State 73612 if len(subjects) == 0: pass # 6: x**n*d yield 6, subst1 if pattern_index == 7: pass # State 74564 if len(subjects) == 0: pass # 7: x**n*b yield 7, subst1 if pattern_index == 8: pass # State 75618 if len(subjects) == 0: pass # 8: b*x**n yield 8, subst1 if pattern_index == 9: pass # State 75714 if len(subjects) == 0: pass # 9: x**2*c yield 9, subst1 if pattern_index == 10: pass # State 75716 if len(subjects) == 0: pass # 10: x*b yield 10, subst1 if pattern_index == 11: pass # State 75753 if len(subjects) == 0: pass # 11: v**2*c yield 11, subst1 if pattern_index == 12: pass # State 75756 if len(subjects) == 0: pass # 12: x*b yield 12, subst1 if pattern_index == 13: pass # State 76643 if len(subjects) == 0: pass # 13: x*f yield 13, subst1 if pattern_index == 14: pass # State 90727 if len(subjects) == 0: pass # 14: x*f yield 14, subst1 if pattern_index == 15: pass # State 99524 if len(subjects) == 0: pass # 15: b*x**n yield 15, subst1 if pattern_index == 16: pass # State 101022 if len(subjects) == 0: pass # 16: b*x yield 16, subst1 if pattern_index == 17: pass # State 101056 if len(subjects) == 0: pass # 17: b*x yield 17, subst1 if pattern_index == 18: pass # State 103460 if len(subjects) == 0: pass # 18: x*f yield 18, subst1 if pattern_index == 19: pass # State 103822 if len(subjects) == 0: pass # 19: e*x yield 19, subst1 if pattern_index == 20: pass # State 105431 if len(subjects) == 0: pass # 20: b*log(x**n*c) yield 20, subst1 subjects.appendleft(tmp92) return yield
class CommutativeMatcher126049(CommutativeMatcher): _instance = None patterns = { 0: (0, Multiset({0: 1}), [ (VariableWithCount('i2.2.1.3.0', 1, 1, S(0)), Add) ]), 1: (1, Multiset({1: 1}), [ (VariableWithCount('i2.2.1.3.0', 1, 1, S(0)), Add) ]) } subjects = {} subjects_by_id = {} bipartite = BipartiteGraph() associative = Add max_optional_count = 1 anonymous_patterns = set() def __init__(self): self.add_subject(None) @staticmethod def get(): if CommutativeMatcher126049._instance is None: CommutativeMatcher126049._instance = CommutativeMatcher126049() return CommutativeMatcher126049._instance @staticmethod def get_match_iter(subject): subjects = deque([subject]) if subject is not None else deque() subst0 = Substitution() # State 126048 subst1 = Substitution(subst0) try: subst1.try_add_variable('i2.2.1.3.1.0_1', S(1)) except ValueError: pass else: pass # State 126050 if len(subjects) >= 1: tmp2 = subjects.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.1.3.1.0', tmp2) except ValueError: pass else: pass # State 126051 if len(subjects) == 0: pass # 0: x*f yield 0, subst2 subjects.appendleft(tmp2) subst1 = Substitution(subst0) try: subst1.try_add_variable('i2.2.1.3.1.0', S(1)) except ValueError: pass else: pass # State 127758 if len(subjects) >= 1 and isinstance(subjects[0], Pow): tmp5 = subjects.popleft() subjects6 = deque(tmp5._args) # State 127759 if len(subjects6) >= 1: tmp7 = subjects6.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.1.3.1.1', tmp7) except ValueError: pass else: pass # State 127760 if len(subjects6) >= 1: tmp9 = subjects6.popleft() subst3 = Substitution(subst2) try: subst3.try_add_variable('i2.2.1.3.1.2', tmp9) except ValueError: pass else: pass # State 127761 if len(subjects6) == 0: pass # State 127762 if len(subjects) == 0: pass # 1: d*x**n yield 1, subst3 subjects6.appendleft(tmp9) subjects6.appendleft(tmp7) subjects.appendleft(tmp5) if len(subjects) >= 1 and isinstance(subjects[0], Mul): tmp11 = subjects.popleft() associative1 = tmp11 associative_type1 = type(tmp11) subjects12 = deque(tmp11._args) matcher = CommutativeMatcher126053.get() tmp13 = subjects12 subjects12 = [] for s in tmp13: matcher.add_subject(s) for pattern_index, subst1 in matcher.match(tmp13, subst0): pass if pattern_index == 0: pass # State 126054 if len(subjects) == 0: pass # 0: x*f yield 0, subst1 if pattern_index == 1: pass # State 127767 if len(subjects) == 0: pass # 1: d*x**n yield 1, subst1 subjects.appendleft(tmp11) return yield
class CommutativeMatcher56993(CommutativeMatcher): _instance = None patterns = { 0: (0, Multiset({0: 1}), [(VariableWithCount('i2.2.2.0', 1, 1, S(0)), Add)]), 1: (1, Multiset({1: 1}), [(VariableWithCount('i2.4.0', 1, 1, S(0)), Add)]) } subjects = {} subjects_by_id = {} bipartite = BipartiteGraph() associative = Add max_optional_count = 1 anonymous_patterns = set() def __init__(self): self.add_subject(None) @staticmethod def get(): if CommutativeMatcher56993._instance is None: CommutativeMatcher56993._instance = CommutativeMatcher56993() return CommutativeMatcher56993._instance @staticmethod def get_match_iter(subject): subjects = deque([subject]) if subject is not None else deque() subst0 = Substitution() # State 56992 subst1 = Substitution(subst0) try: subst1.try_add_variable('i2.2.2.1.0_1', S(1)) except ValueError: pass else: pass # State 56994 if len(subjects) >= 1: tmp2 = subjects.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.2.1.0', tmp2) except ValueError: pass else: pass # State 56995 if len(subjects) == 0: pass # 0: x*f yield 0, subst2 subjects.appendleft(tmp2) subst1 = Substitution(subst0) try: subst1.try_add_variable('i2.4.1.0_1', S(1)) except ValueError: pass else: pass # State 76153 if len(subjects) >= 1: tmp5 = subjects.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.4.1.0', tmp5) except ValueError: pass else: pass # State 76154 if len(subjects) == 0: pass # 1: x*f yield 1, subst2 subjects.appendleft(tmp5) if len(subjects) >= 1 and isinstance(subjects[0], Mul): tmp7 = subjects.popleft() associative1 = tmp7 associative_type1 = type(tmp7) subjects8 = deque(tmp7._args) matcher = CommutativeMatcher56997.get() tmp9 = subjects8 subjects8 = [] for s in tmp9: matcher.add_subject(s) for pattern_index, subst1 in matcher.match(tmp9, subst0): pass if pattern_index == 0: pass # State 56998 if len(subjects) == 0: pass # 0: x*f yield 0, subst1 if pattern_index == 1: pass # State 76155 if len(subjects) == 0: pass # 1: x*f yield 1, subst1 subjects.appendleft(tmp7) return yield
class CommutativeMatcher120321(CommutativeMatcher): _instance = None patterns = { 0: (0, Multiset({0: 1}), [(VariableWithCount('i2.3.0', 1, 1, S(1)), Mul)]) } subjects = {} subjects_by_id = {} bipartite = BipartiteGraph() associative = Mul max_optional_count = 1 anonymous_patterns = set() def __init__(self): self.add_subject(None) @staticmethod def get(): if CommutativeMatcher120321._instance is None: CommutativeMatcher120321._instance = CommutativeMatcher120321() return CommutativeMatcher120321._instance @staticmethod def get_match_iter(subject): subjects = deque([subject]) if subject is not None else deque() subst0 = Substitution() # State 120320 if len(subjects) >= 1 and isinstance(subjects[0], Pow): tmp1 = subjects.popleft() subjects2 = deque(tmp1._args) # State 120322 subst1 = Substitution(subst0) try: subst1.try_add_variable('i2.3.2.0', S(0)) except ValueError: pass else: pass # State 120323 subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.3.2.1.0', S(1)) except ValueError: pass else: pass # State 120324 subst3 = Substitution(subst2) try: subst3.try_add_variable('i2.3.2.1.2', S(1)) except ValueError: pass else: pass # State 120325 if len(subjects2) >= 1: tmp6 = subjects2.popleft() subst4 = Substitution(subst3) try: subst4.try_add_variable('i2.3.2.1.1', tmp6) except ValueError: pass else: pass # State 120326 if len(subjects2 ) >= 1 and subjects2[0] == Integer(-1): tmp8 = subjects2.popleft() # State 120327 if len(subjects2) == 0: pass # State 120328 if len(subjects) == 0: pass # 0: 1/(a + b*x**n) /; (cons_f2) and (cons_f3) and (cons_f8) and (cons_f4) and (cons_f19) and (cons_f1768) yield 0, subst4 subjects2.appendleft(tmp8) subjects2.appendleft(tmp6) if len(subjects2) >= 1 and isinstance(subjects2[0], Pow): tmp9 = subjects2.popleft() subjects10 = deque(tmp9._args) # State 120329 if len(subjects10) >= 1: tmp11 = subjects10.popleft() subst3 = Substitution(subst2) try: subst3.try_add_variable('i2.3.2.1.1', tmp11) except ValueError: pass else: pass # State 120330 subst4 = Substitution(subst3) try: subst4.try_add_variable('i2.3.2.1.2', 1) except ValueError: pass else: pass # State 120331 if len(subjects10) == 0: pass # State 120332 if len(subjects2) >= 1 and subjects2[ 0] == Integer(-1): tmp14 = subjects2.popleft() # State 120333 if len(subjects2) == 0: pass # State 120334 if len(subjects) == 0: pass # 0: 1/(a + b*x**n) /; (cons_f2) and (cons_f3) and (cons_f8) and (cons_f4) and (cons_f19) and (cons_f1768) yield 0, subst4 subjects2.appendleft(tmp14) if len(subjects10) >= 1: tmp15 = subjects10.popleft() subst4 = Substitution(subst3) try: subst4.try_add_variable( 'i2.3.2.1.2', tmp15) except ValueError: pass else: pass # State 120331 if len(subjects10) == 0: pass # State 120332 if len(subjects2 ) >= 1 and subjects2[ 0] == Integer(-1): tmp17 = subjects2.popleft() # State 120333 if len(subjects2) == 0: pass # State 120334 if len(subjects) == 0: pass # 0: 1/(a + b*x**n) /; (cons_f2) and (cons_f3) and (cons_f8) and (cons_f4) and (cons_f19) and (cons_f1768) yield 0, subst4 subjects2.appendleft(tmp17) subjects10.appendleft(tmp15) subjects10.appendleft(tmp11) subjects2.appendleft(tmp9) if len(subjects2) >= 1 and isinstance(subjects2[0], Mul): tmp18 = subjects2.popleft() associative1 = tmp18 associative_type1 = type(tmp18) subjects19 = deque(tmp18._args) matcher = CommutativeMatcher120336.get() tmp20 = subjects19 subjects19 = [] for s in tmp20: matcher.add_subject(s) for pattern_index, subst2 in matcher.match(tmp20, subst1): pass if pattern_index == 0: pass # State 120343 if len(subjects2) >= 1 and subjects2[0] == Integer( -1): tmp21 = subjects2.popleft() # State 120344 if len(subjects2) == 0: pass # State 120345 if len(subjects) == 0: pass # 0: 1/(a + b*x**n) /; (cons_f2) and (cons_f3) and (cons_f8) and (cons_f4) and (cons_f19) and (cons_f1768) yield 0, subst2 subjects2.appendleft(tmp21) subjects2.appendleft(tmp18) if len(subjects2) >= 1 and isinstance(subjects2[0], Add): tmp22 = subjects2.popleft() associative1 = tmp22 associative_type1 = type(tmp22) subjects23 = deque(tmp22._args) matcher = CommutativeMatcher120347.get() tmp24 = subjects23 subjects23 = [] for s in tmp24: matcher.add_subject(s) for pattern_index, subst1 in matcher.match(tmp24, subst0): pass if pattern_index == 0: pass # State 120364 if len(subjects2) >= 1 and subjects2[0] == Integer(-1): tmp25 = subjects2.popleft() # State 120365 if len(subjects2) == 0: pass # State 120366 if len(subjects) == 0: pass # 0: 1/(a + b*x**n) /; (cons_f2) and (cons_f3) and (cons_f8) and (cons_f4) and (cons_f19) and (cons_f1768) yield 0, subst1 subjects2.appendleft(tmp25) subjects2.appendleft(tmp22) subjects.appendleft(tmp1) return yield
class CommutativeMatcher23213(CommutativeMatcher): _instance = None patterns = { 0: (0, Multiset({0: 1}), [(VariableWithCount('i2.2.1.2.2.0', 1, 1, S(1)), Mul)]), 1: (1, Multiset({1: 1}), [(VariableWithCount('i2.2.1.2.2.0', 1, 1, S(1)), Mul)]), 2: (2, Multiset({2: 1}), [(VariableWithCount('i2.2.1.2.2.0', 1, 1, S(1)), Mul)]), 3: (3, Multiset({3: 1}), [(VariableWithCount('i2.2.1.2.2.0', 1, 1, S(1)), Mul)]), 4: (4, Multiset({4: 1}), [(VariableWithCount('i2.2.1.2.2.0', 1, 1, S(1)), Mul)]), 5: (5, Multiset({5: 1}), [(VariableWithCount('i2.2.1.2.2.0', 1, 1, S(1)), Mul)]), 6: (6, Multiset({6: 1}), [(VariableWithCount('i2.2.1.2.2.0', 1, 1, S(1)), Mul)]) } subjects = {} subjects_by_id = {} bipartite = BipartiteGraph() associative = Mul max_optional_count = 1 anonymous_patterns = set() def __init__(self): self.add_subject(None) @staticmethod def get(): if CommutativeMatcher23213._instance is None: CommutativeMatcher23213._instance = CommutativeMatcher23213() return CommutativeMatcher23213._instance @staticmethod def get_match_iter(subject): subjects = deque([subject]) if subject is not None else deque() subst0 = Substitution() # State 23212 subst1 = Substitution(subst0) try: subst1.try_add_variable('i2.2.1.2.2.2', S(1)) except ValueError: pass else: pass # State 23214 subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.1.2.2.2.0', S(0)) except ValueError: pass else: pass # State 23215 subst3 = Substitution(subst2) try: subst3.try_add_variable('i2.2.1.2.2.2.1.0_1', S(1)) except ValueError: pass else: pass # State 23216 if len(subjects) >= 1: tmp4 = subjects.popleft() subst4 = Substitution(subst3) try: subst4.try_add_variable('i2.2.1.2.2.2.1.0', tmp4) except ValueError: pass else: pass # State 23217 if len(subjects) == 0: pass # 0: (e + x*f)**p yield 0, subst4 subjects.appendleft(tmp4) subst3 = Substitution(subst2) try: subst3.try_add_variable('i2.2.1.2.2.2.1.0', S(1)) except ValueError: pass else: pass # State 34520 if len(subjects) >= 1 and isinstance(subjects[0], Pow): tmp7 = subjects.popleft() subjects8 = deque(tmp7._args) # State 34521 if len(subjects8) >= 1: tmp9 = subjects8.popleft() subst4 = Substitution(subst3) try: subst4.try_add_variable( 'i2.2.1.2.2.2.1.1', tmp9) except ValueError: pass else: pass # State 34522 if len(subjects8) >= 1: tmp11 = subjects8.popleft() subst5 = Substitution(subst4) try: subst5.try_add_variable( 'i2.2.1.2.2.2.1.2', tmp11) except ValueError: pass else: pass # State 34523 if len(subjects8) == 0: pass # State 34524 if len(subjects) == 0: pass # 4: (e + f*x**m)**p yield 4, subst5 subjects8.appendleft(tmp11) subjects8.appendleft(tmp9) subjects.appendleft(tmp7) if len(subjects) >= 1 and isinstance(subjects[0], Mul): tmp13 = subjects.popleft() associative1 = tmp13 associative_type1 = type(tmp13) subjects14 = deque(tmp13._args) matcher = CommutativeMatcher23219.get() tmp15 = subjects14 subjects14 = [] for s in tmp15: matcher.add_subject(s) for pattern_index, subst3 in matcher.match(tmp15, subst2): pass if pattern_index == 0: pass # State 23220 if len(subjects) == 0: pass # 0: (e + x*f)**p yield 0, subst3 if pattern_index == 1: pass # State 34529 if len(subjects) == 0: pass # 4: (e + f*x**m)**p yield 4, subst3 subjects.appendleft(tmp13) if len(subjects) >= 1: tmp16 = subjects.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.1.2.2.1', tmp16) except ValueError: pass else: pass # State 45531 if len(subjects) == 0: pass # 6: v**p yield 6, subst2 subjects.appendleft(tmp16) if len(subjects) >= 1 and isinstance(subjects[0], Add): tmp18 = subjects.popleft() associative1 = tmp18 associative_type1 = type(tmp18) subjects19 = deque(tmp18._args) matcher = CommutativeMatcher23222.get() tmp20 = subjects19 subjects19 = [] for s in tmp20: matcher.add_subject(s) for pattern_index, subst2 in matcher.match(tmp20, subst1): pass if pattern_index == 0: pass # State 23228 if len(subjects) == 0: pass # 0: (e + x*f)**p yield 0, subst2 if pattern_index == 1: pass # State 28930 if len(subjects) == 0: pass # 2: (e + f*x**m)**p yield 2, subst2 if pattern_index == 2: pass # State 34530 if len(subjects) == 0: pass # 4: (e + f*x**m)**p yield 4, subst2 if pattern_index == 3: pass # State 44004 if len(subjects) == 0: pass # 5: (e + f*x + g*x**2)**p yield 5, subst2 subjects.appendleft(tmp18) if len(subjects) >= 1 and isinstance(subjects[0], Mul): tmp21 = subjects.popleft() associative1 = tmp21 associative_type1 = type(tmp21) subjects22 = deque(tmp21._args) matcher = CommutativeMatcher31369.get() tmp23 = subjects22 subjects22 = [] for s in tmp23: matcher.add_subject(s) for pattern_index, subst2 in matcher.match(tmp23, subst1): pass if pattern_index == 0: pass # State 31393 if len(subjects) == 0: pass # 3: (x**m*(f + e*x**r))**p yield 3, subst2 subjects.appendleft(tmp21) if len(subjects) >= 1 and isinstance(subjects[0], Pow): tmp24 = subjects.popleft() subjects25 = deque(tmp24._args) # State 23229 subst1 = Substitution(subst0) try: subst1.try_add_variable('i2.2.1.2.2.2.0', S(0)) except ValueError: pass else: pass # State 23230 subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.1.2.2.2.1.0_1', S(1)) except ValueError: pass else: pass # State 23231 if len(subjects25) >= 1: tmp28 = subjects25.popleft() subst3 = Substitution(subst2) try: subst3.try_add_variable('i2.2.1.2.2.2.1.0', tmp28) except ValueError: pass else: pass # State 23232 subst4 = Substitution(subst3) try: subst4.try_add_variable('i2.2.1.2.2.2', 1) except ValueError: pass else: pass # State 23233 if len(subjects25) == 0: pass # State 23234 if len(subjects) == 0: pass # 0: (e + x*f)**p yield 0, subst4 if len(subjects25) >= 1: tmp31 = subjects25.popleft() subst4 = Substitution(subst3) try: subst4.try_add_variable( 'i2.2.1.2.2.2', tmp31) except ValueError: pass else: pass # State 23233 if len(subjects25) == 0: pass # State 23234 if len(subjects) == 0: pass # 0: (e + x*f)**p yield 0, subst4 subjects25.appendleft(tmp31) subjects25.appendleft(tmp28) subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.1.2.2.2.1.0', S(1)) except ValueError: pass else: pass # State 34531 if len(subjects25) >= 1 and isinstance(subjects25[0], Pow): tmp34 = subjects25.popleft() subjects35 = deque(tmp34._args) # State 34532 if len(subjects35) >= 1: tmp36 = subjects35.popleft() subst3 = Substitution(subst2) try: subst3.try_add_variable( 'i2.2.1.2.2.2.1.1', tmp36) except ValueError: pass else: pass # State 34533 if len(subjects35) >= 1: tmp38 = subjects35.popleft() subst4 = Substitution(subst3) try: subst4.try_add_variable( 'i2.2.1.2.2.2.1.2', tmp38) except ValueError: pass else: pass # State 34534 if len(subjects35) == 0: pass # State 34535 subst5 = Substitution(subst4) try: subst5.try_add_variable( 'i2.2.1.2.2.2', 1) except ValueError: pass else: pass # State 34536 if len(subjects25) == 0: pass # State 34537 if len(subjects) == 0: pass # 4: (e + f*x**m)**p yield 4, subst5 if len(subjects25) >= 1: tmp41 = subjects25.popleft() subst5 = Substitution(subst4) try: subst5.try_add_variable( 'i2.2.1.2.2.2', tmp41) except ValueError: pass else: pass # State 34536 if len(subjects25) == 0: pass # State 34537 if len(subjects) == 0: pass # 4: (e + f*x**m)**p yield 4, subst5 subjects25.appendleft(tmp41) subjects35.appendleft(tmp38) subjects35.appendleft(tmp36) subjects25.appendleft(tmp34) if len(subjects25) >= 1 and isinstance(subjects25[0], Mul): tmp43 = subjects25.popleft() associative1 = tmp43 associative_type1 = type(tmp43) subjects44 = deque(tmp43._args) matcher = CommutativeMatcher23236.get() tmp45 = subjects44 subjects44 = [] for s in tmp45: matcher.add_subject(s) for pattern_index, subst2 in matcher.match(tmp45, subst1): pass if pattern_index == 0: pass # State 23237 subst3 = Substitution(subst2) try: subst3.try_add_variable('i2.2.1.2.2.2', 1) except ValueError: pass else: pass # State 23238 if len(subjects25) == 0: pass # State 23239 if len(subjects) == 0: pass # 0: (e + x*f)**p yield 0, subst3 if len(subjects25) >= 1: tmp47 = [] tmp47.append(subjects25.popleft()) while True: if len(tmp47) > 1: tmp48 = create_operation_expression( associative1, tmp47) elif len(tmp47) == 1: tmp48 = tmp47[0] else: assert False, "Unreachable" subst3 = Substitution(subst2) try: subst3.try_add_variable( 'i2.2.1.2.2.2', tmp48) except ValueError: pass else: pass # State 23238 if len(subjects25) == 0: pass # State 23239 if len(subjects) == 0: pass # 0: (e + x*f)**p yield 0, subst3 if len(subjects25) == 0: break tmp47.append(subjects25.popleft()) subjects25.extendleft(reversed(tmp47)) if pattern_index == 1: pass # State 34542 subst3 = Substitution(subst2) try: subst3.try_add_variable('i2.2.1.2.2.2', 1) except ValueError: pass else: pass # State 34543 if len(subjects25) == 0: pass # State 34544 if len(subjects) == 0: pass # 4: (e + f*x**m)**p yield 4, subst3 if len(subjects25) >= 1: tmp51 = [] tmp51.append(subjects25.popleft()) while True: if len(tmp51) > 1: tmp52 = create_operation_expression( associative1, tmp51) elif len(tmp51) == 1: tmp52 = tmp51[0] else: assert False, "Unreachable" subst3 = Substitution(subst2) try: subst3.try_add_variable( 'i2.2.1.2.2.2', tmp52) except ValueError: pass else: pass # State 34543 if len(subjects25) == 0: pass # State 34544 if len(subjects) == 0: pass # 4: (e + f*x**m)**p yield 4, subst3 if len(subjects25) == 0: break tmp51.append(subjects25.popleft()) subjects25.extendleft(reversed(tmp51)) subjects25.appendleft(tmp43) if len(subjects25) >= 1: tmp54 = subjects25.popleft() subst1 = Substitution(subst0) try: subst1.try_add_variable('i2.2.1.2.2.1', tmp54) except ValueError: pass else: pass # State 25607 if len(subjects25) >= 1: tmp56 = subjects25.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.1.2.2.2', tmp56) except ValueError: pass else: pass # State 25608 if len(subjects25) == 0: pass # State 25609 if len(subjects) == 0: pass # 1: v**p yield 1, subst2 subjects25.appendleft(tmp56) subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.1.2.2.2', 1) except ValueError: pass else: pass # State 45532 if len(subjects25) == 0: pass # State 45533 if len(subjects) == 0: pass # 6: v**p yield 6, subst2 if len(subjects25) >= 1: tmp59 = subjects25.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.1.2.2.2', tmp59) except ValueError: pass else: pass # State 45532 if len(subjects25) == 0: pass # State 45533 if len(subjects) == 0: pass # 6: v**p yield 6, subst2 subjects25.appendleft(tmp59) subjects25.appendleft(tmp54) if len(subjects25) >= 1 and isinstance(subjects25[0], Add): tmp61 = subjects25.popleft() associative1 = tmp61 associative_type1 = type(tmp61) subjects62 = deque(tmp61._args) matcher = CommutativeMatcher23241.get() tmp63 = subjects62 subjects62 = [] for s in tmp63: matcher.add_subject(s) for pattern_index, subst1 in matcher.match(tmp63, subst0): pass if pattern_index == 0: pass # State 23247 subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.1.2.2.2', 1) except ValueError: pass else: pass # State 23248 if len(subjects25) == 0: pass # State 23249 if len(subjects) == 0: pass # 0: (e + x*f)**p yield 0, subst2 if len(subjects25) >= 1: tmp65 = [] tmp65.append(subjects25.popleft()) while True: if len(tmp65) > 1: tmp66 = create_operation_expression( associative1, tmp65) elif len(tmp65) == 1: tmp66 = tmp65[0] else: assert False, "Unreachable" subst2 = Substitution(subst1) try: subst2.try_add_variable( 'i2.2.1.2.2.2', tmp66) except ValueError: pass else: pass # State 23248 if len(subjects25) == 0: pass # State 23249 if len(subjects) == 0: pass # 0: (e + x*f)**p yield 0, subst2 if len(subjects25) == 0: break tmp65.append(subjects25.popleft()) subjects25.extendleft(reversed(tmp65)) if pattern_index == 1: pass # State 28941 subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.1.2.2.2', 1) except ValueError: pass else: pass # State 28942 if len(subjects25) == 0: pass # State 28943 if len(subjects) == 0: pass # 2: (e + f*x**m)**p yield 2, subst2 if len(subjects25) >= 1: tmp69 = [] tmp69.append(subjects25.popleft()) while True: if len(tmp69) > 1: tmp70 = create_operation_expression( associative1, tmp69) elif len(tmp69) == 1: tmp70 = tmp69[0] else: assert False, "Unreachable" subst2 = Substitution(subst1) try: subst2.try_add_variable( 'i2.2.1.2.2.2', tmp70) except ValueError: pass else: pass # State 28942 if len(subjects25) == 0: pass # State 28943 if len(subjects) == 0: pass # 2: (e + f*x**m)**p yield 2, subst2 if len(subjects25) == 0: break tmp69.append(subjects25.popleft()) subjects25.extendleft(reversed(tmp69)) if pattern_index == 2: pass # State 34545 subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.1.2.2.2', 1) except ValueError: pass else: pass # State 34546 if len(subjects25) == 0: pass # State 34547 if len(subjects) == 0: pass # 4: (e + f*x**m)**p yield 4, subst2 if len(subjects25) >= 1: tmp73 = [] tmp73.append(subjects25.popleft()) while True: if len(tmp73) > 1: tmp74 = create_operation_expression( associative1, tmp73) elif len(tmp73) == 1: tmp74 = tmp73[0] else: assert False, "Unreachable" subst2 = Substitution(subst1) try: subst2.try_add_variable( 'i2.2.1.2.2.2', tmp74) except ValueError: pass else: pass # State 34546 if len(subjects25) == 0: pass # State 34547 if len(subjects) == 0: pass # 4: (e + f*x**m)**p yield 4, subst2 if len(subjects25) == 0: break tmp73.append(subjects25.popleft()) subjects25.extendleft(reversed(tmp73)) if pattern_index == 3: pass # State 44012 subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.1.2.2.2', 1) except ValueError: pass else: pass # State 44013 if len(subjects25) == 0: pass # State 44014 if len(subjects) == 0: pass # 5: (e + f*x + g*x**2)**p yield 5, subst2 if len(subjects25) >= 1: tmp77 = [] tmp77.append(subjects25.popleft()) while True: if len(tmp77) > 1: tmp78 = create_operation_expression( associative1, tmp77) elif len(tmp77) == 1: tmp78 = tmp77[0] else: assert False, "Unreachable" subst2 = Substitution(subst1) try: subst2.try_add_variable( 'i2.2.1.2.2.2', tmp78) except ValueError: pass else: pass # State 44013 if len(subjects25) == 0: pass # State 44014 if len(subjects) == 0: pass # 5: (e + f*x + g*x**2)**p yield 5, subst2 if len(subjects25) == 0: break tmp77.append(subjects25.popleft()) subjects25.extendleft(reversed(tmp77)) subjects25.appendleft(tmp61) if len(subjects25) >= 1 and isinstance(subjects25[0], Mul): tmp80 = subjects25.popleft() associative1 = tmp80 associative_type1 = type(tmp80) subjects81 = deque(tmp80._args) matcher = CommutativeMatcher31395.get() tmp82 = subjects81 subjects81 = [] for s in tmp82: matcher.add_subject(s) for pattern_index, subst1 in matcher.match(tmp82, subst0): pass if pattern_index == 0: pass # State 31419 subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.1.2.2.2', 1) except ValueError: pass else: pass # State 31420 if len(subjects25) == 0: pass # State 31421 if len(subjects) == 0: pass # 3: (x**m*(f + e*x**r))**p yield 3, subst2 if len(subjects25) >= 1: tmp84 = [] tmp84.append(subjects25.popleft()) while True: if len(tmp84) > 1: tmp85 = create_operation_expression( associative1, tmp84) elif len(tmp84) == 1: tmp85 = tmp84[0] else: assert False, "Unreachable" subst2 = Substitution(subst1) try: subst2.try_add_variable( 'i2.2.1.2.2.2', tmp85) except ValueError: pass else: pass # State 31420 if len(subjects25) == 0: pass # State 31421 if len(subjects) == 0: pass # 3: (x**m*(f + e*x**r))**p yield 3, subst2 if len(subjects25) == 0: break tmp84.append(subjects25.popleft()) subjects25.extendleft(reversed(tmp84)) subjects25.appendleft(tmp80) subjects.appendleft(tmp24) return yield
class CommutativeMatcher17761(CommutativeMatcher): _instance = None patterns = { 0: (0, Multiset({0: 1}), [(VariableWithCount('i2.3.0', 1, 1, S(1)), Mul)]), 1: (1, Multiset({1: 1}), [(VariableWithCount('i2.2.1.3.0', 1, 1, S(1)), Mul)]) } subjects = {} subjects_by_id = {} bipartite = BipartiteGraph() associative = Mul max_optional_count = 1 anonymous_patterns = set() def __init__(self): self.add_subject(None) @staticmethod def get(): if CommutativeMatcher17761._instance is None: CommutativeMatcher17761._instance = CommutativeMatcher17761() return CommutativeMatcher17761._instance @staticmethod def get_match_iter(subject): subjects = deque([subject]) if subject is not None else deque() subst0 = Substitution() # State 17760 subst1 = Substitution(subst0) try: subst1.try_add_variable('i2.3.1.0', S(0)) except ValueError: pass else: pass # State 17762 subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.3.1.1.0_1', S(1)) except ValueError: pass else: pass # State 17763 if len(subjects) >= 1: tmp3 = subjects.popleft() subst3 = Substitution(subst2) try: subst3.try_add_variable('i2.3.1.1.0', tmp3) except ValueError: pass else: pass # State 17764 if len(subjects) == 0: pass # 0: c + x*d yield 0, subst3 subjects.appendleft(tmp3) if len(subjects) >= 1 and isinstance(subjects[0], Mul): tmp5 = subjects.popleft() associative1 = tmp5 associative_type1 = type(tmp5) subjects6 = deque(tmp5._args) matcher = CommutativeMatcher17766.get() tmp7 = subjects6 subjects6 = [] for s in tmp7: matcher.add_subject(s) for pattern_index, subst2 in matcher.match(tmp7, subst1): pass if pattern_index == 0: pass # State 17767 if len(subjects) == 0: pass # 0: c + x*d yield 0, subst2 subjects.appendleft(tmp5) subst1 = Substitution(subst0) try: subst1.try_add_variable('i2.2.1.3.1.0', S(0)) except ValueError: pass else: pass # State 18083 subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.1.3.1.1.0_1', S(1)) except ValueError: pass else: pass # State 18084 if len(subjects) >= 1: tmp10 = subjects.popleft() subst3 = Substitution(subst2) try: subst3.try_add_variable('i2.2.1.3.1.1.0', tmp10) except ValueError: pass else: pass # State 18085 if len(subjects) == 0: pass # 1: c + x*d yield 1, subst3 subjects.appendleft(tmp10) if len(subjects) >= 1 and isinstance(subjects[0], Mul): tmp12 = subjects.popleft() associative1 = tmp12 associative_type1 = type(tmp12) subjects13 = deque(tmp12._args) matcher = CommutativeMatcher18087.get() tmp14 = subjects13 subjects13 = [] for s in tmp14: matcher.add_subject(s) for pattern_index, subst2 in matcher.match(tmp14, subst1): pass if pattern_index == 0: pass # State 18088 if len(subjects) == 0: pass # 1: c + x*d yield 1, subst2 subjects.appendleft(tmp12) if len(subjects) >= 1 and isinstance(subjects[0], Add): tmp15 = subjects.popleft() associative1 = tmp15 associative_type1 = type(tmp15) subjects16 = deque(tmp15._args) matcher = CommutativeMatcher17769.get() tmp17 = subjects16 subjects16 = [] for s in tmp17: matcher.add_subject(s) for pattern_index, subst1 in matcher.match(tmp17, subst0): pass if pattern_index == 0: pass # State 17775 if len(subjects) == 0: pass # 0: c + x*d yield 0, subst1 if pattern_index == 1: pass # State 18092 if len(subjects) == 0: pass # 1: c + x*d yield 1, subst1 subjects.appendleft(tmp15) return yield
class CommutativeMatcher36468(CommutativeMatcher): _instance = None patterns = { 0: (0, Multiset({0: 1}), [(VariableWithCount('i2.2.1.2.2.0', 1, 1, S(1)), Mul)]) } subjects = {} subjects_by_id = {} bipartite = BipartiteGraph() associative = Mul max_optional_count = 1 anonymous_patterns = set() def __init__(self): self.add_subject(None) @staticmethod def get(): if CommutativeMatcher36468._instance is None: CommutativeMatcher36468._instance = CommutativeMatcher36468() return CommutativeMatcher36468._instance @staticmethod def get_match_iter(subject): subjects = deque([subject]) if subject is not None else deque() subst0 = Substitution() # State 36467 subst1 = Substitution(subst0) try: subst1.try_add_variable('i2.2.1.2.2.2', S(1)) except ValueError: pass else: pass # State 36469 subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.1.2.2.2.0', S(0)) except ValueError: pass else: pass # State 36470 subst3 = Substitution(subst2) try: subst3.try_add_variable('i2.2.1.2.2.2.1.0', S(1)) except ValueError: pass else: pass # State 36471 if len(subjects) >= 1 and isinstance(subjects[0], Pow): tmp4 = subjects.popleft() subjects5 = deque(tmp4._args) # State 36472 if len(subjects5) >= 1: tmp6 = subjects5.popleft() subst4 = Substitution(subst3) try: subst4.try_add_variable('i2.2.1.1', tmp6) except ValueError: pass else: pass # State 36473 if len(subjects5) >= 1: tmp8 = subjects5.popleft() subst5 = Substitution(subst4) try: subst5.try_add_variable( 'i2.2.1.2', tmp8) except ValueError: pass else: pass # State 36474 if len(subjects5) == 0: pass # State 36475 if len(subjects) == 0: pass # 0: (x**j*f + e)**p yield 0, subst5 subjects5.appendleft(tmp8) subjects5.appendleft(tmp6) subjects.appendleft(tmp4) if len(subjects) >= 1 and isinstance(subjects[0], Mul): tmp10 = subjects.popleft() associative1 = tmp10 associative_type1 = type(tmp10) subjects11 = deque(tmp10._args) matcher = CommutativeMatcher36477.get() tmp12 = subjects11 subjects11 = [] for s in tmp12: matcher.add_subject(s) for pattern_index, subst3 in matcher.match(tmp12, subst2): pass if pattern_index == 0: pass # State 36482 if len(subjects) == 0: pass # 0: (x**j*f + e)**p yield 0, subst3 subjects.appendleft(tmp10) if len(subjects) >= 1 and isinstance(subjects[0], Add): tmp13 = subjects.popleft() associative1 = tmp13 associative_type1 = type(tmp13) subjects14 = deque(tmp13._args) matcher = CommutativeMatcher36484.get() tmp15 = subjects14 subjects14 = [] for s in tmp15: matcher.add_subject(s) for pattern_index, subst2 in matcher.match(tmp15, subst1): pass if pattern_index == 0: pass # State 36497 if len(subjects) == 0: pass # 0: (x**j*f + e)**p yield 0, subst2 subjects.appendleft(tmp13) if len(subjects) >= 1 and isinstance(subjects[0], Pow): tmp16 = subjects.popleft() subjects17 = deque(tmp16._args) # State 36498 subst1 = Substitution(subst0) try: subst1.try_add_variable('i2.2.1.2.2.2.0', S(0)) except ValueError: pass else: pass # State 36499 subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.1.2.2.2.1.0', S(1)) except ValueError: pass else: pass # State 36500 if len(subjects17) >= 1 and isinstance(subjects17[0], Pow): tmp20 = subjects17.popleft() subjects21 = deque(tmp20._args) # State 36501 if len(subjects21) >= 1: tmp22 = subjects21.popleft() subst3 = Substitution(subst2) try: subst3.try_add_variable('i2.2.1.1', tmp22) except ValueError: pass else: pass # State 36502 if len(subjects21) >= 1: tmp24 = subjects21.popleft() subst4 = Substitution(subst3) try: subst4.try_add_variable( 'i2.2.1.2', tmp24) except ValueError: pass else: pass # State 36503 if len(subjects21) == 0: pass # State 36504 subst5 = Substitution(subst4) try: subst5.try_add_variable( 'i2.2.1.2.2.2', 1) except ValueError: pass else: pass # State 36505 if len(subjects17) == 0: pass # State 36506 if len(subjects) == 0: pass # 0: (x**j*f + e)**p yield 0, subst5 if len(subjects17) >= 1: tmp27 = subjects17.popleft() subst5 = Substitution(subst4) try: subst5.try_add_variable( 'i2.2.1.2.2.2', tmp27) except ValueError: pass else: pass # State 36505 if len(subjects17) == 0: pass # State 36506 if len(subjects) == 0: pass # 0: (x**j*f + e)**p yield 0, subst5 subjects17.appendleft(tmp27) subjects21.appendleft(tmp24) subjects21.appendleft(tmp22) subjects17.appendleft(tmp20) if len(subjects17) >= 1 and isinstance(subjects17[0], Mul): tmp29 = subjects17.popleft() associative1 = tmp29 associative_type1 = type(tmp29) subjects30 = deque(tmp29._args) matcher = CommutativeMatcher36508.get() tmp31 = subjects30 subjects30 = [] for s in tmp31: matcher.add_subject(s) for pattern_index, subst2 in matcher.match(tmp31, subst1): pass if pattern_index == 0: pass # State 36513 subst3 = Substitution(subst2) try: subst3.try_add_variable('i2.2.1.2.2.2', 1) except ValueError: pass else: pass # State 36514 if len(subjects17) == 0: pass # State 36515 if len(subjects) == 0: pass # 0: (x**j*f + e)**p yield 0, subst3 if len(subjects17) >= 1: tmp33 = [] tmp33.append(subjects17.popleft()) while True: if len(tmp33) > 1: tmp34 = create_operation_expression( associative1, tmp33) elif len(tmp33) == 1: tmp34 = tmp33[0] else: assert False, "Unreachable" subst3 = Substitution(subst2) try: subst3.try_add_variable( 'i2.2.1.2.2.2', tmp34) except ValueError: pass else: pass # State 36514 if len(subjects17) == 0: pass # State 36515 if len(subjects) == 0: pass # 0: (x**j*f + e)**p yield 0, subst3 if len(subjects17) == 0: break tmp33.append(subjects17.popleft()) subjects17.extendleft(reversed(tmp33)) subjects17.appendleft(tmp29) if len(subjects17) >= 1 and isinstance(subjects17[0], Add): tmp36 = subjects17.popleft() associative1 = tmp36 associative_type1 = type(tmp36) subjects37 = deque(tmp36._args) matcher = CommutativeMatcher36517.get() tmp38 = subjects37 subjects37 = [] for s in tmp38: matcher.add_subject(s) for pattern_index, subst1 in matcher.match(tmp38, subst0): pass if pattern_index == 0: pass # State 36530 subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.1.2.2.2', 1) except ValueError: pass else: pass # State 36531 if len(subjects17) == 0: pass # State 36532 if len(subjects) == 0: pass # 0: (x**j*f + e)**p yield 0, subst2 if len(subjects17) >= 1: tmp40 = [] tmp40.append(subjects17.popleft()) while True: if len(tmp40) > 1: tmp41 = create_operation_expression( associative1, tmp40) elif len(tmp40) == 1: tmp41 = tmp40[0] else: assert False, "Unreachable" subst2 = Substitution(subst1) try: subst2.try_add_variable( 'i2.2.1.2.2.2', tmp41) except ValueError: pass else: pass # State 36531 if len(subjects17) == 0: pass # State 36532 if len(subjects) == 0: pass # 0: (x**j*f + e)**p yield 0, subst2 if len(subjects17) == 0: break tmp40.append(subjects17.popleft()) subjects17.extendleft(reversed(tmp40)) subjects17.appendleft(tmp36) subjects.appendleft(tmp16) return yield
class CommutativeMatcher65551(CommutativeMatcher): _instance = None patterns = { 0: (0, Multiset({0: 1}), [(VariableWithCount('i2.2.2.0', 1, 1, S(0)), Add)]), 1: (1, Multiset({1: 1}), [(VariableWithCount('i2.3.0', 1, 1, S(0)), Add)]), 2: (2, Multiset({2: 1}), [(VariableWithCount('i2.2.1.2.0', 1, 1, S(0)), Add)]), 3: (3, Multiset({3: 1}), [(VariableWithCount('i2.2.3.0', 1, 1, S(0)), Add)]), 4: (4, Multiset({4: 1}), [(VariableWithCount('i2.1.1.3.0', 1, 1, S(0)), Add)]), 5: (5, Multiset({5: 1}), [(VariableWithCount('i2.2.1.3.0', 1, 1, S(0)), Add)]), 6: (6, Multiset({6: 1}), [(VariableWithCount('i2.2.2.3.0', 1, 1, S(0)), Add)]) } subjects = {} subjects_by_id = {} bipartite = BipartiteGraph() associative = Add max_optional_count = 1 anonymous_patterns = set() def __init__(self): self.add_subject(None) @staticmethod def get(): if CommutativeMatcher65551._instance is None: CommutativeMatcher65551._instance = CommutativeMatcher65551() return CommutativeMatcher65551._instance @staticmethod def get_match_iter(subject): subjects = deque([subject]) if subject is not None else deque() subst0 = Substitution() # State 65550 subst1 = Substitution(subst0) try: subst1.try_add_variable('i2.2.2.1.0_1', S(1)) except ValueError: pass else: pass # State 65552 if len(subjects) >= 1: tmp2 = subjects.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.2.1.0', tmp2) except ValueError: pass else: pass # State 65553 if len(subjects) == 0: pass # 0: x*f yield 0, subst2 subjects.appendleft(tmp2) subst1 = Substitution(subst0) try: subst1.try_add_variable('i2.3.1.0_1', S(1)) except ValueError: pass else: pass # State 65710 if len(subjects) >= 1: tmp5 = subjects.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.3.1.0', tmp5) except ValueError: pass else: pass # State 65711 if len(subjects) == 0: pass # 1: x*f yield 1, subst2 subjects.appendleft(tmp5) subst1 = Substitution(subst0) try: subst1.try_add_variable('i2.2.1.2.1.0_1', S(1)) except ValueError: pass else: pass # State 65848 if len(subjects) >= 1: tmp8 = subjects.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.1.2.1.0', tmp8) except ValueError: pass else: pass # State 65849 if len(subjects) == 0: pass # 2: x*d yield 2, subst2 subjects.appendleft(tmp8) subst1 = Substitution(subst0) try: subst1.try_add_variable('i2.2.3.1.0_1', S(1)) except ValueError: pass else: pass # State 66109 if len(subjects) >= 1: tmp11 = subjects.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.3.1.0', tmp11) except ValueError: pass else: pass # State 66110 if len(subjects) == 0: pass # 3: x*f yield 3, subst2 subjects.appendleft(tmp11) subst1 = Substitution(subst0) try: subst1.try_add_variable('i2.1.1.3.1.0_1', S(1)) except ValueError: pass else: pass # State 90921 if len(subjects) >= 1: tmp14 = subjects.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.1.1.3.1.0', tmp14) except ValueError: pass else: pass # State 90922 if len(subjects) == 0: pass # 4: x*d yield 4, subst2 subjects.appendleft(tmp14) subst1 = Substitution(subst0) try: subst1.try_add_variable('i2.2.1.3.1.0_1', S(1)) except ValueError: pass else: pass # State 91583 if len(subjects) >= 1: tmp17 = subjects.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.1.3.1.0', tmp17) except ValueError: pass else: pass # State 91584 if len(subjects) == 0: pass # 5: x*f yield 5, subst2 subjects.appendleft(tmp17) subst1 = Substitution(subst0) try: subst1.try_add_variable('i2.2.2.3.1.0_1', S(1)) except ValueError: pass else: pass # State 94167 if len(subjects) >= 1: tmp20 = subjects.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.2.3.1.0', tmp20) except ValueError: pass else: pass # State 94168 if len(subjects) == 0: pass # 6: x*f yield 6, subst2 subjects.appendleft(tmp20) if len(subjects) >= 1 and isinstance(subjects[0], Mul): tmp22 = subjects.popleft() associative1 = tmp22 associative_type1 = type(tmp22) subjects23 = deque(tmp22._args) matcher = CommutativeMatcher65555.get() tmp24 = subjects23 subjects23 = [] for s in tmp24: matcher.add_subject(s) for pattern_index, subst1 in matcher.match(tmp24, subst0): pass if pattern_index == 0: pass # State 65556 if len(subjects) == 0: pass # 0: x*f yield 0, subst1 if pattern_index == 1: pass # State 65712 if len(subjects) == 0: pass # 1: x*f yield 1, subst1 if pattern_index == 2: pass # State 65850 if len(subjects) == 0: pass # 2: x*d yield 2, subst1 if pattern_index == 3: pass # State 66111 if len(subjects) == 0: pass # 3: x*f yield 3, subst1 if pattern_index == 4: pass # State 90923 if len(subjects) == 0: pass # 4: x*d yield 4, subst1 if pattern_index == 5: pass # State 91585 if len(subjects) == 0: pass # 5: x*f yield 5, subst1 if pattern_index == 6: pass # State 94169 if len(subjects) == 0: pass # 6: x*f yield 6, subst1 subjects.appendleft(tmp22) return yield
class CommutativeMatcher84681(CommutativeMatcher): _instance = None patterns = { 0: (0, Multiset({0: 1}), [(VariableWithCount('i2.2.1.3.0', 1, 1, S(0)), Add)]), 1: (1, Multiset({1: 1}), [(VariableWithCount('i2.2.1.4.0', 1, 1, S(0)), Add)]), 2: (2, Multiset({2: 1}), [(VariableWithCount('i2.4.0', 1, 1, S(0)), Add)]) } subjects = {} subjects_by_id = {} bipartite = BipartiteGraph() associative = Add max_optional_count = 1 anonymous_patterns = set() def __init__(self): self.add_subject(None) @staticmethod def get(): if CommutativeMatcher84681._instance is None: CommutativeMatcher84681._instance = CommutativeMatcher84681() return CommutativeMatcher84681._instance @staticmethod def get_match_iter(subject): subjects = deque([subject]) if subject is not None else deque() subst0 = Substitution() # State 84680 subst1 = Substitution(subst0) try: subst1.try_add_variable('i2.2.1.3.1.0_1', S(1)) except ValueError: pass else: pass # State 84682 if len(subjects) >= 1: tmp2 = subjects.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.1.3.1.0', tmp2) except ValueError: pass else: pass # State 84683 if len(subjects) == 0: pass # 0: x*f yield 0, subst2 subjects.appendleft(tmp2) subst1 = Substitution(subst0) try: subst1.try_add_variable('i2.2.1.4.1.0_1', S(1)) except ValueError: pass else: pass # State 84999 if len(subjects) >= 1: tmp5 = subjects.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.1.4.1.0', tmp5) except ValueError: pass else: pass # State 85000 if len(subjects) == 0: pass # 1: x*d yield 1, subst2 subjects.appendleft(tmp5) subst1 = Substitution(subst0) try: subst1.try_add_variable('i2.4.1.0_1', S(1)) except ValueError: pass else: pass # State 86405 if len(subjects) >= 1: tmp8 = subjects.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.4.1.0', tmp8) except ValueError: pass else: pass # State 86406 if len(subjects) == 0: pass # 2: x*f yield 2, subst2 subjects.appendleft(tmp8) if len(subjects) >= 1 and isinstance(subjects[0], Mul): tmp10 = subjects.popleft() associative1 = tmp10 associative_type1 = type(tmp10) subjects11 = deque(tmp10._args) matcher = CommutativeMatcher84685.get() tmp12 = subjects11 subjects11 = [] for s in tmp12: matcher.add_subject(s) for pattern_index, subst1 in matcher.match(tmp12, subst0): pass if pattern_index == 0: pass # State 84686 if len(subjects) == 0: pass # 0: x*f yield 0, subst1 if pattern_index == 1: pass # State 85001 if len(subjects) == 0: pass # 1: x*d yield 1, subst1 if pattern_index == 2: pass # State 86407 if len(subjects) == 0: pass # 2: x*f yield 2, subst1 subjects.appendleft(tmp10) return yield
class CommutativeMatcher21709(CommutativeMatcher): _instance = None patterns = { 0: (0, Multiset({0: 1}), [(VariableWithCount('i2.2.1.2.2.2.0', 1, 1, S(0)), Add)]), 1: (1, Multiset({1: 1}), [(VariableWithCount('i2.2.1.2.2.2.0', 1, 1, None), Add)]), 2: (2, Multiset({1: 1}), [(VariableWithCount('i2.2.1.2.2.2.0', 1, 1, S(0)), Add)]), 3: (3, Multiset({ 2: 1, 3: 1 }), [(VariableWithCount('i2.2.1.2.2.2.0', 1, 1, S(0)), Add)]) } subjects = {} subjects_by_id = {} bipartite = BipartiteGraph() associative = Add max_optional_count = 1 anonymous_patterns = set() def __init__(self): self.add_subject(None) @staticmethod def get(): if CommutativeMatcher21709._instance is None: CommutativeMatcher21709._instance = CommutativeMatcher21709() return CommutativeMatcher21709._instance @staticmethod def get_match_iter(subject): subjects = deque([subject]) if subject is not None else deque() subst0 = Substitution() # State 21708 subst1 = Substitution(subst0) try: subst1.try_add_variable('i2.2.1.2.2.2.1.0_1', S(1)) except ValueError: pass else: pass # State 21710 if len(subjects) >= 1: tmp2 = subjects.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.1.2.2.2.1.0', tmp2) except ValueError: pass else: pass # State 21711 if len(subjects) == 0: pass # 0: x*f yield 0, subst2 subjects.appendleft(tmp2) if len(subjects) >= 1: tmp4 = subjects.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.1.2.2.2.1.1', tmp4) except ValueError: pass else: pass # State 44660 if len(subjects) == 0: pass # 3: f*x yield 3, subst2 subjects.appendleft(tmp4) subst1 = Substitution(subst0) try: subst1.try_add_variable('i2.2.1.2.2.2.1.0', S(1)) except ValueError: pass else: pass # State 29761 if len(subjects) >= 1 and isinstance(subjects[0], Pow): tmp7 = subjects.popleft() subjects8 = deque(tmp7._args) # State 29762 if len(subjects8) >= 1: tmp9 = subjects8.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.1.2.2.2.1.1', tmp9) except ValueError: pass else: pass # State 29763 if len(subjects8) >= 1: tmp11 = subjects8.popleft() subst3 = Substitution(subst2) try: subst3.try_add_variable( 'i2.2.1.2.2.2.1.2', tmp11) except ValueError: pass else: pass # State 29764 if len(subjects8) == 0: pass # State 29765 if len(subjects) == 0: pass # 1: f*x**m yield 1, subst3 subjects8.appendleft(tmp11) if len(subjects8) >= 1 and subjects8[0] == Integer(2): tmp13 = subjects8.popleft() # State 44655 if len(subjects8) == 0: pass # State 44656 if len(subjects) == 0: pass # 2: g*x**2 yield 2, subst2 subjects8.appendleft(tmp13) subjects8.appendleft(tmp9) subjects.appendleft(tmp7) if len(subjects) >= 1 and isinstance(subjects[0], Mul): tmp14 = subjects.popleft() associative1 = tmp14 associative_type1 = type(tmp14) subjects15 = deque(tmp14._args) matcher = CommutativeMatcher21713.get() tmp16 = subjects15 subjects15 = [] for s in tmp16: matcher.add_subject(s) for pattern_index, subst1 in matcher.match(tmp16, subst0): pass if pattern_index == 0: pass # State 21714 if len(subjects) == 0: pass # 0: x*f yield 0, subst1 if pattern_index == 1: pass # State 29770 if len(subjects) == 0: pass # 1: f*x**m yield 1, subst1 if pattern_index == 2: pass # State 44659 if len(subjects) == 0: pass # 2: g*x**2 yield 2, subst1 if pattern_index == 3: pass # State 44661 if len(subjects) == 0: pass # 3: f*x yield 3, subst1 subjects.appendleft(tmp14) return yield
class CommutativeMatcher58908(CommutativeMatcher): _instance = None patterns = { 0: (0, Multiset({0: 1}), [(VariableWithCount('i2.2.2.0', 1, 1, S(0)), Add)]), 1: (1, Multiset({1: 1}), [(VariableWithCount('i2.2.3.0', 1, 1, S(0)), Add)]), 2: (2, Multiset({2: 1}), [(VariableWithCount('i2.2.1.2.0', 1, 1, S(0)), Add)]), 3: (3, Multiset({3: 1}), [(VariableWithCount('i2.2.2.2.0', 1, 1, S(0)), Add)]), 4: (4, Multiset({4: 1}), [(VariableWithCount('i2.2.1.3.0', 1, 1, S(0)), Add)]), 5: (5, Multiset({5: 1}), [(VariableWithCount('i2.2.1.2.0', 1, 1, S(0)), Add)]), 6: (6, Multiset({6: 1}), [(VariableWithCount('i2.2.1.2.0', 1, 1, S(0)), Add)]), 7: (7, Multiset({7: 1}), [(VariableWithCount('i2.2.1.2.0', 1, 1, S(0)), Add)]), 8: (8, Multiset({8: 1}), [(VariableWithCount('i2.2.1.2.0', 1, 1, S(0)), Add)]) } subjects = {} subjects_by_id = {} bipartite = BipartiteGraph() associative = Add max_optional_count = 1 anonymous_patterns = set() def __init__(self): self.add_subject(None) @staticmethod def get(): if CommutativeMatcher58908._instance is None: CommutativeMatcher58908._instance = CommutativeMatcher58908() return CommutativeMatcher58908._instance @staticmethod def get_match_iter(subject): subjects = deque([subject]) if subject is not None else deque() subst0 = Substitution() # State 58907 subst1 = Substitution(subst0) try: subst1.try_add_variable('i2.2.2.1.0_1', S(1)) except ValueError: pass else: pass # State 58909 if len(subjects) >= 1: tmp2 = subjects.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.2.1.0', tmp2) except ValueError: pass else: pass # State 58910 if len(subjects) == 0: pass # 0: x*f yield 0, subst2 subjects.appendleft(tmp2) subst1 = Substitution(subst0) try: subst1.try_add_variable('i2.2.3.1.0_1', S(1)) except ValueError: pass else: pass # State 59101 if len(subjects) >= 1: tmp5 = subjects.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.3.1.0', tmp5) except ValueError: pass else: pass # State 59102 if len(subjects) == 0: pass # 1: x*f yield 1, subst2 subjects.appendleft(tmp5) subst1 = Substitution(subst0) try: subst1.try_add_variable('i2.2.1.2.1.0_1', S(1)) except ValueError: pass else: pass # State 60241 if len(subjects) >= 1: tmp8 = subjects.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.1.2.1.0', tmp8) except ValueError: pass else: pass # State 60242 if len(subjects) == 0: pass # 2: x*d yield 2, subst2 subjects.appendleft(tmp8) subst1 = Substitution(subst0) try: subst1.try_add_variable('i2.2.2.2.1.0_1', S(1)) except ValueError: pass else: pass # State 61740 if len(subjects) >= 1: tmp11 = subjects.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.2.2.1.0', tmp11) except ValueError: pass else: pass # State 61741 if len(subjects) == 0: pass # 3: x*f yield 3, subst2 subjects.appendleft(tmp11) subst1 = Substitution(subst0) try: subst1.try_add_variable('i2.2.1.3.1.0_1', S(1)) except ValueError: pass else: pass # State 62101 if len(subjects) >= 1: tmp14 = subjects.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.1.3.1.0', tmp14) except ValueError: pass else: pass # State 62102 if len(subjects) == 0: pass # 4: x*f yield 4, subst2 subjects.appendleft(tmp14) subst1 = Substitution(subst0) try: subst1.try_add_variable('i2.2.1.2.1.0', S(1)) except ValueError: pass else: pass # State 74386 if len(subjects) >= 1 and isinstance(subjects[0], Pow): tmp17 = subjects.popleft() subjects18 = deque(tmp17._args) # State 74387 if len(subjects18) >= 1: tmp19 = subjects18.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.0_1', tmp19) except ValueError: pass else: pass # State 74388 if len(subjects18) >= 1: tmp21 = subjects18.popleft() subst3 = Substitution(subst2) try: subst3.try_add_variable('i2.2.1.2.1.2', tmp21) except ValueError: pass else: pass # State 74389 if len(subjects18) == 0: pass # State 74390 if len(subjects) == 0: pass # 5: x**n*d yield 5, subst3 subjects18.appendleft(tmp21) subjects18.appendleft(tmp19) if len(subjects18) >= 1: tmp23 = subjects18.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.0', tmp23) except ValueError: pass else: pass # State 74920 if len(subjects18) >= 1: tmp25 = subjects18.popleft() subst3 = Substitution(subst2) try: subst3.try_add_variable('i2.2.1.2.1.2', tmp25) except ValueError: pass else: pass # State 74921 if len(subjects18) == 0: pass # State 74922 if len(subjects) == 0: pass # 6: x**n*d yield 6, subst3 subjects18.appendleft(tmp25) subjects18.appendleft(tmp23) if len(subjects18) >= 1: tmp27 = subjects18.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.1.2.1.1', tmp27) except ValueError: pass else: pass # State 75307 if len(subjects18) >= 1: tmp29 = subjects18.popleft() subst3 = Substitution(subst2) try: subst3.try_add_variable('i2.2.1.2.1.2', tmp29) except ValueError: pass else: pass # State 75308 if len(subjects18) == 0: pass # State 75309 if len(subjects) == 0: pass # 7: d*x**n yield 7, subst3 subjects18.appendleft(tmp29) subjects18.appendleft(tmp27) subjects.appendleft(tmp17) if len(subjects) >= 1: tmp31 = subjects.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.1.0', tmp31) except ValueError: pass else: pass # State 107259 if len(subjects) == 0: pass # 8: x*d yield 8, subst2 subjects.appendleft(tmp31) if len(subjects) >= 1 and isinstance(subjects[0], Mul): tmp33 = subjects.popleft() associative1 = tmp33 associative_type1 = type(tmp33) subjects34 = deque(tmp33._args) matcher = CommutativeMatcher58912.get() tmp35 = subjects34 subjects34 = [] for s in tmp35: matcher.add_subject(s) for pattern_index, subst1 in matcher.match(tmp35, subst0): pass if pattern_index == 0: pass # State 58913 if len(subjects) == 0: pass # 0: x*f yield 0, subst1 if pattern_index == 1: pass # State 59103 if len(subjects) == 0: pass # 1: x*f yield 1, subst1 if pattern_index == 2: pass # State 60243 if len(subjects) == 0: pass # 2: x*d yield 2, subst1 if pattern_index == 3: pass # State 61742 if len(subjects) == 0: pass # 3: x*f yield 3, subst1 if pattern_index == 4: pass # State 62103 if len(subjects) == 0: pass # 4: x*f yield 4, subst1 if pattern_index == 5: pass # State 74395 if len(subjects) == 0: pass # 5: x**n*d yield 5, subst1 if pattern_index == 6: pass # State 74926 if len(subjects) == 0: pass # 6: x**n*d yield 6, subst1 if pattern_index == 7: pass # State 75313 if len(subjects) == 0: pass # 7: d*x**n yield 7, subst1 if pattern_index == 8: pass # State 107260 if len(subjects) == 0: pass # 8: x*d yield 8, subst1 subjects.appendleft(tmp33) return yield
class CommutativeMatcher54112(CommutativeMatcher): _instance = None patterns = { 0: (0, Multiset({0: 1}), [ (VariableWithCount('i2.2.1.2.0', 1, 1, S(0)), Add) ]), 1: (1, Multiset({1: 1}), [ (VariableWithCount('i2.1.1.2.0', 1, 1, None), Add) ]) } subjects = {} subjects_by_id = {} bipartite = BipartiteGraph() associative = Add max_optional_count = 1 anonymous_patterns = set() def __init__(self): self.add_subject(None) @staticmethod def get(): if CommutativeMatcher54112._instance is None: CommutativeMatcher54112._instance = CommutativeMatcher54112() return CommutativeMatcher54112._instance @staticmethod def get_match_iter(subject): subjects = deque([subject]) if subject is not None else deque() subst0 = Substitution() # State 54111 subst1 = Substitution(subst0) try: subst1.try_add_variable('i2.2.1.2.1.0_1', S(1)) except ValueError: pass else: pass # State 54113 if len(subjects) >= 1: tmp2 = subjects.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.1.2.1.0', tmp2) except ValueError: pass else: pass # State 54114 if len(subjects) == 0: pass # 0: x*d yield 0, subst2 subjects.appendleft(tmp2) subst1 = Substitution(subst0) try: subst1.try_add_variable('i2.1.1.2.1.0', S(1)) except ValueError: pass else: pass # State 114246 if len(subjects) >= 1 and isinstance(subjects[0], Pow): tmp5 = subjects.popleft() subjects6 = deque(tmp5._args) # State 114247 if len(subjects6) >= 1: tmp7 = subjects6.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.1.2.0', tmp7) except ValueError: pass else: pass # State 114248 if len(subjects6) >= 1 and subjects6[0] == Integer(2): tmp9 = subjects6.popleft() # State 114249 if len(subjects6) == 0: pass # State 114250 if len(subjects) == 0: pass # 1: g*x**2 yield 1, subst2 subjects6.appendleft(tmp9) subjects6.appendleft(tmp7) subjects.appendleft(tmp5) if len(subjects) >= 1 and isinstance(subjects[0], Mul): tmp10 = subjects.popleft() associative1 = tmp10 associative_type1 = type(tmp10) subjects11 = deque(tmp10._args) matcher = CommutativeMatcher54116.get() tmp12 = subjects11 subjects11 = [] for s in tmp12: matcher.add_subject(s) for pattern_index, subst1 in matcher.match(tmp12, subst0): pass if pattern_index == 0: pass # State 54117 if len(subjects) == 0: pass # 0: x*d yield 0, subst1 if pattern_index == 1: pass # State 114255 if len(subjects) == 0: pass # 1: g*x**2 yield 1, subst1 subjects.appendleft(tmp10) return yield
class CommutativeMatcher106130(CommutativeMatcher): _instance = None patterns = { 0: (0, Multiset({0: 1}), [(VariableWithCount('i5.1.0', 1, 1, S(1)), Mul)]) } subjects = {} subjects_by_id = {} bipartite = BipartiteGraph() associative = Mul max_optional_count = 1 anonymous_patterns = set() def __init__(self): self.add_subject(None) @staticmethod def get(): if CommutativeMatcher106130._instance is None: CommutativeMatcher106130._instance = CommutativeMatcher106130() return CommutativeMatcher106130._instance @staticmethod def get_match_iter(subject): subjects = deque([subject]) if subject is not None else deque() subst0 = Substitution() # State 106129 if len(subjects) >= 1 and isinstance(subjects[0], log): tmp1 = subjects.popleft() subjects2 = deque(tmp1._args) # State 106131 subst1 = Substitution(subst0) try: subst1.try_add_variable('i5.1.2.0', S(1)) except ValueError: pass else: pass # State 106132 subst2 = Substitution(subst1) try: subst2.try_add_variable('i5.1.2.2', S(1)) except ValueError: pass else: pass # State 106133 if len(subjects2) >= 1: tmp5 = subjects2.popleft() subst3 = Substitution(subst2) try: subst3.try_add_variable('i5.1.2.1', tmp5) except ValueError: pass else: pass # State 106134 if len(subjects2) == 0: pass # State 106135 if len(subjects) == 0: pass # 0: log(c*x**n) /; (cons_f2) and (cons_f3) and (cons_f8) and (cons_f4) and (cons_f5) and (cons_f1713) yield 0, subst3 subjects2.appendleft(tmp5) if len(subjects2) >= 1 and isinstance(subjects2[0], Pow): tmp7 = subjects2.popleft() subjects8 = deque(tmp7._args) # State 106136 if len(subjects8) >= 1: tmp9 = subjects8.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i5.1.2.1', tmp9) except ValueError: pass else: pass # State 106137 subst3 = Substitution(subst2) try: subst3.try_add_variable('i5.1.2.2', 1) except ValueError: pass else: pass # State 106138 if len(subjects8) == 0: pass # State 106139 if len(subjects2) == 0: pass # State 106140 if len(subjects) == 0: pass # 0: log(c*x**n) /; (cons_f2) and (cons_f3) and (cons_f8) and (cons_f4) and (cons_f5) and (cons_f1713) yield 0, subst3 if len(subjects8) >= 1: tmp12 = subjects8.popleft() subst3 = Substitution(subst2) try: subst3.try_add_variable('i5.1.2.2', tmp12) except ValueError: pass else: pass # State 106138 if len(subjects8) == 0: pass # State 106139 if len(subjects2) == 0: pass # State 106140 if len(subjects) == 0: pass # 0: log(c*x**n) /; (cons_f2) and (cons_f3) and (cons_f8) and (cons_f4) and (cons_f5) and (cons_f1713) yield 0, subst3 subjects8.appendleft(tmp12) subjects8.appendleft(tmp9) subjects2.appendleft(tmp7) if len(subjects2) >= 1 and isinstance(subjects2[0], Mul): tmp14 = subjects2.popleft() associative1 = tmp14 associative_type1 = type(tmp14) subjects15 = deque(tmp14._args) matcher = CommutativeMatcher106142.get() tmp16 = subjects15 subjects15 = [] for s in tmp16: matcher.add_subject(s) for pattern_index, subst1 in matcher.match(tmp16, subst0): pass if pattern_index == 0: pass # State 106149 if len(subjects2) == 0: pass # State 106150 if len(subjects) == 0: pass # 0: log(c*x**n) /; (cons_f2) and (cons_f3) and (cons_f8) and (cons_f4) and (cons_f5) and (cons_f1713) yield 0, subst1 subjects2.appendleft(tmp14) subjects.appendleft(tmp1) return yield
class CommutativeMatcher61433(CommutativeMatcher): _instance = None patterns = { 0: (0, Multiset({0: 1}), [(VariableWithCount('i2.2.2.0', 1, 1, S(1)), Mul)]), 1: (1, Multiset({1: 1}), [(VariableWithCount('i2.2.2.0', 1, 1, S(1)), Mul)]), 2: (2, Multiset({2: 1}), [(VariableWithCount('i2.2.2.0', 1, 1, S(1)), Mul)]), 3: (3, Multiset({3: 1}), [(VariableWithCount('i2.2.2.0', 1, 1, S(1)), Mul)]), 4: (4, Multiset({4: 1}), [(VariableWithCount('i2.2.2.0', 1, 1, S(1)), Mul)]), 5: (5, Multiset({5: 1}), [(VariableWithCount('i2.2.2.0', 1, 1, S(1)), Mul)]), 6: (6, Multiset({6: 1}), [(VariableWithCount('i2.2.2.0', 1, 1, None), Mul), (VariableWithCount('i2.2.2.0_1', 1, 1, S(1)), Mul)]), 7: (7, Multiset({6: 1}), [(VariableWithCount('i2.2.2.0', 1, 1, None), Mul)]), 8: (8, Multiset({7: 1}), [(VariableWithCount('i2.2.2.0', 1, 1, S(1)), Mul)]) } subjects = {} subjects_by_id = {} bipartite = BipartiteGraph() associative = Mul max_optional_count = 1 anonymous_patterns = set() def __init__(self): self.add_subject(None) @staticmethod def get(): if CommutativeMatcher61433._instance is None: CommutativeMatcher61433._instance = CommutativeMatcher61433() return CommutativeMatcher61433._instance @staticmethod def get_match_iter(subject): subjects = deque([subject]) if subject is not None else deque() subst0 = Substitution() # State 61432 if len(subjects) >= 1 and isinstance(subjects[0], sin): tmp1 = subjects.popleft() subjects2 = deque(tmp1._args) # State 61434 subst1 = Substitution(subst0) try: subst1.try_add_variable('i2.2.2.2.0', S(0)) except ValueError: pass else: pass # State 61435 subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.2.2.1.0_1', S(1)) except ValueError: pass else: pass # State 61436 if len(subjects2) >= 1: tmp5 = subjects2.popleft() subst3 = Substitution(subst2) try: subst3.try_add_variable('i2.2.2.2.1.0', tmp5) except ValueError: pass else: pass # State 61437 if len(subjects2) == 0: pass # State 61438 if len(subjects) == 0: pass # 0: sin(e + x*f) yield 0, subst3 subjects2.appendleft(tmp5) if len(subjects2) >= 1 and isinstance(subjects2[0], Mul): tmp7 = subjects2.popleft() associative1 = tmp7 associative_type1 = type(tmp7) subjects8 = deque(tmp7._args) matcher = CommutativeMatcher61440.get() tmp9 = subjects8 subjects8 = [] for s in tmp9: matcher.add_subject(s) for pattern_index, subst2 in matcher.match(tmp9, subst1): pass if pattern_index == 0: pass # State 61441 if len(subjects2) == 0: pass # State 61442 if len(subjects) == 0: pass # 0: sin(e + x*f) yield 0, subst2 subjects2.appendleft(tmp7) if len(subjects2) >= 1 and isinstance(subjects2[0], Add): tmp10 = subjects2.popleft() associative1 = tmp10 associative_type1 = type(tmp10) subjects11 = deque(tmp10._args) matcher = CommutativeMatcher61444.get() tmp12 = subjects11 subjects11 = [] for s in tmp12: matcher.add_subject(s) for pattern_index, subst1 in matcher.match(tmp12, subst0): pass if pattern_index == 0: pass # State 61450 if len(subjects2) == 0: pass # State 61451 if len(subjects) == 0: pass # 0: sin(e + x*f) yield 0, subst1 subjects2.appendleft(tmp10) subjects.appendleft(tmp1) if len(subjects) >= 1 and isinstance(subjects[0], cos): tmp13 = subjects.popleft() subjects14 = deque(tmp13._args) # State 61663 subst1 = Substitution(subst0) try: subst1.try_add_variable('i2.2.2.2.0', S(0)) except ValueError: pass else: pass # State 61664 subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.2.2.1.0_1', S(1)) except ValueError: pass else: pass # State 61665 if len(subjects14) >= 1: tmp17 = subjects14.popleft() subst3 = Substitution(subst2) try: subst3.try_add_variable('i2.2.2.2.1.0', tmp17) except ValueError: pass else: pass # State 61666 if len(subjects14) == 0: pass # State 61667 if len(subjects) == 0: pass # 1: cos(e + x*f) yield 1, subst3 subjects14.appendleft(tmp17) if len(subjects14) >= 1 and isinstance(subjects14[0], Mul): tmp19 = subjects14.popleft() associative1 = tmp19 associative_type1 = type(tmp19) subjects20 = deque(tmp19._args) matcher = CommutativeMatcher61669.get() tmp21 = subjects20 subjects20 = [] for s in tmp21: matcher.add_subject(s) for pattern_index, subst2 in matcher.match(tmp21, subst1): pass if pattern_index == 0: pass # State 61670 if len(subjects14) == 0: pass # State 61671 if len(subjects) == 0: pass # 1: cos(e + x*f) yield 1, subst2 subjects14.appendleft(tmp19) if len(subjects14) >= 1 and isinstance(subjects14[0], Add): tmp22 = subjects14.popleft() associative1 = tmp22 associative_type1 = type(tmp22) subjects23 = deque(tmp22._args) matcher = CommutativeMatcher61673.get() tmp24 = subjects23 subjects23 = [] for s in tmp24: matcher.add_subject(s) for pattern_index, subst1 in matcher.match(tmp24, subst0): pass if pattern_index == 0: pass # State 61679 if len(subjects14) == 0: pass # State 61680 if len(subjects) == 0: pass # 1: cos(e + x*f) yield 1, subst1 subjects14.appendleft(tmp22) subjects.appendleft(tmp13) if len(subjects) >= 1 and isinstance(subjects[0], Pow): tmp25 = subjects.popleft() subjects26 = deque(tmp25._args) # State 76890 if len(subjects26) >= 1 and isinstance(subjects26[0], cos): tmp27 = subjects26.popleft() subjects28 = deque(tmp27._args) # State 76891 subst1 = Substitution(subst0) try: subst1.try_add_variable('i2.2.2.3.0', S(0)) except ValueError: pass else: pass # State 76892 subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.2.3.1.0_1', S(1)) except ValueError: pass else: pass # State 76893 if len(subjects28) >= 1: tmp31 = subjects28.popleft() subst3 = Substitution(subst2) try: subst3.try_add_variable('i2.2.2.3.1.0', tmp31) except ValueError: pass else: pass # State 76894 if len(subjects28) == 0: pass # State 76895 if len(subjects26) >= 1 and subjects26[ 0] == Integer(-1): tmp33 = subjects26.popleft() # State 76896 if len(subjects26) == 0: pass # State 76897 if len(subjects) == 0: pass # 2: 1/cos(e + x*f) yield 2, subst3 subjects26.appendleft(tmp33) subjects28.appendleft(tmp31) if len(subjects28) >= 1 and isinstance(subjects28[0], Mul): tmp34 = subjects28.popleft() associative1 = tmp34 associative_type1 = type(tmp34) subjects35 = deque(tmp34._args) matcher = CommutativeMatcher76899.get() tmp36 = subjects35 subjects35 = [] for s in tmp36: matcher.add_subject(s) for pattern_index, subst2 in matcher.match( tmp36, subst1): pass if pattern_index == 0: pass # State 76900 if len(subjects28) == 0: pass # State 76901 if len(subjects26) >= 1 and subjects26[ 0] == Integer(-1): tmp37 = subjects26.popleft() # State 76902 if len(subjects26) == 0: pass # State 76903 if len(subjects) == 0: pass # 2: 1/cos(e + x*f) yield 2, subst2 subjects26.appendleft(tmp37) subjects28.appendleft(tmp34) if len(subjects28) >= 1 and isinstance(subjects28[0], Add): tmp38 = subjects28.popleft() associative1 = tmp38 associative_type1 = type(tmp38) subjects39 = deque(tmp38._args) matcher = CommutativeMatcher76905.get() tmp40 = subjects39 subjects39 = [] for s in tmp40: matcher.add_subject(s) for pattern_index, subst1 in matcher.match(tmp40, subst0): pass if pattern_index == 0: pass # State 76911 if len(subjects28) == 0: pass # State 76912 if len(subjects26 ) >= 1 and subjects26[0] == Integer(-1): tmp41 = subjects26.popleft() # State 76913 if len(subjects26) == 0: pass # State 76914 if len(subjects) == 0: pass # 2: 1/cos(e + x*f) yield 2, subst1 subjects26.appendleft(tmp41) subjects28.appendleft(tmp38) subjects26.appendleft(tmp27) if len(subjects26) >= 1 and isinstance(subjects26[0], sin): tmp42 = subjects26.popleft() subjects43 = deque(tmp42._args) # State 77169 subst1 = Substitution(subst0) try: subst1.try_add_variable('i2.2.2.3.0', S(0)) except ValueError: pass else: pass # State 77170 subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.2.3.1.0_1', S(1)) except ValueError: pass else: pass # State 77171 if len(subjects43) >= 1: tmp46 = subjects43.popleft() subst3 = Substitution(subst2) try: subst3.try_add_variable('i2.2.2.3.1.0', tmp46) except ValueError: pass else: pass # State 77172 if len(subjects43) == 0: pass # State 77173 if len(subjects26) >= 1 and subjects26[ 0] == Integer(-1): tmp48 = subjects26.popleft() # State 77174 if len(subjects26) == 0: pass # State 77175 if len(subjects) == 0: pass # 3: 1/sin(e + x*f) yield 3, subst3 subjects26.appendleft(tmp48) subjects43.appendleft(tmp46) if len(subjects43) >= 1 and isinstance(subjects43[0], Mul): tmp49 = subjects43.popleft() associative1 = tmp49 associative_type1 = type(tmp49) subjects50 = deque(tmp49._args) matcher = CommutativeMatcher77177.get() tmp51 = subjects50 subjects50 = [] for s in tmp51: matcher.add_subject(s) for pattern_index, subst2 in matcher.match( tmp51, subst1): pass if pattern_index == 0: pass # State 77178 if len(subjects43) == 0: pass # State 77179 if len(subjects26) >= 1 and subjects26[ 0] == Integer(-1): tmp52 = subjects26.popleft() # State 77180 if len(subjects26) == 0: pass # State 77181 if len(subjects) == 0: pass # 3: 1/sin(e + x*f) yield 3, subst2 subjects26.appendleft(tmp52) subjects43.appendleft(tmp49) if len(subjects43) >= 1 and isinstance(subjects43[0], Add): tmp53 = subjects43.popleft() associative1 = tmp53 associative_type1 = type(tmp53) subjects54 = deque(tmp53._args) matcher = CommutativeMatcher77183.get() tmp55 = subjects54 subjects54 = [] for s in tmp55: matcher.add_subject(s) for pattern_index, subst1 in matcher.match(tmp55, subst0): pass if pattern_index == 0: pass # State 77189 if len(subjects43) == 0: pass # State 77190 if len(subjects26 ) >= 1 and subjects26[0] == Integer(-1): tmp56 = subjects26.popleft() # State 77191 if len(subjects26) == 0: pass # State 77192 if len(subjects) == 0: pass # 3: 1/sin(e + x*f) yield 3, subst1 subjects26.appendleft(tmp56) subjects43.appendleft(tmp53) subjects26.appendleft(tmp42) if len(subjects26) >= 1 and isinstance(subjects26[0], tan): tmp57 = subjects26.popleft() subjects58 = deque(tmp57._args) # State 80258 subst1 = Substitution(subst0) try: subst1.try_add_variable('i2.2.2.3.0', S(0)) except ValueError: pass else: pass # State 80259 subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.2.3.1.0_1', S(1)) except ValueError: pass else: pass # State 80260 if len(subjects58) >= 1: tmp61 = subjects58.popleft() subst3 = Substitution(subst2) try: subst3.try_add_variable('i2.2.2.3.1.0', tmp61) except ValueError: pass else: pass # State 80261 if len(subjects58) == 0: pass # State 80262 if len(subjects26) >= 1 and subjects26[ 0] == Integer(-1): tmp63 = subjects26.popleft() # State 80263 if len(subjects26) == 0: pass # State 80264 if len(subjects) == 0: pass # 5: 1/tan(e + x*f) yield 5, subst3 subjects26.appendleft(tmp63) subjects58.appendleft(tmp61) if len(subjects58) >= 1 and isinstance(subjects58[0], Mul): tmp64 = subjects58.popleft() associative1 = tmp64 associative_type1 = type(tmp64) subjects65 = deque(tmp64._args) matcher = CommutativeMatcher80266.get() tmp66 = subjects65 subjects65 = [] for s in tmp66: matcher.add_subject(s) for pattern_index, subst2 in matcher.match( tmp66, subst1): pass if pattern_index == 0: pass # State 80267 if len(subjects58) == 0: pass # State 80268 if len(subjects26) >= 1 and subjects26[ 0] == Integer(-1): tmp67 = subjects26.popleft() # State 80269 if len(subjects26) == 0: pass # State 80270 if len(subjects) == 0: pass # 5: 1/tan(e + x*f) yield 5, subst2 subjects26.appendleft(tmp67) subjects58.appendleft(tmp64) if len(subjects58) >= 1 and isinstance(subjects58[0], Add): tmp68 = subjects58.popleft() associative1 = tmp68 associative_type1 = type(tmp68) subjects69 = deque(tmp68._args) matcher = CommutativeMatcher80272.get() tmp70 = subjects69 subjects69 = [] for s in tmp70: matcher.add_subject(s) for pattern_index, subst1 in matcher.match(tmp70, subst0): pass if pattern_index == 0: pass # State 80278 if len(subjects58) == 0: pass # State 80279 if len(subjects26 ) >= 1 and subjects26[0] == Integer(-1): tmp71 = subjects26.popleft() # State 80280 if len(subjects26) == 0: pass # State 80281 if len(subjects) == 0: pass # 5: 1/tan(e + x*f) yield 5, subst1 subjects26.appendleft(tmp71) subjects58.appendleft(tmp68) subjects26.appendleft(tmp57) subst1 = Substitution(subst0) try: subst1.try_add_variable('i2.2.2.2.0', S(0)) except ValueError: pass else: pass # State 150809 subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.2.2.1.0_1', S(1)) except ValueError: pass else: pass # State 150810 if len(subjects26) >= 1: tmp74 = subjects26.popleft() subst3 = Substitution(subst2) try: subst3.try_add_variable('i2.2.2.2.1.0', tmp74) except ValueError: pass else: pass # State 150811 if len(subjects26) >= 1: tmp76 = subjects26.popleft() subst4 = Substitution(subst3) try: subst4.try_add_variable('i2.2.2.2', tmp76) except ValueError: pass else: pass # State 150812 if len(subjects26) == 0: pass # State 150813 if len(subjects) == 0: pass # 7: (a + x*b)**n yield 7, subst4 subjects26.appendleft(tmp76) subjects26.appendleft(tmp74) if len(subjects26) >= 1 and isinstance(subjects26[0], Mul): tmp78 = subjects26.popleft() associative1 = tmp78 associative_type1 = type(tmp78) subjects79 = deque(tmp78._args) matcher = CommutativeMatcher150815.get() tmp80 = subjects79 subjects79 = [] for s in tmp80: matcher.add_subject(s) for pattern_index, subst2 in matcher.match(tmp80, subst1): pass if pattern_index == 0: pass # State 150816 if len(subjects26) >= 1: tmp81 = [] tmp81.append(subjects26.popleft()) while True: if len(tmp81) > 1: tmp82 = create_operation_expression( associative1, tmp81) elif len(tmp81) == 1: tmp82 = tmp81[0] else: assert False, "Unreachable" subst3 = Substitution(subst2) try: subst3.try_add_variable( 'i2.2.2.2', tmp82) except ValueError: pass else: pass # State 150817 if len(subjects26) == 0: pass # State 150818 if len(subjects) == 0: pass # 7: (a + x*b)**n yield 7, subst3 if len(subjects26) == 0: break tmp81.append(subjects26.popleft()) subjects26.extendleft(reversed(tmp81)) subjects26.appendleft(tmp78) if len(subjects26) >= 1 and isinstance(subjects26[0], Add): tmp84 = subjects26.popleft() associative1 = tmp84 associative_type1 = type(tmp84) subjects85 = deque(tmp84._args) matcher = CommutativeMatcher150820.get() tmp86 = subjects85 subjects85 = [] for s in tmp86: matcher.add_subject(s) for pattern_index, subst1 in matcher.match(tmp86, subst0): pass if pattern_index == 0: pass # State 150826 if len(subjects26) >= 1: tmp87 = [] tmp87.append(subjects26.popleft()) while True: if len(tmp87) > 1: tmp88 = create_operation_expression( associative1, tmp87) elif len(tmp87) == 1: tmp88 = tmp87[0] else: assert False, "Unreachable" subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.2.2', tmp88) except ValueError: pass else: pass # State 150827 if len(subjects26) == 0: pass # State 150828 if len(subjects) == 0: pass # 7: (a + x*b)**n yield 7, subst2 if len(subjects26) == 0: break tmp87.append(subjects26.popleft()) subjects26.extendleft(reversed(tmp87)) subjects26.appendleft(tmp84) subjects.appendleft(tmp25) if len(subjects) >= 1 and isinstance(subjects[0], tan): tmp90 = subjects.popleft() subjects91 = deque(tmp90._args) # State 80016 subst1 = Substitution(subst0) try: subst1.try_add_variable('i2.2.2.2.0', S(0)) except ValueError: pass else: pass # State 80017 subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.2.2.1.0_1', S(1)) except ValueError: pass else: pass # State 80018 if len(subjects91) >= 1: tmp94 = subjects91.popleft() subst3 = Substitution(subst2) try: subst3.try_add_variable('i2.2.2.2.1.0', tmp94) except ValueError: pass else: pass # State 80019 if len(subjects91) == 0: pass # State 80020 if len(subjects) == 0: pass # 4: tan(e + x*f) yield 4, subst3 subjects91.appendleft(tmp94) if len(subjects91) >= 1 and isinstance(subjects91[0], Mul): tmp96 = subjects91.popleft() associative1 = tmp96 associative_type1 = type(tmp96) subjects97 = deque(tmp96._args) matcher = CommutativeMatcher80022.get() tmp98 = subjects97 subjects97 = [] for s in tmp98: matcher.add_subject(s) for pattern_index, subst2 in matcher.match(tmp98, subst1): pass if pattern_index == 0: pass # State 80023 if len(subjects91) == 0: pass # State 80024 if len(subjects) == 0: pass # 4: tan(e + x*f) yield 4, subst2 subjects91.appendleft(tmp96) if len(subjects91) >= 1 and isinstance(subjects91[0], Add): tmp99 = subjects91.popleft() associative1 = tmp99 associative_type1 = type(tmp99) subjects100 = deque(tmp99._args) matcher = CommutativeMatcher80026.get() tmp101 = subjects100 subjects100 = [] for s in tmp101: matcher.add_subject(s) for pattern_index, subst1 in matcher.match(tmp101, subst0): pass if pattern_index == 0: pass # State 80032 if len(subjects91) == 0: pass # State 80033 if len(subjects) == 0: pass # 4: tan(e + x*f) yield 4, subst1 subjects91.appendleft(tmp99) subjects.appendleft(tmp90) subst1 = Substitution(subst0) try: subst1.try_add_variable('i2.2.2.1.0', S(0)) except ValueError: pass else: pass # State 102490 subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.2.1.1.0_1', S(1)) except ValueError: pass else: pass # State 102491 if len(subjects) >= 1: tmp104 = subjects.popleft() subst3 = Substitution(subst2) try: subst3.try_add_variable('i2.2.2.1.1.0', tmp104) except ValueError: pass else: pass # State 102492 if len(subjects) == 0: pass # 6: c + x*d yield 6, subst3 subjects.appendleft(tmp104) if len(subjects) >= 1 and isinstance(subjects[0], Mul): tmp106 = subjects.popleft() associative1 = tmp106 associative_type1 = type(tmp106) subjects107 = deque(tmp106._args) matcher = CommutativeMatcher102494.get() tmp108 = subjects107 subjects107 = [] for s in tmp108: matcher.add_subject(s) for pattern_index, subst2 in matcher.match(tmp108, subst1): pass if pattern_index == 0: pass # State 102495 if len(subjects) == 0: pass # 6: c + x*d yield 6, subst2 subjects.appendleft(tmp106) if len(subjects) >= 1 and isinstance(subjects[0], Add): tmp109 = subjects.popleft() associative1 = tmp109 associative_type1 = type(tmp109) subjects110 = deque(tmp109._args) matcher = CommutativeMatcher102497.get() tmp111 = subjects110 subjects110 = [] for s in tmp111: matcher.add_subject(s) for pattern_index, subst1 in matcher.match(tmp111, subst0): pass if pattern_index == 0: pass # State 102503 if len(subjects) == 0: pass # 6: c + x*d yield 6, subst1 subjects.appendleft(tmp109) return yield
class CommutativeMatcher47935(CommutativeMatcher): _instance = None patterns = { 0: (0, Multiset({0: 1, 1: 1}), [ (VariableWithCount('i2.2.2.0', 1, 1, S(1)), Mul) ]), 1: (1, Multiset({2: 1, 3: 1}), [ (VariableWithCount('i2.2.2.0', 1, 1, S(1)), Mul) ]) } subjects = {} subjects_by_id = {} bipartite = BipartiteGraph() associative = Mul max_optional_count = 1 anonymous_patterns = set() def __init__(self): self.add_subject(None) @staticmethod def get(): if CommutativeMatcher47935._instance is None: CommutativeMatcher47935._instance = CommutativeMatcher47935() return CommutativeMatcher47935._instance @staticmethod def get_match_iter(subject): subjects = deque([subject]) if subject is not None else deque() subst0 = Substitution() # State 47934 subst1 = Substitution(subst0) try: subst1.try_add_variable('i2.2.2.2', S(1)) except ValueError: pass else: pass # State 47936 subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.2.2.0', S(0)) except ValueError: pass else: pass # State 47937 subst3 = Substitution(subst2) try: subst3.try_add_variable('i2.2.2.2.1.0', S(1)) except ValueError: pass else: pass # State 47938 if len(subjects) >= 1: tmp4 = subjects.popleft() subst4 = Substitution(subst3) try: subst4.try_add_variable('i2.2.1.0', tmp4) except ValueError: pass else: pass # State 47939 if len(subjects) == 0: pass # 0: (x*b + a)**n1 yield 0, subst4 subjects.appendleft(tmp4) if len(subjects) >= 1: tmp6 = subjects.popleft() subst4 = Substitution(subst3) try: subst4.try_add_variable('i2.2.1.1', tmp6) except ValueError: pass else: pass # State 48786 if len(subjects) == 0: pass # 2: (x*b + a)**n1 yield 2, subst4 subjects.appendleft(tmp6) if len(subjects) >= 1 and isinstance(subjects[0], Mul): tmp8 = subjects.popleft() associative1 = tmp8 associative_type1 = type(tmp8) subjects9 = deque(tmp8._args) matcher = CommutativeMatcher47941.get() tmp10 = subjects9 subjects9 = [] for s in tmp10: matcher.add_subject(s) for pattern_index, subst3 in matcher.match(tmp10, subst2): pass if pattern_index == 0: pass # State 47942 if len(subjects) == 0: pass # 0: (x*b + a)**n1 yield 0, subst3 if pattern_index == 1: pass # State 48787 if len(subjects) == 0: pass # 2: (x*b + a)**n1 yield 2, subst3 subjects.appendleft(tmp8) if len(subjects) >= 1 and isinstance(subjects[0], Add): tmp11 = subjects.popleft() associative1 = tmp11 associative_type1 = type(tmp11) subjects12 = deque(tmp11._args) matcher = CommutativeMatcher47944.get() tmp13 = subjects12 subjects12 = [] for s in tmp13: matcher.add_subject(s) for pattern_index, subst2 in matcher.match(tmp13, subst1): pass if pattern_index == 0: pass # State 47950 if len(subjects) == 0: pass # 0: (x*b + a)**n1 yield 0, subst2 if pattern_index == 1: pass # State 48790 if len(subjects) == 0: pass # 2: (x*b + a)**n1 yield 2, subst2 subjects.appendleft(tmp11) if len(subjects) >= 1 and isinstance(subjects[0], Pow): tmp14 = subjects.popleft() subjects15 = deque(tmp14._args) # State 47951 subst1 = Substitution(subst0) try: subst1.try_add_variable('i2.2.2.2.0', S(0)) except ValueError: pass else: pass # State 47952 subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.2.2.1.0', S(1)) except ValueError: pass else: pass # State 47953 if len(subjects15) >= 1: tmp18 = subjects15.popleft() subst3 = Substitution(subst2) try: subst3.try_add_variable('i2.2.1.0', tmp18) except ValueError: pass else: pass # State 47954 subst4 = Substitution(subst3) try: subst4.try_add_variable('i2.2.2.2', 1) except ValueError: pass else: pass # State 47955 if len(subjects15) == 0: pass # State 47956 if len(subjects) == 0: pass # 0: (x*b + a)**n1 yield 0, subst4 if len(subjects15) >= 1: tmp21 = subjects15.popleft() subst4 = Substitution(subst3) try: subst4.try_add_variable('i2.2.2.2', tmp21) except ValueError: pass else: pass # State 47955 if len(subjects15) == 0: pass # State 47956 if len(subjects) == 0: pass # 0: (x*b + a)**n1 yield 0, subst4 subjects15.appendleft(tmp21) subjects15.appendleft(tmp18) if len(subjects15) >= 1: tmp23 = subjects15.popleft() subst3 = Substitution(subst2) try: subst3.try_add_variable('i2.2.1.1', tmp23) except ValueError: pass else: pass # State 48791 subst4 = Substitution(subst3) try: subst4.try_add_variable('i2.2.2.2', 1) except ValueError: pass else: pass # State 48792 if len(subjects15) == 0: pass # State 48793 if len(subjects) == 0: pass # 2: (x*b + a)**n1 yield 2, subst4 if len(subjects15) >= 1: tmp26 = subjects15.popleft() subst4 = Substitution(subst3) try: subst4.try_add_variable('i2.2.2.2', tmp26) except ValueError: pass else: pass # State 48792 if len(subjects15) == 0: pass # State 48793 if len(subjects) == 0: pass # 2: (x*b + a)**n1 yield 2, subst4 subjects15.appendleft(tmp26) subjects15.appendleft(tmp23) if len(subjects15) >= 1 and isinstance(subjects15[0], Mul): tmp28 = subjects15.popleft() associative1 = tmp28 associative_type1 = type(tmp28) subjects29 = deque(tmp28._args) matcher = CommutativeMatcher47958.get() tmp30 = subjects29 subjects29 = [] for s in tmp30: matcher.add_subject(s) for pattern_index, subst2 in matcher.match(tmp30, subst1): pass if pattern_index == 0: pass # State 47959 subst3 = Substitution(subst2) try: subst3.try_add_variable('i2.2.2.2', 1) except ValueError: pass else: pass # State 47960 if len(subjects15) == 0: pass # State 47961 if len(subjects) == 0: pass # 0: (x*b + a)**n1 yield 0, subst3 if len(subjects15) >= 1: tmp32 = [] tmp32.append(subjects15.popleft()) while True: if len(tmp32) > 1: tmp33 = create_operation_expression(associative1, tmp32) elif len(tmp32) == 1: tmp33 = tmp32[0] else: assert False, "Unreachable" subst3 = Substitution(subst2) try: subst3.try_add_variable('i2.2.2.2', tmp33) except ValueError: pass else: pass # State 47960 if len(subjects15) == 0: pass # State 47961 if len(subjects) == 0: pass # 0: (x*b + a)**n1 yield 0, subst3 if len(subjects15) == 0: break tmp32.append(subjects15.popleft()) subjects15.extendleft(reversed(tmp32)) if pattern_index == 1: pass # State 48794 subst3 = Substitution(subst2) try: subst3.try_add_variable('i2.2.2.2', 1) except ValueError: pass else: pass # State 48795 if len(subjects15) == 0: pass # State 48796 if len(subjects) == 0: pass # 2: (x*b + a)**n1 yield 2, subst3 if len(subjects15) >= 1: tmp36 = [] tmp36.append(subjects15.popleft()) while True: if len(tmp36) > 1: tmp37 = create_operation_expression(associative1, tmp36) elif len(tmp36) == 1: tmp37 = tmp36[0] else: assert False, "Unreachable" subst3 = Substitution(subst2) try: subst3.try_add_variable('i2.2.2.2', tmp37) except ValueError: pass else: pass # State 48795 if len(subjects15) == 0: pass # State 48796 if len(subjects) == 0: pass # 2: (x*b + a)**n1 yield 2, subst3 if len(subjects15) == 0: break tmp36.append(subjects15.popleft()) subjects15.extendleft(reversed(tmp36)) subjects15.appendleft(tmp28) subst1 = Substitution(subst0) try: subst1.try_add_variable('i2.2.2.2.0_1', S(0)) except ValueError: pass else: pass # State 47972 subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.2.2.1.0_1', S(1)) except ValueError: pass else: pass # State 47973 if len(subjects15) >= 1: tmp41 = subjects15.popleft() subst3 = Substitution(subst2) try: subst3.try_add_variable('i2.2.1.0', tmp41) except ValueError: pass else: pass # State 47974 if len(subjects15) >= 1: tmp43 = subjects15.popleft() subst4 = Substitution(subst3) try: subst4.try_add_variable('i2.2.2.2_1', tmp43) except ValueError: pass else: pass # State 47975 if len(subjects15) == 0: pass # State 47976 if len(subjects) == 0: pass # 1: (x*d + c)**n2 yield 1, subst4 subjects15.appendleft(tmp43) subjects15.appendleft(tmp41) if len(subjects15) >= 1: tmp45 = subjects15.popleft() subst3 = Substitution(subst2) try: subst3.try_add_variable('i2.2.1.1', tmp45) except ValueError: pass else: pass # State 48802 if len(subjects15) >= 1: tmp47 = subjects15.popleft() subst4 = Substitution(subst3) try: subst4.try_add_variable('i2.2.2.2_1', tmp47) except ValueError: pass else: pass # State 48803 if len(subjects15) == 0: pass # State 48804 if len(subjects) == 0: pass # 3: (x*d + c)**n2 yield 3, subst4 subjects15.appendleft(tmp47) subjects15.appendleft(tmp45) if len(subjects15) >= 1 and isinstance(subjects15[0], Mul): tmp49 = subjects15.popleft() associative1 = tmp49 associative_type1 = type(tmp49) subjects50 = deque(tmp49._args) matcher = CommutativeMatcher47978.get() tmp51 = subjects50 subjects50 = [] for s in tmp51: matcher.add_subject(s) for pattern_index, subst2 in matcher.match(tmp51, subst1): pass if pattern_index == 0: pass # State 47979 if len(subjects15) >= 1: tmp52 = [] tmp52.append(subjects15.popleft()) while True: if len(tmp52) > 1: tmp53 = create_operation_expression(associative1, tmp52) elif len(tmp52) == 1: tmp53 = tmp52[0] else: assert False, "Unreachable" subst3 = Substitution(subst2) try: subst3.try_add_variable('i2.2.2.2_1', tmp53) except ValueError: pass else: pass # State 47980 if len(subjects15) == 0: pass # State 47981 if len(subjects) == 0: pass # 1: (x*d + c)**n2 yield 1, subst3 if len(subjects15) == 0: break tmp52.append(subjects15.popleft()) subjects15.extendleft(reversed(tmp52)) if pattern_index == 1: pass # State 48805 if len(subjects15) >= 1: tmp55 = [] tmp55.append(subjects15.popleft()) while True: if len(tmp55) > 1: tmp56 = create_operation_expression(associative1, tmp55) elif len(tmp55) == 1: tmp56 = tmp55[0] else: assert False, "Unreachable" subst3 = Substitution(subst2) try: subst3.try_add_variable('i2.2.2.2_1', tmp56) except ValueError: pass else: pass # State 48806 if len(subjects15) == 0: pass # State 48807 if len(subjects) == 0: pass # 3: (x*d + c)**n2 yield 3, subst3 if len(subjects15) == 0: break tmp55.append(subjects15.popleft()) subjects15.extendleft(reversed(tmp55)) subjects15.appendleft(tmp49) if len(subjects15) >= 1 and isinstance(subjects15[0], Add): tmp58 = subjects15.popleft() associative1 = tmp58 associative_type1 = type(tmp58) subjects59 = deque(tmp58._args) matcher = CommutativeMatcher47963.get() tmp60 = subjects59 subjects59 = [] for s in tmp60: matcher.add_subject(s) for pattern_index, subst1 in matcher.match(tmp60, subst0): pass if pattern_index == 0: pass # State 47969 subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.2.2', 1) except ValueError: pass else: pass # State 47970 if len(subjects15) == 0: pass # State 47971 if len(subjects) == 0: pass # 0: (x*b + a)**n1 yield 0, subst2 if len(subjects15) >= 1: tmp62 = [] tmp62.append(subjects15.popleft()) while True: if len(tmp62) > 1: tmp63 = create_operation_expression(associative1, tmp62) elif len(tmp62) == 1: tmp63 = tmp62[0] else: assert False, "Unreachable" subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.2.2', tmp63) except ValueError: pass else: pass # State 47970 if len(subjects15) == 0: pass # State 47971 if len(subjects) == 0: pass # 0: (x*b + a)**n1 yield 0, subst2 if len(subjects15) == 0: break tmp62.append(subjects15.popleft()) subjects15.extendleft(reversed(tmp62)) if pattern_index == 1: pass # State 47985 if len(subjects15) >= 1: tmp65 = [] tmp65.append(subjects15.popleft()) while True: if len(tmp65) > 1: tmp66 = create_operation_expression(associative1, tmp65) elif len(tmp65) == 1: tmp66 = tmp65[0] else: assert False, "Unreachable" subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.2.2_1', tmp66) except ValueError: pass else: pass # State 47986 if len(subjects15) == 0: pass # State 47987 if len(subjects) == 0: pass # 1: (x*d + c)**n2 yield 1, subst2 if len(subjects15) == 0: break tmp65.append(subjects15.popleft()) subjects15.extendleft(reversed(tmp65)) if pattern_index == 2: pass # State 48799 subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.2.2', 1) except ValueError: pass else: pass # State 48800 if len(subjects15) == 0: pass # State 48801 if len(subjects) == 0: pass # 2: (x*b + a)**n1 yield 2, subst2 if len(subjects15) >= 1: tmp69 = [] tmp69.append(subjects15.popleft()) while True: if len(tmp69) > 1: tmp70 = create_operation_expression(associative1, tmp69) elif len(tmp69) == 1: tmp70 = tmp69[0] else: assert False, "Unreachable" subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.2.2', tmp70) except ValueError: pass else: pass # State 48800 if len(subjects15) == 0: pass # State 48801 if len(subjects) == 0: pass # 2: (x*b + a)**n1 yield 2, subst2 if len(subjects15) == 0: break tmp69.append(subjects15.popleft()) subjects15.extendleft(reversed(tmp69)) if pattern_index == 3: pass # State 48810 if len(subjects15) >= 1: tmp72 = [] tmp72.append(subjects15.popleft()) while True: if len(tmp72) > 1: tmp73 = create_operation_expression(associative1, tmp72) elif len(tmp72) == 1: tmp73 = tmp72[0] else: assert False, "Unreachable" subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.2.2_1', tmp73) except ValueError: pass else: pass # State 48811 if len(subjects15) == 0: pass # State 48812 if len(subjects) == 0: pass # 3: (x*d + c)**n2 yield 3, subst2 if len(subjects15) == 0: break tmp72.append(subjects15.popleft()) subjects15.extendleft(reversed(tmp72)) subjects15.appendleft(tmp58) subjects.appendleft(tmp14) return yield
class CommutativeMatcher97582(CommutativeMatcher): _instance = None patterns = { 0: (0, Multiset({0: 1}), [ (VariableWithCount('i3.1.3.1.0', 1, 1, S(1)), Mul) ]), 1: (1, Multiset({1: 1}), [ (VariableWithCount('i3.1.3.1.0', 1, 1, S(1)), Mul) ]), 2: (2, Multiset({2: 1}), [ (VariableWithCount('i3.1.3.1.0', 1, 1, S(1)), Mul) ]) } subjects = {} subjects_by_id = {} bipartite = BipartiteGraph() associative = Mul max_optional_count = 1 anonymous_patterns = set() def __init__(self): self.add_subject(None) @staticmethod def get(): if CommutativeMatcher97582._instance is None: CommutativeMatcher97582._instance = CommutativeMatcher97582() return CommutativeMatcher97582._instance @staticmethod def get_match_iter(subject): subjects = deque([subject]) if subject is not None else deque() subst0 = Substitution() # State 97581 if len(subjects) >= 1 and isinstance(subjects[0], Pow): tmp1 = subjects.popleft() subjects2 = deque(tmp1._args) # State 97583 if len(subjects2) >= 1: tmp3 = subjects2.popleft() subst1 = Substitution(subst0) try: subst1.try_add_variable('i3.1.3.1.1', tmp3) except ValueError: pass else: pass # State 97584 if len(subjects2) >= 1: tmp5 = subjects2.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i3.1.3.1.2', tmp5) except ValueError: pass else: pass # State 97585 if len(subjects2) == 0: pass # State 97586 if len(subjects) == 0: pass # 0: x**n /; (cons_f2) and (cons_f3) and (cons_f8) and (cons_f29) and (cons_f5) and (cons_f1575) yield 0, subst2 # 1: x**n /; (cons_f2) and (cons_f3) and (cons_f8) and (cons_f29) and (cons_f4) and (cons_f5) and (cons_f1497) yield 1, subst2 # 2: x**n /; (cons_f4) and (cons_f70) and (cons_f71) yield 2, subst2 subjects2.appendleft(tmp5) subjects2.appendleft(tmp3) subjects.appendleft(tmp1) return yield
class CommutativeMatcher133344(CommutativeMatcher): _instance = None patterns = { 0: (0, Multiset({0: 1}), [(VariableWithCount('i4.1.2.0', 1, 1, S(1)), Mul)]), 1: (1, Multiset({1: 1}), [(VariableWithCount('i4.1.2.0', 1, 1, S(1)), Mul)]), 2: (2, Multiset({2: 1}), [(VariableWithCount('i4.1.2.0', 1, 1, S(1)), Mul)]), 3: (3, Multiset({3: 1}), [(VariableWithCount('i4.1.2.0', 1, 1, S(1)), Mul)]), 4: (4, Multiset({4: 1}), [(VariableWithCount('i4.1.2.0', 1, 1, S(1)), Mul)]), 5: (5, Multiset({5: 1}), [(VariableWithCount('i4.1.2.0', 1, 1, S(1)), Mul)]), 6: (6, Multiset({6: 1}), [(VariableWithCount('i4.1.2.0', 1, 1, S(1)), Mul)]) } subjects = {} subjects_by_id = {} bipartite = BipartiteGraph() associative = Mul max_optional_count = 1 anonymous_patterns = set() def __init__(self): self.add_subject(None) @staticmethod def get(): if CommutativeMatcher133344._instance is None: CommutativeMatcher133344._instance = CommutativeMatcher133344() return CommutativeMatcher133344._instance @staticmethod def get_match_iter(subject): subjects = deque([subject]) if subject is not None else deque() subst0 = Substitution() # State 133343 subst1 = Substitution(subst0) try: subst1.try_add_variable('i4.1.2.2', S(1)) except ValueError: pass else: pass # State 133345 if len(subjects) >= 1: tmp2 = subjects.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i4.1.2.1', tmp2) except ValueError: pass else: pass # State 133346 if len(subjects) == 0: pass # 0: x**n /; (cons_f2) and (cons_f3) and (cons_f8) and (cons_f4) and (cons_f5) and (cons_f1876) yield 0, subst2 # 1: x**n /; (cons_f2) and (cons_f3) and (cons_f8) and (cons_f4) and (cons_f1877) yield 1, subst2 # 2: x**n /; (cons_f2) and (cons_f3) and (cons_f8) and (cons_f4) and (cons_f1878) yield 2, subst2 # 3: x**n /; (cons_f2) and (cons_f3) and (cons_f8) and (cons_f4) and (cons_f1880) yield 3, subst2 # 4: x**n /; (cons_f2) and (cons_f3) and (cons_f8) and (cons_f4) and (cons_f1881) yield 4, subst2 # 5: x**n /; (cons_f2) and (cons_f3) and (cons_f8) and (cons_f4) and (cons_f5) and (cons_f1880) yield 5, subst2 # 6: x**n /; (cons_f2) and (cons_f3) and (cons_f8) and (cons_f4) and (cons_f1887) yield 6, subst2 subjects.appendleft(tmp2) if len(subjects) >= 1 and isinstance(subjects[0], Pow): tmp4 = subjects.popleft() subjects5 = deque(tmp4._args) # State 133347 if len(subjects5) >= 1: tmp6 = subjects5.popleft() subst1 = Substitution(subst0) try: subst1.try_add_variable('i4.1.2.1', tmp6) except ValueError: pass else: pass # State 133348 subst2 = Substitution(subst1) try: subst2.try_add_variable('i4.1.2.2', 1) except ValueError: pass else: pass # State 133349 if len(subjects5) == 0: pass # State 133350 if len(subjects) == 0: pass # 0: x**n /; (cons_f2) and (cons_f3) and (cons_f8) and (cons_f4) and (cons_f5) and (cons_f1876) yield 0, subst2 # 1: x**n /; (cons_f2) and (cons_f3) and (cons_f8) and (cons_f4) and (cons_f1877) yield 1, subst2 # 2: x**n /; (cons_f2) and (cons_f3) and (cons_f8) and (cons_f4) and (cons_f1878) yield 2, subst2 # 3: x**n /; (cons_f2) and (cons_f3) and (cons_f8) and (cons_f4) and (cons_f1880) yield 3, subst2 # 4: x**n /; (cons_f2) and (cons_f3) and (cons_f8) and (cons_f4) and (cons_f1881) yield 4, subst2 # 5: x**n /; (cons_f2) and (cons_f3) and (cons_f8) and (cons_f4) and (cons_f5) and (cons_f1880) yield 5, subst2 # 6: x**n /; (cons_f2) and (cons_f3) and (cons_f8) and (cons_f4) and (cons_f1887) yield 6, subst2 if len(subjects5) >= 1: tmp9 = subjects5.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i4.1.2.2', tmp9) except ValueError: pass else: pass # State 133349 if len(subjects5) == 0: pass # State 133350 if len(subjects) == 0: pass # 0: x**n /; (cons_f2) and (cons_f3) and (cons_f8) and (cons_f4) and (cons_f5) and (cons_f1876) yield 0, subst2 # 1: x**n /; (cons_f2) and (cons_f3) and (cons_f8) and (cons_f4) and (cons_f1877) yield 1, subst2 # 2: x**n /; (cons_f2) and (cons_f3) and (cons_f8) and (cons_f4) and (cons_f1878) yield 2, subst2 # 3: x**n /; (cons_f2) and (cons_f3) and (cons_f8) and (cons_f4) and (cons_f1880) yield 3, subst2 # 4: x**n /; (cons_f2) and (cons_f3) and (cons_f8) and (cons_f4) and (cons_f1881) yield 4, subst2 # 5: x**n /; (cons_f2) and (cons_f3) and (cons_f8) and (cons_f4) and (cons_f5) and (cons_f1880) yield 5, subst2 # 6: x**n /; (cons_f2) and (cons_f3) and (cons_f8) and (cons_f4) and (cons_f1887) yield 6, subst2 subjects5.appendleft(tmp9) subjects5.appendleft(tmp6) subjects.appendleft(tmp4) return yield
class CommutativeMatcher24724(CommutativeMatcher): _instance = None patterns = { 0: (0, Multiset({0: 1}), [ (VariableWithCount('i2.1.1.2.2.2.0', 1, 1, S(0)), Add) ]), 1: (1, Multiset({1: 1}), [ (VariableWithCount('i2.1.1.2.2.2.0', 1, 1, S(0)), Add) ]), 2: (2, Multiset({1: 1}), [ (VariableWithCount('i2.1.1.2.2.2.0', 1, 1, None), Add) ]), 3: (3, Multiset({2: 1}), [ (VariableWithCount('i2.1.1.2.2.2.0', 1, 1, S(0)), Add) ]) } subjects = {} subjects_by_id = {} bipartite = BipartiteGraph() associative = Add max_optional_count = 1 anonymous_patterns = set() def __init__(self): self.add_subject(None) @staticmethod def get(): if CommutativeMatcher24724._instance is None: CommutativeMatcher24724._instance = CommutativeMatcher24724() return CommutativeMatcher24724._instance @staticmethod def get_match_iter(subject): subjects = deque([subject]) if subject is not None else deque() subst0 = Substitution() # State 24723 subst1 = Substitution(subst0) try: subst1.try_add_variable('i2.1.1.2.2.2.1.0', S(1)) except ValueError: pass else: pass # State 24725 if len(subjects) >= 1: tmp2 = subjects.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.1.0', tmp2) except ValueError: pass else: pass # State 24726 if len(subjects) == 0: pass # 0: f*x yield 0, subst2 subjects.appendleft(tmp2) if len(subjects) >= 1: tmp4 = subjects.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.1.1', tmp4) except ValueError: pass else: pass # State 26856 if len(subjects) == 0: pass # 1: f*x yield 1, subst2 subjects.appendleft(tmp4) if len(subjects) >= 1: tmp6 = subjects.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.3.1.0', tmp6) except ValueError: pass else: pass # State 27923 if len(subjects) == 0: pass # 2: f*x yield 2, subst2 subjects.appendleft(tmp6) if len(subjects) >= 1 and isinstance(subjects[0], Mul): tmp8 = subjects.popleft() associative1 = tmp8 associative_type1 = type(tmp8) subjects9 = deque(tmp8._args) matcher = CommutativeMatcher24728.get() tmp10 = subjects9 subjects9 = [] for s in tmp10: matcher.add_subject(s) for pattern_index, subst1 in matcher.match(tmp10, subst0): pass if pattern_index == 0: pass # State 24729 if len(subjects) == 0: pass # 0: f*x yield 0, subst1 if pattern_index == 1: pass # State 26857 if len(subjects) == 0: pass # 1: f*x yield 1, subst1 if pattern_index == 2: pass # State 27924 if len(subjects) == 0: pass # 2: f*x yield 2, subst1 subjects.appendleft(tmp8) return yield
class CommutativeMatcher73095(CommutativeMatcher): _instance = None patterns = { 0: (0, Multiset({0: 1}), [(VariableWithCount('i3.1.2.0', 1, 1, S(0)), Add)]), 1: (1, Multiset({1: 1}), [(VariableWithCount('i3.1.2.0', 1, 1, S(0)), Add)]), 2: (2, Multiset({2: 1}), [(VariableWithCount('i3.1.2.0', 1, 1, S(0)), Add)]) } subjects = {} subjects_by_id = {} bipartite = BipartiteGraph() associative = Add max_optional_count = 1 anonymous_patterns = set() def __init__(self): self.add_subject(None) @staticmethod def get(): if CommutativeMatcher73095._instance is None: CommutativeMatcher73095._instance = CommutativeMatcher73095() return CommutativeMatcher73095._instance @staticmethod def get_match_iter(subject): subjects = deque([subject]) if subject is not None else deque() subst0 = Substitution() # State 73094 subst1 = Substitution(subst0) try: subst1.try_add_variable('i3.1.2.1.0', S(1)) except ValueError: pass else: pass # State 73096 if len(subjects) >= 1 and isinstance(subjects[0], Pow): tmp2 = subjects.popleft() subjects3 = deque(tmp2._args) # State 73097 if len(subjects3) >= 1: tmp4 = subjects3.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i3.1.2.1.1', tmp4) except ValueError: pass else: pass # State 73098 if len(subjects3) >= 1: tmp6 = subjects3.popleft() subst3 = Substitution(subst2) try: subst3.try_add_variable('i3.1.2.1.2', tmp6) except ValueError: pass else: pass # State 73099 if len(subjects3) == 0: pass # State 73100 if len(subjects) == 0: pass # 0: d*x**n /; (cons_f2) and (cons_f3) and (cons_f8) and (cons_f29) and (cons_f198) yield 0, subst3 # 1: d*x**n /; (cons_f2) and (cons_f3) and (cons_f8) and (cons_f29) and (cons_f491) yield 1, subst3 # 2: d*x**n /; (cons_f29) and (cons_f4) and (cons_f70) and (cons_f71) yield 2, subst3 subjects3.appendleft(tmp6) subjects3.appendleft(tmp4) subjects.appendleft(tmp2) if len(subjects) >= 1 and isinstance(subjects[0], Mul): tmp8 = subjects.popleft() associative1 = tmp8 associative_type1 = type(tmp8) subjects9 = deque(tmp8._args) matcher = CommutativeMatcher73102.get() tmp10 = subjects9 subjects9 = [] for s in tmp10: matcher.add_subject(s) for pattern_index, subst1 in matcher.match(tmp10, subst0): pass if pattern_index == 0: pass # State 73107 if len(subjects) == 0: pass # 0: d*x**n /; (cons_f2) and (cons_f3) and (cons_f8) and (cons_f29) and (cons_f198) yield 0, subst1 # 1: d*x**n /; (cons_f2) and (cons_f3) and (cons_f8) and (cons_f29) and (cons_f491) yield 1, subst1 # 2: d*x**n /; (cons_f29) and (cons_f4) and (cons_f70) and (cons_f71) yield 2, subst1 subjects.appendleft(tmp8) return yield
class CommutativeMatcher14058(CommutativeMatcher): _instance = None patterns = { 0: (0, Multiset({0: 1}), [(VariableWithCount('i2.2.1.2.1.0', 1, 1, S(1)), Mul)]) } subjects = {} subjects_by_id = {} bipartite = BipartiteGraph() associative = Mul max_optional_count = 1 anonymous_patterns = set() def __init__(self): self.add_subject(None) @staticmethod def get(): if CommutativeMatcher14058._instance is None: CommutativeMatcher14058._instance = CommutativeMatcher14058() return CommutativeMatcher14058._instance @staticmethod def get_match_iter(subject): subjects = deque([subject]) if subject is not None else deque() subst0 = Substitution() # State 14057 subst1 = Substitution(subst0) try: subst1.try_add_variable('i2.2.1.2.1.2', S(1)) except ValueError: pass else: pass # State 14059 if len(subjects) >= 1: tmp2 = subjects.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.1.2.1.1', tmp2) except ValueError: pass else: pass # State 14060 if len(subjects) == 0: pass # 0: x**p yield 0, subst2 subjects.appendleft(tmp2) if len(subjects) >= 1 and isinstance(subjects[0], Pow): tmp4 = subjects.popleft() subjects5 = deque(tmp4._args) # State 14061 if len(subjects5) >= 1: tmp6 = subjects5.popleft() subst1 = Substitution(subst0) try: subst1.try_add_variable('i2.2.1.2.1.1', tmp6) except ValueError: pass else: pass # State 14062 subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.1.2.1.2', 1) except ValueError: pass else: pass # State 14063 if len(subjects5) == 0: pass # State 14064 if len(subjects) == 0: pass # 0: x**p yield 0, subst2 if len(subjects5) >= 1: tmp9 = subjects5.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.1.2.1.2', tmp9) except ValueError: pass else: pass # State 14063 if len(subjects5) == 0: pass # State 14064 if len(subjects) == 0: pass # 0: x**p yield 0, subst2 subjects5.appendleft(tmp9) subjects5.appendleft(tmp6) subjects.appendleft(tmp4) return yield
class CommutativeMatcher3798(CommutativeMatcher): _instance = None patterns = { 0: (0, Multiset({}), [(VariableWithCount('i2.2.1.0', 1, 1, None), Mul), (VariableWithCount('i2.2.1.0_4', 1, 1, S(1)), Mul)]), 1: (1, Multiset({0: 1}), [(VariableWithCount('i2.2.1.0_4', 1, 1, S(1)), Mul)]), 2: (2, Multiset({}), [(VariableWithCount('i2.2.1.0', 1, 1, None), Mul), (VariableWithCount('i2.2.1.0_5', 1, 1, S(1)), Mul)]), 3: (3, Multiset({1: 1}), [(VariableWithCount('i2.2.1.0_1', 1, 1, S(1)), Mul)]), 4: (4, Multiset({2: 1}), [(VariableWithCount('i2.2.1.0_2', 1, 1, S(1)), Mul)]), 5: (5, Multiset({3: 1}), [(VariableWithCount('i2.2.1.0_2', 1, 1, S(1)), Mul)]), 6: (6, Multiset({4: 1}), [(VariableWithCount('i2.2.1.0_2', 1, 1, S(1)), Mul)]), 7: (7, Multiset({5: 1}), [(VariableWithCount('i2.2.1.0_2', 1, 1, S(1)), Mul)]), 8: (8, Multiset({5: 1}), [(VariableWithCount('i2.2.1.0_3', 1, 1, S(1)), Mul)]), 9: (9, Multiset({}), [(VariableWithCount('i2.2.1.0_6', 1, 1, None), Mul), (VariableWithCount('i2.2.1.0_7', 1, 1, S(1)), Mul)]) } subjects = {} subjects_by_id = {} bipartite = BipartiteGraph() associative = Mul max_optional_count = 1 anonymous_patterns = set() def __init__(self): self.add_subject(None) @staticmethod def get(): if CommutativeMatcher3798._instance is None: CommutativeMatcher3798._instance = CommutativeMatcher3798() return CommutativeMatcher3798._instance @staticmethod def get_match_iter(subject): subjects = deque([subject]) if subject is not None else deque() subst0 = Substitution() # State 3797 if len(subjects) >= 1 and isinstance(subjects[0], Pow): tmp1 = subjects.popleft() subjects2 = deque(tmp1._args) # State 5890 if len(subjects2) >= 1: tmp3 = subjects2.popleft() subst1 = Substitution(subst0) try: subst1.try_add_variable('i2.2.1.0', tmp3) except ValueError: pass else: pass # State 5891 if len(subjects2) >= 1 and subjects2[0] == Integer(2): tmp5 = subjects2.popleft() # State 5892 if len(subjects2) == 0: pass # State 5893 if len(subjects) == 0: pass # 0: v**2 yield 0, subst1 subjects2.appendleft(tmp5) subjects2.appendleft(tmp3) if len(subjects2) >= 1: tmp6 = subjects2.popleft() subst1 = Substitution(subst0) try: subst1.try_add_variable('i2.2.1', tmp6) except ValueError: pass else: pass # State 7913 if len(subjects2) >= 1: tmp8 = subjects2.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.2', tmp8) except ValueError: pass else: pass # State 7914 if len(subjects2) == 0: pass # State 7915 if len(subjects) == 0: pass # 1: x**n yield 1, subst2 subjects2.appendleft(tmp8) subjects2.appendleft(tmp6) if len(subjects2) >= 1: tmp10 = subjects2.popleft() subst1 = Substitution(subst0) try: subst1.try_add_variable('i2.2.0', tmp10) except ValueError: pass else: pass # State 7939 if len(subjects2) >= 1: tmp12 = subjects2.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.1.2', tmp12) except ValueError: pass else: pass # State 7940 if len(subjects2) == 0: pass # State 7941 if len(subjects) == 0: pass # 2: x**n yield 2, subst2 subjects2.appendleft(tmp12) subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.1.2_1', 1) except ValueError: pass else: pass # State 8104 if len(subjects2) == 0: pass # State 8105 if len(subjects) == 0: pass # 5: x**n2 yield 5, subst2 if len(subjects2) >= 1: tmp15 = subjects2.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.1.2_1', tmp15) except ValueError: pass else: pass # State 8104 if len(subjects2) == 0: pass # State 8105 if len(subjects) == 0: pass # 5: x**n2 yield 5, subst2 subjects2.appendleft(tmp15) subjects2.appendleft(tmp10) if len(subjects2) >= 1: tmp17 = subjects2.popleft() subst1 = Substitution(subst0) try: subst1.try_add_variable('i2.2.0_1', tmp17) except ValueError: pass else: pass # State 7969 if len(subjects2) >= 1: tmp19 = subjects2.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.1.2', tmp19) except ValueError: pass else: pass # State 7970 if len(subjects2) == 0: pass # State 7971 if len(subjects) == 0: pass # 3: x**n yield 3, subst2 subjects2.appendleft(tmp19) subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.1.2_1', 1) except ValueError: pass else: pass # State 8077 if len(subjects2) == 0: pass # State 8078 if len(subjects) == 0: pass # 4: x**n yield 4, subst2 if len(subjects2) >= 1: tmp22 = subjects2.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.1.2_1', tmp22) except ValueError: pass else: pass # State 8077 if len(subjects2) == 0: pass # State 8078 if len(subjects) == 0: pass # 4: x**n yield 4, subst2 subjects2.appendleft(tmp22) subjects2.appendleft(tmp17) subjects.appendleft(tmp1) subst1 = Substitution(subst0) try: subst1.try_add_variable('i2.2.1.2_1', S(1)) except ValueError: pass else: pass # State 8075 if len(subjects) >= 1: tmp25 = subjects.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.0_1', tmp25) except ValueError: pass else: pass # State 8076 if len(subjects) == 0: pass # 4: x**n yield 4, subst2 subjects.appendleft(tmp25) if len(subjects) >= 1: tmp27 = subjects.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.0', tmp27) except ValueError: pass else: pass # State 8103 if len(subjects) == 0: pass # 5: x**n2 yield 5, subst2 subjects.appendleft(tmp27) return yield
class CommutativeMatcher130773(CommutativeMatcher): _instance = None patterns = { 0: (0, Multiset({0: 1}), [(VariableWithCount('i2.2.1.3.1.0', 1, 1, S(1)), Mul)]) } subjects = {} subjects_by_id = {} bipartite = BipartiteGraph() associative = Mul max_optional_count = 1 anonymous_patterns = set() def __init__(self): self.add_subject(None) @staticmethod def get(): if CommutativeMatcher130773._instance is None: CommutativeMatcher130773._instance = CommutativeMatcher130773() return CommutativeMatcher130773._instance @staticmethod def get_match_iter(subject): subjects = deque([subject]) if subject is not None else deque() subst0 = Substitution() # State 130772 if len(subjects) >= 1 and isinstance(subjects[0], Pow): tmp1 = subjects.popleft() subjects2 = deque(tmp1._args) # State 130774 if len(subjects2) >= 1: tmp3 = subjects2.popleft() subst1 = Substitution(subst0) try: subst1.try_add_variable('i2.2.1.3.1.1', tmp3) except ValueError: pass else: pass # State 130775 if len(subjects2) >= 1: tmp5 = subjects2.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.1.3.1.2', tmp5) except ValueError: pass else: pass # State 130776 if len(subjects2) == 0: pass # State 130777 if len(subjects) == 0: pass # 0: x**n yield 0, subst2 subjects2.appendleft(tmp5) subjects2.appendleft(tmp3) subjects.appendleft(tmp1) return yield
class CommutativeMatcher102344(CommutativeMatcher): _instance = None patterns = { 0: (0, Multiset({0: 1}), [ (VariableWithCount('i2.2.2.0', 1, 1, None), Mul), (VariableWithCount('i2.2.2.0_1', 1, 1, S(1)), Mul) ]) } subjects = {} subjects_by_id = {} bipartite = BipartiteGraph() associative = Mul max_optional_count = 1 anonymous_patterns = set() def __init__(self): self.add_subject(None) @staticmethod def get(): if CommutativeMatcher102344._instance is None: CommutativeMatcher102344._instance = CommutativeMatcher102344() return CommutativeMatcher102344._instance @staticmethod def get_match_iter(subject): subjects = deque([subject]) if subject is not None else deque() subst0 = Substitution() # State 102343 subst1 = Substitution(subst0) try: subst1.try_add_variable('i2.2.2.1.0', S(0)) except ValueError: pass else: pass # State 102345 subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.2.1.1.0_1', S(1)) except ValueError: pass else: pass # State 102346 if len(subjects) >= 1: tmp3 = subjects.popleft() subst3 = Substitution(subst2) try: subst3.try_add_variable('i2.2.2.1.1.0', tmp3) except ValueError: pass else: pass # State 102347 if len(subjects) == 0: pass # 0: c + x*d /; (cons_f2) and (cons_f3) and (cons_f8) and (cons_f29) and (cons_f4) and (cons_f5) yield 0, subst3 subjects.appendleft(tmp3) if len(subjects) >= 1 and isinstance(subjects[0], Mul): tmp5 = subjects.popleft() associative1 = tmp5 associative_type1 = type(tmp5) subjects6 = deque(tmp5._args) matcher = CommutativeMatcher102349.get() tmp7 = subjects6 subjects6 = [] for s in tmp7: matcher.add_subject(s) for pattern_index, subst2 in matcher.match(tmp7, subst1): pass if pattern_index == 0: pass # State 102350 if len(subjects) == 0: pass # 0: c + x*d /; (cons_f2) and (cons_f3) and (cons_f8) and (cons_f29) and (cons_f4) and (cons_f5) yield 0, subst2 subjects.appendleft(tmp5) if len(subjects) >= 1 and isinstance(subjects[0], Add): tmp8 = subjects.popleft() associative1 = tmp8 associative_type1 = type(tmp8) subjects9 = deque(tmp8._args) matcher = CommutativeMatcher102352.get() tmp10 = subjects9 subjects9 = [] for s in tmp10: matcher.add_subject(s) for pattern_index, subst1 in matcher.match(tmp10, subst0): pass if pattern_index == 0: pass # State 102358 if len(subjects) == 0: pass # 0: c + x*d /; (cons_f2) and (cons_f3) and (cons_f8) and (cons_f29) and (cons_f4) and (cons_f5) yield 0, subst1 subjects.appendleft(tmp8) return yield
class CommutativeMatcher141768(CommutativeMatcher): _instance = None patterns = { 0: (0, Multiset({0: 1}), [(VariableWithCount('i4.3.0', 1, 1, S(0)), Add)]) } subjects = {} subjects_by_id = {} bipartite = BipartiteGraph() associative = Add max_optional_count = 1 anonymous_patterns = set() def __init__(self): self.add_subject(None) @staticmethod def get(): if CommutativeMatcher141768._instance is None: CommutativeMatcher141768._instance = CommutativeMatcher141768() return CommutativeMatcher141768._instance @staticmethod def get_match_iter(subject): subjects = deque([subject]) if subject is not None else deque() subst0 = Substitution() # State 141767 subst1 = Substitution(subst0) try: subst1.try_add_variable('i4.3.1.0_1', S(1)) except ValueError: pass else: pass # State 141769 if len(subjects) >= 1: tmp2 = subjects.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i4.3.1.0', tmp2) except ValueError: pass else: pass # State 141770 if len(subjects) == 0: pass # 0: x*b /; (cons_f2) and (cons_f3) and (cons_f8) and (cons_f127) yield 0, subst2 subjects.appendleft(tmp2) if len(subjects) >= 1 and isinstance(subjects[0], Mul): tmp4 = subjects.popleft() associative1 = tmp4 associative_type1 = type(tmp4) subjects5 = deque(tmp4._args) matcher = CommutativeMatcher141772.get() tmp6 = subjects5 subjects5 = [] for s in tmp6: matcher.add_subject(s) for pattern_index, subst1 in matcher.match(tmp6, subst0): pass if pattern_index == 0: pass # State 141773 if len(subjects) == 0: pass # 0: x*b /; (cons_f2) and (cons_f3) and (cons_f8) and (cons_f127) yield 0, subst1 subjects.appendleft(tmp4) return yield
class CommutativeMatcher57205(CommutativeMatcher): _instance = None patterns = { 0: (0, Multiset({0: 1}), [(VariableWithCount('i2.2.2.0', 1, 1, S(0)), Add)]), 1: (1, Multiset({1: 1}), [(VariableWithCount('i2.2.1.2.0', 1, 1, S(0)), Add)]), 2: (2, Multiset({2: 1}), [(VariableWithCount('i2.2.1.3.0', 1, 1, S(0)), Add)]), 3: (3, Multiset({3: 1}), [(VariableWithCount('i2.3.0', 1, 1, S(0)), Add)]), 4: (4, Multiset({4: 1}), [(VariableWithCount('i2.2.1.2.2.0', 1, 1, S(0)), Add)]), 5: (5, Multiset({5: 1}), [(VariableWithCount('i2.3.0', 1, 1, S(0)), Add)]), 6: (6, Multiset({6: 1}), [(VariableWithCount('i2.3.0', 1, 1, S(0)), Add)]), 7: (7, Multiset({7: 1}), [(VariableWithCount('i2.3.0', 1, 1, S(0)), Add)]), 8: (8, Multiset({ 8: 1, 9: 1 }), [(VariableWithCount('i2.3.0', 1, 1, S(0)), Add)]), 9: (9, Multiset({10: 1}), [(VariableWithCount('i2.4.0', 1, 1, S(0)), Add)]), 10: (10, Multiset({11: 1}), [(VariableWithCount('i2.2.3.0', 1, 1, S(0)), Add)]), 11: (11, Multiset({12: 1}), [(VariableWithCount('i2.2.1.2.3.0', 1, 1, S(0)), Add)]), 12: (12, Multiset({13: 1}), [(VariableWithCount('i2.2.1.4.0', 1, 1, S(0)), Add)]), 13: (13, Multiset({14: 1}), [(VariableWithCount('i2.3.0', 1, 1, S(0)), Add)]), 14: (14, Multiset({15: 1}), [(VariableWithCount('i2.2.1.2.0', 1, 1, S(0)), Add)]), 15: (15, Multiset({9: 1}), [(VariableWithCount('i2.3.0_1', 1, 1, S(0)), Add)]), 16: (16, Multiset({16: 1}), [(VariableWithCount('i2.3.0', 1, 1, S(0)), Add)]), 17: (17, Multiset({17: 1}), [(VariableWithCount('i2.3.0', 1, 1, S(0)), Add)]), 18: (18, Multiset({18: 1}), [(VariableWithCount('i2.2.1.3.0', 1, 1, S(0)), Add)]), 19: (19, Multiset({19: 1}), [(VariableWithCount('i2.3.0_1', 1, 1, S(0)), Add)]), 20: (20, Multiset({19: 1}), [(VariableWithCount('i2.3.0_1', 1, 1, None), Add)]) } subjects = {} subjects_by_id = {} bipartite = BipartiteGraph() associative = Add max_optional_count = 1 anonymous_patterns = set() def __init__(self): self.add_subject(None) @staticmethod def get(): if CommutativeMatcher57205._instance is None: CommutativeMatcher57205._instance = CommutativeMatcher57205() return CommutativeMatcher57205._instance @staticmethod def get_match_iter(subject): subjects = deque([subject]) if subject is not None else deque() subst0 = Substitution() # State 57204 subst1 = Substitution(subst0) try: subst1.try_add_variable('i2.2.2.1.0_1', S(1)) except ValueError: pass else: pass # State 57206 if len(subjects) >= 1: tmp2 = subjects.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.2.1.0', tmp2) except ValueError: pass else: pass # State 57207 if len(subjects) == 0: pass # 0: x*f yield 0, subst2 subjects.appendleft(tmp2) subst1 = Substitution(subst0) try: subst1.try_add_variable('i2.2.1.2.1.0_1', S(1)) except ValueError: pass else: pass # State 58406 if len(subjects) >= 1: tmp5 = subjects.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.1.2.1.0', tmp5) except ValueError: pass else: pass # State 58407 if len(subjects) == 0: pass # 1: x*d yield 1, subst2 subjects.appendleft(tmp5) subst1 = Substitution(subst0) try: subst1.try_add_variable('i2.2.1.3.1.0_1', S(1)) except ValueError: pass else: pass # State 64367 if len(subjects) >= 1: tmp8 = subjects.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.1.3.1.0', tmp8) except ValueError: pass else: pass # State 64368 if len(subjects) == 0: pass # 2: x*f yield 2, subst2 subjects.appendleft(tmp8) subst1 = Substitution(subst0) try: subst1.try_add_variable('i2.3.1.0_1', S(1)) except ValueError: pass else: pass # State 65747 if len(subjects) >= 1: tmp11 = subjects.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.3.1.0', tmp11) except ValueError: pass else: pass # State 65748 if len(subjects) == 0: pass # 3: x*f yield 3, subst2 subjects.appendleft(tmp11) if len(subjects) >= 1: tmp13 = subjects.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.1.0', tmp13) except ValueError: pass else: pass # State 75825 if len(subjects) == 0: pass # 9: x*b yield 9, subst2 subjects.appendleft(tmp13) subst1 = Substitution(subst0) try: subst1.try_add_variable('i2.2.1.2.2.1.0_1', S(1)) except ValueError: pass else: pass # State 68200 if len(subjects) >= 1: tmp16 = subjects.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.1.2.2.1.0', tmp16) except ValueError: pass else: pass # State 68201 if len(subjects) == 0: pass # 4: x*d yield 4, subst2 subjects.appendleft(tmp16) subst1 = Substitution(subst0) try: subst1.try_add_variable('i2.3.1.0', S(1)) except ValueError: pass else: pass # State 72101 if len(subjects) >= 1: tmp19 = subjects.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.1.0', tmp19) except ValueError: pass else: pass # State 72102 if len(subjects) == 0: pass # 5: x*f yield 5, subst2 subjects.appendleft(tmp19) subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.3.1.2', S(1)) except ValueError: pass else: pass # State 75573 if len(subjects) >= 1: tmp22 = subjects.popleft() subst3 = Substitution(subst2) try: subst3.try_add_variable('i2.3.1.1', tmp22) except ValueError: pass else: pass # State 75574 if len(subjects) == 0: pass # 7: b*x**n yield 7, subst3 subjects.appendleft(tmp22) if len(subjects) >= 1: tmp24 = subjects.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.2.1.0', tmp24) except ValueError: pass else: pass # State 100887 if len(subjects) == 0: pass # 14: x*b yield 14, subst2 subjects.appendleft(tmp24) if len(subjects) >= 1 and isinstance(subjects[0], Pow): tmp26 = subjects.popleft() subjects27 = deque(tmp26._args) # State 74655 if len(subjects27) >= 1: tmp28 = subjects27.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.3.1.1', tmp28) except ValueError: pass else: pass # State 74656 if len(subjects27) >= 1: tmp30 = subjects27.popleft() subst3 = Substitution(subst2) try: subst3.try_add_variable('i2.3.1.2', tmp30) except ValueError: pass else: pass # State 74657 if len(subjects27) == 0: pass # State 74658 if len(subjects) == 0: pass # 6: b*x**n yield 6, subst3 subjects27.appendleft(tmp30) subst3 = Substitution(subst2) try: subst3.try_add_variable('i2.3.1.2', 1) except ValueError: pass else: pass # State 75575 if len(subjects27) == 0: pass # State 75576 if len(subjects) == 0: pass # 7: b*x**n yield 7, subst3 if len(subjects27) >= 1: tmp33 = subjects27.popleft() subst3 = Substitution(subst2) try: subst3.try_add_variable('i2.3.1.2', tmp33) except ValueError: pass else: pass # State 75575 if len(subjects27) == 0: pass # State 75576 if len(subjects) == 0: pass # 7: b*x**n yield 7, subst3 subjects27.appendleft(tmp33) subjects27.appendleft(tmp28) if len(subjects27) >= 1: tmp35 = subjects27.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.1.0', tmp35) except ValueError: pass else: pass # State 75818 if len(subjects27) >= 1 and subjects27[0] == Integer( 2): tmp37 = subjects27.popleft() # State 75819 if len(subjects27) == 0: pass # State 75820 if len(subjects) == 0: pass # 8: v**2*c yield 8, subst2 subjects27.appendleft(tmp37) subjects27.appendleft(tmp35) if len(subjects27) >= 1 and isinstance(subjects27[0], Add): tmp38 = subjects27.popleft() associative1 = tmp38 associative_type1 = type(tmp38) subjects39 = deque(tmp38._args) matcher = CommutativeMatcher107464.get() tmp40 = subjects39 subjects39 = [] for s in tmp40: matcher.add_subject(s) for pattern_index, subst2 in matcher.match(tmp40, subst1): pass if pattern_index == 0: pass # State 107470 if len(subjects27) >= 1: tmp41 = [] tmp41.append(subjects27.popleft()) while True: if len(tmp41) > 1: tmp42 = create_operation_expression( associative1, tmp41) elif len(tmp41) == 1: tmp42 = tmp41[0] else: assert False, "Unreachable" subst3 = Substitution(subst2) try: subst3.try_add_variable( 'i2.3.1.2', tmp42) except ValueError: pass else: pass # State 107471 if len(subjects27) == 0: pass # State 107472 if len(subjects) == 0: pass # 17: b*(x*d + c)**n yield 17, subst3 if len(subjects27) == 0: break tmp41.append(subjects27.popleft()) subjects27.extendleft(reversed(tmp41)) subjects27.appendleft(tmp38) subjects.appendleft(tmp26) if len(subjects) >= 1 and isinstance(subjects[0], log): tmp44 = subjects.popleft() subjects45 = deque(tmp44._args) # State 105092 subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.3.1.2.0', S(1)) except ValueError: pass else: pass # State 105093 subst3 = Substitution(subst2) try: subst3.try_add_variable('i2.3.1.2.2', S(1)) except ValueError: pass else: pass # State 105094 if len(subjects45) >= 1: tmp48 = subjects45.popleft() subst4 = Substitution(subst3) try: subst4.try_add_variable('i2.3.1.2.1', tmp48) except ValueError: pass else: pass # State 105095 if len(subjects45) == 0: pass # State 105096 if len(subjects) == 0: pass # 16: b*log(c*x**n) yield 16, subst4 subjects45.appendleft(tmp48) if len(subjects45) >= 1 and isinstance(subjects45[0], Pow): tmp50 = subjects45.popleft() subjects51 = deque(tmp50._args) # State 105097 if len(subjects51) >= 1: tmp52 = subjects51.popleft() subst3 = Substitution(subst2) try: subst3.try_add_variable('i2.3.1.2.1', tmp52) except ValueError: pass else: pass # State 105098 subst4 = Substitution(subst3) try: subst4.try_add_variable('i2.3.1.2.2', 1) except ValueError: pass else: pass # State 105099 if len(subjects51) == 0: pass # State 105100 if len(subjects45) == 0: pass # State 105101 if len(subjects) == 0: pass # 16: b*log(c*x**n) yield 16, subst4 if len(subjects51) >= 1: tmp55 = subjects51.popleft() subst4 = Substitution(subst3) try: subst4.try_add_variable( 'i2.3.1.2.2', tmp55) except ValueError: pass else: pass # State 105099 if len(subjects51) == 0: pass # State 105100 if len(subjects45) == 0: pass # State 105101 if len(subjects) == 0: pass # 16: b*log(c*x**n) yield 16, subst4 subjects51.appendleft(tmp55) subjects51.appendleft(tmp52) subjects45.appendleft(tmp50) if len(subjects45) >= 1 and isinstance(subjects45[0], Mul): tmp57 = subjects45.popleft() associative1 = tmp57 associative_type1 = type(tmp57) subjects58 = deque(tmp57._args) matcher = CommutativeMatcher105103.get() tmp59 = subjects58 subjects58 = [] for s in tmp59: matcher.add_subject(s) for pattern_index, subst2 in matcher.match(tmp59, subst1): pass if pattern_index == 0: pass # State 105110 if len(subjects45) == 0: pass # State 105111 if len(subjects) == 0: pass # 16: b*log(c*x**n) yield 16, subst2 subjects45.appendleft(tmp57) subjects.appendleft(tmp44) subst1 = Substitution(subst0) try: subst1.try_add_variable('i2.4.1.0_1', S(1)) except ValueError: pass else: pass # State 75950 if len(subjects) >= 1: tmp61 = subjects.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.4.1.0', tmp61) except ValueError: pass else: pass # State 75951 if len(subjects) == 0: pass # 10: x*f yield 10, subst2 subjects.appendleft(tmp61) subst1 = Substitution(subst0) try: subst1.try_add_variable('i2.2.3.1.0_1', S(1)) except ValueError: pass else: pass # State 75988 if len(subjects) >= 1: tmp64 = subjects.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.3.1.0', tmp64) except ValueError: pass else: pass # State 75989 if len(subjects) == 0: pass # 11: x*f yield 11, subst2 subjects.appendleft(tmp64) subst1 = Substitution(subst0) try: subst1.try_add_variable('i2.2.1.2.3.1.0_1', S(1)) except ValueError: pass else: pass # State 82600 if len(subjects) >= 1: tmp67 = subjects.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.1.2.3.1.0', tmp67) except ValueError: pass else: pass # State 82601 if len(subjects) == 0: pass # 12: x*d yield 12, subst2 subjects.appendleft(tmp67) subst1 = Substitution(subst0) try: subst1.try_add_variable('i2.2.1.4.1.0_1', S(1)) except ValueError: pass else: pass # State 82794 if len(subjects) >= 1: tmp70 = subjects.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.1.4.1.0', tmp70) except ValueError: pass else: pass # State 82795 if len(subjects) == 0: pass # 13: x*d yield 13, subst2 subjects.appendleft(tmp70) subst1 = Substitution(subst0) try: subst1.try_add_variable('i2.2.1.2.1.0', S(1)) except ValueError: pass else: pass # State 103699 if len(subjects) >= 1: tmp73 = subjects.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.1.0', tmp73) except ValueError: pass else: pass # State 103700 if len(subjects) == 0: pass # 15: x*d yield 15, subst2 subjects.appendleft(tmp73) subst1 = Substitution(subst0) try: subst1.try_add_variable('i2.2.1.3.1.0', S(1)) except ValueError: pass else: pass # State 107637 if len(subjects) >= 1: tmp76 = subjects.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.1.0', tmp76) except ValueError: pass else: pass # State 107638 if len(subjects) == 0: pass # 18: x*e yield 18, subst2 subjects.appendleft(tmp76) subst1 = Substitution(subst0) try: subst1.try_add_variable('i2.3.1.0_2', S(1)) except ValueError: pass else: pass # State 107851 if len(subjects) >= 1: tmp79 = subjects.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.3.1.0', tmp79) except ValueError: pass else: pass # State 107852 if len(subjects) == 0: pass # 19: x*d yield 19, subst2 subjects.appendleft(tmp79) if len(subjects) >= 1 and isinstance(subjects[0], Mul): tmp81 = subjects.popleft() associative1 = tmp81 associative_type1 = type(tmp81) subjects82 = deque(tmp81._args) matcher = CommutativeMatcher57209.get() tmp83 = subjects82 subjects82 = [] for s in tmp83: matcher.add_subject(s) for pattern_index, subst1 in matcher.match(tmp83, subst0): pass if pattern_index == 0: pass # State 57210 if len(subjects) == 0: pass # 0: x*f yield 0, subst1 if pattern_index == 1: pass # State 58408 if len(subjects) == 0: pass # 1: x*d yield 1, subst1 if pattern_index == 2: pass # State 64369 if len(subjects) == 0: pass # 2: x*f yield 2, subst1 if pattern_index == 3: pass # State 65749 if len(subjects) == 0: pass # 3: x*f yield 3, subst1 if pattern_index == 4: pass # State 68202 if len(subjects) == 0: pass # 4: x*d yield 4, subst1 if pattern_index == 5: pass # State 72103 if len(subjects) == 0: pass # 5: x*f yield 5, subst1 if pattern_index == 6: pass # State 74663 if len(subjects) == 0: pass # 6: b*x**n yield 6, subst1 if pattern_index == 7: pass # State 75581 if len(subjects) == 0: pass # 7: b*x**n yield 7, subst1 if pattern_index == 8: pass # State 75824 if len(subjects) == 0: pass # 8: v**2*c yield 8, subst1 if pattern_index == 9: pass # State 75826 if len(subjects) == 0: pass # 9: x*b yield 9, subst1 if pattern_index == 10: pass # State 75952 if len(subjects) == 0: pass # 10: x*f yield 10, subst1 if pattern_index == 11: pass # State 75990 if len(subjects) == 0: pass # 11: x*f yield 11, subst1 if pattern_index == 12: pass # State 82602 if len(subjects) == 0: pass # 12: x*d yield 12, subst1 if pattern_index == 13: pass # State 82796 if len(subjects) == 0: pass # 13: x*d yield 13, subst1 if pattern_index == 14: pass # State 100888 if len(subjects) == 0: pass # 14: x*b yield 14, subst1 if pattern_index == 15: pass # State 103701 if len(subjects) == 0: pass # 15: x*d yield 15, subst1 if pattern_index == 16: pass # State 105132 if len(subjects) == 0: pass # 16: b*log(c*x**n) yield 16, subst1 if pattern_index == 17: pass # State 107483 if len(subjects) == 0: pass # 17: b*(x*d + c)**n yield 17, subst1 if pattern_index == 18: pass # State 107639 if len(subjects) == 0: pass # 18: x*e yield 18, subst1 if pattern_index == 19: pass # State 107853 if len(subjects) == 0: pass # 19: x*d yield 19, subst1 subjects.appendleft(tmp81) return yield