I'm tired and this is going to come out all jumbled, I fear, but I think the maths just don't work with this kind of thing, just like you suggest. Imagine a high-rise building with say 10 floors, each with eight flats, each flat housing a family of 3 to 5 people. Now, each of those families needs an area to grow their crops that's at least as large as the area of the house they live in. Sure, they can plant the rooftop over their heads. The only problem is, there are 10 families under the same area of rooftop. So it just can't work.
I think this generally holds for living in cities. Since residence is basically vertical, it gets progressively harder to also grow and raise food vertically also. All the space is already taken. And all the space that isn't housing is infrastructure (roads, sewers, cables) that would all have to be ripped out in order to plant enough to sustain the city.
So the food production moves away from the city, and away from the people who need the food. The OP is right to wonder: what happens if the supply lines from the countryside are cut? That would be a huge disaster, and whenever this has happened throughout history, it was a huge disaster. E.g. when Greece was occupied by the Axis, in the 1940's, the people in Athens died in droves of famine while the people in the countryside, well, they subsisted. In fact, anecdotally, my friend's grandma told her there was no other time they were so fat in their lives because they ate all they had everyday, just because they didn't know if they would have any more food tomorrow. But the countryside had food to eat while the city was left with scraps. btw this was originally caused by the Nazis who requisitioned crops to feed their war effort, assholes.
in the greater Athens–Piraeus area alone, some 40,000 people died of starvation, and by the end of the Occupation "it was estimated that the total population of Greece [...] was 300,000 less than it should have been because of famine or malnutrition" (P. Voglis).[24]
I think this generally holds for living in cities. Since residence is basically vertical, it gets progressively harder to also grow and raise food vertically also. All the space is already taken. And all the space that isn't housing is infrastructure (roads, sewers, cables) that would all have to be ripped out in order to plant enough to sustain the city.
So the food production moves away from the city, and away from the people who need the food. The OP is right to wonder: what happens if the supply lines from the countryside are cut? That would be a huge disaster, and whenever this has happened throughout history, it was a huge disaster. E.g. when Greece was occupied by the Axis, in the 1940's, the people in Athens died in droves of famine while the people in the countryside, well, they subsisted. In fact, anecdotally, my friend's grandma told her there was no other time they were so fat in their lives because they ate all they had everyday, just because they didn't know if they would have any more food tomorrow. But the countryside had food to eat while the city was left with scraps. btw this was originally caused by the Nazis who requisitioned crops to feed their war effort, assholes.
in the greater Athens–Piraeus area alone, some 40,000 people died of starvation, and by the end of the Occupation "it was estimated that the total population of Greece [...] was 300,000 less than it should have been because of famine or malnutrition" (P. Voglis).[24]
https://en.wikipedia.org/wiki/Axis_occupation_of_Greece#Econ...
(When I'm tired, I write too much :P)