Relational Cost Analysis

被引:33
作者
Cicek, Ezgi [1 ]
Barthe, Gilles [2 ]
Gaboardi, Marco [3 ]
Garg, Deepak [1 ]
Hoffmann, Jan [4 ]
机构
[1] MPI SWS, Kaiserslautern, Germany
[2] IMDEA Software Inst Spain, Madrid, Spain
[3] Univ Buffalo State Univ New York, Buffalo, NY USA
[4] Carnegie Mellon Univ, Pittsburgh, PA 15213 USA
基金
美国国家科学基金会;
关键词
Relational reasoning; complexity analysis; type and effect systems; INFORMATION-FLOW; MODEL;
D O I
10.1145/3093333.3009858
中图分类号
TP31 [计算机软件];
学科分类号
081202 ; 0835 ;
摘要
Establishing quantitative bounds on the execution cost of programs is essential in many areas of computer science such as complexity analysis, compiler optimizations, security and privacy. Techniques based on program analysis, type systems and abstract interpretation are well-studied, but methods for analyzing how the execution costs of two programs compare to each other have not received attention. Naively combining the worst and best case execution costs of the two programs does not work well in many cases because such analysis forgets the similarities between the programs or the inputs. In this work, we propose a relational cost analysis technique that is capable of establishing precise bounds on the difference in the execution cost of two programs by making use of relational properties of programs and inputs. We develop Rel Cost, a refinement type and effect system for a higher-order functional language with recursion and subtyping. The key novelty of our technique is the combination of relational refinements with two modes of typing-relational typing for reasoning about similar computations/inputs and unary typing for reasoning about unrelated computations/inputs. This combination allows us to analyze the execution cost difference of two programs more precisely than a naive non-relational approach. We prove our type system sound using a semantic model based on step-indexed unary and binary logical relations accounting for non-relational and relational reasoning principles with their respective costs. We demonstrate the precision and generality of our technique through examples.
引用
收藏
页码:316 / 329
页数:14
相关论文
共 48 条
  • [1] Ahmed A, 2006, LECT NOTES COMPUT SC, V3924, P69
  • [2] Termination and Cost Analysis with COSTA and its User Interfaces
    Albert, E.
    Arenas, P.
    Genaim, S.
    Gomez-Zamalloa, M.
    Puebla, G.
    Ramirez, D.
    Roman, G.
    Zanardini, D.
    [J]. ELECTRONIC NOTES IN THEORETICAL COMPUTER SCIENCE, 2009, 258 (01) : 109 - 121
  • [3] A logic for information flow in object-oriented programs
    Amtoft, T
    Bandhakavi, S
    Banerjee, A
    [J]. ACM SIGPLAN NOTICES, 2006, 41 (01) : 91 - 102
  • [4] [Anonymous], 2010, Proceedings of the FSE/SDP Workshop on Future of Software Engineering Research FOSER
  • [5] An indexed model of recursive types for foundational proof-carrying code
    Appel, AW
    McAllester, D
    [J]. ACM TRANSACTIONS ON PROGRAMMING LANGUAGES AND SYSTEMS, 2001, 23 (05): : 657 - 683
  • [6] Atkey R, 2010, LECT NOTES COMPUT SC, V6012, P85, DOI 10.1007/978-3-642-11957-6_6
  • [7] Barthe Gilles, 2011, FM 2011: Formal Methods. Proceedings 17th International Symposium on Formal Methods, P200, DOI 10.1007/978-3-642-21437-0_17
  • [8] Barthe G, 2015, ACM SIGPLAN NOTICES, V50, P55, DOI [10.1145/2775051.2677000, 10.1145/10.1145/2676726.2677000]
  • [9] Probabilistic Relational Verification for Cryptographic Implementations
    Barthe, Gilles
    Fournet, Cedric
    Gregoire, Benjamin
    Strub, Pierre-Yves
    Swamy, Nikhil
    Zanella-Beguelin, Santiago
    [J]. ACM SIGPLAN NOTICES, 2014, 49 (01) : 193 - 205
  • [10] Simple relational correctness proofs for static analyses and program transformations
    Benton, N
    [J]. ACM SIGPLAN NOTICES, 2004, 39 (01) : 14 - 25