Proving decidability of subset in Agda

假如想象 提交于 2020-04-30 02:35:31

问题


Suppose I have this definition of Subset in Agda

Subset : ∀ {α} → Set α → {ℓ : Level} → Set (α ⊔ suc ℓ)
Subset A {ℓ} = A → Set ℓ

and I have a set

data Q : Set where
 a : Q
 b : Q

Is it possible to prove that all subset of q is decidable and why?

Qs? : (qs : Subset Q {zero}) → Decidable qs

Decidable is defined here:

-- Membership
infix 10 _∈_
_∈_ : ∀ {α ℓ}{A : Set α} → A → Subset A → Set ℓ
a ∈ p = p a

-- Decidable
Decidable : ∀ {α ℓ}{A : Set α} → Subset A {ℓ} → Set (α ⊔ ℓ)
Decidable as = ∀ a → Dec (a ∈ as)

回答1:


Not for that definition of Subset, since decidability would require to check whether "p a" is inhabited or not, i.e. excluded middle.

Decidable subsets would exactly be maps into Bool:

Subset : ∀ {α} (A : Set α) -> Set
Subset A = A → Bool 

_∈_ : ∀ {α}{A : Set α} → A → Subset A → Set
a ∈ p = T (p a)

But if you want more flexibility on the shape of the membership proofs you could use your definition of Subset and carry around a proof that it is Decidable.



来源:https://stackoverflow.com/questions/34183349/proving-decidability-of-subset-in-agda

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