smt lib 3
play

SMT-LIB 3 Clark Barrett Pascal Fontaine Cesare Tinelli Stanford - PowerPoint PPT Presentation

SMT-LIB 3 Clark Barrett Pascal Fontaine Cesare Tinelli Stanford University, USA Universit e de Lorraine, CNRS, Inria, LORIA, France The University of Iowa, USA 1/19 Disclaimer This is work in progress needs discussion needs


  1. SMT-LIB 3 Clark Barrett Pascal Fontaine Cesare Tinelli Stanford University, USA Universit´ e de Lorraine, CNRS, Inria, LORIA, France The University of Iowa, USA 1/19

  2. Disclaimer This ◮ is work in progress ◮ needs discussion ◮ needs to be concretely applied to reveal flaws ◮ needs to be discussed with the SMT community ◮ will most likely evolve We have been discussing SMT-LIB 3 for several years. It is getting clearer in our mind. It will eventually come. Two main goals: ◮ from FOL to HOL ◮ find a nice replacement for logics 2/19

  3. Credits Based on inputs from Nikolaj Bjørner, Jasmin Blanchette, Koen Claessen, Tobias Nipkow, . . . , [your name here!] 3/19

  4. SMT-LIB 2 Standard ◮ Widely adopted I/O language for SMT solvers 4/19

  5. SMT-LIB 2 Standard ◮ Widely adopted I/O language for SMT solvers ◮ Around 340,000 benchmarks 4/19

  6. SMT-LIB 2 Standard ◮ Widely adopted I/O language for SMT solvers ◮ Around 340,000 benchmarks ◮ Command language ◮ Stack-based, tell-and-ask execution model ◮ Benchmarks are command scripts ◮ Same online and offline behavior 4/19

  7. SMT-LIB 2 Standard ◮ Widely adopted I/O language for SMT solvers ◮ Around 340,000 benchmarks ◮ Command language ◮ Stack-based, tell-and-ask execution model ◮ Benchmarks are command scripts ◮ Same online and offline behavior ◮ Simple syntax ◮ Sublanguage of Common Lisp S-expressions ◮ Easy to parse ◮ Few syntactic categories 4/19

  8. SMT-LIB 2 Standard ◮ Widely adopted I/O language for SMT solvers ◮ Around 340,000 benchmarks ◮ Command language ◮ Stack-based, tell-and-ask execution model ◮ Benchmarks are command scripts ◮ Same online and offline behavior ◮ Simple syntax ◮ Sublanguage of Common Lisp S-expressions ◮ Easy to parse ◮ Few syntactic categories ◮ Powerful underlying logic ◮ Many sorted FOL with (pseudo-)parametric types ◮ Schematic theory declarations ◮ Semantic definition of theories 4/19

  9. SMT-LIB 2 Concrete Syntax Strict subset of Common Lisp S-expressions: � spec constant � ::= � numeral � | � decimal � | � hexadecimal � | � binary � | � string � � s expr � ::= � spec constant � | � symbol � ( � s expr � ∗ ) | 5/19

  10. Example: Concrete Syntax ( declare − datatype L i s t ( par (X) ( ( n i l ) ( cons ( head X) ( t a i l ( L i s t X) ) ) ) ) ) ( declare − fun append (( L i s t I n t ) ( L i s t I n t ) ( L i s t I n t ) ) ) ( declare − const a I n t ) ( a s s e r t ( f o r a l l (( x ( L i s t I n t )) ( y ( L i s t I n t ) ) ) (= ( append x y ) ( i t e (= x ( as n i l ( L i s t I n t ) ) ) y ( l e t (( h ( head x )) ( t ( t a i l x ) ) ) ( cons h ( append t y )) ) ) ) ) ) ( a s s e r t (= ( cons a ( as n i l ( L i s t I n t ) ) ) ( append ( cons 2 ( as n i l ( L i s t I n t ) ) ) n i l ) ) ) ( check − sat ) 6/19

  11. From Many-sorted FOL to HOL Motivation: ◮ Several hammers for ITP systems use SMT solvers ◮ Communities are extending SMT-LIB with HOL features (for synthesis, inductive reasoning, symbolic computation, . . . ) Goals: ◮ Serve these new users and other non-traditional users ◮ Maintain backward compatibility as much as possible 7/19

  12. From Many-sorted FOL to HOL Plan: ◮ Adopt (Gordon’s) HOL with parametric types, rank-1 polymorphism, and extensional equality ◮ Extend syntax by introducing → type, λ and ε binders ◮ Make all function symbols Curried ◮ Enable higher-order quantification ◮ Keep SMT-LIB 2 constructs/notions but define them in terms of HOL 8/19

  13. SMT-LIB 3: Basic Concrete Syntax for Sorts (Types) � symbol � � label � + ) � indentifier � ::= � symbol � | ( � sort � ::= � identifier � ( -> � sort � + � sort � ) | ( � identifier � � sort � + ) | ◮ -> predefined right-associative type constructor ◮ as will probably have a new, simpler semantics 9/19

  14. SMT-LIB 3: Basic Concrete Syntax for Terms � sorted var � ::= ( � symbol � � sort � ) � term � ::= � spec constant � | � identifier � | ( � term � � term � ) | ( lambda ( � sorted var � ) � term � ) | ( choose ( � sorted var � ) � term � ) ( ! � term � � attribute � + ) | ( par ( � symbol � + ) � term � ) � par term � ::= | ( not � par term � ) | � term � ◮ par is used in terms too. Should this be renamed forall-type ? 10/19

  15. SMT-LIB 3: Extended Concrete Syntax for Terms ◮ ( t 1 t 2 t 3 · · · t n ) := (( t 1 t 2 ) t 3 · · · t n ) 11/19

  16. SMT-LIB 3: Extended Concrete Syntax for Terms ◮ ( t 1 t 2 t 3 · · · t n ) := (( t 1 t 2 ) t 3 · · · t n ) ◮ (lambda (( x σ ) ( x 1 σ 1 ) · · · ( x n σ n )) ϕ ) := (lambda (( x σ )) (lambda (( y 1 σ 1 ) · · · ( y n σ n )) ϕ [ y i /x i ] )) with y i fresh 11/19

  17. SMT-LIB 3: Extended Concrete Syntax for Terms ◮ ( t 1 t 2 t 3 · · · t n ) := (( t 1 t 2 ) t 3 · · · t n ) ◮ (lambda (( x σ ) ( x 1 σ 1 ) · · · ( x n σ n )) ϕ ) := (lambda (( x σ )) (lambda (( y 1 σ 1 ) · · · ( y n σ n )) ϕ [ y i /x i ] )) with y i fresh ◮ (let (( x 1 t 1 ) · · · ( x n t n )) t ) := ((lambda (( x 1 σ 1 ) · · · ( x n σ n )) t ) t 1 · · · t n ) where σ i is the sort of t i 11/19

  18. SMT-LIB 3: Extended Concrete Syntax for Terms ◮ ( t 1 t 2 t 3 · · · t n ) := (( t 1 t 2 ) t 3 · · · t n ) ◮ (lambda (( x σ ) ( x 1 σ 1 ) · · · ( x n σ n )) ϕ ) := (lambda (( x σ )) (lambda (( y 1 σ 1 ) · · · ( y n σ n )) ϕ [ y i /x i ] )) with y i fresh ◮ (let (( x 1 t 1 ) · · · ( x n t n )) t ) := ((lambda (( x 1 σ 1 ) · · · ( x n σ n )) t ) t 1 · · · t n ) where σ i is the sort of t i ◮ (forall (( x σ )) ϕ ) := (= (lambda (( x σ )) ϕ ) (lambda (( x σ )) true)) (forall (( x 1 σ 1 ) ( x 2 σ 2 ) · · · ( x n σ n )) ϕ ) := (forall (( x 1 σ 1 )) (forall (( x 2 σ 2 ) · · · ( x n σ n )) ϕ )) 11/19

  19. SMT-LIB 3: Extended Concrete Syntax for Terms ◮ ( t 1 t 2 t 3 · · · t n ) := (( t 1 t 2 ) t 3 · · · t n ) ◮ (lambda (( x σ ) ( x 1 σ 1 ) · · · ( x n σ n )) ϕ ) := (lambda (( x σ )) (lambda (( y 1 σ 1 ) · · · ( y n σ n )) ϕ [ y i /x i ] )) with y i fresh ◮ (let (( x 1 t 1 ) · · · ( x n t n )) t ) := ((lambda (( x 1 σ 1 ) · · · ( x n σ n )) t ) t 1 · · · t n ) where σ i is the sort of t i ◮ (forall (( x σ )) ϕ ) := (= (lambda (( x σ )) ϕ ) (lambda (( x σ )) true)) (forall (( x 1 σ 1 ) ( x 2 σ 2 ) · · · ( x n σ n )) ϕ ) := (forall (( x 1 σ 1 )) (forall (( x 2 σ 2 ) · · · ( x n σ n )) ϕ )) ◮ (choose (( x 1 σ 1 ) · · · ( x n σ n )) ϕ ) := . . . 11/19

  20. SMT-LIB 3: Extended Concrete Syntax for Terms ◮ ( t 1 t 2 t 3 · · · t n ) := (( t 1 t 2 ) t 3 · · · t n ) ◮ (lambda (( x σ ) ( x 1 σ 1 ) · · · ( x n σ n )) ϕ ) := (lambda (( x σ )) (lambda (( y 1 σ 1 ) · · · ( y n σ n )) ϕ [ y i /x i ] )) with y i fresh ◮ (let (( x 1 t 1 ) · · · ( x n t n )) t ) := ((lambda (( x 1 σ 1 ) · · · ( x n σ n )) t ) t 1 · · · t n ) where σ i is the sort of t i ◮ (forall (( x σ )) ϕ ) := (= (lambda (( x σ )) ϕ ) (lambda (( x σ )) true)) (forall (( x 1 σ 1 ) ( x 2 σ 2 ) · · · ( x n σ n )) ϕ ) := (forall (( x 1 σ 1 )) (forall (( x 2 σ 2 ) · · · ( x n σ n )) ϕ )) ◮ (choose (( x 1 σ 1 ) · · · ( x n σ n )) ϕ ) := . . . ◮ (exists (( x 1 σ 1 ) · · · ( x n σ n )) ϕ ) := . . . 11/19

  21. SMT-LIB 3: Commands ◮ Mostly as in SMT-LIB 2 ◮ Fed to the solver’s standard input channel or stored in a file ◮ Look like Lisp function calls: ( � comm name � � arg � ∗ ) ◮ Operate on an stack of assertion sets ◮ Cause solver to outputs an S-expression to the standard output/error channel ◮ Four categories: ◮ assertion-set commands, modify the assertion set stack ◮ post-check commands, query about the assertion sets ◮ option commands, set solver parameters ◮ diagnostic commands, get solver diagnostics 12/19

  22. SMT-LIB 3: Assertion-Set Commands (assert t ) where t ∈ � par term � (declare-sort s n ) Example: (declare-sort Elem 0) (declare-sort Set 1) Effect: declares sort symbol s with arity n (define-sort s ( u 1 · · · u n ) σ ) Example: (define-sort MyArray (u) (Array Int u)) Effect: enables the use of (MyArray Real) as a shorthand for (Array Int Real) 13/19

  23. SMT-LIB 3: Assertion-Set Commands (declare-const f τ ) Example: (declare-const a (Array Int Real)) (declare-const g (-> Int Int Int)) (declare-const len (par (X) (-> (List X) Int))) Effect: declares f with type τ (declare-fun f ( σ 1 · · · σ n ) σ ) Example: (declare-fun a () (Array Int Real)) (declare-fun g (Int Int) Int) Effect: same as (declare-const f (-> σ 1 · · · σ n σ )) (declare-fun f (par ( u 1 · · · u n ) ( σ 1 · · · σ n ) σ )) Example: (declare-fun len (par (X) ((List X)) Int)) Effect: same as (declare-const f (par ( u 1 · · · u n ) (-> σ 1 · · · σ n σ ))) 14/19

  24. SMT-LIB 3: Assertion-Set Commands (set-logic s ) ◮ We want logic to be parsable. ◮ Rationale: there are too many of them, and need for more. ◮ Need to better express combinations of theories. 15/19

  25. SMT-LIB 3: Theories ◮ Theories as written in SMT-LIB 2.6 are a reminiscence of SMT-LIB 1 ◮ They are never parsed (and only partially parsable) ◮ What should a theory be? A script? Something totally informal? ◮ We are probably going for something in-between ◮ Use SMT-LIB 3 commands when possible, informal descriptions otherwise 16/19

Recommend


More recommend