https://github.com/muneeb706/prolog-programs
Solutions of Logic in Computer Science problems in Proloh.
https://github.com/muneeb706/prolog-programs
logic-in-computer-science logic-programming prolog-programming-language
Last synced: 9 months ago
JSON representation
Solutions of Logic in Computer Science problems in Proloh.
- Host: GitHub
- URL: https://github.com/muneeb706/prolog-programs
- Owner: muneeb706
- Created: 2020-03-30T21:52:36.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2020-04-02T13:12:09.000Z (over 5 years ago)
- Last Synced: 2025-01-31T10:42:13.453Z (11 months ago)
- Topics: logic-in-computer-science, logic-programming, prolog-programming-language
- Language: Prolog
- Size: 1.18 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Prolog Programs
Solutions of Logic in Computer Science problems in Prolog. Following are descriptions of implemented programs
## Insertion Sort:
Implemention of the insertion sort, isort(X, Y), where X is a list of integers and Y is the result of sorting X.
## Selection Sort:
Implemention of the selection sort, ssort(X, Y), where X is a list of integers and Y is the result of sorting X.
## Propostional Formula to CNF (Conjunctive Normal Form):
Implementation of a Prolog program which converts a propositional formula into CNF. That is, provide an implementation of transCNF(X, Y) in Prolog, where X is a propositional formula and Y is the CNF equivalent formula to X.
## Generate Prolog Clauses:
Suppose the program M is written as a fact in Prolog format:
programM(
[l(1, sub1(x, 5)),
l(2, add1(y)),
l(3, add1(y)),
l(4, goto(1)),
l(5, sub1(y, 8)),
l(6, add1(x)),
l(7, goto(5)),
l(8, end)]).
Implementation of a Proglog program which takes the program M as input, and generates the clauses in Prolog format for the negation of the formula SM as follows:
prob3 :- programM(X), generate(X).
where generate(X) will print out the clauses in Prolog format. Output can be compared with the prolog program in double.pl.
[Instructions to Run prolog program](https://www.swi-prolog.org/man/quickstart.html)