Simple Addition - Prolog Typing CST Test
Loading…
Simple Addition — Prolog Code
Adds two numbers and prints the result.
add(A,B,Sum) :- Sum is A + B.
% Example
?- add(10,20,S), write(S), nl.Prolog Language Guide
Prolog (Programming in Logic) is a high-level, declarative programming language focused on logic programming and symbolic reasoning. It is widely used in artificial intelligence, natural language processing, and rule-based systems, enabling developers to express knowledge and relationships rather than step-by-step instructions.
Primary Use Cases
- ▸Expert systems and rule-based AI
- ▸Natural language processing
- ▸Automated theorem proving
- ▸Knowledge representation and reasoning
- ▸Constraint logic programming
Notable Features
- ▸Declarative syntax: describe what to solve, not how
- ▸Built-in backtracking search
- ▸Unification for pattern matching
- ▸Logical inference engine
- ▸Support for recursion and symbolic computation
Origin & Creator
Developed in 1972 by Alain Colmerauer and Robert Kowalski at the University of Marseille.
Industrial Note
Prolog underpins many AI applications, including expert systems, natural language understanding, and theorem proving frameworks.