text stringlengths 4 690k |
|---|
open import Agda.Builtin.Bool
data D : Set where
run-time : D
@0 compile-time : D
-- This code should be rejected: Both f compile-time and f run-time
-- are type-correct run-time terms.
f : @0 D → Bool
f compile-time = true
f run-time = false
|
------------------------------------------------------------------------
-- Solver for commutative ring or semiring equalities
------------------------------------------------------------------------
-- Uses ideas from the Coq ring tactic. See "Proving Equalities in a
-- Commutative Ring Done Right in Coq" by Grégoire... |
{-# OPTIONS --without-K #-}
module function.overloading {i j}{X : Set i}{Y : Set j} where
open import level
open import sum
open import overloading.core
fun-is-fun : Coercion (X → Y) (X → Y)
fun-is-fun = coerce-self _
private
module fun-methods {k}{Source : Set k}
⦃ c : Coercion Source (X → Y... |
module Base.Isomorphism where
open import Relation.Binary.PropositionalEquality using (_≡_)
-- The stdlib contains `Function.Inverse`, which seems to have a similar purpose, but is more complicated.
infix 0 _≃_
record _≃_ (A B : Set) : Set where
field
to : A → B
from : B → A
from∘to : ∀ (x : A) → fro... |
{-# OPTIONS --without-K #-}
module A where
open import Data.Nat
open import Data.Empty
open import Data.Unit
open import Data.Sum
open import Data.Product
infix 4 _≡_ -- propositional equality
infixr 10 _◎_
infixr 30 _⟷_
------------------------------------------------------------------------------
-- Our own v... |
-- 2015-02-24 Andrea Vezzosi
-- Since type constructors are considered injective by the forcing analysis we are able to define the type for the "russel" paradox:
open import Common.Product
Type = Set₁
data Box : Type -> Set where
-- The following type should be rejected, as A is not forced.
data Tree' : Set -> Typ... |
------------------------------------------------------------------------
-- The Agda standard library
--
-- Properties of These
------------------------------------------------------------------------
{-# OPTIONS --without-K --safe #-}
module Data.These.Properties where
open import Data.These
open import Function us... |
open import Oscar.Prelude
open import Oscar.Class
open import Oscar.Class.Smap
open import Oscar.Data.Fin
open import Oscar.Data.Term
open import Oscar.Data.Vec
import Oscar.Class.Surjection.⋆
module Oscar.Class.Smap.ExtensionFinExtensionTerm where
module _ {𝔭} {𝔓 : Ø 𝔭} where
open Term 𝔓
private
mutu... |
{-# OPTIONS --without-K #-}
open import Types
open import Paths
{- Stuff about truncation levels (aka h-levers) that do not require the notion
of equivalence or function extensionality -}
module HLevel {i} where
-- Definition of truncation levels
is-contr : Set i → Set i
is-contr A = Σ A (λ x → ((y : A) → y ≡ x... |
module Haskell.Prim.String where
open import Agda.Builtin.Char
open import Agda.Builtin.Unit
open import Agda.Builtin.FromString
import Agda.Builtin.String as Str
open import Haskell.Prim
open import Haskell.Prim.List
open import Haskell.Prim.Foldable
--------------------------------------------------
-- String
St... |
------------------------------------------------------------------------------
-- The McCarthy 91 function: A function with nested recursion
------------------------------------------------------------------------------
{-# OPTIONS --exact-split #-}
{-# OPTIONS --no-sized-types #-}
{-# OPTIONS -... |
-- Sample non-literate Agda program
-- ================================
--
-- A remark to test bulleted lists:
--
-- * This file serves as example for agda2lagda.
--
-- * The content may be non-sensical.
--
-- Indeed!
module Foo where
-- Some data type.
data D : Set where
c : D
-- A function.
foo : D → D
foo c = ... |
------------------------------------------------------------------------
-- The Agda standard library
--
-- Sparse polynomials in a commutative ring, encoded in Horner normal
-- form.
--
-- Horner normal form encodes a polynomial as a list of coefficients.
-- As an example take the polynomial:
--
-- 3 + 2x² + 4x⁵ + 2... |
open import Agda.Builtin.Nat
f : Nat → Nat
f v@n with n
... | zero = zero
... | suc m with m
... | zero = {!!}
... | suc o with o
... | zero = {!!}
... | suc p = {!!}
|
import Lvl
open import Type
module Type.Cardinality {ℓₗ : Lvl.Level} where
import Type.Functions
import Logic.Predicate
module _ {ℓₒ₁}{ℓₒ₂} (X : Type{ℓₒ₁}) (Y : Type{ℓₒ₂}) where
open Type.Functions{ℓₗ}{ℓₒ₁}{ℓₒ₂}
open Logic.Predicate{ℓₗ}
_≍_ : Type{ℓₗ Lvl.⊔ ℓₒ₁ Lvl.⊔ ℓₒ₂}
_≍_ = ∃(Bijective{X}{Y})
_≼_... |
{-# OPTIONS --without-K #-}
module module-layout where
f : Set1
f = Set
|
{-# OPTIONS --without-K #-}
module HoTT.Base where
open import Agda.Primitive public
-- Universe
𝒰 : (i : Level) → Set (lsuc i)
𝒰 i = Set i
𝒰₀ : Set₁
𝒰₀ = Set₀
module variables where
variable
i j : Level
A B : 𝒰 i
P Q : A → 𝒰 i
open variables
record Lift {i j} (A : 𝒰 j) : 𝒰 (i ⊔ j) where
co... |
{-# OPTIONS --without-K --rewriting #-}
open import HoTT
open import stash.modalities.JoinAdj
module stash.modalities.Orthogonality where
module PathSplit {i} (X : Type i) (x y : X) where
to : (x == y) → Σ X (λ z → (x == z) × (z == y))
to p = x , (idp , p)
from : Σ X (λ z → (x == z) × (z == y)) → x ... |
module sort where
open import bool
open import eq
open import nat
open import list
open import nondet
open import nondet-thms
-- non-deterministic insert.
--This takes a nondeterministic list because I need to be able to call it with the result of perm
--
--implementation in curry:
-- ndinsert x [] = []
-- ndinsert x... |
{-# OPTIONS --safe --warning=error --without-K #-}
open import LogicalFormulae
open import Groups.Homomorphisms.Definition
open import Groups.Definition
open import Groups.Lemmas
open import Setoids.Setoids
open import Sets.EquivalenceRelations
open import Rings.Definition
open import Rings.Homomorphisms.Definition
op... |
------------------------------------------------------------------------
-- The Agda standard library
--
-- Properties related to All
------------------------------------------------------------------------
{-# OPTIONS --without-K --safe #-}
module Data.List.Relation.Unary.All.Properties where
open import Axiom.Exte... |
------------------------------------------------------------------------
-- The Agda standard library
--
-- Least Common Multiple for integers
------------------------------------------------------------------------
{-# OPTIONS --without-K --safe #-}
module Data.Integer.LCM where
open import Data.Integer.Base
open i... |
module SortedBinaryTree where
infix 4 _≡_
data _≡_ {a} {A : Set a} (x : A) : A → Set a where
refl : x ≡ x
{-# BUILTIN EQUALITY _≡_ #-}
{-# BUILTIN REFL refl #-}
open import Sec4
postulate A : Set -- XXX: E.g., Nat or Bool some base type
-- XXX: Postulates for ≤
postulate _≤_ : A → A → Prop
... |
module Pi where
open import Agda.Builtin.Equality
using (_≡_; refl)
f
: {A : Set}
→ {x y : A}
→ (z w : A)
→ x ≡ z
→ z ≡ x
f _ _ refl
= refl
|
module Prelude.Bool.Properties where
open import Prelude.Equality
open import Prelude.Bool
open import Prelude.Decidable
open import Prelude.Empty
open import Prelude.Variables
de-morg-neg-conj : (a b : Bool) → not (a && b) ≡ (not a || not b)
de-morg-neg-conj true true = refl
de-morg-neg-conj false true = refl
de-mo... |
module Integer where
open import Data.Nat
open import Data.Nat.Properties
open import Data.Empty
open import Relation.Binary.PropositionalEquality
data ℤ₃ : Set where
ℤ₊ : ℕ → ℤ₃
ℤ₀ : ℤ₃
ℤ₋ : ℕ → ℤ₃
ℤ₊-injective : ∀ {m n} → ℤ₊ m ≡ ℤ₊ n → m ≡ n
ℤ₊-injective refl = refl
ℤ₋-injective : ∀ {m n} → ℤ₋ m ≡ ℤ₋ n → m ... |
{-# OPTIONS --without-K --safe #-}
module Categories.Adjoint.Properties where
open import Level
open import Data.Product using (Σ; _,_; -,_; proj₂; uncurry)
open import Function using (_$_)
open import Categories.Adjoint using (_⊣_; Adjoint; Hom-NI′⇒Adjoint)
open import Categories.Adjoint.RAPL public
open import Cat... |
------------------------------------------------------------------------
-- An example
------------------------------------------------------------------------
module RecursiveDescent.Hybrid.Mixfix.Example where
open import Data.Vec using ([]; _∷_; [_])
open import Data.List renaming ([_] to L[_])
open import Data.Pr... |
-- Minimal propositional logic, PHOAS approach, initial encoding
module Pi.Mp where
-- Types
infixl 2 _&&_
infixl 1 _||_
infixr 0 _=>_
data Ty : Set where
UNIT : Ty
_=>_ : Ty -> Ty -> Ty
_&&_ : Ty -> Ty -> Ty
_||_ : Ty -> Ty -> Ty
FALSE : Ty
infixr 0 _<=>_
_<=>_ : Ty -> Ty -> ... |
module Data.Num.Maximum where
open import Data.Num.Core
open import Data.Nat
open import Data.Nat.Properties
open import Data.Nat.Properties.Simple
open import Data.Nat.Properties.Extra
open import Data.Fin as Fin
using (Fin; fromℕ≤; inject≤)
renaming (zero to z; suc to s)
open import Data.Fin.Properties us... |
module Esterel.Lang.CanFunction where
open import utility
hiding (module ListSet)
open import Esterel.Lang
open import Esterel.Environment as Env
using (Env ; _←_ ; Θ ; module SigMap ; module ShrMap ; module VarMap)
open import Esterel.CompletionCode as Code
using () renaming (CompletionCode to Code)
open impor... |
{-
Groupoid quotients:
-}
{-# OPTIONS --cubical --no-import-sorts --safe #-}
module Cubical.HITs.GroupoidQuotients.Properties where
open import Cubical.HITs.GroupoidQuotients.Base
open import Cubical.Core.Everything
open import Cubical.Foundations.Prelude
open import Cubical.Foundations.Isomorphism
open import Cu... |
-- Andreas, 2016-10-09, re issue #2223
module Issue2223.Setoids where
open import Common.Level
record Setoid c ℓ : Set (lsuc (c ⊔ ℓ)) where
infix 4 _≈_
field
Carrier : Set c
_≈_ : (x y : Carrier) → Set ℓ
_⟨_⟩_ : ∀ {a b c} {A : Set a} {B : Set b} {C : Set c} →
A → (A → B → C) → B ... |
{-# OPTIONS --safe #-}
module Cubical.Foundations.Pointed.Properties where
open import Cubical.Foundations.Prelude
open import Cubical.Foundations.Pointed.Base
open import Cubical.Foundations.Function
open import Cubical.Foundations.GroupoidLaws
open import Cubical.Foundations.Isomorphism
open import Cubical.Foundatio... |
-- Andreas, 2013-09-17
module DoNotEtaContractFunIntoRecord where
record _×_ (A B : Set) : Set where
constructor _,_
field
fst : A
snd : B
postulate
A : Set
B : Set
P : (B → A × B) → Set
goal : (x : A) → P (λ y → x , y)
goal x = {!!}
-- Goal should be displayed as
-- P (λ y → x , y)
-- rather th... |
{- Byzantine Fault Tolerant Consensus Verification in Agda, version 0.9.
Copyright (c) 2020, 2021, Oracle and/or its affiliates.
Licensed under the Universal Permissive License v 1.0 as shown at https://opensource.oracle.com/licenses/upl
-}
open import LibraBFT.Prelude
open import LibraBFT.Lemmas
open import Lib... |
{- An adaptation of Edwin Brady and Kevin Hammond's paper Scrapping your inefficient engine ... -}
{-# OPTIONS --type-in-type #-}
module tests.Cat where
open import Prelude.Bool
open import Prelude.Bot
open import Prelude.IO
open import Prelude.Fin
open import Prelude.Eq
open import Prelude.Nat
open import Prelude.Pro... |
{-# OPTIONS --cubical --postfix-projections --safe #-}
open import Relation.Binary
open import Prelude
module Data.List.Sort.MergeSort {e} {E : Type e} {r₁ r₂} (totalOrder : TotalOrder E r₁ r₂) where
open TotalOrder totalOrder hiding (refl)
open import Data.List.Sort.InsertionSort totalOrder using (insert; insert-s... |
import Structure.Logic.Classical.NaturalDeduction
module Structure.Logic.Classical.NaturalDeduction.Proofs {ℓₗ} {Formula} {ℓₘₗ} {Proof} {ℓₒ} {Domain} ⦃ classicLogic : _ ⦄ where
open Structure.Logic.Classical.NaturalDeduction.ClassicalLogic {ℓₗ} {Formula} {ℓₘₗ} {Proof} {ℓₒ} {Domain} (classicLogic)
open import Function... |
{-# OPTIONS --without-K #-}
-- Note that this is properly named, but it does depend on our version of
-- Equiv and TypeEquiv for a number of things.
module Data.SumProd.Properties where
open import Data.Empty using (⊥)
open import Data.Unit using (⊤)
open import Data.Sum using (_⊎_; inj₁; inj₂) renaming (ma... |
{-# OPTIONS --universe-polymorphism #-}
open import Categories.Category
module Categories.Object.Product {o ℓ e} (C : Category o ℓ e) where
open Category C
open Equiv
open import Function using (flip)
open import Level
open import Function using (flip)
open import Categories.Support.PropositionalEquality
open impor... |
module Issue280 where
data PreModel (C : Set) (M : C → Set) : Set → Set where
model : (c : C) → PreModel C M (M c)
reflect : (C : Set)(M : C → Set) → PreModel C M C → C
reflect .(M c) M (model c) = c
|
module Div where
data True : Set where
trivial : True
data False : Set where
data Nat : Set where
zero : Nat
suc : Nat -> Nat
NonZero : Nat -> Set
NonZero zero = False
NonZero (suc _) = True
divHelp : Nat -> Nat -> Nat -> Nat
divHelp zero zero c = suc zero
divHelp zero (suc y) c = zero
divHelp ... |
{-# OPTIONS -v treeless.opt.final:20 -v 0 #-}
module Word where
open import Agda.Builtin.Nat
open import Agda.Builtin.Bool
open import Agda.Builtin.Word renaming (primWord64ToNat to toNat)
open import Agda.Builtin.Equality
open import Agda.Builtin.Unit
open import Agda.Builtin.IO
open import Agda.Builtin.FromNat
open ... |
{-# OPTIONS --cubical --safe #-}
module Data.Sigma.Base where
open import Agda.Builtin.Sigma
using (Σ; _,_; fst; snd)
public
open import Level
open import Path
∃ : ∀ {a b} {A : Type a} (B : A → Type b) → Type (a ℓ⊔ b)
∃ {A = A} = Σ A
infixr 4.5 ∃-syntax
∃-syntax : ∀ {a b} {A : Type a} (B : A → Type b) → Type (a... |
{-# OPTIONS --safe --without-K #-}
module Data.Unit.UniversePolymorphic where
open import Level
record ⊤ {ℓ} : Type ℓ where instance constructor tt
|
{-# OPTIONS --safe --experimental-lossy-unification #-}
module Cubical.Algebra.Polynomials.Multivariate.EquivCarac.Polyn-nPoly where
open import Cubical.Foundations.Prelude
open import Cubical.Foundations.Equiv
open import Cubical.Data.Nat renaming (_+_ to _+n_; _·_ to _·n_)
open import Cubical.Data.Vec
open import C... |
------------------------------------------------------------------------
-- Weakening for the NBE values
------------------------------------------------------------------------
import Axiom.Extensionality.Propositional as E
import Level
open import Data.Universe
-- The code makes use of the assumption that propositi... |
{-# OPTIONS --without-K --safe #-}
module Categories.Category.Construction.Grothendieck where
-- The construction of a 1-Category from a (contravariant)
-- pseudofunctor into Cats (as a bicategory)
open import Level
open import Data.Product using (Σ; _,_)
open import Function using (_$_)
open import Relation.Binary u... |
------------------------------------------------------------------------
-- Embeddings
------------------------------------------------------------------------
-- Partially following the HoTT book.
{-# OPTIONS --without-K --safe #-}
open import Equality
module Embedding
{reflexive} (eq : ∀ {a p} → Equality-with-J... |
open import Relation.Binary.Core
module Heapsort.Impl1 {A : Set}
(_≤_ : A → A → Set)
(tot≤ : Total _≤_)
(trans≤ : Transitive _≤_) where
open import BBHeap _≤_ hiding (flatten)
open import BBHeap.Heapify _≤_ tot≤ trans≤
open import BHeap _≤_ hiding (flatten)
open... |
module jarsec where
open import Algebra
open import Data.Bool
open import Data.Char
-- open import Data.Empty
-- open import Data.Fin
open import Data.List
open import Data.Maybe hiding (map)
open import Data.Nat
open import Data.Nat.Base
open import Data.Nat.Show
-- open import Data.Integer
open import Data.Product h... |
{-# OPTIONS --without-K #-}
open import HoTT.Base
open import HoTT.Equivalence
open import HoTT.Identity
module HoTT.Identity.Pi where
open variables
private variable f g h : Π A P
module _ {f g : Π A P} where
-- Axiom 2.9.3 - function extensionality
postulate
happly-isequiv : isequiv (happly {f = f} {g})
... |
open import MJ.Types
import MJ.Classtable.Core as Core
module MJ.Syntax.Untyped {c}(Ct : Core.Classtable c) where
open import Prelude
open import Data.Maybe as Maybe using (Maybe; just; nothing)
open import Data.Maybe.All as MayAll
open import Data.Vec as Vec hiding (_∈_)
open import Data.Star
open import Data.List.M... |
module DefinitionalEquality where
data _==_ {A : Set}(x : A) : A -> Set where
refl : x == x
subst : {A : Set}(P : A -> Set){x y : A} -> x == y -> P y -> P x
subst {A} P refl p = p
data Nat : Set where
zero : Nat
suc : Nat -> Nat
_+_ : Nat -> Nat -> Nat
zero + m = m
suc n + m = suc (n + m)
-- This formulat... |
-- Agda program using the Iowa Agda library
open import bool
module PROOF-odddoublecoin
(Choice : Set)
(choose : Choice → 𝔹)
(lchoice : Choice → Choice)
(rchoice : Choice → Choice)
where
open import eq
open import nat
open import list
open import maybe
----------------------------------------------------... |
{-# OPTIONS -v treeless:20 #-}
module _ where
open import Common.Prelude
f : List Nat → List Nat → Nat
f _ [] = 0
f [] (y ∷ ys) = y
f (x ∷ xs) _ = x
main : IO Unit
main = printNat (f [] [])
,, printNat (f (1 ∷ []) [])
,, printNat (f [] (2 ∷ []))
,, printNat (f (3 ∷ []) (4 ∷ []))... |
module Cats.Category.Product.Binary where
open import Level using (_⊔_)
open import Relation.Binary using (Rel ; IsEquivalence ; _Preserves₂_⟶_⟶_)
open import Relation.Binary.Product.Pointwise using (×-isEquivalence ; Pointwise)
open import Cats.Category.Base
open import Cats.Util.Logic.Constructive using (_∧_ ; _,_... |
module Substitution where
open import Library
open import Terms
-- VarTm n specifies whether the substitution produces variables or terms.
-- The index is used to impose an order on the constructors
-- and so pass termination checking in lift/subst.
data VarTm : ℕ → Set where
`Var : VarTm 0
`Tm : VarTm 1
max01... |
-- Andreas, 2014-09-23, later changed by someone else
-- Issue 1194, reported by marco.vax91, 2014-06-13
module _ where
module A where
data D₁ : Set where
b : D₁
c : D₁ → D₁
infix 19 c
syntax c x = ! x
module B where
data D₂ : Set where
_+_ : D₂ → D₂ → D₂
c : A.D₁ → D₂
infix 10 _+_
... |
-- Andreas, 2017-11-01, issue #2831
-- The following pragma should trigger a warning, since the mutual block
-- does not contain anything the pragma could apply to.
{-# NO_POSITIVITY_CHECK #-}
mutual
postulate
A : Set
-- EXPECTED WARNING:
-- No positivity checking pragmas can only precede a data/record
-- defi... |
open import Agda.Builtin.Unit
module Imports.Issue5583 (_ : ⊤) where
it : ∀ {A : Set} → ⦃ A ⦄ → A
it ⦃ x ⦄ = x
data X : Set where
instance x : X
|
module Issue1760d where
-- Skipping a new-style mutual block: Anywhere before the declaration or
-- the definition of a data/record in the block (case: record).
{-# NO_POSITIVITY_CHECK #-}
record U₁ : Set
data D₁ : Set
record U₁ where
field ap : U₁ → U₁
data D₁ where
lam : (D₁ → D₁) → D₁
-- Skipping a new-sty... |
module IPC.Metatheory.Gentzen-BasicTarski where
open import IPC.Syntax.Gentzen public
open import IPC.Semantics.BasicTarski public
-- Soundness with respect to all models, or evaluation.
eval : ∀ {A Γ} → Γ ⊢ A → Γ ⊨ A
eval (var i) γ = lookup i γ
eval (lam t) γ = λ a → eval t (γ , a)
eval (app t u) γ = ... |
------------------------------------------------------------------------
-- The Agda standard library
--
-- Correctness proofs for container combinators
------------------------------------------------------------------------
{-# OPTIONS --without-K --safe #-}
module Data.Container.Combinator.Properties where
open i... |
-- Occurs there are several ways to parse a left-hand side.
module AmbiguousParseForLHS where
data X : Set where
if_then_else_ : X -> X -> X -> X
if_then_ : X -> X -> X
x : X
bad : X -> X
bad (if x then if x then x else x) = x
bad _ = if x then x
|
{-# OPTIONS --without-K --rewriting #-}
open import lib.Basics
open import lib.types.Truncation
module lib.Function2 where
is-surj : ∀ {i j} {A : Type i} {B : Type j} (f : A → B) → Type (lmax i j)
is-surj {A = A} f = ∀ b → Trunc -1 (hfiber f b)
module _ {i j k} {A : Type i} {B : Type j} {C : Type k}
{f : A → B} {... |
-- Not using any Floats so shouldn't need ieee754 installed.
-- .flags file contains
-- -c --ghc-flag="-hide-package ieee754"
module _ where
open import Agda.Builtin.IO
open import Agda.Builtin.Unit
postulate
return : {A : Set} → A → IO A
{-# COMPILE GHC return = \ _ -> return #-}
main : IO ⊤
main = return _
|
module Impure.STLCRef.Eval where
open import Prelude
open import Data.Product
open import Data.List
open import Data.List.Reverse
open import Data.Nat
open import Data.Fin hiding (_<_)
open import Extensions.List as L
open import Impure.STLCRef.Syntax
open import Impure.STLCRef.Welltyped
_!!_ : ∀ {n i} → (μ : Store... |
module STLC.Kovacs.NormalForm where
open import STLC.Kovacs.Embedding public
open import Category
--------------------------------------------------------------------------------
mutual
-- (Nfₑ)
renⁿᶠ : ∀ {Γ Γ′ A} → Γ′ ⊇ Γ → Γ ⊢ⁿᶠ A → Γ′ ⊢ⁿᶠ A
renⁿᶠ η (ƛ M) = ƛ (renⁿᶠ (liftₑ η) M)
renⁿᶠ η (ne M) = ne (ren... |
------------------------------------------------------------------------------
-- Properties related with the group commutator
------------------------------------------------------------------------------
{-# OPTIONS --exact-split #-}
{-# OPTIONS --no-sized-types #-}
{-# OPTIONS --no-universe-p... |
module BTA9 where
----------------------------------------------
-- Preliminaries: Imports and List-utilities
----------------------------------------------
open import Data.Nat hiding (_<_;_⊔_;_*_;equal)
open import Data.Bool hiding (_∧_;_∨_)
open import Function using (_∘_)
open import Data.List
open import Data... |
{-# OPTIONS --without-K --exact-split #-}
module subgroups where
import 15-groups
open 15-groups public
{- Subsets of groups -}
subset-Group :
(l : Level) {l1 : Level} (G : Group l1) → UU ((lsuc l) ⊔ l1)
subset-Group l G = type-Group G → UU-Prop l
is-set-subset-Group :
(l : Level) {l1 : Level} (G : Group l1) →... |
module Basic.AST where
import Data.Bool as Bool using (not)
open import Data.Bool hiding (not; if_then_else_)
open import Data.Fin using (Fin; suc; zero; #_)
open import Data.Nat
open import Data.Vec
open import Relation.Nullary
open import Relation.Nullary.Decidable
open import Utils.Decidable
{-
This module cove... |
{-# OPTIONS --without-K --safe #-}
module Categories.Adjoint.Compose where
-- Composition of Adjoints
open import Level
open import Data.Product using (_,_; _×_)
open import Function using (_$_) renaming (_∘_ to _∙_)
open import Function.Equality using (Π; _⟶_)
import Function.Inverse as FI
open import Relation.Bina... |
module #6 where
open import Level
open import Data.Bool
open import Relation.Binary.PropositionalEquality
{-
Exercise 1.6. Show that if we define A × B :≡ ∏(x:2) rec2(U, A, B, x), then we can give a
definition of indA×B for which the definitional equalities stated in §1.5 hold propositionally (i.e. using equality
t... |
{-# OPTIONS --without-K #-}
module sets.finite.infinite where
open import sum
open import equality.core
open import function.isomorphism.core
open import function.isomorphism.utils
open import sets.nat
open import sets.empty
open import sets.unit
open import sets.fin.core
open import sets.fin.properties
open import se... |
------------------------------------------------------------------------
-- The Agda standard library
--
-- This module is DEPRECATED. Please use `Algebra` or `Algebra.Core`
-- instead.
------------------------------------------------------------------------
{-# OPTIONS --without-K --safe #-}
module Algebra.FunctionP... |
{- Byzantine Fault Tolerant Consensus Verification in Agda, version 0.9.
Copyright (c) 2021, Oracle and/or its affiliates.
Licensed under the Universal Permissive License v 1.0 as shown at https://opensource.oracle.com/licenses/upl
-}
open import LibraBFT.Base.Types
import LibraBFT.Impl.Consensus.RecoveryD... |
{-# OPTIONS --safe #-}
module Generics.Constructions.Injective where
open import Generics.Prelude hiding (lookup; pi; curry; icong)
open import Generics.Telescope
open import Generics.Desc
open import Generics.All
open import Generics.HasDesc
open import Relation.Binary.PropositionalEquality.Properties
PathOver : ∀ ... |
{-# OPTIONS --cubical --safe #-}
module Data.Nat.Properties where
open import Data.Nat.Base
open import Agda.Builtin.Nat using () renaming (_<_ to _<ᴮ_; _==_ to _≡ᴮ_) public
open import Prelude
open import Cubical.Data.Nat using (caseNat; znots; snotz; injSuc) public
pred : ℕ → ℕ
pred (suc n) = n
pred zero = zero
c... |
{- Byzantine Fault Tolerant Consensus Verification in Agda, version 0.9.
Copyright (c) 2021 Oracle and/or its affiliates.
Licensed under the Universal Permissive License v 1.0 as shown at https://opensource.oracle.com/licenses/upl
-}
open import LibraBFT.Prelude
open import LibraBFT.Base.PKCS
open import LibraBF... |
-- {-# OPTIONS -v tc.constr.findInScope:50 #-}
module 06-listEquality where
infixr 5 _∷_
data List (A : Set) : Set where
[] : List A
_∷_ : (x : A) (xs : List A) → List A
data Bool : Set where
true : Bool
false : Bool
id : {A : Set} → A → A
id v = v
or : Bool → Bool → Bool
or true _ = true
or _ true = true... |
-- Proof: insertion sort computes a permutation of the input list
module sortnat where
open import bool
open import eq
open import nat
open import list
open import nondet
open import nondet-thms
-- non-deterministic insert.
--This takes a nondeterministic list because I need to be able to call it with the result of ... |
open import Common.Prelude hiding (tt)
open import Common.Reflection
open import Common.Equality
tt : ⊤
tt = record{}
NoConf : Nat → Nat → Set
NoConf zero zero = ⊤
NoConf zero (suc n) = ⊥
NoConf (suc m) zero = ⊥
NoConf (suc m) (suc n) = m ≡ n
pattern `Nat = def (quote Nat) []
infixr 0 Π
syntax Π x a b = [ x ∈ a ]→... |
module z where
------------------------------------------------------------------------------
-- inductive data types and function that are defined by pattern matching
data ℕ : Set where
zero : ℕ
suc : ℕ → ℕ
_+_ : ℕ → ℕ → ℕ
zero + n = n
suc m + n = suc (m + n)
data List {ℓ} (A : Set ℓ) : Set ℓ where
... |
------------------------------------------------------------------------
-- The Agda standard library
--
-- Converting reflection machinery to strings
------------------------------------------------------------------------
-- Note that Reflection.termErr can also be used directly in tactic
-- error messages.
{-# OPT... |
{-# OPTIONS --copatterns #-}
module CoinductiveUnitRecord where
import Common.Level
open import Common.Equality
record Unit : Set where
coinductive
constructor delay
field force : Unit
open Unit
good : Unit
force good = good
bad : Unit
bad = delay bad
-- should not termination check ...
bad' : Unit
bad' = de... |
{-# OPTIONS --cubical --safe #-}
module Data.Nat.Fold where
open import Prelude
open import Data.Nat
foldr-ℕ : (A → A) → A → ℕ → A
foldr-ℕ f b zero = b
foldr-ℕ f b (suc n) = f (foldr-ℕ f b n)
foldr-ℕ-universal : ∀ (h : ℕ → A) f x →
(h zero ≡ x) →
(∀ n → h (suc n) ≡ f (h n)) →
... |
{-# OPTIONS --prop --without-K --rewriting #-}
module Calf.Prelude where
open import Agda.Builtin.Equality
open import Agda.Builtin.Equality.Rewrite public
Ω = Prop
□ = Set
postulate
funext : ∀ {a b} {A : Set a} {B : A → Set b} {f g : (a : A) → B a} → (∀ x → f x ≡ g x) → f ≡ g
funext/Ω : {A : Prop} {B : □} {f g... |
{-# OPTIONS --cubical --safe #-}
module Data.Binary.FromZeroed where
open import Data.Binary.Definition
open import Prelude
inc-z : 𝔹 → 𝔹
inc-z 0ᵇ = 2ᵇ 0ᵇ
inc-z (1ᵇ xs) = 2ᵇ xs
inc-z (2ᵇ xs) = 1ᵇ inc-z xs
toZ : 𝔹 → 𝔹
toZ 0ᵇ = 0ᵇ
toZ (1ᵇ xs) = 2ᵇ toZ xs
toZ (2ᵇ xs) = 1ᵇ inc-z (toZ xs)
ones : ℕ → 𝔹 → 𝔹
ones ze... |
open import bool
open import bool-thms2
open import eq
open import product
open import product-thms
open import bool-relations
module minmax {A : Set} (_≤A_ : A → A → 𝔹)
(≤A-trans : transitive _≤A_)
(≤A-total : total _≤A_) where
≤A-refl : reflexive _≤A_
≤A-refl = total-reflexive _≤A_ ≤A-... |
module 020-equivalence where
-- We need False to represent logical contradiction.
open import 010-false-true
-- Next, we need to be able to work with equalities. Equalities are
-- defined between objects of the same type. Two objects are equal if
-- we have a proof of their equality. In Agda, we can represent this
-... |
import Issue2447.M
Rejected : Set
Rejected = Set
|
------------------------------------------------------------------------
-- The Agda standard library
--
-- Some Vec-related properties that depend on the K rule or make use
-- of heterogeneous equality
------------------------------------------------------------------------
{-# OPTIONS --with-K --safe #-}
module Dat... |
{-# OPTIONS --without-K --exact-split #-}
module 17-number-theory where
import 16-sets
open 16-sets public
-- Section 10.1 Decidability.
{- Recall that a proposition P is decidable if P + (¬ P) holds. -}
classical-Prop :
(l : Level) → UU (lsuc l)
classical-Prop l = Σ (UU-Prop l) (λ P → is-decidable (pr1 P))
is-... |
-- Check that the termination checker can handle recursive
-- calls on subterms which aren't simply variables.
module SubtermTermination where
data N : Set where
zero : N
suc : N → N
f : N → N
f (suc zero) = f zero
f _ = zero
data One? : N → Set where
one : One? (suc zero)
other : ∀ {n} → One? n
-... |
------------------------------------------------------------------------------
-- The paradoxical combinator
------------------------------------------------------------------------------
{-# OPTIONS --exact-split #-}
{-# OPTIONS --no-sized-types #-}
{-# OPTIONS --no-universe-polymorphism #-}
{-... |
{-# OPTIONS --cubical --safe #-}
module Data.Vec.Inductive where
open import Prelude
open import Data.List using (List; _∷_; []; length)
private
variable
n m : ℕ
infixr 5 _∷_
data Vec (A : Type a) : ℕ → Type a where
[] : Vec A 0
_∷_ : A → Vec A n → Vec A (suc n)
foldr : ∀ {p} (P : ℕ → Type p) →
... |
{-
Finitely presented algebras.
An R-algebra A is finitely presented, if there merely is an exact sequence
of R-modules:
(f₁,⋯,fₘ) → R[X₁,⋯,Xₙ] → A → 0
(where f₁,⋯,fₘ ∈ R[X₁,⋯,Xₙ])
-}
{-# OPTIONS --safe #-}
module Cubical.Algebra.CommAlgebra.FPAlgebra where
open import Cubical.Foundations.Prelude
open im... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.