A cognitive model of axiom formulation and reformulation with application to AI and software engineering