Patch looks fine to me. By the way, why don't we just say "Can we skip scanning part_rel?" in the comment before the newly added call to PartConstraintImpliedByRelConstraint()? We don't need to repeat the explanation of what it does at the every place we call it.
Чтобы сделать работу с сайтом удобнее, мы используем cookie и аналитический сервис «Яндекс.Метрика». Продолжая пользоваться сайтом, вы соглашаетесь с их использованием.