When another person is sinning, when is your related act (cooperative act) sinful?
Explicit cooperation occurs when your intention (intended end, purpose) is to assist the other person precisely in what is sinful. Explicit cooperation is always immoral because it denotes a bad intention; the intended end is evil. In explicit cooperation, you share the immoral intention of the other person.
Cooperation without such an intention is termed “implicit cooperation”. Implicit cooperation may or may not be moral.
Formal cooperation occurs when your act, by its very nature, can be defined as a direct participation in the intrinsically evil act of the other person. In other words, their act is intrinsically evil, and your act is directly ordered toward helping them accomplish that intrinsically evil act. It is never moral to cooperate formally in evil.
So if your cooperation is either explicit cooperation or formal cooperation or both, your act is a sin. Implicit formal cooperation occurs when you do not share the immoral intention of the other person, yet you knowingly choose an act directly participating in their intrinsically evil act. Despite your good intention, such a choice is never morally licit.
Material cooperation occurs when your act participates in the sin of the other person, only in the form it takes in a concrete situation, i.e. in the circumstances surrounding the act. If their act is intrinsically evil, your act must not participate directly in their act, and you must not share their immoral intention.
Material cooperation is moral if your act has only good in the intention, and your act is not intrinsically evil, and you reasonably anticipate that your act will not do more harm than good. Typically, material cooperation is moral when your act is remote from the other act, and immoral when your act is proximate to the other act. But certainly all the reasonably anticipated good and bad consequences must be taken into account, including scandal.
See my book: Roman Catholic Teaching on Cooperation with Evil
Please take a look at this list of my books and booklets, and see if any topic interests you.