Generalization in the presence of free variables: A mechanically-checked proof for one algorithm