For example from this link: http://te.fisica.edu.uy/fuerza_en_Capacitor.pdf we can deduce, that the work the electric field inside a constant-voltage capacitor does during the insertion of a dielectric is positive (the dielectric is attracted to the capacitor). Nevertheless, the overall potential energy of the electric field with a constant potential difference increases after inserting a dielectric, namely it is given by $E'=kE$. My question is: why has the energy of the system increased, if the work it's done is positive? My hypothesis is that in order to maintain a constant potential difference, additional charges must have been added to the plates of the capacitor, e.g. by a battery. I think the additional energy comes from the work done by the battery moving these additional charges onto the plate, but I may be wrong.
I'm also a little confused about the field in the capacitor while the dielectric is being inserted.
If the potential difference is to be conserved, the charge density on the plates inside $x$ should increase (these are the additional charges I mentioned in the firs part). If there are now more charges in the Regions II and III, shouldn't the situation look more like this?
Now, the dielectric slab would be subject not only to the attractive force in the Regions I and II, but also to a repulsive force in the Region III. Why don't the calculations include that?