My goal is to define an injective function f: Int -> Term, where Termis a new type. Noting the definition of injective function, I wrote the following:
(declare-sort Term)
(declare-fun f (Int) Term)
(assert (forall ((x Int) (y Int))
(=> (= (f x) (f y)) (= x y))))
(check-sat)
This results in a timeout. I suspect this is because the solver is trying to validate the statement for all values ββin a domain Intthat is infinite.
I also verified that the model described above works for a specific custom sort instead Int:
(declare-sort Term)
(declare-sort A)
(declare-fun f (A) Term)
(assert (forall ((x A) (y A))
(=> (= (f x) (f y)) (= x y))))
(declare-const x A)
(declare-const y A)
(assert (and (not (= x y)) (= (f x) (f y))))
(check-sat)
(get-model)
The first question is how to implement the same model for sorting Intinstead A. Could this solve it?
. , :pattern . , :pattern .