My Picat page
This page is maintained by Hakan Kjellerstrand (hakank@gmail.com)
Picat is a general-purpose programming language that incorporates features from logic programming, functional programming, and scripting languages. The letters in the name summarize Picat's features:
- Pattern-matching: A predicate defines a relation, and can have zero, one, or multiple an-
swers. A function is a special kind of a predicate that always succeeds with one answer.
Picat is a rule-based language. Predicates and functions are defined with pattern-matching
rules.
- Intuitive: Picat provides assignment and loop statements for programming everyday things.
An assignable variable mimics multiple logic variables, each of which holds a value at a
different stage of computation. Assignments are useful for computing aggregates and are
used with the foreach loop for implementing list and array comprehensions.
(Note: In early versions of Picat, the I stood for Imperative.)
- Constraints: Picat supports constraint programming. Given a set of variables, each of which
has a domain of possible values, and a set of constraints that limit the acceptable set of
assignments of values to variables, the goal is to find an assignment of values to the variables
that satisfies all of the constraints. Picat provides three solver modules: cp, sat, and mip.
These three modules follow the same interface, which allows for seamless switching from
one solver to another.
- Actors: Actors are event-driven calls. Picat provides action rules for describing event-
driven behaviors of actors. Events are posted through channels. An actor can be attached to
a channel in order to watch and to process its events.
- Tabling: Tabling can be used to store the results of certain calculations in memory, allow-
ing the program to do a quick table lookup instead of repeatedly calculating a value. As
computer memory grows, tabling is becoming increasingly important for offering dynamic
programming solutions for many problems. The planner module, which is implemented
by the use of tabling, has been shown to be a more efficient tool than ASP and PDDL for
solving many planning problems.
Picat is created by Neng-Fa Zhou and Jonathan Fruhman.
Some links:
- Download
- A User's Guide to Picat (PDF) by Neng-Fa Zhou and Jonathan Fruhman (HTML-version)
- exs.pi: Examples
- Euler Project in Picat (some of my versions my versions are published there. Cf the versions below.)
- Get Started (PDF)
- Tutorial (PDF)
- Modules
- Ninety-Nine Picat Problems
- Neng-Fa Zhou: Combinatorial Search With Picat (arXiv)
- Neng-Fa Zhou: Scripting and Modeling with Picat 2013-09-23, IBM PL DAY (PDF)
- 2013-09-29: I blogged about Picat in A first look at Picat programming language
- Håkan Kjellerstrand: CCDC 2014 paper My First Look At Picat as a Modeling Language for Constraint Solving andPlanning (PDF) (based on the blog post "A first look at Picat programming language", see above)
- Håkan Kjellerstrand: Picat - a new logic-based multi-paradigm programming language (PPT, slightly edited), talk at SweConsNet 2014, 20140613
- Håkan Kjellerstrand: ALP Newsletter article (July 2014) Picat: A Logic-based Multi-paradigm Language (as PDF: alp14.pdf)
- Picartesius, Windows Excel/VBA integration of Picat (by Lorenz Schiffmann)
- Neng-Fa Zhou: Tabling for Planning - Modeling and Solving Planning Problems With Picat (PDF, ECAI'14 Tutorial, Prague 8/18/2014)
- Neng-Fa Zhou, Håkan Kjellerstrand: Solving several planning problems with Picat (Conference paper: Control and Decision Conference, 2014 CCDC)
- Sergii Dymchenko occasionally write about Picat (and Logic Programming in general): sdymchenko.com
- Sergii Dymchenko, Mariia Mykhailova: Declaratively solving Google Code Jam problems with Picat (arXiv)
- Sergii Dymchenko in Linux Journal: An Introduction to Tabled Logic Programming with Picat
- Paper (PADL16) Neng-Fa Zhou, Håkan Kjellerstrand: The Picat-SAT Compiler, Presentation
- Neng-Fa Zhou, Håkan Kjellerstrand: A Picat-based XCSP Solver - from Parsing,Modeling, to SAT Encoding (LPOP 2020)
- Neng-Fa Zhou: Video Tutorial "Programming in Picat" (FLOPS16): Part 1, Part 2, Part 3
- Neng-Fa Zhou: Video Programming in Picat (RuleML 2016)
- Sergii Dymchenko: Video Introduction to Tabled Logic Programming with Picat Part 1 - λC 2016, Part 2
- Claudio Cesar de Sa: Video Video-aula introdutoria de PICAT and Videoaula 02 - PICAT - Tipos de Dados (in Portuguese)
- Roman Bartak and Neng-Fa Zhou Modeling and Solving AI Problems in Picat, A tutorial at AAAI 2017, slides, video
- Roman Bartak and Jindrich Vodrazka ICAPS 2017: Modeling & Solving Techniques on Performance of a Tabled Logic ("An Experimental Study of Influence of Modeling and Solving Techniques on Performance of a Tabled Logic") (YouTube video)
- Picat Online Editor by Alexandre Goncalves Silva. Here's two different n-queens implementations.
Book: Constraint Solving and Planning with Picat
Book by Neng-Fa Zhou, Håkan Kjellerstrand, and Jonathan Fruhman: Constraint Solving and Planning with Picat, Springer Verlag. ISBN: 9783319258812 (paper), 9783319258836 (e-book).
From the Springer page:
This book introduces a new logic-based multi-paradigm programming language that integrates logic programming, functional programming, dynamic programming with tabling, and scripting, for use in solving combinatorial search problems, including CP, SAT, and MIP (mixed integer programming) based solver modules, and a module for planning that is implemented using tabling.
The book is useful for undergraduate and graduate students, researchers, and practitioners.
The book page at http://picat-lang.org/ .
The complete book is available as a PDF.
My Picat programs/models
Here are some of my Picat programs/models. Many are ported from (or inspired by) my earlier B-Prolog models. There are also quite a few non-CP programs, e.g. problem from Rosetta Code and Project Euler.
The files are available (or will soon be available) at my Github repo: https://github.com/hakank/hakank/tree/master/picat .
They are separated in different sections:
Program for Picat v3
These programs are for Picat version v3 with (Prolog) Horn clauses, DCG's etc. Also, see Neng-Fa Zhou's port of GeoQuery to Picat v3: github.com/nfzhou/geoquery.