I humbly beg to differ here. Why do you even need a PIC to do this? A simple mains rectifier output indicates power present. Similarly, when the power fails, the reservoir capacitor will hold the voltage a little while before indicating mains failure(takes care of short power glitches if you get them)
Sizing this value appropriately can give you some delay before you command the generator to switch on.

In short, mains adaptor -> transistor inverter -> relay is all that is needed to achieve this.