agda

Guidance on very shallow embedding VHDL in AGDA

[亡魂溺海] 提交于 2020-01-15 08:57:02
问题 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

Substitution versus (OPE-based) renaming

做~自己de王妃 提交于 2020-01-06 19:55:13
问题 Based on this suggestion I am trying to use order-preserving embeddings to represent renamings in a project where I am going to need two levels of contexts (types live in a kinding context of type variable kinds, and terms live in a typing context of term variable types). In my full code, I have substitution for types fully implemented; but a single hole remains in the function that does type-renaming of terms (so this is for renaming type variables). Below is my attempt at recreating the

How to use Logical AND operation between two sets in agda?

五迷三道 提交于 2020-01-06 19:42:01
问题 I wanted to proof that if there is m which is less than 10 and there is n which is less than 15 then there exist z which is less than 25. thm : ((∃ λ m → (m < 10)) AND (∃ λ n → (n < 15))) -> (∃ λ z → (z < 25)) thm = ? How to define AND here?? Please help me. And how to proof this?? 回答1: and corresponds to product in Agda. Here is the corresponding construct in the standard library. In your case, you may want to use the non-dependent version _×_ . 回答2: The theorem you're trying to prove seems

Congruence for heterogenous equality

时光毁灭记忆、已成空白 提交于 2020-01-03 15:18:11
问题 I'm trying to use heterogenous equality to prove statements involving this indexed datatype: data Counter : ℕ → Set where cut : (i j : ℕ) → Counter (suc i + j) I was able to write my proofs using Relation.Binary.HeterogenousEquality.≅-Reasoning , but only by assuming the following congruence property: Counter-cong : ∀ {n n′} {k : Counter n} {k′ : Counter n′} → {A : ℕ → Set} → (f : ∀{n} → Counter n → A n) → k ≅ k′ → f k ≅ f k′ Counter-cong f k≅k′ = {!!} However, I can't pattern match on k≅k′

With clauses obscuring termination

烈酒焚心 提交于 2020-01-03 04:49:07
问题 I'm trying to define binary numbers in agda but agda cant see that ⟦_⇑⟧ is terminating. I really dont want to have to break out accessibility relations. How can I show agda that n gets smaller? module Binary where open import Data.Nat using (ℕ; _+_; +-suc) open ℕ 2* : ℕ → ℕ 2* n = n + n data Parity : ℕ → Set where 𝕖 : ∀ k → Parity (2* k) 𝕠 : ∀ k → Parity (1 + 2* k) parity : ∀ n → Parity n parity zero = 𝕖 0 parity (suc n) with parity n parity (suc .(k + k)) | 𝕖 k = 𝕠 k parity (suc .(suc (k + k

Instance search limitations

♀尐吖头ヾ 提交于 2020-01-02 10:03:39
问题 The instance arguments machinery is described in an old paper and at the Agda wiki. Are there some notable facts that these sources do not mention? What are limitations of instance search? 回答1: Removing ambiguity If we typecheck this: open import Category.Functor open import Category.Monad open RawFunctor open RawMonad and run C-c C-w _<$>_ ( C-c C-w is "explain why a particular name in scope"), we get (after some cleaning) _<$>_ is in scope as * a record field Category.Functor.RawFunctor._<$

Self-representation and universes in OTT

老子叫甜甜 提交于 2020-01-02 07:16:09
问题 The question is about Observational Type Theory. Consider this setting: data level : Set where # : ℕ -> level ω : level _⊔_ : level -> level -> level # α ⊔ # β = # (α ⊔ℕ β) _ ⊔ _ = ω _⊔ᵢ_ : level -> level -> level α ⊔ᵢ # 0 = # 0 α ⊔ᵢ β = α ⊔ β mutual Prop = Univ (# 0) Type = Univ ∘ # ∘ suc data Univ : level -> Set where bot : Prop top : Prop nat : Type 0 univ : ∀ α -> Type α σ≡ : ∀ {α β γ} -> α ⊔ β ≡ γ -> (A : Univ α) -> (⟦ A ⟧ -> Univ β) -> Univ γ π≡ : ∀ {α β γ} -> α ⊔ᵢ β ≡ γ -> (A : Univ α)

Getting path induction to work in Agda

本小妞迷上赌 提交于 2020-01-02 05:32:25
问题 I can't figure out why my path induction isn't type checking correctly. It says "C x should be a function type, but it isn't" when referring to C (refl x). Perhaps my definition of refl is wrong or is there something wrong with my {}'s and ()'s? data _≡_ {A : Set}(a : A) : A → Set where refl : a ≡ a infix 4 _≡_ pathInd : ∀ {u} → {A : Set} → (C : {x y : A} → x ≡ y → Set u) → (c : (x : A) → C (refl x)) → ({x y : A} (p : x ≡ y) → C p) pathInd C c (refl x) = c x 回答1: refl is not a function. Here

Agda: Reading a line of standard input as a String instead of a Costring

妖精的绣舞 提交于 2020-01-01 10:49:05
问题 I am trying to write a simple program that reads a line from standard input, reverses it, and then prints the reversed string. Unfortunately the native getLine function reads a Costring ; I can only reverse String s; and there is no function that takes a Costring to a String . How can I amend this program to compile? module EchoInputReverse where -- Agda standard library 0.7 open import Data.List using (reverse) open import Data.String open import Foreign.Haskell using (Unit) open import IO

Pushing a path along a pair of paths originating from its endpoints

不想你离开。 提交于 2019-12-25 03:24:44
问题 Suppose I have, using the cubical-demo library, the following things in scope: i : I p0 : x ≡ y p1 : x' ≡ y' q0 : x ≡ x' q1 : y ≡ y' How do I then construct q' : p0 i ≡ p1 i ? 回答1: One way is by contracting singleton pairs with J, there might be simpler proofs though. open import Cubical.PathPrelude q' : ∀ {A : Set} (i : I) (x : A) x' (q0 : x ≡ x') y (p0 : x ≡ y) y' (p1 : x' ≡ y') (q1 : y ≡ y') → p0 i ≡ p1 i q' i x = pathJ _ (pathJ _ (pathJ _ (\ q1 → q1))) 回答2: Another one I've come up with