<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta />
    <article-meta>
      <title-group>
        <article-title>LFSC for SMT Proofs: Work in Progress</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Aaron Stump</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Andrew Reynolds</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Cesare Tinelli</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Austin Laugesen</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Harley Eades</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Corey Oliver</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Ruoyu Zhang</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>The University of Iowa</institution>
          ,
          <country country="US">USA</country>
        </aff>
      </contrib-group>
      <pub-date>
        <year>2012</year>
      </pub-date>
      <fpage>21</fpage>
      <lpage>27</lpage>
      <abstract>
        <p>This paper presents work in progress on a new version, for public release, of the Logical Framework with Side Conditions (LFSC), previously proposed as a proof meta-format for SMT solvers and other proof-producing systems. The paper reviews the type-theoretic approach of LFSC, presents a new input syntax which hides the type-theoretic details for better accessibility, and discusses work in progress on formalizing and implementing a revised core language.</p>
      </abstract>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>-</title>
      <p>formulas
contexts
2
`
::=
::=
p j 1 !
j ;
2</p>
    </sec>
    <sec id="sec-2">
      <title>Assump</title>
      <p>
        ; (p ! (q ! r)); q; p ` q
rules for the SMT-LIB logics QF IDL and QF LRA, and showed how to use type computation
for LFSC to compute interpolants [
        <xref ref-type="bibr" rid="ref10 ref9">10, 9</xref>
        ]. Optimized LFSC proof checking is quite e cient
relative to solving time: for QF UF benchmarks we found a total average overhead of 30% for
proof generation and checking (together) over and above solving alone.
      </p>
      <p>We are now focusing on providing a high-quality implementation of LFSC for public release.
It is our hope that the availability of such an implementation will be the nal step which will
enable solver implementors to adopt LFSC as a single, semantics-based meta-format for SMT
proofs. In the rest of this short paper, we describe our work in progress towards this vision,
which consists of devising a more accessible input syntax (Section 2) and formalizing a new core
language which is able to accommodate features like local de nitions and implicit arguments
(Section 3), which we found to be important in practice but which are often not considered in
standard treatments of LF.</p>
      <p>We would like to acknowledge also the contributions of Jed McClurg and Cuong Thai to
earlier work on this new version of LFSC.
2</p>
      <p>A Surface Syntax Based on Grammars and Rules
LF and LFSC are meta-languages based on a dependent type theory. The methodology for
using LF/LFSC is to encode object-language constructs using dependently typed data
constructors in LF/LFSC. If used directly, this requires unfamiliar type-theoretic notation and
conceptualization, a burden we do not wish to impose on SMT solver implementors.</p>
      <p>
        To illustrate these points, let us consider an example proof system in standard mathematical
notation. Figure 1 shows the syntax and inference rules of minimal propositional logic. As our
proposed syntax for side-condition code has not changed fundamentally, we are deliberately
restricting our attention here to a signature without side conditions. For more on side-condition
code in LFSC, including examples for a resolution calculus, see [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ].
      </p>
      <p>In the LF methodology, a proof system like the one in Figure 1 is encoded as a sequence
of type declarations called a signature. The syntactic categories, here Formula and Context,
are encoded as types, whose syntactic constructs are encoded as constructors of those types.
formula : Type
imp : formula ! formula ! formula
holds : formula ! Type
ImpIntro : f1 : formula: f2 : formula:((holds f1) ! (holds f2)) ! (holds (imp f1 f2))
ImpElim : f1 : formula: f2 : formula:(holds (imp f1 f2)) ! (holds f1) ! (holds f2)</p>
    </sec>
    <sec id="sec-3">
      <title>ImpIntro (imp p (imp q r)) (imp q (imp p r)) u:ImpIntro q (imp p r) v:ImpIntro p r w:ImpElim q r (ImpElim p (imp q r) u w) v</title>
      <p>The judgments of the proof system are also encoded as types, with the inference rules as
constructors. Object-language variables are represented with meta-language variables,
objectlanguage binders with LF's -binder, and logical contexts (like in this example) with the LF
typing context.</p>
      <p>
        Figure 2 shows the corresponding signature in standard type-theoretic notation for LF. The
Assump rule does not have a constructor, because assumptions in the object language have
been mapped to variables in LF. For the example proof, the -bound variables u, v, and w
correspond to the assumptions of p ! (q ! r), q, and p, respectively. Since inference rules
are encoded using term constructors with dependent types ( types), there is rather a lot
of redundant information in that encoded example proof. Implementations of LF like Twelf
allow one to omit some of these arguments in some cases, if they can be inferred from other
parts of the proof term [
        <xref ref-type="bibr" rid="ref7">7</xref>
        ]. In our rst implementation of LFSC, we allowed proofs to contain
underscores for omitted arguments, which we then sought to reconstruct in a similar way to
what is done in Twelf.
      </p>
      <p>
        We are designing a surface language for LFSC, intended to rely on the more familiar concepts
of context-free grammars for describing syntax, and more familiar notation for inference rules,
as is done in tools like Ott (and others) [
        <xref ref-type="bibr" rid="ref11">11</xref>
        ]. Using this surface language, our sample signature is
encoded as in Figure 3. The ImpIntro rule uses square brackets and a turnstile for hypothetical
reasoning; in this case, to represent the fact that holds f2 is to be proved under the assumption
of holds f1. We use root names like f for formula to avoid specifying types for meta-variables
in the rules. Root names are speci ed when a syntactic category is de ned. The example proof
term is similar to the one in Figure 2, except that arguments which an analysis determines can
be reconstructed can be omitted. De ning this analysis is still work in progress, but in this
case, it will determine that of the meta-variables used in the ImpIntro and ImpElim rules, only
f1 needs a value in order to guarantee that the types computed for terms are fully instantiated
(that is, without free meta-variables). The bene ts of omitting arguments in dependently typed
languages are well known: notice how much more compact the example proof term is without
values for the meta-variables f2 for ImpIntro and f1 and f2 for ImpElim.
      </p>
      <p>For encoding SMT logics, we made use, in our previous proposals, of LF type-checking to
implement SMT type-checking of SMT terms contained in proofs. This is done in a standard
way by using an indexed type term T to represent SMT terms which have (encoded) SMT type
T. Our new surface syntax also supports indexed syntactic categories. For example, Figure 4</p>
      <p>SYNTAX
formula f ::= imp f1 f2 .</p>
      <p>JUDGMENTS
(holds f)
RULES
[ holds f1 ] |- holds f2
----------------------------- ImpIntro
holds (imp f1 f2) .
holds (imp f1 f2) , holds f1
----------------------------- ImpElim
holds f2 .</p>
      <p>ImpIntro (imp p (imp q r))
u. ImpIntro q
v. ImpIntro p
w. ImpElim (ImpElim u w) v
gives part of a signature for a minimal SMT theory. This syntax de nition indexes the syntactic
category term by the syntactic category sort. Everywhere a meta-variable for terms is used, it
must be listed with its sort. Similarly, the de nitions of constructors show the resulting indices.
For example, since equality is sort-polymorphic, we see that its meta-variables are indexed by
(the same) sort s, while its resulting sort is indicated as bool. This example also demonstrates
our surface syntax for binding, namely ^, in the declaration of forall. This notation means
that forall binds a variable ranging over terms of sort s, and then has a body which must be
a term of sort bool.</p>
      <p>As a nal example of the new syntax, Figure 5 shows the LFSC encodings of SMT rules
for universal quanti ers. The rules are complicated somewhat by the need to express the sort
information for terms. The rst rule uses the ^ binding notation to indicate a parametric
t&lt;s&gt; ^ holds f { t&lt;s&gt; }
--------------------------------- all_intro
holds (forall t&lt;s&gt; ^ f{t&lt;s&gt;} ).
holds (forall t&lt;s&gt; ^ f { t&lt;s&gt; } )
----------------------------------- all_elim
holds f{t&lt;s&gt;} .
judgment in the premise: to apply all_intro, we must supply a proof of holds f{t&lt;s&gt;}
for an arbitrary term t of sort s. The fact that the term is arbitrary is indicated by the
use of ^ in the premise. We also see a notation for expression contexts, using curly braces.
Any meta-variable can be used as a context variable, although if that meta-variable is from
an indexed syntactic category, the result index must also be shown. Here, we make use of a
de ned syntactic category of formulas, so that no result sort need be listed for meta-variable f.
All these di erent binding concepts (expression contexts, parametric proofs, and hypothetical
proofs) are ultimately implemented with just the single -binder of LF. But for the surface
language, our common informal meta-language tends to distinguish them, and so we follow
that approach in our surface language.
3</p>
      <sec id="sec-3-1">
        <title>Improving the Core Language</title>
        <p>
          While the surface language distinguishes syntactic constructs and proof rules, LF elegantly
unites them (under encoding) as just term constructors for possibly indexed datatypes. So
both for conciseness and to give a semantics for the di erent features sketched above, we are
working to compile signatures from our surface language to a core language for LFSC, which
we are specifying formally with the help of the Ott tool [
          <xref ref-type="bibr" rid="ref11">11</xref>
          ]. We are addressing a number of
issues important for practical use of LF/LFSC for large proofs:
        </p>
        <p>We have explicit syntax to indicate which arguments to term constructors are implicit
and which are explicit.</p>
        <p>We are devising an algorithm to ensure that all higher-order implicit arguments (which
our surface language limits to second order) can be automatically reconstructed during
proof checking. Other approaches simply delay constraints falling outside the decidable
higher-order pattern fragment in the hopes of not needing to solve them.</p>
        <p>In general, we only intend to execute side-condition code on concrete terms. So we are
designing the language to help ensure that as much as statically possible, the arguments
to side condition programs do not contain meta-variables for omitted implicit arguments.
Such meta-variables can be lled in by type checking, but not during execution of
sidecondition code.</p>
        <p>We have support for global and local de nitions, both of which are incorporated into
de nitional equality. Some other treatments of LF do not handle de nitions at all, but
these are essential for keeping proof sizes down.
sample.sig</p>
        <sec id="sec-3-1-1">
          <title>Surface LFSC</title>
          <p>sample.core sig</p>
        </sec>
        <sec id="sec-3-1-2">
          <title>Core LFSC</title>
          <p>sample.pf</p>
        </sec>
        <sec id="sec-3-1-3">
          <title>C++ checker for sample.sig</title>
        </sec>
        <sec id="sec-3-1-4">
          <title>Pass: pf valid</title>
        </sec>
        <sec id="sec-3-1-5">
          <title>Fail: pf invalid</title>
          <p>Since we use de nitions, we cannot so easily make use of the so-called \canonical forms"
version of LF, where all terms are assumed to be in -short -long normal form:
applications of de ned symbols can be redexes. Instead, we are formulating a system with
explicit de nitional equality, which can also ll in implicit arguments.</p>
          <p>We retain support for compiling proof rules to e cient low-level (C/C++) code by
avoiding explicit substitutions in our formalization. Meta-level substitutions will be carried out
directly in code emitted by the compiler, so using explicit substitutions merely obscures
what will happen in compiled code.</p>
          <p>We are designing the language for side-condition programs to respect dependent typing of
terms. This does not require implementing a full-blown dependently typed programming
language, because indices to types can only contain terms which normalize to constructor
terms. (In contrast, in dependently typed programming, indices can include terms with
recursion.)</p>
          <p>While none of these features is terribly complex, designing detailed typing rules that
accommodate them all simultaneously has taken time. For example, we are implementing a
requirement that all omitted arguments to a term constructor C must be reconstructed by the
time we complete the type checking of an application of C. For this, we constrain the syntax of
types for term constructors so that implicit arguments are listed rst, then explicit arguments
and possible invocations of side-condition code, and nally a possibly indexed result type.
4</p>
        </sec>
      </sec>
      <sec id="sec-3-2">
        <title>Status and Conclusion</title>
        <p>Figure 6 shows the architecture for the LFSC system we are currently implementing. A sample
signature sample.sig in the surface syntax discussed above is translated to a core-language
signature sample.core sig, which is then compiled to C++ code optimized for checking proofs
in that signature. A sample proof sample.pf can then be fed to that checker, which reports
whether the proof passes (all inferences correct and all side conditions succeed) or fails.</p>
        <p>Co-author Corey Oliver has completed the translator for surface-language signature
(\Surface LFSC" in Figure 6). Co-author Austin Laugesen has completed implementation of the
compiler for side-condition code (part of LFSC core in Figure 6). This compiler translates the
LFSC side-condition language to C++, and supports both reference counting or regions for
managing memory allocated during execution of side-condition code. A preliminary evaluation
con rms the performance bene ts for this application of region-based memory management,
where all new memory is allocated from a single monolithic region of memory which can then
be reclaimed at once in constant time. Co-authors Harley Eades and Ruoyu Zhang have worked
with Aaron Stump on the design of the core language, which is almost complete. The rst three
co-authors have worked to devise the surface syntax, which is complete now. Implementation
of the core-language type checker and compiler (\Core LFSC" in Figure 6) in OCaml are just
beginning, and should be done Summer 2012. We expect to have an initial public release of
the tool in early Fall 2012. We hope that this release will be a decisive step in the quest for
a standard meta-format for SMT proofs, and will help the community continue its remarkable
success in providing high-performance, usable logic solvers for advanced applications in many
elds of Computer Science.</p>
      </sec>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          [1]
          <string-name>
            <given-names>C.</given-names>
            <surname>Barrett</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Stump</surname>
          </string-name>
          , and
          <string-name>
            <given-names>C.</given-names>
            <surname>Tinelli</surname>
          </string-name>
          .
          <source>The SMT-LIB Standard: Version 2.0</source>
          ,
          <year>2010</year>
          . available from www.
          <source>smtlib.org.</source>
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          [2]
          <string-name>
            <given-names>F.</given-names>
            <surname>Besson</surname>
          </string-name>
          ,
          <string-name>
            <given-names>P.</given-names>
            <surname>Fontaine</surname>
          </string-name>
          , and
          <string-name>
            <given-names>L.</given-names>
            <surname>Thry</surname>
          </string-name>
          .
          <article-title>A Flexible Proof Format for SMT: a Proposal</article-title>
          . In P. Fontaine and
          <string-name>
            <surname>A</surname>
          </string-name>
          . Stump, editors,
          <source>Workshop on Proof eXchange for Theorem Proving (PxTP)</source>
          ,
          <year>2011</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          [3]
          <string-name>
            <surname>Sascha</surname>
            <given-names>Bohme and Tjark</given-names>
          </string-name>
          <string-name>
            <surname>Weber</surname>
          </string-name>
          .
          <article-title>Fast LCF-style proof reconstruction for Z3</article-title>
          . In Matt Kaufmann and Lawrence Paulson, editors,
          <source>Interactive Theorem Proving</source>
          , volume
          <volume>6172</volume>
          of Lecture Notes in Computer Science, pages
          <volume>179</volume>
          {
          <fpage>194</fpage>
          . Springer,
          <year>2010</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          [4]
          <string-name>
            <given-names>J.</given-names>
            <surname>Chen</surname>
          </string-name>
          ,
          <string-name>
            <given-names>R.</given-names>
            <surname>Chugh</surname>
          </string-name>
          , and
          <string-name>
            <given-names>N.</given-names>
            <surname>Swamy</surname>
          </string-name>
          .
          <article-title>Type-preserving compilation of end-to-end veri cation of security enforcement</article-title>
          .
          <source>In Programming Language Design and Implementation (PLDI)</source>
          , pages
          <fpage>412</fpage>
          {
          <fpage>423</fpage>
          . ACM,
          <year>2010</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          [5]
          <string-name>
            <given-names>R.</given-names>
            <surname>Harper</surname>
          </string-name>
          ,
          <string-name>
            <given-names>F.</given-names>
            <surname>Honsell</surname>
          </string-name>
          , and
          <string-name>
            <given-names>G.</given-names>
            <surname>Plotkin. A Framework for De ning Logics</surname>
          </string-name>
          .
          <source>Journal of the Association for Computing Machinery</source>
          ,
          <volume>40</volume>
          (
          <issue>1</issue>
          ):
          <volume>143</volume>
          {
          <fpage>184</fpage>
          ,
          <year>January 1993</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          [6]
          <string-name>
            <given-names>D.</given-names>
            <surname>Oe</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Reynolds</surname>
          </string-name>
          ,
          <article-title>and</article-title>
          <string-name>
            <given-names>A.</given-names>
            <surname>Stump</surname>
          </string-name>
          .
          <article-title>Fast and Flexible Proof Checking for SMT</article-title>
          . In B. Dutertre and O. Strichman, editors,
          <source>International Workshop on Satis ability Modulo Theories</source>
          ,
          <year>2009</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          [7]
          <string-name>
            <given-names>F.</given-names>
            <surname>Pfenning</surname>
          </string-name>
          and
          <string-name>
            <surname>C.</surname>
          </string-name>
          <article-title>Schurmann. System Description: Twelf | A Meta-Logical Framework for Deductive Systems</article-title>
          .
          <source>In 16th International Conference on Automated Deduction</source>
          ,
          <year>1999</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          [8]
          <string-name>
            <given-names>S.</given-names>
            <surname>Ranise</surname>
          </string-name>
          and
          <string-name>
            <given-names>C.</given-names>
            <surname>Tinelli</surname>
          </string-name>
          .
          <source>The SMT-LIB Standard, Version 1.2</source>
          ,
          <year>2006</year>
          .
          <article-title>Available from the "Documents" section of http://www</article-title>
          .smtlib.org.
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          [9]
          <string-name>
            <given-names>Andrew</given-names>
            <surname>Reynolds</surname>
          </string-name>
          , Liana Hadarean, Cesare Tinelli, Yeting Ge, Aaron Stump, and
          <string-name>
            <given-names>Clark</given-names>
            <surname>Barrett</surname>
          </string-name>
          .
          <article-title>Comparing proof systems for linear real arithmetic with LFSC</article-title>
          . In A. Gupta and D. Kroening, editors,
          <source>International Workshop on Satis ability Modulo Theories</source>
          ,
          <year>2010</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          [10]
          <string-name>
            <given-names>Andrew</given-names>
            <surname>Reynolds</surname>
          </string-name>
          , Cesare Tinelli, and
          <string-name>
            <given-names>Liana</given-names>
            <surname>Hadarean</surname>
          </string-name>
          .
          <article-title>Certi ed interpolant generation for EUF</article-title>
          . In S. Lahiri and S. Seshia, editors,
          <source>International Workshop on Satis ability Modulo Theories</source>
          ,
          <year>2011</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref11">
        <mixed-citation>
          [11]
          <string-name>
            <given-names>Peter</given-names>
            <surname>Sewell</surname>
          </string-name>
          , Francesco Zappa Nardelli, Scott Owens, Gilles Peskine, Thomas Ridge, Susmit Sarkar, and
          <string-name>
            <given-names>Rok</given-names>
            <surname>Strnisa</surname>
          </string-name>
          .
          <article-title>Ott: E ective tool support for the working semanticist</article-title>
          .
          <source>J. Funct. Program.</source>
          ,
          <volume>20</volume>
          (
          <issue>1</issue>
          ):
          <volume>71</volume>
          {
          <fpage>122</fpage>
          ,
          <year>2010</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref12">
        <mixed-citation>
          [12]
          <string-name>
            <given-names>A.</given-names>
            <surname>Stump</surname>
          </string-name>
          .
          <article-title>Proof checking technology for satis ability modulo theories</article-title>
          . In A. Abel and C. Urban, editors,
          <source>Logical Frameworks and Meta-Languages: Theory and Practice</source>
          ,
          <year>2008</year>
          .
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>