Skip to content

[KIP] - Partial SMT hook syntax #2308

@Baltoli

Description

@Baltoli

Motivation

This issue summarises a threaded conversation on Slack; the original messages can be found here.

Currently, our syntax for SMT hook encodings is fully constructive; in smtlib as used by Z3, this means that partial functions cannot be specified as SMT hooks. Only total functions can be used as hooks.

Our original motivation for this change is in the issues related to the semantics of integer exponentiation around #2225. When developing that PR, we identified the need for a partial SMT encoding of integer exponentiation when both the base and exponent are positive integers:

(ite (and (< 0 #1) (< 0 #2)) (to_int (^ #1 #2)) ???)

Because the hook must be defined constructively, there is no valid term to fill the ??? hole. @daejunpark offered the axiomatic definition:

(declare-fun intExp (Int Int) Int)
(assert
  (forall
    ( (X Int) (N Int) )
    (implies
      (and (< 0 X) (< 0 N))
      (= (intExp X N) (to_int (^ X N))))))

Unfortunately, this partial definition is not compatible with our SMT hook syntax. It would be useful to have an auxiliary syntax that permits a declaration and series of axioms that define a partial function.

Example K Code

[smt-hook-decl((declare-fun intExp (Int Int) Int)), smt-hook-axiom((forall ((X Int) ...)]

Potential Alternatives/Work-arounds

The alternative approach is to define additional functions in an SMT prelude, but we don't want to be doing this at all (per @ehildenb), so adding new hook syntax is likely to be the most sensible option.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions