Logic programming

Updated: 09/15/2017 by Computer Hope

Logic programming is a computer programming paradigm in which programstatements express facts and rules about problems within a system of formal logic. Rules are written as logical clauses with a head and a body; for instance, "H is true if B1, B2, and B3 are true." Facts are expressed similar to rules, but without a body; for instance, "H is true."

Some logic programming languages such as Datalog and Answer Set Programming (ASP) are purely declarative — they allow for statements about what the program should accomplish, with no explicit step-by-step instructions about how to do so. Others, such as Prolog, are a combination of declarative and imperative — they may also include procedural statements such as "To solve H, solve B1, B2, and B3."