Lune

PLDI2022Top-tier venue

Karp: a language for NP reductions

Chenhao Zhang, Jason D. Hartline, Christos Dimoulas

Abstract

In CS theory courses, NP reductions are a notorious source of pain for students and instructors alike. Invariably, students use pen and paper to write down reductions that łworkž in many but not all cases. When instructors observe that a student's reduction deviates from the expected one, they have to manually compute a counterexample that exposes the mistake. In other words, NP reductions are subtle yet, most of the time, unimplemented programs. And for a good reason: there exists no language tailored to NP reductions.

We introduce Karp, a language for programming and testing NP reductions. Karp combines an array of programming languages techniques: language-oriented programming and macros, solver-aided languages, property testing, higherorder contracts and gradual typing. To validate the correctness of Karp, we prove that its core is well-defined. To validate its pragmatics, we demonstrate that it is expressive and performant enough to handle a diverse set of reduction exercises from a popular algorithms textbook. Finally, we report the results from a preliminary user study with Karp.

Ask Lune

Know this paper in minutes, not an afternoon.

Lune can read every page of it and the top-tier papers that cite it, and gives you its claims, its evidence and its limits, each one cited to the paper it comes from. No skimming, no AI slop.

1 top-tier paper has cited it since. Know what they found before your reviewers do.

Questions to start from

Lune can draw on

the full paper · the top-tier papers that cite it · related work

Get the answer

Free to start. No credit card required.

Lineage

Builds onCited byLeft to right by year; the more cited, the higher.

Cited by top-tier papers1

  1. Detecting and Explaining (In-)equivalence of Context-Free GrammarsMarko Schmellenkamp, Thomas Zeume, Sven Argo, Sandra Kiefer et al.OOPSLA 2025 · 2 citations

Builds on1

  1. A formal foundation for symbolic evaluation with mergingSorawee Porncharoenwase, Luke Nelson, Xi Wang, Emina TorlakPOPL 2022 · 13 citations

Related papers

  1. On the Complexity of Checking Soundness of Natural ReductionsConstantin Enea, Azadeh Farzan, Dominik KlumppCAV 2026
  2. Corpse reviver: sound and efficient gradual typing via contract verificationCameron Moy, Phuc C. Nguyen, Sam Tobin-Hochstadt, David Van HornPOPL 2021 · 16 citations
  3. Reductions for safety proofsAzadeh Farzan, Anthony VandikasPOPL 2020 · 21 citations
  4. Student-Teacher Constructive Separations and (Un)Provability in Bounded Arithmetic: Witnessing the GapStefan Grosser, Marco CarmosinoSTOC 2025 · 3 citations
  5. A systematic approach to deriving incremental type checkersAndré Pacak, Sebastian Erdweg, Tamás SzabóOOPSLA 2020 · 16 citations
Dusk over the sea between two cliffs drawn in fine vertical lines