hexsha
stringlengths 40
40
| size
int64 3
1.05M
| ext
stringclasses 163
values | lang
stringclasses 53
values | max_stars_repo_path
stringlengths 3
945
| max_stars_repo_name
stringlengths 4
112
| max_stars_repo_head_hexsha
stringlengths 40
78
| max_stars_repo_licenses
listlengths 1
10
| max_stars_count
float64 1
191k
⌀ | max_stars_repo_stars_event_min_datetime
stringlengths 24
24
⌀ | max_stars_repo_stars_event_max_datetime
stringlengths 24
24
⌀ | max_issues_repo_path
stringlengths 3
945
| max_issues_repo_name
stringlengths 4
113
| max_issues_repo_head_hexsha
stringlengths 40
78
| max_issues_repo_licenses
listlengths 1
10
| max_issues_count
float64 1
116k
⌀ | max_issues_repo_issues_event_min_datetime
stringlengths 24
24
⌀ | max_issues_repo_issues_event_max_datetime
stringlengths 24
24
⌀ | max_forks_repo_path
stringlengths 3
945
| max_forks_repo_name
stringlengths 4
113
| max_forks_repo_head_hexsha
stringlengths 40
78
| max_forks_repo_licenses
listlengths 1
10
| max_forks_count
float64 1
105k
⌀ | max_forks_repo_forks_event_min_datetime
stringlengths 24
24
⌀ | max_forks_repo_forks_event_max_datetime
stringlengths 24
24
⌀ | content
stringlengths 3
1.05M
| avg_line_length
float64 1
966k
| max_line_length
int64 1
977k
| alphanum_fraction
float64 0
1
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0d079ed13b1e7fca6bf68f676cd4c541fa26225a
| 253
|
agda
|
Agda
|
test/Fail/Issue998d.agda
|
alex-mckenna/agda
|
78b62cd24bbd570271a7153e44ad280e52ef3e29
|
[
"BSD-3-Clause"
] | 3
|
2015-03-28T14:51:03.000Z
|
2015-12-07T20:14:00.000Z
|
test/Fail/Issue998d.agda
|
andersk/agda
|
56928ff709dcb931cb9a48c4790e5ed3739e3032
|
[
"BSD-3-Clause"
] | null | null | null |
test/Fail/Issue998d.agda
|
andersk/agda
|
56928ff709dcb931cb9a48c4790e5ed3739e3032
|
[
"BSD-3-Clause"
] | 1
|
2022-03-12T11:35:18.000Z
|
2022-03-12T11:35:18.000Z
|
open import Common.Level
postulate
ℓ : Level
f : (l : Level) (A : Set l) → Set ℓ
f ℓ A = A
-- Expected error:
-- ℓ != ℓ of type Level
-- (because one is a variable and one a defined identifier)
-- when checking that the expression A has type Set ℓ
| 19.461538
| 59
| 0.664032
|
edf922c966d7704dafcdd9f95425a4e95130fd06
| 83
|
agda
|
Agda
|
src/higher.agda
|
pcapriotti/agda-base
|
bbbc3bfb2f80ad08c8e608cccfa14b83ea3d258c
|
[
"BSD-3-Clause"
] | 20
|
2015-06-12T12:20:17.000Z
|
2022-02-01T11:25:54.000Z
|
src/higher.agda
|
pcapriotti/agda-base
|
bbbc3bfb2f80ad08c8e608cccfa14b83ea3d258c
|
[
"BSD-3-Clause"
] | 4
|
2015-02-02T14:32:16.000Z
|
2016-10-26T11:57:26.000Z
|
src/higher.agda
|
pcapriotti/agda-base
|
bbbc3bfb2f80ad08c8e608cccfa14b83ea3d258c
|
[
"BSD-3-Clause"
] | 4
|
2015-02-02T12:17:00.000Z
|
2019-05-04T19:31:00.000Z
|
{-# OPTIONS --without-K #-}
module higher where
open import higher.circle public
| 13.833333
| 32
| 0.722892
|
fd2cf2f2f8e017fdd4a7db289691b45b1e18e363
| 29,166
|
agda
|
Agda
|
prototyping/Properties/StrictMode.agda
|
saga/luau
|
5bb9f379b07e378db0a170e7c4030e3a943b2f14
|
[
"MIT"
] | null | null | null |
prototyping/Properties/StrictMode.agda
|
saga/luau
|
5bb9f379b07e378db0a170e7c4030e3a943b2f14
|
[
"MIT"
] | null | null | null |
prototyping/Properties/StrictMode.agda
|
saga/luau
|
5bb9f379b07e378db0a170e7c4030e3a943b2f14
|
[
"MIT"
] | null | null | null |
{-# OPTIONS --rewriting #-}
module Properties.StrictMode where
import Agda.Builtin.Equality.Rewrite
open import Agda.Builtin.Equality using (_≡_; refl)
open import FFI.Data.Either using (Either; Left; Right; mapL; mapR; mapLR; swapLR; cond)
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ᴴ; UnallocatedAddress; UnboundVariable; FunctionCallMismatch; app₁; app₂; 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.Subtyping using (_≮:_; witness; unknown; never; scalar; function; scalar-function; scalar-function-ok; scalar-function-err; scalar-scalar; function-scalar; function-ok; function-err; left; right; _,_; Tree; Language; ¬Language)
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; nil; number; boolean; string; _⇒_; never; unknown; _∩_; _∪_; src; tgt; _≡ᵀ_; _≡ᴹᵀ_)
open import Luau.TypeCheck using (_⊢ᴮ_∈_; _⊢ᴱ_∈_; _⊢ᴴᴮ_▷_∈_; _⊢ᴴᴱ_▷_∈_; nil; var; addr; app; function; block; done; return; local; orUnknown; srcBinOp; 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.Functions using (_∘_)
open import Properties.Subtyping using (unknown-≮:; ≡-trans-≮:; ≮:-trans-≡; never-tgt-≮:; tgt-never-≮:; src-unknown-≮:; unknown-src-≮:; ≮:-trans; ≮:-refl; scalar-≢-impl-≮:; function-≮:-scalar; scalar-≮:-function; function-≮:-never; unknown-≮:-scalar; scalar-≮:-never; unknown-≮:-never)
open import Properties.TypeCheck using (typeOfᴼ; typeOfᴹᴼ; typeOfⱽ; typeOfᴱ; typeOfᴮ; typeCheckᴱ; typeCheckᴮ; typeCheckᴼ; typeCheckᴴ)
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 (RuntimeType; valueType; number; string; boolean; nil; function)
data _⊑_ (H : Heap yes) : Heap yes → Set where
refl : (H ⊑ H)
snoc : ∀ {H′ a O} → (H′ ≡ᴴ H ⊕ a ↦ O) → (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
heap-weakeningᴱ : ∀ Γ H M {H′ U} → (H ⊑ H′) → (typeOfᴱ H′ Γ M ≮: U) → (typeOfᴱ H Γ M ≮: U)
heap-weakeningᴱ Γ H (var x) h p = p
heap-weakeningᴱ Γ H (val nil) h p = p
heap-weakeningᴱ Γ H (val (addr a)) refl p = p
heap-weakeningᴱ Γ H (val (addr a)) (snoc {a = b} q) p with a ≡ᴬ b
heap-weakeningᴱ Γ H (val (addr a)) (snoc {a = a} defn) p | yes refl = unknown-≮: p
heap-weakeningᴱ Γ H (val (addr a)) (snoc {a = b} q) p | no r = ≡-trans-≮: (cong orUnknown (cong typeOfᴹᴼ (lookup-not-allocated q r))) p
heap-weakeningᴱ Γ H (val (number x)) h p = p
heap-weakeningᴱ Γ H (val (bool x)) h p = p
heap-weakeningᴱ Γ H (val (string x)) h p = p
heap-weakeningᴱ Γ H (M $ N) h p = never-tgt-≮: (heap-weakeningᴱ Γ H M h (tgt-never-≮: p))
heap-weakeningᴱ Γ H (function f ⟨ var x ∈ T ⟩∈ U is B end) h p = p
heap-weakeningᴱ Γ H (block var b ∈ T is B end) h p = p
heap-weakeningᴱ Γ H (binexp M op N) h p = p
heap-weakeningᴮ : ∀ Γ H B {H′ U} → (H ⊑ H′) → (typeOfᴮ H′ Γ B ≮: U) → (typeOfᴮ H Γ B ≮: U)
heap-weakeningᴮ Γ H (function f ⟨ var x ∈ T ⟩∈ U is C end ∙ B) h p = heap-weakeningᴮ (Γ ⊕ f ↦ (T ⇒ U)) H B h p
heap-weakeningᴮ Γ H (local var x ∈ T ← M ∙ B) h p = heap-weakeningᴮ (Γ ⊕ x ↦ T) H B h p
heap-weakeningᴮ Γ H (return M ∙ B) h p = heap-weakeningᴱ Γ H M h p
heap-weakeningᴮ Γ H done h p = p
substitutivityᴱ : ∀ {Γ T U} H M v x → (typeOfᴱ H Γ (M [ v / x ]ᴱ) ≮: U) → Either (typeOfᴱ H (Γ ⊕ x ↦ T) M ≮: U) (typeOfᴱ H ∅ (val v) ≮: T)
substitutivityᴱ-whenever : ∀ {Γ T U} H v x y (r : Dec(x ≡ y)) → (typeOfᴱ H Γ (var y [ v / x ]ᴱwhenever r) ≮: U) → Either (typeOfᴱ H (Γ ⊕ x ↦ T) (var y) ≮: U) (typeOfᴱ H ∅ (val v) ≮: T)
substitutivityᴮ : ∀ {Γ T U} H B v x → (typeOfᴮ H Γ (B [ v / x ]ᴮ) ≮: U) → Either (typeOfᴮ H (Γ ⊕ x ↦ T) B ≮: U) (typeOfᴱ H ∅ (val v) ≮: T)
substitutivityᴮ-unless : ∀ {Γ T U V} H B v x y (r : Dec(x ≡ y)) → (typeOfᴮ H (Γ ⊕ y ↦ U) (B [ v / x ]ᴮunless r) ≮: V) → Either (typeOfᴮ H ((Γ ⊕ x ↦ T) ⊕ y ↦ U) B ≮: V) (typeOfᴱ H ∅ (val v) ≮: T)
substitutivityᴮ-unless-yes : ∀ {Γ Γ′ T V} H B v x y (r : x ≡ y) → (Γ′ ≡ Γ) → (typeOfᴮ H Γ (B [ v / x ]ᴮunless yes r) ≮: V) → Either (typeOfᴮ H Γ′ B ≮: V) (typeOfᴱ H ∅ (val v) ≮: T)
substitutivityᴮ-unless-no : ∀ {Γ Γ′ T V} H B v x y (r : x ≢ y) → (Γ′ ≡ Γ ⊕ x ↦ T) → (typeOfᴮ H Γ (B [ v / x ]ᴮunless no r) ≮: V) → Either (typeOfᴮ H Γ′ B ≮: V) (typeOfᴱ H ∅ (val v) ≮: T)
substitutivityᴱ H (var y) v x p = substitutivityᴱ-whenever H v x y (x ≡ⱽ y) p
substitutivityᴱ H (val w) v x p = Left p
substitutivityᴱ H (binexp M op N) v x p = Left p
substitutivityᴱ H (M $ N) v x p = mapL never-tgt-≮: (substitutivityᴱ H M v x (tgt-never-≮: p))
substitutivityᴱ H (function f ⟨ var y ∈ T ⟩∈ U is B end) v x p = Left p
substitutivityᴱ H (block var b ∈ T is B end) v x p = Left p
substitutivityᴱ-whenever H v x x (yes refl) q = swapLR (≮:-trans q)
substitutivityᴱ-whenever H v x y (no p) q = Left (≡-trans-≮: (cong orUnknown (sym (⊕-lookup-miss x y _ _ p))) q)
substitutivityᴮ H (function f ⟨ var y ∈ T ⟩∈ U is C end ∙ B) v x p = substitutivityᴮ-unless H B v x f (x ≡ⱽ f) p
substitutivityᴮ H (local var y ∈ T ← M ∙ B) v x p = substitutivityᴮ-unless H B v x y (x ≡ⱽ y) p
substitutivityᴮ H (return M ∙ B) v x p = substitutivityᴱ H M v x p
substitutivityᴮ H done v x p = Left p
substitutivityᴮ-unless H B v x y (yes p) q = substitutivityᴮ-unless-yes H B v x y p (⊕-over p) q
substitutivityᴮ-unless H B v x y (no p) q = substitutivityᴮ-unless-no H B v x y p (⊕-swap p) q
substitutivityᴮ-unless-yes H B v x y refl refl p = Left p
substitutivityᴮ-unless-no H B v x y p refl q = 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
reflect-subtypingᴱ : ∀ H M {H′ M′ T} → (H ⊢ M ⟶ᴱ M′ ⊣ H′) → (typeOfᴱ H′ ∅ M′ ≮: T) → Either (typeOfᴱ H ∅ M ≮: T) (Warningᴱ H (typeCheckᴱ H ∅ M))
reflect-subtypingᴮ : ∀ H B {H′ B′ T} → (H ⊢ B ⟶ᴮ B′ ⊣ H′) → (typeOfᴮ H′ ∅ B′ ≮: T) → Either (typeOfᴮ H ∅ B ≮: T) (Warningᴮ H (typeCheckᴮ H ∅ B))
reflect-subtypingᴱ H (M $ N) (app₁ s) p = mapLR never-tgt-≮: app₁ (reflect-subtypingᴱ H M s (tgt-never-≮: p))
reflect-subtypingᴱ H (M $ N) (app₂ v s) p = Left (never-tgt-≮: (heap-weakeningᴱ ∅ H M (rednᴱ⊑ s) (tgt-never-≮: p)))
reflect-subtypingᴱ H (M $ N) (beta (function f ⟨ var y ∈ T ⟩∈ U is B end) v refl q) p = Left (≡-trans-≮: (cong tgt (cong orUnknown (cong typeOfᴹᴼ q))) p)
reflect-subtypingᴱ H (function f ⟨ var x ∈ T ⟩∈ U is B end) (function a defn) p = Left p
reflect-subtypingᴱ H (block var b ∈ T is B end) (block s) p = Left p
reflect-subtypingᴱ H (block var b ∈ T is return (val v) ∙ B end) (return v) p = mapR BlockMismatch (swapLR (≮:-trans p))
reflect-subtypingᴱ H (block var b ∈ T is done end) done p = mapR BlockMismatch (swapLR (≮:-trans p))
reflect-subtypingᴱ H (binexp M op N) (binOp₀ s) p = Left (≡-trans-≮: (binOpPreservation H s) p)
reflect-subtypingᴱ H (binexp M op N) (binOp₁ s) p = Left p
reflect-subtypingᴱ H (binexp M op N) (binOp₂ s) p = Left p
reflect-subtypingᴮ H (function f ⟨ var x ∈ T ⟩∈ U is C end ∙ B) (function a defn) p = mapLR (heap-weakeningᴮ _ _ B (snoc defn)) (CONTRADICTION ∘ ≮:-refl) (substitutivityᴮ _ B (addr a) f p)
reflect-subtypingᴮ H (local var x ∈ T ← M ∙ B) (local s) p = Left (heap-weakeningᴮ (x ↦ T) H B (rednᴱ⊑ s) p)
reflect-subtypingᴮ H (local var x ∈ T ← M ∙ B) (subst v) p = mapR LocalVarMismatch (substitutivityᴮ H B v x p)
reflect-subtypingᴮ H (return M ∙ B) (return s) p = mapR return (reflect-subtypingᴱ H M s p)
reflect-substitutionᴱ : ∀ {Γ T} H M v x → Warningᴱ H (typeCheckᴱ H Γ (M [ v / x ]ᴱ)) → Either (Warningᴱ H (typeCheckᴱ H (Γ ⊕ x ↦ T) M)) (Either (Warningᴱ H (typeCheckᴱ H ∅ (val v))) (typeOfᴱ H ∅ (val v) ≮: T))
reflect-substitutionᴱ-whenever : ∀ {Γ T} H v x y (p : Dec(x ≡ y)) → Warningᴱ H (typeCheckᴱ H Γ (var y [ v / x ]ᴱwhenever p)) → Either (Warningᴱ H (typeCheckᴱ H (Γ ⊕ x ↦ T) (var y))) (Either (Warningᴱ H (typeCheckᴱ H ∅ (val v))) (typeOfᴱ H ∅ (val v) ≮: T))
reflect-substitutionᴮ : ∀ {Γ T} H B v x → Warningᴮ H (typeCheckᴮ H Γ (B [ v / x ]ᴮ)) → Either (Warningᴮ H (typeCheckᴮ H (Γ ⊕ x ↦ T) B)) (Either (Warningᴱ H (typeCheckᴱ H ∅ (val v))) (typeOfᴱ H ∅ (val v) ≮: T))
reflect-substitutionᴮ-unless : ∀ {Γ T U} H B v x y (r : Dec(x ≡ y)) → Warningᴮ H (typeCheckᴮ H (Γ ⊕ y ↦ U) (B [ v / x ]ᴮunless r)) → Either (Warningᴮ H (typeCheckᴮ H ((Γ ⊕ x ↦ T) ⊕ y ↦ U) B)) (Either (Warningᴱ H (typeCheckᴱ H ∅ (val v))) (typeOfᴱ H ∅ (val v) ≮: T))
reflect-substitutionᴮ-unless-yes : ∀ {Γ Γ′ T} H B v x y (r : x ≡ y) → (Γ′ ≡ Γ) → Warningᴮ H (typeCheckᴮ H Γ (B [ v / x ]ᴮunless yes r)) → Either (Warningᴮ H (typeCheckᴮ H Γ′ B)) (Either (Warningᴱ H (typeCheckᴱ H ∅ (val v))) (typeOfᴱ H ∅ (val v) ≮: T))
reflect-substitutionᴮ-unless-no : ∀ {Γ Γ′ T} H B v x y (r : x ≢ y) → (Γ′ ≡ Γ ⊕ x ↦ T) → Warningᴮ H (typeCheckᴮ H Γ (B [ v / x ]ᴮunless no r)) → Either (Warningᴮ H (typeCheckᴮ H Γ′ B)) (Either (Warningᴱ H (typeCheckᴱ H ∅ (val v))) (typeOfᴱ H ∅ (val v) ≮: T))
reflect-substitutionᴱ H (var y) v x W = reflect-substitutionᴱ-whenever H v x y (x ≡ⱽ y) W
reflect-substitutionᴱ H (val (addr a)) v x (UnallocatedAddress r) = Left (UnallocatedAddress r)
reflect-substitutionᴱ H (M $ N) v x (FunctionCallMismatch p) with substitutivityᴱ H N v x p
reflect-substitutionᴱ H (M $ N) v x (FunctionCallMismatch p) | Right W = Right (Right W)
reflect-substitutionᴱ H (M $ N) v x (FunctionCallMismatch p) | Left q with substitutivityᴱ H M v x (src-unknown-≮: q)
reflect-substitutionᴱ H (M $ N) v x (FunctionCallMismatch p) | Left q | Left r = Left ((FunctionCallMismatch ∘ unknown-src-≮: q) r)
reflect-substitutionᴱ H (M $ N) v x (FunctionCallMismatch p) | Left q | Right W = Right (Right W)
reflect-substitutionᴱ H (M $ N) v x (app₁ W) = mapL app₁ (reflect-substitutionᴱ H M v x W)
reflect-substitutionᴱ H (M $ N) v x (app₂ W) = mapL app₂ (reflect-substitutionᴱ H N v x W)
reflect-substitutionᴱ H (function f ⟨ var y ∈ T ⟩∈ U is B end) v x (FunctionDefnMismatch q) = mapLR FunctionDefnMismatch Right (substitutivityᴮ-unless H B v x y (x ≡ⱽ y) q)
reflect-substitutionᴱ H (function f ⟨ var y ∈ T ⟩∈ U is B end) v x (function₁ W) = mapL function₁ (reflect-substitutionᴮ-unless H B v x y (x ≡ⱽ y) W)
reflect-substitutionᴱ H (block var b ∈ T is B end) v x (BlockMismatch q) = mapLR BlockMismatch Right (substitutivityᴮ H B v x q)
reflect-substitutionᴱ H (block var b ∈ T is B end) v x (block₁ W′) = mapL block₁ (reflect-substitutionᴮ H B v x W′)
reflect-substitutionᴱ H (binexp M op N) v x (BinOpMismatch₁ q) = mapLR BinOpMismatch₁ Right (substitutivityᴱ H M v x q)
reflect-substitutionᴱ H (binexp M op N) v x (BinOpMismatch₂ q) = mapLR BinOpMismatch₂ Right (substitutivityᴱ H N v x q)
reflect-substitutionᴱ H (binexp M op N) v x (bin₁ W) = mapL bin₁ (reflect-substitutionᴱ H M v x W)
reflect-substitutionᴱ H (binexp M op N) v x (bin₂ W) = mapL bin₂ (reflect-substitutionᴱ H N v x W)
reflect-substitutionᴱ-whenever H a x x (yes refl) (UnallocatedAddress p) = Right (Left (UnallocatedAddress p))
reflect-substitutionᴱ-whenever H v x y (no p) (UnboundVariable q) = Left (UnboundVariable (trans (sym (⊕-lookup-miss x y _ _ p)) q))
reflect-substitutionᴮ H (function f ⟨ var y ∈ T ⟩∈ U is C end ∙ B) v x (FunctionDefnMismatch q) = mapLR FunctionDefnMismatch Right (substitutivityᴮ-unless H C v x y (x ≡ⱽ y) q)
reflect-substitutionᴮ H (function f ⟨ var y ∈ T ⟩∈ U is C end ∙ B) v x (function₁ W) = mapL function₁ (reflect-substitutionᴮ-unless H C v x y (x ≡ⱽ y) W)
reflect-substitutionᴮ H (function f ⟨ var y ∈ T ⟩∈ U is C end ∙ B) v x (function₂ W) = mapL function₂ (reflect-substitutionᴮ-unless H B v x f (x ≡ⱽ f) W)
reflect-substitutionᴮ H (local var y ∈ T ← M ∙ B) v x (LocalVarMismatch q) = mapLR LocalVarMismatch Right (substitutivityᴱ H M v x q)
reflect-substitutionᴮ H (local var y ∈ T ← M ∙ B) v x (local₁ W) = mapL local₁ (reflect-substitutionᴱ H M v x W)
reflect-substitutionᴮ H (local var y ∈ T ← M ∙ B) v x (local₂ W) = mapL local₂ (reflect-substitutionᴮ-unless H B v x y (x ≡ⱽ y) W)
reflect-substitutionᴮ H (return M ∙ B) v x (return W) = mapL return (reflect-substitutionᴱ H M v x W)
reflect-substitutionᴮ-unless H B v x y (yes p) W = reflect-substitutionᴮ-unless-yes H B v x y p (⊕-over p) W
reflect-substitutionᴮ-unless H B v x y (no p) W = reflect-substitutionᴮ-unless-no H B v x y p (⊕-swap p) W
reflect-substitutionᴮ-unless-yes H B v x x refl refl W = Left W
reflect-substitutionᴮ-unless-no H B v x y p refl W = reflect-substitutionᴮ H B v x 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) = FunctionCallMismatch (heap-weakeningᴱ Γ H N h (unknown-src-≮: p (heap-weakeningᴱ Γ H M h (src-unknown-≮: p))))
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) = BinOpMismatch₁ (heap-weakeningᴱ Γ H M h p)
reflect-weakeningᴱ Γ H (binexp M op N) h (BinOpMismatch₂ p) = BinOpMismatch₂ (heap-weakeningᴱ Γ H N h p)
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) = FunctionDefnMismatch (heap-weakeningᴮ (Γ ⊕ y ↦ T) H B h p)
reflect-weakeningᴱ Γ H (function f ⟨ var y ∈ T ⟩∈ U is B end) h (function₁ W) = function₁ (reflect-weakeningᴮ (Γ ⊕ y ↦ T) H B h W)
reflect-weakeningᴱ Γ H (block var b ∈ T is B end) h (BlockMismatch p) = BlockMismatch (heap-weakeningᴮ Γ H B h p)
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) = LocalVarMismatch (heap-weakeningᴱ Γ H M h p)
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ᴮ (Γ ⊕ y ↦ T) H B h W)
reflect-weakeningᴮ Γ H (function f ⟨ var x ∈ T ⟩∈ U is C end ∙ B) h (FunctionDefnMismatch p) = FunctionDefnMismatch (heap-weakeningᴮ (Γ ⊕ x ↦ T) H C h p)
reflect-weakeningᴮ Γ H (function f ⟨ var x ∈ T ⟩∈ U is C end ∙ B) h (function₁ W) = function₁ (reflect-weakeningᴮ (Γ ⊕ x ↦ T) H C h W)
reflect-weakeningᴮ Γ H (function f ⟨ var x ∈ T ⟩∈ U is C end ∙ B) h (function₂ W) = function₂ (reflect-weakeningᴮ (Γ ⊕ f ↦ (T ⇒ U)) 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) = FunctionDefnMismatch (heap-weakeningᴮ (x ↦ T) H B h p)
reflect-weakeningᴼ H (just function f ⟨ var x ∈ T ⟩∈ U is B end) h (function₁ W) = function₁ (reflect-weakeningᴮ (x ↦ T) H B h W)
reflectᴱ : ∀ H M {H′ M′} → (H ⊢ M ⟶ᴱ M′ ⊣ H′) → Warningᴱ H′ (typeCheckᴱ H′ ∅ M′) → Either (Warningᴱ H (typeCheckᴱ H ∅ M)) (Warningᴴ H (typeCheckᴴ H))
reflectᴮ : ∀ H B {H′ B′} → (H ⊢ B ⟶ᴮ B′ ⊣ H′) → Warningᴮ H′ (typeCheckᴮ H′ ∅ B′) → Either (Warningᴮ H (typeCheckᴮ H ∅ B)) (Warningᴴ H (typeCheckᴴ H))
reflectᴱ H (M $ N) (app₁ s) (FunctionCallMismatch p) = cond (Left ∘ FunctionCallMismatch ∘ heap-weakeningᴱ ∅ H N (rednᴱ⊑ s) ∘ unknown-src-≮: p) (Left ∘ app₁) (reflect-subtypingᴱ H M s (src-unknown-≮: p))
reflectᴱ H (M $ N) (app₁ s) (app₁ W′) = mapL app₁ (reflectᴱ H M s W′)
reflectᴱ H (M $ N) (app₁ s) (app₂ W′) = Left (app₂ (reflect-weakeningᴱ ∅ H N (rednᴱ⊑ s) W′))
reflectᴱ H (M $ N) (app₂ p s) (FunctionCallMismatch q) = cond (λ r → Left (FunctionCallMismatch (unknown-src-≮: r (heap-weakeningᴱ ∅ H M (rednᴱ⊑ s) (src-unknown-≮: r))))) (Left ∘ app₂) (reflect-subtypingᴱ H N s q)
reflectᴱ H (M $ N) (app₂ p s) (app₁ W′) = Left (app₁ (reflect-weakeningᴱ ∅ H M (rednᴱ⊑ s) W′))
reflectᴱ H (M $ N) (app₂ p s) (app₂ W′) = mapL app₂ (reflectᴱ H N s W′)
reflectᴱ H (val (addr a) $ N) (beta (function f ⟨ var x ∈ T ⟩∈ U is B end) v refl p) (BlockMismatch q) with substitutivityᴮ H B v x q
reflectᴱ H (val (addr a) $ N) (beta (function f ⟨ var x ∈ T ⟩∈ U is B end) v refl p) (BlockMismatch q) | Left r = Right (addr a p (FunctionDefnMismatch r))
reflectᴱ H (val (addr a) $ N) (beta (function f ⟨ var x ∈ T ⟩∈ U is B end) v refl p) (BlockMismatch q) | Right r = Left (FunctionCallMismatch (≮:-trans-≡ r ((cong src (cong orUnknown (cong typeOfᴹᴼ (sym p)))))))
reflectᴱ H (val (addr a) $ N) (beta (function f ⟨ var x ∈ T ⟩∈ U is B end) v refl p) (block₁ W′) with reflect-substitutionᴮ _ B v x W′
reflectᴱ H (val (addr a) $ N) (beta (function f ⟨ var x ∈ T ⟩∈ U is B end) v refl p) (block₁ W′) | Left W = Right (addr a p (function₁ W))
reflectᴱ H (val (addr a) $ N) (beta (function f ⟨ var x ∈ T ⟩∈ U is B end) v refl p) (block₁ W′) | Right (Left W) = Left (app₂ W)
reflectᴱ H (val (addr a) $ N) (beta (function f ⟨ var x ∈ T ⟩∈ U is B end) v refl p) (block₁ W′) | Right (Right q) = Left (FunctionCallMismatch (≮:-trans-≡ q (cong src (cong orUnknown (cong typeOfᴹᴼ (sym p))))))
reflectᴱ H (block var b ∈ T is B end) (block s) (BlockMismatch p) = Left (cond BlockMismatch block₁ (reflect-subtypingᴮ H B s p))
reflectᴱ H (block var b ∈ T is B end) (block s) (block₁ W′) = mapL block₁ (reflectᴮ H B s W′)
reflectᴱ H (block var b ∈ T is B end) (return v) W′ = Left (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) = Left (cond BinOpMismatch₁ bin₁ (reflect-subtypingᴱ H M s p))
reflectᴱ H (binexp M op N) (binOp₁ s) (BinOpMismatch₂ p) = Left (BinOpMismatch₂ (heap-weakeningᴱ ∅ H N (rednᴱ⊑ s) p))
reflectᴱ H (binexp M op N) (binOp₁ s) (bin₁ W′) = mapL bin₁ (reflectᴱ H M s W′)
reflectᴱ H (binexp M op N) (binOp₁ s) (bin₂ W′) = Left (bin₂ (reflect-weakeningᴱ ∅ H N (rednᴱ⊑ s) W′))
reflectᴱ H (binexp M op N) (binOp₂ s) (BinOpMismatch₁ p) = Left (BinOpMismatch₁ (heap-weakeningᴱ ∅ H M (rednᴱ⊑ s) p))
reflectᴱ H (binexp M op N) (binOp₂ s) (BinOpMismatch₂ p) = Left (cond BinOpMismatch₂ bin₂ (reflect-subtypingᴱ H N s p))
reflectᴱ H (binexp M op N) (binOp₂ s) (bin₁ W′) = Left (bin₁ (reflect-weakeningᴱ ∅ H M (rednᴱ⊑ s) W′))
reflectᴱ H (binexp M op N) (binOp₂ s) (bin₂ W′) = mapL bin₂ (reflectᴱ H N s W′)
reflectᴮ H (local var x ∈ T ← M ∙ B) (local s) (LocalVarMismatch p) = Left (cond LocalVarMismatch local₁ (reflect-subtypingᴱ H M s p))
reflectᴮ H (local var x ∈ T ← M ∙ B) (local s) (local₁ W′) = mapL local₁ (reflectᴱ H M s W′)
reflectᴮ H (local var x ∈ T ← M ∙ B) (local s) (local₂ W′) = Left (local₂ (reflect-weakeningᴮ (x ↦ T) H B (rednᴱ⊑ s) W′))
reflectᴮ H (local var x ∈ T ← M ∙ B) (subst v) W′ = Left (cond local₂ (cond local₁ LocalVarMismatch) (reflect-substitutionᴮ H B v x W′))
reflectᴮ H (function f ⟨ var y ∈ T ⟩∈ U is C end ∙ B) (function a defn) W′ with reflect-substitutionᴮ _ B (addr a) f W′
reflectᴮ H (function f ⟨ var y ∈ T ⟩∈ U is C end ∙ B) (function a defn) W′ | Left W = Left (function₂ (reflect-weakeningᴮ (f ↦ (T ⇒ U)) H B (snoc defn) W))
reflectᴮ H (function f ⟨ var y ∈ T ⟩∈ U is C end ∙ B) (function a defn) W′ | Right (Left (UnallocatedAddress ()))
reflectᴮ H (function f ⟨ var y ∈ T ⟩∈ U is C end ∙ B) (function a defn) W′ | Right (Right p) = CONTRADICTION (≮:-refl p)
reflectᴮ H (return M ∙ B) (return s) (return W′) = mapL return (reflectᴱ H M s W′)
reflectᴴᴱ : ∀ H M {H′ M′} → (H ⊢ M ⟶ᴱ M′ ⊣ H′) → Warningᴴ H′ (typeCheckᴴ H′) → Either (Warningᴱ H (typeCheckᴱ H ∅ M)) (Warningᴴ H (typeCheckᴴ H))
reflectᴴᴮ : ∀ H B {H′ B′} → (H ⊢ B ⟶ᴮ B′ ⊣ H′) → Warningᴴ H′ (typeCheckᴴ H′) → Either (Warningᴮ H (typeCheckᴮ H ∅ B)) (Warningᴴ H (typeCheckᴴ H))
reflectᴴᴱ H (M $ N) (app₁ s) W = mapL app₁ (reflectᴴᴱ H M s W)
reflectᴴᴱ H (M $ N) (app₂ v s) W = mapL app₂ (reflectᴴᴱ H N s W)
reflectᴴᴱ H (M $ N) (beta O v refl p) W = Right W
reflectᴴᴱ H (function f ⟨ var x ∈ T ⟩∈ U is B end) (function a p) (addr b refl W) with b ≡ᴬ a
reflectᴴᴱ H (function f ⟨ var x ∈ T ⟩∈ U is B end) (function a defn) (addr b refl (FunctionDefnMismatch p)) | yes refl = Left (FunctionDefnMismatch (heap-weakeningᴮ (x ↦ T) H B (snoc defn) p))
reflectᴴᴱ H (function f ⟨ var x ∈ T ⟩∈ U is B end) (function a defn) (addr b refl (function₁ W)) | yes refl = Left (function₁ (reflect-weakeningᴮ (x ↦ T) H B (snoc defn) W))
reflectᴴᴱ H (function f ⟨ var x ∈ T ⟩∈ U is B end) (function a p) (addr b refl W) | no q = Right (addr b (lookup-not-allocated p q) (reflect-weakeningᴼ H _ (snoc p) W))
reflectᴴᴱ H (block var b ∈ T is B end) (block s) W = mapL block₁ (reflectᴴᴮ H B s W)
reflectᴴᴱ H (block var b ∈ T is return (val v) ∙ B end) (return v) W = Right W
reflectᴴᴱ H (block var b ∈ T is done end) done W = Right W
reflectᴴᴱ H (binexp M op N) (binOp₀ s) W = Right W
reflectᴴᴱ H (binexp M op N) (binOp₁ s) W = mapL bin₁ (reflectᴴᴱ H M s W)
reflectᴴᴱ H (binexp M op N) (binOp₂ s) W = mapL bin₂ (reflectᴴᴱ H N s W)
reflectᴴᴮ H (function f ⟨ var x ∈ T ⟩∈ U is C end ∙ B) (function a p) (addr b refl W) with b ≡ᴬ a
reflectᴴᴮ H (function f ⟨ var x ∈ T ⟩∈ U is C end ∙ B) (function a defn) (addr b refl (FunctionDefnMismatch p)) | yes refl = Left (FunctionDefnMismatch (heap-weakeningᴮ (x ↦ T) H C (snoc defn) p))
reflectᴴᴮ H (function f ⟨ var x ∈ T ⟩∈ U is C end ∙ B) (function a defn) (addr b refl (function₁ W)) | yes refl = Left (function₁ (reflect-weakeningᴮ (x ↦ T) H C (snoc defn) W))
reflectᴴᴮ H (function f ⟨ var x ∈ T ⟩∈ U is C end ∙ B) (function a p) (addr b refl W) | no q = Right (addr b (lookup-not-allocated p q) (reflect-weakeningᴼ H _ (snoc p) W))
reflectᴴᴮ H (local var x ∈ T ← M ∙ B) (local s) W = mapL local₁ (reflectᴴᴱ H M s W)
reflectᴴᴮ H (local var x ∈ T ← M ∙ B) (subst v) W = Right W
reflectᴴᴮ H (return M ∙ B) (return s) W = mapL return (reflectᴴᴱ H M s W)
reflect* : ∀ H B {H′ B′} → (H ⊢ B ⟶* B′ ⊣ H′) → Either (Warningᴮ H′ (typeCheckᴮ H′ ∅ B′)) (Warningᴴ H′ (typeCheckᴴ H′)) → Either (Warningᴮ H (typeCheckᴮ H ∅ B)) (Warningᴴ H (typeCheckᴴ H))
reflect* H B refl W = W
reflect* H B (step s t) W = cond (reflectᴮ H B s) (reflectᴴᴮ H B s) (reflect* _ _ t W)
isntNumber : ∀ H v → (valueType v ≢ number) → (typeOfᴱ H ∅ (val v) ≮: number)
isntNumber H nil p = scalar-≢-impl-≮: nil number (λ ())
isntNumber H (addr a) p with remember (H [ a ]ᴴ)
isntNumber H (addr a) p | (just (function f ⟨ var x ∈ T ⟩∈ U is B end) , q) = ≡-trans-≮: (cong orUnknown (cong typeOfᴹᴼ q)) (function-≮:-scalar number)
isntNumber H (addr a) p | (nothing , q) = ≡-trans-≮: (cong orUnknown (cong typeOfᴹᴼ q)) (unknown-≮:-scalar number)
isntNumber H (number x) p = CONTRADICTION (p refl)
isntNumber H (bool x) p = scalar-≢-impl-≮: boolean number (λ ())
isntNumber H (string x) p = scalar-≢-impl-≮: string number (λ ())
isntString : ∀ H v → (valueType v ≢ string) → (typeOfᴱ H ∅ (val v) ≮: string)
isntString H nil p = scalar-≢-impl-≮: nil string (λ ())
isntString H (addr a) p with remember (H [ a ]ᴴ)
isntString H (addr a) p | (just (function f ⟨ var x ∈ T ⟩∈ U is B end) , q) = ≡-trans-≮: (cong orUnknown (cong typeOfᴹᴼ q)) (function-≮:-scalar string)
isntString H (addr a) p | (nothing , q) = ≡-trans-≮: (cong orUnknown (cong typeOfᴹᴼ q)) (unknown-≮:-scalar string)
isntString H (number x) p = scalar-≢-impl-≮: number string (λ ())
isntString H (bool x) p = scalar-≢-impl-≮: boolean string (λ ())
isntString H (string x) p = CONTRADICTION (p refl)
isntFunction : ∀ H v {T U} → (valueType v ≢ function) → (typeOfᴱ H ∅ (val v) ≮: (T ⇒ U))
isntFunction H nil p = scalar-≮:-function nil
isntFunction H (addr a) p = CONTRADICTION (p refl)
isntFunction H (number x) p = scalar-≮:-function number
isntFunction H (bool x) p = scalar-≮:-function boolean
isntFunction H (string x) p = scalar-≮:-function string
isntEmpty : ∀ H v → (typeOfᴱ H ∅ (val v) ≮: never)
isntEmpty H nil = scalar-≮:-never nil
isntEmpty H (addr a) with remember (H [ a ]ᴴ)
isntEmpty H (addr a) | (just (function f ⟨ var x ∈ T ⟩∈ U is B end) , p) = ≡-trans-≮: (cong orUnknown (cong typeOfᴹᴼ p)) function-≮:-never
isntEmpty H (addr a) | (nothing , p) = ≡-trans-≮: (cong orUnknown (cong typeOfᴹᴼ p)) unknown-≮:-never
isntEmpty H (number x) = scalar-≮:-never number
isntEmpty H (bool x) = scalar-≮:-never boolean
isntEmpty H (string x) = scalar-≮:-never string
runtimeBinOpWarning : ∀ H {op} v → BinOpError op (valueType v) → (typeOfᴱ H ∅ (val v) ≮: srcBinOp op)
runtimeBinOpWarning H v (+ p) = isntNumber H v p
runtimeBinOpWarning H v (- p) = isntNumber H v p
runtimeBinOpWarning H v (* p) = isntNumber H v p
runtimeBinOpWarning H v (/ p) = isntNumber H v p
runtimeBinOpWarning H v (< p) = isntNumber H v p
runtimeBinOpWarning H v (> p) = isntNumber H v p
runtimeBinOpWarning H v (<= p) = isntNumber H v p
runtimeBinOpWarning H v (>= p) = isntNumber H v p
runtimeBinOpWarning H v (·· p) = isntString H v p
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) = FunctionCallMismatch (unknown-src-≮: (isntEmpty H w) (isntFunction H v p))
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 (Left (runtimeWarningᴮ H′ B′ err))
wellTypedProgramsDontGoWrong H′ B B′ t err | Right (addr a refl ())
wellTypedProgramsDontGoWrong H′ B B′ t err | Left W = W
| 84.051873
| 323
| 0.653021
|
736df6d3ac4af6d0a26e7007197ce5a6ef47ad5c
| 2,287
|
agda
|
Agda
|
Structure/Category/Functor/Proofs.agda
|
Lolirofle/stuff-in-agda
|
70f4fba849f2fd779c5aaa5af122ccb6a5b271ba
|
[
"MIT"
] | 6
|
2020-04-07T17:58:13.000Z
|
2022-02-05T06:53:22.000Z
|
Structure/Category/Functor/Proofs.agda
|
Lolirofle/stuff-in-agda
|
70f4fba849f2fd779c5aaa5af122ccb6a5b271ba
|
[
"MIT"
] | null | null | null |
Structure/Category/Functor/Proofs.agda
|
Lolirofle/stuff-in-agda
|
70f4fba849f2fd779c5aaa5af122ccb6a5b271ba
|
[
"MIT"
] | null | null | null |
module Structure.Category.Functor.Proofs where
open import Data.Tuple as Tuple using (_,_)
open import Functional using (_$_)
open import Logic.Predicate
import Lvl
open import Structure.Category
open import Structure.Categorical.Properties
open import Structure.Category.Functor
open import Structure.Category.Functor.Equiv
open import Structure.Function
open import Structure.Operator
open import Structure.Relator.Equivalence
open import Structure.Relator.Properties
open import Structure.Setoid
open import Syntax.Transitivity
open import Type
private variable ℓ ℓₗₑ ℓᵣₑ : Lvl.Level
private variable Obj Obj₁ Obj₂ Obj₃ : Type{ℓ}
private variable Morphism Morphism₁ Morphism₂ Morphism₃ : Obj → Obj → Type{ℓ}
module _
⦃ morphism-equiv₁ : ∀{x y} → Equiv{ℓₗₑ}(Morphism₁ x y) ⦄
⦃ morphism-equiv₂ : ∀{x y} → Equiv{ℓᵣₑ}(Morphism₂ x y) ⦄
{cat₁ : Category(Morphism₁)}
{cat₂ : Category(Morphism₂)}
(F : Obj₁ → Obj₂)
⦃ functor : Functor(cat₁)(cat₂)(F) ⦄
where
open Category.ArrowNotation ⦃ … ⦄
open Category ⦃ … ⦄
open Functor(functor)
private open module MorphismEquivₗ {x}{y} = Equiv(morphism-equiv₁{x}{y}) using () renaming (_≡_ to _≡ₗₘ_)
private open module MorphismEquivᵣ {x}{y} = Equiv(morphism-equiv₂{x}{y}) using () renaming (_≡_ to _≡ᵣₘ_)
private instance _ = cat₁
private instance _ = cat₂
private variable x y : Obj₁
isomorphism-preserving : ∀{f : x ⟶ y} → Morphism.Isomorphism ⦃ \{x y} → morphism-equiv₁ {x}{y} ⦄ (_∘_)(id)(f) → Morphism.Isomorphism ⦃ \{x y} → morphism-equiv₂ {x}{y} ⦄ (_∘_)(id)(map f)
∃.witness (isomorphism-preserving ([∃]-intro g)) = map g
∃.proof (isomorphism-preserving {f = f} iso@([∃]-intro g)) =
(Morphism.intro $
map g ∘ map f 🝖-[ op-preserving ]-sym
map(g ∘ f) 🝖-[ congruence₁(map) (inverseₗ(f)(g)) ]
map id 🝖-[ id-preserving ]
id 🝖-end
) , (Morphism.intro $
map f ∘ map g 🝖-[ op-preserving ]-sym
map(f ∘ g) 🝖-[ congruence₁(map) (inverseᵣ(f)(g)) ]
map id 🝖-[ id-preserving ]
id 🝖-end
)
where
open Morphism.OperModule (\{x : Obj₁} → _∘_ {x = x})
open Morphism.IdModule (\{x : Obj₁} → _∘_ {x = x})(id)
open Morphism.Isomorphism(\{x : Obj₁} → _∘_ {x = x})(id)(f)
instance _ = iso
| 37.491803
| 187
| 0.651509
|
2134f5bed58b293df9bb00ed5683bca7b6137381
| 2,663
|
agda
|
Agda
|
src/Categories/Category/Duality.agda
|
jaykru/agda-categories
|
a4053cf700bcefdf73b857c3352f1eae29382a60
|
[
"MIT"
] | 5
|
2020-10-07T12:07:53.000Z
|
2020-10-10T21:41:32.000Z
|
src/Categories/Category/Duality.agda
|
jaykru/agda-categories
|
a4053cf700bcefdf73b857c3352f1eae29382a60
|
[
"MIT"
] | null | null | null |
src/Categories/Category/Duality.agda
|
jaykru/agda-categories
|
a4053cf700bcefdf73b857c3352f1eae29382a60
|
[
"MIT"
] | 1
|
2021-11-04T06:54:45.000Z
|
2021-11-04T06:54:45.000Z
|
{-# OPTIONS --without-K --safe #-}
open import Categories.Category
module Categories.Category.Duality {o ℓ e} (C : Category o ℓ e) where
open import Relation.Binary.PropositionalEquality using (_≡_; refl)
open import Categories.Category.Cartesian
open import Categories.Category.Cocartesian
open import Categories.Category.Complete
open import Categories.Category.Complete.Finitely
open import Categories.Category.Cocomplete
open import Categories.Category.Cocomplete.Finitely
open import Categories.Object.Duality
open import Categories.Diagram.Duality
open import Categories.Functor
private
module C = Category C
open C
coCartesian⇒Cocartesian : Cartesian C.op → Cocartesian C
coCartesian⇒Cocartesian Car = record
{ initial = op⊤⇒⊥ C terminal
; coproducts = record
{ coproduct = coProduct⇒Coproduct C product
}
}
where open Cartesian Car
Cocartesian⇒coCartesian : Cocartesian C → Cartesian C.op
Cocartesian⇒coCartesian Co = record
{ terminal = ⊥⇒op⊤ C initial
; products = record
{ product = Coproduct⇒coProduct C coproduct
}
}
where open Cocartesian Co
coComplete⇒Cocomplete : ∀ {o′ ℓ′ e′} → Complete o′ ℓ′ e′ C.op → Cocomplete o′ ℓ′ e′ C
coComplete⇒Cocomplete Com F = coLimit⇒Colimit C (Com F.op)
where module F = Functor F
Cocomplete⇒coComplete : ∀ {o′ ℓ′ e′} → Cocomplete o′ ℓ′ e′ C → Complete o′ ℓ′ e′ C.op
Cocomplete⇒coComplete Coc F = Colimit⇒coLimit C (Coc F.op)
where module F = Functor F
coFinitelyComplete⇒FinitelyCocomplete : FinitelyComplete C.op → FinitelyCocomplete C
coFinitelyComplete⇒FinitelyCocomplete FC = record
{ cocartesian = coCartesian⇒Cocartesian cartesian
; coequalizer = λ f g → coEqualizer⇒Coequalizer C (equalizer f g)
}
where open FinitelyComplete FC
FinitelyCocomplete⇒coFinitelyComplete : FinitelyCocomplete C → FinitelyComplete C.op
FinitelyCocomplete⇒coFinitelyComplete FC = record
{ cartesian = Cocartesian⇒coCartesian cocartesian
; equalizer = λ f g → Coequalizer⇒coEqualizer C (coequalizer f g)
}
where open FinitelyCocomplete FC
module DualityConversionProperties where
private
op-involutive : Category.op C.op ≡ C
op-involutive = refl
coCartesian⇔Cocartesian : ∀(coCartesian : Cartesian C.op)
→ Cocartesian⇒coCartesian (coCartesian⇒Cocartesian coCartesian)
≡ coCartesian
coCartesian⇔Cocartesian _ = refl
coFinitelyComplete⇔FinitelyCocomplete : ∀(coFinComplete : FinitelyComplete C.op) →
FinitelyCocomplete⇒coFinitelyComplete
(coFinitelyComplete⇒FinitelyCocomplete coFinComplete) ≡ coFinComplete
coFinitelyComplete⇔FinitelyCocomplete _ = refl
| 32.876543
| 91
| 0.745024
|
3f164b5bfb32e52dbc254cd987d768299444c441
| 929
|
agda
|
Agda
|
test/succeed/SubtermTermination.agda
|
asr/agda-kanso
|
aa10ae6a29dc79964fe9dec2de07b9df28b61ed5
|
[
"MIT"
] | 1
|
2019-11-27T07:26:06.000Z
|
2019-11-27T07:26:06.000Z
|
test/succeed/SubtermTermination.agda
|
np/agda-git-experiment
|
20596e9dd9867166a64470dd24ea68925ff380ce
|
[
"MIT"
] | null | null | null |
test/succeed/SubtermTermination.agda
|
np/agda-git-experiment
|
20596e9dd9867166a64470dd24ea68925ff380ce
|
[
"MIT"
] | null | null | null |
-- Check that the termination checker can handle recursive
-- calls on subterms which aren't simply variables.
module SubtermTermination where
data N : Set where
zero : N
suc : N → N
f : N → N
f (suc zero) = f zero
f _ = zero
data One? : N → Set where
one : One? (suc zero)
other : ∀ {n} → One? n
-- Should work for dot patterns as well
f′ : (n : N) → One? n → N
f′ (suc .zero) one = f′ zero other
f′ _ _ = zero
f″ : (n : N) → One? n → N
f″ ._ one = f″ zero other
f″ _ _ = zero
data D : Set where
c₁ : D
c₂ : D → D
c₃ : D → D → D
g : D → D
g (c₃ (c₂ x) y) = g (c₂ x)
g _ = c₁
{- Andreas, 2011-07-07 subterm is not complete
does not work with postulates or definitions
postulate
i : {A : Set} → A → A
data NAT : N → Set where
Zero : NAT zero
Suc : ∀ n → NAT (i n) → NAT (suc (i n))
h : (n : N) -> NAT n -> Set
h .zero Zero = N
h .(suc (i n)) (Suc n m) = h (i n) (i m)
-}
| 19.354167
| 58
| 0.547901
|
1161ebdaaa9fdb3e6f69eded7239020b70ff615c
| 992
|
agda
|
Agda
|
test/MonoidTactic.agda
|
t-more/agda-prelude
|
da4fca7744d317b8843f2bc80a923972f65548d3
|
[
"MIT"
] | 111
|
2015-01-05T11:28:15.000Z
|
2022-02-12T23:29:26.000Z
|
test/MonoidTactic.agda
|
t-more/agda-prelude
|
da4fca7744d317b8843f2bc80a923972f65548d3
|
[
"MIT"
] | 59
|
2016-02-09T05:36:44.000Z
|
2022-01-14T07:32:36.000Z
|
test/MonoidTactic.agda
|
t-more/agda-prelude
|
da4fca7744d317b8843f2bc80a923972f65548d3
|
[
"MIT"
] | 24
|
2015-03-12T18:03:45.000Z
|
2021-04-22T06:10:41.000Z
|
module MonoidTactic where
open import Prelude
open import Container.Traversable
open import Tactic.Monoid
open import Tactic.Reflection
SemigroupAnd : Semigroup Bool
_<>_ {{SemigroupAnd}} = _&&_
MonoidAnd : Monoid Bool
Monoid.super MonoidAnd = SemigroupAnd
mempty {{MonoidAnd}} = true
Monoid/LawsAnd : Monoid/Laws Bool
Monoid/Laws.super Monoid/LawsAnd = MonoidAnd
left-identity {{Monoid/LawsAnd}} x = refl
right-identity {{Monoid/LawsAnd}} true = refl
right-identity {{Monoid/LawsAnd}} false = refl
monoid-assoc {{Monoid/LawsAnd}} true y z = refl
monoid-assoc {{Monoid/LawsAnd}} false y z = refl
test₁ : (a b : Bool) → (a && (b && a && true)) ≡ ((a && b) && a)
test₁ a b = auto-monoid {{Laws = Monoid/LawsAnd}}
test₂ : ∀ {a} {A : Set a} {{Laws : Monoid/Laws A}} →
(x y : A) → x <> (y <> x <> mempty) ≡ (x <> y) <> x
test₂ x y = auto-monoid
test₃ : ∀ {a} {A : Set a} (xs ys zs : List A) → xs ++ ys ++ zs ≡ (xs ++ []) ++ (ys ++ []) ++ zs
test₃ xs ys zs = runT monoidTactic
| 29.176471
| 95
| 0.640121
|
733ca6df003cb28219b7807c1853a4229c33704c
| 326
|
agda
|
Agda
|
Categories/Presheaves.agda
|
copumpkin/categories
|
36f4181d751e2ecb54db219911d8c69afe8ba892
|
[
"BSD-3-Clause"
] | 98
|
2015-04-15T14:57:33.000Z
|
2022-03-08T05:20:36.000Z
|
Categories/Presheaves.agda
|
p-pavel/categories
|
e41aef56324a9f1f8cf3cd30b2db2f73e01066f2
|
[
"BSD-3-Clause"
] | 19
|
2015-05-23T06:47:10.000Z
|
2019-08-09T16:31:40.000Z
|
Categories/Presheaves.agda
|
p-pavel/categories
|
e41aef56324a9f1f8cf3cd30b2db2f73e01066f2
|
[
"BSD-3-Clause"
] | 23
|
2015-02-05T13:03:09.000Z
|
2021-11-11T13:50:56.000Z
|
{-# OPTIONS --universe-polymorphism #-}
module Categories.Presheaves where
open import Level
open import Categories.Category
open import Categories.Agda
open import Categories.FunctorCategory
Presheaves : ∀ {o ℓ e : Level} → Category o ℓ e → Category _ _ _
Presheaves {o} {ℓ} {e} C = Functors (Category.op C) (ISetoids ℓ e)
| 29.636364
| 66
| 0.745399
|
ad35f5c9419f1752354034e0ba2f2f86d29d14d2
| 1,281
|
agda
|
Agda
|
test/Succeed/RewritingGlobalConfluenceWithClauses.agda
|
cagix/agda
|
cc026a6a97a3e517bb94bafa9d49233b067c7559
|
[
"BSD-2-Clause"
] | 1,989
|
2015-01-09T23:51:16.000Z
|
2022-03-30T18:20:48.000Z
|
test/Succeed/RewritingGlobalConfluenceWithClauses.agda
|
Seanpm2001-languages/agda
|
9911f73061e21a87fad76c662463257afe02c861
|
[
"BSD-2-Clause"
] | 4,066
|
2015-01-10T11:24:51.000Z
|
2022-03-31T21:14:49.000Z
|
test/Succeed/RewritingGlobalConfluenceWithClauses.agda
|
Seanpm2001-languages/agda
|
9911f73061e21a87fad76c662463257afe02c861
|
[
"BSD-2-Clause"
] | 371
|
2015-01-03T14:04:08.000Z
|
2022-03-30T19:00:30.000Z
|
{-# OPTIONS --rewriting --confluence-check #-}
open import Agda.Builtin.List
open import Agda.Builtin.Nat
open import Agda.Builtin.Equality
open import Agda.Builtin.Equality.Rewrite
variable
A B : Set
x y z : A
xs ys zs : List A
f : A → B
m n : Nat
cong : (f : A → B) → x ≡ y → f x ≡ f y
cong f refl = refl
trans : x ≡ y → y ≡ z → x ≡ z
trans refl refl = refl
+zero : m + zero ≡ m
+zero {zero} = refl
+zero {suc m} = cong suc +zero
suc+zero : suc m + zero ≡ suc m
suc+zero = +zero
+suc : m + (suc n) ≡ suc (m + n)
+suc {zero} = refl
+suc {suc m} = cong suc +suc
zero+suc : zero + (suc n) ≡ suc n
zero+suc = refl
suc+suc : (suc m) + (suc n) ≡ suc (suc (m + n))
suc+suc = cong suc +suc
{-# REWRITE +zero +suc suc+zero zero+suc suc+suc #-}
map : (A → B) → List A → List B
map f [] = []
map f (x ∷ xs) = (f x) ∷ (map f xs)
_++_ : List A → List A → List A
[] ++ ys = ys
(x ∷ xs) ++ ys = x ∷ (xs ++ ys)
++-[] : xs ++ [] ≡ xs
++-[] {xs = []} = refl
++-[] {xs = x ∷ xs} = cong (_∷_ x) ++-[]
∷-++-[] : (x ∷ xs) ++ [] ≡ x ∷ xs
∷-++-[] = ++-[]
map-id : map (λ x → x) xs ≡ xs
map-id {xs = []} = refl
map-id {xs = x ∷ xs} = cong (_∷_ x) map-id
map-id-∷ : map (λ x → x) (x ∷ xs) ≡ x ∷ xs
map-id-∷ = map-id
{-# REWRITE ++-[] ∷-++-[] #-}
{-# REWRITE map-id map-id-∷ #-}
| 20.015625
| 52
| 0.50039
|
119d2d9465bb903f679cbd153a4a098adb7f0813
| 864
|
agda
|
Agda
|
test/Succeed/BlockOnFreshMeta.agda
|
redfish64/autonomic-agda
|
c0ae7d20728b15d7da4efff6ffadae6fe4590016
|
[
"BSD-3-Clause"
] | null | null | null |
test/Succeed/BlockOnFreshMeta.agda
|
redfish64/autonomic-agda
|
c0ae7d20728b15d7da4efff6ffadae6fe4590016
|
[
"BSD-3-Clause"
] | null | null | null |
test/Succeed/BlockOnFreshMeta.agda
|
redfish64/autonomic-agda
|
c0ae7d20728b15d7da4efff6ffadae6fe4590016
|
[
"BSD-3-Clause"
] | null | null | null |
module _ where
open import Common.Prelude hiding (_>>=_)
open import Common.Reflection
open import Common.Equality
infix 0 case_of_
case_of_ : ∀ {a b} {A : Set a} {B : Set b} → A → (A → B) → B
case x of f = f x
blockOnFresh : TC ⊤
blockOnFresh =
checkType unknown unknown >>= λ
{ (meta m _) → blockOnMeta m
; _ → typeError (strErr "impossible" ∷ []) }
macro
weirdButShouldWork : Tactic
weirdButShouldWork hole =
inferType hole >>= λ goal →
case goal of λ
{ (meta _ _) → blockOnFresh
; _ → unify hole (lit (nat 42))
}
-- When the goal is a meta the tactic will block on a different, fresh, meta.
-- That's silly, but should still work. Once the goal is resolved the tactic
-- doesn't block any more so everything should be fine.
thing : _
solves : Nat
thing = weirdButShouldWork
solves = thing
check : thing ≡ 42
check = refl
| 23.351351
| 77
| 0.668981
|
1478c4e40129474f1bc01b186ccf34692e270c97
| 180
|
agda
|
Agda
|
Cubical/HITs/Ints/QuoInt.agda
|
limemloh/cubical
|
df4ef7edffd1c1deb3d4ff342c7178e9901c44f1
|
[
"MIT"
] | 1
|
2020-03-23T23:52:11.000Z
|
2020-03-23T23:52:11.000Z
|
Cubical/HITs/Ints/QuoInt.agda
|
limemloh/cubical
|
df4ef7edffd1c1deb3d4ff342c7178e9901c44f1
|
[
"MIT"
] | null | null | null |
Cubical/HITs/Ints/QuoInt.agda
|
limemloh/cubical
|
df4ef7edffd1c1deb3d4ff342c7178e9901c44f1
|
[
"MIT"
] | null | null | null |
{-# OPTIONS --cubical --safe #-}
module Cubical.HITs.Ints.QuoInt where
open import Cubical.HITs.Ints.QuoInt.Base public
-- open import Cubical.HITs.Ints.QuoInt.Properties public
| 25.714286
| 57
| 0.766667
|
21cc7c58c4b6dd20c7f624fa65c4983af33ff34c
| 1,133
|
agda
|
Agda
|
src/Human/List.agda
|
MaisaMilena/JuiceMaker
|
b509eb4c4014605facfb4ee5c807cd07753d4477
|
[
"MIT"
] | 6
|
2019-03-29T17:35:20.000Z
|
2020-11-28T05:46:27.000Z
|
src/Human/List.agda
|
MaisaMilena/JuiceMaker
|
b509eb4c4014605facfb4ee5c807cd07753d4477
|
[
"MIT"
] | null | null | null |
src/Human/List.agda
|
MaisaMilena/JuiceMaker
|
b509eb4c4014605facfb4ee5c807cd07753d4477
|
[
"MIT"
] | null | null | null |
module Human.List where
open import Human.Nat
infixr 5 _,_
data List {a} (A : Set a) : Set a where
end : List A
_,_ : (x : A) (xs : List A) → List A
{-# BUILTIN LIST List #-}
{-# COMPILE JS List = function(x,v) { if (x.length < 1) { return v["[]"](); } else { return v["_∷_"](x[0], x.slice(1)); } } #-}
{-# COMPILE JS end = Array() #-}
{-# COMPILE JS _,_ = function (x) { return function(y) { return Array(x).concat(y); }; } #-}
foldr : ∀ {A : Set} {B : Set} → (A → B → B) → B → List A → B
foldr c n end = n
foldr c n (x , xs) = c x (foldr c n xs)
length : ∀ {A : Set} → List A → Nat
length = foldr (λ a n → suc n) zero
-- TODO --
-- filter
-- reduce
-- Receives a function that transforms each element of A, a function A and a new list, B.
map : ∀ {A : Set} {B : Set} → (f : A → B) → List A → List B
map f end = end
map f (x , xs) = (f x) , (map f xs) -- f transforms element x, return map to do a new transformation
-- Sum all numbers in a list
sum : List Nat → Nat
sum end = zero
sum (x , l) = x + (sum l)
remove-last : ∀ {A : Set} → List A → List A
remove-last end = end
remove-last (x , l) = l
| 28.325
| 128
| 0.551633
|
5e1f15d99ac87c14ada167d22984b37455ec3358
| 2,571
|
agda
|
Agda
|
src/fot/FOTC/Induction/WF.agda
|
asr/fotc
|
2fc9f2b81052a2e0822669f02036c5750371b72d
|
[
"MIT"
] | 11
|
2015-09-03T20:53:42.000Z
|
2021-09-12T16:09:54.000Z
|
src/fot/FOTC/Induction/WF.agda
|
asr/fotc
|
2fc9f2b81052a2e0822669f02036c5750371b72d
|
[
"MIT"
] | 2
|
2016-10-12T17:28:16.000Z
|
2017-01-01T14:34:26.000Z
|
src/fot/FOTC/Induction/WF.agda
|
asr/fotc
|
2fc9f2b81052a2e0822669f02036c5750371b72d
|
[
"MIT"
] | 3
|
2016-09-19T14:18:30.000Z
|
2018-03-14T08:50:00.000Z
|
------------------------------------------------------------------------------
-- Well-founded induction on natural numbers
------------------------------------------------------------------------------
{-# OPTIONS --exact-split #-}
{-# OPTIONS --no-sized-types #-}
{-# OPTIONS --no-universe-polymorphism #-}
{-# OPTIONS --without-K #-}
-- Adapted from
-- http://www.iis.sinica.edu.tw/~scm/2008/well-founded-recursion-and-accessibility/
-- and the Agda standard library 0.8.1.
module FOTC.Induction.WF where
open import Common.Relation.Unary
open import FOTC.Base
------------------------------------------------------------------------------
-- The accessibility predicate: x is accessible if everything which is
-- smaller than x is also accessible (inductively).
data Acc (P : D → Set)(_<_ : D → D → Set)(x : D) : Set where
acc : (∀ {y} → P y → y < x → Acc P _<_ y) → Acc P _<_ x
accFold : {P Q : D → Set}(_<_ : D → D → Set) →
(∀ {x} → Q x → (∀ {y} → Q y → y < x → P y) → P x) →
∀ {x} → Q x → Acc Q _<_ x → P x
accFold _<_ f Qx (acc h) = f Qx (λ Qy y<x → accFold _<_ f Qy (h Qy y<x))
-- The accessibility predicate encodes what it means to be
-- well-founded; if all elements are accessible, then _<_ is
-- well-founded.
WellFounded : {P : D → Set} → (D → D → Set) → Set
WellFounded {P} _<_ = ∀ {x} → P x → Acc P _<_ x
WellFoundedInduction : {P Q : D → Set}
{_<_ : D → D → Set} →
WellFounded _<_ →
(∀ {x} → Q x → (∀ {y} → Q y → y < x → P y) → P x) →
∀ {x} → Q x → P x
WellFoundedInduction {_<_ = _<_} wf f Qx = accFold _<_ f Qx (wf Qx)
module Subrelation {P : D → Set}
{_<_ _<'_ : D → D → Set}
(<⇒<' : ∀ {x y} → P x → x < y → x <' y)
where
accessible : Acc P _<'_ ⊆ Acc P _<_
accessible (acc h) = acc (λ Py y<x → accessible (h Py (<⇒<' Py y<x)))
well-founded : WellFounded _<'_ → WellFounded _<_
well-founded wf = λ Px → accessible (wf Px)
module InverseImage {P Q : D → Set}
{_<_ : D → D → Set}
{f : D → D}
(f-Q : ∀ {x} → P x → Q (f x))
where
accessible : ∀ {x} → P x →
Acc Q _<_ (f x) → Acc P (λ x' y' → f x' < f y') x
accessible Px (acc h) =
acc (λ {y} Py fy<fx → accessible Py (h (f-Q Py) fy<fx))
wellFounded : WellFounded _<_ → WellFounded (λ x y → f x < f y)
wellFounded wf = λ Px → accessible Px (wf (f-Q Px))
| 37.808824
| 83
| 0.450797
|
3f32c39e2fece07481930f94d806fa692b21bd41
| 270
|
agda
|
Agda
|
examples/ATPAxiomDataConstructors.agda
|
asr/apia
|
a66c5ddca2ab470539fd68c42c4fbd45f720d682
|
[
"MIT"
] | 10
|
2015-09-03T20:54:16.000Z
|
2019-12-03T13:44:25.000Z
|
examples/ATPAxiomDataConstructors.agda
|
asr/apia
|
a66c5ddca2ab470539fd68c42c4fbd45f720d682
|
[
"MIT"
] | 121
|
2015-01-25T13:22:12.000Z
|
2018-04-22T06:01:44.000Z
|
examples/ATPAxiomDataConstructors.agda
|
asr/apia
|
a66c5ddca2ab470539fd68c42c4fbd45f720d682
|
[
"MIT"
] | 4
|
2016-05-10T23:06:19.000Z
|
2016-08-03T03:54:55.000Z
|
-- The ATP pragma with the role <axiom> can be used with data constructors.
module ATPAxiomDataConstructors where
postulate
D : Set
zero : D
succ : D → D
data N : D → Set where
zN : N zero
sN : ∀ {n} → N n → N (succ n)
{-# ATP axiom zN #-}
| 19.285714
| 75
| 0.585185
|
37018aa25c05ce16aa271f97e29f3c23dca805c6
| 965
|
agda
|
Agda
|
src/Data/PropFormula/Theorems.agda
|
jonaprieto/agda-prop
|
a1730062a6aaced2bb74878c1071db06477044ae
|
[
"MIT"
] | 13
|
2017-05-01T16:45:41.000Z
|
2022-01-17T03:33:12.000Z
|
src/Data/PropFormula/Theorems.agda
|
jonaprieto/agda-prop
|
a1730062a6aaced2bb74878c1071db06477044ae
|
[
"MIT"
] | 18
|
2017-03-08T14:33:10.000Z
|
2017-12-18T16:34:21.000Z
|
src/Data/PropFormula/Theorems.agda
|
jonaprieto/agda-prop
|
a1730062a6aaced2bb74878c1071db06477044ae
|
[
"MIT"
] | 2
|
2017-03-30T16:41:56.000Z
|
2017-12-01T17:01:25.000Z
|
------------------------------------------------------------------------------
-- Agda-Prop Library.
-- A compilation of theorems in Propositional Logic
------------------------------------------------------------------------------
open import Data.Nat using ( ℕ )
module Data.PropFormula.Theorems ( n : ℕ ) where
------------------------------------------------------------------------------
open import Data.PropFormula.Theorems.Biimplication n public
open import Data.PropFormula.Theorems.Classical n public
open import Data.PropFormula.Theorems.Conjunction n public
open import Data.PropFormula.Theorems.Disjunction n public
open import Data.PropFormula.Theorems.Implication n public
open import Data.PropFormula.Theorems.Mixies n public
open import Data.PropFormula.Theorems.Negation n public
open import Data.PropFormula.Theorems.Weakening n public
------------------------------------------------------------------------------
| 43.863636
| 78
| 0.532642
|
cc44af0f5242ac1ba1157e90e89cf81116cc02f8
| 222
|
agda
|
Agda
|
test/Fail/Issue2127.agda
|
mdimjasevic/agda
|
8fb548356b275c7a1e79b768b64511ae937c738b
|
[
"BSD-3-Clause"
] | 1,989
|
2015-01-09T23:51:16.000Z
|
2022-03-30T18:20:48.000Z
|
test/Fail/Issue2127.agda
|
Seanpm2001-languages/agda
|
9911f73061e21a87fad76c662463257afe02c861
|
[
"BSD-2-Clause"
] | 4,066
|
2015-01-10T11:24:51.000Z
|
2022-03-31T21:14:49.000Z
|
test/Fail/Issue2127.agda
|
Seanpm2001-languages/agda
|
9911f73061e21a87fad76c662463257afe02c861
|
[
"BSD-2-Clause"
] | 371
|
2015-01-03T14:04:08.000Z
|
2022-03-30T19:00:30.000Z
|
-- Andreas, 2016-08-02 issue #2127 reported by petercommand
data Test : Set₁ where
field
A : Set
B : Set -- second field necessary to trigger internal error
-- WAS: internal error
-- Should give proper error
| 20.181818
| 64
| 0.698198
|
7ceb9cda8b223740655c664c41bb153b85bc76cc
| 329
|
agda
|
Agda
|
test/Fail/Issue314.agda
|
mdimjasevic/agda
|
8fb548356b275c7a1e79b768b64511ae937c738b
|
[
"BSD-3-Clause"
] | 1,989
|
2015-01-09T23:51:16.000Z
|
2022-03-30T18:20:48.000Z
|
test/Fail/Issue314.agda
|
Seanpm2001-languages/agda
|
9911f73061e21a87fad76c662463257afe02c861
|
[
"BSD-2-Clause"
] | 4,066
|
2015-01-10T11:24:51.000Z
|
2022-03-31T21:14:49.000Z
|
test/Fail/Issue314.agda
|
Seanpm2001-languages/agda
|
9911f73061e21a87fad76c662463257afe02c861
|
[
"BSD-2-Clause"
] | 371
|
2015-01-03T14:04:08.000Z
|
2022-03-30T19:00:30.000Z
|
module Issue314 where
postulate A : Set
data _≡_ (x : A) : A → Set where
refl : x ≡ x
postulate lemma : (x y : A) → x ≡ y
Foo : A → Set₁
Foo x with lemma x _
Foo x | refl = Set
-- Bug.agda:12,9-13
-- Failed to solve the following constraints:
-- x == _23 x : A
-- when checking that the pattern refl has type x ≡ _23 x
| 17.315789
| 57
| 0.620061
|
113b5a1fc1f10318a0ba8c4867231ae6fa9e0150
| 102,926
|
agda
|
Agda
|
src/templates.agda
|
xoltar/cedille
|
acf691e37210607d028f4b19f98ec26c4353bfb5
|
[
"MIT"
] | null | null | null |
src/templates.agda
|
xoltar/cedille
|
acf691e37210607d028f4b19f98ec26c4353bfb5
|
[
"MIT"
] | null | null | null |
src/templates.agda
|
xoltar/cedille
|
acf691e37210607d028f4b19f98ec26c4353bfb5
|
[
"MIT"
] | null | null | null |
-- Generated by src/templates/TemplatesCompiler
module templates where
open import lib
open import cedille-types
-- src/templates/Mendler.ced
MendlerTemplate = File "1" ImportsStart "1" "8" "Mendler" (ParamsCons (Decl "16" "17" NotErased "Indices" (Tkk (Star "27")) "29") ParamsNil) (CmdsNext (DefTermOrType OpacTrans (DefType "32" "Sigma" (KndPi "40" "42" "A" (Tkk (Star "46")) (KndArrow (KndParens "49" (KndTpArrow (TpVar "50" "A") (Star "54")) "56") (Star "59"))) (TpLambda "63" "65" "A" (Tkk (Star "69")) (TpLambda "72" "74" "B" (Tkk (KndTpArrow (TpVar "78" "A") (Star "82"))) (Iota "87" "89" "x" (TpEq "93" (Beta "94" NoTerm NoTerm) (Beta "98" NoTerm NoTerm) "100") (Abs "102" Erased "104" "X" (Tkk (KndTpArrow (TpEq "108" (Beta "109" NoTerm NoTerm) (Beta "113" NoTerm NoTerm) "115") (Star "118"))) (TpArrow (TpParens "121" (Abs "122" NotErased "124" "a" (Tkt (TpVar "128" "A")) (Abs "131" NotErased "133" "b" (Tkt (TpAppt (TpVar "137" "B") (Var "139" "a"))) (TpAppt (TpVar "142" "X") (Beta "144" NoTerm (SomeTerm (Lam "146" NotErased "148" "f" NoClass (App (App (Var "151" "f") NotErased (Var "153" "a")) NotErased (Var "155" "b"))) "157"))))) "158") NotErased (TpAppt (TpVar "161" "X") (Var "163" "x")))))))) "165") (CmdsNext (DefTermOrType OpacTrans (DefType "166" "Product" (KndArrow (Star "176") (KndArrow (Star "180") (Star "184"))) (TpLambda "188" "190" "A" (Tkk (Star "194")) (TpLambda "197" "199" "B" (Tkk (Star "203")) (TpApp (TpApp (TpVar "206" "Sigma") (TpVar "214" "A")) (TpParens "218" (TpLambda "219" "221" "_" (Tkt (TpVar "225" "A")) (TpVar "228" "B")) "230"))))) "231") (CmdsNext (DefTermOrType OpacTrans (DefTerm "233" "sigma" (SomeType (Abs "241" Erased "243" "A" (Tkk (Star "247")) (Abs "250" Erased "252" "B" (Tkk (KndTpArrow (TpVar "256" "A") (Star "260"))) (Abs "263" NotErased "265" "a" (Tkt (TpVar "269" "A")) (TpArrow (TpAppt (TpVar "272" "B") (Var "274" "a")) NotErased (TpApp (TpApp (TpVar "278" "Sigma") (TpVar "286" "A")) (TpVar "290" "B"))))))) (Lam "296" Erased "298" "A" NoClass (Lam "301" Erased "303" "B" NoClass (Lam "306" NotErased "308" "a" NoClass (Lam "311" NotErased "313" "b" NoClass (IotaPair "316" (Beta "317" NoTerm (SomeTerm (Lam "319" NotErased "321" "f" NoClass (App (App (Var "324" "f") NotErased (Var "326" "a")) NotErased (Var "328" "b"))) "330")) (Lam "332" Erased "334" "X" NoClass (Lam "337" NotErased "339" "f" NoClass (App (App (Var "342" "f") NotErased (Var "344" "a")) NotErased (Var "346" "b")))) NoGuide "348")))))) "349") (CmdsNext (DefTermOrType OpacTrans (DefTerm "351" "SigmaInd" (SomeType (Abs "366" Erased "368" "A" (Tkk (Star "372")) (Abs "379" Erased "381" "B" (Tkk (KndTpArrow (TpVar "385" "A") (Star "389"))) (Abs "396" NotErased "398" "x" (Tkt (TpApp (TpApp (TpVar "402" "Sigma") (TpVar "410" "A")) (TpVar "414" "B"))) (Abs "421" Erased "423" "Q" (Tkk (KndTpArrow (TpApp (TpApp (TpVar "427" "Sigma") (TpVar "435" "A")) (TpVar "439" "B")) (Star "443"))) (TpArrow (TpParens "450" (Abs "451" NotErased "453" "a" (Tkt (TpVar "457" "A")) (Abs "460" NotErased "462" "b" (Tkt (TpAppt (TpVar "466" "B") (Var "468" "a"))) (TpAppt (TpVar "471" "Q") (Parens "473" (App (App (AppTp (AppTp (Var "474" "sigma") (TpVar "482" "A")) (TpVar "486" "B")) NotErased (Var "488" "a")) NotErased (Var "490" "b")) "492")))) "493") NotErased (TpAppt (TpVar "500" "Q") (Var "502" "x")))))))) (Lam "508" Erased "510" "A" NoClass (Lam "513" Erased "515" "B" NoClass (Lam "518" NotErased "520" "x" NoClass (Lam "523" Erased "525" "Q" NoClass (Lam "528" NotErased "530" "f" NoClass (App (App (App (AppTp (IotaProj (Var "537" "x") "2" "540") (TpParens "543" (TpLambda "544" "546" "x" (Tkt (TpEq "550" (Beta "551" NoTerm NoTerm) (Beta "555" NoTerm NoTerm) "557")) (Abs "559" Erased "561" "x'" (Tkt (TpApp (TpApp (TpVar "566" "Sigma") (TpVar "574" "A")) (TpVar "578" "B"))) (TpArrow (TpEq "581" (Var "582" "x'") (Var "587" "x") "589") Erased (TpAppt (TpVar "592" "Q") (Var "594" "x'"))))) "597")) NotErased (Parens "604" (Lam "605" NotErased "607" "a" NoClass (Lam "610" NotErased "612" "b" NoClass (Lam "615" Erased "617" "x'" NoClass (Lam "621" Erased "623" "e" NoClass (Rho "626" RhoPlain NoNums (Var "628" "e") NoGuide (App (App (Var "632" "f") NotErased (Var "634" "a")) NotErased (Var "636" "b"))))))) "638")) Erased (Var "640" "x")) Erased (Beta "643" NoTerm NoTerm)))))))) "645") (CmdsNext (DefTermOrType OpacTrans (DefTerm "647" "fst" (SomeType (Abs "653" Erased "655" "A" (Tkk (Star "659")) (Abs "662" Erased "664" "B" (Tkk (KndTpArrow (TpVar "668" "A") (Star "672"))) (TpArrow (TpApp (TpApp (TpVar "675" "Sigma") (TpVar "683" "A")) (TpVar "687" "B")) NotErased (TpVar "691" "A"))))) (Lam "695" Erased "697" "A" NoClass (Lam "700" Erased "702" "B" NoClass (Lam "705" NotErased "707" "x" NoClass (App (AppTp (App (Var "712" "SigmaInd") NotErased (Var "721" "x")) (TpParens "725" (TpLambda "726" "728" "x" (Tkt (TpApp (TpApp (TpVar "732" "Sigma") (TpVar "740" "A")) (TpVar "744" "B"))) (TpVar "747" "A")) "749")) NotErased (Parens "750" (Lam "751" NotErased "753" "a" NoClass (Lam "756" NotErased "758" "b" NoClass (Var "761" "a"))) "763")))))) "764") (CmdsNext (DefTermOrType OpacTrans (DefTerm "766" "snd" (SomeType (Abs "772" Erased "774" "A" (Tkk (Star "778")) (Abs "781" Erased "783" "B" (Tkk (KndTpArrow (TpVar "787" "A") (Star "791"))) (Abs "794" NotErased "796" "x" (Tkt (TpApp (TpApp (TpVar "800" "Sigma") (TpVar "808" "A")) (TpVar "812" "B"))) (TpAppt (TpVar "815" "B") (Parens "817" (App (Var "818" "fst") NotErased (Var "822" "x")) "824")))))) (Lam "827" Erased "829" "A" NoClass (Lam "832" Erased "834" "B" NoClass (Lam "837" NotErased "839" "x" NoClass (App (AppTp (App (Var "844" "SigmaInd") NotErased (Var "853" "x")) (TpParens "857" (TpLambda "858" "860" "x" (Tkt (TpApp (TpApp (TpVar "864" "Sigma") (TpVar "872" "A")) (TpVar "876" "B"))) (TpAppt (TpVar "879" "B") (Parens "881" (App (Var "882" "fst") NotErased (Var "886" "x")) "888"))) "889")) NotErased (Parens "890" (Lam "891" NotErased "893" "a" NoClass (Lam "896" NotErased "898" "b" NoClass (Var "901" "b"))) "903")))))) "904") (CmdsNext (DefTermOrType OpacTrans (DefType "907" "Cast" (KndArrow (KndParens "914" (KndTpArrow (TpVar "915" "Indices") (Star "925")) "927") (KndArrow (KndParens "930" (KndTpArrow (TpVar "931" "Indices") (Star "941")) "943") (Star "946"))) (TpLambda "950" "952" "A" (Tkk (KndTpArrow (TpVar "956" "Indices") (Star "966"))) (TpLambda "969" "971" "B" (Tkk (KndTpArrow (TpVar "975" "Indices") (Star "985"))) (Iota "990" "992" "cast" (Abs "999" Erased "1001" "indices" (Tkt (TpVar "1011" "Indices")) (TpArrow (TpAppt (TpVar "1020" "A") (Var "1022" "indices")) NotErased (TpAppt (TpVar "1032" "B") (Var "1034" "indices")))) (TpEq "1043" (Var "1044" "cast") (Lam "1051" NotErased "1053" "x" NoClass (Var "1056" "x")) "1058"))))) "1059") (CmdsNext (DefTermOrType OpacTrans (DefTerm "1061" "cast" (SomeType (Abs "1072" Erased "1074" "A" (Tkk (KndTpArrow (TpVar "1078" "Indices") (Star "1088"))) (Abs "1091" Erased "1093" "B" (Tkk (KndTpArrow (TpVar "1097" "Indices") (Star "1107"))) (TpArrow (TpApp (TpApp (TpVar "1110" "Cast") (TpVar "1117" "A")) (TpVar "1121" "B")) Erased (Abs "1129" Erased "1131" "indices" (Tkt (TpVar "1141" "Indices")) (TpArrow (TpAppt (TpVar "1150" "A") (Var "1152" "indices")) NotErased (TpAppt (TpVar "1162" "B") (Var "1164" "indices")))))))) (Lam "1176" Erased "1178" "A" NoClass (Lam "1181" Erased "1183" "B" NoClass (Lam "1186" Erased "1188" "c" NoClass (Phi "1191" (IotaProj (Var "1193" "c") "2" "1196") (IotaProj (Var "1199" "c") "1" "1202") (Lam "1204" NotErased "1206" "x" NoClass (Var "1209" "x")) "1211"))))) "1212") (CmdsNext (DefTermOrType OpacTrans (DefType "1214" "Functor" (KndArrow (KndParens "1224" (KndArrow (KndParens "1225" (KndTpArrow (TpVar "1226" "Indices") (Star "1236")) "1238") (KndTpArrow (TpVar "1241" "Indices") (Star "1251"))) "1253") (Star "1256")) (TpLambda "1262" "1264" "F" (Tkk (KndArrow (KndParens "1268" (KndTpArrow (TpVar "1269" "Indices") (Star "1279")) "1281") (KndTpArrow (TpVar "1284" "Indices") (Star "1294")))) (Abs "1297" Erased "1299" "X" (Tkk (KndTpArrow (TpVar "1303" "Indices") (Star "1313"))) (Abs "1316" Erased "1318" "Y" (Tkk (KndTpArrow (TpVar "1322" "Indices") (Star "1332"))) (TpArrow (TpApp (TpApp (TpVar "1339" "Cast") (TpVar "1346" "X")) (TpVar "1350" "Y")) Erased (TpApp (TpApp (TpVar "1354" "Cast") (TpParens "1361" (TpApp (TpVar "1362" "F") (TpVar "1366" "X")) "1368")) (TpParens "1371" (TpApp (TpVar "1372" "F") (TpVar "1376" "Y")) "1378"))))))) "1379") (CmdsNext (DefTermOrType OpacTrans (DefType "1382" "AlgM" (KndArrow (KndParens "1389" (KndArrow (KndParens "1390" (KndTpArrow (TpVar "1391" "Indices") (Star "1401")) "1403") (KndTpArrow (TpVar "1406" "Indices") (Star "1416"))) "1418") (KndArrow (Star "1421") (KndTpArrow (TpVar "1425" "Indices") (Star "1435")))) (TpLambda "1441" "1443" "F" (Tkk (KndArrow (KndParens "1447" (KndTpArrow (TpVar "1448" "Indices") (Star "1458")) "1460") (KndTpArrow (TpVar "1463" "Indices") (Star "1473")))) (TpLambda "1476" "1478" "A" (Tkk (Star "1482")) (TpLambda "1485" "1487" "indices" (Tkt (TpVar "1497" "Indices")) (Abs "1510" Erased "1512" "R" (Tkk (KndTpArrow (TpVar "1516" "Indices") (Star "1526"))) (TpArrow (TpParens "1529" (TpArrow (TpAppt (TpVar "1530" "R") (Var "1532" "indices")) NotErased (TpVar "1542" "A")) "1544") NotErased (TpArrow (TpAppt (TpApp (TpVar "1547" "F") (TpVar "1551" "R")) (Var "1553" "indices")) NotErased (TpVar "1563" "A")))))))) "1565") (CmdsNext (DefTermOrType OpacTrans (DefType "1567" "FixM" (KndArrow (KndParens "1574" (KndArrow (KndParens "1575" (KndTpArrow (TpVar "1576" "Indices") (Star "1586")) "1588") (KndTpArrow (TpVar "1591" "Indices") (Star "1601"))) "1603") (KndTpArrow (TpVar "1606" "Indices") (Star "1616"))) (TpLambda "1622" "1624" "F" (Tkk (KndArrow (KndParens "1628" (KndTpArrow (TpVar "1629" "Indices") (Star "1639")) "1641") (KndTpArrow (TpVar "1644" "Indices") (Star "1654")))) (TpLambda "1657" "1659" "indices" (Tkt (TpVar "1669" "Indices")) (Abs "1678" Erased "1680" "A" (Tkk (Star "1684")) (TpArrow (TpAppt (TpApp (TpApp (TpVar "1687" "AlgM") (TpVar "1694" "F")) (TpVar "1698" "A")) (Var "1700" "indices")) NotErased (TpVar "1710" "A")))))) "1712") (CmdsNext (DefTermOrType OpacTrans (DefTerm "1714" "foldM" (SomeType (Abs "1726" Erased "1728" "F" (Tkk (KndArrow (KndParens "1732" (KndTpArrow (TpVar "1733" "Indices") (Star "1743")) "1745") (KndTpArrow (TpVar "1748" "Indices") (Star "1758")))) (Abs "1761" Erased "1763" "A" (Tkk (Star "1767")) (Abs "1770" Erased "1772" "indices" (Tkt (TpVar "1782" "Indices")) (TpArrow (TpAppt (TpApp (TpApp (TpVar "1795" "AlgM") (TpVar "1802" "F")) (TpVar "1806" "A")) (Var "1808" "indices")) NotErased (TpArrow (TpAppt (TpApp (TpVar "1818" "FixM") (TpVar "1825" "F")) (Var "1827" "indices")) NotErased (TpVar "1837" "A"))))))) (Lam "1843" Erased "1845" "F" NoClass (Lam "1848" Erased "1850" "A" NoClass (Lam "1853" Erased "1855" "indices" NoClass (Lam "1864" NotErased "1866" "alg" NoClass (Lam "1871" NotErased "1873" "fix" NoClass (App (Var "1878" "fix") NotErased (Var "1882" "alg")))))))) "1886") (CmdsNext (DefTermOrType OpacTrans (DefTerm "1888" "inFixM" (SomeType (Abs "1901" Erased "1903" "F" (Tkk (KndArrow (KndParens "1907" (KndTpArrow (TpVar "1908" "Indices") (Star "1918")) "1920") (KndTpArrow (TpVar "1923" "Indices") (Star "1933")))) (Abs "1936" Erased "1938" "indices" (Tkt (TpVar "1948" "Indices")) (TpArrow (TpAppt (TpApp (TpVar "1961" "F") (TpParens "1965" (TpApp (TpVar "1966" "FixM") (TpVar "1973" "F")) "1975")) (Var "1976" "indices")) NotErased (TpAppt (TpApp (TpVar "1986" "FixM") (TpVar "1993" "F")) (Var "1995" "indices")))))) (Lam "2007" Erased "2009" "F" NoClass (Lam "2012" Erased "2014" "indices" NoClass (Lam "2023" NotErased "2025" "fexp" NoClass (Lam "2031" Erased "2033" "A" NoClass (Lam "2036" NotErased "2038" "alg" NoClass (App (App (Var "2043" "alg") NotErased (Parens "2047" (App (App (AppTp (AppTp (Var "2048" "foldM") (TpVar "2056" "F")) (TpVar "2060" "A")) Erased (Var "2063" "indices")) NotErased (Var "2071" "alg")) "2075")) NotErased (Var "2076" "fexp")))))))) "2081") (CmdsNext (DefTermOrType OpacTrans (DefType "2083" "PrfAlgM" (KndPi "2097" "2099" "F" (Tkk (KndArrow (KndParens "2103" (KndTpArrow (TpVar "2104" "Indices") (Star "2114")) "2116") (KndTpArrow (TpVar "2119" "Indices") (Star "2129")))) (KndTpArrow (TpApp (TpVar "2136" "Functor") (TpVar "2146" "F")) (KndPi "2154" "2156" "X" (Tkk (KndTpArrow (TpVar "2160" "Indices") (Star "2170"))) (KndArrow (KndParens "2177" (KndPi "2178" "2180" "indices" (Tkt (TpVar "2190" "Indices")) (KndTpArrow (TpAppt (TpVar "2199" "X") (Var "2201" "indices")) (Star "2211"))) "2213") (KndTpArrow (TpParens "2220" (Abs "2221" Erased "2223" "indices" (Tkt (TpVar "2233" "Indices")) (TpArrow (TpAppt (TpApp (TpVar "2242" "F") (TpVar "2246" "X")) (Var "2248" "indices")) NotErased (TpAppt (TpVar "2258" "X") (Var "2260" "indices")))) "2268") (Star "2275")))))) (TpLambda "2281" "2283" "F" (Tkk (KndArrow (KndParens "2287" (KndTpArrow (TpVar "2288" "Indices") (Star "2298")) "2300") (KndTpArrow (TpVar "2303" "Indices") (Star "2313")))) (TpLambda "2316" "2318" "fmap" (Tkt (TpApp (TpVar "2325" "Functor") (TpVar "2335" "F"))) (TpLambda "2338" "2340" "X" (Tkk (KndTpArrow (TpVar "2344" "Indices") (Star "2354"))) (TpLambda "2361" "2363" "Q" (Tkk (KndPi "2367" "2369" "indices" (Tkt (TpVar "2379" "Indices")) (KndTpArrow (TpAppt (TpVar "2388" "X") (Var "2390" "indices")) (Star "2400")))) (TpLambda "2409" "2411" "alg" (Tkt (TpParens "2417" (Abs "2418" Erased "2420" "indices" (Tkt (TpVar "2430" "Indices")) (TpArrow (TpAppt (TpApp (TpVar "2439" "F") (TpVar "2443" "X")) (Var "2445" "indices")) NotErased (TpAppt (TpVar "2455" "X") (Var "2457" "indices")))) "2465")) (Abs "2476" Erased "2478" "R" (Tkk (KndTpArrow (TpVar "2482" "Indices") (Star "2492"))) (Abs "2495" Erased "2497" "c" (Tkt (TpApp (TpApp (TpVar "2501" "Cast") (TpVar "2508" "R")) (TpVar "2512" "X"))) (TpArrow (TpParens "2524" (Abs "2525" Erased "2527" "indices" (Tkt (TpVar "2537" "Indices")) (Abs "2546" NotErased "2548" "r" (Tkt (TpAppt (TpVar "2552" "R") (Var "2554" "indices"))) (TpAppt (TpAppt (TpVar "2563" "Q") (Var "2565" "indices")) (Parens "2573" (App (App (App (Var "2574" "cast") Erased (Var "2580" "c")) Erased (Var "2583" "indices")) NotErased (Var "2591" "r")) "2593")))) "2594") NotErased (Abs "2605" Erased "2607" "indices" (Tkt (TpVar "2617" "Indices")) (Abs "2626" NotErased "2628" "gr" (Tkt (TpAppt (TpApp (TpVar "2633" "F") (TpVar "2637" "R")) (Var "2639" "indices"))) (TpAppt (TpAppt (TpVar "2656" "Q") (Var "2658" "indices")) (Parens "2666" (App (App (Var "2667" "alg") Erased (Var "2672" "indices")) NotErased (Parens "2680" (App (App (App (Var "2681" "cast") Erased (Parens "2687" (App (Var "2688" "fmap") Erased (Var "2694" "c")) "2696")) Erased (Var "2698" "indices")) NotErased (Var "2706" "gr")) "2709")) "2710"))))))))))))) "2711") (CmdsNext (DefTermOrType OpacTrans (DefType "2713" "IsIndFixM" (KndPi "2729" "2731" "F" (Tkk (KndArrow (KndParens "2735" (KndTpArrow (TpVar "2736" "Indices") (Star "2746")) "2748") (KndTpArrow (TpVar "2751" "Indices") (Star "2761")))) (KndTpArrow (TpApp (TpVar "2768" "Functor") (TpVar "2778" "F")) (KndPi "2786" "2788" "indices" (Tkt (TpVar "2798" "Indices")) (KndTpArrow (TpAppt (TpApp (TpVar "2811" "FixM") (TpVar "2818" "F")) (Var "2820" "indices")) (Star "2834"))))) (TpLambda "2840" "2842" "F" (Tkk (KndArrow (KndParens "2846" (KndTpArrow (TpVar "2847" "Indices") (Star "2857")) "2859") (KndTpArrow (TpVar "2862" "Indices") (Star "2872")))) (TpLambda "2875" "2877" "fmap" (Tkt (TpApp (TpVar "2884" "Functor") (TpVar "2894" "F"))) (TpLambda "2901" "2903" "indices" (Tkt (TpVar "2913" "Indices")) (TpLambda "2922" "2924" "x" (Tkt (TpAppt (TpApp (TpVar "2928" "FixM") (TpVar "2935" "F")) (Var "2937" "indices"))) (Abs "2952" Erased "2954" "Q" (Tkk (KndPi "2958" "2960" "indices" (Tkt (TpVar "2970" "Indices")) (KndTpArrow (TpAppt (TpApp (TpVar "2979" "FixM") (TpVar "2986" "F")) (Var "2988" "indices")) (Star "2998")))) (TpArrow (TpAppt (TpApp (TpApp (TpAppt (TpApp (TpVar "3007" "PrfAlgM") (TpVar "3017" "F")) (Var "3019" "fmap")) (TpParens "3026" (TpApp (TpVar "3027" "FixM") (TpVar "3034" "F")) "3036")) (TpVar "3039" "Q")) (Parens "3041" (AppTp (Var "3042" "inFixM") (TpVar "3051" "F")) "3053")) NotErased (TpAppt (TpAppt (TpVar "3056" "Q") (Var "3058" "indices")) (Var "3066" "x"))))))))) "3068") (CmdsNext (DefTermOrType OpacTrans (DefType "3070" "FixIndM" (KndPi "3080" "3082" "F" (Tkk (KndArrow (KndParens "3086" (KndTpArrow (TpVar "3087" "Indices") (Star "3097")) "3099") (KndTpArrow (TpVar "3102" "Indices") (Star "3112")))) (KndTpArrow (TpApp (TpVar "3115" "Functor") (TpVar "3125" "F")) (KndTpArrow (TpVar "3129" "Indices") (Star "3139")))) (TpLambda "3145" "3147" "F" (Tkk (KndArrow (KndParens "3151" (KndTpArrow (TpVar "3152" "Indices") (Star "3162")) "3164") (KndTpArrow (TpVar "3167" "Indices") (Star "3177")))) (TpLambda "3180" "3182" "fmap" (Tkt (TpApp (TpVar "3189" "Functor") (TpVar "3199" "F"))) (TpLambda "3202" "3204" "indices" (Tkt (TpVar "3214" "Indices")) (Iota "3227" "3229" "x" (TpAppt (TpApp (TpVar "3233" "FixM") (TpVar "3240" "F")) (Var "3242" "indices")) (TpAppt (TpAppt (TpAppt (TpApp (TpVar "3251" "IsIndFixM") (TpVar "3263" "F")) (Var "3265" "fmap")) (Var "3270" "indices")) (Var "3278" "x"))))))) "3280") (CmdsNext (DefTermOrType OpacTrans (DefTerm "3282" "inFixIndM" (SomeType (Abs "3294" Erased "3296" "F" (Tkk (KndArrow (KndParens "3300" (KndTpArrow (TpVar "3301" "Indices") (Star "3311")) "3313") (KndTpArrow (TpVar "3316" "Indices") (Star "3326")))) (Abs "3329" Erased "3331" "fmap" (Tkt (TpApp (TpVar "3338" "Functor") (TpVar "3348" "F"))) (Abs "3355" Erased "3357" "indices" (Tkt (TpVar "3367" "Indices")) (TpArrow (TpAppt (TpApp (TpVar "3376" "F") (TpParens "3380" (TpAppt (TpApp (TpVar "3381" "FixIndM") (TpVar "3391" "F")) (Var "3393" "fmap")) "3398")) (Var "3399" "indices")) NotErased (TpAppt (TpAppt (TpApp (TpVar "3409" "FixIndM") (TpVar "3419" "F")) (Var "3421" "fmap")) (Var "3426" "indices"))))))) (Lam "3438" Erased "3440" "F" NoClass (Lam "3443" Erased "3445" "fmap" NoClass (Lam "3451" Erased "3453" "indices" NoClass (Lam "3462" NotErased "3464" "v" NoClass (Let "3471" (DefTerm "3472" "outInd" (SomeType (TpApp (TpApp (TpVar "3481" "Cast") (TpParens "3488" (TpAppt (TpApp (TpVar "3489" "FixIndM") (TpVar "3499" "F")) (Var "3501" "fmap")) "3506")) (TpParens "3509" (TpApp (TpVar "3510" "FixM") (TpVar "3517" "F")) "3519"))) (IotaPair "3522" (Lam "3523" Erased "3525" "indices" NoClass (Lam "3534" NotErased "3536" "x" NoClass (IotaProj (Var "3539" "x") "1" "3542"))) (Beta "3544" NoTerm NoTerm) NoGuide "3546")) (IotaPair "3554" (App (App (AppTp (Var "3555" "inFixM") (TpVar "3564" "F")) Erased (Var "3567" "indices")) NotErased (Parens "3575" (App (App (App (Var "3576" "cast") Erased (Parens "3582" (App (Var "3583" "fmap") Erased (Var "3589" "outInd")) "3596")) Erased (Var "3598" "indices")) NotErased (Var "3606" "v")) "3608")) (Lam "3615" Erased "3617" "Q" NoClass (Lam "3620" NotErased "3622" "q" NoClass (App (App (App (App (Var "3625" "q") Erased (Var "3628" "outInd")) NotErased (Parens "3635" (Lam "3636" Erased "3638" "indices" NoClass (Lam "3647" NotErased "3649" "r" NoClass (App (IotaProj (Var "3652" "r") "2" "3655") NotErased (Var "3656" "q")))) "3658")) Erased (Var "3660" "indices")) NotErased (Var "3668" "v")))) NoGuide "3671"))))))) "3672") (CmdsNext (DefTermOrType OpacTrans (DefType "3674" "WithWitness" (KndPi "3688" "3690" "X" (Tkk (Star "3694")) (KndPi "3697" "3699" "Y" (Tkk (Star "3703")) (KndArrow (KndParens "3706" (KndTpArrow (TpVar "3707" "X") (Star "3711")) "3713") (KndTpArrow (TpVar "3716" "Y") (Star "3720"))))) (TpLambda "3726" "3728" "X" (Tkk (Star "3732")) (TpLambda "3735" "3737" "Y" (Tkk (Star "3741")) (TpLambda "3744" "3746" "Q" (Tkk (KndTpArrow (TpVar "3750" "X") (Star "3754"))) (TpLambda "3757" "3759" "y" (Tkt (TpVar "3763" "Y")) (TpApp (TpApp (TpVar "3770" "Sigma") (TpParens "3778" (Iota "3779" "3781" "x" (TpVar "3785" "X") (TpEq "3788" (Var "3789" "y") (Var "3793" "x") "3795")) "3796")) (TpParens "3799" (TpLambda "3800" "3802" "x" (Tkt (TpParens "3806" (Iota "3807" "3809" "x" (TpVar "3813" "X") (TpEq "3816" (Var "3817" "y") (Var "3821" "x") "3823")) "3824")) (TpAppt (TpVar "3826" "Q") (IotaProj (Var "3828" "x") "1" "3831"))) "3832"))))))) "3833") (CmdsNext (DefTermOrType OpacTrans (DefType "3835" "Lift" (KndPi "3846" "3848" "F" (Tkk (KndArrow (KndParens "3852" (KndTpArrow (TpVar "3853" "Indices") (Star "3863")) "3865") (KndTpArrow (TpVar "3868" "Indices") (Star "3878")))) (KndPi "3881" "3883" "fmap" (Tkt (TpApp (TpVar "3890" "Functor") (TpVar "3900" "F"))) (KndArrow (KndParens "3907" (KndPi "3908" "3910" "indices" (Tkt (TpVar "3920" "Indices")) (KndTpArrow (TpAppt (TpAppt (TpApp (TpVar "3929" "FixIndM") (TpVar "3939" "F")) (Var "3941" "fmap")) (Var "3946" "indices")) (Star "3956"))) "3958") (KndPi "3965" "3967" "indices" (Tkt (TpVar "3977" "Indices")) (KndTpArrow (TpAppt (TpApp (TpVar "3986" "FixM") (TpVar "3993" "F")) (Var "3995" "indices")) (Star "4009")))))) (TpLambda "4015" "4017" "F" (Tkk (KndArrow (KndParens "4021" (KndTpArrow (TpVar "4022" "Indices") (Star "4032")) "4034") (KndTpArrow (TpVar "4037" "Indices") (Star "4047")))) (TpLambda "4050" "4052" "fmap" (Tkt (TpApp (TpVar "4059" "Functor") (TpVar "4069" "F"))) (TpLambda "4076" "4078" "Q" (Tkk (KndPi "4082" "4084" "indices" (Tkt (TpVar "4094" "Indices")) (KndTpArrow (TpAppt (TpAppt (TpApp (TpVar "4103" "FixIndM") (TpVar "4113" "F")) (Var "4115" "fmap")) (Var "4120" "indices")) (Star "4130")))) (TpLambda "4139" "4141" "indices" (Tkt (TpVar "4151" "Indices")) (TpLambda "4160" "4162" "e" (Tkt (TpAppt (TpApp (TpVar "4166" "FixM") (TpVar "4173" "F")) (Var "4175" "indices"))) (TpAppt (TpApp (TpApp (TpApp (TpVar "4192" "WithWitness") (TpParens "4206" (TpAppt (TpAppt (TpApp (TpVar "4207" "FixIndM") (TpVar "4217" "F")) (Var "4219" "fmap")) (Var "4224" "indices")) "4232")) (TpParens "4235" (TpAppt (TpApp (TpVar "4236" "FixM") (TpVar "4243" "F")) (Var "4245" "indices")) "4253")) (TpParens "4256" (TpAppt (TpVar "4257" "Q") (Var "4259" "indices")) "4267")) (Var "4268" "e")))))))) "4270") (CmdsNext (DefTermOrType OpacTrans (DefTerm "4272" "LiftProp1" (SomeType (Abs "4288" Erased "4290" "F" (Tkk (KndArrow (KndParens "4294" (KndTpArrow (TpVar "4295" "Indices") (Star "4305")) "4307") (KndTpArrow (TpVar "4310" "Indices") (Star "4320")))) (Abs "4323" Erased "4325" "fmap" (Tkt (TpApp (TpVar "4332" "Functor") (TpVar "4342" "F"))) (Abs "4349" Erased "4351" "Q" (Tkk (KndPi "4355" "4357" "indices" (Tkt (TpVar "4367" "Indices")) (KndTpArrow (TpAppt (TpAppt (TpApp (TpVar "4376" "FixIndM") (TpVar "4386" "F")) (Var "4388" "fmap")) (Var "4393" "indices")) (Star "4403")))) (Abs "4410" Erased "4412" "indices" (Tkt (TpVar "4422" "Indices")) (Abs "4431" Erased "4433" "e" (Tkt (TpAppt (TpAppt (TpApp (TpVar "4437" "FixIndM") (TpVar "4447" "F")) (Var "4449" "fmap")) (Var "4454" "indices"))) (TpArrow (TpAppt (TpAppt (TpApp (TpAppt (TpApp (TpVar "4467" "Lift") (TpVar "4474" "F")) (Var "4476" "fmap")) (TpVar "4483" "Q")) (Var "4485" "indices")) (IotaProj (Var "4493" "e") "1" "4496")) NotErased (TpAppt (TpAppt (TpVar "4499" "Q") (Var "4501" "indices")) (Var "4509" "e"))))))))) (Lam "4515" Erased "4517" "F" NoClass (Lam "4520" Erased "4522" "fmap" NoClass (Lam "4528" Erased "4530" "Q" NoClass (Lam "4533" Erased "4535" "indices" NoClass (Lam "4544" Erased "4546" "e" NoClass (Lam "4549" NotErased "4551" "pr" NoClass (Rho "4555" RhoPlain NoNums (IotaProj (Parens "4557" (App (Var "4558" "fst") NotErased (Var "4562" "pr")) "4565") "2" "4567") NoGuide (App (Var "4570" "snd") NotErased (Var "4574" "pr")))))))))) "4577") (CmdsNext (DefTermOrType OpacTrans (DefTerm "4579" "LiftProp2" (SomeType (Abs "4595" Erased "4597" "F" (Tkk (KndArrow (KndParens "4601" (KndTpArrow (TpVar "4602" "Indices") (Star "4612")) "4614") (KndTpArrow (TpVar "4617" "Indices") (Star "4627")))) (Abs "4630" Erased "4632" "fmap" (Tkt (TpApp (TpVar "4639" "Functor") (TpVar "4649" "F"))) (Abs "4656" Erased "4658" "Q" (Tkk (KndPi "4662" "4664" "indices" (Tkt (TpVar "4674" "Indices")) (KndTpArrow (TpAppt (TpAppt (TpApp (TpVar "4683" "FixIndM") (TpVar "4693" "F")) (Var "4695" "fmap")) (Var "4700" "indices")) (Star "4710")))) (Abs "4717" Erased "4719" "indices" (Tkt (TpVar "4729" "Indices")) (Abs "4738" NotErased "4740" "e" (Tkt (TpAppt (TpAppt (TpApp (TpVar "4744" "FixIndM") (TpVar "4754" "F")) (Var "4756" "fmap")) (Var "4761" "indices"))) (TpArrow (TpAppt (TpAppt (TpVar "4774" "Q") (Var "4776" "indices")) (Var "4784" "e")) NotErased (TpAppt (TpAppt (TpApp (TpAppt (TpApp (TpVar "4788" "Lift") (TpVar "4795" "F")) (Var "4797" "fmap")) (TpVar "4804" "Q")) (Var "4806" "indices")) (IotaProj (Var "4814" "e") "1" "4817"))))))))) (Lam "4822" Erased "4824" "F" NoClass (Lam "4827" Erased "4829" "fmap" NoClass (Lam "4835" Erased "4837" "Q" NoClass (Lam "4840" Erased "4842" "indices" NoClass (Lam "4851" NotErased "4853" "e" NoClass (App (AppTp (AppTp (Var "4856" "sigma") (TpParens "4868" (Iota "4869" "4871" "x" (TpAppt (TpAppt (TpApp (TpVar "4875" "FixIndM") (TpVar "4885" "F")) (Var "4887" "fmap")) (Var "4892" "indices")) (TpEq "4901" (Var "4902" "e") (Var "4906" "x") "4908")) "4909")) (TpParens "4916" (TpLambda "4917" "4919" "x" (Tkt (Iota "4923" "4925" "x" (TpAppt (TpAppt (TpApp (TpVar "4929" "FixIndM") (TpVar "4939" "F")) (Var "4941" "fmap")) (Var "4946" "indices")) (TpEq "4955" (Var "4956" "e") (Var "4960" "x") "4962"))) (TpAppt (TpAppt (TpVar "4964" "Q") (Var "4966" "indices")) (IotaProj (Var "4974" "x") "1" "4977"))) "4978")) NotErased (IotaPair "4983" (Var "4984" "e") (Beta "4987" NoTerm (SomeTerm (Var "4989" "e") "4991")) NoGuide "4992")))))))) "4993") (CmdsNext (DefTermOrType OpacTrans (DefTerm "4995" "LiftProp3" (SomeType (Abs "5011" Erased "5013" "F" (Tkk (KndArrow (KndParens "5017" (KndTpArrow (TpVar "5018" "Indices") (Star "5028")) "5030") (KndTpArrow (TpVar "5033" "Indices") (Star "5043")))) (Abs "5046" Erased "5048" "fmap" (Tkt (TpApp (TpVar "5055" "Functor") (TpVar "5065" "F"))) (Abs "5072" Erased "5074" "Q" (Tkk (KndPi "5078" "5080" "indices" (Tkt (TpVar "5090" "Indices")) (KndTpArrow (TpAppt (TpAppt (TpApp (TpVar "5099" "FixIndM") (TpVar "5109" "F")) (Var "5111" "fmap")) (Var "5116" "indices")) (Star "5126")))) (Abs "5133" Erased "5135" "indices" (Tkt (TpVar "5145" "Indices")) (Abs "5154" Erased "5156" "e" (Tkt (TpAppt (TpApp (TpVar "5160" "FixM") (TpVar "5167" "F")) (Var "5169" "indices"))) (TpArrow (TpAppt (TpAppt (TpApp (TpAppt (TpApp (TpVar "5182" "Lift") (TpVar "5189" "F")) (Var "5191" "fmap")) (TpVar "5198" "Q")) (Var "5200" "indices")) (Var "5208" "e")) NotErased (TpAppt (TpAppt (TpApp (TpVar "5212" "FixIndM") (TpVar "5222" "F")) (Var "5224" "fmap")) (Var "5229" "indices"))))))))) (Lam "5241" Erased "5243" "F" NoClass (Lam "5246" Erased "5248" "fmap" NoClass (Lam "5254" Erased "5256" "Q" NoClass (Lam "5259" Erased "5261" "indices" NoClass (Lam "5270" Erased "5272" "e" NoClass (Lam "5275" NotErased "5277" "pr" NoClass (IotaProj (Parens "5281" (App (Var "5282" "fst") NotErased (Var "5286" "pr")) "5289") "1" "5291")))))))) "5292") (CmdsNext (DefTermOrType OpacTrans (DefTerm "5294" "LiftProp4" (SomeType (Abs "5310" Erased "5312" "F" (Tkk (KndArrow (KndParens "5316" (KndTpArrow (TpVar "5317" "Indices") (Star "5327")) "5329") (KndTpArrow (TpVar "5332" "Indices") (Star "5342")))) (Abs "5345" Erased "5347" "fmap" (Tkt (TpApp (TpVar "5354" "Functor") (TpVar "5364" "F"))) (Abs "5371" Erased "5373" "Q" (Tkk (KndPi "5377" "5379" "indices" (Tkt (TpVar "5389" "Indices")) (KndTpArrow (TpAppt (TpAppt (TpApp (TpVar "5398" "FixIndM") (TpVar "5408" "F")) (Var "5410" "fmap")) (Var "5415" "indices")) (Star "5425")))) (Abs "5432" Erased "5434" "indices" (Tkt (TpVar "5444" "Indices")) (Abs "5453" Erased "5455" "e" (Tkt (TpAppt (TpApp (TpVar "5459" "FixM") (TpVar "5466" "F")) (Var "5468" "indices"))) (Abs "5481" Erased "5483" "p" (Tkt (TpAppt (TpAppt (TpApp (TpAppt (TpApp (TpVar "5487" "Lift") (TpVar "5494" "F")) (Var "5496" "fmap")) (TpVar "5503" "Q")) (Var "5505" "indices")) (Var "5513" "e"))) (TpEq "5516" (App (Var "5517" "LiftProp3") NotErased (Var "5527" "p")) (Var "5531" "e") "5533")))))))) (Lam "5538" Erased "5540" "F" NoClass (Lam "5543" Erased "5545" "fmap" NoClass (Lam "5551" Erased "5553" "Q" NoClass (Lam "5556" Erased "5558" "indices" NoClass (Lam "5567" Erased "5569" "e" NoClass (Lam "5572" Erased "5574" "pr" NoClass (Rho "5578" RhoPlain NoNums (IotaProj (Parens "5580" (App (Var "5581" "fst") NotErased (Var "5585" "pr")) "5588") "2" "5590") NoGuide (Beta "5593" NoTerm NoTerm))))))))) "5595") (CmdsNext (DefTermOrType OpacTrans (DefTerm "5597" "convIH" (SomeType (Abs "5607" Erased "5609" "F" (Tkk (KndArrow (KndParens "5613" (KndTpArrow (TpVar "5614" "Indices") (Star "5624")) "5626") (KndTpArrow (TpVar "5629" "Indices") (Star "5639")))) (Abs "5642" Erased "5644" "fmap" (Tkt (TpApp (TpVar "5651" "Functor") (TpVar "5661" "F"))) (Abs "5665" Erased "5667" "Q" (Tkk (KndPi "5671" "5673" "indices" (Tkt (TpVar "5683" "Indices")) (KndTpArrow (TpAppt (TpAppt (TpApp (TpVar "5692" "FixIndM") (TpVar "5702" "F")) (Var "5704" "fmap")) (Var "5709" "indices")) (Star "5719")))) (Abs "5723" Erased "5725" "Y" (Tkk (KndPi "5729" "5731" "indices" (Tkt (TpVar "5741" "Indices")) (KndTpArrow (TpAppt (TpApp (TpVar "5750" "FixM") (TpVar "5757" "F")) (Var "5759" "indices")) (Star "5769")))) (Abs "5773" NotErased "5775" "Yprop1" (Tkt (Abs "5784" Erased "5786" "indices" (Tkt (TpVar "5796" "Indices")) (Abs "5805" Erased "5807" "e" (Tkt (TpAppt (TpAppt (TpApp (TpVar "5811" "FixIndM") (TpVar "5821" "F")) (Var "5823" "fmap")) (Var "5828" "indices"))) (TpArrow (TpAppt (TpAppt (TpVar "5837" "Y") (Var "5839" "indices")) (IotaProj (Var "5847" "e") "1" "5850")) NotErased (TpAppt (TpAppt (TpVar "5853" "Q") (Var "5855" "indices")) (Var "5863" "e")))))) (Abs "5867" NotErased "5869" "Yprop2" (Tkt (Abs "5878" Erased "5880" "indices" (Tkt (TpVar "5890" "Indices")) (Abs "5899" NotErased "5901" "e" (Tkt (TpAppt (TpAppt (TpApp (TpVar "5905" "FixIndM") (TpVar "5915" "F")) (Var "5917" "fmap")) (Var "5922" "indices"))) (TpArrow (TpAppt (TpAppt (TpVar "5931" "Q") (Var "5933" "indices")) (Var "5941" "e")) NotErased (TpAppt (TpAppt (TpVar "5945" "Y") (Var "5947" "indices")) (IotaProj (Var "5955" "e") "1" "5958")))))) (Abs "5961" NotErased "5963" "Yprop3" (Tkt (Abs "5972" Erased "5974" "indices" (Tkt (TpVar "5984" "Indices")) (Abs "5993" Erased "5995" "e" (Tkt (TpAppt (TpApp (TpVar "5999" "FixM") (TpVar "6006" "F")) (Var "6008" "indices"))) (TpArrow (TpAppt (TpAppt (TpVar "6017" "Y") (Var "6019" "indices")) (Var "6027" "e")) NotErased (TpAppt (TpAppt (TpApp (TpVar "6031" "FixIndM") (TpVar "6041" "F")) (Var "6043" "fmap")) (Var "6048" "indices")))))) (Abs "6058" NotErased "6060" "Yprop4" (Tkt (Abs "6069" Erased "6071" "indices" (Tkt (TpVar "6081" "Indices")) (Abs "6090" Erased "6092" "e" (Tkt (TpAppt (TpApp (TpVar "6096" "FixM") (TpVar "6103" "F")) (Var "6105" "indices"))) (Abs "6114" Erased "6116" "p" (Tkt (TpAppt (TpAppt (TpVar "6120" "Y") (Var "6122" "indices")) (Var "6130" "e"))) (TpEq "6133" (App (Var "6134" "Yprop3") NotErased (Var "6141" "p")) (Var "6145" "e") "6147"))))) (TpArrow (TpAppt (TpApp (TpApp (TpAppt (TpApp (TpVar "6150" "PrfAlgM") (TpVar "6160" "F")) (Var "6162" "fmap")) (TpParens "6169" (TpAppt (TpApp (TpVar "6170" "FixIndM") (TpVar "6180" "F")) (Var "6182" "fmap")) "6187")) (TpVar "6190" "Q")) (Parens "6192" (App (AppTp (Var "6193" "inFixIndM") (TpVar "6205" "F")) Erased (Var "6208" "fmap")) "6213")) NotErased (TpAppt (TpApp (TpApp (TpAppt (TpApp (TpVar "6217" "PrfAlgM") (TpVar "6227" "F")) (Var "6229" "fmap")) (TpParens "6236" (TpApp (TpVar "6237" "FixM") (TpVar "6244" "F")) "6246")) (TpVar "6249" "Y")) (Parens "6251" (AppTp (Var "6252" "inFixM") (TpVar "6261" "F")) "6263")))))))))))) (Lam "6268" Erased "6270" "F" NoClass (Lam "6273" Erased "6275" "fmap" NoClass (Lam "6281" Erased "6283" "Q" NoClass (Lam "6286" Erased "6288" "Y" NoClass (Lam "6291" NotErased "6293" "qp3" NoClass (Lam "6298" NotErased "6300" "qp4" NoClass (Lam "6305" NotErased "6307" "qp1" NoClass (Lam "6312" NotErased "6314" "qp2" NoClass (Lam "6319" NotErased "6321" "q" NoClass (Lam "6324" Erased "6326" "R" NoClass (Lam "6329" Erased "6331" "cst" NoClass (Lam "6336" NotErased "6338" "ih" NoClass (Lam "6342" Erased "6344" "indices" NoClass (Lam "6353" NotErased "6355" "gr" NoClass (Let "6363" (DefTerm "6364" "cst2" (SomeType (TpApp (TpApp (TpVar "6371" "Cast") (TpVar "6378" "R")) (TpParens "6382" (TpAppt (TpApp (TpVar "6383" "FixIndM") (TpVar "6393" "F")) (Var "6395" "fmap")) "6400"))) (IotaPair "6409" (Lam "6410" Erased "6412" "indices" NoClass (Lam "6421" NotErased "6423" "r" NoClass (Phi "6426" (Parens "6428" (App (App (App (Var "6429" "qp2") Erased (Var "6434" "indices")) Erased (Parens "6443" (App (App (App (Var "6444" "cast") Erased (Var "6450" "cst")) Erased (Var "6455" "indices")) NotErased (Var "6463" "r")) "6465")) Erased (Parens "6467" (App (App (Var "6468" "ih") Erased (Var "6472" "indices")) NotErased (Var "6480" "r")) "6482")) "6483") (Parens "6494" (App (App (App (Var "6495" "qp1") Erased (Var "6500" "indices")) Erased (Parens "6509" (App (App (App (Var "6510" "cast") Erased (Var "6516" "cst")) Erased (Var "6521" "indices")) NotErased (Var "6529" "r")) "6531")) NotErased (Parens "6532" (App (App (Var "6533" "ih") Erased (Var "6537" "indices")) NotErased (Var "6545" "r")) "6547")) "6548") (Var "6550" "r") "6552"))) (Beta "6554" NoTerm NoTerm) NoGuide "6556")) (App (App (App (Var "6564" "qp4") Erased (Var "6569" "indices")) NotErased (Parens "6577" (App (App (App (Var "6578" "inFixIndM") Erased (Var "6589" "fmap")) Erased (Var "6595" "indices")) NotErased (Parens "6603" (App (App (App (Var "6604" "cast") Erased (Parens "6610" (App (Var "6611" "fmap") Erased (Var "6617" "cst2")) "6622")) Erased (Var "6624" "indices")) NotErased (Var "6632" "gr")) "6635")) "6636")) NotErased (Parens "6643" (App (App (App (App (Var "6644" "q") Erased (Var "6647" "cst2")) NotErased (Parens "6652" (Lam "6653" Erased "6655" "indices" NoClass (Lam "6664" NotErased "6666" "r" NoClass (App (App (App (Var "6669" "qp3") Erased (Var "6674" "indices")) Erased (Parens "6683" (App (App (App (Var "6684" "cast") Erased (Var "6690" "cst2")) Erased (Var "6696" "indices")) NotErased (Var "6704" "r")) "6706")) NotErased (Parens "6707" (App (App (Var "6708" "ih") Erased (Var "6712" "indices")) NotErased (Var "6720" "r")) "6722")))) "6723")) Erased (Var "6733" "indices")) NotErased (Var "6741" "gr")) "6744")))))))))))))))))) "6745") (CmdsNext (DefTermOrType OpacTrans (DefTerm "6747" "indFixIndM" (SomeType (Abs "6760" Erased "6762" "F" (Tkk (KndArrow (KndParens "6766" (KndTpArrow (TpVar "6767" "Indices") (Star "6777")) "6779") (KndTpArrow (TpVar "6782" "Indices") (Star "6792")))) (Abs "6795" Erased "6797" "fmap" (Tkt (TpApp (TpVar "6804" "Functor") (TpVar "6814" "F"))) (Abs "6830" Erased "6832" "indices" (Tkt (TpVar "6842" "Indices")) (Abs "6851" NotErased "6853" "e" (Tkt (TpAppt (TpAppt (TpApp (TpVar "6857" "FixIndM") (TpVar "6867" "F")) (Var "6869" "fmap")) (Var "6874" "indices"))) (Abs "6896" Erased "6898" "Q" (Tkk (KndPi "6902" "6904" "indices" (Tkt (TpVar "6914" "Indices")) (KndTpArrow (TpAppt (TpAppt (TpApp (TpVar "6923" "FixIndM") (TpVar "6933" "F")) (Var "6935" "fmap")) (Var "6940" "indices")) (Star "6950")))) (TpArrow (TpAppt (TpApp (TpApp (TpAppt (TpApp (TpVar "6966" "PrfAlgM") (TpVar "6976" "F")) (Var "6978" "fmap")) (TpParens "6985" (TpAppt (TpApp (TpVar "6986" "FixIndM") (TpVar "6996" "F")) (Var "6998" "fmap")) "7003")) (TpVar "7006" "Q")) (Parens "7008" (App (AppTp (Var "7009" "inFixIndM") (TpVar "7021" "F")) Erased (Var "7024" "fmap")) "7029")) NotErased (TpAppt (TpAppt (TpVar "7045" "Q") (Var "7047" "indices")) (Var "7055" "e"))))))))) (Lam "7062" Erased "7064" "F" NoClass (Lam "7067" Erased "7069" "fmap" NoClass (Lam "7075" Erased "7077" "indices" NoClass (Lam "7086" NotErased "7088" "e" NoClass (Lam "7091" Erased "7093" "Q" NoClass (Lam "7096" NotErased "7098" "q" NoClass (App (App (App (AppTp (App (Var "7101" "LiftProp1") Erased (Var "7112" "fmap")) (TpVar "7119" "Q")) Erased (Var "7122" "indices")) Erased (Var "7131" "e")) NotErased (Parens "7137" (App (IotaProj (Var "7138" "e") "2" "7141") NotErased (Parens "7142" (App (App (App (App (App (App (Var "7143" "convIH") Erased (Var "7151" "fmap")) NotErased (Parens "7162" (AppTp (App (Var "7163" "LiftProp1") Erased (Var "7174" "fmap")) (TpVar "7181" "Q")) "7183")) NotErased (Parens "7190" (AppTp (App (Var "7191" "LiftProp2") Erased (Var "7202" "fmap")) (TpVar "7209" "Q")) "7211")) NotErased (Parens "7218" (AppTp (App (Var "7219" "LiftProp3") Erased (Var "7230" "fmap")) (TpVar "7237" "Q")) "7239")) NotErased (Parens "7246" (AppTp (App (Var "7247" "LiftProp4") Erased (Var "7258" "fmap")) (TpVar "7265" "Q")) "7267")) NotErased (Var "7274" "q")) "7276")) "7277"))))))))) "7278") (CmdsNext (DefTermOrType OpacTrans (DefTerm "7281" "outAlgM" (SomeType (Abs "7295" Erased "7297" "F" (Tkk (KndArrow (KndParens "7301" (KndTpArrow (TpVar "7302" "Indices") (Star "7312")) "7314") (KndTpArrow (TpVar "7317" "Indices") (Star "7327")))) (Abs "7330" Erased "7332" "fmap" (Tkt (TpApp (TpVar "7339" "Functor") (TpVar "7349" "F"))) (TpAppt (TpApp (TpApp (TpAppt (TpApp (TpVar "7352" "PrfAlgM") (TpVar "7362" "F")) (Var "7364" "fmap")) (TpParens "7377" (TpAppt (TpApp (TpVar "7378" "FixIndM") (TpVar "7388" "F")) (Var "7390" "fmap")) "7395")) (TpParens "7398" (TpLambda "7399" "7401" "indices" (Tkt (TpVar "7411" "Indices")) (TpLambda "7420" "7422" "_" (Tkt (TpAppt (TpAppt (TpApp (TpVar "7426" "FixIndM") (TpVar "7436" "F")) (Var "7438" "fmap")) (Var "7443" "indices"))) (TpAppt (TpApp (TpVar "7483" "F") (TpParens "7487" (TpAppt (TpApp (TpVar "7488" "FixIndM") (TpVar "7498" "F")) (Var "7500" "fmap")) "7505")) (Var "7506" "indices")))) "7514")) (Parens "7515" (App (AppTp (Var "7516" "inFixIndM") (TpVar "7528" "F")) Erased (Var "7531" "fmap")) "7536"))))) (Lam "7541" Erased "7543" "F" NoClass (Lam "7546" Erased "7548" "fmap" NoClass (Lam "7554" Erased "7556" "R" NoClass (Lam "7559" Erased "7561" "c" NoClass (Lam "7564" NotErased "7566" "x" NoClass (App (Var "7569" "cast") Erased (Parens "7575" (App (Var "7576" "fmap") Erased (Var "7582" "c")) "7584")))))))) "7585") (CmdsNext (DefTermOrType OpacTrans (DefTerm "7587" "outFixIndM" (SomeType (Abs "7604" Erased "7606" "F" (Tkk (KndArrow (KndParens "7610" (KndTpArrow (TpVar "7611" "Indices") (Star "7621")) "7623") (KndTpArrow (TpVar "7626" "Indices") (Star "7636")))) (Abs "7639" Erased "7641" "fmap" (Tkt (TpApp (TpVar "7648" "Functor") (TpVar "7658" "F"))) (Abs "7661" Erased "7663" "indices" (Tkt (TpVar "7673" "Indices")) (TpArrow (TpAppt (TpAppt (TpApp (TpVar "7686" "FixIndM") (TpVar "7696" "F")) (Var "7698" "fmap")) (Var "7703" "indices")) NotErased (TpAppt (TpApp (TpVar "7713" "F") (TpParens "7717" (TpAppt (TpApp (TpVar "7718" "FixIndM") (TpVar "7728" "F")) (Var "7730" "fmap")) "7735")) (Var "7736" "indices"))))))) (Lam "7748" Erased "7750" "F" NoClass (Lam "7753" Erased "7755" "fmap" NoClass (Lam "7761" Erased "7763" "indices" NoClass (Lam "7772" NotErased "7774" "e" NoClass (App (AppTp (App (App (App (Var "7777" "indFixIndM") Erased (Var "7789" "fmap")) Erased (Var "7795" "indices")) NotErased (Var "7803" "e")) (TpParens "7811" (TpLambda "7812" "7814" "indices" (Tkt (TpVar "7824" "Indices")) (TpLambda "7833" "7835" "_" (Tkt (TpAppt (TpAppt (TpApp (TpVar "7839" "FixIndM") (TpVar "7849" "F")) (Var "7851" "fmap")) (Var "7856" "indices"))) (TpAppt (TpApp (TpVar "7865" "F") (TpParens "7869" (TpAppt (TpApp (TpVar "7870" "FixIndM") (TpVar "7880" "F")) (Var "7882" "fmap")) "7887")) (Var "7888" "indices")))) "7896")) NotErased (Parens "7901" (App (AppTp (Var "7902" "outAlgM") (TpVar "7912" "F")) Erased (Var "7915" "fmap")) "7920"))))))) "7921") (CmdsNext (DefTermOrType OpacTrans (DefType "7924" "Cowedge" (KndArrow (KndParens "7934" (KndArrow (KndParens "7935" (KndTpArrow (TpVar "7936" "Indices") (Star "7946")) "7948") (KndTpArrow (TpVar "7951" "Indices") (Star "7961"))) "7963") (KndArrow (KndParens "7966" (KndTpArrow (TpVar "7967" "Indices") (Star "7977")) "7979") (KndTpArrow (TpVar "7982" "Indices") (Star "7992")))) (TpLambda "7998" "8000" "F" (Tkk (KndArrow (KndParens "8004" (KndTpArrow (TpVar "8005" "Indices") (Star "8015")) "8017") (KndTpArrow (TpVar "8020" "Indices") (Star "8030")))) (TpLambda "8033" "8035" "D" (Tkk (KndTpArrow (TpVar "8039" "Indices") (Star "8049"))) (TpLambda "8052" "8054" "indices" (Tkt (TpVar "8064" "Indices")) (Abs "8077" Erased "8079" "A" (Tkk (KndTpArrow (TpVar "8083" "Indices") (Star "8093"))) (TpArrow (TpParens "8100" (Abs "8101" Erased "8103" "indices" (Tkt (TpVar "8113" "Indices")) (TpArrow (TpAppt (TpVar "8122" "A") (Var "8124" "indices")) NotErased (TpAppt (TpVar "8134" "D") (Var "8136" "indices")))) "8144") NotErased (TpArrow (TpAppt (TpApp (TpVar "8151" "F") (TpVar "8155" "A")) (Var "8157" "indices")) NotErased (TpAppt (TpVar "8171" "D") (Var "8173" "indices"))))))))) "8181") (CmdsNext (DefTermOrType OpacTrans (DefType "8182" "Coend" (KndArrow (KndParens "8190" (KndArrow (KndParens "8191" (KndTpArrow (TpVar "8192" "Indices") (Star "8202")) "8204") (KndTpArrow (TpVar "8207" "Indices") (Star "8217"))) "8219") (KndArrow (KndParens "8222" (KndTpArrow (TpVar "8223" "Indices") (Star "8233")) "8235") (KndTpArrow (TpVar "8238" "Indices") (Star "8248")))) (TpLambda "8254" "8256" "F" (Tkk (KndArrow (KndParens "8260" (KndTpArrow (TpVar "8261" "Indices") (Star "8271")) "8273") (KndTpArrow (TpVar "8276" "Indices") (Star "8286")))) (TpLambda "8289" "8291" "A" (Tkk (KndTpArrow (TpVar "8295" "Indices") (Star "8305"))) (TpLambda "8308" "8310" "indices" (Tkt (TpVar "8320" "Indices")) (Abs "8333" Erased "8335" "Y" (Tkk (Star "8339")) (TpArrow (TpParens "8346" (Abs "8347" Erased "8349" "R" (Tkk (KndTpArrow (TpVar "8353" "Indices") (Star "8363"))) (TpArrow (TpParens "8366" (Abs "8367" Erased "8369" "indices" (Tkt (TpVar "8379" "Indices")) (TpArrow (TpAppt (TpVar "8388" "R") (Var "8390" "indices")) NotErased (TpAppt (TpVar "8400" "A") (Var "8402" "indices")))) "8410") NotErased (TpArrow (TpAppt (TpApp (TpVar "8413" "F") (TpVar "8417" "R")) (Var "8419" "indices")) NotErased (TpVar "8429" "Y")))) "8431") NotErased (TpVar "8438" "Y"))))))) "8440") (CmdsNext (DefTermOrType OpacTrans (DefTerm "8442" "intrCoend" (SomeType (Abs "8458" Erased "8460" "F" (Tkk (KndArrow (KndParens "8464" (KndTpArrow (TpVar "8465" "Indices") (Star "8475")) "8477") (KndTpArrow (TpVar "8480" "Indices") (Star "8490")))) (Abs "8497" Erased "8499" "C" (Tkk (KndTpArrow (TpVar "8503" "Indices") (Star "8513"))) (Abs "8520" Erased "8522" "R" (Tkk (KndTpArrow (TpVar "8526" "Indices") (Star "8536"))) (Abs "8543" Erased "8545" "indices" (Tkt (TpVar "8555" "Indices")) (TpArrow (TpParens "8568" (Abs "8569" Erased "8571" "indices" (Tkt (TpVar "8581" "Indices")) (TpArrow (TpAppt (TpVar "8590" "R") (Var "8592" "indices")) NotErased (TpAppt (TpVar "8602" "C") (Var "8604" "indices")))) "8612") NotErased (TpArrow (TpAppt (TpApp (TpVar "8619" "F") (TpVar "8623" "R")) (Var "8625" "indices")) NotErased (TpAppt (TpApp (TpApp (TpVar "8639" "Coend") (TpVar "8647" "F")) (TpVar "8651" "C")) (Var "8653" "indices"))))))))) (Lam "8665" Erased "8667" "F" NoClass (Lam "8670" Erased "8672" "C" NoClass (Lam "8675" Erased "8677" "R" NoClass (Lam "8680" Erased "8682" "indices" NoClass (Lam "8691" NotErased "8693" "ac" NoClass (Lam "8697" NotErased "8699" "ga" NoClass (Lam "8703" Erased "8705" "Y" NoClass (Lam "8708" NotErased "8710" "q" NoClass (App (App (Var "8713" "q") NotErased (Var "8715" "ac")) NotErased (Var "8718" "ga"))))))))))) "8721") (CmdsNext (DefTermOrType OpacTrans (DefTerm "8723" "elimCoend" (SomeType (Abs "8739" Erased "8741" "F" (Tkk (KndArrow (KndParens "8745" (KndTpArrow (TpVar "8746" "Indices") (Star "8756")) "8758") (KndTpArrow (TpVar "8761" "Indices") (Star "8771")))) (Abs "8778" Erased "8780" "A" (Tkk (KndTpArrow (TpVar "8784" "Indices") (Star "8794"))) (Abs "8801" Erased "8803" "D" (Tkk (Star "8807")) (Abs "8814" Erased "8816" "indices" (Tkt (TpVar "8826" "Indices")) (TpArrow (TpParens "8839" (Abs "8840" Erased "8842" "R" (Tkk (KndTpArrow (TpVar "8846" "Indices") (Star "8856"))) (TpArrow (TpParens "8859" (Abs "8860" Erased "8862" "indices" (Tkt (TpVar "8872" "Indices")) (TpArrow (TpAppt (TpVar "8881" "R") (Var "8883" "indices")) NotErased (TpAppt (TpVar "8893" "A") (Var "8895" "indices")))) "8903") NotErased (TpArrow (TpAppt (TpApp (TpVar "8906" "F") (TpVar "8910" "R")) (Var "8912" "indices")) NotErased (TpVar "8922" "D")))) "8924") NotErased (TpArrow (TpAppt (TpApp (TpApp (TpVar "8931" "Coend") (TpVar "8939" "F")) (TpVar "8943" "A")) (Var "8945" "indices")) NotErased (TpVar "8959" "D")))))))) (Lam "8965" Erased "8967" "F" NoClass (Lam "8970" Erased "8972" "A" NoClass (Lam "8975" Erased "8977" "D" NoClass (Lam "8980" Erased "8982" "indices" NoClass (Lam "8991" NotErased "8993" "phi" NoClass (Lam "8998" NotErased "9000" "e" NoClass (App (Var "9003" "e") NotErased (Var "9005" "phi"))))))))) "9009") (CmdsNext (DefTermOrType OpacTrans (DefType "9011" "CoendInductive" (KndPi "9032" "9034" "F" (Tkk (KndArrow (KndParens "9038" (KndTpArrow (TpVar "9039" "Indices") (Star "9049")) "9051") (KndTpArrow (TpVar "9054" "Indices") (Star "9064")))) (KndPi "9067" "9069" "C" (Tkk (KndTpArrow (TpVar "9073" "Indices") (Star "9083"))) (KndPi "9090" "9092" "indices" (Tkt (TpVar "9102" "Indices")) (KndTpArrow (TpAppt (TpApp (TpApp (TpVar "9111" "Coend") (TpVar "9119" "F")) (TpVar "9123" "C")) (Var "9125" "indices")) (Star "9135"))))) (TpLambda "9141" "9143" "F" (Tkk (KndArrow (KndParens "9147" (KndTpArrow (TpVar "9148" "Indices") (Star "9158")) "9160") (KndTpArrow (TpVar "9163" "Indices") (Star "9173")))) (TpLambda "9176" "9178" "C" (Tkk (KndTpArrow (TpVar "9182" "Indices") (Star "9192"))) (TpLambda "9199" "9201" "indices" (Tkt (TpVar "9211" "Indices")) (TpLambda "9220" "9222" "e" (Tkt (TpAppt (TpApp (TpApp (TpVar "9226" "Coend") (TpVar "9234" "F")) (TpVar "9238" "C")) (Var "9240" "indices"))) (Abs "9255" Erased "9257" "Q" (Tkk (KndPi "9261" "9263" "indices" (Tkt (TpVar "9273" "Indices")) (KndTpArrow (TpAppt (TpApp (TpApp (TpVar "9282" "Coend") (TpVar "9290" "F")) (TpVar "9294" "C")) (Var "9296" "indices")) (Star "9306")))) (TpArrow (TpParens "9315" (Abs "9316" Erased "9318" "R" (Tkk (KndTpArrow (TpVar "9322" "Indices") (Star "9332"))) (Abs "9335" Erased "9337" "indices" (Tkt (TpVar "9347" "Indices")) (Abs "9356" NotErased "9358" "c" (Tkt (TpApp (TpApp (TpVar "9362" "Cast") (TpVar "9369" "R")) (TpVar "9373" "C"))) (Abs "9384" NotErased "9386" "gr" (Tkt (TpAppt (TpApp (TpVar "9391" "F") (TpVar "9395" "R")) (Var "9397" "indices"))) (TpAppt (TpAppt (TpVar "9406" "Q") (Var "9408" "indices")) (Parens "9416" (App (App (App (AppTp (AppTp (AppTp (Var "9417" "intrCoend") (TpVar "9429" "F")) (TpVar "9433" "C")) (TpVar "9437" "R")) Erased (Var "9440" "indices")) NotErased (Parens "9448" (App (Var "9449" "cast") Erased (Var "9455" "c")) "9457")) NotErased (Var "9458" "gr")) "9461")))))) "9462") NotErased (TpAppt (TpAppt (TpVar "9471" "Q") (Var "9473" "indices")) (Var "9481" "e"))))))))) "9483") (CmdsNext (DefTermOrType OpacTrans (DefType "9485" "CoendInd" (KndArrow (KndParens "9496" (KndArrow (KndParens "9497" (KndTpArrow (TpVar "9498" "Indices") (Star "9508")) "9510") (KndTpArrow (TpVar "9513" "Indices") (Star "9523"))) "9525") (KndArrow (KndParens "9528" (KndTpArrow (TpVar "9529" "Indices") (Star "9539")) "9541") (KndTpArrow (TpVar "9544" "Indices") (Star "9554")))) (TpLambda "9560" "9562" "G" (Tkk (KndArrow (KndParens "9566" (KndTpArrow (TpVar "9567" "Indices") (Star "9577")) "9579") (KndTpArrow (TpVar "9582" "Indices") (Star "9592")))) (TpLambda "9595" "9597" "C" (Tkk (KndTpArrow (TpVar "9601" "Indices") (Star "9611"))) (TpLambda "9614" "9616" "indices" (Tkt (TpVar "9626" "Indices")) (Iota "9639" "9641" "x" (TpAppt (TpApp (TpApp (TpVar "9645" "Coend") (TpVar "9653" "G")) (TpVar "9657" "C")) (Var "9659" "indices")) (TpAppt (TpAppt (TpApp (TpApp (TpVar "9668" "CoendInductive") (TpVar "9686" "G")) (TpVar "9690" "C")) (Var "9692" "indices")) (Var "9700" "x"))))))) "9702") (CmdsNext (DefTermOrType OpacTrans (DefTerm "9705" "intrCoendInd" (SomeType (Abs "9724" Erased "9726" "F" (Tkk (KndArrow (KndParens "9730" (KndTpArrow (TpVar "9731" "Indices") (Star "9741")) "9743") (KndTpArrow (TpVar "9746" "Indices") (Star "9756")))) (Abs "9763" Erased "9765" "C" (Tkk (KndTpArrow (TpVar "9769" "Indices") (Star "9779"))) (Abs "9782" Erased "9784" "R" (Tkk (KndTpArrow (TpVar "9788" "Indices") (Star "9798"))) (Abs "9801" Erased "9803" "indices" (Tkt (TpVar "9813" "Indices")) (TpArrow (TpApp (TpApp (TpVar "9826" "Cast") (TpVar "9833" "R")) (TpVar "9837" "C")) Erased (TpArrow (TpAppt (TpApp (TpVar "9841" "F") (TpVar "9845" "R")) (Var "9847" "indices")) NotErased (TpAppt (TpApp (TpApp (TpVar "9857" "CoendInd") (TpVar "9868" "F")) (TpVar "9872" "C")) (Var "9874" "indices"))))))))) (Lam "9886" Erased "9888" "F" NoClass (Lam "9891" Erased "9893" "C" NoClass (Lam "9896" Erased "9898" "R" NoClass (Lam "9901" Erased "9903" "indices" NoClass (Lam "9912" Erased "9914" "f" NoClass (Lam "9917" NotErased "9919" "gr" NoClass (IotaPair "9927" (App (App (App (AppTp (AppTp (AppTp (Var "9928" "intrCoend") (TpVar "9940" "F")) (TpVar "9944" "C")) (TpVar "9948" "R")) Erased (Var "9951" "indices")) NotErased (Parens "9959" (App (Var "9960" "cast") Erased (Var "9966" "f")) "9968")) NotErased (Var "9969" "gr")) (Lam "9973" Erased "9975" "Q" NoClass (Lam "9978" NotErased "9980" "q" NoClass (App (App (App (AppTp (Var "9983" "q") (TpVar "9987" "R")) Erased (Var "9990" "indices")) NotErased (IotaPair "9998" (App (Var "9999" "cast") Erased (Var "10005" "f")) (Beta "10008" NoTerm NoTerm) NoGuide "10010")) NotErased (Var "10011" "gr")))) NoGuide "10014")))))))) "10015") (CmdsNext (DefTermOrType OpacTrans (DefTerm "10018" "indCoend'" (SomeType (Abs "10034" Erased "10036" "F" (Tkk (KndArrow (KndParens "10040" (KndTpArrow (TpVar "10041" "Indices") (Star "10051")) "10053") (KndTpArrow (TpVar "10056" "Indices") (Star "10066")))) (Abs "10069" Erased "10071" "C" (Tkk (KndTpArrow (TpVar "10075" "Indices") (Star "10085"))) (Abs "10088" Erased "10090" "indices" (Tkt (TpVar "10100" "Indices")) (Abs "10113" NotErased "10115" "e" (Tkt (TpAppt (TpApp (TpApp (TpVar "10119" "CoendInd") (TpVar "10130" "F")) (TpVar "10134" "C")) (Var "10136" "indices"))) (Abs "10149" Erased "10151" "Q" (Tkk (KndPi "10155" "10157" "indices" (Tkt (TpVar "10167" "Indices")) (KndTpArrow (TpAppt (TpApp (TpApp (TpVar "10176" "CoendInd") (TpVar "10187" "F")) (TpVar "10191" "C")) (Var "10193" "indices")) (Star "10203")))) (TpArrow (TpParens "10210" (Abs "10211" Erased "10213" "R" (Tkk (KndTpArrow (TpVar "10217" "Indices") (Star "10227"))) (Abs "10230" Erased "10232" "indices" (Tkt (TpVar "10242" "Indices")) (Abs "10251" Erased "10253" "c" (Tkt (TpApp (TpApp (TpVar "10257" "Cast") (TpVar "10264" "R")) (TpVar "10268" "C"))) (Abs "10277" NotErased "10279" "gr" (Tkt (TpAppt (TpApp (TpVar "10284" "F") (TpVar "10288" "R")) (Var "10290" "indices"))) (TpAppt (TpAppt (TpVar "10299" "Q") (Var "10301" "indices")) (Parens "10309" (App (App (App (AppTp (AppTp (AppTp (Var "10310" "intrCoendInd") (TpVar "10325" "F")) (TpVar "10329" "C")) (TpVar "10333" "R")) Erased (Var "10336" "indices")) Erased (Var "10345" "c")) NotErased (Var "10347" "gr")) "10350")))))) "10351") NotErased (Abs "10358" Erased "10360" "X" (Tkk (KndPi "10364" "10366" "indices" (Tkt (TpVar "10376" "Indices")) (KndTpArrow (TpAppt (TpApp (TpApp (TpVar "10385" "CoendInd") (TpVar "10396" "F")) (TpVar "10400" "C")) (Var "10402" "indices")) (Star "10412")))) (TpArrow (TpParens "10419" (Abs "10420" Erased "10422" "indices" (Tkt (TpVar "10432" "Indices")) (Abs "10441" Erased "10443" "x'" (Tkt (TpAppt (TpApp (TpApp (TpVar "10448" "CoendInd") (TpVar "10459" "F")) (TpVar "10463" "C")) (Var "10465" "indices"))) (TpArrow (TpAppt (TpAppt (TpVar "10474" "Q") (Var "10476" "indices")) (Var "10484" "x'")) NotErased (TpAppt (TpAppt (TpVar "10489" "X") (Var "10491" "indices")) (Var "10499" "x'"))))) "10502") NotErased (TpAppt (TpAppt (TpVar "10509" "X") (Var "10511" "indices")) (Var "10519" "e"))))))))))) (Lam "10525" Erased "10527" "F" NoClass (Lam "10530" Erased "10532" "C" NoClass (Lam "10535" Erased "10537" "indices" NoClass (Lam "10546" NotErased "10548" "e" NoClass (Lam "10551" Erased "10553" "Q" NoClass (Lam "10556" NotErased "10558" "q" NoClass (Theta "10561" (AbstractVars (VarsNext "indices" (VarsStart "e"))) (IotaProj (Var "10574" "e") "2" "10577") (LtermsCons NotErased (Parens "10582" (Lam "10583" Erased "10585" "R" NoClass (Lam "10588" Erased "10590" "indices" NoClass (Lam "10599" NotErased "10601" "ar" NoClass (Lam "10605" NotErased "10607" "gr" NoClass (Lam "10611" Erased "10613" "X" NoClass (Lam "10616" NotErased "10618" "qq" NoClass (App (App (App (Var "10622" "qq") Erased (Var "10626" "indices")) Erased (Parens "10641" (App (App (App (AppTp (AppTp (AppTp (Var "10642" "intrCoendInd") (TpVar "10657" "F")) (TpVar "10661" "C")) (TpVar "10665" "R")) Erased (Var "10668" "indices")) Erased (Var "10677" "ar")) NotErased (Var "10680" "gr")) "10683")) NotErased (Parens "10684" (App (App (App (AppTp (Var "10685" "q") (TpVar "10689" "R")) Erased (Var "10692" "indices")) Erased (Var "10701" "ar")) NotErased (Var "10704" "gr")) "10707")))))))) "10708") (LtermsNil "10707")))))))))) "10709") (CmdsNext (DefTermOrType OpacTrans (DefTerm "10712" "indCoend" (SomeType (Abs "10727" Erased "10729" "F" (Tkk (KndArrow (KndParens "10733" (KndTpArrow (TpVar "10734" "Indices") (Star "10744")) "10746") (KndTpArrow (TpVar "10749" "Indices") (Star "10759")))) (Abs "10762" Erased "10764" "C" (Tkk (KndTpArrow (TpVar "10768" "Indices") (Star "10778"))) (Abs "10781" Erased "10783" "indices" (Tkt (TpVar "10793" "Indices")) (Abs "10806" NotErased "10808" "e" (Tkt (TpAppt (TpApp (TpApp (TpVar "10812" "CoendInd") (TpVar "10823" "F")) (TpVar "10827" "C")) (Var "10829" "indices"))) (Abs "10842" Erased "10844" "Q" (Tkk (KndPi "10848" "10850" "indices" (Tkt (TpVar "10860" "Indices")) (KndTpArrow (TpAppt (TpApp (TpApp (TpVar "10869" "CoendInd") (TpVar "10880" "F")) (TpVar "10884" "C")) (Var "10886" "indices")) (Star "10896")))) (TpArrow (TpParens "10903" (Abs "10904" Erased "10906" "R" (Tkk (KndTpArrow (TpVar "10910" "Indices") (Star "10920"))) (Abs "10923" Erased "10925" "indices" (Tkt (TpVar "10935" "Indices")) (Abs "10944" Erased "10946" "c" (Tkt (TpApp (TpApp (TpVar "10950" "Cast") (TpVar "10957" "R")) (TpVar "10961" "C"))) (Abs "10970" NotErased "10972" "gr" (Tkt (TpAppt (TpApp (TpVar "10977" "F") (TpVar "10981" "R")) (Var "10983" "indices"))) (TpAppt (TpAppt (TpVar "10992" "Q") (Var "10994" "indices")) (Parens "11002" (App (App (App (AppTp (AppTp (AppTp (Var "11003" "intrCoendInd") (TpVar "11018" "F")) (TpVar "11022" "C")) (TpVar "11026" "R")) Erased (Var "11029" "indices")) Erased (Var "11038" "c")) NotErased (Var "11040" "gr")) "11043")))))) "11044") NotErased (TpAppt (TpAppt (TpVar "11051" "Q") (Var "11053" "indices")) (Var "11061" "e"))))))))) (Lam "11067" Erased "11069" "F" NoClass (Lam "11072" Erased "11074" "C" NoClass (Lam "11077" Erased "11079" "indices" NoClass (Lam "11088" NotErased "11090" "e" NoClass (Lam "11093" Erased "11095" "Q" NoClass (Lam "11098" NotErased "11100" "i" NoClass (App (AppTp (App (AppTp (App (App (AppTp (AppTp (Var "11107" "indCoend'") (TpVar "11119" "F")) (TpVar "11123" "C")) Erased (Var "11126" "indices")) NotErased (Var "11134" "e")) (TpVar "11138" "Q")) NotErased (Var "11140" "i")) (TpVar "11144" "Q")) NotErased (Parens "11146" (Lam "11147" Erased "11149" "indices" NoClass (Lam "11158" Erased "11160" "x'" NoClass (Lam "11164" NotErased "11166" "u" NoClass (Var "11169" "u")))) "11171"))))))))) "11172") (CmdsNext (DefTermOrType OpacTrans (DefTerm "11174" "fmapCoend" (SomeType (Abs "11186" Erased "11188" "F" (Tkk (KndArrow (KndParens "11192" (KndTpArrow (TpVar "11193" "Indices") (Star "11203")) "11205") (KndTpArrow (TpVar "11208" "Indices") (Star "11218")))) (TpApp (TpVar "11221" "Functor") (TpParens "11231" (TpApp (TpVar "11232" "CoendInd") (TpVar "11243" "F")) "11245")))) (Lam "11250" Erased "11252" "F" NoClass (Lam "11255" Erased "11257" "A" NoClass (Lam "11260" Erased "11262" "B" NoClass (Lam "11265" Erased "11267" "f" NoClass (IotaPair "11274" (Lam "11275" Erased "11277" "indices" NoClass (Lam "11286" NotErased "11288" "c" NoClass (Phi "11297" (Parens "11299" (Theta "11300" (AbstractVars (VarsNext "indices" (VarsStart "c"))) (Parens "11313" (App (App (AppTp (AppTp (Var "11314" "indCoend") (TpVar "11325" "F")) (TpVar "11329" "A")) Erased (Var "11332" "indices")) NotErased (Var "11340" "c")) "11342") (LtermsCons NotErased (Parens "11343" (Lam "11344" Erased "11346" "R" NoClass (Lam "11349" Erased "11351" "indices" NoClass (Lam "11360" Erased "11362" "i" NoClass (Lam "11365" NotErased "11367" "gr" NoClass (Beta "11371" NoTerm NoTerm))))) "11373") (LtermsNil "11372"))) "11374") (Theta "11386" (AbstractVars (VarsNext "indices" (VarsStart "c"))) (Parens "11399" (App (App (AppTp (AppTp (Var "11400" "indCoend") (TpVar "11411" "F")) (TpVar "11415" "A")) Erased (Var "11418" "indices")) NotErased (Var "11426" "c")) "11428") (LtermsCons NotErased (Parens "11429" (Lam "11430" Erased "11432" "R" NoClass (Lam "11435" Erased "11437" "indices" NoClass (Lam "11446" Erased "11448" "i" NoClass (Lam "11451" NotErased "11453" "gr" NoClass (App (App (App (AppTp (AppTp (AppTp (Var "11468" "intrCoendInd") (TpVar "11483" "F")) (TpVar "11487" "B")) (TpVar "11491" "R")) Erased (Var "11494" "indices")) Erased (IotaPair "11516" (Lam "11517" Erased "11519" "indices" NoClass (Lam "11528" NotErased "11530" "r" NoClass (App (App (App (Var "11533" "cast") Erased (Var "11539" "f")) Erased (Var "11542" "indices")) NotErased (Parens "11550" (App (App (App (Var "11551" "cast") Erased (Var "11557" "i")) Erased (Var "11560" "indices")) NotErased (Var "11568" "r")) "11570")))) (Beta "11572" NoTerm NoTerm) NoGuide "11574")) NotErased (Var "11575" "gr")))))) "11578") (LtermsNil "11578"))) (Var "11580" "c") "11582"))) (Beta "11584" NoTerm NoTerm) NoGuide "11586")))))) "11587") (CmdsNext (DefTermOrType OpacTrans (DefType "11590" "AlgCVM" (KndArrow (KndParens "11599" (KndArrow (KndParens "11600" (KndTpArrow (TpVar "11601" "Indices") (Star "11611")) "11613") (KndTpArrow (TpVar "11616" "Indices") (Star "11626"))) "11628") (KndArrow (Star "11631") (KndTpArrow (TpVar "11635" "Indices") (Star "11645")))) (TpLambda "11651" "11653" "F" (Tkk (KndArrow (KndParens "11657" (KndTpArrow (TpVar "11658" "Indices") (Star "11668")) "11670") (KndTpArrow (TpVar "11673" "Indices") (Star "11683")))) (TpLambda "11686" "11688" "X" (Tkk (Star "11692")) (TpLambda "11695" "11697" "indices" (Tkt (TpVar "11707" "Indices")) (Abs "11720" Erased "11722" "R" (Tkk (KndTpArrow (TpVar "11726" "Indices") (Star "11736"))) (TpArrow (TpParens "11739" (TpArrow (TpAppt (TpVar "11740" "R") (Var "11742" "indices")) NotErased (TpAppt (TpApp (TpVar "11752" "F") (TpVar "11756" "R")) (Var "11758" "indices"))) "11766") NotErased (TpArrow (TpParens "11769" (TpArrow (TpAppt (TpVar "11770" "R") (Var "11772" "indices")) NotErased (TpVar "11782" "X")) "11784") NotErased (TpArrow (TpAppt (TpApp (TpVar "11787" "F") (TpVar "11791" "R")) (Var "11793" "indices")) NotErased (TpVar "11803" "X"))))))))) "11805") (CmdsNext (DefTermOrType OpacTrans (DefType "11808" "FixCVM" (KndArrow (KndParens "11817" (KndArrow (KndParens "11818" (KndTpArrow (TpVar "11819" "Indices") (Star "11829")) "11831") (KndTpArrow (TpVar "11834" "Indices") (Star "11844"))) "11846") (KndTpArrow (TpVar "11849" "Indices") (Star "11859"))) (TpLambda "11865" "11867" "F" (Tkk (KndArrow (KndParens "11871" (KndTpArrow (TpVar "11872" "Indices") (Star "11882")) "11884") (KndTpArrow (TpVar "11887" "Indices") (Star "11897")))) (TpLambda "11900" "11902" "indices" (Tkt (TpVar "11912" "Indices")) (Abs "11925" Erased "11927" "R" (Tkk (Star "11931")) (TpArrow (TpAppt (TpApp (TpApp (TpVar "11934" "AlgCVM") (TpVar "11943" "F")) (TpVar "11947" "R")) (Var "11949" "indices")) NotErased (TpVar "11959" "R")))))) "11961") (CmdsNext (DefTermOrType OpacTrans (DefTerm "11963" "foldCVM" (SomeType (Abs "11977" Erased "11979" "F" (Tkk (KndArrow (KndParens "11983" (KndTpArrow (TpVar "11984" "Indices") (Star "11994")) "11996") (KndTpArrow (TpVar "11999" "Indices") (Star "12009")))) (Abs "12012" Erased "12014" "A" (Tkk (Star "12018")) (Abs "12021" Erased "12023" "indices" (Tkt (TpVar "12033" "Indices")) (TpArrow (TpAppt (TpApp (TpApp (TpVar "12046" "AlgCVM") (TpVar "12055" "F")) (TpVar "12059" "A")) (Var "12061" "indices")) NotErased (TpArrow (TpAppt (TpApp (TpVar "12071" "FixCVM") (TpVar "12080" "F")) (Var "12082" "indices")) NotErased (TpVar "12092" "A"))))))) (Lam "12098" Erased "12100" "F" NoClass (Lam "12103" Erased "12105" "A" NoClass (Lam "12108" Erased "12110" "indices" NoClass (Lam "12119" NotErased "12121" "alg" NoClass (Lam "12126" NotErased "12128" "fix" NoClass (App (Var "12133" "fix") NotErased (Var "12137" "alg")))))))) "12141") (CmdsNext (DefTermOrType OpacTrans (DefType "12143" "CVProduct'" (KndArrow (KndParens "12157" (KndArrow (KndParens "12158" (KndTpArrow (TpVar "12159" "Indices") (Star "12169")) "12171") (KndTpArrow (TpVar "12174" "Indices") (Star "12184"))) "12186") (KndArrow (KndParens "12189" (KndTpArrow (TpVar "12190" "Indices") (Star "12200")) "12202") (KndTpArrow (TpVar "12205" "Indices") (Star "12215")))) (TpLambda "12221" "12223" "F" (Tkk (KndArrow (KndParens "12227" (KndTpArrow (TpVar "12228" "Indices") (Star "12238")) "12240") (KndTpArrow (TpVar "12243" "Indices") (Star "12253")))) (TpLambda "12256" "12258" "X" (Tkk (KndTpArrow (TpVar "12262" "Indices") (Star "12272"))) (TpLambda "12275" "12277" "indices" (Tkt (TpVar "12287" "Indices")) (TpApp (TpApp (TpVar "12300" "Sigma") (TpParens "12308" (TpAppt (TpApp (TpVar "12309" "F") (TpVar "12313" "X")) (Var "12315" "indices")) "12323")) (TpParens "12326" (TpLambda "12327" "12329" "_" (Tkt (TpAppt (TpApp (TpVar "12333" "F") (TpVar "12337" "X")) (Var "12339" "indices"))) (TpArrow (TpAppt (TpVar "12348" "X") (Var "12350" "indices")) NotErased (TpAppt (TpApp (TpVar "12360" "F") (TpVar "12364" "X")) (Var "12366" "indices")))) "12374")))))) "12375") (CmdsNext (DefTermOrType OpacTrans (DefType "12376" "CVF'" (KndArrow (KndParens "12389" (KndArrow (KndParens "12390" (KndTpArrow (TpVar "12391" "Indices") (Star "12401")) "12403") (KndTpArrow (TpVar "12406" "Indices") (Star "12416"))) "12418") (KndArrow (KndParens "12421" (KndTpArrow (TpVar "12422" "Indices") (Star "12432")) "12434") (KndTpArrow (TpVar "12437" "Indices") (Star "12447")))) (TpLambda "12453" "12455" "F" (Tkk (KndArrow (KndParens "12459" (KndTpArrow (TpVar "12460" "Indices") (Star "12470")) "12472") (KndTpArrow (TpVar "12475" "Indices") (Star "12485")))) (TpApp (TpVar "12488" "CoendInd") (TpParens "12499" (TpApp (TpVar "12500" "CVProduct'") (TpVar "12513" "F")) "12515")))) "12516") (CmdsNext (DefTermOrType OpacTrans (DefType "12517" "CVFixIndM'" (KndArrow (KndParens "12530" (KndArrow (KndParens "12531" (KndTpArrow (TpVar "12532" "Indices") (Star "12542")) "12544") (KndTpArrow (TpVar "12547" "Indices") (Star "12557"))) "12559") (KndTpArrow (TpVar "12562" "Indices") (Star "12572"))) (TpLambda "12578" "12580" "F" (Tkk (KndArrow (KndParens "12584" (KndTpArrow (TpVar "12585" "Indices") (Star "12595")) "12597") (KndTpArrow (TpVar "12600" "Indices") (Star "12610")))) (TpAppt (TpApp (TpVar "12613" "FixIndM") (TpParens "12623" (TpApp (TpVar "12624" "CVF'") (TpVar "12631" "F")) "12633")) (Parens "12634" (AppTp (Var "12635" "fmapCoend") (TpParens "12647" (TpApp (TpVar "12648" "CVProduct'") (TpVar "12661" "F")) "12663")) "12664")))) "12665") (CmdsNext (DefTermOrType OpacTrans (DefTerm "12667" "cvOutFixIndM'" (SomeType (Abs "12687" Erased "12689" "F" (Tkk (KndArrow (KndParens "12693" (KndTpArrow (TpVar "12694" "Indices") (Star "12704")) "12706") (KndTpArrow (TpVar "12709" "Indices") (Star "12719")))) (Abs "12722" Erased "12724" "fmap" (Tkt (TpApp (TpVar "12731" "Functor") (TpVar "12741" "F"))) (Abs "12744" Erased "12746" "indices" (Tkt (TpVar "12756" "Indices")) (TpArrow (TpAppt (TpApp (TpVar "12769" "CVFixIndM'") (TpVar "12782" "F")) (Var "12784" "indices")) NotErased (TpAppt (TpApp (TpVar "12794" "F") (TpParens "12798" (TpApp (TpVar "12799" "CVFixIndM'") (TpVar "12812" "F")) "12814")) (Var "12815" "indices"))))))) (Lam "12827" Erased "12829" "F" NoClass (Lam "12832" Erased "12834" "fmap" NoClass (Lam "12840" Erased "12842" "indices" NoClass (Lam "12851" NotErased "12853" "v" NoClass (App (AppTp (App (App (AppTp (AppTp (Var "12856" "indCoend") (TpParens "12871" (TpApp (TpVar "12872" "CVProduct'") (TpVar "12885" "F")) "12887")) (TpParens "12894" (TpAppt (TpApp (TpVar "12895" "FixIndM") (TpParens "12905" (TpApp (TpVar "12906" "CoendInd") (TpParens "12917" (TpApp (TpVar "12918" "CVProduct'") (TpVar "12931" "F")) "12933")) "12934")) (Parens "12935" (AppTp (Var "12936" "fmapCoend") (TpParens "12948" (TpApp (TpVar "12949" "CVProduct'") (TpVar "12962" "F")) "12964")) "12965")) "12966")) Erased (Var "12972" "indices")) NotErased (Parens "12980" (App (App (App (Var "12981" "outFixIndM") Erased (Parens "12993" (AppTp (Var "12994" "fmapCoend") (TpParens "13006" (TpApp (TpVar "13007" "CVProduct'") (TpVar "13020" "F")) "13022")) "13023")) Erased (Var "13025" "indices")) NotErased (Var "13033" "v")) "13035")) (TpParens "13043" (TpLambda "13044" "13046" "indices" (Tkt (TpVar "13056" "Indices")) (TpLambda "13065" "13067" "_" (Tkt (TpAppt (TpApp (TpApp (TpVar "13071" "CoendInd") (TpParens "13082" (TpApp (TpVar "13083" "CVProduct'") (TpVar "13096" "F")) "13098")) (TpParens "13101" (TpApp (TpVar "13102" "CVFixIndM'") (TpVar "13115" "F")) "13117")) (Var "13118" "indices"))) (TpAppt (TpApp (TpVar "13135" "F") (TpParens "13139" (TpApp (TpVar "13140" "CVFixIndM'") (TpVar "13153" "F")) "13155")) (Var "13156" "indices")))) "13164")) NotErased (Parens "13166" (Lam "13167" Erased "13169" "R" NoClass (Lam "13172" Erased "13174" "indices" NoClass (Lam "13183" Erased "13185" "c" NoClass (Lam "13188" NotErased "13190" "v" NoClass (App (App (App (Var "13193" "cast") Erased (Parens "13199" (App (Var "13200" "fmap") Erased (Var "13206" "c")) "13208")) Erased (Var "13210" "indices")) NotErased (Parens "13218" (App (Var "13219" "fst") NotErased (Var "13223" "v")) "13225")))))) "13226"))))))) "13227") (CmdsNext (DefTermOrType OpacTrans (DefType "13229" "CVProduct" (KndArrow (KndParens "13241" (KndArrow (KndParens "13242" (KndTpArrow (TpVar "13243" "Indices") (Star "13253")) "13255") (KndTpArrow (TpVar "13258" "Indices") (Star "13268"))) "13270") (KndArrow (KndParens "13273" (KndTpArrow (TpVar "13274" "Indices") (Star "13284")) "13286") (KndTpArrow (TpVar "13289" "Indices") (Star "13299")))) (TpLambda "13305" "13307" "F" (Tkk (KndArrow (KndParens "13311" (KndTpArrow (TpVar "13312" "Indices") (Star "13322")) "13324") (KndTpArrow (TpVar "13327" "Indices") (Star "13337")))) (TpLambda "13340" "13342" "X" (Tkk (KndTpArrow (TpVar "13346" "Indices") (Star "13356"))) (TpLambda "13359" "13361" "indices" (Tkt (TpVar "13371" "Indices")) (TpApp (TpApp (TpVar "13380" "Product") (TpParens "13394" (TpAppt (TpApp (TpVar "13395" "F") (TpVar "13399" "X")) (Var "13401" "indices")) "13409")) (TpParens "13416" (Iota "13417" "13419" "o" (Abs "13423" Erased "13425" "indices" (Tkt (TpVar "13435" "Indices")) (TpArrow (TpAppt (TpVar "13444" "X") (Var "13446" "indices")) NotErased (TpAppt (TpApp (TpVar "13456" "F") (TpVar "13460" "X")) (Var "13462" "indices")))) (TpEq "13471" (Var "13472" "o") (Var "13476" "cvOutFixIndM'") "13490")) "13491")))))) "13492") (CmdsNext (DefTermOrType OpacTrans (DefType "13493" "CVF" (KndArrow (KndParens "13500" (KndArrow (KndParens "13501" (KndTpArrow (TpVar "13502" "Indices") (Star "13512")) "13514") (KndTpArrow (TpVar "13517" "Indices") (Star "13527"))) "13529") (KndArrow (KndParens "13532" (KndTpArrow (TpVar "13533" "Indices") (Star "13543")) "13545") (KndTpArrow (TpVar "13548" "Indices") (Star "13558")))) (TpLambda "13564" "13566" "F" (Tkk (KndArrow (KndParens "13570" (KndTpArrow (TpVar "13571" "Indices") (Star "13581")) "13583") (KndTpArrow (TpVar "13586" "Indices") (Star "13596")))) (TpApp (TpVar "13599" "CoendInd") (TpParens "13610" (TpApp (TpVar "13611" "CVProduct") (TpVar "13623" "F")) "13625")))) "13626") (CmdsNext (DefTermOrType OpacTrans (DefType "13627" "CVFixIndM" (KndPi "13639" "13641" "F" (Tkk (KndArrow (KndParens "13645" (KndTpArrow (TpVar "13646" "Indices") (Star "13656")) "13658") (KndTpArrow (TpVar "13661" "Indices") (Star "13671")))) (KndTpArrow (TpApp (TpVar "13674" "Functor") (TpVar "13684" "F")) (KndTpArrow (TpVar "13688" "Indices") (Star "13698")))) (TpLambda "13704" "13706" "F" (Tkk (KndArrow (KndParens "13710" (KndTpArrow (TpVar "13711" "Indices") (Star "13721")) "13723") (KndTpArrow (TpVar "13726" "Indices") (Star "13736")))) (TpLambda "13739" "13741" "fmap" (Tkt (TpApp (TpVar "13748" "Functor") (TpVar "13758" "F"))) (TpAppt (TpApp (TpVar "13765" "FixIndM") (TpParens "13775" (TpApp (TpVar "13776" "CVF") (TpVar "13782" "F")) "13784")) (Parens "13785" (AppTp (Var "13786" "fmapCoend") (TpParens "13798" (TpApp (TpVar "13799" "CVProduct") (TpVar "13811" "F")) "13813")) "13814"))))) "13815") (CmdsNext (DefTermOrType OpacTrans (DefTerm "13817" "cvOutFixIndM" (SomeType (Abs "13836" Erased "13838" "F" (Tkk (KndArrow (KndParens "13842" (KndTpArrow (TpVar "13843" "Indices") (Star "13853")) "13855") (KndTpArrow (TpVar "13858" "Indices") (Star "13868")))) (Abs "13871" Erased "13873" "fmap" (Tkt (TpApp (TpVar "13880" "Functor") (TpVar "13890" "F"))) (Abs "13893" Erased "13895" "indices" (Tkt (TpVar "13905" "Indices")) (TpArrow (TpAppt (TpAppt (TpApp (TpVar "13918" "CVFixIndM") (TpVar "13930" "F")) (Var "13932" "fmap")) (Var "13937" "indices")) NotErased (TpAppt (TpApp (TpVar "13947" "F") (TpParens "13951" (TpAppt (TpApp (TpVar "13952" "CVFixIndM") (TpVar "13964" "F")) (Var "13966" "fmap")) "13971")) (Var "13972" "indices"))))))) (Lam "13984" Erased "13986" "F" NoClass (Lam "13989" Erased "13991" "fmap" NoClass (Lam "13997" Erased "13999" "indices" NoClass (Lam "14008" NotErased "14010" "v" NoClass (App (AppTp (App (App (AppTp (AppTp (Var "14013" "indCoend") (TpParens "14028" (TpApp (TpVar "14029" "CVProduct") (TpVar "14041" "F")) "14043")) (TpParens "14050" (TpAppt (TpApp (TpVar "14051" "FixIndM") (TpParens "14061" (TpApp (TpVar "14062" "CoendInd") (TpParens "14073" (TpApp (TpVar "14074" "CVProduct") (TpVar "14086" "F")) "14088")) "14089")) (Parens "14090" (AppTp (Var "14091" "fmapCoend") (TpParens "14103" (TpApp (TpVar "14104" "CVProduct") (TpVar "14116" "F")) "14118")) "14119")) "14120")) Erased (Var "14126" "indices")) NotErased (Parens "14138" (App (App (App (Var "14139" "outFixIndM") Erased (Parens "14151" (AppTp (Var "14152" "fmapCoend") (TpParens "14164" (TpApp (TpVar "14165" "CVProduct") (TpVar "14177" "F")) "14179")) "14180")) Erased (Var "14182" "indices")) NotErased (Var "14190" "v")) "14192")) (TpParens "14199" (TpLambda "14200" "14202" "indices" (Tkt (TpVar "14212" "Indices")) (TpLambda "14221" "14223" "_" (Tkt (TpAppt (TpApp (TpApp (TpVar "14227" "CoendInd") (TpParens "14238" (TpApp (TpVar "14239" "CVProduct") (TpVar "14251" "F")) "14253")) (TpParens "14256" (TpAppt (TpApp (TpVar "14257" "CVFixIndM") (TpVar "14269" "F")) (Var "14271" "fmap")) "14276")) (Var "14277" "indices"))) (TpAppt (TpApp (TpVar "14294" "F") (TpParens "14298" (TpAppt (TpApp (TpVar "14299" "CVFixIndM") (TpVar "14311" "F")) (Var "14313" "fmap")) "14318")) (Var "14319" "indices")))) "14327")) NotErased (Parens "14332" (Lam "14333" Erased "14335" "R" NoClass (Lam "14338" Erased "14340" "indices" NoClass (Lam "14349" Erased "14351" "c" NoClass (Lam "14354" NotErased "14356" "v" NoClass (App (App (App (Var "14359" "cast") Erased (Parens "14365" (App (Var "14366" "fmap") Erased (Var "14372" "c")) "14374")) Erased (Var "14376" "indices")) NotErased (Parens "14384" (App (Var "14385" "fst") NotErased (Var "14389" "v")) "14391")))))) "14392"))))))) "14393") (CmdsNext (DefTermOrType OpacTrans (DefTerm "14395" "cvInFixIndM" (SomeType (Abs "14413" Erased "14415" "F" (Tkk (KndArrow (KndParens "14419" (KndTpArrow (TpVar "14420" "Indices") (Star "14430")) "14432") (KndTpArrow (TpVar "14435" "Indices") (Star "14445")))) (Abs "14448" Erased "14450" "fmap" (Tkt (TpApp (TpVar "14457" "Functor") (TpVar "14467" "F"))) (Abs "14470" Erased "14472" "indices" (Tkt (TpVar "14482" "Indices")) (TpArrow (TpAppt (TpApp (TpVar "14495" "F") (TpParens "14499" (TpAppt (TpApp (TpVar "14500" "CVFixIndM") (TpVar "14512" "F")) (Var "14514" "fmap")) "14519")) (Var "14520" "indices")) NotErased (TpAppt (TpAppt (TpApp (TpVar "14530" "CVFixIndM") (TpVar "14542" "F")) (Var "14544" "fmap")) (Var "14549" "indices"))))))) (Lam "14561" Erased "14563" "F" NoClass (Lam "14566" Erased "14568" "fmap" NoClass (Lam "14574" Erased "14576" "indices" NoClass (Lam "14585" NotErased "14587" "fcv" NoClass (App (App (App (Var "14592" "inFixIndM") Erased (Parens "14603" (AppTp (Var "14604" "fmapCoend") (TpParens "14616" (TpApp (TpVar "14617" "CVProduct") (TpVar "14629" "F")) "14631")) "14632")) Erased (Var "14634" "indices")) NotErased (Parens "14646" (App (App (App (AppTp (AppTp (AppTp (Var "14647" "intrCoendInd") (TpParens "14662" (TpApp (TpVar "14663" "CVProduct") (TpVar "14675" "F")) "14677")) (TpParens "14680" (TpAppt (TpApp (TpVar "14681" "CVFixIndM") (TpVar "14693" "F")) (Var "14695" "fmap")) "14700")) (TpParens "14703" (TpAppt (TpApp (TpVar "14704" "CVFixIndM") (TpVar "14716" "F")) (Var "14718" "fmap")) "14723")) Erased (Var "14731" "indices")) Erased (IotaPair "14740" (Lam "14741" Erased "14743" "indices" NoClass (Lam "14752" NotErased "14754" "x" NoClass (Var "14757" "x"))) (Beta "14760" NoTerm NoTerm) NoGuide "14762")) NotErased (Parens "14769" (App (App (Var "14770" "sigma") NotErased (Var "14776" "fcv")) NotErased (IotaPair "14780" (App (Var "14781" "cvOutFixIndM") Erased (Var "14795" "fmap")) (Beta "14801" NoTerm (SomeTerm (Var "14803" "cvOutFixIndM") "14816")) NoGuide "14817")) "14818")) "14819"))))))) "14820") (CmdsNext (DefTermOrType OpacTrans (DefTerm "14822" "cvIndFixIndM" (SomeType (Abs "14841" Erased "14843" "F" (Tkk (KndArrow (KndParens "14847" (KndTpArrow (TpVar "14848" "Indices") (Star "14858")) "14860") (KndTpArrow (TpVar "14863" "Indices") (Star "14873")))) (Abs "14876" Erased "14878" "fmap" (Tkt (TpApp (TpVar "14885" "Functor") (TpVar "14895" "F"))) (Abs "14902" Erased "14904" "indices" (Tkt (TpVar "14914" "Indices")) (Abs "14923" NotErased "14925" "e" (Tkt (TpAppt (TpAppt (TpApp (TpVar "14929" "CVFixIndM") (TpVar "14941" "F")) (Var "14943" "fmap")) (Var "14948" "indices"))) (Abs "14961" Erased "14963" "Q" (Tkk (KndPi "14967" "14969" "indices" (Tkt (TpVar "14979" "Indices")) (KndTpArrow (TpAppt (TpAppt (TpApp (TpVar "14988" "CVFixIndM") (TpVar "15000" "F")) (Var "15002" "fmap")) (Var "15007" "indices")) (Star "15017")))) (TpArrow (TpParens "15024" (Abs "15025" Erased "15027" "R" (Tkk (KndTpArrow (TpVar "15031" "Indices") (Star "15041"))) (Abs "15044" Erased "15046" "c" (Tkt (TpApp (TpApp (TpVar "15050" "Cast") (TpVar "15057" "R")) (TpParens "15061" (TpAppt (TpApp (TpVar "15062" "CVFixIndM") (TpVar "15074" "F")) (Var "15076" "fmap")) "15081"))) (Abs "15088" Erased "15090" "out" (Tkt (Abs "15096" Erased "15098" "indices" (Tkt (TpVar "15108" "Indices")) (TpArrow (TpAppt (TpVar "15117" "R") (Var "15119" "indices")) NotErased (TpAppt (TpApp (TpVar "15129" "F") (TpVar "15133" "R")) (Var "15135" "indices"))))) (TpArrow (TpEq "15144" (Var "15145" "out") (Var "15151" "cvOutFixIndM") "15164") Erased (TpArrow (TpParens "15172" (Abs "15173" Erased "15175" "indices" (Tkt (TpVar "15185" "Indices")) (Abs "15194" NotErased "15196" "r" (Tkt (TpAppt (TpVar "15200" "R") (Var "15202" "indices"))) (TpAppt (TpAppt (TpVar "15211" "Q") (Var "15213" "indices")) (Parens "15221" (App (App (App (Var "15222" "cast") Erased (Var "15228" "c")) Erased (Var "15231" "indices")) NotErased (Var "15239" "r")) "15241")))) "15242") NotErased (Abs "15250" Erased "15252" "indices" (Tkt (TpVar "15262" "Indices")) (Abs "15271" NotErased "15273" "gr" (Tkt (TpAppt (TpApp (TpVar "15278" "F") (TpVar "15282" "R")) (Var "15284" "indices"))) (TpAppt (TpAppt (TpVar "15298" "Q") (Var "15300" "indices")) (Parens "15308" (App (App (App (Var "15309" "cvInFixIndM") Erased (Var "15322" "fmap")) Erased (Var "15328" "indices")) NotErased (Parens "15336" (App (App (App (Var "15337" "cast") Erased (Parens "15343" (App (Var "15344" "fmap") Erased (Var "15350" "c")) "15352")) Erased (Var "15354" "indices")) NotErased (Var "15362" "gr")) "15365")) "15366"))))))))) "15367") NotErased (TpAppt (TpAppt (TpVar "15374" "Q") (Var "15376" "indices")) (Var "15384" "e"))))))))) (Lam "15390" Erased "15392" "F" NoClass (Lam "15395" Erased "15397" "fmap" NoClass (Lam "15403" Erased "15405" "indices" NoClass (Lam "15414" NotErased "15416" "e" NoClass (Lam "15419" Erased "15421" "Q" NoClass (Lam "15424" NotErased "15426" "prf" NoClass (App (AppTp (App (App (App (Var "15435" "indFixIndM") Erased (Parens "15447" (AppTp (Var "15448" "fmapCoend") (TpParens "15460" (TpApp (TpVar "15461" "CVProduct") (TpVar "15473" "F")) "15475")) "15476")) Erased (Var "15478" "indices")) NotErased (Var "15486" "e")) (TpVar "15490" "Q")) NotErased (Parens "15498" (Lam "15499" Erased "15501" "R" NoClass (Lam "15504" Erased "15506" "i" NoClass (Lam "15509" NotErased "15511" "ih" NoClass (Lam "15515" Erased "15517" "indices" NoClass (Lam "15526" NotErased "15528" "gr" NoClass (Theta "15540" (AbstractVars (VarsNext "indices" (VarsStart "gr"))) (Parens "15554" (App (App (AppTp (AppTp (Var "15555" "indCoend") (TpParens "15566" (TpApp (TpVar "15567" "CVProduct") (TpVar "15579" "F")) "15581")) (TpVar "15584" "R")) Erased (Var "15587" "indices")) NotErased (Var "15595" "gr")) "15598") (LtermsCons NotErased (Parens "15609" (Lam "15610" Erased "15612" "R'" NoClass (Lam "15616" Erased "15618" "indices" NoClass (Lam "15627" Erased "15629" "i2" NoClass (Lam "15633" NotErased "15635" "fr" NoClass (Theta "15639" (AbstractVars (VarsStart "fr")) (Parens "15645" (App (Var "15646" "SigmaInd") NotErased (Var "15655" "fr")) "15658") (LtermsCons NotErased (Parens "15671" (Lam "15672" NotErased "15674" "a" NoClass (Lam "15677" NotErased "15679" "b" NoClass (Rho "15682" RhoPlain NoNums (IotaProj (Var "15684" "b") "2" "15687") NoGuide (App (App (App (App (App (App (AppTp (Var "15690" "prf") (TpVar "15696" "R'")) Erased (IotaPair "15714" (Lam "15715" Erased "15717" "indices" NoClass (Lam "15726" NotErased "15728" "r" NoClass (App (App (App (Var "15731" "cast") Erased (Var "15737" "i")) Erased (Var "15740" "indices")) NotErased (Parens "15748" (App (App (App (Var "15749" "cast") Erased (Var "15755" "i2")) Erased (Var "15759" "indices")) NotErased (Var "15767" "r")) "15769")))) (Beta "15771" NoTerm NoTerm) NoGuide "15773")) Erased (IotaProj (Var "15775" "b") "1" "15778")) Erased (IotaProj (Var "15780" "b") "2" "15783")) NotErased (Parens "15798" (Lam "15799" Erased "15801" "indices" NoClass (Lam "15810" NotErased "15812" "r'" NoClass (App (App (Var "15816" "ih") Erased (Var "15820" "indices")) NotErased (Parens "15828" (App (App (App (Var "15829" "cast") Erased (Var "15835" "i2")) Erased (Var "15839" "indices")) NotErased (Var "15847" "r'")) "15850")))) "15851")) Erased (Var "15853" "indices")) NotErased (Var "15861" "a"))))) "15863") (LtermsNil "15862"))))))) "15864") (LtermsNil "15863")))))))) "15865"))))))))) "15866") CmdsStart)))))))))))))))))))))))))))))))))))))))))))))))))) "15866"
-- src/templates/MendlerSimple.ced
MendlerSimpleTemplate = File "1" ImportsStart "1" "8" "MendlerSimple" (ParamsCons (Decl "22" "23" NotErased "Indices" (Tkk (Star "33")) "35") ParamsNil) (CmdsNext (DefTermOrType OpacTrans (DefType "38" "Top" (Star "44") (TpEq "48" (Beta "49" NoTerm NoTerm) (Beta "53" NoTerm NoTerm) "55")) "56") (CmdsNext (DefTermOrType OpacTrans (DefType "58" "Cast" (KndArrow (KndParens "65" (KndTpArrow (TpVar "66" "Indices") (Star "76")) "78") (KndArrow (KndParens "81" (KndTpArrow (TpVar "82" "Indices") (Star "92")) "94") (Star "97"))) (TpLambda "101" "103" "A" (Tkk (KndTpArrow (TpVar "107" "Indices") (Star "117"))) (TpLambda "120" "122" "B" (Tkk (KndTpArrow (TpVar "126" "Indices") (Star "136"))) (Iota "141" "143" "cast" (Abs "150" Erased "152" "indices" (Tkt (TpVar "162" "Indices")) (TpArrow (TpAppt (TpVar "171" "A") (Var "173" "indices")) NotErased (TpAppt (TpVar "183" "B") (Var "185" "indices")))) (TpEq "194" (Var "195" "cast") (Lam "202" NotErased "204" "x" NoClass (Var "207" "x")) "209"))))) "210") (CmdsNext (DefTermOrType OpacTrans (DefTerm "212" "cast" (SomeType (Abs "219" Erased "221" "A" (Tkk (KndTpArrow (TpVar "225" "Indices") (Star "235"))) (Abs "238" Erased "240" "B" (Tkk (KndTpArrow (TpVar "244" "Indices") (Star "254"))) (TpArrow (TpApp (TpApp (TpVar "257" "Cast") (TpVar "264" "A")) (TpVar "268" "B")) Erased (Abs "276" Erased "278" "indices" (Tkt (TpVar "288" "Indices")) (TpArrow (TpAppt (TpVar "297" "A") (Var "299" "indices")) NotErased (TpAppt (TpVar "309" "B") (Var "311" "indices")))))))) (Lam "323" Erased "325" "A" NoClass (Lam "328" Erased "330" "B" NoClass (Lam "333" Erased "335" "c" NoClass (Phi "338" (IotaProj (Var "340" "c") "2" "343") (IotaProj (Var "346" "c") "1" "349") (Lam "351" NotErased "353" "x" NoClass (Var "356" "x")) "358"))))) "359") (CmdsNext (DefTermOrType OpacTrans (DefType "361" "RecFunctor" (KndArrow (KndParens "374" (KndArrow (KndParens "375" (KndTpArrow (TpVar "376" "Indices") (Star "386")) "388") (KndTpArrow (TpVar "391" "Indices") (Star "401"))) "403") (Star "406")) (TpLambda "412" "414" "F" (Tkk (KndArrow (KndParens "418" (KndTpArrow (TpVar "419" "Indices") (Star "429")) "431") (KndTpArrow (TpVar "434" "Indices") (Star "444")))) (Abs "447" Erased "449" "X" (Tkk (KndTpArrow (TpVar "453" "Indices") (Star "463"))) (Abs "466" Erased "468" "Y" (Tkk (KndTpArrow (TpVar "472" "Indices") (Star "482"))) (TpArrow (TpApp (TpApp (TpVar "489" "Cast") (TpVar "496" "X")) (TpVar "500" "Y")) Erased (TpApp (TpApp (TpVar "504" "Cast") (TpParens "511" (TpApp (TpVar "512" "F") (TpVar "516" "X")) "518")) (TpParens "521" (TpApp (TpVar "522" "F") (TpVar "526" "Y")) "528"))))))) "529") (CmdsNext (DefTermOrType OpacTrans (DefType "531" "Rec" (KndArrow (KndParens "537" (KndArrow (KndParens "538" (KndTpArrow (TpVar "539" "Indices") (Star "549")) "551") (KndTpArrow (TpVar "554" "Indices") (Star "564"))) "566") (KndTpArrow (TpVar "569" "Indices") (Star "579"))) (TpLambda "585" "587" "F" (Tkk (KndArrow (KndParens "591" (KndTpArrow (TpVar "592" "Indices") (Star "602")) "604") (KndTpArrow (TpVar "607" "Indices") (Star "617")))) (TpLambda "620" "622" "indices" (Tkt (TpVar "632" "Indices")) (Abs "645" Erased "647" "X" (Tkk (KndTpArrow (TpVar "651" "Indices") (Star "661"))) (TpArrow (TpApp (TpApp (TpVar "664" "Cast") (TpParens "671" (TpApp (TpVar "672" "F") (TpVar "676" "X")) "678")) (TpVar "681" "X")) Erased (TpAppt (TpVar "685" "X") (Var "687" "indices"))))))) "695") (CmdsNext (DefTermOrType OpacTrans (DefTerm "698" "recCast" (SomeType (Abs "708" Erased "710" "F" (Tkk (KndArrow (KndParens "714" (KndTpArrow (TpVar "715" "Indices") (Star "725")) "727") (KndTpArrow (TpVar "730" "Indices") (Star "740")))) (Abs "743" Erased "745" "X" (Tkk (KndTpArrow (TpVar "749" "Indices") (Star "759"))) (TpArrow (TpApp (TpApp (TpVar "766" "Cast") (TpParens "773" (TpApp (TpVar "774" "F") (TpVar "778" "X")) "780")) (TpVar "783" "X")) Erased (TpApp (TpApp (TpVar "787" "Cast") (TpParens "794" (TpApp (TpVar "795" "Rec") (TpVar "801" "F")) "803")) (TpVar "806" "X")))))) (Lam "812" Erased "814" "F" NoClass (Lam "817" Erased "819" "X" NoClass (Lam "822" Erased "824" "c" NoClass (IotaPair "827" (Lam "828" Erased "830" "indices" NoClass (Lam "839" NotErased "841" "a" NoClass (App (AppTp (Var "844" "a") (TpVar "848" "X")) Erased (Var "851" "c")))) (Beta "854" NoTerm NoTerm) NoGuide "856"))))) "857") (CmdsNext (DefTermOrType OpacTrans (DefTerm "859" "recIn" (SomeType (Abs "867" Erased "869" "F" (Tkk (KndArrow (KndParens "873" (KndTpArrow (TpVar "874" "Indices") (Star "884")) "886") (KndTpArrow (TpVar "889" "Indices") (Star "899")))) (TpArrow (TpApp (TpVar "902" "RecFunctor") (TpVar "915" "F")) Erased (TpApp (TpApp (TpVar "923" "Cast") (TpParens "930" (TpApp (TpVar "931" "F") (TpParens "935" (TpApp (TpVar "936" "Rec") (TpVar "942" "F")) "944")) "945")) (TpParens "948" (TpApp (TpVar "949" "Rec") (TpVar "955" "F")) "957"))))) (Lam "962" Erased "964" "F" NoClass (Lam "967" Erased "969" "fmap" NoClass (IotaPair "979" (Lam "980" Erased "982" "indices" NoClass (Lam "991" NotErased "993" "a" NoClass (Lam "996" Erased "998" "X" NoClass (Lam "1001" Erased "1003" "c" NoClass (App (App (App (Var "1006" "cast") Erased (Var "1012" "c")) Erased (Var "1015" "indices")) NotErased (Parens "1023" (App (App (App (Var "1024" "cast") Erased (Parens "1030" (App (Var "1031" "fmap") Erased (Parens "1037" (App (Var "1038" "recCast") Erased (Var "1047" "c")) "1049")) "1050")) Erased (Var "1052" "indices")) NotErased (Var "1060" "a")) "1062")))))) (Beta "1064" NoTerm NoTerm) NoGuide "1066")))) "1067") (CmdsNext (DefTermOrType OpacTrans (DefTerm "1069" "recOut" (SomeType (Abs "1078" Erased "1080" "F" (Tkk (KndArrow (KndParens "1084" (KndTpArrow (TpVar "1085" "Indices") (Star "1095")) "1097") (KndTpArrow (TpVar "1100" "Indices") (Star "1110")))) (TpArrow (TpApp (TpVar "1113" "RecFunctor") (TpVar "1126" "F")) Erased (TpApp (TpApp (TpVar "1140" "Cast") (TpParens "1147" (TpApp (TpVar "1148" "Rec") (TpVar "1154" "F")) "1156")) (TpParens "1159" (TpApp (TpVar "1160" "F") (TpParens "1164" (TpApp (TpVar "1165" "Rec") (TpVar "1171" "F")) "1173")) "1174"))))) (Lam "1179" Erased "1181" "F" NoClass (Lam "1184" Erased "1186" "fmap" NoClass (IotaPair "1192" (Lam "1193" Erased "1195" "indices" NoClass (Lam "1204" NotErased "1206" "a" NoClass (App (Var "1209" "a") Erased (Parens "1212" (App (Var "1213" "fmap") Erased (Parens "1219" (App (Var "1220" "recIn") Erased (Var "1227" "fmap")) "1232")) "1233")))) (Beta "1235" NoTerm NoTerm) NoGuide "1237")))) "1238") (CmdsNext (DefTermOrType OpacTrans (DefType "1240" "FixMF" (KndPi "1248" "1250" "F" (Tkk (KndArrow (KndParens "1254" (KndTpArrow (TpVar "1255" "Indices") (Star "1265")) "1267") (KndTpArrow (TpVar "1270" "Indices") (Star "1280")))) (KndTpArrow (TpApp (TpVar "1283" "RecFunctor") (TpVar "1296" "F")) (KndArrow (KndParens "1300" (KndTpArrow (TpVar "1301" "Indices") (Star "1311")) "1313") (KndTpArrow (TpVar "1316" "Indices") (Star "1326"))))) (TpLambda "1332" "1334" "F" (Tkk (KndArrow (KndParens "1338" (KndTpArrow (TpVar "1339" "Indices") (Star "1349")) "1351") (KndTpArrow (TpVar "1354" "Indices") (Star "1364")))) (TpLambda "1367" "1369" "fm" (Tkt (TpApp (TpVar "1374" "RecFunctor") (TpVar "1387" "F"))) (TpLambda "1394" "1396" "FixM" (Tkk (KndTpArrow (TpVar "1403" "Indices") (Star "1413"))) (TpLambda "1416" "1418" "indices" (Tkt (TpVar "1428" "Indices")) (Iota "1444" "1446" "x" (TpVar "1450" "Top") (Abs "1455" Erased "1457" "X" (Tkk (KndTpArrow (TpVar "1461" "Top") (KndTpArrow (TpVar "1467" "Indices") (Star "1477")))) (TpArrow (TpParens "1488" (Iota "1489" "1491" "alg" (TpVar "1497" "Top") (Abs "1511" Erased "1513" "R" (Tkk (KndTpArrow (TpVar "1517" "Indices") (Star "1527"))) (TpArrow (TpApp (TpApp (TpVar "1539" "Cast") (TpVar "1546" "R")) (TpVar "1550" "FixM")) Erased (TpArrow (TpParens "1566" (Iota "1567" "1569" "o" (Abs "1573" Erased "1575" "indices" (Tkt (TpVar "1585" "Indices")) (TpArrow (TpAppt (TpVar "1594" "R") (Var "1596" "indices")) NotErased (TpAppt (TpApp (TpVar "1606" "F") (TpVar "1610" "R")) (Var "1612" "indices")))) (TpEq "1632" (Var "1633" "o") (Lam "1637" NotErased "1639" "d" NoClass (App (Var "1642" "d") NotErased (Parens "1644" (Lam "1645" NotErased "1647" "e" NoClass (Lam "1650" NotErased "1652" "p" NoClass (Lam "1655" NotErased "1657" "d" NoClass (Var "1660" "d")))) "1662"))) "1663")) "1664") NotErased (TpArrow (TpParens "1676" (Iota "1677" "1679" "ih" (Abs "1684" Erased "1686" "indices" (Tkt (TpVar "1696" "Indices")) (Abs "1705" NotErased "1707" "r" (Tkt (TpAppt (TpVar "1711" "R") (Var "1713" "indices"))) (TpAppt (TpAppt (TpVar "1722" "X") (Beta "1724" NoTerm (SomeTerm (Var "1726" "r") "1728"))) (Var "1729" "indices")))) (TpEq "1738" (Var "1739" "ih") (Lam "1744" NotErased "1746" "d" NoClass (App (Var "1749" "d") NotErased (Var "1751" "alg"))) "1755")) "1756") NotErased (Abs "1768" Erased "1770" "indices" (Tkt (TpVar "1780" "Indices")) (Abs "1798" NotErased "1800" "x" (Tkt (TpAppt (TpApp (TpVar "1804" "F") (TpVar "1808" "R")) (Var "1810" "indices"))) (TpAppt (TpAppt (TpVar "1828" "X") (Beta "1830" NoTerm (SomeTerm (Lam "1832" NotErased "1834" "alg" NoClass (App (App (App (Var "1839" "alg") NotErased (Parens "1843" (Lam "1844" NotErased "1846" "d" NoClass (App (Var "1849" "d") NotErased (Parens "1851" (Lam "1852" NotErased "1854" "p" NoClass (Lam "1857" NotErased "1859" "e" NoClass (Lam "1862" NotErased "1864" "d" NoClass (Var "1867" "d")))) "1869"))) "1870")) NotErased (Parens "1871" (Lam "1872" NotErased "1874" "d" NoClass (App (Var "1877" "d") NotErased (Var "1879" "alg"))) "1883")) NotErased (Var "1884" "x"))) "1886"))) (Var "1887" "indices"))))))))) "1895") NotErased (TpAppt (TpAppt (TpVar "1906" "X") (Var "1908" "x")) (Var "1910" "indices")))))))))) "1918") (CmdsNext (DefTermOrType OpacTrans (DefType "1920" "FixM" (KndPi "1927" "1929" "F" (Tkk (KndArrow (KndParens "1933" (KndTpArrow (TpVar "1934" "Indices") (Star "1944")) "1946") (KndTpArrow (TpVar "1949" "Indices") (Star "1959")))) (KndTpArrow (TpApp (TpVar "1962" "RecFunctor") (TpVar "1975" "F")) (KndTpArrow (TpVar "1979" "Indices") (Star "1989")))) (TpLambda "1995" "1997" "F" (Tkk (KndArrow (KndParens "2001" (KndTpArrow (TpVar "2002" "Indices") (Star "2012")) "2014") (KndTpArrow (TpVar "2017" "Indices") (Star "2027")))) (TpLambda "2030" "2032" "fm" (Tkt (TpApp (TpVar "2037" "RecFunctor") (TpVar "2050" "F"))) (TpApp (TpVar "2053" "Rec") (TpParens "2059" (TpAppt (TpApp (TpVar "2060" "FixMF") (TpVar "2068" "F")) (Var "2070" "fm")) "2073"))))) "2074") (CmdsNext (DefTermOrType OpacTrans (DefTerm "2076" "FixFmap" (SomeType (Abs "2090" Erased "2092" "F" (Tkk (KndArrow (KndParens "2096" (KndTpArrow (TpVar "2097" "Indices") (Star "2107")) "2109") (KndTpArrow (TpVar "2112" "Indices") (Star "2122")))) (Abs "2125" Erased "2127" "fm" (Tkt (TpApp (TpVar "2132" "RecFunctor") (TpVar "2145" "F"))) (TpApp (TpVar "2148" "RecFunctor") (TpParens "2161" (TpAppt (TpApp (TpVar "2162" "FixMF") (TpVar "2170" "F")) (Var "2172" "fm")) "2175"))))) (Lam "2180" Erased "2182" "F" NoClass (Lam "2185" Erased "2187" "fm" NoClass (Lam "2191" Erased "2193" "D" NoClass (Lam "2196" Erased "2198" "D'" NoClass (Lam "2202" Erased "2204" "c" NoClass (IotaPair "2211" (Lam "2212" Erased "2214" "indices" NoClass (Lam "2223" NotErased "2225" "d" NoClass (IotaPair "2228" (IotaProj (Var "2229" "d") "1" "2232") (Lam "2234" Erased "2236" "X" NoClass (Lam "2239" NotErased "2241" "alg" NoClass (App (AppTp (IotaProj (Var "2246" "d") "2" "2249") (TpVar "2252" "X")) NotErased (IotaPair "2260" (IotaProj (Var "2261" "alg") "1" "2266") (Lam "2268" Erased "2270" "R" NoClass (Lam "2273" Erased "2275" "reveal" NoClass (App (AppTp (IotaProj (Var "2283" "alg") "2" "2288") (TpVar "2291" "R")) Erased (IotaPair "2302" (Lam "2303" Erased "2305" "indices" NoClass (Lam "2314" NotErased "2316" "r" NoClass (App (App (App (Var "2319" "cast") Erased (Var "2325" "c")) Erased (Var "2328" "indices")) NotErased (Parens "2336" (App (App (App (Var "2337" "cast") Erased (Var "2343" "reveal")) Erased (Var "2351" "indices")) NotErased (Var "2359" "r")) "2361")))) (Beta "2363" NoTerm NoTerm) NoGuide "2365")))) NoGuide "2366")))) NoGuide "2367"))) (Beta "2369" NoTerm NoTerm) NoGuide "2371"))))))) "2372") (CmdsNext (DefTermOrType OpacTrans (DefTerm "2374" "inFixM" (SomeType (Abs "2387" Erased "2389" "F" (Tkk (KndArrow (KndParens "2393" (KndTpArrow (TpVar "2394" "Indices") (Star "2404")) "2406") (KndTpArrow (TpVar "2409" "Indices") (Star "2419")))) (Abs "2422" Erased "2424" "fm" (Tkt (TpApp (TpVar "2429" "RecFunctor") (TpVar "2442" "F"))) (Abs "2449" Erased "2451" "indices" (Tkt (TpVar "2461" "Indices")) (TpArrow (TpAppt (TpApp (TpAppt (TpApp (TpVar "2470" "FixMF") (TpVar "2478" "F")) (Var "2480" "fm")) (TpParens "2485" (TpAppt (TpApp (TpVar "2486" "FixM") (TpVar "2493" "F")) (Var "2495" "fm")) "2498")) (Var "2499" "indices")) NotErased (TpAppt (TpAppt (TpApp (TpVar "2509" "FixM") (TpVar "2516" "F")) (Var "2518" "fm")) (Var "2521" "indices"))))))) (Lam "2533" Erased "2535" "F" NoClass (Lam "2538" Erased "2540" "fm" NoClass (App (Var "2544" "cast") Erased (Parens "2550" (App (Var "2551" "recIn") Erased (Parens "2558" (App (Var "2559" "FixFmap") NotErased (Var "2567" "fm")) "2570")) "2571"))))) "2572") (CmdsNext (DefTermOrType OpacTrans (DefTerm "2573" "outFixM" (SomeType (Abs "2583" Erased "2585" "F" (Tkk (KndArrow (KndParens "2589" (KndTpArrow (TpVar "2590" "Indices") (Star "2600")) "2602") (KndTpArrow (TpVar "2605" "Indices") (Star "2615")))) (Abs "2618" Erased "2620" "fm" (Tkt (TpApp (TpVar "2625" "RecFunctor") (TpVar "2638" "F"))) (Abs "2645" Erased "2647" "indices" (Tkt (TpVar "2657" "Indices")) (TpArrow (TpAppt (TpAppt (TpApp (TpVar "2666" "FixM") (TpVar "2673" "F")) (Var "2675" "fm")) (Var "2678" "indices")) NotErased (TpAppt (TpApp (TpAppt (TpApp (TpVar "2688" "FixMF") (TpVar "2696" "F")) (Var "2698" "fm")) (TpParens "2703" (TpAppt (TpApp (TpVar "2704" "FixM") (TpVar "2711" "F")) (Var "2713" "fm")) "2716")) (Var "2717" "indices"))))))) (Lam "2729" Erased "2731" "F" NoClass (Lam "2734" Erased "2736" "fm" NoClass (App (Var "2740" "cast") Erased (Parens "2746" (App (Var "2747" "recOut") Erased (Parens "2755" (App (Var "2756" "FixFmap") NotErased (Var "2764" "fm")) "2767")) "2768"))))) "2769") (CmdsNext (DefTermOrType OpacTrans (DefTerm "2771" "inFix" (SomeType (Abs "2783" Erased "2785" "F" (Tkk (KndArrow (KndParens "2789" (KndTpArrow (TpVar "2790" "Indices") (Star "2800")) "2802") (KndTpArrow (TpVar "2805" "Indices") (Star "2815")))) (Abs "2818" Erased "2820" "fm" (Tkt (TpApp (TpVar "2825" "RecFunctor") (TpVar "2838" "F"))) (Abs "2845" Erased "2847" "indices" (Tkt (TpVar "2857" "Indices")) (TpArrow (TpAppt (TpApp (TpVar "2866" "F") (TpParens "2870" (TpAppt (TpApp (TpVar "2871" "FixM") (TpVar "2878" "F")) (Var "2880" "fm")) "2883")) (Var "2884" "indices")) NotErased (TpAppt (TpAppt (TpApp (TpVar "2894" "FixM") (TpVar "2901" "F")) (Var "2903" "fm")) (Var "2906" "indices"))))))) (Lam "2918" Erased "2920" "F" NoClass (Lam "2923" Erased "2925" "fm" NoClass (Lam "2929" Erased "2931" "indices" NoClass (Lam "2940" NotErased "2942" "d" NoClass (App (App (App (Var "2945" "inFixM") Erased (Var "2953" "fm")) Erased (Var "2957" "indices")) NotErased (IotaPair "2967" (Beta "2968" NoTerm (SomeTerm (Lam "2970" NotErased "2972" "alg" NoClass (App (App (App (Var "2977" "alg") NotErased (Parens "2981" (Lam "2982" NotErased "2984" "d" NoClass (App (Var "2987" "d") NotErased (Parens "2989" (Lam "2990" NotErased "2992" "p" NoClass (Lam "2995" NotErased "2997" "e" NoClass (Lam "3000" NotErased "3002" "d" NoClass (Var "3005" "d")))) "3007"))) "3008")) NotErased (Parens "3009" (Lam "3010" NotErased "3012" "d" NoClass (App (Var "3015" "d") NotErased (Var "3017" "alg"))) "3021")) NotErased (Var "3022" "d"))) "3024")) (Lam "3029" Erased "3031" "X" NoClass (Lam "3034" NotErased "3036" "alg" NoClass (App (App (App (App (App (AppTp (IotaProj (Var "3041" "alg") "2" "3046") (TpParens "3049" (TpAppt (TpApp (TpVar "3050" "FixM") (TpVar "3057" "F")) (Var "3059" "fm")) "3062")) Erased (IotaPair "3064" (Lam "3065" Erased "3067" "indices" NoClass (Lam "3076" NotErased "3078" "d" NoClass (Var "3081" "d"))) (Beta "3084" NoTerm NoTerm) NoGuide "3086")) NotErased (IotaPair "3092" (Lam "3093" Erased "3095" "indices" NoClass (Lam "3104" NotErased "3106" "d" NoClass (App (AppTp (IotaProj (Parens "3109" (App (App (App (Var "3110" "outFixM") Erased (Var "3119" "fm")) Erased (Var "3123" "indices")) NotErased (Var "3131" "d")) "3133") "2" "3135") (TpParens "3138" (TpLambda "3139" "3141" "x" (Tkt (TpVar "3145" "Top")) (TpApp (TpVar "3150" "F") (TpParens "3154" (TpAppt (TpApp (TpVar "3155" "FixM") (TpVar "3162" "F")) (Var "3164" "fm")) "3167"))) "3168")) NotErased (IotaPair "3176" (Beta "3177" NoTerm (SomeTerm (Lam "3179" NotErased "3181" "p" NoClass (Lam "3184" NotErased "3186" "e" NoClass (Lam "3189" NotErased "3191" "d" NoClass (Var "3194" "d")))) "3196")) (Lam "3198" Erased "3200" "X" NoClass (Lam "3203" Erased "3205" "reveal" NoClass (Lam "3213" NotErased "3215" "p" NoClass (Lam "3218" NotErased "3220" "e" NoClass (App (Var "3223" "cast") Erased (Parens "3229" (App (Var "3230" "fm") Erased (Var "3234" "reveal")) "3241")))))) NoGuide "3242")))) (Beta "3252" NoTerm (SomeTerm (Lam "3254" NotErased "3256" "d" NoClass (App (Var "3259" "d") NotErased (Parens "3261" (Lam "3262" NotErased "3264" "p" NoClass (Lam "3267" NotErased "3269" "e" NoClass (Lam "3272" NotErased "3274" "d" NoClass (Var "3277" "d")))) "3279"))) "3280")) NoGuide "3281")) NotErased (IotaPair "3287" (Lam "3288" Erased "3290" "indices" NoClass (Lam "3299" NotErased "3301" "d" NoClass (App (AppTp (IotaProj (Parens "3304" (App (App (App (Var "3305" "outFixM") Erased (Var "3314" "fm")) Erased (Var "3318" "indices")) NotErased (Var "3326" "d")) "3328") "2" "3330") (TpVar "3333" "X")) NotErased (Var "3335" "alg")))) (Beta "3340" NoTerm (SomeTerm (Lam "3342" NotErased "3344" "d" NoClass (App (Var "3347" "d") NotErased (Var "3349" "alg"))) "3353")) NoGuide "3354")) Erased (Var "3356" "indices")) NotErased (Var "3364" "d")))) NoGuide "3366"))))))) "3367") (CmdsNext (DefTermOrType OpacTrans (DefTerm "3369" "IndFixM" (SomeType (Abs "3383" Erased "3385" "F" (Tkk (KndArrow (KndParens "3389" (KndTpArrow (TpVar "3390" "Indices") (Star "3400")) "3402") (KndTpArrow (TpVar "3405" "Indices") (Star "3415")))) (Abs "3422" Erased "3424" "fm" (Tkt (TpApp (TpVar "3429" "RecFunctor") (TpVar "3442" "F"))) (Abs "3449" Erased "3451" "indices" (Tkt (TpVar "3461" "Indices")) (Abs "3474" NotErased "3476" "d" (Tkt (TpAppt (TpAppt (TpApp (TpVar "3480" "FixM") (TpVar "3487" "F")) (Var "3489" "fm")) (Var "3492" "indices"))) (Abs "3505" Erased "3507" "Q" (Tkk (KndPi "3511" "3513" "indices" (Tkt (TpVar "3523" "Indices")) (KndTpArrow (TpAppt (TpAppt (TpApp (TpVar "3532" "FixM") (TpVar "3539" "F")) (Var "3541" "fm")) (Var "3544" "indices")) (Star "3554")))) (TpArrow (TpParens "3561" (Iota "3562" "3564" "alg" (TpVar "3570" "Top") (Abs "3582" Erased "3584" "R" (Tkk (KndTpArrow (TpVar "3588" "Indices") (Star "3598"))) (Abs "3608" Erased "3610" "reveal" (Tkt (TpApp (TpApp (TpVar "3619" "Cast") (TpVar "3626" "R")) (TpParens "3630" (TpAppt (TpApp (TpVar "3631" "FixM") (TpVar "3638" "F")) (Var "3640" "fm")) "3643"))) (TpArrow (TpParens "3652" (Iota "3653" "3655" "o" (Abs "3659" Erased "3661" "indices" (Tkt (TpVar "3671" "Indices")) (TpArrow (TpAppt (TpVar "3680" "R") (Var "3682" "indices")) NotErased (TpAppt (TpApp (TpVar "3692" "F") (TpVar "3696" "R")) (Var "3698" "indices")))) (TpEq "3717" (Var "3718" "o") (Lam "3722" NotErased "3724" "d" NoClass (App (Var "3727" "d") NotErased (Parens "3729" (Lam "3730" NotErased "3732" "p" NoClass (Lam "3735" NotErased "3737" "e" NoClass (Lam "3740" NotErased "3742" "d" NoClass (Var "3745" "d")))) "3747"))) "3748")) "3749") NotErased (TpArrow (TpParens "3759" (Iota "3760" "3762" "ih" (Abs "3767" Erased "3769" "indices" (Tkt (TpVar "3779" "Indices")) (Abs "3788" NotErased "3790" "r" (Tkt (TpAppt (TpVar "3794" "R") (Var "3796" "indices"))) (TpAppt (TpAppt (TpVar "3814" "Q") (Var "3816" "indices")) (Parens "3824" (App (App (App (Var "3825" "cast") Erased (Var "3831" "reveal")) Erased (Var "3839" "indices")) NotErased (Var "3847" "r")) "3849")))) (TpEq "3851" (Var "3852" "ih") (Lam "3857" NotErased "3859" "d" NoClass (App (Var "3862" "d") NotErased (Var "3864" "alg"))) "3868")) "3869") NotErased (Abs "3879" Erased "3881" "indices" (Tkt (TpVar "3891" "Indices")) (Abs "3907" NotErased "3909" "x" (Tkt (TpAppt (TpApp (TpVar "3913" "F") (TpVar "3917" "R")) (Var "3919" "indices"))) (TpAppt (TpAppt (TpVar "3935" "Q") (Var "3937" "indices")) (Parens "3945" (App (App (App (Var "3946" "inFix") Erased (Var "3953" "fm")) Erased (Var "3957" "indices")) NotErased (Parens "3965" (App (App (App (Var "3966" "cast") Erased (Parens "3972" (App (Var "3973" "fm") Erased (Var "3977" "reveal")) "3984")) Erased (Var "3986" "indices")) NotErased (Var "3994" "x")) "3996")) "3997"))))))))) "3998") NotErased (TpAppt (TpAppt (TpVar "4005" "Q") (Var "4007" "indices")) (Var "4015" "d"))))))))) (Lam "4021" Erased "4023" "F" NoClass (Lam "4026" Erased "4028" "fm" NoClass (Lam "4032" Erased "4034" "indices" NoClass (Lam "4043" NotErased "4045" "d" NoClass (Lam "4048" Erased "4050" "Q" NoClass (Lam "4053" NotErased "4055" "alg" NoClass (App (App (App (AppTp (IotaProj (Parens "4060" (App (App (App (Var "4061" "outFixM") Erased (Var "4070" "fm")) Erased (Var "4074" "indices")) NotErased (Var "4082" "d")) "4084") "2" "4086") (TpParens "4093" (TpLambda "4094" "4096" "d" (Tkt (TpVar "4100" "Top")) (TpLambda "4105" "4107" "indices" (Tkt (TpVar "4117" "Indices")) (Abs "4135" Erased "4137" "d'" (Tkt (TpAppt (TpAppt (TpApp (TpVar "4142" "FixM") (TpVar "4149" "F")) (Var "4151" "fm")) (Var "4154" "indices"))) (Abs "4163" Erased "4165" "e" (Tkt (TpEq "4169" (Var "4170" "d'") (Var "4175" "d") "4177")) (TpAppt (TpAppt (TpVar "4179" "Q") (Var "4181" "indices")) (Parens "4189" (Phi "4190" (Var "4192" "e") (Var "4196" "d'") (Var "4200" "d") "4202") "4203")))))) "4204")) NotErased (IotaPair "4209" (Beta "4210" NoTerm (SomeTerm (Var "4212" "alg") "4216")) (Lam "4218" Erased "4220" "R" NoClass (Lam "4223" Erased "4225" "reveal" NoClass (Lam "4233" NotErased "4235" "out" NoClass (Lam "4240" NotErased "4242" "ih" NoClass (Lam "4246" Erased "4248" "indices" NoClass (Lam "4257" NotErased "4259" "d" NoClass (Lam "4262" Erased "4264" "d'" NoClass (Lam "4268" Erased "4270" "e" NoClass (App (App (App (App (App (AppTp (IotaProj (Var "4273" "alg") "2" "4278") (TpVar "4281" "R")) Erased (Var "4284" "reveal")) NotErased (Var "4291" "out")) NotErased (IotaPair "4301" (Lam "4302" Erased "4304" "indices" NoClass (Lam "4313" NotErased "4315" "r" NoClass (App (App (App (App (IotaProj (Var "4318" "ih") "1" "4322") Erased (Var "4324" "indices")) NotErased (Var "4332" "r")) Erased (Parens "4335" (App (App (App (Var "4336" "cast") Erased (Var "4342" "reveal")) Erased (Var "4350" "indices")) NotErased (Var "4358" "r")) "4360")) Erased (Beta "4362" NoTerm NoTerm)))) (IotaProj (Var "4365" "ih") "2" "4369") NoGuide "4370")) Erased (Var "4372" "indices")) NotErased (Var "4380" "d")))))))))) NoGuide "4382")) Erased (Var "4389" "d")) Erased (Beta "4392" NoTerm NoTerm))))))))) "4394") CmdsStart))))))))))))))) "4394"
| 7,917.384615
| 79,494
| 0.631259
|
ccf9e29db028a772de42469ac1dbc79839102017
| 626
|
agda
|
Agda
|
src/Everything.agda
|
andreasabel/cubical
|
914f655c7c0417754c2ffe494d3f6ea7a357b1c3
|
[
"MIT"
] | null | null | null |
src/Everything.agda
|
andreasabel/cubical
|
914f655c7c0417754c2ffe494d3f6ea7a357b1c3
|
[
"MIT"
] | null | null | null |
src/Everything.agda
|
andreasabel/cubical
|
914f655c7c0417754c2ffe494d3f6ea7a357b1c3
|
[
"MIT"
] | null | null | null |
module Everything where
import Control.Category
import Control.Category.Functor
import Control.Category.Product
import Control.Category.SetsAndFunctions
import Control.Category.Slice
import Control.Decoration
import Control.Functor
import Control.Functor.NaturalTransformation
import Control.Functor.Product
import Control.Kleisli
import Control.Lens
import Control.Monad
import Control.Monad.Error
import Control.Monad.KleisliTriple
import Control.Comonad
import Control.Comonad.Store
import Dimension.PartialWeakening
import Dimension.PartialWeakening.Model
-- import Dimension.PartialWeakening.Soundness -- still broken
| 26.083333
| 62
| 0.86901
|
524e8ec8405264df078464f0aacc05c6b2fbf527
| 661
|
agda
|
Agda
|
test/Succeed/ProjectionLikeAndModules1.agda
|
mdimjasevic/agda
|
8fb548356b275c7a1e79b768b64511ae937c738b
|
[
"BSD-3-Clause"
] | 1,989
|
2015-01-09T23:51:16.000Z
|
2022-03-30T18:20:48.000Z
|
test/Succeed/ProjectionLikeAndModules1.agda
|
Seanpm2001-languages/agda
|
9911f73061e21a87fad76c662463257afe02c861
|
[
"BSD-2-Clause"
] | 4,066
|
2015-01-10T11:24:51.000Z
|
2022-03-31T21:14:49.000Z
|
test/Succeed/ProjectionLikeAndModules1.agda
|
Seanpm2001-languages/agda
|
9911f73061e21a87fad76c662463257afe02c861
|
[
"BSD-2-Clause"
] | 371
|
2015-01-03T14:04:08.000Z
|
2022-03-30T19:00:30.000Z
|
-- {-# OPTIONS -v tc.proj.like:10 #-} {-# OPTIONS -v tc.conv:10 #-}
import Common.Level
module ProjectionLikeAndModules1 (A : Set) (a : A) where
record ⊤ : Set where
constructor tt
data Wrap (W : Set) : Set where
wrap : W → Wrap W
data Bool : Set where
true false : Bool
-- `or' should be projection like in the module parameters
if : Bool → {B : Set} → B → B → B
if true a b = a
if false a b = b
postulate
u v : ⊤
P : Wrap ⊤ -> Set
test : (y : Bool)
-> P (if y (wrap u) (wrap tt))
-> P (if y (wrap tt) (wrap v))
test y h = h
-- Error:
-- u != tt of type Set
-- when checking that the expression h has type
-- P (if y (wrap tt) (wrap v))
| 20.030303
| 67
| 0.593041
|
d1c108ee6a750c4ee99c7a159b7494d34c16309f
| 3,644
|
agda
|
Agda
|
src/Data/Vec/Membership/Propositional/Distinct/Properties.agda
|
tizmd/agda-distinct-disjoint
|
d4cd2a3442a9b58e6139499d16a2b31268f27f80
|
[
"MIT"
] | null | null | null |
src/Data/Vec/Membership/Propositional/Distinct/Properties.agda
|
tizmd/agda-distinct-disjoint
|
d4cd2a3442a9b58e6139499d16a2b31268f27f80
|
[
"MIT"
] | null | null | null |
src/Data/Vec/Membership/Propositional/Distinct/Properties.agda
|
tizmd/agda-distinct-disjoint
|
d4cd2a3442a9b58e6139499d16a2b31268f27f80
|
[
"MIT"
] | null | null | null |
module Data.Vec.Membership.Propositional.Distinct.Properties where
open import Data.Fin as Fin
open import Relation.Binary.PropositionalEquality as P
open import Data.Vec as Vec using (Vec; [] ; _∷_ ; _++_)
open import Data.Vec.Any
open import Data.Vec.Membership.Propositional.Distinct
open import Data.Vec.Membership.Propositional.Disjoint renaming (Disjoint to _⋈_)
open import Data.Vec.Membership.Propositional.Properties
open import Data.Vec.Membership.Propositional
open import Data.Product
open import Data.Empty using (⊥-elim)
open import Function using (_∘_)
open import Function.Equivalence using (_⇔_; equivalence)
distinct-++ˡ : ∀ {a}{A : Set a}{m n} (xs : Vec A m){ys : Vec A n} → Distinct (xs ++ ys) → Distinct xs
distinct-++ˡ [] dis = distinct-[]
distinct-++ˡ (x ∷ xs) (.x distinct-∷ dis by x∉xsys) = x distinct-∷ distinct-++ˡ xs dis by λ x∈xs → x∉xsys (∈-++⁺ˡ x∈xs)
distinct-++ʳ : ∀ {a}{A : Set a}{m n} (xs : Vec A m) {ys : Vec A n} → Distinct (xs ++ ys) → Distinct ys
distinct-++ʳ [] dys = dys
distinct-++ʳ (x ∷ xs) (.x distinct-∷ dxsys by _) = distinct-++ʳ xs dxsys
distinct-++→disjoint : ∀ {a}{A : Set a}{m n} (xs : Vec A m) {ys : Vec A n} → Distinct (xs ++ ys) → xs ⋈ ys
distinct-++→disjoint [] dxsys {z} () z∈ys
distinct-++→disjoint (x ∷ xs) (.x distinct-∷ dxsys by x∉xsys) {.x} (here refl) x∈ys = x∉xsys (∈-++⁺ʳ xs x∈ys)
distinct-++→disjoint (x ∷ xs) (.x distinct-∷ dxsys by x₁) {z} (there z∈xs) z∈ys = distinct-++→disjoint xs dxsys z∈xs z∈ys
⋈→distinct-++ : ∀ {a}{A : Set a}{m n}{xs : Vec A m}{ys : Vec A n} → Distinct xs → Distinct ys → xs ⋈ ys → Distinct (xs ++ ys)
⋈→distinct-++ {xs = []} _ dys _ = dys
⋈→distinct-++ {xs = x ∷ xs} (.x distinct-∷ dxs by x∉xs) dys xxs⋈ys = x distinct-∷ ⋈→distinct-++ dxs dys (xxs⋈ys ∘ there)
by λ x∈xs++ys → xxs⋈ys (here P.refl) (x∈xs++ys→x∉xs→x∈ys xs x∈xs++ys x∉xs)
where
x∈xs++ys→x∉xs→x∈ys : ∀ {a} {A : Set a} {m n} (xs : Vec A m){ys : Vec A n} →
∀ {x} → x ∈ xs ++ ys → x ∉ xs → x ∈ ys
x∈xs++ys→x∉xs→x∈ys [] x∈ys _ = x∈ys
x∈xs++ys→x∉xs→x∈ys (x ∷ xs) (here refl) x∉xs = ⊥-elim (x∉xs (here refl))
x∈xs++ys→x∉xs→x∈ys (x ∷ xs) (there x∈xsys) x∉xs = x∈xs++ys→x∉xs→x∈ys xs x∈xsys (x∉xs ∘ there)
distinct-++⇔⋈ : ∀ {a}{A : Set a}{m n} {xs : Vec A m}{ys : Vec A n} →
Distinct (xs ++ ys) ⇔ (Distinct xs × Distinct ys × xs ⋈ ys)
distinct-++⇔⋈ = equivalence to from
where
open import Data.Nat.Properties
to : ∀ {a}{A : Set a} {m n} {xs : Vec A m}{ys : Vec A n} →
Distinct (xs ++ ys) → (Distinct xs × Distinct ys × xs ⋈ ys)
to {xs = xs} dxsys = distinct-++ˡ xs dxsys , distinct-++ʳ xs dxsys , distinct-++→disjoint xs dxsys
from : ∀ {a}{A : Set a} {m n} {xs : Vec A m}{ ys : Vec A n} →
(Distinct xs × Distinct ys × xs ⋈ ys) → Distinct (xs ++ ys)
from (dxs , dys , xs⋈ys) = ⋈→distinct-++ dxs dys xs⋈ys
private
lookup-∈ : ∀ {a n}{A : Set a} i (xs : Vec A n) → Vec.lookup i xs ∈ xs
lookup-∈ () []
lookup-∈ zero (x ∷ xs) = here P.refl
lookup-∈ (suc i) (x ∷ xs) = there (lookup-∈ i xs)
lookup-injective : ∀ {a n}{A : Set a} {xs : Vec A n}{i j} →
Distinct xs → Vec.lookup i xs ≡ Vec.lookup j xs → i ≡ j
lookup-injective {i = ()} {j} distinct-[] _
lookup-injective {i = zero} {zero} (x distinct-∷ dxs by x∉xs) eq = P.refl
lookup-injective {i = suc i} {suc j} (x distinct-∷ dxs by x∉xs) eq = P.cong Fin.suc (lookup-injective dxs eq)
lookup-injective {xs = _ ∷ xs} {i = zero} {suc j} (x distinct-∷ dxs by x∉xs) eq rewrite eq =
⊥-elim (x∉xs (lookup-∈ j xs))
lookup-injective {xs = _ ∷ xs} {i = suc i} {zero} (x distinct-∷ dxs by x∉xs) eq rewrite P.sym eq = ⊥-elim (x∉xs (lookup-∈ i xs))
| 54.38806
| 129
| 0.589737
|
03d89ebde2ae6216930409c5aa8c7f0e2bdd2a26
| 28,596
|
agda
|
Agda
|
archive/agda-3/src/AgdaFeaturePitfallInstanceResolution.agda
|
m0davis/oscar
|
52e1cdbdee54d9a8eaee04ee518a0d7f61d25afb
|
[
"RSA-MD"
] | null | null | null |
archive/agda-3/src/AgdaFeaturePitfallInstanceResolution.agda
|
m0davis/oscar
|
52e1cdbdee54d9a8eaee04ee518a0d7f61d25afb
|
[
"RSA-MD"
] | 1
|
2019-04-29T00:35:04.000Z
|
2019-05-11T23:33:04.000Z
|
archive/agda-3/src/AgdaFeaturePitfallInstanceResolution.agda
|
m0davis/oscar
|
52e1cdbdee54d9a8eaee04ee518a0d7f61d25afb
|
[
"RSA-MD"
] | null | null | null |
{-# OPTIONS --allow-unsolved-metas #-}
{-
The moral of the story is best told by comparing RegularVsConstructedMoreSimpler and RegularVsConstructed-EnhancedReg:
* aliased type constructors can lose information about their dependencies, leading to some inconvenience when using a function which takes those dependencies implicitly
* expressing those constructors as records (instead of as aliases) averts the above inconvenience
* the loss of information happens when the resultant type is made from projections on the dependencies, where only a proper subset of all the possible projections are used
TODO: what if instead of projections, we use a function? (try one that's abstract, and one that case splits on arguments)
- see ProjectedMorality ... so far it looks like it doesn't matter --- not sure why
TODO: what if the argument type (the one that's losing information) were data instead of record?
- see DataMorality ... weirdness!
-}
module AgdaFeaturePitfallInstanceResolution where
record Symmetry {B : Set₁} (_∼_ : B → B → Set) : Set₁ where
field symmetry : ∀ {x y} → x ∼ y → y ∼ x
Property : Set → Set₁
Property A = A → Set
Extension : {A : Set} → Property A → Set
Extension P = ∀ f → P f
postulate PropertyEquivalence : ∀ {P : Set} → Property P → Property P → Set
record Regular : Set where
no-eta-equality
infixr 5 _,_
record Σ (𝔒 : Set₁) (𝔓 : 𝔒 → Set) : Set₁ where
constructor _,_
field
π₀ : 𝔒
π₁ : 𝔓 π₀
open Σ public
ExtensionProperty : ∀ (𝔒 : Set) → Set₁
ExtensionProperty 𝔒 = Σ (Property 𝔒) Extension
_≈_ : {𝔒 : Set} → ExtensionProperty 𝔒 → ExtensionProperty 𝔒 → Set
_≈_ P Q = PropertyEquivalence (π₀ P) (π₀ Q)
record Instance : Set where
no-eta-equality
postulate instance _ : ∀ {𝔒 : Set} → Symmetry (_≈_ {𝔒 = 𝔒})
open Symmetry ⦃ … ⦄
module Test {𝔒 : Set} where
test1-fails : {P Q : ExtensionProperty 𝔒} → P ≈ Q → Q ≈ P
test1-fails P≈Q = symmetry P≈Q
test2-works : {P Q : ExtensionProperty 𝔒} → P ≈ Q → Q ≈ P
test2-works {P} {Q} P≈Q = symmetry {x = P} {y = Q} P≈Q
test3-fails : {P Q : ExtensionProperty 𝔒} → P ≈ Q → Q ≈ P
test3-fails {P} {Q} P≈Q = symmetry {x = _ , _} {y = _ , _} P≈Q
test4-works : {P Q : ExtensionProperty 𝔒} → P ≈ Q → Q ≈ P
test4-works {P} {Q} P≈Q = symmetry {x = _ , π₁ P} {y = _ , π₁ Q} P≈Q
record Function : Set where
no-eta-equality
postulate symmetry : ∀ {𝔒} {x y : ExtensionProperty 𝔒} → x ≈ y → y ≈ x
-- normalises to : {𝔒 : Set} {x y : Σ (𝔒 → Set) (λ P → (f : 𝔒) → P f)} → PropertyEquivalence (π₀ x) (π₀ y) → PropertyEquivalence (π₀ y) (π₀ x)
module Test {𝔒 : Set} where
test1-fails : {P Q : ExtensionProperty 𝔒} → P ≈ Q → Q ≈ P
test1-fails P≈Q = symmetry P≈Q
test2-works : {P Q : ExtensionProperty 𝔒} → P ≈ Q → Q ≈ P
test2-works {P} {Q} P≈Q = symmetry {x = P} {y = Q} P≈Q
test3-fails : {P Q : ExtensionProperty 𝔒} → P ≈ Q → Q ≈ P
test3-fails {P} {Q} P≈Q = symmetry {x = _ , _} {y = _ , _} P≈Q
test4-works : {P Q : ExtensionProperty 𝔒} → P ≈ Q → Q ≈ P
test4-works {P} {Q} P≈Q = symmetry {x = _ , π₁ P} {y = _ , π₁ Q} P≈Q
record Revamped : Set where
no-eta-equality
record ExtensionProperty (𝔒 : Set) : Set₁ where
constructor _,_
field
π₀ : Property 𝔒
π₁ : Extension π₀
open ExtensionProperty
_≈_ : {𝔒 : Set} → ExtensionProperty 𝔒 → ExtensionProperty 𝔒 → Set
_≈_ P Q = PropertyEquivalence (π₀ P) (π₀ Q)
record Instance : Set where
no-eta-equality
postulate instance _ : ∀ {𝔒 : Set} → Symmetry (_≈_ {𝔒 = 𝔒})
open Symmetry ⦃ … ⦄
module Test {𝔒 : Set} where
test1-fails : {P Q : ExtensionProperty 𝔒} → P ≈ Q → Q ≈ P
test1-fails P≈Q = symmetry P≈Q
test2-works : {P Q : ExtensionProperty 𝔒} → P ≈ Q → Q ≈ P
test2-works {P} {Q} P≈Q = symmetry {x = P} {y = Q} P≈Q
test3-fails : {P Q : ExtensionProperty 𝔒} → P ≈ Q → Q ≈ P
test3-fails {P} {Q} P≈Q = symmetry {x = _ , _} {y = _ , _} P≈Q
test4-works : {P Q : ExtensionProperty 𝔒} → P ≈ Q → Q ≈ P
test4-works {P} {Q} P≈Q = symmetry {x = _ , π₁ P} {y = _ , π₁ Q} P≈Q
record Function : Set where
no-eta-equality
postulate symmetry : ∀ {𝔒} {x y : ExtensionProperty 𝔒} → x ≈ y → y ≈ x
-- normalises to : ∀ {𝔒} {x y : ExtensionProperty 𝔒} → PropertyEquivalence (π₀ x) (π₀ y) → PropertyEquivalence (π₀ y) (π₀ x)
module Test {𝔒 : Set} where
test1-fails : {P Q : ExtensionProperty 𝔒} → P ≈ Q → Q ≈ P
test1-fails P≈Q = symmetry P≈Q
test2-works : {P Q : ExtensionProperty 𝔒} → P ≈ Q → Q ≈ P
test2-works {P} {Q} P≈Q = symmetry {x = P} {y = Q} P≈Q
test3-fails : {P Q : ExtensionProperty 𝔒} → P ≈ Q → Q ≈ P
test3-fails {P} {Q} P≈Q = symmetry {x = _ , _} {y = _ , _} P≈Q
test4-works : {P Q : ExtensionProperty 𝔒} → P ≈ Q → Q ≈ P
test4-works {P} {Q} P≈Q = symmetry {x = _ , π₁ P} {y = _ , π₁ Q} P≈Q
record PostulatedExtensionProperty : Set where
no-eta-equality
postulate
ExtensionProperty : Set → Set₁
π₀ : {𝔒 : Set} → ExtensionProperty 𝔒 → Property 𝔒
π₁ : {𝔒 : Set} → (P : ExtensionProperty 𝔒) → Extension (π₀ P)
_,_ : {𝔒 : Set} → (π₀ : Property 𝔒) → Extension π₀ → ExtensionProperty 𝔒
_≈_ : {𝔒 : Set} → ExtensionProperty 𝔒 → ExtensionProperty 𝔒 → Set
_≈_ P Q = PropertyEquivalence (π₀ P) (π₀ Q)
record Instance : Set where
no-eta-equality
postulate instance _ : ∀ {𝔒 : Set} → Symmetry (_≈_ {𝔒 = 𝔒})
open Symmetry ⦃ … ⦄
module Test {𝔒 : Set} where
test1-works : {P Q : ExtensionProperty 𝔒} → P ≈ Q → Q ≈ P
test1-works P≈Q = symmetry P≈Q
test2-works : {P Q : ExtensionProperty 𝔒} → P ≈ Q → Q ≈ P
test2-works {P} {Q} P≈Q = symmetry {x = P} {y = Q} P≈Q
test3-inexpressible : {P Q : ExtensionProperty 𝔒} → P ≈ Q → Q ≈ P
test3-inexpressible {P} {Q} P≈Q = {!!} -- symmetry {x = _ , _} {y = _ , _} P≈Q
test4-inexpressible : {P Q : ExtensionProperty 𝔒} → P ≈ Q → Q ≈ P
test4-inexpressible {P} {Q} P≈Q = {!!} -- symmetry {x = _ , π₁ P} {y = _ , π₁ Q} P≈Q
record Function : Set where
no-eta-equality
postulate symmetry : ∀ {𝔒} {x y : ExtensionProperty 𝔒} → x ≈ y → y ≈ x
-- normalises to : ∀ {𝔒} {x y : ExtensionProperty 𝔒} → PropertyEquivalence (π₀ x) (π₀ y) → PropertyEquivalence (π₀ y) (π₀ x)
module Test {𝔒 : Set} where
test1-works : {P Q : ExtensionProperty 𝔒} → P ≈ Q → Q ≈ P
test1-works P≈Q = symmetry P≈Q
test2-works : {P Q : ExtensionProperty 𝔒} → P ≈ Q → Q ≈ P
test2-works {P} {Q} P≈Q = symmetry {x = P} {y = Q} P≈Q
test3-inexpressible : {P Q : ExtensionProperty 𝔒} → P ≈ Q → Q ≈ P
test3-inexpressible {P} {Q} P≈Q = {!!} -- symmetry {x = _ , _} {y = _ , _} P≈Q
test4-inexpressible : {P Q : ExtensionProperty 𝔒} → P ≈ Q → Q ≈ P
test4-inexpressible {P} {Q} P≈Q = {!!} -- symmetry {x = _ , π₁ P} {y = _ , π₁ Q} P≈Q
record Constructed : Set where
no-eta-equality
infixr 5 _,_
record Σ (𝔒 : Set₁) (𝔓 : 𝔒 → Set) : Set₁ where
constructor _,_
field
π₀ : 𝔒
π₁ : 𝔓 π₀
open Σ public
ExtensionProperty : Set → Set₁
ExtensionProperty 𝔒 = Σ (Property 𝔒) Extension
record _≈_ {𝔒 : Set} (P Q : ExtensionProperty 𝔒) : Set where
constructor ∁
field
π₀ : PropertyEquivalence (π₀ P) (π₀ Q)
record Instance : Set where
no-eta-equality
postulate instance _ : {𝔒 : Set} → Symmetry (_≈_ {𝔒 = 𝔒})
open Symmetry ⦃ … ⦄
module Test {𝔒 : Set} where
test1-works : {P Q : ExtensionProperty 𝔒} → P ≈ Q → Q ≈ P
test1-works P≈Q = symmetry P≈Q
test2-works : {P Q : ExtensionProperty 𝔒} → P ≈ Q → Q ≈ P
test2-works {P} {Q} P≈Q = symmetry {x = P} {y = Q} P≈Q
test3-works : {P Q : ExtensionProperty 𝔒} → P ≈ Q → Q ≈ P
test3-works {P} {Q} P≈Q = symmetry {x = _ , _} {y = _ , _} P≈Q
test4-works : {P Q : ExtensionProperty 𝔒} → P ≈ Q → Q ≈ P
test4-works {P} {Q} P≈Q = symmetry {x = _ , π₁ P} {y = _ , π₁ Q} P≈Q
record Function : Set where
no-eta-equality
postulate symmetry : ∀ {𝔒} {x y : ExtensionProperty 𝔒} → x ≈ y → y ≈ x
-- normalises to : {𝔒 : Set} {x y : Σ (𝔒 → Set) (λ P → (f : 𝔒) → P f)} → x ≈ y → y ≈ x
module Test {𝔒 : Set} where
test1-works : {P Q : ExtensionProperty 𝔒} → P ≈ Q → Q ≈ P
test1-works P≈Q = symmetry P≈Q
test2-works : {P Q : ExtensionProperty 𝔒} → P ≈ Q → Q ≈ P
test2-works {P} {Q} P≈Q = symmetry {x = P} {y = Q} P≈Q
test3-works : {P Q : ExtensionProperty 𝔒} → P ≈ Q → Q ≈ P
test3-works {P} {Q} P≈Q = symmetry {x = _ , _} {y = _ , _} P≈Q
test4-works : {P Q : ExtensionProperty 𝔒} → P ≈ Q → Q ≈ P
test4-works {P} {Q} P≈Q = symmetry {x = _ , π₁ P} {y = _ , π₁ Q} P≈Q
record RegularVsConstructed : Set where
no-eta-equality
infixr 5 _,_
record Σ (𝔒 : Set₁) (𝔓 : 𝔒 → Set) : Set₁ where
constructor _,_
field
π₀ : 𝔒
π₁ : 𝔓 π₀
open Σ public
ExtensionProperty : Set → Set₁
ExtensionProperty 𝔒 = Σ (Property 𝔒) Extension
record _≈R_ {𝔒 : Set} (P Q : ExtensionProperty 𝔒) : Set where
constructor ∁
field
π₀ : PropertyEquivalence (π₀ P) (π₀ Q)
_≈F_ : {𝔒 : Set} → ExtensionProperty 𝔒 → ExtensionProperty 𝔒 → Set
_≈F_ P Q = PropertyEquivalence (π₀ P) (π₀ Q)
record Instance : Set where
no-eta-equality
postulate instance _ : {𝔒 : Set} → Symmetry (_≈R_ {𝔒 = 𝔒})
postulate instance _ : {𝔒 : Set} → Symmetry (_≈F_ {𝔒 = 𝔒})
open Symmetry ⦃ … ⦄
module Test {𝔒 : Set} where
test1-worksR : {P Q : ExtensionProperty 𝔒} → P ≈R Q → Q ≈R P
test1-worksR P≈Q = symmetry P≈Q
test2-worksR : {P Q : ExtensionProperty 𝔒} → P ≈R Q → Q ≈R P
test2-worksR {P} {Q} P≈Q = symmetry {x = P} {y = Q} P≈Q
test3-worksR : {P Q : ExtensionProperty 𝔒} → P ≈R Q → Q ≈R P
test3-worksR {P} {Q} P≈Q = symmetry {x = _ , _} {y = _ , _} P≈Q
test4-worksR : {P Q : ExtensionProperty 𝔒} → P ≈R Q → Q ≈R P
test4-worksR {P} {Q} P≈Q = symmetry {x = _ , π₁ P} {y = _ , π₁ Q} P≈Q
test1-failsF : {P Q : ExtensionProperty 𝔒} → P ≈F Q → Q ≈F P
test1-failsF P≈Q = symmetry P≈Q
test2-worksF : {P Q : ExtensionProperty 𝔒} → P ≈F Q → Q ≈F P
test2-worksF {P} {Q} P≈Q = symmetry {x = P} {y = Q} P≈Q
test3-failsF : {P Q : ExtensionProperty 𝔒} → P ≈F Q → Q ≈F P
test3-failsF {P} {Q} P≈Q = symmetry {x = _ , _} {y = _ , _} P≈Q
test4-worksF : {P Q : ExtensionProperty 𝔒} → P ≈F Q → Q ≈F P
test4-worksF {P} {Q} P≈Q = symmetry {x = _ , π₁ P} {y = _ , π₁ Q} P≈Q
record Function : Set where
no-eta-equality
postulate symmetryR : ∀ {𝔒} {x y : ExtensionProperty 𝔒} → x ≈R y → y ≈R x
postulate symmetryF : ∀ {𝔒} {x y : ExtensionProperty 𝔒} → x ≈F y → y ≈F x
module Test {𝔒 : Set} where
test1-worksR : {P Q : ExtensionProperty 𝔒} → P ≈R Q → Q ≈R P
test1-worksR P≈Q = symmetryR P≈Q
test2-worksR : {P Q : ExtensionProperty 𝔒} → P ≈R Q → Q ≈R P
test2-worksR {P} {Q} P≈Q = symmetryR {x = P} {y = Q} P≈Q
test3-worksR : {P Q : ExtensionProperty 𝔒} → P ≈R Q → Q ≈R P
test3-worksR {P} {Q} P≈Q = symmetryR {x = _ , _} {y = _ , _} P≈Q
test4-worksR : {P Q : ExtensionProperty 𝔒} → P ≈R Q → Q ≈R P
test4-worksR {P} {Q} P≈Q = symmetryR {x = _ , π₁ P} {y = _ , π₁ Q} P≈Q
test1-failsF : {P Q : ExtensionProperty 𝔒} → P ≈F Q → Q ≈F P
test1-failsF P≈Q = symmetryF P≈Q
test2-worksF : {P Q : ExtensionProperty 𝔒} → P ≈F Q → Q ≈F P
test2-worksF {P} {Q} P≈Q = symmetryF {x = P} {y = Q} P≈Q
test3-failsF : {P Q : ExtensionProperty 𝔒} → P ≈F Q → Q ≈F P
test3-failsF {P} {Q} P≈Q = symmetryF {x = _ , _} {y = _ , _} P≈Q
test4-worksF : {P Q : ExtensionProperty 𝔒} → P ≈F Q → Q ≈F P
test4-worksF {P} {Q} P≈Q = symmetryF {x = _ , π₁ P} {y = _ , π₁ Q} P≈Q
record RegularVsConstructedSimpler : Set where
no-eta-equality
infixr 5 _,_
record Σ (𝔒 : Set₁) (𝔓 : 𝔒 → Set) : Set₁ where
constructor _,_
field
π₀ : 𝔒
π₁ : 𝔓 π₀
open Σ public
postulate Prop : Set₁
postulate Ext : Prop → Set
postulate PropEq : Prop → Set
ExtProp : Set₁
ExtProp = Σ Prop Ext
record ≈C_ (P : ExtProp) : Set where
constructor ∁
field
π₀ : PropEq (π₀ P)
≈R_ : ExtProp → Set
≈R_ P = PropEq (π₀ P)
record Instance : Set where
no-eta-equality
record Class {B : Set₁} (∼_ : B → Set) : Set₁ where
field foo : ∀ {x} → ∼ x → Set
open Class ⦃ … ⦄
postulate instance _ : Class ≈C_
postulate instance _ : Class ≈R_
module Test where
test1-worksC : {P : ExtProp} → ≈C P → Set
test1-worksC P≈Q = foo P≈Q
test2-worksC : {P : ExtProp} → ≈C P → Set
test2-worksC {P} P≈Q = foo {x = P} P≈Q
test3-worksC : {P : ExtProp} → ≈C P → Set
test3-worksC {P} P≈Q = foo {x = _ , _} P≈Q
test4-worksC : {P : ExtProp} → ≈C P → Set
test4-worksC {P} P≈Q = foo {x = _ , π₁ P} P≈Q
test1-failsR : {P : ExtProp} → ≈R P → Set
test1-failsR P≈Q = foo P≈Q
test2-worksR : {P : ExtProp} → ≈R P → Set
test2-worksR {P} P≈Q = foo {x = P} P≈Q
test3-failsR : {P : ExtProp} → ≈R P → Set
test3-failsR {P} P≈Q = foo {x = _ , _} P≈Q
test4-worksR : {P : ExtProp} → ≈R P → Set
test4-worksR {P} P≈Q = foo {x = _ , π₁ P} P≈Q
record Function : Set where
no-eta-equality
postulate fooC : {x : ExtProp} → ≈C x → Set
postulate fooR : {x : ExtProp} → ≈R x → Set
module Test where
test1-worksC : {P : ExtProp} → ≈C P → Set
test1-worksC P≈Q = fooC P≈Q
test2-worksC : {P : ExtProp} → ≈C P → Set
test2-worksC {P} P≈Q = fooC {x = P} P≈Q
test3-worksC : {P : ExtProp} → ≈C P → Set
test3-worksC {P} P≈Q = fooC {x = _ , _} P≈Q
test4-worksC : {P : ExtProp} → ≈C P → Set
test4-worksC {P} P≈Q = fooC {x = _ , π₁ P} P≈Q
test1-failsR : {P : ExtProp} → ≈R P → Set
test1-failsR P≈Q = fooR P≈Q
test2-worksR : {P : ExtProp} → ≈R P → Set
test2-worksR {P} P≈Q = fooR {x = P} P≈Q
test3-failsR : {P : ExtProp} → ≈R P → Set
test3-failsR {P} P≈Q = fooR {x = _ , _} P≈Q
test4-worksR : {P : ExtProp} → ≈R P → Set
test4-worksR {P} P≈Q = fooR {x = _ , π₁ P} P≈Q
record RegularVsConstructedMoreSimpler : Set where
no-eta-equality
infixr 5 _,_
record Σ (𝔒 : Set₁) (𝔓 : 𝔒 → Set) : Set₁ where
constructor _,_
field
π₀ : 𝔒
π₁ : Set
open Σ
postulate Prop : Set₁
postulate Ext : Prop → Set
postulate PropEq : Prop → Set
ExtProp : Set₁
ExtProp = Σ Prop Ext
Reg : ExtProp → Set
Reg P = PropEq (π₀ P)
record Con (P : ExtProp) : Set where
constructor ∁
field
π₀ : Reg P
module Instance where
record Class {B : Set₁} (F : B → Set) : Set₁ where
field foo : ∀ {x} → F x → Set
open Class ⦃ … ⦄
postulate instance _ : Class Reg
postulate instance _ : Class Con
postulate instance _ : Class Ext
postulate instance _ : Class PropEq
test1-failsR : {P : ExtProp} → Reg P → Set
test1-failsR P≈Q = foo P≈Q
test2-worksR : {P : ExtProp} → Reg P → Set
test2-worksR {P} P≈Q = foo {x = P} P≈Q
test3-failsR : {P : ExtProp} → Reg P → Set
test3-failsR {P} P≈Q = foo {x = _ , _} P≈Q
test4-worksR : {P : ExtProp} → Reg P → Set
test4-worksR {P} P≈Q = foo {x = _ , π₁ P} P≈Q
test1-worksC : {P : ExtProp} → Con P → Set
test1-worksC P≈Q = foo P≈Q
test2-worksC : {P : ExtProp} → Con P → Set
test2-worksC {P} P≈Q = foo {x = P} P≈Q
test3-worksC : {P : ExtProp} → Con P → Set
test3-worksC {P} P≈Q = foo {x = _ , _} P≈Q
test4-worksC : {P : ExtProp} → Con P → Set
test4-worksC {P} P≈Q = foo {x = _ , π₁ P} P≈Q
module Function where
postulate fooR : {x : ExtProp} → Reg x → Set
postulate fooC : {x : ExtProp} → Con x → Set
test1-failsR : {P : ExtProp} → Reg P → Set
test1-failsR P≈Q = fooR P≈Q
test2-worksR : {P : ExtProp} → Reg P → Set
test2-worksR {P} P≈Q = fooR {x = P} P≈Q
test3-failsR : {P : ExtProp} → Reg P → Set
test3-failsR {P} P≈Q = fooR {x = _ , _} P≈Q
test4-worksR : {P : ExtProp} → Reg P → Set
test4-worksR {P} P≈Q = fooR {x = _ , π₁ P} P≈Q
test1-worksC : {P : ExtProp} → Con P → Set
test1-worksC P≈Q = fooC P≈Q
test2-worksC : {P : ExtProp} → Con P → Set
test2-worksC {P} P≈Q = fooC {x = P} P≈Q
test3-worksC : {P : ExtProp} → Con P → Set
test3-worksC {P} P≈Q = fooC {x = _ , _} P≈Q
test4-worksC : {P : ExtProp} → Con P → Set
test4-worksC {P} P≈Q = fooC {x = _ , π₁ P} P≈Q
module RegularVsConstructed-EnhancedReg where
infixr 5 _,_
record Σ (𝔒 : Set₁) (𝔓 : 𝔒 → Set) : Set₁ where
constructor _,_
field
π₀ : 𝔒
π₁ : Set
open Σ
postulate Prop : Set₁
postulate Ext : Prop → Set
postulate PropEq : Prop → Set → Set
ExtProp : Set₁
ExtProp = Σ Prop Ext
Reg : ExtProp → Set
Reg P = PropEq (π₀ P) (π₁ P)
record Con (P : ExtProp) : Set where
constructor ∁
field
π₀ : Reg P
module Instance where
record Class {B : Set₁} (F : B → Set) : Set₁ where
field foo : ∀ {x} → F x → Set
open Class ⦃ … ⦄
postulate instance _ : Class Reg
postulate instance _ : Class Con
postulate instance _ : Class Ext
test1-failsR : {P : ExtProp} → Reg P → Set
test1-failsR P≈Q = foo P≈Q
test2-worksR : {P : ExtProp} → Reg P → Set
test2-worksR {P} P≈Q = foo {x = P} P≈Q
test3-failsR : {P : ExtProp} → Reg P → Set
test3-failsR {P} P≈Q = foo {x = _ , _} P≈Q
test4-worksR : {P : ExtProp} → Reg P → Set
test4-worksR {P} P≈Q = foo {x = _ , π₁ P} P≈Q
test1-worksC : {P : ExtProp} → Con P → Set
test1-worksC P≈Q = foo P≈Q
test2-worksC : {P : ExtProp} → Con P → Set
test2-worksC {P} P≈Q = foo {x = P} P≈Q
test3-worksC : {P : ExtProp} → Con P → Set
test3-worksC {P} P≈Q = foo {x = _ , _} P≈Q
test4-worksC : {P : ExtProp} → Con P → Set
test4-worksC {P} P≈Q = foo {x = _ , π₁ P} P≈Q
module Function where
postulate fooR : {x : ExtProp} → Reg x → Set
postulate fooC : {x : ExtProp} → Con x → Set
test1-failsR : {P : ExtProp} → Reg P → Set
test1-failsR P≈Q = fooR P≈Q
test2-worksR : {P : ExtProp} → Reg P → Set
test2-worksR {P} P≈Q = fooR {x = P} P≈Q
test3-failsR : {P : ExtProp} → Reg P → Set
test3-failsR {P} P≈Q = fooR {x = _ , _} P≈Q
test4-worksR : {P : ExtProp} → Reg P → Set
test4-worksR {P} P≈Q = fooR {x = _ , π₁ P} P≈Q
test1-worksC : {P : ExtProp} → Con P → Set
test1-worksC P≈Q = fooC P≈Q
test2-worksC : {P : ExtProp} → Con P → Set
test2-worksC {P} P≈Q = fooC {x = P} P≈Q
test3-worksC : {P : ExtProp} → Con P → Set
test3-worksC {P} P≈Q = fooC {x = _ , _} P≈Q
test4-worksC : {P : ExtProp} → Con P → Set
test4-worksC {P} P≈Q = fooC {x = _ , π₁ P} P≈Q
record ProjectedMorality : Set where
no-eta-equality
infixr 5 _,_
record Σ (𝔒 : Set₁) (𝔓 : 𝔒 → Set) : Set₁ where
constructor _,_
field
π₀ : 𝔒
π₁ : Set
open Σ
postulate Prop : Set₁
postulate Ext : Prop → Set
postulate PropEq : Prop → Set
Reg : Σ Prop Ext → Set
Reg P = PropEq (π₀ P)
postulate bar : ∀ {𝔒 : Set₁} → 𝔒 → 𝔒
postulate qux : ∀ {𝔒} {𝔓 : 𝔒 → Set} → Σ 𝔒 𝔓 → Σ 𝔒 𝔓
postulate fake-π₀ : ∀ {𝔒} {𝔓 : 𝔒 → Set} → Σ 𝔒 𝔓 → 𝔒
abstract
abstracted-π₀ : ∀ {𝔒} {𝔓 : 𝔒 → Set} → Σ 𝔒 𝔓 → 𝔒
abstracted-π₀ x = π₀ x
Reg-using-abstracted-projection : Σ Prop Ext → Set
Reg-using-abstracted-projection (P0 , P1) = PropEq (abstracted-π₀ {𝔒 = Prop} {𝔓 = Ext} (P0 , P1))
Reg-using-q : Σ Prop Ext → Set
Reg-using-q x = PropEq (π₀ (qux x))
Reg-using-fake-π₀ : Σ Prop Ext → Set
Reg-using-fake-π₀ x = PropEq (fake-π₀ x)
record Con (P : Σ Prop Ext) : Set where
constructor ∁
field
π₀ : Reg P
record Con-using-abstracted-projection (P : Σ Prop Ext) : Set where
constructor ∁
field
π₀ : Reg-using-abstracted-projection P
record Con-using-q (P : Σ Prop Ext) : Set where
constructor ∁
field
π₀ : Reg-using-q P
record Con-using-fake-π₀ (P : Σ Prop Ext) : Set where
constructor ∁
field
π₀ : Reg-using-fake-π₀ P
record Class {B : Set₁} (F : B → Set) : Set₁ where
field foo : ∀ {x} → F x → Set
open Class ⦃ … ⦄
postulate instance _ : Class Reg
postulate instance _ : Class Reg-using-abstracted-projection
postulate instance _ : Class Reg-using-q
postulate instance _ : Class Reg-using-fake-π₀
postulate instance _ : Class Con
postulate instance _ : Class Con-using-abstracted-projection
postulate instance _ : Class Con-using-q
postulate instance _ : Class Con-using-fake-π₀
test1-failsR : ∀ {P} → Reg P → Set
test1-failsR = foo
test1-failsRap : ∀ {P} → Reg-using-abstracted-projection P → Set
test1-failsRap = foo
test1-failsRq : ∀ {P} → Reg-using-q P → Set
test1-failsRq = foo
test1-failsRf : ∀ {P} → Reg-using-fake-π₀ P → Set
test1-failsRf = foo
test1-worksC : ∀ {P} → Con P → Set
test1-worksC = foo
test1-worksCap : ∀ {P} → Con-using-abstracted-projection P → Set
test1-worksCap = foo
test1-worksCq : ∀ {P} → Con-using-q P → Set
test1-worksCq = foo
test1-worksCf : ∀ {P} → Con-using-fake-π₀ P → Set
test1-worksCf = foo
record DataMorality : Set where
no-eta-equality
module _ (𝔒 : Set₁) (𝔓 : 𝔒 → Set) where
data Σ : Set₁ where
_,_ : 𝔒 → Set → Σ
module _ {𝔒 : Set₁} {𝔓 : 𝔒 → Set} where
dπ₀ : Σ _ 𝔓 → 𝔒
dπ₀ (x , _) = x
dπ₁ : Σ _ 𝔓 → Set
dπ₁ (_ , y) = y
postulate Prop : Set₁
postulate Ext : Prop → Set
postulate PropEq : Prop → Set
Reg : Σ Prop Ext → Set
Reg P = PropEq (dπ₀ P)
postulate bar : ∀ {𝔒 : Set₁} → 𝔒 → 𝔒
postulate qux : ∀ {𝔒} {𝔓 : 𝔒 → Set} → Σ 𝔒 𝔓 → Σ 𝔒 𝔓
postulate fake-π₀ : ∀ {𝔒} {𝔓 : 𝔒 → Set} → Σ 𝔒 𝔓 → 𝔒
abstract
abstracted-π₀ : ∀ {𝔒} {𝔓 : 𝔒 → Set} → Σ 𝔒 𝔓 → 𝔒
abstracted-π₀ x = dπ₀ x
Reg-using-abstracted-projection : Σ Prop Ext → Set
Reg-using-abstracted-projection (P0 , P1) = PropEq (abstracted-π₀ {𝔒 = Prop} {𝔓 = Ext} (P0 , P1))
Reg-using-q : Σ Prop Ext → Set
Reg-using-q x = PropEq (dπ₀ (qux x))
Reg-using-fake-π₀ : Σ Prop Ext → Set
Reg-using-fake-π₀ x = PropEq (fake-π₀ x)
record Con (P : Σ Prop Ext) : Set where
constructor ∁
field
π₀ : Reg P
record Con-using-abstracted-projection (P : Σ Prop Ext) : Set where
constructor ∁
field
π₀ : Reg-using-abstracted-projection P
record Con-using-q (P : Σ Prop Ext) : Set where
constructor ∁
field
π₀ : Reg-using-q P
record Con-using-fake-π₀ (P : Σ Prop Ext) : Set where
constructor ∁
field
π₀ : Reg-using-fake-π₀ P
record Class {B : Set₁} (F : B → Set) : Set₁ where
field foo : ∀ {x} → F x → Set
open Class ⦃ … ⦄
postulate instance _ : Class Reg
postulate instance _ : Class Reg-using-abstracted-projection
postulate instance _ : Class Reg-using-q
postulate instance _ : Class Reg-using-fake-π₀
postulate instance _ : Class Con
postulate instance _ : Class Con-using-abstracted-projection
postulate instance _ : Class Con-using-q
postulate instance _ : Class Con-using-fake-π₀
test1-failsR : ∀ {P} → Reg P → Set
test1-failsR = foo
test1-failsRap : ∀ {P} → Reg-using-abstracted-projection P → Set
test1-failsRap = foo -- woah, it actually works. why?
test1-failsRq : ∀ {P} → Reg-using-q P → Set
test1-failsRq = foo -- NB this doesn't fail if instance of Class Reg is excluded
test1-failsRf : ∀ {P} → Reg-using-fake-π₀ P → Set
test1-failsRf = foo -- NB this doesn't fail if instance of Class Reg is excluded
test1-worksC : ∀ {P} → Con P → Set
test1-worksC = foo
test1-worksCap : ∀ {P} → Con-using-abstracted-projection P → Set
test1-worksCap = foo
test1-worksCq : ∀ {P} → Con-using-q P → Set
test1-worksCq = foo
test1-worksCf : ∀ {P} → Con-using-fake-π₀ P → Set
test1-worksCf = foo
module RevampedSimpleFailure where
record ExtensionProperty (𝔒 : Set) : Set₁ where
field
π₀ : Property 𝔒
π₁ : Extension π₀
open ExtensionProperty
_≈_ : {𝔒 : Set} → ExtensionProperty 𝔒 → ExtensionProperty 𝔒 → Set
_≈_ P Q = PropertyEquivalence (π₀ P) (π₀ Q)
postulate symmetry : ∀ {𝔒} {x y : ExtensionProperty 𝔒} → x ≈ y → y ≈ x
-- normalises to : ∀ {𝔒} {x y : ExtensionProperty 𝔒} → PropertyEquivalence (π₀ x) (π₀ y) → PropertyEquivalence (π₀ y) (π₀ x)
test-fails : {𝔒 : Set} {P Q : ExtensionProperty 𝔒} → P ≈ Q → Q ≈ P
test-fails P≈Q = symmetry P≈Q
module PostulatedExtensionPropertySimpleSuccess where
postulate
ExtensionProperty : Set → Set₁
π₀ : {𝔒 : Set} → ExtensionProperty 𝔒 → Property 𝔒
_≈_ : {𝔒 : Set} → ExtensionProperty 𝔒 → ExtensionProperty 𝔒 → Set
_≈_ P Q = PropertyEquivalence (π₀ P) (π₀ Q)
postulate symmetry : ∀ {𝔒} {x y : ExtensionProperty 𝔒} → x ≈ y → y ≈ x
-- normalises to : ∀ {𝔒} {x y : ExtensionProperty 𝔒} → PropertyEquivalence (π₀ {𝔒} x) (π₀ {𝔒} y) → PropertyEquivalence (π₀ {𝔒} y) (π₀ {𝔒} x)
test-works : {𝔒 : Set} {P Q : ExtensionProperty 𝔒} → P ≈ Q → Q ≈ P
test-works P≈Q = symmetry P≈Q
module RevampedVerySimpleFailure where
-- was PropertyEquivalence : ∀ {P : Set} → Property P → Property P → Set
postulate _∼_ : Set → Set → Set
record ExtensionProperty : Set₁ where
field
π₀ : Set -- was Property 𝔒
π₁ : Set -- was Extension π₀
open ExtensionProperty
postulate symmetry : ∀ {x y : ExtensionProperty} → π₀ x ∼ π₀ y → π₀ y ∼ π₀ x
postulate x y : ExtensionProperty
test-fails : π₀ x ∼ π₀ y → π₀ y ∼ π₀ x
test-fails = symmetry
module PostulatedExtensionPropertyVerySimpleSuccess where
postulate _∼_ : Set → Set → Set
postulate
ExtensionProperty : Set₁
π₀ : ExtensionProperty → Set
postulate symmetry : ∀ {x y : ExtensionProperty} → π₀ x ∼ π₀ y → π₀ y ∼ π₀ x
postulate x y : ExtensionProperty
test-works : π₀ x ∼ π₀ y → π₀ y ∼ π₀ x
test-works P≈Q = symmetry P≈Q
module RevampedEvenSimplerFailure where
-- was _∼_, which was PropertyEquivalence
postulate F : Set → Set
record ExtensionProperty : Set₁ where
field
π₀ : Set
π₁ : Set
open ExtensionProperty
postulate symmetry : ∀ {x : ExtensionProperty} → F (π₀ x) → Set
postulate x : ExtensionProperty
postulate Fpx : F (π₀ x)
test-fails1 : Set
test-fails1 = symmetry Fpx
test-fails2 : Set
test-fails2 = symmetry {x = record { π₀ = π₀ x ; π₁ = _}} Fpx
test-works-arbitrarily : Set
test-works-arbitrarily = symmetry {x = record { π₀ = π₀ x ; π₁ = F (F (π₁ x)) }} Fpx
module PostulatedExtensionPropertyEvenSimplerSuccess where
postulate F : Set → Set
postulate
ExtensionProperty : Set₁
π₀ : ExtensionProperty → Set
postulate symmetry : ∀ {x : ExtensionProperty} → F (π₀ x) → Set
postulate x : ExtensionProperty
postulate Fpx : F (π₀ x)
test-works1 : Set
test-works1 = symmetry Fpx
test-works2 : Set
test-works2 = symmetry {x = x} Fpx
module RevampedEvenSimplerFailureClassified where
postulate F : Set → Set
record ExtensionProperty : Set₁ where
field
π₀ : Set
π₁ : Set
open ExtensionProperty
record Symmetry' (R : Set → Set) : Set₁ where
field symmetry : ∀ {x : ExtensionProperty} → R (π₀ x) → Set
open Symmetry' ⦃ … ⦄
postulate instance _ : Symmetry' F
postulate x : ExtensionProperty
postulate Fpx : F (π₀ x)
test-fails1 : Set
test-fails1 = symmetry Fpx
test-fails2 : Set
test-fails2 = symmetry {x = record { π₀ = π₀ x ; π₁ = _}} Fpx
test-works-arbitrarily : Set
test-works-arbitrarily = symmetry {x = record { π₀ = π₀ x ; π₁ = F (F (π₁ x)) }} Fpx
module PostulatedExtensionPropertyEvenSimplerSuccessClassified where
postulate F : Set → Set
postulate
ExtensionProperty : Set₁
π₀ : ExtensionProperty → Set
record Symmetry' (R : Set → Set) : Set₁ where
field symmetry : ∀ {x : ExtensionProperty} → R (π₀ x) → Set
open Symmetry' ⦃ … ⦄
postulate instance _ : Symmetry' F
postulate x : ExtensionProperty
postulate Fpx : F (π₀ x)
test-works1 : Set
test-works1 = symmetry Fpx
test-works2 : Set
test-works2 = symmetry {x = x} Fpx
module RevampedVsPostulated where
record R : Set₁ where
field
f1 : Set
f2 : Set
open R
postulate fooR : ∀ {x : R} → f1 x → Set
postulate r : R
postulate f1r : f1 r
test-fails1 : Set
test-fails1 = fooR f1r
postulate
S : Set₁
g1 : S → Set
postulate fooS : ∀ {x : S} → g1 x → Set
postulate s : S
postulate g1s : g1 s
test-works1 : Set
test-works1 = fooS g1s
| 28.653307
| 173
| 0.585152
|
11825a6e1946841094f5cc455b3c1e7bfef55b17
| 271
|
agda
|
Agda
|
Cubical/Foundations/Equiv/Reasoning.agda
|
kiana-S/univalent-foundations
|
8bdb0766260489f9c89a14f4c0f2ad26e5190dec
|
[
"MIT"
] | null | null | null |
Cubical/Foundations/Equiv/Reasoning.agda
|
kiana-S/univalent-foundations
|
8bdb0766260489f9c89a14f4c0f2ad26e5190dec
|
[
"MIT"
] | null | null | null |
Cubical/Foundations/Equiv/Reasoning.agda
|
kiana-S/univalent-foundations
|
8bdb0766260489f9c89a14f4c0f2ad26e5190dec
|
[
"MIT"
] | null | null | null |
{-# OPTIONS --cubical --no-import-sorts --safe #-}
module Cubical.Foundations.Equiv.Reasoning where
open import Cubical.Foundations.Prelude using (refl; sym)
open import Cubical.Relation.Binary
-- Properties of equivalence
≃-reflexive : Reflexive _≃_
≃-reflexive = ?
| 22.583333
| 57
| 0.752768
|
307103ed33efce692817b5e21506224e324f3555
| 319
|
agda
|
Agda
|
test/Succeed/Issue3109.agda
|
mdimjasevic/agda
|
8fb548356b275c7a1e79b768b64511ae937c738b
|
[
"BSD-3-Clause"
] | 1,989
|
2015-01-09T23:51:16.000Z
|
2022-03-30T18:20:48.000Z
|
test/Succeed/Issue3109.agda
|
Seanpm2001-languages/agda
|
9911f73061e21a87fad76c662463257afe02c861
|
[
"BSD-2-Clause"
] | 4,066
|
2015-01-10T11:24:51.000Z
|
2022-03-31T21:14:49.000Z
|
test/Succeed/Issue3109.agda
|
Seanpm2001-languages/agda
|
9911f73061e21a87fad76c662463257afe02c861
|
[
"BSD-2-Clause"
] | 371
|
2015-01-03T14:04:08.000Z
|
2022-03-30T19:00:30.000Z
|
{-# OPTIONS --allow-unsolved-metas #-}
postulate
Nat : Set
Fin : Nat → Set
Foo : (n : Nat) → Fin n → Set
Bar : ∀ {n m} → Foo n m → Set
variable
n : Nat
m : Fin _
k : Foo _ m
l : Foo n m
open import Agda.Builtin.Equality
postulate
goal-type-error : Bar k
foo : Bar _
foo = goal-type-error {_} {_}
| 14.5
| 38
| 0.579937
|
5294fa52d2ede43be95445194e5d3a6b5420f42b
| 884
|
agda
|
Agda
|
currypp/.cpm/packages/currycheck/examples/withVerification/PROOF-appendAddLengths.agda
|
phlummox/curry-tools
|
7905bc4f625a94a725f9f6d8a2de1140bea5e471
|
[
"BSD-3-Clause"
] | null | null | null |
currypp/.cpm/packages/currycheck/examples/withVerification/PROOF-appendAddLengths.agda
|
phlummox/curry-tools
|
7905bc4f625a94a725f9f6d8a2de1140bea5e471
|
[
"BSD-3-Clause"
] | null | null | null |
currypp/.cpm/packages/currycheck/examples/withVerification/PROOF-appendAddLengths.agda
|
phlummox/curry-tools
|
7905bc4f625a94a725f9f6d8a2de1140bea5e471
|
[
"BSD-3-Clause"
] | null | null | null |
-- Agda program using the Iowa Agda library
open import bool
module PROOF-appendAddLengths
(Choice : Set)
(choose : Choice → 𝔹)
(lchoice : Choice → Choice)
(rchoice : Choice → Choice)
where
open import eq
open import nat
open import list
open import maybe
---------------------------------------------------------------------------
-- Translated Curry operations:
++ : {a : Set} → 𝕃 a → 𝕃 a → 𝕃 a
++ [] x = x
++ (y :: z) u = y :: (++ z u)
append : {a : Set} → 𝕃 a → 𝕃 a → 𝕃 a
append x y = ++ x y
---------------------------------------------------------------------------
appendAddLengths : {a : Set} → (x : 𝕃 a) → (y : 𝕃 a)
→ ((length x) + (length y)) ≡ (length (append x y))
appendAddLengths [] y = refl
appendAddLengths (x :: xs) y rewrite appendAddLengths xs y = refl
---------------------------------------------------------------------------
| 25.257143
| 75
| 0.438914
|
73e8cca26f2e38b0d01975323c339f5ec09d9987
| 500
|
agda
|
Agda
|
test/Succeed/Issue919.agda
|
mdimjasevic/agda
|
8fb548356b275c7a1e79b768b64511ae937c738b
|
[
"BSD-3-Clause"
] | 1,989
|
2015-01-09T23:51:16.000Z
|
2022-03-30T18:20:48.000Z
|
test/Succeed/Issue919.agda
|
Seanpm2001-languages/agda
|
9911f73061e21a87fad76c662463257afe02c861
|
[
"BSD-2-Clause"
] | 4,066
|
2015-01-10T11:24:51.000Z
|
2022-03-31T21:14:49.000Z
|
test/Succeed/Issue919.agda
|
Seanpm2001-languages/agda
|
9911f73061e21a87fad76c662463257afe02c861
|
[
"BSD-2-Clause"
] | 371
|
2015-01-03T14:04:08.000Z
|
2022-03-30T19:00:30.000Z
|
module Issue919 where
open import Common.Prelude
Zero : Nat → Set
Zero 0 = ⊤
Zero (suc _) = ⊥
test : (n : Nat) {p : Zero n} → Set → Set
test 0 A = A
test (suc _) {()}
-- Horrible error for first clause:
-- Cannot eliminate type Set with pattern {(implicit)} (did you supply
-- too many arguments?)
-- when checking that the pattern zero has type Nat
-- Caused by trailing implicit insertion (see Rules/Def.hs).
-- With trailing implicit insertion switched off, this should work now.
| 23.809524
| 71
| 0.678
|
5e96164cf880ac155b442447ef2b658090b2c96c
| 5,481
|
agda
|
Agda
|
src/Tactic/Reflection/Substitute.agda
|
t-more/agda-prelude
|
da4fca7744d317b8843f2bc80a923972f65548d3
|
[
"MIT"
] | null | null | null |
src/Tactic/Reflection/Substitute.agda
|
t-more/agda-prelude
|
da4fca7744d317b8843f2bc80a923972f65548d3
|
[
"MIT"
] | null | null | null |
src/Tactic/Reflection/Substitute.agda
|
t-more/agda-prelude
|
da4fca7744d317b8843f2bc80a923972f65548d3
|
[
"MIT"
] | null | null | null |
module Tactic.Reflection.Substitute where
open import Prelude hiding (abs)
open import Builtin.Reflection
open import Tactic.Reflection.DeBruijn
IsSafe : Term → Set
IsSafe (lam _ _) = ⊥
IsSafe _ = ⊤
data SafeTerm : Set where
safe : (v : Term) (p : IsSafe v) → SafeTerm
maybeSafe : Term → Maybe SafeTerm
maybeSafe (var x args) = just (safe (var x args) _)
maybeSafe (con c args) = just (safe (con c args) _)
maybeSafe (def f args) = just (safe (def f args) _)
maybeSafe (meta x args) = just (safe (meta x args) _)
maybeSafe (lam v t) = nothing
maybeSafe (pat-lam cs args) = just (safe (pat-lam cs args) _)
maybeSafe (pi a b) = just (safe (pi a b) _)
maybeSafe (agda-sort s) = just (safe (agda-sort s) _)
maybeSafe (lit l) = just (safe (lit l) _)
maybeSafe unknown = just (safe unknown _)
instance
DeBruijnSafeTerm : DeBruijn SafeTerm
strengthenFrom {{DeBruijnSafeTerm}} k n (safe v _) = do
-- Strengthening or weakening safe terms always results in safe terms,
-- but proving that is a bit of a bother, thus maybeSafe.
v₁ ← strengthenFrom k n v
maybeSafe v₁
weakenFrom {{DeBruijnSafeTerm}} k n (safe v p) =
maybe (safe unknown _) id (maybeSafe (weakenFrom k n v))
safe-term : SafeTerm → Term
safe-term (safe v _) = v
applyTerm : SafeTerm → List (Arg Term) → Term
applyTerm v [] = safe-term v
applyTerm (safe (var x args) _) args₁ = var x (args ++ args₁)
applyTerm (safe (con c args) _) args₁ = con c (args ++ args₁)
applyTerm (safe (def f args) _) args₁ = def f (args ++ args₁)
applyTerm (safe (meta x args) _) args₁ = meta x (args ++ args₁)
applyTerm (safe (lam v t) ()) args
applyTerm (safe (pat-lam cs args) _) args₁ = pat-lam cs (args ++ args₁)
applyTerm (safe (pi a b) _) _ = pi a b
applyTerm (safe (agda-sort s) _) _ = agda-sort s
applyTerm (safe (lit l) _) _ = lit l
applyTerm (safe unknown _) _ = unknown
Subst : Set → Set
Subst A = List SafeTerm → A → A
substTerm : Subst Term
substArgs : Subst (List (Arg Term))
substArg : Subst (Arg Term)
substAbs : Subst (Abs Term)
substSort : Subst Sort
substClauses : Subst (List Clause)
substClause : Subst Clause
substTerm σ (var x args) =
case index σ x of λ
{ nothing → var (x - length σ) (substArgs σ args)
; (just v) → applyTerm v (substArgs σ args) }
substTerm σ (con c args) = con c (substArgs σ args)
substTerm σ (def f args) = def f (substArgs σ args)
substTerm σ (meta x args) = meta x (substArgs σ args)
substTerm σ (lam v b) = lam v (substAbs σ b)
substTerm σ (pat-lam cs args) = pat-lam (substClauses σ cs) (substArgs σ args)
substTerm σ (pi a b) = pi (substArg σ a) (substAbs σ b)
substTerm σ (agda-sort s) = agda-sort (substSort σ s)
substTerm σ (lit l) = lit l
substTerm σ unknown = unknown
substSort σ (set t) = set (substTerm σ t)
substSort σ (lit n) = lit n
substSort σ unknown = unknown
substClauses σ [] = []
substClauses σ (c ∷ cs) = substClause σ c ∷ substClauses σ cs
substClause σ (clause tel ps b) =
case length tel of λ
{ zero → clause tel ps (substTerm σ b)
; (suc n) → clause tel ps (substTerm (reverse (map (λ i → safe (var i []) _) (from 0 to n)) ++ weaken (suc n) σ) b)
}
substClause σ (absurd-clause tel ps) = absurd-clause tel ps
substArgs σ [] = []
substArgs σ (x ∷ args) = substArg σ x ∷ substArgs σ args
substArg σ (arg i x) = arg i (substTerm σ x)
substAbs σ (abs x v) = abs x $ substTerm (safe (var 0 []) _ ∷ weaken 1 σ) v
private
toArgs : Nat → List (Arg SafeTerm) → List (Arg Term)
toArgs k = map (λ x → weaken k (fmap safe-term x))
SafeApplyType : Set → Set
SafeApplyType A = List SafeTerm → Nat → A → List (Arg SafeTerm) → A
safeApplyAbs : SafeApplyType (Abs Term)
safeApplyArg : SafeApplyType (Arg Term)
safeApplySort : SafeApplyType Sort
-- safeApply′ env |Θ| v args = v′
-- where Γ, Δ, Θ ⊢ v
-- Γ ⊢ env : Δ
-- Γ ⊢ args
-- Γ, Θ ⊢ v′
safeApply′ : List SafeTerm → Nat → Term → List (Arg SafeTerm) → Term
safeApply′ env k (var x args) args₁ =
if x <? k then var x (args ++ toArgs k args₁)
else case index env (x - k) of λ
{ nothing → var (x - length env) (args ++ toArgs k args₁)
; (just v) → applyTerm v (args ++ toArgs k args₁) }
safeApply′ env k (con c args) args₁ = con c (args ++ toArgs k args₁)
safeApply′ env k (def f args) args₁ = def f (args ++ toArgs k args₁)
safeApply′ env k (lam v t) (a ∷ args₁) = safeApply′ (unArg a ∷ env) k (unAbs t) args₁
safeApply′ env k (lam v b) [] = lam v $ safeApplyAbs env k b []
safeApply′ env k (pat-lam cs args) args₁ = pat-lam cs (args ++ toArgs k args₁)
-- not right if applying to constructors
safeApply′ env k (pi a b) _ = pi (safeApplyArg env k a []) (safeApplyAbs env k b [])
safeApply′ env k (agda-sort s) args₁ = agda-sort (safeApplySort env k s [])
safeApply′ env k (lit l) args₁ = lit l
safeApply′ env k (meta x args) args₁ = meta x (args ++ toArgs k args₁)
safeApply′ env k unknown args₁ = unknown
safeApplyAbs env k (abs x b) _ = abs x (safeApply′ env (suc k) b [])
safeApplyArg env k (arg i v) args₁ = arg i (safeApply′ env k v args₁)
safeApplySort env k (set t) _ = set (safeApply′ env k t [])
safeApplySort env k (lit n) _ = lit n
safeApplySort env k unknown _ = unknown
safeApply : Term → List (Arg SafeTerm) → Term
safeApply v args = safeApply′ [] 0 v args
| 39.15
| 117
| 0.632549
|
118bae1011168434f4ec61f010953cd45bd7f90d
| 443
|
agda
|
Agda
|
test/Succeed/Issue175.agda
|
pthariensflame/agda
|
222c4c64b2ccf8e0fc2498492731c15e8fef32d4
|
[
"BSD-3-Clause"
] | 3
|
2015-03-28T14:51:03.000Z
|
2015-12-07T20:14:00.000Z
|
test/succeed/Issue175.agda
|
np/agda-git-experiment
|
20596e9dd9867166a64470dd24ea68925ff380ce
|
[
"MIT"
] | null | null | null |
test/succeed/Issue175.agda
|
np/agda-git-experiment
|
20596e9dd9867166a64470dd24ea68925ff380ce
|
[
"MIT"
] | 1
|
2019-03-05T20:02:38.000Z
|
2019-03-05T20:02:38.000Z
|
module Issue175 where
data List (A : Set) : Set where
[] : List A
_∷_ : A → List A → List A
{-# BUILTIN LIST List #-}
{-# BUILTIN NIL [] #-}
{-# BUILTIN CONS _∷_ #-}
data _≡_ {A : Set} (x : A) : A → Set where
refl : x ≡ x
postulate
Char : Set
String : Set
{-# BUILTIN CHAR Char #-}
{-# BUILTIN STRING String #-}
primitive primStringToList : String → List Char
lemma : primStringToList "0" ≡ ('0' ∷ [])
lemma = refl
| 17.72
| 47
| 0.568849
|
21dcf9bda3f9c76e9d7d6b8d5a69f2b462bd7f19
| 2,470
|
agda
|
Agda
|
Cubical/HITs/Rationals/QuoQ/Base.agda
|
maxdore/cubical
|
ef62b84397396d48135d73ba7400b71c721ddc94
|
[
"MIT"
] | null | null | null |
Cubical/HITs/Rationals/QuoQ/Base.agda
|
maxdore/cubical
|
ef62b84397396d48135d73ba7400b71c721ddc94
|
[
"MIT"
] | null | null | null |
Cubical/HITs/Rationals/QuoQ/Base.agda
|
maxdore/cubical
|
ef62b84397396d48135d73ba7400b71c721ddc94
|
[
"MIT"
] | 1
|
2021-03-12T20:08:45.000Z
|
2021-03-12T20:08:45.000Z
|
{-# OPTIONS --safe #-}
module Cubical.HITs.Rationals.QuoQ.Base where
open import Cubical.Foundations.Prelude
open import Cubical.Foundations.Equiv
open import Cubical.Data.Nat as ℕ using (discreteℕ)
open import Cubical.Data.NatPlusOne
open import Cubical.Data.Sigma
open import Cubical.HITs.Ints.QuoInt
open import Cubical.HITs.SetQuotients as SetQuotient
using ([_]; eq/; discreteSetQuotients) renaming (_/_ to _//_) public
open import Cubical.Relation.Nullary
open import Cubical.Relation.Binary.Base
open BinaryRelation
ℕ₊₁→ℤ : ℕ₊₁ → ℤ
ℕ₊₁→ℤ n = pos (ℕ₊₁→ℕ n)
private
ℕ₊₁→ℤ-hom : ∀ m n → ℕ₊₁→ℤ (m ·₊₁ n) ≡ ℕ₊₁→ℤ m · ℕ₊₁→ℤ n
ℕ₊₁→ℤ-hom _ _ = refl
-- ℚ as a set quotient of ℤ × ℕ₊₁ (as in the HoTT book)
_∼_ : ℤ × ℕ₊₁ → ℤ × ℕ₊₁ → Type₀
(a , b) ∼ (c , d) = a · ℕ₊₁→ℤ d ≡ c · ℕ₊₁→ℤ b
ℚ : Type₀
ℚ = (ℤ × ℕ₊₁) // _∼_
isSetℚ : isSet ℚ
isSetℚ = SetQuotient.squash/
[_/_] : ℤ → ℕ₊₁ → ℚ
[ a / b ] = [ a , b ]
isEquivRel∼ : isEquivRel _∼_
isEquivRel.reflexive isEquivRel∼ (a , b) = refl
isEquivRel.symmetric isEquivRel∼ (a , b) (c , d) = sym
isEquivRel.transitive isEquivRel∼ (a , b) (c , d) (e , f) p q = ·-injʳ _ _ _ r
where r = (a · ℕ₊₁→ℤ f) · ℕ₊₁→ℤ d ≡[ i ]⟨ ·-comm a (ℕ₊₁→ℤ f) i · ℕ₊₁→ℤ d ⟩
(ℕ₊₁→ℤ f · a) · ℕ₊₁→ℤ d ≡⟨ sym (·-assoc (ℕ₊₁→ℤ f) a (ℕ₊₁→ℤ d)) ⟩
ℕ₊₁→ℤ f · (a · ℕ₊₁→ℤ d) ≡[ i ]⟨ ℕ₊₁→ℤ f · p i ⟩
ℕ₊₁→ℤ f · (c · ℕ₊₁→ℤ b) ≡⟨ ·-assoc (ℕ₊₁→ℤ f) c (ℕ₊₁→ℤ b) ⟩
(ℕ₊₁→ℤ f · c) · ℕ₊₁→ℤ b ≡[ i ]⟨ ·-comm (ℕ₊₁→ℤ f) c i · ℕ₊₁→ℤ b ⟩
(c · ℕ₊₁→ℤ f) · ℕ₊₁→ℤ b ≡[ i ]⟨ q i · ℕ₊₁→ℤ b ⟩
(e · ℕ₊₁→ℤ d) · ℕ₊₁→ℤ b ≡⟨ sym (·-assoc e (ℕ₊₁→ℤ d) (ℕ₊₁→ℤ b)) ⟩
e · (ℕ₊₁→ℤ d · ℕ₊₁→ℤ b) ≡[ i ]⟨ e · ·-comm (ℕ₊₁→ℤ d) (ℕ₊₁→ℤ b) i ⟩
e · (ℕ₊₁→ℤ b · ℕ₊₁→ℤ d) ≡⟨ ·-assoc e (ℕ₊₁→ℤ b) (ℕ₊₁→ℤ d) ⟩
(e · ℕ₊₁→ℤ b) · ℕ₊₁→ℤ d ∎
eq/⁻¹ : ∀ x y → Path ℚ [ x ] [ y ] → x ∼ y
eq/⁻¹ = SetQuotient.effective (λ _ _ → isSetℤ _ _) isEquivRel∼
discreteℚ : Discrete ℚ
discreteℚ = discreteSetQuotients (discreteΣ discreteℤ (λ _ → subst Discrete 1+Path discreteℕ))
(λ _ _ → isSetℤ _ _) isEquivRel∼ (λ _ _ → discreteℤ _ _)
-- Natural number and negative integer literals for ℚ
open import Cubical.Data.Nat.Literals public
instance
fromNatℚ : HasFromNat ℚ
fromNatℚ = record { Constraint = λ _ → Unit ; fromNat = λ n → [ pos n / 1 ] }
instance
fromNegℚ : HasFromNeg ℚ
fromNegℚ = record { Constraint = λ _ → Unit ; fromNeg = λ n → [ neg n / 1 ] }
| 32.077922
| 94
| 0.554251
|
4e2b53e79b54e4b67a584870e53e4913bffa662b
| 196
|
agda
|
Agda
|
test/Fail/NoPatternMatching.agda
|
mdimjasevic/agda
|
8fb548356b275c7a1e79b768b64511ae937c738b
|
[
"BSD-3-Clause"
] | 1,989
|
2015-01-09T23:51:16.000Z
|
2022-03-30T18:20:48.000Z
|
test/Fail/NoPatternMatching.agda
|
Seanpm2001-languages/agda
|
9911f73061e21a87fad76c662463257afe02c861
|
[
"BSD-2-Clause"
] | 4,066
|
2015-01-10T11:24:51.000Z
|
2022-03-31T21:14:49.000Z
|
test/Fail/NoPatternMatching.agda
|
Seanpm2001-languages/agda
|
9911f73061e21a87fad76c662463257afe02c861
|
[
"BSD-2-Clause"
] | 371
|
2015-01-03T14:04:08.000Z
|
2022-03-30T19:00:30.000Z
|
{-# OPTIONS --no-pattern-matching #-}
id : {A : Set} (x : A) → A
id x = x
data Unit : Set where
unit : Unit
fail : Unit → Set
fail unit = Unit
-- Expected error: Pattern matching is disabled
| 16.333333
| 47
| 0.622449
|
647ab5aa96e08a53811f22f1b7c1a694749e278a
| 4,046
|
agda
|
Agda
|
Cubical/Codata/Stream/Properties.agda
|
kiana-S/univalent-foundations
|
8bdb0766260489f9c89a14f4c0f2ad26e5190dec
|
[
"MIT"
] | null | null | null |
Cubical/Codata/Stream/Properties.agda
|
kiana-S/univalent-foundations
|
8bdb0766260489f9c89a14f4c0f2ad26e5190dec
|
[
"MIT"
] | 1
|
2022-01-27T02:07:48.000Z
|
2022-01-27T02:07:48.000Z
|
Cubical/Codata/Stream/Properties.agda
|
kiana-S/univalent-foundations
|
8bdb0766260489f9c89a14f4c0f2ad26e5190dec
|
[
"MIT"
] | 1
|
2021-11-22T02:02:01.000Z
|
2021-11-22T02:02:01.000Z
|
{-# OPTIONS --cubical --no-import-sorts --safe --guardedness #-}
module Cubical.Codata.Stream.Properties where
open import Cubical.Core.Everything
open import Cubical.Data.Nat
open import Cubical.Foundations.Prelude
open import Cubical.Foundations.Equiv
open import Cubical.Foundations.Isomorphism
open import Cubical.Foundations.Univalence
open import Cubical.Codata.Stream.Base
open Stream
mapS : ∀ {A B} → (A → B) → Stream A → Stream B
head (mapS f xs) = f (head xs)
tail (mapS f xs) = mapS f (tail xs)
even : ∀ {A} → Stream A → Stream A
head (even a) = head a
tail (even a) = even (tail (tail a))
odd : ∀ {A} → Stream A → Stream A
head (odd a) = head (tail a)
tail (odd a) = odd (tail (tail a))
merge : ∀ {A} → Stream A → Stream A → Stream A
head (merge a _) = head a
head (tail (merge _ b)) = head b
tail (tail (merge a b)) = merge (tail a) (tail b)
mapS-id : ∀ {A} {xs : Stream A} → mapS (λ x → x) xs ≡ xs
head (mapS-id {xs = xs} i) = head xs
tail (mapS-id {xs = xs} i) = mapS-id {xs = tail xs} i
Stream-η : ∀ {A} {xs : Stream A} → xs ≡ (head xs , tail xs)
head (Stream-η {A} {xs} i) = head xs
tail (Stream-η {A} {xs} i) = tail xs
elimS : ∀ {A} (P : Stream A → Type₀) (c : ∀ x xs → P (x , xs)) (xs : Stream A) → P xs
elimS P c xs = transp (λ i → P (Stream-η {xs = xs} (~ i))) i0
(c (head xs) (tail xs))
odd≡even∘tail : ∀ {A} → (a : Stream A) → odd a ≡ even (tail a)
head (odd≡even∘tail a i) = head (tail a)
tail (odd≡even∘tail a i) = odd≡even∘tail (tail (tail a)) i
mergeEvenOdd≡id : ∀ {A} → (a : Stream A) → merge (even a) (odd a) ≡ a
head (mergeEvenOdd≡id a i) = head a
head (tail (mergeEvenOdd≡id a i)) = head (tail a)
tail (tail (mergeEvenOdd≡id a i)) = mergeEvenOdd≡id (tail (tail a)) i
module Equality≅Bisimulation where
-- Bisimulation
record _≈_ {A : Type₀} (x y : Stream A) : Type₀ where
coinductive
field
≈head : head x ≡ head y
≈tail : tail x ≈ tail y
open _≈_
bisim : {A : Type₀} → {x y : Stream A} → x ≈ y → x ≡ y
head (bisim x≈y i) = ≈head x≈y i
tail (bisim x≈y i) = bisim (≈tail x≈y) i
misib : {A : Type₀} → {x y : Stream A} → x ≡ y → x ≈ y
≈head (misib p) = λ i → head (p i)
≈tail (misib p) = misib (λ i → tail (p i))
iso1 : {A : Type₀} → {x y : Stream A} → (p : x ≡ y) → bisim (misib p) ≡ p
head (iso1 p i j) = head (p j)
tail (iso1 p i j) = iso1 (λ i → tail (p i)) i j
iso2 : {A : Type₀} → {x y : Stream A} → (p : x ≈ y) → misib (bisim p) ≡ p
≈head (iso2 p i) = ≈head p
≈tail (iso2 p i) = iso2 (≈tail p) i
path≃bisim : {A : Type₀} → {x y : Stream A} → (x ≡ y) ≃ (x ≈ y)
path≃bisim = isoToEquiv (iso misib bisim iso2 iso1)
path≡bisim : {A : Type₀} → {x y : Stream A} → (x ≡ y) ≡ (x ≈ y)
path≡bisim = ua path≃bisim
-- misib can be implemented by transport as well.
refl≈ : {A : Type₀} {x : Stream A} → x ≈ x
≈head refl≈ = refl
≈tail refl≈ = refl≈
cast : ∀ {A : Type₀} {x y : Stream A} (p : x ≡ y) → x ≈ y
cast {x = x} p = transport (λ i → x ≈ p i) refl≈
misib-refl : ∀ {A : Type₀} {x : Stream A} → misib {x = x} refl ≡ refl≈
≈head (misib-refl i) = refl
≈tail (misib-refl i) = misib-refl i
misibTransp : ∀ {A : Type₀} {x y : Stream A} (p : x ≡ y) → cast p ≡ misib p
misibTransp p = J (λ _ p → cast p ≡ misib p) ((transportRefl refl≈) ∙ (sym misib-refl)) p
module Stream≅Nat→ {A : Type₀} where
lookup : Stream A → ℕ → A
lookup xs zero = head xs
lookup xs (suc n) = lookup (tail xs) n
tabulate : (ℕ → A) → Stream A
head (tabulate f) = f zero
tail (tabulate f) = tabulate (λ n → f (suc n))
lookup∘tabulate : (λ (x : _ → A) → lookup (tabulate x)) ≡ (λ x → x)
lookup∘tabulate i f zero = f zero
lookup∘tabulate i f (suc n) = lookup∘tabulate i (λ n → f (suc n)) n
tabulate∘lookup : (λ (x : Stream A) → tabulate (lookup x)) ≡ (λ x → x)
head (tabulate∘lookup i xs) = head xs
tail (tabulate∘lookup i xs) = tabulate∘lookup i (tail xs)
Stream≡Nat→ : Stream A ≡ (ℕ → A)
Stream≡Nat→ = isoToPath (iso lookup tabulate (λ f i → lookup∘tabulate i f) (λ xs i → tabulate∘lookup i xs))
| 33.163934
| 109
| 0.580079
|
356c41f6c253821e2c4a36025ff75e85db08f15e
| 2,631
|
agda
|
Agda
|
src/Prelude/Nat/Properties.agda
|
t-more/agda-prelude
|
da4fca7744d317b8843f2bc80a923972f65548d3
|
[
"MIT"
] | 111
|
2015-01-05T11:28:15.000Z
|
2022-02-12T23:29:26.000Z
|
src/Prelude/Nat/Properties.agda
|
t-more/agda-prelude
|
da4fca7744d317b8843f2bc80a923972f65548d3
|
[
"MIT"
] | 59
|
2016-02-09T05:36:44.000Z
|
2022-01-14T07:32:36.000Z
|
src/Prelude/Nat/Properties.agda
|
t-more/agda-prelude
|
da4fca7744d317b8843f2bc80a923972f65548d3
|
[
"MIT"
] | 24
|
2015-03-12T18:03:45.000Z
|
2021-04-22T06:10:41.000Z
|
module Prelude.Nat.Properties where
open import Prelude.Bool
open import Prelude.Nat.Core
open import Prelude.Equality
open import Prelude.Semiring
suc-inj : ∀ {n m} → suc n ≡ suc m → n ≡ m
suc-inj refl = refl
--- Addition ---
add-zero-r : (n : Nat) → n + 0 ≡ n
add-zero-r zero = refl
add-zero-r (suc n) = suc $≡ add-zero-r n
add-suc-r : (n m : Nat) → n + suc m ≡ suc (n + m)
add-suc-r zero m = refl
add-suc-r (suc n) m = suc $≡ add-suc-r n m
add-commute : (a b : Nat) → a + b ≡ b + a
add-commute zero b = sym (add-zero-r _)
add-commute (suc a) b = suc $≡ add-commute a b ⟨≡⟩ʳ add-suc-r b _
add-assoc : (a b c : Nat) → a + (b + c) ≡ a + b + c
add-assoc zero b c = refl
add-assoc (suc a) b c = suc $≡ add-assoc a b c
add-inj₂ : (a b c : Nat) → a + b ≡ a + c → b ≡ c
add-inj₂ zero b c eq = eq
add-inj₂ (suc a) b c eq = add-inj₂ a b c (suc-inj eq)
add-inj₁ : (a b c : Nat) → a + c ≡ b + c → a ≡ b
add-inj₁ a b c eq = add-inj₂ c a b (add-commute c a ⟨≡⟩ eq ⟨≡⟩ add-commute b c)
--- Subtraction ---
--- Multiplication ---
mul-one-r : (x : Nat) → x * 1 ≡ x
mul-one-r zero = refl
mul-one-r (suc x) = suc $≡ mul-one-r x
mul-zero-r : (x : Nat) → x * 0 ≡ 0
mul-zero-r zero = refl
mul-zero-r (suc x) = mul-zero-r x
mul-distr-r : (x y z : Nat) → (x + y) * z ≡ x * z + y * z
mul-distr-r zero y z = refl
mul-distr-r (suc x) y z = z +_ $≡ mul-distr-r x y z ⟨≡⟩ add-assoc z _ _
private
shuffle : (a b c d : Nat) → a + b + (c + d) ≡ a + c + (b + d)
shuffle a b c d = add-assoc a _ _ ʳ⟨≡⟩
a +_ $≡ (add-assoc b c d ⟨≡⟩ _+ d $≡ add-commute b c ⟨≡⟩ʳ add-assoc c b d) ⟨≡⟩
add-assoc a _ _
mul-distr-l : (x y z : Nat) → x * (y + z) ≡ x * y + x * z
mul-distr-l zero y z = refl
mul-distr-l (suc x) y z = y + z +_ $≡ mul-distr-l x y z ⟨≡⟩ shuffle y z (x * y) (x * z)
mul-assoc : (x y z : Nat) → x * (y * z) ≡ x * y * z
mul-assoc zero y z = refl
mul-assoc (suc x) y z = y * z +_ $≡ mul-assoc x y z ⟨≡⟩ʳ mul-distr-r y (x * y) z
mul-commute : (x y : Nat) → x * y ≡ y * x
mul-commute x zero = mul-zero-r x
mul-commute x (suc y) = mul-distr-l x 1 y ⟨≡⟩ _+ x * y $≡ mul-one-r x ⟨≡⟩ x +_ $≡ mul-commute x y
mul-inj₁ : (x y z : Nat) {{_ : NonZero z}} → x * z ≡ y * z → x ≡ y
mul-inj₁ x y zero {{}}
mul-inj₁ zero zero (suc z) eq = refl
mul-inj₁ zero (suc y) (suc z) ()
mul-inj₁ (suc x) zero (suc z) ()
mul-inj₁ (suc x) (suc y) (suc z) eq = suc $≡ mul-inj₁ x y (suc z) (add-inj₂ z _ _ (suc-inj eq))
mul-inj₂ : (x y z : Nat) {{_ : NonZero x}} → x * y ≡ x * z → y ≡ z
mul-inj₂ x y z eq = mul-inj₁ y z x (mul-commute y x ⟨≡⟩ eq ⟨≡⟩ mul-commute x z)
| 32.8875
| 98
| 0.522995
|
4e0ca7e6bd1ca737b7b4b7252e4f18163452cd0f
| 500
|
agda
|
Agda
|
test/Succeed/Issue557.agda
|
mdimjasevic/agda
|
8fb548356b275c7a1e79b768b64511ae937c738b
|
[
"BSD-3-Clause"
] | 1,989
|
2015-01-09T23:51:16.000Z
|
2022-03-30T18:20:48.000Z
|
test/Succeed/Issue557.agda
|
Seanpm2001-languages/agda
|
9911f73061e21a87fad76c662463257afe02c861
|
[
"BSD-2-Clause"
] | 4,066
|
2015-01-10T11:24:51.000Z
|
2022-03-31T21:14:49.000Z
|
test/Succeed/Issue557.agda
|
Seanpm2001-languages/agda
|
9911f73061e21a87fad76c662463257afe02c861
|
[
"BSD-2-Clause"
] | 371
|
2015-01-03T14:04:08.000Z
|
2022-03-30T19:00:30.000Z
|
-- Andreas, 2012-01-30, bug reported by Nisse
-- {-# OPTIONS -v tc.term.absurd:50 -v tc.signature:30 -v tc.conv.atom:30 -v tc.conv.elim:50 #-}
module Issue557 where
data ⊥ : Set where
postulate
A : Set
a : (⊥ → ⊥) → A
F : A → Set
f : (a : A) → F a
module M (I : Set → Set) where
x : A
x = a (λ ())
y : A
y = M.x (λ A → A)
z : F y
z = f y
-- cause was absurd lambda in a module, i.e., under a telescope (I : Set -> Set)
-- (λ ()) must be replaced by (absurd I) not just by (absurd)
| 19.230769
| 96
| 0.562
|
6574976a0382a4cf9e2173f8d15f7d53001874d6
| 1,469
|
agda
|
Agda
|
Rings/Orders/Partial/Bounded.agda
|
Smaug123/agdaproofs
|
0f4230011039092f58f673abcad8fb0652e6b562
|
[
"MIT"
] | 4
|
2019-08-08T12:44:19.000Z
|
2022-01-28T06:04:15.000Z
|
Rings/Orders/Partial/Bounded.agda
|
Smaug123/agdaproofs
|
0f4230011039092f58f673abcad8fb0652e6b562
|
[
"MIT"
] | 14
|
2019-01-06T21:11:59.000Z
|
2020-04-11T11:03:39.000Z
|
Rings/Orders/Partial/Bounded.agda
|
Smaug123/agdaproofs
|
0f4230011039092f58f673abcad8fb0652e6b562
|
[
"MIT"
] | 1
|
2021-11-29T13:23:07.000Z
|
2021-11-29T13:23:07.000Z
|
{-# OPTIONS --safe --warning=error --without-K --guardedness #-}
open import Agda.Primitive using (Level; lzero; lsuc; _⊔_)
open import Setoids.Setoids
open import Rings.Definition
open import Rings.Orders.Partial.Definition
open import Sets.EquivalenceRelations
open import Sequences
open import Setoids.Orders.Partial.Definition
open import Functions.Definition
open import LogicalFormulae
open import Numbers.Naturals.Semiring
open import Groups.Definition
module Rings.Orders.Partial.Bounded {m n o : _} {A : Set m} {S : Setoid {m} {n} A} {_+_ : A → A → A} {_*_ : A → A → A} {_<_ : Rel {m} {o} A} {pOrder : SetoidPartialOrder S _<_} {R : Ring S _+_ _*_} (pRing : PartiallyOrderedRing R pOrder) where
open Group (Ring.additiveGroup R)
open import Groups.Lemmas (Ring.additiveGroup R)
open Setoid S
open Equivalence eq
open SetoidPartialOrder pOrder
BoundedAbove : Sequence A → Set (m ⊔ o)
BoundedAbove x = Sg A (λ K → (n : ℕ) → index x n < K)
BoundedBelow : Sequence A → Set (m ⊔ o)
BoundedBelow x = Sg A (λ K → (n : ℕ) → K < index x n)
Bounded : Sequence A → Set (m ⊔ o)
Bounded x = Sg A (λ K → (n : ℕ) → ((Group.inverse (Ring.additiveGroup R) K) < index x n) && (index x n < K))
boundNonzero : {s : Sequence A} → (b : Bounded s) → underlying b ∼ 0G → False
boundNonzero {s} (a , b) isEq with b 0
... | bad1 ,, bad2 = irreflexive (<Transitive bad1 (<WellDefined reflexive (transitive isEq (symmetric (transitive (inverseWellDefined isEq) invIdent))) bad2))
| 40.805556
| 243
| 0.699796
|
d1da78a7b73e8a7a3d26da9a73584def9982a6b6
| 5,589
|
agda
|
Agda
|
core/lib/types/CommutingSquare.agda
|
mikeshulman/HoTT-Agda
|
e7d663b63d89f380ab772ecb8d51c38c26952dbb
|
[
"MIT"
] | null | null | null |
core/lib/types/CommutingSquare.agda
|
mikeshulman/HoTT-Agda
|
e7d663b63d89f380ab772ecb8d51c38c26952dbb
|
[
"MIT"
] | null | null | null |
core/lib/types/CommutingSquare.agda
|
mikeshulman/HoTT-Agda
|
e7d663b63d89f380ab772ecb8d51c38c26952dbb
|
[
"MIT"
] | 1
|
2018-12-26T21:31:57.000Z
|
2018-12-26T21:31:57.000Z
|
{-# OPTIONS --without-K --rewriting #-}
open import lib.Basics
open import lib.types.Sigma
open import lib.types.Paths
module lib.types.CommutingSquare where
{- maps between two functions -}
infix 0 _□$_
_□$_ = CommSquare.commutes
CommSquare-∘v : ∀ {i₀ i₁ i₂ j₀ j₁ j₂}
{A₀ : Type i₀} {A₁ : Type i₁} {A₂ : Type i₂}
{B₀ : Type j₀} {B₁ : Type j₁} {B₂ : Type j₂}
{f₀ : A₀ → B₀} {f₁ : A₁ → B₁} {f₂ : A₂ → B₂}
{hA : A₀ → A₁} {hB : B₀ → B₁}
{kA : A₁ → A₂} {kB : B₁ → B₂}
→ CommSquare f₁ f₂ kA kB
→ CommSquare f₀ f₁ hA hB
→ CommSquare f₀ f₂ (kA ∘ hA) (kB ∘ hB)
CommSquare-∘v {hA = hA} {kB = kB} (comm-sqr □₁₂) (comm-sqr □₀₁) =
comm-sqr λ a₀ → ap kB (□₀₁ a₀) ∙ □₁₂ (hA a₀)
CommSquare-inverse-v : ∀ {i₀ i₁ j₀ j₁}
{A₀ : Type i₀} {A₁ : Type i₁} {B₀ : Type j₀} {B₁ : Type j₁}
{f₀ : A₀ → B₀} {f₁ : A₁ → B₁} {hA : A₀ → A₁} {hB : B₀ → B₁}
→ CommSquare f₀ f₁ hA hB → (hA-ise : is-equiv hA) (hB-ise : is-equiv hB)
→ CommSquare f₁ f₀ (is-equiv.g hA-ise) (is-equiv.g hB-ise)
CommSquare-inverse-v {f₀ = f₀} {f₁} {hA} {hB} (comm-sqr □) hA-ise hB-ise =
comm-sqr λ a₁ → ap hB.g (! (□ (hA.g a₁) ∙ ap f₁ (hA.f-g a₁))) ∙ hB.g-f (f₀ (hA.g a₁))
where module hA = is-equiv hA-ise
module hB = is-equiv hB-ise
abstract
-- 'r' with respect to '∘v'
CommSquare-inverse-inv-r : ∀ {i₀ i₁ j₀ j₁}
{A₀ : Type i₀} {A₁ : Type i₁} {B₀ : Type j₀} {B₁ : Type j₁}
{f₀ : A₀ → B₀} {f₁ : A₁ → B₁} {hA : A₀ → A₁} {hB : B₀ → B₁}
(cs : CommSquare f₀ f₁ hA hB) (hA-ise : is-equiv hA) (hB-ise : is-equiv hB)
→ ∀ a₁ → (CommSquare-∘v cs (CommSquare-inverse-v cs hA-ise hB-ise) □$ a₁)
== is-equiv.f-g hB-ise (f₁ a₁) ∙ ! (ap f₁ (is-equiv.f-g hA-ise a₁))
CommSquare-inverse-inv-r {f₀ = f₀} {f₁} {hA} {hB} (comm-sqr □) hA-ise hB-ise a₁ =
ap hB ( ap hB.g (! (□ (hA.g a₁) ∙ ap f₁ (hA.f-g a₁)))
∙ hB.g-f (f₀ (hA.g a₁)))
∙ □ (hA.g a₁)
=⟨ ap-∙ hB (ap hB.g (! (□ (hA.g a₁) ∙ ap f₁ (hA.f-g a₁)))) (hB.g-f (f₀ (hA.g a₁)))
|in-ctx _∙ □ (hA.g a₁) ⟩
( ap hB (ap hB.g (! (□ (hA.g a₁) ∙ ap f₁ (hA.f-g a₁))))
∙ ap hB (hB.g-f (f₀ (hA.g a₁))))
∙ □ (hA.g a₁)
=⟨ ap2 _∙_
(∘-ap hB hB.g (! (□ (hA.g a₁) ∙ ap f₁ (hA.f-g a₁))))
(hB.adj (f₀ (hA.g a₁)))
|in-ctx _∙ □ (hA.g a₁) ⟩
( ap (hB ∘ hB.g) (! (□ (hA.g a₁) ∙ ap f₁ (hA.f-g a₁)))
∙ hB.f-g (hB (f₀ (hA.g a₁))))
∙ □ (hA.g a₁)
=⟨ ! (↓-app=idf-out $ apd hB.f-g (! (□ (hA.g a₁) ∙ ap f₁ (hA.f-g a₁))))
|in-ctx _∙ □ (hA.g a₁) ⟩
( hB.f-g (f₁ a₁)
∙' (! (□ (hA.g a₁) ∙ ap f₁ (hA.f-g a₁))))
∙ □ (hA.g a₁)
=⟨ lemma (hB.f-g (f₁ a₁)) (□ (hA.g a₁)) (ap f₁ (hA.f-g a₁)) ⟩
hB.f-g (f₁ a₁) ∙ ! (ap f₁ (hA.f-g a₁))
=∎
where module hA = is-equiv hA-ise
module hB = is-equiv hB-ise
lemma : ∀ {i} {A : Type i} {a₀ a₁ a₂ a₃ : A}
(p₀ : a₀ == a₁) (p₁ : a₃ == a₂) (p₂ : a₂ == a₁)
→ (p₀ ∙' (! (p₁ ∙ p₂))) ∙ p₁ == p₀ ∙ ! p₂
lemma idp idp idp = idp
-- 'l' with respect to '∘v'
CommSquare-inverse-inv-l : ∀ {i₀ i₁ j₀ j₁}
{A₀ : Type i₀} {A₁ : Type i₁} {B₀ : Type j₀} {B₁ : Type j₁}
{f₀ : A₀ → B₀} {f₁ : A₁ → B₁} {hA : A₀ → A₁} {hB : B₀ → B₁}
(cs : CommSquare f₀ f₁ hA hB) (hA-ise : is-equiv hA) (hB-ise : is-equiv hB)
→ ∀ a₀ → (CommSquare-∘v (CommSquare-inverse-v cs hA-ise hB-ise) cs □$ a₀)
== is-equiv.g-f hB-ise (f₀ a₀) ∙ ! (ap f₀ (is-equiv.g-f hA-ise a₀))
CommSquare-inverse-inv-l {f₀ = f₀} {f₁} {hA} {hB} (comm-sqr □) hA-ise hB-ise a₀ =
ap hB.g (□ a₀)
∙ ( ap hB.g (! (□ (hA.g (hA a₀)) ∙ ap f₁ (hA.f-g (hA a₀))))
∙ hB.g-f (f₀ (hA.g (hA a₀))))
=⟨ ! (hA.adj a₀) |in-ctx ap f₁
|in-ctx □ (hA.g (hA a₀)) ∙_
|in-ctx ! |in-ctx ap hB.g
|in-ctx _∙ hB.g-f (f₀ (hA.g (hA a₀)))
|in-ctx ap hB.g (□ a₀) ∙_ ⟩
ap hB.g (□ a₀)
∙ ( ap hB.g (! (□ (hA.g (hA a₀)) ∙ ap f₁ (ap hA (hA.g-f a₀))))
∙ hB.g-f (f₀ (hA.g (hA a₀))))
=⟨ ∘-ap f₁ hA (hA.g-f a₀)
|in-ctx □ (hA.g (hA a₀)) ∙_
|in-ctx ! |in-ctx ap hB.g
|in-ctx _∙ hB.g-f (f₀ (hA.g (hA a₀)))
|in-ctx ap hB.g (□ a₀) ∙_ ⟩
ap hB.g (□ a₀)
∙ ( ap hB.g (! (□ (hA.g (hA a₀)) ∙ ap (f₁ ∘ hA) (hA.g-f a₀)))
∙ hB.g-f (f₀ (hA.g (hA a₀))))
=⟨ ↓-='-out' (apd □ (hA.g-f a₀))
|in-ctx ! |in-ctx ap hB.g
|in-ctx _∙ hB.g-f (f₀ (hA.g (hA a₀)))
|in-ctx ap hB.g (□ a₀) ∙_ ⟩
ap hB.g (□ a₀)
∙ ( ap hB.g (! (ap (hB ∘ f₀) (hA.g-f a₀) ∙' □ a₀))
∙ hB.g-f (f₀ (hA.g (hA a₀))))
=⟨ lemma hB.g (□ a₀) (ap (hB ∘ f₀) (hA.g-f a₀)) (hB.g-f (f₀ (hA.g (hA a₀)))) ⟩
! (ap hB.g (ap (hB ∘ f₀) (hA.g-f a₀)))
∙' hB.g-f (f₀ (hA.g (hA a₀)))
=⟨ ∘-ap hB.g (hB ∘ f₀) (hA.g-f a₀)
|in-ctx ! |in-ctx _∙' hB.g-f (f₀ (hA.g (hA a₀))) ⟩
! (ap (hB.g ∘ hB ∘ f₀) (hA.g-f a₀))
∙' hB.g-f (f₀ (hA.g (hA a₀)))
=⟨ !-ap (hB.g ∘ hB ∘ f₀) (hA.g-f a₀)
|in-ctx _∙' hB.g-f (f₀ (hA.g (hA a₀))) ⟩
ap (hB.g ∘ hB ∘ f₀) (! (hA.g-f a₀))
∙' hB.g-f (f₀ (hA.g (hA a₀)))
=⟨ ! (↓-='-out' (apd (hB.g-f ∘ f₀) (! (hA.g-f a₀)))) ⟩
hB.g-f (f₀ a₀) ∙ ap f₀ (! (hA.g-f a₀))
=⟨ ap-! f₀ (hA.g-f a₀) |in-ctx hB.g-f (f₀ a₀) ∙_ ⟩
hB.g-f (f₀ a₀) ∙ ! (ap f₀ (hA.g-f a₀))
=∎
where module hA = is-equiv hA-ise
module hB = is-equiv hB-ise
lemma : ∀ {i j} {A : Type i} {B : Type j} (f : A → B)
{a₀ a₁ a₂ : A} {b : B}
(p₀ : a₀ == a₁) (p₁ : a₂ == a₀) (q₀ : f a₂ == b)
→ ap f p₀ ∙ (ap f (! (p₁ ∙' p₀)) ∙ q₀) == ! (ap f p₁) ∙' q₀
lemma f idp idp idp = idp
| 41.708955
| 88
| 0.449633
|
0d879ef9f4cc7b9c693e7f6c93da6c096ec3db39
| 14,523
|
agda
|
Agda
|
Cubical/Foundations/Path.agda
|
howsiyu/cubical
|
1b9c97a2140fe96fe636f4c66beedfd7b8096e8f
|
[
"MIT"
] | null | null | null |
Cubical/Foundations/Path.agda
|
howsiyu/cubical
|
1b9c97a2140fe96fe636f4c66beedfd7b8096e8f
|
[
"MIT"
] | null | null | null |
Cubical/Foundations/Path.agda
|
howsiyu/cubical
|
1b9c97a2140fe96fe636f4c66beedfd7b8096e8f
|
[
"MIT"
] | null | null | null |
{-# OPTIONS --safe #-}
module Cubical.Foundations.Path where
open import Cubical.Foundations.Prelude
open import Cubical.Foundations.Function
open import Cubical.Foundations.GroupoidLaws
open import Cubical.Foundations.Equiv
open import Cubical.Foundations.Isomorphism
open import Cubical.Foundations.Transport
open import Cubical.Foundations.Univalence
open import Cubical.Reflection.StrictEquiv
private
variable
ℓ ℓ' : Level
A : Type ℓ
-- Less polymorphic version of `cong`, to avoid some unresolved metas
cong′ : ∀ {B : Type ℓ'} (f : A → B) {x y : A} (p : x ≡ y)
→ Path B (f x) (f y)
cong′ f = cong f
{-# INLINE cong′ #-}
module _ {A : I → Type ℓ} {x : A i0} {y : A i1} where
toPathP⁻ : x ≡ transport⁻ (λ i → A i) y → PathP A x y
toPathP⁻ p = symP (toPathP (sym p))
fromPathP⁻ : PathP A x y → x ≡ transport⁻ (λ i → A i) y
fromPathP⁻ p = sym (fromPathP {A = λ i → A (~ i)} (symP p))
PathP≡Path : ∀ (P : I → Type ℓ) (p : P i0) (q : P i1) →
PathP P p q ≡ Path (P i1) (transport (λ i → P i) p) q
PathP≡Path P p q i = PathP (λ j → P (i ∨ j)) (transport-filler (λ j → P j) p i) q
PathP≡Path⁻ : ∀ (P : I → Type ℓ) (p : P i0) (q : P i1) →
PathP P p q ≡ Path (P i0) p (transport⁻ (λ i → P i) q)
PathP≡Path⁻ P p q i = PathP (λ j → P (~ i ∧ j)) p (transport⁻-filler (λ j → P j) q i)
PathPIsoPath : ∀ (A : I → Type ℓ) (x : A i0) (y : A i1) → Iso (PathP A x y) (transport (λ i → A i) x ≡ y)
PathPIsoPath A x y .Iso.fun = fromPathP
PathPIsoPath A x y .Iso.inv = toPathP
PathPIsoPath A x y .Iso.rightInv q k i =
hcomp
(λ j → λ
{ (i = i0) → slide (j ∨ ~ k)
; (i = i1) → q j
; (k = i0) → transp (λ l → A (i ∨ l)) i (fromPathPFiller j)
; (k = i1) → ∧∨Square i j
})
(transp (λ l → A (i ∨ ~ k ∨ l)) (i ∨ ~ k)
(transp (λ l → (A (i ∨ (~ k ∧ l)))) (k ∨ i)
(transp (λ l → A (i ∧ l)) (~ i)
x)))
where
fromPathPFiller : _
fromPathPFiller =
hfill
(λ j → λ
{ (i = i0) → x
; (i = i1) → q j })
(inS (transp (λ j → A (i ∧ j)) (~ i) x))
slide : I → _
slide i = transp (λ l → A (i ∨ l)) i (transp (λ l → A (i ∧ l)) (~ i) x)
∧∨Square : I → I → _
∧∨Square i j =
hcomp
(λ l → λ
{ (i = i0) → slide j
; (i = i1) → q (j ∧ l)
; (j = i0) → slide i
; (j = i1) → q (i ∧ l)
})
(slide (i ∨ j))
PathPIsoPath A x y .Iso.leftInv q k i =
outS
(hcomp-unique
(λ j → λ
{ (i = i0) → x
; (i = i1) → transp (λ l → A (j ∨ l)) j (q j)
})
(inS (transp (λ l → A (i ∧ l)) (~ i) x))
(λ j → inS (transp (λ l → A (i ∧ (j ∨ l))) (~ i ∨ j) (q (i ∧ j)))))
k
PathP≃Path : (A : I → Type ℓ) (x : A i0) (y : A i1) →
PathP A x y ≃ (transport (λ i → A i) x ≡ y)
PathP≃Path A x y = isoToEquiv (PathPIsoPath A x y)
PathP≡compPath : ∀ {A : Type ℓ} {x y z : A} (p : x ≡ y) (q : y ≡ z) (r : x ≡ z)
→ (PathP (λ i → x ≡ q i) p r) ≡ (p ∙ q ≡ r)
PathP≡compPath p q r k = PathP (λ i → p i0 ≡ q (i ∨ k)) (λ j → compPath-filler p q k j) r
-- a quick corollary for 3-constant functions
3-ConstantCompChar : {A : Type ℓ} {B : Type ℓ'} (f : A → B) (link : 2-Constant f)
→ (∀ x y z → link x y ∙ link y z ≡ link x z)
→ 3-Constant f
3-Constant.link (3-ConstantCompChar f link coh₂) = link
3-Constant.coh₁ (3-ConstantCompChar f link coh₂) _ _ _ =
transport⁻ (PathP≡compPath _ _ _) (coh₂ _ _ _)
PathP≡doubleCompPathˡ : ∀ {A : Type ℓ} {w x y z : A} (p : w ≡ y) (q : w ≡ x) (r : y ≡ z) (s : x ≡ z)
→ (PathP (λ i → p i ≡ s i) q r) ≡ (p ⁻¹ ∙∙ q ∙∙ s ≡ r)
PathP≡doubleCompPathˡ p q r s k = PathP (λ i → p (i ∨ k) ≡ s (i ∨ k))
(λ j → doubleCompPath-filler (p ⁻¹) q s k j) r
PathP≡doubleCompPathʳ : ∀ {A : Type ℓ} {w x y z : A} (p : w ≡ y) (q : w ≡ x) (r : y ≡ z) (s : x ≡ z)
→ (PathP (λ i → p i ≡ s i) q r) ≡ (q ≡ p ∙∙ r ∙∙ s ⁻¹)
PathP≡doubleCompPathʳ p q r s k = PathP (λ i → p (i ∧ (~ k)) ≡ s (i ∧ (~ k)))
q (λ j → doubleCompPath-filler p r (s ⁻¹) k j)
compPathl-cancel : ∀ {ℓ} {A : Type ℓ} {x y z : A} (p : x ≡ y) (q : x ≡ z) → p ∙ (sym p ∙ q) ≡ q
compPathl-cancel p q = p ∙ (sym p ∙ q) ≡⟨ assoc p (sym p) q ⟩
(p ∙ sym p) ∙ q ≡⟨ cong (_∙ q) (rCancel p) ⟩
refl ∙ q ≡⟨ sym (lUnit q) ⟩
q ∎
compPathr-cancel : ∀ {ℓ} {A : Type ℓ} {x y z : A} (p : z ≡ y) (q : x ≡ y) → (q ∙ sym p) ∙ p ≡ q
compPathr-cancel {x = x} p q i j =
hcomp-equivFiller (doubleComp-faces (λ _ → x) (sym p) j) (inS (q j)) (~ i)
compPathl-isEquiv : {x y z : A} (p : x ≡ y) → isEquiv (λ (q : y ≡ z) → p ∙ q)
compPathl-isEquiv p = isoToIsEquiv (iso (p ∙_) (sym p ∙_) (compPathl-cancel p) (compPathl-cancel (sym p)))
compPathlEquiv : {x y z : A} (p : x ≡ y) → (y ≡ z) ≃ (x ≡ z)
compPathlEquiv p = (p ∙_) , compPathl-isEquiv p
compPathr-isEquiv : {x y z : A} (p : y ≡ z) → isEquiv (λ (q : x ≡ y) → q ∙ p)
compPathr-isEquiv p = isoToIsEquiv (iso (_∙ p) (_∙ sym p) (compPathr-cancel p) (compPathr-cancel (sym p)))
compPathrEquiv : {x y z : A} (p : y ≡ z) → (x ≡ y) ≃ (x ≡ z)
compPathrEquiv p = (_∙ p) , compPathr-isEquiv p
-- Variations of isProp→isSet for PathP
isProp→SquareP : ∀ {B : I → I → Type ℓ} → ((i j : I) → isProp (B i j))
→ {a : B i0 i0} {b : B i0 i1} {c : B i1 i0} {d : B i1 i1}
→ (r : PathP (λ j → B j i0) a c) (s : PathP (λ j → B j i1) b d)
→ (t : PathP (λ j → B i0 j) a b) (u : PathP (λ j → B i1 j) c d)
→ SquareP B t u r s
isProp→SquareP {B = B} isPropB {a = a} r s t u i j =
hcomp (λ { k (i = i0) → isPropB i0 j (base i0 j) (t j) k
; k (i = i1) → isPropB i1 j (base i1 j) (u j) k
; k (j = i0) → isPropB i i0 (base i i0) (r i) k
; k (j = i1) → isPropB i i1 (base i i1) (s i) k
}) (base i j) where
base : (i j : I) → B i j
base i j = transport (λ k → B (i ∧ k) (j ∧ k)) a
isProp→isPropPathP : ∀ {ℓ} {B : I → Type ℓ} → ((i : I) → isProp (B i))
→ (b0 : B i0) (b1 : B i1)
→ isProp (PathP (λ i → B i) b0 b1)
isProp→isPropPathP {B = B} hB b0 b1 = isProp→SquareP (λ _ → hB) refl refl
isProp→isContrPathP : {A : I → Type ℓ} → (∀ i → isProp (A i))
→ (x : A i0) (y : A i1)
→ isContr (PathP A x y)
isProp→isContrPathP h x y = isProp→PathP h x y , isProp→isPropPathP h x y _
-- Flipping a square along its diagonal
flipSquare : {a₀₀ a₀₁ : A} {a₀₋ : a₀₀ ≡ a₀₁}
{a₁₀ a₁₁ : A} {a₁₋ : a₁₀ ≡ a₁₁}
{a₋₀ : a₀₀ ≡ a₁₀} {a₋₁ : a₀₁ ≡ a₁₁}
→ Square a₀₋ a₁₋ a₋₀ a₋₁ → Square a₋₀ a₋₁ a₀₋ a₁₋
flipSquare sq i j = sq j i
module _ {a₀₀ a₀₁ : A} {a₀₋ : a₀₀ ≡ a₀₁} {a₁₀ a₁₁ : A} {a₁₋ : a₁₀ ≡ a₁₁}
{a₋₀ : a₀₀ ≡ a₁₀} {a₋₁ : a₀₁ ≡ a₁₁}
where
flipSquareEquiv : Square a₀₋ a₁₋ a₋₀ a₋₁ ≃ Square a₋₀ a₋₁ a₀₋ a₁₋
unquoteDef flipSquareEquiv = defStrictEquiv flipSquareEquiv flipSquare flipSquare
flipSquarePath : Square a₀₋ a₁₋ a₋₀ a₋₁ ≡ Square a₋₀ a₋₁ a₀₋ a₁₋
flipSquarePath = ua flipSquareEquiv
module _ {a₀₀ a₁₁ : A} {a₋ : a₀₀ ≡ a₁₁}
{a₁₀ : A} {a₁₋ : a₁₀ ≡ a₁₁} {a₋₀ : a₀₀ ≡ a₁₀} where
slideSquareFaces : (i j k : I) → Partial (i ∨ ~ i ∨ j ∨ ~ j) A
slideSquareFaces i j k (i = i0) = a₋ (j ∧ ~ k)
slideSquareFaces i j k (i = i1) = a₁₋ j
slideSquareFaces i j k (j = i0) = a₋₀ i
slideSquareFaces i j k (j = i1) = a₋ (i ∨ ~ k)
slideSquare : Square a₋ a₁₋ a₋₀ refl → Square refl a₁₋ a₋₀ a₋
slideSquare sq i j = hcomp (slideSquareFaces i j) (sq i j)
slideSquareEquiv : (Square a₋ a₁₋ a₋₀ refl) ≃ (Square refl a₁₋ a₋₀ a₋)
slideSquareEquiv = isoToEquiv (iso slideSquare slideSquareInv fillerTo fillerFrom) where
slideSquareInv : Square refl a₁₋ a₋₀ a₋ → Square a₋ a₁₋ a₋₀ refl
slideSquareInv sq i j = hcomp (λ k → slideSquareFaces i j (~ k)) (sq i j)
fillerTo : ∀ p → slideSquare (slideSquareInv p) ≡ p
fillerTo p k i j = hcomp-equivFiller (λ k → slideSquareFaces i j (~ k)) (inS (p i j)) (~ k)
fillerFrom : ∀ p → slideSquareInv (slideSquare p) ≡ p
fillerFrom p k i j = hcomp-equivFiller (slideSquareFaces i j) (inS (p i j)) (~ k)
-- The type of fillers of a square is equivalent to the double composition identites
Square≃doubleComp : {a₀₀ a₀₁ a₁₀ a₁₁ : A}
(a₀₋ : a₀₀ ≡ a₀₁) (a₁₋ : a₁₀ ≡ a₁₁)
(a₋₀ : a₀₀ ≡ a₁₀) (a₋₁ : a₀₁ ≡ a₁₁)
→ Square a₀₋ a₁₋ a₋₀ a₋₁ ≃ (a₋₀ ⁻¹ ∙∙ a₀₋ ∙∙ a₋₁ ≡ a₁₋)
Square≃doubleComp a₀₋ a₁₋ a₋₀ a₋₁ = transportEquiv (PathP≡doubleCompPathˡ a₋₀ a₀₋ a₁₋ a₋₁)
-- Flipping a square in Ω²A is the same as inverting it
sym≡flipSquare : {x : A} (P : Square (refl {x = x}) refl refl refl)
→ sym P ≡ flipSquare P
sym≡flipSquare {x = x} P = sym (main refl P)
where
B : (q : x ≡ x) → I → Type _
B q i = PathP (λ j → x ≡ q (i ∨ j)) (λ k → q (i ∧ k)) refl
main : (q : x ≡ x) (p : refl ≡ q) → PathP (λ i → B q i) (λ i j → p j i) (sym p)
main q = J (λ q p → PathP (λ i → B q i) (λ i j → p j i) (sym p)) refl
-- Inverting both interval arguments of a square in Ω²A is the same as doing nothing
sym-cong-sym≡id : {x : A} (P : Square (refl {x = x}) refl refl refl)
→ P ≡ λ i j → P (~ i) (~ j)
sym-cong-sym≡id {x = x} P = sym (main refl P)
where
B : (q : x ≡ x) → I → Type _
B q i = Path (x ≡ q i) (λ j → q (i ∨ ~ j)) λ j → q (i ∧ j)
main : (q : x ≡ x) (p : refl ≡ q) → PathP (λ i → B q i) (λ i j → p (~ i) (~ j)) p
main q = J (λ q p → PathP (λ i → B q i) (λ i j → p (~ i) (~ j)) p) refl
-- Applying cong sym is the same as flipping a square in Ω²A
flipSquare≡cong-sym : ∀ {ℓ} {A : Type ℓ} {x : A} (P : Square (refl {x = x}) refl refl refl)
→ flipSquare P ≡ λ i j → P i (~ j)
flipSquare≡cong-sym P = sym (sym≡flipSquare P) ∙ sym (sym-cong-sym≡id (cong sym P))
-- Applying cong sym is the same as inverting a square in Ω²A
sym≡cong-sym : ∀ {ℓ} {A : Type ℓ} {x : A} (P : Square (refl {x = x}) refl refl refl)
→ sym P ≡ cong sym P
sym≡cong-sym P = sym-cong-sym≡id (sym P)
-- sym induces an equivalence on identity types of paths
symIso : {a b : A} → Iso (a ≡ b) (b ≡ a)
symIso = iso sym sym (λ _ → refl) λ _ → refl
-- J is an equivalence
Jequiv : {x : A} (P : ∀ y → x ≡ y → Type ℓ') → P x refl ≃ (∀ {y} (p : x ≡ y) → P y p)
Jequiv P = isoToEquiv isom
where
isom : Iso _ _
Iso.fun isom = J P
Iso.inv isom f = f refl
Iso.rightInv isom f =
implicitFunExt λ {_} →
funExt λ t →
J (λ _ t → J P (f refl) t ≡ f t) (JRefl P (f refl)) t
Iso.leftInv isom = JRefl P
-- Action of PathP on equivalences (without relying on univalence)
congPathIso : ∀ {ℓ ℓ'} {A : I → Type ℓ} {B : I → Type ℓ'}
(e : ∀ i → A i ≃ B i) {a₀ : A i0} {a₁ : A i1}
→ Iso (PathP A a₀ a₁) (PathP B (e i0 .fst a₀) (e i1 .fst a₁))
congPathIso {A = A} {B} e {a₀} {a₁} .Iso.fun p i = e i .fst (p i)
congPathIso {A = A} {B} e {a₀} {a₁} .Iso.inv q i =
hcomp
(λ j → λ
{ (i = i0) → retEq (e i0) a₀ j
; (i = i1) → retEq (e i1) a₁ j
})
(invEq (e i) (q i))
congPathIso {A = A} {B} e {a₀} {a₁} .Iso.rightInv q k i =
hcomp
(λ j → λ
{ (i = i0) → commSqIsEq (e i0 .snd) a₀ j k
; (i = i1) → commSqIsEq (e i1 .snd) a₁ j k
; (k = i0) →
e i .fst
(hfill
(λ j → λ
{ (i = i0) → retEq (e i0) a₀ j
; (i = i1) → retEq (e i1) a₁ j
})
(inS (invEq (e i) (q i)))
j)
; (k = i1) → q i
})
(secEq (e i) (q i) k)
where b = commSqIsEq
congPathIso {A = A} {B} e {a₀} {a₁} .Iso.leftInv p k i =
hcomp
(λ j → λ
{ (i = i0) → retEq (e i0) a₀ (j ∨ k)
; (i = i1) → retEq (e i1) a₁ (j ∨ k)
; (k = i1) → p i
})
(retEq (e i) (p i) k)
congPathEquiv : ∀ {ℓ ℓ'} {A : I → Type ℓ} {B : I → Type ℓ'}
(e : ∀ i → A i ≃ B i) {a₀ : A i0} {a₁ : A i1}
→ PathP A a₀ a₁ ≃ PathP B (e i0 .fst a₀) (e i1 .fst a₁)
congPathEquiv e = isoToEquiv (congPathIso e)
-- Characterizations of dependent paths in path types
doubleCompPath-filler∙ : {a b c d : A} (p : a ≡ b) (q : b ≡ c) (r : c ≡ d)
→ PathP (λ i → p i ≡ r (~ i)) (p ∙ q ∙ r) q
doubleCompPath-filler∙ {A = A} {b = b} p q r j i =
hcomp (λ k → λ { (i = i0) → p j
; (i = i1) → side j k
; (j = i1) → q (i ∧ k)})
(p (j ∨ i))
where
side : I → I → A
side i j =
hcomp (λ k → λ { (i = i1) → q j
; (j = i0) → b
; (j = i1) → r (~ i ∧ k)})
(q j)
PathP→compPathL : {a b c d : A} {p : a ≡ c} {q : b ≡ d} {r : a ≡ b} {s : c ≡ d}
→ PathP (λ i → p i ≡ q i) r s
→ sym p ∙ r ∙ q ≡ s
PathP→compPathL {p = p} {q = q} {r = r} {s = s} P j i =
hcomp (λ k → λ { (i = i0) → p (j ∨ k)
; (i = i1) → q (j ∨ k)
; (j = i0) → doubleCompPath-filler∙ (sym p) r q (~ k) i
; (j = i1) → s i })
(P j i)
PathP→compPathR : {a b c d : A} {p : a ≡ c} {q : b ≡ d} {r : a ≡ b} {s : c ≡ d}
→ PathP (λ i → p i ≡ q i) r s
→ r ≡ p ∙ s ∙ sym q
PathP→compPathR {p = p} {q = q} {r = r} {s = s} P j i =
hcomp (λ k → λ { (i = i0) → p (j ∧ (~ k))
; (i = i1) → q (j ∧ (~ k))
; (j = i0) → r i
; (j = i1) → doubleCompPath-filler∙ p s (sym q) (~ k) i})
(P j i)
-- Other direction
compPathL→PathP : {a b c d : A} {p : a ≡ c} {q : b ≡ d} {r : a ≡ b} {s : c ≡ d}
→ sym p ∙ r ∙ q ≡ s
→ PathP (λ i → p i ≡ q i) r s
compPathL→PathP {p = p} {q = q} {r = r} {s = s} P j i =
hcomp (λ k → λ { (i = i0) → p (~ k ∨ j)
; (i = i1) → q (~ k ∨ j)
; (j = i0) → doubleCompPath-filler∙ (sym p) r q k i
; (j = i1) → s i})
(P j i)
compPathR→PathP : {a b c d : A} {p : a ≡ c} {q : b ≡ d} {r : a ≡ b} {s : c ≡ d}
→ r ≡ p ∙ s ∙ sym q
→ PathP (λ i → p i ≡ q i) r s
compPathR→PathP {p = p} {q = q} {r = r} {s = s} P j i =
hcomp (λ k → λ { (i = i0) → p (k ∧ j)
; (i = i1) → q (k ∧ j)
; (j = i0) → r i
; (j = i1) → doubleCompPath-filler∙ p s (sym q) k i})
(P j i)
compPathR→PathP∙∙ : {a b c d : A} {p : a ≡ c} {q : b ≡ d} {r : a ≡ b} {s : c ≡ d}
→ r ≡ p ∙∙ s ∙∙ sym q
→ PathP (λ i → p i ≡ q i) r s
compPathR→PathP∙∙ {p = p} {q = q} {r = r} {s = s} P j i =
hcomp (λ k → λ { (i = i0) → p (k ∧ j)
; (i = i1) → q (k ∧ j)
; (j = i0) → r i
; (j = i1) → doubleCompPath-filler p s (sym q) (~ k) i})
(P j i)
| 39.251351
| 106
| 0.476141
|
0df7e54ada19c7540acb374a912dfbaf5a15d55e
| 4,384
|
agda
|
Agda
|
agda-stdlib/src/Data/Table/Properties.agda
|
DreamLinuxer/popl21-artifact
|
fb380f2e67dcb4a94f353dbaec91624fcb5b8933
|
[
"MIT"
] | 5
|
2020-10-07T12:07:53.000Z
|
2020-10-10T21:41:32.000Z
|
agda-stdlib/src/Data/Table/Properties.agda
|
DreamLinuxer/popl21-artifact
|
fb380f2e67dcb4a94f353dbaec91624fcb5b8933
|
[
"MIT"
] | null | null | null |
agda-stdlib/src/Data/Table/Properties.agda
|
DreamLinuxer/popl21-artifact
|
fb380f2e67dcb4a94f353dbaec91624fcb5b8933
|
[
"MIT"
] | 1
|
2021-11-04T06:54:45.000Z
|
2021-11-04T06:54:45.000Z
|
------------------------------------------------------------------------
-- The Agda standard library
--
-- This module is DEPRECATED. Please use `Data.Vec.Functional` instead.
------------------------------------------------------------------------
{-# OPTIONS --without-K --safe #-}
-- Disabled to prevent warnings from other Table modules
{-# OPTIONS --warn=noUserWarning #-}
module Data.Table.Properties where
{-# WARNING_ON_IMPORT
"Data.Table.Properties was deprecated in v1.2.
Use Data.Vec.Functional.Properties instead."
#-}
open import Data.Table
open import Data.Table.Relation.Binary.Equality
open import Data.Bool.Base using (true; false; if_then_else_)
open import Data.Nat.Base using (zero; suc)
open import Data.Empty using (⊥-elim)
open import Data.Fin using (Fin; suc; zero; _≟_; punchIn)
import Data.Fin.Properties as FP
open import Data.Fin.Permutation as Perm using (Permutation; _⟨$⟩ʳ_; _⟨$⟩ˡ_)
open import Data.List.Base as L using (List; _∷_; [])
open import Data.List.Relation.Unary.Any using (here; there; index)
open import Data.List.Membership.Propositional using (_∈_)
open import Data.Product as Product using (Σ; ∃; _,_; proj₁; proj₂)
open import Data.Vec.Base as V using (Vec; _∷_; [])
import Data.Vec.Properties as VP
open import Level using (Level)
open import Function.Base using (_∘_; flip)
open import Function.Inverse using (Inverse)
open import Relation.Binary.PropositionalEquality as P
using (_≡_; _≢_; refl; sym; cong)
open import Relation.Nullary using (does)
open import Relation.Nullary.Decidable using (dec-true; dec-false)
open import Relation.Nullary.Negation using (contradiction)
private
variable
a : Level
A : Set a
------------------------------------------------------------------------
-- select
-- Selecting from any table is the same as selecting from a constant table.
select-const : ∀ {n} (z : A) (i : Fin n) t →
select z i t ≗ select z i (replicate (lookup t i))
select-const z i t j with does (j ≟ i)
... | true = refl
... | false = refl
-- Selecting an element from a table then looking it up is the same as looking
-- up the index in the original table
select-lookup : ∀ {n x i} (t : Table A n) →
lookup (select x i t) i ≡ lookup t i
select-lookup {i = i} t rewrite dec-true (i ≟ i) refl = refl
-- Selecting an element from a table then removing the same element produces a
-- constant table
select-remove : ∀ {n x} i (t : Table A (suc n)) →
remove i (select x i t) ≗ replicate {n = n} x
select-remove i t j rewrite dec-false (punchIn i j ≟ i) (FP.punchInᵢ≢i _ _)
= refl
------------------------------------------------------------------------
-- permute
-- Removing an index 'i' from a table permuted with 'π' is the same as
-- removing the element, then permuting with 'π' minus 'i'.
remove-permute : ∀ {m n} (π : Permutation (suc m) (suc n))
i (t : Table A (suc n)) →
remove (π ⟨$⟩ˡ i) (permute π t)
≗ permute (Perm.remove (π ⟨$⟩ˡ i) π) (remove i t)
remove-permute π i t j = P.cong (lookup t) (Perm.punchIn-permute′ π i j)
------------------------------------------------------------------------
-- fromList
fromList-∈ : ∀ {xs : List A} (i : Fin (L.length xs)) → lookup (fromList xs) i ∈ xs
fromList-∈ {xs = x ∷ xs} zero = here refl
fromList-∈ {xs = x ∷ xs} (suc i) = there (fromList-∈ i)
index-fromList-∈ : ∀ {xs : List A} {i} → index (fromList-∈ {xs = xs} i) ≡ i
index-fromList-∈ {xs = x ∷ xs} {zero} = refl
index-fromList-∈ {xs = x ∷ xs} {suc i} = cong suc index-fromList-∈
fromList-index : ∀ {xs} {x : A} (x∈xs : x ∈ xs) → lookup (fromList xs) (index x∈xs) ≡ x
fromList-index (here px) = sym px
fromList-index (there x∈xs) = fromList-index x∈xs
------------------------------------------------------------------------
-- There exists an isomorphism between tables and vectors.
↔Vec : ∀ {n} → Inverse (≡-setoid A n) (P.setoid (Vec A n))
↔Vec = record
{ to = record { _⟨$⟩_ = toVec ; cong = VP.tabulate-cong }
; from = P.→-to-⟶ fromVec
; inverse-of = record
{ left-inverse-of = VP.lookup∘tabulate ∘ lookup
; right-inverse-of = VP.tabulate∘lookup
}
}
------------------------------------------------------------------------
-- Other
lookup∈ : ∀ {xs : List A} (i : Fin (L.length xs)) → ∃ λ x → x ∈ xs
lookup∈ i = _ , fromList-∈ i
| 36.533333
| 87
| 0.573905
|
64c9f8db7305c94c0dcc9dca09fad02fcd843c1d
| 541
|
agda
|
Agda
|
test/Fail/Issue300.agda
|
mdimjasevic/agda
|
8fb548356b275c7a1e79b768b64511ae937c738b
|
[
"BSD-3-Clause"
] | 3
|
2015-03-28T14:51:03.000Z
|
2015-12-07T20:14:00.000Z
|
test/Fail/Issue300.agda
|
mdimjasevic/agda
|
8fb548356b275c7a1e79b768b64511ae937c738b
|
[
"BSD-3-Clause"
] | 3
|
2018-11-14T15:31:44.000Z
|
2019-04-01T19:39:26.000Z
|
test/Fail/Issue300.agda
|
mdimjasevic/agda
|
8fb548356b275c7a1e79b768b64511ae937c738b
|
[
"BSD-3-Clause"
] | 1
|
2015-09-15T14:36:15.000Z
|
2015-09-15T14:36:15.000Z
|
-- {-# OPTIONS -v tc.size.solve:60 #-}
module Issue300 where
open import Common.Size
data Nat : Size → Set where
zero : (i : Size) → Nat (↑ i)
suc : (i : Size) → Nat i → Nat (↑ i)
-- Size meta used in a different context than the one created in
A : Set₁
A = (Id : (i : Size) → Nat _ → Set)
(k : Size) (m : Nat (↑ k)) (p : Id k m) →
(j : Size) (n : Nat j ) → Id j n
-- should solve _ with ↑ i
-- 1) Id,k,m |- ↑ 1 ≤ X 1 ==> ↑ 4 ≤ X 4
-- 2) Id,k,m,p,j,n |- 1 ≤ X 1
-- Unfixed by fix for #1914 (Andreas, 2016-04-08).
| 23.521739
| 64
| 0.51756
|
1d01f2afaf8e4126adb42c23bf7c6e9907f4b600
| 790
|
agda
|
Agda
|
test/Succeed/Issue3364.agda
|
strake/agda
|
c8a3cfa002e77acc5ae1993bae413fde42d4f93b
|
[
"BSD-3-Clause"
] | 2
|
2019-10-29T09:40:30.000Z
|
2020-09-20T00:28:57.000Z
|
test/Succeed/Issue3364.agda
|
vikfret/agda
|
49ad0b3f0d39c01bc35123478b857e702b29fb9d
|
[
"BSD-3-Clause"
] | 1
|
2020-01-26T18:22:08.000Z
|
2020-01-26T18:22:08.000Z
|
test/Succeed/Issue3364.agda
|
vikfret/agda
|
49ad0b3f0d39c01bc35123478b857e702b29fb9d
|
[
"BSD-3-Clause"
] | 1
|
2021-04-01T18:30:09.000Z
|
2021-04-01T18:30:09.000Z
|
-- Andreas, 2018-11-03, issue #3364
-- Andreas, 2019-02-23, issue #3457
--
-- Better error when trying to import with new qualified module name.
open import Agda.Builtin.Nat as Builtin.Nat
-- WAS: Error:
-- Not in scope:
-- as at ...
-- when scope checking as
-- NOW: Warning
-- `as' must be followed by an identifier; a qualified name is not allowed here
-- when scope checking the declaration
-- open import Agda.Builtin.Nat as Builtin.Nat
import Agda.Builtin.Sigma as .as
-- `as' must be followed by an identifier
-- when scope checking the declaration
-- import Agda.Builtin.Sigma as .as
import Agda.Builtin.String as _
-- `as' must be followed by an identifier; an underscore is not allowed here
-- when scope checking the declaration
-- import Agda.Builtin.String as _
| 27.241379
| 79
| 0.722785
|
732b3c3eaa4b06218aace3eeb231b5427b9ef703
| 3,372
|
agda
|
Agda
|
examples/examplesPaperJFP/Sized.agda
|
agda/ooAgda
|
7cc45e0148a4a508d20ed67e791544c30fecd795
|
[
"MIT"
] | 23
|
2016-06-19T12:57:55.000Z
|
2020-10-12T23:15:25.000Z
|
examples/examplesPaperJFP/Sized.agda
|
agda/ooAgda
|
7cc45e0148a4a508d20ed67e791544c30fecd795
|
[
"MIT"
] | null | null | null |
examples/examplesPaperJFP/Sized.agda
|
agda/ooAgda
|
7cc45e0148a4a508d20ed67e791544c30fecd795
|
[
"MIT"
] | 2
|
2018-09-01T15:02:37.000Z
|
2022-03-12T11:41:00.000Z
|
module examplesPaperJFP.Sized where
open import Data.Product using (_×_; _,_)
open import Data.String
open import Function using (case_of_)
open import Size
open import examplesPaperJFP.NativeIOSafe
open import examplesPaperJFP.BasicIO using (IOInterface; Command; Response)
open import examplesPaperJFP.ConsoleInterface
open import examplesPaperJFP.Console using (translateIOConsoleLocal)
open import examplesPaperJFP.Object using (Interface; Method; Result;
cellJ; CellMethod; get; put; CellResult)
module UnfoldF where
open import examplesPaperJFP.Coalgebra using (F; mapF)
record νF (i : Size) : Set where
coinductive
constructor delay
field force : ∀(j : Size< i) → F (νF j)
open νF using (force)
unfoldF : ∀{S} (t : S → F S) → ∀ i → (S → νF i)
force (unfoldF t i s) j = mapF (unfoldF t j) (t s)
mutual
record IO (Iᵢₒ : IOInterface) (i : Size) (A : Set) : Set where
coinductive
constructor delay
field force : {j : Size< i} → IO′ Iᵢₒ j A
data IO′ (Iᵢₒ : IOInterface) (i : Size) (A : Set) : Set where
exec′ : (c : Command Iᵢₒ) (f : Response Iᵢₒ c → IO Iᵢₒ i A) → IO′ Iᵢₒ i A
return′ : (a : A) → IO′ Iᵢₒ i A
module NestedRecursion (Iᵢₒ : IOInterface) (A : Set) where
data F (X : Set) : Set where
exec′ : (c : Command Iᵢₒ) (f : Response Iᵢₒ c → X) → F X
return′ : (a : A) → F X
record νF (i : Size) : Set where
coinductive
constructor delay
field force : {j : Size< i} → F (νF j)
open IO public
module _ {Iᵢₒ : IOInterface } (let C = Command Iᵢₒ) (let R = Response Iᵢₒ) where
infixl 2 _>>=_
exec : ∀ {i A} (c : C) (f : R c → IO Iᵢₒ i A) → IO Iᵢₒ i A
return : ∀ {i A} (a : A) → IO Iᵢₒ i A
_>>=_ : ∀ {i A B} (m : IO Iᵢₒ i A) (k : A → IO Iᵢₒ i B) → IO Iᵢₒ i B
force (exec c f) = exec′ c f
force (return a) = return′ a
force (_>>=_ {i} m k) {j} with force m {j}
... | exec′ c f = exec′ c λ r → _>>=_ {j} (f r) k
... | return′ a = force (k a) {j}
{-# NON_TERMINATING #-}
translateIO : ∀{A : Set}
→ (translateLocal : (c : C) → NativeIO (R c))
→ IO Iᵢₒ ∞ A
→ NativeIO A
translateIO translateLocal m = case (force m) of
λ{ (exec′ c f) → (translateLocal c) native>>= λ r →
translateIO translateLocal (f r)
; (return′ a) → nativeReturn a
}
record IOObject (Iᵢₒ : IOInterface) (I : Interface) (i : Size) : Set where
coinductive
field method : ∀{j : Size< i} (m : Method I)
→ IO Iᵢₒ ∞ (Result I m × IOObject Iᵢₒ I j)
open IOObject public
CellC : (i : Size) → Set
CellC = IOObject ConsoleInterface (cellJ String)
simpleCell : ∀{i} (s : String) → CellC i
force (method (simpleCell {i} s) {j} get) =
exec′ (putStrLn ("getting (" ++ s ++ ")")) λ _ →
return (s , simpleCell {j} s)
force (method (simpleCell _) (put s)) =
exec′ (putStrLn ("putting (" ++ s ++ ")")) λ _ →
return (unit , simpleCell s)
program : ∀{i} → IO ConsoleInterface i Unit
force program =
let c₁ = simpleCell "Start" in
exec′ getLine λ{ nothing → return unit; (just s) →
method c₁ (put s) >>= λ{ (_ , c₂) →
method c₂ get >>= λ{ (s′ , c₃) →
exec (putStrLn s′) λ _ →
program }}}
main : NativeIO Unit
main = translateIO translateIOConsoleLocal program
| 30.107143
| 84
| 0.580664
|
ed8d771b07adfa2349f98f898120ac56aa20730e
| 13,543
|
agda
|
Agda
|
Agda/18-circle.agda
|
UlrikBuchholtz/HoTT-Intro
|
1e1f8def50f9359928e52ebb2ee53ed1166487d9
|
[
"CC-BY-4.0"
] | 333
|
2018-09-26T08:33:30.000Z
|
2022-03-22T23:50:15.000Z
|
Agda/18-circle.agda
|
UlrikBuchholtz/HoTT-Intro
|
1e1f8def50f9359928e52ebb2ee53ed1166487d9
|
[
"CC-BY-4.0"
] | 8
|
2019-06-18T04:16:04.000Z
|
2020-10-16T15:27:01.000Z
|
Agda/18-circle.agda
|
UlrikBuchholtz/HoTT-Intro
|
1e1f8def50f9359928e52ebb2ee53ed1166487d9
|
[
"CC-BY-4.0"
] | 30
|
2018-09-26T09:08:57.000Z
|
2022-03-16T00:33:50.000Z
|
{-# OPTIONS --without-K --exact-split #-}
module 18-circle where
import 17-number-theory
open 17-number-theory public
{- Section 11.1 The induction principle of the circle -}
free-loops :
{ l1 : Level} (X : UU l1) → UU l1
free-loops X = Σ X (λ x → Id x x)
base-free-loop :
{ l1 : Level} {X : UU l1} → free-loops X → X
base-free-loop = pr1
loop-free-loop :
{ l1 : Level} {X : UU l1} (l : free-loops X) →
Id (base-free-loop l) (base-free-loop l)
loop-free-loop = pr2
-- Now we characterize the identity types of free loops
Eq-free-loops :
{ l1 : Level} {X : UU l1} (l l' : free-loops X) → UU l1
Eq-free-loops (pair x l) l' =
Σ (Id x (pr1 l')) (λ p → Id (l ∙ p) (p ∙ (pr2 l')))
reflexive-Eq-free-loops :
{ l1 : Level} {X : UU l1} (l : free-loops X) → Eq-free-loops l l
reflexive-Eq-free-loops (pair x l) = pair refl right-unit
Eq-free-loops-eq :
{ l1 : Level} {X : UU l1} (l l' : free-loops X) →
Id l l' → Eq-free-loops l l'
Eq-free-loops-eq l .l refl = reflexive-Eq-free-loops l
abstract
is-contr-total-Eq-free-loops :
{ l1 : Level} {X : UU l1} (l : free-loops X) →
is-contr (Σ (free-loops X) (Eq-free-loops l))
is-contr-total-Eq-free-loops (pair x l) =
is-contr-total-Eq-structure
( λ x l' p → Id (l ∙ p) (p ∙ l'))
( is-contr-total-path x)
( pair x refl)
( is-contr-is-equiv'
( Σ (Id x x) (λ l' → Id l l'))
( tot (λ l' α → right-unit ∙ α))
( is-equiv-tot-is-fiberwise-equiv
( λ l' → is-equiv-concat right-unit l'))
( is-contr-total-path l))
abstract
is-equiv-Eq-free-loops-eq :
{ l1 : Level} {X : UU l1} (l l' : free-loops X) →
is-equiv (Eq-free-loops-eq l l')
is-equiv-Eq-free-loops-eq l =
fundamental-theorem-id l
( reflexive-Eq-free-loops l)
( is-contr-total-Eq-free-loops l)
( Eq-free-loops-eq l)
{- We introduce dependent free loops, which are used in the induction principle
of the circle. -}
dependent-free-loops :
{ l1 l2 : Level} {X : UU l1} (l : free-loops X) (P : X → UU l2) → UU l2
dependent-free-loops l P =
Σ ( P (base-free-loop l))
( λ p₀ → Id (tr P (loop-free-loop l) p₀) p₀)
Eq-dependent-free-loops :
{ l1 l2 : Level} {X : UU l1} (l : free-loops X) (P : X → UU l2) →
( p p' : dependent-free-loops l P) → UU l2
Eq-dependent-free-loops (pair x l) P (pair y p) p' =
Σ ( Id y (pr1 p'))
( λ q → Id (p ∙ q) ((ap (tr P l) q) ∙ (pr2 p')))
reflexive-Eq-dependent-free-loops :
{ l1 l2 : Level} {X : UU l1} (l : free-loops X) (P : X → UU l2) →
( p : dependent-free-loops l P) → Eq-dependent-free-loops l P p p
reflexive-Eq-dependent-free-loops (pair x l) P (pair y p) =
pair refl right-unit
Eq-dependent-free-loops-eq :
{ l1 l2 : Level} {X : UU l1} (l : free-loops X) (P : X → UU l2) →
( p p' : dependent-free-loops l P) →
Id p p' → Eq-dependent-free-loops l P p p'
Eq-dependent-free-loops-eq l P p .p refl =
reflexive-Eq-dependent-free-loops l P p
abstract
is-contr-total-Eq-dependent-free-loops :
{ l1 l2 : Level} {X : UU l1} (l : free-loops X) (P : X → UU l2) →
( p : dependent-free-loops l P) →
is-contr (Σ (dependent-free-loops l P) (Eq-dependent-free-loops l P p))
is-contr-total-Eq-dependent-free-loops (pair x l) P (pair y p) =
is-contr-total-Eq-structure
( λ y' p' q → Id (p ∙ q) ((ap (tr P l) q) ∙ p'))
( is-contr-total-path y)
( pair y refl)
( is-contr-is-equiv'
( Σ (Id (tr P l y) y) (λ p' → Id p p'))
( tot (λ p' α → right-unit ∙ α))
( is-equiv-tot-is-fiberwise-equiv
( λ p' → is-equiv-concat right-unit p'))
( is-contr-total-path p))
abstract
is-equiv-Eq-dependent-free-loops-eq :
{ l1 l2 : Level} {X : UU l1} (l : free-loops X) (P : X → UU l2)
( p p' : dependent-free-loops l P) →
is-equiv (Eq-dependent-free-loops-eq l P p p')
is-equiv-Eq-dependent-free-loops-eq l P p =
fundamental-theorem-id p
( reflexive-Eq-dependent-free-loops l P p)
( is-contr-total-Eq-dependent-free-loops l P p)
( Eq-dependent-free-loops-eq l P p)
eq-Eq-dependent-free-loops :
{ l1 l2 : Level} {X : UU l1} (l : free-loops X) (P : X → UU l2)
( p p' : dependent-free-loops l P) →
Eq-dependent-free-loops l P p p' → Id p p'
eq-Eq-dependent-free-loops l P p p' =
inv-is-equiv (is-equiv-Eq-dependent-free-loops-eq l P p p')
{- We now define the induction principle of the circle. -}
ev-free-loop' :
{ l1 l2 : Level} {X : UU l1} (l : free-loops X) (P : X → UU l2) →
( (x : X) → P x) → dependent-free-loops l P
ev-free-loop' (pair x₀ p) P f = pair (f x₀) (apd f p)
induction-principle-circle :
{ l1 : Level} (l2 : Level) {X : UU l1} (l : free-loops X) →
UU ((lsuc l2) ⊔ l1)
induction-principle-circle l2 {X} l =
(P : X → UU l2) → sec (ev-free-loop' l P)
{- Section 11.2 The universal property of the circle -}
{- We first state the universal property of the circle -}
ev-free-loop :
{ l1 l2 : Level} {X : UU l1} (l : free-loops X) (Y : UU l2) →
( X → Y) → free-loops Y
ev-free-loop l Y f = pair (f (pr1 l)) (ap f (pr2 l))
universal-property-circle :
{ l1 : Level} (l2 : Level) {X : UU l1} (l : free-loops X) → UU _
universal-property-circle l2 l =
( Y : UU l2) → is-equiv (ev-free-loop l Y)
{- A fairly straightforward proof of the universal property of the circle
factors through the dependent universal property of the circle. -}
dependent-universal-property-circle :
{ l1 : Level} (l2 : Level) {X : UU l1} (l : free-loops X) →
UU ((lsuc l2) ⊔ l1)
dependent-universal-property-circle l2 {X} l =
( P : X → UU l2) → is-equiv (ev-free-loop' l P)
{- We first prove that the dependent universal property of the circle follows
from the induction principle of the circle. To show this, we have to show
that the section of ev-free-loop' is also a retraction. This construction
is also by the induction principle of the circle, but it requires (a minimal
amount of) preparations. -}
Eq-subst :
{ l1 l2 : Level} {X : UU l1} {P : X → UU l2} (f g : (x : X) → P x) →
X → UU _
Eq-subst f g x = Id (f x) (g x)
tr-Eq-subst :
{ l1 l2 : Level} {X : UU l1} {P : X → UU l2} (f g : (x : X) → P x)
{ x y : X} (p : Id x y) (q : Id (f x) (g x)) (r : Id (f y) (g y))→
( Id ((apd f p) ∙ r) ((ap (tr P p) q) ∙ (apd g p))) →
( Id (tr (Eq-subst f g) p q) r)
tr-Eq-subst f g refl q .((ap id q) ∙ refl) refl =
inv (right-unit ∙ (ap-id q))
dependent-free-loops-htpy :
{l1 l2 : Level} {X : UU l1} {l : free-loops X} {P : X → UU l2}
{f g : (x : X) → P x} →
( Eq-dependent-free-loops l P (ev-free-loop' l P f) (ev-free-loop' l P g)) →
( dependent-free-loops l (λ x → Id (f x) (g x)))
dependent-free-loops-htpy {l = (pair x l)} (pair p q) =
pair p (tr-Eq-subst _ _ l p p q)
isretr-ind-circle :
{ l1 l2 : Level} {X : UU l1} (l : free-loops X) →
( ind-circle : induction-principle-circle l2 l) (P : X → UU l2) →
( (pr1 (ind-circle P)) ∘ (ev-free-loop' l P)) ~ id
isretr-ind-circle l ind-circle P f =
eq-htpy
( pr1
( ind-circle
( λ t → Id (pr1 (ind-circle P) (ev-free-loop' l P f) t) (f t)))
( dependent-free-loops-htpy
( Eq-dependent-free-loops-eq l P _ _
( pr2 (ind-circle P) (ev-free-loop' l P f)))))
abstract
dependent-universal-property-induction-principle-circle :
{ l1 l2 : Level} {X : UU l1} (l : free-loops X) →
induction-principle-circle l2 l → dependent-universal-property-circle l2 l
dependent-universal-property-induction-principle-circle l ind-circle P =
is-equiv-has-inverse
( pr1 (ind-circle P))
( pr2 (ind-circle P))
( isretr-ind-circle l ind-circle P)
{- We use the dependent universal property to derive a uniqeness property of
dependent functions on the circle. -}
dependent-uniqueness-circle :
{ l1 l2 : Level} {X : UU l1} (l : free-loops X) →
dependent-universal-property-circle l2 l →
{ P : X → UU l2} (k : dependent-free-loops l P) →
is-contr
( Σ ( (x : X) → P x)
( λ h → Eq-dependent-free-loops l P (ev-free-loop' l P h) k))
dependent-uniqueness-circle l dup-circle {P} k =
is-contr-is-equiv'
( fib (ev-free-loop' l P) k)
( tot (λ h → Eq-dependent-free-loops-eq l P (ev-free-loop' l P h) k))
( is-equiv-tot-is-fiberwise-equiv
(λ h → is-equiv-Eq-dependent-free-loops-eq l P (ev-free-loop' l P h) k))
( is-contr-map-is-equiv (dup-circle P) k)
{- Now that we have established the dependent universal property, we can
reduce the (non-dependent) universal property to the dependent case. We do
so by constructing a commuting triangle relating ev-free-loop to
ev-free-loop' via a comparison equivalence. -}
tr-const :
{i j : Level} {A : UU i} {B : UU j} {x y : A} (p : Id x y) (b : B) →
Id (tr (λ (a : A) → B) p b) b
tr-const refl b = refl
apd-const :
{i j : Level} {A : UU i} {B : UU j} (f : A → B) {x y : A}
(p : Id x y) → Id (apd f p) ((tr-const p (f x)) ∙ (ap f p))
apd-const f refl = refl
comparison-free-loops :
{ l1 l2 : Level} {X : UU l1} (l : free-loops X) (Y : UU l2) →
free-loops Y → dependent-free-loops l (λ x → Y)
comparison-free-loops l Y =
tot (λ y l' → (tr-const (pr2 l) y) ∙ l')
abstract
is-equiv-comparison-free-loops :
{ l1 l2 : Level} {X : UU l1} (l : free-loops X) (Y : UU l2) →
is-equiv (comparison-free-loops l Y)
is-equiv-comparison-free-loops l Y =
is-equiv-tot-is-fiberwise-equiv
( λ y → is-equiv-concat (tr-const (pr2 l) y) y)
triangle-comparison-free-loops :
{ l1 l2 : Level} {X : UU l1} (l : free-loops X) (Y : UU l2) →
( (comparison-free-loops l Y) ∘ (ev-free-loop l Y)) ~
( ev-free-loop' l (λ x → Y))
triangle-comparison-free-loops (pair x l) Y f =
eq-Eq-dependent-free-loops
( pair x l)
( λ x → Y)
( comparison-free-loops (pair x l) Y (ev-free-loop (pair x l) Y f))
( ev-free-loop' (pair x l) (λ x → Y) f)
( pair refl (right-unit ∙ (inv (apd-const f l))))
abstract
universal-property-dependent-universal-property-circle :
{ l1 l2 : Level} {X : UU l1} (l : free-loops X) →
( dependent-universal-property-circle l2 l) →
( universal-property-circle l2 l)
universal-property-dependent-universal-property-circle l dup-circle Y =
is-equiv-right-factor
( ev-free-loop' l (λ x → Y))
( comparison-free-loops l Y)
( ev-free-loop l Y)
( htpy-inv (triangle-comparison-free-loops l Y))
( is-equiv-comparison-free-loops l Y)
( dup-circle (λ x → Y))
{- Now we get the universal property of the circle from the induction principle
of the circle by composing the earlier two proofs. -}
abstract
universal-property-induction-principle-circle :
{ l1 l2 : Level} {X : UU l1} (l : free-loops X) →
induction-principle-circle l2 l → universal-property-circle l2 l
universal-property-induction-principle-circle l =
( universal-property-dependent-universal-property-circle l) ∘
( dependent-universal-property-induction-principle-circle l)
unique-mapping-property-circle :
{ l1 : Level} (l2 : Level) {X : UU l1} (l : free-loops X) →
UU (l1 ⊔ (lsuc l2))
unique-mapping-property-circle l2 {X} l =
( Y : UU l2) (l' : free-loops Y) →
is-contr (Σ (X → Y) (λ f → Eq-free-loops (ev-free-loop l Y f) l'))
abstract
unique-mapping-property-universal-property-circle :
{ l1 l2 : Level} {X : UU l1} (l : free-loops X) →
universal-property-circle l2 l →
unique-mapping-property-circle l2 l
unique-mapping-property-universal-property-circle l up-circle Y l' =
is-contr-is-equiv'
( fib (ev-free-loop l Y) l')
( tot (λ f → Eq-free-loops-eq (ev-free-loop l Y f) l'))
( is-equiv-tot-is-fiberwise-equiv
( λ f → is-equiv-Eq-free-loops-eq (ev-free-loop l Y f) l'))
( is-contr-map-is-equiv (up-circle Y) l')
{- We assume that we have a circle. -}
postulate 𝕊¹ : UU lzero
postulate base-𝕊¹ : 𝕊¹
postulate loop-𝕊¹ : Id base-𝕊¹ base-𝕊¹
free-loop-𝕊¹ : free-loops 𝕊¹
free-loop-𝕊¹ = pair base-𝕊¹ loop-𝕊¹
postulate ind-𝕊¹ : {l : Level} → induction-principle-circle l free-loop-𝕊¹
dependent-universal-property-𝕊¹ :
{l : Level} → dependent-universal-property-circle l free-loop-𝕊¹
dependent-universal-property-𝕊¹ =
dependent-universal-property-induction-principle-circle free-loop-𝕊¹ ind-𝕊¹
dependent-uniqueness-𝕊¹ :
{l : Level} {P : 𝕊¹ → UU l} (k : dependent-free-loops free-loop-𝕊¹ P) →
is-contr (Σ ((x : 𝕊¹) → P x) (λ h → Eq-dependent-free-loops free-loop-𝕊¹ P (ev-free-loop' free-loop-𝕊¹ P h) k))
dependent-uniqueness-𝕊¹ {l} {P} k =
dependent-uniqueness-circle free-loop-𝕊¹ dependent-universal-property-𝕊¹ k
universal-property-𝕊¹ :
{l : Level} → universal-property-circle l free-loop-𝕊¹
universal-property-𝕊¹ =
universal-property-dependent-universal-property-circle
free-loop-𝕊¹
dependent-universal-property-𝕊¹
-- Section 14.3 Multiplication on the circle
{- Exercises -}
-- Exercise 11.1
{- The dependent universal property of the circle (and hence also the induction
principle of the circle, implies that the circle is connected in the sense
that for any family of propositions parametrized by the circle, if the
proposition at the base holds, then it holds for any x : circle. -}
abstract
is-connected-circle' :
{ l1 l2 : Level} {X : UU l1} (l : free-loops X) →
( dup-circle : dependent-universal-property-circle l2 l)
( P : X → UU l2) (is-prop-P : (x : X) → is-prop (P x)) →
P (base-free-loop l) → (x : X) → P x
is-connected-circle' l dup-circle P is-prop-P p =
inv-is-equiv
( dup-circle P)
( pair p (center (is-prop-P _ (tr P (pr2 l) p) p)))
| 36.308311
| 113
| 0.612789
|
0d19b4cc8c1453df4c483a4b97b1379e1dee10e4
| 9,664
|
agda
|
Agda
|
Definition/LogicalRelation/Substitution/Properties.agda
|
fhlkfy/logrel-mltt
|
ea83fc4f618d1527d64ecac82d7d17e2f18ac391
|
[
"MIT"
] | 30
|
2017-05-20T03:05:21.000Z
|
2022-03-30T18:01:07.000Z
|
Definition/LogicalRelation/Substitution/Properties.agda
|
fhlkfy/logrel-mltt
|
ea83fc4f618d1527d64ecac82d7d17e2f18ac391
|
[
"MIT"
] | 4
|
2017-06-22T12:49:23.000Z
|
2021-02-22T10:37:24.000Z
|
Definition/LogicalRelation/Substitution/Properties.agda
|
fhlkfy/logrel-mltt
|
ea83fc4f618d1527d64ecac82d7d17e2f18ac391
|
[
"MIT"
] | 8
|
2017-10-18T14:18:20.000Z
|
2021-11-27T15:58:33.000Z
|
{-# OPTIONS --without-K --safe #-}
open import Definition.Typed.EqualityRelation
module Definition.LogicalRelation.Substitution.Properties {{eqrel : EqRelSet}} where
open EqRelSet {{...}}
open import Definition.Untyped
open import Definition.Untyped.Properties
open import Definition.Typed
open import Definition.Typed.Weakening
open import Definition.LogicalRelation
open import Definition.LogicalRelation.Substitution
open import Definition.LogicalRelation.Substitution.Irrelevance
using (irrelevanceSubst′)
open import Definition.LogicalRelation.Irrelevance
open import Definition.LogicalRelation.Properties
import Definition.LogicalRelation.Weakening as LR
open import Tools.Fin
open import Tools.Nat
open import Tools.Unit
open import Tools.Product
import Tools.PropositionalEquality as PE
private
variable
k m n : Nat
Γ : Con Term n
σ σ′ : Subst m n
ρ : Wk k n
-- Valid substitutions are well-formed
wellformedSubst : ∀ {Γ Δ} ([Γ] : ⊩ᵛ Γ) (⊢Δ : ⊢ Δ)
→ Δ ⊩ˢ σ ∷ Γ / [Γ] / ⊢Δ
→ Δ ⊢ˢ σ ∷ Γ
wellformedSubst ε ⊢Δ [σ] = id
wellformedSubst ([Γ] ∙ [A]) ⊢Δ ([tailσ] , [headσ]) =
wellformedSubst [Γ] ⊢Δ [tailσ]
, escapeTerm (proj₁ ([A] ⊢Δ [tailσ])) [headσ]
-- Valid substitution equality is well-formed
wellformedSubstEq : ∀ {Γ Δ} ([Γ] : ⊩ᵛ Γ) (⊢Δ : ⊢ Δ)
([σ] : Δ ⊩ˢ σ ∷ Γ / [Γ] / ⊢Δ)
→ Δ ⊩ˢ σ ≡ σ′ ∷ Γ / [Γ] / ⊢Δ / [σ]
→ Δ ⊢ˢ σ ≡ σ′ ∷ Γ
wellformedSubstEq ε ⊢Δ [σ] [σ≡σ′] = id
wellformedSubstEq ([Γ] ∙ [A]) ⊢Δ ([tailσ] , [headσ]) ([tailσ≡σ′] , [headσ≡σ′]) =
wellformedSubstEq [Γ] ⊢Δ [tailσ] [tailσ≡σ′]
, ≅ₜ-eq (escapeTermEq (proj₁ ([A] ⊢Δ [tailσ])) [headσ≡σ′])
-- Extend a valid substitution with a term
consSubstS : ∀ {l t A Γ Δ} ([Γ] : ⊩ᵛ Γ) (⊢Δ : ⊢ Δ)
([σ] : Δ ⊩ˢ σ ∷ Γ / [Γ] / ⊢Δ)
([A] : Γ ⊩ᵛ⟨ l ⟩ A / [Γ])
([t] : Δ ⊩⟨ l ⟩ t ∷ subst σ A / proj₁ ([A] ⊢Δ [σ]))
→ Δ ⊩ˢ consSubst σ t ∷ Γ ∙ A / [Γ] ∙ [A] / ⊢Δ
consSubstS [Γ] ⊢Δ [σ] [A] [t] = [σ] , [t]
-- Extend a valid substitution equality with a term
consSubstSEq : ∀ {l t A Γ Δ} ([Γ] : ⊩ᵛ Γ) (⊢Δ : ⊢ Δ)
([σ] : Δ ⊩ˢ σ ∷ Γ / [Γ] / ⊢Δ)
([σ≡σ′] : Δ ⊩ˢ σ ≡ σ′ ∷ Γ / [Γ] / ⊢Δ / [σ])
([A] : Γ ⊩ᵛ⟨ l ⟩ A / [Γ])
([t] : Δ ⊩⟨ l ⟩ t ∷ subst σ A / proj₁ ([A] ⊢Δ [σ]))
→ Δ ⊩ˢ consSubst σ t ≡ consSubst σ′ t ∷ Γ ∙ A / [Γ] ∙ [A] / ⊢Δ
/ consSubstS {t = t} {A = A} [Γ] ⊢Δ [σ] [A] [t]
consSubstSEq [Γ] ⊢Δ [σ] [σ≡σ′] [A] [t] =
[σ≡σ′] , reflEqTerm (proj₁ ([A] ⊢Δ [σ])) [t]
-- Weakening of valid substitutions
wkSubstS : ∀ {Γ Δ Δ′} ([Γ] : ⊩ᵛ Γ) (⊢Δ : ⊢ Δ) (⊢Δ′ : ⊢ Δ′)
([ρ] : ρ ∷ Δ′ ⊆ Δ)
([σ] : Δ ⊩ˢ σ ∷ Γ / [Γ] / ⊢Δ)
→ Δ′ ⊩ˢ ρ •ₛ σ ∷ Γ / [Γ] / ⊢Δ′
wkSubstS ε ⊢Δ ⊢Δ′ ρ [σ] = tt
wkSubstS {σ = σ} {Γ = Γ ∙ A} ([Γ] ∙ x) ⊢Δ ⊢Δ′ ρ [σ] =
let [tailσ] = wkSubstS [Γ] ⊢Δ ⊢Δ′ ρ (proj₁ [σ])
in [tailσ]
, irrelevanceTerm′ (wk-subst A)
(LR.wk ρ ⊢Δ′ (proj₁ (x ⊢Δ (proj₁ [σ]))))
(proj₁ (x ⊢Δ′ [tailσ]))
(LR.wkTerm ρ ⊢Δ′ (proj₁ (x ⊢Δ (proj₁ [σ]))) (proj₂ [σ]))
-- Weakening of valid substitution equality
wkSubstSEq : ∀ {Γ Δ Δ′} ([Γ] : ⊩ᵛ Γ) (⊢Δ : ⊢ Δ) (⊢Δ′ : ⊢ Δ′)
([ρ] : ρ ∷ Δ′ ⊆ Δ)
([σ] : Δ ⊩ˢ σ ∷ Γ / [Γ] / ⊢Δ)
([σ≡σ′] : Δ ⊩ˢ σ ≡ σ′ ∷ Γ / [Γ] / ⊢Δ / [σ])
→ Δ′ ⊩ˢ ρ •ₛ σ ≡ ρ •ₛ σ′ ∷ Γ / [Γ]
/ ⊢Δ′ / wkSubstS [Γ] ⊢Δ ⊢Δ′ [ρ] [σ]
wkSubstSEq ε ⊢Δ ⊢Δ′ ρ [σ] [σ≡σ′] = tt
wkSubstSEq {Γ = Γ ∙ A} ([Γ] ∙ x) ⊢Δ ⊢Δ′ ρ [σ] [σ≡σ′] =
wkSubstSEq [Γ] ⊢Δ ⊢Δ′ ρ (proj₁ [σ]) (proj₁ [σ≡σ′])
, irrelevanceEqTerm′ (wk-subst A) (LR.wk ρ ⊢Δ′ (proj₁ (x ⊢Δ (proj₁ [σ]))))
(proj₁ (x ⊢Δ′ (wkSubstS [Γ] ⊢Δ ⊢Δ′ ρ (proj₁ [σ]))))
(LR.wkEqTerm ρ ⊢Δ′ (proj₁ (x ⊢Δ (proj₁ [σ]))) (proj₂ [σ≡σ′]))
-- Weaken a valid substitution by one type
wk1SubstS : ∀ {F Γ Δ} ([Γ] : ⊩ᵛ Γ) (⊢Δ : ⊢ Δ)
(⊢F : Δ ⊢ F)
([σ] : Δ ⊩ˢ σ ∷ Γ / [Γ] / ⊢Δ)
→ (Δ ∙ F) ⊩ˢ wk1Subst σ ∷ Γ / [Γ]
/ (⊢Δ ∙ ⊢F)
wk1SubstS {F} {σ} {Γ} {Δ} [Γ] ⊢Δ ⊢F [σ] =
wkSubstS [Γ] ⊢Δ (⊢Δ ∙ ⊢F) (step id) [σ]
-- Weaken a valid substitution equality by one type
wk1SubstSEq : ∀ {F Γ Δ} ([Γ] : ⊩ᵛ Γ) (⊢Δ : ⊢ Δ)
(⊢F : Δ ⊢ F)
([σ] : Δ ⊩ˢ σ ∷ Γ / [Γ] / ⊢Δ)
([σ≡σ′] : Δ ⊩ˢ σ ≡ σ′ ∷ Γ / [Γ] / ⊢Δ / [σ])
→ (Δ ∙ F) ⊩ˢ wk1Subst σ ≡ wk1Subst σ′ ∷ Γ / [Γ]
/ (⊢Δ ∙ ⊢F) / wk1SubstS [Γ] ⊢Δ ⊢F [σ]
wk1SubstSEq {l} {F} {σ} {Γ} {Δ} [Γ] ⊢Δ ⊢F [σ] [σ≡σ′] =
wkSubstSEq [Γ] ⊢Δ (⊢Δ ∙ ⊢F) (step id) [σ] [σ≡σ′]
-- Lift a valid substitution
liftSubstS : ∀ {l F Γ Δ} ([Γ] : ⊩ᵛ Γ) (⊢Δ : ⊢ Δ)
([F] : Γ ⊩ᵛ⟨ l ⟩ F / [Γ])
([σ] : Δ ⊩ˢ σ ∷ Γ / [Γ] / ⊢Δ)
→ (Δ ∙ subst σ F) ⊩ˢ liftSubst σ ∷ Γ ∙ F / [Γ] ∙ [F]
/ (⊢Δ ∙ escape (proj₁ ([F] ⊢Δ [σ])))
liftSubstS {σ = σ} {F = F} {Δ = Δ} [Γ] ⊢Δ [F] [σ] =
let ⊢F = escape (proj₁ ([F] ⊢Δ [σ]))
[tailσ] = wk1SubstS {F = subst σ F} [Γ] ⊢Δ (escape (proj₁ ([F] ⊢Δ [σ]))) [σ]
var0 = var (⊢Δ ∙ ⊢F) (PE.subst (λ x → x0 ∷ x ∈ (Δ ∙ subst σ F))
(wk-subst F) here)
in [tailσ] , neuTerm (proj₁ ([F] (⊢Δ ∙ ⊢F) [tailσ])) (var x0)
var0 (~-var var0)
-- Lift a valid substitution equality
liftSubstSEq : ∀ {l F Γ Δ} ([Γ] : ⊩ᵛ Γ) (⊢Δ : ⊢ Δ)
([F] : Γ ⊩ᵛ⟨ l ⟩ F / [Γ])
([σ] : Δ ⊩ˢ σ ∷ Γ / [Γ] / ⊢Δ)
([σ≡σ′] : Δ ⊩ˢ σ ≡ σ′ ∷ Γ / [Γ] / ⊢Δ / [σ])
→ (Δ ∙ subst σ F) ⊩ˢ liftSubst σ ≡ liftSubst σ′ ∷ Γ ∙ F / [Γ] ∙ [F]
/ (⊢Δ ∙ escape (proj₁ ([F] ⊢Δ [σ])))
/ liftSubstS {F = F} [Γ] ⊢Δ [F] [σ]
liftSubstSEq {σ = σ} {σ′ = σ′} {F = F} {Δ = Δ} [Γ] ⊢Δ [F] [σ] [σ≡σ′] =
let ⊢F = escape (proj₁ ([F] ⊢Δ [σ]))
[tailσ] = wk1SubstS {F = subst σ F} [Γ] ⊢Δ (escape (proj₁ ([F] ⊢Δ [σ]))) [σ]
[tailσ≡σ′] = wk1SubstSEq [Γ] ⊢Δ (escape (proj₁ ([F] ⊢Δ [σ]))) [σ] [σ≡σ′]
var0 = var (⊢Δ ∙ ⊢F) (PE.subst (λ x → x0 ∷ x ∈ (Δ ∙ subst σ F)) (wk-subst F) here)
in [tailσ≡σ′] , neuEqTerm (proj₁ ([F] (⊢Δ ∙ ⊢F) [tailσ])) (var x0) (var x0)
var0 var0 (~-var var0)
mutual
-- Valid contexts are well-formed
soundContext : ⊩ᵛ Γ → ⊢ Γ
soundContext ε = ε
soundContext (x ∙ x₁) =
soundContext x ∙ escape (irrelevance′ (subst-id _)
(proj₁ (x₁ (soundContext x)
(idSubstS x))))
-- From a valid context we can constuct a valid identity substitution
idSubstS : ([Γ] : ⊩ᵛ Γ) → Γ ⊩ˢ idSubst ∷ Γ / [Γ] / soundContext [Γ]
idSubstS ε = tt
idSubstS {Γ = Γ ∙ A} ([Γ] ∙ [A]) =
let ⊢Γ = soundContext [Γ]
⊢Γ∙A = soundContext ([Γ] ∙ [A])
⊢Γ∙A′ = ⊢Γ ∙ escape (proj₁ ([A] ⊢Γ (idSubstS [Γ])))
[A]′ = wk1SubstS {F = subst idSubst A} [Γ] ⊢Γ
(escape (proj₁ ([A] (soundContext [Γ])
(idSubstS [Γ]))))
(idSubstS [Γ])
[tailσ] = irrelevanceSubst′ (PE.cong (_∙_ Γ) (subst-id A))
[Γ] [Γ] ⊢Γ∙A′ ⊢Γ∙A [A]′
var0 = var ⊢Γ∙A (PE.subst (λ x → x0 ∷ x ∈ (Γ ∙ A))
(wk-subst A)
(PE.subst (λ x → x0 ∷ wk1 (subst idSubst A)
∈ (Γ ∙ x))
(subst-id A) here))
in [tailσ]
, neuTerm (proj₁ ([A] ⊢Γ∙A [tailσ]))
(var x0)
var0 (~-var var0)
-- Reflexivity valid substitutions
reflSubst : ∀ {Γ Δ} ([Γ] : ⊩ᵛ Γ) (⊢Δ : ⊢ Δ)
([σ] : Δ ⊩ˢ σ ∷ Γ / [Γ] / ⊢Δ)
→ Δ ⊩ˢ σ ≡ σ ∷ Γ / [Γ] / ⊢Δ / [σ]
reflSubst ε ⊢Δ [σ] = tt
reflSubst ([Γ] ∙ x) ⊢Δ [σ] =
reflSubst [Γ] ⊢Δ (proj₁ [σ]) , reflEqTerm (proj₁ (x ⊢Δ (proj₁ [σ]))) (proj₂ [σ])
-- Reflexivity of valid identity substitution
reflIdSubst : ([Γ] : ⊩ᵛ Γ)
→ Γ ⊩ˢ idSubst ≡ idSubst ∷ Γ / [Γ] / soundContext [Γ] / idSubstS [Γ]
reflIdSubst [Γ] = reflSubst [Γ] (soundContext [Γ]) (idSubstS [Γ])
-- Symmetry of valid substitution
symS : ∀ {Γ Δ} ([Γ] : ⊩ᵛ Γ) (⊢Δ : ⊢ Δ)
([σ] : Δ ⊩ˢ σ ∷ Γ / [Γ] / ⊢Δ)
([σ′] : Δ ⊩ˢ σ′ ∷ Γ / [Γ] / ⊢Δ)
→ Δ ⊩ˢ σ ≡ σ′ ∷ Γ / [Γ] / ⊢Δ / [σ]
→ Δ ⊩ˢ σ′ ≡ σ ∷ Γ / [Γ] / ⊢Δ / [σ′]
symS ε ⊢Δ [σ] [σ′] [σ≡σ′] = tt
symS ([Γ] ∙ x) ⊢Δ [σ] [σ′] [σ≡σ′] =
symS [Γ] ⊢Δ (proj₁ [σ]) (proj₁ [σ′]) (proj₁ [σ≡σ′])
, let [σA] = proj₁ (x ⊢Δ (proj₁ [σ]))
[σ′A] = proj₁ (x ⊢Δ (proj₁ [σ′]))
[σA≡σ′A] = (proj₂ (x ⊢Δ (proj₁ [σ]))) (proj₁ [σ′]) (proj₁ [σ≡σ′])
[headσ′≡headσ] = symEqTerm [σA] (proj₂ [σ≡σ′])
in convEqTerm₁ [σA] [σ′A] [σA≡σ′A] [headσ′≡headσ]
-- Transitivity of valid substitution
transS : ∀ {σ″ Γ Δ} ([Γ] : ⊩ᵛ Γ) (⊢Δ : ⊢ Δ)
([σ] : Δ ⊩ˢ σ ∷ Γ / [Γ] / ⊢Δ)
([σ′] : Δ ⊩ˢ σ′ ∷ Γ / [Γ] / ⊢Δ)
([σ″] : Δ ⊩ˢ σ″ ∷ Γ / [Γ] / ⊢Δ)
→ Δ ⊩ˢ σ ≡ σ′ ∷ Γ / [Γ] / ⊢Δ / [σ]
→ Δ ⊩ˢ σ′ ≡ σ″ ∷ Γ / [Γ] / ⊢Δ / [σ′]
→ Δ ⊩ˢ σ ≡ σ″ ∷ Γ / [Γ] / ⊢Δ / [σ]
transS ε ⊢Δ [σ] [σ′] [σ″] [σ≡σ′] [σ′≡σ″] = tt
transS ([Γ] ∙ x) ⊢Δ [σ] [σ′] [σ″] [σ≡σ′] [σ′≡σ″] =
transS [Γ] ⊢Δ (proj₁ [σ]) (proj₁ [σ′]) (proj₁ [σ″])
(proj₁ [σ≡σ′]) (proj₁ [σ′≡σ″])
, let [σA] = proj₁ (x ⊢Δ (proj₁ [σ]))
[σ′A] = proj₁ (x ⊢Δ (proj₁ [σ′]))
[σ″A] = proj₁ (x ⊢Δ (proj₁ [σ″]))
[σ′≡σ″]′ = convEqTerm₂ [σA] [σ′A]
((proj₂ (x ⊢Δ (proj₁ [σ]))) (proj₁ [σ′])
(proj₁ [σ≡σ′])) (proj₂ [σ′≡σ″])
in transEqTerm [σA] (proj₂ [σ≡σ′]) [σ′≡σ″]′
| 42.572687
| 89
| 0.424772
|
65025ff805f6a03cb774bffb15ff827c1f55573e
| 4,215
|
agda
|
Agda
|
Cubical/Data/FinSet/DecidablePredicate.agda
|
howsiyu/cubical
|
1b9c97a2140fe96fe636f4c66beedfd7b8096e8f
|
[
"MIT"
] | null | null | null |
Cubical/Data/FinSet/DecidablePredicate.agda
|
howsiyu/cubical
|
1b9c97a2140fe96fe636f4c66beedfd7b8096e8f
|
[
"MIT"
] | null | null | null |
Cubical/Data/FinSet/DecidablePredicate.agda
|
howsiyu/cubical
|
1b9c97a2140fe96fe636f4c66beedfd7b8096e8f
|
[
"MIT"
] | null | null | null |
{-
This files contains:
- Lots of useful properties about (this) decidable predicates on finite sets.
(P.S. We use the alternative definition of decidability for computational effectivity.)
-}
{-# OPTIONS --safe #-}
module Cubical.Data.FinSet.DecidablePredicate where
open import Cubical.Foundations.Prelude
open import Cubical.Foundations.Function
open import Cubical.Foundations.HLevels
open import Cubical.Foundations.Equiv renaming (_∙ₑ_ to _⋆_)
open import Cubical.Foundations.Equiv.Properties
open import Cubical.HITs.PropositionalTruncation as Prop
open import Cubical.Data.Bool
open import Cubical.Data.Empty as Empty
open import Cubical.Data.Sigma
open import Cubical.Data.Fin
open import Cubical.Data.SumFin renaming (Fin to SumFin)
open import Cubical.Data.FinSet.Base
open import Cubical.Data.FinSet.Properties
open import Cubical.Relation.Nullary
open import Cubical.Relation.Nullary.DecidablePropositions
hiding (DecProp) renaming (DecProp' to DecProp)
private
variable
ℓ ℓ' ℓ'' ℓ''' : Level
module _
(X : Type ℓ)(p : isFinOrd X) where
isDecProp¬' : isDecProp (¬ X)
isDecProp¬' = _ , invEquiv (preCompEquiv (p .snd)) ⋆ SumFin¬ _
isDecProp∥∥' : isDecProp ∥ X ∥
isDecProp∥∥' = _ , propTrunc≃ (p .snd) ⋆ SumFin∥∥DecProp _
module _
(X : Type ℓ )(p : isFinOrd X)
(P : X → Type ℓ')
(dec : (x : X) → isDecProp (P x)) where
private
e = p .snd
isFinOrdSub : isFinOrd (Σ X P)
isFinOrdSub = _ ,
Σ-cong-equiv {B' = λ x → P (invEq e x)} e (transpFamily p)
⋆ Σ-cong-equiv-snd (λ x → dec (invEq e x) .snd)
⋆ SumFinSub≃ _ (fst ∘ dec ∘ invEq e)
isDecProp∃' : isDecProp ∥ Σ X P ∥
isDecProp∃' = _ ,
Prop.propTrunc≃ (
Σ-cong-equiv {B' = λ x → P (invEq e x)} e (transpFamily p)
⋆ Σ-cong-equiv-snd (λ x → dec (invEq e x) .snd))
⋆ SumFin∃≃ _ (fst ∘ dec ∘ invEq e)
isDecProp∀' : isDecProp ((x : X) → P x)
isDecProp∀' = _ ,
equivΠ {B' = λ x → P (invEq e x)} e (transpFamily p)
⋆ equivΠCod (λ x → dec (invEq e x) .snd)
⋆ SumFin∀≃ _ (fst ∘ dec ∘ invEq e)
module _
(X : Type ℓ )(p : isFinOrd X)
(a b : X) where
private
e = p .snd
isDecProp≡' : isDecProp (a ≡ b)
isDecProp≡' .fst = SumFin≡ _ (e .fst a) (e .fst b)
isDecProp≡' .snd = congEquiv e ⋆ SumFin≡≃ _ _ _
module _
(X : FinSet ℓ)
(P : X .fst → DecProp ℓ') where
isFinSetSub : isFinSet (Σ (X .fst) (λ x → P x .fst))
isFinSetSub = Prop.rec isPropIsFinSet
(λ p → isFinOrd→isFinSet (isFinOrdSub (X .fst) (_ , p) (λ x → P x .fst) (λ x → P x .snd)))
(X .snd .snd)
isDecProp∃ : isDecProp ∥ Σ (X .fst) (λ x → P x .fst) ∥
isDecProp∃ = Prop.rec isPropIsDecProp
(λ p → isDecProp∃' (X .fst) (_ , p) (λ x → P x .fst) (λ x → P x .snd)) (X .snd .snd)
isDecProp∀ : isDecProp ((x : X .fst) → P x .fst)
isDecProp∀ = Prop.rec isPropIsDecProp
(λ p → isDecProp∀' (X .fst) (_ , p) (λ x → P x .fst) (λ x → P x .snd)) (X .snd .snd)
module _
(X : FinSet ℓ)
(Y : X .fst → FinSet ℓ')
(Z : (x : X .fst) → Y x .fst → DecProp ℓ'') where
isDecProp∀2 : isDecProp ((x : X .fst) → (y : Y x .fst) → Z x y .fst)
isDecProp∀2 = isDecProp∀ X (λ x → _ , isDecProp∀ (Y x) (Z x))
module _
(X : FinSet ℓ)
(Y : X .fst → FinSet ℓ')
(Z : (x : X .fst) → Y x .fst → FinSet ℓ'')
(W : (x : X .fst) → (y : Y x .fst) → Z x y .fst → DecProp ℓ''') where
isDecProp∀3 : isDecProp ((x : X .fst) → (y : Y x .fst) → (z : Z x y .fst) → W x y z .fst)
isDecProp∀3 = isDecProp∀ X (λ x → _ , isDecProp∀2 (Y x) (Z x) (W x))
module _
(X : FinSet ℓ) where
isDecProp≡ : (a b : X .fst) → isDecProp (a ≡ b)
isDecProp≡ a b = Prop.rec isPropIsDecProp
(λ p → isDecProp≡' (X .fst) (_ , p) a b) (X .snd .snd)
module _
(P : DecProp ℓ )
(Q : DecProp ℓ') where
isDecProp× : isDecProp (P .fst × Q .fst)
isDecProp× .fst = P .snd .fst and Q .snd .fst
isDecProp× .snd = Σ-cong-equiv (P .snd .snd) (λ _ → Q .snd .snd) ⋆ Bool→Type×≃ _ _
module _
(X : FinSet ℓ) where
isDecProp¬ : isDecProp (¬ (X .fst))
isDecProp¬ = Prop.rec isPropIsDecProp
(λ p → isDecProp¬' (X .fst) (_ , p)) (X .snd .snd)
isDecProp∥∥ : isDecProp ∥ X .fst ∥
isDecProp∥∥ = Prop.rec isPropIsDecProp
(λ p → isDecProp∥∥' (X .fst) (_ , p)) (X .snd .snd)
| 29.475524
| 94
| 0.604033
|
4ec640f4c01742f138752f0c8121b96f06be4ad9
| 814
|
agda
|
Agda
|
Definition/LogicalRelation/Substitution/Reflexivity.agda
|
CoqHott/logrel-mltt
|
e0eeebc4aa5ed791ce3e7c0dc9531bd113dfcc04
|
[
"MIT"
] | 2
|
2018-06-21T08:39:01.000Z
|
2022-01-17T16:13:53.000Z
|
Definition/LogicalRelation/Substitution/Reflexivity.agda
|
CoqHott/logrel-mltt
|
e0eeebc4aa5ed791ce3e7c0dc9531bd113dfcc04
|
[
"MIT"
] | null | null | null |
Definition/LogicalRelation/Substitution/Reflexivity.agda
|
CoqHott/logrel-mltt
|
e0eeebc4aa5ed791ce3e7c0dc9531bd113dfcc04
|
[
"MIT"
] | 2
|
2022-01-26T14:55:51.000Z
|
2022-02-15T19:42:19.000Z
|
{-# OPTIONS --safe #-}
open import Definition.Typed.EqualityRelation
module Definition.LogicalRelation.Substitution.Reflexivity {{eqrel : EqRelSet}} where
open EqRelSet {{...}}
open import Definition.LogicalRelation.Properties
open import Definition.LogicalRelation.Substitution
open import Tools.Product
-- Reflexivity of valid types.
reflᵛ : ∀ {A Γ rA l}
([Γ] : ⊩ᵛ Γ)
([A] : Γ ⊩ᵛ⟨ l ⟩ A ^ rA / [Γ])
→ Γ ⊩ᵛ⟨ l ⟩ A ≡ A ^ rA / [Γ] / [A]
reflᵛ [Γ] [A] ⊢Δ [σ] =
reflEq (proj₁ ([A] ⊢Δ [σ]))
-- Reflexivity of valid terms.
reflᵗᵛ : ∀ {A t Γ rA l}
([Γ] : ⊩ᵛ Γ)
([A] : Γ ⊩ᵛ⟨ l ⟩ A ^ rA / [Γ])
([t] : Γ ⊩ᵛ⟨ l ⟩ t ∷ A ^ rA / [Γ] / [A])
→ Γ ⊩ᵛ⟨ l ⟩ t ≡ t ∷ A ^ rA / [Γ] / [A]
reflᵗᵛ [Γ] [A] [t] ⊢Δ [σ] =
reflEqTerm (proj₁ ([A] ⊢Δ [σ])) (proj₁ ([t] ⊢Δ [σ]))
| 27.133333
| 85
| 0.527027
|
7cb2347f541a78bb17c0a2c5f11421015de94b5b
| 354
|
agda
|
Agda
|
data/declaration/Open2.agda
|
msuperdock/agda-unused
|
f327f9aab8dcb07022b857736d8201906bba02e9
|
[
"MIT"
] | 6
|
2020-10-29T09:38:43.000Z
|
2022-03-01T16:38:05.000Z
|
data/declaration/Open2.agda
|
msuperdock/agda-unused
|
f327f9aab8dcb07022b857736d8201906bba02e9
|
[
"MIT"
] | null | null | null |
data/declaration/Open2.agda
|
msuperdock/agda-unused
|
f327f9aab8dcb07022b857736d8201906bba02e9
|
[
"MIT"
] | 1
|
2022-03-01T16:38:14.000Z
|
2022-03-01T16:38:14.000Z
|
module Open2 where
data ⊤
: Set
where
tt
: ⊤
data ⊤'
(x : ⊤)
: Set
where
tt
: ⊤' x
record R
: Set
where
field
x
: ⊤
y
: ⊤
record S
: Set₁
where
field
x
: R
open R x public
renaming (x to y; y to z)
postulate
s
: S
open S s
using (y)
postulate
p
: ⊤' y
| 6.436364
| 29
| 0.432203
|
03927ba96a43a877c174398651aff853ca361d67
| 168
|
agda
|
Agda
|
test/Succeed/WarningOnImport/Impo.agda
|
mdimjasevic/agda
|
8fb548356b275c7a1e79b768b64511ae937c738b
|
[
"BSD-3-Clause"
] | 1,989
|
2015-01-09T23:51:16.000Z
|
2022-03-30T18:20:48.000Z
|
test/Succeed/WarningOnImport/Impo.agda
|
Seanpm2001-languages/agda
|
9911f73061e21a87fad76c662463257afe02c861
|
[
"BSD-2-Clause"
] | 4,066
|
2015-01-10T11:24:51.000Z
|
2022-03-31T21:14:49.000Z
|
test/Succeed/WarningOnImport/Impo.agda
|
Seanpm2001-languages/agda
|
9911f73061e21a87fad76c662463257afe02c861
|
[
"BSD-2-Clause"
] | 371
|
2015-01-03T14:04:08.000Z
|
2022-03-30T19:00:30.000Z
|
module WarningOnImport.Impo where
B = Set
A = B
{-# WARNING_ON_USAGE A "Deprecated: Use B instead" #-}
{-# WARNING_ON_IMPORT "Deprecated: Use Impossible instead" #-}
| 21
| 62
| 0.720238
|
7c450c192c99171cf1c0fe5aac6c9b299be97503
| 1,405
|
agda
|
Agda
|
Cubical/Data/Nat/Base.agda
|
AkermanRydbeck/cubical
|
038bcaff93d278c627ccdcec34a4f6df2b56ad5a
|
[
"MIT"
] | null | null | null |
Cubical/Data/Nat/Base.agda
|
AkermanRydbeck/cubical
|
038bcaff93d278c627ccdcec34a4f6df2b56ad5a
|
[
"MIT"
] | null | null | null |
Cubical/Data/Nat/Base.agda
|
AkermanRydbeck/cubical
|
038bcaff93d278c627ccdcec34a4f6df2b56ad5a
|
[
"MIT"
] | null | null | null |
{-# OPTIONS --no-exact-split --safe #-}
module Cubical.Data.Nat.Base where
open import Cubical.Core.Primitives
open import Agda.Builtin.Nat public
using (zero; suc; _+_)
renaming (Nat to ℕ; _-_ to _∸_; _*_ to _·_)
open import Cubical.Data.Nat.Literals public
open import Cubical.Data.Bool.Base
open import Cubical.Data.Sum.Base hiding (elim)
open import Cubical.Data.Empty.Base hiding (elim)
open import Cubical.Data.Unit.Base
predℕ : ℕ → ℕ
predℕ zero = zero
predℕ (suc n) = n
caseNat : ∀ {ℓ} → {A : Type ℓ} → (a0 aS : A) → ℕ → A
caseNat a0 aS zero = a0
caseNat a0 aS (suc n) = aS
doubleℕ : ℕ → ℕ
doubleℕ zero = zero
doubleℕ (suc x) = suc (suc (doubleℕ x))
-- doublesℕ n m = 2^n · m
doublesℕ : ℕ → ℕ → ℕ
doublesℕ zero m = m
doublesℕ (suc n) m = doublesℕ n (doubleℕ m)
-- iterate
iter : ∀ {ℓ} {A : Type ℓ} → ℕ → (A → A) → A → A
iter zero f z = z
iter (suc n) f z = f (iter n f z)
elim : ∀ {ℓ} {A : ℕ → Type ℓ}
→ A zero
→ ((n : ℕ) → A n → A (suc n))
→ (n : ℕ) → A n
elim a₀ _ zero = a₀
elim a₀ f (suc n) = f n (elim a₀ f n)
isEven isOdd : ℕ → Bool
isEven zero = true
isEven (suc n) = isOdd n
isOdd zero = false
isOdd (suc n) = isEven n
--Typed version
private
toType : Bool → Type
toType false = ⊥
toType true = Unit
isEvenT : ℕ → Type
isEvenT n = toType (isEven n)
isOddT : ℕ → Type
isOddT n = isEvenT (suc n)
isZero : ℕ → Bool
isZero zero = true
isZero (suc n) = false
| 21.287879
| 52
| 0.627046
|
6474f6c404607a6b2f486a6e58fd8e5ae0722fbf
| 4,692
|
agda
|
Agda
|
examples/instance-arguments/07-subclasses.agda
|
larrytheliquid/agda
|
477c8c37f948e6038b773409358fd8f38395f827
|
[
"MIT"
] | 1
|
2018-10-10T17:08:44.000Z
|
2018-10-10T17:08:44.000Z
|
examples/instance-arguments/07-subclasses.agda
|
masondesu/agda
|
70c8a575c46f6a568c7518150a1a64fcd03aa437
|
[
"MIT"
] | null | null | null |
examples/instance-arguments/07-subclasses.agda
|
masondesu/agda
|
70c8a575c46f6a568c7518150a1a64fcd03aa437
|
[
"MIT"
] | 1
|
2022-03-12T11:35:18.000Z
|
2022-03-12T11:35:18.000Z
|
-- {-# OPTIONS --verbose tc.records.ifs:15 #-}
-- {-# OPTIONS --verbose tc.constr.findInScope:15 #-}
-- {-# OPTIONS --verbose tc.term.args.ifs:15 #-}
-- {-# OPTIONS --verbose cta.record.ifs:15 #-}
-- {-# OPTIONS --verbose tc.section.apply:25 #-}
-- {-# OPTIONS --verbose tc.mod.apply:100 #-}
-- {-# OPTIONS --verbose scope.rec:15 #-}
-- {-# OPTIONS --verbose tc.rec.def:15 #-}
module 07-subclasses where
module Imports where
module L where
open import Agda.Primitive public
using (Level; _⊔_) renaming (lzero to zero; lsuc to suc)
-- extract from Function
id : ∀ {a} {A : Set a} → A → A
id x = x
_$_ : ∀ {a b} {A : Set a} {B : A → Set b} →
((x : A) → B x) → ((x : A) → B x)
f $ x = f x
_∘_ : ∀ {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)
-- extract from Data.Bool
infixr 5 _∨_
data Bool : Set where
true : Bool
false : Bool
not : Bool → Bool
not true = false
not false = true
_∨_ : Bool → Bool → Bool
true ∨ b = true
false ∨ b = b
-- extract from Relation.Nullary.Decidable and friends
infix 3 ¬_
data ⊥ : Set where
¬_ : ∀ {ℓ} → Set ℓ → Set ℓ
¬ P = P → ⊥
data Dec {p} (P : Set p) : Set p where
yes : ( p : P) → Dec P
no : (¬p : ¬ P) → Dec P
⌊_⌋ : ∀ {p} {P : Set p} → Dec P → Bool
⌊ yes _ ⌋ = true
⌊ no _ ⌋ = false
-- extract from Relation.Binary.PropositionalEquality
data _≡_ {a} {A : Set a} (x : A) : A → Set a where
refl : x ≡ x
cong : ∀ {a b} {A : Set a} {B : Set b}
(f : A → B) {x y} → x ≡ y → f x ≡ f y
cong f refl = refl
-- extract from Data.Nat
data ℕ : Set where
zero : ℕ
suc : (n : ℕ) → ℕ
{-# BUILTIN NATURAL ℕ #-}
pred : ℕ → ℕ
pred zero = zero
pred (suc n) = n
_≟_ : (x y : ℕ) → Dec (x ≡ y)
zero ≟ zero = yes refl
suc m ≟ suc n with m ≟ n
suc m ≟ suc .m | yes refl = yes refl
suc m ≟ suc n | no prf = no (prf ∘ cong pred)
zero ≟ suc n = no λ()
suc m ≟ zero = no λ()
open Imports
-- Begin of actual example!
record Eq (A : Set) : Set where
field eq : A → A → Bool
primEqBool : Bool → Bool → Bool
primEqBool true = id
primEqBool false = not
eqBool : Eq Bool
eqBool = record { eq = primEqBool }
primEqNat : ℕ → ℕ → Bool
primEqNat a b = ⌊ a ≟ b ⌋
primLtNat : ℕ → ℕ → Bool
primLtNat 0 _ = true
primLtNat (suc a) (suc b) = primLtNat a b
primLtNat _ _ = false
neq : {t : Set} → {{eqT : Eq t}} → t → t → Bool
neq a b = not $ eq a b
where open Eq {{...}}
record Ord₁ (A : Set) : Set where
field _<_ : A → A → Bool
eqA : Eq A
ord₁Nat : Ord₁ ℕ
ord₁Nat = record { _<_ = primLtNat; eqA = eqNat }
where eqNat : Eq ℕ
eqNat = record { eq = primEqNat }
record Ord₂ {A : Set} (eqA : Eq A) : Set where
field _<_ : A → A → Bool
ord₂Nat : Ord₂ (record { eq = primEqNat })
ord₂Nat = record { _<_ = primLtNat }
record Ord₃ (A : Set) : Set where
field _<_ : A → A → Bool
eqA : Eq A
open Eq eqA public
ord₃Nat : Ord₃ ℕ
ord₃Nat = record { _<_ = primLtNat; eqA = eqNat }
where eqNat : Eq ℕ
eqNat = record { eq = primEqNat }
record Ord₄ {A : Set} (eqA : Eq A) : Set where
field _<_ : A → A → Bool
open Eq eqA public
ord₄Nat : Ord₄ (record { eq = primEqNat })
ord₄Nat = record { _<_ = primLtNat }
module test₁ where
open Ord₁ {{...}}
open Eq {{...}}
eqNat : Eq _
eqNat = eqA
test₁ = 5 < 3
test₂ = eq 5 3
test₃ = eq true false
test₄ : {A : Set} → {{ ordA : Ord₁ A }} → A → A → Bool
test₄ a b = a < b ∨ eq a b
where
eqA' : Eq _
eqA' = eqA
module test₂ where
open Ord₂ {{...}}
open Eq {{...}}
eqNat : Eq ℕ
eqNat = record { eq = primEqNat }
test₁ = 5 < 3
test₂ = eq 5 3
test₃ = eq true false
test₄ : {A : Set} → {eqA : Eq A} → {{ ordA : Ord₂ eqA }} → A → A → Bool
test₄ {eqA = _} a b = a < b ∨ eq a b
module test₃ where
open Ord₃ {{...}}
open Eq {{...}} renaming (eq to eq')
test₁ = 5 < 3
test₂ = eq 5 3
test₃ = eq' true false
test₄ : {A : Set} → {{ ordA : Ord₃ A }} → A → A → Bool
test₄ a b = a < b ∨ eq a b
module test₄ where
open Ord₄ {{...}}
open Eq {{...}} renaming (eq to eq')
test₁ = 5 < 3
test₂ = eq 5 3
test₃ = eq' true false
test₄ : {A : Set} → {eqA : Eq A} → {{ ordA : Ord₄ eqA }} → A → A → Bool
test₄ a b = a < b ∨ eq a b
module test₄′ where
open Ord₄ {{...}} hiding (eq)
open Eq {{...}}
eqNat : Eq ℕ
eqNat = record { eq = primEqNat }
test₁ = 5 < 3
test₂ = eq 5 3
test₃ = eq true false
test₄ : {A : Set} → {eqA : Eq A} → {{ ordA : Ord₄ eqA }} → A → A → Bool
test₄ {eqA = _} a b = a < b ∨ eq a b
| 22.132075
| 73
| 0.521739
|
116a9d74eb27a9da5b8db966536e91480a937f3d
| 3,736
|
agda
|
Agda
|
RMonads/REM.agda
|
jmchapman/Relative-Monads
|
74707d3538bf494f4bd30263d2f5515a84733865
|
[
"MIT"
] | 21
|
2015-07-30T01:25:12.000Z
|
2021-02-13T18:02:18.000Z
|
RMonads/REM.agda
|
jmchapman/Relative-Monads
|
74707d3538bf494f4bd30263d2f5515a84733865
|
[
"MIT"
] | 3
|
2019-01-13T13:12:33.000Z
|
2019-05-29T09:50:26.000Z
|
RMonads/REM.agda
|
jmchapman/Relative-Monads
|
74707d3538bf494f4bd30263d2f5515a84733865
|
[
"MIT"
] | 1
|
2019-11-04T21:33:13.000Z
|
2019-11-04T21:33:13.000Z
|
open import Categories
open import Functors
open import RMonads
module RMonads.REM {a b c d}{C : Cat {a}{b}}{D : Cat {c}{d}}{J : Fun C D}
(M : RMonad J) where
open import Library
open RMonad M
open Fun
record RAlg : Set (a ⊔ c ⊔ d) where
constructor ralg
open Cat D
field acar : Obj
astr : ∀ {Z} → Hom (OMap J Z) acar → Hom (T Z) acar
alaw1 : ∀ {Z}{f : Hom (OMap J Z) acar} →
f ≅ comp (astr f) η
alaw2 : ∀{Z}{W}{k : Hom (OMap J Z) (T W)}
{f : Hom (OMap J W) acar} →
astr (comp (astr f) k) ≅ comp (astr f) (bind k)
AlgEq : {X Y : RAlg} → RAlg.acar X ≅ RAlg.acar Y →
((λ {Z} → RAlg.astr X {Z}) ≅ (λ {Z} → RAlg.astr Y {Z})) →
X ≅ Y
AlgEq {ralg acar astr _ _}{ralg .acar .astr _ _} refl refl = let open Cat in
cong₂ (ralg acar astr)
(iext λ _ → iext λ _ → ir _ _)
(iext λ _ → iext λ _ → iext λ _ → iext λ _ → ir _ _)
astrnat : ∀(alg : RAlg){X Y}
(f : Cat.Hom C X Y) →
(g : Cat.Hom D (OMap J X) (RAlg.acar alg))
(g' : Cat.Hom D (OMap J Y) (RAlg.acar alg)) →
Cat.comp D g' (HMap J f) ≅ g →
Cat.comp D (RAlg.astr alg g')
(RMonad.bind M (Cat.comp D (RMonad.η M) (HMap J f)))
≅
RAlg.astr alg g
astrnat alg f g g' p = let
open RAlg alg; open Cat D in
proof
comp (astr g') (bind (comp η (HMap J f)))
≅⟨ sym alaw2 ⟩
astr (comp (astr g') (comp η (HMap J f)))
≅⟨ cong astr (sym ass) ⟩
astr (comp (comp (astr g') η) (HMap J f))
≅⟨ cong (λ g₁ → astr (comp g₁ (HMap J f))) (sym alaw1) ⟩
astr (comp g' (HMap J f))
≅⟨ cong astr p ⟩
astr g ∎
record RAlgMorph (A B : RAlg) : Set (a ⊔ c ⊔ d)
where
constructor ralgmorph
open Cat D
open RAlg
field amor : Hom (acar A) (acar B)
ahom : ∀{Z}{f : Hom (OMap J Z) (acar A)} →
comp amor (astr A f) ≅ astr B (comp amor f)
open RAlgMorph
RAlgMorphEq : ∀{X Y : RAlg}{f g : RAlgMorph X Y} → amor f ≅ amor g → f ≅ g
RAlgMorphEq {X}{Y}{ralgmorph amor _}{ralgmorph .amor _} refl =
cong (ralgmorph amor) (iext λ _ → iext λ _ → ir _ _)
lemZ : ∀{X X' Y Y' : RAlg}
{f : RAlgMorph X Y}{g : RAlgMorph X' Y'} → X ≅ X' → Y ≅ Y' →
amor f ≅ amor g → f ≅ g
lemZ refl refl = RAlgMorphEq
IdMorph : ∀{A : RAlg} → RAlgMorph A A
IdMorph {A} = let open Cat D; open RAlg A in record {
amor = iden;
ahom = λ {_ f} →
proof
comp iden (astr f)
≅⟨ idl ⟩
astr f
≅⟨ cong astr (sym idl) ⟩
astr (comp iden f)
∎}
CompMorph : ∀{X Y Z : RAlg} →
RAlgMorph Y Z → RAlgMorph X Y → RAlgMorph X Z
CompMorph {X}{Y}{Z} f g = let open Cat D; open RAlg in record {
amor = comp (amor f) (amor g);
ahom = λ {_ f'} →
proof
comp (comp (amor f) (amor g)) (astr X f')
≅⟨ ass ⟩
comp (amor f) (comp (amor g) (astr X f'))
≅⟨ cong (comp (amor f)) (ahom g) ⟩
comp (amor f) (astr Y (comp (amor g) f'))
≅⟨ ahom f ⟩
astr Z (comp (amor f) (comp (amor g) f'))
≅⟨ cong (astr Z) (sym ass) ⟩
astr Z (comp (comp (amor f) (amor g)) f')
∎}
idlMorph : {X Y : RAlg}{f : RAlgMorph X Y} →
CompMorph IdMorph f ≅ f
idlMorph = RAlgMorphEq (Cat.idl D)
idrMorph : ∀{X Y : RAlg}{f : RAlgMorph X Y} →
CompMorph f IdMorph ≅ f
idrMorph = RAlgMorphEq (Cat.idr D)
assMorph : ∀{W X Y Z : RAlg}
{f : RAlgMorph Y Z}{g : RAlgMorph X Y}{h : RAlgMorph W X} →
CompMorph (CompMorph f g) h ≅ CompMorph f (CompMorph g h)
assMorph = RAlgMorphEq (Cat.ass D)
EM : Cat
EM = record{
Obj = RAlg;
Hom = RAlgMorph;
iden = IdMorph;
comp = CompMorph;
idl = idlMorph;
idr = idrMorph;
ass = λ{_ _ _ _ f g h} → assMorph {f = f}{g}{h}}
| 30.129032
| 76
| 0.523019
|
3f2b9915ed3d88213be87cdbd75c76cd3566d9ed
| 276
|
agda
|
Agda
|
test/Common/Irrelevance.agda
|
larrytheliquid/agda
|
477c8c37f948e6038b773409358fd8f38395f827
|
[
"MIT"
] | 1
|
2019-11-27T07:26:06.000Z
|
2019-11-27T07:26:06.000Z
|
test/Common/Irrelevance.agda
|
np/agda-git-experiment
|
20596e9dd9867166a64470dd24ea68925ff380ce
|
[
"MIT"
] | null | null | null |
test/Common/Irrelevance.agda
|
np/agda-git-experiment
|
20596e9dd9867166a64470dd24ea68925ff380ce
|
[
"MIT"
] | 1
|
2022-03-12T11:35:18.000Z
|
2022-03-12T11:35:18.000Z
|
-- Andreas, 2012-01-12
module Common.Irrelevance where
open import Common.Level
postulate
.irrAxiom : ∀ {a}{A : Set a} → .A → A
{-# BUILTIN IRRAXIOM irrAxiom #-}
record Squash {a}(A : Set a) : Set a where
constructor squash
field
.unsquash : A
open Squash public
| 18.4
| 42
| 0.673913
|
4ef7e78516337a81789d9d81a5ead72033fee44f
| 2,512
|
agda
|
Agda
|
DataAndCodata.agda
|
nad/codata
|
1b90445566df0d3b4ba6e31bd0bac417b4c0eb0e
|
[
"MIT"
] | 1
|
2021-02-13T14:48:45.000Z
|
2021-02-13T14:48:45.000Z
|
DataAndCodata.agda
|
nad/codata
|
1b90445566df0d3b4ba6e31bd0bac417b4c0eb0e
|
[
"MIT"
] | null | null | null |
DataAndCodata.agda
|
nad/codata
|
1b90445566df0d3b4ba6e31bd0bac417b4c0eb0e
|
[
"MIT"
] | null | null | null |
------------------------------------------------------------------------
-- Data and codata can sometimes be "unified"
------------------------------------------------------------------------
-- In Haskell one can define the partial list type once, and define
-- map once and for all for this type. In Agda one typically defines
-- the (finite) list type + map and separately the (potentially
-- infinite) colist type + map. This is not strictly necessary,
-- though: the two types can be unified. The gain may be small,
-- though.
module DataAndCodata where
open import Codata.Musical.Notation
open import Function
open import Relation.Binary.PropositionalEquality
------------------------------------------------------------------------
-- Conditional coinduction
data Rec : Set where
μ : Rec
ν : Rec
∞? : Rec → Set → Set
∞? μ = id
∞? ν = ∞
♯? : ∀ (r : Rec) {A} → A → ∞? r A
♯? μ x = x
♯? ν x = ♯ x
♭? : ∀ (r : Rec) {A} → ∞? r A → A
♭? μ = id
♭? ν = ♭
------------------------------------------------------------------------
-- A type for definitely finite or potentially infinite lists
-- If the Rec parameter is μ, then the type contains finite lists, and
-- otherwise it contains potentially infinite lists.
infixr 5 _∷_
data List∞? (r : Rec) (A : Set) : Set where
[] : List∞? r A
_∷_ : A → ∞? r (List∞? r A) → List∞? r A
-- List equality.
infix 4 _≈_
data _≈_ {r A} : List∞? r A → List∞? r A → Set where
[] : [] ≈ []
_∷_ : ∀ {x y xs ys} →
x ≡ y → ∞? r (♭? r xs ≈ ♭? r ys) → x ∷ xs ≈ y ∷ ys
-- μ-lists can be seen as ν-lists.
lift : ∀ {A} → List∞? μ A → List∞? ν A
lift [] = []
lift (x ∷ xs) = x ∷ ♯ lift xs
------------------------------------------------------------------------
-- The map function
-- Maps over any list. The definition contains separate cases for _∷_
-- depending on whether the Rec index is μ or ν, though.
map : ∀ {r A B} → (A → B) → List∞? r A → List∞? r B
map f [] = []
map {μ} f (x ∷ xs) = f x ∷ map f xs -- Structural recursion
-- (guarded).
map {ν} f (x ∷ xs) = f x ∷ ♯ map f (♭ xs) -- Guarded corecursion.
-- In Haskell the map function is automatically (in effect) parametric
-- in the Rec parameter. Here this property is not automatic, so I
-- have proved it manually:
map-parametric : ∀ {A B} (f : A → B) (xs : List∞? μ A) →
map f (lift xs) ≈ lift (map f xs)
map-parametric f [] = []
map-parametric f (x ∷ xs) = refl ∷ ♯ map-parametric f xs
| 29.904762
| 72
| 0.496815
|
3666f9520a710b3afbf1c2e71c5e51dd3f793232
| 41
|
agda
|
Agda
|
test/interaction/Issue2959.agda
|
mdimjasevic/agda
|
8fb548356b275c7a1e79b768b64511ae937c738b
|
[
"BSD-3-Clause"
] | 1,989
|
2015-01-09T23:51:16.000Z
|
2022-03-30T18:20:48.000Z
|
test/interaction/Issue2959.agda
|
Seanpm2001-languages/agda
|
9911f73061e21a87fad76c662463257afe02c861
|
[
"BSD-2-Clause"
] | 4,066
|
2015-01-10T11:24:51.000Z
|
2022-03-31T21:14:49.000Z
|
test/interaction/Issue2959.agda
|
Seanpm2001-languages/agda
|
9911f73061e21a87fad76c662463257afe02c861
|
[
"BSD-2-Clause"
] | 371
|
2015-01-03T14:04:08.000Z
|
2022-03-30T19:00:30.000Z
|
open import Issue2959.M Set
r : R
r = ?
| 8.2
| 27
| 0.634146
|
37dc2b48aaf7fc1991538b52a4278a69097ca189
| 4,125
|
agda
|
Agda
|
Categories/Object/BinaryProducts/N-ary.agda
|
copumpkin/categories
|
36f4181d751e2ecb54db219911d8c69afe8ba892
|
[
"BSD-3-Clause"
] | 98
|
2015-04-15T14:57:33.000Z
|
2022-03-08T05:20:36.000Z
|
Categories/Object/BinaryProducts/N-ary.agda
|
copumpkin/categories
|
36f4181d751e2ecb54db219911d8c69afe8ba892
|
[
"BSD-3-Clause"
] | 19
|
2015-05-23T06:47:10.000Z
|
2019-08-09T16:31:40.000Z
|
Categories/Object/BinaryProducts/N-ary.agda
|
copumpkin/categories
|
36f4181d751e2ecb54db219911d8c69afe8ba892
|
[
"BSD-3-Clause"
] | 23
|
2015-02-05T13:03:09.000Z
|
2021-11-11T13:50:56.000Z
|
{-# OPTIONS --universe-polymorphism #-}
open import Categories.Category
open import Categories.Object.BinaryProducts
module Categories.Object.BinaryProducts.N-ary {o ℓ e}
(C : Category o ℓ e)
(BP : BinaryProducts C)
where
open Category C
open BinaryProducts BP
open Equiv
import Categories.Object.Product
open Categories.Object.Product C
open import Data.Nat using (ℕ; zero; suc)
open import Data.Vec
open import Data.Product.N-ary hiding ([])
Prod : {n : ℕ} → Vec Obj (suc n) → Obj
Prod { zero} (A ∷ []) = A
Prod {suc n} (A ∷ As) = A × Prod {n} As
πˡ : {n m : ℕ}
→ (As : Vec Obj (suc n))
→ (Bs : Vec Obj (suc m))
→ Prod (As ++ Bs) ⇒ Prod As
πˡ { zero} (A ∷ []) Bs = π₁
πˡ {suc n} (A ∷ As) Bs = ⟨ π₁ , πˡ {n} As Bs ∘ π₂ ⟩
πʳ : {n m : ℕ}
→ (As : Vec Obj (suc n))
→ (Bs : Vec Obj (suc m))
→ Prod (As ++ Bs) ⇒ Prod Bs
πʳ { zero} (A ∷ []) Bs = π₂
πʳ {suc n} (A ∷ As) Bs = πʳ {n} As Bs ∘ π₂
glue : {n m : ℕ}{X : Obj}
→ (As : Vec Obj (suc n))
→ (Bs : Vec Obj (suc m))
→ (f : X ⇒ Prod As)
→ (g : X ⇒ Prod Bs)
→ X ⇒ Prod (As ++ Bs)
glue { zero}{m} (A ∷ []) Bs f g = ⟨ f , g ⟩
glue {suc n}{m} (A ∷ As) Bs f g = ⟨ π₁ ∘ f , glue As Bs (π₂ ∘ f) g ⟩
open HomReasoning
.commuteˡ : {n m : ℕ}{X : Obj}
→ (As : Vec Obj (suc n))
→ (Bs : Vec Obj (suc m))
→ {f : X ⇒ Prod As}
→ {g : X ⇒ Prod Bs}
→ πˡ As Bs ∘ glue As Bs f g ≡ f
commuteˡ { zero} (A ∷ []) Bs {f}{g} = commute₁
commuteˡ {suc n} (A ∷ As) Bs {f}{g} =
begin
⟨ π₁ , πˡ As Bs ∘ π₂ ⟩ ∘ ⟨ π₁ ∘ f , glue As Bs (π₂ ∘ f) g ⟩
↓⟨ ⟨⟩∘ ⟩
⟨ π₁ ∘ ⟨ π₁ ∘ f , glue As Bs (π₂ ∘ f) g ⟩
, (πˡ As Bs ∘ π₂) ∘ ⟨ π₁ ∘ f , glue As Bs (π₂ ∘ f) g ⟩
⟩
↓⟨ ⟨⟩-cong₂ commute₁ assoc ⟩
⟨ π₁ ∘ f
, πˡ As Bs ∘ π₂ ∘ ⟨ π₁ ∘ f , glue As Bs (π₂ ∘ f) g ⟩
⟩
↓⟨ ⟨⟩-congʳ (refl ⟩∘⟨ commute₂) ⟩
⟨ π₁ ∘ f , πˡ As Bs ∘ glue As Bs (π₂ ∘ f) g ⟩
↓⟨ ⟨⟩-congʳ (commuteˡ As Bs) ⟩
⟨ π₁ ∘ f , π₂ ∘ f ⟩
↓⟨ g-η ⟩
f
∎
.commuteʳ : {n m : ℕ}{X : Obj}
→ (As : Vec Obj (suc n))
→ (Bs : Vec Obj (suc m))
→ {f : X ⇒ Prod As}
→ {g : X ⇒ Prod Bs}
→ πʳ As Bs ∘ glue As Bs f g ≡ g
commuteʳ { zero} (A ∷ []) Bs {f}{g} = commute₂
commuteʳ {suc n} (A ∷ As) Bs {f}{g} =
begin
(πʳ As Bs ∘ π₂) ∘ ⟨ π₁ ∘ f , glue As Bs (π₂ ∘ f) g ⟩
↓⟨ assoc ⟩
πʳ As Bs ∘ π₂ ∘ ⟨ π₁ ∘ f , glue As Bs (π₂ ∘ f) g ⟩
↓⟨ refl ⟩∘⟨ commute₂ ⟩
πʳ As Bs ∘ glue As Bs (π₂ ∘ f) g
↓⟨ commuteʳ As Bs ⟩
g
∎
.N-universal : {n m : ℕ}{X : Obj}
→ (As : Vec Obj (suc n))
→ (Bs : Vec Obj (suc m))
→ {f : X ⇒ Prod As}
→ {g : X ⇒ Prod Bs}
→ {h : X ⇒ Prod (As ++ Bs) }
→ πˡ As Bs ∘ h ≡ f
→ πʳ As Bs ∘ h ≡ g
→ glue As Bs f g ≡ h
N-universal { zero} (A ∷ []) Bs {f}{g}{h} h-commuteˡ h-commuteʳ = universal h-commuteˡ h-commuteʳ
N-universal {suc n} (A ∷ As) Bs {f}{g}{h} h-commuteˡ h-commuteʳ =
begin
⟨ π₁ ∘ f , glue As Bs (π₂ ∘ f) g ⟩
↓⟨ ⟨⟩-congʳ (N-universal As Bs π₂∘h-commuteˡ π₂∘h-commuteʳ) ⟩
⟨ π₁ ∘ f , π₂ ∘ h ⟩
↑⟨ ⟨⟩-congˡ π₁∘h-commuteˡ ⟩
⟨ π₁ ∘ h , π₂ ∘ h ⟩
↓⟨ g-η ⟩
h
∎
where
-- h-commuteˡ : ⟨ π₁ , πˡ As Bs ∘ π₂ ⟩ ∘ h ≡ f
-- h-commuteʳ : (πʳ As Bs ∘ π₂) ∘ h ≡ g
π₁∘h-commuteˡ : π₁ ∘ h ≡ π₁ ∘ f
π₁∘h-commuteˡ =
begin
π₁ ∘ h
↑⟨ commute₁ ⟩∘⟨ refl ⟩
(π₁ ∘ ⟨ π₁ , πˡ As Bs ∘ π₂ ⟩) ∘ h
↓⟨ assoc ⟩
π₁ ∘ ⟨ π₁ , πˡ As Bs ∘ π₂ ⟩ ∘ h
↓⟨ refl ⟩∘⟨ h-commuteˡ ⟩
π₁ ∘ f
∎
π₂∘h-commuteˡ : πˡ As Bs ∘ π₂ ∘ h ≡ π₂ ∘ f
π₂∘h-commuteˡ =
begin
πˡ As Bs ∘ π₂ ∘ h
↑⟨ assoc ⟩
(πˡ As Bs ∘ π₂) ∘ h
↑⟨ commute₂ ⟩∘⟨ refl ⟩
(π₂ ∘ ⟨ π₁ , πˡ As Bs ∘ π₂ ⟩) ∘ h
↓⟨ assoc ⟩
π₂ ∘ ⟨ π₁ , πˡ As Bs ∘ π₂ ⟩ ∘ h
↓⟨ refl ⟩∘⟨ h-commuteˡ ⟩
π₂ ∘ f
∎
π₂∘h-commuteʳ : πʳ As Bs ∘ π₂ ∘ h ≡ g
π₂∘h-commuteʳ = trans (sym assoc) h-commuteʳ
isProduct : {n m : ℕ}
→ (As : Vec Obj (suc n))
→ (Bs : Vec Obj (suc m))
→ Product (Prod As) (Prod Bs)
isProduct {n}{m} As Bs = record
{ A×B = Prod (As ++ Bs)
; π₁ = πˡ As Bs
; π₂ = πʳ As Bs
; ⟨_,_⟩ = glue As Bs
; commute₁ = commuteˡ As Bs
; commute₂ = commuteʳ As Bs
; universal = N-universal As Bs
}
| 25.78125
| 97
| 0.475152
|
116ee691a0428b2b36171620969d3f7378fffd66
| 1,569
|
agda
|
Agda
|
src/Categories/Category/Helper.agda
|
jaykru/agda-categories
|
a4053cf700bcefdf73b857c3352f1eae29382a60
|
[
"MIT"
] | 279
|
2019-06-01T14:36:40.000Z
|
2022-03-22T00:40:14.000Z
|
src/Categories/Category/Helper.agda
|
seanpm2001/agda-categories
|
d9e4f578b126313058d105c61707d8c8ae987fa8
|
[
"MIT"
] | 236
|
2019-06-01T14:53:54.000Z
|
2022-03-28T14:31:43.000Z
|
src/Categories/Category/Helper.agda
|
seanpm2001/agda-categories
|
d9e4f578b126313058d105c61707d8c8ae987fa8
|
[
"MIT"
] | 64
|
2019-06-02T16:58:15.000Z
|
2022-03-14T02:00:59.000Z
|
{-# OPTIONS --without-K --safe #-}
module Categories.Category.Helper where
open import Level
open import Relation.Binary using (Rel; IsEquivalence)
open import Categories.Category.Core using (Category)
-- Since we add extra proofs in the definition of `Category` (i.e. `sym-assoc` and
-- `identity²`), we might still want to construct a `Category` in its originally
-- easier manner. Thus, this redundant definition is here to ease the construction.
private
record CategoryHelper (o ℓ e : Level) : Set (suc (o ⊔ ℓ ⊔ e)) where
infix 4 _≈_ _⇒_
infixr 9 _∘_
field
Obj : Set o
_⇒_ : Rel Obj ℓ
_≈_ : ∀ {A B} → Rel (A ⇒ B) e
id : ∀ {A} → (A ⇒ A)
_∘_ : ∀ {A B C} → (B ⇒ C) → (A ⇒ B) → (A ⇒ C)
field
assoc : ∀ {A B C D} {f : A ⇒ B} {g : B ⇒ C} {h : C ⇒ D} → (h ∘ g) ∘ f ≈ h ∘ (g ∘ f)
identityˡ : ∀ {A B} {f : A ⇒ B} → id ∘ f ≈ f
identityʳ : ∀ {A B} {f : A ⇒ B} → f ∘ id ≈ f
equiv : ∀ {A B} → IsEquivalence (_≈_ {A} {B})
∘-resp-≈ : ∀ {A B C} {f h : B ⇒ C} {g i : A ⇒ B} → f ≈ h → g ≈ i → f ∘ g ≈ h ∘ i
categoryHelper : ∀ {o ℓ e} → CategoryHelper o ℓ e → Category o ℓ e
categoryHelper C = record
{ Obj = Obj
; _⇒_ = _⇒_
; _≈_ = _≈_
; id = id
; _∘_ = _∘_
; assoc = assoc
; sym-assoc = sym assoc
; identityˡ = identityˡ
; identityʳ = identityʳ
; identity² = identityˡ
; equiv = equiv
; ∘-resp-≈ = ∘-resp-≈
}
where open CategoryHelper C
module _ {A B} where
open IsEquivalence (equiv {A} {B}) public
| 31.38
| 93
| 0.525813
|
4e5f90ee81f2910c5485e0a2d7514d31ee852b52
| 189
|
agda
|
Agda
|
Cubical/HITs/AssocList.agda
|
kiana-S/univalent-foundations
|
8bdb0766260489f9c89a14f4c0f2ad26e5190dec
|
[
"MIT"
] | null | null | null |
Cubical/HITs/AssocList.agda
|
kiana-S/univalent-foundations
|
8bdb0766260489f9c89a14f4c0f2ad26e5190dec
|
[
"MIT"
] | 1
|
2022-01-27T02:07:48.000Z
|
2022-01-27T02:07:48.000Z
|
Cubical/HITs/AssocList.agda
|
kiana-S/univalent-foundations
|
8bdb0766260489f9c89a14f4c0f2ad26e5190dec
|
[
"MIT"
] | 1
|
2021-11-22T02:02:01.000Z
|
2021-11-22T02:02:01.000Z
|
{-# OPTIONS --cubical --no-import-sorts --safe #-}
module Cubical.HITs.AssocList where
open import Cubical.HITs.AssocList.Base public
open import Cubical.HITs.AssocList.Properties public
| 27
| 52
| 0.783069
|
1b7ae68b5774d544b03ab3346ad592ec477a0e6b
| 5,660
|
agda
|
Agda
|
Cubical/HITs/SetQuotients/Properties.agda
|
Rotsor/cubical
|
d55cd4834ca1f171f58b4a0c46b804ea6d18191f
|
[
"MIT"
] | null | null | null |
Cubical/HITs/SetQuotients/Properties.agda
|
Rotsor/cubical
|
d55cd4834ca1f171f58b4a0c46b804ea6d18191f
|
[
"MIT"
] | null | null | null |
Cubical/HITs/SetQuotients/Properties.agda
|
Rotsor/cubical
|
d55cd4834ca1f171f58b4a0c46b804ea6d18191f
|
[
"MIT"
] | null | null | null |
{-
Set quotients:
-}
{-# OPTIONS --cubical --safe #-}
module Cubical.HITs.SetQuotients.Properties where
open import Cubical.HITs.SetQuotients.Base
open import Cubical.Core.Everything
open import Cubical.Foundations.Prelude
open import Cubical.Foundations.Isomorphism
open import Cubical.Foundations.Equiv
open import Cubical.Foundations.HLevels
open import Cubical.Foundations.HAEquiv
open import Cubical.Foundations.Univalence
open import Cubical.Data.Nat
open import Cubical.Data.Sigma
open import Cubical.Relation.Nullary
open import Cubical.Relation.Binary.Base
open import Cubical.HITs.PropositionalTruncation
open import Cubical.HITs.SetTruncation
-- Type quotients
private
variable
ℓ ℓ' ℓ'' : Level
A : Type ℓ
R : A → A → Type ℓ'
B : A / R → Type ℓ''
elimEq/ : (Bprop : (x : A / R ) → isProp (B x))
{x y : A / R}
(eq : x ≡ y)
(bx : B x)
(by : B y) →
PathP (λ i → B (eq i)) bx by
elimEq/ {B = B} Bprop {x = x} =
J (λ y eq → ∀ bx by → PathP (λ i → B (eq i)) bx by) (λ bx by → Bprop x bx by)
elimSetQuotientsProp : ((x : A / R ) → isProp (B x)) →
(f : (a : A) → B ( [ a ])) →
(x : A / R) → B x
elimSetQuotientsProp Bprop f [ x ] = f x
elimSetQuotientsProp Bprop f (squash/ x y p q i j) =
isOfHLevel→isOfHLevelDep {n = 2} (λ x → isProp→isSet (Bprop x))
(g x) (g y) (cong g p) (cong g q) (squash/ x y p q) i j
where
g = elimSetQuotientsProp Bprop f
elimSetQuotientsProp Bprop f (eq/ a b r i) = elimEq/ Bprop (eq/ a b r) (f a) (f b) i
-- lemma 6.10.2 in hott book
-- TODO: defined truncated Sigma as ∃
[]surjective : (x : A / R) → ∥ Σ[ a ∈ A ] [ a ] ≡ x ∥
[]surjective = elimSetQuotientsProp (λ x → squash) (λ a → ∣ a , refl ∣)
elimSetQuotients : {B : A / R → Type ℓ} →
(Bset : (x : A / R) → isSet (B x)) →
(f : (a : A) → (B [ a ])) →
(feq : (a b : A) (r : R a b) →
PathP (λ i → B (eq/ a b r i)) (f a) (f b)) →
(x : A / R) → B x
elimSetQuotients Bset f feq [ a ] = f a
elimSetQuotients Bset f feq (eq/ a b r i) = feq a b r i
elimSetQuotients Bset f feq (squash/ x y p q i j) =
isOfHLevel→isOfHLevelDep {n = 2} Bset
(g x) (g y) (cong g p) (cong g q) (squash/ x y p q) i j
where
g = elimSetQuotients Bset f feq
setQuotUniversal : {B : Type ℓ} (Bset : isSet B) →
(A / R → B) ≃ (Σ[ f ∈ (A → B) ] ((a b : A) → R a b → f a ≡ f b))
setQuotUniversal Bset = isoToEquiv (iso intro elim elimRightInv elimLeftInv)
where
intro = λ g → (λ a → g [ a ]) , λ a b r i → g (eq/ a b r i)
elim = λ h → elimSetQuotients (λ x → Bset) (fst h) (snd h)
elimRightInv : ∀ h → intro (elim h) ≡ h
elimRightInv h = refl
elimLeftInv : ∀ g → elim (intro g) ≡ g
elimLeftInv = λ g → funExt (λ x → elimPropTrunc {P = λ sur → elim (intro g) x ≡ g x}
(λ sur → Bset (elim (intro g) x) (g x))
(λ sur → cong (elim (intro g)) (sym (snd sur)) ∙ (cong g (snd sur))) ([]surjective x)
)
open BinaryRelation
effective : (Rprop : isPropValued R) (Requiv : isEquivRel R) (a b : A) → [ a ] ≡ [ b ] → R a b
effective {A = A} {R = R} Rprop (EquivRel R/refl R/sym R/trans) a b p = transport aa≡ab (R/refl _)
where
helper : A / R → hProp
helper = elimSetQuotients (λ _ → isSetHProp) (λ c → (R a c , Rprop a c))
(λ c d cd → ΣProp≡ (λ _ → isPropIsProp)
(ua (PropEquiv→Equiv (Rprop a c) (Rprop a d)
(λ ac → R/trans _ _ _ ac cd) (λ ad → R/trans _ _ _ ad (R/sym _ _ cd)))))
aa≡ab : R a a ≡ R a b
aa≡ab i = fst (helper (p i))
isEquivRel→isEffective : isPropValued R → isEquivRel R → isEffective R
isEquivRel→isEffective {R = R} Rprop Req a b = isoToEquiv (iso intro elim intro-elim elim-intro)
where
intro : [ a ] ≡ [ b ] → R a b
intro = effective Rprop Req a b
elim : R a b → [ a ] ≡ [ b ]
elim = eq/ a b
intro-elim : ∀ x → intro (elim x) ≡ x
intro-elim ab = Rprop a b _ _
elim-intro : ∀ x → elim (intro x) ≡ x
elim-intro eq = squash/ _ _ _ _
discreteSetQuotients : Discrete A → isPropValued R → isEquivRel R → (∀ a₀ a₁ → Dec (R a₀ a₁)) → Discrete (A / R)
discreteSetQuotients {A = A} {R = R} Adis Rprop Req Rdec =
elimSetQuotients ((λ a₀ → isSetPi (λ a₁ → isProp→isSet (isPropDec (squash/ a₀ a₁)))))
discreteSetQuotients' discreteSetQuotients'-eq
where
discreteSetQuotients' : (a : A) (y : A / R) → Dec ([ a ] ≡ y)
discreteSetQuotients' a₀ = elimSetQuotients ((λ a₁ → isProp→isSet (isPropDec (squash/ [ a₀ ] a₁)))) dis dis-eq
where
dis : (a₁ : A) → Dec ([ a₀ ] ≡ [ a₁ ])
dis a₁ with Rdec a₀ a₁
... | (yes p) = yes (eq/ a₀ a₁ p)
... | (no ¬p) = no λ eq → ¬p (effective Rprop Req a₀ a₁ eq )
dis-eq : (a b : A) (r : R a b) →
PathP (λ i → Dec ([ a₀ ] ≡ eq/ a b r i)) (dis a) (dis b)
dis-eq a b ab = J (λ b ab → ∀ k → PathP (λ i → Dec ([ a₀ ] ≡ ab i)) (dis a) k)
(λ k → isPropDec (squash/ _ _) _ _) (eq/ a b ab) (dis b)
discreteSetQuotients'-eq : (a b : A) (r : R a b) →
PathP (λ i → (y : A / R) → Dec (eq/ a b r i ≡ y))
(discreteSetQuotients' a) (discreteSetQuotients' b)
discreteSetQuotients'-eq a b ab =
J (λ b ab → ∀ k → PathP (λ i → (y : A / R) → Dec (ab i ≡ y))
(discreteSetQuotients' a) k)
(λ k → funExt (λ x → isPropDec (squash/ _ _) _ _)) (eq/ a b ab) (discreteSetQuotients' b)
| 37.733333
| 142
| 0.536219
|
cc3891dd3329870ef6bc3d534ace5a802e3cf579
| 164
|
agda
|
Agda
|
test/Fail/UnknownImplicitInstance.agda
|
mdimjasevic/agda
|
8fb548356b275c7a1e79b768b64511ae937c738b
|
[
"BSD-3-Clause"
] | 1,989
|
2015-01-09T23:51:16.000Z
|
2022-03-30T18:20:48.000Z
|
test/Fail/UnknownImplicitInstance.agda
|
Seanpm2001-languages/agda
|
9911f73061e21a87fad76c662463257afe02c861
|
[
"BSD-2-Clause"
] | 4,066
|
2015-01-10T11:24:51.000Z
|
2022-03-31T21:14:49.000Z
|
test/Fail/UnknownImplicitInstance.agda
|
Seanpm2001-languages/agda
|
9911f73061e21a87fad76c662463257afe02c861
|
[
"BSD-2-Clause"
] | 371
|
2015-01-03T14:04:08.000Z
|
2022-03-30T19:00:30.000Z
|
module UnknownImplicitInstance where
⟨⟩ : {A : Set} {{a : A}} → A
⟨⟩ {{a}} = a
postulate
B : Set
instance b : B
f : {A : Set₁} {{a : A}} → A
x : Set
x = f
| 12.615385
| 36
| 0.493902
|
4ea49ed65934cac2c59e698ca56b4ab067e09706
| 5,061
|
agda
|
Agda
|
vendor/stdlib/src/Data/Fin/Dec.agda
|
isabella232/Lemmachine
|
8ef786b40e4a9ab274c6103dc697dcb658cf3db3
|
[
"MIT"
] | 56
|
2015-01-20T02:11:42.000Z
|
2021-12-21T17:02:19.000Z
|
vendor/stdlib/src/Data/Fin/Dec.agda
|
larrytheliquid/Lemmachine
|
8ef786b40e4a9ab274c6103dc697dcb658cf3db3
|
[
"MIT"
] | 1
|
2022-03-12T12:17:51.000Z
|
2022-03-12T12:17:51.000Z
|
vendor/stdlib/src/Data/Fin/Dec.agda
|
isabella232/Lemmachine
|
8ef786b40e4a9ab274c6103dc697dcb658cf3db3
|
[
"MIT"
] | 3
|
2015-07-21T16:37:58.000Z
|
2022-03-12T11:54:10.000Z
|
------------------------------------------------------------------------
-- Decision procedures for finite sets and subsets of finite sets
------------------------------------------------------------------------
module Data.Fin.Dec where
open import Data.Function
open import Data.Nat hiding (_<_)
open import Data.Vec hiding (_∈_)
open import Data.Fin
open import Data.Fin.Subset
open import Data.Fin.Subset.Props
open import Data.Product as Prod
open import Data.Empty
open import Relation.Nullary
open import Relation.Unary using (Pred)
infix 4 _∈?_
_∈?_ : ∀ {n} x (p : Subset n) → Dec (x ∈ p)
zero ∈? inside ∷ p = yes here
zero ∈? outside ∷ p = no λ()
suc n ∈? s ∷ p with n ∈? p
... | yes n∈p = yes (there n∈p)
... | no n∉p = no (n∉p ∘ drop-there)
private
restrictP : ∀ {n} → (Fin (suc n) → Set) → (Fin n → Set)
restrictP P f = P (suc f)
restrict : ∀ {n} {P : Fin (suc n) → Set} →
(∀ f → Dec (P f)) →
(∀ f → Dec (restrictP P f))
restrict dec f = dec (suc f)
any? : ∀ {n} {P : Fin n → Set} →
((f : Fin n) → Dec (P f)) →
Dec (∃ P)
any? {zero} {P} dec = no ((¬ Fin 0 ∶ λ()) ∘ proj₁)
any? {suc n} {P} dec with dec zero | any? (restrict dec)
... | yes p | _ = yes (_ , p)
... | _ | yes (_ , p') = yes (_ , p')
... | no ¬p | no ¬p' = no helper
where
helper : ∄ P
helper (zero , p) = ¬p p
helper (suc f , p') = ¬p' (_ , p')
nonempty? : ∀ {n} (p : Subset n) → Dec (Nonempty p)
nonempty? p = any? (λ x → x ∈? p)
private
restrict∈ : ∀ {n} P {Q : Fin (suc n) → Set} →
(∀ {f} → Q f → Dec (P f)) →
(∀ {f} → restrictP Q f → Dec (restrictP P f))
restrict∈ _ dec {f} Qf = dec {suc f} Qf
decFinSubset : ∀ {n} {P Q : Fin n → Set} →
(∀ f → Dec (Q f)) →
(∀ {f} → Q f → Dec (P f)) →
Dec (∀ {f} → Q f → P f)
decFinSubset {zero} _ _ = yes λ{}
decFinSubset {suc n} {P} {Q} decQ decP = helper
where
helper : Dec (∀ {f} → Q f → P f)
helper with decFinSubset (restrict decQ) (restrict∈ P decP)
helper | no ¬q⟶p = no (λ q⟶p → ¬q⟶p (λ {f} q → q⟶p {suc f} q))
helper | yes q⟶p with decQ zero
helper | yes q⟶p | yes q₀ with decP q₀
helper | yes q⟶p | yes q₀ | no ¬p₀ = no (λ q⟶p → ¬p₀ (q⟶p {zero} q₀))
helper | yes q⟶p | yes q₀ | yes p₀ = yes (λ {_} → hlpr _)
where
hlpr : ∀ f → Q f → P f
hlpr zero _ = p₀
hlpr (suc f) qf = q⟶p qf
helper | yes q⟶p | no ¬q₀ = yes (λ {_} → hlpr _)
where
hlpr : ∀ f → Q f → P f
hlpr zero q₀ = ⊥-elim (¬q₀ q₀)
hlpr (suc f) qf = q⟶p qf
all∈? : ∀ {n} {P : Fin n → Set} {q} →
(∀ {f} → f ∈ q → Dec (P f)) →
Dec (∀ {f} → f ∈ q → P f)
all∈? {q = q} dec = decFinSubset (λ f → f ∈? q) dec
all? : ∀ {n} {P : Fin n → Set} →
(∀ f → Dec (P f)) →
Dec (∀ f → P f)
all? dec with all∈? {q = all inside} (λ {f} _ → dec f)
... | yes ∀p = yes (λ f → ∀p (allInside f))
... | no ¬∀p = no (λ ∀p → ¬∀p (λ {f} _ → ∀p f))
decLift : ∀ {n} {P : Fin n → Set} →
(∀ x → Dec (P x)) →
(∀ p → Dec (Lift P p))
decLift dec p = all∈? (λ {x} _ → dec x)
private
restrictSP : ∀ {n} → Side → (Subset (suc n) → Set) → (Subset n → Set)
restrictSP s P p = P (s ∷ p)
restrictS : ∀ {n} {P : Subset (suc n) → Set} →
(s : Side) →
(∀ p → Dec (P p)) →
(∀ p → Dec (restrictSP s P p))
restrictS s dec p = dec (s ∷ p)
anySubset? : ∀ {n} {P : Subset n → Set} →
(∀ s → Dec (P s)) →
Dec (∃ P)
anySubset? {zero} {P} dec with dec []
... | yes P[] = yes (_ , P[])
... | no ¬P[] = no helper
where
helper : ∄ P
helper ([] , P[]) = ¬P[] P[]
anySubset? {suc n} {P} dec with anySubset? (restrictS inside dec)
| anySubset? (restrictS outside dec)
... | yes (_ , Pp) | _ = yes (_ , Pp)
... | _ | yes (_ , Pp) = yes (_ , Pp)
... | no ¬Pp | no ¬Pp' = no helper
where
helper : ∄ P
helper (inside ∷ p , Pp) = ¬Pp (_ , Pp)
helper (outside ∷ p , Pp') = ¬Pp' (_ , Pp')
-- If a decidable predicate P over a finite set is sometimes false,
-- then we can find the smallest value for which this is the case.
¬∀⟶∃¬-smallest :
∀ n (P : Pred (Fin n)) → (∀ i → Dec (P i)) →
¬ (∀ i → P i) → ∃ λ i → ¬ P i × ((j : Fin′ i) → P (inject j))
¬∀⟶∃¬-smallest zero P dec ¬∀iPi = ⊥-elim (¬∀iPi (λ()))
¬∀⟶∃¬-smallest (suc n) P dec ¬∀iPi with dec zero
¬∀⟶∃¬-smallest (suc n) P dec ¬∀iPi | no ¬P0 = (zero , ¬P0 , λ ())
¬∀⟶∃¬-smallest (suc n) P dec ¬∀iPi | yes P0 =
Prod.map suc (Prod.map id extend′) $
¬∀⟶∃¬-smallest n (λ n → P (suc n)) (dec ∘ suc) (¬∀iPi ∘ extend)
where
extend : (∀ i → P (suc i)) → (∀ i → P i)
extend ∀iP[1+i] zero = P0
extend ∀iP[1+i] (suc i) = ∀iP[1+i] i
extend′ : ∀ {i : Fin n} →
((j : Fin′ i) → P (suc (inject j))) →
((j : Fin′ (suc i)) → P (inject j))
extend′ g zero = P0
extend′ g (suc j) = g j
| 33.078431
| 72
| 0.447935
|
21416802f97d42f092e6f877fc67ea78d96c19af
| 600
|
agda
|
Agda
|
src/Dodo/Unary/Unique.agda
|
sourcedennis/agda-dodo
|
376f0ccee1e1aa31470890e494bcb534324f598a
|
[
"BSD-3-Clause"
] | null | null | null |
src/Dodo/Unary/Unique.agda
|
sourcedennis/agda-dodo
|
376f0ccee1e1aa31470890e494bcb534324f598a
|
[
"BSD-3-Clause"
] | null | null | null |
src/Dodo/Unary/Unique.agda
|
sourcedennis/agda-dodo
|
376f0ccee1e1aa31470890e494bcb534324f598a
|
[
"BSD-3-Clause"
] | null | null | null |
{-# OPTIONS --without-K --safe #-}
module Dodo.Unary.Unique where
-- Stdlib imports
open import Level using (Level)
open import Relation.Unary using (Pred)
open import Relation.Binary using (Rel)
-- Local imports
open import Dodo.Nullary.Unique
-- # Definitions #
-- | At most one element satisfies the predicate
Unique₁ : ∀ {a ℓ₁ ℓ₂ : Level} {A : Set a}
→ Rel A ℓ₁ → Pred A ℓ₂ → Set _
Unique₁ _≈_ P = ∀ {x y} → P x → P y → x ≈ y
-- | For every `x`, there exists at most one inhabitant of `P x`.
UniquePred : ∀ {a ℓ : Level} {A : Set a}
→ Pred A ℓ → Set _
UniquePred P = ∀ x → Unique (P x)
| 25
| 65
| 0.643333
|
1198c5b1ba1cee854f6c36f3c35416b9bf5d68dd
| 589
|
agda
|
Agda
|
Utils/Monoid.agda
|
AndrasKovacs/SemanticsWithApplications
|
05200d60b4a4b2c6fa37806ced9247055d24db94
|
[
"MIT"
] | 8
|
2016-09-12T04:25:39.000Z
|
2020-02-02T10:01:52.000Z
|
Utils/Monoid.agda
|
AndrasKovacs/SemanticsWithApplications
|
05200d60b4a4b2c6fa37806ced9247055d24db94
|
[
"MIT"
] | null | null | null |
Utils/Monoid.agda
|
AndrasKovacs/SemanticsWithApplications
|
05200d60b4a4b2c6fa37806ced9247055d24db94
|
[
"MIT"
] | null | null | null |
-- Ad-hoc monoid typeclass module
module Utils.Monoid where
open import Data.List
open import Data.String
record Monoid {α}(A : Set α) : Set α where
constructor rec
field
append : A → A → A
identity : A
infixr 5 _<>_
_<>_ : ∀ {α}{A : Set α} ⦃ _ : Monoid A ⦄ → A → A → A
_<>_ ⦃ dict ⦄ a b = Monoid.append dict a b
mempty : ∀ {α}{A : Set α} ⦃ _ : Monoid A ⦄ → A
mempty ⦃ dict ⦄ = Monoid.identity dict
instance
MonoidList : ∀ {α A} → Monoid {α} (List A)
MonoidList = rec Data.List._++_ []
MonoidString : Monoid String
MonoidString = rec Data.String._++_ ""
| 20.310345
| 52
| 0.609508
|
36fc57850ccf0cc58409240cbb15e384ab07ad73
| 1,686
|
agda
|
Agda
|
src/Bisimilarity/Equational-reasoning-instances.agda
|
nad/up-to
|
b936ff85411baf3401ad85ce85d5ff2e9aa0ca14
|
[
"MIT"
] | null | null | null |
src/Bisimilarity/Equational-reasoning-instances.agda
|
nad/up-to
|
b936ff85411baf3401ad85ce85d5ff2e9aa0ca14
|
[
"MIT"
] | null | null | null |
src/Bisimilarity/Equational-reasoning-instances.agda
|
nad/up-to
|
b936ff85411baf3401ad85ce85d5ff2e9aa0ca14
|
[
"MIT"
] | null | null | null |
------------------------------------------------------------------------
-- "Equational" reasoning combinator setup
------------------------------------------------------------------------
{-# OPTIONS --sized-types #-}
open import Prelude.Size
open import Labelled-transition-system
module Bisimilarity.Equational-reasoning-instances
{ℓ} {lts : LTS ℓ} {i : Size} where
open import Prelude
open import Bisimilarity lts
open import Equational-reasoning
instance
reflexive∼ : Reflexive [ i ]_∼_
reflexive∼ = is-reflexive reflexive-∼
reflexive∼′ : Reflexive [ i ]_∼′_
reflexive∼′ = is-reflexive reflexive-∼′
symmetric∼ : Symmetric [ i ]_∼_
symmetric∼ = is-symmetric symmetric-∼
symmetric∼′ : Symmetric [ i ]_∼′_
symmetric∼′ = is-symmetric symmetric-∼′
trans∼∼ : Transitive [ i ]_∼_ [ i ]_∼_
trans∼∼ = is-transitive transitive-∼
trans∼′∼ : Transitive _∼′_ [ i ]_∼_
trans∼′∼ = is-transitive λ p∼′q → transitive (force p∼′q)
trans∼′∼′ : Transitive [ i ]_∼′_ [ i ]_∼′_
trans∼′∼′ = is-transitive transitive-∼′
trans∼∼′ : Transitive [ i ]_∼_ [ i ]_∼′_
trans∼∼′ = is-transitive lemma
where
lemma : ∀ {p q r} → [ i ] p ∼ q → [ i ] q ∼′ r → [ i ] p ∼′ r
force (lemma p∼q q∼′r) = transitive-∼ p∼q (force q∼′r)
convert∼∼ : Convertible [ i ]_∼_ [ i ]_∼_
convert∼∼ = is-convertible id
convert∼′∼ : Convertible _∼′_ [ i ]_∼_
convert∼′∼ = is-convertible λ p∼′q → force p∼′q
convert∼∼′ : Convertible [ i ]_∼_ [ i ]_∼′_
convert∼∼′ = is-convertible lemma
where
lemma : ∀ {p q} → [ i ] p ∼ q → [ i ] p ∼′ q
force (lemma p∼q) = p∼q
convert∼′∼′ : Convertible [ i ]_∼′_ [ i ]_∼′_
convert∼′∼′ = is-convertible id
| 27.193548
| 72
| 0.549229
|
19b37df11c2a09096145088644e54b7e353e07b0
| 200
|
agda
|
Agda
|
Cubical/HITs/TypeQuotients.agda
|
Edlyr/cubical
|
5de11df25b79ee49d5c084fbbe6dfc66e4147a2e
|
[
"MIT"
] | null | null | null |
Cubical/HITs/TypeQuotients.agda
|
Edlyr/cubical
|
5de11df25b79ee49d5c084fbbe6dfc66e4147a2e
|
[
"MIT"
] | null | null | null |
Cubical/HITs/TypeQuotients.agda
|
Edlyr/cubical
|
5de11df25b79ee49d5c084fbbe6dfc66e4147a2e
|
[
"MIT"
] | null | null | null |
{-# OPTIONS --cubical --no-import-sorts --safe #-}
module Cubical.HITs.TypeQuotients where
open import Cubical.HITs.TypeQuotients.Base public
open import Cubical.HITs.TypeQuotients.Properties public
| 33.333333
| 56
| 0.8
|
d1860b77087e5a7c0887b820d2c05d925633a6ca
| 2,013
|
agda
|
Agda
|
JamesContractibility.agda
|
guillaumebrunerie/JamesConstruction
|
89fbc29473d2d1ed1a45c3c0e56288cdcf77050b
|
[
"MIT"
] | 5
|
2016-12-07T04:34:52.000Z
|
2018-11-16T22:10:16.000Z
|
JamesContractibility.agda
|
guillaumebrunerie/JamesConstruction
|
89fbc29473d2d1ed1a45c3c0e56288cdcf77050b
|
[
"MIT"
] | null | null | null |
JamesContractibility.agda
|
guillaumebrunerie/JamesConstruction
|
89fbc29473d2d1ed1a45c3c0e56288cdcf77050b
|
[
"MIT"
] | null | null | null |
{-# OPTIONS --without-K --rewriting #-}
open import PathInduction
open import Pushout
module JamesContractibility {i} (A : Type i) (⋆A : A) where
open import JamesTwoMaps A ⋆A public
-- We do not prove the flattening lemma here, we only prove that the following pushout is contractible
T : Type i
T = Pushout (span JA JA (A × JA) snd (uncurry αJ))
⋆T : T
⋆T = inl εJ
T-contr-inl-ε : inl εJ == ⋆T
T-contr-inl-ε = idp
T-contr-inl-α : (a : A) (x : JA) → inl x == ⋆T → inl (αJ a x) == ⋆T
T-contr-inl-α a x y = push (⋆A , αJ a x) ∙ ! (ap inr (δJ (αJ a x))) ∙ ! (push (a , x)) ∙ y
T-contr-inl-δ : (x : JA) (y : inl x == ⋆T) → Square (ap inl (δJ x)) y (T-contr-inl-α ⋆A x y) idp
T-contr-inl-δ x y = & coh (ap-square inr (& cη (ηJ x))) (natural-square (λ z → push (⋆A , z)) (δJ x) idp (ap-∘ inr (αJ ⋆A) (δJ x))) where
coh : Coh ({A : Type i} {a b : A} {p : a == b} {c : A} {q q' : c == b} (q= : Square q q' idp idp)
{d : A} {r : d == c} {e : A} {s : d == e} {t : d == a} (sq : Square r t q p)
→ Square t s (p ∙ ! q' ∙ ! r ∙ s) idp)
coh = path-induction
cη : Coh ({A : Type i} {a b : A} {p : a == b} {c : A} {q : a == c} {r : b == c} (ηJ : ! p ∙ q == r) → Square p q r idp)
cη = path-induction
T-contr-inl : (x : JA) → inl x == ⋆T
T-contr-inl = JA-elim T-contr-inl-ε T-contr-inl-α (λ x y → ↓-='-from-square idp (ap-cst ⋆T (δJ x)) (square-symmetry (T-contr-inl-δ x y)))
T-contr-inr : (x : JA) → inr x == ⋆T
T-contr-inr x = ap inr (δJ x) ∙ ! (push (⋆A , x)) ∙ T-contr-inl x
T-contr-push : (a : A) (x : JA) → Square (T-contr-inl x) (push (a , x)) idp (T-contr-inr (αJ a x))
T-contr-push a x = & coh where
coh : Coh ({A : Type i} {a b : A} {r : a == b} {c : A} {p : c == b} {d : A} {q : d == c} {e : A} {y : d == e}
→ Square y q idp (p ∙ ! r ∙ (r ∙ ! p ∙ ! q ∙ y)))
coh = path-induction
T-contr : (x : T) → x == ⋆T
T-contr = Pushout-elim T-contr-inl T-contr-inr (λ {(a , x) → ↓-='-from-square (ap-idf (push (a , x))) (ap-cst ⋆T (push (a , x))) (T-contr-push a x)})
| 40.26
| 149
| 0.506706
|
adeac7d48649b135372e2ff56bc0dc682884b4ac
| 1,298
|
agda
|
Agda
|
src/Categories/Category/Monoidal/Instance/Cats.agda
|
yourboynico/agda-categories
|
6a087c592dbe58fc4bd9d02e1be9b94a9e138aca
|
[
"MIT"
] | 279
|
2019-06-01T14:36:40.000Z
|
2022-03-22T00:40:14.000Z
|
src/Categories/Category/Monoidal/Instance/Cats.agda
|
seanpm2001/agda-categories
|
d9e4f578b126313058d105c61707d8c8ae987fa8
|
[
"MIT"
] | 236
|
2019-06-01T14:53:54.000Z
|
2022-03-28T14:31:43.000Z
|
src/Categories/Category/Monoidal/Instance/Cats.agda
|
seanpm2001/agda-categories
|
d9e4f578b126313058d105c61707d8c8ae987fa8
|
[
"MIT"
] | 64
|
2019-06-02T16:58:15.000Z
|
2022-03-14T02:00:59.000Z
|
{-# OPTIONS --without-K --safe #-}
-- The category of Cats is Monoidal
module Categories.Category.Monoidal.Instance.Cats where
open import Level
open import Categories.Category.BinaryProducts using (BinaryProducts)
open import Categories.Category.Cartesian using (Cartesian)
open import Categories.Category.Cartesian.Monoidal using (module CartesianMonoidal)
open import Categories.Category.Instance.Cats using (Cats)
open import Categories.Category.Instance.One using (One-⊤)
open import Categories.Category.Monoidal using (Monoidal)
open import Categories.Category.Product using (Product; πˡ; πʳ; _※_)
open import Categories.Category.Product.Properties using (project₁; project₂; unique)
-- Cats is a Monoidal Category with Product as Bifunctor
module Product {o ℓ e : Level} where
private
C = Cats o ℓ e
Cats-has-all : BinaryProducts C
Cats-has-all = record { product = λ {A} {B} → record
{ A×B = Product A B
; π₁ = πˡ
; π₂ = πʳ
; ⟨_,_⟩ = _※_
; project₁ = λ {_} {h} {i} → project₁ {i = h} {j = i}
; project₂ = λ {_} {h} {i} → project₂ {i = h} {j = i}
; unique = unique
} }
Cats-is : Cartesian C
Cats-is = record { terminal = One-⊤ ; products = Cats-has-all }
Cats-Monoidal : Monoidal C
Cats-Monoidal = CartesianMonoidal.monoidal Cats-is
| 33.282051
| 85
| 0.702619
|
ede41404e31a6adad20409ece6505b20e297dd07
| 2,994
|
agda
|
Agda
|
src/Relation/Binary/Construct/Closure/SymmetricTransitive.agda
|
MirceaS/agda-categories
|
58e5ec015781be5413bdf968f7ec4fdae0ab4b21
|
[
"MIT"
] | null | null | null |
src/Relation/Binary/Construct/Closure/SymmetricTransitive.agda
|
MirceaS/agda-categories
|
58e5ec015781be5413bdf968f7ec4fdae0ab4b21
|
[
"MIT"
] | null | null | null |
src/Relation/Binary/Construct/Closure/SymmetricTransitive.agda
|
MirceaS/agda-categories
|
58e5ec015781be5413bdf968f7ec4fdae0ab4b21
|
[
"MIT"
] | null | null | null |
{-# OPTIONS --without-K --safe #-}
module Relation.Binary.Construct.Closure.SymmetricTransitive where
open import Level
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-synax back-syntax
infixr 2 forth⁺-syntax back⁺-syntax
forth-synax : ∀ x y → x ≤ y → Plus⇔ _≤_ x y
forth-synax _ _ = forth
syntax forth-synax 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) (inj : _≤_ =[ f ]⇒ _≼_) where
map : ∀ {x y} → Plus⇔ _≤_ x y → Plus⇔ _≼_ (f x) (f y)
map (forth r) = forth (inj r)
map (back r) = back (inj r)
map (forth⁺ r rel) = forth⁺ (inj r) (map rel)
map (back⁺ r rel) = back⁺ (inj r) (map rel)
| 27.218182
| 83
| 0.542418
|
73462b03187cbf1b42f6df6187412e515c05c67a
| 579
|
agda
|
Agda
|
agda-stdlib/src/Data/Vec/Relation/Pointwise/Inductive.agda
|
DreamLinuxer/popl21-artifact
|
fb380f2e67dcb4a94f353dbaec91624fcb5b8933
|
[
"MIT"
] | 5
|
2020-10-07T12:07:53.000Z
|
2020-10-10T21:41:32.000Z
|
agda-stdlib/src/Data/Vec/Relation/Pointwise/Inductive.agda
|
DreamLinuxer/popl21-artifact
|
fb380f2e67dcb4a94f353dbaec91624fcb5b8933
|
[
"MIT"
] | null | null | null |
agda-stdlib/src/Data/Vec/Relation/Pointwise/Inductive.agda
|
DreamLinuxer/popl21-artifact
|
fb380f2e67dcb4a94f353dbaec91624fcb5b8933
|
[
"MIT"
] | 1
|
2021-11-04T06:54:45.000Z
|
2021-11-04T06:54:45.000Z
|
------------------------------------------------------------------------
-- The Agda standard library
--
-- This module is DEPRECATED. Please use
-- Data.Vec.Relation.Binary.Pointwise.Inductive directly.
------------------------------------------------------------------------
{-# OPTIONS --without-K --safe #-}
module Data.Vec.Relation.Pointwise.Inductive where
open import Data.Vec.Relation.Binary.Pointwise.Inductive public
{-# WARNING_ON_IMPORT
"Data.Vec.Relation.Pointwise.Inductive was deprecated in v1.0.
Use Data.Vec.Relation.Binary.Pointwise.Inductive instead."
#-}
| 32.166667
| 72
| 0.578584
|
64e2bfd3d64965fe328aba7f8adb681ea4d68bb4
| 3,644
|
agda
|
Agda
|
examples/ISWIM.agda
|
mdimjasevic/agda
|
8fb548356b275c7a1e79b768b64511ae937c738b
|
[
"BSD-3-Clause"
] | 1,989
|
2015-01-09T23:51:16.000Z
|
2022-03-30T18:20:48.000Z
|
examples/ISWIM.agda
|
Seanpm2001-languages/agda
|
9911f73061e21a87fad76c662463257afe02c861
|
[
"BSD-2-Clause"
] | 4,066
|
2015-01-10T11:24:51.000Z
|
2022-03-31T21:14:49.000Z
|
examples/ISWIM.agda
|
Seanpm2001-languages/agda
|
9911f73061e21a87fad76c662463257afe02c861
|
[
"BSD-2-Clause"
] | 371
|
2015-01-03T14:04:08.000Z
|
2022-03-30T19:00:30.000Z
|
-- A Typed version of a subset of Landin's ISWIM from "The Next 700 Programming
-- Languages"
module ISWIM where
data Nat : Set where
zero : Nat
suc : Nat -> Nat
_+_ : Nat -> Nat -> Nat
zero + m = m
suc n + m = suc (n + m)
{-# BUILTIN NATURAL Nat #-}
{-# BUILTIN NATPLUS _+_ #-}
data Bool : Set where
true : Bool
false : Bool
module Syntax where
infixl 100 _∙_
infixl 80 _WHERE_ _PP_
infixr 60 _─→_
infixl 40 _,_
data Type : Set where
nat : Type
bool : Type
_─→_ : Type -> Type -> Type
data Context : Set where
ε : Context
_,_ : Context -> Type -> Context
data Var : Context -> Type -> Set where
vz : {Γ : Context}{τ : Type} -> Var (Γ , τ) τ
vs : {Γ : Context}{σ τ : Type} -> Var Γ τ -> Var (Γ , σ) τ
data Expr (Γ : Context) : Type -> Set where
var : {τ : Type} -> Var Γ τ -> Expr Γ τ
litNat : Nat -> Expr Γ nat
litBool : Bool -> Expr Γ bool
plus : Expr Γ (nat ─→ nat ─→ nat)
if : {τ : Type} -> Expr Γ (bool ─→ τ ─→ τ ─→ τ)
_∙_ : {σ τ : Type} -> Expr Γ (σ ─→ τ) -> Expr Γ σ -> Expr Γ τ
_WHERE_ : {σ τ ρ : Type} -> Expr (Γ , σ ─→ τ) ρ -> Expr (Γ , σ) τ -> Expr Γ ρ
_PP_ : {σ τ ρ : Type} -> Expr (Γ , σ ─→ τ) ρ -> Expr (Γ , σ) ρ -> Expr Γ ρ
-- ƛ x. e = f where f x = e
ƛ : {Γ : Context}{σ τ : Type} -> Expr (Γ , σ) τ -> Expr Γ (σ ─→ τ)
ƛ e = var vz WHERE e
module Cont (R : Set) where
C : Set -> Set
C a = (a -> R) -> R
callcc : {a : Set} -> (({b : Set} -> a -> C b) -> C a) -> C a
callcc {a} g = \k -> g (\x _ -> k x) k
return : {a : Set} -> a -> C a
return x = \k -> k x
infixr 10 _>>=_
_>>=_ : {a b : Set} -> C a -> (a -> C b) -> C b
(m >>= k) ret = m \x -> k x ret
module Semantics (R : Set) where
open module C = Cont R
open Syntax
infix 60 _!_
infixl 40 _||_
⟦_⟧type : Type -> Set
⟦_⟧type' : Type -> Set
⟦ nat ⟧type' = Nat
⟦ bool ⟧type' = Bool
⟦ σ ─→ τ ⟧type' = ⟦ σ ⟧type' -> ⟦ τ ⟧type
⟦ τ ⟧type = C ⟦ τ ⟧type'
data ⟦_⟧ctx : Context -> Set where
★ : ⟦ ε ⟧ctx
_||_ : {Γ : Context}{τ : Type} -> ⟦ Γ ⟧ctx -> ⟦ τ ⟧type' -> ⟦ Γ , τ ⟧ctx
_!_ : {Γ : Context}{τ : Type} -> ⟦ Γ ⟧ctx -> Var Γ τ -> ⟦ τ ⟧type'
★ ! ()
(ρ || v) ! vz = v
(ρ || v) ! vs x = ρ ! x
⟦_⟧ : {Γ : Context}{τ : Type} -> Expr Γ τ -> ⟦ Γ ⟧ctx -> ⟦ τ ⟧type
⟦ var x ⟧ ρ = return (ρ ! x)
⟦ litNat n ⟧ ρ = return n
⟦ litBool b ⟧ ρ = return b
⟦ plus ⟧ ρ = return \n -> return \m -> return (n + m)
⟦ f ∙ e ⟧ ρ = ⟦ e ⟧ ρ >>= \v ->
⟦ f ⟧ ρ >>= \w ->
w v
⟦ e WHERE f ⟧ ρ = ⟦ e ⟧ (ρ || (\x -> ⟦ f ⟧ (ρ || x)))
⟦ e PP f ⟧ ρ = callcc \k ->
let throw = \x -> ⟦ f ⟧ (ρ || x) >>= k
in ⟦ e ⟧ (ρ || throw)
⟦ if ⟧ ρ = return \x -> return \y -> return \z -> return (iff x y z)
where
iff : {A : Set} -> Bool -> A -> A -> A
iff true x y = x
iff false x y = y
module Test where
open Syntax
open module C = Cont Nat
open module S = Semantics Nat
run : Expr ε nat -> Nat
run e = ⟦ e ⟧ ★ \x -> x
-- 1 + 1
two : Expr ε nat
two = plus ∙ litNat 1 ∙ litNat 1
-- f 1 + f 2 where f x = x
three : Expr ε nat
three = plus ∙ (var vz ∙ litNat 1) ∙ (var vz ∙ litNat 2) WHERE var vz
-- 1 + f 1 where pp f x = x
one : Expr ε nat
one = plus ∙ litNat 1 ∙ (var vz ∙ litNat 1) PP var vz
open Test
data _==_ {a : Set}(x : a) : a -> Set where
refl : x == x
twoOK : run two == 2
twoOK = refl
threeOK : run three == 3
threeOK = refl
oneOK : run one == 1
oneOK = refl
open Cont
open Syntax
open Semantics
| 23.509677
| 81
| 0.464599
|
657edd55bfd3cea96c0074a89859b160c8aaf47c
| 3,768
|
agda
|
Agda
|
src/Container/List.agda
|
L-TChen/agda-prelude
|
158d299b1b365e186f00d8ef5b8c6844235ee267
|
[
"MIT"
] | 111
|
2015-01-05T11:28:15.000Z
|
2022-02-12T23:29:26.000Z
|
src/Container/List.agda
|
L-TChen/agda-prelude
|
158d299b1b365e186f00d8ef5b8c6844235ee267
|
[
"MIT"
] | 59
|
2016-02-09T05:36:44.000Z
|
2022-01-14T07:32:36.000Z
|
src/Container/List.agda
|
L-TChen/agda-prelude
|
158d299b1b365e186f00d8ef5b8c6844235ee267
|
[
"MIT"
] | 24
|
2015-03-12T18:03:45.000Z
|
2021-04-22T06:10:41.000Z
|
module Container.List where
open import Prelude
infixr 5 _∷_
data All {a b} {A : Set a} (P : A → Set b) : List A → Set (a ⊔ b) where
[] : All P []
_∷_ : ∀ {x xs} (p : P x) (ps : All P xs) → All P (x ∷ xs)
data Any {a b} {A : Set a} (P : A → Set b) : List A → Set (a ⊔ b) where
zero : ∀ {x xs} (p : P x) → Any P (x ∷ xs)
suc : ∀ {x xs} (i : Any P xs) → Any P (x ∷ xs)
pattern zero! = zero refl
-- Literal overloading for Any
module _ {a b} {A : Set a} {P : A → Set b} where
private
AnyConstraint : List A → Nat → Set (a ⊔ b)
AnyConstraint [] _ = ⊥′
AnyConstraint (x ∷ _) zero = ⊤′ {a} × P x -- hack to line up levels
AnyConstraint (_ ∷ xs) (suc i) = AnyConstraint xs i
natToIx : ∀ (xs : List A) n → {{_ : AnyConstraint xs n}} → Any P xs
natToIx [] n {{}}
natToIx (x ∷ xs) zero {{_ , px}} = zero px
natToIx (x ∷ xs) (suc n) = suc (natToIx xs n)
instance
NumberAny : ∀ {xs} → Number (Any P xs)
Number.Constraint (NumberAny {xs}) = AnyConstraint xs
fromNat {{NumberAny {xs}}} = natToIx xs
infix 3 _∈_
_∈_ : ∀ {a} {A : Set a} → A → List A → Set a
x ∈ xs = Any (_≡_ x) xs
forgetAny : ∀ {a p} {A : Set a} {P : A → Set p} {xs : List A} → Any P xs → Nat
forgetAny (zero _) = zero
forgetAny (suc i) = suc (forgetAny i)
lookupAny : ∀ {a b} {A : Set a} {P Q : A → Set b} {xs} → All P xs → Any Q xs → Σ A (λ x → P x × Q x)
lookupAny (p ∷ ps) (zero q) = _ , p , q
lookupAny (p ∷ ps) (suc i) = lookupAny ps i
lookup∈ : ∀ {a b} {A : Set a} {P : A → Set b} {xs x} → All P xs → x ∈ xs → P x
lookup∈ (p ∷ ps) (zero refl) = p
lookup∈ (p ∷ ps) (suc i) = lookup∈ ps i
module _ {a b} {A : Set a} {P Q : A → Set b} (f : ∀ {x} → P x → Q x) where
mapAll : ∀ {xs} → All P xs → All Q xs
mapAll [] = []
mapAll (x ∷ xs) = f x ∷ mapAll xs
mapAny : ∀ {xs} → Any P xs → Any Q xs
mapAny (zero x) = zero (f x)
mapAny (suc i) = suc (mapAny i)
traverseAll : ∀ {a b} {A : Set a} {B : A → Set a} {F : Set a → Set b}
{{AppF : Applicative F}} →
(∀ x → F (B x)) → (xs : List A) → F (All B xs)
traverseAll f [] = pure []
traverseAll f (x ∷ xs) = ⦇ f x ∷ traverseAll f xs ⦈
module _ {a b} {A : Set a} {P : A → Set b} where
-- Append
infixr 5 _++All_
_++All_ : ∀ {xs ys} → All P xs → All P ys → All P (xs ++ ys)
[] ++All qs = qs
(p ∷ ps) ++All qs = p ∷ ps ++All qs
-- Delete
deleteIx : ∀ xs → Any P xs → List A
deleteIx (_ ∷ xs) (zero _) = xs
deleteIx (x ∷ xs) (suc i) = x ∷ deleteIx xs i
deleteAllIx : ∀ {c} {Q : A → Set c} {xs} → All Q xs → (i : Any P xs) → All Q (deleteIx xs i)
deleteAllIx (q ∷ qs) (zero _) = qs
deleteAllIx (q ∷ qs) (suc i) = q ∷ deleteAllIx qs i
-- Equality --
module _ {a b} {A : Set a} {P : A → Set b} {{EqP : ∀ {x} → Eq (P x)}} where
private
z : ∀ {x xs} → P x → Any P (x ∷ xs)
z = zero
zero-inj : ∀ {x} {xs : List A} {p q : P x} → Any.zero {xs = xs} p ≡ z q → p ≡ q
zero-inj refl = refl
sucAny-inj : ∀ {x xs} {i j : Any P xs} → Any.suc {x = x} i ≡ Any.suc {x = x} j → i ≡ j
sucAny-inj refl = refl
cons-inj₁ : ∀ {x xs} {p q : P x} {ps qs : All P xs} → p All.∷ ps ≡ q ∷ qs → p ≡ q
cons-inj₁ refl = refl
cons-inj₂ : ∀ {x xs} {p q : P x} {ps qs : All P xs} → p All.∷ ps ≡ q ∷ qs → ps ≡ qs
cons-inj₂ refl = refl
instance
EqAny : ∀ {xs} → Eq (Any P xs)
_==_ {{EqAny}} (zero p) (zero q) = decEq₁ zero-inj (p == q)
_==_ {{EqAny}} (suc i) (suc j) = decEq₁ sucAny-inj (i == j)
_==_ {{EqAny}} (zero _) (suc _) = no λ ()
_==_ {{EqAny}} (suc _) (zero _) = no λ ()
EqAll : ∀ {xs} → Eq (All P xs)
_==_ {{EqAll}} [] [] = yes refl
_==_ {{EqAll}} (x ∷ xs) (y ∷ ys) = decEq₂ cons-inj₁ cons-inj₂ (x == y) (xs == ys)
| 32.765217
| 100
| 0.49018
|
3f162ffdc2a81b89598f01c88a059eab5a64870f
| 994
|
agda
|
Agda
|
test/asset/agda-stdlib-1.0/Data/Table/Relation/Binary/Equality.agda
|
omega12345/agda-mode
|
0debb886eb5dbcd38dbeebd04b34cf9d9c5e0e71
|
[
"MIT"
] | null | null | null |
test/asset/agda-stdlib-1.0/Data/Table/Relation/Binary/Equality.agda
|
omega12345/agda-mode
|
0debb886eb5dbcd38dbeebd04b34cf9d9c5e0e71
|
[
"MIT"
] | null | null | null |
test/asset/agda-stdlib-1.0/Data/Table/Relation/Binary/Equality.agda
|
omega12345/agda-mode
|
0debb886eb5dbcd38dbeebd04b34cf9d9c5e0e71
|
[
"MIT"
] | null | null | null |
------------------------------------------------------------------------
-- The Agda standard library
--
-- Pointwise table equality
------------------------------------------------------------------------
{-# OPTIONS --without-K --safe #-}
module Data.Table.Relation.Binary.Equality where
open import Relation.Binary using (Setoid)
open import Data.Table.Base
open import Data.Nat using (ℕ)
open import Function using (_∘_)
open import Relation.Binary.PropositionalEquality
as P using (_≡_; _→-setoid_)
setoid : ∀ {c p} → Setoid c p → ℕ → Setoid _ _
setoid S n = record
{ Carrier = Table Carrier n
; _≈_ = λ t t′ → ∀ i → lookup t i ≈ lookup t′ i
; isEquivalence = record
{ refl = λ i → refl
; sym = λ p → sym ∘ p
; trans = λ p q i → trans (p i) (q i)
}
}
where open Setoid S
≡-setoid : ∀ {a} → Set a → ℕ → Setoid _ _
≡-setoid A = setoid (P.setoid A)
module _ {a} {A : Set a} {n} where
open Setoid (≡-setoid A n) public
using () renaming (_≈_ to _≗_)
| 27.611111
| 72
| 0.533199
|
5ed40cc0c6fe4192ec6e78cf7eb48672f235aa57
| 2,520
|
agda
|
Agda
|
Cubical/Foundations/Pointed/Base.agda
|
hyleIndex/cubical
|
ce5c2820ecb2e0fd8dce74fb0247856cdbf034c4
|
[
"MIT"
] | 301
|
2018-10-17T18:00:24.000Z
|
2022-03-24T02:10:47.000Z
|
Cubical/Foundations/Pointed/Base.agda
|
hyleIndex/cubical
|
ce5c2820ecb2e0fd8dce74fb0247856cdbf034c4
|
[
"MIT"
] | 584
|
2018-10-15T09:49:02.000Z
|
2022-03-30T12:09:17.000Z
|
Cubical/Foundations/Pointed/Base.agda
|
hyleIndex/cubical
|
ce5c2820ecb2e0fd8dce74fb0247856cdbf034c4
|
[
"MIT"
] | 134
|
2018-11-16T06:11:03.000Z
|
2022-03-23T16:22:13.000Z
|
{-# OPTIONS --safe #-}
module Cubical.Foundations.Pointed.Base where
open import Cubical.Foundations.Prelude
open import Cubical.Foundations.Equiv
open import Cubical.Foundations.Structure
open import Cubical.Foundations.Structure using (typ) public
open import Cubical.Foundations.GroupoidLaws
open import Cubical.Foundations.Isomorphism
open import Cubical.Foundations.Univalence
Pointed : (ℓ : Level) → Type (ℓ-suc ℓ)
Pointed ℓ = TypeWithStr ℓ (λ x → x)
pt : ∀ {ℓ} (A∙ : Pointed ℓ) → typ A∙
pt = str
Pointed₀ = Pointed ℓ-zero
{- Pointed functions -}
_→∙_ : ∀{ℓ ℓ'} → (A : Pointed ℓ) (B : Pointed ℓ') → Type (ℓ-max ℓ ℓ')
(A , a) →∙ (B , b) = Σ[ f ∈ (A → B) ] f a ≡ b
_→∙_∙ : ∀{ℓ ℓ'} → (A : Pointed ℓ) (B : Pointed ℓ') → Pointed (ℓ-max ℓ ℓ')
(A →∙ B ∙) .fst = A →∙ B
(A →∙ B ∙) .snd .fst x = pt B
(A →∙ B ∙) .snd .snd = refl
idfun∙ : ∀ {ℓ} (A : Pointed ℓ) → A →∙ A
idfun∙ A .fst x = x
idfun∙ A .snd = refl
ua∙ : ∀ {ℓ} {A B : Pointed ℓ} (e : fst A ≃ fst B)
→ fst e (snd A) ≡ snd B → A ≡ B
fst (ua∙ e p i) = ua e i
snd (ua∙ {A = A} e p i) = ua-gluePath e p i
{- HIT allowing for pattern matching on pointed types -}
data Pointer {ℓ} (A : Pointed ℓ) : Type ℓ where
pt₀ : Pointer A
⌊_⌋ : typ A → Pointer A
id : ⌊ pt A ⌋ ≡ pt₀
IsoPointedPointer : ∀ {ℓ} {A : Pointed ℓ} → Iso (typ A) (Pointer A)
Iso.fun IsoPointedPointer = ⌊_⌋
Iso.inv (IsoPointedPointer {A = A}) pt₀ = pt A
Iso.inv IsoPointedPointer ⌊ x ⌋ = x
Iso.inv (IsoPointedPointer {A = A}) (id i) = pt A
Iso.rightInv IsoPointedPointer pt₀ = id
Iso.rightInv IsoPointedPointer ⌊ x ⌋ = refl
Iso.rightInv IsoPointedPointer (id i) j = id (i ∧ j)
Iso.leftInv IsoPointedPointer x = refl
Pointed≡Pointer : ∀ {ℓ} {A : Pointed ℓ} → typ A ≡ Pointer A
Pointed≡Pointer = isoToPath IsoPointedPointer
Pointer∙ : ∀ {ℓ} (A : Pointed ℓ) → Pointed ℓ
Pointer∙ A .fst = Pointer A
Pointer∙ A .snd = pt₀
Pointed≡∙Pointer : ∀ {ℓ} {A : Pointed ℓ} → A ≡ (Pointer A , pt₀)
Pointed≡∙Pointer {A = A} i = (Pointed≡Pointer {A = A} i) , helper i
where
helper : PathP (λ i → Pointed≡Pointer {A = A} i) (pt A) pt₀
helper = ua-gluePath (isoToEquiv (IsoPointedPointer {A = A})) id
pointerFun : ∀ {ℓ ℓ'} {A : Pointed ℓ} {B : Pointed ℓ'} (f : A →∙ B)
→ Pointer A → Pointer B
pointerFun f pt₀ = pt₀
pointerFun f ⌊ x ⌋ = ⌊ fst f x ⌋
pointerFun f (id i) = (cong ⌊_⌋ (snd f) ∙ id) i
pointerFun∙ : ∀ {ℓ ℓ'} {A : Pointed ℓ} {B : Pointed ℓ'} (f : A →∙ B)
→ Pointer∙ A →∙ Pointer∙ B
pointerFun∙ f .fst = pointerFun f
pointerFun∙ f .snd = refl
| 32.307692
| 73
| 0.611111
|
fb1f0d29f01e70f4b5bf592ed117835230dd51ee
| 2,239
|
agda
|
Agda
|
agda-stdlib/src/Data/List/Relation/Binary/Permutation/Homogeneous.agda
|
DreamLinuxer/popl21-artifact
|
fb380f2e67dcb4a94f353dbaec91624fcb5b8933
|
[
"MIT"
] | 5
|
2020-10-07T12:07:53.000Z
|
2020-10-10T21:41:32.000Z
|
agda-stdlib/src/Data/List/Relation/Binary/Permutation/Homogeneous.agda
|
DreamLinuxer/popl21-artifact
|
fb380f2e67dcb4a94f353dbaec91624fcb5b8933
|
[
"MIT"
] | null | null | null |
agda-stdlib/src/Data/List/Relation/Binary/Permutation/Homogeneous.agda
|
DreamLinuxer/popl21-artifact
|
fb380f2e67dcb4a94f353dbaec91624fcb5b8933
|
[
"MIT"
] | 1
|
2021-11-04T06:54:45.000Z
|
2021-11-04T06:54:45.000Z
|
------------------------------------------------------------------------
-- The Agda standard library
--
-- A definition for the permutation relation using setoid equality
------------------------------------------------------------------------
{-# OPTIONS --without-K --safe #-}
module Data.List.Relation.Binary.Permutation.Homogeneous where
open import Data.List.Base using (List; _∷_)
open import Data.List.Relation.Binary.Pointwise as Pointwise
using (Pointwise)
open import Level using (Level; _⊔_)
open import Relation.Binary
private
variable
a r s : Level
A : Set a
data Permutation {A : Set a} (R : Rel A r) : Rel (List A) (a ⊔ r) where
refl : ∀ {xs ys} → Pointwise R xs ys → Permutation R xs ys
prep : ∀ {xs ys x y} (eq : R x y) → Permutation R xs ys → Permutation R (x ∷ xs) (y ∷ ys)
swap : ∀ {xs ys x y x' y'} (eq₁ : R x x') (eq₂ : R y y') → Permutation R xs ys → Permutation R (x ∷ y ∷ xs) (y' ∷ x' ∷ ys)
trans : ∀ {xs ys zs} → Permutation R xs ys → Permutation R ys zs → Permutation R xs zs
------------------------------------------------------------------------
-- The Permutation relation is an equivalence
module _ {R : Rel A r} where
sym : Symmetric R → Symmetric (Permutation R)
sym R-sym (refl xs∼ys) = refl (Pointwise.symmetric R-sym xs∼ys)
sym R-sym (prep x∼x' xs↭ys) = prep (R-sym x∼x') (sym R-sym xs↭ys)
sym R-sym (swap x∼x' y∼y' xs↭ys) = swap (R-sym y∼y') (R-sym x∼x') (sym R-sym xs↭ys)
sym R-sym (trans xs↭ys ys↭zs) = trans (sym R-sym ys↭zs) (sym R-sym xs↭ys)
isEquivalence : Reflexive R → Symmetric R → IsEquivalence (Permutation R)
isEquivalence R-refl R-sym = record
{ refl = refl (Pointwise.refl R-refl)
; sym = sym R-sym
; trans = trans
}
setoid : Reflexive R → Symmetric R → Setoid _ _
setoid R-refl R-sym = record
{ isEquivalence = isEquivalence R-refl R-sym
}
map : ∀ {R : Rel A r} {S : Rel A s} →
(R ⇒ S) → (Permutation R ⇒ Permutation S)
map R⇒S (refl xs∼ys) = refl (Pointwise.map R⇒S xs∼ys)
map R⇒S (prep e xs∼ys) = prep (R⇒S e) (map R⇒S xs∼ys)
map R⇒S (swap e₁ e₂ xs∼ys) = swap (R⇒S e₁) (R⇒S e₂) (map R⇒S xs∼ys)
map R⇒S (trans xs∼ys ys∼zs) = trans (map R⇒S xs∼ys) (map R⇒S ys∼zs)
| 39.280702
| 125
| 0.557392
|
3f7b5752591469cff8e4fbffeb045a91f9c78519
| 1,277
|
agda
|
Agda
|
theorems/cw/cohomology/TipAndAugment.agda
|
mikeshulman/HoTT-Agda
|
e7d663b63d89f380ab772ecb8d51c38c26952dbb
|
[
"MIT"
] | null | null | null |
theorems/cw/cohomology/TipAndAugment.agda
|
mikeshulman/HoTT-Agda
|
e7d663b63d89f380ab772ecb8d51c38c26952dbb
|
[
"MIT"
] | null | null | null |
theorems/cw/cohomology/TipAndAugment.agda
|
mikeshulman/HoTT-Agda
|
e7d663b63d89f380ab772ecb8d51c38c26952dbb
|
[
"MIT"
] | 1
|
2018-12-26T21:31:57.000Z
|
2018-12-26T21:31:57.000Z
|
{-# OPTIONS --without-K --rewriting #-}
open import HoTT
open import cohomology.Theory
open import cw.CW
module cw.cohomology.TipAndAugment {i} (OT : OrdinaryTheory i)
(⊙skel : ⊙Skeleton {i} 0) where
open OrdinaryTheory OT
open import homotopy.DisjointlyPointedSet
open import cohomology.DisjointlyPointedSet OT
module _ (m : ℤ) where
CX₀ : Group i
CX₀ = C m (⊙cw-head ⊙skel)
CX₀-is-abelian : is-abelian CX₀
CX₀-is-abelian = C-is-abelian m (⊙cw-head ⊙skel)
C2×CX₀ : Group i
C2×CX₀ = C2 m ×ᴳ CX₀
abstract
C2×CX₀-is-abelian : is-abelian C2×CX₀
C2×CX₀-is-abelian = ×ᴳ-is-abelian (C2 m) CX₀ (C2-is-abelian m) CX₀-is-abelian
C2×CX₀-abgroup : AbGroup i
C2×CX₀-abgroup = C2×CX₀ , C2×CX₀-is-abelian
CX₀-β : ⊙has-cells-with-choice 0 ⊙skel i
→ CX₀ ≃ᴳ Πᴳ (MinusPoint (⊙cw-head ⊙skel)) (λ _ → C2 m)
CX₀-β ac = C-set m (⊙cw-head ⊙skel) (snd (⊙Skeleton.skel ⊙skel)) (⊙Skeleton.pt-dec ⊙skel) ac
abstract
CX₀-≠-is-trivial : ∀ {m} (m≠0 : m ≠ 0)
→ ⊙has-cells-with-choice 0 ⊙skel i
→ is-trivialᴳ (CX₀ m)
CX₀-≠-is-trivial {m} m≠0 ac =
iso-preserves'-trivial (CX₀-β m ac) $
Πᴳ-is-trivial (MinusPoint (⊙cw-head ⊙skel))
(λ _ → C2 m) (λ _ → C-dimension m≠0)
cw-coε : C2 0 →ᴳ C2×CX₀ 0
cw-coε = ×ᴳ-inl {G = C2 0} {H = CX₀ 0}
| 27.170213
| 94
| 0.635865
|
5931adde7d83016d1b98ebba83cb4dbd1da6d7d1
| 2,389
|
agda
|
Agda
|
Lec8.agda
|
clarkdm/CS410
|
523a8749f49c914bcd28402116dcbe79a78dbbf4
|
[
"CC0-1.0"
] | null | null | null |
Lec8.agda
|
clarkdm/CS410
|
523a8749f49c914bcd28402116dcbe79a78dbbf4
|
[
"CC0-1.0"
] | null | null | null |
Lec8.agda
|
clarkdm/CS410
|
523a8749f49c914bcd28402116dcbe79a78dbbf4
|
[
"CC0-1.0"
] | null | null | null |
module Lec8 where
open import CS410-Prelude
open import CS410-Functor
open import CS410-Monoid
open import CS410-Nat
data Maybe (X : Set) : Set where
yes : X -> Maybe X
no : Maybe X
maybeFunctor : Functor Maybe
maybeFunctor = record
{ map = \ { f (yes x) -> yes (f x)
; f no -> no
}
; mapid = \ { (yes x) -> refl ; no -> refl }
; mapcomp = \ { f g (yes x) -> refl ; f g no -> refl } }
open Functor maybeFunctor
data List (X : Set) : Set where -- X scopes over the whole declaration...
[] : List X -- ...so you can use it here...
_::_ : X -> List X -> List X -- ...and here.
infixr 3 _::_
data Hutton : Set where
val : Nat -> Hutton
_+H_ : Hutton -> Hutton -> Hutton
hif_then_else_ : Hutton -> Hutton -> Hutton -> Hutton
fail : Hutton
maybeApplicative : Applicative Maybe
maybeApplicative = record
{ pure = yes
; _<*>_ = \ { no mx -> no
; (yes f) no -> no
; (yes f) (yes x) -> yes (f x)
}
; identity = \ {(yes x) -> refl ; no -> refl}
; composition = \
{ (yes f) (yes g) (yes x) -> refl
; (yes f) (yes g) no -> refl
; (yes x) no mx -> refl
; no mg mx -> refl
}
; homomorphism = \ f x -> refl
; interchange = \ { (yes f) y -> refl ; no y → refl }
}
open Applicative maybeApplicative public
cond : Nat -> Nat -> Nat -> Nat
cond zero t e = e
cond (suc c) t e = t
_>>=_ : forall {X Y} -> Maybe X -> (X -> Maybe Y) -> Maybe Y
yes x >>= x2my = x2my x
no >>= x2my = no
eval : Hutton -> Maybe Nat
eval (val x) = pure x
eval (h +H h') = pure _+N_ <*> eval h <*> eval h'
eval (hif c then t else e)
-- = pure cond <*> eval c <*> eval t <*> eval e -- oops
= eval c >>= \ { zero -> eval e
; (suc _) -> eval t}
eval fail = no
foo : Hutton
foo = hif val 1 then (val 2 +H val 3) else (hif val 0 then val 4 else val 6)
goo : Hutton
goo = hif val 1 then (val 2 +H val 3) else (hif val 0 then fail else val 6)
ap : forall {X Y} -> Maybe (X -> Y) -> Maybe X -> Maybe Y
ap mf mx = mf >>= \ f -> mx >>= \ x -> yes (f x)
| 30.628205
| 76
| 0.462955
|
368d67c6016e6f964cf2d58162826c8bf75df96e
| 15,166
|
agda
|
Agda
|
contexts.agda
|
hazelgrove/hazel-palette-agda
|
c3225acc3c94c56376c6842b82b8b5d76912df2a
|
[
"MIT"
] | 4
|
2020-10-04T06:45:06.000Z
|
2021-12-19T15:38:31.000Z
|
contexts.agda
|
hazelgrove/hazel-palette-agda
|
c3225acc3c94c56376c6842b82b8b5d76912df2a
|
[
"MIT"
] | 9
|
2020-09-30T20:27:56.000Z
|
2020-10-20T20:44:13.000Z
|
contexts.agda
|
hazelgrove/hazelnut-livelits-agda
|
c3225acc3c94c56376c6842b82b8b5d76912df2a
|
[
"MIT"
] | null | null | null |
open import Prelude
open import Nat
module contexts where
-- variables are named with naturals in ė. therefore we represent
-- contexts as functions from names for variables (nats) to possible
-- bindings.
_ctx : Set → Set
A ctx = Nat → Maybe A
-- convenient shorthand for the (unique up to fun. ext.) empty context
∅ : {A : Set} → A ctx
∅ _ = None
infixr 100 ■_
-- the domain of a context is those naturals which cuase it to emit some τ
dom : {A : Set} → A ctx → Nat → Set
dom {A} Γ x = Σ[ τ ∈ A ] (Γ x == Some τ)
-- membership, or presence, in a context
_∈_ : {A : Set} (p : Nat × A) → (Γ : A ctx) → Set
(x , y) ∈ Γ = (Γ x) == Some y
-- this packages up an appeal to context memebership into a form that
-- lets us retain more information
ctxindirect : {A : Set} (Γ : A ctx) (n : Nat) → Σ[ a ∈ A ] (Γ n == Some a) + Γ n == None
ctxindirect Γ n with Γ n
ctxindirect Γ n | Some x = Inl (x , refl)
ctxindirect Γ n | None = Inr refl
-- apartness for contexts
_#_ : {A : Set} (n : Nat) → (Γ : A ctx) → Set
x # Γ = (Γ x) == None
-- disjoint contexts are those which share no mappings
_##_ : {A : Set} → A ctx → A ctx → Set
_##_ {A} Γ Γ' = ((n : Nat) → dom Γ n → n # Γ') × ((n : Nat) → dom Γ' n → n # Γ)
-- contexts give at most one binding for each variable
ctxunicity : {A : Set} → {Γ : A ctx} {n : Nat} {t t' : A} →
(n , t) ∈ Γ →
(n , t') ∈ Γ →
t == t'
ctxunicity {n = n} p q with natEQ n n
ctxunicity p q | Inl refl = someinj (! p · q)
ctxunicity _ _ | Inr x≠x = abort (x≠x refl)
-- warning: this is union, but it assumes WITHOUT CHECKING that the
-- domains are disjoint. this is inherently asymmetric, and that's
-- reflected throughout the development that follows
_∪_ : {A : Set} → A ctx → A ctx → A ctx
(C1 ∪ C2) x with C1 x
(C1 ∪ C2) x | Some x₁ = Some x₁
(C1 ∪ C2) x | None = C2 x
-- the singleton context
■_ : {A : Set} → (Nat × A) → A ctx
(■ (x , a)) y with natEQ x y
(■ (x , a)) .x | Inl refl = Some a
... | Inr _ = None
-- context extension
_,,_ : {A : Set} → A ctx → (Nat × A) → A ctx
(Γ ,, (x , t)) = Γ ∪ (■ (x , t))
infixl 10 _,,_
-- used below in proof of ∪ commutativity and associativity
lem-dom-union1 : {A : Set} {C1 C2 : A ctx} {x : Nat} →
C1 ## C2 →
dom C1 x →
(C1 ∪ C2) x == C1 x
lem-dom-union1 {A} {C1} {C2} {x} (d1 , d2) D with C1 x
lem-dom-union1 (d1 , d2) D | Some x₁ = refl
lem-dom-union1 (d1 , d2) D | None = abort (somenotnone (! (π2 D)))
lem-dom-union2 : {A : Set} {C1 C2 : A ctx} {x : Nat} →
C1 ## C2 →
dom C1 x →
(C2 ∪ C1) x == C1 x
lem-dom-union2 {A} {C1} {C2} {x} (d1 , d2) D with ctxindirect C2 x
lem-dom-union2 {A} {C1} {C2} {x} (d1 , d2) D | Inl x₁ = abort (somenotnone (! (π2 x₁) · d1 x D ))
lem-dom-union2 {A} {C1} {C2} {x} (d1 , d2) D | Inr x₁ with C2 x
lem-dom-union2 (d1 , d2) D | Inr x₂ | Some x₁ = abort (somenotnone x₂)
lem-dom-union2 (d1 , d2) D | Inr x₁ | None = refl
-- if the contexts in question are disjoint, then union is commutative
∪comm : {A : Set} → (C1 C2 : A ctx) → C1 ## C2 → (C1 ∪ C2) == (C2 ∪ C1)
∪comm C1 C2 (d1 , d2)= funext guts
where
lem-apart-union1 : {A : Set} (C1 C2 : A ctx) (x : Nat) → x # C1 → x # C2 → x # (C1 ∪ C2)
lem-apart-union1 C1 C2 x apt1 apt2 with C1 x
lem-apart-union1 C1 C2 x apt1 apt2 | Some x₁ = abort (somenotnone apt1)
lem-apart-union1 C1 C2 x apt1 apt2 | None = apt2
lem-apart-union2 : {A : Set} (C1 C2 : A ctx) (x : Nat) → x # C1 → x # C2 → x # (C2 ∪ C1)
lem-apart-union2 C1 C2 x apt1 apt2 with C2 x
lem-apart-union2 C1 C2 x apt1 apt2 | Some x₁ = abort (somenotnone apt2)
lem-apart-union2 C1 C2 x apt1 apt2 | None = apt1
guts : (x : Nat) → (C1 ∪ C2) x == (C2 ∪ C1) x
guts x with ctxindirect C1 x | ctxindirect C2 x
guts x | Inl (π1 , π2) | Inl (π3 , π4) = abort (somenotnone (! π4 · d1 x (π1 , π2)))
guts x | Inl x₁ | Inr x₂ = tr (λ qq → qq == (C2 ∪ C1) x) (! (lem-dom-union1 (d1 , d2) x₁)) (tr (λ qq → C1 x == qq) (! (lem-dom-union2 (d1 , d2) x₁)) refl)
guts x | Inr x₁ | Inl x₂ = tr (λ qq → (C1 ∪ C2) x == qq) (! (lem-dom-union1 (d2 , d1) x₂)) (tr (λ qq → qq == C2 x) (! (lem-dom-union2 (d2 , d1) x₂)) refl)
guts x | Inr x₁ | Inr x₂ = tr (λ qq → qq == (C2 ∪ C1) x) (! (lem-apart-union1 C1 C2 x x₁ x₂)) (tr (λ qq → None == qq) (! (lem-apart-union2 C1 C2 x x₁ x₂)) refl)
-- an element in the left of a union is in the union
x∈∪l : {A : Set} → (Γ Γ' : A ctx) (n : Nat) (x : A) → (n , x) ∈ Γ → (n , x) ∈ (Γ ∪ Γ')
x∈∪l Γ Γ' n x xin with Γ n
x∈∪l Γ Γ' n x₁ xin | Some x = xin
x∈∪l Γ Γ' n x () | None
-- an element in the right of a union is in the union as long as the
-- contexts are disjoint; this asymmetry reflects the asymmetry in the
-- definition of union
x∈∪r : {A : Set} → (Γ Γ' : A ctx) (n : Nat) (x : A) →
(n , x) ∈ Γ' →
Γ' ## Γ →
(n , x) ∈ (Γ ∪ Γ')
x∈∪r Γ Γ' n x nx∈ disj = tr (λ qq → (n , x) ∈ qq) (∪comm _ _ disj) (x∈∪l Γ' Γ n x nx∈)
-- an element is in the context formed with just itself
x∈■ : {A : Set} (n : Nat) (a : A) → (n , a) ∈ (■ (n , a))
x∈■ n a with natEQ n n
x∈■ n a | Inl refl = refl
x∈■ n a | Inr x = abort (x refl)
-- if an index is in the domain of a singleton context, it's the only
-- index in the context
lem-dom-eq : {A : Set} {y : A} {n m : Nat} →
dom (■ (m , y)) n →
n == m
lem-dom-eq {n = n} {m = m} (π1 , π2) with natEQ m n
lem-dom-eq (π1 , π2) | Inl refl = refl
lem-dom-eq (π1 , π2) | Inr x = abort (somenotnone (! π2))
-- a singleton context formed with an index apart from a context is
-- disjoint from that context
lem-apart-sing-disj : {A : Set} {n : Nat} {a : A} {Γ : A ctx} →
n # Γ →
(■ (n , a)) ## Γ
lem-apart-sing-disj {A} {n} {a} {Γ} apt = asd1 , asd2
where
asd1 : (n₁ : Nat) → dom (■ (n , a)) n₁ → n₁ # Γ
asd1 m d with lem-dom-eq d
asd1 .n d | refl = apt
asd2 : (n₁ : Nat) → dom Γ n₁ → n₁ # (■ (n , a))
asd2 m (π1 , π2) with natEQ n m
asd2 .n (π1 , π2) | Inl refl = abort (somenotnone (! π2 · apt ))
asd2 m (π1 , π2) | Inr x = refl
-- the only index of a singleton context is in its domain
lem-domsingle : {A : Set} (p : Nat) (q : A) → dom (■ (p , q)) p
lem-domsingle p q with natEQ p p
lem-domsingle p q | Inl refl = q , refl
lem-domsingle p q | Inr x₁ = abort (x₁ refl)
-- dual of above
lem-disj-sing-apart : {A : Set} {n : Nat} {a : A} {Γ : A ctx} →
(■ (n , a)) ## Γ →
n # Γ
lem-disj-sing-apart {A} {n} {a} {Γ} (d1 , d2) = d1 n (lem-domsingle n a)
-- the singleton context can only produce one non-none result
lem-insingeq : {A : Set} {x x' : Nat} {τ τ' : A} →
(■ (x , τ)) x' == Some τ' →
τ == τ'
lem-insingeq {A} {x} {x'} {τ} {τ'} eq with lem-dom-eq (τ' , eq)
lem-insingeq {A} {x} {.x} {τ} {τ'} eq | refl with natEQ x x
lem-insingeq refl | refl | Inl refl = refl
lem-insingeq eq | refl | Inr x₁ = abort (somenotnone (! eq))
-- if an index doesn't appear in a context, and the union of that context
-- with a singleton does produce a result, it must have come from the singleton
lem-apart-union-eq : {A : Set} {Γ : A ctx} {x x' : Nat} {τ τ' : A} →
x' # Γ →
(Γ ∪ ■ (x , τ)) x' == Some τ' →
τ == τ'
lem-apart-union-eq {A} {Γ} {x} {x'} {τ} {τ'} apart eq with Γ x'
lem-apart-union-eq apart eq | Some x = abort (somenotnone apart)
lem-apart-union-eq apart eq | None = lem-insingeq eq
-- if an index not in a singleton context produces a result from that
-- singleton unioned with another context, the result must have come from
-- the other context
lem-neq-union-eq : {A : Set} {Γ : A ctx} {x x' : Nat} {τ τ' : A} →
x' ≠ x →
(Γ ∪ ■ (x , τ)) x' == Some τ' →
Γ x' == Some τ'
lem-neq-union-eq {A} {Γ} {x} {x'} {τ} {τ'} neq eq with Γ x'
lem-neq-union-eq neq eq | Some x = eq
lem-neq-union-eq {A} {Γ} {x} {x'} {τ} {τ'} neq eq | None with natEQ x x'
lem-neq-union-eq neq eq | None | Inl x₁ = abort ((flip neq) x₁)
lem-neq-union-eq neq eq | None | Inr x₁ = abort (somenotnone (! eq))
-- extending a context with a new index produces the result paired with
-- that index.
ctx-top : {A : Set} → (Γ : A ctx) (n : Nat) (a : A) →
(n # Γ) →
(n , a) ∈ (Γ ,, (n , a))
ctx-top Γ n a apt = x∈∪r Γ (■ (n , a)) n a (x∈■ n a) (lem-apart-sing-disj apt)
--- lemmas building up to a proof of associativity of ∪
ctxignore1 : {A : Set} (x : Nat) (C1 C2 : A ctx) → x # C1 → (C1 ∪ C2) x == C2 x
ctxignore1 x C1 C2 apt with ctxindirect C1 x
ctxignore1 x C1 C2 apt | Inl x₁ = abort (somenotnone (! (π2 x₁) · apt))
ctxignore1 x C1 C2 apt | Inr x₁ with C1 x
ctxignore1 x C1 C2 apt | Inr x₂ | Some x₁ = abort (somenotnone (x₂))
ctxignore1 x C1 C2 apt | Inr x₁ | None = refl
ctxignore2 : {A : Set} (x : Nat) (C1 C2 : A ctx) → x # C2 → (C1 ∪ C2) x == C1 x
ctxignore2 x C1 C2 apt with ctxindirect C2 x
ctxignore2 x C1 C2 apt | Inl x₁ = abort (somenotnone (! (π2 x₁) · apt))
ctxignore2 x C1 C2 apt | Inr x₁ with C1 x
ctxignore2 x C1 C2 apt | Inr x₂ | Some x₁ = refl
ctxignore2 x C1 C2 apt | Inr x₁ | None = x₁
ctxcollapse1 : {A : Set} → (C1 C2 C3 : A ctx) (x : Nat) →
(x # C3) →
(C2 ∪ C3) x == C2 x →
(C1 ∪ (C2 ∪ C3)) x == (C1 ∪ C2) x
ctxcollapse1 C1 C2 C3 x apt eq with C2 x
ctxcollapse1 C1 C2 C3 x apt eq | Some x₁ with C1 x
ctxcollapse1 C1 C2 C3 x apt eq | Some x₂ | Some x₁ = refl
ctxcollapse1 C1 C2 C3 x apt eq | Some x₁ | None with C2 x
ctxcollapse1 C1 C2 C3 x apt eq | Some x₂ | None | Some x₁ = refl
ctxcollapse1 C1 C2 C3 x apt eq | Some x₁ | None | None = apt
ctxcollapse1 C1 C2 C3 x apt eq | None with C1 x
ctxcollapse1 C1 C2 C3 x apt eq | None | Some x₁ = refl
ctxcollapse1 C1 C2 C3 x apt eq | None | None with C2 x
ctxcollapse1 C1 C2 C3 x apt eq | None | None | Some x₁ = refl
ctxcollapse1 C1 C2 C3 x apt eq | None | None | None = eq
ctxcollapse2 : {A : Set} → (C1 C2 C3 : A ctx) (x : Nat) →
(x # C2) →
(C2 ∪ C3) x == C3 x →
(C1 ∪ (C2 ∪ C3)) x == (C1 ∪ C3) x
ctxcollapse2 C1 C2 C3 x apt eq with C1 x
ctxcollapse2 C1 C2 C3 x apt eq | Some x₁ = refl
ctxcollapse2 C1 C2 C3 x apt eq | None with C2 x
ctxcollapse2 C1 C2 C3 x apt eq | None | Some x₁ = eq
ctxcollapse2 C1 C2 C3 x apt eq | None | None = refl
ctxcollapse3 : {A : Set} → (C1 C2 C3 : A ctx) (x : Nat) →
(x # C2) →
((C1 ∪ C2) ∪ C3) x == (C1 ∪ C3) x
ctxcollapse3 C1 C2 C3 x apt with C1 x
ctxcollapse3 C1 C2 C3 x apt | Some x₁ = refl
ctxcollapse3 C1 C2 C3 x apt | None with C2 x
ctxcollapse3 C1 C2 C3 x apt | None | Some x₁ = abort (somenotnone apt)
ctxcollapse3 C1 C2 C3 x apt | None | None = refl
-- if a union of a singleton and a ctx produces no result, the argument
-- index must be apart from the ctx and disequal to the index of the
-- singleton
lem-union-none : {A : Set} {Γ : A ctx} {a : A} {x x' : Nat}
→ (Γ ∪ ■ (x , a)) x' == None
→ (x ≠ x') × (x' # Γ)
lem-union-none {A} {Γ} {a} {x} {x'} emp with ctxindirect Γ x'
lem-union-none {A} {Γ} {a} {x} {x'} emp | Inl (π1 , π2) with Γ x'
lem-union-none emp | Inl (π1 , π2) | Some x = abort (somenotnone emp)
lem-union-none {A} {Γ} {a} {x} {x'} emp | Inl (π1 , π2) | None with natEQ x x'
lem-union-none emp | Inl (π1 , π2) | None | Inl x₁ = abort (somenotnone (! π2))
lem-union-none emp | Inl (π1 , π2) | None | Inr x₁ = x₁ , refl
lem-union-none {A} {Γ} {a} {x} {x'} emp | Inr y with Γ x'
lem-union-none emp | Inr y | Some x = abort (somenotnone emp)
lem-union-none {A} {Γ} {a} {x} {x'} emp | Inr y | None with natEQ x x'
lem-union-none emp | Inr y | None | Inl refl = abort (somenotnone emp)
lem-union-none emp | Inr y | None | Inr x₁ = x₁ , refl
-- converse of lem-union-none
lem-none-union : {A : Set} {Γ : A ctx} {a : A} {x x' : Nat}
→ (x ≠ x')
→ (x' # Γ)
→ (Γ ∪ ■ (x , a)) x' == None
lem-none-union {A} {Γ} {a} {x} {x'} h₁ h₂ with ctxindirect (■ (x , a)) x'
lem-none-union {A} {Γ} {a} {x} {x'} h₁ h₂ | Inl (a' , h) = abort (somenotnone (!( lem-neq-union-eq (flip h₁) (tr (λ y → y == Some a') refl h))))
lem-none-union {A} {Γ} {a} {x} {x'} h₁ h₂ | Inr h = (ctxignore1 x' Γ (■ (x , a)) h₂) · h
∪assoc : {A : Set} (C1 C2 C3 : A ctx) → (C2 ## C3) → (C1 ∪ C2) ∪ C3 == C1 ∪ (C2 ∪ C3)
∪assoc C1 C2 C3 (d1 , d2) = funext guts
where
case2 : (x : Nat) → x # C3 → dom C2 x → ((C1 ∪ C2) ∪ C3) x == (C1 ∪ (C2 ∪ C3)) x
case2 x apt dom = (ctxignore2 x (C1 ∪ C2) C3 apt) ·
! (ctxcollapse1 C1 C2 C3 x apt (lem-dom-union1 (d1 , d2) dom))
case34 : (x : Nat) → x # C2 → ((C1 ∪ C2) ∪ C3) x == (C1 ∪ (C2 ∪ C3)) x
case34 x apt = ctxcollapse3 C1 C2 C3 x apt ·
! (ctxcollapse2 C1 C2 C3 x apt (ctxignore1 x C2 C3 apt))
guts : (x : Nat) → ((C1 ∪ C2) ∪ C3) x == (C1 ∪ (C2 ∪ C3)) x
guts x with ctxindirect C2 x | ctxindirect C3 x
guts x | Inl (π1 , π2) | Inl (π3 , π4) = abort (somenotnone (! π4 · d1 x (π1 , π2)))
guts x | Inl x₁ | Inr x₂ = case2 x x₂ x₁
guts x | Inr x₁ | Inl x₂ = case34 x x₁
guts x | Inr x₁ | Inr x₂ = case34 x x₁
-- if x is apart from either part of a union, the answer comes from the other one
lem-dom-union-apt1 : {A : Set} {Δ1 Δ2 : A ctx} {x : Nat} {y : A} → x # Δ1 → ((Δ1 ∪ Δ2) x == Some y) → (Δ2 x == Some y)
lem-dom-union-apt1 {A} {Δ1} {Δ2} {x} {y} apt xin with Δ1 x
lem-dom-union-apt1 apt xin | Some x₁ = abort (somenotnone apt)
lem-dom-union-apt1 apt xin | None = xin
lem-dom-union-apt2 : {A : Set} {Δ1 Δ2 : A ctx} {x : Nat} {y : A} → x # Δ2 → ((Δ1 ∪ Δ2) x == Some y) → (Δ1 x == Some y)
lem-dom-union-apt2 {A} {Δ1} {Δ2} {x} {y} apt xin with Δ1 x
lem-dom-union-apt2 apt xin | Some x₁ = xin
lem-dom-union-apt2 apt xin | None = abort (somenotnone (! xin · apt))
-- the empty context is a left and right unit for ∪
∅∪1 : {A : Set} {Γ : A ctx} → ∅ ∪ Γ == Γ
∅∪1 {A} {Γ} = refl
∅∪2 : {A : Set} {Γ : A ctx} → Γ ∪ ∅ == Γ
∅∪2 {A} {Γ} = funext guts
where
guts : (x : Nat) → (Γ ∪ ∅) x == Γ x
guts x with Γ x
guts x | Some x₁ = refl
guts x | None = refl
| 46.664615
| 166
| 0.509891
|
edd0fe3821c0428ac0b4f9cae2331bdd3edad6bd
| 4,801
|
agda
|
Agda
|
LibraBFT/Impl/Consensus/Types.agda
|
lisandrasilva/bft-consensus-agda-1
|
b7dd98dd90d98fbb934ef8cb4f3314940986790d
|
[
"UPL-1.0"
] | null | null | null |
LibraBFT/Impl/Consensus/Types.agda
|
lisandrasilva/bft-consensus-agda-1
|
b7dd98dd90d98fbb934ef8cb4f3314940986790d
|
[
"UPL-1.0"
] | null | null | null |
LibraBFT/Impl/Consensus/Types.agda
|
lisandrasilva/bft-consensus-agda-1
|
b7dd98dd90d98fbb934ef8cb4f3314940986790d
|
[
"UPL-1.0"
] | null | null | null |
{- Byzantine Fault Tolerant Consensus Verification in Agda, version 0.9.
Copyright (c) 2020 Oracle and/or its affiliates.
Licensed under the Universal Permissive License v 1.0 as shown at https://opensource.oracle.com/licenses/upl
-}
{-# OPTIONS --allow-unsolved-metas #-}
open import LibraBFT.Prelude
open import LibraBFT.Hash
open import LibraBFT.Base.PKCS
open import LibraBFT.Base.Encode
open import LibraBFT.Base.KVMap as KVMap
open import Optics.All
open import Data.String using (String)
-- This module defines types for an out-of-date implementation, based
-- on a previous version of LibraBFT. It will be updated to model a
-- more recent version in future.
--
-- One important trick here is that the EventProcessor type separayes
-- types that /define/ the EpochConfig and types that /use/ the
-- /EpochConfig/. The advantage of doing this separation can be seen
-- in Util.Util.liftEC, where we define a lifting of a function that
-- does not change the bits that define the EpochConfig into the whole
-- state. This enables a more elegant approach for reasoning about
-- functions that do not change parts of the state responsible for
-- defining the epoch config. However, the separation is not perfect,
-- so sometimes fields may be modified in EpochIndep even though there
-- is no epoch change.
module LibraBFT.Impl.Consensus.Types where
open import LibraBFT.Impl.NetworkMsg
open import LibraBFT.Impl.Consensus.Types.EpochIndep public
open import LibraBFT.Impl.Consensus.Types.EpochDep public
-- The parts of the state of a peer that are used to
-- define the EpochConfig are the SafetyRules and ValidatorVerifier:
record EventProcessorEC : Set where
constructor mkEventProcessorPreEC
field
₋epSafetyRules : SafetyRules
₋epValidators : ValidatorVerifier
open EventProcessorEC public
unquoteDecl epSafetyRules epValidators = mkLens (quote EventProcessorEC)
(epSafetyRules ∷ epValidators ∷ [])
epEpoch : Lens EventProcessorEC EpochId
epEpoch = epSafetyRules ∙ srPersistentStorage ∙ psEpoch
epLastVotedRound : Lens EventProcessorEC Round
epLastVotedRound = epSafetyRules ∙ srPersistentStorage ∙ psLastVotedRound
-- We need enough authors to withstand the desired number of
-- byzantine failures. We enforce this with a predicate over
-- 'EventProcessorEC'.
EventProcessorEC-correct : EventProcessorEC → Set
EventProcessorEC-correct epec =
let numAuthors = kvm-size (epec ^∙ epValidators ∙ vvAddressToValidatorInfo)
qsize = epec ^∙ epValidators ∙ vvQuorumVotingPower
bizF = numAuthors ∸ qsize
in suc (3 * bizF) ≤ numAuthors
EventProcessorEC-correct-≡ : (epec1 : EventProcessorEC)
→ (epec2 : EventProcessorEC)
→ (epec1 ^∙ epValidators) ≡ (epec2 ^∙ epValidators)
→ EventProcessorEC-correct epec1
→ EventProcessorEC-correct epec2
EventProcessorEC-correct-≡ epec1 epec2 refl = id
-- Given a well-formed set of definitions that defines an EpochConfig,
-- α-EC will compute this EpochConfig by abstracting away the unecessary
-- pieces from EventProcessorEC.
-- TODO-2: update and complete when definitions are updated to more recent version
α-EC : Σ EventProcessorEC EventProcessorEC-correct → EpochConfig
α-EC (epec , ok) =
let numAuthors = kvm-size (epec ^∙ epValidators ∙ vvAddressToValidatorInfo)
qsize = epec ^∙ epValidators ∙ vvQuorumVotingPower
bizF = numAuthors ∸ qsize
in (mkEpochConfig {! someHash?!}
(epec ^∙ epEpoch) numAuthors {!!} {!!} {!!} {!!} {!!} {!!} {!!} {!!})
α-EC-≡ : (epec1 : EventProcessorEC)
→ (epec2 : EventProcessorEC)
→ (vals≡ : (epec1 ^∙ epValidators) ≡ (epec2 ^∙ epValidators))
→ (epoch≡ : (epec1 ^∙ epEpoch) ≡ (epec2 ^∙ epEpoch))
→ (epec1-corr : EventProcessorEC-correct epec1)
→ α-EC (epec1 , epec1-corr) ≡ α-EC (epec2 , EventProcessorEC-correct-≡ epec1 epec2 vals≡ epec1-corr)
α-EC-≡ epec1 epec2 refl refl epec1-corr = refl
-- Finally, the EventProcessor is split in two pieces: those
-- that are used to make an EpochConfig versus those that
-- use an EpochConfig.
record EventProcessor : Set where
constructor mkEventProcessor
field
₋epMeta-Msgs : List NetworkMsg -- List of messages sent by this peer
₋epEC : EventProcessorEC
₋epEC-correct : EventProcessorEC-correct ₋epEC
₋epWithEC : EventProcessorWithEC (α-EC (₋epEC , ₋epEC-correct))
-- If we want to add pieces that neither contribute to the
-- construction of the EC nor need one, they should be defined in
-- EventProcessor directly
open EventProcessor public
| 45.72381
| 111
| 0.70277
|
3611700f25a0f853ea94628273d4f1542ad14d57
| 1,040
|
agda
|
Agda
|
Data/List/Smart.agda
|
oisdk/agda-playground
|
97a3aab1282b2337c5f43e2cfa3fa969a94c11b7
|
[
"MIT"
] | 6
|
2020-09-11T17:45:41.000Z
|
2021-11-16T08:11:34.000Z
|
Data/List/Smart.agda
|
oisdk/agda-playground
|
97a3aab1282b2337c5f43e2cfa3fa969a94c11b7
|
[
"MIT"
] | null | null | null |
Data/List/Smart.agda
|
oisdk/agda-playground
|
97a3aab1282b2337c5f43e2cfa3fa969a94c11b7
|
[
"MIT"
] | 1
|
2021-11-11T12:30:21.000Z
|
2021-11-11T12:30:21.000Z
|
{-# OPTIONS --cubical --safe #-}
module Data.List.Smart where
open import Prelude
open import Data.Nat.Properties using (_≡ᴮ_; complete-==)
infixr 5 _∷′_ _++′_
data List {a} (A : Type a) : Type a where
[]′ : List A
_∷′_ : A → List A → List A
_++′_ : List A → List A → List A
sz′ : List A → ℕ → ℕ
sz′ []′ k = k
sz′ (x ∷′ xs) k = k
sz′ (xs ++′ ys) k = suc (sz′ xs (sz′ ys k))
sz : List A → ℕ
sz []′ = zero
sz (x ∷′ xs) = zero
sz (xs ++′ ys) = sz′ xs (sz ys)
_HasSize_ : List A → ℕ → Type
xs HasSize n = T (sz xs ≡ᴮ n)
data ListView {a} (A : Type a) : Type a where
Nil : ListView A
Cons : A → List A → ListView A
viewˡ : List A → ListView A
viewˡ xs = go xs (sz xs) (complete-== (sz xs))
where
go : (xs : List A) → (n : ℕ) → xs HasSize n → ListView A
go []′ n p = Nil
go (x ∷′ xs) n p = Cons x xs
go ((x ∷′ xs) ++′ ys) n p = Cons x (xs ++′ ys)
go ([]′ ++′ ys) n p = go ys n p
go ((xs ++′ ys) ++′ zs) (suc n) p = go (xs ++′ (ys ++′ zs)) n p
| 23.636364
| 66
| 0.480769
|
65b8ac3a19925f749db747719001a24f9b70f3a0
| 1,342
|
agda
|
Agda
|
src/data/lib/prim/Agda/Primitive/Cubical.agda
|
phadej/agda
|
2fa8ede09451d43647f918dbfb24ff7b27c52edc
|
[
"BSD-3-Clause"
] | null | null | null |
src/data/lib/prim/Agda/Primitive/Cubical.agda
|
phadej/agda
|
2fa8ede09451d43647f918dbfb24ff7b27c52edc
|
[
"BSD-3-Clause"
] | null | null | null |
src/data/lib/prim/Agda/Primitive/Cubical.agda
|
phadej/agda
|
2fa8ede09451d43647f918dbfb24ff7b27c52edc
|
[
"BSD-3-Clause"
] | null | null | null |
{-# OPTIONS --cubical #-}
module Agda.Primitive.Cubical where
{-# BUILTIN INTERVAL I #-} -- I : Setω
{-# BUILTIN IZERO i0 #-}
{-# BUILTIN IONE i1 #-}
infix 30 primINeg
infixr 20 primIMin primIMax
primitive
primIMin : I → I → I
primIMax : I → I → I
primINeg : I → I
{-# BUILTIN ISONE IsOne #-} -- IsOne : I → Setω
postulate
itIsOne : IsOne i1
IsOne1 : ∀ i j → IsOne i → IsOne (primIMax i j)
IsOne2 : ∀ i j → IsOne j → IsOne (primIMax i j)
{-# BUILTIN ITISONE itIsOne #-}
{-# BUILTIN ISONE1 IsOne1 #-}
{-# BUILTIN ISONE2 IsOne2 #-}
{-# BUILTIN PARTIAL Partial #-}
{-# BUILTIN PARTIALP PartialP #-}
postulate
isOneEmpty : ∀ {a} {A : Partial i0 (Set a)} → PartialP i0 A
{-# BUILTIN ISONEEMPTY isOneEmpty #-}
primitive
primPOr : ∀ {a} (i j : I) {A : Partial (primIMax i j) (Set a)}
→ PartialP i (λ z → A (IsOne1 i j z)) → PartialP j (λ z → A (IsOne2 i j z))
→ PartialP (primIMax i j) A
-- Computes in terms of primHComp and primTransp
primComp : ∀ {a} (A : (i : I) → Set (a i)) (φ : I) → (∀ i → Partial φ (A i)) → (a : A i0) → A i1
syntax primPOr p q u t = [ p ↦ u , q ↦ t ]
primitive
primTransp : ∀ {a} (A : (i : I) → Set (a i)) (φ : I) → (a : A i0) → A i1
primHComp : ∀ {a} {A : Set a} {φ : I} → (∀ i → Partial φ A) → A → A
| 28.553191
| 98
| 0.538003
|
36606c14dd617e0e112f90b292a288d122d14525
| 2,762
|
agda
|
Agda
|
Cubical/Categories/Category/Base.agda
|
antoinevanmuylder/cubical
|
5b40df813434aa11631ac240409ca2c4d849453c
|
[
"MIT"
] | null | null | null |
Cubical/Categories/Category/Base.agda
|
antoinevanmuylder/cubical
|
5b40df813434aa11631ac240409ca2c4d849453c
|
[
"MIT"
] | null | null | null |
Cubical/Categories/Category/Base.agda
|
antoinevanmuylder/cubical
|
5b40df813434aa11631ac240409ca2c4d849453c
|
[
"MIT"
] | null | null | null |
{-# OPTIONS --safe #-}
module Cubical.Categories.Category.Base where
open import Cubical.Foundations.Prelude
open import Cubical.Foundations.HLevels
open import Cubical.Foundations.Equiv
private
variable
ℓ ℓ' : Level
-- Categories with hom-sets
record Category ℓ ℓ' : Type (ℓ-suc (ℓ-max ℓ ℓ')) where
-- no-eta-equality ; NOTE: need eta equality for `opop`
field
ob : Type ℓ
Hom[_,_] : ob → ob → Type ℓ'
id : ∀ {x} → Hom[ x , x ]
_⋆_ : ∀ {x y z} (f : Hom[ x , y ]) (g : Hom[ y , z ]) → Hom[ x , z ]
⋆IdL : ∀ {x y} (f : Hom[ x , y ]) → id ⋆ f ≡ f
⋆IdR : ∀ {x y} (f : Hom[ x , y ]) → f ⋆ id ≡ f
⋆Assoc : ∀ {x y z w} (f : Hom[ x , y ]) (g : Hom[ y , z ]) (h : Hom[ z , w ])
→ (f ⋆ g) ⋆ h ≡ f ⋆ (g ⋆ h)
isSetHom : ∀ {x y} → isSet Hom[ x , y ]
-- composition: alternative to diagramatic order
_∘_ : ∀ {x y z} (g : Hom[ y , z ]) (f : Hom[ x , y ]) → Hom[ x , z ]
g ∘ f = f ⋆ g
infixr 9 _⋆_
infixr 9 _∘_
open Category
-- Helpful syntax/notation
_[_,_] : (C : Category ℓ ℓ') → (x y : C .ob) → Type ℓ'
_[_,_] = Hom[_,_]
-- Needed to define this in order to be able to make the subsequence syntax declaration
seq' : ∀ (C : Category ℓ ℓ') {x y z} (f : C [ x , y ]) (g : C [ y , z ]) → C [ x , z ]
seq' = _⋆_
infixl 15 seq'
syntax seq' C f g = f ⋆⟨ C ⟩ g
-- composition
comp' : ∀ (C : Category ℓ ℓ') {x y z} (g : C [ y , z ]) (f : C [ x , y ]) → C [ x , z ]
comp' = _∘_
infixr 16 comp'
syntax comp' C g f = g ∘⟨ C ⟩ f
-- Isomorphisms and paths in categories
record CatIso (C : Category ℓ ℓ') (x y : C .ob) : Type ℓ' where
constructor catiso
field
mor : C [ x , y ]
inv : C [ y , x ]
sec : inv ⋆⟨ C ⟩ mor ≡ C .id
ret : mor ⋆⟨ C ⟩ inv ≡ C .id
pathToIso : {C : Category ℓ ℓ'} {x y : C .ob} (p : x ≡ y) → CatIso C x y
pathToIso {C = C} p = J (λ z _ → CatIso _ _ z) (catiso idx idx (C .⋆IdL idx) (C .⋆IdL idx)) p
where
idx = C .id
-- Univalent Categories
record isUnivalent (C : Category ℓ ℓ') : Type (ℓ-max ℓ ℓ') where
field
univ : (x y : C .ob) → isEquiv (pathToIso {C = C} {x = x} {y = y})
-- package up the univalence equivalence
univEquiv : ∀ (x y : C .ob) → (x ≡ y) ≃ (CatIso _ x y)
univEquiv x y = pathToIso , univ x y
-- The function extracting paths from category-theoretic isomorphisms.
CatIsoToPath : {x y : C .ob} (p : CatIso _ x y) → x ≡ y
CatIsoToPath {x = x} {y = y} p =
equivFun (invEquiv (univEquiv x y)) p
-- Opposite category
_^op : Category ℓ ℓ' → Category ℓ ℓ'
ob (C ^op) = ob C
Hom[_,_] (C ^op) x y = C [ y , x ]
id (C ^op) = id C
_⋆_ (C ^op) f g = g ⋆⟨ C ⟩ f
⋆IdL (C ^op) = C .⋆IdR
⋆IdR (C ^op) = C .⋆IdL
⋆Assoc (C ^op) f g h = sym (C .⋆Assoc _ _ _)
isSetHom (C ^op) = C .isSetHom
| 30.351648
| 93
| 0.524258
|
352d5446fc029d5f369d325f61d2711d31ead933
| 1,428
|
agda
|
Agda
|
Cubical/Algebra/Group/DirProd.agda
|
FernandoLarrain/cubical
|
9acdecfa6437ec455568be4e5ff04849cc2bc13b
|
[
"MIT"
] | 301
|
2018-10-17T18:00:24.000Z
|
2022-03-24T02:10:47.000Z
|
Cubical/Algebra/Group/DirProd.agda
|
FernandoLarrain/cubical
|
9acdecfa6437ec455568be4e5ff04849cc2bc13b
|
[
"MIT"
] | 584
|
2018-10-15T09:49:02.000Z
|
2022-03-30T12:09:17.000Z
|
Cubical/Algebra/Group/DirProd.agda
|
FernandoLarrain/cubical
|
9acdecfa6437ec455568be4e5ff04849cc2bc13b
|
[
"MIT"
] | 134
|
2018-11-16T06:11:03.000Z
|
2022-03-23T16:22:13.000Z
|
{-# OPTIONS --safe #-}
module Cubical.Algebra.Group.DirProd where
open import Cubical.Foundations.Prelude
open import Cubical.Foundations.HLevels
open import Cubical.Data.Sigma
open import Cubical.Algebra.Group.Base
open import Cubical.Algebra.Monoid
open import Cubical.Algebra.Semigroup
open GroupStr
open IsGroup hiding (rid ; lid ; invr ; invl)
open IsMonoid hiding (rid ; lid)
open IsSemigroup
DirProd : ∀ {ℓ ℓ'} → Group ℓ → Group ℓ' → Group (ℓ-max ℓ ℓ')
fst (DirProd G H) = fst G × fst H
1g (snd (DirProd G H)) = (1g (snd G)) , (1g (snd H))
_·_ (snd (DirProd G H)) x y = _·_ (snd G) (fst x) (fst y)
, _·_ (snd H) (snd x) (snd y)
(inv (snd (DirProd G H))) x = (inv (snd G) (fst x)) , (inv (snd H) (snd x))
is-set (isSemigroup (isMonoid (isGroup (snd (DirProd G H))))) =
isSet× (is-set (snd G)) (is-set (snd H))
assoc (isSemigroup (isMonoid (isGroup (snd (DirProd G H))))) x y z i =
assoc (snd G) (fst x) (fst y) (fst z) i , assoc (snd H) (snd x) (snd y) (snd z) i
fst (identity (isMonoid (isGroup (snd (DirProd G H)))) x) i =
rid (snd G) (fst x) i , rid (snd H) (snd x) i
snd (identity (isMonoid (isGroup (snd (DirProd G H)))) x) i =
lid (snd G) (fst x) i , lid (snd H) (snd x) i
fst (inverse (isGroup (snd (DirProd G H))) x) i =
(invr (snd G) (fst x) i) , invr (snd H) (snd x) i
snd (inverse (isGroup (snd (DirProd G H))) x) i =
(invl (snd G) (fst x) i) , invl (snd H) (snd x) i
| 42
| 83
| 0.616947
|
3675d3258877c42b029a8ee2edb23e36c451213c
| 1,120
|
agda
|
Agda
|
theorems/cw/cohomology/reconstructed/HigherCoboundary.agda
|
AntoineAllioux/HoTT-Agda
|
1037d82edcf29b620677a311dcfd4fc2ade2faa6
|
[
"MIT"
] | 294
|
2015-01-09T16:23:23.000Z
|
2022-03-20T13:54:45.000Z
|
theorems/cw/cohomology/reconstructed/HigherCoboundary.agda
|
AntoineAllioux/HoTT-Agda
|
1037d82edcf29b620677a311dcfd4fc2ade2faa6
|
[
"MIT"
] | 31
|
2015-03-05T20:09:00.000Z
|
2021-10-03T19:15:25.000Z
|
theorems/cw/cohomology/reconstructed/HigherCoboundary.agda
|
AntoineAllioux/HoTT-Agda
|
1037d82edcf29b620677a311dcfd4fc2ade2faa6
|
[
"MIT"
] | 50
|
2015-01-10T01:48:08.000Z
|
2022-02-14T03:03:25.000Z
|
{-# OPTIONS --without-K --rewriting #-}
open import HoTT
open import groups.Cokernel
open import cw.WedgeOfCells
open import cohomology.Theory
open import cw.CW
module cw.cohomology.reconstructed.HigherCoboundary {i} (OT : OrdinaryTheory i)
{n} (⊙skel : ⊙Skeleton {i} (S (S n))) where
open OrdinaryTheory OT
open import cw.cohomology.grid.LongExactSequence cohomology-theory
(ℕ-to-ℤ (S n)) (⊙cw-incl-last (⊙cw-init ⊙skel)) (⊙cw-incl-last ⊙skel)
open import cw.cohomology.WedgeOfCells OT
cw-co∂-last : CXₙ/Xₙ₋₁ (⊙cw-init ⊙skel) (ℕ-to-ℤ (S n)) →ᴳ CXₙ/Xₙ₋₁ ⊙skel (ℕ-to-ℤ (S (S n)))
cw-co∂-last = grid-co∂
cw-∂-before-Susp : Xₙ/Xₙ₋₁ (⊙Skeleton.skel ⊙skel) → Susp (Xₙ/Xₙ₋₁ (cw-init (⊙Skeleton.skel ⊙skel)))
cw-∂-before-Susp = grid-∂-before-Susp
⊙cw-∂-before-Susp : ⊙Xₙ/Xₙ₋₁ (⊙Skeleton.skel ⊙skel) ⊙→ ⊙Susp (Xₙ/Xₙ₋₁ (cw-init (⊙Skeleton.skel ⊙skel)))
⊙cw-∂-before-Susp = ⊙grid-∂-before-Susp
cw-∂-before-Susp-glue-β = grid-∂-before-Susp-glue-β
cw-co∂-last-β = grid-co∂-β
module CokerCo∂ where
grp = Coker cw-co∂-last (CXₙ/Xₙ₋₁-is-abelian ⊙skel (ℕ-to-ℤ (S (S n))))
open Group grp public
CokerCo∂ = CokerCo∂.grp
| 32
| 103
| 0.675893
|
11089e25fc9714c377e6102dc8b0e36c80a1030f
| 4,772
|
agda
|
Agda
|
notes/fixed-points/LFPs/List.agda
|
asr/fotc
|
2fc9f2b81052a2e0822669f02036c5750371b72d
|
[
"MIT"
] | 11
|
2015-09-03T20:53:42.000Z
|
2021-09-12T16:09:54.000Z
|
notes/fixed-points/LFPs/List.agda
|
asr/fotc
|
2fc9f2b81052a2e0822669f02036c5750371b72d
|
[
"MIT"
] | 2
|
2016-10-12T17:28:16.000Z
|
2017-01-01T14:34:26.000Z
|
notes/fixed-points/LFPs/List.agda
|
asr/fotc
|
2fc9f2b81052a2e0822669f02036c5750371b72d
|
[
"MIT"
] | 3
|
2016-09-19T14:18:30.000Z
|
2018-03-14T08:50:00.000Z
|
------------------------------------------------------------------------------
-- Equivalence of definitions of total lists
------------------------------------------------------------------------------
{-# OPTIONS --exact-split #-}
{-# OPTIONS --no-sized-types #-}
{-# OPTIONS --no-universe-polymorphism #-}
{-# OPTIONS --without-K #-}
module LFPs.List where
open import FOTC.Base
open import FOTC.Base.List
open import FOTC.Data.Nat.UnaryNumbers
------------------------------------------------------------------------------
module LFP where
-- List is a least fixed-point of a functor
-- The functor.
ListF : (D → Set) → D → Set
ListF A xs = xs ≡ [] ∨ (∃[ x' ] ∃[ xs' ] xs ≡ x' ∷ xs' ∧ A xs')
-- List is the least fixed-point of ListF. i.e.
postulate
List : D → Set
-- List is a pre-fixed point of ListF, i.e.
--
-- ListF List ≤ List.
--
-- Peter: It corresponds to the introduction rules.
List-in : ∀ {xs} → xs ≡ [] ∨ (∃[ x' ] ∃[ xs' ] xs ≡ x' ∷ xs' ∧ List xs') →
List xs
-- The higher-order version.
List-in-ho : {xs : D} → ListF List xs → List xs
-- List is the least pre-fixed point of ListF, i.e.
--
-- ∀ A. ListF A ≤ A ⇒ List ≤ A.
--
-- Peter: It corresponds to the elimination rule of an inductively
-- defined predicate.
List-ind :
(A : D → Set) →
(∀ {xs} → xs ≡ [] ∨ (∃[ x' ] ∃[ xs' ] xs ≡ x' ∷ xs' ∧ A xs') → A xs) →
∀ {xs} → List xs → A xs
-- Higher-order version.
List-ind-ho :
(A : D → Set) →
(∀ {xs} → ListF A xs → A xs) →
∀ {xs} → List xs → A xs
----------------------------------------------------------------------------
-- List-in and List-in-ho are equivalents
List-in-fo : ∀ {xs} → xs ≡ [] ∨ (∃[ x' ] ∃[ xs' ] xs ≡ x' ∷ xs' ∧ List xs') →
List xs
List-in-fo = List-in-ho
List-in-ho' : {xs : D} → ListF List xs → List xs
List-in-ho' = List-in-ho
----------------------------------------------------------------------------
-- List-ind and List-ind-ho are equivalents
List-ind-fo :
(A : D → Set) →
(∀ {xs} → xs ≡ [] ∨ (∃[ x' ] ∃[ xs' ] xs ≡ x' ∷ xs' ∧ A xs') → A xs) →
∀ {xs} → List xs → A xs
List-ind-fo = List-ind-ho
List-ind-ho' :
(A : D → Set) →
(∀ {xs} → ListF A xs → A xs) →
∀ {xs} → List xs → A xs
List-ind-ho' = List-ind
----------------------------------------------------------------------------
-- The data constructors of List.
lnil : List []
lnil = List-in (inj₁ refl)
lcons : ∀ x {xs} → List xs → List (x ∷ xs)
lcons x {xs} Lxs = List-in (inj₂ (x , xs , refl , Lxs))
----------------------------------------------------------------------------
-- The type theoretical induction principle for List.
List-ind' : (A : D → Set) →
A [] →
(∀ x {xs} → A xs → A (x ∷ xs)) →
∀ {xs} → List xs → A xs
List-ind' A A[] is = List-ind A prf
where
prf : ∀ {xs} → xs ≡ [] ∨ (∃[ x' ] ∃[ xs' ] xs ≡ x' ∷ xs' ∧ A xs') → A xs
prf (inj₁ xs≡[]) = subst A (sym xs≡[]) A[]
prf (inj₂ (x' , xs' , h₁ , Axs')) = subst A (sym h₁) (is x' Axs')
----------------------------------------------------------------------------
-- Example
xs : D
xs = 0' ∷ true ∷ 1' ∷ false ∷ []
xs-List : List xs
xs-List = lcons 0' (lcons true (lcons 1' (lcons false lnil)))
------------------------------------------------------------------------------
module Data where
data List : D → Set where
lnil : List []
lcons : ∀ x {xs} → List xs → List (x ∷ xs)
-- Induction principle.
List-ind : (A : D → Set) →
A [] →
(∀ x {xs} → A xs → A (x ∷ xs)) →
∀ {xs} → List xs → A xs
List-ind A A[] h lnil = A[]
List-ind A A[] h (lcons x Lxs) = h x (List-ind A A[] h Lxs)
----------------------------------------------------------------------------
-- List-in
List-in : ∀ {xs} → xs ≡ [] ∨ (∃[ x' ] ∃[ xs' ] xs ≡ x' ∷ xs' ∧ List xs') →
List xs
List-in {xs} h = case prf₁ prf₂ h
where
prf₁ : xs ≡ [] → List xs
prf₁ xs≡[] = subst List (sym xs≡[]) lnil
prf₂ : ∃[ x' ] ∃[ xs' ] xs ≡ x' ∷ xs' ∧ List xs' → List xs
prf₂ (x' , xs' , prf , Lxs') = subst List (sym prf) (lcons x' Lxs')
----------------------------------------------------------------------------
-- The fixed-point induction principle for List.
List-ind' :
(A : D → Set) →
(∀ {xs} → xs ≡ [] ∨ (∃[ x' ] ∃[ xs' ] xs ≡ x' ∷ xs' ∧ A xs') → A xs) →
∀ {xs} → List xs → A xs
List-ind' A h Lxs = List-ind A h₁ h₂ Lxs
where
h₁ : A []
h₁ = h (inj₁ refl)
h₂ : ∀ y {ys} → A ys → A (y ∷ ys)
h₂ y {ys} Ays = h (inj₂ (y , ys , refl , Ays))
| 31.189542
| 79
| 0.384325
|
527a2fd1bb5abfd7cf63fc92cd47326f0af5618a
| 146
|
agda
|
Agda
|
Categories/Enriched.agda
|
copumpkin/categories
|
36f4181d751e2ecb54db219911d8c69afe8ba892
|
[
"BSD-3-Clause"
] | 98
|
2015-04-15T14:57:33.000Z
|
2022-03-08T05:20:36.000Z
|
Categories/Enriched.agda
|
p-pavel/categories
|
e41aef56324a9f1f8cf3cd30b2db2f73e01066f2
|
[
"BSD-3-Clause"
] | 19
|
2015-05-23T06:47:10.000Z
|
2019-08-09T16:31:40.000Z
|
Categories/Enriched.agda
|
p-pavel/categories
|
e41aef56324a9f1f8cf3cd30b2db2f73e01066f2
|
[
"BSD-3-Clause"
] | 23
|
2015-02-05T13:03:09.000Z
|
2021-11-11T13:50:56.000Z
|
{-# OPTIONS --universe-polymorphism #-}
module Categories.Enriched where
open import Categories.Category
open import Categories.Monoidal
-- moar
| 20.857143
| 39
| 0.794521
|
3535852b8c69df17544e8458e38b00235c6efe64
| 9,243
|
agda
|
Agda
|
src/Categories/Morphism/Isomorphism.agda
|
yourboynico/agda-categories
|
6a087c592dbe58fc4bd9d02e1be9b94a9e138aca
|
[
"MIT"
] | 279
|
2019-06-01T14:36:40.000Z
|
2022-03-22T00:40:14.000Z
|
src/Categories/Morphism/Isomorphism.agda
|
seanpm2001/agda-categories
|
d9e4f578b126313058d105c61707d8c8ae987fa8
|
[
"MIT"
] | 236
|
2019-06-01T14:53:54.000Z
|
2022-03-28T14:31:43.000Z
|
src/Categories/Morphism/Isomorphism.agda
|
seanpm2001/agda-categories
|
d9e4f578b126313058d105c61707d8c8ae987fa8
|
[
"MIT"
] | 64
|
2019-06-02T16:58:15.000Z
|
2022-03-14T02:00:59.000Z
|
{-# OPTIONS --without-K --safe #-}
open import Categories.Category
-- Mainly *properties* of isomorphisms, and a lot of other things too
-- TODO: split things up more semantically?
module Categories.Morphism.Isomorphism {o ℓ e} (𝒞 : Category o ℓ e) where
open import Level using (_⊔_)
open import Function using (flip)
open import Data.Product using (_,_)
open import Relation.Binary using (Rel; _Preserves_⟶_; IsEquivalence)
open import Relation.Binary.Construct.Closure.Transitive
open import Relation.Binary.PropositionalEquality as ≡ using (_≡_)
import Categories.Category.Construction.Core as Core
open import Categories.Category.Groupoid using (IsGroupoid)
import Categories.Category.Groupoid.Properties as GroupoidProps
import Categories.Morphism as Morphism
import Categories.Morphism.Properties as MorphismProps
import Categories.Morphism.IsoEquiv as IsoEquiv
import Categories.Category.Construction.Path as Path
open Core 𝒞 using (Core; Core-isGroupoid; CoreGroupoid; module Shorthands)
open Morphism 𝒞
open MorphismProps 𝒞
open Path 𝒞
import Categories.Morphism.Reasoning as MR
open Category 𝒞
open Definitions 𝒞
private
module MCore where
open GroupoidProps CoreGroupoid public
open MorphismProps Core public
open Morphism Core public
open Path Core public
variable
A B C D E F : Obj
open Shorthands hiding (_≅_)
CommutativeIso = IsGroupoid.CommutativeSquare Core-isGroupoid
--------------------
-- Also stuff about transitive closure
∘ᵢ-tc : A [ _≅_ ]⁺ B → A ≅ B
∘ᵢ-tc = MCore.∘-tc
infix 4 _≃⁺_
_≃⁺_ : Rel (A [ _≅_ ]⁺ B) e
_≃⁺_ = MCore._≈⁺_
TransitiveClosure : Category o (o ⊔ ℓ ⊔ e) e
TransitiveClosure = MCore.Path
--------------------
-- some infrastructure setup in order to say something about morphisms and isomorphisms
module _ where
private
data IsoPlus : A [ _⇒_ ]⁺ B → Set (o ⊔ ℓ ⊔ e) where
[_] : {f : A ⇒ B} {g : B ⇒ A} → Iso f g → IsoPlus [ f ]
_∼⁺⟨_⟩_ : ∀ A {f⁺ : A [ _⇒_ ]⁺ B} {g⁺ : B [ _⇒_ ]⁺ C} → IsoPlus f⁺ → IsoPlus g⁺ → IsoPlus (_ ∼⁺⟨ f⁺ ⟩ g⁺)
open _≅_
≅⁺⇒⇒⁺ : A [ _≅_ ]⁺ B → A [ _⇒_ ]⁺ B
≅⁺⇒⇒⁺ [ f ] = [ from f ]
≅⁺⇒⇒⁺ (_ ∼⁺⟨ f⁺ ⟩ f⁺′) = _ ∼⁺⟨ ≅⁺⇒⇒⁺ f⁺ ⟩ ≅⁺⇒⇒⁺ f⁺′
reverse : A [ _≅_ ]⁺ B → B [ _≅_ ]⁺ A
reverse [ f ] = [ ≅.sym f ]
reverse (_ ∼⁺⟨ f⁺ ⟩ f⁺′) = _ ∼⁺⟨ reverse f⁺′ ⟩ reverse f⁺
reverse⇒≅-sym : (f⁺ : A [ _≅_ ]⁺ B) → ∘ᵢ-tc (reverse f⁺) ≡ ≅.sym (∘ᵢ-tc f⁺)
reverse⇒≅-sym [ f ] = ≡.refl
reverse⇒≅-sym (_ ∼⁺⟨ f⁺ ⟩ f⁺′) = ≡.cong₂ (Morphism.≅.trans 𝒞) (reverse⇒≅-sym f⁺′) (reverse⇒≅-sym f⁺)
TransitiveClosure-groupoid : IsGroupoid TransitiveClosure
TransitiveClosure-groupoid = record
{ _⁻¹ = reverse
; iso = λ {_ _ f⁺} → record { isoˡ = isoˡ′ f⁺ ; isoʳ = isoʳ′ f⁺ }
}
where
open HomReasoningᵢ
isoˡ′ : (f⁺ : A [ _≅_ ]⁺ B) → ∘ᵢ-tc (reverse f⁺) ∘ᵢ ∘ᵢ-tc f⁺ ≈ᵢ ≅.refl
isoˡ′ f⁺ = begin
∘ᵢ-tc (reverse f⁺) ∘ᵢ ∘ᵢ-tc f⁺
≡⟨ ≡.cong (_∘ᵢ ∘ᵢ-tc f⁺) (reverse⇒≅-sym f⁺) ⟩
≅.sym (∘ᵢ-tc f⁺) ∘ᵢ ∘ᵢ-tc f⁺
≈⟨ ⁻¹-iso.isoˡ ⟩
≅.refl
∎
isoʳ′ : (f⁺ : A [ _≅_ ]⁺ B) → ∘ᵢ-tc f⁺ ∘ᵢ ∘ᵢ-tc (reverse f⁺) ≈ᵢ ≅.refl
isoʳ′ f⁺ = begin
∘ᵢ-tc f⁺ ∘ᵢ ∘ᵢ-tc (reverse f⁺)
≡⟨ ≡.cong (∘ᵢ-tc f⁺ ∘ᵢ_) (reverse⇒≅-sym f⁺) ⟩
∘ᵢ-tc f⁺ ∘ᵢ ≅.sym (∘ᵢ-tc f⁺)
≈⟨ ⁻¹-iso.isoʳ ⟩
≅.refl
∎
from-∘ᵢ-tc : (f⁺ : A [ _≅_ ]⁺ B) → from (∘ᵢ-tc f⁺) ≡ ∘-tc (≅⁺⇒⇒⁺ f⁺)
from-∘ᵢ-tc [ f ] = ≡.refl
from-∘ᵢ-tc (_ ∼⁺⟨ f⁺ ⟩ f⁺′) = ≡.cong₂ _∘_ (from-∘ᵢ-tc f⁺′) (from-∘ᵢ-tc f⁺)
≅*⇒⇒*-cong : ≅⁺⇒⇒⁺ {A} {B} Preserves _≃⁺_ ⟶ _≈⁺_
≅*⇒⇒*-cong {_} {_} {f⁺} {g⁺} f⁺≃⁺g⁺ = begin
∘-tc (≅⁺⇒⇒⁺ f⁺) ≡˘⟨ from-∘ᵢ-tc f⁺ ⟩
from (∘ᵢ-tc f⁺) ≈⟨ from-≈ f⁺≃⁺g⁺ ⟩
from (∘ᵢ-tc g⁺) ≡⟨ from-∘ᵢ-tc g⁺ ⟩
∘-tc (≅⁺⇒⇒⁺ g⁺) ∎
where open HomReasoning
≅-shift : ∀ {f⁺ : A [ _≅_ ]⁺ B} {g⁺ : B [ _≅_ ]⁺ C} {h⁺ : A [ _≅_ ]⁺ C} →
(_ ∼⁺⟨ f⁺ ⟩ g⁺) ≃⁺ h⁺ → g⁺ ≃⁺ (_ ∼⁺⟨ reverse f⁺ ⟩ h⁺)
≅-shift {f⁺ = f⁺} {g⁺ = g⁺} {h⁺ = h⁺} eq = begin
∘ᵢ-tc g⁺ ≈⟨ introʳ (I.isoʳ f⁺) ⟩
∘ᵢ-tc g⁺ ∘ᵢ (∘ᵢ-tc f⁺ ∘ᵢ ∘ᵢ-tc (reverse f⁺)) ≈⟨ pullˡ eq ⟩
∘ᵢ-tc h⁺ ∘ᵢ ∘ᵢ-tc (reverse f⁺) ∎
where
open HomReasoningᵢ
open MR Core
module I {A B} (f⁺ : A [ _≅_ ]⁺ B) = Morphism.Iso (IsGroupoid.iso TransitiveClosure-groupoid {f = f⁺})
lift : ∀ {f⁺ : A [ _⇒_ ]⁺ B} → IsoPlus f⁺ → A [ _≅_ ]⁺ B
lift [ iso ] = [ record
{ from = _
; to = _
; iso = iso
} ]
lift (_ ∼⁺⟨ iso ⟩ iso′) = _ ∼⁺⟨ lift iso ⟩ lift iso′
reduce-lift : ∀ {f⁺ : A [ _⇒_ ]⁺ B} (f′ : IsoPlus f⁺) → from (∘ᵢ-tc (lift f′)) ≡ ∘-tc f⁺
reduce-lift [ f ] = ≡.refl
reduce-lift (_ ∼⁺⟨ f′ ⟩ f″) = ≡.cong₂ _∘_ (reduce-lift f″) (reduce-lift f′)
lift-cong : ∀ {f⁺ g⁺ : A [ _⇒_ ]⁺ B} (f′ : IsoPlus f⁺) (g′ : IsoPlus g⁺) →
f⁺ ≈⁺ g⁺ → lift f′ ≃⁺ lift g′
lift-cong {_} {_} {f⁺} {g⁺} f′ g′ eq = ⌞ from-≈′ ⌟
where
open HomReasoning
from-≈′ : from (∘ᵢ-tc (lift f′)) ≈ from (∘ᵢ-tc (lift g′))
from-≈′ = begin
from (∘ᵢ-tc (lift f′)) ≡⟨ reduce-lift f′ ⟩
∘-tc f⁺ ≈⟨ eq ⟩
∘-tc g⁺ ≡˘⟨ reduce-lift g′ ⟩
from (∘ᵢ-tc (lift g′)) ∎
lift-triangle : {f : A ⇒ B} {g : C ⇒ A} {h : C ⇒ B} {k : B ⇒ C} {i : B ⇒ A} {j : A ⇒ C} →
f ∘ g ≈ h → (f′ : Iso f i) → (g′ : Iso g j) → (h′ : Iso h k) →
lift (_ ∼⁺⟨ [ g′ ] ⟩ [ f′ ]) ≃⁺ lift [ h′ ]
lift-triangle eq f′ g′ h′ = lift-cong (_ ∼⁺⟨ [ g′ ] ⟩ [ f′ ]) [ h′ ] eq
lift-square : {f : A ⇒ B} {g : C ⇒ A} {h : D ⇒ B} {i : C ⇒ D} {j : D ⇒ C} {a : B ⇒ A} {b : A ⇒ C} {c : B ⇒ D} →
f ∘ g ≈ h ∘ i → (f′ : Iso f a) → (g′ : Iso g b) → (h′ : Iso h c) → (i′ : Iso i j) →
lift (_ ∼⁺⟨ [ g′ ] ⟩ [ f′ ]) ≃⁺ lift (_ ∼⁺⟨ [ i′ ] ⟩ [ h′ ])
lift-square eq f′ g′ h′ i′ = lift-cong (_ ∼⁺⟨ [ g′ ] ⟩ [ f′ ]) (_ ∼⁺⟨ [ i′ ] ⟩ [ h′ ]) eq
lift-pentagon : {f : A ⇒ B} {g : C ⇒ A} {h : D ⇒ C} {i : E ⇒ B} {j : D ⇒ E} {l : E ⇒ D}
{a : B ⇒ A} {b : A ⇒ C} {c : C ⇒ D} {d : B ⇒ E} →
f ∘ g ∘ h ≈ i ∘ j →
(f′ : Iso f a) → (g′ : Iso g b) → (h′ : Iso h c) → (i′ : Iso i d) → (j′ : Iso j l) →
lift (_ ∼⁺⟨ _ ∼⁺⟨ [ h′ ] ⟩ [ g′ ] ⟩ [ f′ ]) ≃⁺ lift (_ ∼⁺⟨ [ j′ ] ⟩ [ i′ ])
lift-pentagon eq f′ g′ h′ i′ j′ = lift-cong (_ ∼⁺⟨ _ ∼⁺⟨ [ h′ ] ⟩ [ g′ ] ⟩ [ f′ ]) (_ ∼⁺⟨ [ j′ ] ⟩ [ i′ ]) eq
module _ where
open _≅_
-- projecting isomorphism commutations to morphism commutations
project-triangle : {g : A ≅ B} {f : C ≅ A} {h : C ≅ B} → g ∘ᵢ f ≈ᵢ h → from g ∘ from f ≈ from h
project-triangle = from-≈
project-square : {g : A ≅ B} {f : C ≅ A} {i : D ≅ B} {h : C ≅ D} → g ∘ᵢ f ≈ᵢ i ∘ᵢ h → from g ∘ from f ≈ from i ∘ from h
project-square = from-≈
-- direct lifting from morphism commutations to isomorphism commutations
lift-triangle′ : {f : A ≅ B} {g : C ≅ A} {h : C ≅ B} → from f ∘ from g ≈ from h → f ∘ᵢ g ≈ᵢ h
lift-triangle′ = ⌞_⌟
lift-square′ : {f : A ≅ B} {g : C ≅ A} {h : D ≅ B} {i : C ≅ D} → from f ∘ from g ≈ from h ∘ from i → f ∘ᵢ g ≈ᵢ h ∘ᵢ i
lift-square′ = ⌞_⌟
lift-pentagon′ : {f : A ≅ B} {g : C ≅ A} {h : D ≅ C} {i : E ≅ B} {j : D ≅ E} →
from f ∘ from g ∘ from h ≈ from i ∘ from j → f ∘ᵢ g ∘ᵢ h ≈ᵢ i ∘ᵢ j
lift-pentagon′ = ⌞_⌟
open MR Core
open HomReasoningᵢ
open MR.GroupoidR _ Core-isGroupoid
squares×≃⇒≃ : {f f′ : A ≅ B} {g : A ≅ C} {h : B ≅ D} {i i′ : C ≅ D} →
CommutativeIso f g h i → CommutativeIso f′ g h i′ → i ≈ᵢ i′ → f ≈ᵢ f′
squares×≃⇒≃ sq₁ sq₂ eq = MCore.isos×≈⇒≈ eq helper₁ (MCore.≅.sym helper₂) sq₁ sq₂
where
helper₁ = record { iso = ⁻¹-iso }
helper₂ = record { iso = ⁻¹-iso }
-- imagine a triangle prism, if all the sides and the top face commute, the bottom face commute.
triangle-prism : {i′ : A ≅ B} {f′ : C ≅ A} {h′ : C ≅ B} {i : D ≅ E} {j : D ≅ A}
{k : E ≅ B} {f : F ≅ D} {g : F ≅ C} {h : F ≅ E} →
i′ ∘ᵢ f′ ≈ᵢ h′ →
CommutativeIso i j k i′ → CommutativeIso f g j f′ → CommutativeIso h g k h′ →
i ∘ᵢ f ≈ᵢ h
triangle-prism {i′ = i′} {f′} {_} {i} {_} {k} {f} {g} {_} eq sq₁ sq₂ sq₃ =
squares×≃⇒≃ glued sq₃ eq
where
glued : CommutativeIso (i ∘ᵢ f) g k (i′ ∘ᵢ f′)
glued = ⟺ (glue (⟺ sq₁) (⟺ sq₂))
elim-triangleˡ : {f : A ≅ B} {g : C ≅ A} {h : D ≅ C} {i : D ≅ B} {j : D ≅ A} →
f ∘ᵢ g ∘ᵢ h ≈ᵢ i → f ∘ᵢ j ≈ᵢ i → g ∘ᵢ h ≈ᵢ j
elim-triangleˡ perim tri = MCore.mono _ _ (perim ○ ⟺ tri)
elim-triangleˡ′ : {f : A ≅ B} {g : C ≅ A} {h : D ≅ C} {i : D ≅ B} {j : C ≅ B} →
f ∘ᵢ g ∘ᵢ h ≈ᵢ i → j ∘ᵢ h ≈ᵢ i → f ∘ᵢ g ≈ᵢ j
elim-triangleˡ′ {f = f} {g} {h} {i} {j} perim tri = MCore.epi _ _ ( begin
(f ∘ᵢ g) ∘ᵢ h ≈⟨ ⌞ assoc ⌟ ⟩
f ∘ᵢ g ∘ᵢ h ≈⟨ perim ⟩
i ≈˘⟨ tri ⟩
j ∘ᵢ h ∎ )
cut-squareʳ : {g : A ≅ B} {f : A ≅ C} {h : B ≅ D} {i : C ≅ D} {j : B ≅ C} →
CommutativeIso g f h i → i ∘ᵢ j ≈ᵢ h → j ∘ᵢ g ≈ᵢ f
cut-squareʳ {g = g} {f = f} {h = h} {i = i} {j = j} sq tri = begin
j ∘ᵢ g ≈⟨ switch-fromtoˡ′ {f = i} {h = j} {k = h} tri ⟩∘⟨refl ⟩
(i ⁻¹ ∘ᵢ h) ∘ᵢ g ≈⟨ ⌞ assoc ⌟ ⟩
i ⁻¹ ∘ᵢ h ∘ᵢ g ≈˘⟨ switch-fromtoˡ′ {f = i} {h = f} {k = h ∘ᵢ g} (⟺ sq) ⟩
f ∎
| 38.352697
| 121
| 0.468787
|
edf5a2bc773e63efa1d5a8e4ceaf942982401982
| 4,419
|
agda
|
Agda
|
src/Partiality-monad/Coinductive/Partial-order.agda
|
nad/partiality-monad
|
f69749280969f9093e5e13884c6feb0ad2506eae
|
[
"MIT"
] | 2
|
2020-05-21T22:59:18.000Z
|
2020-07-03T08:56:08.000Z
|
src/Partiality-monad/Coinductive/Partial-order.agda
|
nad/partiality-monad
|
f69749280969f9093e5e13884c6feb0ad2506eae
|
[
"MIT"
] | null | null | null |
src/Partiality-monad/Coinductive/Partial-order.agda
|
nad/partiality-monad
|
f69749280969f9093e5e13884c6feb0ad2506eae
|
[
"MIT"
] | null | null | null |
------------------------------------------------------------------------
-- A partial order
------------------------------------------------------------------------
{-# OPTIONS --cubical --sized-types #-}
open import Prelude hiding (⊥; module W)
module Partiality-monad.Coinductive.Partial-order {a} {A : Type a} where
open import Equality.Propositional.Cubical
open import Logical-equivalence using (_⇔_)
open import Prelude.Size
open import Bijection equality-with-J using (_↔_)
open import Equality.Path.Isomorphisms.Univalence equality-with-paths
open import H-level equality-with-J
open import H-level.Closure equality-with-J
open import H-level.Truncation.Propositional equality-with-paths
as Trunc
open import Quotient equality-with-paths as Quotient
open import Univalence-axiom equality-with-J
open import Delay-monad
open import Delay-monad.Bisimilarity as B using (_≈_)
import Delay-monad.Partial-order as PO
open import Partiality-monad.Coinductive
-- An ordering relation.
LE : A ⊥ → A ⊥ → Proposition a
LE x y = Quotient.rec
(λ where
.[]ʳ x → LE″ x y
.[]-respects-relationʳ → left-lemma″-∥∥ y
.is-setʳ → is-set)
x
where
LE′ : Delay A ∞ → Delay A ∞ → Proposition a
LE′ x y = ∥ x PO.⊑ y ∥ , truncation-is-proposition
abstract
is-set : Is-set (∃ λ (A : Type a) → Is-proposition A)
is-set = Is-set-∃-Is-proposition ext prop-ext
right-lemma : ∀ {x y z} → x ≈ y → LE′ z x ≡ LE′ z y
right-lemma x≈y =
_↔_.to (⇔↔≡″ ext prop-ext)
(record { to = ∥∥-map (flip PO.transitive-⊑≈ x≈y)
; from = ∥∥-map (flip PO.transitive-⊑≈
(B.symmetric x≈y))
})
right-lemma-∥∥ : ∀ {x y z} → ∥ x ≈ y ∥ → LE′ z x ≡ LE′ z y
right-lemma-∥∥ = Trunc.rec is-set right-lemma
LE″ : Delay A ∞ → A ⊥ → Proposition a
LE″ x y = Quotient.rec
(λ where
.[]ʳ → LE′ x
.[]-respects-relationʳ → right-lemma-∥∥
.is-setʳ → is-set)
y
abstract
left-lemma : ∀ {x y z} → x ≈ y → LE′ x z ≡ LE′ y z
left-lemma x≈y =
_↔_.to (⇔↔≡″ ext prop-ext)
(record { to = ∥∥-map (PO.transitive-≈⊑
(B.symmetric x≈y))
; from = ∥∥-map (PO.transitive-≈⊑ x≈y)
})
left-lemma″ : ∀ {x y} z → x ≈ y → LE″ x z ≡ LE″ y z
left-lemma″ {x} {y} z x≈y = Quotient.elim-prop
{P = λ z → LE″ x z ≡ LE″ y z}
(λ where
.[]ʳ _ → left-lemma x≈y
.is-propositionʳ _ →
Is-set-∃-Is-proposition ext prop-ext)
z
left-lemma″-∥∥ : ∀ {x y} z → ∥ x ≈ y ∥ → LE″ x z ≡ LE″ y z
left-lemma″-∥∥ z = Trunc.rec
is-set
(left-lemma″ z)
infix 4 _⊑_
_⊑_ : A ⊥ → A ⊥ → Type a
x ⊑ y = proj₁ (LE x y)
-- _⊑_ is propositional.
⊑-propositional : ∀ x y → Is-proposition (x ⊑ y)
⊑-propositional x y = proj₂ (LE x y)
-- _⊑_ is reflexive.
reflexive : ∀ x → x ⊑ x
reflexive = Quotient.elim-prop λ where
.[]ʳ x → ∣ PO.reflexive x ∣
.is-propositionʳ x → ⊑-propositional [ x ] [ x ]
-- _⊑_ is antisymmetric.
antisymmetric : ∀ x y → x ⊑ y → y ⊑ x → x ≡ y
antisymmetric = Quotient.elim-prop λ where
.[]ʳ x → Quotient.elim-prop (λ where
.[]ʳ y ∥x⊑y∥ ∥y⊑x∥ →
[]-respects-relation $
Trunc.rec truncation-is-proposition
(λ x⊑y → ∥∥-map (PO.antisymmetric x⊑y) ∥y⊑x∥)
∥x⊑y∥
.is-propositionʳ _ →
Π-closure ext 1 λ _ →
Π-closure ext 1 λ _ →
⊥-is-set)
.is-propositionʳ _ →
Π-closure ext 1 λ _ →
Π-closure ext 1 λ _ →
Π-closure ext 1 λ _ →
⊥-is-set
-- _⊑_ is transitive.
transitive : ∀ x y z → x ⊑ y → y ⊑ z → x ⊑ z
transitive = Quotient.elim-prop λ where
.[]ʳ x → Quotient.elim-prop λ where
.[]ʳ y → Quotient.elim-prop λ where
.[]ʳ z ∥x⊑y∥ →
Trunc.rec truncation-is-proposition
(λ y⊑z → ∥∥-map (λ x⊑y → PO.transitive x⊑y y⊑z) ∥x⊑y∥)
.is-propositionʳ _ →
Π-closure ext 1 λ _ →
Π-closure ext 1 λ _ →
⊑-propositional [ _ ] [ _ ]
.is-propositionʳ _ →
Π-closure ext 1 λ z →
Π-closure ext 1 λ _ →
Π-closure ext 1 λ _ →
⊑-propositional [ _ ] z
.is-propositionʳ _ →
Π-closure ext 1 λ _ →
Π-closure ext 1 λ z →
Π-closure ext 1 λ _ →
Π-closure ext 1 λ _ →
⊑-propositional [ _ ] z
| 29.072368
| 72
| 0.523874
|
738e18110147d5ec290a0007fdcff896608f64fc
| 1,618
|
agda
|
Agda
|
test/Test3.agda
|
mchristianl/synthetic-reals
|
10206b5c3eaef99ece5d18bf703c9e8b2371bde4
|
[
"MIT"
] | 3
|
2020-07-31T18:15:26.000Z
|
2022-02-19T12:15:21.000Z
|
test/Test3.agda
|
mchristianl/synthetic-reals
|
10206b5c3eaef99ece5d18bf703c9e8b2371bde4
|
[
"MIT"
] | null | null | null |
test/Test3.agda
|
mchristianl/synthetic-reals
|
10206b5c3eaef99ece5d18bf703c9e8b2371bde4
|
[
"MIT"
] | null | null | null |
{-# OPTIONS --cubical --no-import-sorts #-}
module Test3 where
open import Cubical.Foundations.Everything renaming (_⁻¹ to _⁻¹ᵖ; assoc to ∙-assoc)
open import Cubical.Foundations.Logic
abstract
!_ : ∀{ℓ} {X : Type ℓ} → X → X
! x = x
!-≡ : ∀{ℓ} {X : Type ℓ} → (! X) ≡ X
!-≡ = refl -- makes use of the definition of `!_` within this block
!!_ : ∀{ℓ} {X : Type ℓ} → X → ! X
!!_ {X = X} x = transport (sym (!-≡ {X = X})) x
!!⁻¹_ : ∀{ℓ} {X : Type ℓ} → ! X → X
!!⁻¹_ {X = X} x = transport (!-≡ {X = X}) x
infix 1 !_
infix 1 !!_
infix 1 !!⁻¹_
-- !-≡' : ∀{ℓ} {X : Type ℓ} → (! X) ≡ X
-- !-≡' = refl -- cannot make use of the definition of `!_` anymore
hPropRel : ∀ {ℓ} (A B : Type ℓ) (ℓ' : Level) → Type (ℓ-max ℓ (ℓ-suc ℓ'))
hPropRel A B ℓ' = A → B → hProp ℓ'
module TestB {ℓ ℓ'} (X : Type ℓ)
(0ˣ : X) (_+_ _·_ : X → X → X) (_<_ : hPropRel X X ℓ')
(let infixl 5 _+_; _+_ = _+_) where
_≤_ : hPropRel X X ℓ'
x ≤ y = ¬(y < x)
postulate
sqrt : (x : X) → {{ ! [ 0ˣ ≤ x ] }} → X
0≤x² : ∀ x → [ 0ˣ ≤ (x · x) ]
instance -- module-scope instances
_ = λ {x} → !! 0≤x² x
test4 : (x y z : X) → [ 0ˣ ≤ x ] → [ 0ˣ ≤ y ] → X
test4 x y z 0≤x 0≤y =
let instance -- let-scope instances
_ = !! 0≤x
_ = !! 0≤y
_ = !! 0≤x² x -- preferred over the instance from module-scope
in ( (sqrt x) -- works
+ (sqrt y) -- also works
+ (sqrt (z · z)) -- uses instance from module scope
+ (sqrt (x · x)) -- uses instance from let-scope (?) -- NOTE: see https://github.com/agda/agda/issues/4688
)
| 28.892857
| 113
| 0.479604
|
0d74afdb4f065bab48d7b8170e28acd4ea6da472
| 482
|
agda
|
Agda
|
Univalence/FiniteType.agda
|
JacquesCarette/pi-dual
|
003835484facfde0b770bc2b3d781b42b76184c1
|
[
"BSD-2-Clause"
] | 14
|
2015-08-18T21:40:15.000Z
|
2021-05-05T01:07:57.000Z
|
Univalence/FiniteType.agda
|
JacquesCarette/pi-dual
|
003835484facfde0b770bc2b3d781b42b76184c1
|
[
"BSD-2-Clause"
] | 4
|
2018-06-07T16:27:41.000Z
|
2021-10-29T20:41:23.000Z
|
Univalence/FiniteType.agda
|
JacquesCarette/pi-dual
|
003835484facfde0b770bc2b3d781b42b76184c1
|
[
"BSD-2-Clause"
] | 3
|
2016-05-29T01:56:33.000Z
|
2019-09-10T09:47:13.000Z
|
{-# OPTIONS --without-K #-}
module FiniteType where
open import Equiv using (_≃_)
open import Data.Product using (Σ; _,_)
open import Data.Nat using (ℕ)
open import Data.Fin using (Fin)
--------------------------------------------------------------------------
--
-- A finite type is a type which is equivalent to Fin n
--
FiniteType : ∀ {ℓ} → (A : Set ℓ) → (n : ℕ) → Set ℓ
FiniteType A n = A ≃ Fin n
--------------------------------------------------------------------------
| 25.368421
| 74
| 0.446058
|
64de029c613f0dba1a89980bf6c88fcebe415b33
| 178
|
agda
|
Agda
|
test/Fail/Issue2467.agda
|
mdimjasevic/agda
|
8fb548356b275c7a1e79b768b64511ae937c738b
|
[
"BSD-3-Clause"
] | 1,989
|
2015-01-09T23:51:16.000Z
|
2022-03-30T18:20:48.000Z
|
test/Fail/Issue2467.agda
|
Seanpm2001-languages/agda
|
9911f73061e21a87fad76c662463257afe02c861
|
[
"BSD-2-Clause"
] | 4,066
|
2015-01-10T11:24:51.000Z
|
2022-03-31T21:14:49.000Z
|
test/Fail/Issue2467.agda
|
Seanpm2001-languages/agda
|
9911f73061e21a87fad76c662463257afe02c861
|
[
"BSD-2-Clause"
] | 371
|
2015-01-03T14:04:08.000Z
|
2022-03-30T19:00:30.000Z
|
-- Andreas, 2017-02-20, issue #2467
-- Proper error on missing BUILTIN REWRITE
{-# OPTIONS --rewriting #-}
postulate A : Set
{-# REWRITE A #-}
-- Should fail with error like
| 16.181818
| 42
| 0.662921
|
ccb26d7ec23c11b3705f3e10b829bdb95c50a159
| 844
|
agda
|
Agda
|
src/Generic/Lib/Data/Sets.agda
|
iblech/Generic
|
380554b20e0991290d1864ddf81f0587ec1647ed
|
[
"MIT"
] | 30
|
2016-07-19T21:10:54.000Z
|
2022-02-05T10:19:38.000Z
|
src/Generic/Lib/Data/Sets.agda
|
iblech/Generic
|
380554b20e0991290d1864ddf81f0587ec1647ed
|
[
"MIT"
] | 9
|
2017-04-06T18:58:09.000Z
|
2022-01-04T15:43:14.000Z
|
src/Generic/Lib/Data/Sets.agda
|
iblech/Generic
|
380554b20e0991290d1864ddf81f0587ec1647ed
|
[
"MIT"
] | 4
|
2017-07-17T07:23:39.000Z
|
2021-01-27T12:57:09.000Z
|
module Generic.Lib.Data.Sets where
open import Generic.Lib.Intro
open import Generic.Lib.Data.Nat
open import Generic.Lib.Data.Product
open import Generic.Lib.Data.Pow
infixl 6 _⊔ⁿ_
_⊔ⁿ_ : ∀ {n} -> Level ^ n -> Level -> Level
_⊔ⁿ_ = flip $ foldPow _ _⊔_
Sets : ∀ {n} -> (αs : Level ^ n) -> Set (mapPow lsuc αs ⊔ⁿ lzero)
Sets {0} _ = ⊤
Sets {suc _} (α , αs) = Set α × Sets αs
FoldSets : ∀ {n β αs} -> Sets {n} αs -> Set β -> Set (αs ⊔ⁿ β)
FoldSets {0} tt B = B
FoldSets {suc _} (A , As) B = A -> FoldSets As B
HList : ∀ {n} {αs} -> Sets {n} αs -> Set (αs ⊔ⁿ lzero)
HList {0} tt = ⊤
HList {suc _} (A , As) = A × HList As
applyFoldSets : ∀ {n β αs} {As : Sets {n} αs} {B : Set β} -> FoldSets As B -> HList As -> B
applyFoldSets {0} y tt = y
applyFoldSets {suc n} f (x , xs) = applyFoldSets (f x) xs
| 30.142857
| 91
| 0.566351
|
52db8884fd5e62288b7362064f3b1711d06920df
| 2,874
|
agda
|
Agda
|
agda-stdlib/src/Codata/Stream/Bisimilarity.agda
|
DreamLinuxer/popl21-artifact
|
fb380f2e67dcb4a94f353dbaec91624fcb5b8933
|
[
"MIT"
] | 5
|
2020-10-07T12:07:53.000Z
|
2020-10-10T21:41:32.000Z
|
agda-stdlib/src/Codata/Stream/Bisimilarity.agda
|
DreamLinuxer/popl21-artifact
|
fb380f2e67dcb4a94f353dbaec91624fcb5b8933
|
[
"MIT"
] | null | null | null |
agda-stdlib/src/Codata/Stream/Bisimilarity.agda
|
DreamLinuxer/popl21-artifact
|
fb380f2e67dcb4a94f353dbaec91624fcb5b8933
|
[
"MIT"
] | 1
|
2021-11-04T06:54:45.000Z
|
2021-11-04T06:54:45.000Z
|
------------------------------------------------------------------------
-- The Agda standard library
--
-- Bisimilarity for Streams
------------------------------------------------------------------------
{-# OPTIONS --without-K --safe --sized-types #-}
module Codata.Stream.Bisimilarity where
open import Size
open import Codata.Thunk
open import Codata.Stream
open import Level
open import Data.List.NonEmpty as List⁺ using (_∷_)
open import Data.List.Relation.Binary.Pointwise using (Pointwise; []; _∷_)
open import Relation.Binary
open import Relation.Binary.PropositionalEquality as Eq using (_≡_)
private
variable
a b c p q r : Level
A : Set a
B : Set b
C : Set c
i : Size
data Bisim {A : Set a} {B : Set b} (R : REL A B r) i :
REL (Stream A ∞) (Stream B ∞) (a ⊔ b ⊔ r) where
_∷_ : ∀ {x y xs ys} → R x y → Thunk^R (Bisim R) i xs ys →
Bisim R i (x ∷ xs) (y ∷ ys)
module _ {R : Rel A r} where
reflexive : Reflexive R → Reflexive (Bisim R i)
reflexive refl^R {r ∷ rs} = refl^R ∷ λ where .force → reflexive refl^R
module _ {P : REL A B p} {Q : REL B A q} where
symmetric : Sym P Q → Sym (Bisim P i) (Bisim Q i)
symmetric sym^PQ (p ∷ ps) = sym^PQ p ∷ λ where .force → symmetric sym^PQ (ps .force)
module _ {P : REL A B p} {Q : REL B C q} {R : REL A C r} where
transitive : Trans P Q R → Trans (Bisim P i) (Bisim Q i) (Bisim R i)
transitive trans^PQR (p ∷ ps) (q ∷ qs) =
trans^PQR p q ∷ λ where .force → transitive trans^PQR (ps .force) (qs .force)
isEquivalence : {R : Rel A r} → IsEquivalence R → IsEquivalence (Bisim R i)
isEquivalence equiv^R = record
{ refl = reflexive equiv^R.refl
; sym = symmetric equiv^R.sym
; trans = transitive equiv^R.trans
} where module equiv^R = IsEquivalence equiv^R
setoid : Setoid a r → Size → Setoid a (a ⊔ r)
setoid S i = record
{ isEquivalence = isEquivalence {i = i} (Setoid.isEquivalence S)
}
module _ {R : REL A B r} where
++⁺ : ∀ {as bs xs ys} → Pointwise R as bs →
Bisim R i xs ys → Bisim R i (as ++ xs) (bs ++ ys)
++⁺ [] rs = rs
++⁺ (r ∷ pw) rs = r ∷ λ where .force → ++⁺ pw rs
⁺++⁺ : ∀ {as bs xs ys} → Pointwise R (List⁺.toList as) (List⁺.toList bs) →
Thunk^R (Bisim R) i xs ys → Bisim R i (as ⁺++ xs) (bs ⁺++ ys)
⁺++⁺ (r ∷ pw) rs = r ∷ λ where .force → ++⁺ pw (rs .force)
------------------------------------------------------------------------
-- Pointwise Equality as a Bisimilarity
module _ {A : Set a} where
infix 1 _⊢_≈_
_⊢_≈_ : ∀ i → Stream A ∞ → Stream A ∞ → Set a
_⊢_≈_ = Bisim _≡_
refl : ∀ {i} → Reflexive (i ⊢_≈_)
refl = reflexive Eq.refl
sym : ∀ {i} → Symmetric (i ⊢_≈_)
sym = symmetric Eq.sym
trans : ∀ {i} → Transitive (i ⊢_≈_)
trans = transitive Eq.trans
module ≈-Reasoning {a} {A : Set a} {i} where
open import Relation.Binary.Reasoning.Setoid (setoid (Eq.setoid A) i) public
| 30.574468
| 85
| 0.561587
|
21339616155a17a0029ac36103ddb262df29aec8
| 5,766
|
agda
|
Agda
|
Cubical/HITs/AssocList/Properties.agda
|
FernandoLarrain/cubical
|
9acdecfa6437ec455568be4e5ff04849cc2bc13b
|
[
"MIT"
] | 301
|
2018-10-17T18:00:24.000Z
|
2022-03-24T02:10:47.000Z
|
Cubical/HITs/AssocList/Properties.agda
|
FernandoLarrain/cubical
|
9acdecfa6437ec455568be4e5ff04849cc2bc13b
|
[
"MIT"
] | 584
|
2018-10-15T09:49:02.000Z
|
2022-03-30T12:09:17.000Z
|
Cubical/HITs/AssocList/Properties.agda
|
FernandoLarrain/cubical
|
9acdecfa6437ec455568be4e5ff04849cc2bc13b
|
[
"MIT"
] | 134
|
2018-11-16T06:11:03.000Z
|
2022-03-23T16:22:13.000Z
|
{-# OPTIONS --safe #-}
module Cubical.HITs.AssocList.Properties where
open import Cubical.HITs.AssocList.Base as AL
open import Cubical.Foundations.Everything
open import Cubical.Foundations.SIP
open import Cubical.HITs.FiniteMultiset as FMS
open import Cubical.Data.Nat using (ℕ; zero; suc; _+_; +-assoc; isSetℕ)
open import Cubical.Structures.MultiSet
open import Cubical.Relation.Nullary
open import Cubical.Relation.Nullary.DecidableEq
private
variable
ℓ : Level
A : Type ℓ
multiPer : (a b : A) (m n : ℕ) (xs : AssocList A)
→ ⟨ a , m ⟩∷ ⟨ b , n ⟩∷ xs ≡ ⟨ b , n ⟩∷ ⟨ a , m ⟩∷ xs
multiPer a b zero n xs = del a (⟨ b , n ⟩∷ xs) ∙ cong (λ ys → ⟨ b , n ⟩∷ ys) (sym (del a xs))
multiPer a b (suc m) zero xs = cong (λ ys → ⟨ a , suc m ⟩∷ ys) (del b xs) ∙ sym (del b (⟨ a , suc m ⟩∷ xs))
multiPer a b (suc m) (suc n) xs =
⟨ a , suc m ⟩∷ ⟨ b , suc n ⟩∷ xs ≡⟨ sym (agg a 1 m (⟨ b , suc n ⟩∷ xs)) ⟩
⟨ a , 1 ⟩∷ ⟨ a , m ⟩∷ ⟨ b , suc n ⟩∷ xs ≡⟨ cong (λ ys → ⟨ a , 1 ⟩∷ ys) (multiPer a b m (suc n) xs) ⟩
⟨ a , 1 ⟩∷ ⟨ b , suc n ⟩∷ ⟨ a , m ⟩∷ xs ≡⟨ cong (λ ys → ⟨ a , 1 ⟩∷ ys) (sym (agg b 1 n (⟨ a , m ⟩∷ xs))) ⟩
⟨ a , 1 ⟩∷ ⟨ b , 1 ⟩∷ ⟨ b , n ⟩∷ ⟨ a , m ⟩∷ xs ≡⟨ per a b (⟨ b , n ⟩∷ ⟨ a , m ⟩∷ xs) ⟩
⟨ b , 1 ⟩∷ ⟨ a , 1 ⟩∷ ⟨ b , n ⟩∷ ⟨ a , m ⟩∷ xs ≡⟨ cong (λ ys → ⟨ b , 1 ⟩∷ ⟨ a , 1 ⟩∷ ys) (multiPer b a n m xs) ⟩
⟨ b , 1 ⟩∷ ⟨ a , 1 ⟩∷ ⟨ a , m ⟩∷ ⟨ b , n ⟩∷ xs ≡⟨ cong (λ ys → ⟨ b , 1 ⟩∷ ys) (agg a 1 m (⟨ b , n ⟩∷ xs)) ⟩
⟨ b , 1 ⟩∷ ⟨ a , suc m ⟩∷ ⟨ b , n ⟩∷ xs ≡⟨ cong (λ ys → ⟨ b , 1 ⟩∷ ys) (multiPer a b (suc m) n xs) ⟩
⟨ b , 1 ⟩∷ ⟨ b , n ⟩∷ ⟨ a , suc m ⟩∷ xs ≡⟨ agg b 1 n (⟨ a , suc m ⟩∷ xs) ⟩
⟨ b , suc n ⟩∷ ⟨ a , suc m ⟩∷ xs ∎
-- Show that association lists and finite multisets are equivalent
multi-∷ : A → ℕ → FMSet A → FMSet A
multi-∷ x zero xs = xs
multi-∷ x (suc n) xs = x ∷ multi-∷ x n xs
multi-∷-agg : (x : A) (m n : ℕ) (b : FMSet A) → multi-∷ x m (multi-∷ x n b) ≡ multi-∷ x (m + n) b
multi-∷-agg x zero n b = refl
multi-∷-agg x (suc m) n b i = x ∷ (multi-∷-agg x m n b i)
AL→FMS : AssocList A → FMSet A
AL→FMS = AL.Rec.f FMS.trunc [] multi-∷ comm multi-∷-agg λ _ _ → refl
FMS→AL : FMSet A → AssocList A
FMS→AL = FMS.Rec.f AL.trunc ⟨⟩ (λ x xs → ⟨ x , 1 ⟩∷ xs) per
AL→FMS∘FMS→AL≡id : section {A = AssocList A} AL→FMS FMS→AL
AL→FMS∘FMS→AL≡id = FMS.ElimProp.f (FMS.trunc _ _) refl (λ x p → cong (λ ys → x ∷ ys) p)
-- need a little lemma for other direction
multi-∷-id : (x : A) (n : ℕ) (u : FMSet A)
→ FMS→AL (multi-∷ x n u) ≡ ⟨ x , n ⟩∷ FMS→AL u
multi-∷-id x zero u = sym (del x (FMS→AL u))
multi-∷-id x (suc n) u = FMS→AL (multi-∷ x (suc n) u) ≡⟨ cong (λ ys → ⟨ x , 1 ⟩∷ ys) (multi-∷-id x n u) ⟩
⟨ x , 1 ⟩∷ ⟨ x , n ⟩∷ (FMS→AL u) ≡⟨ agg x 1 n (FMS→AL u) ⟩
⟨ x , (suc n) ⟩∷ (FMS→AL u) ∎
FMS→AL∘AL→FMS≡id : retract {A = AssocList A} AL→FMS FMS→AL
FMS→AL∘AL→FMS≡id = AL.ElimProp.f (AL.trunc _ _) refl (λ x n {xs} p → (multi-∷-id x n (AL→FMS xs)) ∙ cong (λ ys → ⟨ x , n ⟩∷ ys) p)
AssocList≃FMSet : AssocList A ≃ FMSet A
AssocList≃FMSet = isoToEquiv (iso AL→FMS FMS→AL AL→FMS∘FMS→AL≡id FMS→AL∘AL→FMS≡id)
FMSet≃AssocList : FMSet A ≃ AssocList A
FMSet≃AssocList = isoToEquiv (iso FMS→AL AL→FMS FMS→AL∘AL→FMS≡id AL→FMS∘FMS→AL≡id)
AssocList≡FMSet : AssocList A ≡ FMSet A
AssocList≡FMSet = ua AssocList≃FMSet
-- We want to define a multiset structure on AssocList A, we use the recursor to define the count-function
module _(discA : Discrete A) where
setA = Discrete→isSet discA
ALcount-⟨,⟩∷* : A → A → ℕ → ℕ → ℕ
ALcount-⟨,⟩∷* a x n xs with discA a x
... | yes a≡x = n + xs
... | no a≢x = xs
ALcount-per* : (a x y : A) (xs : ℕ)
→ ALcount-⟨,⟩∷* a x 1 (ALcount-⟨,⟩∷* a y 1 xs)
≡ ALcount-⟨,⟩∷* a y 1 (ALcount-⟨,⟩∷* a x 1 xs)
ALcount-per* a x y xs with discA a x | discA a y
ALcount-per* a x y xs | yes a≡x | yes a≡y = refl
ALcount-per* a x y xs | yes a≡x | no a≢y = refl
ALcount-per* a x y xs | no a≢x | yes a≡y = refl
ALcount-per* a x y xs | no a≢x | no a≢y = refl
ALcount-agg* : (a x : A) (m n xs : ℕ)
→ ALcount-⟨,⟩∷* a x m (ALcount-⟨,⟩∷* a x n xs)
≡ ALcount-⟨,⟩∷* a x (m + n) xs
ALcount-agg* a x m n xs with discA a x
... | yes _ = +-assoc m n xs
... | no _ = refl
ALcount-del* : (a x : A) (xs : ℕ) → ALcount-⟨,⟩∷* a x 0 xs ≡ xs
ALcount-del* a x xs with discA a x
... | yes _ = refl
... | no _ = refl
ALcount : A → AssocList A → ℕ
ALcount a = AL.Rec.f isSetℕ 0 (ALcount-⟨,⟩∷* a) (ALcount-per* a) (ALcount-agg* a) (ALcount-del* a)
AL-with-str : MultiSet A setA
AL-with-str = (AssocList A , ⟨⟩ , ⟨_, 1 ⟩∷_ , ALcount)
-- We want to show that Al-with-str ≅ FMS-with-str as multiset-structures
FMS→AL-EquivStr : MultiSetEquivStr A setA (FMS-with-str discA) (AL-with-str) FMSet≃AssocList
FMS→AL-EquivStr = refl , (λ a xs → refl) , φ
where
φ : ∀ a xs → FMScount discA a xs ≡ ALcount a (FMS→AL xs)
φ a = FMS.ElimProp.f (isSetℕ _ _) refl ψ
where
ψ : (x : A) {xs : FMSet A}
→ FMScount discA a xs ≡ ALcount a (FMS→AL xs)
→ FMScount discA a (x ∷ xs) ≡ ALcount a (FMS→AL (x ∷ xs))
ψ x {xs} p = subst B α θ
where
B = λ ys → FMScount discA a (x ∷ xs) ≡ ALcount a ys
α : ⟨ x , 1 ⟩∷ FMS→AL xs ≡ FMS→AL (x ∷ xs)
α = sym (multi-∷-id x 1 xs)
θ : FMScount discA a (x ∷ xs) ≡ ALcount a (⟨ x , 1 ⟩∷ (FMS→AL xs))
θ with discA a x
... | yes _ = cong suc p
... | no ¬p = p
FMS-with-str≡AL-with-str : FMS-with-str discA ≡ AL-with-str
FMS-with-str≡AL-with-str = sip (multiSetUnivalentStr A setA)
(FMS-with-str discA) AL-with-str
(FMSet≃AssocList , FMS→AL-EquivStr)
| 35.374233
| 130
| 0.524974
|
ed25dfc4f1cb4cd52153b5d160cfb8a43af1f590
| 353
|
agda
|
Agda
|
test/Succeed/Issue759.agda
|
mdimjasevic/agda
|
8fb548356b275c7a1e79b768b64511ae937c738b
|
[
"BSD-3-Clause"
] | 1,989
|
2015-01-09T23:51:16.000Z
|
2022-03-30T18:20:48.000Z
|
test/Succeed/Issue759.agda
|
Seanpm2001-languages/agda
|
9911f73061e21a87fad76c662463257afe02c861
|
[
"BSD-2-Clause"
] | 4,066
|
2015-01-10T11:24:51.000Z
|
2022-03-31T21:14:49.000Z
|
test/Succeed/Issue759.agda
|
Seanpm2001-languages/agda
|
9911f73061e21a87fad76c662463257afe02c861
|
[
"BSD-2-Clause"
] | 371
|
2015-01-03T14:04:08.000Z
|
2022-03-30T19:00:30.000Z
|
-- Andreas, 2012-11-18: abstract record values
module Issue759 where
import Common.Level
abstract
record Wrap (A : Set) : Set where
field wrapped : A
open Wrap public
wrap : {A : Set} → A → Wrap A
wrap a = record { wrapped = a }
-- caused 'Not in Scope: recCon-NOT-PRINTED'
-- during eta-contraction in serialization
-- should work now
| 19.611111
| 46
| 0.68272
|
65bb5f5c3ceb1f54e01b2b00796eaa5c9ea1e14a
| 597
|
agda
|
Agda
|
test/interaction/IntroSharp.agda
|
asr/agda-kanso
|
aa10ae6a29dc79964fe9dec2de07b9df28b61ed5
|
[
"MIT"
] | 1
|
2019-11-27T04:41:05.000Z
|
2019-11-27T04:41:05.000Z
|
test/interaction/IntroSharp.agda
|
np/agda-git-experiment
|
20596e9dd9867166a64470dd24ea68925ff380ce
|
[
"MIT"
] | null | null | null |
test/interaction/IntroSharp.agda
|
np/agda-git-experiment
|
20596e9dd9867166a64470dd24ea68925ff380ce
|
[
"MIT"
] | null | null | null |
-- The "intro" command manages to refine goals of type ∞ A with the
-- term ♯ ?.
{-# OPTIONS --universe-polymorphism #-}
module IntroSharp where
postulate
Level : Set
zero : Level
suc : (i : Level) → Level
_⊔_ : Level -> Level -> Level
{-# BUILTIN LEVEL Level #-}
{-# BUILTIN LEVELZERO zero #-}
{-# BUILTIN LEVELSUC suc #-}
{-# BUILTIN LEVELMAX _⊔_ #-}
postulate
∞ : ∀ {a} (A : Set a) → Set a
♯_ : ∀ {a} {A : Set a} → A → ∞ A
♭ : ∀ {a} {A : Set a} → ∞ A → A
{-# BUILTIN INFINITY ∞ #-}
{-# BUILTIN SHARP ♯_ #-}
{-# BUILTIN FLAT ♭ #-}
Foo : ∞ Set
Foo = ?
| 19.9
| 67
| 0.525963
|
1b139dd295afa6ec949d715e6d568b6a0ff76708
| 1,019
|
agda
|
Agda
|
test/Succeed/Issue2248.agda
|
Blaisorblade/Agda
|
802a28aa8374f15fe9d011ceb80317fdb1ec0949
|
[
"BSD-3-Clause"
] | 3
|
2015-03-28T14:51:03.000Z
|
2015-12-07T20:14:00.000Z
|
test/Succeed/Issue2248.agda
|
Blaisorblade/Agda
|
802a28aa8374f15fe9d011ceb80317fdb1ec0949
|
[
"BSD-3-Clause"
] | null | null | null |
test/Succeed/Issue2248.agda
|
Blaisorblade/Agda
|
802a28aa8374f15fe9d011ceb80317fdb1ec0949
|
[
"BSD-3-Clause"
] | null | null | null |
-- Andreas, 2016-10-11, AIM XXIV
-- COMPILED pragma accidentially also accepted for abstract definitions
-- Ulf, 2017-02-22: We now allow COMPILE pragmas on functions, and abstract
-- functions should not be an exception. The original problem, however, was
-- that we expected an unused argument-version of the function to be available.
-- This is not the case for COMPILE'd functions. This problem has now been
-- fixed.
open import Common.String
data Unit : Set where
unit : Unit
{-# COMPILE GHC Unit = data () (()) #-}
postulate
IO : Set → Set
doNothing : IO Unit
doSomething : String → IO Unit
{-# COMPILE GHC IO = type IO #-}
{-# BUILTIN IO IO #-}
{-# COMPILE GHC doNothing = return () #-}
{-# FOREIGN GHC import qualified Data.Text.IO #-}
abstract
putStrLn : Unit → String → IO Unit
putStrLn _ = doSomething
{-# COMPILE GHC putStrLn = \ _ -> Data.Text.IO.putStrLn #-}
main = putStrLn unit "Hello, world!"
-- WAS: compiler produced ill-formed Haskell-code
-- NOW: Error on COMPILE GHC pragma
| 27.540541
| 79
| 0.698724
|
cc015b38f33caaf785fb43bf32423daec0b288d9
| 176
|
agda
|
Agda
|
Cubical/HITs/FiniteMultiset.agda
|
FernandoLarrain/cubical
|
9acdecfa6437ec455568be4e5ff04849cc2bc13b
|
[
"MIT"
] | 301
|
2018-10-17T18:00:24.000Z
|
2022-03-24T02:10:47.000Z
|
Cubical/HITs/FiniteMultiset.agda
|
FernandoLarrain/cubical
|
9acdecfa6437ec455568be4e5ff04849cc2bc13b
|
[
"MIT"
] | 584
|
2018-10-15T09:49:02.000Z
|
2022-03-30T12:09:17.000Z
|
Cubical/HITs/FiniteMultiset.agda
|
FernandoLarrain/cubical
|
9acdecfa6437ec455568be4e5ff04849cc2bc13b
|
[
"MIT"
] | 134
|
2018-11-16T06:11:03.000Z
|
2022-03-23T16:22:13.000Z
|
{-# OPTIONS --safe #-}
module Cubical.HITs.FiniteMultiset where
open import Cubical.HITs.FiniteMultiset.Base public
open import Cubical.HITs.FiniteMultiset.Properties public
| 25.142857
| 57
| 0.8125
|
edb0768f06f2da5d43973894b2ea64e7b22cb87f
| 5,697
|
agda
|
Agda
|
agda-stdlib/README/Text/Tabular.agda
|
DreamLinuxer/popl21-artifact
|
fb380f2e67dcb4a94f353dbaec91624fcb5b8933
|
[
"MIT"
] | 5
|
2020-10-07T12:07:53.000Z
|
2020-10-10T21:41:32.000Z
|
agda-stdlib/README/Text/Tabular.agda
|
DreamLinuxer/popl21-artifact
|
fb380f2e67dcb4a94f353dbaec91624fcb5b8933
|
[
"MIT"
] | null | null | null |
agda-stdlib/README/Text/Tabular.agda
|
DreamLinuxer/popl21-artifact
|
fb380f2e67dcb4a94f353dbaec91624fcb5b8933
|
[
"MIT"
] | 1
|
2021-11-04T06:54:45.000Z
|
2021-11-04T06:54:45.000Z
|
------------------------------------------------------------------------
-- The Agda standard library
--
-- Examples of printing list and vec-based tables
------------------------------------------------------------------------
{-# OPTIONS --safe --without-K #-}
module README.Text.Tabular where
open import Function.Base
open import Relation.Binary.PropositionalEquality
open import Data.List.Base
open import Data.String.Base
open import Data.Vec.Base
open import Text.Tabular.Base
import Text.Tabular.List as Tabularˡ
import Text.Tabular.Vec as Tabularᵛ
------------------------------------------------------------------------
-- VEC
--
-- If you have a matrix of strings, you simply need to:
-- * pick a configuration (see below)
-- * pick an alignment for each column
-- * pass the matrix
--
-- The display function will then pad each string on the left, right,
-- or both to respect the alignment constraints.
-- It will return a list of strings corresponding to each line in the
-- table. You may then:
--- * use Data.String.Base's unlines to produce a String
-- * use Text.Pretty's text and vcat to produce a Doc (i.e. indentable!)
------------------------------------------------------------------------
_ : unlines (Tabularᵛ.display unicode
(Right ∷ Left ∷ Center ∷ [])
( ("foo" ∷ "bar" ∷ "baz" ∷ [])
∷ ("1" ∷ "2" ∷ "3" ∷ [])
∷ ("6" ∷ "5" ∷ "4" ∷ [])
∷ []))
≡ "┌───┬───┬───┐
\ \│foo│bar│baz│
\ \├───┼───┼───┤
\ \│ 1│2 │ 3 │
\ \├───┼───┼───┤
\ \│ 6│5 │ 4 │
\ \└───┴───┴───┘"
_ = refl
------------------------------------------------------------------------
-- CONFIG
--
-- Configurations allow you to change the way the table is displayed.
------------------------------------------------------------------------
-- We will use the same example throughout
foobar : Vec (Vec String 2) 3
foobar = ("foo" ∷ "bar" ∷ [])
∷ ("1" ∷ "2" ∷ [])
∷ ("4" ∷ "3" ∷ [])
∷ []
------------------------------------------------------------------------
-- Basic configurations: unicode, ascii, whitespace
-- unicode
_ : unlines (Tabularᵛ.display unicode
(Right ∷ Left ∷ [])
foobar)
≡ "┌───┬───┐
\ \│foo│bar│
\ \├───┼───┤
\ \│ 1│2 │
\ \├───┼───┤
\ \│ 4│3 │
\ \└───┴───┘"
_ = refl
-- ascii
_ : unlines (Tabularᵛ.display ascii
(Right ∷ Left ∷ [])
foobar)
≡ "+-------+
\ \|foo|bar|
\ \|---+---|
\ \| 1|2 |
\ \|---+---|
\ \| 4|3 |
\ \+-------+"
_ = refl
-- whitespace
_ : unlines (Tabularᵛ.display whitespace
(Right ∷ Left ∷ [])
foobar)
≡ "foo bar
\ \ 1 2
\ \ 4 3 "
_ = refl
------------------------------------------------------------------------
-- Modifiers: altering existing configurations
-- In these examples we will be using unicode as the base configuration.
-- However these modifiers apply to all configurations (and can even be
-- combined)
-- compact: drop the horizontal line between each row
_ : unlines (Tabularᵛ.display (compact unicode)
(Right ∷ Left ∷ [])
foobar)
≡ "┌───┬───┐
\ \│foo│bar│
\ \│ 1│2 │
\ \│ 4│3 │
\ \└───┴───┘"
_ = refl
-- noBorder: drop the outside borders
_ : unlines (Tabularᵛ.display (noBorder unicode)
(Right ∷ Left ∷ [])
foobar)
≡ "foo│bar
\ \───┼───
\ \ 1│2
\ \───┼───
\ \ 4│3 "
_ = refl
-- addSpace : add whitespace space inside cells
_ : unlines (Tabularᵛ.display (addSpace unicode)
(Right ∷ Left ∷ [])
foobar)
≡ "┌─────┬─────┐
\ \│ foo │ bar │
\ \├─────┼─────┤
\ \│ 1 │ 2 │
\ \├─────┼─────┤
\ \│ 4 │ 3 │
\ \└─────┴─────┘"
_ = refl
-- compact together with addSpace
_ : unlines (Tabularᵛ.display (compact (addSpace unicode))
(Right ∷ Left ∷ [])
foobar)
≡ "┌─────┬─────┐
\ \│ foo │ bar │
\ \│ 1 │ 2 │
\ \│ 4 │ 3 │
\ \└─────┴─────┘"
_ = refl
------------------------------------------------------------------------
-- LIST
--
-- Same thing as for vectors except that if the list of lists is not
-- rectangular, it is padded with empty strings to make it so. If there
-- are not enough alignment directives, we arbitrarily pick Left.
------------------------------------------------------------------------
_ : unlines (Tabularˡ.display unicode
(Center ∷ Right ∷ [])
( ("foo" ∷ "bar" ∷ [])
∷ ("partial" ∷ "rows" ∷ "are" ∷ "ok" ∷ [])
∷ ("3" ∷ "2" ∷ "1" ∷ "..." ∷ "surprise!" ∷ [])
∷ []))
≡ "┌───────┬────┬───┬───┬─────────┐
\ \│ foo │ bar│ │ │ │
\ \├───────┼────┼───┼───┼─────────┤
\ \│partial│rows│are│ok │ │
\ \├───────┼────┼───┼───┼─────────┤
\ \│ 3 │ 2│1 │...│surprise!│
\ \└───────┴────┴───┴───┴─────────┘"
_ = refl
------------------------------------------------------------------------
-- LIST (UNSAFE)
--
-- If you know *for sure* that your data is already perfectly rectangular
-- i.e. all the rows of the list of lists have the same length
-- in each column, all the strings have the same width
-- then you can use the unsafeDisplay function defined Text.Tabular.Base.
--
-- This is what gets used internally by `Text.Tabular.Vec` and
-- `Text.Tabular.List` once the potentially unsafe data has been
-- processed.
------------------------------------------------------------------------
_ : unlines (unsafeDisplay (compact unicode)
( ("foo" ∷ "bar" ∷ [])
∷ (" 1" ∷ " 2" ∷ [])
∷ (" 4" ∷ " 3" ∷ [])
∷ []))
≡ "┌───┬───┐
\ \│foo│bar│
\ \│ 1│ 2│
\ \│ 4│ 3│
\ \└───┴───┘"
_ = refl
| 26.746479
| 74
| 0.415833
|
659af290ca653a205aba9307ac867e1586dbff20
| 4,121
|
agda
|
Agda
|
out/CommRing/Syntax.agda
|
JoeyEremondi/agda-soas
|
ff1a985a6be9b780d3ba2beff68e902394f0a9d8
|
[
"MIT"
] | 39
|
2021-11-09T20:39:55.000Z
|
2022-03-19T17:33:12.000Z
|
out/CommRing/Syntax.agda
|
JoeyEremondi/agda-soas
|
ff1a985a6be9b780d3ba2beff68e902394f0a9d8
|
[
"MIT"
] | 1
|
2021-11-21T12:19:32.000Z
|
2021-11-21T12:19:32.000Z
|
out/CommRing/Syntax.agda
|
JoeyEremondi/agda-soas
|
ff1a985a6be9b780d3ba2beff68e902394f0a9d8
|
[
"MIT"
] | 4
|
2021-11-09T20:39:59.000Z
|
2022-01-24T12:49:17.000Z
|
{-
This second-order term syntax was created from the following second-order syntax description:
syntax CommRing | CR
type
* : 0-ary
term
zero : * | 𝟘
add : * * -> * | _⊕_ l20
one : * | 𝟙
mult : * * -> * | _⊗_ l30
neg : * -> * | ⊖_ r50
theory
(𝟘U⊕ᴸ) a |> add (zero, a) = a
(𝟘U⊕ᴿ) a |> add (a, zero) = a
(⊕A) a b c |> add (add(a, b), c) = add (a, add(b, c))
(⊕C) a b |> add(a, b) = add(b, a)
(𝟙U⊗ᴸ) a |> mult (one, a) = a
(𝟙U⊗ᴿ) a |> mult (a, one) = a
(⊗A) a b c |> mult (mult(a, b), c) = mult (a, mult(b, c))
(⊗D⊕ᴸ) a b c |> mult (a, add (b, c)) = add (mult(a, b), mult(a, c))
(⊗D⊕ᴿ) a b c |> mult (add (a, b), c) = add (mult(a, c), mult(b, c))
(𝟘X⊗ᴸ) a |> mult (zero, a) = zero
(𝟘X⊗ᴿ) a |> mult (a, zero) = zero
(⊖N⊕ᴸ) a |> add (neg (a), a) = zero
(⊖N⊕ᴿ) a |> add (a, neg (a)) = zero
(⊗C) a b |> mult(a, b) = mult(b, a)
-}
module CommRing.Syntax where
open import SOAS.Common
open import SOAS.Context
open import SOAS.Variable
open import SOAS.Families.Core
open import SOAS.Construction.Structure
open import SOAS.ContextMaps.Inductive
open import SOAS.Metatheory.Syntax
open import CommRing.Signature
private
variable
Γ Δ Π : Ctx
α : *T
𝔛 : Familyₛ
-- Inductive term declaration
module CR:Terms (𝔛 : Familyₛ) where
data CR : Familyₛ where
var : ℐ ⇾̣ CR
mvar : 𝔛 α Π → Sub CR Π Γ → CR α Γ
𝟘 : CR * Γ
_⊕_ : CR * Γ → CR * Γ → CR * Γ
𝟙 : CR * Γ
_⊗_ : CR * Γ → CR * Γ → CR * Γ
⊖_ : CR * Γ → CR * Γ
infixl 20 _⊕_
infixl 30 _⊗_
infixr 50 ⊖_
open import SOAS.Metatheory.MetaAlgebra ⅀F 𝔛
CRᵃ : MetaAlg CR
CRᵃ = record
{ 𝑎𝑙𝑔 = λ where
(zeroₒ ⋮ _) → 𝟘
(addₒ ⋮ a , b) → _⊕_ a b
(oneₒ ⋮ _) → 𝟙
(multₒ ⋮ a , b) → _⊗_ a b
(negₒ ⋮ a) → ⊖_ a
; 𝑣𝑎𝑟 = var ; 𝑚𝑣𝑎𝑟 = λ 𝔪 mε → mvar 𝔪 (tabulate mε) }
module CRᵃ = MetaAlg CRᵃ
module _ {𝒜 : Familyₛ}(𝒜ᵃ : MetaAlg 𝒜) where
open MetaAlg 𝒜ᵃ
𝕤𝕖𝕞 : CR ⇾̣ 𝒜
𝕊 : Sub CR Π Γ → Π ~[ 𝒜 ]↝ Γ
𝕊 (t ◂ σ) new = 𝕤𝕖𝕞 t
𝕊 (t ◂ σ) (old v) = 𝕊 σ v
𝕤𝕖𝕞 (mvar 𝔪 mε) = 𝑚𝑣𝑎𝑟 𝔪 (𝕊 mε)
𝕤𝕖𝕞 (var v) = 𝑣𝑎𝑟 v
𝕤𝕖𝕞 𝟘 = 𝑎𝑙𝑔 (zeroₒ ⋮ tt)
𝕤𝕖𝕞 (_⊕_ a b) = 𝑎𝑙𝑔 (addₒ ⋮ 𝕤𝕖𝕞 a , 𝕤𝕖𝕞 b)
𝕤𝕖𝕞 𝟙 = 𝑎𝑙𝑔 (oneₒ ⋮ tt)
𝕤𝕖𝕞 (_⊗_ a b) = 𝑎𝑙𝑔 (multₒ ⋮ 𝕤𝕖𝕞 a , 𝕤𝕖𝕞 b)
𝕤𝕖𝕞 (⊖_ a) = 𝑎𝑙𝑔 (negₒ ⋮ 𝕤𝕖𝕞 a)
𝕤𝕖𝕞ᵃ⇒ : MetaAlg⇒ CRᵃ 𝒜ᵃ 𝕤𝕖𝕞
𝕤𝕖𝕞ᵃ⇒ = record
{ ⟨𝑎𝑙𝑔⟩ = λ{ {t = t} → ⟨𝑎𝑙𝑔⟩ t }
; ⟨𝑣𝑎𝑟⟩ = refl
; ⟨𝑚𝑣𝑎𝑟⟩ = λ{ {𝔪 = 𝔪}{mε} → cong (𝑚𝑣𝑎𝑟 𝔪) (dext (𝕊-tab mε)) } }
where
open ≡-Reasoning
⟨𝑎𝑙𝑔⟩ : (t : ⅀ CR α Γ) → 𝕤𝕖𝕞 (CRᵃ.𝑎𝑙𝑔 t) ≡ 𝑎𝑙𝑔 (⅀₁ 𝕤𝕖𝕞 t)
⟨𝑎𝑙𝑔⟩ (zeroₒ ⋮ _) = refl
⟨𝑎𝑙𝑔⟩ (addₒ ⋮ _) = refl
⟨𝑎𝑙𝑔⟩ (oneₒ ⋮ _) = refl
⟨𝑎𝑙𝑔⟩ (multₒ ⋮ _) = refl
⟨𝑎𝑙𝑔⟩ (negₒ ⋮ _) = refl
𝕊-tab : (mε : Π ~[ CR ]↝ Γ)(v : ℐ α Π) → 𝕊 (tabulate mε) v ≡ 𝕤𝕖𝕞 (mε v)
𝕊-tab mε new = refl
𝕊-tab mε (old v) = 𝕊-tab (mε ∘ old) v
module _ (g : CR ⇾̣ 𝒜)(gᵃ⇒ : MetaAlg⇒ CRᵃ 𝒜ᵃ g) where
open MetaAlg⇒ gᵃ⇒
𝕤𝕖𝕞! : (t : CR α Γ) → 𝕤𝕖𝕞 t ≡ g t
𝕊-ix : (mε : Sub CR Π Γ)(v : ℐ α Π) → 𝕊 mε v ≡ g (index mε v)
𝕊-ix (x ◂ mε) new = 𝕤𝕖𝕞! x
𝕊-ix (x ◂ mε) (old v) = 𝕊-ix mε v
𝕤𝕖𝕞! (mvar 𝔪 mε) rewrite cong (𝑚𝑣𝑎𝑟 𝔪) (dext (𝕊-ix mε))
= trans (sym ⟨𝑚𝑣𝑎𝑟⟩) (cong (g ∘ mvar 𝔪) (tab∘ix≈id mε))
𝕤𝕖𝕞! (var v) = sym ⟨𝑣𝑎𝑟⟩
𝕤𝕖𝕞! 𝟘 = sym ⟨𝑎𝑙𝑔⟩
𝕤𝕖𝕞! (_⊕_ a b) rewrite 𝕤𝕖𝕞! a | 𝕤𝕖𝕞! b = sym ⟨𝑎𝑙𝑔⟩
𝕤𝕖𝕞! 𝟙 = sym ⟨𝑎𝑙𝑔⟩
𝕤𝕖𝕞! (_⊗_ a b) rewrite 𝕤𝕖𝕞! a | 𝕤𝕖𝕞! b = sym ⟨𝑎𝑙𝑔⟩
𝕤𝕖𝕞! (⊖_ a) rewrite 𝕤𝕖𝕞! a = sym ⟨𝑎𝑙𝑔⟩
-- Syntax instance for the signature
CR:Syn : Syntax
CR:Syn = record
{ ⅀F = ⅀F
; ⅀:CS = ⅀:CompatStr
; mvarᵢ = CR:Terms.mvar
; 𝕋:Init = λ 𝔛 → let open CR:Terms 𝔛 in record
{ ⊥ = CR ⋉ CRᵃ
; ⊥-is-initial = record { ! = λ{ {𝒜 ⋉ 𝒜ᵃ} → 𝕤𝕖𝕞 𝒜ᵃ ⋉ 𝕤𝕖𝕞ᵃ⇒ 𝒜ᵃ }
; !-unique = λ{ {𝒜 ⋉ 𝒜ᵃ} (f ⋉ fᵃ⇒) {x = t} → 𝕤𝕖𝕞! 𝒜ᵃ f fᵃ⇒ t } } } }
-- Instantiation of the syntax and metatheory
open Syntax CR:Syn public
open CR:Terms public
open import SOAS.Families.Build public
open import SOAS.Syntax.Shorthands CRᵃ public
open import SOAS.Metatheory CR:Syn public
| 26.587097
| 93
| 0.502063
|
ccc3cb23b821c63c1bcd1b57dceda8d7b8b816da
| 3,537
|
agda
|
Agda
|
agda-stdlib-0.9/src/Data/Star/Properties.agda
|
qwe2/try-agda
|
9d4c43b1609d3f085636376fdca73093481ab882
|
[
"Apache-2.0"
] | 1
|
2016-10-20T15:52:05.000Z
|
2016-10-20T15:52:05.000Z
|
agda-stdlib-0.9/src/Data/Star/Properties.agda
|
qwe2/try-agda
|
9d4c43b1609d3f085636376fdca73093481ab882
|
[
"Apache-2.0"
] | null | null | null |
agda-stdlib-0.9/src/Data/Star/Properties.agda
|
qwe2/try-agda
|
9d4c43b1609d3f085636376fdca73093481ab882
|
[
"Apache-2.0"
] | null | null | null |
------------------------------------------------------------------------
-- The Agda standard library
--
-- Some properties related to Data.Star
------------------------------------------------------------------------
module Data.Star.Properties where
open import Data.Star
open import Function
open import Relation.Binary
open import Relation.Binary.PropositionalEquality as PropEq
using (_≡_; refl; sym; cong; cong₂)
import Relation.Binary.PreorderReasoning as PreR
◅◅-assoc : ∀ {i t} {I : Set i} {T : Rel I t} {i j k l}
(xs : Star T i j) (ys : Star T j k)
(zs : Star T k l) →
(xs ◅◅ ys) ◅◅ zs ≡ xs ◅◅ (ys ◅◅ zs)
◅◅-assoc ε ys zs = refl
◅◅-assoc (x ◅ xs) ys zs = cong (_◅_ x) (◅◅-assoc xs ys zs)
gmap-id : ∀ {i t} {I : Set i} {T : Rel I t} {i j} (xs : Star T i j) →
gmap id id xs ≡ xs
gmap-id ε = refl
gmap-id (x ◅ xs) = cong (_◅_ x) (gmap-id xs)
gmap-∘ : ∀ {i t} {I : Set i} {T : Rel I t}
{j u} {J : Set j} {U : Rel J u}
{k v} {K : Set k} {V : Rel K v}
(f : J → K) (g : U =[ f ]⇒ V)
(f′ : I → J) (g′ : T =[ f′ ]⇒ U)
{i j} (xs : Star T i j) →
(gmap {U = V} f g ∘ gmap f′ g′) xs ≡ gmap (f ∘ f′) (g ∘ g′) xs
gmap-∘ f g f′ g′ ε = refl
gmap-∘ f g f′ g′ (x ◅ xs) = cong (_◅_ (g (g′ x))) (gmap-∘ f g f′ g′ xs)
gmap-◅◅ : ∀ {i t j u}
{I : Set i} {T : Rel I t} {J : Set j} {U : Rel J u}
(f : I → J) (g : T =[ f ]⇒ U)
{i j k} (xs : Star T i j) (ys : Star T j k) →
gmap {U = U} f g (xs ◅◅ ys) ≡ gmap f g xs ◅◅ gmap f g ys
gmap-◅◅ f g ε ys = refl
gmap-◅◅ f g (x ◅ xs) ys = cong (_◅_ (g x)) (gmap-◅◅ f g xs ys)
gmap-cong : ∀ {i t j u}
{I : Set i} {T : Rel I t} {J : Set j} {U : Rel J u}
(f : I → J) (g : T =[ f ]⇒ U) (g′ : T =[ f ]⇒ U) →
(∀ {i j} (x : T i j) → g x ≡ g′ x) →
∀ {i j} (xs : Star T i j) →
gmap {U = U} f g xs ≡ gmap f g′ xs
gmap-cong f g g′ eq ε = refl
gmap-cong f g g′ eq (x ◅ xs) = cong₂ _◅_ (eq x) (gmap-cong f g g′ eq xs)
fold-◅◅ : ∀ {i p} {I : Set i}
(P : Rel I p) (_⊕_ : Transitive P) (∅ : Reflexive P) →
(∀ {i j} (x : P i j) → ∅ ⊕ x ≡ x) →
(∀ {i j k l} (x : P i j) (y : P j k) (z : P k l) →
(x ⊕ y) ⊕ z ≡ x ⊕ (y ⊕ z)) →
∀ {i j k} (xs : Star P i j) (ys : Star P j k) →
fold P _⊕_ ∅ (xs ◅◅ ys) ≡ fold P _⊕_ ∅ xs ⊕ fold P _⊕_ ∅ ys
fold-◅◅ P _⊕_ ∅ left-unit assoc ε ys = sym (left-unit _)
fold-◅◅ P _⊕_ ∅ left-unit assoc (x ◅ xs) ys = begin
x ⊕ fold P _⊕_ ∅ (xs ◅◅ ys) ≡⟨ cong (_⊕_ x) $
fold-◅◅ P _⊕_ ∅ left-unit assoc xs ys ⟩
x ⊕ (fold P _⊕_ ∅ xs ⊕ fold P _⊕_ ∅ ys) ≡⟨ sym (assoc x _ _) ⟩
(x ⊕ fold P _⊕_ ∅ xs) ⊕ fold P _⊕_ ∅ ys ∎
where open PropEq.≡-Reasoning
-- Reflexive transitive closures are preorders.
preorder : ∀ {i t} {I : Set i} (T : Rel I t) → Preorder _ _ _
preorder T = record
{ _≈_ = _≡_
; _∼_ = Star T
; isPreorder = record
{ isEquivalence = PropEq.isEquivalence
; reflexive = reflexive
; trans = _◅◅_
}
}
where
reflexive : _≡_ ⇒ Star T
reflexive refl = ε
-- Preorder reasoning for Star.
module StarReasoning {i t} {I : Set i} (T : Rel I t) where
open PreR (preorder T) public
renaming (_∼⟨_⟩_ to _⟶⋆⟨_⟩_; _≈⟨_⟩_ to _≡⟨_⟩_)
infixr 2 _⟶⟨_⟩_
_⟶⟨_⟩_ : ∀ x {y z} → T x y → y IsRelatedTo z → x IsRelatedTo z
x ⟶⟨ x⟶y ⟩ y⟶⋆z = x ⟶⋆⟨ x⟶y ◅ ε ⟩ y⟶⋆z
| 36.84375
| 88
| 0.430025
|
3745d842ecf979acff52051a0650f96fc4ca98da
| 265
|
agda
|
Agda
|
test/fail/WithoutK5.agda
|
dagit/agda
|
4383a3d20328a6c43689161496cee8eb479aca08
|
[
"MIT"
] | 1
|
2019-11-27T07:26:06.000Z
|
2019-11-27T07:26:06.000Z
|
test/fail/WithoutK5.agda
|
np/agda-git-experiment
|
20596e9dd9867166a64470dd24ea68925ff380ce
|
[
"MIT"
] | null | null | null |
test/fail/WithoutK5.agda
|
np/agda-git-experiment
|
20596e9dd9867166a64470dd24ea68925ff380ce
|
[
"MIT"
] | null | null | null |
{-# OPTIONS --without-K --show-implicit #-}
module WithoutK5 where
-- Equality defined with one index.
data _≡_ {A : Set} (x : A) : A → Set where
refl : x ≡ x
weak-K : {A : Set} {a b : A} (p q : a ≡ b) (α β : p ≡ q) → α ≡ β
weak-K refl .refl refl refl = refl
| 22.083333
| 64
| 0.558491
|
523bedea1f509a50cc239b76a4b76c60ae95976c
| 9,284
|
agda
|
Agda
|
Cubical/Algebra/Magma/MorphismProperties.agda
|
kiana-S/univalent-foundations
|
8bdb0766260489f9c89a14f4c0f2ad26e5190dec
|
[
"MIT"
] | null | null | null |
Cubical/Algebra/Magma/MorphismProperties.agda
|
kiana-S/univalent-foundations
|
8bdb0766260489f9c89a14f4c0f2ad26e5190dec
|
[
"MIT"
] | null | null | null |
Cubical/Algebra/Magma/MorphismProperties.agda
|
kiana-S/univalent-foundations
|
8bdb0766260489f9c89a14f4c0f2ad26e5190dec
|
[
"MIT"
] | null | null | null |
{-# OPTIONS --cubical --no-import-sorts --safe #-}
module Cubical.Algebra.Magma.MorphismProperties where
open import Cubical.Foundations.Prelude
open import Cubical.Foundations.Isomorphism
open import Cubical.Foundations.Equiv
open import Cubical.Foundations.Equiv.HalfAdjoint
open import Cubical.Foundations.HLevels
open import Cubical.Foundations.Univalence
open import Cubical.Foundations.SIP
open import Cubical.Foundations.Function using (_∘_; id)
open import Cubical.Foundations.GroupoidLaws
open import Cubical.Functions.Embedding
open import Cubical.Data.Sigma
open import Cubical.Data.Prod using (isPropProd)
open import Cubical.Algebra
open import Cubical.Algebra.Properties
open import Cubical.Algebra.Magma.Morphism
open import Cubical.Structures.Axioms
open import Cubical.Structures.Auto
open import Cubical.Structures.Record
open import Cubical.Relation.Binary.Reasoning.Equality
open Iso
private
variable
ℓ ℓ′ ℓ′′ : Level
L : Magma ℓ
M : Magma ℓ′
N : Magma ℓ′′
isPropIsMagmaHom : ∀ (M : Magma ℓ) (N : Magma ℓ′) f → isProp (IsMagmaHom M N f)
isPropIsMagmaHom M N f = isPropHomomorphic₂ (Magma.is-set N) f (Magma._•_ M) (Magma._•_ N)
isSetMagmaHom : isSet (M ⟶ᴴ N)
isSetMagmaHom {M = M} {N = N} = isOfHLevelRespectEquiv 2 equiv
(isSetΣ (isSetΠ λ _ → is-set N)
(λ f → isProp→isSet (isPropIsMagmaHom M N f)))
where
open Magma
equiv : (Σ[ g ∈ (⟨ M ⟩ → ⟨ N ⟩) ] IsMagmaHom M N g) ≃ MagmaHom M N
equiv = isoToEquiv (iso (λ (g , m) → magmahom g m)
(λ (magmahom g m) → g , m)
(λ _ → refl) λ _ → refl)
isMagmaHomComp : {f : ⟨ L ⟩ → ⟨ M ⟩} {g : ⟨ M ⟩ → ⟨ N ⟩} →
IsMagmaHom L M f → IsMagmaHom M N g → IsMagmaHom L N (g ∘ f)
isMagmaHomComp {g = g} fHom gHom _ _ = cong g (fHom _ _) ∙ gHom _ _
private
isMagmaHomComp′ : (f : L ⟶ᴴ M) (g : M ⟶ᴴ N) →
IsMagmaHom L N (MagmaHom.fun g ∘ MagmaHom.fun f)
isMagmaHomComp′ (magmahom f fHom) (magmahom g gHom) _ _ = cong g (fHom _ _) ∙ gHom _ _
compMagmaHom : (L ⟶ᴴ M) → (M ⟶ᴴ N) → (L ⟶ᴴ N)
compMagmaHom f g = magmahom _ (isMagmaHomComp′ f g)
compMagmaEquiv : L ≃ᴴ M → M ≃ᴴ N → L ≃ᴴ N
compMagmaEquiv f g = magmaequiv (compEquiv f.eq g.eq) (isMagmaHomComp′ f.hom g.hom)
where
module f = MagmaEquiv f
module g = MagmaEquiv g
isMagmaHomId : (M : Magma ℓ) → IsMagmaHom M M id
isMagmaHomId M _ _ = refl
idMagmaHom : (M : Magma ℓ) → (M ⟶ᴴ M)
idMagmaHom M = record
{ fun = id
; isHom = isMagmaHomId M
}
idMagmaEquiv : (M : Magma ℓ) → M ≃ᴴ M
idMagmaEquiv M = record
{ eq = idEquiv ⟨ M ⟩
; isHom = isMagmaHomId M
}
-- Isomorphism inversion
isMagmaHomInv : (eqv : M ≃ᴴ N) → IsMagmaHom N M (invEq (MagmaEquiv.eq eqv))
isMagmaHomInv {M = M} {N = N} (magmaequiv eq isHom) x y = isInj-f _ _ (
f (f⁻¹ (x •ᴺ y)) ≡⟨ retEq eq _ ⟩
x •ᴺ y ≡˘⟨ cong₂ _•ᴺ_ (retEq eq x) (retEq eq y) ⟩
f (f⁻¹ x) •ᴺ f (f⁻¹ y) ≡˘⟨ isHom (f⁻¹ x) (f⁻¹ y) ⟩
f (f⁻¹ x •ᴹ f⁻¹ y) ∎)
where
_•ᴹ_ = Magma._•_ M
_•ᴺ_ = Magma._•_ N
f = equivFun eq
f⁻¹ = invEq eq
isInj-f : (x y : ⟨ M ⟩) → f x ≡ f y → x ≡ y
isInj-f x y = invEq (_ , isEquiv→isEmbedding (eq .snd) x y)
invMagmaHom : M ≃ᴴ N → (N ⟶ᴴ M)
invMagmaHom eq = record { isHom = isMagmaHomInv eq }
invMagmaEquiv : (M ≃ᴴ N) → (N ≃ᴴ M)
invMagmaEquiv eq = record
{ eq = invEquiv (MagmaEquiv.eq eq)
; isHom = isMagmaHomInv eq
}
magmaHomEq : {f g : M ⟶ᴴ N} → (MagmaHom.fun f ≡ MagmaHom.fun g) → f ≡ g
magmaHomEq {M = M} {N = N} {magmahom f fm} {magmahom g gm} p i = magmahom (p i) (p-hom i)
where
p-hom : PathP (λ i → IsMagmaHom M N (p i)) fm gm
p-hom = toPathP (isPropIsMagmaHom M N _ _ _)
magmaEquivEq : {f g : M ≃ᴴ N} → (MagmaEquiv.eq f ≡ MagmaEquiv.eq g) → f ≡ g
magmaEquivEq {M = M} {N = N} {magmaequiv f fm} {magmaequiv g gm} p i = magmaequiv (p i) (p-hom i)
where
p-hom : PathP (λ i → IsMagmaHom M N (p i .fst)) fm gm
p-hom = toPathP (isPropIsMagmaHom M N _ _ _)
module MagmaΣTheory {ℓ} where
RawMagmaStructure : Type ℓ → Type ℓ
RawMagmaStructure A = A → A → A
RawMagmaEquivStr = AutoEquivStr RawMagmaStructure
rawMagmaUnivalentStr : UnivalentStr _ RawMagmaEquivStr
rawMagmaUnivalentStr = autoUnivalentStr RawMagmaStructure
MagmaAxioms : (A : Type ℓ) → RawMagmaStructure A → Type ℓ
MagmaAxioms A _•_ = isSet A
MagmaStructure : Type ℓ → Type ℓ
MagmaStructure = AxiomsStructure RawMagmaStructure MagmaAxioms
MagmaΣ : Type (ℓ-suc ℓ)
MagmaΣ = TypeWithStr ℓ MagmaStructure
isPropMagmaAxioms : (A : Type ℓ) (_•_ : RawMagmaStructure A)
→ isProp (MagmaAxioms A _•_)
isPropMagmaAxioms _ _ = isPropIsSet
MagmaEquivStr : StrEquiv MagmaStructure ℓ
MagmaEquivStr = AxiomsEquivStr RawMagmaEquivStr MagmaAxioms
MagmaAxiomsIsoIsMagma : {A : Type ℓ} (_•_ : RawMagmaStructure A)
→ Iso (MagmaAxioms A _•_) (IsMagma A _•_)
fun (MagmaAxiomsIsoIsMagma s) x = ismagma x
inv (MagmaAxiomsIsoIsMagma s) (ismagma x) = x
rightInv (MagmaAxiomsIsoIsMagma s) _ = refl
leftInv (MagmaAxiomsIsoIsMagma s) _ = refl
MagmaAxioms≡IsMagma : {A : Type ℓ} (_•_ : RawMagmaStructure A)
→ MagmaAxioms A _•_ ≡ IsMagma A _•_
MagmaAxioms≡IsMagma s = isoToPath (MagmaAxiomsIsoIsMagma s)
Magma→MagmaΣ : Magma ℓ → MagmaΣ
Magma→MagmaΣ (mkmagma A _•_ isMagma) =
A , _•_ , MagmaAxiomsIsoIsMagma _ .inv isMagma
MagmaΣ→Magma : MagmaΣ → Magma ℓ
MagmaΣ→Magma (A , _•_ , isMagma•) =
mkmagma A _•_ (MagmaAxiomsIsoIsMagma _ .fun isMagma•)
MagmaIsoMagmaΣ : Iso (Magma ℓ) MagmaΣ
MagmaIsoMagmaΣ =
iso Magma→MagmaΣ MagmaΣ→Magma (λ _ → refl) (λ _ → refl)
magmaUnivalentStr : UnivalentStr MagmaStructure MagmaEquivStr
magmaUnivalentStr = axiomsUnivalentStr _ isPropMagmaAxioms rawMagmaUnivalentStr
MagmaΣPath : (M N : MagmaΣ) → (M ≃[ MagmaEquivStr ] N) ≃ (M ≡ N)
MagmaΣPath = SIP magmaUnivalentStr
MagmaEquivΣ : (M N : Magma ℓ) → Type ℓ
MagmaEquivΣ M N = Magma→MagmaΣ M ≃[ MagmaEquivStr ] Magma→MagmaΣ N
MagmaIsoΣPath : {M N : Magma ℓ} → Iso (MagmaEquiv M N) (MagmaEquivΣ M N)
fun MagmaIsoΣPath (magmaequiv e h) = (e , h)
inv MagmaIsoΣPath (e , h) = magmaequiv e h
rightInv MagmaIsoΣPath _ = refl
leftInv MagmaIsoΣPath _ = refl
MagmaPath : (M N : Magma ℓ) → (MagmaEquiv M N) ≃ (M ≡ N)
MagmaPath M N =
MagmaEquiv M N ≃⟨ isoToEquiv MagmaIsoΣPath ⟩
MagmaEquivΣ M N ≃⟨ MagmaΣPath _ _ ⟩
Magma→MagmaΣ M ≡ Magma→MagmaΣ N ≃⟨ isoToEquiv (invIso (congIso MagmaIsoMagmaΣ)) ⟩
M ≡ N ■
RawMagmaΣ : Type (ℓ-suc ℓ)
RawMagmaΣ = TypeWithStr ℓ RawMagmaStructure
Magma→RawMagmaΣ : Magma ℓ → RawMagmaΣ
Magma→RawMagmaΣ M = (⟨ M ⟩ , Magma._•_ M)
InducedMagma : (M : Magma ℓ) (N : RawMagmaΣ) (e : ⟨ M ⟩ ≃ ⟨ N ⟩)
→ RawMagmaEquivStr (Magma→RawMagmaΣ M) N e → Magma ℓ
InducedMagma M N e r =
MagmaΣ→Magma (inducedStructure rawMagmaUnivalentStr (Magma→MagmaΣ M) N (e , r))
InducedMagmaPath : (M : Magma ℓ) (N : RawMagmaΣ) (e : ⟨ M ⟩ ≃ ⟨ N ⟩)
(E : RawMagmaEquivStr (Magma→RawMagmaΣ M) N e)
→ M ≡ InducedMagma M N e E
InducedMagmaPath M N e E =
MagmaPath M (InducedMagma M N e E) .fst (magmaequiv e E)
open MagmaΣTheory public using (InducedMagma; InducedMagmaPath)
MagmaPath : (M ≃ᴴ N) ≃ (M ≡ N)
MagmaPath = MagmaΣTheory.MagmaPath _ _
open Magma
uaMagma : M ≃ᴴ N → M ≡ N
uaMagma = equivFun MagmaPath
carac-uaMagma : {M N : Magma ℓ} (f : M ≃ᴴ N) → cong Carrier (uaMagma f) ≡ ua (MagmaEquiv.eq f)
carac-uaMagma (magmaequiv f m) =
(refl ∙∙ ua f ∙∙ refl)
≡˘⟨ rUnit (ua f) ⟩
ua f ∎
Magma≡ : (M N : Magma ℓ) → (
Σ[ p ∈ ⟨ M ⟩ ≡ ⟨ N ⟩ ]
Σ[ q ∈ PathP (λ i → p i → p i → p i) (_•_ M) (_•_ N) ]
PathP (λ i → IsMagma (p i) (q i)) (isMagma M) (isMagma N))
≃ (M ≡ N)
Magma≡ M N = isoToEquiv (iso
(λ (p , q , r) i → mkmagma (p i) (q i) (r i))
(λ p → cong Carrier p , cong _•_ p , cong isMagma p)
(λ _ → refl) (λ _ → refl))
caracMagma≡ : (p q : M ≡ N) → cong Carrier p ≡ cong Carrier q → p ≡ q
caracMagma≡ {M = M} {N = N} p q t = cong (Magma≡ M N .fst) (Σ≡Prop (λ _ →
isPropΣ
(isOfHLevelPathP' 1 (isSetΠ2 λ _ _ → is-set N) _ _) λ _ →
isOfHLevelPathP 1 (λ { (ismagma x) (ismagma y) → cong ismagma (isPropIsSet x y) }) _ _)
t)
uaMagmaId : (M : Magma ℓ) → uaMagma (idMagmaEquiv M) ≡ refl
uaMagmaId M = caracMagma≡ _ _ (carac-uaMagma (idMagmaEquiv M) ∙ uaIdEquiv)
uaCompMagmaEquiv : {L M N : Magma ℓ} (f : L ≃ᴴ M) (g : M ≃ᴴ N)
→ uaMagma (compMagmaEquiv f g) ≡ uaMagma f ∙ uaMagma g
uaCompMagmaEquiv f g = caracMagma≡ _ _ (
cong Carrier (uaMagma (compMagmaEquiv f g))
≡⟨ carac-uaMagma (compMagmaEquiv f g) ⟩
ua (eq (compMagmaEquiv f g))
≡⟨ uaCompEquiv _ _ ⟩
ua (eq f) ∙ ua (eq g)
≡⟨ cong (_∙ ua (eq g)) (sym (carac-uaMagma f)) ⟩
cong Carrier (uaMagma f) ∙ ua (eq g)
≡⟨ cong (cong Carrier (uaMagma f) ∙_) (sym (carac-uaMagma g)) ⟩
cong Carrier (uaMagma f) ∙ cong Carrier (uaMagma g)
≡⟨ sym (cong-∙ Carrier (uaMagma f) (uaMagma g)) ⟩
cong Carrier (uaMagma f ∙ uaMagma g) ∎)
where open MagmaEquiv
| 35.707692
| 97
| 0.621069
|
1a0416e472bdad83a9ded3dca03908b866b48a6c
| 1,258
|
agda
|
Agda
|
prototyping/Luau/Heap.agda
|
FreakingBarbarians/luau
|
5187e64f88953f34785ffe58acd0610ee5041f5f
|
[
"MIT"
] | 1
|
2022-02-11T21:30:17.000Z
|
2022-02-11T21:30:17.000Z
|
prototyping/Luau/Heap.agda
|
FreakingBarbarians/luau
|
5187e64f88953f34785ffe58acd0610ee5041f5f
|
[
"MIT"
] | null | null | null |
prototyping/Luau/Heap.agda
|
FreakingBarbarians/luau
|
5187e64f88953f34785ffe58acd0610ee5041f5f
|
[
"MIT"
] | null | null | null |
module Luau.Heap where
open import Agda.Builtin.Equality using (_≡_)
open import FFI.Data.Maybe using (Maybe; just)
open import FFI.Data.Vector using (Vector; length; snoc; empty)
open import Luau.Addr using (Addr)
open import Luau.Var using (Var)
open import Luau.Syntax using (Block; Expr; nil; addr; function⟨_⟩_end)
data HeapValue : Set where
function_⟨_⟩_end : Var → Var → Block → HeapValue
Heap = Vector HeapValue
data _≡_⊕_↦_ : Heap → Heap → Addr → HeapValue → Set where
defn : ∀ {H val} →
-----------------------------------
(snoc H val) ≡ H ⊕ (length H) ↦ val
lookup : Heap → Addr → Maybe HeapValue
lookup = FFI.Data.Vector.lookup
emp : Heap
emp = empty
data AllocResult (H : Heap) (V : HeapValue) : Set where
ok : ∀ a H′ → (H′ ≡ H ⊕ a ↦ V) → AllocResult H V
alloc : ∀ H V → AllocResult H V
alloc H V = ok (length H) (snoc H V) defn
next : Heap → Addr
next = length
allocated : Heap → HeapValue → Heap
allocated = snoc
-- next-emp : (length empty ≡ 0)
next-emp = FFI.Data.Vector.length-empty
-- lookup-next : ∀ V H → (lookup (allocated H V) (next H) ≡ just V)
lookup-next = FFI.Data.Vector.lookup-snoc
-- lookup-next-emp : ∀ V → (lookup (allocated emp V) 0 ≡ just V)
lookup-next-emp = FFI.Data.Vector.lookup-snoc-empty
| 25.673469
| 71
| 0.651828
|
Subsets and Splits
HTML Code Excluding Scripts
The query retrieves a limited set of HTML content entries that are longer than 8 characters and do not contain script tags, offering only basic filtering with minimal analytical value.