Finally, Peter was praised by God as an apostle, and Ananias was killed on the spot by God.
The above is what I got by standing in the moment and looking back at their words. Nervously, the law is essentially a lie. Why does God treat it differently?
With this tension, I took a "time machine" to see the scene at that time.
Look at Peter first. The handmaid of the high priest recognized him on the spot. Out of fear or confusion, he denied his relationship with the Lord Jesus. But in fact, as long as the maid reports to the high priest that he has been arrested, the law can "beat" him immediately. But it seems that the maid didn't report it, and it was three times in a row, which shows that Peter is specially guarded by God. If God didn't keep him, would he be caught by the high priest and then convicted and put to death? If so, how will he understand and comprehend his own experience text? How will future generations understand and comprehend Peter's scripture? Peter won't be saved, and God didn't do it.
Look at Ananias. They put their property in front of Peter. Peter asked him how to keep some property for himself. God didn't even give him a chance to speak, so he shot him. If he had the chance to speak, would he instinctively lie and deny it out of shame and fear? If he denies it, no one can judge whether what he said is true or not, and everyone will think that what he said is true, so the law can't "hit" him, so he can "hide". If this happens, how will they understand and comprehend their own experience text? How will future generations understand and comprehend their texts? God knows if they will be saved, and more people will be saved. God must make an example of him.
What God sees is not right or wrong at the legal level, but the effect of redemption.
God will not deny salvation because of the right or wrong of human law, but God also knows what people can do to get salvation. God's plans and actions are aimed at saving more people.