procedure resolution(KB, Q)
;; KB is a set of consistent, true FOL sentences
;; Q is a goal sentence that we want to derive
;; return success if KB |- Q, and failure otherwise
KB = union(KB, ~Q)
KB = clause-form(KB) ; convert sentences to clause form
while false not in KB do
{pick 2 clauses, C1 and C2, that contain literals that unify
if none, return "failure"
resolvent = resolution-rule(C1, C2)
KB = union(KB, resolvent) }
return "success"
end