an agreement between a prosecutor and a defendant whereby the defendant is allowed to plead guilty to a lesser charge rather than risk conviction for a graver crime in order to avoid a protracted trial or to win the defendant's cooperation as a witness.