In the US the law allows for you to make the case of self defense, it is a defense for violations of the law. I.E. it is always illegal to kill someone, but it is a defense if you kill someone who was trying to kill you..
Things like bobby traps, or poisoning your food against a thief would not be legal under American law. For example I can not setup a series of Automated Gun Turrents in my home to kill anyone that breaks in, but I could (in some states) shoot someone myself if they break in.
In a food theft case as an individual could in fact assault someone possibly even commit battery against someone in order to prevent the from stealing my lunch but I could not say put bobby trap that could cause physical harm to them on the lunch