Search is not available for this dataset
text
string
meta
dict
data Unit : Set where unit : Unit P : Unit → Set P unit = Unit postulate Q : (u : Unit) → P u → Set variable u : Unit p : P u postulate q : P u → Q u p q' : (u : Unit) (p : P u) → P u → Q u p q' u p = q {u} {p}
{ "alphanum_fraction": 0.4933920705, "avg_line_length": 11.35, "ext": "agda", "hexsha": "50b8352825106b5e804d0de7128705ec9cf5af8b", "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/Issue3667.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/Issue3667.agda", "max_line_length": 39, "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/Issue3667.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": 100, "size": 227 }
data ℕ : Set where zero : ℕ suc : ℕ → ℕ {-# BUILTIN NATURAL ℕ #-} infixl 6 _+_ infix 6 _∸_ _+_ : ℕ → ℕ → ℕ zero + n = n suc m + n = suc (m + n) _∸_ : ℕ → ℕ → ℕ m ∸ zero = m zero ∸ suc n = zero suc m ∸ suc n = m ∸ n should-be-rejected : ℕ should-be-rejected = 1 + 0 ∸ 1
{ "alphanum_fraction": 0.5052264808, "avg_line_length": 13.6666666667, "ext": "agda", "hexsha": "2d3a1a0678390e4f4439c6f2db502b93d1eea59f", "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/Same-Precedence-Different-Associativity.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/Same-Precedence-Different-Associativity.agda", "max_line_length": 30, "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/Same-Precedence-Different-Associativity.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": 135, "size": 287 }
-- {-# OPTIONS -v term:20 #-} -- Andreas, 2011-04-19 (Agda list post by Leonard Rodriguez) module TerminationSubExpression where infixr 3 _⇨_ data Type : Set where int : Type _⇨_ : Type → Type → Type test : Type → Type test int = int test (φ ⇨ int) = test φ test (φ ⇨ (φ′ ⇨ φ″)) = test (φ′ ⇨ φ″) -- this should terminate since rec. call on subterm test' : Type → Type test' int = int test' (φ ⇨ int) = test' φ test' (φ ⇨ φ′) = test' φ′ ok : Type → Type ok int = int ok (φ ⇨ φ′) with φ′ ... | int = ok φ ... | (φ″ ⇨ φ‴) = ok (φ″ ⇨ φ‴)
{ "alphanum_fraction": 0.5732600733, "avg_line_length": 21, "ext": "agda", "hexsha": "16ac402e49e460fe5493694f922d365c118ec9ae", "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/succeed/TerminationSubExpression.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/succeed/TerminationSubExpression.agda", "max_line_length": 60, "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/TerminationSubExpression.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": 222, "size": 546 }
{-# OPTIONS --safe --warning=error --without-K #-} open import Sets.EquivalenceRelations open import Setoids.Setoids open import Functions.Definition open import Groups.Definition open import Groups.Homomorphisms.Definition open import Groups.Subgroups.Definition open import Groups.Subgroups.Normal.Definition module Groups.Cosets {a b : _} {A : Set a} {S : Setoid {a} {b} A} {_+_ : A → A → A} (G : Group S _+_) {c : _} {pred : A → Set c} (subgrp : Subgroup G pred) where open Equivalence (Setoid.eq S) open import Groups.Lemmas G open Group G open Subgroup subgrp cosetSetoid : Setoid A Setoid._∼_ cosetSetoid g h = pred ((Group.inverse G h) + g) Equivalence.reflexive (Setoid.eq cosetSetoid) = isSubset (symmetric (Group.invLeft G)) containsIdentity Equivalence.symmetric (Setoid.eq cosetSetoid) yx = isSubset (transitive invContravariant (+WellDefined reflexive invInv)) (closedUnderInverse yx) Equivalence.transitive (Setoid.eq cosetSetoid) yx zy = isSubset (transitive +Associative (+WellDefined (transitive (symmetric +Associative) (transitive (+WellDefined reflexive invRight) identRight)) reflexive)) (closedUnderPlus zy yx) cosetGroup : normalSubgroup G subgrp → Group cosetSetoid _+_ Group.+WellDefined (cosetGroup norm) {m} {n} {x} {y} m=x n=y = ans where t : pred (inverse y + n) t = n=y u : pred (inverse x + m) u = m=x v : pred (m + inverse x) v = isSubset (+WellDefined reflexive (transitive (symmetric +Associative) (transitive (+WellDefined reflexive invRight) identRight))) (norm u) ans' : pred ((inverse y) + ((inverse x + m) + inverse (inverse y))) ans' = norm u ans'' : pred ((inverse y) + ((inverse x + m) + y)) ans'' = isSubset (+WellDefined reflexive (+WellDefined reflexive (invTwice y))) ans' ans : pred (inverse (x + y) + (m + n)) ans = isSubset (transitive (transitive +Associative (transitive (+WellDefined (transitive (symmetric +Associative) (transitive (+WellDefined reflexive (transitive (symmetric +Associative) (transitive (+WellDefined reflexive invRight) identRight))) +Associative)) reflexive) (symmetric +Associative))) (symmetric (+WellDefined invContravariant reflexive))) (closedUnderPlus ans'' t) Group.0G (cosetGroup norm) = 0G Group.inverse (cosetGroup norm) = inverse Group.+Associative (cosetGroup norm) {a} {b} {c} = isSubset (symmetric (transitive (+WellDefined (inverseWellDefined (symmetric +Associative)) reflexive) (invLeft {a + (b + c)}))) containsIdentity Group.identRight (cosetGroup norm) = isSubset (symmetric (transitive +Associative (transitive (+WellDefined invLeft reflexive) identRight))) containsIdentity Group.identLeft (cosetGroup norm) = isSubset (symmetric (transitive (+WellDefined reflexive identLeft) invLeft)) containsIdentity Group.invLeft (cosetGroup norm) = isSubset (symmetric (transitive (+WellDefined reflexive invLeft) invLeft)) containsIdentity Group.invRight (cosetGroup norm) = isSubset (symmetric (transitive (+WellDefined reflexive invRight) invLeft)) containsIdentity cosetGroupHom : (norm : normalSubgroup G subgrp) → GroupHom G (cosetGroup norm) id GroupHom.groupHom (cosetGroupHom norm) = isSubset (symmetric (transitive (+WellDefined invContravariant reflexive) (transitive +Associative (transitive (+WellDefined (transitive (symmetric +Associative) (+WellDefined reflexive invLeft)) reflexive) (transitive (+WellDefined identRight reflexive) invLeft))))) (Subgroup.containsIdentity subgrp) GroupHom.wellDefined (cosetGroupHom norm) {x} {y} x=y = isSubset (symmetric (transitive (+WellDefined reflexive x=y) invLeft)) (Subgroup.containsIdentity subgrp)
{ "alphanum_fraction": 0.7504862462, "avg_line_length": 71.98, "ext": "agda", "hexsha": "35ef2809f0226dba2c0f61791f45c712e9ea4aae", "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": "Groups/Cosets.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": "Groups/Cosets.agda", "max_line_length": 385, "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": "Groups/Cosets.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": 1027, "size": 3599 }
{-# BUILTIN NATURAL ℕ #-} module the-naturals where import Relation.Binary.PropositionalEquality as Eq open Eq using (_≡_; refl) open Eq.≡-Reasoning using (begin_; _≡⟨⟩_; _∎) infixl 6 _+_ _∸_ infixl 7 _*_ -- the naturals data ℕ : Set where zero : ℕ suc : ℕ → ℕ -- addition _+_ : ℕ → ℕ → ℕ zero + n = n (suc m) + n = suc (m + n) -- multiplication _*_ : ℕ → ℕ → ℕ zero * n = zero (suc m) * n = n + (m * n) -- monus ( subtraction for the naturals ) _∸_ : ℕ → ℕ → ℕ m ∸ zero = m zero ∸ suc n = zero suc m ∸ suc n = m ∸ n
{ "alphanum_fraction": 0.5615942029, "avg_line_length": 16.7272727273, "ext": "agda", "hexsha": "a2ffecbed0a3b576537d1af7c6705da337243dee", "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": "9fd9fbf9f265bf526a2ec83e9442dedc7106b80c", "max_forks_repo_licenses": [ "CC0-1.0" ], "max_forks_repo_name": "seanwestfall/agda_explorations", "max_forks_repo_path": "src/the-naturals.agda", "max_issues_count": null, "max_issues_repo_head_hexsha": "9fd9fbf9f265bf526a2ec83e9442dedc7106b80c", "max_issues_repo_issues_event_max_datetime": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_licenses": [ "CC0-1.0" ], "max_issues_repo_name": "seanwestfall/agda_explorations", "max_issues_repo_path": "src/the-naturals.agda", "max_line_length": 50, "max_stars_count": null, "max_stars_repo_head_hexsha": "9fd9fbf9f265bf526a2ec83e9442dedc7106b80c", "max_stars_repo_licenses": [ "CC0-1.0" ], "max_stars_repo_name": "seanwestfall/agda_explorations", "max_stars_repo_path": "src/the-naturals.agda", "max_stars_repo_stars_event_max_datetime": null, "max_stars_repo_stars_event_min_datetime": null, "num_tokens": 227, "size": 552 }
module Category.Functor.Arr where open import Agda.Primitive using (_⊔_) open import Category.Functor using (RawFunctor ; module RawFunctor ) open import Category.Applicative using (RawApplicative; module RawApplicative) open import Function using (_∘_) open import Category.Functor.Lawful open import Relation.Binary.PropositionalEquality using (refl) Arr : ∀ {l₁ l₂} → Set l₁ → Set l₂ → Set (l₁ ⊔ l₂) Arr A B = A → B arrFunctor : ∀ {l₁ l₂} {B : Set l₁} → RawFunctor (Arr {l₁} {l₂} B) arrFunctor = record { _<$>_ = λ z z₁ x → z (z₁ x) } -- auto-found arrLawfulFunctor : ∀ {l₁ l₂} {B : Set l₁} → LawfulFunctorImp (arrFunctor {l₁} {l₂} {B}) arrLawfulFunctor = record { <$>-identity = refl ; <$>-compose = refl } arrApplicative : ∀ {l₁} {B : Set l₁} → RawApplicative (Arr {l₁} {l₁} B) arrApplicative = record { pure = λ z x → z ; _⊛_ = λ z z₁ x → z x (z₁ x) } -- auto-found arrLawfulApplicative : ∀ {l₁} {B : Set l₁} → LawfulApplicativeImp (arrApplicative {l₁} {B}) arrLawfulApplicative = record { ⊛-identity = refl ; ⊛-homomorphism = refl ; ⊛-interchange = refl ; ⊛-composition = refl }
{ "alphanum_fraction": 0.6630920465, "avg_line_length": 34.96875, "ext": "agda", "hexsha": "7ff0c6ea8523b74f0c456754545987d742c83875", "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": "308afeeaa905870dbf1a995fa82e8825dfaf2d74", "max_forks_repo_licenses": [ "BSD-3-Clause" ], "max_forks_repo_name": "crisoagf/agda-optics", "max_forks_repo_path": "src/Category/Functor/Arr.agda", "max_issues_count": null, "max_issues_repo_head_hexsha": "308afeeaa905870dbf1a995fa82e8825dfaf2d74", "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": "crisoagf/agda-optics", "max_issues_repo_path": "src/Category/Functor/Arr.agda", "max_line_length": 91, "max_stars_count": null, "max_stars_repo_head_hexsha": "308afeeaa905870dbf1a995fa82e8825dfaf2d74", "max_stars_repo_licenses": [ "BSD-3-Clause" ], "max_stars_repo_name": "crisoagf/agda-optics", "max_stars_repo_path": "src/Category/Functor/Arr.agda", "max_stars_repo_stars_event_max_datetime": null, "max_stars_repo_stars_event_min_datetime": null, "num_tokens": 406, "size": 1119 }
------------------------------------------------------------------------ -- The Agda standard library -- -- Universe levels ------------------------------------------------------------------------ module Level where -- Levels. open import Agda.Primitive public using (Level; _⊔_) renaming (lzero to zero; lsuc to suc) -- Lifting. record Lift {a ℓ} (A : Set a) : Set (a ⊔ ℓ) where constructor lift field lower : A open Lift public
{ "alphanum_fraction": 0.4496644295, "avg_line_length": 20.3181818182, "ext": "agda", "hexsha": "648bf49c05fcdfb23a6e1ee60f4ad322e7ec677d", "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/Level.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/Level.agda", "max_line_length": 72, "max_stars_count": 1, "max_stars_repo_head_hexsha": "9d4c43b1609d3f085636376fdca73093481ab882", "max_stars_repo_licenses": [ "Apache-2.0" ], "max_stars_repo_name": "qwe2/try-agda", "max_stars_repo_path": "agda-stdlib-0.9/src/Level.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": 97, "size": 447 }
{-# OPTIONS --without-K #-} open import lib.Basics open import lib.NConnected open import lib.types.Nat open import lib.types.TLevel open import lib.types.Empty open import lib.types.Group open import lib.types.Pi open import lib.types.Pointed open import lib.types.Paths open import lib.types.Sigma open import lib.types.Truncation open import lib.cubical.Square module lib.types.LoopSpace where module _ {i} where ⊙Ω : Ptd i → Ptd i ⊙Ω (A , a) = ⊙[ (a == a) , idp ] Ω : Ptd i → Type i Ω = fst ∘ ⊙Ω ⊙Ω^ : (n : ℕ) → Ptd i → Ptd i ⊙Ω^ O X = X ⊙Ω^ (S n) X = ⊙Ω (⊙Ω^ n X) Ω^ : (n : ℕ) → Ptd i → Type i Ω^ n X = fst (⊙Ω^ n X) idp^ : ∀ {i} (n : ℕ) {X : Ptd i} → Ω^ n X idp^ n {X} = snd (⊙Ω^ n X) {- for n ≥ 1, we have a group structure on the loop space -} module _ {i} where !^ : (n : ℕ) (t : n ≠ O) {X : Ptd i} → Ω^ n X → Ω^ n X !^ O t = ⊥-rec (t idp) !^ (S n) _ = ! conc^ : (n : ℕ) (t : n ≠ O) {X : Ptd i} → Ω^ n X → Ω^ n X → Ω^ n X conc^ O t = ⊥-rec (t idp) conc^ (S n) _ = _∙_ {- ap and ap2 for pointed functions -} private pt-lemma : ∀ {i} {A : Type i} {x y : A} (p : x == y) → ! p ∙ (idp ∙' p) == idp pt-lemma idp = idp ⊙ap : ∀ {i j} {X : Ptd i} {Y : Ptd j} → fst (X ⊙→ Y) → fst (⊙Ω X ⊙→ ⊙Ω Y) ⊙ap (f , fpt) = ((λ p → ! fpt ∙ ap f p ∙' fpt) , pt-lemma fpt) ⊙ap2 : ∀ {i j k} {X : Ptd i} {Y : Ptd j} {Z : Ptd k} → fst (X ⊙× Y ⊙→ Z) → fst (⊙Ω X ⊙× ⊙Ω Y ⊙→ ⊙Ω Z) ⊙ap2 (f , fpt) = ((λ {(p , q) → ! fpt ∙ ap2 (curry f) p q ∙' fpt}) , pt-lemma fpt) ⊙ap-∘ : ∀ {i j k} {X : Ptd i} {Y : Ptd j} {Z : Ptd k} (g : fst (Y ⊙→ Z)) (f : fst (X ⊙→ Y)) → ⊙ap (g ⊙∘ f) == ⊙ap g ⊙∘ ⊙ap f ⊙ap-∘ (g , idp) (f , idp) = ⊙λ= (λ p → ap-∘ g f p) idp ⊙ap-idf : ∀ {i} {X : Ptd i} → ⊙ap (⊙idf X) == ⊙idf _ ⊙ap-idf = ⊙λ= ap-idf idp ⊙ap2-fst : ∀ {i j} {X : Ptd i} {Y : Ptd j} → ⊙ap2 {X = X} {Y = Y} ⊙fst == ⊙fst ⊙ap2-fst = ⊙λ= (uncurry ap2-fst) idp ⊙ap2-snd : ∀ {i j} {X : Ptd i} {Y : Ptd j} → ⊙ap2 {X = X} {Y = Y} ⊙snd == ⊙snd ⊙ap2-snd = ⊙λ= (uncurry ap2-snd) idp ⊙ap-ap2 : ∀ {i j k l} {X : Ptd i} {Y : Ptd j} {Z : Ptd k} {W : Ptd l} (G : fst (Z ⊙→ W)) (F : fst (X ⊙× Y ⊙→ Z)) → ⊙ap G ⊙∘ ⊙ap2 F == ⊙ap2 (G ⊙∘ F) ⊙ap-ap2 (g , idp) (f , idp) = ⊙λ= (uncurry (ap-ap2 g (curry f))) idp ⊙ap2-ap : ∀ {i j k l m} {X : Ptd i} {Y : Ptd j} {U : Ptd k} {V : Ptd l} {Z : Ptd m} (G : fst ((U ⊙× V) ⊙→ Z)) (F₁ : fst (X ⊙→ U)) (F₂ : fst (Y ⊙→ V)) → ⊙ap2 G ⊙∘ pair⊙→ (⊙ap F₁) (⊙ap F₂) == ⊙ap2 (G ⊙∘ pair⊙→ F₁ F₂) ⊙ap2-ap (g , idp) (f₁ , idp) (f₂ , idp) = ⊙λ= (λ {(p , q) → ap2-ap-l (curry g) f₁ p (ap f₂ q) ∙ ap2-ap-r (λ x v → g (f₁ x , v)) f₂ p q}) idp ⊙ap2-diag : ∀ {i j} {X : Ptd i} {Y : Ptd j} (F : fst (X ⊙× X ⊙→ Y)) → ⊙ap2 F ⊙∘ ⊙diag == ⊙ap (F ⊙∘ ⊙diag) ⊙ap2-diag (f , idp) = ⊙λ= (ap2-diag (curry f)) idp {- ap and ap2 for higher loop spaces -} ap^ : ∀ {i j} (n : ℕ) {X : Ptd i} {Y : Ptd j} → fst (X ⊙→ Y) → fst (⊙Ω^ n X ⊙→ ⊙Ω^ n Y) ap^ O F = F ap^ (S n) F = ⊙ap (ap^ n F) ap2^ : ∀ {i j k} (n : ℕ) {X : Ptd i} {Y : Ptd j} {Z : Ptd k} → fst ((X ⊙× Y) ⊙→ Z) → fst ((⊙Ω^ n X ⊙× ⊙Ω^ n Y) ⊙→ ⊙Ω^ n Z) ap2^ O F = F ap2^ (S n) F = ⊙ap2 (ap2^ n F) ap^-idf : ∀ {i} (n : ℕ) {X : Ptd i} → ap^ n (⊙idf X) == ⊙idf _ ap^-idf O = idp ap^-idf (S n) = ap ⊙ap (ap^-idf n) ∙ ⊙ap-idf ap^-ap2^ : ∀ {i j k l} (n : ℕ) {X : Ptd i} {Y : Ptd j} {Z : Ptd k} {W : Ptd l} (G : fst (Z ⊙→ W)) (F : fst ((X ⊙× Y) ⊙→ Z)) → ap^ n G ⊙∘ ap2^ n F == ap2^ n (G ⊙∘ F) ap^-ap2^ O G F = idp ap^-ap2^ (S n) G F = ⊙ap-ap2 (ap^ n G) (ap2^ n F) ∙ ap ⊙ap2 (ap^-ap2^ n G F) ap2^-fst : ∀ {i j} (n : ℕ) {X : Ptd i} {Y : Ptd j} → ap2^ n {X} {Y} ⊙fst == ⊙fst ap2^-fst O = idp ap2^-fst (S n) = ap ⊙ap2 (ap2^-fst n) ∙ ⊙ap2-fst ap2^-snd : ∀ {i j} (n : ℕ) {X : Ptd i} {Y : Ptd j} → ap2^ n {X} {Y} ⊙snd == ⊙snd ap2^-snd O = idp ap2^-snd (S n) = ap ⊙ap2 (ap2^-snd n) ∙ ⊙ap2-snd ap2^-ap^ : ∀ {i j k l m} (n : ℕ) {X : Ptd i} {Y : Ptd j} {U : Ptd k} {V : Ptd l} {Z : Ptd m} (G : fst ((U ⊙× V) ⊙→ Z)) (F₁ : fst (X ⊙→ U)) (F₂ : fst (Y ⊙→ V)) → ap2^ n G ⊙∘ pair⊙→ (ap^ n F₁) (ap^ n F₂) == ap2^ n (G ⊙∘ pair⊙→ F₁ F₂) ap2^-ap^ O G F₁ F₂ = idp ap2^-ap^ (S n) G F₁ F₂ = ⊙ap2-ap (ap2^ n G) (ap^ n F₁) (ap^ n F₂) ∙ ap ⊙ap2 (ap2^-ap^ n G F₁ F₂) ap2^-diag : ∀ {i j} (n : ℕ) {X : Ptd i} {Y : Ptd j} (F : fst (X ⊙× X ⊙→ Y)) → ap2^ n F ⊙∘ ⊙diag == ap^ n (F ⊙∘ ⊙diag) ap2^-diag O F = idp ap2^-diag (S n) F = ⊙ap2-diag (ap2^ n F) ∙ ap ⊙ap (ap2^-diag n F) module _ {i} {X : Ptd i} where {- Prove these as lemmas now - so we don't have to deal with the n = O case later -} conc^-unit-l : (n : ℕ) (t : n ≠ O) (q : Ω^ n X) → (conc^ n t (idp^ n) q) == q conc^-unit-l O t _ = ⊥-rec (t idp) conc^-unit-l (S n) _ _ = idp conc^-unit-r : (n : ℕ) (t : n ≠ O) (q : Ω^ n X) → (conc^ n t q (idp^ n)) == q conc^-unit-r O t = ⊥-rec (t idp) conc^-unit-r (S n) _ = ∙-unit-r conc^-assoc : (n : ℕ) (t : n ≠ O) (p q r : Ω^ n X) → conc^ n t (conc^ n t p q) r == conc^ n t p (conc^ n t q r) conc^-assoc O t = ⊥-rec (t idp) conc^-assoc (S n) _ = ∙-assoc !^-inv-l : (n : ℕ) (t : n ≠ O) (p : Ω^ n X) → conc^ n t (!^ n t p) p == idp^ n !^-inv-l O t = ⊥-rec (t idp) !^-inv-l (S n) _ = !-inv-l !^-inv-r : (n : ℕ) (t : n ≠ O) (p : Ω^ n X) → conc^ n t p (!^ n t p) == idp^ n !^-inv-r O t = ⊥-rec (t idp) !^-inv-r (S n) _ = !-inv-r abstract ap^-conc^ : ∀ {i j} (n : ℕ) (t : n ≠ O) {X : Ptd i} {Y : Ptd j} (F : fst (X ⊙→ Y)) (p q : Ω^ n X) → fst (ap^ n F) (conc^ n t p q) == conc^ n t (fst (ap^ n F) p) (fst (ap^ n F) q) ap^-conc^ O t _ _ _ = ⊥-rec (t idp) ap^-conc^ (S n) _ {X = X} {Y = Y} F p q = ! gpt ∙ ap g (p ∙ q) ∙' gpt =⟨ ap-∙ g p q |in-ctx (λ w → ! gpt ∙ w ∙' gpt) ⟩ ! gpt ∙ (ap g p ∙ ap g q) ∙' gpt =⟨ lemma (ap g p) (ap g q) gpt ⟩ (! gpt ∙ ap g p ∙' gpt) ∙ (! gpt ∙ ap g q ∙' gpt) ∎ where g : Ω^ n X → Ω^ n Y g = fst (ap^ n F) gpt : g (idp^ n) == idp^ n gpt = snd (ap^ n F) lemma : ∀ {i} {A : Type i} {x y : A} → (p q : x == x) (r : x == y) → ! r ∙ (p ∙ q) ∙' r == (! r ∙ p ∙' r) ∙ (! r ∙ q ∙' r) lemma p q idp = idp {- ap^ preserves (pointed) equivalences -} module _ {i j} {X : Ptd i} {Y : Ptd j} where is-equiv-ap^ : (n : ℕ) (F : fst (X ⊙→ Y)) (e : is-equiv (fst F)) → is-equiv (fst (ap^ n F)) is-equiv-ap^ O F e = e is-equiv-ap^ (S n) F e = pre∙-is-equiv (! (snd (ap^ n F))) ∘ise post∙'-is-equiv (snd (ap^ n F)) ∘ise snd (equiv-ap (_ , is-equiv-ap^ n F e) _ _) equiv-ap^ : (n : ℕ) (F : fst (X ⊙→ Y)) (e : is-equiv (fst F)) → Ω^ n X ≃ Ω^ n Y equiv-ap^ n F e = (fst (ap^ n F) , is-equiv-ap^ n F e) Ω^-level-in : ∀ {i} (m : ℕ₋₂) (n : ℕ) (X : Ptd i) → (has-level ((n -2) +2+ m) (fst X) → has-level m (Ω^ n X)) Ω^-level-in m O X pX = pX Ω^-level-in m (S n) X pX = Ω^-level-in (S m) n X (transport (λ k → has-level k (fst X)) (! (+2+-βr (n -2) m)) pX) (idp^ n) (idp^ n) Ω^-conn-in : ∀ {i} (m : ℕ₋₂) (n : ℕ) (X : Ptd i) → (is-connected ((n -2) +2+ m) (fst X)) → is-connected m (Ω^ n X) Ω^-conn-in m O X pX = pX Ω^-conn-in m (S n) X pX = path-conn $ Ω^-conn-in (S m) n X $ transport (λ k → is-connected k (fst X)) (! (+2+-βr (n -2) m)) pX {- Eckmann-Hilton argument -} module _ {i} {X : Ptd i} where conc^2-comm : (α β : Ω^ 2 X) → conc^ 2 (ℕ-S≠O _) α β == conc^ 2 (ℕ-S≠O _) β α conc^2-comm α β = ! (⋆2=conc^ α β) ∙ ⋆2=⋆'2 α β ∙ ⋆'2=conc^ α β where ⋆2=conc^ : (α β : Ω^ 2 X) → α ⋆2 β == conc^ 2 (ℕ-S≠O _) α β ⋆2=conc^ α β = ap (λ π → π ∙ β) (∙-unit-r α) ⋆'2=conc^ : (α β : Ω^ 2 X) → α ⋆'2 β == conc^ 2 (ℕ-S≠O _) β α ⋆'2=conc^ α β = ap (λ π → β ∙ π) (∙-unit-r α) {- Pushing truncation through loop space -} module _ {i} where Trunc-Ω^ : (m : ℕ₋₂) (n : ℕ) (X : Ptd i) → ⊙Trunc m (⊙Ω^ n X) == ⊙Ω^ n (⊙Trunc ((n -2) +2+ m) X) Trunc-Ω^ m O X = idp Trunc-Ω^ m (S n) X = ⊙Trunc m (⊙Ω^ (S n) X) =⟨ ! (pair= (Trunc=-path [ _ ] [ _ ]) (↓-idf-ua-in _ idp)) ⟩ ⊙Ω (⊙Trunc (S m) (⊙Ω^ n X)) =⟨ ap ⊙Ω (Trunc-Ω^ (S m) n X) ⟩ ⊙Ω^ (S n) (⊙Trunc ((n -2) +2+ S m) X) =⟨ +2+-βr (n -2) m |in-ctx (λ k → ⊙Ω^ (S n) (⊙Trunc k X)) ⟩ ⊙Ω^ (S n) (⊙Trunc (S (n -2) +2+ m) X) ∎ Ω-Trunc-equiv : (m : ℕ₋₂) (X : Ptd i) → Ω (⊙Trunc (S m) X) ≃ Trunc m (Ω X) Ω-Trunc-equiv m X = Trunc=-equiv [ snd X ] [ snd X ] {- A loop space is a pregroup, and a group if it has the right level -} module _ {i} (n : ℕ) (t : n ≠ O) (X : Ptd i) where Ω^-group-structure : GroupStructure (Ω^ n X) Ω^-group-structure = record { ident = idp^ n; inv = !^ n t; comp = conc^ n t; unitl = conc^-unit-l n t; unitr = conc^-unit-r n t; assoc = conc^-assoc n t; invr = !^-inv-r n t; invl = !^-inv-l n t } Ω^-Group : has-level ⟨ n ⟩ (fst X) → Group i Ω^-Group pX = group (Ω^ n X) (Ω^-level-in ⟨0⟩ n X $ transport (λ t → has-level t (fst X)) (+2+-comm ⟨0⟩ (n -2)) pX) Ω^-group-structure {- Our definition of Ω^ builds up loops on the outside, - but this is equivalent to building up on the inside -} module _ {i} where ⊙Ω^-inner-path : (n : ℕ) (X : Ptd i) → ⊙Ω^ (S n) X == ⊙Ω^ n (⊙Ω X) ⊙Ω^-inner-path O X = idp ⊙Ω^-inner-path (S n) X = ap ⊙Ω (⊙Ω^-inner-path n X) ⊙Ω^-inner-out : (n : ℕ) (X : Ptd i) → fst (⊙Ω^ (S n) X ⊙→ ⊙Ω^ n (⊙Ω X)) ⊙Ω^-inner-out O _ = (idf _ , idp) ⊙Ω^-inner-out (S n) X = ap^ 1 (⊙Ω^-inner-out n X) Ω^-inner-out : (n : ℕ) (X : Ptd i) → (Ω^ (S n) X → Ω^ n (⊙Ω X)) Ω^-inner-out n X = fst (⊙Ω^-inner-out n X) Ω^-inner-out-conc^ : (n : ℕ) (t : n ≠ O) (X : Ptd i) (p q : Ω^ (S n) X) → Ω^-inner-out n X (conc^ (S n) (ℕ-S≠O _) p q) == conc^ n t (Ω^-inner-out n X p) (Ω^-inner-out n X q) Ω^-inner-out-conc^ O t X _ _ = ⊥-rec (t idp) Ω^-inner-out-conc^ (S n) t X p q = ap^-conc^ 1 (ℕ-S≠O _) (⊙Ω^-inner-out n X) p q Ω^-inner-is-equiv : (n : ℕ) (X : Ptd i) → is-equiv (fst (⊙Ω^-inner-out n X)) Ω^-inner-is-equiv O X = is-eq (idf _) (idf _) (λ _ → idp) (λ _ → idp) Ω^-inner-is-equiv (S n) X = is-equiv-ap^ 1 (⊙Ω^-inner-out n X) (Ω^-inner-is-equiv n X) Ω^-inner-equiv : (n : ℕ) (X : Ptd i) → Ω^ (S n) X ≃ Ω^ n (⊙Ω X) Ω^-inner-equiv n X = _ , Ω^-inner-is-equiv n X
{ "alphanum_fraction": 0.4476686996, "avg_line_length": 32.3757961783, "ext": "agda", "hexsha": "135baf1abc80410eaa9fe7bc837f992e105a6d8c", "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": "1695a7f3dc60177457855ae846bbd86fcd96983e", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "danbornside/HoTT-Agda", "max_forks_repo_path": "lib/types/LoopSpace.agda", "max_issues_count": null, "max_issues_repo_head_hexsha": "1695a7f3dc60177457855ae846bbd86fcd96983e", "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": "danbornside/HoTT-Agda", "max_issues_repo_path": "lib/types/LoopSpace.agda", "max_line_length": 79, "max_stars_count": null, "max_stars_repo_head_hexsha": "1695a7f3dc60177457855ae846bbd86fcd96983e", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "danbornside/HoTT-Agda", "max_stars_repo_path": "lib/types/LoopSpace.agda", "max_stars_repo_stars_event_max_datetime": null, "max_stars_repo_stars_event_min_datetime": null, "num_tokens": 5386, "size": 10166 }
open import Prelude module Implicits.Syntax.Term where open import Implicits.Syntax.Type infixl 9 _[_] _·_ data Term (ν n : ℕ) : Set where var : (x : Fin n) → Term ν n Λ : Term (suc ν) n → Term ν n λ' : Type ν → Term ν (suc n) → Term ν n _[_] : Term ν n → Type ν → Term ν n _·_ : Term ν n → Term ν n → Term ν n -- rule abstraction and application ρ : Type ν → Term ν (suc n) → Term ν n _with'_ : Term ν n → Term ν n → Term ν n -- implicit rule application _⟨⟩ : Term ν n → Term ν n ClosedTerm : Set ClosedTerm = Term 0 0 ----------------------------------------------------------------------------- -- syntactic sugar let'_∶_in'_ : ∀ {ν n} → Term ν n → Type ν → Term ν (suc n) → Term ν n let' e₁ ∶ r in' e₂ = (λ' r e₂) · e₁ implicit_∶_in'_ : ∀ {ν n} → Term ν n → Type ν → Term ν (suc n) → Term ν n implicit e₁ ∶ r in' e₂ = (ρ r e₂) with' e₁ ¿_ : ∀ {ν n} → Type ν → Term ν n ¿ r = (ρ r (var zero)) ⟨⟩
{ "alphanum_fraction": 0.5217853348, "avg_line_length": 26.1388888889, "ext": "agda", "hexsha": "73e46aef827433ba0ae3a8552403b7f29d13ac88", "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": "7fe638b87de26df47b6437f5ab0a8b955384958d", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "metaborg/ts.agda", "max_forks_repo_path": "src/Implicits/Syntax/Term.agda", "max_issues_count": null, "max_issues_repo_head_hexsha": "7fe638b87de26df47b6437f5ab0a8b955384958d", "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": "metaborg/ts.agda", "max_issues_repo_path": "src/Implicits/Syntax/Term.agda", "max_line_length": 77, "max_stars_count": 4, "max_stars_repo_head_hexsha": "7fe638b87de26df47b6437f5ab0a8b955384958d", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "metaborg/ts.agda", "max_stars_repo_path": "src/Implicits/Syntax/Term.agda", "max_stars_repo_stars_event_max_datetime": "2021-05-07T04:08:41.000Z", "max_stars_repo_stars_event_min_datetime": "2019-04-05T17:57:11.000Z", "num_tokens": 355, "size": 941 }
{-# OPTIONS --omega-in-omega --no-termination-check --overlapping-instances #-} module Light.Library where module Literals where open import Light.Literals public module Data where module Empty where open import Light.Library.Data.Empty public module Either where open import Light.Library.Data.Either public module Natural where open import Light.Library.Data.Natural public module Unit where open import Light.Library.Data.Unit public module Integer where open import Light.Library.Data.Integer public module Boolean where open import Light.Library.Data.Boolean public module Both where open import Light.Library.Data.Both public module Product where open import Light.Library.Data.Product public module These where open import Light.Library.Data.These public module Relation where module Binary where open import Light.Library.Relation.Binary public module Equality where open import Light.Library.Relation.Binary.Equality public module Decidable where open import Light.Library.Relation.Binary.Equality.Decidable public module Decidable where open import Light.Library.Relation.Binary.Decidable public open import Light.Library.Relation public module Decidable where open import Light.Library.Relation.Decidable public module Action where open import Light.Library.Action public module Arithmetic where open import Light.Library.Arithmetic public module Level where open import Light.Level public module Subtyping where open import Light.Subtyping public module Variable where module Levels where open import Light.Variable.Levels public module Sets where open import Light.Variable.Sets public module Other {ℓ} (𝕒 : Set ℓ) where open import Light.Variable.Other 𝕒 public module Package where open import Light.Package public open Package using (Package) hiding (module Package) public -- module Indexed where open import Light.Indexed
{ "alphanum_fraction": 0.7677772253, "avg_line_length": 46.7674418605, "ext": "agda", "hexsha": "853888e8dbdf22e87333e815fb286ecf8b9434fb", "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": "Light/Library.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": "Light/Library.agda", "max_line_length": 108, "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": "Light/Library.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": 372, "size": 2011 }
{-# OPTIONS --safe #-} module Cubical.Algebra.CommRing.Instances.Polynomials where open import Cubical.Foundations.Prelude open import Cubical.Algebra.CommRing open import Cubical.Algebra.Polynomials private variable ℓ : Level Poly : (CommRing ℓ) → CommRing ℓ Poly R = (PolyMod.Poly R) , str where open CommRingStr --(snd R) str : CommRingStr (PolyMod.Poly R) 0r str = PolyMod.0P R 1r str = PolyMod.1P R _+_ str = PolyMod._Poly+_ R _·_ str = PolyMod._Poly*_ R - str = PolyMod.Poly- R isCommRing str = makeIsCommRing (PolyMod.isSetPoly R) (PolyMod.Poly+Assoc R) (PolyMod.Poly+Rid R) (PolyMod.Poly+Inverses R) (PolyMod.Poly+Comm R) (PolyMod.Poly*Associative R) (PolyMod.Poly*Rid R) (PolyMod.Poly*LDistrPoly+ R) (PolyMod.Poly*Commutative R)
{ "alphanum_fraction": 0.5036166365, "avg_line_length": 33.5151515152, "ext": "agda", "hexsha": "a359a454a95bb376620ac769e25c791da32ef222", "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": "038bcaff93d278c627ccdcec34a4f6df2b56ad5a", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "AkermanRydbeck/cubical", "max_forks_repo_path": "Cubical/Algebra/CommRing/Instances/Polynomials.agda", "max_issues_count": null, "max_issues_repo_head_hexsha": "038bcaff93d278c627ccdcec34a4f6df2b56ad5a", "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": "AkermanRydbeck/cubical", "max_issues_repo_path": "Cubical/Algebra/CommRing/Instances/Polynomials.agda", "max_line_length": 66, "max_stars_count": null, "max_stars_repo_head_hexsha": "038bcaff93d278c627ccdcec34a4f6df2b56ad5a", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "AkermanRydbeck/cubical", "max_stars_repo_path": "Cubical/Algebra/CommRing/Instances/Polynomials.agda", "max_stars_repo_stars_event_max_datetime": null, "max_stars_repo_stars_event_min_datetime": null, "num_tokens": 282, "size": 1106 }
module empty where open import level ---------------------------------------------------------------------- -- datatypes ---------------------------------------------------------------------- data ⊥ {ℓ : Level} : Set ℓ where ---------------------------------------------------------------------- -- syntax ---------------------------------------------------------------------- ---------------------------------------------------------------------- -- theorems ---------------------------------------------------------------------- ⊥-elim : ∀{ℓ} → ⊥ {ℓ} → ∀{ℓ'}{P : Set ℓ'} → P ⊥-elim ()
{ "alphanum_fraction": 0.1517706577, "avg_line_length": 28.2380952381, "ext": "agda", "hexsha": "fd2cb85734e977f589c421f3bb3bd74135151bf0", "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": "b33c6a59d664aed46cac8ef77d34313e148fecc2", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "heades/AUGL", "max_forks_repo_path": "empty.agda", "max_issues_count": null, "max_issues_repo_head_hexsha": "b33c6a59d664aed46cac8ef77d34313e148fecc2", "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": "heades/AUGL", "max_issues_repo_path": "empty.agda", "max_line_length": 70, "max_stars_count": null, "max_stars_repo_head_hexsha": "b33c6a59d664aed46cac8ef77d34313e148fecc2", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "heades/AUGL", "max_stars_repo_path": "empty.agda", "max_stars_repo_stars_event_max_datetime": null, "max_stars_repo_stars_event_min_datetime": null, "num_tokens": 83, "size": 593 }
-- Andreas, 2015-08-11, issue reported by G.Allais -- The `a` record field of `Pack` is identified as a function -- (coloured blue, put in a \AgdaFunction in the LaTeX backend) -- when it should be coloured pink. -- The problem does not show up when dropping the second record -- type or removing the module declaration. record Pack (A : Set) : Set where field a : A record Packed {A : Set} (p : Pack A) : Set where module PP = Pack p module Synchronised {A : Set} {p : Pack A} (rel : Packed p) where module M = Packed rel
{ "alphanum_fraction": 0.687150838, "avg_line_length": 29.8333333333, "ext": "agda", "hexsha": "ef714adf1ad14bc1901ef64e28438600eec7fd80", "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/Issue1619.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/Issue1619.agda", "max_line_length": 65, "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/Issue1619.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": 158, "size": 537 }
{-# OPTIONS --cubical --no-import-sorts --safe #-} module Cubical.Data.Nat.GCD where open import Cubical.Foundations.Prelude open import Cubical.Foundations.Function open import Cubical.Foundations.HLevels open import Cubical.Foundations.Equiv open import Cubical.Foundations.Isomorphism open import Cubical.Induction.WellFounded open import Cubical.Data.Fin open import Cubical.Data.Sigma as Σ open import Cubical.Data.NatPlusOne open import Cubical.HITs.PropositionalTruncation as PropTrunc open import Cubical.Data.Nat.Base open import Cubical.Data.Nat.Properties open import Cubical.Data.Nat.Order open import Cubical.Data.Nat.Divisibility private variable m n d : ℕ -- common divisors isCD : ℕ → ℕ → ℕ → Type₀ isCD m n d = (d ∣ m) × (d ∣ n) isPropIsCD : isProp (isCD m n d) isPropIsCD = isProp× isProp∣ isProp∣ symCD : isCD m n d → isCD n m d symCD (d∣m , d∣n) = (d∣n , d∣m) -- greatest common divisors isGCD : ℕ → ℕ → ℕ → Type₀ isGCD m n d = (isCD m n d) × (∀ d' → isCD m n d' → d' ∣ d) GCD : ℕ → ℕ → Type₀ GCD m n = Σ ℕ (isGCD m n) isPropIsGCD : isProp (isGCD m n d) isPropIsGCD = isProp× isPropIsCD (isPropΠ2 (λ _ _ → isProp∣)) isPropGCD : isProp (GCD m n) isPropGCD (d , dCD , gr) (d' , d'CD , gr') = Σ≡Prop (λ _ → isPropIsGCD) (antisym∣ (gr' d dCD) (gr d' d'CD)) symGCD : isGCD m n d → isGCD n m d symGCD (dCD , gr) = symCD dCD , λ { d' d'CD → gr d' (symCD d'CD) } divsGCD : m ∣ n → isGCD m n m divsGCD p = (∣-refl refl , p) , λ { d (d∣m , _) → d∣m } oneGCD : ∀ m → isGCD m 1 1 oneGCD m = symGCD (divsGCD (∣-oneˡ m)) -- The base case of the Euclidean algorithm zeroGCD : ∀ m → isGCD m 0 m zeroGCD m = divsGCD (∣-zeroʳ m) private lem₁ : prediv d (suc n) → prediv d (m % suc n) → prediv d m lem₁ {d} {n} {m} (c₁ , p₁) (c₂ , p₂) = (q · c₁ + c₂) , p where r = m % suc n; q = n%k≡n[modk] m (suc n) .fst p = (q · c₁ + c₂) · d ≡⟨ sym (·-distribʳ (q · c₁) c₂ d) ⟩ (q · c₁) · d + c₂ · d ≡⟨ cong (_+ c₂ · d) (sym (·-assoc q c₁ d)) ⟩ q · (c₁ · d) + c₂ · d ≡[ i ]⟨ q · (p₁ i) + (p₂ i) ⟩ q · (suc n) + r ≡⟨ n%k≡n[modk] m (suc n) .snd ⟩ m ∎ lem₂ : prediv d (suc n) → prediv d m → prediv d (m % suc n) lem₂ {d} {n} {m} (c₁ , p₁) (c₂ , p₂) = c₂ ∸ q · c₁ , p where r = m % suc n; q = n%k≡n[modk] m (suc n) .fst p = (c₂ ∸ q · c₁) · d ≡⟨ ∸-distribʳ c₂ (q · c₁) d ⟩ c₂ · d ∸ (q · c₁) · d ≡⟨ cong (c₂ · d ∸_) (sym (·-assoc q c₁ d)) ⟩ c₂ · d ∸ q · (c₁ · d) ≡[ i ]⟨ p₂ i ∸ q · (p₁ i) ⟩ m ∸ q · (suc n) ≡⟨ cong (_∸ q · (suc n)) (sym (n%k≡n[modk] m (suc n) .snd)) ⟩ (q · (suc n) + r) ∸ q · (suc n) ≡⟨ cong (_∸ q · (suc n)) (+-comm (q · (suc n)) r) ⟩ (r + q · (suc n)) ∸ q · (suc n) ≡⟨ ∸-cancelʳ r zero (q · (suc n)) ⟩ r ∎ -- The inductive step of the Euclidean algorithm stepGCD : isGCD (suc n) (m % suc n) d → isGCD m (suc n) d fst (stepGCD ((d∣n , d∣m%n) , gr)) = PropTrunc.map2 lem₁ d∣n d∣m%n , d∣n snd (stepGCD ((d∣n , d∣m%n) , gr)) d' (d'∣m , d'∣n) = gr d' (d'∣n , PropTrunc.map2 lem₂ d'∣n d'∣m) -- putting it all together using well-founded induction euclid< : ∀ m n → n < m → GCD m n euclid< = WFI.induction <-wellfounded λ { m rec zero p → m , zeroGCD m ; m rec (suc n) p → let d , dGCD = rec (suc n) p (m % suc n) (n%sk<sk m n) in d , stepGCD dGCD } euclid : ∀ m n → GCD m n euclid m n with n ≟ m ... | lt p = euclid< m n p ... | gt p = Σ.map-snd symGCD (euclid< n m p) ... | eq p = m , divsGCD (∣-refl (sym p)) isContrGCD : ∀ m n → isContr (GCD m n) isContrGCD m n = euclid m n , isPropGCD _ -- the gcd operator on ℕ gcd : ℕ → ℕ → ℕ gcd m n = euclid m n .fst gcdIsGCD : ∀ m n → isGCD m n (gcd m n) gcdIsGCD m n = euclid m n .snd isGCD→gcd≡ : isGCD m n d → gcd m n ≡ d isGCD→gcd≡ dGCD = cong fst (isContrGCD _ _ .snd (_ , dGCD)) gcd≡→isGCD : gcd m n ≡ d → isGCD m n d gcd≡→isGCD p = subst (isGCD _ _) p (gcdIsGCD _ _) -- multiplicative properties of the gcd isCD-cancelʳ : ∀ k → isCD (m · suc k) (n · suc k) (d · suc k) → isCD m n d isCD-cancelʳ k (dk∣mk , dk∣nk) = (∣-cancelʳ k dk∣mk , ∣-cancelʳ k dk∣nk) isCD-multʳ : ∀ k → isCD m n d → isCD (m · k) (n · k) (d · k) isCD-multʳ k (d∣m , d∣n) = (∣-multʳ k d∣m , ∣-multʳ k d∣n) isGCD-cancelʳ : ∀ k → isGCD (m · suc k) (n · suc k) (d · suc k) → isGCD m n d isGCD-cancelʳ {m} {n} {d} k (dCD , gr) = isCD-cancelʳ k dCD , λ d' d'CD → ∣-cancelʳ k (gr (d' · suc k) (isCD-multʳ (suc k) d'CD)) gcd-factorʳ : ∀ m n k → gcd (m · k) (n · k) ≡ gcd m n · k gcd-factorʳ m n zero = (λ i → gcd (0≡m·0 m (~ i)) (0≡m·0 n (~ i))) ∙ 0≡m·0 (gcd m n) gcd-factorʳ m n (suc k) = sym p ∙ cong (_· suc k) (sym q) where k∣gcd : suc k ∣ gcd (m · suc k) (n · suc k) k∣gcd = gcdIsGCD (m · suc k) (n · suc k) .snd (suc k) (∣-right m , ∣-right n) d' = ∣-untrunc k∣gcd .fst p : d' · suc k ≡ gcd (m · suc k) (n · suc k) p = ∣-untrunc k∣gcd .snd d'GCD : isGCD m n d' d'GCD = isGCD-cancelʳ _ (subst (isGCD _ _) (sym p) (gcdIsGCD (m · suc k) (n · suc k))) q : gcd m n ≡ d' q = isGCD→gcd≡ d'GCD -- Q: Can this be proved directly? (i.e. without a transport) isGCD-multʳ : ∀ k → isGCD m n d → isGCD (m · k) (n · k) (d · k) isGCD-multʳ {m} {n} {d} k dGCD = gcd≡→isGCD (gcd-factorʳ m n k ∙ cong (_· k) r) where r : gcd m n ≡ d r = isGCD→gcd≡ dGCD
{ "alphanum_fraction": 0.5252161383, "avg_line_length": 34.2716049383, "ext": "agda", "hexsha": "c5196cf0abe5ed14028d89c715014059ac863565", "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/Data/Nat/GCD.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/Data/Nat/GCD.agda", "max_line_length": 107, "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/Data/Nat/GCD.agda", "max_stars_repo_stars_event_max_datetime": null, "max_stars_repo_stars_event_min_datetime": null, "num_tokens": 2517, "size": 5552 }
{-# OPTIONS --prop --without-K --rewriting #-} module Calf.Types.Bool where open import Calf.Prelude open import Calf.Metalanguage open import Data.Bool public using (Bool; true; false; if_then_else_) bool : tp pos bool = U (meta Bool)
{ "alphanum_fraction": 0.7333333333, "avg_line_length": 20, "ext": "agda", "hexsha": "581307995d4d9804de484679a277db7a1105c718", "lang": "Agda", "max_forks_count": 2, "max_forks_repo_forks_event_max_datetime": "2022-01-29T08:12:01.000Z", "max_forks_repo_forks_event_min_datetime": "2021-10-06T10:28:24.000Z", "max_forks_repo_head_hexsha": "e51606f9ca18d8b4cf9a63c2d6caa2efc5516146", "max_forks_repo_licenses": [ "Apache-2.0" ], "max_forks_repo_name": "jonsterling/agda-calf", "max_forks_repo_path": "src/Calf/Types/Bool.agda", "max_issues_count": null, "max_issues_repo_head_hexsha": "e51606f9ca18d8b4cf9a63c2d6caa2efc5516146", "max_issues_repo_issues_event_max_datetime": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_licenses": [ "Apache-2.0" ], "max_issues_repo_name": "jonsterling/agda-calf", "max_issues_repo_path": "src/Calf/Types/Bool.agda", "max_line_length": 69, "max_stars_count": 29, "max_stars_repo_head_hexsha": "e51606f9ca18d8b4cf9a63c2d6caa2efc5516146", "max_stars_repo_licenses": [ "Apache-2.0" ], "max_stars_repo_name": "jonsterling/agda-calf", "max_stars_repo_path": "src/Calf/Types/Bool.agda", "max_stars_repo_stars_event_max_datetime": "2022-03-22T20:35:11.000Z", "max_stars_repo_stars_event_min_datetime": "2021-07-14T03:18:28.000Z", "num_tokens": 63, "size": 240 }
{-# OPTIONS --safe #-} module MissingDefinition where T : Set -> Set
{ "alphanum_fraction": 0.6571428571, "avg_line_length": 14, "ext": "agda", "hexsha": "0ce46b49d9be468775377e9d5a159066a54ecb17", "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/MissingDefinition.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/MissingDefinition.agda", "max_line_length": 30, "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/MissingDefinition.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": 16, "size": 70 }
{- Cubical Agda with K This file demonstrates the incompatibility of the --cubical and --with-K flags, relying on the well-known incosistency of K with univalence. The --safe flag can be used to prevent accidentally mixing such incompatible flags. -} {-# OPTIONS --with-K #-} module Cubical.WithK where open import Cubical.Data.Equality open import Cubical.Data.Bool open import Cubical.Data.Empty private variable ℓ : Level A : Type ℓ x y : A uip : (prf : x ≡ x) → Path _ prf refl uip refl i = refl transport-uip : (prf : A ≡ A) → Path _ (transportPath (eqToPath prf) x) x transport-uip {x = x} prf = compPath (congPath (λ p → transportPath (eqToPath p) x) (uip prf)) (transportRefl x) transport-not : Path _ (transportPath (eqToPath (pathToEq notEq)) true) false transport-not = congPath (λ a → transportPath a true) (eqToPath-pathToEq notEq) false-true : Path _ false true false-true = compPath (symPath transport-not) (transport-uip (pathToEq notEq)) absurd : (X : Type) → X absurd X = transportPath (congPath sel false-true) true where sel : Bool → Type sel false = Bool sel true = X inconsistency : ⊥ inconsistency = absurd ⊥
{ "alphanum_fraction": 0.709760274, "avg_line_length": 24.3333333333, "ext": "agda", "hexsha": "8adf2905a9a593b453a4ded9500a2babf2a44836", "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/WithK.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/WithK.agda", "max_line_length": 86, "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/WithK.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": 364, "size": 1168 }
module WrongNamedArgument2 where postulate f : {A : Set₁} → A test : Set test = f {B = Set} -- Unsolved meta. -- It is not an error since A could be instantiated to a function type -- accepting hidden argument with name B.
{ "alphanum_fraction": 0.701754386, "avg_line_length": 19, "ext": "agda", "hexsha": "8ff2c85ca3b4b3a6299af02bf9683c17863d1b53", "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/WrongNamedArgument2.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/WrongNamedArgument2.agda", "max_line_length": 70, "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/WrongNamedArgument2.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": 63, "size": 228 }
------------------------------------------------------------------------ -- The Agda standard library -- -- Argument information used in the reflection machinery ------------------------------------------------------------------------ {-# OPTIONS --without-K --safe #-} module Reflection.Argument.Information where open import Data.Product open import Relation.Nullary import Relation.Nullary.Decidable as Dec open import Relation.Nullary.Product using (_×-dec_) open import Relation.Binary open import Relation.Binary.PropositionalEquality open import Reflection.Argument.Relevance as Relevance using (Relevance) open import Reflection.Argument.Visibility as Visibility using (Visibility) ------------------------------------------------------------------------ -- Re-exporting the builtins publically open import Agda.Builtin.Reflection public using (ArgInfo) open ArgInfo public ------------------------------------------------------------------------ -- Operations visibility : ArgInfo → Visibility visibility (arg-info v _) = v relevance : ArgInfo → Relevance relevance (arg-info _ r) = r ------------------------------------------------------------------------ -- Decidable equality arg-info-injective₁ : ∀ {v r v′ r′} → arg-info v r ≡ arg-info v′ r′ → v ≡ v′ arg-info-injective₁ refl = refl arg-info-injective₂ : ∀ {v r v′ r′} → arg-info v r ≡ arg-info v′ r′ → r ≡ r′ arg-info-injective₂ refl = refl arg-info-injective : ∀ {v r v′ r′} → arg-info v r ≡ arg-info v′ r′ → v ≡ v′ × r ≡ r′ arg-info-injective = < arg-info-injective₁ , arg-info-injective₂ > _≟_ : DecidableEquality ArgInfo arg-info v r ≟ arg-info v′ r′ = Dec.map′ (uncurry (cong₂ arg-info)) arg-info-injective (v Visibility.≟ v′ ×-dec r Relevance.≟ r′)
{ "alphanum_fraction": 0.5673678226, "avg_line_length": 33.1886792453, "ext": "agda", "hexsha": "22a0e92ae2a0de22e8cc2d134d9ed93cf56c4127", "lang": "Agda", "max_forks_count": 1, "max_forks_repo_forks_event_max_datetime": "2021-11-04T06:54:45.000Z", "max_forks_repo_forks_event_min_datetime": "2021-11-04T06:54:45.000Z", "max_forks_repo_head_hexsha": "fb380f2e67dcb4a94f353dbaec91624fcb5b8933", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "DreamLinuxer/popl21-artifact", "max_forks_repo_path": "agda-stdlib/src/Reflection/Argument/Information.agda", "max_issues_count": null, "max_issues_repo_head_hexsha": "fb380f2e67dcb4a94f353dbaec91624fcb5b8933", "max_issues_repo_issues_event_max_datetime": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_licenses": [ "MIT" ], "max_issues_repo_name": "DreamLinuxer/popl21-artifact", "max_issues_repo_path": "agda-stdlib/src/Reflection/Argument/Information.agda", "max_line_length": 84, "max_stars_count": 5, "max_stars_repo_head_hexsha": "fb380f2e67dcb4a94f353dbaec91624fcb5b8933", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "DreamLinuxer/popl21-artifact", "max_stars_repo_path": "agda-stdlib/src/Reflection/Argument/Information.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": 395, "size": 1759 }
{-# OPTIONS --rewriting #-} module FFI.Data.Vector where open import Agda.Builtin.Equality using (_≡_) open import Agda.Builtin.Equality.Rewrite using () open import Agda.Builtin.Int using (Int; pos; negsuc) open import Agda.Builtin.Nat using (Nat) open import Agda.Builtin.Bool using (Bool; false; true) open import FFI.Data.HaskellInt using (HaskellInt; haskellIntToInt; intToHaskellInt) open import FFI.Data.Maybe using (Maybe; just; nothing) open import Properties.Equality using (_≢_) {-# FOREIGN GHC import qualified Data.Vector #-} postulate Vector : Set → Set {-# POLARITY Vector ++ #-} {-# COMPILE GHC Vector = type Data.Vector.Vector #-} postulate empty : ∀ {A} → (Vector A) null : ∀ {A} → (Vector A) → Bool unsafeHead : ∀ {A} → (Vector A) → A unsafeTail : ∀ {A} → (Vector A) → (Vector A) length : ∀ {A} → (Vector A) → Nat lookup : ∀ {A} → (Vector A) → Nat → (Maybe A) snoc : ∀ {A} → (Vector A) → A → (Vector A) {-# COMPILE GHC empty = \_ -> Data.Vector.empty #-} {-# COMPILE GHC null = \_ -> Data.Vector.null #-} {-# COMPILE GHC unsafeHead = \_ -> Data.Vector.unsafeHead #-} {-# COMPILE GHC unsafeTail = \_ -> Data.Vector.unsafeTail #-} {-# COMPILE GHC length = \_ -> (fromIntegral . Data.Vector.length) #-} {-# COMPILE GHC lookup = \_ v -> ((v Data.Vector.!?) . fromIntegral) #-} {-# COMPILE GHC snoc = \_ -> Data.Vector.snoc #-} postulate length-empty : ∀ {A} → (length (empty {A}) ≡ 0) postulate lookup-empty : ∀ {A} n → (lookup (empty {A}) n ≡ nothing) postulate lookup-snoc : ∀ {A} (x : A) (v : Vector A) → (lookup (snoc v x) (length v) ≡ just x) postulate lookup-length : ∀ {A} (v : Vector A) → (lookup v (length v) ≡ nothing) postulate lookup-snoc-empty : ∀ {A} (x : A) → (lookup (snoc empty x) 0 ≡ just x) postulate lookup-snoc-not : ∀ {A n} (x : A) (v : Vector A) → (n ≢ length v) → (lookup v n ≡ lookup (snoc v x) n) {-# REWRITE length-empty lookup-snoc lookup-length lookup-snoc-empty lookup-empty #-} head : ∀ {A} → (Vector A) → (Maybe A) head vec with null vec head vec | false = just (unsafeHead vec) head vec | true = nothing tail : ∀ {A} → (Vector A) → Vector A tail vec with null vec tail vec | false = unsafeTail vec tail vec | true = empty
{ "alphanum_fraction": 0.6420428637, "avg_line_length": 40.6111111111, "ext": "agda", "hexsha": "08761edf850acead13e94ec0267acfdd5676b3fa", "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": "362428f8b4b6f5c9d43f4daf55bcf7873f536c3f", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "XanderYZZ/luau", "max_forks_repo_path": "prototyping/FFI/Data/Vector.agda", "max_issues_count": null, "max_issues_repo_head_hexsha": "362428f8b4b6f5c9d43f4daf55bcf7873f536c3f", "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": "XanderYZZ/luau", "max_issues_repo_path": "prototyping/FFI/Data/Vector.agda", "max_line_length": 112, "max_stars_count": 1, "max_stars_repo_head_hexsha": "72d8d443431875607fd457a13fe36ea62804d327", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "TheGreatSageEqualToHeaven/luau", "max_stars_repo_path": "prototyping/FFI/Data/Vector.agda", "max_stars_repo_stars_event_max_datetime": "2021-12-05T21:53:03.000Z", "max_stars_repo_stars_event_min_datetime": "2021-12-05T21:53:03.000Z", "num_tokens": 682, "size": 2193 }
open import Function using (_∘_) open import Category.Functor open import Category.Monad open import Data.Empty using (⊥; ⊥-elim) open import Data.Fin as Fin using (Fin; zero; suc) open import Data.Fin.Props as FinProps using () open import Data.Maybe as Maybe using (Maybe; maybe; just; nothing) open import Data.Nat using (ℕ; zero; suc) open import Data.Product using (Σ; ∃; _,_; proj₁; proj₂) renaming (_×_ to _∧_) open import Data.Sum using (_⊎_; inj₁; inj₂; [_,_]) open import Data.Vec as Vec using (Vec; []; _∷_; head; tail) open import Data.Vec.Equality as VecEq open import Relation.Nullary using (Dec; yes; no; ¬_) open import Relation.Binary open import Relation.Binary.PropositionalEquality as PropEq using (_≡_; _≢_; refl; sym; trans; cong; cong₂; inspect; Reveal_is_; [_]) module Unification.Correctness (Symbol : ℕ -> Set) (decEqSym : ∀ {k} (f g : Symbol k) → Dec (f ≡ g)) where open import Unification Symbol decEqSym open RawFunctor {{...}} open DecSetoid {{...}} using (_≟_) private maybeFunctor = Maybe.functor private finDecSetoid : ∀ {n} → DecSetoid _ _ finDecSetoid {n} = FinProps.decSetoid n -- * proving correctness of replacement function mutual -- | proof that var is the identity of replace replace-thm₁ : ∀ {n} (t : Term n) → replace var t ≡ t replace-thm₁ (var x) = refl replace-thm₁ (con s ts) = cong (con s) (replaceChildren-thm₁ ts) -- | proof that var is the identity of replaceChildren replaceChildren-thm₁ : ∀ {n k} (ts : Vec (Term n) k) → replaceChildren var ts ≡ ts replaceChildren-thm₁ [] = refl replaceChildren-thm₁ (t ∷ ts) rewrite replace-thm₁ t = cong (_∷_ _) (replaceChildren-thm₁ ts) -- * proving correctness of substitution/replacement composition -- | proof that `var ∘ _` is the identity of ◇ compose-thm₁ : ∀ {m n l} (f : Fin m → Term n) (r : Fin l → Fin m) (t : Term l) → f ◇ (var ∘ r) ≡ f ∘ r compose-thm₁ f r t = refl mutual -- | proof that _◇_ behaves as composition of replacements compose-thm₂ : ∀ {m n l} (f : Fin m → Term n) (g : Fin l → Term m) (t : Term l) → replace (f ◇ g) t ≡ replace f (replace g t) compose-thm₂ f g (var x) = refl compose-thm₂ f g (con s ts) = cong (con s) (composeChildren-thm₂ f g ts) -- | proof that _◇_ behaves as composition of replacements composeChildren-thm₂ : ∀ {m n l k} (f : Fin m → Term n) (g : Fin l → Term m) (ts : Vec (Term l) k) → replaceChildren (f ◇ g) ts ≡ replaceChildren f (replaceChildren g ts) composeChildren-thm₂ f g [] = refl composeChildren-thm₂ f g (t ∷ ts) rewrite compose-thm₂ f g t = cong (_∷_ _) (composeChildren-thm₂ f g ts) -- * proving correctness of thick and thin -- | predecessor function over finite numbers pred : ∀ {n} → Fin (suc (suc n)) → Fin (suc n) pred zero = zero pred (suc x) = x -- | proof of injectivity of thin thin-injective : ∀ {n} (x : Fin (suc n)) (y z : Fin n) → thin x y ≡ thin x z → y ≡ z thin-injective {zero} zero () _ _ thin-injective {zero} (suc _) () _ _ thin-injective {suc _} zero zero zero refl = refl thin-injective {suc _} zero zero (suc _) () thin-injective {suc _} zero (suc _) zero () thin-injective {suc _} zero (suc y) (suc .y) refl = refl thin-injective {suc _} (suc _) zero zero refl = refl thin-injective {suc _} (suc _) zero (suc _) () thin-injective {suc _} (suc _) (suc _) zero () thin-injective {suc n} (suc x) (suc y) (suc z) p = cong suc (thin-injective x y z (cong pred p)) -- | proof that thin x will never map anything to x thinxy≢x : ∀ {n} (x : Fin (suc n)) (y : Fin n) → thin x y ≢ x thinxy≢x zero zero () thinxy≢x zero (suc _) () thinxy≢x (suc _) zero () thinxy≢x (suc x) (suc y) p = thinxy≢x x y (cong pred p) -- | proof that `thin x` reaches all y where x ≢ y x≢y→thinxz≡y : ∀ {n} (x y : Fin (suc n)) → x ≢ y → ∃ (λ z → thin x z ≡ y) x≢y→thinxz≡y zero zero 0≢0 with 0≢0 refl x≢y→thinxz≡y zero zero 0≢0 | () x≢y→thinxz≡y {zero} (suc ()) _ _ x≢y→thinxz≡y {zero} zero (suc ()) _ x≢y→thinxz≡y {suc _} zero (suc y) _ = y , refl x≢y→thinxz≡y {suc _} (suc x) zero _ = zero , refl x≢y→thinxz≡y {suc _} (suc x) (suc y) sx≢sy = (suc (proj₁ prf)) , (lem x y (proj₁ prf) (proj₂ prf)) where x≢y = sx≢sy ∘ cong suc prf = x≢y→thinxz≡y x y x≢y lem : ∀ {n} (x y : Fin (suc n)) (z : Fin n) → thin x z ≡ y → thin (suc x) (suc z) ≡ suc y lem zero zero _ () lem zero (suc .z) z refl = refl lem (suc _) zero zero refl = refl lem (suc _) zero (suc _) () lem (suc _) (suc _) zero () lem (suc x) (suc .(thin x z)) (suc z) refl = refl -- | proof that thick x composed with thin x is the identity thickx∘thinx≡yes : ∀ {n} (x : Fin (suc n)) (y : Fin n) → thick x (thin x y) ≡ just y thickx∘thinx≡yes zero zero = refl thickx∘thinx≡yes zero (suc _) = refl thickx∘thinx≡yes (suc _) zero = refl thickx∘thinx≡yes (suc x) (suc y) = cong (_<$>_ suc) (thickx∘thinx≡yes x y) -- | proof that `thin` is a partial inverse of `thick` thin≡thick⁻¹ : ∀ {n} (x : Fin (suc n)) (y : Fin n) (z : Fin (suc n)) → thin x y ≡ z → thick x z ≡ just y thin≡thick⁻¹ x y z p with p thin≡thick⁻¹ x y .(thin x y) _ | refl = thickx∘thinx≡yes x y -- | proof that `thick x x` returns nothing thickxx≡no : ∀ {n} (x : Fin (suc n)) → thick x x ≡ nothing thickxx≡no zero = refl thickxx≡no {zero} (suc ()) thickxx≡no {suc n} (suc x) = cong (maybe (λ x → just (suc x)) nothing) (thickxx≡no x) -- | proof that `thick x y` returns something when x ≢ y x≢y→thickxy≡yes : ∀ {n} (x y : Fin (suc n)) → x ≢ y → ∃ (λ z → thick x y ≡ just z) x≢y→thickxy≡yes zero zero 0≢0 with 0≢0 refl x≢y→thickxy≡yes zero zero 0≢0 | () x≢y→thickxy≡yes zero (suc y) p = y , refl x≢y→thickxy≡yes {zero} (suc ()) _ _ x≢y→thickxy≡yes {suc n} (suc x) zero _ = zero , refl x≢y→thickxy≡yes {suc n} (suc x) (suc y) sx≢sy = (suc (proj₁ prf)) , (cong (_<$>_ suc) (proj₂ prf)) where x≢y = sx≢sy ∘ cong suc prf = x≢y→thickxy≡yes {n} x y x≢y -- | proof that `thick` is the partial inverse of `thin` thick≡thin⁻¹ : ∀ {n} (x y : Fin (suc n)) (r : Maybe (Fin n)) → thick x y ≡ r → x ≡ y ∧ r ≡ nothing ⊎ ∃ (λ z → thin x z ≡ y ∧ r ≡ just z) thick≡thin⁻¹ x y _ thickxy≡r with x ≟ y | thickxy≡r thick≡thin⁻¹ x .x .(thick x x) _ | yes refl | refl = inj₁ (refl , thickxx≡no x) thick≡thin⁻¹ x y .(thick x y) _ | no x≢y | refl = inj₂ (proj₁ prf₁ , (proj₂ prf₁) , prf₂) where prf₁ = x≢y→thinxz≡y x y x≢y prf₂ = thin≡thick⁻¹ x (proj₁ prf₁) y (proj₂ prf₁) -- | proof that if check returns nothing, checkChildren will too check≡no→checkChildren≡no : ∀ {n} (x : Fin (suc n)) (s : Symbol (suc n)) (ts : Vec (Term (suc n)) (suc n)) → check x (con s ts) ≡ nothing → checkChildren x ts ≡ nothing check≡no→checkChildren≡no x s ts p with checkChildren x ts check≡no→checkChildren≡no x s ts p | nothing = refl check≡no→checkChildren≡no x s ts () | just _ -- | proof that if check returns something, checkChildren will too check≡yes→checkChildren≡yes : ∀ {n} (x : Fin (suc n)) (s : Symbol (suc n)) (ts : Vec (Term (suc n)) (suc n)) (ts' : Vec (Term n) (suc n)) → check x (con s ts) ≡ just (con s ts') → checkChildren x ts ≡ just ts' check≡yes→checkChildren≡yes x s ts ts' p with checkChildren x ts check≡yes→checkChildren≡yes x s ts ts' refl | just .ts' = refl check≡yes→checkChildren≡yes x s ts ts' () | nothing -- | occurs predicate that is only inhabited if x occurs in t mutual data Occurs {n : ℕ} (x : Fin n) : Term n → Set where Here : Occurs x (var x) Further : ∀ {k ts} {s : Symbol k} → OccursChildren x {k} ts → Occurs x (con s ts) data OccursChildren {n : ℕ} (x : Fin n) : {k : ℕ} → Vec (Term n) k → Set where Here : ∀ {k t ts} → Occurs x t → OccursChildren x {suc k} (t ∷ ts) Further : ∀ {k t ts} → OccursChildren x {k} ts → OccursChildren x {suc k} (t ∷ ts) -- | proof of decidability for the occurs predicate mutual occurs? : ∀ {n} (x : Fin n) (t : Term n) → Dec (Occurs x t) occurs? x₁ (var x₂) with x₁ ≟ x₂ occurs? .x₂ (var x₂) | yes refl = yes Here occurs? x₁ (var x₂) | no x₁≢x₂ = no (x₁≢x₂ ∘ lem x₁ x₂) where lem : ∀ {n} (x y : Fin n) → Occurs x (var y) → x ≡ y lem zero zero _ = refl lem zero (suc _) () lem (suc x) zero () lem (suc x) (suc .x) Here = refl occurs? x₁ (con s ts) with occursChildren? x₁ ts occurs? x₁ (con s ts) | yes x₁∈ts = yes (Further x₁∈ts) occurs? x₁ (con s ts) | no x₁∉ts = no (x₁∉ts ∘ lem x₁) where lem : ∀ {n s ts} (x : Fin n) → Occurs x (con s ts) → OccursChildren x ts lem x (Further x₂) = x₂ occursChildren? : ∀ {n k} (x : Fin n) (ts : Vec (Term n) k) → Dec (OccursChildren x ts) occursChildren? x₁ [] = no (λ ()) occursChildren? x₁ (t ∷ ts) with occurs? x₁ t occursChildren? x₁ (t ∷ ts) | yes h = yes (Here h) occursChildren? x₁ (t ∷ ts) | no ¬h with occursChildren? x₁ ts occursChildren? x₁ (t ∷ ts) | no ¬h | yes f = yes (Further f) occursChildren? x₁ (t ∷ ts) | no ¬h | no ¬f = no lem where lem : OccursChildren x₁ (t ∷ ts) → ⊥ lem (Here p) = ¬h p lem (Further p) = ¬f p -- * proving correctness of check mutual -- | proving that if x occurs in t, check returns nothing occurs→check≡no : ∀ {n} (x : Fin (suc n)) (t : Term (suc n)) → Occurs x t → check x t ≡ nothing occurs→check≡no x .(Unification.var x) Here rewrite thickxx≡no x = refl occurs→check≡no x .(Unification.con s ts) (Further {k} {ts} {s} p) rewrite occursChildren→checkChildren≡no x ts p = refl -- | proving that if x occurs in ts, checkChildren returns nothing occursChildren→checkChildren≡no : ∀ {n k} (x : Fin (suc n)) (ts : Vec (Term (suc n)) k) → OccursChildren x ts → checkChildren x ts ≡ nothing occursChildren→checkChildren≡no x .(t ∷ ts) (Here {k} {t} {ts} p) rewrite occurs→check≡no x t p = refl occursChildren→checkChildren≡no x .(t ∷ ts) (Further {k} {t} {ts} p) with check x t ... | just _ rewrite occursChildren→checkChildren≡no x ts p = refl ... | nothing rewrite occursChildren→checkChildren≡no x ts p = refl mutual -- | proof that if check x t returns nothing, x occurs in t check≡no→occurs : ∀ {n} (x : Fin (suc n)) (t : Term (suc n)) → check x t ≡ nothing → Occurs x t check≡no→occurs x₁ (var x₂) p with x₁ ≟ x₂ check≡no→occurs .x₂ (var x₂) p | yes refl = Here check≡no→occurs x₁ (var x₂) p | no x₁≢x₂ = ⊥-elim (lem₂ p) where lem₁ : ∃ (λ z → thick x₁ x₂ ≡ just z) lem₁ = x≢y→thickxy≡yes x₁ x₂ x₁≢x₂ lem₂ : var <$> thick x₁ x₂ ≡ nothing → ⊥ lem₂ rewrite proj₂ lem₁ = λ () check≡no→occurs {n} x₁ (con s ts) p = Further (checkChildren≡no→occursChildren x₁ ts (lem p)) where lem : con s <$> checkChildren x₁ ts ≡ nothing → checkChildren x₁ ts ≡ nothing lem p with checkChildren x₁ ts | inspect (checkChildren x₁) ts lem () | just _ | [ eq ] lem p | nothing | [ eq ] = refl -- | proof that if checkChildren x ts returns nothing, x occurs in ts checkChildren≡no→occursChildren : ∀ {n k} (x : Fin (suc n)) (ts : Vec (Term (suc n)) k) → checkChildren x ts ≡ nothing → OccursChildren x ts checkChildren≡no→occursChildren x [] () checkChildren≡no→occursChildren x (t ∷ ts) p with check x t | inspect (check x) t ... | nothing | [ e₁ ] = Here (check≡no→occurs x t e₁) ... | just _ | [ e₁ ] with checkChildren x ts | inspect (checkChildren x) ts ... | nothing | [ e₂ ] = Further (checkChildren≡no→occursChildren x ts e₂) checkChildren≡no→occursChildren x (t ∷ ts) () | just _ | [ e₁ ] | just _ | [ e₂ ] -- | proof that if check returns just, x does not occur in t check≡yes→¬occurs : ∀ {n} (x : Fin (suc n)) (t : Term (suc n)) (t' : Term n) → check x t ≡ just t' → ¬ (Occurs x t) check≡yes→¬occurs x t t' p₁ x∈t with occurs→check≡no x t x∈t check≡yes→¬occurs x t t' p₁ _ | p₂ with check x t check≡yes→¬occurs x t t' p₁ _ | () | just _ check≡yes→¬occurs x t t' () _ | p₂ | nothing -- | proof that x does not occur in t, check returns just ¬occurs→check≡yes : ∀ {n} (x : Fin (suc n)) (t : Term (suc n)) → ¬ (Occurs x t) → ∃ (λ t' → check x t ≡ just t') ¬occurs→check≡yes x t x∉t with check x t | inspect (check x) t ¬occurs→check≡yes x t x∉t | nothing | [ eq ] with x∉t (check≡no→occurs x t eq) ¬occurs→check≡yes x t x∉t | nothing | [ eq ] | () ¬occurs→check≡yes x t x∉t | just t' | [ eq ] = t' , refl -- * proving correctness of _for_ -- | proof that if there is nothing to unify, _for_ is the identity for-thm₁ : ∀ {n} (t : Term n) (x : Fin (suc n)) (y : Fin n) → (t for x) (thin x y) ≡ var y for-thm₁ t x y rewrite thickx∘thinx≡yes x y = refl mutual -- | proof that if there is something to unify, _for_ unifies for-thm₂ : ∀ {n} (x : Fin (suc n)) (t : Term (suc n)) (t' : Term n) → check x t ≡ just t' → replace (t' for x) t ≡ (t' for x) x for-thm₂ x (var y) _ _ with x ≟ y for-thm₂ .y (var y) _ _ | yes refl = refl for-thm₂ x (var y) _ _ | no x≢y with thick x y | x≢y→thickxy≡yes x y x≢y | thick x x | thickxx≡no x for-thm₂ x (var y) .(var z) refl | no _ | .(just z) | z , refl | .nothing | refl = refl for-thm₂ x (con s ts) _ _ with checkChildren x ts | inspect (checkChildren x) ts for-thm₂ x (con s ts) _ () | nothing | _ for-thm₂ x (con s ts) .(con s ts') refl | just ts' | [ checkChildren≡yes ] rewrite thickxx≡no x = cong (con s) (forChildren-thm₂ x s ts ts' checkChildren≡yes) forChildren-thm₂ : ∀ {n k} -> (x : Fin (suc n)) (s : Symbol k) (ts : Vec (Term (suc n)) k) (ts' : Vec (Term n) k) -> checkChildren x ts ≡ just ts' -> replaceChildren (con s ts' for x) ts ≡ ts' forChildren-thm₂ x s [] [] eq rewrite thickxx≡no x = refl forChildren-thm₂ x s (t1 ∷ ts) (t2 ∷ ts') eq with check x t1 | inspect (check x) t1 | checkChildren x ts | inspect (checkChildren x) ts forChildren-thm₂ x s (t1 ∷ ts) (t2 ∷ ts') refl | just .t2 | [ eq1 ] | just .ts' | [ eq2 ] = cong₂ _∷_ {!!} {!!} where lemma₁ = for-thm₂ x t1 t2 eq1 forChildren-thm₂ x s (t1 ∷ ts) (t2 ∷ ts') () | just x₁ | _ | nothing | _ forChildren-thm₂ x s (t1 ∷ ts) (t2 ∷ ts') () | nothing | _ | cs | _ -- * proving correctness of apply, concat and compose ++-thm₁ : ∀ {m n} (s : Subst m n) → nil ++ s ≡ s ++-thm₁ nil = refl ++-thm₁ (snoc s t x) = cong (λ s → snoc s t x) (++-thm₁ s) mutual replace-var-id : ∀ {m} (t : Term m) -> replace var t ≡ t replace-var-id (Unification.var x) = refl replace-var-id (Unification.con s ts) = cong (con s) (replaceChildren-var-id ts) replaceChildren-var-id : ∀ {m n} -> (ts : Vec (Term m) n) -> replaceChildren var ts ≡ ts replaceChildren-var-id [] = refl replaceChildren-var-id (x ∷ ts) = cong₂ _∷_ (replace-var-id x) (replaceChildren-var-id ts) mutual replace-var-id' : ∀ {n m} (f : Fin n -> Term m) (t : Term n) -> replace (\x -> replace var (f x)) t ≡ replace f t replace-var-id' f (Unification.var x) = replace-var-id (f x) replace-var-id' f (Unification.con s ts) = cong (con s) (replaceChildren-var-id' f ts) replaceChildren-var-id' : ∀ {m n k} -> (f : Fin m -> Term k) (ts : Vec (Term m) n) -> replaceChildren (\x -> replace var (f x)) ts ‌≡ replaceChildren f ts replaceChildren-var-id' f [] = refl replaceChildren-var-id' f (x ∷ ts) = cong₂ _∷_ (replace-var-id' f x) (replaceChildren-var-id' f ts) ++-lem₁ : ∀ {m n} (s : Subst m n) (t : Term (suc m)) (t' : Term m) (x : Fin (suc m)) -> replace (apply s) (replace (t' for x) t) ≡ replace (\x' -> replace (apply s) (_for_ t' x x')) t ++-lem₁ Unification.nil t t' x rewrite replace-var-id (replace (t' for x) t) | replace-var-id' (t' for x) t = refl ++-lem₁ (Unification.snoc s t x) t₁ t' x₁ = {!!} ++-lem₂ : ∀ {l m n} (s₁ : Subst m n) (s₂ : Subst l m) (t : Term l) → replace (apply (s₁ ++ s₂)) t ≡ replace (apply s₁) (replace (apply s₂) t) ++-lem₂ s₁ nil t rewrite replace-thm₁ t = refl ++-lem₂ {.(suc k)} {m} {n} s₁ (snoc {k} s₂ t₂ x) t = {!!} where lem = ++-lem₂ s₁ s₂ (replace (t₂ for x) t) ++-thm₂ : ∀ {l m n} (s₁ : Subst m n) (s₂ : Subst l m) (x : Fin l) → apply (s₁ ++ s₂) x ≡ (apply s₁ ◇ apply s₂) x ++-thm₂ s₁ nil x = refl ++-thm₂ s₁ (snoc s₂ t y) x with thick y x ++-thm₂ s₁ (snoc s₂ t y) x | just t' = ++-thm₂ s₁ s₂ t' ++-thm₂ s₁ (snoc s₂ t y) x | nothing = ++-lem₂ s₁ s₂ t
{ "alphanum_fraction": 0.5723645724, "avg_line_length": 42.6284289277, "ext": "agda", "hexsha": "878f11eae9166ecb4d9601d9c99ab02eb58e8674", "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": "5fc229e7eb6925dd3ea8e5d8e8bfbff4500c5614", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "wenkokke/FirstOrderUnificationInAgda", "max_forks_repo_path": "Unification/Correctness.agda", "max_issues_count": null, "max_issues_repo_head_hexsha": "5fc229e7eb6925dd3ea8e5d8e8bfbff4500c5614", "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": "wenkokke/FirstOrderUnificationInAgda", "max_issues_repo_path": "Unification/Correctness.agda", "max_line_length": 133, "max_stars_count": 3, "max_stars_repo_head_hexsha": "5fc229e7eb6925dd3ea8e5d8e8bfbff4500c5614", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "wenkokke/FirstOrderUnificationInAgda", "max_stars_repo_path": "Unification/Correctness.agda", "max_stars_repo_stars_event_max_datetime": "2020-07-06T21:58:31.000Z", "max_stars_repo_stars_event_min_datetime": "2017-07-27T22:15:32.000Z", "num_tokens": 6675, "size": 17094 }
{-# OPTIONS --safe --experimental-lossy-unification #-} module Cubical.ZCohomology.RingStructure.GradedCommutativity where open import Cubical.Foundations.HLevels open import Cubical.Foundations.Function open import Cubical.Foundations.Transport open import Cubical.Foundations.Prelude open import Cubical.Foundations.Isomorphism open import Cubical.Foundations.Pointed open import Cubical.Foundations.Pointed.Homogeneous open import Cubical.Foundations.GroupoidLaws hiding (assoc) open import Cubical.Foundations.Path open import Cubical.Data.Empty as ⊥ open import Cubical.Data.Nat open import Cubical.Data.Int renaming (_+_ to _ℤ+_ ; _·_ to _ℤ∙_ ; +Comm to +ℤ-comm ; ·Comm to ∙-comm ; +Assoc to ℤ+-assoc ; -_ to -ℤ_) hiding (_+'_ ; +'≡+) open import Cubical.Data.Sigma open import Cubical.Data.Sum open import Cubical.HITs.SetTruncation as ST open import Cubical.HITs.Truncation as T open import Cubical.HITs.S1 hiding (_·_) open import Cubical.HITs.Sn open import Cubical.HITs.Susp open import Cubical.Homotopy.Loopspace 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.Properties private variable ℓ : Level open PlusBis natTranspLem : ∀ {ℓ} {A B : ℕ → Type ℓ} {n m : ℕ} (a : A n) (f : (n : ℕ) → (a : A n) → B n) (p : n ≡ m) → f m (subst A p a) ≡ subst B p (f n a) natTranspLem {A = A} {B = B} a f p = sym (substCommSlice A B f p a) transp0₁ : (n : ℕ) → subst coHomK (+'-comm 1 (suc n)) (0ₖ _) ≡ 0ₖ _ transp0₁ zero = refl transp0₁ (suc n) = refl transp0₂ : (n m : ℕ) → subst coHomK (+'-comm (suc (suc n)) (suc m)) (0ₖ _) ≡ 0ₖ _ transp0₂ n zero = refl transp0₂ n (suc m) = refl -- Recurring expressions private ΩKn+1→Ω²Kn+2 : {k : ℕ} → typ (Ω (coHomK-ptd k)) → typ ((Ω^ 2) (coHomK-ptd (suc k))) ΩKn+1→Ω²Kn+2 x = sym (Kn→ΩKn+10ₖ _) ∙∙ cong (Kn→ΩKn+1 _) x ∙∙ Kn→ΩKn+10ₖ _ ΩKn+1→Ω²Kn+2' : {k : ℕ} → Kn→ΩKn+1 k (0ₖ k) ≡ Kn→ΩKn+1 k (0ₖ k) → typ ((Ω^ 2) (coHomK-ptd (suc k))) ΩKn+1→Ω²Kn+2' p = sym (Kn→ΩKn+10ₖ _) ∙∙ p ∙∙ Kn→ΩKn+10ₖ _ Kn→Ω²Kn+2 : {k : ℕ} → coHomK k → typ ((Ω^ 2) (coHomK-ptd (2 + k))) Kn→Ω²Kn+2 x = ΩKn+1→Ω²Kn+2 (Kn→ΩKn+1 _ x) -- Definition of of -ₖ'ⁿ̇*ᵐ -- This definition is introduced to facilite the proofs -ₖ'-helper : {k : ℕ} (n m : ℕ) → isEvenT n ⊎ isOddT n → isEvenT m ⊎ isOddT m → coHomKType k → coHomKType k -ₖ'-helper {k = zero} n m (inl x₁) q x = x -ₖ'-helper {k = zero} n m (inr x₁) (inl x₂) x = x -ₖ'-helper {k = zero} n m (inr x₁) (inr x₂) x = 0 - x -ₖ'-helper {k = suc zero} n m p q base = base -ₖ'-helper {k = suc zero} n m (inl x) q (loop i) = loop i -ₖ'-helper {k = suc zero} n m (inr x) (inl x₁) (loop i) = loop i -ₖ'-helper {k = suc zero} n m (inr x) (inr x₁) (loop i) = loop (~ i) -ₖ'-helper {k = suc (suc k)} n m p q north = north -ₖ'-helper {k = suc (suc k)} n m p q south = north -ₖ'-helper {k = suc (suc k)} n m (inl x) q (merid a i) = (merid a ∙ sym (merid (ptSn (suc k)))) i -ₖ'-helper {k = suc (suc k)} n m (inr x) (inl x₁) (merid a i) = (merid a ∙ sym (merid (ptSn (suc k)))) i -ₖ'-helper {k = suc (suc k)} n m (inr x) (inr x₁) (merid a i) = (merid a ∙ sym (merid (ptSn (suc k)))) (~ i) -ₖ'-gen : {k : ℕ} (n m : ℕ) (p : isEvenT n ⊎ isOddT n) (q : isEvenT m ⊎ isOddT m) → coHomK k → coHomK k -ₖ'-gen {k = zero} = -ₖ'-helper {k = zero} -ₖ'-gen {k = suc k} n m p q = T.map (-ₖ'-helper {k = suc k} n m p q) -- -ₖ'ⁿ̇*ᵐ -ₖ'^_·_ : {k : ℕ} (n m : ℕ) → coHomK k → coHomK k -ₖ'^_·_ {k = k} n m = -ₖ'-gen n m (evenOrOdd n) (evenOrOdd m) -- cohomology version -ₕ'^_·_ : {k : ℕ} {A : Type ℓ} (n m : ℕ) → coHom k A → coHom k A -ₕ'^_·_ n m = ST.map λ f x → (-ₖ'^ n · m) (f x) -- -ₖ'ⁿ̇*ᵐ = -ₖ' for n m odd -ₖ'-gen-inr≡-ₖ' : {k : ℕ} (n m : ℕ) (p : _) (q : _) (x : coHomK k) → -ₖ'-gen n m (inr p) (inr q) x ≡ (-ₖ x) -ₖ'-gen-inr≡-ₖ' {k = zero} n m p q _ = refl -ₖ'-gen-inr≡-ₖ' {k = suc zero} n m p q = T.elim ((λ _ → isOfHLevelTruncPath)) λ { base → refl ; (loop i) → refl} -ₖ'-gen-inr≡-ₖ' {k = suc (suc k)} n m p q = T.elim ((λ _ → isOfHLevelTruncPath)) λ { north → refl ; south → refl ; (merid a i) k → ∣ symDistr (merid (ptSn _)) (sym (merid a)) (~ k) (~ i) ∣ₕ} -- -ₖ'ⁿ̇*ᵐ x = x for n even -ₖ'-gen-inl-left : {k : ℕ} (n m : ℕ) (p : _) (q : _) (x : coHomK k) → -ₖ'-gen n m (inl p) q x ≡ x -ₖ'-gen-inl-left {k = zero} n m p q x = refl -ₖ'-gen-inl-left {k = suc zero} n m p q = T.elim (λ _ → isOfHLevelTruncPath) λ { base → refl ; (loop i) → refl} -ₖ'-gen-inl-left {k = suc (suc k)} n m p q = T.elim (λ _ → isOfHLevelPath (4 + k) (isOfHLevelTrunc (4 + k)) _ _) λ { north → refl ; south → cong ∣_∣ₕ (merid (ptSn _)) ; (merid a i) k → ∣ compPath-filler (merid a) (sym (merid (ptSn _))) (~ k) i ∣ₕ} -- -ₖ'ⁿ̇*ᵐ x = x for m even -ₖ'-gen-inl-right : {k : ℕ} (n m : ℕ) (p : _) (q : _) (x : coHomK k) → -ₖ'-gen n m p (inl q) x ≡ x -ₖ'-gen-inl-right {k = zero} n m (inl x₁) q x = refl -ₖ'-gen-inl-right {k = zero} n m (inr x₁) q x = refl -ₖ'-gen-inl-right {k = suc zero} n m (inl x₁) q = T.elim (λ _ → isOfHLevelTruncPath) λ { base → refl ; (loop i) → refl} -ₖ'-gen-inl-right {k = suc zero} n m (inr x₁) q = T.elim (λ _ → isOfHLevelTruncPath) λ { base → refl ; (loop i) → refl} -ₖ'-gen-inl-right {k = suc (suc k)} n m (inl x₁) q = T.elim (λ _ → isOfHLevelTruncPath) λ { north → refl ; south → cong ∣_∣ₕ (merid (ptSn _)) ; (merid a i) k → ∣ compPath-filler (merid a) (sym (merid (ptSn _))) (~ k) i ∣ₕ} -ₖ'-gen-inl-right {k = suc (suc k)} n m (inr x₁) q = T.elim (λ _ → isOfHLevelTruncPath) λ { north → refl ; south → cong ∣_∣ₕ (merid (ptSn _)) ; (merid a i) k → ∣ compPath-filler (merid a) (sym (merid (ptSn _))) (~ k) i ∣ₕ} -ₖ'-gen² : {k : ℕ} (n m : ℕ) (p : isEvenT n ⊎ isOddT n) (q : isEvenT m ⊎ isOddT m) → (x : coHomK k) → -ₖ'-gen n m p q (-ₖ'-gen n m p q x) ≡ x -ₖ'-gen² {k = zero} n m (inl x₁) q x = refl -ₖ'-gen² {k = zero} n m (inr x₁) (inl x₂) x = refl -ₖ'-gen² {k = zero} n m (inr x₁) (inr x₂) x = cong (pos 0 -_) (-AntiComm (pos 0) x) ∙∙ -AntiComm (pos 0) (-ℤ (x - pos 0)) ∙∙ h x where h : (x : _) → -ℤ (-ℤ (x - pos 0) - pos 0) ≡ x h (pos zero) = refl h (pos (suc n)) = refl h (negsuc n) = refl -ₖ'-gen² {k = suc k} n m (inl x₁) q x i = -ₖ'-gen-inl-left n m x₁ q (-ₖ'-gen-inl-left n m x₁ q x i) i -ₖ'-gen² {k = suc k} n m (inr x₁) (inl x₂) x i = -ₖ'-gen-inl-right n m (inr x₁) x₂ (-ₖ'-gen-inl-right n m (inr x₁) x₂ x i) i -ₖ'-gen² {k = suc k} n m (inr x₁) (inr x₂) x = (λ i → -ₖ'-gen-inr≡-ₖ' n m x₁ x₂ (-ₖ'-gen-inr≡-ₖ' n m x₁ x₂ x i) i) ∙ -ₖ^2 x -ₖ'-genIso : {k : ℕ} (n m : ℕ) (p : isEvenT n ⊎ isOddT n) (q : isEvenT m ⊎ isOddT m) → Iso (coHomK k) (coHomK k) Iso.fun (-ₖ'-genIso {k = k} n m p q) = -ₖ'-gen n m p q Iso.inv (-ₖ'-genIso {k = k} n m p q) = -ₖ'-gen n m p q Iso.rightInv (-ₖ'-genIso {k = k} n m p q) = -ₖ'-gen² n m p q Iso.leftInv (-ₖ'-genIso {k = k} n m p q) = -ₖ'-gen² n m p q -- action of cong on -ₖ'ⁿ̇*ᵐ cong-ₖ'-gen-inr : {k : ℕ} (n m : ℕ) (p : _) (q : _) (P : Path (coHomK (2 + k)) (0ₖ _) (0ₖ _)) → cong (-ₖ'-gen n m (inr p) (inr q)) P ≡ sym P cong-ₖ'-gen-inr {k = k} n m p q P = code≡sym (0ₖ _) P where code : (x : coHomK (2 + k)) → 0ₖ _ ≡ x → x ≡ 0ₖ _ code = T.elim (λ _ → isOfHLevelΠ (4 + k) λ _ → isOfHLevelTruncPath) λ { north → cong (-ₖ'-gen n m (inr p) (inr q)) ; south P → cong ∣_∣ₕ (sym (merid (ptSn _))) ∙ (cong (-ₖ'-gen n m (inr p) (inr q)) P) ; (merid a i) → t a i} where t : (a : S₊ (suc k)) → PathP (λ i → 0ₖ (2 + k) ≡ ∣ merid a i ∣ₕ → ∣ merid a i ∣ₕ ≡ 0ₖ (2 + k)) (cong (-ₖ'-gen n m (inr p) (inr q))) (λ P → cong ∣_∣ₕ (sym (merid (ptSn _))) ∙ (cong (-ₖ'-gen n m (inr p) (inr q)) P)) t a = toPathP (funExt λ P → cong (transport (λ i → ∣ merid a i ∣ ≡ 0ₖ (suc (suc k)))) (cong (cong (-ₖ'-gen n m (inr p) (inr q))) (λ i → (transp (λ j → 0ₖ (suc (suc k)) ≡ ∣ merid a (~ j ∧ ~ i) ∣) i (compPath-filler P (λ j → ∣ merid a (~ j) ∣ₕ) i)))) ∙∙ cong (transport (λ i → ∣ merid a i ∣ ≡ 0ₖ (suc (suc k)))) (congFunct (-ₖ'-gen n m (inr p) (inr q)) P (sym (cong ∣_∣ₕ (merid a)))) ∙∙ (λ j → transp (λ i → ∣ merid a (i ∨ j) ∣ ≡ 0ₖ (suc (suc k))) j (compPath-filler' (cong ∣_∣ₕ (sym (merid a))) (cong (-ₖ'-gen n m (inr p) (inr q)) P ∙ cong (-ₖ'-gen n m (inr p) (inr q)) (sym (cong ∣_∣ₕ (merid a)))) j)) ∙∙ (λ i → sym (cong ∣_∣ₕ (merid a)) ∙ isCommΩK (2 + k) (cong (-ₖ'-gen n m (inr p) (inr q)) P) (cong (-ₖ'-gen n m (inr p) (inr q)) (sym (cong ∣_∣ₕ (merid a)))) i) ∙∙ (λ j → (λ i → ∣ merid a (~ i ∨ j) ∣) ∙ (cong ∣_∣ₕ (compPath-filler' (merid a) (sym (merid (ptSn _))) (~ j)) ∙ (λ i → -ₖ'-gen n m (inr p) (inr q) (P i)))) ∙ sym (lUnit _)) code≡sym : (x : coHomK (2 + k)) → (p : 0ₖ _ ≡ x) → code x p ≡ sym p code≡sym x = J (λ x p → code x p ≡ sym p) refl cong-cong-ₖ'-gen-inr : {k : ℕ} (n m : ℕ) (p : _) (q : _) (P : Square (refl {x = 0ₖ (suc (suc k))}) refl refl refl) → cong (cong (-ₖ'-gen n m (inr p) (inr q))) P ≡ sym P cong-cong-ₖ'-gen-inr n m p q P = rUnit _ ∙∙ (λ k → (λ i → cong-ₖ'-gen-inr n m p q refl (i ∧ k)) ∙∙ (λ i → cong-ₖ'-gen-inr n m p q (P i) k) ∙∙ λ i → cong-ₖ'-gen-inr n m p q refl (~ i ∧ k)) ∙∙ (λ k → transportRefl refl k ∙∙ cong sym P ∙∙ transportRefl refl k) ∙∙ sym (rUnit (cong sym P)) ∙∙ sym (sym≡cong-sym P) Kn→ΩKn+1-ₖ'' : {k : ℕ} (n m : ℕ) (p : _) (q : _) (x : coHomK k) → Kn→ΩKn+1 k (-ₖ'-gen n m (inr p) (inr q) x) ≡ sym (Kn→ΩKn+1 k x) Kn→ΩKn+1-ₖ'' n m p q x = cong (Kn→ΩKn+1 _) (-ₖ'-gen-inr≡-ₖ' n m p q x) ∙ Kn→ΩKn+1-ₖ _ x transpΩ² : {n m : ℕ} (p q : n ≡ m) → (P : _) → transport (λ i → refl {x = 0ₖ (p i)} ≡ refl {x = 0ₖ (p i)}) P ≡ transport (λ i → refl {x = 0ₖ (q i)} ≡ refl {x = 0ₖ (q i)}) P transpΩ² p q P k = subst (λ n → refl {x = 0ₖ n} ≡ refl {x = 0ₖ n}) (isSetℕ _ _ p q k) P -- Some technical lemmas about Kn→Ω²Kn+2 and its interaction with -ₖ'ⁿ̇*ᵐ and transports -- TODO : Check if this can be cleaned up more by having more general lemmas private lem₁ : (n : ℕ) (a : _) → (cong (cong (subst coHomK (+'-comm (suc zero) (suc (suc n))))) (Kn→Ω²Kn+2 ∣ a ∣ₕ)) ≡ ΩKn+1→Ω²Kn+2 (sym (transp0₁ n) ∙∙ cong (subst coHomK (+'-comm (suc zero) (suc n))) (Kn→ΩKn+1 (suc n) ∣ a ∣ₕ) ∙∙ transp0₁ n) lem₁ zero a = (λ k i j → transportRefl (Kn→Ω²Kn+2 ∣ a ∣ₕ i j) k) ∙ cong ΩKn+1→Ω²Kn+2 λ k → rUnit (λ i → transportRefl (Kn→ΩKn+1 1 ∣ a ∣ i) (~ k)) k lem₁ (suc n) a = (λ k → transp (λ i → refl {x = 0ₖ (+'-comm 1 (suc (suc (suc n))) (i ∨ ~ k))} ≡ refl {x = 0ₖ (+'-comm 1 (suc (suc (suc n))) (i ∨ ~ k))}) (~ k) (λ i j → transp (λ i → coHomK (+'-comm 1 (suc (suc (suc n))) (i ∧ ~ k))) k (Kn→Ω²Kn+2 ∣ a ∣ₕ i j))) ∙∙ transpΩ² (+'-comm 1 (suc (suc (suc n)))) (cong suc (+'-comm (suc zero) (suc (suc n)))) (Kn→Ω²Kn+2 ∣ a ∣ₕ) ∙∙ sym (natTranspLem {A = λ n → 0ₖ n ≡ 0ₖ n} (Kn→ΩKn+1 (suc (suc n)) ∣ a ∣) (λ _ → ΩKn+1→Ω²Kn+2) (+'-comm 1 (suc (suc n)))) ∙∙ cong ΩKn+1→Ω²Kn+2 (λ k → transp (λ i → 0ₖ (+'-comm (suc zero) (suc (suc n)) (i ∨ k)) ≡ 0ₖ (+'-comm (suc zero) (suc (suc n)) (i ∨ k))) k (λ i → transp (λ i → coHomK (+'-comm (suc zero) (suc (suc n)) (i ∧ k))) (~ k) (Kn→ΩKn+1 _ ∣ a ∣ₕ i))) ∙∙ cong ΩKn+1→Ω²Kn+2 (rUnit (cong (subst coHomK (+'-comm (suc zero) (suc (suc n)))) (Kn→ΩKn+1 (suc (suc n)) ∣ a ∣ₕ))) lem₂ : (n : ℕ) (a : _) (p : _) (q : _) → (cong (cong (-ₖ'-gen (suc (suc n)) (suc zero) p q ∘ (subst coHomK (+'-comm 1 (suc (suc n)))))) (Kn→Ω²Kn+2 (∣ a ∣ₕ))) ≡ ΩKn+1→Ω²Kn+2 (sym (transp0₁ n) ∙∙ cong (subst coHomK (+'-comm (suc zero) (suc n))) (cong (-ₖ'-gen (suc (suc n)) (suc zero) p q) (Kn→ΩKn+1 (suc n) ∣ a ∣ₕ)) ∙∙ transp0₁ n) lem₂ n a (inl x) (inr y) = (λ k i j → (-ₖ'-gen-inl-left (suc (suc n)) 1 x (inr y) ( subst coHomK (+'-comm 1 (suc (suc n))) (Kn→Ω²Kn+2 ∣ a ∣ₕ i j))) k) ∙∙ lem₁ n a ∙∙ cong ΩKn+1→Ω²Kn+2 (cong (sym (transp0₁ n) ∙∙_∙∙ transp0₁ n) λ k i → subst coHomK (+'-comm 1 (suc n)) (-ₖ'-gen-inl-left (suc (suc n)) 1 x (inr y) (Kn→ΩKn+1 (suc n) ∣ a ∣ i) (~ k))) lem₂ n a (inr x) (inr y) = cong-cong-ₖ'-gen-inr (suc (suc n)) 1 x y (cong (cong (subst coHomK (+'-comm 1 (suc (suc n))))) (Kn→Ω²Kn+2 ∣ a ∣ₕ)) ∙∙ cong sym (lem₁ n a) ∙∙ λ k → ΩKn+1→Ω²Kn+2 (sym (transp0₁ n) ∙∙ cong (subst coHomK (+'-comm 1 (suc n))) (cong-ₖ'-gen-inr (suc (suc n)) 1 x y (Kn→ΩKn+1 (suc n) ∣ a ∣) (~ k)) ∙∙ transp0₁ n) lem₃ : (n m : ℕ) (q : _) (p : isEvenT (suc (suc n)) ⊎ isOddT (suc (suc n))) (x : _) → (((sym (cong (-ₖ'-gen (suc n) (suc (suc m)) (evenOrOdd (suc n)) q) (transp0₂ m n)) ∙∙ (λ j → -ₖ'-gen (suc n) (suc (suc m)) (evenOrOdd (suc n)) q (subst coHomK (+'-comm (suc (suc m)) (suc n)) (Kn→ΩKn+1 _ x j))) ∙∙ cong (-ₖ'-gen (suc n) (suc (suc m)) (evenOrOdd (suc n)) q) (transp0₂ m n)))) ≡ (Kn→ΩKn+1 _ (-ₖ'-gen (suc n) (suc (suc m)) (evenOrOdd (suc n)) q (subst coHomK (cong suc (+-comm (suc m) n)) x))) lem₃ n m q p x = sym (cong-∙∙ (-ₖ'-gen (suc n) (suc (suc m)) (evenOrOdd (suc n)) q) (sym (transp0₂ m n)) (λ j → subst coHomK (+'-comm (suc (suc m)) (suc n)) (Kn→ΩKn+1 _ x j)) (transp0₂ m n)) ∙ h n m p q x where help : (n m : ℕ) (x : _) → ((sym (transp0₂ m n)) ∙∙ (λ j → subst coHomK (+'-comm (suc (suc m)) (suc n)) (Kn→ΩKn+1 (suc (suc (m + n))) x j)) ∙∙ transp0₂ m n) ≡ Kn→ΩKn+1 (suc (n + suc m)) (subst coHomK (cong suc (+-comm (suc m) n)) x) help zero m x = sym (rUnit _) ∙∙ (λ k i → transp (λ i → coHomK (+'-comm (suc (suc m)) 1 (i ∨ k))) k (Kn→ΩKn+1 _ (transp (λ i → coHomK (predℕ (+'-comm (suc (suc m)) 1 (i ∧ k)))) (~ k) x) i)) ∙∙ cong (Kn→ΩKn+1 _) λ k → subst coHomK (isSetℕ _ _ (cong predℕ (+'-comm (suc (suc m)) 1)) (cong suc (+-comm (suc m) zero)) k) x help (suc n) m x = sym (rUnit _) ∙∙ ((λ k i → transp (λ i → coHomK (+'-comm (suc (suc m)) (suc (suc n)) (i ∨ k))) k (Kn→ΩKn+1 _ (transp (λ i → coHomK (predℕ (+'-comm (suc (suc m)) (suc (suc n)) (i ∧ k)))) (~ k) x) i))) ∙∙ cong (Kn→ΩKn+1 _) (λ k → subst coHomK (isSetℕ _ _ (cong predℕ (+'-comm (suc (suc m)) (suc (suc n)))) (cong suc (+-comm (suc m) (suc n))) k) x) h : (n m : ℕ) (p : isEvenT (suc (suc n)) ⊎ isOddT (suc (suc n))) (q : _) (x : _) → cong (-ₖ'-gen (suc n) (suc (suc m)) (evenOrOdd (suc n)) q) (sym (transp0₂ m n) ∙∙ (λ j → subst coHomK (+'-comm (suc (suc m)) (suc n)) (Kn→ΩKn+1 (suc (suc (m + n))) x j)) ∙∙ transp0₂ m n) ≡ Kn→ΩKn+1 (suc (n + suc m)) (-ₖ'-gen (suc n) (suc (suc m)) (evenOrOdd (suc n)) q (subst coHomK (cong suc (+-comm (suc m) n)) x)) h n m (inl p) (inl q) x = (λ k → cong (-ₖ'-gen (suc n) (suc (suc m)) (isPropEvenOrOdd (suc n) (evenOrOdd (suc n)) (inr p) k) (inl q)) (help n m x k)) ∙∙ ((λ k i → -ₖ'-gen-inl-right (suc n) (suc (suc m)) (inr p) q (help n m x i1 i) k)) ∙∙ λ i → Kn→ΩKn+1 (suc (n + suc m)) (-ₖ'-gen-inl-right (suc n) (suc (suc m)) (isPropEvenOrOdd (suc n) (inr p) (evenOrOdd (suc n)) i) q (subst coHomK (cong suc (+-comm (suc m) n)) x) (~ i)) h n m (inl p) (inr q) x = (λ k → cong (-ₖ'-gen (suc n) (suc (suc m)) (isPropEvenOrOdd (suc n) (evenOrOdd (suc n)) (inr p) k) (inr q)) (help n m x k)) ∙∙ cong-ₖ'-gen-inr (suc n) (suc (suc m)) p q (help n m x i1) ∙∙ sym (Kn→ΩKn+1-ₖ'' (suc n) (suc (suc m)) p q (subst coHomK (λ i → suc (+-comm (suc m) n i)) x)) ∙ λ k → Kn→ΩKn+1 (suc (n + suc m)) (-ₖ'-gen (suc n) (suc (suc m)) (isPropEvenOrOdd (suc n) (inr p) (evenOrOdd (suc n)) k) (inr q) (subst coHomK (cong suc (+-comm (suc m) n)) x)) h n m (inr p) (inl q) x = (λ k → cong (-ₖ'-gen (suc n) (suc (suc m)) (isPropEvenOrOdd (suc n) (evenOrOdd (suc n)) (inl p) k) (inl q)) (help n m x k)) ∙∙ (λ k i → -ₖ'-gen-inl-left (suc n) (suc (suc m)) p (inl q) (help n m x i1 i) k) ∙∙ λ k → Kn→ΩKn+1 (suc (n + suc m)) (-ₖ'-gen-inl-right (suc n) (suc (suc m)) (evenOrOdd (suc n)) q (subst coHomK (cong suc (+-comm (suc m) n)) x) (~ k)) h n m (inr p) (inr q) x = (λ k → cong (-ₖ'-gen (suc n) (suc (suc m)) (isPropEvenOrOdd (suc n) (evenOrOdd (suc n)) (inl p) k) (inr q)) (help n m x k)) ∙∙ (λ k i → -ₖ'-gen-inl-left (suc n) (suc (suc m)) p (inr q) (help n m x i1 i) k) ∙∙ cong (Kn→ΩKn+1 (suc (n + suc m))) (sym (-ₖ'-gen-inl-left (suc n) (suc (suc m)) p (inr q) (subst coHomK (λ i → suc (+-comm (suc m) n i)) x))) ∙ λ k → Kn→ΩKn+1 (suc (n + suc m)) (-ₖ'-gen (suc n) (suc (suc m)) (isPropEvenOrOdd (suc n) (inl p) (evenOrOdd (suc n)) k) (inr q) (subst coHomK (cong suc (+-comm (suc m) n)) x)) lem₄ : (n m : ℕ) (q : _) (p : isEvenT (suc (suc n)) ⊎ isOddT (suc (suc n))) (a : _) (b : _) → cong (Kn→ΩKn+1 _) (((sym (cong (-ₖ'-gen (suc n) (suc (suc m)) (evenOrOdd (suc n)) q) (transp0₂ m n)) ∙∙ (λ j → -ₖ'-gen (suc n) (suc (suc m)) (evenOrOdd (suc n)) q (subst coHomK (+'-comm (suc (suc m)) (suc n)) (_⌣ₖ_ {n = suc (suc m)} {m = (suc n)} ∣ merid b j ∣ₕ ∣ a ∣))) ∙∙ cong (-ₖ'-gen (suc n) (suc (suc m)) (evenOrOdd (suc n)) q) (transp0₂ m n)))) ≡ cong (Kn→ΩKn+1 _) (Kn→ΩKn+1 _ (-ₖ'-gen (suc n) (suc (suc m)) (evenOrOdd (suc n)) q (subst coHomK (cong suc (+-comm (suc m) n)) (_⌣ₖ_ {n = suc m} {m = (suc n)} ∣ b ∣ₕ ∣ a ∣)))) lem₄ n m q p a b = cong (cong (Kn→ΩKn+1 _)) (lem₃ n m q p (_⌣ₖ_ {n = suc m} {m = (suc n)} ∣ b ∣ₕ ∣ a ∣)) lem₅ : (n m : ℕ) (p : _) (q : _) (a : _) (b : _) → cong (cong (-ₖ'-gen (suc (suc n)) (suc (suc m)) p q ∘ (subst coHomK (+'-comm (suc (suc m)) (suc (suc n)))))) (ΩKn+1→Ω²Kn+2 (sym (cong (-ₖ'-gen (suc m) (suc (suc n)) (evenOrOdd (suc m)) p) (transp0₂ n m)) ∙∙ (λ i → -ₖ'-gen (suc m) (suc (suc n)) (evenOrOdd (suc m)) p (subst coHomK (+'-comm (suc (suc n)) (suc m)) (_⌣ₖ_ {n = suc (suc n)} {m = suc m} ∣ merid a i ∣ₕ ∣ b ∣ₕ))) ∙∙ cong (-ₖ'-gen (suc m) (suc (suc n)) (evenOrOdd (suc m)) p) (transp0₂ n m))) ≡ Kn→Ω²Kn+2 (-ₖ'-gen (suc (suc n)) (suc (suc m)) p q (-ₖ'-gen (suc m) (suc (suc n)) (evenOrOdd (suc m)) p (subst coHomK (cong suc (sym (+-suc n m))) (_⌣ₖ_ {n = suc n} {m = suc m} ∣ a ∣ₕ ∣ b ∣ₕ)))) lem₅ n m p q a b = cong (cong (cong (-ₖ'-gen (suc (suc n)) (suc (suc m)) p q ∘ (subst coHomK (+'-comm (suc (suc m)) (suc (suc n))))))) (cong (sym (Kn→ΩKn+10ₖ _) ∙∙_∙∙ Kn→ΩKn+10ₖ _) (lem₄ m n p q b a)) ∙ help p q (_⌣ₖ_ {n = suc n} {m = suc m} ∣ a ∣ ∣ b ∣) where annoying : (x : _) → cong (cong (subst coHomK (+'-comm (suc (suc m)) (suc (suc n))))) (Kn→Ω²Kn+2 (subst coHomK (cong suc (+-comm (suc n) m)) x)) ≡ Kn→Ω²Kn+2 (subst coHomK (cong suc (sym (+-suc n m))) x) annoying x = ((λ k → transp (λ i → refl {x = 0ₖ ((+'-comm (suc (suc m)) (suc (suc n))) (i ∨ ~ k))} ≡ refl {x = 0ₖ ((+'-comm (suc (suc m)) (suc (suc n))) (i ∨ ~ k))}) (~ k) λ i j → transp (λ i → coHomK (+'-comm (suc (suc m)) (suc (suc n)) (i ∧ ~ k))) k (Kn→Ω²Kn+2 (subst coHomK (cong suc (+-comm (suc n) m)) x) i j))) ∙∙ cong (transport (λ i → refl {x = 0ₖ ((+'-comm (suc (suc m)) (suc (suc n))) i)} ≡ refl {x = 0ₖ ((+'-comm (suc (suc m)) (suc (suc n))) i)})) (natTranspLem {A = coHomK} x (λ _ → Kn→Ω²Kn+2) (cong suc (+-comm (suc n) m))) ∙∙ sym (substComposite (λ n → refl {x = 0ₖ n} ≡ refl {x = 0ₖ n}) (cong (suc ∘ suc ∘ suc) (+-comm (suc n) m)) (+'-comm (suc (suc m)) (suc (suc n))) (Kn→Ω²Kn+2 x)) ∙∙ (λ k → subst (λ n → refl {x = 0ₖ n} ≡ refl {x = 0ₖ n}) (isSetℕ _ _ (cong (suc ∘ suc ∘ suc) (+-comm (suc n) m) ∙ (+'-comm (suc (suc m)) (suc (suc n)))) (cong (suc ∘ suc ∘ suc) (sym (+-suc n m))) k) (Kn→Ω²Kn+2 x)) ∙∙ sym (natTranspLem {A = coHomK} x (λ _ → Kn→Ω²Kn+2) (cong suc (sym (+-suc n m)))) help : (p : _) (q : _) (x : _) → cong (cong (-ₖ'-gen (suc (suc n)) (suc (suc m)) p q ∘ subst coHomK (+'-comm (suc (suc m)) (suc (suc n))))) (Kn→Ω²Kn+2 (-ₖ'-gen (suc m) (suc (suc n)) (evenOrOdd (suc m)) p (subst coHomK (cong suc (+-comm (suc n) m)) x))) ≡ Kn→Ω²Kn+2 (-ₖ'-gen (suc (suc n)) (suc (suc m)) p q (-ₖ'-gen (suc m) (suc (suc n)) (evenOrOdd (suc m)) p (subst coHomK (cong suc (sym (+-suc n m))) x))) help (inl x) (inl y) z = (λ k i j → -ₖ'-gen-inl-right (suc (suc n)) (suc (suc m)) (inl x) y (subst coHomK (+'-comm (suc (suc m)) (suc (suc n))) ((ΩKn+1→Ω²Kn+2 (Kn→ΩKn+1 _ (-ₖ'-gen-inl-right (suc m) (suc (suc n)) (evenOrOdd (suc m)) x (subst coHomK (cong suc (+-comm (suc n) m)) z) k))) i j)) k) ∙∙ annoying z ∙∙ cong Kn→Ω²Kn+2 λ k → (-ₖ'-gen-inl-right (suc (suc n)) (suc (suc m)) (inl x) y (-ₖ'-gen-inl-right (suc m) (suc (suc n)) (evenOrOdd (suc m)) x (subst coHomK (cong suc (sym (+-suc n m))) z) (~ k)) (~ k)) help (inl x) (inr y) z = (λ k i j → -ₖ'-gen-inl-left (suc (suc n)) (suc (suc m)) x (inr y) (subst coHomK (+'-comm (suc (suc m)) (suc (suc n))) (Kn→Ω²Kn+2 (-ₖ'-gen-inl-right (suc m) (suc (suc n)) (evenOrOdd (suc m)) x (subst coHomK (cong suc (+-comm (suc n) m)) z) k) i j)) k) ∙∙ annoying z ∙∙ cong Kn→Ω²Kn+2 (λ k → (-ₖ'-gen-inl-left (suc (suc n)) (suc (suc m)) x (inr y) (-ₖ'-gen-inl-right (suc m) (suc (suc n)) (evenOrOdd (suc m)) x (subst coHomK (cong suc (sym (+-suc n m))) z) (~ k)) (~ k))) help (inr x) (inl y) z = (λ k i j → -ₖ'-gen-inl-right (suc (suc n)) (suc (suc m)) (inr x) y (subst coHomK (+'-comm (suc (suc m)) (suc (suc n))) (Kn→Ω²Kn+2 (-ₖ'-gen (suc m) (suc (suc n)) (isPropEvenOrOdd (suc m) (evenOrOdd (suc m)) (inr y) k) (inr x) (subst coHomK (cong suc (+-comm (suc n) m)) z)) i j)) k) ∙∙ cong (cong (cong (subst coHomK (+'-comm (suc (suc m)) (suc (suc n))))) ∘ ΩKn+1→Ω²Kn+2) (Kn→ΩKn+1-ₖ'' (suc m) (suc (suc n)) y x (subst coHomK (cong suc (+-comm (suc n) m)) z)) ∙∙ cong sym (annoying z) ∙∙ cong ΩKn+1→Ω²Kn+2 (sym (Kn→ΩKn+1-ₖ'' (suc m) (suc (suc n)) y x (subst coHomK (cong suc (sym (+-suc n m))) z))) ∙∙ cong Kn→Ω²Kn+2 λ k → (-ₖ'-gen-inl-right (suc (suc n)) (suc (suc m)) (inr x) y (-ₖ'-gen (suc m) (suc (suc n)) (isPropEvenOrOdd (suc m) (evenOrOdd (suc m)) (inr y) (~ k)) (inr x) (subst coHomK (cong suc (sym (+-suc n m))) z)) (~ k)) help (inr x) (inr y) z = (λ k → cong-cong-ₖ'-gen-inr (suc (suc n)) (suc (suc m)) x y (λ i j → subst coHomK (+'-comm (suc (suc m)) (suc (suc n))) (Kn→Ω²Kn+2 (-ₖ'-gen (suc m) (suc (suc n)) (isPropEvenOrOdd (suc m) (evenOrOdd (suc m)) (inl y) k) (inr x) (subst coHomK (cong suc (+-comm (suc n) m)) z)) i j)) k) ∙∙ cong (sym ∘ cong (cong (subst coHomK (+'-comm (suc (suc m)) (suc (suc n))))) ∘ Kn→Ω²Kn+2) (-ₖ'-gen-inl-left (suc m) (suc (suc n)) y (inr x) (subst coHomK (cong suc (+-comm (suc n) m)) z)) ∙∙ cong sym (annoying z) ∙∙ cong (sym ∘ Kn→Ω²Kn+2) (sym (-ₖ'-gen-inl-left (suc m) (suc (suc n)) y (inr x) (subst coHomK (cong suc (sym (+-suc n m))) z))) ∙∙ cong ΩKn+1→Ω²Kn+2 λ k → (Kn→ΩKn+1-ₖ'' (suc (suc n)) (suc (suc m)) x y (-ₖ'-gen (suc m) (suc (suc n)) ( isPropEvenOrOdd (suc m) (evenOrOdd (suc m)) (inl y) (~ k)) (inr x) (subst coHomK (cong suc (sym (+-suc n m))) z))) (~ k) lem₆ : (n m : ℕ) (p : _) (q : _) (a : _) (b : _) → flipSquare (Kn→Ω²Kn+2 (-ₖ'-gen (suc n) (suc (suc m)) (evenOrOdd (suc n)) q (subst coHomK (cong suc (+-comm (suc m) n)) (_⌣ₖ_ {n = suc m} {m = (suc n)} ∣ b ∣ₕ ∣ a ∣)))) ≡ Kn→Ω²Kn+2 (-ₖ'-gen (suc (suc n)) (suc (suc m)) p q (-ₖ'-gen (suc m) (suc (suc n)) (evenOrOdd (suc m)) p (subst coHomK (cong suc (sym (+-suc n m))) (-ₖ'-gen (suc n) (suc m) (evenOrOdd (suc n)) (evenOrOdd (suc m)) (subst coHomK (+'-comm (suc m) (suc n)) (∣ b ∣ₕ ⌣ₖ ∣ a ∣ₕ)))))) lem₆ n m p q a b = sym (sym≡flipSquare (Kn→Ω²Kn+2 (-ₖ'-gen (suc n) (suc (suc m)) (evenOrOdd (suc n)) q (subst coHomK (cong suc (+-comm (suc m) n)) (_⌣ₖ_ {n = suc m} {m = (suc n)} ∣ b ∣ₕ ∣ a ∣))))) ∙ cong ΩKn+1→Ω²Kn+2 (help₁ (subst coHomK (cong suc (+-comm (suc m) n)) (_⌣ₖ_ {n = suc m} {m = (suc n)} ∣ b ∣ ∣ a ∣)) p q ∙ cong (Kn→ΩKn+1 _) (sym (help₂ (∣ b ∣ ⌣ₖ ∣ a ∣)))) where help₁ : (x : _) (p : _) (q : _) → sym (Kn→ΩKn+1 (suc (n + suc m)) (-ₖ'-gen (suc n) (suc (suc m)) (evenOrOdd (suc n)) q x)) ≡ Kn→ΩKn+1 (suc (n + suc m)) ((-ₖ'-gen (suc (suc n)) (suc (suc m)) p q (-ₖ'-gen (suc m) (suc (suc n)) (evenOrOdd (suc m)) p (-ₖ'-gen (suc n) (suc m) (evenOrOdd (suc n)) (evenOrOdd (suc m)) x)))) help₁ z (inl x) (inl y) = cong (λ x → sym (Kn→ΩKn+1 (suc (n + suc m)) x)) (-ₖ'-gen-inl-right (suc n) (suc (suc m)) (evenOrOdd (suc n)) y z) ∙∙ sym (Kn→ΩKn+1-ₖ'' (suc n) (suc m) x y z) ∙∙ λ k → Kn→ΩKn+1 (suc (n + suc m)) (-ₖ'-gen-inl-right (suc (suc n)) (suc (suc m)) (inl x) y (-ₖ'-gen-inl-right (suc m) (suc (suc n)) (evenOrOdd (suc m)) x (-ₖ'-gen (suc n) (suc m) (isPropEvenOrOdd (suc n) (inr x) (evenOrOdd (suc n)) k) (isPropEvenOrOdd (suc m) (inr y) (evenOrOdd (suc m)) k) z) (~ k)) (~ k)) help₁ z (inl x) (inr y) = (λ k → sym (Kn→ΩKn+1 (suc (n + suc m)) (-ₖ'-gen (suc n) (suc (suc m)) (isPropEvenOrOdd (suc n) (evenOrOdd (suc n)) (inr x) k) (inr y) z))) ∙∙ cong sym (Kn→ΩKn+1-ₖ'' (suc n) (suc (suc m)) x y z) ∙∙ cong (Kn→ΩKn+1 (suc (n + suc m))) (sym (-ₖ'-gen-inl-right (suc n) (suc m) (inr x) y z)) ∙ λ k → Kn→ΩKn+1 (suc (n + suc m)) (-ₖ'-gen-inl-left (suc (suc n)) (suc (suc m)) x (inr y) (-ₖ'-gen-inl-right (suc m) (suc (suc n)) (evenOrOdd (suc m)) x (-ₖ'-gen (suc n) (suc m) (isPropEvenOrOdd (suc n) (inr x) (evenOrOdd (suc n)) k) (isPropEvenOrOdd (suc m) (inl y) (evenOrOdd (suc m)) k) z) (~ k)) (~ k)) help₁ z (inr x) (inl y) = cong (λ x → sym (Kn→ΩKn+1 (suc (n + suc m)) x)) (-ₖ'-gen-inl-right (suc n) (suc (suc m)) (evenOrOdd (suc n)) y z) ∙∙ (λ k → Kn→ΩKn+1-ₖ'' (suc m) (suc (suc n)) y x (-ₖ'-gen-inl-left (suc n) (suc m) x (inr y) z (~ k)) (~ k)) ∙∙ λ k → Kn→ΩKn+1 (suc (n + suc m)) (-ₖ'-gen-inl-right (suc (suc n)) (suc (suc m)) (inr x) y (-ₖ'-gen (suc m) (suc (suc n)) (isPropEvenOrOdd (suc m) (inr y) (evenOrOdd (suc m)) k) (inr x) (-ₖ'-gen (suc n) (suc m) (isPropEvenOrOdd (suc n) (inl x) (evenOrOdd (suc n)) k) (isPropEvenOrOdd (suc m) (inr y) (evenOrOdd (suc m)) k) z)) (~ k)) help₁ z (inr x) (inr y) = ((λ k → sym (Kn→ΩKn+1 (suc (n + suc m)) (-ₖ'-gen (suc n) (suc (suc m)) (isPropEvenOrOdd (suc n) (evenOrOdd (suc n)) (inl x) k) (inr y) z)))) ∙∙ cong sym (cong (Kn→ΩKn+1 (suc (n + suc m))) (-ₖ'-gen-inl-left (suc n) (suc (suc m)) x (inr y) z)) ∙∙ (λ k → sym (Kn→ΩKn+1 (suc (n + suc m)) (-ₖ'-gen-inl-left (suc m) (suc (suc n)) y (inr x) (-ₖ'-gen-inl-right (suc n) (suc m) (inl x) y z (~ k)) (~ k)))) ∙ λ k → Kn→ΩKn+1-ₖ'' (suc (suc n)) (suc (suc m)) x y (-ₖ'-gen (suc m) (suc (suc n)) (isPropEvenOrOdd (suc m) (inl y) (evenOrOdd (suc m)) k) (inr x) (-ₖ'-gen (suc n) (suc m) (isPropEvenOrOdd (suc n) (inl x) (evenOrOdd (suc n)) k) (isPropEvenOrOdd (suc m) (inl y) (evenOrOdd (suc m)) k) z)) (~ k) help₂ : (x : _) → (-ₖ'-gen (suc (suc n)) (suc (suc m)) p q (-ₖ'-gen (suc m) (suc (suc n)) (evenOrOdd (suc m)) p (subst coHomK (cong suc (sym (+-suc n m))) (-ₖ'-gen (suc n) (suc m) (evenOrOdd (suc n)) (evenOrOdd (suc m)) (subst coHomK (+'-comm (suc m) (suc n)) x))))) ≡ -ₖ'-gen (suc (suc n)) (suc (suc m)) p q (-ₖ'-gen (suc m) (suc (suc n)) (evenOrOdd (suc m)) p (-ₖ'-gen (suc n) (suc m) (evenOrOdd (suc n)) (evenOrOdd (suc m)) (subst coHomK (cong suc (+-comm (suc m) n)) x))) help₂ x = (λ k → -ₖ'-gen (suc (suc n)) (suc (suc m)) p q (-ₖ'-gen (suc m) (suc (suc n)) (evenOrOdd (suc m)) p (transp (λ i → coHomK ((cong suc (sym (+-suc n m))) (i ∨ k))) k (-ₖ'-gen (suc n) (suc m) (evenOrOdd (suc n)) (evenOrOdd (suc m)) (transp (λ i → coHomK ((cong suc (sym (+-suc n m))) (i ∧ k))) (~ k) (subst coHomK (+'-comm (suc m) (suc n)) x)))))) ∙ cong (-ₖ'-gen (suc (suc n)) (suc (suc m)) p q ∘ -ₖ'-gen (suc m) (suc (suc n)) (evenOrOdd (suc m)) p ∘ -ₖ'-gen (suc n) (suc m) (evenOrOdd (suc n)) (evenOrOdd (suc m))) (sym (substComposite coHomK (+'-comm (suc m) (suc n)) ((cong suc (sym (+-suc n m)))) x) ∙ λ k → subst coHomK (isSetℕ _ _ (+'-comm (suc m) (suc n) ∙ cong suc (sym (+-suc n m))) ((cong suc (+-comm (suc m) n))) k) x) lem₇ : (n : ℕ) (a : _) (p : _) (q : _) → ((λ i → Kn→ΩKn+1 _ (-ₖ'-gen (suc n) (suc zero) (evenOrOdd (suc n)) (inr tt) (transp0₁ n (~ i)))) ∙∙ (λ i j → Kn→ΩKn+1 _ (-ₖ'-gen (suc n) (suc zero) (evenOrOdd (suc n)) (inr tt) (subst coHomK (+'-comm (suc zero) (suc n)) (Kn→ΩKn+1 (suc n) ∣ a ∣ₕ i))) j) ∙∙ (λ i → Kn→ΩKn+1 _ (-ₖ'-gen (suc n) (suc zero) (evenOrOdd (suc n)) (inr tt) (transp0₁ n i)))) ≡ (cong (Kn→ΩKn+1 (suc (suc (n + zero)))) (sym (transp0₁ n) ∙∙ sym (cong (subst coHomK (+'-comm (suc zero) (suc n))) (cong (-ₖ'-gen (suc (suc n)) (suc zero) p q) (Kn→ΩKn+1 (suc n) ∣ a ∣ₕ))) ∙∙ transp0₁ n)) lem₇ zero a (inl x) (inr tt) = (λ k → rUnit ((cong (Kn→ΩKn+1 _) (cong-ₖ'-gen-inr (suc zero) (suc zero) tt tt (λ i → (subst coHomK (+'-comm (suc zero) (suc zero)) (Kn→ΩKn+1 (suc zero) ∣ a ∣ₕ i))) k))) (~ k)) ∙ λ k → ((cong (Kn→ΩKn+1 (suc (suc zero))) (rUnit (λ i → subst coHomK (+'-comm (suc zero) (suc zero)) (-ₖ'-gen-inl-left (suc (suc zero)) (suc zero) tt (inr tt) (Kn→ΩKn+1 (suc zero) ∣ a ∣ₕ (~ i)) (~ k))) k))) lem₇ (suc n) a (inl x) (inr tt) = ((λ k → rUnit (cong (Kn→ΩKn+1 _) (λ i → -ₖ'-gen (suc (suc n)) (suc zero) (isPropEvenOrOdd n (evenOrOdd (suc (suc n))) (inr x) k) (inr tt) (subst coHomK (+'-comm (suc zero) (suc (suc n))) (Kn→ΩKn+1 (suc (suc n)) ∣ a ∣ₕ i)))) (~ k))) ∙∙ (((λ k → ((cong (Kn→ΩKn+1 _) (cong-ₖ'-gen-inr (suc (suc n)) (suc zero) x tt (λ i → (subst coHomK (+'-comm (suc zero) (suc (suc n))) (Kn→ΩKn+1 (suc (suc n)) ∣ a ∣ₕ i))) k)))))) ∙∙ λ k → ((cong (Kn→ΩKn+1 (suc (suc (suc n + zero)))) (rUnit (λ i → subst coHomK (+'-comm (suc zero) (suc (suc n))) (-ₖ'-gen-inl-left (suc (suc (suc n))) (suc zero) x (inr tt) (Kn→ΩKn+1 (suc (suc n)) ∣ a ∣ₕ (~ i)) (~ k))) k))) lem₇ (suc n) a (inr x) (inr tt) = (λ k → rUnit (λ i j → Kn→ΩKn+1 _ (-ₖ'-gen (suc (suc n)) (suc zero) (isPropEvenOrOdd (suc (suc n)) (evenOrOdd (suc (suc n))) (inl x) k) (inr tt) (subst coHomK (+'-comm (suc zero) (suc (suc n))) (Kn→ΩKn+1 (suc (suc n)) ∣ a ∣ₕ i))) j) (~ k)) ∙∙ (λ k i j → Kn→ΩKn+1 _ (-ₖ'-gen-inl-left (suc (suc n)) (suc zero) x (inr tt) (subst coHomK (+'-comm (suc zero) (suc (suc n))) (Kn→ΩKn+1 (suc (suc n)) ∣ a ∣ₕ i)) k) j) ∙∙ λ k → cong (Kn→ΩKn+1 _) (rUnit (sym (cong (subst coHomK (+'-comm (suc zero) (suc (suc n)))) (cong-ₖ'-gen-inr (suc (suc (suc n))) (suc zero) x tt (Kn→ΩKn+1 (suc (suc n)) ∣ a ∣ₕ) (~ k)))) k) -- ∣ a ∣ ⌣ₖ ∣ b ∣ ≡ -ₖ'ⁿ*ᵐ (∣ b ∣ ⌣ₖ ∣ a ∣) for n ≥ 1, m = 1 gradedComm'-elimCase-left : (n : ℕ) (p : _) (q : _) (a : S₊ (suc n)) (b : S¹) → (_⌣ₖ_ {n = suc n} {m = (suc zero)} ∣ a ∣ₕ ∣ b ∣ₕ) ≡ (-ₖ'-gen (suc n) (suc zero) p q) (subst coHomK (+'-comm (suc zero) (suc n)) (_⌣ₖ_ {n = suc zero} {m = suc n} ∣ b ∣ₕ ∣ a ∣ₕ)) gradedComm'-elimCase-left zero (inr tt) (inr tt) a b = proof a b ∙ cong (-ₖ'-gen 1 1 (inr tt) (inr tt)) (sym (transportRefl ((_⌣ₖ_ {n = suc zero} {m = suc zero} ∣ b ∣ ∣ a ∣)))) where help : flipSquare (ΩKn+1→Ω²Kn+2' (λ j i → _⌣ₖ_ {n = suc zero} {m = suc zero} ∣ loop i ∣ₕ ∣ loop j ∣ₕ)) ≡ cong (cong (-ₖ'-gen 1 1 (inr tt) (inr tt))) (ΩKn+1→Ω²Kn+2' (λ i j → _⌣ₖ_ {n = suc zero} {m = suc zero} ∣ loop j ∣ₕ ∣ loop i ∣ₕ)) help = sym (sym≡flipSquare _) ∙ sym (cong-cong-ₖ'-gen-inr 1 1 tt tt (ΩKn+1→Ω²Kn+2' (λ i j → _⌣ₖ_ {n = suc zero} {m = suc zero} ∣ loop j ∣ ∣ loop i ∣))) proof : (a b : S¹) → _⌣ₖ_ {n = suc zero} {m = suc zero} ∣ a ∣ₕ ∣ b ∣ₕ ≡ -ₖ'-gen 1 1 (inr tt) (inr tt) (_⌣ₖ_ {n = suc zero} {m = suc zero} ∣ b ∣ ∣ a ∣) proof base base = refl proof base (loop i) k = -ₖ'-gen 1 1 (inr tt) (inr tt) (Kn→ΩKn+10ₖ _ (~ k) i) proof (loop i) base k = Kn→ΩKn+10ₖ _ k i proof (loop i) (loop j) k = hcomp (λ r → λ { (i = i0) → -ₖ'-gen 1 1 (inr tt) (inr tt) (Kn→ΩKn+10ₖ _ (~ k ∨ ~ r) j) ; (i = i1) → -ₖ'-gen 1 1 (inr tt) (inr tt) (Kn→ΩKn+10ₖ _ (~ k ∨ ~ r) j) ; (j = i0) → Kn→ΩKn+10ₖ _ (k ∨ ~ r) i ; (j = i1) → Kn→ΩKn+10ₖ _ (k ∨ ~ r) i ; (k = i0) → doubleCompPath-filler (sym (Kn→ΩKn+10ₖ _)) (λ j i → _⌣ₖ_ {n = suc zero} {m = suc zero} ∣ loop i ∣ₕ ∣ loop j ∣ₕ) (Kn→ΩKn+10ₖ _) (~ r) j i ; (k = i1) → (-ₖ'-gen 1 1 (inr tt) (inr tt) (doubleCompPath-filler (sym (Kn→ΩKn+10ₖ _)) (λ i j → _⌣ₖ_ {n = suc zero} {m = suc zero} ∣ loop j ∣ₕ ∣ loop i ∣ₕ) (Kn→ΩKn+10ₖ _) (~ r) i j))}) (help k i j) gradedComm'-elimCase-left (suc n) p q north b = cong (-ₖ'-gen (suc (suc n)) 1 p q ∘ (subst coHomK (+'-comm 1 (suc (suc n))))) (sym (⌣ₖ-0ₖ _ (suc (suc n)) ∣ b ∣ₕ)) gradedComm'-elimCase-left (suc n) p q south b = cong (-ₖ'-gen (suc (suc n)) 1 p q ∘ (subst coHomK (+'-comm 1 (suc (suc n))))) ((sym (⌣ₖ-0ₖ _ (suc (suc n)) ∣ b ∣ₕ)) ∙ λ i → ∣ b ∣ ⌣ₖ ∣ merid (ptSn (suc n)) i ∣ₕ) gradedComm'-elimCase-left (suc n) p q (merid a i) base k = hcomp (λ j → λ {(i = i0) → (-ₖ'-gen (suc (suc n)) 1 p q ∘ (subst coHomK (+'-comm 1 (suc (suc n))))) (0ₖ _) ; (i = i1) → (-ₖ'-gen (suc (suc n)) 1 p q ∘ (subst coHomK (+'-comm 1 (suc (suc n))))) (compPath-filler (sym (⌣ₖ-0ₖ _ (suc (suc n)) ∣ base ∣ₕ)) (λ i → ∣ base ∣ ⌣ₖ ∣ merid a i ∣ₕ) j k) ; (k = i0) → _⌣ₖ_ {n = suc (suc n)} {m = suc zero} ∣ merid a i ∣ₕ ∣ base ∣ₕ ; (k = i1) → -ₖ'-gen (suc (suc n)) 1 p q (subst coHomK (+'-comm 1 (suc (suc n))) (∣ base ∣ₕ ⌣ₖ ∣ merid a i ∣ₕ))}) (hcomp (λ j → λ {(i = i0) → ∣ north ∣ ; (i = i1) → ∣ north ∣ ; (k = i0) → (sym (Kn→ΩKn+10ₖ _) ∙ (λ j → Kn→ΩKn+1 _ (sym (gradedComm'-elimCase-left n (evenOrOdd (suc n)) (inr tt) a base ∙ cong (-ₖ'-gen (suc n) 1 (evenOrOdd (suc n)) (inr tt)) (transp0₁ n)) j))) j i ; (k = i1) → ∣ north ∣}) ∣ north ∣) gradedComm'-elimCase-left (suc n) p q (merid a i) (loop j) k = hcomp (λ r → λ { (i = i0) → (-ₖ'-gen (suc (suc n)) 1 p q ∘ (subst coHomK (+'-comm 1 (suc (suc n))))) (sym (⌣ₖ-0ₖ _ (suc (suc n)) ∣ (loop j) ∣ₕ) k) ; (i = i1) → (-ₖ'-gen (suc (suc n)) 1 p q ∘ (subst coHomK (+'-comm 1 (suc (suc n))))) (compPath-filler (sym (⌣ₖ-0ₖ _ (suc (suc n)) ∣ (loop j) ∣ₕ)) (λ i → ∣ loop j ∣ ⌣ₖ ∣ merid (ptSn (suc n)) i ∣ₕ) r k) ; (k = i0) → _⌣ₖ_ {n = suc (suc n)} {m = suc zero} ∣ merid a i ∣ₕ ∣ loop j ∣ₕ ; (k = i1) → -ₖ'-gen (suc (suc n)) 1 p q (subst coHomK (+'-comm 1 (suc (suc n))) (_⌣ₖ_ {n = suc zero} {m = suc (suc n)} ∣ loop j ∣ₕ ∣ compPath-filler (merid a) (sym (merid (ptSn (suc n)))) (~ r) i ∣ₕ))}) (hcomp (λ r → λ { (i = i0) → (-ₖ'-gen (suc (suc n)) 1 p q ∘ (subst coHomK (+'-comm 1 (suc (suc n))))) ∣ rCancel (merid (ptSn (suc (suc n)))) (~ k ∧ r) j ∣ ; (i = i1) → (-ₖ'-gen (suc (suc n)) 1 p q ∘ (subst coHomK (+'-comm 1 (suc (suc n))))) ∣ rCancel (merid (ptSn (suc (suc n)))) (~ k ∧ r) j ∣ ; (k = i0) → help₂ r i j ; (k = i1) → -ₖ'-gen (suc (suc n)) 1 p q (subst coHomK (+'-comm 1 (suc (suc n))) (_⌣ₖ_ {n = suc zero} {m = suc (suc n)} ∣ loop j ∣ₕ (Kn→ΩKn+1 _ ∣ a ∣ₕ i)))}) (-ₖ'-gen (suc (suc n)) 1 p q (subst coHomK (+'-comm 1 (suc (suc n))) (_⌣ₖ_ {n = suc zero} {m = suc (suc n)} ∣ loop j ∣ₕ (Kn→ΩKn+1 _ ∣ a ∣ₕ i))))) where P : Path _ (Kn→ΩKn+1 (suc (suc (n + 0))) (0ₖ _)) (Kn→ΩKn+1 (suc (suc (n + 0))) (_⌣ₖ_ {n = (suc n)} {m = suc zero} ∣ a ∣ ∣ base ∣)) P i = Kn→ΩKn+1 (suc (suc (n + 0))) ((sym (gradedComm'-elimCase-left n (evenOrOdd (suc n)) (inr tt) a base ∙ cong (-ₖ'-gen (suc n) 1 (evenOrOdd (suc n)) (inr tt)) (transp0₁ n)) i)) help₁ : (P ∙∙ ((λ i j → _⌣ₖ_ {n = suc (suc n)} {m = suc zero} ∣ merid a j ∣ₕ ∣ loop i ∣ₕ)) ∙∙ sym P) ≡ ((λ i → Kn→ΩKn+1 _ (-ₖ'-gen (suc n) 1 (evenOrOdd (suc n)) (inr tt) (transp0₁ n (~ i)))) ∙∙ (λ i j → Kn→ΩKn+1 _ (-ₖ'-gen (suc n) 1 (evenOrOdd (suc n)) (inr tt) (subst coHomK (+'-comm 1 (suc n)) (∣ loop i ∣ₕ ⌣ₖ ∣ a ∣ₕ))) j) ∙∙ (λ i → Kn→ΩKn+1 _ (-ₖ'-gen (suc n) 1 (evenOrOdd (suc n)) (inr tt) (transp0₁ n i)))) help₁ k i j = ((λ i → (Kn→ΩKn+1 (suc (suc (n + 0)))) (compPath-filler' ((gradedComm'-elimCase-left n (evenOrOdd (suc n)) (inr tt) a base)) (cong (-ₖ'-gen (suc n) 1 (evenOrOdd (suc n)) (inr tt)) (transp0₁ n)) (~ k) (~ i))) ∙∙ (λ i j → (Kn→ΩKn+1 _ (gradedComm'-elimCase-left n (evenOrOdd (suc n)) (inr tt) a (loop i) k) j)) ∙∙ λ i → (Kn→ΩKn+1 (suc (suc (n + 0)))) (compPath-filler' ((gradedComm'-elimCase-left n (evenOrOdd (suc n)) (inr tt) a base)) (cong (-ₖ'-gen (suc n) 1 (evenOrOdd (suc n)) (inr tt)) (transp0₁ n)) (~ k) i)) i j help₂ : I → I → I → coHomK _ help₂ r i j = hcomp (λ k → λ { (i = i0) → (-ₖ'-gen (suc (suc n)) 1 p q ∘ subst coHomK (+'-comm 1 (suc (suc n)))) ∣ rCancel (merid (ptSn (suc (suc n)))) (~ k ∨ r) j ∣ ; (i = i1) → (-ₖ'-gen (suc (suc n)) 1 p q ∘ subst coHomK (+'-comm 1 (suc (suc n)))) ∣ rCancel (merid (ptSn (suc (suc n)))) (~ k ∨ r) j ∣ ; (j = i0) → compPath-filler (sym (Kn→ΩKn+10ₖ (suc (suc (n + 0))))) P k r i ; (j = i1) → compPath-filler (sym (Kn→ΩKn+10ₖ (suc (suc (n + 0))))) P k r i ; (r = i0) → -ₖ'-gen (suc (suc n)) 1 p q (subst coHomK (+'-comm 1 (suc (suc n))) (doubleCompPath-filler (sym (Kn→ΩKn+10ₖ _)) (λ i j → _⌣ₖ_ {n = suc zero} {m = suc (suc n)} ∣ loop j ∣ₕ (Kn→ΩKn+1 (suc n) ∣ a ∣ₕ i)) (Kn→ΩKn+10ₖ _) (~ k) i j)) ; (r = i1) → doubleCompPath-filler P (λ i j → _⌣ₖ_ {n = suc (suc n)} {m = suc zero} ∣ merid a j ∣ₕ ∣ loop i ∣ₕ) (sym P) (~ k) j i}) (hcomp (λ k → λ { (i = i0) → ∣ north ∣ ; (i = i1) → ∣ north ∣ ; (j = i0) → (Kn→ΩKn+10ₖ (suc (suc (n + 0)))) (~ r) i ; (j = i1) → (Kn→ΩKn+10ₖ (suc (suc (n + 0)))) (~ r) i ; (r = i0) → lem₂ n a p q (~ k) i j ; (r = i1) → help₁ (~ k) j i}) (hcomp (λ k → λ { (i = i0) → ∣ north ∣ ; (i = i1) → ∣ north ∣ ; (j = i0) → Kn→ΩKn+10ₖ (suc (suc (n + 0))) (~ r) i ; (j = i1) → Kn→ΩKn+10ₖ (suc (suc (n + 0))) (~ r) i ; (r = i0) → flipSquare≡cong-sym (flipSquare (ΩKn+1→Ω²Kn+2 (sym (transp0₁ n) ∙∙ cong (subst coHomK (+'-comm 1 (suc n))) (cong (-ₖ'-gen (suc (suc n)) 1 p q) (Kn→ΩKn+1 (suc n) ∣ a ∣ₕ)) ∙∙ transp0₁ n))) (~ k) i j ; (r = i1) → ((λ i → Kn→ΩKn+1 _ (-ₖ'-gen (suc n) 1 (evenOrOdd (suc n)) (inr tt) (transp0₁ n (~ i)))) ∙∙ (λ i j → Kn→ΩKn+1 _ (-ₖ'-gen (suc n) 1 (evenOrOdd (suc n)) (inr tt) (subst coHomK (+'-comm 1 (suc n)) (Kn→ΩKn+1 (suc n) ∣ a ∣ₕ i))) j) ∙∙ (λ i → Kn→ΩKn+1 _ (-ₖ'-gen (suc n) 1 (evenOrOdd (suc n)) (inr tt) (transp0₁ n i)))) j i}) (hcomp (λ k → λ { (i = i0) → ∣ north ∣ ; (i = i1) → ∣ north ∣ ; (j = i0) → Kn→ΩKn+10ₖ (suc (suc (n + 0))) (~ r ∧ k) i ; (j = i1) → Kn→ΩKn+10ₖ (suc (suc (n + 0))) (~ r ∧ k) i ; (r = i0) → doubleCompPath-filler (sym (Kn→ΩKn+10ₖ _)) (cong (Kn→ΩKn+1 (suc (suc (n + 0)))) (sym (transp0₁ n) ∙∙ sym (cong (subst coHomK (+'-comm 1 (suc n))) (cong (-ₖ'-gen (suc (suc n)) 1 p q) (Kn→ΩKn+1 (suc n) ∣ a ∣ₕ))) ∙∙ transp0₁ n)) (Kn→ΩKn+10ₖ _) k j i ; (r = i1) → lem₇ n a p q (~ k) j i}) (lem₇ n a p q i1 j i)))) -- ∣ a ∣ ⌣ₖ ∣ b ∣ ≡ -ₖ'ⁿ*ᵐ (∣ b ∣ ⌣ₖ ∣ a ∣) for all n, m ≥ 1 gradedComm'-elimCase : (k n m : ℕ) (term : n + m ≡ k) (p : _) (q : _) (a : _) (b : _) → (_⌣ₖ_ {n = suc n} {m = (suc m)} ∣ a ∣ₕ ∣ b ∣ₕ) ≡ (-ₖ'-gen (suc n) (suc m) p q) (subst coHomK (+'-comm (suc m) (suc n)) (_⌣ₖ_ {n = suc m} {m = suc n} ∣ b ∣ₕ ∣ a ∣ₕ)) gradedComm'-elimCase k zero zero term p q a b = gradedComm'-elimCase-left zero p q a b gradedComm'-elimCase k zero (suc m) term (inr tt) q a b = help q ∙ sym (cong (-ₖ'-gen 1 (suc (suc m)) (inr tt) q ∘ (subst coHomK (+'-comm (suc (suc m)) 1))) (gradedComm'-elimCase-left (suc m) q (inr tt) b a)) where help : (q : _) → ∣ a ∣ₕ ⌣ₖ ∣ b ∣ₕ ≡ -ₖ'-gen 1 (suc (suc m)) (inr tt) q (subst coHomK (+'-comm (suc (suc m)) 1) (-ₖ'-gen (suc (suc m)) 1 q (inr tt) (subst coHomK (+'-comm 1 (suc (suc m))) (∣ a ∣ₕ ⌣ₖ ∣ b ∣ₕ)))) help (inl x) = (sym (transportRefl _) ∙ (λ i → subst coHomK (isSetℕ _ _ refl (+'-comm 1 (suc (suc m)) ∙ +'-comm (suc (suc m)) 1) i) (∣ a ∣ₕ ⌣ₖ ∣ b ∣ₕ))) ∙∙ substComposite coHomK (+'-comm 1 (suc (suc m))) (+'-comm (suc (suc m)) 1) ((∣ a ∣ₕ ⌣ₖ ∣ b ∣ₕ)) ∙∙ λ i → -ₖ'-gen-inl-right (suc zero) (suc (suc m)) (inr tt) x ((subst coHomK (+'-comm (suc (suc m)) 1) (-ₖ'-gen-inl-left (suc (suc m)) 1 x (inr tt) (subst coHomK (+'-comm 1 (suc (suc m))) (∣ a ∣ₕ ⌣ₖ ∣ b ∣ₕ)) (~ i)))) (~ i) help (inr x) = (sym (transportRefl _) ∙∙ (λ k → subst coHomK (isSetℕ _ _ refl (+'-comm 1 (suc (suc m)) ∙ +'-comm (suc (suc m)) 1) k) (∣ a ∣ₕ ⌣ₖ ∣ b ∣ₕ)) ∙∙ sym (-ₖ^2 (subst coHomK (+'-comm 1 (suc (suc m)) ∙ +'-comm (suc (suc m)) 1) (∣ a ∣ₕ ⌣ₖ ∣ b ∣ₕ)))) ∙∙ (λ i → -ₖ'-gen-inr≡-ₖ' 1 (suc (suc m)) tt x (-ₖ'-gen-inr≡-ₖ' (suc (suc m)) 1 x tt (substComposite coHomK (+'-comm 1 (suc (suc m))) (+'-comm (suc (suc m)) 1) (∣ a ∣ₕ ⌣ₖ ∣ b ∣ₕ) i) (~ i)) (~ i)) ∙∙ λ i → (-ₖ'-gen 1 (suc (suc m)) (inr tt) (inr x) (transp (λ j → coHomK ((+'-comm (suc (suc m)) 1) (j ∨ ~ i))) (~ i) (-ₖ'-gen (suc (suc m)) 1 (inr x) (inr tt) (transp (λ j → coHomK ((+'-comm (suc (suc m)) 1) (j ∧ ~ i))) i ((subst coHomK (+'-comm 1 (suc (suc m))) (∣ a ∣ₕ ⌣ₖ ∣ b ∣ₕ))))))) gradedComm'-elimCase k (suc n) zero term p q a b = gradedComm'-elimCase-left (suc n) p q a b gradedComm'-elimCase zero (suc n) (suc m) term p q a b = ⊥.rec (snotz (sym (+-suc n m) ∙ cong predℕ term)) gradedComm'-elimCase (suc zero) (suc n) (suc m) term p q a b = ⊥.rec (snotz (sym (+-suc n m) ∙ cong predℕ term)) gradedComm'-elimCase (suc (suc k)) (suc n) (suc m) term p q north north = refl gradedComm'-elimCase (suc (suc k)) (suc n) (suc m) term p q north south = refl gradedComm'-elimCase (suc (suc k)) (suc n) (suc m) term p q north (merid a i) r = -ₖ'-gen (suc (suc n)) (suc (suc m)) p q ( (subst coHomK (+'-comm (suc (suc m)) (suc (suc n)))) ((sym (Kn→ΩKn+10ₖ _) ∙ cong (Kn→ΩKn+1 _) (cong (-ₖ'-gen (suc m) (suc (suc n)) (evenOrOdd (suc m)) p) (sym (transp0₂ n m)) ∙ sym (gradedComm'-elimCase (suc k) m (suc n) (+-suc m n ∙ +-comm (suc m) n ∙ cong predℕ term) (evenOrOdd (suc m)) p a north))) r i)) gradedComm'-elimCase (suc (suc k)) (suc n) (suc m) term p q south north = refl gradedComm'-elimCase (suc (suc k)) (suc n) (suc m) term p q south south = refl gradedComm'-elimCase (suc (suc k)) (suc n) (suc m) term p q south (merid a i) r = -ₖ'-gen (suc (suc n)) (suc (suc m)) p q ( (subst coHomK (+'-comm (suc (suc m)) (suc (suc n)))) ((sym (Kn→ΩKn+10ₖ _) ∙ cong (Kn→ΩKn+1 _) (cong (-ₖ'-gen (suc m) (suc (suc n)) (evenOrOdd (suc m)) p) (sym (transp0₂ n m)) ∙ sym (gradedComm'-elimCase (suc k) m (suc n) (+-suc m n ∙ +-comm (suc m) n ∙ cong predℕ term) (evenOrOdd (suc m)) p a south))) r i)) gradedComm'-elimCase (suc (suc k)) (suc n) (suc m) term p q (merid a i) north r = (cong (Kn→ΩKn+1 (suc (suc (n + suc m)))) (gradedComm'-elimCase (suc k) n (suc m) (cong predℕ term) (evenOrOdd (suc n)) q a north ∙ cong (-ₖ'-gen (suc n) (suc (suc m)) (evenOrOdd (suc n)) q) (transp0₂ m n)) ∙' Kn→ΩKn+10ₖ _) r i gradedComm'-elimCase (suc (suc k)) (suc n) (suc m) term p q (merid a i) south r = (cong (Kn→ΩKn+1 (suc (suc (n + suc m)))) (gradedComm'-elimCase (suc k) n (suc m) (cong predℕ term) (evenOrOdd (suc n)) q a south ∙ cong (-ₖ'-gen (suc n) (suc (suc m)) (evenOrOdd (suc n)) q) (transp0₂ m n)) ∙' Kn→ΩKn+10ₖ _) r i gradedComm'-elimCase (suc (suc k)) (suc n) (suc m) term p q (merid a i) (merid b j) r = hcomp (λ l → λ { (i = i0) → -ₖ'-gen (suc (suc n)) (suc (suc m)) p q ( (subst coHomK (+'-comm (suc (suc m)) (suc (suc n)))) ((compPath-filler (sym (Kn→ΩKn+10ₖ _)) (cong (Kn→ΩKn+1 _) (cong (-ₖ'-gen (suc m) (suc (suc n)) (evenOrOdd (suc m)) p) (sym (transp0₂ n m)) ∙ sym (gradedComm'-elimCase (suc k) m (suc n) (+-suc m n ∙ +-comm (suc m) n ∙ cong predℕ term) (evenOrOdd (suc m)) p b north))) l r j))) ; (i = i1) → -ₖ'-gen (suc (suc n)) (suc (suc m)) p q ( (subst coHomK (+'-comm (suc (suc m)) (suc (suc n)))) ((compPath-filler (sym (Kn→ΩKn+10ₖ _)) (cong (Kn→ΩKn+1 _) (cong (-ₖ'-gen (suc m) (suc (suc n)) (evenOrOdd (suc m)) p) (sym (transp0₂ n m)) ∙ sym (gradedComm'-elimCase (suc k) m (suc n) (+-suc m n ∙ +-comm (suc m) n ∙ cong predℕ term) (evenOrOdd (suc m)) p b south))) l r j))) ; (r = i0) → help₂ l i j ; (r = i1) → -ₖ'-gen (suc (suc n)) (suc (suc m)) p q (subst coHomK (+'-comm (suc (suc m)) (suc (suc n))) (help₁ l i j))}) (hcomp (λ l → λ { (i = i0) → -ₖ'-gen (suc (suc n)) (suc (suc m)) p q (subst coHomK (+'-comm (suc (suc m)) (suc (suc n))) (Kn→ΩKn+10ₖ _ (~ r ∨ ~ l) j)) ; (i = i1) → -ₖ'-gen (suc (suc n)) (suc (suc m)) p q (subst coHomK (+'-comm (suc (suc m)) (suc (suc n))) (Kn→ΩKn+10ₖ _ (~ r ∨ ~ l) j)) ; (j = i0) → Kn→ΩKn+10ₖ _ r i ; (j = i1) → Kn→ΩKn+10ₖ _ r i ; (r = i0) → lem₄ n m q p a b (~ l) j i ; (r = i1) → -ₖ'-gen (suc (suc n)) (suc (suc m)) p q (subst coHomK (+'-comm (suc (suc m)) (suc (suc n))) (doubleCompPath-filler (sym (Kn→ΩKn+10ₖ _)) (λ i j → Kn→ΩKn+1 _ ((sym (cong (-ₖ'-gen (suc m) (suc (suc n)) (evenOrOdd (suc m)) p) (transp0₂ n m)) ∙∙ (λ i → -ₖ'-gen (suc m) (suc (suc n)) (evenOrOdd (suc m)) p (subst coHomK (+'-comm (suc (suc n)) (suc m)) (_⌣ₖ_ {n = suc (suc n)} {m = suc m} ∣ merid a i ∣ₕ ∣ b ∣ₕ))) ∙∙ cong (-ₖ'-gen (suc m) (suc (suc n)) (evenOrOdd (suc m)) p) (transp0₂ n m)) i) j) (Kn→ΩKn+10ₖ _) (~ l) i j))}) (hcomp (λ l → λ { (i = i0) → ∣ north ∣ ; (i = i1) → ∣ north ∣ ; (j = i0) → Kn→ΩKn+10ₖ _ r i ; (j = i1) → Kn→ΩKn+10ₖ _ r i ; (r = i0) → lem₄ n m q p a b i1 j i ; (r = i1) → lem₅ n m p q a b (~ l) i j}) (hcomp (λ l → λ { (i = i0) → ∣ north ∣ ; (i = i1) → ∣ north ∣ ; (j = i0) → Kn→ΩKn+10ₖ _ (r ∨ ~ l) i ; (j = i1) → Kn→ΩKn+10ₖ _ (r ∨ ~ l) i ; (r = i0) → doubleCompPath-filler (sym (Kn→ΩKn+10ₖ _)) (lem₄ n m q p a b i1) (Kn→ΩKn+10ₖ _) (~ l) j i ; (r = i1) → Kn→Ω²Kn+2 (-ₖ'-gen (suc (suc n)) (suc (suc m)) p q (-ₖ'-gen (suc m) (suc (suc n)) (evenOrOdd (suc m)) p (subst coHomK (cong suc (sym (+-suc n m))) (gradedComm'-elimCase k n m (+-comm n m ∙∙ cong predℕ (+-comm (suc m) n) ∙∙ cong (predℕ ∘ predℕ) term) (evenOrOdd (suc n)) (evenOrOdd (suc m)) a b (~ l))))) i j}) (lem₆ n m p q a b r i j)))) where help₁ : I → I → I → coHomK _ help₁ l i j = Kn→ΩKn+1 _ (hcomp (λ r → λ { (i = i0) → compPath-filler' (cong ((-ₖ'-gen (suc m) (suc (suc n)) (evenOrOdd (suc m)) p)) (sym (transp0₂ n m))) (sym (gradedComm'-elimCase (suc k) m (suc n) (+-suc m n ∙ +-comm (suc m) n ∙ cong predℕ term) (evenOrOdd (suc m)) p b north)) r l ; (i = i1) → compPath-filler' (cong ((-ₖ'-gen (suc m) (suc (suc n)) (evenOrOdd (suc m)) p)) (sym (transp0₂ n m))) (sym (gradedComm'-elimCase (suc k) m (suc n) (+-suc m n ∙ +-comm (suc m) n ∙ cong predℕ term) (evenOrOdd (suc m)) p b south)) r l ; (l = i0) → doubleCompPath-filler (sym (cong (-ₖ'-gen (suc m) (suc (suc n)) (evenOrOdd (suc m)) p) (transp0₂ n m))) (λ i → -ₖ'-gen (suc m) (suc (suc n)) (evenOrOdd (suc m)) p (subst coHomK (+'-comm (suc (suc n)) (suc m)) (_⌣ₖ_ {n = suc (suc n)} {m = suc m} ∣ merid a i ∣ₕ ∣ b ∣ₕ))) (cong (-ₖ'-gen (suc m) (suc (suc n)) (evenOrOdd (suc m)) p) (transp0₂ n m)) r i ; (l = i1) → _⌣ₖ_ {n = suc m} {m = suc (suc n)} ∣ b ∣ₕ ∣ merid a i ∣ₕ}) (gradedComm'-elimCase (suc k) m (suc n) (+-suc m n ∙ +-comm (suc m) n ∙ cong predℕ term) (evenOrOdd (suc m)) p b (merid a i) (~ l))) j help₂ : I → I → I → coHomK _ help₂ l i j = hcomp (λ r → λ { (i = i0) → ∣ north ∣ ; (i = i1) → ∣ north ∣ ; (j = i0) → Kn→ΩKn+1 (suc (suc (n + suc m))) (compPath-filler (gradedComm'-elimCase (suc k) n (suc m) (cong predℕ term) (evenOrOdd (suc n)) q a north) (cong (-ₖ'-gen (suc n) (suc (suc m)) (evenOrOdd (suc n)) q) (transp0₂ m n)) r (~ l)) i ; (j = i1) → Kn→ΩKn+1 (suc (suc (n + suc m))) (compPath-filler (gradedComm'-elimCase (suc k) n (suc m) (cong predℕ term) (evenOrOdd (suc n)) q a south) (cong (-ₖ'-gen (suc n) (suc (suc m)) (evenOrOdd (suc n)) q) (transp0₂ m n)) r (~ l)) i ; (l = i0) → Kn→ΩKn+1 _ (doubleCompPath-filler (sym (cong (-ₖ'-gen (suc n) (suc (suc m)) (evenOrOdd (suc n)) q) (transp0₂ m n))) (λ j → -ₖ'-gen (suc n) (suc (suc m)) (evenOrOdd (suc n)) q (subst coHomK (+'-comm (suc (suc m)) (suc n)) (_⌣ₖ_ {n = suc (suc m)} {m = (suc n)} ∣ merid b j ∣ₕ ∣ a ∣))) (cong (-ₖ'-gen (suc n) (suc (suc m)) (evenOrOdd (suc n)) q) (transp0₂ m n)) r j) i ; (l = i1) → Kn→ΩKn+1 _ (_⌣ₖ_ {n = (suc n)} {m = suc (suc m)} ∣ a ∣ ∣ merid b j ∣ₕ) i}) (hcomp (λ r → λ { (i = i0) → ∣ north ∣ ; (i = i1) → ∣ north ∣ ; (j = i0) → Kn→ΩKn+1 (suc (suc (n + suc m))) (gradedComm'-elimCase (suc k) n (suc m) (cong predℕ term) (evenOrOdd (suc n)) q a north (~ l ∨ ~ r)) i ; (j = i1) → Kn→ΩKn+1 (suc (suc (n + suc m))) (gradedComm'-elimCase (suc k) n (suc m) (cong predℕ term) (evenOrOdd (suc n)) q a south (~ l ∨ ~ r)) i ; (l = i0) → Kn→ΩKn+1 (suc (suc (n + suc m))) (gradedComm'-elimCase (suc k) n (suc m) (cong predℕ term) (evenOrOdd (suc n)) q a (merid b j) i1) i ; (l = i1) → Kn→ΩKn+1 _ (gradedComm'-elimCase (suc k) n (suc m) (cong predℕ term) (evenOrOdd (suc n)) q a (merid b j) (~ r)) i}) (Kn→ΩKn+1 (suc (suc (n + suc m))) (gradedComm'-elimCase (suc k) n (suc m) (cong predℕ term) (evenOrOdd (suc n)) q a (merid b j) i1) i)) private coherence-transp : (n m : ℕ) (p : _) (q : _) → -ₖ'-gen (suc n) (suc m) p q (subst coHomK (+'-comm (suc m) (suc n)) (0ₖ (suc m +' suc n))) ≡ 0ₖ _ coherence-transp zero zero p q = refl coherence-transp zero (suc m) p q = refl coherence-transp (suc n) zero p q = refl coherence-transp (suc n) (suc m) p q = refl gradedComm'-⌣ₖ∙ : (n m : ℕ) (p : _) (q : _) (a : _) → ⌣ₖ∙ (suc n) (suc m) a ≡ ((λ b → -ₖ'-gen (suc n) (suc m) p q (subst coHomK (+'-comm (suc m) (suc n)) (b ⌣ₖ a))) , (cong (-ₖ'-gen (suc n) (suc m) p q) (cong (subst coHomK (+'-comm (suc m) (suc n))) (0ₖ-⌣ₖ (suc m) (suc n) a)) ∙ coherence-transp n m p q)) gradedComm'-⌣ₖ∙ n m p q = T.elim (λ _ → isOfHLevelPath (3 + n) ((isOfHLevel↑∙ (suc n) m)) _ _) λ a → →∙Homogeneous≡ (isHomogeneousKn _) (funExt λ b → funExt⁻ (cong fst (f₁≡f₂ b)) a) where f₁ : coHomK (suc m) → S₊∙ (suc n) →∙ coHomK-ptd (suc n +' suc m) fst (f₁ b) a = _⌣ₖ_ {n = suc n} {m = suc m} ∣ a ∣ₕ b snd (f₁ b) = 0ₖ-⌣ₖ (suc n) (suc m) b f₂ : coHomK (suc m) → S₊∙ (suc n) →∙ coHomK-ptd (suc n +' suc m) fst (f₂ b) a = -ₖ'-gen (suc n) (suc m) p q (subst coHomK (+'-comm (suc m) (suc n)) (_⌣ₖ_ {n = suc m} {m = suc n} b ∣ a ∣ₕ)) snd (f₂ b) = (cong (-ₖ'-gen (suc n) (suc m) p q) (cong (subst coHomK (+'-comm (suc m) (suc n))) (⌣ₖ-0ₖ (suc m) (suc n) b)) ∙ coherence-transp n m p q) f₁≡f₂ : (b : _) → f₁ b ≡ f₂ b f₁≡f₂ = T.elim (λ _ → isOfHLevelPath (3 + m) (subst (isOfHLevel (3 + m)) (λ i → S₊∙ (suc n) →∙ coHomK-ptd (+'-comm (suc n) (suc m) (~ i))) (isOfHLevel↑∙' (suc m) n)) _ _) λ b → →∙Homogeneous≡ (isHomogeneousKn _) (funExt λ a → gradedComm'-elimCase (n + m) n m refl p q a b) -- Finally, graded commutativity: gradedComm'-⌣ₖ : (n m : ℕ) (a : coHomK n) (b : coHomK m) → a ⌣ₖ b ≡ (-ₖ'^ n · m) (subst coHomK (+'-comm m n) (b ⌣ₖ a)) gradedComm'-⌣ₖ zero zero a b = sym (transportRefl _) ∙ cong (transport refl) (comm-·₀ a b) gradedComm'-⌣ₖ zero (suc m) a b = sym (transportRefl _) ∙∙ (λ k → subst coHomK (isSetℕ _ _ refl (+'-comm (suc m) zero) k) (b ⌣ₖ a)) ∙∙ sym (-ₖ'-gen-inl-left zero (suc m) tt (evenOrOdd (suc m)) (subst coHomK (+'-comm (suc m) zero) (b ⌣ₖ a))) gradedComm'-⌣ₖ (suc n) zero a b = sym (transportRefl _) ∙∙ ((λ k → subst coHomK (isSetℕ _ _ refl (+'-comm zero (suc n)) k) (b ⌣ₖ a))) ∙∙ sym (-ₖ'-gen-inl-right (suc n) zero (evenOrOdd (suc n)) tt (subst coHomK (+'-comm zero (suc n)) (b ⌣ₖ a))) gradedComm'-⌣ₖ (suc n) (suc m) a b = funExt⁻ (cong fst (gradedComm'-⌣ₖ∙ n m (evenOrOdd (suc n)) (evenOrOdd (suc m)) a)) b gradedComm'-⌣ : {A : Type ℓ} (n m : ℕ) (a : coHom n A) (b : coHom m A) → a ⌣ b ≡ (-ₕ'^ n · m) (subst (λ n → coHom n A) (+'-comm m n) (b ⌣ a)) gradedComm'-⌣ n m = ST.elim2 (λ _ _ → isOfHLevelPath 2 squash₂ _ _) λ f g → cong ∣_∣₂ (funExt (λ x → gradedComm'-⌣ₖ n m (f x) (g x) ∙ cong ((-ₖ'^ n · m) ∘ (subst coHomK (+'-comm m n))) λ i → g (transportRefl x (~ i)) ⌣ₖ f (transportRefl x (~ i)))) ----------------------------------------------------------------------------- -- The previous code introduces another - to facilitate proof -- This a reformulation with the usual -ₕ' definition (the one of the ring) of the results -ₕ^-gen : {k : ℕ} → {A : Type ℓ} → (n m : ℕ) → (p : isEvenT n ⊎ isOddT n) → (q : isEvenT m ⊎ isOddT m) → (a : coHom k A) → coHom k A -ₕ^-gen n m (inl p) q a = a -ₕ^-gen n m (inr p) (inl q) a = a -ₕ^-gen n m (inr p) (inr q) a = -ₕ a -ₕ^_·_ : {k : ℕ} → {A : Type ℓ} → (n m : ℕ) → (a : coHom k A) → coHom k A -ₕ^_·_ n m a = -ₕ^-gen n m (evenOrOdd n) (evenOrOdd m) a -ₕ^-gen-eq : ∀ {ℓ} {k : ℕ} {A : Type ℓ} (n m : ℕ) → (p : isEvenT n ⊎ isOddT n) (q : isEvenT m ⊎ isOddT m) → (x : coHom k A) → -ₕ^-gen n m p q x ≡ (ST.map λ f x → (-ₖ'-gen n m p q) (f x)) x -ₕ^-gen-eq {k = k} n m (inl p) q = ST.elim (λ _ → isSetPathImplicit) λ f → cong ∣_∣₂ (funExt λ x → sym (-ₖ'-gen-inl-left n m p q (f x))) -ₕ^-gen-eq {k = k} n m (inr p) (inl q) = ST.elim (λ _ → isSetPathImplicit) λ f → cong ∣_∣₂ (funExt λ z → sym (-ₖ'-gen-inl-right n m (inr p) q (f z))) -ₕ^-gen-eq {k = k} n m (inr p) (inr q) = ST.elim (λ _ → isSetPathImplicit) λ f → cong ∣_∣₂ (funExt λ z → sym (-ₖ'-gen-inr≡-ₖ' n m p q (f z))) -ₕ^-eq : ∀ {ℓ} {k : ℕ} {A : Type ℓ} (n m : ℕ) → (a : coHom k A) → (-ₕ^ n · m) a ≡ (-ₕ'^ n · m) a -ₕ^-eq n m a = -ₕ^-gen-eq n m (evenOrOdd n) (evenOrOdd m) a gradedComm-⌣ : ∀ {ℓ} {A : Type ℓ} (n m : ℕ) (a : coHom n A) (b : coHom m A) → a ⌣ b ≡ (-ₕ^ n · m) (subst (λ n → coHom n A) (+'-comm m n) (b ⌣ a)) gradedComm-⌣ n m a b = (gradedComm'-⌣ n m a b) ∙ (sym (-ₕ^-eq n m (subst (λ n₁ → coHom n₁ _) (+'-comm m n) (b ⌣ a))))
{ "alphanum_fraction": 0.4246041602, "avg_line_length": 56.8077601411, "ext": "agda", "hexsha": "11866cc169686b648f7bf25515516114ab57dafa", "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/GradedCommutativity.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/GradedCommutativity.agda", "max_line_length": 149, "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/GradedCommutativity.agda", "max_stars_repo_stars_event_max_datetime": null, "max_stars_repo_stars_event_min_datetime": null, "num_tokens": 28108, "size": 64420 }
------------------------------------------------------------------------ -- The Agda standard library -- -- Divisibility ------------------------------------------------------------------------ module Data.Nat.Divisibility where open import Data.Nat as Nat open import Data.Nat.DivMod import Data.Nat.Properties as NatProp open import Data.Fin as Fin using (Fin; zero; suc) import Data.Fin.Properties as FP open NatProp.SemiringSolver open import Algebra private module CS = CommutativeSemiring NatProp.commutativeSemiring open import Data.Product open import Relation.Nullary open import Relation.Binary import Relation.Binary.PartialOrderReasoning as PartialOrderReasoning open import Relation.Binary.PropositionalEquality as PropEq using (_≡_; _≢_; refl; sym; cong; subst) open import Function -- m ∣ n is inhabited iff m divides n. Some sources, like Hardy and -- Wright's "An Introduction to the Theory of Numbers", require m to -- be non-zero. However, some things become a bit nicer if m is -- allowed to be zero. For instance, _∣_ becomes a partial order, and -- the gcd of 0 and 0 becomes defined. infix 4 _∣_ data _∣_ : ℕ → ℕ → Set where divides : {m n : ℕ} (q : ℕ) (eq : n ≡ q * m) → m ∣ n -- Extracts the quotient. quotient : ∀ {m n} → m ∣ n → ℕ quotient (divides q _) = q -- If m divides n, and n is positive, then m ≤ n. ∣⇒≤ : ∀ {m n} → m ∣ suc n → m ≤ suc n ∣⇒≤ (divides zero ()) ∣⇒≤ {m} {n} (divides (suc q) eq) = begin m ≤⟨ NatProp.m≤m+n m (q * m) ⟩ suc q * m ≡⟨ sym eq ⟩ suc n ∎ where open ≤-Reasoning -- _∣_ is a partial order. poset : Poset _ _ _ poset = record { Carrier = ℕ ; _≈_ = _≡_ ; _≤_ = _∣_ ; isPartialOrder = record { isPreorder = record { isEquivalence = PropEq.isEquivalence ; reflexive = reflexive ; trans = trans } ; antisym = antisym } } where module DTO = DecTotalOrder Nat.decTotalOrder open PropEq.≡-Reasoning reflexive : _≡_ ⇒ _∣_ reflexive {n} refl = divides 1 (sym $ proj₁ CS.*-identity n) antisym : Antisymmetric _≡_ _∣_ antisym (divides {n = zero} q₁ eq₁) (divides {n = n₂} q₂ eq₂) = begin n₂ ≡⟨ eq₂ ⟩ q₂ * 0 ≡⟨ CS.*-comm q₂ 0 ⟩ 0 ∎ antisym (divides {n = n₁} q₁ eq₁) (divides {n = zero} q₂ eq₂) = begin 0 ≡⟨ CS.*-comm 0 q₁ ⟩ q₁ * 0 ≡⟨ sym eq₁ ⟩ n₁ ∎ antisym (divides {n = suc n₁} q₁ eq₁) (divides {n = suc n₂} q₂ eq₂) = DTO.antisym (∣⇒≤ (divides q₁ eq₁)) (∣⇒≤ (divides q₂ eq₂)) trans : Transitive _∣_ trans (divides q₁ refl) (divides q₂ refl) = divides (q₂ * q₁) (sym (CS.*-assoc q₂ q₁ _)) module ∣-Reasoning = PartialOrderReasoning poset renaming (_≤⟨_⟩_ to _∣⟨_⟩_; _≈⟨_⟩_ to _≡⟨_⟩_) private module P = Poset poset -- 1 divides everything. 1∣_ : ∀ n → 1 ∣ n 1∣ n = divides n (sym $ proj₂ CS.*-identity n) -- Everything divides 0. _∣0 : ∀ n → n ∣ 0 n ∣0 = divides 0 refl -- 0 only divides 0. 0∣⇒≡0 : ∀ {n} → 0 ∣ n → n ≡ 0 0∣⇒≡0 {n} 0∣n = P.antisym (n ∣0) 0∣n -- Only 1 divides 1. ∣1⇒≡1 : ∀ {n} → n ∣ 1 → n ≡ 1 ∣1⇒≡1 {n} n∣1 = P.antisym n∣1 (1∣ n) -- If i divides m and n, then i divides their sum. ∣-+ : ∀ {i m n} → i ∣ m → i ∣ n → i ∣ m + n ∣-+ (divides {m = i} q refl) (divides q' refl) = divides (q + q') (sym $ proj₂ CS.distrib i q q') -- If i divides m and n, then i divides their difference. ∣-∸ : ∀ {i m n} → i ∣ m + n → i ∣ m → i ∣ n ∣-∸ (divides {m = i} q' eq) (divides q refl) = divides (q' ∸ q) (sym $ NatProp.im≡jm+n⇒[i∸j]m≡n q' q i _ $ sym eq) -- A simple lemma: n divides kn. ∣-* : ∀ k {n} → n ∣ k * n ∣-* k = divides k refl -- If i divides j, then ki divides kj. *-cong : ∀ {i j} k → i ∣ j → k * i ∣ k * j *-cong {i} {j} k (divides q eq) = divides q lemma where open PropEq.≡-Reasoning lemma = begin k * j ≡⟨ cong (_*_ k) eq ⟩ k * (q * i) ≡⟨ solve 3 (λ k q i → k :* (q :* i) := q :* (k :* i)) refl k q i ⟩ q * (k * i) ∎ -- If ki divides kj, and k is positive, then i divides j. /-cong : ∀ {i j} k → suc k * i ∣ suc k * j → i ∣ j /-cong {i} {j} k (divides q eq) = divides q lemma where open PropEq.≡-Reasoning k′ = suc k lemma = NatProp.cancel-*-right j (q * i) (begin j * k′ ≡⟨ CS.*-comm j k′ ⟩ k′ * j ≡⟨ eq ⟩ q * (k′ * i) ≡⟨ solve 3 (λ q k i → q :* (k :* i) := q :* i :* k) refl q k′ i ⟩ q * i * k′ ∎) -- If the remainder after division is non-zero, then the divisor does -- not divide the dividend. nonZeroDivisor-lemma : ∀ m q (r : Fin (1 + m)) → Fin.toℕ r ≢ 0 → ¬ (1 + m) ∣ (Fin.toℕ r + q * (1 + m)) nonZeroDivisor-lemma m zero r r≢zero (divides zero eq) = r≢zero $ begin Fin.toℕ r ≡⟨ sym $ proj₁ CS.*-identity (Fin.toℕ r) ⟩ 1 * Fin.toℕ r ≡⟨ eq ⟩ 0 ∎ where open PropEq.≡-Reasoning nonZeroDivisor-lemma m zero r r≢zero (divides (suc q) eq) = NatProp.¬i+1+j≤i m $ begin m + suc (q * suc m) ≡⟨ solve 2 (λ m q → m :+ (con 1 :+ q) := con 1 :+ m :+ q) refl m (q * suc m) ⟩ suc (m + q * suc m) ≡⟨ sym eq ⟩ 1 * Fin.toℕ r ≡⟨ proj₁ CS.*-identity (Fin.toℕ r) ⟩ Fin.toℕ r ≤⟨ ≤-pred $ FP.bounded r ⟩ m ∎ where open ≤-Reasoning nonZeroDivisor-lemma m (suc q) r r≢zero d = nonZeroDivisor-lemma m q r r≢zero (∣-∸ d' P.refl) where lem = solve 3 (λ m r q → r :+ (m :+ q) := m :+ (r :+ q)) refl (suc m) (Fin.toℕ r) (q * suc m) d' = subst (λ x → (1 + m) ∣ x) lem d -- Divisibility is decidable. _∣?_ : Decidable _∣_ zero ∣? zero = yes (0 ∣0) zero ∣? suc n = no ((λ ()) ∘′ 0∣⇒≡0) suc m ∣? n with n divMod suc m suc m ∣? .(q * suc m) | result q zero refl = yes $ divides q refl suc m ∣? .(1 + Fin.toℕ r + q * suc m) | result q (suc r) refl = no $ nonZeroDivisor-lemma m q (suc r) (λ())
{ "alphanum_fraction": 0.5202129429, "avg_line_length": 29.038647343, "ext": "agda", "hexsha": "59850d6559e7539eea9852732172275af6c80e10", "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/Nat/Divisibility.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/Nat/Divisibility.agda", "max_line_length": 72, "max_stars_count": 1, "max_stars_repo_head_hexsha": "9d4c43b1609d3f085636376fdca73093481ab882", "max_stars_repo_licenses": [ "Apache-2.0" ], "max_stars_repo_name": "qwe2/try-agda", "max_stars_repo_path": "agda-stdlib-0.9/src/Data/Nat/Divisibility.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": 2411, "size": 6011 }
------------------------------------------------------------------------ -- An alternative (non-standard) classical definition of weak -- bisimilarity ------------------------------------------------------------------------ -- This definition is based on the function "wb" in Section 6.5.1 of -- Pous and Sangiorgi's "Enhancements of the bisimulation proof -- method". {-# OPTIONS --sized-types #-} open import Labelled-transition-system module Bisimilarity.Weak.Alternative.Classical {ℓ} (lts : LTS ℓ) where open import Prelude import Bisimilarity.Classical open LTS lts -- We get weak bisimilarity by instantiating strong bisimilarity with -- a different LTS. private module WB = Bisimilarity.Classical (weak lts) open WB public using (⟪_,_⟫) renaming ( Bisimulation to Weak-bisimulation ; Bisimilarity′ to Weak-bisimilarity′ ; Bisimilarity to Weak-bisimilarity ; _∼_ to _≈_ )
{ "alphanum_fraction": 0.5941114616, "avg_line_length": 27.1714285714, "ext": "agda", "hexsha": "e34e6367e2ad4618c78292c955c63e40d0e13bc9", "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": "b936ff85411baf3401ad85ce85d5ff2e9aa0ca14", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "nad/up-to", "max_forks_repo_path": "src/Bisimilarity/Weak/Alternative/Classical.agda", "max_issues_count": null, "max_issues_repo_head_hexsha": "b936ff85411baf3401ad85ce85d5ff2e9aa0ca14", "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/up-to", "max_issues_repo_path": "src/Bisimilarity/Weak/Alternative/Classical.agda", "max_line_length": 72, "max_stars_count": null, "max_stars_repo_head_hexsha": "b936ff85411baf3401ad85ce85d5ff2e9aa0ca14", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "nad/up-to", "max_stars_repo_path": "src/Bisimilarity/Weak/Alternative/Classical.agda", "max_stars_repo_stars_event_max_datetime": null, "max_stars_repo_stars_event_min_datetime": null, "num_tokens": 222, "size": 951 }
------------------------------------------------------------------------------ -- Properties related with the group commutator ------------------------------------------------------------------------------ {-# OPTIONS --exact-split #-} {-# OPTIONS --no-sized-types #-} {-# OPTIONS --no-universe-polymorphism #-} {-# OPTIONS --without-K #-} module GroupTheory.Commutator.PropertiesATP where open import GroupTheory.Base open import GroupTheory.Commutator ------------------------------------------------------------------------------ -- From: A. G. Kurosh. The Theory of Groups, vol. 1. Chelsea Publising -- Company, 2nd edition, 1960. p. 99. postulate commutatorInverse : ∀ a b → [ a , b ] · [ b , a ] ≡ ε {-# ATP prove commutatorInverse #-} -- If the commutator is associative, then commutator of any two -- elements lies in the center of the group, i.e. a [b,c] = [b,c] a. -- From: TPTP 6.4.0 problem GRP/GRP024-5.p. postulate commutatorAssocCenter : (∀ a b c → commutatorAssoc a b c) → (∀ a b c → a · [ b , c ] ≡ [ b , c ] · a) {-# ATP prove commutatorAssocCenter #-}
{ "alphanum_fraction": 0.4873803307, "avg_line_length": 41.0357142857, "ext": "agda", "hexsha": "4c7c4b22d7e30e41032573c5c7c72768acb8e425", "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/GroupTheory/Commutator/PropertiesATP.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/GroupTheory/Commutator/PropertiesATP.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/GroupTheory/Commutator/PropertiesATP.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": 271, "size": 1149 }
-- 2014-01-01 Andreas, test case constructed by Christian Sattler {-# OPTIONS --allow-unsolved-metas #-} -- unguarded recursive record record R : Set where constructor cons field r : R postulate F : (R → Set) → Set q : (∀ P → F P) → (∀ P → F P) q h P = h (λ {(cons x) → {!!}}) -- ISSUE WAS: Bug in implementation of eta-expansion of projected var, -- leading to loop in Agda.
{ "alphanum_fraction": 0.6323907455, "avg_line_length": 21.6111111111, "ext": "agda", "hexsha": "6b75339fd73f513fd0a79812d189c456c14ce299", "lang": "Agda", "max_forks_count": 1, "max_forks_repo_forks_event_max_datetime": "2022-03-12T11:35:18.000Z", "max_forks_repo_forks_event_min_datetime": "2022-03-12T11:35:18.000Z", "max_forks_repo_head_hexsha": "70c8a575c46f6a568c7518150a1a64fcd03aa437", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "masondesu/agda", "max_forks_repo_path": "test/succeed/Issue376Loop.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/Issue376Loop.agda", "max_line_length": 70, "max_stars_count": 1, "max_stars_repo_head_hexsha": "477c8c37f948e6038b773409358fd8f38395f827", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "larrytheliquid/agda", "max_stars_repo_path": "test/succeed/Issue376Loop.agda", "max_stars_repo_stars_event_max_datetime": "2018-10-10T17:08:44.000Z", "max_stars_repo_stars_event_min_datetime": "2018-10-10T17:08:44.000Z", "num_tokens": 120, "size": 389 }
------------------------------------------------------------------------ -- The Agda standard library -- -- Examples of format strings and printf ------------------------------------------------------------------------ {-# OPTIONS --safe --without-K #-} module README.Text.Printf where open import Data.Nat.Base open import Data.Char.Base open import Data.List.Base open import Data.String.Base open import Data.Sum.Base open import Relation.Binary.PropositionalEquality ------------------------------------------------------------------------ -- Format strings open import Text.Format -- We can specify a format by writing a string which will get interpreted -- by a lexer into a list of formatting directives. -- The specification types are always started with a '%' character: -- Integers (%d or %i) -- Naturals (%u) -- Floats (%f) -- Chars (%c) -- Strings (%s) -- Anything which is not a type specification is a raw string to be spliced -- in the output of printf. -- For instance the following format alternates types and raw strings _ : lexer "%s: %u + %u ≡ %u" ≡ inj₂ (`String ∷ Raw ": " ∷ `ℕ ∷ Raw " + " ∷ `ℕ ∷ Raw " ≡ " ∷ `ℕ ∷ []) _ = refl -- Lexing can fail. There are two possible errors: -- If we start a specification type with a '%' but the string ends then -- we get an UnexpectedEndOfString error _ : lexer "%s: %u + %u ≡ %" ≡ inj₁ (UnexpectedEndOfString "%s: %u + %u ≡ %") _ = refl -- If we start a specification type with a '%' and the following character -- does not correspond to an existing type, we get an InvalidType error -- together with a focus highlighting the position of the problematic type. _ : lexer "%s: %u + %a ≡ %u" ≡ inj₁ (InvalidType "%s: %u + %" 'a' " ≡ %u") _ = refl ------------------------------------------------------------------------ -- Printf open import Text.Printf -- printf is a function which takes a format string as an argument and -- returns a function expecting a value for each type specification present -- in the format and returns a string splicing in these values into the -- format string. -- For instance `printf "%s: %u + %u ≡ %u"` is a -- `String → ℕ → ℕ → ℕ → String` function. _ : String → ℕ → ℕ → ℕ → String _ = printf "%s: %u + %u ≡ %u" _ : printf "%s: %u + %u ≡ %u" "example" 3 2 5 ≡ "example: 3 + 2 ≡ 5" _ = refl -- If the format string str is invalid then `printf str` will have type -- `Error e` where `e` is the lexing error. _ : Text.Printf.Error (UnexpectedEndOfString "%s: %u + %u ≡ %") _ = printf "%s: %u + %u ≡ %" _ : Text.Printf.Error (InvalidType "%s: %u + %" 'a' " ≡ %u") _ = printf "%s: %u + %a ≡ %u" -- Trying to pass arguments to such an ̀Error` type will lead to a -- unification error which hopefully makes the problem clear e.g. -- `printf "%s: %u + %a ≡ %u" "example" 3 2 5` fails with the error: -- Text.Printf.Error (InvalidType "%s: %u + %" 'a' " ≡ %u") should be -- a function type, but it isn't -- when checking that "example" 3 2 5 are valid arguments to a -- function of type Text.Printf.Printf (lexer "%s: %u + %a ≡ %u")
{ "alphanum_fraction": 0.5886200131, "avg_line_length": 31.2040816327, "ext": "agda", "hexsha": "638962ee50fc895327ae09ba4bb4d3c183e307b4", "lang": "Agda", "max_forks_count": 1, "max_forks_repo_forks_event_max_datetime": "2021-11-04T06:54:45.000Z", "max_forks_repo_forks_event_min_datetime": "2021-11-04T06:54:45.000Z", "max_forks_repo_head_hexsha": "fb380f2e67dcb4a94f353dbaec91624fcb5b8933", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "DreamLinuxer/popl21-artifact", "max_forks_repo_path": "agda-stdlib/README/Text/Printf.agda", "max_issues_count": null, "max_issues_repo_head_hexsha": "fb380f2e67dcb4a94f353dbaec91624fcb5b8933", "max_issues_repo_issues_event_max_datetime": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_licenses": [ "MIT" ], "max_issues_repo_name": "DreamLinuxer/popl21-artifact", "max_issues_repo_path": "agda-stdlib/README/Text/Printf.agda", "max_line_length": 75, "max_stars_count": 5, "max_stars_repo_head_hexsha": "fb380f2e67dcb4a94f353dbaec91624fcb5b8933", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "DreamLinuxer/popl21-artifact", "max_stars_repo_path": "agda-stdlib/README/Text/Printf.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": 837, "size": 3058 }
module Inference-of-implicit-function-space where postulate _⇔_ : Set → Set → Set equivalence : {A B : Set} → (A → B) → (B → A) → A ⇔ B A : Set P : Set P = {x : A} → A ⇔ A works : P ⇔ P works = equivalence (λ r {x} → r {x = x}) (λ r {x} → r {x = x}) works₂ : P ⇔ P works₂ = equivalence {A = P} (λ r {x} → r {x = x}) (λ r {y} → r {y}) fails : P ⇔ P fails = equivalence (λ r {x} → r {x = x}) (λ r {y} → r {y})
{ "alphanum_fraction": 0.4691075515, "avg_line_length": 23, "ext": "agda", "hexsha": "56d8c1fa55202968349a519d1fa1dd17b65faa92", "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/Inference-of-implicit-function-space.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/Inference-of-implicit-function-space.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/Inference-of-implicit-function-space.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": 188, "size": 437 }
{-# OPTIONS --safe #-} open import Definition.Typed.EqualityRelation module Definition.LogicalRelation.Substitution.Introductions.Transp {{eqrel : EqRelSet}} where open EqRelSet {{...}} open import Definition.Untyped as U hiding (wk) open import Definition.Untyped.Properties open import Definition.Typed open import Definition.Typed.Properties open import Definition.Typed.Weakening as T hiding (wk; wkTerm; wkEqTerm) open import Definition.Typed.RedSteps open import Definition.LogicalRelation open import Definition.LogicalRelation.ShapeView open import Definition.LogicalRelation.Irrelevance as I open import Definition.LogicalRelation.Weakening open import Definition.LogicalRelation.Properties open import Definition.LogicalRelation.Application open import Definition.LogicalRelation.Substitution open import Definition.LogicalRelation.Substitution.Properties open import Definition.LogicalRelation.Substitution.Irrelevance as S open import Definition.LogicalRelation.Substitution.Reflexivity open import Definition.LogicalRelation.Substitution.Introductions.Sigma open import Definition.LogicalRelation.Substitution.Introductions.Fst open import Definition.LogicalRelation.Substitution.Introductions.Pi open import Definition.LogicalRelation.Substitution.Introductions.Lambda open import Definition.LogicalRelation.Substitution.Introductions.Application open import Definition.LogicalRelation.Substitution.Introductions.Cast open import Definition.LogicalRelation.Substitution.Introductions.Id open import Definition.LogicalRelation.Substitution.Introductions.SingleSubst open import Definition.LogicalRelation.Substitution.MaybeEmbed open import Definition.LogicalRelation.Substitution.Escape open import Definition.LogicalRelation.Substitution.Introductions.Universe open import Definition.LogicalRelation.Substitution.Reduction open import Definition.LogicalRelation.Substitution.Weakening open import Definition.LogicalRelation.Substitution.ProofIrrelevance open import Tools.Product import Tools.PropositionalEquality as PE IdSymᵗᵛ : ∀ {A l t u e Γ} ([Γ] : ⊩ᵛ Γ) ([U] : Γ ⊩ᵛ⟨ ∞ ⟩ U l ^ [ ! , next l ] / [Γ]) ([AU] : Γ ⊩ᵛ⟨ ∞ ⟩ A ∷ U l ^ [ ! , next l ] / [Γ] / [U]) ([A] : Γ ⊩ᵛ⟨ ∞ ⟩ A ^ [ ! , ι l ] / [Γ]) ([t] : Γ ⊩ᵛ⟨ ∞ ⟩ t ∷ A ^ [ ! , ι l ] / [Γ] / [A]) ([u] : Γ ⊩ᵛ⟨ ∞ ⟩ u ∷ A ^ [ ! , ι l ] / [Γ] / [A]) ([Id] : Γ ⊩ᵛ⟨ ∞ ⟩ Id A t u ^ [ % , ι l ] / [Γ]) → ([Idinv] : Γ ⊩ᵛ⟨ ∞ ⟩ Id A u t ^ [ % , ι l ] / [Γ]) → ([e] : Γ ⊩ᵛ⟨ ∞ ⟩ e ∷ Id A t u ^ [ % , ι l ] / [Γ] / [Id] ) → Γ ⊩ᵛ⟨ ∞ ⟩ Idsym A t u e ∷ Id A u t ^ [ % , ι l ] / [Γ] / [Idinv] IdSymᵗᵛ {A} {l} {t} {u} {e} {Γ} [Γ] [U] [AU] [A] [t] [u] [Id] [Idinv] [e] = validityIrr {A = Id A u t} {t = Idsym A t u e} [Γ] [Idinv] λ {Δ} {σ} ⊢Δ [σ] → PE.subst (λ X → Δ ⊢ X ∷ subst σ (Id A u t) ^ [ % , ι l ] ) (PE.sym (subst-Idsym σ A t u e)) (Idsymⱼ {A = subst σ A} {x = subst σ t} {y = subst σ u} (escapeTerm (proj₁ ([U] {Δ} {σ} ⊢Δ [σ])) (proj₁ ([AU] ⊢Δ [σ]))) (escapeTerm (proj₁ ([A] {Δ} {σ} ⊢Δ [σ])) (proj₁ ([t] ⊢Δ [σ]))) (escapeTerm (proj₁ ([A] {Δ} {σ} ⊢Δ [σ])) (proj₁ ([u] ⊢Δ [σ]))) (escapeTerm (proj₁ ([Id] {Δ} {σ} ⊢Δ [σ])) (proj₁ ([e] ⊢Δ [σ])))) abstract transpᵗᵛ : ∀ {A P l t s u e Γ} ([Γ] : ⊩ᵛ Γ) ([A] : Γ ⊩ᵛ⟨ ∞ ⟩ A ^ [ ! , l ] / [Γ]) ([P] : Γ ∙ A ^ [ ! , l ] ⊩ᵛ⟨ ∞ ⟩ P ^ [ % , l ] / (_∙_ {A = A} [Γ] [A])) ([t] : Γ ⊩ᵛ⟨ ∞ ⟩ t ∷ A ^ [ ! , l ] / [Γ] / [A]) ([s] : Γ ⊩ᵛ⟨ ∞ ⟩ s ∷ P [ t ] ^ [ % , l ] / [Γ] / substS {A} {P} {t} [Γ] [A] [P] [t]) ([u] : Γ ⊩ᵛ⟨ ∞ ⟩ u ∷ A ^ [ ! , l ] / [Γ] / [A]) ([Id] : Γ ⊩ᵛ⟨ ∞ ⟩ Id A t u ^ [ % , l ] / [Γ]) → ([e] : Γ ⊩ᵛ⟨ ∞ ⟩ e ∷ Id A t u ^ [ % , l ] / [Γ] / [Id] ) → Γ ⊩ᵛ⟨ ∞ ⟩ transp A P t s u e ∷ P [ u ] ^ [ % , l ] / [Γ] / substS {A} {P} {u} [Γ] [A] [P] [u] transpᵗᵛ {A} {P} {l} {t} {s} {u} {e} {Γ} [Γ] [A] [P] [t] [s] [u] [Id] [e] = validityIrr {A = P [ u ]} {t = transp A P t s u e } [Γ] (substS {A} {P} {u} [Γ] [A] [P] [u]) λ {Δ} {σ} ⊢Δ [σ] → let [liftσ] = liftSubstS {F = A} [Γ] ⊢Δ [A] [σ] [A]σ = proj₁ ([A] {Δ} {σ} ⊢Δ [σ]) [P[t]]σ = I.irrelevance′ (singleSubstLift P t) (proj₁ (substS {A} {P} {t} [Γ] [A] [P] [t] {Δ} {σ} ⊢Δ [σ])) X = transpⱼ (escape [A]σ) (escape (proj₁ ([P] {Δ ∙ subst σ A ^ [ ! , l ]} {liftSubst σ} (⊢Δ ∙ (escape [A]σ)) [liftσ]))) (escapeTerm [A]σ (proj₁ ([t] ⊢Δ [σ]))) (escapeTerm [P[t]]σ (I.irrelevanceTerm′ (singleSubstLift P t) PE.refl PE.refl (proj₁ (substS {A} {P} {t} [Γ] [A] [P] [t] {Δ} {σ} ⊢Δ [σ])) [P[t]]σ (proj₁ ([s] ⊢Δ [σ])))) (escapeTerm [A]σ (proj₁ ([u] ⊢Δ [σ]))) (escapeTerm (proj₁ ([Id] {Δ} {σ} ⊢Δ [σ])) (proj₁ ([e] ⊢Δ [σ]))) in PE.subst (λ X → Δ ⊢ transp (subst σ A) ( subst (liftSubst σ) P) (subst σ t) (subst σ s) (subst σ u) (subst σ e) ∷ X ^ [ % , l ] ) (PE.sym (singleSubstLift P u)) X
{ "alphanum_fraction": 0.5627016129, "avg_line_length": 62, "ext": "agda", "hexsha": "7e209ba0ca1597da34023e7a9e18d3e819225535", "lang": "Agda", "max_forks_count": 2, "max_forks_repo_forks_event_max_datetime": "2022-02-15T19:42:19.000Z", "max_forks_repo_forks_event_min_datetime": "2022-01-26T14:55:51.000Z", "max_forks_repo_head_hexsha": "e0eeebc4aa5ed791ce3e7c0dc9531bd113dfcc04", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "CoqHott/logrel-mltt", "max_forks_repo_path": "Definition/LogicalRelation/Substitution/Introductions/Transp.agda", "max_issues_count": null, "max_issues_repo_head_hexsha": "e0eeebc4aa5ed791ce3e7c0dc9531bd113dfcc04", "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": "CoqHott/logrel-mltt", "max_issues_repo_path": "Definition/LogicalRelation/Substitution/Introductions/Transp.agda", "max_line_length": 236, "max_stars_count": 2, "max_stars_repo_head_hexsha": "e0eeebc4aa5ed791ce3e7c0dc9531bd113dfcc04", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "CoqHott/logrel-mltt", "max_stars_repo_path": "Definition/LogicalRelation/Substitution/Introductions/Transp.agda", "max_stars_repo_stars_event_max_datetime": "2022-01-17T16:13:53.000Z", "max_stars_repo_stars_event_min_datetime": "2018-06-21T08:39:01.000Z", "num_tokens": 2029, "size": 4960 }
-------------------------------------------------------------------------------- -- This is part of Agda Inference Systems {-# OPTIONS --sized-types --guardedness #-} open import Data.Product open import Data.Vec open import Codata.Colist as Colist open import Agda.Builtin.Equality open import Size open import Codata.Thunk open import Data.Fin open import Data.Nat open import Data.Maybe open import Examples.Colists.Auxiliary.Colist_member open import is-lib.InfSys module Examples.Colists.member {A : Set} where U = A × Colist A ∞ data memberRN : Set where mem-h mem-t : memberRN mem-h-r : FinMetaRule U mem-h-r .Ctx = A × Thunk (Colist A) ∞ mem-h-r .comp (x , xs) = [] , ---------------- (x , x ∷ xs) mem-t-r : FinMetaRule U mem-t-r .Ctx = A × A × Thunk (Colist A) ∞ mem-t-r .comp (x , y , xs) = ((x , xs .force) ∷ []) , ---------------- (x , y ∷ xs) memberIS : IS U memberIS .Names = memberRN memberIS .rules mem-h = from mem-h-r memberIS .rules mem-t = from mem-t-r _member_ : A → Colist A ∞ → Set x member xs = Ind⟦ memberIS ⟧ (x , xs) memSpec : U → Set memSpec (x , xs) = Σ[ i ∈ ℕ ] (Colist.lookup i xs ≡ just x) memSpecClosed : ISClosed memberIS memSpec memSpecClosed mem-h _ _ = zero , refl memSpecClosed mem-t _ pr = let (i , proof) = pr Fin.zero in (suc i) , proof memberSound : ∀{x xs} → x member xs → memSpec (x , xs) memberSound = ind[ memberIS ] memSpec memSpecClosed -- Completeness using memSpec does not terminate -- Product implemented as record. Record projections do not decrease memSpec' : U → ℕ → Set memSpec' (x , xs) i = Colist.lookup i xs ≡ just x memberCompl : ∀{x xs i} → memSpec' (x , xs) i → x member xs memberCompl {.x} {x ∷ _} {zero} refl = apply-ind mem-h _ λ () memberCompl {x} {y ∷ xs} {suc i} eq = apply-ind mem-t _ λ{zero → memberCompl eq} memberComplete : ∀{x xs} → memSpec (x , xs) → x member xs memberComplete (i , eq) = memberCompl eq {- Correctness wrt to Agda DataType -} ∈-sound : ∀{x xs} → x ∈ xs → x member xs ∈-sound here = apply-ind mem-h _ λ () ∈-sound (there mem) = apply-ind mem-t _ λ{zero → ∈-sound mem} ∈-complete : ∀{x xs} → x member xs → x ∈ xs ∈-complete (fold (mem-h , _ , refl , _)) = here ∈-complete (fold (mem-t , _ , refl , prem)) = there (∈-complete (prem zero))
{ "alphanum_fraction": 0.5938161796, "avg_line_length": 29.5125, "ext": "agda", "hexsha": "b6b83f1de4cc9b67683f078537046fbcfc313bf4", "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": "b9043f99e4bf7211db4066a7a943401d127f0c8f", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "LcicC/inference-systems-agda", "max_forks_repo_path": "Examples/Colists/member.agda", "max_issues_count": null, "max_issues_repo_head_hexsha": "b9043f99e4bf7211db4066a7a943401d127f0c8f", "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": "LcicC/inference-systems-agda", "max_issues_repo_path": "Examples/Colists/member.agda", "max_line_length": 82, "max_stars_count": 3, "max_stars_repo_head_hexsha": "b9043f99e4bf7211db4066a7a943401d127f0c8f", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "LcicC/inference-systems-agda", "max_stars_repo_path": "Examples/Colists/member.agda", "max_stars_repo_stars_event_max_datetime": "2022-03-25T15:48:52.000Z", "max_stars_repo_stars_event_min_datetime": "2022-03-10T15:53:47.000Z", "num_tokens": 778, "size": 2361 }
{-# OPTIONS --cubical-compatible #-} open import Common.Prelude open import Common.Equality open import Common.Product data _≅_ {A : Set} (a : A) : {B : Set} (b : B) → Set₁ where refl : a ≅ a data D : Bool → Set where x : D true y : D false P : Set -> Set₁ P S = Σ S (\s → s ≅ x) pbool : P (D true) pbool = _ , refl ¬pfin : P (D false) → ⊥ ¬pfin (y , ())
{ "alphanum_fraction": 0.5679347826, "avg_line_length": 17.5238095238, "ext": "agda", "hexsha": "c1b00be20b1e195fd107d963b558085d4b05c7fe", "lang": "Agda", "max_forks_count": null, "max_forks_repo_forks_event_max_datetime": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_head_hexsha": "98c9382a59f707c2c97d75919e389fc2a783ac75", "max_forks_repo_licenses": [ "BSD-2-Clause" ], "max_forks_repo_name": "KDr2/agda", "max_forks_repo_path": "test/Fail/Issue1408b.agda", "max_issues_count": 6, "max_issues_repo_head_hexsha": "98c9382a59f707c2c97d75919e389fc2a783ac75", "max_issues_repo_issues_event_max_datetime": "2021-11-24T08:31:10.000Z", "max_issues_repo_issues_event_min_datetime": "2021-10-18T08:12:24.000Z", "max_issues_repo_licenses": [ "BSD-2-Clause" ], "max_issues_repo_name": "KDr2/agda", "max_issues_repo_path": "test/Fail/Issue1408b.agda", "max_line_length": 59, "max_stars_count": null, "max_stars_repo_head_hexsha": "98c9382a59f707c2c97d75919e389fc2a783ac75", "max_stars_repo_licenses": [ "BSD-2-Clause" ], "max_stars_repo_name": "KDr2/agda", "max_stars_repo_path": "test/Fail/Issue1408b.agda", "max_stars_repo_stars_event_max_datetime": null, "max_stars_repo_stars_event_min_datetime": null, "num_tokens": 142, "size": 368 }

NOTE: Please see EleutherAI/proof-pile-2

This is a cherry-picked repackaging of the algebraic-stack segment from the proof-pile-2 dataset as parquet files

License

see EleutherAI/proof-pile-2

Citation

see EleutherAI/proof-pile-2

Downloads last month
193
Edit dataset card