Search is not available for this dataset
text
string | meta
dict |
---|---|
module _ where
open import Common.Prelude renaming (_+_ to _+N_)
open import Common.Integer
diff : Nat β Nat β Integer
diff a zero = pos a
diff zero (suc b) = negsuc b
diff (suc a) (suc b) = diff a b
_+_ : Integer β Integer β Integer
pos a + pos b = pos (a +N b)
pos a + negsuc b = diff a (suc b)
negsuc a + pos b = diff b (suc a)
negsuc a + negsuc b = negsuc (suc a +N b)
printInt : Integer β IO Unit
printInt n = putStrLn (intToString n)
main : IO Unit
main = printInt (pos 42 + pos 58) ,,
printInt (pos 42 + negsuc 141) ,,
printInt (pos 42 + negsuc 31) ,,
printInt (negsuc 42 + pos 143) ,,
printInt (negsuc 42 + pos 33) ,,
printInt (negsuc 42 + negsuc 56)
| {
"alphanum_fraction": 0.595890411,
"avg_line_length": 26.0714285714,
"ext": "agda",
"hexsha": "0ba399540897dcbde387e3ca1b1d243171286248",
"lang": "Agda",
"max_forks_count": 371,
"max_forks_repo_forks_event_max_datetime": "2022-03-30T19:00:30.000Z",
"max_forks_repo_forks_event_min_datetime": "2015-01-03T14:04:08.000Z",
"max_forks_repo_head_hexsha": "7f58030124fa99dfbf8db376659416f3ad8384de",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "cruhland/agda",
"max_forks_repo_path": "test/Compiler/simple/BuiltinInt.agda",
"max_issues_count": 4066,
"max_issues_repo_head_hexsha": "7f58030124fa99dfbf8db376659416f3ad8384de",
"max_issues_repo_issues_event_max_datetime": "2022-03-31T21:14:49.000Z",
"max_issues_repo_issues_event_min_datetime": "2015-01-10T11:24:51.000Z",
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "cruhland/agda",
"max_issues_repo_path": "test/Compiler/simple/BuiltinInt.agda",
"max_line_length": 49,
"max_stars_count": 1989,
"max_stars_repo_head_hexsha": "7f58030124fa99dfbf8db376659416f3ad8384de",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "cruhland/agda",
"max_stars_repo_path": "test/Compiler/simple/BuiltinInt.agda",
"max_stars_repo_stars_event_max_datetime": "2022-03-30T18:20:48.000Z",
"max_stars_repo_stars_event_min_datetime": "2015-01-09T23:51:16.000Z",
"num_tokens": 270,
"size": 730
} |
{-# OPTIONS --without-K --rewriting #-}
open import HoTT renaming (pt to ptβ)
open import cw.CW
module cw.FinCW where
record AttachedFinSkeleton n (Skel : Typeβ) (Real : Skel β Skeleton n) : Typeβ where
constructor attached-fin-skeleton
field
skel : Skel
numCells : β
attaching : Attaching β¦ Real skel β§ (Fin numCells) (Sphere n)
FinSkeleton : β β Typeβ
FinSkeleton-realize : {n : β} β FinSkeleton n β Skeleton n
FinSkeleton O = β
FinSkeleton (S n) = AttachedFinSkeleton n (FinSkeleton n) FinSkeleton-realize
FinSkeleton-realize {n = O} n = Fin n , Fin-is-set
FinSkeleton-realize {n = S n} (attached-fin-skeleton _ s Ξ±) =
attached-skeleton _ (Fin s , Fin-is-set) Ξ±
β¦_β¦ = FinSkeleton-realize
-- Pointedness
-- this function is needed for pointedness
fcw-head : β {n : β} β FinSkeleton n β Typeβ
fcw-head = cw-head β FinSkeleton-realize
fcw-head-has-dec-eq : β {n : β} (fin-skel : FinSkeleton n)
β has-dec-eq (fcw-head fin-skel)
fcw-head-has-dec-eq {n = 0} _ = Fin-has-dec-eq
fcw-head-has-dec-eq {n = S n} (attached-fin-skeleton skel _ _) =
fcw-head-has-dec-eq skel
-- this function is needed for pointedness
fcw-incl^ : β {n : β} (skel : FinSkeleton n)
β fcw-head skel β β¦ β¦ skel β¦ β§
fcw-incl^ fin-skel = incl^ (FinSkeleton-realize fin-skel)
-- disjointly pointed skeletons
record βFinSkeleton (n : β) : Typeβ where
constructor βfin-skeleton
field
skel : FinSkeleton n
pt : fcw-head skel
βFinSkeleton-realize : {n : β} β βFinSkeleton n β βSkeleton {i = lzero} n
βFinSkeleton-realize (βfin-skeleton skel pt) =
βskeleton (FinSkeleton-realize skel) pt (fcw-head-has-dec-eq skel pt)
ββ¦_β¦ : {n : β} β βFinSkeleton n β βSkeleton {i = lzero} n
ββ¦_β¦ = βFinSkeleton-realize
-- Take a prefix of a skeleton
fcw-init : β {n} β FinSkeleton (S n) β FinSkeleton n
fcw-init (attached-fin-skeleton skel _ _) = skel
βfcw-init : β {n} β βFinSkeleton (S n) β βFinSkeleton n
βfcw-init (βfin-skeleton skel pt) = βfin-skeleton (fcw-init skel) pt
-- Extra conditions on CW complexes
-- 1. decidable equalities
FinSkeleton-has-cells-with-dec-eq : β {n} (fin-skel : FinSkeleton n)
β has-cells-with-dec-eq (FinSkeleton-realize fin-skel)
FinSkeleton-has-cells-with-dec-eq {n = O} fin-skel = Fin-has-dec-eq
FinSkeleton-has-cells-with-dec-eq {n = S n} fin-skel =
FinSkeleton-has-cells-with-dec-eq (fcw-init fin-skel) , Fin-has-dec-eq
βFinSkeleton-has-cells-with-dec-eq : β {n} (βfin-skel : βFinSkeleton n)
β βhas-cells-with-dec-eq (βFinSkeleton-realize βfin-skel)
βFinSkeleton-has-cells-with-dec-eq βfin-skel = FinSkeleton-has-cells-with-dec-eq _
-- 2. choice
FinSkeleton-has-cells-with-choice : β t {n} (fin-skel : FinSkeleton n) j
β has-cells-with-choice t (FinSkeleton-realize fin-skel) j
FinSkeleton-has-cells-with-choice t {n = O} fin-skel j = Fin-has-choice t j
FinSkeleton-has-cells-with-choice t {n = S n} fin-skel j =
FinSkeleton-has-cells-with-choice t (fcw-init fin-skel) j , Fin-has-choice t j
βFinSkeleton-has-cells-with-choice : β t {n} (fin-skel : βFinSkeleton n) j
β βhas-cells-with-choice t (βFinSkeleton-realize fin-skel) j
βFinSkeleton-has-cells-with-choice t fin-skel j = FinSkeleton-has-cells-with-choice t _ j
| {
"alphanum_fraction": 0.6897637795,
"avg_line_length": 34.8901098901,
"ext": "agda",
"hexsha": "7152828740176501526475aee5bdabeed489c298",
"lang": "Agda",
"max_forks_count": 50,
"max_forks_repo_forks_event_max_datetime": "2022-02-14T03:03:25.000Z",
"max_forks_repo_forks_event_min_datetime": "2015-01-10T01:48:08.000Z",
"max_forks_repo_head_hexsha": "66f800adef943afdf08c17b8ecfba67340fead5e",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "timjb/HoTT-Agda",
"max_forks_repo_path": "theorems/cw/FinCW.agda",
"max_issues_count": 31,
"max_issues_repo_head_hexsha": "66f800adef943afdf08c17b8ecfba67340fead5e",
"max_issues_repo_issues_event_max_datetime": "2021-10-03T19:15:25.000Z",
"max_issues_repo_issues_event_min_datetime": "2015-03-05T20:09:00.000Z",
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "timjb/HoTT-Agda",
"max_issues_repo_path": "theorems/cw/FinCW.agda",
"max_line_length": 89,
"max_stars_count": 294,
"max_stars_repo_head_hexsha": "66f800adef943afdf08c17b8ecfba67340fead5e",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "timjb/HoTT-Agda",
"max_stars_repo_path": "theorems/cw/FinCW.agda",
"max_stars_repo_stars_event_max_datetime": "2022-03-20T13:54:45.000Z",
"max_stars_repo_stars_event_min_datetime": "2015-01-09T16:23:23.000Z",
"num_tokens": 1135,
"size": 3175
} |
-- binary search trees (not balanced)
open import bool
open import bool-thms2
open import eq
open import maybe
open import product
open import product-thms
open import bool-relations using (transitive ; total)
module bst (A : Set) (_β€A_ : A β A β πΉ)
(β€A-trans : transitive _β€A_)
(β€A-total : total _β€A_) where
open import bool-relations _β€A_ hiding (transitive ; total)
open import minmax _β€A_ β€A-trans β€A-total
data bst : A β A β Set where
bst-leaf : β {l u : A} β l β€A u β‘ tt β bst l u
bst-node : β {l l' u' u : A}(d : A) β
bst l' d β bst d u' β
l β€A l' β‘ tt β u' β€A u β‘ tt β
bst l u
-- find a node which is isomorphic (_=A_) to d and return it; or else return nothing
bst-search : β{l u : A}(d : A) β bst l u β maybe (Ξ£ A (Ξ» d' β d isoπΉ d' β‘ tt))
bst-search d (bst-leaf _) = nothing
bst-search d (bst-node d' L R _ _) with keep (d β€A d')
bst-search d (bst-node d' L R _ _) | tt , p1 with keep (d' β€A d)
bst-search d (bst-node d' L R _ _) | tt , p1 | tt , p2 = just (d' , isoπΉ-intro p1 p2)
bst-search d (bst-node d' L R _ _) | tt , p1 | ff , p2 = bst-search d L
bst-search d (bst-node d' L R _ _) | ff , p1 = bst-search d R
bst-dec-lb : β {l l' u' : A} β bst l' u' β l β€A l' β‘ tt β bst l u'
bst-dec-lb (bst-leaf p) q = bst-leaf (β€A-trans q p)
bst-dec-lb (bst-node d L R p1 p2) q = bst-node d L R (β€A-trans q p1) p2
bst-inc-ub : β {l' u' u : A} β bst l' u' β u' β€A u β‘ tt β bst l' u
bst-inc-ub (bst-leaf p) q = bst-leaf (β€A-trans p q)
bst-inc-ub (bst-node d L R p1 p2) q = bst-node d L R p1 (β€A-trans p2 q)
bst-insert : β{l u : A}(d : A) β bst l u β bst (min d l) (max d u)
bst-insert d (bst-leaf p) = bst-node d (bst-leaf β€A-refl) (bst-leaf β€A-refl) min-β€1 max-β€1
bst-insert d (bst-node d' L R p1 p2) with keep (d β€A d')
bst-insert d (bst-node d' L R p1 p2) | tt , p with bst-insert d L
bst-insert d (bst-node d' L R p1 p2) | tt , p | L' rewrite p =
bst-node d' L' (bst-inc-ub R (β€A-trans p2 max-β€2)) (min2-mono p1) β€A-refl
bst-insert d (bst-node d' L R p1 p2) | ff , p with bst-insert d R
bst-insert d (bst-node d' L R p1 p2) | ff , p | R' rewrite p =
bst-node d' (bst-dec-lb L p1) R' min-β€2 (max2-mono p2)
| {
"alphanum_fraction": 0.5747387551,
"avg_line_length": 41.5283018868,
"ext": "agda",
"hexsha": "b3f8197f02d5ed9e2d4fd35b142177b0967b074e",
"lang": "Agda",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "2ad96390a9be5c238e73709a21533c7354cedd0c",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "logicshan/IAL",
"max_forks_repo_path": "bst.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "2ad96390a9be5c238e73709a21533c7354cedd0c",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "logicshan/IAL",
"max_issues_repo_path": "bst.agda",
"max_line_length": 90,
"max_stars_count": null,
"max_stars_repo_head_hexsha": "2ad96390a9be5c238e73709a21533c7354cedd0c",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "logicshan/IAL",
"max_stars_repo_path": "bst.agda",
"max_stars_repo_stars_event_max_datetime": null,
"max_stars_repo_stars_event_min_datetime": null,
"num_tokens": 891,
"size": 2201
} |
{-
https://github.com/mietek/hilbert-gentzen
An Agda formalisation of IPC, IS4, ICML, and ILP. Work in progress.
Made by MiΓ«tek Bak. Published under the MIT X11 license.
-}
module Everything where
import Common
import Common.Context
import Common.ContextPair
import Common.Predicate
import Common.PredicateBasedContext
import Common.Semantics
import Common.UntypedContext
-- Basic intuitionistic propositional calculus, without β¨ or β₯.
-- Common syntax.
import BasicIPC.Syntax.Common
-- Hilbert-style formalisation of closed syntax.
import BasicIPC.Syntax.ClosedHilbertSequential -- Sequences of terms.
import BasicIPC.Syntax.ClosedHilbert -- Nested terms.
-- Hilbert-style formalisation of syntax.
import BasicIPC.Syntax.HilbertSequential -- Sequences of terms.
import BasicIPC.Syntax.Hilbert -- Nested terms.
-- Gentzen-style formalisation of syntax.
import BasicIPC.Syntax.Gentzen -- Simple terms.
import BasicIPC.Syntax.GentzenNormalForm -- Normal forms and neutrals.
import BasicIPC.Syntax.GentzenSpinalNormalForm -- Normal forms, neutrals, and spines.
-- Translation between different formalisations of syntax.
import BasicIPC.Syntax.Translation
-- Basic Tarski-style semantics, for soundness only.
import BasicIPC.Semantics.BasicTarski
-- Tarski-style semantics with glueing for Ξ± and β», after Coquand-Dybjer.
import BasicIPC.Semantics.TarskiGluedClosedImplicit -- Implicit closed syntax.
import BasicIPC.Semantics.TarskiGluedClosedHilbert -- Hilbert-style closed syntax.
-- Tarski-style semantics with contexts as concrete worlds, and glueing for Ξ± and β».
import BasicIPC.Semantics.TarskiConcreteGluedImplicit -- Implicit syntax.
import BasicIPC.Semantics.TarskiConcreteGluedHilbert -- Hilbert-style syntax.
import BasicIPC.Semantics.TarskiConcreteGluedGentzen -- Gentzen-style syntax.
-- Kripke-style semantics with contexts as concrete worlds, and glueing for Ξ± and β».
import BasicIPC.Semantics.KripkeConcreteGluedImplicit -- Implicit syntax.
import BasicIPC.Semantics.KripkeConcreteGluedHilbert -- Hilbert-style syntax.
import BasicIPC.Semantics.KripkeConcreteGluedGentzen -- Gentzen-style syntax.
-- Kripke-style semantics with contexts as concrete worlds.
import BasicIPC.Semantics.KripkeConcrete
-- Kripke-style semantics with abstract worlds.
import BasicIPC.Semantics.KripkeMcKinseyTarski -- McKinsey-Tarski embedding.
import BasicIPC.Semantics.KripkeGodel -- GΓΆdel embedding.
-- Available metatheory for basic IPC.
--
-- βββββββ¬ββββββ¬ββββββ¬ββββββ¬ββββββ
-- β CH β H β G β GβΏαΆ β GΛ’βΏαΆ β
-- βββββββΌββββββΌββββββΌββββββΌββββββΌββββββ€
-- β BT β eβ β e β e β β β
-- βββββββΌββββββΌββββββΌββββββΌββββββΌββββββ€
-- β TGCIβ eβqββ eqβ β eqβ β β β
-- βββββββΌββββββΌββββββΌββββββΌββββββΌββββββ€
-- β TGCHβ eβqββ eqβ β β β β
-- βββββββΌββββββΌββββββΌββββββΌββββββΌββββββ€
-- β TCGIβ β eq β eq β β β
-- βββββββΌββββββΌββββββΌββββββΌββββββΌββββββ€
-- β TCGHβ β eq β eq β β β
-- βββββββΌββββββΌββββββΌββββββΌββββββΌββββββ€
-- β TCGGβ β eq β eq β β β
-- βββββββΌββββββΌββββββΌββββββΌββββββΌββββββ€
-- β KCGIβ β eq β eq β β β
-- βββββββΌββββββΌββββββΌββββββΌββββββΌββββββ€
-- β KCGHβ β eq β eq β β β
-- βββββββΌββββββΌββββββΌββββββΌββββββΌββββββ€
-- β KCGGβ β eq β eq β β β
-- βββββββΌββββββΌββββββΌββββββΌββββββΌββββββ€
-- β KC β β eq β eq β eq β β
-- βββββββΌββββββΌββββββΌββββββΌββββββΌββββββ€
-- β KMT β β eq β eq β eq β β
-- βββββββΌββββββΌββββββΌββββββΌββββββΌββββββ€
-- β KG β β eq β eq β eq β β
-- βββββββΌββββββΌββββββΌββββββΌββββββΌββββββ€
-- β HS β β β β β n β
-- βββββββ΄ββββββ΄ββββββ΄ββββββ΄ββββββ΄ββββββ
--
-- eβ : Soundness only, for closed terms only.
-- eβqβ : Soundness and completeness, for closed terms only.
-- e : Soundness only.
-- eqβ : Soundness, for all terms; completeness, for closed terms only.
-- eq : Soundness and completeness, or normalisation by evaluation.
-- n : Normalisation by other means.
import BasicIPC.Metatheory.ClosedHilbert-BasicTarski
import BasicIPC.Metatheory.ClosedHilbert-TarskiGluedClosedImplicit
import BasicIPC.Metatheory.ClosedHilbert-TarskiGluedClosedHilbert
import BasicIPC.Metatheory.Hilbert-BasicTarski
import BasicIPC.Metatheory.Hilbert-TarskiGluedClosedImplicit
import BasicIPC.Metatheory.Hilbert-TarskiGluedClosedHilbert
import BasicIPC.Metatheory.Hilbert-TarskiConcreteGluedImplicit
import BasicIPC.Metatheory.Hilbert-TarskiConcreteGluedHilbert
import BasicIPC.Metatheory.Hilbert-TarskiConcreteGluedGentzen
import BasicIPC.Metatheory.Hilbert-KripkeConcreteGluedImplicit
import BasicIPC.Metatheory.Hilbert-KripkeConcreteGluedHilbert
import BasicIPC.Metatheory.Hilbert-KripkeConcreteGluedGentzen
import BasicIPC.Metatheory.Hilbert-KripkeConcrete
import BasicIPC.Metatheory.Hilbert-KripkeMcKinseyTarski
import BasicIPC.Metatheory.Hilbert-KripkeGodel
import BasicIPC.Metatheory.Gentzen-BasicTarski
import BasicIPC.Metatheory.Gentzen-TarskiGluedClosedImplicit
import BasicIPC.Metatheory.Gentzen-TarskiConcreteGluedImplicit
import BasicIPC.Metatheory.Gentzen-TarskiConcreteGluedHilbert
import BasicIPC.Metatheory.Gentzen-TarskiConcreteGluedGentzen
import BasicIPC.Metatheory.Gentzen-KripkeConcreteGluedImplicit
import BasicIPC.Metatheory.Gentzen-KripkeConcreteGluedHilbert
import BasicIPC.Metatheory.Gentzen-KripkeConcreteGluedGentzen
import BasicIPC.Metatheory.Gentzen-KripkeConcrete
import BasicIPC.Metatheory.Gentzen-KripkeMcKinseyTarski
import BasicIPC.Metatheory.Gentzen-KripkeGodel
import BasicIPC.Metatheory.GentzenNormalForm-KripkeConcrete
import BasicIPC.Metatheory.GentzenNormalForm-KripkeMcKinseyTarski
import BasicIPC.Metatheory.GentzenNormalForm-KripkeGodel
import BasicIPC.Metatheory.GentzenSpinalNormalForm-HereditarySubstitution
-- TODO
-- Common syntax.
import BasicT.Syntax.Common
-- Gentzen-style formalisation of syntax.
import BasicT.Syntax.Gentzen
import BasicT.Syntax.GentzenNormalForm
-- Basic Tarski-style semantics, for soundness only.
import BasicT.Semantics.BasicTarski
-- Available metatheory.
import BasicT.Metatheory.Gentzen-BasicTarski
import BasicT.Metatheory.GentzenNormalForm-Unknown
-- Intuitionistic propositional calculus.
-- Common syntax.
import IPC.Syntax.Common
-- Hilbert-style formalisation of closed syntax.
import IPC.Syntax.ClosedHilbertSequential -- Sequences of terms.
import IPC.Syntax.ClosedHilbert -- Nested terms.
-- Hilbert-style formalisation of syntax.
import IPC.Syntax.HilbertSequential -- Sequences of terms.
import IPC.Syntax.Hilbert -- Nested terms.
-- Gentzen-style formalisation of syntax.
import IPC.Syntax.Gentzen -- Simple terms.
import IPC.Syntax.GentzenNormalForm -- Normal forms and neutrals.
import IPC.Syntax.GentzenSpinalNormalForm -- Normal forms, neutrals, and spines.
-- Translation between different formalisations of syntax.
import IPC.Syntax.Translation
-- Basic Tarski-style semantics, for soundness only.
import IPC.Semantics.BasicTarski
-- Kripke-style semantics with exploding abstract worlds.
import IPC.Semantics.KripkeExploding
-- Available metatheory for IPC.
--
-- βββββββ¬ββββββ¬ββββββ¬ββββββ¬ββββββ
-- β CH β H β G β GβΏαΆ β GΛ’βΏαΆ β
-- βββββββΌββββββΌββββββΌββββββΌββββββΌββββββ€
-- β BT β eβ β e β e β β β
-- βββββββΌββββββΌββββββΌββββββΌββββββΌββββββ€
-- β KE β β β eq β eq β β
-- βββββββΌββββββΌββββββΌββββββΌββββββΌββββββ€
-- β HS β β β β β n β
-- βββββββ΄ββββββ΄ββββββ΄ββββββ΄ββββββ΄ββββββ
--
-- eβ : Soundness only, for closed terms only.
-- eβqβ : Soundness and completeness, for closed terms only.
-- e : Soundness only.
-- eqβ : Soundness, for all terms; completeness, for closed terms only.
-- eq : Soundness and completeness, or normalisation by evaluation.
-- n : Normalisation by other means.
import IPC.Metatheory.ClosedHilbert-BasicTarski
import IPC.Metatheory.Hilbert-BasicTarski
import IPC.Metatheory.Gentzen-BasicTarski
import IPC.Metatheory.Gentzen-KripkeExploding
import IPC.Metatheory.GentzenNormalForm-KripkeExploding
import IPC.Metatheory.GentzenSpinalNormalForm-HereditarySubstitution
-- Basic intuitionistic modal logic S4, without β¨, β₯, or β.
-- Common syntax.
import BasicIS4.Syntax.Common
-- Hilbert-style formalisation of closed syntax.
import BasicIS4.Syntax.ClosedHilbertSequential -- Sequences of terms.
import BasicIS4.Syntax.ClosedHilbert -- Nested terms.
-- Hilbert-style formalisation of syntax.
import BasicIS4.Syntax.HilbertSequential -- Sequences of terms.
import BasicIS4.Syntax.Hilbert -- Nested terms.
-- Gentzen-style formalisation of syntax, after Bierman-de Paiva.
import BasicIS4.Syntax.Gentzen
-- Hilbert-style formalisation of syntax with context pairs.
import BasicIS4.Syntax.DyadicHilbertSequential -- Sequences of terms.
import BasicIS4.Syntax.DyadicHilbert -- Nested terms.
-- Gentzen-style formalisation of syntax with context pairs, after Pfenning-Davies.
import BasicIS4.Syntax.DyadicGentzen -- Simple terms.
import BasicIS4.Syntax.DyadicGentzenNormalForm -- Normal forms and neutrals.
import BasicIS4.Syntax.DyadicGentzenSpinalNormalForm -- Normal forms, neutrals, and spines.
-- Gentzen-style formalisation of labelled syntax, after Basin-Matthews-ViganΓ².
import BasicIS4.Syntax.LabelledGentzen
-- Translation between different formalisations of syntax.
import BasicIS4.Syntax.Translation
-- Basic Kripke-style semantics with abstract worlds, for soundness only.
import BasicIS4.Semantics.BasicKripkeOno -- Ono-style conditions.
import BasicIS4.Semantics.BasicKripkeBozicDosen -- BoΕΎiΔ-DoΕ‘en-style conditions.
import BasicIS4.Semantics.BasicKripkeEwald -- Ewald-style conditions.
import BasicIS4.Semantics.BasicKripkeAlechina -- Alechina-style conditions.
-- Tarski-style semantics with glueing for Ξ±, β», and β‘, after Gabbay-Nanevski.
import BasicIS4.Semantics.TarskiClosedOvergluedImplicit -- Implicit closed syntax.
import BasicIS4.Semantics.TarskiClosedOvergluedHilbert -- Hilbert-style closed syntax.
-- Tarski-style semantics with contexts as concrete worlds, and glueing for Ξ±, β», and β‘.
import BasicIS4.Semantics.TarskiOvergluedImplicit -- Implicit syntax.
import BasicIS4.Semantics.TarskiOvergluedHilbert -- Hilbert-style syntax.
import BasicIS4.Semantics.TarskiOvergluedGentzen -- Gentzen-style syntax.
-- Tarski-style semantics with contexts as concrete worlds, and glueing for β‘ only.
import BasicIS4.Semantics.TarskiGluedImplicit -- Implicit syntax.
import BasicIS4.Semantics.TarskiGluedHilbert -- Hilbert-style syntax.
import BasicIS4.Semantics.TarskiGluedGentzen -- Gentzen-style syntax.
-- Tarski-style semantics with context pairs as concrete worlds, and glueing for Ξ±, β», and β‘.
import BasicIS4.Semantics.TarskiOvergluedDyadicImplicit -- Implicit syntax.
import BasicIS4.Semantics.TarskiOvergluedDyadicHilbert -- Hilbert-style syntax.
import BasicIS4.Semantics.TarskiOvergluedDyadicGentzen -- Gentzen-style syntax.
-- Tarski-style semantics with context pairs as concrete worlds, and glueing for β‘ only.
import BasicIS4.Semantics.TarskiGluedDyadicImplicit -- Implicit syntax.
-- TODO
import BasicIS4.Semantics.TarskiGluedDyadicHilbert -- Hilbert-style syntax.
import BasicIS4.Semantics.TarskiGluedDyadicGentzen -- Gentzen-style syntax.
-- Canonical model equipment for Kripke-style semantics with contexts as concrete worlds.
import BasicIS4.Equipment.KripkeCanonical
import BasicIS4.Equipment.KripkeNonCanonical
-- Canonical model equipment for Kripke-style semantics with context pairs as concrete worlds.
import BasicIS4.Equipment.KripkeDyadicCanonical
import BasicIS4.Equipment.KripkeDyadicNonCanonical
-- Available metatheory for basic IS4.
--
-- βββββββ¬ββββββ¬ββββββ¬ββββββ¬ββββββ
-- β CH β H β G β DH β DG β
-- βββββββΌββββββΌββββββΌββββββΌββββββΌββββββ€
-- β BKO β β e β e β e β e β
-- βββββββΌββββββΌββββββΌββββββΌββββββΌββββββ€
-- β BKBDβ β e β e β e β e β
-- βββββββΌββββββΌββββββΌββββββΌββββββΌββββββ€
-- β BKE β β e β e β e β e β
-- βββββββΌββββββΌββββββΌββββββΌββββββΌββββββ€
-- β BKA&β β e β e β e β e β
-- βββββββΌββββββΌββββββΌββββββΌββββββΌββββββ€
-- β TCOIβ eβqββ eqβ β eqβ β β β
-- βββββββΌββββββΌββββββΌββββββΌββββββΌββββββ€
-- β TCOHβ eβqββ eqβ β β β β
-- βββββββΌββββββΌββββββΌββββββΌββββββΌββββββ€
-- β TOI β β eq β eq β β β
-- βββββββΌββββββΌββββββΌββββββΌββββββΌββββββ€
-- β TOH β β eq β β β β
-- βββββββΌββββββΌββββββΌββββββΌββββββΌββββββ€
-- β TOG β β eq β eq β β β
-- βββββββΌββββββΌββββββΌββββββΌββββββΌββββββ€
-- β TGI β β eq β WIP β β β
-- βββββββΌββββββΌββββββΌββββββΌββββββΌββββββ€
-- β TGH β β eq β β β β
-- βββββββΌββββββΌββββββΌββββββΌββββββΌββββββ€
-- β TGG β β β WIP β β β
-- βββββββΌββββββΌββββββΌββββββΌββββββΌββββββ€
-- β TODIβ β β β eq β eq β
-- βββββββΌββββββΌββββββΌββββββΌββββββΌββββββ€
-- β TODHβ β β β eq β β
-- βββββββΌββββββΌββββββΌββββββΌββββββΌββββββ€
-- β TODGβ β β β eq β eq β
-- βββββββΌββββββΌββββββΌββββββΌββββββΌββββββ€
-- β TGDIβ β β β WIP β WIP β
-- βββββββΌββββββΌββββββΌββββββΌββββββΌββββββ€
-- β TGDHβ β β β WIP β β
-- βββββββΌββββββΌββββββΌββββββΌββββββΌββββββ€
-- β TGDGβ β β β β WIP β
-- βββββββ΄ββββββ΄ββββββ΄ββββββ΄ββββββ΄ββββββ
--
-- eβ : Soundness only, for closed terms only.
-- eβqβ : Soundness and completeness, for closed terms only.
-- e : Soundness only.
-- eqβ : Soundness, for all terms; completeness, for closed terms only.
-- eq : Soundness and completeness, or normalisation by evaluation.
-- WIP : Work in progress.
import BasicIS4.Metatheory.ClosedHilbert-TarskiClosedOvergluedImplicit
import BasicIS4.Metatheory.ClosedHilbert-TarskiClosedOvergluedHilbert
import BasicIS4.Metatheory.Hilbert-BasicKripkeOno
import BasicIS4.Metatheory.Hilbert-BasicKripkeBozicDosen
import BasicIS4.Metatheory.Hilbert-BasicKripkeEwald
import BasicIS4.Metatheory.Hilbert-BasicKripkeAlechina
import BasicIS4.Metatheory.Hilbert-TarskiClosedOvergluedImplicit
import BasicIS4.Metatheory.Hilbert-TarskiClosedOvergluedHilbert
import BasicIS4.Metatheory.Hilbert-TarskiOvergluedImplicit
import BasicIS4.Metatheory.Hilbert-TarskiOvergluedHilbert
import BasicIS4.Metatheory.Hilbert-TarskiOvergluedGentzen
import BasicIS4.Metatheory.Hilbert-TarskiGluedImplicit
import BasicIS4.Metatheory.Hilbert-TarskiGluedHilbert
import BasicIS4.Metatheory.Gentzen-BasicKripkeOno
import BasicIS4.Metatheory.Gentzen-BasicKripkeBozicDosen
import BasicIS4.Metatheory.Gentzen-BasicKripkeEwald
import BasicIS4.Metatheory.Gentzen-BasicKripkeAlechina
import BasicIS4.Metatheory.Gentzen-TarskiClosedOvergluedImplicit
import BasicIS4.Metatheory.Gentzen-TarskiOvergluedImplicit
import BasicIS4.Metatheory.Gentzen-TarskiOvergluedGentzen
import BasicIS4.Metatheory.Gentzen-TarskiGluedImplicit -- FIXME
import BasicIS4.Metatheory.Gentzen-TarskiGluedGentzen -- FIXME
import BasicIS4.Metatheory.DyadicHilbert-BasicKripkeOno
import BasicIS4.Metatheory.DyadicHilbert-BasicKripkeBozicDosen
import BasicIS4.Metatheory.DyadicHilbert-BasicKripkeEwald
import BasicIS4.Metatheory.DyadicHilbert-BasicKripkeAlechina
import BasicIS4.Metatheory.DyadicHilbert-TarskiOvergluedDyadicImplicit
import BasicIS4.Metatheory.DyadicHilbert-TarskiOvergluedDyadicHilbert
import BasicIS4.Metatheory.DyadicHilbert-TarskiOvergluedDyadicGentzen
import BasicIS4.Metatheory.DyadicHilbert-TarskiGluedDyadicImplicit -- FIXME
import BasicIS4.Metatheory.DyadicHilbert-TarskiGluedDyadicHilbert
import BasicIS4.Metatheory.DyadicGentzen-BasicKripkeOno
import BasicIS4.Metatheory.DyadicGentzen-BasicKripkeBozicDosen
import BasicIS4.Metatheory.DyadicGentzen-BasicKripkeEwald
import BasicIS4.Metatheory.DyadicGentzen-BasicKripkeAlechina
import BasicIS4.Metatheory.DyadicGentzen-TarskiOvergluedDyadicImplicit
import BasicIS4.Metatheory.DyadicGentzen-TarskiOvergluedDyadicGentzen
import BasicIS4.Metatheory.DyadicGentzen-TarskiGluedDyadicImplicit -- FIXME
import BasicIS4.Metatheory.DyadicGentzen-TarskiGluedDyadicGentzen -- FIXME
import BasicIS4.Metatheory.DyadicGentzenSpinalNormalForm-HereditarySubstitution
-- Basic intuitionistic contextual modal logic, without β¨ or β₯.
-- Common syntax.
import BasicICML.Syntax.Common
-- Gentzen-style formalisation of syntax with context pairs, after Nanevski-Pfenning-Pientka.
import BasicICML.Syntax.DyadicGentzen
import BasicICML.Syntax.DyadicGentzenNormalForm
import BasicICML.Syntax.DyadicGentzenSpinalNormalForm
-- Available metatheory for basic ICML.
import BasicICML.Metatheory.DyadicGentzenSpinalNormalForm-HereditarySubstitution
-- Basic intuitionistic logic of proofs, without β¨, β₯, or +.
-- Common syntax.
import BasicILP.Syntax.Common
-- Gentzen-style formalisation of syntax with context pairs.
import BasicILP.Syntax.DyadicGentzen
import BasicILP.Syntax.DyadicGentzenNormalForm
-- (To be rewritten.)
-- Common syntax, with types parametrised by a closed, untyped representation of syntax.
import OldBasicILP.UntypedSyntax.Common
-- Hilbert-style formalisation of closed syntax.
import OldBasicILP.UntypedSyntax.ClosedHilbertSequential -- Sequences of terms.
import OldBasicILP.UntypedSyntax.ClosedHilbert -- Nested terms.
-- Translation between different formalisations of syntax.
import OldBasicILP.UntypedSyntax.Translation -- FIXME
-- Common syntax, with types parametrised by closed syntax.
import OldBasicILP.Syntax.Common
-- Hilbert-style formalisation of closed syntax.
import OldBasicILP.Syntax.ClosedHilbertSequential -- Sequences of terms.
import OldBasicILP.Syntax.ClosedHilbert -- Nested terms.
-- Translation between different formalisations of syntax.
import OldBasicILP.Syntax.Translation -- FIXME
-- import OldBasicILP.Syntax.Projection -- FIXME
-- (To be rewritten.)
import OlderBasicILP.Indirect
import OlderBasicILP.Indirect.Hilbert.Sequential
import OlderBasicILP.Indirect.Hilbert.Nested
import OlderBasicILP.Indirect.Gentzen
-- import OlderBasicILP.Indirect.Translation
import OlderBasicILP.Direct.Hilbert.Nested
import OlderBasicILP.Direct.Gentzen
-- import OlderBasicILP.Direct.Translation
| {
"alphanum_fraction": 0.6896925663,
"avg_line_length": 39.0741525424,
"ext": "agda",
"hexsha": "53517d1bc506796910aa1f00a084e6caae34564f",
"lang": "Agda",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "fcd187db70f0a39b894fe44fad0107f61849405c",
"max_forks_repo_licenses": [
"X11"
],
"max_forks_repo_name": "mietek/hilbert-gentzen",
"max_forks_repo_path": "Everything.agda",
"max_issues_count": 1,
"max_issues_repo_head_hexsha": "fcd187db70f0a39b894fe44fad0107f61849405c",
"max_issues_repo_issues_event_max_datetime": "2018-06-10T09:11:22.000Z",
"max_issues_repo_issues_event_min_datetime": "2018-06-10T09:11:22.000Z",
"max_issues_repo_licenses": [
"X11"
],
"max_issues_repo_name": "mietek/hilbert-gentzen",
"max_issues_repo_path": "Everything.agda",
"max_line_length": 94,
"max_stars_count": 29,
"max_stars_repo_head_hexsha": "fcd187db70f0a39b894fe44fad0107f61849405c",
"max_stars_repo_licenses": [
"X11"
],
"max_stars_repo_name": "mietek/hilbert-gentzen",
"max_stars_repo_path": "Everything.agda",
"max_stars_repo_stars_event_max_datetime": "2022-01-01T10:29:18.000Z",
"max_stars_repo_stars_event_min_datetime": "2016-07-03T18:51:56.000Z",
"num_tokens": 5965,
"size": 18443
} |
module IPL where
data _β§_ (P : Set) (Q : Set) : Set where
β§-intro : P β Q β (P β§ Q)
proofβ : {P Q : Set} β (P β§ Q) β P
proofβ (β§-intro p q) = p
proofβ : {P Q : Set} β (P β§ Q) β Q
proofβ (β§-intro p q) = q
_β_ : (P : Set) β (Q : Set) β Set
a β b = (a β b) β§ (b β a)
β§-commβ² : (P Q : Set) β (P β§ Q) β (Q β§ P)
β§-commβ² _ _ (β§-intro p q) = β§-intro q p
β§-comm : (P Q : Set) β (P β§ Q) β (Q β§ P)
β§-comm P Q = β§-intro (β§-commβ² P Q) (β§-commβ² Q P)
β§-comm1β² : {P Q : Set} β (P β§ Q) β (Q β§ P)
β§-comm1β² (β§-intro p q) = β§-intro q p
data _β¨_ (P Q : Set) : Set where
β¨-introβ : P β P β¨ Q
β¨-introβ : Q β P β¨ Q
β¨-elim : {A B C : Set} β (A β C) β (B β C) β (A β¨ B) β C
β¨-elim ac bc (β¨-introβ a) = ac a
β¨-elim ac bc (β¨-introβ b) = bc b
β¨-commβ² : {A B : Set} β (A β¨ B) β (B β¨ A)
β¨-commβ² (β¨-introβ a) = β¨-introβ a
β¨-commβ² (β¨-introβ b) = β¨-introβ b
β¨-comm : {A B : Set} β (A β¨ B) β (B β¨ A)
β¨-comm = β§-intro β¨-commβ² β¨-commβ²
data β₯ : Set where
Β¬ : Set β Set
Β¬ A = A β β₯
| {
"alphanum_fraction": 0.4219712526,
"avg_line_length": 18.3773584906,
"ext": "agda",
"hexsha": "6fbdc19033d4ca5c3209752661d0580d0b004364",
"lang": "Agda",
"max_forks_count": 2,
"max_forks_repo_forks_event_max_datetime": "2017-06-03T06:32:26.000Z",
"max_forks_repo_forks_event_min_datetime": "2015-12-02T02:10:26.000Z",
"max_forks_repo_head_hexsha": "a6fc111e02dc631f56302bb059d855446792bebc",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "shouya/thinking-dumps",
"max_forks_repo_path": "learyouanagda/IPL.agda",
"max_issues_count": 1,
"max_issues_repo_head_hexsha": "a6fc111e02dc631f56302bb059d855446792bebc",
"max_issues_repo_issues_event_max_datetime": "2015-08-04T22:05:11.000Z",
"max_issues_repo_issues_event_min_datetime": "2015-06-14T06:07:33.000Z",
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "shouya/thinking-dumps",
"max_issues_repo_path": "learyouanagda/IPL.agda",
"max_line_length": 56,
"max_stars_count": 24,
"max_stars_repo_head_hexsha": "a6fc111e02dc631f56302bb059d855446792bebc",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "shouya/thinking-dumps",
"max_stars_repo_path": "learyouanagda/IPL.agda",
"max_stars_repo_stars_event_max_datetime": "2022-01-09T01:02:15.000Z",
"max_stars_repo_stars_event_min_datetime": "2015-02-14T17:18:34.000Z",
"num_tokens": 516,
"size": 974
} |
------------------------------------------------------------------------
-- The Agda standard library
--
-- Conversion of β€ to <, along with a number of properties
------------------------------------------------------------------------
-- Possible TODO: Prove that a conversion β€ β < β β€ returns a
-- relation equivalent to the original one (and similarly for
-- <Β βΒ β€Β βΒ <).
open import Relation.Binary
module Relation.Binary.NonStrictToStrict
{a ββ ββ} {A : Set a}
(_β_ : Rel A ββ) (_β€_ : Rel A ββ)
where
open import Relation.Nullary
open import Relation.Binary.Consequences
open import Function
open import Data.Product
open import Data.Sum
------------------------------------------------------------------------
-- Conversion
-- _β€_ can be turned into _<_ as follows:
_<_ : Rel A _
x < y = (x β€ y) Γ Β¬ (x β y)
------------------------------------------------------------------------
-- The converted relations have certain properties
-- (if the original relations have certain other properties)
irrefl : Irreflexive _β_ _<_
irrefl xβy x<y = projβ x<y xβy
trans : IsPartialOrder _β_ _β€_ β Transitive _<_
trans po = Ξ» x<y y<z β
( PO.trans (projβ x<y) (projβ y<z)
, Ξ» xβz β projβ x<y $ lemma (projβ x<y) (projβ y<z) xβz
)
where
module PO = IsPartialOrder po
lemma : β {x y z} β x β€ y β y β€ z β x β z β x β y
lemma xβ€y yβ€z xβz =
PO.antisym xβ€y $ PO.trans yβ€z (PO.reflexive $ PO.Eq.sym xβz)
antisymβΆasym : Antisymmetric _β_ _β€_ β Asymmetric _<_
antisymβΆasym antisym (xβ€y , Β¬xβy) (yβ€x , Β¬yβx) =
Β¬xβy (antisym xβ€y yβ€x)
<-resp-β : IsEquivalence _β_ β _β€_ Respectsβ _β_ β _<_ Respectsβ _β_
<-resp-β eq β€-resp-β =
(Ξ» {x y' y} y'βy x<y' β
( projβ β€-resp-β y'βy (projβ x<y')
, Ξ» xβy β projβ x<y' (Eq.trans xβy (Eq.sym y'βy))
)
) ,
(Ξ» {y x' x} x'βx x'<y β
( projβ β€-resp-β x'βx (projβ x'<y)
, Ξ» xβy β projβ x'<y (Eq.trans x'βx xβy)
))
where module Eq = IsEquivalence eq
trichotomous : Symmetric _β_ β Decidable _β_ β
Antisymmetric _β_ _β€_ β Total _β€_ β
Trichotomous _β_ _<_
trichotomous β-sym β-dec antisym total x y with β-dec x y
... | yes xβy = triβ (irrefl xβy) xβy (irrefl (β-sym xβy))
... | no xβy with total x y
... | injβ xβ€y = tri< (xβ€y , xβy) xβy
(xβy β antisym xβ€y β projβ)
... | injβ xβ₯y = tri> (xβy β flip antisym xβ₯y β projβ) xβy
(xβ₯y , xβy β β-sym)
decidable : Decidable _β_ β Decidable _β€_ β Decidable _<_
decidable β-dec β€-dec x y with β-dec x y | β€-dec x y
... | yes xβy | _ = no (flip projβ xβy)
... | no xβy | yes xβ€y = yes (xβ€y , xβy)
... | no xβy | no xβ°y = no (xβ°y β projβ)
isPartialOrderβΆisStrictPartialOrder :
IsPartialOrder _β_ _β€_ β IsStrictPartialOrder _β_ _<_
isPartialOrderβΆisStrictPartialOrder po = record
{ isEquivalence = PO.isEquivalence
; irrefl = irrefl
; trans = trans po
; <-resp-β = <-resp-β PO.isEquivalence PO.β€-resp-β
} where module PO = IsPartialOrder po
isTotalOrderβΆisStrictTotalOrder :
Decidable _β_ β IsTotalOrder _β_ _β€_ β IsStrictTotalOrder _β_ _<_
isTotalOrderβΆisStrictTotalOrder dec-β tot = record
{ isEquivalence = TO.isEquivalence
; trans = trans TO.isPartialOrder
; compare = trichotomous TO.Eq.sym dec-β TO.antisym TO.total
; <-resp-β = <-resp-β TO.isEquivalence TO.β€-resp-β
} where module TO = IsTotalOrder tot
isDecTotalOrderβΆisStrictTotalOrder :
IsDecTotalOrder _β_ _β€_ β IsStrictTotalOrder _β_ _<_
isDecTotalOrderβΆisStrictTotalOrder dtot =
isTotalOrderβΆisStrictTotalOrder DTO._β_ DTO.isTotalOrder
where module DTO = IsDecTotalOrder dtot
| {
"alphanum_fraction": 0.5625342841,
"avg_line_length": 33.7592592593,
"ext": "agda",
"hexsha": "73e2eed20a132478a4d0490a1e70c2f0108c7e4b",
"lang": "Agda",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "9d4c43b1609d3f085636376fdca73093481ab882",
"max_forks_repo_licenses": [
"Apache-2.0"
],
"max_forks_repo_name": "qwe2/try-agda",
"max_forks_repo_path": "agda-stdlib-0.9/src/Relation/Binary/NonStrictToStrict.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "9d4c43b1609d3f085636376fdca73093481ab882",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"Apache-2.0"
],
"max_issues_repo_name": "qwe2/try-agda",
"max_issues_repo_path": "agda-stdlib-0.9/src/Relation/Binary/NonStrictToStrict.agda",
"max_line_length": 72,
"max_stars_count": 1,
"max_stars_repo_head_hexsha": "9d4c43b1609d3f085636376fdca73093481ab882",
"max_stars_repo_licenses": [
"Apache-2.0"
],
"max_stars_repo_name": "qwe2/try-agda",
"max_stars_repo_path": "agda-stdlib-0.9/src/Relation/Binary/NonStrictToStrict.agda",
"max_stars_repo_stars_event_max_datetime": "2016-10-20T15:52:05.000Z",
"max_stars_repo_stars_event_min_datetime": "2016-10-20T15:52:05.000Z",
"num_tokens": 1384,
"size": 3646
} |
-- This module is used to illustrate how to import a non-parameterised module.
module examples.syntax.ModuleA where
data Nat : Set where
zero : Nat
suc : Nat -> Nat
plus : Nat -> Nat -> Nat
eval : Nat -> Nat
eval zero = zero
eval (suc x) = suc (eval x)
eval (plus zero y) = eval y
eval (plus (suc x) y) = suc (eval (plus x y))
eval (plus (plus x y) z) = eval (plus x (plus y z))
| {
"alphanum_fraction": 0.5787037037,
"avg_line_length": 25.4117647059,
"ext": "agda",
"hexsha": "4a77449488fbd7dcde1b9f52534f28351388fc07",
"lang": "Agda",
"max_forks_count": 1,
"max_forks_repo_forks_event_max_datetime": "2022-03-12T11:35:18.000Z",
"max_forks_repo_forks_event_min_datetime": "2022-03-12T11:35:18.000Z",
"max_forks_repo_head_hexsha": "70c8a575c46f6a568c7518150a1a64fcd03aa437",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "masondesu/agda",
"max_forks_repo_path": "examples/outdated-and-incorrect/syntax/ModuleA.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "70c8a575c46f6a568c7518150a1a64fcd03aa437",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "masondesu/agda",
"max_issues_repo_path": "examples/outdated-and-incorrect/syntax/ModuleA.agda",
"max_line_length": 78,
"max_stars_count": 1,
"max_stars_repo_head_hexsha": "aa10ae6a29dc79964fe9dec2de07b9df28b61ed5",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "asr/agda-kanso",
"max_stars_repo_path": "examples/outdated-and-incorrect/syntax/ModuleA.agda",
"max_stars_repo_stars_event_max_datetime": "2019-11-27T04:41:05.000Z",
"max_stars_repo_stars_event_min_datetime": "2019-11-27T04:41:05.000Z",
"num_tokens": 138,
"size": 432
} |
-- Andreas, 2012-09-24 Ensure that size successor is monotone
{-# OPTIONS --sized-types #-}
module SizeSucMonotone where
open import Common.Size
data Bool : Set where
true false : Bool
-- T should be monotone in its second arg
T : Bool β Size β Set
T true i = Size< i
T false i = Size< (β i)
test : {x : Bool}{i : Size}{j : Size< i} β T x j β T x i
test h = h
| {
"alphanum_fraction": 0.6467391304,
"avg_line_length": 20.4444444444,
"ext": "agda",
"hexsha": "50929eca1d6b85e2437e0e55941884f581f6690c",
"lang": "Agda",
"max_forks_count": 1,
"max_forks_repo_forks_event_max_datetime": "2022-03-12T11:35:18.000Z",
"max_forks_repo_forks_event_min_datetime": "2022-03-12T11:35:18.000Z",
"max_forks_repo_head_hexsha": "70c8a575c46f6a568c7518150a1a64fcd03aa437",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "masondesu/agda",
"max_forks_repo_path": "test/succeed/SizeSucMonotone.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "70c8a575c46f6a568c7518150a1a64fcd03aa437",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "masondesu/agda",
"max_issues_repo_path": "test/succeed/SizeSucMonotone.agda",
"max_line_length": 61,
"max_stars_count": 1,
"max_stars_repo_head_hexsha": "477c8c37f948e6038b773409358fd8f38395f827",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "larrytheliquid/agda",
"max_stars_repo_path": "test/succeed/SizeSucMonotone.agda",
"max_stars_repo_stars_event_max_datetime": "2018-10-10T17:08:44.000Z",
"max_stars_repo_stars_event_min_datetime": "2018-10-10T17:08:44.000Z",
"num_tokens": 119,
"size": 368
} |
module Data.String.Exts where
open import Data.Bool hiding (_<?_)
open import Data.Char hiding (_<?_)
open import Data.String hiding (_<?_)
open import Data.Maybe
open import Data.Nat
open import Relation.Nullary.Decidable
{-#
FOREIGN GHC
import Data.Text
#-}
postulate
strHead : String -> Maybe Char
strNull : String -> Bool
strTake : β -> String -> String
strDrop : β -> String -> String
stripPrefix : String -> String -> Maybe String
strLength : String -> β
{-# COMPILE GHC strHead = (fmap fst) . uncons #-}
{-# COMPILE GHC strNull = Data.Text.null #-}
{-# COMPILE GHC strTake = Data.Text.take . fromIntegral #-}
{-# COMPILE GHC strDrop = Data.Text.drop . fromIntegral #-}
{-# COMPILE GHC stripPrefix = stripPrefix #-}
{-# COMPILE GHC strLength = toInteger . Data.Text.length #-}
shortenString : β -> String -> String
shortenString l s = if β length s <? l β then s else strTake l s ++ "..."
| {
"alphanum_fraction": 0.6772082879,
"avg_line_length": 27.7878787879,
"ext": "agda",
"hexsha": "99ac2b5fa49d0fa4689c0093a90ecd79c39b0fe8",
"lang": "Agda",
"max_forks_count": 2,
"max_forks_repo_forks_event_max_datetime": "2021-10-20T10:46:20.000Z",
"max_forks_repo_forks_event_min_datetime": "2019-06-27T23:12:48.000Z",
"max_forks_repo_head_hexsha": "62fa6f36e4555360d94041113749bbb6d291691c",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "WhatisRT/meta-cedille",
"max_forks_repo_path": "stdlib-exts/Data/String/Exts.agda",
"max_issues_count": 10,
"max_issues_repo_head_hexsha": "62fa6f36e4555360d94041113749bbb6d291691c",
"max_issues_repo_issues_event_max_datetime": "2020-04-25T15:29:17.000Z",
"max_issues_repo_issues_event_min_datetime": "2019-06-13T17:44:43.000Z",
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "WhatisRT/meta-cedille",
"max_issues_repo_path": "stdlib-exts/Data/String/Exts.agda",
"max_line_length": 73,
"max_stars_count": 35,
"max_stars_repo_head_hexsha": "62fa6f36e4555360d94041113749bbb6d291691c",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "WhatisRT/meta-cedille",
"max_stars_repo_path": "stdlib-exts/Data/String/Exts.agda",
"max_stars_repo_stars_event_max_datetime": "2021-10-12T22:59:10.000Z",
"max_stars_repo_stars_event_min_datetime": "2019-06-13T07:44:50.000Z",
"num_tokens": 239,
"size": 917
} |
{-# OPTIONS --without-K --rewriting #-}
open import HoTT
import homotopy.RelativelyConstantToSetExtendsViaSurjection as SurjExt
module homotopy.vankampen.Code {i j k l}
(span : Span {i} {j} {k})
{D : Type l} (h : D β Span.C span) (h-is-surj : is-surj h) where
open Span span
open import homotopy.vankampen.CodeAP span h h-is-surj
open import homotopy.vankampen.CodeBP span h h-is-surj
pcAA-to-pcBA : β dβ {a} β precodeAA (f (h dβ)) a β precodeBA (g (h dβ)) a
pcAB-to-pcBB : β dβ {b} β precodeAB (f (h dβ)) b β precodeBB (g (h dβ)) b
pcAA-to-pcBA dβ (pc-a pA) = pc-bba dβ (pc-b idpβ) pA
pcAA-to-pcBA dβ (pc-aba d pc pA) = pc-bba d (pcAB-to-pcBB dβ pc) pA
pcAB-to-pcBB dβ (pc-aab d pc pB) = pc-bab d (pcAA-to-pcBA dβ pc) pB
abstract
pcAA-to-pcBA-rel : β dβ {a} {pcAAβ pcAAβ : precodeAA (f (h dβ)) a}
β precodeAA-rel pcAAβ pcAAβ
β precodeBA-rel (pcAA-to-pcBA dβ pcAAβ) (pcAA-to-pcBA dβ pcAAβ)
pcAB-to-pcBB-rel : β dβ {a} {pcABβ pcABβ : precodeAB (f (h dβ)) a}
β precodeAB-rel pcABβ pcABβ
β precodeBB-rel (pcAB-to-pcBB dβ pcABβ) (pcAB-to-pcBB dβ pcABβ)
pcAA-to-pcBA-rel dβ (pcAAr-idpβ-idpβ pcAA) = pcBAr-idpβ-idpβ (pcAA-to-pcBA dβ pcAA)
pcAA-to-pcBA-rel dβ (pcAAr-cong r pA) = pcBAr-cong (pcAB-to-pcBB-rel dβ r) pA
pcAB-to-pcBB-rel dβ (pcABr-idpβ-idpβ pcAB) = pcBBr-idpβ-idpβ (pcAB-to-pcBB dβ pcAB)
pcAB-to-pcBB-rel dβ (pcABr-switch pcAB pC) = pcBBr-switch (pcAB-to-pcBB dβ pcAB) pC
pcAB-to-pcBB-rel dβ (pcABr-cong r pB) = pcBBr-cong (pcAA-to-pcBA-rel dβ r) pB
cAA-to-cBA : β dβ {a} β codeAA (f (h dβ)) a β codeBA (g (h dβ)) a
cAA-to-cBA dβ = SetQuot-rec SetQuot-level (q[_] β pcAA-to-pcBA dβ) (quot-rel β pcAA-to-pcBA-rel dβ)
cAB-to-cBB : β dβ {b} β codeAB (f (h dβ)) b β codeBB (g (h dβ)) b
cAB-to-cBB dβ = SetQuot-rec SetQuot-level (q[_] β pcAB-to-pcBB dβ) (quot-rel β pcAB-to-pcBB-rel dβ)
-- BX to AX
pcBA-to-pcAA : β dβ {a} β precodeBA (g (h dβ)) a β precodeAA (f (h dβ)) a
pcBB-to-pcAB : β dβ {b} β precodeBB (g (h dβ)) b β precodeAB (f (h dβ)) b
pcBA-to-pcAA dβ (pc-bba d pc pA) = pc-aba d (pcBB-to-pcAB dβ pc) pA
pcBB-to-pcAB dβ (pc-b pB) = pc-aab dβ (pc-a idpβ) pB
pcBB-to-pcAB dβ (pc-bab d pc pB) = pc-aab d (pcBA-to-pcAA dβ pc) pB
abstract
pcBA-to-pcAA-rel : β dβ {a} {pcBAβ pcBAβ : precodeBA (g (h dβ)) a}
β precodeBA-rel pcBAβ pcBAβ
β precodeAA-rel (pcBA-to-pcAA dβ pcBAβ) (pcBA-to-pcAA dβ pcBAβ)
pcBB-to-pcAB-rel : β dβ {a} {pcBBβ pcBBβ : precodeBB (g (h dβ)) a}
β precodeBB-rel pcBBβ pcBBβ
β precodeAB-rel (pcBB-to-pcAB dβ pcBBβ) (pcBB-to-pcAB dβ pcBBβ)
pcBA-to-pcAA-rel dβ (pcBAr-idpβ-idpβ pcBA) = pcAAr-idpβ-idpβ (pcBA-to-pcAA dβ pcBA)
pcBA-to-pcAA-rel dβ (pcBAr-cong r pA) = pcAAr-cong (pcBB-to-pcAB-rel dβ r) pA
pcBB-to-pcAB-rel dβ (pcBBr-idpβ-idpβ pcBB) = pcABr-idpβ-idpβ (pcBB-to-pcAB dβ pcBB)
pcBB-to-pcAB-rel dβ (pcBBr-switch pcBB pC) = pcABr-switch (pcBB-to-pcAB dβ pcBB) pC
pcBB-to-pcAB-rel dβ (pcBBr-cong r pB) = pcABr-cong (pcBA-to-pcAA-rel dβ r) pB
cBA-to-cAA : β dβ {a} β codeBA (g (h dβ)) a β codeAA (f (h dβ)) a
cBA-to-cAA dβ = SetQuot-rec SetQuot-level (q[_] β pcBA-to-pcAA dβ) (quot-rel β pcBA-to-pcAA-rel dβ)
cBB-to-cAB : β dβ {b} β codeBB (g (h dβ)) b β codeAB (f (h dβ)) b
cBB-to-cAB dβ = SetQuot-rec SetQuot-level (q[_] β pcBB-to-pcAB dβ) (quot-rel β pcBB-to-pcAB-rel dβ)
-- roundtrips
abstract
pcBA-to-pcAA-to-pcBA : β dβ {a} (pcBA : precodeBA _ a)
β q[ pcAA-to-pcBA dβ (pcBA-to-pcAA dβ pcBA) ] == q[ pcBA ] :> codeBA _ a
pcBB-to-pcAB-to-pcBB : β dβ {b} (pcBB : precodeBB _ b)
β q[ pcAB-to-pcBB dβ (pcBB-to-pcAB dβ pcBB) ] == q[ pcBB ] :> codeBB _ b
pcBA-to-pcAA-to-pcBA dβ (pc-bba d pc pA) = pcBB-to-pcAB-to-pcBB dβ pc |in-ctx Ξ» c β c-bba d c pA
pcBB-to-pcAB-to-pcBB dβ (pc-b pB) = pcBB-idpβ-idpβ-head pB
pcBB-to-pcAB-to-pcBB dβ (pc-bab d pc pB) = pcBA-to-pcAA-to-pcBA dβ pc |in-ctx Ξ» c β c-bab d c pB
pcAA-to-pcBA-to-pcAA : β dβ {a} (pcAA : precodeAA _ a)
β q[ pcBA-to-pcAA dβ (pcAA-to-pcBA dβ pcAA) ] == q[ pcAA ] :> codeAA _ a
pcAB-to-pcBB-to-pcAB : β dβ {b} (pcAB : precodeAB _ b)
β q[ pcBB-to-pcAB dβ (pcAB-to-pcBB dβ pcAB) ] == q[ pcAB ] :> codeAB _ b
pcAA-to-pcBA-to-pcAA dβ (pc-aba d pc pA) = pcAB-to-pcBB-to-pcAB dβ pc |in-ctx Ξ» c β c-aba d c pA
pcAA-to-pcBA-to-pcAA dβ (pc-a pA) = pcAA-idpβ-idpβ-head pA
pcAB-to-pcBB-to-pcAB dβ (pc-aab d pc pB) = pcAA-to-pcBA-to-pcAA dβ pc |in-ctx Ξ» c β c-aab d c pB
private
pcAA-lemma : β dβ dβ {aβ} (p : h dβ == h dβ) (pcAA : precodeAA _ aβ)
β q[ pcBA-prepend dβ [ ap g p ] (pcAA-to-pcBA dβ pcAA) ]
== q[ pcAA-to-pcBA dβ (pcAA-prepend dβ [ ap f p ] pcAA) ]
pcAB-lemma : β dβ dβ {bβ} (p : h dβ == h dβ) (pcAB : precodeAB _ bβ)
β q[ pcBB-prepend dβ [ ap g p ] (pcAB-to-pcBB dβ pcAB) ]
== q[ pcAB-to-pcBB dβ (pcAB-prepend dβ [ ap f p ] pcAB) ]
pcAA-lemma dβ dβ p (pc-a pA) = ap (Ξ» c β c-bba dβ c pA) $ ! $
q[ β§b idpβ bbβ¦ _ β§a [ ap f p ] baβ¦ _ β§b idpβ ]
=β¨ quot-rel (pcBBr-switch (β§b idpβ) [ p ]) β©
q[ β§b idpβ bbβ¦ _ β§a idpβ baβ¦ _ β§b [ ap g p ] ]
=β¨ pcBB-idpβ-idpβ-head [ ap g p ] β©
q[ β§b [ ap g p ] ]
=β¨ ! (quot-rel (pcBBr-idpβ-idpβ (pc-b [ ap g p ]))) β©
q[ β§b [ ap g p ] bbβ¦ _ β§a idpβ baβ¦ _ β§b idpβ ]
=β
pcAA-lemma dβ dβ p (pc-aba d pc pA) = pcAB-lemma dβ dβ p pc |in-ctx (Ξ» c β c-bba d c pA)
pcAB-lemma dβ dβ p (pc-aab d pc pB) = pcAA-lemma dβ dβ p pc |in-ctx (Ξ» c β c-bab d c pB)
module CodeAAEquivCodeBA (aβ : A) where
eqv-on-image : (dβ : D) β codeAA (f (h dβ)) aβ β codeBA (g (h dβ)) aβ
eqv-on-image dβ = equiv to from to-from from-to where
to : codeAA (f (h dβ)) aβ β codeBA (g (h dβ)) aβ
to = cAA-to-cBA dβ
from : codeBA (g (h dβ)) aβ β codeAA (f (h dβ)) aβ
from = cBA-to-cAA dβ
abstract
to-from : β cBA β to (from cBA) == cBA
to-from = SetQuot-elim
(Ξ» _ β =-preserves-set SetQuot-is-set)
(pcBA-to-pcAA-to-pcBA dβ)
(Ξ» _ β prop-has-all-paths-β (SetQuot-is-set _ _))
from-to : β cAA β from (to cAA) == cAA
from-to = SetQuot-elim
(Ξ» _ β =-preserves-set SetQuot-is-set)
(pcAA-to-pcBA-to-pcAA dβ)
(Ξ» _ β prop-has-all-paths-β (SetQuot-is-set _ _))
abstract
eqv-is-const : β dβ dβ (p : h dβ == h dβ)
β eqv-on-image dβ == eqv-on-image dβ
[ (Ξ» c β codeAA (f c) aβ β codeBA (g c) aβ) β p ]
eqv-is-const dβ dβ p = β-Subtype-in (Ξ» d β is-equiv-prop) $
β-β-from-transp $ Ξ»= $
SetQuot-elim (Ξ» _ β =-preserves-set SetQuot-is-set)
(Ξ» pcAA β
transport (Ξ» c β codeBA (g c) aβ) p q[ pcAA-to-pcBA dβ pcAA ]
=β¨ ap-β (Ξ» b β codeBA b aβ) g p |in-ctx (Ξ» p β coe p q[ pcAA-to-pcBA dβ pcAA ]) β©
transport (Ξ» b β codeBA b aβ) (ap g p) q[ pcAA-to-pcBA dβ pcAA ]
=β¨ transp-cBA-l dβ (ap g p) (pcAA-to-pcBA dβ pcAA) β©
q[ pcBA-prepend dβ [ ! $ ap g p ] (pcAA-to-pcBA dβ pcAA) ]
=β¨ !-ap g p |in-ctx (Ξ» p β q[ pcBA-prepend dβ [ p ] (pcAA-to-pcBA dβ pcAA) ]) β©
q[ pcBA-prepend dβ [ ap g (! p) ] (pcAA-to-pcBA dβ pcAA) ]
=β¨ pcAA-lemma dβ dβ (! p) pcAA β©
q[ pcAA-to-pcBA dβ (pcAA-prepend dβ [ ap f (! p) ] pcAA) ]
=β¨ ap-! f p |in-ctx (Ξ» p β q[ pcAA-to-pcBA dβ (pcAA-prepend dβ [ p ] pcAA) ]) β©
q[ pcAA-to-pcBA dβ (pcAA-prepend dβ [ ! $ ap f p ] pcAA) ]
=β¨ ! $ transp-cAA-l dβ (ap f p) pcAA |in-ctx cAA-to-cBA dβ β©
cAA-to-cBA dβ (transport (Ξ» a β codeAA a aβ) (ap f p) q[ pcAA ])
=β¨ β-ap (Ξ» c β codeAA c aβ) f p |in-ctx (Ξ» p β coe p q[ pcAA ]) |in-ctx cAA-to-cBA dβ β©
cAA-to-cBA dβ (transport (Ξ» c β codeAA (f c) aβ) p q[ pcAA ])
=β)
(Ξ» _ β prop-has-all-paths-β (SetQuot-is-set _ _))
module SE = SurjExt
(Ξ» c β β-is-set SetQuot-is-set SetQuot-is-set)
h h-is-surj
eqv-on-image
eqv-is-const
abstract
eqv : β c β codeAA (f c) aβ β codeBA (g c) aβ
eqv = SE.ext
eqv-Ξ² : β d β eqv (h d) == eqv-on-image d
eqv-Ξ² = SE.Ξ²
module CodeABEquivCodeBB (bβ : B) where
eqv-on-image : (dβ : D) β codeAB (f (h dβ)) bβ β codeBB (g (h dβ)) bβ
eqv-on-image dβ = equiv to from to-from from-to where
to : codeAB (f (h dβ)) bβ β codeBB (g (h dβ)) bβ
to = cAB-to-cBB dβ
from : codeBB (g (h dβ)) bβ β codeAB (f (h dβ)) bβ
from = cBB-to-cAB dβ
abstract
to-from : β cBB β to (from cBB) == cBB
to-from = SetQuot-elim
(Ξ» _ β =-preserves-set SetQuot-is-set)
(pcBB-to-pcAB-to-pcBB dβ)
(Ξ» _ β prop-has-all-paths-β (SetQuot-is-set _ _))
from-to : β cAB β from (to cAB) == cAB
from-to = SetQuot-elim
(Ξ» _ β =-preserves-set SetQuot-is-set)
(pcAB-to-pcBB-to-pcAB dβ)
(Ξ» _ β prop-has-all-paths-β (SetQuot-is-set _ _))
abstract
eqv-is-const : β dβ dβ (p : h dβ == h dβ)
β eqv-on-image dβ == eqv-on-image dβ
[ (Ξ» c β codeAB (f c) bβ β codeBB (g c) bβ) β p ]
eqv-is-const dβ dβ p = β-Subtype-in (Ξ» d β is-equiv-prop) $
β-β-from-transp $ Ξ»= $
SetQuot-elim (Ξ» _ β =-preserves-set SetQuot-is-set)
(Ξ» pcAB β
transport (Ξ» c β codeBB (g c) bβ) p q[ pcAB-to-pcBB dβ pcAB ]
=β¨ ap-β (Ξ» b β codeBB b bβ) g p |in-ctx (Ξ» p β coe p q[ pcAB-to-pcBB dβ pcAB ]) β©
transport (Ξ» b β codeBB b bβ) (ap g p) q[ pcAB-to-pcBB dβ pcAB ]
=β¨ transp-cBB-l dβ (ap g p) (pcAB-to-pcBB dβ pcAB) β©
q[ pcBB-prepend dβ [ ! $ ap g p ] (pcAB-to-pcBB dβ pcAB) ]
=β¨ !-ap g p |in-ctx (Ξ» p β q[ pcBB-prepend dβ [ p ] (pcAB-to-pcBB dβ pcAB) ]) β©
q[ pcBB-prepend dβ [ ap g (! p) ] (pcAB-to-pcBB dβ pcAB) ]
=β¨ pcAB-lemma dβ dβ (! p) pcAB β©
q[ pcAB-to-pcBB dβ (pcAB-prepend dβ [ ap f (! p) ] pcAB) ]
=β¨ ap-! f p |in-ctx (Ξ» p β q[ pcAB-to-pcBB dβ (pcAB-prepend dβ [ p ] pcAB) ]) β©
q[ pcAB-to-pcBB dβ (pcAB-prepend dβ [ ! $ ap f p ] pcAB) ]
=β¨ ! $ transp-cAB-l dβ (ap f p) pcAB |in-ctx cAB-to-cBB dβ β©
cAB-to-cBB dβ (transport (Ξ» a β codeAB a bβ) (ap f p) q[ pcAB ])
=β¨ β-ap (Ξ» c β codeAB c bβ) f p |in-ctx (Ξ» p β coe p q[ pcAB ]) |in-ctx cAB-to-cBB dβ β©
cAB-to-cBB dβ (transport (Ξ» c β codeAB (f c) bβ) p q[ pcAB ])
=β)
(Ξ» _ β prop-has-all-paths-β (SetQuot-is-set _ _))
module SE = SurjExt
(Ξ» c β β-is-set SetQuot-is-set SetQuot-is-set)
h h-is-surj
eqv-on-image
eqv-is-const
abstract
eqv : β c β codeAB (f c) bβ β codeBB (g c) bβ
eqv = SE.ext
eqv-Ξ² : β d β eqv (h d) == eqv-on-image d
eqv-Ξ² = SE.Ξ²
module EqvPAIdEqvPB where
abstract
path-on-image : β dβ dβ
β CodeAAEquivCodeBA.eqv (f (h dβ)) (h dβ)
== CodeABEquivCodeBB.eqv (g (h dβ)) (h dβ)
[ (Ξ» p β codeAP (f (h dβ)) p β codeBP (g (h dβ)) p) β glue (h dβ) ]
path-on-image dβ dβ =
CodeAAEquivCodeBA.eqv-Ξ² (f (h dβ)) dβ
βα΅ lemma
β'α΅ ! (CodeABEquivCodeBB.eqv-Ξ² (g (h dβ)) dβ) where
lemma : CodeAAEquivCodeBA.eqv-on-image (f (h dβ)) dβ
== CodeABEquivCodeBB.eqv-on-image (g (h dβ)) dβ
[ (Ξ» p β codeAP (f (h dβ)) p β codeBP (g (h dβ)) p) β glue (h dβ) ]
lemma = β-Subtype-in (Ξ» d β is-equiv-prop) $
β-β-from-transp $ Ξ»= $ SetQuot-elim
(Ξ» _ β =-preserves-set SetQuot-is-set)
(Ξ» pcAA β
transport (Ξ» p β codeBP (g (h dβ)) p) (glue (h dβ)) q[ pcAA-to-pcBA dβ pcAA ]
=β¨ transp-cBP-glue dβ (pcAA-to-pcBA dβ pcAA) β©
q[ pcAA-to-pcBA dβ pcAA baβ¦ dβ β§b idpβ ]
=β¨ ! $ transp-cAP-glue dβ pcAA |in-ctx cAB-to-cBB dβ β©
cAB-to-cBB dβ (transport (Ξ» p β codeAP (f (h dβ)) p) (glue (h dβ)) q[ pcAA ])
=β)
(Ξ» _ β prop-has-all-paths-β $ SetQuot-is-set _ _)
abstract
path : β cβ cβ
β CodeAAEquivCodeBA.eqv (f cβ) cβ
== CodeABEquivCodeBB.eqv (g cβ) cβ
[ (Ξ» p β codeAP (f cβ) p β codeBP (g cβ) p) β glue cβ ]
path = SurjExt.ext
(Ξ» cβ β Ξ -is-set Ξ» cβ β β-preserves-level $ β-is-set SetQuot-is-set SetQuot-is-set)
h h-is-surj
(Ξ» dβ β SurjExt.ext
(Ξ» cβ β β-preserves-level $ β-is-set SetQuot-is-set SetQuot-is-set)
h h-is-surj
(Ξ» dβ β path-on-image dβ dβ)
(Ξ» _ _ _ β prop-has-all-paths-β $ β-level $ β-is-set SetQuot-is-set SetQuot-is-set))
(Ξ» _ _ _ β prop-has-all-paths-β $ Ξ -is-prop Ξ» _ β β-level $ β-is-set SetQuot-is-set SetQuot-is-set)
cAP-equiv-cBP : β cβ pβ β codeAP (f cβ) pβ β codeBP (g cβ) pβ
cAP-equiv-cBP cβ = Pushout-elim
{P = Ξ» pβ β codeAP (f cβ) pβ β codeBP (g cβ) pβ}
(Ξ» aβ β CodeAAEquivCodeBA.eqv aβ cβ)
(Ξ» bβ β CodeABEquivCodeBB.eqv bβ cβ)
(Ξ» cβ β EqvPAIdEqvPB.path cβ cβ)
module Code = PushoutRec
{D = Pushout span β Type (lmax (lmax (lmax i j) k) l)}
codeAP codeBP (Ξ» cβ β Ξ»= $ ua β cAP-equiv-cBP cβ)
code : Pushout span β Pushout span β Type (lmax (lmax (lmax i j) k) l)
code = Code.f
abstract
code-level : β {pβ pβ} β is-set (code pβ pβ)
code-level {pβ} {pβ} = Pushout-elim
{P = Ξ» pβ β β pβ β is-set (code pβ pβ)}
(Ξ» aβ pβ β codeAP-level {aβ} {pβ})
(Ξ» bβ pβ β codeBP-level {bβ} {pβ})
(Ξ» cβ β prop-has-all-paths-β $ Ξ -is-prop Ξ» pβ β is-set-is-prop)
pβ pβ
code-is-set = code-level
abstract
transp-cPA-glue : β dβ {aβ} (pcAA : precodeAA (f (h dβ)) aβ)
β transport (Ξ» pβ β code pβ (left aβ)) (glue (h dβ)) q[ pcAA ] == q[ pcAA-to-pcBA dβ pcAA ]
transp-cPA-glue dβ {aβ} pcAA =
transport (Ξ» pβ β code pβ (left aβ)) (glue (h dβ)) q[ pcAA ]
=β¨ ap (Ξ» e β coe e q[ pcAA ])
( ap-β (_$ left aβ) code (glue (h dβ))
β ap (ap (_$ left aβ)) (Code.glue-Ξ² (h dβ))
β app=-Ξ² (ua β cAP-equiv-cBP (h dβ)) (left aβ)
β ap ua (CodeAAEquivCodeBA.eqv-Ξ² aβ dβ)) β©
coe (ua (CodeAAEquivCodeBA.eqv-on-image aβ dβ)) q[ pcAA ]
=β¨ coe-Ξ² (CodeAAEquivCodeBA.eqv-on-image aβ dβ) q[ pcAA ] β©
q[ pcAA-to-pcBA dβ pcAA ]
=β
transp-cPB-glue : β dβ {bβ} (pcAB : precodeAB (f (h dβ)) bβ)
β transport (Ξ» pβ β code pβ (right bβ)) (glue (h dβ)) q[ pcAB ] == q[ pcAB-to-pcBB dβ pcAB ]
transp-cPB-glue dβ {bβ} pcAB =
transport (Ξ» pβ β code pβ (right bβ)) (glue (h dβ)) q[ pcAB ]
=β¨ ap (Ξ» e β coe e q[ pcAB ])
( ap-β (_$ right bβ) code (glue (h dβ))
β ap (ap (_$ right bβ)) (Code.glue-Ξ² (h dβ))
β app=-Ξ² (ua β cAP-equiv-cBP (h dβ)) (right bβ)
β ap ua (CodeABEquivCodeBB.eqv-Ξ² bβ dβ)) β©
coe (ua (CodeABEquivCodeBB.eqv-on-image bβ dβ)) q[ pcAB ]
=β¨ coe-Ξ² (CodeABEquivCodeBB.eqv-on-image bβ dβ) q[ pcAB ] β©
q[ pcAB-to-pcBB dβ pcAB ]
=β
-- code to path
abstract
pcAA-to-pcBA-to-path : β dβ {aβ} (pcAA : precodeAA _ aβ) β
pcBA-to-path (pcAA-to-pcBA dβ pcAA)
== !β [ glue (h dβ) ] ββ' pcAA-to-path pcAA
pcAB-to-pcBB-to-path : β dβ {bβ} (pcAB : precodeAB _ bβ) β
pcBB-to-path (pcAB-to-pcBB dβ pcAB)
== !β [ glue (h dβ) ] ββ' pcAB-to-path pcAB
pcAA-to-pcBA-to-path dβ (pc-a pA) = ββ'-unit-l (!β [ glue (h dβ) ] ββ' apβ left pA)
pcAA-to-pcBA-to-path dβ (pc-aba d pc pA) =
ap (Ξ» p β p ββ' !β [ glue (h d) ] ββ' apβ left pA) (pcAB-to-pcBB-to-path dβ pc)
β ββ'-assoc (!β [ glue (h dβ) ]) (pcAB-to-path pc) (!β [ glue (h d) ] ββ' apβ left pA)
pcAB-to-pcBB-to-path dβ (pc-aab d pc pB) =
ap (Ξ» p β p ββ' [ glue (h d) ] ββ' apβ right pB) (pcAA-to-pcBA-to-path dβ pc)
β ββ'-assoc (!β [ glue (h dβ) ]) (pcAA-to-path pc) ([ glue (h d) ] ββ' apβ right pB)
abstract
decodeAA-is-decodeBA : β {aβ} cβ β
decodeAA {f cβ} {aβ} == decodeBA {g cβ} {aβ}
[ (Ξ» pβ β code pβ (left aβ) β pβ =β left aβ) β glue cβ ]
decodeAA-is-decodeBA {aβ = aβ} = SurjExt.ext
(Ξ» _ β β-preserves-level $ Ξ -is-set Ξ» _ β Trunc-level) h h-is-surj
(Ξ» dβ β β-β-from-transp $ Ξ»= $ SetQuot-elim
{P = Ξ» cAA β transport (_=β left aβ) (glue (h dβ)) (decodeAA cAA)
== decodeBA (transport (Ξ» pβ β code pβ (left aβ)) (glue (h dβ)) cAA)}
(Ξ» _ β =-preserves-set Trunc-level)
(Ξ» pcAA β
transport (_=β left aβ) (glue (h dβ)) (pcAA-to-path pcAA)
=β¨ transpβ-idf=βcst [ glue (h dβ) ] (pcAA-to-path pcAA) β©
!β [ glue (h dβ) ] ββ pcAA-to-path pcAA
=β¨ ββ=ββ' [ ! (glue (h dβ)) ] (pcAA-to-path pcAA) β©
!β [ glue (h dβ) ] ββ' pcAA-to-path pcAA
=β¨ ! $ pcAA-to-pcBA-to-path dβ pcAA β©
pcBA-to-path (pcAA-to-pcBA dβ pcAA)
=β¨ ! $ ap (Ξ» e β decodeBA (β> e q[ pcAA ])) (CodeAAEquivCodeBA.eqv-Ξ² aβ dβ) β©
decodeBA (β> (CodeAAEquivCodeBA.eqv aβ (h dβ)) q[ pcAA ])
=β¨ ! $ ap decodeBA (coe-Ξ² (CodeAAEquivCodeBA.eqv aβ (h dβ)) q[ pcAA ]) β©
decodeBA (coe (ua (CodeAAEquivCodeBA.eqv aβ (h dβ))) q[ pcAA ])
=β¨ ! $ ap (Ξ» p β decodeBA (coe p q[ pcAA ])) (app=-Ξ² (ua β cAP-equiv-cBP (h dβ)) (left aβ)) β©
decodeBA (coe (app= (Ξ»= Ξ» pβ β ua (cAP-equiv-cBP (h dβ) pβ)) (left aβ)) q[ pcAA ])
=β¨ ! $ ap (Ξ» p β decodeBA (coe (app= p (left aβ)) q[ pcAA ])) (Code.glue-Ξ² (h dβ)) β©
decodeBA (coe (app= (ap code (glue (h dβ))) (left aβ)) q[ pcAA ])
=β¨ ap (Ξ» p β decodeBA (coe p q[ pcAA ])) (β-ap (Ξ» fβ β fβ (left aβ)) code (glue (h dβ))) β©
decodeBA (transport (Ξ» pβ β code pβ (left aβ)) (glue (h dβ)) q[ pcAA ])
=β)
(Ξ» _ β prop-has-all-paths-β $ Trunc-level {n = 0} _ _))
(Ξ» _ _ _ β prop-has-all-paths-β $ β-level $ Ξ -is-set Ξ» _ β Trunc-level)
abstract
decodeAB-is-decodeBB : β {bβ} cβ β
decodeAB {f cβ} {bβ} == decodeBB {g cβ} {bβ}
[ (Ξ» pβ β code pβ (right bβ) β pβ =β right bβ) β glue cβ ]
decodeAB-is-decodeBB {bβ = bβ} = SurjExt.ext
(Ξ» _ β β-preserves-level $ Ξ -is-set Ξ» _ β Trunc-level) h h-is-surj
(Ξ» dβ β β-β-from-transp $ Ξ»= $ SetQuot-elim
{P = Ξ» cAB β transport (_=β right bβ) (glue (h dβ)) (decodeAB cAB)
== decodeBB (transport (Ξ» pβ β code pβ (right bβ)) (glue (h dβ)) cAB)}
(Ξ» _ β =-preserves-set Trunc-level)
(Ξ» pcAB β
transport (_=β right bβ) (glue (h dβ)) (pcAB-to-path pcAB)
=β¨ transpβ-idf=βcst [ glue (h dβ) ] (pcAB-to-path pcAB) β©
!β [ glue (h dβ) ] ββ pcAB-to-path pcAB
=β¨ ββ=ββ' [ ! (glue (h dβ)) ] (pcAB-to-path pcAB) β©
!β [ glue (h dβ) ] ββ' pcAB-to-path pcAB
=β¨ ! $ pcAB-to-pcBB-to-path dβ pcAB β©
pcBB-to-path (pcAB-to-pcBB dβ pcAB)
=β¨ ! $ ap (Ξ» e β decodeBB (β> e q[ pcAB ])) (CodeABEquivCodeBB.eqv-Ξ² bβ dβ) β©
decodeBB (β> (CodeABEquivCodeBB.eqv bβ (h dβ)) q[ pcAB ])
=β¨ ! $ ap decodeBB (coe-Ξ² (CodeABEquivCodeBB.eqv bβ (h dβ)) q[ pcAB ]) β©
decodeBB (coe (ua (CodeABEquivCodeBB.eqv bβ (h dβ))) q[ pcAB ])
=β¨ ! $ ap (Ξ» p β decodeBB (coe p q[ pcAB ])) (app=-Ξ² (ua β cAP-equiv-cBP (h dβ)) (right bβ)) β©
decodeBB (coe (app= (Ξ»= Ξ» pβ β ua (cAP-equiv-cBP (h dβ) pβ)) (right bβ)) q[ pcAB ])
=β¨ ! $ ap (Ξ» p β decodeBB (coe (app= p (right bβ)) q[ pcAB ])) (Code.glue-Ξ² (h dβ)) β©
decodeBB (coe (app= (ap code (glue (h dβ))) (right bβ)) q[ pcAB ])
=β¨ ap (Ξ» p β decodeBB (coe p q[ pcAB ])) (β-ap (Ξ» fβ β fβ (right bβ)) code (glue (h dβ))) β©
decodeBB (transport (Ξ» pβ β code pβ (right bβ)) (glue (h dβ)) q[ pcAB ])
=β)
(Ξ» _ β prop-has-all-paths-β $ Trunc-level {n = 0} _ _))
(Ξ» _ _ _ β prop-has-all-paths-β $ β-level $ Ξ -is-set Ξ» _ β Trunc-level)
abstract
decodeAP-is-decodeBP : β cβ pβ
β decodeAP {f cβ} {pβ} == decodeBP {g cβ} {pβ}
[ (Ξ» pβ β code pβ pβ β pβ =β pβ) β glue cβ ]
decodeAP-is-decodeBP cβ = Pushout-elim
{P = Ξ» pβ β decodeAP {f cβ} {pβ} == decodeBP {g cβ} {pβ}
[ (Ξ» pβ β code pβ pβ β pβ =β pβ) β glue cβ ]}
(Ξ» aβ β decodeAA-is-decodeBA {aβ = aβ} cβ)
(Ξ» bβ β decodeAB-is-decodeBB {bβ = bβ} cβ)
(Ξ» _ β prop-has-all-paths-β $ β-level $ Ξ -is-set Ξ» _ β Trunc-level)
decode : β {pβ pβ} β code pβ pβ β pβ =β pβ
decode {pβ} {pβ} = Pushout-elim
{P = Ξ» pβ β code pβ pβ β pβ =β pβ}
(Ξ» aβ β decodeAP {aβ} {pβ})
(Ξ» bβ β decodeBP {bβ} {pβ})
(Ξ» cβ β decodeAP-is-decodeBP cβ pβ)
pβ
| {
"alphanum_fraction": 0.5274369626,
"avg_line_length": 49.7644230769,
"ext": "agda",
"hexsha": "bc6734a499ec29d85e08ff59ac292f7268528578",
"lang": "Agda",
"max_forks_count": 1,
"max_forks_repo_forks_event_max_datetime": "2018-12-26T21:31:57.000Z",
"max_forks_repo_forks_event_min_datetime": "2018-12-26T21:31:57.000Z",
"max_forks_repo_head_hexsha": "e7d663b63d89f380ab772ecb8d51c38c26952dbb",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "mikeshulman/HoTT-Agda",
"max_forks_repo_path": "theorems/homotopy/vankampen/Code.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "e7d663b63d89f380ab772ecb8d51c38c26952dbb",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "mikeshulman/HoTT-Agda",
"max_issues_repo_path": "theorems/homotopy/vankampen/Code.agda",
"max_line_length": 107,
"max_stars_count": null,
"max_stars_repo_head_hexsha": "e7d663b63d89f380ab772ecb8d51c38c26952dbb",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "mikeshulman/HoTT-Agda",
"max_stars_repo_path": "theorems/homotopy/vankampen/Code.agda",
"max_stars_repo_stars_event_max_datetime": null,
"max_stars_repo_stars_event_min_datetime": null,
"num_tokens": 8952,
"size": 20702
} |
{-# OPTIONS --cubical --no-import-sorts --safe #-}
open import Cubical.Core.Everything
open import Cubical.Relation.Binary.Raw
module Cubical.Relation.Binary.Reasoning.Preorder {c β} {A : Type c} (P : Preorder A β) where
open Preorder P
------------------------------------------------------------------------
-- Publicly re-export the contents of the base module
open import Cubical.Relation.Binary.Reasoning.Base.Single _βΌ_ isPreorder public
| {
"alphanum_fraction": 0.6391982183,
"avg_line_length": 32.0714285714,
"ext": "agda",
"hexsha": "e9a699340bc25b259149e9f191737c5c073e49ae",
"lang": "Agda",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "737f922d925da0cd9a875cb0c97786179f1f4f61",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "bijan2005/univalent-foundations",
"max_forks_repo_path": "Cubical/Relation/Binary/Reasoning/Preorder.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "737f922d925da0cd9a875cb0c97786179f1f4f61",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "bijan2005/univalent-foundations",
"max_issues_repo_path": "Cubical/Relation/Binary/Reasoning/Preorder.agda",
"max_line_length": 93,
"max_stars_count": null,
"max_stars_repo_head_hexsha": "737f922d925da0cd9a875cb0c97786179f1f4f61",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "bijan2005/univalent-foundations",
"max_stars_repo_path": "Cubical/Relation/Binary/Reasoning/Preorder.agda",
"max_stars_repo_stars_event_max_datetime": null,
"max_stars_repo_stars_event_min_datetime": null,
"num_tokens": 105,
"size": 449
} |
------------------------------------------------------------------------
-- The Agda standard library
--
-- This module is DEPRECATED. Please use the
-- Relation.Binary.Construct.Closure.Reflexive module directly.
------------------------------------------------------------------------
{-# OPTIONS --without-K --safe #-}
module Data.ReflexiveClosure where
open import Relation.Binary.Construct.Closure.Reflexive public
{-# WARNING_ON_IMPORT
"Data.ReflexiveClosure was deprecated in v0.16.
Use Relation.Binary.Construct.Closure.Reflexive instead."
#-}
| {
"alphanum_fraction": 0.5737410072,
"avg_line_length": 30.8888888889,
"ext": "agda",
"hexsha": "43bf72b8c3f5908bfe99310c706247a93594289d",
"lang": "Agda",
"max_forks_count": 1,
"max_forks_repo_forks_event_max_datetime": "2021-11-04T06:54:45.000Z",
"max_forks_repo_forks_event_min_datetime": "2021-11-04T06:54:45.000Z",
"max_forks_repo_head_hexsha": "fb380f2e67dcb4a94f353dbaec91624fcb5b8933",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "DreamLinuxer/popl21-artifact",
"max_forks_repo_path": "agda-stdlib/src/Data/ReflexiveClosure.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "fb380f2e67dcb4a94f353dbaec91624fcb5b8933",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "DreamLinuxer/popl21-artifact",
"max_issues_repo_path": "agda-stdlib/src/Data/ReflexiveClosure.agda",
"max_line_length": 72,
"max_stars_count": 5,
"max_stars_repo_head_hexsha": "fb380f2e67dcb4a94f353dbaec91624fcb5b8933",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "DreamLinuxer/popl21-artifact",
"max_stars_repo_path": "agda-stdlib/src/Data/ReflexiveClosure.agda",
"max_stars_repo_stars_event_max_datetime": "2020-10-10T21:41:32.000Z",
"max_stars_repo_stars_event_min_datetime": "2020-10-07T12:07:53.000Z",
"num_tokens": 99,
"size": 556
} |
{-# OPTIONS --cubical --safe #-}
module Cubical.Data.Prod.Properties where
open import Cubical.Core.Everything
open import Cubical.Data.Prod.Base
open import Cubical.Data.Sigma
open import Cubical.Foundations.Prelude
open import Cubical.Foundations.Equiv
open import Cubical.Foundations.HLevels
open import Cubical.Foundations.Isomorphism
open import Cubical.Foundations.Univalence
private
variable
β β' : Level
A : Type β
B : Type β'
-- Swapping is an equivalence
swap : A Γ B β B Γ A
swap (x , y) = (y , x)
swap-invol : (xy : A Γ B) β swap (swap xy) β‘ xy
swap-invol (_ , _) = refl
isEquivSwap : (A : Type β) (B : Type β') β isEquiv (Ξ» (xy : A Γ B) β swap xy)
isEquivSwap A B = isoToIsEquiv (iso swap swap swap-invol swap-invol)
swapEquiv : (A : Type β) (B : Type β') β A Γ B β B Γ A
swapEquiv A B = (swap , isEquivSwap A B)
swapEq : (A : Type β) (B : Type β') β A Γ B β‘ B Γ A
swapEq A B = ua (swapEquiv A B)
private
open import Cubical.Data.Nat
-- As Γ is defined as a datatype this computes as expected
-- (i.e. "C-c C-n test1" reduces to (2 , 1)). If Γ is implemented
-- using Sigma this would be "transp (Ξ» i β swapEq β β i) i0 (1 , 2)"
test : β Γ β
test = transp (Ξ» i β swapEq β β i) i0 (1 , 2)
testrefl : test β‘ (2 , 1)
testrefl = refl
-- equivalence between the sigma-based definition and the inductive one
AΓBβAΓΞ£B : A Γ B β A ΓΞ£ B
AΓBβAΓΞ£B = isoToEquiv (iso (Ξ» { (a , b) β (a , b)})
(Ξ» { (a , b) β (a , b)})
(Ξ» _ β refl)
(Ξ» { (a , b) β refl }))
AΓBβ‘AΓΞ£B : A Γ B β‘ A ΓΞ£ B
AΓBβ‘AΓΞ£B = ua AΓBβAΓΞ£B
swapΞ£Equiv : (A : Type β) (B : Type β') β A ΓΞ£ B β B ΓΞ£ A
swapΞ£Equiv A B = compEquiv (compEquiv (invEquiv AΓBβAΓΞ£B) (swapEquiv A B)) AΓBβAΓΞ£B
-- truncation for products
isOfHLevelProd : (n : β) β isOfHLevel n A β isOfHLevel n B β isOfHLevel n (A Γ B)
isOfHLevelProd {A = A} {B = B} n h1 h2 =
let h : isOfHLevel n (A ΓΞ£ B)
h = isOfHLevelΞ£ n h1 (Ξ» _ β h2)
in transport (Ξ» i β isOfHLevel n (AΓBβ‘AΓΞ£B {A = A} {B = B} (~ i))) h
Γ-β : β {ββ ββ ββ ββ} {A : Type ββ} {B : Type ββ} {C : Type ββ} {D : Type ββ}
β A β C β B β D β A Γ B β C Γ D
Γ-β {A = A} {B = B} {C = C} {D = D} f g = isoToEquiv (iso Ο Ο Ξ· Ξ΅)
where
Ο : A Γ B β C Γ D
Ο (a , b) = equivFun f a , equivFun g b
Ο : C Γ D β A Γ B
Ο (c , d) = equivFun (invEquiv f) c , equivFun (invEquiv g) d
Ξ· : section Ο Ο
Ξ· (c , d) i = retEq f c i , retEq g d i
Ξ΅ : retract Ο Ο
Ξ΅ (a , b) i = secEq f a i , secEq g b i
| {
"alphanum_fraction": 0.5636077196,
"avg_line_length": 29.523255814,
"ext": "agda",
"hexsha": "2113997fefcd048c8de5076e6473db414d916367",
"lang": "Agda",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "cefeb3669ffdaea7b88ae0e9dd258378418819ca",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "borsiemir/cubical",
"max_forks_repo_path": "Cubical/Data/Prod/Properties.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "cefeb3669ffdaea7b88ae0e9dd258378418819ca",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "borsiemir/cubical",
"max_issues_repo_path": "Cubical/Data/Prod/Properties.agda",
"max_line_length": 83,
"max_stars_count": null,
"max_stars_repo_head_hexsha": "cefeb3669ffdaea7b88ae0e9dd258378418819ca",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "borsiemir/cubical",
"max_stars_repo_path": "Cubical/Data/Prod/Properties.agda",
"max_stars_repo_stars_event_max_datetime": null,
"max_stars_repo_stars_event_min_datetime": null,
"num_tokens": 1070,
"size": 2539
} |
{-# OPTIONS --cubical #-}
open import Agda.Primitive.Cubical
open import Agda.Builtin.Cubical.Path
data S1 : Set where
base : S1
loop : base β‘ base
postulate
weird : S1 β I
bad : (x : S1) β I
bad base = {!!}
bad (loop x) = {!!}
| {
"alphanum_fraction": 0.6074380165,
"avg_line_length": 15.125,
"ext": "agda",
"hexsha": "043d9ec7d5f7c24bf6dc6294e8315bcc95a6da23",
"lang": "Agda",
"max_forks_count": 371,
"max_forks_repo_forks_event_max_datetime": "2022-03-30T19:00:30.000Z",
"max_forks_repo_forks_event_min_datetime": "2015-01-03T14:04:08.000Z",
"max_forks_repo_head_hexsha": "7f58030124fa99dfbf8db376659416f3ad8384de",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "cruhland/agda",
"max_forks_repo_path": "test/Fail/Issue3314.agda",
"max_issues_count": 4066,
"max_issues_repo_head_hexsha": "7f58030124fa99dfbf8db376659416f3ad8384de",
"max_issues_repo_issues_event_max_datetime": "2022-03-31T21:14:49.000Z",
"max_issues_repo_issues_event_min_datetime": "2015-01-10T11:24:51.000Z",
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "cruhland/agda",
"max_issues_repo_path": "test/Fail/Issue3314.agda",
"max_line_length": 37,
"max_stars_count": 1989,
"max_stars_repo_head_hexsha": "7f58030124fa99dfbf8db376659416f3ad8384de",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "cruhland/agda",
"max_stars_repo_path": "test/Fail/Issue3314.agda",
"max_stars_repo_stars_event_max_datetime": "2022-03-30T18:20:48.000Z",
"max_stars_repo_stars_event_min_datetime": "2015-01-09T23:51:16.000Z",
"num_tokens": 85,
"size": 242
} |
module Structure.Categorical.Multi where
open import Data
open import Data.Boolean
open import Data.Tuple using (_β¨―_ ; _,_)
open import Data.Tuple.Raiseα΅£
import Data.Tuple.Raiseα΅£.Functions as Raise
open import Data.Tuple.RaiseTypeα΅£
import Data.Tuple.RaiseTypeα΅£.Functions as RaiseType
open import Function.Multi
open import Function.Multi.Functions
open import Functional using (_βαΆ _)
import Functional.Dependent as Fn
open import Lang.Instance
import Lvl
open import Logic
open import Logic.Predicate
open import Logic.Propositional
open import Numeral.Natural
open import Numeral.Natural.Oper.Comparisons
open import Structure.Setoid
import Structure.Categorical.Names as Names
import Structure.Operator.Names as Names
import Structure.Relator.Names as Names
open import Structure.Relator.Properties
open import Syntax.Function
open import Type
open import Type.Properties.Singleton
private variable β ββ ββ βββ βββ ββ βββ βββ : Lvl.Level
private variable Obj Objβ Objβ : Type{ββ}
module Morphism where
module _
(_βΆ_ : Obj β Obj β Stmt{ββ})
β¦ morphism-equiv : β{x y} β Equiv{ββ}(x βΆ y) β¦
where
{-
-- Examples:
-- MorphismChain(3) T x y z
-- = compose(1) ((x βΆ y) ,_) (MorphismChain(2) T y) z
-- = (x βΆ y) , (MorphismChain(2) T y z)
-- = (x βΆ y) , (y βΆ z) , T(z)
--
-- MorphismChain(4) T x y z w
-- = compose(2) ((x βΆ y) ,_) (MorphismChain(3) T y) z w
-- = (x βΆ y) , (MorphismChain(3) T y z w)
-- = (x βΆ y) , (y βΆ z) , (z βΆ w) , T(w)
MorphismChain : (n : β) β (Obj β Type{ββ}) β (RaiseType.repeat (π(n)) Obj) β Types(Raise.repeat (π(n)) ββ)
MorphismChain 0 T x = T(x)
MorphismChain 1 T x y = (x βΆ y) , T(y)
MorphismChain (π(π(n))) T x y = compose(π(n)) ((x βΆ y) ,_) (MorphismChain(π(n)) T y)
-- Examples:
-- MorphismMapping(2) x y
-- = MorphismChain(2)(x βΆ_) x y
-- = (x βΆ y) β (x βΆ y)
--
-- MorphismMapping(3) x y z
-- = MorphismChain(3)(x βΆ_) x y z
-- = (x βΆ y) β (y βΆ z) β (x βΆ z)
--
-- MorphismMapping(4) x y z w
-- = MorphismChain(4)(x βΆ_) x y z w
-- = (x βΆ y) β (y βΆ z) β (z βΆ w) β (x βΆ w)
MorphismMapping : (n : β) β (RaiseType.repeat n Obj) β Type{ββ}
MorphismMapping(0) = Unit
MorphismMapping(1) = {!!}
MorphismMapping(π(π n)) = {!!}
--MorphismMapping(π n) = curry(n) {!Fs β¦ (uncurry(n) (MorphismChain(n)) Fs β (? β ?))!}
{-
MorphismMapping(1) x = ? -- MorphismChain(1)(x βΆ_) x
MorphismMapping(π(π(n))) x = compose(π(n)) (RaiseType.reduceα΅£{π(n)}{\ββ ββ β ββ Lvl.β ββ} _βαΆ _) (MorphismChain(π(π(n))) (x βΆ_) x)
-- MorphismChain(π(π(n)))(x βΆ_) x-}
-}
MorphismFlippedChain : (n : β) β (RaiseType.repeat (π(n)) Obj) β Type{ββ}
MorphismFlippedChain π x = x βΆ x
MorphismFlippedChain (π(n)) x = Out(π(n)) (x βΆ_) x where
Out : (n : β) β (Obj β Type{ββ}) β (RaiseType.repeat (π(n)) Obj) β Type{ββ}
Out 0 T x = T(x)
Out 1 T x y = (x βΆ y) β T(y)
Out (π(π(n))) T x y = Out(π(n)) (z β¦ ((x βΆ y) β T(z))) y
module _
(_βΆβ_ : Objβ β Objβ β Stmt{βββ})
β¦ morphism-equivβ : β{x y} β Equiv{βββ}(x βΆβ y) β¦
(_βΆβ_ : Objβ β Objβ β Stmt{βββ})
β¦ morphism-equivβ : β{x y} β Equiv{βββ}(x βΆβ y) β¦
where
private open module Equivβ{x}{y} = Equiv(morphism-equivβ{x}{y}) using () renaming (_β‘_ to _β‘β_)
module _
{F : Objβ β Objβ}
where
-- Definition of the relation between a function and an operation that says:
-- The function preserves the operation.
-- Often used when defining homomorphisms.
-- Examples:
-- Preserving(0) (map)(Gβ)(Gβ)
-- = β{x} β (map ββ Gβ β‘ Gβ onβ map)
-- = β{x} β (map(Gβ) β‘ Gβ(f))
-- Preserving(1) (map)(Gβ)(Gβ)
-- = β{x y}{f : x βΆ y} β ((map ββ Gβ)(f) β‘ (Gβ onβ map)(f))
-- = β{x y}{f : x βΆ y} β (map(Gβ(f)) β‘ Gβ(map(f)))
-- Preserving(2) (map)(Gβ)(Gβ)
-- = β{x y z}{fβ : y βΆ z}{fβ : x βΆ y} β ((map ββ Gβ)(fβ)(fβ) β‘ (Gβ onβ map)(fβ)(fβ))
-- = β{x y z}{fβ : y βΆ z}{fβ : x βΆ y} β (map(Gβ fβ fβ) β‘ Gβ (map(fβ)) (map(fβ)))
-- Preserving(3) (map)(Gβ)(Gβ)
-- = β{fβ fβ fβ} β ((map ββ Gβ)(fβ)(fβ)(fβ) β‘ (Gβ onβ map)(fβ)(fβ)(fβ))
-- = β{fβ fβ fβ} β (map(Gβ fβ fβ fβ) β‘ Gβ (map(fβ)) (map(fβ)) (map(fβ)))
Preserving : (n : β) β (map : β{x y} β (x βΆβ y) β (F(x) βΆβ F(y))) β (quantifierβ(π(n))(ββ) (MorphismFlippedChain(_βΆβ_)(n))) β (quantifierβ(π(n))(ββ) (MorphismFlippedChain(_βΆβ_)(n))) β (RaiseType.repeat (π(n)) Objβ) β Stmt{if(n β€? 0) then (βββ) else (βββ Lvl.β βββ)}
Preserving 0 map Gβ Gβ x = (map{x}(Gβ) β‘ Gβ)
Preserving 1 map Gβ Gβ x y = β{f : x βΆβ y} β map (Gβ(f)) β‘ Gβ(map f)
Preserving (π(π(n))) map Gβ Gβ x y = {!Preserving(π(n)) map ? ? y!}
-- β{f} β (Gβ(f)) (Gβ(map f))
--Preserving 2 map Gβ Gβ x y z = β{fβ : y βΆβ z}{fβ : x βΆβ y} β (map(Gβ(fβ)(fβ)) β‘ Gβ(map fβ)(map fβ))
-- Preserving (π(π(π(n)))) map Gβ Gβ x y z = {!β{f} β Preserving(π(π(n))) map !}
--test (P β¦ (β{f} β P f)) (f β¦ Preserving (π(π(n))) map {!Gβ!} {!Gβ!} y z) where
-- test : ((P : {!!}) β TYPE ({!!} Lvl.β {!!})) β ((f : {!!} βΆβ {!!}) β RaiseType.repeat (π n) Objβ β Type) β (RaiseType.repeat (π n) Objβ β Type)
-- compose(π(n)) (P β¦ (β{f} β P f)) ({!f β¦ Preserving (π(π(n))) map {!Gβ!} {!Gβ!} {!!} {!!}!})
-- compose(π(n)) {!!} {!!}
-- β{f : x βΆβ y} β
-- Preserving(π(π(n))) map (\{a b} β {!Gβ{a}{x}{b}!}) \{a b} β {!Gβ{a}{F x}{b}!}
{-
-- Preserving 3 map Gβ Gβ a x y z
-- = β{f : a βΆβ x} β Preserving 2 map (Gβ(f)) (Gβ(map f)) x y z
-- = β{f : a βΆβ x}{fβ : x βΆβ y}{fβ : y βΆβ z} β (map(Gβ(f)(fβ)(fβ)) β‘ Gβ(map f)(map fβ)(map fβ))
-- β{x y}{f : x βΆβ y} β Preserving(π(π(n))) (map) (Gβ(f)) (Gβ(map(f)))
{- Preserving(π) (f)(gβ)(gβ) = (f(gβ) β‘ gβ)
Preserving(π(π)) (f)(gβ)(gβ) = (β{x} β f(gβ(x)) β‘ gβ(f(x)))
Preserving(π(π(n))) (f)(gβ)(gβ) = (β{x} β Preserving(π(n)) (f) (gβ(x)) (gβ(f(x))))
-- β{x y z : Objβ}{f : y βΆ z}{g : x βΆ y} β (map(f β g) β‘ map(f) β map(g))
-}
-}
| {
"alphanum_fraction": 0.5083816892,
"avg_line_length": 43.3846153846,
"ext": "agda",
"hexsha": "a61593de71245bcfe6dc15a4bf2d398e8980224f",
"lang": "Agda",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "Lolirofle/stuff-in-agda",
"max_forks_repo_path": "Structure/Categorical/Multi.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "Lolirofle/stuff-in-agda",
"max_issues_repo_path": "Structure/Categorical/Multi.agda",
"max_line_length": 271,
"max_stars_count": 6,
"max_stars_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "Lolirofle/stuff-in-agda",
"max_stars_repo_path": "Structure/Categorical/Multi.agda",
"max_stars_repo_stars_event_max_datetime": "2022-02-05T06:53:22.000Z",
"max_stars_repo_stars_event_min_datetime": "2020-04-07T17:58:13.000Z",
"num_tokens": 2800,
"size": 6204
} |
{- 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
-}
import LibraBFT.Impl.Consensus.LedgerRecoveryData as LedgerRecoveryData
open import LibraBFT.Impl.OBM.Logging.Logging
open import LibraBFT.ImplShared.Consensus.Types
open import Optics.All
open import Util.Prelude
------------------------------------------------------------------------------
open import Data.String using (String)
module LibraBFT.Impl.Consensus.RecoveryData where
findBlocksToPrune
: HashValue β List Block β List QuorumCert
β (List HashValue Γ List Block Γ List QuorumCert)
new
: Maybe Vote
β LedgerRecoveryData
β List Block
β RootMetadata
β List QuorumCert
β Maybe TimeoutCertificate
β Either ErrLog RecoveryData
new lastVote storageLedger blocks0 rootMetadata quorumCerts0 highestTimeoutCertificate = do
(root@(RootInfoβnew rb _ _) , blocks1 , quorumCerts1)
β withErrCtx' (here' []) (LedgerRecoveryData.findRoot blocks0 quorumCerts0 storageLedger)
let (blocksToPrune , blocks , quorumCerts)
= findBlocksToPrune (rb ^β bId) blocks1 quorumCerts1
epoch = rb ^β bEpoch
pure $ mkRecoveryData
(case lastVote of Ξ» where
(just v) β if-dec v ^β vEpoch β epoch then just v else nothing
nothing β nothing)
root
rootMetadata
blocks
quorumCerts
(just blocksToPrune)
(case highestTimeoutCertificate of Ξ» where
(just tc) β if-dec tc ^β tcEpoch β epoch then just tc else nothing
nothing β nothing)
where
here' : List String β List String
here' t = "RecoveryData" β· "new" β· t
-- TODO (the "TODO" is in the Haskell code)
findBlocksToPrune _rootId blocks quorumCerts = ([] , blocks , quorumCerts)
| {
"alphanum_fraction": 0.6781429317,
"avg_line_length": 36.8653846154,
"ext": "agda",
"hexsha": "b5df892b9dfea36e82dbfd93e38cc0b96d669db3",
"lang": "Agda",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "a4674fc473f2457fd3fe5123af48253cfb2404ef",
"max_forks_repo_licenses": [
"UPL-1.0"
],
"max_forks_repo_name": "LaudateCorpus1/bft-consensus-agda",
"max_forks_repo_path": "src/LibraBFT/Impl/Consensus/RecoveryData.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "a4674fc473f2457fd3fe5123af48253cfb2404ef",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"UPL-1.0"
],
"max_issues_repo_name": "LaudateCorpus1/bft-consensus-agda",
"max_issues_repo_path": "src/LibraBFT/Impl/Consensus/RecoveryData.agda",
"max_line_length": 111,
"max_stars_count": null,
"max_stars_repo_head_hexsha": "a4674fc473f2457fd3fe5123af48253cfb2404ef",
"max_stars_repo_licenses": [
"UPL-1.0"
],
"max_stars_repo_name": "LaudateCorpus1/bft-consensus-agda",
"max_stars_repo_path": "src/LibraBFT/Impl/Consensus/RecoveryData.agda",
"max_stars_repo_stars_event_max_datetime": null,
"max_stars_repo_stars_event_min_datetime": null,
"num_tokens": 524,
"size": 1917
} |
{-# OPTIONS --without-K #-}
module Circle where
open import Agda.Prim
open import Data.Product
open import Function renaming (_β_ to _β_)
infixr 8 _β_ -- path composition
infix 4 _β‘_ -- propositional equality
infix 4 _βΌ_ -- homotopy between two functions
infix 4 _β_ -- type of equivalences
infix 2 _β -- equational reasoning
infixr 2 _β‘β¨_β©_ -- equational reasoning
------------------------------------------------------------------------------
-- Identity types
-- Our own version of refl that makes 'a' explicit
data _β‘_ {β} {A : Set β} : (a b : A) β Set β where
refl : (a : A) β (a β‘ a)
pathInd : β {u β} β {A : Set u} β
(C : {x y : A} β x β‘ y β Set β) β
(c : (x : A) β C (refl x)) β
({x y : A} (p : x β‘ y) β C p)
pathInd C c (refl x) = c x
------------------------------------------------------------------------------
-- Ch. 2
-- Lemma 2.1.1
! : β {u} β {A : Set u} {x y : A} β (x β‘ y) β (y β‘ x)
! = pathInd (Ξ» {x} {y} _ β y β‘ x) refl
-- Lemma 2.1.2
_β_ : β {u} β {A : Set u} β {x y z : A} β (x β‘ y) β (y β‘ z) β (x β‘ z)
_β_ {u} {A} {x} {y} {z} p q =
pathInd
(Ξ» {x} {y} p β ((z : A) β (q : y β‘ z) β (x β‘ z)))
(Ξ» x z q β pathInd (Ξ» {x} {z} _ β x β‘ z) refl {x} {z} q)
{x} {y} p z q
-- Lemma 2.1.4
-- p = p . refl
unitTransR : {A : Set} {x y : A} β (p : x β‘ y) β (p β‘ p β refl y)
unitTransR {A} {x} {y} p =
pathInd
(Ξ» {x} {y} p β p β‘ p β (refl y))
(Ξ» x β refl (refl x))
{x} {y} p
-- p = refl . p
unitTransL : {A : Set} {x y : A} β (p : x β‘ y) β (p β‘ refl x β p)
unitTransL {A} {x} {y} p =
pathInd
(Ξ» {x} {y} p β p β‘ (refl x) β p)
(Ξ» x β refl (refl x))
{x} {y} p
-- ! p . p = refl
invTransL : {A : Set} {x y : A} β (p : x β‘ y) β (! p β p β‘ refl y)
invTransL {A} {x} {y} p =
pathInd
(Ξ» {x} {y} p β ! p β p β‘ refl y)
(Ξ» x β refl (refl x))
{x} {y} p
-- p . ! p = refl
invTransR : β {β} {A : Set β} {x y : A} β (p : x β‘ y) β (p β ! p β‘ refl x)
invTransR {β} {A} {x} {y} p =
pathInd
(Ξ» {x} {y} p β p β ! p β‘ refl x)
(Ξ» x β refl (refl x))
{x} {y} p
-- ! (! p) = p
invId : {A : Set} {x y : A} β (p : x β‘ y) β (! (! p) β‘ p)
invId {A} {x} {y} p =
pathInd
(Ξ» {x} {y} p β ! (! p) β‘ p)
(Ξ» x β refl (refl x))
{x} {y} p
-- p . (q . r) = (p . q) . r
assocP : {A : Set} {x y z w : A} β (p : x β‘ y) β (q : y β‘ z) β (r : z β‘ w) β
(p β (q β r) β‘ (p β q) β r)
assocP {A} {x} {y} {z} {w} p q r =
pathInd
(Ξ» {x} {y} p β (z : A) β (w : A) β (q : y β‘ z) β (r : z β‘ w) β
p β (q β r) β‘ (p β q) β r)
(Ξ» x z w q r β
pathInd
(Ξ» {x} {z} q β (w : A) β (r : z β‘ w) β
(refl x) β (q β r) β‘ ((refl x) β q) β r)
(Ξ» x w r β
pathInd
(Ξ» {x} {w} r β
(refl x) β ((refl x) β r) β‘
((refl x) β (refl x)) β r)
(Ξ» x β (refl (refl x)))
{x} {w} r)
{x} {z} q w r)
{x} {y} p z w q r
-- ! (p β q) β‘ ! q β ! p
invComp : {A : Set} {x y z : A} β (p : x β‘ y) β (q : y β‘ z) β
! (p β q) β‘ ! q β ! p
invComp {A} {x} {y} {z} p q =
pathInd
(Ξ» {x} {y} p β (z : A) β (q : y β‘ z) β ! (p β q) β‘ ! q β ! p)
(Ξ» x z q β
pathInd
(Ξ» {x} {z} q β ! (refl x β q) β‘ ! q β ! (refl x))
(Ξ» x β refl (refl x))
{x} {z} q)
{x} {y} p z q
-- Introduce equational reasoning syntax to simplify proofs
_β‘β¨_β©_ : β {u} β {A : Set u} (x : A) {y z : A} β (x β‘ y) β (y β‘ z) β (x β‘ z)
_ β‘β¨ p β© q = p β q
bydef : β {u} β {A : Set u} {x : A} β (x β‘ x)
bydef {u} {A} {x} = refl x
_β : β {u} β {A : Set u} (x : A) β x β‘ x
_β x = refl x
------------------------------------------------------------------------------
-- Functions are functors
-- Lemma 2.2.1
-- computation rule: ap f (refl x) = refl (f x)
ap : β {β β'} β {A : Set β} {B : Set β'} {x y : A} β
(f : A β B) β (x β‘ y) β (f x β‘ f y)
ap {β} {β'} {A} {B} {x} {y} f p =
pathInd
(Ξ» {x} {y} p β f x β‘ f y)
(Ξ» x β refl (f x))
{x} {y} p
-- Lemma 2.2.2
-- f (p β q) β‘ f p β f q
apfTrans : β {u} β {A B : Set u} {x y z : A} β
(f : A β B) β (p : x β‘ y) β (q : y β‘ z) β ap f (p β q) β‘ (ap f p) β (ap f q)
apfTrans {u} {A} {B} {x} {y} {z} f p q =
pathInd {u}
(Ξ» {x} {y} p β (z : A) β (q : y β‘ z) β
ap f (p β q) β‘ (ap f p) β (ap f q))
(Ξ» x z q β
pathInd {u}
(Ξ» {x} {z} q β
ap f (refl x β q) β‘ (ap f (refl x)) β (ap f q))
(Ξ» x β refl (refl (f x)))
{x} {z} q)
{x} {y} p z q
-- f (! p) β‘ ! (f p)
apfInv : β {u} β {A B : Set u} {x y : A} β (f : A β B) β (p : x β‘ y) β
ap f (! p) β‘ ! (ap f p)
apfInv {u} {A} {B} {x} {y} f p =
pathInd {u}
(Ξ» {x} {y} p β ap f (! p) β‘ ! (ap f p))
(Ξ» x β refl (ap f (refl x)))
{x} {y} p
-- g (f p) β‘ (g β f) p
apfComp : {A B C : Set} {x y : A} β (f : A β B) β (g : B β C) β (p : x β‘ y) β
ap g (ap f p) β‘ ap (g β f) p
apfComp {A} {B} {C} {x} {y} f g p =
pathInd
(Ξ» {x} {y} p β ap g (ap f p) β‘ ap (g β f) p)
(Ξ» x β refl (ap g (ap f (refl x))))
{x} {y} p
-- id p β‘ p
apfId : {A : Set} {x y : A} β (p : x β‘ y) β ap id p β‘ p
apfId {A} {x} {y} p =
pathInd
(Ξ» {x} {y} p β ap id p β‘ p)
(Ξ» x β refl (refl x))
{x} {y} p
-- Transport
-- Lemma 2.3.1
transport : β {β β'} β {A : Set β} {x y : A} β
(P : A β Set β') β (p : x β‘ y) β P x β P y
transport {β} {β'} {A} {x} {y} P p =
pathInd
(Ξ» {x} {y} p β (P x β P y))
(Ξ» _ β id)
{x} {y} p
-------------------------------------------------------------------------------
-- Homotopies and equivalences
_βΌ_ : β {β β'} β {A : Set β} {P : A β Set β'} β
(f g : (x : A) β P x) β Set (_β_ β β')
_βΌ_ {β} {β'} {A} {P} f g = (x : A) β f x β‘ g x
-- Quasi-inverses
record qinv {β β'} {A : Set β} {B : Set β'} (f : A β B) :
Set (_β_ β β') where
constructor mkqinv
field
g : B β A
Ξ± : (f β g) βΌ id
Ξ² : (g β f) βΌ id
-- Example 2.4.7
idqinv : β {β} β {A : Set β} β qinv {β} {β} {A} {A} id
idqinv = record {
g = id ;
Ξ± = Ξ» b β refl b ;
Ξ² = Ξ» a β refl a
}
-- Equivalences
record isequiv {β β'} {A : Set β} {B : Set β'} (f : A β B) :
Set (_β_ β β') where
constructor mkisequiv
field
g : B β A
Ξ± : (f β g) βΌ id
h : B β A
Ξ² : (h β f) βΌ id
equivβ : β {β β'} β {A : Set β} {B : Set β'} {f : A β B} β qinv f β isequiv f
equivβ (mkqinv qg qΞ± qΞ²) = mkisequiv qg qΞ± qg qΞ²
_β_ : β {β β'} (A : Set β) (B : Set β') β Set (_β_ β β')
A β B = Ξ£ (A β B) isequiv
-- Lemma 2.4.12
idequiv : β {β} {A : Set β} β A β A
idequiv = (id , equivβ idqinv)
------------------------------------------------------------------------------
-- Sec. 2.10: Universes; univalence
idtoeqv : {A B : Set} β (A β‘ B) β (A β B)
idtoeqv {A} {B} p =
pathInd
(Ξ» {A} {B} p β A β B)
(Ξ» A β idequiv)
{A} {B} p
postulate
univalence : {A B : Set} β (A β‘ B) β (A β B)
------------------------------------------------------------------------------
-- Sec. 2.11: Identity types
-- Thm 2.11.3
transportId : {A B : Set} {y z : A} β (f g : A β B) β
(p : y β‘ z) β (q : f y β‘ g y) β
transport (Ξ» x β f x β‘ g x) p q β‘ ! (ap f p) β q β (ap g p)
transportId {A} {B} {y} {z} f g p q =
pathInd
(Ξ» {y} {z} p β (q : f y β‘ g y) β
transport (Ξ» x β f x β‘ g x) p q β‘ ! (ap f p) β q β (ap g p))
(Ξ» y q β q
β‘β¨ unitTransR q β©
q β refl (g y)
β‘β¨ unitTransL (q β refl (g y)) β©
refl (f y) β q β refl (g y) β)
{y} {z} p q
------------------------------------------------------------------------------
-- Exercise: let's show that the following two definitions of the
-- circle are "the same"
{--
data SΒΉ where
base : SΒΉ
loop : base β‘ base
data SΒΉ' where
south : SΒΉ'
north : SΒΉ'
east : south β‘ north
west : south β‘ north
--}
module Circle1 where
private
data SΒΉ* : Set where
base* : SΒΉ*
SΒΉ : Set
SΒΉ = SΒΉ*
base : SΒΉ
base = base*
postulate
loop : base β‘ base
recSΒΉ : {C : Set} β (cbase : C) β (cloop : cbase β‘ cbase) β SΒΉ β C
recSΒΉ cbase cloop base* = cbase
postulate
Ξ²recSΒΉ : {C : Set} β (cbase : C) β (cloop : cbase β‘ cbase) β
ap (recSΒΉ cbase cloop) loop β‘ cloop
indSΒΉ : {C : SΒΉ β Set} β
(cbase : C base) β (cloop : transport C loop cbase β‘ cbase) β
(circle : SΒΉ) β C circle
indSΒΉ cbase cloop base* = cbase
open Circle1 public
--
module Circle2 where
private
data SΒΉ'* : Set where
south* : SΒΉ'*
north* : SΒΉ'*
SΒΉ' : Set
SΒΉ' = SΒΉ'*
south : SΒΉ'
south = south*
north : SΒΉ'
north = north*
postulate
east : south β‘ north
west : south β‘ north
recSΒΉ' : {C : Set} β
(csouth cnorth : C) β (ceast cwest : csouth β‘ cnorth) β SΒΉ' β C
recSΒΉ' csouth cnorth ceast cwest south* = csouth
recSΒΉ' csouth cnorth ceast cwest north* = cnorth
postulate
Ξ²receastSΒΉ' : {C : Set} β
(csouth cnorth : C) β (ceast cwest : csouth β‘ cnorth) β
ap (recSΒΉ' csouth cnorth ceast cwest) east β‘ ceast
Ξ²recwestSΒΉ' : {C : Set} β
(csouth cnorth : C) β (ceast cwest : csouth β‘ cnorth) β
ap (recSΒΉ' csouth cnorth ceast cwest) west β‘ cwest
indSΒΉ' : {C : SΒΉ' β Set} β
(csouth : C south) β (cnorth : C north) β
(ceast : transport C east csouth β‘ cnorth) β
(cwest : transport C west csouth β‘ cnorth) β
(circle : SΒΉ') β C circle
indSΒΉ' csouth cnorth ceast cwest south* = csouth
indSΒΉ' csouth cnorth ceast cwest north* = cnorth
open Circle2 public
-- Maps between Circle1 and Circle2 and back
-- fcircle (base) = south
-- fcircle (loop) = east β ! west
fcircle : SΒΉ β SΒΉ'
fcircle = recSΒΉ south (east β ! west)
floop : ap fcircle loop β‘ (east β ! west)
floop = Ξ²recSΒΉ south (east β ! west)
-- gcircle (south) = base
-- gcircle (north) = base
-- gcircle (east) = loop
-- gcircle (west) = refl base
gcircle : SΒΉ' β SΒΉ
gcircle = recSΒΉ' base base loop (refl base)
geast : ap gcircle east β‘ loop
geast = Ξ²receastSΒΉ' base base loop (refl base)
gwest : ap gcircle west β‘ (refl base)
gwest = Ξ²recwestSΒΉ' base base loop (refl base)
-- compose both ways
-- gf (base) = base
-- gf (loop) = loop
gf : SΒΉ β SΒΉ
gf = gcircle β fcircle
gfloop : ap gf loop β‘ loop
gfloop = ap gf loop
β‘β¨ ! (apfComp fcircle gcircle loop) β©
ap gcircle (ap fcircle loop)
β‘β¨ ap (ap gcircle) floop β©
ap gcircle (east β ! west)
β‘β¨ apfTrans gcircle east (! west) β©
ap gcircle east β ap gcircle (! west)
β‘β¨ ap (Ξ» x β ap gcircle east β x) (apfInv gcircle west) β©
ap gcircle east β ! (ap gcircle west)
β‘β¨ ap (Ξ» x β ap gcircle east β ! x) gwest β©
ap gcircle east β (refl base)
β‘β¨ ! (unitTransR (ap gcircle east)) β©
ap gcircle east
β‘β¨ geast β©
loop β
Ξ±loop : transport (Ξ» x β gf x β‘ x) loop (refl base) β‘ refl base
Ξ±loop = transport (Ξ» x β gf x β‘ x) loop (refl base)
β‘β¨ transportId gf id loop (refl base) β© -- Thm 2.11.3
! (ap gf loop) β refl base β ap id loop
β‘β¨ ap (Ξ» x β ! (ap gf loop) β refl base β x) (apfId loop) β©
! (ap gf loop) β refl base β loop
β‘β¨ ap (Ξ» x β ! (ap gf loop) β x) (! (unitTransL loop)) β©
! (ap gf loop) β loop
β‘β¨ ap (Ξ» x β ! x β loop) gfloop β©
! loop β loop
β‘β¨ invTransL loop β©
refl base β
Ξ²circle : gf βΌ id
Ξ²circle =
indSΒΉ {Ξ» x β gf x β‘ x}
(refl base)
Ξ±loop
-- fg (south) = south
-- fg (north) = south
-- fg (east) = east β ! west
-- fg (west) = refl south
fg : SΒΉ' β SΒΉ'
fg = fcircle β gcircle
fgeast : ap fg east β‘ east β ! west
fgeast = ap fg east
β‘β¨ ! (apfComp gcircle fcircle east) β©
ap fcircle (ap gcircle east)
β‘β¨ ap (ap fcircle) geast β©
ap fcircle loop
β‘β¨ floop β©
(east β ! west) β
fgwest : ap fg west β‘ refl south
fgwest = ap fg west
β‘β¨ ! (apfComp gcircle fcircle west) β©
ap fcircle (ap gcircle west)
β‘β¨ ap (ap fcircle) gwest β©
ap fcircle (refl base)
β‘β¨ bydef β©
refl south β
Ξ±east : transport (Ξ» x β fg x β‘ x) east (refl south) β‘ west
Ξ±east = transport (Ξ» x β fg x β‘ x) east (refl south)
β‘β¨ transportId fg id east (refl south) β© -- Thm 2.11.3
! (ap fg east) β refl south β ap id east
β‘β¨ ap (Ξ» x β ! (ap fg east) β refl south β x) (apfId east) β©
! (ap fg east) β refl south β east
β‘β¨ ap (Ξ» x β ! (ap fg east) β x) (! (unitTransL east)) β©
! (ap fg east) β east
β‘β¨ ap (Ξ» x β ! x β east) fgeast β©
! (east β ! west) β east
β‘β¨ ap (Ξ» x β x β east) (invComp east (! west)) β©
(! (! west) β ! east) β east
β‘β¨ ! (assocP (! (! west)) (! east) east) β©
! (! west) β ! east β east
β‘β¨ ap (Ξ» x β ! (! west) β x) (invTransL east) β©
! (! west) β refl north
β‘β¨ ! (unitTransR (! (! west))) β©
! (! west)
β‘β¨ invId west β©
west β
Ξ±west : transport (Ξ» x β fg x β‘ x) west (refl south) β‘ west
Ξ±west = transport (Ξ» x β fg x β‘ x) west (refl south)
β‘β¨ transportId fg id west (refl south) β© -- Thm 2.11.3
! (ap fg west) β refl south β ap id west
β‘β¨ ap (Ξ» x β ! (ap fg west) β refl south β x) (apfId west) β©
! (ap fg west) β refl south β west
β‘β¨ ap (Ξ» x β ! (ap fg west) β x) (! (unitTransL west)) β©
! (ap fg west) β west
β‘β¨ ap (Ξ» x β ! x β west) fgwest β©
! (refl south) β west
β‘β¨ ! (unitTransL west) β©
west β
Ξ±circle : fg βΌ id
Ξ±circle =
indSΒΉ' {Ξ» x β fg x β‘ x}
(refl south) west
Ξ±east
Ξ±west
--
sequiv : SΒΉ β SΒΉ'
sequiv = (fcircle , equivβ (mkqinv gcircle Ξ±circle Ξ²circle))
spath : SΒΉ β‘ SΒΉ'
spath with univalence
... | (_ , eq) = isequiv.g eq sequiv
------------------------------------------------------------------------------
| {
"alphanum_fraction": 0.4136978735,
"avg_line_length": 27.3283018868,
"ext": "agda",
"hexsha": "f55b6f716648fff6d73eb9b7de0612b23a5c70ce",
"lang": "Agda",
"max_forks_count": 3,
"max_forks_repo_forks_event_max_datetime": "2019-09-10T09:47:13.000Z",
"max_forks_repo_forks_event_min_datetime": "2016-05-29T01:56:33.000Z",
"max_forks_repo_head_hexsha": "003835484facfde0b770bc2b3d781b42b76184c1",
"max_forks_repo_licenses": [
"BSD-2-Clause"
],
"max_forks_repo_name": "JacquesCarette/pi-dual",
"max_forks_repo_path": "OBT/Circle.agda",
"max_issues_count": 4,
"max_issues_repo_head_hexsha": "003835484facfde0b770bc2b3d781b42b76184c1",
"max_issues_repo_issues_event_max_datetime": "2021-10-29T20:41:23.000Z",
"max_issues_repo_issues_event_min_datetime": "2018-06-07T16:27:41.000Z",
"max_issues_repo_licenses": [
"BSD-2-Clause"
],
"max_issues_repo_name": "JacquesCarette/pi-dual",
"max_issues_repo_path": "OBT/Circle.agda",
"max_line_length": 80,
"max_stars_count": 14,
"max_stars_repo_head_hexsha": "003835484facfde0b770bc2b3d781b42b76184c1",
"max_stars_repo_licenses": [
"BSD-2-Clause"
],
"max_stars_repo_name": "JacquesCarette/pi-dual",
"max_stars_repo_path": "OBT/Circle.agda",
"max_stars_repo_stars_event_max_datetime": "2021-05-05T01:07:57.000Z",
"max_stars_repo_stars_event_min_datetime": "2015-08-18T21:40:15.000Z",
"num_tokens": 6050,
"size": 14484
} |
-- Andreas, 2015-03-17
-- Andreas, 2020-10-26 conform to Issue1428a
open import Agda.Builtin.Size
data β₯ : Set where
data SizeLt (i : Size) : Set where
wrap : Size< i β SizeLt i
-- This definition of size predecessor should be forbidden...
module _ (i : Size) where
postulate
pred : Size< i
-- ...otherwise the injectivity test loops here.
iter : β i β SizeLt i β β₯
iter i (wrap j) = iter j (wrap (pred j))
loop : Size β β₯
loop i = iter i (wrap (pred i))
absurd : β₯
absurd = FIXME loop β
-- Testcase temporarily mutilated, original error:
--
-- -Issue1428c.agda:...
-- -We don't like postulated sizes in parametrized modules.
--
-- +Issue1428c.agda:...
-- +Not in scope:
-- + FIXME at Issue1428c.agda:...
-- +when scope checking FIXME
| {
"alphanum_fraction": 0.6595744681,
"avg_line_length": 21.4857142857,
"ext": "agda",
"hexsha": "8a5a573d330de89fa5ecbbc07d19daa66206ede1",
"lang": "Agda",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "ed8ac6f4062ea8a20fa0f62d5db82d4e68278338",
"max_forks_repo_licenses": [
"BSD-3-Clause"
],
"max_forks_repo_name": "shlevy/agda",
"max_forks_repo_path": "test/Fail/Issue1428c.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "ed8ac6f4062ea8a20fa0f62d5db82d4e68278338",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"BSD-3-Clause"
],
"max_issues_repo_name": "shlevy/agda",
"max_issues_repo_path": "test/Fail/Issue1428c.agda",
"max_line_length": 61,
"max_stars_count": null,
"max_stars_repo_head_hexsha": "ed8ac6f4062ea8a20fa0f62d5db82d4e68278338",
"max_stars_repo_licenses": [
"BSD-3-Clause"
],
"max_stars_repo_name": "shlevy/agda",
"max_stars_repo_path": "test/Fail/Issue1428c.agda",
"max_stars_repo_stars_event_max_datetime": null,
"max_stars_repo_stars_event_min_datetime": null,
"num_tokens": 238,
"size": 752
} |
------------------------------------------------------------------------------
-- Note on the equality type class using Kettelhoit's approach
------------------------------------------------------------------------------
{-# OPTIONS --exact-split #-}
{-# OPTIONS --no-sized-types #-}
{-# OPTIONS --no-universe-polymorphism #-}
{-# OPTIONS --without-K #-}
-- Adapted from Kettelhoit's thesis.
module FOT.FOTC.TypeClasses.EqualityKettelhoit where
open import FOTC.Base
open import FOTC.Data.Bool
open import FOTC.Data.Bool.Type
open import FOTC.Data.Nat.Type
------------------------------------------------------------------------------
record Eq (P : D β Set) : Setβ where
field equal : β {tβ tβ} β P tβ β P tβ β Set
open Eq {{...}} public
boolEq : β {bβ bβ} β Bool bβ β Bool bβ β Set
boolEq btrue btrue = Bool true
boolEq bfalse bfalse = Bool true
{-# CATCHALL #-}
boolEq _ _ = Bool false
nEq : β {m n} β N m β N n β Set
nEq nzero nzero = Bool true
nEq (nsucc Nm) (nsucc Nn) = Bool true
{-# CATCHALL #-}
nEq _ _ = Bool false
instance
eqInstanceBool : Eq Bool
eqInstanceBool = record { equal = boolEq }
eqInstanceN : Eq N
eqInstanceN = record { equal = nEq }
testβ : Set
testβ = equal nzero (nsucc nzero)
testβ : Set
testβ = equal bfalse bfalse
eqN-sym : β {m n} β (Nm : N m) β (Nn : N n) β equal Nm Nn β equal Nn Nm
eqN-sym nzero nzero h = h
eqN-sym nzero (nsucc Nn) h = h
eqN-sym (nsucc Nm) nzero h = h
eqN-sym (nsucc Nm) (nsucc Nn) h = h
postulate eqN-sym' : β {m n} β (Nm : N m) β (Nn : N n) β equal Nm Nn β equal Nn Nm
-- {-# ATP prove eqN-sym' #-}
| {
"alphanum_fraction": 0.5158020274,
"avg_line_length": 28.4237288136,
"ext": "agda",
"hexsha": "6f272e8a048889a5946a103972ac223d56066c52",
"lang": "Agda",
"max_forks_count": 3,
"max_forks_repo_forks_event_max_datetime": "2018-03-14T08:50:00.000Z",
"max_forks_repo_forks_event_min_datetime": "2016-09-19T14:18:30.000Z",
"max_forks_repo_head_hexsha": "2fc9f2b81052a2e0822669f02036c5750371b72d",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "asr/fotc",
"max_forks_repo_path": "notes/FOT/FOTC/TypeClasses/EqualityKettelhoit.agda",
"max_issues_count": 2,
"max_issues_repo_head_hexsha": "2fc9f2b81052a2e0822669f02036c5750371b72d",
"max_issues_repo_issues_event_max_datetime": "2017-01-01T14:34:26.000Z",
"max_issues_repo_issues_event_min_datetime": "2016-10-12T17:28:16.000Z",
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "asr/fotc",
"max_issues_repo_path": "notes/FOT/FOTC/TypeClasses/EqualityKettelhoit.agda",
"max_line_length": 82,
"max_stars_count": 11,
"max_stars_repo_head_hexsha": "2fc9f2b81052a2e0822669f02036c5750371b72d",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "asr/fotc",
"max_stars_repo_path": "notes/FOT/FOTC/TypeClasses/EqualityKettelhoit.agda",
"max_stars_repo_stars_event_max_datetime": "2021-09-12T16:09:54.000Z",
"max_stars_repo_stars_event_min_datetime": "2015-09-03T20:53:42.000Z",
"num_tokens": 508,
"size": 1677
} |
-- 2014-03-05 Andreas, issue reported by James
-- {-# OPTIONS -v tc.with.strip:60 -v:impossible:10 #-}
data Nat : Set where
zero : Nat
pattern pzero = zero
f : Nat β Nat
f pzero with pzero
f pzero | pzero = pzero
-- ERROR WAS:
-- With clause pattern pzero is not an instance of its parent pattern
-- when checking that the clause
-- f pzero with pzero
-- f pzero | pzero = pzero
-- has type Nat β Nat
| {
"alphanum_fraction": 0.6789215686,
"avg_line_length": 20.4,
"ext": "agda",
"hexsha": "e7660d87608c755c73ff48c644698eac0ef39ccd",
"lang": "Agda",
"max_forks_count": 371,
"max_forks_repo_forks_event_max_datetime": "2022-03-30T19:00:30.000Z",
"max_forks_repo_forks_event_min_datetime": "2015-01-03T14:04:08.000Z",
"max_forks_repo_head_hexsha": "231d6ad8e77b67ff8c4b1cb35a6c31ccd988c3e9",
"max_forks_repo_licenses": [
"BSD-3-Clause"
],
"max_forks_repo_name": "Agda-zh/agda",
"max_forks_repo_path": "test/Succeed/Issue1074.agda",
"max_issues_count": 4066,
"max_issues_repo_head_hexsha": "ed8ac6f4062ea8a20fa0f62d5db82d4e68278338",
"max_issues_repo_issues_event_max_datetime": "2022-03-31T21:14:49.000Z",
"max_issues_repo_issues_event_min_datetime": "2015-01-10T11:24:51.000Z",
"max_issues_repo_licenses": [
"BSD-3-Clause"
],
"max_issues_repo_name": "shlevy/agda",
"max_issues_repo_path": "test/Succeed/Issue1074.agda",
"max_line_length": 69,
"max_stars_count": 1989,
"max_stars_repo_head_hexsha": "ed8ac6f4062ea8a20fa0f62d5db82d4e68278338",
"max_stars_repo_licenses": [
"BSD-3-Clause"
],
"max_stars_repo_name": "shlevy/agda",
"max_stars_repo_path": "test/Succeed/Issue1074.agda",
"max_stars_repo_stars_event_max_datetime": "2022-03-30T18:20:48.000Z",
"max_stars_repo_stars_event_min_datetime": "2015-01-09T23:51:16.000Z",
"num_tokens": 126,
"size": 408
} |
{-# OPTIONS --without-K --safe #-}
module Dodo.Binary.Functional where
-- Stdlib imports
open import Level using (Level; _β_)
open import Relation.Binary using (Rel; REL)
-- Local imports
open import Dodo.Binary.Equality
-- # Definitions #
Functional : β {a b ββ ββ : Level} {A : Set a} {B : Set b}
β Rel B ββ
β REL A B ββ
---------------------
β Set (a β b β ββ β ββ)
Functional _β_ r = β x yβ yβ β r x yβ β r x yβ β yβ β yβ
-- The /explicit/ x, yβ, and yβ are crucial. If they're implicit, Agda will attempt to
-- instantiate them when absent, which often fails to resolve. Not sure why.
-- # Operations #
module _ {a ββ ββ ββ : Level} {A : Set a} {β : Rel A ββ} {P : Rel A ββ} {Q : Rel A ββ} where
functional-ββ : P ββ Q β Functional β Q β Functional β P
functional-ββ PβQ funcQ x yβ yβ Pxyβ Pxyβ = funcQ x yβ yβ (ββ-apply PβQ Pxyβ) (ββ-apply PβQ Pxyβ)
| {
"alphanum_fraction": 0.614334471,
"avg_line_length": 29.3,
"ext": "agda",
"hexsha": "6b8d380808192152c29324c14125393b7e57cd4f",
"lang": "Agda",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "376f0ccee1e1aa31470890e494bcb534324f598a",
"max_forks_repo_licenses": [
"BSD-3-Clause"
],
"max_forks_repo_name": "sourcedennis/agda-dodo",
"max_forks_repo_path": "src/Dodo/Binary/Functional.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "376f0ccee1e1aa31470890e494bcb534324f598a",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"BSD-3-Clause"
],
"max_issues_repo_name": "sourcedennis/agda-dodo",
"max_issues_repo_path": "src/Dodo/Binary/Functional.agda",
"max_line_length": 99,
"max_stars_count": null,
"max_stars_repo_head_hexsha": "376f0ccee1e1aa31470890e494bcb534324f598a",
"max_stars_repo_licenses": [
"BSD-3-Clause"
],
"max_stars_repo_name": "sourcedennis/agda-dodo",
"max_stars_repo_path": "src/Dodo/Binary/Functional.agda",
"max_stars_repo_stars_event_max_datetime": null,
"max_stars_repo_stars_event_min_datetime": null,
"num_tokens": 346,
"size": 879
} |
module Data.Environment {a} {A : Set a} where
open import Algebra
open import Data.Nat
open import Data.Empty using (β₯-elim)
open import Data.Pos using (ββΊ; suc; replicateβΊ)
open import Data.List as L using (List; []; _β·_; [_]; _++_; map; concatMap; replicate)
open import Data.List.Any using (here; there)
open import Data.List.Any.BagAndSetEquality as B using ()
open import Data.List.Any.Membership.Propositional public using (_β_; _βΌ[_]_; bag)
open import Data.Product using (Ξ£-syntax; ββ; _Γ_; projβ; projβ; _,_)
open import Data.Sum using (_β_; injβ; injβ)
open import Function using (_$_; flip)
open import Function.Equality using (_β¨$β©_)
open import Function.Inverse using (id; sym; _β_)
open Function.Inverse.Inverse using (to; from)
open import Relation.Binary.PropositionalEquality as P using (_β‘_)
private module ++ = Monoid (L.monoid A)
bubble : (xs {ys} : List A) {x y z : A} β
z β xs ++ y β· x β· ys β z β xs ++ x β· y β· ys
bubble [] (here px) = there (here px)
bubble [] (there (here px)) = here px
bubble [] (there (there i)) = there (there i)
bubble (x β· xs) (here px) = here px
bubble (x β· xs) (there i) = there (bubble xs i)
-- There is a bijection between indices into the environment
-- ΞBAΞ and the environment ΞABΞ. This is called a 'bubble',
-- because it swaps two adjacent elements, as in bubble
-- sort.
bbl : (xs {ys} : List A) {x y : A} β
xs ++ y β· x β· ys βΌ[ bag ] xs ++ x β· y β· ys
bbl xs {ys} {x} {y} = record
{ to = P.β-to-βΆ (bubble xs)
; from = P.β-to-βΆ (bubble xs)
; inverse-of = record
{ left-inverse-of = inv xs
; right-inverse-of = inv xs } }
where
inv : (xs {ys} : List A) {x y z : A} β
(i : z β xs ++ y β· x β· ys) β
bubble xs (bubble xs i) β‘ i
inv [] (here px) = P.refl
inv [] (there (here px)) = P.refl
inv [] (there (there i)) = P.refl
inv (x β· xs) (here px) = P.refl
inv (x β· xs) (there i) = P.cong there (inv xs i)
-- There is a bijection between indices into the environment
-- ΞΞAΞ and the environment ΞAΞΞ.
fwd : (xs ys {zs} : List A) {w : A} β
xs ++ ys ++ w β· zs βΌ[ bag ] xs ++ w β· ys ++ zs
fwd (x β· xs) ys = B.β·-cong P.refl (fwd xs ys)
fwd [] ys = fwd' ys
where
fwd' : (xs {ys} : List A) {w : A} β
xs ++ w β· ys βΌ[ bag ] w β· xs ++ ys
fwd' [] = id
fwd' (x β· xs) = bbl [] β B.β·-cong P.refl (fwd' xs)
bwd : (xs ys {zs} : List A) {w : A} β
xs ++ w β· ys ++ zs βΌ[ bag ] xs ++ ys ++ w β· zs
bwd xs ys = sym (fwd xs ys)
-- List all possible ways to split a list xs into two lists xsβ and xsβ.
allSplit : (xs : List A) β List (Ξ£[ xsβ β List A ] Ξ£[ xsβ β List A ] xs β‘ xsβ ++ xsβ)
allSplit [] = L.[ [] , [] , P.refl ]
allSplit (x β· xs) = now β· later
where
now = ([] , x β· xs , P.refl)
later = flip map (allSplit xs) $
Ξ»{(xsβ , xsβ , p) β (x β· xsβ , xsβ , P.cong (x β·_) p)}
-- Test if allSplit does as advertised.
{-
private
module _ where
postulate x y z w : A
test-allSplit :
allSplit (x β· y β· z β· w β· []) β‘
( ( [] , (x β· y β· z β· w β· []) , P.refl )
β· ( (x β· []) , (y β· z β· w β· []) , P.refl )
β· ( (x β· y β· []) , (z β· w β· []) , P.refl )
β· ( (x β· y β· z β· []) , (w β· []) , P.refl )
β· ( (x β· y β· z β· w β· [] ) , [] , P.refl )
β· [] )
test-allSplit = P.refl
-}
-- It is possible to list all environments Ξ for which there
-- exists a bijection between indices into the environment Ξ
-- and the environment Ξ.
all : (xs : List A) β List (Ξ£[ ys β List A ] xs βΌ[ bag ] ys)
all [] = ([] , id) β· []
all (x β· xs) = concatMap insAll (all xs)
where
insAll : Ξ£[ ys β List A ] xs βΌ[ bag ] ys
β List (Ξ£[ ys β List A ] x β· xs βΌ[ bag ] ys)
insAll (ys , b) = map insOne (allSplit ys)
where
insOne : Ξ£[ ysβ β List A ] Ξ£[ ysβ β List A ] ys β‘ ysβ ++ ysβ
β Ξ£[ zs β List A ] x β· xs βΌ[ bag ] zs
insOne (ysβ , ysβ , p) = ysβ ++ x β· ysβ ,
bwd [] ysβ {ysβ} {x} β B.β·-cong P.refl (P.subst (ys βΌ[ bag ]_) p id β b)
-- Any element which is contained in a list created using replicate
-- is equal to the replicated element.
β-replicate : {x y : A} (n : β) β x β y β· replicate n y β x β‘ y
β-replicate zero (here px) = px
β-replicate zero (there ())
β-replicate (suc n) (here px) = px
β-replicate (suc n) (there m) = β-replicate n m
-- Any bag which is equivalent to the bag created using replicate,
-- is equal to the bag created using replicate.
all-replicate : {xs : List A} {y : A} (n : β) β
xs βΌ[ bag ] replicate n y β xs β‘ replicate n y
all-replicate {[]} {y} zero b = P.refl
all-replicate {[]} {y} (suc n) b with from b β¨$β© here P.refl; ... | ()
all-replicate {x β· xs} {y} zero b with to b β¨$β© here P.refl; ... | ()
all-replicate {x β· xs} {y} (suc n) b = P.congβ _β·_ x=y (all-replicate n b')
where
x=y : x β‘ y
x=y = β-replicate n (to b β¨$β© here P.refl)
b' : xs βΌ[ bag ] replicate n y
b' = B.drop-cons (P.subst (Ξ» x β x β· xs βΌ[ bag ] y β· replicate n y) x=y b)
-- The same lemma holds for replicateβΊ.
all-replicateβΊ : {xs : List A} {y : A} (n : ββΊ) β
xs βΌ[ bag ] replicateβΊ n y β xs β‘ replicateβΊ n y
all-replicateβΊ {[]} {y} (suc n) b with from b β¨$β© here P.refl; ... | ()
all-replicateβΊ {x β· xs} {y} (suc n) b = P.congβ _β·_ x=y (all-replicate n b')
where
x=y : x β‘ y
x=y = β-replicate n (to b β¨$β© here P.refl)
b' : xs βΌ[ bag ] replicate n y
b' = B.drop-cons (P.subst (Ξ» x β x β· xs βΌ[ bag ] y β· replicate n y) x=y b)
-- There is a bijection between indices into the environment
-- ΞΞ£ΞΞ and the environment ΞΞΣΠ.
swpβ : (xs ys zs {ws} : List A) β
xs ++ zs ++ ys ++ ws βΌ[ bag ] xs ++ ys ++ zs ++ ws
swpβ xs [] zs = id
swpβ xs (y β· ys) zs =
( P.substβ _βΌ[ bag ]_ (++.assoc xs [ y ] _) (++.assoc xs [ y ] _)
$ swpβ (xs ++ [ y ]) ys zs
) β fwd xs zs
-- Alias for swpβ.
swp = swpβ
-- There is a bijection between indices into the environment
-- ΞΣΠand the environment ΞΞΞ£. This is mostly a convenience
-- function because of the annoyance of using ++.identity
-- in the logic proofs.
swpβ : (xs ys {zs} : List A) β
xs ++ zs ++ ys βΌ[ bag ] xs ++ ys ++ zs
swpβ xs ys {zs} =
( P.substβ (Ξ» ys' zs' β xs ++ zs ++ ys' βΌ[ bag ] xs ++ ys ++ zs')
(projβ ++.identity ys)
(projβ ++.identity zs)
$ swpβ xs ys zs
)
-- There is a bijection between indices into the environment
-- ΞΣΠand the environment ΞΞΞ£. This is mostly a convenience
-- function because of the annoyance of using ++.identity
-- in the logic proofs.
swpβ : (xs {ys} : List A) β
ys ++ xs βΌ[ bag ] xs ++ ys
swpβ = swpβ []
_-_ : (xs : List A) {x : A} (i : x β xs) β List A
(x β· xs) - (here _) = xs
(x β· xs) - (there i) = x β· xs - i
del-[] : {x y : A} (i : y β x β· []) β (x β· []) - i β‘ []
del-[] (here px) = P.refl
del-[] (there ())
-- Given a proof of membership x β xs, we can be sure that
-- there are two lists xsβ and xsβ s.t.
--
-- (1) xs = xsβ ++ x β· xsβ; and
-- (2) xs - i = xsβ ++ xsβ.
--
-- That is to say, that we can break the list xs into a prefix,
-- the element x, and a suffix, and that if we delete that occurrence
-- of x, we are left with the prefix and the suffix.
ββ++ : {xs : List A} {x : A} (i : x β xs) β
ββ Ξ» xsβ xsβ β xs β‘ xsβ ++ x β· xsβ Γ xs - i β‘ xsβ ++ xsβ
ββ++ {x β· xs} (here P.refl) = ([] , xs , P.refl , P.refl)
ββ++ {x β· xs} (there i) with ββ++ {xs} i
... | (xsβ , xsβ , pβ , pβ) = (x β· xsβ , xsβ , P.cong (x β·_) pβ , P.cong (x β·_) pβ)
-- Given two lists which are bag-equal, we can prove that if we delete
-- the same element from both lists, the resulting lists are also bag-equal.
del-to : {xs ys : List A} {x : A} β
(eq : xs βΌ[ bag ] ys) (i : x β xs) β
xs - i βΌ[ bag ] ys - (to eq β¨$β© i)
del-to {xs} {ys} {x} eq i
with ββ++ {xs} i
... | (xsβ , xsβ , pβ , pβ) rewrite pβ | pβ
with ββ++ {ys} (to eq β¨$β© i)
... | (ysβ , ysβ , qβ , qβ) rewrite qβ | qβ
= B.drop-cons (fwd [] ysβ β eq β sym (fwd [] xsβ))
del-from : {xs ys : List A} {x : A} β
(eq : ys βΌ[ bag ] xs) (i : x β xs) β
ys - (from eq β¨$β© i) βΌ[ bag ] xs - i
del-from {xs} {ys} {x} eq i
with ββ++ {xs} i
... | (xsβ , xsβ , pβ , pβ) rewrite pβ | pβ
with ββ++ {ys} (from eq β¨$β© i)
... | (ysβ , ysβ , qβ , qβ) rewrite qβ | qβ
= B.drop-cons (fwd [] xsβ β eq β sym (fwd [] ysβ))
-- Split a environment based on a proof of membership (used as index).
split : β (xs {ys} : List A) {x : A} β
(i : x β xs ++ ys) β
Ξ£[ j β x β xs ] ((xs ++ ys) - i β‘ xs - j ++ ys) β
Ξ£[ j β x β ys ] ((xs ++ ys) - i β‘ xs ++ ys - j)
split [] i = injβ (i , P.refl)
split (_ β· xs) (here px) = injβ (here px , P.refl)
split (_ β· xs) (there i) with split xs i
... | injβ (j , p) = injβ (there j , P.cong (_ β·_) p)
... | injβ (j , p) = injβ (j , P.cong (_ β·_) p)
-- -}
-- -}
-- -}
-- -}
-- -}
| {
"alphanum_fraction": 0.4965318536,
"avg_line_length": 37.0395256917,
"ext": "agda",
"hexsha": "bb9db5bcf772e19b2ad3beb98d548970faa0cef5",
"lang": "Agda",
"max_forks_count": 1,
"max_forks_repo_forks_event_max_datetime": "2018-09-05T08:58:13.000Z",
"max_forks_repo_forks_event_min_datetime": "2018-09-05T08:58:13.000Z",
"max_forks_repo_head_hexsha": "fb5e78d6182276e4d93c4c0e0d563b6b027bc5c2",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "pepijnkokke/nodcap",
"max_forks_repo_path": "src/cpnd1/Data/Environment.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "fb5e78d6182276e4d93c4c0e0d563b6b027bc5c2",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "pepijnkokke/nodcap",
"max_issues_repo_path": "src/cpnd1/Data/Environment.agda",
"max_line_length": 117,
"max_stars_count": 4,
"max_stars_repo_head_hexsha": "fb5e78d6182276e4d93c4c0e0d563b6b027bc5c2",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "wenkokke/nodcap",
"max_stars_repo_path": "src/cpnd1/Data/Environment.agda",
"max_stars_repo_stars_event_max_datetime": "2019-09-24T20:16:35.000Z",
"max_stars_repo_stars_event_min_datetime": "2018-09-05T08:58:11.000Z",
"num_tokens": 3505,
"size": 9371
} |
module x06-747Connectives-hc where
import Relation.Binary.PropositionalEquality as Eq
open Eq using (_β‘_; refl)
open Eq.β‘-Reasoning
open import Data.Nat using (β)
open import Function using (_β_)
------------------------------------------------------------------------------
-- BEGIN : Copied from 747Isomorphism.
postulate
extensionality : β {A B : Set} {f g : A β B}
β (β (x : A) β f x β‘ g x)
-----------------------
β f β‘ g
infix 0 _β_
record _β_ (A B : Set) : Set where
constructor mk-β -- This has been added, not in PLFA
field
to : A β B
from : B β A
fromβto : β (x : A) β from (to x) β‘ x
toβfrom : β (y : B) β to (from y) β‘ y
open _β_
infix 0 _β²_
record _β²_ (A B : Set) : Set where
field
to : A β B
from : B β A
fromβto : β (x : A) β from (to x) β‘ x
open _β²_
record _β_ (A B : Set) : Set where
field
to : A β B
from : B β A
open _β_
-- You may copy over the various reasoning modules if you wish.
-- END : Copied from 747Isomorphism.
------------------------------------------------------------------------------
------------------------------------------------------------------------------
-- logical AND is Cartesian product.
data _Γ_ (A : Set) (B : Set) : Set where
β¨_,_β© :
A
β B
-----
β A Γ B
-- destructors (aka eliminators) for Γ.
projβ : β {A B : Set}
β A Γ B
-----
β A
projβ β¨ a , _ β© = a
projβ : β {A B : Set}
β A Γ B
-----
β B
projβ β¨ _ , b β© = b
-- equivalent construction using records
record _Γβ²_ (A B : Set) : Set where
field
projββ² : A
projββ² : B
open _Γβ²_
-- eta-equivalence relates constructors and destructors
Ξ·-Γ : β {A B : Set} (w : A Γ B) β β¨ projβ w , projβ w β© β‘ w
Ξ·-Γ β¨ a , b β© = refl
-- type with two members
infixr 2 _Γ_
data Bool : Set where
true : Bool
false : Bool
-- type with three members (used in examples)
data Tri : Set where
aa : Tri
bb : Tri
cc : Tri
-- Bool Γ Tri has six members
Γ-count : Bool Γ Tri β β
Γ-count β¨ true , aa β© = 1
Γ-count β¨ true , bb β© = 2
Γ-count β¨ true , cc β© = 3
Γ-count β¨ false , aa β© = 4
Γ-count β¨ false , bb β© = 5
Γ-count β¨ false , cc β© = 6
-- Cartesian product is commutative and associative up to isomorphism.
swap : β {A B : Set} β A Γ B β B Γ A
swap β¨ a , b β© = β¨ b , a β©
Γ-comm : β {A B : Set} β A Γ B β B Γ A
to Γ-comm = swap
from Γ-comm = swap
fromβto Γ-comm β¨ _ , _ β© = refl
toβfrom Γ-comm β¨ _ , _ β© = refl
Γ-assoc : β {A B C : Set} β (A Γ B) Γ C β A Γ (B Γ C)
to Γ-assoc β¨ β¨ a , b β© , c β© = β¨ a , β¨ b , c β© β©
from Γ-assoc β¨ a , β¨ b , c β© β© = β¨ β¨ a , b β© , c β©
fromβto Γ-assoc β¨ β¨ _ , _ β© , _ β© = refl
toβfrom Γ-assoc β¨ _ , β¨ _ , _ β© β© = refl
-- A β B is isomorphic to (A β B) Γ (B β A)
iff-iso-if-onlyif : β {A B : Set} β A β B β (A β B) Γ (B β A)
_β_.to iff-iso-if-onlyif record { to = to ; from = from } = β¨ to , from β©
to (_β_.from iff-iso-if-onlyif β¨ AβB , BβA β©) = AβB
from (_β_.from iff-iso-if-onlyif β¨ AβB , BβA β©) = BβA
fromβto iff-iso-if-onlyif record { to = to ; from = from } = refl
toβfrom iff-iso-if-onlyif β¨ AβB , BβA β© = refl
------------------------------------------------------------------------------
-- logical True is a type with one member (unit)
data β€ : Set where
tt :
--
β€
Ξ·-β€ : β (w : β€) β tt β‘ w
Ξ·-β€ tt = refl
β€-count : β€ β β
β€-count tt = 1
-- Unit is the left and right identity of product.
β€-identityΛ‘ : β {A : Set} β β€ Γ A β A
to β€-identityΛ‘ β¨ β€ , a β© = a
from β€-identityΛ‘ a = β¨ tt , a β©
fromβto β€-identityΛ‘ β¨ tt , a β© = refl
toβfrom β€-identityΛ‘ a = refl
β€-identityΚ³ : β {A : Set} β (A Γ β€) β A
to β€-identityΚ³ β¨ a , β€ β© = a
from β€-identityΚ³ a = β¨ a , tt β©
fromβto β€-identityΚ³ β¨ a , tt β© = refl
toβfrom β€-identityΚ³ a = refl
------------------------------------------------------------------------------
-- logical OR (disjunction) is sum (disjoint union)
data _β_ : Set β Set β Set where
injβ : β {A B : Set}
β A
-----
β A β B
injβ : β {A B : Set}
β B
-----
β A β B
-- a way to eliminate a sum (but easier to use pattern-matching to eliminate sums)
case-β : β {A B C : Set}
β (A β C)
β (B β C)
β A β B
-----------
β C
case-β f g (injβ x) = f x
case-β f g (injβ x) = g x
-- eta equivalence for sums
Ξ·-β : β {A B : Set} (w : A β B) β case-β injβ injβ w β‘ w
Ξ·-β (injβ _) = refl
Ξ·-β (injβ _) = refl
-- generalization
uniq-β : β {A B C : Set}
β (h : A β B β C) β (w : A β B)
β case-β (h β injβ) (h β injβ) w β‘ h w
uniq-β h (injβ _) = refl
uniq-β h (injβ _) = refl
infix 1 _β_
-- Bool β Tri has five members
β-count : Bool β Tri β β
β-count (injβ true) = 1
β-count (injβ false) = 2
β-count (injβ aa) = 3
β-count (injβ bb) = 4
β-count (injβ cc) = 5
-- Sum is commutative up to isomorphism.
β-comm : β {A B : Set} β A β B β B β A
to β-comm (injβ a) = injβ a
to β-comm (injβ b) = injβ b
from β-comm (injβ b) = injβ b
from β-comm (injβ a) = injβ a
fromβto β-comm (injβ _) = refl
fromβto β-comm (injβ _) = refl
toβfrom β-comm (injβ _) = refl
toβfrom β-comm (injβ _) = refl
-- Sum is associative up to isomorphism.
β-assoc : β {A B C : Set} β (A β B) β C β A β (B β C)
to β-assoc (injβ (injβ a)) = injβ a
to β-assoc (injβ (injβ b)) = injβ (injβ b)
to β-assoc (injβ c) = injβ (injβ c)
from β-assoc (injβ a) = injβ (injβ a)
from β-assoc (injβ (injβ b)) = injβ (injβ b)
from β-assoc (injβ (injβ c)) = injβ c
fromβto β-assoc (injβ (injβ _)) = refl
fromβto β-assoc (injβ (injβ _)) = refl
fromβto β-assoc (injβ _) = refl
toβfrom β-assoc (injβ _) = refl
toβfrom β-assoc (injβ (injβ _)) = refl
toβfrom β-assoc (injβ (injβ _)) = refl
------------------------------------------------------------------------------
-- logical False is the empty type ("bottom", "empty")
data β₯ : Set where
-- no clauses
-- Ex falso quodlibet "from falsehood, anything follows".
β₯-elim : β {A : Set}
β β₯
--
β A
β₯-elim ()
uniq-β₯ : β {C : Set}
β (h : β₯ β C) β (w : β₯)
β β₯-elim w β‘ h w
uniq-β₯ h ()
β₯-count : β₯ β β
β₯-count ()
-- Empty is the left unit of sum up to isomorphism.
β-identityΛ‘ : β {A : Set} β β₯ β A β A
to β-identityΛ‘ (injβ a) = a
from β-identityΛ‘ a = injβ a
fromβto β-identityΛ‘ (injβ _) = refl
toβfrom β-identityΛ‘ _ = refl
-- Empty is the right unit of sum up to isomorphism.
β-identityΚ³ : β {A : Set} β A β β₯ β A
to β-identityΚ³ (injβ a) = a
from β-identityΚ³ a = injβ a
fromβto β-identityΚ³ (injβ _) = refl
toβfrom β-identityΚ³ _ = refl
------------------------------------------------------------------------------
-- logical implication (if-then) is the function TYPE constructor.
-- Eliminating an if-then (modus ponens) is function application.
β-elim : β {A B : Set}
β (A β B)
β A
-------
β B
β-elim L M = L M
-- β-elim works because eta-reduction for β is built in
Ξ·-β : β {A B : Set}
β (f : A β B)
β (Ξ» (x : A) β f x) β‘ f
Ξ·-β f = refl
-- The function space A β B is called the exponential Bᴬ.
-- Bool β Tri has 3Β² (9) members.
β-count : (Bool β Tri) β β
β-count f with f true | f false
... | aa | aa = 1
... | aa | bb = 2
... | aa | cc = 3
... | bb | aa = 4
... | bb | bb = 5
... | bb | cc = 6
... | cc | aa = 7
... | cc | bb = 8
... | cc | cc = 9
------------------------------------------------------------------------------
-- "currying" : functions of multiple parameters
-- math : (p ^ n) ^ m = p ^ (n * m)
-- types : (A ^ B) ^ C β A ^ (B Γ C)
currying : β {A B C : Set} β (A β B β C) β (A Γ B β C)
to currying f = Ξ» { β¨ a , b β© β f a b }
from currying f = Ξ» a b β f β¨ a , b β©
fromβto currying _ = refl
toβfrom currying f = extensionality Ξ» { β¨ x , y β© β refl }
-- math, : p ^ (n + m) = (p ^ n) * (p ^ m)
-- types : (A β B β C) β ((A β C) Γ (B β C))
β-distrib-β : β {A B C : Set} β (A β B β C) β ((A β C) Γ (B β C))
to β-distrib-β f = β¨ (Ξ» a β f (injβ a)) , (Ξ» b β f (injβ b)) β©
from β-distrib-β β¨ AβC , BβC β© = Ξ» { (injβ a) β AβC a ; (injβ b) β BβC b }
fromβto β-distrib-β _ = extensionality Ξ» { (injβ x) β refl ; (injβ x) β refl }
toβfrom β-distrib-β = Ξ»{ β¨ g , h β© β refl }
-- math : (p * n) ^ m = (p ^ m) * (n ^ m)
-- types : (A β B Γ C) β (A β B) Γ (A β C)
β-distrib-Γ : β {A B C : Set} β (A β B Γ C) β (A β B) Γ (A β C)
to β-distrib-Γ f = β¨ (Ξ» a β projβ (f a)) , (Ξ» a β projβ (f a)) β©
from β-distrib-Γ f = Ξ» a β β¨ projβ f a , projβ f a β©
fromβto β-distrib-Γ = Ξ» aβbΓc β extensionality Ξ» a β Ξ·-Γ (aβbΓc a)
toβfrom β-distrib-Γ = Ξ» { β¨ _ , _ β© β refl }
Γ-distrib-β : β {A B C : Set} β (A β B) Γ C β (A Γ C) β (B Γ C)
to Γ-distrib-β β¨ injβ a , c β© = injβ β¨ a , c β©
to Γ-distrib-β β¨ injβ b , c β© = injβ β¨ b , c β©
from Γ-distrib-β (injβ β¨ a , c β©) = β¨ injβ a , c β©
from Γ-distrib-β (injβ β¨ b , c β©) = β¨ injβ b , c β©
fromβto Γ-distrib-β = Ξ» { β¨ injβ a , c β© β refl ; β¨ injβ b , c β© β refl }
toβfrom Γ-distrib-β = Ξ» { ( injβ β¨ a , c β©) β refl ; ( injβ β¨ b , c β©) β refl }
-- Think of a counterexample to show this is not an isomorphism. TODO
β-distrib-Γ : β {A B C : Set} β (A Γ B) β C β² (A β C) Γ (B β C)
to β-distrib-Γ (injβ β¨ a , b β©) = β¨ injβ a , injβ b β©
to β-distrib-Γ (injβ c) = β¨ injβ c , injβ c β©
from β-distrib-Γ β¨ injβ a , injβ b β© = injβ β¨ a , b β©
from β-distrib-Γ β¨ injβ a , injβ c β© = injβ c
from β-distrib-Γ β¨ injβ c , injβ b β© = injβ c
from β-distrib-Γ β¨ injβ c , injβ C β© = injβ c -- injβ C also valid (loses info)
fromβto β-distrib-Γ = Ξ» { (injβ β¨ a , b β©) β refl ; (injβ c) β refl }
Γ-distrib-β : β {A B C : Set} β (C β (A Γ B)) β (C β A) Γ (C β B)
to Γ-distrib-β f = β¨ (Ξ» c β projβ (f c)) , (Ξ» c β projβ (f c)) β©
from Γ-distrib-β f = Ξ» c β β¨ projβ f c , projβ f c β©
fromβto Γ-distrib-β = Ξ» { cβaΓb β extensionality Ξ» c β Ξ·-Γ (cβaΓb c) }
toβfrom Γ-distrib-β = Ξ» { β¨ cβa , cβb β© β refl }
β-distrib-β : β {A B C : Set} β ((A β B) β C) β (A β C) Γ (B β C)
to β-distrib-β f = β¨ (Ξ» a β f (injβ a)) , (Ξ» b β f (injβ b)) β©
from β-distrib-β f = Ξ» { (injβ a) β (projβ f a) ; (injβ b) β (projβ f b) }
--fromβto β-distrib-β f = extensionality Ξ» aβb β {!!} -- TODO
fromβto β-distrib-β = Ξ» { aβbβc β extensionality Ξ» { (injβ a) β refl ; (injβ b) β refl } }
toβfrom β-distrib-β = Ξ» { β¨ aβc , bβc β© β refl }
-- PLFA exercise: a weak distributive law.
β-weak-Γ : β {A B C : Set} β (A β B) Γ C β A β (B Γ C)
β-weak-Γ β¨ injβ a , c β© = injβ a
β-weak-Γ β¨ injβ b , c β© = injβ β¨ b , c β©
-- State and prove the strong law, and explain the relationship. TODO
-- SumOfProdImpProdOfSum : disjunct of conjuncts implies a conjunct of disjuncts.
βΓ-implies-Γβ : β {A B C D : Set}
β (A Γ B) β (C Γ D)
β (A β C) Γ (B β D)
βΓ-implies-Γβ (injβ β¨ a , b β©) = β¨ injβ a , injβ b β©
βΓ-implies-Γβ (injβ β¨ c , d β©) = β¨ injβ c , injβ d β©
-- the converse is NOT true
Γβ-implies-βΓ-not : β {A B C D : Set}
β (A β C) Γ (B β D)
β (A Γ B) β (C Γ D)
Γβ-implies-βΓ-not β¨ injβ a , injβ b β© = injβ β¨ a , b β©
Γβ-implies-βΓ-not β¨ injβ a , injβ d β© = {!!} -- A Γ B β C Γ D -- not possible
Γβ-implies-βΓ-not β¨ injβ c , injβ b β© = {!!} -- A Γ B β C Γ D -- not possible
Γβ-implies-βΓ-not β¨ injβ c , injβ d β© = injβ β¨ c , d β©
| {
"alphanum_fraction": 0.4417214585,
"avg_line_length": 30.6570680628,
"ext": "agda",
"hexsha": "5624a26ee44325d39cc1f4b33584b39fbc52a9ea",
"lang": "Agda",
"max_forks_count": 8,
"max_forks_repo_forks_event_max_datetime": "2021-09-21T15:58:10.000Z",
"max_forks_repo_forks_event_min_datetime": "2015-04-13T21:40:15.000Z",
"max_forks_repo_head_hexsha": "3dc7abca7ad868316bb08f31c77fbba0d3910225",
"max_forks_repo_licenses": [
"Unlicense"
],
"max_forks_repo_name": "haroldcarr/learn-haskell-coq-ml-etc",
"max_forks_repo_path": "agda/book/Programming_Language_Foundations_in_Agda/x06-747Connectives-hc.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "3dc7abca7ad868316bb08f31c77fbba0d3910225",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"Unlicense"
],
"max_issues_repo_name": "haroldcarr/learn-haskell-coq-ml-etc",
"max_issues_repo_path": "agda/book/Programming_Language_Foundations_in_Agda/x06-747Connectives-hc.agda",
"max_line_length": 96,
"max_stars_count": 36,
"max_stars_repo_head_hexsha": "3dc7abca7ad868316bb08f31c77fbba0d3910225",
"max_stars_repo_licenses": [
"Unlicense"
],
"max_stars_repo_name": "haroldcarr/learn-haskell-coq-ml-etc",
"max_stars_repo_path": "agda/book/Programming_Language_Foundations_in_Agda/x06-747Connectives-hc.agda",
"max_stars_repo_stars_event_max_datetime": "2021-07-30T06:55:03.000Z",
"max_stars_repo_stars_event_min_datetime": "2015-01-29T14:37:15.000Z",
"num_tokens": 5018,
"size": 11711
} |
module PLDI14-List-of-Theorems where
-- List of theorems in PLDI submission
--
-- For hints about installation and execution, please refer
-- to README.agda.
--
-- Agda modules corresponding to definitions, lemmas and theorems
-- are listed here with the most important names. For example,
-- after this file type checks (C-C C-L), placing the cursor
-- on the purple "Base.Change.Algebra" and pressing M-. will
-- bring you to the file where change structures are defined.
-- The name for change structures in that file is
-- "ChangeAlgebra", given in the using-clause.
-- Definition 2.1 (Change structures)
open import Base.Change.Algebra using (ChangeAlgebra)
---- Carrier in record ChangeAlgebra --(a)
open Base.Change.Algebra.ChangeAlgebra using (Change) --(b)
open Base.Change.Algebra.ChangeAlgebra using (update) --(c)
open Base.Change.Algebra.ChangeAlgebra using (diff) --(d)
open Base.Change.Algebra.IsChangeAlgebra using (update-diff)--(e)
-- Definition 2.2 (Nil change)
-- IsChangeAlgebra.nil
open Base.Change.Algebra using (IsChangeAlgebra)
-- Lemma 2.3 (Behavior of nil)
-- IsChangeAlgebra.update-nil
open Base.Change.Algebra using (IsChangeAlgebra)
-- Lemma 2.5 (Behavior of derivatives on nil)
open import Base.Change.Equivalence using (deriv-zero)
-- Definition 2.4 (Derivatives)
open Base.Change.Algebra using (IsDerivative)
-- Definition 2.6 (Carrier set of function changes)
open Base.Change.Algebra.FunctionChanges
-- Definition 2.7 (Operations on function changes)
-- ChangeAlgebra.update FunctionChanges.changeAlgebra
-- ChangeAlgebra.diff FunctionChanges.changeAlgebra
open Base.Change.Algebra.FunctionChanges using (changeAlgebraFun)
-- Theorem 2.8 (Function changes form a change structure)
-- (In Agda, the proof of Theorem 2.8 has to be included in the
-- definition of function changes, here
-- FunctionChanges.changeAlgebra.)
open Base.Change.Algebra.FunctionChanges using (changeAlgebraFun)
-- Theorem 2.9 (Incrementalization)
open Base.Change.Algebra.FunctionChanges using (incrementalization)
-- Theorem 2.10 (Nil changes are derivatives)
open Base.Change.Algebra.FunctionChanges using (nil-is-derivative)
-- Definition 3.1 (Domains)
import Parametric.Denotation.Value
open Parametric.Denotation.Value.Structure using (β¦_β§Type)
-- Definition 3.2 (Environments)
open import Base.Denotation.Environment using (β¦_β§Context)
-- Definition 3.3 (Evaluation)
import Parametric.Denotation.Evaluation
open Parametric.Denotation.Evaluation.Structure using (β¦_β§Term)
-- Definition 3.4 (Changes)
-- Definition 3.5 (Change environments)
import Parametric.Change.Validity
open Parametric.Change.Validity.Structure using (change-algebra)
open Parametric.Change.Validity.Structure using (environment-changes)
-- Definition 3.6 (Change semantics)
-- Lemma 3.7 (Change semantics is the derivative of semantics)
import Parametric.Change.Specification
open Parametric.Change.Specification.Structure using (β¦_β§Ξ)
open Parametric.Change.Specification.Structure using (correctness)
-- Definition 3.8 (Erasure)
-- Lemma 3.9 (The erased version of a change is almost the same)
import Parametric.Change.Implementation
open Parametric.Change.Implementation.Structure using (_β_)
open Parametric.Change.Implementation.Structure using (carry-over)
-- Lemma 3.10 (β¦ t β§Ξ erases to Derive(t))
-- Theorem 3.11 (Correctness of differentiation)
import Parametric.Change.Correctness
open Parametric.Change.Correctness.Structure using (derive-correct-closed)
open Parametric.Change.Correctness.Structure using (main-theorem)
| {
"alphanum_fraction": 0.7772816076,
"avg_line_length": 38.9456521739,
"ext": "agda",
"hexsha": "d9379e6c42fa7ae97d0409b0d3fcc919976cba17",
"lang": "Agda",
"max_forks_count": 1,
"max_forks_repo_forks_event_max_datetime": "2016-02-18T12:26:44.000Z",
"max_forks_repo_forks_event_min_datetime": "2016-02-18T12:26:44.000Z",
"max_forks_repo_head_hexsha": "39bb081c6f192bdb87bd58b4a89291686d2d7d03",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "inc-lc/ilc-agda",
"max_forks_repo_path": "PLDI14-List-of-Theorems.agda",
"max_issues_count": 6,
"max_issues_repo_head_hexsha": "39bb081c6f192bdb87bd58b4a89291686d2d7d03",
"max_issues_repo_issues_event_max_datetime": "2017-05-04T13:53:59.000Z",
"max_issues_repo_issues_event_min_datetime": "2015-07-01T18:09:31.000Z",
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "inc-lc/ilc-agda",
"max_issues_repo_path": "PLDI14-List-of-Theorems.agda",
"max_line_length": 74,
"max_stars_count": 10,
"max_stars_repo_head_hexsha": "39bb081c6f192bdb87bd58b4a89291686d2d7d03",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "inc-lc/ilc-agda",
"max_stars_repo_path": "PLDI14-List-of-Theorems.agda",
"max_stars_repo_stars_event_max_datetime": "2019-07-19T07:06:59.000Z",
"max_stars_repo_stars_event_min_datetime": "2015-03-04T06:09:20.000Z",
"num_tokens": 890,
"size": 3583
} |
open import Data.Product using ( projβ ; projβ )
open import Data.Sum using ( injβ ; injβ )
open import Relation.Binary.PropositionalEquality using
( _β‘_ ; refl ; sym ; cong )
open import Relation.Unary using ( _β_ )
open import Web.Semantic.DL.ABox using ( ABox ; β¨ABoxβ© ; Assertions )
open import Web.Semantic.DL.ABox.Interp using ( β_β ; ind )
open import Web.Semantic.DL.ABox.Model using ( _β¨a_ ; bnodes ; _,_ )
open import Web.Semantic.DL.Category.Object using ( Object ; IN ; fin ; iface )
open import Web.Semantic.DL.Category.Morphism using ( impl ; _β£_ ; _β_ ; _,_ )
open import Web.Semantic.DL.Category.Tensor using ( _β_ ; _β¨ββ©_ )
open import Web.Semantic.DL.Category.Properties.Tensor.Lemmas using
( tensor-up ; tensor-down ; tensor-resp-β¨a )
open import Web.Semantic.DL.Category.Wiring using
( wiring ; wires-β ; wires-ββ»ΒΉ ; identity ; idβ )
open import Web.Semantic.DL.Signature using ( Signature )
open import Web.Semantic.DL.TBox using ( TBox )
open import Web.Semantic.DL.TBox.Interp using
( Ξ ; _β¨_β_ ; β-refl ; β-reflβ² ; β-trans )
open import Web.Semantic.Util using
( id ; _β_ ; False ; elim ; injβ»ΒΉ ; _β_β_ ; inode ; bnode ; enode )
module Web.Semantic.DL.Category.Properties.Tensor.RespectsWiring
{Ξ£ : Signature} {S T : TBox Ξ£} where
tensor-resp-wiring : β (Aβ Aβ Bβ Bβ : Object S T) β
(fβ : IN Bβ β IN Aβ) β
(fββ : Assertions (β¨ABoxβ© fβ (iface Bβ)) β Assertions (iface Aβ)) β
(fβ : IN Bβ β IN Aβ) β
(fββ : Assertions (β¨ABoxβ© fβ (iface Bβ)) β Assertions (iface Aβ)) β
(g : IN (Bβ β Bβ) β IN (Aβ β Aβ)) β
(gβ : Assertions (β¨ABoxβ© g (iface (Bβ β Bβ))) β Assertions (iface (Aβ β Aβ))) β
(β x β injβ (fβ x) β‘ g (injβ x)) β
(β x β injβ (fβ x) β‘ g (injβ x)) β
((wiring Aβ Bβ fβ fββ β¨ββ© wiring Aβ Bβ fβ fββ) β£
(wiring (Aβ β Aβ) (Bβ β Bβ) g gβ))
tensor-resp-wiring Aβ Aβ Bβ Bβ fβ fββ fβ fββ g gβ fββ‘gβ fββ‘gβ =
(LHSβRHS , RHSβLHS) where
LHSβRHS :
wiring Aβ Bβ fβ fββ β¨ββ© wiring Aβ Bβ fβ fββ β
wiring (Aβ β Aβ) (Bβ β Bβ) g gβ
LHSβRHS I Iβ¨STA Iβ¨F = (elim , Iβ¨RHS) where
lemma : β x β β I β β¨ ind I (inode (g x)) β ind I (enode x)
lemma (injβ x) = β-trans β I β
(β-reflβ² β I β (cong (ind I β inode) (sym (fββ‘gβ x))))
(wires-β fβ (projβ (fin Bβ) x)
(tensor-up (wiring Aβ Bβ fβ fββ) (wiring Aβ Bβ fβ fββ) I Iβ¨F))
lemma (injβ x) = β-trans β I β
(β-reflβ² β I β (cong (ind I β inode) (sym (fββ‘gβ x))))
(wires-β fβ (projβ (fin Bβ) x)
(tensor-down (wiring Aβ Bβ fβ fββ) (wiring Aβ Bβ fβ fββ) I Iβ¨F))
Iβ¨RHS : bnodes I elim β¨a impl (wiring (Aβ β Aβ) (Bβ β Bβ) g gβ)
Iβ¨RHS = wires-ββ»ΒΉ g lemma (projβ (fin (Bβ β Bβ)))
RHSβLHS :
wiring (Aβ β Aβ) (Bβ β Bβ) g gβ β
wiring Aβ Bβ fβ fββ β¨ββ© wiring Aβ Bβ fβ fββ
RHSβLHS I Iβ¨STA Iβ¨F = (elim β injβ»ΒΉ , Iβ¨LHS) where
lemmaβ : β x β β I β β¨ ind I (inode (injβ (fβ x))) β ind I (enode (injβ x))
lemmaβ x = β-trans β I β
(β-reflβ² β I β (cong (ind I β inode) (fββ‘gβ x)))
(wires-β g (projβ (fin (Bβ β Bβ)) (injβ x)) Iβ¨F)
lemmaβ : β x β β I β β¨ ind I (inode (injβ (fβ x))) β ind I (enode (injβ x))
lemmaβ x = β-trans β I β
(β-reflβ² β I β (cong (ind I β inode) (fββ‘gβ x)))
(wires-β g (projβ (fin (Bβ β Bβ)) (injβ x)) Iβ¨F)
Iβ¨LHS : bnodes I (elim β injβ»ΒΉ) β¨a impl (wiring Aβ Bβ fβ fββ β¨ββ© wiring Aβ Bβ fβ fββ)
Iβ¨LHS = tensor-resp-β¨a (wiring Aβ Bβ fβ fββ) (wiring Aβ Bβ fβ fββ) (bnodes I (elim β injβ»ΒΉ))
(wires-ββ»ΒΉ fβ lemmaβ (projβ (fin Bβ))) (wires-ββ»ΒΉ fβ lemmaβ (projβ (fin Bβ)))
| {
"alphanum_fraction": 0.5715093273,
"avg_line_length": 46.5526315789,
"ext": "agda",
"hexsha": "b04bc840873ec9bc65772a38243d9aff2dd3b8b4",
"lang": "Agda",
"max_forks_count": 3,
"max_forks_repo_forks_event_max_datetime": "2022-03-12T11:40:03.000Z",
"max_forks_repo_forks_event_min_datetime": "2017-12-03T14:52:09.000Z",
"max_forks_repo_head_hexsha": "38fbc3af7062ba5c3d7d289b2b4bcfb995d99057",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "bblfish/agda-web-semantic",
"max_forks_repo_path": "src/Web/Semantic/DL/Category/Properties/Tensor/RespectsWiring.agda",
"max_issues_count": 4,
"max_issues_repo_head_hexsha": "38fbc3af7062ba5c3d7d289b2b4bcfb995d99057",
"max_issues_repo_issues_event_max_datetime": "2021-01-04T20:57:19.000Z",
"max_issues_repo_issues_event_min_datetime": "2018-11-14T02:32:28.000Z",
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "bblfish/agda-web-semantic",
"max_issues_repo_path": "src/Web/Semantic/DL/Category/Properties/Tensor/RespectsWiring.agda",
"max_line_length": 97,
"max_stars_count": 9,
"max_stars_repo_head_hexsha": "8ddbe83965a616bff6fc7a237191fa261fa78bab",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "agda/agda-web-semantic",
"max_stars_repo_path": "src/Web/Semantic/DL/Category/Properties/Tensor/RespectsWiring.agda",
"max_stars_repo_stars_event_max_datetime": "2020-03-14T14:21:08.000Z",
"max_stars_repo_stars_event_min_datetime": "2015-09-13T17:46:41.000Z",
"num_tokens": 1716,
"size": 3538
} |
module ParserC where
{-
import Prelude
import Equiv
import Eq
import Datoid
import List
import Bag
open Prelude
open Equiv
open Eq
open Datoid
open List
open Bag
parserDatoid : (a, s : Datoid) -> Datoid
parserDatoid a s = Bag (pairDatoid a (listDatoid s))
-- We use the following datatype instead of
-- type Parsing s a = [s] -> Bag (a, [s])
data Parsing (s, a : Datoid) : Set1 where
P : (List (El s) -> El (parserDatoid a s)) -> Parsing s a
private
unP : {s, a : Datoid} -> Parsing s a
-> List (El s) -> El (parserDatoid a s)
unP (P x) = x
_<+>_ : {a : Datoid} -> El (Bag a) -> El (Bag a) -> El (Bag a)
_<+>_ {a} x y = bagElim (\bs -> El (Bag a)) ? y (\z zs ih -> insert z ih) x
concatMap : {a, b : Datoid} -> (El a -> El (Bag b)) -> El (Bag a)
-> El (Bag b)
concatMap {a} {b} f = bagElim (\bs -> El (Bag b)) ? empty (\x b ih -> f x <+> ih)
symbol : {s : Datoid} -> Parsing s s
symbol {s} = P symbol'
where
symbol' : List (El s) -> El (parserDatoid s s)
symbol' nil = empty
symbol' (x :: xs) = insert (pair x xs) empty
fail : {s, a : Datoid} -> Parsing s a
fail = P (\ss -> empty)
(+++) : {s, a : Datoid} -> Parsing s a -> Parsing s a -> Parsing s a
P p +++ P q = P (\s -> p s <+> q s)
return : {s, a : Datoid} -> (x : El a) -> Parsing s a
return = \x -> P (\s -> insert (pair x s) empty)
-- data Traverse (a : Datoid) : Set where
-- Empty : Traverse a
-- Insert : (x : El a) -> (b : El (Bag a)) -> Traverse a
-- run : {a : Datoid} -> Traverse a -> El (Bag a)
-- traverse : {a : Datoid} -> El (Bag a) -> Traverse a
-- traverseTraverses
-- : {a : Datoid} -> (b : El (Bag a)) -> run (traverse b) =^= b
-- insert : {a : Datoid} -> El a -> El (Bag a) -> El (Bag a)
-- pairDatoid : Datoid -> Datoid -> Datoid
--(empty {Bag (pairDatoid s (listDatoid s))})
-- bagElim
-- : {a : Datoid}
-- -> (P : El (Bag a) -> Set)
-- -> P empty
-- -> ((x : El a) -> (b : El (Bag a)) -> P b -> P (insert x b))
-- -> (b : El (Bag a))
-- -> P b
(>>=) : {s, a, b : Datoid}
-> Parsing s a -> (El a -> Parsing s b) -> Parsing s b
(>>=) {s} {a} {b} (P p) k
= P (\s -> concatMap (\y -> unP (k (fst y)) (snd y)) (p s))
{-
parserDatoid : (a, s : Datoid) -> Datoid
parserDatoid a s = Bag (pairDatoid a (listDatoid s))
-- We use the following datatype instead of
-- type Parsing s a = [s] -> Bag (a, [s])
data Parsing (s, a : Datoid) : Set1 where
P : (List (El s) -> El (parserDatoid a s))
-> Parsing s a
-}
-}
| {
"alphanum_fraction": 0.504611837,
"avg_line_length": 27.1041666667,
"ext": "agda",
"hexsha": "60517c1ec0ba204ea17eea329e50bb9c7ec1ddc7",
"lang": "Agda",
"max_forks_count": 371,
"max_forks_repo_forks_event_max_datetime": "2022-03-30T19:00:30.000Z",
"max_forks_repo_forks_event_min_datetime": "2015-01-03T14:04:08.000Z",
"max_forks_repo_head_hexsha": "7f58030124fa99dfbf8db376659416f3ad8384de",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "cruhland/agda",
"max_forks_repo_path": "examples/AIM4/bag/ParserC.agda",
"max_issues_count": 4066,
"max_issues_repo_head_hexsha": "7f58030124fa99dfbf8db376659416f3ad8384de",
"max_issues_repo_issues_event_max_datetime": "2022-03-31T21:14:49.000Z",
"max_issues_repo_issues_event_min_datetime": "2015-01-10T11:24:51.000Z",
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "cruhland/agda",
"max_issues_repo_path": "examples/AIM4/bag/ParserC.agda",
"max_line_length": 85,
"max_stars_count": 1989,
"max_stars_repo_head_hexsha": "7f58030124fa99dfbf8db376659416f3ad8384de",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "cruhland/agda",
"max_stars_repo_path": "examples/AIM4/bag/ParserC.agda",
"max_stars_repo_stars_event_max_datetime": "2022-03-30T18:20:48.000Z",
"max_stars_repo_stars_event_min_datetime": "2015-01-09T23:51:16.000Z",
"num_tokens": 973,
"size": 2602
} |
{-# OPTIONS --without-K #-}
module Test where
open import Level
infixl 4 _β‘_
data _β‘_ {a} {A : Set a} (x : A) : A β Set a where
refl : x β‘ x
J : {a b : Level} (A : Set a) (C : (x y : A) β x β‘ y β Set b)
β ((x : A) β C x x refl)
β (x y : A) (P : x β‘ y)
β C x y P
J A C b x .x refl = b x
-- K : (A : Set) (x : A) (C : x β‘ x β Set)
-- β C refl
-- β (loop : x β‘ x)
-- β C loop
-- K A x C b p = {! p !}
-- Lemma 2.1.1 (inversion of paths)
infix 6 Β¬_
Β¬_ : {a : Level} {A : Set a} {x y : A} β x β‘ y β y β‘ x
Β¬_ {a} {A} {x} {y} p = J A D d x y p
where
D : (x y : A) (p : x β‘ y) β Set a
D x y p = y β‘ x
d : (x : A) β D x x refl
d x = refl
-- Lemma 2.1.2 (concatenation of paths)
infixl 5 _β_
_β_ : {a : Level} {A : Set a} {x y z : A} β x β‘ y β y β‘ z β x β‘ z
_β_ {a} {A} {x} {y} {z} p q = J {a} {a} A D d x y p z q
where
-- the predicate
D : (x y : A) (p : x β‘ y) β Set a
D x y p = (z : A) (q : y β‘ z) β x β‘ z
-- base case
d : (x : A) β D x x refl
d x z q = J A E e x z q
where
-- the predicate
E : (x z : A) (q : x β‘ z) β Set a
E x z q = x β‘ z
-- base case
e : (x : A) β E x x refl
e x = refl
-- Lemma 2.1.4.i (identity of path concatenation)
β-identityΚ³ : {a : Level} {A : Set a} {x y : A} (p : x β‘ y) β p β‘ p β refl
β-identityΚ³ {a} {A} {x} {y} p = J A D d x y p
where
-- the predicate
D : (x y : A) (p : x β‘ y) β Set a
D x y p = p β‘ p β refl
-- base case
d : (x : A) β D x x refl
d x = refl
β-identityΛ‘ : {a : Level} {A : Set a} {x y : A} (p : x β‘ y) β p β‘ refl β p
β-identityΛ‘ {a} {A} {x} {y} p = J A D d x y p
where
-- the predicate
D : (x y : A) (p : x β‘ y) β Set a
D x y p = p β‘ refl β p
-- base case
d : (x : A) β D x x refl
d x = refl
-- Lemma 2.1.4.ii (identity of path inversion)
Β¬-identityΚ³ : {a : Level} {A : Set a} {x y : A} (p : x β‘ y) β Β¬ p β p β‘ refl
Β¬-identityΚ³ {a} {A} {x} {y} p = J A D d x y p
where
-- the predicate
D : (x y : A) (p : x β‘ y) β Set a
D x y p = Β¬ p β p β‘ refl
-- base case
d : (x : A) β D x x refl
d x = refl
Β¬-identityΛ‘ : {a : Level} {A : Set a} {x y : A} (p : x β‘ y) β p β Β¬ p β‘ refl
Β¬-identityΛ‘ {a} {A} {x} {y} p = J A D d x y p
where
-- the predicate
D : (x y : A) (p : x β‘ y) β Set a
D x y p = p β Β¬ p β‘ refl
-- base case
d : (x : A) β D x x refl
d x = refl
-- Lemma 2.1.4.iii (involution of path inversion)
involution : {A : Set} {x y : A} (p : x β‘ y) β Β¬ Β¬ p β‘ p
involution {A} {x} {y} p = J A D d x y p
where
-- the predicate
D : (x y : A) (p : x β‘ y) β Set
D x y p = Β¬ Β¬ p β‘ p
-- base case
d : (x : A) β D x x refl
d x = refl
-- Lemma 2.1.4.iv (associativity of path concatenation)
β-assoc : {a : Level} {A : Set a} {w x y z : A}
β (p : w β‘ x) (q : x β‘ y) (r : y β‘ z)
β p β (q β r) β‘ (p β q) β r
β-assoc {a} {A} {w} {x} {y} {z} p q r = J A D d w x p y q z r
where
-- the predicate
D : (w x : A) (p : w β‘ x) β Set a
D w x p = (y : A) (q : x β‘ y)
β (z : A) (r : y β‘ z)
β p β (q β r) β‘ (p β q) β r
-- base case
d : (x : A) β D x x refl
d x y q z r = J A E e x y q z r
where
-- the predicate
E : (x y : A) (q : x β‘ y) β Set a
E x y q = (z : A) (r : y β‘ z)
β refl β (q β r) β‘ refl β q β r
-- base case
e : (x : A) β E x x refl
e x z r = J A F f x z r
where
-- the predicate
F : (y z : A) (r : y β‘ z) β Set a
F y z r = refl β (refl β r) β‘ refl β refl β r
-- base case
f : (x : A) β F x x refl
f x = {! !}
| {
"alphanum_fraction": 0.397311828,
"avg_line_length": 24.6357615894,
"ext": "agda",
"hexsha": "4bed8fc67385a11db50395a6b5339a5e395ff724",
"lang": "Agda",
"max_forks_count": 18,
"max_forks_repo_forks_event_max_datetime": "2019-11-21T10:12:31.000Z",
"max_forks_repo_forks_event_min_datetime": "2015-05-24T04:15:44.000Z",
"max_forks_repo_head_hexsha": "67d4db3b1050e6acfbdfdc05f8a656fd4c1f0b07",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "erydo/agda-mode",
"max_forks_repo_path": "test/asset/Test.agda",
"max_issues_count": 126,
"max_issues_repo_head_hexsha": "67d4db3b1050e6acfbdfdc05f8a656fd4c1f0b07",
"max_issues_repo_issues_event_max_datetime": "2020-12-23T23:00:13.000Z",
"max_issues_repo_issues_event_min_datetime": "2015-02-02T05:47:54.000Z",
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "erydo/agda-mode",
"max_issues_repo_path": "test/asset/Test.agda",
"max_line_length": 76,
"max_stars_count": 58,
"max_stars_repo_head_hexsha": "67d4db3b1050e6acfbdfdc05f8a656fd4c1f0b07",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "erydo/agda-mode",
"max_stars_repo_path": "test/asset/Test.agda",
"max_stars_repo_stars_event_max_datetime": "2021-06-11T01:42:34.000Z",
"max_stars_repo_stars_event_min_datetime": "2015-01-10T10:24:09.000Z",
"num_tokens": 1728,
"size": 3720
} |
{-# OPTIONS --without-K --safe #-}
module Definition.Typed.Consequences.Equality where
open import Definition.Untyped
open import Definition.Typed
open import Definition.Typed.Properties
open import Definition.Typed.EqRelInstance
open import Definition.LogicalRelation
open import Definition.LogicalRelation.Irrelevance
open import Definition.LogicalRelation.ShapeView
open import Definition.LogicalRelation.Fundamental.Reducibility
open import Tools.Product
import Tools.PropositionalEquality as PE
Uβ‘Aβ² : β {A Ξ l} ([U] : Ξ β©β¨ l β©U)
β Ξ β©β¨ l β© U β‘ A / (U-intr [U])
β A PE.β‘ U
Uβ‘Aβ² (noemb [U]) [Uβ‘A] = [Uβ‘A]
Uβ‘Aβ² (emb 0<1 [U]) [Uβ‘A] = Uβ‘Aβ² [U] [Uβ‘A]
-- If A is judgmentally equal to U, then A is propositionally equal to U.
Uβ‘A : β {A Ξ}
β Ξ β’ U β‘ A
β A PE.β‘ U
Uβ‘A {A} Uβ‘A with reducibleEq Uβ‘A
Uβ‘A {A} Uβ‘A | [U] , [A] , [Uβ‘A] =
Uβ‘Aβ² (U-elim [U]) (irrelevanceEq [U] (U-intr (U-elim [U])) [Uβ‘A])
ββ‘Aβ² : β {A Ξ l} ([β] : Ξ β©β¨ l β©β β)
β Ξ β©β¨ l β© β β‘ A / (β-intr [β])
β Whnf A
β A PE.β‘ β
ββ‘Aβ² (noemb x) [ββ‘A] whnfA = whnfRed* [ββ‘A] whnfA
ββ‘Aβ² (emb 0<1 [β]) [ββ‘A] whnfA = ββ‘Aβ² [β] [ββ‘A] whnfA
-- If A in WHNF is judgmentally equal to β, then A is propositionally equal to β.
ββ‘A : β {A Ξ}
β Ξ β’ β β‘ A
β Whnf A
β A PE.β‘ β
ββ‘A {A} ββ‘A whnfA with reducibleEq ββ‘A
ββ‘A {A} ββ‘A whnfA | [β] , [A] , [ββ‘A] =
ββ‘Aβ² (β-elim [β]) (irrelevanceEq [β] (β-intr (β-elim [β])) [ββ‘A]) whnfA
-- If A in WHNF is judgmentally equal to Empty, then A is propositionally equal to Empty.
Emptyβ‘Aβ² : β {A Ξ l} ([Empty] : Ξ β©β¨ l β©Empty Empty)
β Ξ β©β¨ l β© Empty β‘ A / (Empty-intr [Empty])
β Whnf A
β A PE.β‘ Empty
Emptyβ‘Aβ² (noemb x) [Emptyβ‘A] whnfA = whnfRed* [Emptyβ‘A] whnfA
Emptyβ‘Aβ² (emb 0<1 [Empty]) [Emptyβ‘A] whnfA = Emptyβ‘Aβ² [Empty] [Emptyβ‘A] whnfA
Emptyβ‘A : β {A Ξ}
β Ξ β’ Empty β‘ A
β Whnf A
β A PE.β‘ Empty
Emptyβ‘A {A} Emptyβ‘A whnfA with reducibleEq Emptyβ‘A
Emptyβ‘A {A} Emptyβ‘A whnfA | [Empty] , [A] , [Emptyβ‘A] =
Emptyβ‘Aβ² (Empty-elim [Empty]) (irrelevanceEq [Empty] (Empty-intr (Empty-elim [Empty])) [Emptyβ‘A]) whnfA
Unitβ‘Aβ² : β {A Ξ l} ([Unit] : Ξ β©β¨ l β©Unit Unit)
β Ξ β©β¨ l β© Unit β‘ A / (Unit-intr [Unit])
β Whnf A
β A PE.β‘ Unit
Unitβ‘Aβ² (noemb x) [Unitβ‘A] whnfA = whnfRed* [Unitβ‘A] whnfA
Unitβ‘Aβ² (emb 0<1 [Unit]) [Unitβ‘A] whnfA = Unitβ‘Aβ² [Unit] [Unitβ‘A] whnfA
Unitβ‘A : β {A Ξ}
β Ξ β’ Unit β‘ A
β Whnf A
β A PE.β‘ Unit
Unitβ‘A {A} Unitβ‘A whnfA with reducibleEq Unitβ‘A
Unitβ‘A {A} Unitβ‘A whnfA | [Unit] , [A] , [Unitβ‘A] =
Unitβ‘Aβ² (Unit-elim [Unit]) (irrelevanceEq [Unit] (Unit-intr (Unit-elim [Unit])) [Unitβ‘A]) whnfA
neβ‘Aβ² : β {A K Ξ l}
β ([K] : Ξ β©β¨ l β©ne K)
β Ξ β©β¨ l β© K β‘ A / (ne-intr [K])
β Whnf A
β β Ξ» M β Neutral M Γ A PE.β‘ M
neβ‘Aβ² (noemb [K]) (neβ M Dβ² neM Kβ‘M) whnfA =
M , neM , (whnfRed* (red Dβ²) whnfA)
neβ‘Aβ² (emb 0<1 [K]) [Kβ‘A] whnfA = neβ‘Aβ² [K] [Kβ‘A] whnfA
-- If A in WHNF is judgmentally equal to K, then there exists a M such that
-- A is propositionally equal to M.
neβ‘A : β {A K Ξ}
β Neutral K
β Ξ β’ K β‘ A
β Whnf A
β β Ξ» M β Neutral M Γ A PE.β‘ M
neβ‘A {A} neK neβ‘A whnfA with reducibleEq neβ‘A
neβ‘A {A} neK neβ‘A whnfA | [ne] , [A] , [neβ‘A] =
neβ‘Aβ² (ne-elim neK [ne])
(irrelevanceEq [ne] (ne-intr (ne-elim neK [ne])) [neβ‘A]) whnfA
Bβ‘Aβ² : β {A F G Ξ l} W ([W] : Ξ β©β¨ l β©Bβ¨ W β© β¦ W β§ F βΉ G)
β Ξ β©β¨ l β© β¦ W β§ F βΉ G β‘ A / (B-intr W [W])
β Whnf A
β ββ Ξ» H E β A PE.β‘ β¦ W β§ H βΉ E
Bβ‘Aβ² W (noemb [W]) (Bβ Fβ² Gβ² Dβ² Aβ‘B [Fβ‘Fβ²] [Gβ‘Gβ²]) whnfA =
Fβ² , Gβ² , whnfRed* Dβ² whnfA
Bβ‘Aβ² W (emb 0<1 [W]) [Wβ‘A] whnfA = Bβ‘Aβ² W [W] [Wβ‘A] whnfA
Ξ β‘Aβ² : β {A F G Ξ l} β _
Ξ β‘Aβ² {A} {F} {G} {Ξ} {l} = Bβ‘Aβ² {A} {F} {G} {Ξ} {l} BΞ
Ξ£β‘Aβ² : β {A F G Ξ l} β _
Ξ£β‘Aβ² {A} {F} {G} {Ξ} {l} = Bβ‘Aβ² {A} {F} {G} {Ξ} {l} BΞ£
-- If A is judgmentally equal to Ξ F βΉ G, then there exists H and E such that
-- A is propositionally equal to Ξ H βΉ E.
Bβ‘A : β {A F G Ξ} W
β Ξ β’ β¦ W β§ F βΉ G β‘ A
β Whnf A
β ββ Ξ» H E β A PE.β‘ β¦ W β§ H βΉ E
Bβ‘A {A} W Wβ‘A whnfA with reducibleEq Wβ‘A
Bβ‘A {A} W Wβ‘A whnfA | [W] , [A] , [Wβ‘A] =
Bβ‘Aβ² W (B-elim W [W]) (irrelevanceEq [W] (B-intr W (B-elim W [W])) [Wβ‘A]) whnfA
Ξ β‘A : β {A F G Ξ} β _
Ξ β‘A {A} {F} {G} {Ξ} = Bβ‘A {A} {F} {G} {Ξ} BΞ
Ξ£β‘A : β {A F G Ξ} β _
Ξ£β‘A {A} {F} {G} {Ξ} = Bβ‘A {A} {F} {G} {Ξ} BΞ£
| {
"alphanum_fraction": 0.5328312544,
"avg_line_length": 33.4566929134,
"ext": "agda",
"hexsha": "29a9f15743b0b3b1ee980681c280407766f7f878",
"lang": "Agda",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "4746894adb5b8edbddc8463904ee45c2e9b29b69",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "Vtec234/logrel-mltt",
"max_forks_repo_path": "Definition/Typed/Consequences/Equality.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "4746894adb5b8edbddc8463904ee45c2e9b29b69",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "Vtec234/logrel-mltt",
"max_issues_repo_path": "Definition/Typed/Consequences/Equality.agda",
"max_line_length": 105,
"max_stars_count": null,
"max_stars_repo_head_hexsha": "4746894adb5b8edbddc8463904ee45c2e9b29b69",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "Vtec234/logrel-mltt",
"max_stars_repo_path": "Definition/Typed/Consequences/Equality.agda",
"max_stars_repo_stars_event_max_datetime": null,
"max_stars_repo_stars_event_min_datetime": null,
"num_tokens": 2232,
"size": 4249
} |
{-
Cubical Agda - A Dependently Typed PL with Univalence and HITs
==============================================================
Anders MΓΆrtberg
Every Proof Assistant - September 17, 2020
Link to slides: https://staff.math.su.se/anders.mortberg/slides/EPA2020.pdf
Link to video: https://vimeo.com/459020971
-}
-- To make Agda cubical add the following options
{-# OPTIONS --cubical --no-import-sorts --safe #-}
module Cubical.Talks.EPA2020 where
-- The "Foundations" package contain a lot of important results (in
-- particular the univalence theorem)
open import Cubical.Foundations.Prelude
open import Cubical.Foundations.Equiv
open import Cubical.Foundations.Isomorphism
open import Cubical.Foundations.Univalence
open import Cubical.Data.Int
open import Cubical.Data.Prod.Base
-- The interval in Cubical Agda is written I and the endpoints i0 and i1.
apply0 : (A : Type) (p : I β A) β A
apply0 A p = p i0
-- We omit the universe level β for simplicity in this talk. In the
-- library everything is maximally universe polymorphic.
-- We can write functions out of the interval using Ξ»-abstraction:
refl' : {A : Type} (x : A) β x β‘ x
refl' x = Ξ» i β x
-- In fact, x β‘ y is short for PathP (Ξ» _ β A) x y
refl'' : {A : Type} (x : A) β PathP (Ξ» _ β A) x x
refl'' x = Ξ» _ β x
-- In general PathP A x y has A : I β Type, x : A i0 and y : A i1
-- PathP = Dependent paths (Path over a Path)
-- We cannot pattern-match on interval variables as I is not inductively defined
-- foo : {A : Type} β I β A
-- foo r = {!r!} -- Try typing C-c C-c
-- cong has a direct proof
cong' : {A B : Type} (f : A β B) {x y : A} β x β‘ y β f x β‘ f y
cong' f p i = f (p i)
-- function extensionality also has a direct proof.
-- It also has computational content: swap the arguments.
funExt' : {A B : Type} {f g : A β B} (p : (x : A) β f x β‘ g x) β f β‘ g
funExt' p i x = p x i
-- Transport is more complex as β‘ isn't inductively defined (so we
-- can't define it by pattern-matching on p)
transport' : {A B : Type} β A β‘ B β A β B
transport' p a = transp (Ξ» i β p i) i0 a
-- This lets us define subst (which is called "transport" in the HoTT book)
subst' : {A : Type} (P : A β Type) {x y : A} (p : x β‘ y) β P x β P y
subst' P p pa = transport (Ξ» i β P (p i)) pa
-- The transp operation reduces differently for different types
-- formers. For paths it reduces to another primitive operation called
-- hcomp.
-- We can also define the J eliminator (aka path induction)
J' : {A : Type} {B : A β Type} {x : A}
(P : (z : A) β x β‘ z β Type)
(d : P x refl) {y : A} (p : x β‘ y) β P y p
J' P d p = transport (Ξ» i β P (p i) (Ξ» j β p (i β§ j))) d
-- So J is provable, but it doesn't satisfy computation rule
-- definitionally. This is almost never a problem in practice as the
-- cubical primitives satisfy many new definitional equalities.
-- Another key concept in HoTT/UF is the Univalence Axiom. In Cubical
-- Agda this is provable, we hence refer to it as the Univalence
-- Theorem.
-- The univalence theorem: equivalences of types give paths of types
ua' : {A B : Type} β A β B β A β‘ B
ua' = ua
-- Any isomorphism of types gives rise to an equivalence
isoToEquiv' : {A B : Type} β Iso A B β A β B
isoToEquiv' = isoToEquiv
-- And hence to a path
isoToPath' : {A B : Type} β Iso A B β A β‘ B
isoToPath' e = ua' (isoToEquiv' e)
-- ua satisfies the following computation rule
-- This suffices to be able to prove the standard formulation of univalence.
uaΞ²' : {A B : Type} (e : A β B) (x : A)
β transport (ua' e) x β‘ fst e x
uaΞ²' e x = transportRefl (equivFun e x)
-- Time for an example!
-- Booleans
data Bool : Type where
false true : Bool
not : Bool β Bool
not false = true
not true = false
notPath : Bool β‘ Bool
notPath = isoToPath' (iso not not rem rem)
where
rem : (b : Bool) β not (not b) β‘ b
rem false = refl
rem true = refl
_ : transport notPath true β‘ false
_ = refl
-- Another example, integers:
sucPath : Int β‘ Int
sucPath = isoToPath' (iso sucInt predInt sucPred predSuc)
_ : transport sucPath (pos 0) β‘ pos 1
_ = refl
_ : transport (sucPath β sucPath) (pos 0) β‘ pos 2
_ = refl
_ : transport (sym sucPath) (pos 0) β‘ negsuc 0
_ = refl
-----------------------------------------------------------------------------
-- Higher inductive types
-- The following definition of finite multisets is due to Vikraman
-- Choudhury and Marcelo Fiore.
infixr 5 _β·_
data FMSet (A : Type) : Type where
[] : FMSet A
_β·_ : (x : A) β (xs : FMSet A) β FMSet A
comm : (x y : A) (xs : FMSet A) β x β· y β· xs β‘ y β· x β· xs
-- trunc : (xs ys : FMSet A) (p q : xs β‘ ys) β p β‘ q
-- We need to add the trunc constructor for FMSets to be sets, omitted
-- here for simplicity.
_++_ : β {A : Type} (xs ys : FMSet A) β FMSet A
[] ++ ys = ys
(x β· xs) ++ ys = x β· xs ++ ys
comm x y xs i ++ ys = comm x y (xs ++ ys) i
-- trunc xs zs p q i j ++ ys =
-- trunc (xs ++ ys) (zs ++ ys) (cong (_++ ys) p) (cong (_++ ys) q) i j
unitr-++ : {A : Type} (xs : FMSet A) β xs ++ [] β‘ xs
unitr-++ [] = refl
unitr-++ (x β· xs) = cong (x β·_) (unitr-++ xs)
unitr-++ (comm x y xs i) j = comm x y (unitr-++ xs j) i
-- unitr-++ (trunc xs ys x y i j) = {!!}
-- This is a special case of set quotients! Very useful for
-- programming and set level mathematics
data _/_ (A : Type) (R : A β A β Type) : Type where
[_] : A β A / R
eq/ : (a b : A) β R a b β [ a ] β‘ [ b ]
trunc : (a b : A / R) (p q : a β‘ b) β p β‘ q
-- Proving that they are effective ((a b : A) β [ a ] β‘ [ b ] β R a b)
-- requires univalence for propositions.
-------------------------------------------------------------------------
-- Topological examples of things that are not sets
-- We can define the circle as the following simple data declaration:
data SΒΉ : Type where
base : SΒΉ
loop : base β‘ base
-- We can write functions on SΒΉ using pattern-matching equations:
double : SΒΉ β SΒΉ
double base = base
double (loop i) = (loop β loop) i
helix : SΒΉ β Type
helix base = Int
helix (loop i) = sucPathInt i
Ξ©SΒΉ : Type
Ξ©SΒΉ = base β‘ base
winding : Ξ©SΒΉ β Int
winding p = subst helix p (pos 0)
_ : winding (Ξ» i β double ((loop β loop) i)) β‘ pos 4
_ = refl
-- We can define the Torus as:
data Torus : Type where
point : Torus
line1 : point β‘ point
line2 : point β‘ point
square : PathP (Ξ» i β line1 i β‘ line1 i) line2 line2
-- And prove that it is equivalent to two circle:
t2c : Torus β SΒΉ Γ SΒΉ
t2c point = (base , base)
t2c (line1 i) = (loop i , base)
t2c (line2 j) = (base , loop j)
t2c (square i j) = (loop i , loop j)
c2t : SΒΉ Γ SΒΉ β Torus
c2t (base , base) = point
c2t (loop i , base) = line1 i
c2t (base , loop j) = line2 j
c2t (loop i , loop j) = square i j
c2t-t2c : (t : Torus) β c2t (t2c t) β‘ t
c2t-t2c point = refl
c2t-t2c (line1 _) = refl
c2t-t2c (line2 _) = refl
c2t-t2c (square _ _) = refl
t2c-c2t : (p : SΒΉ Γ SΒΉ) β t2c (c2t p) β‘ p
t2c-c2t (base , base) = refl
t2c-c2t (base , loop _) = refl
t2c-c2t (loop _ , base) = refl
t2c-c2t (loop _ , loop _) = refl
-- Using univalence we get the following equality:
Torusβ‘SΒΉΓSΒΉ : Torus β‘ SΒΉ Γ SΒΉ
Torusβ‘SΒΉΓSΒΉ = isoToPath' (iso t2c c2t t2c-c2t c2t-t2c)
windingTorus : point β‘ point β Int Γ Int
windingTorus l = ( winding (Ξ» i β projβ (t2c (l i)))
, winding (Ξ» i β projβ (t2c (l i))))
_ : windingTorus (line1 β sym line2) β‘ (pos 1 , negsuc 0)
_ = refl
-- We have many more topological examples, including Klein bottle, RP^n,
-- higher spheres, suspensions, join, wedges, smash product:
open import Cubical.HITs.KleinBottle
open import Cubical.HITs.RPn
open import Cubical.HITs.S2
open import Cubical.HITs.S3
open import Cubical.HITs.Susp
open import Cubical.HITs.Join
open import Cubical.HITs.Wedge
open import Cubical.HITs.SmashProduct
-- There's also a proof of the "3x3 lemma" for pushouts in less than
-- 200LOC. In HoTT-Agda this took about 3000LOC. For details see:
-- https://github.com/HoTT/HoTT-Agda/tree/master/theorems/homotopy/3x3
open import Cubical.HITs.Pushout
-- We also defined the Hopf fibration and proved that its total space
-- is SΒ³ in about 300LOC:
open import Cubical.HITs.Hopf
-- There is also some integer cohomology:
open import Cubical.ZCohomology.Everything
-- To compute cohomology groups of various spaces we need a bunch of
-- interesting theorems: Freudenthal suspension theorem,
-- Mayer-Vietoris sequence...
open import Cubical.Homotopy.Freudenthal
open import Cubical.ZCohomology.MayerVietorisUnreduced
-------------------------------------------------------------------------
-- The structure identity principle
-- A more efficient version of finite multisets based on association lists
open import Cubical.HITs.AssocList.Base
-- data AssocList (A : Type) : Type where
-- β¨β© : AssocList A
-- β¨_,_β©β·_ : (a : A) (n : β) (xs : AssocList A) β AssocList A
-- per : (a b : A) (m n : β) (xs : AssocList A)
-- β β¨ a , m β©β· β¨ b , n β©β· xs β‘ β¨ b , n β©β· β¨ a , m β©β· xs
-- agg : (a : A) (m n : β) (xs : AssocList A)
-- β β¨ a , m β©β· β¨ a , n β©β· xs β‘ β¨ a , m + n β©β· xs
-- del : (a : A) (xs : AssocList A) β β¨ a , 0 β©β· xs β‘ xs
-- trunc : (xs ys : AssocList A) (p q : xs β‘ ys) β p β‘ q
-- Programming and proving is more complicated with AssocList compared
-- to FMSet. This kind of example occurs everywhere in programming and
-- mathematics: one representation is easier to work with, but not
-- efficient, while another is efficient but difficult to work with.
-- Solution: substitute using univalence
substIso : {A B : Type} (P : Type β Type) (e : Iso A B) β P A β P B
substIso P e = subst P (isoToPath e)
-- Can transport for example Monoid structure from FMSet to AssocList
-- this way, but the achieved Monoid structure is not very efficient
-- to work with. A better solution is to prove that FMSet and
-- AssocList are equal *as monoids*, but how to do this?
-- Solution: structure identity principle (SIP)
-- This is a very useful consequence of univalence
open import Cubical.Foundations.SIP
sip' : {β : Level} {S : Type β β Type β} {ΞΉ : StrEquiv S β}
(ΞΈ : UnivalentStr S ΞΉ) (A B : TypeWithStr β S) β A β[ ΞΉ ] B β A β‘ B
sip' = sip
-- The tricky thing is to prove that (S,ΞΉ) is a univalent structure.
-- Luckily we provide automation for this in the library, see for example:
open import Cubical.Algebra.Monoid.Base
-- Another cool application of the SIP: matrices represented as
-- functions out of pairs of Fin's and vectors are equal as abelian
-- groups:
open import Cubical.Algebra.Matrix
-- The end, back to slides!
| {
"alphanum_fraction": 0.628761272,
"avg_line_length": 30.8040935673,
"ext": "agda",
"hexsha": "12b37d9c29d3ed147e74cbf6e28996aee663280e",
"lang": "Agda",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "fd8059ec3eed03f8280b4233753d00ad123ffce8",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "dan-iel-lee/cubical",
"max_forks_repo_path": "Cubical/Talks/EPA2020.agda",
"max_issues_count": 1,
"max_issues_repo_head_hexsha": "fd8059ec3eed03f8280b4233753d00ad123ffce8",
"max_issues_repo_issues_event_max_datetime": "2022-01-27T02:07:48.000Z",
"max_issues_repo_issues_event_min_datetime": "2022-01-27T02:07:48.000Z",
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "dan-iel-lee/cubical",
"max_issues_repo_path": "Cubical/Talks/EPA2020.agda",
"max_line_length": 80,
"max_stars_count": null,
"max_stars_repo_head_hexsha": "fd8059ec3eed03f8280b4233753d00ad123ffce8",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "dan-iel-lee/cubical",
"max_stars_repo_path": "Cubical/Talks/EPA2020.agda",
"max_stars_repo_stars_event_max_datetime": null,
"max_stars_repo_stars_event_min_datetime": null,
"num_tokens": 3549,
"size": 10535
} |
module Structure.Sets.Relators where
| {
"alphanum_fraction": 0.8648648649,
"avg_line_length": 18.5,
"ext": "agda",
"hexsha": "134367bbfc51f3e9acaa5136a5fbcf628f06a338",
"lang": "Agda",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "Lolirofle/stuff-in-agda",
"max_forks_repo_path": "Structure/Sets/Relators.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "Lolirofle/stuff-in-agda",
"max_issues_repo_path": "Structure/Sets/Relators.agda",
"max_line_length": 36,
"max_stars_count": 6,
"max_stars_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "Lolirofle/stuff-in-agda",
"max_stars_repo_path": "Structure/Sets/Relators.agda",
"max_stars_repo_stars_event_max_datetime": "2022-02-05T06:53:22.000Z",
"max_stars_repo_stars_event_min_datetime": "2020-04-07T17:58:13.000Z",
"num_tokens": 8,
"size": 37
} |
module Prelude.Monoid where
open import Prelude.Function
open import Prelude.Maybe
open import Prelude.List
open import Prelude.Semiring
open import Prelude.Applicative
open import Prelude.Functor
record Monoid {a} (A : Set a) : Set a where
infixr 6 _<>_
field
mempty : A
_<>_ : A β A β A
open Monoid {{...}} public
{-# DISPLAY Monoid.mempty _ = mempty #-}
{-# DISPLAY Monoid._<>_ _ a b = a <> b #-}
mconcat : β {a} {A : Set a} {{MonA : Monoid A}} β List A β A
mconcat = foldr _<>_ mempty
--- Instances ---
instance
MonoidList : β {a} {A : Set a} β Monoid (List A)
mempty {{MonoidList}} = []
_<>_ {{MonoidList}} = _++_
MonoidFun : β {a b} {A : Set a} {B : A β Set b} {{_ : β {x} β Monoid (B x)}} β Monoid (β x β B x)
mempty {{MonoidFun}} _ = mempty
_<>_ {{MonoidFun}} f g x = f x <> g x
MonoidMaybe : β {a} {A : Set a} β Monoid (Maybe A)
mempty {{MonoidMaybe}} = nothing
_<>_ {{MonoidMaybe}} nothing y = y
_<>_ {{MonoidMaybe}} (just x) _ = just x
record Sum {a} (A : Set a) : Set a where
constructor mkSum
field getSum : A
open Sum public
instance
MonoidSum : β {a} {A : Set a} {{_ : Semiring A}} β Monoid (Sum A)
getSum (mempty {{MonoidSum}}) = zro
getSum (_<>_ {{MonoidSum}} x y) = getSum x + getSum y
record Product {a} (A : Set a) : Set a where
constructor mkProduct
field getProduct : A
open Product public
instance
MonoidProduct : β {a} {A : Set a} {{_ : Semiring A}} β Monoid (Product A)
getProduct (mempty {{MonoidProduct}}) = one
getProduct (_<>_ {{MonoidProduct}} x y) = getProduct x * getProduct y
record Const {a b} (A : Set a) (B : Set b) : Set a where
constructor mkConst
field getConst : A
open Const public
module _ {a b} {A : Set a} {{MonA : Monoid A}} where
instance
FunctorConst : Functor {a = b} (Const A)
getConst (fmap {{FunctorConst}} f x) = getConst x
ApplicativeConst : Applicative (Const A)
getConst (pure {{ApplicativeConst}} x) = mempty
getConst (_<*>_ {{ApplicativeConst}} wf wx) = getConst wf <> getConst wx
| {
"alphanum_fraction": 0.6107350097,
"avg_line_length": 26.8571428571,
"ext": "agda",
"hexsha": "12a6238220386af3b23191863a9b1cfa45afea31",
"lang": "Agda",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "75016b4151ed601e28f4462cd7b6b1aaf5d0d1a6",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "lclem/agda-prelude",
"max_forks_repo_path": "src/Prelude/Monoid.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "75016b4151ed601e28f4462cd7b6b1aaf5d0d1a6",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "lclem/agda-prelude",
"max_issues_repo_path": "src/Prelude/Monoid.agda",
"max_line_length": 99,
"max_stars_count": null,
"max_stars_repo_head_hexsha": "75016b4151ed601e28f4462cd7b6b1aaf5d0d1a6",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "lclem/agda-prelude",
"max_stars_repo_path": "src/Prelude/Monoid.agda",
"max_stars_repo_stars_event_max_datetime": null,
"max_stars_repo_stars_event_min_datetime": null,
"num_tokens": 714,
"size": 2068
} |
{-# OPTIONS --safe #-}
module Cubical.Algebra.Group.Instances.NProd where
open import Cubical.Foundations.Prelude
open import Cubical.Foundations.HLevels
open import Cubical.Data.Nat using (β)
open import Cubical.Algebra.Group
private variable
β : Level
open GroupStr
NProd-Group : (G : (n : β) β Type β) β (Gstr : (n : β) β GroupStr (G n)) β Group β
fst (NProd-Group G Gstr) = (n : β) β G n
1g (snd (NProd-Group G Gstr)) = Ξ» n β 1g (Gstr n)
GroupStr._Β·_ (snd (NProd-Group G Gstr)) = Ξ» f g n β Gstr n ._Β·_ (f n) (g n)
inv (snd (NProd-Group G Gstr)) = Ξ» f n β (Gstr n).inv (f n)
isGroup (snd (NProd-Group G Gstr)) = makeIsGroup (isSetΞ (Ξ» _ β is-set (Gstr _)))
(Ξ» f g h β funExt Ξ» n β Β·Assoc (Gstr n) _ _ _)
(Ξ» f β funExt Ξ» n β Β·IdR (Gstr n) _)
(Ξ» f β funExt Ξ» n β Β·IdL (Gstr n) _)
(Ξ» f β funExt Ξ» n β Β·InvR (Gstr n) _)
Ξ» f β funExt Ξ» n β Β·InvL (Gstr n) _
| {
"alphanum_fraction": 0.4887285843,
"avg_line_length": 41.0740740741,
"ext": "agda",
"hexsha": "8169e1da5fed15cc28ed752d38e4c186ee879601",
"lang": "Agda",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "58c0b83bb0fed0dc683f3d29b1709effe51c1689",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "thomas-lamiaux/cubical",
"max_forks_repo_path": "Cubical/Algebra/Group/Instances/NProd.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "58c0b83bb0fed0dc683f3d29b1709effe51c1689",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "thomas-lamiaux/cubical",
"max_issues_repo_path": "Cubical/Algebra/Group/Instances/NProd.agda",
"max_line_length": 95,
"max_stars_count": null,
"max_stars_repo_head_hexsha": "58c0b83bb0fed0dc683f3d29b1709effe51c1689",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "thomas-lamiaux/cubical",
"max_stars_repo_path": "Cubical/Algebra/Group/Instances/NProd.agda",
"max_stars_repo_stars_event_max_datetime": null,
"max_stars_repo_stars_event_min_datetime": null,
"num_tokens": 352,
"size": 1109
} |
------------------------------------------------------------------------
-- An abstraction: term-like things
------------------------------------------------------------------------
open import Data.Universe.Indexed
module deBruijn.Context.Term-like
{i u e} (Uni : IndexedUniverse i u e) where
import Axiom.Extensionality.Propositional as E
open import Data.Product
import deBruijn.Context.Basics as Basics
import deBruijn.Context.Extension.Right as Right
open import Function.Base hiding (_β_)
open import Level using (_β_)
open import Relation.Binary using (Setoid)
open import Relation.Binary.PropositionalEquality as P using (_β‘_)
open Basics Uni
open Right Uni
open P.β‘-Reasoning
------------------------------------------------------------------------
-- Term-like things
record Term-like β : Set (i β u β e β Level.suc β) where
infix 3 _β’_
field
_β’_ : (Ξ : Ctxt) β Type Ξ β Set β
β¦_β§ : β {Ξ Ο} β Ξ β’ Ο β Value Ξ Ο
-- Equality of term-like things.
record [β’] : Set (i β u β e β β) where
constructor [_]
field
{Ξ} : Ctxt
{Ο} : Type Ξ
t : Ξ β’ Ο
infix 4 _β
-β’_
_β
-β’_ : β {Ξβ Οβ} (tβ : Ξβ β’ Οβ)
{Ξβ Οβ} (tβ : Ξβ β’ Οβ) β Set _
tβ β
-β’ tβ = _β‘_ {A = [β’]} [ tβ ] [ tβ ]
β
-β’-β-β‘ : β {Ξ Ο} {tβ tβ : Ξ β’ Ο} β
tβ β
-β’ tβ β tβ β‘ tβ
β
-β’-β-β‘ P.refl = P.refl
-- Certain uses of substitutivity can be removed.
drop-subst-β’ :
β {a} {A : Set a} {xβ xβ : A} {Ξ}
(f : A β Type Ξ) {t} (eq : xβ β‘ xβ) β
P.subst (Ξ» x β Ξ β’ f x) eq t β
-β’ t
drop-subst-β’ f P.refl = P.refl
-- A congruence lemma.
β¦β§-cong : β {Ξβ Οβ} {tβ : Ξβ β’ Οβ}
{Ξβ Οβ} {tβ : Ξβ β’ Οβ} β
tβ β
-β’ tβ β β¦ tβ β§ β
-Value β¦ tβ β§
β¦β§-cong P.refl = P.refl
-- Values are term-like.
Val : Term-like _
Val = record { _β’_ = Value; β¦_β§ = id }
-- Variables are term-like.
Var : Term-like _
Var = record { _β’_ = _β_; β¦_β§ = lookup }
------------------------------------------------------------------------
-- Families of functions which, on the semantic side, correspond to
-- the application of a given context morphism
record [_βΆ_] {tβ tβ} (Tβ : Term-like tβ) (Tβ : Term-like tβ)
{Ξ Ξ : Ctxt} (ΟΜ : Ξ β¨Μ Ξ) : Set (i β u β e β tβ β tβ) where
constructor _,_
open Term-like Tβ renaming (_β’_ to _β’β_; β¦_β§ to β¦_β§β)
open Term-like Tβ renaming (_β’_ to _β’β_; β¦_β§ to β¦_β§β)
field
function : β Ο β Ξ β’β Ο β Ξ β’β Ο /Μ ΟΜ
corresponds :
β Ο (t : Ξ β’β Ο) β β¦ t β§β /ΜVal ΟΜ β
-Value β¦ function Ο t β§β
-- Functions which do not change the context or type.
[_βΆβΌ_] : β {tβ tβ} β Term-like tβ β Term-like tβ β Set _
[ Tβ βΆβΌ Tβ ] = β {Ξ} β [ Tβ βΆ Tβ ] iΜd[ Ξ ]
-- Projections. (The fields above have explicit Ο's to avoid some
-- problems; the projections below have implicit Ο's.)
infixl 9 _Β·_
_Β·_ : β {tβ tβ} {Tβ : Term-like tβ} {Tβ : Term-like tβ} β
let open Term-like Tβ renaming (_β’_ to _β’β_)
open Term-like Tβ renaming (_β’_ to _β’β_) in
β {Ξ Ξ Ο} {ΟΜ : Ξ β¨Μ Ξ} β
[ Tβ βΆ Tβ ] ΟΜ β Ξ β’β Ο β Ξ β’β Ο /Μ ΟΜ
_Β·_ f = [_βΆ_].function f _
corresponds :
β {tβ tβ} {Tβ : Term-like tβ} {Tβ : Term-like tβ} β
let open Term-like Tβ renaming (_β’_ to _β’β_; β¦_β§ to β¦_β§β)
open Term-like Tβ renaming (β¦_β§ to β¦_β§β) in
β {Ξ Ξ : Ctxt} {ΟΜ : Ξ β¨Μ Ξ} {Ο}
(f : [ Tβ βΆ Tβ ] ΟΜ) (t : Ξ β’β Ο) β
β¦ t β§β /ΜVal ΟΜ β
-Value β¦ f Β· t β§β
corresponds f = [_βΆ_].corresponds f _
-- Weakening of variables (the successor function).
weakenβ : β {Ξ} {Ο : Type Ξ} β [ Var βΆ Var ] wΜk[ Ο ]
weakenβ = record
{ function = Ξ» _ β suc
; corresponds = Ξ» _ _ β P.refl
}
weakenβ[_] : β {Ξ} (Ο : Type Ξ) β [ Var βΆ Var ] wΜk[ Ο ]
weakenβ[ _ ] = weakenβ
-- Lifts a function on variables, f, to a function which leaves a
-- prefix of the context unchanged and otherwise behaves as f.
lift : β {Ξ Ξ} {ΟΜ : Ξ β¨Μ Ξ} β
[ Var βΆ Var ] ΟΜ β β ΞβΊ β [ Var βΆ Var ] (ΟΜ βΜβΊ ΞβΊ)
lift f Ξ΅ = f
lift {Ξ} {Ξ} {ΟΜ} f (ΞβΊ β» Ο) = record
{ function = function
; corresponds = corr
}
where
function : β Ο β Ξ ++βΊ ΞβΊ β» Ο β Ο β
Ξ ++βΊ (ΞβΊ β» Ο) /ΜβΊ ΟΜ β Ο /Μ ΟΜ βΜβΊ (ΞβΊ β» Ο)
function ._ zero = zero
function ._ (suc x) = suc (lift f ΞβΊ Β· x)
abstract
corr : β Ο (x : Ξ ++βΊ ΞβΊ β» Ο β Ο) β
lookup x /ΜVal ΟΜ βΜβΊ (ΞβΊ β» Ο) β
-Value lookup (function _ x)
corr ._ zero = P.refl
corr ._ (suc x) = begin
[ lookup x /ΜVal ΟΜ βΜβΊ ΞβΊ /ΜVal wΜk ] β‘β¨ /ΜVal-cong (corresponds (lift f ΞβΊ) x) P.refl β©
[ lookup (lift f ΞβΊ Β· x) /ΜVal wΜk ] β‘β¨ P.refl β©
[ lookup (suc (lift f ΞβΊ Β· x)) ] β
------------------------------------------------------------------------
-- Equality for the functions introduced above
-- Note that the definition of equality does not take the
-- "corresponds" proof into account.
record [βΆ] {tβ tβ} (Tβ : Term-like tβ) (Tβ : Term-like tβ)
: Set (i β u β e β tβ β tβ) where
constructor [_]
open Term-like Tβ renaming (_β’_ to _β’β_)
open Term-like Tβ renaming (_β’_ to _β’β_)
field
{Ξ Ξ} : Ctxt
{ΟΜ} : Ξ β¨Μ Ξ
f : β Ο β Ξ β’β Ο β Ξ β’β Ο /Μ ΟΜ
[_]βΆ : β {tβ tβ} {Tβ : Term-like tβ} {Tβ : Term-like tβ}
{Ξ Ξ} {ΟΜ : Ξ β¨Μ Ξ} β
[ Tβ βΆ Tβ ] ΟΜ β [βΆ] Tβ Tβ
[ f ]βΆ = [ [_βΆ_].function f ]
-- Equality is defined as a record type to make it possible to infer
-- Οβ and Οβ from a value of type ΟβΒ β
-βΆΒ Οβ.
infix 4 _β
-βΆ_
record _β
-βΆ_
{tβ tβ} {Tβ : Term-like tβ} {Tβ : Term-like tβ}
{Ξβ Ξβ : Ctxt} {ΟΜβ : Ξβ β¨Μ Ξβ} (fβ : [ Tβ βΆ Tβ ] ΟΜβ)
{Ξβ Ξβ : Ctxt} {ΟΜβ : Ξβ β¨Μ Ξβ} (fβ : [ Tβ βΆ Tβ ] ΟΜβ)
: Set (i β u β e β tβ β tβ) where
constructor [_]
field
[fβ]βΆβ‘[fβ]βΆ : [ fβ ]βΆ β‘ [ fβ ]βΆ
-- Some equational reasoning combinators.
module β
-βΆ-Reasoning
{tβ tβ} {Tβ : Term-like tβ} {Tβ : Term-like tβ}
where
infix 3 _β-βΆ
infixr 2 _β
-βΆβ¨_β©_
_β
-βΆβ¨_β©_ : β {Ξβ Ξβ} {ΟΜβ : Ξβ β¨Μ Ξβ}
{Ξβ Ξβ} {ΟΜβ : Ξβ β¨Μ Ξβ}
{Ξβ Ξβ} {ΟΜβ : Ξβ β¨Μ Ξβ}
(fβ : [ Tβ βΆ Tβ ] ΟΜβ) {fβ : [ Tβ βΆ Tβ ] ΟΜβ}
{fβ : [ Tβ βΆ Tβ ] ΟΜβ} β
fβ β
-βΆ fβ β fβ β
-βΆ fβ β fβ β
-βΆ fβ
_ β
-βΆβ¨ [ fββ
fβ ] β© [ fββ
fβ ] = [ P.trans fββ
fβ fββ
fβ ]
_β-βΆ : β {Ξ Ξ} {ΟΜ : Ξ β¨Μ Ξ} (f : [ Tβ βΆ Tβ ] ΟΜ) β f β
-βΆ f
_ β-βΆ = [ P.refl ]
sym-βΆ : β {Ξβ Ξβ} {ΟΜβ : Ξβ β¨Μ Ξβ} {fβ : [ Tβ βΆ Tβ ] ΟΜβ}
{Ξβ Ξβ} {ΟΜβ : Ξβ β¨Μ Ξβ} {fβ : [ Tβ βΆ Tβ ] ΟΜβ} β
fβ β
-βΆ fβ β fβ β
-βΆ fβ
sym-βΆ [ fββ
fβ ] = [ P.sym fββ
fβ ]
open β
-βΆ-Reasoning public
-- A setoid for [_βΆ_].
[_βΆ_]-setoid : β {tβ tβ} (Tβ : Term-like tβ) (Tβ : Term-like tβ) β
β {Ξ Ξ} β Ξ β¨Μ Ξ β Setoid _ _
[ Tβ βΆ Tβ ]-setoid ΟΜ = record
{ Carrier = [ Tβ βΆ Tβ ] ΟΜ
; _β_ = Ξ» fβ fβ β fβ β
-βΆ fβ
; isEquivalence = record
{ refl = _ β-βΆ
; sym = sym-βΆ
; trans = Ξ» p q β _ β
-βΆβ¨ p β© q
}
}
-- A congruence lemma.
Β·-cong :
β {tβ tβ} {Tβ : Term-like tβ} {Tβ : Term-like tβ} β
let open Term-like Tβ renaming (_β’_ to _β’β_; _β
-β’_ to _β
-β’β_)
open Term-like Tβ renaming (_β’_ to _β’β_; _β
-β’_ to _β
-β’β_) in
β {Ξβ Ξβ Οβ} {ΟΜβ : Ξβ β¨Μ Ξβ} {fβ : [ Tβ βΆ Tβ ] ΟΜβ} {tβ : Ξβ β’β Οβ}
{Ξβ Ξβ Οβ} {ΟΜβ : Ξβ β¨Μ Ξβ} {fβ : [ Tβ βΆ Tβ ] ΟΜβ} {tβ : Ξβ β’β Οβ} β
fβ β
-βΆ fβ β tβ β
-β’β tβ β fβ Β· tβ β
-β’β fβ Β· tβ
Β·-cong {fβ = _ , _} {fβ = ._ , _} [ P.refl ] P.refl = P.refl
abstract
-- Two variants of extensional equality (assuming ordinary
-- extensional equality).
extensional-equalityβ :
β {tβ tβ} {Tβ : Term-like tβ} {Tβ : Term-like tβ} β
let open Term-like Tβ renaming (_β’_ to _β’β_)
open Term-like Tβ renaming (_β
-β’_ to _β
-β’β_)
in
E.Extensionality (i β u β e β tβ) (tβ β tβ) β
β {Ξ Ξβ} {ΟΜβ : Ξ β¨Μ Ξβ} {fβ : [ Tβ βΆ Tβ ] ΟΜβ}
{Ξβ} {ΟΜβ : Ξ β¨Μ Ξβ} {fβ : [ Tβ βΆ Tβ ] ΟΜβ} β
ΟΜβ β
-β¨Μ ΟΜβ β (β {Ο} (t : Ξ β’β Ο) β fβ Β· t β
-β’β fβ Β· t) β
fβ β
-βΆ fβ
extensional-equalityβ {tβ} {tβ} {Tβ = Tβ} ext P.refl fββ
fβ =
[ P.cong [_] (extβ Ξ» Ο β extβ Ξ» t β β
-β’β-β-β‘ (fββ
fβ t)) ]
where
open Term-like Tβ using () renaming (β
-β’-β-β‘ to β
-β’β-β-β‘)
extβ : E.Extensionality (i β u β e) (tβ β tβ)
extβ = E.lower-extensionality tβ Level.zero ext
extβ : E.Extensionality tβ tβ
extβ = E.lower-extensionality (i β u β e) tβ ext
extensional-equalityβ :
β {tβ tβ} {Tβ : Term-like tβ} {Tβ : Term-like tβ} β
let open Term-like Tβ renaming (_β
-β’_ to _β
-β’β_; _β’_ to _β’β_)
open Term-like Tβ renaming (_β
-β’_ to _β
-β’β_)
in
E.Extensionality (i β u β e β tβ) (tβ β tβ) β
β {Ξβ Ξβ} {ΟΜβ : Ξβ β¨Μ Ξβ} {fβ : [ Tβ βΆ Tβ ] ΟΜβ}
{Ξβ Ξβ} {ΟΜβ : Ξβ β¨Μ Ξβ} {fβ : [ Tβ βΆ Tβ ] ΟΜβ} β
ΟΜβ β
-β¨Μ ΟΜβ β
(β {Οβ} {tβ : Ξβ β’β Οβ} {Οβ} {tβ : Ξβ β’β Οβ} β
tβ β
-β’β tβ β fβ Β· tβ β
-β’β fβ Β· tβ) β
fβ β
-βΆ fβ
extensional-equalityβ {Tβ = Tβ} ext P.refl fββ
fβ =
extensional-equalityβ ext P.refl (Ξ» t β fββ
fβ (P.refl {x = [ t ]}))
where open Term-like Tβ using ([_])
-- liftΒ βΒ weakenβ sort of commutes with a lifted version of itself.
lift-weakenβ-lift-lift-weakenβ :
β {Ξ} Ο ΞβΊ Ο ΞβΊβΊ {Ο
} (x : Ξ ++βΊ ΞβΊ ++βΊ ΞβΊβΊ β Ο
) β
lift weakenβ[ Ο /Μ wΜk βΜβΊ ΞβΊ ] (ΞβΊβΊ /ΜβΊ wΜk βΜβΊ ΞβΊ) Β·
(lift (lift weakenβ[ Ο ] ΞβΊ) ΞβΊβΊ Β· x) β
-β
lift (lift weakenβ[ Ο ] (ΞβΊ β» Ο)) (ΞβΊβΊ /ΜβΊ wΜk) Β·
(lift weakenβ[ Ο ] ΞβΊβΊ Β· x)
lift-weakenβ-lift-lift-weakenβ Ο ΞβΊ Ο Ξ΅ x = P.refl
lift-weakenβ-lift-lift-weakenβ Ο ΞβΊ Ο (ΞβΊβΊ β» Ο
) zero =
zero-cong (/Μ-βΜβΊ-/Μ-wΜk-βΜβΊ Ο (wΜk βΜβΊ ΞβΊ) ΞβΊβΊ Ο
)
lift-weakenβ-lift-lift-weakenβ Ο ΞβΊ Ο (ΞβΊβΊ β» Ο
) (suc x) =
suc-cong (/Μ-βΜβΊ-/Μ-wΜk-βΜβΊ Ο (wΜk βΜβΊ ΞβΊ) ΞβΊβΊ Ο
)
(lift-weakenβ-lift-lift-weakenβ Ο ΞβΊ Ο ΞβΊβΊ x)
------------------------------------------------------------------------
-- Term-likeΒ t and [_βΆ_] form a category
-- At least if we ignore the context morphism index.
-- Identity.
[id] : β {t} {T : Term-like t} {Ξ} β [ T βΆ T ] iΜd[ Ξ ]
[id] = record { function = Ξ» _ β id; corresponds = Ξ» _ _ β P.refl }
-- Composition.
infixl 9 _[β]_
_[β]_ : β {tβ tβ tβ}
{Tβ : Term-like tβ} {Tβ : Term-like tβ} {Tβ : Term-like tβ}
{Ξ Ξ Ξ} {ΟΜβ : Ξ β¨Μ Ξ} {ΟΜβ : Ξ β¨Μ Ξ} β
[ Tβ βΆ Tβ ] ΟΜβ β [ Tβ βΆ Tβ ] ΟΜβ β [ Tβ βΆ Tβ ] (ΟΜβ βΜ ΟΜβ)
_[β]_ {Tβ = Tβ} {Tβ} {Tβ} {ΟΜβ = ΟΜβ} {ΟΜβ} f g = record
{ function = Ξ» _ β _Β·_ f β _Β·_ g
; corresponds = corr
}
where
open P.β‘-Reasoning
open Term-like Tβ renaming (β¦_β§ to β¦_β§β; _β’_ to _β’β_)
open Term-like Tβ renaming (β¦_β§ to β¦_β§β)
open Term-like Tβ renaming (β¦_β§ to β¦_β§β)
abstract
corr : β Ο (t : _ β’β Ο) β
β¦ t β§β /ΜVal ΟΜβ βΜ ΟΜβ β
-Value β¦ f Β· (g Β· t) β§β
corr = Ξ» Ο t β begin
[ β¦ t β§β /ΜVal ΟΜβ βΜ ΟΜβ ] β‘β¨ /ΜVal-cong (corresponds g t) P.refl β©
[ β¦ g Β· t β§β /ΜVal ΟΜβ ] β‘β¨ corresponds f (g Β· t) β©
[ β¦ f Β· (g Β· t) β§β ] β
-- [id] and _[β]_ preserve equality.
[id]-cong :
β {t} {T : Term-like t} {Ξβ Ξβ} β
Ξβ β
-Ctxt Ξβ β [id] {T = T} {Ξ = Ξβ} β
-βΆ [id] {T = T} {Ξ = Ξβ}
[id]-cong P.refl = [ P.refl ]
private
module Dummy {tβ tβ} {Tβ : Term-like tβ} {Tβ : Term-like tβ} where
[β]-cong : β {tβ} {Tβ : Term-like tβ}
{Ξβ Ξβ Ξβ} {ΟΜββ : Ξβ β¨Μ Ξβ} {ΟΜββ : Ξβ β¨Μ Ξβ}
{fββ : [ Tβ βΆ Tβ ] ΟΜββ} {fββ : [ Tβ βΆ Tβ ] ΟΜββ}
{Ξβ Ξβ Ξβ} {ΟΜββ : Ξβ β¨Μ Ξβ} {ΟΜββ : Ξβ β¨Μ Ξβ}
{fββ : [ Tβ βΆ Tβ ] ΟΜββ} {fββ : [ Tβ βΆ Tβ ] ΟΜββ} β
fββ β
-βΆ fββ β fββ β
-βΆ fββ β fββ [β] fββ β
-βΆ fββ [β] fββ
[β]-cong {fββ = _ , _} {fββ = _ , _} {fββ = ._ , _} {fββ = ._ , _}
[ P.refl ] [ P.refl ] = [ P.refl ]
-- [id] is a left and right identity of _[β]_, which is associative.
[id]-[β] : β {Ξ Ξ} {ΟΜ : Ξ β¨Μ Ξ}
(f : [ Tβ βΆ Tβ ] ΟΜ) β [id] [β] f β
-βΆ f
[id]-[β] f = [ P.refl ]
[β]-[id] : β {Ξ Ξ} {ΟΜ : Ξ β¨Μ Ξ}
(f : [ Tβ βΆ Tβ ] ΟΜ) β f [β] [id] β
-βΆ f
[β]-[id] f = [ P.refl ]
[β]-[β] :
β {tβ tβ} {Tβ : Term-like tβ} {Tβ : Term-like tβ}
{Ξ Ξ Ξ Ξ} {ΟΜβ : Ξ β¨Μ Ξ} {ΟΜβ : Ξ β¨Μ Ξ} {ΟΜβ : Ξ β¨Μ Ξ}
(fβ : [ Tβ βΆ Tβ ] ΟΜβ) (fβ : [ Tβ βΆ Tβ ] ΟΜβ)
(fβ : [ Tβ βΆ Tβ ] ΟΜβ) β
fβ [β] (fβ [β] fβ) β
-βΆ (fβ [β] fβ) [β] fβ
[β]-[β] fβ fβ fβ = [ P.refl ]
open Dummy public
| {
"alphanum_fraction": 0.4594773953,
"avg_line_length": 32.4059139785,
"ext": "agda",
"hexsha": "3cbf85d0a8cc0b227de995674128d4f31c156fef",
"lang": "Agda",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "498f8aefc570f7815fd1d6616508eeb92c52abce",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "nad/dependently-typed-syntax",
"max_forks_repo_path": "deBruijn/Context/Term-like.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "498f8aefc570f7815fd1d6616508eeb92c52abce",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "nad/dependently-typed-syntax",
"max_issues_repo_path": "deBruijn/Context/Term-like.agda",
"max_line_length": 97,
"max_stars_count": 5,
"max_stars_repo_head_hexsha": "498f8aefc570f7815fd1d6616508eeb92c52abce",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "nad/dependently-typed-syntax",
"max_stars_repo_path": "deBruijn/Context/Term-like.agda",
"max_stars_repo_stars_event_max_datetime": "2020-07-08T22:51:36.000Z",
"max_stars_repo_stars_event_min_datetime": "2020-04-16T12:14:44.000Z",
"num_tokens": 6147,
"size": 12055
} |
module Logic.Propositional.Proofs.Structures where
import Data.Tuple as Tuple
import Lvl
open import Functional
open import Logic
open import Logic.Propositional
import Logic.Propositional.Theorems as Theorems
open import Structure.Operator.Properties
open import Structure.Relator.Equivalence
open import Structure.Relator.Properties
open import Structure.Setoid
open import Type
open import Logic.Propositional.Equiv public
private variable β ββ ββ ββ βββ βββ : Lvl.Level
private variable T A B : Type{β}
instance
[β]-reflexivity : Reflexivity{ββ = β}(_βαΆ _)
[β]-reflexivity = intro Theorems.[β]-reflexivity
instance
[β]-transitivity : Transitivity{ββ = β}(_βαΆ _)
[β]-transitivity = intro Theorems.[β]-transitivity
module _ where
[β]-reflexivity : Reflexivity{ββ = β}(_β_)
[β]-reflexivity = intro Theorems.[β]-reflexivity
module _ where
[β]-transitivity : Transitivity{ββ = β}(_β_)
[β]-transitivity = intro (swap Theorems.[β]-transitivity)
instance
[β]-antisymmetry : Antisymmetry{ββ = β}(_βαΆ _)(_β_)
[β]-antisymmetry = intro(swap [β]-intro)
open import Structure.Relator
open import Structure.Function
open import Structure.Operator
module _ β¦ equiv : Equiv{ββ}(T) β¦ {P : T β Type{β}} where
relator-functionβ : UnaryRelator(P) β Function β¦ equiv-B = [β]-equiv β¦ (P)
UnaryRelator.substitution (Tuple.left relator-functionβ (intro congruence)) xy = [β]-to-[β] (congruence xy)
Function.congruence (Tuple.right relator-functionβ (intro substitution)) xy = [β]-intro (substitution(symmetry(_β‘_) xy)) (substitution xy)
module _ β¦ equiv-A : Equiv{βββ}(A) β¦ β¦ equiv-B : Equiv{βββ}(B) β¦ {P : A β B β Type{β}} where
relator-functionβ : BinaryRelator(P) β BinaryOperator β¦ equiv-B = [β]-equiv β¦ (P)
BinaryRelator.substitution (Tuple.left relator-functionβ (intro congruence)) xy1 xy2 = [β]-to-[β] (congruence xy1 xy2)
BinaryOperator.congruence (Tuple.right relator-functionβ (intro substitution)) xy1 xy2 = [β]-intro (substitution(symmetry(_β‘_) xy1) (symmetry(_β‘_) xy2)) (substitution xy1 xy2)
{- TODO: Maybe a general Equiv and Transitivity for (_β_) is possible with indexed relation structures? What I mean by indexed:
test : β{ββ ββ}{T : TYPE ββ}{β : T β Lvl.Level} β ((x : T) β TYPE(β x)) β TYPE ββ
test2 : TYPE Lvl.π
test2 = test{T = Lvl.Level}{β = Lvl.π} (\β β TYPE β)
instead of:
test : β{ββ ββ}{T : TYPE ββ}{β : Lvl.Level} β TYPE β β TYPE ββ
Then all special cases for (_β_) and (_β_) would finally be redundant. Also, substitution could be a special case of congruence, so *Relator would be special cases of *Operator
-}
instance
[β§]-symmetry : Symmetry{ββ = β}(_β§_)
[β§]-symmetry = intro Theorems.[β§]-symmetry
instance
[β¨]-symmetry : Symmetry{ββ = β}(_β¨_)
[β¨]-symmetry = intro Theorems.[β¨]-symmetry
instance
[β§][β]-sub : (_β§_) ββ (_β_ {ββ}{ββ})
[β§][β]-sub = intro Theorems.[β§]-to-[β]
instance
[β§][β]-sub : (_β§_) ββ (_βαΆ _ {ββ}{ββ})
[β§][β]-sub = intro Theorems.[β§]-to-[β]
instance
[β§][β]-sub : (_β§_) ββ (_β_ {ββ}{ββ})
[β§][β]-sub = intro Theorems.[β§]-to-[β]
instance
[β§][β¨]-sub : (_β§_) ββ (_β¨_ {ββ}{ββ})
[β§][β¨]-sub = intro Theorems.[β§]-to-[β¨]
instance
[β§]-associativity : Associativity β¦ [β]-equiv β¦ (_β§_ {β})
[β§]-associativity = intro Theorems.[β§]-associativity
instance
[β§]-operator : BinaryOperator β¦ [β]-equiv{ββ} β¦ β¦ [β]-equiv{ββ} β¦ β¦ [β]-equiv β¦ (_β§_)
BinaryOperator.congruence [β§]-operator = Theorems.[β§]-map-[β]
instance
[β¨]-operator : BinaryOperator β¦ [β]-equiv{ββ} β¦ β¦ [β]-equiv{ββ} β¦ β¦ [β]-equiv β¦ (_β¨_)
BinaryOperator.congruence [β¨]-operator = Theorems.[β¨]-map-[β]
instance
[β]-operator : BinaryOperator β¦ [β]-equiv{ββ} β¦ β¦ [β]-equiv{ββ} β¦ β¦ [β]-equiv β¦ (_βαΆ _)
BinaryOperator.congruence [β]-operator = Theorems.[β]-map-[β]
instance
[β]-operator : BinaryOperator β¦ [β]-equiv{ββ} β¦ β¦ [β]-equiv{ββ} β¦ β¦ [β]-equiv β¦ (_β_)
BinaryOperator.congruence [β]-operator = Theorems.[β]-map-[β]
| {
"alphanum_fraction": 0.6533945891,
"avg_line_length": 35.9449541284,
"ext": "agda",
"hexsha": "99e83434143373e9ac593b8fd86591bfb5ae0da3",
"lang": "Agda",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "Lolirofle/stuff-in-agda",
"max_forks_repo_path": "Logic/Propositional/Proofs/Structures.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "Lolirofle/stuff-in-agda",
"max_issues_repo_path": "Logic/Propositional/Proofs/Structures.agda",
"max_line_length": 178,
"max_stars_count": 6,
"max_stars_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "Lolirofle/stuff-in-agda",
"max_stars_repo_path": "Logic/Propositional/Proofs/Structures.agda",
"max_stars_repo_stars_event_max_datetime": "2022-02-05T06:53:22.000Z",
"max_stars_repo_stars_event_min_datetime": "2020-04-07T17:58:13.000Z",
"num_tokens": 1586,
"size": 3918
} |
{-# OPTIONS --prop --rewriting #-}
module Examples.Sorting.Parallel where
open import Examples.Sorting.Parallel.Comparable
open import Calf costMonoid
open import Calf.Types.Nat
open import Calf.Types.List
open import Relation.Binary.PropositionalEquality as Eq using (_β‘_)
open import Data.Product using (_,_)
open import Data.Nat using (zβ€n; sβ€s)
test/forward = 1 β· 2 β· 3 β· 4 β· 5 β· 6 β· 7 β· 8 β· 9 β· 10 β· 11 β· 12 β· 13 β· 14 β· 15 β· 16 β· []
test/backward = 16 β· 15 β· 14 β· 13 β· 12 β· 11 β· 10 β· 9 β· 8 β· 7 β· 6 β· 5 β· 4 β· 3 β· 2 β· 1 β· []
test/shuffled = 4 β· 8 β· 12 β· 16 β· 13 β· 3 β· 5 β· 14 β· 9 β· 6 β· 7 β· 10 β· 11 β· 1 β· 2 β· 15 β· []
module Ex/InsertionSort where
import Examples.Sorting.Parallel.InsertionSort NatComparable as Sort
list' = list nat
ex/insert : cmp (F list')
ex/insert = Sort.insert 3 (1 β· 2 β· 4 β· [])
ex/sort : cmp (F list')
ex/sort = Sort.sort (1 β· 5 β· 3 β· 1 β· 2 β· [])
ex/sort/forward : cmp (F list')
ex/sort/forward = Sort.sort test/forward -- cost: 15 , 15
ex/sort/backward : cmp (F list')
ex/sort/backward = Sort.sort test/backward -- cost: 120 , 120
ex/sort/shuffled : cmp (F list')
ex/sort/shuffled = Sort.sort test/shuffled -- cost: 76 , 76
module Ex/MergeSort where
import Examples.Sorting.Parallel.MergeSort NatComparable as Sort
list' = list nat
ex/split : cmp (F Sort.pair)
ex/split = Sort.split (6 β· 2 β· 8 β· 3 β· 1 β· 8 β· 5 β· [])
ex/merge : cmp (F list')
ex/merge = Sort.merge (2 β· 3 β· 6 β· 8 β· [] , 1 β· 5 β· 8 β· [])
ex/sort : cmp (F list')
ex/sort = Sort.sort (1 β· 5 β· 3 β· 1 β· 2 β· [])
ex/sort/forward : cmp (F list')
ex/sort/forward = Sort.sort test/forward -- cost: 32, 15
ex/sort/backward : cmp (F list')
ex/sort/backward = Sort.sort test/backward -- cost: 32, 15
ex/sort/shuffled : cmp (F list')
ex/sort/shuffled = Sort.sort test/shuffled -- cost: 47, 26
module Ex/MergeSortPar where
import Examples.Sorting.Parallel.MergeSortPar NatComparable as Sort
list' = list nat
ex/split : cmp (F Sort.pair)
ex/split = Sort.split (6 β· 2 β· 8 β· 3 β· 1 β· 8 β· 5 β· [])
ex/splitMid : cmp (F Sort.triple)
ex/splitMid = Sort.splitMid test/forward (sβ€s zβ€n)
ex/splitBy : cmp (F Sort.pair)
ex/splitBy = Sort.splitBy test/forward 5
ex/merge : cmp (F list')
ex/merge = Sort.merge (2 β· 3 β· 6 β· 8 β· [] , 1 β· 5 β· 8 β· [])
ex/sort : cmp (F list')
ex/sort = Sort.sort (1 β· 5 β· 3 β· 1 β· 2 β· [])
ex/sort/forward : cmp (F list')
ex/sort/forward = Sort.sort test/forward -- cost: 40, 21
ex/sort/backward : cmp (F list')
ex/sort/backward = Sort.sort test/backward -- cost: 40, 21
ex/sort/shuffled : cmp (F list')
ex/sort/shuffled = Sort.sort test/shuffled -- cost: 43, 17
module SortEquivalence (M : Comparable) where
open Comparable M
open import Examples.Sorting.Parallel.Core M
import Examples.Sorting.Parallel.InsertionSort M as ISort
import Examples.Sorting.Parallel.MergeSort M as MSort
import Examples.Sorting.Parallel.MergeSortPar M as PSort
isortβ‘msort : β― (ISort.sort β‘ MSort.sort)
isortβ‘msort = IsSortββ‘ ISort.sort ISort.sort/correct MSort.sort MSort.sort/correct
msortβ‘psort : β― (MSort.sort β‘ PSort.sort)
msortβ‘psort = IsSortββ‘ MSort.sort MSort.sort/correct PSort.sort PSort.sort/correct
| {
"alphanum_fraction": 0.6391465677,
"avg_line_length": 31.0961538462,
"ext": "agda",
"hexsha": "1a796c9bfdc15dc94d53d24daa3d43c197ffcebb",
"lang": "Agda",
"max_forks_count": 2,
"max_forks_repo_forks_event_max_datetime": "2022-01-29T08:12:01.000Z",
"max_forks_repo_forks_event_min_datetime": "2021-10-06T10:28:24.000Z",
"max_forks_repo_head_hexsha": "e51606f9ca18d8b4cf9a63c2d6caa2efc5516146",
"max_forks_repo_licenses": [
"Apache-2.0"
],
"max_forks_repo_name": "jonsterling/agda-calf",
"max_forks_repo_path": "src/Examples/Sorting/Parallel.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "e51606f9ca18d8b4cf9a63c2d6caa2efc5516146",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"Apache-2.0"
],
"max_issues_repo_name": "jonsterling/agda-calf",
"max_issues_repo_path": "src/Examples/Sorting/Parallel.agda",
"max_line_length": 89,
"max_stars_count": 29,
"max_stars_repo_head_hexsha": "e51606f9ca18d8b4cf9a63c2d6caa2efc5516146",
"max_stars_repo_licenses": [
"Apache-2.0"
],
"max_stars_repo_name": "jonsterling/agda-calf",
"max_stars_repo_path": "src/Examples/Sorting/Parallel.agda",
"max_stars_repo_stars_event_max_datetime": "2022-03-22T20:35:11.000Z",
"max_stars_repo_stars_event_min_datetime": "2021-07-14T03:18:28.000Z",
"num_tokens": 1266,
"size": 3234
} |
module Day3 where
open import Data.String as String
open import Data.Maybe
open import Foreign.Haskell using (Unit)
open import Data.List as List hiding (fromMaybe)
open import Data.Nat
open import Data.Nat.DivMod
open import Data.Nat.Properties
import Data.Nat.Show as βs
open import Data.Char
open import Data.Vec as Vec renaming (_>>=_ to _VV=_ ; toList to VecToList)
open import Data.Product
open import Relation.Nullary
open import Data.Nat.Properties
open import Data.Bool.Base
open import AocIO
open import AocUtil
open import AocVec
open import Relation.Binary.PropositionalEquality
open import EvenOdd
printUsage : String β IO Unit
printUsage name = printString ("Usage: " String.++ name String.++ " NUMBER\n(NUMBER > 0)")
sqr : (l : β) β Ξ£[ k β β ] (k β‘ l * l)
sqr l = l * l , refl
first-larger-odd-square : {m : β} β (n : β) β suc m β‘ n β Ξ£[ k β β ] (n β€ (k * k) Γ Odd k)
first-larger-odd-square {m} n n-is-suc = helper 1 m n-is-suc oddOne
where
helper : (m diff : β) β (m + diff) β‘ n β Odd m β Ξ£[ k β β ] (n β€ (k * k) Γ Odd k)
helper m (suc (suc diff)) p m-is-odd with sqr m
... | (mΒ² , mΒ²β‘m*m) with n β€? mΒ²
... | yes nβ€mΒ² rewrite mΒ²β‘m*m = m , nβ€mΒ² , m-is-odd
... | no _ = helper (suc (suc m)) diff rewr-p (oddSuc m-is-odd)
where
rewr-p : suc (suc m + diff) β‘ n
rewr-p with (+-suc m diff) | (+-suc m (suc diff))
... | s | t rewrite (sym s) | t = p
helper m zero p m-is-odd rewrite (+-identityΚ³ m) with (sqr m)
... | (mΒ² , q) = m , (my-proof n refl) , m-is-odd
where
my-proof : (k : β) β k β‘ n β n β€ m * m
my-proof k pβ rewrite sym pβ with k
... | zero = zβ€n
... | suc kk rewrite p with (mβ€m+n kk (kk * suc kk))
... | kkβ€kk+junk = sβ€s kkβ€kk+junk
helper zero (suc zero) p ()
helper (suc zero) (suc zero) p m-is-odd rewrite sym p = 3 , (sβ€s (sβ€s zβ€n) , oddSuc oddOne)
helper (suc (suc m)) (suc zero) p m-is-odd = (suc (suc m)) , my-proof n refl , m-is-odd
where
my-proof : (k : β) β k β‘ n β n β€ suc (suc (m + suc (suc (m + m * suc (suc m)))))
my-proof k pβ rewrite sym pβ with k
... | zero = zβ€n
-- we replace with p and get an expression 1 + m β€ suc (suc m + junk)
-- +-comm m 1 turns 1 + m into suc m
-- sym +-suc turns m + suc junk into suc (m + junk) to match the number on the other side
-- finally we cancel suc on both sides and use m β€ m + junk
... | suc kk rewrite sym p | +-comm m 1 | +-suc m (suc (m + m * suc (suc m))) = sβ€s (sβ€s (sβ€s (mβ€m+n m (suc (m + m * suc (suc m))))))
oddness : β {n} β Odd n β β
oddness oddOne = 1
oddness (oddSuc v) = suc (oddness v)
ring-for-square# : {m : β} β (n : β) β suc m β‘ n β Ξ£[ k β β ] Odd k Γ β
ring-for-square# zero ()
ring-for-square# (suc n) p with (first-larger-odd-square (suc n) (cong suc refl))
... | k , projβ , k-odd = k , k-odd , (oddness k-odd)
ring-corners : {m : β} β Odd m β β Γ β Γ β Γ β Γ β
ring-corners oddOne = 1 , (1 , (1 , 1 , 1))
ring-corners {(suc (suc n))} (oddSuc _) = (n * n) , ((projβ first-corner) , ((projβ second-corner) , ((projβ third-corner) , (projβ fourth-corner))))
where
first-corner : Ξ£[ k β β ] k β‘ suc ((n * n) + n)
first-corner = suc (n * n + n) , refl
second-corner : Ξ£[ k β β ] k β‘ suc (suc ((n * n) + n + n))
second-corner = (suc (suc (n * n + n + n))) , refl
third-corner : Ξ£[ k β β ] k β‘ suc (suc (suc ((n * n) + n + n + n)))
third-corner = suc (suc (suc (n * n + n + n + n))) , refl
fourth-corner : Ξ£[ k β β ] k β‘ suc (suc (n + suc (suc (n + n * suc (suc n)))))
fourth-corner = sqr (suc (suc n))
ring-length : Ξ£[ k β β ] k β‘ (2 * (suc (suc n))) + (2 * n)
ring-length = (2 * (suc (suc n)) + 2 * n) , refl
-- proof that fourth-corner = ring-length + prev-fourth-corner
ring-length-proof : {m l : β} β m β‘ suc (suc (n + suc (suc (n + n * suc (suc n))))) β l β‘ (2 * (suc (suc n))) + (2 * n) β l + (n * n) β‘ m
ring-length-proof p q rewrite p | q = cong suc (cong suc my-proof)
where
halp : n + n + (n + n) β‘ n + n + n + n
halp = begin
n + n + (n + n)
β‘β¨ sym (+-assoc (n + n) n n) β©
n + n + n + n β
where
open β‘-Reasoning
halp-again : n * n + (n + n + n + n) β‘ n * n + n + n + n + n
halp-again with +-assoc (n * n) (n + n + n) n
... | pβ rewrite sym pβ with +-assoc (n * n) (n + n) n
... | pβ rewrite sym pβ with +-assoc (n * n) n n
... | pβ rewrite sym pβ = refl
my-proof : n + suc (suc (n + 0)) + (n + (n + 0)) + n * n β‘ n + suc (suc (n + n * suc (suc n)))
my-proof rewrite +-identityΚ³ n | +-*-suc n (suc n) | +-*-suc n n with +-comm n (suc (suc n)) | +-comm n (suc (suc (n + (n + (n + n * n)))))
... | pβ | pβ rewrite pβ | pβ with +-comm n (n + n * n) | +-comm n (n + n * n + n) | +-comm n (n * n) | +-comm (n + n + (n + n)) (n * n)
... | pβ | pβ | pβ
| pβ rewrite pβ | pβ | pβ
| pβ | halp | halp-again = cong suc (cong suc refl)
-- Here I'd like a proof that the distance between the corners add up to the length
abs-diff : (n m : β) β β
abs-diff zero m = m
abs-diff (suc n) zero = suc n
abs-diff (suc n) (suc m) = abs-diff n m
min-5 : (a b c d e : β) β β
min-5 a b c d e with a β b | c β d
... | min-ab | min-cd with min-ab β min-cd
... | min-abcd = min-abcd β e
dist-to-closest-ring-corner : {k : β} β (n : β) β suc k β‘ n β β
dist-to-closest-ring-corner zero ()
dist-to-closest-ring-corner (suc k) p with (ring-for-square# (suc k) p) | (suc k)
... | corner-root , corner-root-odd , ring# | n with ring-corners corner-root-odd
... | cβ , cβ , cβ , cβ , cβ with abs-diff n cβ | abs-diff n cβ | abs-diff n cβ | abs-diff n cβ | abs-diff n cβ
... | n-cβ | n-cβ | n-cβ | n-cβ | n-cβ = min-5 n-cβ n-cβ n-cβ n-cβ n-cβ
dist-to-center : {k : β} β (n : β) β suc k β‘ n β β
dist-to-center zero ()
dist-to-center (suc k) p with (ring-for-square# (suc k) p) | (suc k)
... | corner-root , corner-root-odd , ring# | n with dist-to-closest-ring-corner (suc k) refl
... | dist = abs-diff dist (2 * (pred ring#))
infixr 5 _+++_
_+++_ : String β String β String
_+++_ s1 s2 = s1 String.++ " " String.++ s2
print-corners : {k : β} β (n : β) β suc k β‘ n β IO Unit
print-corners zero ()
print-corners (suc k) p with (ring-for-square# (suc k) p) | (suc k)
... | corner-root , corner-root-odd , ring# | n with ring-corners corner-root-odd
... | cβ , cβ , cβ , cβ , cβ with abs-diff n cβ | abs-diff n cβ | abs-diff n cβ | abs-diff n cβ | abs-diff n cβ
... | n-cβ | n-cβ | n-cβ | n-cβ | n-cβ with βs.show n-cβ | βs.show n-cβ | βs.show n-cβ | βs.show n-cβ | βs.show n-cβ | βs.show corner-root | βs.show ring#
... | s0 | s1 | s2 | s3 | s4 | s5 | s6 = printString (s0 +++ s1 +++ s2 +++ s3 +++ s4 +++ "==" +++ s5 +++ s6)
main : IO Unit
main = mainBuilder main'
where
main' : String β (List String) β IO Unit
main' name (numS β· []) with (unsafeParseNat (String.toList numS))
... | 0 = printUsage name
... | (suc n) = printString (βs.show (dist-to-center (suc n) (cong suc refl)))
main' name _ = printUsage name
| {
"alphanum_fraction": 0.5383426966,
"avg_line_length": 46.2337662338,
"ext": "agda",
"hexsha": "82743da45bf400c2317d5ded5b0b2a0d1ab3db72",
"lang": "Agda",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "37956e581dc51bf78008d7dd902bb18d2ee481f6",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "Zalastax/adventofcode2017",
"max_forks_repo_path": "day-3/Day3.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "37956e581dc51bf78008d7dd902bb18d2ee481f6",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "Zalastax/adventofcode2017",
"max_issues_repo_path": "day-3/Day3.agda",
"max_line_length": 154,
"max_stars_count": null,
"max_stars_repo_head_hexsha": "37956e581dc51bf78008d7dd902bb18d2ee481f6",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "Zalastax/adventofcode2017",
"max_stars_repo_path": "day-3/Day3.agda",
"max_stars_repo_stars_event_max_datetime": null,
"max_stars_repo_stars_event_min_datetime": null,
"num_tokens": 2778,
"size": 7120
} |
{-# OPTIONS --without-K --rewriting #-}
open import HoTT
module experimental.NConnected where
lemmaβ : β {i j} {A : Type i} {B : Type j} (f : A β B) {n : βββ}
β is-connected n A β is-connected (S n) B
β has-conn-fibers n f
lemmaβ f cA cB = Ξ» b β Ξ£-conn cA (Ξ» a β path-conn cB)
lemmaβ : β {i} {A B C : Type i}
β (f : A β B) (g : B β C) {n : βββ}
β has-conn-fibers n (g β f)
β has-conn-fibers (S n) g
β has-conn-fibers n f
lemmaβ f g {n} cA cB b =
equiv-preserves-conn (eqv b idp β»ΒΉ) (lemmaβ-fβ² (g b) (b , idp))
where
fβ² : β c β hfiber (g β f) c β hfiber g c
fβ² c (a , p) = (f a , p)
-- We first show [β b β is-connected n (hfiber (fβ² (g b) (b , idp))) ]
lemmaβ-fβ² : β c β has-conn-fibers n (fβ² c)
lemmaβ-fβ² c = lemmaβ (fβ² c) (cA c) (cB c)
-- The remaining shows [hfiber (fβ² (g b) (b , idp))]
-- is the same as [hfiber f b]
to : β b p β hfiber f b β hfiber (fβ² (g b)) (b , p)
to ._ p (a , idp) = ((a , p) , idp)
fromβ² : β b a β f a == b β hfiber f b
fromβ² ._ a idp = (a , idp)
from : β b p β hfiber (fβ² (g b)) (b , p) β hfiber f b
from b p ((a , q) , r) = fromβ² b a (fst= r)
from-to : β b p x β from b p (to b p x) == x
from-to ._ p (a , idp) = idp
to-from : β b p x β to b p (from b p x) == x
to-from b p ((a , q) , r) =
to b p (from b p ((a , q) , r))
=β¨ pair=-Ξ· r |in-ctx (Ξ» r β to b p (from b p ((a , q) , r))) β©
to b p (from b p ((a , q) , pair= (fst= r) (snd= r)))
=β¨ lemma b p a q (fst= r) (snd= r) β©
((a , q) , pair= (fst= r) (snd= r))
=β¨ ! (pair=-Ξ· r) |in-ctx (Ξ» r β ((a , q) , r)) β©
((a , q) , r)
β
where
lemma : β b p a (q : g (f a) == g b)
β (r : f a == b) (s : q == p [ (Ξ» bβ² β g bβ² == g b) β r ])
β to b p (from b p ((a , q) , pair= r s)) == ((a , q) , pair= r s)
lemma ._ ._ a q idp idp = idp
eqv : β b p β hfiber f b β hfiber (fβ² (g b)) (b , p)
eqv b p = equiv (to b p) (from b p) (to-from b p) (from-to b p)
lemmaβ : β {i j} {A : Type i} {B : Type j} (f : A β B)
β A β Ξ£ B (hfiber f)
lemmaβ {A = A} {B} f = equiv to from to-from from-to
where
to : A β Ξ£ B (hfiber f)
to a = (f a , (a , idp))
from : Ξ£ B (hfiber f) β A
from (_ , (a , p)) = a
to-from : β s β to (from s) == s
to-from (._ , (a , idp)) = idp
from-to : β a β from (to a) == a
from-to a = idp
{-
β-conn : β {i j k} {A : Type i} {B : Type j} {C : Type k}
β (f : A β B) β (g : B β C) β {n : βββ}
β has-conn-fibers n f
β has-conn-fibers n g
β has-conn-fibers n (g β f)
β-conn f g {β¨-2β©} cf cg c = -2-conn _
β-conn f g {S n } cf cg c =
Trunc-rec
{P = is-connected (hfiber (g β f) c)}
(prop-has-level-S n (is-connected-is-prop n A))
(Ξ» c )
(cg c)
-}
{-
lemmaβ-path : β {i j} {A : Type i} {B : Type j} (f : A β B)
β A == Ξ£ B (hfiber f)
lemmaβ-path = Ξ» f β ua (lemmaβ f)
-}
| {
"alphanum_fraction": 0.4139922978,
"avg_line_length": 31.7959183673,
"ext": "agda",
"hexsha": "df9db6d4aa8d7194f181591437946aacad07c90a",
"lang": "Agda",
"max_forks_count": 50,
"max_forks_repo_forks_event_max_datetime": "2022-02-14T03:03:25.000Z",
"max_forks_repo_forks_event_min_datetime": "2015-01-10T01:48:08.000Z",
"max_forks_repo_head_hexsha": "66f800adef943afdf08c17b8ecfba67340fead5e",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "timjb/HoTT-Agda",
"max_forks_repo_path": "theorems/stash/NConnected.agda",
"max_issues_count": 31,
"max_issues_repo_head_hexsha": "66f800adef943afdf08c17b8ecfba67340fead5e",
"max_issues_repo_issues_event_max_datetime": "2021-10-03T19:15:25.000Z",
"max_issues_repo_issues_event_min_datetime": "2015-03-05T20:09:00.000Z",
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "timjb/HoTT-Agda",
"max_issues_repo_path": "theorems/stash/NConnected.agda",
"max_line_length": 80,
"max_stars_count": 294,
"max_stars_repo_head_hexsha": "66f800adef943afdf08c17b8ecfba67340fead5e",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "timjb/HoTT-Agda",
"max_stars_repo_path": "theorems/stash/NConnected.agda",
"max_stars_repo_stars_event_max_datetime": "2022-03-20T13:54:45.000Z",
"max_stars_repo_stars_event_min_datetime": "2015-01-09T16:23:23.000Z",
"num_tokens": 1314,
"size": 3116
} |
------------------------------------------------------------------------
-- The Agda standard library
--
-- The basic code for equational reasoning with a single relation
------------------------------------------------------------------------
{-# OPTIONS --without-K --safe #-}
open import Relation.Binary
module Relation.Binary.Reasoning.Base.Single
{a β} {A : Set a} (_βΌ_ : Rel A β)
(refl : Reflexive _βΌ_) (trans : Transitive _βΌ_)
where
------------------------------------------------------------------------
-- Reasoning combinators
-- Re-export combinators from partial reasoning
open import Relation.Binary.Reasoning.Base.Partial _βΌ_ trans public
hiding (_ββ¨_β©)
-- Redefine the terminating combinator now that we have reflexivity
infix 3 _β
_β : β x β x IsRelatedTo x
x β = relTo refl
| {
"alphanum_fraction": 0.5185185185,
"avg_line_length": 27,
"ext": "agda",
"hexsha": "d8957b78f6af00591f434601d511ccb510442274",
"lang": "Agda",
"max_forks_count": 1,
"max_forks_repo_forks_event_max_datetime": "2021-11-04T06:54:45.000Z",
"max_forks_repo_forks_event_min_datetime": "2021-11-04T06:54:45.000Z",
"max_forks_repo_head_hexsha": "fb380f2e67dcb4a94f353dbaec91624fcb5b8933",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "DreamLinuxer/popl21-artifact",
"max_forks_repo_path": "agda-stdlib/src/Relation/Binary/Reasoning/Base/Single.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "fb380f2e67dcb4a94f353dbaec91624fcb5b8933",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "DreamLinuxer/popl21-artifact",
"max_issues_repo_path": "agda-stdlib/src/Relation/Binary/Reasoning/Base/Single.agda",
"max_line_length": 72,
"max_stars_count": 5,
"max_stars_repo_head_hexsha": "fb380f2e67dcb4a94f353dbaec91624fcb5b8933",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "DreamLinuxer/popl21-artifact",
"max_stars_repo_path": "agda-stdlib/src/Relation/Binary/Reasoning/Base/Single.agda",
"max_stars_repo_stars_event_max_datetime": "2020-10-10T21:41:32.000Z",
"max_stars_repo_stars_event_min_datetime": "2020-10-07T12:07:53.000Z",
"num_tokens": 180,
"size": 810
} |
{-# OPTIONS --universe-polymorphism #-}
module Issue227 where
open import Common.Level
data D (a p b : Level) (A : Set a) (P : A β Set p) : Set (p β a β b) where
d : ((x : A) β P x) β D a p b A P
-- Unsolved trivial constraint: Set (a β p) =< Set (p β a).
OK : β {a} {A : Set a} β (A β Set) β A β Set _
OK P = P
NotOK : β {a} {A : Set a} β (P : A β Set) β A β Set _
NotOK P = P
-- Unsolved constraint:
-- \/ (Set (a β suc zero)) (Set (a β suc zero)) = \/ (Set (a β suc zero)) (Set (a β suc zero)) | {
"alphanum_fraction": 0.5138888889,
"avg_line_length": 28,
"ext": "agda",
"hexsha": "b5334e00eb83db032381da85860d212407577c94",
"lang": "Agda",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "70c8a575c46f6a568c7518150a1a64fcd03aa437",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "masondesu/agda",
"max_forks_repo_path": "test/succeed/Issue227.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "70c8a575c46f6a568c7518150a1a64fcd03aa437",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "masondesu/agda",
"max_issues_repo_path": "test/succeed/Issue227.agda",
"max_line_length": 94,
"max_stars_count": 1,
"max_stars_repo_head_hexsha": "aa10ae6a29dc79964fe9dec2de07b9df28b61ed5",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "asr/agda-kanso",
"max_stars_repo_path": "test/succeed/Issue227.agda",
"max_stars_repo_stars_event_max_datetime": "2019-11-27T04:41:05.000Z",
"max_stars_repo_stars_event_min_datetime": "2019-11-27T04:41:05.000Z",
"num_tokens": 202,
"size": 504
} |
------------------------------------------------------------------------------
-- Induction principles for the total natural numbers inductive predicate
------------------------------------------------------------------------------
{-# OPTIONS --exact-split #-}
{-# OPTIONS --no-sized-types #-}
{-# OPTIONS --no-universe-polymorphism #-}
{-# OPTIONS --without-K #-}
module FOT.FOTC.Data.Nat.Type where
open import FOTC.Base hiding ( succβ )
------------------------------------------------------------------------------
-- We define succβ outside an abstract block.
succβ : D β D
succβ n = succ Β· n
module ConstantAndUnaryFunction where
-- N using the constant succ.
data N : D β Set where
nzero : N zero
nsucc : β {n} β N n β N (succ Β· n)
N-ind : (A : D β Set) β
A zero β
(β {n} β A n β A (succ Β· n)) β
β {n} β N n β A n
N-ind A A0 h nzero = A0
N-ind A A0 h (nsucc Nn) = h (N-ind A A0 h Nn)
-- N using the unary function succβ.
data Nβ : D β Set where
nzeroβ : Nβ zero
nsuccβ : β {n} β Nβ n β Nβ (succβ n)
N-indβ : (A : D β Set) β
A zero β
(β {n} β A n β A (succβ n)) β
β {n} β Nβ n β A n
N-indβ A A0 h nzeroβ = A0
N-indβ A A0 h (nsuccβ Nn) = h (N-indβ A A0 h Nn)
----------------------------------------------------------------------------
-- From N/Nβ to Nβ/N.
NβNβ : β {n} β N n β Nβ n
NβNβ nzero = nzeroβ
NβNβ (nsucc {n} Nn) = nsuccβ (NβNβ Nn)
NββN : β {n} β Nβ n β N n
NββN nzeroβ = nzero
NββN (nsuccβ {n} Nβn) = nsucc (NββN Nβn)
----------------------------------------------------------------------------
-- From N-ind β N-indβ.
N-indβ' : (A : D β Set) β
A zero β
(β {n} β A n β A (succβ n)) β
β {n} β Nβ n β A n
N-indβ' A A0 h Nnβ = N-ind A A0 h' (NββN Nnβ)
where
h' : β {n} β A n β A (succ Β· n)
h' {n} An = h An
----------------------------------------------------------------------------
-- From N-indβ β N-ind.
N-ind' : (A : D β Set) β
A zero β
(β {n} β A n β A (succ Β· n)) β
β {n} β N n β A n
N-ind' A A0 h Nn = N-indβ A A0 h' (NβNβ Nn)
where
h' : β {n} β A n β A (succβ n)
h' {n} An = h An
------------------------------------------------------------------------------
module AdditionalHypotheis where
data N : D β Set where
nzero : N zero
nsucc : β {n} β N n β N (succβ n)
-- The induction principle generated by Coq 8.4pl4 when we define
-- the data type N in Prop.
N-indβ : (A : D β Set) β
A zero β
(β {n} β N n β A n β A (succβ n)) β
β {n} β N n β A n
N-indβ A A0 h nzero = A0
N-indβ A A0 h (nsucc Nn) = h Nn (N-indβ A A0 h Nn)
-- The induction principle removing the hypothesis N n from the
-- inductive step (see Martin-LΓΆf 1971, p. 190).
N-indβ : (A : D β Set) β
A zero β
(β {n} β A n β A (succβ n)) β
β {n} β N n β A n
N-indβ A A0 h nzero = A0
N-indβ A A0 h (nsucc Nn) = h (N-indβ A A0 h Nn)
----------------------------------------------------------------------------
-- N-indβ from N-indβ.
N-indβ' : (A : D β Set) β
A zero β
(β {n} β A n β A (succβ n)) β
β {n} β N n β A n
N-indβ' A A0 h = N-indβ A A0 (Ξ» _ β h)
----------------------------------------------------------------------------
-- N-indβ from N-indβ.
N-indβ' : (A : D β Set) β
A zero β
(β {n} β N n β A n β A (succβ n)) β
β {n} β N n β A n
N-indβ' A A0 h {n} Nn = β§-projβ (N-indβ B B0 h' Nn)
where
B : D β Set
B n = N n β§ A n
B0 : B zero
B0 = nzero , A0
h' : β {m} β B m β B (succβ m)
h' (Nm , Am) = nsucc Nm , h Nm Am
------------------------------------------------------------------------------
-- References
--
-- Martin-LΓΆf, P. (1971). Hauptsatz for the Intuitionistic Theory of
-- Iterated Inductive Definitions. In: Proceedings of the Second
-- Scandinavian Logic Symposium. Ed. by Fenstad,
-- J. E. Vol. 63. Studies in Logic and the Foundations of
-- Mathematics. North-Holland Publishing Company, pp. 179β216.
| {
"alphanum_fraction": 0.3912326184,
"avg_line_length": 30.7463768116,
"ext": "agda",
"hexsha": "9028e7d935ee6ca0bd8b567c2b66bcf0a8bf64a2",
"lang": "Agda",
"max_forks_count": 3,
"max_forks_repo_forks_event_max_datetime": "2018-03-14T08:50:00.000Z",
"max_forks_repo_forks_event_min_datetime": "2016-09-19T14:18:30.000Z",
"max_forks_repo_head_hexsha": "2fc9f2b81052a2e0822669f02036c5750371b72d",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "asr/fotc",
"max_forks_repo_path": "notes/FOT/FOTC/Data/Nat/Type.agda",
"max_issues_count": 2,
"max_issues_repo_head_hexsha": "2fc9f2b81052a2e0822669f02036c5750371b72d",
"max_issues_repo_issues_event_max_datetime": "2017-01-01T14:34:26.000Z",
"max_issues_repo_issues_event_min_datetime": "2016-10-12T17:28:16.000Z",
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "asr/fotc",
"max_issues_repo_path": "notes/FOT/FOTC/Data/Nat/Type.agda",
"max_line_length": 78,
"max_stars_count": 11,
"max_stars_repo_head_hexsha": "2fc9f2b81052a2e0822669f02036c5750371b72d",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "asr/fotc",
"max_stars_repo_path": "notes/FOT/FOTC/Data/Nat/Type.agda",
"max_stars_repo_stars_event_max_datetime": "2021-09-12T16:09:54.000Z",
"max_stars_repo_stars_event_min_datetime": "2015-09-03T20:53:42.000Z",
"num_tokens": 1387,
"size": 4243
} |
{-# OPTIONS --without-K #-}
open import HoTT.Base
open import HoTT.Identity
module HoTT.Homotopy where
open variables
private variable f g : A β B
-- Lemma 2.4.3
~-natural : (Ξ± : f ~ g) {x y : A} (p : x == y) β Ξ± x β ap g p == ap f p β Ξ± y
~-natural Ξ± {x} refl rewrite Ξ± x = refl
~-natural-id : (Ξ± : f ~ id) {x y : A} (p : x == y) β Ξ± x β p == ap f p β Ξ± y
~-natural-id Ξ± {x} refl rewrite Ξ± x = refl
-- Corollary 2.4.4
~-natural-comm : {f : A β A} (Ξ± : f ~ id) β Ξ± β f ~ ap f β Ξ±
~-natural-comm {f = f} Ξ± x = cancelα΅£ (Ξ± (f x) ββ ap-id (Ξ± x) β»ΒΉ β ~-natural Ξ± (Ξ± x))
module ~-Reasoning where
_~β¨_β©_ : (f : Ξ A P) {g h : Ξ A P} β f ~ g β g ~ h β f ~ h
x ~β¨ Ξ± β© Ξ² = Ξ± ββ Ξ²
infixr 2 _~β¨_β©_
_β : (f : Ξ A P) β f ~ f
_ β = reflβ
infix 3 _β
| {
"alphanum_fraction": 0.5066489362,
"avg_line_length": 25.9310344828,
"ext": "agda",
"hexsha": "292c830abb899876b30072a04e35ddcba3c72600",
"lang": "Agda",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "ef4d9fbb9cc0352657f1a6d0d3534d4c8a6fd508",
"max_forks_repo_licenses": [
"0BSD"
],
"max_forks_repo_name": "michaelforney/hott",
"max_forks_repo_path": "HoTT/Homotopy.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "ef4d9fbb9cc0352657f1a6d0d3534d4c8a6fd508",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"0BSD"
],
"max_issues_repo_name": "michaelforney/hott",
"max_issues_repo_path": "HoTT/Homotopy.agda",
"max_line_length": 84,
"max_stars_count": null,
"max_stars_repo_head_hexsha": "ef4d9fbb9cc0352657f1a6d0d3534d4c8a6fd508",
"max_stars_repo_licenses": [
"0BSD"
],
"max_stars_repo_name": "michaelforney/hott",
"max_stars_repo_path": "HoTT/Homotopy.agda",
"max_stars_repo_stars_event_max_datetime": null,
"max_stars_repo_stars_event_min_datetime": null,
"num_tokens": 349,
"size": 752
} |
module UniDB.Morph.Unit where
open import UniDB.Spec
--------------------------------------------------------------------------------
data Unit : MOR where
unit : {Ξ³ : Dom} β Unit Ξ³ Ξ³
instance
iUpUnit : Up Unit
_ββ {{iUpUnit}} unit = unit
_β_ {{iUpUnit}} unit Ξ΄ = unit
β-zero {{iUpUnit}} unit = refl
β-suc {{iUpUnit}} unit Ξ΄ = refl
iIdmUnit : Idm Unit
idm {{iIdmUnit}} _ = unit
iCompUnit : Comp Unit
_β_ {{iCompUnit}} unit unit = unit
iUpIdmUnit : UpIdm Unit
idm-ββ {{iUpIdmUnit}} = refl
module _ {T : STX} {{vrT : Vr T}} where
instance
iLkUnit : Lk T Unit
lk {{iLkUnit}} unit = vr {T = T}
iLkUpUnit : {{wkT : Wk T}} {{wkVrT : WkVr T}} β LkUp T Unit
lk-ββ-zero {{iLkUpUnit}} unit = refl
lk-ββ-suc {{iLkUpUnit}} unit i = sym (wkβ-vr {T = T} i)
iLkIdmUnit : LkIdm T Unit
lk-idm {{iLkIdmUnit}} i = refl
--------------------------------------------------------------------------------
| {
"alphanum_fraction": 0.4905263158,
"avg_line_length": 23.1707317073,
"ext": "agda",
"hexsha": "f78293244babd44fc98db8ae5dde1f4e22bd165f",
"lang": "Agda",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "7ae52205db44ad4f463882ba7e5082120fb76349",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "skeuchel/unidb-agda",
"max_forks_repo_path": "UniDB/Morph/Unit.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "7ae52205db44ad4f463882ba7e5082120fb76349",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "skeuchel/unidb-agda",
"max_issues_repo_path": "UniDB/Morph/Unit.agda",
"max_line_length": 80,
"max_stars_count": null,
"max_stars_repo_head_hexsha": "7ae52205db44ad4f463882ba7e5082120fb76349",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "skeuchel/unidb-agda",
"max_stars_repo_path": "UniDB/Morph/Unit.agda",
"max_stars_repo_stars_event_max_datetime": null,
"max_stars_repo_stars_event_min_datetime": null,
"num_tokens": 340,
"size": 950
} |
{-# OPTIONS --safe #-}
module Cubical.Categories.Functor.Base where
open import Cubical.Foundations.Prelude
open import Cubical.Data.Sigma
open import Cubical.Categories.Category
private
variable
βC βC' βD βD' : Level
record Functor (C : Category βC βC') (D : Category βD βD') :
Type (β-max (β-max βC βC') (β-max βD βD')) where
no-eta-equality
open Category
field
F-ob : C .ob β D .ob
F-hom : {x y : C .ob} β C [ x , y ] β D [ F-ob x , F-ob y ]
F-id : {x : C .ob} β F-hom (C .id) β‘ D .id {x = F-ob x}
F-seq : {x y z : C .ob} (f : C [ x , y ]) (g : C [ y , z ])
β F-hom (f ββ¨ C β© g) β‘ (F-hom f) ββ¨ D β© (F-hom g)
isFull = (x y : _) (F[f] : D [ F-ob x , F-ob y ]) β β[ f β C [ x , y ] ] F-hom f β‘ F[f]
isFaithful = (x y : _) (f g : C [ x , y ]) β F-hom f β‘ F-hom g β f β‘ g
isEssentiallySurj = (d : D .ob) β Ξ£[ c β C .ob ] CatIso D (F-ob c) d
private
variable
β β' : Level
C D E : Category β β'
open Category
open Functor
-- Helpful notation
-- action on objects
infix 30 _β
_β
_β
_β : (F : Functor C D)
β C .ob
β D .ob
_β
_β = F-ob
-- action on morphisms
infix 30 _βͺ_β« -- same infix level as on objects since these will never be used in the same context
_βͺ_β« : (F : Functor C D)
β β {x y}
β C [ x , y ]
β D [(F β
x β) , (F β
y β)]
_βͺ_β« = F-hom
-- Functor constructions
πβ¨_β© : β (C : Category β β') β Functor C C
πβ¨ C β© .F-ob x = x
πβ¨ C β© .F-hom f = f
πβ¨ C β© .F-id = refl
πβ¨ C β© .F-seq _ _ = refl
-- functor composition
funcComp : β (G : Functor D E) (F : Functor C D) β Functor C E
(funcComp G F) .F-ob c = G β
F β
c β β
(funcComp G F) .F-hom f = G βͺ F βͺ f β« β«
(funcComp G F) .F-id = cong (G βͺ_β«) (F .F-id) β G .F-id
(funcComp G F) .F-seq f g = cong (G βͺ_β«) (F .F-seq _ _) β G .F-seq _ _
infixr 30 funcComp
syntax funcComp G F = G βF F
_^opF : Functor C D β Functor (C ^op) (D ^op)
(F ^opF) .F-ob = F .F-ob
(F ^opF) .F-hom = F .F-hom
(F ^opF) .F-id = F .F-id
(F ^opF) .F-seq f g = F .F-seq g f
| {
"alphanum_fraction": 0.513540128,
"avg_line_length": 25.3875,
"ext": "agda",
"hexsha": "871dd6d72eba1d7958133aaa4c5dff4b3d7e0ff9",
"lang": "Agda",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "58f2d0dd07e51f8aa5b348a522691097b6695d1c",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "Seanpm2001-web/cubical",
"max_forks_repo_path": "Cubical/Categories/Functor/Base.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "58f2d0dd07e51f8aa5b348a522691097b6695d1c",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "Seanpm2001-web/cubical",
"max_issues_repo_path": "Cubical/Categories/Functor/Base.agda",
"max_line_length": 98,
"max_stars_count": 1,
"max_stars_repo_head_hexsha": "9acdecfa6437ec455568be4e5ff04849cc2bc13b",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "FernandoLarrain/cubical",
"max_stars_repo_path": "Cubical/Categories/Functor/Base.agda",
"max_stars_repo_stars_event_max_datetime": "2022-03-05T00:28:39.000Z",
"max_stars_repo_stars_event_min_datetime": "2022-03-05T00:28:39.000Z",
"num_tokens": 921,
"size": 2031
} |
module Prelude.Monoid where
open import Prelude.Function
open import Prelude.Maybe
open import Prelude.List
open import Prelude.Semiring
open import Prelude.Semigroup public
open import Prelude.Applicative
open import Prelude.Functor
open import Prelude.Equality
open import Prelude.Variables
record Monoid {a} (A : Set a) : Set a where
field
{{super}} : Semigroup A
mempty : A
open Monoid {{...}} public hiding (super)
{-# DISPLAY Monoid.mempty _ = mempty #-}
record Monoid/Laws {β} (A : Set β) : Set β where
field
overlap {{super}} : Monoid A
left-identity : (e : A) β mempty <> e β‘ e
right-identity : (e : A) β e <> mempty β‘ e
-- Using Semigroup/Laws instance creates inference problems
-- Maby we can do this in a better way?
monoid-assoc : (a b c : A) β (a <> b) <> c β‘ a <> (b <> c)
open Monoid/Laws {{...}} public hiding (super)
mconcat : β {a} {A : Set a} {{MonA : Monoid A}} β List A β A
mconcat = foldr _<>_ mempty
--- Instances ---
instance
MonoidList : β {a} {A : Set a} β Monoid (List A)
Monoid.super MonoidList = it
mempty {{MonoidList}} = []
MonoidFun : β {a b} {A : Set a} {B : A β Set b} {{_ : β {x} β Monoid (B x)}} β Monoid (β x β B x)
Monoid.super (MonoidFun {a} {b} {A} {B} {{SG}}) =
SemigroupFun {a} {b} {A} {B} {{Monoid.super SG}}
mempty {{MonoidFun}} _ = mempty
MonoidMaybe : β {a} {A : Set a} β Monoid (Maybe A)
Monoid.super MonoidMaybe = it
mempty {{MonoidMaybe}} = nothing
-- Temporarily here, better version comes in the list update
Monoid/LawsList : Monoid/Laws (List A)
Monoid/Laws.super Monoid/LawsList = it
left-identity {{Monoid/LawsList}} _ = refl
right-identity {{Monoid/LawsList}} [] = refl
right-identity {{Monoid/LawsList}} (x β· xs) =
cong (x β·_) (right-identity xs)
monoid-assoc {{Monoid/LawsList}} [] ys zs = refl
monoid-assoc {{Monoid/LawsList}} (x β· xs) ys zs =
cong (x β·_) (monoid-assoc xs ys zs)
record Sum {a} (A : Set a) : Set a where
constructor mkSum
field getSum : A
open Sum public
instance
SemigroupSum : β {a} {A : Set a} {{_ : Semiring A}} β Semigroup (Sum A)
getSum (_<>_ {{SemigroupSum}} x y) = getSum x + getSum y
MonoidSum : β {a} {A : Set a} {{_ : Semiring A}} β Monoid (Sum A)
Monoid.super MonoidSum = it
getSum (mempty {{MonoidSum}}) = zro
record Product {a} (A : Set a) : Set a where
constructor mkProduct
field getProduct : A
open Product public
instance
SemigroupProduct : β {a} {A : Set a} {{_ : Semiring A}} β Semigroup (Product A)
getProduct (_<>_ {{SemigroupProduct}} x y) = getProduct x * getProduct y
MonoidProduct : β {a} {A : Set a} {{_ : Semiring A}} β Monoid (Product A)
Monoid.super MonoidProduct = it
getProduct (mempty {{MonoidProduct}}) = one
record Const {a b} (A : Set a) (B : Set b) : Set a where
constructor mkConst
field getConst : A
open Const public
module _ {a b} {A : Set a} {{MonA : Monoid A}} where
instance
FunctorConst : Functor {a = b} (Const A)
getConst (fmap {{FunctorConst}} f x) = getConst x
ApplicativeConst : Applicative (Const A)
getConst (pure {{ApplicativeConst}} x) = mempty
getConst (_<*>_ {{ApplicativeConst}} wf wx) = getConst wf <> getConst wx
| {
"alphanum_fraction": 0.6341917468,
"avg_line_length": 29.3,
"ext": "agda",
"hexsha": "8cab9b38ab60c3a2800eef333c2fbf4d9403a3c8",
"lang": "Agda",
"max_forks_count": 24,
"max_forks_repo_forks_event_max_datetime": "2021-04-22T06:10:41.000Z",
"max_forks_repo_forks_event_min_datetime": "2015-03-12T18:03:45.000Z",
"max_forks_repo_head_hexsha": "158d299b1b365e186f00d8ef5b8c6844235ee267",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "L-TChen/agda-prelude",
"max_forks_repo_path": "src/Prelude/Monoid.agda",
"max_issues_count": 59,
"max_issues_repo_head_hexsha": "158d299b1b365e186f00d8ef5b8c6844235ee267",
"max_issues_repo_issues_event_max_datetime": "2022-01-14T07:32:36.000Z",
"max_issues_repo_issues_event_min_datetime": "2016-02-09T05:36:44.000Z",
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "L-TChen/agda-prelude",
"max_issues_repo_path": "src/Prelude/Monoid.agda",
"max_line_length": 99,
"max_stars_count": 111,
"max_stars_repo_head_hexsha": "158d299b1b365e186f00d8ef5b8c6844235ee267",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "L-TChen/agda-prelude",
"max_stars_repo_path": "src/Prelude/Monoid.agda",
"max_stars_repo_stars_event_max_datetime": "2022-02-12T23:29:26.000Z",
"max_stars_repo_stars_event_min_datetime": "2015-01-05T11:28:15.000Z",
"num_tokens": 1084,
"size": 3223
} |
{-# OPTIONS --without-K #-}
module T where
open import Level
open import Relation.Binary.PropositionalEquality
using (_β‘_; refl; sym; trans; cong; subst; module β‘-Reasoning)
open import Data.Nat using (β; _+_)
open import Data.Fin using (Fin)
data Exp : Set where
ONE : Exp
PLUS : Exp β Exp β Exp
val : Exp β β
val ONE = 1
val (PLUS eβ eβ) = val eβ + val eβ
data eqExp : Exp β Exp β Set where
idExp : {e : Exp} β eqExp e e
transExp : {eβ eβ eβ : Exp} β (eqExp eβ eβ) β (eqExp eβ eβ) β (eqExp eβ eβ)
valβ‘ : {eβ eβ : Exp} β (eqExp eβ eβ) β (val eβ β‘ val eβ)
valβ‘ idExp = refl
valβ‘ (transExp Ξ±β Ξ±β) = trans (valβ‘ Ξ±β) (valβ‘ Ξ±β)
trans-assoc : {A : Set} {x y z w : A} β (p : x β‘ y) (q : y β‘ z) (r : z β‘ w) β
trans (trans p q) r β‘ trans p (trans q r)
trans-assoc refl refl refl = refl
subst-trans : (P : β β Set) (p : (n : β) β P n) {eβ eβ eβ : Exp} β
(Ξ± : eqExp eβ eβ) (Ξ² : eqExp eβ eβ) (v : P (val eβ)) β
subst P (trans (valβ‘ Ξ±) (valβ‘ Ξ²)) v β‘
subst P (valβ‘ Ξ²) (subst P (valβ‘ Ξ±) v)
subst-trans P p idExp Ξ² v = refl
subst-trans P p (transExp Ξ±β Ξ±β) Ξ² v =
begin (subst P (trans (trans (valβ‘ Ξ±β) (valβ‘ Ξ±β)) (valβ‘ Ξ²)) v
β‘β¨ cong (Ξ» x β subst P x v)
(trans-assoc (valβ‘ Ξ±β) (valβ‘ Ξ±β) (valβ‘ Ξ²)) β©
subst P (trans (valβ‘ Ξ±β) (trans (valβ‘ Ξ±β) (valβ‘ Ξ²))) v
β‘β¨ refl β©
subst P (trans (valβ‘ Ξ±β) (valβ‘ (transExp Ξ±β Ξ²))) v
β‘β¨ subst-trans P p Ξ±β (transExp Ξ±β Ξ²) v β©
subst P (valβ‘ (transExp Ξ±β Ξ²)) (subst P (valβ‘ Ξ±β) v)
β‘β¨ refl β©
subst P (trans (valβ‘ Ξ±β) (valβ‘ Ξ²)) (subst P (valβ‘ Ξ±β) v)
β‘β¨ subst-trans P p Ξ±β Ξ² (subst P (valβ‘ Ξ±β) v) β©
subst P (valβ‘ Ξ²) (subst P (valβ‘ Ξ±β) (subst P (valβ‘ Ξ±β) v))
β‘β¨ cong (Ξ» x β subst P (valβ‘ Ξ²) x) (sym (subst-trans P p Ξ±β Ξ±β v)) β©
subst P (valβ‘ Ξ²) (subst P (trans (valβ‘ Ξ±β) (valβ‘ Ξ±β)) v)
β‘β¨ refl β©
subst P (valβ‘ Ξ²) (subst P (valβ‘ (transExp Ξ±β Ξ±β)) v) β)
where open β‘-Reasoning
pr : {P : β β Set} {p : (n : β) β P n} {eβ eβ : Exp} {Ξ± : eqExp eβ eβ} β
subst P (valβ‘ Ξ±) (p (val eβ)) β‘ p (val eβ)
pr {P} {p} {e} {.e} {idExp} = refl
pr {P} {p} {eβ} {eβ} {transExp {eβ = eβ} Ξ± Ξ²} =
begin (subst P (valβ‘ (transExp Ξ± Ξ²)) (p (val eβ))
β‘β¨ refl β©
subst P (trans (valβ‘ Ξ±) (valβ‘ Ξ²)) (p (val eβ))
β‘β¨ subst-trans P p Ξ± Ξ² (p (val eβ)) β©
subst P (valβ‘ Ξ²) (subst P (valβ‘ Ξ±) (p (val eβ)))
β‘β¨ cong (Ξ» x β subst P (valβ‘ Ξ²) x) (pr {P} {p} {eβ} {eβ} {Ξ±}) β©
subst P (valβ‘ Ξ²) (p (val eβ))
β‘β¨ pr {P} {p} {eβ} {eβ} {Ξ²} β©
p (val eβ) β)
where open β‘-Reasoning
| {
"alphanum_fraction": 0.4915824916,
"avg_line_length": 38.7391304348,
"ext": "agda",
"hexsha": "748581ee2fbf589898800b2383dba06650a18c59",
"lang": "Agda",
"max_forks_count": 3,
"max_forks_repo_forks_event_max_datetime": "2019-09-10T09:47:13.000Z",
"max_forks_repo_forks_event_min_datetime": "2016-05-29T01:56:33.000Z",
"max_forks_repo_head_hexsha": "003835484facfde0b770bc2b3d781b42b76184c1",
"max_forks_repo_licenses": [
"BSD-2-Clause"
],
"max_forks_repo_name": "JacquesCarette/pi-dual",
"max_forks_repo_path": "Univalence/Obsolete/T.agda",
"max_issues_count": 4,
"max_issues_repo_head_hexsha": "003835484facfde0b770bc2b3d781b42b76184c1",
"max_issues_repo_issues_event_max_datetime": "2021-10-29T20:41:23.000Z",
"max_issues_repo_issues_event_min_datetime": "2018-06-07T16:27:41.000Z",
"max_issues_repo_licenses": [
"BSD-2-Clause"
],
"max_issues_repo_name": "JacquesCarette/pi-dual",
"max_issues_repo_path": "Univalence/Obsolete/T.agda",
"max_line_length": 78,
"max_stars_count": 14,
"max_stars_repo_head_hexsha": "003835484facfde0b770bc2b3d781b42b76184c1",
"max_stars_repo_licenses": [
"BSD-2-Clause"
],
"max_stars_repo_name": "JacquesCarette/pi-dual",
"max_stars_repo_path": "Univalence/Obsolete/T.agda",
"max_stars_repo_stars_event_max_datetime": "2021-05-05T01:07:57.000Z",
"max_stars_repo_stars_event_min_datetime": "2015-08-18T21:40:15.000Z",
"num_tokens": 1186,
"size": 2673
} |
{-
This file contains:
- Some basic properties of Rijke finite types.
-}
{-# OPTIONS --safe #-}
module Cubical.Data.FinType.Properties where
open import Cubical.Foundations.Prelude
open import Cubical.Foundations.Isomorphism
open import Cubical.Foundations.Equiv
open import Cubical.Foundations.Equiv.Properties
open import Cubical.HITs.SetTruncation
open import Cubical.Data.Nat
open import Cubical.Data.FinSet
open import Cubical.Data.FinSet.Constructors
open import Cubical.Data.FinType.Base
private
variable
β β' : Level
n : β
X : Type β
Y : Type β'
EquivPresIsFinType : (n : β) β X β Y β isFinType n X β isFinType n Y
EquivPresIsFinType 0 e = EquivPresIsFinSet (isoToEquiv (setTruncIso (equivToIso e)))
EquivPresIsFinType (suc n) e (p , q) .fst = EquivPresIsFinType 0 e p
EquivPresIsFinType (suc n) e (p , q) .snd a b =
EquivPresIsFinType n (invEquiv (congEquiv (invEquiv e))) (q _ _)
isFinSetβisFinType : (n : β) β isFinSet X β isFinType n X
isFinSetβisFinType 0 p = EquivPresIsFinSet (invEquiv (setTruncIdempotentβ (isFinSetβisSet p))) p
isFinSetβisFinType (suc n) p .fst = isFinSetβisFinType 0 p
isFinSetβisFinType (suc n) p .snd a b = isFinSetβisFinType n (isFinSetβ‘ (_ , p) _ _)
isPathConnectedβisFinType0 : isContr β₯ X β₯β β isFinType 0 X
isPathConnectedβisFinType0 p = isContrβisFinSet p
| {
"alphanum_fraction": 0.7441685478,
"avg_line_length": 30.9069767442,
"ext": "agda",
"hexsha": "befeba15a6899449bba2ac710230efb970c2b9ae",
"lang": "Agda",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "58c0b83bb0fed0dc683f3d29b1709effe51c1689",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "thomas-lamiaux/cubical",
"max_forks_repo_path": "Cubical/Data/FinType/Properties.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "58c0b83bb0fed0dc683f3d29b1709effe51c1689",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "thomas-lamiaux/cubical",
"max_issues_repo_path": "Cubical/Data/FinType/Properties.agda",
"max_line_length": 96,
"max_stars_count": 1,
"max_stars_repo_head_hexsha": "58c0b83bb0fed0dc683f3d29b1709effe51c1689",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "thomas-lamiaux/cubical",
"max_stars_repo_path": "Cubical/Data/FinType/Properties.agda",
"max_stars_repo_stars_event_max_datetime": "2021-10-31T17:32:49.000Z",
"max_stars_repo_stars_event_min_datetime": "2021-10-31T17:32:49.000Z",
"num_tokens": 476,
"size": 1329
} |
{-# OPTIONS --universe-polymorphism #-}
module Categories.Monoidal.Braided where
open import Level
open import Level using (_β_)
open import Categories.Category
open import Categories.Bifunctor using (Bifunctor)
open import Categories.NaturalIsomorphism
open import Categories.NaturalTransformation using (_ββ_) renaming (_β‘_ to _β‘βΏ_)
open import Categories.Monoidal.Helpers
open import Categories.Monoidal.Braided.Helpers
open import Categories.Monoidal
record Braided {o β e} {C : Category o β e} (M : Monoidal C) : Set (o β β β e) where
private module C = Category C
private module M = Monoidal M
open C hiding (id; identityΛ‘; identityΚ³; assoc)
open M
open MonoidalHelperFunctors C β id
open BraidedHelperFunctors C β id
field
braid : NaturalIsomorphism xβy yβx
open Braiding identityΛ‘ identityΚ³ assoc braid
field
-- NB: Triangle is redundant, proof coming soon...
.hexagonβ : (Hexagon1SideB ββ (Hexagon1TopB ββ Hexagon1TopA)) β‘βΏ (Hexagon1BottomB ββ (Hexagon1BottomA ββ Hexagon1SideA))
.hexagonβ : (Hexagon2SideB ββ (Hexagon2TopB ββ Hexagon2TopA)) β‘βΏ (Hexagon2BottomB ββ (Hexagon2BottomA ββ Hexagon2SideA)) | {
"alphanum_fraction": 0.7519446845,
"avg_line_length": 33.0571428571,
"ext": "agda",
"hexsha": "2e714243fd3fc13c6d03b09a1d4a0a25dc89bc3c",
"lang": "Agda",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "e41aef56324a9f1f8cf3cd30b2db2f73e01066f2",
"max_forks_repo_licenses": [
"BSD-3-Clause"
],
"max_forks_repo_name": "p-pavel/categories",
"max_forks_repo_path": "Categories/Monoidal/Braided.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "e41aef56324a9f1f8cf3cd30b2db2f73e01066f2",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"BSD-3-Clause"
],
"max_issues_repo_name": "p-pavel/categories",
"max_issues_repo_path": "Categories/Monoidal/Braided.agda",
"max_line_length": 124,
"max_stars_count": 1,
"max_stars_repo_head_hexsha": "e41aef56324a9f1f8cf3cd30b2db2f73e01066f2",
"max_stars_repo_licenses": [
"BSD-3-Clause"
],
"max_stars_repo_name": "p-pavel/categories",
"max_stars_repo_path": "Categories/Monoidal/Braided.agda",
"max_stars_repo_stars_event_max_datetime": "2018-12-29T21:51:57.000Z",
"max_stars_repo_stars_event_min_datetime": "2018-12-29T21:51:57.000Z",
"num_tokens": 376,
"size": 1157
} |
module DaraisPhoas where
open import Agda.Primitive using (_β_)
module Prelude where
infixr 3 βπ π‘
infixl 5 _β¨_
infixr 20 _β·_
data πΉ : Set where
T : πΉ
F : πΉ
data _β¨_ {ββ ββ} (A : Set ββ) (B : Set ββ) : Set (ββ β ββ) where
Inl : A β A β¨ B
Inr : B β A β¨ B
syntax βπ π‘ A (Ξ» x β B) = β x β¦ A π π‘ B
data βπ π‘ {ββ ββ} (A : Set ββ) (B : A β Set ββ) : Set (ββ β ββ) where
β¨β_,_β© : β (x : A) β B x β β x β¦ A π π‘ B x
data β¬_β {β} (A : Set β) : Set β where
[] : β¬ A β
_β·_ : A β β¬ A β β β¬ A β
open Prelude
infixr 15 _β¨ββ©_
data type : Set where
β¨ββ© : type
_β¨ββ©_ : type β type β type
infixl 15 _β¨ββ©_
data exp-phoas (var : type β β¬ type β β Set) : β (Ξ : β¬ type β) (Ο : type) β Set where
Var : β {Ξ Ο}
(x : var Ο Ξ)
β exp-phoas var Ξ Ο
β¨Ξ»β© : β {Ξ Οβ Οβ}
(e : var Οβ (Οβ β· Ξ) β exp-phoas var (Οβ β· Ξ) Οβ)
β exp-phoas var Ξ (Οβ β¨ββ© Οβ)
_β¨ββ©_ : β {Ξ Οβ Οβ}
(eβ : exp-phoas var Ξ (Οβ β¨ββ© Οβ))
(eβ : exp-phoas var Ξ Οβ)
β exp-phoas var Ξ Οβ
infix 10 _β_
data _β_ {β} {A : Set β} (x : A) : β (xs : β¬ A β) β Set β where
Z : β {xs} β x β x β· xs
S : β {xβ² xs} β x β xs β x β xβ² β· xs
infix 10 _β’_
data _β’_ : β (Ξ : β¬ type β) (Ο : type) β Set where
Var : β {Ξ Ο}
(x : Ο β Ξ)
β Ξ β’ Ο
β¨Ξ»β© : β {Ξ Οβ Οβ}
(e : Οβ β· Ξ β’ Οβ)
β Ξ β’ Οβ β¨ββ© Οβ
_β¨ββ©_ : β {Ξ Οβ Οβ}
(eβ : Ξ β’ Οβ β¨ββ© Οβ)
(eβ : Ξ β’ Οβ)
β Ξ β’ Οβ
β¦_β§β : β {Ξ Ο} (e : exp-phoas _β_ Ξ Ο) β Ξ β’ Ο
β¦ Var x β§β = Var x
β¦ β¨Ξ»β© e β§β = β¨Ξ»β© β¦ e Z β§β
β¦ eβ β¨ββ© eβ β§β = β¦ eβ β§β β¨ββ© β¦ eβ β§β
β¦_β§β : β {Ξ Ο} (e : Ξ β’ Ο) β exp-phoas _β_ Ξ Ο
β¦ Var x β§β = Var x
β¦ β¨Ξ»β© e β§β = β¨Ξ»β© (Ξ» _ β β¦ e β§β)
β¦ eβ β¨ββ© eβ β§β = β¦ eβ β§β β¨ββ© β¦ eβ β§β
Ch : type
Ch = (β¨ββ© β¨ββ© β¨ββ©) β¨ββ© β¨ββ© β¨ββ© β¨ββ©
twoDB : [] β’ Ch
twoDB = β¨Ξ»β© (β¨Ξ»β© (Var (S Z) β¨ββ© (Var (S Z) β¨ββ© Var Z)))
twoPH : exp-phoas _β_ [] Ch
twoPH = β¨Ξ»β© (Ξ» f β β¨Ξ»β© (Ξ» x β Var f β¨ββ© (Var f β¨ββ© Var x)))
{-
/Users/wadler/sf/src/extra/DaraisPhoas.agda:82,9-60
β¨ββ© β¨ββ© β¨ββ© != β¨ββ© of type type
when checking that the expression
β¨Ξ»β© (Ξ» f β β¨Ξ»β© (Ξ» x β Var f β¨ββ© (Var f β¨ββ© Var x))) has type
exp-phoas _β_ [] Ch
-}
| {
"alphanum_fraction": 0.4388489209,
"avg_line_length": 22.9120879121,
"ext": "agda",
"hexsha": "b513d70d9a25a82492c0e5a024c9769f510f0993",
"lang": "Agda",
"max_forks_count": 304,
"max_forks_repo_forks_event_max_datetime": "2022-03-28T11:35:02.000Z",
"max_forks_repo_forks_event_min_datetime": "2018-07-16T18:24:59.000Z",
"max_forks_repo_head_hexsha": "8a2c2ace545092fd0e04bf5831ed458267f18ae4",
"max_forks_repo_licenses": [
"CC-BY-4.0"
],
"max_forks_repo_name": "manikdv/plfa.github.io",
"max_forks_repo_path": "extra/extra/DaraisPhoas.agda",
"max_issues_count": 323,
"max_issues_repo_head_hexsha": "8a2c2ace545092fd0e04bf5831ed458267f18ae4",
"max_issues_repo_issues_event_max_datetime": "2022-03-30T07:42:57.000Z",
"max_issues_repo_issues_event_min_datetime": "2018-07-05T22:34:34.000Z",
"max_issues_repo_licenses": [
"CC-BY-4.0"
],
"max_issues_repo_name": "manikdv/plfa.github.io",
"max_issues_repo_path": "extra/extra/DaraisPhoas.agda",
"max_line_length": 86,
"max_stars_count": 1003,
"max_stars_repo_head_hexsha": "8a2c2ace545092fd0e04bf5831ed458267f18ae4",
"max_stars_repo_licenses": [
"CC-BY-4.0"
],
"max_stars_repo_name": "manikdv/plfa.github.io",
"max_stars_repo_path": "extra/extra/DaraisPhoas.agda",
"max_stars_repo_stars_event_max_datetime": "2022-03-27T07:03:28.000Z",
"max_stars_repo_stars_event_min_datetime": "2018-07-05T18:15:14.000Z",
"num_tokens": 1221,
"size": 2085
} |
module All where
open import Prelude
open import T
open import SubstTheory
open import DynTheory
open import Progress
open import HT
open import Examples
open import Eq
open import DenotCommutes
| {
"alphanum_fraction": 0.8418367347,
"avg_line_length": 16.3333333333,
"ext": "agda",
"hexsha": "06383780fc7bb2802794d27643875873e98a68f1",
"lang": "Agda",
"max_forks_count": 3,
"max_forks_repo_forks_event_max_datetime": "2021-05-04T22:37:18.000Z",
"max_forks_repo_forks_event_min_datetime": "2015-04-26T11:39:14.000Z",
"max_forks_repo_head_hexsha": "7412725cf27873b2b23f7e411a236a97dd99ef91",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "msullivan/godels-t",
"max_forks_repo_path": "All.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "7412725cf27873b2b23f7e411a236a97dd99ef91",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "msullivan/godels-t",
"max_issues_repo_path": "All.agda",
"max_line_length": 25,
"max_stars_count": 4,
"max_stars_repo_head_hexsha": "7412725cf27873b2b23f7e411a236a97dd99ef91",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "msullivan/godels-t",
"max_stars_repo_path": "All.agda",
"max_stars_repo_stars_event_max_datetime": "2021-03-22T00:28:03.000Z",
"max_stars_repo_stars_event_min_datetime": "2016-12-25T01:52:57.000Z",
"num_tokens": 46,
"size": 196
} |
{-
Problem #53
Given premises:
(all x)[(F x) -> (some y)((F y) & (G x y))] justification = 1.0
Ultimate epistemic interests:
(all x)[(F x) -> (some y)(some z)((G x y) & (G y z))] interest = 1.0
-}
open import Prelude
postulate
U : Set
F : U β Set
G : U β U β Set
record Premise {x : U} (Fx : F x) : Set where
field
pY : U
pF : F pY
pG : G x pY
open Premise
record Conclusion {x : U} (Fx : F x) : Set where
field
cY : U
cZ : U
cGxy : G x cY
cGyz : G cY cZ
open Conclusion
premise = β x β (Fx : F x) β Premise Fx
conclusion = β x β (Fx : F x) β Conclusion Fx
proof1 : premise β conclusion
proof1 p x Fx =
record
{ cY = _
; cZ = _
; cGxy = pG p1
; cGyz = pG p2 }
where
p1 = p x Fx
p2 = p (pY p1) (pF p1)
{-
postulate
U : Set
F : U β Set
G : U β U β Set
β : β {a b} {A : Set a} (B : A β Set b) β Set (a β b)
β = Ξ£ _
premise = β x β F x β β Ξ» y β (F y Γ G x y)
conclusion = β x β F x β β Ξ» y β β Ξ» z β (G x y Γ G y z)
pY : premise β β x β F x β _
pY p x Fx = fst (p x Fx)
pF : premise β β x β F x β F y -- y is not in scope!
pF p x Fx = {!fst (snd (p x Fx))!}
pG : premise β β x β F x β _
pG p x Fx = {!snd (snd (p x Fx))!}
proof1 : premise β conclusion
proof1 p x Fx = y , z , Gxy , Gyz
where
y : U
y = {!!}
z : U
z = {!!}
Gxy : G x y
Gxy = {!!}
Gyz : G y z
Gyz = {!!}
-}
| {
"alphanum_fraction": 0.4759856631,
"avg_line_length": 16.6071428571,
"ext": "agda",
"hexsha": "605f96e99b470405a868ea63cce39e46beecc8bf",
"lang": "Agda",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "52e1cdbdee54d9a8eaee04ee518a0d7f61d25afb",
"max_forks_repo_licenses": [
"RSA-MD"
],
"max_forks_repo_name": "m0davis/oscar",
"max_forks_repo_path": "archive/lisp-revised/Problem53.agda",
"max_issues_count": 1,
"max_issues_repo_head_hexsha": "52e1cdbdee54d9a8eaee04ee518a0d7f61d25afb",
"max_issues_repo_issues_event_max_datetime": "2019-05-11T23:33:04.000Z",
"max_issues_repo_issues_event_min_datetime": "2019-04-29T00:35:04.000Z",
"max_issues_repo_licenses": [
"RSA-MD"
],
"max_issues_repo_name": "m0davis/oscar",
"max_issues_repo_path": "archive/lisp-revised/Problem53.agda",
"max_line_length": 75,
"max_stars_count": null,
"max_stars_repo_head_hexsha": "52e1cdbdee54d9a8eaee04ee518a0d7f61d25afb",
"max_stars_repo_licenses": [
"RSA-MD"
],
"max_stars_repo_name": "m0davis/oscar",
"max_stars_repo_path": "archive/lisp-revised/Problem53.agda",
"max_stars_repo_stars_event_max_datetime": null,
"max_stars_repo_stars_event_min_datetime": null,
"num_tokens": 616,
"size": 1395
} |
module Issue384 where
postulate
D : (A : Set) β A β Set
data I : Set where
i : I
Dβ² : (A : Set) β A β I β Set
Dβ² A x i = D A x
postulate
Q : (A : Set) β A β Set
q : β j A (x : A) β Dβ² A x j β Q A x
A : Set
x : A
d : D A x
P : (A : Set) β A β Set
p : P (Q _ _) (q _ _ _ d)
| {
"alphanum_fraction": 0.430976431,
"avg_line_length": 12.9130434783,
"ext": "agda",
"hexsha": "c5457a466043c43acc5f8e1389d8905f289cc53d",
"lang": "Agda",
"max_forks_count": 371,
"max_forks_repo_forks_event_max_datetime": "2022-03-30T19:00:30.000Z",
"max_forks_repo_forks_event_min_datetime": "2015-01-03T14:04:08.000Z",
"max_forks_repo_head_hexsha": "231d6ad8e77b67ff8c4b1cb35a6c31ccd988c3e9",
"max_forks_repo_licenses": [
"BSD-3-Clause"
],
"max_forks_repo_name": "Agda-zh/agda",
"max_forks_repo_path": "test/Succeed/Issue384.agda",
"max_issues_count": 4066,
"max_issues_repo_head_hexsha": "ed8ac6f4062ea8a20fa0f62d5db82d4e68278338",
"max_issues_repo_issues_event_max_datetime": "2022-03-31T21:14:49.000Z",
"max_issues_repo_issues_event_min_datetime": "2015-01-10T11:24:51.000Z",
"max_issues_repo_licenses": [
"BSD-3-Clause"
],
"max_issues_repo_name": "shlevy/agda",
"max_issues_repo_path": "test/Succeed/Issue384.agda",
"max_line_length": 38,
"max_stars_count": 1989,
"max_stars_repo_head_hexsha": "ed8ac6f4062ea8a20fa0f62d5db82d4e68278338",
"max_stars_repo_licenses": [
"BSD-3-Clause"
],
"max_stars_repo_name": "shlevy/agda",
"max_stars_repo_path": "test/Succeed/Issue384.agda",
"max_stars_repo_stars_event_max_datetime": "2022-03-30T18:20:48.000Z",
"max_stars_repo_stars_event_min_datetime": "2015-01-09T23:51:16.000Z",
"num_tokens": 141,
"size": 297
} |
module Issue168 where
postulate X : Set
open import Issue168b
open Membership X
postulate
P : Nat β Set
lemma : β n β P (id n)
foo : P zero
foo = lemma _
| {
"alphanum_fraction": 0.6687116564,
"avg_line_length": 10.8666666667,
"ext": "agda",
"hexsha": "442c2d9fbfd5c29b88734d432c3ced70a796a4de",
"lang": "Agda",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "aa10ae6a29dc79964fe9dec2de07b9df28b61ed5",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "asr/agda-kanso",
"max_forks_repo_path": "test/succeed/Issue168.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "aa10ae6a29dc79964fe9dec2de07b9df28b61ed5",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "asr/agda-kanso",
"max_issues_repo_path": "test/succeed/Issue168.agda",
"max_line_length": 24,
"max_stars_count": null,
"max_stars_repo_head_hexsha": "aa10ae6a29dc79964fe9dec2de07b9df28b61ed5",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "asr/agda-kanso",
"max_stars_repo_path": "test/succeed/Issue168.agda",
"max_stars_repo_stars_event_max_datetime": null,
"max_stars_repo_stars_event_min_datetime": null,
"num_tokens": 52,
"size": 163
} |
------------------------------------------------------------------------
-- The Agda standard library
--
-- List Literals
------------------------------------------------------------------------
{-# OPTIONS --without-K --safe #-}
module Data.List.Literals where
open import Agda.Builtin.FromString
open import Data.Unit
open import Agda.Builtin.Char
open import Agda.Builtin.List
open import Data.String.Base using (toList)
isString : IsString (List Char)
isString = record
{ Constraint = Ξ» _ β β€
; fromString = Ξ» s β toList s
}
| {
"alphanum_fraction": 0.5250463822,
"avg_line_length": 24.5,
"ext": "agda",
"hexsha": "7172cec21dcc1b24242a08fb00774a8f5b053bd8",
"lang": "Agda",
"max_forks_count": 1,
"max_forks_repo_forks_event_max_datetime": "2021-11-04T06:54:45.000Z",
"max_forks_repo_forks_event_min_datetime": "2021-11-04T06:54:45.000Z",
"max_forks_repo_head_hexsha": "0debb886eb5dbcd38dbeebd04b34cf9d9c5e0e71",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "omega12345/agda-mode",
"max_forks_repo_path": "test/asset/agda-stdlib-1.0/Data/List/Literals.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "0debb886eb5dbcd38dbeebd04b34cf9d9c5e0e71",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "omega12345/agda-mode",
"max_issues_repo_path": "test/asset/agda-stdlib-1.0/Data/List/Literals.agda",
"max_line_length": 72,
"max_stars_count": 5,
"max_stars_repo_head_hexsha": "0debb886eb5dbcd38dbeebd04b34cf9d9c5e0e71",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "omega12345/agda-mode",
"max_stars_repo_path": "test/asset/agda-stdlib-1.0/Data/List/Literals.agda",
"max_stars_repo_stars_event_max_datetime": "2020-10-10T21:41:32.000Z",
"max_stars_repo_stars_event_min_datetime": "2020-10-07T12:07:53.000Z",
"num_tokens": 109,
"size": 539
} |
------------------------------------------------------------------------------
-- The relation of divisibility on partial natural numbers
------------------------------------------------------------------------------
{-# OPTIONS --exact-split #-}
{-# OPTIONS --no-sized-types #-}
{-# OPTIONS --no-universe-polymorphism #-}
{-# OPTIONS --without-K #-}
module FOTC.Data.Nat.Divisibility.By0 where
open import FOTC.Base
open import FOTC.Data.Nat
infix 4 _β£_
------------------------------------------------------------------------------
-- The relation of divisibility (the symbol is '\mid' not '|')
--
-- It seems there is not agreement about if 0β£0:
--
-- Hardy and Wright 1975, p. 1: 0β€0
--
-- Knuth 1977, p. 40: 0β€0
--
-- Agda standard libraryΒ 0.8.1: 0|0
--
-- Coq 8.4pl4: 0β£0
--
-- Isabelle2014: 0β£0
-- In our definition 0β£0, which is used to prove properties of the gcd
-- as it is in GHC β₯ 7.2.1, where gcd 0 0 = 0 (see
-- http://hackage.haskell.org/trac/ghc/ticket/3304).
-- Note that @k@ should be a total natural number.
_β£_ : D β D β Set
m β£ n = β[ k ] N k β§ n β‘ k * m
{-# ATP definition _β£_ #-}
------------------------------------------------------------------------------
-- References:
--
-- Hardy, G. H. and Wright, E. M. (1975). An Introduction to the
-- Theory of Numbers. 4th ed. Oxford University Press.
--
-- Knuth, Donald E. (1997). The Art of Computer Programming. 3rd
-- ed. Vol. 1. Fundamental Algorithms. Addison-Wesley Professional.
| {
"alphanum_fraction": 0.497671324,
"avg_line_length": 30.6734693878,
"ext": "agda",
"hexsha": "d6f1f6abcf1d77a73b4c325d1211709bcc6474c5",
"lang": "Agda",
"max_forks_count": 3,
"max_forks_repo_forks_event_max_datetime": "2018-03-14T08:50:00.000Z",
"max_forks_repo_forks_event_min_datetime": "2016-09-19T14:18:30.000Z",
"max_forks_repo_head_hexsha": "2fc9f2b81052a2e0822669f02036c5750371b72d",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "asr/fotc",
"max_forks_repo_path": "src/fot/FOTC/Data/Nat/Divisibility/By0.agda",
"max_issues_count": 2,
"max_issues_repo_head_hexsha": "2fc9f2b81052a2e0822669f02036c5750371b72d",
"max_issues_repo_issues_event_max_datetime": "2017-01-01T14:34:26.000Z",
"max_issues_repo_issues_event_min_datetime": "2016-10-12T17:28:16.000Z",
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "asr/fotc",
"max_issues_repo_path": "src/fot/FOTC/Data/Nat/Divisibility/By0.agda",
"max_line_length": 78,
"max_stars_count": 11,
"max_stars_repo_head_hexsha": "2fc9f2b81052a2e0822669f02036c5750371b72d",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "asr/fotc",
"max_stars_repo_path": "src/fot/FOTC/Data/Nat/Divisibility/By0.agda",
"max_stars_repo_stars_event_max_datetime": "2021-09-12T16:09:54.000Z",
"max_stars_repo_stars_event_min_datetime": "2015-09-03T20:53:42.000Z",
"num_tokens": 405,
"size": 1503
} |
------------------------------------------------------------------------
-- Compiler correctness
------------------------------------------------------------------------
{-# OPTIONS --cubical --sized-types #-}
module Lambda.Partiality-monad.Inductive.Compiler-correctness where
open import Equality.Propositional.Cubical
open import Prelude hiding (β₯)
open import Bijection equality-with-J using (_β_)
open import Maybe equality-with-J as Maybe
open import Monad equality-with-J
open import Vec.Function equality-with-J
open import Partiality-monad.Inductive
open import Partiality-monad.Inductive.Monad
open import Lambda.Compiler
open import Lambda.Partiality-monad.Inductive.Interpreter
open import Lambda.Partiality-monad.Inductive.Virtual-machine
open import Lambda.Syntax
open import Lambda.Virtual-machine
private
module C = Closure Code
module T = Closure Tm
-- Compiler correctness.
mutual
β¦β§-correct :
β {n} t {Ο : T.Env n} {c s} {k : β β T.Value β M C.Value} {n} β
(β v β steps β¨ c , val (comp-val v) β· s , comp-env Ο β© β³[ n ]
Ξ» n β run (k n v)) β
steps β¨ comp t c , s , comp-env Ο β© β³[ n ]
Ξ» n β run (β¦ t β§β² Ο n >>= k n)
β¦β§-correct (con i) {Ο} {c} {s} {k} hyp =
steps β¨ con i β· c , s , comp-env Ο β© β³β¨ stepβ β©
steps β¨ c , val (comp-val (T.con i)) β· s , comp-env Ο β© β³β¨ hyp (T.con i) β©
(Ξ» n β run (k n (T.con i))) β‘β¨ sym now->>= β©β³
(Ξ» n β run (β¦ con i β§β² Ο n >>= k n)) ββ³
β¦β§-correct (var x) {Ο} {c} {s} {k} hyp =
steps β¨ var x β· c , s , comp-env Ο β© β³β¨ stepβ β©
steps β¨ c , val (comp-val (Ο x)) β· s , comp-env Ο β© β³β¨ hyp (Ο x) β©
(Ξ» n β run (k n (Ο x))) β‘β¨ sym now->>= β©β³
(Ξ» n β run (β¦ var x β§β² Ο n >>= k n)) ββ³
β¦β§-correct (Ζ t) {Ο} {c} {s} {k} hyp =
steps β¨ clo (comp t (ret β· [])) β· c , s , comp-env Ο β© β³β¨ stepβ β©
steps β¨ c , val (comp-val (T.Ζ t Ο)) β· s , comp-env Ο β© β³β¨ hyp (T.Ζ t Ο) β©
(Ξ» n β run (k n (T.Ζ t Ο))) β‘β¨ sym now->>= β©β³
(Ξ» n β run (β¦ Ζ t β§β² Ο n >>= k n)) ββ³
β¦β§-correct (tβ Β· tβ) {Ο} {c} {s} {k} {n} hyp =
steps β¨ comp tβ (comp tβ (app β· c)) , s , comp-env Ο β© β³β¨ (β¦β§-correct tβ {n = n} Ξ» vβ β β¦β§-correct tβ Ξ» vβ β β-correct vβ vβ hyp) β©
(Ξ» n β run (β¦ tβ β§β² Ο n >>= Ξ» vβ β
β¦ tβ β§β² Ο n >>= Ξ» vβ β
(vβ β vβ) n >>= k n)) β‘β¨ cong (Ξ» f β run (β¦ tβ β§β² Ο n >>= f))
(β¨extβ© Ξ» vβ β Monad.associativity tr (β¦ tβ β§β² Ο n) _ _) β©β³
(Ξ» n β run (β¦ tβ β§β² Ο n >>= Ξ» vβ β
(β¦ tβ β§β² Ο n >>= Ξ» vβ β (vβ β vβ) n) >>= k n)) β‘β¨ cong MaybeT.run $ Monad.associativity tr (β¦ tβ β§β² Ο n) _ _ β©β³
(Ξ» n β run (β¦ tβ Β· tβ β§β² Ο n >>= k n)) ββ³
where
tr = Monad-transformer.transform (Maybe.monad-transformer ext)
β-correct :
β {n} vβ vβ {Ο : T.Env n} {c s} {k : β β T.Value β M C.Value} {n} β
(β v β steps β¨ c , val (comp-val v) β· s , comp-env Ο β© β³[ n ]
Ξ» n β run (k n v)) β
steps β¨ app β· c
, val (comp-val vβ) β· val (comp-val vβ) β· s
, comp-env Ο
β© β³[ n ]
Ξ» n β run ((vβ β vβ) n >>= k n)
β-correct (T.con i) vβ {Ο} {c} {s} {k} hyp =
steps β¨ app β· c
, val (comp-val vβ) β· val (C.con i) β· s
, comp-env Ο
β© β³β¨β©
const (run fail) β‘β¨ sym now->>= β©β³
(Ξ» n β run ((T.con i β vβ) n >>= k n)) ββ³
β-correct (T.Ζ tβ Οβ) vβ {Ο} {c} {s} {k} {zero} hyp =
steps β¨ app β· c
, val (comp-val vβ) β· val (comp-val (T.Ζ tβ Οβ)) β· s
, comp-env Ο
β© β‘β¨ refl β©β³
const never β‘β¨ sym never->>= β©β³
const (never >>= _) β‘β¨ cong (_>>= maybe (MaybeT.run β k 0) (return nothing) β¦ (_ β₯ β _)) (sym never->>=) β©β³
(Ξ» n β run ((T.Ζ tβ Οβ β vβ) n >>= k n)) ββ³
β-correct (T.Ζ tβ Οβ) vβ {Ο} {c} {s} {k} {suc n} hyp = later (
steps β¨ app β· c
, val (comp-val vβ) β·
val (comp-val (T.Ζ tβ Οβ)) β· s
, comp-env Ο
β© β suc β³β¨β©
steps β¨ comp tβ (ret β· [])
, ret c (comp-env Ο) β· s
, cons (comp-val vβ) (comp-env Οβ)
β© ββ‘β¨ (Ξ» n β cong (Ξ» Οβ² β steps β¨ comp tβ (ret β· []) , ret c (comp-env Ο) β· s , Οβ² β© n) $
sym comp-cons) β©β³
steps β¨ comp tβ (ret β· [])
, ret c (comp-env Ο) β· s
, comp-env (cons vβ Οβ)
β© β³β¨ (β¦β§-correct tβ {n = n} Ξ» v β
steps β¨ ret β· []
, val (comp-val v) β· ret c (comp-env Ο) β· s
, comp-env (cons vβ Οβ)
β© β³β¨ stepβ β©
steps β¨ c , val (comp-val v) β· s , comp-env Ο β© β³β¨ hyp v β©
(Ξ» n β run (k n v)) β³β¨ stepβ β©
(Ξ» n β run (k (suc n) v)) ββ³) β©
(Ξ» n β run (β¦ tβ β§β² (cons vβ Οβ) n >>= k (suc n))) β³β¨β©
(Ξ» n β run ((T.Ζ tβ Οβ β vβ) (suc n) >>= k (suc n))) ββ³)
-- Note that the equality that is used here is syntactic.
correct :
β t β
wrap (exec β¨ comp t [] , [] , nil β©) β‘
(β¦ t β§ nil >>= Ξ» v β return (comp-val v))
correct t =
wrap (exec β¨ comp t [] , [] , nil β©) β‘β¨ cong (Ξ» Ο β wrap (exec β¨ comp t [] , [] , Ο β©)) $ sym comp-nil β©
wrap (exec β¨ comp t [] , [] , comp-env nil β©) β‘β¨β©
wrap (β¨ (stepsΛ’ β¨ comp t [] , [] , comp-env nil β©)) β‘β¨ cong wrap (β³ββ¨β‘β¨ 0 $ β¦β§-correct t Ξ» v β
const (MaybeT.run (return (comp-val v))) ββ³) β©
wrap (β¨ (β¦ t β§Λ’ nil >>=Λ’ Ξ» v β
constΛ’ (MaybeT.run (return (comp-val v))))) β‘β¨ cong (Ξ» s β wrap (β¨ s))
(_β_.to equality-characterisation-increasing (Ξ» _ β refl)) β©
wrap (β¨ (maybe (Ξ» v β MaybeT.run (return (comp-val v)))
(return nothing)
β-inc
β¦ t β§Λ’ nil)) β‘β¨ cong wrap (sym β¨->>=) β©β
(β¦ t β§ nil >>= Ξ» v β return (comp-val v)) β
| {
"alphanum_fraction": 0.3845448992,
"avg_line_length": 41.7070063694,
"ext": "agda",
"hexsha": "8dfe87fc08411a5b0c5a3692b3f5d2252a464a96",
"lang": "Agda",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "f69749280969f9093e5e13884c6feb0ad2506eae",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "nad/partiality-monad",
"max_forks_repo_path": "src/Lambda/Partiality-monad/Inductive/Compiler-correctness.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "f69749280969f9093e5e13884c6feb0ad2506eae",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "nad/partiality-monad",
"max_issues_repo_path": "src/Lambda/Partiality-monad/Inductive/Compiler-correctness.agda",
"max_line_length": 145,
"max_stars_count": 2,
"max_stars_repo_head_hexsha": "f69749280969f9093e5e13884c6feb0ad2506eae",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "nad/partiality-monad",
"max_stars_repo_path": "src/Lambda/Partiality-monad/Inductive/Compiler-correctness.agda",
"max_stars_repo_stars_event_max_datetime": "2020-07-03T08:56:08.000Z",
"max_stars_repo_stars_event_min_datetime": "2020-05-21T22:59:18.000Z",
"num_tokens": 2416,
"size": 6548
} |
module BHeap.Properties {A : Set}(_β€_ : A β A β Set) where
open import Bound.Lower A
open import Bound.Lower.Order _β€_
open import BHeap _β€_
open import Data.List
open import Data.Nat
open import Data.Sum
open import Nat.Sum
open import List.Permutation.Base A
open import List.Permutation.Base.Concatenation A
open import List.Permutation.Base.Equivalence A
open import List.Properties A
open import Relation.Binary.Core
open import Relation.Binary.PropositionalEquality
lemma-merge-lf : {b : Bound}(totβ€ : Total _β€_)(h : BHeap b) β merge totβ€ h lf β‘ h
lemma-merge-lf _ lf = refl
lemma-merge-lf _ (nd bβ€x l r) = refl
lemma-merge# : {b : Bound}(totβ€ : Total _β€_)(l r : BHeap b) β # (merge totβ€ l r) β‘ # l + # r
lemma-merge# _ lf r = refl
lemma-merge# totβ€ l lf rewrite lemma-merge-lf totβ€ l | +id (# l) = refl
lemma-merge# totβ€ (nd {x = y} xβ€y l r) (nd {x = y'} xβ€y' l' r')
with totβ€ y y'
... | injβ yβ€y' rewrite lemma-merge# totβ€ l r = refl
... | injβ y'β€y rewrite lemma-merge# totβ€ l' r' | +assoc (# l + # r) (# l' + # r') = refl
lemma-mergeβ€β² : {b : Bound}{x : A}(totβ€ : Total _β€_)(bβ€x : LeB b (val x))(l r : BHeap (val x)) β suc (# (merge totβ€ l r)) β€β² # (nd bβ€x l r)
lemma-mergeβ€β² totβ€ bβ€x l r rewrite lemma-merge# totβ€ l r = β€β²-refl
lemma-mergeβΌ : {b : Bound}(totβ€ : Total _β€_)(l r : BHeap b) β flatten (merge totβ€ l r) βΌ (flatten l ++ flatten r)
lemma-mergeβΌ _ lf r = reflβΌ
lemma-mergeβΌ totβ€ l lf rewrite lemma-merge-lf totβ€ l | ++id (flatten l) = reflβΌ
lemma-mergeβΌ totβ€ (nd {x = y} bβ€x l r) (nd {x = y'} bβ€y' l' r')
with totβ€ y y'
... | injβ yβ€y' = lemma++βΌr (βΌx /head /head (lemma-mergeβΌ totβ€ l r))
... | injβ y'β€y = transβΌ (lemma++βΌl {xs = y' β· (y β· flatten l ++ flatten r)} (lemma-mergeβΌ totβ€ l' r')) (βΌx /head (lemma++/ {xs = y β· flatten l ++ flatten r}) reflβΌ)
| {
"alphanum_fraction": 0.6128133705,
"avg_line_length": 46.0256410256,
"ext": "agda",
"hexsha": "33f3a49df229bde81e36210219064c5eb40fa071",
"lang": "Agda",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "b8d428bccbdd1b13613e8f6ead6c81a8f9298399",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "bgbianchi/sorting",
"max_forks_repo_path": "agda/BHeap/Properties.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "b8d428bccbdd1b13613e8f6ead6c81a8f9298399",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "bgbianchi/sorting",
"max_issues_repo_path": "agda/BHeap/Properties.agda",
"max_line_length": 165,
"max_stars_count": 6,
"max_stars_repo_head_hexsha": "b8d428bccbdd1b13613e8f6ead6c81a8f9298399",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "bgbianchi/sorting",
"max_stars_repo_path": "agda/BHeap/Properties.agda",
"max_stars_repo_stars_event_max_datetime": "2021-08-24T22:11:15.000Z",
"max_stars_repo_stars_event_min_datetime": "2015-05-21T12:50:35.000Z",
"num_tokens": 731,
"size": 1795
} |
-- Andreas, 2012-10-30 Sections
-- Reported by guillaume.brunerie, Oct 24 2012
module Issue735 where
import Common.Level
open import Common.Prelude using (Nat; zero; suc)
{- I often want to use something like sections in Coq. I usually use
parametrized modules but this has at least two issues that Coq does
not have:
1) I need to give a name to the module, and there is often no
meaningful name to be given
2) It exports the module, so I cannot define a module in another file
with the same name
I guess I can workaround 2) by declaring the module private, but this
will mean that everything will be indented further (again) and I
really want to avoid that.
I think this can easily be fixed by adding a kind of anonymous
modules. An anonymous module would be declared by naming it `_`, and
the following code
module _ params where
declarations
would be translated to:
private
module Fresh params where
declarations
open Fresh public
where Fresh is a new name. -}
-- Andreas: this translation is not necessary, because Agda
-- has a concept of sections internally (in Abstract syntax).
-- However, the translation and the actual implementation should
-- have the same semantics, except that a name 'Fresh' is never generated.
-- An empty section with no parameters
module _ where
-- A section with a non-hidden parameter
module _ {a} (A : Set a) where
data List : Set a where
[] : List
_β·_ : (x : A) (xs : List) β List
-- A section with all hidden parameters
module _ {a} {A : Set a} where
_++_ : List A β List A β List A
[] ++ ys = ys
(x β· xs) ++ ys = x β· (xs ++ ys)
module _ (default : A) where
head : List A β A
head [] = default
head (x β· _) = x
test : List Nat
test = head 1 [] β· ((2 β· []) ++ (3 β· []))
| {
"alphanum_fraction": 0.686285397,
"avg_line_length": 24.6712328767,
"ext": "agda",
"hexsha": "91b4680ba4a294310f12cdad167339f664efa34a",
"lang": "Agda",
"max_forks_count": 371,
"max_forks_repo_forks_event_max_datetime": "2022-03-30T19:00:30.000Z",
"max_forks_repo_forks_event_min_datetime": "2015-01-03T14:04:08.000Z",
"max_forks_repo_head_hexsha": "231d6ad8e77b67ff8c4b1cb35a6c31ccd988c3e9",
"max_forks_repo_licenses": [
"BSD-3-Clause"
],
"max_forks_repo_name": "Agda-zh/agda",
"max_forks_repo_path": "test/Succeed/Issue735.agda",
"max_issues_count": 4066,
"max_issues_repo_head_hexsha": "ed8ac6f4062ea8a20fa0f62d5db82d4e68278338",
"max_issues_repo_issues_event_max_datetime": "2022-03-31T21:14:49.000Z",
"max_issues_repo_issues_event_min_datetime": "2015-01-10T11:24:51.000Z",
"max_issues_repo_licenses": [
"BSD-3-Clause"
],
"max_issues_repo_name": "shlevy/agda",
"max_issues_repo_path": "test/Succeed/Issue735.agda",
"max_line_length": 74,
"max_stars_count": 1989,
"max_stars_repo_head_hexsha": "ed8ac6f4062ea8a20fa0f62d5db82d4e68278338",
"max_stars_repo_licenses": [
"BSD-3-Clause"
],
"max_stars_repo_name": "shlevy/agda",
"max_stars_repo_path": "test/Succeed/Issue735.agda",
"max_stars_repo_stars_event_max_datetime": "2022-03-30T18:20:48.000Z",
"max_stars_repo_stars_event_min_datetime": "2015-01-09T23:51:16.000Z",
"num_tokens": 488,
"size": 1801
} |
module ImpossiblePattern where
f : ?
f (_ _) = ?
| {
"alphanum_fraction": 0.6153846154,
"avg_line_length": 7.4285714286,
"ext": "agda",
"hexsha": "c2065e84749a61672340e4bd0904f03a971f3f08",
"lang": "Agda",
"max_forks_count": 1,
"max_forks_repo_forks_event_max_datetime": "2019-03-05T20:02:38.000Z",
"max_forks_repo_forks_event_min_datetime": "2019-03-05T20:02:38.000Z",
"max_forks_repo_head_hexsha": "6043e77e4a72518711f5f808fb4eb593cbf0bb7c",
"max_forks_repo_licenses": [
"BSD-3-Clause"
],
"max_forks_repo_name": "alhassy/agda",
"max_forks_repo_path": "test/bugs/ImpossiblePattern.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "6043e77e4a72518711f5f808fb4eb593cbf0bb7c",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"BSD-3-Clause"
],
"max_issues_repo_name": "alhassy/agda",
"max_issues_repo_path": "test/bugs/ImpossiblePattern.agda",
"max_line_length": 30,
"max_stars_count": 3,
"max_stars_repo_head_hexsha": "6043e77e4a72518711f5f808fb4eb593cbf0bb7c",
"max_stars_repo_licenses": [
"BSD-3-Clause"
],
"max_stars_repo_name": "alhassy/agda",
"max_stars_repo_path": "test/bugs/ImpossiblePattern.agda",
"max_stars_repo_stars_event_max_datetime": "2015-12-07T20:14:00.000Z",
"max_stars_repo_stars_event_min_datetime": "2015-03-28T14:51:03.000Z",
"num_tokens": 14,
"size": 52
} |
open import Issue2959.M Set
r : R
r = ?
| {
"alphanum_fraction": 0.6341463415,
"avg_line_length": 8.2,
"ext": "agda",
"hexsha": "3666f9520a710b3afbf1c2e71c5e51dd3f793232",
"lang": "Agda",
"max_forks_count": 371,
"max_forks_repo_forks_event_max_datetime": "2022-03-30T19:00:30.000Z",
"max_forks_repo_forks_event_min_datetime": "2015-01-03T14:04:08.000Z",
"max_forks_repo_head_hexsha": "7f58030124fa99dfbf8db376659416f3ad8384de",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "cruhland/agda",
"max_forks_repo_path": "test/interaction/Issue2959.agda",
"max_issues_count": 4066,
"max_issues_repo_head_hexsha": "7f58030124fa99dfbf8db376659416f3ad8384de",
"max_issues_repo_issues_event_max_datetime": "2022-03-31T21:14:49.000Z",
"max_issues_repo_issues_event_min_datetime": "2015-01-10T11:24:51.000Z",
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "cruhland/agda",
"max_issues_repo_path": "test/interaction/Issue2959.agda",
"max_line_length": 27,
"max_stars_count": 1989,
"max_stars_repo_head_hexsha": "7f58030124fa99dfbf8db376659416f3ad8384de",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "cruhland/agda",
"max_stars_repo_path": "test/interaction/Issue2959.agda",
"max_stars_repo_stars_event_max_datetime": "2022-03-30T18:20:48.000Z",
"max_stars_repo_stars_event_min_datetime": "2015-01-09T23:51:16.000Z",
"num_tokens": 15,
"size": 41
} |
------------------------------------------------------------------------------
-- Example of a nested recursive function using the Agda standard
-- library
------------------------------------------------------------------------------
{-# OPTIONS --exact-split #-}
{-# OPTIONS --no-sized-types #-}
{-# OPTIONS --no-universe-polymorphism #-}
{-# OPTIONS --without-K #-}
-- From: Ana Bove and Venanzio Capretta. Nested general recursion and
-- partiality in type theory. vol 2152 LNCS. 2001.
module FOT.FOTC.Program.Nest.NestSL where
open import Data.Nat renaming (suc to succ)
open import Relation.Binary.PropositionalEquality
------------------------------------------------------------------------------
{-# TERMINATING #-}
nest : β β β
nest 0 = 0
nest (succ n) = nest (nest n)
{-# TERMINATING #-}
nest-xβ‘0 : β n β nest n β‘ zero
nest-xβ‘0 zero = refl
nest-xβ‘0 (succ n) = nest-xβ‘0 (nest n)
| {
"alphanum_fraction": 0.4761904762,
"avg_line_length": 31.5,
"ext": "agda",
"hexsha": "e2e9d5591910b897db1f4b5a07f80b4908e30a86",
"lang": "Agda",
"max_forks_count": 3,
"max_forks_repo_forks_event_max_datetime": "2018-03-14T08:50:00.000Z",
"max_forks_repo_forks_event_min_datetime": "2016-09-19T14:18:30.000Z",
"max_forks_repo_head_hexsha": "2fc9f2b81052a2e0822669f02036c5750371b72d",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "asr/fotc",
"max_forks_repo_path": "notes/FOT/FOTC/Program/Nest/NestSL.agda",
"max_issues_count": 2,
"max_issues_repo_head_hexsha": "2fc9f2b81052a2e0822669f02036c5750371b72d",
"max_issues_repo_issues_event_max_datetime": "2017-01-01T14:34:26.000Z",
"max_issues_repo_issues_event_min_datetime": "2016-10-12T17:28:16.000Z",
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "asr/fotc",
"max_issues_repo_path": "notes/FOT/FOTC/Program/Nest/NestSL.agda",
"max_line_length": 78,
"max_stars_count": 11,
"max_stars_repo_head_hexsha": "2fc9f2b81052a2e0822669f02036c5750371b72d",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "asr/fotc",
"max_stars_repo_path": "notes/FOT/FOTC/Program/Nest/NestSL.agda",
"max_stars_repo_stars_event_max_datetime": "2021-09-12T16:09:54.000Z",
"max_stars_repo_stars_event_min_datetime": "2015-09-03T20:53:42.000Z",
"num_tokens": 203,
"size": 945
} |
-- Andreas, 2022-03-09, issue #5819, reported by Zilin Chen
--
-- This test uncovered an unsound optimization (8e0fca895b9c6740d9d6c1751ed1e0ecefe63473)
-- in the termination checker which replaced a (stripAllProjections . normalize)
-- by a (iteratively reduce . stripAllProjections).
-- Those reductions on now ill-formed terms triggered the __IMPOSSIBLE__:
-- Incomplete pattern matching when applying Issue5819.dl-iso
open import Agda.Builtin.Unit using (β€; tt)
open import Agda.Builtin.Nat renaming (Nat to β)
open import Agda.Builtin.Equality
open import Agda.Builtin.Sigma renaming (fst to projβ; snd to projβ)
data β₯ : Set where
β : {A : Set} (B : A β Set) β Set
β B = Ξ£ _ B
_Γ_ : (A B : Set) β Set
A Γ B = Ξ£ A Ξ» _ β B
sym : {A : Set} {x y : A} β x β‘ y β y β‘ x
sym refl = refl
_β’_ : {A : Set} (x y : A) β Set
x β’ y = x β‘ y β β₯
record Inverse (A B : Set) : Set where
field
f : A β B
fβ»ΒΉ : B β A
inverse : β x β f (fβ»ΒΉ x) β‘ x
open Inverse
data DList : Set
Fresh : (a : β) β (l : DList) β Set
data DList where
dnil : DList
dcons : (a : β) β (l : DList) β Fresh a l β DList
Fresh a dnil = β€
Fresh a (dcons b l _) = (a β’ b) Γ Fresh a l
data Listβ² : Set where
nilβ² : Listβ²
consβ² : β β Listβ² β Listβ²
Freshβ² : β β Listβ² β Set
Freshβ² a nilβ² = β€
Freshβ² a (consβ² b l) = (a β’ b) Γ Freshβ² a l
AllFresh : Listβ² β Set
AllFresh nilβ² = β€
AllFresh (consβ² a l) = Freshβ² a l Γ AllFresh l
data DListβ² : Listβ² β Set β Setβ where
dnilβ² : DListβ² nilβ² β€
dconsβ² : β{l}{prf} β (a : β) β DListβ² l prf β DListβ² (consβ² a l) (Freshβ² a l Γ prf)
data DListβ³ : Set where
dlβ³ : (l : Listβ²) β AllFresh l β DListβ³
undlβ³-l : DListβ³ β Listβ²
undlβ³-l (dlβ³ l _) = l
undlβ³-p : DListβ³ β β AllFresh
undlβ³-p (dlβ³ l p) = l , p
-- dl-iso : DList β DListβ³
dl-iso : Inverse DList DListβ³
-- f-dl-iso : DList β DListβ³
-- g-dl-iso : DListβ³ β DList
-- inverse-dl-iso : β x β f-dl-iso (g-dl-iso x) β‘ x
FreshβFreshβ² : β{a}{l}{lβ³}
β (f dl-iso l β‘ lβ³)
β Fresh a l
β Freshβ² a (undlβ³-l lβ³)
FreshβAllFresh : β{a}{l}{lβ³}
β (f dl-iso l β‘ lβ³)
β Fresh a l
β AllFresh (undlβ³-l lβ³)
All/Freshβ²βFresh : β{a}{l}{lβ³}
β (l β‘ fβ»ΒΉ dl-iso lβ³)
β Freshβ² a (undlβ³-l lβ³) Γ AllFresh (undlβ³-l lβ³)
β Fresh a l
f dl-iso dnil = dlβ³ nilβ² tt
f dl-iso (dcons a l p)
= dlβ³ (consβ² a (undlβ³-l (f dl-iso l)))
((FreshβFreshβ² {l = l}{lβ³ = f dl-iso l} refl p) ,
(FreshβAllFresh {a = a}{l = l}{lβ³ = f dl-iso l} refl p))
fβ»ΒΉ dl-iso (dlβ³ nilβ² p) = dnil
fβ»ΒΉ dl-iso (dlβ³ (consβ² a lβ²) p)
= dcons a (fβ»ΒΉ dl-iso (dlβ³ lβ² (projβ p)))
(All/Freshβ²βFresh {lβ³ = dlβ³ lβ² (projβ p)} refl p)
-- Can't do any further, otherwise an Agda bug occurs.
inverse dl-iso x = invΛ‘
where
invΛ‘ : β{x} β f dl-iso (fβ»ΒΉ dl-iso x) β‘ x
invΛ‘ {dlβ³ nilβ² _} = refl
invΛ‘ {dlβ³ (consβ² a l) p} rewrite invΛ‘ {dlβ³ l {!!}} = {!!} -- add "rewrite invΛ‘ {dlβ³ l ?}" (w/o quotes) to the left of the = sign and C-c C-l
FreshβFreshβ² {a} {dnil} eq p rewrite sym eq = tt
FreshβFreshβ² {a} {dcons aβ l x} eq p rewrite sym eq
= projβ p , FreshβFreshβ² {lβ³ = f dl-iso l} refl (projβ p)
FreshβAllFresh {l = dnil} eq p rewrite sym eq = tt
FreshβAllFresh {l = dcons a l x} eq p rewrite sym eq
= (FreshβFreshβ² {lβ³ = f dl-iso l} refl x) , FreshβAllFresh {a = a}{l = l}{lβ³ = f dl-iso l} refl x
All/Freshβ²βFresh {a} {lβ³ = dlβ³ nilβ² x} eq p rewrite eq = tt
All/Freshβ²βFresh {a} {lβ³ = dlβ³ (consβ² b l) x} eq p rewrite eq
= (projβ (projβ p)) , {!All/Freshβ²βFresh!} -- put "All/Freshβ²βFresh" in the hole and C-c C-r
-- WAS: internal error in reduction machinery
-- SHOULD: fail with termination error
| {
"alphanum_fraction": 0.563299755,
"avg_line_length": 29.6209677419,
"ext": "agda",
"hexsha": "a895809ccf0bcc4e46036d3418d93cea774c6d64",
"lang": "Agda",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "98c9382a59f707c2c97d75919e389fc2a783ac75",
"max_forks_repo_licenses": [
"BSD-2-Clause"
],
"max_forks_repo_name": "KDr2/agda",
"max_forks_repo_path": "test/Fail/Issue5819.agda",
"max_issues_count": 6,
"max_issues_repo_head_hexsha": "98c9382a59f707c2c97d75919e389fc2a783ac75",
"max_issues_repo_issues_event_max_datetime": "2021-11-24T08:31:10.000Z",
"max_issues_repo_issues_event_min_datetime": "2021-10-18T08:12:24.000Z",
"max_issues_repo_licenses": [
"BSD-2-Clause"
],
"max_issues_repo_name": "KDr2/agda",
"max_issues_repo_path": "test/Fail/Issue5819.agda",
"max_line_length": 143,
"max_stars_count": null,
"max_stars_repo_head_hexsha": "98c9382a59f707c2c97d75919e389fc2a783ac75",
"max_stars_repo_licenses": [
"BSD-2-Clause"
],
"max_stars_repo_name": "KDr2/agda",
"max_stars_repo_path": "test/Fail/Issue5819.agda",
"max_stars_repo_stars_event_max_datetime": null,
"max_stars_repo_stars_event_min_datetime": null,
"num_tokens": 1509,
"size": 3673
} |
{-# OPTIONS --without-K #-}
open import HoTT
open import homotopy.HSpace
module homotopy.EM1HSpace where
module EMβHSpace {i} (A : Group i) (A-abelian : is-abelian A) where
module A = Group A
open EMβ A
mult-loop : (g : A.El) (x : EMβ) β x == x
mult-loop g = EMβ-elim
{P = Ξ» x β x == x}
(Ξ» _ β =-preserves-level _ emlevel)
(emloop g)
loop'
(set-β-has-all-paths-β (emlevel embase embase))
(Ξ» _ _ β set-β-has-all-paths-β (emlevel embase embase))
where
abstract
loop' : (g' : A.El) β emloop g == emloop g [ (Ξ» x β x == x) β emloop g' ]
loop' g' = β-idf=idf-in $
emloop g β emloop g' =β¨ ! (emloop-comp g g') β©
emloop (A.comp g g') =β¨ ap emloop (A-abelian g g') β©
emloop (A.comp g' g) =β¨ emloop-comp g' g β©
emloop g' β emloop g =β¨ β=β' (emloop g') (emloop g) β©
emloop g' β' emloop g β
mult-hom : GroupHom A
(Ξ©^S-group 0 ((EMβ β EMβ) , (Ξ» x β x)) (Ξ -level (Ξ» _ β emlevel)))
mult-hom = record {f = f; pres-comp = pres-comp}
where
f = Ξ» g β Ξ»= (mult-loop g)
pres-comp = Ξ» gβ gβ β
ap Ξ»= (Ξ»= (EMβ-elim
{P = Ξ» x β mult-loop (A.comp gβ gβ) x
== mult-loop gβ x β mult-loop gβ x}
(Ξ» _ β =-preserves-level _ (=-preserves-level _ emlevel))
(emloop-comp gβ gβ)
(Ξ» _ β prop-has-all-paths-β (emlevel _ _ _ _))
(set-β-has-all-paths-β (=-preserves-level _ (emlevel _ _)))
(Ξ» _ _ β set-β-has-all-paths-β (=-preserves-level _ (emlevel _ _)))))
β ! (β-Ξ»= _ _)
mult : EMβ β EMβ β EMβ
mult = EMβ-rec {C = EMβ β EMβ} (Ξ -level (Ξ» _ β emlevel)) (Ξ» x β x) mult-hom
H-EMβ : HSpaceStructure EMβ
H-EMβ = record { e = embase; ΞΌ = mult; ΞΌ-e-l = ΞΌ-e-l; ΞΌ-e-r = ΞΌ-e-r; ΞΌ-coh = ΞΌ-coh }
where
ΞΌ-e-l : (x : EMβ) β mult embase x == x
ΞΌ-e-l = EMβ-elim
{P = Ξ» x β mult embase x == x}
(Ξ» _ β =-preserves-level 1 emlevel)
idp
(Ξ» g β β-app=idf-in $ β'-unit-l (emloop g) β (! (ap-idf (emloop g)))
β ! (β-unit-r (ap (mult embase) (emloop g))))
(set-β-has-all-paths-β (emlevel _ _))
(Ξ» _ _ β set-β-has-all-paths-β (emlevel _ _))
ΞΌ-e-r : (x : EMβ) β mult x embase == x
ΞΌ-e-r = EMβ-elim
{P = Ξ» x β mult x embase == x}
(Ξ» _ β =-preserves-level 1 emlevel)
idp
(Ξ» g β β-app=idf-in $
idp β' emloop g
=β¨ β'-unit-l (emloop g) β©
emloop g
=β¨ ! (app=-Ξ² (mult-loop g) embase) β©
app= (Ξ»= (mult-loop g)) embase
=β¨ ! (EMβRec.emloop-Ξ² {C = EMβ β EMβ}
(Ξ -level (Ξ» _ β emlevel)) (Ξ» x β x) mult-hom g)
|in-ctx (Ξ» w β app= w embase) β©
app= (ap mult (emloop g)) embase
=β¨ β-ap (Ξ» f β f embase) mult (emloop g) β©
ap (Ξ» z β mult z embase) (emloop g)
=β¨ ! (β-unit-r (ap (Ξ» z β mult z embase) (emloop g))) β©
ap (Ξ» z β mult z embase) (emloop g) β idp β)
(set-β-has-all-paths-β (emlevel _ _))
(Ξ» _ _ β set-β-has-all-paths-β (emlevel _ _))
ΞΌ-coh : ΞΌ-e-l embase == ΞΌ-e-r embase
ΞΌ-coh = idp
open HSpaceStructure H-EMβ
| {
"alphanum_fraction": 0.488061127,
"avg_line_length": 34.9,
"ext": "agda",
"hexsha": "ec1ae3f3d26b8382e9d4290538eee81466a0d825",
"lang": "Agda",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "bc849346a17b33e2679a5b3f2b8efbe7835dc4b6",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "cmknapp/HoTT-Agda",
"max_forks_repo_path": "theorems/homotopy/EM1HSpace.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "bc849346a17b33e2679a5b3f2b8efbe7835dc4b6",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "cmknapp/HoTT-Agda",
"max_issues_repo_path": "theorems/homotopy/EM1HSpace.agda",
"max_line_length": 86,
"max_stars_count": null,
"max_stars_repo_head_hexsha": "bc849346a17b33e2679a5b3f2b8efbe7835dc4b6",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "cmknapp/HoTT-Agda",
"max_stars_repo_path": "theorems/homotopy/EM1HSpace.agda",
"max_stars_repo_stars_event_max_datetime": null,
"max_stars_repo_stars_event_min_datetime": null,
"num_tokens": 1251,
"size": 3141
} |
------------------------------------------------------------------------
-- The Agda standard library
--
-- Format strings for Printf and Scanf
------------------------------------------------------------------------
{-# OPTIONS --without-K --safe #-}
module Text.Format where
open import Level using (0β)
open import Category.Applicative
open import Data.List.Base as List
open import Data.Product
open import Data.Product.Nary.NonDependent
open import Data.Sum.Base
import Data.Sum.Categorical.Left as Sumβ
open import Function
open import Function.Nary.NonDependent using (0βs; Sets)
open import Strict
-- Formatted types
open import Data.Char.Base
open import Data.Integer.Base
open import Data.Float
open import Data.Nat.Base
open import Data.String.Base
------------------------------------------------------------------------
-- Basic types
data Chunk : Set where
`β `β€ `Float `Char `String : Chunk
Raw : String β Chunk
Format : Set
Format = List Chunk
------------------------------------------------------------------------
-- Semantics
size : Format β β
size = List.sum ββ² List.map Ξ» { (Raw _) β 0; _ β 1 }
-- Meaning of a format as a list of value types
β¦_β§ : (fmt : Format) β Sets (size fmt) 0βs
β¦ [] β§ = _
β¦ `β β· cs β§ = β , β¦ cs β§
β¦ `β€ β· cs β§ = β€ , β¦ cs β§
β¦ `Float β· cs β§ = Float , β¦ cs β§
β¦ `Char β· cs β§ = Char , β¦ cs β§
β¦ `String β· cs β§ = String , β¦ cs β§
β¦ Raw _ β· cs β§ = β¦ cs β§
------------------------------------------------------------------------
-- Lexer: from Strings to Formats
-- Lexing may fail. To have a useful error message, we defined the following
-- enumerated type
data Error : Set where
UnexpectedEndOfString : String β Error
-- ^ expected a type declaration; found an empty string
InvalidType : String β Char β String β Error
-- ^ invalid type declaration
-- return a focus: prefix processed, character causing failure, rest
lexer : String β Error β List Chunk
lexer input = loop [] [] (toList input) where
open RawApplicative (Sumβ.applicative Error 0β)
-- Type synonyms used locally to document the code
RevWord = List Char -- Mere characters accumulated so far
Prefix = RevWord -- Prefix of the input String already read
toRevString : RevWord β String
toRevString = fromList ββ² reverse
-- Push a Raw token if we have accumulated some mere characters
push : RevWord β List Chunk β List Chunk
push [] ks = ks
push cs ks = Raw (toRevString cs) β· ks
-- Main loop
loop : RevWord β Prefix β List Char β Error β List Chunk
type : Prefix β List Char β Error β List Chunk
loop acc bef [] = pure (push acc [])
-- escaped '%' character: treat like a mere character
loop acc bef ('%' β· '%' β· cs) = loop ('%' β· acc) ('%' β· '%' β· bef) cs
-- non escaped '%': type declaration following
loop acc bef ('%' β· cs) = push acc <$> type ('%' β· bef) cs
-- mere character: push onto the accumulator
loop acc bef (c β· cs) = loop (c β· acc) (c β· bef) cs
type bef [] = injβ (UnexpectedEndOfString input)
type bef (c β· cs) = _β·_ <$> chunk c β loop [] (c β· bef) cs where
chunk : Char β Error β Chunk
chunk 'd' = pure `β€
chunk 'i' = pure `β€
chunk 'u' = pure `β
chunk 'f' = pure `Float
chunk 'c' = pure `Char
chunk 's' = pure `String
chunk _ = forceβ² (toRevString bef) $β² Ξ» prefix β
forceβ² (fromList cs) $β² Ξ» suffix β
injβ (InvalidType prefix c suffix)
| {
"alphanum_fraction": 0.5612332287,
"avg_line_length": 31.5585585586,
"ext": "agda",
"hexsha": "3c2b9cd2f8a80efedd194ce0ec20da6ded6a5eab",
"lang": "Agda",
"max_forks_count": 1,
"max_forks_repo_forks_event_max_datetime": "2021-11-04T06:54:45.000Z",
"max_forks_repo_forks_event_min_datetime": "2021-11-04T06:54:45.000Z",
"max_forks_repo_head_hexsha": "fb380f2e67dcb4a94f353dbaec91624fcb5b8933",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "DreamLinuxer/popl21-artifact",
"max_forks_repo_path": "agda-stdlib/src/Text/Format.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "fb380f2e67dcb4a94f353dbaec91624fcb5b8933",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "DreamLinuxer/popl21-artifact",
"max_issues_repo_path": "agda-stdlib/src/Text/Format.agda",
"max_line_length": 76,
"max_stars_count": 5,
"max_stars_repo_head_hexsha": "fb380f2e67dcb4a94f353dbaec91624fcb5b8933",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "DreamLinuxer/popl21-artifact",
"max_stars_repo_path": "agda-stdlib/src/Text/Format.agda",
"max_stars_repo_stars_event_max_datetime": "2020-10-10T21:41:32.000Z",
"max_stars_repo_stars_event_min_datetime": "2020-10-07T12:07:53.000Z",
"num_tokens": 961,
"size": 3503
} |
------------------------------------------------------------------------------
-- Testing Agsy *without* using the Agda standard library
------------------------------------------------------------------------------
{-# OPTIONS --allow-unsolved-metas #-}
{-# OPTIONS --exact-split #-}
{-# OPTIONS --no-sized-types #-}
{-# OPTIONS --no-universe-polymorphism #-}
{-# OPTIONS --without-K #-}
-- Tested with the development version of Agda on 15 June 2012.
module FOT.Agsy.NoStd.AgsyNoStd where
-- The equational reasoning from the Agda standard libraryΒ 0.8.1.
-- open import Relation.Binary.PropositionalEquality
-- open β‘-Reasoning
-- My equational reasoning.
open import FOT.Agsy.NoStd.MyPropositionalEquality
open β‘-Reasoning
-- We add 3 to the fixities of the Agda standard libraryΒ 0.8.1 (see
-- Data/Nat.agda).
infixl 9 _+_
------------------------------------------------------------------------------
data β : Set where
zero : β
suc : β β β
_+_ : β β β β β
zero + n = n
suc m + n = suc (m + n)
+-assoc : β m n o β m + n + o β‘ m + (n + o)
+-assoc zero n o = refl -- via Agsy
+-assoc (suc m) n o = {!!} -- Agsy fails using my propositional equality
| {
"alphanum_fraction": 0.5074135091,
"avg_line_length": 30.35,
"ext": "agda",
"hexsha": "9e790ecaf60db73c770b6d5316628b495363872e",
"lang": "Agda",
"max_forks_count": 3,
"max_forks_repo_forks_event_max_datetime": "2018-03-14T08:50:00.000Z",
"max_forks_repo_forks_event_min_datetime": "2016-09-19T14:18:30.000Z",
"max_forks_repo_head_hexsha": "2fc9f2b81052a2e0822669f02036c5750371b72d",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "asr/fotc",
"max_forks_repo_path": "notes/FOT/Agsy/NoStd/AgsyNoStd.agda",
"max_issues_count": 2,
"max_issues_repo_head_hexsha": "2fc9f2b81052a2e0822669f02036c5750371b72d",
"max_issues_repo_issues_event_max_datetime": "2017-01-01T14:34:26.000Z",
"max_issues_repo_issues_event_min_datetime": "2016-10-12T17:28:16.000Z",
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "asr/fotc",
"max_issues_repo_path": "notes/FOT/Agsy/NoStd/AgsyNoStd.agda",
"max_line_length": 78,
"max_stars_count": 11,
"max_stars_repo_head_hexsha": "2fc9f2b81052a2e0822669f02036c5750371b72d",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "asr/fotc",
"max_stars_repo_path": "notes/FOT/Agsy/NoStd/AgsyNoStd.agda",
"max_stars_repo_stars_event_max_datetime": "2021-09-12T16:09:54.000Z",
"max_stars_repo_stars_event_min_datetime": "2015-09-03T20:53:42.000Z",
"num_tokens": 304,
"size": 1214
} |
module Tactic.Nat.Subtract.Simplify where
open import Prelude hiding (abs)
open import Builtin.Reflection
open import Tactic.Reflection.Quote
open import Tactic.Reflection
open import Control.Monad.State
open import Tactic.Nat.Reflect
open import Tactic.Nat.NF
open import Tactic.Nat.Exp
open import Tactic.Nat.Auto
open import Tactic.Nat.Auto.Lemmas
open import Tactic.Nat.Simpl.Lemmas
open import Tactic.Nat.Simpl
open import Tactic.Nat.Reflect
open import Tactic.Nat.Subtract.Exp
open import Tactic.Nat.Subtract.Reflect
open import Tactic.Nat.Subtract.Lemmas
open import Tactic.Nat.Less.Lemmas
simplifySubEqn : β eqn Ο β cβ¦ eqn β§eqn Ο β β¦ eqn β§eqn Ο
simplifySubEqn (a :β‘ b) = simplifySubEq a b
simplifySubEqn (a :< b) = simplifySubLess a b
complicateSubEqn : β eqn Ο β β¦ eqn β§eqn Ο β cβ¦ eqn β§eqn Ο
complicateSubEqn (a :β‘ b) = complicateSubEq a b
complicateSubEqn (a :< b) = complicateSubLess a b
β¦_β§sh : List Eqn β Env Var β Set
β¦ [] β§sh Ο = β₯
β¦ h β· [] β§sh Ο = β¦ h β§eqn Ο
β¦ h β· g β§sh Ο = β¦ h β§eqn Ο β β¦ g β§sh Ο
β¦_β§shs : List Eqn β Env Var β Set
β¦ [] β§shs Ο = β₯
β¦ h β· [] β§shs Ο = cβ¦ h β§eqn Ο
β¦ h β· g β§shs Ο = cβ¦ h β§eqn Ο β β¦ g β§shs Ο
simplifySubH : β goal Ο β β¦ goal β§shs Ο β β¦ goal β§sh Ο
simplifySubH [] Ο ()
simplifySubH (h β· []) Ο H = simplifySubEqn h Ο H
simplifySubH (h β· hβ β· g) Ο H = Ξ» Hβ β simplifySubH (hβ β· g) Ο $ H (complicateSubEqn h Ο Hβ)
simplifysub-tactic : Term β Type β TC Term
simplifysub-tactic prf g =
inferType prf >>= Ξ» h β
let t = pi (vArg h) (abs "_" (weaken 1 g)) in
caseM termToSubHyps t of
Ξ» { nothing β pure $ failedProof (quote invalidGoal) t
; (just (goal , Ξ)) β pure $
def (quote flip)
$ vArg (def (quote simplifySubH)
( vArg (` goal)
β· vArg (quotedEnv Ξ) β· [] ))
β· vArg prf β· []
}
simplifygoal-tactic : Type β TC Term
simplifygoal-tactic t =
caseM termToSubHyps t of Ξ»
{ nothing β pure $ failedProof (quote invalidGoal) t
; (just (goal , Ξ)) β pure $
def (quote simplifySubH)
$ vArg (` goal)
β· vArg (quotedEnv Ξ)
β· []
}
| {
"alphanum_fraction": 0.6319543509,
"avg_line_length": 29.6197183099,
"ext": "agda",
"hexsha": "64029d5388ceee8b6c1742ff42bb260f8ebb43f7",
"lang": "Agda",
"max_forks_count": 24,
"max_forks_repo_forks_event_max_datetime": "2021-04-22T06:10:41.000Z",
"max_forks_repo_forks_event_min_datetime": "2015-03-12T18:03:45.000Z",
"max_forks_repo_head_hexsha": "158d299b1b365e186f00d8ef5b8c6844235ee267",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "L-TChen/agda-prelude",
"max_forks_repo_path": "src/Tactic/Nat/Subtract/Simplify.agda",
"max_issues_count": 59,
"max_issues_repo_head_hexsha": "158d299b1b365e186f00d8ef5b8c6844235ee267",
"max_issues_repo_issues_event_max_datetime": "2022-01-14T07:32:36.000Z",
"max_issues_repo_issues_event_min_datetime": "2016-02-09T05:36:44.000Z",
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "L-TChen/agda-prelude",
"max_issues_repo_path": "src/Tactic/Nat/Subtract/Simplify.agda",
"max_line_length": 92,
"max_stars_count": 111,
"max_stars_repo_head_hexsha": "158d299b1b365e186f00d8ef5b8c6844235ee267",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "L-TChen/agda-prelude",
"max_stars_repo_path": "src/Tactic/Nat/Subtract/Simplify.agda",
"max_stars_repo_stars_event_max_datetime": "2022-02-12T23:29:26.000Z",
"max_stars_repo_stars_event_min_datetime": "2015-01-05T11:28:15.000Z",
"num_tokens": 827,
"size": 2103
} |
{-# OPTIONS --safe --experimental-lossy-unification #-}
module Cubical.ZCohomology.Groups.WedgeOfSpheres where
open import Cubical.Foundations.Prelude
open import Cubical.Foundations.Isomorphism
open import Cubical.Data.Sigma.Base
open import Cubical.ZCohomology.Base
open import Cubical.ZCohomology.GroupStructure
open import Cubical.ZCohomology.Groups.Unit
open import Cubical.ZCohomology.Groups.Sn
open import Cubical.ZCohomology.Groups.Wedge
open import Cubical.ZCohomology.Groups.Connected
open import Cubical.Data.Int renaming (_+_ to _β€+_)
open import Cubical.HITs.Sn
open import Cubical.HITs.S1
open import Cubical.HITs.Susp
open import Cubical.HITs.Wedge
open import Cubical.HITs.Pushout
open import Cubical.HITs.Truncation renaming (elim to trElim) hiding (map ; elim2)
open import Cubical.Algebra.Group renaming (β€ to β€Group ; Bool to BoolGroup ; Unit to UnitGroup)
open import Cubical.HITs.SetTruncation renaming (rec to sRec ; rec2 to sRec2 ; elim to sElim)
SΒΉβSΒΉ : Typeβ
SΒΉβSΒΉ = Sββ 1 β Sββ 1
SΒ²βSΒΉβSΒΉ : Typeβ
SΒ²βSΒΉβSΒΉ = Sββ 2 β (SΒΉβSΒΉ , inl base)
------------- Hβ°(SΒΉβSΒΉ) ------------
Hβ°-SΒΉβSΒΉ : GroupIso (coHomGr 0 SΒΉβSΒΉ) β€Group
Hβ°-SΒΉβSΒΉ = Hβ°-connected (inl base) (wedgeConnected _ _ (Sn-connected 0) (Sn-connected 0))
------------- HΒΉ(SΒΉβSΒΉ) ------------
HΒΉ-SΒΉβSΒΉ : GroupIso (coHomGr 1 SΒΉβSΒΉ) (DirProd β€Group β€Group)
HΒΉ-SΒΉβSΒΉ = (HβΏ-β _ _ 0) β‘ GroupIsoDirProd coHom1S1ββ€ coHom1S1ββ€
------------- Hβ°(SΒ²βSΒΉβSΒΉ) ---------
Hβ°-SΒ²βSΒΉβSΒΉ : GroupIso (coHomGr 0 SΒ²βSΒΉβSΒΉ) β€Group
Hβ°-SΒ²βSΒΉβSΒΉ = Hβ°-connected (inl north)
(wedgeConnected _ _
(Sn-connected 1)
(wedgeConnected _ _
(Sn-connected 0)
(Sn-connected 0)))
------------- HΒΉ(SΒ²βSΒΉβSΒΉ) ---------
HΒΉ-SΒ²βSΒΉβSΒΉ : GroupIso (coHomGr 1 SΒ²βSΒΉβSΒΉ) (DirProd β€Group β€Group)
HΒΉ-SΒ²βSΒΉβSΒΉ =
HβΏ-β (Sββ 2) (SΒΉβSΒΉ , inl base) 0
β‘ GroupIsoDirProd (HΒΉ-SβΏβ
0 0) HΒΉ-SΒΉβSΒΉ
β‘ lUnitGroupIso
------------- HΒ²(SΒ²βSΒΉβSΒΉ) ---------
HΒ²-SΒ²βSΒΉβSΒΉ : GroupIso (coHomGr 2 SΒ²βSΒΉβSΒΉ) β€Group
HΒ²-SΒ²βSΒΉβSΒΉ =
compGroupIso
(HβΏ-β _ _ 1)
(GroupIsoDirProd {B = UnitGroup}
(HβΏ-SβΏβ
β€ 1)
((HβΏ-β _ _ 1) β‘ GroupIsoDirProd (HβΏ-SΒΉβ
0 0) (HβΏ-SΒΉβ
0 0) β‘ rUnitGroupIso)
β‘ rUnitGroupIso)
private
open IsGroupHom
open Iso
toβ : coHom 2 SΒ²βSΒΉβSΒΉ β β€
toβ = fun (fst HΒ²-SΒ²βSΒΉβSΒΉ)
fromβ : β€ β coHom 2 SΒ²βSΒΉβSΒΉ
fromβ = inv (fst HΒ²-SΒ²βSΒΉβSΒΉ)
toβ : coHom 1 SΒ²βSΒΉβSΒΉ β β€ Γ β€
toβ = fun (fst HΒΉ-SΒ²βSΒΉβSΒΉ)
fromβ : β€ Γ β€ β coHom 1 SΒ²βSΒΉβSΒΉ
fromβ = inv (fst HΒΉ-SΒ²βSΒΉβSΒΉ)
toβ : coHom 0 SΒ²βSΒΉβSΒΉ β β€
toβ = fun (fst Hβ°-SΒ²βSΒΉβSΒΉ)
fromβ : β€ β coHom 0 SΒ²βSΒΉβSΒΉ
fromβ = inv (fst Hβ°-SΒ²βSΒΉβSΒΉ)
{-
-- Compute pretty fast
test1 : toβ (fromβ (1 , 0) +β fromβ (0 , 1)) β‘ (1 , 1)
test1 = refl
-- Computes, but only when computing some smaller numbers first
test2 : toβ (fromβ (50 , 3) +β fromβ (2 , -2)) β‘ (52 , 1)
test2 = refl
test3 : toβ (fromβ 0) β‘ 0
test3 = refl
test4 : toβ (fromβ 3) β‘ 3
test4 = refl
test5 : toβ (fromβ 1 +β fromβ 1) β‘ 2
test5 = refl
-}
g : SΒ²βSΒΉβSΒΉ β β₯ Susp SΒΉ β₯ 4
g (inl x) = β£ x β£
g (inr x) = 0β _
g (push a i) = 0β _
G = β£ g β£β
{- Does not compute:
testβ : toβ (G +β G) β‘ 2
testβ = refl
but this does:
testβ : toβ (G +'β G) β‘ 2
testβ = refl
-}
| {
"alphanum_fraction": 0.6269718528,
"avg_line_length": 26.9416666667,
"ext": "agda",
"hexsha": "cdc616371c53fd4503a63a624e1bc1e46ec202c6",
"lang": "Agda",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "f2d74ae8e2e176963029a35bd886364480948214",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "kl-i/cubical-0.3",
"max_forks_repo_path": "Cubical/ZCohomology/Groups/WedgeOfSpheres.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "f2d74ae8e2e176963029a35bd886364480948214",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "kl-i/cubical-0.3",
"max_issues_repo_path": "Cubical/ZCohomology/Groups/WedgeOfSpheres.agda",
"max_line_length": 96,
"max_stars_count": null,
"max_stars_repo_head_hexsha": "f2d74ae8e2e176963029a35bd886364480948214",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "kl-i/cubical-0.3",
"max_stars_repo_path": "Cubical/ZCohomology/Groups/WedgeOfSpheres.agda",
"max_stars_repo_stars_event_max_datetime": null,
"max_stars_repo_stars_event_min_datetime": null,
"num_tokens": 1586,
"size": 3233
} |
------------------------------------------------------------------------
-- Vectors, defined as functions from finite sets
------------------------------------------------------------------------
{-# OPTIONS --without-K --safe #-}
open import Equality
module Vec.Function
{reflexive} (eq : β {a p} β Equality-with-J a p reflexive) where
open import Prelude
open import Bijection eq using (_β_)
open Derived-definitions-and-properties eq
open import Function-universe eq hiding (id; _β_)
open import List eq using (length)
open import Surjection eq using (_β _; β -β‘)
private
variable
a : Level
A B : Type a
n : β
k : Kind
------------------------------------------------------------------------
-- The type
-- Vectors.
Vec : β {a} β Type a β β β Type a
Vec A n = Fin n β A
-- Nil.
nil : Vec A zero
nil = Ξ» ()
-- Cons.
cons : A β Vec A n β Vec A (suc n)
cons x xs = [ const x , xs ]
------------------------------------------------------------------------
-- Some simple functions
-- Finds the element at the given position.
index : Vec A n β Fin n β A
index = id
-- Applies the function to every element in the vector.
map : (A β B) β Vec A n β Vec B n
map f xs = f β xs
-- Constructs a vector containing a certain number of copies of the
-- given element.
replicate : A β Vec A n
replicate = const
-- The head of the vector.
head : Vec A (suc n) β A
head = _$ fzero
-- The tail of the vector.
tail : Vec A (suc n) β Vec A n
tail = _β fsuc
-- Updates the element at the given position.
infix 3 _[_β_]
_[_β_] : Vec A n β Fin n β A β Vec A n
_[_β_] {n = zero} _ () _
_[_β_] {n = suc _} xs fzero x = cons x (tail xs)
_[_β_] {n = suc _} xs (fsuc i) x = cons (head xs) (tail xs [ i β x ])
------------------------------------------------------------------------
-- Some properties
-- Empty lists are equal to nil (assuming extensionality).
emptyβ‘nil :
{A : Type a} β
Extensionality lzero a β
{xs : Vec A zero} β
xs β‘ nil
emptyβ‘nil ext = apply-ext ext Ξ» ()
-- A non-empty list is equal to its head consed onto its tail
-- (assuming extensionality).
non-emptyβ‘cons-head-tail :
{A : Type a} β
Extensionality lzero a β
(xs : Vec A (suc n)) β
xs β‘ cons (head xs) (tail xs)
non-emptyβ‘cons-head-tail ext _ =
apply-ext ext [ (Ξ» _ β refl _) , (Ξ» _ β refl _) ]
------------------------------------------------------------------------
-- Conversions to and from lists
-- Vectors can be converted to lists.
to-list : Vec A n β List A
to-list {n = zero} _ = []
to-list {n = suc _} xs = head xs β· to-list (tail xs)
-- Lists can be converted to vectors.
from-list : (xs : List A) β Vec A (length xs)
from-list [] = nil
from-list (x β· xs) = cons x (from-list xs)
-- There is a split surjection from βΒ (VecΒ A) to ListΒ A.
βVecβ List : β (Vec A) β List A
βVecβ List {A = A} = record
{ logical-equivalence = record
{ to = to-list β projβ
; from = Ξ» xs β length xs , from-list xs
}
; right-inverse-of = toβfrom
}
where
toβfrom : (xs : List A) β to-list (from-list xs) β‘ xs
toβfrom [] = refl _
toβfrom (x β· xs) = cong (x β·_) (toβfrom xs)
-- βΒ (VecΒ A) is equivalent to ListΒ A (assuming extensionality).
βVecβList :
{A : Type a} β
β (Vec A) β[ lzero β£ a ] List A
βVecβList {a = a} {A = A} =
generalise-ext?
(_β _.logical-equivalence βVecβ List)
(Ξ» ext β
_β _.right-inverse-of βVecβ List
, uncurry (fromβto ext))
where
tailβ² : A β β (Vec A) β β (Vec A)
tailβ² y = record
{ logical-equivalence = record
{ to = Ξ» where
(suc n , xs) β n , tail xs
xs@(zero , _) β xs
; from = Ξ£-map suc (cons y)
}
; right-inverse-of = refl
}
fromβto :
Extensionality lzero a β
β n (xs : Vec A n) β
(length (to-list xs) , from-list (to-list xs)) β‘ (n , xs)
fromβto ext zero xs =
(length {A = A} [] , nil) β‘β¨ cong (zero ,_) $ sym $ emptyβ‘nil ext β©β
(zero , xs) β
fromβto ext (suc n) xs = $β¨ fromβto ext n (tail xs) β©
(length (to-list (tail xs)) , from-list (to-list (tail xs)))
β‘
(n , tail xs) ββ¨ _β _.from $ β -β‘ (tailβ² (head xs)) β©
(length (to-list xs) , from-list (to-list xs))
β‘
(suc n , cons (head xs) (tail xs)) ββ¨ β‘ββ _ $ cong (Ξ» ys β (_ , from-list (to-list xs)) β‘ (_ , ys)) $ sym $
non-emptyβ‘cons-head-tail ext xs β©β‘
(length (to-list xs) , from-list (to-list xs))
β‘
(suc n , xs) β‘
| {
"alphanum_fraction": 0.4867690994,
"avg_line_length": 26.1787709497,
"ext": "agda",
"hexsha": "ba4c909f716c68e3a04298ca1944e81686770f33",
"lang": "Agda",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "402b20615cfe9ca944662380d7b2d69b0f175200",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "nad/equality",
"max_forks_repo_path": "src/Vec/Function.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "402b20615cfe9ca944662380d7b2d69b0f175200",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "nad/equality",
"max_issues_repo_path": "src/Vec/Function.agda",
"max_line_length": 138,
"max_stars_count": 3,
"max_stars_repo_head_hexsha": "402b20615cfe9ca944662380d7b2d69b0f175200",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "nad/equality",
"max_stars_repo_path": "src/Vec/Function.agda",
"max_stars_repo_stars_event_max_datetime": "2021-09-02T17:18:15.000Z",
"max_stars_repo_stars_event_min_datetime": "2020-05-21T22:58:50.000Z",
"num_tokens": 1453,
"size": 4686
} |
{-# OPTIONS --without-K --rewriting #-}
open import HoTT
import homotopy.ConstantToSetExtendsToProp as ConstExt
{-
q[_]α΄³
G/Q β------ G
β β
Οβ β β inject
β β
H β------- P
Οβ
Then, H βα΄³ P/Q.
-}
module groups.PropQuotUniqueFactorization
{i j lβ lβ} {G : Group i} {H : Group j}
(P : SubgroupProp G lβ)
(Q : NormalSubgroupProp G lβ)
(Οβ : Subgroup P βα΄³ H) (Οβ-is-surj : is-surjα΄³ Οβ)
(Οβ : H βα΄³ QuotGroup Q) (Οβ-is-inj : is-injα΄³ Οβ)
(Ο-comm : β p β GroupHom.f (Οβ βα΄³ Οβ) p == q[ fst p ])
where
private
module G = Group G
module H = Group H
module P = Subgroup P
module Οβ = GroupHom Οβ
module Οβ = GroupHom Οβ
P/Q-prop : NormalSubgroupProp (Subgroup P) lβ
P/Q-prop = quot-of-sub P Q
P/Q : Group (lmax i (lmax lβ lβ))
P/Q = QuotGroup P/Q-prop
module P/Q = Group P/Q
module _ (k : Group.El H) where
H-to-P/Q-f' : hfiber Οβ.f k β P/Q.El
H-to-P/Q-f' (p , _) = q[ p ]
abstract
H-to-P/Q-f'-const : (hfβ hfβ : hfiber Οβ.f k)
β H-to-P/Q-f' hfβ == H-to-P/Q-f' hfβ
H-to-P/Q-f'-const (hβ , rβ) (hβ , rβ) =
quot-relα΄³ {P = P/Q-prop} $ <β (quot-relα΄³-equiv {P = Q}) $
! (Ο-comm hβ) β ap Οβ.f (rβ β ! rβ) β Ο-comm hβ
module HToP/Q = ConstExt P/Q.El-is-set
H-to-P/Q-f' H-to-P/Q-f'-const
H-to-P/Q-f : Trunc -1 (hfiber Οβ.f k) β P/Q.El
H-to-P/Q-f = HToP/Q.ext
H-to-P/Q-f-is-const : β hfβ hfβ β H-to-P/Q-f hfβ == H-to-P/Q-f hfβ
H-to-P/Q-f-is-const = HToP/Q.ext-is-const
abstract
H-to-P/Q-f-comp : (kβ kβ : H.El)
β (hfββ : Trunc -1 (hfiber Οβ.f (H.comp kβ kβ)))
β (hfβ : Trunc -1 (hfiber Οβ.f kβ))
β (hfβ : Trunc -1 (hfiber Οβ.f kβ))
β H-to-P/Q-f (H.comp kβ kβ) hfββ == P/Q.comp (H-to-P/Q-f kβ hfβ) (H-to-P/Q-f kβ hfβ)
H-to-P/Q-f-comp kβ kβ hfββ = Trunc-elim
(Ξ» hfβ β Ξ -is-prop Ξ» hfβ β
P/Q.El-is-set _ (P/Q.comp (H-to-P/Q-f kβ hfβ) (H-to-P/Q-f kβ hfβ)))
(Ξ»{(pβ , rβ) β Trunc-elim
(Ξ» hfβ β P/Q.El-is-set _ (P/Q.comp q[ pβ ] (H-to-P/Q-f kβ hfβ)))
(Ξ»{(pβ , rβ) β H-to-P/Q-f-is-const (H.comp kβ kβ)
hfββ [ P.comp pβ pβ , Οβ.pres-comp pβ pβ β ap2 H.comp rβ rβ ]})})
H-to-P/Q : H βα΄³ P/Q
H-to-P/Q = record {
f = Ξ» k β H-to-P/Q-f k (Οβ-is-surj k);
pres-comp = Ξ» kβ kβ β H-to-P/Q-f-comp kβ kβ
(Οβ-is-surj (H.comp kβ kβ)) (Οβ-is-surj kβ) (Οβ-is-surj kβ)}
H-iso-P/Q : H βα΄³ P/Q
H-iso-P/Q = H-to-P/Q , is-eq to from to-from from-to where
to : H.El β P/Q.El
to = Ξ» k β H-to-P/Q-f k (Οβ-is-surj k)
from : P/Q.El β H.El
from = SetQuot-rec H.El-is-set
(Ξ» p β Οβ.f p)
(Ξ» {pβ} {pβ} q'pβpββ»ΒΉ β Οβ-is-inj (Οβ.f pβ) (Οβ.f pβ) $
Ο-comm pβ β quot-relα΄³ {P = Q} q'pβpββ»ΒΉ β ! (Ο-comm pβ))
abstract
to-from : β p/q β to (from p/q) == p/q
to-from = SetQuot-elim (Ξ» p/q β raise-level -1 $ P/Q.El-is-set _ p/q)
(Ξ» p β H-to-P/Q-f-is-const (Οβ.f p) (Οβ-is-surj (Οβ.f p)) [ p , idp ])
(Ξ» _ β prop-has-all-paths-β $ P/Q.El-is-set _ _)
from-to' : β k (hf : Trunc -1 (hfiber Οβ.f k)) β from (H-to-P/Q-f k hf) == k
from-to' k = Trunc-elim (Ξ» hf β H.El-is-set (from (H-to-P/Q-f k hf)) k) (Ξ»{(p , r) β r})
from-to : β k β from (to k) == k
from-to k = from-to' k (Οβ-is-surj k)
| {
"alphanum_fraction": 0.4952857985,
"avg_line_length": 32.9514563107,
"ext": "agda",
"hexsha": "e61e98d5fb6d521b1836a9fdd4072bdda7c9c2fe",
"lang": "Agda",
"max_forks_count": 1,
"max_forks_repo_forks_event_max_datetime": "2018-12-26T21:31:57.000Z",
"max_forks_repo_forks_event_min_datetime": "2018-12-26T21:31:57.000Z",
"max_forks_repo_head_hexsha": "e7d663b63d89f380ab772ecb8d51c38c26952dbb",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "mikeshulman/HoTT-Agda",
"max_forks_repo_path": "theorems/groups/PropQuotUniqueFactorization.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "e7d663b63d89f380ab772ecb8d51c38c26952dbb",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "mikeshulman/HoTT-Agda",
"max_issues_repo_path": "theorems/groups/PropQuotUniqueFactorization.agda",
"max_line_length": 94,
"max_stars_count": null,
"max_stars_repo_head_hexsha": "e7d663b63d89f380ab772ecb8d51c38c26952dbb",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "mikeshulman/HoTT-Agda",
"max_stars_repo_path": "theorems/groups/PropQuotUniqueFactorization.agda",
"max_stars_repo_stars_event_max_datetime": null,
"max_stars_repo_stars_event_min_datetime": null,
"num_tokens": 1432,
"size": 3394
} |
{-# OPTIONS --safe --without-K #-}
open import Generics.Prelude
open import Generics.Telescope
open import Generics.Desc
open import Agda.Builtin.Reflection
module Generics.Helpers
P I
{levelArgRel : Level β Level}
(ArgRel : β {a} β Set a β Set (levelArgRel a))
{levelArgIrr : Level β Level}
(ArgIrr : β {a} β Set a β Set (levelArgIrr a))
(Ind : β {V} (C : ConDesc P V I) β SetΟ)
where
data ConHelper p {V} : ConDesc P V I β SetΟ where
instance var : β {f} β ConHelper p (var f)
pi-irr : β {β n v q}
{S : β¦ P , V β§xtel β Set β}
(let ai = n , arg-info v (modality irrelevant q))
{C : ConDesc P (V β’< ai > S) I}
β β¦ β {v} β ArgIrr (S (p , v)) β¦
β β¦ ConHelper p C β¦
β ConHelper p (Ο ai S C)
pi-rel : β {β n v q}
{S : β¦ P , V β§xtel β Set β}
(let ai = n , arg-info v (modality relevant q))
{C : ConDesc P (V β’< ai > S) I}
β β¦ β {v} β ArgRel (S (p , v)) β¦
β β¦ ConHelper p C β¦
β ConHelper p (Ο ai S C)
prod : {A B : ConDesc P V I}
β β¦ Ind A β¦
β β¦ ConHelper p B β¦
β ConHelper p (A β B)
data Helpers p : {n : β} β DataDesc P I n β SetΟ where
instance nil : Helpers p []
cons : β {n} {C : ConDesc P Ξ΅ I}
{D : DataDesc P I n}
β β¦ ConHelper p C β¦
β β¦ Helpers p D β¦
β Helpers p (C β· D)
lookupHelper : β {n} {D : DataDesc P I n} {p}
(HD : Helpers p D) (k : Fin n)
β ConHelper p (lookupCon D k)
lookupHelper (cons β¦ HC β¦ β¦ HD β¦) zero = HC
lookupHelper (cons β¦ HC β¦ β¦ HD β¦) (suc k) = lookupHelper HD k
| {
"alphanum_fraction": 0.402281746,
"avg_line_length": 36.6545454545,
"ext": "agda",
"hexsha": "bc3419170d682e1fbca649d177884c4a61d506b3",
"lang": "Agda",
"max_forks_count": 3,
"max_forks_repo_forks_event_max_datetime": "2022-01-14T10:35:16.000Z",
"max_forks_repo_forks_event_min_datetime": "2021-04-08T08:32:42.000Z",
"max_forks_repo_head_hexsha": "db764f858d908aa39ea4901669a6bbce1525f757",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "flupe/generics",
"max_forks_repo_path": "src/Generics/Helpers.agda",
"max_issues_count": 4,
"max_issues_repo_head_hexsha": "db764f858d908aa39ea4901669a6bbce1525f757",
"max_issues_repo_issues_event_max_datetime": "2022-01-14T10:48:30.000Z",
"max_issues_repo_issues_event_min_datetime": "2021-09-13T07:33:50.000Z",
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "flupe/generics",
"max_issues_repo_path": "src/Generics/Helpers.agda",
"max_line_length": 71,
"max_stars_count": 11,
"max_stars_repo_head_hexsha": "db764f858d908aa39ea4901669a6bbce1525f757",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "flupe/generics",
"max_stars_repo_path": "src/Generics/Helpers.agda",
"max_stars_repo_stars_event_max_datetime": "2022-02-05T09:35:17.000Z",
"max_stars_repo_stars_event_min_datetime": "2021-04-08T15:10:20.000Z",
"num_tokens": 641,
"size": 2016
} |
open import Common.Prelude hiding (_>>=_)
open import Common.Reflection
open import Common.Equality
setβ = sort (lit 0)
set! = sort unknown
-- Definitions added by tactics always use the original context, and thus are not
-- affected by inContext and extendContext. The reason for this is that they are added
-- to the module of the macro call, so they need to live in the context of that module
-- or things break.
freshFun : Type β List Clause β Tactic
freshFun t cs hole =
freshName "fresh" >>= Ξ» n β
inContext [] (define (vArg n) (funDef t cs)) >>= Ξ» _ β
unify hole (def n [])
macro
ack : Tactic
ack = freshFun set! (clause [] setβ β· [])
theA : Tactic
theA = freshFun setβ (clause [] (var 0 []) β· [])
module Foo (A : Set) where
foo : Set
foo = theA
bar : Setβ
bar = ack
check : {A : Set} β Foo.foo A β‘ A
check = refl
| {
"alphanum_fraction": 0.6643192488,
"avg_line_length": 23.6666666667,
"ext": "agda",
"hexsha": "faf01473ca1f767f408bffc146614ea05a8b1d1f",
"lang": "Agda",
"max_forks_count": 1,
"max_forks_repo_forks_event_max_datetime": "2019-03-05T20:02:38.000Z",
"max_forks_repo_forks_event_min_datetime": "2019-03-05T20:02:38.000Z",
"max_forks_repo_head_hexsha": "231d6ad8e77b67ff8c4b1cb35a6c31ccd988c3e9",
"max_forks_repo_licenses": [
"BSD-3-Clause"
],
"max_forks_repo_name": "Agda-zh/agda",
"max_forks_repo_path": "test/Succeed/Issue1827.agda",
"max_issues_count": 3,
"max_issues_repo_head_hexsha": "aac88412199dd4cbcb041aab499d8a6b7e3f4a2e",
"max_issues_repo_issues_event_max_datetime": "2019-04-01T19:39:26.000Z",
"max_issues_repo_issues_event_min_datetime": "2018-11-14T15:31:44.000Z",
"max_issues_repo_licenses": [
"BSD-3-Clause"
],
"max_issues_repo_name": "hborum/agda",
"max_issues_repo_path": "test/Succeed/Issue1827.agda",
"max_line_length": 86,
"max_stars_count": 3,
"max_stars_repo_head_hexsha": "aac88412199dd4cbcb041aab499d8a6b7e3f4a2e",
"max_stars_repo_licenses": [
"BSD-3-Clause"
],
"max_stars_repo_name": "hborum/agda",
"max_stars_repo_path": "test/Succeed/Issue1827.agda",
"max_stars_repo_stars_event_max_datetime": "2015-12-07T20:14:00.000Z",
"max_stars_repo_stars_event_min_datetime": "2015-03-28T14:51:03.000Z",
"num_tokens": 254,
"size": 852
} |
{-# OPTIONS --universe-polymorphism #-}
module Categories.NaturalTransformation.Core where
open import Level
open import Relation.Binary using (Rel; IsEquivalence)
open import Categories.Support.Equivalence
open import Categories.Category
open import Categories.Functor.Core renaming (id to idF; _β_ to _βF_)
record NaturalTransformation {o β e oβ² ββ² eβ²}
{C : Category o β e}
{D : Category oβ² ββ² eβ²}
(F G : Functor C D) : Set (o β β β e β oβ² β ββ² β eβ²) where
private module C = Category C
private module D = Category D
private module F = Functor F
private module G = Functor G
open F using (Fβ; Fβ)
open G using () renaming (Fβ to Gβ; Fβ to Gβ)
field
Ξ· : β X β D [ Fβ X , Gβ X ]
.commute : β {X Y} (f : C [ X , Y ]) β D.CommutativeSquare (Fβ f) (Ξ· X) (Ξ· Y) (Gβ f)
op : NaturalTransformation G.op F.op
op = record
{ Ξ· = Ξ·
; commute = Ξ» f β D.Equiv.sym (commute f)
}
id : β {o β e oβ² ββ² eβ²} {C : Category o β e} {D : Category oβ² ββ² eβ²} {F : Functor C D} β NaturalTransformation F F
id {C = C} {D} {F} = record
{ Ξ· = Ξ» _ β D.id
; commute = commuteβ²
}
where
module C = Category C
module D = Category D
module F = Functor F
open F
.commuteβ² : β {X Y} (f : C [ X , Y ]) β D [ D [ D.id β Fβ f ] β‘ D [ Fβ f β D.id ] ]
commuteβ² f = begin
D [ D.id β Fβ f ]
ββ¨ D.identityΛ‘ β©
Fβ f
ββ¨ D.identityΚ³ β©
D [ Fβ f β D.id ]
β
where
open D.HomReasoning
infixr 9 _ββ_ _ββ_
-- "Vertical composition"
_ββ_ : β {oβ ββ eβ oβ ββ eβ}
{C : Category oβ ββ eβ} {D : Category oβ ββ eβ}
{F G H : Functor C D}
β NaturalTransformation G H β NaturalTransformation F G β NaturalTransformation F H
_ββ_ {C = C} {D} {F} {G} {H} X Y = record
{ Ξ· = Ξ» q β D [ X.Ξ· q β Y.Ξ· q ]
; commute = commuteβ²
}
where
module C = Category C
module D = Category D
module F = Functor F
module G = Functor G
module H = Functor H
module X = NaturalTransformation X
module Y = NaturalTransformation Y
open F
open G renaming (Fβ to Gβ; Fβ to Gβ)
open H renaming (Fβ to Hβ; Fβ to Hβ)
.commuteβ² : β {A B} (f : C [ A , B ]) β D [ D [ D [ X.Ξ· B β Y.Ξ· B ] β Fβ f ] β‘ D [ Hβ f β D [ X.Ξ· A β Y.Ξ· A ] ] ]
commuteβ² {A} {B} f =
begin
D [ D [ X.Ξ· B β Y.Ξ· B ] β Fβ f ]
ββ¨ D.assoc β©
D [ X.Ξ· B β D [ Y.Ξ· B β Fβ f ] ]
ββ¨ D.β-resp-β‘Κ³ (Y.commute f) β©
D [ X.Ξ· B β D [ Gβ f β Y.Ξ· A ] ]
ββ¨ D.assoc β©
D [ D [ X.Ξ· B β Gβ f ] β Y.Ξ· A ]
ββ¨ D.β-resp-β‘Λ‘ (X.commute f) β©
D [ D [ Hβ f β X.Ξ· A ] β Y.Ξ· A ]
ββ¨ D.assoc β©
D [ Hβ f β D [ X.Ξ· A β Y.Ξ· A ] ]
β
where
open D.HomReasoning
-- "Horizontal composition"
_ββ_ : β {oβ ββ eβ oβ ββ eβ oβ ββ eβ}
{C : Category oβ ββ eβ} {D : Category oβ ββ eβ} {E : Category oβ ββ eβ}
{F G : Functor C D} {H I : Functor D E}
β NaturalTransformation H I β NaturalTransformation F G β NaturalTransformation (H βF F) (I βF G)
_ββ_ {C = C} {D} {E} {F} {G} {H} {I} Y X = record
{ Ξ· = Ξ» q β E [ Iβ (X.Ξ· q) β Y.Ξ· (Fβ q) ]
; commute = commuteβ²
}
where
module C = Category C
module D = Category D
module E = Category E
module F = Functor F
module G = Functor G
module H = Functor H
module I = Functor I
module X = NaturalTransformation X
module Y = NaturalTransformation Y
open F
open G renaming (Fβ to Gβ; Fβ to Gβ; F-resp-β‘ to G-resp-β‘)
open H renaming (Fβ to Hβ; Fβ to Hβ; F-resp-β‘ to H-resp-β‘)
open I renaming (Fβ to Iβ; Fβ to Iβ; F-resp-β‘ to I-resp-β‘)
.commuteβ² : β {A B} (f : C [ A , B ]) β E [ E [ E [ Iβ (X.Ξ· B) β Y.Ξ· (Fβ B) ] β Hβ (Fβ f) ] β‘ E [ Iβ (Gβ f) β E [ Iβ (X.Ξ· A) β Y.Ξ· (Fβ A) ] ] ]
commuteβ² {A} {B} f =
begin
E [ E [ Iβ (X.Ξ· B) β Y.Ξ· (Fβ B) ] β Hβ (Fβ f) ]
ββ¨ E.assoc β©
E [ Iβ (X.Ξ· B) β E [ Y.Ξ· (Fβ B) β Hβ (Fβ f) ] ]
ββ¨ E.β-resp-β‘Κ³ (Y.commute (Fβ f)) β©
E [ Iβ (X.Ξ· B) β E [ Iβ (Fβ f) β Y.Ξ· (Fβ A) ] ]
ββ¨ E.assoc β©
E [ E [ Iβ (X.Ξ· B) β Iβ (Fβ f) ] β Y.Ξ· (Fβ A) ]
ββ¨ E.β-resp-β‘Λ‘ I.homomorphism β©
E [ Iβ (D [ X.Ξ· B β Fβ f ]) β Y.Ξ· (Fβ A) ]
ββ¨ E.β-resp-β‘Λ‘ (I-resp-β‘ (X.commute f)) β©
E [ Iβ (D [ Gβ f β X.Ξ· A ]) β Y.Ξ· (Fβ A) ]
ββ¨ E.β-resp-β‘Λ‘ I.homomorphism β©
E [ E [ Iβ (Gβ f) β Iβ (X.Ξ· A) ] β Y.Ξ· (Fβ A) ]
ββ¨ E.assoc β©
E [ Iβ (Gβ f) β E [ Iβ (X.Ξ· A) β Y.Ξ· (Fβ A) ] ]
β
where
open E.HomReasoning
infix 4 _β‘_
_β‘_ : β {o β e oβ² ββ² eβ²} {C : Category o β e} {D : Category oβ² ββ² eβ²} {F G : Functor C D} β Rel (NaturalTransformation F G) (o β eβ²)
_β‘_ {D = D} X Y = β {x} β D [ NaturalTransformation.Ξ· X x β‘ NaturalTransformation.Ξ· Y x ]
.equiv : β {o β e oβ² ββ² eβ²} {C : Category o β e} {D : Category oβ² ββ² eβ²} {F G : Functor C D} β IsEquivalence (_β‘_ {F = F} {G})
equiv {C = C} {D} {F} {G} = record
{ refl = refl
; sym = Ξ» f β sym f
; trans = Ξ» f g β trans f g
}
where
open Category.Equiv D
setoid : β {o β e oβ² ββ² eβ²} {C : Category o β e} {D : Category oβ² ββ² eβ²} {F G : Functor C D} β Setoid _ _
setoid {F = F} {G} = record
{ Carrier = NaturalTransformation F G
; _β_ = _β‘_
; isEquivalence = equiv {F = F}
}
| {
"alphanum_fraction": 0.4865611193,
"avg_line_length": 33.3251533742,
"ext": "agda",
"hexsha": "21d3429bc17d0c0c77bc2b93c7b46847b1d513ba",
"lang": "Agda",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "e41aef56324a9f1f8cf3cd30b2db2f73e01066f2",
"max_forks_repo_licenses": [
"BSD-3-Clause"
],
"max_forks_repo_name": "p-pavel/categories",
"max_forks_repo_path": "Categories/NaturalTransformation/Core.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "e41aef56324a9f1f8cf3cd30b2db2f73e01066f2",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"BSD-3-Clause"
],
"max_issues_repo_name": "p-pavel/categories",
"max_issues_repo_path": "Categories/NaturalTransformation/Core.agda",
"max_line_length": 145,
"max_stars_count": 1,
"max_stars_repo_head_hexsha": "e41aef56324a9f1f8cf3cd30b2db2f73e01066f2",
"max_stars_repo_licenses": [
"BSD-3-Clause"
],
"max_stars_repo_name": "p-pavel/categories",
"max_stars_repo_path": "Categories/NaturalTransformation/Core.agda",
"max_stars_repo_stars_event_max_datetime": "2018-12-29T21:51:57.000Z",
"max_stars_repo_stars_event_min_datetime": "2018-12-29T21:51:57.000Z",
"num_tokens": 2288,
"size": 5432
} |
------------------------------------------------------------------------
-- INCREMENTAL Ξ»-CALCULUS
--
-- Incrementalization as term-to-term transformation with the Nehemiah plugin.
------------------------------------------------------------------------
module Nehemiah.Change.Derive where
open import Nehemiah.Syntax.Type
open import Nehemiah.Syntax.Term
open import Nehemiah.Change.Type
open import Nehemiah.Change.Term
open import Data.Integer
import Parametric.Change.Derive Const ΞBase as Derive
derive-const : Derive.Structure
derive-const (intlit-const n) = intlit (+ 0)
derive-const add-const = absV 4 (Ξ» s ds t dt β add ds dt)
derive-const minus-const = absV 2 (Ξ» t dt β minus dt)
derive-const empty-const = empty
derive-const insert-const = absV 4 (Ξ» s ds t dt β
insert (s ββ int β ds) (t ββ bag β dt) β insert s t)
derive-const union-const = absV 4 (Ξ» s ds t dt β union ds dt)
derive-const negate-const = absV 2 (Ξ» t dt β negate dt)
derive-const flatmap-const = absV 4 (Ξ» s ds t dt β
flatmap (s ββ int β bag β ds) (t ββ bag β dt) β flatmap s t)
derive-const sum-const = absV 2 (Ξ» t dt β sum dt)
open Derive.Structure derive-const public
| {
"alphanum_fraction": 0.6076794658,
"avg_line_length": 37.4375,
"ext": "agda",
"hexsha": "21149a18e05d1a806bc9f49ec251495f16f1c0ab",
"lang": "Agda",
"max_forks_count": 1,
"max_forks_repo_forks_event_max_datetime": "2016-02-18T12:26:44.000Z",
"max_forks_repo_forks_event_min_datetime": "2016-02-18T12:26:44.000Z",
"max_forks_repo_head_hexsha": "39bb081c6f192bdb87bd58b4a89291686d2d7d03",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "inc-lc/ilc-agda",
"max_forks_repo_path": "Nehemiah/Change/Derive.agda",
"max_issues_count": 6,
"max_issues_repo_head_hexsha": "39bb081c6f192bdb87bd58b4a89291686d2d7d03",
"max_issues_repo_issues_event_max_datetime": "2017-05-04T13:53:59.000Z",
"max_issues_repo_issues_event_min_datetime": "2015-07-01T18:09:31.000Z",
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "inc-lc/ilc-agda",
"max_issues_repo_path": "Nehemiah/Change/Derive.agda",
"max_line_length": 78,
"max_stars_count": 10,
"max_stars_repo_head_hexsha": "39bb081c6f192bdb87bd58b4a89291686d2d7d03",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "inc-lc/ilc-agda",
"max_stars_repo_path": "Nehemiah/Change/Derive.agda",
"max_stars_repo_stars_event_max_datetime": "2019-07-19T07:06:59.000Z",
"max_stars_repo_stars_event_min_datetime": "2015-03-04T06:09:20.000Z",
"num_tokens": 348,
"size": 1198
} |
module InferrableFields where
data β : Set where
zero : β
suc : β β β
data Vec A : β β Set where
[] : Vec A zero
_β·_ : β {n} β A β Vec A n β Vec A (suc n)
record SomeVec A : Set where
field n : β
unpack : Vec A n
open SomeVec using (unpack)
pack : β {A n} β Vec A n -> SomeVec A
pack xs = record { unpack = xs }
data _β‘_ {A : Set}(x : A) : A β Set where
refl : x β‘ x
lemPack : β {A}(xs : SomeVec A) β pack (unpack xs) β‘ xs
lemPack xs = refl
| {
"alphanum_fraction": 0.5567226891,
"avg_line_length": 18.3076923077,
"ext": "agda",
"hexsha": "fd83fa80359e7e191d9107ae843c9e9e61e8c429",
"lang": "Agda",
"max_forks_count": 1,
"max_forks_repo_forks_event_max_datetime": "2019-03-05T20:02:38.000Z",
"max_forks_repo_forks_event_min_datetime": "2019-03-05T20:02:38.000Z",
"max_forks_repo_head_hexsha": "c0ae7d20728b15d7da4efff6ffadae6fe4590016",
"max_forks_repo_licenses": [
"BSD-3-Clause"
],
"max_forks_repo_name": "redfish64/autonomic-agda",
"max_forks_repo_path": "test/Succeed/InferrableFields.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "c0ae7d20728b15d7da4efff6ffadae6fe4590016",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"BSD-3-Clause"
],
"max_issues_repo_name": "redfish64/autonomic-agda",
"max_issues_repo_path": "test/Succeed/InferrableFields.agda",
"max_line_length": 55,
"max_stars_count": 3,
"max_stars_repo_head_hexsha": "c0ae7d20728b15d7da4efff6ffadae6fe4590016",
"max_stars_repo_licenses": [
"BSD-3-Clause"
],
"max_stars_repo_name": "redfish64/autonomic-agda",
"max_stars_repo_path": "test/Succeed/InferrableFields.agda",
"max_stars_repo_stars_event_max_datetime": "2015-12-07T20:14:00.000Z",
"max_stars_repo_stars_event_min_datetime": "2015-03-28T14:51:03.000Z",
"num_tokens": 179,
"size": 476
} |
-- {-# OPTIONS -v scope.operators:100 #-}
module Issue675 where
data D : Set where
d : D β D
Foo : {x : D} β Setβ
Foo {x = D.d x} = Set
-- qualified constructors should also work in hidden arguments
| {
"alphanum_fraction": 0.645320197,
"avg_line_length": 20.3,
"ext": "agda",
"hexsha": "53beaeb30d2e0c56fff4ebd657bc8222d84dbfb5",
"lang": "Agda",
"max_forks_count": 371,
"max_forks_repo_forks_event_max_datetime": "2022-03-30T19:00:30.000Z",
"max_forks_repo_forks_event_min_datetime": "2015-01-03T14:04:08.000Z",
"max_forks_repo_head_hexsha": "7f58030124fa99dfbf8db376659416f3ad8384de",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "cruhland/agda",
"max_forks_repo_path": "test/Succeed/Issue675.agda",
"max_issues_count": 4066,
"max_issues_repo_head_hexsha": "7f58030124fa99dfbf8db376659416f3ad8384de",
"max_issues_repo_issues_event_max_datetime": "2022-03-31T21:14:49.000Z",
"max_issues_repo_issues_event_min_datetime": "2015-01-10T11:24:51.000Z",
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "cruhland/agda",
"max_issues_repo_path": "test/Succeed/Issue675.agda",
"max_line_length": 62,
"max_stars_count": 1989,
"max_stars_repo_head_hexsha": "7f58030124fa99dfbf8db376659416f3ad8384de",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "cruhland/agda",
"max_stars_repo_path": "test/Succeed/Issue675.agda",
"max_stars_repo_stars_event_max_datetime": "2022-03-30T18:20:48.000Z",
"max_stars_repo_stars_event_min_datetime": "2015-01-09T23:51:16.000Z",
"num_tokens": 62,
"size": 203
} |
module Functor where
open import Level
import Data.Nat as N
open import Basic
open import Category
open Category.Category
record Functor {cβ cβ β cββ² cββ² ββ²} (C : Category cβ cβ β) (D : Category cββ² cββ² ββ²) : Set (suc (cβ β cββ² β cβ β cββ² β β β ββ²)) where
field
fobj : Obj C β Obj D
fmapsetoid : {A B : Obj C} β Map.Map (Homsetoid C A B) (Homsetoid D (fobj A) (fobj B))
fmap : {A B : Obj C} β Hom C A B β Hom D (fobj A) (fobj B)
fmap {A} {B} = Map.Map.mapping (fmapsetoid {A} {B})
field
preserveId : {A : Obj C} β D [ fmap (id C {A}) β id D {fobj A} ]
preserveComp : {a b c : Obj C} {f : Hom C b c} {g : Hom C a b} β D [ fmap (C [ f β g ]) β (D [ fmap f β fmap g ]) ]
open Functor
preserveEq : β {cβ cβ β cββ² cββ² ββ²} {C : Category cβ cβ β} {D : Category cββ² cββ² ββ²} {A B : Obj C} {x y : Hom C A B} (F : Functor C D) β C [ x β y ] β D [ fmap F x β fmap F y ]
preserveEq F xy = Map.Map.preserveEq (fmapsetoid F) xy
compose : β {cβ cβ β cββ² cββ² ββ² cββ³ cββ³ ββ³} {C : Category cβ cβ β} {D : Category cββ² cββ² ββ²} {E : Category cββ³ cββ³ ββ³} β Functor {cββ²} {cββ²} {ββ²} {cββ³} {cββ³} {ββ³} D E β Functor {cβ} {cβ} {β} {cββ²} {cββ²} {ββ²} C D β Functor {cβ} {cβ} {β} {cββ³} {cββ³} {ββ³} C E
compose {C = C} {D} {E} G F = record {
fobj = Ξ» x β fobj G (fobj F x);
fmapsetoid = record { mapping = Ξ» f β fmap G (fmap F f) ; preserveEq = Ξ» {x} {y} xβy β beginβ¨ E β©
fmap G (fmap F x) ββ¨ preserveEq G (beginβ¨ D β©
fmap F x ββ¨ preserveEq F xβy β©
fmap F y β) β©
fmap G (fmap F y) β
};
preserveId = beginβ¨ E β©
fmap G (fmap F (id C)) ββ¨ preserveEq G (preserveId F) β©
fmap G (id D) ββ¨ preserveId G β©
(id E) β;
preserveComp = Ξ» {_} {_} {_} {f} {g} β beginβ¨ E β©
fmap G (fmap F (C [ f β g ])) ββ¨ preserveEq G (preserveComp F) β©
fmap G (D [ fmap F f β fmap F g ]) ββ¨ preserveComp G β©
(E [ fmap G (fmap F f) β fmap G (fmap F g) ]) β
}
identity : β {cβ cβ β} (C : Category cβ cβ β) β Functor {cβ} {cβ} {β} {cβ} {cβ} {β} C C
identity C = record {
fobj = Ξ» x β x ;
fmapsetoid = record { mapping = Ξ» x β x ; preserveEq = Ξ» xβ β xβ } ;
preserveId = refl-hom C ; preserveComp = refl-hom C }
exp : β {cβ cβ β} {C : Category cβ cβ β} β Functor C C β N.β β Functor C C
exp {C = C} F N.zero = identity C
exp F (N.suc N.zero) = F
exp F (N.suc n) = compose F (exp F n)
data _[_~_]
{Cβ Cβ β : Level} (C : Category Cβ Cβ β) {A B : Obj C} (f : Hom C A B)
: β{X Y : Obj C} β Hom C X Y β Set (suc (Cβ β Cβ β β)) where
eqArrow : {g : Hom C A B} β C [ f β g ] β C [ f ~ g ]
eqArrowRefl : β {cβ cβ β} (C : Category cβ cβ β) {A B : Obj C} {f : Hom C A B} β C [ f ~ f ]
eqArrowRefl C = eqArrow (refl-hom C)
eqArrowSym : β {cβ cβ β} (C : Category cβ cβ β) {X Y Z W : Obj C} {f : Hom C X Y} {g : Hom C Z W} β C [ f ~ g ] β C [ g ~ f ]
eqArrowSym C (eqArrow f~g) = eqArrow (sym-hom C f~g)
eqArrowTrans : β {cβ cβ β} (C : Category cβ cβ β) {X Y Z W S T : Obj C} {f : Hom C X Y} {g : Hom C Z W} {h : Hom C S T} β C [ f ~ g ] β C [ g ~ h ] β C [ f ~ h ]
eqArrowTrans C (eqArrow f~g) (eqArrow g~h) = eqArrow (trans-hom C f~g g~h)
eqArrowFmap : β {cβ cβ β cββ² cββ² ββ²} {C : Category cβ cβ β} {D : Category cββ² cββ² ββ²} {X Y Z W : Obj C} {x : Category.Hom C X Y} {y : Category.Hom C Z W} (F : Functor C D) β C [ x ~ y ] β D [ fmap F x ~ fmap F y ]
eqArrowFmap F (eqArrow x~y) = eqArrow (preserveEq F x~y)
equality : β {cβ cβ β} {C D : Category cβ cβ β} β (F G : Functor C D) β _
equality {C = C} {D} F G = β {A B : Obj C} (f : Hom C A B) β D [ fmap F f ~ fmap G f ]
Cat : β {cβ cβ β} β Category (suc (cβ β cβ β β)) _ _
Cat {cβ} {cβ} {β} = record {
Obj = Category cβ cβ β;
Homsetoid = Ξ» A B β record {
Carrier = Functor A B ; _β_ = equality ;
isEquivalence = record {
refl = Ξ» f β eqArrowRefl B ;
sym = Ξ» x f β eqArrowSym B (x f);
trans = Ξ» x xβ f β eqArrowTrans B (x f) (xβ f) } };
comp = compose;
id = Ξ» {A} β identity A;
leftId = Ξ» {A} {B} {f} fβ β eqArrow (refl-hom B);
rightId = Ξ» {A} {B} {f} fβ β eqArrow (refl-hom B);
assoc = Ξ» {A} {B} {C} {D} {f} {g} {h} fβ β eqArrow (beginβ¨ D β©
fmap (compose (compose h g) f) fβ ββ¨ refl-hom D β©
fmap h (fmap g (fmap f fβ)) ββ¨ refl-hom D β©
fmap (compose h (compose g f)) fβ
β);
β-composite = Ξ» {A} {B} {C} {f} {g} {h} {i} f~g h~i fβ β eqArrowTrans C (f~g (fmap h fβ)) (eqArrowFmap g (h~i fβ))
}
| {
"alphanum_fraction": 0.5287329795,
"avg_line_length": 44.2142857143,
"ext": "agda",
"hexsha": "6f1f36cd84452d76867b7ee1f7cf5930bf28b137",
"lang": "Agda",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "59004994acdbc65fb4f8abf0baa1777a8dbe758e",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "myuon/agda-cate",
"max_forks_repo_path": "src/Functor.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "59004994acdbc65fb4f8abf0baa1777a8dbe758e",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "myuon/agda-cate",
"max_issues_repo_path": "src/Functor.agda",
"max_line_length": 256,
"max_stars_count": 2,
"max_stars_repo_head_hexsha": "59004994acdbc65fb4f8abf0baa1777a8dbe758e",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "myuon/agda-cate",
"max_stars_repo_path": "src/Functor.agda",
"max_stars_repo_stars_event_max_datetime": "2019-11-02T07:30:47.000Z",
"max_stars_repo_stars_event_min_datetime": "2018-07-28T04:59:31.000Z",
"num_tokens": 2008,
"size": 4333
} |
-- Bi-Cartesian closed structure of families
module SOAS.Families.BCCC {T : Set} where
open import SOAS.Common
open import SOAS.Context {T}
open import SOAS.Sorting {T}
open import SOAS.Families.Core {T}
open import SOAS.Families.Isomorphism {T}
import Categories.Category.CartesianClosed.Canonical as Canonical
import Categories.Category.CartesianClosed as CCC
import Categories.Category.Cartesian as Cart
open import Categories.Category.Cocartesian
open import Categories.Category.BicartesianClosed
import Categories.Object.Initial as Initial
open import Categories.Category.Monoidal
import Data.Unit as Unit
import Data.Empty as Empty
-- | Unsorted
-- Category of families is Cartesian closed
π½am-CanCCC : Canonical.CartesianClosed π½amilies
π½am-CanCCC = record
{ β€ = Ξ» Ξ β Unit.β€
; _Γ_ = Ξ» X Y Ξ β X Ξ Γ Y Ξ
; ! = Ξ» _ β Unit.tt
; Οβ = projβ
; Οβ = projβ
; β¨_,_β© = Ξ» f g x β f x , g x
; !-unique = Ξ» f β refl
; Οβ-comp = refl
; Οβ-comp = refl
; β¨,β©-unique = Ξ» pβ pβ {Ξ}{x} β sym (congβ _,_ pβ pβ)
; _^_ = Ξ» X Y Ξ β Y Ξ β X Ξ
; eval = Ξ»{ (f , x) β f x}
; curry = Ξ» f x y β f (x , y)
; eval-comp = refl
; curry-resp-β = Ξ»{X}{Y}{Z}{f}{g} p β ext (Ξ» x β p)
; curry-unique = Ξ» p β ext (Ξ» x β p)
}
π½am-CCC : CCC.CartesianClosed π½amilies
π½am-CCC = Canonical.Equivalence.fromCanonical _ π½am-CanCCC
module π½am-CCC = CCC.CartesianClosed π½am-CCC
-- Category of families is co-Cartesian
π½am-Cocartesian : Cocartesian π½amilies
π½am-Cocartesian = record
{ initial = record { β₯ = Ξ» Ξ β Empty.β₯ ; β₯-is-initial = record { ! = Ξ» () ; !-unique = Ξ»{ f {Ξ} {()}} } }
; coproducts = record { coproduct = Ξ»{X}{Y} β record
{ A+B = Ξ» Ξ β X Ξ β Y Ξ
; iβ = injβ
; iβ = injβ
; [_,_] = Ξ»{ f g (injβ x) β f x ; f g (injβ y) β g y}
; injectβ = refl
; injectβ = refl
; unique = Ξ»{ pβ pβ {Ξ} {injβ x} β sym pβ ; pβ pβ {Ξ} {injβ y} β sym pβ}
} }
}
module π½am-Cocart = Cocartesian π½am-Cocartesian
-- Category of families is bi-Cartesian closed
π½am-BCCC : BicartesianClosed π½amilies
π½am-BCCC = record { cartesianClosed = π½am-CCC ; cocartesian = π½am-Cocartesian }
module π½am-BCCC = BicartesianClosed π½am-BCCC
-- Shorthand for family product and sum and exponential
_Γβ_ : Family β Family β Family
_Γβ_ = π½am-CCC._Γ_
_+β_ : Family β Family β Family
_+β_ = π½am-Cocart._+_
_β¨_ : Family β Family β Family
_β¨_ = π½am-CCC._β¨_
infixr 25 _β¨_
β€β : Family
β€β Ξ = Unit.β€
private variable X Y Z W : Family
curryβ-iso : (X Γβ Y βΎ Z) β
β (X βΎ Y β¨ Z)
curryβ-iso = record
{ from = Ξ» f x y β f (x , y)
; to = Ξ»{ f (x , y) β f x y }
; iso = record { isoΛ‘ = refl ; isoΚ³ = refl }
}
-- Congruence for indexed families of functions
βΎ-cong : X β
β Y β W β
β Z β (X βΎ W) β
β (Y βΎ Z)
βΎ-cong Xβ
Y Wβ
Z = record
{ from = Ξ» f y β _β
β_.from Wβ
Z (f (_β
β_.to Xβ
Y y))
; to = Ξ» g x β _β
β_.to Wβ
Z (g (_β
β_.from Xβ
Y x))
; iso = record
{ isoΛ‘ = Ξ» {f} β dextβ² (trans (_β
β_.isoΛ‘ Wβ
Z) (cong f (_β
β_.isoΛ‘ Xβ
Y)))
; isoΚ³ = Ξ» {g} β dextβ² (trans (_β
β_.isoΚ³ Wβ
Z) (cong g (_β
β_.isoΚ³ Xβ
Y)))
}
}
βΎ-β
dom : X β
β Y β (X βΎ W) β
β (Y βΎ W)
βΎ-β
dom Xβ
Y = βΎ-cong Xβ
Y β
β.refl
βΎ-β
cod : W β
β Z β (X βΎ W) β
β (X βΎ Z)
βΎ-β
cod Wβ
Z = βΎ-cong β
β.refl Wβ
Z
-- | Sorted
-- Category of sorted families is Cartesian closed
π½amβ-CanCCC : Canonical.CartesianClosed π½amiliesβ
π½amβ-CanCCC = πorted-CanCCC π½am-CanCCC
π½amβ-CCC : CCC.CartesianClosed π½amiliesβ
π½amβ-CCC = Canonical.Equivalence.fromCanonical _ π½amβ-CanCCC
-- Category of sorted families is co-Cartesian
π½amβ-Cocartesian : Cocartesian π½amiliesβ
π½amβ-Cocartesian = πorted-Cocartesian π½am-Cocartesian
-- Category of sorted families is bi-Cartesian closed
π½amβ-BCCC : BicartesianClosed π½amiliesβ
π½amβ-BCCC = πorted-BCCC π½am-BCCC
module π½amβ-CCC = CCC.CartesianClosed π½amβ-CCC
module π½amβ-Cocart = Cocartesian π½amβ-Cocartesian
π½amβ-Mon : Monoidal π½amiliesβ
π½amβ-Mon = Cart.CartesianMonoidal.monoidal π½amiliesβ π½amβ-CCC.cartesian
-- Shorthand for sorted family product and sum and exponential
_ΓΜ£β_ : Familyβ β Familyβ β Familyβ
_ΓΜ£β_ = π½amβ-CCC._Γ_
_+Μ£β_ : Familyβ β Familyβ β Familyβ
_+Μ£β_ = π½amβ-Cocart._+_
_β¨Μ£_ : Familyβ β Familyβ β Familyβ
_β¨Μ£_ = π½amβ-CCC._β¨_
infixr 25 _β¨Μ£_
| {
"alphanum_fraction": 0.6489874638,
"avg_line_length": 28.2176870748,
"ext": "agda",
"hexsha": "2b273fac2bf8d1ace452a764f53e13f4724d1fb8",
"lang": "Agda",
"max_forks_count": 4,
"max_forks_repo_forks_event_max_datetime": "2022-01-24T12:49:17.000Z",
"max_forks_repo_forks_event_min_datetime": "2021-11-09T20:39:59.000Z",
"max_forks_repo_head_hexsha": "ff1a985a6be9b780d3ba2beff68e902394f0a9d8",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "JoeyEremondi/agda-soas",
"max_forks_repo_path": "SOAS/Families/BCCC.agda",
"max_issues_count": 1,
"max_issues_repo_head_hexsha": "ff1a985a6be9b780d3ba2beff68e902394f0a9d8",
"max_issues_repo_issues_event_max_datetime": "2021-11-21T12:19:32.000Z",
"max_issues_repo_issues_event_min_datetime": "2021-11-21T12:19:32.000Z",
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "JoeyEremondi/agda-soas",
"max_issues_repo_path": "SOAS/Families/BCCC.agda",
"max_line_length": 108,
"max_stars_count": 39,
"max_stars_repo_head_hexsha": "ff1a985a6be9b780d3ba2beff68e902394f0a9d8",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "JoeyEremondi/agda-soas",
"max_stars_repo_path": "SOAS/Families/BCCC.agda",
"max_stars_repo_stars_event_max_datetime": "2022-03-19T17:33:12.000Z",
"max_stars_repo_stars_event_min_datetime": "2021-11-09T20:39:55.000Z",
"num_tokens": 1856,
"size": 4148
} |
module test where
open import Relation.Binary.PropositionalEquality
module NewCodata where
open import Data.Nat
open import Data.List
open import Data.Maybe
record Pair (A B : Set) : Set where
field
fst : A
snd : B
record Stream (A : Set) : Set where
coinductive
field
hd : A
tl : Stream A
open Stream
repeat : β {A : Set} β A β Stream A
hd (repeat x) = x
tl (repeat x) = repeat x
nth : β {A : Set} β β β Stream A β A
nth zero s = hd s
nth (suc n) s = nth n (tl s)
mutual
data ΞΌColist (A : Set) : Set where
[] : ΞΌColist A
_β·_ : (x : A) (xs : Ξ½Colist A) β ΞΌColist A
record Ξ½Colist (A : Set) : Set where
coinductive
field out : ΞΌColist A
open Ξ½Colist
record Ξ½Tree (A : Set) : Set where
coinductive
field label : A
subs : List (Ξ½Tree A)
open Ξ½Tree
append : {A : Set} β List A β Ξ½Colist A β Ξ½Colist A
out (append [] ys) = out ys
out (append (x β· xs) ys) = x β· append xs ys
appendS : {A : Set} β List A β Stream A β Stream A
hd (appendS [] s) = hd s
hd (appendS (x β· xs) s) = x
tl (appendS [] s) = tl s
tl (appendS (x β· xs) s) = tl (appendS xs s)
record Pi (A : Set) (B : A β Set) : Set where
field _$_ : (x : A) β B x
infixl 20 _$_
open Pi
_β'_ : Set β Set β Set
A β' B = Pi A (Ξ» _ β B)
infixr 20 _β'_
plus2 : β β' β
plus2 $ x = suc (suc x)
plus : β β' β β' β
plus $ 0 $ m = m
plus $ (suc n) $ m = suc (plus $ n $ m)
data Vec (A : Set) : β β Set where
nil : Vec A 0
_:::_ : {n : β} β A β Vec A n β Vec A (suc n)
test : Vec β 2
test = 2 ::: (2 ::: nil)
repeat2V : Pi β (Ξ» n β Vec β n)
repeat2V $ 0 = nil
repeat2V $ suc n = 2 ::: (repeat2V $ n)
{-
bf : {A : Set} β List (Ξ½Tree A) β Ξ½Colist A
out (bf []) = []
out (bf (t β· ts)) = label t β·
append (map label ts)
(bf (concatMap subs (t β· ts)))
-}
record ββ : Set where
coinductive
field
predβ : Maybe ββ
open ββ
infinity : ββ
predβ infinity = just infinity
zeroβ : ββ
predβ zeroβ = nothing
oneβ : ββ
predβ oneβ = just zeroβ
sucβ : ββ β ββ
predβ (sucβ x) = just x
plusβ : ββ β ββ β ββ
predβ (plusβ n m) with predβ n
... | nothing = predβ m
... | just n' = just (plusβ n' m)
{-
record PStr (A : Set) (n : ββ) : Set where
coinductive
field
phd : (k : ββ) β PStr A (sucβ k) β A
ptl : (k : ββ) β PStr A (sucβ k) β PStr A k
-}
module OldCodata where
open import Codata.Musical.Notation
open import Data.Nat
data Stream (A : Set) : Set where
cons : A β β (Stream A) β Stream A
repeat : {A : Set} β A β Stream A
repeat x = cons x (β― (repeat x))
nth : {A : Set} β β β Stream A β A
nth 0 (cons x _) = x
nth (suc n) (cons _ xs) = nth n (β xs)
data ββ : Set where
zeroβ : ββ
sucβ : β (ββ) β ββ
infinity : ββ
infinity = sucβ (β― infinity)
module NonTerminating where
open import Data.Nat
{-
_/_ : β β β β β
zero / y = zero
suc x / y = suc ( (x βΈ y) / y)
-}
module PositiveSizedTypes where
open import Agda.Builtin.Size
data β : Size β Set where
zero : {i : Size} β β i
suc : {i : Size} β β i β β (β i)
one : β β
one = suc zero
two : β β
two = suc one
three : β β
three = suc two
four : β β
four = suc three
five : β β
five = suc four
_-_ : {i : Size} β β i β β β β β i
zero - _ = zero
n - zero = n
(suc n) - (suc m) = n - m
infixl 20 _-_
-testβ : five - two β‘ three
-testβ = refl
_/_ : {i : Size} β β i β β β β β i
zero / _ = zero
suc x / y = suc ( (x - y) / y)
infixl 30 _/_
_+_ : β β β β β β β β
zero + y = y
suc x + y = suc (x + y)
infixl 20 _+_
_*_ : β β β β β β β β
zero * _ = zero
suc x * y = x + x * y
infixl 30 _*_
min : {i : Size} β β i β β i β β i
min zero _ = zero
min _ zero = zero
min (suc m) (suc n) = suc (min m n)
testβ : zero / zero β‘ zero
testβ = refl
testβ : zero / five β‘ zero
testβ = refl
testβ : one / one β‘ one
testβ = refl
testβ : two / two β‘ one
testβ = refl
testβ
: five / five β‘ one
testβ
= refl
testβ : one / zero β‘ one
testβ = refl
testβ : two / one β‘ one
testβ = refl
testβ : four / two β‘ two
testβ = refl
module NegativSizedTypes where
open import Agda.Builtin.Size
open import Data.Nat
open import Data.Bool using (if_then_else_)
open import Relation.Nullary.Decidable using (β_β)
record Stream (i : Size) (A : Set) : Set where
coinductive
field
hd : A
tl : β {j : Size< i} β Stream j A
open Stream
cons : {i : Size} {A : Set} β A -> Stream i A β Stream i A
hd (cons x _) = x
tl (cons _ xs) = xs
map : {A B : Set} {i : Size} β (A β B) β Stream i A β Stream i B
hd (map f xs) = f (hd xs)
tl (map f xs) = map f (tl xs)
merge : {i : Size} β Stream i β β Stream i β β Stream i β
hd (merge xs ys) = hd xs β hd ys
tl (merge xs ys) = if β hd xs β€? hd ys β
then cons (hd ys) (merge (tl xs) (tl ys))
else cons (hd xs) (merge (tl xs) (tl ys))
ham : {i : Size} β Stream i β
hd ham = 1
tl ham = (merge (map (_*_ 2) ham) (map (_*_ 3) ham))
| {
"alphanum_fraction": 0.503948853,
"avg_line_length": 21.272,
"ext": "agda",
"hexsha": "1aff282ebdecfdb8002d87d17de46eb12a9401fd",
"lang": "Agda",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "68afff2b0a7183751737ef20e713df1fef3d4cf2",
"max_forks_repo_licenses": [
"BSD-3-Clause"
],
"max_forks_repo_name": "StillerHarpo/masterarbeit",
"max_forks_repo_path": "doc/test.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "68afff2b0a7183751737ef20e713df1fef3d4cf2",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"BSD-3-Clause"
],
"max_issues_repo_name": "StillerHarpo/masterarbeit",
"max_issues_repo_path": "doc/test.agda",
"max_line_length": 66,
"max_stars_count": null,
"max_stars_repo_head_hexsha": "68afff2b0a7183751737ef20e713df1fef3d4cf2",
"max_stars_repo_licenses": [
"BSD-3-Clause"
],
"max_stars_repo_name": "StillerHarpo/masterarbeit",
"max_stars_repo_path": "doc/test.agda",
"max_stars_repo_stars_event_max_datetime": null,
"max_stars_repo_stars_event_min_datetime": null,
"num_tokens": 2141,
"size": 5318
} |
{-# OPTIONS --show-implicit #-}
module BottomUp1 where
record R (_ : Set) : Set where
no-eta-equality
record S (F : Set β Set)
β¦ _ : {A : Set} β R (F A) β¦
: Set where
module M0 where
private
postulate
F : Set β Set
instance Ri : {A : Set} β R (F A)
instance Si : S F
module M1 (_ : Set) where
private
postulate
F : Set β Set
instance Ri : {A : Set} β R (F A)
instance Si-works : S F β¦ Ri β¦
instance Si-fails : S F
{- No instance of type R (F A) was found in scope. -}
| {
"alphanum_fraction": 0.5317604356,
"avg_line_length": 20.4074074074,
"ext": "agda",
"hexsha": "ced1fb32ee21c7a4909f3d3b60ebac4e62fb1fca",
"lang": "Agda",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "52e1cdbdee54d9a8eaee04ee518a0d7f61d25afb",
"max_forks_repo_licenses": [
"RSA-MD"
],
"max_forks_repo_name": "m0davis/oscar",
"max_forks_repo_path": "archive/agda-1/BottomUp1.agda",
"max_issues_count": 1,
"max_issues_repo_head_hexsha": "52e1cdbdee54d9a8eaee04ee518a0d7f61d25afb",
"max_issues_repo_issues_event_max_datetime": "2019-05-11T23:33:04.000Z",
"max_issues_repo_issues_event_min_datetime": "2019-04-29T00:35:04.000Z",
"max_issues_repo_licenses": [
"RSA-MD"
],
"max_issues_repo_name": "m0davis/oscar",
"max_issues_repo_path": "archive/agda-1/BottomUp1.agda",
"max_line_length": 59,
"max_stars_count": null,
"max_stars_repo_head_hexsha": "52e1cdbdee54d9a8eaee04ee518a0d7f61d25afb",
"max_stars_repo_licenses": [
"RSA-MD"
],
"max_stars_repo_name": "m0davis/oscar",
"max_stars_repo_path": "archive/agda-1/BottomUp1.agda",
"max_stars_repo_stars_event_max_datetime": null,
"max_stars_repo_stars_event_min_datetime": null,
"num_tokens": 187,
"size": 551
} |
open import Data.ByteString using ( lazy ; strict )
open import System.IO using ( _>>_ ; _>>=_ ; getBytes ; putStr ; commit )
module System.IO.Examples.DevNull where
main =
getBytes {lazy} >>= Ξ» bs β
putStr "Done.\n" >>
commit
| {
"alphanum_fraction": 0.6638297872,
"avg_line_length": 23.5,
"ext": "agda",
"hexsha": "a5c768af937385ec538265dbae0c4edc52ed3553",
"lang": "Agda",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "d06c219c7b7afc85aae3b1d4d66951b889aa7371",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "ilya-fiveisky/agda-system-io",
"max_forks_repo_path": "src/System/IO/Examples/DevNull.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "d06c219c7b7afc85aae3b1d4d66951b889aa7371",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "ilya-fiveisky/agda-system-io",
"max_issues_repo_path": "src/System/IO/Examples/DevNull.agda",
"max_line_length": 73,
"max_stars_count": null,
"max_stars_repo_head_hexsha": "d06c219c7b7afc85aae3b1d4d66951b889aa7371",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "ilya-fiveisky/agda-system-io",
"max_stars_repo_path": "src/System/IO/Examples/DevNull.agda",
"max_stars_repo_stars_event_max_datetime": null,
"max_stars_repo_stars_event_min_datetime": null,
"num_tokens": 67,
"size": 235
} |
module Data.Fin.Substitution.Lemmas.Extra where
import Function as Fun
open import Data.Nat
open import Data.Fin hiding (_+_)
open import Data.Fin.Substitution
open import Data.Fin.Substitution.Lemmas
open import Data.Vec.Properties
open import Data.Vec
open import Data.Star using (_β
_ ; Ξ΅)
open import Function hiding (id)
open import Relation.Binary.PropositionalEquality
open β‘-Reasoning
module AdditionalLemmas {T} (lemmas : TermLemmas T) where
open TermLemmas lemmas
module Var = VarSubst
-- Weakening commutes with single-variable substitution
weaken-sub : β {n} (a : T (1 + n)) (b : T n) β
weaken (a / sub b) β‘ a / wk β / sub (weaken b)
weaken-sub a b = begin
weaken (a / sub b) β‘β¨ sym (/-wkβ² (a / sub b)) β©
a / sub b / wk β‘β¨ sub-commutes a β©
a / wk β / sub (b / wk) β‘β¨ cong (Ξ» c β a / wk β / sub c) (/-wkβ² b) β©
a / wk β / sub (weaken b) β
where /-wkβ² : β {n} (a : T n) β a / wk β‘ weaken a
/-wkβ² a = /-wk {t = a}
-- Weakening commutes with reverse composition of substitutions.
map-weaken-β : β {m n k} (Οβ : Sub T m n) (Οβ : Sub T n k) β
map weaken (Οβ β Οβ) β‘ (map weaken Οβ) β (Οβ β)
map-weaken-β Οβ Οβ = begin
map weaken (Οβ β Οβ) β‘β¨ map-weaken β©
(Οβ β Οβ) β wk β‘β¨ sym β-assoc β©
Οβ β (Οβ β wk) β‘β¨ cong (Ξ» Οβ β Οβ β Οβ) β-wk β©
Οβ β (wk β (Οβ β)) β‘β¨ β-assoc β©
(Οβ β wk) β (Οβ β) β‘β¨ cong (Ξ» Οβ β Οβ β (Οβ β)) (sym map-weaken) β©
(map weaken Οβ) β (Οβ β) β
weakenββ : β {Ξ½ ΞΌ} (x : T Ξ½) (s : Sub T Ξ½ ΞΌ) β (weaken x) / (s β) β‘ weaken (x / s)
weakenββ x s = begin
(weaken x) / (s β) β‘β¨ cong (Ξ» u β u / (s β)) (sym /-wk) β©
x / wk / (s β) β‘β¨ sym (/-β x) β©
x / (wk β (s β)) β‘β¨ cong (_/_ x) (sym β-wk) β©
x / (s β wk) β‘β¨ /-β x β©
x / s / wk β‘β¨ /-wk β©
weaken (x / s) β
weaken-sub-vanishes : β {Ξ½} {a b : T Ξ½} β (weaken a) / (sub b) β‘ a
weaken-sub-vanishes {Ξ½} {a} {b} = begin
(weaken a) / (sub b) β‘β¨ cong (flip _/_ (sub b)) (sym $ /-wk {t = a}) β©
a / wk / (sub b) β‘β¨ wk-sub-vanishes a β©
a β
-- make /Var usable from lemmas
open TermSubst termSubst using (_/Var_) public
private
varβweaken : β {n} β _β_ {A = Fin n} (var β suc) (weaken β var)
varβweaken n = begin
var (suc n) β‘β¨ sym $ lookup-wk n β©
lookup n wk β‘β¨ sym $ var-/ β©
(var n) / wk β‘β¨ /-wk β©
weaken (var n) β
map-varβweaken : β {n m} {v : Vec (Fin n) m} β map var (map suc v) β‘ map weaken (map var v)
map-varβweaken {v = v} = begin
map var (map suc v) β‘β¨ sym $ map-β var suc v β©
map (var β suc) v β‘β¨ map-cong varβweaken v β©
map (weaken β var) v β‘β¨ map-β weaken var v β©
map weaken (map var v) β
map-var-varidβ‘id : β {n} β map var (Var.id {n}) β‘ id {n}
map-var-varidβ‘id {zero} = refl
map-var-varidβ‘id {suc n} = begin
var zero β· (map var $ map suc Var.id)
β‘β¨ cong (_β·_ (var zero)) map-varβweaken β©
var zero β· (map weaken $ map var Var.id)
β‘β¨ cong (Ξ» u β var zero β· (map weaken u)) map-var-varidβ‘id β©
id β β
map-var-varwkβ‘wk : β {n} β map var (Var.wk {n}) β‘ wk {n}
map-var-varwkβ‘wk {zero} = refl
map-var-varwkβ‘wk {suc n} = begin
map var (map suc Var.id) β‘β¨ map-varβweaken β©
map weaken (map var Var.id) β‘β¨ cong (map weaken) map-var-varidβ‘id β©
wk β
map-var-β : β {n m} {s : Vec (Fin n) m} {s'} β map var s β‘ s' β map var (s Var.β) β‘ s' β
map-var-β {s = s} {s' = s'} eq = begin
var zero β· (map var $ map suc s)
β‘β¨ cong (_β·_ $ var zero) map-varβweaken β©
var zero β· (map weaken $ map var s)
β‘β¨ cong (Ξ» u β var zero β· (map weaken u)) eq β©
s' β β
a/wkβ/sub0β‘a : β {Ξ½} (a : T (suc Ξ½)) β a / wk β / (sub $ var zero) β‘ a
a/wkβ/sub0β‘a a = begin
a / wk β / (sub $ var zero)
β‘β¨ sym $ /-β a β©
a / (var zero / (sub $ var zero) β· map /-var-zero (map weaken wk))
β‘β¨ cong (Ξ» u β a / (u β· map /-var-zero (map weaken wk))) var-/ β©
a / (var zero β· map /-var-zero (map weaken wk))
β‘β¨ cong' (sym $ map-β /-var-zero weaken wk) β©
a / (var zero β· map (Ξ» t β (weaken t) / (sub $ var zero)) wk)
β‘β¨ cong' (map-cong (Ξ» t β weaken-sub-vanishes) wk) β©
a / (var zero β· map Fun.id wk)
β‘β¨ cong' (map-id wk) β©
a / ((var zero β· wk))
β‘β¨ id-vanishes a β©
a β
where
/-var-zero = (Ξ» t β t / (sub $ var zero))
cong' : β {x y} β x β‘ y β a / (var zero β· x) β‘ a / (var zero β· y)
cong' = Ξ» rest β cong (Ξ» u β a / (var zero β· u)) rest
lookup-lift-β· : β {v w} k x {b}{Ο : Sub T v w} β lookup (lift k suc x) ((b β· Ο) ββ k) β‘ lookup x (Ο ββ k)
lookup-lift-β· zero zero = refl
lookup-lift-β· zero (suc x) = refl
lookup-lift-β· (suc k) zero = refl
lookup-lift-β· (suc k) (suc x) {b} {Ο} = begin
lookup (lift k suc x) (map (Ξ» t β t /Var Var.wk) ((b β· Ο) ββ k))
β‘β¨ lookup-map (lift k suc x) (Ξ» t β t /Var Var.wk) ((b β· Ο) ββ k) β©
lookup (lift k suc x) ((b β· Ο) ββ k) /Var Var.wk
β‘β¨ cong (Ξ» t β t /Var Var.wk) (lookup-lift-β· k x) β©
lookup x (Ο ββ k) /Var Var.wk
β‘β¨ sym (lookup-map x (Ξ» t β t /Var Var.wk) (Ο ββ k)) β©
lookup x (map (Ξ» t β t /Var Var.wk) (Ο ββ k))
β
wk-β· : β {Ξ½ Ξ½'} (a : T Ξ½)(Ο : Sub T Ξ½ Ξ½'){b} β a / wk / (b β· Ο) β‘ a / Ο
wk-β· a Ο {b} = begin
a / wk / (b β· Ο)
β‘β¨ /βΆ-ββΆ ((b β· Ο) β
wk β
Ξ΅) (Ο β
Ξ΅) (Ξ» k x β begin
(var x) /βΆ ((b β· Ο) β
wk β
Ξ΅) ββΆ k
β‘β¨ refl β©
(var x) / wk ββ k / (b β· Ο) ββ k
β‘β¨ cong (flip _/_ ((b β· Ο) ββ k)) var-/ β©
(lookup x (wk ββ k)) / (b β· Ο) ββ k
β‘β¨ cong (flip _/_ ((b β· Ο) ββ k)) (lookup-wk-ββ k x) β©
(var (lift k suc x)) / (b β· Ο) ββ k
β‘β¨ var-/ β©
lookup (lift k suc x) ((b β· Ο) ββ k)
β‘β¨ lookup-lift-β· k x β©
lookup x (Ο ββ k)
β‘β¨ sym var-/ β©
(var x) /βΆ (Ο β
Ξ΅) ββΆ k β) 0 a β©
a / Ο
β
wkβ-++ : β {Ξ½ Ξ½'} ΞΌ (a : T Ξ½)(Ο : Sub T Ξ½ Ξ½'){Ο'} β a / wkβ ΞΌ / (Ο' ++ Ο) β‘ a / Ο
wkβ-++ zero a Ο {[]} = cong (Ξ» t β t / Ο) (id-vanishes a)
wkβ-++ (suc ΞΌ) a Ο {_ β· Ο'} = begin
a / wkβ (suc ΞΌ) / (_ β· Ο' ++ Ο)
β‘β¨ cong (Ξ» Ο β a / Ο / (_ β· Ο' ++ Ο)) map-weaken β©
a / (wkβ ΞΌ β wk) / (_ β· Ο' ++ Ο)
β‘β¨ cong (Ξ» t β _/_ t (_ β· Ο' ++ Ο)) (/-β a) β©
a / wkβ ΞΌ / wk / (_ β· Ο' ++ Ο)
β‘β¨ wk-β· (a / wkβ ΞΌ) (Ο' ++ Ο) β©
a / wkβ ΞΌ / (Ο' ++ Ο)
β‘β¨ wkβ-++ ΞΌ a Ο β©
a / Ο
β
| {
"alphanum_fraction": 0.4643590959,
"avg_line_length": 38.1144578313,
"ext": "agda",
"hexsha": "2a1b2a8decc180c8a31a094ffb979a4879098a12",
"lang": "Agda",
"max_forks_count": 1,
"max_forks_repo_forks_event_max_datetime": "2021-12-28T17:38:05.000Z",
"max_forks_repo_forks_event_min_datetime": "2021-12-28T17:38:05.000Z",
"max_forks_repo_head_hexsha": "0c096fea1716d714db0ff204ef2a9450b7a816df",
"max_forks_repo_licenses": [
"Apache-2.0"
],
"max_forks_repo_name": "metaborg/mj.agda",
"max_forks_repo_path": "src/Data/Fin/Substitution/Lemmas/Extra.agda",
"max_issues_count": 1,
"max_issues_repo_head_hexsha": "0c096fea1716d714db0ff204ef2a9450b7a816df",
"max_issues_repo_issues_event_max_datetime": "2020-10-14T13:41:58.000Z",
"max_issues_repo_issues_event_min_datetime": "2019-01-13T13:03:47.000Z",
"max_issues_repo_licenses": [
"Apache-2.0"
],
"max_issues_repo_name": "metaborg/mj.agda",
"max_issues_repo_path": "src/Data/Fin/Substitution/Lemmas/Extra.agda",
"max_line_length": 107,
"max_stars_count": 10,
"max_stars_repo_head_hexsha": "0c096fea1716d714db0ff204ef2a9450b7a816df",
"max_stars_repo_licenses": [
"Apache-2.0"
],
"max_stars_repo_name": "metaborg/mj.agda",
"max_stars_repo_path": "src/Data/Fin/Substitution/Lemmas/Extra.agda",
"max_stars_repo_stars_event_max_datetime": "2021-09-24T08:02:33.000Z",
"max_stars_repo_stars_event_min_datetime": "2017-11-17T17:10:36.000Z",
"num_tokens": 3006,
"size": 6327
} |
module Ual.Either where
infix 10 _β¨_
data _β¨_ (A B : Set) : Set where
orL : A β A β¨ B
orR : B β A β¨ B
| {
"alphanum_fraction": 0.5607476636,
"avg_line_length": 15.2857142857,
"ext": "agda",
"hexsha": "199476c1802e31da8805087f59e1079b7870c558",
"lang": "Agda",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "ea0260e1a0612ba581e4283dfb187f531a944dfd",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "brunoczim/ual",
"max_forks_repo_path": "Either.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "ea0260e1a0612ba581e4283dfb187f531a944dfd",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "brunoczim/ual",
"max_issues_repo_path": "Either.agda",
"max_line_length": 32,
"max_stars_count": null,
"max_stars_repo_head_hexsha": "ea0260e1a0612ba581e4283dfb187f531a944dfd",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "brunoczim/ual",
"max_stars_repo_path": "Either.agda",
"max_stars_repo_stars_event_max_datetime": null,
"max_stars_repo_stars_event_min_datetime": null,
"num_tokens": 52,
"size": 107
} |
------------------------------------------------------------------------------
-- Group theory congruence proofs using pattern matching
------------------------------------------------------------------------------
{-# OPTIONS --exact-split #-}
{-# OPTIONS --no-sized-types #-}
{-# OPTIONS --no-universe-polymorphism #-}
{-# OPTIONS --without-K #-}
module LogicalFramework.GroupCongruence where
open import GroupTheory.Base
Β·-cong : β {a b c d} β a β‘ b β c β‘ d β a Β· c β‘ b Β· d
Β·-cong refl refl = refl
Β·-leftCong : β {a b c} β a β‘ b β a Β· c β‘ b Β· c
Β·-leftCong refl = refl
Β·-rightCong : β {a b c} β b β‘ c β a Β· b β‘ a Β· c
Β·-rightCong refl = refl
β»ΒΉ-cong : β {a b} β a β‘ b β a β»ΒΉ β‘ b β»ΒΉ
β»ΒΉ-cong refl = refl
| {
"alphanum_fraction": 0.4278074866,
"avg_line_length": 29.92,
"ext": "agda",
"hexsha": "95828cf7d3eb48616e557e204832d091ab7a8dcb",
"lang": "Agda",
"max_forks_count": 3,
"max_forks_repo_forks_event_max_datetime": "2018-03-14T08:50:00.000Z",
"max_forks_repo_forks_event_min_datetime": "2016-09-19T14:18:30.000Z",
"max_forks_repo_head_hexsha": "2fc9f2b81052a2e0822669f02036c5750371b72d",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "asr/fotc",
"max_forks_repo_path": "notes/thesis/report/LogicalFramework/GroupCongruence.agda",
"max_issues_count": 2,
"max_issues_repo_head_hexsha": "2fc9f2b81052a2e0822669f02036c5750371b72d",
"max_issues_repo_issues_event_max_datetime": "2017-01-01T14:34:26.000Z",
"max_issues_repo_issues_event_min_datetime": "2016-10-12T17:28:16.000Z",
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "asr/fotc",
"max_issues_repo_path": "notes/thesis/report/LogicalFramework/GroupCongruence.agda",
"max_line_length": 78,
"max_stars_count": 11,
"max_stars_repo_head_hexsha": "2fc9f2b81052a2e0822669f02036c5750371b72d",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "asr/fotc",
"max_stars_repo_path": "notes/thesis/report/LogicalFramework/GroupCongruence.agda",
"max_stars_repo_stars_event_max_datetime": "2021-09-12T16:09:54.000Z",
"max_stars_repo_stars_event_min_datetime": "2015-09-03T20:53:42.000Z",
"num_tokens": 208,
"size": 748
} |
------------------------------------------------------------------------
-- The Agda standard library
--
-- Lists where at least one element satisfies a given property
------------------------------------------------------------------------
module Data.List.Any where
open import Data.Empty
open import Data.Fin
open import Function
open import Function.Equality using (_β¨$β©_)
open import Function.Equivalence as Equiv using (module Equivalence)
open import Function.Related as Related hiding (_βΌ[_]_)
open import Data.List as List using (List; []; _β·_)
open import Data.Product as Prod using (β; _Γ_; _,_)
open import Level using (Level; _β_)
open import Relation.Nullary
import Relation.Nullary.Decidable as Dec
open import Relation.Unary using (Decidable) renaming (_β_ to _β_)
open import Relation.Binary hiding (Decidable)
import Relation.Binary.InducedPreorders as Ind
open import Relation.Binary.List.Pointwise as ListEq using ([]; _β·_)
open import Relation.Binary.PropositionalEquality as PropEq
using (_β‘_)
-- Any P xs means that at least one element in xs satisfies P.
data Any {a p} {A : Set a}
(P : A β Set p) : List A β Set (a β p) where
here : β {x xs} (px : P x) β Any P (x β· xs)
there : β {x xs} (pxs : Any P xs) β Any P (x β· xs)
-- Map.
map : β {a p q} {A : Set a} {P : A β Set p} β {Q : A β Set q} β
P β Q β Any P β Any Q
map g (here px) = here (g px)
map g (there pxs) = there (map g pxs)
-- If the head does not satisfy the predicate, then the tail will.
tail : β {a p} {A : Set a} {x : A} {xs : List A} {P : A β Set p} β
Β¬ P x β Any P (x β· xs) β Any P xs
tail Β¬px (here px) = β₯-elim (Β¬px px)
tail Β¬px (there pxs) = pxs
-- Decides Any.
any : β {a p} {A : Set a} {P : A β Set p} β
Decidable P β Decidable (Any P)
any p [] = no Ξ»()
any p (x β· xs) with p x
any p (x β· xs) | yes px = yes (here px)
any p (x β· xs) | no Β¬px = Dec.mapβ² there (tail Β¬px) (any p xs)
-- indexΒ xβxs is the list position (zero-based) which xβxs points to.
index : β {a p} {A : Set a} {P : A β Set p} {xs} β
Any P xs β Fin (List.length xs)
index (here px) = zero
index (there pxs) = suc (index pxs)
------------------------------------------------------------------------
-- List membership and some related definitions
module Membership {c β : Level} (S : Setoid c β) where
private
open module S = Setoid S using (_β_) renaming (Carrier to A)
open module LS = Setoid (ListEq.setoid S)
using () renaming (_β_ to _β_)
-- If a predicate P respects the underlying equality then AnyΒ P
-- respects the list equality.
lift-resp : β {p} {P : A β Set p} β
P Respects _β_ β Any P Respects _β_
lift-resp resp [] ()
lift-resp resp (xβy β· xsβys) (here px) = here (resp xβy px)
lift-resp resp (xβy β· xsβys) (there pxs) =
there (lift-resp resp xsβys pxs)
-- List membership.
infix 4 _β_ _β_
_β_ : A β List A β Set _
x β xs = Any (_β_ x) xs
_β_ : A β List A β Set _
x β xs = Β¬ x β xs
-- Subsets.
infix 4 _β_ _β_
_β_ : List A β List A β Set _
xs β ys = β {x} β x β xs β x β ys
_β_ : List A β List A β Set _
xs β ys = Β¬ xs β ys
-- Equality is respected by the predicate which is used to define
-- _β_.
β-resp-β : β {x} β (_β_ x) Respects _β_
β-resp-β = flip S.trans
-- List equality is respected by _β_.
β-resp-list-β : β {x} β _β_ x Respects _β_
β-resp-list-β = lift-resp β-resp-β
-- _β_ is a preorder.
β-preorder : Preorder _ _ _
β-preorder = Ind.InducedPreorderβ (ListEq.setoid S) _β_ β-resp-list-β
module β-Reasoning where
import Relation.Binary.PreorderReasoning as PreR
open PreR β-preorder public
renaming (_βΌβ¨_β©_ to _ββ¨_β©_)
infix 1 _ββ¨_β©_
_ββ¨_β©_ : β x {xs ys} β x β xs β xs IsRelatedTo ys β x β ys
x ββ¨ xβxs β© xsβys = (begin xsβys) xβxs
-- A variant of List.map.
map-with-β : β {b} {B : Set b}
(xs : List A) β (β {x} β x β xs β B) β List B
map-with-β [] f = []
map-with-β (x β· xs) f = f (here S.refl) β· map-with-β xs (f β there)
-- Finds an element satisfying the predicate.
find : β {p} {P : A β Set p} {xs} β
Any P xs β β Ξ» x β x β xs Γ P x
find (here px) = (_ , here S.refl , px)
find (there pxs) = Prod.map id (Prod.map there id) (find pxs)
lose : β {p} {P : A β Set p} {x xs} β
P Respects _β_ β x β xs β P x β Any P xs
lose resp xβxs px = map (flip resp px) xβxs
-- The code above instantiated (and slightly changed) for
-- propositional equality, along with some additional definitions.
module Membership-β‘ where
private
open module M {a} {A : Set a} = Membership (PropEq.setoid A) public
hiding (lift-resp; lose; β-preorder; module β-Reasoning)
lose : β {a p} {A : Set a} {P : A β Set p} {x xs} β
x β xs β P x β Any P xs
lose {P = P} = M.lose (PropEq.subst P)
-- _β_ is a preorder.
β-preorder : β {a} β Set a β Preorder _ _ _
β-preorder A = Ind.InducedPreorderβ (PropEq.setoid (List A)) _β_
(PropEq.subst (_β_ _))
-- Set and bag equality and related preorders.
open Related public
using (Kind; Symmetric-kind)
renaming ( implication to subset
; reverse-implication to superset
; equivalence to set
; injection to subbag
; reverse-injection to superbag
; bijection to bag
)
[_]-Order : Kind β β {a} β Set a β Preorder _ _ _
[ k ]-Order A = Related.InducedPreorderβ k (_β_ {A = A})
[_]-Equality : Symmetric-kind β β {a} β Set a β Setoid _ _
[ k ]-Equality A = Related.InducedEquivalenceβ k (_β_ {A = A})
infix 4 _βΌ[_]_
_βΌ[_]_ : β {a} {A : Set a} β List A β Kind β List A β Set _
_βΌ[_]_ {A = A} xs k ys = Preorder._βΌ_ ([ k ]-Order A) xs ys
-- Bag equality implies the other relations.
bag-=β : β {k a} {A : Set a} {xs ys : List A} β
xs βΌ[ bag ] ys β xs βΌ[ k ] ys
bag-=β xsβys = ββ xsβys
-- "Equational" reasoning for _β_.
module β-Reasoning where
import Relation.Binary.PreorderReasoning as PreR
private
open module PR {a} {A : Set a} = PreR (β-preorder A) public
renaming (_βΌβ¨_β©_ to _ββ¨_β©_; _ββ¨_β©_ to _β‘β¨_β©_)
infixr 2 _βΌβ¨_β©_
infix 1 _ββ¨_β©_
_ββ¨_β©_ : β {a} {A : Set a} x {xs ys : List A} β
x β xs β xs IsRelatedTo ys β x β ys
x ββ¨ xβxs β© xsβys = (begin xsβys) xβxs
_βΌβ¨_β©_ : β {k a} {A : Set a} xs {ys zs : List A} β
xs βΌ[ β k ββ ] ys β ys IsRelatedTo zs β xs IsRelatedTo zs
xs βΌβ¨ xsβys β© ysβzs = xs ββ¨ ββ xsβys β© ysβzs
------------------------------------------------------------------------
-- Another function
-- If any element satisfies P, then P is satisfied.
satisfied : β {a p} {A : Set a} {P : A β Set p} {xs} β
Any P xs β β P
satisfied = Prod.map id Prod.projβ β Membership-β‘.find
| {
"alphanum_fraction": 0.5429398986,
"avg_line_length": 30.9641255605,
"ext": "agda",
"hexsha": "89a0255c3bf8075bcc8b74931042744c7f3d602e",
"lang": "Agda",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "9d4c43b1609d3f085636376fdca73093481ab882",
"max_forks_repo_licenses": [
"Apache-2.0"
],
"max_forks_repo_name": "qwe2/try-agda",
"max_forks_repo_path": "agda-stdlib-0.9/src/Data/List/Any.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "9d4c43b1609d3f085636376fdca73093481ab882",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"Apache-2.0"
],
"max_issues_repo_name": "qwe2/try-agda",
"max_issues_repo_path": "agda-stdlib-0.9/src/Data/List/Any.agda",
"max_line_length": 72,
"max_stars_count": 1,
"max_stars_repo_head_hexsha": "9d4c43b1609d3f085636376fdca73093481ab882",
"max_stars_repo_licenses": [
"Apache-2.0"
],
"max_stars_repo_name": "qwe2/try-agda",
"max_stars_repo_path": "agda-stdlib-0.9/src/Data/List/Any.agda",
"max_stars_repo_stars_event_max_datetime": "2016-10-20T15:52:05.000Z",
"max_stars_repo_stars_event_min_datetime": "2016-10-20T15:52:05.000Z",
"num_tokens": 2476,
"size": 6905
} |
------------------------------------------------------------------------
-- The Agda standard library
--
-- Well-founded induction
------------------------------------------------------------------------
{-# OPTIONS --without-K --safe #-}
open import Relation.Binary
module Induction.WellFounded where
open import Data.Product
open import Function
open import Induction
open import Level
open import Relation.Unary
-- When using well-founded recursion you can recurse arbitrarily, as
-- long as the arguments become smaller, and "smaller" is
-- well-founded.
WfRec : β {a r} {A : Set a} β Rel A r β β {β} β RecStruct A β _
WfRec _<_ P x = β y β y < x β P y
-- The accessibility predicate: x is accessible if everything which is
-- smaller than x is also accessible (inductively).
data Acc {a β} {A : Set a} (_<_ : Rel A β) (x : A) : Set (a β β) where
acc : (rs : WfRec _<_ (Acc _<_) x) β Acc _<_ x
-- The accessibility predicate encodes what it means to be
-- well-founded; if all elements are accessible, then _<_ is
-- well-founded.
WellFounded : β {a β} {A : Set a} β Rel A β β Set _
WellFounded _<_ = β x β Acc _<_ x
Well-founded = WellFounded
{-# WARNING_ON_USAGE Well-founded
"Warning: Well-founded was deprecated in v0.15.
Please use WellFounded instead."
#-}
------------------------------------------------------------------------
-- Well-founded induction for the subset of accessible elements:
module Some {a lt} {A : Set a} {_<_ : Rel A lt} {β} where
wfRecBuilder : SubsetRecursorBuilder (Acc _<_) (WfRec _<_ {β = β})
wfRecBuilder P f x (acc rs) = Ξ» y y<x β
f y (wfRecBuilder P f y (rs y y<x))
wfRec : SubsetRecursor (Acc _<_) (WfRec _<_)
wfRec = subsetBuild wfRecBuilder
wfRec-builder = wfRecBuilder
{-# WARNING_ON_USAGE wfRec-builder
"Warning: wfRec-builder was deprecated in v0.15.
Please use wfRecBuilder instead."
#-}
------------------------------------------------------------------------
-- Well-founded induction for all elements, assuming they are all
-- accessible:
module All {a lt} {A : Set a} {_<_ : Rel A lt}
(wf : WellFounded _<_) β where
wfRecBuilder : RecursorBuilder (WfRec _<_ {β = β})
wfRecBuilder P f x = Some.wfRecBuilder P f x (wf x)
wfRec : Recursor (WfRec _<_)
wfRec = build wfRecBuilder
wfRec-builder = wfRecBuilder
{-# WARNING_ON_USAGE wfRec-builder
"Warning: wfRec-builder was deprecated in v0.15.
Please use wfRecBuilder instead."
#-}
------------------------------------------------------------------------
-- It might be useful to establish proofs of Acc or Well-founded using
-- combinators such as the ones below (see, for instance,
-- "Constructing Recursion Operators in Intuitionistic Type Theory" by
-- Lawrence C Paulson).
module Subrelation {a ββ ββ} {A : Set a}
{_<β_ : Rel A ββ} {_<β_ : Rel A ββ}
(<ββ<β : β {x y} β x <β y β x <β y) where
accessible : Acc _<β_ β Acc _<β_
accessible (acc rs) = acc (Ξ» y y<x β accessible (rs y (<ββ<β y<x)))
wellFounded : WellFounded _<β_ β WellFounded _<β_
wellFounded wf = Ξ» x β accessible (wf x)
well-founded = wellFounded
{-# WARNING_ON_USAGE well-founded
"Warning: well-founded was deprecated in v0.15.
Please use wellFounded instead."
#-}
module InverseImage {a b β} {A : Set a} {B : Set b} {_<_ : Rel B β}
(f : A β B) where
accessible : β {x} β Acc _<_ (f x) β Acc (_<_ on f) x
accessible (acc rs) = acc (Ξ» y fy<fx β accessible (rs (f y) fy<fx))
wellFounded : WellFounded _<_ β WellFounded (_<_ on f)
wellFounded wf = Ξ» x β accessible (wf (f x))
well-founded = wellFounded
{-# WARNING_ON_USAGE well-founded
"Warning: well-founded was deprecated in v0.15.
Please use wellFounded instead."
#-}
module TransitiveClosure {a β} {A : Set a} (_<_ : Rel A β) where
infix 4 _<βΊ_
data _<βΊ_ : Rel A (a β β) where
[_] : β {x y} (x<y : x < y) β x <βΊ y
trans : β {x y z} (x<y : x <βΊ y) (y<z : y <βΊ z) β x <βΊ z
downwardsClosed : β {x y} β Acc _<βΊ_ y β x <βΊ y β Acc _<βΊ_ x
downwardsClosed (acc rs) x<y = acc (Ξ» z z<x β rs z (trans z<x x<y))
mutual
accessible : β {x} β Acc _<_ x β Acc _<βΊ_ x
accessible acc-x = acc (accessibleβ² acc-x)
accessibleβ² : β {x} β Acc _<_ x β WfRec _<βΊ_ (Acc _<βΊ_) x
accessibleβ² (acc rs) y [ y<x ] = accessible (rs y y<x)
accessibleβ² acc-x y (trans y<z z<x) =
downwardsClosed (accessibleβ² acc-x _ z<x) y<z
wellFounded : WellFounded _<_ β WellFounded _<βΊ_
wellFounded wf = Ξ» x β accessible (wf x)
downwards-closed = downwardsClosed
{-# WARNING_ON_USAGE downwards-closed
"Warning: downwards-closed was deprecated in v0.15.
Please use downwardsClosed instead."
#-}
well-founded = wellFounded
{-# WARNING_ON_USAGE well-founded
"Warning: well-founded was deprecated in v0.15.
Please use wellFounded instead."
#-}
module Lexicographic {a b ββ ββ} {A : Set a} {B : A β Set b}
(RelA : Rel A ββ)
(RelB : β x β Rel (B x) ββ) where
data _<_ : Rel (Ξ£ A B) (a β b β ββ β ββ) where
left : β {xβ yβ xβ yβ} (xβ<xβ : RelA xβ xβ) β (xβ , yβ) < (xβ , yβ)
right : β {x yβ yβ} (yβ<yβ : RelB x yβ yβ) β (x , yβ) < (x , yβ)
mutual
accessible : β {x y} β
Acc RelA x β (β {x} β WellFounded (RelB x)) β
Acc _<_ (x , y)
accessible accA wfB = acc (accessibleβ² accA (wfB _) wfB)
accessibleβ² :
β {x y} β
Acc RelA x β Acc (RelB x) y β (β {x} β WellFounded (RelB x)) β
WfRec _<_ (Acc _<_) (x , y)
accessibleβ² (acc rsA) _ wfB ._ (left xβ²<x) = accessible (rsA _ xβ²<x) wfB
accessibleβ² accA (acc rsB) wfB ._ (right yβ²<y) =
acc (accessibleβ² accA (rsB _ yβ²<y) wfB)
wellFounded : WellFounded RelA β (β {x} β WellFounded (RelB x)) β
WellFounded _<_
wellFounded wfA wfB p = accessible (wfA (projβ p)) wfB
well-founded = wellFounded
{-# WARNING_ON_USAGE well-founded
"Warning: well-founded was deprecated in v0.15.
Please use wellFounded instead."
#-}
------------------------------------------------------------------------
-- DEPRECATED NAMES
------------------------------------------------------------------------
-- Please use the new names as continuing support for the old names is
-- not guaranteed.
-- Version 1.0
module Inverse-image = InverseImage
module Transitive-closure = TransitiveClosure
| {
"alphanum_fraction": 0.5717841033,
"avg_line_length": 32.3065326633,
"ext": "agda",
"hexsha": "7f0ea62de59db5a0ff3fdff9fccb9aa3803a538e",
"lang": "Agda",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "0debb886eb5dbcd38dbeebd04b34cf9d9c5e0e71",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "omega12345/agda-mode",
"max_forks_repo_path": "test/asset/agda-stdlib-1.0/Induction/WellFounded.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "0debb886eb5dbcd38dbeebd04b34cf9d9c5e0e71",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "omega12345/agda-mode",
"max_issues_repo_path": "test/asset/agda-stdlib-1.0/Induction/WellFounded.agda",
"max_line_length": 80,
"max_stars_count": null,
"max_stars_repo_head_hexsha": "0debb886eb5dbcd38dbeebd04b34cf9d9c5e0e71",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "omega12345/agda-mode",
"max_stars_repo_path": "test/asset/agda-stdlib-1.0/Induction/WellFounded.agda",
"max_stars_repo_stars_event_max_datetime": null,
"max_stars_repo_stars_event_min_datetime": null,
"num_tokens": 1974,
"size": 6429
} |
open import FRP.LTL.RSet.Core using ( RSet )
module FRP.LTL.RSet.Stateless where
infixr 1 _β_
_β_ : RSet β RSet β RSet
(A β B) t = A t β B t
| {
"alphanum_fraction": 0.6413793103,
"avg_line_length": 14.5,
"ext": "agda",
"hexsha": "33cb88eee7a2b890b9becfeb89093bf8ca36cfd0",
"lang": "Agda",
"max_forks_count": 3,
"max_forks_repo_forks_event_max_datetime": "2022-03-12T11:39:04.000Z",
"max_forks_repo_forks_event_min_datetime": "2015-03-01T07:33:00.000Z",
"max_forks_repo_head_hexsha": "e88107d7d192cbfefd0a94505e6a5793afe1a7a5",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "agda/agda-frp-ltl",
"max_forks_repo_path": "src/FRP/LTL/RSet/Stateless.agda",
"max_issues_count": 2,
"max_issues_repo_head_hexsha": "e88107d7d192cbfefd0a94505e6a5793afe1a7a5",
"max_issues_repo_issues_event_max_datetime": "2015-03-02T15:23:53.000Z",
"max_issues_repo_issues_event_min_datetime": "2015-03-01T07:01:31.000Z",
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "agda/agda-frp-ltl",
"max_issues_repo_path": "src/FRP/LTL/RSet/Stateless.agda",
"max_line_length": 44,
"max_stars_count": 21,
"max_stars_repo_head_hexsha": "e88107d7d192cbfefd0a94505e6a5793afe1a7a5",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "agda/agda-frp-ltl",
"max_stars_repo_path": "src/FRP/LTL/RSet/Stateless.agda",
"max_stars_repo_stars_event_max_datetime": "2020-06-15T02:51:13.000Z",
"max_stars_repo_stars_event_min_datetime": "2015-07-02T20:25:05.000Z",
"num_tokens": 62,
"size": 145
} |
------------------------------------------------------------------------
-- The Agda standard library
--
-- Properties of binary trees
------------------------------------------------------------------------
{-# OPTIONS --without-K --safe #-}
module Data.Tree.Binary.Properties where
open import Level using (Level)
open import Data.Nat.Base using (suc; _+_)
open import Data.Tree.Binary
open import Function.Base
open import Relation.Binary.PropositionalEquality
private
variable
a b : Level
A : Set a
B : Set b
size-map : β (f : A β B) t β size (map f t) β‘ size t
size-map f leaf = refl
size-map f (node l m r) =
congβ (Ξ» l r β l + suc r) (size-map f l) (size-map f r)
map-id : β (t : Tree A) β map id t β‘ t
map-id leaf = refl
map-id (node l v r) = congβ (flip node v) (map-id l) (map-id r)
| {
"alphanum_fraction": 0.5222623345,
"avg_line_length": 26.8064516129,
"ext": "agda",
"hexsha": "d23b24aa198706814eaf1073e1fed3e2d509a703",
"lang": "Agda",
"max_forks_count": 1,
"max_forks_repo_forks_event_max_datetime": "2021-11-04T06:54:45.000Z",
"max_forks_repo_forks_event_min_datetime": "2021-11-04T06:54:45.000Z",
"max_forks_repo_head_hexsha": "fb380f2e67dcb4a94f353dbaec91624fcb5b8933",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "DreamLinuxer/popl21-artifact",
"max_forks_repo_path": "agda-stdlib/src/Data/Tree/Binary/Properties.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "fb380f2e67dcb4a94f353dbaec91624fcb5b8933",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "DreamLinuxer/popl21-artifact",
"max_issues_repo_path": "agda-stdlib/src/Data/Tree/Binary/Properties.agda",
"max_line_length": 72,
"max_stars_count": 5,
"max_stars_repo_head_hexsha": "fb380f2e67dcb4a94f353dbaec91624fcb5b8933",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "DreamLinuxer/popl21-artifact",
"max_stars_repo_path": "agda-stdlib/src/Data/Tree/Binary/Properties.agda",
"max_stars_repo_stars_event_max_datetime": "2020-10-10T21:41:32.000Z",
"max_stars_repo_stars_event_min_datetime": "2020-10-07T12:07:53.000Z",
"num_tokens": 215,
"size": 831
} |
{-# OPTIONS --without-K --exact-split #-}
module ideals where
import abelian-subgroups
import rings
open abelian-subgroups public
open rings public
{- Subsets of rings -}
subset-Ring :
(l : Level) {l1 : Level} (R : Ring l1) β UU ((lsuc l) β l1)
subset-Ring l R = type-Ring R β UU-Prop l
is-set-subset-Ring :
(l : Level) {l1 : Level} (R : Ring l1) β is-set (subset-Ring l R)
is-set-subset-Ring l R =
is-set-function-type (is-set-UU-Prop l)
{- Closure properties of subsets of rings -}
is-additive-subgroup-subset-Ring :
{l1 l2 : Level} (R : Ring l1) (P : subset-Ring l2 R) β UU (l1 β l2)
is-additive-subgroup-subset-Ring R = is-subgroup-Ab (ab-Ring R)
is-closed-under-mul-left-subset-Ring :
{l1 l2 : Level} (R : Ring l1) (P : subset-Ring l2 R) β UU (l1 β l2)
is-closed-under-mul-left-subset-Ring R P =
(x : type-Ring R) (y : type-Ring R) β
type-Prop (P y) β type-Prop (P (mul-Ring R x y))
is-closed-under-mul-right-subset-Ring :
{l1 l2 : Level} (R : Ring l1) (P : subset-Ring l2 R) β UU (l1 β l2)
is-closed-under-mul-right-subset-Ring R P =
(x : type-Ring R) (y : type-Ring R) β
type-Prop (P x) β type-Prop (P (mul-Ring R x y))
{- The definition of left and right ideals -}
is-left-ideal-subset-Ring :
{l1 l2 : Level} (R : Ring l1) (P : subset-Ring l2 R) β UU (l1 β l2)
is-left-ideal-subset-Ring R P =
is-additive-subgroup-subset-Ring R P Γ
is-closed-under-mul-left-subset-Ring R P
Left-Ideal-Ring :
(l : Level) {l1 : Level} (R : Ring l1) β UU ((lsuc l) β l1)
Left-Ideal-Ring l R = Ξ£ (subset-Ring l R) (is-left-ideal-subset-Ring R)
is-right-ideal-subset-Ring :
{l1 l2 : Level} (R : Ring l1) (P : subset-Ring l2 R) β UU (l1 β l2)
is-right-ideal-subset-Ring R P =
is-additive-subgroup-subset-Ring R P Γ
is-closed-under-mul-right-subset-Ring R P
Right-Ideal-Ring :
(l : Level) {l1 : Level} (R : Ring l1) β UU ((lsuc l) β l1)
Right-Ideal-Ring l R = Ξ£ (subset-Ring l R) (is-right-ideal-subset-Ring R)
is-two-sided-ideal-subset-Ring :
{l1 l2 : Level} (R : Ring l1) (P : subset-Ring l2 R) β UU (l1 β l2)
is-two-sided-ideal-subset-Ring R P =
is-additive-subgroup-subset-Ring R P Γ
( is-closed-under-mul-left-subset-Ring R P Γ
is-closed-under-mul-right-subset-Ring R P)
Two-Sided-Ideal-Ring :
(l : Level) {l1 : Level} (R : Ring l1) β UU ((lsuc l) β l1)
Two-Sided-Ideal-Ring l R =
Ξ£ (subset-Ring l R) (is-two-sided-ideal-subset-Ring R)
{- Special ideals -}
| {
"alphanum_fraction": 0.6391880696,
"avg_line_length": 32.1866666667,
"ext": "agda",
"hexsha": "d377147d8c90aee2ff9e2997cb8d8268bd7b34d4",
"lang": "Agda",
"max_forks_count": 30,
"max_forks_repo_forks_event_max_datetime": "2022-03-16T00:33:50.000Z",
"max_forks_repo_forks_event_min_datetime": "2018-09-26T09:08:57.000Z",
"max_forks_repo_head_hexsha": "1e1f8def50f9359928e52ebb2ee53ed1166487d9",
"max_forks_repo_licenses": [
"CC-BY-4.0"
],
"max_forks_repo_name": "UlrikBuchholtz/HoTT-Intro",
"max_forks_repo_path": "Agda/ideals.agda",
"max_issues_count": 8,
"max_issues_repo_head_hexsha": "1e1f8def50f9359928e52ebb2ee53ed1166487d9",
"max_issues_repo_issues_event_max_datetime": "2020-10-16T15:27:01.000Z",
"max_issues_repo_issues_event_min_datetime": "2019-06-18T04:16:04.000Z",
"max_issues_repo_licenses": [
"CC-BY-4.0"
],
"max_issues_repo_name": "UlrikBuchholtz/HoTT-Intro",
"max_issues_repo_path": "Agda/ideals.agda",
"max_line_length": 73,
"max_stars_count": 333,
"max_stars_repo_head_hexsha": "1e1f8def50f9359928e52ebb2ee53ed1166487d9",
"max_stars_repo_licenses": [
"CC-BY-4.0"
],
"max_stars_repo_name": "UlrikBuchholtz/HoTT-Intro",
"max_stars_repo_path": "Agda/ideals.agda",
"max_stars_repo_stars_event_max_datetime": "2022-03-22T23:50:15.000Z",
"max_stars_repo_stars_event_min_datetime": "2018-09-26T08:33:30.000Z",
"num_tokens": 934,
"size": 2414
} |
open import Auto.Prelude
-- using a type argument as a proof
h0 : (xβ xβ : β₯) β xβ β‘ xβ
h0 = {!!}
--h0 = Ξ» xβ β Ξ» ()
-- using dependent pair to define non-dep pair
module DND where
_Γ_ : Set β Set β Set
A Γ B = Ξ£ A (Ξ» _ β B)
h1-2 : β {A B} β A Γ B β B Γ A
-- h1-2 = {!!} -- no solution found
h1-2 = Ξ» h β Ξ£-i {!!} {!!}
-- h1-2 = Ξ» h β Ξ£-i (Ξ£.prf h) (Ξ£.wit h)
| {
"alphanum_fraction": 0.4906666667,
"avg_line_length": 15,
"ext": "agda",
"hexsha": "6da444fb9174e373a32c37e48f66b23d6bf8ad8f",
"lang": "Agda",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "70c8a575c46f6a568c7518150a1a64fcd03aa437",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "masondesu/agda",
"max_forks_repo_path": "test/interaction/Auto-Misc.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "70c8a575c46f6a568c7518150a1a64fcd03aa437",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "masondesu/agda",
"max_issues_repo_path": "test/interaction/Auto-Misc.agda",
"max_line_length": 46,
"max_stars_count": 1,
"max_stars_repo_head_hexsha": "70c8a575c46f6a568c7518150a1a64fcd03aa437",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "masondesu/agda",
"max_stars_repo_path": "test/interaction/Auto-Misc.agda",
"max_stars_repo_stars_event_max_datetime": "2018-10-10T17:08:44.000Z",
"max_stars_repo_stars_event_min_datetime": "2018-10-10T17:08:44.000Z",
"num_tokens": 165,
"size": 375
} |
{-# OPTIONS --safe --without-K #-}
open import Relation.Binary
module Data.List.Membership.Setoid.Distinct where
open import Data.List as List using (List; []; _β·_; _++_)
open import Data.List.Any as Any hiding (map; head; tail)
open import Data.List.Any.Properties
open import Relation.Binary.PropositionalEquality as P using (_β‘_)
open import Function
open import Function.Equivalence using (_β_; equivalence)
open import Function.Equality using (_β¨$β©_)
open import Function.Inverse using ()
open import Function.Injection using (_β£_; Injection)
open import Data.Product hiding (map)
open import Data.Sum hiding (map)
import Level as L
open import Data.Fin as Fin using (Fin)
open import Data.Nat as β
module _ {a p} {S : Setoid a p} where
open Setoid S renaming (Carrier to A)
open import Data.List.Membership.Setoid (S)
open import Data.List.Membership.Setoid.Properties
open import Data.List.Membership.Setoid.Disjoint (S) renaming (Disjoint to _β_)
open import Data.List.Membership.Setoid.Trans (S)
open import Data.Empty
data Distinct : List A β Set (a L.β p) where
distinct-[] : Distinct []
_distinct-β·_by_ : β x {xs} β Distinct xs β x β xs β Distinct (x β· xs)
head : β {x}{xs : List A} β Distinct (x β· xs) β A
head (x distinct-β· _ by _) = x
tail : β {x}{xs : List A} β Distinct (x β· xs) β Distinct xs
tail (_ distinct-β· dis by _) = dis
headβtail : β {x}{xs : List A} β Distinct (x β· xs) β x β xs
headβtail (_ distinct-β· _ by xβxs) = xβxs
distinct-[_] : β x β Distinct (List.[ x ])
distinct-[ x ] = x distinct-β· distinct-[] by (Ξ» ())
β-++ : β (xs ys : List A) β
Distinct (xs ++ ys) β (Distinct xs Γ Distinct ys Γ xs β ys)
β-++ xs ys = equivalence to from
where
to : β {xs ys : List A} β Distinct (xs ++ ys) β (Distinct xs Γ Distinct ys Γ xs β ys)
to {[]} dys = distinct-[] , dys , disjoint-[]Κ³
to {x β· xs} {ys} (.x distinct-β· dis by xβxsys) with to {xs = xs} dis
... | dxs , dys , xsβys = x distinct-β· dxs by (Ξ» xβxs β xβxsys (++βΊΛ‘ xβxs)) , dys ,
Ξ» { (here px) βys β xβxsys (++βΊΚ³ xs (β-trans-β (sym px) βys)) ; (there βxs) βys β xsβys βxs βys}
from : β {xs ys : List A} β
(Distinct xs Γ Distinct ys Γ xs β ys) β Distinct (xs ++ ys)
from (distinct-[] , dys , xsβys) = dys
from {xs = .x β· xs} ((x distinct-β· dxs by xβxs) , dys , xxsβys) with from (dxs , dys , xxsβys β there)
... | dxsys = x distinct-β· dxsys by Ξ» xβxsys β case ++β» xs xβxsys of Ξ» { (injβ xβxs) β xβxs xβxs
; (injβ xβys) β xxsβys (here refl) xβys}
lookup-injective : {xs : List A}(dxs : Distinct xs) β β {i j} β List.lookup xs i β‘ List.lookup xs j β i β‘ j
lookup-injective distinct-[] {()} {()} _
lookup-injective (x distinct-β· dxs by xβxs) {Fin.zero} {Fin.zero} _ = P.refl
lookup-injective (x distinct-β· dxs by xβxs) {Fin.suc i} {Fin.suc j} eq = P.cong Fin.suc (lookup-injective dxs eq)
lookup-injective {xs} (x distinct-β· dxs by xβxs) {Fin.zero} {Fin.suc j} eq rewrite eq = β₯-elim (xβxs (β-lookup S _ j))
lookup-injective (x distinct-β· dxs by xβxs) {Fin.suc i} {Fin.zero} eq rewrite P.sym eq = β₯-elim (xβxs (β-lookup S _ i))
module _ {aβ aβ pβ pβ}{Sβ : Setoid aβ pβ} {Sβ : Setoid aβ pβ} where
open Setoid Sβ renaming (Carrier to A) using ()
open Setoid Sβ renaming (Carrier to B) using ()
open import Data.List.Membership.Setoid (Sβ) renaming (_β_ to _ββ_) using ()
open import Data.List.Membership.Setoid.Properties
open import Data.List.Membership.Setoid.Trans (Sβ)
map : (f : Injection Sβ Sβ) β β {xs : List A} β Distinct {S = Sβ} xs β Distinct {S = Sβ} (List.map (Injection.to f β¨$β©_) xs)
map f {[]} distinct-[] = distinct-[]
map f {.x β· xs} (x distinct-β· dis by xβxs) = fx distinct-β· map f dis by lemma
where
fx = Injection.to f β¨$β© x
lemma : fx ββ List.map (Injection.to f β¨$β©_) xs
lemma p with β-mapβ» Sβ Sβ p
... | _ , yβxs , fxβfy = xβxs (β-trans-β (Injection.injective f fxβfy) yβxs)
| {
"alphanum_fraction": 0.5965686275,
"avg_line_length": 48,
"ext": "agda",
"hexsha": "3f688f384bbed4e8ea1c1fa10a98678740095c96",
"lang": "Agda",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "d4cd2a3442a9b58e6139499d16a2b31268f27f80",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "tizmd/agda-distinct-disjoint",
"max_forks_repo_path": "src/Data/List/Membership/Setoid/Distinct.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "d4cd2a3442a9b58e6139499d16a2b31268f27f80",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "tizmd/agda-distinct-disjoint",
"max_issues_repo_path": "src/Data/List/Membership/Setoid/Distinct.agda",
"max_line_length": 136,
"max_stars_count": null,
"max_stars_repo_head_hexsha": "d4cd2a3442a9b58e6139499d16a2b31268f27f80",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "tizmd/agda-distinct-disjoint",
"max_stars_repo_path": "src/Data/List/Membership/Setoid/Distinct.agda",
"max_stars_repo_stars_event_max_datetime": null,
"max_stars_repo_stars_event_min_datetime": null,
"num_tokens": 1466,
"size": 4080
} |
module StateSized.GUI.BitMaps where
open import StateSizedIO.GUI.WxBindingsFFI
ship : Bitmap
ship = bitmap "./StateSized/GUI/ship.ico"
rock : Bitmap
rock = bitmap "./StateSized/GUI/rock.ico"
| {
"alphanum_fraction": 0.7680412371,
"avg_line_length": 19.4,
"ext": "agda",
"hexsha": "951aae4e24daff87f21ac3dca69ce63ca503b8c0",
"lang": "Agda",
"max_forks_count": 2,
"max_forks_repo_forks_event_max_datetime": "2022-03-12T11:41:00.000Z",
"max_forks_repo_forks_event_min_datetime": "2018-09-01T15:02:37.000Z",
"max_forks_repo_head_hexsha": "7cc45e0148a4a508d20ed67e791544c30fecd795",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "agda/ooAgda",
"max_forks_repo_path": "examples/StateSized/GUI/BitMaps.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "7cc45e0148a4a508d20ed67e791544c30fecd795",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "agda/ooAgda",
"max_issues_repo_path": "examples/StateSized/GUI/BitMaps.agda",
"max_line_length": 42,
"max_stars_count": 23,
"max_stars_repo_head_hexsha": "7cc45e0148a4a508d20ed67e791544c30fecd795",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "agda/ooAgda",
"max_stars_repo_path": "examples/StateSized/GUI/BitMaps.agda",
"max_stars_repo_stars_event_max_datetime": "2020-10-12T23:15:25.000Z",
"max_stars_repo_stars_event_min_datetime": "2016-06-19T12:57:55.000Z",
"num_tokens": 56,
"size": 194
} |
-- Andreas, 2020-04-15, issue #4586
-- Better error message when `let` contains a `where` clause.
foo : Setβ
foo = let x = Set
where y = Set
in Set
-- WAS:
-- Not a valid let-declaration
-- when scope checking
-- let x = Set
-- where
-- y = Set
-- in Set
-- EXPECTED:
-- No `where' clauses allowed in let binding
-- when scope checking
-- let x = Set
-- where
-- y = Set
-- in Set
| {
"alphanum_fraction": 0.5612009238,
"avg_line_length": 18.0416666667,
"ext": "agda",
"hexsha": "a3ec1d94475608beb2a37d2fab9be18e801fcb84",
"lang": "Agda",
"max_forks_count": 371,
"max_forks_repo_forks_event_max_datetime": "2022-03-30T19:00:30.000Z",
"max_forks_repo_forks_event_min_datetime": "2015-01-03T14:04:08.000Z",
"max_forks_repo_head_hexsha": "ed8ac6f4062ea8a20fa0f62d5db82d4e68278338",
"max_forks_repo_licenses": [
"BSD-3-Clause"
],
"max_forks_repo_name": "shlevy/agda",
"max_forks_repo_path": "test/Fail/Issue4586WhereInLet.agda",
"max_issues_count": 4066,
"max_issues_repo_head_hexsha": "ed8ac6f4062ea8a20fa0f62d5db82d4e68278338",
"max_issues_repo_issues_event_max_datetime": "2022-03-31T21:14:49.000Z",
"max_issues_repo_issues_event_min_datetime": "2015-01-10T11:24:51.000Z",
"max_issues_repo_licenses": [
"BSD-3-Clause"
],
"max_issues_repo_name": "shlevy/agda",
"max_issues_repo_path": "test/Fail/Issue4586WhereInLet.agda",
"max_line_length": 61,
"max_stars_count": 1989,
"max_stars_repo_head_hexsha": "ed8ac6f4062ea8a20fa0f62d5db82d4e68278338",
"max_stars_repo_licenses": [
"BSD-3-Clause"
],
"max_stars_repo_name": "shlevy/agda",
"max_stars_repo_path": "test/Fail/Issue4586WhereInLet.agda",
"max_stars_repo_stars_event_max_datetime": "2022-03-30T18:20:48.000Z",
"max_stars_repo_stars_event_min_datetime": "2015-01-09T23:51:16.000Z",
"num_tokens": 130,
"size": 433
} |
------------------------------------------------------------------------
-- The Agda standard library
--
-- Least common multiple
------------------------------------------------------------------------
{-# OPTIONS --without-K --safe #-}
module Data.Nat.LCM where
open import Algebra
open import Data.Nat.Base
open import Data.Nat.Coprimality using (Coprime)
open import Data.Nat.Divisibility
open import Data.Nat.DivMod
open import Data.Nat.Properties
open import Data.Nat.Solver
open import Data.Nat.GCD
open import Data.Product
open import Data.Sum.Base using (_β_; injβ; injβ)
open import Function
open import Relation.Binary.PropositionalEquality as P
using (_β‘_; refl; sym; trans; cong; congβ; module β‘-Reasoning)
open import Relation.Binary
open import Relation.Nullary.Decidable using (False; fromWitnessFalse)
open +-*-Solver
private
gcdβ’0β² : β m n β False (gcd (suc m) n β 0)
gcdβ’0β² m n = fromWitnessFalse (gcd[m,n]β’0 (suc m) n (injβ (Ξ»())))
------------------------------------------------------------------------
-- Definition
lcm : β β β β β
lcm zero n = zero
lcm m@(suc m-1) n = m * (n / gcd m n) {gcdβ’0β² m-1 n}
------------------------------------------------------------------------
-- Core properties
private
rearrange : β m-1 n β lcm (suc m-1) n β‘ ((suc m-1) * n / gcd (suc m-1) n) {gcdβ’0β² m-1 n}
rearrange m-1 n = sym (*-/-assoc m {n} {gcd m n} {gcdβ’0β² m-1 n} (gcd[m,n]β£n m n))
where m = suc m-1
mβ£lcm[m,n] : β m n β m β£ lcm m n
mβ£lcm[m,n] zero n = 0 β£0
mβ£lcm[m,n] m@(suc _) n = mβ£m*n (n / gcd m n)
nβ£lcm[m,n] : β m n β n β£ lcm m n
nβ£lcm[m,n] zero n = n β£0
nβ£lcm[m,n] m@(suc m-1) n = begin
n β£β¨ mβ£m*n (m / gcd m n) β©
n * (m / gcd m n) β‘β¨ sym (*-/-assoc n {β’0 = gcdβ’0β² m-1 n} (gcd[m,n]β£m m n)) β©
n * m / gcd m n β‘β¨ cong (Ξ» v β (v / gcd m n) {gcdβ’0β² m-1 n}) (*-comm n m) β©
m * n / gcd m n β‘β¨ sym (rearrange m-1 n) β©
m * (n / gcd m n) β
where open β£-Reasoning
lcm-least : β {m n c} β m β£ c β n β£ c β lcm m n β£ c
lcm-least {zero} {n} {c} 0β£c _ = 0β£c
lcm-least {m@(suc m-1)} {n} {c} mβ£c nβ£c = P.subst (_β£ c) (sym (rearrange m-1 n))
(mβ£n*oβm/nβ£o {nβ’0 = gcdβ’0β² m-1 n} gcd[m,n]β£m*n mnβ£c*gcd)
where
open β£-Reasoning
gcd[m,n]β£m*n : gcd m n β£ m * n
gcd[m,n]β£m*n = β£-trans (gcd[m,n]β£m m n) (mβ£m*n n)
mnβ£c*gcd : m * n β£ c * gcd m n
mnβ£c*gcd = begin
m * n β£β¨ gcd-greatest (P.subst (_β£ c * m) (*-comm n m) (*-monoΛ‘-β£ m nβ£c)) (*-monoΛ‘-β£ n mβ£c) β©
gcd (c * m) (c * n) β‘β¨ sym (c*gcd[m,n]β‘gcd[cm,cn] c m n) β©
c * gcd m n β
------------------------------------------------------------------------
-- Other properties
-- Note that all other properties of `gcd` should be inferable from the
-- 3 core properties above.
gcd*lcm : β m n β gcd m n * lcm m n β‘ m * n
gcd*lcm zero n = *-zeroΚ³ (gcd 0 n)
gcd*lcm m@(suc m-1) n = trans (cong (gcd m n *_) (rearrange m-1 n)) (m*[n/m]β‘n {gcd m n} (begin
gcd m n β£β¨ gcd[m,n]β£m m n β©
m β£β¨ mβ£m*n n β©
m * n β))
where open β£-Reasoning
lcm[0,n]β‘0 : β n β lcm 0 n β‘ 0
lcm[0,n]β‘0 n = 0β£ββ‘0 (mβ£lcm[m,n] 0 n)
lcm[n,0]β‘0 : β n β lcm n 0 β‘ 0
lcm[n,0]β‘0 n = 0β£ββ‘0 (nβ£lcm[m,n] n 0)
lcm-comm : β m n β lcm m n β‘ lcm n m
lcm-comm m n = β£-antisym
(lcm-least (nβ£lcm[m,n] n m) (mβ£lcm[m,n] n m))
(lcm-least (nβ£lcm[m,n] m n) (mβ£lcm[m,n] m n))
------------------------------------------------------------------------
-- Least common multiple (lcm).
module LCM where
-- Specification of the least common multiple (lcm) of two natural
-- numbers.
record LCM (i j lcm : β) : Set where
field
-- The lcm is a common multiple.
commonMultiple : i β£ lcm Γ j β£ lcm
-- The lcm divides all common multiples, i.e. the lcm is the least
-- common multiple according to the partial order _β£_.
least : β {m} β i β£ m Γ j β£ m β lcm β£ m
open LCM public
-- The lcm is unique.
unique : β {dβ dβ m n} β LCM m n dβ β LCM m n dβ β dβ β‘ dβ
unique dβ dβ = β£-antisym (LCM.least dβ (LCM.commonMultiple dβ))
(LCM.least dβ (LCM.commonMultiple dβ))
open LCM public using (LCM) hiding (module LCM)
------------------------------------------------------------------------
-- Calculating the LCM
lcm-LCM : β m n β LCM m n (lcm m n)
lcm-LCM m n = record
{ commonMultiple = mβ£lcm[m,n] m n , nβ£lcm[m,n] m n
; least = uncurryβ² lcm-least
}
mkLCM : β m n β β Ξ» d β LCM m n d
mkLCM m n = lcm m n , lcm-LCM m n
GCD*LCM : β {m n g l} β GCD m n g β LCM m n l β m * n β‘ g * l
GCD*LCM {m} {n} {g} {l} gc lc = sym (begin
g * l β‘β¨ congβ _*_ (GCD.unique gc (gcd-GCD m n)) (LCM.unique lc (lcm-LCM m n)) β©
gcd m n * lcm m n β‘β¨ gcd*lcm m n β©
m * n β)
where open β‘-Reasoning
| {
"alphanum_fraction": 0.4918759232,
"avg_line_length": 32.2380952381,
"ext": "agda",
"hexsha": "4d2d3b1f2a0ea6f201f3f92a1a240558df37774b",
"lang": "Agda",
"max_forks_count": 1,
"max_forks_repo_forks_event_max_datetime": "2021-11-04T06:54:45.000Z",
"max_forks_repo_forks_event_min_datetime": "2021-11-04T06:54:45.000Z",
"max_forks_repo_head_hexsha": "fb380f2e67dcb4a94f353dbaec91624fcb5b8933",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "DreamLinuxer/popl21-artifact",
"max_forks_repo_path": "agda-stdlib/src/Data/Nat/LCM.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "fb380f2e67dcb4a94f353dbaec91624fcb5b8933",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "DreamLinuxer/popl21-artifact",
"max_issues_repo_path": "agda-stdlib/src/Data/Nat/LCM.agda",
"max_line_length": 111,
"max_stars_count": 5,
"max_stars_repo_head_hexsha": "fb380f2e67dcb4a94f353dbaec91624fcb5b8933",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "DreamLinuxer/popl21-artifact",
"max_stars_repo_path": "agda-stdlib/src/Data/Nat/LCM.agda",
"max_stars_repo_stars_event_max_datetime": "2020-10-10T21:41:32.000Z",
"max_stars_repo_stars_event_min_datetime": "2020-10-07T12:07:53.000Z",
"num_tokens": 1910,
"size": 4739
} |
_ : (@0 Set β Set) β (@Ο Set β Set)
_ = Ξ» f β f
| {
"alphanum_fraction": 0.3958333333,
"avg_line_length": 16,
"ext": "agda",
"hexsha": "6d383eb684aa5c9bf147c850131d225c48d30a37",
"lang": "Agda",
"max_forks_count": 371,
"max_forks_repo_forks_event_max_datetime": "2022-03-30T19:00:30.000Z",
"max_forks_repo_forks_event_min_datetime": "2015-01-03T14:04:08.000Z",
"max_forks_repo_head_hexsha": "7f58030124fa99dfbf8db376659416f3ad8384de",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "cruhland/agda",
"max_forks_repo_path": "test/Fail/Issue5251-2.agda",
"max_issues_count": 4066,
"max_issues_repo_head_hexsha": "7f58030124fa99dfbf8db376659416f3ad8384de",
"max_issues_repo_issues_event_max_datetime": "2022-03-31T21:14:49.000Z",
"max_issues_repo_issues_event_min_datetime": "2015-01-10T11:24:51.000Z",
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "cruhland/agda",
"max_issues_repo_path": "test/Fail/Issue5251-2.agda",
"max_line_length": 35,
"max_stars_count": 1989,
"max_stars_repo_head_hexsha": "7f58030124fa99dfbf8db376659416f3ad8384de",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "cruhland/agda",
"max_stars_repo_path": "test/Fail/Issue5251-2.agda",
"max_stars_repo_stars_event_max_datetime": "2022-03-30T18:20:48.000Z",
"max_stars_repo_stars_event_min_datetime": "2015-01-09T23:51:16.000Z",
"num_tokens": 22,
"size": 48
} |
-- Andreas, 2012-04-18, bug reported by pumpkingod on 2012-04-16
module Issue610 where
import Common.Level
open import Common.Equality
data β₯ : Set where
record β€ : Set where
record A : Setβ where
constructor set
field
.a : Set
.get : A β Set
get x = helper x
module R where
helper : .A -> Set
helper x = A.a x
ack : A β Set
ack x = R.helper x x
-- Expected error:
-- Identifier R.helper is declared irrelevant, so it cannot be used here
hah : set β€ β‘ set β₯
hah = refl
.moo : β₯
moo with cong ack hah
moo | q = subst (Ξ» x β x) q _
baa : .β₯ β β₯
baa ()
yoink : β₯
yoink = baa moo
| {
"alphanum_fraction": 0.6416666667,
"avg_line_length": 15.3846153846,
"ext": "agda",
"hexsha": "cce06a4dfb29c4c752263e32910325ba00270fe3",
"lang": "Agda",
"max_forks_count": 1,
"max_forks_repo_forks_event_max_datetime": "2019-03-05T20:02:38.000Z",
"max_forks_repo_forks_event_min_datetime": "2019-03-05T20:02:38.000Z",
"max_forks_repo_head_hexsha": "c0ae7d20728b15d7da4efff6ffadae6fe4590016",
"max_forks_repo_licenses": [
"BSD-3-Clause"
],
"max_forks_repo_name": "redfish64/autonomic-agda",
"max_forks_repo_path": "test/Fail/Issue610.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "c0ae7d20728b15d7da4efff6ffadae6fe4590016",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"BSD-3-Clause"
],
"max_issues_repo_name": "redfish64/autonomic-agda",
"max_issues_repo_path": "test/Fail/Issue610.agda",
"max_line_length": 72,
"max_stars_count": 3,
"max_stars_repo_head_hexsha": "c0ae7d20728b15d7da4efff6ffadae6fe4590016",
"max_stars_repo_licenses": [
"BSD-3-Clause"
],
"max_stars_repo_name": "redfish64/autonomic-agda",
"max_stars_repo_path": "test/Fail/Issue610.agda",
"max_stars_repo_stars_event_max_datetime": "2015-12-07T20:14:00.000Z",
"max_stars_repo_stars_event_min_datetime": "2015-03-28T14:51:03.000Z",
"num_tokens": 213,
"size": 600
} |
module Relation.Path where
open import Relation.Path.Operation
| {
"alphanum_fraction": 0.8307692308,
"avg_line_length": 13,
"ext": "agda",
"hexsha": "f86b0e4c5174faf9961411e1c8e10e92b79e64bd",
"lang": "Agda",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "3411b253b0a49a5f9c3301df175ae8ecdc563b12",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "CodaFi/HoTT-Exercises",
"max_forks_repo_path": "Relation/Path.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "3411b253b0a49a5f9c3301df175ae8ecdc563b12",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "CodaFi/HoTT-Exercises",
"max_issues_repo_path": "Relation/Path.agda",
"max_line_length": 35,
"max_stars_count": null,
"max_stars_repo_head_hexsha": "3411b253b0a49a5f9c3301df175ae8ecdc563b12",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "CodaFi/HoTT-Exercises",
"max_stars_repo_path": "Relation/Path.agda",
"max_stars_repo_stars_event_max_datetime": null,
"max_stars_repo_stars_event_min_datetime": null,
"num_tokens": 11,
"size": 65
} |
open import Mockingbird.Forest using (Forest)
module Mockingbird.Forest.Combination {b β} (forest : Forest {b} {β}) where
open import Mockingbird.Forest.Combination.Base public
| {
"alphanum_fraction": 0.7877094972,
"avg_line_length": 29.8333333333,
"ext": "agda",
"hexsha": "1226b73efbbaf4811b0a37fe5186fbf747a6018e",
"lang": "Agda",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "df8bf877e60b3059532c54a247a36a3d83cd55b0",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "splintah/combinatory-logic",
"max_forks_repo_path": "Mockingbird/Forest/Combination.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "df8bf877e60b3059532c54a247a36a3d83cd55b0",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "splintah/combinatory-logic",
"max_issues_repo_path": "Mockingbird/Forest/Combination.agda",
"max_line_length": 75,
"max_stars_count": 1,
"max_stars_repo_head_hexsha": "df8bf877e60b3059532c54a247a36a3d83cd55b0",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "splintah/combinatory-logic",
"max_stars_repo_path": "Mockingbird/Forest/Combination.agda",
"max_stars_repo_stars_event_max_datetime": "2022-02-28T23:44:42.000Z",
"max_stars_repo_stars_event_min_datetime": "2022-02-28T23:44:42.000Z",
"num_tokens": 51,
"size": 179
} |
{-# OPTIONS --without-K #-}
module Path2Equiv where
-- nothing for the standard library needed directly!
open import FT
open import Equivalences
open import TypeEquivalences
-- We now have enough to map each Pi combinator to the corresponding type equivalence
path2equiv : {Bβ Bβ : FT} β (Bβ β Bβ) β (β¦ Bβ β§ β β¦ Bβ β§)
path2equiv uniteββ = uniteβequiv
path2equiv unitiββ = unitiβequiv
path2equiv swapββ = swapβequiv
path2equiv assoclββ = assoclβequiv
path2equiv assocrββ = assocrβequiv
path2equiv uniteββ = uniteβequiv
path2equiv unitiββ = unitiβequiv
path2equiv swapββ = swapβequiv
path2equiv assoclββ = assoclβequiv
path2equiv assocrββ = assocrβequiv
path2equiv distzβ = distzequiv
path2equiv factorzβ = factorzequiv
path2equiv distβ = distequiv
path2equiv factorβ = factorequiv
path2equiv idβ = idequiv
path2equiv (symβ p) = symβ (path2equiv p)
path2equiv (p β q) = transβ (path2equiv p) (path2equiv q)
path2equiv (p β q) = pathβ (path2equiv p) (path2equiv q)
path2equiv (p β q) = pathΓ (path2equiv p) (path2equiv q)
| {
"alphanum_fraction": 0.7159199237,
"avg_line_length": 30.8529411765,
"ext": "agda",
"hexsha": "53a4042c426c2f34a48c0e243accf81205d141f6",
"lang": "Agda",
"max_forks_count": 3,
"max_forks_repo_forks_event_max_datetime": "2019-09-10T09:47:13.000Z",
"max_forks_repo_forks_event_min_datetime": "2016-05-29T01:56:33.000Z",
"max_forks_repo_head_hexsha": "003835484facfde0b770bc2b3d781b42b76184c1",
"max_forks_repo_licenses": [
"BSD-2-Clause"
],
"max_forks_repo_name": "JacquesCarette/pi-dual",
"max_forks_repo_path": "Univalence/OldUnivalence/Path2Equiv.agda",
"max_issues_count": 4,
"max_issues_repo_head_hexsha": "003835484facfde0b770bc2b3d781b42b76184c1",
"max_issues_repo_issues_event_max_datetime": "2021-10-29T20:41:23.000Z",
"max_issues_repo_issues_event_min_datetime": "2018-06-07T16:27:41.000Z",
"max_issues_repo_licenses": [
"BSD-2-Clause"
],
"max_issues_repo_name": "JacquesCarette/pi-dual",
"max_issues_repo_path": "Univalence/OldUnivalence/Path2Equiv.agda",
"max_line_length": 85,
"max_stars_count": 14,
"max_stars_repo_head_hexsha": "003835484facfde0b770bc2b3d781b42b76184c1",
"max_stars_repo_licenses": [
"BSD-2-Clause"
],
"max_stars_repo_name": "JacquesCarette/pi-dual",
"max_stars_repo_path": "Univalence/OldUnivalence/Path2Equiv.agda",
"max_stars_repo_stars_event_max_datetime": "2021-05-05T01:07:57.000Z",
"max_stars_repo_stars_event_min_datetime": "2015-08-18T21:40:15.000Z",
"num_tokens": 436,
"size": 1049
} |
------------------------------------------------------------------------
-- Recursive types and potentially infinite trees
------------------------------------------------------------------------
module RecursiveTypes.Syntax where
open import Data.Nat
open import Data.Fin
open import Function.Base
open import Data.Product
open import Codata.Musical.Notation
open import Relation.Nullary
import Relation.Nullary.Decidable as Dec
open import Relation.Binary
open import Relation.Binary.PropositionalEquality
import Data.Fin.Properties as FP
private
open module DF {n} = DecSetoid (FP.β‘-decSetoid n)
using () renaming (_β_ to _βF_)
------------------------------------------------------------------------
-- Types
infixr 10 _βΆ_
infix 10 ΞΌ_βΆ_
-- Recursive types, parameterised on the maximum number of free
-- variables.
--
-- ΞΌΒ ΟΒ βΆΒ Ο stands for ΞΌX.Β ΟΒ βΆΒ Ο, where X can be free in Ο and Ο. The
-- arrow is included to avoid nonsensical types like ΞΌX.X. Note that
-- no attempt is made to ensure that the variable bound in ΞΌ_βΆ_ is
-- actually used.
data Ty (n : β) : Set where
β₯ : Ty n
β€ : Ty n
var : (x : Fin n) β Ty n
_βΆ_ : (Οβ Οβ : Ty n) β Ty n
ΞΌ_βΆ_ : (Οβ Οβ : Ty (suc n)) β Ty n
-- Potentially infinite trees.
data Tree (n : β) : Set where
β₯ : Tree n
β€ : Tree n
var : (x : Fin n) β Tree n
_βΆ_ : (Οβ Οβ : β (Tree n)) β Tree n
------------------------------------------------------------------------
-- Syntactic equality of types is decidable
private
drop-var : β {n x y} β (Ty n β var x) β‘ var y β x β‘ y
drop-var refl = refl
dropβΆΛ‘ : β {n Οβ Οβ Οβ Οβ} β
(Ty n β Οβ βΆ Οβ) β‘ Οβ βΆ Οβ β Οβ β‘ Οβ
dropβΆΛ‘ refl = refl
dropβΆΚ³ : β {n Οβ Οβ Οβ Οβ} β
(Ty n β Οβ βΆ Οβ) β‘ Οβ βΆ Οβ β Οβ β‘ Οβ
dropβΆΚ³ refl = refl
dropΞΌβΆΛ‘ : β {n Οβ Οβ Οβ Οβ} β
(Ty n β ΞΌ Οβ βΆ Οβ) β‘ ΞΌ Οβ βΆ Οβ β Οβ β‘ Οβ
dropΞΌβΆΛ‘ refl = refl
dropΞΌβΆΚ³ : β {n Οβ Οβ Οβ Οβ} β
(Ty n β ΞΌ Οβ βΆ Οβ) β‘ ΞΌ Οβ βΆ Οβ β Οβ β‘ Οβ
dropΞΌβΆΚ³ refl = refl
infix 4 _β‘?_
_β‘?_ : β {n} (Ο Ο : Ty n) β Dec (Ο β‘ Ο)
β₯ β‘? β₯ = yes refl
β₯ β‘? β€ = no (Ξ» ())
β₯ β‘? var y = no (Ξ» ())
β₯ β‘? Οβ βΆ Οβ = no (Ξ» ())
β₯ β‘? ΞΌ Οβ βΆ Οβ = no (Ξ» ())
β€ β‘? β₯ = no (Ξ» ())
β€ β‘? β€ = yes refl
β€ β‘? var y = no (Ξ» ())
β€ β‘? Οβ βΆ Οβ = no (Ξ» ())
β€ β‘? ΞΌ Οβ βΆ Οβ = no (Ξ» ())
var x β‘? β₯ = no (Ξ» ())
var x β‘? β€ = no (Ξ» ())
var x β‘? var y = Dec.mapβ² (cong var) drop-var (x βF y)
var x β‘? Οβ βΆ Οβ = no (Ξ» ())
var x β‘? ΞΌ Οβ βΆ Οβ = no (Ξ» ())
Οβ βΆ Οβ β‘? β₯ = no (Ξ» ())
Οβ βΆ Οβ β‘? β€ = no (Ξ» ())
Οβ βΆ Οβ β‘? var y = no (Ξ» ())
Οβ βΆ Οβ β‘? Οβ βΆ Οβ with Οβ β‘? Οβ | Οβ β‘? Οβ
Οβ βΆ Οβ β‘? .Οβ βΆ .Οβ | yes refl | yes refl = yes refl
Οβ βΆ Οβ β‘? Οβ βΆ Οβ | no Οββ’Οβ | _ = no (Οββ’Οβ β dropβΆΛ‘)
Οβ βΆ Οβ β‘? Οβ βΆ Οβ | _ | no Οββ’Οβ = no (Οββ’Οβ β dropβΆΚ³)
Οβ βΆ Οβ β‘? ΞΌ Οβ βΆ Οβ = no (Ξ» ())
ΞΌ Οβ βΆ Οβ β‘? β₯ = no (Ξ» ())
ΞΌ Οβ βΆ Οβ β‘? β€ = no (Ξ» ())
ΞΌ Οβ βΆ Οβ β‘? var y = no (Ξ» ())
ΞΌ Οβ βΆ Οβ β‘? Οβ βΆ Οβ = no (Ξ» ())
ΞΌ Οβ βΆ Οβ β‘? ΞΌ Οβ βΆ Οβ with Οβ β‘? Οβ | Οβ β‘? Οβ
ΞΌ Οβ βΆ Οβ β‘? ΞΌ .Οβ βΆ .Οβ | yes refl | yes refl = yes refl
ΞΌ Οβ βΆ Οβ β‘? ΞΌ Οβ βΆ Οβ | no Οββ’Οβ | _ = no (Οββ’Οβ β dropΞΌβΆΛ‘)
ΞΌ Οβ βΆ Οβ β‘? ΞΌ Οβ βΆ Οβ | _ | no Οββ’Οβ = no (Οββ’Οβ β dropΞΌβΆΚ³)
------------------------------------------------------------------------
-- Hypotheses
-- A hypothesis is a pair of types where the first is assumed to be a
-- subtype of the other.
open Data.Product public using () renaming (_,_ to _β²_)
Hyp : β β Set
Hyp n = Ty n Γ Ty n
| {
"alphanum_fraction": 0.4336378291,
"avg_line_length": 31.2773109244,
"ext": "agda",
"hexsha": "8c3b482416449ebe181ac36a531fdf95aad76950",
"lang": "Agda",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "1b90445566df0d3b4ba6e31bd0bac417b4c0eb0e",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "nad/codata",
"max_forks_repo_path": "RecursiveTypes/Syntax.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "1b90445566df0d3b4ba6e31bd0bac417b4c0eb0e",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "nad/codata",
"max_issues_repo_path": "RecursiveTypes/Syntax.agda",
"max_line_length": 72,
"max_stars_count": 1,
"max_stars_repo_head_hexsha": "1b90445566df0d3b4ba6e31bd0bac417b4c0eb0e",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "nad/codata",
"max_stars_repo_path": "RecursiveTypes/Syntax.agda",
"max_stars_repo_stars_event_max_datetime": "2021-02-13T14:48:45.000Z",
"max_stars_repo_stars_event_min_datetime": "2021-02-13T14:48:45.000Z",
"num_tokens": 1523,
"size": 3722
} |
module _ where
module Mβ where
record R : Setβ where
field
_A : Setβ
open R
-- The following code used to be syntactically incorrect, because
-- the left-hand side could be parsed either as the function r
-- applied to a pattern variable, or as the copattern _A applied
-- toΒ r. Now the former interpretation is ruled out.
r : R
r A = Set
module Mβ where
record R : Setβ where
field
_A : Setβ
open R
data D : Set where
d_A : D
-- Name parts coming from constructors can be used as part of
-- copatterns.
r : R
r A = Set
module Mβ where
data Dβ : Set where
c : Dβ
record Rβ : Setβ where
field
f_c : Set
open Rβ
-- Name parts coming from projections can be used as part of
-- constructor patterns.
F : Dβ β Setβ
F c = Set
| {
"alphanum_fraction": 0.6385836386,
"avg_line_length": 15.75,
"ext": "agda",
"hexsha": "964dc98cb17f92b7fa47341841a93d6dac6d9b3e",
"lang": "Agda",
"max_forks_count": 371,
"max_forks_repo_forks_event_max_datetime": "2022-03-30T19:00:30.000Z",
"max_forks_repo_forks_event_min_datetime": "2015-01-03T14:04:08.000Z",
"max_forks_repo_head_hexsha": "231d6ad8e77b67ff8c4b1cb35a6c31ccd988c3e9",
"max_forks_repo_licenses": [
"BSD-3-Clause"
],
"max_forks_repo_name": "Agda-zh/agda",
"max_forks_repo_path": "test/Succeed/Issue3400.agda",
"max_issues_count": 4066,
"max_issues_repo_head_hexsha": "ed8ac6f4062ea8a20fa0f62d5db82d4e68278338",
"max_issues_repo_issues_event_max_datetime": "2022-03-31T21:14:49.000Z",
"max_issues_repo_issues_event_min_datetime": "2015-01-10T11:24:51.000Z",
"max_issues_repo_licenses": [
"BSD-3-Clause"
],
"max_issues_repo_name": "shlevy/agda",
"max_issues_repo_path": "test/Succeed/Issue3400.agda",
"max_line_length": 67,
"max_stars_count": 1989,
"max_stars_repo_head_hexsha": "ed8ac6f4062ea8a20fa0f62d5db82d4e68278338",
"max_stars_repo_licenses": [
"BSD-3-Clause"
],
"max_stars_repo_name": "shlevy/agda",
"max_stars_repo_path": "test/Succeed/Issue3400.agda",
"max_stars_repo_stars_event_max_datetime": "2022-03-30T18:20:48.000Z",
"max_stars_repo_stars_event_min_datetime": "2015-01-09T23:51:16.000Z",
"num_tokens": 251,
"size": 819
} |
{-# OPTIONS --without-K #-}
open import HoTT hiding (_::_)
module algebra.Word {i} (A : Type i) where
data Word : Type i where
nil : Word
_::_ : A β Word β Word
_inv::_ : A β Word β Word
infixr 60 _::_ _inv::_
-- The following six functions prove things like if [x β· v β‘ y β· w],
-- then [x β‘ y].
-- This is not as easy as it sounds, you cannot directly induct on the equality
-- (because [x β· v] is not a general element of type word), so you have to
-- extract the head, but itβs not always possibleβ¦
Word= : (v w : Word) β Type i
Word= nil nil = Lift β€
Word= nil (y :: w) = Lift β₯
Word= nil (y inv:: w) = Lift β₯
Word= (x :: v) nil = Lift β₯
Word= (x :: v) (y :: w) = (x == y) Γ (v == w)
Word= (x :: v) (y inv:: w) = Lift β₯
Word= (x inv:: v) nil = Lift β₯
Word= (x inv:: v) (y :: w) = Lift β₯
Word= (x inv:: v) (y inv:: w) = (x == y) Γ (v == w)
Word=-out : {v w : Word} (p : v == w) β Word= v w
Word=-out {v = nil} idp = lift unit
Word=-out {v = x :: v} idp = (idp , idp)
Word=-out {v = x inv:: v} idp = (idp , idp)
Word=-in : {v w : Word} β Word= v w β v == w
Word=-in {nil} {nil} _ = idp
Word=-in {nil} {y :: w} (lift ())
Word=-in {nil} {y inv:: w} (lift ())
Word=-in {x :: v} {nil} (lift ())
Word=-in {x :: v} {y :: w} (p , q) = ap2 _::_ p q
Word=-in {x :: v} {y inv:: w} (lift ())
Word=-in {x inv:: v} {nil} (lift ())
Word=-in {x inv:: v} {y :: w} (lift ())
Word=-in {x inv:: v} {y inv:: w} (p , q) = ap2 _inv::_ p q
Word-fst= : {x y : A} {v w : Word} (p : x :: v == y :: w) β x == y
Word-fst= p = fst (Word=-out p)
Word-snd= : {x y : A} {v w : Word} (p : x :: v == y :: w) β v == w
Word-snd= p = snd (Word=-out p)
Word-fst=' : {x y : A} {v w : Word} (p : x inv:: v == y inv:: w) β x == y
Word-fst=' p = fst (Word=-out p)
Word-snd=' : {x y : A} {v w : Word} (p : x inv:: v == y inv:: w) β v == w
Word-snd=' p = snd (Word=-out p)
| {
"alphanum_fraction": 0.4459980714,
"avg_line_length": 35.7586206897,
"ext": "agda",
"hexsha": "08a8586acdaa5a6988b1bc3ea81ecb0b3ec3cde9",
"lang": "Agda",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "939a2d83e090fcc924f69f7dfa5b65b3b79fe633",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "nicolaikraus/HoTT-Agda",
"max_forks_repo_path": "algebra/Word.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "939a2d83e090fcc924f69f7dfa5b65b3b79fe633",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "nicolaikraus/HoTT-Agda",
"max_issues_repo_path": "algebra/Word.agda",
"max_line_length": 81,
"max_stars_count": 1,
"max_stars_repo_head_hexsha": "f8fa68bf753d64d7f45556ca09d0da7976709afa",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "UlrikBuchholtz/HoTT-Agda",
"max_stars_repo_path": "algebra/Word.agda",
"max_stars_repo_stars_event_max_datetime": "2021-06-30T00:17:55.000Z",
"max_stars_repo_stars_event_min_datetime": "2021-06-30T00:17:55.000Z",
"num_tokens": 831,
"size": 2074
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.