【发布时间】:2018-01-30 21:31:58
【问题描述】:
在 Microsoft Z3 Dot Net API 中,没有执行 sin cos 运算的函数。上网查了一下,发现sin和cos函数的值可以通过将函数转换为笛卡尔坐标来计算。
例如:
if x = cos(theta) and y = sin(theta)
x^2 + y^2 = 1
使用这个逻辑,我们可以生成 sin cos 函数的值。
我可以生成以下代码:
(set-info :status sat)
(set-option :pp.decimal true)
(set-option :model_validate false)
(declare-fun x () Real)
(declare-fun y () Real)
(declare-fun theta () Real)
(assert (= (cos theta) x))
(assert (= (sin theta) y))
(assert (= (+ (* x x) (* y y)) 1))
(check-sat-using qfnra-nlsat)
(get-model)
(reset)
我现在得到的输出是这样的:
sat
(model
(define-fun x () Real
0.125)
(define-fun y () Real
(- 0.9921567416?))
(define-fun theta () Real
(+ (acos (- 0.125)) pi))
)
我不清楚的是,如何获得 Z3 中给定 theta 的 sin(theta) 或 cos(theta) 值?谁能帮我制作smt代码?
我在结果中得到的“(+ (acos (- 0.125)) pi))”值是多少?
【问题讨论】: