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 条
  • [31] Declarative Network Verification
    Wang, Anduo
    Basu, Prithwish
    Loo, Boon Thau
    Sokolsky, Oleg
    PRACTICAL ASPECTS OF DECLARATIVE LANGUAGES, 2009, 5418 : 61 - +
  • [32] SEMANTICS OF A DECLARATIVE LANGUAGE
    MINTS, G
    TYUGU, E
    INFORMATION PROCESSING LETTERS, 1986, 23 (03) : 147 - 151
  • [33] WHAT IS DECLARATIVE PROGRAMMING
    VORONKOV, AA
    LECTURE NOTES IN ARTIFICIAL INTELLIGENCE, 1991, 567 : 394 - 398
  • [34] DECLARATIVE SOURCE DEBUGGING
    CALEJO, M
    PEREIRA, LM
    LECTURE NOTES IN ARTIFICIAL INTELLIGENCE, 1991, 541 : 237 - 249
  • [35] ON THE DEVELOPMENT OF DECLARATIVE MEMORY
    MCKEE, RD
    SQUIRE, LR
    JOURNAL OF EXPERIMENTAL PSYCHOLOGY-LEARNING MEMORY AND COGNITION, 1993, 19 (02) : 397 - 404
  • [36] Are declarative sentences representational?
    Donaho, S
    MIND, 1998, 107 (425) : 33 - 58
  • [37] Declarative Scripting in Haskell
    Bauer, Tim
    Erwig, Martin
    SOFTWARE LANGUAGE ENGINEERING, 2010, 5969 : 294 - 313
  • [38] On the declarative specification of models
    Spinellis, D
    IEEE SOFTWARE, 2003, 20 (02) : 96 - +
  • [39] A Framework for Declarative Autograders
    Hovemeyer, David
    PROCEEDINGS OF THE 54TH ACM TECHNICAL SYMPOSIUM ON COMPUTER SCIENCE EDUCATION, VOL 2, SIGCSE 2023, 2023, : 1282 - 1282
  • [40] Declarative Game Programming
    Nilsson, Henrik
    Perez, Ivan
    PPDP'14: PROCEEDINGS OF THE 16TH INTERNATIONAL SYMPOSIUM ON PRINCIPLES AND PRACTICE OF DECLARATIVE PROGRAMMING, 2014, : 159 - 160