Legal term needed

What is the legal term for a crime in which the perpetrator does not actually engage in an illegal act? For example, a drug dealer tries to sell drugs to an undercover cop, but is arrested before actually making the exchange. Similarly, a cop might pretend to be a little kid and try to get a pedophile to show up at a certain location, and then arrest him. Thanks for your help.

Attempt.

deleted

Inchoate.