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

被引:0
|
作者
Kiselyov, Oleg
Byrd, William E.
Friedman, Daniel P.
Shan, Chung-Chieh
机构
来源
关键词
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 LANGUAGE - SNARK
    LAURIERE, JL
    TSI-TECHNIQUE ET SCIENCE INFORMATIQUES, 1986, 5 (03): : 141 - 172
  • [42] Declarative Smart Contracts
    Chen, Haoxian
    Whitters, Gerald
    Amiri, Mohammad Javad
    Wang, Yuepeng
    Loo, Boon Thau
    PROCEEDINGS OF THE 30TH ACM JOINT MEETING EUROPEAN SOFTWARE ENGINEERING CONFERENCE AND SYMPOSIUM ON THE FOUNDATIONS OF SOFTWARE ENGINEERING, ESEC/FSE 2022, 2022, : 281 - 293
  • [43] DECLARATIVE CONTROL ARCHITECTURE
    KOHN, W
    COMMUNICATIONS OF THE ACM, 1991, 34 (08) : 64 - 79
  • [44] Optimizing Declarative Sensornets
    Chu, David
    Hellerstein, Joseph M.
    Lai, Tsung-te
    SENSYS'08: PROCEEDINGS OF THE 6TH ACM CONFERENCE ON EMBEDDED NETWORKED SENSOR SYSTEMS, 2008, : 403 - 404
  • [45] Learning declarative bias
    Bridewell, Will
    Todorovski, Ljupco
    INDUCTIVE LOGIC PROGRAMMING, 2008, 4894 : 63 - 77
  • [46] Methods of Declarative Psychology
    Plaut, Paul
    ARCHIV FUR DIE GESAMTE PSYCHOLOGIE, 1934, 91 (3-4): : 564 - 565
  • [47] Declarative agent control
    Kakas, A
    Mancarella, P
    Sadri, F
    Stathis, K
    Toni, F
    COMPUTATIONAL LOGIC IN MULTI-AGENT SYSTEMS, 2004, 3487 : 96 - 110
  • [48] Deep Declarative Networks
    Gould, Stephen
    Hartley, Richard
    Campbell, Dylan John
    IEEE TRANSACTIONS ON PATTERN ANALYSIS AND MACHINE INTELLIGENCE, 2022, 44 (08) : 3988 - 4004
  • [49] Declarative Software Development
    Laemmel, Ralf
    Varanovich, Andrei
    Leinberger, Martin
    Schmorleiz, Thomas
    Favre, Jean-Marie
    PPDP'14: PROCEEDINGS OF THE 16TH INTERNATIONAL SYMPOSIUM ON PRINCIPLES AND PRACTICE OF DECLARATIVE PROGRAMMING, 2014, : 1 - 6
  • [50] DECLARATIVE VISUAL LANGUAGES
    BURNETT, MM
    AMBLER, AL
    JOURNAL OF VISUAL LANGUAGES AND COMPUTING, 1994, 5 (01): : 1 - 3