Z3 randomness of generated model values

后端 未结 1 1962
余生分开走
余生分开走 2021-01-23 23:39

I\'m trying to influence the randomness of results for model values generated by Z3. As far as I understand, the options for this are very limited: in case of linear arithmetic,

相关标签:
1条回答
  • 2021-01-24 00:18

    Thanks for catching that! There was indeed a bug that caused the random seed not to be passed through to the arithmetic theory. This is now fixed in the unstable branch (fix here).

    This example:

    (set-option :smt.arith.random_initial_value true)
    (declare-const x Int)
    (declare-const y Int)
    (assert (> (+ x y) 0))
    (check-sat-using (using-params qflra :random_seed 1))
    (get-model)
    (check-sat-using (using-params qflra :random_seed 2))
    (get-model)
    (check-sat-using (using-params qflra :random_seed 3))
    (get-model)
    

    Now produces three different models:

    sat
    model
      (define-fun y () Int
        4294966763)
      (define-fun x () Int
        4294966337)
    )
    sat
    (model
      (define-fun y () Int
        216)
      (define-fun x () Int
        4294966341)
    )
    sat
    (model
      (define-fun y () Int
        196)
      (define-fun x () Int
        4294966344)
    )
    

    It looks like there may be another place where this option isn't passed through correctly (e.g., when using set-logic instead of calling the qflra tactic directly), we're still looking into that.

    0 讨论(0)
提交回复
热议问题