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

  • Home
  • SEARCH
  • 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 8810171
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T03:03:46+00:00 2026-06-14T03:03:46+00:00

I need a theorem prover for some simple linear arithmetic problems. However, I can’t

  • 0

I need a theorem prover for some simple linear arithmetic problems. However, I can’t get Z3 to work even on simple problems. I’m aware that it is incomplete, however it should be able to handle this simple example:

(assert (forall ((t Int)) (= t 5)))
(check-sat)

I’m not sure if i’m overlooking something, but this should be trivial to disprove. I even tried this simpler example:

(assert (forall ((t Bool)) (= t true)))
(check-sat)

That should be solvable by making an exhaustive search, since boot only contains two values.

In both cases z3 answers with unknown. I’d like to know if i’m doing something wrong here or if not if you can recommend a theorem prover for these types of formulas.

  • 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-06-14T03:03:47+00:00Added an answer on June 14, 2026 at 3:03 am

    For handling this kind of quantifiers, you should use the quantifier elimination module available in Z3. Here is an example on how to use it (try online at http://rise4fun.com/Z3/3C3):

    (assert (forall ((t Int)) (= t 5)))
    (check-sat-using (then qe smt))
    
    (reset)
    
    (assert (forall ((t Bool)) (= t true)))
    (check-sat-using (then qe smt))
    

    The command check-sat-using allows us to specify an strategy to solve the problem. In the example above, I’m just using qe (quantifier elimination) and then invoking a general purpose SMT solver.
    Note that, for these examples, qe is sufficient.

    Here is a more complicated example, where we really need to combine qe and smt (try online at: http://rise4fun.com/Z3/l3Rl )

    (declare-const a Int)
    (declare-const b Int)
    (assert (forall ((t Int)) (=> (<= t a) (< t b))))
    (check-sat-using (then qe smt))
    (get-model)
    

    EDIT
    Here is the same example using the C/C++ API:

    void tactic_qe() {
        std::cout << "tactic example using quantifier elimination\n";
        context c;
    
        // Create a solver using "qe" and "smt" tactics
        solver s = 
            (tactic(c, "qe") &
             tactic(c, "smt")).mk_solver();
    
        expr a = c.int_const("a");
        expr b = c.int_const("b");
        expr x = c.int_const("x");
        expr f = implies(x <= a, x < b);
    
        // We have to use the C API directly for creating quantified formulas.
        Z3_app vars[] = {(Z3_app) x};
        expr qf = to_expr(c, Z3_mk_forall_const(c, 0, 1, vars,
                                                0, 0, // no pattern
                                                f));
        std::cout << qf << "\n";
    
        s.add(qf);
        std::cout << s.check() << "\n";
        std::cout << s.get_model() << "\n";
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Need some regular expressions help. So far I have my code working to allow
Need some help... I have jasperserver 4.1 installed on my ubuntu. It runs via
Need to set some attributes of button. For example Checked. I guess it is
Need a div to partially show the image behind it, is this even possible?
Need some advise on what I am doing wrong during client JSON parsing... Tips
I'm carrying out some experiments in theorem proving with combinator logic, which is looking
Need some advice on how to optimize my articles table for read operations. I
I have a problem with theorem numbering in LaTeX. I can make it number
Need some help understanding the difference between the success and ajaxSuccess events documented here
Need to choose optimal data structure for fast work with list of locations and

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.