class CommutativeMatcher57250(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.2.3.0', 1, 1, S(0)), Add)]), 10: (10, Multiset({11: 1}), [(VariableWithCount('i2.2.1.2.3.0', 1, 1, S(0)), Add)]), 11: (11, Multiset({12: 1}), [(VariableWithCount('i2.2.1.4.0', 1, 1, S(0)), Add)]), 12: (12, Multiset({13: 1}), [(VariableWithCount('i2.3.0', 1, 1, S(0)), Add)]), 13: (13, Multiset({14: 1}), [(VariableWithCount('i2.4.0', 1, 1, S(0)), Add)]), 14: (14, Multiset({9: 1}), [(VariableWithCount('i2.3.0_1', 1, 1, S(0)), Add)]), 15: (15, Multiset({15: 1}), [(VariableWithCount('i2.3.0_1', 1, 1, S(0)), Add)]), 16: (16, Multiset({16: 1}), [(VariableWithCount('i2.3.0_2', 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.3.0', 1, 1, S(0)), Add)]), 19: (19, Multiset({19: 1}), [(VariableWithCount('i2.2.1.3.0', 1, 1, S(0)), Add)]), 20: (20, Multiset({20: 1}), [(VariableWithCount('i2.3.0_1', 1, 1, S(0)), Add)]), 21: (21, Multiset({20: 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 CommutativeMatcher57250._instance is None: CommutativeMatcher57250._instance = CommutativeMatcher57250() return CommutativeMatcher57250._instance @staticmethod def get_match_iter(subject): subjects = deque([subject]) if subject is not None else deque() subst0 = Substitution() # State 57249 subst1 = Substitution(subst0) try: subst1.try_add_variable('i2.2.2.1.0_1', S(1)) except ValueError: pass else: pass # State 57251 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 57252 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 58519 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 58520 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 64332 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 64333 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 65672 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 65673 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 75809 if len(subjects) == 0: pass # 9: x*b yield 9, subst2 subjects.appendleft(tmp13) if len(subjects) >= 1: tmp15 = subjects.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.3.1.1.0', tmp15) except ValueError: pass else: pass # State 103847 if len(subjects) == 0: pass # 15: e*x yield 15, subst2 subjects.appendleft(tmp15) subst1 = Substitution(subst0) try: subst1.try_add_variable('i2.2.1.2.2.1.0_1', S(1)) except ValueError: pass else: pass # State 68421 if len(subjects) >= 1: tmp18 = subjects.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.1.2.2.1.0', tmp18) except ValueError: pass else: pass # State 68422 if len(subjects) == 0: pass # 4: x*d yield 4, subst2 subjects.appendleft(tmp18) subst1 = Substitution(subst0) try: subst1.try_add_variable('i2.3.1.0', S(1)) except ValueError: pass else: pass # State 72082 if len(subjects) >= 1: tmp21 = subjects.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.1.0', tmp21) except ValueError: pass else: pass # State 72083 if len(subjects) == 0: pass # 5: x*f yield 5, subst2 subjects.appendleft(tmp21) subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.3.1.2', S(1)) except ValueError: pass else: pass # State 75472 if len(subjects) >= 1: tmp24 = subjects.popleft() subst3 = Substitution(subst2) try: subst3.try_add_variable('i2.1', tmp24) except ValueError: pass else: pass # State 75473 if len(subjects) == 0: pass # 7: x**n*b yield 7, subst3 subjects.appendleft(tmp24) if len(subjects) >= 1: tmp26 = subjects.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.2.1.0', tmp26) except ValueError: pass else: pass # State 100904 if len(subjects) == 0: pass # 13: x*b yield 13, subst2 subjects.appendleft(tmp26) if len(subjects) >= 1 and isinstance(subjects[0], Pow): tmp28 = subjects.popleft() subjects29 = deque(tmp28._args) # State 74624 if len(subjects29) >= 1: tmp30 = subjects29.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.1', tmp30) except ValueError: pass else: pass # State 74625 if len(subjects29) >= 1: tmp32 = subjects29.popleft() subst3 = Substitution(subst2) try: subst3.try_add_variable('i2.3.1.2', tmp32) except ValueError: pass else: pass # State 74626 if len(subjects29) == 0: pass # State 74627 if len(subjects) == 0: pass # 6: x**n*b yield 6, subst3 subjects29.appendleft(tmp32) subst3 = Substitution(subst2) try: subst3.try_add_variable('i2.3.1.2', 1) except ValueError: pass else: pass # State 75474 if len(subjects29) == 0: pass # State 75475 if len(subjects) == 0: pass # 7: x**n*b yield 7, subst3 if len(subjects29) >= 1: tmp35 = subjects29.popleft() subst3 = Substitution(subst2) try: subst3.try_add_variable('i2.3.1.2', tmp35) except ValueError: pass else: pass # State 75474 if len(subjects29) == 0: pass # State 75475 if len(subjects) == 0: pass # 7: x**n*b yield 7, subst3 subjects29.appendleft(tmp35) subjects29.appendleft(tmp30) if len(subjects29) >= 1: tmp37 = subjects29.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.1.0', tmp37) except ValueError: pass else: pass # State 75802 if len(subjects29) >= 1 and subjects29[0] == Integer( 2): tmp39 = subjects29.popleft() # State 75803 if len(subjects29) == 0: pass # State 75804 if len(subjects) == 0: pass # 8: v**2*c yield 8, subst2 subjects29.appendleft(tmp39) subjects29.appendleft(tmp37) if len(subjects29) >= 1 and isinstance(subjects29[0], Add): tmp40 = subjects29.popleft() associative1 = tmp40 associative_type1 = type(tmp40) subjects41 = deque(tmp40._args) matcher = CommutativeMatcher107363.get() tmp42 = subjects41 subjects41 = [] for s in tmp42: matcher.add_subject(s) for pattern_index, subst2 in matcher.match(tmp42, subst1): pass if pattern_index == 0: pass # State 107369 if len(subjects29) >= 1: tmp43 = [] tmp43.append(subjects29.popleft()) while True: if len(tmp43) > 1: tmp44 = create_operation_expression( associative1, tmp43) elif len(tmp43) == 1: tmp44 = tmp43[0] else: assert False, "Unreachable" subst3 = Substitution(subst2) try: subst3.try_add_variable( 'i2.3.1.2', tmp44) except ValueError: pass else: pass # State 107370 if len(subjects29) == 0: pass # State 107371 if len(subjects) == 0: pass # 18: b*(x*d + c)**n yield 18, subst3 if len(subjects29) == 0: break tmp43.append(subjects29.popleft()) subjects29.extendleft(reversed(tmp43)) subjects29.appendleft(tmp40) subjects.appendleft(tmp28) if len(subjects) >= 1 and isinstance(subjects[0], log): tmp46 = subjects.popleft() subjects47 = deque(tmp46._args) # State 104991 subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.3.1.2.0', S(1)) except ValueError: pass else: pass # State 104992 subst3 = Substitution(subst2) try: subst3.try_add_variable('i2.3.1.2.2', S(1)) except ValueError: pass else: pass # State 104993 if len(subjects47) >= 1: tmp50 = subjects47.popleft() subst4 = Substitution(subst3) try: subst4.try_add_variable('i2.1', tmp50) except ValueError: pass else: pass # State 104994 if len(subjects47) == 0: pass # State 104995 if len(subjects) == 0: pass # 17: b*log(x**n*c) yield 17, subst4 subjects47.appendleft(tmp50) if len(subjects47) >= 1 and isinstance(subjects47[0], Pow): tmp52 = subjects47.popleft() subjects53 = deque(tmp52._args) # State 104996 if len(subjects53) >= 1: tmp54 = subjects53.popleft() subst3 = Substitution(subst2) try: subst3.try_add_variable('i2.1', tmp54) except ValueError: pass else: pass # State 104997 subst4 = Substitution(subst3) try: subst4.try_add_variable('i2.3.1.2.2', 1) except ValueError: pass else: pass # State 104998 if len(subjects53) == 0: pass # State 104999 if len(subjects47) == 0: pass # State 105000 if len(subjects) == 0: pass # 17: b*log(x**n*c) yield 17, subst4 if len(subjects53) >= 1: tmp57 = subjects53.popleft() subst4 = Substitution(subst3) try: subst4.try_add_variable( 'i2.3.1.2.2', tmp57) except ValueError: pass else: pass # State 104998 if len(subjects53) == 0: pass # State 104999 if len(subjects47) == 0: pass # State 105000 if len(subjects) == 0: pass # 17: b*log(x**n*c) yield 17, subst4 subjects53.appendleft(tmp57) subjects53.appendleft(tmp54) subjects47.appendleft(tmp52) if len(subjects47) >= 1 and isinstance(subjects47[0], Mul): tmp59 = subjects47.popleft() associative1 = tmp59 associative_type1 = type(tmp59) subjects60 = deque(tmp59._args) matcher = CommutativeMatcher105002.get() tmp61 = subjects60 subjects60 = [] for s in tmp61: matcher.add_subject(s) for pattern_index, subst2 in matcher.match(tmp61, subst1): pass if pattern_index == 0: pass # State 105009 if len(subjects47) == 0: pass # State 105010 if len(subjects) == 0: pass # 17: b*log(x**n*c) yield 17, subst2 subjects47.appendleft(tmp59) subjects.appendleft(tmp46) subst1 = Substitution(subst0) try: subst1.try_add_variable('i2.2.3.1.0_1', S(1)) except ValueError: pass else: pass # State 76607 if len(subjects) >= 1: tmp63 = subjects.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.3.1.0', tmp63) except ValueError: pass else: pass # State 76608 if len(subjects) == 0: pass # 10: x*f yield 10, subst2 subjects.appendleft(tmp63) subst1 = Substitution(subst0) try: subst1.try_add_variable('i2.2.1.2.3.1.0_1', S(1)) except ValueError: pass else: pass # State 85691 if len(subjects) >= 1: tmp66 = subjects.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.1.2.3.1.0', tmp66) except ValueError: pass else: pass # State 85692 if len(subjects) == 0: pass # 11: x*d yield 11, subst2 subjects.appendleft(tmp66) subst1 = Substitution(subst0) try: subst1.try_add_variable('i2.2.1.4.1.0_1', S(1)) except ValueError: pass else: pass # State 85900 if len(subjects) >= 1: tmp69 = subjects.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.1.4.1.0', tmp69) except ValueError: pass else: pass # State 85901 if len(subjects) == 0: pass # 12: x*d yield 12, subst2 subjects.appendleft(tmp69) subst1 = Substitution(subst0) try: subst1.try_add_variable('i2.4.1.0_1', S(1)) except ValueError: pass else: pass # State 103613 if len(subjects) >= 1: tmp72 = subjects.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.4.1.0', tmp72) except ValueError: pass else: pass # State 103614 if len(subjects) == 0: pass # 14: x*f yield 14, subst2 subjects.appendleft(tmp72) subst1 = Substitution(subst0) try: subst1.try_add_variable('i2.3.1.0_3', S(1)) except ValueError: pass else: pass # State 104088 if len(subjects) >= 1: tmp75 = subjects.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.3.1.0', tmp75) except ValueError: pass else: pass # State 104089 if len(subjects) == 0: pass # 16: x*f yield 16, subst2 subjects.appendleft(tmp75) subst1 = Substitution(subst0) try: subst1.try_add_variable('i2.2.1.3.1.0', S(1)) except ValueError: pass else: pass # State 107708 if len(subjects) >= 1: tmp78 = subjects.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.1.0', tmp78) except ValueError: pass else: pass # State 107709 if len(subjects) == 0: pass # 19: x*e yield 19, subst2 subjects.appendleft(tmp78) subst1 = Substitution(subst0) try: subst1.try_add_variable('i2.3.1.0_2', S(1)) except ValueError: pass else: pass # State 107822 if len(subjects) >= 1: tmp81 = subjects.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.3.1.0', tmp81) except ValueError: pass else: pass # State 107823 if len(subjects) == 0: pass # 20: x*d yield 20, subst2 subjects.appendleft(tmp81) if len(subjects) >= 1 and isinstance(subjects[0], Mul): tmp83 = subjects.popleft() associative1 = tmp83 associative_type1 = type(tmp83) subjects84 = deque(tmp83._args) matcher = CommutativeMatcher57254.get() tmp85 = subjects84 subjects84 = [] for s in tmp85: matcher.add_subject(s) for pattern_index, subst1 in matcher.match(tmp85, subst0): pass if pattern_index == 0: pass # State 57255 if len(subjects) == 0: pass # 0: x*f yield 0, subst1 if pattern_index == 1: pass # State 58521 if len(subjects) == 0: pass # 1: x*d yield 1, subst1 if pattern_index == 2: pass # State 64334 if len(subjects) == 0: pass # 2: x*f yield 2, subst1 if pattern_index == 3: pass # State 65674 if len(subjects) == 0: pass # 3: x*f yield 3, subst1 if pattern_index == 4: pass # State 68423 if len(subjects) == 0: pass # 4: x*d yield 4, subst1 if pattern_index == 5: pass # State 72084 if len(subjects) == 0: pass # 5: x*f yield 5, subst1 if pattern_index == 6: pass # State 74632 if len(subjects) == 0: pass # 6: x**n*b yield 6, subst1 if pattern_index == 7: pass # State 75480 if len(subjects) == 0: pass # 7: x**n*b yield 7, subst1 if pattern_index == 8: pass # State 75808 if len(subjects) == 0: pass # 8: v**2*c yield 8, subst1 if pattern_index == 9: pass # State 75810 if len(subjects) == 0: pass # 9: x*b yield 9, subst1 if pattern_index == 10: pass # State 76609 if len(subjects) == 0: pass # 10: x*f yield 10, subst1 if pattern_index == 11: pass # State 85693 if len(subjects) == 0: pass # 11: x*d yield 11, subst1 if pattern_index == 12: pass # State 85902 if len(subjects) == 0: pass # 12: x*d yield 12, subst1 if pattern_index == 13: pass # State 100905 if len(subjects) == 0: pass # 13: x*b yield 13, subst1 if pattern_index == 14: pass # State 103615 if len(subjects) == 0: pass # 14: x*f yield 14, subst1 if pattern_index == 15: pass # State 103848 if len(subjects) == 0: pass # 15: e*x yield 15, subst1 if pattern_index == 16: pass # State 104090 if len(subjects) == 0: pass # 16: x*f yield 16, subst1 if pattern_index == 17: pass # State 105031 if len(subjects) == 0: pass # 17: b*log(x**n*c) yield 17, subst1 if pattern_index == 18: pass # State 107382 if len(subjects) == 0: pass # 18: b*(x*d + c)**n yield 18, subst1 if pattern_index == 19: pass # State 107710 if len(subjects) == 0: pass # 19: x*e yield 19, subst1 if pattern_index == 20: pass # State 107824 if len(subjects) == 0: pass # 20: x*d yield 20, subst1 subjects.appendleft(tmp83) return yield
class CommutativeMatcher17046(CommutativeMatcher): _instance = None patterns = { 0: (0, Multiset({0: 1}), [(VariableWithCount('i4.1.0', 1, 1, S(1)), Mul)]), 1: (1, Multiset({1: 1}), [(VariableWithCount('i4.1.0', 1, 1, S(1)), Mul)]), 2: (2, Multiset({2: 1}), [(VariableWithCount('i4.1.0', 1, 1, S(1)), Mul)]), 3: (3, Multiset({3: 1}), [(VariableWithCount('i4.1.0', 1, 1, S(1)), Mul)]), 4: (4, Multiset({}), [(VariableWithCount('i4.1.0_1', 1, 1, S(1)), Mul), (VariableWithCount('i4.1.1', 1, 1, None), 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 CommutativeMatcher17046._instance is None: CommutativeMatcher17046._instance = CommutativeMatcher17046() return CommutativeMatcher17046._instance @staticmethod def get_match_iter(subject): subjects = deque([subject]) if subject is not None else deque() subst0 = Substitution() # State 17045 subst1 = Substitution(subst0) try: subst1.try_add_variable('i4.1.1.0', S(0)) except ValueError: pass else: pass # State 17047 subst2 = Substitution(subst1) try: subst2.try_add_variable('i4.1.1.1.0_1', S(1)) except ValueError: pass else: pass # State 17048 if len(subjects) >= 1: tmp3 = subjects.popleft() subst3 = Substitution(subst2) try: subst3.try_add_variable('i4.1.1.1.0', tmp3) except ValueError: pass else: pass # State 17049 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 = CommutativeMatcher17051.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 17052 if len(subjects) == 0: pass # 0: c + x*d 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 = CommutativeMatcher17054.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 17060 if len(subjects) == 0: pass # 0: c + x*d yield 0, subst1 subjects.appendleft(tmp8) if len(subjects) >= 1 and isinstance(subjects[0], Pow): tmp11 = subjects.popleft() subjects12 = deque(tmp11._args) # State 17142 subst1 = Substitution(subst0) try: subst1.try_add_variable('i4.1.2.0', S(0)) except ValueError: pass else: pass # State 17143 subst2 = Substitution(subst1) try: subst2.try_add_variable('i4.1.2.1.0_1', S(1)) except ValueError: pass else: pass # State 17144 if len(subjects12) >= 1: tmp15 = subjects12.popleft() subst3 = Substitution(subst2) try: subst3.try_add_variable('i4.1.2.1.0', tmp15) except ValueError: pass else: pass # State 17145 if len(subjects12 ) >= 1 and subjects12[0] == Integer(2): tmp17 = subjects12.popleft() # State 17146 if len(subjects12) == 0: pass # State 17147 if len(subjects) == 0: pass # 1: (c + x*d)**2 yield 1, subst3 subjects12.appendleft(tmp17) if len(subjects12) >= 1: tmp18 = subjects12.popleft() subst4 = Substitution(subst3) try: subst4.try_add_variable('i4.1.2', tmp18) except ValueError: pass else: pass # State 17203 if len(subjects12) == 0: pass # State 17204 if len(subjects) == 0: pass # 2: (c + x*d)**n yield 2, subst4 subjects12.appendleft(tmp18) subjects12.appendleft(tmp15) if len(subjects12) >= 1 and isinstance(subjects12[0], Mul): tmp20 = subjects12.popleft() associative1 = tmp20 associative_type1 = type(tmp20) subjects21 = deque(tmp20._args) matcher = CommutativeMatcher17149.get() tmp22 = subjects21 subjects21 = [] for s in tmp22: matcher.add_subject(s) for pattern_index, subst2 in matcher.match(tmp22, subst1): pass if pattern_index == 0: pass # State 17150 if len(subjects12 ) >= 1 and subjects12[0] == Integer(2): tmp23 = subjects12.popleft() # State 17151 if len(subjects12) == 0: pass # State 17152 if len(subjects) == 0: pass # 1: (c + x*d)**2 yield 1, subst2 subjects12.appendleft(tmp23) if len(subjects12) >= 1: tmp24 = [] tmp24.append(subjects12.popleft()) while True: if len(tmp24) > 1: tmp25 = create_operation_expression( associative1, tmp24) elif len(tmp24) == 1: tmp25 = tmp24[0] else: assert False, "Unreachable" subst3 = Substitution(subst2) try: subst3.try_add_variable( 'i4.1.2', tmp25) except ValueError: pass else: pass # State 17205 if len(subjects12) == 0: pass # State 17206 if len(subjects) == 0: pass # 2: (c + x*d)**n yield 2, subst3 if len(subjects12) == 0: break tmp24.append(subjects12.popleft()) subjects12.extendleft(reversed(tmp24)) subjects12.appendleft(tmp20) if len(subjects12) >= 1: tmp27 = subjects12.popleft() subst1 = Substitution(subst0) try: subst1.try_add_variable('i4.1.1', tmp27) except ValueError: pass else: pass # State 17677 if len(subjects12) >= 1 and subjects12[0] == Integer(2): tmp29 = subjects12.popleft() # State 17678 if len(subjects12) == 0: pass # State 17679 if len(subjects) == 0: pass # 3: x**2 yield 3, subst1 subjects12.appendleft(tmp29) subjects12.appendleft(tmp27) if len(subjects12) >= 1 and isinstance(subjects12[0], Add): tmp30 = subjects12.popleft() associative1 = tmp30 associative_type1 = type(tmp30) subjects31 = deque(tmp30._args) matcher = CommutativeMatcher17154.get() tmp32 = subjects31 subjects31 = [] for s in tmp32: matcher.add_subject(s) for pattern_index, subst1 in matcher.match(tmp32, subst0): pass if pattern_index == 0: pass # State 17160 if len(subjects12) >= 1 and subjects12[0] == Integer( 2): tmp33 = subjects12.popleft() # State 17161 if len(subjects12) == 0: pass # State 17162 if len(subjects) == 0: pass # 1: (c + x*d)**2 yield 1, subst1 subjects12.appendleft(tmp33) if len(subjects12) >= 1: tmp34 = [] tmp34.append(subjects12.popleft()) while True: if len(tmp34) > 1: tmp35 = create_operation_expression( associative1, tmp34) elif len(tmp34) == 1: tmp35 = tmp34[0] else: assert False, "Unreachable" subst2 = Substitution(subst1) try: subst2.try_add_variable('i4.1.2', tmp35) except ValueError: pass else: pass # State 17207 if len(subjects12) == 0: pass # State 17208 if len(subjects) == 0: pass # 2: (c + x*d)**n yield 2, subst2 if len(subjects12) == 0: break tmp34.append(subjects12.popleft()) subjects12.extendleft(reversed(tmp34)) subjects12.appendleft(tmp30) subjects.appendleft(tmp11) return yield
class CommutativeMatcher151083(CommutativeMatcher): _instance = None patterns = { 0: (0, Multiset({0: 1}), [ (VariableWithCount('i2.2.1.3.2.0', 1, 1, S(0)), Add) ]), 1: (1, Multiset({1: 1}), [ (VariableWithCount('i2.2.1.3.2.0_1', 1, 1, S(0)), Add) ]), 2: (2, Multiset({2: 1, 0: 1}), [ ]), 3: (3, Multiset({2: 1, 1: 1}), [ ]) } subjects = {} subjects_by_id = {} bipartite = BipartiteGraph() associative = Add max_optional_count = 1 anonymous_patterns = {2} def __init__(self): self.add_subject(None) @staticmethod def get(): if CommutativeMatcher151083._instance is None: CommutativeMatcher151083._instance = CommutativeMatcher151083() return CommutativeMatcher151083._instance @staticmethod def get_match_iter(subject): subjects = deque([subject]) if subject is not None else deque() subst0 = Substitution() # State 151082 subst1 = Substitution(subst0) try: subst1.try_add_variable('i2.2.1.3.2.1.0_1', S(1)) except ValueError: pass else: pass # State 151084 if len(subjects) >= 1: tmp2 = subjects.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.1.3.2.1.0', tmp2) except ValueError: pass else: pass # State 151085 if len(subjects) == 0: pass # 0: x*e yield 0, subst2 subjects.appendleft(tmp2) subst1 = Substitution(subst0) try: subst1.try_add_variable('i2.2.1.3.2.1.0_2', S(1)) except ValueError: pass else: pass # State 151102 if len(subjects) >= 1: tmp5 = subjects.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.1.3.2.1.0', tmp5) except ValueError: pass else: pass # State 151103 if len(subjects) == 0: pass # 1: x*g 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 = CommutativeMatcher151087.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 151088 if len(subjects) == 0: pass # 0: x*e yield 0, subst1 if pattern_index == 1: pass # State 151104 if len(subjects) == 0: pass # 1: x*g yield 1, subst1 subjects.appendleft(tmp7) if len(subjects) >= 1 and subjects[0] == Integer(1): tmp10 = subjects.popleft() # State 151384 if len(subjects) == 0: pass # 2: 1 yield 2, subst0 subjects.appendleft(tmp10) return yield
class CommutativeMatcher72804(CommutativeMatcher): _instance = None patterns = { 0: (0, Multiset({0: 1}), [(VariableWithCount('i3.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 CommutativeMatcher72804._instance is None: CommutativeMatcher72804._instance = CommutativeMatcher72804() return CommutativeMatcher72804._instance @staticmethod def get_match_iter(subject): subjects = deque([subject]) if subject is not None else deque() subst0 = Substitution() # State 72803 if len(subjects) >= 1 and isinstance(subjects[0], Pow): tmp1 = subjects.popleft() subjects2 = deque(tmp1._args) # State 72805 if len(subjects2) >= 1: tmp3 = subjects2.popleft() subst1 = Substitution(subst0) try: subst1.try_add_variable('i3.1.2.1.1', tmp3) except ValueError: pass else: pass # State 72806 if len(subjects2) >= 1: tmp5 = subjects2.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i3.1.2.1.2', tmp5) except ValueError: pass else: pass # State 72807 if len(subjects2) == 0: pass # State 72808 if len(subjects) == 0: pass # 0: x**n yield 0, subst2 subjects2.appendleft(tmp5) subjects2.appendleft(tmp3) subjects.appendleft(tmp1) return yield
class CommutativeMatcher72698(CommutativeMatcher): _instance = None patterns = { 0: (0, Multiset({0: 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 CommutativeMatcher72698._instance is None: CommutativeMatcher72698._instance = CommutativeMatcher72698() return CommutativeMatcher72698._instance @staticmethod def get_match_iter(subject): subjects = deque([subject]) if subject is not None else deque() subst0 = Substitution() # State 72697 subst1 = Substitution(subst0) try: subst1.try_add_variable('i3.1.2.1.0', S(1)) except ValueError: pass else: pass # State 72699 if len(subjects) >= 1 and isinstance(subjects[0], Pow): tmp2 = subjects.popleft() subjects3 = deque(tmp2._args) # State 72700 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 72701 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 72702 if len(subjects3) == 0: pass # State 72703 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 = CommutativeMatcher72705.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 72710 if len(subjects) == 0: pass # 0: d*x**n yield 0, subst1 subjects.appendleft(tmp8) return yield
class CommutativeMatcher23152(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 CommutativeMatcher23152._instance is None: CommutativeMatcher23152._instance = CommutativeMatcher23152() return CommutativeMatcher23152._instance @staticmethod def get_match_iter(subject): subjects = deque([subject]) if subject is not None else deque() subst0 = Substitution() # State 23151 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 23153 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 23154 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 43969 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 28878 if len(subjects) >= 1 and isinstance(subjects[0], Pow): tmp7 = subjects.popleft() subjects8 = deque(tmp7._args) # State 28879 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 28880 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 28881 if len(subjects8) == 0: pass # State 28882 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 43964 if len(subjects8) == 0: pass # State 43965 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 = CommutativeMatcher23156.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 23157 if len(subjects) == 0: pass # 0: x*f yield 0, subst1 if pattern_index == 1: pass # State 28887 if len(subjects) == 0: pass # 1: f*x**m yield 1, subst1 if pattern_index == 2: pass # State 43968 if len(subjects) == 0: pass # 2: g*x**2 yield 2, subst1 if pattern_index == 3: pass # State 43970 if len(subjects) == 0: pass # 3: f*x yield 3, subst1 subjects.appendleft(tmp14) return yield
class CommutativeMatcher135569(CommutativeMatcher): _instance = None patterns = { 0: (0, Multiset({0: 1}), [ (VariableWithCount('i5.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 CommutativeMatcher135569._instance is None: CommutativeMatcher135569._instance = CommutativeMatcher135569() return CommutativeMatcher135569._instance @staticmethod def get_match_iter(subject): subjects = deque([subject]) if subject is not None else deque() subst0 = Substitution() # State 135568 subst1 = Substitution(subst0) try: subst1.try_add_variable('i5.1.0', S(1)) except ValueError: pass else: pass # State 135570 if len(subjects) >= 1 and isinstance(subjects[0], log): tmp2 = subjects.popleft() subjects3 = deque(tmp2._args) # State 135571 subst2 = Substitution(subst1) try: subst2.try_add_variable('i5.1.2.0', S(1)) except ValueError: pass else: pass # State 135572 subst3 = Substitution(subst2) try: subst3.try_add_variable('i5.1.2.2', S(1)) except ValueError: pass else: pass # State 135573 if len(subjects3) >= 1: tmp6 = subjects3.popleft() subst4 = Substitution(subst3) try: subst4.try_add_variable('i5.1.2.1', tmp6) except ValueError: pass else: pass # State 135574 if len(subjects3) == 0: pass # State 135575 if len(subjects) == 0: pass # 0: b*log(c*x**n) /; (cons_f2) and (cons_f3) and (cons_f8) and (cons_f4) and (cons_f5) and (cons_f1880) yield 0, subst4 subjects3.appendleft(tmp6) if len(subjects3) >= 1 and isinstance(subjects3[0], Pow): tmp8 = subjects3.popleft() subjects9 = deque(tmp8._args) # State 135576 if len(subjects9) >= 1: tmp10 = subjects9.popleft() subst3 = Substitution(subst2) try: subst3.try_add_variable('i5.1.2.1', tmp10) except ValueError: pass else: pass # State 135577 subst4 = Substitution(subst3) try: subst4.try_add_variable('i5.1.2.2', 1) except ValueError: pass else: pass # State 135578 if len(subjects9) == 0: pass # State 135579 if len(subjects3) == 0: pass # State 135580 if len(subjects) == 0: pass # 0: b*log(c*x**n) /; (cons_f2) and (cons_f3) and (cons_f8) and (cons_f4) and (cons_f5) and (cons_f1880) yield 0, subst4 if len(subjects9) >= 1: tmp13 = subjects9.popleft() subst4 = Substitution(subst3) try: subst4.try_add_variable('i5.1.2.2', tmp13) except ValueError: pass else: pass # State 135578 if len(subjects9) == 0: pass # State 135579 if len(subjects3) == 0: pass # State 135580 if len(subjects) == 0: pass # 0: b*log(c*x**n) /; (cons_f2) and (cons_f3) and (cons_f8) and (cons_f4) and (cons_f5) and (cons_f1880) yield 0, subst4 subjects9.appendleft(tmp13) subjects9.appendleft(tmp10) subjects3.appendleft(tmp8) if len(subjects3) >= 1 and isinstance(subjects3[0], Mul): tmp15 = subjects3.popleft() associative1 = tmp15 associative_type1 = type(tmp15) subjects16 = deque(tmp15._args) matcher = CommutativeMatcher135582.get() tmp17 = subjects16 subjects16 = [] for s in tmp17: matcher.add_subject(s) for pattern_index, subst2 in matcher.match(tmp17, subst1): pass if pattern_index == 0: pass # State 135589 if len(subjects3) == 0: pass # State 135590 if len(subjects) == 0: pass # 0: b*log(c*x**n) /; (cons_f2) and (cons_f3) and (cons_f8) and (cons_f4) and (cons_f5) and (cons_f1880) yield 0, subst2 subjects3.appendleft(tmp15) subjects.appendleft(tmp2) if len(subjects) >= 1 and isinstance(subjects[0], Mul): tmp18 = subjects.popleft() associative1 = tmp18 associative_type1 = type(tmp18) subjects19 = deque(tmp18._args) matcher = CommutativeMatcher135592.get() tmp20 = subjects19 subjects19 = [] for s in tmp20: matcher.add_subject(s) for pattern_index, subst1 in matcher.match(tmp20, subst0): pass if pattern_index == 0: pass # State 135613 if len(subjects) == 0: pass # 0: b*log(c*x**n) /; (cons_f2) and (cons_f3) and (cons_f8) and (cons_f4) and (cons_f5) and (cons_f1880) yield 0, subst1 subjects.appendleft(tmp18) return yield
class CommutativeMatcher26431(CommutativeMatcher): _instance = None patterns = { 0: (0, Multiset({0: 1}), [(VariableWithCount('i2.1.1.2.2.0', 1, 1, S(0)), Add)]), 1: (1, Multiset({1: 1}), [(VariableWithCount('i2.1.1.2.2.0', 1, 1, S(0)), Add)]), 2: (2, Multiset({2: 1}), [(VariableWithCount('i2.1.1.2.2.0', 1, 1, S(0)), Add)]), 3: (3, Multiset({3: 1}), [(VariableWithCount('i2.1.1.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 CommutativeMatcher26431._instance is None: CommutativeMatcher26431._instance = CommutativeMatcher26431() return CommutativeMatcher26431._instance @staticmethod def get_match_iter(subject): subjects = deque([subject]) if subject is not None else deque() subst0 = Substitution() # State 26430 subst1 = Substitution(subst0) try: subst1.try_add_variable('i2.1.1.2.2.1.0', S(1)) except ValueError: pass else: pass # State 26432 if len(subjects) >= 1: tmp2 = subjects.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.1.1', tmp2) except ValueError: pass else: pass # State 26433 if len(subjects) == 0: pass # 0: f*x yield 0, subst2 subjects.appendleft(tmp2) if len(subjects) >= 1 and isinstance(subjects[0], Pow): tmp4 = subjects.popleft() subjects5 = deque(tmp4._args) # State 49461 if len(subjects5) >= 1: tmp6 = subjects5.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.1.0', tmp6) except ValueError: pass else: pass # State 49462 if len(subjects5) >= 1: tmp8 = subjects5.popleft() subst3 = Substitution(subst2) try: subst3.try_add_variable('i2.1.1.2.2.1.2', tmp8) except ValueError: pass else: pass # State 49463 if len(subjects5) == 0: pass # State 49464 if len(subjects) == 0: pass # 1: e*x**n yield 1, subst3 subjects5.appendleft(tmp8) subjects5.appendleft(tmp6) if len(subjects5) >= 1: tmp10 = subjects5.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.3.1.0', tmp10) except ValueError: pass else: pass # State 49973 if len(subjects5) >= 1: tmp12 = subjects5.popleft() subst3 = Substitution(subst2) try: subst3.try_add_variable( 'i2.1.1.2.2.1.2', tmp12) except ValueError: pass else: pass # State 49974 if len(subjects5) == 0: pass # State 49975 if len(subjects) == 0: pass # 2: e*x**n yield 2, subst3 subjects5.appendleft(tmp12) subjects5.appendleft(tmp10) if len(subjects5) >= 1: tmp14 = subjects5.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.1.1', tmp14) except ValueError: pass else: pass # State 50299 if len(subjects5) >= 1 and subjects5[0] == Integer(2): tmp16 = subjects5.popleft() # State 50300 if len(subjects5) == 0: pass # State 50301 if len(subjects) == 0: pass # 3: e*x**2 yield 3, subst2 subjects5.appendleft(tmp16) subjects5.appendleft(tmp14) subjects.appendleft(tmp4) if len(subjects) >= 1 and isinstance(subjects[0], Mul): tmp17 = subjects.popleft() associative1 = tmp17 associative_type1 = type(tmp17) subjects18 = deque(tmp17._args) matcher = CommutativeMatcher26435.get() tmp19 = subjects18 subjects18 = [] for s in tmp19: matcher.add_subject(s) for pattern_index, subst1 in matcher.match(tmp19, subst0): pass if pattern_index == 0: pass # State 26436 if len(subjects) == 0: pass # 0: f*x yield 0, subst1 if pattern_index == 1: pass # State 49469 if len(subjects) == 0: pass # 1: e*x**n yield 1, subst1 if pattern_index == 2: pass # State 49979 if len(subjects) == 0: pass # 2: e*x**n yield 2, subst1 if pattern_index == 3: pass # State 50305 if len(subjects) == 0: pass # 3: e*x**2 yield 3, subst1 subjects.appendleft(tmp17) return yield
class CommutativeMatcher139696(CommutativeMatcher): _instance = None patterns = { 0: (0, Multiset({}), [(VariableWithCount('i2.3.0', 1, 1, None), Mul), (VariableWithCount('i2.3.0_1', 1, 1, S(1)), Mul)]), 1: (1, Multiset({}), [(VariableWithCount('i2.2.1.1', 1, 1, None), Mul), (VariableWithCount('i2.3.0', 1, 1, S(1)), Mul)]), 2: (2, Multiset({0: 1}), [(VariableWithCount('i2.3.0', 1, 1, S(1)), Mul)]), 3: (3, Multiset({1: 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 CommutativeMatcher139696._instance is None: CommutativeMatcher139696._instance = CommutativeMatcher139696() return CommutativeMatcher139696._instance @staticmethod def get_match_iter(subject): subjects = deque([subject]) if subject is not None else deque() subst0 = Substitution() # State 139695 if len(subjects) >= 1 and isinstance(subjects[0], Pow): tmp1 = subjects.popleft() subjects2 = deque(tmp1._args) # State 140708 if len(subjects2) >= 1: tmp3 = subjects2.popleft() subst1 = Substitution(subst0) try: subst1.try_add_variable('i2.3.1', tmp3) except ValueError: pass else: pass # State 140709 if len(subjects2) >= 1: tmp5 = subjects2.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.3.2', tmp5) except ValueError: pass else: pass # State 140710 if len(subjects2) == 0: pass # State 140711 if len(subjects) == 0: pass # 0: x**p yield 0, subst2 subjects2.appendleft(tmp5) subjects2.appendleft(tmp3) subst1 = Substitution(subst0) try: subst1.try_add_variable('i2.3.2.0', S(0)) except ValueError: pass else: pass # State 141039 subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.3.2.1.0', S(1)) except ValueError: pass else: pass # State 141040 subst3 = Substitution(subst2) try: subst3.try_add_variable('i2.3.2.1.2', S(1)) except ValueError: pass else: pass # State 141041 if len(subjects2) >= 1: tmp10 = subjects2.popleft() subst4 = Substitution(subst3) try: subst4.try_add_variable('i2.3.2.1.1', tmp10) except ValueError: pass else: pass # State 141042 if len(subjects2 ) >= 1 and subjects2[0] == Integer(-1): tmp12 = subjects2.popleft() # State 141043 if len(subjects2) == 0: pass # State 141044 if len(subjects) == 0: pass # 1: 1/(a + b*x**n) yield 1, subst4 subjects2.appendleft(tmp12) subjects2.appendleft(tmp10) if len(subjects2) >= 1 and isinstance(subjects2[0], Pow): tmp13 = subjects2.popleft() subjects14 = deque(tmp13._args) # State 141045 if len(subjects14) >= 1: tmp15 = subjects14.popleft() subst3 = Substitution(subst2) try: subst3.try_add_variable('i2.3.2.1.1', tmp15) except ValueError: pass else: pass # State 141046 subst4 = Substitution(subst3) try: subst4.try_add_variable('i2.3.2.1.2', 1) except ValueError: pass else: pass # State 141047 if len(subjects14) == 0: pass # State 141048 if len(subjects2) >= 1 and subjects2[ 0] == Integer(-1): tmp18 = subjects2.popleft() # State 141049 if len(subjects2) == 0: pass # State 141050 if len(subjects) == 0: pass # 1: 1/(a + b*x**n) yield 1, subst4 subjects2.appendleft(tmp18) if len(subjects14) >= 1: tmp19 = subjects14.popleft() subst4 = Substitution(subst3) try: subst4.try_add_variable( 'i2.3.2.1.2', tmp19) except ValueError: pass else: pass # State 141047 if len(subjects14) == 0: pass # State 141048 if len(subjects2 ) >= 1 and subjects2[ 0] == Integer(-1): tmp21 = subjects2.popleft() # State 141049 if len(subjects2) == 0: pass # State 141050 if len(subjects) == 0: pass # 1: 1/(a + b*x**n) yield 1, subst4 subjects2.appendleft(tmp21) subjects14.appendleft(tmp19) subjects14.appendleft(tmp15) subjects2.appendleft(tmp13) if len(subjects2) >= 1 and isinstance(subjects2[0], Mul): tmp22 = subjects2.popleft() associative1 = tmp22 associative_type1 = type(tmp22) subjects23 = deque(tmp22._args) matcher = CommutativeMatcher141052.get() tmp24 = subjects23 subjects23 = [] for s in tmp24: matcher.add_subject(s) for pattern_index, subst2 in matcher.match(tmp24, subst1): pass if pattern_index == 0: pass # State 141059 if len(subjects2) >= 1 and subjects2[0] == Integer( -1): tmp25 = subjects2.popleft() # State 141060 if len(subjects2) == 0: pass # State 141061 if len(subjects) == 0: pass # 1: 1/(a + b*x**n) yield 1, subst2 subjects2.appendleft(tmp25) subjects2.appendleft(tmp22) if len(subjects2) >= 1 and isinstance(subjects2[0], Add): tmp26 = subjects2.popleft() associative1 = tmp26 associative_type1 = type(tmp26) subjects27 = deque(tmp26._args) matcher = CommutativeMatcher141063.get() tmp28 = subjects27 subjects27 = [] for s in tmp28: matcher.add_subject(s) for pattern_index, subst1 in matcher.match(tmp28, subst0): pass if pattern_index == 0: pass # State 141080 if len(subjects2) >= 1 and subjects2[0] == Integer(-1): tmp29 = subjects2.popleft() # State 141081 if len(subjects2) == 0: pass # State 141082 if len(subjects) == 0: pass # 1: 1/(a + b*x**n) yield 1, subst1 subjects2.appendleft(tmp29) subjects2.appendleft(tmp26) subjects.appendleft(tmp1) return yield
class CommutativeMatcher65061(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.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 CommutativeMatcher65061._instance is None: CommutativeMatcher65061._instance = CommutativeMatcher65061() return CommutativeMatcher65061._instance @staticmethod def get_match_iter(subject): subjects = deque([subject]) if subject is not None else deque() subst0 = Substitution() # State 65060 subst1 = Substitution(subst0) try: subst1.try_add_variable('i2.2.1.2.1.0_1', S(1)) except ValueError: pass else: pass # State 65062 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 65063 if len(subjects) == 0: pass # 0: x*d yield 0, subst2 subjects.appendleft(tmp2) subst1 = Substitution(subst0) try: subst1.try_add_variable('i2.2.1.2.1.0', S(1)) except ValueError: pass else: pass # State 73880 if len(subjects) >= 1 and isinstance(subjects[0], Pow): tmp5 = subjects.popleft() subjects6 = deque(tmp5._args) # State 73881 if len(subjects6) >= 1: tmp7 = subjects6.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.1.2.1.1', tmp7) except ValueError: pass else: pass # State 73882 if len(subjects6) >= 1: tmp9 = subjects6.popleft() subst3 = Substitution(subst2) try: subst3.try_add_variable('i2.2.1.2.1.2', tmp9) except ValueError: pass else: pass # State 73883 if len(subjects6) == 0: pass # State 73884 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 = CommutativeMatcher65065.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 65066 if len(subjects) == 0: pass # 0: x*d yield 0, subst1 if pattern_index == 1: pass # State 73889 if len(subjects) == 0: pass # 1: d*x**n yield 1, subst1 subjects.appendleft(tmp11) return yield
class CommutativeMatcher15816(CommutativeMatcher): _instance = None patterns = { 0: (0, Multiset({0: 1}), [(VariableWithCount('i2.4.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 CommutativeMatcher15816._instance is None: CommutativeMatcher15816._instance = CommutativeMatcher15816() return CommutativeMatcher15816._instance @staticmethod def get_match_iter(subject): subjects = deque([subject]) if subject is not None else deque() subst0 = Substitution() # State 15815 subst1 = Substitution(subst0) try: subst1.try_add_variable('i2.4.1.0', S(0)) except ValueError: pass else: pass # State 15817 subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.4.1.1.0_1', S(1)) except ValueError: pass else: pass # State 15818 if len(subjects) >= 1: tmp3 = subjects.popleft() subst3 = Substitution(subst2) try: subst3.try_add_variable('i2.4.1.1.0', tmp3) except ValueError: pass else: pass # State 15819 if len(subjects) == 0: pass # 0: e + x*f 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 = CommutativeMatcher15821.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 15822 if len(subjects) == 0: pass # 0: e + x*f 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 = CommutativeMatcher15824.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 15830 if len(subjects) == 0: pass # 0: e + x*f yield 0, subst1 subjects.appendleft(tmp8) return yield
class CommutativeMatcher74299(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.2.1.2.0', 1, 1, S(0)), Add) ]), 2: (2, Multiset({2: 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 CommutativeMatcher74299._instance is None: CommutativeMatcher74299._instance = CommutativeMatcher74299() return CommutativeMatcher74299._instance @staticmethod def get_match_iter(subject): subjects = deque([subject]) if subject is not None else deque() subst0 = Substitution() # State 74298 subst1 = Substitution(subst0) try: subst1.try_add_variable('i2.2.1.2.1.0', S(1)) except ValueError: pass else: pass # State 74300 if len(subjects) >= 1 and isinstance(subjects[0], Pow): tmp2 = subjects.popleft() subjects3 = deque(tmp2._args) # State 74301 if len(subjects3) >= 1: tmp4 = subjects3.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.0_1', tmp4) except ValueError: pass else: pass # State 74302 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 74303 if len(subjects3) == 0: pass # State 74304 if len(subjects) == 0: pass # 0: x**n*d yield 0, subst3 subjects3.appendleft(tmp6) subjects3.appendleft(tmp4) if len(subjects3) >= 1: tmp8 = subjects3.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.0', tmp8) except ValueError: pass else: pass # State 74865 if len(subjects3) >= 1: tmp10 = subjects3.popleft() subst3 = Substitution(subst2) try: subst3.try_add_variable('i2.2.1.2.1.2', tmp10) except ValueError: pass else: pass # State 74866 if len(subjects3) == 0: pass # State 74867 if len(subjects) == 0: pass # 1: x**n*d yield 1, subst3 subjects3.appendleft(tmp10) subjects3.appendleft(tmp8) if len(subjects3) >= 1: tmp12 = subjects3.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.1.2.1.1', tmp12) except ValueError: pass else: pass # State 75252 if len(subjects3) >= 1: tmp14 = subjects3.popleft() subst3 = Substitution(subst2) try: subst3.try_add_variable('i2.2.1.2.1.2', tmp14) except ValueError: pass else: pass # State 75253 if len(subjects3) == 0: pass # State 75254 if len(subjects) == 0: pass # 2: d*x**n yield 2, subst3 subjects3.appendleft(tmp14) subjects3.appendleft(tmp12) subjects.appendleft(tmp2) if len(subjects) >= 1 and isinstance(subjects[0], Mul): tmp16 = subjects.popleft() associative1 = tmp16 associative_type1 = type(tmp16) subjects17 = deque(tmp16._args) matcher = CommutativeMatcher74306.get() tmp18 = subjects17 subjects17 = [] for s in tmp18: matcher.add_subject(s) for pattern_index, subst1 in matcher.match(tmp18, subst0): pass if pattern_index == 0: pass # State 74311 if len(subjects) == 0: pass # 0: x**n*d yield 0, subst1 if pattern_index == 1: pass # State 74871 if len(subjects) == 0: pass # 1: x**n*d yield 1, subst1 if pattern_index == 2: pass # State 75258 if len(subjects) == 0: pass # 2: d*x**n yield 2, subst1 subjects.appendleft(tmp16) return yield
class CommutativeMatcher67402(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 CommutativeMatcher67402._instance is None: CommutativeMatcher67402._instance = CommutativeMatcher67402() return CommutativeMatcher67402._instance @staticmethod def get_match_iter(subject): subjects = deque([subject]) if subject is not None else deque() subst0 = Substitution() # State 67401 subst1 = Substitution(subst0) try: subst1.try_add_variable('i2.2.1.3.1.0_1', S(1)) except ValueError: pass else: pass # State 67403 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 67404 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 84847 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 84848 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 86350 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 86351 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 = CommutativeMatcher67406.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 67407 if len(subjects) == 0: pass # 0: x*f yield 0, subst1 if pattern_index == 1: pass # State 84849 if len(subjects) == 0: pass # 1: x*d yield 1, subst1 if pattern_index == 2: pass # State 86352 if len(subjects) == 0: pass # 2: x*f yield 2, subst1 subjects.appendleft(tmp10) return yield
class CommutativeMatcher133000(CommutativeMatcher): _instance = None patterns = { 0: (0, Multiset({0: 1}), [ (VariableWithCount('i4.0', 1, 1, S(1)), Mul) ]), 1: (1, Multiset({1: 1}), [ (VariableWithCount('i4.0', 1, 1, S(1)), Mul) ]), 2: (2, Multiset({2: 1, 3: 1}), [ (VariableWithCount('i4.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 CommutativeMatcher133000._instance is None: CommutativeMatcher133000._instance = CommutativeMatcher133000() return CommutativeMatcher133000._instance @staticmethod def get_match_iter(subject): subjects = deque([subject]) if subject is not None else deque() subst0 = Substitution() # State 132999 if len(subjects) >= 1 and isinstance(subjects[0], log): tmp1 = subjects.popleft() subjects2 = deque(tmp1._args) # State 133001 subst1 = Substitution(subst0) try: subst1.try_add_variable('i4.2.0', S(1)) except ValueError: pass else: pass # State 133002 subst2 = Substitution(subst1) try: subst2.try_add_variable('i4.2.2', S(1)) except ValueError: pass else: pass # State 133003 if len(subjects2) >= 1: tmp5 = subjects2.popleft() subst3 = Substitution(subst2) try: subst3.try_add_variable('i4.2.1', tmp5) except ValueError: pass else: pass # State 133004 if len(subjects2) == 0: pass # State 133005 if len(subjects) == 0: pass # 0: log(c*x**n) /; (cons_f8) and (cons_f1875) yield 0, subst3 subjects2.appendleft(tmp5) if len(subjects2) >= 1 and isinstance(subjects2[0], Pow): tmp7 = subjects2.popleft() subjects8 = deque(tmp7._args) # State 133006 if len(subjects8) >= 1: tmp9 = subjects8.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i4.2.1', tmp9) except ValueError: pass else: pass # State 133007 subst3 = Substitution(subst2) try: subst3.try_add_variable('i4.2.2', 1) except ValueError: pass else: pass # State 133008 if len(subjects8) == 0: pass # State 133009 if len(subjects2) == 0: pass # State 133010 if len(subjects) == 0: pass # 0: log(c*x**n) /; (cons_f8) and (cons_f1875) yield 0, subst3 if len(subjects8) >= 1: tmp12 = subjects8.popleft() subst3 = Substitution(subst2) try: subst3.try_add_variable('i4.2.2', tmp12) except ValueError: pass else: pass # State 133008 if len(subjects8) == 0: pass # State 133009 if len(subjects2) == 0: pass # State 133010 if len(subjects) == 0: pass # 0: log(c*x**n) /; (cons_f8) and (cons_f1875) 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 = CommutativeMatcher133012.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 133019 if len(subjects2) == 0: pass # State 133020 if len(subjects) == 0: pass # 0: log(c*x**n) /; (cons_f8) and (cons_f1875) yield 0, subst1 subjects2.appendleft(tmp14) subjects.appendleft(tmp1) if len(subjects) >= 1 and isinstance(subjects[0], Pow): tmp17 = subjects.popleft() subjects18 = deque(tmp17._args) # State 136487 subst1 = Substitution(subst0) try: subst1.try_add_variable('i4.2.0', S(0)) except ValueError: pass else: pass # State 136488 subst2 = Substitution(subst1) try: subst2.try_add_variable('i4.2.1.0_1', S(1)) except ValueError: pass else: pass # State 136489 if len(subjects18) >= 1: tmp21 = subjects18.popleft() subst3 = Substitution(subst2) try: subst3.try_add_variable('i4.2.1.0', tmp21) except ValueError: pass else: pass # State 136490 if len(subjects18) >= 1 and subjects18[0] == Integer(-1): tmp23 = subjects18.popleft() # State 136491 if len(subjects18) == 0: pass # State 136492 if len(subjects) == 0: pass # 1: 1/(c + x*d) /; (cons_f2) and (cons_f8) and (cons_f29) yield 1, subst3 # 2: 1/(c + x*d) /; (cons_f2) and (cons_f3) and (cons_f8) and (cons_f29) and (cons_f73) yield 2, subst3 subjects18.appendleft(tmp23) subjects18.appendleft(tmp21) if len(subjects18) >= 1 and isinstance(subjects18[0], Mul): tmp24 = subjects18.popleft() associative1 = tmp24 associative_type1 = type(tmp24) subjects25 = deque(tmp24._args) matcher = CommutativeMatcher136494.get() tmp26 = subjects25 subjects25 = [] for s in tmp26: matcher.add_subject(s) for pattern_index, subst2 in matcher.match(tmp26, subst1): pass if pattern_index == 0: pass # State 136495 if len(subjects18) >= 1 and subjects18[0] == Integer(-1): tmp27 = subjects18.popleft() # State 136496 if len(subjects18) == 0: pass # State 136497 if len(subjects) == 0: pass # 1: 1/(c + x*d) /; (cons_f2) and (cons_f8) and (cons_f29) yield 1, subst2 # 2: 1/(c + x*d) /; (cons_f2) and (cons_f3) and (cons_f8) and (cons_f29) and (cons_f73) yield 2, subst2 subjects18.appendleft(tmp27) subjects18.appendleft(tmp24) if len(subjects18) >= 1 and isinstance(subjects18[0], Add): tmp28 = subjects18.popleft() associative1 = tmp28 associative_type1 = type(tmp28) subjects29 = deque(tmp28._args) matcher = CommutativeMatcher136499.get() tmp30 = subjects29 subjects29 = [] for s in tmp30: matcher.add_subject(s) for pattern_index, subst1 in matcher.match(tmp30, subst0): pass if pattern_index == 0: pass # State 136505 if len(subjects18) >= 1 and subjects18[0] == Integer(-1): tmp31 = subjects18.popleft() # State 136506 if len(subjects18) == 0: pass # State 136507 if len(subjects) == 0: pass # 1: 1/(c + x*d) /; (cons_f2) and (cons_f8) and (cons_f29) yield 1, subst1 # 2: 1/(c + x*d) /; (cons_f2) and (cons_f3) and (cons_f8) and (cons_f29) and (cons_f73) yield 2, subst1 subjects18.appendleft(tmp31) subjects18.appendleft(tmp28) subjects.appendleft(tmp17) subst1 = Substitution(subst0) try: subst1.try_add_variable('i4.1.0', S(0)) except ValueError: pass else: pass # State 136693 subst2 = Substitution(subst1) try: subst2.try_add_variable('i4.1.1.0', S(1)) except ValueError: pass else: pass # State 136694 if len(subjects) >= 1: tmp34 = subjects.popleft() subst3 = Substitution(subst2) try: subst3.try_add_variable('i4.2.1.0', tmp34) except ValueError: pass else: pass # State 136695 if len(subjects) == 0: pass # 3: a + b*x /; (cons_f2) and (cons_f3) and (cons_f8) and (cons_f29) and (cons_f73) yield 3, subst3 subjects.appendleft(tmp34) if len(subjects) >= 1 and isinstance(subjects[0], Mul): tmp36 = subjects.popleft() associative1 = tmp36 associative_type1 = type(tmp36) subjects37 = deque(tmp36._args) matcher = CommutativeMatcher136697.get() tmp38 = subjects37 subjects37 = [] for s in tmp38: matcher.add_subject(s) for pattern_index, subst2 in matcher.match(tmp38, subst1): pass if pattern_index == 0: pass # State 136698 if len(subjects) == 0: pass # 3: a + b*x /; (cons_f2) and (cons_f3) and (cons_f8) and (cons_f29) and (cons_f73) yield 3, subst2 subjects.appendleft(tmp36) if len(subjects) >= 1 and isinstance(subjects[0], Add): tmp39 = subjects.popleft() associative1 = tmp39 associative_type1 = type(tmp39) subjects40 = deque(tmp39._args) matcher = CommutativeMatcher136700.get() tmp41 = subjects40 subjects40 = [] for s in tmp41: matcher.add_subject(s) for pattern_index, subst1 in matcher.match(tmp41, subst0): pass if pattern_index == 0: pass # State 136706 if len(subjects) == 0: pass # 3: a + b*x /; (cons_f2) and (cons_f3) and (cons_f8) and (cons_f29) and (cons_f73) yield 3, subst1 subjects.appendleft(tmp39) return yield
class CommutativeMatcher18265(CommutativeMatcher): _instance = None patterns = { 0: (0, Multiset({0: 1, 1: 1}), [ ]), 1: (1, Multiset({2: 1}), [ (VariableWithCount('i4.0', 1, 1, S(1)), Mul) ]), 2: (2, Multiset({3: 1}), [ (VariableWithCount('i4.0', 1, 1, S(1)), Mul) ]), 3: (3, Multiset({4: 1}), [ (VariableWithCount('i4.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 CommutativeMatcher18265._instance is None: CommutativeMatcher18265._instance = CommutativeMatcher18265() return CommutativeMatcher18265._instance @staticmethod def get_match_iter(subject): subjects = deque([subject]) if subject is not None else deque() subst0 = Substitution() # State 18264 if len(subjects) >= 1 and isinstance(subjects[0], Pow): tmp1 = subjects.popleft() subjects2 = deque(tmp1._args) # State 18266 if len(subjects2) >= 1: tmp3 = subjects2.popleft() subst1 = Substitution(subst0) try: subst1.try_add_variable('i4.1', tmp3) except ValueError: pass else: pass # State 18267 if len(subjects2) >= 1 and subjects2[0] == Integer(-2): tmp5 = subjects2.popleft() # State 18268 if len(subjects2) == 0: pass # State 18269 if len(subjects) == 0: pass # 0: x**(-2) /; (cons_f1101) and (cons_f2) and (cons_f3) and (cons_f1153) yield 0, subst1 subjects2.appendleft(tmp5) subjects2.appendleft(tmp3) if len(subjects2) >= 1 and isinstance(subjects2[0], asinh): tmp6 = subjects2.popleft() subjects7 = deque(tmp6._args) # State 141800 subst1 = Substitution(subst0) try: subst1.try_add_variable('i4.3.0', S(0)) except ValueError: pass else: pass # State 141801 subst2 = Substitution(subst1) try: subst2.try_add_variable('i4.3.1.0_1', S(1)) except ValueError: pass else: pass # State 141802 if len(subjects7) >= 1: tmp10 = subjects7.popleft() subst3 = Substitution(subst2) try: subst3.try_add_variable('i4.3.1.0', tmp10) except ValueError: pass else: pass # State 141803 if len(subjects7) == 0: pass # State 141804 subst4 = Substitution(subst3) try: subst4.try_add_variable('i4.3', 1) except ValueError: pass else: pass # State 141805 if len(subjects2) == 0: pass # State 141806 if len(subjects) == 0: pass # 3: asinh(a + x*b)**n /; (cons_f2) and (cons_f3) and (cons_f8) and (cons_f127) and (cons_f150) yield 3, subst4 if len(subjects2) >= 1: tmp13 = subjects2.popleft() subst4 = Substitution(subst3) try: subst4.try_add_variable('i4.3', tmp13) except ValueError: pass else: pass # State 141805 if len(subjects2) == 0: pass # State 141806 if len(subjects) == 0: pass # 3: asinh(a + x*b)**n /; (cons_f2) and (cons_f3) and (cons_f8) and (cons_f127) and (cons_f150) yield 3, subst4 subjects2.appendleft(tmp13) subjects7.appendleft(tmp10) if len(subjects7) >= 1 and isinstance(subjects7[0], Mul): tmp15 = subjects7.popleft() associative1 = tmp15 associative_type1 = type(tmp15) subjects16 = deque(tmp15._args) matcher = CommutativeMatcher141808.get() tmp17 = subjects16 subjects16 = [] for s in tmp17: matcher.add_subject(s) for pattern_index, subst2 in matcher.match(tmp17, subst1): pass if pattern_index == 0: pass # State 141809 if len(subjects7) == 0: pass # State 141810 subst3 = Substitution(subst2) try: subst3.try_add_variable('i4.3', 1) except ValueError: pass else: pass # State 141811 if len(subjects2) == 0: pass # State 141812 if len(subjects) == 0: pass # 3: asinh(a + x*b)**n /; (cons_f2) and (cons_f3) and (cons_f8) and (cons_f127) and (cons_f150) yield 3, subst3 if len(subjects2) >= 1: tmp19 = subjects2.popleft() subst3 = Substitution(subst2) try: subst3.try_add_variable('i4.3', tmp19) except ValueError: pass else: pass # State 141811 if len(subjects2) == 0: pass # State 141812 if len(subjects) == 0: pass # 3: asinh(a + x*b)**n /; (cons_f2) and (cons_f3) and (cons_f8) and (cons_f127) and (cons_f150) yield 3, subst3 subjects2.appendleft(tmp19) subjects7.appendleft(tmp15) if len(subjects7) >= 1 and isinstance(subjects7[0], Add): tmp21 = subjects7.popleft() associative1 = tmp21 associative_type1 = type(tmp21) subjects22 = deque(tmp21._args) matcher = CommutativeMatcher141814.get() tmp23 = subjects22 subjects22 = [] for s in tmp23: matcher.add_subject(s) for pattern_index, subst1 in matcher.match(tmp23, subst0): pass if pattern_index == 0: pass # State 141820 if len(subjects7) == 0: pass # State 141821 subst2 = Substitution(subst1) try: subst2.try_add_variable('i4.3', 1) except ValueError: pass else: pass # State 141822 if len(subjects2) == 0: pass # State 141823 if len(subjects) == 0: pass # 3: asinh(a + x*b)**n /; (cons_f2) and (cons_f3) and (cons_f8) and (cons_f127) and (cons_f150) yield 3, subst2 if len(subjects2) >= 1: tmp25 = subjects2.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i4.3', tmp25) except ValueError: pass else: pass # State 141822 if len(subjects2) == 0: pass # State 141823 if len(subjects) == 0: pass # 3: asinh(a + x*b)**n /; (cons_f2) and (cons_f3) and (cons_f8) and (cons_f127) and (cons_f150) yield 3, subst2 subjects2.appendleft(tmp25) subjects7.appendleft(tmp21) subjects2.appendleft(tmp6) if len(subjects2) >= 1 and isinstance(subjects2[0], acosh): tmp27 = subjects2.popleft() subjects28 = deque(tmp27._args) # State 141906 subst1 = Substitution(subst0) try: subst1.try_add_variable('i4.3.0', S(0)) except ValueError: pass else: pass # State 141907 subst2 = Substitution(subst1) try: subst2.try_add_variable('i4.3.1.0_1', S(1)) except ValueError: pass else: pass # State 141908 if len(subjects28) >= 1: tmp31 = subjects28.popleft() subst3 = Substitution(subst2) try: subst3.try_add_variable('i4.3.1.0', tmp31) except ValueError: pass else: pass # State 141909 if len(subjects28) == 0: pass # State 141910 subst4 = Substitution(subst3) try: subst4.try_add_variable('i4.3', 1) except ValueError: pass else: pass # State 141911 if len(subjects2) == 0: pass # State 141912 if len(subjects) == 0: pass # 4: acosh(a + x*b)**n /; (cons_f2) and (cons_f3) and (cons_f8) and (cons_f127) and (cons_f150) yield 4, subst4 if len(subjects2) >= 1: tmp34 = subjects2.popleft() subst4 = Substitution(subst3) try: subst4.try_add_variable('i4.3', tmp34) except ValueError: pass else: pass # State 141911 if len(subjects2) == 0: pass # State 141912 if len(subjects) == 0: pass # 4: acosh(a + x*b)**n /; (cons_f2) and (cons_f3) and (cons_f8) and (cons_f127) and (cons_f150) yield 4, subst4 subjects2.appendleft(tmp34) subjects28.appendleft(tmp31) if len(subjects28) >= 1 and isinstance(subjects28[0], Mul): tmp36 = subjects28.popleft() associative1 = tmp36 associative_type1 = type(tmp36) subjects37 = deque(tmp36._args) matcher = CommutativeMatcher141914.get() tmp38 = subjects37 subjects37 = [] for s in tmp38: matcher.add_subject(s) for pattern_index, subst2 in matcher.match(tmp38, subst1): pass if pattern_index == 0: pass # State 141915 if len(subjects28) == 0: pass # State 141916 subst3 = Substitution(subst2) try: subst3.try_add_variable('i4.3', 1) except ValueError: pass else: pass # State 141917 if len(subjects2) == 0: pass # State 141918 if len(subjects) == 0: pass # 4: acosh(a + x*b)**n /; (cons_f2) and (cons_f3) and (cons_f8) and (cons_f127) and (cons_f150) yield 4, subst3 if len(subjects2) >= 1: tmp40 = subjects2.popleft() subst3 = Substitution(subst2) try: subst3.try_add_variable('i4.3', tmp40) except ValueError: pass else: pass # State 141917 if len(subjects2) == 0: pass # State 141918 if len(subjects) == 0: pass # 4: acosh(a + x*b)**n /; (cons_f2) and (cons_f3) and (cons_f8) and (cons_f127) and (cons_f150) yield 4, subst3 subjects2.appendleft(tmp40) subjects28.appendleft(tmp36) if len(subjects28) >= 1 and isinstance(subjects28[0], Add): tmp42 = subjects28.popleft() associative1 = tmp42 associative_type1 = type(tmp42) subjects43 = deque(tmp42._args) matcher = CommutativeMatcher141920.get() tmp44 = subjects43 subjects43 = [] for s in tmp44: matcher.add_subject(s) for pattern_index, subst1 in matcher.match(tmp44, subst0): pass if pattern_index == 0: pass # State 141926 if len(subjects28) == 0: pass # State 141927 subst2 = Substitution(subst1) try: subst2.try_add_variable('i4.3', 1) except ValueError: pass else: pass # State 141928 if len(subjects2) == 0: pass # State 141929 if len(subjects) == 0: pass # 4: acosh(a + x*b)**n /; (cons_f2) and (cons_f3) and (cons_f8) and (cons_f127) and (cons_f150) yield 4, subst2 if len(subjects2) >= 1: tmp46 = subjects2.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i4.3', tmp46) except ValueError: pass else: pass # State 141928 if len(subjects2) == 0: pass # State 141929 if len(subjects) == 0: pass # 4: acosh(a + x*b)**n /; (cons_f2) and (cons_f3) and (cons_f8) and (cons_f127) and (cons_f150) yield 4, subst2 subjects2.appendleft(tmp46) subjects28.appendleft(tmp42) subjects2.appendleft(tmp27) subjects.appendleft(tmp1) subst1 = Substitution(subst0) try: subst1.try_add_variable('i4.1.0', S(0)) except ValueError: pass else: pass # State 18270 subst2 = Substitution(subst1) try: subst2.try_add_variable('i4.1.1.0', S(1)) except ValueError: pass else: pass # State 18271 if len(subjects) >= 1 and isinstance(subjects[0], Pow): tmp50 = subjects.popleft() subjects51 = deque(tmp50._args) # State 18272 if len(subjects51) >= 1: tmp52 = subjects51.popleft() subst3 = Substitution(subst2) try: subst3.try_add_variable('i4.1', tmp52) except ValueError: pass else: pass # State 18273 if len(subjects51) >= 1 and subjects51[0] == Integer(4): tmp54 = subjects51.popleft() # State 18274 if len(subjects51) == 0: pass # State 18275 if len(subjects) == 0: pass # 1: a + b*x**4 /; (cons_f1101) and (cons_f2) and (cons_f3) and (cons_f1153) yield 1, subst3 subjects51.appendleft(tmp54) subjects51.appendleft(tmp52) subjects.appendleft(tmp50) if len(subjects) >= 1 and isinstance(subjects[0], Mul): tmp55 = subjects.popleft() associative1 = tmp55 associative_type1 = type(tmp55) subjects56 = deque(tmp55._args) matcher = CommutativeMatcher18277.get() tmp57 = subjects56 subjects56 = [] for s in tmp57: matcher.add_subject(s) for pattern_index, subst2 in matcher.match(tmp57, subst1): pass if pattern_index == 0: pass # State 18282 if len(subjects) == 0: pass # 1: a + b*x**4 /; (cons_f1101) and (cons_f2) and (cons_f3) and (cons_f1153) yield 1, subst2 subjects.appendleft(tmp55) subst1 = Substitution(subst0) try: subst1.try_add_variable('i4.3', S(1)) except ValueError: pass else: pass # State 141781 if len(subjects) >= 1 and isinstance(subjects[0], asinh): tmp59 = subjects.popleft() subjects60 = deque(tmp59._args) # State 141782 subst2 = Substitution(subst1) try: subst2.try_add_variable('i4.3.0', S(0)) except ValueError: pass else: pass # State 141783 subst3 = Substitution(subst2) try: subst3.try_add_variable('i4.3.1.0_1', S(1)) except ValueError: pass else: pass # State 141784 if len(subjects60) >= 1: tmp63 = subjects60.popleft() subst4 = Substitution(subst3) try: subst4.try_add_variable('i4.3.1.0', tmp63) except ValueError: pass else: pass # State 141785 if len(subjects60) == 0: pass # State 141786 if len(subjects) == 0: pass # 3: asinh(a + x*b)**n /; (cons_f2) and (cons_f3) and (cons_f8) and (cons_f127) and (cons_f150) yield 3, subst4 subjects60.appendleft(tmp63) if len(subjects60) >= 1 and isinstance(subjects60[0], Mul): tmp65 = subjects60.popleft() associative1 = tmp65 associative_type1 = type(tmp65) subjects66 = deque(tmp65._args) matcher = CommutativeMatcher141788.get() tmp67 = subjects66 subjects66 = [] for s in tmp67: matcher.add_subject(s) for pattern_index, subst3 in matcher.match(tmp67, subst2): pass if pattern_index == 0: pass # State 141789 if len(subjects60) == 0: pass # State 141790 if len(subjects) == 0: pass # 3: asinh(a + x*b)**n /; (cons_f2) and (cons_f3) and (cons_f8) and (cons_f127) and (cons_f150) yield 3, subst3 subjects60.appendleft(tmp65) if len(subjects60) >= 1 and isinstance(subjects60[0], Add): tmp68 = subjects60.popleft() associative1 = tmp68 associative_type1 = type(tmp68) subjects69 = deque(tmp68._args) matcher = CommutativeMatcher141792.get() tmp70 = subjects69 subjects69 = [] for s in tmp70: matcher.add_subject(s) for pattern_index, subst2 in matcher.match(tmp70, subst1): pass if pattern_index == 0: pass # State 141798 if len(subjects60) == 0: pass # State 141799 if len(subjects) == 0: pass # 3: asinh(a + x*b)**n /; (cons_f2) and (cons_f3) and (cons_f8) and (cons_f127) and (cons_f150) yield 3, subst2 subjects60.appendleft(tmp68) subjects.appendleft(tmp59) if len(subjects) >= 1 and isinstance(subjects[0], acosh): tmp71 = subjects.popleft() subjects72 = deque(tmp71._args) # State 141888 subst2 = Substitution(subst1) try: subst2.try_add_variable('i4.3.0', S(0)) except ValueError: pass else: pass # State 141889 subst3 = Substitution(subst2) try: subst3.try_add_variable('i4.3.1.0_1', S(1)) except ValueError: pass else: pass # State 141890 if len(subjects72) >= 1: tmp75 = subjects72.popleft() subst4 = Substitution(subst3) try: subst4.try_add_variable('i4.3.1.0', tmp75) except ValueError: pass else: pass # State 141891 if len(subjects72) == 0: pass # State 141892 if len(subjects) == 0: pass # 4: acosh(a + x*b)**n /; (cons_f2) and (cons_f3) and (cons_f8) and (cons_f127) and (cons_f150) yield 4, subst4 subjects72.appendleft(tmp75) if len(subjects72) >= 1 and isinstance(subjects72[0], Mul): tmp77 = subjects72.popleft() associative1 = tmp77 associative_type1 = type(tmp77) subjects78 = deque(tmp77._args) matcher = CommutativeMatcher141894.get() tmp79 = subjects78 subjects78 = [] for s in tmp79: matcher.add_subject(s) for pattern_index, subst3 in matcher.match(tmp79, subst2): pass if pattern_index == 0: pass # State 141895 if len(subjects72) == 0: pass # State 141896 if len(subjects) == 0: pass # 4: acosh(a + x*b)**n /; (cons_f2) and (cons_f3) and (cons_f8) and (cons_f127) and (cons_f150) yield 4, subst3 subjects72.appendleft(tmp77) if len(subjects72) >= 1 and isinstance(subjects72[0], Add): tmp80 = subjects72.popleft() associative1 = tmp80 associative_type1 = type(tmp80) subjects81 = deque(tmp80._args) matcher = CommutativeMatcher141898.get() tmp82 = subjects81 subjects81 = [] for s in tmp82: matcher.add_subject(s) for pattern_index, subst2 in matcher.match(tmp82, subst1): pass if pattern_index == 0: pass # State 141904 if len(subjects72) == 0: pass # State 141905 if len(subjects) == 0: pass # 4: acosh(a + x*b)**n /; (cons_f2) and (cons_f3) and (cons_f8) and (cons_f127) and (cons_f150) yield 4, subst2 subjects72.appendleft(tmp80) subjects.appendleft(tmp71) if len(subjects) >= 1 and isinstance(subjects[0], Add): tmp83 = subjects.popleft() associative1 = tmp83 associative_type1 = type(tmp83) subjects84 = deque(tmp83._args) matcher = CommutativeMatcher18284.get() tmp85 = subjects84 subjects84 = [] for s in tmp85: matcher.add_subject(s) for pattern_index, subst1 in matcher.match(tmp85, subst0): pass if pattern_index == 0: pass # State 18297 if len(subjects) == 0: pass # 1: a + b*x**4 /; (cons_f1101) and (cons_f2) and (cons_f3) and (cons_f1153) yield 1, subst1 subjects.appendleft(tmp83) if len(subjects) >= 1 and isinstance(subjects[0], log): tmp86 = subjects.popleft() subjects87 = deque(tmp86._args) # State 54149 if len(subjects87) >= 1: tmp88 = subjects87.popleft() subst1 = Substitution(subst0) try: subst1.try_add_variable('i4.1', tmp88) except ValueError: pass else: pass # State 54150 if len(subjects87) == 0: pass # State 54151 if len(subjects) == 0: pass # 2: log(u) yield 2, subst1 subjects87.appendleft(tmp88) subjects.appendleft(tmp86) return yield
class CommutativeMatcher47597(CommutativeMatcher): _instance = None patterns = { 0: (0, Multiset({0: 1}), [(VariableWithCount('i2.3.2.2.0', 1, 1, S(0)), Add)]), 1: (1, Multiset({1: 1}), [(VariableWithCount('i2.3.2.2.0', 1, 1, S(0)), Add)]), 2: (2, Multiset({2: 1}), [(VariableWithCount('i2.3.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 CommutativeMatcher47597._instance is None: CommutativeMatcher47597._instance = CommutativeMatcher47597() return CommutativeMatcher47597._instance @staticmethod def get_match_iter(subject): subjects = deque([subject]) if subject is not None else deque() subst0 = Substitution() # State 47596 subst1 = Substitution(subst0) try: subst1.try_add_variable('i2.3.2.2.1.0', S(1)) except ValueError: pass else: pass # State 47598 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 47599 if len(subjects) == 0: pass # 0: x*b 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 48495 if len(subjects) == 0: pass # 1: x*b yield 1, subst2 subjects.appendleft(tmp4) subst1 = Substitution(subst0) try: subst1.try_add_variable('i2.3.2.2.1.0_1', S(1)) except ValueError: pass else: pass # State 48944 if len(subjects) >= 1: tmp7 = subjects.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.3.2.2.1.0', tmp7) except ValueError: pass else: pass # State 48945 if len(subjects) == 0: pass # 2: x*d yield 2, subst2 subjects.appendleft(tmp7) if len(subjects) >= 1 and isinstance(subjects[0], Mul): tmp9 = subjects.popleft() associative1 = tmp9 associative_type1 = type(tmp9) subjects10 = deque(tmp9._args) matcher = CommutativeMatcher47601.get() tmp11 = subjects10 subjects10 = [] for s in tmp11: matcher.add_subject(s) for pattern_index, subst1 in matcher.match(tmp11, subst0): pass if pattern_index == 0: pass # State 47602 if len(subjects) == 0: pass # 0: x*b yield 0, subst1 if pattern_index == 1: pass # State 48496 if len(subjects) == 0: pass # 1: x*b yield 1, subst1 if pattern_index == 2: pass # State 48946 if len(subjects) == 0: pass # 2: x*d yield 2, subst1 subjects.appendleft(tmp9) return yield
class CommutativeMatcher21859(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)]), 7: (7, Multiset({7: 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 CommutativeMatcher21859._instance is None: CommutativeMatcher21859._instance = CommutativeMatcher21859() return CommutativeMatcher21859._instance @staticmethod def get_match_iter(subject): subjects = deque([subject]) if subject is not None else deque() subst0 = Substitution() # State 21858 subst1 = Substitution(subst0) try: subst1.try_add_variable('i2.2.1.2.2.2', S(1)) except ValueError: pass else: pass # State 21860 subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.1.2.2.2.0', S(0)) except ValueError: pass else: pass # State 21861 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 21862 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 21863 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 35710 if len(subjects) >= 1 and isinstance(subjects[0], Pow): tmp7 = subjects.popleft() subjects8 = deque(tmp7._args) # State 35711 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 35712 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 35713 if len(subjects8) == 0: pass # State 35714 if len(subjects) == 0: pass # 4: (e + f*x**m)**p yield 4, subst5 subjects8.appendleft(tmp11) subjects8.appendleft(tmp9) if len(subjects8) >= 1: tmp13 = subjects8.popleft() subst4 = Substitution(subst3) try: subst4.try_add_variable('i2.2.1.1', tmp13) except ValueError: pass else: pass # State 40096 if len(subjects8) >= 1: tmp15 = subjects8.popleft() subst5 = Substitution(subst4) try: subst5.try_add_variable( 'i2.2.1.2', tmp15) except ValueError: pass else: pass # State 40097 if len(subjects8) == 0: pass # State 40098 if len(subjects) == 0: pass # 5: (x**j*f + e)**p yield 5, subst5 subjects8.appendleft(tmp15) subjects8.appendleft(tmp13) subjects.appendleft(tmp7) if len(subjects) >= 1 and isinstance(subjects[0], Mul): tmp17 = subjects.popleft() associative1 = tmp17 associative_type1 = type(tmp17) subjects18 = deque(tmp17._args) matcher = CommutativeMatcher21865.get() tmp19 = subjects18 subjects18 = [] for s in tmp19: matcher.add_subject(s) for pattern_index, subst3 in matcher.match(tmp19, subst2): pass if pattern_index == 0: pass # State 21866 if len(subjects) == 0: pass # 0: (e + x*f)**p yield 0, subst3 if pattern_index == 1: pass # State 35719 if len(subjects) == 0: pass # 4: (e + f*x**m)**p yield 4, subst3 if pattern_index == 2: pass # State 40102 if len(subjects) == 0: pass # 5: (x**j*f + e)**p yield 5, subst3 subjects.appendleft(tmp17) if len(subjects) >= 1: tmp20 = subjects.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.1.2.2.1', tmp20) except ValueError: pass else: pass # State 45755 if len(subjects) == 0: pass # 7: v**p yield 7, subst2 subjects.appendleft(tmp20) if len(subjects) >= 1 and isinstance(subjects[0], Add): tmp22 = subjects.popleft() associative1 = tmp22 associative_type1 = type(tmp22) subjects23 = deque(tmp22._args) matcher = CommutativeMatcher21868.get() tmp24 = subjects23 subjects23 = [] for s in tmp24: matcher.add_subject(s) for pattern_index, subst2 in matcher.match(tmp24, subst1): pass if pattern_index == 0: pass # State 21874 if len(subjects) == 0: pass # 0: (e + x*f)**p yield 0, subst2 if pattern_index == 1: pass # State 29868 if len(subjects) == 0: pass # 2: (e + f*x**m)**p yield 2, subst2 if pattern_index == 2: pass # State 35720 if len(subjects) == 0: pass # 4: (e + f*x**m)**p yield 4, subst2 if pattern_index == 3: pass # State 40110 if len(subjects) == 0: pass # 5: (x**j*f + e)**p yield 5, subst2 if pattern_index == 4: pass # State 44738 if len(subjects) == 0: pass # 6: (e + f*x + g*x**2)**p yield 6, subst2 subjects.appendleft(tmp22) if len(subjects) >= 1 and isinstance(subjects[0], Mul): tmp25 = subjects.popleft() associative1 = tmp25 associative_type1 = type(tmp25) subjects26 = deque(tmp25._args) matcher = CommutativeMatcher33327.get() tmp27 = subjects26 subjects26 = [] for s in tmp27: matcher.add_subject(s) for pattern_index, subst2 in matcher.match(tmp27, subst1): pass if pattern_index == 0: pass # State 33351 if len(subjects) == 0: pass # 3: (x**m*(f + e*x**r))**p yield 3, subst2 subjects.appendleft(tmp25) if len(subjects) >= 1 and isinstance(subjects[0], Pow): tmp28 = subjects.popleft() subjects29 = deque(tmp28._args) # State 21875 subst1 = Substitution(subst0) try: subst1.try_add_variable('i2.2.1.2.2.2.0', S(0)) except ValueError: pass else: pass # State 21876 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 21877 if len(subjects29) >= 1: tmp32 = subjects29.popleft() subst3 = Substitution(subst2) try: subst3.try_add_variable('i2.2.1.2.2.2.1.0', tmp32) except ValueError: pass else: pass # State 21878 subst4 = Substitution(subst3) try: subst4.try_add_variable('i2.2.1.2.2.2', 1) except ValueError: pass else: pass # State 21879 if len(subjects29) == 0: pass # State 21880 if len(subjects) == 0: pass # 0: (e + x*f)**p yield 0, subst4 if len(subjects29) >= 1: tmp35 = subjects29.popleft() subst4 = Substitution(subst3) try: subst4.try_add_variable( 'i2.2.1.2.2.2', tmp35) except ValueError: pass else: pass # State 21879 if len(subjects29) == 0: pass # State 21880 if len(subjects) == 0: pass # 0: (e + x*f)**p yield 0, subst4 subjects29.appendleft(tmp35) subjects29.appendleft(tmp32) subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.1.2.2.2.1.0', S(1)) except ValueError: pass else: pass # State 35721 if len(subjects29) >= 1 and isinstance(subjects29[0], Pow): tmp38 = subjects29.popleft() subjects39 = deque(tmp38._args) # State 35722 if len(subjects39) >= 1: tmp40 = subjects39.popleft() subst3 = Substitution(subst2) try: subst3.try_add_variable( 'i2.2.1.2.2.2.1.1', tmp40) except ValueError: pass else: pass # State 35723 if len(subjects39) >= 1: tmp42 = subjects39.popleft() subst4 = Substitution(subst3) try: subst4.try_add_variable( 'i2.2.1.2.2.2.1.2', tmp42) except ValueError: pass else: pass # State 35724 if len(subjects39) == 0: pass # State 35725 subst5 = Substitution(subst4) try: subst5.try_add_variable( 'i2.2.1.2.2.2', 1) except ValueError: pass else: pass # State 35726 if len(subjects29) == 0: pass # State 35727 if len(subjects) == 0: pass # 4: (e + f*x**m)**p yield 4, subst5 if len(subjects29) >= 1: tmp45 = subjects29.popleft() subst5 = Substitution(subst4) try: subst5.try_add_variable( 'i2.2.1.2.2.2', tmp45) except ValueError: pass else: pass # State 35726 if len(subjects29) == 0: pass # State 35727 if len(subjects) == 0: pass # 4: (e + f*x**m)**p yield 4, subst5 subjects29.appendleft(tmp45) subjects39.appendleft(tmp42) subjects39.appendleft(tmp40) if len(subjects39) >= 1: tmp47 = subjects39.popleft() subst3 = Substitution(subst2) try: subst3.try_add_variable('i2.2.1.1', tmp47) except ValueError: pass else: pass # State 40111 if len(subjects39) >= 1: tmp49 = subjects39.popleft() subst4 = Substitution(subst3) try: subst4.try_add_variable( 'i2.2.1.2', tmp49) except ValueError: pass else: pass # State 40112 if len(subjects39) == 0: pass # State 40113 subst5 = Substitution(subst4) try: subst5.try_add_variable( 'i2.2.1.2.2.2', 1) except ValueError: pass else: pass # State 40114 if len(subjects29) == 0: pass # State 40115 if len(subjects) == 0: pass # 5: (x**j*f + e)**p yield 5, subst5 if len(subjects29) >= 1: tmp52 = subjects29.popleft() subst5 = Substitution(subst4) try: subst5.try_add_variable( 'i2.2.1.2.2.2', tmp52) except ValueError: pass else: pass # State 40114 if len(subjects29) == 0: pass # State 40115 if len(subjects) == 0: pass # 5: (x**j*f + e)**p yield 5, subst5 subjects29.appendleft(tmp52) subjects39.appendleft(tmp49) subjects39.appendleft(tmp47) subjects29.appendleft(tmp38) if len(subjects29) >= 1 and isinstance(subjects29[0], Mul): tmp54 = subjects29.popleft() associative1 = tmp54 associative_type1 = type(tmp54) subjects55 = deque(tmp54._args) matcher = CommutativeMatcher21882.get() tmp56 = subjects55 subjects55 = [] for s in tmp56: matcher.add_subject(s) for pattern_index, subst2 in matcher.match(tmp56, subst1): pass if pattern_index == 0: pass # State 21883 subst3 = Substitution(subst2) try: subst3.try_add_variable('i2.2.1.2.2.2', 1) except ValueError: pass else: pass # State 21884 if len(subjects29) == 0: pass # State 21885 if len(subjects) == 0: pass # 0: (e + x*f)**p yield 0, subst3 if len(subjects29) >= 1: tmp58 = [] tmp58.append(subjects29.popleft()) while True: if len(tmp58) > 1: tmp59 = create_operation_expression( associative1, tmp58) elif len(tmp58) == 1: tmp59 = tmp58[0] else: assert False, "Unreachable" subst3 = Substitution(subst2) try: subst3.try_add_variable( 'i2.2.1.2.2.2', tmp59) except ValueError: pass else: pass # State 21884 if len(subjects29) == 0: pass # State 21885 if len(subjects) == 0: pass # 0: (e + x*f)**p yield 0, subst3 if len(subjects29) == 0: break tmp58.append(subjects29.popleft()) subjects29.extendleft(reversed(tmp58)) if pattern_index == 1: pass # State 35732 subst3 = Substitution(subst2) try: subst3.try_add_variable('i2.2.1.2.2.2', 1) except ValueError: pass else: pass # State 35733 if len(subjects29) == 0: pass # State 35734 if len(subjects) == 0: pass # 4: (e + f*x**m)**p yield 4, subst3 if len(subjects29) >= 1: tmp62 = [] tmp62.append(subjects29.popleft()) while True: if len(tmp62) > 1: tmp63 = create_operation_expression( associative1, tmp62) elif len(tmp62) == 1: tmp63 = tmp62[0] else: assert False, "Unreachable" subst3 = Substitution(subst2) try: subst3.try_add_variable( 'i2.2.1.2.2.2', tmp63) except ValueError: pass else: pass # State 35733 if len(subjects29) == 0: pass # State 35734 if len(subjects) == 0: pass # 4: (e + f*x**m)**p yield 4, subst3 if len(subjects29) == 0: break tmp62.append(subjects29.popleft()) subjects29.extendleft(reversed(tmp62)) if pattern_index == 2: pass # State 40119 subst3 = Substitution(subst2) try: subst3.try_add_variable('i2.2.1.2.2.2', 1) except ValueError: pass else: pass # State 40120 if len(subjects29) == 0: pass # State 40121 if len(subjects) == 0: pass # 5: (x**j*f + e)**p yield 5, subst3 if len(subjects29) >= 1: tmp66 = [] tmp66.append(subjects29.popleft()) while True: if len(tmp66) > 1: tmp67 = create_operation_expression( associative1, tmp66) elif len(tmp66) == 1: tmp67 = tmp66[0] else: assert False, "Unreachable" subst3 = Substitution(subst2) try: subst3.try_add_variable( 'i2.2.1.2.2.2', tmp67) except ValueError: pass else: pass # State 40120 if len(subjects29) == 0: pass # State 40121 if len(subjects) == 0: pass # 5: (x**j*f + e)**p yield 5, subst3 if len(subjects29) == 0: break tmp66.append(subjects29.popleft()) subjects29.extendleft(reversed(tmp66)) subjects29.appendleft(tmp54) if len(subjects29) >= 1: tmp69 = subjects29.popleft() subst1 = Substitution(subst0) try: subst1.try_add_variable('i2.2.1.2.2.1', tmp69) except ValueError: pass else: pass # State 25802 if len(subjects29) >= 1: tmp71 = subjects29.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.1.2.2.2', tmp71) except ValueError: pass else: pass # State 25803 if len(subjects29) == 0: pass # State 25804 if len(subjects) == 0: pass # 1: v**p yield 1, subst2 subjects29.appendleft(tmp71) subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.1.2.2.2', 1) except ValueError: pass else: pass # State 45756 if len(subjects29) == 0: pass # State 45757 if len(subjects) == 0: pass # 7: v**p yield 7, subst2 if len(subjects29) >= 1: tmp74 = subjects29.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.1.2.2.2', tmp74) except ValueError: pass else: pass # State 45756 if len(subjects29) == 0: pass # State 45757 if len(subjects) == 0: pass # 7: v**p yield 7, subst2 subjects29.appendleft(tmp74) subjects29.appendleft(tmp69) if len(subjects29) >= 1 and isinstance(subjects29[0], Add): tmp76 = subjects29.popleft() associative1 = tmp76 associative_type1 = type(tmp76) subjects77 = deque(tmp76._args) matcher = CommutativeMatcher21887.get() tmp78 = subjects77 subjects77 = [] for s in tmp78: matcher.add_subject(s) for pattern_index, subst1 in matcher.match(tmp78, subst0): pass if pattern_index == 0: pass # State 21893 subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.1.2.2.2', 1) except ValueError: pass else: pass # State 21894 if len(subjects29) == 0: pass # State 21895 if len(subjects) == 0: pass # 0: (e + x*f)**p yield 0, subst2 if len(subjects29) >= 1: tmp80 = [] tmp80.append(subjects29.popleft()) while True: if len(tmp80) > 1: tmp81 = create_operation_expression( associative1, tmp80) elif len(tmp80) == 1: tmp81 = tmp80[0] else: assert False, "Unreachable" subst2 = Substitution(subst1) try: subst2.try_add_variable( 'i2.2.1.2.2.2', tmp81) except ValueError: pass else: pass # State 21894 if len(subjects29) == 0: pass # State 21895 if len(subjects) == 0: pass # 0: (e + x*f)**p yield 0, subst2 if len(subjects29) == 0: break tmp80.append(subjects29.popleft()) subjects29.extendleft(reversed(tmp80)) if pattern_index == 1: pass # State 29879 subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.1.2.2.2', 1) except ValueError: pass else: pass # State 29880 if len(subjects29) == 0: pass # State 29881 if len(subjects) == 0: pass # 2: (e + f*x**m)**p yield 2, subst2 if len(subjects29) >= 1: tmp84 = [] tmp84.append(subjects29.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 29880 if len(subjects29) == 0: pass # State 29881 if len(subjects) == 0: pass # 2: (e + f*x**m)**p yield 2, subst2 if len(subjects29) == 0: break tmp84.append(subjects29.popleft()) subjects29.extendleft(reversed(tmp84)) if pattern_index == 2: pass # State 35735 subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.1.2.2.2', 1) except ValueError: pass else: pass # State 35736 if len(subjects29) == 0: pass # State 35737 if len(subjects) == 0: pass # 4: (e + f*x**m)**p yield 4, subst2 if len(subjects29) >= 1: tmp88 = [] tmp88.append(subjects29.popleft()) while True: if len(tmp88) > 1: tmp89 = create_operation_expression( associative1, tmp88) elif len(tmp88) == 1: tmp89 = tmp88[0] else: assert False, "Unreachable" subst2 = Substitution(subst1) try: subst2.try_add_variable( 'i2.2.1.2.2.2', tmp89) except ValueError: pass else: pass # State 35736 if len(subjects29) == 0: pass # State 35737 if len(subjects) == 0: pass # 4: (e + f*x**m)**p yield 4, subst2 if len(subjects29) == 0: break tmp88.append(subjects29.popleft()) subjects29.extendleft(reversed(tmp88)) if pattern_index == 3: pass # State 40129 subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.1.2.2.2', 1) except ValueError: pass else: pass # State 40130 if len(subjects29) == 0: pass # State 40131 if len(subjects) == 0: pass # 5: (x**j*f + e)**p yield 5, subst2 if len(subjects29) >= 1: tmp92 = [] tmp92.append(subjects29.popleft()) while True: if len(tmp92) > 1: tmp93 = create_operation_expression( associative1, tmp92) elif len(tmp92) == 1: tmp93 = tmp92[0] else: assert False, "Unreachable" subst2 = Substitution(subst1) try: subst2.try_add_variable( 'i2.2.1.2.2.2', tmp93) except ValueError: pass else: pass # State 40130 if len(subjects29) == 0: pass # State 40131 if len(subjects) == 0: pass # 5: (x**j*f + e)**p yield 5, subst2 if len(subjects29) == 0: break tmp92.append(subjects29.popleft()) subjects29.extendleft(reversed(tmp92)) if pattern_index == 4: pass # State 44746 subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.1.2.2.2', 1) except ValueError: pass else: pass # State 44747 if len(subjects29) == 0: pass # State 44748 if len(subjects) == 0: pass # 6: (e + f*x + g*x**2)**p yield 6, subst2 if len(subjects29) >= 1: tmp96 = [] tmp96.append(subjects29.popleft()) while True: if len(tmp96) > 1: tmp97 = create_operation_expression( associative1, tmp96) elif len(tmp96) == 1: tmp97 = tmp96[0] else: assert False, "Unreachable" subst2 = Substitution(subst1) try: subst2.try_add_variable( 'i2.2.1.2.2.2', tmp97) except ValueError: pass else: pass # State 44747 if len(subjects29) == 0: pass # State 44748 if len(subjects) == 0: pass # 6: (e + f*x + g*x**2)**p yield 6, subst2 if len(subjects29) == 0: break tmp96.append(subjects29.popleft()) subjects29.extendleft(reversed(tmp96)) subjects29.appendleft(tmp76) if len(subjects29) >= 1 and isinstance(subjects29[0], Mul): tmp99 = subjects29.popleft() associative1 = tmp99 associative_type1 = type(tmp99) subjects100 = deque(tmp99._args) matcher = CommutativeMatcher33353.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 33377 subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.1.2.2.2', 1) except ValueError: pass else: pass # State 33378 if len(subjects29) == 0: pass # State 33379 if len(subjects) == 0: pass # 3: (x**m*(f + e*x**r))**p yield 3, subst2 if len(subjects29) >= 1: tmp103 = [] tmp103.append(subjects29.popleft()) while True: if len(tmp103) > 1: tmp104 = create_operation_expression( associative1, tmp103) elif len(tmp103) == 1: tmp104 = tmp103[0] else: assert False, "Unreachable" subst2 = Substitution(subst1) try: subst2.try_add_variable( 'i2.2.1.2.2.2', tmp104) except ValueError: pass else: pass # State 33378 if len(subjects29) == 0: pass # State 33379 if len(subjects) == 0: pass # 3: (x**m*(f + e*x**r))**p yield 3, subst2 if len(subjects29) == 0: break tmp103.append(subjects29.popleft()) subjects29.extendleft(reversed(tmp103)) subjects29.appendleft(tmp99) subjects.appendleft(tmp28) return yield
class CommutativeMatcher61853(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.4.0', 1, 1, S(0)), Add)]), 2: (2, Multiset({2: 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 CommutativeMatcher61853._instance is None: CommutativeMatcher61853._instance = CommutativeMatcher61853() return CommutativeMatcher61853._instance @staticmethod def get_match_iter(subject): subjects = deque([subject]) if subject is not None else deque() subst0 = Substitution() # State 61852 subst1 = Substitution(subst0) try: subst1.try_add_variable('i2.2.1.3.1.0_1', S(1)) except ValueError: pass else: pass # State 61854 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 61855 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 64668 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 64669 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.3.1.0', S(1)) except ValueError: pass else: pass # State 98696 if len(subjects) >= 1 and isinstance(subjects[0], Pow): tmp8 = subjects.popleft() subjects9 = deque(tmp8._args) # State 98697 if len(subjects9) >= 1: tmp10 = subjects9.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.1.3.1.1', tmp10) except ValueError: pass else: pass # State 98698 if len(subjects9) >= 1: tmp12 = subjects9.popleft() subst3 = Substitution(subst2) try: subst3.try_add_variable('i2.2.1.3.1.2', tmp12) except ValueError: pass else: pass # State 98699 if len(subjects9) == 0: pass # State 98700 if len(subjects) == 0: pass # 2: d*x**n yield 2, subst3 subjects9.appendleft(tmp12) subjects9.appendleft(tmp10) subjects.appendleft(tmp8) if len(subjects) >= 1 and isinstance(subjects[0], Mul): tmp14 = subjects.popleft() associative1 = tmp14 associative_type1 = type(tmp14) subjects15 = deque(tmp14._args) matcher = CommutativeMatcher61857.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 61858 if len(subjects) == 0: pass # 0: x*f yield 0, subst1 if pattern_index == 1: pass # State 64670 if len(subjects) == 0: pass # 1: x*f yield 1, subst1 if pattern_index == 2: pass # State 98705 if len(subjects) == 0: pass # 2: d*x**n yield 2, subst1 subjects.appendleft(tmp14) return yield
class CommutativeMatcher59875(CommutativeMatcher): _instance = None patterns = { 0: (0, Multiset({0: 1}), [(VariableWithCount('i2.1.1.2.0', 1, 1, S(0)), Add)]), 1: (1, Multiset({1: 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 CommutativeMatcher59875._instance is None: CommutativeMatcher59875._instance = CommutativeMatcher59875() return CommutativeMatcher59875._instance @staticmethod def get_match_iter(subject): subjects = deque([subject]) if subject is not None else deque() subst0 = Substitution() # State 59874 subst1 = Substitution(subst0) try: subst1.try_add_variable('i2.1.1.2.1.0_1', S(1)) except ValueError: pass else: pass # State 59876 if len(subjects) >= 1: tmp2 = subjects.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.1.1.2.1.0', tmp2) except ValueError: pass else: pass # State 59877 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 65089 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 65090 if len(subjects) == 0: pass # 1: x*d 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 = CommutativeMatcher59879.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 59880 if len(subjects) == 0: pass # 0: x*f yield 0, subst1 if pattern_index == 1: pass # State 65091 if len(subjects) == 0: pass # 1: x*d yield 1, subst1 subjects.appendleft(tmp7) return yield
class CommutativeMatcher146015(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.1', 1, 1, None), Mul), (VariableWithCount('i2.3.0', 1, 1, S(1)), Mul) ]), 2: (2, Multiset({2: 1}), [ (VariableWithCount('i2.2.1.1', 1, 1, None), Mul), (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 CommutativeMatcher146015._instance is None: CommutativeMatcher146015._instance = CommutativeMatcher146015() return CommutativeMatcher146015._instance @staticmethod def get_match_iter(subject): subjects = deque([subject]) if subject is not None else deque() subst0 = Substitution() # State 146014 if len(subjects) >= 1 and isinstance(subjects[0], Pow): tmp1 = subjects.popleft() subjects2 = deque(tmp1._args) # State 146016 subst1 = Substitution(subst0) try: subst1.try_add_variable('i2.3.2.0', S(0)) except ValueError: pass else: pass # State 146017 subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.3.2.1.0', S(1)) except ValueError: pass else: pass # State 146018 subst3 = Substitution(subst2) try: subst3.try_add_variable('i2.3.2.1.2', S(1)) except ValueError: pass else: pass # State 146019 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 146020 if len(subjects2) >= 1 and subjects2[0] == Integer(-1): tmp8 = subjects2.popleft() # State 146021 if len(subjects2) == 0: pass # State 146022 if len(subjects) == 0: pass # 0: 1/(a + b*x**n) 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 146023 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 146024 subst4 = Substitution(subst3) try: subst4.try_add_variable('i2.3.2.1.2', 1) except ValueError: pass else: pass # State 146025 if len(subjects10) == 0: pass # State 146026 if len(subjects2) >= 1 and subjects2[0] == Integer(-1): tmp14 = subjects2.popleft() # State 146027 if len(subjects2) == 0: pass # State 146028 if len(subjects) == 0: pass # 0: 1/(a + b*x**n) 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 146025 if len(subjects10) == 0: pass # State 146026 if len(subjects2) >= 1 and subjects2[0] == Integer(-1): tmp17 = subjects2.popleft() # State 146027 if len(subjects2) == 0: pass # State 146028 if len(subjects) == 0: pass # 0: 1/(a + b*x**n) yield 0, subst4 subjects2.appendleft(tmp17) subjects10.appendleft(tmp15) subjects10.appendleft(tmp11) if len(subjects10) >= 1: tmp18 = subjects10.popleft() subst3 = Substitution(subst2) try: subst3.try_add_variable('i2.2.1.1', tmp18) except ValueError: pass else: pass # State 146675 if len(subjects10) >= 1 and subjects10[0] == Integer(2): tmp20 = subjects10.popleft() # State 146676 if len(subjects10) == 0: pass # State 146677 if len(subjects2) >= 1 and subjects2[0] == Rational(-1, 2): tmp21 = subjects2.popleft() # State 146678 if len(subjects2) == 0: pass # State 146679 if len(subjects) == 0: pass # 2: 1/sqrt(x**2*b + a) yield 2, subst3 subjects2.appendleft(tmp21) subjects10.appendleft(tmp20) subjects10.appendleft(tmp18) subjects2.appendleft(tmp9) if len(subjects2) >= 1 and isinstance(subjects2[0], Mul): tmp22 = subjects2.popleft() associative1 = tmp22 associative_type1 = type(tmp22) subjects23 = deque(tmp22._args) matcher = CommutativeMatcher146030.get() tmp24 = subjects23 subjects23 = [] for s in tmp24: matcher.add_subject(s) for pattern_index, subst2 in matcher.match(tmp24, subst1): pass if pattern_index == 0: pass # State 146037 if len(subjects2) >= 1 and subjects2[0] == Integer(-1): tmp25 = subjects2.popleft() # State 146038 if len(subjects2) == 0: pass # State 146039 if len(subjects) == 0: pass # 0: 1/(a + b*x**n) yield 0, subst2 subjects2.appendleft(tmp25) if pattern_index == 1: pass # State 146683 if len(subjects2) >= 1 and subjects2[0] == Rational(-1, 2): tmp26 = subjects2.popleft() # State 146684 if len(subjects2) == 0: pass # State 146685 if len(subjects) == 0: pass # 2: 1/sqrt(x**2*b + a) yield 2, subst2 subjects2.appendleft(tmp26) subjects2.appendleft(tmp22) subst1 = Substitution(subst0) try: subst1.try_add_variable('i2.2.0', S(0)) except ValueError: pass else: pass # State 146511 subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.1.0', S(1)) except ValueError: pass else: pass # State 146512 if len(subjects2) >= 1 and isinstance(subjects2[0], Pow): tmp29 = subjects2.popleft() subjects30 = deque(tmp29._args) # State 146513 if len(subjects30) >= 1: tmp31 = subjects30.popleft() subst3 = Substitution(subst2) try: subst3.try_add_variable('i2.2.1.1', tmp31) except ValueError: pass else: pass # State 146514 if len(subjects30) >= 1 and subjects30[0] == Integer(2): tmp33 = subjects30.popleft() # State 146515 if len(subjects30) == 0: pass # State 146516 if len(subjects2) >= 1 and subjects2[0] == Rational(-1, 2): tmp34 = subjects2.popleft() # State 146517 if len(subjects2) == 0: pass # State 146518 if len(subjects) == 0: pass # 1: 1/sqrt(d + e*x**2) yield 1, subst3 subjects2.appendleft(tmp34) subjects30.appendleft(tmp33) subjects30.appendleft(tmp31) subjects2.appendleft(tmp29) if len(subjects2) >= 1 and isinstance(subjects2[0], Mul): tmp35 = subjects2.popleft() associative1 = tmp35 associative_type1 = type(tmp35) subjects36 = deque(tmp35._args) matcher = CommutativeMatcher146520.get() tmp37 = subjects36 subjects36 = [] for s in tmp37: matcher.add_subject(s) for pattern_index, subst2 in matcher.match(tmp37, subst1): pass if pattern_index == 0: pass # State 146525 if len(subjects2) >= 1 and subjects2[0] == Rational(-1, 2): tmp38 = subjects2.popleft() # State 146526 if len(subjects2) == 0: pass # State 146527 if len(subjects) == 0: pass # 1: 1/sqrt(d + e*x**2) yield 1, subst2 subjects2.appendleft(tmp38) subjects2.appendleft(tmp35) if len(subjects2) >= 1 and isinstance(subjects2[0], Add): tmp39 = subjects2.popleft() associative1 = tmp39 associative_type1 = type(tmp39) subjects40 = deque(tmp39._args) matcher = CommutativeMatcher146041.get() tmp41 = subjects40 subjects40 = [] for s in tmp41: matcher.add_subject(s) for pattern_index, subst1 in matcher.match(tmp41, subst0): pass if pattern_index == 0: pass # State 146058 if len(subjects2) >= 1 and subjects2[0] == Integer(-1): tmp42 = subjects2.popleft() # State 146059 if len(subjects2) == 0: pass # State 146060 if len(subjects) == 0: pass # 0: 1/(a + b*x**n) yield 0, subst1 subjects2.appendleft(tmp42) if pattern_index == 1: pass # State 146537 if len(subjects2) >= 1 and subjects2[0] == Rational(-1, 2): tmp43 = subjects2.popleft() # State 146538 if len(subjects2) == 0: pass # State 146539 if len(subjects) == 0: pass # 1: 1/sqrt(d + e*x**2) yield 1, subst1 subjects2.appendleft(tmp43) if pattern_index == 2: pass # State 146690 if len(subjects2) >= 1 and subjects2[0] == Rational(-1, 2): tmp44 = subjects2.popleft() # State 146691 if len(subjects2) == 0: pass # State 146692 if len(subjects) == 0: pass # 2: 1/sqrt(x**2*b + a) yield 2, subst1 subjects2.appendleft(tmp44) subjects2.appendleft(tmp39) subjects.appendleft(tmp1) return yield
class CommutativeMatcher141344(CommutativeMatcher): _instance = None patterns = { 0: (0, Multiset({0: 1}), [(VariableWithCount('i2.3.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 CommutativeMatcher141344._instance is None: CommutativeMatcher141344._instance = CommutativeMatcher141344() return CommutativeMatcher141344._instance @staticmethod def get_match_iter(subject): subjects = deque([subject]) if subject is not None else deque() subst0 = Substitution() # State 141343 subst1 = Substitution(subst0) try: subst1.try_add_variable('i2.3.2.1.0', S(1)) except ValueError: pass else: pass # State 141345 subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.3.2.1.2', S(1)) except ValueError: pass else: pass # State 141346 if len(subjects) >= 1: tmp3 = subjects.popleft() subst3 = Substitution(subst2) try: subst3.try_add_variable('i2.3.2.1.1', tmp3) except ValueError: pass else: pass # State 141347 if len(subjects) == 0: pass # 0: b*x**n /; (cons_f2) and (cons_f3) and (cons_f8) and (cons_f4) and (cons_f19) and (cons_f1768) yield 0, subst3 subjects.appendleft(tmp3) if len(subjects) >= 1 and isinstance(subjects[0], Pow): tmp5 = subjects.popleft() subjects6 = deque(tmp5._args) # State 141348 if len(subjects6) >= 1: tmp7 = subjects6.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.3.2.1.1', tmp7) except ValueError: pass else: pass # State 141349 subst3 = Substitution(subst2) try: subst3.try_add_variable('i2.3.2.1.2', 1) except ValueError: pass else: pass # State 141350 if len(subjects6) == 0: pass # State 141351 if len(subjects) == 0: pass # 0: b*x**n /; (cons_f2) and (cons_f3) and (cons_f8) and (cons_f4) and (cons_f19) and (cons_f1768) yield 0, subst3 if len(subjects6) >= 1: tmp10 = subjects6.popleft() subst3 = Substitution(subst2) try: subst3.try_add_variable('i2.3.2.1.2', tmp10) except ValueError: pass else: pass # State 141350 if len(subjects6) == 0: pass # State 141351 if len(subjects) == 0: pass # 0: b*x**n /; (cons_f2) and (cons_f3) and (cons_f8) and (cons_f4) and (cons_f19) and (cons_f1768) 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 = CommutativeMatcher141353.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 141360 if len(subjects) == 0: pass # 0: b*x**n /; (cons_f2) and (cons_f3) and (cons_f8) and (cons_f4) and (cons_f19) and (cons_f1768) yield 0, subst1 subjects.appendleft(tmp12) return yield
class CommutativeMatcher17009(CommutativeMatcher): _instance = None patterns = { 0: (0, Multiset({0: 1}), [ (VariableWithCount('i4.1.0', 1, 1, S(1)), Mul) ]), 1: (1, Multiset({1: 1}), [ (VariableWithCount('i4.1.0', 1, 1, S(1)), Mul) ]), 2: (2, Multiset({2: 1}), [ (VariableWithCount('i4.1.0', 1, 1, S(1)), Mul) ]), 3: (3, Multiset({3: 1}), [ (VariableWithCount('i4.1.0', 1, 1, S(1)), Mul) ]), 4: (4, Multiset({4: 1}), [ (VariableWithCount('i4.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 CommutativeMatcher17009._instance is None: CommutativeMatcher17009._instance = CommutativeMatcher17009() return CommutativeMatcher17009._instance @staticmethod def get_match_iter(subject): subjects = deque([subject]) if subject is not None else deque() subst0 = Substitution() # State 17008 subst1 = Substitution(subst0) try: subst1.try_add_variable('i4.1.1.0', S(0)) except ValueError: pass else: pass # State 17010 subst2 = Substitution(subst1) try: subst2.try_add_variable('i4.1.1.1.0_1', S(1)) except ValueError: pass else: pass # State 17011 if len(subjects) >= 1: tmp3 = subjects.popleft() subst3 = Substitution(subst2) try: subst3.try_add_variable('i4.1.1.1.0', tmp3) except ValueError: pass else: pass # State 17012 if len(subjects) == 0: pass # 0: c + x*d /; (cons_f1101) and (cons_f2) and (cons_f3) and (cons_f8) and (cons_f29) and (cons_f1115) 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 = CommutativeMatcher17014.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 17015 if len(subjects) == 0: pass # 0: c + x*d /; (cons_f1101) and (cons_f2) and (cons_f3) and (cons_f8) and (cons_f29) and (cons_f1115) 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 = CommutativeMatcher17017.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 17023 if len(subjects) == 0: pass # 0: c + x*d /; (cons_f1101) and (cons_f2) and (cons_f3) and (cons_f8) and (cons_f29) and (cons_f1115) yield 0, subst1 subjects.appendleft(tmp8) if len(subjects) >= 1 and isinstance(subjects[0], Pow): tmp11 = subjects.popleft() subjects12 = deque(tmp11._args) # State 17096 subst1 = Substitution(subst0) try: subst1.try_add_variable('i4.1.2.0', S(0)) except ValueError: pass else: pass # State 17097 subst2 = Substitution(subst1) try: subst2.try_add_variable('i4.1.2.1.0_1', S(1)) except ValueError: pass else: pass # State 17098 if len(subjects12) >= 1: tmp15 = subjects12.popleft() subst3 = Substitution(subst2) try: subst3.try_add_variable('i4.1.2.1.0', tmp15) except ValueError: pass else: pass # State 17099 if len(subjects12) >= 1 and subjects12[0] == Integer(2): tmp17 = subjects12.popleft() # State 17100 if len(subjects12) == 0: pass # State 17101 if len(subjects) == 0: pass # 1: (c + x*d)**2 /; (cons_f1101) and (cons_f2) and (cons_f3) and (cons_f8) and (cons_f29) yield 1, subst3 subjects12.appendleft(tmp17) if len(subjects12) >= 1: tmp18 = subjects12.popleft() subst4 = Substitution(subst3) try: subst4.try_add_variable('i4.1.2', tmp18) except ValueError: pass else: pass # State 17187 if len(subjects12) == 0: pass # State 17188 if len(subjects) == 0: pass # 2: (c + x*d)**n /; (cons_f1101) and (cons_f2) and (cons_f3) and (cons_f8) and (cons_f29) and (cons_f1116) and (cons_f198) yield 2, subst4 # 3: (c + x*d)**n /; (cons_f1101) and (cons_f2) and (cons_f3) and (cons_f8) and (cons_f29) and (cons_f1116) and (cons_f25) yield 3, subst4 # 4: (c + x*d)**n /; (cons_f1101) and (cons_f2) and (cons_f3) and (cons_f8) and (cons_f29) and (cons_f4) and (cons_f1117) yield 4, subst4 subjects12.appendleft(tmp18) subjects12.appendleft(tmp15) if len(subjects12) >= 1 and isinstance(subjects12[0], Mul): tmp20 = subjects12.popleft() associative1 = tmp20 associative_type1 = type(tmp20) subjects21 = deque(tmp20._args) matcher = CommutativeMatcher17103.get() tmp22 = subjects21 subjects21 = [] for s in tmp22: matcher.add_subject(s) for pattern_index, subst2 in matcher.match(tmp22, subst1): pass if pattern_index == 0: pass # State 17104 if len(subjects12) >= 1 and subjects12[0] == Integer(2): tmp23 = subjects12.popleft() # State 17105 if len(subjects12) == 0: pass # State 17106 if len(subjects) == 0: pass # 1: (c + x*d)**2 /; (cons_f1101) and (cons_f2) and (cons_f3) and (cons_f8) and (cons_f29) yield 1, subst2 subjects12.appendleft(tmp23) if len(subjects12) >= 1: tmp24 = [] tmp24.append(subjects12.popleft()) while True: if len(tmp24) > 1: tmp25 = create_operation_expression(associative1, tmp24) elif len(tmp24) == 1: tmp25 = tmp24[0] else: assert False, "Unreachable" subst3 = Substitution(subst2) try: subst3.try_add_variable('i4.1.2', tmp25) except ValueError: pass else: pass # State 17189 if len(subjects12) == 0: pass # State 17190 if len(subjects) == 0: pass # 2: (c + x*d)**n /; (cons_f1101) and (cons_f2) and (cons_f3) and (cons_f8) and (cons_f29) and (cons_f1116) and (cons_f198) yield 2, subst3 # 3: (c + x*d)**n /; (cons_f1101) and (cons_f2) and (cons_f3) and (cons_f8) and (cons_f29) and (cons_f1116) and (cons_f25) yield 3, subst3 # 4: (c + x*d)**n /; (cons_f1101) and (cons_f2) and (cons_f3) and (cons_f8) and (cons_f29) and (cons_f4) and (cons_f1117) yield 4, subst3 if len(subjects12) == 0: break tmp24.append(subjects12.popleft()) subjects12.extendleft(reversed(tmp24)) subjects12.appendleft(tmp20) if len(subjects12) >= 1 and isinstance(subjects12[0], Add): tmp27 = subjects12.popleft() associative1 = tmp27 associative_type1 = type(tmp27) subjects28 = deque(tmp27._args) matcher = CommutativeMatcher17108.get() tmp29 = subjects28 subjects28 = [] for s in tmp29: matcher.add_subject(s) for pattern_index, subst1 in matcher.match(tmp29, subst0): pass if pattern_index == 0: pass # State 17114 if len(subjects12) >= 1 and subjects12[0] == Integer(2): tmp30 = subjects12.popleft() # State 17115 if len(subjects12) == 0: pass # State 17116 if len(subjects) == 0: pass # 1: (c + x*d)**2 /; (cons_f1101) and (cons_f2) and (cons_f3) and (cons_f8) and (cons_f29) yield 1, subst1 subjects12.appendleft(tmp30) if len(subjects12) >= 1: tmp31 = [] tmp31.append(subjects12.popleft()) while True: if len(tmp31) > 1: tmp32 = create_operation_expression(associative1, tmp31) elif len(tmp31) == 1: tmp32 = tmp31[0] else: assert False, "Unreachable" subst2 = Substitution(subst1) try: subst2.try_add_variable('i4.1.2', tmp32) except ValueError: pass else: pass # State 17191 if len(subjects12) == 0: pass # State 17192 if len(subjects) == 0: pass # 2: (c + x*d)**n /; (cons_f1101) and (cons_f2) and (cons_f3) and (cons_f8) and (cons_f29) and (cons_f1116) and (cons_f198) yield 2, subst2 # 3: (c + x*d)**n /; (cons_f1101) and (cons_f2) and (cons_f3) and (cons_f8) and (cons_f29) and (cons_f1116) and (cons_f25) yield 3, subst2 # 4: (c + x*d)**n /; (cons_f1101) and (cons_f2) and (cons_f3) and (cons_f8) and (cons_f29) and (cons_f4) and (cons_f1117) yield 4, subst2 if len(subjects12) == 0: break tmp31.append(subjects12.popleft()) subjects12.extendleft(reversed(tmp31)) subjects12.appendleft(tmp27) subjects.appendleft(tmp11) return yield
class CommutativeMatcher61897(CommutativeMatcher): _instance = None patterns = { 0: (0, Multiset({}), [ (VariableWithCount('i2.2.1.3.1.0', 1, 1, None), Mul), (VariableWithCount('i2.2.1.3.1.0_1', 1, 1, S(1)), Mul) ]), 1: (1, Multiset({0: 1}), [ (VariableWithCount('i2.2.1.3.1.0', 1, 1, S(1)), Mul) ]), 2: (2, Multiset({1: 1}), [ (VariableWithCount('i2.2.1.3.1.0', 1, 1, S(1)), Mul) ]), 3: (3, Multiset({}), [ (VariableWithCount('i2.2.1.0', 1, 1, None), Mul), (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 CommutativeMatcher61897._instance is None: CommutativeMatcher61897._instance = CommutativeMatcher61897() return CommutativeMatcher61897._instance @staticmethod def get_match_iter(subject): subjects = deque([subject]) if subject is not None else deque() subst0 = Substitution() # State 61896 if len(subjects) >= 1 and isinstance(subjects[0], Pow): tmp1 = subjects.popleft() subjects2 = deque(tmp1._args) # State 98819 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 98820 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 98821 if len(subjects2) == 0: pass # State 98822 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.2.0_1', tmp7) except ValueError: pass else: pass # State 99383 if len(subjects2) >= 1: tmp9 = subjects2.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.1.3.1.2', tmp9) except ValueError: pass else: pass # State 99384 if len(subjects2) == 0: pass # State 99385 if len(subjects) == 0: pass # 1: x**n yield 1, subst2 subjects2.appendleft(tmp9) subjects2.appendleft(tmp7) subjects.appendleft(tmp1) return yield
class CommutativeMatcher10249(CommutativeMatcher): _instance = None patterns = { 0: (0, Multiset({0: 1}), [(VariableWithCount('i2.2.1.2.0', 1, 1, S(1)), Mul)]), 1: (1, Multiset({1: 1}), [(VariableWithCount('i2.2.1.2.0', 1, 1, S(1)), Mul)]), 2: (2, Multiset({2: 1}), [(VariableWithCount('i2.2.1.2.0', 1, 1, S(1)), Mul)]), 3: (3, Multiset({3: 1}), [(VariableWithCount('i2.2.1.2.0', 1, 1, S(1)), Mul)]), 4: (4, Multiset({4: 1}), [(VariableWithCount('i2.2.1.2.0', 1, 1, S(1)), Mul)]), 5: (5, Multiset({5: 1}), [(VariableWithCount('i2.2.1.2.0', 1, 1, S(1)), Mul)]), 6: (6, Multiset({6: 1}), [(VariableWithCount('i2.2.1.2.0', 1, 1, S(1)), Mul)]), 7: (7, Multiset({7: 1}), [(VariableWithCount('i2.2.1.2.0', 1, 1, S(1)), Mul)]), 8: (8, Multiset({8: 1}), [(VariableWithCount('i2.2.1.2.0', 1, 1, S(1)), Mul)]), 9: (9, Multiset({9: 1}), [(VariableWithCount('i2.2.1.2.0', 1, 1, S(1)), Mul)]), 10: (10, Multiset({10: 1}), [(VariableWithCount('i2.2.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 CommutativeMatcher10249._instance is None: CommutativeMatcher10249._instance = CommutativeMatcher10249() return CommutativeMatcher10249._instance @staticmethod def get_match_iter(subject): subjects = deque([subject]) if subject is not None else deque() subst0 = Substitution() # State 10248 if len(subjects) >= 1 and isinstance(subjects[0], Pow): tmp1 = subjects.popleft() subjects2 = deque(tmp1._args) # State 10250 if len(subjects2) >= 1: tmp3 = subjects2.popleft() subst1 = Substitution(subst0) try: subst1.try_add_variable('i2.2.1.2.1', tmp3) except ValueError: pass else: pass # State 10251 if len(subjects2) >= 1: tmp5 = subjects2.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.1.2.2', tmp5) except ValueError: pass else: pass # State 10252 if len(subjects2) == 0: pass # State 10253 if len(subjects) == 0: pass # 0: x**n yield 0, subst2 subjects2.appendleft(tmp5) if len(subjects2) >= 1 and subjects2[0] == Integer(-1): tmp7 = subjects2.popleft() # State 10719 if len(subjects2) == 0: pass # State 10720 if len(subjects) == 0: pass # 1: 1/x yield 1, subst1 subjects2.appendleft(tmp7) subjects2.appendleft(tmp3) if len(subjects2) >= 1: tmp8 = subjects2.popleft() subst1 = Substitution(subst0) try: subst1.try_add_variable('i2.2.0', tmp8) except ValueError: pass else: pass # State 10855 if len(subjects2) >= 1 and subjects2[0] == Integer(-1): tmp10 = subjects2.popleft() # State 10856 if len(subjects2) == 0: pass # State 10857 if len(subjects) == 0: pass # 2: 1/x yield 2, subst1 subjects2.appendleft(tmp10) subjects2.appendleft(tmp8) if len(subjects2) >= 1 and isinstance(subjects2[0], tan): tmp11 = subjects2.popleft() subjects12 = deque(tmp11._args) # State 82557 subst1 = Substitution(subst0) try: subst1.try_add_variable('i2.2.1.2.3.0', S(0)) except ValueError: pass else: pass # State 82558 subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.1.2.3.1.0_1', S(1)) except ValueError: pass else: pass # State 82559 if len(subjects12) >= 1: tmp15 = subjects12.popleft() subst3 = Substitution(subst2) try: subst3.try_add_variable( 'i2.2.1.2.3.1.0', tmp15) except ValueError: pass else: pass # State 82560 if len(subjects12) == 0: pass # State 82561 if len(subjects2) >= 1 and subjects2[ 0] == Integer(-1): tmp17 = subjects2.popleft() # State 82562 if len(subjects2) == 0: pass # State 82563 if len(subjects) == 0: pass # 8: 1/tan(c + x*d) yield 8, subst3 subjects2.appendleft(tmp17) subjects12.appendleft(tmp15) if len(subjects12) >= 1 and isinstance(subjects12[0], Mul): tmp18 = subjects12.popleft() associative1 = tmp18 associative_type1 = type(tmp18) subjects19 = deque(tmp18._args) matcher = CommutativeMatcher82565.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 82566 if len(subjects12) == 0: pass # State 82567 if len(subjects2) >= 1 and subjects2[ 0] == Integer(-1): tmp21 = subjects2.popleft() # State 82568 if len(subjects2) == 0: pass # State 82569 if len(subjects) == 0: pass # 8: 1/tan(c + x*d) yield 8, subst2 subjects2.appendleft(tmp21) subjects12.appendleft(tmp18) subst1 = Substitution(subst0) try: subst1.try_add_variable('i2.4.0', S(0)) except ValueError: pass else: pass # State 83161 subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.4.1.0_1', S(1)) except ValueError: pass else: pass # State 83162 if len(subjects12) >= 1: tmp24 = subjects12.popleft() subst3 = Substitution(subst2) try: subst3.try_add_variable('i2.4.1.0', tmp24) except ValueError: pass else: pass # State 83163 if len(subjects12) == 0: pass # State 83164 if len(subjects2) >= 1 and subjects2[ 0] == Integer(-1): tmp26 = subjects2.popleft() # State 83165 if len(subjects2) == 0: pass # State 83166 if len(subjects) == 0: pass # 10: 1/tan(e + x*f) yield 10, subst3 subjects2.appendleft(tmp26) subjects12.appendleft(tmp24) if len(subjects12) >= 1 and isinstance(subjects12[0], Mul): tmp27 = subjects12.popleft() associative1 = tmp27 associative_type1 = type(tmp27) subjects28 = deque(tmp27._args) matcher = CommutativeMatcher83168.get() tmp29 = subjects28 subjects28 = [] for s in tmp29: matcher.add_subject(s) for pattern_index, subst2 in matcher.match( tmp29, subst1): pass if pattern_index == 0: pass # State 83169 if len(subjects12) == 0: pass # State 83170 if len(subjects2) >= 1 and subjects2[ 0] == Integer(-1): tmp30 = subjects2.popleft() # State 83171 if len(subjects2) == 0: pass # State 83172 if len(subjects) == 0: pass # 10: 1/tan(e + x*f) yield 10, subst2 subjects2.appendleft(tmp30) subjects12.appendleft(tmp27) if len(subjects12) >= 1 and isinstance(subjects12[0], Add): tmp31 = subjects12.popleft() associative1 = tmp31 associative_type1 = type(tmp31) subjects32 = deque(tmp31._args) matcher = CommutativeMatcher82571.get() tmp33 = subjects32 subjects32 = [] for s in tmp33: matcher.add_subject(s) for pattern_index, subst1 in matcher.match(tmp33, subst0): pass if pattern_index == 0: pass # State 82577 if len(subjects12) == 0: pass # State 82578 if len(subjects2 ) >= 1 and subjects2[0] == Integer(-1): tmp34 = subjects2.popleft() # State 82579 if len(subjects2) == 0: pass # State 82580 if len(subjects) == 0: pass # 8: 1/tan(c + x*d) yield 8, subst1 subjects2.appendleft(tmp34) if pattern_index == 1: pass # State 83176 if len(subjects12) == 0: pass # State 83177 if len(subjects2 ) >= 1 and subjects2[0] == Integer(-1): tmp35 = subjects2.popleft() # State 83178 if len(subjects2) == 0: pass # State 83179 if len(subjects) == 0: pass # 10: 1/tan(e + x*f) yield 10, subst1 subjects2.appendleft(tmp35) subjects12.appendleft(tmp31) subjects2.appendleft(tmp11) subjects.appendleft(tmp1) if len(subjects) >= 1 and isinstance(subjects[0], sin): tmp36 = subjects.popleft() subjects37 = deque(tmp36._args) # State 68150 subst1 = Substitution(subst0) try: subst1.try_add_variable('i2.2.1.2.2.0', S(0)) except ValueError: pass else: pass # State 68151 subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.1.2.2.1.0_1', S(1)) except ValueError: pass else: pass # State 68152 if len(subjects37) >= 1: tmp40 = subjects37.popleft() subst3 = Substitution(subst2) try: subst3.try_add_variable('i2.2.1.2.2.1.0', tmp40) except ValueError: pass else: pass # State 68153 if len(subjects37) == 0: pass # State 68154 if len(subjects) == 0: pass # 3: sin(c + x*d) yield 3, subst3 subjects37.appendleft(tmp40) if len(subjects37) >= 1 and isinstance(subjects37[0], Mul): tmp42 = subjects37.popleft() associative1 = tmp42 associative_type1 = type(tmp42) subjects43 = deque(tmp42._args) matcher = CommutativeMatcher68156.get() tmp44 = subjects43 subjects43 = [] for s in tmp44: matcher.add_subject(s) for pattern_index, subst2 in matcher.match(tmp44, subst1): pass if pattern_index == 0: pass # State 68157 if len(subjects37) == 0: pass # State 68158 if len(subjects) == 0: pass # 3: sin(c + x*d) yield 3, subst2 subjects37.appendleft(tmp42) subst1 = Substitution(subst0) try: subst1.try_add_variable('i2.4.0', S(0)) except ValueError: pass else: pass # State 71481 subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.4.1.0_1', S(1)) except ValueError: pass else: pass # State 71482 if len(subjects37) >= 1: tmp47 = subjects37.popleft() subst3 = Substitution(subst2) try: subst3.try_add_variable('i2.4.1.0', tmp47) except ValueError: pass else: pass # State 71483 if len(subjects37) == 0: pass # State 71484 if len(subjects) == 0: pass # 6: sin(e + x*f) yield 6, subst3 subjects37.appendleft(tmp47) if len(subjects37) >= 1 and isinstance(subjects37[0], Mul): tmp49 = subjects37.popleft() associative1 = tmp49 associative_type1 = type(tmp49) subjects50 = deque(tmp49._args) matcher = CommutativeMatcher71486.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 71487 if len(subjects37) == 0: pass # State 71488 if len(subjects) == 0: pass # 6: sin(e + x*f) yield 6, subst2 subjects37.appendleft(tmp49) if len(subjects37) >= 1 and isinstance(subjects37[0], Add): tmp52 = subjects37.popleft() associative1 = tmp52 associative_type1 = type(tmp52) subjects53 = deque(tmp52._args) matcher = CommutativeMatcher68160.get() tmp54 = subjects53 subjects53 = [] for s in tmp54: matcher.add_subject(s) for pattern_index, subst1 in matcher.match(tmp54, subst0): pass if pattern_index == 0: pass # State 68166 if len(subjects37) == 0: pass # State 68167 if len(subjects) == 0: pass # 3: sin(c + x*d) yield 3, subst1 if pattern_index == 1: pass # State 71492 if len(subjects37) == 0: pass # State 71493 if len(subjects) == 0: pass # 6: sin(e + x*f) yield 6, subst1 subjects37.appendleft(tmp52) subjects.appendleft(tmp36) if len(subjects) >= 1 and isinstance(subjects[0], cos): tmp55 = subjects.popleft() subjects56 = deque(tmp55._args) # State 68371 subst1 = Substitution(subst0) try: subst1.try_add_variable('i2.2.1.2.2.0', S(0)) except ValueError: pass else: pass # State 68372 subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.1.2.2.1.0_1', S(1)) except ValueError: pass else: pass # State 68373 if len(subjects56) >= 1: tmp59 = subjects56.popleft() subst3 = Substitution(subst2) try: subst3.try_add_variable('i2.2.1.2.2.1.0', tmp59) except ValueError: pass else: pass # State 68374 if len(subjects56) == 0: pass # State 68375 if len(subjects) == 0: pass # 4: cos(c + x*d) yield 4, subst3 subjects56.appendleft(tmp59) if len(subjects56) >= 1 and isinstance(subjects56[0], Mul): tmp61 = subjects56.popleft() associative1 = tmp61 associative_type1 = type(tmp61) subjects62 = deque(tmp61._args) matcher = CommutativeMatcher68377.get() tmp63 = subjects62 subjects62 = [] for s in tmp63: matcher.add_subject(s) for pattern_index, subst2 in matcher.match(tmp63, subst1): pass if pattern_index == 0: pass # State 68378 if len(subjects56) == 0: pass # State 68379 if len(subjects) == 0: pass # 4: cos(c + x*d) yield 4, subst2 subjects56.appendleft(tmp61) subst1 = Substitution(subst0) try: subst1.try_add_variable('i2.4.0', S(0)) except ValueError: pass else: pass # State 68592 subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.4.1.0_1', S(1)) except ValueError: pass else: pass # State 68593 if len(subjects56) >= 1: tmp66 = subjects56.popleft() subst3 = Substitution(subst2) try: subst3.try_add_variable('i2.4.1.0', tmp66) except ValueError: pass else: pass # State 68594 if len(subjects56) == 0: pass # State 68595 if len(subjects) == 0: pass # 5: cos(e + x*f) yield 5, subst3 subjects56.appendleft(tmp66) if len(subjects56) >= 1 and isinstance(subjects56[0], Mul): tmp68 = subjects56.popleft() associative1 = tmp68 associative_type1 = type(tmp68) subjects69 = deque(tmp68._args) matcher = CommutativeMatcher68597.get() tmp70 = subjects69 subjects69 = [] for s in tmp70: matcher.add_subject(s) for pattern_index, subst2 in matcher.match(tmp70, subst1): pass if pattern_index == 0: pass # State 68598 if len(subjects56) == 0: pass # State 68599 if len(subjects) == 0: pass # 5: cos(e + x*f) yield 5, subst2 subjects56.appendleft(tmp68) if len(subjects56) >= 1 and isinstance(subjects56[0], Add): tmp71 = subjects56.popleft() associative1 = tmp71 associative_type1 = type(tmp71) subjects72 = deque(tmp71._args) matcher = CommutativeMatcher68381.get() tmp73 = subjects72 subjects72 = [] for s in tmp73: matcher.add_subject(s) for pattern_index, subst1 in matcher.match(tmp73, subst0): pass if pattern_index == 0: pass # State 68387 if len(subjects56) == 0: pass # State 68388 if len(subjects) == 0: pass # 4: cos(c + x*d) yield 4, subst1 if pattern_index == 1: pass # State 68603 if len(subjects56) == 0: pass # State 68604 if len(subjects) == 0: pass # 5: cos(e + x*f) yield 5, subst1 subjects56.appendleft(tmp71) subjects.appendleft(tmp55) if len(subjects) >= 1 and isinstance(subjects[0], tan): tmp74 = subjects.popleft() subjects75 = deque(tmp74._args) # State 82436 subst1 = Substitution(subst0) try: subst1.try_add_variable('i2.2.1.2.2.0', S(0)) except ValueError: pass else: pass # State 82437 subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.1.2.2.1.0_1', S(1)) except ValueError: pass else: pass # State 82438 if len(subjects75) >= 1: tmp78 = subjects75.popleft() subst3 = Substitution(subst2) try: subst3.try_add_variable('i2.2.1.2.2.1.0', tmp78) except ValueError: pass else: pass # State 82439 if len(subjects75) == 0: pass # State 82440 if len(subjects) == 0: pass # 7: tan(c + x*d) yield 7, subst3 subjects75.appendleft(tmp78) if len(subjects75) >= 1 and isinstance(subjects75[0], Mul): tmp80 = subjects75.popleft() associative1 = tmp80 associative_type1 = type(tmp80) subjects81 = deque(tmp80._args) matcher = CommutativeMatcher82442.get() tmp82 = subjects81 subjects81 = [] for s in tmp82: matcher.add_subject(s) for pattern_index, subst2 in matcher.match(tmp82, subst1): pass if pattern_index == 0: pass # State 82443 if len(subjects75) == 0: pass # State 82444 if len(subjects) == 0: pass # 7: tan(c + x*d) yield 7, subst2 subjects75.appendleft(tmp80) subst1 = Substitution(subst0) try: subst1.try_add_variable('i2.4.0', S(0)) except ValueError: pass else: pass # State 82950 subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.4.1.0_1', S(1)) except ValueError: pass else: pass # State 82951 if len(subjects75) >= 1: tmp85 = subjects75.popleft() subst3 = Substitution(subst2) try: subst3.try_add_variable('i2.4.1.0', tmp85) except ValueError: pass else: pass # State 82952 if len(subjects75) == 0: pass # State 82953 if len(subjects) == 0: pass # 9: tan(e + x*f) yield 9, subst3 subjects75.appendleft(tmp85) if len(subjects75) >= 1 and isinstance(subjects75[0], Mul): tmp87 = subjects75.popleft() associative1 = tmp87 associative_type1 = type(tmp87) subjects88 = deque(tmp87._args) matcher = CommutativeMatcher82955.get() tmp89 = subjects88 subjects88 = [] for s in tmp89: matcher.add_subject(s) for pattern_index, subst2 in matcher.match(tmp89, subst1): pass if pattern_index == 0: pass # State 82956 if len(subjects75) == 0: pass # State 82957 if len(subjects) == 0: pass # 9: tan(e + x*f) yield 9, subst2 subjects75.appendleft(tmp87) if len(subjects75) >= 1 and isinstance(subjects75[0], Add): tmp90 = subjects75.popleft() associative1 = tmp90 associative_type1 = type(tmp90) subjects91 = deque(tmp90._args) matcher = CommutativeMatcher82446.get() tmp92 = subjects91 subjects91 = [] for s in tmp92: matcher.add_subject(s) for pattern_index, subst1 in matcher.match(tmp92, subst0): pass if pattern_index == 0: pass # State 82452 if len(subjects75) == 0: pass # State 82453 if len(subjects) == 0: pass # 7: tan(c + x*d) yield 7, subst1 if pattern_index == 1: pass # State 82961 if len(subjects75) == 0: pass # State 82962 if len(subjects) == 0: pass # 9: tan(e + x*f) yield 9, subst1 subjects75.appendleft(tmp90) subjects.appendleft(tmp74) return yield
class CommutativeMatcher38674(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 CommutativeMatcher38674._instance is None: CommutativeMatcher38674._instance = CommutativeMatcher38674() return CommutativeMatcher38674._instance @staticmethod def get_match_iter(subject): subjects = deque([subject]) if subject is not None else deque() subst0 = Substitution() # State 38673 subst1 = Substitution(subst0) try: subst1.try_add_variable('i2.2.1.2.2.2', S(1)) except ValueError: pass else: pass # State 38675 subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.1.2.2.2.0', S(0)) except ValueError: pass else: pass # State 38676 subst3 = Substitution(subst2) try: subst3.try_add_variable('i2.2.1.2.2.2.1.0', S(1)) except ValueError: pass else: pass # State 38677 if len(subjects) >= 1 and isinstance(subjects[0], Pow): tmp4 = subjects.popleft() subjects5 = deque(tmp4._args) # State 38678 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 38679 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 38680 if len(subjects5) == 0: pass # State 38681 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 = CommutativeMatcher38683.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 38688 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 = CommutativeMatcher38690.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 38703 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 38704 subst1 = Substitution(subst0) try: subst1.try_add_variable('i2.2.1.2.2.2.0', S(0)) except ValueError: pass else: pass # State 38705 subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.1.2.2.2.1.0', S(1)) except ValueError: pass else: pass # State 38706 if len(subjects17) >= 1 and isinstance(subjects17[0], Pow): tmp20 = subjects17.popleft() subjects21 = deque(tmp20._args) # State 38707 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 38708 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 38709 if len(subjects21) == 0: pass # State 38710 subst5 = Substitution(subst4) try: subst5.try_add_variable( 'i2.2.1.2.2.2', 1) except ValueError: pass else: pass # State 38711 if len(subjects17) == 0: pass # State 38712 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 38711 if len(subjects17) == 0: pass # State 38712 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 = CommutativeMatcher38714.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 38719 subst3 = Substitution(subst2) try: subst3.try_add_variable('i2.2.1.2.2.2', 1) except ValueError: pass else: pass # State 38720 if len(subjects17) == 0: pass # State 38721 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 38720 if len(subjects17) == 0: pass # State 38721 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 = CommutativeMatcher38723.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 38736 subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.1.2.2.2', 1) except ValueError: pass else: pass # State 38737 if len(subjects17) == 0: pass # State 38738 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 38737 if len(subjects17) == 0: pass # State 38738 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 CommutativeMatcher77678(CommutativeMatcher): _instance = None patterns = { 0: (0, Multiset({0: 1}), [(VariableWithCount('i2.4.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.0', 1, 1, S(0)), Add)]), 4: (4, Multiset({4: 1}), [(VariableWithCount('i2.2.2.2.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)]) } 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 CommutativeMatcher77678._instance is None: CommutativeMatcher77678._instance = CommutativeMatcher77678() return CommutativeMatcher77678._instance @staticmethod def get_match_iter(subject): subjects = deque([subject]) if subject is not None else deque() subst0 = Substitution() # State 77677 subst1 = Substitution(subst0) try: subst1.try_add_variable('i2.4.1.0_1', S(1)) except ValueError: pass else: pass # State 77679 if len(subjects) >= 1: tmp2 = subjects.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.4.1.0', tmp2) except ValueError: pass else: pass # State 77680 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 77732 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 77733 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 77810 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 77811 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.1.0_1', S(1)) except ValueError: pass else: pass # State 78179 if len(subjects) >= 1: tmp11 = subjects.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.2.1.0', tmp11) except ValueError: pass else: pass # State 78180 if len(subjects) == 0: pass # 3: x*f yield 3, subst2 subjects.appendleft(tmp11) subst1 = Substitution(subst0) try: subst1.try_add_variable('i2.2.2.2.1.0_1', S(1)) except ValueError: pass else: pass # State 80138 if len(subjects) >= 1: tmp14 = subjects.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.2.2.1.0', tmp14) except ValueError: pass else: pass # State 80139 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 88103 if len(subjects) >= 1 and isinstance(subjects[0], Pow): tmp17 = subjects.popleft() subjects18 = deque(tmp17._args) # State 88104 if len(subjects18) >= 1: tmp19 = subjects18.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.1.2.1.1', tmp19) except ValueError: pass else: pass # State 88105 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 88106 if len(subjects18) == 0: pass # State 88107 if len(subjects) == 0: pass # 5: d*x**n 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_1', tmp23) except ValueError: pass else: pass # State 88651 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 88652 if len(subjects18) == 0: pass # State 88653 if len(subjects) == 0: pass # 6: x**n*d yield 6, subst3 subjects18.appendleft(tmp25) subjects18.appendleft(tmp23) subjects.appendleft(tmp17) if len(subjects) >= 1 and isinstance(subjects[0], Mul): tmp27 = subjects.popleft() associative1 = tmp27 associative_type1 = type(tmp27) subjects28 = deque(tmp27._args) matcher = CommutativeMatcher77682.get() tmp29 = subjects28 subjects28 = [] for s in tmp29: matcher.add_subject(s) for pattern_index, subst1 in matcher.match(tmp29, subst0): pass if pattern_index == 0: pass # State 77683 if len(subjects) == 0: pass # 0: x*f yield 0, subst1 if pattern_index == 1: pass # State 77734 if len(subjects) == 0: pass # 1: x*f yield 1, subst1 if pattern_index == 2: pass # State 77812 if len(subjects) == 0: pass # 2: x*d yield 2, subst1 if pattern_index == 3: pass # State 78181 if len(subjects) == 0: pass # 3: x*f yield 3, subst1 if pattern_index == 4: pass # State 80140 if len(subjects) == 0: pass # 4: x*f yield 4, subst1 if pattern_index == 5: pass # State 88112 if len(subjects) == 0: pass # 5: d*x**n yield 5, subst1 if pattern_index == 6: pass # State 88657 if len(subjects) == 0: pass # 6: x**n*d yield 6, subst1 subjects.appendleft(tmp27) return yield
class CommutativeMatcher145670(CommutativeMatcher): _instance = None patterns = { 0: (0, Multiset({0: 1}), [ (VariableWithCount('i2.3.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 CommutativeMatcher145670._instance is None: CommutativeMatcher145670._instance = CommutativeMatcher145670() return CommutativeMatcher145670._instance @staticmethod def get_match_iter(subject): subjects = deque([subject]) if subject is not None else deque() subst0 = Substitution() # State 145669 subst1 = Substitution(subst0) try: subst1.try_add_variable('i2.3.2.1.2', S(1)) except ValueError: pass else: pass # State 145671 if len(subjects) >= 1: tmp2 = subjects.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.3.2.1.1', tmp2) except ValueError: pass else: pass # State 145672 if len(subjects) == 0: pass # 0: x**n yield 0, subst2 subjects.appendleft(tmp2) if len(subjects) >= 1 and isinstance(subjects[0], Pow): tmp4 = subjects.popleft() subjects5 = deque(tmp4._args) # State 145673 if len(subjects5) >= 1: tmp6 = subjects5.popleft() subst1 = Substitution(subst0) try: subst1.try_add_variable('i2.3.2.1.1', tmp6) except ValueError: pass else: pass # State 145674 subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.3.2.1.2', 1) except ValueError: pass else: pass # State 145675 if len(subjects5) == 0: pass # State 145676 if len(subjects) == 0: pass # 0: x**n yield 0, subst2 if len(subjects5) >= 1: tmp9 = subjects5.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.3.2.1.2', tmp9) except ValueError: pass else: pass # State 145675 if len(subjects5) == 0: pass # State 145676 if len(subjects) == 0: pass # 0: x**n yield 0, subst2 subjects5.appendleft(tmp9) subjects5.appendleft(tmp6) subjects.appendleft(tmp4) return yield
class CommutativeMatcher89402(CommutativeMatcher): _instance = None patterns = { 0: (0, Multiset({ 0: 1, 1: 1 }), [(VariableWithCount('i4.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 CommutativeMatcher89402._instance is None: CommutativeMatcher89402._instance = CommutativeMatcher89402() return CommutativeMatcher89402._instance @staticmethod def get_match_iter(subject): subjects = deque([subject]) if subject is not None else deque() subst0 = Substitution() # State 89401 subst1 = Substitution(subst0) try: subst1.try_add_variable('i4.1.0', S(1)) except ValueError: pass else: pass # State 89403 if len(subjects) >= 1 and isinstance(subjects[0], Pow): tmp2 = subjects.popleft() subjects3 = deque(tmp2._args) # State 89404 if len(subjects3) >= 1: tmp4 = subjects3.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i4.1.1', tmp4) except ValueError: pass else: pass # State 89405 if len(subjects3) >= 1 and subjects3[0] == Integer(2): tmp6 = subjects3.popleft() # State 89406 if len(subjects3) == 0: pass # State 89407 if len(subjects) == 0: pass # 0: c*x**2 /; (cons_f2) and (cons_f3) and (cons_f8) and (cons_f4) and (cons_f1581) yield 0, subst2 subjects3.appendleft(tmp6) subjects3.appendleft(tmp4) subjects.appendleft(tmp2) subst1 = Substitution(subst0) try: subst1.try_add_variable('i4.1.0_1', S(1)) except ValueError: pass else: pass # State 89415 if len(subjects) >= 1: tmp8 = subjects.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i4.1.1', tmp8) except ValueError: pass else: pass # State 89416 if len(subjects) == 0: pass # 1: b*x /; (cons_f2) and (cons_f3) and (cons_f8) and (cons_f4) and (cons_f1581) yield 1, 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 = CommutativeMatcher89409.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 89414 if len(subjects) == 0: pass # 0: c*x**2 /; (cons_f2) and (cons_f3) and (cons_f8) and (cons_f4) and (cons_f1581) yield 0, subst1 if pattern_index == 1: pass # State 89417 if len(subjects) == 0: pass # 1: b*x /; (cons_f2) and (cons_f3) and (cons_f8) and (cons_f4) and (cons_f1581) yield 1, subst1 subjects.appendleft(tmp10) return yield
class CommutativeMatcher51803(CommutativeMatcher): _instance = None patterns = { 0: (0, Multiset({0: 1}), [(VariableWithCount('i3.1.2.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 CommutativeMatcher51803._instance is None: CommutativeMatcher51803._instance = CommutativeMatcher51803() return CommutativeMatcher51803._instance @staticmethod def get_match_iter(subject): subjects = deque([subject]) if subject is not None else deque() subst0 = Substitution() # State 51802 subst1 = Substitution(subst0) try: subst1.try_add_variable('i3.1.2.2.1.2.1.0_1', S(1)) except ValueError: pass else: pass # State 51804 if len(subjects) >= 1: tmp2 = subjects.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i3.1.2.2.1.2.1.0', tmp2) except ValueError: pass else: pass # State 51805 if len(subjects) == 0: pass # 0: x*g 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 = CommutativeMatcher51807.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 51808 if len(subjects) == 0: pass # 0: x*g yield 0, subst1 subjects.appendleft(tmp4) return yield
class CommutativeMatcher65598(CommutativeMatcher): _instance = None patterns = { 0: (0, Multiset({}), [(VariableWithCount('i2.2.2.1.0', 1, 1, None), Mul), (VariableWithCount('i2.2.2.1.0_1', 1, 1, S(1)), Mul)]), 1: (1, Multiset({}), [(VariableWithCount('i2.3.1.0', 1, 1, None), Mul), (VariableWithCount('i2.3.1.0_1', 1, 1, S(1)), Mul)]), 2: (2, Multiset({}), [(VariableWithCount('i2.2.1.2.1.0', 1, 1, None), Mul), (VariableWithCount('i2.2.1.2.1.0_1', 1, 1, S(1)), Mul)]), 3: (3, Multiset({}), [(VariableWithCount('i2.2.3.1.0', 1, 1, None), Mul), (VariableWithCount('i2.2.3.1.0_1', 1, 1, S(1)), Mul)]), 4: (4, Multiset({}), [(VariableWithCount('i2.1.1.3.1.0', 1, 1, None), Mul), (VariableWithCount('i2.1.1.3.1.0_1', 1, 1, S(1)), Mul)]), 5: (5, Multiset({}), [(VariableWithCount('i2.2.1.3.1.0', 1, 1, None), Mul), (VariableWithCount('i2.2.1.3.1.0_1', 1, 1, S(1)), Mul)]), 6: (6, Multiset({}), [(VariableWithCount('i2.2.2.3.1.0', 1, 1, None), Mul), (VariableWithCount('i2.2.2.3.1.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 CommutativeMatcher65598._instance is None: CommutativeMatcher65598._instance = CommutativeMatcher65598() return CommutativeMatcher65598._instance @staticmethod def get_match_iter(subject): subjects = deque([subject]) if subject is not None else deque() subst0 = Substitution() # State 65597 return yield