That is what is so troublesome about eyewitness testimony. It's not that these witnesses are lying, it's that they are mistaken, and the reason they are mistaken is usually because law enforcement didn't use proper techniques when interviewing them. The Justice Department has just released its first ever guide for law enforcement to use when interviewing eyewitnesses. I served on the panel that created this guide, and even the prosecutors and police that served on the panel agreed that we need to better train law enforcement on how to interview eyewitnesses. Criminal trials are not really a search for the truth.
Criminal trials are about testing the evidence.
The issue in any criminal trial is whether the prosecution can prove its case with legally competent evidence beyond a resonable doubt. In a perfect world, that would always lead to the truth, but this is not a perfect world. It is about the defense testing the prosecution's evidence. I don't know if my client is guilty, even if I know that my client committed the act with which they are chargedm it doesn't necessarily follow that they are guilty of a crime. Guilt is a matter for judges and juries to decide.