Right now pairs of Factors that grammatically correspond to each other are stored as key-value pairs. But this broke when a factor needed to refer to two other factors, because a Fact with a quantity comparison implied two other Facts. It seems like for the bug to arise, the implying fact ended up as a key once and a value once. Not sure how that happened with a some-to-some comparison, but it would definitely happen with all-to-all, because that requires self's factors to imply other's sometimes, and sometimes vice versa.
Maybe every implication relationship needs a key-value entry (with a list of multiple values allowed), but equality entries need to be entered in reverse as well.
Or maybe the dict should be for generic context factors only, and comparison of non-generic factors should happen elsewhere. Limiting dict entries to just generic Factors broke test_implication_complex(), but maybe that's a glitch I can get around.
tests passing for now at least. Only generic Factors are included in the dict of matches, and each match is entered in reverse so values can also be looked up as keys.
Right now pairs of Factors that grammatically correspond to each other are stored as key-value pairs. But this broke when a factor needed to refer to two other factors, because a Fact with a quantity comparison implied two other Facts. It seems like for the bug to arise, the implying fact ended up as a key once and a value once. Not sure how that happened with a some-to-some comparison, but it would definitely happen with all-to-all, because that requires self's factors to imply other's sometimes, and sometimes vice versa.
Maybe every implication relationship needs a key-value entry (with a list of multiple values allowed), but equality entries need to be entered in reverse as well.
Or maybe the dict should be for generic context factors only, and comparison of non-generic factors should happen elsewhere. Limiting dict entries to just generic Factors broke test_implication_complex(), but maybe that's a glitch I can get around.