agda

How do I use Agda's implementation of delimited continuations?

好久不见. 提交于 2021-02-07 14:16:00
问题 We can implement a delimited continuation monad in Agda rather easily. There is, however, no need to, as the Agda "standard library" has an implementation of a delimited continuation monad. What confuses me about this implementation, though, is the addition of an extra parameter to the DCont type. DCont : ∀ {i f} {I : Set i} → (I → Set f) → IFun I f DCont K = DContT K Identity My question is: why is the extra parameter K there? And how would I use the DContIMonadDCont instance? Can I open it

How do I find further constraints than boundary conditions?

给你一囗甜甜゛ 提交于 2021-01-29 15:32:19
问题 In the following Agda code, I have one hole with some potential filling; alas, the filling doesn't typecheck. It seems to fulfill all the constraints Agda shows, so I'd like to know where I could find what other, invisible constraints there are. {-# OPTIONS --cubical #-} module _ where open import Cubical.Core.Everything open import Cubical.Foundations.Everything open import Cubical.Data.Nat module UntypedNominalTerms (A : Type) where data Term : Type where var : ℕ → (x : A) → Term rename : ∀

How to define a subformula of an inductively defined type in Agda?

强颜欢笑 提交于 2021-01-29 08:11:22
问题 I'm trying to define a simple predicate to determine if a formula is a subformula of a given formal over a simple inductively defined syntax. I'm running into a few, presumably simple, problems. (i) I'd rather use a parameterized module with a given type A. How can one import the information that A is a set, in the sense that A has decideable equality? If this can't be done, what are some workarounds? This is why I have Nat instead. (ii) Is the t1 ≡ (t2 // t3) (and similairly defined)

Using irrelevant fields

依然范特西╮ 提交于 2021-01-28 14:07:09
问题 Is it possible to declare fields in a record irrelevant but still use them somewhere? Suppose I have postulate f : ℕ → ℕ record Silly x : Set where field n : ℕ s : f n ≡ x open Silly Then, I can same-silly : ∀{x} {p q : Silly x} → f (n p) ≡ f(n q) same-silly {x} {p} {q} = ≡-trans (s p) (≡-sym (s q)) But if I use dotted-fields, record Silly x : Set where field n : ℕ .s : f n ≡ x -- note the dot then same-silly can no longer be proven ---not by me at least. When I attempt to use s , as in the

`with f x` matches `false`, but cannot construct `f x == false`

偶尔善良 提交于 2020-08-17 12:06:08
问题 A piece of code here: -- transitivity trans : {A : Set} {x y z : A} -> x == y -> y == z -> x == z trans refl refl = refl union-pair' : {A : Set} -> (m n : S {A}) -> (x : A) -> (ismember (set-union (set-pair m n)) x) == (ismember (union m n) x) union-pair' m n x with ismember m x | ismember n x | ismember (set-union (set-pair m n)) x union-pair' : {A : Set} -> (m n : S {A}) -> (x : A) -> (ismember (set-union (set-pair m n)) x) == (ismember (union m n) x) union-pair' m n x with ismember m x |

Agda: Can't find std-lib when installing with Stack

我的未来我决定 提交于 2020-08-05 06:00:10
问题 I'm trying to compile an Agda file, but I'm having trouble getting it to find the standard library. I've seen the documentation here. I've used Stack to install it: > which agda /home/joey/.local/bin/agda And I've set the environment variable for my Agda directory: > echo $AGDA_DIR /home/joey/.agda Which is populated with the correct files: /home/joey/agda/agda-stdlib/standard-library.agda-lib > cat "$AGDA_DIR"/libraries /home/joey/agda/agda-stdlib/standard-library.agda-lib > cat "$AGDA_DIR"

How to explicitly use an induction principle in coq?

三世轮回 提交于 2020-05-16 22:06:15
问题 I'm trying to prove symmetry of propositional identity with the induction principal explicitly in Coq, but can't do it with the induction principle like I can in agda. I don't know how to locally declare a variable in Coq, nor do I know how to unfold a definition, as you can see below. How can I get a proof that resembles the agda one below? Inductive Id (A : Type) (x : A) : A -> Type := | refl : Id A x x. (* trivial with induction *) Theorem symId {A} {x y} : Id A x y -> Id A y x. Proof.

How to explicitly use an induction principle in coq?

我的梦境 提交于 2020-05-16 22:05:20
问题 I'm trying to prove symmetry of propositional identity with the induction principal explicitly in Coq, but can't do it with the induction principle like I can in agda. I don't know how to locally declare a variable in Coq, nor do I know how to unfold a definition, as you can see below. How can I get a proof that resembles the agda one below? Inductive Id (A : Type) (x : A) : A -> Type := | refl : Id A x x. (* trivial with induction *) Theorem symId {A} {x y} : Id A x y -> Id A y x. Proof.

How to explicitly use an induction principle in coq?

陌路散爱 提交于 2020-05-16 22:05:03
问题 I'm trying to prove symmetry of propositional identity with the induction principal explicitly in Coq, but can't do it with the induction principle like I can in agda. I don't know how to locally declare a variable in Coq, nor do I know how to unfold a definition, as you can see below. How can I get a proof that resembles the agda one below? Inductive Id (A : Type) (x : A) : A -> Type := | refl : Id A x x. (* trivial with induction *) Theorem symId {A} {x y} : Id A x y -> Id A y x. Proof.

Cubical Agda: how do I prove two things not equal

久未见 提交于 2020-05-16 06:32:08
问题 How can I prove two things are not equal in Cubical Agda? (v2.6.1, Cubical repo version acabbd9 ) Concretely, here are the integers as a higher inductive type: {-# OPTIONS --safe --warning=error --cubical --without-K #-} open import Cubical.Core.Everything open import Cubical.Foundations.Prelude module Integers where data False : Set where data ℕ : Set where zero : ℕ succ : ℕ → ℕ {-# BUILTIN NATURAL ℕ #-} data ℤ : Set where pos : ℕ → ℤ neg : ℕ → ℤ congZero : pos 0 ≡ neg 0 It's easy to show