How can i change working of forall in agda?

自作多情 提交于 2019-12-22 13:01:25

问题


I am working with pair of Stream of rationals, Lets say (L,R) Where L and R are Stream of rationals. There are 3 conditions which L and R both have to satisfy to say it is valid. I have written the code as..

isCut_ : cut → Set
isCut x = (p q : pair ) → 
              if((((p mem (getLC x)) ∨ (p mem (getRC x)))) ∧ 
                ((not (p mem getLC x)) ∨ (not (p mem getRC x))) ∧ 
                (not (p <pair q) ∨ ((p mem getLC x) ∨ (q mem getRC x))))then ⊤
              else ⊥

I really wanted to change the return type of this function to Bool. Here cut means (L, R) and mem is membership.

The problem coming from forall p q which expect return type to be Set. How should i handle to get desired result.


回答1:


You can write something like this:

isCut : cut → (p q : pair) → Bool
isCut x p q = (((p mem (getLC x)) ∨ (p mem (getRC x))))
            ∧ ((not (p mem getLC x)) ∨ (not (p mem getRC x)))
            ∧ (not (p <pair q) ∨ ((p mem getLC x) ∨ (q mem getRC x))))


来源:https://stackoverflow.com/questions/30817693/how-can-i-change-working-of-forall-in-agda

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