HackerPapers

arXiv:1607.01590cs.PL

Indexing dif/2

Ulrich Neumerkel, Stefan Kral

Abstract

Many Prolog programs are unnecessarily impure because of inadequate means to express syntactic inequality. While the frequently provided built-in `dif/2` is able to correctly describe expected answers, its direct use in programs often leads to overly complex and inefficient definitions --- mainly due to the lack of adequate indexing mechanisms. We propose to overcome these problems by using a new predicate that subsumes both equality and inequality via reification. Code complexity is reduced with a monotonic, higher-order if-then-else construct based on `call/N`. For comparable correct uses of impure definitions, our approach is as determinate and similarly efficient as its impure counterparts.

arXiv comments
Journal reference
DOI
Subjects
cs.PLProgramming Languages

On Hacker News

Linked by 3 identifiable commenters in 4 comments across 4 threads, from May 2017 to Dec 2022. Found in 1 HN submission from May 2018 to May 2018. Open submission discussions.

Comments linking this paper, per year.

Discussed in comments4 threads

  1. Prolog at Work 1 comment
    • These are valid concerns, arising mostly from inadequate implementations and a lack of modern features in early (and also current) Prolog systems. In the past 20 years, many new language constructs and implementation improvements were introduced and have become widely available…

      triskaView on HNParent context

    • That's super cool. I'm definitely not an expert on the subject but this paper about dif/2 intrigues me: https://arxiv.org/abs/1607.01590 And perhaps Ciao's paper could offer some hints? http://cliplab.org/papers/hermenegildo11:ciao-design-tplp.pd... You're probably already aware…

      groseView on HNParent context

  2. Swish: SWI Prolog Notebook 1 comment
    • In general, using any of the mentioned predicates (->)/2, (\+)/1 or !/0 in Prolog code destroys essential properties we expect from classical logic, and therefore complicates declarative reasoning about the code to such an extent that it can be said to prevent it entirely. For…

      triskaView on HNParent context

    • Have you been exposed to more recent research on Prolog language constructs? In particular, I recommend the following publication: https://arxiv.org/abs/1607.01590 if_/3 and other declarative predicates like dif/2 are more general alternatives and likely good solutions in the…

      zmonxView on HNParent context

Submitted to Hacker News

Connected through shared HN threads, not inferred similarity or a recommendation.