A logic of dimensional analysis