Pasted from a web site which sells mirrors
Q: How do Auto Dimming Mirrors work?
A: 1. A forward-facing sensor recognizes low ambient light levels and signals the mirror to begin looking for glare.
A: 2. A rearward-facing sensor then detects glare from the vehicles traveling behind you, sending voltage to the mirror's EC gel in proportion to the amount of glare detected.
A: 3. The mirror dims in proportion to the glare and then clears when the glare is no longer detected.
A: 4. The interior mirror's sensors and electronics control the dimming of the mirrors.
That didn't make much sense to me until I also found this explanation on another web site forum which makes more sense about the function of the front sensor.
I haven't checked but I think you are correct. The mirror "knows" how much to dim by sensing light from in front and from behind. When there is relatively a lot of light from the front, the mirror doesn't darken as much even if there are headlights from behind you, as it assumes you are in a well-lit city street or in daylight, so that you can still see things. When the front sensor senses "dark," it will assume you are out on a dark highway, where it's more important to darken the mirror so you are not blinded by approaching headlights from behind.