Everything you need for logic programming, built on solid foundations
Parse and process first order logic expressions with full support for quantifiers, operators, and predicates.
Leverage SLD resolution for efficient query processing on facts and rules in your logic programs.
Extensive library of built-in predicates including list operations, arithmetic, and logical operations.
GIC uses a first-order logic syntax. If P is a predicate (Uppercase) and t1, ..., tn are terms (variables or function applications in lowercase), then L-Formulas are defined as:
A .gic file consists of a set of L-Formulas separated by .
You can use either ASCII operators (and, or, impl, not, exists, forall) or Unicode symbols (∧, ∨, ⇒, ¬, ∃, ∀) interchangeably.
Universal quantifiers (forall) may be left implicit.
L-Formulas f ::=
P(t1, ..., tn) // Predicate
| bottom // ⊥
| f and f // f ∧ f
| f or f // f ∨ f
| f impl f // f ⇒ f
| not f // ¬ f
| exists X. f // ∃ X. f
| forall X. f // ∀ X. fGIC makes it easy to work with logic programs. Here's what you can build.
Define and query complex relationships with logical rules.
(Father(A,B) and Father(B,C)) ⇒ Grandpa(A,C).Work with recursive data structures and solve constraints.
Reverse(XS,XS) ⇒ Palindrome(Xs)Express complex mathematical expressions with logic formulas.
Fib(0,0).
Fib(1,1).
(
Gt(N,1) and
Sub(N,1,N1) and
Fib(N1,F1) and
Sub(N,2,N2) and
Fib(N2,F2) and
Add(F1,F2,F)
) impl Fib(N,F).