Z3Prover / z3

The Z3 Theorem Prover
Other
10.3k stars 1.48k forks source link

Overloading theory symbols in user programs #6789

Closed LeventErkok closed 1 year ago

LeventErkok commented 1 year ago

It appears z3 allows overloading of theory symbols in user-space:

(set-logic ALL)
(declare-datatype T ((a) (b)))
(define-fun <= ((x T) (y T)) Bool (= x a))

z3 accepts the above without complaint. Is this intentional? CVC5 rejects it:

CVC5: (error "Parse Error: a.smt2:3.13: Symbol `<=' is shadowing a theory function symbol")

I also checked with SMTLib folks and they confirmed SMTLib does not allow such overloading. (https://groups.google.com/g/smt-lib/c/1qGiNqodg4g)

NikolajBjorner commented 1 year ago

z3 performs overload resolution across user and non-user functions. Producing errors for smtlib2_compliant is extra liability and only serves the purpose of a filter so there are no plans to support this.