# Prolog Examples Library

This is a library of Prolog programs examples gathered from several books about Logic Programming and Prolog. The library has been created by P.Hołownia and W.T.Furmańska, based on work done within student projects (MIW2006 & MIW2007).

For every example there is a page with an explanation, and a source code available for download.

Please use the tag cloud to search for a topic:

Below you can find all the files grouped by categories (tags):

## logic

 And gate 2013/01/17 08:48 Disjunction 2013/01/17 08:48 Logic operators 2013/01/17 08:48 Propositional calculus 2 clauses 2013/01/17 08:48 Truth table 2013/01/17 08:48

## math

 Add 2013/01/17 15:21 Add 2 2013/01/17 15:21 Arc 2013/01/17 08:48 Ascending sorting 2013/01/17 08:48 Capacity 2013/01/17 08:48 Common divisor 2 2013/01/17 08:48 Comon divisor 2013/01/17 08:48 Correlation factor 2013/01/17 08:48 Derivative 2013/01/17 08:48 Derivative 2 2013/01/17 08:48 Differential equations 2013/01/17 08:48 Disjunctive sets 2013/01/17 08:48 Equation solving 2013/01/17 08:48 Equation solving 2 2013/01/17 08:48 Evaluator 2013/01/17 08:48 Exp 2013/01/17 08:48 Factorial 2013/01/17 08:48 Factorial 2 2013/01/17 08:48 Lesseq operator 2013/01/17 08:48 Matrix add 2013/01/17 08:48 Matrix multiply 2013/01/17 08:48 Max 2013/01/17 08:48 Max min 2013/01/17 08:48 Min 2013/01/17 08:48 Multiply 2013/01/17 08:48 Natural numbers 2013/01/17 08:48 Normalization 2013/01/17 08:48 Polinomial 2013/01/17 08:48 Polinomial 2 2013/01/17 08:48 Standard deviation 2013/01/17 08:48 Union and intersection 2013/01/17 08:48 Variance 2013/01/17 08:48 Vectors inner product 2013/01/17 08:48 Vectors inner product 2 2013/01/17 08:48

## set_algebra

 Set intersection 2013/01/17 08:48 Sets sum 2013/01/17 08:48

## matrix

 Matrix add 2013/01/17 08:48 Matrix multiply 2013/01/17 08:48 Matrix transposition 2013/01/17 08:48

## numbers

 Dcg numbers 2013/01/17 08:48 Natural numbers 2013/01/17 08:48 Riddle 2013/01/17 08:48 String2int 2013/01/17 08:48 Terms variety 2013/01/17 08:48

## keywords

 Keyword in context 2013/01/17 08:48

## patterns

 File operations 2013/01/17 08:48 Pattern interpreter 2013/01/17 08:48

## rules

 Abc language recognition 2013/01/17 15:21 Animals 2013/01/17 08:48 Backward-chaining rule interpreter 2013/01/17 08:48 Birds recognition 2013/01/17 08:48 Course rules 2013/01/17 08:48 Credit system 2013/01/17 08:48 Derivative 2013/01/17 08:48 Derivative 2 2013/01/17 08:48 Forward-chaining rule interpreter 2013/01/17 08:48 Generalization 2013/01/17 08:48 Grammar2clauses 2013/01/17 08:48 If rule 2013/01/17 08:48 If then rule 2013/01/17 08:48 Polinomial 2013/01/17 08:48 Polinomial 2 2013/01/17 08:48 Rule interpreter 2013/01/17 08:48 Rule interpreter 2 2013/01/17 08:48 Rule interpreter 4 2013/01/17 08:48 Rule interpreter certainty 2013/01/17 08:48

## backward-chaining

 Backward-chaining rule interpreter 2013/01/17 08:48

## forward-chaining

 Forward-chaining rule interpreter 2013/01/17 08:48

## diagnostic_systems

 Diagnose false solution 2013/01/17 08:48 Diagnose false solution top-down 2013/01/17 08:48 Diagnose missing solution 2013/01/17 08:48 Recognize objects 2013/01/17 08:48

## expert_shell

 Explanation shell 2013/01/17 08:48 Interactive shell 2013/01/17 08:48 Shell 2013/01/17 08:48

## expert_systems

 Birds recognition 2013/01/17 08:48 Oven 2013/01/17 08:48 Shell 2013/01/17 08:48

## knowledge_base

 All solutions 2013/01/17 08:48 Animals kb 2013/01/17 08:48 Answers storing 2013/01/17 08:48 Birds 2013/01/17 08:48 Clauses displaying 2013/01/17 08:48 Electrical network kb 2013/01/17 08:48 English2french 2013/01/17 08:48 Family 2013/01/17 08:48 German2english 2013/01/17 08:48 Road-map path-finding 2013/01/17 08:48

## framework

 Best-first framework 2013/01/17 08:48 Best-first framework 2 2013/01/17 08:48 Depth-first framework 2013/01/17 08:48 Game framework 2013/01/17 08:48 Hill-climbing framework 2013/01/17 08:48 Rule interpreter 3 2013/01/17 08:48

## interactive

 Animals 2013/01/17 08:48 Answers storing 2013/01/17 08:48 Interactive interpreter 2013/01/17 08:48 Interactive shell 2013/01/17 08:48 Interface 2013/01/17 08:48 Interface 2 2013/01/17 08:48 Yesno question 2013/01/17 08:48

## model

 Electrical circuits 2013/01/17 08:48 Model bath tub 2013/01/17 08:48 Model block-spring 2013/01/17 08:48 Model circuit 2013/01/17 08:48 Modelling circuits 2013/01/17 08:48 Oscillator 2013/01/17 08:48

## simulator

 Circuit simulator 2013/01/17 08:48 Differential equations 2013/01/17 08:48 Eliza simulator 2013/01/17 08:48

## algorithms

 Alfa beta 2013/01/17 08:48 Best-move 2013/01/17 08:48 Best-move minimax 2013/01/17 08:48 Bubble sort 2013/01/17 08:48 Ida algorithm 2013/01/17 08:48 Insert sort 2013/01/17 08:48 Interchange sort 2013/01/17 08:48 Merge sort 2013/01/17 08:48 Merge sort 2 2013/01/17 08:48 Naiv sort 2013/01/17 08:48 Permutation sort 2013/01/17 08:48 Quicksort 2013/01/17 08:48 Quicksort 2 2013/01/17 08:48

## function

 Ackermann 2013/01/17 15:21 Area 2013/01/17 08:48 Disjunctive sets 2013/01/17 08:48 String2int 2013/01/17 08:48 Subterm 2013/01/17 08:48 Subterm 2 2013/01/17 08:48

## hypothesis

 Hyper hypothesis refiner 2013/01/17 08:48 Interpreter for hypotheses 2013/01/17 08:48

## proof

 Interpreter for hypotheses 2013/01/17 08:48 Meta interpreter 2 2013/01/17 08:48 Proof explanation 2013/01/17 08:48 Rule interpreter 2 2013/01/17 08:48 Theorem proving 2013/01/17 08:48 Trees proof 2013/01/17 08:48

## automata

 Ndfa interpreter 2013/01/17 08:48 Npda interpreter 2013/01/17 08:48

## counting

 Dcg interpreter counting words 2013/01/17 08:48

## learning

 Hyper hypothesis refiner 2013/01/17 08:48 If then rule 2013/01/17 08:48 Learning predicate 2013/01/17 08:48

## planning

 Blocks 2013/01/17 08:48 Camera planner 2013/01/17 08:48 Flight planner 2013/01/17 08:48 Means-ends 2013/01/17 08:48 Means-ends goal protection 2013/01/17 08:48 Regression planner 2013/01/17 08:48 Scheduling 2013/01/17 08:48 Scheduling clp 2013/01/17 08:48 Space planner 2013/01/17 08:48 State-space 2013/01/17 08:48 Task scheduling 2013/01/17 08:48

## problem_solving

 Best-first framework 2013/01/17 08:48 Best-first framework 2 2013/01/17 08:48 Depth-first framework 2013/01/17 08:48 Dutch flag 2013/01/17 08:48 Dutch flag 2 2013/01/17 08:48 Equation solving 2013/01/17 08:48 Equation solving 2 2013/01/17 08:48 Hanoi 2013/01/17 08:48 Hanoi 2 2013/01/17 08:48 Hill-climbing framework 2013/01/17 08:48 Lee routing 2013/01/17 08:48 Map colouring 2013/01/17 08:48 Map colouring2 2013/01/17 08:48 Minimax move 2013/01/17 08:48 Minimax principle 2013/01/17 08:48 Monkey banana 2013/01/17 08:48 N queens 2013/01/17 08:48 N queens 2 2013/01/17 08:48 Regression planner 2013/01/17 08:48 Road-map path-finding 2013/01/17 08:48 Sliding puzzle 2013/01/17 08:48 Water jugs 2013/01/17 08:48

## searching

 All solutions 2013/01/17 08:48 Best first search 2013/01/17 08:48 Best-first 2013/01/17 08:48 Breadth-first search 2013/01/17 08:48 Breadth-first search 2 2013/01/17 08:48 Depth-first search 2013/01/17 08:48 Depth-first search 2 2013/01/17 08:48 Depth-first search 3 2013/01/17 08:48 Rbfs algorithm 2013/01/17 08:48 Search tree 2013/01/17 08:48

## sorting

 Ascending sorting 2013/01/17 08:48 Bubble sort 2013/01/17 08:48 Diff quicksort 2013/01/17 08:48 Insert sort 2013/01/17 08:48 Insertion sort 2013/01/17 08:48 Interchange sort 2013/01/17 08:48 Merge sort 2013/01/17 08:48 Merge sort 2 2013/01/17 08:48 Permutation sort 2013/01/17 08:48 Quicksort 2 2013/01/17 08:48

## graphs

 Acyclic path 2013/01/17 15:21 Acyclic path 2 2013/01/17 15:21 Graph connections 2013/01/17 08:48 Graph directed 2013/01/17 08:48 Graph path 2013/01/17 08:48 Graph path 2 2013/01/17 08:48 Graph path 3 2013/01/17 08:48 Graph path 4 2013/01/17 08:48 Graph path learning 2013/01/17 08:48 Task scheduling 2013/01/17 08:48 Transitive closure 2013/01/17 08:48

## heap

 Trees heap 2013/01/17 08:48 Trees heap 2 2013/01/17 08:48

## lists

 Append 2013/01/17 08:48 Ascending sorting 2013/01/17 08:48 Change element 2013/01/17 08:48 Credit system 2013/01/17 08:48 Delete element 2013/01/17 08:48 Delete element 2 2013/01/17 08:48 Diff quicksort 2013/01/17 08:48 Disjunctive sets 2013/01/17 08:48 Dynamic memory 2013/01/17 08:48 Explanation shell 2013/01/17 08:48 Flatten 2013/01/17 08:48 Flatten 2 2013/01/17 08:48 Flatten 3 2013/01/17 08:48 Flatten 4 2013/01/17 08:48 Get element 2013/01/17 08:48 If then rule 2013/01/17 08:48 Integers set 2013/01/17 08:48 Last element 2013/01/17 08:48 List define 2013/01/17 08:48 List divide 2013/01/17 08:48 List duplicates remove 2013/01/17 08:48 List examples 2013/01/17 08:48 List intersection 2013/01/17 08:48 List learn membership 2013/01/17 08:48 List length 2013/01/17 08:48 List length 2 2013/01/17 08:48 List length 3 2013/01/17 08:48 List linking 2013/01/17 08:48 List linking 2 2013/01/17 08:48 List linking 3 2013/01/17 08:48 List linking 4 2013/01/17 08:48 List max element 2013/01/17 08:48 List member 2013/01/17 08:48 List member 2 2013/01/17 08:48 List member 3 2013/01/17 08:48 List member 4 2013/01/17 08:48 List nonmember 2013/01/17 08:48 List odd-even 2013/01/17 08:48 List prefix 2013/01/17 08:48 List prefix suffix 2013/01/17 08:48 List smallest element 2013/01/17 08:48 List sum 2013/01/17 08:48 List sum 2 2013/01/17 08:48 List sum 3 2013/01/17 08:48 List2term 2013/01/17 08:48 Lists merging 2013/01/17 08:48 Palindrome 2013/01/17 08:48 Permutation 2013/01/17 08:48 Polygon area 2013/01/17 08:48 Reverse 1 2013/01/17 08:48 Reverse 2 2013/01/17 08:48 Reverse difference 2013/01/17 08:48 Reverse no duplicate 2013/01/17 08:48 Select 2013/01/17 08:48 Select first 2013/01/17 08:48 Sentence2atoms 2013/01/17 08:48 Sets sum 2013/01/17 08:48 String2list 2013/01/17 08:48 Sublists 2013/01/17 08:48 Term2list 2013/01/17 08:48 Union 2013/01/17 08:48 Variation 2013/01/17 08:48 Variation 2 2013/01/17 08:48

## networks

 Belief network specification 2013/01/17 08:48 Belief networks 2013/01/17 08:48

## queue

 Queue 2013/01/17 08:48

## stack

 Meta interpreter 4 2013/01/17 08:48

## terms

 Ground term 2013/01/17 08:48 Occurs 2013/01/17 08:48 Subterm substitution 2013/01/17 08:48 Term substitution 2013/01/17 08:48 Unification 2013/01/17 08:48 Unification 2 2013/01/17 08:48

## trees

 Avl dict insert 2013/01/17 08:48 Binary dictionary 2013/01/17 08:48 Dcg tree 2013/01/17 08:48 Delete from tree 2013/01/17 08:48 Depth-first search 2 2013/01/17 08:48 Depth-first search 3 2013/01/17 08:48 Dictionary lookup 2013/01/17 08:48 Dictionary modification 2013/01/17 08:48 Explanation shell 2013/01/17 08:48 Insert into tree 2013/01/17 08:48 Insert into tree 2 2013/01/17 08:48 Learn tree 2013/01/17 08:48 Meta interpreter 2 2013/01/17 08:48 Prune tree 2013/01/17 08:48 Rule interpreter 2 2013/01/17 08:48 Search tree 2013/01/17 08:48 Tree 2013/01/17 08:48 Tree 2 2013/01/17 08:48 Tree displaying 2013/01/17 08:48 Tree member 2013/01/17 08:48 Trees binary 2013/01/17 08:48 Trees game 2013/01/17 08:48 Trees heap 2013/01/17 08:48 Trees heap 2 2013/01/17 08:48 Trees isomorphic 2013/01/17 08:48 Trees proof 2013/01/17 08:48 Trees spanning 2013/01/17 08:48 Trees spanning 2 2013/01/17 08:48

## game

 Game framework 2013/01/17 08:48 Kalah 2013/01/17 08:48 Mastermind 2013/01/17 08:48 Nim game 2013/01/17 08:48 Tictactoe 2013/01/17 08:48 Trees game 2013/01/17 08:48

## puzzle

 8 puzzle 2013/01/17 15:21 8 queens 2013/01/17 15:21 8 queens 2 2013/01/17 15:21 8 queens 3 2013/01/17 15:21 8 queens 4 2013/01/17 15:21 8 queens 5 2013/01/17 15:21 Crossword 2013/01/17 08:48 Cryptoarithmetic puzzle 2013/01/17 08:48 Cryptoarithmetic puzzle 2 2013/01/17 08:48 Puzzle 2013/01/17 08:48 Riddle 2013/01/17 08:48 Sliding puzzle 2013/01/17 08:48 Wolf goat cabbage 2013/01/17 08:48

## chess

 8 queens 2013/01/17 15:21 8 queens 2 2013/01/17 15:21 8 queens 3 2013/01/17 15:21 8 queens 4 2013/01/17 15:21 8 queens 5 2013/01/17 15:21 King rook 2013/01/17 08:48 N queens 2013/01/17 08:48 N queens 2 2013/01/17 08:48

## family

 Ancestor 2013/01/17 08:48 Descendant 2013/01/17 08:48 Fam biblical 2013/01/17 08:48 Fam grandparents 2013/01/17 08:48 Family 2013/01/17 08:48 Family 2 2013/01/17 08:48 Learning predicate 2013/01/17 08:48 Older 2013/01/17 08:48 Predecessor 2013/01/17 08:48 Relationships 2013/01/17 08:48 Sister 2013/01/17 08:48

## fun

 Editor 2013/01/17 08:48 Mastermind 2013/01/17 08:48 Monkey banana 2013/01/17 08:48 Puzzle 2013/01/17 08:48

## map

 Map colouring 2013/01/17 08:48 Map colouring2 2013/01/17 08:48 Road-map path-finding 2013/01/17 08:48

## money

 Dollar 2013/01/17 08:48 Warehouse 2013/01/17 08:48

## CLP

 8 queens 2013/01/17 15:21 Cryptoarithmetic puzzle 2013/01/17 08:48 Scheduling clp 2013/01/17 08:48

## DCG

 Dcg 2013/01/17 08:48 Dcg contextless 2013/01/17 08:48 Dcg interpreter 2013/01/17 08:48 Dcg interpreter counting words 2013/01/17 08:48 Dcg number agreement 2013/01/17 08:48 Dcg numbers 2013/01/17 08:48 Dcg tree 2013/01/17 08:48 Grammar2clauses 2013/01/17 08:48 Parser pascal 2013/01/17 08:48

## ILP

 Minihyper ilp program 2013/01/17 08:48

## NPDA

 Npda 2013/01/17 08:48 Npda interpreter 2013/01/17 08:48

## OOP

 Geometric objects 2013/01/17 08:48 Oo interpreter 2013/01/17 08:48 Robot world 2013/01/17 08:48

## arithmetic

 Add 2013/01/17 15:21 Add 2 2013/01/17 15:21 Between 2013/01/17 08:48 Equation solving 2013/01/17 08:48 Equation solving 2 2013/01/17 08:48 Evaluator 2013/01/17 08:48 Exp 2013/01/17 08:48 Integers set 2013/01/17 08:48 Lesseq operator 2013/01/17 08:48 List sum 2013/01/17 08:48 List sum 2 2013/01/17 08:48 List sum 3 2013/01/17 08:48 Multiply 2013/01/17 08:48 Older 2013/01/17 08:48 Tree 2 2013/01/17 08:48

## combinatorics

 Combinations with repeated 2013/01/17 08:48 Combinations without repeated 2013/01/17 08:48 Variation 2013/01/17 08:48 Variation 2 2013/01/17 08:48

## electronics

 And gate 2013/01/17 08:48 Circuit simulator 2013/01/17 08:48 Electrical circuits 2013/01/17 08:48 Electrical network kb 2013/01/17 08:48 Electronics 2013/01/17 08:48 Modelling circuits 2013/01/17 08:48 Oscillator 2013/01/17 08:48

## geometry

 Analogy 2013/01/17 08:48 Arc 2013/01/17 08:48 Area 2013/01/17 08:48 Capacity 2013/01/17 08:48 Geometric objects 2013/01/17 08:48 Polygon area 2013/01/17 08:48 Recognize objects 2013/01/17 08:48

## conversation

 Eliza simulator 2013/01/17 08:48

## language

 Abc language enhancement 2013/01/17 15:21 Abc language recognition 2013/01/17 15:21 English2french 2013/01/17 08:48 Prolog compiler 2013/01/17 08:48 Sentence 2013/01/17 08:48 Sentence2atoms 2013/01/17 08:48

## natural_language

 Build sentence 2013/01/17 08:48 German2english 2013/01/17 08:48

## cut

 Cut 2013/01/17 08:48 List max element 2013/01/17 08:48 List smallest element 2013/01/17 08:48 Lists merging 2013/01/17 08:48 Min 2013/01/17 08:48 Sentence2atoms 2013/01/17 08:48 Uncertaint reasoning 2013/01/17 08:48

## operators

 Acyclic path 2013/01/17 15:21 Acyclic path 2 2013/01/17 15:21 Depth-first search 2 2013/01/17 08:48 Dif operator 2013/01/17 08:48 Differential equations 2013/01/17 08:48 Equation solving 2 2013/01/17 08:48 Explanation shell 2013/01/17 08:48 Flatten 3 2013/01/17 08:48 Flatten 4 2013/01/17 08:48 If then rule 2013/01/17 08:48 King rook 2013/01/17 08:48 Lesseq operator 2013/01/17 08:48 Logic operators 2013/01/17 08:48 Negation 2013/01/17 08:48 Proof explanation 2013/01/17 08:48 Propositional calculus 2 clauses 2013/01/17 08:48 Task scheduling 2013/01/17 08:48 Terms variety 2013/01/17 08:48 Theorem proving 2013/01/17 08:48 Truth table 2013/01/17 08:48

## predicates

 Findall 2013/01/17 08:48 Variables in term 2013/01/17 08:48

## recursion

 Ancestor 2013/01/17 08:48 Bubble sort 2013/01/17 08:48 Factorial 2013/01/17 08:48 Factorial 2 2013/01/17 08:48 Flatten 2013/01/17 08:48 Flatten 2 2013/01/17 08:48 Food chain 2013/01/17 08:48 Insert sort 2013/01/17 08:48 List prefix 2013/01/17 08:48 List prefix suffix 2013/01/17 08:48 Merge sort 2013/01/17 08:48 Merge sort 2 2013/01/17 08:48 Naiv sort 2013/01/17 08:48 Natural numbers 2013/01/17 08:48 Permutation sort 2013/01/17 08:48 Polygon area 2013/01/17 08:48 Predecessor 2013/01/17 08:48 Quicksort 2013/01/17 08:48 Quicksort 2 2013/01/17 08:48 Recursion 2013/01/17 08:48 Tree member 2013/01/17 08:48 Uncertaint reasoning 2013/01/17 08:48 Union and intersection 2013/01/17 08:48

## statements

 If rule 2013/01/17 08:48 If then 2013/01/17 08:48 If then rule 2013/01/17 08:48

## compiler

 Prolog compiler 2013/01/17 08:48

## interpreter

 Backward-chaining rule interpreter 2013/01/17 08:48 Belief networks 2013/01/17 08:48 Dcg interpreter 2013/01/17 08:48 Dcg interpreter counting words 2013/01/17 08:48 Forward-chaining rule interpreter 2013/01/17 08:48 Interactive interpreter 2013/01/17 08:48 Interpreter for hypotheses 2013/01/17 08:48 Ndfa interpreter 2013/01/17 08:48 Npda interpreter 2013/01/17 08:48 Oo interpreter 2013/01/17 08:48 Pattern interpreter 2013/01/17 08:48 Rule interpreter 2013/01/17 08:48 Rule interpreter 2 2013/01/17 08:48 Rule interpreter 3 2013/01/17 08:48 Rule interpreter 4 2013/01/17 08:48 Rule interpreter certainty 2013/01/17 08:48

## metainterpreter

 Meta interpreter 2013/01/17 08:48 Meta interpreter 2 2013/01/17 08:48 Meta interpreter 3 2013/01/17 08:48 Meta interpreter 4 2013/01/17 08:48 Meta interpreter 5 2013/01/17 08:48 Meta interpreter 6 2013/01/17 08:48 Meta interpreter 7 2013/01/17 08:48 Meta interpreter tracing 2013/01/17 08:48 Partial reduction 2013/01/17 08:48

## parser

 Parser abc 2013/01/17 08:48 Parser pascal 2013/01/17 08:48

## file

 Consulting file 2013/01/17 08:48 Editor 2013/01/17 08:48 File writting 2013/01/17 08:48 Read from file 2013/01/17 08:48

## memory

 Consulting file 2013/01/17 08:48 Dynamic memory 2013/01/17 08:48

## read/write

 Consulting file 2013/01/17 08:48 File operations 2013/01/17 08:48 Read from file 2013/01/17 08:48

## tracers

 Tracer 2013/01/17 08:48

## npda

 Npda 2013/01/17 08:48 Npda interpreter 2013/01/17 08:48

## misc

 Arg predicate 2013/01/17 08:48 Composition 2013/01/17 08:48 Explanation-based generalization problem def 2013/01/17 08:48 Functor predicate 2013/01/17 08:48 Mcsam 2013/01/17 08:48 Repeat 2013/01/17 08:48 Skeleton 2013/01/17 08:48 Term melting 2013/01/17 08:48 Welfare payments 2013/01/17 08:48 Write predicate 2013/01/17 08:48
pl/prolog/pllib/start.txt · ostatnio zmienione: 2017/07/17 08:08 (edycja zewnętrzna)