agda

Proving decidability of subset in Agda

六月ゝ 毕业季﹏ 提交于 2020-04-30 02:37:33
问题 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 →

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 →

Empty functions are equal in Agda (without functional extensionality)

狂风中的少年 提交于 2020-04-16 02:34:06
问题 Can I prove that two empty functions (functions from the empty domain) are equal? More concretely, is it possible to prove in Agda the following: eqf : ∀ {A : Set} (f g : ⊥ → A) → f ≡ g Edit: as @Sassa-NF points out in the comments, if extensionality is present, then this can be proven. I am interested in whether this can be proven without extensionality. 回答1: No, this is not possible to prove in plain Martin-Löf Type Theory (and hence should also be unprovable in Agda without extra

Empty functions are equal in Agda (without functional extensionality)

偶尔善良 提交于 2020-04-16 02:34:05
问题 Can I prove that two empty functions (functions from the empty domain) are equal? More concretely, is it possible to prove in Agda the following: eqf : ∀ {A : Set} (f g : ⊥ → A) → f ≡ g Edit: as @Sassa-NF points out in the comments, if extensionality is present, then this can be proven. I am interested in whether this can be proven without extensionality. 回答1: No, this is not possible to prove in plain Martin-Löf Type Theory (and hence should also be unprovable in Agda without extra

Agda: how does one obtain a value of a dependent type?

老子叫甜甜 提交于 2020-01-31 05:52:26
问题 I recently asked this question: An agda proposition used in the type -- what does it mean? and received a very well thought out answer on how to make types implicit and get a real compile time error. However, it is still unclear to me, how to create a value with a dependent type. Consider: div : (n : N) -> even n -> N div zero p = zero div (succ (succ n)) p= succ (div n p) div (succ zero) () Where N is the natural numbers and even is the following proposition. even : N -> Set even zero = \top

How to get around the implicit vs explicit function type error?

前提是你 提交于 2020-01-25 00:05:30
问题 This is from the last chapter of PLFA book. import Relation.Binary.PropositionalEquality as Eq open Eq using (_≡_; refl; sym; trans; cong) open import Data.Product using (_×_; ∃; ∃-syntax; Σ; Σ-syntax) renaming (_,_ to ⟨_,_⟩) infix 0 _≃_ record _≃_ (A B : Set) : Set where field to : A → B from : B → A from∘to : ∀ (x : A) → from (to x) ≡ x to∘from : ∀ (y : B) → to (from y) ≡ y open _≃_ data List (A : Set) : Set where [] : List A _∷_ : A → List A → List A infixr 5 _∷_ data All {A : Set} (P : A

How to get around the implicit vs explicit function type error?

泪湿孤枕 提交于 2020-01-25 00:05:12
问题 This is from the last chapter of PLFA book. import Relation.Binary.PropositionalEquality as Eq open Eq using (_≡_; refl; sym; trans; cong) open import Data.Product using (_×_; ∃; ∃-syntax; Σ; Σ-syntax) renaming (_,_ to ⟨_,_⟩) infix 0 _≃_ record _≃_ (A B : Set) : Set where field to : A → B from : B → A from∘to : ∀ (x : A) → from (to x) ≡ x to∘from : ∀ (y : B) → to (from y) ≡ y open _≃_ data List (A : Set) : Set where [] : List A _∷_ : A → List A → List A infixr 5 _∷_ data All {A : Set} (P : A

An agda proposition used in the type — what does it mean?

好久不见. 提交于 2020-01-23 12:34:51
问题 I am taking this from the "Brutal Introduction to Agda" http://oxij.org/note/BrutalDepTypes/ Suppose we want to define division by two on even numbers. We can do this as: div : (n : N) -> even n -> N div zero p = zero div (succ (succ n)) p= succ (div n p) div (succ zero) () N is the natural numbers and even is the following "proposition" even : N -> Set even zero = \top even (succ zero) = \bot even (succ (succ n)) = even n data \bot : Set where record \top : Set where When you evaluate the

How to add two rational in agda?

 ̄綄美尐妖づ 提交于 2020-01-15 16:46:30
问题 How to add two rational.. I was trying this but this is not correct. As I am unable to prove that coprime part. open import Data.Rational open import Data.Integer open import Data.Nat _add_ : ℚ -> ℚ -> ℚ x add y = (nx Data.Integer.* dy Data.Integer.+ dx Data.Integer.* ny) ÷ (dx′ Data.Nat.* dy′) where nx = ℚ.numerator x dx = ℚ.denominator x dx′ = ℕ.suc (ℚ.denominator-1 x) ny = ℚ.numerator y dy = ℚ.denominator y dy′ = ℕ.suc (ℚ.denominator-1 y) 回答1: You need to simplify (nx * dy + dx * ny) / (dx

Guidance on very shallow embedding VHDL in AGDA

孤者浪人 提交于 2020-01-15 08:57:12
问题 for my project in Programming Languages I am doing a very shallow and simple embedding VHDL digital circuits in agda. The aim is to write the syntax, static semantics, dynamic semantics and then write some proofs to show our understanding of the material. Up till now I have written the following code: data Ckt : Set where var : String → Ckt bool : Bool → Ckt empty : Ckt gate : String → ℕ → ℕ → Ckt -- name in out series : String → Ckt → Ckt → Ckt -- name ckt1 ckt2 parallel : String → Ckt → Ckt