The Phone portrait mode is actually a combination of calculated depth that David described, and "AI" (ML algorithms) that Alain mentioned.? ?The spatial algorithms produce bokeh effects, and the "AI" prioritizes focus on faces.? They work together and cannot be isolated, despite the fact that the edit UI f-stop slider seems seems to suggest that you are only affecting spatial aspects.?
Also note that the intent of portrait mode is not to simulate optical bokeh.? The intent to make nice portraits.? Blurring things that not in the same plane as the subject is one tool to help make nice portraits, and optics do this (bokeh), but digital processing also provides entirely new methods, eg, recognizing human faces and blurring everything else, regardless of its distance from the lens.
With just optics, everything at the same distance from a lens has the same focus.? For example, a subject's chin and a necklace might be at exactly the same distance from the lens, and so will have the same focus.? But they will not have the same focus on an iPhone in portrait mode, because although the depth calculations would result in the same focus, the "AI" algorithms will override the distance calcs, and prioritize the face and blur the necklace.? ? These algorithms prioritization of focus on faces, or on non-human objects they assume to the the point of interest, are one of the culprits?in the sometimes too-sharp "cut out" boundaries that Alain referred to.