Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6869661
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T03:35:09+00:00 2026-05-27T03:35:09+00:00

How do I get the maximum of a formula using smt-lib2? I want something

  • 0

How do I get the maximum of a formula using smt-lib2?

I want something like this:

(declare-fun x () Int)
(declare-fun y () Int)
(declare-fun z () Int)
(assert (= x 2))
(assert (= y 4))
(assert (= z (max x y))
(check-sat)
(get-model)
(exit)

Of course, ‘max’ is unknown to smtlibv2.
So, how can this be done?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T03:35:10+00:00Added an answer on May 27, 2026 at 3:35 am

    In Z3, you can easily define a macro max and use it for getting maximum of two values:

    (define-fun max ((x Int) (y Int)) Int
      (ite (< x y) y x))
    

    There is another trick to model max using uninterpreted functions, which will be helpful to use with Z3 API:

    (declare-fun max (Int Int) Int)
    (assert (forall ((x Int) (y Int))
        (= (max x y) (ite (< x y) y x))))
    

    Note that you have to set (set-option :macro-finder true), so Z3 is able to replace universal quantifiers with body of the function when checking satisfiability.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to get the maximum record based on a field, but the Max()
I want get the maximum value for this record. Please help me: SELECT rest.field1
So I have an NSFont, and I want to get the maximum dimensions for
I want to get the maximum values from two images, while preserving other information.
Ive got a Zend_Db_Table Now I want to get the maximum available value of
I need to get the minimum and maximum values in a collection of floating
I am trying to get all users that are updated maximum 90 seconds ago:
What is the maximum allowed size of a URL for a GET request in
What's the maximum length of an HTTP GET request? Is there a response error
how can we get the maximum number of letters that are side-by-side? For example,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.