וְכׇל־הָעָ֖ם יִשְׁמְע֣וּ וְיִרָ֑אוּ וְלֹ֥א יְזִיד֖וּן עֽוֹד׃
all the people will hear and be afraid and will not act presumptuously again.
Torah Temimah points to Sanhedrin / Sifrei.
וכל העם ישמעו. ויראו ולא יזידון עוד — מלמד שהמטרה היא הרתעה.
English: And all the people shall hear and fear and shall not act presumptuously again — this teaches that the purpose is deterrence.
The public nature of the punishment is explicitly for the education and deterrence of the wider community.
Derash on the verse (Sifrei) — not a formal named middah of the 13.
The public execution and proclamation are intended to deter future acts of judicial rebellion.