Zack,
smallvehicle and truck are subsets or binary parameters?
If they are subsets, so they should not be defined as smallvehicle(i) nor truck(i), but as smallvehicle and truck (without the car index i). Thus, supposing they are subsets of the original cars set, you should use:
carspeed(i | i in smallvehicle) := 40;
carspeed(i | i in truck) := 25;
But, if they are binary parameters, for instance, smallvehicle(i) = 1 represents car i is a smallvehicle, then you should use:
carspeed(i | smallvehicle(i)) := 40;
carspeed(i | truck(i)) := 25;
Best regards,
Leonardo.