In my understanding, ‘lam’ is used for total and strong negation as a linguistic principle.
Total and strong negation means you’ve to emphatically negate something i.e. something that exists in reality whose negation is intended or something that exists in ideology whose negation is intended. Negation for both these categories require an emphatic negation (i.e. strong negation). The same can be applied to both (65:4) & (112:3). In the former, there’s something that has happened or should happen but we want to express its negation, therefore strong negation; and in the latter, there’s this ideology that exists which requires negation, hence the strong negation.
(I am not an Arabic Linguist, I have explained this to the best of my understanding).