If you battle at a Gym you'll earn some XP for each Pokémon trainer you defeat at the Gym even if you can't beat all the trainers at the Gym. Per win the Gym will also loose some of its prestige.
As the level (and maximum number of occupying Pokémon) of the Gym is related to this amount of prestige, is it possible to lower the Gym's level and effectively booting out one of the occupying Pokémon in case the maximum number of occupants is exceeded?
For example. Let's say you'd battle at a Level 3 Gym that has 3 Pokémon stationed at it. If you would keep on winning fights up to the point the Gym level would lower to 2, would one of the Pokémon (presumably the one with the lowest CP) be removed from the Gym?