State. One joint Gaussian x = [xr, yr, θ, l1x, l1y, ...] with covariance P. Robot-landmark cross terms in P are what make loop closure improve the whole map.
Prediction (unicycle). x' = x + vΔt cosθ, y' = y + vΔt sinθ, θ' = θ + ωΔt; P' = F P FT + G Q GT with F = ∂f/∂x, Q = diag(σv2, σω2). Only the robot rows and columns change.
Update. Measurement z = [√(dx²+dy²), atan2(dy,dx) - θ] + noise, innovation ν = z - h(x), S = H P HT + R, K = P HT S-1, x += Kν, P -= K S KT. New landmarks are initialised by inverting h and propagating the covariance through its Jacobians.
Association. Nearest neighbour accepts a landmark if the squared Mahalanobis distance νTS-1ν is below the chi-square 99% gate (9.21, 2 dof); beyond 16 a new landmark is created; in between the measurement is ignored.
Consistency. NEES = eT Prr-1 e for the pose error e has expectation 3 for a consistent filter.
Honest simplifications. The EKF linearises, so it is mildly over-confident (NEES slightly above 3) on tight turns; landmarks are static points with unique identities in "known" mode; there is no occupancy grid, no scan matching and no graph optimisation (modern systems use pose-graph or factor-graph smoothing). Heading is wrapped to (-π, π].