How to use Z3 SMT-LIB to prove theorems in Frobenius Algebras

时光怂恿深爱的人放手 提交于 2019-12-22 09:28:34

问题


We prove the following theorem in Frobenius Algebras

The proof is performed using the following code

;; Frobenius algebra object (A,mu,eta,delta, epsilon)
(declare-sort A)
(declare-sort AA)
(declare-sort A_AA)
(declare-sort AA_A)
(declare-sort I)
(declare-sort I_A)
(declare-sort A_I)
(declare-fun alpha (AA_A) A_AA)
(declare-fun inv_alpha (A_AA) AA_A)
(declare-fun mu (AA) A)
(declare-fun eta (I) A)
(declare-fun mu_id (AA_A) AA)
(declare-fun id_mu (A_AA) AA)
(declare-fun eta_id (I_A) AA)
(declare-fun id_eta (A_I) AA)
(declare-fun lambda (I_A) A)
(declare-fun rho (A_I) A)
(declare-fun delta (A) AA)
(declare-fun delta_id (AA) AA_A)
(declare-fun id_delta (AA) A_AA)
(declare-fun epsilon (A) I)
(declare-fun inv_lambda (A) I_A)
(declare-fun inv_rho (A) A_I)
(declare-fun epsilon_id (AA) I_A)
(declare-fun id_epsilon (AA) A_I)
(declare-fun Id (A) A)
(declare-fun beta1 (A) A_I)
(declare-fun beta2 (A) I_A)
(declare-fun inv_beta1 (A_I) A)
(declare-fun inv_beta2 (I_A) A)
(define-fun gamma ((x I))  AA
            (delta (eta x)))

;; Algebra Object
(assert (forall ((x I_A)) (= (lambda x) (mu (eta_id x)))    ))
(assert (forall ((x A_I) ) (= (rho x) (mu (id_eta x)))    ))
(assert (forall ((x AA_A) ) (= (mu (id_mu (alpha x)) ) (mu (mu_id x))    )   ) )

;; Coalgebra Object
(assert (forall ((x A)) (= (id_delta (delta x)) (alpha (delta_id (delta x)))  )  )   )

(assert (forall ((x A)) (= (epsilon_id (delta x))  (inv_lambda x)  )    ) )  

(assert (forall ((x A)) (= (id_epsilon (delta x))  (inv_rho x)  )    ) )  

;; Frobenius Relation

(assert (forall ((x AA)) (= (mu_id (inv_alpha (id_delta x))) (delta (mu x)))    ) )

(assert (forall ((x AA)) (= (id_mu (alpha (delta_id x))) (delta (mu x)))    ) )

(assert (forall ((x A)) (= (mu (id_eta (beta1 x))) (Id x))   ))

(assert (forall ((x A)) (= (mu (eta_id (beta2 x))) (Id x))   ))

(assert (forall ((x A)) (= (inv_beta1 (id_epsilon (delta x))) (Id x) )   ))

(assert (forall ((x A)) (= (inv_beta2 (epsilon_id (delta x))) (Id x))   ))

(assert (forall ((x A)) (= (Id (Id x)) (Id x))   ) )

(check-sat)
;;(get-model)


;; First Identity

(push)
(assert (forall ((x I_A)) (distinct (id_epsilon (id_mu (alpha (delta_id (eta_id x)) )  ) ) 
                                    (id_epsilon (delta (mu (eta_id x))))     )  ) )
(check-sat)
(pop)


(push)
(assert (forall ((x A )) (distinct (inv_beta1 (id_epsilon (delta (mu (eta_id (beta2 x)))))) 
                                    (Id x)     )  ) )
(check-sat)
(pop)


;; Second Identity
(push)
(assert (forall ((x A_I)) (distinct (epsilon_id (mu_id (inv_alpha (id_delta (id_eta x)) )  ) ) 
                                    (epsilon_id (delta (mu (id_eta x))))     )  ) )
(check-sat)
(pop)


(push)
(assert (forall ((x A)) (distinct (inv_beta2 (epsilon_id (delta (mu (id_eta (beta1 x))))) ) 
                                  (Id x)     )  ) )
(check-sat)
(pop)

And the corresponding output is

sat
unsat
unsat

unsat
unsat

Please run this proof online here

My claim is that this example is the first application of Z3 in Frobenius algebra. Do you agree?

来源:https://stackoverflow.com/questions/24815996/how-to-use-z3-smt-lib-to-prove-theorems-in-frobenius-algebras

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!