Skip to content

janbabak/Prolog

Repository files navigation

Logical programming in Prolog

Description

This repository includes programs created for the Programming Paradigms course at the Czech Technical University's Faculty of Information Technology. The programs are written in Prolog.

🤓 Logical Programming

Logical programming is an approach to programming based on formal logic. Programs consist of statements and rules expressing facts and relationships about a problem domain.

Programmers define relationships between entities and constraints on possible solutions. The system searches for valid solutions by applying inference rules. Prolog is a popular language in this paradigm, which allows for expressing complex relationships and constraints concisely. Logical programming is well-suited for tasks involving symbolic reasoning, knowledge representation, and manipulation of complex data structures.

🗃️ Content

The repository contains the following files:

  • binarySearchTree operations with binary search trees (insert, contains, delete, create tree from list)
  • factorial mathematical factorial
  • fibonacci computes the $n$-th Fibonacci number
  • lists operations with lists (contains, get $n$-th element, length, push back, delete first, delete all, replace all, get last element, flatten, reverse, powerset)
  • mergeSort standard sorting algorithm
  • occurrenceCounter counts all occurrences in a list
  • selectSort another sorting algorithm
  • unarySystem arithmetic operations over the unary system, where numbers are represented like this: 0 = [], 1 = [x], 2 = [x, x], ...

👨‍🎓 Takeaways

Throughout this course, I gained knowledge about programming paradigms beyond the imperative approach, including logical and functional. It came to my attention that certain tasks can be accomplished more efficiently with alternative methods. Additionally, I enhanced my understanding of recursion and acquired knowledge of recursive algorithms like merge sort and operations involving binary trees.

About

logical programming

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages