The Bible teaches that the fear of the Lord is the beginning of wisdom (Psalm 111:10, Proverbs 1:7, 9:10). In other words, one cannot really possess any wisdom that has any kind of worth unless one has a healthy fear and respect of the Living God. Thus, it is one's relationship with God that will ultimately determine how much one is able to know of truth and of the weighty matters in life. One's connection to the Living God by faith is what facilitates understanding in life.
In Genesis 18:16-33 this principal is made apparent. The scriptures show that after the Lord and His two servants were done eating with Abraham, they walked with Abraham in the direction of Sodom and Gomorrah. As they were walking, the Bible provides an interesting detail to explain the heart of the Lord. The Bible says that as the four men were walking, the Lord said, "Shall I hide from Abraham what I am doing, sine Abraham shall surely become a great and mighty nation, and all the nations of the earth shall be blessed in him?" The Lord reveals that, because Abraham was a chosen child of God, and because Abraham had a relationship with God, there was no reason for Him to hide the work that He was doing.
Since Abraham possessed faith, and by extension was seen as righteous in the eyes of the Lord, there was a good relationship between God and Abraham so that the New Testament even refers to Abraham as a "friend of God (James 2:23)." As a friend, God was willing to inform Abraham about the work He was going to do. In fact, in John 15:15 the Lord Jesus said, "No longer do I call you servants, for a servant does not know what his master is doing; but I have called you friends, for all things that I heard from My Father I have made known to you." The Bible repeatedly shows that those who have a connection to the Lord in faith are able to know and understand the plans and works of the Living God to a certain degree. Recall that the scriptures described Noah as a man that "walked with God" and so God informed him about the flood. Thus, those who are connected to the Lord by faith are able to receive information from God to know what God is doing - especially concerning judgment.
As Genesis 18:16-33 goes on, the Lord Jesus explained to Abraham that He was going to destroy Sodom and Gomorrah. The scriptures reveal that sin had reached its measure in those cities so that God would purge those cities to remove the sin. It is true that the cities were able to conduct themselves in sin for a long time, but the patience of God does have a limit. It is true that the patience of God is monumentally great, but it still has its limits so that when people repeatedly reject repentance and salvation, and continue in sin, the Bible is clear to show that God will bring judgment against sin and the people who willfully commit it. When the Lord told Abraham these things, the scriptures explain that Abraham was concerned. Likely recalling that his nephew was living in Sodom, Abraham sought to plead with the Lord to spare the righteous people living in those cities.
The rest Genesis 18:16-33 is an interesting dialogue between the Lord and Abraham. Abraham begins pleading with the Lord to show mercy on the righteous people living in Sodom and Gomorrah. He does so by trying to negotiate with the Lord. Abraham first asks if the Lord would be willing to spare the cities if the Lord were able to find only 50 righteous in the city. The Lord agreed that if He could find 50 righteous people in Sodom in Gomorrah, He would spare the cities. However, the scriptures do not state that the Lord changed His mind to destroy the cities, hinting that there were not a mere 50 righteous people in both of the cities. Therefore, Abraham gave another proposal. He asked the Lord if He would be willing to spare the cities if He was able to find only 45 people. Abraham sought to display his sales skills and said, "Suppose there were five less than the fifty righteous; would You destroy all of the city of a lack of five?" The Lord agreed to spare the cities if He could find 45 righteous people. The exercise continues as the scriptures progress. Abraham has less confidence in the righteousness of the cities and asks the Lord to spare the cities until he gets down to ten people. The Lord agreed that if He could find 10 righteous people, He would spare the cities.
There are a few things that can be learned about this conversation. The most powerful point stems from the beginning of the discussion. Abraham asked the Lord, "Would you destroy the righteous with the wicked?" The Lord answered, "No." In the fact that the Lord would have been willing to spare all of Sodom and Gomorrah on account of 10 people shows a tremendous example of God's mercy. Though the hundreds or maybe thousands of people that lived in the two cities were extremely wicked, it would have been the righteousness of 10 people that would have allowed them to live. The Bible teaches that God is not willing that any should perish but that all should come to repentance (2 Peter 3:9). God does not take pleasure in the destruction of His people (Ezekiel 18:32). Thus the scriptures show God's patience with the wicked on account of the righteous who seek Him in faith.
The second point that one must examine is Abraham's gradual understanding of the circumstances. It is interesting to see that as Abraham pleads on behalf of Sodom and Gomorrah, he begins his plead on the assumption that the Lord would surely be able to find 50 righteous people in two whole cities. However, the discussion shows that Abraham's trust in the amount of righteousness in the two cities that God desired to judge had dwindled so that he was asking for mercy on behalf of only 10 people. What was it that caused Abraham to start with 50, but go down to 10? What changed Abraham's confidence in the representation of righteousness in the cities? If Abraham felt so strongly that there were 50 righteous in the city, why did he end asking the Lord to spare the cities on behalf of only 10 people? It seems as if Abraham's confidence in the amount of righteousness had dwindled as he began to understand the perspective of God.
Consider how the details of the testimony flow. The Lord Jesus desired to inform Abraham of coming judgment because Abraham had a good relationship with the Lord that afforded him the privilege to be informed of the Lord's work. However, the Lord had already determined that Sodom and Gomorrah had exceeded His patience in regards to sin, and their wickedness had run over its limit. The cities needed to be judged. Abraham, began his inquires by asking God, "Will you also judge the righteous with the wicked?" The Lord said that He would not unfairly judge the righteous with the wicked. Therefore, one must consider that the Lord determined to judge Sodom and Gomorrah because there were none that were righteous. The "progressive negotiation" between Abraham in the Lord was simply the exercise Abraham had to go through to learn what the Lord already knew. When Abraham asked the Lord to spare the cities on account of 50 righteous, the Lord said He would, but He didn't change His mind. The scriptures never say that God changed His mind regarding judgment. This shows that there weren't 50 righteous people. Abraham was hopeful in his progression, asking for fewer people in bunches of 5, only to realize in the end that God had it right the first time. There were none righteous.
God would have spared the cities if there had been 50, 25, or 10 righteous people in Sodom and Gomorrah. Abraham learned that truth, but in a morbid sort of way. His pleas for the cities reflect a sort of desperate hope and God's agreement with Abraham shows that God desires the same things. The tough reality however is that there was only one righteous in the total of the two cities. The scriptures reveal that he was delivered and was not judged with the wicked. Nevertheless, it was Abraham's relationship with the Lord that allowed him to know the Lord's plan, and even have a certain degree of understanding into the reasons for God's plan. God's plan was for mankind to live, but in rebellion, mankind demonstrated wickedness, which forced God to judge and allow the consequences of sin to run its course. God found no pleasure in this work, but did what needed to be done according to His righteousness. Thankfully, He is still willing to spare the righteous from the wicked!