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
} |
{-# OPTIONS --without-K --safe #-}
open import Categories.Category.Monoidal.Bundle
using (SymmetricMonoidalCategory)
module Categories.Category.Construction.SymmetricMonoidalFunctors
{o ℓ e o′ ℓ′ e′}
(C : SymmetricMonoidalCategory o ℓ e)
(D : SymmetricMonoidalCategory o′ ℓ′ e′) where
-- The symmetric monoidal category [C , D] of symmetric monoidal
-- functors between the symmetric monoidal categories C and D.
open import Level
open import Data.Product using (_,_; uncurry′)
open import Categories.Category using (Category)
open import Categories.Category.Monoidal
open import Categories.Category.Monoidal.Braided using (Braided)
open import Categories.Category.Monoidal.Symmetric using (Symmetric)
import Categories.Functor.Monoidal.Symmetric as SMF
import Categories.Functor.Monoidal.PointwiseTensor as PT
import Categories.NaturalTransformation.Monoidal.Symmetric as SMNT
open import Categories.NaturalTransformation.NaturalIsomorphism using (niHelper)
import Categories.NaturalTransformation.NaturalIsomorphism.Monoidal.Symmetric as SMNI
open import Categories.Functor.Bifunctor using (Bifunctor)
import Categories.Morphism as Morphism
open SymmetricMonoidalCategory D
module Lax where
open SMF.Lax
open SMNT.Lax renaming (id to idNT)
-- The category of symmetric monoidal functors.
MonoidalFunctorsU : Category (o ⊔ ℓ ⊔ e ⊔ o′ ⊔ ℓ′ ⊔ e′) (o ⊔ ℓ ⊔ ℓ′ ⊔ e′)
(o ⊔ e′)
MonoidalFunctorsU = record
{ Obj = SymmetricMonoidalFunctor C D
; _⇒_ = SymmetricMonoidalNaturalTransformation
; _≈_ = λ α β → ∀ {X} → η α X ≈ η β X
; id = idNT
; _∘_ = _∘ᵥ_
; assoc = assoc
; sym-assoc = sym-assoc
; identityˡ = identityˡ
; identityʳ = identityʳ
; identity² = identity²
; equiv = record
{ refl = Equiv.refl
; sym = λ α≈β → Equiv.sym α≈β
; trans = λ α≈β β≈γ → Equiv.trans α≈β β≈γ
}
; ∘-resp-≈ = λ α₁≈β₁ α₂≈β₂ → ∘-resp-≈ α₁≈β₁ α₂≈β₂
}
where open SymmetricMonoidalNaturalTransformation using (η)
open SMNI.Lax using (_≃_)
open Morphism MonoidalFunctorsU using (_≅_)
-- Symmetric natural isos are isos in the functor category.
≃⇒≅ : ∀ {F G : SymmetricMonoidalFunctor C D} → F ≃ G → F ≅ G
≃⇒≅ ni = record
{ from = ni.F⇒G-monoidal
; to = ni.F⇐G-monoidal
; iso = record
{ isoˡ = λ {X} → ni.iso.isoˡ X
; isoʳ = λ {X} → ni.iso.isoʳ X
}
}
where module ni = SMNI.Lax.SymmetricMonoidalNaturalIsomorphism ni
open PT.Lax
MonoidalFunctorsU-monoidal : Monoidal MonoidalFunctorsU
MonoidalFunctorsU-monoidal = monoidalHelper MonoidalFunctorsU (record
{ ⊗ = record
{ F₀ = uncurry′ _⊗̇₀_
; F₁ = uncurry′ _⊗̇₁_
; identity = ⊗.identity
; homomorphism = ⊗.homomorphism
; F-resp-≈ = λ{ (eq₁ , eq₂) → ⊗.F-resp-≈ (eq₁ , eq₂) }
}
; unit = unitF
; unitorˡ = λ {F} → ≃⇒≅ (⊗̇-unitorˡ {F = F})
; unitorʳ = λ {F} → ≃⇒≅ (⊗̇-unitorʳ {F = F})
; associator = λ {F G H} → record
-- NOTE: this is clearly the same as
--
-- ≃⇒≅ (⊗̇-associator {F = F} {G} {H})
--
-- but the manual expansion seems necessary for Agda to finish
-- typechecking it.
{ from = record
{ U = ⊗̇-associator.F⇒G {F = F} {G} {H}
; isMonoidal = record
{ ε-compat = ⊗̇-associator.ε-compat {F = F} {G} {H}
; ⊗-homo-compat = ⊗̇-associator.⊗-homo-compat {F = F} {G} {H}
}
}
; to = record
{ U = ⊗̇-associator.F⇐G {F = F} {G} {H}
; isMonoidal = record
{ ε-compat = ⊗̇-associator.⇐.ε-compat {F = F} {G} {H}
; ⊗-homo-compat = ⊗̇-associator.⇐.⊗-homo-compat {F = F} {G} {H}
}
}
; iso = record
{ isoˡ = associator.isoˡ
; isoʳ = associator.isoʳ
}
}
; unitorˡ-commute = unitorˡ-commute-from
; unitorʳ-commute = unitorʳ-commute-from
; assoc-commute = assoc-commute-from
; triangle = triangle
; pentagon = pentagon
})
MonoidalFunctorsU-braided : Braided MonoidalFunctorsU-monoidal
MonoidalFunctorsU-braided = record
{ braiding = niHelper (record
{ η = λ{ (F , G) → record
{ U = ⊗̇-braiding.F⇒G {F = F} {G}
; isMonoidal = record
{ ε-compat = ⊗̇-braiding.ε-compat {F = F} {G}
; ⊗-homo-compat = ⊗̇-braiding.⊗-homo-compat {F = F} {G}
}
} }
; η⁻¹ = λ{ (F , G) → record
{ U = ⊗̇-braiding.F⇐G {F = F} {G}
; isMonoidal = record
{ ε-compat = ⊗̇-braiding.⇐.ε-compat {F = F} {G}
; ⊗-homo-compat = ⊗̇-braiding.⇐.⊗-homo-compat {F = F} {G}
}
} }
; commute = λ{ (β , γ) {X} →
let module β = SymmetricMonoidalNaturalTransformation β
module γ = SymmetricMonoidalNaturalTransformation γ
in braiding.⇒.commute (β.η X , γ.η X) }
; iso = λ _ → record
{ isoˡ = braiding.iso.isoˡ _
; isoʳ = braiding.iso.isoʳ _ }
})
; hexagon₁ = hexagon₁
; hexagon₂ = hexagon₂
}
MonoidalFunctorsU-symmetric : Symmetric MonoidalFunctorsU-monoidal
MonoidalFunctorsU-symmetric = record
{ braided = MonoidalFunctorsU-braided
; commutative = commutative
}
MonoidalFunctors : SymmetricMonoidalCategory (o ⊔ ℓ ⊔ e ⊔ o′ ⊔ ℓ′ ⊔ e′)
(o ⊔ ℓ ⊔ ℓ′ ⊔ e′) (o ⊔ e′)
MonoidalFunctors = record
{ U = MonoidalFunctorsU
; monoidal = MonoidalFunctorsU-monoidal
; symmetric = MonoidalFunctorsU-symmetric
}
module Strong where
open SMF.Strong
open SMNT.Strong renaming (id to idNT)
-- The category of symmetric monoidal functors.
MonoidalFunctorsU : Category (o ⊔ ℓ ⊔ e ⊔ o′ ⊔ ℓ′ ⊔ e′) (o ⊔ ℓ ⊔ ℓ′ ⊔ e′)
(o ⊔ e′)
MonoidalFunctorsU = record
{ Obj = SymmetricMonoidalFunctor C D
; _⇒_ = SymmetricMonoidalNaturalTransformation
; _≈_ = λ α β → ∀ {X} → η α X ≈ η β X
; id = idNT
; _∘_ = _∘ᵥ_
; assoc = assoc
; sym-assoc = sym-assoc
; identityˡ = identityˡ
; identityʳ = identityʳ
; identity² = identity²
; equiv = record
{ refl = Equiv.refl
; sym = λ α≈β → Equiv.sym α≈β
; trans = λ α≈β β≈γ → Equiv.trans α≈β β≈γ
}
; ∘-resp-≈ = λ α₁≈β₁ α₂≈β₂ → ∘-resp-≈ α₁≈β₁ α₂≈β₂
}
where open SymmetricMonoidalNaturalTransformation using (η)
open SMNI.Strong using (_≃_)
open Morphism MonoidalFunctorsU using (_≅_)
-- Symmetric natural isos are isos in the functor category.
≃⇒≅ : ∀ {F G : SymmetricMonoidalFunctor C D} → F ≃ G → F ≅ G
≃⇒≅ ni = record
{ from = ni.F⇒G-monoidal
; to = ni.F⇐G-monoidal
; iso = record
{ isoˡ = λ {X} → ni.iso.isoˡ X
; isoʳ = λ {X} → ni.iso.isoʳ X
}
}
where module ni = SMNI.Strong.SymmetricMonoidalNaturalIsomorphism ni
open PT.Strong
MonoidalFunctorsU-monoidal : Monoidal MonoidalFunctorsU
MonoidalFunctorsU-monoidal = monoidalHelper MonoidalFunctorsU (record
{ ⊗ = record
{ F₀ = uncurry′ _⊗̇₀_
; F₁ = uncurry′ _⊗̇₁_
; identity = ⊗.identity
; homomorphism = ⊗.homomorphism
; F-resp-≈ = λ{ (eq₁ , eq₂) → ⊗.F-resp-≈ (eq₁ , eq₂) }
}
; unit = unitF
; unitorˡ = λ {F} → ≃⇒≅ (⊗̇-unitorˡ {F = F})
; unitorʳ = λ {F} → ≃⇒≅ (⊗̇-unitorʳ {F = F})
; associator = λ {F G H} → record
-- NOTE: this is clearly the same as
--
-- ≃⇒≅ (⊗̇-associator {F = F} {G} {H})
--
-- but the manual expansion seems necessary for Agda to finish
-- typechecking it.
{ from = record
{ U = ⊗̇-associator.F⇒G {F = F} {G} {H}
; isMonoidal = record
{ ε-compat = ⊗̇-associator.ε-compat {F = F} {G} {H}
; ⊗-homo-compat = ⊗̇-associator.⊗-homo-compat {F = F} {G} {H}
}
}
; to = record
{ U = ⊗̇-associator.F⇐G {F = F} {G} {H}
; isMonoidal = record
{ ε-compat = ⊗̇-associator.⇐.ε-compat {F = F} {G} {H}
; ⊗-homo-compat = ⊗̇-associator.⇐.⊗-homo-compat {F = F} {G} {H}
}
}
; iso = record
{ isoˡ = associator.isoˡ
; isoʳ = associator.isoʳ
}
}
; unitorˡ-commute = unitorˡ-commute-from
; unitorʳ-commute = unitorʳ-commute-from
; assoc-commute = assoc-commute-from
; triangle = triangle
; pentagon = pentagon
})
MonoidalFunctorsU-braided : Braided MonoidalFunctorsU-monoidal
MonoidalFunctorsU-braided = record
{ braiding = niHelper (record
{ η = λ{ (F , G) → record
{ U = ⊗̇-braiding.F⇒G {F = F} {G}
; isMonoidal = record
{ ε-compat = ⊗̇-braiding.ε-compat {F = F} {G}
; ⊗-homo-compat = ⊗̇-braiding.⊗-homo-compat {F = F} {G}
}
} }
; η⁻¹ = λ{ (F , G) → record
{ U = ⊗̇-braiding.F⇐G {F = F} {G}
; isMonoidal = record
{ ε-compat = ⊗̇-braiding.⇐.ε-compat {F = F} {G}
; ⊗-homo-compat = ⊗̇-braiding.⇐.⊗-homo-compat {F = F} {G}
}
} }
; commute = λ{ (β , γ) {X} →
let module β = SymmetricMonoidalNaturalTransformation β
module γ = SymmetricMonoidalNaturalTransformation γ
in braiding.⇒.commute (β.η X , γ.η X) }
; iso = λ _ → record
{ isoˡ = braiding.iso.isoˡ _
; isoʳ = braiding.iso.isoʳ _ }
})
; hexagon₁ = hexagon₁
; hexagon₂ = hexagon₂
}
MonoidalFunctorsU-symmetric : Symmetric MonoidalFunctorsU-monoidal
MonoidalFunctorsU-symmetric = record
{ braided = MonoidalFunctorsU-braided
; commutative = commutative
}
MonoidalFunctors : SymmetricMonoidalCategory (o ⊔ ℓ ⊔ e ⊔ o′ ⊔ ℓ′ ⊔ e′)
(o ⊔ ℓ ⊔ ℓ′ ⊔ e′) (o ⊔ e′)
MonoidalFunctors = record
{ U = MonoidalFunctorsU
; monoidal = MonoidalFunctorsU-monoidal
; symmetric = MonoidalFunctorsU-symmetric
}
| {
"alphanum_fraction": 0.5357483317,
"avg_line_length": 35.2013422819,
"ext": "agda",
"hexsha": "bf7a005f845761c6a790729d1096131a4517efcc",
"lang": "Agda",
"max_forks_count": 64,
"max_forks_repo_forks_event_max_datetime": "2022-03-14T02:00:59.000Z",
"max_forks_repo_forks_event_min_datetime": "2019-06-02T16:58:15.000Z",
"max_forks_repo_head_hexsha": "d9e4f578b126313058d105c61707d8c8ae987fa8",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "Code-distancing/agda-categories",
"max_forks_repo_path": "src/Categories/Category/Construction/SymmetricMonoidalFunctors.agda",
"max_issues_count": 236,
"max_issues_repo_head_hexsha": "d9e4f578b126313058d105c61707d8c8ae987fa8",
"max_issues_repo_issues_event_max_datetime": "2022-03-28T14:31:43.000Z",
"max_issues_repo_issues_event_min_datetime": "2019-06-01T14:53:54.000Z",
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "Code-distancing/agda-categories",
"max_issues_repo_path": "src/Categories/Category/Construction/SymmetricMonoidalFunctors.agda",
"max_line_length": 85,
"max_stars_count": 279,
"max_stars_repo_head_hexsha": "d9e4f578b126313058d105c61707d8c8ae987fa8",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "Trebor-Huang/agda-categories",
"max_stars_repo_path": "src/Categories/Category/Construction/SymmetricMonoidalFunctors.agda",
"max_stars_repo_stars_event_max_datetime": "2022-03-22T00:40:14.000Z",
"max_stars_repo_stars_event_min_datetime": "2019-06-01T14:36:40.000Z",
"num_tokens": 3770,
"size": 10490
} |
{-
This file contains:
- An implementation of the free group of a type of generators as a HIT
-}
{-# OPTIONS --safe #-}
module Cubical.HITs.FreeGroup.Base where
open import Cubical.Foundations.Prelude
private
variable
ℓ : Level
data FreeGroup (A : Type ℓ) : Type ℓ where
η : A → FreeGroup A
_·_ : FreeGroup A → FreeGroup A → FreeGroup A
ε : FreeGroup A
inv : FreeGroup A → FreeGroup A
assoc : ∀ x y z → x · (y · z) ≡ (x · y) · z
idr : ∀ x → x ≡ x · ε
idl : ∀ x → x ≡ ε · x
invr : ∀ x → x · (inv x) ≡ ε
invl : ∀ x → (inv x) · x ≡ ε
trunc : isSet (FreeGroup A)
| {
"alphanum_fraction": 0.5737704918,
"avg_line_length": 21.0344827586,
"ext": "agda",
"hexsha": "5299cc1868c0b08308b2341160e3573fc3be2548",
"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/HITs/FreeGroup/Base.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/HITs/FreeGroup/Base.agda",
"max_line_length": 70,
"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/HITs/FreeGroup/Base.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": 227,
"size": 610
} |
------------------------------------------------------------------------
-- A type-checker
------------------------------------------------------------------------
import Axiom.Extensionality.Propositional as E
import Level
open import Data.Universe
-- The code makes use of the assumption that propositional equality of
-- functions is extensional.
module README.DependentlyTyped.Type-checker
(Uni₀ : Universe Level.zero Level.zero)
(ext : E.Extensionality Level.zero Level.zero)
where
open import Category.Monad
open import Data.Maybe hiding (_>>=_)
import Data.Maybe.Categorical as Maybe
open import Data.Nat using (ℕ; zero; suc; pred)
open import Data.Product as Prod
open import Function as F hiding (_∋_) renaming (_∘_ to _⊚_)
import README.DependentlyTyped.Equality-checker as EC; open EC Uni₀ ext
import README.DependentlyTyped.NBE as NBE; open NBE Uni₀ ext
import README.DependentlyTyped.NormalForm as NF
open NF Uni₀ hiding (⌊_⌋; no)
import README.DependentlyTyped.Raw-term as RT; open RT Uni₀
import README.DependentlyTyped.Term as Term; open Term Uni₀
import README.DependentlyTyped.Term.Substitution as S; open S Uni₀
open import Relation.Binary.PropositionalEquality as P using (_≡_)
open import Relation.Nullary
import Relation.Nullary.Decidable as Dec
open import Relation.Nullary.Product
open P.≡-Reasoning
open RawMonadZero (Maybe.monadZero {f = Level.zero})
-- Computes a syntactic type for a variable from a matching syntactic
-- context.
type-of-var : ∀ {Γ σ} → Γ ∋ σ → Γ ctxt → Γ ⊢ σ type
type-of-var zero (Γ′ ▻ σ′) = σ′ /⊢t wk
type-of-var (suc x) (Γ′ ▻ σ′) = type-of-var x Γ′ /⊢t wk
-- Infers the type of a variable, if possible.
infer-var : (Γ : Ctxt) (x : ℕ) →
Dec (∃₂ λ σ (x′ : Γ ∋ σ) → position x′ ≡ x)
infer-var ε x = no helper
where
helper : ¬ ∃₂ λ σ (x′ : ε ∋ σ) → position x′ ≡ x
helper (_ , () , _)
infer-var (Γ ▻ σ) zero = yes (σ /̂ ŵk , zero , P.refl)
infer-var (Γ ▻ σ) (suc x) =
Dec.map′ (Prod.map (λ σ → σ /̂ ŵk) (Prod.map suc (P.cong suc)))
helper
(infer-var Γ x)
where
helper : (∃₂ λ τ (x′ : Γ ▻ σ ∋ τ) → position x′ ≡ suc x) →
(∃₂ λ τ (x′ : Γ ∋ τ) → position x′ ≡ x)
helper (._ , zero , ())
helper (._ , suc x′ , eq) = (_ , x′ , P.cong pred eq)
-- Infers the /syntactic/ type of a variable, if possible.
infer-var-syntactic :
∀ {Γ} → Γ ctxt → (x : ℕ) →
Dec (∃ λ σ → Γ ⊢ σ type × ∃ λ (x′ : Γ ∋ σ) → position x′ ≡ x)
infer-var-syntactic {Γ} Γ′ x = Dec.map′
(Prod.map F.id (λ p → type-of-var (proj₁ p) Γ′ , proj₁ p , proj₂ p))
(Prod.map F.id proj₂)
(infer-var Γ x)
mutual
-- Tries to infer a well-typed form of a raw type.
infer-ty :
∀ {Γ} → Γ ctxt → (σ : Raw-ty) →
Maybe (∃₂ λ σ′ (σ″ : Γ ⊢ σ′ type) → ⌊ σ″ ⌋ty ≡ ⌊ σ ⌋raw-ty)
infer-ty Γ′ ⋆ = return (_ , ⋆ , P.refl)
infer-ty Γ′ (el t) =
check Γ′ ⋆ t >>= λ { (t′ , eq) →
return (_ , el t′ , P.cong el eq) }
infer-ty Γ′ (π σ′₁ σ′₂) =
infer-ty Γ′ σ′₁ >>= λ { (_ , σ′₁′ , eq₁) →
infer-ty (Γ′ ▻ σ′₁′) σ′₂ >>= λ { (_ , σ′₂′ , eq₂) →
return (_ , π σ′₁′ σ′₂′ , P.cong₂ π eq₁ eq₂) }}
-- Tries to infer a type for a term. In the case of success a
-- well-typed term is returned.
infer :
∀ {Γ} → Γ ctxt → (t : Raw) →
Maybe (∃ λ σ → Γ ⊢ σ type × ∃ λ (t′ : Γ ⊢ σ) → ⌊ t′ ⌋ ≡ ⌊ t ⌋raw)
infer Γ′ (var x) with infer-var-syntactic Γ′ x
... | yes (_ , σ′ , x′ , eq) = return (_ , σ′ , var x′ , P.cong var eq)
... | no _ = ∅
infer Γ′ (ƛ t) = ∅
infer Γ′ (t₁ · t₂) =
infer Γ′ t₁ >>=
λ { (._ , π σ′₁ σ′₂ , t₁′ , eq₁) →
check Γ′ σ′₁ t₂ >>= λ { (t₂′ , eq₂) →
return (_ , σ′₂ /⊢t sub t₂′ , t₁′ · t₂′ ,
P.cong₂ _·_ eq₁ eq₂) }
; _ → ∅
}
infer Γ′ (t ∶ σ) =
infer-ty Γ′ σ >>= λ { (_ , σ′ , eq) →
check Γ′ σ′ t >>= λ { (t′ , eq) →
return (_ , σ′ , t′ , eq) }}
-- Tries to type-check a term. In the case of success a well-typed
-- term is returned.
check : ∀ {Γ σ} → Γ ctxt → (σ′ : Γ ⊢ σ type) (t : Raw) →
Maybe (∃ λ (t′ : Γ ⊢ σ) → ⌊ t′ ⌋ ≡ ⌊ t ⌋raw)
check Γ′ (π σ′₁ σ′₂) (ƛ t) =
check (Γ′ ▻ σ′₁) σ′₂ t >>= λ { (t′ , eq) →
return (ƛ t′ , P.cong ƛ eq) }
check Γ′ σ′ t =
infer Γ′ t >>= λ { (_ , τ′ , t′ , eq₁) →
τ′ ≟-Type σ′ >>= λ eq₂ →
return (P.subst (_⊢_ _) (≅-Type-⇒-≡ eq₂) t′ , (begin
⌊ P.subst (_⊢_ _) (≅-Type-⇒-≡ eq₂) t′ ⌋ ≡⟨ ⌊⌋-cong $ drop-subst-⊢ F.id (≅-Type-⇒-≡ eq₂) ⟩
⌊ t′ ⌋ ≡⟨ eq₁ ⟩
⌊ t ⌋raw ∎)) }
-- Tries to establish that the given raw term has the given raw type
-- (in the empty context).
infix 4 _∋?_
_∋?_ : (σ : Raw-ty) (t : Raw) →
Maybe (∃₂ λ (σ′ : Type ε) (σ″ : ε ⊢ σ′ type) →
∃ λ (t′ : ε ⊢ σ′) →
⌊ σ″ ⌋ty ≡ ⌊ σ ⌋raw-ty × ⌊ t′ ⌋ ≡ ⌊ t ⌋raw)
σ ∋? t = infer-ty ε σ >>= λ { (σ′ , σ″ , eq₁) →
check ε σ″ t >>= λ { (t′ , eq₂) →
return (σ′ , σ″ , t′ , eq₁ , eq₂) }}
------------------------------------------------------------------------
-- Examples
private
σ₁ : Raw-ty
σ₁ = π ⋆ ⋆
σ₁′ : Type ε
σ₁′ = proj₁ $ from-just $ infer-ty ε σ₁
t₁ : Raw
t₁ = ƛ (var zero)
t₁′ : ε ⊢ σ₁′
t₁′ = proj₁ $ proj₂ $ proj₂ $ from-just $ σ₁ ∋? t₁
t₂ : ε ▻ (⋆ , _) ⊢ (⋆ , _)
t₂ = proj₁ $ proj₂ $ proj₂ $ from-just $ infer (ε ▻ ⋆) (var zero)
t₃ : Raw
t₃ = (ƛ (var zero) ∶ π ⋆ ⋆) · var zero
t₃′ : ε ▻ (⋆ , _) ⊢ (⋆ , _)
t₃′ = proj₁ $ proj₂ $ proj₂ $ from-just $ infer (ε ▻ ⋆) t₃
| {
"alphanum_fraction": 0.4759938049,
"avg_line_length": 34.7964071856,
"ext": "agda",
"hexsha": "f20c0579b63177c0123fcc0a7d80f759cbe3ac23",
"lang": "Agda",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "498f8aefc570f7815fd1d6616508eeb92c52abce",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "nad/dependently-typed-syntax",
"max_forks_repo_path": "README/DependentlyTyped/Type-checker.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "498f8aefc570f7815fd1d6616508eeb92c52abce",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "nad/dependently-typed-syntax",
"max_issues_repo_path": "README/DependentlyTyped/Type-checker.agda",
"max_line_length": 104,
"max_stars_count": 5,
"max_stars_repo_head_hexsha": "498f8aefc570f7815fd1d6616508eeb92c52abce",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "nad/dependently-typed-syntax",
"max_stars_repo_path": "README/DependentlyTyped/Type-checker.agda",
"max_stars_repo_stars_event_max_datetime": "2020-07-08T22:51:36.000Z",
"max_stars_repo_stars_event_min_datetime": "2020-04-16T12:14:44.000Z",
"num_tokens": 2226,
"size": 5811
} |
{-# OPTIONS --without-K --safe #-}
module Relation.Binary.Construct.Closure.SymmetricTransitive where
open import Level
open import Function
open import Relation.Binary
private
variable
a ℓ ℓ′ : Level
A B : Set a
module _ {A : Set a} (_≤_ : Rel A ℓ) where
private
variable
x y z : A
data Plus⇔ : Rel A (a ⊔ ℓ) where
forth : x ≤ y → Plus⇔ x y
back : y ≤ x → Plus⇔ x y
forth⁺ : x ≤ y → Plus⇔ y z → Plus⇔ x z
back⁺ : y ≤ x → Plus⇔ y z → Plus⇔ x z
module _ (_∼_ : Rel A ℓ) where
trans : Transitive (Plus⇔ _∼_)
trans (forth r) rel′ = forth⁺ r rel′
trans (back r) rel′ = back⁺ r rel′
trans (forth⁺ r rel) rel′ = forth⁺ r (trans rel rel′)
trans (back⁺ r rel) rel′ = back⁺ r (trans rel rel′)
sym : Symmetric (Plus⇔ _∼_)
sym (forth r) = back r
sym (back r) = forth r
sym (forth⁺ r rel) = trans (sym rel) (back r)
sym (back⁺ r rel) = trans (sym rel) (forth r)
isPartialEquivalence : IsPartialEquivalence (Plus⇔ _∼_)
isPartialEquivalence = record
{ sym = sym
; trans = trans
}
partialSetoid : PartialSetoid _ _
partialSetoid = record
{ Carrier = A
; _≈_ = Plus⇔ _∼_
; isPartialEquivalence = isPartialEquivalence
}
module _ (refl : Reflexive _∼_) where
isEquivalence : IsEquivalence (Plus⇔ _∼_)
isEquivalence = record
{ refl = forth refl
; sym = sym
; trans = trans
}
setoid : Setoid _ _
setoid = record
{ Carrier = A
; _≈_ = Plus⇔ _∼_
; isEquivalence = isEquivalence
}
module _ {c e} (S : Setoid c e) where
private
module S = Setoid S
minimal : (f : A → Setoid.Carrier S) →
_∼_ =[ f ]⇒ Setoid._≈_ S →
Plus⇔ _∼_ =[ f ]⇒ Setoid._≈_ S
minimal f inj (forth r) = inj r
minimal f inj (back r) = S.sym (inj r)
minimal f inj (forth⁺ r rel) = S.trans (inj r) (minimal f inj rel)
minimal f inj (back⁺ r rel) = S.trans (S.sym (inj r)) (minimal f inj rel)
module Plus⇔Reasoning (_≤_ : Rel A ℓ) where
infix 3 forth-syntax back-syntax
infixr 2 forth⁺-syntax back⁺-syntax
forth-syntax : ∀ x y → x ≤ y → Plus⇔ _≤_ x y
forth-syntax _ _ = forth
syntax forth-syntax x y x≤y = x ⇒⟨ x≤y ⟩∎ y ∎
back-syntax : ∀ x y → y ≤ x → Plus⇔ _≤_ x y
back-syntax _ _ = back
syntax back-syntax x y y≤x = x ⇐⟨ y≤x ⟩∎ y ∎
forth⁺-syntax : ∀ x {y z} → x ≤ y → Plus⇔ _≤_ y z → Plus⇔ _≤_ x z
forth⁺-syntax _ = forth⁺
syntax forth⁺-syntax x x≤y y⇔z = x ⇒⟨ x≤y ⟩ y⇔z
back⁺-syntax : ∀ x {y z} → y ≤ x → Plus⇔ _≤_ y z → Plus⇔ _≤_ x z
back⁺-syntax _ = back⁺
syntax back⁺-syntax x y≤x y⇔z = x ⇐⟨ y≤x ⟩ y⇔z
module _ {_≤_ : Rel A ℓ} {_≼_ : Rel B ℓ′} (f : A → B) where
module _ (inj : _≤_ =[ f ]⇒ _≼_) where
gmap : Plus⇔ _≤_ =[ f ]⇒ Plus⇔ _≼_
gmap (forth r) = forth (inj r)
gmap (back r) = back (inj r)
gmap (forth⁺ r rel) = forth⁺ (inj r) (gmap rel)
gmap (back⁺ r rel) = back⁺ (inj r) (gmap rel)
map : {_≤_ : Rel A ℓ} {_≼_ : Rel A ℓ′} (inj : _≤_ ⇒ _≼_) → Plus⇔ _≤_ ⇒ Plus⇔ _≼_
map = gmap id
| {
"alphanum_fraction": 0.5420114577,
"avg_line_length": 27.0862068966,
"ext": "agda",
"hexsha": "c24fca62676c6ca021ed81571d21d864850fe6b5",
"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": "ad0f94b6cf18d8a448b844b021aeda58e833d152",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "turion/agda-categories",
"max_forks_repo_path": "src/Relation/Binary/Construct/Closure/SymmetricTransitive.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "ad0f94b6cf18d8a448b844b021aeda58e833d152",
"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": "turion/agda-categories",
"max_issues_repo_path": "src/Relation/Binary/Construct/Closure/SymmetricTransitive.agda",
"max_line_length": 80,
"max_stars_count": null,
"max_stars_repo_head_hexsha": "ad0f94b6cf18d8a448b844b021aeda58e833d152",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "turion/agda-categories",
"max_stars_repo_path": "src/Relation/Binary/Construct/Closure/SymmetricTransitive.agda",
"max_stars_repo_stars_event_max_datetime": null,
"max_stars_repo_stars_event_min_datetime": null,
"num_tokens": 1301,
"size": 3142
} |
module L.Data.Bool where
-- Reexport definitions
open import L.Data.Bool.Core public
open import L.Data.Bool.Properties public
-- Functions on Bools
infix 7 not_
infixr 6 _∧_
infixr 5 _∨_ _xor_
not_ : Bool → Bool
not x = if (λ _ → Bool) ff tt x
_∧_ : Bool → Bool → Bool
x ∧ y = if (λ _ → Bool) y ff x
_∨_ : Bool → Bool → Bool
x ∨ y = if (λ _ → Bool) tt y x
_xor_ : Bool → Bool → Bool
x xor y = if (λ _ → Bool) y (not y) x
| {
"alphanum_fraction": 0.6348837209,
"avg_line_length": 17.9166666667,
"ext": "agda",
"hexsha": "75aafe050582d38d2f4f109e43164bb11a0e7ce4",
"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": "83707537b182ba8906228ac0bcb9ccef972eaaa3",
"max_forks_repo_licenses": [
"BSD-2-Clause"
],
"max_forks_repo_name": "borszag/smallib",
"max_forks_repo_path": "src/L/Data/Bool.agda",
"max_issues_count": 10,
"max_issues_repo_head_hexsha": "83707537b182ba8906228ac0bcb9ccef972eaaa3",
"max_issues_repo_issues_event_max_datetime": "2020-11-09T16:40:39.000Z",
"max_issues_repo_issues_event_min_datetime": "2020-10-19T10:13:16.000Z",
"max_issues_repo_licenses": [
"BSD-2-Clause"
],
"max_issues_repo_name": "borszag/smallib",
"max_issues_repo_path": "src/L/Data/Bool.agda",
"max_line_length": 41,
"max_stars_count": null,
"max_stars_repo_head_hexsha": "83707537b182ba8906228ac0bcb9ccef972eaaa3",
"max_stars_repo_licenses": [
"BSD-2-Clause"
],
"max_stars_repo_name": "borszag/smallib",
"max_stars_repo_path": "src/L/Data/Bool.agda",
"max_stars_repo_stars_event_max_datetime": null,
"max_stars_repo_stars_event_min_datetime": null,
"num_tokens": 162,
"size": 430
} |
------------------------------------------------------------------------------
-- FOTC version of a nested recursive function by the
-- Bove-Capretta method
------------------------------------------------------------------------------
{-# OPTIONS --exact-split #-}
{-# OPTIONS --no-sized-types #-}
{-# OPTIONS --no-universe-polymorphism #-}
{-# OPTIONS --without-K #-}
-- From: Ana Bove and Venanzio Capretta. Nested general recursion and
-- partiality in type theory. Vol. 2152 of LNCS. 2001.
module FOT.FOTC.Program.Nest.Nest-FOTC-BC where
open import Common.FOL.Relation.Binary.EqReasoning
open import FOTC.Base
open import FOTC.Data.Nat
import FOTC.Data.Nat.Induction.Acc.WF-I
open FOTC.Data.Nat.Induction.Acc.WF-I.<-WF
open import FOTC.Data.Nat.Inequalities
open import FOTC.Data.Nat.Inequalities.PropertiesI
------------------------------------------------------------------------------
-- The nest function.
postulate
nest : D → D
nest-0 : nest zero ≡ zero
nest-S : ∀ d → nest (succ₁ d) ≡ nest (nest d)
data Dom : D → Set where
dom0 : Dom zero
domS : ∀ d → Dom d → Dom (nest d) → Dom (succ₁ d)
-- Inductive principle associated to the domain predicate.
Dom-ind : (P : D → Set) →
P zero →
(∀ {d} → Dom d → P d → Dom (nest d) → P (nest d) → P (succ₁ d)) →
∀ {d} → Dom d → P d
Dom-ind P P0 ih dom0 = P0
Dom-ind P P0 ih (domS d h₁ h₂) =
ih h₁ (Dom-ind P P0 ih h₁) h₂ (Dom-ind P P0 ih h₂)
-- The domain predicate is total.
dom-N : ∀ d → Dom d → N d
dom-N .zero dom0 = nzero
dom-N .(succ₁ d) (domS d h₁ h₂) = nsucc (dom-N d h₁)
nestCong : ∀ {n₁ n₂} → n₁ ≡ n₂ → nest n₁ ≡ nest n₂
nestCong refl = refl
nest-x≡0 : ∀ {n} → N n → nest n ≡ zero
nest-x≡0 nzero = nest-0
nest-x≡0 (nsucc {n} Nn) =
nest (succ₁ n) ≡⟨ nest-S n ⟩
nest (nest n) ≡⟨ nestCong (nest-x≡0 Nn) ⟩
nest zero ≡⟨ nest-0 ⟩
zero ∎
-- The nest function is total in its domain (via structural recursion
-- in the domain predicate).
nest-DN : ∀ {d} → Dom d → N (nest d)
nest-DN dom0 = subst N (sym nest-0) nzero
nest-DN (domS d h₁ h₂) = subst N (sym (nest-S d)) (nest-DN h₂)
-- The nest function is total.
nest-N : ∀ {n} → N n → N (nest n)
nest-N Nn = subst N (sym (nest-x≡0 Nn)) nzero
nest-≤ : ∀ {n} → Dom n → nest n ≤ n
nest-≤ dom0 = le (nest zero) zero ≡⟨ leLeftCong nest-0 ⟩
le zero zero ≡⟨ x≤x nzero ⟩
true ∎
nest-≤ (domS n h₁ h₂) =
≤-trans (nest-N (nsucc (dom-N n h₁))) (nest-N (dom-N n h₁)) (nsucc Nn) prf₁ prf₂
where
Nn : N n
Nn = dom-N n h₁
prf₁ : nest (succ₁ n) ≤ nest n
prf₁ = le (nest (succ₁ n)) (nest n) ≡⟨ leLeftCong (nest-S n) ⟩
le (nest (nest n)) (nest n) ≡⟨ nest-≤ h₂ ⟩
true ∎
prf₂ : nest n ≤ succ₁ n
prf₂ = ≤-trans (nest-N (dom-N n h₁)) Nn (nsucc Nn) (nest-≤ h₁) (x≤Sx Nn)
N→Dom : ∀ {n} → N n → Dom n
N→Dom = <-wfind P ih
where
P : D → Set
P = Dom
ih : ∀ {x} → N x → (∀ {y} → N y → y < x → P y) → P x
ih nzero h = dom0
ih (nsucc {x} Nx) h =
domS x dn-x (h (nest-N Nx) (x≤y→x<Sy (nest-N Nx) Nx (nest-≤ dn-x)))
where
dn-x : Dom x
dn-x = h Nx (x<Sx Nx)
| {
"alphanum_fraction": 0.5072771377,
"avg_line_length": 31.1132075472,
"ext": "agda",
"hexsha": "bbea487e0f5914d4ca54ff4d4dc5791f2fde8b51",
"lang": "Agda",
"max_forks_count": 3,
"max_forks_repo_forks_event_max_datetime": "2018-03-14T08:50:00.000Z",
"max_forks_repo_forks_event_min_datetime": "2016-09-19T14:18:30.000Z",
"max_forks_repo_head_hexsha": "2fc9f2b81052a2e0822669f02036c5750371b72d",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "asr/fotc",
"max_forks_repo_path": "notes/FOT/FOTC/Program/Nest/Nest-FOTC-BC.agda",
"max_issues_count": 2,
"max_issues_repo_head_hexsha": "2fc9f2b81052a2e0822669f02036c5750371b72d",
"max_issues_repo_issues_event_max_datetime": "2017-01-01T14:34:26.000Z",
"max_issues_repo_issues_event_min_datetime": "2016-10-12T17:28:16.000Z",
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "asr/fotc",
"max_issues_repo_path": "notes/FOT/FOTC/Program/Nest/Nest-FOTC-BC.agda",
"max_line_length": 82,
"max_stars_count": 11,
"max_stars_repo_head_hexsha": "2fc9f2b81052a2e0822669f02036c5750371b72d",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "asr/fotc",
"max_stars_repo_path": "notes/FOT/FOTC/Program/Nest/Nest-FOTC-BC.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": 1173,
"size": 3298
} |
------------------------------------------------------------------------
-- The Agda standard library
--
-- Instantiates the natural coefficients ring solver, using coefficient
-- equality induced by ℕ.
--
-- This is sufficient for proving equalities that are independent of the
-- characteristic. In particular, this is enough for equalities in rings of
-- characteristic 0.
------------------------------------------------------------------------
{-# OPTIONS --without-K --safe #-}
open import Algebra
module Algebra.Solver.Ring.NaturalCoefficients.Default
{r₁ r₂} (R : CommutativeSemiring r₁ r₂) where
import Algebra.Operations.Semiring as SemiringOps
open import Data.Maybe.Base using (Maybe; map)
open import Data.Nat using (_≟_)
open import Relation.Binary.Consequences using (dec⟶weaklyDec)
import Relation.Binary.PropositionalEquality as P
open CommutativeSemiring R
open SemiringOps semiring
private
dec : ∀ m n → Maybe (m × 1# ≈ n × 1#)
dec m n = map (λ { P.refl → refl }) (dec⟶weaklyDec _≟_ m n)
open import Algebra.Solver.Ring.NaturalCoefficients R dec public
| {
"alphanum_fraction": 0.6505032022,
"avg_line_length": 33.1212121212,
"ext": "agda",
"hexsha": "fa44d082dd3dcec6b80505ec06212c554e802dab",
"lang": "Agda",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "0debb886eb5dbcd38dbeebd04b34cf9d9c5e0e71",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "omega12345/agda-mode",
"max_forks_repo_path": "test/asset/agda-stdlib-1.0/Algebra/Solver/Ring/NaturalCoefficients/Default.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "0debb886eb5dbcd38dbeebd04b34cf9d9c5e0e71",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "omega12345/agda-mode",
"max_issues_repo_path": "test/asset/agda-stdlib-1.0/Algebra/Solver/Ring/NaturalCoefficients/Default.agda",
"max_line_length": 76,
"max_stars_count": null,
"max_stars_repo_head_hexsha": "0debb886eb5dbcd38dbeebd04b34cf9d9c5e0e71",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "omega12345/agda-mode",
"max_stars_repo_path": "test/asset/agda-stdlib-1.0/Algebra/Solver/Ring/NaturalCoefficients/Default.agda",
"max_stars_repo_stars_event_max_datetime": null,
"max_stars_repo_stars_event_min_datetime": null,
"num_tokens": 254,
"size": 1093
} |
-- Andreas, 2016-10-30, issue #2286 reported by carlostome
-- {-# OPTIONS -v interaction.give:40 #-}
-- {-# OPTIONS -v tc.term.expr:40 #-}
-- {-# OPTIONS -v tc.meta:40 #-}
-- {-# OPTIONS -v 10 #-}
data Nat : Set where
zero : Nat
succ : Nat → Nat
data _==_ {A : Set} (x : A) : A → Set where
refl : x == x
f : Nat -> Nat
f x = {! f x !} -- giving f x here used to loop, as termination checking was not redone
p1 : (n : Nat) -> f n == n
p1 n = refl -- This unsolved constraint triggered the loop.
| {
"alphanum_fraction": 0.5776031434,
"avg_line_length": 25.45,
"ext": "agda",
"hexsha": "6a2a9fa3dd11e79d0a8bfc5e39d7911242b40ba2",
"lang": "Agda",
"max_forks_count": 371,
"max_forks_repo_forks_event_max_datetime": "2022-03-30T19:00:30.000Z",
"max_forks_repo_forks_event_min_datetime": "2015-01-03T14:04:08.000Z",
"max_forks_repo_head_hexsha": "7f58030124fa99dfbf8db376659416f3ad8384de",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "cruhland/agda",
"max_forks_repo_path": "test/interaction/Issue2286.agda",
"max_issues_count": 4066,
"max_issues_repo_head_hexsha": "7f58030124fa99dfbf8db376659416f3ad8384de",
"max_issues_repo_issues_event_max_datetime": "2022-03-31T21:14:49.000Z",
"max_issues_repo_issues_event_min_datetime": "2015-01-10T11:24:51.000Z",
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "cruhland/agda",
"max_issues_repo_path": "test/interaction/Issue2286.agda",
"max_line_length": 90,
"max_stars_count": 1989,
"max_stars_repo_head_hexsha": "7f58030124fa99dfbf8db376659416f3ad8384de",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "cruhland/agda",
"max_stars_repo_path": "test/interaction/Issue2286.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": 173,
"size": 509
} |
-- Andreas, 2018-06-14, issue #2513, parsing attributes
-- Run-time only use.
postulate
@0 RT₁ : Set
@erased RT₂ : Set
-- Default: unrestricted use.
postulate
@ω CT₁ : Set
@plenty CT₂ : Set
-- Irrelevance.
postulate
. I₀ : Set
@irr I₁ : Set
@irrelevant I₂ : Set
-- Shape-irrelevance
postulate
-- .. SI₀ : Set -- Does not parse (yet).
@shirr SI₁ : Set
@shape-irrelevant SI₂ : Set
-- Relevance (default).
postulate
R₀ : Set
@relevant R₁ : Set
-- Mix.
postulate
@0 @shape-irrelevant M : Set
-- In function spaces and telescopes.
@ω id : ∀{@0 A : Set} → @relevant @ω A → A
id x = x
data Wrap (@0 A : Set) : Set where
wrap' : @relevant A → Wrap A
wrap : ∀ (@0 A) → A → Wrap A
wrap A x = wrap' x
-- In record fields.
record Squash (@0 A : Set) : Set where
no-eta-equality; constructor squash; field
@irrelevant squashed : A
| {
"alphanum_fraction": 0.595814978,
"avg_line_length": 16.2142857143,
"ext": "agda",
"hexsha": "aea86132ba9829de4ba2d3f94d65cad45ed1a427",
"lang": "Agda",
"max_forks_count": 1,
"max_forks_repo_forks_event_max_datetime": "2015-09-15T14:36:15.000Z",
"max_forks_repo_forks_event_min_datetime": "2015-09-15T14:36:15.000Z",
"max_forks_repo_head_hexsha": "231d6ad8e77b67ff8c4b1cb35a6c31ccd988c3e9",
"max_forks_repo_licenses": [
"BSD-3-Clause"
],
"max_forks_repo_name": "Agda-zh/agda",
"max_forks_repo_path": "test/Succeed/Attributes.agda",
"max_issues_count": 3,
"max_issues_repo_head_hexsha": "aac88412199dd4cbcb041aab499d8a6b7e3f4a2e",
"max_issues_repo_issues_event_max_datetime": "2019-04-01T19:39:26.000Z",
"max_issues_repo_issues_event_min_datetime": "2018-11-14T15:31:44.000Z",
"max_issues_repo_licenses": [
"BSD-3-Clause"
],
"max_issues_repo_name": "hborum/agda",
"max_issues_repo_path": "test/Succeed/Attributes.agda",
"max_line_length": 55,
"max_stars_count": 2,
"max_stars_repo_head_hexsha": "aac88412199dd4cbcb041aab499d8a6b7e3f4a2e",
"max_stars_repo_licenses": [
"BSD-3-Clause"
],
"max_stars_repo_name": "hborum/agda",
"max_stars_repo_path": "test/Succeed/Attributes.agda",
"max_stars_repo_stars_event_max_datetime": "2020-09-20T00:28:57.000Z",
"max_stars_repo_stars_event_min_datetime": "2019-10-29T09:40:30.000Z",
"num_tokens": 311,
"size": 908
} |
{-# OPTIONS --without-K --exact-split #-}
module 20-pullbacks where
import 19-fundamental-cover
open 19-fundamental-cover public
-- Section 13.1 Cartesian squares
{- We introduce the basic concepts of this chapter: commuting squares, cospans,
cones, and pullback squares. Pullback squares are also called cartesian
squares. -}
{- Commutativity of squares is expressed with a homotopy. -}
coherence-square :
{l1 l2 l3 l4 : Level} {A : UU l1} {B : UU l2} {C : UU l3} {X : UU l4}
(top : C → B) (left : C → A) (right : B → X) (bottom : A → X) →
UU (l3 ⊔ l4)
coherence-square top left right bottom =
(bottom ∘ left) ~ (right ∘ top)
{- A cospan is a pair of functions with a common codomain. -}
cospan :
{l1 l2 : Level} (l : Level) (A : UU l1) (B : UU l2) →
UU (l1 ⊔ (l2 ⊔ (lsuc l)))
cospan l A B =
Σ (UU l) (λ X → (A → X) × (B → X))
{- A cone on a cospan with a vertex C is a pair of functions from C into the
domains of the maps in the cospan, equipped with a homotopy witnessing that
the resulting square commutes. -}
cone :
{l1 l2 l3 l4 : Level} {A : UU l1} {B : UU l2} {X : UU l3}
(f : A → X) (g : B → X) → UU l4 → UU (l1 ⊔ (l2 ⊔ (l3 ⊔ l4)))
cone {A = A} {B = B} f g C =
Σ (C → A) (λ p → Σ (C → B) (λ q → coherence-square q p g f))
{- A map into the vertex of a cone induces a new cone. -}
cone-map :
{l1 l2 l3 l4 l5 : Level} {A : UU l1} {B : UU l2} {X : UU l3}
(f : A → X) (g : B → X) {C : UU l4} {C' : UU l5} →
cone f g C → (C' → C) → cone f g C'
cone-map f g c h =
pair
( (pr1 c) ∘ h)
( pair
( (pr1 (pr2 c)) ∘ h)
( (pr2 (pr2 c)) ·r h))
{- We introduce the universal property of pullbacks. -}
universal-property-pullback :
{l1 l2 l3 l4 : Level} (l : Level) {A : UU l1} {B : UU l2}
{X : UU l3} (f : A → X) (g : B → X) {C : UU l4} → cone f g C →
UU (l1 ⊔ (l2 ⊔ (l3 ⊔ (l4 ⊔ (lsuc l)))))
universal-property-pullback l f g c =
(C' : UU l) → is-equiv (cone-map f g {C' = C'} c)
is-prop-universal-property-pullback :
{l1 l2 l3 l4 : Level} (l : Level) {A : UU l1} {B : UU l2}
{X : UU l3} (f : A → X) (g : B → X) {C : UU l4} (c : cone f g C) →
is-prop (universal-property-pullback l f g c)
is-prop-universal-property-pullback l f g c =
is-prop-Π (λ C' → is-subtype-is-equiv (cone-map f g c))
{-
lower-universal-property-pullback :
{l1 l2 l3 l4 : Level} (l l' : Level) {A : UU l1} {B : UU l2} {X : UU l3}
(f : A → X) (g : B → X) {C : UU l4} (c : cone f g C) →
universal-property-pullback (l ⊔ l') f g c →
universal-property-pullback l f g c
lower-universal-property-pullback l l' f g c up-c C' =
is-equiv-right-factor
{!!}
{!!}
{!!}
{!!}
{!!}
{!!}
-}
map-universal-property-pullback :
{l1 l2 l3 l4 l5 : Level} {A : UU l1} {B : UU l2}
{X : UU l3} (f : A → X) (g : B → X) {C : UU l4} (c : cone f g C) →
universal-property-pullback l5 f g c →
{C' : UU l5} (c' : cone f g C') → C' → C
map-universal-property-pullback f g c up-c {C'} c' =
inv-is-equiv (up-c C') c'
eq-map-universal-property-pullback :
{l1 l2 l3 l4 l5 : Level} {A : UU l1} {B : UU l2}
{X : UU l3} (f : A → X) (g : B → X) {C : UU l4} (c : cone f g C) →
(up-c : universal-property-pullback l5 f g c) →
{C' : UU l5} (c' : cone f g C') →
Id (cone-map f g c (map-universal-property-pullback f g c up-c c')) c'
eq-map-universal-property-pullback f g c up-c {C'} c' =
issec-inv-is-equiv (up-c C') c'
{- Next we characterize the identity type of the type of cones with a given
vertex C. Note that in the definition of htpy-cone we do not use pattern
matching on the cones c and c'. This is to ensure that the type
htpy-cone f g c c' is a Σ-type for any c and c', not just for c and c' of the
form (pair p (pair q H)) and (pair p' (pair q' H')) respectively. -}
coherence-htpy-cone :
{l1 l2 l3 l4 : Level} {A : UU l1} {B : UU l2} {X : UU l3}
(f : A → X) (g : B → X) {C : UU l4} (c c' : cone f g C) →
(K : (pr1 c) ~ (pr1 c')) (L : (pr1 (pr2 c)) ~ (pr1 (pr2 c'))) → UU (l4 ⊔ l3)
coherence-htpy-cone f g c c' K L =
( (pr2 (pr2 c)) ∙h (htpy-left-whisk g L)) ~
( (htpy-left-whisk f K) ∙h (pr2 (pr2 c')))
htpy-cone :
{l1 l2 l3 l4 : Level} {A : UU l1} {B : UU l2} {X : UU l3}
(f : A → X) (g : B → X) {C : UU l4} → cone f g C → cone f g C →
UU (l1 ⊔ (l2 ⊔ (l3 ⊔ l4)))
htpy-cone f g c c' =
Σ ( (pr1 c) ~ (pr1 c'))
( λ K → Σ ((pr1 (pr2 c)) ~ (pr1 (pr2 c')))
( λ L → coherence-htpy-cone f g c c' K L))
reflexive-htpy-cone :
{l1 l2 l3 l4 : Level} {A : UU l1} {B : UU l2} {X : UU l3}
(f : A → X) (g : B → X) {C : UU l4} (c : cone f g C) →
htpy-cone f g c c
reflexive-htpy-cone f g c =
pair refl-htpy (pair refl-htpy htpy-right-unit)
htpy-cone-eq :
{l1 l2 l3 l4 : Level} {A : UU l1} {B : UU l2} {X : UU l3}
(f : A → X) (g : B → X) {C : UU l4} (c c' : cone f g C) →
Id c c' → htpy-cone f g c c'
htpy-cone-eq f g c .c refl =
reflexive-htpy-cone f g c
abstract
is-contr-total-htpy-cone :
{l1 l2 l3 l4 : Level} {A : UU l1} {B : UU l2} {X : UU l3}
(f : A → X) (g : B → X) {C : UU l4} (c : cone f g C) →
is-contr (Σ (cone f g C) (htpy-cone f g c))
is-contr-total-htpy-cone {A = A} {B} f g {C} (pair p (pair q H)) =
is-contr-total-Eq-structure
( λ p' qH' K →
Σ ( q ~ (pr1 qH'))
( coherence-htpy-cone f g (pair p (pair q H)) (pair p' qH') K))
( is-contr-total-htpy p)
( pair p refl-htpy)
( is-contr-total-Eq-structure
( λ q' H' →
coherence-htpy-cone f g
( pair p (pair q H))
( pair p (pair q' H'))
( refl-htpy))
( is-contr-total-htpy q)
( pair q refl-htpy)
( is-contr-equiv'
( Σ ((f ∘ p) ~ (g ∘ q)) (λ H' → H ~ H'))
( equiv-tot
( λ H' → equiv-htpy-concat htpy-right-unit H'))
( is-contr-total-htpy H)))
abstract
is-fiberwise-equiv-htpy-cone-eq :
{l1 l2 l3 l4 : Level} {A : UU l1} {B : UU l2} {X : UU l3}
(f : A → X) (g : B → X) {C : UU l4} (c : cone f g C) →
is-fiberwise-equiv (htpy-cone-eq f g c)
is-fiberwise-equiv-htpy-cone-eq f g {C = C} c =
fundamental-theorem-id c
( htpy-cone-eq f g c c refl)
( is-contr-total-htpy-cone f g c)
( htpy-cone-eq f g c)
equiv-htpy-cone :
{l1 l2 l3 l4 : Level} {A : UU l1} {B : UU l2} {X : UU l3}
(f : A → X) (g : B → X) {C : UU l4} (c c' : cone f g C) →
Id c c' ≃ htpy-cone f g c c'
equiv-htpy-cone f g c c' =
pair (htpy-cone-eq f g c c') (is-fiberwise-equiv-htpy-cone-eq f g c c')
{- The inverse of htpy-cone-eq is the map eq-htpy-cone. -}
eq-htpy-cone :
{l1 l2 l3 l4 : Level} {A : UU l1} {B : UU l2} {X : UU l3}
{f : A → X} {g : B → X} {C : UU l4} (c c' : cone f g C) →
htpy-cone f g c c' → Id c c'
eq-htpy-cone {f = f} {g = g} c c' =
inv-is-equiv (is-fiberwise-equiv-htpy-cone-eq f g c c')
{- This completes our characterization of the identity type of the type of
cones with a fixed vertex C. -}
{- We now conclude the universal property of pullbacks as the following
statement of contractibility. -}
abstract
is-contr-universal-property-pullback :
{l1 l2 l3 l4 l5 : Level} {A : UU l1} {B : UU l2} {C : UU l3} {X : UU l4}
(f : A → X) (g : B → X) (c : cone f g C) →
universal-property-pullback l5 f g c →
(C' : UU l5) (c' : cone f g C') →
is-contr (Σ (C' → C) (λ h → htpy-cone f g (cone-map f g c h) c'))
is-contr-universal-property-pullback {C = C} f g c up C' c' =
is-contr-equiv'
( Σ (C' → C) (λ h → Id (cone-map f g c h) c'))
( equiv-tot
(λ h → equiv-htpy-cone f g (cone-map f g c h) c'))
( is-contr-map-is-equiv (up C') c')
{- Next we establish a '3-for-2' property for pullbacks. -}
triangle-cone-cone : {l1 l2 l3 l4 l5 l6 : Level}
{A : UU l1} {B : UU l2} {X : UU l3} {C : UU l4} {C' : UU l5}
{f : A → X} {g : B → X} (c : cone f g C) (c' : cone f g C')
(h : C' → C) (KLM : htpy-cone f g (cone-map f g c h) c') (D : UU l6) →
(cone-map f g {C' = D} c') ~ ((cone-map f g c) ∘ (λ (k : D → C') → h ∘ k))
triangle-cone-cone {C' = C'} {f = f} {g = g} c c' h KLM D k =
inv (ap
( λ t → cone-map f g {C' = D} t k)
{ x = (cone-map f g c h)}
{ y = c'}
( eq-htpy-cone (cone-map f g c h) c' KLM))
abstract
is-equiv-up-pullback-up-pullback :
{l1 l2 l3 l4 l5 : Level}
{A : UU l1} {B : UU l2} {X : UU l3} {C : UU l4} {C' : UU l5}
(f : A → X) (g : B → X) (c : cone f g C) (c' : cone f g C')
(h : C' → C) (KLM : htpy-cone f g (cone-map f g c h) c') →
({l : Level} → universal-property-pullback l f g c) →
({l : Level} → universal-property-pullback l f g c') →
is-equiv h
is-equiv-up-pullback-up-pullback {C = C} {C' = C'} f g c c' h KLM up up' =
is-equiv-is-equiv-postcomp h
( λ D → is-equiv-right-factor
( cone-map f g {C' = D} c')
( cone-map f g c)
( λ (k : D → C') → h ∘ k)
( triangle-cone-cone {C = C} {C' = C'} {f = f} {g = g} c c' h KLM D)
( up D) (up' D))
abstract
is-equiv-up-pullback-up-pullback' :
{l1 l2 l3 l4 : Level}
{A : UU l1} {B : UU l2} {X : UU l3} {C : UU l4} {C' : UU l4}
(f : A → X) (g : B → X) (c : cone f g C) (c' : cone f g C') →
(h : C' → C) (KLM : htpy-cone f g (cone-map f g c h) c') →
universal-property-pullback l4 f g c →
universal-property-pullback l4 f g c' →
is-equiv h
is-equiv-up-pullback-up-pullback'
{C = C} {C' = C'} f g c c' h KLM up-c up-c' =
is-equiv-is-equiv-postcomp' h
( λ D → is-equiv-right-factor
( cone-map f g {C' = D} c')
( cone-map f g c)
( λ (k : D → C') → h ∘ k)
( triangle-cone-cone {C = C} {C' = C'} {f = f} {g = g} c c' h KLM D)
(up-c D) (up-c' D))
abstract
up-pullback-up-pullback-is-equiv : {l1 l2 l3 l4 l5 : Level}
{A : UU l1} {B : UU l2} {X : UU l3} {C : UU l4} {C' : UU l5}
(f : A → X) (g : B → X) (c : cone f g C) (c' : cone f g C')
(h : C' → C) (KLM : htpy-cone f g (cone-map f g c h) c') → is-equiv h →
({l : Level} → universal-property-pullback l f g c) →
({l : Level} → universal-property-pullback l f g c')
up-pullback-up-pullback-is-equiv f g c c' h KLM is-equiv-h up D =
is-equiv-comp
( cone-map f g c')
( cone-map f g c)
( λ k → h ∘ k)
( triangle-cone-cone {f = f} {g = g} c c' h KLM D)
( is-equiv-postcomp-is-equiv h is-equiv-h D)
( up D)
abstract
up-pullback-is-equiv-up-pullback : {l1 l2 l3 l4 l5 : Level}
{A : UU l1} {B : UU l2} {X : UU l3} {C : UU l4} {C' : UU l5}
(f : A → X) (g : B → X) (c : cone f g C) (c' : cone f g C')
(h : C' → C) (KLM : htpy-cone f g (cone-map f g c h) c') →
({l : Level} → universal-property-pullback l f g c') →
is-equiv h →
({l : Level} → universal-property-pullback l f g c)
up-pullback-is-equiv-up-pullback f g c c' h KLM up' is-equiv-h D =
is-equiv-left-factor
( cone-map f g c')
( cone-map f g c)
( λ k → h ∘ k)
( triangle-cone-cone {f = f} {g = g} c c' h KLM D)
( up' D)
( is-equiv-postcomp-is-equiv h is-equiv-h D)
{- This concludes the '3-for-2-property' of pullbacks. -}
{- We establish the uniquely uniqueness of pullbacks. -}
htpy-cone-map-universal-property-pullback :
{l1 l2 l3 l4 l5 : Level} {A : UU l1} {B : UU l2}
{X : UU l3} (f : A → X) (g : B → X) {C : UU l4} (c : cone f g C) →
(up-c : universal-property-pullback l5 f g c) →
{C' : UU l5} (c' : cone f g C') →
htpy-cone f g
( cone-map f g c (map-universal-property-pullback f g c up-c c'))
( c')
htpy-cone-map-universal-property-pullback f g c up-c c' =
htpy-cone-eq f g
( cone-map f g c (map-universal-property-pullback f g c up-c c'))
( c')
( eq-map-universal-property-pullback f g c up-c c')
{- We describe the type of all pullbacks in a universe UU l. -}
UU-pullback :
{l1 l2 l3 : Level} (l : Level) {A : UU l1} {B : UU l2} {X : UU l3}
(f : A → X) (g : B → X) → UU _
UU-pullback l f g =
Σ (UU l) (λ C → Σ (cone f g C) (λ c → universal-property-pullback l f g c))
equiv-pullback :
{l1 l2 l3 l4 l5 : Level} {A : UU l1} {B : UU l2} {X : UU l3}
(f : A → X) (g : B → X) →
UU-pullback l4 f g → UU-pullback l5 f g → UU (l1 ⊔ l2 ⊔ l3 ⊔ l4 ⊔ l5)
equiv-pullback f g (pair C (pair c is-pb-C)) P' =
Σ ( (pr1 P') ≃ C)
( λ e → htpy-cone f g (cone-map f g c (map-equiv e)) (pr1 (pr2 P')))
reflexive-equiv-pullback :
{l1 l2 l3 l4 : Level} {A : UU l1} {B : UU l2} {X : UU l3}
(f : A → X) (g : B → X) (P : UU-pullback l4 f g) →
equiv-pullback f g P P
reflexive-equiv-pullback f g (pair C (pair c is-pb-C)) =
pair (equiv-id C) (reflexive-htpy-cone f g c)
equiv-pullback-eq :
{l1 l2 l3 l4 : Level} {A : UU l1} {B : UU l2} {X : UU l3}
(f : A → X) (g : B → X) (P P' : UU-pullback l4 f g) →
Id P P' → equiv-pullback f g P P'
equiv-pullback-eq f g P .P refl = reflexive-equiv-pullback f g P
is-contr-total-equiv-pullback :
{l1 l2 l3 l4 : Level} {A : UU l1} {B : UU l2} {X : UU l3}
(f : A → X) (g : B → X) (P : UU-pullback l4 f g) →
is-contr (Σ (UU-pullback l4 f g) (equiv-pullback f g P))
is-contr-total-equiv-pullback f g (pair C (pair c is-pb-C)) =
is-contr-total-Eq-structure
( λ C' t e → htpy-cone f g (cone-map f g c (map-equiv e)) (pr1 t))
( is-contr-total-equiv' C)
( pair C (equiv-id C))
( is-contr-total-Eq-substructure
( is-contr-total-htpy-cone f g c)
( is-prop-universal-property-pullback _ f g)
( c)
( reflexive-htpy-cone f g c)
( is-pb-C))
is-equiv-equiv-pullback-eq :
{l1 l2 l3 l4 : Level} {A : UU l1} {B : UU l2} {X : UU l3}
(f : A → X) (g : B → X) (P Q : UU-pullback l4 f g) →
is-equiv (equiv-pullback-eq f g P Q)
is-equiv-equiv-pullback-eq f g P =
fundamental-theorem-id P
( reflexive-equiv-pullback f g P)
( is-contr-total-equiv-pullback f g P)
( equiv-pullback-eq f g P)
equiv-equiv-pullback-eq :
{l1 l2 l3 l4 : Level} {A : UU l1} {B : UU l2} {X : UU l3}
(f : A → X) (g : B → X) (P P' : UU-pullback l4 f g) →
Id P P' ≃ equiv-pullback f g P P'
equiv-equiv-pullback-eq f g P P' =
pair (equiv-pullback-eq f g P P') (is-equiv-equiv-pullback-eq f g P P')
{- We show that pullbacks are uniquely unique, and indeed that the type of all
pullbacks in any given universe level is a proposition. -}
{-
abstract
uniquely-unique-pullback :
{ l1 l2 l3 l4 l5 : Level}
{ A : UU l1} {B : UU l2} {X : UU l3} {C : UU l4} {C' : UU l5}
( f : A → X) (g : B → X) (c : cone f g C) (c' : cone f g C') →
( up-c' : {l : Level} → universal-property-pullback l f g c') →
( up-c : {l : Level} → universal-property-pullback l f g c) →
is-contr
( equiv-pullback f g (pair C (pair c up-c)) (pair C' (pair c' up-c')))
uniquely-unique-pullback {C = C} {C' = C'} f g c c' up-c' up-c =
is-contr-total-Eq-substructure
( is-contr-universal-property-pullback f g c up-c C' c')
( is-subtype-is-equiv)
( map-universal-property-pullback f g c up-c c')
( htpy-cone-map-universal-property-pullback f g c up-c c')
( is-equiv-up-pullback-up-pullback f g c c'
( map-universal-property-pullback f g c up-c c')
( htpy-cone-map-universal-property-pullback f g c up-c c')
up-c up-c')
-}
abstract
uniquely-unique-pullback' :
{ l1 l2 l3 l4 : Level}
{ A : UU l1} {B : UU l2} {X : UU l3} {C : UU l4} {C' : UU l4}
( f : A → X) (g : B → X) (c : cone f g C) (c' : cone f g C') →
( up-c' : universal-property-pullback l4 f g c') →
( up-c : universal-property-pullback l4 f g c) →
is-contr
( equiv-pullback f g (pair C (pair c up-c)) (pair C' (pair c' up-c')))
uniquely-unique-pullback' {C = C} {C' = C'} f g c c' up-c' up-c =
is-contr-total-Eq-substructure
( is-contr-universal-property-pullback f g c up-c C' c')
( is-subtype-is-equiv)
( map-universal-property-pullback f g c up-c c')
( htpy-cone-map-universal-property-pullback f g c up-c c')
( is-equiv-up-pullback-up-pullback' f g c c'
( map-universal-property-pullback f g c up-c c')
( htpy-cone-map-universal-property-pullback f g c up-c c')
up-c up-c')
is-prop-UU-pullback :
{l1 l2 l3 : Level} (l : Level) {A : UU l1} {B : UU l2} {X : UU l3}
( f : A → X) (g : B → X) →
is-prop (UU-pullback l f g)
is-prop-UU-pullback l f g (pair C (pair c up-c)) (pair C' (pair c' up-c')) =
is-contr-equiv
( equiv-pullback f g
( pair C (pair c up-c))
( pair C' (pair c' up-c')))
( equiv-equiv-pullback-eq f g
( pair C (pair c up-c))
( pair C' (pair c' up-c')))
( uniquely-unique-pullback' f g c c' up-c' up-c)
-- Section 13.2
{- The canonical pullback is a type which can be equipped with a cone that
satisfies the universal property of a pullback. -}
canonical-pullback : {l1 l2 l3 : Level} {A : UU l1} {B : UU l2} {X : UU l3}
(f : A → X) (g : B → X) → UU ((l1 ⊔ l2) ⊔ l3)
canonical-pullback {A = A} {B = B} f g = Σ A (λ x → Σ B (λ y → Id (f x) (g y)))
{- We construct the maps and homotopies that are part of the cone structure of
the canonical pullback. -}
π₁ : {l1 l2 l3 : Level} {A : UU l1} {B : UU l2} {X : UU l3}
{f : A → X} {g : B → X} → canonical-pullback f g → A
π₁ = pr1
π₂ : {l1 l2 l3 : Level} {A : UU l1} {B : UU l2} {X : UU l3}
{f : A → X} {g : B → X} → canonical-pullback f g → B
π₂ t = pr1 (pr2 t)
π₃ : {l1 l2 l3 : Level} {A : UU l1} {B : UU l2} {X : UU l3} {f : A → X}
{g : B → X} → (f ∘ (π₁ {f = f} {g = g})) ~ (g ∘ (π₂ {f = f} {g = g}))
π₃ t = pr2 (pr2 t)
cone-canonical-pullback : {l1 l2 l3 : Level} {A : UU l1} {B : UU l2} {X : UU l3}
(f : A → X) (g : B → X) → cone f g (canonical-pullback f g)
cone-canonical-pullback f g = pair π₁ (pair π₂ π₃)
{- We show that the canonical pullback satisfies the universal property of
a pullback. -}
abstract
universal-property-pullback-canonical-pullback : {l1 l2 l3 l4 : Level}
{A : UU l1} {B : UU l2} {X : UU l3} (f : A → X) (g : B → X) →
universal-property-pullback l4 f g (cone-canonical-pullback f g)
universal-property-pullback-canonical-pullback f g C =
is-equiv-comp
( cone-map f g (cone-canonical-pullback f g))
( tot (λ p → choice-∞))
( mapping-into-Σ)
( refl-htpy)
( is-equiv-mapping-into-Σ)
( is-equiv-tot-is-fiberwise-equiv
( λ p → is-equiv-choice-∞))
{- We characterize the identity type of the canonical pullback. -}
Eq-canonical-pullback :
{l1 l2 l3 : Level} {A : UU l1} {B : UU l2} {X : UU l3}
(f : A → X) (g : B → X) (t t' : canonical-pullback f g) → UU (l1 ⊔ (l2 ⊔ l3))
Eq-canonical-pullback f g (pair a bp) t' =
let b = pr1 bp
p = pr2 bp
a' = pr1 t'
b' = pr1 (pr2 t')
p' = pr2 (pr2 t')
in
Σ (Id a a') (λ α → Σ (Id b b') (λ β → Id ((ap f α) ∙ p') (p ∙ (ap g β))))
reflexive-Eq-canonical-pullback :
{l1 l2 l3 : Level} {A : UU l1} {B : UU l2} {X : UU l3}
(f : A → X) (g : B → X) (t : canonical-pullback f g) →
Eq-canonical-pullback f g t t
reflexive-Eq-canonical-pullback f g (pair a (pair b p)) =
pair refl (pair refl (inv right-unit))
Eq-canonical-pullback-eq :
{l1 l2 l3 : Level} {A : UU l1} {B : UU l2} {X : UU l3}
(f : A → X) (g : B → X) (t t' : canonical-pullback f g) →
Id t t' → Eq-canonical-pullback f g t t'
Eq-canonical-pullback-eq f g t .t refl =
reflexive-Eq-canonical-pullback f g t
abstract
is-contr-total-Eq-canonical-pullback :
{l1 l2 l3 : Level} {A : UU l1} {B : UU l2} {X : UU l3}
(f : A → X) (g : B → X) (t : canonical-pullback f g) →
is-contr (Σ (canonical-pullback f g) (Eq-canonical-pullback f g t))
is-contr-total-Eq-canonical-pullback f g (pair a (pair b p)) =
is-contr-total-Eq-structure
( λ a' bp' α →
Σ (Id b (pr1 bp')) (λ β → Id ((ap f α) ∙ (pr2 bp')) (p ∙ (ap g β))))
( is-contr-total-path a)
( pair a refl)
( is-contr-total-Eq-structure
( λ b' p' β → Id ((ap f refl) ∙ p') (p ∙ (ap g β)))
( is-contr-total-path b)
( pair b refl)
( is-contr-equiv'
( Σ (Id (f a) (g b)) (λ p' → Id p p'))
( equiv-tot
( λ p' → (equiv-concat' p' (inv right-unit)) ∘e (equiv-inv p p')))
( is-contr-total-path p)))
abstract
is-equiv-Eq-canonical-pullback-eq :
{l1 l2 l3 : Level} {A : UU l1} {B : UU l2} {X : UU l3}
(f : A → X) (g : B → X) (t t' : canonical-pullback f g) →
is-equiv (Eq-canonical-pullback-eq f g t t')
is-equiv-Eq-canonical-pullback-eq f g t =
fundamental-theorem-id t
( reflexive-Eq-canonical-pullback f g t)
( is-contr-total-Eq-canonical-pullback f g t)
( Eq-canonical-pullback-eq f g t)
eq-Eq-canonical-pullback :
{ l1 l2 l3 : Level} {A : UU l1} {B : UU l2} {X : UU l3}
( f : A → X) (g : B → X) {t t' : canonical-pullback f g} →
( α : Id (pr1 t) (pr1 t')) (β : Id (pr1 (pr2 t)) (pr1 (pr2 t'))) →
( Id ((ap f α) ∙ (pr2 (pr2 t'))) ((pr2 (pr2 t)) ∙ (ap g β))) → Id t t'
eq-Eq-canonical-pullback f g {pair a (pair b p)} {pair a' (pair b' p')} α β γ =
inv-is-equiv
( is-equiv-Eq-canonical-pullback-eq f g
( pair a (pair b p))
( pair a' (pair b' p')))
( pair α (pair β γ))
{- The gap map of a square is the map fron the vertex of the cone into the
canonical pullback. -}
gap :
{l1 l2 l3 l4 : Level} {A : UU l1} {B : UU l2} {X : UU l3} {C : UU l4}
(f : A → X) (g : B → X) → cone f g C → C → canonical-pullback f g
gap f g c z = pair ((pr1 c) z) (pair ((pr1 (pr2 c)) z) ((pr2 (pr2 c)) z))
{- The proposition is-pullback is the assertion that the gap map is an
equivalence. Note that this proposition is small, whereas the universal
property is a large proposition. Of course, we will show below that the
proposition is-pullback is equivalent to the universal property of
pullbacks. -}
is-pullback :
{l1 l2 l3 l4 : Level} {A : UU l1} {B : UU l2} {X : UU l3} {C : UU l4}
(f : A → X) (g : B → X) → cone f g C → UU (l1 ⊔ (l2 ⊔ (l3 ⊔ l4)))
is-pullback f g c = is-equiv (gap f g c)
{- We first establish that a cone is equal to the value of cone-map at
its own gap map. -}
htpy-cone-up-pullback-canonical-pullback :
{l1 l2 l3 l4 : Level} {A : UU l1} {B : UU l2} {X : UU l3} {C : UU l4}
(f : A → X) (g : B → X) (c : cone f g C) →
htpy-cone f g (cone-map f g (cone-canonical-pullback f g) (gap f g c)) c
htpy-cone-up-pullback-canonical-pullback f g c =
pair refl-htpy ( pair refl-htpy htpy-right-unit)
{- We show that the universal property of the pullback implies that the gap
map is an equivalence. -}
abstract
is-pullback-up-pullback :
{l1 l2 l3 l4 : Level} {A : UU l1} {B : UU l2} {X : UU l3} {C : UU l4}
(f : A → X) (g : B → X) (c : cone f g C) →
({l : Level} → universal-property-pullback l f g c) → is-pullback f g c
is-pullback-up-pullback f g c up =
is-equiv-up-pullback-up-pullback f g
( cone-canonical-pullback f g)
( c)
( gap f g c)
( htpy-cone-up-pullback-canonical-pullback f g c)
( universal-property-pullback-canonical-pullback f g)
( up)
{- We show that the universal property follows from the assumption that the
the gap map is an equivalence. -}
abstract
up-pullback-is-pullback :
{l1 l2 l3 l4 : Level} {A : UU l1} {B : UU l2} {X : UU l3} {C : UU l4}
(f : A → X) (g : B → X) (c : cone f g C) →
is-pullback f g c → ({l : Level} → universal-property-pullback l f g c)
up-pullback-is-pullback f g c is-pullback-c =
up-pullback-up-pullback-is-equiv f g
( cone-canonical-pullback f g)
( c)
( gap f g c)
( htpy-cone-up-pullback-canonical-pullback f g c)
( is-pullback-c)
( universal-property-pullback-canonical-pullback f g)
-- Section 13.3 Fiber products
{- We construct the cone for two maps into the unit type. -}
cone-prod :
{i j : Level} (A : UU i) (B : UU j) →
cone (const A unit star) (const B unit star) (A × B)
cone-prod A B = pair pr1 (pair pr2 refl-htpy)
{- Cartesian products are a special case of pullbacks. -}
inv-gap-prod :
{i j : Level} (A : UU i) (B : UU j) →
canonical-pullback (const A unit star) (const B unit star) → A × B
inv-gap-prod A B (pair a (pair b p)) = pair a b
issec-inv-gap-prod :
{i j : Level} (A : UU i) (B : UU j) →
( ( gap (const A unit star) (const B unit star) (cone-prod A B)) ∘
( inv-gap-prod A B)) ~ id
issec-inv-gap-prod A B (pair a (pair b p)) =
eq-Eq-canonical-pullback
( const A unit star)
( const B unit star)
refl
refl
( is-prop-is-contr' (is-prop-is-contr is-contr-unit star star) p refl)
isretr-inv-gap-prod :
{i j : Level} (A : UU i) (B : UU j) →
( ( inv-gap-prod A B) ∘
( gap (const A unit star) (const B unit star) (cone-prod A B))) ~ id
isretr-inv-gap-prod A B (pair a b) =
eq-pair refl refl
abstract
is-pullback-prod :
{i j : Level} (A : UU i) (B : UU j) →
is-pullback (const A unit star) (const B unit star) (cone-prod A B)
is-pullback-prod A B =
is-equiv-has-inverse
( inv-gap-prod A B)
( issec-inv-gap-prod A B)
( isretr-inv-gap-prod A B)
{- We conclude that cartesian products satisfy the universal property of
pullbacks. -}
abstract
universal-property-pullback-prod :
{i j : Level} (A : UU i) (B : UU j) →
{l : Level} → universal-property-pullback l
( const A unit star)
( const B unit star)
( cone-prod A B)
universal-property-pullback-prod A B =
up-pullback-is-pullback
( const A unit star)
( const B unit star)
( cone-prod A B)
( is-pullback-prod A B)
{- Similar as the above, but now for families of products. -}
cone-fiberwise-prod :
{l1 l2 l3 : Level} {X : UU l1} (P : X → UU l2) (Q : X → UU l3) →
cone (pr1 {A = X} {B = P}) (pr1 {A = X} {B = Q}) (Σ X (λ x → (P x) × (Q x)))
cone-fiberwise-prod P Q =
pair
( tot (λ x → pr1))
( pair
( tot (λ x → pr2))
( refl-htpy))
{- We will show that the fiberwise product is a pullback by showing that the
gap map is an equivalence. We do this by directly construct an inverse to
the gap map. -}
inv-gap-fiberwise-prod :
{l1 l2 l3 : Level} {X : UU l1} (P : X → UU l2) (Q : X → UU l3) →
canonical-pullback (pr1 {B = P}) (pr1 {B = Q}) → Σ X (λ x → (P x) × (Q x))
inv-gap-fiberwise-prod P Q (pair (pair x p) (pair (pair .x q) refl)) =
pair x (pair p q)
issec-inv-gap-fiberwise-prod :
{l1 l2 l3 : Level} {X : UU l1} (P : X → UU l2) (Q : X → UU l3) →
((gap (pr1 {B = P}) (pr1 {B = Q}) (cone-fiberwise-prod P Q)) ∘
(inv-gap-fiberwise-prod P Q)) ~ id
issec-inv-gap-fiberwise-prod P Q (pair (pair x p) (pair (pair .x q) refl)) =
eq-pair refl (eq-pair refl refl)
isretr-inv-gap-fiberwise-prod :
{l1 l2 l3 : Level} {X : UU l1} (P : X → UU l2) (Q : X → UU l3) →
( ( inv-gap-fiberwise-prod P Q) ∘
( gap (pr1 {B = P}) (pr1 {B = Q}) (cone-fiberwise-prod P Q))) ~ id
isretr-inv-gap-fiberwise-prod P Q (pair x (pair p q)) = refl
{- With all the pieces in place we conclude that the fiberwise product is a
pullback. -}
abstract
is-pullback-fiberwise-prod :
{l1 l2 l3 : Level} {X : UU l1} (P : X → UU l2) (Q : X → UU l3) →
is-pullback (pr1 {A = X} {B = P}) (pr1 {A = X} {B = Q})
(cone-fiberwise-prod P Q)
is-pullback-fiberwise-prod P Q =
is-equiv-has-inverse
( inv-gap-fiberwise-prod P Q)
( issec-inv-gap-fiberwise-prod P Q)
( isretr-inv-gap-fiberwise-prod P Q)
{- Furthermore we conclude that the fiberwise product satisfies the universal
property of pullbacks. -}
abstract
universal-property-pullback-fiberwise-prod :
{l1 l2 l3 l4 : Level} {X : UU l1} (P : X → UU l2) (Q : X → UU l3) →
universal-property-pullback l4 (pr1 {B = P}) (pr1 {B = Q})
(cone-fiberwise-prod P Q)
universal-property-pullback-fiberwise-prod P Q =
up-pullback-is-pullback pr1 pr1
( cone-fiberwise-prod P Q)
( is-pullback-fiberwise-prod P Q)
{- We now generalize the above to arbitrary maps and their fibers. -}
cone-total-prod-fibers :
{l1 l2 l3 : Level} {A : UU l1} {B : UU l2} {X : UU l3}
(f : A → X) (g : B → X) → cone f g (Σ X (λ x → (fib f x) × (fib g x)))
cone-total-prod-fibers f g =
pair
( λ t → pr1 (pr1 (pr2 t)))
( pair
( λ t → pr1 (pr2 (pr2 t)))
( λ t → (pr2 (pr1 (pr2 t))) ∙ (inv (pr2 (pr2 (pr2 t))))))
cone-span :
{l1 l2 l3 l4 l5 l6 : Level} {A : UU l1} {B : UU l2}
{X : UU l3} (f : A → X) (g : B → X)
{A' : UU l4} {B' : UU l5} {C : A' → B' → UU l6}
(i : A' → A) (j : B' → B)
(k : (x : A') (y : B') → C x y → Id (f (i x)) (g (j y))) →
cone f g (Σ A' (λ x → Σ B' (C x)))
cone-span f g i j k =
pair
( λ t → i (pr1 t))
( pair
( λ t → j (pr1 (pr2 t)))
( λ t → k (pr1 t) (pr1 (pr2 t)) (pr2 (pr2 t))))
abstract
is-pullback-cone-span-is-equiv :
{l1 l2 l3 l4 l5 l6 : Level} {A : UU l1} {B : UU l2}
{X : UU l3} (f : A → X) (g : B → X)
{A' : UU l4} {B' : UU l5} {C : A' → B' → UU l6}
(i : A' → A) (j : B' → B)
(k : (x' : A') (y' : B') → C x' y' → Id (f (i x')) (g (j y'))) →
is-equiv i → is-equiv j → ((x : A') (y : B') → is-equiv (k x y)) →
is-pullback f g (cone-span f g i j k)
is-pullback-cone-span-is-equiv {B = B} f g i j k
is-equiv-i is-equiv-j is-equiv-k =
is-equiv-toto-is-fiberwise-equiv-is-equiv-base-map
( λ x → Σ B (λ y → Id (f x) (g y)))
( i)
( λ x' → toto (λ y → Id (f (i x')) (g y)) j (k x'))
( is-equiv-i)
( λ x' → is-equiv-toto-is-fiberwise-equiv-is-equiv-base-map
( λ y → Id (f (i x')) (g y))
( j)
( k x')
( is-equiv-j)
( is-equiv-k x'))
abstract
is-pullback-total-prod-fibers :
{l1 l2 l3 : Level} {A : UU l1} {B : UU l2} {X : UU l3}
(f : A → X) (g : B → X) →
is-pullback f g (cone-total-prod-fibers f g)
is-pullback-total-prod-fibers f g =
is-equiv-comp
( gap f g (cone-total-prod-fibers f g))
( gap f g
(cone-span f g
( Σ-fib-to-domain f)
( Σ-fib-to-domain g)
( λ s t α → (pr2 (pr2 s)) ∙ (α ∙ (inv (pr2 (pr2 t)))))))
( gap
( pr1 {B = fib f})
( pr1 {B = fib g})
( cone-fiberwise-prod (fib f) (fib g)))
( λ t → refl)
( is-pullback-fiberwise-prod (fib f) (fib g))
( is-pullback-cone-span-is-equiv f g
( Σ-fib-to-domain f)
( Σ-fib-to-domain g)
( λ s t α → (pr2 (pr2 s)) ∙ (α ∙ (inv (pr2 (pr2 t)))))
( is-equiv-Σ-fib-to-domain f)
( is-equiv-Σ-fib-to-domain g)
( λ s t → is-equiv-comp _
( concat (pr2 (pr2 s)) (g (pr1 (pr2 t))))
( concat' (pr1 s) (inv (pr2 (pr2 t))))
( refl-htpy)
( is-equiv-concat' (pr1 s) (inv (pr2 (pr2 t))))
( is-equiv-concat (pr2 (pr2 s)) (g (pr1 (pr2 t))))))
-- Section 13.4 Fibers as pullbacks
square-fiber :
{l1 l2 : Level} {A : UU l1} {B : UU l2} (f : A → B) (b : B) →
( f ∘ (pr1 {B = λ x → Id (f x) b})) ~
( (const unit B b) ∘ (const (fib f b) unit star))
square-fiber f b = pr2
cone-fiber :
{l1 l2 : Level} {A : UU l1} {B : UU l2} (f : A → B) (b : B) →
cone f (const unit B b) (fib f b)
cone-fiber f b =
pair pr1 (pair (const (fib f b) unit star) (square-fiber f b))
abstract
is-pullback-cone-fiber :
{l1 l2 : Level} {A : UU l1} {B : UU l2} (f : A → B) →
(b : B) → is-pullback f (const unit B b) (cone-fiber f b)
is-pullback-cone-fiber f b =
is-equiv-tot-is-fiberwise-equiv ( λ a →
is-equiv-left-unit-law-Σ-map-gen (λ t → Id (f a) b) is-contr-unit star)
abstract
universal-property-pullback-cone-fiber :
{l1 l2 l3 : Level} {A : UU l1} {B : UU l2} (f : A → B) (b : B) →
universal-property-pullback l3 f (const unit B b) (cone-fiber f b)
universal-property-pullback-cone-fiber {B = B} f b =
up-pullback-is-pullback f (const unit B b)
( cone-fiber f b)
( is-pullback-cone-fiber f b)
cone-fiber-fam :
{l1 l2 : Level} {A : UU l1} (B : A → UU l2)
(a : A) → cone (pr1 {B = B}) (const unit A a) (B a)
cone-fiber-fam B a =
pair (λ b → pair a b) (pair (const (B a) unit star) (λ b → refl))
abstract
is-pullback-cone-fiber-fam :
{l1 l2 : Level} {A : UU l1} (B : A → UU l2) →
(a : A) → is-pullback (pr1 {B = B}) (const unit A a) (cone-fiber-fam B a)
is-pullback-cone-fiber-fam {A = A} B a =
is-equiv-comp
( gap (pr1 {B = B}) (const unit A a) (cone-fiber-fam B a))
( gap (pr1 {B = B}) (const unit A a) (cone-fiber (pr1 {B = B}) a))
( fib-pr1-fib-fam B a)
( λ y → refl)
( is-equiv-fib-pr1-fib-fam B a)
( is-pullback-cone-fiber pr1 a)
-- Section 13.5 Fiberwise equivalences
cone-subst :
{l1 l2 l3 : Level} {A : UU l1} {B : UU l2} (f : A → B) (Q : B → UU l3) →
cone f (pr1 {B = Q}) (Σ A (λ x → Q (f x)))
cone-subst f Q =
pair pr1 (pair (Σ-map-base-map f Q) (λ t → refl))
inv-gap-cone-subst :
{l1 l2 l3 : Level} {A : UU l1} {B : UU l2} (f : A → B) (Q : B → UU l3) →
canonical-pullback f (pr1 {B = Q}) → Σ A (λ x → Q (f x))
inv-gap-cone-subst f Q (pair x (pair (pair .(f x) q) refl)) =
pair x q
issec-inv-gap-cone-subst :
{l1 l2 l3 : Level} {A : UU l1} {B : UU l2} (f : A → B) (Q : B → UU l3) →
((gap f (pr1 {B = Q}) (cone-subst f Q)) ∘ (inv-gap-cone-subst f Q)) ~ id
issec-inv-gap-cone-subst f Q (pair x (pair (pair .(f x) q) refl)) =
refl
isretr-inv-gap-cone-subst :
{l1 l2 l3 : Level} {A : UU l1} {B : UU l2} (f : A → B) (Q : B → UU l3) →
((inv-gap-cone-subst f Q) ∘ (gap f (pr1 {B = Q}) (cone-subst f Q))) ~ id
isretr-inv-gap-cone-subst f Q (pair x q) =
refl
abstract
is-pullback-cone-subst :
{l1 l2 l3 : Level} {A : UU l1} {B : UU l2} (f : A → B) (Q : B → UU l3) →
is-pullback f (pr1 {B = Q}) (cone-subst f Q)
is-pullback-cone-subst f Q =
is-equiv-has-inverse
( inv-gap-cone-subst f Q)
( issec-inv-gap-cone-subst f Q)
( isretr-inv-gap-cone-subst f Q)
cone-toto :
{l1 l2 l3 l4 : Level} {A : UU l1} {B : UU l2} {P : A → UU l3}
(Q : B → UU l4) (f : A → B) (g : (x : A) → (P x) → (Q (f x))) →
cone f (pr1 {B = Q}) (Σ A P)
cone-toto Q f g = pair pr1 (pair (toto Q f g) (λ t → refl))
abstract
is-pullback-is-fiberwise-equiv :
{l1 l2 l3 l4 : Level} {A : UU l1} {B : UU l2} {P : A → UU l3}
(Q : B → UU l4) (f : A → B) (g : (x : A) → (P x) → (Q (f x))) →
is-fiberwise-equiv g → is-pullback f (pr1 {B = Q}) (cone-toto Q f g)
is-pullback-is-fiberwise-equiv Q f g is-equiv-g =
is-equiv-comp
( gap f pr1 (cone-toto Q f g))
( gap f pr1 (cone-subst f Q))
( tot g)
( λ t → refl)
( is-equiv-tot-is-fiberwise-equiv is-equiv-g)
( is-pullback-cone-subst f Q)
abstract
universal-property-pullback-is-fiberwise-equiv :
{l1 l2 l3 l4 l5 : Level} {A : UU l1} {B : UU l2} {P : A → UU l3}
(Q : B → UU l4) (f : A → B) (g : (x : A) → (P x) → (Q (f x))) →
is-fiberwise-equiv g →
universal-property-pullback l5 f (pr1 {B = Q}) (cone-toto Q f g)
universal-property-pullback-is-fiberwise-equiv Q f g is-equiv-g =
up-pullback-is-pullback f pr1 (cone-toto Q f g)
( is-pullback-is-fiberwise-equiv Q f g is-equiv-g)
abstract
is-fiberwise-equiv-is-pullback :
{l1 l2 l3 l4 : Level} {A : UU l1} {B : UU l2} {P : A → UU l3}
(Q : B → UU l4) (f : A → B) (g : (x : A) → (P x) → (Q (f x))) →
is-pullback f (pr1 {B = Q}) (cone-toto Q f g) → is-fiberwise-equiv g
is-fiberwise-equiv-is-pullback Q f g is-pullback-cone-toto =
is-fiberwise-equiv-is-equiv-tot g
( is-equiv-right-factor
( gap f pr1 (cone-toto Q f g))
( gap f pr1 (cone-subst f Q))
( tot g)
( λ t → refl)
( is-pullback-cone-subst f Q)
( is-pullback-cone-toto))
abstract
is-fiberwise-equiv-universal-property-pullback :
{l1 l2 l3 l4 : Level} {A : UU l1} {B : UU l2} {P : A → UU l3}
(Q : B → UU l4) (f : A → B) (g : (x : A) → (P x) → (Q (f x))) →
( {l : Level} → universal-property-pullback l f (pr1 {B = Q})
(cone-toto Q f g)) →
is-fiberwise-equiv g
is-fiberwise-equiv-universal-property-pullback Q f g up =
is-fiberwise-equiv-is-pullback Q f g
( is-pullback-up-pullback f pr1 (cone-toto Q f g) up)
fib-square :
{l1 l2 l3 l4 : Level} {A : UU l1} {B : UU l2} {C : UU l3} {X : UU l4}
(f : A → X) (g : B → X) (c : cone f g C) →
(x : A) → fib (pr1 c) x → fib g (f x)
fib-square f g c x t =
let p = pr1 c
q = pr1 (pr2 c)
H = pr2 (pr2 c)
in
pair (q (pr1 t) ) ((inv (H (pr1 t))) ∙ (ap f (pr2 t)))
fib-square-id :
{l1 l2 : Level} {B : UU l1} {X : UU l2} (g : B → X) (x : X) →
fib-square id g (pair g (pair id refl-htpy)) x ~ id
fib-square-id g .(g b) (pair b refl) =
refl
square-tot-fib-square :
{l1 l2 l3 l4 : Level} {A : UU l1} {B : UU l2} {C : UU l3} {X : UU l4}
(f : A → X) (g : B → X) (c : cone f g C) →
( (gap f g c) ∘ (Σ-fib-to-domain (pr1 c))) ~
( (tot (λ a → tot (λ b → inv))) ∘ (tot (fib-square f g c)))
square-tot-fib-square f g c (pair .((pr1 c) x) (pair x refl)) =
let p = pr1 c
q = pr1 (pr2 c)
H = pr2 (pr2 c)
in
eq-pair refl
( eq-pair refl
( inv ((ap inv right-unit) ∙ (inv-inv (H x)))))
abstract
is-fiberwise-equiv-fib-square-is-pullback :
{l1 l2 l3 l4 : Level} {A : UU l1} {B : UU l2} {C : UU l3} {X : UU l4}
(f : A → X) (g : B → X) (c : cone f g C) →
is-pullback f g c → is-fiberwise-equiv (fib-square f g c)
is-fiberwise-equiv-fib-square-is-pullback f g c pb =
let p = pr1 c
q = pr1 (pr2 c)
H = pr2 (pr2 c)
in
is-fiberwise-equiv-is-equiv-tot
( fib-square f g c)
( is-equiv-top-is-equiv-bottom-square
( Σ-fib-to-domain p)
( tot (λ x → tot (λ y → inv)))
( tot (fib-square f g c))
( gap f g c)
( square-tot-fib-square f g c)
( is-equiv-Σ-fib-to-domain p)
( is-equiv-tot-is-fiberwise-equiv
( λ x → is-equiv-tot-is-fiberwise-equiv
( λ y → is-equiv-inv (g y) (f x))))
( pb))
abstract
is-pullback-is-fiberwise-equiv-fib-square :
{l1 l2 l3 l4 : Level} {A : UU l1} {B : UU l2} {C : UU l3} {X : UU l4}
(f : A → X) (g : B → X) (c : cone f g C) →
is-fiberwise-equiv (fib-square f g c) → is-pullback f g c
is-pullback-is-fiberwise-equiv-fib-square f g c is-equiv-fsq =
let p = pr1 c
q = pr1 (pr2 c)
H = pr2 (pr2 c)
in
is-equiv-bottom-is-equiv-top-square
( Σ-fib-to-domain p)
( tot (λ x → tot (λ y → inv)))
( tot (fib-square f g c))
( gap f g c)
( square-tot-fib-square f g c)
( is-equiv-Σ-fib-to-domain p)
( is-equiv-tot-is-fiberwise-equiv
( λ x → is-equiv-tot-is-fiberwise-equiv
( λ y → is-equiv-inv (g y) (f x))))
( is-equiv-tot-is-fiberwise-equiv is-equiv-fsq)
abstract
is-trunc-is-pullback :
{l1 l2 l3 l4 : Level} (k : 𝕋) {A : UU l1} {B : UU l2} {C : UU l3}
{X : UU l4} (f : A → X) (g : B → X) (c : cone f g C) →
is-pullback f g c → is-trunc-map k g → is-trunc-map k (pr1 c)
is-trunc-is-pullback k f g c pb is-trunc-g a =
is-trunc-is-equiv k
( fib g (f a))
( fib-square f g c a)
( is-fiberwise-equiv-fib-square-is-pullback f g c pb a)
(is-trunc-g (f a))
abstract
is-emb-is-pullback :
{l1 l2 l3 l4 : Level} {A : UU l1} {B : UU l2} {C : UU l3} {X : UU l4}
(f : A → X) (g : B → X) (c : cone f g C) →
is-pullback f g c → is-emb g → is-emb (pr1 c)
is-emb-is-pullback f g c pb is-emb-g =
is-emb-is-prop-map
( pr1 c)
( is-trunc-is-pullback neg-one-𝕋 f g c pb (is-prop-map-is-emb g is-emb-g))
abstract
is-equiv-is-pullback :
{l1 l2 l3 l4 : Level} {A : UU l1} {B : UU l2} {C : UU l3} {X : UU l4}
(f : A → X) (g : B → X) (c : cone f g C) →
is-equiv g → is-pullback f g c → is-equiv (pr1 c)
is-equiv-is-pullback f g c is-equiv-g pb =
is-equiv-is-contr-map
( is-trunc-is-pullback neg-two-𝕋 f g c pb
( is-contr-map-is-equiv is-equiv-g))
abstract
is-pullback-is-equiv :
{l1 l2 l3 l4 : Level} {A : UU l1} {B : UU l2} {C : UU l3} {X : UU l4}
(f : A → X) (g : B → X) (c : cone f g C) →
is-equiv g → is-equiv (pr1 c) → is-pullback f g c
is-pullback-is-equiv f g c is-equiv-g is-equiv-p =
is-pullback-is-fiberwise-equiv-fib-square f g c
( λ a → is-equiv-is-contr
( fib-square f g c a)
( is-contr-map-is-equiv is-equiv-p a)
( is-contr-map-is-equiv is-equiv-g (f a)))
-- Section 13.6 The pullback pasting property
coherence-square-comp-horizontal :
{l1 l2 l3 l4 l5 l6 : Level}
{A : UU l1} {B : UU l2} {C : UU l3} {X : UU l4} {Y : UU l5} {Z : UU l6}
(top-left : A → B) (top-right : B → C)
(left : A → X) (mid : B → Y) (right : C → Z)
(bottom-left : X → Y) (bottom-right : Y → Z) →
coherence-square top-left left mid bottom-left →
coherence-square top-right mid right bottom-right →
coherence-square
(top-right ∘ top-left) left right (bottom-right ∘ bottom-left)
coherence-square-comp-horizontal
top-left top-right left mid right bottom-left bottom-right sq-left sq-right =
(bottom-right ·l sq-left) ∙h (sq-right ·r top-left)
coherence-square-comp-vertical :
{l1 l2 l3 l4 l5 l6 : Level}
{A : UU l1} {B : UU l2} {C : UU l3} {X : UU l4} {Y : UU l5} {Z : UU l6}
(top : A → X)
(left-top : A → B) (right-top : X → Y)
(mid : B → Y)
(left-bottom : B → C) (right-bottom : Y → Z)
(bottom : C → Z) →
coherence-square top left-top right-top mid →
coherence-square mid left-bottom right-bottom bottom →
coherence-square
top (left-bottom ∘ left-top) (right-bottom ∘ right-top) bottom
coherence-square-comp-vertical
top left-top right-top mid left-bottom right-bottom bottom sq-top sq-bottom =
(sq-bottom ·r left-top) ∙h (right-bottom ·l sq-top)
cone-comp-horizontal :
{l1 l2 l3 l4 l5 l6 : Level}
{A : UU l1} {B : UU l2} {C : UU l3} {X : UU l4} {Y : UU l5} {Z : UU l6}
(i : X → Y) (j : Y → Z) (h : C → Z) →
(c : cone j h B) → (cone i (pr1 c) A) → cone (j ∘ i) h A
cone-comp-horizontal i j h c d =
pair
( pr1 d)
( pair
( (pr1 (pr2 c)) ∘ (pr1 (pr2 d)))
( coherence-square-comp-horizontal
(pr1 (pr2 d)) (pr1 (pr2 c)) (pr1 d) (pr1 c) h i j
(pr2 (pr2 d)) (pr2 (pr2 c))))
cone-comp-vertical :
{l1 l2 l3 l4 l5 l6 : Level}
{A : UU l1} {B : UU l2} {C : UU l3} {X : UU l4} {Y : UU l5} {Z : UU l6}
(f : C → Z) (g : Y → Z) (h : X → Y) →
(c : cone f g B) → cone (pr1 (pr2 c)) h A → cone f (g ∘ h) A
cone-comp-vertical f g h c d =
pair
( (pr1 c) ∘ (pr1 d))
( pair
( pr1 (pr2 d))
( coherence-square-comp-vertical
( pr1 (pr2 d)) (pr1 d) h (pr1 (pr2 c)) (pr1 c) g f
( pr2 (pr2 d)) (pr2 (pr2 c))))
fib-square-comp-horizontal :
{l1 l2 l3 l4 l5 l6 : Level}
{A : UU l1} {B : UU l2} {C : UU l3} {X : UU l4} {Y : UU l5} {Z : UU l6}
(i : X → Y) (j : Y → Z) (h : C → Z) →
(c : cone j h B) (d : cone i (pr1 c) A) → (x : X) →
( fib-square (j ∘ i) h (cone-comp-horizontal i j h c d) x) ~
( (fib-square j h c (i x)) ∘ (fib-square i (pr1 c) d x))
fib-square-comp-horizontal i j h c d .(pr1 d a) (pair a refl) =
let f = pr1 d
k = pr1 (pr2 d)
H = pr2 (pr2 d)
g = pr1 c
l = pr1 (pr2 c)
K = pr2 (pr2 c)
in
eq-pair refl
( ( ap
( concat' (h (l (k a))) refl)
( distributive-inv-concat (ap j (H a)) (K (k a)))) ∙
( ( assoc (inv (K (k a))) (inv (ap j (H a))) refl) ∙
( ap
( concat (inv (K (k a))) (j (i (f a))))
( ( ap (concat' (j (g (k a))) refl) (inv (ap-inv j (H a)))) ∙
( inv (ap-concat j (inv (H a)) refl))))))
fib-square-comp-vertical :
{l1 l2 l3 l4 l5 l6 : Level}
{A : UU l1} {B : UU l2} {C : UU l3} {X : UU l4} {Y : UU l5} {Z : UU l6}
(f : C → Z) (g : Y → Z) (h : X → Y) →
(c : cone f g B) (d : cone (pr1 (pr2 c)) h A) (x : C) →
( ( fib-square f (g ∘ h) (cone-comp-vertical f g h c d) x) ∘
( inv-map-fib-comp (pr1 c) (pr1 d) x)) ~
( ( inv-map-fib-comp g h (f x)) ∘
( toto
( λ t → fib h (pr1 t))
( fib-square f g c x)
( λ t → fib-square (pr1 (pr2 c)) h d (pr1 t))))
fib-square-comp-vertical f g h
(pair p (pair q H)) (pair p' (pair q' H')) .(p (p' a))
(pair (pair .(p' a) refl) (pair a refl)) =
eq-pair refl
( ( right-unit) ∙
( ( distributive-inv-concat (H (p' a)) (ap g (H' a))) ∙
( ( ap
( concat (inv (ap g (H' a))) (f (p (p' a))))
( inv right-unit)) ∙
( ap
( concat' (g (h (q' a)))
( pr2
( fib-square f g
( pair p (pair q H))
( p (p' a))
( pair (p' a) refl))))
( ( inv (ap-inv g (H' a))) ∙
( ap (ap g) (inv right-unit)))))))
abstract
is-pullback-rectangle-is-pullback-left-square :
{l1 l2 l3 l4 l5 l6 : Level}
{A : UU l1} {B : UU l2} {C : UU l3} {X : UU l4} {Y : UU l5} {Z : UU l6}
(i : X → Y) (j : Y → Z) (h : C → Z)
(c : cone j h B) (d : cone i (pr1 c) A) →
is-pullback j h c → is-pullback i (pr1 c) d →
is-pullback (j ∘ i) h (cone-comp-horizontal i j h c d)
is-pullback-rectangle-is-pullback-left-square i j h c d is-pb-c is-pb-d =
is-pullback-is-fiberwise-equiv-fib-square (j ∘ i) h
( cone-comp-horizontal i j h c d)
( λ x → is-equiv-comp
( fib-square (j ∘ i) h (cone-comp-horizontal i j h c d) x)
( fib-square j h c (i x))
( fib-square i (pr1 c) d x)
( fib-square-comp-horizontal i j h c d x)
( is-fiberwise-equiv-fib-square-is-pullback i (pr1 c) d is-pb-d x)
( is-fiberwise-equiv-fib-square-is-pullback j h c is-pb-c (i x)))
abstract
is-pullback-left-square-is-pullback-rectangle :
{l1 l2 l3 l4 l5 l6 : Level}
{A : UU l1} {B : UU l2} {C : UU l3} {X : UU l4} {Y : UU l5} {Z : UU l6}
(i : X → Y) (j : Y → Z) (h : C → Z)
(c : cone j h B) (d : cone i (pr1 c) A) →
is-pullback j h c → is-pullback (j ∘ i) h (cone-comp-horizontal i j h c d) →
is-pullback i (pr1 c) d
is-pullback-left-square-is-pullback-rectangle i j h c d is-pb-c is-pb-rect =
is-pullback-is-fiberwise-equiv-fib-square i (pr1 c) d
( λ x → is-equiv-right-factor
( fib-square (j ∘ i) h (cone-comp-horizontal i j h c d) x)
( fib-square j h c (i x))
( fib-square i (pr1 c) d x)
( fib-square-comp-horizontal i j h c d x)
( is-fiberwise-equiv-fib-square-is-pullback j h c is-pb-c (i x))
( is-fiberwise-equiv-fib-square-is-pullback (j ∘ i) h
( cone-comp-horizontal i j h c d) is-pb-rect x))
abstract
is-pullback-top-is-pullback-rectangle :
{l1 l2 l3 l4 l5 l6 : Level}
{A : UU l1} {B : UU l2} {C : UU l3} {X : UU l4} {Y : UU l5} {Z : UU l6}
(f : C → Z) (g : Y → Z) (h : X → Y) →
(c : cone f g B) (d : cone (pr1 (pr2 c)) h A) →
is-pullback f g c →
is-pullback f (g ∘ h) (cone-comp-vertical f g h c d) →
is-pullback (pr1 (pr2 c)) h d
is-pullback-top-is-pullback-rectangle f g h c d is-pb-c is-pb-dc =
is-pullback-is-fiberwise-equiv-fib-square (pr1 (pr2 c)) h d
( λ x → is-fiberwise-equiv-is-equiv-toto-is-equiv-base-map
( λ t → fib h (pr1 t))
( fib-square f g c ((pr1 c) x))
( λ t → fib-square (pr1 (pr2 c)) h d (pr1 t))
( is-fiberwise-equiv-fib-square-is-pullback f g c is-pb-c ((pr1 c) x))
( is-equiv-top-is-equiv-bottom-square
( inv-map-fib-comp (pr1 c) (pr1 d) ((pr1 c) x))
( inv-map-fib-comp g h (f ((pr1 c) x)))
( toto
( λ t → fib h (pr1 t))
( fib-square f g c ((pr1 c) x))
( λ t → fib-square (pr1 (pr2 c)) h d (pr1 t)))
( fib-square f (g ∘ h) (cone-comp-vertical f g h c d) ((pr1 c) x))
( fib-square-comp-vertical f g h c d ((pr1 c) x))
( is-equiv-inv-map-fib-comp (pr1 c) (pr1 d) ((pr1 c) x))
( is-equiv-inv-map-fib-comp g h (f ((pr1 c) x)))
( is-fiberwise-equiv-fib-square-is-pullback f (g ∘ h)
( cone-comp-vertical f g h c d) is-pb-dc ((pr1 c) x)))
( pair x refl))
abstract
is-pullback-rectangle-is-pullback-top :
{l1 l2 l3 l4 l5 l6 : Level}
{A : UU l1} {B : UU l2} {C : UU l3} {X : UU l4} {Y : UU l5} {Z : UU l6}
(f : C → Z) (g : Y → Z) (h : X → Y) →
(c : cone f g B) (d : cone (pr1 (pr2 c)) h A) →
is-pullback f g c →
is-pullback (pr1 (pr2 c)) h d →
is-pullback f (g ∘ h) (cone-comp-vertical f g h c d)
is-pullback-rectangle-is-pullback-top f g h c d is-pb-c is-pb-d =
is-pullback-is-fiberwise-equiv-fib-square f (g ∘ h)
( cone-comp-vertical f g h c d)
( λ x → is-equiv-bottom-is-equiv-top-square
( inv-map-fib-comp (pr1 c) (pr1 d) x)
( inv-map-fib-comp g h (f x))
( toto
( λ t → fib h (pr1 t))
( fib-square f g c x)
( λ t → fib-square (pr1 (pr2 c)) h d (pr1 t)))
( fib-square f (g ∘ h) (cone-comp-vertical f g h c d) x)
( fib-square-comp-vertical f g h c d x)
( is-equiv-inv-map-fib-comp (pr1 c) (pr1 d) x)
( is-equiv-inv-map-fib-comp g h (f x))
( is-equiv-toto-is-fiberwise-equiv-is-equiv-base-map
( λ t → fib h (pr1 t))
( fib-square f g c x)
( λ t → fib-square (pr1 (pr2 c)) h d (pr1 t))
( is-fiberwise-equiv-fib-square-is-pullback f g c is-pb-c x)
( λ t → is-fiberwise-equiv-fib-square-is-pullback
(pr1 (pr2 c)) h d is-pb-d (pr1 t))))
-- Section 13.7 Descent for coproducts and Σ-types
fib-functor-coprod-inl-fib : {l1 l2 l1' l2' : Level}
{A : UU l1} {B : UU l2} {A' : UU l1'} {B' : UU l2'}
(f : A' → A) (g : B' → B) (x : A) →
fib f x → fib (functor-coprod f g) (inl x)
fib-functor-coprod-inl-fib f g x (pair a' p) =
pair (inl a') (ap inl p)
fib-fib-functor-coprod-inl : {l1 l2 l1' l2' : Level}
{A : UU l1} {B : UU l2} {A' : UU l1'} {B' : UU l2'}
(f : A' → A) (g : B' → B) (x : A) →
fib (functor-coprod f g) (inl x) → fib f x
fib-fib-functor-coprod-inl f g x (pair (inl a') p) =
pair a' (map-compute-eq-coprod-inl-inl (f a') x p)
fib-fib-functor-coprod-inl f g x (pair (inr b') p) =
ind-empty {P = λ t → fib f x}
( map-compute-eq-coprod-inr-inl (g b') x p)
issec-fib-fib-functor-coprod-inl : {l1 l2 l1' l2' : Level}
{A : UU l1} {B : UU l2} {A' : UU l1'} {B' : UU l2'}
(f : A' → A) (g : B' → B) (x : A) →
( (fib-functor-coprod-inl-fib f g x) ∘
( fib-fib-functor-coprod-inl f g x)) ~ id
issec-fib-fib-functor-coprod-inl f g .(f a') (pair (inl a') refl) =
eq-pair refl
( ap (ap inl)
( isretr-inv-is-equiv
( is-equiv-map-raise _ (Id (f a') (f a'))) refl))
issec-fib-fib-functor-coprod-inl f g x (pair (inr b') p) =
ind-empty
{ P = λ t → Id
( fib-functor-coprod-inl-fib f g x
( fib-fib-functor-coprod-inl f g x (pair (inr b') p)))
( pair (inr b') p)}
( map-compute-eq-coprod-inr-inl (g b') x p)
isretr-fib-fib-functor-coprod-inl : {l1 l2 l1' l2' : Level}
{A : UU l1} {B : UU l2} {A' : UU l1'} {B' : UU l2'}
(f : A' → A) (g : B' → B) (x : A) →
( (fib-fib-functor-coprod-inl f g x) ∘
( fib-functor-coprod-inl-fib f g x)) ~ id
isretr-fib-fib-functor-coprod-inl f g .(f a') (pair a' refl) =
eq-pair refl
( isretr-inv-is-equiv (is-equiv-map-raise _ (Id (f a') (f a'))) refl)
abstract
is-equiv-fib-functor-coprod-inl-fib : {l1 l2 l1' l2' : Level}
{A : UU l1} {B : UU l2} {A' : UU l1'} {B' : UU l2'}
(f : A' → A) (g : B' → B) (x : A) →
is-equiv (fib-functor-coprod-inl-fib f g x)
is-equiv-fib-functor-coprod-inl-fib f g x =
is-equiv-has-inverse
( fib-fib-functor-coprod-inl f g x)
( issec-fib-fib-functor-coprod-inl f g x)
( isretr-fib-fib-functor-coprod-inl f g x)
fib-functor-coprod-inr-fib : {l1 l2 l1' l2' : Level}
{A : UU l1} {B : UU l2} {A' : UU l1'} {B' : UU l2'}
(f : A' → A) (g : B' → B) (y : B) →
fib g y → fib (functor-coprod f g) (inr y)
fib-functor-coprod-inr-fib f g y (pair b' p) =
pair (inr b') (ap inr p)
fib-fib-functor-coprod-inr : {l1 l2 l1' l2' : Level}
{A : UU l1} {B : UU l2} {A' : UU l1'} {B' : UU l2'}
(f : A' → A) (g : B' → B) (y : B) →
fib (functor-coprod f g) (inr y) → fib g y
fib-fib-functor-coprod-inr f g y (pair (inl a') p) =
ind-empty {P = λ t → fib g y}
( map-compute-eq-coprod-inl-inr (f a') y p)
fib-fib-functor-coprod-inr f g y (pair (inr b') p) =
pair b' (map-compute-eq-coprod-inr-inr (g b') y p)
issec-fib-fib-functor-coprod-inr : {l1 l2 l1' l2' : Level}
{A : UU l1} {B : UU l2} {A' : UU l1'} {B' : UU l2'}
(f : A' → A) (g : B' → B) (y : B) →
( (fib-functor-coprod-inr-fib f g y) ∘
( fib-fib-functor-coprod-inr f g y)) ~ id
issec-fib-fib-functor-coprod-inr f g .(g b') (pair (inr b') refl) =
eq-pair refl
( ap (ap inr)
( isretr-inv-is-equiv
( is-equiv-map-raise _ (Id (g b') (g b'))) refl))
issec-fib-fib-functor-coprod-inr f g y (pair (inl a') p) =
ind-empty
{ P = λ t → Id
( fib-functor-coprod-inr-fib f g y
( fib-fib-functor-coprod-inr f g y (pair (inl a') p)))
( pair (inl a') p)}
( map-compute-eq-coprod-inl-inr (f a') y p)
isretr-fib-fib-functor-coprod-inr : {l1 l2 l1' l2' : Level}
{A : UU l1} {B : UU l2} {A' : UU l1'} {B' : UU l2'}
(f : A' → A) (g : B' → B) (y : B) →
( (fib-fib-functor-coprod-inr f g y) ∘
( fib-functor-coprod-inr-fib f g y)) ~ id
isretr-fib-fib-functor-coprod-inr f g .(g b') (pair b' refl) =
eq-pair refl
( isretr-inv-is-equiv (is-equiv-map-raise _ (Id (g b') (g b'))) refl)
abstract
is-equiv-fib-functor-coprod-inr-fib : {l1 l2 l1' l2' : Level}
{A : UU l1} {B : UU l2} {A' : UU l1'} {B' : UU l2'}
(f : A' → A) (g : B' → B) (y : B) →
is-equiv (fib-functor-coprod-inr-fib f g y)
is-equiv-fib-functor-coprod-inr-fib f g y =
is-equiv-has-inverse
( fib-fib-functor-coprod-inr f g y)
( issec-fib-fib-functor-coprod-inr f g y)
( isretr-fib-fib-functor-coprod-inr f g y)
cone-descent-coprod : {l1 l2 l3 l1' l2' l3' : Level}
{A : UU l1} {B : UU l2} {X : UU l3} {A' : UU l1'} {B' : UU l2'} {X' : UU l3'}
(f : A → X) (g : B → X) (i : X' → X)
(cone-A' : cone f i A') (cone-B' : cone g i B') →
cone (ind-coprod _ f g) i (coprod A' B')
cone-descent-coprod f g i (pair h (pair f' H)) (pair k (pair g' K)) =
pair
( functor-coprod h k)
( pair
( ind-coprod _ f' g')
( ind-coprod _ H K))
triangle-descent-square-fib-functor-coprod-inl-fib :
{l1 l2 l3 l1' l2' l3' : Level}
{A : UU l1} {B : UU l2} {X : UU l3}
{A' : UU l1'} {B' : UU l2'} {X' : UU l3'}
(f : A' → A) (g : B' → B) (h : X' → X)
(αA : A → X) (αB : B → X) (αA' : A' → X') (αB' : B' → X')
(HA : (αA ∘ f) ~ (h ∘ αA')) (HB : (αB ∘ g) ~ (h ∘ αB')) (x : A) →
(fib-square αA h (pair f (pair αA' HA)) x) ~
( (fib-square (ind-coprod _ αA αB) h
( pair
( functor-coprod f g)
( pair (ind-coprod _ αA' αB') (ind-coprod _ HA HB))) (inl x)) ∘
( fib-functor-coprod-inl-fib f g x))
triangle-descent-square-fib-functor-coprod-inl-fib
{X = X} {X' = X'} f g h αA αB αA' αB' HA HB x (pair a' p) =
eq-pair refl
( ap (concat (inv (HA a')) (αA x))
( ap-comp (ind-coprod _ αA αB) inl p))
triangle-descent-square-fib-functor-coprod-inr-fib :
{l1 l2 l3 l1' l2' l3' : Level}
{A : UU l1} {B : UU l2} {X : UU l3}
{A' : UU l1'} {B' : UU l2'} {X' : UU l3'}
(f : A' → A) (g : B' → B) (h : X' → X)
(αA : A → X) (αB : B → X) (αA' : A' → X') (αB' : B' → X')
(HA : (αA ∘ f) ~ (h ∘ αA')) (HB : (αB ∘ g) ~ (h ∘ αB')) (y : B) →
(fib-square αB h (pair g (pair αB' HB)) y) ~
( (fib-square (ind-coprod _ αA αB) h
( pair
( functor-coprod f g)
( pair (ind-coprod _ αA' αB') (ind-coprod _ HA HB))) (inr y)) ∘
( fib-functor-coprod-inr-fib f g y))
triangle-descent-square-fib-functor-coprod-inr-fib
{X = X} {X' = X'} f g h αA αB αA' αB' HA HB y ( pair b' p) =
eq-pair refl
( ap (concat (inv (HB b')) (αB y))
( ap-comp (ind-coprod _ αA αB) inr p))
abstract
descent-coprod : {l1 l2 l3 l1' l2' l3' : Level}
{A : UU l1} {B : UU l2} {X : UU l3}
{A' : UU l1'} {B' : UU l2'} {X' : UU l3'}
(f : A → X) (g : B → X) (i : X' → X)
(cone-A' : cone f i A') (cone-B' : cone g i B') →
is-pullback f i cone-A' →
is-pullback g i cone-B' →
is-pullback (ind-coprod _ f g) i (cone-descent-coprod f g i cone-A' cone-B')
descent-coprod f g i (pair h (pair f' H)) (pair k (pair g' K))
is-pb-cone-A' is-pb-cone-B' =
is-pullback-is-fiberwise-equiv-fib-square
( ind-coprod _ f g)
( i)
( cone-descent-coprod f g i (pair h (pair f' H)) (pair k (pair g' K)))
( ind-coprod _
( λ x → is-equiv-left-factor
( fib-square f i (pair h (pair f' H)) x)
( fib-square (ind-coprod _ f g) i
( pair (functor-coprod h k)
( pair (ind-coprod _ f' g') (ind-coprod _ H K)))
( inl x))
( fib-functor-coprod-inl-fib h k x)
( triangle-descent-square-fib-functor-coprod-inl-fib
h k i f g f' g' H K x)
( is-fiberwise-equiv-fib-square-is-pullback f i
( pair h (pair f' H)) is-pb-cone-A' x)
( is-equiv-fib-functor-coprod-inl-fib h k x))
( λ y → is-equiv-left-factor
( fib-square g i (pair k (pair g' K)) y)
( fib-square
( ind-coprod _ f g) i
( pair
( functor-coprod h k)
( pair (ind-coprod _ f' g') (ind-coprod _ H K))) (inr y))
( fib-functor-coprod-inr-fib h k y)
( triangle-descent-square-fib-functor-coprod-inr-fib
h k i f g f' g' H K y)
( is-fiberwise-equiv-fib-square-is-pullback g i
( pair k (pair g' K)) is-pb-cone-B' y)
( is-equiv-fib-functor-coprod-inr-fib h k y)))
abstract
descent-coprod-inl : {l1 l2 l3 l1' l2' l3' : Level}
{A : UU l1} {B : UU l2} {X : UU l3}
{A' : UU l1'} {B' : UU l2'} {X' : UU l3'}
(f : A → X) (g : B → X) (i : X' → X)
(cone-A' : cone f i A') (cone-B' : cone g i B') →
is-pullback
( ind-coprod _ f g)
( i)
( cone-descent-coprod f g i cone-A' cone-B') →
is-pullback f i cone-A'
descent-coprod-inl f g i (pair h (pair f' H)) (pair k (pair g' K))
is-pb-dsq =
is-pullback-is-fiberwise-equiv-fib-square f i (pair h (pair f' H))
( λ a → is-equiv-comp
( fib-square f i (pair h (pair f' H)) a)
( fib-square (ind-coprod _ f g) i
( cone-descent-coprod f g i
( pair h (pair f' H)) (pair k (pair g' K))) (inl a))
( fib-functor-coprod-inl-fib h k a)
( triangle-descent-square-fib-functor-coprod-inl-fib
h k i f g f' g' H K a)
( is-equiv-fib-functor-coprod-inl-fib h k a)
( is-fiberwise-equiv-fib-square-is-pullback (ind-coprod _ f g) i
( cone-descent-coprod f g i
( pair h (pair f' H)) (pair k (pair g' K))) is-pb-dsq (inl a)))
abstract
descent-coprod-inr : {l1 l2 l3 l1' l2' l3' : Level}
{A : UU l1} {B : UU l2} {X : UU l3}
{A' : UU l1'} {B' : UU l2'} {X' : UU l3'}
(f : A → X) (g : B → X) (i : X' → X)
(cone-A' : cone f i A') (cone-B' : cone g i B') →
is-pullback
( ind-coprod _ f g)
( i)
( cone-descent-coprod f g i cone-A' cone-B') →
is-pullback g i cone-B'
descent-coprod-inr f g i (pair h (pair f' H)) (pair k (pair g' K))
is-pb-dsq =
is-pullback-is-fiberwise-equiv-fib-square g i (pair k (pair g' K))
( λ b → is-equiv-comp
( fib-square g i (pair k (pair g' K)) b)
( fib-square (ind-coprod _ f g) i
( cone-descent-coprod f g i
( pair h (pair f' H)) (pair k (pair g' K))) (inr b))
( fib-functor-coprod-inr-fib h k b)
( triangle-descent-square-fib-functor-coprod-inr-fib
h k i f g f' g' H K b)
( is-equiv-fib-functor-coprod-inr-fib h k b)
( is-fiberwise-equiv-fib-square-is-pullback (ind-coprod _ f g) i
( cone-descent-coprod f g i
( pair h (pair f' H)) (pair k (pair g' K))) is-pb-dsq (inr b)))
-- Descent for Σ-types
cone-descent-Σ : {l1 l2 l3 l4 l5 : Level}
{I : UU l1} {A : I → UU l2} {A' : I → UU l3} {X : UU l4} {X' : UU l5}
(f : (i : I) → A i → X) (h : X' → X)
(c : (i : I) → cone (f i) h (A' i)) →
cone (ind-Σ f) h (Σ I A')
cone-descent-Σ f h c =
pair
( tot (λ i → (pr1 (c i))))
( pair
( ind-Σ (λ i → (pr1 (pr2 (c i)))))
( ind-Σ (λ i → (pr2 (pr2 (c i))))))
triangle-descent-Σ : {l1 l2 l3 l4 l5 : Level}
{I : UU l1} {A : I → UU l2} {A' : I → UU l3} {X : UU l4} {X' : UU l5}
(f : (i : I) → A i → X) (h : X' → X)
(c : (i : I) → cone (f i) h (A' i)) →
(i : I) (a : A i) →
( fib-square (f i) h (c i) a) ~
((fib-square (ind-Σ f) h (cone-descent-Σ f h c) (pair i a)) ∘ (fib-tot-fib-ftr (λ i → (pr1 (c i))) (pair i a)))
triangle-descent-Σ f h c i .(pr1 (c i) a') (pair a' refl) = refl
abstract
descent-Σ : {l1 l2 l3 l4 l5 : Level}
{I : UU l1} {A : I → UU l2} {A' : I → UU l3} {X : UU l4} {X' : UU l5}
(f : (i : I) → A i → X) (h : X' → X)
(c : (i : I) → cone (f i) h (A' i)) →
((i : I) → is-pullback (f i) h (c i)) →
is-pullback (ind-Σ f) h (cone-descent-Σ f h c)
descent-Σ f h c is-pb-c =
is-pullback-is-fiberwise-equiv-fib-square
( ind-Σ f)
( h)
( cone-descent-Σ f h c)
( ind-Σ
( λ i a → is-equiv-left-factor
( fib-square (f i) h (c i) a)
( fib-square (ind-Σ f) h (cone-descent-Σ f h c) (pair i a))
( fib-tot-fib-ftr (λ i → pr1 (c i)) (pair i a))
( triangle-descent-Σ f h c i a)
( is-fiberwise-equiv-fib-square-is-pullback
(f i) h (c i) (is-pb-c i) a)
( is-equiv-fib-tot-fib-ftr (λ i → pr1 (c i)) (pair i a))))
abstract
descent-Σ' : {l1 l2 l3 l4 l5 : Level}
{I : UU l1} {A : I → UU l2} {A' : I → UU l3} {X : UU l4} {X' : UU l5}
(f : (i : I) → A i → X) (h : X' → X)
(c : (i : I) → cone (f i) h (A' i)) →
is-pullback (ind-Σ f) h (cone-descent-Σ f h c) →
((i : I) → is-pullback (f i) h (c i))
descent-Σ' f h c is-pb-dsq i =
is-pullback-is-fiberwise-equiv-fib-square (f i) h (c i)
( λ a → is-equiv-comp
( fib-square (f i) h (c i) a)
( fib-square (ind-Σ f) h (cone-descent-Σ f h c) (pair i a))
( fib-tot-fib-ftr (λ i → pr1 (c i)) (pair i a))
( triangle-descent-Σ f h c i a)
( is-equiv-fib-tot-fib-ftr (λ i → pr1 (c i)) (pair i a))
( is-fiberwise-equiv-fib-square-is-pullback (ind-Σ f) h
( cone-descent-Σ f h c) is-pb-dsq (pair i a)))
-- Extra material
-- Homotopical squares
{- We consider the situation where we have two 'parallel squares', i.e. a
diagram of the form
--------->
C ---------> B
| | | |
| | | |
V V V V
A ---------> X.
--------->
Suppose that between each parallel pair of maps there is a homotopy, and
that there is a homotopy between the homotopies that fill the two squares,
as expessed by the type coherence-htpy-square below. Our goal is to show
that if one of the squares is a pullback square, then so is the other.
We do so without using function extensionality. -}
coherence-htpy-square :
{l1 l2 l3 l4 : Level} {A : UU l1} {B : UU l2} {X : UU l3} {C : UU l4}
{f f' : A → X} (Hf : f ~ f') {g g' : B → X} (Hg : g ~ g') →
(c : cone f g C) (c' : cone f' g' C)
(Hp : pr1 c ~ pr1 c') (Hq : pr1 (pr2 c) ~ pr1 (pr2 c')) → UU _
coherence-htpy-square {f = f} {f'} Hf {g} {g'} Hg c c' Hp Hq =
let p = pr1 c
q = pr1 (pr2 c)
H = pr2 (pr2 c)
p' = pr1 c'
q' = pr1 (pr2 c')
H' = pr2 (pr2 c')
in
( H ∙h ((g ·l Hq) ∙h (Hg ·r q'))) ~ (((f ·l Hp) ∙h (Hf ·r p')) ∙h H')
fam-htpy-square :
{l1 l2 l3 l4 : Level} {A : UU l1} {B : UU l2} {X : UU l3} {C : UU l4}
{f f' : A → X} (Hf : f ~ f') {g g' : B → X} (Hg : g ~ g') →
(c : cone f g C) → (c' : cone f' g' C) →
(pr1 c ~ pr1 c') → UU _
fam-htpy-square {f = f} {f'} Hf {g} {g'} Hg c c' Hp =
Σ ((pr1 (pr2 c)) ~ (pr1 (pr2 c'))) (coherence-htpy-square Hf Hg c c' Hp)
htpy-square :
{l1 l2 l3 l4 : Level} {A : UU l1} {B : UU l2} {X : UU l3} {C : UU l4}
{f f' : A → X} (Hf : f ~ f') {g g' : B → X} (Hg : g ~ g') →
cone f g C → cone f' g' C → UU (l1 ⊔ (l2 ⊔ (l3 ⊔ l4)))
htpy-square
{f = f} {f'} Hf {g} {g'} Hg c c' =
Σ ((pr1 c) ~ (pr1 c')) (fam-htpy-square Hf Hg c c')
map-is-pullback-htpy :
{l1 l2 l3 : Level} {A : UU l1} {B : UU l2} {X : UU l3}
{f : A → X} {f' : A → X} (Hf : f ~ f')
{g : B → X} {g' : B → X} (Hg : g ~ g') →
canonical-pullback f' g' → canonical-pullback f g
map-is-pullback-htpy {f = f} {f'} Hf {g} {g'} Hg =
tot (λ a → tot (λ b →
( concat' (f a) (inv (Hg b))) ∘ (concat (Hf a) (g' b))))
abstract
is-equiv-map-is-pullback-htpy :
{l1 l2 l3 : Level} {A : UU l1} {B : UU l2} {X : UU l3}
{f : A → X} {f' : A → X} (Hf : f ~ f')
{g : B → X} {g' : B → X} (Hg : g ~ g') →
is-equiv (map-is-pullback-htpy Hf Hg)
is-equiv-map-is-pullback-htpy {f = f} {f'} Hf {g} {g'} Hg =
is-equiv-tot-is-fiberwise-equiv (λ a →
is-equiv-tot-is-fiberwise-equiv (λ b →
is-equiv-comp
( (concat' (f a) (inv (Hg b))) ∘ (concat (Hf a) (g' b)))
( concat' (f a) (inv (Hg b)))
( concat (Hf a) (g' b))
( refl-htpy)
( is-equiv-concat (Hf a) (g' b))
( is-equiv-concat' (f a) (inv (Hg b)))))
tot-pullback-rel : {l1 l2 l3 : Level} {A : UU l1} {B : UU l2} {X : UU l3}
(f : A → X) (g : B → X) (x : A) → UU _
tot-pullback-rel {B = B} f g x = Σ B (λ y → Id (f x) (g y))
triangle-is-pullback-htpy :
{l1 l2 l3 l4 : Level} {A : UU l1} {B : UU l2} {X : UU l3} {C : UU l4}
{f : A → X} {f' : A → X} (Hf : f ~ f')
{g : B → X} {g' : B → X} (Hg : g ~ g')
{c : cone f g C} {c' : cone f' g' C} (Hc : htpy-square Hf Hg c c') →
(gap f g c) ~ ((map-is-pullback-htpy Hf Hg) ∘ (gap f' g' c'))
triangle-is-pullback-htpy {A = A} {B} {X} {C} {f = f} {f'} Hf {g} {g'} Hg
{pair p (pair q H)} {pair p' (pair q' H')} (pair Hp (pair Hq HH)) z =
eq-Eq-canonical-pullback f g
( Hp z)
( Hq z)
( ( inv
( assoc (ap f (Hp z)) ((Hf (p' z)) ∙ (H' z)) (inv (Hg (q' z))))) ∙
( inv
( con-inv
( (H z) ∙ (ap g (Hq z)))
( Hg (q' z))
( ( ap f (Hp z)) ∙ ((Hf (p' z)) ∙ (H' z)))
( ( assoc (H z) (ap g (Hq z)) (Hg (q' z))) ∙
( ( HH z) ∙
( assoc (ap f (Hp z)) (Hf (p' z)) (H' z)))))))
abstract
is-pullback-htpy :
{l1 l2 l3 l4 : Level} {A : UU l1} {B : UU l2} {X : UU l3} {C : UU l4}
{f : A → X} (f' : A → X) (Hf : f ~ f')
{g : B → X} (g' : B → X) (Hg : g ~ g')
{c : cone f g C} (c' : cone f' g' C) (Hc : htpy-square Hf Hg c c') →
is-pullback f' g' c' → is-pullback f g c
is-pullback-htpy
{f = f} f' Hf {g} g' Hg
{c = pair p (pair q H)} (pair p' (pair q' H'))
(pair Hp (pair Hq HH)) is-pb-c' =
is-equiv-comp
( gap f g (pair p (pair q H)))
( map-is-pullback-htpy Hf Hg)
( gap f' g' (pair p' (pair q' H')))
( triangle-is-pullback-htpy Hf Hg
{pair p (pair q H)} {pair p' (pair q' H')} (pair Hp (pair Hq HH)))
( is-pb-c')
( is-equiv-map-is-pullback-htpy Hf Hg)
abstract
is-pullback-htpy' :
{l1 l2 l3 l4 : Level} {A : UU l1} {B : UU l2} {X : UU l3} {C : UU l4}
(f : A → X) {f' : A → X} (Hf : f ~ f')
(g : B → X) {g' : B → X} (Hg : g ~ g') →
(c : cone f g C) {c' : cone f' g' C} (Hc : htpy-square Hf Hg c c') →
is-pullback f g c → is-pullback f' g' c'
is-pullback-htpy'
f {f'} Hf g {g'} Hg
(pair p (pair q H)) {pair p' (pair q' H')}
(pair Hp (pair Hq HH)) is-pb-c =
is-equiv-right-factor
( gap f g (pair p (pair q H)))
( map-is-pullback-htpy Hf Hg)
( gap f' g' (pair p' (pair q' H')))
( triangle-is-pullback-htpy Hf Hg
{pair p (pair q H)} {pair p' (pair q' H')} (pair Hp (pair Hq HH)))
( is-equiv-map-is-pullback-htpy Hf Hg)
( is-pb-c)
{- In the following part we will relate the type htpy-square to the Identity
type of cones. Here we will rely on function extensionality. -}
reflexive-htpy-square :
{l1 l2 l3 l4 : Level} {A : UU l1} {B : UU l2} {X : UU l3} {C : UU l4}
(f : A → X) (g : B → X) (c : cone f g C) →
htpy-square (refl-htpy {f = f}) (refl-htpy {f = g}) c c
reflexive-htpy-square f g c =
pair refl-htpy (pair refl-htpy htpy-right-unit)
htpy-square-eq-refl-htpy :
{l1 l2 l3 l4 : Level} {A : UU l1} {B : UU l2} {X : UU l3} {C : UU l4}
(f : A → X) (g : B → X) (c c' : cone f g C) →
Id c c' → htpy-square (refl-htpy {f = f}) (refl-htpy {f = g}) c c'
htpy-square-eq-refl-htpy f g c .c refl =
pair refl-htpy (pair refl-htpy htpy-right-unit)
htpy-square-refl-htpy-htpy-cone :
{l1 l2 l3 l4 : Level} {A : UU l1} {B : UU l2} {X : UU l3} {C : UU l4}
(f : A → X) (g : B → X) →
(c c' : cone f g C) →
htpy-cone f g c c' → htpy-square (refl-htpy {f = f}) (refl-htpy {f = g}) c c'
htpy-square-refl-htpy-htpy-cone f g
(pair p (pair q H)) (pair p' (pair q' H')) =
tot
( λ K → tot
( λ L M → ( htpy-ap-concat H _ _ htpy-right-unit) ∙h
( M ∙h htpy-ap-concat' _ _ H' (htpy-inv htpy-right-unit))))
abstract
is-equiv-htpy-square-refl-htpy-htpy-cone :
{l1 l2 l3 l4 : Level} {A : UU l1} {B : UU l2} {X : UU l3} {C : UU l4}
(f : A → X) (g : B → X) →
(c c' : cone f g C) →
is-equiv (htpy-square-refl-htpy-htpy-cone f g c c')
is-equiv-htpy-square-refl-htpy-htpy-cone f g
(pair p (pair q H)) (pair p' (pair q' H')) =
is-equiv-tot-is-fiberwise-equiv
( λ K → is-equiv-tot-is-fiberwise-equiv
( λ L → is-equiv-comp
( λ M → ( htpy-ap-concat H _ _ htpy-right-unit) ∙h
( M ∙h
( htpy-ap-concat' _ _ H' (htpy-inv htpy-right-unit))))
( htpy-concat
( htpy-ap-concat H _ _ htpy-right-unit)
( ((f ·l K) ∙h refl-htpy) ∙h H'))
( htpy-concat'
( H ∙h (g ·l L))
( htpy-ap-concat' _ _ H' (htpy-inv htpy-right-unit)))
( refl-htpy)
( is-equiv-htpy-concat'
( H ∙h (g ·l L))
( λ x → ap (λ z → z ∙ H' x) (inv right-unit)))
( is-equiv-htpy-concat
( λ x → ap (_∙_ (H x)) right-unit)
( ((f ·l K) ∙h refl-htpy) ∙h H'))))
abstract
is-contr-total-htpy-square-refl-htpy-refl-htpy :
{l1 l2 l3 l4 : Level} {A : UU l1} {B : UU l2} {X : UU l3} {C : UU l4}
(f : A → X) (g : B → X) →
(c : cone f g C) →
is-contr (Σ (cone f g C) (htpy-square (refl-htpy' f) (refl-htpy' g) c))
is-contr-total-htpy-square-refl-htpy-refl-htpy {A = A} {B} {X} {C}
f g (pair p (pair q H)) =
let c = pair p (pair q H) in
is-contr-is-equiv'
( Σ (cone f g C) (htpy-cone f g c))
( tot (htpy-square-refl-htpy-htpy-cone f g c))
( is-equiv-tot-is-fiberwise-equiv
( is-equiv-htpy-square-refl-htpy-htpy-cone f g c))
( is-contr-total-htpy-cone f g c)
abstract
is-contr-total-htpy-square-refl-htpy :
{l1 l2 l3 l4 : Level} {A : UU l1} {B : UU l2} {X : UU l3} {C : UU l4}
(f : A → X) {g g' : B → X} (Hg : g ~ g') →
(c : cone f g C) →
is-contr (Σ (cone f g' C) (htpy-square (refl-htpy' f) Hg c))
is-contr-total-htpy-square-refl-htpy {C = C} f {g} =
ind-htpy g
( λ g'' Hg' → ( c : cone f g C) →
is-contr (Σ (cone f g'' C) (htpy-square (refl-htpy' f) Hg' c)))
( is-contr-total-htpy-square-refl-htpy-refl-htpy f g)
abstract
is-contr-total-htpy-square :
{l1 l2 l3 l4 : Level} {A : UU l1} {B : UU l2} {X : UU l3} {C : UU l4}
{f f' : A → X} (Hf : f ~ f') {g g' : B → X} (Hg : g ~ g') →
(c : cone f g C) →
is-contr (Σ (cone f' g' C) (htpy-square Hf Hg c))
is-contr-total-htpy-square {A = A} {B} {X} {C} {f} {f'} Hf {g} {g'} Hg =
ind-htpy
{ A = A}
{ B = λ t → X}
( f)
( λ f'' Hf' → (g g' : B → X) (Hg : g ~ g') (c : cone f g C) →
is-contr (Σ (cone f'' g' C) (htpy-square Hf' Hg c)))
( λ g g' Hg → is-contr-total-htpy-square-refl-htpy f Hg)
Hf g g' Hg
tr-tr-refl-htpy-cone :
{l1 l2 l3 l4 : Level} {A : UU l1} {B : UU l2} {X : UU l3} {C : UU l4}
(f : A → X) (g : B → X) (c : cone f g C) →
let tr-c = tr (λ x → cone x g C) (eq-htpy (refl-htpy {f = f})) c
tr-tr-c = tr (λ y → cone f y C) (eq-htpy (refl-htpy {f = g})) tr-c
in
Id tr-tr-c c
tr-tr-refl-htpy-cone {C = C} f g c =
let tr-c = tr (λ f''' → cone f''' g C) (eq-htpy refl-htpy) c
tr-tr-c = tr (λ g'' → cone f g'' C) (eq-htpy refl-htpy) tr-c
α : Id tr-tr-c tr-c
α = ap (λ t → tr (λ g'' → cone f g'' C) t tr-c) (eq-htpy-refl-htpy g)
β : Id tr-c c
β = ap (λ t → tr (λ f''' → cone f''' g C) t c) (eq-htpy-refl-htpy f)
in
α ∙ β
htpy-square-eq-refl-htpy-refl-htpy :
{l1 l2 l3 l4 : Level} {A : UU l1} {B : UU l2} {X : UU l3} {C : UU l4}
(f : A → X) (g : B → X) (c c' : cone f g C) →
let tr-c = tr (λ x → cone x g C) (eq-htpy (refl-htpy {f = f})) c
tr-tr-c = tr (λ y → cone f y C) (eq-htpy (refl-htpy {f = g})) tr-c
in
Id tr-tr-c c' → htpy-square (refl-htpy' f) (refl-htpy' g) c c'
htpy-square-eq-refl-htpy-refl-htpy f g c c' =
ind-is-equiv
( λ p → htpy-square (refl-htpy' f) (refl-htpy' g) c c')
( λ (p : Id c c') → (tr-tr-refl-htpy-cone f g c) ∙ p)
( is-equiv-concat (tr-tr-refl-htpy-cone f g c) c')
( htpy-square-eq-refl-htpy f g c c')
comp-htpy-square-eq-refl-htpy-refl-htpy :
{l1 l2 l3 l4 : Level} {A : UU l1} {B : UU l2} {X : UU l3} {C : UU l4}
(f : A → X) (g : B → X) (c c' : cone f g C) →
( (htpy-square-eq-refl-htpy-refl-htpy f g c c') ∘
(concat (tr-tr-refl-htpy-cone f g c) c')) ~
( htpy-square-eq-refl-htpy f g c c')
comp-htpy-square-eq-refl-htpy-refl-htpy f g c c' =
htpy-comp-is-equiv
( λ p → htpy-square (refl-htpy' f) (refl-htpy' g) c c')
( λ (p : Id c c') → (tr-tr-refl-htpy-cone f g c) ∙ p)
( is-equiv-concat (tr-tr-refl-htpy-cone f g c) c')
( htpy-square-eq-refl-htpy f g c c')
abstract
htpy-square-eq' :
{l1 l2 l3 l4 : Level} {A : UU l1} {B : UU l2} {X : UU l3} {C : UU l4}
(f : A → X) {g g' : B → X} (Hg : g ~ g') →
(c : cone f g C) (c' : cone f g' C) →
let tr-c = tr (λ x → cone x g C) (eq-htpy (refl-htpy {f = f})) c
tr-tr-c = tr (λ y → cone f y C) (eq-htpy Hg) tr-c
in
Id tr-tr-c c' → htpy-square (refl-htpy' f) Hg c c'
htpy-square-eq' {C = C} f {g} =
ind-htpy g
( λ g'' Hg' →
( c : cone f g C) (c' : cone f g'' C) →
Id (tr (λ g'' → cone f g'' C) (eq-htpy Hg')
( tr (λ f''' → cone f''' g C) (eq-htpy (refl-htpy' f)) c)) c' →
htpy-square refl-htpy Hg' c c')
( htpy-square-eq-refl-htpy-refl-htpy f g)
comp-htpy-square-eq' :
{l1 l2 l3 l4 : Level} {A : UU l1} {B : UU l2} {X : UU l3} {C : UU l4}
(f : A → X) (g : B → X) (c c' : cone f g C) →
( ( htpy-square-eq' f refl-htpy c c') ∘
( concat (tr-tr-refl-htpy-cone f g c) c')) ~
( htpy-square-eq-refl-htpy f g c c')
comp-htpy-square-eq' {A = A} {B} {X} {C} f g c c' =
htpy-right-whisk
( htpy-eq (htpy-eq (htpy-eq (comp-htpy g
( λ g'' Hg' →
( c : cone f g C) (c' : cone f g'' C) →
Id (tr (λ g'' → cone f g'' C) (eq-htpy Hg')
( tr (λ f''' → cone f''' g C) (eq-htpy (refl-htpy' f)) c)) c' →
htpy-square refl-htpy Hg' c c')
( htpy-square-eq-refl-htpy-refl-htpy f g)) c) c'))
( concat (tr-tr-refl-htpy-cone f g c) c') ∙h
( comp-htpy-square-eq-refl-htpy-refl-htpy f g c c')
abstract
htpy-square-eq :
{l1 l2 l3 l4 : Level} {A : UU l1} {B : UU l2} {X : UU l3} {C : UU l4}
{f f' : A → X} (Hf : f ~ f') {g g' : B → X} (Hg : g ~ g') →
(c : cone f g C) (c' : cone f' g' C) →
let tr-c = tr (λ x → cone x g C) (eq-htpy Hf) c
tr-tr-c = tr (λ y → cone f' y C) (eq-htpy Hg) tr-c
in
Id tr-tr-c c' → htpy-square Hf Hg c c'
htpy-square-eq {A = A} {B} {X} {C} {f} {f'} Hf {g} {g'} Hg c c' p =
ind-htpy f
( λ f'' Hf' →
( g g' : B → X) (Hg : g ~ g') (c : cone f g C) (c' : cone f'' g' C) →
( Id (tr (λ g'' → cone f'' g'' C) (eq-htpy Hg)
( tr (λ f''' → cone f''' g C) (eq-htpy Hf') c)) c') →
htpy-square Hf' Hg c c')
( λ g g' → htpy-square-eq' f {g = g} {g' = g'})
Hf g g' Hg c c' p
comp-htpy-square-eq :
{l1 l2 l3 l4 : Level} {A : UU l1} {B : UU l2} {X : UU l3} {C : UU l4}
(f : A → X) (g : B → X) (c c' : cone f g C) →
( ( htpy-square-eq refl-htpy refl-htpy c c') ∘
( concat (tr-tr-refl-htpy-cone f g c) c')) ~
( htpy-square-eq-refl-htpy f g c c')
comp-htpy-square-eq {A = A} {B} {X} {C} f g c c' =
htpy-right-whisk
( htpy-eq (htpy-eq (htpy-eq (htpy-eq (htpy-eq (htpy-eq (comp-htpy f
( λ f'' Hf' →
( g g' : B → X) (Hg : g ~ g') (c : cone f g C) (c' : cone f'' g' C) →
( Id ( tr (λ g'' → cone f'' g'' C) (eq-htpy Hg)
( tr (λ f''' → cone f''' g C) (eq-htpy Hf') c)) c') →
htpy-square Hf' Hg c c')
( λ g g' → htpy-square-eq' f {g = g} {g' = g'})) g) g)
refl-htpy) c) c'))
( concat (tr-tr-refl-htpy-cone f g c) c') ∙h
( comp-htpy-square-eq' f g c c')
abstract
is-fiberwise-equiv-htpy-square-eq :
{l1 l2 l3 l4 : Level} {A : UU l1} {B : UU l2} {X : UU l3} {C : UU l4}
{f f' : A → X} (Hf : f ~ f') {g g' : B → X} (Hg : g ~ g') →
(c : cone f g C) (c' : cone f' g' C) →
is-equiv (htpy-square-eq Hf Hg c c')
is-fiberwise-equiv-htpy-square-eq
{A = A} {B} {X} {C} {f} {f'} Hf {g} {g'} Hg c c' =
ind-htpy f
( λ f' Hf →
( g g' : B → X) (Hg : g ~ g') (c : cone f g C) (c' : cone f' g' C) →
is-equiv (htpy-square-eq Hf Hg c c'))
( λ g g' Hg c c' →
ind-htpy g
( λ g' Hg →
( c : cone f g C) (c' : cone f g' C) →
is-equiv (htpy-square-eq refl-htpy Hg c c'))
( λ c c' →
is-equiv-left-factor
( htpy-square-eq-refl-htpy f g c c')
( htpy-square-eq refl-htpy refl-htpy c c')
( concat (tr-tr-refl-htpy-cone f g c) c')
( htpy-inv (comp-htpy-square-eq f g c c'))
( fundamental-theorem-id c
( reflexive-htpy-square f g c)
( is-contr-total-htpy-square (refl-htpy' f) (refl-htpy' g) c)
( htpy-square-eq-refl-htpy f g c) c')
( is-equiv-concat (tr-tr-refl-htpy-cone f g c) c'))
Hg c c')
Hf g g' Hg c c'
eq-htpy-square :
{l1 l2 l3 l4 : Level} {A : UU l1} {B : UU l2} {X : UU l3} {C : UU l4}
{f f' : A → X} (Hf : f ~ f') {g g' : B → X} (Hg : g ~ g') →
(c : cone f g C) (c' : cone f' g' C) →
let tr-c = tr (λ x → cone x g C) (eq-htpy Hf) c
tr-tr-c = tr (λ y → cone f' y C) (eq-htpy Hg) tr-c
in
htpy-square Hf Hg c c' → Id tr-tr-c c'
eq-htpy-square Hf Hg c c' =
inv-is-equiv
{ f = htpy-square-eq Hf Hg c c'}
( is-fiberwise-equiv-htpy-square-eq Hf Hg c c')
-- Exercises
-- Exercise 10.1
cone-Id :
{l : Level} {A : UU l} (x y : A) →
cone (const unit A x) (const unit A y) (Id x y)
cone-Id x y =
pair
( const (Id x y) unit star)
( pair
( const (Id x y) unit star)
( id))
inv-gap-cone-Id :
{l : Level} {A : UU l} (x y : A) →
canonical-pullback (const unit A x) (const unit A y) → Id x y
inv-gap-cone-Id x y (pair star (pair star p)) = p
issec-inv-gap-cone-Id :
{l : Level} {A : UU l} (x y : A) →
( ( gap (const unit A x) (const unit A y) (cone-Id x y)) ∘
( inv-gap-cone-Id x y)) ~ id
issec-inv-gap-cone-Id x y (pair star (pair star p)) = refl
isretr-inv-gap-cone-Id :
{l : Level} {A : UU l} (x y : A) →
( ( inv-gap-cone-Id x y) ∘
( gap (const unit A x) (const unit A y) (cone-Id x y))) ~ id
isretr-inv-gap-cone-Id x y p = refl
abstract
is-pullback-cone-Id :
{l : Level} {A : UU l} (x y : A) →
is-pullback (const unit A x) (const unit A y) (cone-Id x y)
is-pullback-cone-Id x y =
is-equiv-has-inverse
( inv-gap-cone-Id x y)
( issec-inv-gap-cone-Id x y)
( isretr-inv-gap-cone-Id x y)
{- One way to solve this exercise is to show that Id (pr1 t) (pr2 t) is a
pullback for every t : A × A. This allows one to use path induction to
show that the inverse of the gap map is a section.
-}
cone-Id' :
{l : Level} {A : UU l} (t : A × A) →
cone (const unit (A × A) t) (diagonal A) (Id (pr1 t) (pr2 t))
cone-Id' {A = A} (pair x y) =
pair
( const (Id x y) unit star)
( pair
( const (Id x y) A x)
( λ p → eq-pair refl (inv p)))
inv-gap-cone-Id' :
{l : Level} {A : UU l} (t : A × A) →
canonical-pullback (const unit (A × A) t) (diagonal A) → Id (pr1 t) (pr2 t)
inv-gap-cone-Id' t (pair star (pair z p)) =
(ap pr1 p) ∙ (inv (ap pr2 p))
issec-inv-gap-cone-Id' :
{l : Level} {A : UU l} (t : A × A) →
( ( gap (const unit (A × A) t) (diagonal A) (cone-Id' t)) ∘
( inv-gap-cone-Id' t)) ~ id
issec-inv-gap-cone-Id' .(pair z z) (pair star (pair z refl)) = refl
isretr-inv-gap-cone-Id' :
{l : Level} {A : UU l} (t : A × A) →
( ( inv-gap-cone-Id' t) ∘
( gap (const unit (A × A) t) (diagonal A) (cone-Id' t))) ~ id
isretr-inv-gap-cone-Id' (pair x .x) refl = refl
abstract
is-pullback-cone-Id' :
{l : Level} {A : UU l} (t : A × A) →
is-pullback (const unit (A × A) t) (diagonal A) (cone-Id' t)
is-pullback-cone-Id' t =
is-equiv-has-inverse
( inv-gap-cone-Id' t)
( issec-inv-gap-cone-Id' t)
( isretr-inv-gap-cone-Id' t)
-- Exercise 10.2
diagonal-map :
{l1 l2 : Level} {A : UU l1} {B : UU l2} (f : A → B) →
A → canonical-pullback f f
diagonal-map f x = pair x (pair x refl)
fib-ap-fib-diagonal-map :
{l1 l2 : Level} {A : UU l1} {B : UU l2} (f : A → B)
(t : canonical-pullback f f) →
(fib (diagonal-map f) t) → (fib (ap f) (pr2 (pr2 t)))
fib-ap-fib-diagonal-map f .(pair z (pair z refl)) (pair z refl) =
pair refl refl
fib-diagonal-map-fib-ap :
{l1 l2 : Level} {A : UU l1} {B : UU l2} (f : A → B)
(t : canonical-pullback f f) →
(fib (ap f) (pr2 (pr2 t))) → (fib (diagonal-map f) t)
fib-diagonal-map-fib-ap f (pair x (pair .x .refl)) (pair refl refl) =
pair x refl
issec-fib-diagonal-map-fib-ap :
{l1 l2 : Level} {A : UU l1} {B : UU l2} (f : A → B)
(t : canonical-pullback f f) →
((fib-ap-fib-diagonal-map f t) ∘ (fib-diagonal-map-fib-ap f t)) ~ id
issec-fib-diagonal-map-fib-ap f (pair x (pair .x .refl)) (pair refl refl) =
refl
isretr-fib-diagonal-map-fib-ap :
{l1 l2 : Level} {A : UU l1} {B : UU l2} (f : A → B)
(t : canonical-pullback f f) →
((fib-diagonal-map-fib-ap f t) ∘ (fib-ap-fib-diagonal-map f t)) ~ id
isretr-fib-diagonal-map-fib-ap f .(pair x (pair x refl)) (pair x refl) =
refl
abstract
is-equiv-fib-ap-fib-diagonal-map :
{l1 l2 : Level} {A : UU l1} {B : UU l2} (f : A → B)
(t : canonical-pullback f f) →
is-equiv (fib-ap-fib-diagonal-map f t)
is-equiv-fib-ap-fib-diagonal-map f t =
is-equiv-has-inverse
( fib-diagonal-map-fib-ap f t)
( issec-fib-diagonal-map-fib-ap f t)
( isretr-fib-diagonal-map-fib-ap f t)
abstract
is-trunc-diagonal-map-is-trunc-map :
{l1 l2 : Level} (k : 𝕋) {A : UU l1} {B : UU l2} (f : A → B) →
is-trunc-map (succ-𝕋 k) f → is-trunc-map k (diagonal-map f)
is-trunc-diagonal-map-is-trunc-map k f is-trunc-f (pair x (pair y p)) =
is-trunc-is-equiv k (fib (ap f) p)
( fib-ap-fib-diagonal-map f (pair x (pair y p)))
( is-equiv-fib-ap-fib-diagonal-map f (pair x (pair y p)))
( is-trunc-ap-is-trunc-map k f is-trunc-f x y p)
abstract
is-trunc-map-is-trunc-diagonal-map :
{l1 l2 : Level} (k : 𝕋) {A : UU l1} {B : UU l2} (f : A → B) →
is-trunc-map k (diagonal-map f) → is-trunc-map (succ-𝕋 k) f
is-trunc-map-is-trunc-diagonal-map
k f is-trunc-δ b (pair x p) (pair x' p') =
is-trunc-is-equiv k
( fib (ap f) (p ∙ (inv p')))
( fib-ap-eq-fib f (pair x p) (pair x' p'))
( is-equiv-fib-ap-eq-fib f (pair x p) (pair x' p'))
( is-trunc-is-equiv' k
( fib (diagonal-map f) (pair x (pair x' (p ∙ (inv p')))))
( fib-ap-fib-diagonal-map f (pair x (pair x' (p ∙ (inv p')))))
( is-equiv-fib-ap-fib-diagonal-map f (pair x (pair x' (p ∙ (inv p')))))
( is-trunc-δ (pair x (pair x' (p ∙ (inv p'))))))
abstract
is-equiv-diagonal-map-is-emb :
{l1 l2 : Level} {A : UU l1} {B : UU l2} (f : A → B) →
is-emb f → is-equiv (diagonal-map f)
is-equiv-diagonal-map-is-emb f is-emb-f =
is-equiv-is-contr-map
( is-trunc-diagonal-map-is-trunc-map neg-two-𝕋 f
( is-prop-map-is-emb f is-emb-f))
abstract
is-emb-is-equiv-diagonal-map :
{l1 l2 : Level} {A : UU l1} {B : UU l2} (f : A → B) →
is-equiv (diagonal-map f) → is-emb f
is-emb-is-equiv-diagonal-map f is-equiv-δ =
is-emb-is-prop-map f
( is-trunc-map-is-trunc-diagonal-map neg-two-𝕋 f
( is-contr-map-is-equiv is-equiv-δ))
-- Exercise 10.3
cone-swap :
{l1 l2 l3 l4 : Level} {A : UU l1} {B : UU l2} {X : UU l3} {C : UU l4}
(f : A → X) (g : B → X) → cone f g C → cone g f C
cone-swap f g (pair p (pair q H)) = pair q (pair p (htpy-inv H))
map-canonical-pullback-swap :
{l1 l2 l3 : Level} {A : UU l1} {B : UU l2} {X : UU l3}
(f : A → X) (g : B → X) → canonical-pullback f g → canonical-pullback g f
map-canonical-pullback-swap f g (pair a (pair b p)) =
pair b (pair a (inv p))
inv-inv-map-canonical-pullback-swap :
{l1 l2 l3 : Level} {A : UU l1} {B : UU l2} {X : UU l3}
(f : A → X) (g : B → X) →
(map-canonical-pullback-swap f g ∘ map-canonical-pullback-swap g f) ~ id
inv-inv-map-canonical-pullback-swap f g (pair b (pair a q)) =
eq-pair refl (eq-pair refl (inv-inv q))
abstract
is-equiv-map-canonical-pullback-swap :
{l1 l2 l3 : Level} {A : UU l1} {B : UU l2} {X : UU l3}
(f : A → X) (g : B → X) → is-equiv (map-canonical-pullback-swap f g)
is-equiv-map-canonical-pullback-swap f g =
is-equiv-has-inverse
( map-canonical-pullback-swap g f)
( inv-inv-map-canonical-pullback-swap f g)
( inv-inv-map-canonical-pullback-swap g f)
triangle-map-canonical-pullback-swap :
{l1 l2 l3 l4 : Level} {A : UU l1} {B : UU l2} {X : UU l3} {C : UU l4}
(f : A → X) (g : B → X) (c : cone f g C) →
( gap g f (cone-swap f g c)) ~
( ( map-canonical-pullback-swap f g) ∘ ( gap f g c))
triangle-map-canonical-pullback-swap f g (pair p (pair q H)) x = refl
abstract
is-pullback-cone-swap :
{l1 l2 l3 l4 : Level} {A : UU l1} {B : UU l2} {X : UU l3} {C : UU l4}
(f : A → X) (g : B → X) (c : cone f g C) →
is-pullback f g c → is-pullback g f (cone-swap f g c)
is-pullback-cone-swap f g c is-pb-c =
is-equiv-comp
( gap g f (cone-swap f g c))
( map-canonical-pullback-swap f g)
( gap f g c)
( triangle-map-canonical-pullback-swap f g c)
( is-pb-c)
( is-equiv-map-canonical-pullback-swap f g)
abstract
is-pullback-cone-swap' :
{l1 l2 l3 l4 : Level} {A : UU l1} {B : UU l2} {X : UU l3} {C : UU l4}
(f : A → X) (g : B → X) (c : cone f g C) →
is-pullback g f (cone-swap f g c) → is-pullback f g c
is-pullback-cone-swap' f g c is-pb-c' =
is-equiv-right-factor
( gap g f (cone-swap f g c))
( map-canonical-pullback-swap f g)
( gap f g c)
( triangle-map-canonical-pullback-swap f g c)
( is-equiv-map-canonical-pullback-swap f g)
( is-pb-c')
{- We conclude the swapped versions of some properties derived above, for
future convenience -}
abstract
is-trunc-is-pullback' :
{l1 l2 l3 l4 : Level} (k : 𝕋)
{A : UU l1} {B : UU l2} {C : UU l3} {X : UU l4}
(f : A → X) (g : B → X) (c : cone f g C) →
is-pullback f g c → is-trunc-map k f → is-trunc-map k (pr1 (pr2 c))
is-trunc-is-pullback' k f g (pair p (pair q H)) pb is-trunc-f =
is-trunc-is-pullback k g f
( cone-swap f g (pair p (pair q H)))
( is-pullback-cone-swap f g (pair p (pair q H)) pb)
is-trunc-f
abstract
is-emb-is-pullback' :
{l1 l2 l3 l4 : Level} {A : UU l1} {B : UU l2} {C : UU l3} {X : UU l4}
(f : A → X) (g : B → X) (c : cone f g C) →
is-pullback f g c → is-emb f → is-emb (pr1 (pr2 c))
is-emb-is-pullback' f g c pb is-emb-f =
is-emb-is-prop-map
( pr1 (pr2 c))
( is-trunc-is-pullback' neg-one-𝕋 f g c pb
( is-prop-map-is-emb f is-emb-f))
abstract
is-equiv-is-pullback' :
{l1 l2 l3 l4 : Level} {A : UU l1} {B : UU l2} {C : UU l3} {X : UU l4}
(f : A → X) (g : B → X) (c : cone f g C) →
is-equiv f → is-pullback f g c → is-equiv (pr1 (pr2 c))
is-equiv-is-pullback' f g c is-equiv-f pb =
is-equiv-is-contr-map
( is-trunc-is-pullback' neg-two-𝕋 f g c pb
( is-contr-map-is-equiv is-equiv-f))
abstract
is-pullback-is-equiv' :
{l1 l2 l3 l4 : Level} {A : UU l1} {B : UU l2} {C : UU l3} {X : UU l4}
(f : A → X) (g : B → X) (c : cone f g C) →
is-equiv f → is-equiv (pr1 (pr2 c)) → is-pullback f g c
is-pullback-is-equiv' f g (pair p (pair q H)) is-equiv-f is-equiv-q =
is-pullback-cone-swap' f g (pair p (pair q H))
( is-pullback-is-equiv g f
( cone-swap f g (pair p (pair q H)))
is-equiv-f
is-equiv-q)
-- Exercise 10.4
cone-empty :
{l1 l2 l3 : Level} {B : UU l1} {X : UU l2} {C : UU l3} →
(g : B → X) (p : C → empty) (q : C → B) →
cone (ind-empty {P = λ t → X}) g C
cone-empty g p q =
pair p
( pair q
( λ c → ind-empty {P = λ t → Id (ind-empty (p c)) (g (q c))} (p c)))
abstract
descent-empty :
{l1 l2 l3 : Level} {B : UU l1} {X : UU l2} {C : UU l3} →
let f = ind-empty {P = λ t → X} in
(g : B → X) (c : cone f g C) → is-pullback f g c
descent-empty g c =
is-pullback-is-fiberwise-equiv-fib-square _ g c ind-empty
abstract
descent-empty' :
{l1 l2 l3 : Level} {B : UU l1} {X : UU l2} {C : UU l3} →
(g : B → X) (p : C → empty) (q : C → B) →
is-pullback (ind-empty {P = λ t → X}) g (cone-empty g p q)
descent-empty' g p q = descent-empty g (cone-empty g p q)
-- Exercise 10.5
{- We show that a square is a pullback square if and only if every exponent of
it is a pullback square. -}
cone-exponent :
{l1 l2 l3 l4 l5 : Level}
{A : UU l1} {B : UU l2} {C : UU l3} {X : UU l4} (T : UU l5)
(f : A → X) (g : B → X) (c : cone f g C) →
cone (λ (h : T → A) → f ∘ h) (λ (h : T → B) → g ∘ h) (T → C)
cone-exponent T f g (pair p (pair q H)) =
pair
( λ h → p ∘ h)
( pair
( λ h → q ∘ h)
( λ h → eq-htpy (H ·r h)))
map-canonical-pullback-exponent :
{l1 l2 l3 l4 : Level}
{A : UU l1} {B : UU l2} {X : UU l3} (f : A → X) (g : B → X)
(T : UU l4) →
canonical-pullback (λ (h : T → A) → f ∘ h) (λ (h : T → B) → g ∘ h) →
cone f g T
map-canonical-pullback-exponent f g T =
tot (λ p → tot (λ q → htpy-eq))
abstract
is-equiv-map-canonical-pullback-exponent :
{l1 l2 l3 l4 : Level}
{A : UU l1} {B : UU l2} {X : UU l3} (f : A → X) (g : B → X)
(T : UU l4) → is-equiv (map-canonical-pullback-exponent f g T)
is-equiv-map-canonical-pullback-exponent f g T =
is-equiv-tot-is-fiberwise-equiv
( λ p → is-equiv-tot-is-fiberwise-equiv
( λ q → funext (f ∘ p) (g ∘ q)))
triangle-map-canonical-pullback-exponent :
{l1 l2 l3 l4 l5 : Level} {A : UU l1} {B : UU l2} {X : UU l3} {C : UU l4}
(T : UU l5) (f : A → X) (g : B → X) (c : cone f g C) →
( cone-map f g {C' = T} c) ~
( ( map-canonical-pullback-exponent f g T) ∘
( gap
( λ (h : T → A) → f ∘ h)
( λ (h : T → B) → g ∘ h)
( cone-exponent T f g c)))
triangle-map-canonical-pullback-exponent
{A = A} {B} T f g (pair p (pair q H)) h =
eq-pair refl (eq-pair refl (inv (issec-eq-htpy (H ·r h))))
abstract
is-pullback-exponent-is-pullback :
{l1 l2 l3 l4 l5 : Level} {A : UU l1} {B : UU l2} {X : UU l3} {C : UU l4}
(f : A → X) (g : B → X) (c : cone f g C) → is-pullback f g c →
(T : UU l5) →
is-pullback
( λ (h : T → A) → f ∘ h)
( λ (h : T → B) → g ∘ h)
( cone-exponent T f g c)
is-pullback-exponent-is-pullback f g c is-pb-c T =
is-equiv-right-factor
( cone-map f g c)
( map-canonical-pullback-exponent f g T)
( gap (_∘_ f) (_∘_ g) (cone-exponent T f g c))
( triangle-map-canonical-pullback-exponent T f g c)
( is-equiv-map-canonical-pullback-exponent f g T)
( up-pullback-is-pullback f g c is-pb-c T)
abstract
is-pullback-is-pullback-exponent :
{l1 l2 l3 l4 : Level} {A : UU l1} {B : UU l2} {X : UU l3} {C : UU l4}
(f : A → X) (g : B → X) (c : cone f g C) →
((l5 : Level) (T : UU l5) → is-pullback
( λ (h : T → A) → f ∘ h)
( λ (h : T → B) → g ∘ h)
( cone-exponent T f g c)) →
is-pullback f g c
is-pullback-is-pullback-exponent f g c is-pb-exp =
is-pullback-up-pullback f g c
( λ T → is-equiv-comp
( cone-map f g c)
( map-canonical-pullback-exponent f g T)
( gap (_∘_ f) (_∘_ g) (cone-exponent T f g c))
( triangle-map-canonical-pullback-exponent T f g c)
( is-pb-exp _ T)
( is-equiv-map-canonical-pullback-exponent f g T))
-- Exercise 10.6
{- Note: the solution below involves a substantial amount of path algebra. It
would be nice to find a simpler solution.
-}
cone-fold :
{l1 l2 l3 l4 : Level} {A : UU l1} {B : UU l2} {X : UU l3} {C : UU l4}
(f : A → X) (g : B → X) →
cone f g C → cone (functor-prod f g) (diagonal X) C
cone-fold f g (pair p (pair q H)) =
pair
( λ z → pair (p z) (q z))
( pair
( g ∘ q)
( λ z → eq-pair-triv (pair (H z) refl)))
map-cone-fold :
{l1 l2 l3 : Level} {A : UU l1} {B : UU l2} {X : UU l3}
(f : A → X) → (g : B → X) →
canonical-pullback f g → canonical-pullback (functor-prod f g) (diagonal X)
map-cone-fold f g (pair a (pair b p)) =
pair
( pair a b)
( pair
( g b)
( eq-pair-triv (pair p refl)))
inv-map-cone-fold :
{l1 l2 l3 : Level} {A : UU l1} {B : UU l2} {X : UU l3}
(f : A → X) → (g : B → X) →
canonical-pullback (functor-prod f g) (diagonal X) → canonical-pullback f g
inv-map-cone-fold f g (pair (pair a b) (pair x α)) =
pair a (pair b ((ap pr1 α) ∙ (inv (ap pr2 α))))
ap-diagonal :
{l : Level} {A : UU l} {x y : A} (p : Id x y) →
Id (ap (diagonal A) p) (eq-pair-triv (pair p p))
ap-diagonal refl = refl
eq-pair-triv-concat :
{l1 l2 : Level} {A : UU l1} {B : UU l2} {x x' x'' : A} {y y' y'' : B}
(p : Id x x') (p' : Id x' x'') (q : Id y y') (q' : Id y' y'') →
Id ( eq-pair-triv {s = pair x y} {t = pair x'' y''} (pair (p ∙ p') (q ∙ q')))
( ( eq-pair-triv {s = pair x y} {t = pair x' y'} (pair p q)) ∙
( eq-pair-triv (pair p' q')))
eq-pair-triv-concat refl p' refl q' = refl
issec-inv-map-cone-fold :
{l1 l2 l3 : Level} {A : UU l1} {B : UU l2} {X : UU l3}
(f : A → X) (g : B → X) →
((map-cone-fold f g) ∘ (inv-map-cone-fold f g)) ~ id
issec-inv-map-cone-fold {A = A} {B} {X} f g (pair (pair a b) (pair x α)) =
eq-Eq-canonical-pullback
( functor-prod f g)
( diagonal X)
refl
( ap pr2 α)
( ( ( ( inv (issec-pair-eq-triv' (pair (f a) (g b)) (pair x x) α)) ∙
( ap
( λ t → (eq-pair-triv ( pair t (ap pr2 α))))
( ( ( inv right-unit) ∙
( inv (ap (concat (ap pr1 α) x) (left-inv (ap pr2 α))))) ∙
( inv (assoc (ap pr1 α) (inv (ap pr2 α)) (ap pr2 α)))))) ∙
( eq-pair-triv-concat
( (ap pr1 α) ∙ (inv (ap pr2 α)))
( ap pr2 α)
( refl)
( ap pr2 α))) ∙
( ap
( concat
( eq-pair-triv
( pair ((ap pr1 α) ∙ (inv (ap pr2 α))) refl))
( pair x x))
( inv (ap-diagonal (ap pr2 α)))))
ap-pr1-eq-pair-triv :
{l1 l2 : Level} {A : UU l1} {B : UU l2}
{x x' : A} (p : Id x x') {y y' : B} (q : Id y y') →
Id (ap pr1 (eq-pair-triv' (pair x y) (pair x' y') (pair p q))) p
ap-pr1-eq-pair-triv refl refl = refl
ap-pr2-eq-pair-triv :
{l1 l2 : Level} {A : UU l1} {B : UU l2}
{x x' : A} (p : Id x x') {y y' : B} (q : Id y y') →
Id (ap pr2 (eq-pair-triv' (pair x y) (pair x' y') (pair p q))) q
ap-pr2-eq-pair-triv refl refl = refl
isretr-inv-map-cone-fold :
{l1 l2 l3 : Level} {A : UU l1} {B : UU l2} {X : UU l3}
(f : A → X) (g : B → X) →
((inv-map-cone-fold f g) ∘ (map-cone-fold f g)) ~ id
isretr-inv-map-cone-fold { A = A} { B = B} { X = X} f g (pair a (pair b p)) =
eq-Eq-canonical-pullback {A = A} {B = B} {X = X} f g
refl
refl
( inv
( ( ap
( concat' (f a) refl)
( ( ( ap
( λ t → t ∙
( inv (ap pr2 (eq-pair-triv'
( pair (f a) (g b))
( pair (g b) (g b))
( pair p refl)))))
( ap-pr1-eq-pair-triv p refl)) ∙
( ap (λ t → p ∙ (inv t)) (ap-pr2-eq-pair-triv p refl))) ∙
( right-unit))) ∙
( right-unit)))
abstract
is-equiv-map-cone-fold :
{l1 l2 l3 : Level} {A : UU l1} {B : UU l2} {X : UU l3}
(f : A → X) (g : B → X) → is-equiv (map-cone-fold f g)
is-equiv-map-cone-fold f g =
is-equiv-has-inverse
( inv-map-cone-fold f g)
( issec-inv-map-cone-fold f g)
( isretr-inv-map-cone-fold f g)
triangle-map-cone-fold :
{l1 l2 l3 l4 : Level} {A : UU l1} {B : UU l2} {X : UU l3} {C : UU l4}
(f : A → X) (g : B → X) (c : cone f g C) →
( gap (functor-prod f g) (diagonal X) (cone-fold f g c)) ~
( (map-cone-fold f g) ∘ (gap f g c))
triangle-map-cone-fold f g (pair p (pair q H)) z = refl
abstract
is-pullback-cone-fold-is-pullback :
{l1 l2 l3 l4 : Level} {A : UU l1} {B : UU l2} {X : UU l3} {C : UU l4}
(f : A → X) (g : B → X) (c : cone f g C) →
is-pullback f g c →
is-pullback (functor-prod f g) (diagonal X) (cone-fold f g c)
is-pullback-cone-fold-is-pullback f g c is-pb-c =
is-equiv-comp
( gap (functor-prod f g) (diagonal _) (cone-fold f g c))
( map-cone-fold f g)
( gap f g c)
( triangle-map-cone-fold f g c)
( is-pb-c)
( is-equiv-map-cone-fold f g)
abstract
is-pullback-is-pullback-cone-fold :
{l1 l2 l3 l4 : Level} {A : UU l1} {B : UU l2} {X : UU l3} {C : UU l4}
(f : A → X) (g : B → X) (c : cone f g C) →
is-pullback (functor-prod f g) (diagonal X) (cone-fold f g c) →
is-pullback f g c
is-pullback-is-pullback-cone-fold f g c is-pb-fold =
is-equiv-right-factor
( gap (functor-prod f g) (diagonal _) (cone-fold f g c))
( map-cone-fold f g)
( gap f g c)
( triangle-map-cone-fold f g c)
( is-equiv-map-cone-fold f g)
( is-pb-fold)
-- Exercise 10.7
cone-pair :
{l1 l2 l3 l4 l1' l2' l3' l4' : Level}
{A : UU l1} {B : UU l2} {X : UU l3} {C : UU l4}
{A' : UU l1'} {B' : UU l2'} {X' : UU l3'} {C' : UU l4'}
(f : A → X) (g : B → X) (f' : A' → X') (g' : B' → X') →
cone f g C → cone f' g' C' →
cone (functor-prod f f') (functor-prod g g') (C × C')
cone-pair f g f' g' (pair p (pair q H)) (pair p' (pair q' H')) =
pair
( functor-prod p p')
( pair
( functor-prod q q')
( ( htpy-inv (functor-prod-comp p p' f f')) ∙h
( ( functor-prod-htpy H H') ∙h
( functor-prod-comp q q' g g'))))
map-cone-pair' :
{l1 l2 l3 l1' l2' l3' : Level}
{A : UU l1} {B : UU l2} {X : UU l3}
{A' : UU l1'} {B' : UU l2'} {X' : UU l3'}
(f : A → X) (g : B → X) (f' : A' → X') (g' : B' → X') →
(t : A × A') (s : B × B') →
(Id (f (pr1 t)) (g (pr1 s))) × (Id (f' (pr2 t)) (g' (pr2 s))) →
(Id (pr1 (functor-prod f f' t)) (pr1 (functor-prod g g' s))) ×
(Id (pr2 (functor-prod f f' t)) (pr2 (functor-prod g g' s)))
map-cone-pair' f g f' g' (pair a a') (pair b b') = id
abstract
is-equiv-map-cone-pair' :
{l1 l2 l3 l1' l2' l3' : Level}
{A : UU l1} {B : UU l2} {X : UU l3}
{A' : UU l1'} {B' : UU l2'} {X' : UU l3'}
(f : A → X) (g : B → X) (f' : A' → X') (g' : B' → X') →
(t : A × A') (s : B × B') →
is-equiv (map-cone-pair' f g f' g' t s)
is-equiv-map-cone-pair' f g f' g' (pair a a') (pair b b') =
is-equiv-id _
map-cone-pair :
{l1 l2 l3 l1' l2' l3' : Level}
{A : UU l1} {B : UU l2} {X : UU l3}
{A' : UU l1'} {B' : UU l2'} {X' : UU l3'}
(f : A → X) (g : B → X) (f' : A' → X') (g' : B' → X') →
(canonical-pullback f g) × (canonical-pullback f' g') →
canonical-pullback (functor-prod f f') (functor-prod g g')
map-cone-pair {A' = A'} {B'} f g f' g' =
( tot
( λ t →
( tot
( λ s →
( eq-pair-triv ∘ (map-cone-pair' f g f' g' t s)))) ∘
( swap-total-Eq-structure
( λ y → Id (f (pr1 t)) (g y))
( λ y → B')
( λ y p y' → Id (f' (pr2 t)) (g' y'))))) ∘
( swap-total-Eq-structure
( λ x → Σ _ (λ y → Id (f x) (g y)))
( λ x → A')
( λ x t x' → Σ _ (λ y' → Id (f' x') (g' y'))))
triangle-map-cone-pair :
{l1 l2 l3 l4 l1' l2' l3' l4' : Level}
{A : UU l1} {B : UU l2} {X : UU l3} {C : UU l4}
{A' : UU l1'} {B' : UU l2'} {X' : UU l3'} {C' : UU l4'}
(f : A → X) (g : B → X) (c : cone f g C)
(f' : A' → X') (g' : B' → X') (c' : cone f' g' C') →
(gap (functor-prod f f') (functor-prod g g') (cone-pair f g f' g' c c')) ~
((map-cone-pair f g f' g') ∘ (functor-prod (gap f g c) (gap f' g' c')))
triangle-map-cone-pair
f g (pair p (pair q H)) f' g' (pair p' (pair q' H')) (pair z z') =
eq-pair refl (eq-pair refl right-unit)
abstract
is-equiv-map-cone-pair :
{l1 l2 l3 l1' l2' l3' : Level}
{A : UU l1} {B : UU l2} {X : UU l3}
{A' : UU l1'} {B' : UU l2'} {X' : UU l3'}
(f : A → X) (g : B → X) (f' : A' → X') (g' : B' → X') →
is-equiv (map-cone-pair f g f' g')
is-equiv-map-cone-pair f g f' g' =
is-equiv-comp
( map-cone-pair f g f' g')
( tot ( λ t →
( tot
( λ s →
( eq-pair-triv ∘ (map-cone-pair' f g f' g' t s)))) ∘
( swap-total-Eq-structure _ _ _)))
( swap-total-Eq-structure _ _ _)
( refl-htpy)
( is-equiv-swap-total-Eq-structure _ _ _)
( is-equiv-tot-is-fiberwise-equiv
( λ t → is-equiv-comp
( ( tot
( λ s →
( eq-pair-triv ∘ (map-cone-pair' f g f' g' t s)))) ∘
( swap-total-Eq-structure
( λ y → Id (f (pr1 t)) (g y))
( λ y → _)
( λ y p y' → Id (f' (pr2 t)) (g' y'))))
( tot
( λ s →
( eq-pair-triv ∘ (map-cone-pair' f g f' g' t s))))
( swap-total-Eq-structure
( λ y → Id (f (pr1 t)) (g y))
( λ y → _)
( λ y p y' → Id (f' (pr2 t)) (g' y')))
( refl-htpy)
( is-equiv-swap-total-Eq-structure _ _ _)
( is-equiv-tot-is-fiberwise-equiv
( λ s → is-equiv-comp
( eq-pair-triv ∘ (map-cone-pair' f g f' g' t s))
( eq-pair-triv)
( map-cone-pair' f g f' g' t s)
( refl-htpy)
( is-equiv-map-cone-pair' f g f' g' t s)
( is-equiv-eq-pair-triv'
( functor-prod f f' t)
( functor-prod g g' s))))))
abstract
is-pullback-prod-is-pullback-pair :
{l1 l2 l3 l4 l1' l2' l3' l4' : Level}
{A : UU l1} {B : UU l2} {X : UU l3} {C : UU l4}
{A' : UU l1'} {B' : UU l2'} {X' : UU l3'} {C' : UU l4'}
(f : A → X) (g : B → X) (c : cone f g C)
(f' : A' → X') (g' : B' → X') (c' : cone f' g' C') →
is-pullback f g c → is-pullback f' g' c' →
is-pullback
( functor-prod f f') (functor-prod g g') (cone-pair f g f' g' c c')
is-pullback-prod-is-pullback-pair f g c f' g' c' is-pb-c is-pb-c' =
is-equiv-comp
( gap (functor-prod f f') (functor-prod g g') (cone-pair f g f' g' c c'))
( map-cone-pair f g f' g')
( functor-prod (gap f g c) (gap f' g' c'))
( triangle-map-cone-pair f g c f' g' c')
( is-equiv-functor-prod _ _ is-pb-c is-pb-c')
( is-equiv-map-cone-pair f g f' g')
map-fib-functor-prod :
{l1 l2 l3 l4 : Level} {A : UU l1} {B : UU l2} {C : UU l3} {D : UU l4}
(f : A → C) (g : B → D) (t : C × D) →
fib (functor-prod f g) t → (fib f (pr1 t)) × (fib g (pr2 t))
map-fib-functor-prod f g .(functor-prod f g (pair a b))
(pair (pair a b) refl) = pair (pair a refl) (pair b refl)
inv-map-fib-functor-prod :
{l1 l2 l3 l4 : Level} {A : UU l1} {B : UU l2} {C : UU l3} {D : UU l4}
(f : A → C) (g : B → D) (t : C × D) →
(fib f (pr1 t)) × (fib g (pr2 t)) → fib (functor-prod f g) t
inv-map-fib-functor-prod f g (pair .(f x) .(g y))
(pair (pair x refl) (pair y refl)) = pair (pair x y) refl
issec-inv-map-fib-functor-prod :
{l1 l2 l3 l4 : Level} {A : UU l1} {B : UU l2} {C : UU l3} {D : UU l4}
(f : A → C) (g : B → D) (t : C × D) →
((map-fib-functor-prod f g t) ∘ (inv-map-fib-functor-prod f g t)) ~ id
issec-inv-map-fib-functor-prod f g (pair .(f x) .(g y))
(pair (pair x refl) (pair y refl)) = refl
isretr-inv-map-fib-functor-prod :
{l1 l2 l3 l4 : Level} {A : UU l1} {B : UU l2} {C : UU l3} {D : UU l4}
(f : A → C) (g : B → D) (t : C × D) →
((inv-map-fib-functor-prod f g t) ∘ (map-fib-functor-prod f g t)) ~ id
isretr-inv-map-fib-functor-prod f g .(functor-prod f g (pair a b))
(pair (pair a b) refl) = refl
abstract
is-equiv-map-fib-functor-prod :
{l1 l2 l3 l4 : Level} {A : UU l1} {B : UU l2} {C : UU l3} {D : UU l4}
(f : A → C) (g : B → D) (t : C × D) →
is-equiv (map-fib-functor-prod f g t)
is-equiv-map-fib-functor-prod f g t =
is-equiv-has-inverse
( inv-map-fib-functor-prod f g t)
( issec-inv-map-fib-functor-prod f g t)
( isretr-inv-map-fib-functor-prod f g t)
abstract
is-equiv-left-factor-is-equiv-functor-prod :
{l1 l2 l3 l4 : Level} {A : UU l1} {B : UU l2} {C : UU l3} {D : UU l4}
(f : A → C) (g : B → D) (d : D) →
is-equiv (functor-prod f g) → is-equiv f
is-equiv-left-factor-is-equiv-functor-prod f g d is-equiv-fg =
is-equiv-is-contr-map
( λ x → is-contr-left-factor-prod
( fib f x)
( fib g d)
( is-contr-is-equiv'
( fib (functor-prod f g) (pair x d))
( map-fib-functor-prod f g (pair x d))
( is-equiv-map-fib-functor-prod f g (pair x d))
( is-contr-map-is-equiv is-equiv-fg (pair x d))))
abstract
is-equiv-right-factor-is-equiv-functor-prod :
{l1 l2 l3 l4 : Level} {A : UU l1} {B : UU l2} {C : UU l3} {D : UU l4}
(f : A → C) (g : B → D) (c : C) →
is-equiv (functor-prod f g) → is-equiv g
is-equiv-right-factor-is-equiv-functor-prod f g c is-equiv-fg =
is-equiv-is-contr-map
( λ y → is-contr-right-factor-prod
( fib f c)
( fib g y)
( is-contr-is-equiv'
( fib (functor-prod f g) (pair c y))
( map-fib-functor-prod f g (pair c y))
( is-equiv-map-fib-functor-prod f g (pair c y))
( is-contr-map-is-equiv is-equiv-fg (pair c y))))
abstract
is-pullback-left-factor-is-pullback-prod :
{l1 l2 l3 l4 l1' l2' l3' l4' : Level}
{A : UU l1} {B : UU l2} {X : UU l3} {C : UU l4}
{A' : UU l1'} {B' : UU l2'} {X' : UU l3'} {C' : UU l4'}
(f : A → X) (g : B → X) (c : cone f g C)
(f' : A' → X') (g' : B' → X') (c' : cone f' g' C') →
is-pullback
( functor-prod f f')
( functor-prod g g')
( cone-pair f g f' g' c c') →
canonical-pullback f' g' → is-pullback f g c
is-pullback-left-factor-is-pullback-prod f g c f' g' c' is-pb-cc' t =
is-equiv-left-factor-is-equiv-functor-prod (gap f g c) (gap f' g' c') t
( is-equiv-right-factor
( gap
( functor-prod f f')
( functor-prod g g')
( cone-pair f g f' g' c c'))
( map-cone-pair f g f' g')
( functor-prod (gap f g c) (gap f' g' c'))
( triangle-map-cone-pair f g c f' g' c')
( is-equiv-map-cone-pair f g f' g')
( is-pb-cc'))
abstract
is-pullback-right-factor-is-pullback-prod :
{l1 l2 l3 l4 l1' l2' l3' l4' : Level}
{A : UU l1} {B : UU l2} {X : UU l3} {C : UU l4}
{A' : UU l1'} {B' : UU l2'} {X' : UU l3'} {C' : UU l4'}
(f : A → X) (g : B → X) (c : cone f g C)
(f' : A' → X') (g' : B' → X') (c' : cone f' g' C') →
is-pullback
( functor-prod f f')
( functor-prod g g')
( cone-pair f g f' g' c c') →
canonical-pullback f g → is-pullback f' g' c'
is-pullback-right-factor-is-pullback-prod f g c f' g' c' is-pb-cc' t =
is-equiv-right-factor-is-equiv-functor-prod (gap f g c) (gap f' g' c') t
( is-equiv-right-factor
( gap
( functor-prod f f')
( functor-prod g g')
( cone-pair f g f' g' c c'))
( map-cone-pair f g f' g')
( functor-prod (gap f g c) (gap f' g' c'))
( triangle-map-cone-pair f g c f' g' c')
( is-equiv-map-cone-pair f g f' g')
( is-pb-cc'))
-- Exercise 10.8
cone-Π :
{l1 l2 l3 l4 l5 : Level} {I : UU l1}
{A : I → UU l2} {B : I → UU l3} {X : I → UU l4} {C : I → UU l5}
(f : (i : I) → A i → X i) (g : (i : I) → B i → X i)
(c : (i : I) → cone (f i) (g i) (C i)) →
cone (postcomp-Π f) (postcomp-Π g) ((i : I) → C i)
cone-Π f g c =
pair
( postcomp-Π (λ i → pr1 (c i)))
( pair
( postcomp-Π (λ i → pr1 (pr2 (c i))))
( htpy-postcomp-Π (λ i → pr2 (pr2 (c i)))))
map-canonical-pullback-Π :
{l1 l2 l3 l4 : Level} {I : UU l1}
{A : I → UU l2} {B : I → UU l3} {X : I → UU l4}
(f : (i : I) → A i → X i) (g : (i : I) → B i → X i) →
canonical-pullback (postcomp-Π f) (postcomp-Π g) →
(i : I) → canonical-pullback (f i) (g i)
map-canonical-pullback-Π f g (pair α (pair β γ)) i =
pair (α i) (pair (β i) (htpy-eq γ i))
inv-map-canonical-pullback-Π :
{l1 l2 l3 l4 : Level} {I : UU l1}
{A : I → UU l2} {B : I → UU l3} {X : I → UU l4}
(f : (i : I) → A i → X i) (g : (i : I) → B i → X i) →
((i : I) → canonical-pullback (f i) (g i)) →
canonical-pullback (postcomp-Π f) (postcomp-Π g)
inv-map-canonical-pullback-Π f g h =
pair
( λ i → (pr1 (h i)))
( pair
( λ i → (pr1 (pr2 (h i))))
( eq-htpy (λ i → (pr2 (pr2 (h i))))))
issec-inv-map-canonical-pullback-Π :
{l1 l2 l3 l4 : Level} {I : UU l1}
{A : I → UU l2} {B : I → UU l3} {X : I → UU l4}
(f : (i : I) → A i → X i) (g : (i : I) → B i → X i) →
((map-canonical-pullback-Π f g) ∘ (inv-map-canonical-pullback-Π f g)) ~ id
issec-inv-map-canonical-pullback-Π f g h =
eq-htpy
( λ i → eq-Eq-canonical-pullback (f i) (g i) refl refl
( inv
( ( right-unit) ∙
( htpy-eq (issec-eq-htpy (λ i → (pr2 (pr2 (h i))))) i))))
isretr-inv-map-canonical-pullback-Π :
{l1 l2 l3 l4 : Level} {I : UU l1}
{A : I → UU l2} {B : I → UU l3} {X : I → UU l4}
(f : (i : I) → A i → X i) (g : (i : I) → B i → X i) →
((inv-map-canonical-pullback-Π f g) ∘ (map-canonical-pullback-Π f g)) ~ id
isretr-inv-map-canonical-pullback-Π f g (pair α (pair β γ)) =
eq-Eq-canonical-pullback
( postcomp-Π f)
( postcomp-Π g)
refl
refl
( inv (right-unit ∙ (isretr-eq-htpy γ)))
abstract
is-equiv-map-canonical-pullback-Π :
{l1 l2 l3 l4 : Level} {I : UU l1}
{A : I → UU l2} {B : I → UU l3} {X : I → UU l4}
(f : (i : I) → A i → X i) (g : (i : I) → B i → X i) →
is-equiv (map-canonical-pullback-Π f g)
is-equiv-map-canonical-pullback-Π f g =
is-equiv-has-inverse
( inv-map-canonical-pullback-Π f g)
( issec-inv-map-canonical-pullback-Π f g)
( isretr-inv-map-canonical-pullback-Π f g)
triangle-map-canonical-pullback-Π :
{l1 l2 l3 l4 l5 : Level} {I : UU l1}
{A : I → UU l2} {B : I → UU l3} {X : I → UU l4} {C : I → UU l5}
(f : (i : I) → A i → X i) (g : (i : I) → B i → X i)
(c : (i : I) → cone (f i) (g i) (C i)) →
( postcomp-Π (λ i → gap (f i) (g i) (c i))) ~
( ( map-canonical-pullback-Π f g) ∘
( gap (postcomp-Π f) (postcomp-Π g) (cone-Π f g c)))
triangle-map-canonical-pullback-Π f g c h =
eq-htpy (λ i →
eq-Eq-canonical-pullback
(f i)
(g i)
refl refl
( (htpy-eq (issec-eq-htpy _) i) ∙ (inv right-unit)))
abstract
is-pullback-cone-Π :
{l1 l2 l3 l4 l5 : Level} {I : UU l1}
{A : I → UU l2} {B : I → UU l3} {X : I → UU l4} {C : I → UU l5}
(f : (i : I) → A i → X i) (g : (i : I) → B i → X i)
(c : (i : I) → cone (f i) (g i) (C i)) →
((i : I) → is-pullback (f i) (g i) (c i)) →
is-pullback (postcomp-Π f) (postcomp-Π g) (cone-Π f g c)
is-pullback-cone-Π f g c is-pb-c =
is-equiv-right-factor
( postcomp-Π (λ i → gap (f i) (g i) (c i)))
( map-canonical-pullback-Π f g)
( gap (postcomp-Π f) (postcomp-Π g) (cone-Π f g c))
( triangle-map-canonical-pullback-Π f g c)
( is-equiv-map-canonical-pullback-Π f g)
( is-equiv-postcomp-Π _ is-pb-c)
-- Exercise 10.9
hom-cospan :
{l1 l2 l3 l1' l2' l3' : Level}
{A : UU l1} {B : UU l2} {X : UU l3} (f : A → X) (g : B → X)
{A' : UU l1'} {B' : UU l2'} {X' : UU l3'} (f' : A' → X') (g' : B' → X') →
UU (l1 ⊔ (l2 ⊔ (l3 ⊔ (l1' ⊔ (l2' ⊔ l3')))))
hom-cospan {A = A} {B} {X} f g {A'} {B'} {X'} f' g' =
Σ (A → A') (λ hA →
Σ (B → B') (λ hB →
Σ (X → X') (λ hX →
((f' ∘ hA) ~ (hX ∘ f)) × ((g' ∘ hB) ~ (hX ∘ g)))))
id-hom-cospan :
{l1 l2 l3 l1' l2' l3' : Level}
{A : UU l1} {B : UU l2} {X : UU l3} (f : A → X) (g : B → X) →
hom-cospan f g f g
id-hom-cospan f g =
pair id (pair id (pair id (pair refl-htpy refl-htpy)))
functor-canonical-pullback :
{l1 l2 l3 l1' l2' l3' : Level}
{A : UU l1} {B : UU l2} {X : UU l3} (f : A → X) (g : B → X)
{A' : UU l1'} {B' : UU l2'} {X' : UU l3'} (f' : A' → X') (g' : B' → X') →
hom-cospan f' g' f g →
canonical-pullback f' g' → canonical-pullback f g
functor-canonical-pullback f g f' g'
(pair hA (pair hB (pair hX (pair HA HB)))) (pair a' (pair b' p')) =
pair (hA a') (pair (hB b') ((HA a') ∙ ((ap hX p') ∙ (inv (HB b')))))
cospan-hom-cospan-rotate :
{l1 l2 l3 l1' l2' l3' l1'' l2'' l3'' : Level}
{A : UU l1} {B : UU l2} {X : UU l3} (f : A → X) (g : B → X)
{A' : UU l1'} {B' : UU l2'} {X' : UU l3'} (f' : A' → X') (g' : B' → X')
{A'' : UU l1''} {B'' : UU l2''} {X'' : UU l3''}
(f'' : A'' → X'') (g'' : B'' → X'')
(h : hom-cospan f' g' f g) (h' : hom-cospan f'' g'' f g) →
hom-cospan (pr1 h) (pr1 h') (pr1 (pr2 (pr2 h))) (pr1 (pr2 (pr2 h')))
cospan-hom-cospan-rotate f g f' g' f'' g'' (pair hA (pair hB (pair hX (pair HA HB)))) (pair hA' (pair hB' (pair hX' (pair HA' HB')))) =
pair f' (pair f'' (pair f (pair (htpy-inv HA) (htpy-inv HA'))))
cospan-hom-cospan-rotate' :
{l1 l2 l3 l1' l2' l3' l1'' l2'' l3'' : Level}
{A : UU l1} {B : UU l2} {X : UU l3} (f : A → X) (g : B → X)
{A' : UU l1'} {B' : UU l2'} {X' : UU l3'} (f' : A' → X') (g' : B' → X')
{A'' : UU l1''} {B'' : UU l2''} {X'' : UU l3''}
(f'' : A'' → X'') (g'' : B'' → X'')
(h : hom-cospan f' g' f g) (h' : hom-cospan f'' g'' f g) →
hom-cospan
(pr1 (pr2 h)) (pr1 (pr2 h')) (pr1 (pr2 (pr2 h))) (pr1 (pr2 (pr2 h')))
cospan-hom-cospan-rotate' f g f' g' f'' g''
(pair hA (pair hB (pair hX (pair HA HB))))
(pair hA' (pair hB' (pair hX' (pair HA' HB')))) =
pair g' (pair g'' (pair g (pair (htpy-inv HB) (htpy-inv HB'))))
{-
map-3-by-3-canonical-pullback' :
{l1 l2 l3 l1' l2' l3' l1'' l2'' l3'' : Level}
{A : UU l1} {B : UU l2} {X : UU l3} (f : A → X) (g : B → X)
{A' : UU l1'} {B' : UU l2'} {X' : UU l3'} (f' : A' → X') (g' : B' → X')
{A'' : UU l1''} {B'' : UU l2''} {X'' : UU l3''}
(f'' : A'' → X'') (g'' : B → X'')
(h : hom-cospan f' g' f g) (h' : hom-cospan f'' g'' f g) →
Σ ( canonical-pullback f' g') (λ t' →
Σ ( canonical-pullback f'' g'') (λ t'' →
Eq-canonical-pullback f g
( functor-canonical-pullback f g f' g' h t')
( functor-canonical-pullback f g f'' g'' h' t''))) →
Σ ( canonical-pullback (pr1 h) (pr1 h')) (λ s →
Σ ( canonical-pullback (pr1 (pr2 h)) (pr1 (pr2 h'))) (λ s' →
Eq-canonical-pullback (pr1 (pr2 (pr2 h))) (pr1 (pr2 (pr2 h')))
( functor-canonical-pullback
( pr1 (pr2 (pr2 h)))
( pr1 (pr2 (pr2 h')))
( pr1 h)
( pr1 h')
( cospan-hom-cospan-rotate f g f' g' f'' g'' h h')
( s))
( functor-canonical-pullback
( pr1 (pr2 (pr2 h)))
( pr1 (pr2 (pr2 h')))
( pr1 (pr2 h))
( pr1 (pr2 h'))
( cospan-hom-cospan-rotate' f g f' g' f'' g'' h h')
( s'))))
map-3-by-3-canonical-pullback' f g f' g' f'' g''
( pair hA (pair hB (pair hX (pair HA HB))))
( pair hA' (pair hB' (pair hX' (pair HA' HB'))))
( pair
( pair a' (pair b' p'))
( pair (pair a'' (pair b'' p'')) (pair α (pair β γ)))) =
pair (pair a' (pair a'' α)) (pair (pair b' (pair b'' β)) (pair p' (pair p'' {!!})))
map-3-by-3-canonical-pullback :
{l1 l2 l3 l1' l2' l3' l1'' l2'' l3'' : Level}
{A : UU l1} {B : UU l2} {X : UU l3} (f : A → X) (g : B → X)
{A' : UU l1'} {B' : UU l2'} {X' : UU l3'} (f' : A' → X') (g' : B' → X')
{A'' : UU l1''} {B'' : UU l2''} {X'' : UU l3''}
(f'' : A'' → X'') (g'' : B → X'')
(h : hom-cospan f' g' f g) (h' : hom-cospan f'' g'' f g) →
canonical-pullback
( functor-canonical-pullback f g f' g' h)
( functor-canonical-pullback f g f'' g'' h') →
canonical-pullback
( functor-canonical-pullback
( pr1 (pr2 (pr2 h)))
( pr1 (pr2 (pr2 h')))
( pr1 h)
( pr1 h')
( cospan-hom-cospan-rotate f g f' g' f'' g'' h h'))
( functor-canonical-pullback
( pr1 (pr2 (pr2 h)))
( pr1 (pr2 (pr2 h')))
( pr1 (pr2 h))
( pr1 (pr2 h'))
( cospan-hom-cospan-rotate' f g f' g' f'' g'' h h'))
map-3-by-3-canonical-pullback = {!!}
-}
| {
"alphanum_fraction": 0.5136841206,
"avg_line_length": 38.1211331814,
"ext": "agda",
"hexsha": "2144703c977af7119befe73cbcab25f41ece21bc",
"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": "09c710bf9c31ba88be144cc950bd7bc19c22a934",
"max_forks_repo_licenses": [
"CC-BY-4.0"
],
"max_forks_repo_name": "hemangandhi/HoTT-Intro",
"max_forks_repo_path": "Agda/20-pullbacks.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "09c710bf9c31ba88be144cc950bd7bc19c22a934",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"CC-BY-4.0"
],
"max_issues_repo_name": "hemangandhi/HoTT-Intro",
"max_issues_repo_path": "Agda/20-pullbacks.agda",
"max_line_length": 135,
"max_stars_count": null,
"max_stars_repo_head_hexsha": "09c710bf9c31ba88be144cc950bd7bc19c22a934",
"max_stars_repo_licenses": [
"CC-BY-4.0"
],
"max_stars_repo_name": "hemangandhi/HoTT-Intro",
"max_stars_repo_path": "Agda/20-pullbacks.agda",
"max_stars_repo_stars_event_max_datetime": null,
"max_stars_repo_stars_event_min_datetime": null,
"num_tokens": 50103,
"size": 117070
} |
{- Byzantine Fault Tolerant Consensus Verification in Agda, version 0.9.
Copyright (c) 2021, Oracle and/or its affiliates.
Licensed under the Universal Permissive License v 1.0 as shown at https://opensource.oracle.com/licenses/upl
-}
open import LibraBFT.Base.Types
import LibraBFT.Impl.Consensus.ConsensusTypes.Block as Block
import LibraBFT.Impl.Consensus.ConsensusTypes.BlockData as BlockData
import LibraBFT.Impl.Consensus.ConsensusTypes.QuorumCert as QuorumCert
import LibraBFT.Impl.Types.BlockInfo as BlockInfo
import LibraBFT.Impl.Types.ValidatorVerifier as ValidatorVerifier
open import LibraBFT.Impl.OBM.Crypto hiding (verify)
open import LibraBFT.Impl.OBM.Logging.Logging
open import LibraBFT.Impl.OBM.Rust.RustTypes
open import LibraBFT.ImplShared.Base.Types
open import LibraBFT.ImplShared.Consensus.Types
open import Optics.All
open import Util.PKCS hiding (verify)
open import Util.Prelude
open import Util.Hash
------------------------------------------------------------------------------
open import Data.String using (String)
module LibraBFT.Impl.Consensus.ConsensusTypes.BlockRetrieval where
verify : BlockRetrievalResponse → HashValue → U64 → ValidatorVerifier → Either ErrLog Unit
verify self blockId numBlocks sigVerifier =
grd‖ self ^∙ brpStatus /= BRSSucceeded ≔
Left fakeErr -- here ["/= BRSSucceeded"]
‖ length (self ^∙ brpBlocks) /= numBlocks ≔
Left fakeErr -- here ["not enough blocks returned", show (self^.brpBlocks), show numBlocks]
‖ otherwise≔
verifyBlocks (self ^∙ brpBlocks)
where
here' : List String → List String
here' t = "BlockRetrieval" ∷ "verify" ∷ t
verifyBlock : HashValue → Block → Either ErrLog HashValue
verifyBlocks : List Block → Either ErrLog Unit
verifyBlocks blks = foldM_ verifyBlock blockId blks
verifyBlock expectedId block = do
Block.validateSignature block sigVerifier
Block.verifyWellFormed block
lcheck (block ^∙ bId == expectedId)
(here' ("blocks do not form a chain" ∷ [])) -- lsHV (block^.bId), lsHV expectedId
pure (block ^∙ bParentId)
| {
"alphanum_fraction": 0.6871633752,
"avg_line_length": 43.6862745098,
"ext": "agda",
"hexsha": "0b90162dee8368233fccfe1f80f25f2da88cf519",
"lang": "Agda",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "a4674fc473f2457fd3fe5123af48253cfb2404ef",
"max_forks_repo_licenses": [
"UPL-1.0"
],
"max_forks_repo_name": "LaudateCorpus1/bft-consensus-agda",
"max_forks_repo_path": "src/LibraBFT/Impl/Consensus/ConsensusTypes/BlockRetrieval.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "a4674fc473f2457fd3fe5123af48253cfb2404ef",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"UPL-1.0"
],
"max_issues_repo_name": "LaudateCorpus1/bft-consensus-agda",
"max_issues_repo_path": "src/LibraBFT/Impl/Consensus/ConsensusTypes/BlockRetrieval.agda",
"max_line_length": 111,
"max_stars_count": null,
"max_stars_repo_head_hexsha": "a4674fc473f2457fd3fe5123af48253cfb2404ef",
"max_stars_repo_licenses": [
"UPL-1.0"
],
"max_stars_repo_name": "LaudateCorpus1/bft-consensus-agda",
"max_stars_repo_path": "src/LibraBFT/Impl/Consensus/ConsensusTypes/BlockRetrieval.agda",
"max_stars_repo_stars_event_max_datetime": null,
"max_stars_repo_stars_event_min_datetime": null,
"num_tokens": 570,
"size": 2228
} |
{-# OPTIONS --type-in-type #-}
open import Data.Unit
open import Data.Product hiding ( curry ; uncurry )
open import Data.List hiding ( concat )
open import Data.String
open import Relation.Binary.PropositionalEquality
open import Function
module Spire.Examples.CompLev where
----------------------------------------------------------------------
Label : Set
Label = String
Enum : Set
Enum = List Label
data Tag : Enum → Set where
here : ∀{l E} → Tag (l ∷ E)
there : ∀{l E} → Tag E → Tag (l ∷ E)
Branches : (E : Enum) (P : Tag E → Set) → Set
Branches [] P = ⊤
Branches (l ∷ E) P = P here × Branches E (λ t → P (there t))
case : {E : Enum} (P : Tag E → Set) (cs : Branches E P) (t : Tag E) → P t
case P (c , cs) here = c
case P (c , cs) (there t) = case (λ t → P (there t)) cs t
----------------------------------------------------------------------
data Tel : Set where
End : Tel
Arg : (A : Set) (B : A → Tel) → Tel
Elᵀ : Tel → Set
Elᵀ End = ⊤
Elᵀ (Arg A B) = Σ A (λ a → Elᵀ (B a))
----------------------------------------------------------------------
data Desc (I : Set) : Set where
End : Desc I
Rec : (i : I) (D : Desc I) → Desc I
RecFun : (A : Set) (B : A → I) (D : Desc I) → Desc I
Arg : (A : Set) (B : A → Desc I) → Desc I
----------------------------------------------------------------------
ISet : Set → Set
ISet I = I → Set
Elᴰ : {I : Set} (D : Desc I) → ISet I → Set
Elᴰ End X = ⊤
Elᴰ (Rec j D) X = X j × Elᴰ D X
Elᴰ (RecFun A B D) X = ((a : A) → X (B a)) × Elᴰ D X
Elᴰ (Arg A B) X = Σ A (λ a → Elᴰ (B a) X)
Hyps : {I : Set} (D : Desc I) (X : ISet I) (P : (i : I) → X i → Set) (xs : Elᴰ D X) → Set
Hyps End X P tt = ⊤
Hyps (Rec i D) X P (x , xs) = P i x × Hyps D X P xs
Hyps (RecFun A B D) X P (f , xs) = ((a : A) → P (B a) (f a)) × Hyps D X P xs
Hyps (Arg A B) X P (a , xs) = Hyps (B a) X P xs
----------------------------------------------------------------------
data μ {I : Set} (R : I → Desc I) (i : I) : Set where
init : Elᴰ (R i) (μ R) → μ R i
----------------------------------------------------------------------
ind : {I : Set} (R : I → Desc I)
(M : (i : I) → μ R i → Set)
(α : ∀ i (xs : Elᴰ (R i) (μ R)) (ihs : Hyps (R i) (μ R) M xs) → M i (init xs))
(i : I)
(x : μ R i)
→ M i x
prove : {I : Set} (D : Desc I) (R : I → Desc I)
(M : (i : I) → μ R i → Set)
(α : ∀ i (xs : Elᴰ (R i) (μ R)) (ihs : Hyps (R i) (μ R) M xs) → M i (init xs))
(xs : Elᴰ D (μ R)) → Hyps D (μ R) M xs
ind R M α i (init xs) = α i xs (prove (R i) R M α xs)
prove End R M α tt = tt
prove (Rec j D) R M α (x , xs) = ind R M α j x , prove D R M α xs
prove (RecFun A B D) R M α (f , xs) = (λ a → ind R M α (B a) (f a)) , prove D R M α xs
prove (Arg A B) R M α (a , xs) = prove (B a) R M α xs
----------------------------------------------------------------------
DescE : Enum
DescE = "End" ∷ "Rec" ∷ "Arg" ∷ []
DescT : Set
DescT = Tag DescE
-- EndT : DescT
pattern EndT = here
-- RecT : DescT
pattern RecT = there here
-- ArgT : DescT
pattern ArgT = there (there here)
DescR : Set → ⊤ → Desc ⊤
DescR I tt = Arg (Tag DescE)
(case (λ _ → Desc ⊤) (
(Arg I λ i → End)
, (Arg I λ i → Rec tt End)
, (Arg Set λ A → RecFun A (λ a → tt) End)
, tt
))
`Desc : (I : Set) → Set
`Desc I = μ (DescR I) tt
-- `End : {I : Set} (i : I) → `Desc I
pattern `End i = init (EndT , i , tt)
-- `Rec : {I : Set} (i : I) (D : `Desc I) → `Desc I
pattern `Rec i D = init (RecT , i , D , tt)
-- `Arg : {I : Set} (A : Set) (B : A → `Desc I) → `Desc I
pattern `Arg A B = init (ArgT , A , B , tt)
----------------------------------------------------------------------
FixI : (I : Set) → Set
FixI I = I × `Desc I
FixR' : (I : Set) (D : `Desc I) → I → `Desc I → Desc (FixI I)
FixR' I D i (`End j) = Arg (j ≡ i) λ q → End
FixR' I D i (`Rec j E) = Rec (j , D) (FixR' I D i E)
FixR' I D i (`Arg A B) = Arg A λ a → FixR' I D i (B a)
FixR' I D i (init (there (there (there ())) , xs))
FixR : (I : Set) (D : `Desc I) → FixI I → Desc (FixI I)
FixR I D E,i = FixR' I D (proj₁ E,i) (proj₂ E,i)
`Fix : (I : Set) (D : `Desc I) (i : I) → Set
`Fix I D i = μ (FixR I D) (i , D)
----------------------------------------------------------------------
| {
"alphanum_fraction": 0.4280592734,
"avg_line_length": 28.462585034,
"ext": "agda",
"hexsha": "791d72839675f2b6002c3987504d72a9f06c66d4",
"lang": "Agda",
"max_forks_count": 1,
"max_forks_repo_forks_event_max_datetime": "2015-08-17T21:00:07.000Z",
"max_forks_repo_forks_event_min_datetime": "2015-08-17T21:00:07.000Z",
"max_forks_repo_head_hexsha": "3d67f137ee9423b7e6f8593634583998cd692353",
"max_forks_repo_licenses": [
"BSD-3-Clause"
],
"max_forks_repo_name": "spire/spire",
"max_forks_repo_path": "formalization/agda/Spire/Examples/CompLev.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "3d67f137ee9423b7e6f8593634583998cd692353",
"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": "spire/spire",
"max_issues_repo_path": "formalization/agda/Spire/Examples/CompLev.agda",
"max_line_length": 89,
"max_stars_count": 43,
"max_stars_repo_head_hexsha": "3d67f137ee9423b7e6f8593634583998cd692353",
"max_stars_repo_licenses": [
"BSD-3-Clause"
],
"max_stars_repo_name": "spire/spire",
"max_stars_repo_path": "formalization/agda/Spire/Examples/CompLev.agda",
"max_stars_repo_stars_event_max_datetime": "2022-03-08T17:10:59.000Z",
"max_stars_repo_stars_event_min_datetime": "2015-05-28T23:25:33.000Z",
"num_tokens": 1605,
"size": 4184
} |
module Issue87 where
data I : Set where
data D : I -> Set where
d : forall {i} (x : D i) -> D i
bar : forall {i} -> D i -> D i -> D i
bar (d x) (d y) with y
bar (d x) (d {i} y) | z = d {i} y
-- ERROR WAS:
-- Panic: unbound variable i
-- when checking that the expression i has type I
-- Andreas, 2016-06-02
-- This looks weird, but is accepted currently:
test : ∀ i → D i → D i → D i
test .i (d {i} x) (d {.i} y) with y
test .i (d {j} x) (d {i} y) | _ = d {i} y
-- Note the {j}!
| {
"alphanum_fraction": 0.5428571429,
"avg_line_length": 22.2727272727,
"ext": "agda",
"hexsha": "8741a7c1d7c4d2e8a63d2577ba2c22bfe83ca98a",
"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/Issue87.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/Issue87.agda",
"max_line_length": 49,
"max_stars_count": 1989,
"max_stars_repo_head_hexsha": "7f58030124fa99dfbf8db376659416f3ad8384de",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "cruhland/agda",
"max_stars_repo_path": "test/Succeed/Issue87.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": 197,
"size": 490
} |
open import Agda.Builtin.Equality
_∘_ : ∀ {a b c}
{A : Set a} {B : A → Set b} {C : {x : A} → B x → Set c} →
(f : ∀ {x} (y : B x) → C y) →
(g : (x : A) → B x) →
((x : A) → C (g x))
f ∘ g = λ x → f (g x)
postulate
A : Set
B : A → Set
C : {x : A} → B x → Set
f : ∀ {x : A} (y : B x) → C y
g : (x : A) → B x
test : (f ∘ g) ≡ (f ∘ g)
test = {!!}
-- WAS: goal displayed as ((λ {x} -> f) ∘ g) ≡ ((λ {x} -> f) ∘ g)
-- WANT: no spurious hidden lambda i.e. (f ∘ g) ≡ (f ∘ g)
| {
"alphanum_fraction": 0.3659491194,
"avg_line_length": 23.2272727273,
"ext": "agda",
"hexsha": "8363390bfd6296596b85eeac140ab8c5bbcd9f11",
"lang": "Agda",
"max_forks_count": 371,
"max_forks_repo_forks_event_max_datetime": "2022-03-30T19:00:30.000Z",
"max_forks_repo_forks_event_min_datetime": "2015-01-03T14:04:08.000Z",
"max_forks_repo_head_hexsha": "7f58030124fa99dfbf8db376659416f3ad8384de",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "cruhland/agda",
"max_forks_repo_path": "test/interaction/Issue3238.agda",
"max_issues_count": 4066,
"max_issues_repo_head_hexsha": "7f58030124fa99dfbf8db376659416f3ad8384de",
"max_issues_repo_issues_event_max_datetime": "2022-03-31T21:14:49.000Z",
"max_issues_repo_issues_event_min_datetime": "2015-01-10T11:24:51.000Z",
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "cruhland/agda",
"max_issues_repo_path": "test/interaction/Issue3238.agda",
"max_line_length": 65,
"max_stars_count": 1989,
"max_stars_repo_head_hexsha": "7f58030124fa99dfbf8db376659416f3ad8384de",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "cruhland/agda",
"max_stars_repo_path": "test/interaction/Issue3238.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": 249,
"size": 511
} |
open import Data.Natural using ( Natural ; # ; _+_ )
module System.IO.Examples.Four where
four : Natural
four = # 2 + # 2 | {
"alphanum_fraction": 0.674796748,
"avg_line_length": 20.5,
"ext": "agda",
"hexsha": "ceb7b3a5352a6cb376d734f4876ce954141d2e3e",
"lang": "Agda",
"max_forks_count": 2,
"max_forks_repo_forks_event_max_datetime": "2022-03-12T11:40:23.000Z",
"max_forks_repo_forks_event_min_datetime": "2017-08-10T06:12:54.000Z",
"max_forks_repo_head_hexsha": "d06c219c7b7afc85aae3b1d4d66951b889aa7371",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "ilya-fiveisky/agda-system-io",
"max_forks_repo_path": "src/System/IO/Examples/Four.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "d06c219c7b7afc85aae3b1d4d66951b889aa7371",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "ilya-fiveisky/agda-system-io",
"max_issues_repo_path": "src/System/IO/Examples/Four.agda",
"max_line_length": 52,
"max_stars_count": 10,
"max_stars_repo_head_hexsha": "d06c219c7b7afc85aae3b1d4d66951b889aa7371",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "ilya-fiveisky/agda-system-io",
"max_stars_repo_path": "src/System/IO/Examples/Four.agda",
"max_stars_repo_stars_event_max_datetime": "2021-09-15T04:35:41.000Z",
"max_stars_repo_stars_event_min_datetime": "2015-01-04T13:45:16.000Z",
"num_tokens": 36,
"size": 123
} |
{-# OPTIONS --safe --warning=error --without-K #-}
open import Sets.EquivalenceRelations
open import Setoids.Setoids
open import Agda.Primitive using (Level; lzero; lsuc; _⊔_)
open import Groups.Definition
module Groups.Homomorphisms.Definition where
record GroupHom {m n o p : _} {A : Set m} {S : Setoid {m} {o} A} {_·A_ : A → A → A} {B : Set n} {T : Setoid {n} {p} B} {_·B_ : B → B → B} (G : Group S _·A_) (H : Group T _·B_) (f : A → B) : Set (m ⊔ n ⊔ o ⊔ p) where
open Group H
open Setoid T
field
groupHom : {x y : A} → f (x ·A y) ∼ (f x) ·B (f y)
wellDefined : {x y : A} → Setoid._∼_ S x y → f x ∼ f y
groupHom' : {x y : A} → (f x) ·B (f y) ∼ f (x ·A y)
groupHom' = Equivalence.symmetric eq groupHom
record InjectiveGroupHom {m n o p : _} {A : Set m} {S : Setoid {m} {o} A} {_·A_ : A → A → A} {B : Set n} {T : Setoid {n} {p} B} {_·B_ : B → B → B} {G : Group S _·A_} {H : Group T _·B_} {underf : A → B} (f : GroupHom G H underf) : Set (m ⊔ n ⊔ o ⊔ p) where
open Setoid S renaming (_∼_ to _∼A_)
open Setoid T renaming (_∼_ to _∼B_)
field
injective : SetoidInjection S T underf
| {
"alphanum_fraction": 0.5796579658,
"avg_line_length": 46.2916666667,
"ext": "agda",
"hexsha": "f9080768704877a2f3278a1a94be862e04d2e952",
"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/Homomorphisms/Definition.agda",
"max_issues_count": 14,
"max_issues_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562",
"max_issues_repo_issues_event_max_datetime": "2020-04-11T11:03:39.000Z",
"max_issues_repo_issues_event_min_datetime": "2019-01-06T21:11:59.000Z",
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "Smaug123/agdaproofs",
"max_issues_repo_path": "Groups/Homomorphisms/Definition.agda",
"max_line_length": 255,
"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/Homomorphisms/Definition.agda",
"max_stars_repo_stars_event_max_datetime": "2022-01-28T06:04:15.000Z",
"max_stars_repo_stars_event_min_datetime": "2019-08-08T12:44:19.000Z",
"num_tokens": 466,
"size": 1111
} |
-- Andreas, 2017-02-14 issue #2455 reported by mechvel
-- Test case by Andrea
-- Seem that the fix for issue #44 was not complete.
-- When inserting module parameters for a definition,
-- we need to respect polarities!
-- {-# OPTIONS -v tc.decl:10 -v tc.polarity:70 -v tc.sig.inst:30 #-}
module Issue2455 where
data _≡_ {A : Set} (x : A) : A → Set where
refl : x ≡ x
data Unit : Set where
unit : Unit
postulate
A : Set
P : A → Set
p : ∀ {e} → P e
module M (e : A) (f : Unit) where
aux : Unit → P e
aux unit = p
-- se does not depent on f
-- se gets type (e : A) (f :{UnusedArg} Unit) -> A
se = e
-- aux' should not depend on f
-- For this to work, the module parameters for se must be
-- respecting UnusedArg.
aux' : Unit → P se
aux' unit = p
works : ∀ x y e → M.aux e x ≡ M.aux e y
works _ _ _ = refl
fails : ∀ x y e → M.aux' e x ≡ M.aux' e y
fails _ _ _ = refl
| {
"alphanum_fraction": 0.596069869,
"avg_line_length": 20.8181818182,
"ext": "agda",
"hexsha": "1aacfe459e80044753bd6c2d508a53ed3dbe8a8a",
"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": "802a28aa8374f15fe9d011ceb80317fdb1ec0949",
"max_forks_repo_licenses": [
"BSD-3-Clause"
],
"max_forks_repo_name": "Blaisorblade/Agda",
"max_forks_repo_path": "test/Succeed/Issue2455.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "802a28aa8374f15fe9d011ceb80317fdb1ec0949",
"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": "Blaisorblade/Agda",
"max_issues_repo_path": "test/Succeed/Issue2455.agda",
"max_line_length": 68,
"max_stars_count": 3,
"max_stars_repo_head_hexsha": "802a28aa8374f15fe9d011ceb80317fdb1ec0949",
"max_stars_repo_licenses": [
"BSD-3-Clause"
],
"max_stars_repo_name": "Blaisorblade/Agda",
"max_stars_repo_path": "test/Succeed/Issue2455.agda",
"max_stars_repo_stars_event_max_datetime": "2015-12-07T20:14:00.000Z",
"max_stars_repo_stars_event_min_datetime": "2015-03-28T14:51:03.000Z",
"num_tokens": 322,
"size": 916
} |
module ShouldBeApplicationOf where
data One : Set where one : One
data Two : Set where two : Two
f : One -> Two
f two = two
| {
"alphanum_fraction": 0.6875,
"avg_line_length": 12.8,
"ext": "agda",
"hexsha": "43e5ac67ca4fb846a1faca7cfe0537e05196793d",
"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/ShouldBeApplicationOf.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/ShouldBeApplicationOf.agda",
"max_line_length": 34,
"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/ShouldBeApplicationOf.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": 37,
"size": 128
} |
-- Andreas, bug found 2011-12-31
{-# OPTIONS --irrelevant-projections #-}
module Issue543 where
open import Common.Equality
data ⊥ : Set where
record ⊤ : Set where
constructor tt
data Bool : Set where
true false : Bool
T : Bool → Set
T true = ⊤
T false = ⊥
record Squash {ℓ}(A : Set ℓ) : Set ℓ where
constructor squash
field
.unsquash : A
open Squash
-- ok:
sqT≡sqF : squash true ≡ squash false
sqT≡sqF = refl
-- this should not be provable!!
.irrT≡F : true ≡ false
irrT≡F = subst (λ s → unsquash (squash true) ≡ unsquash s) sqT≡sqF refl
-- the rest is easy
T≠F : true ≡ false → ⊥
T≠F p = subst T p tt
.irr⊥ : ⊥
irr⊥ = T≠F irrT≡F
rel⊥ : .⊥ → ⊥
rel⊥ ()
absurd : ⊥
absurd = rel⊥ irr⊥
| {
"alphanum_fraction": 0.6295774648,
"avg_line_length": 15.4347826087,
"ext": "agda",
"hexsha": "76321c10d405b284ea2d6ca3b453167a6d7d74a7",
"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/Issue543.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/Issue543.agda",
"max_line_length": 71,
"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/Issue543.agda",
"max_stars_repo_stars_event_max_datetime": null,
"max_stars_repo_stars_event_min_datetime": null,
"num_tokens": 292,
"size": 710
} |
{-# OPTIONS --without-K --exact-split --safe #-}
module HoTT.Ident where
data Id (X : Set) : X → X → Set where
refl : (x : X) → Id X x x
_≡_ : {X : Set} → X → X → Set
x ≡ y = Id _ x y
𝕁 : {X : Set}
→ (A : (x y : X) → x ≡ y → Set)
→ ((x : X) → A x x (refl x))
→ (x y : X) → (p : x ≡ y) → A x y p
𝕁 A f x x (refl x) = f x
ℍ : {X : Set}
→ (x : X)
→ (B : (y : X) → x ≡ y → Set)
→ B x (refl x)
→ (y : X) → (p : x ≡ y) → B y p
ℍ x B b x (refl x) = b
-- Defining `𝕁` in terms of `ℍ`.
𝕁' : {X : Set}
→ (A : (x y : X) → x ≡ y → Set)
→ ((x : X) → A x x (refl x))
→ (x y : X) → (p : x ≡ y) → A x y p
𝕁' A f x = ℍ x (A x) (f x)
-- Defining `ℍ` in terms of `𝕁`.
transport : {X : Set} → (f : X → Set) → (x y : X) → (x ≡ y) → f x → f y
transport f = 𝕁 (λ x y p → f x → f y) (λ x y → y)
data Σ (A : Set) (p : A → Set) : Set where
_,_ : (x : A) → p x → Σ A p
curry : {A : Set} {B : A → Set} → ((x : A) → B x → Set) → Σ A B → Set
curry f (x , y) = f x y
-- This is just for the "Note" below.
singl : (A : Set) → A → Set
singl A x = Σ A (λ y → x ≡ y)
-- Note: `≡` in the conclusion is WRT `Id (singl X x)`.
-- Source: http://www.cse.chalmers.se/~coquand/singl.pdf
lemma : {X : Set} → (x y : X) → (p : x ≡ y) → (x , refl x) ≡ (y , p)
lemma = 𝕁 (λ x y p → (x , refl x) ≡ (y , p)) (λ x → refl (x , refl x))
ℍ' : {X : Set}
→ (x : X)
→ (B : (y : X) → x ≡ y → Set)
→ B x (refl x)
→ (y : X) → (p : x ≡ y) → B y p
ℍ' x B b y p = transport (curry B) (x , refl x) (y , p) (lemma x y p) b
| {
"alphanum_fraction": 0.4193762442,
"avg_line_length": 25.5423728814,
"ext": "agda",
"hexsha": "d77b326eb295b813c95a32789424ddb14073cc55",
"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": "049af4726fb1e2810705a798280389e72cb323f9",
"max_forks_repo_licenses": [
"BSD-2-Clause"
],
"max_forks_repo_name": "izuk/agda-hott",
"max_forks_repo_path": "HoTT/Ident.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "049af4726fb1e2810705a798280389e72cb323f9",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"BSD-2-Clause"
],
"max_issues_repo_name": "izuk/agda-hott",
"max_issues_repo_path": "HoTT/Ident.agda",
"max_line_length": 71,
"max_stars_count": null,
"max_stars_repo_head_hexsha": "049af4726fb1e2810705a798280389e72cb323f9",
"max_stars_repo_licenses": [
"BSD-2-Clause"
],
"max_stars_repo_name": "izuk/agda-hott",
"max_stars_repo_path": "HoTT/Ident.agda",
"max_stars_repo_stars_event_max_datetime": null,
"max_stars_repo_stars_event_min_datetime": null,
"num_tokens": 752,
"size": 1507
} |
------------------------------------------------------------------------
-- Compiler correctness
------------------------------------------------------------------------
open import Prelude
import Lambda.Syntax
module Lambda.Compiler-correctness
{Name : Type}
(open Lambda.Syntax Name)
(def : Name → Tm 1)
where
import Equality.Propositional as E
import Tactic.By.Propositional as By
open import Prelude.Size
open import List E.equality-with-J using (_++_)
open import Monad E.equality-with-J using (return; _>>=_)
open import Vec.Data E.equality-with-J
open import Delay-monad.Bisimilarity
open import Lambda.Compiler def
open import Lambda.Delay-crash
open import Lambda.Interpreter def
open import Lambda.Virtual-machine.Instructions Name hiding (crash)
open import Lambda.Virtual-machine comp-name
private
module C = Closure Code
module T = Closure Tm
------------------------------------------------------------------------
-- A lemma
-- A rearrangement lemma for ⟦_⟧.
⟦⟧-· :
∀ {n} (t₁ t₂ : Tm n) {ρ} {k : T.Value → Delay-crash C.Value ∞} →
⟦ t₁ · t₂ ⟧ ρ >>= k ∼
⟦ t₁ ⟧ ρ >>= λ v₁ → ⟦ t₂ ⟧ ρ >>= λ v₂ → v₁ ∙ v₂ >>= k
⟦⟧-· t₁ t₂ {ρ} {k} =
⟦ t₁ · t₂ ⟧ ρ >>= k ∼⟨⟩
(do v₁ ← ⟦ t₁ ⟧ ρ
v₂ ← ⟦ t₂ ⟧ ρ
v₁ ∙ v₂) >>= k ∼⟨ symmetric (associativity (⟦ t₁ ⟧ _) _ _) ⟩
(do v₁ ← ⟦ t₁ ⟧ ρ
(do v₂ ← ⟦ t₂ ⟧ ρ
v₁ ∙ v₂) >>= k) ∼⟨ (⟦ t₁ ⟧ _ ∎) >>=-cong (λ _ → symmetric (associativity (⟦ t₂ ⟧ _) _ _)) ⟩
(do v₁ ← ⟦ t₁ ⟧ ρ
v₂ ← ⟦ t₂ ⟧ ρ
v₁ ∙ v₂ >>= k) ∎
------------------------------------------------------------------------
-- Well-formed continuations and stacks
-- A continuation is OK with respect to a certain state if the
-- following property is satisfied.
Cont-OK : Size → State → (T.Value → Delay-crash C.Value ∞) → Type
Cont-OK i ⟨ c , s , ρ ⟩ k =
∀ v → [ i ] exec ⟨ c , val (comp-val v) ∷ s , ρ ⟩ ≈ k v
-- If the In-tail-context parameter indicates that we are in a tail
-- context, then the stack must have a certain shape, and it must be
-- related to the continuation in a certain way.
data Stack-OK (i : Size) (k : T.Value → Delay-crash C.Value ∞) :
In-tail-context → Stack → Type where
unrestricted : ∀ {s} → Stack-OK i k false s
restricted : ∀ {s n} {c : Code n} {ρ : C.Env n} →
Cont-OK i ⟨ c , s , ρ ⟩ k →
Stack-OK i k true (ret c ρ ∷ s)
-- A lemma that can be used to show that certain stacks are OK.
ret-ok :
∀ {p i s n c} {ρ : C.Env n} {k} →
Cont-OK i ⟨ c , s , ρ ⟩ k →
Stack-OK i k p (ret c ρ ∷ s)
ret-ok {true} c-ok = restricted c-ok
ret-ok {false} _ = unrestricted
------------------------------------------------------------------------
-- The semantics of the compiled program matches that of the source
-- code
mutual
-- Some lemmas making up the main part of the compiler correctness
-- result.
⟦⟧-correct :
∀ {i n} (t : Tm n) (ρ : T.Env n) {c s}
{k : T.Value → Delay-crash C.Value ∞} {tc} →
Stack-OK i k tc s →
Cont-OK i ⟨ c , s , comp-env ρ ⟩ k →
[ i ] exec ⟨ comp tc t c , s , comp-env ρ ⟩ ≈ ⟦ t ⟧ ρ >>= k
⟦⟧-correct (var x) ρ {c} {s} {k} _ c-ok =
exec ⟨ var x ∷ c , s , comp-env ρ ⟩ ≳⟨⟩
exec ⟨ c , val By.⟨ index (comp-env ρ) x ⟩ ∷ s , comp-env ρ ⟩ ≡⟨ By.⟨by⟩ (comp-index ρ x) ⟩
exec ⟨ c , val (comp-val (index ρ x)) ∷ s , comp-env ρ ⟩ ≈⟨ c-ok (index ρ x) ⟩∼
k (index ρ x) ∼⟨⟩
⟦ var x ⟧ ρ >>= k ∎
⟦⟧-correct (lam t) ρ {c} {s} {k} _ c-ok =
exec ⟨ clo (comp-body t) ∷ c , s , comp-env ρ ⟩ ≳⟨⟩
exec ⟨ c , val (comp-val (T.lam t ρ)) ∷ s , comp-env ρ ⟩ ≈⟨ c-ok (T.lam t ρ) ⟩∼
k (T.lam t ρ) ∼⟨⟩
⟦ lam t ⟧ ρ >>= k ∎
⟦⟧-correct (t₁ · t₂) ρ {c} {s} {k} _ c-ok =
exec ⟨ comp false t₁ (comp false t₂ (app ∷ c))
, s
, comp-env ρ
⟩ ≈⟨ (⟦⟧-correct t₁ _ unrestricted λ v₁ →
exec ⟨ comp false t₂ (app ∷ c)
, val (comp-val v₁) ∷ s
, comp-env ρ
⟩ ≈⟨ (⟦⟧-correct t₂ _ unrestricted λ v₂ →
exec ⟨ app ∷ c
, val (comp-val v₂) ∷ val (comp-val v₁) ∷ s
, comp-env ρ
⟩ ≈⟨ ∙-correct v₁ v₂ c-ok ⟩∼
v₁ ∙ v₂ >>= k ∎) ⟩∼
(⟦ t₂ ⟧ ρ >>= λ v₂ → v₁ ∙ v₂ >>= k) ∎) ⟩∼
(⟦ t₁ ⟧ ρ >>= λ v₁ → ⟦ t₂ ⟧ ρ >>= λ v₂ → v₁ ∙ v₂ >>= k) ∼⟨ symmetric (⟦⟧-· t₁ t₂) ⟩
⟦ t₁ · t₂ ⟧ ρ >>= k ∎
⟦⟧-correct (call f t) ρ {c} {s} {k} unrestricted c-ok =
exec ⟨ comp false (call f t) c , s , comp-env ρ ⟩ ∼⟨⟩
exec ⟨ comp false t (cal f ∷ c) , s , comp-env ρ ⟩ ≈⟨ (⟦⟧-correct t _ unrestricted λ v →
exec ⟨ cal f ∷ c , val (comp-val v) ∷ s , comp-env ρ ⟩ ≈⟨ (later λ { .force →
exec ⟨ comp-name f
, ret c (comp-env ρ) ∷ s
, comp-val v ∷ []
⟩ ≈⟨ body-lemma (def f) [] c-ok ⟩∼
(⟦ def f ⟧ (v ∷ []) >>= k) ∎ }) ⟩∼
(T.lam (def f) [] ∙ v >>= k) ∎) ⟩∼
(⟦ t ⟧ ρ >>= λ v → T.lam (def f) [] ∙ v >>= k) ∼⟨ associativity (⟦ t ⟧ ρ) _ _ ⟩
(⟦ t ⟧ ρ >>= λ v → T.lam (def f) [] ∙ v) >>= k ∼⟨⟩
⟦ call f t ⟧ ρ >>= k ∎
⟦⟧-correct (call f t) ρ {c} {ret c′ ρ′ ∷ s} {k} (restricted c-ok) _ =
exec ⟨ comp true (call f t) c , ret c′ ρ′ ∷ s , comp-env ρ ⟩ ∼⟨⟩
exec ⟨ comp false t (tcl f ∷ c) , ret c′ ρ′ ∷ s , comp-env ρ ⟩ ≈⟨ (⟦⟧-correct t _ unrestricted λ v →
exec ⟨ tcl f ∷ c
, val (comp-val v) ∷ ret c′ ρ′ ∷ s
, comp-env ρ
⟩ ≈⟨ (later λ { .force →
exec ⟨ comp-name f
, ret c′ ρ′ ∷ s
, comp-val v ∷ []
⟩ ≈⟨ body-lemma (def f) [] c-ok ⟩∼
⟦ def f ⟧ (v ∷ []) >>= k ∎ }) ⟩∼
T.lam (def f) [] ∙ v >>= k ∎) ⟩∼
(⟦ t ⟧ ρ >>= λ v → T.lam (def f) [] ∙ v >>= k) ∼⟨ associativity (⟦ t ⟧ ρ) _ _ ⟩
(⟦ t ⟧ ρ >>= λ v → T.lam (def f) [] ∙ v) >>= k ∼⟨⟩
⟦ call f t ⟧ ρ >>= k ∎
⟦⟧-correct (con b) ρ {c} {s} {k} _ c-ok =
exec ⟨ con b ∷ c , s , comp-env ρ ⟩ ≳⟨⟩
exec ⟨ c , val (comp-val (T.con b)) ∷ s , comp-env ρ ⟩ ≈⟨ c-ok (T.con b) ⟩∼
k (T.con b) ∼⟨⟩
⟦ con b ⟧ ρ >>= k ∎
⟦⟧-correct (if t₁ t₂ t₃) ρ {c} {s} {k} {tc} s-ok c-ok =
exec ⟨ comp false t₁ (bra (comp tc t₂ []) (comp tc t₃ []) ∷ c)
, s
, comp-env ρ
⟩ ≈⟨ (⟦⟧-correct t₁ _ unrestricted λ v₁ → ⟦if⟧-correct v₁ t₂ t₃ s-ok c-ok) ⟩∼
(⟦ t₁ ⟧ ρ >>= λ v₁ → ⟦if⟧ v₁ t₂ t₃ ρ >>= k) ∼⟨ associativity (⟦ t₁ ⟧ ρ) _ _ ⟩
(⟦ t₁ ⟧ ρ >>= λ v₁ → ⟦if⟧ v₁ t₂ t₃ ρ) >>= k ∼⟨⟩
⟦ if t₁ t₂ t₃ ⟧ ρ >>= k ∎
body-lemma :
∀ {i n n′} (t : Tm (1 + n)) ρ {ρ′ : C.Env n′} {c s v}
{k : T.Value → Delay-crash C.Value ∞} →
Cont-OK i ⟨ c , s , ρ′ ⟩ k →
[ i ] exec ⟨ comp-body t
, ret c ρ′ ∷ s
, comp-val v ∷ comp-env ρ
⟩ ≈
⟦ t ⟧ (v ∷ ρ) >>= k
body-lemma t ρ {ρ′} {c} {s} {v} {k} c-ok =
exec ⟨ comp-body t , ret c ρ′ ∷ s , comp-val v ∷ comp-env ρ ⟩ ∼⟨⟩
exec ⟨ comp-body t , ret c ρ′ ∷ s , comp-env (v ∷ ρ) ⟩ ≈⟨ (⟦⟧-correct t (_ ∷ _) (ret-ok c-ok) λ v′ →
exec ⟨ ret ∷ []
, val (comp-val v′) ∷ ret c ρ′ ∷ s
, comp-env (v ∷ ρ)
⟩ ≳⟨⟩
exec ⟨ c , val (comp-val v′) ∷ s , ρ′ ⟩ ≈⟨ c-ok v′ ⟩∼
k v′ ∎) ⟩∼
⟦ t ⟧ (v ∷ ρ) >>= k ∎
∙-correct :
∀ {i n} v₁ v₂ {ρ : C.Env n} {c s}
{k : T.Value → Delay-crash C.Value ∞} →
Cont-OK i ⟨ c , s , ρ ⟩ k →
[ i ] exec ⟨ app ∷ c
, val (comp-val v₂) ∷ val (comp-val v₁) ∷ s
, ρ
⟩ ≈
v₁ ∙ v₂ >>= k
∙-correct (T.lam t₁ ρ₁) v₂ {ρ} {c} {s} {k} c-ok =
exec ⟨ app ∷ c
, val (comp-val v₂) ∷ val (comp-val (T.lam t₁ ρ₁)) ∷ s
, ρ
⟩ ≈⟨ later (λ { .force →
exec ⟨ comp-body t₁ , ret c ρ ∷ s , comp-val v₂ ∷ comp-env ρ₁ ⟩ ≈⟨ body-lemma t₁ _ c-ok ⟩∼
⟦ t₁ ⟧ (v₂ ∷ ρ₁) >>= k ∎ }) ⟩∎
T.lam t₁ ρ₁ ∙ v₂ >>= k ∎
∙-correct (T.con b) v₂ {ρ} {c} {s} {k} _ =
exec ⟨ app ∷ c
, val (comp-val v₂) ∷ val (comp-val (T.con b)) ∷ s
, ρ
⟩ ≳⟨⟩
crash ∼⟨⟩
T.con b ∙ v₂ >>= k ∎
⟦if⟧-correct :
∀ {i n} v₁ (t₂ t₃ : Tm n) {ρ : T.Env n} {c s}
{k : T.Value → Delay-crash C.Value ∞} {tc} →
Stack-OK i k tc s →
Cont-OK i ⟨ c , s , comp-env ρ ⟩ k →
[ i ] exec ⟨ bra (comp tc t₂ []) (comp tc t₃ []) ∷ c
, val (comp-val v₁) ∷ s
, comp-env ρ
⟩ ≈
⟦if⟧ v₁ t₂ t₃ ρ >>= k
⟦if⟧-correct (T.lam t₁ ρ₁) t₂ t₃ {ρ} {c} {s} {k} {tc} _ _ =
exec ⟨ bra (comp tc t₂ []) (comp tc t₃ []) ∷ c
, val (comp-val (T.lam t₁ ρ₁)) ∷ s
, comp-env ρ
⟩ ≳⟨⟩
crash ∼⟨⟩
⟦if⟧ (T.lam t₁ ρ₁) t₂ t₃ ρ >>= k ∎
⟦if⟧-correct (T.con true) t₂ t₃ {ρ} {c} {s} {k} {tc} s-ok c-ok =
exec ⟨ bra (comp tc t₂ []) (comp tc t₃ []) ∷ c
, val (comp-val (T.con true)) ∷ s
, comp-env ρ
⟩ ≳⟨⟩
exec ⟨ comp tc t₂ [] ++ c , s , comp-env ρ ⟩ ≡⟨ By.by (comp-++ _ t₂) ⟩
exec ⟨ comp tc t₂ c , s , comp-env ρ ⟩ ≈⟨ ⟦⟧-correct t₂ _ s-ok c-ok ⟩∼
⟦ t₂ ⟧ ρ >>= k ∼⟨⟩
⟦if⟧ (T.con true) t₂ t₃ ρ >>= k ∎
⟦if⟧-correct (T.con false) t₂ t₃ {ρ} {c} {s} {k} {tc} s-ok c-ok =
exec ⟨ bra (comp tc t₂ []) (comp tc t₃ []) ∷ c
, val (comp-val (T.con false)) ∷ s
, comp-env ρ
⟩ ≳⟨⟩
exec ⟨ comp tc t₃ [] ++ c , s , comp-env ρ ⟩ ≡⟨ By.by (comp-++ _ t₃) ⟩
exec ⟨ comp tc t₃ c , s , comp-env ρ ⟩ ≈⟨ ⟦⟧-correct t₃ _ s-ok c-ok ⟩∼
⟦ t₃ ⟧ ρ >>= k ∼⟨⟩
⟦if⟧ (T.con false) t₂ t₃ ρ >>= k ∎
-- Compiler correctness. Note that the equality that is used here is
-- syntactic.
correct :
(t : Tm 0) →
exec ⟨ comp₀ t , [] , [] ⟩ ≈
⟦ t ⟧ [] >>= λ v → return (comp-val v)
correct t =
exec ⟨ comp false t [] , [] , [] ⟩ ∼⟨⟩
exec ⟨ comp false t [] , [] , comp-env [] ⟩ ≈⟨ ⟦⟧-correct t [] unrestricted (λ v → laterˡ (return (comp-val v) ∎)) ⟩
(⟦ t ⟧ [] >>= λ v → return (comp-val v)) ∎
| {
"alphanum_fraction": 0.3604299631,
"avg_line_length": 36.7530864198,
"ext": "agda",
"hexsha": "0acae2c4bca4e2ae4972b3c85d5f5130ddee1e69",
"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": "dec8cd2d2851340840de25acb0feb78f7b5ffe96",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "nad/definitional-interpreters",
"max_forks_repo_path": "src/Lambda/Compiler-correctness.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "dec8cd2d2851340840de25acb0feb78f7b5ffe96",
"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/definitional-interpreters",
"max_issues_repo_path": "src/Lambda/Compiler-correctness.agda",
"max_line_length": 143,
"max_stars_count": null,
"max_stars_repo_head_hexsha": "dec8cd2d2851340840de25acb0feb78f7b5ffe96",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "nad/definitional-interpreters",
"max_stars_repo_path": "src/Lambda/Compiler-correctness.agda",
"max_stars_repo_stars_event_max_datetime": null,
"max_stars_repo_stars_event_min_datetime": null,
"num_tokens": 4320,
"size": 11908
} |
{-# OPTIONS --cubical-compatible #-}
data Bool : Set where
true : Bool
false : Bool
data ℕ : Set where
zero : ℕ
suc : (n : ℕ) → ℕ
data Fin : ℕ → Set where
zero : {n : ℕ} → Fin (suc n)
suc : {n : ℕ} (i : Fin n) → Fin (suc n)
infixr 5 _∷_
data Vec {a} (A : Set a) : ℕ → Set a where
[] : Vec A zero
_∷_ : ∀ {n} (x : A) (xs : Vec A n) → Vec A (suc n)
infix 4 _[_]=_
data _[_]=_ {a} {A : Set a} :
{n : ℕ} → Vec A n → Fin n → A → Set a where
here : ∀ {n} {x} {xs : Vec A n} → x ∷ xs [ zero ]= x
there : ∀ {n} {i} {x y} {xs : Vec A n}
(xs[i]=x : xs [ i ]= x) → y ∷ xs [ suc i ]= x
Subset : ℕ → Set
Subset = Vec Bool
infix 4 _∈_
_∈_ : ∀ {n} → Fin n → Subset n → Set
x ∈ p = p [ x ]= true
drop-there : ∀ {s n x} {p : Subset n} → suc x ∈ s ∷ p → x ∈ p
drop-there (there x∈p) = x∈p
_∘_ : ∀ {a b c}
{A : Set a} {B : A → Set b} {C : {x : A} → B x → Set c} →
(∀ {x} (y : B x) → C y) → (g : (x : A) → B x) →
((x : A) → C (g x))
f ∘ g = λ x → f (g x)
data ⊥ : Set where
infix 3 ¬_
¬_ : ∀ {ℓ} → Set ℓ → Set ℓ
¬ P = P → ⊥
data Dec {p} (P : Set p) : Set p where
yes : ( p : P) → Dec P
no : (¬p : ¬ P) → Dec P
infix 4 _∈?_
_∈?_ : ∀ {n} x (p : Subset n) → Dec (x ∈ p)
zero ∈? true ∷ p = yes here
zero ∈? false ∷ p = no λ()
suc n ∈? s ∷ p with n ∈? p
... | yes n∈p = yes (there n∈p)
... | no n∉p = no (n∉p ∘ drop-there)
| {
"alphanum_fraction": 0.4156293223,
"avg_line_length": 22.2461538462,
"ext": "agda",
"hexsha": "b5716ecd8123ec3bcaf576ae9d5ee63e27bf6666",
"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/Succeed/Issue1775.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/Succeed/Issue1775.agda",
"max_line_length": 65,
"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/Succeed/Issue1775.agda",
"max_stars_repo_stars_event_max_datetime": null,
"max_stars_repo_stars_event_min_datetime": null,
"num_tokens": 668,
"size": 1446
} |
module STLC1.Kovacs.Soundness where
open import STLC1.Kovacs.Convertibility public
open import STLC1.Kovacs.PresheafRefinement public
--------------------------------------------------------------------------------
infix 3 _≈_
_≈_ : ∀ {A Γ} → Γ ⊩ A → Γ ⊩ A → Set
_≈_ {⎵} {Γ} M₁ M₂ = M₁ ≡ M₂
_≈_ {A ⇒ B} {Γ} f₁ f₂ = ∀ {Γ′} → (η : Γ′ ⊇ Γ) {a₁ a₂ : Γ′ ⊩ A}
→ (p : a₁ ≈ a₂) (u₁ : 𝒰 a₁) (u₂ : 𝒰 a₂)
→ f₁ η a₁ ≈ f₂ η a₂
_≈_ {A ⩕ B} {Γ} s₁ s₂ = proj₁ s₁ ≈ proj₁ s₂ × proj₂ s₁ ≈ proj₂ s₂
_≈_ {⫪} {Γ} s₁ s₂ = ⊤
-- (≈ᶜ ; ∙ ; _,_)
infix 3 _≈⋆_
data _≈⋆_ : ∀ {Γ Ξ} → Γ ⊩⋆ Ξ → Γ ⊩⋆ Ξ → Set
where
∅ : ∀ {Γ} → ∅ {Γ} ≈⋆ ∅
_,_ : ∀ {Γ Ξ A} → {ρ₁ ρ₂ : Γ ⊩⋆ Ξ} {M₁ M₂ : Γ ⊩ A}
→ (χ : ρ₁ ≈⋆ ρ₂) (p : M₁ ≈ M₂)
→ ρ₁ , M₁ ≈⋆ ρ₂ , M₂
-- (_≈⁻¹)
_⁻¹≈ : ∀ {A Γ} → {a₁ a₂ : Γ ⊩ A}
→ a₁ ≈ a₂
→ a₂ ≈ a₁
_⁻¹≈ {⎵} p = p ⁻¹
_⁻¹≈ {A ⇒ B} F = λ η p u₁ u₂ →
F η (p ⁻¹≈) u₂ u₁ ⁻¹≈
_⁻¹≈ {A ⩕ B} p = proj₁ p ⁻¹≈ , proj₂ p ⁻¹≈
_⁻¹≈ {⫪} p = tt
-- (_≈ᶜ⁻¹)
_⁻¹≈⋆ : ∀ {Γ Ξ} → {ρ₁ ρ₂ : Γ ⊩⋆ Ξ}
→ ρ₁ ≈⋆ ρ₂
→ ρ₂ ≈⋆ ρ₁
∅ ⁻¹≈⋆ = ∅
(χ , p) ⁻¹≈⋆ = χ ⁻¹≈⋆ , p ⁻¹≈
-- (_≈◾_)
_⦙≈_ : ∀ {A Γ} → {a₁ a₂ a₃ : Γ ⊩ A}
→ a₁ ≈ a₂ → a₂ ≈ a₃
→ a₁ ≈ a₃
_⦙≈_ {⎵} p q = p ⦙ q
_⦙≈_ {A ⇒ B} F G = λ η p u₁ u₂ →
F η (p ⦙≈ (p ⁻¹≈)) u₁ u₁
⦙≈ G η p u₁ u₂
_⦙≈_ {A ⩕ B} p q = proj₁ p ⦙≈ proj₁ q , proj₂ p ⦙≈ proj₂ q
_⦙≈_ {⫪} p q = tt
-- (_≈ᶜ◾_)
_⦙≈⋆_ : ∀ {Γ Ξ} → {ρ₁ ρ₂ ρ₃ : Γ ⊩⋆ Ξ}
→ ρ₁ ≈⋆ ρ₂ → ρ₂ ≈⋆ ρ₃
→ ρ₁ ≈⋆ ρ₃
∅ ⦙≈⋆ ∅ = ∅
(χ₁ , p) ⦙≈⋆ (χ₂ , q) = χ₁ ⦙≈⋆ χ₂ , p ⦙≈ q
instance
per≈ : ∀ {Γ A} → PER (Γ ⊩ A) _≈_
per≈ =
record
{ _⁻¹ = _⁻¹≈
; _⦙_ = _⦙≈_
}
instance
per≈⋆ : ∀ {Γ Ξ} → PER (Γ ⊩⋆ Ξ) _≈⋆_
per≈⋆ =
record
{ _⁻¹ = _⁻¹≈⋆
; _⦙_ = _⦙≈⋆_
}
--------------------------------------------------------------------------------
-- (≈ₑ)
acc≈ : ∀ {A Γ Γ′} → {a₁ a₂ : Γ ⊩ A}
→ (η : Γ′ ⊇ Γ) → a₁ ≈ a₂
→ acc η a₁ ≈ acc η a₂
acc≈ {⎵} η p = renⁿᶠ η & p
acc≈ {A ⇒ B} η F = λ η′ → F (η ○ η′)
acc≈ {A ⩕ B} η p = acc≈ η (proj₁ p) , acc≈ η (proj₂ p)
acc≈ {⫪} η p = tt
-- (≈ᶜₑ)
_⬖≈_ : ∀ {Γ Γ′ Ξ} → {ρ₁ ρ₂ : Γ ⊩⋆ Ξ}
→ ρ₁ ≈⋆ ρ₂ → (η : Γ′ ⊇ Γ)
→ ρ₁ ⬖ η ≈⋆ ρ₂ ⬖ η
∅ ⬖≈ η = ∅
(χ , p) ⬖≈ η = χ ⬖≈ η , acc≈ η p
-- (∈≈)
get≈ : ∀ {Γ Ξ A} → {ρ₁ ρ₂ : Γ ⊩⋆ Ξ}
→ ρ₁ ≈⋆ ρ₂ → (i : Ξ ∋ A)
→ getᵥ ρ₁ i ≈ getᵥ ρ₂ i
get≈ (χ , p) zero = p
get≈ (χ , p) (suc i) = get≈ χ i
-- (Tm≈)
eval≈ : ∀ {Γ Ξ A} → {ρ₁ ρ₂ : Γ ⊩⋆ Ξ}
→ ρ₁ ≈⋆ ρ₂ → 𝒰⋆ ρ₁ → 𝒰⋆ ρ₂ → (M : Ξ ⊢ A)
→ eval ρ₁ M ≈ eval ρ₂ M
eval≈ χ υ₁ υ₂ (𝓋 i) = get≈ χ i
eval≈ χ υ₁ υ₂ (ƛ M) = λ η p u₁ u₂ →
eval≈ (χ ⬖≈ η , p)
(υ₁ ⬖𝒰 η , u₁)
(υ₂ ⬖𝒰 η , u₂)
M
eval≈ χ υ₁ υ₂ (M ∙ N) = eval≈ χ υ₁ υ₂ M idₑ
(eval≈ χ υ₁ υ₂ N)
(eval𝒰 υ₁ N)
(eval𝒰 υ₂ N)
eval≈ χ υ₁ υ₂ (M , N) = eval≈ χ υ₁ υ₂ M , eval≈ χ υ₁ υ₂ N
eval≈ χ υ₁ υ₂ (π₁ M) = proj₁ (eval≈ χ υ₁ υ₂ M)
eval≈ χ υ₁ υ₂ (π₂ M) = proj₂ (eval≈ χ υ₁ υ₂ M)
eval≈ χ υ₁ υ₂ τ = tt
--------------------------------------------------------------------------------
-- (Subᴺᴾ)
-- NOTE: _◆𝒰_ = eval𝒰⋆
_◆𝒰_ : ∀ {Γ Ξ Φ} → {ρ : Γ ⊩⋆ Ξ}
→ (σ : Ξ ⊢⋆ Φ) → 𝒰⋆ ρ
→ 𝒰⋆ (σ ◆ ρ)
∅ ◆𝒰 υ = ∅
(σ , M) ◆𝒰 υ = σ ◆𝒰 υ , eval𝒰 υ M
-- (Subᴺ≈ᶜ)
-- NOTE: _◆≈_ = eval≈⋆
_◆≈_ : ∀ {Γ Ξ Φ} → {ρ₁ ρ₂ : Γ ⊩⋆ Ξ}
→ (σ : Ξ ⊢⋆ Φ) → ρ₁ ≈⋆ ρ₂ → 𝒰⋆ ρ₁ → 𝒰⋆ ρ₂
→ σ ◆ ρ₁ ≈⋆ σ ◆ ρ₂
(∅ ◆≈ χ) υ₁ υ₂ = ∅
((σ , M) ◆≈ χ) υ₁ υ₂ = (σ ◆≈ χ) υ₁ υ₂ , eval≈ χ υ₁ υ₂ M
--------------------------------------------------------------------------------
-- (Tmₛᴺ)
eval◆ : ∀ {Γ Ξ Φ A} → {ρ : Γ ⊩⋆ Ξ}
→ ρ ≈⋆ ρ → 𝒰⋆ ρ → (σ : Ξ ⊢⋆ Φ) (M : Φ ⊢ A)
→ eval ρ (sub σ M) ≈ eval (σ ◆ ρ) M
eval◆ {ρ = ρ} χ υ σ (𝓋 i)
rewrite get◆ ρ σ i
= eval≈ χ υ υ (getₛ σ i)
eval◆ {ρ = ρ} χ υ σ (ƛ M) η {a₁} {a₂} p u₁ u₂
rewrite comp◆⬖ η υ σ
= let
υ′ = υ ⬖𝒰 η
in
eval◆ {ρ = ρ ⬖ η , a₁}
((χ ⬖≈ η) , (p ⦙ p ⁻¹))
(υ ⬖𝒰 η , u₁)
(liftₛ σ)
M
⦙ coe ((λ ρ′ → eval (ρ′ , a₁) M ≈ _)
& ( comp◆⬗ (ρ ⬖ η , a₁) (wkₑ idₑ) σ
⦙ (σ ◆_) & lid⬗ (ρ ⬖ η)
) ⁻¹)
(eval≈ ((σ ◆≈ (χ ⬖≈ η)) υ′ υ′ , p)
(σ ◆𝒰 υ′ , u₁)
(σ ◆𝒰 υ′ , u₂)
M)
eval◆ {ρ = ρ} χ υ σ (M ∙ N)
= eval◆ χ υ σ M
idₑ
(eval◆ χ υ σ N)
(eval𝒰 υ (sub σ N))
(eval𝒰 (σ ◆𝒰 υ) N)
eval◆ {ρ = ρ} χ υ σ (M , N) = eval◆ χ υ σ M , eval◆ χ υ σ N
eval◆ {ρ = ρ} χ υ σ (π₁ M) = proj₁ (eval◆ χ υ σ M)
eval◆ {ρ = ρ} χ υ σ (π₂ M) = proj₂ (eval◆ χ υ σ M)
eval◆ {ρ = ρ} χ υ σ τ = tt
--------------------------------------------------------------------------------
-- (~≈)
eval∼ : ∀ {Γ Ξ A} → {ρ₁ ρ₂ : Γ ⊩⋆ Ξ}
→ ρ₁ ≈⋆ ρ₂ → 𝒰⋆ ρ₁ → 𝒰⋆ ρ₂
→ {M₁ M₂ : Ξ ⊢ A}
→ M₁ ∼ M₂
→ eval ρ₁ M₁ ≈ eval ρ₂ M₂
eval∼ χ υ₁ υ₂ {M} refl∼ = eval≈ χ υ₁ υ₂ M
eval∼ χ υ₁ υ₂ (p ⁻¹∼) = eval∼ (χ ⁻¹) υ₂ υ₁ p ⁻¹
eval∼ χ υ₁ υ₂ (p ⦙∼ q) = eval∼ (χ ⦙ χ ⁻¹) υ₁ υ₁ p
⦙ eval∼ χ υ₁ υ₂ q
eval∼ χ υ₁ υ₂ (ƛ∼ p)
= λ η q u₁ u₂ →
eval∼ (χ ⬖≈ η , q)
(υ₁ ⬖𝒰 η , u₁)
(υ₂ ⬖𝒰 η , u₂)
p
eval∼ χ υ₁ υ₂ (_∙∼_ {N₁ = N₁} {N₂} p q)
= eval∼ χ υ₁ υ₂ p
idₑ
(eval∼ χ υ₁ υ₂ q)
(eval𝒰 υ₁ N₁)
(eval𝒰 υ₂ N₂)
eval∼ χ υ₁ υ₂ (p ,∼ q) = eval∼ χ υ₁ υ₂ p , eval∼ χ υ₁ υ₂ q
eval∼ χ υ₁ υ₂ (π₁∼ p ) = proj₁ (eval∼ χ υ₁ υ₂ p)
eval∼ χ υ₁ υ₂ (π₂∼ p ) = proj₂ (eval∼ χ υ₁ υ₂ p)
eval∼ {ρ₁ = ρ₁} {ρ₂} χ υ₁ υ₂ (red⇒ M N)
= coe ((λ ρ₁′ ρ₂′ → eval (ρ₁′ , eval ρ₁ N) M ≈ eval (ρ₂′ , eval ρ₂ N) M)
& (lid⬖ ρ₁ ⁻¹)
⊗ (lid◆ ρ₂ ⁻¹))
(eval≈ (χ , eval≈ χ υ₁ υ₂ N)
(υ₁ , eval𝒰 υ₁ N)
(υ₂ , eval𝒰 υ₂ N)
M)
⦙ eval◆ (χ ⁻¹ ⦙ χ) υ₂ (idₛ , N) M ⁻¹
eval∼ χ υ₁ υ₂ (red⩕₁ M N) = eval≈ χ υ₁ υ₂ M
eval∼ χ υ₁ υ₂ (red⩕₂ M N) = eval≈ χ υ₁ υ₂ N
eval∼ {ρ₂ = ρ₂} χ υ₁ υ₂ (exp⇒ M) η {a₂ = a₂} p u₁ u₂
rewrite eval⬗ (ρ₂ ⬖ η , a₂) (wkₑ idₑ) M ⁻¹
| lid⬗ (ρ₂ ⬖ η)
| eval⬖ η υ₂ M
| rid○ η
= eval≈ χ υ₁ υ₂ M η p u₁ u₂
eval∼ χ υ₁ υ₂ (exp⩕ M) = eval≈ χ υ₁ υ₂ M
eval∼ χ υ₁ υ₂ (exp⫪ M) = tt
--------------------------------------------------------------------------------
mutual
-- (q≈)
reify≈ : ∀ {A Γ} → {a₁ a₂ : Γ ⊩ A}
→ a₁ ≈ a₂
→ reify a₁ ≡ reify a₂
reify≈ {⎵} p = p
reify≈ {A ⇒ B} F = ƛ & reify≈ (F (wkₑ {A = A} idₑ)
(reflect≈ refl)
(reflect𝒰 {A} 0)
(reflect𝒰 {A} 0))
reify≈ {A ⩕ B} p = _,_ & reify≈ (proj₁ p)
⊗ reify≈ (proj₂ p)
reify≈ {⫪} p = refl
-- (u≈)
reflect≈ : ∀ {A Γ} → {M₁ M₂ : Γ ⊢ⁿᵉ A}
→ M₁ ≡ M₂
→ reflect M₁ ≈ reflect M₂
reflect≈ {⎵} p = ne & p
reflect≈ {A ⇒ B} p = λ η q u₁ u₂ →
reflect≈ (_∙_ & (renⁿᵉ η & p)
⊗ reify≈ q)
reflect≈ {A ⩕ B} p = reflect≈ (π₁ & p) , reflect≈ (π₂ & p)
reflect≈ {⫪} p = tt
-- (uᶜ≈)
id≈ : ∀ {Γ} → idᵥ {Γ} ≈⋆ idᵥ
id≈ {∅} = ∅
id≈ {Γ , A} = id≈ ⬖≈ wkₑ idₑ , reflect≈ refl
sound : ∀ {Γ A} → {M₁ M₂ : Γ ⊢ A}
→ M₁ ∼ M₂
→ nf M₁ ≡ nf M₂
sound p = reify≈ (eval∼ id≈ id𝒰 id𝒰 p)
--------------------------------------------------------------------------------
| {
"alphanum_fraction": 0.3078169804,
"avg_line_length": 26.7366666667,
"ext": "agda",
"hexsha": "8e830d3a3330328d95993e2466615c755c157347",
"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": "bd626509948fbf8503ec2e31c1852e1ac6edcc79",
"max_forks_repo_licenses": [
"X11"
],
"max_forks_repo_name": "mietek/coquand-kovacs",
"max_forks_repo_path": "src/STLC1/Kovacs/Soundness.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "bd626509948fbf8503ec2e31c1852e1ac6edcc79",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"X11"
],
"max_issues_repo_name": "mietek/coquand-kovacs",
"max_issues_repo_path": "src/STLC1/Kovacs/Soundness.agda",
"max_line_length": 80,
"max_stars_count": null,
"max_stars_repo_head_hexsha": "bd626509948fbf8503ec2e31c1852e1ac6edcc79",
"max_stars_repo_licenses": [
"X11"
],
"max_stars_repo_name": "mietek/coquand-kovacs",
"max_stars_repo_path": "src/STLC1/Kovacs/Soundness.agda",
"max_stars_repo_stars_event_max_datetime": null,
"max_stars_repo_stars_event_min_datetime": null,
"num_tokens": 4501,
"size": 8021
} |
------------------------------------------------------------------------
-- The Agda standard library
--
-- Decision procedures for finite sets and subsets of finite sets
--
-- This module is DEPRECATED. Please use the Data.Fin.Properties
-- and Data.Fin.Subset.Properties directly.
------------------------------------------------------------------------
{-# OPTIONS --without-K --safe #-}
module Data.Fin.Dec where
open import Data.Fin.Properties public
using (decFinSubset; any?; all?; ¬∀⟶∃¬-smallest; ¬∀⟶∃¬)
open import Data.Fin.Subset.Properties public
using (_∈?_; _⊆?_; nonempty?; anySubset?)
renaming (Lift? to decLift)
| {
"alphanum_fraction": 0.5485893417,
"avg_line_length": 31.9,
"ext": "agda",
"hexsha": "57d48fda9d0aef6f692a88e6b96d13defe2f1a72",
"lang": "Agda",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "0debb886eb5dbcd38dbeebd04b34cf9d9c5e0e71",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "omega12345/agda-mode",
"max_forks_repo_path": "test/asset/agda-stdlib-1.0/Data/Fin/Dec.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "0debb886eb5dbcd38dbeebd04b34cf9d9c5e0e71",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "omega12345/agda-mode",
"max_issues_repo_path": "test/asset/agda-stdlib-1.0/Data/Fin/Dec.agda",
"max_line_length": 72,
"max_stars_count": null,
"max_stars_repo_head_hexsha": "0debb886eb5dbcd38dbeebd04b34cf9d9c5e0e71",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "omega12345/agda-mode",
"max_stars_repo_path": "test/asset/agda-stdlib-1.0/Data/Fin/Dec.agda",
"max_stars_repo_stars_event_max_datetime": null,
"max_stars_repo_stars_event_min_datetime": null,
"num_tokens": 148,
"size": 638
} |
module ial where
open import ial-datatypes public
open import logic public
open import thms public
open import termination public
open import error public
open import io public
| {
"alphanum_fraction": 0.8370786517,
"avg_line_length": 19.7777777778,
"ext": "agda",
"hexsha": "b182d10bc1854e45861b2a58951c7b8abce23c67",
"lang": "Agda",
"max_forks_count": 34,
"max_forks_repo_forks_event_max_datetime": "2022-02-20T18:33:16.000Z",
"max_forks_repo_forks_event_min_datetime": "2018-09-17T11:51:36.000Z",
"max_forks_repo_head_hexsha": "75f72bf2e41ac4042efc3128fa9958d4cd69b947",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "mudathirmahgoub/cedille",
"max_forks_repo_path": "src/ial.agda",
"max_issues_count": 123,
"max_issues_repo_head_hexsha": "75f72bf2e41ac4042efc3128fa9958d4cd69b947",
"max_issues_repo_issues_event_max_datetime": "2022-01-12T03:51:28.000Z",
"max_issues_repo_issues_event_min_datetime": "2018-09-17T10:53:20.000Z",
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "mudathirmahgoub/cedille",
"max_issues_repo_path": "src/ial.agda",
"max_line_length": 32,
"max_stars_count": 328,
"max_stars_repo_head_hexsha": "75f72bf2e41ac4042efc3128fa9958d4cd69b947",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "mudathirmahgoub/cedille",
"max_stars_repo_path": "src/ial.agda",
"max_stars_repo_stars_event_max_datetime": "2022-03-26T10:33:07.000Z",
"max_stars_repo_stars_event_min_datetime": "2018-09-14T20:06:09.000Z",
"num_tokens": 39,
"size": 178
} |
------------------------------------------------------------------------
-- Values
------------------------------------------------------------------------
open import Atom
module Values (atoms : χ-atoms) where
open import Equality.Propositional
open import Prelude hiding (const)
open import Chi atoms
open import Deterministic atoms
open χ-atoms atoms
-- Values.
mutual
infixr 5 _∷_
data Value : Exp → Type where
lambda : ∀ x e → Value (lambda x e)
const : ∀ c {es} → Values es → Value (const c es)
data Values : List Exp → Type where
[] : Values []
_∷_ : ∀ {e es} → Value e → Values es → Values (e ∷ es)
-- Constructor applications.
data Consts : Type where
const : Const → List Consts → Consts
mutual
data Constructor-application : Exp → Type where
const : ∀ c {es} →
Constructor-applications es →
Constructor-application (const c es)
data Constructor-applications : List Exp → Type where
[] : Constructor-applications []
_∷_ : ∀ {e es} →
Constructor-application e → Constructor-applications es →
Constructor-applications (e ∷ es)
-- Constructor applications are values.
mutual
const→value : ∀ {e} → Constructor-application e → Value e
const→value (const c cs) = const c (consts→values cs)
consts→values : ∀ {es} → Constructor-applications es → Values es
consts→values [] = []
consts→values (c ∷ cs) = const→value c ∷ consts→values cs
-- The second argument of _⇓_ is always a Value.
mutual
⇓-Value : ∀ {e v} → e ⇓ v → Value v
⇓-Value (apply _ _ p) = ⇓-Value p
⇓-Value (case _ _ _ p) = ⇓-Value p
⇓-Value (rec p) = ⇓-Value p
⇓-Value lambda = lambda _ _
⇓-Value (const ps) = const _ (⇓⋆-Values ps)
⇓⋆-Values : ∀ {es vs} → es ⇓⋆ vs → Values vs
⇓⋆-Values [] = []
⇓⋆-Values (p ∷ ps) = ⇓-Value p ∷ ⇓⋆-Values ps
mutual
values-compute-to-themselves : ∀ {v} → Value v → v ⇓ v
values-compute-to-themselves (lambda _ _) = lambda
values-compute-to-themselves (const _ ps) =
const (values-compute-to-themselves⋆ ps)
values-compute-to-themselves⋆ : ∀ {vs} → Values vs → vs ⇓⋆ vs
values-compute-to-themselves⋆ [] = []
values-compute-to-themselves⋆ (p ∷ ps) =
values-compute-to-themselves p ∷ values-compute-to-themselves⋆ ps
values-only-compute-to-themselves :
∀ {v₁ v₂} → Value v₁ → v₁ ⇓ v₂ → v₁ ≡ v₂
values-only-compute-to-themselves p q =
⇓-deterministic (values-compute-to-themselves p) q
values-only-compute-to-themselves⋆ :
∀ {vs₁ vs₂} → Values vs₁ → vs₁ ⇓⋆ vs₂ → vs₁ ≡ vs₂
values-only-compute-to-themselves⋆ ps qs =
⇓⋆-deterministic (values-compute-to-themselves⋆ ps) qs
| {
"alphanum_fraction": 0.5975336323,
"avg_line_length": 27.875,
"ext": "agda",
"hexsha": "f560dda2deca2e883320020403faa05040f3efdc",
"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": "30966769b8cbd46aa490b6964a4aa0e67a7f9ab1",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "nad/chi",
"max_forks_repo_path": "src/Values.agda",
"max_issues_count": 1,
"max_issues_repo_head_hexsha": "30966769b8cbd46aa490b6964a4aa0e67a7f9ab1",
"max_issues_repo_issues_event_max_datetime": "2020-06-08T11:08:25.000Z",
"max_issues_repo_issues_event_min_datetime": "2020-05-21T23:29:54.000Z",
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "nad/chi",
"max_issues_repo_path": "src/Values.agda",
"max_line_length": 72,
"max_stars_count": 2,
"max_stars_repo_head_hexsha": "30966769b8cbd46aa490b6964a4aa0e67a7f9ab1",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "nad/chi",
"max_stars_repo_path": "src/Values.agda",
"max_stars_repo_stars_event_max_datetime": "2020-10-20T16:27:00.000Z",
"max_stars_repo_stars_event_min_datetime": "2020-05-21T22:58:07.000Z",
"num_tokens": 856,
"size": 2676
} |
{-# OPTIONS --cubical --no-import-sorts --safe #-}
module Cubical.Algebra.Semigroup.Properties where
open import Cubical.Core.Everything
open import Cubical.Foundations.Prelude
open import Cubical.Foundations.Isomorphism
open import Cubical.Foundations.Function using (_∘_; id)
open import Cubical.Foundations.Equiv
open import Cubical.Foundations.HLevels
open import Cubical.Foundations.Logic using (_≡ₚ_)
open import Cubical.Functions.Embedding
open import Cubical.Data.Nat
open import Cubical.Data.NatPlusOne
open import Cubical.Algebra
open import Cubical.Algebra.Properties
open import Cubical.Algebra.Semigroup.Morphism
open import Cubical.Algebra.Magma.Properties using (isPropIsMagma)
open import Cubical.Relation.Binary
open import Cubical.Relation.Binary.Reasoning.Equality
open import Cubical.HITs.PropositionalTruncation
open import Cubical.Algebra.Semigroup.MorphismProperties public
using (SemigroupPath; uaSemigroup; carac-uaSemigroup; Semigroup≡; caracSemigroup≡)
private
variable
ℓ ℓ′ : Level
isPropIsSemigroup : ∀ {S : Type ℓ} {_•_} → isProp (IsSemigroup S _•_)
isPropIsSemigroup {_} {_} {_•_} (issemigroup aMagma aAssoc) (issemigroup bMagma bAssoc) =
cong₂ issemigroup (isPropIsMagma aMagma bMagma) (isPropAssociative (IsMagma.is-set aMagma) _•_ aAssoc bAssoc)
module SemigroupLemmas (S : Semigroup ℓ) where
open Semigroup S
^-suc : ∀ x n → x ^ suc₊₁ n ≡ x ^ n • x
^-suc x one = refl
^-suc x (2+ n) =
x ^ suc₊₁ (2+ n) ≡⟨⟩
x ^ 1+ suc (suc n) ≡⟨⟩
x • (x • x ^ 1+ n) ≡⟨⟩
x • x ^ suc₊₁ (1+ n) ≡⟨ cong (x •_) (^-suc x (1+ n)) ⟩
x • (x ^ 1+ n • x) ≡˘⟨ assoc x (x ^ 1+ n) x ⟩
x • x ^ 1+ n • x ≡⟨⟩
x ^ 2+ n • x ∎
^-plus : ∀ x → Homomorphic₂ (x ^_) _+₊₁_ _•_
^-plus _ one _ = refl
^-plus x (2+ m) n =
x ^ (1+ (suc m) +₊₁ n) ≡⟨⟩
x • (x ^ (1+ m +₊₁ n)) ≡⟨ cong (x •_) (^-plus x (1+ m) n) ⟩
x • (x ^ 1+ m • x ^ n) ≡˘⟨ assoc x (x ^ 1+ m) (x ^ n) ⟩
x • x ^ 1+ m • x ^ n ≡⟨⟩
x ^ 2+ m • x ^ n ∎
module Kernel {S : Semigroup ℓ} {T : Semigroup ℓ′} (hom : SemigroupHom S T) where
private
module S = Semigroup S
module T = Semigroup T
open SemigroupHom hom renaming (fun to f)
Kernel′ : RawRel ⟨ S ⟩ ℓ′
Kernel′ x y = f x ≡ f y
isPropKernel : isPropValued Kernel′
isPropKernel x y = T.is-set (f x) (f y)
Kernel : Rel ⟨ S ⟩ ℓ′
Kernel = fromRaw Kernel′ isPropKernel
ker-reflexive : Reflexive Kernel
ker-reflexive = refl
ker-fromEq : FromEq Kernel
ker-fromEq = rec (isPropKernel _ _) (cong f)
ker-symmetric : Symmetric Kernel
ker-symmetric = sym
ker-transitive : Transitive Kernel
ker-transitive = _∙_
ker-isPreorder : IsPreorder Kernel
ker-isPreorder = record
{ reflexive = ker-reflexive
; transitive = ker-transitive
}
ker-isPartialEquivalence : IsPartialEquivalence Kernel
ker-isPartialEquivalence = record
{ symmetric = ker-symmetric
; transitive = ker-transitive
}
ker-isEquivalence : IsEquivalence Kernel
ker-isEquivalence = record
{ isPartialEquivalence = ker-isPartialEquivalence
; reflexive = ker-reflexive
}
ker⇒id→emb : Kernel ⇒ _≡ₚ_ → isEmbedding f
ker⇒id→emb ker⇒id = injEmbedding S.is-set T.is-set (λ p → rec (S.is-set _ _) id (ker⇒id p))
emb→ker⇒id : isEmbedding f → Kernel ⇒ _≡ₚ_
emb→ker⇒id isemb {x} {y} = ∣_∣ ∘ invIsEq (isemb x y)
| {
"alphanum_fraction": 0.6538688718,
"avg_line_length": 29.701754386,
"ext": "agda",
"hexsha": "85938894b37d708e3d91428e204b5150c16ff791",
"lang": "Agda",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "737f922d925da0cd9a875cb0c97786179f1f4f61",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "bijan2005/univalent-foundations",
"max_forks_repo_path": "Cubical/Algebra/Semigroup/Properties.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "737f922d925da0cd9a875cb0c97786179f1f4f61",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "bijan2005/univalent-foundations",
"max_issues_repo_path": "Cubical/Algebra/Semigroup/Properties.agda",
"max_line_length": 111,
"max_stars_count": null,
"max_stars_repo_head_hexsha": "737f922d925da0cd9a875cb0c97786179f1f4f61",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "bijan2005/univalent-foundations",
"max_stars_repo_path": "Cubical/Algebra/Semigroup/Properties.agda",
"max_stars_repo_stars_event_max_datetime": null,
"max_stars_repo_stars_event_min_datetime": null,
"num_tokens": 1254,
"size": 3386
} |
{-# OPTIONS --prop #-}
data _≡_ {A : Set} (a : A) : A → Set where
refl : a ≡ a
postulate
funextP : {A : Prop} {B : A → Set} {f g : (a : A) → B a} (h : (x : A) → f x ≡ g x) → f ≡ g
test : {A : Prop} {B : A → Set} {f g : (a : A) → B a} (h : (x : A) → f x ≡ g x) → f ≡ g
test h = funextP h
| {
"alphanum_fraction": 0.4046822742,
"avg_line_length": 27.1818181818,
"ext": "agda",
"hexsha": "959917b76d2067211e62068da39a39be6aa7f916",
"lang": "Agda",
"max_forks_count": 371,
"max_forks_repo_forks_event_max_datetime": "2022-03-30T19:00:30.000Z",
"max_forks_repo_forks_event_min_datetime": "2015-01-03T14:04:08.000Z",
"max_forks_repo_head_hexsha": "231d6ad8e77b67ff8c4b1cb35a6c31ccd988c3e9",
"max_forks_repo_licenses": [
"BSD-3-Clause"
],
"max_forks_repo_name": "Agda-zh/agda",
"max_forks_repo_path": "test/Succeed/Issue4122-yellow.agda",
"max_issues_count": 4066,
"max_issues_repo_head_hexsha": "ed8ac6f4062ea8a20fa0f62d5db82d4e68278338",
"max_issues_repo_issues_event_max_datetime": "2022-03-31T21:14:49.000Z",
"max_issues_repo_issues_event_min_datetime": "2015-01-10T11:24:51.000Z",
"max_issues_repo_licenses": [
"BSD-3-Clause"
],
"max_issues_repo_name": "shlevy/agda",
"max_issues_repo_path": "test/Succeed/Issue4122-yellow.agda",
"max_line_length": 92,
"max_stars_count": 1989,
"max_stars_repo_head_hexsha": "ed8ac6f4062ea8a20fa0f62d5db82d4e68278338",
"max_stars_repo_licenses": [
"BSD-3-Clause"
],
"max_stars_repo_name": "shlevy/agda",
"max_stars_repo_path": "test/Succeed/Issue4122-yellow.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": 147,
"size": 299
} |
------------------------------------------------------------------------------
-- Parametrized preorder reasoning
------------------------------------------------------------------------------
{-# OPTIONS --exact-split #-}
{-# OPTIONS --no-sized-types #-}
{-# OPTIONS --no-universe-polymorphism #-}
{-# OPTIONS --without-K #-}
module Common.Relation.Binary.PreorderReasoning
{D : Set}
(_∼_ : D → D → Set)
(refl : ∀ {x} → x ∼ x)
(trans : ∀ {x y z} → x ∼ y → y ∼ z → x ∼ z)
where
infix 3 _∎
infixr 2 _∼⟨_⟩_
------------------------------------------------------------------------------
-- From (Mu, S.-C., Ko, H.-S. and Jansson, P. (2009)).
--
-- N.B. Unlike Ulf's thesis (and the Agda standard library 0.8.1) this
-- set of combinators do not use a wrapper data type.
_∼⟨_⟩_ : ∀ x {y z} → x ∼ y → y ∼ z → x ∼ z
_ ∼⟨ x∼y ⟩ y∼z = trans x∼y y∼z
_∎ : ∀ x → x ∼ x
_∎ _ = refl
------------------------------------------------------------------------------
-- References
--
-- Mu, S.-C., Ko, H.-S. and Jansson, P. (2009). Algebra of programming
-- in Agda: Dependent types for relational program derivation. Journal
-- of Functional Programming 19.5, pp. 545–579.
| {
"alphanum_fraction": 0.412633306,
"avg_line_length": 32.0789473684,
"ext": "agda",
"hexsha": "b7aac86af89d08b837a8f41e7aaddfb9aaceacd2",
"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/Common/Relation/Binary/PreorderReasoning.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/Common/Relation/Binary/PreorderReasoning.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/Common/Relation/Binary/PreorderReasoning.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": 346,
"size": 1219
} |
{-# OPTIONS --without-K #-}
module SubstLemmas where
open import Level using (Level)
open import Relation.Binary.PropositionalEquality
using (_≡_; refl; sym; trans; subst; cong₂)
open import Data.Nat using (ℕ; _+_; _*_)
------------------------------------------------------------------------------
-- Lemmas about subst (and a couple about trans)
subst-dist :
{a b : Level} {A : Set a} {B : A → Set b}
(f : {x : A} → B x → B x → B x) →
{x₁ x₂ : A} → (x₂≡x₁ : x₂ ≡ x₁) → (v₁ v₂ : B x₂) →
subst B x₂≡x₁ (f v₁ v₂) ≡ f (subst B x₂≡x₁ v₁) (subst B x₂≡x₁ v₂)
subst-dist f refl v₁ v₂ = refl
subst-trans :
{a b : Level} {A : Set a} {B : A → Set b} {x₁ x₂ x₃ : A} →
(x₂≡x₁ : x₂ ≡ x₁) → (x₃≡x₂ : x₃ ≡ x₂) → (v : B x₃) →
subst B x₂≡x₁ (subst B x₃≡x₂ v) ≡ subst B (trans x₃≡x₂ x₂≡x₁) v
subst-trans refl refl v = refl
subst₂+ : {b : Level} {B : ℕ → Set b} {x₁ x₂ x₃ x₄ : ℕ} →
(x₂≡x₁ : x₂ ≡ x₁) → (x₄≡x₃ : x₄ ≡ x₃) → (v₁ : B x₂) → (v₂ : B x₄) →
(f : {x₁ x₂ : ℕ} → B x₁ → B x₂ → B (x₁ + x₂)) →
subst B (cong₂ _+_ x₂≡x₁ x₄≡x₃) (f v₁ v₂) ≡
f (subst B x₂≡x₁ v₁) (subst B x₄≡x₃ v₂)
subst₂+ refl refl v₁ v₂ f = refl
subst₂* : {b : Level} {B : ℕ → Set b} {x₁ x₂ x₃ x₄ : ℕ} →
(x₂≡x₁ : x₂ ≡ x₁) → (x₄≡x₃ : x₄ ≡ x₃) → (v₁ : B x₂) → (v₂ : B x₄) →
(f : {x₁ x₂ : ℕ} → B x₁ → B x₂ → B (x₁ * x₂)) →
subst B (cong₂ _*_ x₂≡x₁ x₄≡x₃) (f v₁ v₂) ≡
f (subst B x₂≡x₁ v₁) (subst B x₄≡x₃ v₂)
subst₂* refl refl v₁ v₂ f = refl
trans-syml : {A : Set} {x y : A} → (p : x ≡ y) → trans (sym p) p ≡ refl
trans-syml refl = refl
trans-symr : {A : Set} {x y : A} → (p : x ≡ y) → trans p (sym p) ≡ refl
trans-symr refl = refl
subst-subst :
{a b : Level} {A : Set a} {B : A → Set b}
{x y : A} → (eq : x ≡ y) → (eq' : y ≡ x) → (irr : sym eq ≡ eq') → (v : B y) →
subst B eq (subst B eq' v) ≡ v
subst-subst refl .refl refl v = refl
| {
"alphanum_fraction": 0.4991869919,
"avg_line_length": 36.1764705882,
"ext": "agda",
"hexsha": "0b9f1c284565ff4bae82b4696351fe1a6c9b4c95",
"lang": "Agda",
"max_forks_count": 3,
"max_forks_repo_forks_event_max_datetime": "2019-09-10T09:47:13.000Z",
"max_forks_repo_forks_event_min_datetime": "2016-05-29T01:56:33.000Z",
"max_forks_repo_head_hexsha": "003835484facfde0b770bc2b3d781b42b76184c1",
"max_forks_repo_licenses": [
"BSD-2-Clause"
],
"max_forks_repo_name": "JacquesCarette/pi-dual",
"max_forks_repo_path": "Univalence/Obsolete/SubstLemmas.agda",
"max_issues_count": 4,
"max_issues_repo_head_hexsha": "003835484facfde0b770bc2b3d781b42b76184c1",
"max_issues_repo_issues_event_max_datetime": "2021-10-29T20:41:23.000Z",
"max_issues_repo_issues_event_min_datetime": "2018-06-07T16:27:41.000Z",
"max_issues_repo_licenses": [
"BSD-2-Clause"
],
"max_issues_repo_name": "JacquesCarette/pi-dual",
"max_issues_repo_path": "Univalence/Obsolete/SubstLemmas.agda",
"max_line_length": 79,
"max_stars_count": 14,
"max_stars_repo_head_hexsha": "003835484facfde0b770bc2b3d781b42b76184c1",
"max_stars_repo_licenses": [
"BSD-2-Clause"
],
"max_stars_repo_name": "JacquesCarette/pi-dual",
"max_stars_repo_path": "Univalence/Obsolete/SubstLemmas.agda",
"max_stars_repo_stars_event_max_datetime": "2021-05-05T01:07:57.000Z",
"max_stars_repo_stars_event_min_datetime": "2015-08-18T21:40:15.000Z",
"num_tokens": 928,
"size": 1845
} |
-- Andreas, 2015-12-29
-- with-clause stripping for record patterns
-- {-# OPTIONS -v tc.with.strip:60 #-}
record R : Set1 where
field
f : Set
test : R → Set1
test record{ f = a } with a
... | x = R
test1 : R → Set1
test1 record{ f = a } with a
test1 record{ f = a } | _ = R
test2 : R → Set1
test2 record{ f = a } with a
test2 record{ f = _ } | _ = R
-- Visible fields may be missing.
test3 : R → Set1
test3 record{ f = a } with a
test3 record{} | _ = R
-- With-clauses may specify more fields than the parent
test4 : R → Set1
test4 record{} with R
test4 record{ f = _ } | _ = R
-- all should pass
| {
"alphanum_fraction": 0.612745098,
"avg_line_length": 18.5454545455,
"ext": "agda",
"hexsha": "60b2af46afb2ae53fbe65897a30f6206c371bafa",
"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/Issue1751.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/Issue1751.agda",
"max_line_length": 55,
"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/Issue1751.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": 214,
"size": 612
} |
{-# OPTIONS --without-K --safe #-}
module TypeTheory.HoTT.Data.Sum.Properties where
-- agda-stdlib
open import Level
open import Data.Empty
open import Data.Product
open import Data.Sum
open import Function.Base
open import Relation.Binary.PropositionalEquality
open import Relation.Nullary
-- agda-misc
open import TypeTheory.HoTT.Base
private
variable
a b : Level
A : Set a
B : Set b
isProp-⊎ : ¬ (A × B) → isProp A → isProp B → isProp (A ⊎ B)
isProp-⊎ ¬[A×B] A-isP B-isP (inj₁ x₁) (inj₁ x₂) = cong inj₁ (A-isP x₁ x₂)
isProp-⊎ ¬[A×B] A-isP B-isP (inj₁ x₁) (inj₂ y₂) = ⊥-elim $ ¬[A×B] (x₁ , y₂)
isProp-⊎ ¬[A×B] A-isP B-isP (inj₂ y₁) (inj₁ x₂) = ⊥-elim $ ¬[A×B] (x₂ , y₁)
isProp-⊎ ¬[A×B] A-isP B-isP (inj₂ y₁) (inj₂ y₂) = cong inj₂ (B-isP y₁ y₂)
| {
"alphanum_fraction": 0.6496732026,
"avg_line_length": 27.3214285714,
"ext": "agda",
"hexsha": "f84ff447909834f882286219dee2a237e3923918",
"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": "37200ea91d34a6603d395d8ac81294068303f577",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "rei1024/agda-misc",
"max_forks_repo_path": "TypeTheory/HoTT/Data/Sum/Properties.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "37200ea91d34a6603d395d8ac81294068303f577",
"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": "rei1024/agda-misc",
"max_issues_repo_path": "TypeTheory/HoTT/Data/Sum/Properties.agda",
"max_line_length": 75,
"max_stars_count": 3,
"max_stars_repo_head_hexsha": "37200ea91d34a6603d395d8ac81294068303f577",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "rei1024/agda-misc",
"max_stars_repo_path": "TypeTheory/HoTT/Data/Sum/Properties.agda",
"max_stars_repo_stars_event_max_datetime": "2020-04-21T00:03:43.000Z",
"max_stars_repo_stars_event_min_datetime": "2020-04-07T17:49:42.000Z",
"num_tokens": 324,
"size": 765
} |
module Proofs where
open import Agda.Builtin.Equality
open import Relation.Binary.PropositionalEquality.Core
open import Data.Nat
open ≡-Reasoning
open import Classes
data Vec : ℕ → Set → Set where
Nil : ∀ {a} → Vec 0 a
Cons : ∀ {n A} → (a : A) → Vec n A → Vec (suc n) A
cons-cong : ∀ {n A} {a c : A} {b d : Vec n A} → a ≡ c → b ≡ d → Cons a b ≡ Cons c d
cons-cong {_} {_} {a} {c} {b} {d} p q = begin
Cons a b ≡⟨ cong (λ x → Cons a x) q ⟩
Cons a d ≡⟨ cong (λ x → Cons x d) p ⟩
Cons c d ∎
instance
VecF : {n : ℕ} → Functor (Vec n)
VecF = record {
fmap = fmap' ;
F-id = id' ;
F-∘ = comp' }
where
fmap' : ∀ {n A B} → (A → B) → Vec n A → Vec n B
fmap' f Nil = Nil
fmap' f (Cons a v) = Cons (f a) (fmap' f v)
id' : ∀ {n A} → (a : Vec n A) → fmap' id a ≡ a
id' Nil = refl
id' (Cons a v) = cong (λ w → Cons a w) (id' v)
comp' : ∀ {n A B C} → (g : B → C) (f : A → B) (a : Vec n A) → fmap' (g ∘ f) a ≡ (fmap' g ∘ fmap' f) a
comp' g f Nil = refl
comp' g f (Cons a v) = cons-cong refl (comp' g f v)
full : ∀ {A} → A → (n : ℕ) → Vec n A
full x zero = Nil
full x (suc n) = Cons x (full x n)
zipWith : ∀ {n A B C} → (A → B → C) → Vec n A → Vec n B → Vec n C
zipWith _ Nil Nil = Nil
zipWith f (Cons a v) (Cons b w) = Cons (f a b) (zipWith f v w)
instance
VecA : {n : ℕ} → Applicative (Vec n)
VecA {n} = record
{ pure = λ x → full x n
; _<*>_ = ap'
; A-id = id'
; A-∘ = comp'
; A-hom = hom'
; A-ic = ic'
}
where
ap' : ∀ {n A B} (v : Vec n (A → B)) (w : Vec n A) → Vec n B
ap' Nil Nil = Nil
ap' (Cons a v) (Cons b w) = Cons (a b) (ap' v w)
id' : ∀ {n A} (v : Vec n A) → ap' (full id n) v ≡ v
id' Nil = refl
id' (Cons a v) = cons-cong refl (id' v)
comp' : ∀ {n A B C} → (u : Vec n (B → C)) (v : Vec n (A → B)) (w : Vec n A)
→ ap' (ap' (ap' (full _∘_ n) u) v) w ≡ ap' u (ap' v w)
comp' Nil Nil Nil = refl
comp' (Cons a u) (Cons b v) (Cons c w) = cons-cong refl (comp' u v w)
hom' : ∀ {n A B} (f : A → B) (x : A) → ap' (full f n) (full x n) ≡ full (f x) n
hom' {zero} f x = refl
hom' {suc n} f x = cons-cong refl (hom' {n} f x)
ic' : ∀ {n A B} (u : Vec n (A → B)) (y : A) → ap' u (full y n) ≡ ap' (full (_$ y) n) u
ic' Nil y = refl
ic' (Cons a u) y = cons-cong refl (ic' u y)
tail : ∀ {n A} → Vec (suc n) A → Vec n A
tail (Cons x v) = v
diag : ∀ {n A} → Vec n (Vec n A) → Vec n A
diag Nil = Nil
diag (Cons (Cons a w) v) = Cons a (diag (fmap tail v))
fmap-pure : ∀ {A B F} {{aF : Applicative F}} (f : A → B) (x : A)
→ fmap f (Applicative.pure aF x) ≡ Applicative.pure aF (f x)
fmap-pure f x = begin
fmap f (pure x) ≡⟨ sym (appFun f (pure x)) ⟩
pure f <*> pure x ≡⟨ A-hom f x ⟩
pure (f x) ∎
diag-full : ∀ {A} (n : ℕ) (v : Vec n A) → diag (full v n) ≡ v
diag-full _ Nil = refl
diag-full (suc n) (Cons a v) = cons-cong refl (begin
diag (fmap tail (full (Cons a v) n)) ≡⟨ cong diag (fmap-pure tail (Cons a v)) ⟩
diag (full v n) ≡⟨ diag-full n v ⟩
v ∎)
instance
VecM : {n : ℕ} → Monad (Vec n)
VecM = record { _>>=_ = bind' ;
left-1 = left' ;
right-1 = {!!} ;
assoc = {!!} }
where
bind' : ∀ {n A B} → Vec n A → (A → Vec n B) → Vec n B
bind' v f = diag (fmap f v)
left' : ∀ {n A B} (a : A) (k : A → Vec n B) → bind' (pure a) k ≡ k a
left' {n} a k = begin
diag (fmap k (full a n)) ≡⟨ cong diag (fmap-pure k a) ⟩
diag (full (k a) n) ≡⟨ diag-full n (k a) ⟩
k a ∎
right' : ∀ {n A} (m : Vec n A) → bind' m pure ≡ m
right' Nil = refl
right' (Cons a m) = begin
bind' (Cons a m) pure ≡⟨ refl ⟩
diag (fmap pure (Cons a m)) ≡⟨ cons-cong refl {!!} ⟩ -- :(
Cons a m ∎
| {
"alphanum_fraction": 0.4563329928,
"avg_line_length": 30.8346456693,
"ext": "agda",
"hexsha": "242472bf2ad9b61901fc002512b5897cfaf4ff13",
"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": "1b019ce3d7b978c369fcc82c97ccafdde8f7fd02",
"max_forks_repo_licenses": [
"BSD-3-Clause"
],
"max_forks_repo_name": "samuelhklumpers/strong-vector",
"max_forks_repo_path": "proofs/Proofs.agda",
"max_issues_count": 3,
"max_issues_repo_head_hexsha": "1b019ce3d7b978c369fcc82c97ccafdde8f7fd02",
"max_issues_repo_issues_event_max_datetime": "2022-03-10T10:24:40.000Z",
"max_issues_repo_issues_event_min_datetime": "2022-03-09T10:24:33.000Z",
"max_issues_repo_licenses": [
"BSD-3-Clause"
],
"max_issues_repo_name": "samuelhklumpers/strong-vector",
"max_issues_repo_path": "proofs/Proofs.agda",
"max_line_length": 107,
"max_stars_count": null,
"max_stars_repo_head_hexsha": "1b019ce3d7b978c369fcc82c97ccafdde8f7fd02",
"max_stars_repo_licenses": [
"BSD-3-Clause"
],
"max_stars_repo_name": "samuelhklumpers/strong-vector",
"max_stars_repo_path": "proofs/Proofs.agda",
"max_stars_repo_stars_event_max_datetime": null,
"max_stars_repo_stars_event_min_datetime": null,
"num_tokens": 1632,
"size": 3916
} |
{-# OPTIONS --without-K #-}
module Model.Term where
open import Cats.Category
open import Model.Size as MS using (_<_ ; ⟦_⟧Δ ; ⟦_⟧n ; ⟦_⟧σ)
open import Model.Type as MT
open import Util.HoTT.Equiv
open import Util.Prelude hiding (id ; _∘_ ; _×_)
open import Source.Size as SS using (v0 ; v1 ; ⋆)
open import Source.Size.Substitution.Theory
open import Source.Size.Substitution.Universe as SU using (Sub⊢ᵤ)
open import Source.Term
import Model.RGraph as RG
import Source.Type as ST
open Category._≅_
open MS.Size
open MS._<_
open MS._≤_
open RG._⇒_
open SS.Size
open SS.Ctx
open ST.Ctx
⟦_⟧x : ∀ {Δ Γ x T}
→ Δ , Γ ⊢ₓ x ∶ T
→ ⟦ Γ ⟧Γ ⇒ ⟦ T ⟧T
⟦_⟧x {Γ = Γ ∙ T} zero = π₂ ⟦ Γ ⟧Γ
⟦ suc {U = U} x ⟧x = ⟦ x ⟧x ∘ π₁ ⟦ U ⟧T
⟦abs⟧ : ∀ Δ (Γ : ST.Ctx Δ) T U
→ ⟦ Γ ∙ T ⟧Γ ⇒ ⟦ U ⟧T
→ ⟦ Γ ⟧Γ ⇒ ⟦ T ⟧T ↝ ⟦ U ⟧T
⟦abs⟧ Δ Γ T U t = curry ⟦ Γ ⟧Γ ⟦ T ⟧T ⟦ U ⟧T t
⟦app⟧ : ∀ Δ (Γ : ST.Ctx Δ) T U
→ ⟦ Γ ⟧Γ ⇒ ⟦ T ⟧T ↝ ⟦ U ⟧T
→ ⟦ Γ ⟧Γ ⇒ ⟦ T ⟧T
→ ⟦ Γ ⟧Γ ⇒ ⟦ U ⟧T
⟦app⟧ Δ Γ T U t u = eval ⟦ T ⟧T ⟦ U ⟧T ∘ ⟨ t , u ⟩
⟦absₛ⟧ : ∀ Δ n (Γ : ST.Ctx Δ) (T : ST.Type (Δ ∙ n))
→ ⟦ Γ [ SU.Wk ]ᵤ ⟧Γ ⇒ ⟦ T ⟧T
→ ⟦ Γ ⟧Γ ⇒ ⟦ ST.Π n , T ⟧T
⟦absₛ⟧ Δ n Γ T t = MT.absₛ (t ∘ ⟦subΓ⟧ SU.Wk Γ .back)
⟦appₛ⟧ : ∀ Δ m n (Γ : ST.Ctx Δ) T
→ ⟦ Γ ⟧Γ ⇒ ⟦ ST.Π n , T ⟧T
→ m SS.< n
→ ⟦ Γ ⟧Γ ⇒ ⟦ T [ SU.Sing m ]ᵤ ⟧T
⟦appₛ⟧ Δ m n Γ T t m<n = ⟦subT⟧ (SU.Sing m<n) T .back ∘ MT.appₛ m<n t
⟦zero⟧ : ∀ Δ (Γ : ST.Ctx Δ) n
→ ⟦ Γ ⟧Γ ⇒ ⟦ ST.Nat n ⟧T
⟦zero⟧ Δ Γ n = record
{ fobj = λ {δ} γ → zero≤ (⟦ n ⟧n .fobj δ)
; feq = λ δ≈δ′ x≈y → refl
}
⟦suc⟧ : ∀ Δ (Γ : ST.Ctx Δ) {m n}
→ m SS.< n
→ ⟦ Γ ⟧Γ ⇒ ⟦ ST.Nat m ⟧T
→ ⟦ Γ ⟧Γ ⇒ ⟦ ST.Nat n ⟧T
⟦suc⟧ Δ Γ m<n i = record
{ fobj = λ γ → suc≤ _ _ (MS.⟦<⟧ m<n) (i .fobj γ)
; feq = λ δ≈δ′ x≈y → cong suc (i .feq _ x≈y)
}
⟦caseNat⟧ : ∀ Δ (Γ : ST.Ctx Δ) n T
→ ⟦ Γ ⟧Γ ⇒ ⟦ ST.Nat n ⟧T
→ ⟦ Γ ⟧Γ ⇒ ⟦ T ⟧T
→ ⟦ Γ ⟧Γ ⇒ ⟦ ST.Π n , ST.Nat v0 ST.⇒ T [ SU.Wk ]ᵤ ⟧T
→ ⟦ Γ ⟧Γ ⇒ ⟦ T ⟧T
⟦caseNat⟧ Δ Γ n T i z s = record
{ fobj = λ γ → caseℕ≤ (i .fobj γ) (z .fobj γ)
λ m m<n i
→ ⟦subT⟧ SU.Wk T .forth .fobj
(s .fobj γ .arr m m<n .fobj i)
; feq = λ {δ δ′} δ≈δ′ {γ γ′} γ≈γ′
→ caseℕ≤-pres (⟦ T ⟧T .eq δ≈δ′) (i .fobj γ) (i .fobj γ′)
(z .fobj γ) (z .fobj γ′) _ _ (i .feq _ γ≈γ′)
(z .feq _ γ≈γ′)
λ m m<n m′ m′<n′ j j′ j≡j′
→ ⟦subT⟧ SU.Wk T .forth .feq _
(s .feq _ γ≈γ′ m m<n m′ m′<n′ j≡j′)
}
⟦cons⟧ : ∀ Δ (Γ : ST.Ctx Δ) n
→ ⟦ Γ ⟧Γ ⇒ ⟦ ST.Nat ∞ ⟧T
→ ⟦ Γ ⟧Γ ⇒ ⟦ ST.Π n , ST.Stream v0 ⟧T
→ ⟦ Γ ⟧Γ ⇒ ⟦ ST.Stream n ⟧T
⟦cons⟧ Δ Γ n i is = record
{ fobj = λ γ → MT.cons (i .fobj γ .proj₁) (is .fobj γ .arr)
; feq = λ δ≈δ′ γ≈γ′ k k≤nδ k≤nδ′
→ cons-≡⁺ (i .feq _ γ≈γ′)
(λ m m<n m<n′ k k≤m → is .feq _ γ≈γ′ m m<n m m<n′ k k≤m k≤m)
k k≤nδ k≤nδ′
}
⟦head⟧ : ∀ Δ (Γ : ST.Ctx Δ) n
→ ⟦ Γ ⟧Γ ⇒ ⟦ ST.Stream n ⟧T
→ ⟦ Γ ⟧Γ ⇒ ⟦ ST.Nat ∞ ⟧T
⟦head⟧ Δ Γ n is = record
{ fobj = λ γ → MT.head (is .fobj γ) , MS.<→≤ MS.zero<∞
; feq = λ δ≈δ′ γ≈γ′ → head-≡⁺ (is .feq _ γ≈γ′)
}
⟦tail⟧ : ∀ Δ (Γ : ST.Ctx Δ) {m n}
→ m SS.< n
→ ⟦ Γ ⟧Γ ⇒ ⟦ ST.Stream n ⟧T
→ ⟦ Γ ⟧Γ ⇒ ⟦ ST.Stream m ⟧T
⟦tail⟧ Δ Γ m<n is = record
{ fobj = λ γ → MT.tail (is .fobj γ) _ (MS.⟦<⟧ m<n)
; feq = λ δ≈δ′ γ≈γ′ i i≤mδ i≤mδ′
→ tail-≡⁺ (is .feq _ γ≈γ′) _ _ (MS.⟦<⟧ m<n) (MS.⟦<⟧ m<n) i i≤mδ i≤mδ′
}
⟦fix⟧ : ∀ Δ (Γ : ST.Ctx Δ) n T
→ n SS.< ⋆
→ ⟦ Γ ⟧Γ ⇒ ⟦ ST.Π ⋆ , (ST.Π v0 , T [ SU.Skip ]ᵤ) ST.⇒ T ⟧T
→ ⟦ Γ ⟧Γ ⇒ ⟦ T [ SU.Sing n ]ᵤ ⟧T
⟦fix⟧ Δ Γ n T n<⋆ t = ⟦subT⟧ (SU.Sing n<⋆) T .back ∘ term⇒
module ⟦fix⟧ where
go
: Σ[ f ∈ (∀ n n<⋆ δ → ⟦ Γ ⟧Γ .Obj δ → ⟦ T ⟧T .Obj (δ , n , n<⋆)) ]
Σ[ f-param ∈ (∀ n n′ n<⋆ n′<⋆ δ δ′ (γ : ⟦ Γ ⟧Γ .Obj δ) (γ′ : ⟦ Γ ⟧Γ .Obj δ′)
→ ⟦ Γ ⟧Γ .eq _ γ γ′ → ⟦ T ⟧T .eq _ (f n n<⋆ δ γ) (f n′ n′<⋆ δ′ γ′)) ]
(∀ {n} → f n ≡ _)
go = MS.<-indΣ′
(λ n → ∀ n<⋆ δ (γ : ⟦ Γ ⟧Γ .Obj δ) → ⟦ T ⟧T .Obj (δ , n , n<⋆))
(λ n m f g → ∀ n<⋆ m<⋆ δ δ′ γ γ′ (γ≈γ′ : ⟦ Γ ⟧Γ .eq _ γ γ′)
→ ⟦ T ⟧T .eq _ (f n<⋆ δ γ) (g m<⋆ δ′ γ′))
(λ n rec rec-resp n<⋆ δ γ
→ t .fobj γ .arr n n<⋆ .fobj
(⟦∀⟧′-resp-≈⟦Type⟧ (⟦subT⟧ SU.Skip T) .back record
{ arr = λ m m<n → rec m m<n (MS.<-trans m<n n<⋆) δ γ
; param = λ m m<n m′ m′<n
→ rec-resp m m<n m′ m′<n _ _ δ δ γ γ (⟦ Γ ⟧Γ .eq-refl γ)
}))
λ n g g-resp m h h-resp g≈h n<⋆ m<⋆ δ δ′ γ γ′ γ≈γ′
→ t .feq _ γ≈γ′ n n<⋆ m m<⋆ λ k k<n k′ k′<m
→ ⟦subT⟧ SU.Skip T .back .feq _
(g≈h k k<n k′ k′<m _ _ δ δ′ γ γ′ γ≈γ′)
term : ∀ n n<⋆ δ → ⟦ Γ ⟧Γ .Obj δ → ⟦ T ⟧T .Obj (δ , n , n<⋆)
term = go .proj₁
term-param : ∀ n n′ n<⋆ n′<⋆ δ δ′ (γ : ⟦ Γ ⟧Γ .Obj δ) (γ′ : ⟦ Γ ⟧Γ .Obj δ′)
→ ⟦ Γ ⟧Γ .eq _ γ γ′
→ ⟦ T ⟧T .eq _ (term n n<⋆ δ γ) (term n′ n′<⋆ δ′ γ′)
term-param = go .proj₂ .proj₁
term⇒ : ⟦ Γ ⟧Γ ⇒ subT ⟦ SU.Sing n<⋆ ⟧σ ⟦ T ⟧T
term⇒ = record
{ fobj = term _ _ _
; feq = λ δ≈δ′ → term-param _ _ _ _ _ _ _ _
}
term-unfold₀ : ∀ {n}
→ term n
≡ λ n<⋆ δ γ → t .fobj γ .arr n n<⋆ .fobj
(⟦∀⟧′-resp-≈⟦Type⟧ (⟦subT⟧ SU.Skip T) .back record
{ arr = λ m m<n → term m (MS.<-trans m<n n<⋆) δ γ
; param = λ m m<n m′ m′<n
→ term-param _ _ _ _ _ _ _ _ (⟦ Γ ⟧Γ .eq-refl γ)
})
term-unfold₀ = go .proj₂ .proj₂
term-unfold : ∀ {n n<⋆ δ γ}
→ term n n<⋆ δ γ
≡ t .fobj γ .arr n n<⋆ .fobj
(⟦∀⟧′-resp-≈⟦Type⟧ (⟦subT⟧ SU.Skip T) .back record
{ arr = λ m m<n → term m (MS.<-trans m<n n<⋆) δ γ
; param = λ m m<n m′ m′<n
→ term-param _ _ _ _ _ _ _ _ (⟦ Γ ⟧Γ .eq-refl γ)
})
term-unfold {n} {n<⋆} {δ} {γ} = cong (λ f → f n<⋆ δ γ) term-unfold₀
⟦_⟧t : ∀ {Δ Γ t T}
→ Δ , Γ ⊢ t ∶ T
→ ⟦ Γ ⟧Γ ⇒ ⟦ T ⟧T
⟦ var ⊢x ⟧t = ⟦ ⊢x ⟧x
⟦ abs {Δ = Δ} {Γ} {T} {t} {U} ⊢t ⟧t = ⟦abs⟧ Δ Γ T U ⟦ ⊢t ⟧t
⟦ app {Δ} {Γ} {T = T} {U = U} ⊢t ⊢u ⟧t = ⟦app⟧ Δ Γ T U ⟦ ⊢t ⟧t ⟦ ⊢u ⟧t
⟦ absₛ {Δ} {n} {T = T} ⊢t refl ⟧t = ⟦absₛ⟧ Δ n _ T ⟦ ⊢t ⟧t
⟦ appₛ {Δ} {m} {n} {Γ} {T = T} m<n ⊢t refl ⟧t = ⟦appₛ⟧ Δ m n Γ T ⟦ ⊢t ⟧t m<n
⟦ zero {Δ} {n} {Γ} n<⋆ ⟧t = ⟦zero⟧ Δ Γ n
⟦ suc {Δ} {Γ = Γ} n<⋆ m<n ⊢i ⟧t = ⟦suc⟧ Δ Γ m<n ⟦ ⊢i ⟧t
⟦ cons {Δ} {n} {Γ} n<⋆ ⊢i ⊢is ⟧t = ⟦cons⟧ Δ Γ n ⟦ ⊢i ⟧t ⟦ ⊢is ⟧t
⟦ head {Δ} {n} {Γ} n<⋆ ⊢is ⟧t = ⟦head⟧ Δ Γ n ⟦ ⊢is ⟧t
⟦ tail {Δ} {n} {m} {Γ} n<⋆ m<n ⊢is ⟧t = ⟦tail⟧ Δ Γ m<n ⟦ ⊢is ⟧t
⟦ caseNat {Δ} {n} {Γ} {T = T} n<⋆ ⊢i ⊢z ⊢s refl ⟧t
= ⟦caseNat⟧ Δ Γ n T ⟦ ⊢i ⟧t ⟦ ⊢z ⟧t ⟦ ⊢s ⟧t
⟦ fix {Δ} {n} {Γ} {T = T} n<⋆ ⊢t refl refl ⟧t
= ⟦fix⟧ Δ Γ n T n<⋆ ⟦ ⊢t ⟧t
⟦_⟧ν : ∀ {Δ} {Γ Ψ : ST.Ctx Δ} {ν} → ν ∶ Γ ⇛ Ψ → ⟦ Γ ⟧Γ ⇒ ⟦ Ψ ⟧Γ
⟦ [] ⟧ν = ! _
⟦ Snoc ⊢ν ⊢t ⟧ν = ⟨ ⟦ ⊢ν ⟧ν , ⟦ ⊢t ⟧t ⟩
| {
"alphanum_fraction": 0.4089958159,
"avg_line_length": 30.9814814815,
"ext": "agda",
"hexsha": "a3ede21980057aff9a36a7724df6ce55cc9ff09e",
"lang": "Agda",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "104cddc6b65386c7e121c13db417aebfd4b7a863",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "JLimperg/msc-thesis-code",
"max_forks_repo_path": "src/Model/Term.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "104cddc6b65386c7e121c13db417aebfd4b7a863",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "JLimperg/msc-thesis-code",
"max_issues_repo_path": "src/Model/Term.agda",
"max_line_length": 84,
"max_stars_count": 5,
"max_stars_repo_head_hexsha": "104cddc6b65386c7e121c13db417aebfd4b7a863",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "JLimperg/msc-thesis-code",
"max_stars_repo_path": "src/Model/Term.agda",
"max_stars_repo_stars_event_max_datetime": "2021-06-26T06:37:31.000Z",
"max_stars_repo_stars_event_min_datetime": "2021-04-13T21:31:17.000Z",
"num_tokens": 3976,
"size": 6692
} |
------------------------------------------------------------------------------
-- Co-inductive natural numbers
------------------------------------------------------------------------------
{-# OPTIONS --exact-split #-}
{-# OPTIONS --no-sized-types #-}
{-# OPTIONS --no-universe-polymorphism #-}
{-# OPTIONS --without-K #-}
module FOTC.Data.Conat where
open import FOTC.Base
open import FOTC.Data.Conat.Type public
------------------------------------------------------------------------------
postulate
∞ : D
∞-eq : ∞ ≡ succ₁ ∞
{-# ATP axiom ∞-eq #-}
| {
"alphanum_fraction": 0.3438538206,
"avg_line_length": 28.6666666667,
"ext": "agda",
"hexsha": "9d035f3509db48a06050c1b21b97f73051e83f43",
"lang": "Agda",
"max_forks_count": 3,
"max_forks_repo_forks_event_max_datetime": "2018-03-14T08:50:00.000Z",
"max_forks_repo_forks_event_min_datetime": "2016-09-19T14:18:30.000Z",
"max_forks_repo_head_hexsha": "2fc9f2b81052a2e0822669f02036c5750371b72d",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "asr/fotc",
"max_forks_repo_path": "src/fot/FOTC/Data/Conat.agda",
"max_issues_count": 2,
"max_issues_repo_head_hexsha": "2fc9f2b81052a2e0822669f02036c5750371b72d",
"max_issues_repo_issues_event_max_datetime": "2017-01-01T14:34:26.000Z",
"max_issues_repo_issues_event_min_datetime": "2016-10-12T17:28:16.000Z",
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "asr/fotc",
"max_issues_repo_path": "src/fot/FOTC/Data/Conat.agda",
"max_line_length": 78,
"max_stars_count": 11,
"max_stars_repo_head_hexsha": "2fc9f2b81052a2e0822669f02036c5750371b72d",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "asr/fotc",
"max_stars_repo_path": "src/fot/FOTC/Data/Conat.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": 105,
"size": 602
} |
------------------------------------------------------------------------
-- The Agda standard library
--
-- An equality postulate which evaluates
------------------------------------------------------------------------
module Relation.Binary.PropositionalEquality.TrustMe where
open import Relation.Binary.PropositionalEquality
private
primitive
primTrustMe : ∀ {a} {A : Set a} {x y : A} → x ≡ y
-- trustMe {x = x} {y = y} evaluates to refl if x and y are
-- definitionally equal.
--
-- For an example of the use of trustMe, see Data.String._≟_.
trustMe : ∀ {a} {A : Set a} {x y : A} → x ≡ y
trustMe = primTrustMe
| {
"alphanum_fraction": 0.5232744783,
"avg_line_length": 28.3181818182,
"ext": "agda",
"hexsha": "5c85b4645cb030e3428d078201bda12103ea437c",
"lang": "Agda",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "9d4c43b1609d3f085636376fdca73093481ab882",
"max_forks_repo_licenses": [
"Apache-2.0"
],
"max_forks_repo_name": "qwe2/try-agda",
"max_forks_repo_path": "agda-stdlib-0.9/src/Relation/Binary/PropositionalEquality/TrustMe.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "9d4c43b1609d3f085636376fdca73093481ab882",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"Apache-2.0"
],
"max_issues_repo_name": "qwe2/try-agda",
"max_issues_repo_path": "agda-stdlib-0.9/src/Relation/Binary/PropositionalEquality/TrustMe.agda",
"max_line_length": 72,
"max_stars_count": 1,
"max_stars_repo_head_hexsha": "9d4c43b1609d3f085636376fdca73093481ab882",
"max_stars_repo_licenses": [
"Apache-2.0"
],
"max_stars_repo_name": "qwe2/try-agda",
"max_stars_repo_path": "agda-stdlib-0.9/src/Relation/Binary/PropositionalEquality/TrustMe.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": 151,
"size": 623
} |
{-# OPTIONS --safe #-}
module Cubical.Categories.Instances.Semilattice where
open import Cubical.Foundations.Prelude
open import Cubical.Algebra.Semilattice
open import Cubical.Categories.Category
open import Cubical.Categories.Instances.Poset
open Category
module _ {ℓ} (L : Semilattice ℓ) where
-- more convenient than working with meet-semilattices
-- as joins are limits
open JoinSemilattice L
SemilatticeCategory : Category ℓ ℓ
SemilatticeCategory = PosetCategory IndPoset
| {
"alphanum_fraction": 0.7955465587,
"avg_line_length": 24.7,
"ext": "agda",
"hexsha": "61c03c677dbaf2646a7af0987547a06948de1285",
"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": "9f9ad9dad7404c75cf457f81ba5ac269afe1b1a7",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "lpw25/cubical",
"max_forks_repo_path": "Cubical/Categories/Instances/Semilattice.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "9f9ad9dad7404c75cf457f81ba5ac269afe1b1a7",
"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": "lpw25/cubical",
"max_issues_repo_path": "Cubical/Categories/Instances/Semilattice.agda",
"max_line_length": 56,
"max_stars_count": null,
"max_stars_repo_head_hexsha": "9f9ad9dad7404c75cf457f81ba5ac269afe1b1a7",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "lpw25/cubical",
"max_stars_repo_path": "Cubical/Categories/Instances/Semilattice.agda",
"max_stars_repo_stars_event_max_datetime": null,
"max_stars_repo_stars_event_min_datetime": null,
"num_tokens": 128,
"size": 494
} |
{-# OPTIONS --warning=error --safe --without-K #-}
open import LogicalFormulae
open import Agda.Primitive using (Level; lzero; lsuc; _⊔_)
open import Functions.Definition
open import Setoids.Setoids
open import Setoids.Subset
open import Graphs.Definition
open import Sets.FinSet.Definition
open import Sets.FinSet.Lemmas
open import Numbers.Naturals.Semiring
open import Sets.EquivalenceRelations
module Graphs.PathGraph where
nNotSucc : {n : ℕ} → (n ≡ succ n) → False
nNotSucc {zero} ()
nNotSucc {succ n} pr = nNotSucc (succInjective pr)
PathGraph : (n : ℕ) → Graph _ (reflSetoid (FinSet (succ n)))
Graph._<->_ (PathGraph n) x y = (toNat x ≡ succ (toNat y)) || (toNat y ≡ succ (toNat x))
Graph.noSelfRelation (PathGraph n) x (inl bad) = nNotSucc bad
Graph.noSelfRelation (PathGraph n) x (inr bad) = nNotSucc bad
Graph.symmetric (PathGraph n) (inl x) = inr x
Graph.symmetric (PathGraph n) (inr x) = inl x
Graph.wellDefined (PathGraph n) refl refl i = i
| {
"alphanum_fraction": 0.735908142,
"avg_line_length": 35.4814814815,
"ext": "agda",
"hexsha": "2fd0a393fb0e200bbd1c1853a94bcd299233a4d4",
"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": "Graphs/PathGraph.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": "Graphs/PathGraph.agda",
"max_line_length": 88,
"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": "Graphs/PathGraph.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": 312,
"size": 958
} |
-- Care needs to be taken to distinguish between instance solutions with and
-- without leftover constraints.
module _ where
_∘_ : ∀ {A B C : Set} → (B → C) → (A → B) → A → C
(f ∘ g) x = f (g x)
postulate
Functor : (Set → Set) → Set₁
fmap : ∀ {F} {{_ : Functor F}} {A B} → (A → B) → F A → F B
List : Set → Set
map : ∀ {A B} → (A → B) → List A → List B
Term : Set
Arg : Set → Set
instance FunArg : Functor Arg
postulate
SafeTerm : Set
safe-term : SafeTerm → Term
DeBruijn : Set → Set₁
weaken : ∀ {A} {{_ : DeBruijn A}} → A → A
instance
DBTerm : DeBruijn Term
DBArg : ∀ {A} {{_ : DeBruijn A}} → DeBruijn (Arg A)
toArgs : List (Arg SafeTerm) → List (Arg Term)
toArgs = map (weaken ∘ fmap safe-term)
| {
"alphanum_fraction": 0.5741496599,
"avg_line_length": 24.5,
"ext": "agda",
"hexsha": "66acf1b683ad2ae1288669bb857a66ed2bdf3854",
"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/Issue2025.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/Issue2025.agda",
"max_line_length": 76,
"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/Issue2025.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": 276,
"size": 735
} |
-- There was a problem with reordering telescopes.
module Issue234 where
postulate
A : Set
P : A → Set
data List : Set where
_∷ : A → List
data _≅_ {x : A}(p : P x) : ∀ {y} → P y → Set where
refl : p ≅ p
data _≡_ (x : A) : A → Set where
refl : x ≡ x
data Any (x : A) : Set where
here : P x → Any x
it : ∀ {x : A} → Any x → A
it {x} (here _) = x
prf : ∀ {x : A}(p : Any x) → P (it p)
prf (here px) = px
foo : (x : A) (p : Any x) →
(f : ∀ {y} → it p ≡ y → P y) →
f refl ≅ prf p →
Set₁
foo x (here ._) f refl = Set
| {
"alphanum_fraction": 0.4872727273,
"avg_line_length": 17.7419354839,
"ext": "agda",
"hexsha": "8148604431638cec72c8817668b87256c47c9eb0",
"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/Issue234.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/Issue234.agda",
"max_line_length": 51,
"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/Issue234.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": 238,
"size": 550
} |
{-# OPTIONS --without-K #-}
open import HoTT
module lib.Quaternions where
data Sign : Type₀ where
plus : Sign
minus : Sign
opposite : Sign → Sign
opposite plus = minus
opposite minus = plus
_·_ : Sign → Sign → Sign
plus · x = x
minus · x = opposite x
·unitr : (x : Sign) → x · plus == x
·unitr plus = idp
·unitr minus = idp
·assoc : (x y z : Sign) → (x · y) · z == x · (y · z)
·assoc plus y z = idp
·assoc minus plus z = idp
·assoc minus minus plus = idp
·assoc minus minus minus = idp
·cohl : {x y : Sign} → x == y → (z : Sign) → x · z == y · z
·cohl idp z = idp
·cohr : (x : Sign) → {y z : Sign} → y == z → x · y == x · z
·cohr x idp = idp
·comm : (x y : Sign) → x · y == y · x
·comm plus plus = idp
·comm plus minus = idp
·comm minus plus = idp
·comm minus minus = idp
data Dir : Type₀ where
i : Dir
j : Dir
k : Dir
shift : Dir → Dir
shift i = j
shift j = k
shift k = i
data QU : Type₀ where
one : QU
dir : Dir → QU
Q : Type₀
Q = Σ Sign λ _ → QU
multWithSign : Dir → Dir → Q
multWithSign i i = minus , one
multWithSign i j = plus , dir k
multWithSign i k = minus , dir j
multWithSign j i = minus , dir k
multWithSign j j = minus , one
multWithSign j k = plus , dir i
multWithSign k i = plus , dir j
multWithSign k j = minus , dir i
multWithSign k k = minus , one
_⊙_ : Q → Q → Q
(s , one) ⊙ (t , u) = s · t , u
(s , dir d) ⊙ (t , one) = s · t , dir d
(s , dir d) ⊙ (t , dir e) with multWithSign d e
... | (x , u) = (s · t) · x , u
inv : Q → Q
inv (x , one) = x , one
inv (x , dir d) = opposite x , dir d
unitl : (a : Q) → (plus , one) ⊙ a == a
unitl (x , u) = idp
unitr : (a : Q) → a ⊙ (plus , one) == a
unitr (x , one) = pair×= (·unitr x) idp
unitr (x , dir d) = pair×= (·unitr x) idp
assoc : (a b c : Q) → (a ⊙ b) ⊙ c == a ⊙ (b ⊙ c)
assoc (x , one) (y , one) (z , w) = pair×= (·assoc x y z) idp
assoc (x , one) (y , dir d) (z , one) = pair×= (·assoc x y z) idp
assoc (x , one) (y , dir d) (z , dir e) with multWithSign d e
... | (w , u) = pair×= lemma idp
where
lemma : ((x · y) · z) · w == x · ((y · z) · w)
lemma = ((x · y) · z) · w =⟨ ·assoc (x · y) z w ⟩
(x · y) · (z · w) =⟨ ·assoc x y (z · w) ⟩
x · (y · (z · w)) =⟨ ·cohr x (! (·assoc y z w)) ⟩
x · ((y · z) · w) ∎
assoc (x , dir d) (y , one) (z , one) = pair×= (·assoc x y z) idp
assoc (x , dir d) (y , one) (z , dir f) with multWithSign d f
... | (w , u) = pair×= lemma idp
where
lemma : ((x · y) · z) · w == (x · (y · z)) · w
lemma = ((x · y) · z) · w =⟨ ·cohl (·assoc x y z) w ⟩
(x · (y · z)) · w ∎
assoc (x , dir d) (y , dir e) (z , one) with multWithSign d e
assoc (x , dir d) (y , dir e) (z , one) | (w , one) = pair×= lemma idp
where
lemma : ((x · y) · w) · z == (x · (y · z)) · w
lemma = ((x · y) · w) · z =⟨ ·assoc (x · y) w z ⟩
(x · y) · (w · z) =⟨ ·cohr (x · y) (·comm w z) ⟩
(x · y) · (z · w) =⟨ ! (·assoc (x · y) z w) ⟩
((x · y) · z) · w =⟨ ·cohl (·assoc x y z) w ⟩
(x · (y · z)) · w ∎
assoc (x , dir d) (y , dir e) (z , one) | (w , dir g) = pair×= lemma idp
where
lemma : ((x · y) · w) · z == (x · (y · z)) · w
lemma = ((x · y) · w) · z =⟨ ·assoc (x · y) w z ⟩
(x · y) · (w · z) =⟨ ·cohr (x · y) (·comm w z) ⟩
(x · y) · (z · w) =⟨ ! (·assoc (x · y) z w) ⟩
((x · y) · z) · w =⟨ ·cohl (·assoc x y z) w ⟩
(x · (y · z)) · w ∎
assoc (x , dir d) (y , dir e) (z , dir f) with multWithSign d e | multWithSign e f
assoc (x , dir d) (y , dir e) (z , dir f) | a , one | b , v = {!!}
assoc (x₁ , dir d) (y , dir e) (z , dir f) | a , dir x | b , v = {!!}
| {
"alphanum_fraction": 0.4552360282,
"avg_line_length": 29.7258064516,
"ext": "agda",
"hexsha": "44bd212a839c42baf4cdd0a727a68d755c25599b",
"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": "f8fa68bf753d64d7f45556ca09d0da7976709afa",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "UlrikBuchholtz/HoTT-Agda",
"max_forks_repo_path": "lib/Quaternions.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "f8fa68bf753d64d7f45556ca09d0da7976709afa",
"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": "UlrikBuchholtz/HoTT-Agda",
"max_issues_repo_path": "lib/Quaternions.agda",
"max_line_length": 82,
"max_stars_count": null,
"max_stars_repo_head_hexsha": "f8fa68bf753d64d7f45556ca09d0da7976709afa",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "UlrikBuchholtz/HoTT-Agda",
"max_stars_repo_path": "lib/Quaternions.agda",
"max_stars_repo_stars_event_max_datetime": null,
"max_stars_repo_stars_event_min_datetime": null,
"num_tokens": 1607,
"size": 3686
} |
open import SOAS.Metatheory.Syntax
-- Initial (⅀, 𝔛)-meta-algebra 𝕋 𝔛 is the free ⅀-monoid on 𝔛
module SOAS.Metatheory.FreeMonoid {T : Set} (Syn : Syntax {T}) where
open Syntax Syn
open import SOAS.Common
open import SOAS.Families.Core {T}
open import SOAS.Context {T}
open import SOAS.Variable {T}
open import SOAS.Construction.Structure as Structure
open import SOAS.Abstract.Hom {T}
import SOAS.Abstract.Coalgebra {T} as →□ ; open →□.Sorted
import SOAS.Abstract.Box {T} as □ ; open □.Sorted
open import Categories.Monad
open import SOAS.Abstract.Monoid
open import SOAS.Coalgebraic.Map
open import SOAS.Coalgebraic.Monoid
open import SOAS.Coalgebraic.Strength
open import SOAS.Metatheory Syn
private
variable
α β : T
Γ Δ : Ctx
module _ (𝔛 : Familyₛ) where
open Theory 𝔛
-- 𝕋 is a Σ-monoid
Σ𝕋ᵐ : ΣMon 𝕋
Σ𝕋ᵐ = record
{ ᵐ = 𝕋ᵐ
; 𝑎𝑙𝑔 = 𝕒𝕝𝕘
; μ⟨𝑎𝑙𝑔⟩ = λ{ {σ = σ} t → begin
𝕤𝕦𝕓 (𝕒𝕝𝕘 t) σ
≡⟨ Substitution.𝕥⟨𝕒⟩ ⟩
𝕒𝕝𝕘 (str 𝕋ᴮ 𝕋 (⅀₁ 𝕤𝕦𝕓 t) σ)
≡⟨ cong 𝕒𝕝𝕘 (CoalgMon.str-eq 𝕋ᴹ 𝕋 ⅀:Str (⅀₁ 𝕤𝕦𝕓 t) σ) ⟩
𝕒𝕝𝕘 (str (Mon.ᴮ 𝕋ᵐ) 𝕋 (⅀₁ 𝕤𝕦𝕓 t) σ)
∎ }
} where open ≡-Reasoning
-- Given a ⅀-monoid ℳ and interpretation ω : 𝔛 ⇾̣ ℳ,
-- there is a unique homomorphic extension 𝕋 𝔛 ⇾̣ ℳ
module FΣM {ℳ : Familyₛ}(Σℳᵐ : ΣMon ℳ) (ω : 𝔛 ⇾̣ ℳ) where
open ΣMon Σℳᵐ renaming (𝑎𝑙𝑔 to ℳ𝑎𝑙𝑔 ; ᴮ to ℳᴮ ; ᵐ to ℳᵐ) public
private module ℳ = ΣMon Σℳᵐ
-- Metavariable operator of ℳ using ω and monoid multiplication, making
-- ℳ into a meta-algebra
χ : 𝔛 ⇾̣ 〖 ℳ , ℳ 〗
χ 𝔪 ε = μ (ω 𝔪) ε
ℳᵃ : MetaAlg ℳ
ℳᵃ = record { 𝑎𝑙𝑔 = ℳ.𝑎𝑙𝑔 ; 𝑣𝑎𝑟 = η ; 𝑚𝑣𝑎𝑟 = χ }
open Semantics ℳᵃ public renaming (𝕤𝕖𝕞 to 𝕖𝕩𝕥)
open MetaAlg ℳᵃ
open Coalgebraic μᶜ
-- Extension is pointed coalgebra hommorphism
𝕖𝕩𝕥ᵇ⇒ : Coalg⇒ 𝕋ᵇ ℳ.ᵇ 𝕖𝕩𝕥
𝕖𝕩𝕥ᵇ⇒ = 𝕤𝕖𝕞ᵇ⇒ ℳ.ᵇ ℳᵃ record
{ ⟨𝑎𝑙𝑔⟩ = λ{ {t = t} → dext (λ ρ → begin
μ (𝑎𝑙𝑔 t) (η ∘ ρ)
≡⟨ μ⟨𝑎𝑙𝑔⟩ t ⟩
𝑎𝑙𝑔 (str ℳ.ᴮ ℳ (⅀₁ μ t) (η ∘ ρ))
≡⟨ cong 𝑎𝑙𝑔 (str-nat₁ (ηᴮ⇒ ℳᴮ) (⅀₁ ℳ.μ t) ρ) ⟩
𝑎𝑙𝑔 (str ℐᴮ ℳ (⅀.F₁ (λ { h ς → h (λ v → η (ς v)) }) (⅀₁ ℳ.μ t)) ρ)
≡˘⟨ congr ⅀.homomorphism (λ - → 𝑎𝑙𝑔 (str ℐᴮ ℳ - ρ)) ⟩
𝑎𝑙𝑔 (str ℐᴮ ℳ (⅀.F₁ (λ{ t ρ → μ t (η ∘ ρ)}) t) ρ)
∎) }
; ⟨𝑣𝑎𝑟⟩ = dext′ ℳ.lunit
; ⟨𝑚𝑣𝑎𝑟⟩ = dext′ ℳ.assoc
} where open ≡-Reasoning
𝕖𝕩𝕥ᴮ⇒ : Coalgₚ⇒ 𝕋ᴮ ℳ.ᴮ 𝕖𝕩𝕥
𝕖𝕩𝕥ᴮ⇒ = record { ᵇ⇒ = 𝕖𝕩𝕥ᵇ⇒ ; ⟨η⟩ = ⟨𝕧⟩ }
-- Extension is monoid homomorphims
μ∘𝕖𝕩𝕥 : MapEq₁ 𝕋ᴮ ℳ.𝑎𝑙𝑔 (λ t σ → 𝕖𝕩𝕥 (𝕤𝕦𝕓 t σ))
(λ t σ → μ (𝕖𝕩𝕥 t) (𝕖𝕩𝕥 ∘ σ))
μ∘𝕖𝕩𝕥 = record
{ φ = 𝕖𝕩𝕥
; χ = χ
; f⟨𝑣⟩ = cong 𝕖𝕩𝕥 Substitution.𝕥⟨𝕧⟩
; f⟨𝑚⟩ = trans (cong 𝕖𝕩𝕥 Substitution.𝕥⟨𝕞⟩) ⟨𝕞⟩
; f⟨𝑎⟩ = λ{ {σ = σ}{t} → begin
𝕖𝕩𝕥 (𝕤𝕦𝕓 (𝕒𝕝𝕘 t) σ)
≡⟨ cong 𝕖𝕩𝕥 Substitution.𝕥⟨𝕒⟩ ⟩
𝕖𝕩𝕥 (𝕒𝕝𝕘 (str 𝕋ᴮ 𝕋 (⅀₁ 𝕤𝕦𝕓 t) σ))
≡⟨ ⟨𝕒⟩ ⟩
𝑎𝑙𝑔 (⅀₁ 𝕖𝕩𝕥 (str 𝕋ᴮ 𝕋 (⅀₁ 𝕤𝕦𝕓 t) σ))
≡˘⟨ cong 𝑎𝑙𝑔 (str-nat₂ 𝕖𝕩𝕥 (⅀₁ 𝕤𝕦𝕓 t) σ) ⟩
𝑎𝑙𝑔 (str 𝕋ᴮ ℳ (⅀.F₁ (λ { h ς → 𝕖𝕩𝕥 (h ς) }) (⅀₁ 𝕤𝕦𝕓 t)) σ)
≡˘⟨ congr ⅀.homomorphism (λ - → 𝑎𝑙𝑔 (str 𝕋ᴮ ℳ - σ)) ⟩
𝑎𝑙𝑔 (str 𝕋ᴮ ℳ (⅀₁ (λ{ t σ → 𝕖𝕩𝕥 (𝕤𝕦𝕓 t σ)}) t) σ)
∎ }
; g⟨𝑣⟩ = trans (μ≈₁ ⟨𝕧⟩) (Mon.lunit ℳ.ᵐ)
; g⟨𝑚⟩ = trans (μ≈₁ ⟨𝕞⟩) (Mon.assoc ℳ.ᵐ)
; g⟨𝑎⟩ = λ{ {σ = σ}{t} → begin
μ (𝕖𝕩𝕥 (𝕒𝕝𝕘 t)) (𝕖𝕩𝕥 ∘ σ)
≡⟨ μ≈₁ ⟨𝕒⟩ ⟩
μ (𝑎𝑙𝑔 (⅀₁ 𝕖𝕩𝕥 t)) (𝕖𝕩𝕥 ∘ σ)
≡⟨ μ⟨𝑎𝑙𝑔⟩ _ ⟩
𝑎𝑙𝑔 (str ℳᴮ ℳ (⅀₁ μ (⅀₁ 𝕖𝕩𝕥 t)) (𝕖𝕩𝕥 ∘ σ))
≡˘⟨ congr ⅀.homomorphism (λ - → 𝑎𝑙𝑔 (str ℳᴮ ℳ - (𝕖𝕩𝕥 ∘ σ))) ⟩
𝑎𝑙𝑔 (str ℳᴮ ℳ (⅀₁ (μ ∘ 𝕖𝕩𝕥) t) (𝕖𝕩𝕥 ∘ σ))
≡⟨ cong 𝑎𝑙𝑔 (str-nat₁ 𝕖𝕩𝕥ᴮ⇒ ((⅀₁ (μ ∘ 𝕖𝕩𝕥) t)) σ) ⟩
𝑎𝑙𝑔 (str 𝕋ᴮ ℳ (⅀.F₁ (λ { h′ ς → h′ (𝕖𝕩𝕥 ∘ ς) }) (⅀₁ (μ ∘ 𝕖𝕩𝕥) t)) σ)
≡˘⟨ congr ⅀.homomorphism (λ - → ℳ𝑎𝑙𝑔 (str 𝕋ᴮ ℳ - σ)) ⟩
𝑎𝑙𝑔 (str 𝕋ᴮ ℳ (⅀₁ (λ{ t σ → μ (𝕖𝕩𝕥 t) (𝕖𝕩𝕥 ∘ σ)}) t) σ)
∎ }
} where open ≡-Reasoning
𝕖𝕩𝕥ᵐ⇒ : ΣMon⇒ Σ𝕋ᵐ Σℳᵐ 𝕖𝕩𝕥
𝕖𝕩𝕥ᵐ⇒ = record { ᵐ⇒ = record
{ ⟨η⟩ = ⟨𝕧⟩
; ⟨μ⟩ = λ{ {t = t} → MapEq₁.≈ μ∘𝕖𝕩𝕥 t } }
; ⟨𝑎𝑙𝑔⟩ = ⟨𝕒⟩ }
module 𝕖𝕩𝕥ᵐ⇒ = ΣMon⇒ 𝕖𝕩𝕥ᵐ⇒
-- Interpretation map is equal to any homomorphism that factors through 𝔛 ⇾ ℳ
module _ {g : 𝕋 ⇾̣ ℳ}
(gᵐ⇒ : ΣMon⇒ Σ𝕋ᵐ Σℳᵐ g)
(p : ∀{α Π}{𝔪 : 𝔛 α Π} → g (𝕞𝕧𝕒𝕣 𝔪 𝕧𝕒𝕣) ≡ ω 𝔪) where
open ΣMon⇒ gᵐ⇒ renaming (⟨𝑎𝑙𝑔⟩ to g⟨𝑎𝑙𝑔⟩)
gᵃ⇒ : MetaAlg⇒ 𝕋ᵃ ℳᵃ g
gᵃ⇒ = record
{ ⟨𝑎𝑙𝑔⟩ = g⟨𝑎𝑙𝑔⟩
; ⟨𝑣𝑎𝑟⟩ = ⟨η⟩
; ⟨𝑚𝑣𝑎𝑟⟩ = λ{ {𝔪 = 𝔪}{ε} → begin
g (𝕞𝕧𝕒𝕣 𝔪 ε) ≡˘⟨ cong g (cong (𝕞𝕧𝕒𝕣 𝔪) (dext′ Substitution.𝕥⟨𝕧⟩)) ⟩
g (𝕞𝕧𝕒𝕣 𝔪 (λ v → 𝕤𝕦𝕓 (𝕧𝕒𝕣 v) ε)) ≡˘⟨ cong g Substitution.𝕥⟨𝕞⟩ ⟩
g (𝕤𝕦𝕓 (𝕞𝕧𝕒𝕣 𝔪 𝕧𝕒𝕣) ε) ≡⟨ ⟨μ⟩ ⟩
μ (g (𝕞𝕧𝕒𝕣 𝔪 𝕧𝕒𝕣)) (g ∘ ε) ≡⟨ μ≈₁ p ⟩
μ (ω 𝔪) (λ x → g (ε x)) ∎ }
} where open ≡-Reasoning
𝕖𝕩𝕥ᵐ! : {α : T}{Γ : Ctx}(t : 𝕋 α Γ) → 𝕖𝕩𝕥 t ≡ g t
𝕖𝕩𝕥ᵐ! = 𝕤𝕖𝕞! gᵃ⇒
-- Free Σ-monoid functor
Famₛ→ΣMon : Familyₛ → ΣMonoid
Famₛ→ΣMon 𝔛 = Theory.𝕋 𝔛 ⋉ (Σ𝕋ᵐ 𝔛)
open ΣMonoidStructure.Free
Free-ΣMon-Mapping : FreeΣMonoid.FreeMapping Famₛ→ΣMon
Free-ΣMon-Mapping = record
{ embed = λ {𝔛} 𝔪 → let open Theory 𝔛 in 𝕞𝕧𝕒𝕣 𝔪 𝕧𝕒𝕣
; univ = λ{ 𝔛 (ℳ ⋉ Σℳᵐ) ω → let open FΣM 𝔛 Σℳᵐ ω in record
{ extend = 𝕖𝕩𝕥 ⋉ 𝕖𝕩𝕥ᵐ⇒
; factor = trans ⟨𝕞⟩ (trans (μ≈₂ ⟨𝕧⟩) runit)
; unique = λ{ (g ⋉ gᵐ⇒) p {x = t} → sym (𝕖𝕩𝕥ᵐ! gᵐ⇒ p t) } }}
}
Free:𝔽amₛ⟶Σ𝕄on : Functor 𝔽amiliesₛ Σ𝕄onoids
Free:𝔽amₛ⟶Σ𝕄on = FreeΣMonoid.FreeMapping.Free Free-ΣMon-Mapping
-- Σ-monoid monad on families
ΣMon:Monad : Monad 𝔽amiliesₛ
ΣMon:Monad = FreeΣMonoid.FreeMapping.FreeMonad Free-ΣMon-Mapping
𝕋F : Functor 𝔽amiliesₛ 𝔽amiliesₛ
𝕋F = Monad.F ΣMon:Monad
open Theory
open Monad ΣMon:Monad
-- Functorial action of 𝕋
𝕋₁ : {𝔛 𝔜 : Familyₛ} → (𝔛 ⇾̣ 𝔜) → 𝕋 𝔛 ⇾̣ 𝕋 𝔜
𝕋₁ f t = Functor.₁ 𝕋F f t
-- Functorial action preserves variables
𝕋₁∘𝕧𝕒𝕣 : {𝔛 𝔜 : Familyₛ}(f : 𝔛 ⇾̣ 𝔜)(v : ℐ α Γ)
→ 𝕋₁ f (𝕧𝕒𝕣 𝔛 v) ≡ 𝕧𝕒𝕣 𝔜 v
𝕋₁∘𝕧𝕒𝕣 {𝔛 = 𝔛}{𝔜} f v = FΣM.⟨𝕧⟩ 𝔛 (Σ𝕋ᵐ 𝔜) (λ 𝔪 → 𝕞𝕧𝕒𝕣 𝔜 (f 𝔪) (𝕧𝕒𝕣 𝔜))
-- Functorial action preserves metavariables
𝕋₁∘𝕞𝕧𝕒𝕣 : {𝔛 𝔜 : Familyₛ}(f : 𝔛 ⇾̣ 𝔜)(𝔪 : 𝔛 α Γ)(ε : Γ ~[ 𝕋 𝔛 ]↝ Δ)
→ 𝕋₁ f (𝕞𝕧𝕒𝕣 𝔛 𝔪 ε) ≡ 𝕞𝕧𝕒𝕣 𝔜 (f 𝔪) (𝕋₁ f ∘ ε)
𝕋₁∘𝕞𝕧𝕒𝕣 {𝔛 = 𝔛}{𝔜} f 𝔪 ε = begin
𝕋₁ f (𝕞𝕧𝕒𝕣 𝔛 𝔪 ε)
≡⟨⟩
FΣM.𝕖𝕩𝕥 𝔛 (Σ𝕋ᵐ 𝔜) (λ 𝔪 → 𝕞𝕧𝕒𝕣 𝔜 (f 𝔪) (𝕧𝕒𝕣 𝔜)) (𝕞𝕧𝕒𝕣 𝔛 𝔪 ε)
≡⟨ FΣM.⟨𝕞⟩ 𝔛 (Σ𝕋ᵐ 𝔜) (λ 𝔪 → 𝕞𝕧𝕒𝕣 𝔜 (f 𝔪) (𝕧𝕒𝕣 𝔜)) ⟩
𝕤𝕦𝕓 𝔜 (𝕞𝕧𝕒𝕣 𝔜 (f 𝔪) (𝕧𝕒𝕣 𝔜)) (𝕋₁ f ∘ ε)
≡⟨ Substitution.𝕥⟨𝕞⟩ 𝔜 ⟩
𝕞𝕧𝕒𝕣 𝔜 (f 𝔪) (λ 𝔫 → 𝕤𝕦𝕓 𝔜 (𝕧𝕒𝕣 𝔜 𝔫) (𝕋₁ f ∘ ε))
≡⟨ cong (𝕞𝕧𝕒𝕣 𝔜 (f 𝔪)) (dext (λ 𝔫 → lunit 𝔜)) ⟩
𝕞𝕧𝕒𝕣 𝔜 (f 𝔪) (𝕋₁ f ∘ ε)
∎ where open ≡-Reasoning
-- Corollary fo the above two
𝕋₁∘𝕞𝕧𝕒𝕣[𝕧𝕒𝕣] : {𝔛 𝔜 : Familyₛ}(f : 𝔛 ⇾̣ 𝔜)(𝔪 : 𝔛 α Γ)(ρ : Γ ↝ Δ)
→ 𝕋₁ f (𝕞𝕧𝕒𝕣 𝔛 𝔪 (𝕧𝕒𝕣 𝔛 ∘ ρ)) ≡ 𝕞𝕧𝕒𝕣 𝔜 (f 𝔪) (𝕧𝕒𝕣 𝔜 ∘ ρ)
𝕋₁∘𝕞𝕧𝕒𝕣[𝕧𝕒𝕣] {𝔛 = 𝔛}{𝔜} f 𝔪 ρ = begin
𝕋₁ f (𝕞𝕧𝕒𝕣 𝔛 𝔪 (𝕧𝕒𝕣 𝔛 ∘ ρ))
≡⟨ 𝕋₁∘𝕞𝕧𝕒𝕣 f 𝔪 (𝕧𝕒𝕣 𝔛 ∘ ρ) ⟩
𝕞𝕧𝕒𝕣 𝔜 (f 𝔪) (𝕋₁ f ∘ 𝕧𝕒𝕣 𝔛 ∘ ρ)
≡⟨ cong (𝕞𝕧𝕒𝕣 𝔜 (f 𝔪)) (dext λ v → 𝕋₁∘𝕧𝕒𝕣 f (ρ v)) ⟩
𝕞𝕧𝕒𝕣 𝔜 (f 𝔪) (𝕧𝕒𝕣 𝔜 ∘ ρ)
∎ where open ≡-Reasoning
| {
"alphanum_fraction": 0.5027554048,
"avg_line_length": 32.9162790698,
"ext": "agda",
"hexsha": "ccf7304bbf319cef2da49bfeb3083884c044f103",
"lang": "Agda",
"max_forks_count": 4,
"max_forks_repo_forks_event_max_datetime": "2022-01-24T12:49:17.000Z",
"max_forks_repo_forks_event_min_datetime": "2021-11-09T20:39:59.000Z",
"max_forks_repo_head_hexsha": "ff1a985a6be9b780d3ba2beff68e902394f0a9d8",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "JoeyEremondi/agda-soas",
"max_forks_repo_path": "SOAS/Metatheory/FreeMonoid.agda",
"max_issues_count": 1,
"max_issues_repo_head_hexsha": "ff1a985a6be9b780d3ba2beff68e902394f0a9d8",
"max_issues_repo_issues_event_max_datetime": "2021-11-21T12:19:32.000Z",
"max_issues_repo_issues_event_min_datetime": "2021-11-21T12:19:32.000Z",
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "JoeyEremondi/agda-soas",
"max_issues_repo_path": "SOAS/Metatheory/FreeMonoid.agda",
"max_line_length": 99,
"max_stars_count": 39,
"max_stars_repo_head_hexsha": "ff1a985a6be9b780d3ba2beff68e902394f0a9d8",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "JoeyEremondi/agda-soas",
"max_stars_repo_path": "SOAS/Metatheory/FreeMonoid.agda",
"max_stars_repo_stars_event_max_datetime": "2022-03-19T17:33:12.000Z",
"max_stars_repo_stars_event_min_datetime": "2021-11-09T20:39:55.000Z",
"num_tokens": 5389,
"size": 7077
} |
{- Name: Bowornmet (Ben) Hudson
--Type safety and meaning functions for L{⇒,+,×,unit}--
-}
open import Preliminaries
open import Preorder
open import Preorder-repackage
module L where
-- => and + and × and unit
data Typ : Set where
_⇒_ : Typ → Typ → Typ
_×'_ : Typ → Typ → Typ
_+'_ : Typ → Typ → Typ
unit : Typ
------------------------------------------
-- represent a context as a list of types
Ctx = List Typ
-- de Bruijn indices (for free variables)
data _∈_ : Typ → Ctx → Set where
i0 : ∀ {Γ τ}
→ τ ∈ (τ :: Γ)
iS : ∀ {Γ τ τ1}
→ τ ∈ Γ
→ τ ∈ (τ1 :: Γ)
------------------------------------------
-- static semantics
data _|-_ : Ctx → Typ → Set where
var : ∀ {Γ τ}
→ (x : τ ∈ Γ) → Γ |- τ
lam : ∀ {Γ τ ρ}
→ (x : (ρ :: Γ) |- τ)
→ Γ |- (ρ ⇒ τ)
app : ∀ {Γ τ1 τ2}
→ (e1 : Γ |- (τ2 ⇒ τ1)) → (e2 : Γ |- τ2)
→ Γ |- τ1
unit : ∀ {Γ}
→ Γ |- unit
prod : ∀ {Γ τ1 τ2}
→ (e1 : Γ |- τ1) → (e2 : Γ |- τ2)
→ Γ |- (τ1 ×' τ2)
l-proj : ∀ {Γ τ1 τ2}
→ (e : Γ |- (τ1 ×' τ2))
→ Γ |- τ1
r-proj : ∀ {Γ τ1 τ2}
→ (e : Γ |- (τ1 ×' τ2))
→ Γ |- τ2
inl : ∀ {Γ τ1 τ2}
→ (e : Γ |- τ1)
→ Γ |- (τ1 +' τ2)
inr : ∀ {Γ τ1 τ2}
→ (e : Γ |- τ2)
→ Γ |- (τ1 +' τ2)
case` : ∀ {Γ τ1 τ2 τ}
→ (e : Γ |- (τ1 +' τ2))
→ (e1 : (τ1 :: Γ) |- τ)
→ (e2 : (τ2 :: Γ) |- τ)
→ Γ |- τ
------------------------------------------
-- renaming
rctx : Ctx → Ctx → Set
rctx Γ Γ' = ∀ {τ} → τ ∈ Γ' → τ ∈ Γ
-- re: transferring variables in contexts
lem1 : ∀ {Γ Γ' τ} → rctx Γ Γ' → rctx (τ :: Γ) (τ :: Γ')
lem1 d i0 = i0
lem1 d (iS x) = iS (d x)
-- renaming lemma
ren : ∀ {Γ Γ' τ} → Γ' |- τ → rctx Γ Γ' → Γ |- τ
ren (var x) d = var (d x)
ren (lam e) d = lam (ren e (lem1 d))
ren (app e1 e2) d = app (ren e1 d) (ren e2 d)
ren unit d = unit
ren (prod e1 e2) d = prod (ren e1 d) (ren e2 d)
ren (l-proj e) d = l-proj (ren e d)
ren (r-proj e) d = r-proj (ren e d)
ren (inl x) d = inl (ren x d)
ren (inr x) d = inr (ren x d)
ren (case` e e1 e2) d = case` (ren e d) (ren e1 (lem1 d)) (ren e2 (lem1 d))
------------------------------------------
-- substitution
sctx : Ctx → Ctx → Set
sctx Γ Γ' = ∀ {τ} → τ ∈ Γ' → Γ |- τ
-- weakening (didn't need this later on. Oh well)
wkn : ∀ {Γ τ1 τ2} → Γ |- τ2 → (τ1 :: Γ) |- τ2
wkn e = ren e iS
-- lem2 (need a lemma for subst like we did for renaming)
lem2 : ∀ {Γ Γ' τ} → sctx Γ Γ' → sctx (τ :: Γ) (τ :: Γ')
lem2 d i0 = var i0
lem2 d (iS i0) = ren (d i0) iS
lem2 d (iS (iS i)) = ren (d (iS i)) iS
-- another substitution lemma
lem3 : ∀ {Γ τ} → Γ |- τ → sctx Γ (τ :: Γ)
lem3 d i0 = d
lem3 d (iS i) = var i
-- one final lemma needed for the last stepping rule. Thank you Professor Licata!
lem4 : ∀ {Γ τ1 τ2} → Γ |- τ1 → Γ |- τ2 → sctx Γ (τ1 :: (τ2 :: Γ))
lem4 x y i0 = x
lem4 x y (iS i0) = y
lem4 x y (iS (iS i)) = var i
-- the 'real' substitution lemma
subst : ∀ {Γ Γ' τ} → sctx Γ Γ' → Γ' |- τ → Γ |- τ
subst d (var x) = d x
subst d (lam e) = lam (subst (lem2 d) e)
subst d (app e1 e2) = app (subst d e1) (subst d e2)
subst d unit = unit
subst d (prod e1 e2) = prod (subst d e1) (subst d e2)
subst d (l-proj e) = l-proj (subst d e)
subst d (r-proj e) = r-proj (subst d e)
subst d (inl x) = inl (subst d x)
subst d (inr x) = inr (subst d x)
subst d (case` e e1 e2) = case` (subst d e) (subst (lem2 d) e1) (subst (lem2 d) e2)
------------------------------------------
-- closed values of L (when something is a value)
-- recall that we use empty contexts when we work with dynamic semantics
data val : ∀ {τ} → [] |- τ → Set where
unit-isval : val unit
lam-isval : ∀ {ρ τ} (e : (ρ :: []) |- τ)
→ val (lam e)
prod-isval : ∀ {τ1 τ2}
→ (e1 : [] |- τ1) → (e2 : [] |- τ2)
→ val e1 → val e2
→ val (prod e1 e2)
inl-isval : ∀ {τ1 τ2}
→ (e : [] |- τ1)
→ val e
→ val (inl {_} {_} {τ2} e)
inr-isval : ∀ {τ1 τ2}
→ (e : [] |- τ2)
→ val e
→ val (inr {_} {τ1} {_} e)
------------------------------------------
-- stepping rules (preservation is folded into this)
-- Preservation: if e:τ and e=>e', then e':τ
data _>>_ : ∀ {τ} → [] |- τ → [] |- τ → Set where
app-steps : ∀ {τ1 τ2}
→ (e1 e1' : [] |- (τ2 ⇒ τ1)) → (e2 : [] |- τ2)
→ e1 >> e1'
→ (app e1 e2) >> (app e1' e2)
app-steps-2 : ∀ {τ1 τ2}
→ (e1 : [] |- (τ2 ⇒ τ1)) → (e2 e2' : [] |- τ2)
→ val e1 → e2 >> e2'
→ (app e1 e2) >> (app e1 e2')
app-steps-3 : ∀ {τ1 τ2}
→ (e1 : (τ1 :: []) |- τ2)
→ (e2 : [] |- τ1)
→ (app (lam e1) e2) >> subst (lem3 e2) e1
prod-steps : ∀ {τ1 τ2}
→ (e1 e1' : [] |- τ1) → (e2 : [] |- τ2)
→ e1 >> e1'
→ (prod e1 e2) >> (prod e1' e2)
prod-steps-2 : ∀ {τ1 τ2}
→ (e1 : [] |- τ1) → (e2 e2' : [] |- τ2)
→ val e1 → e2 >> e2'
→ (prod e1 e2) >> (prod e1 e2')
l-proj-steps : ∀ {τ1 τ2}
→ (e e' : [] |- (τ1 ×' τ2))
→ e >> e'
→ (l-proj e) >> (l-proj e')
l-proj-steps-2 : ∀ {τ1 τ2}
→ (e1 : [] |- τ1) → (e2 : [] |- τ2)
→ val e1 → val e2
→ (l-proj (prod e1 e2)) >> e1
r-proj-steps : ∀ {τ1 τ2}
→ (e e' : [] |- (τ1 ×' τ2))
→ e >> e'
→ (r-proj e) >> (r-proj e')
r-proj-steps-2 : ∀ {τ1 τ2}
→ (e1 : [] |- τ1) → (e2 : [] |- τ2)
→ val e1 → val e2
→ (r-proj (prod e1 e2)) >> e2
inl-steps : ∀ {τ1 τ2}
→ (e e' : [] |- τ1)
→ e >> e'
→ inl {_} {_} {τ2} e >> inl e'
inr-steps : ∀ {τ1 τ2}
→ (e e' : [] |- τ2)
→ e >> e'
→ inr {_} {τ1} {_} e >> inr e'
case`-steps : ∀ {τ1 τ2 τ}
→ (e e' : [] |- (τ1 +' τ2))
→ (e1 : (τ1 :: []) |- τ)
→ (e2 : (τ2 :: []) |- τ)
→ e >> e'
→ (case` e e1 e2) >> (case` e' e1 e2)
case`-steps-2 : ∀ {τ1 τ2 τ}
→ (e : [] |- τ1)
→ (e1 : (τ1 :: []) |- τ)
→ (e2 : (τ2 :: []) |- τ)
→ val e
→ (case` (inl e) e1 e2) >> subst (lem3 e) e1
case`-steps-3 : ∀ {τ1 τ2 τ}
→ (e : [] |- τ2)
→ (e1 : (τ1 :: []) |- τ)
→ (e2 : (τ2 :: []) |- τ)
→ val e
→ (case` (inr e) e1 e2) >> subst (lem3 e) e2
------------------------------------------
-- Proof of progress!
-- Progress: if e:τ, then either e val or ∃e' such that e=>e'
progress : ∀ {τ} (e : [] |- τ) → Either (val e) (Σ (λ e' → (e >> e')))
progress (var ())
progress (lam x) = Inl (lam-isval x)
progress (app e1 e2) with progress e1
progress (app .(lam e) e2) | Inl (lam-isval e) = Inr (_ , app-steps-3 e e2)
progress (app e1 e2) | Inr (x , d) = Inr (_ , app-steps e1 x e2 d)
progress unit = Inl unit-isval
progress (prod e1 e2) with progress e1
progress (prod e1 e2) | Inl d with progress e2
progress (prod e1 e2) | Inl d | Inl x = Inl (prod-isval e1 e2 d x)
progress (prod e1 e2) | Inl d | Inr (x , k) = Inr (_ , prod-steps-2 e1 e2 x d k)
progress (prod e1 e2) | Inr (x , d) = Inr (_ , prod-steps e1 x e2 d)
progress (l-proj e) with progress e
progress (l-proj .(prod e1 e2)) | Inl (prod-isval e1 e2 d d₁) = Inr (_ , l-proj-steps-2 e1 e2 d d₁)
progress (l-proj e) | Inr (x , d) = Inr (_ , l-proj-steps e x d)
progress (r-proj e) with progress e
progress (r-proj .(prod e1 e2)) | Inl (prod-isval e1 e2 d d₁) = Inr (_ , r-proj-steps-2 e1 e2 d d₁)
progress (r-proj e) | Inr (x , d) = Inr (_ , r-proj-steps e x d)
progress (inl e) with progress e
progress (inl e) | Inl x = Inl (inl-isval e x)
progress (inl e) | Inr (x , d) = Inr (_ , inl-steps e x d)
progress (inr e) with progress e
progress (inr e) | Inl x = Inl (inr-isval e x)
progress (inr e) | Inr (x , d) = Inr (_ , inr-steps e x d)
progress (case` e e1 e2) with progress e
progress (case` .(inl e) e1 e2) | Inl (inl-isval e x) = Inr (_ , case`-steps-2 e e1 e2 x)
progress (case` .(inr e) e1 e2) | Inl (inr-isval e x) = Inr (_ , case`-steps-3 e e1 e2 x)
progress (case` e e1 e2) | Inr (x , d) = Inr (_ , case`-steps e x e1 e2 d)
------------------------------------------
-- how to interpret types in L as preorders
interp : Typ → PREORDER
interp (A ⇒ B) = interp A ->p interp B
interp (A ×' B) = interp A ×p interp B
interp (A +' B) = interp A +p interp B
interp unit = unit-p
interpC : Ctx → PREORDER
interpC [] = unit-p
interpC (A :: Γ) = interpC Γ ×p interp A
-- look up a variable in context
lookup : ∀{Γ τ} → τ ∈ Γ → el (interpC Γ ->p interp τ)
lookup (i0 {Γ} {τ}) = snd' {interpC (τ :: Γ)} {interpC Γ} {_} id
lookup (iS {Γ} {τ} {τ1} x) = comp {interpC (τ1 :: Γ)} {_} {_} (fst' {interpC (τ1 :: Γ)} {_} {interp τ1} id) (lookup x)
interpE : ∀{Γ τ} → Γ |- τ → el (interpC Γ ->p interp τ)
interpE (var x) = lookup x
interpE (lam e) = lam' (interpE e)
interpE (app e1 e2) = app' (interpE e1) (interpE e2)
interpE unit = monotone (λ _ → <>) (λ x y _ → <>)
interpE (prod e1 e2) = pair' (interpE e1) (interpE e2)
interpE (l-proj {Γ} {τ1} {τ2} e) = fst' {_} {_} {interp τ2} (interpE e)
interpE (r-proj {Γ} {τ1} {τ2} e) = snd' {_} {interp τ1} {_} (interpE e)
interpE (inl e) = inl' (interpE e)
interpE (inr e) = inr' (interpE e)
interpE (case` e e1 e2) = case' (interpE e1) (interpE e2) (interpE e)
| {
"alphanum_fraction": 0.4231692677,
"avg_line_length": 35.1971830986,
"ext": "agda",
"hexsha": "01155eaf198f8d301a5e1d11358ec1b1183cd64c",
"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": "2404a6ef2688f879bda89860bb22f77664ad813e",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "benhuds/Agda",
"max_forks_repo_path": "ug/L.agda",
"max_issues_count": 1,
"max_issues_repo_head_hexsha": "2404a6ef2688f879bda89860bb22f77664ad813e",
"max_issues_repo_issues_event_max_datetime": "2020-05-12T00:32:45.000Z",
"max_issues_repo_issues_event_min_datetime": "2020-03-23T08:39:04.000Z",
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "benhuds/Agda",
"max_issues_repo_path": "ug/L.agda",
"max_line_length": 120,
"max_stars_count": 2,
"max_stars_repo_head_hexsha": "2404a6ef2688f879bda89860bb22f77664ad813e",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "benhuds/Agda",
"max_stars_repo_path": "ug/L.agda",
"max_stars_repo_stars_event_max_datetime": "2019-08-08T12:27:18.000Z",
"max_stars_repo_stars_event_min_datetime": "2016-04-26T20:22:22.000Z",
"num_tokens": 3926,
"size": 9996
} |
{-# OPTIONS --cubical --safe #-}
module Data.Nat where
open import Data.Nat.Base public
| {
"alphanum_fraction": 0.7,
"avg_line_length": 15,
"ext": "agda",
"hexsha": "d84f77e551aa04d941bf1495a2687eb36edc36f9",
"lang": "Agda",
"max_forks_count": 1,
"max_forks_repo_forks_event_max_datetime": "2021-01-05T14:05:30.000Z",
"max_forks_repo_forks_event_min_datetime": "2021-01-05T14:05:30.000Z",
"max_forks_repo_head_hexsha": "3c176d4690566d81611080e9378f5a178b39b851",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "oisdk/combinatorics-paper",
"max_forks_repo_path": "agda/Data/Nat.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "3c176d4690566d81611080e9378f5a178b39b851",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "oisdk/combinatorics-paper",
"max_issues_repo_path": "agda/Data/Nat.agda",
"max_line_length": 32,
"max_stars_count": 4,
"max_stars_repo_head_hexsha": "3c176d4690566d81611080e9378f5a178b39b851",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "oisdk/combinatorics-paper",
"max_stars_repo_path": "agda/Data/Nat.agda",
"max_stars_repo_stars_event_max_datetime": "2021-01-05T15:32:14.000Z",
"max_stars_repo_stars_event_min_datetime": "2021-01-05T14:07:44.000Z",
"num_tokens": 23,
"size": 90
} |
open import Common.Prelude
open import Common.Reflection
open import Common.Equality
open import Agda.Builtin.Sigma
magic₁ : ⊥ → Nat
magic₁ = λ ()
magic₂ : ⊥ → Nat
magic₂ = λ { () }
magic₃ : ⊥ → Nat
magic₃ ()
data Wrap (A : Set) : Set where
wrap : A → Wrap A
magic₄ : Wrap ⊥ → Nat
magic₄ (wrap ())
data OK : Set where
ok : OK
bad : String
bad = "not good"
macro
checkDefinition : (Definition → Bool) → QName → Tactic
checkDefinition isOk f hole =
bindTC (getDefinition f) λ def →
give (if isOk def then quoteTerm ok else quoteTerm bad) hole
pattern `Nat = def (quote Nat) []
pattern _`→_ a b = pi (vArg a) (abs "_" b)
pattern `Wrap a = def (quote Wrap) (vArg a ∷ [])
pattern `⊥ = def (quote ⊥) []
pattern expected₄ = funDef
(absurdClause (("()" , vArg `⊥) ∷ []) (vArg (con (quote wrap) (vArg absurd ∷ [])) ∷ [])
∷ [])
check₄ : OK
check₄ = checkDefinition (λ { expected₄ → true; _ → false }) magic₄
expected = extLam (absurdClause (("()" , vArg `⊥) ∷ []) (arg (argInfo visible relevant) absurd ∷ []) ∷ []) []
macro
quoteTermNormalised : Term → Term → TC ⊤
quoteTermNormalised t hole =
bindTC (normalise t) λ t →
bindTC (quoteTC t) λ t →
unify hole t
check₁ : quoteTermNormalised magic₁ ≡ expected
check₁ = refl
check₂ : quoteTermNormalised magic₂ ≡ expected
check₂ = refl
pattern expectedDef =
funDef (absurdClause (("()" , vArg `⊥) ∷ []) (vArg absurd ∷ []) ∷ [])
check₃ : OK
check₃ = checkDefinition (λ { expectedDef → true; _ → false }) magic₃
| {
"alphanum_fraction": 0.6333998669,
"avg_line_length": 22.4328358209,
"ext": "agda",
"hexsha": "032317840273fb6fb6eb4007db76ed2f69caeddc",
"lang": "Agda",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "ed8ac6f4062ea8a20fa0f62d5db82d4e68278338",
"max_forks_repo_licenses": [
"BSD-3-Clause"
],
"max_forks_repo_name": "shlevy/agda",
"max_forks_repo_path": "test/Succeed/QuoteExtLam.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "ed8ac6f4062ea8a20fa0f62d5db82d4e68278338",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"BSD-3-Clause"
],
"max_issues_repo_name": "shlevy/agda",
"max_issues_repo_path": "test/Succeed/QuoteExtLam.agda",
"max_line_length": 109,
"max_stars_count": null,
"max_stars_repo_head_hexsha": "ed8ac6f4062ea8a20fa0f62d5db82d4e68278338",
"max_stars_repo_licenses": [
"BSD-3-Clause"
],
"max_stars_repo_name": "shlevy/agda",
"max_stars_repo_path": "test/Succeed/QuoteExtLam.agda",
"max_stars_repo_stars_event_max_datetime": null,
"max_stars_repo_stars_event_min_datetime": null,
"num_tokens": 508,
"size": 1503
} |
import cedille-options
open import general-util
module untyped-spans (options : cedille-options.options) {F : Set → Set} {{monadF : monad F}} where
open import lib
open import ctxt
open import cedille-types
open import spans options {F}
open import syntax-util
open import to-string options
untyped-term-spans : term → spanM ⊤
untyped-type-spans : type → spanM ⊤
untyped-kind-spans : kind → spanM ⊤
untyped-tk-spans : tk → spanM ⊤
untyped-liftingType-spans : liftingType → spanM ⊤
untyped-optTerm-spans : optTerm → spanM (posinfo → posinfo)
untyped-optType-spans : optType → spanM ⊤
untyped-optGuide-spans : optGuide → spanM ⊤
untyped-lterms-spans : lterms → spanM ⊤
untyped-optClass-spans : optClass → spanM ⊤
untyped-defTermOrType-spans : defTermOrType → spanM (spanM ⊤ → spanM ⊤)
untyped-var-spans : posinfo → var → (ctxt → posinfo → var → checking-mode → 𝕃 tagged-val → err-m → span) → spanM ⊤ → spanM ⊤
untyped-var-spans pi x f m = get-ctxt λ Γ → with-ctxt (ctxt-var-decl-loc pi x Γ) (get-ctxt λ Γ → spanM-add (f Γ pi x untyped [] nothing) ≫span m)
untyped-term-spans (App t me t') = untyped-term-spans t ≫span untyped-term-spans t' ≫span spanM-add (App-span ff t t' untyped [] nothing)
untyped-term-spans (AppTp t T) = untyped-term-spans t ≫span untyped-type-spans T ≫span spanM-add (AppTp-span t T untyped [] nothing)
untyped-term-spans (Beta pi ot ot') = untyped-optTerm-spans ot ≫=span λ f → untyped-optTerm-spans ot' ≫=span λ f' → spanM-add (Beta-span pi (f' (f (posinfo-plus pi 1))) untyped [] nothing)
untyped-term-spans (Chi pi mT t) = untyped-optType-spans mT ≫span untyped-term-spans t ≫span get-ctxt λ Γ → spanM-add (Chi-span Γ pi mT t untyped [] nothing)
untyped-term-spans (Delta pi mT t) = untyped-optType-spans mT ≫span untyped-term-spans t ≫span get-ctxt λ Γ → spanM-add (Delta-span Γ pi mT t untyped [] nothing)
untyped-term-spans (Epsilon pi lr mm t) = untyped-term-spans t ≫span spanM-add (Epsilon-span pi lr mm t untyped [] nothing)
untyped-term-spans (Hole pi) = get-ctxt λ Γ → spanM-add (hole-span Γ pi nothing [])
untyped-term-spans (IotaPair pi t t' og pi') = untyped-term-spans t ≫span untyped-term-spans t' ≫span untyped-optGuide-spans og ≫span spanM-add (IotaPair-span pi pi' untyped [] nothing)
untyped-term-spans (IotaProj t n pi) = untyped-term-spans t ≫span spanM-add (IotaProj-span t pi untyped [] nothing)
untyped-term-spans (Lam pi l pi' x oc t) = untyped-optClass-spans oc ≫span get-ctxt λ Γ → spanM-add (Lam-span Γ untyped pi l x oc t [] nothing) ≫span untyped-var-spans pi' x Var-span (untyped-term-spans t)
untyped-term-spans (Let pi d t) = untyped-defTermOrType-spans d ≫=span λ f → f (untyped-term-spans t) ≫span get-ctxt λ Γ → spanM-add (Let-span Γ untyped pi d t [] nothing)
untyped-term-spans (Open pi x t) = untyped-term-spans t ≫span spanM-add (mk-span "Open" pi (term-end-pos t) [] nothing)
untyped-term-spans (Parens pi t pi') = untyped-term-spans t
untyped-term-spans (Phi pi t t' t'' pi') = untyped-term-spans t ≫span untyped-term-spans t' ≫span untyped-term-spans t'' ≫span spanM-add (Phi-span pi pi' untyped [] nothing)
untyped-term-spans (Rho pi op on t og t') = untyped-term-spans t ≫span untyped-term-spans t' ≫span spanM-add (mk-span "Rho" pi (term-end-pos t') (ll-data-term :: [ checking-data untyped ]) nothing)
untyped-term-spans (Sigma pi t) = untyped-term-spans t ≫span get-ctxt λ Γ → spanM-add (mk-span "Sigma" pi (term-end-pos t) (ll-data-term :: [ checking-data untyped ]) nothing)
untyped-term-spans (Theta pi θ t ls) = untyped-term-spans t ≫span untyped-lterms-spans ls ≫span get-ctxt λ Γ → spanM-add (Theta-span Γ pi θ t ls untyped [] nothing)
untyped-term-spans (Var pi x) = get-ctxt λ Γ →
spanM-add (Var-span Γ pi x untyped [] (if ctxt-binds-var Γ x then nothing else just "This variable is not currently in scope."))
untyped-term-spans (Mu pi x t ot pi' cs pi'') = spanM-add (Mu-span t [] nothing)
untyped-term-spans (Mu' pi t ot pi' cs pi'') = spanM-add (Mu-span t [] nothing)
untyped-type-spans (Abs pi b pi' x atk T) = untyped-tk-spans atk ≫span spanM-add (TpQuant-span (me-unerased b) pi x atk T untyped [] nothing) ≫span untyped-var-spans pi' x (if tk-is-type atk then Var-span else TpVar-span) (untyped-type-spans T)
untyped-type-spans (Iota pi pi' x T T') = untyped-type-spans T ≫span spanM-add (Iota-span pi T' untyped [] nothing) ≫span untyped-var-spans pi' x TpVar-span (untyped-type-spans T')
untyped-type-spans (Lft pi pi' x t lT) = untyped-liftingType-spans lT ≫span spanM-add (Lft-span pi x t untyped [] nothing) ≫span untyped-var-spans pi' x Var-span (untyped-term-spans t)
untyped-type-spans (NoSpans T pi) = spanMok
untyped-type-spans (TpApp T T') = untyped-type-spans T ≫span untyped-type-spans T' ≫span spanM-add (TpApp-span T T' untyped [] nothing)
untyped-type-spans (TpAppt T t) = untyped-type-spans T ≫span untyped-term-spans t ≫span spanM-add (TpAppt-span T t untyped [] nothing)
untyped-type-spans (TpArrow T a T') = untyped-type-spans T ≫span untyped-type-spans T' ≫span spanM-add (TpArrow-span T T' untyped [] nothing)
untyped-type-spans (TpEq pi t t' pi') = untyped-term-spans t ≫span untyped-term-spans t' ≫span spanM-add (TpEq-span pi t t' pi' untyped [] nothing)
untyped-type-spans (TpHole pi) = get-ctxt λ Γ → spanM-add (tp-hole-span Γ pi nothing [])
untyped-type-spans (TpLambda pi pi' x atk T) = untyped-tk-spans atk ≫span spanM-add (TpLambda-span pi pi' atk T untyped [] nothing) ≫span untyped-var-spans pi' x TpVar-span (untyped-type-spans T)
untyped-type-spans (TpParens pi T pi') = untyped-type-spans T
untyped-type-spans (TpVar pi x) = get-ctxt λ Γ →
spanM-add (TpVar-span Γ pi x untyped [] (if ctxt-binds-var Γ x then nothing else just "This variable is not currently in scope."))
untyped-type-spans (TpLet pi d T) = untyped-defTermOrType-spans d ≫=span λ f → f (untyped-type-spans T) ≫span get-ctxt λ Γ → spanM-add (TpLet-span Γ untyped pi d T [] nothing)
untyped-kind-spans (KndArrow k k') = untyped-kind-spans k ≫span untyped-kind-spans k' ≫span spanM-add (KndArrow-span k k' untyped nothing)
untyped-kind-spans (KndParens pi k pi') = untyped-kind-spans k
untyped-kind-spans (KndPi pi pi' x atk k) = untyped-tk-spans atk ≫span spanM-add (KndPi-span pi x atk k untyped nothing) ≫span untyped-var-spans pi' x (if tk-is-type atk then Var-span else TpVar-span) (untyped-kind-spans k)
untyped-kind-spans (KndTpArrow T k) = untyped-type-spans T ≫span untyped-kind-spans k ≫span spanM-add (KndTpArrow-span T k untyped nothing)
untyped-kind-spans (KndVar pi x as) = get-ctxt λ Γ →
spanM-add (KndVar-span Γ (pi , x) (kvar-end-pos pi x as) ParamsNil untyped [] (if ctxt-binds-var Γ x then nothing else just "This variable is not currently in scope."))
untyped-kind-spans (Star pi) = spanM-add (Star-span pi untyped nothing)
untyped-liftingType-spans lT = spanMok -- Unimplemented
untyped-tk-spans (Tkt T) = untyped-type-spans T
untyped-tk-spans (Tkk k) = untyped-kind-spans k
untyped-optTerm-spans NoTerm = spanMr λ pi → pi
untyped-optTerm-spans (SomeTerm t pi) = untyped-term-spans t ≫span spanMr λ _ → pi
untyped-optType-spans NoType = spanMok
untyped-optType-spans (SomeType T) = untyped-type-spans T
untyped-optGuide-spans NoGuide = spanMok
untyped-optGuide-spans (Guide pi x T) = untyped-var-spans pi x Var-span (untyped-type-spans T)
untyped-lterms-spans (LtermsNil pi) = spanMok
untyped-lterms-spans (LtermsCons me t ls) = untyped-term-spans t ≫span untyped-lterms-spans ls
untyped-optClass-spans NoClass = spanMok
untyped-optClass-spans (SomeClass atk) = untyped-tk-spans atk
untyped-defTermOrType-spans (DefTerm pi x NoType t) = untyped-term-spans t ≫span get-ctxt λ Γ → with-ctxt (ctxt-var-decl-loc pi x Γ) (spanMr λ x → x)
untyped-defTermOrType-spans (DefTerm pi x (SomeType T) t) = untyped-term-spans t ≫span untyped-type-spans T ≫span get-ctxt λ Γ → with-ctxt (ctxt-var-decl-loc pi x Γ) (spanMr λ x → x)
untyped-defTermOrType-spans (DefType pi x k T) = untyped-kind-spans k ≫span untyped-type-spans T ≫span get-ctxt λ Γ → with-ctxt (ctxt-var-decl-loc pi x Γ) (spanMr λ x → x)
| {
"alphanum_fraction": 0.7202343847,
"avg_line_length": 82.6907216495,
"ext": "agda",
"hexsha": "3a765a565cd214eb5b264b7100a47a212253eb5d",
"lang": "Agda",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "acf691e37210607d028f4b19f98ec26c4353bfb5",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "xoltar/cedille",
"max_forks_repo_path": "src/untyped-spans.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "acf691e37210607d028f4b19f98ec26c4353bfb5",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "xoltar/cedille",
"max_issues_repo_path": "src/untyped-spans.agda",
"max_line_length": 244,
"max_stars_count": null,
"max_stars_repo_head_hexsha": "acf691e37210607d028f4b19f98ec26c4353bfb5",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "xoltar/cedille",
"max_stars_repo_path": "src/untyped-spans.agda",
"max_stars_repo_stars_event_max_datetime": null,
"max_stars_repo_stars_event_min_datetime": null,
"num_tokens": 2720,
"size": 8021
} |
data unit : Set where tt : unit
record Y (A : Set) : Set where field y : A
record Z (A : Set) : Set where field z : A
instance
-- Y[unit] : Y unit
-- Y.y Y[unit] = tt
Z[unit] : Z unit
Z.z Z[unit] = tt
foo : ∀ (A : Set) {{YA : Y A}} {{ZA : Z A}} → unit
foo A = tt
foo[unit] : unit
foo[unit] = foo unit -- {{ZA = Z[unit]}}
| {
"alphanum_fraction": 0.5299401198,
"avg_line_length": 18.5555555556,
"ext": "agda",
"hexsha": "64378729628e7ed66d3b28fccaf357a8c96ef0d7",
"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/Issue1955.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/Issue1955.agda",
"max_line_length": 50,
"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/Issue1955.agda",
"max_stars_repo_stars_event_max_datetime": "2022-03-30T18:20:48.000Z",
"max_stars_repo_stars_event_min_datetime": "2015-01-09T23:51:16.000Z",
"num_tokens": 126,
"size": 334
} |
module L.Base.Empty where
-- Reexport definitions
open import L.Base.Empty.Core public
| {
"alphanum_fraction": 0.7954545455,
"avg_line_length": 17.6,
"ext": "agda",
"hexsha": "b34a648c8b7d3471ae27a797e567dfd586306acf",
"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": "83707537b182ba8906228ac0bcb9ccef972eaaa3",
"max_forks_repo_licenses": [
"BSD-2-Clause"
],
"max_forks_repo_name": "borszag/smallib",
"max_forks_repo_path": "src/L/Base/Empty.agda",
"max_issues_count": 10,
"max_issues_repo_head_hexsha": "83707537b182ba8906228ac0bcb9ccef972eaaa3",
"max_issues_repo_issues_event_max_datetime": "2020-11-09T16:40:39.000Z",
"max_issues_repo_issues_event_min_datetime": "2020-10-19T10:13:16.000Z",
"max_issues_repo_licenses": [
"BSD-2-Clause"
],
"max_issues_repo_name": "borszag/smallib",
"max_issues_repo_path": "src/L/Base/Empty.agda",
"max_line_length": 36,
"max_stars_count": null,
"max_stars_repo_head_hexsha": "83707537b182ba8906228ac0bcb9ccef972eaaa3",
"max_stars_repo_licenses": [
"BSD-2-Clause"
],
"max_stars_repo_name": "borszag/smallib",
"max_stars_repo_path": "src/L/Base/Empty.agda",
"max_stars_repo_stars_event_max_datetime": null,
"max_stars_repo_stars_event_min_datetime": null,
"num_tokens": 19,
"size": 88
} |
{-# OPTIONS --without-K --rewriting #-}
open import lib.Base
open import lib.Equivalence
open import lib.PathGroupoid
open import lib.NType
open import lib.Univalence
open import lib.path-seq.Concat
open import lib.path-seq.Split
module lib.path-seq.Reasoning where
infix 30 _=↯=_
_=↯=_ : ∀ {i} {A : Type i} {a a' : A} → a =-= a' → a =-= a' → Type i
_=↯=_ s t = (↯ s) == (↯ t)
module _ {i} {A : Type i} {a a' : A} where
=-=ₛ-equiv : (s t : a =-= a') → (s =↯= t) ≃ (s =ₛ t)
=-=ₛ-equiv s t = equiv =ₛ-in =ₛ-out (λ _ → idp) (λ _ → idp)
=ₛ-level : {s t : a =-= a'} {n : ℕ₋₂}
→ has-level (S (S n)) A → has-level n (s =ₛ t)
=ₛ-level {s} {t} {n} A-level =
transport (has-level n) (ua (=-=ₛ-equiv s t)) $
has-level-apply (has-level-apply A-level _ _) _ _
!ₛ : {s t : a =-= a'} → s =ₛ t → t =ₛ s
!ₛ (=ₛ-in p) = =ₛ-in (! p)
_∙ₛ_ : {s t u : a =-= a'} → s =ₛ t → t =ₛ u → s =ₛ u
_∙ₛ_ (=ₛ-in p) (=ₛ-in q) = =ₛ-in (p ∙ q)
expand : (s : a =-= a') → ↯ s ◃∎ =ₛ s
expand s = =ₛ-in idp
contract : {s : a =-= a'} → s =ₛ ↯ s ◃∎
contract = =ₛ-in idp
abstract
private
infixr 10 _=↯=⟨_&_&_&_⟩_
_=↯=⟨_&_&_&_⟩_ : {q : a == a'}
→ (s : a =-= a')
→ (n : ℕ) (m : ℕ)
→ (t : point-from-start n s =-= point-from-start m (drop n s))
→ take m (drop n s) =↯= t
→ ↯ (take n s ∙∙ t ∙∙ drop m (drop n s)) == q
→ ↯ s == q
_=↯=⟨_&_&_&_⟩_ {q} s n m t p p' =
↯ s
=⟨ =ₛ-out (take-drop-split n s) ⟩
↯ (take n s) ∙ ↯ (drop n s)
=⟨ ap (↯ (take n s) ∙_) (=ₛ-out (take-drop-split m (drop n s))) ⟩
↯ (take n s) ∙ ↯ (take m (drop n s)) ∙ ↯ (drop m (drop n s))
=⟨ ap (λ v → ↯ (take n s) ∙ v ∙ ↯ (drop m (drop n s))) p ⟩
↯ (take n s) ∙ ↯ t ∙ ↯ (drop m (drop n s))
=⟨ ap (λ v → ↯ (take n s) ∙ v) (! (↯-∙∙ t (drop m (drop n s)))) ⟩
↯ (take n s) ∙ ↯ (t ∙∙ drop m (drop n s))
=⟨ ! (↯-∙∙ (take n s) (t ∙∙ drop m (drop n s))) ⟩
↯ (take n s ∙∙ t ∙∙ drop m (drop n s))
=⟨ p' ⟩
q =∎
{- For making proofs more readable by making
definitional equalities visible. Example:
p ◃∙ ap f idp ◃∙ q ◃∎
=ₛ⟨id⟩
p ◃∙ idp ◃∙ q ◃∎ ∎ₛ
-}
infixr 10 _=ₛ⟨id⟩_
_=ₛ⟨id⟩_ : (s : a =-= a') {u : a =-= a'}
→ s =ₛ u
→ s =ₛ u
_=ₛ⟨id⟩_ s e = e
{- For rewriting everything using a [_=ₛ_] path. Example:
ap f p ◃∙ h y ◃∎
=ₛ⟨ homotopy-naturality f g h p ⟩
h x ◃∙ ap g p ◃∎ ∎ₛ
-}
infixr 10 _=ₛ⟨_⟩_
_=ₛ⟨_⟩_ : (s : a =-= a') {t u : a =-= a'}
→ s =ₛ t
→ t =ₛ u
→ s =ₛ u
_=ₛ⟨_⟩_ _ p q = p ∙ₛ q
{- For rewriting a segment using a [_=ₛ_] path. Example:
p ◃∙ ! (q ∙ r) ◃∙ s ◃∎
=ₛ⟨ 1 & 1 & !-∙-seq (q ◃∙ r ◃∎) ⟩
p ◃∙ ! r ◃∙ ! q ◃∙ s ◃∎ ∎ₛ
-}
infixr 10 _=ₛ⟨_&_&_⟩_
_=ₛ⟨_&_&_⟩_ : (s : a =-= a') {u : a =-= a'}
→ (m n : ℕ)
→ {r : point-from-start m s =-= point-from-start n (drop m s)}
→ take n (drop m s) =ₛ r
→ take m s ∙∙ r ∙∙ drop n (drop m s) =ₛ u
→ s =ₛ u
_=ₛ⟨_&_&_⟩_ s m n {r} p p' = =ₛ-in (s =↯=⟨ m & n & r & =ₛ-out p ⟩ =ₛ-out p')
{- For rewriting everything using a [_==_] path. Example:
p ◃∙ idp ◃∎
=ₛ₁⟨ ∙-unit-r p ⟩
p ◃∎ ∎ₛ
-}
infixr 10 _=ₛ₁⟨_⟩_
_=ₛ₁⟨_⟩_ : (s : a =-= a') {u : a =-= a'}
→ {r : a == a'}
→ ↯ s == r
→ r ◃∎ =ₛ u
→ s =ₛ u
_=ₛ₁⟨_⟩_ s {r} p p' = =ₛ-in p ∙ₛ p'
{- For rewriting a segment using a [_==_] path. Example:
p ◃∙ ! (ap f q) ◃∙ r ◃∎
=ₛ₁⟨ 1 & 1 & !-ap f q ⟩
p ◃∙ ap f (! q) ◃∙ r ◃∎ ∎ₛ
-}
infixr 10 _=ₛ₁⟨_&_&_⟩_
_=ₛ₁⟨_&_&_⟩_ : (s : a =-= a') {u : a =-= a'}
→ (m n : ℕ)
→ {r : point-from-start m s == point-from-start n (drop m s)}
→ ↯ (take n (drop m s)) == r
→ take m s ∙∙ r ◃∙ drop n (drop m s) =ₛ u
→ s =ₛ u
_=ₛ₁⟨_&_&_⟩_ s m n {r} p p' = s =ₛ⟨ m & n & =ₛ-in {t = r ◃∎} p ⟩ p'
infix 15 _∎ₛ
_∎ₛ : (s : a =-= a') → s =ₛ s
_∎ₛ _ = =ₛ-in idp
| {
"alphanum_fraction": 0.4040079169,
"avg_line_length": 28.2657342657,
"ext": "agda",
"hexsha": "4c243eb2f706ac125aadd0603bfee53a7b4b84c3",
"lang": "Agda",
"max_forks_count": 50,
"max_forks_repo_forks_event_max_datetime": "2022-02-14T03:03:25.000Z",
"max_forks_repo_forks_event_min_datetime": "2015-01-10T01:48:08.000Z",
"max_forks_repo_head_hexsha": "1037d82edcf29b620677a311dcfd4fc2ade2faa6",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "AntoineAllioux/HoTT-Agda",
"max_forks_repo_path": "core/lib/path-seq/Reasoning.agda",
"max_issues_count": 31,
"max_issues_repo_head_hexsha": "1037d82edcf29b620677a311dcfd4fc2ade2faa6",
"max_issues_repo_issues_event_max_datetime": "2021-10-03T19:15:25.000Z",
"max_issues_repo_issues_event_min_datetime": "2015-03-05T20:09:00.000Z",
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "AntoineAllioux/HoTT-Agda",
"max_issues_repo_path": "core/lib/path-seq/Reasoning.agda",
"max_line_length": 80,
"max_stars_count": 294,
"max_stars_repo_head_hexsha": "1037d82edcf29b620677a311dcfd4fc2ade2faa6",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "AntoineAllioux/HoTT-Agda",
"max_stars_repo_path": "core/lib/path-seq/Reasoning.agda",
"max_stars_repo_stars_event_max_datetime": "2022-03-20T13:54:45.000Z",
"max_stars_repo_stars_event_min_datetime": "2015-01-09T16:23:23.000Z",
"num_tokens": 2021,
"size": 4042
} |
{-# OPTIONS --prop --rewriting #-}
open import Examples.Sorting.Parallel.Comparable
module Examples.Sorting.Parallel.MergeSortPar (M : Comparable) where
open Comparable M
open import Examples.Sorting.Parallel.Core M
open import Calf costMonoid
open import Calf.ParMetalanguage parCostMonoid
open import Calf.Types.Nat
open import Calf.Types.List
open import Calf.Types.Bounded costMonoid
open import Calf.Types.BigO costMonoid
open import Relation.Binary.PropositionalEquality as Eq using (_≡_; refl; module ≡-Reasoning)
open import Data.Product using (_×_; _,_; ∃; proj₁; proj₂)
open import Data.Nat as Nat using (ℕ; zero; suc; z≤n; s≤s; _+_; _*_; _^_; ⌊_/2⌋; ⌈_/2⌉; _⊔_)
open import Data.Nat.Properties as N using (module ≤-Reasoning)
open import Data.Nat.Log2
open import Data.Nat.Square
open import Data.Nat.PredExp2
open import Examples.Sorting.Parallel.MergeSort.Split M public
open import Examples.Sorting.Parallel.MergeSortPar.Merge M public
sort/clocked : cmp (Π nat λ _ → Π (list A) λ _ → F (list A))
sort/clocked zero l = ret l
sort/clocked (suc k) l =
bind (F (list A)) (split l) λ (l₁ , l₂) →
bind (F (list A)) (sort/clocked k l₁ & sort/clocked k l₂) merge
sort/clocked/correct : ∀ k l → ⌈log₂ length l ⌉ Nat.≤ k → SortResult (sort/clocked k) l
sort/clocked/correct zero l h u = l , refl , refl , short-sorted (⌈log₂n⌉≡0⇒n≤1 (N.n≤0⇒n≡0 h))
sort/clocked/correct (suc k) l h u =
let (l₁ , l₂ , ≡ , length₁ , length₂ , ↭) = split/correct l u in
let (l₁' , ≡₁ , ↭₁ , sorted₁) = sort/clocked/correct k l₁ (
let open ≤-Reasoning in
begin
⌈log₂ length l₁ ⌉
≡⟨ Eq.cong ⌈log₂_⌉ length₁ ⟩
⌈log₂ ⌊ length l /2⌋ ⌉
≤⟨ log₂-mono (N.⌊n/2⌋≤⌈n/2⌉ (length l)) ⟩
⌈log₂ ⌈ length l /2⌉ ⌉
≤⟨ log₂-suc (length l) h ⟩
k
∎
) u in
let (l₂' , ≡₂ , ↭₂ , sorted₂) = sort/clocked/correct k l₂ (
let open ≤-Reasoning in
begin
⌈log₂ length l₂ ⌉
≡⟨ Eq.cong ⌈log₂_⌉ length₂ ⟩
⌈log₂ ⌈ length l /2⌉ ⌉
≤⟨ log₂-suc (length l) h ⟩
k
∎
) u in
let (l' , ≡' , h-sorted) = merge/correct l₁' l₂' u
(↭' , sorted) = h-sorted sorted₁ sorted₂
in
l' , (
let open ≡-Reasoning in
begin
sort/clocked (suc k) l
≡⟨⟩
(bind (F (list A)) (split l) λ (l₁ , l₂) →
bind (F (list A)) (sort/clocked k l₁ & sort/clocked k l₂) merge)
≡⟨ Eq.cong (λ e → bind (F (list A)) e _) ≡ ⟩
bind (F (list A)) (sort/clocked k l₁ & sort/clocked k l₂) merge
≡⟨ Eq.cong (λ e → bind (F (list A)) e merge) (Eq.cong₂ _&_ ≡₁ ≡₂) ⟩
merge (l₁' , l₂')
≡⟨ ≡' ⟩
ret l'
∎
) , (
let open PermutationReasoning in
begin
l
↭⟨ ↭ ⟩
l₁ ++ l₂
↭⟨ ++⁺-↭ ↭₁ ↭₂ ⟩
l₁' ++ l₂'
↭⟨ ↭' ⟩
l'
∎
) , sorted
sort/clocked/cost : cmp (Π nat λ _ → Π (list A) λ _ → cost)
sort/clocked/cost zero l = 𝟘
sort/clocked/cost (suc k) l =
bind cost (split l) λ (l₁ , l₂) → split/cost l ⊕
bind cost (sort/clocked k l₁ & sort/clocked k l₂) λ (l₁' , l₂') → (sort/clocked/cost k l₁ ⊗ sort/clocked/cost k l₂) ⊕
merge/cost/closed (l₁' , l₂')
sort/clocked/cost/closed : cmp (Π nat λ _ → Π (list A) λ _ → cost)
sort/clocked/cost/closed k l = k * length l * ⌈log₂ suc ⌈ length l /2⌉ ⌉ , k * ⌈log₂ suc ⌈ length l /2⌉ ⌉ ²
sort/clocked/cost≤sort/clocked/cost/closed : ∀ k l → ⌈log₂ length l ⌉ Nat.≤ k → ◯ (sort/clocked/cost k l ≤ₚ sort/clocked/cost/closed k l)
sort/clocked/cost≤sort/clocked/cost/closed zero l h u = z≤n , z≤n
sort/clocked/cost≤sort/clocked/cost/closed (suc k) l h u =
let (l₁ , l₂ , ≡ , length₁ , length₂ , ↭) = split/correct l u in
let h₁ : ⌈log₂ length l₁ ⌉ Nat.≤ k
h₁ =
let open ≤-Reasoning in
begin
⌈log₂ length l₁ ⌉
≡⟨ Eq.cong ⌈log₂_⌉ length₁ ⟩
⌈log₂ ⌊ length l /2⌋ ⌉
≤⟨ log₂-mono (N.⌊n/2⌋≤⌈n/2⌉ (length l)) ⟩
⌈log₂ ⌈ length l /2⌉ ⌉
≤⟨ log₂-suc (length l) h ⟩
k
∎
h₂ : ⌈log₂ length l₂ ⌉ Nat.≤ k
h₂ =
let open ≤-Reasoning in
begin
⌈log₂ length l₂ ⌉
≡⟨ Eq.cong ⌈log₂_⌉ length₂ ⟩
⌈log₂ ⌈ length l /2⌉ ⌉
≤⟨ log₂-suc (length l) h ⟩
k
∎
in
let (l₁' , ≡₁ , ↭₁ , sorted₁) = sort/clocked/correct k l₁ h₁ u in
let (l₂' , ≡₂ , ↭₂ , sorted₂) = sort/clocked/correct k l₂ h₂ u in
let open ≤ₚ-Reasoning in
begin
sort/clocked/cost (suc k) l
≡⟨⟩
(bind cost (split l) λ (l₁ , l₂) → split/cost l ⊕
bind cost (sort/clocked k l₁ & sort/clocked k l₂) λ (l₁' , l₂') → (sort/clocked/cost k l₁ ⊗ sort/clocked/cost k l₂) ⊕
merge/cost/closed (l₁' , l₂'))
≡⟨ Eq.cong (λ e → bind cost e _) (≡) ⟩
(split/cost l ⊕
bind cost (sort/clocked k l₁ & sort/clocked k l₂) λ (l₁' , l₂') → (sort/clocked/cost k l₁ ⊗ sort/clocked/cost k l₂) ⊕
merge/cost/closed (l₁' , l₂'))
≡⟨⟩
(𝟘 ⊕
bind cost (sort/clocked k l₁ & sort/clocked k l₂) λ (l₁' , l₂') → (sort/clocked/cost k l₁ ⊗ sort/clocked/cost k l₂) ⊕
merge/cost/closed (l₁' , l₂'))
≡⟨ ⊕-identityˡ _ ⟩
(bind cost (sort/clocked k l₁ & sort/clocked k l₂) λ (l₁' , l₂') → (sort/clocked/cost k l₁ ⊗ sort/clocked/cost k l₂) ⊕
merge/cost/closed (l₁' , l₂'))
≡⟨
Eq.cong (λ e → bind cost e λ (l₁' , l₂') → (sort/clocked/cost k l₁ ⊗ sort/clocked/cost k l₂) ⊕ merge/cost/closed (l₁' , l₂')) (
Eq.cong₂ _&_
≡₁
≡₂
)
⟩
(sort/clocked/cost k l₁ ⊗ sort/clocked/cost k l₂) ⊕ merge/cost/closed (l₁' , l₂')
≤⟨
⊕-monoˡ-≤ (merge/cost/closed (l₁' , l₂')) (
⊗-mono-≤
(sort/clocked/cost≤sort/clocked/cost/closed k l₁ h₁ u)
(sort/clocked/cost≤sort/clocked/cost/closed k l₂ h₂ u)
)
⟩
(sort/clocked/cost/closed k l₁ ⊗ sort/clocked/cost/closed k l₂) ⊕ merge/cost/closed (l₁' , l₂')
≡⟨⟩
(sort/clocked/cost/closed k l₁ ⊗ sort/clocked/cost/closed k l₂) ⊕
(pred[2^ ⌈log₂ suc (length l₁') ⌉ ] * ⌈log₂ suc (length l₂') ⌉ , ⌈log₂ suc (length l₁') ⌉ * ⌈log₂ suc (length l₂') ⌉)
≡˘⟨
Eq.cong ((sort/clocked/cost/closed k l₁ ⊗ sort/clocked/cost/closed k l₂) ⊕_) (
Eq.cong₂ (λ n₁ n₂ → pred[2^ ⌈log₂ suc n₁ ⌉ ] * ⌈log₂ suc n₂ ⌉ , ⌈log₂ suc n₁ ⌉ * ⌈log₂ suc n₂ ⌉)
(↭-length ↭₁)
(↭-length ↭₂)
)
⟩
(sort/clocked/cost/closed k l₁ ⊗ sort/clocked/cost/closed k l₂) ⊕
(pred[2^ ⌈log₂ suc (length l₁) ⌉ ] * ⌈log₂ suc (length l₂) ⌉ , ⌈log₂ suc (length l₁) ⌉ * ⌈log₂ suc (length l₂) ⌉)
≡⟨⟩
((k * length l₁ * ⌈log₂ suc ⌈ length l₁ /2⌉ ⌉ , k * ⌈log₂ suc ⌈ length l₁ /2⌉ ⌉ ²) ⊗
(k * length l₂ * ⌈log₂ suc ⌈ length l₂ /2⌉ ⌉ , k * ⌈log₂ suc ⌈ length l₂ /2⌉ ⌉ ²)) ⊕
(pred[2^ ⌈log₂ suc (length l₁) ⌉ ] * ⌈log₂ suc (length l₂) ⌉ , ⌈log₂ suc (length l₁) ⌉ * ⌈log₂ suc (length l₂) ⌉)
≡⟨
Eq.cong₂ (
λ n₁ n₂ →
((k * n₁ * ⌈log₂ suc ⌈ n₁ /2⌉ ⌉ , k * ⌈log₂ suc ⌈ n₁ /2⌉ ⌉ ²) ⊗
(k * n₂ * ⌈log₂ suc ⌈ n₂ /2⌉ ⌉ , k * ⌈log₂ suc ⌈ n₂ /2⌉ ⌉ ²)) ⊕
(pred[2^ ⌈log₂ suc (n₁) ⌉ ] * ⌈log₂ suc (n₂) ⌉ , ⌈log₂ suc (n₁) ⌉ * ⌈log₂ suc (n₂) ⌉)
)
length₁
length₂
⟩
((k * ⌊ length l /2⌋ * ⌈log₂ suc ⌈ ⌊ length l /2⌋ /2⌉ ⌉ , k * ⌈log₂ suc ⌈ ⌊ length l /2⌋ /2⌉ ⌉ ²) ⊗
(k * ⌈ length l /2⌉ * ⌈log₂ suc ⌈ ⌈ length l /2⌉ /2⌉ ⌉ , k * ⌈log₂ suc ⌈ ⌈ length l /2⌉ /2⌉ ⌉ ²)) ⊕
(pred[2^ ⌈log₂ suc ⌊ length l /2⌋ ⌉ ] * ⌈log₂ suc ⌈ length l /2⌉ ⌉ , ⌈log₂ suc ⌊ length l /2⌋ ⌉ * ⌈log₂ suc ⌈ length l /2⌉ ⌉)
≤⟨
⊕-mono-≤
(
let h-⌊n/2⌋ = log₂-mono (s≤s (N.⌈n/2⌉-mono (N.⌊n/2⌋≤n (length l))))
h-⌈n/2⌉ = log₂-mono (s≤s (N.⌈n/2⌉-mono (N.⌈n/2⌉≤n (length l)))) in
⊗-mono-≤
(N.*-monoʳ-≤ (k * ⌊ length l /2⌋) h-⌊n/2⌋ , N.*-monoʳ-≤ k (²-mono h-⌊n/2⌋))
(N.*-monoʳ-≤ (k * ⌈ length l /2⌉) h-⌈n/2⌉ , N.*-monoʳ-≤ k (²-mono h-⌈n/2⌉))
)
(
let h = log₂-mono (s≤s (N.⌊n/2⌋≤⌈n/2⌉ (length l))) in
N.*-monoˡ-≤ ⌈log₂ suc ⌈ length l /2⌉ ⌉ (pred[2^]-mono h) ,
N.*-monoˡ-≤ ⌈log₂ suc ⌈ length l /2⌉ ⌉ h
)
⟩
((k * ⌊ length l /2⌋ * ⌈log₂ suc ⌈ length l /2⌉ ⌉ , k * ⌈log₂ suc ⌈ length l /2⌉ ⌉ ²) ⊗
(k * ⌈ length l /2⌉ * ⌈log₂ suc ⌈ length l /2⌉ ⌉ , k * ⌈log₂ suc ⌈ length l /2⌉ ⌉ ²)) ⊕
(pred[2^ ⌈log₂ suc ⌈ length l /2⌉ ⌉ ] * ⌈log₂ suc ⌈ length l /2⌉ ⌉ , ⌈log₂ suc ⌈ length l /2⌉ ⌉ ²)
≤⟨
arithmetic/work (length l) ,
(N.≤-reflexive (arithmetic/span (⌈log₂ suc ⌈ length l /2⌉ ⌉ ²)))
⟩
suc k * length l * ⌈log₂ suc ⌈ length l /2⌉ ⌉ , suc k * ⌈log₂ suc ⌈ length l /2⌉ ⌉ ²
≡⟨⟩
sort/clocked/cost/closed (suc k) l
∎
where
arithmetic/work : (n : ℕ) →
(k * ⌊ n /2⌋ * ⌈log₂ suc ⌈ n /2⌉ ⌉ + k * ⌈ n /2⌉ * ⌈log₂ suc ⌈ n /2⌉ ⌉)
+ pred[2^ ⌈log₂ suc ⌈ n /2⌉ ⌉ ] * ⌈log₂ suc ⌈ n /2⌉ ⌉
Nat.≤ suc k * n * ⌈log₂ suc ⌈ n /2⌉ ⌉
arithmetic/work n =
begin
(k * ⌊ n /2⌋ * ⌈log₂ suc ⌈ n /2⌉ ⌉ + k * ⌈ n /2⌉ * ⌈log₂ suc ⌈ n /2⌉ ⌉)
+ pred[2^ ⌈log₂ suc ⌈ n /2⌉ ⌉ ] * ⌈log₂ suc ⌈ n /2⌉ ⌉
≡⟨
Eq.cong
(_+ pred[2^ ⌈log₂ suc ⌈ n /2⌉ ⌉ ] * ⌈log₂ suc ⌈ n /2⌉ ⌉)
(Eq.cong₂ _+_
(N.*-assoc k ⌊ n /2⌋ ⌈log₂ suc ⌈ n /2⌉ ⌉)
(N.*-assoc k ⌈ n /2⌉ ⌈log₂ suc ⌈ n /2⌉ ⌉))
⟩
(k * (⌊ n /2⌋ * ⌈log₂ suc ⌈ n /2⌉ ⌉) + k * (⌈ n /2⌉ * ⌈log₂ suc ⌈ n /2⌉ ⌉))
+ pred[2^ ⌈log₂ suc ⌈ n /2⌉ ⌉ ] * ⌈log₂ suc ⌈ n /2⌉ ⌉
≡˘⟨
Eq.cong (_+ pred[2^ ⌈log₂ suc ⌈ n /2⌉ ⌉ ] * ⌈log₂ suc ⌈ n /2⌉ ⌉) (
N.*-distribˡ-+ k (⌊ n /2⌋ * ⌈log₂ suc ⌈ n /2⌉ ⌉) (⌈ n /2⌉ * ⌈log₂ suc ⌈ n /2⌉ ⌉)
)
⟩
k * (⌊ n /2⌋ * ⌈log₂ suc ⌈ n /2⌉ ⌉ + ⌈ n /2⌉ * ⌈log₂ suc ⌈ n /2⌉ ⌉)
+ pred[2^ ⌈log₂ suc ⌈ n /2⌉ ⌉ ] * ⌈log₂ suc ⌈ n /2⌉ ⌉
≡˘⟨
Eq.cong
(λ m → k * m + pred[2^ ⌈log₂ suc ⌈ n /2⌉ ⌉ ] * ⌈log₂ suc ⌈ n /2⌉ ⌉)
(N.*-distribʳ-+ ⌈log₂ suc ⌈ n /2⌉ ⌉ ⌊ n /2⌋ ⌈ n /2⌉)
⟩
k * ((⌊ n /2⌋ + ⌈ n /2⌉) * ⌈log₂ suc ⌈ n /2⌉ ⌉) + pred[2^ ⌈log₂ suc ⌈ n /2⌉ ⌉ ] * ⌈log₂ suc ⌈ n /2⌉ ⌉
≡⟨
Eq.cong
(λ m → k * (m * ⌈log₂ suc ⌈ n /2⌉ ⌉) + pred[2^ ⌈log₂ suc ⌈ n /2⌉ ⌉ ] * ⌈log₂ suc ⌈ n /2⌉ ⌉)
(N.⌊n/2⌋+⌈n/2⌉≡n n)
⟩
k * (n * ⌈log₂ suc ⌈ n /2⌉ ⌉) + pred[2^ ⌈log₂ suc ⌈ n /2⌉ ⌉ ] * ⌈log₂ suc ⌈ n /2⌉ ⌉
≤⟨ N.+-monoʳ-≤ (k * (n * ⌈log₂ suc ⌈ n /2⌉ ⌉)) (N.*-monoˡ-≤ ⌈log₂ suc ⌈ n /2⌉ ⌉ (pred[2^log₂] n)) ⟩
k * (n * ⌈log₂ suc ⌈ n /2⌉ ⌉) + n * ⌈log₂ suc ⌈ n /2⌉ ⌉
≡⟨ N.+-comm (k * (n * ⌈log₂ suc ⌈ n /2⌉ ⌉)) (n * ⌈log₂ suc ⌈ n /2⌉ ⌉) ⟩
n * ⌈log₂ suc ⌈ n /2⌉ ⌉ + k * (n * ⌈log₂ suc ⌈ n /2⌉ ⌉)
≡⟨⟩
suc k * (n * ⌈log₂ suc ⌈ n /2⌉ ⌉)
≡˘⟨ N.*-assoc (suc k) n ⌈log₂ suc ⌈ n /2⌉ ⌉ ⟩
suc k * n * ⌈log₂ suc ⌈ n /2⌉ ⌉
∎
where open ≤-Reasoning
arithmetic/span : (n : ℕ) → ((k * n) ⊔ (k * n)) + n ≡ suc k * n
arithmetic/span n =
begin
((k * n) ⊔ (k * n)) + n
≡⟨ Eq.cong (_+ n) (N.⊔-idem (k * n)) ⟩
k * n + n
≡⟨ N.+-comm (k * n) n ⟩
n + k * n
≡⟨⟩
suc k * n
∎
where open ≡-Reasoning
sort/clocked≤sort/clocked/cost : ∀ k l → IsBounded (list A) (sort/clocked k l) (sort/clocked/cost k l)
sort/clocked≤sort/clocked/cost zero l = bound/ret
sort/clocked≤sort/clocked/cost (suc k) l =
bound/bind (split/cost l) _ (split≤split/cost l) λ (l₁ , l₂) →
bound/bind (sort/clocked/cost k l₁ ⊗ sort/clocked/cost k l₂) _ (bound/par (sort/clocked≤sort/clocked/cost k l₁) (sort/clocked≤sort/clocked/cost k l₂)) λ (l₁' , l₂') →
merge≤merge/cost/closed l₁' l₂'
sort/clocked≤sort/clocked/cost/closed : ∀ k l → ⌈log₂ length l ⌉ Nat.≤ k → IsBounded (list A) (sort/clocked k l) (sort/clocked/cost/closed k l)
sort/clocked≤sort/clocked/cost/closed k l h = bound/relax (sort/clocked/cost≤sort/clocked/cost/closed k l h) (sort/clocked≤sort/clocked/cost k l)
sort/depth : cmp (Π (list A) λ _ → meta ℕ)
sort/depth l = ⌈log₂ length l ⌉
sort : cmp (Π (list A) λ _ → F (list A))
sort l = sort/clocked (sort/depth l) l
sort/correct : IsSort sort
sort/correct l = sort/clocked/correct (sort/depth l) l N.≤-refl
sort/cost : cmp (Π (list A) λ _ → cost)
sort/cost l = sort/clocked/cost (sort/depth l) l
sort/cost/closed : cmp (Π (list A) λ _ → cost)
sort/cost/closed l = sort/clocked/cost/closed (sort/depth l) l
sort≤sort/cost : ∀ l → IsBounded (list A) (sort l) (sort/cost l)
sort≤sort/cost l = sort/clocked≤sort/clocked/cost (sort/depth l) l
sort≤sort/cost/closed : ∀ l → IsBounded (list A) (sort l) (sort/cost/closed l)
sort≤sort/cost/closed l = sort/clocked≤sort/clocked/cost/closed (sort/depth l) l N.≤-refl
sort/asymptotic : given (list A) measured-via length , sort ∈𝓞(λ n → n * ⌈log₂ n ⌉ ² , ⌈log₂ n ⌉ ^ 3)
sort/asymptotic = 2 ≤n⇒f[n]≤g[n]via λ l h →
bound/relax
(λ u → let open ≤-Reasoning in
(
begin
⌈log₂ length l ⌉ * length l * ⌈log₂ suc ⌈ length l /2⌉ ⌉
≤⟨ N.*-monoʳ-≤ (⌈log₂ length l ⌉ * length l) (lemma (length l) h) ⟩
⌈log₂ length l ⌉ * length l * ⌈log₂ length l ⌉
≡⟨ N.*-assoc ⌈log₂ length l ⌉ (length l) ⌈log₂ length l ⌉ ⟩
⌈log₂ length l ⌉ * (length l * ⌈log₂ length l ⌉)
≡⟨ N.*-comm ⌈log₂ length l ⌉ (length l * ⌈log₂ length l ⌉) ⟩
length l * ⌈log₂ length l ⌉ * ⌈log₂ length l ⌉
≡⟨ N.*-assoc (length l) ⌈log₂ length l ⌉ ⌈log₂ length l ⌉ ⟩
length l * ⌈log₂ length l ⌉ ²
∎
) , (
begin
⌈log₂ length l ⌉ * ⌈log₂ suc ⌈ length l /2⌉ ⌉ ²
≤⟨ N.*-monoʳ-≤ ⌈log₂ length l ⌉ (²-mono (lemma (length l) h)) ⟩
⌈log₂ length l ⌉ * ⌈log₂ length l ⌉ ²
≡⟨⟩
⌈log₂ length l ⌉ * (⌈log₂ length l ⌉ * ⌈log₂ length l ⌉)
≡˘⟨ Eq.cong (λ n → ⌈log₂ length l ⌉ * (⌈log₂ length l ⌉ * n)) (N.*-identityʳ _) ⟩
⌈log₂ length l ⌉ * (⌈log₂ length l ⌉ * (⌈log₂ length l ⌉ * 1))
≡⟨⟩
⌈log₂ length l ⌉ ^ 3
∎
)
)
(sort≤sort/cost/closed l)
where
lemma : ∀ n → 2 Nat.≤ n → ⌈log₂ suc ⌈ n /2⌉ ⌉ Nat.≤ ⌈log₂ n ⌉
lemma (suc (suc n)) (s≤s (s≤s h)) = log₂-mono (s≤s (s≤s (N.⌈n/2⌉≤n n)))
| {
"alphanum_fraction": 0.4858346355,
"avg_line_length": 42.5404624277,
"ext": "agda",
"hexsha": "f7a849455a46e9b1204b6773afab4960c6dd2f04",
"lang": "Agda",
"max_forks_count": 2,
"max_forks_repo_forks_event_max_datetime": "2022-01-29T08:12:01.000Z",
"max_forks_repo_forks_event_min_datetime": "2021-10-06T10:28:24.000Z",
"max_forks_repo_head_hexsha": "e51606f9ca18d8b4cf9a63c2d6caa2efc5516146",
"max_forks_repo_licenses": [
"Apache-2.0"
],
"max_forks_repo_name": "jonsterling/agda-calf",
"max_forks_repo_path": "src/Examples/Sorting/Parallel/MergeSortPar.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "e51606f9ca18d8b4cf9a63c2d6caa2efc5516146",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"Apache-2.0"
],
"max_issues_repo_name": "jonsterling/agda-calf",
"max_issues_repo_path": "src/Examples/Sorting/Parallel/MergeSortPar.agda",
"max_line_length": 170,
"max_stars_count": 29,
"max_stars_repo_head_hexsha": "e51606f9ca18d8b4cf9a63c2d6caa2efc5516146",
"max_stars_repo_licenses": [
"Apache-2.0"
],
"max_stars_repo_name": "jonsterling/agda-calf",
"max_stars_repo_path": "src/Examples/Sorting/Parallel/MergeSortPar.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": 7167,
"size": 14719
} |
{-# OPTIONS --without-K #-}
module Model.Exponential where
open import Cats.Category
open import Model.RGraph as RG using (RGraph)
open import Model.Type.Core
open import Model.Product
open import Util.HoTT.HLevel
open import Util.Prelude hiding (_×_ ; id ; _∘_)
open RGraph
open RG._⇒_
private
variable Δ : RGraph
infixr 9 _↝_
Ap : ⟦Type⟧ Δ → Δ .Obj → RGraph
Ap {Δ} T δ = record
{ ObjHSet = T .ObjHSet δ
; eqHProp = eqHProp T (Δ .eq-refl _)
; eq-refl = λ x → T .eq-refl x
}
_↝_ : (T U : ⟦Type⟧ Δ) → ⟦Type⟧ Δ
_↝_ T U = record
{ ObjHSet = λ γ → HLevel⁺ (Ap T γ RG.⇒ Ap U γ) (RG.⇒-IsSet {Ap T γ} {Ap U γ})
; eqHProp = λ γ≈γ′ f g
→ ∀∙-HProp λ x
→ ∀∙-HProp λ y
→ T .eqHProp γ≈γ′ x y →-HProp′ U .eqHProp γ≈γ′ (f .RG.fobj x) (g .RG.fobj y)
; eq-refl = λ f → f .RG.feq
}
curry : (T U V : ⟦Type⟧ Δ)
→ T × U ⇒ V → T ⇒ U ↝ V
curry {Δ} T U V f = record
{ fobj = λ {δ} t → record
{ fobj = λ u → f .fobj (t , u)
; feq = λ x≈y → f .feq (Δ .eq-refl δ) (T .eq-refl t , x≈y)
}
; feq = λ γ≈γ′ x≈y v≈w → f .feq γ≈γ′ (x≈y , v≈w)
}
eval : (T U : ⟦Type⟧ Δ)
→ (T ↝ U) × T ⇒ U
eval T U = record
{ fobj = λ { (f , x) → f .RG.fobj x }
; feq = λ { γ≈γ′ (f≈g , x≈y) → f≈g x≈y }
}
eval∘curry : (T U V : ⟦Type⟧ Δ) {f : T × U ⇒ V}
→ eval U V ∘ ⟨_×_⟩ {B = U} (curry T U V f) id ≈ f
eval∘curry T U V = ≈⁺ λ γ x → refl
instance
hasExponentials : ∀ {Δ} → HasExponentials (⟦Types⟧ Δ)
hasExponentials .HasExponentials.hasBinaryProducts = hasBinaryProducts
hasExponentials .HasExponentials._↝′_ T U = record
{ Cᴮ = T ↝ U
; eval = eval T U
; curry′ = λ {A} f → record
{ arr = curry A T U f
; prop = eval∘curry A T U
; unique = λ {g} g-prop → ≈⁺ λ γ h → RG.≈→≡ (RG.≈⁺ λ x
→ sym (g-prop .≈⁻ γ (h , x)))
}
}
module ⟦Types⟧↝ {Δ} = HasExponentials (hasExponentials {Δ})
↝-resp-≈⟦Type⟧ : ∀ {Δ} (T T′ U U′ : ⟦Type⟧ Δ)
→ T ≈⟦Type⟧ T′
→ U ≈⟦Type⟧ U′
→ T ↝ U ≈⟦Type⟧ T′ ↝ U′
↝-resp-≈⟦Type⟧ {Δ} T T′ U U′ T≈T′ U≈U′
= ⟦Types⟧↝.↝-resp-≅ {Δ} {T} {T′} {U} {U′} T≈T′ U≈U′
subT-↝ : ∀ {Γ Δ} (f : Γ RG.⇒ Δ)
→ (T U : ⟦Type⟧ Δ)
→ subT f T ↝ subT f U ≈⟦Type⟧ subT f (T ↝ U)
subT-↝ {Γ} {Δ} f T U = record
{ forth = record
{ fobj = λ g → record
{ fobj = g .fobj
; feq = λ {x y} x≈y → transportEq U (g .feq (transportEq T x≈y))
}
; feq = λ γ≈γ′ f≈g x≈y → f≈g x≈y
}
; back = record
{ fobj = λ g → record
{ fobj = g .fobj
; feq = λ {x y} x≈y → transportEq U (g .feq (transportEq T x≈y))
}
; feq = λ γ≈γ′ f≈g x≈y → f≈g x≈y
}
; back-forth = ≈⁺ λ γ x → RG.≈→≡ (RG.≈⁺ λ y → refl)
; forth-back = ≈⁺ λ γ x → RG.≈→≡ (RG.≈⁺ λ y → refl)
}
| {
"alphanum_fraction": 0.493501671,
"avg_line_length": 23.8318584071,
"ext": "agda",
"hexsha": "ea993be150317c2dca44d02cb7fc8a9e32f128c8",
"lang": "Agda",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "104cddc6b65386c7e121c13db417aebfd4b7a863",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "JLimperg/msc-thesis-code",
"max_forks_repo_path": "src/Model/Exponential.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "104cddc6b65386c7e121c13db417aebfd4b7a863",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "JLimperg/msc-thesis-code",
"max_issues_repo_path": "src/Model/Exponential.agda",
"max_line_length": 82,
"max_stars_count": 5,
"max_stars_repo_head_hexsha": "104cddc6b65386c7e121c13db417aebfd4b7a863",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "JLimperg/msc-thesis-code",
"max_stars_repo_path": "src/Model/Exponential.agda",
"max_stars_repo_stars_event_max_datetime": "2021-06-26T06:37:31.000Z",
"max_stars_repo_stars_event_min_datetime": "2021-04-13T21:31:17.000Z",
"num_tokens": 1360,
"size": 2693
} |
------------------------------------------------------------------------
-- Simple expressions
------------------------------------------------------------------------
-- Several examples based on Matsuda and Wang's "FliPpr: A Prettier
-- Invertible Printing System".
{-# OPTIONS --guardedness #-}
module Examples.Expression where
open import Algebra
open import Codata.Musical.Notation
open import Data.List
open import Data.List.Properties
open import Data.Product
open import Data.Unit
open import Function
open import Relation.Binary.PropositionalEquality as P using (_≡_; refl)
private
module LM {A : Set} = Monoid (++-monoid A)
open import Examples.Identifier
import Grammar.Infinite as Grammar
import Pretty
open import Renderer
open import Utilities
-- Very simple expressions.
module Expression₁ where
data Expr : Set where
one : Expr
sub : Expr → Expr → Expr
module _ where
open Grammar
mutual
expr : Grammar Expr
expr = term
∣ sub <$> ♯ expr
<⊛ whitespace ⋆
<⊛ string′ "-"
<⊛ whitespace ⋆
⊛ term
term : Grammar Expr
term = one <$ string′ "1"
∣ string′ "("
⊛> whitespace ⋆
⊛> ♯ expr
<⊛ whitespace ⋆
<⊛ string′ ")"
open Pretty
one-doc : Doc term one
one-doc = left (<$ text)
mutual
expr-printer : Pretty-printer expr
expr-printer one = left one-doc
expr-printer (sub e₁ e₂) =
group (right (<$> expr-printer e₁ <⊛-tt
nest 2 line⋆ <⊛ text <⊛ space ⊛
nest 2 (term-printer e₂)))
term-printer : Pretty-printer term
term-printer one = one-doc
term-printer e =
right (text ⊛> nil-⋆ ⊛> expr-printer e <⊛ nil-⋆ <⊛ text)
example : Expr
example = sub (sub one one) (sub one one)
test₁ : render 80 (expr-printer example) ≡ "1 - 1 - (1 - 1)"
test₁ = refl
test₂ : render 11 (expr-printer example) ≡ "1 - 1\n - (1 - 1)"
test₂ = refl
test₃ : render 8 (expr-printer example) ≡ "1 - 1\n - (1\n - 1)"
test₃ = refl
-- Expression₁.expr does not accept final whitespace. The grammar
-- below does.
module Expression₂ where
open Expression₁ using (Expr; one; sub; example)
module _ where
open Grammar
mutual
expr : Grammar Expr
expr = term
∣ sub <$> ♯ expr <⊛ symbol′ "-" ⊛ term
term : Grammar Expr
term = one <$ symbol′ "1"
∣ symbol′ "(" ⊛> ♯ expr <⊛ symbol′ ")"
private
-- A manual proof of Trailing-whitespace expr (included for
-- illustrative purposes; not used below).
Trailing-whitespace″ : ∀ {A} → Grammar A → Set₁
Trailing-whitespace″ g =
∀ {x s s₁ s₂} →
x ∈ g · s₁ → s ∈ whitespace ⋆ · s₂ → x ∈ g · s₁ ++ s₂
tw′-whitespace : Trailing-whitespace′ (whitespace ⋆)
tw′-whitespace ⋆-[]-sem w = _ , w
tw′-whitespace (⋆-+-sem (⊛-sem {s₁ = s₁} (<$>-sem p) q)) w
with tw′-whitespace q w
... | _ , r = _ , cast (P.sym $ LM.assoc s₁ _ _)
(⋆-+-sem (⊛-sem (<$>-sem p) r))
tw″-symbol : ∀ {s} → Trailing-whitespace″ (symbol s)
tw″-symbol (<⊛-sem {s₁ = s₁} p q) w =
cast (P.sym $ LM.assoc s₁ _ _)
(<⊛-sem p (proj₂ (tw′-whitespace q w)))
tw″-term : Trailing-whitespace″ term
tw″-term (left-sem (<$-sem p)) w =
left-sem (<$-sem (tw″-symbol p w))
tw″-term (right-sem (<⊛-sem {s₁ = s₁} p q)) w =
cast (P.sym $ LM.assoc s₁ _ _)
(right-sem (<⊛-sem p (tw″-symbol q w)))
tw″-expr : Trailing-whitespace″ expr
tw″-expr (left-sem p) w =
left-sem (tw″-term p w)
tw″-expr (right-sem (⊛-sem {s₁ = s₁} p q)) w =
cast (P.sym $ LM.assoc s₁ _ _)
(right-sem (⊛-sem p (tw″-term q w)))
tw-expr : Trailing-whitespace expr
tw-expr (<⊛-sem p w) = tw″-expr p w
open Pretty
one-doc : Doc term one
one-doc = left (<$ symbol)
mutual
expr-printer : Pretty-printer expr
expr-printer one = left one-doc
expr-printer (sub e₁ e₂) =
group (right (<$> final-line 6 (expr-printer e₁) 2 <⊛
symbol-space ⊛ nest 2 (term-printer e₂)))
term-printer : Pretty-printer term
term-printer one = one-doc
term-printer e = right (symbol ⊛> expr-printer e <⊛ symbol)
test₁ : render 80 (expr-printer example) ≡ "1 - 1 - (1 - 1)"
test₁ = refl
test₂ : render 11 (expr-printer example) ≡ "1 - 1\n - (1 - 1)"
test₂ = refl
test₃ : render 8 (expr-printer example) ≡ "1 - 1\n - (1\n - 1)"
test₃ = refl
-- A somewhat larger expression example.
module Expression₃ where
-- Expressions.
data Expr : Set where
one : Expr
sub : Expr → Expr → Expr
div : Expr → Expr → Expr
var : Identifier → Expr
-- Precedences.
data Prec : Set where
′5 ′6 ′7 : Prec
module _ where
open Grammar
-- One expression grammar for each precedence level.
expr : Prec → Grammar Expr
expr ′5 = ♯ expr ′6
∣ sub <$> ♯ expr ′5 <⊛ symbol′ "-" ⊛ ♯ expr ′6
expr ′6 = ♯ expr ′7
∣ div <$> ♯ expr ′6 <⊛ symbol′ "/" ⊛ ♯ expr ′7
expr ′7 = one <$ symbol′ "1"
∣ var <$> identifier-w
∣ symbol′ "(" ⊛> ♯ expr ′5 <⊛ symbol′ ")"
open Pretty
-- Document for one.
one-doc : Doc (expr ′7) one
one-doc = left (left (<$ symbol))
-- Documents for variables.
var-doc : ∀ x → Doc (expr ′7) (var x)
var-doc x = left (right (<$> identifier-w-printer x))
-- Adds parentheses to a document.
parens : ∀ {e} → Doc (expr ′5) e → Doc (expr ′7) e
parens d = right (symbol ⊛> d <⊛ symbol)
-- Adds parentheses only when necessary (when p₁ < p₂).
parens-if[_<_] : ∀ p₁ p₂ {e} → Doc (expr p₁) e → Doc (expr p₂) e
parens-if[ ′5 < ′5 ] = id
parens-if[ ′5 < ′6 ] = left ∘ parens
parens-if[ ′5 < ′7 ] = parens
parens-if[ ′6 < ′5 ] = left
parens-if[ ′6 < ′6 ] = id
parens-if[ ′6 < ′7 ] = parens ∘ left
parens-if[ ′7 < ′5 ] = left ∘ left
parens-if[ ′7 < ′6 ] = left
parens-if[ ′7 < ′7 ] = id
mutual
-- Pretty-printers.
expr-printer : ∀ p → Pretty-printer (expr p)
expr-printer p (sub e₁ e₂) = parens-if[ ′5 < p ] (sub-printer e₁ e₂)
expr-printer p (div e₁ e₂) = parens-if[ ′6 < p ] (div-printer e₁ e₂)
expr-printer p one = parens-if[ ′7 < p ] one-doc
expr-printer p (var x) = parens-if[ ′7 < p ] (var-doc x)
sub-printer : ∀ e₁ e₂ → Doc (expr ′5) (sub e₁ e₂)
sub-printer e₁ e₂ =
group (right (<$> final-line 10 (expr-printer ′5 e₁) 2 <⊛
symbol-space ⊛ nest 2 (expr-printer ′6 e₂)))
div-printer : ∀ e₁ e₂ → Doc (expr ′6) (div e₁ e₂)
div-printer e₁ e₂ =
group (right (<$> final-line 10 (expr-printer ′6 e₁) 2 <⊛
symbol-space ⊛ nest 2 (expr-printer ′7 e₂)))
-- Unit tests.
example : Expr
example = sub (div (var (str⁺ "x")) one) (sub one (var (str⁺ "y")))
test₁ : render 80 (expr-printer ′5 example) ≡ "x / 1 - (1 - y)"
test₁ = refl
test₂ : render 11 (expr-printer ′5 example) ≡ "x / 1\n - (1 - y)"
test₂ = refl
test₃ : render 8 (expr-printer ′5 example) ≡ "x / 1\n - (1\n - y)"
test₃ = refl
test₄ : render 11 (expr-printer ′6 example) ≡ "(x / 1\n - (1\n - y))"
test₄ = refl
test₅ : render 12 (expr-printer ′6 example) ≡ "(x / 1\n - (1 - y))"
test₅ = refl
| {
"alphanum_fraction": 0.5317587403,
"avg_line_length": 26.9568345324,
"ext": "agda",
"hexsha": "30435bded91d95ba8cd89facd35a5ddbce4d6e0f",
"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": "b956803ba90b6c5f57bbbaab01bb18485d948492",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "nad/pretty",
"max_forks_repo_path": "Examples/Expression.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "b956803ba90b6c5f57bbbaab01bb18485d948492",
"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/pretty",
"max_issues_repo_path": "Examples/Expression.agda",
"max_line_length": 75,
"max_stars_count": null,
"max_stars_repo_head_hexsha": "b956803ba90b6c5f57bbbaab01bb18485d948492",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "nad/pretty",
"max_stars_repo_path": "Examples/Expression.agda",
"max_stars_repo_stars_event_max_datetime": null,
"max_stars_repo_stars_event_min_datetime": null,
"num_tokens": 2579,
"size": 7494
} |
open import Data.Empty using ( ⊥ ; ⊥-elim )
open import Data.Nat using ( ℕ ; zero ; suc )
open import Data.Product using ( ∃ ; _×_ ; _,_ )
open import FRP.LTL.RSet.Core using ( RSet ; _[_,_⟩ ; _[_,_] ; ⟦_⟧ )
open import FRP.LTL.RSet.Causal using ( _⊵_ ; identity )
open import FRP.LTL.RSet.Stateless using ( _⇒_ )
open import FRP.LTL.RSet.Globally using ( □ )
open import FRP.LTL.RSet.Product using ( _∧_ ; _&&&_ ; fst ; snd )
open import FRP.LTL.Time using
( Time ; _+_ ; _∸_ ; _≤_ ; _<_
; ≤-refl ; _≤-trans_ ; <-impl-≤ ; <-impl-≱ ; _<-transˡ_ ; _<-transʳ_
; ≡-impl-≤ ; +-unit ; _≮[_]_ ; <-wo )
module FRP.LTL.RSet.Decoupled where
infixr 2 _▹_
infixr 3 _⋙ˡ_ _⋙ʳ_ _⋙ˡʳ_
-- Decoupled function space
_▹_ : RSet → RSet → RSet
(A ▹ B) t = ∀ {u} → (t ≤ u) → (A [ t , u ⟩) → B u
-- Upcast a decoupled function to a causal function
couple : ∀ {A B} → ⟦ (A ▹ B) ⇒ (A ⊵ B) ⟧
couple {A} {B} {s} f {u} s≤u σ = f s≤u σ′ where
σ′ : A [ s , u ⟩
σ′ s≤t t<u = σ s≤t (<-impl-≤ t<u)
-- Variants on composition which produce decoupled functions
_beforeˡ_ : ∀ {A s u v} → (A [ s , v ⟩) → (u ≤ v) → (A [ s , u ⟩)
(σ beforeˡ u≤v) s≤t t<u = σ s≤t (t<u <-transˡ u≤v)
_$ˡ_ : ∀ {A B s u} → (A ▹ B) s → (A [ s , u ⟩) → (B [ s , u ])
(f $ˡ σ) s≤t t≤u = f s≤t (σ beforeˡ t≤u)
_⋙ˡ_ : ∀ {A B C} → ⟦ (A ▹ B) ⇒ (B ⊵ C) ⇒ (A ▹ C) ⟧
(f ⋙ˡ g) s≤t σ = g s≤t (f $ˡ σ)
_beforeʳ_ : ∀ {A s u v} → (A [ s , v ⟩) → (u < v) → (A [ s , u ])
(σ beforeʳ u<v) s≤t t≤u = σ s≤t (t≤u <-transʳ u<v)
_$ʳ_ : ∀ {A B s u} → (A ⊵ B) s → (A [ s , u ⟩) → (B [ s , u ⟩)
(f $ʳ σ) s≤t t<u = f s≤t (σ beforeʳ t<u)
_⋙ʳ_ : ∀ {A B C} → ⟦ (A ⊵ B) ⇒ (B ▹ C) ⇒ (A ▹ C) ⟧
(f ⋙ʳ g) s≤t σ = g s≤t (f $ʳ σ)
_⋙ˡʳ_ : ∀ {A B C} → ⟦ (A ▹ B) ⇒ (B ▹ C) ⇒ (A ▹ C) ⟧
(f ⋙ˡʳ g) = (f ⋙ˡ couple g)
-- Fixed points
-- The following type-checks, but fails to pass the termination
-- checker, as the well-ordering on time is not made explicit:
--
-- fix : ∀ {A} → ⟦ (A ▹ A) ⇒ □ A ⟧
-- fix {A} {s} f {u} s≤u = f s≤u (σ u) where
--
-- σ : (u : Time) → A [ s , u ⟩
-- σ u {t} s≤t t<u = f s≤t (σ t)
--
-- To get this to pass the termination checker, we have to
-- be explicit about the induction scheme, which is
-- over < being a well-ordering on an interval.
fix : ∀ {A} → ⟦ (A ▹ A) ⇒ □ A ⟧
fix {A} {s} f {u} s≤u = f s≤u (σ (<-wo s≤u)) where
σ : ∀ {u} → (∃ λ n → (s ≮[ n ] u)) → A [ s , u ⟩
σ (zero , ()) s≤t t<u
σ (suc n , s≮ⁿ⁺¹u) s≤t t<u = f s≤t (σ (n , s≮ⁿ⁺¹u s≤t t<u))
-- Indexed fixed points are derivable from fixed points
ifix : ∀ {A B} → ⟦ ((A ∧ B) ▹ A) ⇒ (B ▹ A) ⟧
ifix {A} {B} {s} f {v} s≤v τ = fix g s≤v ≤-refl where
A′ : RSet
A′ t = (t ≤ v) → A t
g : (A′ ▹ A′) s
g {u} s≤u σ u≤v = f s≤u ρ where
ρ : (A ∧ B) [ s , u ⟩
ρ s≤t t<u = (σ s≤t t<u (<-impl-≤ t<u ≤-trans u≤v) , τ s≤t (t<u <-transˡ u≤v))
-- Loops are derivable from indexed fixed points
loop : ∀ {A B C} → ⟦ ((A ∧ B) ▹ (A ∧ C)) ⇒ (B ▹ C) ⟧
loop f = (couple (ifix (f ⋙ˡ fst)) &&& identity) ⋙ʳ f ⋙ˡ snd
| {
"alphanum_fraction": 0.4888211382,
"avg_line_length": 31.0736842105,
"ext": "agda",
"hexsha": "693ee7e95077c9fffcb1603bf1213c2609433c22",
"lang": "Agda",
"max_forks_count": 3,
"max_forks_repo_forks_event_max_datetime": "2022-03-12T11:39:04.000Z",
"max_forks_repo_forks_event_min_datetime": "2015-03-01T07:33:00.000Z",
"max_forks_repo_head_hexsha": "e88107d7d192cbfefd0a94505e6a5793afe1a7a5",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "agda/agda-frp-ltl",
"max_forks_repo_path": "src/FRP/LTL/RSet/Decoupled.agda",
"max_issues_count": 2,
"max_issues_repo_head_hexsha": "e88107d7d192cbfefd0a94505e6a5793afe1a7a5",
"max_issues_repo_issues_event_max_datetime": "2015-03-02T15:23:53.000Z",
"max_issues_repo_issues_event_min_datetime": "2015-03-01T07:01:31.000Z",
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "agda/agda-frp-ltl",
"max_issues_repo_path": "src/FRP/LTL/RSet/Decoupled.agda",
"max_line_length": 81,
"max_stars_count": 21,
"max_stars_repo_head_hexsha": "e88107d7d192cbfefd0a94505e6a5793afe1a7a5",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "agda/agda-frp-ltl",
"max_stars_repo_path": "src/FRP/LTL/RSet/Decoupled.agda",
"max_stars_repo_stars_event_max_datetime": "2020-06-15T02:51:13.000Z",
"max_stars_repo_stars_event_min_datetime": "2015-07-02T20:25:05.000Z",
"num_tokens": 1524,
"size": 2952
} |
-- Correctness conditions for the boolean AND gate
f : Tensor Real [2] -> Tensor Real [1]
f = evaluate _ _
truthy : Real -> Set
truthy x = x >= 0.5
falsey : Real -> Set
falsey x = x <= 0.5
validInput : Tensor Real [2] -> Set
validInput x = All (λ xi -> 0 <= xi ∧ xi <= 1) x
correctOutput : Tensor Real [2] -> Set
correctOutput x =
let y : Real
y = f x ! 0
in (truthy x!0 and falsey x!1 => truthy y) and
(truthy x!0 and truthy x!1 => truthy y) and
(falsey x!0 and falsey x!1 => truthy y) and
(falsey x!0 and truthy x!1 => truthy y)
correct : ∀ x -> validInput x -> correctOutput x
correct = prove _ _
| {
"alphanum_fraction": 0.6085578447,
"avg_line_length": 24.2692307692,
"ext": "agda",
"hexsha": "73cde6e07405de41d3135c9f4677ca9191c4b910",
"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": "08e31d78d9f02f30e115311cb3bcff6269456023",
"max_forks_repo_licenses": [
"BSD-3-Clause"
],
"max_forks_repo_name": "bobatkey/vehicle",
"max_forks_repo_path": "examples/andGate.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "08e31d78d9f02f30e115311cb3bcff6269456023",
"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": "bobatkey/vehicle",
"max_issues_repo_path": "examples/andGate.agda",
"max_line_length": 50,
"max_stars_count": null,
"max_stars_repo_head_hexsha": "08e31d78d9f02f30e115311cb3bcff6269456023",
"max_stars_repo_licenses": [
"BSD-3-Clause"
],
"max_stars_repo_name": "bobatkey/vehicle",
"max_stars_repo_path": "examples/andGate.agda",
"max_stars_repo_stars_event_max_datetime": null,
"max_stars_repo_stars_event_min_datetime": null,
"num_tokens": 223,
"size": 631
} |
{-# OPTIONS --allow-unsolved-metas #-}
module Sequent where
open import OscarPrelude
open import Formula
infix 15 _╱_
record Sequent : Set
where
constructor _╱_
field
statement : Formula
suppositions : List Formula
open Sequent public
instance EqSequent : Eq Sequent
Eq._==_ EqSequent ( φᵗ₁ ╱ φˢs₁ ) ( φᵗ₂ ╱ φˢs₂ ) = decEq₂ (cong statement) (cong suppositions) (φᵗ₁ ≟ φᵗ₂) (φˢs₁ ≟ φˢs₂)
open import HasNegation
instance HasNegationSequent : HasNegation Sequent
HasNegation.~ HasNegationSequent ( φᵗ ╱ φˢs ) = ~ φᵗ ╱ φˢs
open import 𝓐ssertion
instance 𝓐ssertionSequent : 𝓐ssertion Sequent
𝓐ssertionSequent = record {}
open import HasSatisfaction
instance HasSatisfactionSequent : HasSatisfaction Sequent
HasSatisfaction._⊨_ HasSatisfactionSequent I (φᵗ ╱ φˢs) = I ⊨ φˢs → I ⊨ φᵗ
open import HasDecidableValidation
instance HasDecidableValidationSequent : HasDecidableValidation Sequent
HasDecidableValidationSequent = {!!}
open import HasSubstantiveDischarge
instance HasSubstantiveDischargeSequentSequent : HasSubstantiveDischarge Sequent Sequent
HasSubstantiveDischarge._≽_ HasSubstantiveDischargeSequentSequent (+ᵗ ╱ +ᵖs) (-ᵗ ╱ -ᵖs) = {!!} -- +ᵗ ≽ -ᵗ × +ᵖs ≽ -ᵖs -- use "unification into", from John's "Natural Deduction"
open import HasDecidableSubstantiveDischarge
instance HasDecidableSubstantiveDischargeSequentSequent : HasDecidableSubstantiveDischarge Sequent Sequent
HasDecidableSubstantiveDischarge._≽?_ HasDecidableSubstantiveDischargeSequentSequent = {!!}
| {
"alphanum_fraction": 0.790247161,
"avg_line_length": 30.5510204082,
"ext": "agda",
"hexsha": "bbddbd206a872c09644452b678de227ff8a8631f",
"lang": "Agda",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "52e1cdbdee54d9a8eaee04ee518a0d7f61d25afb",
"max_forks_repo_licenses": [
"RSA-MD"
],
"max_forks_repo_name": "m0davis/oscar",
"max_forks_repo_path": "archive/agda-1/Sequent.agda",
"max_issues_count": 1,
"max_issues_repo_head_hexsha": "52e1cdbdee54d9a8eaee04ee518a0d7f61d25afb",
"max_issues_repo_issues_event_max_datetime": "2019-05-11T23:33:04.000Z",
"max_issues_repo_issues_event_min_datetime": "2019-04-29T00:35:04.000Z",
"max_issues_repo_licenses": [
"RSA-MD"
],
"max_issues_repo_name": "m0davis/oscar",
"max_issues_repo_path": "archive/agda-1/Sequent.agda",
"max_line_length": 176,
"max_stars_count": null,
"max_stars_repo_head_hexsha": "52e1cdbdee54d9a8eaee04ee518a0d7f61d25afb",
"max_stars_repo_licenses": [
"RSA-MD"
],
"max_stars_repo_name": "m0davis/oscar",
"max_stars_repo_path": "archive/agda-1/Sequent.agda",
"max_stars_repo_stars_event_max_datetime": null,
"max_stars_repo_stars_event_min_datetime": null,
"num_tokens": 524,
"size": 1497
} |
{-# OPTIONS --without-K --safe #-}
module Dodo.Binary.Subtraction where
-- Stdlib imports
open import Level using (Level; _⊔_)
open import Relation.Binary using (REL)
-- Local imports
open import Dodo.Binary.Empty using (¬₂_)
open import Dodo.Binary.Intersection using (_∩₂_)
-- # Definitions
infixl 30 _\₂_
_\₂_ : {a b ℓ₀ ℓ₁ : Level} {A : Set a} {B : Set b} → REL A B ℓ₀ → REL A B ℓ₁ → REL A B (ℓ₀ ⊔ ℓ₁)
_\₂_ R Q = R ∩₂ (¬₂ Q)
| {
"alphanum_fraction": 0.6566820276,
"avg_line_length": 22.8421052632,
"ext": "agda",
"hexsha": "83f659746d7cb766718d7c58ebc614ef567e4d29",
"lang": "Agda",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "376f0ccee1e1aa31470890e494bcb534324f598a",
"max_forks_repo_licenses": [
"BSD-3-Clause"
],
"max_forks_repo_name": "sourcedennis/agda-dodo",
"max_forks_repo_path": "src/Dodo/Binary/Subtraction.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "376f0ccee1e1aa31470890e494bcb534324f598a",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"BSD-3-Clause"
],
"max_issues_repo_name": "sourcedennis/agda-dodo",
"max_issues_repo_path": "src/Dodo/Binary/Subtraction.agda",
"max_line_length": 96,
"max_stars_count": null,
"max_stars_repo_head_hexsha": "376f0ccee1e1aa31470890e494bcb534324f598a",
"max_stars_repo_licenses": [
"BSD-3-Clause"
],
"max_stars_repo_name": "sourcedennis/agda-dodo",
"max_stars_repo_path": "src/Dodo/Binary/Subtraction.agda",
"max_stars_repo_stars_event_max_datetime": null,
"max_stars_repo_stars_event_min_datetime": null,
"num_tokens": 154,
"size": 434
} |
{-# OPTIONS --rewriting #-}
module Properties.StrictMode where
import Agda.Builtin.Equality.Rewrite
open import Agda.Builtin.Equality using (_≡_; refl)
open import FFI.Data.Maybe using (Maybe; just; nothing)
open import Luau.Heap using (Heap; Object; function_is_end; defn; alloc; ok; next; lookup-not-allocated) renaming (_≡_⊕_↦_ to _≡ᴴ_⊕_↦_; _[_] to _[_]ᴴ; ∅ to ∅ᴴ)
open import Luau.StrictMode using (Warningᴱ; Warningᴮ; Warningᴼ; Warningᴴᴱ; Warningᴴᴮ; UnallocatedAddress; UnboundVariable; FunctionCallMismatch; app₁; app₂; BinOpWarning; BinOpMismatch₁; BinOpMismatch₂; bin₁; bin₂; BlockMismatch; block₁; return; LocalVarMismatch; local₁; local₂; FunctionDefnMismatch; function₁; function₂; heap; expr; block; addr; +; -; *; /; <; >; <=; >=; ··)
open import Luau.Substitution using (_[_/_]ᴮ; _[_/_]ᴱ; _[_/_]ᴮunless_; var_[_/_]ᴱwhenever_)
open import Luau.Syntax using (Expr; yes; var; val; var_∈_; _⟨_⟩∈_; _$_; addr; number; bool; string; binexp; nil; function_is_end; block_is_end; done; return; local_←_; _∙_; fun; arg; name; ==; ~=)
open import Luau.Type using (Type; strict; nil; _⇒_; none; tgt; _≡ᵀ_; _≡ᴹᵀ_)
open import Luau.TypeCheck(strict) using (_⊢ᴮ_∈_; _⊢ᴱ_∈_; _⊢ᴴᴮ_▷_∈_; _⊢ᴴᴱ_▷_∈_; nil; var; addr; app; function; block; done; return; local; orNone; tgtBinOp)
open import Luau.Var using (_≡ⱽ_)
open import Luau.Addr using (_≡ᴬ_)
open import Luau.VarCtxt using (VarCtxt; ∅; _⋒_; _↦_; _⊕_↦_; _⊝_; ⊕-lookup-miss; ⊕-swap; ⊕-over) renaming (_[_] to _[_]ⱽ)
open import Luau.VarCtxt using (VarCtxt; ∅)
open import Properties.Remember using (remember; _,_)
open import Properties.Equality using (_≢_; sym; cong; trans; subst₁)
open import Properties.Dec using (Dec; yes; no)
open import Properties.Contradiction using (CONTRADICTION)
open import Properties.TypeCheck(strict) using (typeOfᴼ; typeOfᴹᴼ; typeOfⱽ; typeOfᴱ; typeOfᴮ; typeCheckᴱ; typeCheckᴮ; typeCheckᴼ; typeCheckᴴᴱ; typeCheckᴴᴮ; mustBeFunction; mustBeNumber; mustBeString)
open import Luau.OpSem using (_⟦_⟧_⟶_; _⊢_⟶*_⊣_; _⊢_⟶ᴮ_⊣_; _⊢_⟶ᴱ_⊣_; app₁; app₂; function; beta; return; block; done; local; subst; binOp₀; binOp₁; binOp₂; refl; step; +; -; *; /; <; >; ==; ~=; <=; >=; ··)
open import Luau.RuntimeError using (BinOpError; RuntimeErrorᴱ; RuntimeErrorᴮ; FunctionMismatch; BinOpMismatch₁; BinOpMismatch₂; UnboundVariable; SEGV; app₁; app₂; bin₁; bin₂; block; local; return; +; -; *; /; <; >; <=; >=; ··)
open import Luau.RuntimeType using (valueType)
src = Luau.Type.src strict
data _⊑_ (H : Heap yes) : Heap yes → Set where
refl : (H ⊑ H)
snoc : ∀ {H′ a V} → (H′ ≡ᴴ H ⊕ a ↦ V) → (H ⊑ H′)
rednᴱ⊑ : ∀ {H H′ M M′} → (H ⊢ M ⟶ᴱ M′ ⊣ H′) → (H ⊑ H′)
rednᴮ⊑ : ∀ {H H′ B B′} → (H ⊢ B ⟶ᴮ B′ ⊣ H′) → (H ⊑ H′)
rednᴱ⊑ (function a p) = snoc p
rednᴱ⊑ (app₁ s) = rednᴱ⊑ s
rednᴱ⊑ (app₂ p s) = rednᴱ⊑ s
rednᴱ⊑ (beta O v p q) = refl
rednᴱ⊑ (block s) = rednᴮ⊑ s
rednᴱ⊑ (return v) = refl
rednᴱ⊑ done = refl
rednᴱ⊑ (binOp₀ p) = refl
rednᴱ⊑ (binOp₁ s) = rednᴱ⊑ s
rednᴱ⊑ (binOp₂ s) = rednᴱ⊑ s
rednᴮ⊑ (local s) = rednᴱ⊑ s
rednᴮ⊑ (subst v) = refl
rednᴮ⊑ (function a p) = snoc p
rednᴮ⊑ (return s) = rednᴱ⊑ s
data LookupResult (H : Heap yes) a V : Set where
just : (H [ a ]ᴴ ≡ just V) → LookupResult H a V
nothing : (H [ a ]ᴴ ≡ nothing) → LookupResult H a V
lookup-⊑-nothing : ∀ {H H′} a → (H ⊑ H′) → (H′ [ a ]ᴴ ≡ nothing) → (H [ a ]ᴴ ≡ nothing)
lookup-⊑-nothing {H} a refl p = p
lookup-⊑-nothing {H} a (snoc defn) p with a ≡ᴬ next H
lookup-⊑-nothing {H} a (snoc defn) p | yes refl = refl
lookup-⊑-nothing {H} a (snoc o) p | no q = trans (lookup-not-allocated o q) p
data OrWarningᴱ {Γ M T} (H : Heap yes) (D : Γ ⊢ᴱ M ∈ T) A : Set where
ok : A → OrWarningᴱ H D A
warning : Warningᴱ H D → OrWarningᴱ H D A
data OrWarningᴮ {Γ B T} (H : Heap yes) (D : Γ ⊢ᴮ B ∈ T) A : Set where
ok : A → OrWarningᴮ H D A
warning : Warningᴮ H D → OrWarningᴮ H D A
data OrWarningᴴᴱ {Γ M T} H (D : Γ ⊢ᴴᴱ H ▷ M ∈ T) A : Set where
ok : A → OrWarningᴴᴱ H D A
warning : Warningᴴᴱ H D → OrWarningᴴᴱ H D A
data OrWarningᴴᴮ {Γ B T} H (D : Γ ⊢ᴴᴮ H ▷ B ∈ T) A : Set where
ok : A → OrWarningᴴᴮ H D A
warning : Warningᴴᴮ H D → OrWarningᴴᴮ H D A
heap-weakeningᴱ : ∀ H M {H′ Γ} → (H ⊑ H′) → OrWarningᴱ H (typeCheckᴱ H Γ M) (typeOfᴱ H Γ M ≡ typeOfᴱ H′ Γ M)
heap-weakeningᴮ : ∀ H B {H′ Γ} → (H ⊑ H′) → OrWarningᴮ H (typeCheckᴮ H Γ B) (typeOfᴮ H Γ B ≡ typeOfᴮ H′ Γ B)
heap-weakeningᴱ H (var x) h = ok refl
heap-weakeningᴱ H (val nil) h = ok refl
heap-weakeningᴱ H (val (addr a)) refl = ok refl
heap-weakeningᴱ H (val (addr a)) (snoc {a = b} defn) with a ≡ᴬ b
heap-weakeningᴱ H (val (addr a)) (snoc {a = a} defn) | yes refl = warning (UnallocatedAddress refl)
heap-weakeningᴱ H (val (addr a)) (snoc {a = b} p) | no q = ok (cong orNone (cong typeOfᴹᴼ (lookup-not-allocated p q)))
heap-weakeningᴱ H (val (number n)) h = ok refl
heap-weakeningᴱ H (val (bool b)) h = ok refl
heap-weakeningᴱ H (val (string x)) h = ok refl
heap-weakeningᴱ H (binexp M op N) h = ok refl
heap-weakeningᴱ H (M $ N) h with heap-weakeningᴱ H M h
heap-weakeningᴱ H (M $ N) h | ok p = ok (cong tgt p)
heap-weakeningᴱ H (M $ N) h | warning W = warning (app₁ W)
heap-weakeningᴱ H (function f ⟨ var x ∈ T ⟩∈ U is B end) h = ok refl
heap-weakeningᴱ H (block var b ∈ T is B end) h = ok refl
heap-weakeningᴮ H (function f ⟨ var x ∈ T ⟩∈ U is C end ∙ B) h with heap-weakeningᴮ H B h
heap-weakeningᴮ H (function f ⟨ var x ∈ T ⟩∈ U is C end ∙ B) h | ok p = ok p
heap-weakeningᴮ H (function f ⟨ var x ∈ T ⟩∈ U is C end ∙ B) h | warning W = warning (function₂ W)
heap-weakeningᴮ H (local var x ∈ T ← M ∙ B) h with heap-weakeningᴮ H B h
heap-weakeningᴮ H (local var x ∈ T ← M ∙ B) h | ok p = ok p
heap-weakeningᴮ H (local var x ∈ T ← M ∙ B) h | warning W = warning (local₂ W)
heap-weakeningᴮ H (return M ∙ B) h with heap-weakeningᴱ H M h
heap-weakeningᴮ H (return M ∙ B) h | ok p = ok p
heap-weakeningᴮ H (return M ∙ B) h | warning W = warning (return W)
heap-weakeningᴮ H (done) h = ok refl
none-not-obj : ∀ O → none ≢ typeOfᴼ O
none-not-obj (function f ⟨ var x ∈ T ⟩∈ U is B end) ()
typeOf-val-not-none : ∀ {H Γ} v → OrWarningᴱ H (typeCheckᴱ H Γ (val v)) (none ≢ typeOfᴱ H Γ (val v))
typeOf-val-not-none nil = ok (λ ())
typeOf-val-not-none (number n) = ok (λ ())
typeOf-val-not-none (bool b) = ok (λ ())
typeOf-val-not-none (string x) = ok (λ ())
typeOf-val-not-none {H = H} (addr a) with remember (H [ a ]ᴴ)
typeOf-val-not-none {H = H} (addr a) | (just O , p) = ok (λ q → none-not-obj O (trans q (cong orNone (cong typeOfᴹᴼ p))))
typeOf-val-not-none {H = H} (addr a) | (nothing , p) = warning (UnallocatedAddress p)
substitutivityᴱ : ∀ {Γ T} H M v x → (just T ≡ typeOfⱽ H v) → (typeOfᴱ H (Γ ⊕ x ↦ T) M ≡ typeOfᴱ H Γ (M [ v / x ]ᴱ))
substitutivityᴱ-whenever-yes : ∀ {Γ T} H v x y (p : x ≡ y) → (just T ≡ typeOfⱽ H v) → (typeOfᴱ H (Γ ⊕ x ↦ T) (var y) ≡ typeOfᴱ H Γ (var y [ v / x ]ᴱwhenever (yes p)))
substitutivityᴱ-whenever-no : ∀ {Γ T} H v x y (p : x ≢ y) → (just T ≡ typeOfⱽ H v) → (typeOfᴱ H (Γ ⊕ x ↦ T) (var y) ≡ typeOfᴱ H Γ (var y [ v / x ]ᴱwhenever (no p)))
substitutivityᴮ : ∀ {Γ T} H B v x → (just T ≡ typeOfⱽ H v) → (typeOfᴮ H (Γ ⊕ x ↦ T) B ≡ typeOfᴮ H Γ (B [ v / x ]ᴮ))
substitutivityᴮ-unless-yes : ∀ {Γ Γ′ T} H B v x y (p : x ≡ y) → (just T ≡ typeOfⱽ H v) → (Γ′ ≡ Γ) → (typeOfᴮ H Γ′ B ≡ typeOfᴮ H Γ (B [ v / x ]ᴮunless (yes p)))
substitutivityᴮ-unless-no : ∀ {Γ Γ′ T} H B v x y (p : x ≢ y) → (just T ≡ typeOfⱽ H v) → (Γ′ ≡ Γ ⊕ x ↦ T) → (typeOfᴮ H Γ′ B ≡ typeOfᴮ H Γ (B [ v / x ]ᴮunless (no p)))
substitutivityᴱ H (var y) v x p with x ≡ⱽ y
substitutivityᴱ H (var y) v x p | yes q = substitutivityᴱ-whenever-yes H v x y q p
substitutivityᴱ H (var y) v x p | no q = substitutivityᴱ-whenever-no H v x y q p
substitutivityᴱ H (val w) v x p = refl
substitutivityᴱ H (binexp M op N) v x p = refl
substitutivityᴱ H (M $ N) v x p = cong tgt (substitutivityᴱ H M v x p)
substitutivityᴱ H (function f ⟨ var y ∈ T ⟩∈ U is B end) v x p = refl
substitutivityᴱ H (block var b ∈ T is B end) v x p = refl
substitutivityᴱ-whenever-yes H v x x refl q = cong orNone q
substitutivityᴱ-whenever-no H v x y p q = cong orNone ( sym (⊕-lookup-miss x y _ _ p))
substitutivityᴮ H (function f ⟨ var y ∈ T ⟩∈ U is C end ∙ B) v x p with x ≡ⱽ f
substitutivityᴮ H (function f ⟨ var y ∈ T ⟩∈ U is C end ∙ B) v x p | yes q = substitutivityᴮ-unless-yes H B v x f q p (⊕-over q)
substitutivityᴮ H (function f ⟨ var y ∈ T ⟩∈ U is C end ∙ B) v x p | no q = substitutivityᴮ-unless-no H B v x f q p (⊕-swap q)
substitutivityᴮ H (local var y ∈ T ← M ∙ B) v x p with x ≡ⱽ y
substitutivityᴮ H (local var y ∈ T ← M ∙ B) v x p | yes q = substitutivityᴮ-unless-yes H B v x y q p (⊕-over q)
substitutivityᴮ H (local var y ∈ T ← M ∙ B) v x p | no q = substitutivityᴮ-unless-no H B v x y q p (⊕-swap q)
substitutivityᴮ H (return M ∙ B) v x p = substitutivityᴱ H M v x p
substitutivityᴮ H done v x p = refl
substitutivityᴮ-unless-yes H B v x x refl q refl = refl
substitutivityᴮ-unless-no H B v x y p q refl = substitutivityᴮ H B v x q
binOpPreservation : ∀ H {op v w x} → (v ⟦ op ⟧ w ⟶ x) → (tgtBinOp op ≡ typeOfᴱ H ∅ (val x))
binOpPreservation H (+ m n) = refl
binOpPreservation H (- m n) = refl
binOpPreservation H (/ m n) = refl
binOpPreservation H (* m n) = refl
binOpPreservation H (< m n) = refl
binOpPreservation H (> m n) = refl
binOpPreservation H (<= m n) = refl
binOpPreservation H (>= m n) = refl
binOpPreservation H (== v w) = refl
binOpPreservation H (~= v w) = refl
binOpPreservation H (·· v w) = refl
preservationᴱ : ∀ H M {H′ M′} → (H ⊢ M ⟶ᴱ M′ ⊣ H′) → OrWarningᴴᴱ H (typeCheckᴴᴱ H ∅ M) (typeOfᴱ H ∅ M ≡ typeOfᴱ H′ ∅ M′)
preservationᴮ : ∀ H B {H′ B′} → (H ⊢ B ⟶ᴮ B′ ⊣ H′) → OrWarningᴴᴮ H (typeCheckᴴᴮ H ∅ B) (typeOfᴮ H ∅ B ≡ typeOfᴮ H′ ∅ B′)
preservationᴱ H (function f ⟨ var x ∈ T ⟩∈ U is B end) (function a defn) = ok refl
preservationᴱ H (M $ N) (app₁ s) with preservationᴱ H M s
preservationᴱ H (M $ N) (app₁ s) | ok p = ok (cong tgt p)
preservationᴱ H (M $ N) (app₁ s) | warning (expr W) = warning (expr (app₁ W))
preservationᴱ H (M $ N) (app₁ s) | warning (heap W) = warning (heap W)
preservationᴱ H (M $ N) (app₂ p s) with heap-weakeningᴱ H M (rednᴱ⊑ s)
preservationᴱ H (M $ N) (app₂ p s) | ok q = ok (cong tgt q)
preservationᴱ H (M $ N) (app₂ p s) | warning W = warning (expr (app₁ W))
preservationᴱ H (val (addr a) $ N) (beta (function f ⟨ var x ∈ S ⟩∈ T is B end) v refl p) with remember (typeOfⱽ H v)
preservationᴱ H (val (addr a) $ N) (beta (function f ⟨ var x ∈ S ⟩∈ T is B end) v refl p) | (just U , q) with S ≡ᵀ U | T ≡ᵀ typeOfᴮ H (x ↦ S) B
preservationᴱ H (val (addr a) $ N) (beta (function f ⟨ var x ∈ S ⟩∈ T is B end) v refl p) | (just U , q) | yes refl | yes refl = ok (cong tgt (cong orNone (cong typeOfᴹᴼ p)))
preservationᴱ H (val (addr a) $ N) (beta (function f ⟨ var x ∈ S ⟩∈ T is B end) v refl p) | (just U , q) | yes refl | no r = warning (heap (addr a p (FunctionDefnMismatch r)))
preservationᴱ H (val (addr a) $ N) (beta (function f ⟨ var x ∈ S ⟩∈ T is B end) v refl p) | (just U , q) | no r | _ = warning (expr (FunctionCallMismatch (λ s → r (trans (trans (sym (cong src (cong orNone (cong typeOfᴹᴼ p)))) s) (cong orNone q)))))
preservationᴱ H (val (addr a) $ N) (beta (function f ⟨ var x ∈ S ⟩∈ T is B end) v refl p) | (nothing , q) with typeOf-val-not-none v
preservationᴱ H (val (addr a) $ N) (beta (function f ⟨ var x ∈ S ⟩∈ T is B end) v refl p) | (nothing , q) | ok r = CONTRADICTION (r (sym (cong orNone q)))
preservationᴱ H (val (addr a) $ N) (beta (function f ⟨ var x ∈ S ⟩∈ T is B end) v refl p) | (nothing , q) | warning W = warning (expr (app₂ W))
preservationᴱ H (block var b ∈ T is B end) (block s) = ok refl
preservationᴱ H (block var b ∈ T is return M ∙ B end) (return v) with T ≡ᵀ typeOfᴱ H ∅ (val v)
preservationᴱ H (block var b ∈ T is return M ∙ B end) (return v) | yes p = ok p
preservationᴱ H (block var b ∈ T is return M ∙ B end) (return v) | no p = warning (expr (BlockMismatch p))
preservationᴱ H (block var b ∈ T is done end) (done) with T ≡ᵀ nil
preservationᴱ H (block var b ∈ T is done end) (done) | yes p = ok p
preservationᴱ H (block var b ∈ T is done end) (done) | no p = warning (expr (BlockMismatch p))
preservationᴱ H (binexp M op N) (binOp₀ s) = ok (binOpPreservation H s)
preservationᴱ H (binexp M op N) (binOp₁ s) = ok refl
preservationᴱ H (binexp M op N) (binOp₂ s) = ok refl
preservationᴮ H (local var x ∈ T ← M ∙ B) (local s) with heap-weakeningᴮ H B (rednᴱ⊑ s)
preservationᴮ H (local var x ∈ T ← M ∙ B) (local s) | ok p = ok p
preservationᴮ H (local var x ∈ T ← M ∙ B) (local s) | warning W = warning (block (local₂ W))
preservationᴮ H (local var x ∈ T ← M ∙ B) (subst v) with remember (typeOfⱽ H v)
preservationᴮ H (local var x ∈ T ← M ∙ B) (subst v) | (just U , p) with T ≡ᵀ U
preservationᴮ H (local var x ∈ T ← M ∙ B) (subst v) | (just T , p) | yes refl = ok (substitutivityᴮ H B v x (sym p))
preservationᴮ H (local var x ∈ T ← M ∙ B) (subst v) | (just U , p) | no q = warning (block (LocalVarMismatch (λ r → q (trans r (cong orNone p)))))
preservationᴮ H (local var x ∈ T ← M ∙ B) (subst v) | (nothing , p) with typeOf-val-not-none v
preservationᴮ H (local var x ∈ T ← M ∙ B) (subst v) | (nothing , p) | ok q = CONTRADICTION (q (sym (cong orNone p)))
preservationᴮ H (local var x ∈ T ← M ∙ B) (subst v) | (nothing , p) | warning W = warning (block (local₁ W))
preservationᴮ H (function f ⟨ var x ∈ T ⟩∈ U is C end ∙ B) (function a defn) with heap-weakeningᴮ H B (snoc defn)
preservationᴮ H (function f ⟨ var x ∈ T ⟩∈ U is C end ∙ B) (function a defn) | ok r = ok (trans r (substitutivityᴮ _ B (addr a) f refl))
preservationᴮ H (function f ⟨ var x ∈ T ⟩∈ U is C end ∙ B) (function a defn) | warning W = warning (block (function₂ W))
preservationᴮ H (return M ∙ B) (return s) with preservationᴱ H M s
preservationᴮ H (return M ∙ B) (return s) | ok p = ok p
preservationᴮ H (return M ∙ B) (return s) | warning (expr W) = warning (block (return W))
preservationᴮ H (return M ∙ B) (return s) | warning (heap W) = warning (heap W)
reflect-substitutionᴱ : ∀ {Γ T} H M v x → (just T ≡ typeOfⱽ H v) → Warningᴱ H (typeCheckᴱ H Γ (M [ v / x ]ᴱ)) → Warningᴱ H (typeCheckᴱ H (Γ ⊕ x ↦ T) M)
reflect-substitutionᴱ-whenever-yes : ∀ {Γ T} H v x y (p : x ≡ y) → (just T ≡ typeOfⱽ H v) → Warningᴱ H (typeCheckᴱ H Γ (var y [ v / x ]ᴱwhenever yes p)) → Warningᴱ H (typeCheckᴱ H (Γ ⊕ x ↦ T) (var y))
reflect-substitutionᴱ-whenever-no : ∀ {Γ T} H v x y (p : x ≢ y) → (just T ≡ typeOfⱽ H v) → Warningᴱ H (typeCheckᴱ H Γ (var y [ v / x ]ᴱwhenever no p)) → Warningᴱ H (typeCheckᴱ H (Γ ⊕ x ↦ T) (var y))
reflect-substitutionᴮ : ∀ {Γ T} H B v x → (just T ≡ typeOfⱽ H v) → Warningᴮ H (typeCheckᴮ H Γ (B [ v / x ]ᴮ)) → Warningᴮ H (typeCheckᴮ H (Γ ⊕ x ↦ T) B)
reflect-substitutionᴮ-unless-yes : ∀ {Γ Γ′ T} H B v x y (r : x ≡ y) → (just T ≡ typeOfⱽ H v) → (Γ′ ≡ Γ) → Warningᴮ H (typeCheckᴮ H Γ (B [ v / x ]ᴮunless yes r)) → Warningᴮ H (typeCheckᴮ H Γ′ B)
reflect-substitutionᴮ-unless-no : ∀ {Γ Γ′ T} H B v x y (r : x ≢ y) → (just T ≡ typeOfⱽ H v) → (Γ′ ≡ Γ ⊕ x ↦ T) → Warningᴮ H (typeCheckᴮ H Γ (B [ v / x ]ᴮunless no r)) → Warningᴮ H (typeCheckᴮ H Γ′ B)
reflect-substitutionᴱ H (var y) v x p W with x ≡ⱽ y
reflect-substitutionᴱ H (var y) v x p W | yes r = reflect-substitutionᴱ-whenever-yes H v x y r p W
reflect-substitutionᴱ H (var y) v x p W | no r = reflect-substitutionᴱ-whenever-no H v x y r p W
reflect-substitutionᴱ H (val (addr a)) v x p (UnallocatedAddress r) = UnallocatedAddress r
reflect-substitutionᴱ H (M $ N) v x p (FunctionCallMismatch q) = FunctionCallMismatch (λ s → q (trans (cong src (sym (substitutivityᴱ H M v x p))) (trans s (substitutivityᴱ H N v x p))))
reflect-substitutionᴱ H (M $ N) v x p (app₁ W) = app₁ (reflect-substitutionᴱ H M v x p W)
reflect-substitutionᴱ H (M $ N) v x p (app₂ W) = app₂ (reflect-substitutionᴱ H N v x p W)
reflect-substitutionᴱ H (function f ⟨ var y ∈ T ⟩∈ U is B end) v x p (FunctionDefnMismatch q) with (x ≡ⱽ y)
reflect-substitutionᴱ H (function f ⟨ var y ∈ T ⟩∈ U is B end) v x p (FunctionDefnMismatch q) | yes r = FunctionDefnMismatch (λ s → q (trans s (substitutivityᴮ-unless-yes H B v x y r p (⊕-over r))))
reflect-substitutionᴱ H (function f ⟨ var y ∈ T ⟩∈ U is B end) v x p (FunctionDefnMismatch q) | no r = FunctionDefnMismatch (λ s → q (trans s (substitutivityᴮ-unless-no H B v x y r p (⊕-swap r))))
reflect-substitutionᴱ H (function f ⟨ var y ∈ T ⟩∈ U is B end) v x p (function₁ W) with (x ≡ⱽ y)
reflect-substitutionᴱ H (function f ⟨ var y ∈ T ⟩∈ U is B end) v x p (function₁ W) | yes r = function₁ (reflect-substitutionᴮ-unless-yes H B v x y r p (⊕-over r) W)
reflect-substitutionᴱ H (function f ⟨ var y ∈ T ⟩∈ U is B end) v x p (function₁ W) | no r = function₁ (reflect-substitutionᴮ-unless-no H B v x y r p (⊕-swap r) W)
reflect-substitutionᴱ H (block var b ∈ T is B end) v x p (BlockMismatch q) = BlockMismatch (λ r → q (trans r (substitutivityᴮ H B v x p)))
reflect-substitutionᴱ H (block var b ∈ T is B end) v x p (block₁ W) = block₁ (reflect-substitutionᴮ H B v x p W)
reflect-substitutionᴱ H (binexp M op N) x v p (BinOpMismatch₁ q) = BinOpMismatch₁ (subst₁ (BinOpWarning op) (sym (substitutivityᴱ H M x v p)) q)
reflect-substitutionᴱ H (binexp M op N) x v p (BinOpMismatch₂ q) = BinOpMismatch₂ (subst₁ (BinOpWarning op) (sym (substitutivityᴱ H N x v p)) q)
reflect-substitutionᴱ H (binexp M op N) x v p (bin₁ W) = bin₁ (reflect-substitutionᴱ H M x v p W)
reflect-substitutionᴱ H (binexp M op N) x v p (bin₂ W) = bin₂ (reflect-substitutionᴱ H N x v p W)
reflect-substitutionᴱ-whenever-no H v x y p q (UnboundVariable r) = UnboundVariable (trans (sym (⊕-lookup-miss x y _ _ p)) r)
reflect-substitutionᴱ-whenever-yes H (addr a) x x refl p (UnallocatedAddress q) with trans p (cong typeOfᴹᴼ q)
reflect-substitutionᴱ-whenever-yes H (addr a) x x refl p (UnallocatedAddress q) | ()
reflect-substitutionᴮ H (function f ⟨ var y ∈ T ⟩∈ U is C end ∙ B) v x p (FunctionDefnMismatch q) with (x ≡ⱽ y)
reflect-substitutionᴮ H (function f ⟨ var y ∈ T ⟩∈ U is C end ∙ B) v x p (FunctionDefnMismatch q) | yes r = FunctionDefnMismatch (λ s → q (trans s (substitutivityᴮ-unless-yes H C v x y r p (⊕-over r))))
reflect-substitutionᴮ H (function f ⟨ var y ∈ T ⟩∈ U is C end ∙ B) v x p (FunctionDefnMismatch q) | no r = FunctionDefnMismatch (λ s → q (trans s (substitutivityᴮ-unless-no H C v x y r p (⊕-swap r))))
reflect-substitutionᴮ H (function f ⟨ var y ∈ T ⟩∈ U is C end ∙ B) v x p (function₁ W) with (x ≡ⱽ y)
reflect-substitutionᴮ H (function f ⟨ var y ∈ T ⟩∈ U is C end ∙ B) v x p (function₁ W) | yes r = function₁ (reflect-substitutionᴮ-unless-yes H C v x y r p (⊕-over r) W)
reflect-substitutionᴮ H (function f ⟨ var y ∈ T ⟩∈ U is C end ∙ B) v x p (function₁ W) | no r = function₁ (reflect-substitutionᴮ-unless-no H C v x y r p (⊕-swap r) W)
reflect-substitutionᴮ H (function f ⟨ var y ∈ T ⟩∈ U is C end ∙ B) v x p (function₂ W) with (x ≡ⱽ f)
reflect-substitutionᴮ H (function f ⟨ var y ∈ T ⟩∈ U is C end ∙ B) v x p (function₂ W)| yes r = function₂ (reflect-substitutionᴮ-unless-yes H B v x f r p (⊕-over r) W)
reflect-substitutionᴮ H (function f ⟨ var y ∈ T ⟩∈ U is C end ∙ B) v x p (function₂ W)| no r = function₂ (reflect-substitutionᴮ-unless-no H B v x f r p (⊕-swap r) W)
reflect-substitutionᴮ H (local var y ∈ T ← M ∙ B) v x p (LocalVarMismatch q) = LocalVarMismatch (λ r → q (trans r (substitutivityᴱ H M v x p)))
reflect-substitutionᴮ H (local var y ∈ T ← M ∙ B) v x p (local₁ W) = local₁ (reflect-substitutionᴱ H M v x p W)
reflect-substitutionᴮ H (local var y ∈ T ← M ∙ B) v x p (local₂ W) with (x ≡ⱽ y)
reflect-substitutionᴮ H (local var y ∈ T ← M ∙ B) v x p (local₂ W) | yes r = local₂ (reflect-substitutionᴮ-unless-yes H B v x y r p (⊕-over r) W)
reflect-substitutionᴮ H (local var y ∈ T ← M ∙ B) v x p (local₂ W) | no r = local₂ (reflect-substitutionᴮ-unless-no H B v x y r p (⊕-swap r) W)
reflect-substitutionᴮ H (return M ∙ B) v x p (return W) = return (reflect-substitutionᴱ H M v x p W)
reflect-substitutionᴮ-unless-yes H B v x y r p refl W = W
reflect-substitutionᴮ-unless-no H B v x y r p refl W = reflect-substitutionᴮ H B v x p W
reflect-weakeningᴱ : ∀ H M {H′ Γ} → (H ⊑ H′) → Warningᴱ H′ (typeCheckᴱ H′ Γ M) → Warningᴱ H (typeCheckᴱ H Γ M)
reflect-weakeningᴮ : ∀ H B {H′ Γ} → (H ⊑ H′) → Warningᴮ H′ (typeCheckᴮ H′ Γ B) → Warningᴮ H (typeCheckᴮ H Γ B)
reflect-weakeningᴱ H (var x) h (UnboundVariable p) = (UnboundVariable p)
reflect-weakeningᴱ H (val (addr a)) h (UnallocatedAddress p) = UnallocatedAddress (lookup-⊑-nothing a h p)
reflect-weakeningᴱ H (M $ N) h (FunctionCallMismatch p) with heap-weakeningᴱ H M h | heap-weakeningᴱ H N h
reflect-weakeningᴱ H (M $ N) h (FunctionCallMismatch p) | ok q₁ | ok q₂ = FunctionCallMismatch (λ r → p (trans (cong src (sym q₁)) (trans r q₂)))
reflect-weakeningᴱ H (M $ N) h (FunctionCallMismatch p) | warning W | _ = app₁ W
reflect-weakeningᴱ H (M $ N) h (FunctionCallMismatch p) | _ | warning W = app₂ W
reflect-weakeningᴱ H (M $ N) h (app₁ W) = app₁ (reflect-weakeningᴱ H M h W)
reflect-weakeningᴱ H (M $ N) h (app₂ W) = app₂ (reflect-weakeningᴱ H N h W)
reflect-weakeningᴱ H (binexp M op N) h (BinOpMismatch₁ p) with heap-weakeningᴱ H M h
reflect-weakeningᴱ H (binexp M op N) h (BinOpMismatch₁ p) | ok q = BinOpMismatch₁ (subst₁ (BinOpWarning op) (sym q) p)
reflect-weakeningᴱ H (binexp M op N) h (BinOpMismatch₁ p) | warning W = bin₁ W
reflect-weakeningᴱ H (binexp M op N) h (BinOpMismatch₂ p) with heap-weakeningᴱ H N h
reflect-weakeningᴱ H (binexp M op N) h (BinOpMismatch₂ p) | ok q = BinOpMismatch₂ (subst₁ (BinOpWarning op) (sym q) p)
reflect-weakeningᴱ H (binexp M op N) h (BinOpMismatch₂ p) | warning W = bin₂ W
reflect-weakeningᴱ H (binexp M op N) h (bin₁ W′) = bin₁ (reflect-weakeningᴱ H M h W′)
reflect-weakeningᴱ H (binexp M op N) h (bin₂ W′) = bin₂ (reflect-weakeningᴱ H N h W′)
reflect-weakeningᴱ H (function f ⟨ var y ∈ T ⟩∈ U is B end) h (FunctionDefnMismatch p) with heap-weakeningᴮ H B h
reflect-weakeningᴱ H (function f ⟨ var y ∈ T ⟩∈ U is B end) h (FunctionDefnMismatch p) | ok q = FunctionDefnMismatch (λ r → p (trans r q))
reflect-weakeningᴱ H (function f ⟨ var y ∈ T ⟩∈ U is B end) h (FunctionDefnMismatch p) | warning W = function₁ W
reflect-weakeningᴱ H (function f ⟨ var y ∈ T ⟩∈ U is B end) h (function₁ W) = function₁ (reflect-weakeningᴮ H B h W)
reflect-weakeningᴱ H (block var b ∈ T is B end) h (BlockMismatch p) with heap-weakeningᴮ H B h
reflect-weakeningᴱ H (block var b ∈ T is B end) h (BlockMismatch p) | ok q = BlockMismatch (λ r → p (trans r q))
reflect-weakeningᴱ H (block var b ∈ T is B end) h (BlockMismatch p) | warning W = block₁ W
reflect-weakeningᴱ H (block var b ∈ T is B end) h (block₁ W) = block₁ (reflect-weakeningᴮ H B h W)
reflect-weakeningᴮ H (return M ∙ B) h (return W) = return (reflect-weakeningᴱ H M h W)
reflect-weakeningᴮ H (local var y ∈ T ← M ∙ B) h (LocalVarMismatch p) with heap-weakeningᴱ H M h
reflect-weakeningᴮ H (local var y ∈ T ← M ∙ B) h (LocalVarMismatch p) | ok q = LocalVarMismatch (λ r → p (trans r q))
reflect-weakeningᴮ H (local var y ∈ T ← M ∙ B) h (LocalVarMismatch p) | warning W = local₁ W
reflect-weakeningᴮ H (local var y ∈ T ← M ∙ B) h (local₁ W) = local₁ (reflect-weakeningᴱ H M h W)
reflect-weakeningᴮ H (local var y ∈ T ← M ∙ B) h (local₂ W) = local₂ (reflect-weakeningᴮ H B h W)
reflect-weakeningᴮ H (function f ⟨ var x ∈ T ⟩∈ U is C end ∙ B) h (FunctionDefnMismatch p) with heap-weakeningᴮ H C h
reflect-weakeningᴮ H (function f ⟨ var x ∈ T ⟩∈ U is C end ∙ B) h (FunctionDefnMismatch p) | ok q = FunctionDefnMismatch (λ r → p (trans r q))
reflect-weakeningᴮ H (function f ⟨ var x ∈ T ⟩∈ U is C end ∙ B) h (FunctionDefnMismatch p) | warning W = function₁ W
reflect-weakeningᴮ H (function f ⟨ var x ∈ T ⟩∈ U is C end ∙ B) h (function₁ W) = function₁ (reflect-weakeningᴮ H C h W)
reflect-weakeningᴮ H (function f ⟨ var x ∈ T ⟩∈ U is C end ∙ B) h (function₂ W) = function₂ (reflect-weakeningᴮ H B h W)
reflect-weakeningᴼ : ∀ H O {H′} → (H ⊑ H′) → Warningᴼ H′ (typeCheckᴼ H′ O) → Warningᴼ H (typeCheckᴼ H O)
reflect-weakeningᴼ H (just (function f ⟨ var x ∈ T ⟩∈ U is B end)) h (FunctionDefnMismatch p) with heap-weakeningᴮ H B h
reflect-weakeningᴼ H (just (function f ⟨ var x ∈ T ⟩∈ U is B end)) h (FunctionDefnMismatch p) | ok q = FunctionDefnMismatch (λ r → p (trans r q))
reflect-weakeningᴼ H (just (function f ⟨ var x ∈ T ⟩∈ U is B end)) h (FunctionDefnMismatch p) | warning W = function₁ W
reflect-weakeningᴼ H (just (function f ⟨ var x ∈ T ⟩∈ U is B end)) h (function₁ W′) = function₁ (reflect-weakeningᴮ H B h W′)
reflectᴱ : ∀ H M {H′ M′} → (H ⊢ M ⟶ᴱ M′ ⊣ H′) → Warningᴱ H′ (typeCheckᴱ H′ ∅ M′) → Warningᴴᴱ H (typeCheckᴴᴱ H ∅ M)
reflectᴮ : ∀ H B {H′ B′} → (H ⊢ B ⟶ᴮ B′ ⊣ H′) → Warningᴮ H′ (typeCheckᴮ H′ ∅ B′) → Warningᴴᴮ H (typeCheckᴴᴮ H ∅ B)
reflectᴱ H (M $ N) (app₁ s) (FunctionCallMismatch p) with preservationᴱ H M s | heap-weakeningᴱ H N (rednᴱ⊑ s)
reflectᴱ H (M $ N) (app₁ s) (FunctionCallMismatch p) | ok q | ok q′ = expr (FunctionCallMismatch (λ r → p (trans (trans (cong src (sym q)) r) q′)))
reflectᴱ H (M $ N) (app₁ s) (FunctionCallMismatch p) | warning (expr W) | _ = expr (app₁ W)
reflectᴱ H (M $ N) (app₁ s) (FunctionCallMismatch p) | warning (heap W) | _ = heap W
reflectᴱ H (M $ N) (app₁ s) (FunctionCallMismatch p) | _ | warning W = expr (app₂ W)
reflectᴱ H (M $ N) (app₁ s) (app₁ W′) with reflectᴱ H M s W′
reflectᴱ H (M $ N) (app₁ s) (app₁ W′) | heap W = heap W
reflectᴱ H (M $ N) (app₁ s) (app₁ W′) | expr W = expr (app₁ W)
reflectᴱ H (M $ N) (app₁ s) (app₂ W′) = expr (app₂ (reflect-weakeningᴱ H N (rednᴱ⊑ s) W′))
reflectᴱ H (M $ N) (app₂ p s) (FunctionCallMismatch p′) with heap-weakeningᴱ H (val p) (rednᴱ⊑ s) | preservationᴱ H N s
reflectᴱ H (M $ N) (app₂ p s) (FunctionCallMismatch p′) | ok q | ok q′ = expr (FunctionCallMismatch (λ r → p′ (trans (trans (cong src (sym q)) r) q′)))
reflectᴱ H (M $ N) (app₂ p s) (FunctionCallMismatch p′) | warning W | _ = expr (app₁ W)
reflectᴱ H (M $ N) (app₂ p s) (FunctionCallMismatch p′) | _ | warning (expr W) = expr (app₂ W)
reflectᴱ H (M $ N) (app₂ p s) (FunctionCallMismatch p′) | _ | warning (heap W) = heap W
reflectᴱ H (M $ N) (app₂ p s) (app₁ W′) = expr (app₁ (reflect-weakeningᴱ H M (rednᴱ⊑ s) W′))
reflectᴱ H (M $ N) (app₂ p s) (app₂ W′) with reflectᴱ H N s W′
reflectᴱ H (M $ N) (app₂ p s) (app₂ W′) | heap W = heap W
reflectᴱ H (M $ N) (app₂ p s) (app₂ W′) | expr W = expr (app₂ W)
reflectᴱ H (val (addr a) $ N) (beta (function f ⟨ var x ∈ T ⟩∈ U is B end) v refl p) (BlockMismatch q) with remember (typeOfⱽ H v)
reflectᴱ H (val (addr a) $ N) (beta (function f ⟨ var x ∈ T ⟩∈ U is B end) v refl p) (BlockMismatch q) | (just S , r) with S ≡ᵀ T
reflectᴱ H (val (addr a) $ N) (beta (function f ⟨ var x ∈ T ⟩∈ U is B end) v refl p) (BlockMismatch q) | (just T , r) | yes refl = heap (addr a p (FunctionDefnMismatch (λ s → q (trans s (substitutivityᴮ H B v x (sym r))))))
reflectᴱ H (val (addr a) $ N) (beta (function f ⟨ var x ∈ T ⟩∈ U is B end) v refl p) (BlockMismatch q) | (just S , r) | no s = expr (FunctionCallMismatch (λ t → s (trans (cong orNone (sym r)) (trans (sym t) (cong src (cong orNone (cong typeOfᴹᴼ p)))))))
reflectᴱ H (val (addr a) $ N) (beta (function f ⟨ var x ∈ T ⟩∈ U is B end) v refl p) (BlockMismatch q) | (nothing , r) with typeOf-val-not-none v
reflectᴱ H (val (addr a) $ N) (beta (function f ⟨ var x ∈ T ⟩∈ U is B end) v refl p) (BlockMismatch q) | (nothing , r) | ok s = CONTRADICTION (s (cong orNone (sym r)))
reflectᴱ H (val (addr a) $ N) (beta (function f ⟨ var x ∈ T ⟩∈ U is B end) v refl p) (BlockMismatch q) | (nothing , r) | warning W = expr (app₂ W)
reflectᴱ H (val (addr a) $ N) (beta (function f ⟨ var x ∈ T ⟩∈ U is B end) v refl p) (block₁ W′) with remember (typeOfⱽ H v)
reflectᴱ H (val (addr a) $ N) (beta (function f ⟨ var x ∈ T ⟩∈ U is B end) v refl p) (block₁ W′) | (just S , q) with S ≡ᵀ T
reflectᴱ H (val (addr a) $ N) (beta (function f ⟨ var x ∈ T ⟩∈ U is B end) v refl p) (block₁ W′) | (just T , q) | yes refl = heap (addr a p (function₁ (reflect-substitutionᴮ H B v x (sym q) W′)))
reflectᴱ H (val (addr a) $ N) (beta (function f ⟨ var x ∈ T ⟩∈ U is B end) v refl p) (block₁ W′) | (just S , q) | no r = expr (FunctionCallMismatch (λ s → r (trans (cong orNone (sym q)) (trans (sym s) (cong src (cong orNone (cong typeOfᴹᴼ p)))))))
reflectᴱ H (val (addr a) $ N) (beta (function f ⟨ var x ∈ T ⟩∈ U is B end) v refl p) (block₁ W′) | (nothing , q) with typeOf-val-not-none v
reflectᴱ H (val (addr a) $ N) (beta (function f ⟨ var x ∈ T ⟩∈ U is B end) v refl p) (block₁ W′) | (nothing , q) | ok r = CONTRADICTION (r (cong orNone (sym q)))
reflectᴱ H (val (addr a) $ N) (beta (function f ⟨ var x ∈ T ⟩∈ U is B end) v refl p) (block₁ W′) | (nothing , q) | warning W = expr (app₂ W)
reflectᴱ H (block var b ∈ T is B end) (block s) (BlockMismatch p) with preservationᴮ H B s
reflectᴱ H (block var b ∈ T is B end) (block s) (BlockMismatch p) | ok q = expr (BlockMismatch (λ r → p (trans r q)))
reflectᴱ H (block var b ∈ T is B end) (block s) (BlockMismatch p) | warning (heap W) = heap W
reflectᴱ H (block var b ∈ T is B end) (block s) (BlockMismatch p) | warning (block W) = expr (block₁ W)
reflectᴱ H (block var b ∈ T is B end) (block s) (block₁ W′) with reflectᴮ H B s W′
reflectᴱ H (block var b ∈ T is B end) (block s) (block₁ W′) | heap W = heap W
reflectᴱ H (block var b ∈ T is B end) (block s) (block₁ W′) | block W = expr (block₁ W)
reflectᴱ H (block var b ∈ T is B end) (return v) W′ = expr (block₁ (return W′))
reflectᴱ H (function f ⟨ var x ∈ T ⟩∈ U is B end) (function a defn) (UnallocatedAddress ())
reflectᴱ H (binexp M op N) (binOp₀ ()) (UnallocatedAddress p)
reflectᴱ H (binexp M op N) (binOp₁ s) (BinOpMismatch₁ p) with preservationᴱ H M s
reflectᴱ H (binexp M op N) (binOp₁ s) (BinOpMismatch₁ p) | ok q = expr (BinOpMismatch₁ (subst₁ (BinOpWarning op) (sym q) p))
reflectᴱ H (binexp M op N) (binOp₁ s) (BinOpMismatch₁ p) | warning (heap W) = heap W
reflectᴱ H (binexp M op N) (binOp₁ s) (BinOpMismatch₁ p) | warning (expr W) = expr (bin₁ W)
reflectᴱ H (binexp M op N) (binOp₁ s) (BinOpMismatch₂ p) with heap-weakeningᴱ H N (rednᴱ⊑ s)
reflectᴱ H (binexp M op N) (binOp₁ s) (BinOpMismatch₂ p) | ok q = expr (BinOpMismatch₂ ((subst₁ (BinOpWarning op) (sym q) p)))
reflectᴱ H (binexp M op N) (binOp₁ s) (BinOpMismatch₂ p) | warning W = expr (bin₂ W)
reflectᴱ H (binexp M op N) (binOp₁ s) (bin₁ W′) with reflectᴱ H M s W′
reflectᴱ H (binexp M op N) (binOp₁ s) (bin₁ W′) | heap W = heap W
reflectᴱ H (binexp M op N) (binOp₁ s) (bin₁ W′) | expr W = expr (bin₁ W)
reflectᴱ H (binexp M op N) (binOp₁ s) (bin₂ W′) = expr (bin₂ (reflect-weakeningᴱ H N (rednᴱ⊑ s) W′))
reflectᴱ H (binexp M op N) (binOp₂ s) (BinOpMismatch₁ p) with heap-weakeningᴱ H M (rednᴱ⊑ s)
reflectᴱ H (binexp M op N) (binOp₂ s) (BinOpMismatch₁ p) | ok q = expr (BinOpMismatch₁ (subst₁ (BinOpWarning op) (sym q) p))
reflectᴱ H (binexp M op N) (binOp₂ s) (BinOpMismatch₁ p) | warning W = expr (bin₁ W)
reflectᴱ H (binexp M op N) (binOp₂ s) (BinOpMismatch₂ p) with preservationᴱ H N s
reflectᴱ H (binexp M op N) (binOp₂ s) (BinOpMismatch₂ p) | ok q = expr (BinOpMismatch₂ (subst₁ (BinOpWarning op) (sym q) p))
reflectᴱ H (binexp M op N) (binOp₂ s) (BinOpMismatch₂ p) | warning (heap W) = heap W
reflectᴱ H (binexp M op N) (binOp₂ s) (BinOpMismatch₂ p) | warning (expr W) = expr (bin₂ W)
reflectᴱ H (binexp M op N) (binOp₂ s) (bin₁ W′) = expr (bin₁ (reflect-weakeningᴱ H M (rednᴱ⊑ s) W′))
reflectᴱ H (binexp M op N) (binOp₂ s) (bin₂ W′) with reflectᴱ H N s W′
reflectᴱ H (binexp M op N) (binOp₂ s) (bin₂ W′) | heap W = heap W
reflectᴱ H (binexp M op N) (binOp₂ s) (bin₂ W′) | expr W = expr (bin₂ W)
reflectᴮ H (local var x ∈ T ← M ∙ B) (local s) (LocalVarMismatch p) with preservationᴱ H M s
reflectᴮ H (local var x ∈ T ← M ∙ B) (local s) (LocalVarMismatch p) | ok q = block (LocalVarMismatch (λ r → p (trans r q)))
reflectᴮ H (local var x ∈ T ← M ∙ B) (local s) (LocalVarMismatch p) | warning (expr W) = block (local₁ W)
reflectᴮ H (local var x ∈ T ← M ∙ B) (local s) (LocalVarMismatch p) | warning (heap W) = heap W
reflectᴮ H (local var x ∈ T ← M ∙ B) (local s) (local₁ W′) with reflectᴱ H M s W′
reflectᴮ H (local var x ∈ T ← M ∙ B) (local s) (local₁ W′) | heap W = heap W
reflectᴮ H (local var x ∈ T ← M ∙ B) (local s) (local₁ W′) | expr W = block (local₁ W)
reflectᴮ H (local var x ∈ T ← M ∙ B) (local s) (local₂ W′) = block (local₂ (reflect-weakeningᴮ H B (rednᴱ⊑ s) W′))
reflectᴮ H (local var x ∈ T ← M ∙ B) (subst v) W′ with remember (typeOfⱽ H v)
reflectᴮ H (local var x ∈ T ← M ∙ B) (subst v) W′ | (just S , p) with S ≡ᵀ T
reflectᴮ H (local var x ∈ T ← M ∙ B) (subst v) W′ | (just T , p) | yes refl = block (local₂ (reflect-substitutionᴮ H B v x (sym p) W′))
reflectᴮ H (local var x ∈ T ← M ∙ B) (subst v) W′ | (just S , p) | no q = block (LocalVarMismatch (λ r → q (trans (cong orNone (sym p)) (sym r))))
reflectᴮ H (local var x ∈ T ← M ∙ B) (subst v) W′ | (nothing , p) with typeOf-val-not-none v
reflectᴮ H (local var x ∈ T ← M ∙ B) (subst v) W′ | (nothing , p) | ok r = CONTRADICTION (r (cong orNone (sym p)))
reflectᴮ H (local var x ∈ T ← M ∙ B) (subst v) W′ | (nothing , p) | warning W = block (local₁ W)
reflectᴮ H (function f ⟨ var y ∈ T ⟩∈ U is C end ∙ B) (function a defn) W′ = block (function₂ (reflect-weakeningᴮ H B (snoc defn) (reflect-substitutionᴮ _ B (addr a) f refl W′)))
reflectᴮ H (return M ∙ B) (return s) (return W′) with reflectᴱ H M s W′
reflectᴮ H (return M ∙ B) (return s) (return W′) | heap W = heap W
reflectᴮ H (return M ∙ B) (return s) (return W′) | expr W = block (return W)
reflectᴴᴱ : ∀ H M {H′ M′} → (H ⊢ M ⟶ᴱ M′ ⊣ H′) → Warningᴴᴱ H′ (typeCheckᴴᴱ H′ ∅ M′) → Warningᴴᴱ H (typeCheckᴴᴱ H ∅ M)
reflectᴴᴮ : ∀ H B {H′ B′} → (H ⊢ B ⟶ᴮ B′ ⊣ H′) → Warningᴴᴮ H′ (typeCheckᴴᴮ H′ ∅ B′) → Warningᴴᴮ H (typeCheckᴴᴮ H ∅ B)
reflectᴴᴱ H M s (expr W′) = reflectᴱ H M s W′
reflectᴴᴱ H (function f ⟨ var x ∈ T ⟩∈ U is B end) (function a p) (heap (addr b refl W′)) with b ≡ᴬ a
reflectᴴᴱ H (function f ⟨ var x ∈ T ⟩∈ U is B end) (function a defn) (heap (addr a refl (FunctionDefnMismatch p))) | yes refl with heap-weakeningᴮ H B (snoc defn)
reflectᴴᴱ H (function f ⟨ var x ∈ T ⟩∈ U is B end) (function a defn) (heap (addr a refl (FunctionDefnMismatch p))) | yes refl | ok r = expr (FunctionDefnMismatch λ q → p (trans q r))
reflectᴴᴱ H (function f ⟨ var x ∈ T ⟩∈ U is B end) (function a defn) (heap (addr a refl (FunctionDefnMismatch p))) | yes refl | warning W = expr (function₁ W)
reflectᴴᴱ H (function f ⟨ var x ∈ T ⟩∈ U is B end) (function a defn) (heap (addr a refl (function₁ W′))) | yes refl = expr (function₁ (reflect-weakeningᴮ H B (snoc defn) W′))
reflectᴴᴱ H (function f ⟨ var x ∈ T ⟩∈ U is B end) (function a p) (heap (addr b refl W′)) | no r = heap (addr b (lookup-not-allocated p r) (reflect-weakeningᴼ H _ (snoc p) W′))
reflectᴴᴱ H (M $ N) (app₁ s) (heap W′) with reflectᴴᴱ H M s (heap W′)
reflectᴴᴱ H (M $ N) (app₁ s) (heap W′) | heap W = heap W
reflectᴴᴱ H (M $ N) (app₁ s) (heap W′) | expr W = expr (app₁ W)
reflectᴴᴱ H (M $ N) (app₂ p s) (heap W′) with reflectᴴᴱ H N s (heap W′)
reflectᴴᴱ H (M $ N) (app₂ p s) (heap W′) | heap W = heap W
reflectᴴᴱ H (M $ N) (app₂ p s) (heap W′) | expr W = expr (app₂ W)
reflectᴴᴱ H (M $ N) (beta O v p q) (heap W′) = heap W′
reflectᴴᴱ H (block var b ∈ T is B end) (block s) (heap W′) with reflectᴴᴮ H B s (heap W′)
reflectᴴᴱ H (block var b ∈ T is B end) (block s) (heap W′) | heap W = heap W
reflectᴴᴱ H (block var b ∈ T is B end) (block s) (heap W′) | block W = expr (block₁ W)
reflectᴴᴱ H (block var b ∈ T is return N ∙ B end) (return v) (heap W′) = heap W′
reflectᴴᴱ H (block var b ∈ T is done end) done (heap W′) = heap W′
reflectᴴᴱ H (binexp M op N) (binOp₀ s) (heap W′) = heap W′
reflectᴴᴱ H (binexp M op N) (binOp₁ s) (heap W′) with reflectᴴᴱ H M s (heap W′)
reflectᴴᴱ H (binexp M op N) (binOp₁ s) (heap W′) | heap W = heap W
reflectᴴᴱ H (binexp M op N) (binOp₁ s) (heap W′) | expr W = expr (bin₁ W)
reflectᴴᴱ H (binexp M op N) (binOp₂ s) (heap W′) with reflectᴴᴱ H N s (heap W′)
reflectᴴᴱ H (binexp M op N) (binOp₂ s) (heap W′) | heap W = heap W
reflectᴴᴱ H (binexp M op N) (binOp₂ s) (heap W′) | expr W = expr (bin₂ W)
reflectᴴᴮ H B s (block W′) = reflectᴮ H B s W′
reflectᴴᴮ H (local var x ∈ T ← M ∙ B) (local s) (heap W′) with reflectᴴᴱ H M s (heap W′)
reflectᴴᴮ H (local var x ∈ T ← M ∙ B) (local s) (heap W′) | heap W = heap W
reflectᴴᴮ H (local var x ∈ T ← M ∙ B) (local s) (heap W′) | expr W = block (local₁ W)
reflectᴴᴮ H (local var x ∈ T ← M ∙ B) (subst v) (heap W′) = heap W′
reflectᴴᴮ H (function f ⟨ var y ∈ T ⟩∈ U is C end ∙ B) (function a p) (heap (addr b refl W′)) with b ≡ᴬ a
reflectᴴᴮ H (function f ⟨ var y ∈ T ⟩∈ U is C end ∙ B) (function a defn) (heap (addr a refl (FunctionDefnMismatch p))) | yes refl with heap-weakeningᴮ H C (snoc defn)
reflectᴴᴮ H (function f ⟨ var y ∈ T ⟩∈ U is C end ∙ B) (function a defn) (heap (addr a refl (FunctionDefnMismatch p))) | yes refl | ok r = block (FunctionDefnMismatch (λ q → p (trans q r)))
reflectᴴᴮ H (function f ⟨ var y ∈ T ⟩∈ U is C end ∙ B) (function a defn) (heap (addr a refl (FunctionDefnMismatch p))) | yes refl | warning W = block (function₁ W)
reflectᴴᴮ H (function f ⟨ var y ∈ T ⟩∈ U is C end ∙ B) (function a defn) (heap (addr a refl (function₁ W′))) | yes refl = block (function₁ (reflect-weakeningᴮ H C (snoc defn) W′))
reflectᴴᴮ H (function f ⟨ var y ∈ T ⟩∈ U is C end ∙ B) (function a p) (heap (addr b refl W′)) | no r = heap (addr b (lookup-not-allocated p r) (reflect-weakeningᴼ H _ (snoc p) W′))
reflectᴴᴮ H (return M ∙ B) (return s) (heap W′) with reflectᴴᴱ H M s (heap W′)
reflectᴴᴮ H (return M ∙ B) (return s) (heap W′) | heap W = heap W
reflectᴴᴮ H (return M ∙ B) (return s) (heap W′) | expr W = block (return W)
reflect* : ∀ H B {H′ B′} → (H ⊢ B ⟶* B′ ⊣ H′) → Warningᴴᴮ H′ (typeCheckᴴᴮ H′ ∅ B′) → Warningᴴᴮ H (typeCheckᴴᴮ H ∅ B)
reflect* H B refl W = W
reflect* H B (step s t) W = reflectᴴᴮ H B s (reflect* _ _ t W)
runtimeBinOpWarning : ∀ H {op} v → BinOpError op (valueType v) → BinOpWarning op (orNone (typeOfⱽ H v))
runtimeBinOpWarning H v (+ p) = + (λ q → p (mustBeNumber H ∅ v q))
runtimeBinOpWarning H v (- p) = - (λ q → p (mustBeNumber H ∅ v q))
runtimeBinOpWarning H v (* p) = * (λ q → p (mustBeNumber H ∅ v q))
runtimeBinOpWarning H v (/ p) = / (λ q → p (mustBeNumber H ∅ v q))
runtimeBinOpWarning H v (< p) = < (λ q → p (mustBeNumber H ∅ v q))
runtimeBinOpWarning H v (> p) = > (λ q → p (mustBeNumber H ∅ v q))
runtimeBinOpWarning H v (<= p) = <= (λ q → p (mustBeNumber H ∅ v q))
runtimeBinOpWarning H v (>= p) = >= (λ q → p (mustBeNumber H ∅ v q))
runtimeBinOpWarning H v (·· p) = ·· (λ q → p (mustBeString H ∅ v q))
runtimeWarningᴱ : ∀ H M → RuntimeErrorᴱ H M → Warningᴱ H (typeCheckᴱ H ∅ M)
runtimeWarningᴮ : ∀ H B → RuntimeErrorᴮ H B → Warningᴮ H (typeCheckᴮ H ∅ B)
runtimeWarningᴱ H (var x) UnboundVariable = UnboundVariable refl
runtimeWarningᴱ H (val (addr a)) (SEGV p) = UnallocatedAddress p
runtimeWarningᴱ H (M $ N) (FunctionMismatch v w p) with typeOf-val-not-none w
runtimeWarningᴱ H (M $ N) (FunctionMismatch v w p) | ok q = FunctionCallMismatch (λ r → p (mustBeFunction H ∅ v (λ r′ → q (trans r′ r))))
runtimeWarningᴱ H (M $ N) (FunctionMismatch v w p) | warning W = app₂ W
runtimeWarningᴱ H (M $ N) (app₁ err) = app₁ (runtimeWarningᴱ H M err)
runtimeWarningᴱ H (M $ N) (app₂ err) = app₂ (runtimeWarningᴱ H N err)
runtimeWarningᴱ H (block var b ∈ T is B end) (block err) = block₁ (runtimeWarningᴮ H B err)
runtimeWarningᴱ H (binexp M op N) (BinOpMismatch₁ v w p) = BinOpMismatch₁ (runtimeBinOpWarning H v p)
runtimeWarningᴱ H (binexp M op N) (BinOpMismatch₂ v w p) = BinOpMismatch₂ (runtimeBinOpWarning H w p)
runtimeWarningᴱ H (binexp M op N) (bin₁ err) = bin₁ (runtimeWarningᴱ H M err)
runtimeWarningᴱ H (binexp M op N) (bin₂ err) = bin₂ (runtimeWarningᴱ H N err)
runtimeWarningᴮ H (local var x ∈ T ← M ∙ B) (local err) = local₁ (runtimeWarningᴱ H M err)
runtimeWarningᴮ H (return M ∙ B) (return err) = return (runtimeWarningᴱ H M err)
wellTypedProgramsDontGoWrong : ∀ H′ B B′ → (∅ᴴ ⊢ B ⟶* B′ ⊣ H′) → (RuntimeErrorᴮ H′ B′) → Warningᴮ ∅ᴴ (typeCheckᴮ ∅ᴴ ∅ B)
wellTypedProgramsDontGoWrong H′ B B′ t err with reflect* ∅ᴴ B t (block (runtimeWarningᴮ H′ B′ err))
wellTypedProgramsDontGoWrong H′ B B′ t err | heap (addr a refl ())
wellTypedProgramsDontGoWrong H′ B B′ t err | block W = W
| {
"alphanum_fraction": 0.646108993,
"avg_line_length": 84.4863157895,
"ext": "agda",
"hexsha": "77852f1a7459ecce8a5fe0b67d7ee05be5b0481f",
"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/Properties/StrictMode.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/Properties/StrictMode.agda",
"max_line_length": 379,
"max_stars_count": 1,
"max_stars_repo_head_hexsha": "3f69d3a4f2b74dac8ecff2ef8ec851c8636324b6",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "gideros/luau",
"max_stars_repo_path": "prototyping/Properties/StrictMode.agda",
"max_stars_repo_stars_event_max_datetime": "2022-03-18T04:10:20.000Z",
"max_stars_repo_stars_event_min_datetime": "2022-03-18T04:10:20.000Z",
"num_tokens": 17220,
"size": 40131
} |
------------------------------------------------------------------------------
-- Properties for the relation LTL
------------------------------------------------------------------------------
{-# OPTIONS --exact-split #-}
{-# OPTIONS --no-sized-types #-}
{-# OPTIONS --no-universe-polymorphism #-}
{-# OPTIONS --without-K #-}
module FOTC.Data.List.WF-Relation.LT-Length.PropertiesI where
open import Common.FOL.Relation.Binary.EqReasoning
open import FOTC.Base
open import FOTC.Base.List
open import FOTC.Data.Nat.Inequalities
open import FOTC.Data.Nat.Inequalities.PropertiesI as Nat using ()
open import FOTC.Data.List
open import FOTC.Data.List.PropertiesI
open import FOTC.Data.List.WF-Relation.LT-Length
------------------------------------------------------------------------------
xs<[]→⊥ : ∀ {xs} → List xs → ¬ (LTL xs [])
xs<[]→⊥ Lxs xs<[] = lg-xs<lg-[]→⊥ Lxs xs<[]
x∷xs<y∷ys→xs<ys : ∀ {x xs y ys} → List xs → List ys →
LTL (x ∷ xs) (y ∷ ys) → LTL xs ys
x∷xs<y∷ys→xs<ys {x} {xs} {y} {ys} Lxs Lys x∷xs<y∷ys = Nat.Sx<Sy→x<y helper
where
helper : succ₁ (length xs) < succ₁ (length ys)
helper =
lt (succ₁ (length xs)) (succ₁ (length ys))
≡⟨ subst₂ (λ t t' → lt (succ₁ (length xs)) (succ₁ (length ys)) ≡ lt t t')
(sym (length-∷ x xs))
(sym (length-∷ y ys))
refl
⟩
lt (length (x ∷ xs)) (length (y ∷ ys))
≡⟨ x∷xs<y∷ys ⟩
true ∎
<-trans : ∀ {xs ys zs} → List xs → List ys → List zs →
LTL xs ys → LTL ys zs → LTL xs zs
<-trans Lxs Lys Lzs xs<ys ys<zs =
Nat.<-trans (lengthList-N Lxs) (lengthList-N Lys) (lengthList-N Lzs) xs<ys ys<zs
lg-xs≡lg-ys→ys<zx→xs<zs : ∀ {xs ys zs} → length xs ≡ length ys →
LTL ys zs → LTL xs zs
lg-xs≡lg-ys→ys<zx→xs<zs {xs} {ys} {zs} h ys<zs =
lt (length xs) (length zs)
≡⟨ subst (λ t → lt (length xs) (length zs) ≡ lt t (length zs)) h refl ⟩
lt (length ys) (length zs)
≡⟨ ys<zs ⟩
true ∎
xs<y∷ys→xs<ys∨lg-xs≡lg-ys : ∀ {xs y ys} → List xs → List ys →
LTL xs (y ∷ ys) →
LTL xs ys ∨ length xs ≡ length ys
xs<y∷ys→xs<ys∨lg-xs≡lg-ys {xs} {y} {ys} Lxs Lys xs<y∷ys =
Nat.x<Sy→x<y∨x≡y (lengthList-N Lxs) (lengthList-N Lys) helper
where
helper : length xs < succ₁ (length ys)
helper =
lt (length xs) (succ₁ (length ys))
≡⟨ subst (λ t → lt (length xs) (succ₁ (length ys)) ≡ lt (length xs) t)
(sym (length-∷ y ys))
refl
⟩
lt (length xs) (length (y ∷ ys))
≡⟨ xs<y∷ys ⟩
true ∎
| {
"alphanum_fraction": 0.4956056553,
"avg_line_length": 35.3648648649,
"ext": "agda",
"hexsha": "0d9b4c5ccb2a99a52e6b21ce37677a917ab9187c",
"lang": "Agda",
"max_forks_count": 3,
"max_forks_repo_forks_event_max_datetime": "2018-03-14T08:50:00.000Z",
"max_forks_repo_forks_event_min_datetime": "2016-09-19T14:18:30.000Z",
"max_forks_repo_head_hexsha": "2fc9f2b81052a2e0822669f02036c5750371b72d",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "asr/fotc",
"max_forks_repo_path": "src/fot/FOTC/Data/List/WF-Relation/LT-Length/PropertiesI.agda",
"max_issues_count": 2,
"max_issues_repo_head_hexsha": "2fc9f2b81052a2e0822669f02036c5750371b72d",
"max_issues_repo_issues_event_max_datetime": "2017-01-01T14:34:26.000Z",
"max_issues_repo_issues_event_min_datetime": "2016-10-12T17:28:16.000Z",
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "asr/fotc",
"max_issues_repo_path": "src/fot/FOTC/Data/List/WF-Relation/LT-Length/PropertiesI.agda",
"max_line_length": 82,
"max_stars_count": 11,
"max_stars_repo_head_hexsha": "2fc9f2b81052a2e0822669f02036c5750371b72d",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "asr/fotc",
"max_stars_repo_path": "src/fot/FOTC/Data/List/WF-Relation/LT-Length/PropertiesI.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": 901,
"size": 2617
} |
module Optics.Lens where
open import Agda.Primitive using (Level; _⊔_; lsuc)
open import Data.Product using (_×_; _,_; ∃-syntax)
open import Function.Inverse using (_↔_; inverse)
open import Relation.Binary.PropositionalEquality using (_≡_; refl; module ≡-Reasoning; cong)
open import Category.Functor.Arr
open import Category.Functor.Const
open import Category.Profunctor.Star
open import Category.Strong
open import Optics
Lens : ∀ {l} (S T A B : Set l) → Set (lsuc l)
Lens = Optic StrongImp
module Lens {l} {S T A B : Set l} (lens : Lens S T A B) where
get : S → A
get = getOptic S T A B (starStrong constFunctor) lens
set : S → B → T
set = setOptic S T A B (starStrong arrFunctor) lens
record LawfulLens {l} {S A : Set l} (lens' : Lens S S A A) : Set (lsuc l) where
open Lens lens' public
lens : Lens S S A A
lens = lens'
field
setget : ∀ (s : S) → set s (get s) ≡ s
getset : ∀ (s : S) (a : A) → get (set s a) ≡ a
setset : ∀ (s : S) (a a' : A) → set (set s a) ≡ set s
lensIso : ∀ {l} {S A : Set l} {lens : Lens S S A A} → (lawful : LawfulLens lens) → S ↔ (∃[ a ] ∃[ c ] ∃[ s ] (c ≡ Lens.set lens s × Lens.get lens s ≡ a))
lensIso {_} {S} {A} lawful = inverse to from from∘to to∘from
where
open LawfulLens lawful
to : S → ∃[ a ] ∃[ c ] ∃[ s ] (c ≡ set s × get s ≡ a)
to s = get s , set s , s , refl , refl
from : ∃[ a ] ∃[ c ] ∃[ s ] (c ≡ set s × get s ≡ a) → S
from (a , c , _ , _ , _) = c a
from∘to : (s : S) → from (to s) ≡ s
from∘to = setget
to∘from : (elem : ∃[ a ] ∃[ c ] ∃[ s ] (c ≡ set s × get s ≡ a)) → to (from elem) ≡ elem
open ≡-Reasoning
to∘from (.(get s) , .(set s) , s , refl , refl) = begin
(get (set s (get s)) , set (set s (get s)) , set s (get s) , _ , _) ≡⟨ cong (λ sᵢ → get sᵢ , set sᵢ , sᵢ , refl , refl) (setget s) ⟩
(get s , set s , s , _ , _) ∎
| {
"alphanum_fraction": 0.5575692964,
"avg_line_length": 39.0833333333,
"ext": "agda",
"hexsha": "3a36bf4da2ecdb0ca60fad5de7c9897c5150f2b3",
"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/Optics/Lens.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/Optics/Lens.agda",
"max_line_length": 153,
"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/Optics/Lens.agda",
"max_stars_repo_stars_event_max_datetime": null,
"max_stars_repo_stars_event_min_datetime": null,
"num_tokens": 760,
"size": 1876
} |
{-# OPTIONS --without-K --rewriting #-}
{-
Imports everything that is not imported by something else.
This is not supposed to be used anywhere, this is just a simple way to
do `make all'
This file is intentionally named index.agda so that
Agda will generate index.html.
-}
module index where
{- some group theory results -}
import groups.ReducedWord
import groups.ProductRepr
import groups.CoefficientExtensionality
{- homotopy groups of circles -}
import homotopy.LoopSpaceCircle
import homotopy.PinSn
import homotopy.HopfJunior
import homotopy.Hopf
{- cohomology -}
import cohomology.EMModel
import cohomology.Sigma
import cohomology.Coproduct
import cohomology.Torus
-- import cohomology.MayerVietorisExact -- FIXME
{- prop * prop is still a prop -}
import homotopy.PropJoinProp
{- a space with preassigned homotopy groups -}
import homotopy.SpaceFromGroups
{- pushout 3x3 lemma -}
{- These takes lots of time and memory to check. -}
-- import homotopy.3x3.Commutes -- commented out because this does not run on travis.
-- import homotopy.JoinAssoc3x3 -- commented out because this does not run on travis.
{- covering spaces -}
import homotopy.GroupSetsRepresentCovers
import homotopy.AnyUniversalCoverIsPathSet
import homotopy.PathSetIsInitalCover
{- van kampen -}
import homotopy.VanKampen
{- blakers massey -}
import homotopy.BlakersMassey
{- cw complexes -}
import cw.CW
import cw.examples.Examples
-- cellular cohomology groups
import cw.cohomology.CellularChainComplex
-- Eilenberg-Steenred cohomology groups rephrased
import cw.cohomology.ReconstructedCohomologyGroups
-- isomorphisms between the cochains the heads
import cw.cohomology.ReconstructedCochainsIsoCellularCochains
-- There are some unported theorems
-- import Spaces.IntervalProps
-- import Algebra.F2NotCommutative
-- import Spaces.LoopSpaceDecidableWedgeCircles
-- import Homotopy.PullbackIsPullback
-- import Homotopy.PushoutIsPushout
-- import Homotopy.Truncation
-- import Sets.QuotientUP
| {
"alphanum_fraction": 0.802824004,
"avg_line_length": 27.1643835616,
"ext": "agda",
"hexsha": "d34751414bea0e5763d5e7c6036e7f14740ca209",
"lang": "Agda",
"max_forks_count": 1,
"max_forks_repo_forks_event_max_datetime": "2018-12-26T21:31:57.000Z",
"max_forks_repo_forks_event_min_datetime": "2018-12-26T21:31:57.000Z",
"max_forks_repo_head_hexsha": "e7d663b63d89f380ab772ecb8d51c38c26952dbb",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "mikeshulman/HoTT-Agda",
"max_forks_repo_path": "theorems/index.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "e7d663b63d89f380ab772ecb8d51c38c26952dbb",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "mikeshulman/HoTT-Agda",
"max_issues_repo_path": "theorems/index.agda",
"max_line_length": 85,
"max_stars_count": null,
"max_stars_repo_head_hexsha": "e7d663b63d89f380ab772ecb8d51c38c26952dbb",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "mikeshulman/HoTT-Agda",
"max_stars_repo_path": "theorems/index.agda",
"max_stars_repo_stars_event_max_datetime": null,
"max_stars_repo_stars_event_min_datetime": null,
"num_tokens": 533,
"size": 1983
} |
module cedille where
open import lib
open import cedille-types public
----------------------------------------------------------------------------------
-- Run-rewriting rules
----------------------------------------------------------------------------------
data gratr2-nt : Set where
_ws-plus-77 : gratr2-nt
_ws : gratr2-nt
_vars : gratr2-nt
_var-star-12 : gratr2-nt
_var-bar-11 : gratr2-nt
_var : gratr2-nt
_type : gratr2-nt
_tk : gratr2-nt
_theta : gratr2-nt
_term : gratr2-nt
_start : gratr2-nt
_rho : gratr2-nt
_qvar : gratr2-nt
_qkvar : gratr2-nt
_pterm : gratr2-nt
_posinfo : gratr2-nt
_params : gratr2-nt
_ows-star-78 : gratr2-nt
_ows : gratr2-nt
_otherpunct-bar-67 : gratr2-nt
_otherpunct-bar-66 : gratr2-nt
_otherpunct-bar-65 : gratr2-nt
_otherpunct-bar-64 : gratr2-nt
_otherpunct-bar-63 : gratr2-nt
_otherpunct-bar-62 : gratr2-nt
_otherpunct-bar-61 : gratr2-nt
_otherpunct-bar-60 : gratr2-nt
_otherpunct-bar-59 : gratr2-nt
_otherpunct-bar-58 : gratr2-nt
_otherpunct-bar-57 : gratr2-nt
_otherpunct-bar-56 : gratr2-nt
_otherpunct-bar-55 : gratr2-nt
_otherpunct-bar-54 : gratr2-nt
_otherpunct-bar-53 : gratr2-nt
_otherpunct-bar-52 : gratr2-nt
_otherpunct-bar-51 : gratr2-nt
_otherpunct-bar-50 : gratr2-nt
_otherpunct-bar-49 : gratr2-nt
_otherpunct-bar-48 : gratr2-nt
_otherpunct-bar-47 : gratr2-nt
_otherpunct-bar-46 : gratr2-nt
_otherpunct-bar-45 : gratr2-nt
_otherpunct-bar-44 : gratr2-nt
_otherpunct-bar-43 : gratr2-nt
_otherpunct-bar-42 : gratr2-nt
_otherpunct-bar-41 : gratr2-nt
_otherpunct-bar-40 : gratr2-nt
_otherpunct-bar-39 : gratr2-nt
_otherpunct-bar-38 : gratr2-nt
_otherpunct-bar-37 : gratr2-nt
_otherpunct-bar-36 : gratr2-nt
_otherpunct-bar-35 : gratr2-nt
_otherpunct-bar-34 : gratr2-nt
_otherpunct-bar-33 : gratr2-nt
_otherpunct-bar-32 : gratr2-nt
_otherpunct-bar-31 : gratr2-nt
_otherpunct-bar-30 : gratr2-nt
_otherpunct-bar-29 : gratr2-nt
_otherpunct-bar-28 : gratr2-nt
_otherpunct-bar-27 : gratr2-nt
_otherpunct-bar-26 : gratr2-nt
_otherpunct-bar-25 : gratr2-nt
_otherpunct-bar-24 : gratr2-nt
_otherpunct-bar-23 : gratr2-nt
_otherpunct-bar-22 : gratr2-nt
_otherpunct-bar-21 : gratr2-nt
_otherpunct : gratr2-nt
_optType : gratr2-nt
_optTerm : gratr2-nt
_optClass : gratr2-nt
_optAs : gratr2-nt
_numpunct-bar-9 : gratr2-nt
_numpunct-bar-8 : gratr2-nt
_numpunct-bar-7 : gratr2-nt
_numpunct-bar-6 : gratr2-nt
_numpunct-bar-10 : gratr2-nt
_numpunct : gratr2-nt
_numone-range-4 : gratr2-nt
_numone : gratr2-nt
_num-plus-5 : gratr2-nt
_num : gratr2-nt
_maybeMinus : gratr2-nt
_maybeErased : gratr2-nt
_maybeCheckType : gratr2-nt
_maybeAtype : gratr2-nt
_ltype : gratr2-nt
_lterms : gratr2-nt
_lterm : gratr2-nt
_lliftingType : gratr2-nt
_liftingType : gratr2-nt
_leftRight : gratr2-nt
_lam : gratr2-nt
_kvar-star-20 : gratr2-nt
_kvar-bar-19 : gratr2-nt
_kvar : gratr2-nt
_kind : gratr2-nt
_imprt : gratr2-nt
_imports : gratr2-nt
_fpth-star-18 : gratr2-nt
_fpth-plus-14 : gratr2-nt
_fpth-bar-17 : gratr2-nt
_fpth-bar-16 : gratr2-nt
_fpth-bar-15 : gratr2-nt
_fpth : gratr2-nt
_defTermOrType : gratr2-nt
_decl : gratr2-nt
_comment-star-73 : gratr2-nt
_comment : gratr2-nt
_cmds : gratr2-nt
_cmd : gratr2-nt
_bvar-bar-13 : gratr2-nt
_bvar : gratr2-nt
_binder : gratr2-nt
_aws-bar-76 : gratr2-nt
_aws-bar-75 : gratr2-nt
_aws-bar-74 : gratr2-nt
_aws : gratr2-nt
_atype : gratr2-nt
_aterm : gratr2-nt
_arrowtype : gratr2-nt
_args : gratr2-nt
_arg : gratr2-nt
_anychar-bar-72 : gratr2-nt
_anychar-bar-71 : gratr2-nt
_anychar-bar-70 : gratr2-nt
_anychar-bar-69 : gratr2-nt
_anychar-bar-68 : gratr2-nt
_anychar : gratr2-nt
_alpha-range-2 : gratr2-nt
_alpha-range-1 : gratr2-nt
_alpha-bar-3 : gratr2-nt
_alpha : gratr2-nt
gratr2-nt-eq : gratr2-nt → gratr2-nt → 𝔹
gratr2-nt-eq _ws-plus-77 _ws-plus-77 = tt
gratr2-nt-eq _ws _ws = tt
gratr2-nt-eq _vars _vars = tt
gratr2-nt-eq _var-star-12 _var-star-12 = tt
gratr2-nt-eq _var-bar-11 _var-bar-11 = tt
gratr2-nt-eq _var _var = tt
gratr2-nt-eq _type _type = tt
gratr2-nt-eq _tk _tk = tt
gratr2-nt-eq _theta _theta = tt
gratr2-nt-eq _term _term = tt
gratr2-nt-eq _start _start = tt
gratr2-nt-eq _rho _rho = tt
gratr2-nt-eq _qvar _qvar = tt
gratr2-nt-eq _qkvar _qkvar = tt
gratr2-nt-eq _pterm _pterm = tt
gratr2-nt-eq _posinfo _posinfo = tt
gratr2-nt-eq _params _params = tt
gratr2-nt-eq _ows-star-78 _ows-star-78 = tt
gratr2-nt-eq _ows _ows = tt
gratr2-nt-eq _otherpunct-bar-67 _otherpunct-bar-67 = tt
gratr2-nt-eq _otherpunct-bar-66 _otherpunct-bar-66 = tt
gratr2-nt-eq _otherpunct-bar-65 _otherpunct-bar-65 = tt
gratr2-nt-eq _otherpunct-bar-64 _otherpunct-bar-64 = tt
gratr2-nt-eq _otherpunct-bar-63 _otherpunct-bar-63 = tt
gratr2-nt-eq _otherpunct-bar-62 _otherpunct-bar-62 = tt
gratr2-nt-eq _otherpunct-bar-61 _otherpunct-bar-61 = tt
gratr2-nt-eq _otherpunct-bar-60 _otherpunct-bar-60 = tt
gratr2-nt-eq _otherpunct-bar-59 _otherpunct-bar-59 = tt
gratr2-nt-eq _otherpunct-bar-58 _otherpunct-bar-58 = tt
gratr2-nt-eq _otherpunct-bar-57 _otherpunct-bar-57 = tt
gratr2-nt-eq _otherpunct-bar-56 _otherpunct-bar-56 = tt
gratr2-nt-eq _otherpunct-bar-55 _otherpunct-bar-55 = tt
gratr2-nt-eq _otherpunct-bar-54 _otherpunct-bar-54 = tt
gratr2-nt-eq _otherpunct-bar-53 _otherpunct-bar-53 = tt
gratr2-nt-eq _otherpunct-bar-52 _otherpunct-bar-52 = tt
gratr2-nt-eq _otherpunct-bar-51 _otherpunct-bar-51 = tt
gratr2-nt-eq _otherpunct-bar-50 _otherpunct-bar-50 = tt
gratr2-nt-eq _otherpunct-bar-49 _otherpunct-bar-49 = tt
gratr2-nt-eq _otherpunct-bar-48 _otherpunct-bar-48 = tt
gratr2-nt-eq _otherpunct-bar-47 _otherpunct-bar-47 = tt
gratr2-nt-eq _otherpunct-bar-46 _otherpunct-bar-46 = tt
gratr2-nt-eq _otherpunct-bar-45 _otherpunct-bar-45 = tt
gratr2-nt-eq _otherpunct-bar-44 _otherpunct-bar-44 = tt
gratr2-nt-eq _otherpunct-bar-43 _otherpunct-bar-43 = tt
gratr2-nt-eq _otherpunct-bar-42 _otherpunct-bar-42 = tt
gratr2-nt-eq _otherpunct-bar-41 _otherpunct-bar-41 = tt
gratr2-nt-eq _otherpunct-bar-40 _otherpunct-bar-40 = tt
gratr2-nt-eq _otherpunct-bar-39 _otherpunct-bar-39 = tt
gratr2-nt-eq _otherpunct-bar-38 _otherpunct-bar-38 = tt
gratr2-nt-eq _otherpunct-bar-37 _otherpunct-bar-37 = tt
gratr2-nt-eq _otherpunct-bar-36 _otherpunct-bar-36 = tt
gratr2-nt-eq _otherpunct-bar-35 _otherpunct-bar-35 = tt
gratr2-nt-eq _otherpunct-bar-34 _otherpunct-bar-34 = tt
gratr2-nt-eq _otherpunct-bar-33 _otherpunct-bar-33 = tt
gratr2-nt-eq _otherpunct-bar-32 _otherpunct-bar-32 = tt
gratr2-nt-eq _otherpunct-bar-31 _otherpunct-bar-31 = tt
gratr2-nt-eq _otherpunct-bar-30 _otherpunct-bar-30 = tt
gratr2-nt-eq _otherpunct-bar-29 _otherpunct-bar-29 = tt
gratr2-nt-eq _otherpunct-bar-28 _otherpunct-bar-28 = tt
gratr2-nt-eq _otherpunct-bar-27 _otherpunct-bar-27 = tt
gratr2-nt-eq _otherpunct-bar-26 _otherpunct-bar-26 = tt
gratr2-nt-eq _otherpunct-bar-25 _otherpunct-bar-25 = tt
gratr2-nt-eq _otherpunct-bar-24 _otherpunct-bar-24 = tt
gratr2-nt-eq _otherpunct-bar-23 _otherpunct-bar-23 = tt
gratr2-nt-eq _otherpunct-bar-22 _otherpunct-bar-22 = tt
gratr2-nt-eq _otherpunct-bar-21 _otherpunct-bar-21 = tt
gratr2-nt-eq _otherpunct _otherpunct = tt
gratr2-nt-eq _optType _optType = tt
gratr2-nt-eq _optTerm _optTerm = tt
gratr2-nt-eq _optClass _optClass = tt
gratr2-nt-eq _optAs _optAs = tt
gratr2-nt-eq _numpunct-bar-9 _numpunct-bar-9 = tt
gratr2-nt-eq _numpunct-bar-8 _numpunct-bar-8 = tt
gratr2-nt-eq _numpunct-bar-7 _numpunct-bar-7 = tt
gratr2-nt-eq _numpunct-bar-6 _numpunct-bar-6 = tt
gratr2-nt-eq _numpunct-bar-10 _numpunct-bar-10 = tt
gratr2-nt-eq _numpunct _numpunct = tt
gratr2-nt-eq _numone-range-4 _numone-range-4 = tt
gratr2-nt-eq _numone _numone = tt
gratr2-nt-eq _num-plus-5 _num-plus-5 = tt
gratr2-nt-eq _num _num = tt
gratr2-nt-eq _maybeMinus _maybeMinus = tt
gratr2-nt-eq _maybeErased _maybeErased = tt
gratr2-nt-eq _maybeCheckType _maybeCheckType = tt
gratr2-nt-eq _maybeAtype _maybeAtype = tt
gratr2-nt-eq _ltype _ltype = tt
gratr2-nt-eq _lterms _lterms = tt
gratr2-nt-eq _lterm _lterm = tt
gratr2-nt-eq _lliftingType _lliftingType = tt
gratr2-nt-eq _liftingType _liftingType = tt
gratr2-nt-eq _leftRight _leftRight = tt
gratr2-nt-eq _lam _lam = tt
gratr2-nt-eq _kvar-star-20 _kvar-star-20 = tt
gratr2-nt-eq _kvar-bar-19 _kvar-bar-19 = tt
gratr2-nt-eq _kvar _kvar = tt
gratr2-nt-eq _kind _kind = tt
gratr2-nt-eq _imprt _imprt = tt
gratr2-nt-eq _imports _imports = tt
gratr2-nt-eq _fpth-star-18 _fpth-star-18 = tt
gratr2-nt-eq _fpth-plus-14 _fpth-plus-14 = tt
gratr2-nt-eq _fpth-bar-17 _fpth-bar-17 = tt
gratr2-nt-eq _fpth-bar-16 _fpth-bar-16 = tt
gratr2-nt-eq _fpth-bar-15 _fpth-bar-15 = tt
gratr2-nt-eq _fpth _fpth = tt
gratr2-nt-eq _defTermOrType _defTermOrType = tt
gratr2-nt-eq _decl _decl = tt
gratr2-nt-eq _comment-star-73 _comment-star-73 = tt
gratr2-nt-eq _comment _comment = tt
gratr2-nt-eq _cmds _cmds = tt
gratr2-nt-eq _cmd _cmd = tt
gratr2-nt-eq _bvar-bar-13 _bvar-bar-13 = tt
gratr2-nt-eq _bvar _bvar = tt
gratr2-nt-eq _binder _binder = tt
gratr2-nt-eq _aws-bar-76 _aws-bar-76 = tt
gratr2-nt-eq _aws-bar-75 _aws-bar-75 = tt
gratr2-nt-eq _aws-bar-74 _aws-bar-74 = tt
gratr2-nt-eq _aws _aws = tt
gratr2-nt-eq _atype _atype = tt
gratr2-nt-eq _aterm _aterm = tt
gratr2-nt-eq _arrowtype _arrowtype = tt
gratr2-nt-eq _args _args = tt
gratr2-nt-eq _arg _arg = tt
gratr2-nt-eq _anychar-bar-72 _anychar-bar-72 = tt
gratr2-nt-eq _anychar-bar-71 _anychar-bar-71 = tt
gratr2-nt-eq _anychar-bar-70 _anychar-bar-70 = tt
gratr2-nt-eq _anychar-bar-69 _anychar-bar-69 = tt
gratr2-nt-eq _anychar-bar-68 _anychar-bar-68 = tt
gratr2-nt-eq _anychar _anychar = tt
gratr2-nt-eq _alpha-range-2 _alpha-range-2 = tt
gratr2-nt-eq _alpha-range-1 _alpha-range-1 = tt
gratr2-nt-eq _alpha-bar-3 _alpha-bar-3 = tt
gratr2-nt-eq _alpha _alpha = tt
gratr2-nt-eq _ _ = ff
open import rtn gratr2-nt
cedille-start : gratr2-nt → 𝕃 gratr2-rule
cedille-start _ws-plus-77 = (just "P225" , nothing , just _ws-plus-77 , inj₁ _aws :: inj₁ _ws-plus-77 :: []) :: (just "P224" , nothing , just _ws-plus-77 , inj₁ _aws :: []) :: []
cedille-start _ws = (just "P226" , nothing , just _ws , inj₁ _ws-plus-77 :: []) :: []
cedille-start _vars = (just "VarsStart" , nothing , just _vars , inj₁ _var :: []) :: (just "VarsNext" , nothing , just _vars , inj₁ _var :: inj₁ _ws :: inj₁ _vars :: []) :: []
cedille-start _var-star-12 = (just "P85" , nothing , just _var-star-12 , inj₁ _var-bar-11 :: inj₁ _var-star-12 :: []) :: (just "P84" , nothing , just _var-star-12 , []) :: []
cedille-start _var-bar-11 = (just "P83" , nothing , just _var-bar-11 , inj₁ _numpunct :: []) :: (just "P82" , nothing , just _var-bar-11 , inj₁ _alpha :: []) :: []
cedille-start _var = (just "P86" , nothing , just _var , inj₁ _alpha :: inj₁ _var-star-12 :: []) :: []
cedille-start _type = (just "embed" , just "embed_end" , just _type , inj₁ _ltype :: []) :: (just "TpLambda" , nothing , just _type , inj₁ _posinfo :: inj₂ 'λ' :: inj₁ _ows :: inj₁ _posinfo :: inj₁ _bvar :: inj₁ _ows :: inj₂ ':' :: inj₁ _ows :: inj₁ _tk :: inj₁ _ows :: inj₂ '.' :: inj₁ _ows :: inj₁ _type :: []) :: (just "TpEq" , nothing , just _type , inj₁ _term :: inj₁ _ows :: inj₂ '≃' :: inj₁ _ows :: inj₁ _term :: []) :: (just "TpArrow" , nothing , just _type , inj₁ _ltype :: inj₁ _ows :: inj₁ _arrowtype :: inj₁ _ows :: inj₁ _type :: []) :: (just "NoSpans" , nothing , just _type , inj₂ '{' :: inj₂ '^' :: inj₁ _type :: inj₁ _posinfo :: inj₂ '^' :: inj₂ '}' :: []) :: (just "Iota" , nothing , just _type , inj₁ _posinfo :: inj₂ 'ι' :: inj₁ _ows :: inj₁ _posinfo :: inj₁ _bvar :: inj₁ _optType :: inj₁ _ows :: inj₂ '.' :: inj₁ _ows :: inj₁ _type :: []) :: (just "Abs" , nothing , just _type , inj₁ _posinfo :: inj₁ _binder :: inj₁ _ows :: inj₁ _posinfo :: inj₁ _bvar :: inj₁ _ows :: inj₂ ':' :: inj₁ _ows :: inj₁ _tk :: inj₁ _ows :: inj₂ '.' :: inj₁ _ows :: inj₁ _type :: []) :: []
cedille-start _tk = (just "Tkt" , nothing , just _tk , inj₁ _type :: []) :: (just "Tkk" , just "Tkk_end" , just _tk , inj₁ _kind :: []) :: []
cedille-start _theta = (just "AbstractVars" , nothing , just _theta , inj₂ 'θ' :: inj₂ '<' :: inj₁ _ows :: inj₁ _vars :: inj₁ _ows :: inj₂ '>' :: []) :: (just "AbstractEq" , nothing , just _theta , inj₂ 'θ' :: inj₂ '+' :: []) :: (just "Abstract" , nothing , just _theta , inj₂ 'θ' :: []) :: []
cedille-start _term = (just "embed" , just "embed_end" , just _term , inj₁ _aterm :: []) :: (just "Theta" , nothing , just _term , inj₁ _posinfo :: inj₁ _theta :: inj₁ _ws :: inj₁ _lterm :: inj₁ _ows :: inj₁ _lterms :: []) :: (just "Let" , nothing , just _term , inj₁ _posinfo :: inj₂ 'l' :: inj₂ 'e' :: inj₂ 't' :: inj₁ _ws :: inj₁ _defTermOrType :: inj₁ _ws :: inj₂ 'i' :: inj₂ 'n' :: inj₁ _ws :: inj₁ _term :: []) :: (just "Lam" , nothing , just _term , inj₁ _posinfo :: inj₁ _lam :: inj₁ _ows :: inj₁ _posinfo :: inj₁ _bvar :: inj₁ _optClass :: inj₁ _ows :: inj₂ '.' :: inj₁ _ows :: inj₁ _term :: []) :: []
cedille-start _start = (just "File" , nothing , just _start , inj₁ _posinfo :: inj₁ _ows :: inj₁ _imports :: inj₂ 'm' :: inj₂ 'o' :: inj₂ 'd' :: inj₂ 'u' :: inj₂ 'l' :: inj₂ 'e' :: inj₁ _ws :: inj₁ _qvar :: inj₁ _ows :: inj₁ _params :: inj₁ _ows :: inj₂ '.' :: inj₁ _ows :: inj₁ _cmds :: inj₁ _ows :: inj₁ _posinfo :: []) :: []
cedille-start _rho = (just "RhoPlus" , nothing , just _rho , inj₂ 'ρ' :: inj₂ '+' :: []) :: (just "RhoPlain" , nothing , just _rho , inj₂ 'ρ' :: []) :: []
cedille-start _qvar = (just "P81" , nothing , just _qvar , inj₁ _var :: inj₂ '.' :: inj₁ _qvar :: []) :: (just "P80" , nothing , just _qvar , inj₁ _var :: []) :: []
cedille-start _qkvar = (just "P102" , nothing , just _qkvar , inj₁ _var :: inj₂ '.' :: inj₁ _qkvar :: []) :: (just "P101" , nothing , just _qkvar , inj₁ _kvar :: []) :: []
cedille-start _pterm = (just "Var" , nothing , just _pterm , inj₁ _posinfo :: inj₁ _qvar :: []) :: (just "Parens" , nothing , just _pterm , inj₁ _posinfo :: inj₂ '(' :: inj₁ _ows :: inj₁ _term :: inj₁ _ows :: inj₂ ')' :: inj₁ _posinfo :: []) :: (just "IotaPair" , nothing , just _pterm , inj₁ _posinfo :: inj₂ '[' :: inj₁ _ows :: inj₁ _term :: inj₁ _ows :: inj₂ ',' :: inj₁ _ows :: inj₁ _term :: inj₁ _ows :: inj₂ ']' :: inj₁ _posinfo :: []) :: (just "Hole" , nothing , just _pterm , inj₁ _posinfo :: inj₂ '●' :: []) :: []
cedille-start _posinfo = (just "Posinfo" , nothing , just _posinfo , []) :: []
cedille-start _params = (just "ParamsNil" , nothing , just _params , []) :: (just "ParamsCons" , nothing , just _params , inj₁ _ows :: inj₁ _decl :: inj₁ _params :: []) :: []
cedille-start _ows-star-78 = (just "P228" , nothing , just _ows-star-78 , inj₁ _aws :: inj₁ _ows-star-78 :: []) :: (just "P227" , nothing , just _ows-star-78 , []) :: []
cedille-start _ows = (just "P229" , nothing , just _ows , inj₁ _ows-star-78 :: []) :: []
cedille-start _otherpunct-bar-67 = (just "P201" , nothing , just _otherpunct-bar-67 , inj₁ _otherpunct-bar-66 :: []) :: (just "P200" , nothing , just _otherpunct-bar-67 , inj₂ '|' :: []) :: []
cedille-start _otherpunct-bar-66 = (just "P199" , nothing , just _otherpunct-bar-66 , inj₁ _otherpunct-bar-65 :: []) :: (just "P198" , nothing , just _otherpunct-bar-66 , inj₂ '□' :: []) :: []
cedille-start _otherpunct-bar-65 = (just "P197" , nothing , just _otherpunct-bar-65 , inj₁ _otherpunct-bar-64 :: []) :: (just "P196" , nothing , just _otherpunct-bar-65 , inj₂ 'Π' :: []) :: []
cedille-start _otherpunct-bar-64 = (just "P195" , nothing , just _otherpunct-bar-64 , inj₁ _otherpunct-bar-63 :: []) :: (just "P194" , nothing , just _otherpunct-bar-64 , inj₂ 'ι' :: []) :: []
cedille-start _otherpunct-bar-63 = (just "P193" , nothing , just _otherpunct-bar-63 , inj₁ _otherpunct-bar-62 :: []) :: (just "P192" , nothing , just _otherpunct-bar-63 , inj₂ 'λ' :: []) :: []
cedille-start _otherpunct-bar-62 = (just "P191" , nothing , just _otherpunct-bar-62 , inj₁ _otherpunct-bar-61 :: []) :: (just "P190" , nothing , just _otherpunct-bar-62 , inj₂ '∀' :: []) :: []
cedille-start _otherpunct-bar-61 = (just "P189" , nothing , just _otherpunct-bar-61 , inj₁ _otherpunct-bar-60 :: []) :: (just "P188" , nothing , just _otherpunct-bar-61 , inj₂ 'π' :: []) :: []
cedille-start _otherpunct-bar-60 = (just "P187" , nothing , just _otherpunct-bar-60 , inj₁ _otherpunct-bar-59 :: []) :: (just "P186" , nothing , just _otherpunct-bar-60 , inj₂ '★' :: []) :: []
cedille-start _otherpunct-bar-59 = (just "P185" , nothing , just _otherpunct-bar-59 , inj₁ _otherpunct-bar-58 :: []) :: (just "P184" , nothing , just _otherpunct-bar-59 , inj₂ '☆' :: []) :: []
cedille-start _otherpunct-bar-58 = (just "P183" , nothing , just _otherpunct-bar-58 , inj₁ _otherpunct-bar-57 :: []) :: (just "P182" , nothing , just _otherpunct-bar-58 , inj₂ '·' :: []) :: []
cedille-start _otherpunct-bar-57 = (just "P181" , nothing , just _otherpunct-bar-57 , inj₁ _otherpunct-bar-56 :: []) :: (just "P180" , nothing , just _otherpunct-bar-57 , inj₂ '⇐' :: []) :: []
cedille-start _otherpunct-bar-56 = (just "P179" , nothing , just _otherpunct-bar-56 , inj₁ _otherpunct-bar-55 :: []) :: (just "P178" , nothing , just _otherpunct-bar-56 , inj₂ '➔' :: []) :: []
cedille-start _otherpunct-bar-55 = (just "P177" , nothing , just _otherpunct-bar-55 , inj₁ _otherpunct-bar-54 :: []) :: (just "P176" , nothing , just _otherpunct-bar-55 , inj₂ '➾' :: []) :: []
cedille-start _otherpunct-bar-54 = (just "P175" , nothing , just _otherpunct-bar-54 , inj₁ _otherpunct-bar-53 :: []) :: (just "P174" , nothing , just _otherpunct-bar-54 , inj₂ '↑' :: []) :: []
cedille-start _otherpunct-bar-53 = (just "P173" , nothing , just _otherpunct-bar-53 , inj₁ _otherpunct-bar-52 :: []) :: (just "P172" , nothing , just _otherpunct-bar-53 , inj₂ '●' :: []) :: []
cedille-start _otherpunct-bar-52 = (just "P171" , nothing , just _otherpunct-bar-52 , inj₁ _otherpunct-bar-51 :: []) :: (just "P170" , nothing , just _otherpunct-bar-52 , inj₂ '(' :: []) :: []
cedille-start _otherpunct-bar-51 = (just "P169" , nothing , just _otherpunct-bar-51 , inj₁ _otherpunct-bar-50 :: []) :: (just "P168" , nothing , just _otherpunct-bar-51 , inj₂ ')' :: []) :: []
cedille-start _otherpunct-bar-50 = (just "P167" , nothing , just _otherpunct-bar-50 , inj₁ _otherpunct-bar-49 :: []) :: (just "P166" , nothing , just _otherpunct-bar-50 , inj₂ ':' :: []) :: []
cedille-start _otherpunct-bar-49 = (just "P165" , nothing , just _otherpunct-bar-49 , inj₁ _otherpunct-bar-48 :: []) :: (just "P164" , nothing , just _otherpunct-bar-49 , inj₂ '.' :: []) :: []
cedille-start _otherpunct-bar-48 = (just "P163" , nothing , just _otherpunct-bar-48 , inj₁ _otherpunct-bar-47 :: []) :: (just "P162" , nothing , just _otherpunct-bar-48 , inj₂ '[' :: []) :: []
cedille-start _otherpunct-bar-47 = (just "P161" , nothing , just _otherpunct-bar-47 , inj₁ _otherpunct-bar-46 :: []) :: (just "P160" , nothing , just _otherpunct-bar-47 , inj₂ ']' :: []) :: []
cedille-start _otherpunct-bar-46 = (just "P159" , nothing , just _otherpunct-bar-46 , inj₁ _otherpunct-bar-45 :: []) :: (just "P158" , nothing , just _otherpunct-bar-46 , inj₂ ',' :: []) :: []
cedille-start _otherpunct-bar-45 = (just "P157" , nothing , just _otherpunct-bar-45 , inj₁ _otherpunct-bar-44 :: []) :: (just "P156" , nothing , just _otherpunct-bar-45 , inj₂ '!' :: []) :: []
cedille-start _otherpunct-bar-44 = (just "P155" , nothing , just _otherpunct-bar-44 , inj₁ _otherpunct-bar-43 :: []) :: (just "P154" , nothing , just _otherpunct-bar-44 , inj₂ '{' :: []) :: []
cedille-start _otherpunct-bar-43 = (just "P153" , nothing , just _otherpunct-bar-43 , inj₁ _otherpunct-bar-42 :: []) :: (just "P152" , nothing , just _otherpunct-bar-43 , inj₂ '}' :: []) :: []
cedille-start _otherpunct-bar-42 = (just "P151" , nothing , just _otherpunct-bar-42 , inj₁ _otherpunct-bar-41 :: []) :: (just "P150" , nothing , just _otherpunct-bar-42 , inj₂ '⇒' :: []) :: []
cedille-start _otherpunct-bar-41 = (just "P149" , nothing , just _otherpunct-bar-41 , inj₁ _otherpunct-bar-40 :: []) :: (just "P148" , nothing , just _otherpunct-bar-41 , inj₂ '?' :: []) :: []
cedille-start _otherpunct-bar-40 = (just "P147" , nothing , just _otherpunct-bar-40 , inj₁ _otherpunct-bar-39 :: []) :: (just "P146" , nothing , just _otherpunct-bar-40 , inj₂ 'Λ' :: []) :: []
cedille-start _otherpunct-bar-39 = (just "P145" , nothing , just _otherpunct-bar-39 , inj₁ _otherpunct-bar-38 :: []) :: (just "P144" , nothing , just _otherpunct-bar-39 , inj₂ 'ρ' :: []) :: []
cedille-start _otherpunct-bar-38 = (just "P143" , nothing , just _otherpunct-bar-38 , inj₁ _otherpunct-bar-37 :: []) :: (just "P142" , nothing , just _otherpunct-bar-38 , inj₂ 'ε' :: []) :: []
cedille-start _otherpunct-bar-37 = (just "P141" , nothing , just _otherpunct-bar-37 , inj₁ _otherpunct-bar-36 :: []) :: (just "P140" , nothing , just _otherpunct-bar-37 , inj₂ 'β' :: []) :: []
cedille-start _otherpunct-bar-36 = (just "P139" , nothing , just _otherpunct-bar-36 , inj₁ _otherpunct-bar-35 :: []) :: (just "P138" , nothing , just _otherpunct-bar-36 , inj₂ '-' :: []) :: []
cedille-start _otherpunct-bar-35 = (just "P137" , nothing , just _otherpunct-bar-35 , inj₁ _otherpunct-bar-34 :: []) :: (just "P136" , nothing , just _otherpunct-bar-35 , inj₂ '𝒌' :: []) :: []
cedille-start _otherpunct-bar-34 = (just "P135" , nothing , just _otherpunct-bar-34 , inj₁ _otherpunct-bar-33 :: []) :: (just "P134" , nothing , just _otherpunct-bar-34 , inj₂ '=' :: []) :: []
cedille-start _otherpunct-bar-33 = (just "P133" , nothing , just _otherpunct-bar-33 , inj₁ _otherpunct-bar-32 :: []) :: (just "P132" , nothing , just _otherpunct-bar-33 , inj₂ 'ς' :: []) :: []
cedille-start _otherpunct-bar-32 = (just "P131" , nothing , just _otherpunct-bar-32 , inj₁ _otherpunct-bar-31 :: []) :: (just "P130" , nothing , just _otherpunct-bar-32 , inj₂ 'θ' :: []) :: []
cedille-start _otherpunct-bar-31 = (just "P129" , nothing , just _otherpunct-bar-31 , inj₁ _otherpunct-bar-30 :: []) :: (just "P128" , nothing , just _otherpunct-bar-31 , inj₂ '+' :: []) :: []
cedille-start _otherpunct-bar-30 = (just "P127" , nothing , just _otherpunct-bar-30 , inj₁ _otherpunct-bar-29 :: []) :: (just "P126" , nothing , just _otherpunct-bar-30 , inj₂ '<' :: []) :: []
cedille-start _otherpunct-bar-29 = (just "P125" , nothing , just _otherpunct-bar-29 , inj₁ _otherpunct-bar-28 :: []) :: (just "P124" , nothing , just _otherpunct-bar-29 , inj₂ '>' :: []) :: []
cedille-start _otherpunct-bar-28 = (just "P123" , nothing , just _otherpunct-bar-28 , inj₁ _otherpunct-bar-27 :: []) :: (just "P122" , nothing , just _otherpunct-bar-28 , inj₂ '≃' :: []) :: []
cedille-start _otherpunct-bar-27 = (just "P121" , nothing , just _otherpunct-bar-27 , inj₁ _otherpunct-bar-26 :: []) :: (just "P120" , nothing , just _otherpunct-bar-27 , inj₂ '\"' :: []) :: []
cedille-start _otherpunct-bar-26 = (just "P119" , nothing , just _otherpunct-bar-26 , inj₁ _otherpunct-bar-25 :: []) :: (just "P118" , nothing , just _otherpunct-bar-26 , inj₂ 'δ' :: []) :: []
cedille-start _otherpunct-bar-25 = (just "P117" , nothing , just _otherpunct-bar-25 , inj₁ _otherpunct-bar-24 :: []) :: (just "P116" , nothing , just _otherpunct-bar-25 , inj₂ 'χ' :: []) :: []
cedille-start _otherpunct-bar-24 = (just "P115" , nothing , just _otherpunct-bar-24 , inj₁ _otherpunct-bar-23 :: []) :: (just "P114" , nothing , just _otherpunct-bar-24 , inj₂ 'μ' :: []) :: []
cedille-start _otherpunct-bar-23 = (just "P113" , nothing , just _otherpunct-bar-23 , inj₁ _otherpunct-bar-22 :: []) :: (just "P112" , nothing , just _otherpunct-bar-23 , inj₂ 'υ' :: []) :: []
cedille-start _otherpunct-bar-22 = (just "P111" , nothing , just _otherpunct-bar-22 , inj₁ _otherpunct-bar-21 :: []) :: (just "P110" , nothing , just _otherpunct-bar-22 , inj₂ 'φ' :: []) :: []
cedille-start _otherpunct-bar-21 = (just "P109" , nothing , just _otherpunct-bar-21 , inj₂ 'ω' :: []) :: (just "P108" , nothing , just _otherpunct-bar-21 , inj₂ '◂' :: []) :: []
cedille-start _otherpunct = (just "P202" , nothing , just _otherpunct , inj₁ _otherpunct-bar-67 :: []) :: []
cedille-start _optType = (just "SomeType" , nothing , just _optType , inj₁ _ows :: inj₂ ':' :: inj₁ _ows :: inj₁ _type :: []) :: (just "NoType" , nothing , just _optType , []) :: []
cedille-start _optTerm = (just "SomeTerm" , nothing , just _optTerm , inj₁ _ows :: inj₂ '{' :: inj₁ _ows :: inj₁ _term :: inj₁ _ows :: inj₂ '}' :: inj₁ _posinfo :: []) :: (just "NoTerm" , nothing , just _optTerm , []) :: []
cedille-start _optClass = (just "SomeClass" , nothing , just _optClass , inj₁ _ows :: inj₂ ':' :: inj₁ _ows :: inj₁ _tk :: []) :: (just "NoClass" , nothing , just _optClass , []) :: []
cedille-start _optAs = (just "SomeOptAs" , nothing , just _optAs , inj₁ _ows :: inj₂ 'a' :: inj₂ 's' :: inj₁ _ws :: inj₁ _var :: []) :: (just "NoOptAs" , nothing , just _optAs , []) :: []
cedille-start _numpunct-bar-9 = (just "P76" , nothing , just _numpunct-bar-9 , inj₁ _numpunct-bar-8 :: []) :: (just "P75" , nothing , just _numpunct-bar-9 , inj₂ '\'' :: []) :: []
cedille-start _numpunct-bar-8 = (just "P74" , nothing , just _numpunct-bar-8 , inj₁ _numpunct-bar-7 :: []) :: (just "P73" , nothing , just _numpunct-bar-8 , inj₂ '-' :: []) :: []
cedille-start _numpunct-bar-7 = (just "P72" , nothing , just _numpunct-bar-7 , inj₁ _numpunct-bar-6 :: []) :: (just "P71" , nothing , just _numpunct-bar-7 , inj₂ '~' :: []) :: []
cedille-start _numpunct-bar-6 = (just "P70" , nothing , just _numpunct-bar-6 , inj₂ '_' :: []) :: (just "P69" , nothing , just _numpunct-bar-6 , inj₂ '#' :: []) :: []
cedille-start _numpunct-bar-10 = (just "P78" , nothing , just _numpunct-bar-10 , inj₁ _numpunct-bar-9 :: []) :: (just "P77" , nothing , just _numpunct-bar-10 , inj₁ _numone :: []) :: []
cedille-start _numpunct = (just "P79" , nothing , just _numpunct , inj₁ _numpunct-bar-10 :: []) :: []
cedille-start _numone-range-4 = (just "P64" , nothing , just _numone-range-4 , inj₂ '9' :: []) :: (just "P63" , nothing , just _numone-range-4 , inj₂ '8' :: []) :: (just "P62" , nothing , just _numone-range-4 , inj₂ '7' :: []) :: (just "P61" , nothing , just _numone-range-4 , inj₂ '6' :: []) :: (just "P60" , nothing , just _numone-range-4 , inj₂ '5' :: []) :: (just "P59" , nothing , just _numone-range-4 , inj₂ '4' :: []) :: (just "P58" , nothing , just _numone-range-4 , inj₂ '3' :: []) :: (just "P57" , nothing , just _numone-range-4 , inj₂ '2' :: []) :: (just "P56" , nothing , just _numone-range-4 , inj₂ '1' :: []) :: (just "P55" , nothing , just _numone-range-4 , inj₂ '0' :: []) :: []
cedille-start _numone = (just "P65" , nothing , just _numone , inj₁ _numone-range-4 :: []) :: []
cedille-start _num-plus-5 = (just "P67" , nothing , just _num-plus-5 , inj₁ _numone :: inj₁ _num-plus-5 :: []) :: (just "P66" , nothing , just _num-plus-5 , inj₁ _numone :: []) :: []
cedille-start _num = (just "P68" , nothing , just _num , inj₁ _num-plus-5 :: []) :: []
cedille-start _maybeMinus = (just "EpsHnf" , nothing , just _maybeMinus , []) :: (just "EpsHanf" , nothing , just _maybeMinus , inj₂ '-' :: []) :: []
cedille-start _maybeErased = (just "NotErased" , nothing , just _maybeErased , []) :: (just "Erased" , nothing , just _maybeErased , inj₂ '-' :: inj₁ _ows :: []) :: []
cedille-start _maybeCheckType = (just "Type" , nothing , just _maybeCheckType , inj₁ _ows :: inj₂ '◂' :: inj₁ _ows :: inj₁ _type :: []) :: (just "NoCheckType" , nothing , just _maybeCheckType , []) :: []
cedille-start _maybeAtype = (just "NoAtype" , nothing , just _maybeAtype , []) :: (just "Atype" , nothing , just _maybeAtype , inj₁ _ows :: inj₁ _atype :: []) :: []
cedille-start _ltype = (just "embed" , nothing , just _ltype , inj₁ _atype :: []) :: (just "Lft" , nothing , just _ltype , inj₁ _posinfo :: inj₂ '↑' :: inj₁ _ows :: inj₁ _posinfo :: inj₁ _var :: inj₁ _ows :: inj₂ '.' :: inj₁ _ows :: inj₁ _term :: inj₁ _ows :: inj₂ ':' :: inj₁ _ows :: inj₁ _lliftingType :: []) :: []
cedille-start _lterms = (just "LtermsNil" , nothing , just _lterms , inj₁ _posinfo :: []) :: (just "LtermsCons" , nothing , just _lterms , inj₁ _ws :: inj₁ _maybeErased :: inj₁ _lterm :: inj₁ _lterms :: []) :: []
cedille-start _lterm = (just "embed" , just "embed_end" , just _lterm , inj₁ _pterm :: []) :: (just "Sigma" , nothing , just _lterm , inj₁ _posinfo :: inj₂ 'ς' :: inj₁ _ows :: inj₁ _lterm :: []) :: (just "Rho" , nothing , just _lterm , inj₁ _posinfo :: inj₁ _rho :: inj₁ _ows :: inj₁ _lterm :: inj₁ _ows :: inj₂ '-' :: inj₁ _ows :: inj₁ _lterm :: []) :: (just "Phi" , nothing , just _lterm , inj₁ _posinfo :: inj₂ 'φ' :: inj₁ _ows :: inj₁ _lterm :: inj₁ _ows :: inj₂ '-' :: inj₁ _ows :: inj₁ _lterm :: inj₁ _ows :: inj₂ '{' :: inj₁ _ows :: inj₁ _term :: inj₁ _ows :: inj₂ '}' :: inj₁ _posinfo :: []) :: (just "Epsilon" , nothing , just _lterm , inj₁ _posinfo :: inj₂ 'ε' :: inj₁ _leftRight :: inj₁ _maybeMinus :: inj₁ _ows :: inj₁ _lterm :: []) :: (just "Chi" , nothing , just _lterm , inj₁ _posinfo :: inj₂ 'χ' :: inj₁ _maybeAtype :: inj₁ _ows :: inj₂ '-' :: inj₁ _ows :: inj₁ _lterm :: []) :: (just "Beta" , nothing , just _lterm , inj₁ _posinfo :: inj₂ 'β' :: inj₁ _optTerm :: []) :: []
cedille-start _lliftingType = (just "LiftStar" , nothing , just _lliftingType , inj₁ _posinfo :: inj₂ '☆' :: []) :: (just "LiftParens" , nothing , just _lliftingType , inj₁ _posinfo :: inj₂ '(' :: inj₁ _ows :: inj₁ _liftingType :: inj₁ _ows :: inj₂ ')' :: inj₁ _posinfo :: []) :: []
cedille-start _liftingType = (just "embed" , nothing , just _liftingType , inj₁ _lliftingType :: []) :: (just "LiftTpArrow" , nothing , just _liftingType , inj₁ _type :: inj₁ _ows :: inj₂ '➔' :: inj₁ _ows :: inj₁ _liftingType :: []) :: (just "LiftPi" , nothing , just _liftingType , inj₁ _posinfo :: inj₂ 'Π' :: inj₁ _ows :: inj₁ _bvar :: inj₁ _ows :: inj₂ ':' :: inj₁ _ows :: inj₁ _type :: inj₁ _ows :: inj₂ '.' :: inj₁ _ows :: inj₁ _liftingType :: []) :: []
cedille-start _leftRight = (just "Right" , nothing , just _leftRight , inj₂ 'r' :: []) :: (just "Left" , nothing , just _leftRight , inj₂ 'l' :: []) :: (just "Both" , nothing , just _leftRight , []) :: []
cedille-start _lam = (just "KeptLambda" , nothing , just _lam , inj₂ 'λ' :: []) :: (just "ErasedLambda" , nothing , just _lam , inj₂ 'Λ' :: []) :: []
cedille-start _kvar-star-20 = (just "P106" , nothing , just _kvar-star-20 , inj₁ _kvar-bar-19 :: inj₁ _kvar-star-20 :: []) :: (just "P105" , nothing , just _kvar-star-20 , []) :: []
cedille-start _kvar-bar-19 = (just "P104" , nothing , just _kvar-bar-19 , inj₁ _numpunct :: []) :: (just "P103" , nothing , just _kvar-bar-19 , inj₁ _alpha :: []) :: []
cedille-start _kvar = (just "P107" , nothing , just _kvar , inj₂ '𝒌' :: inj₁ _kvar-star-20 :: []) :: []
cedille-start _kind = (just "Star" , nothing , just _kind , inj₁ _posinfo :: inj₂ '★' :: []) :: (just "KndVar" , nothing , just _kind , inj₁ _posinfo :: inj₁ _qkvar :: inj₁ _args :: []) :: (just "KndTpArrow" , nothing , just _kind , inj₁ _ltype :: inj₁ _ows :: inj₂ '➔' :: inj₁ _ows :: inj₁ _kind :: []) :: (just "KndPi" , nothing , just _kind , inj₁ _posinfo :: inj₂ 'Π' :: inj₁ _ows :: inj₁ _posinfo :: inj₁ _bvar :: inj₁ _ows :: inj₂ ':' :: inj₁ _ows :: inj₁ _tk :: inj₁ _ows :: inj₂ '.' :: inj₁ _ows :: inj₁ _kind :: []) :: (just "KndParens" , nothing , just _kind , inj₁ _posinfo :: inj₂ '(' :: inj₁ _ows :: inj₁ _kind :: inj₁ _ows :: inj₂ ')' :: inj₁ _posinfo :: []) :: []
cedille-start _imprt = (just "Import" , nothing , just _imprt , inj₁ _posinfo :: inj₂ 'i' :: inj₂ 'm' :: inj₂ 'p' :: inj₂ 'o' :: inj₂ 'r' :: inj₂ 't' :: inj₁ _ws :: inj₁ _fpth :: inj₁ _optAs :: inj₁ _args :: inj₁ _ows :: inj₂ '.' :: inj₁ _posinfo :: []) :: []
cedille-start _imports = (just "ImportsStart" , nothing , just _imports , []) :: (just "ImportsNext" , nothing , just _imports , inj₁ _imprt :: inj₁ _ows :: inj₁ _imports :: []) :: []
cedille-start _fpth-star-18 = (just "P99" , nothing , just _fpth-star-18 , inj₁ _fpth-bar-17 :: inj₁ _fpth-star-18 :: []) :: (just "P98" , nothing , just _fpth-star-18 , []) :: []
cedille-start _fpth-plus-14 = (just "P91" , nothing , just _fpth-plus-14 , inj₂ '.' :: inj₂ '.' :: inj₂ '/' :: inj₁ _fpth-plus-14 :: []) :: (just "P90" , nothing , just _fpth-plus-14 , inj₂ '.' :: inj₂ '.' :: inj₂ '/' :: []) :: []
cedille-start _fpth-bar-17 = (just "P97" , nothing , just _fpth-bar-17 , inj₁ _fpth-bar-16 :: []) :: (just "P96" , nothing , just _fpth-bar-17 , inj₁ _alpha :: []) :: []
cedille-start _fpth-bar-16 = (just "P95" , nothing , just _fpth-bar-16 , inj₂ '/' :: []) :: (just "P94" , nothing , just _fpth-bar-16 , inj₁ _numpunct :: []) :: []
cedille-start _fpth-bar-15 = (just "P93" , nothing , just _fpth-bar-15 , inj₁ _fpth-plus-14 :: []) :: (just "P92" , nothing , just _fpth-bar-15 , inj₁ _alpha :: []) :: []
cedille-start _fpth = (just "P100" , nothing , just _fpth , inj₁ _fpth-bar-15 :: inj₁ _fpth-star-18 :: []) :: []
cedille-start _defTermOrType = (just "DefType" , nothing , just _defTermOrType , inj₁ _posinfo :: inj₁ _var :: inj₁ _ows :: inj₂ '◂' :: inj₁ _ows :: inj₁ _kind :: inj₁ _ows :: inj₂ '=' :: inj₁ _ows :: inj₁ _type :: []) :: (just "DefTerm" , nothing , just _defTermOrType , inj₁ _posinfo :: inj₁ _var :: inj₁ _maybeCheckType :: inj₁ _ows :: inj₂ '=' :: inj₁ _ows :: inj₁ _term :: []) :: []
cedille-start _decl = (just "Decl" , nothing , just _decl , inj₁ _posinfo :: inj₂ '(' :: inj₁ _ows :: inj₁ _posinfo :: inj₁ _bvar :: inj₁ _ows :: inj₂ ':' :: inj₁ _ows :: inj₁ _tk :: inj₁ _ows :: inj₂ ')' :: inj₁ _posinfo :: []) :: []
cedille-start _comment-star-73 = (just "P215" , nothing , just _comment-star-73 , inj₁ _anychar :: inj₁ _comment-star-73 :: []) :: (just "P214" , nothing , just _comment-star-73 , []) :: []
cedille-start _comment = (just "P216" , nothing , just _comment , inj₂ '%' :: inj₁ _comment-star-73 :: inj₂ '\n' :: []) :: []
cedille-start _cmds = (just "CmdsStart" , nothing , just _cmds , []) :: (just "CmdsNext" , nothing , just _cmds , inj₁ _cmd :: inj₁ _ws :: inj₁ _cmds :: []) :: []
cedille-start _cmd = (just "ImportCmd" , nothing , just _cmd , inj₁ _imprt :: []) :: (just "DefTermOrType" , nothing , just _cmd , inj₁ _defTermOrType :: inj₁ _ows :: inj₂ '.' :: inj₁ _posinfo :: []) :: (just "DefKind" , nothing , just _cmd , inj₁ _posinfo :: inj₁ _kvar :: inj₁ _params :: inj₁ _ows :: inj₂ '=' :: inj₁ _ows :: inj₁ _kind :: inj₁ _ows :: inj₂ '.' :: inj₁ _posinfo :: []) :: []
cedille-start _bvar-bar-13 = (just "P88" , nothing , just _bvar-bar-13 , inj₁ _var :: []) :: (just "P87" , nothing , just _bvar-bar-13 , inj₂ '_' :: []) :: []
cedille-start _bvar = (just "P89" , nothing , just _bvar , inj₁ _bvar-bar-13 :: []) :: []
cedille-start _binder = (just "Pi" , nothing , just _binder , inj₂ 'Π' :: []) :: (just "All" , nothing , just _binder , inj₂ '∀' :: []) :: []
cedille-start _aws-bar-76 = (just "P222" , nothing , just _aws-bar-76 , inj₁ _aws-bar-75 :: []) :: (just "P221" , nothing , just _aws-bar-76 , inj₂ '\n' :: []) :: []
cedille-start _aws-bar-75 = (just "P220" , nothing , just _aws-bar-75 , inj₁ _aws-bar-74 :: []) :: (just "P219" , nothing , just _aws-bar-75 , inj₂ '\t' :: []) :: []
cedille-start _aws-bar-74 = (just "P218" , nothing , just _aws-bar-74 , inj₁ _comment :: []) :: (just "P217" , nothing , just _aws-bar-74 , inj₂ ' ' :: []) :: []
cedille-start _aws = (just "P223" , nothing , just _aws , inj₁ _aws-bar-76 :: []) :: []
cedille-start _atype = (just "TpVar" , nothing , just _atype , inj₁ _posinfo :: inj₁ _qvar :: []) :: (just "TpParens" , nothing , just _atype , inj₁ _posinfo :: inj₂ '(' :: inj₁ _ows :: inj₁ _type :: inj₁ _ows :: inj₂ ')' :: inj₁ _posinfo :: []) :: (just "TpHole" , nothing , just _atype , inj₁ _posinfo :: inj₂ '●' :: []) :: []
cedille-start _aterm = (just "embed" , nothing , just _aterm , inj₁ _lterm :: []) :: []
cedille-start _arrowtype = (just "UnerasedArrow" , nothing , just _arrowtype , inj₂ '➔' :: []) :: (just "ErasedArrow" , nothing , just _arrowtype , inj₂ '➾' :: []) :: []
cedille-start _args = (just "ArgsNil" , nothing , just _args , inj₁ _posinfo :: []) :: (just "ArgsCons" , nothing , just _args , inj₁ _arg :: inj₁ _args :: []) :: []
cedille-start _arg = (just "TypeArg" , nothing , just _arg , inj₁ _ows :: inj₂ '·' :: inj₁ _ws :: inj₁ _atype :: []) :: (just "TermArg" , nothing , just _arg , inj₁ _ws :: inj₁ _lterm :: []) :: []
cedille-start _anychar-bar-72 = (just "P212" , nothing , just _anychar-bar-72 , inj₁ _anychar-bar-71 :: []) :: (just "P211" , nothing , just _anychar-bar-72 , inj₁ _alpha :: []) :: []
cedille-start _anychar-bar-71 = (just "P210" , nothing , just _anychar-bar-71 , inj₁ _anychar-bar-70 :: []) :: (just "P209" , nothing , just _anychar-bar-71 , inj₁ _numpunct :: []) :: []
cedille-start _anychar-bar-70 = (just "P208" , nothing , just _anychar-bar-70 , inj₁ _anychar-bar-69 :: []) :: (just "P207" , nothing , just _anychar-bar-70 , inj₂ '\t' :: []) :: []
cedille-start _anychar-bar-69 = (just "P206" , nothing , just _anychar-bar-69 , inj₁ _anychar-bar-68 :: []) :: (just "P205" , nothing , just _anychar-bar-69 , inj₂ ' ' :: []) :: []
cedille-start _anychar-bar-68 = (just "P204" , nothing , just _anychar-bar-68 , inj₁ _otherpunct :: []) :: (just "P203" , nothing , just _anychar-bar-68 , inj₂ '%' :: []) :: []
cedille-start _anychar = (just "P213" , nothing , just _anychar , inj₁ _anychar-bar-72 :: []) :: []
cedille-start _alpha-range-2 = (just "P51" , nothing , just _alpha-range-2 , inj₂ 'Z' :: []) :: (just "P50" , nothing , just _alpha-range-2 , inj₂ 'Y' :: []) :: (just "P49" , nothing , just _alpha-range-2 , inj₂ 'X' :: []) :: (just "P48" , nothing , just _alpha-range-2 , inj₂ 'W' :: []) :: (just "P47" , nothing , just _alpha-range-2 , inj₂ 'V' :: []) :: (just "P46" , nothing , just _alpha-range-2 , inj₂ 'U' :: []) :: (just "P45" , nothing , just _alpha-range-2 , inj₂ 'T' :: []) :: (just "P44" , nothing , just _alpha-range-2 , inj₂ 'S' :: []) :: (just "P43" , nothing , just _alpha-range-2 , inj₂ 'R' :: []) :: (just "P42" , nothing , just _alpha-range-2 , inj₂ 'Q' :: []) :: (just "P41" , nothing , just _alpha-range-2 , inj₂ 'P' :: []) :: (just "P40" , nothing , just _alpha-range-2 , inj₂ 'O' :: []) :: (just "P39" , nothing , just _alpha-range-2 , inj₂ 'N' :: []) :: (just "P38" , nothing , just _alpha-range-2 , inj₂ 'M' :: []) :: (just "P37" , nothing , just _alpha-range-2 , inj₂ 'L' :: []) :: (just "P36" , nothing , just _alpha-range-2 , inj₂ 'K' :: []) :: (just "P35" , nothing , just _alpha-range-2 , inj₂ 'J' :: []) :: (just "P34" , nothing , just _alpha-range-2 , inj₂ 'I' :: []) :: (just "P33" , nothing , just _alpha-range-2 , inj₂ 'H' :: []) :: (just "P32" , nothing , just _alpha-range-2 , inj₂ 'G' :: []) :: (just "P31" , nothing , just _alpha-range-2 , inj₂ 'F' :: []) :: (just "P30" , nothing , just _alpha-range-2 , inj₂ 'E' :: []) :: (just "P29" , nothing , just _alpha-range-2 , inj₂ 'D' :: []) :: (just "P28" , nothing , just _alpha-range-2 , inj₂ 'C' :: []) :: (just "P27" , nothing , just _alpha-range-2 , inj₂ 'B' :: []) :: (just "P26" , nothing , just _alpha-range-2 , inj₂ 'A' :: []) :: []
cedille-start _alpha-range-1 = (just "P9" , nothing , just _alpha-range-1 , inj₂ 'j' :: []) :: (just "P8" , nothing , just _alpha-range-1 , inj₂ 'i' :: []) :: (just "P7" , nothing , just _alpha-range-1 , inj₂ 'h' :: []) :: (just "P6" , nothing , just _alpha-range-1 , inj₂ 'g' :: []) :: (just "P5" , nothing , just _alpha-range-1 , inj₂ 'f' :: []) :: (just "P4" , nothing , just _alpha-range-1 , inj₂ 'e' :: []) :: (just "P3" , nothing , just _alpha-range-1 , inj₂ 'd' :: []) :: (just "P25" , nothing , just _alpha-range-1 , inj₂ 'z' :: []) :: (just "P24" , nothing , just _alpha-range-1 , inj₂ 'y' :: []) :: (just "P23" , nothing , just _alpha-range-1 , inj₂ 'x' :: []) :: (just "P22" , nothing , just _alpha-range-1 , inj₂ 'w' :: []) :: (just "P21" , nothing , just _alpha-range-1 , inj₂ 'v' :: []) :: (just "P20" , nothing , just _alpha-range-1 , inj₂ 'u' :: []) :: (just "P2" , nothing , just _alpha-range-1 , inj₂ 'c' :: []) :: (just "P19" , nothing , just _alpha-range-1 , inj₂ 't' :: []) :: (just "P18" , nothing , just _alpha-range-1 , inj₂ 's' :: []) :: (just "P17" , nothing , just _alpha-range-1 , inj₂ 'r' :: []) :: (just "P16" , nothing , just _alpha-range-1 , inj₂ 'q' :: []) :: (just "P15" , nothing , just _alpha-range-1 , inj₂ 'p' :: []) :: (just "P14" , nothing , just _alpha-range-1 , inj₂ 'o' :: []) :: (just "P13" , nothing , just _alpha-range-1 , inj₂ 'n' :: []) :: (just "P12" , nothing , just _alpha-range-1 , inj₂ 'm' :: []) :: (just "P11" , nothing , just _alpha-range-1 , inj₂ 'l' :: []) :: (just "P10" , nothing , just _alpha-range-1 , inj₂ 'k' :: []) :: (just "P1" , nothing , just _alpha-range-1 , inj₂ 'b' :: []) :: (just "P0" , nothing , just _alpha-range-1 , inj₂ 'a' :: []) :: []
cedille-start _alpha-bar-3 = (just "P53" , nothing , just _alpha-bar-3 , inj₁ _alpha-range-2 :: []) :: (just "P52" , nothing , just _alpha-bar-3 , inj₁ _alpha-range-1 :: []) :: []
cedille-start _alpha = (just "P54" , nothing , just _alpha , inj₁ _alpha-bar-3 :: []) :: []
cedille-return : maybe gratr2-nt → 𝕃 gratr2-rule
cedille-return (just _pterm) = (nothing , nothing , just _pterm , inj₁ _ows :: inj₂ '.' :: inj₁ _ows :: inj₁ _num :: inj₁ _posinfo :: []) :: []
cedille-return (just _ltype) = (nothing , nothing , just _ltype , inj₁ _ws :: inj₁ _lterm :: []) :: (nothing , nothing , just _ltype , inj₁ _ws :: inj₂ '·' :: inj₁ _ws :: inj₁ _atype :: []) :: []
cedille-return (just _liftingType) = (nothing , nothing , just _liftingType , inj₁ _ows :: inj₂ '➔' :: inj₁ _ows :: inj₁ _liftingType :: []) :: []
cedille-return (just _kind) = (nothing , nothing , just _kind , inj₁ _ows :: inj₂ '➔' :: inj₁ _ows :: inj₁ _kind :: []) :: []
cedille-return (just _aterm) = (nothing , nothing , just _aterm , inj₁ _ws :: inj₂ '·' :: inj₁ _ws :: inj₁ _atype :: []) :: (nothing , nothing , just _aterm , inj₁ _ws :: inj₁ _maybeErased :: inj₁ _aterm :: []) :: []
cedille-return _ = []
cedille-rtn : gratr2-rtn
cedille-rtn = record { start = _start ; _eq_ = gratr2-nt-eq ; gratr2-start = cedille-start ; gratr2-return = cedille-return }
open import run ptr
open noderiv
------------------------------------------
-- Length-decreasing rules
------------------------------------------
len-dec-rewrite : Run → maybe (Run × ℕ)
len-dec-rewrite {- Abs-} ((Id "Abs") :: (ParseTree (parsed-posinfo x0)) :: (ParseTree (parsed-binder x1)) :: (ParseTree parsed-ows) :: (ParseTree (parsed-posinfo x2)) :: (ParseTree (parsed-bvar x3)) :: (ParseTree parsed-ows) :: (InputChar ':') :: (ParseTree parsed-ows) :: (ParseTree (parsed-tk x4)) :: (ParseTree parsed-ows) :: (InputChar '.') :: (ParseTree parsed-ows) :: _::_(ParseTree (parsed-type x5)) rest) = just (ParseTree (parsed-type (norm-type (Abs x0 x1 x2 x3 x4 x5))) ::' rest , 14)
len-dec-rewrite {- Abstract-} ((Id "Abstract") :: _::_(InputChar 'θ') rest) = just (ParseTree (parsed-theta (norm-theta Abstract)) ::' rest , 2)
len-dec-rewrite {- AbstractEq-} ((Id "AbstractEq") :: (InputChar 'θ') :: _::_(InputChar '+') rest) = just (ParseTree (parsed-theta (norm-theta AbstractEq)) ::' rest , 3)
len-dec-rewrite {- AbstractVars-} ((Id "AbstractVars") :: (InputChar 'θ') :: (InputChar '<') :: (ParseTree parsed-ows) :: (ParseTree (parsed-vars x0)) :: (ParseTree parsed-ows) :: _::_(InputChar '>') rest) = just (ParseTree (parsed-theta (norm-theta (AbstractVars x0))) ::' rest , 7)
len-dec-rewrite {- All-} ((Id "All") :: _::_(InputChar '∀') rest) = just (ParseTree (parsed-binder (norm-binder All)) ::' rest , 2)
len-dec-rewrite {- App-} ((ParseTree (parsed-aterm x0)) :: (ParseTree parsed-ws) :: (ParseTree (parsed-maybeErased x1)) :: _::_(ParseTree (parsed-aterm x2)) rest) = just (ParseTree (parsed-aterm (norm-term (App x0 x1 x2))) ::' rest , 4)
len-dec-rewrite {- AppTp-} ((ParseTree (parsed-aterm x0)) :: (ParseTree parsed-ws) :: (InputChar '·') :: (ParseTree parsed-ws) :: _::_(ParseTree (parsed-atype x1)) rest) = just (ParseTree (parsed-aterm (norm-term (AppTp x0 x1))) ::' rest , 5)
len-dec-rewrite {- ArgsCons-} ((Id "ArgsCons") :: (ParseTree (parsed-arg x0)) :: _::_(ParseTree (parsed-args x1)) rest) = just (ParseTree (parsed-args (norm-args (ArgsCons x0 x1))) ::' rest , 3)
len-dec-rewrite {- ArgsNil-} ((Id "ArgsNil") :: _::_(ParseTree (parsed-posinfo x0)) rest) = just (ParseTree (parsed-args (norm-args (ArgsNil x0))) ::' rest , 2)
len-dec-rewrite {- Atype-} ((Id "Atype") :: (ParseTree parsed-ows) :: _::_(ParseTree (parsed-atype x0)) rest) = just (ParseTree (parsed-maybeAtype (norm-maybeAtype (Atype x0))) ::' rest , 3)
len-dec-rewrite {- Beta-} ((Id "Beta") :: (ParseTree (parsed-posinfo x0)) :: (InputChar 'β') :: _::_(ParseTree (parsed-optTerm x1)) rest) = just (ParseTree (parsed-lterm (norm-term (Beta x0 x1))) ::' rest , 4)
len-dec-rewrite {- Chi-} ((Id "Chi") :: (ParseTree (parsed-posinfo x0)) :: (InputChar 'χ') :: (ParseTree (parsed-maybeAtype x1)) :: (ParseTree parsed-ows) :: (InputChar '-') :: (ParseTree parsed-ows) :: _::_(ParseTree (parsed-lterm x2)) rest) = just (ParseTree (parsed-lterm (norm-term (Chi x0 x1 x2))) ::' rest , 8)
len-dec-rewrite {- CmdsNext-} ((Id "CmdsNext") :: (ParseTree (parsed-cmd x0)) :: (ParseTree parsed-ws) :: _::_(ParseTree (parsed-cmds x1)) rest) = just (ParseTree (parsed-cmds (norm-cmds (CmdsNext x0 x1))) ::' rest , 4)
len-dec-rewrite {- Decl-} ((Id "Decl") :: (ParseTree (parsed-posinfo x0)) :: (InputChar '(') :: (ParseTree parsed-ows) :: (ParseTree (parsed-posinfo x1)) :: (ParseTree (parsed-bvar x2)) :: (ParseTree parsed-ows) :: (InputChar ':') :: (ParseTree parsed-ows) :: (ParseTree (parsed-tk x3)) :: (ParseTree parsed-ows) :: (InputChar ')') :: _::_(ParseTree (parsed-posinfo x4)) rest) = just (ParseTree (parsed-decl (norm-decl (Decl x0 x1 x2 x3 x4))) ::' rest , 13)
len-dec-rewrite {- DefKind-} ((Id "DefKind") :: (ParseTree (parsed-posinfo x0)) :: (ParseTree (parsed-kvar x1)) :: (ParseTree (parsed-params x2)) :: (ParseTree parsed-ows) :: (InputChar '=') :: (ParseTree parsed-ows) :: (ParseTree (parsed-kind x3)) :: (ParseTree parsed-ows) :: (InputChar '.') :: _::_(ParseTree (parsed-posinfo x4)) rest) = just (ParseTree (parsed-cmd (norm-cmd (DefKind x0 x1 x2 x3 x4))) ::' rest , 11)
len-dec-rewrite {- DefTerm-} ((Id "DefTerm") :: (ParseTree (parsed-posinfo x0)) :: (ParseTree (parsed-var x1)) :: (ParseTree (parsed-maybeCheckType x2)) :: (ParseTree parsed-ows) :: (InputChar '=') :: (ParseTree parsed-ows) :: _::_(ParseTree (parsed-term x3)) rest) = just (ParseTree (parsed-defTermOrType (norm-defTermOrType (DefTerm x0 x1 x2 x3))) ::' rest , 8)
len-dec-rewrite {- DefTermOrType-} ((Id "DefTermOrType") :: (ParseTree (parsed-defTermOrType x0)) :: (ParseTree parsed-ows) :: (InputChar '.') :: _::_(ParseTree (parsed-posinfo x1)) rest) = just (ParseTree (parsed-cmd (norm-cmd (DefTermOrType x0 x1))) ::' rest , 5)
len-dec-rewrite {- DefType-} ((Id "DefType") :: (ParseTree (parsed-posinfo x0)) :: (ParseTree (parsed-var x1)) :: (ParseTree parsed-ows) :: (InputChar '◂') :: (ParseTree parsed-ows) :: (ParseTree (parsed-kind x2)) :: (ParseTree parsed-ows) :: (InputChar '=') :: (ParseTree parsed-ows) :: _::_(ParseTree (parsed-type x3)) rest) = just (ParseTree (parsed-defTermOrType (norm-defTermOrType (DefType x0 x1 x2 x3))) ::' rest , 11)
len-dec-rewrite {- EpsHanf-} ((Id "EpsHanf") :: _::_(InputChar '-') rest) = just (ParseTree (parsed-maybeMinus (norm-maybeMinus EpsHanf)) ::' rest , 2)
len-dec-rewrite {- Epsilon-} ((Id "Epsilon") :: (ParseTree (parsed-posinfo x0)) :: (InputChar 'ε') :: (ParseTree (parsed-leftRight x1)) :: (ParseTree (parsed-maybeMinus x2)) :: (ParseTree parsed-ows) :: _::_(ParseTree (parsed-lterm x3)) rest) = just (ParseTree (parsed-lterm (norm-term (Epsilon x0 x1 x2 x3))) ::' rest , 7)
len-dec-rewrite {- Erased-} ((Id "Erased") :: (InputChar '-') :: _::_(ParseTree parsed-ows) rest) = just (ParseTree (parsed-maybeErased (norm-maybeErased Erased)) ::' rest , 3)
len-dec-rewrite {- ErasedArrow-} ((Id "ErasedArrow") :: _::_(InputChar '➾') rest) = just (ParseTree (parsed-arrowtype (norm-arrowtype ErasedArrow)) ::' rest , 2)
len-dec-rewrite {- ErasedLambda-} ((Id "ErasedLambda") :: _::_(InputChar 'Λ') rest) = just (ParseTree (parsed-lam (norm-lam ErasedLambda)) ::' rest , 2)
len-dec-rewrite {- File-} ((Id "File") :: (ParseTree (parsed-posinfo x0)) :: (ParseTree parsed-ows) :: (ParseTree (parsed-imports x1)) :: (InputChar 'm') :: (InputChar 'o') :: (InputChar 'd') :: (InputChar 'u') :: (InputChar 'l') :: (InputChar 'e') :: (ParseTree parsed-ws) :: (ParseTree (parsed-qvar x2)) :: (ParseTree parsed-ows) :: (ParseTree (parsed-params x3)) :: (ParseTree parsed-ows) :: (InputChar '.') :: (ParseTree parsed-ows) :: (ParseTree (parsed-cmds x4)) :: (ParseTree parsed-ows) :: _::_(ParseTree (parsed-posinfo x5)) rest) = just (ParseTree (parsed-start (norm-start (File x0 x1 x2 x3 x4 x5))) ::' rest , 20)
len-dec-rewrite {- Hole-} ((Id "Hole") :: (ParseTree (parsed-posinfo x0)) :: _::_(InputChar '●') rest) = just (ParseTree (parsed-pterm (norm-term (Hole x0))) ::' rest , 3)
len-dec-rewrite {- Import-} ((Id "Import") :: (ParseTree (parsed-posinfo x0)) :: (InputChar 'i') :: (InputChar 'm') :: (InputChar 'p') :: (InputChar 'o') :: (InputChar 'r') :: (InputChar 't') :: (ParseTree parsed-ws) :: (ParseTree (parsed-fpth x1)) :: (ParseTree (parsed-optAs x2)) :: (ParseTree (parsed-args x3)) :: (ParseTree parsed-ows) :: (InputChar '.') :: _::_(ParseTree (parsed-posinfo x4)) rest) = just (ParseTree (parsed-imprt (norm-imprt (Import x0 x1 x2 x3 x4))) ::' rest , 15)
len-dec-rewrite {- ImportCmd-} ((Id "ImportCmd") :: _::_(ParseTree (parsed-imprt x0)) rest) = just (ParseTree (parsed-cmd (norm-cmd (ImportCmd x0))) ::' rest , 2)
len-dec-rewrite {- ImportsNext-} ((Id "ImportsNext") :: (ParseTree (parsed-imprt x0)) :: (ParseTree parsed-ows) :: _::_(ParseTree (parsed-imports x1)) rest) = just (ParseTree (parsed-imports (norm-imports (ImportsNext x0 x1))) ::' rest , 4)
len-dec-rewrite {- Iota-} ((Id "Iota") :: (ParseTree (parsed-posinfo x0)) :: (InputChar 'ι') :: (ParseTree parsed-ows) :: (ParseTree (parsed-posinfo x1)) :: (ParseTree (parsed-bvar x2)) :: (ParseTree (parsed-optType x3)) :: (ParseTree parsed-ows) :: (InputChar '.') :: (ParseTree parsed-ows) :: _::_(ParseTree (parsed-type x4)) rest) = just (ParseTree (parsed-type (norm-type (Iota x0 x1 x2 x3 x4))) ::' rest , 11)
len-dec-rewrite {- IotaPair-} ((Id "IotaPair") :: (ParseTree (parsed-posinfo x0)) :: (InputChar '[') :: (ParseTree parsed-ows) :: (ParseTree (parsed-term x1)) :: (ParseTree parsed-ows) :: (InputChar ',') :: (ParseTree parsed-ows) :: (ParseTree (parsed-term x2)) :: (ParseTree parsed-ows) :: (InputChar ']') :: _::_(ParseTree (parsed-posinfo x3)) rest) = just (ParseTree (parsed-pterm (norm-term (IotaPair x0 x1 x2 x3))) ::' rest , 12)
len-dec-rewrite {- IotaProj-} ((ParseTree (parsed-pterm x0)) :: (ParseTree parsed-ows) :: (InputChar '.') :: (ParseTree parsed-ows) :: (ParseTree (parsed-num x1)) :: _::_(ParseTree (parsed-posinfo x2)) rest) = just (ParseTree (parsed-pterm (norm-term (IotaProj x0 x1 x2))) ::' rest , 6)
len-dec-rewrite {- KeptLambda-} ((Id "KeptLambda") :: _::_(InputChar 'λ') rest) = just (ParseTree (parsed-lam (norm-lam KeptLambda)) ::' rest , 2)
len-dec-rewrite {- KndArrow-} ((ParseTree (parsed-kind x0)) :: (ParseTree parsed-ows) :: (InputChar '➔') :: (ParseTree parsed-ows) :: _::_(ParseTree (parsed-kind x1)) rest) = just (ParseTree (parsed-kind (norm-kind (KndArrow x0 x1))) ::' rest , 5)
len-dec-rewrite {- KndParens-} ((Id "KndParens") :: (ParseTree (parsed-posinfo x0)) :: (InputChar '(') :: (ParseTree parsed-ows) :: (ParseTree (parsed-kind x1)) :: (ParseTree parsed-ows) :: (InputChar ')') :: _::_(ParseTree (parsed-posinfo x2)) rest) = just (ParseTree (parsed-kind (norm-kind (KndParens x0 x1 x2))) ::' rest , 8)
len-dec-rewrite {- KndPi-} ((Id "KndPi") :: (ParseTree (parsed-posinfo x0)) :: (InputChar 'Π') :: (ParseTree parsed-ows) :: (ParseTree (parsed-posinfo x1)) :: (ParseTree (parsed-bvar x2)) :: (ParseTree parsed-ows) :: (InputChar ':') :: (ParseTree parsed-ows) :: (ParseTree (parsed-tk x3)) :: (ParseTree parsed-ows) :: (InputChar '.') :: (ParseTree parsed-ows) :: _::_(ParseTree (parsed-kind x4)) rest) = just (ParseTree (parsed-kind (norm-kind (KndPi x0 x1 x2 x3 x4))) ::' rest , 14)
len-dec-rewrite {- KndTpArrow-} ((Id "KndTpArrow") :: (ParseTree (parsed-ltype x0)) :: (ParseTree parsed-ows) :: (InputChar '➔') :: (ParseTree parsed-ows) :: _::_(ParseTree (parsed-kind x1)) rest) = just (ParseTree (parsed-kind (norm-kind (KndTpArrow x0 x1))) ::' rest , 6)
len-dec-rewrite {- KndVar-} ((Id "KndVar") :: (ParseTree (parsed-posinfo x0)) :: (ParseTree (parsed-qkvar x1)) :: _::_(ParseTree (parsed-args x2)) rest) = just (ParseTree (parsed-kind (norm-kind (KndVar x0 x1 x2))) ::' rest , 4)
len-dec-rewrite {- Lam-} ((Id "Lam") :: (ParseTree (parsed-posinfo x0)) :: (ParseTree (parsed-lam x1)) :: (ParseTree parsed-ows) :: (ParseTree (parsed-posinfo x2)) :: (ParseTree (parsed-bvar x3)) :: (ParseTree (parsed-optClass x4)) :: (ParseTree parsed-ows) :: (InputChar '.') :: (ParseTree parsed-ows) :: _::_(ParseTree (parsed-term x5)) rest) = just (ParseTree (parsed-term (norm-term (Lam x0 x1 x2 x3 x4 x5))) ::' rest , 11)
len-dec-rewrite {- Left-} ((Id "Left") :: _::_(InputChar 'l') rest) = just (ParseTree (parsed-leftRight (norm-leftRight Left)) ::' rest , 2)
len-dec-rewrite {- Let-} ((Id "Let") :: (ParseTree (parsed-posinfo x0)) :: (InputChar 'l') :: (InputChar 'e') :: (InputChar 't') :: (ParseTree parsed-ws) :: (ParseTree (parsed-defTermOrType x1)) :: (ParseTree parsed-ws) :: (InputChar 'i') :: (InputChar 'n') :: (ParseTree parsed-ws) :: _::_(ParseTree (parsed-term x2)) rest) = just (ParseTree (parsed-term (norm-term (Let x0 x1 x2))) ::' rest , 12)
len-dec-rewrite {- Lft-} ((Id "Lft") :: (ParseTree (parsed-posinfo x0)) :: (InputChar '↑') :: (ParseTree parsed-ows) :: (ParseTree (parsed-posinfo x1)) :: (ParseTree (parsed-var x2)) :: (ParseTree parsed-ows) :: (InputChar '.') :: (ParseTree parsed-ows) :: (ParseTree (parsed-term x3)) :: (ParseTree parsed-ows) :: (InputChar ':') :: (ParseTree parsed-ows) :: _::_(ParseTree (parsed-lliftingType x4)) rest) = just (ParseTree (parsed-ltype (norm-type (Lft x0 x1 x2 x3 x4))) ::' rest , 14)
len-dec-rewrite {- LiftArrow-} ((ParseTree (parsed-liftingType x0)) :: (ParseTree parsed-ows) :: (InputChar '➔') :: (ParseTree parsed-ows) :: _::_(ParseTree (parsed-liftingType x1)) rest) = just (ParseTree (parsed-liftingType (norm-liftingType (LiftArrow x0 x1))) ::' rest , 5)
len-dec-rewrite {- LiftParens-} ((Id "LiftParens") :: (ParseTree (parsed-posinfo x0)) :: (InputChar '(') :: (ParseTree parsed-ows) :: (ParseTree (parsed-liftingType x1)) :: (ParseTree parsed-ows) :: (InputChar ')') :: _::_(ParseTree (parsed-posinfo x2)) rest) = just (ParseTree (parsed-lliftingType (norm-liftingType (LiftParens x0 x1 x2))) ::' rest , 8)
len-dec-rewrite {- LiftPi-} ((Id "LiftPi") :: (ParseTree (parsed-posinfo x0)) :: (InputChar 'Π') :: (ParseTree parsed-ows) :: (ParseTree (parsed-bvar x1)) :: (ParseTree parsed-ows) :: (InputChar ':') :: (ParseTree parsed-ows) :: (ParseTree (parsed-type x2)) :: (ParseTree parsed-ows) :: (InputChar '.') :: (ParseTree parsed-ows) :: _::_(ParseTree (parsed-liftingType x3)) rest) = just (ParseTree (parsed-liftingType (norm-liftingType (LiftPi x0 x1 x2 x3))) ::' rest , 13)
len-dec-rewrite {- LiftStar-} ((Id "LiftStar") :: (ParseTree (parsed-posinfo x0)) :: _::_(InputChar '☆') rest) = just (ParseTree (parsed-lliftingType (norm-liftingType (LiftStar x0))) ::' rest , 3)
len-dec-rewrite {- LiftTpArrow-} ((Id "LiftTpArrow") :: (ParseTree (parsed-type x0)) :: (ParseTree parsed-ows) :: (InputChar '➔') :: (ParseTree parsed-ows) :: _::_(ParseTree (parsed-liftingType x1)) rest) = just (ParseTree (parsed-liftingType (norm-liftingType (LiftTpArrow x0 x1))) ::' rest , 6)
len-dec-rewrite {- LtermsCons-} ((Id "LtermsCons") :: (ParseTree parsed-ws) :: (ParseTree (parsed-maybeErased x0)) :: (ParseTree (parsed-lterm x1)) :: _::_(ParseTree (parsed-lterms x2)) rest) = just (ParseTree (parsed-lterms (norm-lterms (LtermsCons x0 x1 x2))) ::' rest , 5)
len-dec-rewrite {- LtermsNil-} ((Id "LtermsNil") :: _::_(ParseTree (parsed-posinfo x0)) rest) = just (ParseTree (parsed-lterms (norm-lterms (LtermsNil x0))) ::' rest , 2)
len-dec-rewrite {- NoSpans-} ((Id "NoSpans") :: (InputChar '{') :: (InputChar '^') :: (ParseTree (parsed-type x0)) :: (ParseTree (parsed-posinfo x1)) :: (InputChar '^') :: _::_(InputChar '}') rest) = just (ParseTree (parsed-type (norm-type (NoSpans x0 x1))) ::' rest , 7)
len-dec-rewrite {- P0-} ((Id "P0") :: _::_(InputChar 'a') rest) = just (ParseTree (parsed-alpha-range-1 (string-append 0 (char-to-string 'a'))) ::' rest , 2)
len-dec-rewrite {- P1-} ((Id "P1") :: _::_(InputChar 'b') rest) = just (ParseTree (parsed-alpha-range-1 (string-append 0 (char-to-string 'b'))) ::' rest , 2)
len-dec-rewrite {- P10-} ((Id "P10") :: _::_(InputChar 'k') rest) = just (ParseTree (parsed-alpha-range-1 (string-append 0 (char-to-string 'k'))) ::' rest , 2)
len-dec-rewrite {- P100-} ((Id "P100") :: (ParseTree (parsed-fpth-bar-15 x0)) :: _::_(ParseTree (parsed-fpth-star-18 x1)) rest) = just (ParseTree (parsed-fpth (string-append 1 x0 x1)) ::' rest , 3)
len-dec-rewrite {- P101-} ((Id "P101") :: _::_(ParseTree (parsed-kvar x0)) rest) = just (ParseTree (parsed-qkvar (string-append 0 x0)) ::' rest , 2)
len-dec-rewrite {- P102-} ((Id "P102") :: (ParseTree (parsed-var x0)) :: (InputChar '.') :: _::_(ParseTree (parsed-qkvar x1)) rest) = just (ParseTree (parsed-qkvar (string-append 2 x0 (char-to-string '.') x1)) ::' rest , 4)
len-dec-rewrite {- P103-} ((Id "P103") :: _::_(ParseTree (parsed-alpha x0)) rest) = just (ParseTree (parsed-kvar-bar-19 (string-append 0 x0)) ::' rest , 2)
len-dec-rewrite {- P104-} ((Id "P104") :: _::_(ParseTree (parsed-numpunct x0)) rest) = just (ParseTree (parsed-kvar-bar-19 (string-append 0 x0)) ::' rest , 2)
len-dec-rewrite {- P106-} ((Id "P106") :: (ParseTree (parsed-kvar-bar-19 x0)) :: _::_(ParseTree (parsed-kvar-star-20 x1)) rest) = just (ParseTree (parsed-kvar-star-20 (string-append 1 x0 x1)) ::' rest , 3)
len-dec-rewrite {- P107-} ((Id "P107") :: (InputChar '𝒌') :: _::_(ParseTree (parsed-kvar-star-20 x0)) rest) = just (ParseTree (parsed-kvar (string-append 1 (char-to-string '𝒌') x0)) ::' rest , 3)
len-dec-rewrite {- P108-} ((Id "P108") :: _::_(InputChar '◂') rest) = just (ParseTree parsed-otherpunct-bar-21 ::' rest , 2)
len-dec-rewrite {- P109-} ((Id "P109") :: _::_(InputChar 'ω') rest) = just (ParseTree parsed-otherpunct-bar-21 ::' rest , 2)
len-dec-rewrite {- P11-} ((Id "P11") :: _::_(InputChar 'l') rest) = just (ParseTree (parsed-alpha-range-1 (string-append 0 (char-to-string 'l'))) ::' rest , 2)
len-dec-rewrite {- P110-} ((Id "P110") :: _::_(InputChar 'φ') rest) = just (ParseTree parsed-otherpunct-bar-22 ::' rest , 2)
len-dec-rewrite {- P111-} ((Id "P111") :: _::_(ParseTree parsed-otherpunct-bar-21) rest) = just (ParseTree parsed-otherpunct-bar-22 ::' rest , 2)
len-dec-rewrite {- P112-} ((Id "P112") :: _::_(InputChar 'υ') rest) = just (ParseTree parsed-otherpunct-bar-23 ::' rest , 2)
len-dec-rewrite {- P113-} ((Id "P113") :: _::_(ParseTree parsed-otherpunct-bar-22) rest) = just (ParseTree parsed-otherpunct-bar-23 ::' rest , 2)
len-dec-rewrite {- P114-} ((Id "P114") :: _::_(InputChar 'μ') rest) = just (ParseTree parsed-otherpunct-bar-24 ::' rest , 2)
len-dec-rewrite {- P115-} ((Id "P115") :: _::_(ParseTree parsed-otherpunct-bar-23) rest) = just (ParseTree parsed-otherpunct-bar-24 ::' rest , 2)
len-dec-rewrite {- P116-} ((Id "P116") :: _::_(InputChar 'χ') rest) = just (ParseTree parsed-otherpunct-bar-25 ::' rest , 2)
len-dec-rewrite {- P117-} ((Id "P117") :: _::_(ParseTree parsed-otherpunct-bar-24) rest) = just (ParseTree parsed-otherpunct-bar-25 ::' rest , 2)
len-dec-rewrite {- P118-} ((Id "P118") :: _::_(InputChar 'δ') rest) = just (ParseTree parsed-otherpunct-bar-26 ::' rest , 2)
len-dec-rewrite {- P119-} ((Id "P119") :: _::_(ParseTree parsed-otherpunct-bar-25) rest) = just (ParseTree parsed-otherpunct-bar-26 ::' rest , 2)
len-dec-rewrite {- P12-} ((Id "P12") :: _::_(InputChar 'm') rest) = just (ParseTree (parsed-alpha-range-1 (string-append 0 (char-to-string 'm'))) ::' rest , 2)
len-dec-rewrite {- P120-} ((Id "P120") :: _::_(InputChar '\"') rest) = just (ParseTree parsed-otherpunct-bar-27 ::' rest , 2)
len-dec-rewrite {- P121-} ((Id "P121") :: _::_(ParseTree parsed-otherpunct-bar-26) rest) = just (ParseTree parsed-otherpunct-bar-27 ::' rest , 2)
len-dec-rewrite {- P122-} ((Id "P122") :: _::_(InputChar '≃') rest) = just (ParseTree parsed-otherpunct-bar-28 ::' rest , 2)
len-dec-rewrite {- P123-} ((Id "P123") :: _::_(ParseTree parsed-otherpunct-bar-27) rest) = just (ParseTree parsed-otherpunct-bar-28 ::' rest , 2)
len-dec-rewrite {- P124-} ((Id "P124") :: _::_(InputChar '>') rest) = just (ParseTree parsed-otherpunct-bar-29 ::' rest , 2)
len-dec-rewrite {- P125-} ((Id "P125") :: _::_(ParseTree parsed-otherpunct-bar-28) rest) = just (ParseTree parsed-otherpunct-bar-29 ::' rest , 2)
len-dec-rewrite {- P126-} ((Id "P126") :: _::_(InputChar '<') rest) = just (ParseTree parsed-otherpunct-bar-30 ::' rest , 2)
len-dec-rewrite {- P127-} ((Id "P127") :: _::_(ParseTree parsed-otherpunct-bar-29) rest) = just (ParseTree parsed-otherpunct-bar-30 ::' rest , 2)
len-dec-rewrite {- P128-} ((Id "P128") :: _::_(InputChar '+') rest) = just (ParseTree parsed-otherpunct-bar-31 ::' rest , 2)
len-dec-rewrite {- P129-} ((Id "P129") :: _::_(ParseTree parsed-otherpunct-bar-30) rest) = just (ParseTree parsed-otherpunct-bar-31 ::' rest , 2)
len-dec-rewrite {- P13-} ((Id "P13") :: _::_(InputChar 'n') rest) = just (ParseTree (parsed-alpha-range-1 (string-append 0 (char-to-string 'n'))) ::' rest , 2)
len-dec-rewrite {- P130-} ((Id "P130") :: _::_(InputChar 'θ') rest) = just (ParseTree parsed-otherpunct-bar-32 ::' rest , 2)
len-dec-rewrite {- P131-} ((Id "P131") :: _::_(ParseTree parsed-otherpunct-bar-31) rest) = just (ParseTree parsed-otherpunct-bar-32 ::' rest , 2)
len-dec-rewrite {- P132-} ((Id "P132") :: _::_(InputChar 'ς') rest) = just (ParseTree parsed-otherpunct-bar-33 ::' rest , 2)
len-dec-rewrite {- P133-} ((Id "P133") :: _::_(ParseTree parsed-otherpunct-bar-32) rest) = just (ParseTree parsed-otherpunct-bar-33 ::' rest , 2)
len-dec-rewrite {- P134-} ((Id "P134") :: _::_(InputChar '=') rest) = just (ParseTree parsed-otherpunct-bar-34 ::' rest , 2)
len-dec-rewrite {- P135-} ((Id "P135") :: _::_(ParseTree parsed-otherpunct-bar-33) rest) = just (ParseTree parsed-otherpunct-bar-34 ::' rest , 2)
len-dec-rewrite {- P136-} ((Id "P136") :: _::_(InputChar '𝒌') rest) = just (ParseTree parsed-otherpunct-bar-35 ::' rest , 2)
len-dec-rewrite {- P137-} ((Id "P137") :: _::_(ParseTree parsed-otherpunct-bar-34) rest) = just (ParseTree parsed-otherpunct-bar-35 ::' rest , 2)
len-dec-rewrite {- P138-} ((Id "P138") :: _::_(InputChar '-') rest) = just (ParseTree parsed-otherpunct-bar-36 ::' rest , 2)
len-dec-rewrite {- P139-} ((Id "P139") :: _::_(ParseTree parsed-otherpunct-bar-35) rest) = just (ParseTree parsed-otherpunct-bar-36 ::' rest , 2)
len-dec-rewrite {- P14-} ((Id "P14") :: _::_(InputChar 'o') rest) = just (ParseTree (parsed-alpha-range-1 (string-append 0 (char-to-string 'o'))) ::' rest , 2)
len-dec-rewrite {- P140-} ((Id "P140") :: _::_(InputChar 'β') rest) = just (ParseTree parsed-otherpunct-bar-37 ::' rest , 2)
len-dec-rewrite {- P141-} ((Id "P141") :: _::_(ParseTree parsed-otherpunct-bar-36) rest) = just (ParseTree parsed-otherpunct-bar-37 ::' rest , 2)
len-dec-rewrite {- P142-} ((Id "P142") :: _::_(InputChar 'ε') rest) = just (ParseTree parsed-otherpunct-bar-38 ::' rest , 2)
len-dec-rewrite {- P143-} ((Id "P143") :: _::_(ParseTree parsed-otherpunct-bar-37) rest) = just (ParseTree parsed-otherpunct-bar-38 ::' rest , 2)
len-dec-rewrite {- P144-} ((Id "P144") :: _::_(InputChar 'ρ') rest) = just (ParseTree parsed-otherpunct-bar-39 ::' rest , 2)
len-dec-rewrite {- P145-} ((Id "P145") :: _::_(ParseTree parsed-otherpunct-bar-38) rest) = just (ParseTree parsed-otherpunct-bar-39 ::' rest , 2)
len-dec-rewrite {- P146-} ((Id "P146") :: _::_(InputChar 'Λ') rest) = just (ParseTree parsed-otherpunct-bar-40 ::' rest , 2)
len-dec-rewrite {- P147-} ((Id "P147") :: _::_(ParseTree parsed-otherpunct-bar-39) rest) = just (ParseTree parsed-otherpunct-bar-40 ::' rest , 2)
len-dec-rewrite {- P148-} ((Id "P148") :: _::_(InputChar '?') rest) = just (ParseTree parsed-otherpunct-bar-41 ::' rest , 2)
len-dec-rewrite {- P149-} ((Id "P149") :: _::_(ParseTree parsed-otherpunct-bar-40) rest) = just (ParseTree parsed-otherpunct-bar-41 ::' rest , 2)
len-dec-rewrite {- P15-} ((Id "P15") :: _::_(InputChar 'p') rest) = just (ParseTree (parsed-alpha-range-1 (string-append 0 (char-to-string 'p'))) ::' rest , 2)
len-dec-rewrite {- P150-} ((Id "P150") :: _::_(InputChar '⇒') rest) = just (ParseTree parsed-otherpunct-bar-42 ::' rest , 2)
len-dec-rewrite {- P151-} ((Id "P151") :: _::_(ParseTree parsed-otherpunct-bar-41) rest) = just (ParseTree parsed-otherpunct-bar-42 ::' rest , 2)
len-dec-rewrite {- P152-} ((Id "P152") :: _::_(InputChar '}') rest) = just (ParseTree parsed-otherpunct-bar-43 ::' rest , 2)
len-dec-rewrite {- P153-} ((Id "P153") :: _::_(ParseTree parsed-otherpunct-bar-42) rest) = just (ParseTree parsed-otherpunct-bar-43 ::' rest , 2)
len-dec-rewrite {- P154-} ((Id "P154") :: _::_(InputChar '{') rest) = just (ParseTree parsed-otherpunct-bar-44 ::' rest , 2)
len-dec-rewrite {- P155-} ((Id "P155") :: _::_(ParseTree parsed-otherpunct-bar-43) rest) = just (ParseTree parsed-otherpunct-bar-44 ::' rest , 2)
len-dec-rewrite {- P156-} ((Id "P156") :: _::_(InputChar '!') rest) = just (ParseTree parsed-otherpunct-bar-45 ::' rest , 2)
len-dec-rewrite {- P157-} ((Id "P157") :: _::_(ParseTree parsed-otherpunct-bar-44) rest) = just (ParseTree parsed-otherpunct-bar-45 ::' rest , 2)
len-dec-rewrite {- P158-} ((Id "P158") :: _::_(InputChar ',') rest) = just (ParseTree parsed-otherpunct-bar-46 ::' rest , 2)
len-dec-rewrite {- P159-} ((Id "P159") :: _::_(ParseTree parsed-otherpunct-bar-45) rest) = just (ParseTree parsed-otherpunct-bar-46 ::' rest , 2)
len-dec-rewrite {- P16-} ((Id "P16") :: _::_(InputChar 'q') rest) = just (ParseTree (parsed-alpha-range-1 (string-append 0 (char-to-string 'q'))) ::' rest , 2)
len-dec-rewrite {- P160-} ((Id "P160") :: _::_(InputChar ']') rest) = just (ParseTree parsed-otherpunct-bar-47 ::' rest , 2)
len-dec-rewrite {- P161-} ((Id "P161") :: _::_(ParseTree parsed-otherpunct-bar-46) rest) = just (ParseTree parsed-otherpunct-bar-47 ::' rest , 2)
len-dec-rewrite {- P162-} ((Id "P162") :: _::_(InputChar '[') rest) = just (ParseTree parsed-otherpunct-bar-48 ::' rest , 2)
len-dec-rewrite {- P163-} ((Id "P163") :: _::_(ParseTree parsed-otherpunct-bar-47) rest) = just (ParseTree parsed-otherpunct-bar-48 ::' rest , 2)
len-dec-rewrite {- P164-} ((Id "P164") :: _::_(InputChar '.') rest) = just (ParseTree parsed-otherpunct-bar-49 ::' rest , 2)
len-dec-rewrite {- P165-} ((Id "P165") :: _::_(ParseTree parsed-otherpunct-bar-48) rest) = just (ParseTree parsed-otherpunct-bar-49 ::' rest , 2)
len-dec-rewrite {- P166-} ((Id "P166") :: _::_(InputChar ':') rest) = just (ParseTree parsed-otherpunct-bar-50 ::' rest , 2)
len-dec-rewrite {- P167-} ((Id "P167") :: _::_(ParseTree parsed-otherpunct-bar-49) rest) = just (ParseTree parsed-otherpunct-bar-50 ::' rest , 2)
len-dec-rewrite {- P168-} ((Id "P168") :: _::_(InputChar ')') rest) = just (ParseTree parsed-otherpunct-bar-51 ::' rest , 2)
len-dec-rewrite {- P169-} ((Id "P169") :: _::_(ParseTree parsed-otherpunct-bar-50) rest) = just (ParseTree parsed-otherpunct-bar-51 ::' rest , 2)
len-dec-rewrite {- P17-} ((Id "P17") :: _::_(InputChar 'r') rest) = just (ParseTree (parsed-alpha-range-1 (string-append 0 (char-to-string 'r'))) ::' rest , 2)
len-dec-rewrite {- P170-} ((Id "P170") :: _::_(InputChar '(') rest) = just (ParseTree parsed-otherpunct-bar-52 ::' rest , 2)
len-dec-rewrite {- P171-} ((Id "P171") :: _::_(ParseTree parsed-otherpunct-bar-51) rest) = just (ParseTree parsed-otherpunct-bar-52 ::' rest , 2)
len-dec-rewrite {- P172-} ((Id "P172") :: _::_(InputChar '●') rest) = just (ParseTree parsed-otherpunct-bar-53 ::' rest , 2)
len-dec-rewrite {- P173-} ((Id "P173") :: _::_(ParseTree parsed-otherpunct-bar-52) rest) = just (ParseTree parsed-otherpunct-bar-53 ::' rest , 2)
len-dec-rewrite {- P174-} ((Id "P174") :: _::_(InputChar '↑') rest) = just (ParseTree parsed-otherpunct-bar-54 ::' rest , 2)
len-dec-rewrite {- P175-} ((Id "P175") :: _::_(ParseTree parsed-otherpunct-bar-53) rest) = just (ParseTree parsed-otherpunct-bar-54 ::' rest , 2)
len-dec-rewrite {- P176-} ((Id "P176") :: _::_(InputChar '➾') rest) = just (ParseTree parsed-otherpunct-bar-55 ::' rest , 2)
len-dec-rewrite {- P177-} ((Id "P177") :: _::_(ParseTree parsed-otherpunct-bar-54) rest) = just (ParseTree parsed-otherpunct-bar-55 ::' rest , 2)
len-dec-rewrite {- P178-} ((Id "P178") :: _::_(InputChar '➔') rest) = just (ParseTree parsed-otherpunct-bar-56 ::' rest , 2)
len-dec-rewrite {- P179-} ((Id "P179") :: _::_(ParseTree parsed-otherpunct-bar-55) rest) = just (ParseTree parsed-otherpunct-bar-56 ::' rest , 2)
len-dec-rewrite {- P18-} ((Id "P18") :: _::_(InputChar 's') rest) = just (ParseTree (parsed-alpha-range-1 (string-append 0 (char-to-string 's'))) ::' rest , 2)
len-dec-rewrite {- P180-} ((Id "P180") :: _::_(InputChar '⇐') rest) = just (ParseTree parsed-otherpunct-bar-57 ::' rest , 2)
len-dec-rewrite {- P181-} ((Id "P181") :: _::_(ParseTree parsed-otherpunct-bar-56) rest) = just (ParseTree parsed-otherpunct-bar-57 ::' rest , 2)
len-dec-rewrite {- P182-} ((Id "P182") :: _::_(InputChar '·') rest) = just (ParseTree parsed-otherpunct-bar-58 ::' rest , 2)
len-dec-rewrite {- P183-} ((Id "P183") :: _::_(ParseTree parsed-otherpunct-bar-57) rest) = just (ParseTree parsed-otherpunct-bar-58 ::' rest , 2)
len-dec-rewrite {- P184-} ((Id "P184") :: _::_(InputChar '☆') rest) = just (ParseTree parsed-otherpunct-bar-59 ::' rest , 2)
len-dec-rewrite {- P185-} ((Id "P185") :: _::_(ParseTree parsed-otherpunct-bar-58) rest) = just (ParseTree parsed-otherpunct-bar-59 ::' rest , 2)
len-dec-rewrite {- P186-} ((Id "P186") :: _::_(InputChar '★') rest) = just (ParseTree parsed-otherpunct-bar-60 ::' rest , 2)
len-dec-rewrite {- P187-} ((Id "P187") :: _::_(ParseTree parsed-otherpunct-bar-59) rest) = just (ParseTree parsed-otherpunct-bar-60 ::' rest , 2)
len-dec-rewrite {- P188-} ((Id "P188") :: _::_(InputChar 'π') rest) = just (ParseTree parsed-otherpunct-bar-61 ::' rest , 2)
len-dec-rewrite {- P189-} ((Id "P189") :: _::_(ParseTree parsed-otherpunct-bar-60) rest) = just (ParseTree parsed-otherpunct-bar-61 ::' rest , 2)
len-dec-rewrite {- P19-} ((Id "P19") :: _::_(InputChar 't') rest) = just (ParseTree (parsed-alpha-range-1 (string-append 0 (char-to-string 't'))) ::' rest , 2)
len-dec-rewrite {- P190-} ((Id "P190") :: _::_(InputChar '∀') rest) = just (ParseTree parsed-otherpunct-bar-62 ::' rest , 2)
len-dec-rewrite {- P191-} ((Id "P191") :: _::_(ParseTree parsed-otherpunct-bar-61) rest) = just (ParseTree parsed-otherpunct-bar-62 ::' rest , 2)
len-dec-rewrite {- P192-} ((Id "P192") :: _::_(InputChar 'λ') rest) = just (ParseTree parsed-otherpunct-bar-63 ::' rest , 2)
len-dec-rewrite {- P193-} ((Id "P193") :: _::_(ParseTree parsed-otherpunct-bar-62) rest) = just (ParseTree parsed-otherpunct-bar-63 ::' rest , 2)
len-dec-rewrite {- P194-} ((Id "P194") :: _::_(InputChar 'ι') rest) = just (ParseTree parsed-otherpunct-bar-64 ::' rest , 2)
len-dec-rewrite {- P195-} ((Id "P195") :: _::_(ParseTree parsed-otherpunct-bar-63) rest) = just (ParseTree parsed-otherpunct-bar-64 ::' rest , 2)
len-dec-rewrite {- P196-} ((Id "P196") :: _::_(InputChar 'Π') rest) = just (ParseTree parsed-otherpunct-bar-65 ::' rest , 2)
len-dec-rewrite {- P197-} ((Id "P197") :: _::_(ParseTree parsed-otherpunct-bar-64) rest) = just (ParseTree parsed-otherpunct-bar-65 ::' rest , 2)
len-dec-rewrite {- P198-} ((Id "P198") :: _::_(InputChar '□') rest) = just (ParseTree parsed-otherpunct-bar-66 ::' rest , 2)
len-dec-rewrite {- P199-} ((Id "P199") :: _::_(ParseTree parsed-otherpunct-bar-65) rest) = just (ParseTree parsed-otherpunct-bar-66 ::' rest , 2)
len-dec-rewrite {- P2-} ((Id "P2") :: _::_(InputChar 'c') rest) = just (ParseTree (parsed-alpha-range-1 (string-append 0 (char-to-string 'c'))) ::' rest , 2)
len-dec-rewrite {- P20-} ((Id "P20") :: _::_(InputChar 'u') rest) = just (ParseTree (parsed-alpha-range-1 (string-append 0 (char-to-string 'u'))) ::' rest , 2)
len-dec-rewrite {- P200-} ((Id "P200") :: _::_(InputChar '|') rest) = just (ParseTree parsed-otherpunct-bar-67 ::' rest , 2)
len-dec-rewrite {- P201-} ((Id "P201") :: _::_(ParseTree parsed-otherpunct-bar-66) rest) = just (ParseTree parsed-otherpunct-bar-67 ::' rest , 2)
len-dec-rewrite {- P202-} ((Id "P202") :: _::_(ParseTree parsed-otherpunct-bar-67) rest) = just (ParseTree parsed-otherpunct ::' rest , 2)
len-dec-rewrite {- P203-} ((Id "P203") :: _::_(InputChar '%') rest) = just (ParseTree parsed-anychar-bar-68 ::' rest , 2)
len-dec-rewrite {- P204-} ((Id "P204") :: _::_(ParseTree parsed-otherpunct) rest) = just (ParseTree parsed-anychar-bar-68 ::' rest , 2)
len-dec-rewrite {- P205-} ((Id "P205") :: _::_(InputChar ' ') rest) = just (ParseTree parsed-anychar-bar-69 ::' rest , 2)
len-dec-rewrite {- P206-} ((Id "P206") :: _::_(ParseTree parsed-anychar-bar-68) rest) = just (ParseTree parsed-anychar-bar-69 ::' rest , 2)
len-dec-rewrite {- P207-} ((Id "P207") :: _::_(InputChar '\t') rest) = just (ParseTree parsed-anychar-bar-70 ::' rest , 2)
len-dec-rewrite {- P208-} ((Id "P208") :: _::_(ParseTree parsed-anychar-bar-69) rest) = just (ParseTree parsed-anychar-bar-70 ::' rest , 2)
len-dec-rewrite {- P209-} ((Id "P209") :: _::_(ParseTree (parsed-numpunct x0)) rest) = just (ParseTree parsed-anychar-bar-71 ::' rest , 2)
len-dec-rewrite {- P21-} ((Id "P21") :: _::_(InputChar 'v') rest) = just (ParseTree (parsed-alpha-range-1 (string-append 0 (char-to-string 'v'))) ::' rest , 2)
len-dec-rewrite {- P210-} ((Id "P210") :: _::_(ParseTree parsed-anychar-bar-70) rest) = just (ParseTree parsed-anychar-bar-71 ::' rest , 2)
len-dec-rewrite {- P211-} ((Id "P211") :: _::_(ParseTree (parsed-alpha x0)) rest) = just (ParseTree parsed-anychar-bar-72 ::' rest , 2)
len-dec-rewrite {- P212-} ((Id "P212") :: _::_(ParseTree parsed-anychar-bar-71) rest) = just (ParseTree parsed-anychar-bar-72 ::' rest , 2)
len-dec-rewrite {- P213-} ((Id "P213") :: _::_(ParseTree parsed-anychar-bar-72) rest) = just (ParseTree parsed-anychar ::' rest , 2)
len-dec-rewrite {- P215-} ((Id "P215") :: (ParseTree parsed-anychar) :: _::_(ParseTree parsed-comment-star-73) rest) = just (ParseTree parsed-comment-star-73 ::' rest , 3)
len-dec-rewrite {- P216-} ((Id "P216") :: (InputChar '%') :: (ParseTree parsed-comment-star-73) :: _::_(InputChar '\n') rest) = just (ParseTree parsed-comment ::' rest , 4)
len-dec-rewrite {- P217-} ((Id "P217") :: _::_(InputChar ' ') rest) = just (ParseTree parsed-aws-bar-74 ::' rest , 2)
len-dec-rewrite {- P218-} ((Id "P218") :: _::_(ParseTree parsed-comment) rest) = just (ParseTree parsed-aws-bar-74 ::' rest , 2)
len-dec-rewrite {- P219-} ((Id "P219") :: _::_(InputChar '\t') rest) = just (ParseTree parsed-aws-bar-75 ::' rest , 2)
len-dec-rewrite {- P22-} ((Id "P22") :: _::_(InputChar 'w') rest) = just (ParseTree (parsed-alpha-range-1 (string-append 0 (char-to-string 'w'))) ::' rest , 2)
len-dec-rewrite {- P220-} ((Id "P220") :: _::_(ParseTree parsed-aws-bar-74) rest) = just (ParseTree parsed-aws-bar-75 ::' rest , 2)
len-dec-rewrite {- P221-} ((Id "P221") :: _::_(InputChar '\n') rest) = just (ParseTree parsed-aws-bar-76 ::' rest , 2)
len-dec-rewrite {- P222-} ((Id "P222") :: _::_(ParseTree parsed-aws-bar-75) rest) = just (ParseTree parsed-aws-bar-76 ::' rest , 2)
len-dec-rewrite {- P223-} ((Id "P223") :: _::_(ParseTree parsed-aws-bar-76) rest) = just (ParseTree parsed-aws ::' rest , 2)
len-dec-rewrite {- P224-} ((Id "P224") :: _::_(ParseTree parsed-aws) rest) = just (ParseTree parsed-ws-plus-77 ::' rest , 2)
len-dec-rewrite {- P225-} ((Id "P225") :: (ParseTree parsed-aws) :: _::_(ParseTree parsed-ws-plus-77) rest) = just (ParseTree parsed-ws-plus-77 ::' rest , 3)
len-dec-rewrite {- P226-} ((Id "P226") :: _::_(ParseTree parsed-ws-plus-77) rest) = just (ParseTree parsed-ws ::' rest , 2)
len-dec-rewrite {- P228-} ((Id "P228") :: (ParseTree parsed-aws) :: _::_(ParseTree parsed-ows-star-78) rest) = just (ParseTree parsed-ows-star-78 ::' rest , 3)
len-dec-rewrite {- P229-} ((Id "P229") :: _::_(ParseTree parsed-ows-star-78) rest) = just (ParseTree parsed-ows ::' rest , 2)
len-dec-rewrite {- P23-} ((Id "P23") :: _::_(InputChar 'x') rest) = just (ParseTree (parsed-alpha-range-1 (string-append 0 (char-to-string 'x'))) ::' rest , 2)
len-dec-rewrite {- P24-} ((Id "P24") :: _::_(InputChar 'y') rest) = just (ParseTree (parsed-alpha-range-1 (string-append 0 (char-to-string 'y'))) ::' rest , 2)
len-dec-rewrite {- P25-} ((Id "P25") :: _::_(InputChar 'z') rest) = just (ParseTree (parsed-alpha-range-1 (string-append 0 (char-to-string 'z'))) ::' rest , 2)
len-dec-rewrite {- P26-} ((Id "P26") :: _::_(InputChar 'A') rest) = just (ParseTree (parsed-alpha-range-2 (string-append 0 (char-to-string 'A'))) ::' rest , 2)
len-dec-rewrite {- P27-} ((Id "P27") :: _::_(InputChar 'B') rest) = just (ParseTree (parsed-alpha-range-2 (string-append 0 (char-to-string 'B'))) ::' rest , 2)
len-dec-rewrite {- P28-} ((Id "P28") :: _::_(InputChar 'C') rest) = just (ParseTree (parsed-alpha-range-2 (string-append 0 (char-to-string 'C'))) ::' rest , 2)
len-dec-rewrite {- P29-} ((Id "P29") :: _::_(InputChar 'D') rest) = just (ParseTree (parsed-alpha-range-2 (string-append 0 (char-to-string 'D'))) ::' rest , 2)
len-dec-rewrite {- P3-} ((Id "P3") :: _::_(InputChar 'd') rest) = just (ParseTree (parsed-alpha-range-1 (string-append 0 (char-to-string 'd'))) ::' rest , 2)
len-dec-rewrite {- P30-} ((Id "P30") :: _::_(InputChar 'E') rest) = just (ParseTree (parsed-alpha-range-2 (string-append 0 (char-to-string 'E'))) ::' rest , 2)
len-dec-rewrite {- P31-} ((Id "P31") :: _::_(InputChar 'F') rest) = just (ParseTree (parsed-alpha-range-2 (string-append 0 (char-to-string 'F'))) ::' rest , 2)
len-dec-rewrite {- P32-} ((Id "P32") :: _::_(InputChar 'G') rest) = just (ParseTree (parsed-alpha-range-2 (string-append 0 (char-to-string 'G'))) ::' rest , 2)
len-dec-rewrite {- P33-} ((Id "P33") :: _::_(InputChar 'H') rest) = just (ParseTree (parsed-alpha-range-2 (string-append 0 (char-to-string 'H'))) ::' rest , 2)
len-dec-rewrite {- P34-} ((Id "P34") :: _::_(InputChar 'I') rest) = just (ParseTree (parsed-alpha-range-2 (string-append 0 (char-to-string 'I'))) ::' rest , 2)
len-dec-rewrite {- P35-} ((Id "P35") :: _::_(InputChar 'J') rest) = just (ParseTree (parsed-alpha-range-2 (string-append 0 (char-to-string 'J'))) ::' rest , 2)
len-dec-rewrite {- P36-} ((Id "P36") :: _::_(InputChar 'K') rest) = just (ParseTree (parsed-alpha-range-2 (string-append 0 (char-to-string 'K'))) ::' rest , 2)
len-dec-rewrite {- P37-} ((Id "P37") :: _::_(InputChar 'L') rest) = just (ParseTree (parsed-alpha-range-2 (string-append 0 (char-to-string 'L'))) ::' rest , 2)
len-dec-rewrite {- P38-} ((Id "P38") :: _::_(InputChar 'M') rest) = just (ParseTree (parsed-alpha-range-2 (string-append 0 (char-to-string 'M'))) ::' rest , 2)
len-dec-rewrite {- P39-} ((Id "P39") :: _::_(InputChar 'N') rest) = just (ParseTree (parsed-alpha-range-2 (string-append 0 (char-to-string 'N'))) ::' rest , 2)
len-dec-rewrite {- P4-} ((Id "P4") :: _::_(InputChar 'e') rest) = just (ParseTree (parsed-alpha-range-1 (string-append 0 (char-to-string 'e'))) ::' rest , 2)
len-dec-rewrite {- P40-} ((Id "P40") :: _::_(InputChar 'O') rest) = just (ParseTree (parsed-alpha-range-2 (string-append 0 (char-to-string 'O'))) ::' rest , 2)
len-dec-rewrite {- P41-} ((Id "P41") :: _::_(InputChar 'P') rest) = just (ParseTree (parsed-alpha-range-2 (string-append 0 (char-to-string 'P'))) ::' rest , 2)
len-dec-rewrite {- P42-} ((Id "P42") :: _::_(InputChar 'Q') rest) = just (ParseTree (parsed-alpha-range-2 (string-append 0 (char-to-string 'Q'))) ::' rest , 2)
len-dec-rewrite {- P43-} ((Id "P43") :: _::_(InputChar 'R') rest) = just (ParseTree (parsed-alpha-range-2 (string-append 0 (char-to-string 'R'))) ::' rest , 2)
len-dec-rewrite {- P44-} ((Id "P44") :: _::_(InputChar 'S') rest) = just (ParseTree (parsed-alpha-range-2 (string-append 0 (char-to-string 'S'))) ::' rest , 2)
len-dec-rewrite {- P45-} ((Id "P45") :: _::_(InputChar 'T') rest) = just (ParseTree (parsed-alpha-range-2 (string-append 0 (char-to-string 'T'))) ::' rest , 2)
len-dec-rewrite {- P46-} ((Id "P46") :: _::_(InputChar 'U') rest) = just (ParseTree (parsed-alpha-range-2 (string-append 0 (char-to-string 'U'))) ::' rest , 2)
len-dec-rewrite {- P47-} ((Id "P47") :: _::_(InputChar 'V') rest) = just (ParseTree (parsed-alpha-range-2 (string-append 0 (char-to-string 'V'))) ::' rest , 2)
len-dec-rewrite {- P48-} ((Id "P48") :: _::_(InputChar 'W') rest) = just (ParseTree (parsed-alpha-range-2 (string-append 0 (char-to-string 'W'))) ::' rest , 2)
len-dec-rewrite {- P49-} ((Id "P49") :: _::_(InputChar 'X') rest) = just (ParseTree (parsed-alpha-range-2 (string-append 0 (char-to-string 'X'))) ::' rest , 2)
len-dec-rewrite {- P5-} ((Id "P5") :: _::_(InputChar 'f') rest) = just (ParseTree (parsed-alpha-range-1 (string-append 0 (char-to-string 'f'))) ::' rest , 2)
len-dec-rewrite {- P50-} ((Id "P50") :: _::_(InputChar 'Y') rest) = just (ParseTree (parsed-alpha-range-2 (string-append 0 (char-to-string 'Y'))) ::' rest , 2)
len-dec-rewrite {- P51-} ((Id "P51") :: _::_(InputChar 'Z') rest) = just (ParseTree (parsed-alpha-range-2 (string-append 0 (char-to-string 'Z'))) ::' rest , 2)
len-dec-rewrite {- P52-} ((Id "P52") :: _::_(ParseTree (parsed-alpha-range-1 x0)) rest) = just (ParseTree (parsed-alpha-bar-3 (string-append 0 x0)) ::' rest , 2)
len-dec-rewrite {- P53-} ((Id "P53") :: _::_(ParseTree (parsed-alpha-range-2 x0)) rest) = just (ParseTree (parsed-alpha-bar-3 (string-append 0 x0)) ::' rest , 2)
len-dec-rewrite {- P54-} ((Id "P54") :: _::_(ParseTree (parsed-alpha-bar-3 x0)) rest) = just (ParseTree (parsed-alpha (string-append 0 x0)) ::' rest , 2)
len-dec-rewrite {- P55-} ((Id "P55") :: _::_(InputChar '0') rest) = just (ParseTree (parsed-numone-range-4 (string-append 0 (char-to-string '0'))) ::' rest , 2)
len-dec-rewrite {- P56-} ((Id "P56") :: _::_(InputChar '1') rest) = just (ParseTree (parsed-numone-range-4 (string-append 0 (char-to-string '1'))) ::' rest , 2)
len-dec-rewrite {- P57-} ((Id "P57") :: _::_(InputChar '2') rest) = just (ParseTree (parsed-numone-range-4 (string-append 0 (char-to-string '2'))) ::' rest , 2)
len-dec-rewrite {- P58-} ((Id "P58") :: _::_(InputChar '3') rest) = just (ParseTree (parsed-numone-range-4 (string-append 0 (char-to-string '3'))) ::' rest , 2)
len-dec-rewrite {- P59-} ((Id "P59") :: _::_(InputChar '4') rest) = just (ParseTree (parsed-numone-range-4 (string-append 0 (char-to-string '4'))) ::' rest , 2)
len-dec-rewrite {- P6-} ((Id "P6") :: _::_(InputChar 'g') rest) = just (ParseTree (parsed-alpha-range-1 (string-append 0 (char-to-string 'g'))) ::' rest , 2)
len-dec-rewrite {- P60-} ((Id "P60") :: _::_(InputChar '5') rest) = just (ParseTree (parsed-numone-range-4 (string-append 0 (char-to-string '5'))) ::' rest , 2)
len-dec-rewrite {- P61-} ((Id "P61") :: _::_(InputChar '6') rest) = just (ParseTree (parsed-numone-range-4 (string-append 0 (char-to-string '6'))) ::' rest , 2)
len-dec-rewrite {- P62-} ((Id "P62") :: _::_(InputChar '7') rest) = just (ParseTree (parsed-numone-range-4 (string-append 0 (char-to-string '7'))) ::' rest , 2)
len-dec-rewrite {- P63-} ((Id "P63") :: _::_(InputChar '8') rest) = just (ParseTree (parsed-numone-range-4 (string-append 0 (char-to-string '8'))) ::' rest , 2)
len-dec-rewrite {- P64-} ((Id "P64") :: _::_(InputChar '9') rest) = just (ParseTree (parsed-numone-range-4 (string-append 0 (char-to-string '9'))) ::' rest , 2)
len-dec-rewrite {- P65-} ((Id "P65") :: _::_(ParseTree (parsed-numone-range-4 x0)) rest) = just (ParseTree (parsed-numone (string-append 0 x0)) ::' rest , 2)
len-dec-rewrite {- P66-} ((Id "P66") :: _::_(ParseTree (parsed-numone x0)) rest) = just (ParseTree (parsed-num-plus-5 (string-append 0 x0)) ::' rest , 2)
len-dec-rewrite {- P67-} ((Id "P67") :: (ParseTree (parsed-numone x0)) :: _::_(ParseTree (parsed-num-plus-5 x1)) rest) = just (ParseTree (parsed-num-plus-5 (string-append 1 x0 x1)) ::' rest , 3)
len-dec-rewrite {- P68-} ((Id "P68") :: _::_(ParseTree (parsed-num-plus-5 x0)) rest) = just (ParseTree (parsed-num (string-append 0 x0)) ::' rest , 2)
len-dec-rewrite {- P69-} ((Id "P69") :: _::_(InputChar '#') rest) = just (ParseTree (parsed-numpunct-bar-6 (string-append 0 (char-to-string '#'))) ::' rest , 2)
len-dec-rewrite {- P7-} ((Id "P7") :: _::_(InputChar 'h') rest) = just (ParseTree (parsed-alpha-range-1 (string-append 0 (char-to-string 'h'))) ::' rest , 2)
len-dec-rewrite {- P70-} ((Id "P70") :: _::_(InputChar '_') rest) = just (ParseTree (parsed-numpunct-bar-6 (string-append 0 (char-to-string '_'))) ::' rest , 2)
len-dec-rewrite {- P71-} ((Id "P71") :: _::_(InputChar '~') rest) = just (ParseTree (parsed-numpunct-bar-7 (string-append 0 (char-to-string '~'))) ::' rest , 2)
len-dec-rewrite {- P72-} ((Id "P72") :: _::_(ParseTree (parsed-numpunct-bar-6 x0)) rest) = just (ParseTree (parsed-numpunct-bar-7 (string-append 0 x0)) ::' rest , 2)
len-dec-rewrite {- P73-} ((Id "P73") :: _::_(InputChar '-') rest) = just (ParseTree (parsed-numpunct-bar-8 (string-append 0 (char-to-string '-'))) ::' rest , 2)
len-dec-rewrite {- P74-} ((Id "P74") :: _::_(ParseTree (parsed-numpunct-bar-7 x0)) rest) = just (ParseTree (parsed-numpunct-bar-8 (string-append 0 x0)) ::' rest , 2)
len-dec-rewrite {- P75-} ((Id "P75") :: _::_(InputChar '\'') rest) = just (ParseTree (parsed-numpunct-bar-9 (string-append 0 (char-to-string '\''))) ::' rest , 2)
len-dec-rewrite {- P76-} ((Id "P76") :: _::_(ParseTree (parsed-numpunct-bar-8 x0)) rest) = just (ParseTree (parsed-numpunct-bar-9 (string-append 0 x0)) ::' rest , 2)
len-dec-rewrite {- P77-} ((Id "P77") :: _::_(ParseTree (parsed-numone x0)) rest) = just (ParseTree (parsed-numpunct-bar-10 (string-append 0 x0)) ::' rest , 2)
len-dec-rewrite {- P78-} ((Id "P78") :: _::_(ParseTree (parsed-numpunct-bar-9 x0)) rest) = just (ParseTree (parsed-numpunct-bar-10 (string-append 0 x0)) ::' rest , 2)
len-dec-rewrite {- P79-} ((Id "P79") :: _::_(ParseTree (parsed-numpunct-bar-10 x0)) rest) = just (ParseTree (parsed-numpunct (string-append 0 x0)) ::' rest , 2)
len-dec-rewrite {- P8-} ((Id "P8") :: _::_(InputChar 'i') rest) = just (ParseTree (parsed-alpha-range-1 (string-append 0 (char-to-string 'i'))) ::' rest , 2)
len-dec-rewrite {- P80-} ((Id "P80") :: _::_(ParseTree (parsed-var x0)) rest) = just (ParseTree (parsed-qvar (string-append 0 x0)) ::' rest , 2)
len-dec-rewrite {- P81-} ((Id "P81") :: (ParseTree (parsed-var x0)) :: (InputChar '.') :: _::_(ParseTree (parsed-qvar x1)) rest) = just (ParseTree (parsed-qvar (string-append 2 x0 (char-to-string '.') x1)) ::' rest , 4)
len-dec-rewrite {- P82-} ((Id "P82") :: _::_(ParseTree (parsed-alpha x0)) rest) = just (ParseTree (parsed-var-bar-11 (string-append 0 x0)) ::' rest , 2)
len-dec-rewrite {- P83-} ((Id "P83") :: _::_(ParseTree (parsed-numpunct x0)) rest) = just (ParseTree (parsed-var-bar-11 (string-append 0 x0)) ::' rest , 2)
len-dec-rewrite {- P85-} ((Id "P85") :: (ParseTree (parsed-var-bar-11 x0)) :: _::_(ParseTree (parsed-var-star-12 x1)) rest) = just (ParseTree (parsed-var-star-12 (string-append 1 x0 x1)) ::' rest , 3)
len-dec-rewrite {- P86-} ((Id "P86") :: (ParseTree (parsed-alpha x0)) :: _::_(ParseTree (parsed-var-star-12 x1)) rest) = just (ParseTree (parsed-var (string-append 1 x0 x1)) ::' rest , 3)
len-dec-rewrite {- P87-} ((Id "P87") :: _::_(InputChar '_') rest) = just (ParseTree (parsed-bvar-bar-13 (string-append 0 (char-to-string '_'))) ::' rest , 2)
len-dec-rewrite {- P88-} ((Id "P88") :: _::_(ParseTree (parsed-var x0)) rest) = just (ParseTree (parsed-bvar-bar-13 (string-append 0 x0)) ::' rest , 2)
len-dec-rewrite {- P89-} ((Id "P89") :: _::_(ParseTree (parsed-bvar-bar-13 x0)) rest) = just (ParseTree (parsed-bvar (string-append 0 x0)) ::' rest , 2)
len-dec-rewrite {- P9-} ((Id "P9") :: _::_(InputChar 'j') rest) = just (ParseTree (parsed-alpha-range-1 (string-append 0 (char-to-string 'j'))) ::' rest , 2)
len-dec-rewrite {- P90-} ((Id "P90") :: (InputChar '.') :: (InputChar '.') :: _::_(InputChar '/') rest) = just (ParseTree (parsed-fpth-plus-14 (string-append 2 (char-to-string '.') (char-to-string '.') (char-to-string '/'))) ::' rest , 4)
len-dec-rewrite {- P91-} ((Id "P91") :: (InputChar '.') :: (InputChar '.') :: (InputChar '/') :: _::_(ParseTree (parsed-fpth-plus-14 x0)) rest) = just (ParseTree (parsed-fpth-plus-14 (string-append 3 (char-to-string '.') (char-to-string '.') (char-to-string '/') x0)) ::' rest , 5)
len-dec-rewrite {- P92-} ((Id "P92") :: _::_(ParseTree (parsed-alpha x0)) rest) = just (ParseTree (parsed-fpth-bar-15 (string-append 0 x0)) ::' rest , 2)
len-dec-rewrite {- P93-} ((Id "P93") :: _::_(ParseTree (parsed-fpth-plus-14 x0)) rest) = just (ParseTree (parsed-fpth-bar-15 (string-append 0 x0)) ::' rest , 2)
len-dec-rewrite {- P94-} ((Id "P94") :: _::_(ParseTree (parsed-numpunct x0)) rest) = just (ParseTree (parsed-fpth-bar-16 (string-append 0 x0)) ::' rest , 2)
len-dec-rewrite {- P95-} ((Id "P95") :: _::_(InputChar '/') rest) = just (ParseTree (parsed-fpth-bar-16 (string-append 0 (char-to-string '/'))) ::' rest , 2)
len-dec-rewrite {- P96-} ((Id "P96") :: _::_(ParseTree (parsed-alpha x0)) rest) = just (ParseTree (parsed-fpth-bar-17 (string-append 0 x0)) ::' rest , 2)
len-dec-rewrite {- P97-} ((Id "P97") :: _::_(ParseTree (parsed-fpth-bar-16 x0)) rest) = just (ParseTree (parsed-fpth-bar-17 (string-append 0 x0)) ::' rest , 2)
len-dec-rewrite {- P99-} ((Id "P99") :: (ParseTree (parsed-fpth-bar-17 x0)) :: _::_(ParseTree (parsed-fpth-star-18 x1)) rest) = just (ParseTree (parsed-fpth-star-18 (string-append 1 x0 x1)) ::' rest , 3)
len-dec-rewrite {- ParamsCons-} ((Id "ParamsCons") :: (ParseTree parsed-ows) :: (ParseTree (parsed-decl x0)) :: _::_(ParseTree (parsed-params x1)) rest) = just (ParseTree (parsed-params (norm-params (ParamsCons x0 x1))) ::' rest , 4)
len-dec-rewrite {- Parens-} ((Id "Parens") :: (ParseTree (parsed-posinfo x0)) :: (InputChar '(') :: (ParseTree parsed-ows) :: (ParseTree (parsed-term x1)) :: (ParseTree parsed-ows) :: (InputChar ')') :: _::_(ParseTree (parsed-posinfo x2)) rest) = just (ParseTree (parsed-pterm (norm-term (Parens x0 x1 x2))) ::' rest , 8)
len-dec-rewrite {- Phi-} ((Id "Phi") :: (ParseTree (parsed-posinfo x0)) :: (InputChar 'φ') :: (ParseTree parsed-ows) :: (ParseTree (parsed-lterm x1)) :: (ParseTree parsed-ows) :: (InputChar '-') :: (ParseTree parsed-ows) :: (ParseTree (parsed-lterm x2)) :: (ParseTree parsed-ows) :: (InputChar '{') :: (ParseTree parsed-ows) :: (ParseTree (parsed-term x3)) :: (ParseTree parsed-ows) :: (InputChar '}') :: _::_(ParseTree (parsed-posinfo x4)) rest) = just (ParseTree (parsed-lterm (norm-term (Phi x0 x1 x2 x3 x4))) ::' rest , 16)
len-dec-rewrite {- Pi-} ((Id "Pi") :: _::_(InputChar 'Π') rest) = just (ParseTree (parsed-binder (norm-binder Pi)) ::' rest , 2)
len-dec-rewrite {- Rho-} ((Id "Rho") :: (ParseTree (parsed-posinfo x0)) :: (ParseTree (parsed-rho x1)) :: (ParseTree parsed-ows) :: (ParseTree (parsed-lterm x2)) :: (ParseTree parsed-ows) :: (InputChar '-') :: (ParseTree parsed-ows) :: _::_(ParseTree (parsed-lterm x3)) rest) = just (ParseTree (parsed-lterm (norm-term (Rho x0 x1 x2 x3))) ::' rest , 9)
len-dec-rewrite {- RhoPlain-} ((Id "RhoPlain") :: _::_(InputChar 'ρ') rest) = just (ParseTree (parsed-rho (norm-rho RhoPlain)) ::' rest , 2)
len-dec-rewrite {- RhoPlus-} ((Id "RhoPlus") :: (InputChar 'ρ') :: _::_(InputChar '+') rest) = just (ParseTree (parsed-rho (norm-rho RhoPlus)) ::' rest , 3)
len-dec-rewrite {- Right-} ((Id "Right") :: _::_(InputChar 'r') rest) = just (ParseTree (parsed-leftRight (norm-leftRight Right)) ::' rest , 2)
len-dec-rewrite {- Sigma-} ((Id "Sigma") :: (ParseTree (parsed-posinfo x0)) :: (InputChar 'ς') :: (ParseTree parsed-ows) :: _::_(ParseTree (parsed-lterm x1)) rest) = just (ParseTree (parsed-lterm (norm-term (Sigma x0 x1))) ::' rest , 5)
len-dec-rewrite {- SomeClass-} ((Id "SomeClass") :: (ParseTree parsed-ows) :: (InputChar ':') :: (ParseTree parsed-ows) :: _::_(ParseTree (parsed-tk x0)) rest) = just (ParseTree (parsed-optClass (norm-optClass (SomeClass x0))) ::' rest , 5)
len-dec-rewrite {- SomeOptAs-} ((Id "SomeOptAs") :: (ParseTree parsed-ows) :: (InputChar 'a') :: (InputChar 's') :: (ParseTree parsed-ws) :: _::_(ParseTree (parsed-var x0)) rest) = just (ParseTree (parsed-optAs (norm-optAs (SomeOptAs x0))) ::' rest , 6)
len-dec-rewrite {- SomeTerm-} ((Id "SomeTerm") :: (ParseTree parsed-ows) :: (InputChar '{') :: (ParseTree parsed-ows) :: (ParseTree (parsed-term x0)) :: (ParseTree parsed-ows) :: (InputChar '}') :: _::_(ParseTree (parsed-posinfo x1)) rest) = just (ParseTree (parsed-optTerm (norm-optTerm (SomeTerm x0 x1))) ::' rest , 8)
len-dec-rewrite {- SomeType-} ((Id "SomeType") :: (ParseTree parsed-ows) :: (InputChar ':') :: (ParseTree parsed-ows) :: _::_(ParseTree (parsed-type x0)) rest) = just (ParseTree (parsed-optType (norm-optType (SomeType x0))) ::' rest , 5)
len-dec-rewrite {- Star-} ((Id "Star") :: (ParseTree (parsed-posinfo x0)) :: _::_(InputChar '★') rest) = just (ParseTree (parsed-kind (norm-kind (Star x0))) ::' rest , 3)
len-dec-rewrite {- TermArg-} ((Id "TermArg") :: (ParseTree parsed-ws) :: _::_(ParseTree (parsed-lterm x0)) rest) = just (ParseTree (parsed-arg (norm-arg (TermArg x0))) ::' rest , 3)
len-dec-rewrite {- Theta-} ((Id "Theta") :: (ParseTree (parsed-posinfo x0)) :: (ParseTree (parsed-theta x1)) :: (ParseTree parsed-ws) :: (ParseTree (parsed-lterm x2)) :: (ParseTree parsed-ows) :: _::_(ParseTree (parsed-lterms x3)) rest) = just (ParseTree (parsed-term (norm-term (Theta x0 x1 x2 x3))) ::' rest , 7)
len-dec-rewrite {- Tkk-} ((Id "Tkk") :: (ParseTree (parsed-kind x0)) :: _::_(Id "Tkk_end") rest) = just (ParseTree (parsed-tk (norm-tk (Tkk x0))) ::' rest , 3)
len-dec-rewrite {- Tkt-} ((Id "Tkt") :: _::_(ParseTree (parsed-type x0)) rest) = just (ParseTree (parsed-tk (norm-tk (Tkt x0))) ::' rest , 2)
len-dec-rewrite {- TpApp-} ((ParseTree (parsed-ltype x0)) :: (ParseTree parsed-ws) :: (InputChar '·') :: (ParseTree parsed-ws) :: _::_(ParseTree (parsed-atype x1)) rest) = just (ParseTree (parsed-ltype (norm-type (TpApp x0 x1))) ::' rest , 5)
len-dec-rewrite {- TpAppt-} ((ParseTree (parsed-ltype x0)) :: (ParseTree parsed-ws) :: _::_(ParseTree (parsed-lterm x1)) rest) = just (ParseTree (parsed-ltype (norm-type (TpAppt x0 x1))) ::' rest , 3)
len-dec-rewrite {- TpArrow-} ((Id "TpArrow") :: (ParseTree (parsed-ltype x0)) :: (ParseTree parsed-ows) :: (ParseTree (parsed-arrowtype x1)) :: (ParseTree parsed-ows) :: _::_(ParseTree (parsed-type x2)) rest) = just (ParseTree (parsed-type (norm-type (TpArrow x0 x1 x2))) ::' rest , 6)
len-dec-rewrite {- TpEq-} ((Id "TpEq") :: (ParseTree (parsed-term x0)) :: (ParseTree parsed-ows) :: (InputChar '≃') :: (ParseTree parsed-ows) :: _::_(ParseTree (parsed-term x1)) rest) = just (ParseTree (parsed-type (norm-type (TpEq x0 x1))) ::' rest , 6)
len-dec-rewrite {- TpHole-} ((Id "TpHole") :: (ParseTree (parsed-posinfo x0)) :: _::_(InputChar '●') rest) = just (ParseTree (parsed-atype (norm-type (TpHole x0))) ::' rest , 3)
len-dec-rewrite {- TpLambda-} ((Id "TpLambda") :: (ParseTree (parsed-posinfo x0)) :: (InputChar 'λ') :: (ParseTree parsed-ows) :: (ParseTree (parsed-posinfo x1)) :: (ParseTree (parsed-bvar x2)) :: (ParseTree parsed-ows) :: (InputChar ':') :: (ParseTree parsed-ows) :: (ParseTree (parsed-tk x3)) :: (ParseTree parsed-ows) :: (InputChar '.') :: (ParseTree parsed-ows) :: _::_(ParseTree (parsed-type x4)) rest) = just (ParseTree (parsed-type (norm-type (TpLambda x0 x1 x2 x3 x4))) ::' rest , 14)
len-dec-rewrite {- TpParens-} ((Id "TpParens") :: (ParseTree (parsed-posinfo x0)) :: (InputChar '(') :: (ParseTree parsed-ows) :: (ParseTree (parsed-type x1)) :: (ParseTree parsed-ows) :: (InputChar ')') :: _::_(ParseTree (parsed-posinfo x2)) rest) = just (ParseTree (parsed-atype (norm-type (TpParens x0 x1 x2))) ::' rest , 8)
len-dec-rewrite {- TpVar-} ((Id "TpVar") :: (ParseTree (parsed-posinfo x0)) :: _::_(ParseTree (parsed-qvar x1)) rest) = just (ParseTree (parsed-atype (norm-type (TpVar x0 x1))) ::' rest , 3)
len-dec-rewrite {- Type-} ((Id "Type") :: (ParseTree parsed-ows) :: (InputChar '◂') :: (ParseTree parsed-ows) :: _::_(ParseTree (parsed-type x0)) rest) = just (ParseTree (parsed-maybeCheckType (norm-maybeCheckType (Type x0))) ::' rest , 5)
len-dec-rewrite {- TypeArg-} ((Id "TypeArg") :: (ParseTree parsed-ows) :: (InputChar '·') :: (ParseTree parsed-ws) :: _::_(ParseTree (parsed-atype x0)) rest) = just (ParseTree (parsed-arg (norm-arg (TypeArg x0))) ::' rest , 5)
len-dec-rewrite {- UnerasedArrow-} ((Id "UnerasedArrow") :: _::_(InputChar '➔') rest) = just (ParseTree (parsed-arrowtype (norm-arrowtype UnerasedArrow)) ::' rest , 2)
len-dec-rewrite {- Var-} ((Id "Var") :: (ParseTree (parsed-posinfo x0)) :: _::_(ParseTree (parsed-qvar x1)) rest) = just (ParseTree (parsed-pterm (norm-term (Var x0 x1))) ::' rest , 3)
len-dec-rewrite {- VarsNext-} ((Id "VarsNext") :: (ParseTree (parsed-var x0)) :: (ParseTree parsed-ws) :: _::_(ParseTree (parsed-vars x1)) rest) = just (ParseTree (parsed-vars (norm-vars (VarsNext x0 x1))) ::' rest , 4)
len-dec-rewrite {- VarsStart-} ((Id "VarsStart") :: _::_(ParseTree (parsed-var x0)) rest) = just (ParseTree (parsed-vars (norm-vars (VarsStart x0))) ::' rest , 2)
len-dec-rewrite {- embed-} ((Id "embed") :: (ParseTree (parsed-aterm x0)) :: _::_(Id "embed_end") rest) = just (ParseTree (parsed-term x0) ::' rest , 3)
len-dec-rewrite {- embed-} ((Id "embed") :: _::_(ParseTree (parsed-lterm x0)) rest) = just (ParseTree (parsed-aterm x0) ::' rest , 2)
len-dec-rewrite {- embed-} ((Id "embed") :: (ParseTree (parsed-pterm x0)) :: _::_(Id "embed_end") rest) = just (ParseTree (parsed-lterm x0) ::' rest , 3)
len-dec-rewrite {- embed-} ((Id "embed") :: (ParseTree (parsed-ltype x0)) :: _::_(Id "embed_end") rest) = just (ParseTree (parsed-type x0) ::' rest , 3)
len-dec-rewrite {- embed-} ((Id "embed") :: _::_(ParseTree (parsed-atype x0)) rest) = just (ParseTree (parsed-ltype x0) ::' rest , 2)
len-dec-rewrite {- embed-} ((Id "embed") :: _::_(ParseTree (parsed-lliftingType x0)) rest) = just (ParseTree (parsed-liftingType x0) ::' rest , 2)
len-dec-rewrite {- Both-} (_::_(Id "Both") rest) = just (ParseTree (parsed-leftRight (norm-leftRight Both)) ::' rest , 1)
len-dec-rewrite {- CmdsStart-} (_::_(Id "CmdsStart") rest) = just (ParseTree (parsed-cmds (norm-cmds CmdsStart)) ::' rest , 1)
len-dec-rewrite {- EpsHnf-} (_::_(Id "EpsHnf") rest) = just (ParseTree (parsed-maybeMinus (norm-maybeMinus EpsHnf)) ::' rest , 1)
len-dec-rewrite {- ImportsStart-} (_::_(Id "ImportsStart") rest) = just (ParseTree (parsed-imports (norm-imports ImportsStart)) ::' rest , 1)
len-dec-rewrite {- NoAtype-} (_::_(Id "NoAtype") rest) = just (ParseTree (parsed-maybeAtype (norm-maybeAtype NoAtype)) ::' rest , 1)
len-dec-rewrite {- NoCheckType-} (_::_(Id "NoCheckType") rest) = just (ParseTree (parsed-maybeCheckType (norm-maybeCheckType NoCheckType)) ::' rest , 1)
len-dec-rewrite {- NoClass-} (_::_(Id "NoClass") rest) = just (ParseTree (parsed-optClass (norm-optClass NoClass)) ::' rest , 1)
len-dec-rewrite {- NoOptAs-} (_::_(Id "NoOptAs") rest) = just (ParseTree (parsed-optAs (norm-optAs NoOptAs)) ::' rest , 1)
len-dec-rewrite {- NoTerm-} (_::_(Id "NoTerm") rest) = just (ParseTree (parsed-optTerm (norm-optTerm NoTerm)) ::' rest , 1)
len-dec-rewrite {- NoType-} (_::_(Id "NoType") rest) = just (ParseTree (parsed-optType (norm-optType NoType)) ::' rest , 1)
len-dec-rewrite {- NotErased-} (_::_(Id "NotErased") rest) = just (ParseTree (parsed-maybeErased (norm-maybeErased NotErased)) ::' rest , 1)
len-dec-rewrite {- P105-} (_::_(Id "P105") rest) = just (ParseTree (parsed-kvar-star-20 empty-string) ::' rest , 1)
len-dec-rewrite {- P214-} (_::_(Id "P214") rest) = just (ParseTree parsed-comment-star-73 ::' rest , 1)
len-dec-rewrite {- P227-} (_::_(Id "P227") rest) = just (ParseTree parsed-ows-star-78 ::' rest , 1)
len-dec-rewrite {- P84-} (_::_(Id "P84") rest) = just (ParseTree (parsed-var-star-12 empty-string) ::' rest , 1)
len-dec-rewrite {- P98-} (_::_(Id "P98") rest) = just (ParseTree (parsed-fpth-star-18 empty-string) ::' rest , 1)
len-dec-rewrite {- ParamsNil-} (_::_(Id "ParamsNil") rest) = just (ParseTree (parsed-params (norm-params ParamsNil)) ::' rest , 1)
len-dec-rewrite {- Posinfo-} (_::_(Posinfo n) rest) = just (ParseTree (parsed-posinfo (ℕ-to-string n)) ::' rest , 1)
len-dec-rewrite x = nothing
rrs : rewriteRules
rrs = record { len-dec-rewrite = len-dec-rewrite }
| {
"alphanum_fraction": 0.6338782105,
"avg_line_length": 130.6722797927,
"ext": "agda",
"hexsha": "8c0d76da79cae73839e0f90ede3533c5e37d44cc",
"lang": "Agda",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "acf691e37210607d028f4b19f98ec26c4353bfb5",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "xoltar/cedille",
"max_forks_repo_path": "src/cedille.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "acf691e37210607d028f4b19f98ec26c4353bfb5",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "xoltar/cedille",
"max_issues_repo_path": "src/cedille.agda",
"max_line_length": 1723,
"max_stars_count": null,
"max_stars_repo_head_hexsha": "acf691e37210607d028f4b19f98ec26c4353bfb5",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "xoltar/cedille",
"max_stars_repo_path": "src/cedille.agda",
"max_stars_repo_stars_event_max_datetime": null,
"max_stars_repo_stars_event_min_datetime": null,
"num_tokens": 36623,
"size": 100879
} |
{-# OPTIONS --rewriting --confluence-check #-}
data _==_ {i} {A : Set i} : (x y : A) → Set i where
refl : {a : A} → a == a
{-# BUILTIN REWRITE _==_ #-}
data ⊥ : Set where
record ⊤ : Set where
constructor tt
module Test (p : ⊥ == ⊤) where
abstract
A : Set
A = ⊥
q : A == ⊤
q = p
{-# REWRITE q #-}
f : A
f = tt
abstract
g : ⊥
g = f
-- g reduces to tt, which does not have type ⊥.
| {
"alphanum_fraction": 0.4802784223,
"avg_line_length": 14.3666666667,
"ext": "agda",
"hexsha": "fce86f08303102376eed679d34547b0bd4bd0d43",
"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/Issue4147.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/Issue4147.agda",
"max_line_length": 51,
"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/Issue4147.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": 161,
"size": 431
} |
module interfaceExtensionAndDelegation where
open import Data.Product
open import Data.Nat.Base
open import Data.Nat.Show
open import Data.String.Base using (String; _++_)
open import Size
open import NativeIO
open import interactiveProgramsAgda using (ConsoleInterface; _>>=_; do;
IO; return; putStrLn;
translateIOConsole )
open import objectsInAgda using (Interface; Method; Result; CellMethod;
get; put; CellResult; cellI; IOObject;
CellC; method; simpleCell )
data CounterMethod A : Set where
super : (m : CellMethod A) → CounterMethod A
stats : CounterMethod A
statsCellI : (A : Set) → Interface
Method (statsCellI A) = CounterMethod A
Result (statsCellI A) (super m) = Result (cellI A) m
Result (statsCellI A) stats = Unit
CounterC : (i : Size) → Set
CounterC = IOObject ConsoleInterface (statsCellI String)
pattern getᶜ = super get
pattern putᶜ x = super (put x)
{- Methods of CounterC are now
getᶜ (putᶜ x) stats
-}
counterCell : ∀{i} (c : CellC i) (ngets nputs : ℕ) → CounterC i
method (counterCell c ngets nputs) getᶜ =
method c get >>= λ { (s , c') →
return (s , counterCell c' (1 + ngets) nputs) }
method (counterCell c ngets nputs) (putᶜ x) =
method c (put x) >>= λ { (_ , c') →
return (_ , counterCell c' ngets (1 + nputs)) }
method (counterCell c ngets nputs) stats =
do (putStrLn ("Counted "
++ show ngets ++ " calls to get and "
++ show nputs ++ " calls to put.")) λ _ →
return (_ , counterCell c ngets nputs)
program : String → IO ConsoleInterface ∞ Unit
program arg =
let c₀ = counterCell (simpleCell "Start") 0 0 in
method c₀ getᶜ >>= λ{ (s , c₁) →
do (putStrLn s) λ _ →
method c₁ (putᶜ arg) >>= λ{ (_ , c₂) →
method c₂ getᶜ >>= λ{ (s' , c₃) →
do (putStrLn s') λ _ →
method c₃ (putᶜ "Over!") >>= λ{ (_ , c₄) →
method c₄ stats >>= λ{ (_ , c₅) →
return _ }}}}}
main : NativeIO Unit
main = translateIOConsole (program "Hello")
| {
"alphanum_fraction": 0.560599383,
"avg_line_length": 33.3676470588,
"ext": "agda",
"hexsha": "292887218748123ddfd1721e7be70d43a2d1bcc3",
"lang": "Agda",
"max_forks_count": 2,
"max_forks_repo_forks_event_max_datetime": "2022-03-12T11:41:00.000Z",
"max_forks_repo_forks_event_min_datetime": "2018-09-01T15:02:37.000Z",
"max_forks_repo_head_hexsha": "7cc45e0148a4a508d20ed67e791544c30fecd795",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "agda/ooAgda",
"max_forks_repo_path": "presentationsAndExampleCode/agdaImplementorsMeetingGlasgow22April2016AntonSetzer/interfaceExtensionAndDelegation.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "7cc45e0148a4a508d20ed67e791544c30fecd795",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "agda/ooAgda",
"max_issues_repo_path": "presentationsAndExampleCode/agdaImplementorsMeetingGlasgow22April2016AntonSetzer/interfaceExtensionAndDelegation.agda",
"max_line_length": 72,
"max_stars_count": 23,
"max_stars_repo_head_hexsha": "7cc45e0148a4a508d20ed67e791544c30fecd795",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "agda/ooAgda",
"max_stars_repo_path": "presentationsAndExampleCode/agdaImplementorsMeetingGlasgow22April2016AntonSetzer/interfaceExtensionAndDelegation.agda",
"max_stars_repo_stars_event_max_datetime": "2020-10-12T23:15:25.000Z",
"max_stars_repo_stars_event_min_datetime": "2016-06-19T12:57:55.000Z",
"num_tokens": 675,
"size": 2269
} |
{-# OPTIONS --cubical #-}
module Integer.Univalence where
open import Cubical.Foundations.NTypes
open import Data.Empty
open import Data.Product as Σ
open import Data.Product.Relation.Pointwise.NonDependent
open import Data.Unit
open import Equality
open import Function
open import Integer.Difference as D
open import Integer.Signed as S
open import Natural as ℕ
open import Quotient as /
open import Syntax
open import Relation.Nullary
zero≢suc : ∀ {m} → ¬ (zero ≡ suc m)
zero≢suc p = case ⟪ p ⟫ of λ ()
⟦D→S⟧ : D.⟦ℤ⟧ → S.⟦ℤ⟧
⟦D→S⟧ (a – zero) = +1* a
⟦D→S⟧ (zero – b) = -1* b
⟦D→S⟧ (suc a – suc b) = ⟦D→S⟧ (a – b)
D→S : D.ℤ → S.ℤ
D→S = ⟦D→S⟧ // line
where
line : ∀ x y → x D.≈ y → ⟦D→S⟧ x S.≈ ⟦D→S⟧ y
line (zero – zero) (zero – zero) p = refl
line (zero – zero) (zero – suc d) p = refl , p
line (zero – zero) (suc c – zero) p = compPath p (cong suc ⟨ +-identityʳ c ⟩)
line (zero – b) (suc c – suc d) p = line (zero – b) (c – d) ⟨ suc-injective ⟪ p ⟫ ⟩
line (suc a – suc b) (zero – d) p = line (a – b) (zero – d) ⟨ suc-injective ⟪ p ⟫ ⟩
line (zero – suc b) (zero – zero) p = sym p , refl
line (zero – suc b) (zero – suc d) p = sym p
line (zero – suc b) (suc c – zero) p = case ⟪ p ⟫ of λ ()
line (suc a – zero) (zero – d) p = case ⟪ p ⟫ of λ ()
line (suc a – zero) (suc c – zero) p =
suc a
≡⟨ cong suc (sym ⟨ +-identityʳ a ⟩) ⟩
suc (a + 0)
≡⟨ p ⟩
suc (c + 0)
≡⟨ cong suc ⟨ +-identityʳ c ⟩ ⟩
suc c
∎
line (suc a – b) (suc c – suc d) p =
line (suc a – b) (c – d)
⟨ suc-injective ⟪ compPath (cong suc (sym (+-suc a d))) p ⟫ ⟩
line (suc a – suc b) (suc c – d) p =
line (a – b) (suc c – d)
⟨ suc-injective ⟪ compPath p (cong suc (+-suc c b)) ⟫ ⟩
⟦S→D⟧ : S.⟦ℤ⟧ → D.⟦ℤ⟧
⟦S→D⟧ (+1* a) = a – zero
⟦S→D⟧ (-1* a) = zero – a
⟦D→S→D⟧ : ∀ x → ⟦S→D⟧ (⟦D→S⟧ x) D.≈ x
⟦D→S→D⟧ (zero – zero) = refl
⟦D→S→D⟧ (zero – suc b) = refl
⟦D→S→D⟧ (suc a – zero) = refl
⟦D→S→D⟧ (suc a – suc b) =
let m , n = ⟦S→D⟧ (⟦D→S⟧ (a – b)) in
m + suc b
≡⟨ +-suc m b ⟩
suc (m + b)
≡⟨ cong suc (⟦D→S→D⟧ (a – b)) ⟩
suc (a + n)
∎
⟦S→D→S⟧ : ∀ x → ⟦D→S⟧ (⟦S→D⟧ x) S.≈ x
⟦S→D→S⟧ (+1* x) = refl
⟦S→D→S⟧ (-1* zero) = refl , refl
⟦S→D→S⟧ (-1* suc x) = refl
cong-⟦S→D⟧ : ∀ x y → x S.≈ y → ⟦S→D⟧ x D.≈ ⟦S→D⟧ y
cong-⟦S→D⟧ (+1* x) (+1* y) = cong (_+ zero)
cong-⟦S→D⟧ (-1* x) (-1* y) = sym
cong-⟦S→D⟧ (+1* x) (-1* y) = Σ.uncurry (cong₂ _+_)
cong-⟦S→D⟧ (-1* x) (+1* y) (p , q) = compPath (sym (cong₂ _+_ p q)) ⟨ +-comm x y ⟩
cong-⟦D→S⟧ : ∀ x y → x D.≈ y → ⟦D→S⟧ x S.≈ ⟦D→S⟧ y
cong-⟦D→S⟧ (zero – zero) (zero – zero) p = refl
cong-⟦D→S⟧ (zero – zero) (zero – suc d) p = refl , p
cong-⟦D→S⟧ (zero – zero) (suc c – zero) p = compPath p (cong suc ⟨ +-identityʳ c ⟩)
cong-⟦D→S⟧ (zero – b) (suc c – suc d) p = cong-⟦D→S⟧ (zero – b) (c – d) ⟨ suc-injective ⟪ p ⟫ ⟩
cong-⟦D→S⟧ (suc a – suc b) (zero – d) p = cong-⟦D→S⟧ (a – b) (zero – d) ⟨ suc-injective ⟪ p ⟫ ⟩
cong-⟦D→S⟧ (zero – suc b) (zero – zero) p = sym p , refl
cong-⟦D→S⟧ (zero – suc b) (zero – suc d) p = sym p
cong-⟦D→S⟧ (zero – suc b) (suc c – zero) p = case ⟪ p ⟫ of λ ()
cong-⟦D→S⟧ (suc a – zero) (zero – d) p = case ⟪ p ⟫ of λ ()
cong-⟦D→S⟧ (suc a – zero) (suc c – zero) p =
suc a
≡⟨ cong suc (sym ⟨ +-identityʳ a ⟩) ⟩
suc (a + 0)
≡⟨ p ⟩
suc (c + 0)
≡⟨ cong suc ⟨ +-identityʳ c ⟩ ⟩
suc c
∎
cong-⟦D→S⟧ (suc a – b) (suc c – suc d) p =
cong-⟦D→S⟧ (suc a – b) (c – d)
⟨ suc-injective ⟪ compPath (cong suc (sym (+-suc a d))) p ⟫ ⟩
cong-⟦D→S⟧ (suc a – suc b) (suc c – d) p =
cong-⟦D→S⟧ (a – b) (suc c – d)
⟨ suc-injective ⟪ compPath p (cong suc (+-suc c b)) ⟫ ⟩
Signed≡Difference : S.ℤ ≡ D.ℤ
Signed≡Difference = ua (isoToEquiv ⟦S→D⟧ ⟦D→S⟧ cong-⟦S→D⟧ cong-⟦D→S⟧ ⟦S→D→S⟧ ⟦D→S→D⟧)
| {
"alphanum_fraction": 0.4940617577,
"avg_line_length": 33.8303571429,
"ext": "agda",
"hexsha": "fb0e3c10c7aa93fa5fa9bdf328f985d855ea526b",
"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": "67ea7b96228c592daf79e800ebe4a7c12ed7221e",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "kcsmnt0/numbers",
"max_forks_repo_path": "src/Integer/Univalence.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "67ea7b96228c592daf79e800ebe4a7c12ed7221e",
"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": "kcsmnt0/numbers",
"max_issues_repo_path": "src/Integer/Univalence.agda",
"max_line_length": 95,
"max_stars_count": 9,
"max_stars_repo_head_hexsha": "67ea7b96228c592daf79e800ebe4a7c12ed7221e",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "kcsmnt0/numbers",
"max_stars_repo_path": "src/Integer/Univalence.agda",
"max_stars_repo_stars_event_max_datetime": "2020-01-16T07:16:26.000Z",
"max_stars_repo_stars_event_min_datetime": "2019-05-20T01:29:41.000Z",
"num_tokens": 1962,
"size": 3789
} |
postulate anything : ∀{a}{A : Set a} → A
data N : Set where
suc : (n : N) → N
data Val : (n : N) → Set where
valSuc : (n : N) → Val (suc n)
-- valSuc : (n : N) → Val n -- internal error disappears
Pred : Set₁
Pred = (n : N) → Set
postulate
Any : (P : Pred) → Set
F : (P : Pred) → Pred
anyF : {P : Pred} (S : Any P) → Any (F P)
Evaluate : ∀ (n : N) (P : (w : Val n) → Set) → Set
Evaluate n P = P anything
LR : (n : N) → Pred
LR n m = Evaluate n λ { (valSuc _) → anything}
anyLR : {n : N} → Any (LR n)
anyLR = anyF anything
| {
"alphanum_fraction": 0.5211009174,
"avg_line_length": 20.1851851852,
"ext": "agda",
"hexsha": "023e559836c49b655b7fac475e0d81ec7586714f",
"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/Issue2047.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/Issue2047.agda",
"max_line_length": 57,
"max_stars_count": 1989,
"max_stars_repo_head_hexsha": "7f58030124fa99dfbf8db376659416f3ad8384de",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "cruhland/agda",
"max_stars_repo_path": "test/Fail/Issue2047.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": 219,
"size": 545
} |
{-# OPTIONS --without-K --safe #-}
-- The 'Identity' instance, with all of Setoids as models
module Categories.Theory.Lawvere.Instance.Identity where
open import Data.Fin using (splitAt)
open import Data.Sum using ([_,_]′)
open import Data.Unit.Polymorphic using (⊤; tt)
open import Level
open import Relation.Binary.PropositionalEquality
using (_≡_; refl; isEquivalence)
open import Categories.Category.Cartesian.Bundle using (CartesianCategory)
open import Categories.Category.Core using (Category)
open import Categories.Category.Instance.Nat
open import Categories.Category.Unbundled.Properties using (unpack′)
open import Categories.Functor.IdentityOnObjects using (id-IOO)
open import Categories.Object.Product using (Product)
open import Categories.Theory.Lawvere using (LawvereTheory)
Identity : LawvereTheory 0ℓ 0ℓ
Identity = record
{ L = unpack′ (Category.op Nat)
; T = CartesianCategory.cartesian Natop-Cartesian
; I = id-IOO
; CartF = record
{ F-resp-⊤ = record { ! = λ () ; !-unique = λ _ () }
; F-resp-× = λ {m} {n} → record { P m n }
}
}
where
module P m n = Product Natop (Natop-Product m n)
| {
"alphanum_fraction": 0.7326906223,
"avg_line_length": 33.5588235294,
"ext": "agda",
"hexsha": "c40264462d1f13c93643de6cf4e8b3df9ff315fa",
"lang": "Agda",
"max_forks_count": 64,
"max_forks_repo_forks_event_max_datetime": "2022-03-14T02:00:59.000Z",
"max_forks_repo_forks_event_min_datetime": "2019-06-02T16:58:15.000Z",
"max_forks_repo_head_hexsha": "d9e4f578b126313058d105c61707d8c8ae987fa8",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "Code-distancing/agda-categories",
"max_forks_repo_path": "src/Categories/Theory/Lawvere/Instance/Identity.agda",
"max_issues_count": 236,
"max_issues_repo_head_hexsha": "d9e4f578b126313058d105c61707d8c8ae987fa8",
"max_issues_repo_issues_event_max_datetime": "2022-03-28T14:31:43.000Z",
"max_issues_repo_issues_event_min_datetime": "2019-06-01T14:53:54.000Z",
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "Code-distancing/agda-categories",
"max_issues_repo_path": "src/Categories/Theory/Lawvere/Instance/Identity.agda",
"max_line_length": 74,
"max_stars_count": 279,
"max_stars_repo_head_hexsha": "d9e4f578b126313058d105c61707d8c8ae987fa8",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "Trebor-Huang/agda-categories",
"max_stars_repo_path": "src/Categories/Theory/Lawvere/Instance/Identity.agda",
"max_stars_repo_stars_event_max_datetime": "2022-03-22T00:40:14.000Z",
"max_stars_repo_stars_event_min_datetime": "2019-06-01T14:36:40.000Z",
"num_tokens": 308,
"size": 1141
} |
-- Andreas, 2016-11-02, issue #2285
-- double check for record types
record Big : _ where
field any : ∀{a} → Set a
| {
"alphanum_fraction": 0.6525423729,
"avg_line_length": 19.6666666667,
"ext": "agda",
"hexsha": "3f5612a9928a1b9661f0379bd8ddba54c0e75b11",
"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/Issue2285-record.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/Issue2285-record.agda",
"max_line_length": 35,
"max_stars_count": 1989,
"max_stars_repo_head_hexsha": "7f58030124fa99dfbf8db376659416f3ad8384de",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "cruhland/agda",
"max_stars_repo_path": "test/Fail/Issue2285-record.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": 41,
"size": 118
} |
{-# OPTIONS --allow-unsolved-metas
--no-positivity-check
--no-termination-check
--type-in-type
--sized-types
--injective-type-constructors
--guardedness-preserving-type-constructors
--experimental-irrelevance #-}
module SafeFlagPragmas where
| {
"alphanum_fraction": 0.5840978593,
"avg_line_length": 29.7272727273,
"ext": "agda",
"hexsha": "8fd7a172b05fc3e26d51e2264532d17ac0aac4eb",
"lang": "Agda",
"max_forks_count": 1,
"max_forks_repo_forks_event_max_datetime": "2019-03-05T20:02:38.000Z",
"max_forks_repo_forks_event_min_datetime": "2019-03-05T20:02:38.000Z",
"max_forks_repo_head_hexsha": "c0ae7d20728b15d7da4efff6ffadae6fe4590016",
"max_forks_repo_licenses": [
"BSD-3-Clause"
],
"max_forks_repo_name": "redfish64/autonomic-agda",
"max_forks_repo_path": "test/Fail/SafeFlagPragmas.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "c0ae7d20728b15d7da4efff6ffadae6fe4590016",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"BSD-3-Clause"
],
"max_issues_repo_name": "redfish64/autonomic-agda",
"max_issues_repo_path": "test/Fail/SafeFlagPragmas.agda",
"max_line_length": 54,
"max_stars_count": 3,
"max_stars_repo_head_hexsha": "c0ae7d20728b15d7da4efff6ffadae6fe4590016",
"max_stars_repo_licenses": [
"BSD-3-Clause"
],
"max_stars_repo_name": "redfish64/autonomic-agda",
"max_stars_repo_path": "test/Fail/SafeFlagPragmas.agda",
"max_stars_repo_stars_event_max_datetime": "2015-12-07T20:14:00.000Z",
"max_stars_repo_stars_event_min_datetime": "2015-03-28T14:51:03.000Z",
"num_tokens": 73,
"size": 327
} |
-- Andreas, 2020-09-26, issue #4944.
-- Size solver got stuck on projected variables which are left over
-- in some size constraints by the generalization feature.
-- {-# OPTIONS --sized-types #-}
-- {-# OPTIONS --show-implicit #-}
-- {-# OPTIONS -v tc.conv.size:60 -v tc.size:30 -v tc.meta.assign:10 #-}
open import Agda.Builtin.Size
variable
i : Size
postulate
A : Set
data ListA (i : Size) : Set where
nil : ListA i
cons : (j : Size< i) (t : A) (as : ListA j) → ListA i
postulate
node : A → ListA ∞ → A
R : (i : Size) (as as′ : ListA i) → Set
test : -- {i : Size} -- made error vanish
(t u : A) (as : ListA i) →
R (↑ (↑ i)) (cons (↑ i) t (cons i u as)) (cons _ (node t (cons _ u nil)) as)
variable
t u : A
as : ListA i
postulate
tst2 : R _ (cons _ t (cons _ u as)) (cons _ (node t (cons _ u nil)) as)
-- Should pass.
| {
"alphanum_fraction": 0.5755148741,
"avg_line_length": 23.6216216216,
"ext": "agda",
"hexsha": "7f85cf8d2b75d5e47bbb4fd76d3172c327b2624a",
"lang": "Agda",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "ed8ac6f4062ea8a20fa0f62d5db82d4e68278338",
"max_forks_repo_licenses": [
"BSD-3-Clause"
],
"max_forks_repo_name": "shlevy/agda",
"max_forks_repo_path": "test/Succeed/Issue4944.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "ed8ac6f4062ea8a20fa0f62d5db82d4e68278338",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"BSD-3-Clause"
],
"max_issues_repo_name": "shlevy/agda",
"max_issues_repo_path": "test/Succeed/Issue4944.agda",
"max_line_length": 85,
"max_stars_count": null,
"max_stars_repo_head_hexsha": "ed8ac6f4062ea8a20fa0f62d5db82d4e68278338",
"max_stars_repo_licenses": [
"BSD-3-Clause"
],
"max_stars_repo_name": "shlevy/agda",
"max_stars_repo_path": "test/Succeed/Issue4944.agda",
"max_stars_repo_stars_event_max_datetime": null,
"max_stars_repo_stars_event_min_datetime": null,
"num_tokens": 307,
"size": 874
} |