Search is not available for this dataset
text
string
meta
dict
open import FRP.JS.Bool using ( Bool ) open import FRP.JS.True using ( ⊤ ; tt ) open import FRP.JS.String using ( String ) open import FRP.JS.True using ( True ) open import FRP.JS.RSet open import FRP.JS.Behaviour module FRP.JS.QUnit where infixr 4 _,_ data Test : Set where ε : Test _,_ : Test → Test → Test ok : String → (b : {t : ⊤} → Bool) → {b✓ : True b} → Test ok! : String → (b : {t : ⊤} → Bool) → Test ok◇ : String → (b : ⟦ Beh ⟨ Bool ⟩ ⟧) → Test data TestSuite : Set where ε : TestSuite _,_ : TestSuite → TestSuite → TestSuite test : String → Test → TestSuite data TestSuites : Set where ε : TestSuites _,_ : TestSuites → TestSuites → TestSuites suite : String → TestSuite → TestSuites
{ "alphanum_fraction": 0.638121547, "avg_line_length": 24.9655172414, "ext": "agda", "hexsha": "568124de0fea7163a8765947999952d358b44f57", "lang": "Agda", "max_forks_count": 7, "max_forks_repo_forks_event_max_datetime": "2022-03-12T11:39:38.000Z", "max_forks_repo_forks_event_min_datetime": "2016-11-07T21:50:58.000Z", "max_forks_repo_head_hexsha": "c7ccaca624cb1fa1c982d8a8310c313fb9a7fa72", "max_forks_repo_licenses": [ "MIT", "BSD-3-Clause" ], "max_forks_repo_name": "agda/agda-frp-js", "max_forks_repo_path": "test/agda/FRP/JS/QUnit.agda", "max_issues_count": null, "max_issues_repo_head_hexsha": "c7ccaca624cb1fa1c982d8a8310c313fb9a7fa72", "max_issues_repo_issues_event_max_datetime": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_licenses": [ "MIT", "BSD-3-Clause" ], "max_issues_repo_name": "agda/agda-frp-js", "max_issues_repo_path": "test/agda/FRP/JS/QUnit.agda", "max_line_length": 59, "max_stars_count": 63, "max_stars_repo_head_hexsha": "c7ccaca624cb1fa1c982d8a8310c313fb9a7fa72", "max_stars_repo_licenses": [ "MIT", "BSD-3-Clause" ], "max_stars_repo_name": "agda/agda-frp-js", "max_stars_repo_path": "test/agda/FRP/JS/QUnit.agda", "max_stars_repo_stars_event_max_datetime": "2022-02-28T09:46:14.000Z", "max_stars_repo_stars_event_min_datetime": "2015-04-20T21:47:00.000Z", "num_tokens": 255, "size": 724 }
module _ where module A where data D : Set₁ where !_ : Set → D infix 3 !_ data C : Set₁ where #_ : A.D → C infix 2 #_ module B where data D : Set₁ where !_ : C → D infix 1 !_ open A open B ok₁ : B.D → B.D ok₁ (! # X) = ! # X ok₂ : C → C ok₂ (# ! X) = # ! X
{ "alphanum_fraction": 0.3994413408, "avg_line_length": 11.9333333333, "ext": "agda", "hexsha": "e309ca3b5f49eee0e18ec3015d345fdc40a6e3bb", "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/Issue1436-13.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/Issue1436-13.agda", "max_line_length": 25, "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/Issue1436-13.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": 358 }
{-# OPTIONS --safe --warning=error --without-K #-} open import LogicalFormulae open import Setoids.Setoids open import Sets.EquivalenceRelations open import Rings.Definition open import Rings.Homomorphisms.Definition module Rings.Homomorphisms.Image {a b c d : _} {A : Set a} {B : Set c} {S : Setoid {a} {b} A} {T : Setoid {c} {d} B} {_+A_ _*A_ : A → A → A} {_+B_ _*B_ : B → B → B} {R1 : Ring S _+A_ _*A_} {R2 : Ring T _+B_ _*B_} {f : A → B} (hom : RingHom R1 R2 f) where open import Groups.Homomorphisms.Image (RingHom.groupHom hom) open import Rings.Subrings.Definition imageGroupSubring : Subring R2 imageGroupPred Subring.isSubgroup imageGroupSubring = imageGroupSubgroup Subring.containsOne imageGroupSubring = Ring.1R R1 , RingHom.preserves1 hom Subring.closedUnderProduct imageGroupSubring {x} {y} (a , fa=x) (b , fb=y) = (a *A b) , transitive ringHom (Ring.*WellDefined R2 fa=x fb=y) where open Setoid T open Equivalence eq open RingHom hom
{ "alphanum_fraction": 0.7128099174, "avg_line_length": 42.0869565217, "ext": "agda", "hexsha": "1d91ad458432ea9020ab27bbff423c1be841e269", "lang": "Agda", "max_forks_count": 1, "max_forks_repo_forks_event_max_datetime": "2021-11-29T13:23:07.000Z", "max_forks_repo_forks_event_min_datetime": "2021-11-29T13:23:07.000Z", "max_forks_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "Smaug123/agdaproofs", "max_forks_repo_path": "Rings/Homomorphisms/Image.agda", "max_issues_count": 14, "max_issues_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_issues_repo_issues_event_max_datetime": "2020-04-11T11:03:39.000Z", "max_issues_repo_issues_event_min_datetime": "2019-01-06T21:11:59.000Z", "max_issues_repo_licenses": [ "MIT" ], "max_issues_repo_name": "Smaug123/agdaproofs", "max_issues_repo_path": "Rings/Homomorphisms/Image.agda", "max_line_length": 254, "max_stars_count": 4, "max_stars_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "Smaug123/agdaproofs", "max_stars_repo_path": "Rings/Homomorphisms/Image.agda", "max_stars_repo_stars_event_max_datetime": "2022-01-28T06:04:15.000Z", "max_stars_repo_stars_event_min_datetime": "2019-08-08T12:44:19.000Z", "num_tokens": 332, "size": 968 }
open import Data.Nat open import Data.Vec open import Data.List open import Relation.Binary.PropositionalEquality open ≡-Reasoning module DependentFold where Nat = ℕ dfold : ∀ {a : Set} → {k : Nat} → (p : Nat → Set) → ((l : Nat) → a → p l → p (1 + l)) → p 0 → Vec a k → p k dfold {k = 0} p step base [] = base dfold {k = suc n} p step base (x ∷ xs) = step n x (dfold p step base xs) foldrₗ : {a b : Set} -> (a -> b -> b) -> b -> List a -> b foldrₗ step base [] = base foldrₗ step base (x ∷ xs) = step x (foldrₗ step base xs) map_motive : Set -> Nat -> Set map_motive a l = Vec a l dmap : {a b : Set} → {n : ℕ} → (a → b) → Vec a n → Vec b n dmap {a} {b} {n} f xs = dfold (map_motive b) (λ _ x xs → f x ∷ xs) [] xs _ : dmap (λ x → x + 3) (1 ∷ 2 ∷ 3 ∷ []) ≡ (4 ∷ 5 ∷ 6 ∷ []) _ = refl dappend : {a : Set} → {m n : ℕ} → Vec a m → Vec a n → Vec a (m + n) dappend {a} {m} {n} xs ys = dfold (λ l → Vec a (l + n)) (λ _ x xs → x ∷ xs) ys xs _ : dappend (1 ∷ 2 ∷ []) (3 ∷ 4 ∷ []) ≡ 1 ∷ 2 ∷ 3 ∷ 4 ∷ [] _ = refl ind : {a : Set} {p : List a → Set} → ((x : a) → {xs : List a} → p xs → p (x ∷ xs)) → p [] → (l : List a) → p l ind step base [] = base ind step base (x ∷ xs) = step x (ind step base xs)
{ "alphanum_fraction": 0.4880382775, "avg_line_length": 26.125, "ext": "agda", "hexsha": "0880c9eb53eccb844cf42d2996287f3945e53d64", "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": "c242aa97ef02ba1edf32f2ee96dd2d7b8ac6e1e4", "max_forks_repo_licenses": [ "BSD-3-Clause" ], "max_forks_repo_name": "ryanorendorff/ryan.orendorff.io", "max_forks_repo_path": "src/posts/2020-12-19-dependent-fold/DependentFold.agda", "max_issues_count": 1, "max_issues_repo_head_hexsha": "c242aa97ef02ba1edf32f2ee96dd2d7b8ac6e1e4", "max_issues_repo_issues_event_max_datetime": "2021-12-31T08:13:39.000Z", "max_issues_repo_issues_event_min_datetime": "2020-12-19T20:17:54.000Z", "max_issues_repo_licenses": [ "BSD-3-Clause" ], "max_issues_repo_name": "ryanorendorff/ryan.orendorff.io", "max_issues_repo_path": "src/posts/2020-12-19-dependent-fold/DependentFold.agda", "max_line_length": 81, "max_stars_count": null, "max_stars_repo_head_hexsha": "c242aa97ef02ba1edf32f2ee96dd2d7b8ac6e1e4", "max_stars_repo_licenses": [ "BSD-3-Clause" ], "max_stars_repo_name": "ryanorendorff/ryan.orendorff.io", "max_stars_repo_path": "src/posts/2020-12-19-dependent-fold/DependentFold.agda", "max_stars_repo_stars_event_max_datetime": null, "max_stars_repo_stars_event_min_datetime": null, "num_tokens": 541, "size": 1254 }
module Issue1251.NonTerminating where open import Common.Prelude -- an import is necessary to trigger internal error -- a non-termination function using imported stuff bla : Nat → Set bla zero = bla zero bla (suc x) = bla x
{ "alphanum_fraction": 0.752173913, "avg_line_length": 25.5555555556, "ext": "agda", "hexsha": "b9711bcbb19545af294f5f93514941daf5d9a6a6", "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/Fail/Issue1251/NonTerminating.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/Issue1251/NonTerminating.agda", "max_line_length": 79, "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/Issue1251/NonTerminating.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": 58, "size": 230 }
------------------------------------------------------------------------------ -- Well-founded relation on lists based on their structure ------------------------------------------------------------------------------ {-# OPTIONS --exact-split #-} {-# OPTIONS --no-sized-types #-} {-# OPTIONS --no-universe-polymorphism #-} {-# OPTIONS --without-K #-} module FOTC.Data.List.WF-Relation.LT-Cons where open import FOTC.Base open import FOTC.Base.List ------------------------------------------------------------------------------ -- Well-founded relation on lists based on their structure. LTC : D → D → Set LTC xs ys = ∃[ x ] ys ≡ x ∷ xs
{ "alphanum_fraction": 0.4041297935, "avg_line_length": 35.6842105263, "ext": "agda", "hexsha": "c1d1eb28d3470514e31d187d2e2276b5a9aac2a3", "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/List/WF-Relation/LT-Cons.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/List/WF-Relation/LT-Cons.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/List/WF-Relation/LT-Cons.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": 118, "size": 678 }
{-# OPTIONS --cubical --sized-types --type-in-type #-} -- Oh my Nathaniel Hawthorne module n2o.Network.Internal where open import proto.Base open import proto.Map open import proto.IO {-# FOREIGN GHC import Network.N2O.Types #-} postulate Header : Set data Event (A : Set) : Set where Init : Event A Message : A → Event A Terminate : Event A data Result (A : Set) : Set where Reply : A → Result A Ok : Result A Unknown : Result A Empty : Result A record Request : Set where constructor Req field reqPath : ByteString Strict reqMeth : ByteString Strict reqVers : ByteString Strict reqHead : List Header mutual data N2OT (S : Set) (M : Set → Set) (A : Set) : Set where runN2O : S → M A → N2OT S M A N2O : (F : Set → Set) (A : Set) → Set → Set N2O F A = N2OT (State F A) IO -- N2O F A = ReaderT (IORef (Context F A)) IO {-# NO_POSITIVITY_CHECK #-} record Context (F : Set → Set) (A : Set) : Set where constructor mkCx field cxHandler : Event A → N2O F A (Result A) → Context F A -- TODO : Strict Positivity cxRequest : Request cxMiddleware : List (Context F A → Context F A) -- TODO : Strict Positivity cxProtos : List (Proto F A) -- TODO : Strict Positivity cxActions : ByteString Strict cxDict : Map (ByteString Strict) (ByteString Strict) State : (F : Set → Set) (A : Set) → Set State F A = IORef (Context F A) -- TODO : comp record Proto (F : Set → Set) (A : Set) : Set where inductive constructor proto field protoInfo : F A → N2O F A (Result (F A)) {-# COMPILE GHC Context = data Network.N2O.Types.Context (mkCx) #-} {-# COMPILE GHC Header = type Network.N2O.Types.Header #-} {-# COMPILE GHC N2OT = data Network.N2O.Types.N2OT ( runN2O ) #-} {-# COMPILE GHC Proto = data Network.N2O.Types.Proto ( protoInfo ) #-} {-# COMPILE GHC Event = data Network.N2O.Types.Event ( Init | Message | Terminate ) #-} {-# COMPILE GHC Request = data Network.N2O.Types.Request ( Req ) #-} {-# COMPILE GHC Result = data Network.N2O.Types.Result ( Reply | Ok | Unknown | Empty ) #-}
{ "alphanum_fraction": 0.5475704369, "avg_line_length": 36.0147058824, "ext": "agda", "hexsha": "3b8346a6feb7c22b612be3d77a08e61b48e9f298", "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": "d7903dfffcd66ae174eed9347afe008f892b2491", "max_forks_repo_licenses": [ "BSD-3-Clause" ], "max_forks_repo_name": "o4/n2o", "max_forks_repo_path": "n2o/Network/Internal.agda", "max_issues_count": null, "max_issues_repo_head_hexsha": "d7903dfffcd66ae174eed9347afe008f892b2491", "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": "o4/n2o", "max_issues_repo_path": "n2o/Network/Internal.agda", "max_line_length": 104, "max_stars_count": 3, "max_stars_repo_head_hexsha": "d7903dfffcd66ae174eed9347afe008f892b2491", "max_stars_repo_licenses": [ "BSD-3-Clause" ], "max_stars_repo_name": "o4/n2o", "max_stars_repo_path": "n2o/Network/Internal.agda", "max_stars_repo_stars_event_max_datetime": "2019-01-02T06:37:47.000Z", "max_stars_repo_stars_event_min_datetime": "2018-11-30T11:37:10.000Z", "num_tokens": 670, "size": 2449 }
module Issue1839.A where postulate PrintThis : Set
{ "alphanum_fraction": 0.7636363636, "avg_line_length": 9.1666666667, "ext": "agda", "hexsha": "0a17598949d52a92339ac0cbf609d26cecff0787", "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/Issue1839/A.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/Issue1839/A.agda", "max_line_length": 24, "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/Issue1839/A.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": 17, "size": 55 }
module _ where -- open import Common.Prelude module Id (A : Set) where id : A → A id x = x module _ (A : Set) where open Id A id2 = id
{ "alphanum_fraction": 0.5945945946, "avg_line_length": 10.5714285714, "ext": "agda", "hexsha": "0b486031f6a63887363c8e9ac7ba4a14dbcf80fb", "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/AnonymousModuleWithParameter.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/AnonymousModuleWithParameter.agda", "max_line_length": 29, "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/AnonymousModuleWithParameter.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": 53, "size": 148 }
-- Copyright: (c) 2016 Ertugrul Söylemez -- License: BSD3 -- Maintainer: Ertugrul Söylemez <[email protected]> module Data.Nat where open import Algebra.Group open import Classes open import Core open import Data.Nat.Core open import Data.Nat.Core public using (ℕ; ℕ-Number; ℕ-Plus; ℕ-Times; ℕ,≤; module ℕ,≤; suc; zero) ℕ,+ : Monoid ℕ,+ = record { semigroup = record { A = ℕ; Eq = PropEq ℕ; semigroupOver = record { _⋄_ = _+_; ⋄-cong = cong2 _+_; assoc = Props.+-assoc } }; isMonoid = record { id = 0; left-id = Props.+-left-id; right-id = Props.+-right-id } } module ℕ,+ = Monoid ℕ,+ ℕ,* : Monoid ℕ,* = record { semigroup = record { A = ℕ; Eq = PropEq ℕ; semigroupOver = record { _⋄_ = _*_; ⋄-cong = cong2 _*_; assoc = Props.*-assoc } }; isMonoid = record { id = 1; left-id = Props.*-left-id; right-id = Props.*-right-id } } module ℕ,* = Monoid ℕ,*
{ "alphanum_fraction": 0.5219047619, "avg_line_length": 17.7966101695, "ext": "agda", "hexsha": "48dd0d0ffda7fbe708019bab8cba90d1ecaadbd1", "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": "d9245e5a8b2e902781736de09bd17e81022f6f13", "max_forks_repo_licenses": [ "BSD-3-Clause" ], "max_forks_repo_name": "esoeylemez/agda-simple", "max_forks_repo_path": "Data/Nat.agda", "max_issues_count": null, "max_issues_repo_head_hexsha": "d9245e5a8b2e902781736de09bd17e81022f6f13", "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": "esoeylemez/agda-simple", "max_issues_repo_path": "Data/Nat.agda", "max_line_length": 48, "max_stars_count": 1, "max_stars_repo_head_hexsha": "d9245e5a8b2e902781736de09bd17e81022f6f13", "max_stars_repo_licenses": [ "BSD-3-Clause" ], "max_stars_repo_name": "esoeylemez/agda-simple", "max_stars_repo_path": "Data/Nat.agda", "max_stars_repo_stars_event_max_datetime": "2019-10-07T17:36:42.000Z", "max_stars_repo_stars_event_min_datetime": "2019-10-07T17:36:42.000Z", "num_tokens": 356, "size": 1050 }
module RecordConstructorOutOfScope where record R : Set where constructor con id : R id = con
{ "alphanum_fraction": 0.7352941176, "avg_line_length": 12.75, "ext": "agda", "hexsha": "06e26da8ad2b577ac8a4ea4fb3426133ee656c4b", "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/RecordConstructorOutOfScope.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/RecordConstructorOutOfScope.agda", "max_line_length": 40, "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/RecordConstructorOutOfScope.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": 27, "size": 102 }
{-# OPTIONS --safe --experimental-lossy-unification #-} module Cubical.ZCohomology.RingStructure.CohomologyRing where open import Cubical.Foundations.Prelude open import Cubical.Foundations.Isomorphism open import Cubical.Foundations.Transport open import Cubical.Data.Nat renaming (_+_ to _+n_ ; _·_ to _·n_) open import Cubical.Data.Sigma open import Cubical.Data.Sum open import Cubical.Algebra.Monoid open import Cubical.Algebra.Monoid.Instances.NatPlusBis open import Cubical.Algebra.Group open import Cubical.Algebra.Group.Morphisms open import Cubical.Algebra.Group.MorphismProperties open import Cubical.Algebra.AbGroup open import Cubical.Algebra.Ring open import Cubical.Algebra.GradedRing.DirectSumHIT open import Cubical.Algebra.DirectSum.DirectSumHIT.Base open import Cubical.Algebra.AbGroup.Instances.DirectSumHIT open import Cubical.HITs.SetTruncation as ST open import Cubical.ZCohomology.Base open import Cubical.ZCohomology.GroupStructure open import Cubical.ZCohomology.RingStructure.CupProduct open import Cubical.ZCohomology.RingStructure.RingLaws open import Cubical.ZCohomology.RingStructure.GradedCommutativity private variable ℓ ℓ' : Level open Iso ----------------------------------------------------------------------------- -- Definition Cohomology Ring open PlusBis open GradedRing-⊕HIT-index open GradedRing-⊕HIT-⋆ module _ (A : Type ℓ) where H*R : Ring ℓ H*R = ⊕HITgradedRing-Ring NatPlusBis-Monoid (λ k → coHom k A) (λ k → snd (coHomGroup k A)) 1⌣ _⌣_ (λ {k} {l} → 0ₕ-⌣ k l) (λ {k} {l} → ⌣-0ₕ k l) (λ _ _ _ → sym (ΣPathTransport→PathΣ _ _ ((sym (+'-assoc _ _ _)) , (sym (assoc-⌣ _ _ _ _ _ _))))) (λ _ → sym (ΣPathTransport→PathΣ _ _ (sym (+'-rid _) , sym (lUnit⌣ _ _)))) (λ _ → ΣPathTransport→PathΣ _ _ (refl , transportRefl _ ∙ rUnit⌣ _ _)) (λ _ _ _ → leftDistr-⌣ _ _ _ _ _) λ _ _ _ → rightDistr-⌣ _ _ _ _ _ H* : Type ℓ H* = fst H*R module gradedRingProperties (A : Type ℓ) where open RingStr (snd (H*R A)) renaming (_·_ to _cup_) ----------------------------------------------------------------------------- -- Graded Comutative Ring -- def + commutation with base -^-gen : (n m : ℕ) → (p : isEvenT n ⊎ isOddT n) → (q : isEvenT m ⊎ isOddT m) → H* A → H* A -^-gen n m (inl p) q x = x -^-gen n m (inr p) (inl q) x = x -^-gen n m (inr p) (inr q) x = - x -^_·_ : (n m : ℕ) → H* A → H* A -^_·_ n m x = -^-gen n m (evenOrOdd n) (evenOrOdd m) x -^-gen-base : {k : ℕ} → (n m : ℕ) → (p : isEvenT n ⊎ isOddT n) → (q : isEvenT m ⊎ isOddT m) (a : coHom k A) → -^-gen n m p q (base k a) ≡ base k (-ₕ^-gen n m p q a) -^-gen-base n m (inl p) q a = refl -^-gen-base n m (inr p) (inl q) a = refl -^-gen-base n m (inr p) (inr q) a = refl -^-base : {k : ℕ} → (n m : ℕ) → (a : coHom k A) → (-^ n · m) (base k a) ≡ base k ((-ₕ^ n · m) a) -^-base n m a = -^-gen-base n m (evenOrOdd n) (evenOrOdd m) a gradCommRing : (n m : ℕ) → (a : coHom n A) → (b : coHom m A) → (base n a) cup (base m b) ≡ (-^ n · m) ((base m b) cup (base n a)) gradCommRing n m a b = base (n +' m) (a ⌣ b) ≡⟨ cong (base (n +' m)) (gradedComm-⌣ n m a b) ⟩ base (n +' m) ((-ₕ^ n · m) (subst (λ n₁ → coHom n₁ A) (+'-comm m n) (b ⌣ a))) ≡⟨ sym (-^-base n m (subst (λ k → coHom k A) (+'-comm m n) (b ⌣ a))) ⟩ (-^ n · m) (base (n +' m) (subst (λ k → coHom k A) (+'-comm m n) (b ⌣ a))) ≡⟨ cong (-^ n · m) (sym (constSubstCommSlice (λ k → coHom k A) (H* A) base (+'-comm m n) (b ⌣ a))) ⟩ (-^ n · m) (base (m +' n) (b ⌣ a)) ∎ ----------------------------------------------------------------------------- -- Equivalence of Type implies equivalence of Cohomology Ring module CohomologyRing-Equiv {X : Type ℓ} {Y : Type ℓ'} (e : Iso X Y) where open IsGroupHom open RingStr (snd (H*R X)) using () renaming ( 0r to 0H*X ; 1r to 1H*X ; _+_ to _+H*X_ ; -_ to -H*X_ ; _·_ to _cupX_ ; +Assoc to +H*XAssoc ; +IdR to +H*XIdR ; +Comm to +H*XComm ; ·Assoc to ·H*XAssoc ; is-set to isSetH*X ) open RingStr (snd (H*R Y)) using () renaming ( 0r to 0H*Y ; 1r to 1H*Y ; _+_ to _+H*Y_ ; -_ to -H*Y_ ; _·_ to _cupY_ ; +Assoc to +H*YAssoc ; +IdR to +H*YIdR ; +Comm to +H*YComm ; ·Assoc to ·H*YAssoc ; is-set to isSetH*Y ) coHomGr-Iso : {n : ℕ} → GroupIso (coHomGr n X) (coHomGr n Y) fst (coHomGr-Iso {n}) = is where is : Iso (coHom n X) (coHom n Y) fun is = ST.rec squash₂ (λ f → ∣ (λ y → f (inv e y)) ∣₂) inv is = ST.rec squash₂ (λ g → ∣ (λ x → g (fun e x)) ∣₂) rightInv is = ST.elim (λ _ → isProp→isSet (squash₂ _ _)) (λ f → cong ∣_∣₂ (funExt (λ y → cong f (rightInv e y)))) leftInv is = ST.elim (λ _ → isProp→isSet (squash₂ _ _)) (λ g → cong ∣_∣₂ (funExt (λ x → cong g (leftInv e x)))) snd (coHomGr-Iso {n}) = makeIsGroupHom (ST.elim (λ _ → isProp→isSet λ u v i y → squash₂ _ _ (u y) (v y) i) (λ f → ST.elim (λ _ → isProp→isSet (squash₂ _ _)) (λ f' → refl))) H*-X→H*-Y : H* X → H* Y H*-X→H*-Y = DS-Rec-Set.f _ _ _ _ isSetH*Y 0H*Y (λ n a → base n (fun (fst coHomGr-Iso) a)) _+H*Y_ +H*YAssoc +H*YIdR +H*YComm (λ n → cong (base n) (pres1 (snd coHomGr-Iso)) ∙ base-neutral n) λ n a b → base-add _ _ _ ∙ cong (base n) (sym (pres· (snd coHomGr-Iso) a b)) H*-Y→H*-X : H* Y → H* X H*-Y→H*-X = DS-Rec-Set.f _ _ _ _ isSetH*X 0H*X (λ m a → base m (inv (fst coHomGr-Iso) a)) _+H*X_ +H*XAssoc +H*XIdR +H*XComm (λ m → cong (base m) (pres1 (snd (invGroupIso coHomGr-Iso))) ∙ base-neutral m) λ m a b → base-add _ _ _ ∙ cong (base m) (sym (pres· (snd (invGroupIso coHomGr-Iso)) a b)) e-sect : (y : H* Y) → H*-X→H*-Y (H*-Y→H*-X y) ≡ y e-sect = DS-Ind-Prop.f _ _ _ _ (λ _ → isSetH*Y _ _) refl (λ m a → cong (base m) (rightInv (fst coHomGr-Iso) a)) (λ {U V} ind-U ind-V → cong₂ _+H*Y_ ind-U ind-V) e-retr : (x : H* X) → H*-Y→H*-X (H*-X→H*-Y x) ≡ x e-retr = DS-Ind-Prop.f _ _ _ _ (λ _ → isSetH*X _ _) refl (λ n a → cong (base n) (leftInv (fst coHomGr-Iso) a)) (λ {U V} ind-U ind-V → cong₂ _+H*X_ ind-U ind-V) H*-X→H*-Y-pres1 : H*-X→H*-Y 1H*X ≡ 1H*Y H*-X→H*-Y-pres1 = refl H*-X→H*-Y-pres+ : (x x' : H* X) → H*-X→H*-Y (x +H*X x') ≡ H*-X→H*-Y x +H*Y H*-X→H*-Y x' H*-X→H*-Y-pres+ x x' = refl H*-X→H*-Y-pres· : (x x' : H* X) → H*-X→H*-Y (x cupX x') ≡ H*-X→H*-Y x cupY H*-X→H*-Y x' H*-X→H*-Y-pres· = DS-Ind-Prop.f _ _ _ _ (λ x u v i y → isSetH*Y _ _ (u y) (v y) i) (λ _ → refl) (λ n → ST.elim (λ x → isProp→isSet λ u v i y → isSetH*Y _ _ (u y) (v y) i) (λ f → DS-Ind-Prop.f _ _ _ _ (λ _ → isSetH*Y _ _) refl (λ m → ST.elim (λ _ → isProp→isSet (isSetH*Y _ _)) (λ g → refl)) λ {U V} ind-U ind-V → cong₂ _+H*Y_ ind-U ind-V) ) (λ {U V} ind-U ind-V y → cong₂ _+H*Y_ (ind-U y) (ind-V y)) module _ {X : Type ℓ} {Y : Type ℓ'} (e : Iso X Y) where open CohomologyRing-Equiv e CohomologyRing-Equiv : RingEquiv (H*R X) (H*R Y) fst CohomologyRing-Equiv = isoToEquiv is where is : Iso (H* X) (H* Y) fun is = H*-X→H*-Y inv is = H*-Y→H*-X rightInv is = e-sect leftInv is = e-retr snd CohomologyRing-Equiv = makeIsRingHom H*-X→H*-Y-pres1 H*-X→H*-Y-pres+ H*-X→H*-Y-pres·
{ "alphanum_fraction": 0.4952251023, "avg_line_length": 36.3198198198, "ext": "agda", "hexsha": "5cdf442ef40028d264b1a2b72cb59ef0836e0eed", "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/ZCohomology/RingStructure/CohomologyRing.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/ZCohomology/RingStructure/CohomologyRing.agda", "max_line_length": 133, "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/ZCohomology/RingStructure/CohomologyRing.agda", "max_stars_repo_stars_event_max_datetime": null, "max_stars_repo_stars_event_min_datetime": null, "num_tokens": 3122, "size": 8063 }
open import Relation.Binary module Data.FingerTree.Relation.Binary.Reasoning.FasterInference.Setoid {ℓ₁ ℓ₂} (setoid : Setoid ℓ₁ ℓ₂) where open import Relation.Binary.PropositionalEquality as ≡ using (_≡_) open Setoid setoid infix 4 _IsRelatedTo_ infix 3 _∎ infixr 2 step-≈ step-≈˘ step-≡ step-≡˘ infixr 2 _≡⟨⟩_ infix 1 begin_ data _IsRelatedTo_ (x y : Carrier) : Set ℓ₂ where relTo : (x≈y : x ≈ y) → x IsRelatedTo y begin_ : ∀ {x y} → x IsRelatedTo y → x ≈ y begin relTo x≈y = x≈y step-≈ : ∀ x {y z} → y IsRelatedTo z → x ≈ y → x IsRelatedTo z step-≈ _ (relTo y≈z) x≈y = relTo (trans x≈y y≈z) syntax step-≈ x y≈z x≈y = x ≈⟨ x≈y ⟩ y≈z step-≈˘ : ∀ x {y z} → y IsRelatedTo z → y ≈ x → x IsRelatedTo z step-≈˘ _ (relTo y≈z) y≈x = relTo (trans (sym y≈x) y≈z) syntax step-≈˘ x y≈z y≈x = x ≈˘⟨ y≈x ⟩ y≈z step-≡ : ∀ x {y z} → y IsRelatedTo z → x ≡ y → x IsRelatedTo z step-≡ _ x≈z ≡.refl = x≈z syntax step-≡ x y≡z x≡y = x ≡⟨ x≡y ⟩ y≡z step-≡˘ : ∀ x {y z} → y IsRelatedTo z → y ≡ x → x IsRelatedTo z step-≡˘ _ x≈z ≡.refl = x≈z syntax step-≡˘ x y≡z y≡x = x ≡˘⟨ y≡x ⟩ y≡z _≡⟨⟩_ : ∀ x {y} → x IsRelatedTo y → x IsRelatedTo y _ ≡⟨⟩ x≈y = _ ≡⟨ ≡.refl ⟩ x≈y _∎ : ∀ x → x IsRelatedTo x _∎ _ = relTo refl
{ "alphanum_fraction": 0.5947063689, "avg_line_length": 26.2826086957, "ext": "agda", "hexsha": "da73f7eb2321a64de4b7dbae73153e589750c843", "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": "39c3d96937384b052b782ffddf4fdec68c5d139f", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "oisdk/agda-indexed-fingertree", "max_forks_repo_path": "src/Data/FingerTree/Relation/Binary/Reasoning/FasterInference/Setoid.agda", "max_issues_count": null, "max_issues_repo_head_hexsha": "39c3d96937384b052b782ffddf4fdec68c5d139f", "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": "oisdk/agda-indexed-fingertree", "max_issues_repo_path": "src/Data/FingerTree/Relation/Binary/Reasoning/FasterInference/Setoid.agda", "max_line_length": 109, "max_stars_count": 1, "max_stars_repo_head_hexsha": "39c3d96937384b052b782ffddf4fdec68c5d139f", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "oisdk/agda-indexed-fingertree", "max_stars_repo_path": "src/Data/FingerTree/Relation/Binary/Reasoning/FasterInference/Setoid.agda", "max_stars_repo_stars_event_max_datetime": "2019-02-26T07:04:54.000Z", "max_stars_repo_stars_event_min_datetime": "2019-02-26T07:04:54.000Z", "num_tokens": 643, "size": 1209 }
module Generic.Test.Data.Vec where open import Generic.Main import Data.Vec as Vec infixr 5 _∷ᵥ_ Vec : ∀ {α} -> Set α -> ℕ -> Set α Vec = readData Vec.Vec -- []ᵥ : ∀ {α} {A : Set α} -> Vec A 0 pattern []ᵥ = #₀ lrefl -- _∷ᵥ_ : ∀ {n α} {A : Set α} -> A -> Vec A n -> Vec A (suc n) pattern _∷ᵥ_ {n} x xs = !#₁ (relv n , relv x , xs , lrefl) elimVec : ∀ {n α π} {A : Set α} -> (P : ∀ {n} -> Vec A n -> Set π) -> (∀ {n} {xs : Vec A n} x -> P xs -> P (x ∷ᵥ xs)) -> P []ᵥ -> (xs : Vec A n) -> P xs elimVec P f z []ᵥ = z elimVec P f z (x ∷ᵥ xs) = f x (elimVec P f z xs)
{ "alphanum_fraction": 0.4634146341, "avg_line_length": 23.6538461538, "ext": "agda", "hexsha": "c241d624b323f689d77a1091f3fa2dc0a239b16d", "lang": "Agda", "max_forks_count": 4, "max_forks_repo_forks_event_max_datetime": "2021-01-27T12:57:09.000Z", "max_forks_repo_forks_event_min_datetime": "2017-07-17T07:23:39.000Z", "max_forks_repo_head_hexsha": "e102b0ec232f2796232bd82bf8e3906c1f8a93fe", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "turion/Generic", "max_forks_repo_path": "src/Generic/Test/Data/Vec.agda", "max_issues_count": 9, "max_issues_repo_head_hexsha": "e102b0ec232f2796232bd82bf8e3906c1f8a93fe", "max_issues_repo_issues_event_max_datetime": "2022-01-04T15:43:14.000Z", "max_issues_repo_issues_event_min_datetime": "2017-04-06T18:58:09.000Z", "max_issues_repo_licenses": [ "MIT" ], "max_issues_repo_name": "turion/Generic", "max_issues_repo_path": "src/Generic/Test/Data/Vec.agda", "max_line_length": 62, "max_stars_count": 30, "max_stars_repo_head_hexsha": "e102b0ec232f2796232bd82bf8e3906c1f8a93fe", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "turion/Generic", "max_stars_repo_path": "src/Generic/Test/Data/Vec.agda", "max_stars_repo_stars_event_max_datetime": "2022-02-05T10:19:38.000Z", "max_stars_repo_stars_event_min_datetime": "2016-07-19T21:10:54.000Z", "num_tokens": 277, "size": 615 }
-- Andreas, issue reported by Matteo Acerbi, 2014-09-04. -- Short summary: x = c x is not impossible for coinductive constructors c, -- so x should not be considered a strictly rigid occurrence in (c x). -- Matteo: -- In the following I cannot understand what justifies the absurd pattern -- in the definition of ¬id≡In: as νId is coinductive, elaboration of the -- no-cycles check to eliminators should not be possible (as far as I know). -- Any two inhabitants of νId are bisimilar, but it seems that current -- pattern matching makes it inconsistent to assume that bisimilarity -- implies equality for νId, which *might* upset some. :-) {-# OPTIONS --copatterns #-} -- False and equality. ⊥ = (X : Set) → X data _≡_ {A : Set}(x : A) : A → Set where <> : x ≡ x -- The cofixpoint of the identity functor. record νId : Set where coinductive constructor In field Out : νId open νId -- The "only" inhabitant of νId. tt : νId Out tt = tt -- x ≡ In x is considered absurd. ¬id≡In : {x : νId} → x ≡ In x → ⊥ ¬id≡In () -- _≈_ is bisimilarity for elements of νId. record _≈νId_ (x y : νId) : Set where coinductive field step : Out x ≈νId Out y open _≈νId_ -- Any two elements are bisimilar. trivial-≈νId : ∀ {x y} → x ≈νId y step trivial-≈νId = trivial-≈νId -- For νId it is not consistent to assume that bisimilarity implies -- equality. problem? : (ext : ∀ {x y} → x ≈νId y → x ≡ y) → ⊥ problem? ext = ¬id≡In {tt} (ext trivial-≈νId)
{ "alphanum_fraction": 0.6689419795, "avg_line_length": 24.8305084746, "ext": "agda", "hexsha": "43b605ba6176f2f50165213f11a8344aa454ad32", "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/Fail/Issue1271.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/Fail/Issue1271.agda", "max_line_length": 76, "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/Fail/Issue1271.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": 479, "size": 1465 }
open import Common.Prelude open import Common.Level open import Common.Reflection open import Common.Equality test₁ : quoteTerm lzero ≡ def (quote lzero) [] test₁ = refl foo : (l : Level) → Bool → Bool foo _ false = true foo _ true = false test₂ : quoteTerm (foo lzero) ≡ def (quote foo) (arg (argInfo visible relevant) (def (quote lzero) []) ∷ []) test₂ = refl test₃ : unquote (give (quoteTerm lzero)) ≡ lzero test₃ = refl
{ "alphanum_fraction": 0.7056074766, "avg_line_length": 23.7777777778, "ext": "agda", "hexsha": "49632ae42d5dad124c950eeab6630c66ff2ae8d8", "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/UnquoteLevel.agda", "max_issues_count": 3, "max_issues_repo_head_hexsha": "ed8ac6f4062ea8a20fa0f62d5db82d4e68278338", "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": "shlevy/agda", "max_issues_repo_path": "test/Succeed/UnquoteLevel.agda", "max_line_length": 108, "max_stars_count": 3, "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/UnquoteLevel.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": 133, "size": 428 }
------------------------------------------------------------------------ -- The Agda standard library -- -- Results concerning uniqueness of identity proofs ------------------------------------------------------------------------ {-# OPTIONS --without-K --safe #-} module Axiom.UniquenessOfIdentityProofs where open import Data.Empty open import Relation.Nullary open import Relation.Binary.Core open import Relation.Binary.PropositionalEquality.Core ------------------------------------------------------------------------ -- Definition -- -- Uniqueness of Identity Proofs (UIP) states that all proofs of -- equality are themselves equal. In other words, the equality relation -- is irrelevant. Here we define UIP relative to a given type. UIP : ∀ {a} (A : Set a) → Set a UIP A = Irrelevant {A = A} _≡_ ------------------------------------------------------------------------ -- Properties -- UIP always holds when using axiom K -- (see `Axiom.UniquenessOfIdentityProofs.WithK`). -- The existence of a constant function over proofs of equality for -- elements in A is enough to prove UIP for A. Indeed, we can relate any -- proof to its image via this function which we then know is equal to -- the image of any other proof. module Constant⇒UIP {a} {A : Set a} (f : _≡_ {A = A} ⇒ _≡_) (f-constant : ∀ {a b} (p q : a ≡ b) → f p ≡ f q) where ≡-canonical : ∀ {a b} (p : a ≡ b) → trans (sym (f refl)) (f p) ≡ p ≡-canonical refl = trans-symˡ (f refl) ≡-irrelevant : UIP A ≡-irrelevant p q = begin p ≡⟨ sym (≡-canonical p) ⟩ trans (sym (f refl)) (f p) ≡⟨ cong (trans _) (f-constant p q) ⟩ trans (sym (f refl)) (f q) ≡⟨ ≡-canonical q ⟩ q ∎ where open ≡-Reasoning -- If equality is decidable for a given type, then we can prove UIP for -- that type. Indeed, the decision procedure allows us to define a -- function over proofs of equality which is constant: it returns the -- proof produced by the decision procedure. module Decidable⇒UIP {a} {A : Set a} (_≟_ : Decidable (_≡_ {A = A})) where ≡-normalise : _≡_ {A = A} ⇒ _≡_ ≡-normalise {a} {b} a≡b with a ≟ b ... | yes p = p ... | no ¬p = ⊥-elim (¬p a≡b) ≡-normalise-constant : ∀ {a b} (p q : a ≡ b) → ≡-normalise p ≡ ≡-normalise q ≡-normalise-constant {a} {b} p q with a ≟ b ... | yes _ = refl ... | no ¬p = ⊥-elim (¬p p) ≡-irrelevant : UIP A ≡-irrelevant = Constant⇒UIP.≡-irrelevant ≡-normalise ≡-normalise-constant
{ "alphanum_fraction": 0.5584206285, "avg_line_length": 34, "ext": "agda", "hexsha": "ab0bdc23664b35bd7deb2a33a4420a100692d39b", "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/Axiom/UniquenessOfIdentityProofs.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/Axiom/UniquenessOfIdentityProofs.agda", "max_line_length": 78, "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/Axiom/UniquenessOfIdentityProofs.agda", "max_stars_repo_stars_event_max_datetime": null, "max_stars_repo_stars_event_min_datetime": null, "num_tokens": 753, "size": 2482 }
------------------------------------------------------------------------------ -- Commutativity of addition of total natural numbers ------------------------------------------------------------------------------ {-# OPTIONS --exact-split #-} {-# OPTIONS --no-sized-types #-} {-# OPTIONS --no-universe-polymorphism #-} {-# OPTIONS --without-K #-} module FOT.FOTC.Data.Nat.AddComm where open import Common.FOL.Relation.Binary.EqReasoning open import FOTC.Base open import FOTC.Data.Nat ------------------------------------------------------------------------------ -- Auxiliary properties succCong : ∀ {m n} → m ≡ n → succ₁ m ≡ succ₁ n succCong refl = refl +-leftIdentity : ∀ n → zero + n ≡ n +-leftIdentity n = +-0x n +-rightIdentity : ∀ {n} → N n → n + zero ≡ n +-rightIdentity Nn = N-ind A A0 is Nn where A : D → Set A i = i + zero ≡ i A0 : A zero A0 = +-leftIdentity zero is : ∀ {i} → A i → A (succ₁ i) is {i} Ai = trans (+-Sx i zero) (succCong Ai) x+Sy≡S[x+y] : ∀ {m} → N m → ∀ n → m + succ₁ n ≡ succ₁ (m + n) x+Sy≡S[x+y] Nm n = N-ind A A0 is Nm where A : D → Set A i = i + succ₁ n ≡ succ₁ (i + n) A0 : A zero A0 = zero + succ₁ n ≡⟨ +-leftIdentity (succ₁ n) ⟩ succ₁ n ≡⟨ succCong (sym (+-leftIdentity n)) ⟩ succ₁ (zero + n) ∎ is : ∀ {i} → A i → A (succ₁ i) is {i} Ai = succ₁ i + succ₁ n ≡⟨ +-Sx i (succ₁ n) ⟩ succ₁ (i + succ₁ n) ≡⟨ succCong Ai ⟩ succ₁ (succ₁ (i + n)) ≡⟨ succCong (sym (+-Sx i n)) ⟩ succ₁ (succ₁ i + n) ∎ +-comm-ind-instance : ∀ n → zero + n ≡ n + zero → (∀ {m} → m + n ≡ n + m → succ₁ m + n ≡ n + succ₁ m) → ∀ {m} → N m → m + n ≡ n + m +-comm-ind-instance n = N-ind (λ i → i + n ≡ n + i) ------------------------------------------------------------------------------ -- Approach 1: Interactive proof using pattern matching module M1 where +-comm : ∀ {m n} → N m → N n → m + n ≡ n + m +-comm {n = n} nzero Nn = zero + n ≡⟨ +-leftIdentity n ⟩ n ≡⟨ sym (+-rightIdentity Nn) ⟩ n + zero ∎ +-comm {n = n} (nsucc {m} Nm) Nn = succ₁ m + n ≡⟨ +-Sx m n ⟩ succ₁ (m + n) ≡⟨ succCong (+-comm Nm Nn) ⟩ succ₁ (n + m) ≡⟨ sym (x+Sy≡S[x+y] Nn m) ⟩ n + succ₁ m ∎ ------------------------------------------------------------------------------ -- Approach 2: Combined proof using pattern matching module M2 where +-comm : ∀ {m n} → N m → N n → m + n ≡ n + m +-comm {n = n} nzero Nn = prf where postulate prf : zero + n ≡ n + zero {-# ATP prove prf +-rightIdentity #-} +-comm {n = n} (nsucc {m} Nm) Nn = prf (+-comm Nm Nn) where postulate prf : m + n ≡ n + m → succ₁ m + n ≡ n + succ₁ m {-# ATP prove prf x+Sy≡S[x+y] #-} ------------------------------------------------------------------------------ -- Approach 3: Interactive proof using the induction principle module M3 where +-comm : ∀ {m n} → N m → N n → m + n ≡ n + m +-comm {n = n} Nm Nn = N-ind A A0 is Nm where A : D → Set A i = i + n ≡ n + i A0 : A zero A0 = zero + n ≡⟨ +-leftIdentity n ⟩ n ≡⟨ sym (+-rightIdentity Nn) ⟩ n + zero ∎ is : ∀ {i} → A i → A (succ₁ i) is {i} Ai = succ₁ i + n ≡⟨ +-Sx i n ⟩ succ₁ (i + n) ≡⟨ succCong Ai ⟩ succ₁ (n + i) ≡⟨ sym (x+Sy≡S[x+y] Nn i) ⟩ n + succ₁ i ∎ ------------------------------------------------------------------------------ -- Approach 4: Combined proof using the induction principle module M4 where -- See Issue https://github.com/asr/apia/issues/81 . +-commA : D → D → Set +-commA n i = i + n ≡ n + i {-# ATP definition +-commA #-} +-comm : ∀ {m n} → N m → N n → m + n ≡ n + m +-comm {n = n} Nm Nn = N-ind (+-commA n) A0 is Nm where postulate A0 : +-commA n zero {-# ATP prove A0 +-rightIdentity #-} postulate is : ∀ {i} → +-commA n i → +-commA n (succ₁ i) {-# ATP prove is x+Sy≡S[x+y] #-} ------------------------------------------------------------------------------ -- Approach 5: Interactive proof using an instance of the induction -- principle module M5 where +-comm : ∀ {m n} → N m → N n → m + n ≡ n + m +-comm {n = n} Nm Nn = +-comm-ind-instance n A0 is Nm where A0 : zero + n ≡ n + zero A0 = zero + n ≡⟨ +-leftIdentity n ⟩ n ≡⟨ sym (+-rightIdentity Nn) ⟩ n + zero ∎ is : ∀ {i} → i + n ≡ n + i → succ₁ i + n ≡ n + succ₁ i is {i} ih = succ₁ i + n ≡⟨ +-Sx i n ⟩ succ₁ (i + n) ≡⟨ succCong ih ⟩ succ₁ (n + i) ≡⟨ sym (x+Sy≡S[x+y] Nn i) ⟩ n + succ₁ i ∎ ------------------------------------------------------------------------------ -- Approach 6: Combined proof using an instance of the induction -- principle module M6 where -- TODO (25 October 2012): Why is it not necessary the hypothesis -- +-rightIdentity? postulate +-comm : ∀ {m n} → N m → N n → m + n ≡ n + m {-# ATP prove +-comm +-comm-ind-instance x+Sy≡S[x+y] #-}
{ "alphanum_fraction": 0.4298454221, "avg_line_length": 30.9570552147, "ext": "agda", "hexsha": "a84dd67f636207e7446f287ffd3dc04b692d97b2", "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/AddComm.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/AddComm.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/AddComm.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": 1741, "size": 5046 }
module _ where id : {A : Set} → A → A id x = x {-# INLINE id #-} -- Adding COMPILE to an INLINE'd function has no effect, since the -- treeless compiler will inline all uses of the function. Hence, we -- warn the user that the pragma is pointless when compiling. {-# COMPILE GHC id = \ _ x -> x #-}
{ "alphanum_fraction": 0.6589403974, "avg_line_length": 25.1666666667, "ext": "agda", "hexsha": "4cd074018b8516b969b6f8ee970af30fe1716232", "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/InlineCompiled.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/InlineCompiled.agda", "max_line_length": 68, "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/InlineCompiled.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": 81, "size": 302 }
open import Data.Nat using () open import Data.Bool using (true; false) open import Data.Product using (_×_; _,_) open import Data.String using (String; _≟_) open import Data.Empty using () open import Level using (suc; _⊔_) open import Relation.Nullary using (yes; no) open import Relation.Nullary.Decidable using (⌊_⌋) open import Relation.Binary.PropositionalEquality using (_≡_; refl; sym) open import IMP open import OperationalSemantics assn : ∀{l} → Set (suc l) assn {a} = state → Set a data ⊢[_]_[_] {l} : assn {l} → com → assn {l} → Set (suc l) where Skip : ∀{P} → ⊢[ P ] SKIP [ P ] Loc : ∀{Q a x} → ⊢[ (λ s → Q (s [ x ::= aval a s ])) ] (x ::= a) [ Q ] Comp : ∀{P Q R c₁ c₂} → ⊢[ P ] c₁ [ Q ] → ⊢[ Q ] c₂ [ R ] → ⊢[ P ] c₁ :: c₂ [ R ] If : ∀{P b c₁ Q c₂} → ⊢[ (λ s → P s × bval b s ≡ true) ] c₁ [ Q ] → ⊢[ (λ s → P s × bval b s ≡ false) ] c₂ [ Q ] → ⊢[ P ] (IF b THEN c₁ ELSE c₂) [ Q ] While : ∀{P b c} → ⊢[ (λ s → P s × bval b s ≡ true) ] c [ P ] → ⊢[ P ] (WHILE b DO c) [ (λ s → P s × bval b s ≡ false) ] Conseq : ∀{P Q P′ Q′ : assn} {c} → (∀ s → P′ s → P s) → ⊢[ P ] c [ Q ] → (∀ s → Q s → Q′ s) → ⊢[ P′ ] c [ Q′ ] ⊨[_]_[_] : assn → com → assn → Set ⊨[ P ] c [ Q ] = ∀{s t} → P s → ⦅ c , s ⦆⇒ t → Q t
{ "alphanum_fraction": 0.4782939832, "avg_line_length": 32.0243902439, "ext": "agda", "hexsha": "ce7569f3f092a4a0ed3044f60bb74789a429153e", "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": "cb98e3b3b93362654b79152bfdf2c21eb4951fcc", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "iwilare/imp-semantics", "max_forks_repo_path": "Hoare.agda", "max_issues_count": null, "max_issues_repo_head_hexsha": "cb98e3b3b93362654b79152bfdf2c21eb4951fcc", "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": "iwilare/imp-semantics", "max_issues_repo_path": "Hoare.agda", "max_line_length": 72, "max_stars_count": 6, "max_stars_repo_head_hexsha": "cb98e3b3b93362654b79152bfdf2c21eb4951fcc", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "iwilare/imp-semantics", "max_stars_repo_path": "Hoare.agda", "max_stars_repo_stars_event_max_datetime": "2022-02-24T22:29:44.000Z", "max_stars_repo_stars_event_min_datetime": "2020-09-08T11:54:07.000Z", "num_tokens": 557, "size": 1313 }
module Structure.Relator.Properties.Proofs where import Lvl open import Data.Tuple as Tuple using (_⨯_ ; _,_) open import Functional open import Logic -- open import Logic.Classical open import Logic.Propositional open import Logic.Propositional.Theorems open import Structure.Relator.Properties open import Structure.Relator open import Structure.Setoid open import Type private variable ℓ ℓ₁ ℓ₂ ℓₑ : Lvl.Level private variable T A B : Type{ℓ} private variable _<_ _▫_ _▫₁_ _▫₂_ : T → T → Stmt{ℓ} private variable f : T → T [asymmetry]-to-irreflexivity : ⦃ _ : Asymmetry(_<_) ⦄ → Irreflexivity(_<_) Irreflexivity.proof([asymmetry]-to-irreflexivity {_<_ = _<_}) = [→]-redundancy(asymmetry(_<_)) [irreflexivity,transitivity]-to-asymmetry : ⦃ irrefl : Irreflexivity(_<_) ⦄ ⦃ trans : Transitivity(_<_) ⦄ → Asymmetry(_<_) Asymmetry.proof([irreflexivity,transitivity]-to-asymmetry {_<_ = _<_}) = Tuple.curry(irreflexivity(_<_) ∘ (Tuple.uncurry(transitivity(_<_)))) converseTotal-to-reflexivity : ⦃ convTotal : ConverseTotal(_<_) ⦄ → Reflexivity(_<_) Reflexivity.proof(converseTotal-to-reflexivity {_<_ = _<_}) = [∨]-elim id id (converseTotal(_<_)) reflexivity-to-negated-irreflexivity : ⦃ refl : Reflexivity(_<_) ⦄ → Irreflexivity((¬_) ∘₂ (_<_)) Irreflexivity.proof (reflexivity-to-negated-irreflexivity {_<_ = _<_}) irrefl = irrefl(reflexivity(_<_)) negated-symmetry : ⦃ sym : Symmetry(_<_) ⦄ → Symmetry((¬_) ∘₂ (_<_)) Symmetry.proof (negated-symmetry {_<_ = _<_}) nxy yx = nxy(symmetry(_<_) yx) antisymmetry-irreflexivity-to-asymmetry : ⦃ equiv : Equiv{ℓₑ}(T) ⦄ ⦃ rel : BinaryRelator{A = T}(_<_) ⦄ ⦃ antisym : Antisymmetry(_<_)(_≡_) ⦄ ⦃ irrefl : Irreflexivity(_<_) ⦄ → Asymmetry(_<_) Asymmetry.proof (antisymmetry-irreflexivity-to-asymmetry {_<_ = _<_}) xy yx = irreflexivity(_<_) (substitute₂ᵣ(_<_) (antisymmetry(_<_)(_≡_) xy yx) yx) asymmetry-to-antisymmetry : ⦃ asym : Asymmetry(_<_) ⦄ → Antisymmetry(_<_)(_▫_) Antisymmetry.proof (asymmetry-to-antisymmetry {_<_ = _<_}) ab ba = [⊥]-elim(asymmetry(_<_) ab ba) subrelation-transitivity-to-subtransitivityₗ : ⦃ sub : (_▫₁_) ⊆₂ (_▫₂_) ⦄ ⦃ trans : Transitivity(_▫₂_) ⦄ → Subtransitivityₗ(_▫₂_)(_▫₁_) Subtransitivityₗ.proof (subrelation-transitivity-to-subtransitivityₗ {_▫₁_ = _▫₁_} {_▫₂_ = _▫₂_}) xy yz = transitivity(_▫₂_) (sub₂(_▫₁_)(_▫₂_) xy) yz subrelation-transitivity-to-subtransitivityᵣ : ⦃ sub : (_▫₁_) ⊆₂ (_▫₂_) ⦄ ⦃ trans : Transitivity(_▫₂_) ⦄ → Subtransitivityᵣ(_▫₂_)(_▫₁_) Subtransitivityᵣ.proof (subrelation-transitivity-to-subtransitivityᵣ {_▫₁_ = _▫₁_} {_▫₂_ = _▫₂_}) xy yz = transitivity(_▫₂_) xy (sub₂(_▫₁_)(_▫₂_) yz) -- TODO: https://proofwiki.org/wiki/Definition%3aRelation_Compatible_with_Operation and substitution. Special case for (≡) and function application: ∀(x∊T)∀(y∊T). (x ≡ y) → (∀(f: T→T). f(x) ≡ f(y)) instance -- A subrelation of a reflexive relation is reflexive. -- ∀{_□_ _△_ : T → T → Type} → ((_□_) ⊆₂ (_△_)) → (Reflexivity(_□_) → Reflexivity(_△_)) subrelation-reflexivity : (_⊆₂_) ⊆₂ ((_→ᶠ_) on₂ Reflexivity{ℓ₂ = ℓ}{T = T}) _⊆₂_.proof subrelation-reflexivity (intro ab) (intro ra) = intro (ab ra) instance -- The negation of a subrelation is a superrelation. -- ∀{_□_ _△_ : T → T → Type} → ((_□_) ⊆₂ (_△_)) → (((¬_) ∘₂ (_△_)) ⊆₂ ((¬_) ∘₂ (_□_))) swapped-negated-subrelation : (_⊆₂_ {A = A}{B = B}{ℓ₁ = ℓ}) ⊆₂ ((_⊇₂_) on₂ ((¬_) ∘₂_)) _⊆₂_.proof (_⊆₂_.proof swapped-negated-subrelation (intro sub)) = _∘ sub swap-reflexivity : ⦃ refl : Reflexivity(_▫_) ⦄ → Reflexivity(swap(_▫_)) swap-reflexivity {_▫_ = _▫_} = intro(reflexivity(_▫_)) on₂-reflexivity : ∀{_▫_ : B → B → Stmt{ℓ}}{f : A → B} → ⦃ refl : Reflexivity(_▫_) ⦄ → Reflexivity((_▫_) on₂ f) on₂-reflexivity {_▫_ = _▫_} = intro(reflexivity(_▫_)) on₂-symmetry : ∀{_▫_ : B → B → Stmt{ℓ}}{f : A → B} → ⦃ sym : Symmetry(_▫_) ⦄ → Symmetry((_▫_) on₂ f) on₂-symmetry {_▫_ = _▫_} = intro(symmetry(_▫_)) on₂-transitivity : ∀{_▫_ : B → B → Stmt{ℓ}}{f : A → B} → ⦃ trans : Transitivity(_▫_) ⦄ → Transitivity((_▫_) on₂ f) on₂-transitivity {_▫_ = _▫_} = intro(transitivity(_▫_))
{ "alphanum_fraction": 0.6712871287, "avg_line_length": 56.1111111111, "ext": "agda", "hexsha": "75d2a8a09dcaa4b6d7cab5efdba110af74a818a9", "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/Relator/Properties/Proofs.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/Relator/Properties/Proofs.agda", "max_line_length": 197, "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/Relator/Properties/Proofs.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": 1662, "size": 4040 }
{-# OPTIONS --without-K --safe #-} module Reasoning where open import PiFrac ------------------------------------------------------------------------------ -- Useful for examples infixr 2 _⟷⟨_⟩_ infix 3 _□ _⟷⟨_⟩_ : (t₁ : 𝕌) {t₂ : 𝕌} {t₃ : 𝕌} → (t₁ ⟷ t₂) → (t₂ ⟷ t₃) → (t₁ ⟷ t₃) _ ⟷⟨ α ⟩ β = α ⊚ β _□ : (t : 𝕌) → {t : 𝕌} → (t ⟷ t) _□ t = id⟷ ------------------------------------------------------------------------------
{ "alphanum_fraction": 0.2931818182, "avg_line_length": 20.9523809524, "ext": "agda", "hexsha": "51686cdc8e4013226f56c330374d92b58abf679b", "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": "fracGC/Reasoning.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": "fracGC/Reasoning.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": "fracGC/Reasoning.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": 162, "size": 440 }
------------------------------------------------------------------------ -- The Agda standard library -- -- This module is DEPRECATED. Please use -- Data.List.Relation.Binary.Permutation.Inductive directly. ------------------------------------------------------------------------ {-# OPTIONS --without-K --safe #-} module Data.List.Relation.Permutation.Inductive where open import Data.List.Relation.Binary.Permutation.Inductive public
{ "alphanum_fraction": 0.5170842825, "avg_line_length": 33.7692307692, "ext": "agda", "hexsha": "9add0152db9a764a56179fadb0488f172c489bc5", "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/Data/List/Relation/Permutation/Inductive.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/Relation/Permutation/Inductive.agda", "max_line_length": 72, "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/Data/List/Relation/Permutation/Inductive.agda", "max_stars_repo_stars_event_max_datetime": null, "max_stars_repo_stars_event_min_datetime": null, "num_tokens": 72, "size": 439 }
------------------------------------------------------------------------ -- The Agda standard library -- -- Lists where all elements satisfy a given property ------------------------------------------------------------------------ {-# OPTIONS --without-K --safe #-} module Data.List.Relation.Unary.All where open import Category.Applicative open import Category.Monad open import Data.List.Base as List using (List; []; _∷_) open import Data.List.Relation.Unary.Any as Any using (here; there) open import Data.List.Membership.Propositional using (_∈_) open import Data.Product as Prod using (_,_) open import Function open import Level open import Relation.Nullary import Relation.Nullary.Decidable as Dec open import Relation.Unary hiding (_∈_) open import Relation.Binary.PropositionalEquality as P ------------------------------------------------------------------------ -- All P xs means that all elements in xs satisfy P. infixr 5 _∷_ data All {a p} {A : Set a} (P : Pred A p) : Pred (List A) (a ⊔ p) where [] : All P [] _∷_ : ∀ {x xs} (px : P x) (pxs : All P xs) → All P (x ∷ xs) ------------------------------------------------------------------------ -- Operations on All head : ∀ {a p} {A : Set a} {P : Pred A p} {x xs} → All P (x ∷ xs) → P x head (px ∷ pxs) = px tail : ∀ {a p} {A : Set a} {P : Pred A p} {x xs} → All P (x ∷ xs) → All P xs tail (px ∷ pxs) = pxs lookup : ∀ {a p} {A : Set a} {P : Pred A p} {xs : List A} → All P xs → (∀ {x} → x ∈ xs → P x) lookup [] () lookup (px ∷ pxs) (here refl) = px lookup (px ∷ pxs) (there x∈xs) = lookup pxs x∈xs tabulate : ∀ {a p} {A : Set a} {P : Pred A p} {xs} → (∀ {x} → x ∈ xs → P x) → All P xs tabulate {xs = []} hyp = [] tabulate {xs = x ∷ xs} hyp = hyp (here refl) ∷ tabulate (hyp ∘ there) map : ∀ {a p q} {A : Set a} {P : Pred A p} {Q : Pred A q} → P ⊆ Q → All P ⊆ All Q map g [] = [] map g (px ∷ pxs) = g px ∷ map g pxs ------------------------------------------------------------------------ -- (weak) updateAt module _ {a p}{A : Set a}{P : Pred A p} where infixl 6 _[_]%=_ _[_]≔_ updateAt : ∀ {x xs} → x ∈ xs → (P x → P x) → All P xs → All P xs updateAt () f [] updateAt (here refl) f (px ∷ pxs) = f px ∷ pxs updateAt (there i) f (px ∷ pxs) = px ∷ updateAt i f pxs _[_]%=_ : ∀ {x xs} → All P xs → x ∈ xs → (P x → P x) → All P xs pxs [ i ]%= f = updateAt i f pxs _[_]≔_ : ∀ {x xs} → All P xs → x ∈ xs → P x → All P xs pxs [ i ]≔ px = pxs [ i ]%= const px ------------------------------------------------------------------------ -- (un/)zip(With/) module _ {a p q r} {A : Set a} {P : Pred A p} {Q : Pred A q} {R : Pred A r} where zipWith : P ∩ Q ⊆ R → All P ∩ All Q ⊆ All R zipWith f ([] , []) = [] zipWith f (px ∷ pxs , qx ∷ qxs) = f (px , qx) ∷ zipWith f (pxs , qxs) unzipWith : R ⊆ P ∩ Q → All R ⊆ All P ∩ All Q unzipWith f [] = [] , [] unzipWith f (rx ∷ rxs) = Prod.zip _∷_ _∷_ (f rx) (unzipWith f rxs) module _ {a p q} {A : Set a} {P : Pred A p} {Q : Pred A q} where zip : All P ∩ All Q ⊆ All (P ∩ Q) zip = zipWith id unzip : All (P ∩ Q) ⊆ All P ∩ All Q unzip = unzipWith id ------------------------------------------------------------------------ -- Traversable-like functions module _ {a} p {A : Set a} {P : Pred A (a ⊔ p)} {F} (App : RawApplicative {a ⊔ p} F) where open RawApplicative App sequenceA : All (F ∘′ P) ⊆ F ∘′ All P sequenceA [] = pure [] sequenceA (x ∷ xs) = _∷_ <$> x ⊛ sequenceA xs mapA : ∀ {q} {Q : Pred A q} → (Q ⊆ F ∘′ P) → All Q ⊆ (F ∘′ All P) mapA f = sequenceA ∘′ map f forA : ∀ {q} {Q : Pred A q} {xs} → All Q xs → (Q ⊆ F ∘′ P) → F (All P xs) forA qxs f = mapA f qxs module _ {a} p {A : Set a} {P : Pred A (a ⊔ p)} {M} (Mon : RawMonad {a ⊔ p} M) where private App = RawMonad.rawIApplicative Mon sequenceM : All (M ∘′ P) ⊆ M ∘′ All P sequenceM = sequenceA p App mapM : ∀ {q} {Q : Pred A q} → (Q ⊆ M ∘′ P) → All Q ⊆ (M ∘′ All P) mapM = mapA p App forM : ∀ {q} {Q : Pred A q} {xs} → All Q xs → (Q ⊆ M ∘′ P) → M (All P xs) forM = forA p App ------------------------------------------------------------------------ -- Properties of predicates preserved by All module _ {a p} {A : Set a} {P : Pred A p} where all : Decidable P → Decidable (All P) all p [] = yes [] all p (x ∷ xs) with p x ... | yes px = Dec.map′ (px ∷_) tail (all p xs) ... | no ¬px = no (¬px ∘ head) universal : Universal P → Universal (All P) universal u [] = [] universal u (x ∷ xs) = u x ∷ universal u xs irrelevant : Irrelevant P → Irrelevant (All P) irrelevant irr [] [] = P.refl irrelevant irr (px₁ ∷ pxs₁) (px₂ ∷ pxs₂) = P.cong₂ _∷_ (irr px₁ px₂) (irrelevant irr pxs₁ pxs₂) satisfiable : Satisfiable (All P) satisfiable = [] , []
{ "alphanum_fraction": 0.4735330324, "avg_line_length": 32.0657894737, "ext": "agda", "hexsha": "b74da22dc36c1b825e781cd294bc2f7d1c126d17", "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/Data/List/Relation/Unary/All.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/Relation/Unary/All.agda", "max_line_length": 81, "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/Data/List/Relation/Unary/All.agda", "max_stars_repo_stars_event_max_datetime": null, "max_stars_repo_stars_event_min_datetime": null, "num_tokens": 1714, "size": 4874 }
{-# OPTIONS --safe #-} module Cubical.Algebra.CommAlgebra.Instances.Initial where open import Cubical.Foundations.Prelude open import Cubical.Foundations.HLevels open import Cubical.Foundations.Isomorphism open import Cubical.Data.Unit open import Cubical.Data.Sigma.Properties using (Σ≡Prop) open import Cubical.Algebra.CommRing open import Cubical.Algebra.Ring open import Cubical.Algebra.Algebra.Base using (IsAlgebraHom) open import Cubical.Algebra.Algebra.Properties open import Cubical.Algebra.CommAlgebra import Cubical.Algebra.Algebra.Properties open AlgebraHoms private variable ℓ : Level module _ (R : CommRing ℓ) where module _ where open CommRingStr (snd R) initialCAlg : CommAlgebra R ℓ initialCAlg .fst = fst R initialCAlg .snd .CommAlgebraStr.0a = _ initialCAlg .snd .CommAlgebraStr.1a = _ initialCAlg .snd .CommAlgebraStr._+_ = _ initialCAlg .snd .CommAlgebraStr._·_ = _ initialCAlg .snd .CommAlgebraStr.-_ = _ initialCAlg .snd .CommAlgebraStr._⋆_ r x = r · x initialCAlg .snd .CommAlgebraStr.isCommAlgebra = makeIsCommAlgebra (isSetRing (CommRing→Ring R)) +Assoc +Rid +Rinv +Comm ·Assoc ·Lid ·Ldist+ ·Comm (λ x y z → sym (·Assoc x y z)) ·Ldist+ ·Rdist+ ·Lid λ x y z → sym (·Assoc x y z) module _ (A : CommAlgebra R ℓ) where open CommAlgebraStr ⦃... ⦄ private instance _ : CommAlgebraStr R (fst A) _ = snd A _ : CommAlgebraStr R (fst R) _ = snd initialCAlg _*_ : fst R → (fst A) → (fst A) r * a = CommAlgebraStr._⋆_ (snd A) r a initialMap : CommAlgebraHom initialCAlg A initialMap = makeCommAlgebraHom {M = initialCAlg} {N = A} (λ r → r * 1a) (⋆-lid _) (λ x y → ⋆-ldist x y 1a) (λ x y → (x · y) * 1a ≡⟨ ⋆-assoc _ _ _ ⟩ x * (y * 1a) ≡[ i ]⟨ x * (·Lid (y * 1a) (~ i)) ⟩ x * (1a · (y * 1a)) ≡⟨ sym (⋆-lassoc _ _ _) ⟩ (x * 1a) · (y * 1a) ∎) (λ r x → (r · x) * 1a ≡⟨ ⋆-assoc _ _ _ ⟩ (r * (x * 1a)) ∎) initialMapEq : (f : CommAlgebraHom initialCAlg A) → f ≡ initialMap initialMapEq f = let open IsAlgebraHom (snd f) in Σ≡Prop (isPropIsCommAlgebraHom {M = initialCAlg} {N = A}) λ i x → ((fst f) x ≡⟨ cong (fst f) (sym (·Rid _)) ⟩ fst f (x · 1a) ≡⟨ pres⋆ x 1a ⟩ CommAlgebraStr._⋆_ (snd A) x (fst f 1a) ≡⟨ cong (λ u → (snd A CommAlgebraStr.⋆ x) u) pres1 ⟩ (CommAlgebraStr._⋆_ (snd A) x 1a) ∎) i initialMapProp : (f g : CommAlgebraHom initialCAlg A) → f ≡ g initialMapProp f g = initialMapEq f ∙ sym (initialMapEq g) initialityIso : Iso (CommAlgebraHom initialCAlg A) (Unit* {ℓ = ℓ}) initialityIso = iso (λ _ → tt*) (λ _ → initialMap) (λ {tt*x → refl}) λ f → sym (initialMapEq f) initialityPath : CommAlgebraHom initialCAlg A ≡ Unit* initialityPath = isoToPath initialityIso initialityContr : isContr (CommAlgebraHom initialCAlg A) initialityContr = initialMap , λ ϕ → sym (initialMapEq ϕ) {- Show that any R-Algebra with the same universal property as the initial R-Algebra, is isomorphic to the initial R-Algebra. -} module _ (A : CommAlgebra R ℓ) where equivByInitiality : (isInitial : (B : CommAlgebra R ℓ) → isContr (CommAlgebraHom A B)) → CommAlgebraEquiv A (initialCAlg) equivByInitiality isInitial = isoToEquiv asIso , snd to where open CommAlgebraHoms to : CommAlgebraHom A initialCAlg to = fst (isInitial initialCAlg) from : CommAlgebraHom initialCAlg A from = initialMap A asIso : Iso (fst A) (fst initialCAlg) Iso.fun asIso = fst to Iso.inv asIso = fst from Iso.rightInv asIso = λ x i → cong fst (isContr→isProp (initialityContr initialCAlg) (to ∘a from) (idCAlgHom initialCAlg)) i x Iso.leftInv asIso = λ x i → cong fst (isContr→isProp (isInitial A) (from ∘a to) (idCAlgHom A)) i x
{ "alphanum_fraction": 0.5371169616, "avg_line_length": 35.3740458015, "ext": "agda", "hexsha": "ba5a12f8688247bb0d093b23561c73ea6b9485f8", "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": "1d9b9691d375659fa8ebd9cbf8b63678955b196b", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "gmagaf/cubical", "max_forks_repo_path": "Cubical/Algebra/CommAlgebra/Instances/Initial.agda", "max_issues_count": null, "max_issues_repo_head_hexsha": "1d9b9691d375659fa8ebd9cbf8b63678955b196b", "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": "gmagaf/cubical", "max_issues_repo_path": "Cubical/Algebra/CommAlgebra/Instances/Initial.agda", "max_line_length": 103, "max_stars_count": null, "max_stars_repo_head_hexsha": "1d9b9691d375659fa8ebd9cbf8b63678955b196b", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "gmagaf/cubical", "max_stars_repo_path": "Cubical/Algebra/CommAlgebra/Instances/Initial.agda", "max_stars_repo_stars_event_max_datetime": null, "max_stars_repo_stars_event_min_datetime": null, "num_tokens": 1437, "size": 4634 }
module _ where module Batch4 where data D1 (open Star) (A : ★) : ★ where c : (x : A) → D1 A data D2 (open Star) : ★ where data D3 (open Star) : ★₁ where c : (A : ★) → D3 data D4 : (open Star) → ★ where data D0 (A : Set) (let B = A → A) : B → Set where c : (f : B) → D0 A f module _ where data D5 (open Star) (A : ★) (open MEndo A) : ★ data D5 A (open MEndo A) where c : (f : Endo) → D5 A data D6 (open Star) (A : ★) (open MEndo A) : Endo → ★ where c : (f : Endo) → D6 A f module Batch5 where data D1 (open Star) (A : ★) : ★ data D1 A where c : (x : A) → D1 A data D2 (open Star) : ★ data D2 where data D3 (open Star) : ★₁ data D3 where c : (A : ★) → D3 data D4 : (open Star) → ★ data D4 where open import Common.Equality module Batch6 where BinOp : (A : Set) → Set BinOp A = A → A → A record IsAssoc {A : Set} (_∘_ : BinOp A) : Set where field assoc : ∀ {a b c} → ((a ∘ b) ∘ c) ≡ (a ∘ (b ∘ c)) record RawSemiGroup : Set₁ where field Carrier : Set _∘_ : Carrier → Carrier → Carrier record SemiGroupLaws1 (G : RawSemiGroup) : Set where open RawSemiGroup G field isAssoc : IsAssoc _∘_ module _ where record SemiGroupBLA (G : RawSemiGroup) (open RawSemiGroup G) (ass : IsAssoc _∘_) : Set where record SemiGroupLaws (G : RawSemiGroup) (open RawSemiGroup G) : Set where field isAssoc : IsAssoc {A = Carrier} _∘_ record SemiGroup : Set₁ where field rawSemiGroup : RawSemiGroup semiGroupLaws : SemiGroupLaws rawSemiGroup
{ "alphanum_fraction": 0.5578817734, "avg_line_length": 20.3, "ext": "agda", "hexsha": "7603433005d29b7c725a5f0a026e2d965d1256a9", "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/TelescopingLetDataRecord.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/TelescopingLetDataRecord.agda", "max_line_length": 75, "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/TelescopingLetDataRecord.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": 624, "size": 1624 }
open import Level hiding ( suc ; zero ) open import Algebra module sym4 where open import Symmetric open import Data.Unit open import Function.Inverse as Inverse using (_↔_; Inverse; _InverseOf_) open import Function open import Data.Nat hiding (_⊔_) -- using (ℕ; suc; zero) open import Relation.Nullary open import Data.Empty open import Data.Product open import Gutil open import Putil open import Solvable using (solvable) open import Relation.Binary.PropositionalEquality hiding ( [_] ) open import Data.Fin open import Data.Fin.Permutation hiding (_∘ₚ_) infixr 200 _∘ₚ_ _∘ₚ_ = Data.Fin.Permutation._∘ₚ_ sym4solvable : solvable (Symmetric 4) solvable.dervied-length sym4solvable = 3 solvable.end sym4solvable x d = solved1 x d where open import Data.List using ( List ; [] ; _∷_ ) open Solvable (Symmetric 4) -- Klien -- -- 1 (1,2),(3,4) (1,3),(2,4) (1,4),(2,3) -- 0 ∷ 1 ∷ 2 ∷ 3 ∷ [] , 1 ∷ 0 ∷ 3 ∷ 2 ∷ [] , 2 ∷ 3 ∷ 0 ∷ 1 ∷ [] , 3 ∷ 2 ∷ 1 ∷ 0 ∷ [] , a0 = pid {4} a1 = pswap (pswap (pid {0})) a2 = pid {4} ∘ₚ pins (n≤ 3) ∘ₚ pins (n≤ 3 ) a3 = pins (n≤ 3) ∘ₚ pins (n≤ 2) ∘ₚ pswap (pid {2}) k3 = plist (a1 ∘ₚ a2 ) ∷ plist (a1 ∘ₚ a3) ∷ plist (a2 ∘ₚ a1 ) ∷ [] open import FLutil open import Data.List.Fresh hiding ([_]) open import Relation.Nary using (⌊_⌋) p0id : FL→perm ((# 0) :: (# 0) :: ((# 0) :: ((# 0 ) :: f0))) =p= pid p0id = pleq _ _ refl open import Data.List.Fresh.Relation.Unary.Any open import FLComm stage3FList : CommFListN 4 3 ≡ cons (zero :: zero :: zero :: zero :: f0) [] (Level.lift tt) stage3FList = refl st3 = proj₁ (toList ( CommFListN 4 2 )) -- st4 = {!!} solved1 : (x : Permutation 4 4) → deriving 3 x → x =p= pid solved1 x dr = CommSolved 4 x ( CommFListN 4 3 ) stage3FList p0id solved2 where -- p0id : FL→perm ((# 0) :: ((# 0) :: ((# 0 ) :: f0))) =p= pid solved2 : Any (perm→FL x ≡_) ( CommFListN 4 3 ) solved2 = CommStage→ 4 3 x dr
{ "alphanum_fraction": 0.5884955752, "avg_line_length": 30.8181818182, "ext": "agda", "hexsha": "9ffda672b10be6aae69d65e9e2bfd3bc657324bf", "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": "bf000643c139f40d5783e962bb3b63353ba3d6e4", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "shinji-kono/Galois", "max_forks_repo_path": "src/sym4.agda", "max_issues_count": null, "max_issues_repo_head_hexsha": "bf000643c139f40d5783e962bb3b63353ba3d6e4", "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": "shinji-kono/Galois", "max_issues_repo_path": "src/sym4.agda", "max_line_length": 95, "max_stars_count": 1, "max_stars_repo_head_hexsha": "bf000643c139f40d5783e962bb3b63353ba3d6e4", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "shinji-kono/Galois", "max_stars_repo_path": "src/sym4.agda", "max_stars_repo_stars_event_max_datetime": "2021-10-16T03:37:05.000Z", "max_stars_repo_stars_event_min_datetime": "2021-10-16T03:37:05.000Z", "num_tokens": 815, "size": 2034 }
open import Logic open import Type module Structure.Sets.Quantifiers {ℓₑ ℓₛ ℓₗ}{E : Type{ℓₑ}}{S : Type{ℓₛ}} (_∈_ : E → S → Stmt{ℓₗ}) where import Lvl open import Logic.Propositional open import Logic.Predicate open import Syntax.Function private variable ℓ : Lvl.Level -- Set restricted existential quantifier. ∃ₛ : S → (E → Stmt{ℓ}) → Stmt ∃ₛ(A) P = ∃(x ↦ (x ∈ A) ∧ P(x)) -- Set restricted universal quantifier. ∀ₛ : S → (E → Stmt{ℓ}) → Stmt ∀ₛ(A) P = ∀ₗ(x ↦ ((x ∈ A) → P(x)))
{ "alphanum_fraction": 0.6352459016, "avg_line_length": 24.4, "ext": "agda", "hexsha": "a01b4c72566969d806fd1d458eafa3bf570e0eab", "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/Quantifiers.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/Quantifiers.agda", "max_line_length": 103, "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/Quantifiers.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": 193, "size": 488 }
{-# OPTIONS --without-K --safe #-} module Source.Term where open import Source.Size as S using ( Size ; _<_ ; Δ ; Δ′ ; Δ″ ; Ω ; Ω′ ; Ω″ ; n ; m ; o ; b ; v0 ; v1 ; ⋆ ) open import Source.Size.Substitution.Theory open import Source.Size.Substitution.Canonical as SC using () renaming ( Sub⊢ to Subₛ⊢ ) open import Source.Size.Substitution.Universe as SU using ( ⟨_⟩ ) renaming ( Sub⊢ᵤ to Subₛ⊢ᵤ ) open import Source.Type as T using ( Type ; Ctx ; T ; U ; V ; Γ ; Γ′ ; Γ″ ; Ψ ; Ψ′ ; Ψ″ ; SubTheory-Type ; SubTheory-Ctx ) open import Util.Prelude hiding (id ; _∘_) open Ctx open S.Ctx open S.Size open S.Var open Type infix 0 _,_⊢_∶_ _,_⊢ₓ_∶_ Sub⊢ infix 3 _⊇_ infixl 5 sub-syntax-Termₛ sub-syntax-Subₛ sub-syntax-Term sub-syntax-⊇ infixr 6 Λ_,_ Λₛ_,_ infixl 7 _·_ _·ₛ_ Var : Set Var = ℕ variable x y : Var data Term Δ : Set where var : (x : Var) → Term Δ Λ_,_ : (T : Type Δ) (t : Term Δ) → Term Δ _·_ : (t u : Term Δ) → Term Δ Λₛ_,_ : (n : Size Δ) (t : Term (Δ ∙ n)) → Term Δ _·ₛ_ : (t : Term Δ) (m : Size Δ) → Term Δ zero : (n : Size Δ) → Term Δ suc : (n m : Size Δ) (i : Term Δ) → Term Δ cons : (i : Term Δ) (n : Size Δ) (is : Term Δ) → Term Δ head : (n : Size Δ) (is : Term Δ) → Term Δ tail : (n : Size Δ) (is : Term Δ) (m : Size Δ) → Term Δ caseNat : (T : Type Δ) (n : Size Δ) (i : Term Δ) (z : Term Δ) (s : Term Δ) → Term Δ fix : (T : Type (Δ ∙ ⋆)) (t : Term Δ) (n : Size Δ) → Term Δ variable t u v w i is z s t′ u′ v′ w′ i′ is′ z′ s′ : Term Δ data _,_⊢ₓ_∶_ : ∀ Δ (Γ : Ctx Δ) (x : Var) (T : Type Δ) → Set where zero : Δ , Γ ∙ T ⊢ₓ zero ∶ T suc : (⊢x : Δ , Γ ⊢ₓ x ∶ T) → Δ , Γ ∙ U ⊢ₓ suc x ∶ T data _,_⊢_∶_ : ∀ Δ (Γ : Ctx Δ) (t : Term Δ) (T : Type Δ) → Set where var : (⊢x : Δ , Γ ⊢ₓ x ∶ T) → Δ , Γ ⊢ var x ∶ T abs : (⊢t : Δ , Γ ∙ T ⊢ t ∶ U) → Δ , Γ ⊢ Λ T , t ∶ T ⇒ U app : (⊢t : Δ , Γ ⊢ t ∶ T ⇒ U) → (⊢u : Δ , Γ ⊢ u ∶ T) → Δ , Γ ⊢ t · u ∶ U absₛ : (⊢t : Δ ∙ n , Ψ ⊢ t ∶ T) → Ψ ≡ Γ [ SC.Wk ] → Δ , Γ ⊢ Λₛ n , t ∶ Π n , T appₛ : (m<n : m < n) → (⊢t : Δ , Γ ⊢ t ∶ (Π n , T)) → U ≡ T [ SC.Sing m ] → Δ , Γ ⊢ t ·ₛ m ∶ U zero : (n<⋆ : n < ⋆) → Δ , Γ ⊢ zero n ∶ Nat n suc : (n<⋆ : n < ⋆) → (m<n : m < n) → (⊢i : Δ , Γ ⊢ i ∶ Nat m) → Δ , Γ ⊢ suc n m i ∶ Nat n cons : (n<⋆ : n < ⋆) → (⊢i : Δ , Γ ⊢ i ∶ Nat ∞) → (⊢is : Δ , Γ ⊢ is ∶ Π n , Stream v0) → Δ , Γ ⊢ cons i n is ∶ Stream n head : (n<⋆ : n < ⋆) → (⊢is : Δ , Γ ⊢ is ∶ Stream n) → Δ , Γ ⊢ head n is ∶ Nat ∞ tail : (n<⋆ : n < ⋆) → (m<n : m < n) → (⊢is : Δ , Γ ⊢ is ∶ Stream n) → Δ , Γ ⊢ tail n is m ∶ Stream m caseNat : (n<⋆ : n < ⋆) → (⊢i : Δ , Γ ⊢ i ∶ Nat n) → (⊢z : Δ , Γ ⊢ z ∶ T) → (⊢s : Δ , Γ ⊢ s ∶ Π n , Nat v0 ⇒ U) → U ≡ T [ SC.Wk ] → Δ , Γ ⊢ caseNat T n i z s ∶ T fix : (n<⋆ : n < ⋆) → (⊢t : Δ , Γ ⊢ t ∶ Π ⋆ , (Π v0 , U) ⇒ T) → U ≡ T [ SC.Skip ] → V ≡ T [ SC.Sing n ] → Δ , Γ ⊢ fix T t n ∶ V subₛ : SC.Sub Δ Ω → Term Ω → Term Δ subₛ σ (var x) = var x subₛ σ (Λ T , t) = Λ T [ σ ] , subₛ σ t subₛ σ (t · u) = subₛ σ t · subₛ σ u subₛ σ (Λₛ n , t) = Λₛ n [ σ ] , subₛ (SC.Lift σ) t subₛ σ (t ·ₛ m) = subₛ σ t ·ₛ (m [ σ ]) subₛ σ (zero n) = zero (n [ σ ]) subₛ σ (suc n m i) = suc (n [ σ ]) (m [ σ ]) (subₛ σ i) subₛ σ (cons i n is) = cons (subₛ σ i) (n [ σ ]) (subₛ σ is) subₛ σ (head n is) = head (n [ σ ]) (subₛ σ is) subₛ σ (tail n is m) = tail (n [ σ ]) (subₛ σ is) (m [ σ ]) subₛ σ (caseNat T n i z s) = caseNat (T [ σ ]) (n [ σ ]) (subₛ σ i) (subₛ σ z) (subₛ σ s) subₛ σ (fix T t n) = fix (T [ SC.Lift σ ]) (subₛ σ t) (n [ σ ]) sub-syntax-Termₛ = subₛ syntax sub-syntax-Termₛ σ t = t [ σ ]ₛ abstract subₛ-resp-⊢ₓ : ∀ {σ} → σ ∶ Δ ⇒ Ω → Ω , Γ ⊢ₓ x ∶ T → Δ , Γ [ σ ] ⊢ₓ x ∶ T [ σ ] subₛ-resp-⊢ₓ ⊢σ zero = zero subₛ-resp-⊢ₓ ⊢σ (suc ⊢x) = suc (subₛ-resp-⊢ₓ ⊢σ ⊢x) subₛ-resp-⊢ : ∀ {σ} → σ ∶ Δ ⇒ Ω → Ω , Γ ⊢ t ∶ T → Δ , Γ [ σ ] ⊢ subₛ σ t ∶ T [ σ ] subₛ-resp-⊢ ⊢σ (var ⊢x) = var (subₛ-resp-⊢ₓ ⊢σ ⊢x) subₛ-resp-⊢ ⊢σ (abs ⊢t) = abs (subₛ-resp-⊢ ⊢σ ⊢t) subₛ-resp-⊢ ⊢σ (app ⊢t ⊢u) = app (subₛ-resp-⊢ ⊢σ ⊢t) (subₛ-resp-⊢ ⊢σ ⊢u) subₛ-resp-⊢ {Δ} {Γ = Γ} {σ = σ} ⊢σ (absₛ {Ψ = Ψ} ⊢t p) = absₛ (subₛ-resp-⊢ (SC.Lift⊢ ⊢σ refl) ⊢t) eq where eq : Ψ [ SC.Lift σ ] ≡ Γ [ σ ] [ SC.Wk ] eq = trans (cong (λ Ψ → Ψ [ SC.Lift σ ]) p) ([>>]″ (SC.Lift σ) SC.Wk SC.Wk σ Γ SC.Lift>>Wk) subₛ-resp-⊢ {σ = σ} ⊢σ (appₛ {m = m} {T = T} {U = U} m<n ⊢t p) = appₛ (SC.sub-resp-< ⊢σ m<n) (subₛ-resp-⊢ ⊢σ ⊢t) eq where eq : U [ σ ] ≡ T [ SC.Lift σ ] [ SC.Sing (m [ σ ]) ] eq = trans (cong (λ U → U [ σ ]) p) ([>>]″ _ _ _ _ _ (sym (SC.Sing>>Lift m))) subₛ-resp-⊢ ⊢σ (zero n<⋆) = zero (SC.sub-resp-< ⊢σ n<⋆) subₛ-resp-⊢ ⊢σ (suc n<⋆ m<n ⊢i) = suc (SC.sub-resp-< ⊢σ n<⋆) (SC.sub-resp-< ⊢σ m<n) (subₛ-resp-⊢ ⊢σ ⊢i) subₛ-resp-⊢ ⊢σ (cons n<⋆ ⊢i ⊢is) = cons (SC.sub-resp-< ⊢σ n<⋆) (subₛ-resp-⊢ ⊢σ ⊢i) (subₛ-resp-⊢ ⊢σ ⊢is) subₛ-resp-⊢ ⊢σ (head n<⋆ ⊢is) = head (SC.sub-resp-< ⊢σ n<⋆) (subₛ-resp-⊢ ⊢σ ⊢is) subₛ-resp-⊢ ⊢σ (tail n<⋆ m<n ⊢is) = tail (SC.sub-resp-< ⊢σ n<⋆) (SC.sub-resp-< ⊢σ m<n) (subₛ-resp-⊢ ⊢σ ⊢is) subₛ-resp-⊢ {σ = σ} ⊢σ (caseNat {T = T} {U = U} n<⋆ ⊢i ⊢z ⊢s p) = caseNat (SC.sub-resp-< ⊢σ n<⋆) (subₛ-resp-⊢ ⊢σ ⊢i) (subₛ-resp-⊢ ⊢σ ⊢z) (subₛ-resp-⊢ ⊢σ ⊢s) eq where eq : U [ SC.Lift σ ] ≡ T [ σ ] [ SC.Wk ] eq = trans (cong (λ U → U [ SC.Lift σ ]) p) ([>>]″ _ _ _ _ _ SC.Lift>>Wk) subₛ-resp-⊢ {σ = σ} ⊢σ (fix {n = n} {U = U} {T = T} {V = V} n<⋆ ⊢t p q) = fix (SC.sub-resp-< ⊢σ n<⋆) (subₛ-resp-⊢ ⊢σ ⊢t) eq₀ eq₁ where eq₀ : U [ SC.Lift (SC.Lift σ) ] ≡ T [ SC.Lift σ ] [ SC.Skip ] eq₀ = trans (cong (λ U → U [ SC.Lift (SC.Lift σ) ]) p) ([>>]″ _ _ _ _ _ SC.LiftLift>>Skip) eq₁ : V [ σ ] ≡ T [ SC.Lift σ ] [ SC.Sing (n [ σ ]) ] eq₁ = trans (cong (λ V → V [ σ ]) q) ([>>]″ _ _ _ _ _ (sym (SC.Sing>>Lift n))) subₛ-Id : (t : Term Δ) → subₛ SC.Id t ≡ t subₛ-Id (var x) = refl subₛ-Id (Λ T , t) = cong₂ Λ_,_ ([Id] T) (subₛ-Id t) subₛ-Id (t · u) = cong₂ _·_ (subₛ-Id t) (subₛ-Id u) subₛ-Id (Λₛ n , t) rewrite [Id] n | subₛ-Id t = refl subₛ-Id (t ·ₛ m) = cong₂ _·ₛ_ (subₛ-Id t) ([Id] m) subₛ-Id (zero n) = cong zero ([Id] n) subₛ-Id (suc n m i) rewrite [Id] n | [Id] m | subₛ-Id i = refl subₛ-Id (cons i n is) rewrite subₛ-Id i | [Id] n | subₛ-Id is = refl subₛ-Id (head n is) = cong₂ head ([Id] n) (subₛ-Id is) subₛ-Id (tail n is m) rewrite [Id] n | subₛ-Id is | [Id] m = refl subₛ-Id (caseNat T n i z s) rewrite [Id] T | [Id] n | subₛ-Id i | subₛ-Id z | subₛ-Id s = refl subₛ-Id (fix T t n) rewrite [Id] T | subₛ-Id t | [Id] n = refl subₛ->> : ∀ (σ : SC.Sub Δ Δ′) (τ : SC.Sub Δ′ Δ″) t → subₛ (σ SC.>> τ) t ≡ subₛ σ (subₛ τ t) subₛ->> σ τ (var x) = refl subₛ->> σ τ (Λ T , t) = cong₂ Λ_,_ ([>>] σ τ T) (subₛ->> σ τ t) subₛ->> σ τ (t · u) = cong₂ _·_ (subₛ->> σ τ t) (subₛ->> σ τ u) subₛ->> σ τ (Λₛ n , t) rewrite [>>] σ τ n = cong (λ t → Λₛ SC.sub σ (SC.sub τ n) , t) (trans (cong (λ σ → subₛ σ t) (sym (SC.Lift>>Lift {n = n [ τ ]}))) (subₛ->> (SC.Lift σ) (SC.Lift τ) t)) subₛ->> σ τ (t ·ₛ m) = cong₂ _·ₛ_ (subₛ->> σ τ t) ([>>] σ τ m) subₛ->> σ τ (zero n) = cong zero ([>>] σ τ n) subₛ->> σ τ (suc n m i) rewrite [>>] σ τ n | [>>] σ τ m | subₛ->> σ τ i = refl subₛ->> σ τ (cons i n is) rewrite subₛ->> σ τ i | [>>] σ τ n | subₛ->> σ τ is = refl subₛ->> σ τ (head n is) rewrite [>>] σ τ n | subₛ->> σ τ is = refl subₛ->> σ τ (tail n is m) rewrite [>>] σ τ n | subₛ->> σ τ is | [>>] σ τ m = refl subₛ->> σ τ (caseNat T n i z s) rewrite [>>] σ τ T | [>>] σ τ n | subₛ->> σ τ i | subₛ->> σ τ z | subₛ->> σ τ s = refl subₛ->> σ τ (fix T t n) rewrite subₛ->> σ τ t | [>>] σ τ n = cong (λ T → fix T (subₛ σ (subₛ τ t)) (n [ τ ] [ σ ])) ([>>]′ _ _ _ _ (sym SC.Lift>>Lift)) subₛᵤ : SU.Sub Δ Ω → Term Ω → Term Δ subₛᵤ σ = subₛ ⟨ σ ⟩ abstract subₛᵤ-resp-⊢ : ∀ {σ} → σ ∶ Δ ⇒ᵤ Ω → Ω , Γ ⊢ t ∶ T → Δ , Γ [ σ ]ᵤ ⊢ subₛᵤ σ t ∶ T [ σ ]ᵤ subₛᵤ-resp-⊢ ⊢σ ⊢t = subₛ-resp-⊢ (SU.⟨⟩-resp-⊢ ⊢σ) ⊢t subₛᵤ-Id : (t : Term Δ) → subₛᵤ SU.Id t ≡ t subₛᵤ-Id t = subₛ-Id t subₛᵤ->> : ∀ (σ : SU.Sub Δ Δ′) (τ : SU.Sub Δ′ Δ″) t → subₛᵤ (σ SU.>> τ) t ≡ subₛᵤ σ (subₛᵤ τ t) subₛᵤ->> σ τ t = subₛ->> ⟨ σ ⟩ ⟨ τ ⟩ t data _⊇_ {Δ} : (Γ Ψ : Ctx Δ) → Set where [] : [] ⊇ [] keep : (α : Γ ⊇ Ψ) (T : Type Δ) → Γ ∙ T ⊇ Ψ ∙ T weak : (α : Γ ⊇ Ψ) (T : Type Δ) → Γ ∙ T ⊇ Ψ variable α β γ : Γ ⊇ Ψ sub⊇ : (σ : SC.Sub Δ Ω) → Γ ⊇ Ψ → Γ [ σ ] ⊇ Ψ [ σ ] sub⊇ σ [] = [] sub⊇ σ (keep α T) = keep (sub⊇ σ α) (T [ σ ]) sub⊇ σ (weak α T) = weak (sub⊇ σ α) (T [ σ ]) sub-syntax-⊇ = sub⊇ syntax sub-syntax-⊇ σ α = α [ σ ]α renV : Γ ⊇ Ψ → Var → Var renV [] x = x -- impossible if x is well-scoped renV (keep α T) zero = zero renV (keep α T) (suc x) = suc (renV α x) renV (weak α T) x = suc (renV α x) ren : {Γ Ψ : Ctx Δ} → Γ ⊇ Ψ → Term Δ → Term Δ ren α (var x) = var (renV α x) ren α (Λ T , t) = Λ T , ren (keep α T) t ren α (t · u) = ren α t · ren α u ren α (Λₛ n , t) = Λₛ n , ren (α [ SC.Wk ]α) t ren α (t ·ₛ m) = ren α t ·ₛ m ren α (zero n) = zero n ren α (suc n m i) = suc n m (ren α i) ren α (cons i n is) = cons (ren α i) n (ren α is) ren α (head n is) = head n (ren α is) ren α (tail n is m) = tail n (ren α is) m ren α (caseNat T n i z s) = caseNat T n (ren α i) (ren α z) (ren α s) ren α (fix T t n) = fix T (ren α t) n abstract renV-resp-⊢ₓ : (α : Γ ⊇ Ψ) → Δ , Ψ ⊢ₓ x ∶ T → Δ , Γ ⊢ₓ renV α x ∶ T renV-resp-⊢ₓ (keep α T) zero = zero renV-resp-⊢ₓ (keep α T) (suc ⊢x) = suc (renV-resp-⊢ₓ α ⊢x) renV-resp-⊢ₓ (weak α T) ⊢x = suc (renV-resp-⊢ₓ α ⊢x) ren-resp-⊢ : (α : Γ ⊇ Ψ) → Δ , Ψ ⊢ t ∶ T → Δ , Γ ⊢ ren α t ∶ T ren-resp-⊢ α (var ⊢x) = var (renV-resp-⊢ₓ α ⊢x) ren-resp-⊢ α (abs ⊢t) = abs (ren-resp-⊢ (keep α _) ⊢t) ren-resp-⊢ α (app ⊢t ⊢u) = app (ren-resp-⊢ α ⊢t) (ren-resp-⊢ α ⊢u) ren-resp-⊢ α (absₛ ⊢t refl) = absₛ (ren-resp-⊢ (α [ SC.Wk ]α) ⊢t) refl ren-resp-⊢ α (appₛ m<n ⊢t p) = appₛ m<n (ren-resp-⊢ α ⊢t) p ren-resp-⊢ α (zero n<⋆) = zero n<⋆ ren-resp-⊢ α (suc n<⋆ m<n ⊢i) = suc n<⋆ m<n (ren-resp-⊢ α ⊢i) ren-resp-⊢ α (cons n<⋆ ⊢i ⊢is) = cons n<⋆ (ren-resp-⊢ α ⊢i) (ren-resp-⊢ α ⊢is) ren-resp-⊢ α (head n<⋆ ⊢is) = head n<⋆ (ren-resp-⊢ α ⊢is) ren-resp-⊢ α (tail n<⋆ m<n ⊢is) = tail n<⋆ m<n (ren-resp-⊢ α ⊢is) ren-resp-⊢ α (caseNat n<⋆ ⊢i ⊢z ⊢s p) = caseNat n<⋆ (ren-resp-⊢ α ⊢i) (ren-resp-⊢ α ⊢z) (ren-resp-⊢ α ⊢s) p ren-resp-⊢ α (fix n<⋆ ⊢t p q) = fix n<⋆ (ren-resp-⊢ α ⊢t) p q Id⊇ : (Γ : Ctx Δ) → Γ ⊇ Γ Id⊇ [] = [] Id⊇ (Γ ∙ T) = keep (Id⊇ Γ) T Wk⊇ : ∀ (Γ : Ctx Δ) T → Γ ∙ T ⊇ Γ Wk⊇ Γ T = weak (Id⊇ Γ) _ data Sub {Δ} (Γ : Ctx Δ) : (Ψ : Ctx Δ) → Set where [] : Sub Γ [] Snoc : (ν : Sub Γ Ψ) (t : Term Δ) → Sub Γ (Ψ ∙ T) variable ν φ : Sub Γ Ψ data Sub⊢ {Δ} (Γ : Ctx Δ) : ∀ Ψ → Sub Γ Ψ → Set where [] : Sub⊢ Γ [] [] Snoc : (⊢ν : Sub⊢ Γ Ψ ν) (⊢t : Δ , Γ ⊢ t ∶ T) → Sub⊢ Γ (Ψ ∙ T) (Snoc ν t) syntax Sub⊢ Γ Ψ ν = ν ∶ Γ ⇛ Ψ Weaken : Sub Γ Ψ → Sub (Γ ∙ T) Ψ Weaken [] = [] Weaken {Γ = Γ} {T = T} (Snoc ν t) = Snoc (Weaken ν) (ren (Wk⊇ Γ T) t) abstract Weaken⊢ : ν ∶ Γ ⇛ Ψ → Weaken ν ∶ Γ ∙ T ⇛ Ψ Weaken⊢ [] = [] Weaken⊢ (Snoc ⊢ν ⊢t) = Snoc (Weaken⊢ ⊢ν) (ren-resp-⊢ (Wk⊇ _ _) ⊢t) Lift : Sub Γ Ψ → ∀ T → Sub (Γ ∙ T) (Ψ ∙ T) Lift σ T = Snoc (Weaken σ) (var zero) abstract Lift⊢ : ν ∶ Γ ⇛ Ψ → Lift ν T ∶ Γ ∙ T ⇛ Ψ ∙ T Lift⊢ ⊢ν = Snoc (Weaken⊢ ⊢ν) (var zero) Id : Sub Γ Γ Id {Γ = []} = [] Id {Γ = Γ ∙ T} = Lift Id T abstract Id⊢ : Id ∶ Γ ⇛ Γ Id⊢ {Γ = []} = [] Id⊢ {Γ = Γ ∙ T} = Snoc (Weaken⊢ Id⊢) (var zero) Wk : Sub (Γ ∙ T) Γ Wk = Weaken Id abstract Wk⊢ : Wk ∶ Γ ∙ T ⇛ Γ Wk⊢ = Weaken⊢ Id⊢ Fill : ∀ (Γ : Ctx Δ) T → Term Δ → Sub Γ (Γ ∙ T) Fill Γ T t = Snoc Id t abstract Fill⊢ : Δ , Γ ⊢ t ∶ T → Fill Γ T t ∶ Γ ⇛ Γ ∙ T Fill⊢ ⊢t = Snoc Id⊢ ⊢t subν : (σ : SC.Sub Δ Ω) → Sub Γ Ψ → Sub (Γ [ σ ]) (Ψ [ σ ]) subν σ [] = [] subν σ (Snoc ν t) = Snoc (subν σ ν) (t [ σ ]ₛ) abstract subν-resp-⊢ : ∀ {σ} → σ ∶ Δ ⇒ Ω → ν ∶ Γ ⇛ Ψ → subν σ ν ∶ Γ [ σ ] ⇛ Ψ [ σ ] subν-resp-⊢ ⊢σ [] = [] subν-resp-⊢ ⊢σ (Snoc ⊢ν ⊢t) = Snoc (subν-resp-⊢ ⊢σ ⊢ν) (subₛ-resp-⊢ ⊢σ ⊢t) sub-syntax-Subₛ = subν syntax sub-syntax-Subₛ σ ν = ν [ σ ]ν subV : Sub {Δ} Γ Ψ → Var → Term Δ subV [] x = var x -- impossible if x is well-scoped subV (Snoc ν t) zero = t subV (Snoc ν t) (suc x) = subV ν x sub : Sub {Δ} Γ Ψ → Term Δ → Term Δ sub ν (var x) = subV ν x sub ν (Λ T , t) = Λ T , sub (Lift ν T) t sub ν (t · u) = sub ν t · sub ν u sub ν (Λₛ n , t) = Λₛ n , sub (ν [ SC.Wk ]ν) t sub ν (t ·ₛ m) = sub ν t ·ₛ m sub ν (zero n) = zero n sub ν (suc n m i) = suc n m (sub ν i) sub ν (cons i n is) = cons (sub ν i) n (sub ν is) sub ν (head n is) = head n (sub ν is) sub ν (tail n is m) = tail n (sub ν is) m sub ν (caseNat T n i z s) = caseNat T n (sub ν i) (sub ν z) (sub ν s) sub ν (fix T t n) = fix T (sub ν t) n sub-syntax-Term = sub syntax sub-syntax-Term ν t = t [ ν ]t abstract subV-resp-⊢ : ν ∶ Γ ⇛ Ψ → Δ , Ψ ⊢ₓ x ∶ T → Δ , Γ ⊢ subV ν x ∶ T subV-resp-⊢ (Snoc ⊢ν ⊢t) zero = ⊢t subV-resp-⊢ (Snoc ⊢ν ⊢t) (suc ⊢x) = subV-resp-⊢ ⊢ν ⊢x sub-resp-⊢ : ν ∶ Γ ⇛ Ψ → Δ , Ψ ⊢ t ∶ T → Δ , Γ ⊢ sub ν t ∶ T sub-resp-⊢ ⊢ν (var ⊢x) = subV-resp-⊢ ⊢ν ⊢x sub-resp-⊢ ⊢ν (abs ⊢t) = abs (sub-resp-⊢ (Lift⊢ ⊢ν) ⊢t) sub-resp-⊢ ⊢ν (app ⊢t ⊢u) = app (sub-resp-⊢ ⊢ν ⊢t) (sub-resp-⊢ ⊢ν ⊢u) sub-resp-⊢ ⊢ν (absₛ ⊢t refl) = absₛ (sub-resp-⊢ (subν-resp-⊢ SC.Wk⊢ ⊢ν) ⊢t) refl sub-resp-⊢ ⊢ν (appₛ m<n ⊢t p) = appₛ m<n (sub-resp-⊢ ⊢ν ⊢t) p sub-resp-⊢ ⊢ν (zero n<⋆) = zero n<⋆ sub-resp-⊢ ⊢ν (suc n<⋆ m<n ⊢i) = suc n<⋆ m<n (sub-resp-⊢ ⊢ν ⊢i) sub-resp-⊢ ⊢ν (cons n<⋆ ⊢i ⊢is) = cons n<⋆ (sub-resp-⊢ ⊢ν ⊢i) (sub-resp-⊢ ⊢ν ⊢is) sub-resp-⊢ ⊢ν (head n<⋆ ⊢is) = head n<⋆ (sub-resp-⊢ ⊢ν ⊢is) sub-resp-⊢ ⊢ν (tail n<⋆ m<n ⊢is) = tail n<⋆ m<n (sub-resp-⊢ ⊢ν ⊢is) sub-resp-⊢ ⊢ν (caseNat n<⋆ ⊢i ⊢z ⊢s p) = caseNat n<⋆ (sub-resp-⊢ ⊢ν ⊢i) (sub-resp-⊢ ⊢ν ⊢z) (sub-resp-⊢ ⊢ν ⊢s) p sub-resp-⊢ ⊢ν (fix n<⋆ ⊢t p q) = fix n<⋆ (sub-resp-⊢ ⊢ν ⊢t) p q
{ "alphanum_fraction": 0.4572007547, "avg_line_length": 28.0058708415, "ext": "agda", "hexsha": "57da3c7eb2baec75e0925cad734fd0a63e98934f", "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": "104cddc6b65386c7e121c13db417aebfd4b7a863", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "JLimperg/msc-thesis-code", "max_forks_repo_path": "src/Source/Term.agda", "max_issues_count": null, "max_issues_repo_head_hexsha": "104cddc6b65386c7e121c13db417aebfd4b7a863", "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": "JLimperg/msc-thesis-code", "max_issues_repo_path": "src/Source/Term.agda", "max_line_length": 77, "max_stars_count": 5, "max_stars_repo_head_hexsha": "104cddc6b65386c7e121c13db417aebfd4b7a863", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "JLimperg/msc-thesis-code", "max_stars_repo_path": "src/Source/Term.agda", "max_stars_repo_stars_event_max_datetime": "2021-06-26T06:37:31.000Z", "max_stars_repo_stars_event_min_datetime": "2021-04-13T21:31:17.000Z", "num_tokens": 7983, "size": 14311 }
module Structure.Operator.Group.Proofs where open import Functional hiding (id) open import Function.Iteration.Order import Lvl open import Lang.Instance open import Logic.Propositional open import Logic.Predicate open import Structure.Setoid open import Structure.Function.Domain open import Structure.Operator.Group open import Structure.Operator.Monoid open import Structure.Operator.Properties open import Structure.Operator.Proofs open import Structure.Relator.Properties open import Syntax.Transitivity open import Type {- module _ {ℓ₁ ℓ₂} {X : Type{ℓ₁}} ⦃ _ : Equiv(X) ⦄ {_▫X_ : X → X → X} ⦃ structureₗ : Group(_▫X_) ⦄ {Y : Type{ℓ₂}} ⦃ _ : Equiv(Y) ⦄ {_▫Y_ : Y → Y → Y} ⦃ structureᵣ : Group(_▫Y_) ⦄ (f : X → Y) where monomorphic-cyclic : ⦃ (_▫X_) ↣ (_▫Y_) ⦄ → Cyclic(_▫X_) → Cyclic(_▫Y_) monomorphic-cyclic ⦃ [∃]-intro θ ⦃ θ-proof ⦄ ⦄ ([∃]-intro index ⦃ intro a ⦄) = {!!} -} {- module _ {T : Type{ℓ₂}} {_▫_ : T → T → T} ⦃ group : Group(_▫_) ⦄ where open Group {T} ⦃ [≡]-equiv ⦄ {_▫_} (group) open Monoid {T} ⦃ [≡]-equiv ⦄ {_▫_} (monoid) commutationₗ : ∀{x y} → (x ▫ y ≡ y ▫ x) ← ((x ▫ y) ▫ inv (x) ≡ y) commutationₗ {x}{y} (comm) = symmetry( (congruence₁(_▫ x) (symmetry comm) ) 🝖 (associativity) 🝖 (congruence₁((x ▫ y) ▫_)) (inverseₗ) 🝖 (identityᵣ) ) -- (x▫y)▫inv(x) = y //comm -- y = (x▫y)▫inv(x) //[≡]-symmetry -- y▫x -- = ((x▫y)▫inv(x))▫x //congruence₁(expr ↦ expr ▫ x) (..) -- = (x▫y)▫(inv(x)▫x) //Group.associativity -- = (x▫y)▫id //congruence₁(_) Group.inverseₗ -- = x▫y //Group.identityᵣ -- x▫y = y▫x //[≡]-symmetry commutationᵣ : ∀{x y} → (x ▫ y ≡ y ▫ x) → ((x ▫ y) ▫ inv(x) ≡ y) commutationᵣ {x}{y} (comm) = (congruence₁(_▫ inv(x)) comm) 🝖 (associativity) 🝖 (congruence₁(y ▫_) (inverseᵣ)) 🝖 (identityᵣ) -- x▫y = y▫x //comm -- (x▫y)▫inv(x) -- = (y▫x)▫inv(x) //congruence₁(expr ↦ expr ▫ inv(x)) (..) -- = y▫(x▫inv(x)) //Group.associativity -- = y▫id //congruence₁(expr ↦ y ▫ expr) Group.inverseᵣ -- = y //Group.identityᵣ module _ {T : Type} {_▫_ : T → T → T} ⦃ commGroup : CommutativeGroup(_▫_) ⦄ where open CommutativeGroup {T} ⦃ [≡]-equiv ⦄ {_▫_} (commGroup) open Group {T} ⦃ [≡]-equiv ⦄ {_▫_} (group) open Monoid {T} ⦃ [≡]-equiv ⦄ {_▫_} (monoid) commutation : ∀{x y} → ((x ▫ y) ▫ inv(x) ≡ y) commutation = commutationᵣ(commutativity) module _ {T : Type} {_▫_ : T → T → T} ⦃ associativity : Associativity(_▫_) ⦄ where -}
{ "alphanum_fraction": 0.5763052209, "avg_line_length": 34.1095890411, "ext": "agda", "hexsha": "954a08027f83747e831a538eaae515ea8bdc06cf", "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/Operator/Group/Proofs.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/Operator/Group/Proofs.agda", "max_line_length": 194, "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/Operator/Group/Proofs.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": 1103, "size": 2490 }
open import Agda.Builtin.Nat data Vec (a : Set) : {n : Nat} → Set where Nil : Vec a {0} Cons : {n : Nat} → a → Vec a {n} → Vec a {suc n} {-# COMPILE AGDA2HS Vec #-} mapV : {a b : Set} {n : Nat} (f : a → b) → Vec a {n} → Vec b {n} mapV f Nil = Nil mapV f (Cons x xs) = Cons (f x) (mapV f xs) {-# COMPILE AGDA2HS mapV #-} tailV : {a : Set} {n : Nat} → Vec a {suc n} → Vec a {n} tailV (Cons x xs) = xs {-# COMPILE AGDA2HS tailV #-} -- Using erasure instead of implicit arguments data Vec' (a : Set) : (@0 n : Nat) → Set where Nil' : Vec' a 0 Cons' : {@0 n : Nat} → a → Vec' a n → Vec' a (suc n) {-# COMPILE AGDA2HS Vec' #-} mapV' : {a b : Set} {@0 n : Nat} (f : a → b) → Vec' a n → Vec' b n mapV' f Nil' = Nil' mapV' f (Cons' x xs) = Cons' (f x) (mapV' f xs) {-# COMPILE AGDA2HS mapV' #-} tailV' : {a : Set} {@0 n : Nat} → Vec' a (suc n) → Vec' a n tailV' (Cons' x xs) = xs {-# COMPILE AGDA2HS tailV' #-}
{ "alphanum_fraction": 0.5278080698, "avg_line_length": 28.65625, "ext": "agda", "hexsha": "58796ec97fe6a08920635b97e92256fe68275f53", "lang": "Agda", "max_forks_count": 18, "max_forks_repo_forks_event_max_datetime": "2022-03-12T11:42:52.000Z", "max_forks_repo_forks_event_min_datetime": "2020-10-21T22:19:09.000Z", "max_forks_repo_head_hexsha": "160478a51bc78b0fdab07b968464420439f9fed6", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "seanpm2001/agda2hs", "max_forks_repo_path": "test/Vector.agda", "max_issues_count": 63, "max_issues_repo_head_hexsha": "160478a51bc78b0fdab07b968464420439f9fed6", "max_issues_repo_issues_event_max_datetime": "2022-02-25T15:47:30.000Z", "max_issues_repo_issues_event_min_datetime": "2020-10-22T05:19:27.000Z", "max_issues_repo_licenses": [ "MIT" ], "max_issues_repo_name": "seanpm2001/agda2hs", "max_issues_repo_path": "test/Vector.agda", "max_line_length": 66, "max_stars_count": 55, "max_stars_repo_head_hexsha": "703c66db29023f5538eaa841f38dc34e89473a3e", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "jespercockx/agda2hs", "max_stars_repo_path": "test/Vector.agda", "max_stars_repo_stars_event_max_datetime": "2022-03-26T21:57:56.000Z", "max_stars_repo_stars_event_min_datetime": "2020-10-20T13:36:25.000Z", "num_tokens": 390, "size": 917 }
{- The goal of this file is to prove the iso π₄S³≅ℤ/β where β is a natural number (aka "the Brunerie number", defined below). -} {-# OPTIONS --safe --experimental-lossy-unification #-} module Cubical.Homotopy.Group.Pi4S3.BrunerieNumber where open import Cubical.Homotopy.Loopspace open import Cubical.Homotopy.Group.Base open import Cubical.Homotopy.HopfInvariant.Base open import Cubical.Homotopy.Group.Pi3S2 open import Cubical.Homotopy.Group.PinSn open import Cubical.Homotopy.BlakersMassey open import Cubical.Homotopy.Whitehead open import Cubical.Homotopy.Connected open import Cubical.Homotopy.Group.LES open import Cubical.Homotopy.Group.Pi4S3.S3PushoutIso2 open import Cubical.Homotopy.Group.Pi4S3.S3PushoutIso open import Cubical.Foundations.Prelude open import Cubical.Foundations.Pointed open import Cubical.Foundations.Function open import Cubical.Foundations.HLevels open import Cubical.Foundations.GroupoidLaws open import Cubical.Foundations.Path open import Cubical.Foundations.Isomorphism open import Cubical.Foundations.Equiv open import Cubical.Data.Unit open import Cubical.Data.Sigma open import Cubical.Data.Nat open import Cubical.Data.Int renaming (ℤ to Z ; _·_ to _·Z_ ; _+_ to _+Z_) open import Cubical.HITs.S1 open import Cubical.HITs.Sn open import Cubical.HITs.Susp open import Cubical.HITs.Wedge open import Cubical.HITs.Pushout open import Cubical.HITs.PropositionalTruncation renaming (rec to pRec ; elim to pElim ; map to pMap) open import Cubical.HITs.SetTruncation renaming (rec to sRec ; rec2 to sRec2 ; elim to sElim ; elim2 to sElim2 ; elim3 to sElim3 ; map to sMap) open import Cubical.HITs.Truncation renaming (rec to trRec ; elim to trElim ; elim2 to trElim2 ; map to trMap) open import Cubical.Algebra.Group open import Cubical.Algebra.Group.Exact open import Cubical.Algebra.Group.ZAction open import Cubical.Algebra.Group.Instances.IntMod open import Cubical.Algebra.Group.Morphisms open import Cubical.Algebra.Group.MorphismProperties open import Cubical.Algebra.Group.Instances.Unit open import Cubical.Algebra.Group.GroupPath open Iso open Exact4 -- The Brunerie number (see Corollary 3.4.5 in Brunerie's PhD thesis) Brunerie : ℕ Brunerie = abs (HopfInvariant-π' 0 [ ∣ idfun∙ (S₊∙ 2) ∣₂ ∣ ∣ idfun∙ (S₊∙ 2) ∣₂ ]π') -- First we need to define the following maps. W : S₊ 3 → (S₊∙ 2 ⋁ S₊∙ 2) W = joinTo⋁ {A = S₊∙ 1} {B = S₊∙ 1} ∘ Iso.inv (IsoSphereJoin 1 1) fold∘W : S₊ 3 → S₊ 2 fold∘W = fold⋁ ∘ W {- We will now instantiate Blakers Massey to get a square: fold∘W S³ --------------> S² |\ ↗ | | \ ↗ | | \ ↗ | | X | inr | / | | / | | / | v / v 1 -----------> coFib fold∘W inl where X is the pullback of inl and inr and the map S³ → X is surjective on π₃. This will give us a sequence π₃ S³ --ᶠ→ π₃ S² → π₃ (coFib fold∘W) → π₂ X ≅ 0, where f is the function induced by fold∘W. From this, we can deduce that π₃ (coFib fold∘W) ≅ ℤ/ f(1) where f(1) is interpreted as an integer via the isos π₃ S³ ≅ π₃ S² ≅ ℤ (Recall that π₃(coFib fold∘W) ≅ π₄S³) For clarity: X, above will have two names (via a trivial iso) below: TotalPushoutPath× (the version the falls out of BM) P = fiber inr (Same name as in Brunerie's prop 4.3.4.) -} -- Before instantiating, we need to show that -- any map S³ → S² is 0-connected isConnectedS3→S2 : (f : S₊ 3 → S₊ 2) → isConnectedFun 2 f isConnectedS3→S2 f p = trRec (isProp→isOfHLevelSuc 1 isPropIsContr) (J (λ p _ → isConnected 2 (fiber f p)) (∣ north , refl ∣ , (trElim (λ _ → isOfHLevelPath 2 (isOfHLevelTrunc 2) _ _) (uncurry (sphereElim 2 (λ _ → isOfHLevelΠ 3 λ _ → isOfHLevelPath 3 (isOfHLevelSuc 2 (isOfHLevelTrunc 2)) _ _) λ p → trRec (isOfHLevelTrunc 2 _ _) (λ r → cong ∣_∣ₕ (ΣPathP (refl , r))) (fun (PathIdTruncIso 1) (isContr→isProp (isConnectedPath 2 (sphereConnected 2) (f north) (f north)) ∣ refl ∣ ∣ p ∣))))))) (fun (PathIdTruncIso 2) (isContr→isProp (sphereConnected 2) ∣ f north ∣ ∣ p ∣)) -- We get our square module BM-inst = BlakersMassey□ (λ _ → tt) fold∘W 3 1 (λ _ → subst (isConnected 4) (isoToPath (invIso fiberUnitIso)) (sphereConnected 3)) (isConnectedS3→S2 fold∘W) open BM-inst -- The central types coFib-fold∘W : Type coFib-fold∘W = Pushout (λ _ → tt) fold∘W coFib-fold∘W∙ : Pointed₀ coFib-fold∘W∙ = coFib-fold∘W , inl tt TotalPushoutPath×∙ : Pointed ℓ-zero fst TotalPushoutPath×∙ = Σ (Unit × S₊ 2) PushoutPath× snd TotalPushoutPath×∙ = (tt , north) , push north S³→TotalPushoutPath× : S₊ 3 → Σ (Unit × S₊ 2) PushoutPath× S³→TotalPushoutPath× = toPullback private inr' : S₊ 2 → coFib-fold∘W inr' = inr inr∙ : S₊∙ 2 →∙ coFib-fold∘W∙ fst inr∙ = inr' snd inr∙ = sym (push north) fiberinr'Iso' : Iso (fiber inr' (inl tt)) (Σ (Unit × S₊ 2) PushoutPath×) fiberinr'Iso' = compIso (Σ-cong-iso-snd (λ x → symIso)) (Σ-cong-iso-fst (invIso lUnit×Iso)) fiberinr'Iso : Iso (fiber inr' (inl tt)) (Σ (Unit × S₊ 2) PushoutPath×) fun fiberinr'Iso (x , p) = (tt , x) , (sym p) inv fiberinr'Iso ((tt , x) , p) = x , (sym p) rightInv fiberinr'Iso _ = refl leftInv fiberinr'Iso _ = refl P : Pointed₀ P = (fiber inr' (inl tt) , north , (sym (push north))) π'P→π'TotalPath× : (n : ℕ) → GroupEquiv (π'Gr n TotalPushoutPath×∙) (π'Gr n P) fst (fst (π'P→π'TotalPath× n)) = π'eqFun n ((invEquiv (isoToEquiv fiberinr'Iso)) , refl) snd (fst (π'P→π'TotalPath× n)) = π'eqFunIsEquiv n _ snd (π'P→π'TotalPath× n) = π'eqFunIsHom n _ -- Time to invoke the long exact sequence of homotopy groups on -- inr : S² → coFib-fold∘W module LESinst = πLES {A = S₊∙ 2} {B = coFib-fold∘W∙} inr∙ -- We instantiate the sequence -- π₃ P → π₃ S² → π₃ coFib-fold∘W∙ → π₂ P P→S²→Pushout : Exact4 (πGr 2 P) (πGr 2 (S₊∙ 2)) (πGr 2 coFib-fold∘W∙) (πGr 1 P) (LESinst.fib→A 2) (LESinst.A→B 2) (LESinst.B→fib 1) Exact4.ImG→H⊂KerH→L P→S²→Pushout = LESinst.Im-fib→A⊂Ker-A→B 2 Exact4.KerH→L⊂ImG→H P→S²→Pushout = LESinst.Ker-A→B⊂Im-fib→A 2 Exact4.ImH→L⊂KerL→R P→S²→Pushout = LESinst.Im-A→B⊂Ker-B→fib 1 Exact4.KerL→R⊂ImH→L P→S²→Pushout = LESinst.Ker-B→fib⊂Im-A→B 1 -- The goal now is to rewrite it as -- π₃ S³ → π₃ S² → π₃ coFib-fold∘W∙ → Unit using the -- "functions from spheres"-definition of πₙ. -- Here, the first map is the one induced by fold∘W. We do this by: -- (1) showing that π₂ P is trivial -- (2) extending the sequence by appending surjections -- π₃ S³ → π₃ TotalPushoutPath×∙ → π₃ P on the left. -- (3) proving that this new composition is indeed the appropriate map -- Step 1: π₂ P is trivial π₂P≅0 : GroupEquiv (πGr 1 P) UnitGroup₀ π₂P≅0 = compGroupEquiv (πIso (isoToEquiv fiberinr'Iso , refl) 1) (GroupIso→GroupEquiv (contrGroupIsoUnit (isOfHLevelRetractFromIso 0 (invIso iso₂) isContrπ₂S³))) where iso₁ : Iso (hLevelTrunc 4 (S₊ 3)) (hLevelTrunc 4 (Σ (Unit × S₊ 2) PushoutPath×)) iso₁ = connectedTruncIso 4 S³→TotalPushoutPath× isConnected-toPullback iso₂ : Iso (π 2 (hLevelTrunc∙ 4 (S₊∙ 3))) (π 2 TotalPushoutPath×∙) iso₂ = (compIso (setTruncIso (equivToIso (_ , (isEquivΩ^→ 2 (fun iso₁ , refl) (isoToIsEquiv iso₁))))) (invIso (πTruncIso 2))) isContrπ₂S³ : isContr (π 2 (hLevelTrunc∙ 4 (S₊∙ 3))) isContrπ₂S³ = subst (λ x → isContr (π 2 x)) (λ i → ((sym (isContr→≡Unit (sphereConnected 3))) i) , transp (λ j → isContr→≡Unit (sphereConnected 3) (~ i ∧ j)) i ∣ north ∣) (∣ refl ∣₂ , sElim (λ _ → isSetPathImplicit) λ p → cong ∣_∣₂ (isProp→isSet (isOfHLevelPath 1 isPropUnit _ _) _ _ _ p)) -- Step 2. We transform our original sequence to one for the -- the "maps from spheres" definition of πₙ and where π₂ P is -- replaced by the trivial group: -- π₃ P → π₃ S² → π₃ coFib-fold∘W∙ → 0 P→S²→Pushout→P' : Exact4 (π'Gr 2 P) (π'Gr 2 (S₊∙ 2)) (π'Gr 2 coFib-fold∘W∙) UnitGroup₀ (π'∘∙Hom 2 (fst , refl)) (π'∘∙Hom 2 inr∙) (→UnitHom _) P→S²→Pushout→P' = transportExact4 (sym (GroupPath _ _ .fst ((GroupIso→GroupEquiv (π'Gr≅πGr 2 P))))) (sym (GroupPath _ _ .fst ((GroupIso→GroupEquiv (π'Gr≅πGr 2 (S₊∙ 2)))))) (sym (GroupPath _ _ .fst ((GroupIso→GroupEquiv (π'Gr≅πGr 2 coFib-fold∘W∙))))) (sym (GroupPath _ _ .fst π₂P≅0)) _ _ _ _ _ P→S²→Pushout (ΣPathPProp (λ _ → isPropIsGroupHom _ _) λ i → fst (π∘∙fib→A-PathP 2 inr∙ i)) (ΣPathPProp (λ _ → isPropIsGroupHom _ _) λ i → fst (π∘∙A→B-PathP 2 inr∙ i)) -- The two surjections in question π₃S³→π₃P : GroupHom (π'Gr 2 (S₊∙ 3)) (π'Gr 2 TotalPushoutPath×∙) π₃S³→π₃P = π'∘∙Hom 2 (S³→TotalPushoutPath× , refl) TotalPushoutPath×∙→P : TotalPushoutPath×∙ →∙ P -- Surjective, and in particular on π₃ fst TotalPushoutPath×∙→P x = (snd (fst x)) , (sym (snd x)) snd TotalPushoutPath×∙→P = refl -- This surjectivity is where Blakers-Massey is used -- In particular, it uses isConnected-toPullback isSurjective-π₃S³→π₃TotalPushoutPath× : isSurjective π₃S³→π₃P isSurjective-π₃S³→π₃TotalPushoutPath× = transport (λ i → isSurjective (transportLem i)) isSurjective-π₃S³→π₃TotalPushoutPath×' where π₃S³→π₃TotalPushoutPath× : GroupHom (πGr 2 (S₊∙ 3)) (πGr 2 TotalPushoutPath×∙) π₃S³→π₃TotalPushoutPath× = πHom 2 (S³→TotalPushoutPath× , refl) isSurjective-π₃S³→π₃TotalPushoutPath×' : isSurjective π₃S³→π₃TotalPushoutPath× isSurjective-π₃S³→π₃TotalPushoutPath×' = sElim (λ _ → isProp→isSet squash₁) λ p → trRec squash₁ (λ s → ∣ ∣ fst s ∣₂ , (cong ∣_∣₂ (snd s)) ∣₁) (((isConnectedΩ^→ 3 3 (S³→TotalPushoutPath× , refl) isConnected-toPullback) p) .fst) transportLem : PathP (λ i → GroupHomπ≅π'PathP (S₊∙ 3) TotalPushoutPath×∙ 2 i) π₃S³→π₃TotalPushoutPath× π₃S³→π₃P transportLem = toPathP (Σ≡Prop (λ _ → isPropIsGroupHom _ _) (π'∘∙Hom'≡π'∘∙fun {A = S₊∙ 3} {B = TotalPushoutPath×∙} 2 (S³→TotalPushoutPath× , refl))) -- We get a sequence on the right form π₃S³ → π₃S² → π₃ Pushout → Unit S³→S²→Pushout→Unit'' : Exact4 (π'Gr 2 (S₊∙ 3)) (π'Gr 2 (S₊∙ 2)) (π'Gr 2 coFib-fold∘W∙) UnitGroup₀ (compGroupHom π₃S³→π₃P (compGroupHom (π'∘∙Hom 2 TotalPushoutPath×∙→P) (π'∘∙Hom 2 (fst , refl)))) (π'∘∙Hom 2 inr∙) (→UnitHom (π'Gr 2 coFib-fold∘W∙)) S³→S²→Pushout→Unit'' = extendExact4Surjective _ _ _ _ _ _ _ _ _ isSurjective-π₃S³→π₃TotalPushoutPath× (extendExact4Surjective _ _ _ _ _ _ _ _ _ ((sElim (λ _ → isProp→isSet squash₁) (λ f → ∣ ∣ (λ x → (tt , fst f x .fst) , sym (fst f x .snd)) , ΣPathP ((ΣPathP (refl , cong fst (snd f))) , λ j i → snd f j .snd (~ i)) ∣₂ , cong ∣_∣₂ (ΣPathP (refl , sym (rUnit _))) ∣₁))) P→S²→Pushout→P') -- Step 3: We need to show that the map π₃S³ → π₃S² in the above sequence -- indeed comes from fold∘W tripleComp≡ : (compGroupHom π₃S³→π₃P (compGroupHom (π'∘∙Hom 2 TotalPushoutPath×∙→P) (π'∘∙Hom 2 (fst , refl)))) ≡ π'∘∙Hom 2 (fold∘W , refl) tripleComp≡ = Σ≡Prop (λ _ → isPropIsGroupHom _ _) (funExt (sElim (λ _ → isSetPathImplicit) λ f → cong ∣_∣₂ (ΣPathP (refl , (cong (_∙ refl) (λ j → cong fst (rUnit (cong (fst TotalPushoutPath×∙→P) (rUnit (cong S³→TotalPushoutPath× (snd f)) (~ j))) (~ j)))))))) -- We finally get the correct sequence S³→S²→Pushout→Unit : Exact4 (π'Gr 2 (S₊∙ 3)) (π'Gr 2 (S₊∙ 2)) (π'Gr 2 coFib-fold∘W∙) UnitGroup₀ (π'∘∙Hom 2 (fold∘W , refl)) (π'∘∙Hom 2 inr∙) (→UnitHom (π'Gr 2 coFib-fold∘W∙)) S³→S²→Pushout→Unit = subst (λ F → Exact4 (π'Gr 2 (S₊∙ 3)) (π'Gr 2 (S₊∙ 2)) (π'Gr 2 coFib-fold∘W∙) UnitGroup₀ F (π'∘∙Hom 2 inr∙) (→UnitHom (π'Gr 2 coFib-fold∘W∙))) tripleComp≡ S³→S²→Pushout→Unit'' -- We need to throw around some pushouts module _ where Pushout-coFibW-fold⋁≃coFib-fold∘W : Pushout {B = (Pushout W (λ _ → tt))} inl fold⋁ ≃ fst coFib-fold∘W∙ Pushout-coFibW-fold⋁≃coFib-fold∘W = compEquiv (compEquiv pushoutSwitchEquiv (isoToEquiv (PushoutDistr.PushoutDistrIso fold⋁ W λ _ → tt))) pushoutSwitchEquiv coFibW≅coFibW' : Pushout W (λ _ → tt) ≃ cofibW S¹ S¹ base base coFibW≅coFibW' = pushoutEquiv W (λ _ → tt) joinTo⋁ (λ _ → tt) (isoToEquiv (invIso (IsoSphereJoin 1 1))) (idEquiv _) (idEquiv _) refl refl Pushout-coFibW-fold⋁≃Pushout⋁↪fold⋁ : Pushout {B = (Pushout W (λ _ → tt))} inl fold⋁ ≃ fst (Pushout⋁↪fold⋁∙ (S₊∙ 2)) Pushout-coFibW-fold⋁≃Pushout⋁↪fold⋁ = pushoutEquiv inl _ ⋁↪ fold⋁ (idEquiv _) (compEquiv coFibW≅coFibW' (isoToEquiv (invIso (Iso-Susp×Susp-cofibJoinTo⋁ S¹ S¹ base base)))) (idEquiv _) (Susp×Susp→cofibW≡ S¹ S¹ base base) refl Pushout-coFibW-fold⋁≃Pushout⋁↪fold⋁∙ : (Pushout {B = (Pushout W (λ _ → tt))} inl fold⋁ , inr north) ≃∙ (Pushout⋁↪fold⋁∙ (S₊∙ 2)) fst Pushout-coFibW-fold⋁≃Pushout⋁↪fold⋁∙ = Pushout-coFibW-fold⋁≃Pushout⋁↪fold⋁ snd Pushout-coFibW-fold⋁≃Pushout⋁↪fold⋁∙ = sym (push (inl north)) π₄S³≅π₃coFib-fold∘W∙ : GroupEquiv (π'Gr 3 (S₊∙ 3)) (π'Gr 2 coFib-fold∘W∙) π₄S³≅π₃coFib-fold∘W∙ = compGroupEquiv (GroupIso→GroupEquiv (compGroupIso (π'Gr≅πGr 3 (S₊∙ 3)) (compGroupIso π₄S³≅π₃PushS² (invGroupIso (π'Gr≅πGr 2 (Pushout⋁↪fold⋁∙ (S₊∙ 2))))))) (compGroupEquiv (invGroupEquiv (π'Iso 2 Pushout-coFibW-fold⋁≃Pushout⋁↪fold⋁∙)) (π'Iso 2 (Pushout-coFibW-fold⋁≃coFib-fold∘W , sym (push north)))) -- We get the iso -- For type checking reasons, let's first prove it for the abstract -- definition of ℤ/_ -- To get everything on the same form as in Brunerie's thesis, we -- first need the following: fold∘W≡Whitehead : fst (π'∘∙Hom 2 (fold∘W , refl)) ∣ idfun∙ (S₊∙ 3) ∣₂ ≡ ∣ [ idfun∙ (S₊∙ 2) ∣ idfun∙ (S₊∙ 2) ]₂ ∣₂ fold∘W≡Whitehead = pRec (squash₂ _ _) (cong ∣_∣₂) (indΠ₃S₂ _ _ (funExt (λ x → funExt⁻ (sym (cong fst (id∨→∙id {A = S₊∙ 2}))) (W x)))) where indΠ₃S₂ : ∀ {ℓ} {A : Pointed ℓ} → (f g : A →∙ S₊∙ 2) → fst f ≡ fst g → ∥ f ≡ g ∥₁ indΠ₃S₂ {A = A} f g p = trRec squash₁ (λ r → ∣ ΣPathP (p , r) ∣₁) (isConnectedPathP 1 {A = (λ i → p i (snd A) ≡ north)} (isConnectedPathSⁿ 1 (fst g (pt A)) north) (snd f) (snd g) .fst ) BrunerieIsoAbstract : GroupEquiv (π'Gr 3 (S₊∙ 3)) (abstractℤGroup/ Brunerie) BrunerieIsoAbstract = compGroupEquiv π₄S³≅π₃coFib-fold∘W∙ (invGroupEquiv (GroupEquiv-abstractℤ/abs-gen (π'Gr 2 (S₊∙ 3)) (π'Gr 2 (S₊∙ 2)) (π'Gr 2 coFib-fold∘W∙) (GroupIso→GroupEquiv (invGroupIso (πₙ'Sⁿ≅ℤ 2))) (invGroupEquiv hopfInvariantEquiv) (π'∘∙Hom 2 (fold∘W , refl)) _ S³→S²→Pushout→Unit Brunerie main)) where mainPath : fst (π'∘∙Hom 2 (fold∘W , refl)) (Iso.inv (fst (πₙ'Sⁿ≅ℤ 2)) 1) ≡ [ ∣ idfun∙ (S₊∙ 2) ∣₂ ∣ ∣ idfun∙ (S₊∙ 2) ∣₂ ]π' mainPath = cong (fst (π'∘∙Hom 2 (fold∘W , refl))) (cong (Iso.inv (fst (πₙ'Sⁿ≅ℤ 2))) (sym (πₙ'Sⁿ≅ℤ-idfun∙ 2)) ∙ (Iso.leftInv (fst (πₙ'Sⁿ≅ℤ 2)) ∣ idfun∙ (S₊∙ 3) ∣₂)) ∙ fold∘W≡Whitehead ∙ cong ∣_∣₂ (sym ([]≡[]₂ (idfun∙ (S₊∙ 2)) (idfun∙ (S₊∙ 2)))) main : _ ≡ Brunerie main i = abs (HopfInvariant-π' 0 (mainPath i)) -- And, finally, we get the actual iso -- (as in Corollary 3.4.5 in Brunerie's thesis) BrunerieIso : GroupEquiv (π'Gr 3 (S₊∙ 3)) (ℤGroup/ Brunerie) BrunerieIso = compGroupEquiv BrunerieIsoAbstract (abstractℤ/≅ℤ Brunerie)
{ "alphanum_fraction": 0.6146356784, "avg_line_length": 35.5357142857, "ext": "agda", "hexsha": "051358e8e2fcb4f63db6dabbb162adc427b37ccd", "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/Homotopy/Group/Pi4S3/BrunerieNumber.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/Homotopy/Group/Pi4S3/BrunerieNumber.agda", "max_line_length": 85, "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/Homotopy/Group/Pi4S3/BrunerieNumber.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": 6822, "size": 15920 }
module UniDB.Morph.WeakenPrime where open import UniDB.Spec open import UniDB.Morph.ShiftsPrime open import Function -------------------------------------------------------------------------------- data Weaken` : MOR where baseW : {γ : Dom} → Weaken` γ γ stepW : {γ₁ γ₂ : Dom} → Weaken` γ₁ γ₂ → Weaken` γ₁ (suc γ₂) lkWeakenIx` : {γ₁ γ₂ : Dom} → Weaken` γ₁ γ₂ → Ix γ₁ → Ix γ₂ lkWeakenIx` baseW i = i lkWeakenIx` (stepW ξ) i = suc (lkWeakenIx` ξ i) instance iLkWeaken` : {T : STX} {{vrT : Vr T}} → Lk T Weaken` lk {{iLkWeaken`}} ξ i = vr (lkWeakenIx` ξ i) iWkmWeaken` : Wkm Weaken` Wkm.wkm iWkmWeaken` zero = baseW Wkm.wkm iWkmWeaken` (suc δ) = stepW (wkm {Weaken`} δ) iIdmWeaken` : Idm Weaken` idm {{iIdmWeaken`}} γ = baseW iWkWeaken` : {γ₁ : Dom} → Wk (Weaken` γ₁) wk₁ {{iWkWeaken`}} ξ = stepW ξ wk {{iWkWeaken`}} zero x = x wk {{iWkWeaken`}} (suc δ) x = wk₁ (wk δ x) wk-zero {{iWkWeaken`}} x = refl wk-suc {{iWkWeaken`}} δ x = refl lkWeakenIx`-wkm : {γ : Dom} (δ : Dom) (i : Ix γ) → lkWeakenIx` (wkm {Weaken`} δ) i ≡ wk δ i lkWeakenIx`-wkm zero i = refl lkWeakenIx`-wkm (suc δ) i = cong suc (lkWeakenIx`-wkm δ i) instance iLkWkmWeaken` : {T : STX} {{vrT : Vr T}} → LkWkm T Weaken` lk-wkm {{iLkWkmWeaken` {T}}} δ i = cong (vr {T}) (lkWeakenIx`-wkm δ i) iCompWeaken` : Comp Weaken` _⊙_ {{iCompWeaken`}} ξ baseW = ξ _⊙_ {{iCompWeaken`}} ξ (stepW ξ₂) = stepW (ξ ⊙ ξ₂) wk-comp` : {γ₁ γ₂ γ₃ : Dom} (ξ₁ : Weaken` γ₁ γ₂) (ξ₂ : Weaken` γ₂ γ₃) (δ : Dom) → wk δ (ξ₁ ⊙ ξ₂) ≡ ξ₁ ⊙ wk δ ξ₂ wk-comp` ξ₁ ξ₂ zero = refl wk-comp` ξ₁ ξ₂ (suc δ) = cong stepW (wk-comp` ξ₁ ξ₂ δ) lkIx-wk-weaken` : {γ₁ γ₂ : Dom} (δ : Dom) (ξ : Weaken` γ₁ γ₂) (i : Ix γ₁) → lk {Ix} {Weaken`} (wk δ ξ) i ≡ wk δ (lk {Ix} {Weaken`} ξ i) lkIx-wk-weaken` zero ξ i = refl lkIx-wk-weaken` (suc δ) ξ i = cong suc (lkIx-wk-weaken` δ ξ i) module _ (T : STX) {{vrT : Vr T}} {{wkT : Wk T}} {{wkVrT : WkVr T}} where lk-wk₁-weaken` : {γ₁ γ₂ : Dom} (ξ : Weaken` γ₁ γ₂) (i : Ix γ₁) → lk {T} {Weaken`} (wk₁ ξ) i ≡ wk₁ (lk {T} {Weaken`} ξ i) lk-wk₁-weaken` ξ i = sym (wk₁-vr {T} (lk {Ix} {Weaken`} ξ i) ) lk-wk-weaken` : {γ₁ γ₂ : Dom} (δ : Dom) (ξ : Weaken` γ₁ γ₂) (i : Ix γ₁) → lk {T} {Weaken`} (wk δ ξ) i ≡ wk δ (lk {T} {Weaken`} ξ i) lk-wk-weaken` δ ξ i = trans (cong (vr {T}) (lkIx-wk-weaken` δ ξ i)) (sym (wk-vr {T} δ (lk {Ix} {Weaken`} ξ i))) lkWeakenIx`-comp : {γ₁ γ₂ γ₃ : Dom} (ξ₁ : Weaken` γ₁ γ₂) (ξ₂ : Weaken` γ₂ γ₃) (i : Ix γ₁) → lkWeakenIx` ((iCompWeaken` Comp.⊙ ξ₁) ξ₂) i ≡ lkWeakenIx` ξ₂ (lkWeakenIx` ξ₁ i) lkWeakenIx`-comp ξ₁ baseW i = refl lkWeakenIx`-comp ξ₁ (stepW ξ₂) i = cong suc (lkWeakenIx`-comp ξ₁ ξ₂ i) instance iLkRenWeaken` : {T : STX} {{vrT : Vr T}} → LkRen T Weaken` lk-ren {{iLkRenWeaken`}} ξ i = refl iLkRenCompWeaken` : {T : STX} {{vrT : Vr T}} → LkRenComp T Weaken` lk-ren-comp {{iLkRenCompWeaken` {T}}} ξ₁ ξ₂ i = cong (vr {T}) (lkWeakenIx`-comp ξ₁ ξ₂ i) iCompIdmWeaken` : CompIdm Weaken` ⊙-idm {{iCompIdmWeaken`}} ξ = refl idm-⊙ {{iCompIdmWeaken`}} baseW = refl idm-⊙ {{iCompIdmWeaken`}} (stepW ξ) = cong stepW (idm-⊙ {Weaken`} ξ) iCompAssocWeaken` : CompAssoc Weaken` ⊙-assoc {{iCompAssocWeaken`}} ξ₁ ξ₂ baseW = refl ⊙-assoc {{iCompAssocWeaken`}} ξ₁ ξ₂ (stepW ξ₃) = cong stepW (⊙-assoc {Weaken`} ξ₁ ξ₂ ξ₃) ⊙-wkm-weaken` : {γ₁ γ₂ : Dom} (ξ : Weaken` γ₁ γ₂) (δ : Dom) → ξ ⊙ wkm {Weaken`} δ ≡ wk δ ξ ⊙-wkm-weaken` ξ zero = refl ⊙-wkm-weaken` ξ (suc δ) = cong stepW (⊙-wkm-weaken` ξ δ) extensionality-weaken` : {γ₁ γ₂ : Dom} (ξ₁ ξ₂ : Weaken` γ₁ γ₂) (hyp : (i : Ix γ₁) → lk {Ix} ξ₁ i ≡ lk {Ix} ξ₂ i) → ξ₁ ≡ ξ₂ extensionality-weaken` baseW baseW hyp = refl extensionality-weaken` baseW (stepW ξ₂) hyp = case hyp zero of λ () extensionality-weaken` (stepW ξ₁) baseW hyp = case hyp zero of λ () extensionality-weaken` (stepW ξ₁) (stepW ξ₂) hyp = cong stepW (extensionality-weaken` ξ₁ ξ₂ (suc-inj ∘ hyp)) --------------------------------------------------------------------------------
{ "alphanum_fraction": 0.5643491124, "avg_line_length": 35.5789473684, "ext": "agda", "hexsha": "87137066ca572551e6f9aa5500ad5dad56fbb231", "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/WeakenPrime.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/WeakenPrime.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/WeakenPrime.agda", "max_stars_repo_stars_event_max_datetime": null, "max_stars_repo_stars_event_min_datetime": null, "num_tokens": 1939, "size": 4056 }
{-# OPTIONS --without-K --safe #-} -- A cartesian functor preserves products (of cartesian categories) module Categories.Functor.Cartesian where open import Data.Product using (Σ; _,_) open import Level open import Categories.Category.Cartesian open import Categories.Category using (Category; _[_,_]) open import Categories.Category.Product open import Categories.Functor using (Functor; _∘F_) open import Categories.NaturalTransformation using (NaturalTransformation) private variable o ℓ e o′ ℓ′ e′ : Level record CartesianF {A : Category o ℓ e} {B : Category o′ ℓ′ e′} (CA : Cartesian A) (CB : Cartesian B) (F : Functor A B) : Set (o ⊔ ℓ ⊔ e ⊔ o′ ⊔ ℓ′ ⊔ e′) where private module CA = Cartesian CA module CB = Cartesian CB field -- F is product preserving ε : B [ CB.⊤ , Functor.F₀ F CA.⊤ ] ⊗-homo : NaturalTransformation (CB.⊗ ∘F (F ⁂ F)) (F ∘F CA.⊗)
{ "alphanum_fraction": 0.6883408072, "avg_line_length": 31.8571428571, "ext": "agda", "hexsha": "99cf0f4f98fb06fc56bea7afc9a7042999e8fb0d", "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": "6cbfdf3f1be15ef513435e3b85faae92cb1ac36f", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "bond15/agda-categories", "max_forks_repo_path": "src/Categories/Functor/Cartesian.agda", "max_issues_count": null, "max_issues_repo_head_hexsha": "6cbfdf3f1be15ef513435e3b85faae92cb1ac36f", "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": "bond15/agda-categories", "max_issues_repo_path": "src/Categories/Functor/Cartesian.agda", "max_line_length": 100, "max_stars_count": null, "max_stars_repo_head_hexsha": "6cbfdf3f1be15ef513435e3b85faae92cb1ac36f", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "bond15/agda-categories", "max_stars_repo_path": "src/Categories/Functor/Cartesian.agda", "max_stars_repo_stars_event_max_datetime": null, "max_stars_repo_stars_event_min_datetime": null, "num_tokens": 270, "size": 892 }
{-# OPTIONS --without-K --safe #-} module Categories.Adjoint.Instance.0-Truncation where -- The adjunction between 0-truncation and the inclusion functor from -- Setoids to Categories/Groupoids. open import Level using (Lift) open import Data.Unit using (⊤) import Function open import Relation.Binary using (Setoid) open import Function.Equality using (Π) renaming (id to idΠ) open import Categories.Adjoint using (_⊣_) open import Categories.Category.Construction.0-Groupoid using (0-Groupoid) open import Categories.Category.Groupoid using (Groupoid) open import Categories.Category.Instance.Groupoids using (Groupoids) open import Categories.Category.Instance.Setoids using (Setoids) open import Categories.Functor renaming (id to idF) open import Categories.Functor.Instance.0-Truncation using (Trunc) open import Categories.NaturalTransformation using (NaturalTransformation; ntHelper) open import Categories.NaturalTransformation.NaturalIsomorphism using (refl) -- The inclusion functor from Setoids to Groupoids Inclusion : ∀ {c ℓ} e → Functor (Setoids c ℓ) (Groupoids c ℓ e) Inclusion {c} {ℓ} e = record { F₀ = 0-Groupoid e ; F₁ = λ f → record { F₀ = f ⟨$⟩_ ; F₁ = cong f } ; identity = refl ; homomorphism = refl ; F-resp-≈ = λ {S T f g} f≗g → let module S = Setoid S module T = Setoid T in record { F⇒G = record { η = λ _ → f≗g S.refl } ; F⇐G = record { η = λ _ → T.sym (f≗g S.refl) } } } where open Π -- Trunc is left-adjoint to the inclusion functor from Setoids to Groupoids TruncAdj : ∀ {o ℓ e} → Trunc ⊣ Inclusion {o} {ℓ} e TruncAdj {o} {ℓ} {e} = record { unit = unit ; counit = counit ; zig = Function.id ; zag = refl } where open Π open Groupoid using (category) unit : NaturalTransformation idF (Inclusion e ∘F Trunc) unit = record { η = λ _ → record { F₀ = Function.id ; F₁ = Function.id } ; commute = λ _ → refl ; sym-commute = λ _ → refl } counit : NaturalTransformation (Trunc ∘F Inclusion e) idF counit = ntHelper record { η = λ S → idΠ ; commute = λ f → cong f }
{ "alphanum_fraction": 0.6668211307, "avg_line_length": 33.71875, "ext": "agda", "hexsha": "3d0a60b0e1e40effb03dab5360ee5209a1c5a4e4", "lang": "Agda", "max_forks_count": 64, "max_forks_repo_forks_event_max_datetime": "2022-03-14T02:00:59.000Z", "max_forks_repo_forks_event_min_datetime": "2019-06-02T16:58:15.000Z", "max_forks_repo_head_hexsha": "d9e4f578b126313058d105c61707d8c8ae987fa8", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "Code-distancing/agda-categories", "max_forks_repo_path": "src/Categories/Adjoint/Instance/0-Truncation.agda", "max_issues_count": 236, "max_issues_repo_head_hexsha": "d9e4f578b126313058d105c61707d8c8ae987fa8", "max_issues_repo_issues_event_max_datetime": "2022-03-28T14:31:43.000Z", "max_issues_repo_issues_event_min_datetime": "2019-06-01T14:53:54.000Z", "max_issues_repo_licenses": [ "MIT" ], "max_issues_repo_name": "Code-distancing/agda-categories", "max_issues_repo_path": "src/Categories/Adjoint/Instance/0-Truncation.agda", "max_line_length": 84, "max_stars_count": 279, "max_stars_repo_head_hexsha": "d9e4f578b126313058d105c61707d8c8ae987fa8", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "Trebor-Huang/agda-categories", "max_stars_repo_path": "src/Categories/Adjoint/Instance/0-Truncation.agda", "max_stars_repo_stars_event_max_datetime": "2022-03-22T00:40:14.000Z", "max_stars_repo_stars_event_min_datetime": "2019-06-01T14:36:40.000Z", "num_tokens": 652, "size": 2158 }
module AbstractInterfaces where open import Prelude public -- Process identifiers. record IsProc : Set₁ where field Proc : Set _≡ₚ?_ : Decidable (_≡_ {A = Proc}) _<ₚ_ : Proc → Proc → Set trans<ₚ : Transitive _<ₚ_ tri<ₚ : Trichotomous _≡_ _<ₚ_ _≮ₚ_ : Proc → Proc → Set P ≮ₚ P′ = ¬ (P <ₚ P′) open IsProc {{…}} public -- Process clocks, message timestamps, and event timestamps. record IsTime : Set₁ where field Time : Set _≡ₜ?_ : Decidable (_≡_ {A = Time}) _<ₜ_ : Time → Time → Set trans<ₜ : Transitive _<ₜ_ tri<ₜ : Trichotomous _≡_ _<ₜ_ irrefl<ₜ : Irreflexive _<ₜ_ sucₜ : Time → Time _⊔ₜ_ : Time → Time → Time n<s[n⊔m]ₜ : ∀ T T′ → T <ₜ sucₜ (T ⊔ₜ T′) _≮ₜ_ : Time → Time → Set T ≮ₜ T′ = ¬ (T <ₜ T′) open IsTime {{…}} public -- Messages. record IsMsg {{_ : IsProc}} {{_ : IsTime}} : Set₁ where field Msg : (Pᵢ Pⱼ : Proc) (Tₘ : Time) → Set open IsMsg {{…}} public -- Events within one process. record IsEvent {{_ : IsProc}} {{_ : IsTime}} {{_ : IsMsg}} : Set₁ where field Event : Proc → Time → Set isSendₑ : ∀ {Cᵢ Pᵢ Pⱼ Tₘ} {{_ : Tₘ ≡ sucₜ Cᵢ}} → Msg Pᵢ Pⱼ Tₘ → Event Pᵢ Tₘ → Set isRecvₑ : ∀ {Cⱼ Pᵢ Pⱼ Tₘ Tⱼ} {{_ : Tⱼ ≡ sucₜ (Tₘ ⊔ₜ Cⱼ)}} → Msg Pᵢ Pⱼ Tₘ → Event Pⱼ Tⱼ → Set absurdₑ : ∀ {Cᵢ Cⱼ P T} {m : Msg P P T} {a : Event P T} → {{_ : T ≡ sucₜ Cᵢ}} {{_ : T ≡ sucₜ (T ⊔ₜ Cⱼ)}} → ¬ (isSendₑ {Cᵢ} m a × isRecvₑ {Cⱼ} m a) open IsEvent {{…}} public
{ "alphanum_fraction": 0.522829582, "avg_line_length": 22.8676470588, "ext": "agda", "hexsha": "08b2ff6522768951bc24d6c19922f3055da0183e", "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": "b685baa99230c3d5fd1e41c66d325575b70308c4", "max_forks_repo_licenses": [ "X11" ], "max_forks_repo_name": "mietek/lamport-timestamps", "max_forks_repo_path": "AbstractInterfaces.agda", "max_issues_count": null, "max_issues_repo_head_hexsha": "b685baa99230c3d5fd1e41c66d325575b70308c4", "max_issues_repo_issues_event_max_datetime": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_licenses": [ "X11" ], "max_issues_repo_name": "mietek/lamport-timestamps", "max_issues_repo_path": "AbstractInterfaces.agda", "max_line_length": 71, "max_stars_count": null, "max_stars_repo_head_hexsha": "b685baa99230c3d5fd1e41c66d325575b70308c4", "max_stars_repo_licenses": [ "X11" ], "max_stars_repo_name": "mietek/lamport-timestamps", "max_stars_repo_path": "AbstractInterfaces.agda", "max_stars_repo_stars_event_max_datetime": null, "max_stars_repo_stars_event_min_datetime": null, "num_tokens": 716, "size": 1555 }
-- Andreas, 2016-12-30, issue #1886, reported by nad -- -- Omitted hidden parameters are not in scope. postulate A : Set P : A → Set data D {a} (X : P a) : Set₁ data D X where c : P a → D _ -- Expected error: -- -- Not in scope: a
{ "alphanum_fraction": 0.5975103734, "avg_line_length": 14.1764705882, "ext": "agda", "hexsha": "62411bab9da0bd709e2cbc33ec6995a553dafcae", "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/Issue1886-omitted-not-in-scope.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/Issue1886-omitted-not-in-scope.agda", "max_line_length": 52, "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/Issue1886-omitted-not-in-scope.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": 86, "size": 241 }
{-# OPTIONS --without-K #-} module Ch2-1 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 = refl open import Relation.Binary isEquivalence : ∀ {a} {A : Set a} → IsEquivalence (_≡_ {a} {A}) isEquivalence = record { refl = refl ; sym = ¬_ ; trans = _∙_ } setoid : ∀ {a} → Set a → Setoid _ _ setoid {a} A = record { Carrier = A ; _≈_ = _≡_ ; isEquivalence = isEquivalence {a} {A} } -- module EckmannHilton where -- -- -- begin -- -- p ∙ refl -- -- ≈⟨ ¬ ∙-identityʳ p ⟩ -- -- p -- -- ≈⟨ α ⟩ -- -- q -- -- ≈⟨ ∙-identityʳ q ⟩ -- -- q ∙ refl -- -- ∎ -- -- where -- -- open import Relation.Binary.Reasoning.Setoid (setoid (a ≡ x)) -- -- -- whisker right -- infixl 6 _∙r_ -- _∙r_ : {A : Set} {a b c : A} {p q : a ≡ b} -- → (α : p ≡ q) (r : b ≡ c) -- → p ∙ r ≡ q ∙ r -- _∙r_ {A} {a} {b} {c} {p} {q} α r = J A D d b c r a p q α -- where -- -- the predicate -- D : (b c : A) (r : b ≡ c) → Set -- D b c r = (a : A) (p q : a ≡ b) (α : p ≡ q) -- → p ∙ r ≡ q ∙ r -- -- -- base case -- d : (x : A) → D x x refl -- d x a p q α = J A E e a x p q -- where -- -- the predicate -- E : (a x : A) (p : a ≡ x) → Set -- E a x p = (q : a ≡ x) → p ∙ refl ≡ q ∙ refl -- -- -- base case -- e : (x : A) → E x x refl -- e x q = {! !} -- where -- -- the predicate -- F : (a x : A) (q : a ≡ x) → Set -- F a x q = {! !} -- -- refl ∙ refl ≡ q ∙ refl -- -- refl ∙ refl ≡ q ∙ refl -- -- -- base case -- f : (x : A) → F x x refl -- f x = {! !} -- -- -- -- ¬ ∙-identityʳ p ∙ α ∙ ∙-identityʳ q -- -- -- -- -- -- -- whisker left -- -- infixl 6 _∙l_ -- -- _∙l_ : {A : Set} {a b c : A} {r s : b ≡ c} -- -- → (q : a ≡ b) (β : r ≡ s) -- -- → q ∙ r ≡ q ∙ s -- -- _∙l_ {A} {a} {b} {c} {r} {s} q β = J A D d a b q c r s β -- -- where -- -- -- the predicate -- -- D : (a b : A) (q : a ≡ b) → Set -- -- D a b q = (c : A) (r s : b ≡ c) (β : r ≡ s) -- -- → q ∙ r ≡ q ∙ s -- -- -- -- -- base case -- -- d : (x : A) → D x x refl -- -- d x c r s β = ¬ ∙-identityˡ r ∙ β ∙ ∙-identityˡ s -- -- -- -- -- horizontal composition -- -- _⋆_ : {A : Set} {a b c : A} {p q : a ≡ b} {r s : b ≡ c} -- -- → (α : p ≡ q) (β : r ≡ s) -- -- → p ∙ r ≡ q ∙ s -- -- _⋆_ {A} {a} {b} {c} {p} {q} {r} {s} α β = (α ∙r r) ∙ (q ∙l β) -- -- -- -- where -- -- whisker-right-lemma : ∀ {A : Set} {a b : A} -- -- → {p q : a ≡ b} {α : p ≡ q} -- -- → α ∙r refl ≡ ¬ ∙-identityʳ p ∙ α ∙ ∙-identityʳ q -- -- whisker-right-lemma {A} {a} {b} {p} {q} {α} = refl -- -- -- -- whisker-left-lemma : ∀ {A : Set} {b c : A} -- -- → {r s : b ≡ c} {β : r ≡ s} -- -- → refl ∙l β ≡ ¬ ∙-identityˡ r ∙ β ∙ ∙-identityˡ s -- -- whisker-left-lemma {A} {b} {c} {r} {s} {α} = refl -- -- -- -- cong : {A B : Set} {x y : A} -- -- → (f : A → B) (p : x ≡ y) -- -- → f x ≡ f y -- -- cong {A} {B} {x} {y} f p = J A D d x y p f -- -- where -- -- -- the predicate -- -- D : (x y : A) (p : x ≡ y) → Set -- -- D x y p = (f : A → B) → f x ≡ f y -- -- -- -- -- base case -- -- d : (x : A) → D x x refl -- -- d x f = refl -- -- -- -- cong2 : {A B C : Set} {x y : A} {a b : B} -- -- → (f : A → B → C) (p : x ≡ y) (q : a ≡ b) -- -- → f x a ≡ f y b -- -- cong2 {A} {B} {C} {x} {y} {a} {b} f p q = J A D d x y p a b q f -- -- -- J A D d x y p f -- -- where -- -- -- the predicate -- -- D : (x y : A) (p : x ≡ y) → Set -- -- D x y p = (a b : B) (q : a ≡ b) (f : A → B → C) → f x a ≡ f y b -- -- -- -- -- base case -- -- d : (x : A) → D x x refl -- -- d x a b q f = cong (f x) q -- -- -- -- -- -- -- theorem : {A : Set} {a b c : A} -- -- -- → {p q : a ≡ b} {r s : b ≡ c} -- -- -- → (α : p ≡ q) (β : r ≡ s) -- -- -- → α ⋆ β ≡ cong2 _∙_ α β -- -- -- theorem {A} {a} {b} {c} {p} {q} {r} {s} α β = J A D d a b p q c r s α β -- -- -- -- -- -- where -- -- -- -- the predicate -- -- -- D : (a b : A) (p : a ≡ b) → Set -- -- -- D a b p = (q : a ≡ b) (c : A) (r s : b ≡ c) (α : p ≡ q) (β : r ≡ s) -- -- -- → α ⋆ β ≡ cong2 _∙_ α β -- -- -- -- -- -- -- base case ʳˡ -- -- -- d : (x : A) → D x x refl -- -- -- d x q c r s α β = J A E e x c r s q α β -- -- -- -- -- -- where -- -- -- -- the predicate -- -- -- E : (b c : A) (r : b ≡ c) → Set -- -- -- E b c r = (s : b ≡ c) (q : b ≡ b) (α : refl ≡ q) (β : r ≡ s) -- -- -- → α ⋆ β ≡ cong2 _∙_ α β -- -- -- -- -- -- -- base case -- -- -- e : (x : A) → E x x refl -- -- -- e x s q α β = {! !}
{ "alphanum_fraction": 0.3445592846, "avg_line_length": 28.2327868852, "ext": "agda", "hexsha": "90f8a2a29cdd48a1a9481e6c6eb133450176fb2f", "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": "75eea99a879e100304bd48c538c9d2db0b4a4ff3", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "banacorn/hott", "max_forks_repo_path": "src/Ch2-1.agda", "max_issues_count": null, "max_issues_repo_head_hexsha": "75eea99a879e100304bd48c538c9d2db0b4a4ff3", "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": "banacorn/hott", "max_issues_repo_path": "src/Ch2-1.agda", "max_line_length": 82, "max_stars_count": null, "max_stars_repo_head_hexsha": "75eea99a879e100304bd48c538c9d2db0b4a4ff3", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "banacorn/hott", "max_stars_repo_path": "src/Ch2-1.agda", "max_stars_repo_stars_event_max_datetime": null, "max_stars_repo_stars_event_min_datetime": null, "num_tokens": 3968, "size": 8611 }
------------------------------------------------------------------------ -- The "interval" ------------------------------------------------------------------------ {-# OPTIONS --erased-cubical --safe #-} -- Partly based on the HoTT book. -- The module is parametrised by a notion of equality. The higher -- constructor of the HIT defining the interval uses path equality, -- but the supplied notion of equality is used for many other things. import Equality.Path as P module Interval {c⁺} (eq : ∀ {a p} → P.Equality-with-paths a p c⁺) where private open module D = P.Derived-definitions-and-properties eq hiding (elim) open import Logical-equivalence using (_⇔_) open import Prelude open import Bijection equality-with-J using (_↔_) import Equality.Path.Isomorphisms eq as I open import Equivalence equality-with-J hiding (_∘_) open import Function-universe equality-with-J hiding (_∘_) open import H-level equality-with-J open import H-level.Closure equality-with-J using (ext⁻¹) private variable a p : Level A B C : Type a ------------------------------------------------------------------------ -- The interval -- The interval, defined as a higher inductive type. data Interval : Type where [0] [1] : Interval 0≡1ᴾ : [0] P.≡ [1] -- [0] is equal to [1]. 0≡1 : [0] ≡ [1] 0≡1 = _↔_.from ≡↔≡ 0≡1ᴾ -- An eliminator, expressed using paths. elimᴾ : (P : Interval → Type p) (p₀ : P [0]) (p₁ : P [1]) → P.[ (λ i → P (0≡1ᴾ i)) ] p₀ ≡ p₁ → (x : Interval) → P x elimᴾ P p₀ p₁ p₀≡p₁ = λ where [0] → p₀ [1] → p₁ (0≡1ᴾ i) → p₀≡p₁ i -- A non-dependent eliminator, expressed using paths. recᴾ : (p₀ p₁ : A) → p₀ P.≡ p₁ → Interval → A recᴾ = elimᴾ _ -- An eliminator. module Elim (P : Interval → Type p) (p₀ : P [0]) (p₁ : P [1]) (p₀≡p₁ : subst P 0≡1 p₀ ≡ p₁) where -- The eliminator. elim : (x : Interval) → P x elim = elimᴾ P p₀ p₁ (I.subst≡→[]≡ p₀≡p₁) -- A "computation" rule for elim. elim-0≡1 : dcong elim 0≡1 ≡ p₀≡p₁ elim-0≡1 = I.dcong-subst≡→[]≡ (refl _) open Elim public -- A non-dependent eliminator. module Rec (p₀ p₁ : A) (p₀≡p₁ : p₀ ≡ p₁) where -- The eliminator. rec : Interval → A rec = recᴾ p₀ p₁ (_↔_.to ≡↔≡ p₀≡p₁) -- A computation rule for rec. rec-0≡1 : cong rec 0≡1 ≡ p₀≡p₁ rec-0≡1 = I.cong-≡↔≡ (refl _) open Rec public ------------------------------------------------------------------------ -- Contractibility -- The interval is contractible. interval-contractible : Contractible Interval interval-contractible = [1] , sym ∘ f where f : (x : Interval) → x ≡ [1] f = elim (_≡ [1]) 0≡1 (refl _) (subst (_≡ [1]) 0≡1 0≡1 ≡⟨ cong (λ p → subst (_≡ [1]) p 0≡1) (sym $ sym-sym 0≡1) ⟩ subst (_≡ [1]) (sym (sym 0≡1)) 0≡1 ≡⟨ subst-trans (sym 0≡1) ⟩ trans (sym 0≡1) 0≡1 ≡⟨ trans-symˡ 0≡1 ⟩∎ refl _ ∎) -- A simplification lemma for rec p p. rec-const : ∀ {p} {P : Type p} (p : P) (p≡p : p ≡ p) i → rec p p p≡p i ≡ p rec-const p p≡p i = rec p p p≡p i ≡⟨ cong (rec p p p≡p) (mono₁ 0 interval-contractible i [0]) ⟩∎ rec p p p≡p [0] ∎ ------------------------------------------------------------------------ -- Extensionality -- The definition of bad-ext has been placed in a separate abstract -- block to ensure that the definitions in the other abstract block -- below do not accidentally depend on the implementation of bad-ext. private module Separate-abstract-block where abstract -- The interval can be used to prove that equality of functions is -- extensional. -- -- The proof bad-ext is perhaps not less "good" than ext (I don't -- know), it is called this simply because it is not defined using -- good-ext. private -- ext-helper {f = f} {g = g} f≡g reduces to λ x → f x when the -- input is [0], and to λ x → g x when the input is [1]. ext-helper : ∀ {a b} {A : Type a} {B : A → Type b} {f g : (x : A) → B x} → (∀ x → f x ≡ g x) → Interval → (x : A) → B x ext-helper {f = f} {g} f≡g i = λ x → rec (f x) (g x) (f≡g x) i bad-ext : ∀ {a b} → Extensionality a b apply-ext bad-ext {f = f} {g = g} f≡g = f ≡⟨⟩ ext-helper f≡g [0] ≡⟨ cong (ext-helper f≡g) 0≡1 ⟩∎ ext-helper f≡g [1] ∎ open Separate-abstract-block public ext : ∀ {a b} → Extensionality a b ext = good-ext bad-ext ⟨ext⟩ : ∀ {a b} {A : Type a} {B : A → Type b} → Extensionality′ A B ⟨ext⟩ = apply-ext ext abstract -- The function ⟨ext⟩ is an equivalence. ext-is-equivalence : ∀ {a b} {A : Type a} {B : A → Type b} {f g : (x : A) → B x} → Is-equivalence {A = ∀ x → f x ≡ g x} ⟨ext⟩ ext-is-equivalence = good-ext-is-equivalence bad-ext -- Equality rearrangement lemmas for ⟨ext⟩. ext-refl : ∀ {a b} {A : Type a} {B : A → Type b} (f : (x : A) → B x) → ⟨ext⟩ (λ x → refl (f x)) ≡ refl f ext-refl = good-ext-refl bad-ext ext-const : ∀ {a b} {A : Type a} {B : Type b} {x y : B} (x≡y : x ≡ y) → ⟨ext⟩ (const {B = A} x≡y) ≡ cong const x≡y ext-const = good-ext-const bad-ext cong-ext : ∀ {a b} {A : Type a} {B : A → Type b} {f g : (x : A) → B x} (f≡g : ∀ x → f x ≡ g x) {x} → cong (_$ x) (⟨ext⟩ f≡g) ≡ f≡g x cong-ext = cong-good-ext bad-ext ext-cong : ∀ {a b c} {A : Type a} {B : Type b} {C : B → Type c} {f : A → (x : B) → C x} {x y : A} {x≡y : x ≡ y} → ⟨ext⟩ (λ z → cong (flip f z) x≡y) ≡ cong f x≡y ext-cong = good-ext-cong bad-ext subst-ext : ∀ {a b p} {A : Type a} {B : A → Type b} {f g : (x : A) → B x} {x} (P : B x → Type p) {p} (f≡g : ∀ x → f x ≡ g x) → subst (λ f → P (f x)) (⟨ext⟩ f≡g) p ≡ subst P (f≡g x) p subst-ext = subst-good-ext bad-ext elim-ext : ∀ {a b p} {A : Type a} {B : A → Type b} {x : A} (P : B x → B x → Type p) (p : (y : B x) → P y y) {f g : (x : A) → B x} (f≡g : ∀ x → f x ≡ g x) → D.elim (λ {f g} _ → P (f x) (g x)) (p ∘ (_$ x)) (⟨ext⟩ f≡g) ≡ D.elim (λ {x y} _ → P x y) p (f≡g x) elim-ext = elim-good-ext bad-ext -- I based the statements of the following three lemmas on code in -- the Lean Homotopy Type Theory Library with Jakob von Raumer and -- Floris van Doorn listed as authors. The file was claimed to have -- been ported from the Coq HoTT library. (The third lemma has later -- been generalised.) ext-sym : ∀ {a b} {A : Type a} {B : A → Type b} {f g : (x : A) → B x} (f≡g : ∀ x → f x ≡ g x) → ⟨ext⟩ (sym ∘ f≡g) ≡ sym (⟨ext⟩ f≡g) ext-sym = good-ext-sym bad-ext ext-trans : ∀ {a b} {A : Type a} {B : A → Type b} {f g h : (x : A) → B x} (f≡g : ∀ x → f x ≡ g x) (g≡h : ∀ x → g x ≡ h x) → ⟨ext⟩ (λ x → trans (f≡g x) (g≡h x)) ≡ trans (⟨ext⟩ f≡g) (⟨ext⟩ g≡h) ext-trans = good-ext-trans bad-ext cong-post-∘-ext : ∀ {a b c} {A : Type a} {B : A → Type b} {C : A → Type c} {f g : (x : A) → B x} {h : ∀ {x} → B x → C x} (f≡g : ∀ x → f x ≡ g x) → cong (h ∘_) (⟨ext⟩ f≡g) ≡ ⟨ext⟩ (cong h ∘ f≡g) cong-post-∘-ext {h = h} = cong-post-∘-good-ext {h = h} bad-ext bad-ext cong-pre-∘-ext : ∀ {a b c} {A : Type a} {B : Type b} {C : B → Type c} {f g : (x : B) → C x} {h : A → B} (f≡g : ∀ x → f x ≡ g x) → cong (_∘ h) (⟨ext⟩ f≡g) ≡ ⟨ext⟩ (f≡g ∘ h) cong-pre-∘-ext = cong-pre-∘-good-ext bad-ext bad-ext cong-∘-ext : {f g : B → C} (f≡g : ∀ x → f x ≡ g x) → cong {B = (A → B) → (A → C)} (λ f → f ∘_) (⟨ext⟩ f≡g) ≡ ⟨ext⟩ λ h → ⟨ext⟩ λ x → f≡g (h x) cong-∘-ext = cong-∘-good-ext bad-ext bad-ext bad-ext
{ "alphanum_fraction": 0.5007199895, "avg_line_length": 28.7180451128, "ext": "agda", "hexsha": "b34f01441aaf4189a8e0878b012cc5dc5b660b02", "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/Interval.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/Interval.agda", "max_line_length": 81, "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/Interval.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": 3060, "size": 7639 }
-- Andreas, 2017-01-26. -- The --no-eta-equality option {-# OPTIONS --no-eta-equality #-} {-# OPTIONS --allow-unsolved-metas #-} -- is only valid for the record types defined in this file. open import HaveEtaForImportedRecords.EtaRecord -- Eta holds for the imported record. test-imported : ∀{x y : ⊤} → x ≡ y test-imported = refl -- Eta does not hold for a record defined here record Unit : Set where test : Unit test = _ -- Should be yellow!
{ "alphanum_fraction": 0.6850220264, "avg_line_length": 20.6363636364, "ext": "agda", "hexsha": "c4b6a7bc9881785607fad8b01042662b11d315b6", "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/HaveEtaForImportedRecords.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/HaveEtaForImportedRecords.agda", "max_line_length": 59, "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/HaveEtaForImportedRecords.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": 129, "size": 454 }
------------------------------------------------------------------------ -- INCREMENTAL λ-CALCULUS -- -- Correctness of differentiation (Lemma 3.10 and Theorem 3.11). ------------------------------------------------------------------------ import Parametric.Syntax.Type as Type import Parametric.Syntax.Term as Term import Parametric.Denotation.Value as Value import Parametric.Denotation.Evaluation as Evaluation import Parametric.Change.Validity as Validity import Parametric.Change.Specification as Specification import Parametric.Change.Type as ChangeType import Parametric.Change.Term as ChangeTerm import Parametric.Change.Value as ChangeValue import Parametric.Change.Evaluation as ChangeEvaluation import Parametric.Change.Derive as Derive import Parametric.Change.Implementation as Implementation module Parametric.Change.Correctness {Base : Type.Structure} (Const : Term.Structure Base) (⟦_⟧Base : Value.Structure Base) (⟦_⟧Const : Evaluation.Structure Const ⟦_⟧Base) (ΔBase : ChangeType.Structure Base) (apply-base : ChangeTerm.ApplyStructure Const ΔBase) (diff-base : ChangeTerm.DiffStructure Const ΔBase) (nil-base : ChangeTerm.NilStructure Const ΔBase) (⟦apply-base⟧ : ChangeValue.ApplyStructure Const ⟦_⟧Base ΔBase) (⟦diff-base⟧ : ChangeValue.DiffStructure Const ⟦_⟧Base ΔBase) (⟦nil-base⟧ : ChangeValue.NilStructure Const ⟦_⟧Base ΔBase) (meaning-⊕-base : ChangeEvaluation.ApplyStructure ⟦_⟧Base ⟦_⟧Const ΔBase apply-base diff-base nil-base ⟦apply-base⟧ ⟦diff-base⟧ ⟦nil-base⟧) (meaning-⊝-base : ChangeEvaluation.DiffStructure ⟦_⟧Base ⟦_⟧Const ΔBase apply-base diff-base nil-base ⟦apply-base⟧ ⟦diff-base⟧ ⟦nil-base⟧) (meaning-onil-base : ChangeEvaluation.NilStructure ⟦_⟧Base ⟦_⟧Const ΔBase apply-base diff-base nil-base ⟦apply-base⟧ ⟦diff-base⟧ ⟦nil-base⟧) {{validity-structure : Validity.Structure ⟦_⟧Base}} (derive-const : Derive.Structure Const ΔBase) (implementation-structure : Implementation.Structure Const ⟦_⟧Base ⟦_⟧Const ΔBase ⟦apply-base⟧ ⟦diff-base⟧ ⟦nil-base⟧ derive-const) where open Type.Structure Base open Term.Structure Base Const open Value.Structure Base ⟦_⟧Base open Evaluation.Structure Const ⟦_⟧Base ⟦_⟧Const open Validity.Structure ⟦_⟧Base {{validity-structure}} open Specification.Structure Const ⟦_⟧Base ⟦_⟧Const open ChangeType.Structure Base ΔBase open ChangeTerm.Structure Const ΔBase apply-base diff-base nil-base open ChangeValue.Structure Const ⟦_⟧Base ΔBase ⟦apply-base⟧ ⟦diff-base⟧ ⟦nil-base⟧ open ChangeEvaluation.Structure ⟦_⟧Base ⟦_⟧Const ΔBase apply-base diff-base nil-base ⟦apply-base⟧ ⟦diff-base⟧ ⟦nil-base⟧ meaning-⊕-base meaning-⊝-base meaning-onil-base open Derive.Structure Const ΔBase derive-const open Implementation.Structure implementation-structure -- The denotational properties of the `derive` transformation. -- In particular, the main theorem about it producing the correct -- incremental behavior. open import Base.Denotation.Notation open import Relation.Binary.PropositionalEquality open import Postulate.Extensionality -- Extension point: A proof that change evaluation for a -- primitive is related to the value of incrementalizing -- this primitive. Structure : Set Structure = ∀ {τ} (c : Const τ) → nil₍ τ ₎ ⟦ c ⟧Const ≈₍ τ ₎ ⟦ derive-const c ⟧Term ∅ module Structure (derive-const-correct : Structure) where deriveVar-correct : ∀ {τ Γ} (x : Var Γ τ) (ρ : ⟦ Γ ⟧) (dρ : Δ₍ Γ ₎ ρ) (ρ′ : ⟦ mapContext ΔType Γ ⟧) (dρ≈ρ′ : implements-env Γ dρ ρ′) → ⟦ x ⟧ΔVar ρ dρ ≈₍ τ ₎ ⟦ deriveVar x ⟧ (alternate ρ ρ′) deriveVar-correct this (v • ρ) (dv • dρ) (dv′ • dρ′) (dv≈dv′ • dρ≈dρ′) = dv≈dv′ deriveVar-correct (that x) (v • ρ) (dv • dρ) (dv′ • dρ′) (dv≈dv′ • dρ≈dρ′) = deriveVar-correct x ρ dρ dρ′ dρ≈dρ′ derive-const-env-irrelevant : ∀ {Γ τ} (c : Const τ) → (ρ : ⟦ ΔContext Γ ⟧) → ⟦ weaken ∅≼Γ (derive-const c) ⟧Term ρ ≡ ⟦ derive-const c ⟧Term ∅ derive-const-env-irrelevant {Γ} c ρ = trans (weaken-sound {Γ₁≼Γ₂ = (∅≼Γ {ΔContext Γ})} (derive-const c) ρ) (cong ⟦ derive-const c ⟧Term (⟦∅≼Γ⟧-∅ ρ)) -- We provide: A variant of Lemma 3.10 for arbitrary contexts. derive-correct : ∀ {τ Γ} (t : Term Γ τ) (ρ : ⟦ Γ ⟧) (dρ : Δ₍ Γ ₎ ρ) (ρ′ : ⟦ mapContext ΔType Γ ⟧) (dρ≈ρ′ : implements-env Γ dρ ρ′) → ⟦ t ⟧Δ ρ dρ ≈₍ τ ₎ ⟦ derive t ⟧ (alternate ρ ρ′) derive-correct {τ} {Γ} (const c) ρ dρ ρ′ dρ≈ρ′ = subst (implements τ (nil₍ τ ₎ ⟦ c ⟧Const)) (sym (derive-const-env-irrelevant c (alternate ρ ρ′))) (derive-const-correct c) derive-correct (var x) ρ dρ ρ′ dρ≈ρ′ = deriveVar-correct x ρ dρ ρ′ dρ≈ρ′ derive-correct (app {σ} {τ} s t) ρ dρ ρ′ dρ≈ρ′ = subst (λ ⟦t⟧ → ⟦ app s t ⟧Δ ρ dρ ≈₍ τ ₎ (⟦ derive s ⟧Term (alternate ρ ρ′)) ⟦t⟧ (⟦ derive t ⟧Term (alternate ρ ρ′))) (⟦fit⟧ t ρ ρ′) (derive-correct {σ ⇒ τ} s ρ dρ ρ′ dρ≈ρ′ (⟦ t ⟧ ρ) (⟦ t ⟧Δ ρ dρ) (⟦ derive t ⟧ (alternate ρ ρ′)) (derive-correct {σ} t ρ dρ ρ′ dρ≈ρ′)) derive-correct (abs {σ} {τ} t) ρ dρ ρ′ dρ≈ρ′ = λ w dw w′ dw≈w′ → derive-correct t (w • ρ) (dw • dρ) (w′ • ρ′) (dw≈w′ • dρ≈ρ′) derive-correct-closed : ∀ {τ} (t : Term ∅ τ) → ⟦ t ⟧Δ ∅ ∅ ≈₍ τ ₎ ⟦ derive t ⟧ ∅ derive-correct-closed t = derive-correct t ∅ ∅ ∅ ∅ -- And we proof Theorem 3.11, finally. main-theorem : ∀ {σ τ} {f : Term ∅ (σ ⇒ τ)} {s : Term ∅ σ} {ds : Term ∅ (ΔType σ)} → {dv : Δ₍ σ ₎ (⟦ s ⟧ ∅)} {erasure : dv ≈₍ σ ₎ (⟦ ds ⟧ ∅)} → ⟦ app f (s ⊕₍ σ ₎ ds) ⟧ ≡ ⟦ app f s ⊕₍ τ ₎ app (app (derive f) s) ds ⟧ main-theorem {σ} {τ} {f} {s} {ds} {dv} {erasure} = let g = ⟦ f ⟧ ∅ Δg = ⟦ f ⟧Δ ∅ ∅ Δg′ = ⟦ derive f ⟧ ∅ v = ⟦ s ⟧ ∅ dv′ = ⟦ ds ⟧ ∅ u = ⟦ s ⊕₍ σ ₎ ds ⟧ ∅ -- Δoutput-term = app (app (derive f) x) (y ⊝ x) in ext {A = ⟦ ∅ ⟧Context} (λ { ∅ → begin g u ≡⟨ cong g (sym (meaning-⊕ {t = s} {Δt = ds})) ⟩ g (v ⟦⊕₍ σ ₎⟧ dv′) ≡⟨ cong g (sym (carry-over {σ} dv erasure)) ⟩ g (v ⊞₍ σ ₎ dv) ≡⟨ corollary-closed {σ} {τ} f v dv ⟩ g v ⊞₍ τ ₎ call-change {σ} {τ} Δg v dv ≡⟨ carry-over {τ} (call-change {σ} {τ} Δg v dv) (derive-correct-closed f v dv dv′ erasure) ⟩ g v ⟦⊕₍ τ ₎⟧ Δg′ v dv′ ≡⟨ meaning-⊕ {t = app f s} {Δt = app (app (derive f) s) ds} ⟩ ⟦ app f s ⊕₍ τ ₎ app (app (derive f) s) ds ⟧ ∅ ∎}) where open ≡-Reasoning
{ "alphanum_fraction": 0.6119706204, "avg_line_length": 43.8287671233, "ext": "agda", "hexsha": "bce94e2e7c31f3e5b226c015df22ef10d941bd05", "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": "Parametric/Change/Correctness.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": "Parametric/Change/Correctness.agda", "max_line_length": 136, "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": "Parametric/Change/Correctness.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": 2509, "size": 6399 }
module Data.Nat.Properties.Extra where open import Data.Nat open import Data.Product open import Data.Nat.Properties open import Data.Nat.Properties.Simple open import Function open import Level using () open import Relation.Binary open import Relation.Binary.Core open import Relation.Nullary.Negation open import Relation.Nullary -- open import Relation.Nullary.Decidable open import Relation.Binary.PropositionalEquality hiding (isPreorder) open ≡-Reasoning open ≤-Reasoning renaming (begin_ to start_; _∎ to _□; _≡⟨_⟩_ to _≈⟨_⟩_) open DecTotalOrder decTotalOrder using (reflexive) renaming (refl to ≤-refl) ------------------------------------------------------------------------ -- Misc ------------------------------------------------------------------------ isDecTotalOrder : IsDecTotalOrder {A = ℕ} _≡_ _≤_ isDecTotalOrder = DecTotalOrder.isDecTotalOrder decTotalOrder isTotalOrder : IsTotalOrder {A = ℕ} _≡_ _≤_ isTotalOrder = IsDecTotalOrder.isTotalOrder isDecTotalOrder isPartialOrder : IsPartialOrder {A = ℕ} _≡_ _≤_ isPartialOrder = IsTotalOrder.isPartialOrder isTotalOrder isPreorder : IsPreorder {A = ℕ} _≡_ _≤_ isPreorder = IsPartialOrder.isPreorder isPartialOrder open import Algebra.Structures import Algebra.FunctionProperties as P; open P (_≡_ {A = ℕ}) isSemiringWithoutOne : IsSemiringWithoutOne _≡_ _⊔_ _⊓_ zero isSemiringWithoutOne = IsCommutativeSemiringWithoutOne.isSemiringWithoutOne ⊔-⊓-0-isCommutativeSemiringWithoutOne +-isCommutativeMonoid : IsCommutativeMonoid _≡_ _⊔_ zero +-isCommutativeMonoid = IsSemiringWithoutOne.+-isCommutativeMonoid isSemiringWithoutOne cmp : Trichotomous _≡_ _<_ cmp = StrictTotalOrder.compare strictTotalOrder ⊓-comm : Commutative _⊓_ ⊓-comm = IsCommutativeSemiringWithoutOne.*-comm ⊔-⊓-0-isCommutativeSemiringWithoutOne ⊔-comm : Commutative _⊔_ ⊔-comm = IsCommutativeMonoid.comm +-isCommutativeMonoid ------------------------------------------------------------------------ -- Equational ------------------------------------------------------------------------ -- ℕ cancel-suc : ∀ {x y} → suc x ≡ suc y → x ≡ y cancel-suc {x} {.x} refl = refl -- cancel-suc : ∀ {x y} → suc x ≡ suc y → x ≡ y -- cancel-suc {x} {.x} refl = refl -- _+_ [a+b]+c≡[a+c]+b : ∀ a b c → a + b + c ≡ a + c + b [a+b]+c≡[a+c]+b a b c = begin a + b + c ≡⟨ +-assoc a b c ⟩ a + (b + c) ≡⟨ cong (λ x → a + x) (+-comm b c) ⟩ a + (c + b) ≡⟨ sym (+-assoc a c b) ⟩ a + c + b ∎ a+[b+c]≡b+[a+c] : ∀ a b c → a + (b + c) ≡ b + (a + c) a+[b+c]≡b+[a+c] a b c = begin a + (b + c) ≡⟨ sym (+-assoc a b c) ⟩ a + b + c ≡⟨ cong (λ x → x + c) (+-comm a b) ⟩ b + a + c ≡⟨ +-assoc b a c ⟩ b + (a + c) ∎ cancel-+-right : ∀ k {i j} → i + k ≡ j + k → i ≡ j cancel-+-right zero {i} {j} p = begin i ≡⟨ sym (+-right-identity i) ⟩ i + zero ≡⟨ p ⟩ j + zero ≡⟨ +-right-identity j ⟩ j ∎ cancel-+-right (suc k) {i} {j} p = cancel-+-right k lemma where lemma : i + k ≡ j + k lemma = cancel-suc $ begin suc (i + k) ≡⟨ sym (+-suc i k) ⟩ i + suc k ≡⟨ p ⟩ j + suc k ≡⟨ +-suc j k ⟩ suc (j + k) ∎ -- _*_ *-right-identity : ∀ n → n * 1 ≡ n *-right-identity zero = refl *-right-identity (suc n) = cong suc (*-right-identity n) *-left-identity : ∀ n → 1 * n ≡ n *-left-identity zero = refl *-left-identity (suc n) = cong suc (*-left-identity n) distrib-left-*-+ : ∀ m n o → m * (n + o) ≡ m * n + m * o distrib-left-*-+ m n o = begin m * (n + o) ≡⟨ *-comm m (n + o) ⟩ (n + o) * m ≡⟨ distribʳ-*-+ m n o ⟩ n * m + o * m ≡⟨ cong₂ _+_ (*-comm n m) (*-comm o m) ⟩ m * n + m * o ∎ -- _∸_ m∸n+n≡m : ∀ {m n} → n ≤ m → m ∸ n + n ≡ m m∸n+n≡m {m} {n} n≤m = begin m ∸ n + n ≡⟨ +-comm (m ∸ n) n ⟩ n + (m ∸ n) ≡⟨ m+n∸m≡n n≤m ⟩ m ∎ m∸[o∸n]+o≡m+n : ∀ m n o → n ≤ o → o ∸ n ≤ m → m ∸ ( o ∸ n ) + o ≡ m + n m∸[o∸n]+o≡m+n m n o n≤o o∸n≤m = begin m ∸ (o ∸ n) + o ≡⟨ +-comm (m ∸ (o ∸ n)) o ⟩ o + (m ∸ (o ∸ n)) ≡⟨ cong (λ x → x + (m ∸ (o ∸ n))) (sym (m+n∸m≡n {n} {o} n≤o)) ⟩ (n + (o ∸ n)) + (m ∸ (o ∸ n)) ≡⟨ +-assoc n (o ∸ n) (m ∸ (o ∸ n)) ⟩ n + ((o ∸ n) + (m ∸ (o ∸ n))) ≡⟨ cong (λ w → n + w) (m+n∸m≡n {o ∸ n} o∸n≤m) ⟩ n + m ≡⟨ +-comm n m ⟩ m + n ∎ ------------------------------------------------------------------------ -- Relational ------------------------------------------------------------------------ -- _≤_ ≤-trans : Transitive _≤_ ≤-trans = IsPreorder.trans isPreorder <⇒≤ : _<_ ⇒ _≤_ <⇒≤ {zero} p = z≤n <⇒≤ {suc i} (s≤s p) = s≤s (<⇒≤ p) >⇒≰ : _>_ ⇒ _≰_ >⇒≰ {zero} () q >⇒≰ {suc m} (s≤s p) (s≤s q) = >⇒≰ p q ≤⇒≯ : _≤_ ⇒ _≯_ ≤⇒≯ {zero} p () ≤⇒≯ {suc m} (s≤s p) (s≤s q) = ≤⇒≯ p q <⇒≱ : _<_ ⇒ _≱_ <⇒≱ {zero} () z≤n <⇒≱ {suc i} (s≤s p) (s≤s q) = <⇒≱ p q >⇒≢ : _>_ ⇒ _≢_ >⇒≢ {zero} () refl >⇒≢ {suc m} (s≤s m>n) refl = >⇒≢ m>n refl ≥⇒≮ : _≥_ ⇒ _≮_ ≥⇒≮ z≤n () ≥⇒≮ (s≤s m) (s≤s p) = ≥⇒≮ m p <⇒≢ : _<_ ⇒ _≢_ <⇒≢ {zero} () refl <⇒≢ {suc m} (s≤s m<n) refl = <⇒≢ m<n refl ≤∧≢⇒< : ∀ {m n} → m ≤ n → m ≢ n → m < n ≤∧≢⇒< {zero} {zero} p q = contradiction refl q ≤∧≢⇒< {zero} {suc n} p q = s≤s z≤n ≤∧≢⇒< {suc m} {zero} () q ≤∧≢⇒< {suc m} {suc n} (s≤s p) q = s≤s (≤∧≢⇒< p (q ∘ cong suc)) ≥∧≢⇒> : ∀ {m n} → m ≥ n → m ≢ n → m > n ≥∧≢⇒> {zero} {zero} p q = contradiction refl q ≥∧≢⇒> {zero} {suc n} () q ≥∧≢⇒> {suc m} {zero} p q = s≤s z≤n ≥∧≢⇒> {suc m} {suc n} (s≤s p) q = s≤s (≥∧≢⇒> p (q ∘ cong suc)) ≤0⇒≡0 : ∀ n → n ≤ 0 → n ≡ 0 ≤0⇒≡0 zero n≤0 = refl ≤0⇒≡0 (suc n) () -- ≤-suc : ∀ {m n} → m ≤ n → suc m ≤ suc n -- ≤-suc z≤n = s≤s z≤n -- ≤-suc (s≤s rel) = s≤s (s≤s rel) -- i*j>0⇒i>0∧j>0 : ∀ i j → i * j > 0 → (i > 0 × j > 0) -- i*j>0⇒i>0∧j>0 zero j () -- i*j>0⇒i>0∧j>0 (suc i) zero p = contradiction (proj₂ (i*j>0⇒i>0∧j>0 i 0 p)) (λ ()) -- i*j>0⇒i>0∧j>0 (suc i) (suc j) p = s≤s z≤n , s≤s z≤n -- _+_ -- m≡n+o⇒m≥o : ∀ {m} {o} n → m ≡ n + o → m ≥ o -- m≡n+o⇒m≥o {.(n + o)} {o} n refl = n≤m+n o n n+-mono : ∀ n → (λ x → n + x) Preserves _≤_ ⟶ _≤_ n+-mono n = _+-mono_ {n} {n} ≤-refl n+-mono-inverse : ∀ n → ∀ {a b} → n + a ≤ n + b → a ≤ b n+-mono-inverse zero a≤b = a≤b n+-mono-inverse (suc n) (s≤s a≤b) = n+-mono-inverse n a≤b +n-mono : ∀ n → (λ x → x + n) Preserves _≤_ ⟶ _≤_ +n-mono n {a} {b} a≤b = _+-mono_ {a} {b} {n} {n} a≤b ≤-refl +n-mono-inverse : ∀ n → ∀ {a b} → a + n ≤ b + n → a ≤ b +n-mono-inverse zero {a} {b} p = start a ≈⟨ sym (+-right-identity a) ⟩ a + 0 ≤⟨ p ⟩ b + 0 ≈⟨ +-right-identity b ⟩ b □ +n-mono-inverse (suc n) {a} {b} p = +n-mono-inverse n p' where p' : a + n ≤ b + n p' = ≤-pred $ start suc (a + n) ≈⟨ sym (+-suc a n) ⟩ a + suc n ≤⟨ p ⟩ b + suc n ≈⟨ +-suc b n ⟩ suc (b + n) □ +-mono-contra : ∀ {a b c d} → a ≥ b → a + c < b + d → c < d +-mono-contra {zero} {zero} p q = q +-mono-contra {zero} {suc b} () q +-mono-contra {suc a} {zero} {c} {d} p q = start suc c ≤⟨ n≤m+n (suc a) (suc c) ⟩ suc a + suc c ≈⟨ +-suc (suc a) c ⟩ suc (suc a) + c ≤⟨ q ⟩ d □ +-mono-contra {suc a} {suc b} (s≤s p) (s≤s q) = +-mono-contra p q -- _∸_ ∸n-mono : ∀ n → (λ x → x ∸ n) Preserves _≤_ ⟶ _≤_ ∸n-mono n {a} {b} a≤b = ∸-mono {a} {b} {n} {n} a≤b ≤-refl ∸n-mono-inverse : ∀ n → ∀ {a b} → a > n → a ∸ n ≤ b ∸ n → a ≤ b ∸n-mono-inverse zero p q = q ∸n-mono-inverse (suc n) {zero} {zero} p q = q ∸n-mono-inverse (suc n) {zero} {suc b} p q = z≤n ∸n-mono-inverse (suc n) {suc a} {zero} p q = contradiction (≤-pred p) (≤⇒≯ q') where q' : a ≤ n q' = ∸n-mono-inverse n (≤-pred p) $ start a ∸ n ≤⟨ q ⟩ zero ≈⟨ sym (n∸n≡0 n) ⟩ n ∸ n □ ∸n-mono-inverse (suc n) {suc a} {suc b} p q = s≤s (∸n-mono-inverse n (≤-pred p) q) n∸-mono : ∀ n → (λ x → n ∸ x) Preserves _≥_ ⟶ _≤_ n∸-mono n {a} {b} a≥b = ∸-mono {n} {n} {a} {b} ≤-refl a≥b m≥n+o⇒m∸o≥n : ∀ m n o → m ≥ n + o → m ∸ o ≥ n m≥n+o⇒m∸o≥n m n o p = start n ≈⟨ sym (m+n∸n≡m n o) ⟩ n + o ∸ o ≤⟨ ∸-mono {n + o} {m} {o} p ≤-refl ⟩ m ∸ o □ cancel-∸-right : ∀ {m n} o → m ≥ o → n ≥ o → m ∸ o ≡ n ∸ o → m ≡ n cancel-∸-right zero p q eq = eq cancel-∸-right {zero} (suc o) () q eq cancel-∸-right {suc m} {zero} (suc o) p () eq cancel-∸-right {suc m} {suc n} (suc o) p q eq = cong suc (cancel-∸-right o (≤-pred p) (≤-pred q) eq) -- _*_ n*-mono : ∀ n → (λ x → n * x) Preserves _≤_ ⟶ _≤_ n*-mono n = _*-mono_ {n} {n} ≤-refl n*-mono-strict-inverse : ∀ n {a} {b} → n * a < n * b → a < b n*-mono-strict-inverse zero () n*-mono-strict-inverse (suc n) {a} {b} p with suc a ≤? b n*-mono-strict-inverse (suc n) {a} {b} p | yes q = q n*-mono-strict-inverse (suc n) {a} {b} p | no ¬q = contradiction p ¬p where ¬q' : b ≤ a ¬q' = ≤-pred (≰⇒> ¬q) ¬p : suc (suc n * a) ≰ suc n * b ¬p = >⇒≰ (s≤s (n*-mono (suc n) ¬q')) *n-mono : ∀ n → (λ x → x * n) Preserves _≤_ ⟶ _≤_ *n-mono n {a} {b} a≤b = _*-mono_ {a} {b} {n} {n} a≤b ≤-refl *-comm-mono : ∀ {a b c d} → a * b ≤ c * d → b * a ≤ d * c *-comm-mono {a} {b} {c} {d} p = start b * a ≈⟨ *-comm b a ⟩ a * b ≤⟨ p ⟩ c * d ≈⟨ *-comm c d ⟩ d * c □ *-comm-mono-strict : ∀ {a b c d} → a * b < c * d → b * a < d * c *-comm-mono-strict {a} {b} {c} {d} p = start suc (b * a) ≈⟨ cong suc (*-comm b a) ⟩ suc (a * b) ≤⟨ p ⟩ c * d ≈⟨ *-comm c d ⟩ d * c □ *n-mono-inverse : ∀ n {a} {b} → a * (suc n) ≤ b * (suc n) → a ≤ b *n-mono-inverse n {zero} p = z≤n *n-mono-inverse n {suc a} {zero} () *n-mono-inverse n {suc a} {suc b} (s≤s p) = s≤s (*n-mono-inverse n (n+-mono-inverse n p)) *n-mono-strict-inverse : ∀ n {a} {b} → a * n < b * n → a < b *n-mono-strict-inverse n {a} {b} p = n*-mono-strict-inverse n (*-comm-mono-strict {a} {n} {b} {n} p) m≤m*1+n : ∀ m n → m ≤ m * suc n m≤m*1+n m zero = reflexive (sym (*-right-identity m)) m≤m*1+n m (suc n) = start m ≤⟨ m≤m+n m (m * suc n) ⟩ m + m * suc n ≈⟨ sym (+-*-suc m (suc n)) ⟩ m * suc (suc n) □ -- _⊔_ m≤n⊔m : ∀ m n → m ≤ n ⊔ m m≤n⊔m zero n = z≤n m≤n⊔m (suc m) zero = s≤s (m≤n⊔m m zero) m≤n⊔m (suc m) (suc n) = s≤s (m≤n⊔m m n) m⊓n≤n : ∀ m n → m ⊓ n ≤ n m⊓n≤n zero n = z≤n m⊓n≤n (suc m) zero = z≤n m⊓n≤n (suc m) (suc n) = s≤s (m⊓n≤n m n) ⊔-upper-bound : ∀ m n o → m + n ≥ o → o ⊔ n ≤ m + n ⊔-upper-bound zero zero zero p = p ⊔-upper-bound zero zero (suc o) () ⊔-upper-bound zero (suc n) zero p = s≤s (⊔-upper-bound zero n zero z≤n) ⊔-upper-bound zero (suc n) (suc o) p = s≤s (⊔-upper-bound zero n o (≤-pred p)) ⊔-upper-bound (suc m) zero zero p = p ⊔-upper-bound (suc m) zero (suc o) p = p ⊔-upper-bound (suc m) (suc n) zero p = start suc n ≤⟨ s≤s (≤-step ≤-refl) ⟩ suc (suc n) ≤⟨ s≤s (n≤m+n m (suc n)) ⟩ suc (m + suc n) □ ⊔-upper-bound (suc m) (suc n) (suc o) p = start suc (o ⊔ n) ≤⟨ s≤s (⊔-upper-bound (suc m) n o $ start o ≤⟨ ≤-pred p ⟩ m + suc n ≈⟨ +-suc m n ⟩ suc (m + n) □ ) ⟩ suc (suc (m + n)) ≈⟨ cong suc (sym (+-suc m n)) ⟩ suc (m + suc n) □ m⊔n≤m+n : ∀ m n → m ⊔ n ≤ m + n m⊔n≤m+n zero n = ≤-refl m⊔n≤m+n (suc m) zero = s≤s (m≤m+n m zero) m⊔n≤m+n (suc m) (suc n) = s≤s $ start m ⊔ n ≤⟨ m⊔n≤m+n m n ⟩ m + n ≤⟨ n+-mono m (n≤m+n 1 n) ⟩ m + suc n □ -- double : ∀ m → m + m ≡ m * 2 -- double m = -- begin -- m + m -- ≡⟨ cong (λ w → m + w) (sym (+-right-identity m)) ⟩ -- m + (m + zero) -- ≡⟨ *-comm (suc (suc zero)) m ⟩ -- m * suc (suc zero) -- ∎ -- cancel-∸-right-inverse : ∀ m n o → n ≥ o → m + o ≡ n → m ≡ n ∸ o -- cancel-∸-right-inverse m n zero p eq = -- begin -- m -- ≡⟨ sym (+-right-identity m) ⟩ -- m + 0 -- ≡⟨ eq ⟩ -- n -- ∎ -- cancel-∸-right-inverse m zero (suc o) () eq -- cancel-∸-right-inverse m (suc n) (suc o) p eq = -- begin -- m -- ≡⟨ cancel-∸-right-inverse m n o (≤-pred p) $ cancel-+-left 1 $ -- begin -- suc m + o -- ≡⟨ sym (+-suc m o) ⟩ -- m + suc o -- ≡⟨ eq ⟩ -- suc n -- ∎ -- ⟩ -- n ∸ o -- ∎
{ "alphanum_fraction": 0.4241977988, "avg_line_length": 26.9352818372, "ext": "agda", "hexsha": "a7fc225938e5da735d88d0aeb74c2caa1ac198fe", "lang": "Agda", "max_forks_count": 1, "max_forks_repo_forks_event_max_datetime": "2015-05-30T05:50:50.000Z", "max_forks_repo_forks_event_min_datetime": "2015-05-30T05:50:50.000Z", "max_forks_repo_head_hexsha": "aae093cc9bf21f11064e7f7b12049448cd6449f1", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "banacorn/numeral", "max_forks_repo_path": "Data/Nat/Properties/Extra.agda", "max_issues_count": null, "max_issues_repo_head_hexsha": "aae093cc9bf21f11064e7f7b12049448cd6449f1", "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": "banacorn/numeral", "max_issues_repo_path": "Data/Nat/Properties/Extra.agda", "max_line_length": 113, "max_stars_count": 1, "max_stars_repo_head_hexsha": "aae093cc9bf21f11064e7f7b12049448cd6449f1", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "banacorn/numeral", "max_stars_repo_path": "Data/Nat/Properties/Extra.agda", "max_stars_repo_stars_event_max_datetime": "2015-04-23T15:58:28.000Z", "max_stars_repo_stars_event_min_datetime": "2015-04-23T15:58:28.000Z", "num_tokens": 6177, "size": 12902 }
open import Data.List using () renaming ( List to ♭List ; [] to []♭ ; _∷_ to _∷♭_ ; _++_ to _++♭_ ; length to length♭ ; map to ♭map ) open import Data.Maybe using ( Maybe ; just ; nothing ) open import Data.Nat using ( zero ; suc ) renaming ( _+_ to _+♭_ ) open import Function using () renaming ( _∘′_ to _∘_ ) open import Relation.Binary.PropositionalEquality using ( _≡_ ; refl ; sym ; subst ; cong ; cong₂ ) open import AssocFree.Util using ( ≡-relevant ) renaming ( lookup to lookup♭ ) open import AssocFree.DNat using ( ℕ ; ♯0 ; _+_ ; iso-resp-+ ) renaming ( ♭ to ♭ⁿ ; ♯ to ♯ⁿ ; iso to isoⁿ ; iso⁻¹ to isoⁿ⁻¹ ) module AssocFree.DList where open Relation.Binary.PropositionalEquality.≡-Reasoning using ( begin_ ; _≡⟨_⟩_ ; _∎ ) infixr 4 _++_ infixl 3 _≪_ infixr 2 _≫_ cat : ∀ {A : Set} → ♭List A → ♭List A → ♭List A cat = _++♭_ cat-assoc : ∀ {A} (as bs : ♭List A) → (cat (cat as bs) ≡ ((cat as) ∘ (cat bs))) cat-assoc []♭ bs = refl cat-assoc (a ∷♭ as) bs = cong (_∘_ (_∷♭_ a)) (cat-assoc as bs) cat-unit : ∀ {A} (as : ♭List A) → cat as []♭ ≡ as cat-unit []♭ = refl cat-unit (a ∷♭ as) = cong (_∷♭_ a) (cat-unit as) -- List A is isomorphic to ♭List A, but has associativity of concatenation -- up to beta reduction, not just up to propositional equality. -- We keep track of the length explicitly to ensure that length is a monoid -- homomorphism up to beta-reduction, not just up to ≡. record List (A : Set) : Set where constructor list field length : ℕ fun : ♭List A → ♭List A .length✓ : length ≡ ♯ⁿ (length♭ (fun []♭)) .fun✓ : fun ≡ cat (fun []♭) open List public -- Convert any ♭List into a List and back ♯ : ∀ {A} → ♭List A → List A ♯ as = list (♯ⁿ (length♭ as)) (cat as) (cong (♯ⁿ ∘ length♭) (sym (cat-unit as))) (cong cat (sym (cat-unit as))) ♭ : ∀ {A} → List A → ♭List A ♭ (list n f n✓ f✓) = f []♭ -- Map map : ∀ {A B} → (A → B) → List A → List B map f as = ♯ (♭map f (♭ as)) -- Empty list [] : ∀ {A} → List A [] = ♯ []♭ -- Singleton [_] : ∀ {A} → A → List A [ a ] = ♯ (a ∷♭ []♭) -- Concatenation length♭-resp-++ : ∀ {A : Set} (as bs : ♭List A) → length♭ (as ++♭ bs) ≡ (length♭ as +♭ length♭ bs) length♭-resp-++ []♭ bs = refl length♭-resp-++ (a ∷♭ as) bs = cong (_+♭_ 1) (length♭-resp-++ as bs) _++_ : ∀ {A} → List A → List A → List A list m f m✓ f✓ ++ list n g n✓ g✓ = list (m + n) (f ∘ g) m+n✓ f∘g✓ where .m+n✓ : (m + n) ≡ ♯ⁿ (length♭ (f (g []♭))) m+n✓ = begin m + n ≡⟨ cong₂ _+_ m✓ n✓ ⟩ ♯ⁿ (length♭ (f []♭)) + ♯ⁿ (length♭ (g []♭)) ≡⟨ sym (isoⁿ (♯ⁿ (length♭ (f []♭)) + ♯ⁿ (length♭ (g []♭)))) ⟩ ♯ⁿ (♭ⁿ (♯ⁿ (length♭ (f []♭)) + ♯ⁿ (length♭ (g []♭)))) ≡⟨ cong ♯ⁿ (iso-resp-+ (♯ⁿ (length♭ (f []♭))) (♯ⁿ (length♭ (g []♭)))) ⟩ ♯ⁿ (♭ⁿ (♯ⁿ (length♭ (f []♭))) +♭ ♭ⁿ (♯ⁿ (length♭ (g []♭)))) ≡⟨ cong ♯ⁿ (cong₂ _+♭_ (isoⁿ⁻¹ (length♭ (f []♭))) (isoⁿ⁻¹ (length♭ (g []♭)))) ⟩ ♯ⁿ (length♭ (f []♭) +♭ length♭ (g []♭)) ≡⟨ cong ♯ⁿ (sym (length♭-resp-++ (f []♭) (g []♭))) ⟩ ♯ⁿ (length♭ (f []♭ ++♭ g []♭)) ≡⟨ cong (λ X → ♯ⁿ (length♭ (X (g []♭)))) (sym f✓) ⟩ ♯ⁿ (length♭ (f (g []♭))) ∎ .f∘g✓ : (f ∘ g) ≡ cat (f (g []♭)) f∘g✓ = begin f ∘ g ≡⟨ cong₂ _∘_ f✓ g✓ ⟩ cat (f []♭) ∘ cat (g []♭) ≡⟨ sym (cat-assoc (f []♭) (g []♭)) ⟩ cat (f []♭ ++♭ g []♭) ≡⟨ cong (λ X → cat (X (g []♭))) (sym f✓) ⟩ cat (f (g []♭)) ∎ -- Cons _∷_ : ∀ {A} → A → List A → List A a ∷ as = [ a ] ++ as -- Ismorphism between List and ♭List which respects ++ and length inject : ∀ {A} (as bs : List A) → (length as ≡ length bs) → (fun as ≡ fun bs) → (as ≡ bs) inject (list m f m✓ f✓) (list .m .f n✓ g✓) refl refl = refl iso : ∀ {A} (as : List A) → ♯ (♭ as) ≡ as iso as = inject (♯ (♭ as)) as (sym (≡-relevant (length✓ as))) (sym (≡-relevant (fun✓ as))) iso⁻¹ : ∀ {A} (as : ♭List A) → ♭ (♯ as) ≡ as iso⁻¹ = cat-unit iso-resp-++ : ∀ {A} (as bs : List A) → ♭ (as ++ bs) ≡ (♭ as ++♭ ♭ bs) iso-resp-++ (list m f m✓ f✓) (list n g n✓ g✓) = cong (λ X → X (g []♭)) (≡-relevant f✓) iso-resp-length : ∀ {A} (as : List A) → ♭ⁿ (length as) ≡ length♭ (♭ as) iso-resp-length as = begin ♭ⁿ (length as) ≡⟨ cong (♭ⁿ ∘ length) (sym (iso as)) ⟩ ♭ⁿ (♯ⁿ (length♭ (♭ as))) ≡⟨ isoⁿ⁻¹ (length♭ (♭ as)) ⟩ length♭ (♭ as) ∎ -- Associtivity and units on the nose ++-assoc : ∀ {A} (as bs cs : List A) → ((as ++ bs) ++ cs) ≡ (as ++ (bs ++ cs)) ++-assoc as bs cs = refl ++-unit₁ : ∀ {A} (as : List A) → (([] ++ as) ≡ as) ++-unit₁ as = refl ++-unit₂ : ∀ {A} (as : List A) → ((as ++ []) ≡ as) ++-unit₂ as = refl -- Length is a monoid homomorphism on the nose length-resp-++ : ∀ {A} (as bs : List A) → (length (as ++ bs) ≡ (length as + length bs)) length-resp-++ as bs = refl length-resp-[] : ∀ {A} → (length {A} [] ≡ ♯0) length-resp-[] = refl -- Lookup lookup : ∀ {A} → List A → ℕ → Maybe A lookup as n = lookup♭ (♭ as) (♭ⁿ n) lookup♭₁ : ∀ {A : Set} {a : A} as bs n → (lookup♭ as n ≡ just a) → (lookup♭ (as ++♭ bs) n ≡ just a) lookup♭₁ []♭ bs n () lookup♭₁ (a ∷♭ as) bs zero refl = refl lookup♭₁ (a ∷♭ as) bs (suc n) as[n]≡a = lookup♭₁ as bs n as[n]≡a lookup♭₂ : ∀ {A : Set} {a : A} as bs n → (lookup♭ bs n ≡ just a) → (lookup♭ (as ++♭ bs) (length♭ as +♭ n) ≡ just a) lookup♭₂ []♭ bs n bs[n]≡a = bs[n]≡a lookup♭₂ (a ∷♭ as) bs n bs[n]≡a = lookup♭₂ as bs n bs[n]≡a lookup₁ : ∀ {A} {a : A} as bs n → (lookup as n ≡ just a) → (lookup (as ++ bs) n ≡ just a) lookup₁ {A} {a} as bs n as[n]≡a = begin lookup♭ (♭ (as ++ bs)) (♭ⁿ n) ≡⟨ cong (λ X → lookup♭ X (♭ⁿ n)) (iso-resp-++ as bs) ⟩ lookup♭ (♭ as ++♭ ♭ bs) (♭ⁿ n) ≡⟨ lookup♭₁ (♭ as) (♭ bs) (♭ⁿ n) as[n]≡a ⟩ just a ∎ lookup₂ : ∀ {A} {a : A} as bs n → (lookup bs n ≡ just a) → (lookup (as ++ bs) (length as + n) ≡ just a) lookup₂ {A} {a} as bs n bs[n]≡a = begin lookup♭ (♭ (as ++ bs)) (♭ⁿ (length as + n)) ≡⟨ cong₂ lookup♭ (iso-resp-++ as bs) (iso-resp-+ (length as) n) ⟩ lookup♭ (♭ as ++♭ ♭ bs) (♭ⁿ (length as) +♭ ♭ⁿ n) ≡⟨ cong (λ X → lookup♭ (♭ as ++♭ ♭ bs) (X +♭ ♭ⁿ n)) (iso-resp-length as) ⟩ lookup♭ (♭ as ++♭ ♭ bs) (length♭ (♭ as) +♭ ♭ⁿ n) ≡⟨ lookup♭₂ (♭ as) (♭ bs) (♭ⁿ n) bs[n]≡a ⟩ just a ∎ -- Membership record _∈_ {A} (a : A) (as : List A) : Set where constructor _,_ field index : ℕ .index✓ : lookup as index ≡ just a open _∈_ public -- Extending membership on the left and right _≪_ : ∀ {A} {a : A} {as} → (a ∈ as) → ∀ bs → (a ∈ (as ++ bs)) _≪_ {A} {a} {as} (n , n✓) bs = (n , lookup₁ as bs n n✓) _≫_ : ∀ {A} {a : A} as {bs} → (a ∈ bs) → (a ∈ (as ++ bs)) _≫_ as {bs} (n , n✓) = ((length as + n) , lookup₂ as bs n n✓) -- Membership extensions have units ≪-unit : ∀ {A} {a : A} as (a∈as : a ∈ as) → (a∈as ≪ []) ≡ a∈as ≪-unit as a∈as = refl ≫-unit : ∀ {A} {a : A} as (a∈as : a ∈ as) → ([] ≫ a∈as) ≡ a∈as ≫-unit as a∈as = refl -- Membership extension is associative on the nose ≪-assoc : ∀ {A} {a : A} as bs cs (a∈as : a ∈ as) → (a∈as ≪ bs ≪ cs) ≡ (a∈as ≪ bs ++ cs) ≪-assoc as bs cs a∈as = refl ≫-≪-assoc : ∀ {A} {a : A} as bs cs (a∈bs : a ∈ bs) → ((as ≫ a∈bs) ≪ cs) ≡ (as ≫ (a∈bs ≪ cs)) ≫-≪-assoc as bs cs a∈bs = refl ≫-assoc : ∀ {A} {a : A} as bs cs (a∈cs : a ∈ cs) → (as ≫ bs ≫ a∈cs) ≡ (as ≫ bs ≫ a∈cs) ≫-assoc as bs cs a∈cs = refl -- Index is a monoid homomorphism on the nose ≪-index : ∀ {A} {a : A} as bs (a∈as : a ∈ as) → index (a∈as ≪ bs) ≡ index a∈as ≪-index as bs a∈as = refl ≫-index : ∀ {A} {a : A} as bs (a∈bs : a ∈ bs) → index (as ≫ a∈bs) ≡ (length as + index a∈bs) ≫-index as bs a∈bs = refl -- Index is injective index-inj : ∀ {A} (a : A) {as} (a∈as₁ a∈as₂ : a ∈ as) → (index a∈as₁ ≡ index a∈as₂) → (a∈as₁ ≡ a∈as₂) index-inj a (m , m✓) (.m , n✓) refl = refl -- Membership of empty list absurd : ∀ {β} {A} {B : Set β} {a : A} → (a ∈ []) → B absurd (n , ()) -- Membership of singleton lookup-uniq : ∀ {A} {a : A} {m} {b} n → (♯ⁿ n ≡ m) → (lookup (b ∷ []) m ≡ just a) → (b ≡ a) lookup-uniq zero refl refl = refl lookup-uniq (suc n) refl () uniq : ∀ {A} {a b : A} → (a ∈ [ b ]) → (b ≡ a) uniq (n , n✓) = lookup-uniq (♭ⁿ n) (isoⁿ n) (≡-relevant n✓) singleton : ∀ {A} (a : A) → (a ∈ [ a ]) singleton a = (♯0 , refl) -- Case on membership data Case {A} a (as bs : List A) : Set where inj₁ : (a∈as : a ∈ as) → Case a as bs inj₂ : (a∈bs : a ∈ bs) → Case a as bs -- Case function _⋙_ : ∀ {A a} as {bs cs} → Case {A} a bs cs → Case a (as ++ bs) cs as ⋙ inj₁ a∈bs = inj₁ (as ≫ a∈bs) as ⋙ inj₂ a∈cs = inj₂ a∈cs lookup♭-case : ∀ {A} {a : A} cs ds n → .(lookup♭ (cs ++♭ ds ++♭ []♭) (n +♭ 0) ≡ just a) → (Case a (♯ cs) (♯ ds)) lookup♭-case []♭ ds n n✓ = inj₂ (♯ⁿ n , n✓) lookup♭-case (c ∷♭ cs) ds zero n✓ = inj₁ (♯0 , n✓) lookup♭-case (c ∷♭ cs) ds (suc n) n✓ = [ c ] ⋙ lookup♭-case cs ds n n✓ lookup-case : ∀ {A a as bs m} cs ds n → .(lookup (as ++ bs) m ≡ just a) → (♯ cs ≡ as) → (♯ ds ≡ bs) → (♯ⁿ n ≡ m) → Case {A} a as bs lookup-case cs ds n n✓ refl refl refl = lookup♭-case cs ds n n✓ case : ∀ {A a} as bs → (a ∈ (as ++ bs)) → Case {A} a as bs case {A} {a} as bs (n , n✓) = lookup-case {A} {a} {as} {bs} {n} (♭ as) (♭ bs) (♭ⁿ n) n✓ (iso as) (iso bs) (isoⁿ n) -- Beta for case with ≪ lookup♭-case-≪ : ∀ {A} {a : A} cs ds n .n✓₁ .n✓₂ → lookup♭-case {A} {a} cs ds n n✓₂ ≡ inj₁ (♯ⁿ n , n✓₁) lookup♭-case-≪ []♭ ds n () n✓₂ lookup♭-case-≪ (c ∷♭ cs) ds zero n✓₁ n✓₂ = refl lookup♭-case-≪ (c ∷♭ cs) ds (suc n) n✓₁ n✓₂ = cong (_⋙_ [ c ]) (lookup♭-case-≪ cs ds n n✓₁ n✓₂) lookup-case-≪ : ∀ {A} {a : A} {as bs m} cs ds n .m✓₁ .m✓₂ cs≡as ds≡bs n≡m → lookup-case {A} {a} {as} {bs} {m} cs ds n m✓₂ cs≡as ds≡bs n≡m ≡ inj₁ (m , m✓₁) lookup-case-≪ cs ds n m✓₁ m✓₂ refl refl refl = lookup♭-case-≪ cs ds n m✓₁ m✓₂ case-≪ : ∀ {A a as} (a∈as : a ∈ as) bs → (case {A} {a} as bs (a∈as ≪ bs) ≡ inj₁ a∈as) case-≪ {A} {a} {as} (n , n✓) bs = lookup-case-≪ {A} {a} {as} {bs} {n} (♭ as) (♭ bs) (♭ⁿ n) n✓ (lookup₁ as bs n n✓) (iso as) (iso bs) (isoⁿ n) -- Beta for case with ≫ lookup♭-case-≫ : ∀ {A} {a : A} cs ds n₁ n₂ .n✓₁ .n✓₂ → (n₂ ≡ n₁) → lookup♭-case {A} {a} cs ds (length♭ cs +♭ n₂) n✓₂ ≡ inj₂ (♯ⁿ n₁ , n✓₁) lookup♭-case-≫ []♭ ds n .n n✓₁ n✓₂ refl = refl lookup♭-case-≫ (c ∷♭ cs) ds n .n n✓₁ n✓₂ refl = cong (_⋙_ [ c ]) (lookup♭-case-≫ cs ds n n n✓₁ n✓₂ refl) lookup-case-≫ : ∀ {A} {a : A} {as bs m l+m} cs ds n .m✓₁ .m✓₂ cs≡as ds≡bs l+n≡l+m → (♯ⁿ n ≡ m) → lookup-case {A} {a} {as} {bs} {l+m} cs ds (♭ⁿ (length as + m)) m✓₂ cs≡as ds≡bs l+n≡l+m ≡ inj₂ (m , m✓₁) lookup-case-≫ cs ds n m✓₁ m✓₂ refl refl refl refl = lookup♭-case-≫ cs ds n (n +♭ 0) m✓₁ m✓₂ (isoⁿ⁻¹ n) case-≫ : ∀ {A a} as {bs} (a∈bs : a ∈ bs) → (case {A} {a} as bs (as ≫ a∈bs) ≡ inj₂ a∈bs) case-≫ {A} {a} as {bs} (n , n✓) = lookup-case-≫ {A} {a} {as} {bs} {n} {length as + n} (♭ as) (♭ bs) (♭ⁿ n) n✓ (lookup₂ as bs n n✓) (iso as) (iso bs) (isoⁿ (length as + n)) (isoⁿ n) -- A variant of case which remembers its argument data Case+ {A} {a} (as bs : List A) : (a ∈ (as ++ bs)) → Set where inj₁ : (a∈as : a ∈ as) → Case+ as bs (a∈as ≪ bs) inj₂ : (a∈bs : a ∈ bs) → Case+ as bs (as ≫ a∈bs) _⋙+_ : ∀ {A a} as {bs cs} {a∈bs++cs} → Case+ {A} {a} bs cs a∈bs++cs → Case+ (as ++ bs) cs (as ≫ a∈bs++cs) as ⋙+ inj₁ a∈bs = inj₁ (as ≫ a∈bs) as ⋙+ inj₂ a∈cs = inj₂ a∈cs lookup♭-case+ : ∀ {A a} cs ds n .n✓ → (Case+ {A} {a} (♯ cs) (♯ ds) (♯ⁿ n , n✓)) lookup♭-case+ []♭ ds n n✓ = inj₂ (♯ⁿ n , n✓) lookup♭-case+ (c ∷♭ cs) ds zero n✓ = inj₁ (♯0 , n✓) lookup♭-case+ (c ∷♭ cs) ds (suc n) n✓ = [ c ] ⋙+ lookup♭-case+ cs ds n n✓ lookup-case+ : ∀ {A a as bs m} cs ds n .m✓ → (♯ cs ≡ as) → (♯ ds ≡ bs) → (♯ⁿ n ≡ m) → Case+ {A} {a} as bs (m , m✓) lookup-case+ cs ds n n✓ refl refl refl = lookup♭-case+ cs ds n n✓ case+ : ∀ {A a} as bs a∈as++bs → Case+ {A} {a} as bs a∈as++bs case+ {A} {a} as bs (n , n✓) = lookup-case+ {A} {a} {as} {bs} {n} (♭ as) (♭ bs) (♭ⁿ n) n✓ (iso as) (iso bs) (isoⁿ n) -- Inverse of case case⁻¹ : ∀ {A a as bs} → Case {A} a as bs → (a ∈ (as ++ bs)) case⁻¹ {A} {a} {as} {bs} (inj₁ a∈as) = (a∈as ≪ bs) case⁻¹ {A} {a} {as} {bs} (inj₂ a∈bs) = (as ≫ a∈bs) case-iso : ∀ {A a} as bs (a∈as++bs : a ∈ (as ++ bs)) → case⁻¹ (case {A} {a} as bs a∈as++bs) ≡ a∈as++bs case-iso as bs a∈as++bs with case+ as bs a∈as++bs case-iso as bs .(a∈as ≪ bs) | inj₁ a∈as = cong case⁻¹ (case-≪ a∈as bs) case-iso as bs .(as ≫ a∈bs) | inj₂ a∈bs = cong case⁻¹ (case-≫ as a∈bs) case-iso⁻¹ : ∀ {A a} as bs (a∈as++bs : Case a as bs) → case {A} {a} as bs (case⁻¹ a∈as++bs) ≡ a∈as++bs case-iso⁻¹ as bs (inj₁ a∈as) = case-≪ a∈as bs case-iso⁻¹ as bs (inj₂ a∈bs) = case-≫ as a∈bs -- ⋙ distributes through case case-⋙ : ∀ {A} {a : A} as bs cs (a∈bs++cs : a ∈ (bs ++ cs)) → (as ⋙ case bs cs a∈bs++cs) ≡ (case (as ++ bs) cs (as ≫ a∈bs++cs)) case-⋙ as bs cs a∈bs++cs with case+ bs cs a∈bs++cs case-⋙ as bs cs .(a∈bs ≪ cs) | inj₁ a∈bs = begin as ⋙ case bs cs (a∈bs ≪ cs) ≡⟨ cong (_⋙_ as) (case-≪ a∈bs cs) ⟩ inj₁ (as ≫ a∈bs) ≡⟨ sym (case-≪ (as ≫ a∈bs) cs) ⟩ case (as ++ bs) cs (as ≫ a∈bs ≪ cs) ∎ case-⋙ as bs cs .(bs ≫ a∈cs) | inj₂ a∈cs = begin as ⋙ case bs cs (bs ≫ a∈cs) ≡⟨ cong (_⋙_ as) (case-≫ bs a∈cs) ⟩ inj₂ a∈cs ≡⟨ sym (case-≫ (as ++ bs) a∈cs) ⟩ case (as ++ bs) cs (as ≫ bs ≫ a∈cs) ∎ -- Three-way case, used for proving associativity properties data Case₃ {A} (a : A) as bs cs : Set where inj₁ : (a ∈ as) → Case₃ a as bs cs inj₂ : (a ∈ bs) → Case₃ a as bs cs inj₃ : (a ∈ cs) → Case₃ a as bs cs case₂₃ : ∀ {A} {a : A} as bs cs → (Case a bs cs) → (Case₃ a as bs cs) case₂₃ as bs cs (inj₁ a∈bs) = inj₂ a∈bs case₂₃ as bs cs (inj₂ a∈cs) = inj₃ a∈cs case₁₃ : ∀ {A} {a : A} as bs cs → (Case a as (bs ++ cs)) → (Case₃ a as bs cs) case₁₃ as bs cs (inj₁ a∈as) = inj₁ a∈as case₁₃ as bs cs (inj₂ a∈bs++cs) = case₂₃ as bs cs (case bs cs a∈bs++cs) case₃ : ∀ {A} {a : A} as bs cs → (a ∈ (as ++ bs ++ cs)) → (Case₃ a as bs cs) case₃ as bs cs a∈as++bs++cs = case₁₃ as bs cs (case as (bs ++ cs) a∈as++bs++cs) -- Associating case₃ to the left gives case caseˡ : ∀ {A} {a : A} {as bs cs} → Case₃ a as bs cs → Case a (as ++ bs) cs caseˡ {bs = bs} (inj₁ a∈as) = inj₁ (a∈as ≪ bs) caseˡ {as = as} (inj₂ a∈bs) = inj₁ (as ≫ a∈bs) caseˡ (inj₃ a∈cs) = inj₂ a∈cs caseˡ₂₃ : ∀ {A a} as bs cs {a∈bs++cs} → Case+ {A} {a} bs cs a∈bs++cs → caseˡ (case₂₃ as bs cs (case bs cs a∈bs++cs)) ≡ case (as ++ bs) cs (as ≫ a∈bs++cs) caseˡ₂₃ as bs cs (inj₁ a∈bs) = begin caseˡ (case₂₃ as bs cs (case bs cs (a∈bs ≪ cs))) ≡⟨ cong (caseˡ ∘ case₂₃ as bs cs) (case-≪ a∈bs cs) ⟩ inj₁ (as ≫ a∈bs) ≡⟨ sym (case-≪ (as ≫ a∈bs) cs) ⟩ case (as ++ bs) cs (as ≫ a∈bs ≪ cs) ∎ caseˡ₂₃ as bs cs (inj₂ a∈cs) = begin caseˡ (case₂₃ as bs cs (case bs cs (bs ≫ a∈cs))) ≡⟨ cong (caseˡ ∘ case₂₃ as bs cs) (case-≫ bs a∈cs) ⟩ inj₂ a∈cs ≡⟨ sym (case-≫ (as ++ bs) a∈cs) ⟩ case (as ++ bs) cs (as ≫ bs ≫ a∈cs) ∎ caseˡ₁₃ : ∀ {A a} as bs cs {a∈as++bs++cs} → Case+ {A} {a} as (bs ++ cs) a∈as++bs++cs → caseˡ (case₁₃ as bs cs (case as (bs ++ cs) a∈as++bs++cs)) ≡ case (as ++ bs) cs a∈as++bs++cs caseˡ₁₃ as bs cs (inj₁ a∈as) = begin caseˡ (case₁₃ as bs cs (case as (bs ++ cs) (a∈as ≪ bs ≪ cs))) ≡⟨ cong (caseˡ ∘ case₁₃ as bs cs) (case-≪ a∈as (bs ++ cs)) ⟩ inj₁ (a∈as ≪ bs) ≡⟨ sym (case-≪ (a∈as ≪ bs) cs) ⟩ case (as ++ bs) cs (a∈as ≪ bs ≪ cs) ∎ caseˡ₁₃ as bs cs (inj₂ a∈bs++cs) = begin caseˡ (case₁₃ as bs cs (case as (bs ++ cs) (as ≫ a∈bs++cs))) ≡⟨ cong (caseˡ ∘ case₁₃ as bs cs) (case-≫ as a∈bs++cs) ⟩ caseˡ (case₂₃ as bs cs (case bs cs a∈bs++cs)) ≡⟨ caseˡ₂₃ as bs cs (case+ bs cs a∈bs++cs) ⟩ case (as ++ bs) cs (as ≫ a∈bs++cs) ∎ caseˡ₃ : ∀ {A} {a : A} as bs cs (a∈as++bs++cs : a ∈ (as ++ bs ++ cs)) → caseˡ (case₃ as bs cs a∈as++bs++cs) ≡ case (as ++ bs) cs a∈as++bs++cs caseˡ₃ as bs cs a∈as++bs++cs = caseˡ₁₃ as bs cs (case+ as (bs ++ cs) a∈as++bs++cs) -- Associating case₃ to the right gives case caseʳ : ∀ {A} {a : A} {as bs cs} → Case₃ a as bs cs → Case a as (bs ++ cs) caseʳ (inj₁ a∈as) = inj₁ a∈as caseʳ {cs = cs} (inj₂ a∈bs) = inj₂ (a∈bs ≪ cs) caseʳ {bs = bs} (inj₃ a∈cs) = inj₂ (bs ≫ a∈cs) caseʳ₂₃ : ∀ {A a} as bs cs {a∈bs++cs} → Case+ {A} {a} bs cs a∈bs++cs → caseʳ (case₂₃ as bs cs (case bs cs a∈bs++cs)) ≡ inj₂ a∈bs++cs caseʳ₂₃ as bs cs (inj₁ a∈bs) = cong (caseʳ ∘ case₂₃ as bs cs) (case-≪ a∈bs cs) caseʳ₂₃ as bs cs (inj₂ a∈cs) = cong (caseʳ ∘ case₂₃ as bs cs) (case-≫ bs a∈cs) caseʳ₁₃ : ∀ {A a} as bs cs {a∈as++bs++cs} → Case+ {A} {a} as (bs ++ cs) a∈as++bs++cs → caseʳ (case₁₃ as bs cs (case as (bs ++ cs) a∈as++bs++cs)) ≡ case as (bs ++ cs) a∈as++bs++cs caseʳ₁₃ as bs cs (inj₁ a∈as) = begin caseʳ (case₁₃ as bs cs (case as (bs ++ cs) (a∈as ≪ bs ≪ cs))) ≡⟨ cong (caseʳ ∘ case₁₃ as bs cs) (case-≪ a∈as (bs ++ cs)) ⟩ inj₁ a∈as ≡⟨ sym (case-≪ a∈as (bs ++ cs)) ⟩ case as (bs ++ cs) (a∈as ≪ bs ≪ cs) ∎ caseʳ₁₃ as bs cs (inj₂ a∈bs++cs) = begin caseʳ (case₁₃ as bs cs (case as (bs ++ cs) (as ≫ a∈bs++cs))) ≡⟨ cong (caseʳ ∘ case₁₃ as bs cs) (case-≫ as a∈bs++cs) ⟩ caseʳ (case₂₃ as bs cs (case bs cs a∈bs++cs)) ≡⟨ caseʳ₂₃ as bs cs (case+ bs cs a∈bs++cs) ⟩ inj₂ a∈bs++cs ≡⟨ sym (case-≫ as a∈bs++cs) ⟩ case as (bs ++ cs) (as ≫ a∈bs++cs) ∎ caseʳ₃ : ∀ {A} {a : A} as bs cs (a∈as++bs++cs : a ∈ (as ++ bs ++ cs)) → caseʳ (case₃ as bs cs a∈as++bs++cs) ≡ case as (bs ++ cs) a∈as++bs++cs caseʳ₃ as bs cs a∈as++bs++cs = caseʳ₁₃ as bs cs (case+ as (bs ++ cs) a∈as++bs++cs)
{ "alphanum_fraction": 0.4957824066, "avg_line_length": 34.5773809524, "ext": "agda", "hexsha": "e3c6f489c449abbb073ad30a790ec55151d43485", "lang": "Agda", "max_forks_count": 2, "max_forks_repo_forks_event_max_datetime": "2022-03-12T11:38:44.000Z", "max_forks_repo_forks_event_min_datetime": "2018-03-03T04:39:31.000Z", "max_forks_repo_head_hexsha": "08337fdb8375137a52cc9b3ade766305191b2394", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "agda/agda-assoc-free", "max_forks_repo_path": "src/AssocFree/DList.agda", "max_issues_count": null, "max_issues_repo_head_hexsha": "08337fdb8375137a52cc9b3ade766305191b2394", "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/agda-assoc-free", "max_issues_repo_path": "src/AssocFree/DList.agda", "max_line_length": 104, "max_stars_count": 3, "max_stars_repo_head_hexsha": "08337fdb8375137a52cc9b3ade766305191b2394", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "agda/agda-assoc-free", "max_stars_repo_path": "src/AssocFree/DList.agda", "max_stars_repo_stars_event_max_datetime": "2020-08-27T20:56:20.000Z", "max_stars_repo_stars_event_min_datetime": "2016-11-22T11:48:31.000Z", "num_tokens": 9010, "size": 17427 }
-- Andreas, 2012-02-14. No short-circuit conversion test for sizes! {-# OPTIONS --sized-types --show-implicit #-} -- {-# OPTIONS -v tc.size.solve:20 -v tc.conv.size:20 -v tc.term.con:50 -v tc.term.args:50 #-} module Issue298b where open import Common.Size data BTree : {size : Size} → Set where leaf : {i : Size} → BTree {↑ i} node : {i : Size} → BTree {i} → BTree {i} → BTree {↑ i} works : ∀ {i} → BTree {i} → BTree works (node (node t1 t2) t3) = node (works t1) (node t2 t3) works t = t
{ "alphanum_fraction": 0.6184738956, "avg_line_length": 31.125, "ext": "agda", "hexsha": "8f38873acc1755f8f315a10b0ebe455cb62b97fc", "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/Issue298b.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/Issue298b.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/Issue298b.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": 180, "size": 498 }
{-# OPTIONS --without-K #-} module PiTracedLevel0 where open import Data.Empty using (⊥; ⊥-elim) open import Data.Unit using (⊤; tt) open import Data.Sum using (_⊎_; inj₁; inj₂) open import Data.Product using (_×_; _,_; proj₁; proj₂) ------------------------------------------------------------------------------ -- Level 0 of Pi (with trace) -- -- ZERO is a type with no elements -- ONE is a type with one element 'tt' -- PLUS ONE ONE is a type with elements 'false' and 'true' -- and so on for all finite types built from ZERO, ONE, PLUS, and TIMES -- -- We also have that U is a type with elements ZERO, ONE, PLUS ONE ONE, -- TIMES BOOL BOOL, etc. data U : Set where ZERO : U ONE : U PLUS : U → U → U TIMES : U → U → U ⟦_⟧ : U → Set ⟦ ZERO ⟧ = ⊥ ⟦ ONE ⟧ = ⊤ ⟦ PLUS t₁ t₂ ⟧ = ⟦ t₁ ⟧ ⊎ ⟦ t₂ ⟧ ⟦ TIMES t₁ t₂ ⟧ = ⟦ t₁ ⟧ × ⟦ t₂ ⟧ infix 30 _⟷_ infixr 50 _◎_ -- Combinators, permutations, or paths depending on the perspective data _⟷_ : U → U → Set where unite₊ : {t : U} → PLUS ZERO t ⟷ t uniti₊ : {t : U} → t ⟷ PLUS ZERO t swap₊ : {t₁ t₂ : U} → PLUS t₁ t₂ ⟷ PLUS t₂ t₁ assocl₊ : {t₁ t₂ t₃ : U} → PLUS t₁ (PLUS t₂ t₃) ⟷ PLUS (PLUS t₁ t₂) t₃ assocr₊ : {t₁ t₂ t₃ : U} → PLUS (PLUS t₁ t₂) t₃ ⟷ PLUS t₁ (PLUS t₂ t₃) unite⋆ : {t : U} → TIMES ONE t ⟷ t uniti⋆ : {t : U} → t ⟷ TIMES ONE t swap⋆ : {t₁ t₂ : U} → TIMES t₁ t₂ ⟷ TIMES t₂ t₁ assocl⋆ : {t₁ t₂ t₃ : U} → TIMES t₁ (TIMES t₂ t₃) ⟷ TIMES (TIMES t₁ t₂) t₃ assocr⋆ : {t₁ t₂ t₃ : U} → TIMES (TIMES t₁ t₂) t₃ ⟷ TIMES t₁ (TIMES t₂ t₃) absorbr : {t : U} → TIMES ZERO t ⟷ ZERO absorbl : {t : U} → TIMES t ZERO ⟷ ZERO factorzr : {t : U} → ZERO ⟷ TIMES t ZERO factorzl : {t : U} → ZERO ⟷ TIMES ZERO t dist : {t₁ t₂ t₃ : U} → TIMES (PLUS t₁ t₂) t₃ ⟷ PLUS (TIMES t₁ t₃) (TIMES t₂ t₃) factor : {t₁ t₂ t₃ : U} → PLUS (TIMES t₁ t₃) (TIMES t₂ t₃) ⟷ TIMES (PLUS t₁ t₂) t₃ id⟷ : {t : U} → t ⟷ t _◎_ : {t₁ t₂ t₃ : U} → (t₁ ⟷ t₂) → (t₂ ⟷ t₃) → (t₁ ⟷ t₃) _⊕_ : {t₁ t₂ t₃ t₄ : U} → (t₁ ⟷ t₃) → (t₂ ⟷ t₄) → (PLUS t₁ t₂ ⟷ PLUS t₃ t₄) _⊗_ : {t₁ t₂ t₃ t₄ : U} → (t₁ ⟷ t₃) → (t₂ ⟷ t₄) → (TIMES t₁ t₂ ⟷ TIMES t₃ t₄) trace : {t t₁ t₂ : U} → (PLUS t₁ t ⟷ PLUS t₂ t) → (t₁ ⟷ t₂) ! : {t₁ t₂ : U} → (t₁ ⟷ t₂) → (t₂ ⟷ t₁) ! unite₊ = uniti₊ ! uniti₊ = unite₊ ! swap₊ = swap₊ ! assocl₊ = assocr₊ ! assocr₊ = assocl₊ ! unite⋆ = uniti⋆ ! uniti⋆ = unite⋆ ! swap⋆ = swap⋆ ! assocl⋆ = assocr⋆ ! assocr⋆ = assocl⋆ ! absorbl = factorzr ! absorbr = factorzl ! factorzl = absorbr ! factorzr = absorbl ! dist = factor ! factor = dist ! id⟷ = id⟷ ! (c₁ ◎ c₂) = ! c₂ ◎ ! c₁ ! (c₁ ⊕ c₂) = (! c₁) ⊕ (! c₂) ! (c₁ ⊗ c₂) = (! c₁) ⊗ (! c₂) ! (trace c) = trace (! c) ------------------------------------------------------------------------------ -- Cat open import Level using () renaming (zero to lzero) open import Data.Unit open import Relation.Binary.Core using (IsEquivalence) open import Data.Product using (_,_) open import Categories.Category open import Categories.Groupoid open import Categories.Monoidal open import Categories.Monoidal.Helpers open import Categories.Bifunctor open import Categories.NaturalIsomorphism open import Categories.Monoidal.Braided open import Categories.Monoidal.Symmetric open import Categories.RigCategory open import Categories.Monoidal.Traced triv≡ : {t₁ t₂ : U} → (f g : t₁ ⟷ t₂) → Set triv≡ _ _ = ⊤ triv≡Equiv : {t₁ t₂ : U} → IsEquivalence (triv≡ {t₁} {t₂}) triv≡Equiv = record { refl = tt ; sym = λ _ → tt ; trans = λ _ _ → tt } PiCat : Category lzero lzero lzero PiCat = record { Obj = U ; _⇒_ = _⟷_ ; _≡_ = triv≡ ; id = id⟷ ; _∘_ = λ y⟷z x⟷y → x⟷y ◎ y⟷z ; assoc = tt ; identityˡ = tt ; identityʳ = tt ; equiv = triv≡Equiv ; ∘-resp-≡ = λ _ _ → tt } -- and a groupoid PiGroupoid : Groupoid PiCat PiGroupoid = record { _⁻¹ = ! ; iso = record { isoˡ = tt ; isoʳ = tt } } -- additive bifunctor and monoidal structure ⊕-bifunctor : Bifunctor PiCat PiCat PiCat ⊕-bifunctor = record { F₀ = λ {(u , v) → PLUS u v} ; F₁ = λ {(x⟷y , z⟷w) → x⟷y ⊕ z⟷w } ; identity = tt ; homomorphism = tt ; F-resp-≡ = λ _ → tt } module ⊎h = MonoidalHelperFunctors PiCat ⊕-bifunctor ZERO 0⊕x≡x : NaturalIsomorphism ⊎h.id⊗x ⊎h.x 0⊕x≡x = record { F⇒G = record { η = λ X → unite₊ ; commute = λ _ → tt } ; F⇐G = record { η = λ X → uniti₊ ; commute = λ _ → tt } ; iso = λ X → record { isoˡ = tt; isoʳ = tt } } x⊕0≡x : NaturalIsomorphism ⊎h.x⊗id ⊎h.x x⊕0≡x = record { F⇒G = record { η = λ X → swap₊ ◎ unite₊ -- !!! ; commute = λ _ → tt } ; F⇐G = record { η = λ X → uniti₊ ◎ swap₊ ; commute = λ _ → tt } ; iso = λ X → record { isoˡ = tt ; isoʳ = tt } } [x⊕y]⊕z≡x⊕[y⊕z] : NaturalIsomorphism ⊎h.[x⊗y]⊗z ⊎h.x⊗[y⊗z] [x⊕y]⊕z≡x⊕[y⊕z] = record { F⇒G = record { η = λ X → assocr₊ ; commute = λ f → tt } ; F⇐G = record { η = λ X → assocl₊ ; commute = λ _ → tt } ; iso = λ X → record { isoˡ = tt ; isoʳ = tt } } M⊕ : Monoidal PiCat M⊕ = record { ⊗ = ⊕-bifunctor ; id = ZERO ; identityˡ = 0⊕x≡x ; identityʳ = x⊕0≡x ; assoc = [x⊕y]⊕z≡x⊕[y⊕z] ; triangle = tt ; pentagon = tt } -- multiplicative bifunctor and monoidal structure ⊗-bifunctor : Bifunctor PiCat PiCat PiCat ⊗-bifunctor = record { F₀ = λ {(u , v) → TIMES u v} ; F₁ = λ {(x⟷y , z⟷w) → x⟷y ⊗ z⟷w } ; identity = tt ; homomorphism = tt ; F-resp-≡ = λ _ → tt } module ⊗h = MonoidalHelperFunctors PiCat ⊗-bifunctor ONE 1⊗x≡x : NaturalIsomorphism ⊗h.id⊗x ⊗h.x 1⊗x≡x = record { F⇒G = record { η = λ X → unite⋆ ; commute = λ _ → tt } ; F⇐G = record { η = λ X → uniti⋆ ; commute = λ _ → tt } ; iso = λ X → record { isoˡ = tt; isoʳ = tt } } x⊗1≡x : NaturalIsomorphism ⊗h.x⊗id ⊗h.x x⊗1≡x = record { F⇒G = record { η = λ X → swap⋆ ◎ unite⋆ -- !!! ; commute = λ _ → tt } ; F⇐G = record { η = λ X → uniti⋆ ◎ swap⋆ ; commute = λ _ → tt } ; iso = λ X → record { isoˡ = tt ; isoʳ = tt } } [x⊗y]⊗z≡x⊗[y⊗z] : NaturalIsomorphism ⊗h.[x⊗y]⊗z ⊗h.x⊗[y⊗z] [x⊗y]⊗z≡x⊗[y⊗z] = record { F⇒G = record { η = λ X → assocr⋆ ; commute = λ f → tt } ; F⇐G = record { η = λ X → assocl⋆ ; commute = λ _ → tt } ; iso = λ X → record { isoˡ = tt ; isoʳ = tt } } M⊗ : Monoidal PiCat M⊗ = record { ⊗ = ⊗-bifunctor ; id = ONE ; identityˡ = 1⊗x≡x ; identityʳ = x⊗1≡x ; assoc = [x⊗y]⊗z≡x⊗[y⊗z] ; triangle = tt ; pentagon = tt } x⊕y≡y⊕x : NaturalIsomorphism ⊎h.x⊗y ⊎h.y⊗x x⊕y≡y⊕x = record { F⇒G = record { η = λ X → swap₊ ; commute = λ f → tt } ; F⇐G = record { η = λ X → swap₊ ; commute = λ f → tt } ; iso = λ X → record { isoˡ = tt ; isoʳ = tt } } BM⊕ : Braided M⊕ BM⊕ = record { braid = x⊕y≡y⊕x ; hexagon₁ = tt ; hexagon₂ = tt } x⊗y≡y⊗x : NaturalIsomorphism ⊗h.x⊗y ⊗h.y⊗x x⊗y≡y⊗x = record { F⇒G = record { η = λ X → swap⋆ ; commute = λ f → tt } ; F⇐G = record { η = λ X → swap⋆ ; commute = λ f → tt } ; iso = λ X → record { isoˡ = tt ; isoʳ = tt } } BM⊗ : Braided M⊗ BM⊗ = record { braid = x⊗y≡y⊗x ; hexagon₁ = tt ; hexagon₂ = tt } SBM⊕ : Symmetric BM⊕ SBM⊕ = record { symmetry = tt } -- trace Pi0Traced : Traced SBM⊕ Pi0Traced = record { trace = trace ; vanish_id = tt ; vanish_⊗ = tt ; superpose = tt ; yank = tt } -- SBM⊗ : Symmetric BM⊗ SBM⊗ = record { symmetry = tt } module r = BimonoidalHelperFunctors SBM⊕ BM⊗ x⊗0≡0 : NaturalIsomorphism r.x⊗0 r.0↑ x⊗0≡0 = record { F⇒G = record { η = λ X → absorbl ; commute = λ f → tt } ; F⇐G = record { η = λ X → factorzr ; commute = λ f → tt } ; iso = λ X → record { isoˡ = tt ; isoʳ = tt } } 0⊗x≡0 : NaturalIsomorphism r.0⊗x r.0↑ 0⊗x≡0 = record { F⇒G = record { η = λ X → absorbr ; commute = λ f → tt } ; F⇐G = record { η = λ X → factorzl ; commute = λ f → tt } ; iso = λ X → record { isoˡ = tt ; isoʳ = tt } } x⊗[y⊕z]≡[x⊗y]⊕[x⊗z] : NaturalIsomorphism r.x⊗[y⊕z] r.[x⊗y]⊕[x⊗z] x⊗[y⊕z]≡[x⊗y]⊕[x⊗z] = record -- this probably says we need distl/distr { F⇒G = record { η = λ X → swap⋆ ◎ dist ◎ (swap⋆ ⊕ swap⋆) ; commute = λ f → tt } ; F⇐G = record { η = λ X → (swap⋆ ⊕ swap⋆) ◎ factor ◎ swap⋆ ; commute = λ f → tt } ; iso = λ X → record { isoˡ = tt ; isoʳ = tt } } [x⊕y]⊗z≡[x⊗z]⊕[y⊗z] : NaturalIsomorphism r.[x⊕y]⊗z r.[x⊗z]⊕[y⊗z] [x⊕y]⊗z≡[x⊗z]⊕[y⊗z] = record { F⇒G = record { η = λ X → dist ; commute = λ f → tt } ; F⇐G = record { η = λ X → factor ; commute = λ f → tt } ; iso = λ X → record { isoˡ = tt ; isoʳ = tt } } Pi0Rig : RigCategory SBM⊕ BM⊗ Pi0Rig = record { distribₗ = x⊗[y⊕z]≡[x⊗y]⊕[x⊗z] ; distribᵣ = [x⊕y]⊗z≡[x⊗z]⊕[y⊗z] ; annₗ = x⊗0≡0 ; annᵣ = 0⊗x≡0 } ------------------------------------------------------------------------------
{ "alphanum_fraction": 0.5127800923, "avg_line_length": 25.5201149425, "ext": "agda", "hexsha": "b5ec6d44bcb2a1ac2c25906a645839bee0ac1171", "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/PiTracedLevel0.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/PiTracedLevel0.agda", "max_line_length": 84, "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/PiTracedLevel0.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": 4355, "size": 8881 }
{-# OPTIONS --rewriting --without-K #-} open import Prelude open import GSeTT.Syntax open import GSeTT.Rules open import GSeTT.Disks open import GSeTT.Uniqueness-Derivations open import GSeTT.Dec-Type-Checking open import CaTT.Ps-contexts open import CaTT.Relation open import CaTT.Uniqueness-Derivations-Ps module CaTT.Decidability-ps where ∅-is-not-ps : ∀ x A → ¬ (nil ⊢ps x # A) ∅-is-not-ps x A ∅⊢psx with psvar ∅⊢psx ... | var _ () ps-carrier : ∀{Γ A B C x y z} → ((Γ :: (x , A)) :: (y , B)) ⊢ps z # C → ((Σ Pre-Tm λ a → (⇒ A a (Var x) == B)) × (x == length Γ)) × (y == S (length Γ)) ps-carrier (psd Γ⊢ps) = ps-carrier Γ⊢ps ps-carrier (pse _ idp idp idp idp idp) = ((_ , idp) , idp) , idp Γ+⊢ps→Γ⊢ps : ∀ {Γ x A a y B z} → ((Γ :: (y , B)) :: (z , ⇒ B (Var a) (Var y))) ⊢ps x # A → Γ ⊢ps a # B Γ+⊢ps→Γ⊢ps (psd Γ⊢ps) = Γ+⊢ps→Γ⊢ps Γ⊢ps Γ+⊢ps→Γ⊢ps (pse Γ⊢ps idp idp p idp idp) = transport ((=Var (snd (fst (=⇒ p)))) ^) Γ⊢ps 𝔻0-var : ∀ x A → Pre-𝔻 0 ⊢t (Var x) # A → x == 0 𝔻0-var x A (var _ (inr (idp , _))) = idp 𝔻0-type : ∀ x A → Pre-𝔻 0 ⊢t (Var x) # A → A == ∗ 𝔻0-type x A (var _ (inr (idp , idp))) = idp ⊢psx→⊢ps : ∀ {Γ x A} → Γ ⊢ps x # A → Γ ⊢ps ⊢psx→⊢ps {A = ∗} Γ⊢psx = ps Γ⊢psx ⊢psx→⊢ps {A = ⇒ A (Var _) (Var _)} Γ⊢psx = ⊢psx→⊢ps (psd Γ⊢psx) dec-⊢-dim : ∀ {Γ} → Γ ⊢C → (n : ℕ) → dec (Σ (ℕ × Pre-Ty) (λ (x , A) → (Γ ⊢t (Var x) # A) × (dim A == n))) dec-⊢-dim {nil} _ n = inr λ{((x , A) , ((var _ ()) , _))} dec-⊢-dim {Γ :: (x , A)} Γ+⊢@(cc Γ⊢ _ _) n with eqdecℕ (dim A) n ... | inl idp = inl ((x , A) , (var Γ+⊢ (inr (idp , idp)) , idp)) ... | inr dimA≠n with dec-⊢-dim Γ⊢ n ... | inl ((y , B) , ((var _ y∈Γ) , dimB=n)) = inl ((y , B ), (var Γ+⊢ (inl y∈Γ) , dimB=n)) ... | inr ¬∃y = inr λ{((z , C) , ((var _ (inl z∈Γ)) , idp)) → ¬∃y ((z , C) , (var Γ⊢ z∈Γ , idp)); ((z , C) , ((var _ (inr (idp , idp))) , idp)) → dimA≠n idp} dim-pse : ∀ {Γ x A y B} → ((Γ :: (x , A)) :: (y , B)) ⊢ps y # B → (∀ z C → ((Γ :: (x , A)) :: (y , B)) ⊢ps z # C → dim C ≤ dim B) dim-pse Γ⊢psy z C (psd Γ⊢psf) = Sn≤m→n≤m (dim-pse Γ⊢psy _ _ Γ⊢psf) dim-pse Γ⊢psy z C (pse Γ⊢psz idp idp idp idp idp) = n≤n _ private tgt-⟿ : ∀ {Γ x A y z a} → Γ ⊢t Var x # ⇒ A (Var y) (Var z) → Γ , x ⟿ a → z ≠ a → Γ , z ⟿ a tgt-⟿ Γ⊢x (∂⁺⟿ Γ⊢'x) z≠a with unique-type Γ⊢x Γ⊢'x idp ... | idp = ⊥-elim (z≠a idp) tgt-⟿ Γ⊢x (x⟿∂⁺ Γ⊢'x x⟿a) z≠a with unique-type Γ⊢x Γ⊢'x idp ... | idp = x⟿a ⇒≠∗ : ∀ {A t u} → ⇒ A t u ≠ ∗ ⇒≠∗ () dec-Σ⊢T : ∀ {Γ t} → dec (Σ Pre-Ty λ A → Γ ⊢t t # A) dec-Σ⊢T {nil} {Var x} = inr λ{(_ , var _ ())} dec-Σ⊢T {Γ+@(Γ :: (y , B))} {Var x} with dec-⊢C Γ+ | eqdecℕ x y ... | inr Γ+⊬ | _ = inr λ (A , Γ+⊢x) → Γ+⊬ (Γ⊢t:A→Γ⊢ Γ+⊢x) ... | inl Γ+⊢ | inl idp = inl (B , var Γ+⊢ (inr (idp , idp))) ... | inl Γ+⊢ | inr x≠y with dec-Σ⊢T {Γ} {Var x} ... | inl (A , Γ⊢x)= inl (A , wkt Γ⊢x Γ+⊢) ... | inr Γ⊬x = inr λ{ (B , var _ (inr (idp , idp))) → x≠y idp; (B , var (cc Γ⊢ _ _) (inl x#B∈Γ)) → Γ⊬x (B , var Γ⊢ x#B∈Γ)} dec-⟿ : ∀ Γ x y → dec (Γ , x ⟿ y) dec-⟿-aux : ∀ Γ x A y → Γ ⊢t (Var x) # A → dec (Γ , x ⟿ y) dec-⟿-aux Γ x ∗ y Γ⊢x = inr λ{(∂⁺⟿ Γ⊢'x) → ⇒≠∗ (unique-type Γ⊢'x Γ⊢x idp) ; (x⟿∂⁺ Γ⊢'x _) → ⇒≠∗ (unique-type Γ⊢'x Γ⊢x idp)} dec-⟿-aux Γ x (⇒ A (Var _) (Var z)) y Γ⊢x with eqdecℕ z y | dec-⟿-aux Γ z A y (Γ⊢tgt (Γ⊢t:A→Γ⊢A Γ⊢x)) ... | inl idp | _ = inl (∂⁺⟿ Γ⊢x) ... | inr _ | inl x⟿z = inl (x⟿∂⁺ Γ⊢x x⟿z) ... | inr z≠y | inr ¬x⟿z = inr λ x⟿y → ¬x⟿z (tgt-⟿ Γ⊢x x⟿y z≠y) dec-⟿ Γ x y with dec-Σ⊢T {Γ} {Var x} ... | inr Γ⊬x = inr λ{(∂⁺⟿ Γ⊢x) → Γ⊬x (_ , Γ⊢x) ; (x⟿∂⁺ Γ⊢x _) → Γ⊬x (_ , Γ⊢x)} ... | inl (A , Γ⊢x) = dec-⟿-aux Γ x A y Γ⊢x Γ⊢psx-dim-⟿ : ∀ {Γ x A y B} → Γ ⊢ps x # A → Γ ⊢ps y # B → dim B < dim A → Γ , x ⟿ y Γ⊢psx-dim-⟿ Γ⊢psx pss dB<dA with 𝔻0-type _ _ (psvar Γ⊢psx) ... | idp = ⊥-elim (Sn≰n _ dB<dA) Γ⊢psx-dim-⟿ {Γ} {x} {A} {y} {B} Γ⊢psx (psd Γ⊢psf) dB<dA with eqdecℕ (S (dim B)) (dim A) ... | inl SdB=dA = transport {B = λ a → Γ , a ⟿ y} (Γ⊢psx-dim Γ⊢psf Γ⊢psx SdB=dA) (∂⁺⟿ (psvar Γ⊢psf)) ... | inr SdB≠dA = T⟿ (Γ⊢psx-dim-⟿ Γ⊢psx Γ⊢psf (≤×≠→< dB<dA SdB≠dA)) (∂⁺⟿ (psvar Γ⊢psf)) Γ⊢psx-dim-⟿ Γ⊢psx Γ⊢psy@(pse _ idp idp idp idp idp) dB<dA = ⊥-elim (Sn≰n _ (≤T dB<dA (dim-pse Γ⊢psy _ _ Γ⊢psx))) ⟿→psx : ∀ {Γ x A y} → Γ ⊢ps x # A → Γ , x ⟿ y → Σ Pre-Ty λ B → Γ ⊢ps y # B ⟿→psx Γ⊢psx (∂⁺⟿ Γ⊢x) with unique-type (psvar Γ⊢psx) Γ⊢x idp ... | idp = _ , (psd Γ⊢psx) ⟿→psx Γ⊢psx (x⟿∂⁺ Γ⊢x z⟿y) with unique-type (psvar Γ⊢psx) Γ⊢x idp ... | idp = ⟿→psx (psd Γ⊢psx) z⟿y pse-max : ∀ {Γ x A y B} → ((Γ :: (x , A)) :: (y , B)) ⊢ps y # B → (∀ z C → ((Γ :: (x , A)) :: (y , B)) ⊢ps z # C → (y == z) + (((Γ :: (x , A)) :: (y , B)) , y ⟿ z)) pse-max {B = B} Γ⊢psy z C Γ⊢psz with ℕ-trichotomy (dim B) (dim C) ... | inl (inl dimB<dimC) = ⊥-elim (Sn≰n _ (≤T dimB<dimC (dim-pse Γ⊢psy _ _ Γ⊢psz)) ) ... | inl (inr dimC<dimB) = inr (Γ⊢psx-dim-⟿ Γ⊢psy Γ⊢psz dimC<dimB) ... | inr dimB=dimC = inl (Γ⊢psx-dim Γ⊢psy Γ⊢psz dimB=dimC) ⊢psx→max : ∀ {Γ x A} → Γ ⊢ps x # A → (Σ (ℕ × Pre-Ty) λ (y , B) → (Γ ⊢ps y # B) × (∀ z C → Γ ⊢ps z # C → (y == z) + (Γ , y ⟿ z))) ⊢psx→max pss = (0 , ∗) , (pss , λ z C 𝔻0⊢psx → inl (𝔻0-var z C (psvar 𝔻0⊢psx) ^)) ⊢psx→max (psd Γ⊢psx) = ⊢psx→max Γ⊢psx ⊢psx→max {((Γ :: (_ , B)) :: (_ , C))} {x} {A} Γ+⊢ps@(pse Γ⊢psx idp idp idp idp idp) = (S (length Γ) , C) , (Γ+⊢ps , pse-max Γ+⊢ps) -- TODO : move case_of_ in Prelude case_of_ : ∀ {a b} {A : Set a} {B : Set b} → A → (A → B) → B case x of f = f x ill-formed-1st-var : ∀ {y A} → ¬ ((nil :: (S y , A)) ⊢C) ill-formed-1st-var (cc _ _ ()) ill-formed-1st-type : ∀ {y A a b} → ¬ ((nil :: (y , ⇒ A a b)) ⊢C) ill-formed-1st-type (cc _ (ar (var _ ()) _) _) dec-⊢psx-max : ∀ {Γ} → dec (Σ (ℕ × Pre-Ty) λ (x , A) → (Γ ⊢ps x # A) × (∀ y B → Γ ⊢ps y # B → (x == y) + (Γ , x ⟿ y))) dec-⊢psx-max {nil} = inr λ ((x , A) , (nil⊢psx , _ )) → ∅-is-not-ps _ _ nil⊢psx dec-⊢psx-max {nil :: (O , ∗)} = inl ((0 , ∗) , (pss , λ y B 𝔻0⊢psy → inl (𝔻0-var _ _ (psvar 𝔻0⊢psy) ^))) dec-⊢psx-max {nil :: (O , ⇒ _ _ _)} = inr λ ((x , A) , (Γ⊢psx , _ )) → ill-formed-1st-type (psv Γ⊢psx) dec-⊢psx-max {nil :: (S z , C)} = inr λ ((x , A) , (Γ⊢psx , _ )) → ill-formed-1st-var (psv Γ⊢psx) dec-⊢psx-max {(Γ :: (z , C)) :: (f , ∗)} = inr λ ((x , A) , (Γ+⊢psx , _)) → ⇒≠∗ (snd (fst (fst (ps-carrier Γ+⊢psx)))) dec-⊢psx-max {(Γ :: (z , C)) :: (f , ⇒ D (Var a) (Var b))} with eqdec-PreTy C D | eqdecℕ z (length Γ) | eqdecℕ (length Γ) b | eqdecℕ f (S (length Γ)) ... | inr C≠D | _ | _ | _ = inr λ ((x , A) , (Γ+⊢psx , _)) → C≠D (fst (fst (=⇒ (snd (fst (fst (ps-carrier Γ+⊢psx))))))) ... | inl idp | inr z≠l | _ | _ = inr λ ((x , A) , (Γ+⊢psx , _)) → z≠l (snd (fst (ps-carrier Γ+⊢psx))) ... | inl idp | inl idp | inr l≠b | _ = inr λ ((x , A) , (Γ+⊢psx , _)) → l≠b (=Var (snd (=⇒ (snd (fst (fst (ps-carrier Γ+⊢psx))))))) ... | inl idp | inl idp | inl idp | inr f≠Sl = inr λ ((x , A) , (Γ+⊢psx , _)) → f≠Sl (snd (ps-carrier Γ+⊢psx)) ... | inl idp | inl idp | inl idp | inl idp with dec-⊢psx-max {Γ} ... | inr ¬Γ⊢ps = inr λ ((x , A) , (Γ+⊢psx , _)) → ¬Γ⊢ps (⊢psx→max (Γ+⊢ps→Γ⊢ps Γ+⊢psx)) ... | inl ((c , E) , (Γ⊢psc , cmax)) with eqdecℕ c a | eqdec-PreTy E C ... | inl idp | inl idp = let Γ+⊢ps = pse Γ⊢psc idp idp idp idp idp in inl ((S (length Γ) , ⇒ C (Var a) (Var (length Γ))) , (Γ+⊢ps , pse-max Γ+⊢ps)) ... | inl idp | inr E≠C = inr λ ((x , A) , (Γ+⊢psx , _)) → E≠C (unique-type (psvar Γ⊢psc) (psvar (Γ+⊢ps→Γ⊢ps Γ+⊢psx)) idp) ... | inr c≠a | _ with dec-⟿ Γ c a ... | inr ¬c⟿a = inr λ ((x , A) , (Γ+⊢psx , _)) → case cmax _ _ (Γ+⊢ps→Γ⊢ps Γ+⊢psx) of λ{(inl c=a) → c≠a c=a; (inr c⟿a) → ¬c⟿a c⟿a } ... | inl c⟿a with (⟿→psx Γ⊢psc c⟿a) ... | (F , Γ⊢psa) with eqdec-PreTy F C ... | inl idp = let Γ+⊢ps = pse Γ⊢psa idp idp idp idp idp in inl ((S (length Γ) , ⇒ C (Var a) (Var (length Γ))) , (Γ+⊢ps , pse-max Γ+⊢ps)) ... | inr F≠C = inr λ ((x , A) , (Γ+⊢psx , _)) → F≠C (unique-type (psvar Γ⊢psa) (psvar (Γ+⊢ps→Γ⊢ps Γ+⊢psx)) idp) dec-⊢ps : ∀ Γ → dec(Γ ⊢ps) dec-⊢ps Γ with dec-⊢psx-max {Γ} ... | inl ((x , A) , (Γ⊢psx , _)) = inl (⊢psx→⊢ps Γ⊢psx) ... | inr ¬Γ⊢psx = inr λ {(ps Γ⊢psy) → ¬Γ⊢psx (⊢psx→max Γ⊢psy)}
{ "alphanum_fraction": 0.455499939, "avg_line_length": 56.4896551724, "ext": "agda", "hexsha": "effc9ef69509680f6e34d8b23cb6e30fc0e4970b", "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": "3a02010a869697f4833c9bc6047d66ca27b87cf2", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "thibautbenjamin/catt-formalization", "max_forks_repo_path": "CaTT/Decidability-ps.agda", "max_issues_count": null, "max_issues_repo_head_hexsha": "3a02010a869697f4833c9bc6047d66ca27b87cf2", "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": "thibautbenjamin/catt-formalization", "max_issues_repo_path": "CaTT/Decidability-ps.agda", "max_line_length": 166, "max_stars_count": null, "max_stars_repo_head_hexsha": "3a02010a869697f4833c9bc6047d66ca27b87cf2", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "thibautbenjamin/catt-formalization", "max_stars_repo_path": "CaTT/Decidability-ps.agda", "max_stars_repo_stars_event_max_datetime": null, "max_stars_repo_stars_event_min_datetime": null, "num_tokens": 4913, "size": 8191 }
open import FRP.JS.String using ( _<_ ) open import FRP.JS.True using ( True ) module FRP.JS.String.Properties where postulate <-trans : ∀ {k l m} → True (k < l) → True (l < m) → True (k < m)
{ "alphanum_fraction": 0.6275510204, "avg_line_length": 24.5, "ext": "agda", "hexsha": "fef552b8617b5dfcb7e743e5f978937d914bab43", "lang": "Agda", "max_forks_count": 7, "max_forks_repo_forks_event_max_datetime": "2022-03-12T11:39:38.000Z", "max_forks_repo_forks_event_min_datetime": "2016-11-07T21:50:58.000Z", "max_forks_repo_head_hexsha": "c7ccaca624cb1fa1c982d8a8310c313fb9a7fa72", "max_forks_repo_licenses": [ "MIT", "BSD-3-Clause" ], "max_forks_repo_name": "agda/agda-frp-js", "max_forks_repo_path": "src/agda/FRP/JS/String/Properties.agda", "max_issues_count": null, "max_issues_repo_head_hexsha": "c7ccaca624cb1fa1c982d8a8310c313fb9a7fa72", "max_issues_repo_issues_event_max_datetime": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_licenses": [ "MIT", "BSD-3-Clause" ], "max_issues_repo_name": "agda/agda-frp-js", "max_issues_repo_path": "src/agda/FRP/JS/String/Properties.agda", "max_line_length": 66, "max_stars_count": 63, "max_stars_repo_head_hexsha": "c7ccaca624cb1fa1c982d8a8310c313fb9a7fa72", "max_stars_repo_licenses": [ "MIT", "BSD-3-Clause" ], "max_stars_repo_name": "agda/agda-frp-js", "max_stars_repo_path": "src/agda/FRP/JS/String/Properties.agda", "max_stars_repo_stars_event_max_datetime": "2022-02-28T09:46:14.000Z", "max_stars_repo_stars_event_min_datetime": "2015-04-20T21:47:00.000Z", "num_tokens": 66, "size": 196 }
{-# OPTIONS --without-K --safe #-} open import Categories.Category using () renaming (Category to Setoid-Category) open import Categories.Category.Monoidal using (Monoidal) module Categories.Enriched.Functor {o ℓ e} {V : Setoid-Category o ℓ e} (M : Monoidal V) where open import Level open import Categories.Enriched.Category M open import Categories.Functor using () renaming (Functor to Setoid-Functor) open import Categories.Morphism.Reasoning V open import Categories.Category.Monoidal.Reasoning M using (⊗-distrib-over-∘) open Setoid-Category V renaming (Obj to ObjV; id to idV) open Commutation open HomReasoning open Monoidal M record Functor {c d} (C : Category c) (D : Category d) : Set (ℓ ⊔ e ⊔ c ⊔ d) where eta-equality private module C = Category C module D = Category D field map₀ : C.Obj → D.Obj map₁ : ∀ {X Y} → C [ X , Y ] ⇒ D [ map₀ X , map₀ Y ] identity : ∀ {X} → map₁ ∘ C.id ≈ D.id {map₀ X} homomorphism : ∀ {X Y Z} → [ C [ Y , Z ] ⊗₀ C [ X , Y ] ⇒ D [ map₀ X , map₀ Z ] ]⟨ C.⊚ ⇒⟨ C [ X , Z ] ⟩ map₁ ≈ map₁ ⊗₁ map₁ ⇒⟨ D [ _ , _ ] ⊗₀ D [ _ , _ ] ⟩ D.⊚ ⟩ -- We don't need an analogue of F-resp-≈ because |hom A B| is not -- a hom-Setoid but a hom-object (in V) and the functorial action -- is not a Setoid-map but a V-morphism. Whether V-objects have a -- notion of equality, and whether such equalities are preserved -- by V-morphisms, depends entirely on V. -- Shorthands for the functorial actions that work well as -- post-projections. ₀ = map₀ ₁ = map₁ Endofunctor : ∀ {c} → Category c → Set (ℓ ⊔ e ⊔ c) Endofunctor C = Functor C C id : ∀ {c} {C : Category c} → Endofunctor C id {_} {C} = record { map₀ = λ X → X ; map₁ = idV ; identity = identityˡ ; homomorphism = id-comm-sym ○ ∘-resp-≈ʳ (⟺ ⊗.identity) } where open Category C module ⊗ = Setoid-Functor ⊗ infixr 9 _∘F_ _∘F_ : ∀ {c d e} {C : Category c} {D : Category d} {E : Category e} → Functor D E → Functor C D → Functor C E _∘F_ {_} {_} {_} {C} {D} {E} G F = record { map₀ = λ X → G.₀ (F.₀ X) ; map₁ = G.₁ ∘ F.₁ ; identity = begin (G.₁ ∘ F.₁) ∘ C.id ≈⟨ pullʳ F.identity ⟩ G.₁ ∘ D.id ≈⟨ G.identity ⟩ E.id ∎ ; homomorphism = begin (G.₁ ∘ F.₁) ∘ C.⊚ ≈⟨ pullʳ F.homomorphism ⟩ G.₁ ∘ (D.⊚ ∘ F.₁ ⊗₁ F.₁) ≈⟨ pullˡ G.homomorphism ⟩ (E.⊚ ∘ G.₁ ⊗₁ G.₁) ∘ F.₁ ⊗₁ F.₁ ≈˘⟨ pushʳ ⊗-distrib-over-∘ ⟩ E.⊚ ∘ (G.₁ ∘ F.₁) ⊗₁ (G.₁ ∘ F.₁) ∎ } where module C = Category C module D = Category D module E = Category E module F = Functor F module G = Functor G -- A V-enriched functor induces an ordinary functor on the underlying -- categories. module _ {c d} {C : Category c} {D : Category d} where UnderlyingFunctor : Functor C D → Setoid-Functor (Underlying C) (Underlying D) UnderlyingFunctor F = record { F₀ = F.₀ ; F₁ = F.₁ ∘_ ; identity = F.identity ; homomorphism = λ {_} {_} {_} {f} {g} → begin F.₁ ∘ C.⊚ ∘ g ⊗₁ f ∘ λ⇐ ≈⟨ pullˡ F.homomorphism ⟩ (D.⊚ ∘ F.₁ ⊗₁ F.₁) ∘ g ⊗₁ f ∘ λ⇐ ≈˘⟨ pushʳ (pushˡ ⊗-distrib-over-∘) ⟩ D.⊚ ∘ (F.₁ ∘ g) ⊗₁ (F.₁ ∘ f) ∘ λ⇐ ∎ ; F-resp-≈ = ∘-resp-≈ʳ } where module C = Category C module D = Category D module F = Functor F λ⇐ = unitorˡ.to module UnderlyingFunctor F = Setoid-Functor (UnderlyingFunctor F)
{ "alphanum_fraction": 0.5501817165, "avg_line_length": 31.9375, "ext": "agda", "hexsha": "80d982f485bca48cea84c66392a3845fd03303da", "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": "58e5ec015781be5413bdf968f7ec4fdae0ab4b21", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "MirceaS/agda-categories", "max_forks_repo_path": "src/Categories/Enriched/Functor.agda", "max_issues_count": null, "max_issues_repo_head_hexsha": "58e5ec015781be5413bdf968f7ec4fdae0ab4b21", "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": "MirceaS/agda-categories", "max_issues_repo_path": "src/Categories/Enriched/Functor.agda", "max_line_length": 82, "max_stars_count": null, "max_stars_repo_head_hexsha": "58e5ec015781be5413bdf968f7ec4fdae0ab4b21", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "MirceaS/agda-categories", "max_stars_repo_path": "src/Categories/Enriched/Functor.agda", "max_stars_repo_stars_event_max_datetime": null, "max_stars_repo_stars_event_min_datetime": null, "num_tokens": 1386, "size": 3577 }
------------------------------------------------------------------------ -- The Agda standard library -- -- Unsafe machine word operations ------------------------------------------------------------------------ {-# OPTIONS --with-K #-} module Data.Word.Unsafe where import Data.Nat as ℕ open import Data.Word using (Word64; toℕ) open import Relation.Nullary using (Dec; yes; no) open import Relation.Binary.PropositionalEquality using (_≡_; refl) open import Relation.Binary.PropositionalEquality.TrustMe ------------------------------------------------------------------------ -- An informative equality test. _≟_ : (a b : Word64) → Dec (a ≡ b) a ≟ b with toℕ a ℕ.≟ toℕ b ... | yes _ = yes trustMe ... | no _ = no whatever where postulate whatever : _
{ "alphanum_fraction": 0.5052493438, "avg_line_length": 30.48, "ext": "agda", "hexsha": "42a8e90525f55921ff15561d95d2e49989a5a8f4", "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/Data/Word/Unsafe.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/Word/Unsafe.agda", "max_line_length": 72, "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/Data/Word/Unsafe.agda", "max_stars_repo_stars_event_max_datetime": null, "max_stars_repo_stars_event_min_datetime": null, "num_tokens": 162, "size": 762 }
{-# OPTIONS --without-K --rewriting #-} open import HoTT open import cohomology.Theory open import groups.Exactness open import groups.ExactSequence open import cw.CW module cw.cohomology.HigherCoboundaryGrid {i} (OT : OrdinaryTheory i) {n} (⊙skel : ⊙Skeleton {i} (S (S n))) (ac : ⊙has-cells-with-choice 0 ⊙skel i) where open OrdinaryTheory OT open import cw.cohomology.WedgeOfCells OT open import cw.cohomology.HigherCoboundary OT ⊙skel open import cw.cohomology.GridPtdMap (⊙cw-incl-last (⊙cw-init ⊙skel)) (⊙cw-incl-last ⊙skel) import cw.cohomology.GridLongExactSequence private module GLES n = cw.cohomology.GridLongExactSequence cohomology-theory n (⊙cw-incl-last (⊙cw-init ⊙skel)) (⊙cw-incl-last ⊙skel) {- Xn --> X(n+1) -----> X(n+2) | | | v v v 1 -> X(n+1)/n ---> X(n+2)/n | this | v one v 1 -----> X(n+2)/(n+1) -} private n≤SSn : n ≤ S (S n) n≤SSn = inr (ltSR ltS) private -- separate lemmas to speed up the type checking abstract lemma₀-exact₀ : is-exact (C-fmap (ℕ-to-ℤ (S n)) Z/X-to-Z/Y) (C-fmap (ℕ-to-ℤ (S n)) Y/X-to-Z/X) lemma₀-exact₀ = exact-seq-index 2 $ GLES.C-grid-cofiber-exact-seq (ℕ-to-ℤ n) lemma₀-exact₁ : is-exact (C-fmap (ℕ-to-ℤ (S n)) Y/X-to-Z/X) cw-co∂-last lemma₀-exact₁ = exact-seq-index 0 $ GLES.C-grid-cofiber-exact-seq (ℕ-to-ℤ (S n)) lemma₀-trivial : is-trivialᴳ (C (ℕ-to-ℤ (S n)) Z/Y) lemma₀-trivial = CXₙ/Xₙ₋₁-<-is-trivial ⊙skel ltS ac Ker-cw-co∂-last : C (ℕ-to-ℤ (S n)) (⊙Cofiber (⊙cw-incl-tail n≤SSn ⊙skel)) ≃ᴳ Ker.grp cw-co∂-last Ker-cw-co∂-last = Exact2.G-trivial-implies-H-iso-ker lemma₀-exact₀ lemma₀-exact₁ lemma₀-trivial private -- separate lemmas to speed up the type checking abstract lemma₁-exact₀ : is-exact cw-co∂-last (C-fmap (ℕ-to-ℤ (S (S n))) Z/X-to-Z/Y) lemma₁-exact₀ = exact-seq-index 1 $ GLES.C-grid-cofiber-exact-seq (ℕ-to-ℤ (S n)) lemma₁-exact₁ : is-exact (C-fmap (ℕ-to-ℤ (S (S n))) Z/X-to-Z/Y) (C-fmap (ℕ-to-ℤ (S (S n))) Y/X-to-Z/X) lemma₁-exact₁ = exact-seq-index 2 $ GLES.C-grid-cofiber-exact-seq (ℕ-to-ℤ (S n)) lemma₁-trivial : is-trivialᴳ (C (ℕ-to-ℤ (S (S n))) Y/X) lemma₁-trivial = CXₙ/Xₙ₋₁->-is-trivial (⊙cw-init ⊙skel) ltS (⊙init-has-cells-with-choice ⊙skel ac) Coker-cw-co∂-last : CokerCo∂ ≃ᴳ C (ℕ-to-ℤ (S (S n))) (⊙Cofiber (⊙cw-incl-tail n≤SSn ⊙skel)) Coker-cw-co∂-last = Exact2.L-trivial-implies-coker-iso-K lemma₁-exact₀ lemma₁-exact₁ (CXₙ/Xₙ₋₁-is-abelian ⊙skel (ℕ-to-ℤ (S (S n)))) lemma₁-trivial
{ "alphanum_fraction": 0.6177039041, "avg_line_length": 35.4383561644, "ext": "agda", "hexsha": "5ac8179a4234ff43260df77ae9252f56d23d3167", "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/cw/cohomology/HigherCoboundaryGrid.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/cw/cohomology/HigherCoboundaryGrid.agda", "max_line_length": 91, "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/cw/cohomology/HigherCoboundaryGrid.agda", "max_stars_repo_stars_event_max_datetime": null, "max_stars_repo_stars_event_min_datetime": null, "num_tokens": 1092, "size": 2587 }
-- Andreas, 2019-04-10, re #3687, better test case for #1926 -- {-# OPTIONS -v interaction.contents.record:20 #-} module _ (Foo : Set) where open import Agda.Builtin.Sigma test : {A : Set} {B : A → Set} (r : Σ A B) → Set test r = {!r!} -- C-c C-o
{ "alphanum_fraction": 0.5992063492, "avg_line_length": 22.9090909091, "ext": "agda", "hexsha": "736d9f11255104d02542789e5b656cb8ad2a1654", "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/Issue1926.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/Issue1926.agda", "max_line_length": 60, "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/Issue1926.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": 93, "size": 252 }
{- Conatural numbers (Tesla Ice Zhang, Feb. 2019) This file defines: - A coinductive natural number representation which is dual to the inductive version (zero | suc Nat → Nat) of natural numbers. - Trivial operations (succ, pred) and the pattern synonyms on conaturals. While this definition can be seen as a coinductive wrapper of an inductive datatype, another way of definition is to define an inductive datatype that wraps a coinductive thunk of Nat. The standard library uses the second approach: https://github.com/agda/agda-stdlib/blob/master/src/Codata/Conat.agda The first approach is chosen to exploit guarded recursion and to avoid the use of Sized Types. -} {-# OPTIONS --cubical --no-import-sorts --safe --guardedness #-} module Cubical.Codata.Conat.Base where open import Cubical.Data.Unit open import Cubical.Data.Sum open import Cubical.Core.Everything record Conat : Type₀ Conat′ = Unit ⊎ Conat record Conat where coinductive constructor conat′ field force : Conat′ open Conat public pattern zero = inl tt pattern suc n = inr n conat : Conat′ → Conat force (conat a) = a succ : Conat → Conat force (succ a) = suc a succ′ : Conat′ → Conat′ succ′ n = suc λ where .force → n pred′ : Conat′ → Conat′ pred′ zero = zero pred′ (suc x) = force x pred′′ : Conat′ → Conat force (pred′′ zero) = zero pred′′ (suc x) = x
{ "alphanum_fraction": 0.7319054653, "avg_line_length": 24.1785714286, "ext": "agda", "hexsha": "2bfe565a9bf83b6a3fcf9691015ba9d7c2d82346", "lang": "Agda", "max_forks_count": 1, "max_forks_repo_forks_event_max_datetime": "2021-11-22T02:02:01.000Z", "max_forks_repo_forks_event_min_datetime": "2021-11-22T02:02:01.000Z", "max_forks_repo_head_hexsha": "fd8059ec3eed03f8280b4233753d00ad123ffce8", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "dan-iel-lee/cubical", "max_forks_repo_path": "Cubical/Codata/Conat/Base.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/Codata/Conat/Base.agda", "max_line_length": 78, "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/Codata/Conat/Base.agda", "max_stars_repo_stars_event_max_datetime": null, "max_stars_repo_stars_event_min_datetime": null, "num_tokens": 392, "size": 1354 }
-- Andreas, 2016-06-21, issue #2054 -- Size solver should not default to ∞ in where block signatures -- {-# OPTIONS --v tc.size:20 #-} -- {-# BUILTIN SIZEUNIV SizeU #-} -- {-# BUILTIN SIZE Size #-} -- {-# BUILTIN SIZESUC ↑_ #-} -- {-# BUILTIN SIZEINF ∞ #-} open import Common.Size data N : Size → Set where suc : ∀{i} (a : N i) → N (↑ i) record R (j : Size) : Set where field num : N j postulate W : ∀ {j} (ft : R j) → Set E : ∀ {j} (ft : R j) (P : (w : W ft) → Set) → Set test : ∀ {j} (ft : R j) → Set test {j} ft = E {j} ft testw where postulate testw : ∀ {ft : R _} (w : W ft) → Set -- Should work -- _ should not set to ∞, but to j
{ "alphanum_fraction": 0.5205882353, "avg_line_length": 21.935483871, "ext": "agda", "hexsha": "a828fac8b09d10bac596265faeaff4cd2f410062", "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/Issue2054.agda", "max_issues_count": 3, "max_issues_repo_head_hexsha": "ed8ac6f4062ea8a20fa0f62d5db82d4e68278338", "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": "shlevy/agda", "max_issues_repo_path": "test/Succeed/Issue2054.agda", "max_line_length": 64, "max_stars_count": 3, "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/Issue2054.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": 257, "size": 680 }
open import Agda.Builtin.Nat data Vec (A : Set) : Nat → Set where [] : Vec A 0 cons : (n : Nat) → A → Vec A n → Vec A (suc n) tail : {A : Set} (n : Nat) → Vec A (suc n) → Vec A n tail n (cons n x xs) = xs tail' : {A : Set} (n : Nat) → Vec A (suc n) → Vec A n tail' 0 (cons 0 x []) = [] tail' (suc n) (cons (suc n) x (cons n x₁ xs)) = (cons n x₁ xs)
{ "alphanum_fraction": 0.5168539326, "avg_line_length": 27.3846153846, "ext": "agda", "hexsha": "cb160dc6dfebd8b91ccba3674d3bafb50e1537c4", "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/ImplicitlyDottedVariable.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/ImplicitlyDottedVariable.agda", "max_line_length": 62, "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/ImplicitlyDottedVariable.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": 156, "size": 356 }
{-# OPTIONS --without-K --safe #-} open import Definition.Typed.EqualityRelation module Definition.LogicalRelation.Properties.Successor {{eqrel : EqRelSet}} where open EqRelSet {{...}} open import Definition.Untyped open import Definition.Typed open import Definition.Typed.Properties open import Definition.LogicalRelation open import Definition.LogicalRelation.Irrelevance open import Definition.LogicalRelation.ShapeView open import Tools.Embedding open import Tools.Product -- Helper function for successors for specific reducible derivations. sucTerm′ : ∀ {l Γ n} ([ℕ] : Γ ⊩⟨ l ⟩ℕ ℕ) → Γ ⊩⟨ l ⟩ n ∷ ℕ / ℕ-intr [ℕ] → Γ ⊩⟨ l ⟩ suc n ∷ ℕ / ℕ-intr [ℕ] sucTerm′ (noemb D) (ιx (ℕₜ n [ ⊢t , ⊢u , d ] n≡n prop)) = let natN = natural prop in ιx (ℕₜ _ [ sucⱼ ⊢t , sucⱼ ⊢t , id (sucⱼ ⊢t) ] (≅-suc-cong (≅ₜ-red (red D) d d ℕₙ (naturalWhnf natN) (naturalWhnf natN) n≡n)) (sucᵣ (ℕₜ n [ ⊢t , ⊢u , d ] n≡n prop))) sucTerm′ (emb 0<1 x) (ιx [n]) = ιx (sucTerm′ x [n]) -- Reducible natural numbers can be used to construct reducible successors. sucTerm : ∀ {l Γ n} ([ℕ] : Γ ⊩⟨ l ⟩ ℕ) → Γ ⊩⟨ l ⟩ n ∷ ℕ / [ℕ] → Γ ⊩⟨ l ⟩ suc n ∷ ℕ / [ℕ] sucTerm [ℕ] [n] = let [n]′ = irrelevanceTerm [ℕ] (ℕ-intr (ℕ-elim [ℕ])) [n] in irrelevanceTerm (ℕ-intr (ℕ-elim [ℕ])) [ℕ] (sucTerm′ (ℕ-elim [ℕ]) [n]′) -- Helper function for successor equality for specific reducible derivations. sucEqTerm′ : ∀ {l Γ n n′} ([ℕ] : Γ ⊩⟨ l ⟩ℕ ℕ) → Γ ⊩⟨ l ⟩ n ≡ n′ ∷ ℕ / ℕ-intr [ℕ] → Γ ⊩⟨ l ⟩ suc n ≡ suc n′ ∷ ℕ / ℕ-intr [ℕ] sucEqTerm′ (noemb D) (ιx (ℕₜ₌ k k′ [ ⊢t , ⊢u , d ] [ ⊢t₁ , ⊢u₁ , d₁ ] t≡u prop)) = let natK , natK′ = split prop in ιx (ℕₜ₌ _ _ (idRedTerm:*: (sucⱼ ⊢t)) (idRedTerm:*: (sucⱼ ⊢t₁)) (≅-suc-cong (≅ₜ-red (red D) d d₁ ℕₙ (naturalWhnf natK) (naturalWhnf natK′) t≡u)) (sucᵣ (ℕₜ₌ k k′ [ ⊢t , ⊢u , d ] [ ⊢t₁ , ⊢u₁ , d₁ ] t≡u prop))) sucEqTerm′ (emb 0<1 x) (ιx [n≡n′]) = ιx (sucEqTerm′ x [n≡n′]) -- Reducible natural number equality can be used to construct reducible equality -- of the successors of the numbers. sucEqTerm : ∀ {l Γ n n′} ([ℕ] : Γ ⊩⟨ l ⟩ ℕ) → Γ ⊩⟨ l ⟩ n ≡ n′ ∷ ℕ / [ℕ] → Γ ⊩⟨ l ⟩ suc n ≡ suc n′ ∷ ℕ / [ℕ] sucEqTerm [ℕ] [n≡n′] = let [n≡n′]′ = irrelevanceEqTerm [ℕ] (ℕ-intr (ℕ-elim [ℕ])) [n≡n′] in irrelevanceEqTerm (ℕ-intr (ℕ-elim [ℕ])) [ℕ] (sucEqTerm′ (ℕ-elim [ℕ]) [n≡n′]′)
{ "alphanum_fraction": 0.5379771743, "avg_line_length": 39.703125, "ext": "agda", "hexsha": "e36e0e48ce04b50b7eefc6c33d2f838d95d7e869", "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": "2251b8da423be0c6fb916f2675d7bd8537e4cd96", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "loic-p/logrel-mltt", "max_forks_repo_path": "Definition/LogicalRelation/Properties/Successor.agda", "max_issues_count": null, "max_issues_repo_head_hexsha": "2251b8da423be0c6fb916f2675d7bd8537e4cd96", "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": "loic-p/logrel-mltt", "max_issues_repo_path": "Definition/LogicalRelation/Properties/Successor.agda", "max_line_length": 88, "max_stars_count": null, "max_stars_repo_head_hexsha": "2251b8da423be0c6fb916f2675d7bd8537e4cd96", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "loic-p/logrel-mltt", "max_stars_repo_path": "Definition/LogicalRelation/Properties/Successor.agda", "max_stars_repo_stars_event_max_datetime": null, "max_stars_repo_stars_event_min_datetime": null, "num_tokens": 1099, "size": 2541 }
open import Nat open import Prelude open import core open import contexts open import typed-elaboration open import lemmas-gcomplete open import lemmas-complete module complete-elaboration where mutual complete-elaboration-synth : ∀{e τ Γ Δ d} → Γ gcomplete → e ecomplete → Γ ⊢ e ⇒ τ ~> d ⊣ Δ → (d dcomplete × τ tcomplete × Δ == ∅) complete-elaboration-synth gc ec ESConst = DCConst , TCBase , refl complete-elaboration-synth gc ec (ESVar x₁) = DCVar , gc _ _ x₁ , refl complete-elaboration-synth gc (ECLam2 ec x₁) (ESLam x₂ exp) with complete-elaboration-synth (gcomp-extend gc x₁ x₂) ec exp ... | ih1 , ih2 , ih3 = DCLam ih1 x₁ , TCArr x₁ ih2 , ih3 complete-elaboration-synth gc (ECAp ec ec₁) (ESAp _ _ x MAHole x₂ x₃) with comp-synth gc ec x ... | () complete-elaboration-synth gc (ECAp ec ec₁) (ESAp {Δ1 = Δ1} {Δ2 = Δ2} _ _ x MAArr x₂ x₃) with comp-synth gc ec x ... | TCArr t1 t2 with complete-elaboration-ana gc ec (TCArr t1 t2) x₂ | complete-elaboration-ana gc ec₁ t1 x₃ ... | ih1 , _ , ih4 | ih2 , _ , ih3 = DCAp (DCCast ih1 (comp-ana gc x₂ ih1) (TCArr t1 t2)) (DCCast ih2 (comp-ana gc x₃ ih2) t1) , t2 , tr (λ qq → (qq ∪ Δ2) == ∅) (! ih4) (tr (λ qq → (∅ ∪ qq) == ∅) (! ih3) refl) complete-elaboration-synth gc () ESEHole complete-elaboration-synth gc () (ESNEHole _ exp) complete-elaboration-synth gc (ECAsc x ec) (ESAsc x₁) with complete-elaboration-ana gc ec x x₁ ... | ih1 , _ , ih2 = DCCast ih1 (comp-ana gc x₁ ih1) x , x , ih2 complete-elaboration-ana : ∀{e τ τ' Γ Δ d} → Γ gcomplete → e ecomplete → τ tcomplete → Γ ⊢ e ⇐ τ ~> d :: τ' ⊣ Δ → (d dcomplete × τ' tcomplete × Δ == ∅) complete-elaboration-ana gc (ECLam1 ec) () (EALam x₁ MAHole exp) complete-elaboration-ana gc (ECLam1 ec) (TCArr t1 t2) (EALam x₁ MAArr exp) with complete-elaboration-ana (gcomp-extend gc t1 x₁) ec t2 exp ... | ih , ih3 , ih2 = DCLam ih t1 , TCArr t1 ih3 , ih2 complete-elaboration-ana gc ec tc (EASubsume x x₁ x₂ x₃) with complete-elaboration-synth gc ec x₂ ... | ih1 , ih2 , ih3 = ih1 , ih2 , ih3 -- this is just a convenience since it shows up a few times above comp-ana : ∀{Γ e τ d τ' Δ} → Γ gcomplete → Γ ⊢ e ⇐ τ ~> d :: τ' ⊣ Δ → d dcomplete → τ' tcomplete comp-ana gc ex dc = complete-ta gc (π2 (typed-elaboration-ana ex)) dc
{ "alphanum_fraction": 0.5505494505, "avg_line_length": 47.0689655172, "ext": "agda", "hexsha": "f58d226e93dc40b3e4292001399afcdbbc9fd557", "lang": "Agda", "max_forks_count": 1, "max_forks_repo_forks_event_max_datetime": "2019-09-13T18:20:02.000Z", "max_forks_repo_forks_event_min_datetime": "2019-09-13T18:20:02.000Z", "max_forks_repo_head_hexsha": "229dfb06ea51ebe91cb3b1c973c2f2792e66797c", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "hazelgrove/hazelnut-dynamics-agda", "max_forks_repo_path": "complete-elaboration.agda", "max_issues_count": 54, "max_issues_repo_head_hexsha": "229dfb06ea51ebe91cb3b1c973c2f2792e66797c", "max_issues_repo_issues_event_max_datetime": "2018-11-29T16:32:40.000Z", "max_issues_repo_issues_event_min_datetime": "2017-06-29T20:53:34.000Z", "max_issues_repo_licenses": [ "MIT" ], "max_issues_repo_name": "hazelgrove/hazelnut-dynamics-agda", "max_issues_repo_path": "complete-elaboration.agda", "max_line_length": 134, "max_stars_count": 16, "max_stars_repo_head_hexsha": "229dfb06ea51ebe91cb3b1c973c2f2792e66797c", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "hazelgrove/hazelnut-dynamics-agda", "max_stars_repo_path": "complete-elaboration.agda", "max_stars_repo_stars_event_max_datetime": "2021-12-19T02:50:23.000Z", "max_stars_repo_stars_event_min_datetime": "2018-03-12T14:32:03.000Z", "num_tokens": 934, "size": 2730 }
------------------------------------------------------------------------ -- Universe levels ------------------------------------------------------------------------ module Common.Level where postulate Level : Set lzero : Level lsuc : (i : Level) → Level _⊔_ : Level -> Level -> Level {-# IMPORT Common.FFI #-} {-# COMPILED_TYPE Level Common.FFI.Level #-} {-# COMPILED lzero Common.FFI.Zero #-} {-# COMPILED lsuc Common.FFI.Suc #-} {-# BUILTIN LEVEL Level #-} {-# BUILTIN LEVELZERO lzero #-} {-# BUILTIN LEVELSUC lsuc #-} {-# BUILTIN LEVELMAX _⊔_ #-} infixl 6 _⊔_ -- Lifting. record Lift {a ℓ} (A : Set a) : Set (a ⊔ ℓ) where constructor lift field lower : A open Lift public
{ "alphanum_fraction": 0.4929378531, "avg_line_length": 21.4545454545, "ext": "agda", "hexsha": "e755024662bafda81ff041a6c9b11b73f127cc36", "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": "20596e9dd9867166a64470dd24ea68925ff380ce", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "np/agda-git-experiment", "max_forks_repo_path": "test/Common/Level.agda", "max_issues_count": null, "max_issues_repo_head_hexsha": "20596e9dd9867166a64470dd24ea68925ff380ce", "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": "np/agda-git-experiment", "max_issues_repo_path": "test/Common/Level.agda", "max_line_length": 72, "max_stars_count": 1, "max_stars_repo_head_hexsha": "20596e9dd9867166a64470dd24ea68925ff380ce", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "np/agda-git-experiment", "max_stars_repo_path": "test/Common/Level.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": 185, "size": 708 }
module Forcing4 where open import Common.Nat renaming (zero to Z; suc to S) open import Lib.Fin open import Common.Equality open import Common.String open import Common.IO open import Common.Unit {- toNat : {n : Nat} → Fin n → Nat toNat (zero _) = 0 toNat (suc _ i) = suc (toNat i) -} Rel : (X : Set) -> Set1 Rel X = X -> X -> Set data _<=_ : Rel Nat where z<=n : ∀ n → Z <= n s<=s : ∀ m n (m<=n : m <= n) → S m <= S n _ℕ<_ : Rel Nat m ℕ< n = S m <= n fromℕ≤ : ∀ {m n} → m ℕ< n → Fin n fromℕ≤ (s<=s .0 n (z<=n .n)) = fz {n} fromℕ≤ (s<=s .(S m) .(S n) (s<=s m n m<=n)) = fs {S n} (fromℕ≤ (s<=s m n m<=n)) fromℕ≤-toℕ : ∀ m (i : Fin m) (i<m : forget i ℕ< m) → fromℕ≤ i<m ≡ i fromℕ≤-toℕ .(S n) (fz {n}) (s<=s .0 .n (z<=n .n)) = refl fromℕ≤-toℕ .(S (S n)) (fs .{S n} y) (s<=s .(S (forget y)) .(S n) (s<=s .(forget y) n m≤n)) = cong (\ n -> fs n) (fromℕ≤-toℕ (S n) y (s<=s (forget y) n m≤n)) [_/2] : Nat -> Nat [ 0 /2] = 0 [ 1 /2] = 0 [ S (S n) /2] = S [ n /2] [1/2]-mono : (m n : Nat) -> m <= n -> [ m /2] <= [ n /2] [1/2]-mono .0 .n (z<=n n) = z<=n [ n /2] [1/2]-mono .1 .(S n) (s<=s .0 .n (z<=n n)) = z<=n [ S n /2] [1/2]-mono .(S (S m)) .(S (S n)) (s<=s .(S m) .(S n) (s<=s m n m<=n)) = s<=s [ m /2] [ n /2] ([1/2]-mono m n m<=n) showEq : {X : Set}{A : X} -> A ≡ A -> String showEq refl = "refl" show<= : {m n : Nat} -> m <= n -> String show<= (z<=n n) = "0 <= " +S+ natToString n show<= (s<=s m n m<=n) = natToString (S m) +S+ " <= " +S+ natToString (S n) data Bot : Set where -- Only to check that it compiles.. foo : (n : Nat) -> S n <= n -> Bot foo .(S n) (s<=s .(S n) n le) = foo n le main : IO Unit main = putStrLn (showEq (fromℕ≤-toℕ 3 (inc (inject 1)) le)) ,, putStrLn (show<= ([1/2]-mono 4 6 le')) where le : 2 <= 3 le = s<=s _ _ (s<=s _ _ (z<=n _)) le' : 4 <= 6 le' = s<=s _ _ (s<=s _ _ (s<=s _ _ (s<=s _ _ (z<=n _))))
{ "alphanum_fraction": 0.4630021142, "avg_line_length": 28.6666666667, "ext": "agda", "hexsha": "58139761632cc12e0a44ba2fc45c5242c78f4849", "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/Compiler/simple/Forcing4.agda", "max_issues_count": 16, "max_issues_repo_head_hexsha": "6043e77e4a72518711f5f808fb4eb593cbf0bb7c", "max_issues_repo_issues_event_max_datetime": "2019-09-08T13:47:04.000Z", "max_issues_repo_issues_event_min_datetime": "2018-10-08T00:32:04.000Z", "max_issues_repo_licenses": [ "BSD-3-Clause" ], "max_issues_repo_name": "alhassy/agda", "max_issues_repo_path": "test/Compiler/simple/Forcing4.agda", "max_line_length": 156, "max_stars_count": 7, "max_stars_repo_head_hexsha": "6043e77e4a72518711f5f808fb4eb593cbf0bb7c", "max_stars_repo_licenses": [ "BSD-3-Clause" ], "max_stars_repo_name": "alhassy/agda", "max_stars_repo_path": "test/Compiler/simple/Forcing4.agda", "max_stars_repo_stars_event_max_datetime": "2018-11-06T16:38:43.000Z", "max_stars_repo_stars_event_min_datetime": "2018-11-05T22:13:36.000Z", "num_tokens": 926, "size": 1892 }
module NatIf3 where open import Data.Nat open import Data.Vec natIf3 : (a : Set) -> a -> a -> a -> ℕ -> a natIf3 a x y z zero = x natIf3 a x y z (suc zero) = y natIf3 a x y z (suc (suc n)) = z nilNat : Vec ℕ 0 nilNat = [] --test1 = natIf3 _ 1 nilNat 3 0 test2 = natIf3 _ nilNat 2 3 0
{ "alphanum_fraction": 0.6089965398, "avg_line_length": 17, "ext": "agda", "hexsha": "16a9389fee61c23fd79e5e2999be09a0f7158dc5", "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": "64a1b4c6632153d75cba540f7c91f40b49375e2f", "max_forks_repo_licenses": [ "BSD-3-Clause" ], "max_forks_repo_name": "JoeyEremondi/lambda-pi-constraint", "max_forks_repo_path": "examples/NatIf3.agda", "max_issues_count": null, "max_issues_repo_head_hexsha": "64a1b4c6632153d75cba540f7c91f40b49375e2f", "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": "JoeyEremondi/lambda-pi-constraint", "max_issues_repo_path": "examples/NatIf3.agda", "max_line_length": 43, "max_stars_count": 16, "max_stars_repo_head_hexsha": "64a1b4c6632153d75cba540f7c91f40b49375e2f", "max_stars_repo_licenses": [ "BSD-3-Clause" ], "max_stars_repo_name": "JoeyEremondi/lambda-pi-constraint", "max_stars_repo_path": "examples/NatIf3.agda", "max_stars_repo_stars_event_max_datetime": "2021-02-05T20:21:46.000Z", "max_stars_repo_stars_event_min_datetime": "2017-03-16T11:14:56.000Z", "num_tokens": 127, "size": 289 }
{-# OPTIONS --exact-split #-} {-# OPTIONS --no-sized-types #-} {-# OPTIONS --no-universe-polymorphism #-} {-# OPTIONS --without-K #-} module FOT.Common.FOL.Existential.Syntax where -- We add 3 to the fixities of the Agda standard library 0.8.1 (see -- Relation.Binary.Core). infix 7 _≡_ postulate D : Set _≡_ : D → D → Set refl : ∀ {d} → d ≡ d d : D module ∃₁ where -- We add 3 to the fixities of the Agda standard library 0.8.1 (see -- Data/Product.agda, Data/Sum.agda and Relation/Nullary/Core.agda). infixr 7 _,_ infix 5 ∃ data ∃ (P : D → Set) : Set where _,_ : (x : D) → P x → ∃ P syntax ∃ (λ x → e) = ∃[ x ] e t₁ : ∃ λ x → x ≡ x t₁ = d , refl t₂ : ∃[ x ] x ≡ x t₂ = d , refl t₃ : ∃ λ x → ∃ λ y → x ≡ y t₃ = d , d , refl t₄ : ∃[ x ] ∃[ y ] x ≡ y t₄ = d , d , refl module ∃₂ where infixr 7 _,_,_ data ∃₂ (P : D → D → Set) : Set where _,_,_ : (x y : D) → P x y → ∃₂ P -- Agda issue: 536 -- syntax ∃₂ (λ x y → e) = ∃₂[ x , y ] e t₁ : ∃₂ λ x y → x ≡ y t₁ = d , d , refl
{ "alphanum_fraction": 0.4931129477, "avg_line_length": 20.5471698113, "ext": "agda", "hexsha": "7c1f9ed4bf1ee29126f97c0215b073851f7f8edf", "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/Common/FOL/Existential/Syntax.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/Common/FOL/Existential/Syntax.agda", "max_line_length": 70, "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/Common/FOL/Existential/Syntax.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": 459, "size": 1089 }
module prelude.int where open import Data.Nat as Nat renaming (suc to s; zero to z) open import Agda.Builtin.Int public ⁺1 : Int → Int ⁺1 (pos n) = pos (s n) ⁺1 (negsuc z) = pos z ⁺1 (negsuc (s n)) = negsuc n ⁻1 : Int → Int ⁻1 (pos Nat.zero) = negsuc Nat.zero ⁻1 (pos (Nat.suc n)) = pos n ⁻1 (negsuc n) = negsuc (Nat.suc n)
{ "alphanum_fraction": 0.6319018405, "avg_line_length": 23.2857142857, "ext": "agda", "hexsha": "269379a9de8fd7a098ff0ee4cb97af244611b457", "lang": "Agda", "max_forks_count": 4, "max_forks_repo_forks_event_max_datetime": "2022-01-30T11:45:57.000Z", "max_forks_repo_forks_event_min_datetime": "2021-07-10T17:19:37.000Z", "max_forks_repo_head_hexsha": "425de958985aacbd3284d3057fe21fd682e315ea", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "dspivak/poly", "max_forks_repo_path": "code-examples/agda/prelude/int.agda", "max_issues_count": 2, "max_issues_repo_head_hexsha": "425de958985aacbd3284d3057fe21fd682e315ea", "max_issues_repo_issues_event_max_datetime": "2022-01-12T10:06:32.000Z", "max_issues_repo_issues_event_min_datetime": "2021-09-02T02:29:39.000Z", "max_issues_repo_licenses": [ "MIT" ], "max_issues_repo_name": "dspivak/poly", "max_issues_repo_path": "code-examples/agda/prelude/int.agda", "max_line_length": 58, "max_stars_count": 53, "max_stars_repo_head_hexsha": "425de958985aacbd3284d3057fe21fd682e315ea", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "mstone/poly", "max_stars_repo_path": "code-examples/agda/prelude/int.agda", "max_stars_repo_stars_event_max_datetime": "2022-03-22T23:08:27.000Z", "max_stars_repo_stars_event_min_datetime": "2021-02-18T16:31:04.000Z", "num_tokens": 141, "size": 326 }
{-# OPTIONS --without-K --safe #-} open import Categories.Category module Categories.Category.Cartesian.Properties {o ℓ e} (C : Category o ℓ e) where open import Function using (_$_) open import Categories.Category.Cartesian C open import Categories.Diagram.Pullback C open import Categories.Diagram.Equalizer C open import Categories.Morphism.Reasoning C private open Category C variable A B X Y : Obj f g : A ⇒ B -- all binary products and pullbacks implies equalizers module _ (prods : BinaryProducts) (pullbacks : ∀ {A B X} (f : A ⇒ X) (g : B ⇒ X) → Pullback f g) where open BinaryProducts prods open HomReasoning prods×pullbacks⇒equalizers : Equalizer f g prods×pullbacks⇒equalizers {f = f} {g = g} = record { arr = pb′.p₁ ; equality = begin f ∘ pb′.p₁ ≈⟨ refl⟩∘⟨ helper₁ ⟩ f ∘ pb.p₁ ∘ pb′.p₂ ≈⟨ pullˡ pb.commute ⟩ (g ∘ pb.p₂) ∘ pb′.p₂ ≈˘⟨ pushʳ helper₂ ⟩ g ∘ pb′.p₁ ∎ ; equalize = λ {_ i} eq → pb′.universal $ begin ⟨ id , id ⟩ ∘ i ≈⟨ ⟨⟩∘ ⟩ ⟨ id ∘ i , id ∘ i ⟩ ≈⟨ ⟨⟩-cong₂ identityˡ identityˡ ⟩ ⟨ i , i ⟩ ≈˘⟨ ⟨⟩-cong₂ pb.p₁∘universal≈h₁ pb.p₂∘universal≈h₂ ⟩ ⟨ pb.p₁ ∘ pb.universal eq , pb.p₂ ∘ pb.universal eq ⟩ ≈˘⟨ ⟨⟩∘ ⟩ h ∘ pb.universal eq ∎ ; universal = ⟺ pb′.p₁∘universal≈h₁ ; unique = λ eq → pb′.unique (⟺ eq) (pb.unique (pullˡ (⟺ helper₁) ○ ⟺ eq) (pullˡ (⟺ helper₂) ○ ⟺ eq)) } where pb : Pullback f g pb = pullbacks _ _ module pb = Pullback pb h = ⟨ pb.p₁ , pb.p₂ ⟩ pb′ : Pullback ⟨ id , id ⟩ h pb′ = pullbacks _ _ module pb′ = Pullback pb′ helper₁ : pb′.p₁ ≈ pb.p₁ ∘ pb′.p₂ helper₁ = begin pb′.p₁ ≈˘⟨ cancelˡ project₁ ⟩ π₁ ∘ ⟨ id , id ⟩ ∘ pb′.p₁ ≈⟨ refl⟩∘⟨ pb′.commute ⟩ π₁ ∘ h ∘ pb′.p₂ ≈⟨ pullˡ project₁ ⟩ pb.p₁ ∘ pb′.p₂ ∎ helper₂ : pb′.p₁ ≈ pb.p₂ ∘ pb′.p₂ helper₂ = begin pb′.p₁ ≈˘⟨ cancelˡ project₂ ⟩ π₂ ∘ ⟨ id , id ⟩ ∘ pb′.p₁ ≈⟨ refl⟩∘⟨ pb′.commute ⟩ π₂ ∘ h ∘ pb′.p₂ ≈⟨ pullˡ project₂ ⟩ pb.p₂ ∘ pb′.p₂ ∎
{ "alphanum_fraction": 0.4735112936, "avg_line_length": 38.6507936508, "ext": "agda", "hexsha": "2ab6a7810d32f5c9a98bad1d5461544417a77ab5", "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": "6ebc1349ee79669c5c496dcadd551d5bbefd1972", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "Taneb/agda-categories", "max_forks_repo_path": "Categories/Category/Cartesian/Properties.agda", "max_issues_count": null, "max_issues_repo_head_hexsha": "6ebc1349ee79669c5c496dcadd551d5bbefd1972", "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": "Taneb/agda-categories", "max_issues_repo_path": "Categories/Category/Cartesian/Properties.agda", "max_line_length": 112, "max_stars_count": null, "max_stars_repo_head_hexsha": "6ebc1349ee79669c5c496dcadd551d5bbefd1972", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "Taneb/agda-categories", "max_stars_repo_path": "Categories/Category/Cartesian/Properties.agda", "max_stars_repo_stars_event_max_datetime": null, "max_stars_repo_stars_event_min_datetime": null, "num_tokens": 893, "size": 2435 }
-- Andreas, 2012-11-06 this has been fixed with issue 655 module Issue378 where infix 7 _≡_ infixl 9 _+_ postulate ℕ : Set _≡_ : ℕ → ℕ → Set zero : ℕ _+_ : ℕ → ℕ → ℕ postulate S₁ : ∀ {m n o} → m ≡ n → m ≡ o → n ≡ o S₅ : ∀ n → zero + n ≡ n -- Calling Auto on the hole generates the invalid expression -- S₁ (S₅ .n) (S₅ .n). refl : ∀ {n} → n ≡ n refl = {!-m!} -- C-c C-a should work now
{ "alphanum_fraction": 0.5503685504, "avg_line_length": 18.5, "ext": "agda", "hexsha": "a31928e98a0780ab48ea13fb9624da3cfc471ff9", "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/interaction/Issue378.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/interaction/Issue378.agda", "max_line_length": 60, "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/interaction/Issue378.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": 181, "size": 407 }
------------------------------------------------------------------------ -- The Agda standard library -- -- Creates trivially indexed records from their non-indexed counterpart. ------------------------------------------------------------------------ {-# OPTIONS --without-K --safe #-} module Relation.Binary.Indexed.Heterogeneous.Construct.Trivial {i} {I : Set i} where open import Relation.Binary open import Relation.Binary.Indexed.Heterogeneous hiding (Rel) hiding (IsEquivalence; Setoid) ------------------------------------------------------------------------ -- Structures module _ {a} {A : Set a} where private Aᵢ : I → Set a Aᵢ i = A isIndexedEquivalence : ∀ {ℓ} {_≈_ : Rel A ℓ} → IsEquivalence _≈_ → IsIndexedEquivalence Aᵢ _≈_ isIndexedEquivalence isEq = record { refl = refl ; sym = sym ; trans = trans } where open IsEquivalence isEq isIndexedPreorder : ∀ {ℓ₁ ℓ₂} {_≈_ : Rel A ℓ₁} {_∼_ : Rel A ℓ₂} → IsPreorder _≈_ _∼_ → IsIndexedPreorder Aᵢ _≈_ _∼_ isIndexedPreorder isPreorder = record { isEquivalence = isIndexedEquivalence isEquivalence ; reflexive = reflexive ; trans = trans } where open IsPreorder isPreorder ------------------------------------------------------------------------ -- Packages indexedSetoid : ∀ {a ℓ} → Setoid a ℓ → IndexedSetoid I a ℓ indexedSetoid S = record { isEquivalence = isIndexedEquivalence isEquivalence } where open Setoid S indexedPreorder : ∀ {a ℓ₁ ℓ₂} → Preorder a ℓ₁ ℓ₂ → IndexedPreorder I a ℓ₁ ℓ₂ indexedPreorder O = record { isPreorder = isIndexedPreorder isPreorder } where open Preorder O
{ "alphanum_fraction": 0.5386836028, "avg_line_length": 29.3559322034, "ext": "agda", "hexsha": "0f6de2a7f901958ee376848bae02be71a0898dd0", "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/Relation/Binary/Indexed/Heterogeneous/Construct/Trivial.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/Relation/Binary/Indexed/Heterogeneous/Construct/Trivial.agda", "max_line_length": 72, "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/Relation/Binary/Indexed/Heterogeneous/Construct/Trivial.agda", "max_stars_repo_stars_event_max_datetime": null, "max_stars_repo_stars_event_min_datetime": null, "num_tokens": 464, "size": 1732 }
open import Oscar.Prelude open import Oscar.Class.Reflexivity open import Oscar.Class.Transitivity open import Oscar.Class.Transextensionality open import Oscar.Class.Transassociativity module Oscar.Class.IsPrecategory where module _ {𝔬} {𝔒 : Ø 𝔬} {𝔯} (_∼_ : 𝔒 → 𝔒 → Ø 𝔯) {ℓ} (_∼̇_ : ∀ {x y} → x ∼ y → x ∼ y → Ø ℓ) (let infix 4 _∼̇_ ; _∼̇_ = _∼̇_) (_↦_ : Transitivity.type _∼_) where record IsPrecategory : Ø 𝔬 ∙̂ 𝔯 ∙̂ ℓ where constructor ∁ field ⦃ `𝓣ransextensionality ⦄ : Transextensionality.class _∼_ _∼̇_ _↦_ ⦃ `𝓣ransassociativity ⦄ : Transassociativity.class _∼_ _∼̇_ _↦_
{ "alphanum_fraction": 0.6617647059, "avg_line_length": 29.1428571429, "ext": "agda", "hexsha": "d7646527929992675d20e4ed572795c40f0a523c", "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-3/src/Oscar/Class/IsPrecategory.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-3/src/Oscar/Class/IsPrecategory.agda", "max_line_length": 77, "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-3/src/Oscar/Class/IsPrecategory.agda", "max_stars_repo_stars_event_max_datetime": null, "max_stars_repo_stars_event_min_datetime": null, "num_tokens": 267, "size": 612 }
{- Byzantine Fault Tolerant Consensus Verification in Agda, version 0.9. Copyright (c) 2020, 2021, Oracle and/or its affiliates. Licensed under the Universal Permissive License v 1.0 as shown at https://opensource.oracle.com/licenses/upl -} open import LibraBFT.Prelude module LibraBFT.ImplShared.Util.Dijkstra.EitherD where data EitherD (E : Set) : Set → Set₁ where -- Primitive combinators EitherD-return : ∀ {A} → A → EitherD E A EitherD-bind : ∀ {A B} → EitherD E A → (A → EitherD E B) → EitherD E B EitherD-bail : ∀ {A} → E → EitherD E A -- Branching conditionals (used for creating more convenient contracts) EitherD-if : ∀ {A} → Guards (EitherD E A) → EitherD E A EitherD-either : ∀ {A B C} → Either B C → (B → EitherD E A) → (C → EitherD E A) → EitherD E A EitherD-maybe : ∀ {A B} → Maybe A → EitherD E B → (A → EitherD E B) → EitherD E B pattern LeftD x = EitherD-bail x pattern RightD x = EitherD-return x private variable E : Set A B C : Set EitherD-run : EitherD E A → Either E A EitherD-run (EitherD-return x) = Right x EitherD-run (EitherD-bind m f) with EitherD-run m ... | Left x = Left x ... | Right y = EitherD-run (f y) EitherD-run (EitherD-bail x) = Left x EitherD-run (EitherD-if (clause (b ≔ c) gs)) = if toBool b then EitherD-run c else EitherD-run (EitherD-if gs) EitherD-run (EitherD-if (otherwise≔ c)) = EitherD-run c EitherD-run (EitherD-either (Left x) f₁ f₂) = EitherD-run (f₁ x) EitherD-run (EitherD-either (Right y) f₁ f₂) = EitherD-run (f₂ y) EitherD-run (EitherD-maybe nothing n s) = EitherD-run n EitherD-run (EitherD-maybe (just x) n s) = EitherD-run (s x) EitherD-Pre : (E A : Set) → Set₁ EitherD-Pre E A = Set EitherD-Post : (E A : Set) → Set₁ EitherD-Post E A = Either E A → Set EitherD-PredTrans : (E A : Set) → Set₁ EitherD-PredTrans E A = EitherD-Post E A → EitherD-Pre E A EitherD-weakestPre-bindPost : (f : A → EitherD E B) → EitherD-Post E B → EitherD-Post E A EitherD-weakestPre : (m : EitherD E A) → EitherD-PredTrans E A EitherD-weakestPre (EitherD-return x) P = P (Right x) EitherD-weakestPre (EitherD-bind m f) P = EitherD-weakestPre m (EitherD-weakestPre-bindPost f P) EitherD-weakestPre (EitherD-bail x) P = P (Left x) EitherD-weakestPre (EitherD-if (clause (b ≔ c) gs)) P = (toBool b ≡ true → EitherD-weakestPre c P) × (toBool b ≡ false → EitherD-weakestPre (EitherD-if gs) P) EitherD-weakestPre (EitherD-if (otherwise≔ x)) P = EitherD-weakestPre x P EitherD-weakestPre (EitherD-either e f₁ f₂) P = (∀ x → e ≡ Left x → EitherD-weakestPre (f₁ x) P) × (∀ y → e ≡ Right y → EitherD-weakestPre (f₂ y) P) EitherD-weakestPre (EitherD-maybe m n s) P = (m ≡ nothing → EitherD-weakestPre n P) × (∀ j → m ≡ just j → EitherD-weakestPre (s j) P) EitherD-weakestPre-bindPost f P (Left x) = P (Left x) EitherD-weakestPre-bindPost f P (Right y) = ∀ c → c ≡ y → EitherD-weakestPre (f c) P EitherD-Contract : (m : EitherD E A) → Set₁ EitherD-Contract{E}{A} m = (P : EitherD-Post E A) → EitherD-weakestPre m P → P (EitherD-run m) EitherD-contract : (m : EitherD E A) → EitherD-Contract m EitherD-contract (EitherD-return x) P wp = wp EitherD-contract (EitherD-bind m f) P wp with EitherD-contract m _ wp ...| wp' with EitherD-run m ... | Left x = wp' ... | Right y = EitherD-contract (f y) P (wp' y refl) EitherD-contract (EitherD-bail x) P wp = wp EitherD-contract{E}{A} (EitherD-if gs) P wp = EitherD-contract-if gs P wp where EitherD-contract-if : (gs : Guards (EitherD E A)) → EitherD-Contract (EitherD-if gs) EitherD-contract-if (clause (b ≔ c) gs) P wp with toBool b ... | false = EitherD-contract-if gs P (proj₂ wp refl) ... | true = EitherD-contract c P (proj₁ wp refl) EitherD-contract-if (otherwise≔ x) P wp = EitherD-contract x P wp EitherD-contract (EitherD-either (Left x) f₁ f₂) P wp = EitherD-contract (f₁ x) P (proj₁ wp x refl) EitherD-contract (EitherD-either (Right y) f₁ f₂) P wp = EitherD-contract (f₂ y) P (proj₂ wp y refl) EitherD-contract (EitherD-maybe nothing f₁ f₂) P wp = EitherD-contract f₁ P (proj₁ wp refl) EitherD-contract (EitherD-maybe (just x) f₁ f₂) P wp = EitherD-contract (f₂ x) P (proj₂ wp x refl)
{ "alphanum_fraction": 0.6694371883, "avg_line_length": 38.2818181818, "ext": "agda", "hexsha": "1612b26c6e06682650c25ba4a37beaaba7c01e66", "lang": "Agda", "max_forks_count": 6, "max_forks_repo_forks_event_max_datetime": "2022-02-18T01:04:32.000Z", "max_forks_repo_forks_event_min_datetime": "2020-12-16T19:43:52.000Z", "max_forks_repo_head_hexsha": "49f8b1b70823be805d84ffc3157c3b880edb1e92", "max_forks_repo_licenses": [ "UPL-1.0" ], "max_forks_repo_name": "oracle/bft-consensus-agda", "max_forks_repo_path": "LibraBFT/ImplShared/Util/Dijkstra/EitherD.agda", "max_issues_count": 72, "max_issues_repo_head_hexsha": "49f8b1b70823be805d84ffc3157c3b880edb1e92", "max_issues_repo_issues_event_max_datetime": "2022-03-25T05:36:11.000Z", "max_issues_repo_issues_event_min_datetime": "2021-02-04T05:04:33.000Z", "max_issues_repo_licenses": [ "UPL-1.0" ], "max_issues_repo_name": "oracle/bft-consensus-agda", "max_issues_repo_path": "LibraBFT/ImplShared/Util/Dijkstra/EitherD.agda", "max_line_length": 111, "max_stars_count": 4, "max_stars_repo_head_hexsha": "49f8b1b70823be805d84ffc3157c3b880edb1e92", "max_stars_repo_licenses": [ "UPL-1.0" ], "max_stars_repo_name": "oracle/bft-consensus-agda", "max_stars_repo_path": "LibraBFT/ImplShared/Util/Dijkstra/EitherD.agda", "max_stars_repo_stars_event_max_datetime": "2021-12-18T19:24:05.000Z", "max_stars_repo_stars_event_min_datetime": "2020-12-16T19:43:41.000Z", "num_tokens": 1497, "size": 4211 }
{-# OPTIONS --safe #-} module Cubical.Algebra.CommMonoid.Base where open import Cubical.Foundations.Prelude open import Cubical.Foundations.Equiv open import Cubical.Foundations.Equiv.HalfAdjoint open import Cubical.Foundations.Function open import Cubical.Foundations.HLevels open import Cubical.Foundations.Isomorphism open import Cubical.Foundations.Univalence open import Cubical.Foundations.Transport open import Cubical.Foundations.SIP open import Cubical.Data.Sigma open import Cubical.Algebra.Semigroup open import Cubical.Algebra.Monoid.Base open import Cubical.Displayed.Base open import Cubical.Displayed.Auto open import Cubical.Displayed.Record open import Cubical.Displayed.Universe open import Cubical.Reflection.RecordEquiv open Iso private variable ℓ ℓ' : Level record IsCommMonoid {A : Type ℓ} (ε : A) (_·_ : A → A → A) : Type ℓ where constructor iscommmonoid field isMonoid : IsMonoid ε _·_ comm : (x y : A) → x · y ≡ y · x open IsMonoid isMonoid public unquoteDecl IsCommMonoidIsoΣ = declareRecordIsoΣ IsCommMonoidIsoΣ (quote IsCommMonoid) record CommMonoidStr (A : Type ℓ) : Type ℓ where constructor commmonoidstr field ε : A _·_ : A → A → A isCommMonoid : IsCommMonoid ε _·_ infixl 7 _·_ open IsCommMonoid isCommMonoid public CommMonoid : ∀ ℓ → Type (ℓ-suc ℓ) CommMonoid ℓ = TypeWithStr ℓ CommMonoidStr commmonoid : (A : Type ℓ) (ε : A) (_·_ : A → A → A) (h : IsCommMonoid ε _·_) → CommMonoid ℓ commmonoid A ε _·_ h = A , commmonoidstr ε _·_ h -- Easier to use constructors makeIsCommMonoid : {M : Type ℓ} {ε : M} {_·_ : M → M → M} (is-setM : isSet M) (assoc : (x y z : M) → x · (y · z) ≡ (x · y) · z) (rid : (x : M) → x · ε ≡ x) (lid : (x : M) → ε · x ≡ x) (comm : (x y : M) → x · y ≡ y · x) → IsCommMonoid ε _·_ IsCommMonoid.isMonoid (makeIsCommMonoid is-setM assoc rid lid comm) = makeIsMonoid is-setM assoc rid lid IsCommMonoid.comm (makeIsCommMonoid is-setM assoc rid lid comm) = comm makeCommMonoid : {M : Type ℓ} (ε : M) (_·_ : M → M → M) (is-setM : isSet M) (assoc : (x y z : M) → x · (y · z) ≡ (x · y) · z) (rid : (x : M) → x · ε ≡ x) (lid : (x : M) → ε · x ≡ x) (comm : (x y : M) → x · y ≡ y · x) → CommMonoid ℓ makeCommMonoid ε _·_ is-setM assoc rid lid comm = commmonoid _ ε _·_ (makeIsCommMonoid is-setM assoc rid lid comm) CommMonoidStr→MonoidStr : {A : Type ℓ} → CommMonoidStr A → MonoidStr A CommMonoidStr→MonoidStr (commmonoidstr _ _ H) = monoidstr _ _ (IsCommMonoid.isMonoid H) CommMonoid→Monoid : CommMonoid ℓ → Monoid ℓ CommMonoid→Monoid (_ , commmonoidstr _ _ H) = _ , monoidstr _ _ (IsCommMonoid.isMonoid H) CommMonoidHom : (L : CommMonoid ℓ) (M : CommMonoid ℓ') → Type (ℓ-max ℓ ℓ') CommMonoidHom L M = MonoidHom (CommMonoid→Monoid L) (CommMonoid→Monoid M) IsCommMonoidEquiv : {A : Type ℓ} {B : Type ℓ'} (M : CommMonoidStr A) (e : A ≃ B) (N : CommMonoidStr B) → Type (ℓ-max ℓ ℓ') IsCommMonoidEquiv M e N = IsMonoidHom (CommMonoidStr→MonoidStr M) (e .fst) (CommMonoidStr→MonoidStr N) CommMonoidEquiv : (M : CommMonoid ℓ) (N : CommMonoid ℓ') → Type (ℓ-max ℓ ℓ') CommMonoidEquiv M N = Σ[ e ∈ (M .fst ≃ N .fst) ] IsCommMonoidEquiv (M .snd) e (N .snd) isPropIsCommMonoid : {M : Type ℓ} (ε : M) (_·_ : M → M → M) → isProp (IsCommMonoid ε _·_) isPropIsCommMonoid ε _·_ (iscommmonoid MM MC) (iscommmonoid SM SC) = λ i → iscommmonoid (isPropIsMonoid _ _ MM SM i) (isPropComm MC SC i) where isSetM : isSet _ isSetM = MM .IsMonoid.isSemigroup .IsSemigroup.is-set isPropComm : isProp ((x y : _) → x · y ≡ y · x) isPropComm = isPropΠ2 λ _ _ → isSetM _ _ 𝒮ᴰ-CommMonoid : DUARel (𝒮-Univ ℓ) CommMonoidStr ℓ 𝒮ᴰ-CommMonoid = 𝒮ᴰ-Record (𝒮-Univ _) IsCommMonoidEquiv (fields: data[ ε ∣ autoDUARel _ _ ∣ presε ] data[ _·_ ∣ autoDUARel _ _ ∣ isHom ] prop[ isCommMonoid ∣ (λ _ _ → isPropIsCommMonoid _ _) ]) where open CommMonoidStr open IsMonoidHom CommMonoidPath : (M N : CommMonoid ℓ) → CommMonoidEquiv M N ≃ (M ≡ N) CommMonoidPath = ∫ 𝒮ᴰ-CommMonoid .UARel.ua
{ "alphanum_fraction": 0.6449858089, "avg_line_length": 33.5555555556, "ext": "agda", "hexsha": "7bec68f71e5a3c06afeb62c74c171198c75aa955", "lang": "Agda", "max_forks_count": 134, "max_forks_repo_forks_event_max_datetime": "2022-03-23T16:22:13.000Z", "max_forks_repo_forks_event_min_datetime": "2018-11-16T06:11:03.000Z", "max_forks_repo_head_hexsha": "53e159ec2e43d981b8fcb199e9db788e006af237", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "marcinjangrzybowski/cubical", "max_forks_repo_path": "Cubical/Algebra/CommMonoid/Base.agda", "max_issues_count": 584, "max_issues_repo_head_hexsha": "53e159ec2e43d981b8fcb199e9db788e006af237", "max_issues_repo_issues_event_max_datetime": "2022-03-30T12:09:17.000Z", "max_issues_repo_issues_event_min_datetime": "2018-10-15T09:49:02.000Z", "max_issues_repo_licenses": [ "MIT" ], "max_issues_repo_name": "marcinjangrzybowski/cubical", "max_issues_repo_path": "Cubical/Algebra/CommMonoid/Base.agda", "max_line_length": 102, "max_stars_count": 301, "max_stars_repo_head_hexsha": "53e159ec2e43d981b8fcb199e9db788e006af237", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "marcinjangrzybowski/cubical", "max_stars_repo_path": "Cubical/Algebra/CommMonoid/Base.agda", "max_stars_repo_stars_event_max_datetime": "2022-03-24T02:10:47.000Z", "max_stars_repo_stars_event_min_datetime": "2018-10-17T18:00:24.000Z", "num_tokens": 1569, "size": 4228 }
module Common where open import Agda.Builtin.Size public using (Size ; Size<_) renaming (ω to ∞) open import Agda.Primitive public using () renaming (_⊔_ to _⊔ᴸ_ ; lsuc to sucᴸ) open import Data.Bool public using (true ; false) renaming (Bool to 𝔹 ; _∧_ to _∧ᴮ_ ; _∨_ to _∨ᴮ_ ; not to ¬ᴮ_ ; if_then_else_ to ifᴮ) open import Data.Empty public using () renaming (⊥ to 𝟘 ; ⊥-elim to elim𝟘) open import Data.Fin public using (Fin ; zero ; suc) open import Data.List public using (List ; [] ; _∷_) open import Data.Nat public using (ℕ ; zero ; suc) renaming (_≟_ to _≟ᴺ_) open import Data.Sum public using (_⊎_) renaming (inj₁ to ι₁ ; inj₂ to ι₂) open import Data.Unit public using () renaming (⊤ to 𝟙 ; tt to ∙) open import Function public using (_∘_ ; _$_) renaming (id to I ; const to K ; _ˢ_ to S) open import Relation.Binary.PropositionalEquality public using (_≡_ ; _≢_ ; refl ; trans ; sym ; cong ; subst) renaming (cong₂ to cong²) open import Relation.Nullary public using (Dec ; yes ; no) renaming (¬_ to Not) open import Relation.Nullary.Decidable public using () renaming (map′ to mapDec) open import Relation.Nullary.Negation public using () renaming (contradiction to _↯_) -- Abstract symbols, or atoms. abstract Atom : Set Atom = ℕ _≟ᵅ_ : (P P′ : Atom) → Dec (P ≡ P′) _≟ᵅ_ = _≟ᴺ_ -- Products, with custom fixities. infixl 5 _,_ record Σ {a b} (A : Set a) (B : A → Set b) : Set (a ⊔ᴸ b) where constructor _,_ field π₁ : A π₂ : B π₁ open Σ public ∃ : ∀ {a b} {A : Set a} → (A → Set b) → Set (a ⊔ᴸ b) ∃ = Σ _ infix 2 _×_ _×_ : ∀ {a b} (A : Set a) (B : Set b) → Set (a ⊔ᴸ b) A × B = Σ A (λ _ → B) -- Elimination for disjoint unions. elim⊎ : ∀ {a b c} {A : Set a} {B : Set b} {C : Set c} → A ⊎ B → (A → C) → (B → C) → C elim⊎ (ι₁ x) f g = f x elim⊎ (ι₂ y) f g = g y -- Double-argument K combinator. K² : ∀ {a b c} {A : Set a} {B : Set b} {C : Set c} → A → B → C → A K² x _ _ = x -- Triple-argument congruence. cong³ : ∀ {a b c d} {A : Set a} {B : Set b} {C : Set c} {D : Set d} (f : A → B → C → D) {x x′ y y′ z z′} → x ≡ x′ → y ≡ y′ → z ≡ z′ → f x y z ≡ f x′ y′ z′ cong³ f refl refl refl = refl -- Iteration and recursion for naturals. itᴺ : ∀ {a} {A : Set a} → ℕ → (A → A) → A → A itᴺ zero f x = x itᴺ (suc n) f x = f (itᴺ n f x) recᴺ : ∀ {a} {A : Set a} → ℕ → (ℕ → A → A) → A → A recᴺ zero f x = x recᴺ (suc n) f x = f n (recᴺ n f x) -- Iteration and recursion for lists. itᴸ : ∀ {a b} {A : Set a} {B : Set b} → List A → (A → B → B) → B → B itᴸ [] f x = x itᴸ (k ∷ ks) f x = f k (itᴸ ks f x) recᴸ : ∀ {a b} {A : Set a} {B : Set b} → List A → (A → List A → B → B) → B → B recᴸ [] f x = x recᴸ (k ∷ ks) f x = f k ks (recᴸ ks f x) -- Composition, supremum, and infimum for relations. module _ {W : Set} where _⨾_ : (W → W → Set) → (W → W → Set) → (W → W → Set) _R_ ⨾ _Q_ = λ w w′ → ∃ (λ v → w R v × v Q w′) _⊔_ : (W → W → Set) → (W → W → Set) → (W → W → Set) _R_ ⊔ _Q_ = λ w w′ → ∃ (λ v → w R v × w′ Q v) _⊓_ : (W → W → Set) → (W → W → Set) → (W → W → Set) _R_ ⊓ _Q_ = λ w w′ → ∃ (λ v → v R w × v Q w′)
{ "alphanum_fraction": 0.5390894819, "avg_line_length": 22.1180555556, "ext": "agda", "hexsha": "54c52af49aba8248c30616774804994b045bc097", "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": "Common.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": "Common.agda", "max_line_length": 86, "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": "Common.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": 1401, "size": 3185 }
------------------------------------------------------------------------ -- 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 Data.Function open import Data.List as List using (List; []; _∷_) import Data.List.Equality as ListEq open import Data.Product as Prod using (∃; _×_; _,_) open import Relation.Nullary import Relation.Nullary.Decidable as Dec open import Relation.Unary using (Pred) renaming (_⊆_ to _⋐_) open import Relation.Binary 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) : List A → Set 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 : Pred A} → 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 x xs} {P : A → Set} → ¬ 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} → (∀ x → Dec (P x)) → (xs : List A) → Dec (Any P xs) 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} {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 (S : Setoid) where private open module S = Setoid S using (_≈_) renaming (carrier to A) open module L = ListEq.Equality S using ([]; _∷_) renaming (_≈_ to _≋_) -- If a predicate P respects the underlying equality then Any P -- respects the list equality. lift-resp : ∀ {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 = record { carrier = List A ; _≈_ = _≋_ ; _∼_ = _⊆_ ; isPreorder = record { isEquivalence = Setoid.isEquivalence L.setoid ; reflexive = reflexive ; trans = λ ys⊆zs xs⊆ys → xs⊆ys ∘ ys⊆zs ; ∼-resp-≈ = (λ ys₁≋ys₂ xs⊆ys₁ → reflexive ys₁≋ys₂ ∘ xs⊆ys₁) , (λ xs₁≋xs₂ xs₁⊆ys → xs₁⊆ys ∘ reflexive (L.sym xs₁≋xs₂)) } } where reflexive : _≋_ ⇒ _⊆_ reflexive eq = ∈-resp-list-≈ eq 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} (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 : A → Set} {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 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. module Membership-≡ {A : Set} where private open module M = Membership (PropEq.setoid A) public hiding (lift-resp; lose; ⊆-preorder; module ⊆-Reasoning) lose : ∀ {P x xs} → x ∈ xs → P x → Any P xs lose {P} = M.lose (PropEq.subst P) -- _⊆_ is a preorder. ⊆-preorder : Preorder ⊆-preorder = record { carrier = List A ; _≈_ = _≡_ ; _∼_ = _⊆_ ; isPreorder = record { isEquivalence = PropEq.isEquivalence ; reflexive = λ eq → PropEq.subst (_∈_ _) eq ; trans = λ ys⊆zs xs⊆ys → xs⊆ys ∘ ys⊆zs ; ∼-resp-≈ = PropEq.resp₂ _⊆_ } } module ⊆-Reasoning where import Relation.Binary.PreorderReasoning as PreR open PreR ⊆-preorder public renaming (_∼⟨_⟩_ to _⊆⟨_⟩_; _≈⟨_⟩_ to _≡⟨_⟩_) infix 1 _∈⟨_⟩_ _∈⟨_⟩_ : ∀ x {xs ys} → x ∈ xs → xs IsRelatedTo ys → x ∈ ys x ∈⟨ x∈xs ⟩ xs⊆ys = (begin xs⊆ys) x∈xs ------------------------------------------------------------------------ -- Another function -- If any element satisfies P, then P is satisfied. satisfied : ∀ {A} {P : A → Set} {xs} → Any P xs → ∃ P satisfied = Prod.map id Prod.proj₂ ∘ Membership-≡.find
{ "alphanum_fraction": 0.5404378506, "avg_line_length": 28.7864583333, "ext": "agda", "hexsha": "9dad3e9cc8a60f424d9471245ea35f33f86780ce", "lang": "Agda", "max_forks_count": 3, "max_forks_repo_forks_event_max_datetime": "2022-03-12T11:54:10.000Z", "max_forks_repo_forks_event_min_datetime": "2015-07-21T16:37:58.000Z", "max_forks_repo_head_hexsha": "8ef786b40e4a9ab274c6103dc697dcb658cf3db3", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "isabella232/Lemmachine", "max_forks_repo_path": "vendor/stdlib/src/Data/List/Any.agda", "max_issues_count": 1, "max_issues_repo_head_hexsha": "8ef786b40e4a9ab274c6103dc697dcb658cf3db3", "max_issues_repo_issues_event_max_datetime": "2022-03-12T12:17:51.000Z", "max_issues_repo_issues_event_min_datetime": "2022-03-12T12:17:51.000Z", "max_issues_repo_licenses": [ "MIT" ], "max_issues_repo_name": "larrytheliquid/Lemmachine", "max_issues_repo_path": "vendor/stdlib/src/Data/List/Any.agda", "max_line_length": 72, "max_stars_count": 56, "max_stars_repo_head_hexsha": "8ef786b40e4a9ab274c6103dc697dcb658cf3db3", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "isabella232/Lemmachine", "max_stars_repo_path": "vendor/stdlib/src/Data/List/Any.agda", "max_stars_repo_stars_event_max_datetime": "2021-12-21T17:02:19.000Z", "max_stars_repo_stars_event_min_datetime": "2015-01-20T02:11:42.000Z", "num_tokens": 2051, "size": 5527 }
-- The category of monadic functions. open import Level open import Relation.Binary open import Relation.Binary.PropositionalEquality open import Axiom.FunctionExtensionality open import Control.Monad open import Control.Category module Control.Kleisli where -- The type of monadic functions. Kleisli : (M : Set → Set) (A : Set) (B : Set) → Set Kleisli M A B = A → M B KleisliHom : (M : Set → Set) (A : Set) (B : Set) → Setoid zero zero KleisliHom M A B = setoid (Kleisli M A B) -- The laws of a Kleisli category correspond to the Monad laws, -- modulo function extensionality. kleisliIsCategory : {M : Set → Set} (monad : IsMonad M) → IsCategory (KleisliHom M) kleisliIsCategory monad = record { ops = record { id = return ; _⟫_ = _⟫_ } ; laws = record { id-first = fun-ext (bind-β _) ; id-last = fun-ext (λ a → bind-η _) ; ∘-assoc = λ f → fun-ext (λ a → bind-assoc (f a)) ; ∘-cong = cong₂ _⟫_ } } where open IsMonad monad open T-CategoryOps (KleisliHom _) _⟫_ : T-⟫ f ⟫ g = λ a → f a >>= g -- The Kleisli category over a Monad on Set KLEISLI : {M : Set → Set} (monad : IsMonad M) → Category _ _ _ KLEISLI monad = record { Hom = KleisliHom _; isCategory = kleisliIsCategory monad }
{ "alphanum_fraction": 0.6496815287, "avg_line_length": 25.6326530612, "ext": "agda", "hexsha": "b4a7d5c1a43ce2551ba785bd6e1a93d79759ff83", "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": "914f655c7c0417754c2ffe494d3f6ea7a357b1c3", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "andreasabel/cubical", "max_forks_repo_path": "src/Control/Kleisli.agda", "max_issues_count": null, "max_issues_repo_head_hexsha": "914f655c7c0417754c2ffe494d3f6ea7a357b1c3", "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": "andreasabel/cubical", "max_issues_repo_path": "src/Control/Kleisli.agda", "max_line_length": 83, "max_stars_count": null, "max_stars_repo_head_hexsha": "914f655c7c0417754c2ffe494d3f6ea7a357b1c3", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "andreasabel/cubical", "max_stars_repo_path": "src/Control/Kleisli.agda", "max_stars_repo_stars_event_max_datetime": null, "max_stars_repo_stars_event_min_datetime": null, "num_tokens": 430, "size": 1256 }
------------------------------------------------------------------------------ -- The FOTC types without using data, i.e. using Agda as a logical framework ------------------------------------------------------------------------------ {-# OPTIONS --exact-split #-} {-# OPTIONS --no-sized-types #-} {-# OPTIONS --no-universe-polymorphism #-} {-# OPTIONS --without-K #-} module Predicates where open import FOTC.Base open import FOTC.Base.List open import FOTC.Base.List.PropertiesI open import FOTC.Base.PropertiesI ------------------------------------------------------------------------------ -- The existential proyections. ∃-proj₁ : ∀ {A} → ∃ A → D ∃-proj₁ (x , _) = x ∃-proj₂ : ∀ {A} → (h : ∃ A) → A (∃-proj₁ h) ∃-proj₂ (_ , Ax) = Ax ------------------------------------------------------------------------------ -- The inductive FOTC types using postulates. module Pure where -- The FOTC natural numbers type. postulate N : D → Set nzero : N zero nsucc : ∀ {n} → N n → N (succ₁ n) -- Example. [1] : D [1] = succ₁ zero 1-N : N [1] 1-N = nsucc nzero -- The FOTC lists type. postulate List : D → Set lnil : List [] lcons : ∀ x {xs} → List xs → List (x ∷ xs) -- Example. l : List (zero ∷ true ∷ []) l = lcons zero (lcons true lnil) -- The FOTC list of natural numbers type. postulate ListN : D → Set lnnil : ListN [] lncons : ∀ {n ns} → N n → ListN ns → ListN (n ∷ ns) -- Example. ln : ListN (zero ∷ [1] ∷ []) ln = lncons nzero (lncons 1-N lnnil) ------------------------------------------------------------------------------ -- The inductive FOTC types using data. module Inductive where -- The FOTC natural numbers type. data N : D → Set where nzero : N zero nsucc : ∀ {n} → N n → N (succ₁ n) -- Example. [1] : D [1] = succ₁ zero 1-N : N [1] 1-N = nsucc nzero -- The FOTC lists type. data List : D → Set where lnil : List [] lcons : ∀ x {xs} → List xs → List (x ∷ xs) -- Example. l : List (zero ∷ true ∷ []) l = lcons zero (lcons true lnil) -- The FOTC list of natural numbers type. data ListN : D → Set where lnnil : ListN [] lncons : ∀ {n ns} → N n → ListN ns → ListN (n ∷ ns) -- Example. ln : ListN (zero ∷ [1] ∷ []) ln = lncons nzero (lncons 1-N lnnil) ------------------------------------------------------------------------------ -- The least fixed-point operator. module LFP where postulate -- Least fixed-points correspond to inductively defined types. -- -- N.B. We cannot write μ in first-order logic. We should use an -- instance instead. μ : ((D → Set) → D → Set) → D → Set -- In FOTC, we cannot use the equality on predicates, i.e. we -- cannot write -- -- (f : (D → Set) → D → Set) → f (μ f) ≡ μ f (1) -- -- because the type of the equality is -- -- _≡_ : D → D → Set, -- -- therefore we postulate both directions of the conversion rule (1). -- LFP₁ : (f : (D → Set) → D → Set)(d : D) → μ f d → f (μ f) d μ-in : (f : (D → Set) → D → Set)(d : D) → f (μ f) d → μ f d ------------------------------------------------------------------------------ -- The greatest fixed-point operator. -- N.B. At the moment, the definitions of μ and ν are the same. module GFP where postulate -- Greatest fixed-points correspond to co-inductively defined -- types. ν : ((D → Set) → D → Set) → D → Set ν-out : (f : (D → Set) → D → Set)(d : D) → ν f d → f (ν f) d GFP₂ : (f : (D → Set) → D → Set)(d : D) → f (ν f) d → ν f d ------------------------------------------------------------------------------ -- The FOTC natural numbers type as the least fixed-point of a -- functor. module NLFP where open LFP -- Functor for the FOTC natural numbers type. -- From Peter: NatF if D was an inductive type. -- -- NatF : (D → Set) → D → Set -- NatF X zero = ⊤ -- NatF X (succ₁ n) = X n -- From Peter: NatF in pure predicate logic. NatF : (D → Set) → D → Set NatF X n = n ≡ zero ∨ (∃[ n' ] n ≡ succ₁ n' ∧ X n') -- The FOTC natural numbers type using μ. N : D → Set N = μ NatF -- The data constructors of N. nzero : N zero nzero = μ-in NatF zero (inj₁ refl) nsucc : {n : D} → N n → N (succ₁ n) nsucc {n} Nn = μ-in NatF (succ₁ n) (inj₂ (n , refl , Nn)) -- Example. [1] : D [1] = succ₁ zero 1-N : N [1] 1-N = nsucc nzero ------------------------------------------------------------------------------ -- The FOTC list type as the least fixed-point of a functor. module ListLFT where open LFP -- Functor for the FOTC lists type. ListF : (D → Set) → D → Set ListF X xs = xs ≡ [] ∨ (∃[ x' ] ∃[ xs' ] xs ≡ x' ∷ xs' ∧ X xs') -- The FOTC list type using μ. List : D → Set List = μ ListF -- The data constructors of List. lnil : List [] lnil = μ-in ListF [] (inj₁ refl) lcons : ∀ x {xs} → List xs → List (x ∷ xs) lcons x {xs} Lxs = μ-in ListF (x ∷ xs) (inj₂ (x , xs , refl , Lxs)) -- Example. l : List (zero ∷ true ∷ []) l = lcons zero (lcons true lnil) ------------------------------------------------------------------------------ -- The FOTC list of natural numbers type as the least fixed-point of a -- functor. module ListNLFT where open LFP open NLFP -- Functor for the FOTC list of natural numbers type. ListNF : (D → Set) → D → Set ListNF X ns = ns ≡ [] ∨ (∃[ n' ] ∃[ ns' ] ns ≡ n' ∷ ns' ∧ N n' ∧ X ns') -- The FOTC list type using μ. ListN : D → Set ListN = μ ListNF -- The data constructors of ListN. lnnil : ListN [] lnnil = μ-in ListNF [] (inj₁ refl) lncons : ∀ {n ns} → N n → ListN ns → ListN (n ∷ ns) lncons {n} {ns} Nn LNns = μ-in ListNF (n ∷ ns) (inj₂ (n , ns , refl , Nn , LNns)) -- Example. ln : ListN (zero ∷ [1] ∷ []) ln = lncons nzero (lncons 1-N lnnil) ------------------------------------------------------------------------------ -- The FOTC Colist type as the greatest fixed-point of a functor. module CoList where open GFP -- Functor for the FOTC Colists type (the same functor that for the -- List type). ColistF : (D → Set) → D → Set ColistF X xs = xs ≡ [] ∨ (∃[ x' ] ∃[ xs' ] xs ≡ x' ∷ xs' ∧ X xs') -- The FOTC Colist type using ν. Colist : D → Set Colist = ν ColistF -- The data constructors of Colist. nilCL : Colist [] nilCL = GFP₂ ColistF [] (inj₁ refl) consCL : ∀ x xs → Colist xs → Colist (x ∷ xs) consCL x xs CLxs = GFP₂ ColistF (x ∷ xs) (inj₂ (x , xs , refl , CLxs)) -- Example (finite colist). l : Colist (zero ∷ true ∷ []) l = consCL zero (true ∷ []) (consCL true [] nilCL) -- TODO: Example (infinite colist). -- zerosCL : Colist {!!} -- zerosCL = consCL zero {!!} zerosCL ------------------------------------------------------------------------------ -- The FOTC Stream type as the greatest fixed-point of a functor. module Stream where open GFP -- Functor for the FOTC Stream type. StreamF : (D → Set) → D → Set StreamF X xs = ∃[ x' ] ∃[ xs' ] xs ≡ x' ∷ xs' ∧ X xs' -- The FOTC Stream type using ν. Stream : D → Set Stream = ν StreamF -- The data constructor of Stream. consS : ∀ x {xs} → Stream xs → Stream (x ∷ xs) consS x {xs} Sxs = GFP₂ StreamF (x ∷ xs) (x , xs , refl , Sxs) -- TODO: Example -- zerosS : Stream {!!} -- zerosS = consS zero {!!} zerosS headS : ∀ {x xs} → Stream (x ∷ xs) → D headS {x} _ = x tailS : ∀ {x xs} → Stream (x ∷ xs) → Stream xs tailS {x} {xs} Sx∷xs = Sxs where unfoldS : StreamF (ν StreamF) (x ∷ xs) unfoldS = ν-out StreamF (x ∷ xs) Sx∷xs e : D e = ∃-proj₁ unfoldS Pe : ∃ λ es → x ∷ xs ≡ e ∷ es ∧ ν StreamF es Pe = ∃-proj₂ unfoldS es : D es = ∃-proj₁ Pe Pes : x ∷ xs ≡ e ∷ es ∧ ν StreamF es Pes = ∃-proj₂ Pe xs≡es : xs ≡ es xs≡es = ∧-proj₂ (∷-injective (∧-proj₁ Pes)) Sxs : ν StreamF xs Sxs = subst (ν StreamF) (sym xs≡es) (∧-proj₂ Pes)
{ "alphanum_fraction": 0.4881682734, "avg_line_length": 25.4363057325, "ext": "agda", "hexsha": "bbf5d673866e2931d45ae00a48d344d7b1696534", "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/fixed-points/Predicates.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/fixed-points/Predicates.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/fixed-points/Predicates.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": 2648, "size": 7987 }
{-# OPTIONS --safe #-} module Issue639-2 where postulate A : Set
{ "alphanum_fraction": 0.6666666667, "avg_line_length": 13.2, "ext": "agda", "hexsha": "3eb2fbf0b41c122c64e6dda7c8217d2a25388421", "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/Issue639-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/interaction/Issue639-2.agda", "max_line_length": 23, "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/Issue639-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": 18, "size": 66 }
module Trees where open import Data.Unit using (⊤) data BinTree {a} (A : Set a) : Set a where Empty : A → BinTree A Node : A → BinTree A → BinTree A → BinTree A BareBinTree : Set BareBinTree = BinTree ⊤
{ "alphanum_fraction": 0.6603773585, "avg_line_length": 17.6666666667, "ext": "agda", "hexsha": "43cad849307a16e785df19b686f498cc1f9d5dd8", "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": "7dc0ea4782a5ff960fe31bdcb8718ce478eaddbc", "max_forks_repo_licenses": [ "Apache-2.0" ], "max_forks_repo_name": "ice1k/Theorems", "max_forks_repo_path": "src/Trees.agda", "max_issues_count": null, "max_issues_repo_head_hexsha": "7dc0ea4782a5ff960fe31bdcb8718ce478eaddbc", "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": "ice1k/Theorems", "max_issues_repo_path": "src/Trees.agda", "max_line_length": 47, "max_stars_count": 1, "max_stars_repo_head_hexsha": "7dc0ea4782a5ff960fe31bdcb8718ce478eaddbc", "max_stars_repo_licenses": [ "Apache-2.0" ], "max_stars_repo_name": "ice1k/Theorems", "max_stars_repo_path": "src/Trees.agda", "max_stars_repo_stars_event_max_datetime": "2020-04-15T15:28:03.000Z", "max_stars_repo_stars_event_min_datetime": "2020-04-15T15:28:03.000Z", "num_tokens": 75, "size": 212 }
------------------------------------------------------------------------ -- The Agda standard library -- -- Properties related to list membership ------------------------------------------------------------------------ -- List membership is defined in Data.List.Any. This module does not -- treat the general variant of list membership, parametrised on a -- setoid, only the variant where the equality is fixed to be -- propositional equality. module Data.List.Any.Membership where open import Algebra open import Category.Monad open import Data.Bool open import Data.Empty open import Function open import Function.Equality using (_⟨$⟩_) open import Function.Equivalence using (module Equivalence) import Function.Injection as Inj open import Function.Inverse as Inv using (_↔_; module Inverse) import Function.Related as Related open import Function.Related.TypeIsomorphisms open import Data.List as List open import Data.List.Any as Any using (Any; here; there) open import Data.List.Any.Properties open import Data.Nat as Nat import Data.Nat.Properties as NatProp open import Data.Product as Prod open import Data.Sum as Sum open import Relation.Binary open import Relation.Binary.PropositionalEquality as P using (_≡_; refl; _≗_) import Relation.Binary.Properties.DecTotalOrder as DTOProperties import Relation.Binary.Sigma.Pointwise as Σ open import Relation.Unary using (_⟨×⟩_) open import Relation.Nullary open import Relation.Nullary.Negation open Any.Membership-≡ private module ×⊎ {k ℓ} = CommutativeSemiring (×⊎-CommutativeSemiring k ℓ) open module ListMonad {ℓ} = RawMonad (List.monad {ℓ = ℓ}) ------------------------------------------------------------------------ -- Properties relating _∈_ to various list functions -- Isomorphisms. map-∈↔ : ∀ {a b} {A : Set a} {B : Set b} {f : A → B} {y xs} → (∃ λ x → x ∈ xs × y ≡ f x) ↔ y ∈ List.map f xs map-∈↔ {a} {b} {f = f} {y} {xs} = (∃ λ x → x ∈ xs × y ≡ f x) ↔⟨ Any↔ {a = a} {p = b} ⟩ Any (λ x → y ≡ f x) xs ↔⟨ map↔ {a = a} {b = b} {p = b} ⟩ y ∈ List.map f xs ∎ where open Related.EquationalReasoning concat-∈↔ : ∀ {a} {A : Set a} {x : A} {xss} → (∃ λ xs → x ∈ xs × xs ∈ xss) ↔ x ∈ concat xss concat-∈↔ {a} {x = x} {xss} = (∃ λ xs → x ∈ xs × xs ∈ xss) ↔⟨ Σ.cong {a₁ = a} {b₁ = a} {b₂ = a} Inv.id $ ×⊎.*-comm _ _ ⟩ (∃ λ xs → xs ∈ xss × x ∈ xs) ↔⟨ Any↔ {a = a} {p = a} ⟩ Any (Any (_≡_ x)) xss ↔⟨ concat↔ {a = a} {p = a} ⟩ x ∈ concat xss ∎ where open Related.EquationalReasoning >>=-∈↔ : ∀ {ℓ} {A B : Set ℓ} {xs} {f : A → List B} {y} → (∃ λ x → x ∈ xs × y ∈ f x) ↔ y ∈ (xs >>= f) >>=-∈↔ {ℓ} {xs = xs} {f} {y} = (∃ λ x → x ∈ xs × y ∈ f x) ↔⟨ Any↔ {a = ℓ} {p = ℓ} ⟩ Any (Any (_≡_ y) ∘ f) xs ↔⟨ >>=↔ {ℓ = ℓ} {p = ℓ} ⟩ y ∈ (xs >>= f) ∎ where open Related.EquationalReasoning ⊛-∈↔ : ∀ {ℓ} {A B : Set ℓ} (fs : List (A → B)) {xs y} → (∃₂ λ f x → f ∈ fs × x ∈ xs × y ≡ f x) ↔ y ∈ fs ⊛ xs ⊛-∈↔ {ℓ} fs {xs} {y} = (∃₂ λ f x → f ∈ fs × x ∈ xs × y ≡ f x) ↔⟨ Σ.cong {a₁ = ℓ} {b₁ = ℓ} {b₂ = ℓ} Inv.id (∃∃↔∃∃ {a = ℓ} {b = ℓ} {p = ℓ} _) ⟩ (∃ λ f → f ∈ fs × ∃ λ x → x ∈ xs × y ≡ f x) ↔⟨ Σ.cong {a₁ = ℓ} {b₁ = ℓ} {b₂ = ℓ} Inv.id ((_ ∎) ⟨ ×⊎.*-cong {ℓ = ℓ} ⟩ Any↔ {a = ℓ} {p = ℓ}) ⟩ (∃ λ f → f ∈ fs × Any (_≡_ y ∘ f) xs) ↔⟨ Any↔ {a = ℓ} {p = ℓ} ⟩ Any (λ f → Any (_≡_ y ∘ f) xs) fs ↔⟨ ⊛↔ ⟩ y ∈ fs ⊛ xs ∎ where open Related.EquationalReasoning ⊗-∈↔ : ∀ {A B : Set} {xs ys} {x : A} {y : B} → (x ∈ xs × y ∈ ys) ↔ (x , y) ∈ (xs ⊗ ys) ⊗-∈↔ {A} {B} {xs} {ys} {x} {y} = (x ∈ xs × y ∈ ys) ↔⟨ ⊗↔′ ⟩ Any (_≡_ x ⟨×⟩ _≡_ y) (xs ⊗ ys) ↔⟨ Any-cong helper (_ ∎) ⟩ (x , y) ∈ (xs ⊗ ys) ∎ where open Related.EquationalReasoning helper : (p : A × B) → (x ≡ proj₁ p × y ≡ proj₂ p) ↔ (x , y) ≡ p helper (x′ , y′) = record { to = P.→-to-⟶ (uncurry $ P.cong₂ _,_) ; from = P.→-to-⟶ < P.cong proj₁ , P.cong proj₂ > ; inverse-of = record { left-inverse-of = λ _ → P.cong₂ _,_ (P.proof-irrelevance _ _) (P.proof-irrelevance _ _) ; right-inverse-of = λ _ → P.proof-irrelevance _ _ } } -- Other properties. filter-∈ : ∀ {a} {A : Set a} (p : A → Bool) (xs : List A) {x} → x ∈ xs → p x ≡ true → x ∈ filter p xs filter-∈ p [] () _ filter-∈ p (x ∷ xs) (here refl) px≡true rewrite px≡true = here refl filter-∈ p (y ∷ xs) (there pxs) px≡true with p y ... | true = there (filter-∈ p xs pxs px≡true) ... | false = filter-∈ p xs pxs px≡true ------------------------------------------------------------------------ -- Properties relating _∈_ to various list functions -- Various functions are monotone. mono : ∀ {a p} {A : Set a} {P : A → Set p} {xs ys} → xs ⊆ ys → Any P xs → Any P ys mono xs⊆ys = _⟨$⟩_ (Inverse.to Any↔) ∘′ Prod.map id (Prod.map xs⊆ys id) ∘ _⟨$⟩_ (Inverse.from Any↔) map-mono : ∀ {a b} {A : Set a} {B : Set b} (f : A → B) {xs ys} → xs ⊆ ys → List.map f xs ⊆ List.map f ys map-mono f xs⊆ys = _⟨$⟩_ (Inverse.to map-∈↔) ∘ Prod.map id (Prod.map xs⊆ys id) ∘ _⟨$⟩_ (Inverse.from map-∈↔) _++-mono_ : ∀ {a} {A : Set a} {xs₁ xs₂ ys₁ ys₂ : List A} → xs₁ ⊆ ys₁ → xs₂ ⊆ ys₂ → xs₁ ++ xs₂ ⊆ ys₁ ++ ys₂ _++-mono_ xs₁⊆ys₁ xs₂⊆ys₂ = _⟨$⟩_ (Inverse.to ++↔) ∘ Sum.map xs₁⊆ys₁ xs₂⊆ys₂ ∘ _⟨$⟩_ (Inverse.from ++↔) concat-mono : ∀ {a} {A : Set a} {xss yss : List (List A)} → xss ⊆ yss → concat xss ⊆ concat yss concat-mono {a} xss⊆yss = _⟨$⟩_ (Inverse.to $ concat-∈↔ {a = a}) ∘ Prod.map id (Prod.map id xss⊆yss) ∘ _⟨$⟩_ (Inverse.from $ concat-∈↔ {a = a}) >>=-mono : ∀ {ℓ} {A B : Set ℓ} (f g : A → List B) {xs ys} → xs ⊆ ys → (∀ {x} → f x ⊆ g x) → (xs >>= f) ⊆ (ys >>= g) >>=-mono {ℓ} f g xs⊆ys f⊆g = _⟨$⟩_ (Inverse.to $ >>=-∈↔ {ℓ = ℓ}) ∘ Prod.map id (Prod.map xs⊆ys f⊆g) ∘ _⟨$⟩_ (Inverse.from $ >>=-∈↔ {ℓ = ℓ}) _⊛-mono_ : ∀ {ℓ} {A B : Set ℓ} {fs gs : List (A → B)} {xs ys : List A} → fs ⊆ gs → xs ⊆ ys → (fs ⊛ xs) ⊆ (gs ⊛ ys) _⊛-mono_ {fs = fs} {gs} fs⊆gs xs⊆ys = _⟨$⟩_ (Inverse.to $ ⊛-∈↔ gs) ∘ Prod.map id (Prod.map id (Prod.map fs⊆gs (Prod.map xs⊆ys id))) ∘ _⟨$⟩_ (Inverse.from $ ⊛-∈↔ fs) _⊗-mono_ : {A B : Set} {xs₁ ys₁ : List A} {xs₂ ys₂ : List B} → xs₁ ⊆ ys₁ → xs₂ ⊆ ys₂ → (xs₁ ⊗ xs₂) ⊆ (ys₁ ⊗ ys₂) xs₁⊆ys₁ ⊗-mono xs₂⊆ys₂ = _⟨$⟩_ (Inverse.to ⊗-∈↔) ∘ Prod.map xs₁⊆ys₁ xs₂⊆ys₂ ∘ _⟨$⟩_ (Inverse.from ⊗-∈↔) any-mono : ∀ {a} {A : Set a} (p : A → Bool) → ∀ {xs ys} → xs ⊆ ys → T (any p xs) → T (any p ys) any-mono {a} p xs⊆ys = _⟨$⟩_ (Equivalence.to $ any⇔ {a = a}) ∘ mono xs⊆ys ∘ _⟨$⟩_ (Equivalence.from $ any⇔ {a = a}) map-with-∈-mono : ∀ {a b} {A : Set a} {B : Set b} {xs : List A} {f : ∀ {x} → x ∈ xs → B} {ys : List A} {g : ∀ {x} → x ∈ ys → B} (xs⊆ys : xs ⊆ ys) → (∀ {x} → f {x} ≗ g ∘ xs⊆ys) → map-with-∈ xs f ⊆ map-with-∈ ys g map-with-∈-mono {f = f} {g = g} xs⊆ys f≈g {x} = _⟨$⟩_ (Inverse.to map-with-∈↔) ∘ Prod.map id (Prod.map xs⊆ys (λ {x∈xs} x≡fx∈xs → begin x ≡⟨ x≡fx∈xs ⟩ f x∈xs ≡⟨ f≈g x∈xs ⟩ g (xs⊆ys x∈xs) ∎)) ∘ _⟨$⟩_ (Inverse.from map-with-∈↔) where open P.≡-Reasoning -- Other properties. filter-⊆ : ∀ {a} {A : Set a} (p : A → Bool) → (xs : List A) → filter p xs ⊆ xs filter-⊆ _ [] = λ () filter-⊆ p (x ∷ xs) with p x | filter-⊆ p xs ... | false | hyp = there ∘ hyp ... | true | hyp = λ { (here eq) → here eq ; (there ∈filter) → there (hyp ∈filter) } ------------------------------------------------------------------------ -- Other properties -- Only a finite number of distinct elements can be members of a -- given list. finite : ∀ {a} {A : Set a} (f : Inj.Injection (P.setoid ℕ) (P.setoid A)) → ∀ xs → ¬ (∀ i → Inj.Injection.to f ⟨$⟩ i ∈ xs) finite inj [] ∈[] with ∈[] zero ... | () finite {A = A} inj (x ∷ xs) ∈x∷xs = excluded-middle helper where open Inj.Injection inj module DTO = DecTotalOrder Nat.decTotalOrder module STO = StrictTotalOrder (DTOProperties.strictTotalOrder Nat.decTotalOrder) module CS = CommutativeSemiring NatProp.commutativeSemiring not-x : ∀ {i} → ¬ (to ⟨$⟩ i ≡ x) → to ⟨$⟩ i ∈ xs not-x {i} ≢x with ∈x∷xs i ... | here ≡x = ⊥-elim (≢x ≡x) ... | there ∈xs = ∈xs helper : ¬ Dec (∃ λ i → to ⟨$⟩ i ≡ x) helper (no ≢x) = finite inj xs (λ i → not-x (≢x ∘ _,_ i)) helper (yes (i , ≡x)) = finite inj′ xs ∈xs where open P f : ℕ → A f j with STO.compare i j f j | tri< _ _ _ = to ⟨$⟩ suc j f j | tri≈ _ _ _ = to ⟨$⟩ suc j f j | tri> _ _ _ = to ⟨$⟩ j ∈-if-not-i : ∀ {j} → i ≢ j → to ⟨$⟩ j ∈ xs ∈-if-not-i i≢j = not-x (i≢j ∘ injective ∘ trans ≡x ∘ sym) lemma : ∀ {k j} → k ≤ j → suc j ≢ k lemma 1+j≤j refl = NatProp.1+n≰n 1+j≤j ∈xs : ∀ j → f j ∈ xs ∈xs j with STO.compare i j ∈xs j | tri< (i≤j , _) _ _ = ∈-if-not-i (lemma i≤j ∘ sym) ∈xs j | tri> _ i≢j _ = ∈-if-not-i i≢j ∈xs .i | tri≈ _ refl _ = ∈-if-not-i (NatProp.m≢1+m+n i ∘ subst (_≡_ i ∘ suc) (sym $ proj₂ CS.+-identity i)) injective′ : Inj.Injective {B = P.setoid A} (→-to-⟶ f) injective′ {j} {k} eq with STO.compare i j | STO.compare i k ... | tri< _ _ _ | tri< _ _ _ = cong pred $ injective eq ... | tri< _ _ _ | tri≈ _ _ _ = cong pred $ injective eq ... | tri< (i≤j , _) _ _ | tri> _ _ (k≤i , _) = ⊥-elim (lemma (DTO.trans k≤i i≤j) $ injective eq) ... | tri≈ _ _ _ | tri< _ _ _ = cong pred $ injective eq ... | tri≈ _ _ _ | tri≈ _ _ _ = cong pred $ injective eq ... | tri≈ _ i≡j _ | tri> _ _ (k≤i , _) = ⊥-elim (lemma (subst (_≤_ k) i≡j k≤i) $ injective eq) ... | tri> _ _ (j≤i , _) | tri< (i≤k , _) _ _ = ⊥-elim (lemma (DTO.trans j≤i i≤k) $ sym $ injective eq) ... | tri> _ _ (j≤i , _) | tri≈ _ i≡k _ = ⊥-elim (lemma (subst (_≤_ j) i≡k j≤i) $ sym $ injective eq) ... | tri> _ _ (j≤i , _) | tri> _ _ (k≤i , _) = injective eq inj′ = record { to = →-to-⟶ {B = P.setoid A} f ; injective = injective′ }
{ "alphanum_fraction": 0.467140825, "avg_line_length": 38.4854014599, "ext": "agda", "hexsha": "4e948ef27402dea805b28223d1925235cd550860", "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/Membership.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/Membership.agda", "max_line_length": 126, "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/Membership.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": 4378, "size": 10545 }
{-# OPTIONS --without-K --safe #-} module Cats.Util.SetoidReasoning where open import Relation.Binary.Reasoning.MultiSetoid public open import Relation.Binary using (Setoid) module _ {c ℓ} (S : Setoid c ℓ) where open Setoid S triangle : ∀ m {x y} → x ≈ m → y ≈ m → x ≈ y triangle m x≈m y≈m = trans x≈m (sym y≈m)
{ "alphanum_fraction": 0.6312684366, "avg_line_length": 18.8333333333, "ext": "agda", "hexsha": "22480955c2d9f5ccae7a4f946d66ef6b13a776c7", "lang": "Agda", "max_forks_count": 1, "max_forks_repo_forks_event_max_datetime": "2019-03-18T15:35:07.000Z", "max_forks_repo_forks_event_min_datetime": "2019-03-18T15:35:07.000Z", "max_forks_repo_head_hexsha": "1ad7b243acb622d46731e9ae7029408db6e561f1", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "JLimperg/cats", "max_forks_repo_path": "Cats/Util/SetoidReasoning.agda", "max_issues_count": null, "max_issues_repo_head_hexsha": "1ad7b243acb622d46731e9ae7029408db6e561f1", "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": "JLimperg/cats", "max_issues_repo_path": "Cats/Util/SetoidReasoning.agda", "max_line_length": 56, "max_stars_count": 24, "max_stars_repo_head_hexsha": "1ad7b243acb622d46731e9ae7029408db6e561f1", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "JLimperg/cats", "max_stars_repo_path": "Cats/Util/SetoidReasoning.agda", "max_stars_repo_stars_event_max_datetime": "2021-08-06T05:00:46.000Z", "max_stars_repo_stars_event_min_datetime": "2017-11-03T15:18:57.000Z", "num_tokens": 117, "size": 339 }
-- {-# OPTIONS -v tc.meta:30 #-} module GiveSize where {-# BUILTIN SIZE Size #-} postulate A : Size → Set c : ∀ i → A i k : ∀ i → A i k i = c {!i!}
{ "alphanum_fraction": 0.5064102564, "avg_line_length": 12, "ext": "agda", "hexsha": "7b0f151528c97f23fc22ea97e25325e5455afbd0", "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/interaction/GiveSize.agda", "max_issues_count": 3, "max_issues_repo_head_hexsha": "ed8ac6f4062ea8a20fa0f62d5db82d4e68278338", "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": "shlevy/agda", "max_issues_repo_path": "test/interaction/GiveSize.agda", "max_line_length": 32, "max_stars_count": 3, "max_stars_repo_head_hexsha": "ed8ac6f4062ea8a20fa0f62d5db82d4e68278338", "max_stars_repo_licenses": [ "BSD-3-Clause" ], "max_stars_repo_name": "shlevy/agda", "max_stars_repo_path": "test/interaction/GiveSize.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": 57, "size": 156 }
{-# OPTIONS --allow-unsolved-metas #-} -- This file documents a bug caused by one of the fixes for issue 153. module Issue153 where open import Common.Coinduction record R : Set₁ where field S : Set T : S → Set module D (r : R) (s : R.S r) where open R r data D (t : T s) : Set where module M (r : R) (s : R.S r) where open R r open D _ s postulate t : T s d : D t foo : ∞ (D t) foo = ♯ d -- An internal error has occurred. Please report this as a bug. -- Location of the error: src/full/Agda/Interaction/Highlighting/Generate.hs:383
{ "alphanum_fraction": 0.6284722222, "avg_line_length": 18, "ext": "agda", "hexsha": "16f62f8b3d4a8f518c706b8b673845d94c74db3b", "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/Issue153.agda", "max_issues_count": 3, "max_issues_repo_head_hexsha": "ed8ac6f4062ea8a20fa0f62d5db82d4e68278338", "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": "shlevy/agda", "max_issues_repo_path": "test/Succeed/Issue153.agda", "max_line_length": 80, "max_stars_count": 3, "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/Issue153.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": 190, "size": 576 }
{-# OPTIONS --safe --warning=error --without-K #-} open import Groups.Definition open import Setoids.Setoids open import Sets.EquivalenceRelations open import Agda.Primitive using (Level; lzero; lsuc; _⊔_) -- Following Part IB's course Groups, Rings, and Modules, we take rings to be commutative with one. module Rings.Definition where record Ring {n m} {A : Set n} (S : Setoid {n} {m} A) (_+_ : A → A → A) (_*_ : A → A → A) : Set (lsuc n ⊔ m) where field additiveGroup : Group S _+_ open Group additiveGroup open Setoid S open Equivalence eq 0R : A 0R = 0G _-R_ : A → A → A a -R b = a + (inverse b) field *WellDefined : {r s t u : A} → (r ∼ t) → (s ∼ u) → r * s ∼ t * u 1R : A groupIsAbelian : {a b : A} → a + b ∼ b + a *Associative : {a b c : A} → (a * (b * c)) ∼ (a * b) * c *Commutative : {a b : A} → a * b ∼ b * a *DistributesOver+ : {a b c : A} → a * (b + c) ∼ (a * b) + (a * c) identIsIdent : {a : A} → 1R * a ∼ a timesZero : {a : A} → a * 0R ∼ 0R timesZero {a} = symmetric (transitive (transitive (symmetric invLeft) (+WellDefined reflexive (transitive (*WellDefined {a} {a} reflexive (symmetric identRight)) *DistributesOver+))) (transitive +Associative (transitive (+WellDefined invLeft reflexive) identLeft))) timesZero' : {a : A} → 0R * a ∼ 0R timesZero' {a} = transitive *Commutative timesZero *DistributesOver+' : {a b c : A} → (a + b) * c ∼ (a * c) + (b * c) *DistributesOver+' = transitive *Commutative (transitive *DistributesOver+ (+WellDefined *Commutative *Commutative)) *Associative' : {a b c : A} → ((a * b) * c) ∼ (a * (b * c)) *Associative' = symmetric *Associative identIsIdent' : {a : A} → a * 1R ∼ a identIsIdent' = transitive *Commutative identIsIdent
{ "alphanum_fraction": 0.606613455, "avg_line_length": 43.85, "ext": "agda", "hexsha": "1cfb0c1afa18b3878632c6274971e0c4b23d0dac", "lang": "Agda", "max_forks_count": 1, "max_forks_repo_forks_event_max_datetime": "2021-11-29T13:23:07.000Z", "max_forks_repo_forks_event_min_datetime": "2021-11-29T13:23:07.000Z", "max_forks_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "Smaug123/agdaproofs", "max_forks_repo_path": "Rings/Definition.agda", "max_issues_count": 14, "max_issues_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_issues_repo_issues_event_max_datetime": "2020-04-11T11:03:39.000Z", "max_issues_repo_issues_event_min_datetime": "2019-01-06T21:11:59.000Z", "max_issues_repo_licenses": [ "MIT" ], "max_issues_repo_name": "Smaug123/agdaproofs", "max_issues_repo_path": "Rings/Definition.agda", "max_line_length": 267, "max_stars_count": 4, "max_stars_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "Smaug123/agdaproofs", "max_stars_repo_path": "Rings/Definition.agda", "max_stars_repo_stars_event_max_datetime": "2022-01-28T06:04:15.000Z", "max_stars_repo_stars_event_min_datetime": "2019-08-08T12:44:19.000Z", "num_tokens": 671, "size": 1754 }
module MLib.Matrix.Core where open import MLib.Prelude open import MLib.Algebra.PropertyCode open import MLib.Algebra.PropertyCode.Structures import Relation.Binary.Indexed as I Matrix : ∀ {a} → Set a → ℕ → ℕ → Set a Matrix A m n = Fin m → Fin n → A module _ {a} (A : Set a) where row : ∀ {m n} → Fin m → Matrix A m n → Table A n row i M .lookup j = M i j col : ∀ {m n} → Fin n → Matrix A m n → Table A m col j M .lookup i = M i j
{ "alphanum_fraction": 0.6418918919, "avg_line_length": 24.6666666667, "ext": "agda", "hexsha": "1e87fdfe1a825fb5d2f855db728a9d8b6eb8d232", "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": "e26ae2e0aa7721cb89865aae78625a2f3fd2b574", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "bch29/agda-matrices", "max_forks_repo_path": "src/MLib/Matrix/Core.agda", "max_issues_count": null, "max_issues_repo_head_hexsha": "e26ae2e0aa7721cb89865aae78625a2f3fd2b574", "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": "bch29/agda-matrices", "max_issues_repo_path": "src/MLib/Matrix/Core.agda", "max_line_length": 50, "max_stars_count": null, "max_stars_repo_head_hexsha": "e26ae2e0aa7721cb89865aae78625a2f3fd2b574", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "bch29/agda-matrices", "max_stars_repo_path": "src/MLib/Matrix/Core.agda", "max_stars_repo_stars_event_max_datetime": null, "max_stars_repo_stars_event_min_datetime": null, "num_tokens": 151, "size": 444 }
module to-string-tests where open import lib open import cedille-types open import syntax-util open import to-string t = mapp (mapp (mvar "plus") (mvar "Z")) (mvar "Z") s = term-to-string t
{ "alphanum_fraction": 0.71875, "avg_line_length": 19.2, "ext": "agda", "hexsha": "b36706b016b6c0bcc43d998215f2b569cf5224d5", "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": "acf691e37210607d028f4b19f98ec26c4353bfb5", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "xoltar/cedille", "max_forks_repo_path": "src/to-string-tests.agda", "max_issues_count": null, "max_issues_repo_head_hexsha": "acf691e37210607d028f4b19f98ec26c4353bfb5", "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": "xoltar/cedille", "max_issues_repo_path": "src/to-string-tests.agda", "max_line_length": 51, "max_stars_count": null, "max_stars_repo_head_hexsha": "acf691e37210607d028f4b19f98ec26c4353bfb5", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "xoltar/cedille", "max_stars_repo_path": "src/to-string-tests.agda", "max_stars_repo_stars_event_max_datetime": null, "max_stars_repo_stars_event_min_datetime": null, "num_tokens": 59, "size": 192 }
-- MIT License -- Copyright (c) 2021 Luca Ciccone and Luca Padovani -- Permission is hereby granted, free of charge, to any person -- obtaining a copy of this software and associated documentation -- files (the "Software"), to deal in the Software without -- restriction, including without limitation the rights to use, -- copy, modify, merge, publish, distribute, sublicense, and/or sell -- copies of the Software, and to permit persons to whom the -- Software is furnished to do so, subject to the following -- conditions: -- The above copyright notice and this permission notice shall be -- included in all copies or substantial portions of the Software. -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -- OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -- HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -- WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -- FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -- OTHER DEALINGS IN THE SOFTWARE. {-# OPTIONS --guardedness #-} open import Level open import Data.Empty open import Data.Unit open import Data.Product open import Data.Sum open import Data.Bool open import Data.List using (List) open import Relation.Nullary open import Relation.Nullary.Decidable open import Relation.Unary using (Pred; _∈_; _⊆_; Empty; Satisfiable) open import Relation.Binary.PropositionalEquality using (_≡_; refl ; subst ; cong) open import Common module SessionType {ℙ : Set} (message : Message ℙ) where data SessionType : Set record ∞SessionType : Set where constructor box_ coinductive field force : SessionType open ∞SessionType public Continuation : Set Continuation = ℙ -> ∞SessionType data SessionType where nil : SessionType inp : (f : Continuation) -> SessionType out : (f : Continuation) -> SessionType data Defined : SessionType -> Set where inp : ∀{f} -> Defined (inp f) out : ∀{f} -> Defined (out f) Defined? : (T : SessionType) -> Dec (Defined T) Defined? nil = no λ () Defined? (inp _) = yes inp Defined? (out _) = yes out Defined-eq : ∀{T : SessionType} (p : Defined T) (q : Defined T) -> p ≡ q Defined-eq inp inp = refl Defined-eq out out = refl dom : Continuation -> Pred ℙ Level.zero dom f x = Defined (f x .force) _∈?_ : (x : ℙ) (f : Continuation) -> Dec (x ∈ dom f) x ∈? f with f x .force ... | nil = no λ () ... | inp _ = yes inp ... | out _ = yes out EmptyContinuation : Continuation -> Set EmptyContinuation f = Empty (dom f) Witness : Continuation -> Set Witness f = Satisfiable (dom f) Empty? : (f : Continuation) -> EmptyContinuation f ⊎ Witness f Empty? f with excluded-middle {Witness f} ... | yes w = inj₂ w ... | no nw = inj₁ λ x def -> nw (x , def) -- WARNING: Win and End must be different predicates, because -- client-wise they are different, whereas Server-wise they are -- equivalent. inp cannot be End or else an ended client may receive -- a message and fail! data Win : SessionType -> Set where out : ∀{f} (U : EmptyContinuation f) -> Win (out f) data End : SessionType -> Set where inp : ∀{f} (U : EmptyContinuation f) -> End (inp f) out : ∀{f} (U : EmptyContinuation f) -> End (out f) win : SessionType win = out λ _ -> λ where .force -> nil Win-win : Win win Win-win = out λ { _ () } win->defined : ∀{T} -> Win T -> Defined T win->defined (out _) = out -- if T is not Defined, then it is nil not-def->nil : ∀{T} → ¬ (Defined T) → T ≡ nil not-def->nil {nil} nd = refl not-def->nil {inp f} nd = ⊥-elim (nd inp) not-def->nil {out f} nd = ⊥-elim (nd out) not-nil-defined : Defined nil → ⊥ not-nil-defined () open Message message if-≡-ch : (x y : ℙ) → SessionType → SessionType → SessionType if-≡-ch x y S T with x ?= y ... | no ¬p = T ... | yes refl = S sample-cont : ℙ → SessionType → SessionType → Continuation force (sample-cont t S T x) = if-≡-ch x t S T cont-not-def : ∀{t} → ¬ (Defined (sample-cont t nil win t .force)) cont-not-def {t} ok with t ?= t cont-not-def {t} () | yes refl ... | no ¬eq = ⊥-elim (¬eq refl) force-eq : ∀{t S T} → S ≡ (sample-cont t S T) t .force force-eq {t} with t ?= t ... | no ¬p = ⊥-elim (¬p refl) ... | yes refl = refl wit-cont : ∀{t S T} → Defined S → Witness (sample-cont t S T) wit-cont {t} def = t , subst Defined force-eq def sample-in : (t : ℙ) → SessionType → SessionType sample-in t S = inp (sample-cont t S nil) sample-out : (t : ℙ) → SessionType → SessionType sample-out t S = out (sample-cont t S nil) full-cont : SessionType → Continuation force (full-cont S _) = S
{ "alphanum_fraction": 0.6766222604, "avg_line_length": 30.0258064516, "ext": "agda", "hexsha": "6243d2ebb1f033025aae7fea73892348f0eece2b", "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": "c4b78e70c3caf68d509f4360b9171d9f80ecb825", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "boystrange/FairSubtypingAgda", "max_forks_repo_path": "src/SessionType.agda", "max_issues_count": null, "max_issues_repo_head_hexsha": "c4b78e70c3caf68d509f4360b9171d9f80ecb825", "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": "boystrange/FairSubtypingAgda", "max_issues_repo_path": "src/SessionType.agda", "max_line_length": 82, "max_stars_count": 4, "max_stars_repo_head_hexsha": "c4b78e70c3caf68d509f4360b9171d9f80ecb825", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "boystrange/FairSubtypingAgda", "max_stars_repo_path": "src/SessionType.agda", "max_stars_repo_stars_event_max_datetime": "2022-01-24T14:38:47.000Z", "max_stars_repo_stars_event_min_datetime": "2021-07-29T14:32:30.000Z", "num_tokens": 1358, "size": 4654 }
{-# OPTIONS --without-K --safe #-} open import Definition.Typed.EqualityRelation module Definition.LogicalRelation.Substitution {{eqrel : EqRelSet}} where open import Agda.Primitive open import Definition.Untyped open import Definition.Typed open import Definition.LogicalRelation open import Tools.Embedding open import Tools.Product open import Tools.Unit -- The validity judgements: -- We consider expressions that satisfy these judgments valid ValRel : Setω₂ ValRel = (Γ : Con Term) → (⊩Subst : (Δ : Con Term) → Subst → ⊢ Δ → Setω) → (⊩EqSubst : (Δ : Con Term) → (σ σ′ : Subst) → (⊢Δ : ⊢ Δ) → (⊩Subst Δ σ ⊢Δ) → Setω) → Setω₁ record ⊩ᵛ⁰_/_ (Γ : Con Term) (_⊩_▸_ : ValRel) : Setω₁ where inductive eta-equality constructor VPack field ⊩Subst : (Δ : Con Term) → Subst → ⊢ Δ → Setω ⊩EqSubst : (Δ : Con Term) → (σ σ′ : Subst) → (⊢Δ : ⊢ Δ) → (⊩Subst Δ σ ⊢Δ) → Setω ⊩V : Γ ⊩ ⊩Subst ▸ ⊩EqSubst _⊩ˢ⁰_∷_/_/_ : {R : ValRel} (Δ : Con Term) (σ : Subst) (Γ : Con Term) ([Γ] : ⊩ᵛ⁰ Γ / R) (⊢Δ : ⊢ Δ) → Setω Δ ⊩ˢ⁰ σ ∷ Γ / VPack ⊩Subst ⊩EqSubst ⊩V / ⊢Δ = ⊩Subst Δ σ ⊢Δ _⊩ˢ⁰_≡_∷_/_/_/_ : {R : ValRel} (Δ : Con Term) (σ σ′ : Subst) (Γ : Con Term) ([Γ] : ⊩ᵛ⁰ Γ / R) (⊢Δ : ⊢ Δ) ([σ] : Δ ⊩ˢ⁰ σ ∷ Γ / [Γ] / ⊢Δ) → Setω Δ ⊩ˢ⁰ σ ≡ σ′ ∷ Γ / VPack ⊩Subst ⊩EqSubst ⊩V / ⊢Δ / [σ] = ⊩EqSubst Δ σ σ′ ⊢Δ [σ] -- Validity of types _⊩ᵛ⁰⟨_⟩_/_ : {R : ValRel} (Γ : Con Term) (l : TypeLevel) (A : Term) → ⊩ᵛ⁰ Γ / R → Setω _⊩ᵛ⁰⟨_⟩_/_ Γ l A [Γ] = ∀ {Δ σ} (⊢Δ : ⊢ Δ) ([σ] : Δ ⊩ˢ⁰ σ ∷ Γ / [Γ] / ⊢Δ) → Σω₀ (Δ ⊩⟨ l ⟩ subst σ A) (λ [Aσ] → ∀ {σ′} ([σ′] : Δ ⊩ˢ⁰ σ′ ∷ Γ / [Γ] / ⊢Δ) ([σ≡σ′] : Δ ⊩ˢ⁰ σ ≡ σ′ ∷ Γ / [Γ] / ⊢Δ / [σ]) → Δ ⊩⟨ l ⟩ subst σ A ≡ subst σ′ A / [Aσ]) data _⊩V_▸_ : ValRel where Vε : ε ⊩V (λ Δ σ ⊢Δ → ⊤′) ▸ (λ Δ σ σ′ ⊢Δ [σ] → ⊤′) V∙ : ∀ {Γ A l} → ([Γ] : ⊩ᵛ⁰ Γ / _⊩V_▸_) → ([A] : Γ ⊩ᵛ⁰⟨ l ⟩ A / [Γ]) → Γ ∙ A ⊩V (λ Δ σ ⊢Δ → Σω₂ (Δ ⊩ˢ⁰ tail σ ∷ Γ / [Γ] / ⊢Δ) (λ [tailσ] → (Δ ⊩⟨ l ⟩ head σ ∷ subst (tail σ) A / proj₁ ([A] ⊢Δ [tailσ])))) ▸ (λ Δ σ σ′ ⊢Δ [σ] → (Δ ⊩ˢ⁰ tail σ ≡ tail σ′ ∷ Γ / [Γ] / ⊢Δ / proj₁ [σ]) ×ω₂ (Δ ⊩⟨ l ⟩ head σ ≡ head σ′ ∷ subst (tail σ) A / proj₁ ([A] ⊢Δ (proj₁ [σ])))) ⊩ᵛ : Con Term → Setω₁ ⊩ᵛ Γ = ⊩ᵛ⁰ Γ / _⊩V_▸_ _⊩ˢ_∷_/_/_ : (Δ : Con Term) (σ : Subst) (Γ : Con Term) ([Γ] : ⊩ᵛ Γ) (⊢Δ : ⊢ Δ) → Setω Δ ⊩ˢ σ ∷ Γ / [Γ] / ⊢Δ = Δ ⊩ˢ⁰ σ ∷ Γ / [Γ] / ⊢Δ _⊩ˢ_≡_∷_/_/_/_ : (Δ : Con Term) (σ σ′ : Subst) (Γ : Con Term) ([Γ] : ⊩ᵛ Γ) (⊢Δ : ⊢ Δ) ([σ] : Δ ⊩ˢ σ ∷ Γ / [Γ] / ⊢Δ) → Setω Δ ⊩ˢ σ ≡ σ′ ∷ Γ / [Γ] / ⊢Δ / [σ] = Δ ⊩ˢ⁰ σ ≡ σ′ ∷ Γ / [Γ] / ⊢Δ / [σ] -- Validity of types _⊩ᵛ⟨_⟩_/_ : (Γ : Con Term) (l : TypeLevel) (A : Term) → ⊩ᵛ Γ → Setω Γ ⊩ᵛ⟨ l ⟩ A / [Γ] = Γ ⊩ᵛ⁰⟨ l ⟩ A / [Γ] -- Validity of terms _⊩ᵛ⟨_⟩_∷_/_/_ : (Γ : Con Term) (l : TypeLevel) (t A : Term) ([Γ] : ⊩ᵛ Γ) ([A] : Γ ⊩ᵛ⟨ l ⟩ A / [Γ]) → Setω Γ ⊩ᵛ⟨ l ⟩ t ∷ A / [Γ] / [A] = ∀ {Δ σ} (⊢Δ : ⊢ Δ) ([σ] : Δ ⊩ˢ σ ∷ Γ / [Γ] / ⊢Δ) → Σω₀ (Δ ⊩⟨ l ⟩ subst σ t ∷ subst σ A / proj₁ ([A] ⊢Δ [σ])) λ [tσ] → ∀ {σ′} → Δ ⊩ˢ σ′ ∷ Γ / [Γ] / ⊢Δ → Δ ⊩ˢ σ ≡ σ′ ∷ Γ / [Γ] / ⊢Δ / [σ] → Δ ⊩⟨ l ⟩ subst σ t ≡ subst σ′ t ∷ subst σ A / proj₁ ([A] ⊢Δ [σ]) -- Validity of type equality _⊩ᵛ⟨_⟩_≡_/_/_ : (Γ : Con Term) (l : TypeLevel) (A B : Term) ([Γ] : ⊩ᵛ Γ) ([A] : Γ ⊩ᵛ⟨ l ⟩ A / [Γ]) → Setω Γ ⊩ᵛ⟨ l ⟩ A ≡ B / [Γ] / [A] = ∀ {Δ σ} (⊢Δ : ⊢ Δ) ([σ] : Δ ⊩ˢ σ ∷ Γ / [Γ] / ⊢Δ) → Δ ⊩⟨ l ⟩ subst σ A ≡ subst σ B / proj₁ ([A] ⊢Δ [σ]) -- Validity of term equality _⊩ᵛ⟨_⟩_≡_∷_/_/_ : (Γ : Con Term) (l : TypeLevel) (t u A : Term) ([Γ] : ⊩ᵛ Γ) ([A] : Γ ⊩ᵛ⟨ l ⟩ A / [Γ]) → Setω Γ ⊩ᵛ⟨ l ⟩ t ≡ u ∷ A / [Γ] / [A] = ∀ {Δ σ} → (⊢Δ : ⊢ Δ) ([σ] : Δ ⊩ˢ σ ∷ Γ / [Γ] / ⊢Δ) → Δ ⊩⟨ l ⟩ subst σ t ≡ subst σ u ∷ subst σ A / proj₁ ([A] ⊢Δ [σ]) -- Valid term equality with validity of its type and terms record [_⊩ᵛ⟨_⟩_≡_∷_/_] (Γ : Con Term) (l : TypeLevel) (t u A : Term) ([Γ] : ⊩ᵛ Γ) : Setω where constructor modelsTermEq field [A] : Γ ⊩ᵛ⟨ l ⟩ A / [Γ] [t] : Γ ⊩ᵛ⟨ l ⟩ t ∷ A / [Γ] / [A] [u] : Γ ⊩ᵛ⟨ l ⟩ u ∷ A / [Γ] / [A] [t≡u] : Γ ⊩ᵛ⟨ l ⟩ t ≡ u ∷ A / [Γ] / [A] -- Validity of reduction of terms _⊩ᵛ_⇒_∷_/_ : (Γ : Con Term) (t u A : Term) ([Γ] : ⊩ᵛ Γ) → Setω Γ ⊩ᵛ t ⇒ u ∷ A / [Γ] = ∀ {Δ σ} (⊢Δ : ⊢ Δ) ([σ] : Δ ⊩ˢ σ ∷ Γ / [Γ] / ⊢Δ) → Δ ⊢ subst σ t ⇒ subst σ u ∷ subst σ A _∙″_ : ∀ {Γ A l} → ([Γ] : ⊩ᵛ Γ) → Γ ⊩ᵛ⟨ l ⟩ A / [Γ] → ⊩ᵛ (Γ ∙ A) [Γ] ∙″ [A] = (VPack _ _ (V∙ [Γ] [A])) pattern ε′ = (VPack _ _ Vε) pattern _∙′_ [Γ] [A] = (VPack _ _ (V∙ [Γ] [A]))
{ "alphanum_fraction": 0.4327510917, "avg_line_length": 37.5409836066, "ext": "agda", "hexsha": "7f9ece4430062d3e453afe2ab75a23e650e3a8b3", "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": "2251b8da423be0c6fb916f2675d7bd8537e4cd96", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "loic-p/logrel-mltt", "max_forks_repo_path": "Definition/LogicalRelation/Substitution.agda", "max_issues_count": null, "max_issues_repo_head_hexsha": "2251b8da423be0c6fb916f2675d7bd8537e4cd96", "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": "loic-p/logrel-mltt", "max_issues_repo_path": "Definition/LogicalRelation/Substitution.agda", "max_line_length": 101, "max_stars_count": null, "max_stars_repo_head_hexsha": "2251b8da423be0c6fb916f2675d7bd8537e4cd96", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "loic-p/logrel-mltt", "max_stars_repo_path": "Definition/LogicalRelation/Substitution.agda", "max_stars_repo_stars_event_max_datetime": null, "max_stars_repo_stars_event_min_datetime": null, "num_tokens": 2685, "size": 4580 }
module ExpressionChanging where open import ParseTree open import Data.Maybe hiding (map) open import Data.List.NonEmpty open import ParseTreeOperations open import AgdaHelperFunctions open import Data.List open import Data.Nat open import Data.Vec using (Vec) open import Data.Fin open import ScopeState import Data.Nat.Properties open import Relation.Nullary import Data.String open import Data.Nat.Show open import Data.Bool {-# TERMINATING #-} applyToExpressionsAndSubExpressions : (List⁺ Expr -> List⁺ Expr) -> Expr -> Expr applyToExpressionsAndSubExpressions i e = listToExpression $ head newTop ∷ newRest where newTop = i $ expressionToList e newRest = Data.List.map (applyToExpressionsAndSubExpressions i) $ tail newTop applyToAllInSignature : (List⁺ Expr -> List⁺ Expr) -> TypeSignature -> TypeSignature applyToAllInSignature i (typeSignature funcName funcType) = typeSignature funcName $ applyToExpressionsAndSubExpressions i funcType applyToAllExpressions : (List⁺ Expr -> List⁺ Expr) -> ParseTree -> ParseTree applyToAllExpressions instructions (signature signature₁ range₁) = signature (applyToAllInSignature instructions signature₁) range₁ applyToAllExpressions instructions (functionDefinition definitionOf params body range₁) = functionDefinition definitionOf (tail newParams) (applyToExpressionsAndSubExpressions instructions body) range₁ where newParams = instructions (ident definitionOf ∷ Data.List.map (applyToExpressionsAndSubExpressions instructions) params) applyToAllExpressions instructions (dataStructure dataName parameters indexInfo constructors range₁ {c} ) = dataStructure dataName (Data.List.map (applyToAllInSignature instructions) parameters) (applyToExpressionsAndSubExpressions instructions indexInfo) (Data.List.map (applyToAllInSignature instructions) constructors) range₁ {c} applyToAllExpressions instructions x = x applyToProgram : (List⁺ Expr -> List⁺ Expr) -> Data.List.List ParseTree -> Data.List.List ParseTree applyToProgram i c = Data.List.map (applyToAllExpressions i) c makeFin : {n : ℕ} -> Vec Expr (n) -> ℕ -> ScopeState (Fin n) makeFin {n} v number with number Data.Nat.Properties.<? n makeFin {n} v number | yes p = return $ fromℕ≤ p makeFin {n} v number | no ¬p = fail $ "Got a non-existing argument: " Data.String.++ Data.Nat.Show.show n Data.String.++ Data.Nat.Show.show (Data.List.length $ Data.Vec.toList v) makeFin2 : {n : ℕ} -> Vec Expr (suc n) -> ℕ -> ScopeState (Fin n) makeFin2 {n} v number with number Data.Nat.Properties.<? n makeFin2 {n} v number | yes p = return $ fromℕ≤ p makeFin2 {n} v number | no ¬p = fail $ "Got a non-existing argument: " Data.String.++ Data.Nat.Show.show n Data.String.++ Data.Nat.Show.show (Data.List.length $ Data.Vec.toList v) --TODO: try to give this a better type updateSignature : ℕ -> List⁺ Expr -> (alterSignature : {n : ℕ} -> Vec Expr (suc n) -> Fin n -> ScopeState (Vec Expr (suc n))) -> ScopeState (List⁺ Expr) updateSignature argNo type f with toVec type ... | c = do -- In a signature, we always have at least one item which is not an argument: the result type newFin <- makeFin2 c argNo newVec <- f c newFin return $ Data.List.NonEmpty.fromVec newVec doForArgument : List ParseTree -> ℕ -> ℕ -> (alterSignature : {n : ℕ} -> Vec Expr (suc n) -> Fin n -> ScopeState (Vec Expr (suc n))) -> (alterExpression : TypeSignature -> ℕ -> ScopeState (List⁺ Expr -> List⁺ Expr)) -> ScopeState (List ParseTree) doForArgument [] funcID whichArgument f1 f2 = fail "funcId not found in doForArgument" doForArgument (signature (typeSignature (identifier name isInRange scope declaration) funcType) range₁ ∷ code) funcID whichArgument f1 f2 with Data.Nat.compare declaration funcID doForArgument (signature (typeSignature (identifier name isInRange scope declaration {e}{b} {a}) funcType) range₁ ∷ code) .declaration whichArgument f1 f2 | equal .declaration = do newType <- updateSignature whichArgument (typeToList funcType) f1 instruction <- f2 ((typeSignature (identifier name isInRange scope declaration {e}{b} {a})) funcType) whichArgument return $ applyToProgram instruction $ signature (typeSignature (identifier name isInRange scope declaration {e}{b} {a}) (listToType newType)) range₁ ∷ code doForArgument (signature (typeSignature (identifier name isInRange scope declaration {e}{b} {a}) funcType) range₁ ∷ code) funcID whichArgument f1 f2 | _ = do newxs <- doForArgument code funcID whichArgument f1 f2 return $ (signature (typeSignature (identifier name isInRange scope declaration {e}{b} {a}) funcType) range₁) ∷ newxs doForArgument (x ∷ xs) funcID whichArgument f1 f2 = do newxs <- doForArgument xs funcID whichArgument f1 f2 return $ x ∷ newxs makeInstruction : TypeSignature -> ℕ -> (makeIns : {n : ℕ} -> Vec Expr n -> Fin n -> (List Expr -> List Expr)) -> ScopeState (List⁺ Expr -> List⁺ Expr) makeInstruction (typeSignature funcName funcType) argNo f with toVec (typeToList funcType) ... | c = do newFin <- makeFin c argNo return $ function $ f c newFin where function : (List Expr -> List Expr) -> (List⁺ Expr -> List⁺ Expr) function f (ident identifier₁ ∷ tail₁) with sameId identifier₁ funcName function f (ident identifier₁ ∷ tail₁) | false = (ident identifier₁ ∷ tail₁) function f (ident identifier₁ ∷ tail₁) | true = ident identifier₁ ∷ f tail₁ function f list = list
{ "alphanum_fraction": 0.7305247866, "avg_line_length": 51.9528301887, "ext": "agda", "hexsha": "a67f088f3dbad130ebaf0449c1d24221038e9ed0", "lang": "Agda", "max_forks_count": 1, "max_forks_repo_forks_event_max_datetime": "2019-01-31T08:40:41.000Z", "max_forks_repo_forks_event_min_datetime": "2019-01-31T08:40:41.000Z", "max_forks_repo_head_hexsha": "52d1034aed14c578c9e077fb60c3db1d0791416b", "max_forks_repo_licenses": [ "BSD-3-Clause" ], "max_forks_repo_name": "omega12345/RefactorAgda", "max_forks_repo_path": "RefactorAgdaEngine/ExpressionChanging.agda", "max_issues_count": 3, "max_issues_repo_head_hexsha": "52d1034aed14c578c9e077fb60c3db1d0791416b", "max_issues_repo_issues_event_max_datetime": "2019-02-05T12:53:36.000Z", "max_issues_repo_issues_event_min_datetime": "2019-01-31T08:03:07.000Z", "max_issues_repo_licenses": [ "BSD-3-Clause" ], "max_issues_repo_name": "omega12345/RefactorAgda", "max_issues_repo_path": "RefactorAgdaEngine/ExpressionChanging.agda", "max_line_length": 180, "max_stars_count": 5, "max_stars_repo_head_hexsha": "52d1034aed14c578c9e077fb60c3db1d0791416b", "max_stars_repo_licenses": [ "BSD-3-Clause" ], "max_stars_repo_name": "omega12345/RefactorAgda", "max_stars_repo_path": "RefactorAgdaEngine/ExpressionChanging.agda", "max_stars_repo_stars_event_max_datetime": "2019-05-03T10:03:36.000Z", "max_stars_repo_stars_event_min_datetime": "2019-01-31T14:10:18.000Z", "num_tokens": 1470, "size": 5507 }
{-# OPTIONS --without-K --safe #-} module Categories.Adjoint.Instance.Core where -- The adjunction between the forgetful functor from Cats to Groupoids -- and the Core functor. open import Level using (_⊔_) import Function open import Categories.Adjoint using (_⊣_) open import Categories.Category using (Category) import Categories.Category.Construction.Core as C open import Categories.Category.Groupoid using (Groupoid) open import Categories.Category.Instance.Cats using (Cats) open import Categories.Category.Instance.Groupoids using (Groupoids) open import Categories.Functor using (Functor; _∘F_; id) open import Categories.Functor.Instance.Core using (Core) import Categories.Morphism as Morphism import Categories.Morphism.Reasoning as MR open import Categories.Morphism.IsoEquiv using (⌞_⌟) open import Categories.NaturalTransformation using (ntHelper) open import Categories.NaturalTransformation.NaturalIsomorphism using (refl; _≃_) -- The forgetful functor from Groupoids to Cats Forgetful : ∀ {o ℓ e} → Functor (Groupoids o ℓ e) (Cats o ℓ e) Forgetful = record { F₀ = category ; F₁ = Function.id ; identity = refl ; homomorphism = refl ; F-resp-≈ = Function.id } where open Groupoid -- Core is right-adjoint to the forgetful functor from Groupoids to -- Cats CoreAdj : ∀ {o ℓ e} → Forgetful {o} {ℓ ⊔ e} {e} ⊣ Core CoreAdj = record { unit = ntHelper record { η = unit ; commute = λ {G} {H} F → unit-commute {G} {H} F } ; counit = ntHelper record { η = counit ; commute = counit-commute } ; zig = λ {G} → zig {G} ; zag = zag } where open Groupoid using (category) module Core = Functor Core unit : ∀ G → Functor (category G) (C.Core (category G)) unit G = record { F₀ = Function.id ; F₁ = λ f → record { from = f ; to = f ⁻¹ ; iso = iso } ; identity = ⌞ Equiv.refl ⌟ ; homomorphism = ⌞ Equiv.refl ⌟ ; F-resp-≈ = λ eq → ⌞ eq ⌟ } where open Groupoid G unit-commute : ∀ {G H} (F : Functor (category G) (category H)) → unit H ∘F F ≃ Core.F₁ F ∘F unit G unit-commute {G} {H} F = record { F⇒G = record { η = λ _ → ≅.refl ; commute = λ _ → ⌞ MR.id-comm-sym (category H) ⌟ ; sym-commute = λ _ → ⌞ MR.id-comm (category H) ⌟ } ; F⇐G = record { η = λ _ → ≅.refl ; commute = λ _ → ⌞ MR.id-comm-sym (category H) ⌟ ; sym-commute = λ _ → ⌞ MR.id-comm (category H) ⌟ } ; iso = λ _ → record { isoˡ = ⌞ identityˡ ⌟ ; isoʳ = ⌞ identityˡ ⌟ } } where open Category (category H) open Morphism (category H) counit : ∀ C → Functor (C.Core C) C counit C = record { F₀ = Function.id ; F₁ = _≅_.from ; identity = Equiv.refl ; homomorphism = Equiv.refl ; F-resp-≈ = λ where ⌞ eq ⌟ → eq } where open Category C open Morphism C counit-commute : ∀ {C D} (F : Functor C D) → counit D ∘F Core.F₁ F ≃ F ∘F counit C counit-commute {C} {D} F = record { F⇒G = record { η = λ _ → D.id ; commute = λ _ → MR.id-comm-sym D ; sym-commute = λ _ → MR.id-comm D } ; F⇐G = record { η = λ _ → D.id ; commute = λ _ → MR.id-comm-sym D ; sym-commute = λ _ → MR.id-comm D } ; iso = λ _ → _≅_.iso ≅.refl } where module D = Category D open Morphism D zig : ∀ {G} → counit (category G) ∘F unit G ≃ id zig {G} = record { F⇒G = record { η = λ _ → G.id ; commute = λ _ → MR.id-comm-sym (category G) ; sym-commute = λ _ → MR.id-comm (category G) } ; F⇐G = record { η = λ _ → G.id ; commute = λ _ → MR.id-comm-sym (category G) ; sym-commute = λ _ → MR.id-comm (category G) } ; iso = λ _ → _≅_.iso ≅.refl } where module G = Groupoid G open Morphism G.category zag : ∀ {B} → Core.F₁ (counit B) ∘F unit (Core.F₀ B) ≃ id zag {B} = record { F⇒G = record { η = λ _ → ≅.refl ; commute = λ _ → ⌞ MR.id-comm-sym B ⌟ ; sym-commute = λ _ → ⌞ MR.id-comm B ⌟ } ; F⇐G = record { η = λ _ → ≅.refl ; commute = λ _ → ⌞ MR.id-comm-sym B ⌟ ; sym-commute = λ _ → ⌞ MR.id-comm B ⌟ } ; iso = λ _ → record { isoˡ = ⌞ identityˡ ⌟ ; isoʳ = ⌞ identityˡ ⌟ } } where open Category B open Morphism B
{ "alphanum_fraction": 0.58261276, "avg_line_length": 37.5350877193, "ext": "agda", "hexsha": "d67a4bae2983e71b99420284c94dd7ede97f9262", "lang": "Agda", "max_forks_count": 64, "max_forks_repo_forks_event_max_datetime": "2022-03-14T02:00:59.000Z", "max_forks_repo_forks_event_min_datetime": "2019-06-02T16:58:15.000Z", "max_forks_repo_head_hexsha": "d9e4f578b126313058d105c61707d8c8ae987fa8", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "Code-distancing/agda-categories", "max_forks_repo_path": "src/Categories/Adjoint/Instance/Core.agda", "max_issues_count": 236, "max_issues_repo_head_hexsha": "d9e4f578b126313058d105c61707d8c8ae987fa8", "max_issues_repo_issues_event_max_datetime": "2022-03-28T14:31:43.000Z", "max_issues_repo_issues_event_min_datetime": "2019-06-01T14:53:54.000Z", "max_issues_repo_licenses": [ "MIT" ], "max_issues_repo_name": "Code-distancing/agda-categories", "max_issues_repo_path": "src/Categories/Adjoint/Instance/Core.agda", "max_line_length": 142, "max_stars_count": 279, "max_stars_repo_head_hexsha": "d9e4f578b126313058d105c61707d8c8ae987fa8", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "Trebor-Huang/agda-categories", "max_stars_repo_path": "src/Categories/Adjoint/Instance/Core.agda", "max_stars_repo_stars_event_max_datetime": "2022-03-22T00:40:14.000Z", "max_stars_repo_stars_event_min_datetime": "2019-06-01T14:36:40.000Z", "num_tokens": 1477, "size": 4279 }
{-# OPTIONS --without-K #-} module Fiber where open import Equivalence open import NTypes.Contractible open import PathOperations open import Types fib : ∀ {a b} {A : Set a} {B : Set b} (f : A → B) (y : B) → Set _ fib {A = A} f y = Σ A λ x → f x ≡ y fib→dom : ∀ {a b} {A : Set a} {B : Set b} (f : A → B) → Σ B (fib f) → A fib→dom f (b , a , p) = a dom→fib : ∀ {a b} {A : Set a} {B : Set b} (f : A → B) → A → Σ B (fib f) dom→fib f a = f a , a , refl fib-dom-eq : ∀ {a b} {A : Set a} {B : Set b} (f : A → B) → Σ B (fib f) ≃ A fib-dom-eq {A = A} {B = B} f = fib→dom f , (dom→fib f , λ _ → refl) , (dom→fib f , λ {(b , a , p) → ap (swap ∘ _,_ a) (π₂ (pp-space-contr (f a)) (b , p))}) where swap : (Σ A λ x → Σ B λ y → f x ≡ y) → Σ B (fib f) swap (b , a , p) = a , b , p
{ "alphanum_fraction": 0.47, "avg_line_length": 25, "ext": "agda", "hexsha": "312ea657da89b7f2ce1dcc552474d1d0661e1f03", "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": "7730385adfdbdda38ee8b124be3cdeebb7312c65", "max_forks_repo_licenses": [ "BSD-3-Clause" ], "max_forks_repo_name": "vituscze/HoTT-lectures", "max_forks_repo_path": "src/Fiber.agda", "max_issues_count": null, "max_issues_repo_head_hexsha": "7730385adfdbdda38ee8b124be3cdeebb7312c65", "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": "vituscze/HoTT-lectures", "max_issues_repo_path": "src/Fiber.agda", "max_line_length": 61, "max_stars_count": null, "max_stars_repo_head_hexsha": "7730385adfdbdda38ee8b124be3cdeebb7312c65", "max_stars_repo_licenses": [ "BSD-3-Clause" ], "max_stars_repo_name": "vituscze/HoTT-lectures", "max_stars_repo_path": "src/Fiber.agda", "max_stars_repo_stars_event_max_datetime": null, "max_stars_repo_stars_event_min_datetime": null, "num_tokens": 372, "size": 800 }
{-# OPTIONS --universe-polymorphism #-} module Categories.Monoidal.Braided.Helpers where open import Categories.Monoidal.Helpers open import Data.Nat using (_+_) open import Function using (flip) open import Categories.Category import Categories.Functor open import Categories.Bifunctor hiding (identityˡ; identityʳ; assoc) renaming (id to idF; _≡_ to _≡F_; _∘_ to _∘F_) open import Categories.NaturalIsomorphism open import Categories.NaturalTransformation using (_∘₀_; _∘₁_; _∘ˡ_; _∘ʳ_; NaturalTransformation) renaming (_≡_ to _≡ⁿ_; id to idⁿ) module BraidedHelperFunctors {o ℓ e} (C : Category o ℓ e) (—⊗— : Bifunctor C C C) (id : Category.Obj C) where open MonoidalHelperFunctors C —⊗— id private module C = Category C open C hiding (id; identityˡ; identityʳ) import Categories.Power.NaturalTransformation private module PowNat = Categories.Power.NaturalTransformation C open PowNat private module ⊗ = Functor —⊗— renaming (F₀ to ⊗₀; F₁ to ⊗₁; F-resp-≡ to ⊗-resp-≡) open ⊗ module Braiding (identityˡ : NaturalIsomorphism id⊗x x) (identityʳ : NaturalIsomorphism x⊗id x) (assoc : NaturalIsomorphism [x⊗y]⊗z x⊗[y⊗z]) (braid : NaturalIsomorphism x⊗y y⊗x) where open NaturalIsomorphism identityˡ using () renaming (F⇒G to υˡ) open NaturalIsomorphism identityʳ using () renaming (F⇒G to υʳ) open NaturalIsomorphism assoc using () renaming (F⇒G to α; F⇐G to α₂) open NaturalIsomorphism braid using () renaming (F⇒G to B) α-over : ∀ {n} (F₁ F₂ F₃ : Powerendo n) → NaturalTransformation ((F₁ ⊗₂ F₂) ⊗₂ F₃) (overlap2ʳ —⊗— F₁ F₂ F₃) α-over F₁ F₂ F₃ = α ∘ʳ plex {3} F₁ F₂ F₃ -- ((hyp F₁ ∥ hyp F₂) ∥ hyp F₃) α₂-over : ∀ {n} (F₁ F₂ F₃ : Powerendo n) → NaturalTransformation (overlap2ʳ —⊗— F₁ F₂ F₃) ((F₁ ⊗₂ F₂) ⊗₂ F₃) α₂-over F₁ F₂ F₃ = α₂ ∘ʳ plex {3} F₁ F₂ F₃ B-over : ∀ {n} (F₁ F₂ : Powerendo n) → NaturalTransformation (F₁ ⊗₂ F₂) (F₂ ⊗₂ F₁) B-over F₁ F₂ = B ∘ʳ plex {2} F₁ F₂ BTriangleTop : NaturalTransformation id⊗x x⊗id BTriangleTop = B-over (widenˡ 1 id↑) x BTriangleLeft : NaturalTransformation id⊗x x BTriangleLeft = υˡ BTriangleRight : NaturalTransformation x⊗id x BTriangleRight = υʳ Hexagon1TopA : NaturalTransformation [x⊗y]⊗z x⊗[y⊗z] Hexagon1TopA = α-over (select 0) (select 1) (select 2) Hexagon1TopB : NaturalTransformation x⊗[y⊗z] [y⊗z]⊗x Hexagon1TopB = B-over (select 0) (select 1 ⊗₂ select 2) Hexagon1SideB : NaturalTransformation [y⊗z]⊗x y⊗[z⊗x] Hexagon1SideB = α-over (select 1) (select 2) (select 0) Hexagon1SideA : NaturalTransformation [x⊗y]⊗z [y⊗x]⊗z Hexagon1SideA = B-over (select 0) (select 1) ⊗ⁿ′ id3 {select 2} Hexagon1BottomA : NaturalTransformation [y⊗x]⊗z y⊗[x⊗z] Hexagon1BottomA = α-over (select 1) (select 0) (select 2) Hexagon1BottomB : NaturalTransformation y⊗[x⊗z] y⊗[z⊗x] Hexagon1BottomB = id3 {select 1} ⊗ⁿ′ B-over (select 0) (select 2) Hexagon2TopA : NaturalTransformation x⊗[y⊗z] [x⊗y]⊗z Hexagon2TopA = α₂-over (select 0) (select 1) (select 2) Hexagon2TopB : NaturalTransformation [x⊗y]⊗z z⊗[x⊗y] Hexagon2TopB = B-over (select 0 ⊗₂ select 1) (select 2) Hexagon2SideB : NaturalTransformation z⊗[x⊗y] [z⊗x]⊗y Hexagon2SideB = α₂-over (select 2) (select 0) (select 1) Hexagon2SideA : NaturalTransformation x⊗[y⊗z] x⊗[z⊗y] Hexagon2SideA = id3 {select 0} ⊗ⁿ′ B-over (select 1) (select 2) Hexagon2BottomA : NaturalTransformation x⊗[z⊗y] [x⊗z]⊗y Hexagon2BottomA = α₂-over (select 0) (select 2) (select 1) Hexagon2BottomB : NaturalTransformation [x⊗z]⊗y [z⊗x]⊗y Hexagon2BottomB = B-over (select 0) (select 2) ⊗ⁿ′ id3 {select 1}
{ "alphanum_fraction": 0.6656914894, "avg_line_length": 43.7209302326, "ext": "agda", "hexsha": "8a98179c567de135730eeb7a9b3f9e7c66c0c741", "lang": "Agda", "max_forks_count": 23, "max_forks_repo_forks_event_max_datetime": "2021-11-11T13:50:56.000Z", "max_forks_repo_forks_event_min_datetime": "2015-02-05T13:03:09.000Z", "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/Helpers.agda", "max_issues_count": 19, "max_issues_repo_head_hexsha": "e41aef56324a9f1f8cf3cd30b2db2f73e01066f2", "max_issues_repo_issues_event_max_datetime": "2019-08-09T16:31:40.000Z", "max_issues_repo_issues_event_min_datetime": "2015-05-23T06:47:10.000Z", "max_issues_repo_licenses": [ "BSD-3-Clause" ], "max_issues_repo_name": "p-pavel/categories", "max_issues_repo_path": "Categories/Monoidal/Braided/Helpers.agda", "max_line_length": 132, "max_stars_count": 98, "max_stars_repo_head_hexsha": "36f4181d751e2ecb54db219911d8c69afe8ba892", "max_stars_repo_licenses": [ "BSD-3-Clause" ], "max_stars_repo_name": "copumpkin/categories", "max_stars_repo_path": "Categories/Monoidal/Braided/Helpers.agda", "max_stars_repo_stars_event_max_datetime": "2022-03-08T05:20:36.000Z", "max_stars_repo_stars_event_min_datetime": "2015-04-15T14:57:33.000Z", "num_tokens": 1561, "size": 3760 }
module Data.ListNonEmpty where open import Data.Boolean import Data.IndexedList open import Functional import Lvl open import Numeral.Natural open import Type private variable ℓ : Lvl.Level private variable T : Type{ℓ} module _ (T : Type{ℓ}) where open Data.IndexedList(T){Bool} using (IndexedList ; intro) -- A non-empty list. List₊ : Type{ℓ} List₊ = IndexedList(intro 𝐹 (const(const 𝑇)))(𝑇) module _ {T : Type{ℓ}} where open Data.IndexedList(T){Bool} using (∅ ; _⊰_ ; singleton) public pattern ‥ = _ ⊰ _ open import Data.List import Data.List.Functions as List -- A list from a non-empty list. list : List₊(T) → List(T) list (singleton(x)) = List.singleton(x) list (x ⊰ l@‥) = x List.⊰ list(l) -- A list without its first element. tail₀ : List₊(T) → List(T) tail₀ (singleton(_)) = List.∅ tail₀ (_ ⊰ l@‥) = list(l) -- List concatenation. _++_ : List₊(T) → List₊(T) → List₊(T) singleton(x) ++ y = x ⊰ y (x ⊰ xl@‥) ++ y = x ⊰ (xl ++ y) -- The first element of the list. head : List₊(T) → T head(singleton x) = x head(x ⊰ l@‥) = x -- Applies a binary operator to each element in the list starting with the initial element. -- Example: -- reduceᵣ(_▫_) [a] = a -- reduceᵣ(_▫_) [a,b] = a ▫ b -- reduceᵣ(_▫_) [a,b,c] = a ▫ (b ▫ c) -- reduceᵣ(_▫_) [a,b,c,d,e] = a ▫ (b ▫ (c ▫ (d ▫ e))) reduceᵣ : (T → T → T) → List₊(T) → T reduceᵣ(_) (singleton(x)) = x reduceᵣ(_▫_) (x ⊰ l@‥) = x ▫ (reduceᵣ(_▫_) l)
{ "alphanum_fraction": 0.5948509485, "avg_line_length": 25.8947368421, "ext": "agda", "hexsha": "0ff42ff380a6ecd860b5a19ae1631e49a4a36a4f", "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": "Data/ListNonEmpty.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": "Data/ListNonEmpty.agda", "max_line_length": 91, "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": "Data/ListNonEmpty.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": 569, "size": 1476 }
{-# OPTIONS --universe-polymorphism #-} open import Categories.Category open import Categories.Support.Equivalence module Categories.Morphism.Indexed {o ℓ e c q} (C : Category o ℓ e) (B : Setoid c q) where open import Level using (_⊔_) open import Data.Product as P using (_,_; _×_) open import Function as F using () renaming (_∘_ to _⋆_; _∘′_ to _⋆′_) open import Relation.Binary as B using () open import Relation.Binary.HeterogeneousEquality as HE using (_≅_) open import Categories.Support.PropositionalEquality open import Categories.Support.SetoidFunctions as SF using (_⟶_; ⟪_,_⟫′) open import Categories.Support.SetoidPi as SΠ public using (Π; IndexedSetoid) renaming (_⟨$⟩_ to _‼_; cong to cong₁) import Categories.Object.Indexed as IxOb open IxOb C B open Category C open Heterogeneous C open Setoid B using () renaming (Carrier to Bc; _≈_ to _≈B_) open Setoid using () renaming (_≈_ to _[_≈_]) ihom-setoid : {S : Set o} → (S → (Obj × Obj)) → (B ⟶ (set→setoid S)) → IndexedSetoid Bc _≈B_ _ _ ihom-setoid {S} F Xs = record -- ok, this is massively ugly, but it gets around some weird problems introduced in 2.5.1.1 (JC) { Carrier = λ i → (P.proj₁ (F (_⟶_._⟨$⟩_ Xs i)) ⇒ P.proj₂ (F (_⟶_._⟨$⟩_ Xs i))) ; _≈_ = λ f g → f ∼ g ; isEquivalence = record { refl = refl ; sym = sym ; trans = trans } ; resp = λ {i} {j} i≈j → SΠ.resp-per′ (at′ i) (at′ j) (resp₁ i≈j) (resp₂ i≈j) } where -- fake 'at' for resp at′ : Bc → Setoid _ _ at′ i = record { Carrier = (P.proj₁ (F (_⟶_._⟨$⟩_ Xs i)) ⇒ P.proj₂ (F (_⟶_._⟨$⟩_ Xs i))) ; _≈_ = λ f g → f ∼ g ; isEquivalence = record { refl = refl; sym = sym; trans = trans } } at-≈ : (X : S) → B.Rel ((P.uncurry _⇒_ ⋆′ F) X) (ℓ ⊔ e) at-≈ X = λ f g → f ∼ g .resp₁ : ∀ {i j} → (i ≈B j) → (P.proj₁ (F (_⟶_._⟨$⟩_ Xs i)) ⇒ P.proj₂ (F (_⟶_._⟨$⟩_ Xs i))) ≣ (P.proj₁ (F (_⟶_._⟨$⟩_ Xs j)) ⇒ P.proj₂ (F (_⟶_._⟨$⟩_ Xs j))) resp₁ i≈j = ≣-cong (P.uncurry _⇒_ ⋆′ F) (cong₀ Xs i≈j) .resp₂ : ∀ {i j} → (i ≈B j) → Setoid._≈_ (at′ i) ≅ Setoid._≈_ (at′ j) resp₂ i≈j = HE.cong at-≈ (HE.≡-to-≅ (cong₀ Xs i≈j)) Fan : Obj → Dust → Set _ Fan X Ys = Π B (ihom-setoid (λ Y → X , Y) Ys) fan-setoid : Obj → Dust → Setoid _ _ fan-setoid X Ys = SΠ.setoid B (ihom-setoid (λ Y → X , Y) Ys) _⇒∗_ = Fan _⇨∗_ = fan-setoid Plume : Dust → Obj → Set _ Plume Xs Y = Π B (ihom-setoid (λ X → X , Y) Xs) plume-setoid : Dust → Obj → Setoid _ _ plume-setoid Xs Y = SΠ.setoid B (ihom-setoid (λ X → X , Y) Xs) _∗⇒_ = Plume _∗⇨_ = plume-setoid Dance : Dust → Dust → Set _ Dance Xs Ys = Π B (ihom-setoid F.id ⟪ Xs , Ys ⟫′) dance-setoid : Dust → Dust → Setoid _ _ dance-setoid Xs Ys = SΠ.setoid B (ihom-setoid F.id ⟪ Xs , Ys ⟫′) _∗⇒∗_ = Dance _∗⇨∗_ = dance-setoid _◃_ : ∀ {Xs Y Z} (f : Y ⇒ Z) (g : Xs ∗⇒ Y) → Xs ∗⇒ Z f ◃ g = record { _⟨$⟩_ = λ x → f ∘ (g ‼ x) ; cong = λ x≈y → ∘-resp-∼ʳ (cong₁ g x≈y) } _▹_ : ∀ {X Y Zs} (f : Y ⇒∗ Zs) (g : X ⇒ Y) → X ⇒∗ Zs f ▹ g = record { _⟨$⟩_ = λ x → (f ‼ x) ∘ g ; cong = λ x≈y → ∘-resp-∼ˡ (cong₁ f x≈y) } _⋊_ : ∀ {Xs Ys Z} (f : Ys ∗⇒ Z) (g : Xs ∗⇒∗ Ys) → Xs ∗⇒ Z f ⋊ g = record { _⟨$⟩_ = λ x → (f ‼ x) ∘ (g ‼ x) ; cong = λ x≈y → ∘-resp-∼ (cong₁ f x≈y) (cong₁ g x≈y) } _⋉_ : ∀ {X Ys Zs} (f : Ys ∗⇒∗ Zs) (g : X ⇒∗ Ys) → X ⇒∗ Zs f ⋉ g = record { _⟨$⟩_ = λ x → (f ‼ x) ∘ (g ‼ x) ; cong = λ x≈y → ∘-resp-∼ (cong₁ f x≈y) (cong₁ g x≈y) } _⋈_ : ∀ {Xs Y Zs} (f : Y ⇒∗ Zs) (g : Xs ∗⇒ Y) → Xs ∗⇒∗ Zs f ⋈ g = record { _⟨$⟩_ = λ x → (f ‼ x) ∘ (g ‼ x) ; cong = λ x≈y → ∘-resp-∼ (cong₁ f x≈y) (cong₁ g x≈y) } _◽_ : ∀ {Xs Ys Zs} (f : Ys ∗⇒∗ Zs) (g : Xs ∗⇒∗ Ys) → Xs ∗⇒∗ Zs f ◽ g = record { _⟨$⟩_ = λ x → (f ‼ x) ∘ (g ‼ x) ; cong = λ x≈y → ∘-resp-∼ (cong₁ f x≈y) (cong₁ g x≈y) } .assoc-◽⋉ : ∀ {X Ys Zs Ws} {f : Zs ∗⇒∗ Ws} {g : Ys ∗⇒∗ Zs} {h : X ⇒∗ Ys} → (X ⇨∗ Ws) [ _⋉_ {Ys = Ys} {Ws} (_◽_ {Ys} {Zs} {Ws} f g) h ≈ _⋉_ {Ys = Zs} {Ws} f (_⋉_ {Ys = Ys} {Zs} g h) ] assoc-◽⋉ {Ys = Ys} {Zs} {Ws} {f = f} {g} {h} {i} {j} i≈j with Ys _⟶_.⟨$⟩ j | cong₀ Ys i≈j | Zs _⟶_.⟨$⟩ j | cong₀ Zs i≈j | Ws _⟶_.⟨$⟩ j | cong₀ Ws i≈j | f ‼ j | cong₁ f i≈j | g ‼ j | cong₁ g i≈j | h ‼ j | cong₁ h i≈j assoc-◽⋉ {f = f} {g} {h} {i} i≈j | ._ | ≣-refl | ._ | ≣-refl | ._ | ≣-refl | fj | ≡⇒∼ fi≡fj | gj | ≡⇒∼ gi≡gj | hj | ≡⇒∼ hi≡hj = ≡⇒∼ (begin ((f ‼ i) ∘ (g ‼ i)) ∘ (h ‼ i) ↓⟨ ∘-resp-≡ (∘-resp-≡ fi≡fj gi≡gj) hi≡hj ⟩ (fj ∘ gj) ∘ hj ↓⟨ assoc ⟩ fj ∘ (gj ∘ hj) ∎) where open Heterogeneous C hiding (≡⇒∼) open HomReasoning
{ "alphanum_fraction": 0.5072976559, "avg_line_length": 37.0655737705, "ext": "agda", "hexsha": "c26953efc5357f5f63e5d7a4caa38adf1dab05bc", "lang": "Agda", "max_forks_count": 23, "max_forks_repo_forks_event_max_datetime": "2021-11-11T13:50:56.000Z", "max_forks_repo_forks_event_min_datetime": "2015-02-05T13:03:09.000Z", "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/Morphism/Indexed.agda", "max_issues_count": 19, "max_issues_repo_head_hexsha": "e41aef56324a9f1f8cf3cd30b2db2f73e01066f2", "max_issues_repo_issues_event_max_datetime": "2019-08-09T16:31:40.000Z", "max_issues_repo_issues_event_min_datetime": "2015-05-23T06:47:10.000Z", "max_issues_repo_licenses": [ "BSD-3-Clause" ], "max_issues_repo_name": "p-pavel/categories", "max_issues_repo_path": "Categories/Morphism/Indexed.agda", "max_line_length": 215, "max_stars_count": 98, "max_stars_repo_head_hexsha": "36f4181d751e2ecb54db219911d8c69afe8ba892", "max_stars_repo_licenses": [ "BSD-3-Clause" ], "max_stars_repo_name": "copumpkin/categories", "max_stars_repo_path": "Categories/Morphism/Indexed.agda", "max_stars_repo_stars_event_max_datetime": "2022-03-08T05:20:36.000Z", "max_stars_repo_stars_event_min_datetime": "2015-04-15T14:57:33.000Z", "num_tokens": 2376, "size": 4522 }
{-# OPTIONS --cubical --safe #-} -- Counterpoint Exercises module Exercises where open import MidiEvent open import Note open import Pitch open import Data.Fin open import Data.List open import Data.Nat -- Exercise 5.4 cantusFirmus : List Pitch cantusFirmus = a 4 ∷ c 5 ∷ b 4 ∷ c 5 ∷ d 5 ∷ e 5 ∷ c 5 ∷ b 4 ∷ a 4 ∷ [] cfNotes : List Note cfNotes = Data.List.map (λ p → tone whole p) cantusFirmus ---- instrument : InstrumentNumber-1 instrument = # 0 -- piano channel : Channel-1 channel = # 0 tempo : ℕ tempo = 120 cfTrack : List MidiTrack cfTrack = track "Piano" instrument channel tempo (notes→events defaultVelocity cfNotes) ∷ []
{ "alphanum_fraction": 0.6972049689, "avg_line_length": 17.8888888889, "ext": "agda", "hexsha": "166b6d8300799ece541f93b8a409896762de6108", "lang": "Agda", "max_forks_count": 3, "max_forks_repo_forks_event_max_datetime": "2020-11-10T04:04:40.000Z", "max_forks_repo_forks_event_min_datetime": "2019-01-12T17:02:36.000Z", "max_forks_repo_head_hexsha": "04896c61b603d46011b7d718fcb47dd756e66021", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "halfaya/MusicTools", "max_forks_repo_path": "agda/Exercises.agda", "max_issues_count": 1, "max_issues_repo_head_hexsha": "04896c61b603d46011b7d718fcb47dd756e66021", "max_issues_repo_issues_event_max_datetime": "2020-11-17T00:58:55.000Z", "max_issues_repo_issues_event_min_datetime": "2020-11-13T01:26:20.000Z", "max_issues_repo_licenses": [ "MIT" ], "max_issues_repo_name": "halfaya/MusicTools", "max_issues_repo_path": "agda/Exercises.agda", "max_line_length": 92, "max_stars_count": 28, "max_stars_repo_head_hexsha": "04896c61b603d46011b7d718fcb47dd756e66021", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "halfaya/MusicTools", "max_stars_repo_path": "agda/Exercises.agda", "max_stars_repo_stars_event_max_datetime": "2022-03-04T18:04:07.000Z", "max_stars_repo_stars_event_min_datetime": "2017-04-21T09:08:52.000Z", "num_tokens": 211, "size": 644 }
module examplesPaperJFP.SpaceShipSimpleVar where open import SizedIO.Base open import StateSizedIO.GUI.BaseStateDependent open import Data.Bool.Base open import Data.List.Base open import Data.Integer open import Data.Product hiding (map) open import SizedIO.Object open import SizedIO.IOObject open import NativeIO open import StateSizedIO.GUI.WxBindingsFFI open import StateSizedIO.GUI.VariableList open import StateSizedIO.GUI.WxGraphicsLib open import StateSized.GUI.BitMaps VarType = ℤ varInit : VarType varInit = (+ 150) onPaint : ∀{i} → VarType → DC → Rect → IO GuiLev1Interface i VarType onPaint z dc rect = exec (drawBitmap dc ship (z , (+ 150)) true) λ _ → return z moveSpaceShip : ∀{i} → Frame → VarType → IO GuiLev1Interface i VarType moveSpaceShip fra z = return (z + (+ 20)) callRepaint : ∀{i} → Frame → VarType → IO GuiLev1Interface i VarType callRepaint fra z = exec (repaint fra) λ _ → return z buttonHandler : ∀{i} → Frame → List (VarType → IO GuiLev1Interface i VarType) buttonHandler fra = moveSpaceShip fra ∷ [ callRepaint fra ] program : ∀{i} → IOˢ GuiLev2Interface i (λ _ → Unit) [] program = execˢ (level1C makeFrame) λ fra → execˢ (level1C (makeButton fra)) λ bt → execˢ (level1C (addButton fra bt)) λ _ → execˢ (createVar varInit) λ _ → execˢ (setButtonHandler bt (moveSpaceShip fra ∷ [ callRepaint fra ])) λ _ → execˢ (setOnPaint fra [ onPaint ]) returnˢ main : NativeIO Unit main = start (translateLev2 program)
{ "alphanum_fraction": 0.6638194021, "avg_line_length": 29.8, "ext": "agda", "hexsha": "14170963b9eaba7c8374cfbea6570062b6ebe204", "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/examplesPaperJFP/SpaceShipSimpleVar.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/examplesPaperJFP/SpaceShipSimpleVar.agda", "max_line_length": 78, "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/examplesPaperJFP/SpaceShipSimpleVar.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": 479, "size": 1639 }
-- {-# OPTIONS --no-coverage #-} -- {-# OPTIONS -v tc.cover:20 #-} open import Common.Bool open import Common.Equality _∨_ : Bool → Bool → Bool a ∨ b = if a then true else b module Works where data Term : Bool → Set where I : Term false App : ∀ a b c → a ∨ b ≡ c → Term a → Term b → Term c -- The following clause works for the coverage checker: test : Term false → Set test (App false false .false refl I x) = Bool module Fails where data Term : Bool -> Set where I : Term false App : ∀ a b c → Term a → Term b → a ∨ b ≡ c → Term c -- If we put the equality proof later in App, it fails: test : Term false → Set test (App false false .false I x refl) = Bool -- The following checks, until you split at p. -- test (App false false .false I x p) = {!p!}
{ "alphanum_fraction": 0.6109725686, "avg_line_length": 25.0625, "ext": "agda", "hexsha": "54b94a4bfb22e8c7ae139d7c091035c6aef6a1cc", "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/Issue1384.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/Issue1384.agda", "max_line_length": 57, "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/Issue1384.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": 247, "size": 802 }
{-# OPTIONS --without-K --safe #-} open import Algebra module Data.FingerTree.View {r m} (ℳ : Monoid r m) where open import Level using (_⊔_) open import Data.Product open import Function open import Data.List as List using (List; _∷_; []) open import Data.FingerTree.Structures ℳ open import Data.FingerTree.Reasoning ℳ open import Data.FingerTree.Measures ℳ open import Data.FingerTree.Cons ℳ open σ ⦃ ... ⦄ {-# DISPLAY σ.μ _ = μ #-} {-# DISPLAY μ-tree _ x = μ x #-} {-# DISPLAY μ-deep _ x = μ x #-} open Monoid ℳ renaming (Carrier to 𝓡) infixr 5 _◃_ data Viewₗ {a b} (A : Set a) (Σ : Set b) : Set (a ⊔ b) where nilₗ : Viewₗ A Σ _◃_ : A → Σ → Viewₗ A Σ instance σ-Viewₗ : ∀ {a b} {A : Set a} {Σ : Set b} ⦃ _ : σ A ⦄ ⦃ _ : σ Σ ⦄ → σ (Viewₗ A Σ) μ ⦃ σ-Viewₗ ⦄ nilₗ = ε μ ⦃ σ-Viewₗ ⦄ (x ◃ xs) = μ x ∙ μ xs viewₗ : ∀ {a} {Σ : Set a} ⦃ _ : σ Σ ⦄ → (xs : Tree Σ) → μ⟨ Viewₗ Σ (Tree Σ) ⟩≈ (μ xs) viewₗ empty = nilₗ ⇑ viewₗ (single x) = (x ◃ empty) ⇑[ ℳ ↯ ] viewₗ (deep (𝓂 ↤ (D₂ a b & m & rs) ⇑[ 𝓂≈ ])) = a ◃ deep ⟪ D₁ b & m & rs ⇓⟫ ⇑[ ℳ ↯ ] ≈[ 𝓂≈ ]′ viewₗ (deep (𝓂 ↤ (D₃ a b c & m & rs) ⇑[ 𝓂≈ ])) = a ◃ deep ⟪ D₂ b c & m & rs ⇓⟫ ⇑[ ℳ ↯ ] ≈[ 𝓂≈ ]′ viewₗ (deep (𝓂 ↤ (D₄ a b c d & m & rs) ⇑[ 𝓂≈ ])) = a ◃ deep ⟪ D₃ b c d & m & rs ⇓⟫ ⇑[ ℳ ↯ ] ≈[ 𝓂≈ ]′ viewₗ (deep (𝓂 ↤ (D₁ a & m & rs) ⇑[ 𝓂≈ ])) with viewₗ m ... | (μ⟨y⟩ ↤ N₂ y₁ y₂ ⇑[ yp ]) ◃ ys ⇑[ p ] = a ◃ deep (μ m ∙ μ rs ↤ D₂ y₁ y₂ & ys & rs ⇑[ ℳ ↯ ] ≈[ ≪∙ (≪∙ yp ⍮ p) ]′) ⇑[ 𝓂≈ ] ... | (μ⟨y⟩ ↤ N₃ y₁ y₂ y₃ ⇑[ yp ]) ◃ ys ⇑[ p ] = a ◃ deep (μ m ∙ μ rs ↤ D₃ y₁ y₂ y₃ & ys & rs ⇑[ ℳ ↯ ] ≈[ ≪∙ (≪∙ yp ⍮ p) ]′) ⇑[ 𝓂≈ ] ... | nilₗ ⇑[ p ] = (digitToTree rs [ _ ∙> r ⟿ r ] >>= (λ rs′ → (a ◃ rs′) ⇑)) ≈[ ∙≫ sym (identityˡ _) ⍮ (∙≫ ≪∙ p) ⍮ 𝓂≈ ] infixl 5 _▹_ data Viewᵣ {a b} (A : Set a) (Σ : Set b) : Set (a ⊔ b) where nilᵣ : Viewᵣ A Σ _▹_ : Σ → A → Viewᵣ A Σ instance σ-Viewᵣ : ∀ {a b} {A : Set a} {Σ : Set b} ⦃ _ : σ A ⦄ ⦃ _ : σ Σ ⦄ → σ (Viewᵣ A Σ) μ ⦃ σ-Viewᵣ ⦄ nilᵣ = ε μ ⦃ σ-Viewᵣ ⦄ (xs ▹ x) = μ xs ∙ μ x viewᵣ : ∀ {a} {Σ : Set a} ⦃ _ : σ Σ ⦄ → (xs : Tree Σ) → μ⟨ Viewᵣ Σ (Tree Σ) ⟩≈ (μ xs) viewᵣ empty = nilᵣ ⇑ viewᵣ (single x) = empty ▹ x ⇑[ ℳ ↯ ] viewᵣ (deep (𝓂 ↤ (ls & m & D₂ a b ) ⇑[ 𝓂≈ ])) = (deep ⟪ ls & m & D₁ a ⇓⟫ ▹ b) ⇑[ ℳ ↯ ] ≈[ 𝓂≈ ]′ viewᵣ (deep (𝓂 ↤ (ls & m & D₃ a b c ) ⇑[ 𝓂≈ ])) = (deep ⟪ ls & m & D₂ a b ⇓⟫ ▹ c) ⇑[ ℳ ↯ ] ≈[ 𝓂≈ ]′ viewᵣ (deep (𝓂 ↤ (ls & m & D₄ a b c d) ⇑[ 𝓂≈ ])) = (deep ⟪ ls & m & D₃ a b c ⇓⟫ ▹ d) ⇑[ ℳ ↯ ] ≈[ 𝓂≈ ]′ viewᵣ (deep (𝓂 ↤ (ls & m & D₁ a) ⇑[ 𝓂≈ ])) with viewᵣ m ... | ys ▹ (μ⟨y⟩ ↤ N₂ y₁ y₂ ⇑[ yp ]) ⇑[ p ] = deep (μ ls ∙ μ m ↤ ls & ys & D₂ y₁ y₂ ⇑[ ℳ ↯ ] ≈[ ∙≫ (∙≫ yp ⍮ p) ]′) ▹ a ⇑[ ℳ ↯ ] ≈[ 𝓂≈ ]′ ... | ys ▹ (μ⟨y⟩ ↤ N₃ y₁ y₂ y₃ ⇑[ yp ]) ⇑[ p ] = deep (μ ls ∙ μ m ↤ ls & ys & D₃ y₁ y₂ y₃ ⇑[ ℳ ↯ ] ≈[ ∙≫ (∙≫ yp ⍮ p) ]′) ▹ a ⇑[ ℳ ↯ ] ≈[ 𝓂≈ ]′ ... | nilᵣ ⇑[ p ] = (digitToTree ls [ l <∙ _ ⟿ l ] >>= (λ ls′ → (ls′ ▹ a) ⇑)) ≈[ ℳ ↯ ↣ μ ls ∙ (ε ∙ μ a) ] ≈[ ∙≫ ≪∙ p ⍮ 𝓂≈ ]′ deepₗ : ∀ {a} {Σ : Set a} ⦃ _ : σ Σ ⦄ → (l : List Σ) → (m : Tree ⟪ Node Σ ⟫) → (r : Digit Σ) → μ⟨ Tree Σ ⟩≈ (μ l ∙ (μ m ∙ μ r)) deepₗ [] m r with viewₗ m deepₗ [] m r | nilₗ ⇑[ n≈ ] = digitToTree r ≈[ ℳ ↯ ↣ ε ∙ (ε ∙ μ r) ] ≈[ ∙≫ ≪∙ n≈ ]′ deepₗ [] m r | ((μ⟨y⟩ ↤ N₂ y₁ y₂ ⇑[ yp ]) ◃ ys) ⇑[ ys≈ ] = deep (μ m ∙ μ r ↤ D₂ y₁ y₂ & ys & r ⇑[ ≪∙ yp ⍮ sym (assoc _ _ _) ⍮ ≪∙ ys≈ ]) ⇑[ ℳ ↯ ] deepₗ [] m r | ((μ⟨y⟩ ↤ N₃ y₁ y₂ y₃ ⇑[ yp ]) ◃ ys) ⇑[ ys≈ ] = deep (μ m ∙ μ r ↤ D₃ y₁ y₂ y₃ & ys & r ⇑[ ≪∙ yp ⍮ sym (assoc _ _ _) ⍮ ≪∙ ys≈ ]) ⇑[ ℳ ↯ ] deepₗ (l ∷ ls) m r = go l ls m r where go : ∀ {a} {Σ : Set a} ⦃ _ : σ Σ ⦄ → (l : Σ) → (ls : List Σ) → (m : Tree ⟪ Node Σ ⟫) → (r : Digit Σ) → μ⟨ Tree Σ ⟩≈ (μ l ∙ μ ls ∙ (μ m ∙ μ r)) go l [] m r = deep ⟪ D₁ l & m & r ⇓⟫ ⇑[ ℳ ↯ ] go l₁ (l₂ ∷ ls) m r = (go l₂ ls m r [ _ ∙> ls′ ⟿ ls′ ] >>= (l₁ ◂_)) ≈[ ℳ ↯ ] deepᵣ : ∀ {a} {Σ : Set a} ⦃ _ : σ Σ ⦄ → (l : Digit Σ) → (m : Tree ⟪ Node Σ ⟫) → (r : List Σ) → μ⟨ Tree Σ ⟩≈ (μ l ∙ (μ m ∙ μ r)) deepᵣ l m [] with viewᵣ m deepᵣ l m [] | nilᵣ ⇑[ p ] = digitToTree l ≈[ sym (identityʳ _) ⍮ ∙≫ (p ⍮ sym (identityʳ _)) ] deepᵣ l m [] | (ys ▹ (μ⟨y⟩ ↤ N₂ y₁ y₂ ⇑[ μ⟨y⟩≈ ])) ⇑[ p ] = deep (μ l ∙ μ m ↤ l & ys & D₂ y₁ y₂ ⇑[ ∙≫ (∙≫ μ⟨y⟩≈ ⍮ p) ]) ⇑[ ℳ ↯ ] deepᵣ l m [] | (ys ▹ (μ⟨y⟩ ↤ N₃ y₁ y₂ y₃ ⇑[ μ⟨y⟩≈ ])) ⇑[ p ] = deep (μ l ∙ μ m ↤ l & ys & D₃ y₁ y₂ y₃ ⇑[ ∙≫ (∙≫ μ⟨y⟩≈ ⍮ p) ]) ⇑[ ℳ ↯ ] deepᵣ l m (r ∷ rs) = go (deep ⟪ l & m & D₁ r ⇓⟫ ⇑) rs ≈[ ℳ ↯ ] where go : ∀ {a} {Σ : Set a} ⦃ _ : σ Σ ⦄ → ∀ {xs} → μ⟨ Tree Σ ⟩≈ xs → (rs : List Σ) → μ⟨ Tree Σ ⟩≈ (xs ∙ μ rs) go xs [] = xs ≈[ sym (identityʳ _) ] go xs (r ∷ rs) = go (xs [ sz <∙ _ ⟿ sz ] >>= (_▸ r)) rs ≈[ ℳ ↯ ]
{ "alphanum_fraction": 0.4154114822, "avg_line_length": 50.9, "ext": "agda", "hexsha": "268576458d0b5e0e55137bd7bb8322ac23b1470c", "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": "39c3d96937384b052b782ffddf4fdec68c5d139f", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "oisdk/agda-indexed-fingertree", "max_forks_repo_path": "src/Data/FingerTree/View.agda", "max_issues_count": null, "max_issues_repo_head_hexsha": "39c3d96937384b052b782ffddf4fdec68c5d139f", "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": "oisdk/agda-indexed-fingertree", "max_issues_repo_path": "src/Data/FingerTree/View.agda", "max_line_length": 150, "max_stars_count": 1, "max_stars_repo_head_hexsha": "39c3d96937384b052b782ffddf4fdec68c5d139f", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "oisdk/agda-indexed-fingertree", "max_stars_repo_path": "src/Data/FingerTree/View.agda", "max_stars_repo_stars_event_max_datetime": "2019-02-26T07:04:54.000Z", "max_stars_repo_stars_event_min_datetime": "2019-02-26T07:04:54.000Z", "num_tokens": 2838, "size": 4581 }
module Logic.Predicate.Multi where open import Data.Tuple.RaiseTypeᵣ open import Function.Multi open import Function.Multi.Functions open import Numeral.Natural open import Logic.Predicate open import Logic -- Universal quantification of multiple variables. -- Example: -- ∀₊(3) P = ∀{x}{y}{z} → P(x)(y)(z) ∀₊ : (n : ℕ) → ∀{ℓ}{ℓ𝓈}{As : Types{n}(ℓ𝓈)} → (As ⇉ Stmt{ℓ}) → Stmt ∀₊(n) = quantifier₊(n) ∀ₗ -- Existential quantification of multiple variables. -- Example: -- ∃₊(3) P = ∃(x ↦ ∃(y ↦ ∃(z ↦ P(x)(y)(z)))) ∃₊ : (n : ℕ) → ∀{ℓ}{ℓ𝓈}{As : Types{n}(ℓ𝓈)} → (As ⇉ Stmt{ℓ}) → Stmt ∃₊(n) = quantifier₊(n) ∃
{ "alphanum_fraction": 0.6108374384, "avg_line_length": 29, "ext": "agda", "hexsha": "7b2ac8cf654da3d667e10f18473bde98c392eca3", "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/Predicate/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": "Logic/Predicate/Multi.agda", "max_line_length": 66, "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/Predicate/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": 259, "size": 609 }
{-# OPTIONS --cubical --safe --no-sized-types --no-guardedness --no-subtyping #-} module Agda.Builtin.Cubical.Glue where open import Agda.Primitive open import Agda.Builtin.Sigma open import Agda.Primitive.Cubical renaming (primINeg to ~_; primIMax to _∨_; primIMin to _∧_; primHComp to hcomp; primTransp to transp; primComp to comp; itIsOne to 1=1) open import Agda.Builtin.Cubical.Path open import Agda.Builtin.Cubical.Sub renaming (Sub to _[_↦_]; primSubOut to ouc) import Agda.Builtin.Cubical.HCompU as HCompU module Helpers = HCompU.Helpers open Helpers -- We make this a record so that isEquiv can be proved using -- copatterns. This is good because copatterns don't get unfolded -- unless a projection is applied so it should be more efficient. record isEquiv {ℓ ℓ'} {A : Set ℓ} {B : Set ℓ'} (f : A → B) : Set (ℓ ⊔ ℓ') where no-eta-equality field equiv-proof : (y : B) → isContr (fiber f y) open isEquiv public infix 4 _≃_ _≃_ : ∀ {ℓ ℓ'} (A : Set ℓ) (B : Set ℓ') → Set (ℓ ⊔ ℓ') A ≃ B = Σ (A → B) \ f → (isEquiv f) equivFun : ∀ {ℓ ℓ'} {A : Set ℓ} {B : Set ℓ'} → A ≃ B → A → B equivFun e = fst e -- Improved version of equivProof compared to Lemma 5 in CCHM. We put -- the (φ = i0) face in contr' making it be definitionally c in this -- case. This makes the computational behavior better, in particular -- for transp in Glue. equivProof : ∀ {la lt} (T : Set la) (A : Set lt) → (w : T ≃ A) → (a : A) → ∀ ψ → (Partial ψ (fiber (w .fst) a)) → fiber (w .fst) a equivProof A B w a ψ fb = contr' {A = fiber (w .fst) a} (w .snd .equiv-proof a) ψ fb where contr' : ∀ {ℓ} {A : Set ℓ} → isContr A → (φ : I) → (u : Partial φ A) → A contr' {A = A} (c , p) φ u = hcomp (λ i → λ { (φ = i1) → p (u 1=1) i ; (φ = i0) → c }) c {-# BUILTIN EQUIV _≃_ #-} {-# BUILTIN EQUIVFUN equivFun #-} {-# BUILTIN EQUIVPROOF equivProof #-} primitive primGlue : ∀ {ℓ ℓ'} (A : Set ℓ) {φ : I} → (T : Partial φ (Set ℓ')) → (e : PartialP φ (λ o → T o ≃ A)) → Set ℓ' prim^glue : ∀ {ℓ ℓ'} {A : Set ℓ} {φ : I} → {T : Partial φ (Set ℓ')} → {e : PartialP φ (λ o → T o ≃ A)} → (t : PartialP φ T) → (a : A) → primGlue A T e prim^unglue : ∀ {ℓ ℓ'} {A : Set ℓ} {φ : I} → {T : Partial φ (Set ℓ')} → {e : PartialP φ (λ o → T o ≃ A)} → primGlue A T e → A -- Needed for transp in Glue. primFaceForall : (I → I) → I module _ {ℓ : I → Level} (P : (i : I) → Set (ℓ i)) where private E : (i : I) → Set (ℓ i) E = λ i → P i ~E : (i : I) → Set (ℓ (~ i)) ~E = λ i → P (~ i) A = P i0 B = P i1 f : A → B f x = transp E i0 x g : B → A g y = transp ~E i0 y u : ∀ i → A → E i u i x = transp (λ j → E (i ∧ j)) (~ i) x v : ∀ i → B → E i v i y = transp (λ j → ~E ( ~ i ∧ j)) i y fiberPath : (y : B) → (xβ0 xβ1 : fiber f y) → xβ0 ≡ xβ1 fiberPath y (x0 , β0) (x1 , β1) k = ω , λ j → δ (~ j) where module _ (j : I) where private sys : A → ∀ i → PartialP (~ j ∨ j) (λ _ → E (~ i)) sys x i (j = i0) = v (~ i) y sys x i (j = i1) = u (~ i) x ω0 = comp ~E (sys x0) ((β0 (~ j))) ω1 = comp ~E (sys x1) ((β1 (~ j))) θ0 = fill ~E (sys x0) (inc (β0 (~ j))) θ1 = fill ~E (sys x1) (inc (β1 (~ j))) sys = λ {j (k = i0) → ω0 j ; j (k = i1) → ω1 j} ω = hcomp sys (g y) θ = hfill sys (inc (g y)) δ = λ (j : I) → comp E (λ i → λ { (j = i0) → v i y ; (k = i0) → θ0 j (~ i) ; (j = i1) → u i ω ; (k = i1) → θ1 j (~ i) }) (θ j) γ : (y : B) → y ≡ f (g y) γ y j = comp E (λ i → λ { (j = i0) → v i y ; (j = i1) → u i (g y) }) (g y) pathToisEquiv : isEquiv f pathToisEquiv .equiv-proof y .fst .fst = g y pathToisEquiv .equiv-proof y .fst .snd = sym (γ y) pathToisEquiv .equiv-proof y .snd = fiberPath y _ pathToEquiv : A ≃ B pathToEquiv .fst = f pathToEquiv .snd = pathToisEquiv
{ "alphanum_fraction": 0.4899685763, "avg_line_length": 33.3629032258, "ext": "agda", "hexsha": "2d9fd1f8871d782a304895515332e9c030213342", "lang": "Agda", "max_forks_count": 1, "max_forks_repo_forks_event_max_datetime": "2015-09-15T14:36:15.000Z", "max_forks_repo_forks_event_min_datetime": "2015-09-15T14:36:15.000Z", "max_forks_repo_head_hexsha": "f275daf2443ac348c287e08cb53ffec7db59625d", "max_forks_repo_licenses": [ "BSD-3-Clause" ], "max_forks_repo_name": "asr/my-agda", "max_forks_repo_path": "src/data/lib/prim/Agda/Builtin/Cubical/Glue.agda", "max_issues_count": 1, "max_issues_repo_head_hexsha": "f275daf2443ac348c287e08cb53ffec7db59625d", "max_issues_repo_issues_event_max_datetime": "2015-09-15T15:49:15.000Z", "max_issues_repo_issues_event_min_datetime": "2015-09-15T15:49:15.000Z", "max_issues_repo_licenses": [ "BSD-3-Clause" ], "max_issues_repo_name": "asr/my-agda", "max_issues_repo_path": "src/data/lib/prim/Agda/Builtin/Cubical/Glue.agda", "max_line_length": 104, "max_stars_count": 1, "max_stars_repo_head_hexsha": "f275daf2443ac348c287e08cb53ffec7db59625d", "max_stars_repo_licenses": [ "BSD-3-Clause" ], "max_stars_repo_name": "asr/my-agda", "max_stars_repo_path": "src/data/lib/prim/Agda/Builtin/Cubical/Glue.agda", "max_stars_repo_stars_event_max_datetime": "2016-05-20T13:58:52.000Z", "max_stars_repo_stars_event_min_datetime": "2016-05-20T13:58:52.000Z", "num_tokens": 1640, "size": 4137 }
{-# OPTIONS --cubical --no-import-sorts --safe #-} module Cubical.Algebra.RingSolver.NatAsAlmostRing where open import Cubical.Foundations.Prelude open import Cubical.Data.Nat open import Cubical.Algebra.RingSolver.AlmostRing open import Cubical.Algebra.Semigroup open import Cubical.Algebra.Monoid open import Cubical.Algebra.AbGroup ℕAsAlmostRing : AlmostRing {ℓ-zero} ℕAsAlmostRing = almostring ℕ 0 1 _+_ _·_ (λ n → n) (isalmostring (ismonoid (issemigroup isSetℕ +-assoc) (λ n → (+-zero n) , refl)) (ismonoid (issemigroup isSetℕ ·-assoc) λ n → (·-identityʳ n) , (·-identityˡ n)) +-comm ·-comm (λ k l n → sym (·-distribˡ k l n) ) (λ k l n → sym (·-distribʳ k l n)) (λ _ _ → refl) (λ _ _ → refl) (λ _ → refl) λ x → sym (0≡m·0 x))
{ "alphanum_fraction": 0.5782997763, "avg_line_length": 40.6363636364, "ext": "agda", "hexsha": "3792920bc6c7e6954b6992f1f8a654b8772dff17", "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/Algebra/RingSolver/NatAsAlmostRing.agda", "max_issues_count": null, "max_issues_repo_head_hexsha": "fd8059ec3eed03f8280b4233753d00ad123ffce8", "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": "dan-iel-lee/cubical", "max_issues_repo_path": "Cubical/Algebra/RingSolver/NatAsAlmostRing.agda", "max_line_length": 99, "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/Algebra/RingSolver/NatAsAlmostRing.agda", "max_stars_repo_stars_event_max_datetime": null, "max_stars_repo_stars_event_min_datetime": null, "num_tokens": 280, "size": 894 }
open import Nat open import Prelude open import core open import contexts open import lemmas-consistency open import type-assignment-unicity open import binders-disjoint-checks open import lemmas-subst-ta module preservation where -- if d and d' both result from filling the hole in ε with terms of the -- same type, they too have the same type. wt-different-fill : ∀{ Δ Γ d ε d1 d2 d' τ τ1 } → d == ε ⟦ d1 ⟧ → Δ , Γ ⊢ d :: τ → Δ , Γ ⊢ d1 :: τ1 → Δ , Γ ⊢ d2 :: τ1 → d' == ε ⟦ d2 ⟧ → Δ , Γ ⊢ d' :: τ wt-different-fill FHOuter D1 D2 D3 FHOuter with type-assignment-unicity D1 D2 ... | refl = D3 wt-different-fill (FHAp1 eps) (TAAp D1 D2) D3 D4 (FHAp1 D5) = TAAp (wt-different-fill eps D1 D3 D4 D5) D2 wt-different-fill (FHAp2 eps) (TAAp D1 D2) D3 D4 (FHAp2 D5) = TAAp D1 (wt-different-fill eps D2 D3 D4 D5) wt-different-fill (FHNEHole eps) (TANEHole x D1 x₁) D2 D3 (FHNEHole D4) = TANEHole x (wt-different-fill eps D1 D2 D3 D4) x₁ wt-different-fill (FHCast eps) (TACast D1 x) D2 D3 (FHCast D4) = TACast (wt-different-fill eps D1 D2 D3 D4) x wt-different-fill (FHFailedCast x) (TAFailedCast y x₁ x₂ x₃) D3 D4 (FHFailedCast eps) = TAFailedCast (wt-different-fill x y D3 D4 eps) x₁ x₂ x₃ -- if a well typed term results from filling the hole in ε, then the term -- that filled the hole is also well typed wt-filling : ∀{ ε Δ Γ d τ d' } → Δ , Γ ⊢ d :: τ → d == ε ⟦ d' ⟧ → Σ[ τ' ∈ htyp ] (Δ , Γ ⊢ d' :: τ') wt-filling TAConst FHOuter = _ , TAConst wt-filling (TAVar x₁) FHOuter = _ , TAVar x₁ wt-filling (TALam f ta) FHOuter = _ , TALam f ta wt-filling (TAAp ta ta₁) FHOuter = _ , TAAp ta ta₁ wt-filling (TAAp ta ta₁) (FHAp1 eps) = wt-filling ta eps wt-filling (TAAp ta ta₁) (FHAp2 eps) = wt-filling ta₁ eps wt-filling (TAEHole x x₁) FHOuter = _ , TAEHole x x₁ wt-filling (TANEHole x ta x₁) FHOuter = _ , TANEHole x ta x₁ wt-filling (TANEHole x ta x₁) (FHNEHole eps) = wt-filling ta eps wt-filling (TACast ta x) FHOuter = _ , TACast ta x wt-filling (TACast ta x) (FHCast eps) = wt-filling ta eps wt-filling (TAFailedCast x y z w) FHOuter = _ , TAFailedCast x y z w wt-filling (TAFailedCast x x₁ x₂ x₃) (FHFailedCast y) = wt-filling x y -- instruction transitions preserve type preserve-trans : ∀{ Δ Γ d τ d' } → binders-unique d → Δ , Γ ⊢ d :: τ → d →> d' → Δ , Γ ⊢ d' :: τ preserve-trans bd TAConst () preserve-trans bd (TAVar x₁) () preserve-trans bd (TALam _ ta) () preserve-trans (BUAp (BULam bd x₁) bd₁ (BDLam x₂ x₃)) (TAAp (TALam apt ta) ta₁) ITLam = lem-subst apt x₂ bd₁ ta ta₁ preserve-trans bd (TAAp (TACast ta TCRefl) ta₁) ITApCast = TACast (TAAp ta (TACast ta₁ TCRefl)) TCRefl preserve-trans bd (TAAp (TACast ta (TCArr x x₁)) ta₁) ITApCast = TACast (TAAp ta (TACast ta₁ (~sym x))) x₁ preserve-trans bd (TAEHole x x₁) () preserve-trans bd (TANEHole x ta x₁) () preserve-trans bd (TACast ta x) (ITCastID) = ta preserve-trans bd (TACast (TACast ta x) x₁) (ITCastSucceed x₂) = ta preserve-trans bd (TACast ta x) (ITGround (MGArr x₁)) = TACast (TACast ta (TCArr TCHole1 TCHole1)) TCHole1 preserve-trans bd (TACast ta TCHole2) (ITExpand (MGArr x₁)) = TACast (TACast ta TCHole2) (TCArr TCHole2 TCHole2) preserve-trans bd (TACast (TACast ta x) x₁) (ITCastFail w y z) = TAFailedCast ta w y z preserve-trans bd (TAFailedCast x y z q) () lem-bd-ε1 : ∀{ d ε d0} → d == ε ⟦ d0 ⟧ → binders-unique d → binders-unique d0 lem-bd-ε1 FHOuter bd = bd lem-bd-ε1 (FHAp1 eps) (BUAp bd bd₁ x) = lem-bd-ε1 eps bd lem-bd-ε1 (FHAp2 eps) (BUAp bd bd₁ x) = lem-bd-ε1 eps bd₁ lem-bd-ε1 (FHNEHole eps) (BUNEHole bd x) = lem-bd-ε1 eps bd lem-bd-ε1 (FHCast eps) (BUCast bd) = lem-bd-ε1 eps bd lem-bd-ε1 (FHFailedCast eps) (BUFailedCast bd) = lem-bd-ε1 eps bd -- this is the main preservation theorem, gluing together the above preservation : {Δ : hctx} {d d' : ihexp} {τ : htyp} {Γ : tctx} → binders-unique d → Δ , Γ ⊢ d :: τ → d ↦ d' → Δ , Γ ⊢ d' :: τ preservation bd D (Step x x₁ x₂) with wt-filling D x ... | (_ , wt) = wt-different-fill x D wt (preserve-trans (lem-bd-ε1 x bd) wt x₁) x₂ -- note that the exact statement of preservation in the paper, where Γ is -- empty indicating that the terms are closed, is an immediate corrolary -- of the slightly more general statement above. preservation' : {Δ : hctx} {d d' : ihexp} {τ : htyp} → binders-unique d → Δ , ∅ ⊢ d :: τ → d ↦ d' → Δ , ∅ ⊢ d' :: τ preservation' = preservation
{ "alphanum_fraction": 0.6214893617, "avg_line_length": 46.5346534653, "ext": "agda", "hexsha": "e6d38a11175909f65f0453e2881642dfa31e11bd", "lang": "Agda", "max_forks_count": 1, "max_forks_repo_forks_event_max_datetime": "2019-09-13T18:20:02.000Z", "max_forks_repo_forks_event_min_datetime": "2019-09-13T18:20:02.000Z", "max_forks_repo_head_hexsha": "229dfb06ea51ebe91cb3b1c973c2f2792e66797c", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "hazelgrove/hazelnut-dynamics-agda", "max_forks_repo_path": "preservation.agda", "max_issues_count": 54, "max_issues_repo_head_hexsha": "229dfb06ea51ebe91cb3b1c973c2f2792e66797c", "max_issues_repo_issues_event_max_datetime": "2018-11-29T16:32:40.000Z", "max_issues_repo_issues_event_min_datetime": "2017-06-29T20:53:34.000Z", "max_issues_repo_licenses": [ "MIT" ], "max_issues_repo_name": "hazelgrove/hazelnut-dynamics-agda", "max_issues_repo_path": "preservation.agda", "max_line_length": 145, "max_stars_count": 16, "max_stars_repo_head_hexsha": "229dfb06ea51ebe91cb3b1c973c2f2792e66797c", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "hazelgrove/hazelnut-dynamics-agda", "max_stars_repo_path": "preservation.agda", "max_stars_repo_stars_event_max_datetime": "2021-12-19T02:50:23.000Z", "max_stars_repo_stars_event_min_datetime": "2018-03-12T14:32:03.000Z", "num_tokens": 1831, "size": 4700 }
{-# OPTIONS --without-K --safe #-} module Categories.NaturalTransformation.NaturalIsomorphism.Properties where open import Level open import Categories.Category open import Categories.Category.Instance.Setoids open import Categories.Functor renaming (id to idF) open import Categories.Functor.Construction.LiftSetoids open import Categories.NaturalTransformation.NaturalIsomorphism open import Categories.NaturalTransformation.Properties import Categories.Morphism as Mor import Categories.Morphism.Properties as Morₚ import Categories.Morphism.Reasoning as MR private variable o ℓ e : Level C D : Category o ℓ e module _ {F G : Functor C D} (α : NaturalIsomorphism F G) where private module C = Category C open Category D open Mor D open Functor F open Functor G renaming (F₀ to G₀; F₁ to G₁) open NaturalIsomorphism α -- We can move equations along natural isomorphism. module _ {A B} {f g : A C.⇒ B} where push-eq : F₁ f ≈ F₁ g → G₁ f ≈ G₁ g push-eq hyp = MR.push-eq D FX≅GX (⇒.commute f) (⇒.commute g) hyp pull-eq : G₁ f ≈ G₁ g → F₁ f ≈ F₁ g pull-eq hyp = MR.push-eq D (≅.sym FX≅GX) (⇐.commute f) (⇐.commute g) hyp -- properties of natural isomorphisms over an endofunctor module _ {F : Endofunctor C} where private module C = Category C module F = Functor F module MC = Mor C module _ (α : F ≃ idF) where open C open HomReasoning open F open MC open MR C open Mor C open Morₚ C open NaturalIsomorphism α F≃id-comm₁ : ∀ {A} → ⇒.η (F₀ A) ≈ F₁ (⇒.η A) F≃id-comm₁ {A} = begin ⇒.η (F₀ A) ≈⟨ introʳ (F-resp-≈ (iso.isoˡ _) ○ identity) ⟩ ⇒.η (F₀ A) ∘ F₁ (⇐.η A ∘ ⇒.η A) ≈⟨ refl⟩∘⟨ homomorphism ⟩ ⇒.η (F₀ A) ∘ F₁ (⇐.η A) ∘ F₁ (⇒.η A) ≈⟨ cancelˡ (⇒.commute _ ○ iso.isoˡ _) ⟩ F₁ (⇒.η A) ∎ F≃id-comm₂ : ∀ {A} → ⇐.η (F₀ A) ≈ F₁ (⇐.η A) F≃id-comm₂ {A} = begin ⇐.η (F₀ A) ≈⟨ introˡ (F-resp-≈ (iso.isoˡ _) ○ identity) ⟩ F₁ (⇐.η A ∘ ⇒.η A) ∘ ⇐.η (F₀ A) ≈⟨ homomorphism ⟩∘⟨refl ⟩ (F₁ (⇐.η A) ∘ F₁ (⇒.η A)) ∘ ⇐.η (F₀ A) ≈⟨ cancelʳ (⟺ (⇐.commute _) ○ iso.isoˡ _) ⟩ F₁ (⇐.η A) ∎ F≃id⇒id : ∀ {A} {f : A ⇒ A} → F₁ f ≈ id → f ≈ id F≃id⇒id {A} {f} eq = Iso⇒Mono (Iso-swap (iso A)) _ _ helper where helper : ⇐.η A ∘ f ≈ ⇐.η A ∘ id helper = begin ⇐.η A ∘ f ≈⟨ ⇐.commute f ⟩ F₁ f ∘ ⇐.η A ≈⟨ eq ⟩∘⟨refl ⟩ id ∘ ⇐.η A ≈˘⟨ id-comm ⟩ ⇐.η A ∘ id ∎ -- unlift universe level module _ {c ℓ ℓ′ e} {F G : Functor C (Setoids c ℓ)} (α : LiftSetoids ℓ′ e ∘F F ≃ LiftSetoids ℓ′ e ∘F G) where open NaturalIsomorphism α unlift-≃ : F ≃ G unlift-≃ = record { F⇒G = unlift-nat F⇒G ; F⇐G = unlift-nat F⇐G ; iso = λ X → record { isoˡ = λ eq → lower (iso.isoˡ X (lift eq)) ; isoʳ = λ eq → lower (iso.isoʳ X (lift eq)) } }
{ "alphanum_fraction": 0.5543695797, "avg_line_length": 31.2291666667, "ext": "agda", "hexsha": "203011ed06635edc7194ae5254616ee0cc46eeff", "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": "7672b7a3185ae77467cc30e05dbe50b36ff2af8a", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "bblfish/agda-categories", "max_forks_repo_path": "src/Categories/NaturalTransformation/NaturalIsomorphism/Properties.agda", "max_issues_count": null, "max_issues_repo_head_hexsha": "7672b7a3185ae77467cc30e05dbe50b36ff2af8a", "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": "bblfish/agda-categories", "max_issues_repo_path": "src/Categories/NaturalTransformation/NaturalIsomorphism/Properties.agda", "max_line_length": 109, "max_stars_count": 5, "max_stars_repo_head_hexsha": "7672b7a3185ae77467cc30e05dbe50b36ff2af8a", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "bblfish/agda-categories", "max_stars_repo_path": "src/Categories/NaturalTransformation/NaturalIsomorphism/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": 1237, "size": 2998 }
{-# OPTIONS --omega-in-omega --no-termination-check --overlapping-instances #-} module Light.Implementation.Standard where module Data where module Empty where open import Light.Implementation.Standard.Data.Empty public module Unit where open import Light.Implementation.Standard.Data.Unit public module These where open import Light.Implementation.Standard.Data.These public module Product where open import Light.Implementation.Standard.Data.Product public module Relation where module Decidable where open import Light.Implementation.Standard.Relation.Decidable public module Sets where open import Light.Implementation.Standard.Relation.Sets public
{ "alphanum_fraction": 0.799132948, "avg_line_length": 49.4285714286, "ext": "agda", "hexsha": "28c5e0b771f0b32f2dbbde4d3c1d9989469e6c4f", "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": "44b1c724f2de95d3a9effe87ca36ef9eca8b4756", "max_forks_repo_licenses": [ "0BSD" ], "max_forks_repo_name": "Zambonifofex/lightlib", "max_forks_repo_path": "bindings/stdlib/Light/Implementation/Standard.agda", "max_issues_count": null, "max_issues_repo_head_hexsha": "44b1c724f2de95d3a9effe87ca36ef9eca8b4756", "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": "Zambonifofex/lightlib", "max_issues_repo_path": "bindings/stdlib/Light/Implementation/Standard.agda", "max_line_length": 96, "max_stars_count": 1, "max_stars_repo_head_hexsha": "44b1c724f2de95d3a9effe87ca36ef9eca8b4756", "max_stars_repo_licenses": [ "0BSD" ], "max_stars_repo_name": "zamfofex/lightlib", "max_stars_repo_path": "bindings/stdlib/Light/Implementation/Standard.agda", "max_stars_repo_stars_event_max_datetime": "2019-12-20T21:33:05.000Z", "max_stars_repo_stars_event_min_datetime": "2019-12-20T21:33:05.000Z", "num_tokens": 123, "size": 692 }
module Oscar.Data where open import Agda.Builtin.Unit open import Oscar.Function open import Oscar.Level infixr 20 ∷_ infixr 20 _∷_ data NAT : Set where ∅ : NAT ∷_ : NAT → NAT testNAT : NAT testNAT = ∷ ∷ ∷ ∅ -- List data ⟦_⟧ {a} (A : Set a) : Set a where ∅ : ⟦ A ⟧ _∷_ : A → ⟦ A ⟧ → ⟦ A ⟧ -- Nat ⟦⟧ = ⟦ ⊤ ⟧ test⟦⟧ : ⟦⟧ test⟦⟧ = {!(tt ∷_) ∅ !} infix 21 ¡_ pattern ¡_ ⟦A⟧ = tt ∷ ⟦A⟧ --¡ : ⟦⟧ → ⟦⟧ --¡ ⟦A⟧ = tt ∷ ⟦A⟧ -- Fin (with a payload) -- n-1 , ... 0 data ⟦_⟧[_] {a} (A : ⟦⟧ → Set a) : ⟦⟧ → Set a where ∅ : ∀ {n} → ⟦ A ⟧[ ¡ n ] _∷_ : ∀ {n} → A n → ⟦ A ⟧[ n ] → ⟦ A ⟧[ ¡ n ] ⟦⟧[_] = ⟦ const ⊤ ⟧[_] -- Vec (with an (optional) index) -- 0 ≤ n, counting down from n to 0 data ⟦_⟧[_₀] {a} (A : ⟦⟧ → Set a) : ⟦⟧ → Set a where ∅ : ⟦ A ⟧[ ∅ ₀] _∷_ : ∀ {n} → A n → ⟦ A ⟧[ n ₀] → ⟦ A ⟧[ ¡ n ₀] ⟦⟧[_₀] = ⟦ const ⊤ ⟧[_₀] -- Interval↓ -- Interval⟨_⟩[_↙_) -- Descenderval -- m ≤ n, counting down from n-1 to m data ⟦_⟧[_≤_↓] {a} (A : ⟦⟧ → Set a) (m : ⟦⟧) : ⟦⟧ → Set a where ∅ : ⟦ A ⟧[ m ≤ m ↓] _∷_ : ∀ {n} → A n → ⟦ A ⟧[ m ≤ n ↓] → ⟦ A ⟧[ m ≤ ¡ n ↓] ⟦⟧[_≤_↓] = ⟦ const ⊤ ⟧[_≤_↓] -- Fin⟨_⟩ = λ A n → Interval↓ A 0 n -- Vec n = Descenderval 0 (↑ n) -- Interval⟨_⟩[_↗_) -- Ascenderval -- m ≤ n, counting up from m to n-1 data ⟦_⟧[↑_≤_] {a} (A : ⟦⟧ → Set a) (m : ⟦⟧) : ⟦⟧ → Set a where ∅ : ⟦ A ⟧[↑ m ≤ m ] _∷_ : ∀ {n} → A m → ⟦ A ⟧[↑ ¡ m ≤ n ] → ⟦ A ⟧[↑ m ≤ n ] ⟦⟧[↑_≤_] = ⟦ const ⊤ ⟧[↑_≤_] -- Inj (almost) -- m ≤ n, m-1...0, n-1...n-m -- Paradescenderval data ⟦_⟧[↓_≤_↓] {a} (A : ⟦⟧ → ⟦⟧ → Set a) : ⟦⟧ → ⟦⟧ → Set a where ∅ : ∀ {n} → ⟦ A ⟧[↓ ∅ ≤ n ↓] _∷_ : ∀ {m n} → A m n → ⟦ A ⟧[↓ m ≤ n ↓] → ⟦ A ⟧[↓ ¡ m ≤ ¡ n ↓] -- Inj = Paradescenderval (λ _ → Fin ∘ ↑_) ⟦⟧[↓_≤_↓] = ⟦ const const ⊤ ⟧[↓_≤_↓] infix 21 ‼_ pattern ‼_ ⟦A⟧ = tt ∷ ⟦A⟧ -- tricky, works for all above _∷_ constructors only because it is defined afterwards, won't work for any later-defined constructors {- Function (B m → B n) Fin Term AList (SubstitutionList) Substilist Step List FinTerm (SubstitutionFunction) Substifunction SubstitutionFunction.internal SubstitutionFunction.Morphism SubstitutionFunction.IsSemigroupoid SubstitutionFunction.IsCategory IsSemigroupoid IsCategory -} --Nat = ⟦⟧ --Vec : -- mutual -- Terms : Nat → Nat → Set 𝔣 -- Terms N m = Vec (Term m) N -- data Term (m : Nat) : Set 𝔣 where -- i : (x : Fin m) → Term m -- leaf : Term m -- _fork_ : (s t : Term m) → Term m -- function : FunctionName → ∀ {N} → Terms N m → Term m
{ "alphanum_fraction": 0.485472155, "avg_line_length": 20.3114754098, "ext": "agda", "hexsha": "a2d429267dd7e305bbc4f8b394d267a5aa56b16e", "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-2/Oscar/Data.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-2/Oscar/Data.agda", "max_line_length": 158, "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-2/Oscar/Data.agda", "max_stars_repo_stars_event_max_datetime": null, "max_stars_repo_stars_event_min_datetime": null, "num_tokens": 1245, "size": 2478 }
open import Agda.Builtin.Nat record R : Set where field x : Nat open R {{...}} f₁ f₂ : R -- This is fine. x ⦃ f₁ ⦄ = 0 -- THIS WORKS BUT MAKES NO SENSE!!! f₂ ⦃ .x ⦄ = 0
{ "alphanum_fraction": 0.5555555556, "avg_line_length": 11.25, "ext": "agda", "hexsha": "227b9eca4a1844031ef1029d34b836dc36b477c5", "lang": "Agda", "max_forks_count": 1, "max_forks_repo_forks_event_max_datetime": "2021-04-01T18:30:09.000Z", "max_forks_repo_forks_event_min_datetime": "2021-04-01T18:30:09.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/Fail/Issue3289.agda", "max_issues_count": 3, "max_issues_repo_head_hexsha": "ed8ac6f4062ea8a20fa0f62d5db82d4e68278338", "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": "shlevy/agda", "max_issues_repo_path": "test/Fail/Issue3289.agda", "max_line_length": 35, "max_stars_count": 2, "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/Issue3289.agda", "max_stars_repo_stars_event_max_datetime": "2020-09-20T00:28:57.000Z", "max_stars_repo_stars_event_min_datetime": "2019-10-29T09:40:30.000Z", "num_tokens": 78, "size": 180 }