Table of Contents
Fetching ...

Picat Through the Lens of Advent of Code

Neng-Fa Zhou, Cristian Grozea, Håkan Kjellerstrand, Oisín Mac Fhearaí

TL;DR

The paper investigates Picat as a practical, declarative tool for solving Advent of Code 2024 problems, emphasizing its SAT-based constraint solving and tabling capabilities. It presents five case studies—Day 23 (LAN Party), Day 17 (Chronospatial Computer), Day 24 (Crossed Wires), Day 16 (Reindeer Maze), and Day 21 (Keypad Conundrum)—each encoded to showcase method-specific advantages, from constraint satisfaction to dynamic programming and planning. Across these studies, the authors demonstrate concise, expressive encodings that achieve competitive results, with notable successes in problem areas like reverse engineering, circuit repair, and multi-layer planning. The work underlines Picat’s practical relevance for formal-method-like tasks and planning problems, while acknowledging areas where traditional optimizations or specialized algorithms may outperform the declarative approach in raw speed.

Abstract

Picat is a logic-based, multi-paradigm programming language that integrates features from logic, functional, constraint, and imperative programming paradigms. This paper presents solutions to several problems from the 2024 Advent of Code (AoC). While AoC problems are not designed for any specific programming language, certain problem types, such as reverse engineering and path-finding, are particularly well-suited to Picat due to its built-in constraint solving, pattern matching, backtracking, and dynamic programming with tabling. This paper demonstrates that Picat's features, especially its SAT-based constraint solving and tabling, enable concise, declarative, and highly efficient implementations of problems that would require significantly more effort in imperative languages.

Picat Through the Lens of Advent of Code

TL;DR

The paper investigates Picat as a practical, declarative tool for solving Advent of Code 2024 problems, emphasizing its SAT-based constraint solving and tabling capabilities. It presents five case studies—Day 23 (LAN Party), Day 17 (Chronospatial Computer), Day 24 (Crossed Wires), Day 16 (Reindeer Maze), and Day 21 (Keypad Conundrum)—each encoded to showcase method-specific advantages, from constraint satisfaction to dynamic programming and planning. Across these studies, the authors demonstrate concise, expressive encodings that achieve competitive results, with notable successes in problem areas like reverse engineering, circuit repair, and multi-layer planning. The work underlines Picat’s practical relevance for formal-method-like tasks and planning problems, while acknowledging areas where traditional optimizations or specialized algorithms may outperform the declarative approach in raw speed.

Abstract

Picat is a logic-based, multi-paradigm programming language that integrates features from logic, functional, constraint, and imperative programming paradigms. This paper presents solutions to several problems from the 2024 Advent of Code (AoC). While AoC problems are not designed for any specific programming language, certain problem types, such as reverse engineering and path-finding, are particularly well-suited to Picat due to its built-in constraint solving, pattern matching, backtracking, and dynamic programming with tabling. This paper demonstrates that Picat's features, especially its SAT-based constraint solving and tabling, enable concise, declarative, and highly efficient implementations of problems that would require significantly more effort in imperative languages.

Paper Structure

This paper contains 8 sections, 2 equations, 1 figure.

Figures (1)

  • Figure 1: The numeric (left) and directional (right) keypads.