{"id":51032926,"url":"https://github.com/marinaa13/sat-solver-haskell","last_synced_at":"2026-06-22T02:33:08.798Z","repository":{"id":319703431,"uuid":"1079379026","full_name":"marinaa13/sat-solver-haskell","owner":"marinaa13","description":"Functional SAT solver in Haskell implementing DPLL and CDCL strategies, with applications to the 3-coloring problem. Features lazy evaluation, clause learning, and non-chronological backtracking","archived":false,"fork":false,"pushed_at":"2025-10-19T17:36:12.000Z","size":14,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-10-20T01:05:57.223Z","etag":null,"topics":["functional-programming","graph-coloring","haskell","logic","np-complete","sat-solver"],"latest_commit_sha":null,"homepage":"","language":"Haskell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/marinaa13.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-10-19T17:31:02.000Z","updated_at":"2025-10-19T17:36:16.000Z","dependencies_parsed_at":"2025-10-20T01:19:16.337Z","dependency_job_id":null,"html_url":"https://github.com/marinaa13/sat-solver-haskell","commit_stats":null,"previous_names":["marinaa13/sat-solver-haskell"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/marinaa13/sat-solver-haskell","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marinaa13%2Fsat-solver-haskell","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marinaa13%2Fsat-solver-haskell/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marinaa13%2Fsat-solver-haskell/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marinaa13%2Fsat-solver-haskell/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/marinaa13","download_url":"https://codeload.github.com/marinaa13/sat-solver-haskell/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marinaa13%2Fsat-solver-haskell/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34632705,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-22T02:00:06.391Z","response_time":106,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["functional-programming","graph-coloring","haskell","logic","np-complete","sat-solver"],"created_at":"2026-06-22T02:33:08.291Z","updated_at":"2026-06-22T02:33:08.790Z","avatar_url":"https://github.com/marinaa13.png","language":"Haskell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SAT Solver in Haskell\n\nA complete **functional SAT solver** implemented in Haskell, inspired by the DPLL and CDCL algorithms.  \nThe project models Boolean formulas in Conjunctive Normal Form (CNF), implements progressively optimized solving techniques, and applies the solver to the **3-coloring problem** in graphs.\n\n---\n\n## Overview\nThe project explores the problem of **Boolean satisfiability (SAT)** using the functional paradigm of Haskell.  \nIt develops from basic formula representation and naive solving by enumeration to advanced strategies like unit propagation, pure literal elimination, conflict-driven clause learning, and non-chronological backtracking.\n\n**Language:** Haskell  \n**Focus:** Functional programming, lazy evaluation, type systems, recursion, and declarative problem-solving  \n\n---\n\n## Features\n\n### 1. Boolean Formula Representation\nImplemented in `Formula.hs`, this component defines:\n- **Data structures** for literals, clauses, and formulas using sets (`Data.Set`)\n- **Basic operations** for creating and manipulating CNF formulas\n- **Naive SAT checking** via interpretation enumeration\n- **Functional style** implementations using list/set comprehensions and higher-order functions  \n\n### 2. Extended Formula Evaluation\nImplemented in `ExtendedFormula.hs`, extending the solver to support:\n- **Formula simplification** after assumptions  \n  - Clause removal when a literal is satisfied  \n  - Complement elimination from remaining clauses  \n- **Unit clause propagation** for automatic assignments  \n- **Pure literal elimination** for deterministic simplifications  \n- **Mapping formulas** to associative structures (`Data.Map`) to retain links between simplified and original clauses  \n- **Recursive and functional transformations** for formula reduction without explicit mutation  \n\n### 3. Complete SAT Solver\nImplemented in `Solver.hs`, integrating all mechanisms into a full DPLL/CDCL-style solver:\n- **Unit propagation** and **pure literal elimination** loops  \n- **Backtracking and conflict resolution**\n  - Detection of conflicts through empty clauses  \n  - Clause learning using **resolution**  \n  - **Non-chronological backtracking** to earliest decision points\n- **Heuristic literal selection** for branching  \n- **Learned clause integration** to avoid repeating conflicts  \n\n### 4. Application: Graph 3-Coloring\nThe solver is applied to encode and solve the **graph 3-coloring problem**:\n- Each node is assigned three Boolean variables (for Red, Green, Blue)\n- Clauses ensure:\n  - Each node has **at least one color**\n  - Each node has **at most one color**\n  - Adjacent nodes have **different colors**\n- The solver determines a satisfying assignment representing a valid coloring.\n\n---\n\n## Example Use Cases\n- Verify whether a CNF formula is satisfiable and obtain a satisfying interpretation.  \n- Simplify formulas dynamically during solving.  \n- Learn new clauses from conflicts to optimize search.  \n- Use SAT solving to compute valid **graph colorings**.\n\n---\n\n## Learning Outcomes\n- Built a complete **SAT solver** purely in Haskell using functional constructs.  \n- Practiced **lazy evaluation**, **pattern matching**, **algebraic data types**, and **higher-order functions**.  \n- Applied **polymorphism**, **type abstraction**, and **monadic evaluation** in a declarative context.  \n- Translated a theoretical **NP-complete problem** into a structured, functional implementation.  \n\n---\n\n## Project Structure\n| File | Description |\n|------|--------------|\n| `Formula.hs` | Basic Boolean formula representation and naive SAT checking. |\n| `ExtendedFormula.hs` | Formula simplification, unit propagation, and pure literal elimination. |\n| `Solver.hs` | Full CDCL-based SAT solver with conflict analysis and backtracking. |\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarinaa13%2Fsat-solver-haskell","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarinaa13%2Fsat-solver-haskell","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarinaa13%2Fsat-solver-haskell/lists"}