Example decks
Every runnable program under examples/ has a deck: a short, wide-audience
walk through the question it answers, the facts and rules that model it, the
answer EyeProlog derives, the proof behind that answer, and the independent
check of that proof. Each deck links to the source and opens the example in the
playground.
- A backward rule — Is 5 more interesting than 3?
- A Boolean circuit — Does this gate network really compute XOR?
- A CDCL SAT step — How does a SAT solver learn from a conflict?
- A chart parser — Is this sentence grammatical, and which phrases does it contain?
- A command parser — One grammar that both reads and writes home-automation commands
- A derived rule — If there is a cat, does a dog make the test true?
- A dog licence rule — Who has so many dogs that they need a licence?
- A DPLL SAT solver — Can these five clauses all be true at once?
- A drone corridor planner — Which delivery plans from Gent to Oostende are reliable and cheap enough?
- A feature model in Boolean constraints — Which product configurations are valid, and how many are there?
- A partial evaluator — What is left of a program when some of its inputs are already known?
- A review quorum — Which two reviewers satisfy every rule?
- A rule that writes a rule — Can one fact about two relations produce a new rule?
- A truth maintenance system — Which beliefs follow from which assumptions, and which clash?
- A Turing machine — Can a handful of clauses run a Turing machine?
- A vanilla meta-interpreter — Can Prolog describe how Prolog runs?
- A withdrawn evidence demand — What follows when an authority asks for something it had no power to ask?
- Abstract interpretation — Can this program divide by zero?
- Access control policy — Does this request satisfy the policy?
- Ackermann — How fast can a tiny recursive definition grow?
- Advanced ODRL policy — One policy, three requests, three different outcomes
- Age check — Is this person older than 80?
- Aliases and namespaces — Which names are built in, and which are just your vocabulary?
- Allen’s interval calculus — How do two time intervals relate?
- An expression language — Parse arithmetic, evaluate it, and print it back with the right parentheses
- Ancestors — Who descends from whom?
- Animal classification — If Joe is a human, is Joe an animal?
- Annotation — Who said what, and when?
- Attributed variables — Can a variable carry a promise about its future value?
- AuroraCare — Should this use of a patient’s health data be permitted, and why?
- Basic monadic benchmark — Which labelled ten-step cycles exist in a graph of 10,000 edges?
- Bayesian diagnosis — Which disease best explains these symptoms?
- Bayesian therapy choice — Which therapy is best when the diagnosis is uncertain?
- Beam deflection — Does this cantilever beam bend too far?
- Big-number multiplication and powers — Can a logic program multiply 34-digit numbers exactly?
- Binomial coefficients and Vandermonde’s identity — Do two ways of counting the same committees agree?
- Blocks-world planning — Which five moves turn one stack of blocks into another?
- Body mass index — What is this person’s BMI, and which category does it fall in?
- Braking safety in alternative worlds — Can the car stop in time, and does the answer depend on the model?
- Buck converter design — Does this voltage regulator keep its ripple within limits?
- Bulk stream writing — Does every character written to a file come back when it is read?
- Burn the witch — How far can a chain of silly rules go?
- Cache performance — Is the cache actually earning its keep?
- Canary release — Should this release be rolled back?
- Cat Koko — How do you say “there is a cat” without naming the cat?
- Catalan numbers — How many ways can you cut a polygon into triangles?
- Certified gradient-descent bounds — What can interval arithmetic certify about ten gradient-descent steps?
- Choosing an epidemic policy — Which intervention brings the outbreak under control?
- Clinical-trial screening — Which patients can enter a diabetes trial, and why are the others turned away?
- Collatz trajectories for 1 to 1000 — Does every start from 1 to 1000 reach 1?
- Combinations with findall and sort — What are all the ways to choose 3 items out of 5?
- Common ISO extensions — Which everyday extensions do mature Prolog systems share?
- Competitive enzyme inhibition — How much does an inhibitor slow an enzyme down?
- Complex numbers — What is i to the power i?
- Composing injective functions — If f and g are injective, is g ∘ f injective too?
- Computing the date of Easter — On which day does Easter fall in each year from 2026 to 2035?
- Computing π — How close does the Nilakantha series get to π?
- Context association — Which named graph holds the data, which holds its signature, and which holds the signature’s metadata?
- Context schema audit — Which fields in a message do not fit the schema?
- Continued fraction for √2 — How do the fractions 3/2, 7/5, 17/12, … close in on the square root of two?
- Control system — What signal should each actuator receive?
- Correlating service logs — Which failures in unstructured logs belong to the same user journey?
- Critical path scheduling — When can the project finish, and which tasks decide that?
- Cross-organization data sharing — Decision
- Dairy energy balance — Is each cow eating enough energy for her body and her milk?
- Data negotiation — Which data requests can both sides agree to?
- Deep taxonomy, depth 10 — Does one individual, climbing ten levels of a class hierarchy, reach the top?
- Deep taxonomy, depth 100 — What does a reasoner have to derive to answer one question?
- Deep taxonomy, depth 1000 — How does a proof grow when the chain gets ten times longer?
- Deep taxonomy, depth 10000 — Can a reasoner follow ten thousand dependent steps without losing its way?
- Deep taxonomy, depth 100000 — Does the whole pipeline (answer, proof, and check) hold up at 300,000 rules?
- Defeasible reasoning — Which travel expenses get reimbursed, and what happens when two policies both claim one?
- Delayed disequality with dif/2 — How do you say “these must differ” before you know what they are?
- Delfour: a privacy-preserving shopping insight — Can a store scanner give diabetes-aware advice without ever learning about the diabetes?
- Deontic logic — Which duties were broken, which were repaired, and does someone need to review it?
- Dependency depth: 10,000 predicates — Can dependency analysis follow a deep chain without exhausting the JavaScript stack?
- Dependency preparation: 5,000 predicates — How quickly can the engine prepare thousands of distinct predicates?
- Dialogical reasoning — Can this claim survive an opponent?
- Dijkstra with findall and sort — What is the cheapest route, found the way Dijkstra would?
- Dining philosophers — Who eats when, and with which forks?
- DONALD + GERALD = ROBERT — Which digit does each letter stand for?
- Equality saturation — What is the cheapest expression equal to this one?
- Euler’s totient — How many numbers up to N share no factor with N?
- Eulerian path — Can you walk every street exactly once?
- EV range worlds — Will the battery last the trip, and under which assumptions?
- Existential rules with witnesses — How can a rule say “there exists something” without inventing anonymous objects?
- Exoplanet validation worlds — When does a transit signal really mean a planet?
- Explainable EV-depot configuration — Questions, not just filtering
- Expression evaluator — What is (2 × 3) + (10 − 4), and how was it computed?
- Factorial with integer constraints — What is 6!, computed with constraints instead of
is/2?
- Family cousins — Who are cousins in this family tree?
- Fast exponentiation — How do you compute 3 to the power 10000 without 10000 multiplications?
- Fibonacci by fast doubling — How do you compute the 10,000th Fibonacci number without computing all the ones before it?
- Field nitrogen balance — Which fields get too little nitrogen, which get too much, and where is leaching worst?
- Finding a bug by asking smaller questions — Where is the fault in a list-maximum predicate that gives the wrong answer?
- Flandor — May a regional board use an economic insight, and which support package should it activate?
- Floating-point arithmetic — What happens when a logic program computes with decimals?
- Four colours for Europe — Does this colouring of the EU map keep every pair of neighbours apart?
- Four-colouring the European Union — Can 27 countries be coloured with four colours so that no neighbours match?
- GDPR-style compliance — Is this processing of personal data allowed, and if not, why not?
- Global constraints over integers — How do whole-problem constraints describe tables, schedules, costs, and tours?
- Goldbach for powers of two — Can each power of two from 4 to 2²⁵ be written as a sum of two primes?
- GPS route choice — Which route should we take from Gent to Oostende?
- Gray-code counter — Does this three-bit circuit count in Gray code?
- Greatest lower bounds are unique — If two things are both the greatest lower bound of the same pair, are they the same?
- Hamiltonian paths — Which routes visit every vertex of this graph exactly once?
- Hamming(7,4) error correction — Which bit of this received packet was flipped, and what was sent?
- Heat loss through a wall — How much heat escapes through this wall on a cold day?
- Herbrand semantics — Can two different names mean the same thing?
- Herbrand witnesses — How do you say “there exists” in a rule?
- Heron’s theorem — What is the area of a triangle when you only know its sides?
- HTTP client — How does a Prolog program fetch and read a JSON document?
- Ideal gas law — Is the pressure in this gas cell close to one atmosphere?
- Illegitimate reasoning — Can a program spot a bad argument?
- Integer partitions — In how many ways can a number be written as a sum?
- Integrity check — Is the input itself consistent?
- Introduction to EyeProlog — What is EyeProlog?
- Intuitionistic logic with a Kripke model — When is “p or not p” not automatically true?
- Inverses in a group are unique — If two elements both undo
x, are they really different?
- ISO atomic conversion — How do atoms, characters, codes and numbers relate?
- ISO control and errors — How does standard Prolog choose, commit, and recover?
- ISO dynamic database — How does a Prolog program keep changing state?
- ISO extension pipeline audit — Can one bounded report count, summarize, trace, and check a pipeline?
- ISO grouped solutions — How do you turn many answers into one list, or one list per group?
- ISO integer arithmetic — What is -7 divided by 3?
- ISO operators — Can a program read like a sentence and still be an ordinary term?
- Job-shop scheduling — What is the shortest way to run three jobs on two shared machines?
- JSON — Can one grammar both read and write JSON?
- Knapsack optimization — Which gear gives an expedition the most value within its weight limit?
- Knight’s tour — Can a chess knight visit every square of a board exactly once?
- Knowledge-engineering alignment — Can data in a local vocabulary be read as a shared standard without rewriting it?
- Knuth–Bendix completion — Does every way of simplifying a term lead to the same result?
- Language — How does an EyeProlog program look when its names are web identifiers?
- Law of cosines — How long is the third side of a triangle?
- Least-squares regression — Which straight line best fits these points, and is the fit good enough?
- Lee routing — How do you route a wire around obstacles on a chip?
- Leg length discrepancy measurement — Are this patient’s legs measurably different in length?
- Linear logic with resources — Can a rule use each resource exactly once?
- List collections — How do you work with a whole list as one value?
- Manufacturing quality control — Is this production line capable of staying inside its tolerances?
- Mapping a data-processing record to a policy — Does this policy really say what the processing record says?
- Markov logic, one world at a time — Which possible world best fits soft, weighted rules?
- Matrix multiplication is not commutative — Does A·B always equal B·A?
- Matrix-chain order — In what order should six matrices be multiplied to do the least work?
- Microgrid dispatch — How should a campus cover its load with renewables, a battery, and the grid?
- Missionaries and cannibals — Can everyone cross the river without anyone being outnumbered?
- Modal logic on a Kripke frame — What is necessarily true, and what is merely possible?
- Modular exponentiation — What is 7⁵⁶⁰ mod 561, without ever computing 7⁵⁶⁰?
- Monkey and bananas — How does a monkey get bananas hanging out of reach?
- N queens with constraints — How can N queens share a board without attacking each other?
- Naive reverse — How much work does it take to reverse a list the slow way?
- Network SLA check — Does this network path meet its latency promise?
- New Scientist Enigma 1225 — Which symmetric 8 × 8 grid scores highest?
- Newton–Raphson root finding — Where does a function cross zero?
- Numeric 8-point FFT — Which frequencies are hidden in eight samples?
- ODRL policy — May this dataset be used for research?
- ODRL policy reasoning — One reasoner, many kinds of policy questions
- Operational incident response — Decision
- Orbital transfer design — Can a spacecraft get from Earth’s orbit to Mars’s orbit within its fuel budget?
- Overlapping equivalence classes — If two classes share a member, are they the same class?
- Path discovery — How can you fly from Ostend to Prague with at most two stopovers?
- Paths through a cycle — Which nodes can reach which, when the graph loops back on itself?
- Peano arithmetic — What is (1 × 2 + 3)! when numbers are only zero and successors?
- Peano calculus — Can arithmetic be built from nothing but zero and “the next number”?
- Pendulum period — Does a one-metre pendulum swing with a two-second period?
- Pointer analysis — Which objects can each pointer variable point to?
- Polynomial roots — Which complex integers are roots of these quartic polynomials?
- Portable library overlap — Can one program use nine libraries and still run on three Prolog systems?
- Prime factors of 202,692,987 — Which primes multiply to this number, and how do we know the list is right?
- Prime range and totient — Which numbers up to 30 are prime, and how many numbers below 271 are coprime to it?
- Primes below 1000 — Which numbers up to 1000 are prime?
- Proof by contrapositive — If the ground is dry, is it raining?
- Propositional Dynamic Logic — Can every way of acting reach the garden, or only some?
- Quine–McCluskey logic minimization — What is the smallest sum-of-products formula for this Boolean function?
- Radioactive decay — How much activity is left after 16 hours?
- Ranked consumer-policy risks — Which clauses of this agreement put the consumer at risk, and which matter most?
- Ranking healthcare policy risks — Which gaps in this healthcare data policy are the most urgent to fix?
- Ranking RDF 1.2 annotated claims — Is the bridge open or closed?
- RDF 1.2 annotations — Who said this, and when?
- RDF 1.2 directional language tags — Will Arabic text still read right to left after reasoning?
- RDF 1.2 graph join — Which station reported this sensor reading?
- RDF 1.2 named graphs — Can rules reason inside one graph without leaking into others?
- RDF 1.2 nested triple terms — What is buried inside a claim about a claim?
- RDF 1.2 triple terms — Can a statement be talked about without being asserted?
- RDF 1.2 triple terms in a named graph — Does a claim keep its context when it is unpacked?
- Reachability with a visited list — Can you get from one node to another, and can the program prove when you can’t?
- Reflective terms — How does a program look inside a term whose shape it does not know?
- Register allocation — Which variables get a CPU register, and which must spill to memory?
- Reified conditionals — How can a condition become data that reusable control predicates act on?
- Relational cube lookup — Can 2000 two-key lookups over 3375 facts stay fast and fully explained?
- Reproducible UUIDs — Can a random identifier be reproducible?
- Resource allocation with integer constraints — Which worker should do which job so the team finishes fast?
- Reusable built-ins — How far do the bundled libraries take you before you write a rule?
- Risk-adjusted route selection — Is the cheapest route the best one when routes carry risk?
- Roads across France — Which cities can you reach by one-way roads?
- Route planning — How do I get to Nantes, and which way exactly?
- Scientific evidence graph — Decision
- Scoped negation as failure — Is there a person Alice does not hate?
- Security incident correlation — Which alerts add up to a confirmed compromise?
- SEND + MORE = MONEY — Which digits make this sum work?
- Service impact — When the payment service fails, what else goes down?
- Sizing an RC low-pass filter — Which frequencies does this resistor and capacitor let through?
- Skolem functions — How do rules create new things with stable names?
- Socrates is mortal — The oldest syllogism, as a program
- Software supply-chain vulnerability response — Decision
- Spacecraft battery diagnosis — Is this battery heading for thermal runaway, and should we act?
- Stable marriage — Can everyone be paired so that no two people would rather run off together?
- Statistics summary — What are the mean, variance, and standard deviation of a small sample?
- Stirling and Bell numbers — In how many ways can a set be split into groups?
- Sudoku with integer constraints — Can constraints solve one of the hardest known Sudokus?
- Superdense coding — Can one shared qubit carry two classical bits?
- Symbiotic Knowledge Graphs with RDF, EyeProlog, and people — One idea, in plain language
- Symbolic derivatives — Can calculus rules be written as clauses?
- Symbolic Fast Fourier Transform — What computation does an 8-point FFT actually perform?
- Term input and output — Can a program write Prolog terms to a file and read them back intact?
- Term tools — How does a program look inside a term?
- The diamond property — When two paths split, can they meet again?
- The good cobbler — Can a statement about a statement be an ordinary term?
- The Nixon diamond — What should a reasoner conclude when two good defaults disagree?
- The Pell equation — Which whole numbers satisfy x² − 2y² = 1?
- The quadratic formula — Where does a parabola cross zero?
- The Riemann hypothesis, as a finite check — Do the zeros in this catalogue lie on the critical line?
- The shoelace formula — What is the area of this polygon?
- The subgroups of D3 — Which sets of triangle symmetries form a group of their own?
- The Takeuchi function — What does a tiny, wildly recursive function compute?
- The zebra puzzle — Who drinks water, and who owns the zebra?
- Towers of Hanoi — How do you move a tower of three disks, one disk at a time?
- Trust flow with a provenance threshold — Should a receiver accept this message?
- Trust-aware data flows — May this data flow go ahead, given the policy and how much we trust the source?
- Type inference — What type does this program have?
- Universal and existential termination — Does “it terminates” mean the first answer, or all of them?
- Vector similarity — How alike are two vectors?
- Vocabulary alignment — Which local vehicle concepts roll up to the reference “car”?
- Vulnerability impact — Which services are exposed to a vulnerable library?
- Web names — Can web identifiers be ordinary Prolog atoms?
- Weighted interval scheduling — Which non-overlapping jobs earn the most?
- Weighted release planning — Which features give the most value within the rules?
- Weighted routes from a to f — Which routes through a small road network stay within a cost budget?
- Wolf, goat and cabbage — How does a farmer cross the river without losing anything?
- Workplace compliance — Which employees followed the end-of-shift policy?