The 4% rule is assuming an average 7% rate of return. We subtract a 3% rate of inflation to that to come up with the 4% rule.
I know MMM and other financial bloggers have said this, but it's not really true. The 4% rule wasn't devised by subtracting inflation from average returns. Actually, the studies that developed the 4% rule in the 90s didn't assume average returns at all, because they analyzed actual historical data. That was kind of the point: they wanted to see what was a safe withdrawal rate even for people retiring into particularly bad (aka well below average) market conditions.
When the studies' authors looked at that historical data, they concluded that 4% would have been an extremely safe withdrawal rate for all or nearly all past retirees based on actual returns over the length of their actual retirements (including retirements that experienced catastrophic market events). (see:
https://www.retailinvestor.org/pdf/Bengen1.pdf; https://www.aaii.com/files/pdf/6794_retirement-savings-choosing-a-withdrawal-rate-that-is-sustainable.pdf) We assume that 4% is also likely to be an extremely safe withdrawal rate in the future, because we assume that the future stock market will, at least over time, resemble its own past. (This may or may not be true, and some people choose a more conservative withdrawal rate because they don't think it's true, or worry it may not be.)
Of course, average returns and inflation are both relevant to our assumptions about the future, but it's not as simple as 7-3=4.
Also, the average 7% rate of return already takes inflation into account; in nominal dollars, the average rate of return (at least for the stock market) is closer to 10%. This actually demonstrates why the safe withdrawal rate isn't just average returns minus inflation: if it was, the safe withdrawal rate would be more like 7%. It's lower, at 4%, to account for retirees with particularly bad sequences of returns (aka those who experience catastrophic market events right at the beginning of their retirements).
This also means that, if the average stock market returns remain around 10% (which, who knows!), most people who use a 4% withdrawal rate are going to wind up with more money than they started with.
If you're worried that inflation will be particularly high for an extended period during your retirement, you can plan on a lower withdrawal rate, though it may also be true that stocks will rise along with inflation (so inflation may or may not actually necessitate a lower withdrawal rate). Also, note that the withdrawal rate studies certainly included years of very high inflation, so high inflation is already baked into the 4% rule.