uses lambdas to create hazard matrix automatically from Pre matrix