「‍」 Lingenic

Logic Programming

(⤓.md ◇.md); γ ≜ [2026-07-17T120407.600, 2026-07-17T135416.643] ∧ |γ| = 3

Logic Programming

Origin. Kowalski, Colmerauer (1970s). Computation as deduction. Horn clauses. Prolog. Foundation for declarative programming.

Models. Programs as logical theories. SLD resolution. Minimal Herbrand model. Negation as failure. Unification-based.

Formalism.

Horn clause: H :- B₁, ..., Bₙ. Head H true if body B₁ ∧ ... ∧ Bₙ true.

Fact: H. Clause with empty body. H always true.

Query: ?- G₁, ..., Gₘ. Find substitution making goals true.

SLD resolution: Select goal Gᵢ. Unify with head H of clause. Replace Gᵢ with body. Apply substitution.

Unification: Find σ with σ(t₁) = σ(t₂). Most general unifier. Occurs check.

Minimal model: T_P operator: T_P(I) = {H : (H :- B) ∈ P, I ⊨ B} Least fixed point = minimal model.

Negation as failure: not G succeeds if G finitely fails. Closed world assumption. SLDNF resolution.

Cut: !: commit to choices. Control backtracking. Affects logical reading.

Definite clause grammars: DCG: grammar as logic program. Parsing as theorem proving.

Symbols.

SymbolUnicodeNameMeaning
:-IfClause arrow
?-QueryGoal
,AndConjunction
notNAFNegation as failure

Metatheory. Sound: answers are logical consequences. Complete for Horn: all consequences found. Negation complicates.

Applies to. Prolog. Databases (Datalog). AI planning. Expert systems. Constraint solving.

Limitations. Order-dependence. Cut affects meaning. Non-termination. Negation subtle.

© 2026 Lingenic LLC