Pure, declarative, and constructive arithmetic relations (declarative pearl)

被引:0
|
作者
Kiselyov, Oleg
Byrd, William E.
Friedman, Daniel P.
Shan, Chung-Chieh
机构
来源
FUNCTIONAL AND LOGIC PROGRAMMING | 2008年 / 4989卷
关键词
D O I
暂无
中图分类号
TP301 [理论、方法];
学科分类号
081202 ;
摘要
We present decidable logic programs for addition, multiplication, division with remainder, exponentiation, and logarithm with remainder over the unbounded domain of natural numbers. Our predicates represent relations without mode restrictions or annotations. They are fully decidable under the common, DFS-like, SLD resolution strategy of Prolog or under an interleaving refinement of DFS. We prove that the evaluation of our arithmetic goals always terminates, given arguments that share no logic variables. Further, the (possibly infinite) set of solutions for a goal denotes exactly the corresponding mathematical relation. (For SLD without interleaving, and for some infinite solution sets, only half of the relation's domain may be covered.) We define predicates to handle unary (for illustration) and binary representations of natural numbers, and prove termination and completeness of these predicates. Our predicates are written in pure Prolog, without cut (!), var/1, or other non-logical operators. The purity and minimalism of our approach allows us to declare arithmetic in other logic systems, such as Haskell type classes.
引用
收藏
页码:64 / 80
页数:17
相关论文
共 50 条
  • [41] A declarative debugger for Maude
    Riesco, Adrian
    Verdejo, Alberto
    Marti-Oliet, Narciso
    Caballero, Rafael
    ALGEBRAIC METHODOLOGY AND SOFTWARE TECHNOLOGY, PROCEEDINGS, 2008, 5140 : 116 - 121
  • [42] Declarative Fence Insertion
    Bender, John
    Lesani, Mohsen
    Palsberg, Jens
    ACM SIGPLAN NOTICES, 2015, 50 (10) : 367 - 385
  • [43] Declarative Probabilistic Programming
    Aref, Molham
    KI 2015: ADVANCES IN ARTIFICIAL INTELLIGENCE, 2015, 9324 : XIII - XIII
  • [44] THE MEASUREMENT OF DECLARATIVE KNOWLEDGE
    DACIN, PA
    MITCHELL, AA
    ADVANCES IN CONSUMER RESEARCH, 1986, 13 : 454 - 459
  • [45] Declarative Choreographies and Liveness
    Hildebrandt, Thomas T.
    Slaats, Tijs
    Lopez, Hugo A.
    Debois, Soren
    Carbone, Marco
    FORMAL TECHNIQUES FOR DISTRIBUTED OBJECTS, COMPONENTS, AND SYSTEMS (FORTE 2019), 2019, 11535 : 129 - 147
  • [46] Declarative programming revisited
    Swaine, M
    DR DOBBS JOURNAL, 2000, 25 (08): : 113 - 117
  • [47] The declarative side of magic
    Mascellani, Paolo
    Pedreschi, Dino
    Lecture Notes in Computer Science (including subseries Lecture Notes in Artificial Intelligence and Lecture Notes in Bioinformatics), 2002, 2408 (PART2): : 83 - 108
  • [48] Declarative debugging with Buddha
    Pope, B
    ADVANCED FUNCTIONAL PROGRAMMING, 2004, 3622 : 273 - 308
  • [49] DECLARATIVE ERROR DIAGNOSIS
    LLOYD, JW
    NEW GENERATION COMPUTING, 1987, 5 (02) : 133 - 154
  • [50] Form-Meaning Relations in Russian Confirmative and Surprise Declarative Questions
    Munteanu, Andrei
    Kiss, Angelika
    LANGUAGE AND SPEECH, 2025,