PaleHorse76 (and all others interested)--
If you want to calculate the probabilities of winning a battle with a certain number of HP remaining, I've got the mathematics all worked out. It's up to Xerxes314 or somebody other than me to make a program out of this.

Though right now I do have it humming on my TI graphing calculator...
The short version:
a = Attacker's attack rating (after terrain, etc, modifiers are accounted for)
b = Attacker's HP
x = Defender's defense rating (after modifiers)
y = Defender's HP
z = How many rounds the defender wins, or, equivalently, how many HP the attacker loses in a battle
Probability of attacker winning with a z-HP loss:
(a / (a+x))^y * (x / (a+x))^z * nCr(y+z-1, y-1)
Where nCr(i, j) = "i choose j"
Basically, the formula is the probability of the attacker winning y (= defender's HP) rounds, times the probability of the defender winning z rounds, times the number of ways that arrangement can happen.
If this formula is right, then the sum of all those probabilities from z=0 to z=b-1 (attacker loses none to all but one HP) should equal the attacker's probability of winning. I checked this against Xerxes314's program for a bunch of cases, and our programs agree!
That's all you need to know.

But if you're interested, the long version, or "What I did instead of my homework yesterday," will follow:
Using the same variables as above (a=A rating, b=A HP, x=D rating, y=D HP, z=losses):
First, the probability of the attacker winning one round (causing a HP loss in the defender) is a/(a+x). This is the familiar Civ1 formula. Equivalently, the probability of the defender winning one "round" is x/(a+x).
So, trivially, this formula can be used to determine the odds of a 1 HP vs. 1 HP battle. With multiple HP involved, it basically becomes a question of combining those simple probabilities. From now on, unless otherwise specified, my examples will be between two 3-HP units.
For example, the probability of the attacker winning a 3 HP vs. 3 HP battle without suffering any losses is (a / (a+x))^3, the probability of winning 3 rounds in a row.
The probability of an attacker winning 3 rounds to the defender's 1 is (a / (a+x))^3 * (x / (a+x)) * (the number of ways this can happen). The number of ways that can happen in this case is 3: DAAA, ADAA, AADA.
Similarly, the probability of an attacker winning 3 rounds to the defender's 2 is (a / (a+x))^3 * (x / (a+x))^2 * (the number of ways this can happen). The number in this case is 6: DDAAA, DADAA, DAADA, ADDAA, ADADA, AADDA.
In general, the probability of an attacker winning y (= defender's HP) rounds to the defender's z is (a / (a+x))^y * (x / (a+x))^z * (the number of ways this can happen).
The number of ways an attacker can win the battle with y (= defender's HP) victories and z losses is nCr(y+z-1, y-1), or "y+z-1 choose y-1." This is the number of ways to get y-1 victories out of y+z-1 rounds.
Intuitively, it might seem like the proper number of combinations is nCr(y+z, y), or the number of ways to get y victories out of y+z rounds, which is how long the battle is (attacker's wins + defender's wins). However, in every battle where the attacker wins, the attacker wins the last round. In other words, a combination like AAAD will never happen because the attacker will have won before that 4th round. So the number of combinations become the number of ways to get y-1 victories (all but the last round) out of y+z-1 rounds (all but the last round again).
Note that the probability of that last round still factors into the equation with (a / (a+x))^y, so it's not like we're throwing out that last round entirely.
Now we're ready to combine all that into a lovely formula.

The probability of the attacker winning while suffering z-HP losses is
(a / (a+x))^y * (x / (a+x))^z * nCr(y+z-1, y-1)
a = Attacker's attack rating (with all modifiers)
b = Attacker's HP
x = Defender's defense rating (with all modifiers)
y = Defender's HP
z = Defender's victories or attacker's HP losses
Again, this is the probability of the attacker winning y rounds, times the probability of the defender winning z rounds, times the number of ways that arrangement can happen.
If you just want a straight-up calculation of what the chances are to win the battle regardless of the HP loss (like Xerxes314's nifty calculator), then sum up that formula from z=0 to z=b-1 (attacker loses 0 to all but 1 HP).
Of course, these formulas don't take into account retreat by a faster unit and assume a fight to the death. I'm not certain of the exact rules involved in retreating (sometimes a faster attack unit fights to the death if the defender is damaged enough), but I'm sure I'll spend another class period or two figuring that out...
Enjoy.