This repository contains laboratory assignments for the "Loginis Programavimas" (Logic Programming) university course. The projects focus on declarative problem-solving, recursive logic, and state-space exploration using Prolog.
- Implementation of a knowledge base using facts and rules.
- Logic for determining complex family ties (siblings, descendants).
- Implementation of hobby-based longevity filters and person classification.
- Graph traversal logic to determine paths between cities with step counting.
- Implementation of subtraction using Peano axioms (s(X) notation) to demonstrate fundamental arithmetic logic.
- Solving a block manipulation problem with height constraints.
- Implementation of a recursive solver that explores possible moves and avoids infinite loops using a visited-states list.
- Features automatic move formatting for solution output.
- High-level list manipulation algorithms:
- Splitting lists by numeric polarity (positive/negative).
- Extracting the last K elements without built-in primitives.
- Implementation of Insertion Sort.
- Infinite-precision addition: Summing large numbers represented as digit lists.
- Knowledge Base reasoning (facts vs rules).
- Depth-first search (DFS) in state space.
- Recursive data structures and pattern matching.
- Pruning search trees with the cut operator (!).
These modules are designed for the SWI-Prolog interpreter.
- Install SWI-Prolog.
- Load a specific module: swipl -s lab1-family-relations/family_logic.pl
- Query the predicates (e.g.,
?- sprendimas(Pradinis, Galinis, N, K, Spr).).
MIT License