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 9148575
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T11:18:47+00:00 2026-06-17T11:18:47+00:00

The following code encodes a record with two fields array-fld and blist-fld . I’ve

  • 0

The following code encodes a “record” with two fields array-fld and blist-fld. I’ve defined the update functions for these fields, and then asserted a property that should be true (but which z3 reports as unknown). This is Z3 version 4.0, run as z3 -smt2 -in:

(declare-datatypes ()
                   ((mystruct (mk-mystruct
                                 (array-fld (Array Int Int))
                                 (blist-fld (List Bool))))))
(define-fun array-fld-upd ((v (Array Int Int)) (obj mystruct)) mystruct
  (mk-mystruct v (blist-fld obj)))
(define-fun blist-fld-upd ((v (List Bool)) (obj mystruct)) mystruct
  (mk-mystruct (array-fld obj) v))

(push)
(assert
 (forall ((z0 mystruct))
         (exists ((array-val (Array Int Int)))
                 (and (= array-val (array-fld z0))
                      (= (select (array-fld
                                  (array-fld-upd (store array-val 2 4) z0)) 3)
                         (select (array-fld z0) 3))))))
(check-sat)

If I manually unwind/eliminate the existential by substituting out the equation array-val binding, I get

(pop)
(assert
 (forall ((z0 mystruct))
         (= (select (array-fld (array-fld-upd (store (array-fld z0) 2 4) z0)) 3)
            (select (array-fld z0) 3))))
(check-sat)

and this is happily resolved as sat.

I guess there are four questions bound up in this:

  1. Is there a way to invoke z3 to get it to solve the first instance as well as the second?
  2. Should I be encoding my records/structs differently?
  3. Should I be encoding my let-expressions differently (it is these that lead to the existential quantification)?
  4. Or, should I just expand out the let-expressions directly (I could do this myself, but it might lead to large terms if there are lots of references).
  • 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-17T11:18:47+00:00Added an answer on June 17, 2026 at 11:18 am

    It seems from the question that you can use proper let expressions.
    Then it will be easier for Z3:

    (declare-datatypes ()
                   ((mystruct (mk-mystruct
                                 (array-fld (Array Int Int))
                                 (blist-fld (List Bool))))))
    (define-fun array-fld-upd ((v (Array Int Int)) (obj mystruct)) mystruct
      (mk-mystruct v (blist-fld obj)))
    (define-fun blist-fld-upd ((v (List Bool)) (obj mystruct)) mystruct
      (mk-mystruct (array-fld obj) v))
    
    (push)
    (assert
     (forall ((z0 mystruct))
        (let ((array-val (array-fld z0)))
                      (= (select (array-fld
                                  (array-fld-upd (store array-val 2 4) z0)) 3)
                         (select (array-fld z0) 3)))))
     (check-sat)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following code which encodes json in php $arr = array('htmlOutput' =>
Following code produces a nested array as a result for keys containing three items:
Following code iterates through many data-rows, calcs some score per row and then sorts
I am using the following code to leverage Windows Media Encoder to record screen.
I am using following code to generate MD5 Hash for my application it encodes
The following code shows that fields like datetime, float and decimal in my test
I have the following javascript code, which loads without error, however the update function
I have the following code in my .Zshrc function google; { $VIEW http://www.google.com/search?q='url-encode ${(j:
I have the following line of code. <%= Html.Encode(string.Join(, , item.company1.companies.Select(x => x.company_name).ToArray())) %>
Following code takes like 2500 milliseconds on an i7-*3.4 GHz windows-7 64-bit computer to

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.