Search is not available for this dataset
text
string | meta
dict |
---|---|
{-# OPTIONS --safe #-}
module STLC.Syntax where
open import Data.Nat using (ℕ; suc)
open import Data.Fin using (Fin) renaming (zero to fzero; suc to fsuc)
open import Relation.Binary.PropositionalEquality using (_≡_; refl)
open import Relation.Nullary using (Dec; yes; no)
private
variable
n : ℕ
data Type : Set where
_⇒_ : Type → Type → Type
_×'_ : Type → Type → Type
unit : Type
data Term : ℕ → Set where
abs : Type → Term (suc n) → Term n
app : Term n → Term n → Term n
var : Fin n → Term n
⋆ : Term n
pair : Term n → Term n → Term n
projₗ : Term n → Term n
projᵣ : Term n → Term n
data Ctx : ℕ → Set where
● : Ctx 0
_,-_ : Ctx n → Type → Ctx (suc n)
find : Ctx n → Fin n → Type
find (Γ ,- A) fzero = A
find (Γ ,- A) (fsuc n) = find Γ n
_=?=_ : (x : Type) → (y : Type) → Dec (x ≡ y)
unit =?= unit = yes refl
(a ⇒ b) =?= (c ⇒ d) with a =?= c | b =?= d
... | yes refl | yes refl = yes refl
... | yes refl | no ne = no λ { refl → ne refl }
... | no ne | _ = no λ { refl → ne refl }
(a ×' b) =?= (c ×' d) with a =?= c | b =?= d
... | yes refl | yes refl = yes refl
... | yes refl | no ne = no λ { refl → ne refl }
... | no ne | _ = no λ { refl → ne refl }
unit =?= (_ ×' _) = no λ ()
unit =?= (_ ⇒ _) = no λ ()
(_ ×' _) =?= unit = no λ ()
(_ ×' _) =?= (_ ⇒ _) = no λ ()
(_ ⇒ _) =?= unit = no λ ()
(_ ⇒ _) =?= (_ ×' _) = no λ ()
| {
"alphanum_fraction": 0.4893029676,
"avg_line_length": 28.4117647059,
"ext": "agda",
"hexsha": "9713e3eea62d0238ba67ffa1f3eb728dfcc45451",
"lang": "Agda",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "59bc9648f326b7359801fb31ff6f957a166876fc",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "TrulyNonstrict/STLC",
"max_forks_repo_path": "STLC/Syntax.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "59bc9648f326b7359801fb31ff6f957a166876fc",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "TrulyNonstrict/STLC",
"max_issues_repo_path": "STLC/Syntax.agda",
"max_line_length": 70,
"max_stars_count": 1,
"max_stars_repo_head_hexsha": "59bc9648f326b7359801fb31ff6f957a166876fc",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "TrulyNonstrict/STLC",
"max_stars_repo_path": "STLC/Syntax.agda",
"max_stars_repo_stars_event_max_datetime": "2020-04-10T14:58:46.000Z",
"max_stars_repo_stars_event_min_datetime": "2020-04-10T14:58:46.000Z",
"num_tokens": 530,
"size": 1449
} |
------------------------------------------------------------------------------
-- Totality properties of the gcd
------------------------------------------------------------------------------
{-# OPTIONS --exact-split #-}
{-# OPTIONS --no-sized-types #-}
{-# OPTIONS --no-universe-polymorphism #-}
{-# OPTIONS --without-K #-}
module FOTC.Program.GCD.Partial.TotalityI where
open import FOTC.Base
open import FOTC.Base.PropertiesI
open import FOTC.Data.Nat
open import FOTC.Data.Nat.Induction.NonAcc.LexicographicI
open import FOTC.Data.Nat.Inequalities
open import FOTC.Data.Nat.Inequalities.EliminationPropertiesI
open import FOTC.Data.Nat.Inequalities.PropertiesI
open import FOTC.Data.Nat.PropertiesI
open import FOTC.Program.GCD.Partial.ConversionRulesI
open import FOTC.Program.GCD.Partial.Definitions
open import FOTC.Program.GCD.Partial.GCD
------------------------------------------------------------------------------
-- gcd 0 (succ n) is total.
gcd-0S-N : ∀ {n} → N n → N (gcd zero (succ₁ n))
gcd-0S-N {n} Nn = subst N (sym (gcd-0S n)) (nsucc Nn)
------------------------------------------------------------------------------
-- gcd (succ₁ n) 0 is total.
gcd-S0-N : ∀ {n} → N n → N (gcd (succ₁ n) zero)
gcd-S0-N {n} Nn = subst N (sym (gcd-S0 n)) (nsucc Nn)
------------------------------------------------------------------------------
-- gcd (succ₁ m) (succ₁ n) when succ₁ m > succ₁ n is total.
gcd-S>S-N : ∀ {m n} → N m → N n →
N (gcd (succ₁ m ∸ succ₁ n) (succ₁ n)) →
succ₁ m > succ₁ n →
N (gcd (succ₁ m) (succ₁ n))
gcd-S>S-N {m} {n} Nm Nn ih Sm>Sn = subst N (sym (gcd-S>S m n Sm>Sn)) ih
------------------------------------------------------------------------------
-- gcd (succ₁ m) (succ₁ n) when succ₁ m ≯ succ₁ n is total.
gcd-S≯S-N : ∀ {m n} → N m → N n →
N (gcd (succ₁ m) (succ₁ n ∸ succ₁ m)) →
succ₁ m ≯ succ₁ n →
N (gcd (succ₁ m) (succ₁ n))
gcd-S≯S-N {m} {n} Nm Nn ih Sm≯Sn = subst N (sym (gcd-S≯S m n Sm≯Sn)) ih
------------------------------------------------------------------------------
-- gcd m n when m > n is total.
gcd-x>y-N :
∀ {m n} → N m → N n →
(∀ {o p} → N o → N p → Lexi o p m n → x≢0≢y o p → N (gcd o p)) →
m > n →
x≢0≢y m n →
N (gcd m n)
gcd-x>y-N nzero Nn _ 0>n _ = ⊥-elim (0>x→⊥ Nn 0>n)
gcd-x>y-N (nsucc Nm) nzero _ _ _ = gcd-S0-N Nm
gcd-x>y-N (nsucc {m} Nm) (nsucc {n} Nn) ah Sm>Sn _ =
gcd-S>S-N Nm Nn ih Sm>Sn
where
-- Inductive hypothesis.
ih : N (gcd (succ₁ m ∸ succ₁ n) (succ₁ n))
ih = ah {succ₁ m ∸ succ₁ n}
{succ₁ n}
(∸-N (nsucc Nm) (nsucc Nn))
(nsucc Nn)
([Sx∸Sy,Sy]<[Sx,Sy] Nm Nn)
(λ p → ⊥-elim (S≢0 (∧-proj₂ p)))
------------------------------------------------------------------------------
-- gcd m n when m ≯ n is total.
gcd-x≯y-N :
∀ {m n} → N m → N n →
(∀ {o p} → N o → N p → Lexi o p m n → x≢0≢y o p → N (gcd o p)) →
m ≯ n →
x≢0≢y m n →
N (gcd m n)
gcd-x≯y-N nzero nzero _ _ h = ⊥-elim (h (refl , refl))
gcd-x≯y-N nzero (nsucc Nn) _ _ _ = gcd-0S-N Nn
gcd-x≯y-N (nsucc _) nzero _ Sm≯0 _ = ⊥-elim (S≯0→⊥ Sm≯0)
gcd-x≯y-N (nsucc {m} Nm) (nsucc {n} Nn) ah Sm≯Sn _ = gcd-S≯S-N Nm Nn ih Sm≯Sn
where
-- Inductive hypothesis.
ih : N (gcd (succ₁ m) (succ₁ n ∸ succ₁ m))
ih = ah {succ₁ m}
{succ₁ n ∸ succ₁ m}
(nsucc Nm)
(∸-N (nsucc Nn) (nsucc Nm))
([Sx,Sy∸Sx]<[Sx,Sy] Nm Nn)
(λ p → ⊥-elim (S≢0 (∧-proj₁ p)))
------------------------------------------------------------------------------
-- gcd m n when m ≢ 0 and n ≢ 0 is total.
gcd-N : ∀ {m n} → N m → N n → x≢0≢y m n → N (gcd m n)
gcd-N = Lexi-wfind A h
where
A : D → D → Set
A i j = x≢0≢y i j → N (gcd i j)
h : ∀ {i j} → N i → N j → (∀ {k l} → N k → N l → Lexi k l i j → A k l) →
A i j
h Ni Nj ah = case (gcd-x>y-N Ni Nj ah) (gcd-x≯y-N Ni Nj ah) (x>y∨x≯y Ni Nj)
| {
"alphanum_fraction": 0.4316885693,
"avg_line_length": 38.4095238095,
"ext": "agda",
"hexsha": "ffe28795f600df14f8ded0bfd275a1a17aaa6fd6",
"lang": "Agda",
"max_forks_count": 3,
"max_forks_repo_forks_event_max_datetime": "2018-03-14T08:50:00.000Z",
"max_forks_repo_forks_event_min_datetime": "2016-09-19T14:18:30.000Z",
"max_forks_repo_head_hexsha": "2fc9f2b81052a2e0822669f02036c5750371b72d",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "asr/fotc",
"max_forks_repo_path": "src/fot/FOTC/Program/GCD/Partial/TotalityI.agda",
"max_issues_count": 2,
"max_issues_repo_head_hexsha": "2fc9f2b81052a2e0822669f02036c5750371b72d",
"max_issues_repo_issues_event_max_datetime": "2017-01-01T14:34:26.000Z",
"max_issues_repo_issues_event_min_datetime": "2016-10-12T17:28:16.000Z",
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "asr/fotc",
"max_issues_repo_path": "src/fot/FOTC/Program/GCD/Partial/TotalityI.agda",
"max_line_length": 78,
"max_stars_count": 11,
"max_stars_repo_head_hexsha": "2fc9f2b81052a2e0822669f02036c5750371b72d",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "asr/fotc",
"max_stars_repo_path": "src/fot/FOTC/Program/GCD/Partial/TotalityI.agda",
"max_stars_repo_stars_event_max_datetime": "2021-09-12T16:09:54.000Z",
"max_stars_repo_stars_event_min_datetime": "2015-09-03T20:53:42.000Z",
"num_tokens": 1446,
"size": 4033
} |
{-# OPTIONS --rewriting #-}
open import Agda.Builtin.Bool
open import Agda.Builtin.Equality
{-# BUILTIN REWRITE _≡_ #-}
data D (A : Set) : Set where
c c' : D A
module M (A : Set) where
postulate rew : c {A} ≡ c' {A}
{-# REWRITE rew #-}
test : ∀ {B} → c {B} ≡ c' {B}
test = refl
| {
"alphanum_fraction": 0.5646258503,
"avg_line_length": 16.3333333333,
"ext": "agda",
"hexsha": "b70e49352fad7b73e8dc3ccaf07c60eb411dbe64",
"lang": "Agda",
"max_forks_count": 1,
"max_forks_repo_forks_event_max_datetime": "2015-09-15T14:36:15.000Z",
"max_forks_repo_forks_event_min_datetime": "2015-09-15T14:36:15.000Z",
"max_forks_repo_head_hexsha": "231d6ad8e77b67ff8c4b1cb35a6c31ccd988c3e9",
"max_forks_repo_licenses": [
"BSD-3-Clause"
],
"max_forks_repo_name": "Agda-zh/agda",
"max_forks_repo_path": "test/Fail/RewriteConstructorParsNotGeneral2.agda",
"max_issues_count": 3,
"max_issues_repo_head_hexsha": "aac88412199dd4cbcb041aab499d8a6b7e3f4a2e",
"max_issues_repo_issues_event_max_datetime": "2019-04-01T19:39:26.000Z",
"max_issues_repo_issues_event_min_datetime": "2018-11-14T15:31:44.000Z",
"max_issues_repo_licenses": [
"BSD-3-Clause"
],
"max_issues_repo_name": "hborum/agda",
"max_issues_repo_path": "test/Fail/RewriteConstructorParsNotGeneral2.agda",
"max_line_length": 33,
"max_stars_count": 2,
"max_stars_repo_head_hexsha": "aac88412199dd4cbcb041aab499d8a6b7e3f4a2e",
"max_stars_repo_licenses": [
"BSD-3-Clause"
],
"max_stars_repo_name": "hborum/agda",
"max_stars_repo_path": "test/Fail/RewriteConstructorParsNotGeneral2.agda",
"max_stars_repo_stars_event_max_datetime": "2020-09-20T00:28:57.000Z",
"max_stars_repo_stars_event_min_datetime": "2019-10-29T09:40:30.000Z",
"num_tokens": 108,
"size": 294
} |
{-
This second-order term syntax was created from the following second-order syntax description:
syntax QIO
type
T : 0-ary
P : 0-ary
term
new : P.T -> T
measure : P T T -> T
applyX : P P.T -> T
applyI2 : P P.T -> T
applyDuv : P P (P,P).T -> T
applyDu : P P.T -> T
applyDv : P P.T -> T
theory
(A) a:P t u:T |> applyX (a, b.measure(b, t, u)) = measure(a, u, t)
(B) a:P b:P t u:P.T |> measure(a, applyDu(b, b.t[b]), applyDv(b, b.u[b])) = applyDuv(a, b, a b.measure(a, t[b], u[b]))
(D) t u:T |> new(a.measure(a, t, u)) = t
(E) b:P t:(P, P).T |> new(a.applyDuv(a, b, a b. t[a,b])) = applyDu(b, b.new(a.t[a,b]))
-}
module QIO.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 QIO.Signature
private
variable
Γ Δ Π : Ctx
α : QIOT
𝔛 : Familyₛ
-- Inductive term declaration
module QIO:Terms (𝔛 : Familyₛ) where
data QIO : Familyₛ where
var : ℐ ⇾̣ QIO
mvar : 𝔛 α Π → Sub QIO Π Γ → QIO α Γ
new : QIO T (P ∙ Γ) → QIO T Γ
measure : QIO P Γ → QIO T Γ → QIO T Γ → QIO T Γ
applyX : QIO P Γ → QIO T (P ∙ Γ) → QIO T Γ
applyI2 : QIO P Γ → QIO T (P ∙ Γ) → QIO T Γ
applyDuv : QIO P Γ → QIO P Γ → QIO T (P ∙ P ∙ Γ) → QIO T Γ
applyDu : QIO P Γ → QIO T (P ∙ Γ) → QIO T Γ
applyDv : QIO P Γ → QIO T (P ∙ Γ) → QIO T Γ
open import SOAS.Metatheory.MetaAlgebra ⅀F 𝔛
QIOᵃ : MetaAlg QIO
QIOᵃ = record
{ 𝑎𝑙𝑔 = λ where
(newₒ ⋮ a) → new a
(measureₒ ⋮ a , b , c) → measure a b c
(applyXₒ ⋮ a , b) → applyX a b
(applyI2ₒ ⋮ a , b) → applyI2 a b
(applyDuvₒ ⋮ a , b , c) → applyDuv a b c
(applyDuₒ ⋮ a , b) → applyDu a b
(applyDvₒ ⋮ a , b) → applyDv a b
; 𝑣𝑎𝑟 = var ; 𝑚𝑣𝑎𝑟 = λ 𝔪 mε → mvar 𝔪 (tabulate mε) }
module QIOᵃ = MetaAlg QIOᵃ
module _ {𝒜 : Familyₛ}(𝒜ᵃ : MetaAlg 𝒜) where
open MetaAlg 𝒜ᵃ
𝕤𝕖𝕞 : QIO ⇾̣ 𝒜
𝕊 : Sub QIO Π Γ → Π ~[ 𝒜 ]↝ Γ
𝕊 (t ◂ σ) new = 𝕤𝕖𝕞 t
𝕊 (t ◂ σ) (old v) = 𝕊 σ v
𝕤𝕖𝕞 (mvar 𝔪 mε) = 𝑚𝑣𝑎𝑟 𝔪 (𝕊 mε)
𝕤𝕖𝕞 (var v) = 𝑣𝑎𝑟 v
𝕤𝕖𝕞 (new a) = 𝑎𝑙𝑔 (newₒ ⋮ 𝕤𝕖𝕞 a)
𝕤𝕖𝕞 (measure a b c) = 𝑎𝑙𝑔 (measureₒ ⋮ 𝕤𝕖𝕞 a , 𝕤𝕖𝕞 b , 𝕤𝕖𝕞 c)
𝕤𝕖𝕞 (applyX a b) = 𝑎𝑙𝑔 (applyXₒ ⋮ 𝕤𝕖𝕞 a , 𝕤𝕖𝕞 b)
𝕤𝕖𝕞 (applyI2 a b) = 𝑎𝑙𝑔 (applyI2ₒ ⋮ 𝕤𝕖𝕞 a , 𝕤𝕖𝕞 b)
𝕤𝕖𝕞 (applyDuv a b c) = 𝑎𝑙𝑔 (applyDuvₒ ⋮ 𝕤𝕖𝕞 a , 𝕤𝕖𝕞 b , 𝕤𝕖𝕞 c)
𝕤𝕖𝕞 (applyDu a b) = 𝑎𝑙𝑔 (applyDuₒ ⋮ 𝕤𝕖𝕞 a , 𝕤𝕖𝕞 b)
𝕤𝕖𝕞 (applyDv a b) = 𝑎𝑙𝑔 (applyDvₒ ⋮ 𝕤𝕖𝕞 a , 𝕤𝕖𝕞 b)
𝕤𝕖𝕞ᵃ⇒ : MetaAlg⇒ QIOᵃ 𝒜ᵃ 𝕤𝕖𝕞
𝕤𝕖𝕞ᵃ⇒ = record
{ ⟨𝑎𝑙𝑔⟩ = λ{ {t = t} → ⟨𝑎𝑙𝑔⟩ t }
; ⟨𝑣𝑎𝑟⟩ = refl
; ⟨𝑚𝑣𝑎𝑟⟩ = λ{ {𝔪 = 𝔪}{mε} → cong (𝑚𝑣𝑎𝑟 𝔪) (dext (𝕊-tab mε)) } }
where
open ≡-Reasoning
⟨𝑎𝑙𝑔⟩ : (t : ⅀ QIO α Γ) → 𝕤𝕖𝕞 (QIOᵃ.𝑎𝑙𝑔 t) ≡ 𝑎𝑙𝑔 (⅀₁ 𝕤𝕖𝕞 t)
⟨𝑎𝑙𝑔⟩ (newₒ ⋮ _) = refl
⟨𝑎𝑙𝑔⟩ (measureₒ ⋮ _) = refl
⟨𝑎𝑙𝑔⟩ (applyXₒ ⋮ _) = refl
⟨𝑎𝑙𝑔⟩ (applyI2ₒ ⋮ _) = refl
⟨𝑎𝑙𝑔⟩ (applyDuvₒ ⋮ _) = refl
⟨𝑎𝑙𝑔⟩ (applyDuₒ ⋮ _) = refl
⟨𝑎𝑙𝑔⟩ (applyDvₒ ⋮ _) = refl
𝕊-tab : (mε : Π ~[ QIO ]↝ Γ)(v : ℐ α Π) → 𝕊 (tabulate mε) v ≡ 𝕤𝕖𝕞 (mε v)
𝕊-tab mε new = refl
𝕊-tab mε (old v) = 𝕊-tab (mε ∘ old) v
module _ (g : QIO ⇾̣ 𝒜)(gᵃ⇒ : MetaAlg⇒ QIOᵃ 𝒜ᵃ g) where
open MetaAlg⇒ gᵃ⇒
𝕤𝕖𝕞! : (t : QIO α Γ) → 𝕤𝕖𝕞 t ≡ g t
𝕊-ix : (mε : Sub QIO Π Γ)(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 ⟨𝑣𝑎𝑟⟩
𝕤𝕖𝕞! (new a) rewrite 𝕤𝕖𝕞! a = sym ⟨𝑎𝑙𝑔⟩
𝕤𝕖𝕞! (measure a b c) rewrite 𝕤𝕖𝕞! a | 𝕤𝕖𝕞! b | 𝕤𝕖𝕞! c = sym ⟨𝑎𝑙𝑔⟩
𝕤𝕖𝕞! (applyX a b) rewrite 𝕤𝕖𝕞! a | 𝕤𝕖𝕞! b = sym ⟨𝑎𝑙𝑔⟩
𝕤𝕖𝕞! (applyI2 a b) rewrite 𝕤𝕖𝕞! a | 𝕤𝕖𝕞! b = sym ⟨𝑎𝑙𝑔⟩
𝕤𝕖𝕞! (applyDuv a b c) rewrite 𝕤𝕖𝕞! a | 𝕤𝕖𝕞! b | 𝕤𝕖𝕞! c = sym ⟨𝑎𝑙𝑔⟩
𝕤𝕖𝕞! (applyDu a b) rewrite 𝕤𝕖𝕞! a | 𝕤𝕖𝕞! b = sym ⟨𝑎𝑙𝑔⟩
𝕤𝕖𝕞! (applyDv a b) rewrite 𝕤𝕖𝕞! a | 𝕤𝕖𝕞! b = sym ⟨𝑎𝑙𝑔⟩
-- Syntax instance for the signature
QIO:Syn : Syntax
QIO:Syn = record
{ ⅀F = ⅀F
; ⅀:CS = ⅀:CompatStr
; mvarᵢ = QIO:Terms.mvar
; 𝕋:Init = λ 𝔛 → let open QIO:Terms 𝔛 in record
{ ⊥ = QIO ⋉ QIOᵃ
; ⊥-is-initial = record { ! = λ{ {𝒜 ⋉ 𝒜ᵃ} → 𝕤𝕖𝕞 𝒜ᵃ ⋉ 𝕤𝕖𝕞ᵃ⇒ 𝒜ᵃ }
; !-unique = λ{ {𝒜 ⋉ 𝒜ᵃ} (f ⋉ fᵃ⇒) {x = t} → 𝕤𝕖𝕞! 𝒜ᵃ f fᵃ⇒ t } } } }
-- Instantiation of the syntax and metatheory
open Syntax QIO:Syn public
open QIO:Terms public
open import SOAS.Families.Build public
open import SOAS.Syntax.Shorthands QIOᵃ public
open import SOAS.Metatheory QIO:Syn public
| {
"alphanum_fraction": 0.5213622291,
"avg_line_length": 30.664556962,
"ext": "agda",
"hexsha": "3bc9b52463760263215aa4e9c1437dca1ff52946",
"lang": "Agda",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "b224d31e20cfd010b7c924ce940f3c2f417777e3",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "k4rtik/agda-soas",
"max_forks_repo_path": "out/QIO/Syntax.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "b224d31e20cfd010b7c924ce940f3c2f417777e3",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "k4rtik/agda-soas",
"max_issues_repo_path": "out/QIO/Syntax.agda",
"max_line_length": 124,
"max_stars_count": null,
"max_stars_repo_head_hexsha": "b224d31e20cfd010b7c924ce940f3c2f417777e3",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "k4rtik/agda-soas",
"max_stars_repo_path": "out/QIO/Syntax.agda",
"max_stars_repo_stars_event_max_datetime": null,
"max_stars_repo_stars_event_min_datetime": null,
"num_tokens": 3090,
"size": 4845
} |
module Context where
open import Level using (_⊔_)
open import Function
open import Data.List.Base
-- | `ifix`. Check `docs/fomega/deep-isorecursive/README.md` for details.
{-# NO_POSITIVITY_CHECK #-}
data IFix {ι φ} {I : Set ι} (F : (I -> Set φ) -> I -> Set φ) (i : I) : Set φ where
Wrap : F (IFix F) i -> IFix F i
infix 3 _∈_ _⊆_
infixl 5 _▻_ _▻▻_ _▶_ _▷_
-- | A context is a snoc-list.
data Con {α} (A : Set α) : Set α where
ε : Con A
_▻_ : (Γ : Con A) -> A -> Con A
-- | The left fold over a context. Note that for contexts, the left fold is the lazy one,
-- i.e. it's preferable.
foldlᶜ : ∀ {α ρ} {A : Set α} {R : Set ρ} -> (R -> A -> R) -> R -> Con A -> R
foldlᶜ f z ε = z
foldlᶜ f z (Γ ▻ σ) = f (foldlᶜ f z Γ) σ
-- | Concatenate two contexts.
_▻▻_ : ∀ {α} {A : Set α} -> Con A -> Con A -> Con A
Γ ▻▻ Δ = foldlᶜ _▻_ Γ Δ
{-# DISPLAY foldlᶜ _▻_ Γ Δ = Γ ▻▻ Δ #-}
-- | The right fold over a context. Note that for contexts, the right fold is the strict one,
-- i.e. it's not preferable.
foldrᶜ : ∀ {α ρ} {A : Set α} {R : Set ρ} -> (A -> R -> R) -> R -> Con A -> R
foldrᶜ f z ε = z
foldrᶜ f z (Γ ▻ σ) = foldrᶜ f (f σ z) Γ
-- | Mapping over a context.
mapᶜ : ∀ {α β} {A : Set α} {B : Set β} -> (A -> B) -> Con A -> Con B
mapᶜ f = foldlᶜ (λ Ξ x -> Ξ ▻ f x) ε
joinᶜ : ∀ {α} {A : Set α} -> Con (Con A) -> Con A
joinᶜ = foldlᶜ _▻▻_ ε
listToCon : ∀ {α} {A : Set α} -> List A -> Con A
listToCon = foldl _▻_ ε
{-# DISPLAY foldl _▻_ ε = listToCon #-}
-- | A variable is a point in a context.
data _∈_ {α} {A : Set α} σ : Con A -> Set where
vz : ∀ {Γ} -> σ ∈ Γ ▻ σ
vs_ : ∀ {Γ τ} -> (v : σ ∈ Γ) -> σ ∈ Γ ▻ τ
-- | Expand the context that a variable is defined in, but do not change the variable.
wkᵛ : ∀ {α} {A : Set α} {Γ Δ : Con A} {σ} -> σ ∈ Δ -> σ ∈ Γ ▻▻ Δ
wkᵛ vz = vz
wkᵛ (vs v) = vs (wkᵛ v)
-- | A variable in the middle of a context.
vsⁿ : ∀ {α} {A : Set α} {Θ : Con A} {σ} Ξ -> σ ∈ Θ ▻ σ ▻▻ Ξ
vsⁿ ε = vz
vsⁿ (Ξ ▻ ν) = vs (vsⁿ Ξ)
mapᵛ : ∀ {α β} {A : Set α} {B : Set β} {Γ σ} {f : A -> B} -> σ ∈ Γ -> f σ ∈ mapᶜ f Γ
mapᵛ vz = vz
mapᵛ (vs v) = vs (mapᵛ v)
-- -- | Order-preserving embedding. I.e. in `Γ ⊆ Δ` `Δ` contains the same elements as `Γ` and
-- -- they're in the same order, but there can be additional elements between them.
-- -- See https://fplab.bitbucket.io/posts/2008-03-07-order-preserving-embeddin.html
-- data _⊆_ {α} {A : Set α} : Con A -> Con A -> Set where
-- -- We use this instead of `ε ⊆ ε`, because we this definition we have `idᵒ ∘ᵒ idᵒ ≡ idᵒ`
-- -- definitionally and this is needed in order to type check some terms with open types.
-- stop : ∀ {Γ} -> Γ ⊆ Γ
-- skip : ∀ {Γ Δ σ} -> (ι : Γ ⊆ Δ) -> Γ ⊆ Δ ▻ σ
-- keep : ∀ {Γ Δ σ} -> (ι : Γ ⊆ Δ) -> Γ ▻ σ ⊆ Δ ▻ σ
_⊆_ : ∀ {α} {A : Set α} -> Con A -> Con A -> Set α
Γ ⊆ Δ = ∀ {σ} -> σ ∈ Γ -> σ ∈ Δ
stop : ∀ {α} {A : Set α} {Γ : Con A} -> Γ ⊆ Γ
stop = id
dupl : ∀ {α} {A : Set α} {Γ : Con A} {σ} -> Γ ▻ σ ▻ σ ⊆ Γ ▻ σ
dupl vz = vz
dupl (vs v) = v
skip : ∀ {α} {A : Set α} {Γ Δ : Con A} {σ} -> Γ ⊆ Δ -> Γ ⊆ Δ ▻ σ
skip ι = vs_ ∘ ι
keep : ∀ {α} {A : Set α} {Γ Δ : Con A} {σ} -> Γ ⊆ Δ -> Γ ▻ σ ⊆ Δ ▻ σ
keep ι vz = vz
keep ι (vs v) = vs (ι v)
move : ∀ {α} {A : Set α} {Γ Δ : Con A} {σ} -> Γ ⊆ Δ -> Γ ▻ σ ▻ σ ⊆ Δ ▻ σ
move ι vz = vz
move ι (vs v) = keep ι v
skipⁿ : ∀ {α} {A : Set α} {Γ Δ : Con A} Ξ -> Γ ⊆ Δ -> Γ ⊆ Δ ▻▻ Ξ
skipⁿ ε ι = ι
skipⁿ (Ξ ▻ ν) ι = skip (skipⁿ Ξ ι)
keepⁿ : ∀ {α} {A : Set α} {Γ Δ : Con A} Ξ -> Γ ⊆ Δ -> Γ ▻▻ Ξ ⊆ Δ ▻▻ Ξ
keepⁿ ε ι = ι
keepⁿ (Ξ ▻ ν) ι = keep (keepⁿ Ξ ι)
empᵒ : ∀ {α} {A : Set α} {Γ : Con A} -> ε ⊆ Γ
empᵒ {Γ = ε} = stop
empᵒ {Γ = Γ ▻ σ} = skip empᵒ
-- | The identity embedding.
idᵒ : ∀ {α} {A : Set α} {Γ : Con A} -> Γ ⊆ Γ
idᵒ = stop
-- | The left extension embedding.
extˡ : ∀ {α} {A : Set α} {Γ Δ : Con A} -> Γ ⊆ Δ ▻▻ Γ
extˡ {Γ = ε} = empᵒ
extˡ {Γ = Γ ▻ σ} = keep extˡ
-- | The right extension embedding.
extʳ : ∀ {α} {A : Set α} {Γ : Con A} Δ -> Γ ⊆ Γ ▻▻ Δ
extʳ Δ = skipⁿ Δ idᵒ
-- | The one element extension embedding.
topᵒ : ∀ {α} {A : Set α} {Γ : Con A} {σ} -> Γ ⊆ Γ ▻ σ
topᵒ = extʳ (ε ▻ _)
mapᶜ-⊆ : ∀ {α β} {A : Set α} {B : Set β} {Γ Δ} {f : A -> B} -> Γ ⊆ Δ -> mapᶜ f Γ ⊆ mapᶜ f Δ
mapᶜ-⊆ {Γ = ε} ι ()
mapᶜ-⊆ {Γ = Γ ▻ σ} ι vz = mapᵛ (ι vz)
mapᶜ-⊆ {Γ = Γ ▻ σ} ι (vs v) = mapᶜ-⊆ (ι ∘ vs_) v
-- | Rename a variable.
renᵛ : ∀ {α} {A : Set α} {Γ Δ : Con A} {σ} -> Γ ⊆ Δ -> σ ∈ Γ -> σ ∈ Δ
renᵛ ι = ι
shiftᵛⁿ : ∀ {α} {A : Set α} {Γ : Con A} {σ} Δ -> σ ∈ Γ -> σ ∈ Γ ▻▻ Δ
shiftᵛⁿ Δ = renᵛ (extʳ Δ)
shiftᵛ : ∀ {α} {A : Set α} {Γ : Con A} {σ τ} -> σ ∈ Γ -> σ ∈ Γ ▻ τ
shiftᵛ = shiftᵛⁿ (ε ▻ _)
-- We need both first-order and higher-order environments, because the former are more convenient
-- for compilation and the latter are more convenient for evaluation at the type level.
-- | In `Seq P Γ` there a `P σ` for each `σ` from `Γ`.
data Seq {α π} {A : Set α} (P : A -> Set π) : Con A -> Set π where
ø : Seq P ε
_▶_ : ∀ {σ Γ} -> Seq P Γ -> P σ -> Seq P (Γ ▻ σ)
-- We wrap this in `record` in order to get good inference.
-- | In `Env P Γ` there a `P σ` for each `σ` from `Γ`.
record Env {α π} {A : Set α} (P : A -> Set π) (Γ : Con A) : Set (α ⊔ π) where
constructor PackEnv
field unpackEnv : ∀ {σ} -> σ ∈ Γ -> P σ
open Env public
foldlˢ
: ∀ {α π ρ} {A : Set α} {P : A -> Set π} {Γ}
-> (R : Con A -> Set ρ) -> (∀ {Ξ σ} -> R Ξ -> P σ -> R (Ξ ▻ σ)) -> R ε -> Seq P Γ -> R Γ
foldlˢ R f z ø = z
foldlˢ R f z (ρ ▶ α) = f (foldlˢ R f z ρ) α
-- | Apply a natural transformation to each element of a `Seq`.
mapˢ
: ∀ {α π₁ π₂} {A : Set α} {P₁ : A -> Set π₁} {P₂ : A -> Set π₂} {Γ}
-> (∀ {σ} -> P₁ σ -> P₂ σ) -> Seq P₁ Γ -> Seq P₂ Γ
mapˢ f = foldlˢ (Seq _) (λ ρ x -> ρ ▶ f x) ø
mapElˢ
: ∀ {α π₁ π₂} {A : Set α} {P₁ : A -> Set π₁} {P₂ : A -> Set π₂} {Γ}
-> (∀ {σ} -> σ ∈ Γ -> P₁ σ -> P₂ σ) -> Seq P₁ Γ -> Seq P₂ Γ
mapElˢ f ø = ø
mapElˢ f (ρ ▶ α) = mapElˢ (f ∘ vs_) ρ ▶ f vz α
eraseˢ : ∀ {α π} {A : Set α} {P : Set π} {Γ : Con A} -> Seq (λ _ -> P) Γ -> Con P
eraseˢ = foldlˢ _ _▻_ ε
∅ : ∀ {α π} {A : Set α} {P : A -> Set π} -> Env P ε
∅ = PackEnv λ()
_▷_ : ∀ {α π} {A : Set α} {Γ σ} {P : A -> Set π} -> Env P Γ -> P σ -> Env P (Γ ▻ σ)
PackEnv ρ ▷ α = PackEnv λ
{ vz -> α
; (vs v) -> ρ v
}
_∘ᵉ_ : ∀ {α π} {A : Set α} {Γ Δ} {P : A -> Set π} -> Env P Δ -> Γ ⊆ Δ -> Env P Γ
PackEnv ρ ∘ᵉ ι = PackEnv (ρ ∘ ι)
withSplitᵉ
: ∀ {α π ρ} {A : Set α} {Γ σ} {P : A -> Set π} {R : Set ρ}
-> Env P (Γ ▻ σ) -> (Env P Γ -> P σ -> R) -> R
withSplitᵉ (PackEnv ρ) k = k (PackEnv (ρ ∘ vs_)) (ρ vz)
foldlᵉ
: ∀ {α π ρ} {A : Set α} {P : A -> Set π} {Γ}
-> (R : Con A -> Set ρ) -> (∀ {Ξ σ} -> R Ξ -> P σ -> R (Ξ ▻ σ)) -> R ε -> Env P Γ -> R Γ
foldlᵉ {Γ = ε} R f z ρ = z
foldlᵉ {Γ = Γ ▻ σ} R f z ρ = withSplitᵉ ρ λ ρ′ α -> f (foldlᵉ R f z ρ′) α
-- | Apply a natural transformation to each element of a `Env`.
mapᵉ
: ∀ {α π₁ π₂} {A : Set α} {P₁ : A -> Set π₁} {P₂ : A -> Set π₂} {Γ}
-> (∀ {σ} -> P₁ σ -> P₂ σ) -> Env P₁ Γ -> Env P₂ Γ
mapᵉ f = foldlᵉ (Env _) (λ ρ x -> ρ ▷ f x) ∅
mapElᵉ
: ∀ {α π₁ π₂} {A : Set α} {P₁ : A -> Set π₁} {P₂ : A -> Set π₂} {Γ}
-> (∀ {σ} -> σ ∈ Γ -> P₁ σ -> P₂ σ) -> Env P₁ Γ -> Env P₂ Γ
mapElᵉ f (PackEnv ρ) = PackEnv λ v -> f v (ρ v)
-- | Look up a variable in an environment.
lookupᵉ : ∀ {α π} {A : Set α} {P : A -> Set π} {Γ σ} -> σ ∈ Γ -> Env P Γ -> P σ
lookupᵉ v (PackEnv ρ) = ρ v
eraseᵉ : ∀ {α π} {A : Set α} {P : Set π} {Γ : Con A} -> Env (λ _ -> P) Γ -> Con P
eraseᵉ = foldlᵉ _ _▻_ ε
record Environment {α β} {A : Set α} (_◆_ : Con A -> A -> Set β) : Set (α ⊔ β) where
infix 3 _⊢ᵉ_
field
varᵈ : ∀ {Γ σ} -> σ ∈ Γ -> Γ ◆ σ
renᵈ : ∀ {Γ Δ σ} -> Γ ⊆ Δ -> Γ ◆ σ -> Δ ◆ σ
idᵉ : ∀ {Γ} -> Env (Γ ◆_) Γ
idᵉ = PackEnv varᵈ
freshᵉ : ∀ {Γ σ} -> (Γ ▻ σ) ◆ σ
freshᵉ = varᵈ vz
_⊢ᵉ_ : Con A -> Con A -> Set (α ⊔ β)
Ξ ⊢ᵉ Θ = Env (λ σ -> Ξ ◆ σ) Θ
renᵉ : ∀ {Δ Ξ Γ} -> Δ ⊆ Ξ -> Δ ⊢ᵉ Γ -> Ξ ⊢ᵉ Γ
renᵉ ι (PackEnv ρ) = PackEnv $ renᵈ ι ∘ ρ
keepᵉ : ∀ {Δ Γ σ} -> Δ ⊢ᵉ Γ -> Δ ▻ σ ⊢ᵉ Γ ▻ σ
keepᵉ ρ = renᵉ topᵒ ρ ▷ freshᵉ
topᵉ : ∀ {Γ σ} -> Γ ◆ σ -> Γ ⊢ᵉ Γ ▻ σ
topᵉ t = idᵉ ▷ t
shiftᵉ : ∀ {Δ Γ τ} -> Δ ⊢ᵉ Γ -> Δ ▻ τ ⊢ᵉ Γ
shiftᵉ = renᵉ topᵒ
| {
"alphanum_fraction": 0.4785583384,
"avg_line_length": 33.2723577236,
"ext": "agda",
"hexsha": "75a3d6b691f7aa72363177be3c808be2cbef9640",
"lang": "Agda",
"max_forks_count": 399,
"max_forks_repo_forks_event_max_datetime": "2022-03-31T11:18:25.000Z",
"max_forks_repo_forks_event_min_datetime": "2018-10-05T09:36:10.000Z",
"max_forks_repo_head_hexsha": "f7d34336cd3d65f62b0da084a16f741dc9156413",
"max_forks_repo_licenses": [
"Apache-2.0"
],
"max_forks_repo_name": "AriFordsham/plutus",
"max_forks_repo_path": "papers/unraveling-recursion/code/src/Context.agda",
"max_issues_count": 2493,
"max_issues_repo_head_hexsha": "f7d34336cd3d65f62b0da084a16f741dc9156413",
"max_issues_repo_issues_event_max_datetime": "2022-03-31T15:31:31.000Z",
"max_issues_repo_issues_event_min_datetime": "2018-09-28T19:28:17.000Z",
"max_issues_repo_licenses": [
"Apache-2.0"
],
"max_issues_repo_name": "AriFordsham/plutus",
"max_issues_repo_path": "papers/unraveling-recursion/code/src/Context.agda",
"max_line_length": 97,
"max_stars_count": 1299,
"max_stars_repo_head_hexsha": "f7d34336cd3d65f62b0da084a16f741dc9156413",
"max_stars_repo_licenses": [
"Apache-2.0"
],
"max_stars_repo_name": "AriFordsham/plutus",
"max_stars_repo_path": "papers/unraveling-recursion/code/src/Context.agda",
"max_stars_repo_stars_event_max_datetime": "2022-03-28T01:10:02.000Z",
"max_stars_repo_stars_event_min_datetime": "2018-10-02T13:41:39.000Z",
"num_tokens": 4123,
"size": 8185
} |
{-# OPTIONS --safe #-}
module Cubical.Categories.Limits.Terminal where
open import Cubical.Foundations.Prelude
open import Cubical.Foundations.HLevels
open import Cubical.HITs.PropositionalTruncation.Base
open import Cubical.Data.Sigma
open import Cubical.Categories.Category
private
variable
ℓ ℓ' : Level
module _ (C : Category ℓ ℓ') where
open Category C
isTerminal : (x : ob) → Type (ℓ-max ℓ ℓ')
isTerminal x = ∀ (y : ob) → isContr (C [ y , x ])
Terminal : Type (ℓ-max ℓ ℓ')
Terminal = Σ[ x ∈ ob ] isTerminal x
terminalOb : Terminal → ob
terminalOb = fst
terminalArrow : (T : Terminal) (y : ob) → C [ y , terminalOb T ]
terminalArrow T y = T .snd y .fst
terminalArrowUnique : {T : Terminal} {y : ob} (f : C [ y , terminalOb T ])
→ terminalArrow T y ≡ f
terminalArrowUnique {T} {y} f = T .snd y .snd f
terminalEndoIsId : (T : Terminal) (f : C [ terminalOb T , terminalOb T ])
→ f ≡ id
terminalEndoIsId T f = isContr→isProp (T .snd (terminalOb T)) f id
hasTerminal : Type (ℓ-max ℓ ℓ')
hasTerminal = ∥ Terminal ∥₁
-- Terminality of an object is a proposition.
isPropIsTerminal : (x : ob) → isProp (isTerminal x)
isPropIsTerminal _ = isPropΠ λ _ → isPropIsContr
open CatIso
-- Objects that are initial are isomorphic.
terminalToIso : (x y : Terminal) → CatIso C (terminalOb x) (terminalOb y)
mor (terminalToIso x y) = terminalArrow y (terminalOb x)
inv (terminalToIso x y) = terminalArrow x (terminalOb y)
sec (terminalToIso x y) = terminalEndoIsId y _
ret (terminalToIso x y) = terminalEndoIsId x _
open isUnivalent
-- The type of terminal objects of a univalent category is a proposition,
-- i.e. all terminal objects are equal.
isPropTerminal : (hC : isUnivalent C) → isProp Terminal
isPropTerminal hC x y =
Σ≡Prop isPropIsTerminal (CatIsoToPath hC (terminalToIso x y))
| {
"alphanum_fraction": 0.6742105263,
"avg_line_length": 30.6451612903,
"ext": "agda",
"hexsha": "b9a472ddaa4b93d953730f0baa9c5cf7e2d738ad",
"lang": "Agda",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "58c0b83bb0fed0dc683f3d29b1709effe51c1689",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "thomas-lamiaux/cubical",
"max_forks_repo_path": "Cubical/Categories/Limits/Terminal.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "58c0b83bb0fed0dc683f3d29b1709effe51c1689",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "thomas-lamiaux/cubical",
"max_issues_repo_path": "Cubical/Categories/Limits/Terminal.agda",
"max_line_length": 76,
"max_stars_count": 1,
"max_stars_repo_head_hexsha": "58c0b83bb0fed0dc683f3d29b1709effe51c1689",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "thomas-lamiaux/cubical",
"max_stars_repo_path": "Cubical/Categories/Limits/Terminal.agda",
"max_stars_repo_stars_event_max_datetime": "2021-10-31T17:32:49.000Z",
"max_stars_repo_stars_event_min_datetime": "2021-10-31T17:32:49.000Z",
"num_tokens": 598,
"size": 1900
} |
{-# OPTIONS --without-K #-}
module Simplify where
open import FT
open import HoTT
-- just flip. It is he caller's responsibility to do other things
flip : {b₁ b₂ : FT} → b₂ ⇛ b₁ → b₁ ⇛ b₂
flip unite₊⇛ = uniti₊⇛
flip uniti₊⇛ = unite₊⇛
flip swap₊⇛ = swap₊⇛
flip assocl₊⇛ = assocr₊⇛
flip assocr₊⇛ = assocl₊⇛
flip unite⋆⇛ = uniti⋆⇛
flip uniti⋆⇛ = unite⋆⇛
flip swap⋆⇛ = swap⋆⇛
flip assocl⋆⇛ = assocr⋆⇛
flip assocr⋆⇛ = assocl⋆⇛
flip distz⇛ = factorz⇛
flip factorz⇛ = distz⇛
flip dist⇛ = factor⇛
flip factor⇛ = dist⇛
flip id⇛ = id⇛
flip (sym⇛ p) = p
flip (p ◎ q) = flip q ◎ flip p
flip (p ⊕ q) = flip p ⊕ flip q
flip (p ⊗ q) = flip p ⊗ flip q
flip-id-lemma : ∀ {b} → flip {b} {b} id⇛ ≡ id⇛
flip-id-lemma = λ {b} → refl id⇛
-- we're going to be pretty brute-force about this, for now
-- All this is going to be one huge mutual definition.
mutual
simplify : {b₁ b₂ : FT} → b₁ ⇛ b₂ → b₁ ⇛ b₂
-- all the basic (atomic) combinators simplify to themselves
simplify unite₊⇛ = unite₊⇛
simplify uniti₊⇛ = uniti₊⇛
simplify swap₊⇛ = swap₊⇛
simplify assocl₊⇛ = assocl₊⇛
simplify assocr₊⇛ = assocr₊⇛
simplify unite⋆⇛ = unite⋆⇛
simplify uniti⋆⇛ = uniti⋆⇛
simplify swap⋆⇛ = swap⋆⇛
simplify assocl⋆⇛ = assocl⋆⇛
simplify assocr⋆⇛ = assocr⋆⇛
simplify distz⇛ = distz⇛
simplify factorz⇛ = factorz⇛
simplify dist⇛ = dist⇛
simplify factor⇛ = factor⇛
simplify id⇛ = id⇛
simplify (sym⇛ p) = flip (simplify p)
simplify (p ◎ q) = scomp (simplify p) (simplify q)
simplify (p ⊕ q) = simplify p ⊕ simplify q
simplify (p ⊗ q) = simplify p ⊗ simplify q
-- split on p, and then only on those q that we want to simplify
scomp : {b₁ b₂ b₃ : FT} → b₁ ⇛ b₂ → b₂ ⇛ b₃ → b₁ ⇛ b₃
scomp id⇛ p = p
scomp unite₊⇛ id⇛ = unite₊⇛
scomp unite₊⇛ uniti₊⇛ = id⇛
scomp unite₊⇛ q = unite₊⇛ ◎ q -- more?
scomp uniti₊⇛ unite₊⇛ = id⇛
scomp uniti₊⇛ id⇛ = uniti₊⇛
scomp uniti₊⇛ q = uniti₊⇛ ◎ q
scomp swap₊⇛ swap₊⇛ = id⇛
scomp swap₊⇛ id⇛ = swap₊⇛
scomp swap₊⇛ (q ◎ q₁) = scomp swap₊⇛ q ◎ q₁
scomp swap₊⇛ q = swap₊⇛ ◎ q
scomp assocl₊⇛ assocr₊⇛ = id⇛
scomp assocl₊⇛ id⇛ = assocl₊⇛
scomp assocl₊⇛ q = assocl₊⇛ ◎ q
scomp assocr₊⇛ assocl₊⇛ = id⇛
scomp assocr₊⇛ id⇛ = assocr₊⇛
scomp assocr₊⇛ q = assocr₊⇛ ◎ q
scomp unite⋆⇛ uniti⋆⇛ = id⇛
scomp unite⋆⇛ id⇛ = unite⋆⇛
scomp unite⋆⇛ q = unite⋆⇛ ◎ q
scomp uniti⋆⇛ unite⋆⇛ = id⇛
scomp uniti⋆⇛ id⇛ = uniti⋆⇛
scomp uniti⋆⇛ q = uniti⋆⇛ ◎ q
scomp swap⋆⇛ swap⋆⇛ = id⇛
scomp swap⋆⇛ id⇛ = swap⋆⇛
scomp swap⋆⇛ q = swap⋆⇛ ◎ q
scomp assocl⋆⇛ assocr⋆⇛ = id⇛
scomp assocl⋆⇛ id⇛ = assocl⋆⇛
scomp assocl⋆⇛ q = assocl⋆⇛ ◎ q
scomp assocr⋆⇛ assocl⋆⇛ = id⇛
scomp assocr⋆⇛ id⇛ = assocr⋆⇛
scomp assocr⋆⇛ q = assocr⋆⇛ ◎ q
scomp distz⇛ id⇛ = distz⇛
scomp distz⇛ q = distz⇛ ◎ q
scomp factorz⇛ distz⇛ = id⇛
scomp factorz⇛ id⇛ = factorz⇛
scomp factorz⇛ q = factorz⇛ ◎ q
scomp dist⇛ q = dist⇛ ◎ q -- Can't simplify?
scomp factor⇛ dist⇛ = id⇛
scomp factor⇛ id⇛ = factor⇛
scomp factor⇛ q = factor⇛ ◎ q
scomp (sym⇛ p) q = (flip p) ◎ q -- won't happen from simplify
scomp (p₁ ◎ p₂) id⇛ = scomp p₁ p₂
scomp (p₁ ◎ p₂) q = scomp p₁ p₂ ◎ q
scomp (p₁ ⊕ p₂) id⇛ = p₁ ⊕ p₂
scomp (p₁ ⊕ p₂) (q₁ ⊕ q₂) = scomp p₁ q₁ ⊕ scomp p₂ q₂
scomp (p₁ ⊕ p₂) q = (p₁ ⊕ p₂) ◎ q
scomp (p₁ ⊗ p₂) id⇛ = p₁ ⊗ p₂
scomp (p₁ ⊗ p₂) (q ◎ q₁) = scomp (p₁ ⊗ p₂) q ◎ q₁
scomp (p₁ ⊗ p₂) (q ⊗ q₁) = scomp p₁ q ⊗ scomp p₂ q₁
scomp (p₁ ⊗ p₂) q = (p₁ ⊗ p₂) ◎ q
-- testing
test1 : ∀ {b₁ : FT} → b₁ ⇛ b₁
test1 = simplify (id⇛ ◎ id⇛ ◎ id⇛)
test2 : ∀ {b₁ : FT} → TIMES ONE b₁ ⇛ TIMES ONE b₁
test2 = simplify ((sym⇛ uniti⋆⇛) ◎ id⇛ ◎ uniti⋆⇛) | {
"alphanum_fraction": 0.5867148416,
"avg_line_length": 31.0172413793,
"ext": "agda",
"hexsha": "3348138923d7cb6dbee105f680cc7d26e1b8f649",
"lang": "Agda",
"max_forks_count": 3,
"max_forks_repo_forks_event_max_datetime": "2019-09-10T09:47:13.000Z",
"max_forks_repo_forks_event_min_datetime": "2016-05-29T01:56:33.000Z",
"max_forks_repo_head_hexsha": "003835484facfde0b770bc2b3d781b42b76184c1",
"max_forks_repo_licenses": [
"BSD-2-Clause"
],
"max_forks_repo_name": "JacquesCarette/pi-dual",
"max_forks_repo_path": "Univalence/OldUnivalence/Simplify.agda",
"max_issues_count": 4,
"max_issues_repo_head_hexsha": "003835484facfde0b770bc2b3d781b42b76184c1",
"max_issues_repo_issues_event_max_datetime": "2021-10-29T20:41:23.000Z",
"max_issues_repo_issues_event_min_datetime": "2018-06-07T16:27:41.000Z",
"max_issues_repo_licenses": [
"BSD-2-Clause"
],
"max_issues_repo_name": "JacquesCarette/pi-dual",
"max_issues_repo_path": "Univalence/OldUnivalence/Simplify.agda",
"max_line_length": 66,
"max_stars_count": 14,
"max_stars_repo_head_hexsha": "003835484facfde0b770bc2b3d781b42b76184c1",
"max_stars_repo_licenses": [
"BSD-2-Clause"
],
"max_stars_repo_name": "JacquesCarette/pi-dual",
"max_stars_repo_path": "Univalence/OldUnivalence/Simplify.agda",
"max_stars_repo_stars_event_max_datetime": "2021-05-05T01:07:57.000Z",
"max_stars_repo_stars_event_min_datetime": "2015-08-18T21:40:15.000Z",
"num_tokens": 2114,
"size": 3598
} |
open import Prelude
open import dynamics-core
module lemmas-ground where
-- not ground types aren't just a type constructor filled with holes
ground-not-holes : ∀{τ} →
(τ ground → ⊥) →
(τ ≠ (⦇-⦈ ==> ⦇-⦈)) × (τ ≠ (⦇-⦈ ⊕ ⦇-⦈)) × (τ ≠ (⦇-⦈ ⊠ ⦇-⦈))
ground-not-holes notg = (λ{refl → notg GArrHole}) ,
(λ{refl → notg GSumHole}) ,
(λ{refl → notg GProdHole})
-- not ground types either have to be hole, an arrow, or a sum
not-ground : ∀{τ} →
(τ ground → ⊥) →
((τ == ⦇-⦈) +
(Σ[ τ1 ∈ htyp ] Σ[ τ2 ∈ htyp ] (τ == (τ1 ==> τ2))) +
(Σ[ τ1 ∈ htyp ] Σ[ τ2 ∈ htyp ] (τ == (τ1 ⊕ τ2))) +
(Σ[ τ1 ∈ htyp ] Σ[ τ2 ∈ htyp ] (τ == (τ1 ⊠ τ2))))
not-ground {num} gnd = abort (gnd GNum)
not-ground {⦇-⦈} gnd = Inl refl
not-ground {τ ==> τ₁} gnd = Inr (Inl (τ , τ₁ , refl))
not-ground {τ ⊕ τ₁} gnd = Inr (Inr (Inl (τ , τ₁ , refl)))
not-ground {τ ⊠ τ₁} gnd = Inr (Inr (Inr (τ , τ₁ , refl)))
| {
"alphanum_fraction": 0.4439163498,
"avg_line_length": 42.08,
"ext": "agda",
"hexsha": "e97235933bd8f36e6e82d94ff21f389a272d9d8f",
"lang": "Agda",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "a3640d7b0f76cdac193afd382694197729ed6d57",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "hazelgrove/hazelnut-agda",
"max_forks_repo_path": "lemmas-ground.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "a3640d7b0f76cdac193afd382694197729ed6d57",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "hazelgrove/hazelnut-agda",
"max_issues_repo_path": "lemmas-ground.agda",
"max_line_length": 80,
"max_stars_count": null,
"max_stars_repo_head_hexsha": "a3640d7b0f76cdac193afd382694197729ed6d57",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "hazelgrove/hazelnut-agda",
"max_stars_repo_path": "lemmas-ground.agda",
"max_stars_repo_stars_event_max_datetime": null,
"max_stars_repo_stars_event_min_datetime": null,
"num_tokens": 432,
"size": 1052
} |
module _ where
open import utility
open import Esterel.Lang
open import Esterel.Lang.Properties
open import Esterel.Environment as Env
open import Esterel.Context
open import Data.Product
open import Data.Sum
open import Data.Bool
open import Data.List
open import Relation.Nullary
open import Relation.Binary.PropositionalEquality
open import Data.Empty
open import calculus
open import context-properties
open import Esterel.Lang.Binding
| {
"alphanum_fraction": 0.8480725624,
"avg_line_length": 24.5,
"ext": "agda",
"hexsha": "fea915ea43eb4428e309ed6df78261d5ff069f67",
"lang": "Agda",
"max_forks_count": 1,
"max_forks_repo_forks_event_max_datetime": "2020-04-15T20:02:49.000Z",
"max_forks_repo_forks_event_min_datetime": "2020-04-15T20:02:49.000Z",
"max_forks_repo_head_hexsha": "4340bef3f8df42ab8167735d35a4cf56243a45cd",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "florence/esterel-calculus",
"max_forks_repo_path": "cross-tests/examples/1/test.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "4340bef3f8df42ab8167735d35a4cf56243a45cd",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "florence/esterel-calculus",
"max_issues_repo_path": "cross-tests/examples/1/test.agda",
"max_line_length": 49,
"max_stars_count": 3,
"max_stars_repo_head_hexsha": "4340bef3f8df42ab8167735d35a4cf56243a45cd",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "florence/esterel-calculus",
"max_stars_repo_path": "cross-tests/examples/1/test.agda",
"max_stars_repo_stars_event_max_datetime": "2020-07-01T03:59:31.000Z",
"max_stars_repo_stars_event_min_datetime": "2020-04-16T10:58:53.000Z",
"num_tokens": 96,
"size": 441
} |
module ShowNat where
open import IO
open import Data.Unit
open import Data.Nat.Show
open import Level using (0ℓ)
main = run {0ℓ} (putStrLn (Data.Nat.Show.show 10))
| {
"alphanum_fraction": 0.7530120482,
"avg_line_length": 18.4444444444,
"ext": "agda",
"hexsha": "bdf3d8e3bad495d914b375b22e71e4d4c0db5de5",
"lang": "Agda",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "cb645fcad38f76a9bf37507583867595b5ce87a1",
"max_forks_repo_licenses": [
"BSD-3-Clause"
],
"max_forks_repo_name": "guilhermehas/agda",
"max_forks_repo_path": "test/Compiler/with-stdlib/ShowNat.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "cb645fcad38f76a9bf37507583867595b5ce87a1",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"BSD-3-Clause"
],
"max_issues_repo_name": "guilhermehas/agda",
"max_issues_repo_path": "test/Compiler/with-stdlib/ShowNat.agda",
"max_line_length": 50,
"max_stars_count": null,
"max_stars_repo_head_hexsha": "cb645fcad38f76a9bf37507583867595b5ce87a1",
"max_stars_repo_licenses": [
"BSD-3-Clause"
],
"max_stars_repo_name": "guilhermehas/agda",
"max_stars_repo_path": "test/Compiler/with-stdlib/ShowNat.agda",
"max_stars_repo_stars_event_max_datetime": null,
"max_stars_repo_stars_event_min_datetime": null,
"num_tokens": 50,
"size": 166
} |
module Avionics.SafetyEnvelopes.ExtInterface where
open import Data.Bool using (Bool)
open import Data.Float using (Float)
open import Data.List using (List; map)
open import Data.Maybe using (Maybe; just; nothing)
open import Data.Product using (_×_; _,_)
open import Avionics.Probability using (Dist; NormalDist; ND)
open import Avionics.Real renaming (fromFloat to ff; toFloat to tf)
open import Avionics.SafetyEnvelopes using (z-predictable'; sample-z-predictable)
open import ExtInterface.Data.Maybe using (just; nothing) renaming (Maybe to ExtMaybe)
open import ExtInterface.Data.Product as Ext using (⟨_,_⟩)
fromFloats-z-predictable : List (Float Ext.× Float) → Float → Float → ExtMaybe (Float Ext.× Bool)
fromFloats-z-predictable means×stds z x =
let
ndists = map (λ{⟨ mean , std ⟩ → ND (ff mean) (ff std)}) means×stds
(m , b) = z-predictable' ndists (ff z) (ff x)
in
just ⟨ tf m , b ⟩
{-# COMPILE GHC fromFloats-z-predictable as zPredictable #-}
fromFloats-sample-z-predictable :
List (Float Ext.× Float)
→ Float → Float → List Float → ExtMaybe (Float Ext.× Float Ext.× Bool)
fromFloats-sample-z-predictable means×stds zμ zσ xs =
let
ndists = map (λ{⟨ mean , std ⟩ → ND (ff mean) (ff std)}) means×stds
in
return (sample-z-predictable ndists (ff zμ) (ff zσ) (map ff xs))
where
return : Maybe (ℝ × ℝ × Bool) → ExtMaybe (Float Ext.× Float Ext.× Bool)
return nothing = nothing
return (just (m' , v' , b)) = just ⟨ tf m' , ⟨ tf v' , b ⟩ ⟩
{-# COMPILE GHC fromFloats-sample-z-predictable as sampleZPredictable #-}
| {
"alphanum_fraction": 0.686163522,
"avg_line_length": 41.8421052632,
"ext": "agda",
"hexsha": "f56efebd35032c4e80bee48069b444e11d16f63b",
"lang": "Agda",
"max_forks_count": 1,
"max_forks_repo_forks_event_max_datetime": "2020-09-20T00:36:09.000Z",
"max_forks_repo_forks_event_min_datetime": "2020-09-20T00:36:09.000Z",
"max_forks_repo_head_hexsha": "896e67a2ad21041a1c9ef5f3ad6318c67d730341",
"max_forks_repo_licenses": [
"BSD-3-Clause"
],
"max_forks_repo_name": "RPI-WCL/safety-envelopes-sentinels",
"max_forks_repo_path": "agda/Avionics/SafetyEnvelopes/ExtInterface.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "896e67a2ad21041a1c9ef5f3ad6318c67d730341",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"BSD-3-Clause"
],
"max_issues_repo_name": "RPI-WCL/safety-envelopes-sentinels",
"max_issues_repo_path": "agda/Avionics/SafetyEnvelopes/ExtInterface.agda",
"max_line_length": 97,
"max_stars_count": null,
"max_stars_repo_head_hexsha": "896e67a2ad21041a1c9ef5f3ad6318c67d730341",
"max_stars_repo_licenses": [
"BSD-3-Clause"
],
"max_stars_repo_name": "RPI-WCL/safety-envelopes-sentinels",
"max_stars_repo_path": "agda/Avionics/SafetyEnvelopes/ExtInterface.agda",
"max_stars_repo_stars_event_max_datetime": null,
"max_stars_repo_stars_event_min_datetime": null,
"num_tokens": 486,
"size": 1590
} |
{-# OPTIONS --universe-polymorphism #-}
module Categories.Monad where
open import Level
open import Categories.Category
open import Categories.Functor hiding (_≡_; assoc; identityˡ; identityʳ)
open import Categories.NaturalTransformation renaming (id to idN)
record Monad {o ℓ e} (C : Category o ℓ e) : Set (o ⊔ ℓ ⊔ e) where
field
F : Endofunctor C
η : NaturalTransformation id F
μ : NaturalTransformation (F ∘ F) F
open Functor F
field
.assoc : μ ∘₁ (F ∘ˡ μ) ≡ μ ∘₁ (μ ∘ʳ F)
.identityˡ : μ ∘₁ (F ∘ˡ η) ≡ idN
.identityʳ : μ ∘₁ (η ∘ʳ F) ≡ idN | {
"alphanum_fraction": 0.6568965517,
"avg_line_length": 27.619047619,
"ext": "agda",
"hexsha": "c1eca3a8e73a374b58d06af33d78bfbc5068c632",
"lang": "Agda",
"max_forks_count": 23,
"max_forks_repo_forks_event_max_datetime": "2021-11-11T13:50:56.000Z",
"max_forks_repo_forks_event_min_datetime": "2015-02-05T13:03:09.000Z",
"max_forks_repo_head_hexsha": "e41aef56324a9f1f8cf3cd30b2db2f73e01066f2",
"max_forks_repo_licenses": [
"BSD-3-Clause"
],
"max_forks_repo_name": "p-pavel/categories",
"max_forks_repo_path": "Categories/Monad.agda",
"max_issues_count": 19,
"max_issues_repo_head_hexsha": "e41aef56324a9f1f8cf3cd30b2db2f73e01066f2",
"max_issues_repo_issues_event_max_datetime": "2019-08-09T16:31:40.000Z",
"max_issues_repo_issues_event_min_datetime": "2015-05-23T06:47:10.000Z",
"max_issues_repo_licenses": [
"BSD-3-Clause"
],
"max_issues_repo_name": "p-pavel/categories",
"max_issues_repo_path": "Categories/Monad.agda",
"max_line_length": 72,
"max_stars_count": 98,
"max_stars_repo_head_hexsha": "36f4181d751e2ecb54db219911d8c69afe8ba892",
"max_stars_repo_licenses": [
"BSD-3-Clause"
],
"max_stars_repo_name": "copumpkin/categories",
"max_stars_repo_path": "Categories/Monad.agda",
"max_stars_repo_stars_event_max_datetime": "2022-03-08T05:20:36.000Z",
"max_stars_repo_stars_event_min_datetime": "2015-04-15T14:57:33.000Z",
"num_tokens": 207,
"size": 580
} |
module Cats.Category.Lift where
open import Relation.Binary using (IsEquivalence)
open import Level as L using (Level ; suc ; _⊔_ ; lift ; lower)
open import Cats.Category.Base
open IsEquivalence
LCategory : (l : Level) → Set (suc l)
LCategory l = Category l l l
Lift : ∀ {lo la l≈ lo′ la′ l≈′} → Category lo la l≈
→ Category (lo ⊔ lo′) (la ⊔ la′) (l≈ ⊔ l≈′)
Lift {lo′ = lo′} {la′} {l≈′} C = record
{ Obj = L.Lift lo′ C.Obj
; _⇒_ = λ A B → L.Lift la′ (lower A C.⇒ lower B)
; _≈_ = λ f g → L.Lift l≈′ (lower f C.≈ lower g)
; id = lift C.id
; _∘_ = λ f g → lift (lower f C.∘ lower g)
; equiv = record
{ refl = lift (refl C.equiv)
; sym = λ eq → lift (sym C.equiv (lower eq))
; trans = λ eq₁ eq₂ → lift (trans C.equiv (lower eq₁) (lower eq₂))
}
; ∘-resp = λ eq₁ eq₂ → lift (C.∘-resp (lower eq₁) (lower eq₂))
; id-r = lift C.id-r
; id-l = lift C.id-l
; assoc = lift C.assoc
}
where
module C = Category C
LiftEq : ∀ {lo la l≈} → Category lo la l≈
→ LCategory (lo ⊔ la ⊔ l≈)
LiftEq {lo} {la} {l≈} = Lift {lo′ = la ⊔ l≈} {la′ = lo ⊔ l≈} {l≈′ = lo ⊔ la}
| {
"alphanum_fraction": 0.5381244522,
"avg_line_length": 28.525,
"ext": "agda",
"hexsha": "a167a3a1e784dc3a3f61f6810945f52db09976e6",
"lang": "Agda",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "a3b69911c4c6ec380ddf6a0f4510d3a755734b86",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "alessio-b-zak/cats",
"max_forks_repo_path": "Cats/Category/Lift.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "a3b69911c4c6ec380ddf6a0f4510d3a755734b86",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "alessio-b-zak/cats",
"max_issues_repo_path": "Cats/Category/Lift.agda",
"max_line_length": 76,
"max_stars_count": null,
"max_stars_repo_head_hexsha": "a3b69911c4c6ec380ddf6a0f4510d3a755734b86",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "alessio-b-zak/cats",
"max_stars_repo_path": "Cats/Category/Lift.agda",
"max_stars_repo_stars_event_max_datetime": null,
"max_stars_repo_stars_event_min_datetime": null,
"num_tokens": 468,
"size": 1141
} |
{-# OPTIONS --without-K --safe #-}
open import Categories.Category
module Categories.Category.Instance.Simplex where
open import Level
open import Data.Product
open import Data.Fin.Base using (Fin; _≤_)
open import Data.Nat.Base using (ℕ; z≤n; s≤s)
open import Function renaming (id to idF; _∘_ to _∙_)
open import Relation.Binary using (_=[_]⇒_)
open import Relation.Binary.PropositionalEquality
Δ : Category 0ℓ 0ℓ 0ℓ
Δ = record
{ Obj = ℕ
; _⇒_ = λ m n → Σ (Fin m → Fin n) (λ f → _≤_ =[ f ]⇒ _≤_)
; _≈_ = λ { (f , mf) (g , mg) → ∀ x → f x ≡ g x }
; id = idF , idF
; _∘_ = λ { (f , mf) (g , mg) → f ∙ g , mf ∙ mg }
; assoc = λ _ → refl
; sym-assoc = λ _ → refl
; identityˡ = λ _ → refl
; identityʳ = λ _ → refl
; identity² = λ _ → refl
; equiv = record
{ refl = λ _ → refl
; sym = λ eq x → sym (eq x)
; trans = λ eq₁ eq₂ x → trans (eq₁ x) (eq₂ x)
}
; ∘-resp-≈ = λ {_ _ _ f g h i} eq₁ eq₂ x → trans (cong (λ t → proj₁ f t) (eq₂ x)) (eq₁ (proj₁ i x))
}
open Category Δ
--------------------------------------------------------------------------------
-- Face + Degeneracy Maps
face-map : ∀ {n} → Fin (ℕ.suc n) → Fin n → Fin (ℕ.suc n)
face-map Fin.zero k = Fin.suc k
face-map (Fin.suc i) Fin.zero = Fin.zero
face-map (Fin.suc i) (Fin.suc k) = Fin.suc (face-map i k)
face-mono : ∀ {n} → (i : Fin (ℕ.suc n)) → _≤_ =[ face-map i ]⇒ _≤_
face-mono Fin.zero {_} {_} le = s≤s le
face-mono (Fin.suc i) {Fin.zero} {_} _ = z≤n
face-mono (Fin.suc i) {Fin.suc _} {Fin.suc _} (s≤s le) = s≤s (face-mono i le)
face : ∀ {n} → Fin (ℕ.suc n) → n ⇒ ℕ.suc n
face i = face-map i , face-mono i
degeneracy-map : ∀ {n} → Fin n → Fin (ℕ.suc n) → Fin n
degeneracy-map Fin.zero Fin.zero = Fin.zero
degeneracy-map Fin.zero (Fin.suc k) = k
degeneracy-map (Fin.suc i) Fin.zero = Fin.zero
degeneracy-map (Fin.suc i) (Fin.suc k) = Fin.suc (degeneracy-map i k)
degeneracy-mono : ∀ {n} → (i : Fin n) → _≤_ =[ degeneracy-map i ]⇒ _≤_
degeneracy-mono Fin.zero {Fin.zero} {_} _ = z≤n
degeneracy-mono Fin.zero {Fin.suc _} {Fin.suc _} (s≤s le) = le
degeneracy-mono (Fin.suc i) {Fin.zero} {_} _ = z≤n
degeneracy-mono (Fin.suc i) {Fin.suc _} {Fin.suc _} (s≤s le) = s≤s (degeneracy-mono i le)
degeneracy : ∀ {n} → Fin n → ℕ.suc n ⇒ n
degeneracy i = degeneracy-map i , degeneracy-mono i
| {
"alphanum_fraction": 0.5386503067,
"avg_line_length": 35.9558823529,
"ext": "agda",
"hexsha": "7894b0f3bf41a0bb6d916e7d8f740b27224e1a91",
"lang": "Agda",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "a4053cf700bcefdf73b857c3352f1eae29382a60",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "jaykru/agda-categories",
"max_forks_repo_path": "src/Categories/Category/Instance/Simplex.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "a4053cf700bcefdf73b857c3352f1eae29382a60",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "jaykru/agda-categories",
"max_issues_repo_path": "src/Categories/Category/Instance/Simplex.agda",
"max_line_length": 102,
"max_stars_count": null,
"max_stars_repo_head_hexsha": "a4053cf700bcefdf73b857c3352f1eae29382a60",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "jaykru/agda-categories",
"max_stars_repo_path": "src/Categories/Category/Instance/Simplex.agda",
"max_stars_repo_stars_event_max_datetime": null,
"max_stars_repo_stars_event_min_datetime": null,
"num_tokens": 961,
"size": 2445
} |
-- Andreas, AIM XXIII, 2016-04-23
-- Issue 1944
-- Milestone 2.0: overload projection by fields (does not affect matching)
-- {-# OPTIONS -v tc.lhs.split:20 #-}
record R : Set2 where
field out : Set1
r : R
R.out r = Set
s = r
open R r -- fully applied open
open R
open R s
-- Now out is overloaded. It is both a field and a projection.
-- We can still use it in pattern position (since a field does not make sense here).
ok : R
out ok = Set -- out should be highlighted as projection
| {
"alphanum_fraction": 0.6794354839,
"avg_line_length": 20.6666666667,
"ext": "agda",
"hexsha": "db179e4dd0a3a56aeb9122ceb0438f60c051040b",
"lang": "Agda",
"max_forks_count": 371,
"max_forks_repo_forks_event_max_datetime": "2022-03-30T19:00:30.000Z",
"max_forks_repo_forks_event_min_datetime": "2015-01-03T14:04:08.000Z",
"max_forks_repo_head_hexsha": "231d6ad8e77b67ff8c4b1cb35a6c31ccd988c3e9",
"max_forks_repo_licenses": [
"BSD-3-Clause"
],
"max_forks_repo_name": "Agda-zh/agda",
"max_forks_repo_path": "test/Succeed/InstantiatedRecordModuleNoCopattern2.agda",
"max_issues_count": 4066,
"max_issues_repo_head_hexsha": "ed8ac6f4062ea8a20fa0f62d5db82d4e68278338",
"max_issues_repo_issues_event_max_datetime": "2022-03-31T21:14:49.000Z",
"max_issues_repo_issues_event_min_datetime": "2015-01-10T11:24:51.000Z",
"max_issues_repo_licenses": [
"BSD-3-Clause"
],
"max_issues_repo_name": "shlevy/agda",
"max_issues_repo_path": "test/Succeed/InstantiatedRecordModuleNoCopattern2.agda",
"max_line_length": 84,
"max_stars_count": 1989,
"max_stars_repo_head_hexsha": "ed8ac6f4062ea8a20fa0f62d5db82d4e68278338",
"max_stars_repo_licenses": [
"BSD-3-Clause"
],
"max_stars_repo_name": "shlevy/agda",
"max_stars_repo_path": "test/Succeed/InstantiatedRecordModuleNoCopattern2.agda",
"max_stars_repo_stars_event_max_datetime": "2022-03-30T18:20:48.000Z",
"max_stars_repo_stars_event_min_datetime": "2015-01-09T23:51:16.000Z",
"num_tokens": 148,
"size": 496
} |
module neq where
open import eq
open import negation
----------------------------------------------------------------------
-- syntax
----------------------------------------------------------------------
infix 4 _≢_
----------------------------------------------------------------------
-- defined types
----------------------------------------------------------------------
_≢_ : ∀ {ℓ}{A : Set ℓ} → A → A → Set ℓ
x ≢ y = ¬ (x ≡ y)
sym-≢ : ∀{ℓ}{A : Set ℓ}{x y : A} → x ≢ y → y ≢ x
sym-≢ p₁ p₂ = p₁ (sym p₂)
| {
"alphanum_fraction": 0.2286821705,
"avg_line_length": 24.5714285714,
"ext": "agda",
"hexsha": "edfd6639074a83d10664749a64a2424f0044e0f0",
"lang": "Agda",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "b33c6a59d664aed46cac8ef77d34313e148fecc2",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "heades/AUGL",
"max_forks_repo_path": "neq.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "b33c6a59d664aed46cac8ef77d34313e148fecc2",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "heades/AUGL",
"max_issues_repo_path": "neq.agda",
"max_line_length": 70,
"max_stars_count": null,
"max_stars_repo_head_hexsha": "b33c6a59d664aed46cac8ef77d34313e148fecc2",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "heades/AUGL",
"max_stars_repo_path": "neq.agda",
"max_stars_repo_stars_event_max_datetime": null,
"max_stars_repo_stars_event_min_datetime": null,
"num_tokens": 121,
"size": 516
} |
-- Product of two functors
{-# OPTIONS --safe #-}
module Cubical.Categories.Functor.BinProduct where
open import Cubical.Categories.Category.Base
open import Cubical.Categories.Constructions.BinProduct
open import Cubical.Categories.Functor.Base
open import Cubical.Data.Sigma.Properties
open import Cubical.Foundations.Prelude
private
variable
ℓA ℓA' ℓB ℓB' ℓC ℓC' ℓD ℓD' : Level
A : Category ℓA ℓA'
B : Category ℓB ℓB'
C : Category ℓC ℓC'
D : Category ℓD ℓD'
open Functor
_×F_ : Functor A C → Functor B D → Functor (A × B) (C × D)
(G ×F H) .F-ob (a , b) = (G ⟅ a ⟆ , H ⟅ b ⟆)
(G ×F H) .F-hom (g , h) = (G ⟪ g ⟫ , H ⟪ h ⟫)
(G ×F H) .F-id = ≡-× (G .F-id) (H .F-id)
(G ×F H) .F-seq _ _ = ≡-× (G .F-seq _ _) (H .F-seq _ _)
| {
"alphanum_fraction": 0.6243315508,
"avg_line_length": 27.7037037037,
"ext": "agda",
"hexsha": "8b15074431c491fede85aa9de504fb68ebc5bfab",
"lang": "Agda",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "58f2d0dd07e51f8aa5b348a522691097b6695d1c",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "Seanpm2001-web/cubical",
"max_forks_repo_path": "Cubical/Categories/Functor/BinProduct.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "58f2d0dd07e51f8aa5b348a522691097b6695d1c",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "Seanpm2001-web/cubical",
"max_issues_repo_path": "Cubical/Categories/Functor/BinProduct.agda",
"max_line_length": 58,
"max_stars_count": 1,
"max_stars_repo_head_hexsha": "9acdecfa6437ec455568be4e5ff04849cc2bc13b",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "FernandoLarrain/cubical",
"max_stars_repo_path": "Cubical/Categories/Functor/BinProduct.agda",
"max_stars_repo_stars_event_max_datetime": "2022-03-05T00:28:39.000Z",
"max_stars_repo_stars_event_min_datetime": "2022-03-05T00:28:39.000Z",
"num_tokens": 297,
"size": 748
} |
------------------------------------------------------------------------
-- The Agda standard library
--
-- Heterogeneous equality
------------------------------------------------------------------------
module Relation.Binary.HeterogeneousEquality where
open import Data.Product
open import Function
open import Function.Inverse using (Inverse)
open import Data.Unit.Core
open import Level
open import Relation.Nullary
open import Relation.Binary
open import Relation.Binary.Consequences
open import Relation.Binary.Indexed as I using (_at_)
open import Relation.Binary.PropositionalEquality as P using (_≡_; refl)
import Relation.Binary.HeterogeneousEquality.Core as Core
------------------------------------------------------------------------
-- Heterogeneous equality
infix 4 _≇_
open Core public using (_≅_; refl)
-- Nonequality.
_≇_ : ∀ {ℓ} {A : Set ℓ} → A → {B : Set ℓ} → B → Set ℓ
x ≇ y = ¬ x ≅ y
------------------------------------------------------------------------
-- Conversion
≡-to-≅ : ∀ {a} {A : Set a} {x y : A} → x ≡ y → x ≅ y
≡-to-≅ refl = refl
open Core public using (≅-to-≡)
------------------------------------------------------------------------
-- Some properties
reflexive : ∀ {a} {A : Set a} → _⇒_ {A = A} _≡_ (λ x y → x ≅ y)
reflexive refl = refl
sym : ∀ {ℓ} {A B : Set ℓ} {x : A} {y : B} → x ≅ y → y ≅ x
sym refl = refl
trans : ∀ {ℓ} {A B C : Set ℓ} {x : A} {y : B} {z : C} →
x ≅ y → y ≅ z → x ≅ z
trans refl eq = eq
subst : ∀ {a} {A : Set a} {p} → Substitutive {A = A} (λ x y → x ≅ y) p
subst P refl p = p
subst₂ : ∀ {a b p} {A : Set a} {B : Set b} (P : A → B → Set p) →
∀ {x₁ x₂ y₁ y₂} → x₁ ≅ x₂ → y₁ ≅ y₂ → P x₁ y₁ → P x₂ y₂
subst₂ P refl refl p = p
subst-removable : ∀ {a p} {A : Set a}
(P : A → Set p) {x y} (eq : x ≅ y) z →
subst P eq z ≅ z
subst-removable P refl z = refl
≡-subst-removable : ∀ {a p} {A : Set a}
(P : A → Set p) {x y} (eq : x ≡ y) z →
P.subst P eq z ≅ z
≡-subst-removable P refl z = refl
cong : ∀ {a b} {A : Set a} {B : A → Set b} {x y}
(f : (x : A) → B x) → x ≅ y → f x ≅ f y
cong f refl = refl
cong-app : ∀ {a b} {A : Set a} {B : A → Set b} {f g : (x : A) → B x} →
f ≅ g → (x : A) → f x ≅ g x
cong-app refl x = refl
cong₂ : ∀ {a b c} {A : Set a} {B : A → Set b} {C : ∀ x → B x → Set c}
{x y u v}
(f : (x : A) (y : B x) → C x y) → x ≅ y → u ≅ v → f x u ≅ f y v
cong₂ f refl refl = refl
resp₂ : ∀ {a ℓ} {A : Set a} (∼ : Rel A ℓ) → ∼ Respects₂ (λ x y → x ≅ y)
resp₂ _∼_ = subst⟶resp₂ _∼_ subst
proof-irrelevance : ∀ {ℓ} {A B : Set ℓ} {x : A} {y : B}
(p q : x ≅ y) → p ≡ q
proof-irrelevance refl refl = refl
isEquivalence : ∀ {a} {A : Set a} →
IsEquivalence {A = A} (λ x y → x ≅ y)
isEquivalence = record
{ refl = refl
; sym = sym
; trans = trans
}
setoid : ∀ {a} → Set a → Setoid _ _
setoid A = record
{ Carrier = A
; _≈_ = λ x y → x ≅ y
; isEquivalence = isEquivalence
}
indexedSetoid : ∀ {a b} {A : Set a} → (A → Set b) → I.Setoid A _ _
indexedSetoid B = record
{ Carrier = B
; _≈_ = λ x y → x ≅ y
; isEquivalence = record
{ refl = refl
; sym = sym
; trans = trans
}
}
≡↔≅ : ∀ {a b} {A : Set a} (B : A → Set b) {x : A} →
Inverse (P.setoid (B x)) (indexedSetoid B at x)
≡↔≅ B = record
{ to = record { _⟨$⟩_ = id; cong = ≡-to-≅ }
; from = record { _⟨$⟩_ = id; cong = ≅-to-≡ }
; inverse-of = record
{ left-inverse-of = λ _ → refl
; right-inverse-of = λ _ → refl
}
}
decSetoid : ∀ {a} {A : Set a} →
Decidable {A = A} {B = A} (λ x y → x ≅ y) →
DecSetoid _ _
decSetoid dec = record
{ _≈_ = λ x y → x ≅ y
; isDecEquivalence = record
{ isEquivalence = isEquivalence
; _≟_ = dec
}
}
isPreorder : ∀ {a} {A : Set a} →
IsPreorder {A = A} (λ x y → x ≅ y) (λ x y → x ≅ y)
isPreorder = record
{ isEquivalence = isEquivalence
; reflexive = id
; trans = trans
}
isPreorder-≡ : ∀ {a} {A : Set a} →
IsPreorder {A = A} _≡_ (λ x y → x ≅ y)
isPreorder-≡ = record
{ isEquivalence = P.isEquivalence
; reflexive = reflexive
; trans = trans
}
preorder : ∀ {a} → Set a → Preorder _ _ _
preorder A = record
{ Carrier = A
; _≈_ = _≡_
; _∼_ = λ x y → x ≅ y
; isPreorder = isPreorder-≡
}
------------------------------------------------------------------------
-- Convenient syntax for equational reasoning
module ≅-Reasoning where
-- The code in Relation.Binary.EqReasoning cannot handle
-- heterogeneous equalities, hence the code duplication here.
infix 4 _IsRelatedTo_
infix 2 _∎
infixr 2 _≅⟨_⟩_ _≡⟨_⟩_ _≡⟨⟩_
infix 1 begin_
data _IsRelatedTo_ {ℓ} {A : Set ℓ} (x : A) {B : Set ℓ} (y : B) :
Set ℓ where
relTo : (x≅y : x ≅ y) → x IsRelatedTo y
begin_ : ∀ {ℓ} {A : Set ℓ} {x : A} {B} {y : B} →
x IsRelatedTo y → x ≅ y
begin relTo x≅y = x≅y
_≅⟨_⟩_ : ∀ {ℓ} {A : Set ℓ} (x : A) {B} {y : B} {C} {z : C} →
x ≅ y → y IsRelatedTo z → x IsRelatedTo z
_ ≅⟨ x≅y ⟩ relTo y≅z = relTo (trans x≅y y≅z)
_≡⟨_⟩_ : ∀ {ℓ} {A : Set ℓ} (x : A) {y C} {z : C} →
x ≡ y → y IsRelatedTo z → x IsRelatedTo z
_ ≡⟨ x≡y ⟩ relTo y≅z = relTo (trans (reflexive x≡y) y≅z)
_≡⟨⟩_ : ∀ {ℓ} {A : Set ℓ} (x : A) {B} {y : B} →
x IsRelatedTo y → x IsRelatedTo y
_ ≡⟨⟩ x≅y = x≅y
_∎ : ∀ {a} {A : Set a} (x : A) → x IsRelatedTo x
_∎ _ = relTo refl
------------------------------------------------------------------------
-- Functional extensionality
-- A form of functional extensionality for _≅_.
Extensionality : (a b : Level) → Set _
Extensionality a b =
{A : Set a} {B₁ B₂ : A → Set b}
{f₁ : (x : A) → B₁ x} {f₂ : (x : A) → B₂ x} →
(∀ x → B₁ x ≡ B₂ x) → (∀ x → f₁ x ≅ f₂ x) → f₁ ≅ f₂
-- This form of extensionality follows from extensionality for _≡_.
≡-ext-to-≅-ext : ∀ {ℓ₁ ℓ₂} →
P.Extensionality ℓ₁ (suc ℓ₂) → Extensionality ℓ₁ ℓ₂
≡-ext-to-≅-ext ext B₁≡B₂ f₁≅f₂ with ext B₁≡B₂
≡-ext-to-≅-ext {ℓ₁} {ℓ₂} ext B₁≡B₂ f₁≅f₂ | P.refl =
≡-to-≅ $ ext′ (≅-to-≡ ∘ f₁≅f₂)
where
ext′ : P.Extensionality ℓ₁ ℓ₂
ext′ = P.extensionality-for-lower-levels ℓ₁ (suc ℓ₂) ext
------------------------------------------------------------------------
-- Inspect on steroids
-- Inspect on steroids can be used when you want to pattern match on
-- the result r of some expression e, and you also need to "remember"
-- that r ≡ e.
data Reveal_is_ {a} {A : Set a} (x : Hidden A) (y : A) : Set a where
[_] : (eq : reveal x ≅ y) → Reveal x is y
inspect : ∀ {a b} {A : Set a} {B : A → Set b}
(f : (x : A) → B x) (x : A) → Reveal (hide f x) is (f x)
inspect f x = [ refl ]
| {
"alphanum_fraction": 0.4701514269,
"avg_line_length": 29.1016949153,
"ext": "agda",
"hexsha": "d6e6896e9387d9e21b531143f3ac33a62a03acc8",
"lang": "Agda",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "9d4c43b1609d3f085636376fdca73093481ab882",
"max_forks_repo_licenses": [
"Apache-2.0"
],
"max_forks_repo_name": "qwe2/try-agda",
"max_forks_repo_path": "agda-stdlib-0.9/src/Relation/Binary/HeterogeneousEquality.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "9d4c43b1609d3f085636376fdca73093481ab882",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"Apache-2.0"
],
"max_issues_repo_name": "qwe2/try-agda",
"max_issues_repo_path": "agda-stdlib-0.9/src/Relation/Binary/HeterogeneousEquality.agda",
"max_line_length": 72,
"max_stars_count": 1,
"max_stars_repo_head_hexsha": "9d4c43b1609d3f085636376fdca73093481ab882",
"max_stars_repo_licenses": [
"Apache-2.0"
],
"max_stars_repo_name": "qwe2/try-agda",
"max_stars_repo_path": "agda-stdlib-0.9/src/Relation/Binary/HeterogeneousEquality.agda",
"max_stars_repo_stars_event_max_datetime": "2016-10-20T15:52:05.000Z",
"max_stars_repo_stars_event_min_datetime": "2016-10-20T15:52:05.000Z",
"num_tokens": 2666,
"size": 6868
} |
{-# OPTIONS --safe --warning=error --without-K #-}
open import Lists.Definition
module Lists.Fold.Fold {a b : _} {A : Set a} {B : Set b} where
fold : (f : A → B → B) → B → List A → B
fold f default [] = default
fold f default (x :: l) = f x (fold f default l)
| {
"alphanum_fraction": 0.5931558935,
"avg_line_length": 26.3,
"ext": "agda",
"hexsha": "921f143c0669e48d9b8346b017c87bb691dec84c",
"lang": "Agda",
"max_forks_count": 1,
"max_forks_repo_forks_event_max_datetime": "2021-11-29T13:23:07.000Z",
"max_forks_repo_forks_event_min_datetime": "2021-11-29T13:23:07.000Z",
"max_forks_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "Smaug123/agdaproofs",
"max_forks_repo_path": "Lists/Fold/Fold.agda",
"max_issues_count": 14,
"max_issues_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562",
"max_issues_repo_issues_event_max_datetime": "2020-04-11T11:03:39.000Z",
"max_issues_repo_issues_event_min_datetime": "2019-01-06T21:11:59.000Z",
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "Smaug123/agdaproofs",
"max_issues_repo_path": "Lists/Fold/Fold.agda",
"max_line_length": 62,
"max_stars_count": 4,
"max_stars_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "Smaug123/agdaproofs",
"max_stars_repo_path": "Lists/Fold/Fold.agda",
"max_stars_repo_stars_event_max_datetime": "2022-01-28T06:04:15.000Z",
"max_stars_repo_stars_event_min_datetime": "2019-08-08T12:44:19.000Z",
"num_tokens": 87,
"size": 263
} |
module DelayMishMash where
open import Level --public
using (Level) renaming (zero to lzero; suc to lsuc)
open import Size public
open import Prelude.Monad renaming (Monad to RawMonad)
--open import Category.Monad public
-- using (RawMonad; module RawMonad)
open import Data.Empty --public
using (⊥; ⊥-elim)
open import Data.List --public
using (List; []; _∷_; map)
open import Data.Maybe --public
using (Maybe; just; nothing) renaming (map to fmap)
open import Data.Product public
using (∃; _×_; _,_) renaming (proj₁ to fst; proj₂ to snd)
--infixr 1 _,_
open import Data.Sum --public
using (_⊎_; [_,_]′) renaming (inj₁ to inl; inj₂ to inr)
open import Data.Unit --public
using (⊤)
open import Function --public
using (_∘_; case_of_)
open import Relation.Nullary --public
using (Dec; yes; no)
open import Relation.Binary --public
using (Setoid; module Setoid)
import Relation.Binary.PreorderReasoning
module Pre = Relation.Binary.PreorderReasoning
open import Relation.Binary.PropositionalEquality --public
using (_≡_; refl; sym; trans; cong; cong₂; subst; module ≡-Reasoning)
--open ≡-Reasoning renaming (begin_ to proof_) public
open import Relation.Binary.HeterogeneousEquality --public
using (_≅_; refl; ≡-to-≅; module ≅-Reasoning)
renaming (sym to hsym; trans to htrans; cong to hcong;
cong₂ to hcong₂; subst to hsubst)
hcong₃ : {A : Set}{B : A → Set}{C : ∀ a → B a → Set}{D : ∀ a b → C a b → Set}
(f : ∀ a b c → D a b c)
{a a′ : A} → a ≅ a′ →
{b : B a}{b′ : B a′} → b ≅ b′ →
{c : C a b}{c′ : C a′ b′} → c ≅ c′ →
f a b c ≅ f a′ b′ c′
hcong₃ f refl refl refl = refl
≅-to-≡ : ∀ {a} {A : Set a} {x y : A} → x ≅ y → x ≡ y
≅-to-≡ refl = refl
mutual
data Delay (i : Size) (A : Set) : Set where
now : A → Delay i A
later : ∞Delay i A → Delay i A
record ∞Delay (i : Size) (A : Set) : Set where
coinductive
field
force : {j : Size< i} → Delay j A
open ∞Delay public
never : ∀{i A} → ∞Delay i A
force (never {i}) {j} = later (never {j})
module Bind where
mutual
bindDelay : ∀ {i A B} → Delay i A → (A → Delay i B) → Delay i B
bindDelay (now a) f = f a
bindDelay (later a∞) f = later (bind∞Delay a∞ f)
bind∞Delay : ∀ {i A B} → ∞Delay i A → (A → Delay i B) → ∞Delay i B
force (bind∞Delay a∞ f) = bindDelay (force a∞) f
_d>>=_ : ∀ {i A B} → Delay i A → (A → Delay i B) → Delay i B
_d>>=_ {i} = Bind.bindDelay {i}
{-
open import Prelude.Applicative using (Applicative)
instance delayApplicative : ∀ {i} → Applicative (Delay i)
Applicative.pure (delayApplicative {i}) x = now x
Applicative._<*>_ (delayApplicative {i}) (now f) x = x d>>= (now ∘ f)
Applicative._<*>_ (delayApplicative {i}) (later f) x = {!force f {i}!}
{-
Applicative._<*>_ (delayApplicative {i}) f (now x) = {!x!} -- Bind.bindDelay x (λ x₁ → {!!})
Applicative._<*>_ (delayApplicative {i}) (now f) (later x) = {!!} -- Bind.bindDelay x (λ x₁ → {!!})
Applicative._<*>_ (delayApplicative {i}) (later f) (later x) = {!!} -- Bind.bindDelay x (λ x₁ → {!!})
-}
Applicative.super (delayApplicative {i}) = {!!}
-}
{-
instance delayMonad : ∀ {i} → RawMonad (Delay i)
delayMonad {i} = record
{ {-return = now
; -}_>>=_ = bindDelay {i}
} where open Bind
-}
{-
module _ {i : Size} where
open module DelayMonad = RawMonad (delayMonad {i = i})
public -- renaming (_⊛_ to _<*>_)
-}
open Bind public using () renaming (bind∞Delay to _∞>>=_)
-- Map for Delay
dreturn : {i : Size} → {A : Set} → A → Delay i A
dreturn {i} = Delay.now {i}
_d<$>_ : ∀ {i A B} (f : A → B) (a : Delay i A) → Delay i B
f d<$> a = a d>>= λ a → dreturn (f a)
-- Map for ∞Delay
_∞<$>_ : ∀ {i A B} (f : A → B) (∞a : ∞Delay i A) → ∞Delay i B
f ∞<$> ∞a = ∞a ∞>>= λ a → dreturn (f a)
-- force (f ∞<$> ∞a) = f <$> force ∞a
-- Double bind
_=<<2_,_ : ∀ {i A B C} → (A → B → Delay i C) → Delay i A → Delay i B → Delay i C
f =<<2 x , y = x d>>= λ a → y d>>= λ b → f a b
mutual
data _∼_ {i : Size} {A : Set} : (a? b? : Delay ∞ A) → Set where
∼now : ∀ a → now a ∼ now a
∼later : ∀ {a∞ b∞} (eq : a∞ ∞∼⟨ i ⟩∼ b∞) → later a∞ ∼ later b∞
_∼⟨_⟩∼_ = λ {A} a? i b? → _∼_ {i}{A} a? b?
record _∞∼⟨_⟩∼_ {A} (a∞ : ∞Delay ∞ A) i (b∞ : ∞Delay ∞ A) : Set where
coinductive
field
∼force : {j : Size< i} → force a∞ ∼⟨ j ⟩∼ force b∞
_∞∼_ = λ {i} {A} a∞ b∞ → _∞∼⟨_⟩∼_ {A} a∞ i b∞
open _∞∼⟨_⟩∼_ public
∼never : ∀{i A} → (never {A = A}) ∞∼⟨ i ⟩∼ never
∼force ∼never = ∼later ∼never
∼refl : ∀{i A} (a? : Delay ∞ A) → a? ∼⟨ i ⟩∼ a?
∞∼refl : ∀{i A} (a∞ : ∞Delay ∞ A) → a∞ ∞∼⟨ i ⟩∼ a∞
∼sym : ∀{i A}{a? b? : Delay ∞ A } → a? ∼⟨ i ⟩∼ b? → b? ∼⟨ i ⟩∼ a?
∞∼sym : ∀{i A}{a∞ b∞ : ∞Delay ∞ A} → a∞ ∞∼⟨ i ⟩∼ b∞ → b∞ ∞∼⟨ i ⟩∼ a∞
∼trans : ∀{i A}{a? b? c? : Delay ∞ A} →
a? ∼⟨ i ⟩∼ b? → b? ∼⟨ i ⟩∼ c? → a? ∼⟨ i ⟩∼ c?
∞∼trans : ∀{i A}{a∞ b∞ c∞ : ∞Delay ∞ A} →
a∞ ∞∼⟨ i ⟩∼ b∞ → b∞ ∞∼⟨ i ⟩∼ c∞ → a∞ ∞∼⟨ i ⟩∼ c∞
∼refl (now a) = ∼now a
∼refl (later a∞) = ∼later (∞∼refl a∞)
∼force (∞∼refl a∞) = ∼refl (force a∞)
∼sym (∼now a) = ∼now a
∼sym (∼later eq) = ∼later (∞∼sym eq)
∼force (∞∼sym eq) = ∼sym (∼force eq)
∼trans (∼now a) (∼now .a) = ∼now a
∼trans (∼later eq) (∼later eq′) = ∼later (∞∼trans eq eq′)
∼force (∞∼trans eq eq′) = ∼trans (∼force eq) (∼force eq′)
-- Equality reasoning
∼setoid : (i : Size) (A : Set) → Setoid lzero lzero
∼setoid i A = record
{ Carrier = Delay ∞ A
; _≈_ = _∼_ {i}
; isEquivalence = record
{ refl = λ {a?} → ∼refl a?
; sym = ∼sym
; trans = ∼trans
}
}
∞∼setoid : (i : Size) (A : Set) → Setoid lzero lzero
∞∼setoid i A = record
{ Carrier = ∞Delay ∞ A
; _≈_ = _∞∼_ {i}
; isEquivalence = record
{ refl = λ {a?} → ∞∼refl a?
; sym = ∞∼sym
; trans = ∞∼trans
}
}
module ∼-Reasoning {i : Size} {A : Set} where
open Pre (Setoid.preorder (∼setoid i A)) public
-- using (begin_; _∎) (_≈⟨⟩_ to _∼⟨⟩_; _≈⟨_⟩_ to _∼⟨_⟩_)
renaming (_≈⟨⟩_ to _≡⟨⟩_; _≈⟨_⟩_ to _≡⟨_⟩_; _∼⟨_⟩_ to _∼⟨_⟩_; begin_ to proof_)
module ∞∼-Reasoning {i : Size} {A : Set} where
open Pre (Setoid.preorder (∞∼setoid i A)) public
-- using (begin_; _∎) (_≈⟨⟩_ to _∼⟨⟩_; _≈⟨_⟩_ to _∼⟨_⟩_)
renaming (_≈⟨⟩_ to _≡⟨⟩_; _≈⟨_⟩_ to _≡⟨_⟩_; _∼⟨_⟩_ to _∞∼⟨_⟩_; begin_ to proof_)
mutual
bind-assoc : ∀{i A B C} (m : Delay ∞ A)
{k : A → Delay ∞ B} {l : B → Delay ∞ C} →
((m d>>= k) d>>= l) ∼⟨ i ⟩∼ (m d>>= λ a → (k a d>>= l))
bind-assoc (now a) = ∼refl _
bind-assoc (later a∞) = ∼later (∞bind-assoc a∞)
∞bind-assoc : ∀{i A B C} (a∞ : ∞Delay ∞ A)
{k : A → Delay ∞ B} {l : B → Delay ∞ C} →
((a∞ ∞>>= k) ∞>>= l) ∞∼⟨ i ⟩∼ (a∞ ∞>>= λ a → (k a d>>= l))
∼force (∞bind-assoc a∞) = bind-assoc (force a∞)
bind-cong-l : ∀{i A B}{a? b? : Delay ∞ A} → a? ∼⟨ i ⟩∼ b? →
(k : A → Delay ∞ B) → (a? d>>= k) ∼⟨ i ⟩∼ (b? d>>= k)
∞bind-cong-l : ∀{i A B}{a∞ b∞ : ∞Delay ∞ A} → a∞ ∞∼⟨ i ⟩∼ b∞ →
(k : A → Delay ∞ B) → (a∞ ∞>>= k) ∞∼⟨ i ⟩∼ (b∞ ∞>>= k)
bind-cong-r : ∀{i A B}(a? : Delay ∞ A){k l : A → Delay ∞ B} →
(∀ a → (k a) ∼⟨ i ⟩∼ (l a)) → (a? d>>= k) ∼⟨ i ⟩∼ (a? d>>= l)
∞bind-cong-r : ∀{i A B}(a∞ : ∞Delay ∞ A){k l : A → Delay ∞ B} →
(∀ a → (k a) ∼⟨ i ⟩∼ (l a)) → (a∞ ∞>>= k) ∞∼⟨ i ⟩∼ (a∞ ∞>>= l)
bind-cong-l (∼now a) k = ∼refl _
bind-cong-l (∼later eq) k = ∼later (∞bind-cong-l eq k)
∼force (∞bind-cong-l eq k) = bind-cong-l (∼force eq) k
bind-cong-r (now a) h = h a
bind-cong-r (later a∞) h = ∼later (∞bind-cong-r a∞ h)
∼force (∞bind-cong-r a∞ h) = bind-cong-r (force a∞) h
open import Prelude.Functor using (Functor; _<$>_)
{-
instance FunctorDelay : {i : Size} → Functor (Delay i)
Functor.fmap (FunctorDelay {i}) {A} {B} f (now x) = {!!}
Functor.fmap (FunctorDelay {i}) {A} {B} f (later x) = {!!}
-}
open import Prelude.Function using (_∘′_)
map-compose : ∀{i A B C} (a? : Delay ∞ A) {f : A → B} {g : B → C} →
(g d<$> (f d<$> a?)) ∼⟨ i ⟩∼ ((g ∘ f) d<$> a?)
map-compose a? = bind-assoc a?
map-cong : ∀{i A B}{a? b? : Delay ∞ A} (f : A → B) →
a? ∼⟨ i ⟩∼ b? → (f d<$> a?) ∼⟨ i ⟩∼ (f d<$> b?)
map-cong f eq = bind-cong-l eq (now ∘ f)
data _⇓_ {A : Set} : (a? : Delay ∞ A) (a : A) → Set where
now⇓ : ∀{a} → now a ⇓ a
later⇓ : ∀{a} {a∞ : ∞Delay ∞ A} → force a∞ ⇓ a → later a∞ ⇓ a
_⇓ : {A : Set} (x : Delay ∞ A) → Set
x ⇓ = ∃ λ a → x ⇓ a
map⇓ : ∀{A B}{a : A}{a? : Delay ∞ A}(f : A → B) → a? ⇓ a → (f d<$> a?) ⇓ f a
subst∼⇓ : ∀{A}{a? a?′ : Delay ∞ A}{a : A} → a? ⇓ a → a? ∼ a?′ → a?′ ⇓ a
bind⇓ : ∀{A B}(f : A → Delay ∞ B){?a : Delay ∞ A}{a : A}{b : B} →
?a ⇓ a → f a ⇓ b → (?a d>>= f) ⇓ b
map⇓ f now⇓ = now⇓
map⇓ f (later⇓ a⇓) = later⇓ (map⇓ f a⇓)
subst∼⇓ now⇓ (∼now a) = now⇓
subst∼⇓ (later⇓ p) (∼later eq) = later⇓ (subst∼⇓ p (∼force eq))
bind⇓ f now⇓ q = q
bind⇓ f (later⇓ p) q = later⇓ (bind⇓ f p q)
--infixr 6 _⇒_
--infixl 1 _,_
| {
"alphanum_fraction": 0.4579093432,
"avg_line_length": 33.204778157,
"ext": "agda",
"hexsha": "b1fa1dbfd312ee9ea804a1ff585fd1d0393d3349",
"lang": "Agda",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "52e1cdbdee54d9a8eaee04ee518a0d7f61d25afb",
"max_forks_repo_licenses": [
"RSA-MD"
],
"max_forks_repo_name": "m0davis/oscar",
"max_forks_repo_path": "archive/agda-1/DelayMishMash.agda",
"max_issues_count": 1,
"max_issues_repo_head_hexsha": "52e1cdbdee54d9a8eaee04ee518a0d7f61d25afb",
"max_issues_repo_issues_event_max_datetime": "2019-05-11T23:33:04.000Z",
"max_issues_repo_issues_event_min_datetime": "2019-04-29T00:35:04.000Z",
"max_issues_repo_licenses": [
"RSA-MD"
],
"max_issues_repo_name": "m0davis/oscar",
"max_issues_repo_path": "archive/agda-1/DelayMishMash.agda",
"max_line_length": 103,
"max_stars_count": null,
"max_stars_repo_head_hexsha": "52e1cdbdee54d9a8eaee04ee518a0d7f61d25afb",
"max_stars_repo_licenses": [
"RSA-MD"
],
"max_stars_repo_name": "m0davis/oscar",
"max_stars_repo_path": "archive/agda-1/DelayMishMash.agda",
"max_stars_repo_stars_event_max_datetime": null,
"max_stars_repo_stars_event_min_datetime": null,
"num_tokens": 4433,
"size": 9729
} |
------------------------------------------------------------------------
-- The Agda standard library
--
-- Bisimilarity for Conats
------------------------------------------------------------------------
{-# OPTIONS --without-K --safe --sized-types #-}
module Codata.Conat.Bisimilarity where
open import Level using (0ℓ)
open import Size
open import Codata.Thunk
open import Codata.Conat
open import Relation.Binary
infix 1 _⊢_≈_
data _⊢_≈_ i : (m n : Conat ∞) → Set where
zero : i ⊢ zero ≈ zero
suc : ∀ {m n} → Thunk^R _⊢_≈_ i m n → i ⊢ suc m ≈ suc n
refl : ∀ {i m} → i ⊢ m ≈ m
refl {m = zero} = zero
refl {m = suc m} = suc λ where .force → refl
sym : ∀ {i m n} → i ⊢ m ≈ n → i ⊢ n ≈ m
sym zero = zero
sym (suc eq) = suc λ where .force → sym (eq .force)
trans : ∀ {i m n p} → i ⊢ m ≈ n → i ⊢ n ≈ p → i ⊢ m ≈ p
trans zero zero = zero
trans (suc eq₁) (suc eq₂) = suc λ where .force → trans (eq₁ .force) (eq₂ .force)
isEquivalence : ∀ {i} → IsEquivalence (i ⊢_≈_)
isEquivalence = record
{ refl = refl
; sym = sym
; trans = trans
}
setoid : Size → Setoid 0ℓ 0ℓ
setoid i = record
{ isEquivalence = isEquivalence {i = i}
}
module ≈-Reasoning {i} where
open import Relation.Binary.Reasoning.Setoid (setoid i) public
infix 1 _⊢_≲_
data _⊢_≲_ i : (m n : Conat ∞) → Set where
z≲n : ∀ {n} → i ⊢ zero ≲ n
s≲s : ∀ {m n} → Thunk^R _⊢_≲_ i m n → i ⊢ suc m ≲ suc n
≈⇒≲ : ∀ {i m n} → i ⊢ m ≈ n → i ⊢ m ≲ n
≈⇒≲ zero = z≲n
≈⇒≲ (suc eq) = s≲s λ where .force → ≈⇒≲ (eq .force)
≲-refl : ∀ {i m} → i ⊢ m ≲ m
≲-refl = ≈⇒≲ refl
≲-antisym : ∀ {i m n} → i ⊢ m ≲ n → i ⊢ n ≲ m → i ⊢ m ≈ n
≲-antisym z≲n z≲n = zero
≲-antisym (s≲s le) (s≲s ge) = suc λ where .force → ≲-antisym (le .force) (ge .force)
≲-trans : ∀ {i m n p} → i ⊢ m ≲ n → i ⊢ n ≲ p → i ⊢ m ≲ p
≲-trans z≲n _ = z≲n
≲-trans (s≲s le₁) (s≲s le₂) = s≲s λ where .force → ≲-trans (le₁ .force) (le₂ .force)
| {
"alphanum_fraction": 0.5002602811,
"avg_line_length": 27.8405797101,
"ext": "agda",
"hexsha": "fea7f2a86668695951e3ee567413283ec46923f2",
"lang": "Agda",
"max_forks_count": 1,
"max_forks_repo_forks_event_max_datetime": "2021-11-04T06:54:45.000Z",
"max_forks_repo_forks_event_min_datetime": "2021-11-04T06:54:45.000Z",
"max_forks_repo_head_hexsha": "fb380f2e67dcb4a94f353dbaec91624fcb5b8933",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "DreamLinuxer/popl21-artifact",
"max_forks_repo_path": "agda-stdlib/src/Codata/Conat/Bisimilarity.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "fb380f2e67dcb4a94f353dbaec91624fcb5b8933",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "DreamLinuxer/popl21-artifact",
"max_issues_repo_path": "agda-stdlib/src/Codata/Conat/Bisimilarity.agda",
"max_line_length": 84,
"max_stars_count": 5,
"max_stars_repo_head_hexsha": "fb380f2e67dcb4a94f353dbaec91624fcb5b8933",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "DreamLinuxer/popl21-artifact",
"max_stars_repo_path": "agda-stdlib/src/Codata/Conat/Bisimilarity.agda",
"max_stars_repo_stars_event_max_datetime": "2020-10-10T21:41:32.000Z",
"max_stars_repo_stars_event_min_datetime": "2020-10-07T12:07:53.000Z",
"num_tokens": 846,
"size": 1921
} |
{-
This second-order equational theory was created from the following second-order syntax description:
$sig_string
-}
module $syn_name.Equality where
open import SOAS.Common
open import SOAS.Context
open import SOAS.Variable
open import SOAS.Families.Core
open import SOAS.Families.Build
open import SOAS.ContextMaps.Inductive
open import $syn_name.Signature
open import $syn_name.Syntax
open import SOAS.Metatheory.SecondOrder.Metasubstitution ${sig}:Syn
open import SOAS.Metatheory.SecondOrder.Equality ${sig}:Syn
private
variable
α β γ τ : $type
Γ Δ Π : Ctx
infix 1 _▹_⊢_≋ₐ_
-- Axioms of equality
data _▹_⊢_≋ₐ_ : ∀ 𝔐 Γ {α} → (𝔐 ▷ ${sig}) α Γ → (𝔐 ▷ ${sig}) α Γ → Set where
$axioms
open EqLogic _▹_⊢_≋ₐ_
open ≋-Reasoning
$derived_eqs
| {
"alphanum_fraction": 0.7427440633,
"avg_line_length": 20.4864864865,
"ext": "agda",
"hexsha": "d5d632f4e9216b0416cb32680507824c9664b844",
"lang": "Agda",
"max_forks_count": 4,
"max_forks_repo_forks_event_max_datetime": "2022-01-24T12:49:17.000Z",
"max_forks_repo_forks_event_min_datetime": "2021-11-09T20:39:59.000Z",
"max_forks_repo_head_hexsha": "ff1a985a6be9b780d3ba2beff68e902394f0a9d8",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "JoeyEremondi/agda-soas",
"max_forks_repo_path": "gen/templates/Equality.agda",
"max_issues_count": 1,
"max_issues_repo_head_hexsha": "ff1a985a6be9b780d3ba2beff68e902394f0a9d8",
"max_issues_repo_issues_event_max_datetime": "2021-11-21T12:19:32.000Z",
"max_issues_repo_issues_event_min_datetime": "2021-11-21T12:19:32.000Z",
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "JoeyEremondi/agda-soas",
"max_issues_repo_path": "gen/templates/Equality.agda",
"max_line_length": 99,
"max_stars_count": 39,
"max_stars_repo_head_hexsha": "ff1a985a6be9b780d3ba2beff68e902394f0a9d8",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "JoeyEremondi/agda-soas",
"max_stars_repo_path": "gen/templates/Equality.agda",
"max_stars_repo_stars_event_max_datetime": "2022-03-19T17:33:12.000Z",
"max_stars_repo_stars_event_min_datetime": "2021-11-09T20:39:55.000Z",
"num_tokens": 258,
"size": 758
} |
{-# OPTIONS --allow-unsolved-metas #-}
module nat where
open import Data.Nat
open import Data.Nat.Properties
open import Data.Empty
open import Relation.Nullary
open import Relation.Binary.PropositionalEquality
open import Relation.Binary.Core
open import Relation.Binary.Definitions
open import logic
open import Level hiding ( zero ; suc )
nat-<> : { x y : ℕ } → x < y → y < x → ⊥
nat-<> (s≤s x<y) (s≤s y<x) = nat-<> x<y y<x
nat-≤> : { x y : ℕ } → x ≤ y → y < x → ⊥
nat-≤> (s≤s x<y) (s≤s y<x) = nat-≤> x<y y<x
nat-<≡ : { x : ℕ } → x < x → ⊥
nat-<≡ (s≤s lt) = nat-<≡ lt
nat-≡< : { x y : ℕ } → x ≡ y → x < y → ⊥
nat-≡< refl lt = nat-<≡ lt
¬a≤a : {la : ℕ} → suc la ≤ la → ⊥
¬a≤a (s≤s lt) = ¬a≤a lt
a<sa : {la : ℕ} → la < suc la
a<sa {zero} = s≤s z≤n
a<sa {suc la} = s≤s a<sa
=→¬< : {x : ℕ } → ¬ ( x < x )
=→¬< {zero} ()
=→¬< {suc x} (s≤s lt) = =→¬< lt
>→¬< : {x y : ℕ } → (x < y ) → ¬ ( y < x )
>→¬< (s≤s x<y) (s≤s y<x) = >→¬< x<y y<x
<-∨ : { x y : ℕ } → x < suc y → ( (x ≡ y ) ∨ (x < y) )
<-∨ {zero} {zero} (s≤s z≤n) = case1 refl
<-∨ {zero} {suc y} (s≤s lt) = case2 (s≤s z≤n)
<-∨ {suc x} {zero} (s≤s ())
<-∨ {suc x} {suc y} (s≤s lt) with <-∨ {x} {y} lt
<-∨ {suc x} {suc y} (s≤s lt) | case1 eq = case1 (cong (λ k → suc k ) eq)
<-∨ {suc x} {suc y} (s≤s lt) | case2 lt1 = case2 (s≤s lt1)
max : (x y : ℕ) → ℕ
max zero zero = zero
max zero (suc x) = (suc x)
max (suc x) zero = (suc x)
max (suc x) (suc y) = suc ( max x y )
-- _*_ : ℕ → ℕ → ℕ
-- _*_ zero _ = zero
-- _*_ (suc n) m = m + ( n * m )
-- x ^ y
exp : ℕ → ℕ → ℕ
exp _ zero = 1
exp n (suc m) = n * ( exp n m )
div2 : ℕ → (ℕ ∧ Bool )
div2 zero = ⟪ 0 , false ⟫
div2 (suc zero) = ⟪ 0 , true ⟫
div2 (suc (suc n)) = ⟪ suc (proj1 (div2 n)) , proj2 (div2 n) ⟫ where
open _∧_
div2-rev : (ℕ ∧ Bool ) → ℕ
div2-rev ⟪ x , true ⟫ = suc (x + x)
div2-rev ⟪ x , false ⟫ = x + x
div2-eq : (x : ℕ ) → div2-rev ( div2 x ) ≡ x
div2-eq zero = refl
div2-eq (suc zero) = refl
div2-eq (suc (suc x)) with div2 x | inspect div2 x
... | ⟪ x1 , true ⟫ | record { eq = eq1 } = begin -- eq1 : div2 x ≡ ⟪ x1 , true ⟫
div2-rev ⟪ suc x1 , true ⟫ ≡⟨⟩
suc (suc (x1 + suc x1)) ≡⟨ cong (λ k → suc (suc k )) (+-comm x1 _ ) ⟩
suc (suc (suc (x1 + x1))) ≡⟨⟩
suc (suc (div2-rev ⟪ x1 , true ⟫)) ≡⟨ cong (λ k → suc (suc (div2-rev k ))) (sym eq1) ⟩
suc (suc (div2-rev (div2 x))) ≡⟨ cong (λ k → suc (suc k)) (div2-eq x) ⟩
suc (suc x) ∎ where open ≡-Reasoning
... | ⟪ x1 , false ⟫ | record { eq = eq1 } = begin
div2-rev ⟪ suc x1 , false ⟫ ≡⟨⟩
suc (x1 + suc x1) ≡⟨ cong (λ k → (suc k )) (+-comm x1 _ ) ⟩
suc (suc (x1 + x1)) ≡⟨⟩
suc (suc (div2-rev ⟪ x1 , false ⟫)) ≡⟨ cong (λ k → suc (suc (div2-rev k ))) (sym eq1) ⟩
suc (suc (div2-rev (div2 x))) ≡⟨ cong (λ k → suc (suc k)) (div2-eq x) ⟩
suc (suc x) ∎ where open ≡-Reasoning
sucprd : {i : ℕ } → 0 < i → suc (pred i) ≡ i
sucprd {suc i} 0<i = refl
0<s : {x : ℕ } → zero < suc x
0<s {_} = s≤s z≤n
px<py : {x y : ℕ } → pred x < pred y → x < y
px<py {zero} {suc y} lt = 0<s
px<py {suc zero} {suc (suc y)} (s≤s lt) = s≤s 0<s
px<py {suc (suc x)} {suc (suc y)} (s≤s lt) = s≤s (px<py {suc x} {suc y} lt)
minus : (a b : ℕ ) → ℕ
minus a zero = a
minus zero (suc b) = zero
minus (suc a) (suc b) = minus a b
_-_ = minus
m+= : {i j m : ℕ } → m + i ≡ m + j → i ≡ j
m+= {i} {j} {zero} refl = refl
m+= {i} {j} {suc m} eq = m+= {i} {j} {m} ( cong (λ k → pred k ) eq )
+m= : {i j m : ℕ } → i + m ≡ j + m → i ≡ j
+m= {i} {j} {m} eq = m+= ( subst₂ (λ j k → j ≡ k ) (+-comm i _ ) (+-comm j _ ) eq )
less-1 : { n m : ℕ } → suc n < m → n < m
less-1 {zero} {suc (suc _)} (s≤s (s≤s z≤n)) = s≤s z≤n
less-1 {suc n} {suc m} (s≤s lt) = s≤s (less-1 {n} {m} lt)
sa=b→a<b : { n m : ℕ } → suc n ≡ m → n < m
sa=b→a<b {0} {suc zero} refl = s≤s z≤n
sa=b→a<b {suc n} {suc (suc n)} refl = s≤s (sa=b→a<b refl)
minus+n : {x y : ℕ } → suc x > y → minus x y + y ≡ x
minus+n {x} {zero} _ = trans (sym (+-comm zero _ )) refl
minus+n {zero} {suc y} (s≤s ())
minus+n {suc x} {suc y} (s≤s lt) = begin
minus (suc x) (suc y) + suc y
≡⟨ +-comm _ (suc y) ⟩
suc y + minus x y
≡⟨ cong ( λ k → suc k ) (
begin
y + minus x y
≡⟨ +-comm y _ ⟩
minus x y + y
≡⟨ minus+n {x} {y} lt ⟩
x
∎
) ⟩
suc x
∎ where open ≡-Reasoning
<-minus-0 : {x y z : ℕ } → z + x < z + y → x < y
<-minus-0 {x} {suc _} {zero} lt = lt
<-minus-0 {x} {y} {suc z} (s≤s lt) = <-minus-0 {x} {y} {z} lt
<-minus : {x y z : ℕ } → x + z < y + z → x < y
<-minus {x} {y} {z} lt = <-minus-0 ( subst₂ ( λ j k → j < k ) (+-comm x _) (+-comm y _ ) lt )
x≤x+y : {z y : ℕ } → z ≤ z + y
x≤x+y {zero} {y} = z≤n
x≤x+y {suc z} {y} = s≤s (x≤x+y {z} {y})
x≤y+x : {z y : ℕ } → z ≤ y + z
x≤y+x {z} {y} = subst (λ k → z ≤ k ) (+-comm _ y ) x≤x+y
<-plus : {x y z : ℕ } → x < y → x + z < y + z
<-plus {zero} {suc y} {z} (s≤s z≤n) = s≤s (subst (λ k → z ≤ k ) (+-comm z _ ) x≤x+y )
<-plus {suc x} {suc y} {z} (s≤s lt) = s≤s (<-plus {x} {y} {z} lt)
<-plus-0 : {x y z : ℕ } → x < y → z + x < z + y
<-plus-0 {x} {y} {z} lt = subst₂ (λ j k → j < k ) (+-comm _ z) (+-comm _ z) ( <-plus {x} {y} {z} lt )
≤-plus : {x y z : ℕ } → x ≤ y → x + z ≤ y + z
≤-plus {0} {y} {zero} z≤n = z≤n
≤-plus {0} {y} {suc z} z≤n = subst (λ k → z < k ) (+-comm _ y ) x≤x+y
≤-plus {suc x} {suc y} {z} (s≤s lt) = s≤s ( ≤-plus {x} {y} {z} lt )
≤-plus-0 : {x y z : ℕ } → x ≤ y → z + x ≤ z + y
≤-plus-0 {x} {y} {zero} lt = lt
≤-plus-0 {x} {y} {suc z} lt = s≤s ( ≤-plus-0 {x} {y} {z} lt )
x+y<z→x<z : {x y z : ℕ } → x + y < z → x < z
x+y<z→x<z {zero} {y} {suc z} (s≤s lt1) = s≤s z≤n
x+y<z→x<z {suc x} {y} {suc z} (s≤s lt1) = s≤s ( x+y<z→x<z {x} {y} {z} lt1 )
*≤ : {x y z : ℕ } → x ≤ y → x * z ≤ y * z
*≤ lt = *-mono-≤ lt ≤-refl
*< : {x y z : ℕ } → x < y → x * suc z < y * suc z
*< {zero} {suc y} lt = s≤s z≤n
*< {suc x} {suc y} (s≤s lt) = <-plus-0 (*< lt)
<to<s : {x y : ℕ } → x < y → x < suc y
<to<s {zero} {suc y} (s≤s lt) = s≤s z≤n
<to<s {suc x} {suc y} (s≤s lt) = s≤s (<to<s {x} {y} lt)
<tos<s : {x y : ℕ } → x < y → suc x < suc y
<tos<s {zero} {suc y} (s≤s z≤n) = s≤s (s≤s z≤n)
<tos<s {suc x} {suc y} (s≤s lt) = s≤s (<tos<s {x} {y} lt)
<to≤ : {x y : ℕ } → x < y → x ≤ y
<to≤ {zero} {suc y} (s≤s z≤n) = z≤n
<to≤ {suc x} {suc y} (s≤s lt) = s≤s (<to≤ {x} {y} lt)
refl-≤s : {x : ℕ } → x ≤ suc x
refl-≤s {zero} = z≤n
refl-≤s {suc x} = s≤s (refl-≤s {x})
refl-≤ : {x : ℕ } → x ≤ x
refl-≤ {zero} = z≤n
refl-≤ {suc x} = s≤s (refl-≤ {x})
x<y→≤ : {x y : ℕ } → x < y → x ≤ suc y
x<y→≤ {zero} {.(suc _)} (s≤s z≤n) = z≤n
x<y→≤ {suc x} {suc y} (s≤s lt) = s≤s (x<y→≤ {x} {y} lt)
≤→= : {i j : ℕ} → i ≤ j → j ≤ i → i ≡ j
≤→= {0} {0} z≤n z≤n = refl
≤→= {suc i} {suc j} (s≤s i<j) (s≤s j<i) = cong suc ( ≤→= {i} {j} i<j j<i )
px≤x : {x : ℕ } → pred x ≤ x
px≤x {zero} = refl-≤
px≤x {suc x} = refl-≤s
px≤py : {x y : ℕ } → x ≤ y → pred x ≤ pred y
px≤py {zero} {zero} lt = refl-≤
px≤py {zero} {suc y} lt = z≤n
px≤py {suc x} {suc y} (s≤s lt) = lt
open import Data.Product
i-j=0→i=j : {i j : ℕ } → j ≤ i → i - j ≡ 0 → i ≡ j
i-j=0→i=j {zero} {zero} _ refl = refl
i-j=0→i=j {zero} {suc j} () refl
i-j=0→i=j {suc i} {zero} z≤n ()
i-j=0→i=j {suc i} {suc j} (s≤s lt) eq = cong suc (i-j=0→i=j {i} {j} lt eq)
m*n=0⇒m=0∨n=0 : {i j : ℕ} → i * j ≡ 0 → (i ≡ 0) ∨ ( j ≡ 0 )
m*n=0⇒m=0∨n=0 {zero} {j} refl = case1 refl
m*n=0⇒m=0∨n=0 {suc i} {zero} eq = case2 refl
minus+1 : {x y : ℕ } → y ≤ x → suc (minus x y) ≡ minus (suc x) y
minus+1 {zero} {zero} y≤x = refl
minus+1 {suc x} {zero} y≤x = refl
minus+1 {suc x} {suc y} (s≤s y≤x) = minus+1 {x} {y} y≤x
minus+yz : {x y z : ℕ } → z ≤ y → x + minus y z ≡ minus (x + y) z
minus+yz {zero} {y} {z} _ = refl
minus+yz {suc x} {y} {z} z≤y = begin
suc x + minus y z ≡⟨ cong suc ( minus+yz z≤y ) ⟩
suc (minus (x + y) z) ≡⟨ minus+1 {x + y} {z} (≤-trans z≤y (subst (λ g → y ≤ g) (+-comm y x) x≤x+y) ) ⟩
minus (suc x + y) z ∎ where open ≡-Reasoning
minus<=0 : {x y : ℕ } → x ≤ y → minus x y ≡ 0
minus<=0 {0} {zero} z≤n = refl
minus<=0 {0} {suc y} z≤n = refl
minus<=0 {suc x} {suc y} (s≤s le) = minus<=0 {x} {y} le
minus>0 : {x y : ℕ } → x < y → 0 < minus y x
minus>0 {zero} {suc _} (s≤s z≤n) = s≤s z≤n
minus>0 {suc x} {suc y} (s≤s lt) = minus>0 {x} {y} lt
minus>0→x<y : {x y : ℕ } → 0 < minus y x → x < y
minus>0→x<y {x} {y} lt with <-cmp x y
... | tri< a ¬b ¬c = a
... | tri≈ ¬a refl ¬c = ⊥-elim ( nat-≡< (sym (minus<=0 {x} ≤-refl)) lt )
... | tri> ¬a ¬b c = ⊥-elim ( nat-≡< (sym (minus<=0 {y} (≤-trans refl-≤s c ))) lt )
minus+y-y : {x y : ℕ } → (x + y) - y ≡ x
minus+y-y {zero} {y} = minus<=0 {zero + y} {y} ≤-refl
minus+y-y {suc x} {y} = begin
(suc x + y) - y ≡⟨ sym (minus+1 {_} {y} x≤y+x) ⟩
suc ((x + y) - y) ≡⟨ cong suc (minus+y-y {x} {y}) ⟩
suc x ∎ where open ≡-Reasoning
minus+yx-yz : {x y z : ℕ } → (y + x) - (y + z) ≡ x - z
minus+yx-yz {x} {zero} {z} = refl
minus+yx-yz {x} {suc y} {z} = minus+yx-yz {x} {y} {z}
minus+xy-zy : {x y z : ℕ } → (x + y) - (z + y) ≡ x - z
minus+xy-zy {x} {y} {z} = subst₂ (λ j k → j - k ≡ x - z ) (+-comm y x) (+-comm y z) (minus+yx-yz {x} {y} {z})
y-x<y : {x y : ℕ } → 0 < x → 0 < y → y - x < y
y-x<y {x} {y} 0<x 0<y with <-cmp x (suc y)
... | tri< a ¬b ¬c = +-cancelʳ-< {x} (y - x) y ( begin
suc ((y - x) + x) ≡⟨ cong suc (minus+n {y} {x} a ) ⟩
suc y ≡⟨ +-comm 1 _ ⟩
y + suc 0 ≤⟨ +-mono-≤ ≤-refl 0<x ⟩
y + x ∎ ) where open ≤-Reasoning
... | tri≈ ¬a refl ¬c = subst ( λ k → k < y ) (sym (minus<=0 {y} {x} refl-≤s )) 0<y
... | tri> ¬a ¬b c = subst ( λ k → k < y ) (sym (minus<=0 {y} {x} (≤-trans (≤-trans refl-≤s refl-≤s) c))) 0<y -- suc (suc y) ≤ x → y ≤ x
open import Relation.Binary.Definitions
distr-minus-* : {x y z : ℕ } → (minus x y) * z ≡ minus (x * z) (y * z)
distr-minus-* {x} {zero} {z} = refl
distr-minus-* {x} {suc y} {z} with <-cmp x y
distr-minus-* {x} {suc y} {z} | tri< a ¬b ¬c = begin
minus x (suc y) * z
≡⟨ cong (λ k → k * z ) (minus<=0 {x} {suc y} (x<y→≤ a)) ⟩
0 * z
≡⟨ sym (minus<=0 {x * z} {z + y * z} le ) ⟩
minus (x * z) (z + y * z)
∎ where
open ≡-Reasoning
le : x * z ≤ z + y * z
le = ≤-trans lemma (subst (λ k → y * z ≤ k ) (+-comm _ z ) (x≤x+y {y * z} {z} ) ) where
lemma : x * z ≤ y * z
lemma = *≤ {x} {y} {z} (<to≤ a)
distr-minus-* {x} {suc y} {z} | tri≈ ¬a refl ¬c = begin
minus x (suc y) * z
≡⟨ cong (λ k → k * z ) (minus<=0 {x} {suc y} refl-≤s ) ⟩
0 * z
≡⟨ sym (minus<=0 {x * z} {z + y * z} (lt {x} {z} )) ⟩
minus (x * z) (z + y * z)
∎ where
open ≡-Reasoning
lt : {x z : ℕ } → x * z ≤ z + x * z
lt {zero} {zero} = z≤n
lt {suc x} {zero} = lt {x} {zero}
lt {x} {suc z} = ≤-trans lemma refl-≤s where
lemma : x * suc z ≤ z + x * suc z
lemma = subst (λ k → x * suc z ≤ k ) (+-comm _ z) (x≤x+y {x * suc z} {z})
distr-minus-* {x} {suc y} {z} | tri> ¬a ¬b c = +m= {_} {_} {suc y * z} ( begin
minus x (suc y) * z + suc y * z
≡⟨ sym (proj₂ *-distrib-+ z (minus x (suc y) ) _) ⟩
( minus x (suc y) + suc y ) * z
≡⟨ cong (λ k → k * z) (minus+n {x} {suc y} (s≤s c)) ⟩
x * z
≡⟨ sym (minus+n {x * z} {suc y * z} (s≤s (lt c))) ⟩
minus (x * z) (suc y * z) + suc y * z
∎ ) where
open ≡-Reasoning
lt : {x y z : ℕ } → suc y ≤ x → z + y * z ≤ x * z
lt {x} {y} {z} le = *≤ le
distr-minus-*' : {z x y : ℕ } → z * (minus x y) ≡ minus (z * x) (z * y)
distr-minus-*' {z} {x} {y} = begin
z * (minus x y) ≡⟨ *-comm _ (x - y) ⟩
(minus x y) * z ≡⟨ distr-minus-* {x} {y} {z} ⟩
minus (x * z) (y * z) ≡⟨ cong₂ (λ j k → j - k ) (*-comm x z ) (*-comm y z) ⟩
minus (z * x) (z * y) ∎ where open ≡-Reasoning
minus- : {x y z : ℕ } → suc x > z + y → minus (minus x y) z ≡ minus x (y + z)
minus- {x} {y} {z} gt = +m= {_} {_} {z} ( begin
minus (minus x y) z + z
≡⟨ minus+n {_} {z} lemma ⟩
minus x y
≡⟨ +m= {_} {_} {y} ( begin
minus x y + y
≡⟨ minus+n {_} {y} lemma1 ⟩
x
≡⟨ sym ( minus+n {_} {z + y} gt ) ⟩
minus x (z + y) + (z + y)
≡⟨ sym ( +-assoc (minus x (z + y)) _ _ ) ⟩
minus x (z + y) + z + y
∎ ) ⟩
minus x (z + y) + z
≡⟨ cong (λ k → minus x k + z ) (+-comm _ y ) ⟩
minus x (y + z) + z
∎ ) where
open ≡-Reasoning
lemma1 : suc x > y
lemma1 = x+y<z→x<z (subst (λ k → k < suc x ) (+-comm z _ ) gt )
lemma : suc (minus x y) > z
lemma = <-minus {_} {_} {y} ( subst ( λ x → z + y < suc x ) (sym (minus+n {x} {y} lemma1 )) gt )
minus-* : {M k n : ℕ } → n < k → minus k (suc n) * M ≡ minus (minus k n * M ) M
minus-* {zero} {k} {n} lt = begin
minus k (suc n) * zero
≡⟨ *-comm (minus k (suc n)) zero ⟩
zero * minus k (suc n)
≡⟨⟩
0 * minus k n
≡⟨ *-comm 0 (minus k n) ⟩
minus (minus k n * 0 ) 0
∎ where
open ≡-Reasoning
minus-* {suc m} {k} {n} lt with <-cmp k 1
minus-* {suc m} {.0} {zero} lt | tri< (s≤s z≤n) ¬b ¬c = refl
minus-* {suc m} {.0} {suc n} lt | tri< (s≤s z≤n) ¬b ¬c = refl
minus-* {suc zero} {.1} {zero} lt | tri≈ ¬a refl ¬c = refl
minus-* {suc (suc m)} {.1} {zero} lt | tri≈ ¬a refl ¬c = minus-* {suc m} {1} {zero} lt
minus-* {suc m} {.1} {suc n} (s≤s ()) | tri≈ ¬a refl ¬c
minus-* {suc m} {k} {n} lt | tri> ¬a ¬b c = begin
minus k (suc n) * M
≡⟨ distr-minus-* {k} {suc n} {M} ⟩
minus (k * M ) ((suc n) * M)
≡⟨⟩
minus (k * M ) (M + n * M )
≡⟨ cong (λ x → minus (k * M) x) (+-comm M _ ) ⟩
minus (k * M ) ((n * M) + M )
≡⟨ sym ( minus- {k * M} {n * M} (lemma lt) ) ⟩
minus (minus (k * M ) (n * M)) M
≡⟨ cong (λ x → minus x M ) ( sym ( distr-minus-* {k} {n} )) ⟩
minus (minus k n * M ) M
∎ where
M = suc m
lemma : {n k m : ℕ } → n < k → suc (k * suc m) > suc m + n * suc m
lemma {zero} {suc k} {m} (s≤s lt) = s≤s (s≤s (subst (λ x → x ≤ m + k * suc m) (+-comm 0 _ ) x≤x+y ))
lemma {suc n} {suc k} {m} lt = begin
suc (suc m + suc n * suc m)
≡⟨⟩
suc ( suc (suc n) * suc m)
≤⟨ ≤-plus-0 {_} {_} {1} (*≤ lt ) ⟩
suc (suc k * suc m)
∎ where open ≤-Reasoning
open ≡-Reasoning
x=y+z→x-z=y : {x y z : ℕ } → x ≡ y + z → x - z ≡ y
x=y+z→x-z=y {x} {zero} {.x} refl = minus<=0 {x} {x} refl-≤ -- x ≡ suc (y + z) → (x ≡ y + z → x - z ≡ y) → (x - z) ≡ suc y
x=y+z→x-z=y {suc x} {suc y} {zero} eq = begin -- suc x ≡ suc (y + zero) → (suc x - zero) ≡ suc y
suc x - zero ≡⟨ refl ⟩
suc x ≡⟨ eq ⟩
suc y + zero ≡⟨ +-comm _ zero ⟩
suc y ∎ where open ≡-Reasoning
x=y+z→x-z=y {suc x} {suc y} {suc z} eq = x=y+z→x-z=y {x} {suc y} {z} ( begin
x ≡⟨ cong pred eq ⟩
pred (suc y + suc z) ≡⟨ +-comm _ (suc z) ⟩
suc z + y ≡⟨ cong suc ( +-comm _ y ) ⟩
suc y + z ∎ ) where open ≡-Reasoning
m*1=m : {m : ℕ } → m * 1 ≡ m
m*1=m {zero} = refl
m*1=m {suc m} = cong suc m*1=m
record Finduction {n m : Level} (P : Set n ) (Q : P → Set m ) (f : P → ℕ) : Set (n Level.⊔ m) where
field
fzero : {p : P} → f p ≡ zero → Q p
pnext : (p : P ) → P
decline : {p : P} → 0 < f p → f (pnext p) < f p
ind : {p : P} → Q (pnext p) → Q p
y<sx→y≤x : {x y : ℕ} → y < suc x → y ≤ x
y<sx→y≤x (s≤s lt) = lt
fi0 : (x : ℕ) → x ≤ zero → x ≡ zero
fi0 .0 z≤n = refl
f-induction : {n m : Level} {P : Set n } → {Q : P → Set m }
→ (f : P → ℕ)
→ Finduction P Q f
→ (p : P ) → Q p
f-induction {n} {m} {P} {Q} f I p with <-cmp 0 (f p)
... | tri> ¬a ¬b ()
... | tri≈ ¬a b ¬c = Finduction.fzero I (sym b)
... | tri< lt _ _ = f-induction0 p (f p) (<to≤ (Finduction.decline I lt)) where
f-induction0 : (p : P) → (x : ℕ) → (f (Finduction.pnext I p)) ≤ x → Q p
f-induction0 p zero le = Finduction.ind I (Finduction.fzero I (fi0 _ le))
f-induction0 p (suc x) le with <-cmp (f (Finduction.pnext I p)) (suc x)
... | tri< (s≤s a) ¬b ¬c = f-induction0 p x a
... | tri≈ ¬a b ¬c = Finduction.ind I (f-induction0 (Finduction.pnext I p) x (y<sx→y≤x f1)) where
f1 : f (Finduction.pnext I (Finduction.pnext I p)) < suc x
f1 = subst (λ k → f (Finduction.pnext I (Finduction.pnext I p)) < k ) b ( Finduction.decline I {Finduction.pnext I p}
(subst (λ k → 0 < k ) (sym b) (s≤s z≤n ) ))
... | tri> ¬a ¬b c = ⊥-elim ( nat-≤> le c )
record Ninduction {n m : Level} (P : Set n ) (Q : P → Set m ) (f : P → ℕ) : Set (n Level.⊔ m) where
field
pnext : (p : P ) → P
fzero : {p : P} → f (pnext p) ≡ zero → Q p
decline : {p : P} → 0 < f p → f (pnext p) < f p
ind : {p : P} → Q (pnext p) → Q p
s≤s→≤ : { i j : ℕ} → suc i ≤ suc j → i ≤ j
s≤s→≤ (s≤s lt) = lt
n-induction : {n m : Level} {P : Set n } → {Q : P → Set m }
→ (f : P → ℕ)
→ Ninduction P Q f
→ (p : P ) → Q p
n-induction {n} {m} {P} {Q} f I p = f-induction0 p (f (Ninduction.pnext I p)) ≤-refl where
f-induction0 : (p : P) → (x : ℕ) → (f (Ninduction.pnext I p)) ≤ x → Q p
f-induction0 p zero lt = Ninduction.fzero I {p} (fi0 _ lt)
f-induction0 p (suc x) le with <-cmp (f (Ninduction.pnext I p)) (suc x)
... | tri< (s≤s a) ¬b ¬c = f-induction0 p x a
... | tri≈ ¬a b ¬c = Ninduction.ind I (f-induction0 (Ninduction.pnext I p) x (s≤s→≤ nle) ) where
f>0 : 0 < f (Ninduction.pnext I p)
f>0 = subst (λ k → 0 < k ) (sym b) ( s≤s z≤n )
nle : suc (f (Ninduction.pnext I (Ninduction.pnext I p))) ≤ suc x
nle = subst (λ k → suc (f (Ninduction.pnext I (Ninduction.pnext I p))) ≤ k) b (Ninduction.decline I {Ninduction.pnext I p} f>0 )
... | tri> ¬a ¬b c = ⊥-elim ( nat-≤> le c )
record Factor (n m : ℕ ) : Set where
field
factor : ℕ
remain : ℕ
is-factor : factor * n + remain ≡ m
record Dividable (n m : ℕ ) : Set where
field
factor : ℕ
is-factor : factor * n + 0 ≡ m
open Factor
DtoF : {n m : ℕ} → Dividable n m → Factor n m
DtoF {n} {m} record { factor = f ; is-factor = fa } = record { factor = f ; remain = 0 ; is-factor = fa }
FtoD : {n m : ℕ} → (fc : Factor n m) → remain fc ≡ 0 → Dividable n m
FtoD {n} {m} record { factor = f ; remain = r ; is-factor = fa } refl = record { factor = f ; is-factor = fa }
--divdable^2 : ( n k : ℕ ) → Dividable k ( n * n ) → Dividable k n
--divdable^2 n k dn2 = {!!}
decf : { n k : ℕ } → ( x : Factor k (suc n) ) → Factor k n
decf {n} {k} record { factor = f ; remain = r ; is-factor = fa } =
decf1 {n} {k} f r fa where
decf1 : { n k : ℕ } → (f r : ℕ) → (f * k + r ≡ suc n) → Factor k n
decf1 {n} {k} f (suc r) fa = -- this case must be the first
record { factor = f ; remain = r ; is-factor = ( begin -- fa : f * k + suc r ≡ suc n
f * k + r ≡⟨ cong pred ( begin
suc ( f * k + r ) ≡⟨ +-comm _ r ⟩
r + suc (f * k) ≡⟨ sym (+-assoc r 1 _) ⟩
(r + 1) + f * k ≡⟨ cong (λ t → t + f * k ) (+-comm r 1) ⟩
(suc r ) + f * k ≡⟨ +-comm (suc r) _ ⟩
f * k + suc r ≡⟨ fa ⟩
suc n ∎ ) ⟩
n ∎ ) } where open ≡-Reasoning
decf1 {n} {zero} (suc f) zero fa = ⊥-elim ( nat-≡< fa (
begin suc (suc f * zero + zero) ≡⟨ cong suc (+-comm _ zero) ⟩
suc (f * 0) ≡⟨ cong suc (*-comm f zero) ⟩
suc zero ≤⟨ s≤s z≤n ⟩
suc n ∎ )) where open ≤-Reasoning
decf1 {n} {suc k} (suc f) zero fa =
record { factor = f ; remain = k ; is-factor = ( begin -- fa : suc (k + f * suc k + zero) ≡ suc n
f * suc k + k ≡⟨ +-comm _ k ⟩
k + f * suc k ≡⟨ +-comm zero _ ⟩
(k + f * suc k) + zero ≡⟨ cong pred fa ⟩
n ∎ ) } where open ≡-Reasoning
div0 : {k : ℕ} → Dividable k 0
div0 {k} = record { factor = 0; is-factor = refl }
div= : {k : ℕ} → Dividable k k
div= {k} = record { factor = 1; is-factor = ( begin
k + 0 * k + 0 ≡⟨ trans ( +-comm _ 0) ( +-comm _ 0) ⟩
k ∎ ) } where open ≡-Reasoning
div1 : { k : ℕ } → k > 1 → ¬ Dividable k 1
div1 {k} k>1 record { factor = (suc f) ; is-factor = fa } = ⊥-elim ( nat-≡< (sym fa) ( begin
2 ≤⟨ k>1 ⟩
k ≡⟨ +-comm 0 _ ⟩
k + 0 ≡⟨ refl ⟩
1 * k ≤⟨ *-mono-≤ {1} {suc f} (s≤s z≤n ) ≤-refl ⟩
suc f * k ≡⟨ +-comm 0 _ ⟩
suc f * k + 0 ∎ )) where open ≤-Reasoning
div+div : { i j k : ℕ } → Dividable k i → Dividable k j → Dividable k (i + j) ∧ Dividable k (j + i)
div+div {i} {j} {k} di dj = ⟪ div+div1 , subst (λ g → Dividable k g) (+-comm i j) div+div1 ⟫ where
fki = Dividable.factor di
fkj = Dividable.factor dj
div+div1 : Dividable k (i + j)
div+div1 = record { factor = fki + fkj ; is-factor = ( begin
(fki + fkj) * k + 0 ≡⟨ +-comm _ 0 ⟩
(fki + fkj) * k ≡⟨ *-distribʳ-+ k fki _ ⟩
fki * k + fkj * k ≡⟨ cong₂ ( λ i j → i + j ) (+-comm 0 (fki * k)) (+-comm 0 (fkj * k)) ⟩
(fki * k + 0) + (fkj * k + 0) ≡⟨ cong₂ ( λ i j → i + j ) (Dividable.is-factor di) (Dividable.is-factor dj) ⟩
i + j ∎ ) } where
open ≡-Reasoning
div-div : { i j k : ℕ } → k > 1 → Dividable k i → Dividable k j → Dividable k (i - j) ∧ Dividable k (j - i)
div-div {i} {j} {k} k>1 di dj = ⟪ div-div1 di dj , div-div1 dj di ⟫ where
div-div1 : {i j : ℕ } → Dividable k i → Dividable k j → Dividable k (i - j)
div-div1 {i} {j} di dj = record { factor = fki - fkj ; is-factor = ( begin
(fki - fkj) * k + 0 ≡⟨ +-comm _ 0 ⟩
(fki - fkj) * k ≡⟨ distr-minus-* {fki} {fkj} ⟩
(fki * k) - (fkj * k) ≡⟨ cong₂ ( λ i j → i - j ) (+-comm 0 (fki * k)) (+-comm 0 (fkj * k)) ⟩
(fki * k + 0) - (fkj * k + 0) ≡⟨ cong₂ ( λ i j → i - j ) (Dividable.is-factor di) (Dividable.is-factor dj) ⟩
i - j ∎ ) } where
open ≡-Reasoning
fki = Dividable.factor di
fkj = Dividable.factor dj
open _∧_
div+1 : { i k : ℕ } → k > 1 → Dividable k i → ¬ Dividable k (suc i)
div+1 {i} {k} k>1 d d1 = div1 k>1 div+11 where
div+11 : Dividable k 1
div+11 = subst (λ g → Dividable k g) (minus+y-y {1} {i} ) ( proj2 (div-div k>1 d d1 ) )
div<k : { m k : ℕ } → k > 1 → m > 0 → m < k → ¬ Dividable k m
div<k {m} {k} k>1 m>0 m<k d = ⊥-elim ( nat-≤> (div<k1 (Dividable.factor d) (Dividable.is-factor d)) m<k ) where
div<k1 : (f : ℕ ) → f * k + 0 ≡ m → k ≤ m
div<k1 zero eq = ⊥-elim (nat-≡< eq m>0 )
div<k1 (suc f) eq = begin
k ≤⟨ x≤x+y ⟩
k + (f * k + 0) ≡⟨ sym (+-assoc k _ _) ⟩
k + f * k + 0 ≡⟨ eq ⟩
m ∎ where open ≤-Reasoning
div→k≤m : { m k : ℕ } → k > 1 → m > 0 → Dividable k m → m ≥ k
div→k≤m {m} {k} k>1 m>0 d with <-cmp m k
... | tri< a ¬b ¬c = ⊥-elim ( div<k k>1 m>0 a d )
... | tri≈ ¬a refl ¬c = ≤-refl
... | tri> ¬a ¬b c = <to≤ c
div1*k+0=k : {k : ℕ } → 1 * k + 0 ≡ k
div1*k+0=k {k} = begin
1 * k + 0 ≡⟨ cong (λ g → g + 0) (+-comm _ 0) ⟩
k + 0 ≡⟨ +-comm _ 0 ⟩
k ∎ where open ≡-Reasoning
decD : {k m : ℕ} → k > 1 → Dec (Dividable k m )
decD {k} {m} k>1 = n-induction {_} {_} {ℕ} {λ m → Dec (Dividable k m ) } F I m where
F : ℕ → ℕ
F m = m
F0 : ( m : ℕ ) → F (m - k) ≡ 0 → Dec (Dividable k m )
F0 0 eq = yes record { factor = 0 ; is-factor = refl }
F0 (suc m) eq with <-cmp k (suc m)
... | tri< a ¬b ¬c = yes record { factor = 1 ; is-factor =
subst (λ g → 1 * k + 0 ≡ g ) (sym (i-j=0→i=j (<to≤ a) eq )) div1*k+0=k } -- (suc m - k) ≡ 0 → k ≡ suc m, k ≤ suc m
... | tri≈ ¬a refl ¬c = yes record { factor = 1 ; is-factor = div1*k+0=k }
... | tri> ¬a ¬b c = no ( λ d → ⊥-elim (div<k k>1 (s≤s z≤n ) c d) )
decl : {m : ℕ } → 0 < m → m - k < m
decl {m} 0<m = y-x<y (<-trans a<sa k>1 ) 0<m
ind : (p : ℕ ) → Dec (Dividable k (p - k) ) → Dec (Dividable k p )
ind p (yes y) with <-cmp p k
... | tri≈ ¬a refl ¬c = yes (subst (λ g → Dividable k g) (minus+n ≤-refl ) (proj1 ( div+div y div= )))
... | tri> ¬a ¬b k<p = yes (subst (λ g → Dividable k g) (minus+n (<-trans k<p a<sa)) (proj1 ( div+div y div= )))
... | tri< a ¬b ¬c with <-cmp p 0
... | tri≈ ¬a refl ¬c₁ = yes div0
... | tri> ¬a ¬b₁ c = no (λ d → not-div p (Dividable.factor d) a c (Dividable.is-factor d) ) where
not-div : (p f : ℕ) → p < k → 0 < p → f * k + 0 ≡ p → ⊥
not-div (suc p) (suc f) p<k 0<p eq = nat-≡< (sym eq) ( begin -- ≤-trans p<k {!!}) -- suc p ≤ k
suc (suc p) ≤⟨ p<k ⟩
k ≤⟨ x≤x+y ⟩
k + (f * k + 0) ≡⟨ sym (+-assoc k _ _) ⟩
suc f * k + 0 ∎ ) where open ≤-Reasoning
ind p (no n) = no (λ d → n (proj1 (div-div k>1 d div=)) )
I : Ninduction ℕ _ F
I = record {
pnext = λ p → p - k
; fzero = λ {m} eq → F0 m eq
; decline = λ {m} lt → decl lt
; ind = λ {p} prev → ind p prev
}
| {
"alphanum_fraction": 0.4311285574,
"avg_line_length": 40.1813880126,
"ext": "agda",
"hexsha": "142961caf70f89cb826bae928cb0a944f54a7222",
"lang": "Agda",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "eba0538f088f3d0c0fedb19c47c081954fbc69cb",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "shinji-kono/automaton-in-agda",
"max_forks_repo_path": "src/nat.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "eba0538f088f3d0c0fedb19c47c081954fbc69cb",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "shinji-kono/automaton-in-agda",
"max_issues_repo_path": "src/nat.agda",
"max_line_length": 136,
"max_stars_count": null,
"max_stars_repo_head_hexsha": "eba0538f088f3d0c0fedb19c47c081954fbc69cb",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "shinji-kono/automaton-in-agda",
"max_stars_repo_path": "src/nat.agda",
"max_stars_repo_stars_event_max_datetime": null,
"max_stars_repo_stars_event_min_datetime": null,
"num_tokens": 12062,
"size": 25475
} |
{-# OPTIONS --cubical --safe #-}
module Cubical.Data.Fin.Properties where
open import Cubical.Core.Everything
open import Cubical.Foundations.Embedding
open import Cubical.Foundations.Function
open import Cubical.Foundations.HLevels
open import Cubical.Foundations.Isomorphism
open import Cubical.Foundations.Prelude
open import Cubical.Foundations.Univalence
open import Cubical.Data.Fin.Base
open import Cubical.Data.Nat
open import Cubical.Data.Nat.Order
open import Cubical.Data.Empty
open import Cubical.Data.Sum
open import Cubical.Data.Sigma
open import Cubical.Induction.WellFounded
private
-- Σ is more convenient than the inductive ×, but I don't
-- want to have to write λ_→ all over.
_×_ : Type₀ → Type₀ → Type₀
A × B = Σ A λ _ → B
-- Fin 0 is empty, and thus a proposition.
Fin0-isProp : isProp (Fin 0)
Fin0-isProp = ⊥-elim ∘ ¬Fin0
-- Fin 1 has only one value.
Fin1-isContr : isContr (Fin 1)
Fin1-isContr
= fzero , λ
{ (zero , _) → toℕ-injective refl
; (suc k , sk<1) → ⊥-elim (¬-<-zero (pred-≤-pred sk<1))
}
-- Regardless of k, Fin k is a set.
isSetFin : ∀{k} → isSet (Fin k)
isSetFin {k} = isOfHLevelΣ 2 isSetℕ (λ _ → isProp→isSet m≤n-isProp)
-- Helper function for the reduction procedure below.
--
-- If n = expand o k m, then n is congruent to m modulo k.
expand : ℕ → ℕ → ℕ → ℕ
expand 0 k m = m
expand (suc o) k m = k + expand o k m
expand≡ : ∀ k m o → expand o k m ≡ o * k + m
expand≡ k m zero = refl
expand≡ k m (suc o)
= cong (k +_) (expand≡ k m o) ∙ +-assoc k (o * k) m
-- Expand a pair. This is useful because the whole function is
-- injective.
expand× : ∀{k} → (Fin k × ℕ) → ℕ
expand× {k} (f , o) = expand o k (toℕ f)
private
lemma₀ : ∀{k m n r} → r ≡ n → k + m ≡ n → k ≤ r
lemma₀ {k = k} {m} p q = m , +-comm m k ∙ q ∙ sym p
expand×Inj : ∀ k → {t1 t2 : Fin (suc k) × ℕ} → expand× t1 ≡ expand× t2 → t1 ≡ t2
expand×Inj k {f1 , zero} {f2 , zero} p i
= toℕ-injective {fj = f1} {f2} p i , zero
expand×Inj k {f1 , suc o1} {(r , r<sk) , zero} p
= ⊥-elim (<-asym r<sk (lemma₀ refl p))
expand×Inj k {(r , r<sk) , zero} {f2 , suc o2} p
= ⊥-elim (<-asym r<sk (lemma₀ refl (sym p)))
expand×Inj k {f1 , suc o1} {f2 , suc o2}
= cong (λ { (f , o) → (f , suc o) })
∘ expand×Inj k {f1 , o1} {f2 , o2}
∘ inj-m+ {suc k}
expand×Emb : ∀ k → isEmbedding (expand× {k})
expand×Emb 0 = ⊥-elim ∘ ¬Fin0 ∘ fst
expand×Emb (suc k)
= injEmbedding (isOfHLevelΣ 2 isSetFin (λ _ → isSetℕ)) isSetℕ (expand×Inj k)
-- A Residue is a family of types representing evidence that a
-- natural is congruent to a value of a finite type.
Residue : ℕ → ℕ → Type₀
Residue k n = Σ[ tup ∈ Fin k × ℕ ] expand× tup ≡ n
extract : ∀{k n} → Residue k n → Fin k
extract = fst ∘ fst
-- There is at most one canonical finite value congruent to each
-- natural.
isPropResidue : ∀ k n → isProp (Residue k n)
isPropResidue k = isEmbedding→hasPropFibers (expand×Emb k)
-- A value of a finite type is its own residue.
Fin→Residue : ∀{k} → (f : Fin k) → Residue k (toℕ f)
Fin→Residue f = (f , 0) , refl
-- Fibers of numbers that differ by k are equivalent in a more obvious
-- way than via the fact that they are propositions.
Residue+k : (k n : ℕ) → Residue k n → Residue k (k + n)
Residue+k k n ((f , o) , p) = (f , suc o) , cong (k +_) p
Residue-k : (k n : ℕ) → Residue k (k + n) → Residue k n
Residue-k k n (((r , r<k) , zero) , p) = ⊥-elim (<-asym r<k (lemma₀ p refl))
Residue-k k n ((f , suc o) , p) = ((f , o) , inj-m+ p)
Residue+k-k
: (k n : ℕ)
→ (R : Residue k (k + n))
→ Residue+k k n (Residue-k k n R) ≡ R
Residue+k-k k n (((r , r<k) , zero) , p) = ⊥-elim (<-asym r<k (lemma₀ p refl))
Residue+k-k k n ((f , suc o) , p)
= ΣProp≡ (λ tup → isSetℕ (expand× tup) (k + n)) refl
Residue-k+k
: (k n : ℕ)
→ (R : Residue k n)
→ Residue-k k n (Residue+k k n R) ≡ R
Residue-k+k k n ((f , o) , p)
= ΣProp≡ (λ tup → isSetℕ (expand× tup) n) refl
private
Residue≃ : ∀ k n → Residue k n ≃ Residue k (k + n)
Residue≃ k n
= Residue+k k n
, isoToIsEquiv (iso (Residue+k k n) (Residue-k k n)
(Residue+k-k k n) (Residue-k+k k n))
Residue≡ : ∀ k n → Residue k n ≡ Residue k (k + n)
Residue≡ k n = ua (Residue≃ k n)
-- For positive `k`, all `n` have a canonical residue mod `k`.
module Reduce (k₀ : ℕ) where
k : ℕ
k = suc k₀
base : ∀ n (n<k : n < k) → Residue k n
base n n<k = Fin→Residue (n , n<k)
step : ∀ n → Residue k n → Residue k (k + n)
step n = transport (Residue≡ k n)
reduce : ∀ n → Residue k n
reduce = +induction k₀ (Residue k) base step
reduce≡
: ∀ n → transport (Residue≡ k n) (reduce n) ≡ reduce (k + n)
reduce≡ n
= sym (+inductionStep k₀ _ base step n)
reduceP
: ∀ n → PathP (λ i → Residue≡ k n i) (reduce n) (reduce (k + n))
reduceP n = toPathP (reduce≡ n)
open Reduce using (reduce; reduce≡) public
private
lemma₅
: ∀ k n (R : Residue k n)
→ extract R ≡ extract (transport (Residue≡ k n) R)
lemma₅ k n = sym ∘ cong extract ∘ uaβ (Residue≃ k n)
-- The residue of n modulo k is the same as the residue of k + n.
extract≡ : ∀ k n → extract (reduce k n) ≡ extract (reduce k (suc k + n))
extract≡ k n
= lemma₅ (suc k) n (reduce k n) ∙ cong extract (Reduce.reduce≡ k n)
isContrResidue : ∀{k n} → isContr (Residue (suc k) n)
isContrResidue {k} {n} = inhProp→isContr (reduce k n) (isPropResidue (suc k) n)
| {
"alphanum_fraction": 0.6066641847,
"avg_line_length": 31.2325581395,
"ext": "agda",
"hexsha": "c77e5e426e10f58be576b49f1efacd9ab04a393e",
"lang": "Agda",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "df4ef7edffd1c1deb3d4ff342c7178e9901c44f1",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "limemloh/cubical",
"max_forks_repo_path": "Cubical/Data/Fin/Properties.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "df4ef7edffd1c1deb3d4ff342c7178e9901c44f1",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "limemloh/cubical",
"max_issues_repo_path": "Cubical/Data/Fin/Properties.agda",
"max_line_length": 82,
"max_stars_count": null,
"max_stars_repo_head_hexsha": "df4ef7edffd1c1deb3d4ff342c7178e9901c44f1",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "limemloh/cubical",
"max_stars_repo_path": "Cubical/Data/Fin/Properties.agda",
"max_stars_repo_stars_event_max_datetime": null,
"max_stars_repo_stars_event_min_datetime": null,
"num_tokens": 2087,
"size": 5372
} |
-- Displayed SIP
{-# OPTIONS --cubical --no-import-sorts --safe #-}
module Cubical.DStructures.Base where
open import Cubical.Foundations.Prelude
open import Cubical.Foundations.Equiv
open import Cubical.Foundations.Equiv.Properties
open import Cubical.Foundations.Function
open import Cubical.Foundations.HLevels
open import Cubical.Foundations.Isomorphism
open import Cubical.Foundations.Univalence
open import Cubical.Foundations.Path
open import Cubical.Foundations.SIP
open import Cubical.Data.Sigma
open import Cubical.Relation.Binary
private
variable
ℓ ℓ' ℓ'' ℓ₁ ℓ₁' ℓ₁'' ℓ₂ ℓA ℓ≅A ℓB ℓ≅B ℓC ℓ≅C ℓ≅ᴰ : Level
-- a univalent reflexive graph structure on a type
record URGStr (A : Type ℓA) (ℓ≅A : Level) : Type (ℓ-max ℓA (ℓ-suc ℓ≅A)) where
no-eta-equality
constructor urgstr
field
_≅_ : Rel A A ℓ≅A
ρ : isRefl _≅_
uni : isUnivalent _≅_ ρ
-- another constructor for URGStr that uses that if the
-- relational singleton is contractible, the relation is univalent
make-𝒮 : {A : Type ℓA} {_≅_ : Rel A A ℓ≅A}
(ρ : isRefl _≅_) (contrTotal : contrRelSingl _≅_)
→ URGStr A ℓ≅A
make-𝒮 {_≅_ = _≅_} _ _ .URGStr._≅_ = _≅_
make-𝒮 ρ _ .URGStr.ρ = ρ
make-𝒮 {_≅_ = _≅_} ρ contrTotal .URGStr.uni = contrRelSingl→isUnivalent _≅_ ρ contrTotal
module _ where
open URGStr
η-URGStr : {A : Type ℓA} {ℓ≅A : Level}
(𝒮-A : URGStr A ℓ≅A) → urgstr (_≅_ 𝒮-A) (ρ 𝒮-A) (uni 𝒮-A) ≡ 𝒮-A
_≅_ (η-URGStr 𝒮-A i) = _≅_ 𝒮-A
ρ (η-URGStr 𝒮-A i) = ρ 𝒮-A
uni (η-URGStr 𝒮-A i) = uni 𝒮-A
-- a displayed univalent reflexive graph structure over a URGStr on a type
record URGStrᴰ {A : Type ℓA} (𝒮-A : URGStr A ℓ≅A)
(B : A → Type ℓB) (ℓ≅ᴰ : Level) : Type (ℓ-max (ℓ-max (ℓ-max ℓA ℓB) ℓ≅A) (ℓ-suc ℓ≅ᴰ)) where
no-eta-equality
constructor urgstrᴰ
open URGStr 𝒮-A
field
_≅ᴰ⟨_⟩_ : {a a' : A} → B a → a ≅ a' → B a' → Type ℓ≅ᴰ
ρᴰ : {a : A} → isRefl _≅ᴰ⟨ ρ a ⟩_
uniᴰ : {a : A} → isUnivalent _≅ᴰ⟨ ρ a ⟩_ ρᴰ
open URGStrᴰ
-- another constructor for URGStrᴰ, using contractability of relational singletons
-- rather than univalence
make-𝒮ᴰ : {A : Type ℓA} {𝒮-A : URGStr A ℓ≅A}
{B : A → Type ℓB}
(_≅ᴰ⟨_⟩_ : {a a' : A} → B a → URGStr._≅_ 𝒮-A a a' → B a' → Type ℓ≅ᴰ)
(ρᴰ : {a : A} → isRefl _≅ᴰ⟨ URGStr.ρ 𝒮-A a ⟩_)
(contrTotal : (a : A) → contrRelSingl _≅ᴰ⟨ URGStr.ρ 𝒮-A a ⟩_)
→ URGStrᴰ 𝒮-A B ℓ≅ᴰ
make-𝒮ᴰ {A = A} {𝒮-A = 𝒮-A} _≅ᴰ⟨_⟩_ ρᴰ contrTotal ._≅ᴰ⟨_⟩_ = _≅ᴰ⟨_⟩_
make-𝒮ᴰ {A = A} {𝒮-A = 𝒮-A} _≅ᴰ⟨_⟩_ ρᴰ contrTotal .ρᴰ = ρᴰ
make-𝒮ᴰ {A = A} {𝒮-A = 𝒮-A} _≅ᴰ⟨_⟩_ ρᴰ contrTotal .uniᴰ {a} b b' = contrRelSingl→isUnivalent (_≅ᴰ⟨ URGStr.ρ 𝒮-A a ⟩_) (ρᴰ {a}) (contrTotal a) b b'
-- abbreviation to obtain contractibility of total space
𝒮→cTS : {A : Type ℓA} (StrA : URGStr A ℓ≅A) → contrRelSingl (URGStr._≅_ StrA)
𝒮→cTS StrA = isUnivalent→contrRelSingl _≅_ ρ uni
where open URGStr StrA
| {
"alphanum_fraction": 0.6357960458,
"avg_line_length": 36.0375,
"ext": "agda",
"hexsha": "4ce63f09fd7e4bc25603c4ea15179dc45543fa08",
"lang": "Agda",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "c345dc0c49d3950dc57f53ca5f7099bb53a4dc3a",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "Schippmunk/cubical",
"max_forks_repo_path": "Cubical/DStructures/Base.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "c345dc0c49d3950dc57f53ca5f7099bb53a4dc3a",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "Schippmunk/cubical",
"max_issues_repo_path": "Cubical/DStructures/Base.agda",
"max_line_length": 146,
"max_stars_count": null,
"max_stars_repo_head_hexsha": "c345dc0c49d3950dc57f53ca5f7099bb53a4dc3a",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "Schippmunk/cubical",
"max_stars_repo_path": "Cubical/DStructures/Base.agda",
"max_stars_repo_stars_event_max_datetime": null,
"max_stars_repo_stars_event_min_datetime": null,
"num_tokens": 1419,
"size": 2883
} |
------------------------------------------------------------------------
-- Convenient syntax for "equational reasoning" using a strict partial
-- order
------------------------------------------------------------------------
open import Relation.Binary
module Relation.Binary.StrictPartialOrderReasoning
(p : StrictPartialOrder) where
import Relation.Binary.PreorderReasoning as PreR
import Relation.Binary.Props.StrictPartialOrder as SPO
open PreR (SPO.preorder p) public renaming (_∼⟨_⟩_ to _<⟨_⟩_)
| {
"alphanum_fraction": 0.5642023346,
"avg_line_length": 36.7142857143,
"ext": "agda",
"hexsha": "3a3d23210bc832f2aec7f5b24b1f7d6aea57bffe",
"lang": "Agda",
"max_forks_count": 3,
"max_forks_repo_forks_event_max_datetime": "2022-03-12T11:54:10.000Z",
"max_forks_repo_forks_event_min_datetime": "2015-07-21T16:37:58.000Z",
"max_forks_repo_head_hexsha": "8ef786b40e4a9ab274c6103dc697dcb658cf3db3",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "isabella232/Lemmachine",
"max_forks_repo_path": "vendor/stdlib/src/Relation/Binary/StrictPartialOrderReasoning.agda",
"max_issues_count": 1,
"max_issues_repo_head_hexsha": "8ef786b40e4a9ab274c6103dc697dcb658cf3db3",
"max_issues_repo_issues_event_max_datetime": "2022-03-12T12:17:51.000Z",
"max_issues_repo_issues_event_min_datetime": "2022-03-12T12:17:51.000Z",
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "larrytheliquid/Lemmachine",
"max_issues_repo_path": "vendor/stdlib/src/Relation/Binary/StrictPartialOrderReasoning.agda",
"max_line_length": 72,
"max_stars_count": 56,
"max_stars_repo_head_hexsha": "8ef786b40e4a9ab274c6103dc697dcb658cf3db3",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "isabella232/Lemmachine",
"max_stars_repo_path": "vendor/stdlib/src/Relation/Binary/StrictPartialOrderReasoning.agda",
"max_stars_repo_stars_event_max_datetime": "2021-12-21T17:02:19.000Z",
"max_stars_repo_stars_event_min_datetime": "2015-01-20T02:11:42.000Z",
"num_tokens": 96,
"size": 514
} |
-- Andreas, 2013-05-16, raised by Andrea 2015-02-10
open import Common.Size
open import Common.Prelude
data Wrap (A : SizeUniv) : SizeUniv where
-- data Wrap (A : Set) : Set where
wrap : A → Wrap A
module M (f : ∀ i → Wrap (Size< i)) where
test : ∀ i → Wrap (Size< i) → ⊥
test i (wrap j) = test j (f j)
module N (pred : ∀ i → Size< i) where
f = (λ i → wrap (pred i))
open M f
loop : Size → ⊥
loop i = test i (f i)
-- = test i (wrap (pred i))
-- = test (pred i) ((λ i → wrap (pred i)) (pred i))
-- = test (pred i) (wrap (pred (pred i)))
-- = test (pred (pred i)) (wrap (pred (pred (pred i))))
-- = ...
| {
"alphanum_fraction": 0.5458860759,
"avg_line_length": 23.4074074074,
"ext": "agda",
"hexsha": "37844b6ea466a7ede5fda2a73512083f2456c41a",
"lang": "Agda",
"max_forks_count": 1,
"max_forks_repo_forks_event_max_datetime": "2019-03-05T20:02:38.000Z",
"max_forks_repo_forks_event_min_datetime": "2019-03-05T20:02:38.000Z",
"max_forks_repo_head_hexsha": "231d6ad8e77b67ff8c4b1cb35a6c31ccd988c3e9",
"max_forks_repo_licenses": [
"BSD-3-Clause"
],
"max_forks_repo_name": "Agda-zh/agda",
"max_forks_repo_path": "test/Fail/Issue1428.agda",
"max_issues_count": 3,
"max_issues_repo_head_hexsha": "aac88412199dd4cbcb041aab499d8a6b7e3f4a2e",
"max_issues_repo_issues_event_max_datetime": "2019-04-01T19:39:26.000Z",
"max_issues_repo_issues_event_min_datetime": "2018-11-14T15:31:44.000Z",
"max_issues_repo_licenses": [
"BSD-3-Clause"
],
"max_issues_repo_name": "hborum/agda",
"max_issues_repo_path": "test/Fail/Issue1428.agda",
"max_line_length": 57,
"max_stars_count": 3,
"max_stars_repo_head_hexsha": "aac88412199dd4cbcb041aab499d8a6b7e3f4a2e",
"max_stars_repo_licenses": [
"BSD-3-Clause"
],
"max_stars_repo_name": "hborum/agda",
"max_stars_repo_path": "test/Fail/Issue1428.agda",
"max_stars_repo_stars_event_max_datetime": "2015-12-07T20:14:00.000Z",
"max_stars_repo_stars_event_min_datetime": "2015-03-28T14:51:03.000Z",
"num_tokens": 235,
"size": 632
} |
{-# OPTIONS --without-K #-}
module NTypes.Universe where
open import Equivalence
open import NTypes
open import PathOperations
open import PathStructure.Coproduct
open import Types
open import Univalence
Bool : Set
Bool = ⊤ ⊎ ⊤
not : Bool → Bool
not = case (λ _ → Bool) (λ _ → inr _) (λ _ → inl _)
not-not : ∀ x → not (not x) ≡ x
not-not = case
(λ x → not (not x) ≡ x)
(λ _ → refl) (λ _ → refl)
Bool-eq₁ : Bool ≃ Bool
Bool-eq₁ = ≡→eq refl
Bool-eq₂ : Bool ≃ Bool
Bool-eq₂
= not
, (not , not-not)
, (not , not-not)
nope : Bool-eq₁ ≡ Bool-eq₂ → ⊥
nope x = lower (split-path (happly (ap π₁ x) (inl _)))
-- With Lift, we could prove stronger statement
-- (∀ ℓ → isSet (Set ℓ) → ⊥), but the idea is same - pick
-- something equivalent to Bool in Set ℓ, find two different
-- ways in which this type is equivalent and derive
-- a contradiction.
¬U-set : (∀ ℓ → isSet (Set ℓ)) → ⊥
¬U-set U-set = nope
( from-to-eq _ ⁻¹
· ap from-≡
(U-set _ Bool Bool (to-≡ Bool-eq₁) (to-≡ Bool-eq₂))
· from-to-eq _
)
where
from-≡ = π₁ (ua {A = Bool} {B = Bool})
to-≡ = π₁ (π₁ (π₂ (ua {A = Bool} {B = Bool})))
from-to-eq = π₂ (π₁ (π₂ (ua {A = Bool} {B = Bool})))
| {
"alphanum_fraction": 0.590108969,
"avg_line_length": 23.86,
"ext": "agda",
"hexsha": "f7a8bc7defc64dcc735b6d04051cf5b23069f5f5",
"lang": "Agda",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "7730385adfdbdda38ee8b124be3cdeebb7312c65",
"max_forks_repo_licenses": [
"BSD-3-Clause"
],
"max_forks_repo_name": "vituscze/HoTT-lectures",
"max_forks_repo_path": "src/NTypes/Universe.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "7730385adfdbdda38ee8b124be3cdeebb7312c65",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"BSD-3-Clause"
],
"max_issues_repo_name": "vituscze/HoTT-lectures",
"max_issues_repo_path": "src/NTypes/Universe.agda",
"max_line_length": 60,
"max_stars_count": null,
"max_stars_repo_head_hexsha": "7730385adfdbdda38ee8b124be3cdeebb7312c65",
"max_stars_repo_licenses": [
"BSD-3-Clause"
],
"max_stars_repo_name": "vituscze/HoTT-lectures",
"max_stars_repo_path": "src/NTypes/Universe.agda",
"max_stars_repo_stars_event_max_datetime": null,
"max_stars_repo_stars_event_min_datetime": null,
"num_tokens": 458,
"size": 1193
} |
-- Basic intuitionistic propositional calculus, without ∨ or ⊥.
-- Translation between different formalisations of syntax.
module BasicIPC.Syntax.Translation where
open import BasicIPC.Syntax.Common public
import BasicIPC.Syntax.ClosedHilbertSequential as CHS
import BasicIPC.Syntax.ClosedHilbert as CH
import BasicIPC.Syntax.HilbertSequential as HS
import BasicIPC.Syntax.Hilbert as H
import BasicIPC.Syntax.Gentzen as G
open HS using () renaming (_⊦⊢_ to HS⟨_⊦⊢_⟩ ; _⊢_ to HS⟨_⊢_⟩) public
open H using () renaming (_⊢_ to H⟨_⊢_⟩) public
open G using () renaming (_⊢_ to G⟨_⊢_⟩) public
-- Available translations.
--
-- ┌─────┬─────┬─────┬─────┬─────┐
-- │ CHS │ CH │ HS │ H │ G │
-- ┌─────┼─────┼─────┼─────┼─────┼─────┤
-- │ CHS │ │ d │ d │ ∘ │ ∘ │
-- ├─────┼─────┼─────┼─────┼─────┼─────┤
-- │ CH │ d │ │ ∘ │ d │ ∘ │
-- ├─────┼─────┼─────┼─────┼─────┼─────┤
-- │ HS │ d │ ∘ │ │ d │ ∘ │
-- ├─────┼─────┼─────┼─────┼─────┼─────┤
-- │ H │ ∘ │ d │ d │ │ d │
-- ├─────┼─────┼─────┼─────┼─────┼─────┤
-- │ G │ ∘ │ ∘ │ ∘ │ d │ │
-- └─────┴─────┴─────┴─────┴─────┴─────┘
--
-- d : Direct translation.
-- ∘ : Composition of translations.
-- Translation from closed Hilbert-style sequential to closed Hilbert-style.
chs→ch : ∀ {A} → CHS.⊢ A → CH.⊢ A
chs→ch (Ξ , ts) = chs⊦→ch ts top
where
chs⊦→ch : ∀ {A Ξ} → CHS.⊦⊢ Ξ → A ∈ Ξ → CH.⊢ A
chs⊦→ch (CHS.mp i j ts) top = CH.app (chs⊦→ch ts i) (chs⊦→ch ts j)
chs⊦→ch (CHS.ci ts) top = CH.ci
chs⊦→ch (CHS.ck ts) top = CH.ck
chs⊦→ch (CHS.cs ts) top = CH.cs
chs⊦→ch (CHS.cpair ts) top = CH.cpair
chs⊦→ch (CHS.cfst ts) top = CH.cfst
chs⊦→ch (CHS.csnd ts) top = CH.csnd
chs⊦→ch (CHS.unit ts) top = CH.unit
chs⊦→ch (CHS.mp i j ts) (pop k) = chs⊦→ch ts k
chs⊦→ch (CHS.ci ts) (pop k) = chs⊦→ch ts k
chs⊦→ch (CHS.ck ts) (pop k) = chs⊦→ch ts k
chs⊦→ch (CHS.cs ts) (pop k) = chs⊦→ch ts k
chs⊦→ch (CHS.cpair ts) (pop k) = chs⊦→ch ts k
chs⊦→ch (CHS.cfst ts) (pop k) = chs⊦→ch ts k
chs⊦→ch (CHS.csnd ts) (pop k) = chs⊦→ch ts k
chs⊦→ch (CHS.unit ts) (pop k) = chs⊦→ch ts k
-- Translation from closed Hilbert-style to closed Hilbert-style sequential.
ch→chs : ∀ {A} → CH.⊢ A → CHS.⊢ A
ch→chs (CH.app t u) = CHS.app (ch→chs t) (ch→chs u)
ch→chs CH.ci = ∅ , CHS.ci CHS.nil
ch→chs CH.ck = ∅ , CHS.ck CHS.nil
ch→chs CH.cs = ∅ , CHS.cs CHS.nil
ch→chs CH.cpair = ∅ , CHS.cpair CHS.nil
ch→chs CH.cfst = ∅ , CHS.cfst CHS.nil
ch→chs CH.csnd = ∅ , CHS.csnd CHS.nil
ch→chs CH.unit = ∅ , CHS.unit CHS.nil
-- Translation from Hilbert-style sequential to Hilbert-style.
hs→h : ∀ {A Γ} → HS⟨ Γ ⊢ A ⟩ → H⟨ Γ ⊢ A ⟩
hs→h (Ξ , ts) = hs⊦→h ts top
where
hs⊦→h : ∀ {A Ξ Γ} → HS⟨ Γ ⊦⊢ Ξ ⟩ → A ∈ Ξ → H⟨ Γ ⊢ A ⟩
hs⊦→h (HS.var i ts) top = H.var i
hs⊦→h (HS.mp i j ts) top = H.app (hs⊦→h ts i) (hs⊦→h ts j)
hs⊦→h (HS.ci ts) top = H.ci
hs⊦→h (HS.ck ts) top = H.ck
hs⊦→h (HS.cs ts) top = H.cs
hs⊦→h (HS.cpair ts) top = H.cpair
hs⊦→h (HS.cfst ts) top = H.cfst
hs⊦→h (HS.csnd ts) top = H.csnd
hs⊦→h (HS.unit ts) top = H.unit
hs⊦→h (HS.var i ts) (pop k) = hs⊦→h ts k
hs⊦→h (HS.mp i j ts) (pop k) = hs⊦→h ts k
hs⊦→h (HS.ci ts) (pop k) = hs⊦→h ts k
hs⊦→h (HS.ck ts) (pop k) = hs⊦→h ts k
hs⊦→h (HS.cs ts) (pop k) = hs⊦→h ts k
hs⊦→h (HS.cpair ts) (pop k) = hs⊦→h ts k
hs⊦→h (HS.cfst ts) (pop k) = hs⊦→h ts k
hs⊦→h (HS.csnd ts) (pop k) = hs⊦→h ts k
hs⊦→h (HS.unit ts) (pop k) = hs⊦→h ts k
-- Translation from Hilbert-style to Hilbert-style sequential.
h→hs : ∀ {A Γ} → H⟨ Γ ⊢ A ⟩ → HS⟨ Γ ⊢ A ⟩
h→hs (H.var i) = ∅ , HS.var i HS.nil
h→hs (H.app t u) = HS.app (h→hs t) (h→hs u)
h→hs H.ci = ∅ , HS.ci HS.nil
h→hs H.ck = ∅ , HS.ck HS.nil
h→hs H.cs = ∅ , HS.cs HS.nil
h→hs H.cpair = ∅ , HS.cpair HS.nil
h→hs H.cfst = ∅ , HS.cfst HS.nil
h→hs H.csnd = ∅ , HS.csnd HS.nil
h→hs H.unit = ∅ , HS.unit HS.nil
-- Deduction and detachment theorems for Hilbert-style sequential.
hs-lam : ∀ {A B Γ} → HS⟨ Γ , A ⊢ B ⟩ → HS⟨ Γ ⊢ A ▻ B ⟩
hs-lam = h→hs ∘ H.lam ∘ hs→h
hs-lam⋆₀ : ∀ {A Γ} → HS⟨ Γ ⊢ A ⟩ → HS⟨ ∅ ⊢ Γ ▻⋯▻ A ⟩
hs-lam⋆₀ = h→hs ∘ H.lam⋆₀ ∘ hs→h
hs-det : ∀ {A B Γ} → HS⟨ Γ ⊢ A ▻ B ⟩ → HS⟨ Γ , A ⊢ B ⟩
hs-det = h→hs ∘ H.det ∘ hs→h
hs-det⋆₀ : ∀ {A Γ} → HS⟨ ∅ ⊢ Γ ▻⋯▻ A ⟩ → HS⟨ Γ ⊢ A ⟩
hs-det⋆₀ = h→hs ∘ H.det⋆₀ ∘ hs→h
-- Translation from closed Hilbert-style sequential to Hilbert-style sequential.
chs→hs₀ : ∀ {A} → CHS.⊢ A → HS⟨ ∅ ⊢ A ⟩
chs→hs₀ (Ξ , ts) = Ξ , chs⊦→hs₀⊦ ts
where
chs⊦→hs₀⊦ : ∀ {Ξ} → CHS.⊦⊢ Ξ → HS⟨ ∅ ⊦⊢ Ξ ⟩
chs⊦→hs₀⊦ CHS.nil = HS.nil
chs⊦→hs₀⊦ (CHS.mp i j ts) = HS.mp i j (chs⊦→hs₀⊦ ts)
chs⊦→hs₀⊦ (CHS.ci ts) = HS.ci (chs⊦→hs₀⊦ ts)
chs⊦→hs₀⊦ (CHS.ck ts) = HS.ck (chs⊦→hs₀⊦ ts)
chs⊦→hs₀⊦ (CHS.cs ts) = HS.cs (chs⊦→hs₀⊦ ts)
chs⊦→hs₀⊦ (CHS.cpair ts) = HS.cpair (chs⊦→hs₀⊦ ts)
chs⊦→hs₀⊦ (CHS.cfst ts) = HS.cfst (chs⊦→hs₀⊦ ts)
chs⊦→hs₀⊦ (CHS.csnd ts) = HS.csnd (chs⊦→hs₀⊦ ts)
chs⊦→hs₀⊦ (CHS.unit ts) = HS.unit (chs⊦→hs₀⊦ ts)
chs→hs : ∀ {A Γ} → CHS.⊢ Γ ▻⋯▻ A → HS⟨ Γ ⊢ A ⟩
chs→hs t = hs-det⋆₀ (chs→hs₀ t)
-- Translation from Hilbert-style sequential to closed Hilbert-style sequential.
hs₀→chs : ∀ {A} → HS⟨ ∅ ⊢ A ⟩ → CHS.⊢ A
hs₀→chs (Ξ , ts) = Ξ , hs₀⊦→chs⊦ ts
where
hs₀⊦→chs⊦ : ∀ {Ξ} → HS⟨ ∅ ⊦⊢ Ξ ⟩ → CHS.⊦⊢ Ξ
hs₀⊦→chs⊦ HS.nil = CHS.nil
hs₀⊦→chs⊦ (HS.var () ts)
hs₀⊦→chs⊦ (HS.mp i j ts) = CHS.mp i j (hs₀⊦→chs⊦ ts)
hs₀⊦→chs⊦ (HS.ci ts) = CHS.ci (hs₀⊦→chs⊦ ts)
hs₀⊦→chs⊦ (HS.ck ts) = CHS.ck (hs₀⊦→chs⊦ ts)
hs₀⊦→chs⊦ (HS.cs ts) = CHS.cs (hs₀⊦→chs⊦ ts)
hs₀⊦→chs⊦ (HS.cpair ts) = CHS.cpair (hs₀⊦→chs⊦ ts)
hs₀⊦→chs⊦ (HS.cfst ts) = CHS.cfst (hs₀⊦→chs⊦ ts)
hs₀⊦→chs⊦ (HS.csnd ts) = CHS.csnd (hs₀⊦→chs⊦ ts)
hs₀⊦→chs⊦ (HS.unit ts) = CHS.unit (hs₀⊦→chs⊦ ts)
hs→chs : ∀ {A Γ} → HS⟨ Γ ⊢ A ⟩ → CHS.⊢ Γ ▻⋯▻ A
hs→chs t = hs₀→chs (hs-lam⋆₀ t)
-- Translation from closed Hilbert-style to Hilbert-style.
ch→h₀ : ∀ {A} → CH.⊢ A → H⟨ ∅ ⊢ A ⟩
ch→h₀ (CH.app t u) = H.app (ch→h₀ t) (ch→h₀ u)
ch→h₀ CH.ci = H.ci
ch→h₀ CH.ck = H.ck
ch→h₀ CH.cs = H.cs
ch→h₀ CH.cpair = H.cpair
ch→h₀ CH.cfst = H.cfst
ch→h₀ CH.csnd = H.csnd
ch→h₀ CH.unit = H.unit
ch→h : ∀ {A Γ} → CH.⊢ Γ ▻⋯▻ A → H⟨ Γ ⊢ A ⟩
ch→h t = H.det⋆₀ (ch→h₀ t)
-- Translation from Hilbert-style to closed Hilbert-style.
h₀→ch : ∀ {A} → H⟨ ∅ ⊢ A ⟩ → CH.⊢ A
h₀→ch (H.var ())
h₀→ch (H.app t u) = CH.app (h₀→ch t) (h₀→ch u)
h₀→ch H.ci = CH.ci
h₀→ch H.ck = CH.ck
h₀→ch H.cs = CH.cs
h₀→ch H.cpair = CH.cpair
h₀→ch H.cfst = CH.cfst
h₀→ch H.csnd = CH.csnd
h₀→ch H.unit = CH.unit
h→ch : ∀ {A Γ} → H⟨ Γ ⊢ A ⟩ → CH.⊢ Γ ▻⋯▻ A
h→ch t = h₀→ch (H.lam⋆₀ t)
-- Translation from Hilbert-style to Gentzen-style.
h→g : ∀ {A Γ} → H⟨ Γ ⊢ A ⟩ → G⟨ Γ ⊢ A ⟩
h→g (H.var i) = G.var i
h→g (H.app t u) = G.app (h→g t) (h→g u)
h→g H.ci = G.ci
h→g H.ck = G.ck
h→g H.cs = G.cs
h→g H.cpair = G.cpair
h→g H.cfst = G.cfst
h→g H.csnd = G.csnd
h→g H.unit = G.unit
-- Translation from Gentzen-style to Hilbert-style.
g→h : ∀ {A Γ} → G⟨ Γ ⊢ A ⟩ → H⟨ Γ ⊢ A ⟩
g→h (G.var i) = H.var i
g→h (G.lam t) = H.lam (g→h t)
g→h (G.app t u) = H.app (g→h t) (g→h u)
g→h (G.pair t u) = H.pair (g→h t) (g→h u)
g→h (G.fst t) = H.fst (g→h t)
g→h (G.snd t) = H.snd (g→h t)
g→h G.unit = H.unit
-- Additional translations from closed Hilbert-style sequential.
chs→h₀ : ∀ {A} → CHS.⊢ A → H⟨ ∅ ⊢ A ⟩
chs→h₀ = ch→h₀ ∘ chs→ch
chs→h : ∀ {A Γ} → CHS.⊢ Γ ▻⋯▻ A → H⟨ Γ ⊢ A ⟩
chs→h = ch→h ∘ chs→ch
chs→g₀ : ∀ {A} → CHS.⊢ A → G⟨ ∅ ⊢ A ⟩
chs→g₀ = h→g ∘ chs→h₀
chs→g : ∀ {A Γ} → CHS.⊢ Γ ▻⋯▻ A → G⟨ Γ ⊢ A ⟩
chs→g = h→g ∘ chs→h
-- Additional translations from closed Hilbert-style.
ch→hs₀ : ∀ {A} → CH.⊢ A → HS⟨ ∅ ⊢ A ⟩
ch→hs₀ = chs→hs₀ ∘ ch→chs
ch→hs : ∀ {A Γ} → CH.⊢ Γ ▻⋯▻ A → HS⟨ Γ ⊢ A ⟩
ch→hs = chs→hs ∘ ch→chs
ch→g₀ : ∀ {A} → CH.⊢ A → G⟨ ∅ ⊢ A ⟩
ch→g₀ = h→g ∘ ch→h₀
ch→g : ∀ {A Γ} → CH.⊢ Γ ▻⋯▻ A → G⟨ Γ ⊢ A ⟩
ch→g = h→g ∘ ch→h
-- Additional translations from Hilbert-style sequential.
hs₀→ch : ∀ {A} → HS⟨ ∅ ⊢ A ⟩ → CH.⊢ A
hs₀→ch = chs→ch ∘ hs₀→chs
hs→ch : ∀ {A Γ} → HS⟨ Γ ⊢ A ⟩ → CH.⊢ Γ ▻⋯▻ A
hs→ch = chs→ch ∘ hs→chs
hs→g : ∀ {A Γ} → HS⟨ Γ ⊢ A ⟩ → G⟨ Γ ⊢ A ⟩
hs→g = h→g ∘ hs→h
-- Additional translations from Hilbert-style.
h₀→chs : ∀ {A} → H⟨ ∅ ⊢ A ⟩ → CHS.⊢ A
h₀→chs = ch→chs ∘ h₀→ch
h→chs : ∀ {A Γ} → H⟨ Γ ⊢ A ⟩ → CHS.⊢ Γ ▻⋯▻ A
h→chs = ch→chs ∘ h→ch
-- Additional translations from Gentzen-style.
g₀→chs : ∀ {A} → G⟨ ∅ ⊢ A ⟩ → CHS.⊢ A
g₀→chs = h₀→chs ∘ g→h
g→chs : ∀ {A Γ} → G⟨ Γ ⊢ A ⟩ → CHS.⊢ Γ ▻⋯▻ A
g→chs = h→chs ∘ g→h
g₀→ch : ∀ {A} → G⟨ ∅ ⊢ A ⟩ → CH.⊢ A
g₀→ch = h₀→ch ∘ g→h
g→ch : ∀ {A Γ} → G⟨ Γ ⊢ A ⟩ → CH.⊢ Γ ▻⋯▻ A
g→ch = h→ch ∘ g→h
g→hs : ∀ {A Γ} → G⟨ Γ ⊢ A ⟩ → HS⟨ Γ ⊢ A ⟩
g→hs = h→hs ∘ g→h
| {
"alphanum_fraction": 0.481571397,
"avg_line_length": 30.4093959732,
"ext": "agda",
"hexsha": "b12d36ae82d8bc32a7d393f1df2a23af101dafc8",
"lang": "Agda",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "fcd187db70f0a39b894fe44fad0107f61849405c",
"max_forks_repo_licenses": [
"X11"
],
"max_forks_repo_name": "mietek/hilbert-gentzen",
"max_forks_repo_path": "BasicIPC/Syntax/Translation.agda",
"max_issues_count": 1,
"max_issues_repo_head_hexsha": "fcd187db70f0a39b894fe44fad0107f61849405c",
"max_issues_repo_issues_event_max_datetime": "2018-06-10T09:11:22.000Z",
"max_issues_repo_issues_event_min_datetime": "2018-06-10T09:11:22.000Z",
"max_issues_repo_licenses": [
"X11"
],
"max_issues_repo_name": "mietek/hilbert-gentzen",
"max_issues_repo_path": "BasicIPC/Syntax/Translation.agda",
"max_line_length": 80,
"max_stars_count": 29,
"max_stars_repo_head_hexsha": "fcd187db70f0a39b894fe44fad0107f61849405c",
"max_stars_repo_licenses": [
"X11"
],
"max_stars_repo_name": "mietek/hilbert-gentzen",
"max_stars_repo_path": "BasicIPC/Syntax/Translation.agda",
"max_stars_repo_stars_event_max_datetime": "2022-01-01T10:29:18.000Z",
"max_stars_repo_stars_event_min_datetime": "2016-07-03T18:51:56.000Z",
"num_tokens": 4866,
"size": 9062
} |
module Numeral.Natural.Relation.Order.Category where
open import Data.Tuple as Tuple using (_⨯_ ; _,_)
open import Functional
open import Logic
open import Logic.Propositional
open import Logic.IntroInstances
import Lvl
open import Numeral.Natural
open import Numeral.Natural.Relation.Order
open import Numeral.Natural.Relation.Order.Proofs
open import Relator.Equals
open import Relator.Equals.Proofs.Equiv
import Structure.Categorical.Names as Names
open import Structure.Categorical.Properties
open import Structure.Category
import Structure.Function.Names as Names
open import Structure.Operator
open import Structure.Relator.Properties
open import Type
instance
[≤]-identityₗ : Morphism.Identityₗ{Obj = ℕ}(\{x} → swap(transitivity(_≤_) {x})) (reflexivity(_≤_))
[≤]-identityₗ = Morphism.intro proof where
proof : Names.Morphism.Identityₗ{Obj = ℕ}(\{x} → swap(transitivity(_≤_) {x})) (reflexivity(_≤_))
proof {𝟎} {y} {min} = [≡]-intro
proof {𝐒 x} {𝐒 y} {succ p} = [≡]-with succ (proof {x}{y} {p})
instance
[≤]-identityᵣ : Morphism.Identityᵣ{Obj = ℕ}(\{x} → swap(transitivity(_≤_) {x})) (reflexivity(_≤_))
[≤]-identityᵣ = Morphism.intro proof where
proof : Names.Morphism.Identityᵣ{Obj = ℕ}(\{x} → swap(transitivity(_≤_) {x})) (reflexivity(_≤_))
proof {𝟎} {y} {min} = [≡]-intro
proof {𝐒 x} {𝐒 y} {succ p} = [≡]-with (p ↦ [≤]-with-[𝐒] ⦃ p ⦄) (proof {x}{y} {p})
instance
[≤]-associativity : Morphism.Associativity{Obj = ℕ}(\{x} → swap(transitivity(_≤_) {x}))
[≤]-associativity = Morphism.intro proof where
proof : Names.Morphism.Associativity{Obj = ℕ}(\{x} → swap(transitivity(_≤_) {x}))
proof {.𝟎} {.𝟎} {.𝟎} {w} {min} {min} {min} = [≡]-intro
proof {.𝟎} {.𝟎} {.(𝐒 _)} {.(𝐒 _)} {succ _} {min} {min} = [≡]-intro
proof {.𝟎} {.(𝐒 _)} {.(𝐒 _)} {.(𝐒 _)} {succ _} {succ _} {min} = [≡]-intro
proof {.(𝐒 _)} {.(𝐒 _)} {.(𝐒 _)} {.(𝐒 _)} {succ _} {succ _} {succ _} = [≡]-with succ proof
instance
[≤]-category : Category(_≤_)
Category._∘_ [≤]-category = swap(transitivity(_≤_))
Category.id [≤]-category = reflexivity(_≤_)
Category.binaryOperator [≤]-category = intro(\{[≡]-intro [≡]-intro → [≡]-intro})
| {
"alphanum_fraction": 0.6313901345,
"avg_line_length": 44.6,
"ext": "agda",
"hexsha": "6832d5a505de0b32fae8c2ca25d5c1f8b70da58c",
"lang": "Agda",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "Lolirofle/stuff-in-agda",
"max_forks_repo_path": "Numeral/Natural/Relation/Order/Category.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "Lolirofle/stuff-in-agda",
"max_issues_repo_path": "Numeral/Natural/Relation/Order/Category.agda",
"max_line_length": 100,
"max_stars_count": 6,
"max_stars_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "Lolirofle/stuff-in-agda",
"max_stars_repo_path": "Numeral/Natural/Relation/Order/Category.agda",
"max_stars_repo_stars_event_max_datetime": "2022-02-05T06:53:22.000Z",
"max_stars_repo_stars_event_min_datetime": "2020-04-07T17:58:13.000Z",
"num_tokens": 825,
"size": 2230
} |
{-# OPTIONS --without-K --safe #-}
module Cats.Category.Constructions.Exponential where
open import Level
open import Cats.Category.Base
open import Cats.Category.Constructions.Product as Product using
(HasBinaryProducts)
open import Cats.Util.Conv
import Cats.Category.Constructions.Iso as Iso
import Cats.Category.Constructions.Unique as Unique
module Build {lo la l≈}
(Cat : Category lo la l≈)
{{hasBinaryProducts : HasBinaryProducts Cat}}
where
open Category Cat
open ≈-Reasoning
open Unique.Build Cat
open Iso.Build Cat
open HasBinaryProducts hasBinaryProducts
open _≅_
record Exp (B C : Obj) : Set (lo ⊔ la ⊔ l≈) where
field
Cᴮ : Obj
eval : Cᴮ × B ⇒ C
curry′ : ∀ {A} (f : A × B ⇒ C)
→ ∃![ f̃ ∈ A ⇒ Cᴮ ] (eval ∘ ⟨ f̃ × id ⟩ ≈ f)
curry : ∀ {A} → A × B ⇒ C → A ⇒ Cᴮ
curry f = curry′ f ⃗
eval-curry : ∀ {A} {f : A × B ⇒ C}
→ eval ∘ ⟨ curry f × id ⟩ ≈ f
eval-curry {f = f} = ∃!′.prop (curry′ f)
curry-unique : ∀ {A} {f : A × B ⇒ C} {g}
→ eval ∘ ⟨ g × id ⟩ ≈ f
→ curry f ≈ g
curry-unique {f = f} = ∃!′.unique (curry′ f)
uncurry : ∀ {A} → A ⇒ Cᴮ → A × B ⇒ C
uncurry f = eval ∘ ⟨ f × id ⟩
curry∘uncurry : ∀ {A} {f : A ⇒ Cᴮ}
→ curry (uncurry f) ≈ f
curry∘uncurry = curry-unique ≈.refl
uncurry∘curry : ∀ {A} {f : A × B ⇒ C}
→ uncurry (curry f) ≈ f
uncurry∘curry = eval-curry
instance HasObj-Exp : ∀ {B C} → HasObj (Exp B C) lo la l≈
HasObj-Exp = record { Cat = Cat ; _ᴼ = Exp.Cᴮ }
open Exp public
curry∘curry : ∀ {A B C Y Z} (Cᴮ : Exp B C) (Yᶻ : Exp Y Z)
→ {f : Cᴮ ᴼ × Y ⇒ Z} {g : A × B ⇒ C}
→ curry Yᶻ f ∘ curry Cᴮ g ≈ curry Yᶻ (f ∘ ⟨ curry Cᴮ g × id ⟩)
curry∘curry Cᴮ Yᶻ {f} {g} = ≈.sym (curry-unique Yᶻ (
begin
eval Yᶻ ∘ ⟨ curry Yᶻ f ∘ curry Cᴮ g × id ⟩
≈⟨ ∘-resp-r (⟨×⟩-resp ≈.refl (≈.sym id-l)) ⟩
eval Yᶻ ∘ ⟨ curry Yᶻ f ∘ curry Cᴮ g × id ∘ id ⟩
≈⟨ ∘-resp-r (≈.sym ⟨×⟩-∘) ⟩
eval Yᶻ ∘ ⟨ curry Yᶻ f × id ⟩ ∘ ⟨ curry Cᴮ g × id ⟩
≈⟨ unassoc ⟩
(eval Yᶻ ∘ ⟨ curry Yᶻ f × id ⟩) ∘ ⟨ curry Cᴮ g × id ⟩
≈⟨ ∘-resp-l (eval-curry Yᶻ) ⟩
f ∘ ⟨ curry Cᴮ g × id ⟩
∎
))
Exp-resp-≅ : ∀ {A A′ B B′}
→ A ≅ A′
→ B ≅ B′
→ (E : Exp A B) (E′ : Exp A′ B′)
→ E ᴼ ≅ E′ ᴼ
Exp-resp-≅ A≅A′ B≅B′ E E′ = record
{ forth = curry E′ (B≅B′ .forth ∘ eval E ∘ ⟨ id × A≅A′ .back ⟩)
; back = curry E (B≅B′ .back ∘ eval E′ ∘ ⟨ id × A≅A′ .forth ⟩)
-- Today in our series on 'trivial' properties (also copy-and-paste
-- programming).
; back-forth = ≈.trans (curry∘curry E′ E)
(curry-unique E (≈.trans (∘-resp-r ⟨×⟩-id) (≈.trans id-r
(≈.sym (≈.trans assoc (≈.trans (∘-resp-r (≈.trans assoc (≈.trans
(∘-resp-r (≈.trans ⟨×⟩-∘
(≈.trans (⟨×⟩-resp (≈.trans id-l (≈.sym id-r)) (≈.trans id-r (≈.sym id-l)))
(≈.sym ⟨×⟩-∘)))) (≈.trans unassoc (∘-resp-l (eval-curry E′))))))
(≈.trans unassoc (≈.trans (∘-resp-l (≈.trans unassoc
(≈.trans (∘-resp-l (B≅B′ .back-forth)) id-l)))
(≈.trans assoc (≈.trans (∘-resp-r (≈.trans ⟨×⟩-∘
(≈.trans (⟨×⟩-resp id-l (A≅A′ .back-forth)) ⟨×⟩-id))) id-r))))))))))
; forth-back = ≈.trans (curry∘curry E E′)
(curry-unique E′ (≈.trans (∘-resp-r ⟨×⟩-id) (≈.trans id-r
(≈.sym (≈.trans assoc (≈.trans (∘-resp-r (≈.trans assoc (≈.trans
(∘-resp-r (≈.trans ⟨×⟩-∘
(≈.trans (⟨×⟩-resp (≈.trans id-l (≈.sym id-r)) (≈.trans id-r (≈.sym id-l)))
(≈.sym ⟨×⟩-∘)))) (≈.trans unassoc (∘-resp-l (eval-curry E))))))
(≈.trans unassoc (≈.trans (∘-resp-l (≈.trans unassoc
(≈.trans (∘-resp-l (B≅B′ .forth-back)) id-l)))
(≈.trans assoc (≈.trans (∘-resp-r (≈.trans ⟨×⟩-∘
(≈.trans (⟨×⟩-resp id-l (A≅A′ .forth-back)) ⟨×⟩-id))) id-r))))))))))
}
record HasExponentials {lo la l≈}
(Cat : Category lo la l≈)
: Set (lo ⊔ la ⊔ l≈)
where
private open module Bld = Build Cat using (Exp)
open Category Cat
open Unique.Build Cat
open Iso.Build Cat
infixr 1 _↝′_ _↝_
field
{{hasBinaryProducts}} : HasBinaryProducts Cat
_↝′_ : ∀ B C → Exp B C
open HasBinaryProducts hasBinaryProducts
_↝_ : Obj → Obj → Obj
B ↝ C = (B ↝′ C) ᴼ
eval : ∀ {B C} → (B ↝ C) × B ⇒ C
eval {B} {C} = Bld.eval (B ↝′ C)
curry : ∀ {A B C} → A × B ⇒ C → A ⇒ B ↝ C
curry {B = B} {C} f = Bld.curry (B ↝′ C) f
uncurry : ∀ {A B C} → A ⇒ B ↝ C → A × B ⇒ C
uncurry {B = B} {C} = Bld.uncurry (B ↝′ C)
eval-curry : ∀ {A B C} {f : A × B ⇒ C}
→ eval ∘ ⟨ curry f × id ⟩ ≈ f
eval-curry {B = B} {C} = Bld.eval-curry (B ↝′ C)
curry-unique : ∀ {A B C} {f : A × B ⇒ C} {g}
→ eval ∘ ⟨ g × id ⟩ ≈ f
→ curry f ≈ g
curry-unique {B = B} {C} = Bld.curry-unique (B ↝′ C)
curry∘uncurry : ∀ {A B C} {f : A ⇒ B ↝ C}
→ curry (uncurry f) ≈ f
curry∘uncurry {B = B} {C} = Bld.curry∘uncurry (B ↝′ C)
uncurry∘curry : ∀ {A B C} {f : A × B ⇒ C}
→ uncurry (curry f) ≈ f
uncurry∘curry {B = B} {C} = Bld.uncurry∘curry (B ↝′ C)
curry∘curry : ∀ {A B C Y Z}
→ {f : (B ↝ C) × Y ⇒ Z} {g : A × B ⇒ C}
→ curry f ∘ curry g ≈ curry (f ∘ ⟨ curry g × id ⟩)
curry∘curry {B = B} {C} {Y} {Z} = Bld.curry∘curry (B ↝′ C) (Y ↝′ Z)
↝-resp-≅ : ∀ {A A′ B B′}
→ A ≅ A′
→ B ≅ B′
→ (A ↝ B) ≅ (A′ ↝ B′)
↝-resp-≅ {A} {A′} {B} {B′} A≅A′ B≅B′
= Bld.Exp-resp-≅ A≅A′ B≅B′ (A ↝′ B) (A′ ↝′ B′)
open Build public
| {
"alphanum_fraction": 0.484904271,
"avg_line_length": 28.1450777202,
"ext": "agda",
"hexsha": "94afbc0095e0d5bb4a8d119ace34451c27664a3b",
"lang": "Agda",
"max_forks_count": 1,
"max_forks_repo_forks_event_max_datetime": "2019-03-18T15:35:07.000Z",
"max_forks_repo_forks_event_min_datetime": "2019-03-18T15:35:07.000Z",
"max_forks_repo_head_hexsha": "1ad7b243acb622d46731e9ae7029408db6e561f1",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "JLimperg/cats",
"max_forks_repo_path": "Cats/Category/Constructions/Exponential.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "1ad7b243acb622d46731e9ae7029408db6e561f1",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "JLimperg/cats",
"max_issues_repo_path": "Cats/Category/Constructions/Exponential.agda",
"max_line_length": 83,
"max_stars_count": 24,
"max_stars_repo_head_hexsha": "1ad7b243acb622d46731e9ae7029408db6e561f1",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "JLimperg/cats",
"max_stars_repo_path": "Cats/Category/Constructions/Exponential.agda",
"max_stars_repo_stars_event_max_datetime": "2021-08-06T05:00:46.000Z",
"max_stars_repo_stars_event_min_datetime": "2017-11-03T15:18:57.000Z",
"num_tokens": 2539,
"size": 5432
} |
{-# OPTIONS --cubical --safe #-}
module Control.Monad.Levels.Eliminators where
open import Prelude
open import Data.Bag
open import Control.Monad.Levels.Definition
record Eliminator {a p} (A : Type a) (P : Levels A → Type p) : Type (a ℓ⊔ p) where
constructor elim
field
⟦_⟧-set : ∀ {xs} → isSet (P xs)
⟦_⟧_∷_⟨_⟩ : ∀ x xs → P xs → P (x ∷ xs)
⟦_⟧[] : P []
⟦_⟧-trail : PathP (λ i → P (trail i)) (⟦_⟧_∷_⟨_⟩ [] [] ⟦_⟧[]) ⟦_⟧[]
run : ∀ xs → P xs
run (x ∷ xs) = ⟦_⟧_∷_⟨_⟩ x xs (run xs)
run [] = ⟦_⟧[]
run (trail i) = ⟦_⟧-trail i
run (trunc xs ys x y i j) =
isOfHLevel→isOfHLevelDep 2
(λ xs → ⟦_⟧-set {xs})
(run xs) (run ys)
(cong run x) (cong run y)
(trunc xs ys x y)
i j
_⇓_ : (xs : Levels A) → P xs
_⇓_ = run
{-# INLINE _⇓_ #-}
open Eliminator public
infixr 1 Eliminator
syntax Eliminator A (λ v → e) = Levels-Π[ v ⦂ e ] A
record Recursor (A : Type a) (B : Type b) : Type (a ℓ⊔ b) where
constructor rec
field
[_]-set : isSet B
[_]_∷_⟨_⟩ : (x : ⟅ A ⟆) → (xs : Levels A) → B → B
[_][] : B
private f = [_]_∷_⟨_⟩; z = [_][]
field
[_]-trail : f [] [] z ≡ z
_↑ : Eliminator A (λ _ → B)
_↑ = elim [_]-set f z [_]-trail
_↓_ : Levels A → B
_↓_ = run _↑
{-# INLINE _↑ #-}
{-# INLINE _↓_ #-}
open Recursor public
infixr 1 Recursor
syntax Recursor A B = Levels-ϕ[ A ] B
infix 4 _⊜_
record AnEquality (A : Type a) : Type a where
constructor _⊜_
field lhs rhs : Levels A
open AnEquality public
record Property {r} (A : Type a) (P : Levels A → Type r) : Type (a ℓ⊔ r) where
constructor property
field
∥_∥-prop : ∀ {xs} → isProp (P xs)
∥_∥_∷_⟨_⟩ : (x : ⟅ A ⟆) → (xs : Levels A) → P xs → P (x ∷ xs)
∥_∥[] : P []
private z = ∥_∥[]; f = ∥_∥_∷_⟨_⟩
∥_∥⇑ = elim
(λ {xs} → isProp→isSet (∥_∥-prop {xs}))
f z
(toPathP (∥_∥-prop (transp (λ i → P (trail i)) i0 (f [] [] z)) z))
∥_∥⇓ = run ∥_∥⇑
{-# INLINE ∥_∥⇑ #-}
{-# INLINE ∥_∥⇓ #-}
open Property public
infixr 1 Property
syntax Property A (λ v → e) = Levels-ψ[ v ⦂ A ] e
record EqualityProof {B : Type b} (A : Type a) (P : Levels A → AnEquality B) : Type (a ℓ⊔ b) where
Pr : Levels A → Type b
Pr xs = let e = P xs in lhs e ≡ rhs e
field
⟦_⟧≡_∷_⟨_⟩ : (x : ⟅ A ⟆) → (xs : Levels A) → Pr xs → Pr (x ∷ xs)
⟦_⟧≡[] : Pr []
_⇑≡ : Eliminator A Pr
_⇑≡ = ∥ property (trunc _ _) ⟦_⟧≡_∷_⟨_⟩ ⟦_⟧≡[] ∥⇑
_⇓≡_ : (xs : Levels A) → Pr xs
_⇓≡_ = run _⇑≡
{-# INLINE _⇑≡ #-}
{-# INLINE _⇓≡_ #-}
open EqualityProof public
infixr 1 EqualityProof
syntax EqualityProof A (λ v → e) = Levels-ψ[ v ⦂ A ]≡ e
| {
"alphanum_fraction": 0.5166602834,
"avg_line_length": 24.8666666667,
"ext": "agda",
"hexsha": "51d7d6730f30e3cb8d3e6bf44519c32351a38d33",
"lang": "Agda",
"max_forks_count": 1,
"max_forks_repo_forks_event_max_datetime": "2021-11-11T12:30:21.000Z",
"max_forks_repo_forks_event_min_datetime": "2021-11-11T12:30:21.000Z",
"max_forks_repo_head_hexsha": "97a3aab1282b2337c5f43e2cfa3fa969a94c11b7",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "oisdk/agda-playground",
"max_forks_repo_path": "Control/Monad/Levels/Eliminators.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "97a3aab1282b2337c5f43e2cfa3fa969a94c11b7",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "oisdk/agda-playground",
"max_issues_repo_path": "Control/Monad/Levels/Eliminators.agda",
"max_line_length": 98,
"max_stars_count": 6,
"max_stars_repo_head_hexsha": "97a3aab1282b2337c5f43e2cfa3fa969a94c11b7",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "oisdk/agda-playground",
"max_stars_repo_path": "Control/Monad/Levels/Eliminators.agda",
"max_stars_repo_stars_event_max_datetime": "2021-11-16T08:11:34.000Z",
"max_stars_repo_stars_event_min_datetime": "2020-09-11T17:45:41.000Z",
"num_tokens": 1220,
"size": 2611
} |
{-# OPTIONS --safe --warning=error --without-K #-}
open import LogicalFormulae
open import Groups.Groups
open import Functions.Definition
open import Numbers.Naturals.Semiring
open import Numbers.Naturals.Order
open import Numbers.Integers.Integers
open import Numbers.Modulo.Group
open import Numbers.Modulo.Definition
open import Rings.Examples.Proofs
open import Numbers.Primes.PrimeNumbers
open import Setoids.Setoids
open import Rings.Definition
open import Groups.Definition
open import Groups.Lemmas
open import Sets.EquivalenceRelations
module Rings.Examples.Examples where
multiplicationNotGroup : {a b : _} {A : Set a} {S : Setoid {a} {b} A} {_+_ _*_ : A → A → A} (R : Ring S _+_ _*_) → (nontrivial : Setoid._∼_ S (Ring.1R R) (Ring.0R R) → False) → Group S _*_ → False
multiplicationNotGroup {S = S} R 1!=0 gr = exFalso (1!=0 (groupsHaveLeftCancellation gr (Ring.0R R) (Ring.1R R) (Ring.0R R) (transitive (Ring.timesZero' R) (symmetric (Ring.timesZero' R)))))
where
open Setoid S
open Equivalence eq
nToZn : (n : ℕ) (pr : 0 <N n) (x : ℕ) → ℤn n pr
nToZn n pr x = nToZn' n pr x
mod : (n : ℕ) → (pr : 0 <N n) → ℤ → ℤn n pr
mod n pr a = mod' n pr a
modNExampleSurjective : (n : ℕ) → (pr : 0 <N n) → Surjection (mod n pr)
modNExampleSurjective n pr = modNExampleSurjective' n pr
{-
modNExampleGroupHom : (n : ℕ) → (pr : 0 <N n) → GroupHom ℤGroup (ℤnGroup n pr) (mod n pr)
modNExampleGroupHom n pr = modNExampleGroupHom' n pr
embedZnInZ : {n : ℕ} {pr : 0 <N n} → (a : ℤn n pr) → ℤ
embedZnInZ record { x = x } = nonneg x
modNRoundTrip : (n : ℕ) → (pr : 0 <N n) → (a : ℤn n pr) → mod n pr (embedZnInZ a) ≡ a
modNRoundTrip zero ()
modNRoundTrip (succ n) pr record { x = x ; xLess = xLess } with divisionAlg (succ n) x
modNRoundTrip (succ n) _ record { x = x ; xLess = xLess } | record { quot = quot ; rem = rem ; pr = pr ; remIsSmall = inl remIsSmall ; quotSmall = quotSmall } = equalityZn _ _ p
where
p : rem ≡ x
p = modIsUnique record { quot = quot ; rem = rem ; pr = pr ; remIsSmall = inl remIsSmall ; quotSmall = quotSmall } record { quot = 0 ; rem = x ; pr = identityOfIndiscernablesLeft _ _ _ _≡_ refl (applyEquality (λ i → i +N x) (multiplicationNIsCommutative 0 n)) ; remIsSmall = inl xLess ; quotSmall = inl (succIsPositive n) }
modNRoundTrip (succ n) _ record { x = x ; xLess = xLess } | record { quot = quot ; rem = rem ; pr = pr ; remIsSmall = inr () }
-}
| {
"alphanum_fraction": 0.6670792079,
"avg_line_length": 45.7358490566,
"ext": "agda",
"hexsha": "f506b84e3dd4a01aea6b603590213dd80a9fcb2e",
"lang": "Agda",
"max_forks_count": 1,
"max_forks_repo_forks_event_max_datetime": "2021-11-29T13:23:07.000Z",
"max_forks_repo_forks_event_min_datetime": "2021-11-29T13:23:07.000Z",
"max_forks_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "Smaug123/agdaproofs",
"max_forks_repo_path": "Rings/Examples/Examples.agda",
"max_issues_count": 14,
"max_issues_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562",
"max_issues_repo_issues_event_max_datetime": "2020-04-11T11:03:39.000Z",
"max_issues_repo_issues_event_min_datetime": "2019-01-06T21:11:59.000Z",
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "Smaug123/agdaproofs",
"max_issues_repo_path": "Rings/Examples/Examples.agda",
"max_line_length": 329,
"max_stars_count": 4,
"max_stars_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "Smaug123/agdaproofs",
"max_stars_repo_path": "Rings/Examples/Examples.agda",
"max_stars_repo_stars_event_max_datetime": "2022-01-28T06:04:15.000Z",
"max_stars_repo_stars_event_min_datetime": "2019-08-08T12:44:19.000Z",
"num_tokens": 862,
"size": 2424
} |
open import Common.Reflection
open import Common.Unit
open import Common.Prelude
macro
t1 : (A : Set) -> Term -> Term -> Tactic
t1 x y z = give y
t2 : Term -> (A : Set) -> Term -> Tactic
t2 x y z = give x
t3 : Term -> Term -> (A : Set) -> QName -> Tactic
t3 x y z n = give x
t4 : Term -> Term -> (A : Set) -> A -> Tactic
t4 x y z a = give x
f1 : {A : Set} -> A -> A
f1 x = t1 Unit x x
f2 : {A : Set} -> A -> A
f2 x = t2 x Unit x
y : Set
y = Unit
f3 : {A : Set} -> A -> A
f3 x = (t3 x x Unit y)
f4 : {A : Set} -> A -> A
f4 x = t4 x x Unit unit
| {
"alphanum_fraction": 0.5113835377,
"avg_line_length": 16.3142857143,
"ext": "agda",
"hexsha": "8104d517493547887ba8923e66a1a02cad5db209",
"lang": "Agda",
"max_forks_count": 371,
"max_forks_repo_forks_event_max_datetime": "2022-03-30T19:00:30.000Z",
"max_forks_repo_forks_event_min_datetime": "2015-01-03T14:04:08.000Z",
"max_forks_repo_head_hexsha": "7f58030124fa99dfbf8db376659416f3ad8384de",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "cruhland/agda",
"max_forks_repo_path": "test/Succeed/MacroArgs.agda",
"max_issues_count": 4066,
"max_issues_repo_head_hexsha": "7f58030124fa99dfbf8db376659416f3ad8384de",
"max_issues_repo_issues_event_max_datetime": "2022-03-31T21:14:49.000Z",
"max_issues_repo_issues_event_min_datetime": "2015-01-10T11:24:51.000Z",
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "cruhland/agda",
"max_issues_repo_path": "test/Succeed/MacroArgs.agda",
"max_line_length": 51,
"max_stars_count": 1989,
"max_stars_repo_head_hexsha": "7f58030124fa99dfbf8db376659416f3ad8384de",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "cruhland/agda",
"max_stars_repo_path": "test/Succeed/MacroArgs.agda",
"max_stars_repo_stars_event_max_datetime": "2022-03-30T18:20:48.000Z",
"max_stars_repo_stars_event_min_datetime": "2015-01-09T23:51:16.000Z",
"num_tokens": 236,
"size": 571
} |
module lambda.untyped where
open import Data.Nat
open import Data.Fin hiding (lift)
data term (n : ℕ) : Set where
lam : term (suc n) → term n
var : Fin n → term n
app : term n → term n → term n
data norm {n : ℕ} : term n → Set
data neut {n : ℕ} : term n → Set
data norm {n} where
lam : {x : term (suc n)} → norm x → norm (lam x)
gnd : {x : term n} → neut x → norm x
data neut {n} where
var : {i : Fin n} → neut (var i)
app : {x y : term n} → neut x → norm y → neut (app x y)
lift : ∀ {n} → term n → term (suc n)
lift (lam x) = lam (lift x)
lift (var i) = var (suc i)
lift (app x y) = app (lift x) (lift y)
lift₁ : ∀ {n} → term (suc n) → term (suc (suc n))
lift₁ (lam x) = lam (lift₁ x)
lift₁ (var zero) = var zero
lift₁ (var (suc i)) = var (suc (suc i))
lift₁ (app x y) = app (lift₁ x) (lift₁ y)
↑ : ∀ {n m} → (Fin n → term m) → Fin (suc n) → term (suc m)
↑ ρ zero = var zero
↑ ρ (suc i) = lift (ρ i)
subst : ∀ {n m} → term n → (Fin n → term m) → term m
subst (lam x) ρ = lam (subst x (↑ ρ))
subst (var i) ρ = ρ i
subst (app x y) ρ = app (subst x ρ) (subst y ρ)
subst₁ : ∀ {n} → term (suc n) → term n → term n
subst₁ x y = subst x (λ {zero → y; (suc i) → var i})
data _→β_ {n : ℕ} : term n → term n → Set where
β-beta : ∀ {x y} → app (lam x) y →β subst₁ x y
β-app₁ : ∀ {x y z} → x →β y → app x z →β app y z
β-app₂ : ∀ {x y z} → y →β z → app x y →β app x z
β-lam : ∀ {x y} → x →β y → lam x →β lam y
data _β*_ {n : ℕ} : term n → term n → Set where
ε : ∀ {x} → x β* x
_←_ : ∀ {x y z} → x →β y → y β* z → x β* z
| {
"alphanum_fraction": 0.5252263907,
"avg_line_length": 28.6296296296,
"ext": "agda",
"hexsha": "b8ffedb3d3332644a2f8edec58867a90c39d3f58",
"lang": "Agda",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "09a231d9b3057d57b864070188ed9fe14a07eda2",
"max_forks_repo_licenses": [
"Apache-2.0"
],
"max_forks_repo_name": "Lapin0t/lambda",
"max_forks_repo_path": "lambda/untyped.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "09a231d9b3057d57b864070188ed9fe14a07eda2",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"Apache-2.0"
],
"max_issues_repo_name": "Lapin0t/lambda",
"max_issues_repo_path": "lambda/untyped.agda",
"max_line_length": 59,
"max_stars_count": null,
"max_stars_repo_head_hexsha": "09a231d9b3057d57b864070188ed9fe14a07eda2",
"max_stars_repo_licenses": [
"Apache-2.0"
],
"max_stars_repo_name": "Lapin0t/lambda",
"max_stars_repo_path": "lambda/untyped.agda",
"max_stars_repo_stars_event_max_datetime": null,
"max_stars_repo_stars_event_min_datetime": null,
"num_tokens": 667,
"size": 1546
} |
{-# OPTIONS --without-K --no-pattern-matching #-}
module Ch2-6 where
open import Level hiding (lift)
open import Ch2-1
open import Ch2-2
open import Ch2-3
open import Ch2-4
open import Ch2-5
open import Data.Product
open import Function using (id; _∘_)
-- Definition 2.6.1
Definition-2-6-1 : ∀ {a b} {A : Set a} {B : Set b} {x y : A × B}
→ (p : x ≡ y)
→ proj₁ x ≡ proj₁ y × proj₂ x ≡ proj₂ y
Definition-2-6-1 {_} {_} {A} {B} {x} {y} p = J (A × B) D d x y p
where
D : (x y : A × B) (p : x ≡ y) → Set _
D x y p = proj₁ x ≡ proj₁ y × proj₂ x ≡ proj₂ y
d : (x : A × B) → D x x refl
d x = refl , refl
-- Definition 2.6.3
Definition-2-6-3 : ∀ {i j} {A : Set i} {B : Set j} {x y : A × B}
→ proj₁ x ≡ proj₁ y × proj₂ x ≡ proj₂ y → x ≡ y
Definition-2-6-3 {_} {_} {A} {B} {x} {y} p
= J A D d (proj₁ x) (proj₁ y) (proj₁ p) (proj₂ x) (proj₂ y) (proj₂ p)
where
D : (a b : A) (fst : a ≡ b) → Set _
D a b fst = (a' b' : B) (snd : a' ≡ b') → (a , a') ≡ (b , b')
d : (x : A) → D x x refl
d x a' b' snd = J B E e a' b' snd x
where
E : (a' b' : B) (snd : a' ≡ b') → Set _
E a' b' snd = (x : A) → (x , a') ≡ (x , b')
e : (x : B) → E x x refl
e x y = refl
pair≡ : ∀ {a b} {A : Set a} {B : Set b} {x y : A × B}
→ proj₁ x ≡ proj₁ y × proj₂ x ≡ proj₂ y → x ≡ y
pair≡ = Definition-2-6-3
-- Theorem 2.6.2
Theorem-2-6-2 : ∀ {a b} {A : Set a} {B : Set b} (x y : A × B)
→ (x ≡ y) ≅ (proj₁ x ≡ proj₁ y × proj₂ x ≡ proj₂ y)
Theorem-2-6-2 {_} {_} {A} {B} a b = Definition-2-6-1 , it-isequiv
--
where
it-isequiv : isequiv Definition-2-6-1
it-isequiv = (Definition-2-6-3 , α) , (Definition-2-6-3 , β)
where
α : Definition-2-6-1 ∘ Definition-2-6-3 ~ id
α p = J A D d (proj₁ a) (proj₁ b) (proj₁ p) (proj₂ a) (proj₂ b) (proj₂ p)
where
D : (x y : A) (p : x ≡ y) → Set _
D x y p = (x' y' : B) (snd : x' ≡ y')
→ (Definition-2-6-1 ∘ Definition-2-6-3) (p , snd) ≡ ((p , snd))
d : (x : A) → D x x refl
d x x' y' q = J B E e x' y' q
where
E : (x' y' : B) (q : x' ≡ y') → Set _
E x' y' q = (Definition-2-6-1 ∘ Definition-2-6-3) (refl , q) ≡ ((refl , q))
e : (x' : B) → E x' x' refl
e x' = refl
β : Definition-2-6-3 ∘ Definition-2-6-1 ~ id
β p = J (A × B) D d a b p
where
D : (x y : A × B) (p : x ≡ y) → Set _
D x y p = (Definition-2-6-3 ∘ Definition-2-6-1) p ≡ id p
d : (x : A × B) → D x x refl
d x = refl
-- Definition 2.6.4
_X_ : {a b : Level} {Z : Set a}
→ (A B : Z → Set b)
→ Z → Set _
_X_ {a} {b} {Z} A B z = A z × B z
-- Theorem 2.6.4
Theorem-2-6-4 : {a b : Level} {Z : Set a}
→ (A B : Z → Set b)
→ {z w : Z} (p : z ≡ w)
→ (x : (A X B) z)
→ transport (A X B) p x ≡ ((transport A p (proj₁ x)) , transport B p (proj₂ x))
Theorem-2-6-4 {_} {_} {Z} A B {z} {w} p x = J _ D d z w p x
where
D : (z w : Z) (p : z ≡ w) → Set _
D z w p = (x : (A X B) z)
→ transport (A X B) p x ≡
(transport A p (proj₁ x) , transport B p (proj₂ x))
d : (z : Z) → D z z refl
d z x = refl
-- Definition 2.6.5
Definition-2-6-5 : {a a' b b' : Level}
→ {A : Set a} {A' : Set a'} {B : Set b} {B' : Set b'}
→ (g : A → A') (h : B → B')
→ A × B
→ A' × B'
Definition-2-6-5 g h x = g (proj₁ x) , h (proj₂ x)
-- Theorem 2.6.5
Theorem-2-6-5 : {a a' b b' : Level}
→ {A : Set a} {A' : Set a'} {B : Set b} {B' : Set b'}
→ (g : A → A') (h : B → B')
→ {x y : A × B}
→ (p : proj₁ x ≡ proj₁ y)
→ (q : proj₂ x ≡ proj₂ y)
→ ap (Definition-2-6-5 g h) (Definition-2-6-3 (p , q)) ≡ Definition-2-6-3 (ap g p , ap h q)
Theorem-2-6-5 {A = A} {A'} {B} {B'} g h {x} {y} p q = J _ D d (proj₁ x) (proj₁ y) p g h (proj₂ x) (proj₂ y) q
where
D : (x₁ y₁ : A) (p : x₁ ≡ y₁) → Set _
D x₁ y₁ p = (g : A → A') (h : B → B') (x₂ y₂ : B) (q : x₂ ≡ y₂)
→ ap (Definition-2-6-5 g h) (Definition-2-6-3 (p , q)) ≡
Definition-2-6-3 (ap g p , ap h q)
d : (x : A) → D x x refl
d x g h x₂ y₂ q = J _ E e x₂ y₂ q g h
where
E : (x₂ y₂ : B) (q : x₂ ≡ y₂) → Set _
E x₂ y₂ q = (g : A → A') (h : B → B')
→ ap (Definition-2-6-5 g h) (Definition-2-6-3 (refl , q)) ≡
Definition-2-6-3 (ap g refl , ap h q)
e : (y : B) → E y y refl
e y g h = refl
| {
"alphanum_fraction": 0.438750281,
"avg_line_length": 30.6827586207,
"ext": "agda",
"hexsha": "0a913c81f61b11a2c3a3942df6e01e5e016ac75d",
"lang": "Agda",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "75eea99a879e100304bd48c538c9d2db0b4a4ff3",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "banacorn/hott",
"max_forks_repo_path": "src/Ch2-6.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "75eea99a879e100304bd48c538c9d2db0b4a4ff3",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "banacorn/hott",
"max_issues_repo_path": "src/Ch2-6.agda",
"max_line_length": 109,
"max_stars_count": null,
"max_stars_repo_head_hexsha": "75eea99a879e100304bd48c538c9d2db0b4a4ff3",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "banacorn/hott",
"max_stars_repo_path": "src/Ch2-6.agda",
"max_stars_repo_stars_event_max_datetime": null,
"max_stars_repo_stars_event_min_datetime": null,
"num_tokens": 2041,
"size": 4449
} |
module L.Base.Empty.Core where
open import Agda.Primitive
-- Introducing the empty type
data ⊥ : Set where
exfalso : ∀{c} (C : ⊥ → Set c) → (a : ⊥) → C a
exfalso = λ C ()
| {
"alphanum_fraction": 0.6206896552,
"avg_line_length": 17.4,
"ext": "agda",
"hexsha": "7b79e8615215c12733256fc3250e3832fb20664a",
"lang": "Agda",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "83707537b182ba8906228ac0bcb9ccef972eaaa3",
"max_forks_repo_licenses": [
"BSD-2-Clause"
],
"max_forks_repo_name": "borszag/smallib",
"max_forks_repo_path": "src/L/Base/Empty/Core.agda",
"max_issues_count": 10,
"max_issues_repo_head_hexsha": "83707537b182ba8906228ac0bcb9ccef972eaaa3",
"max_issues_repo_issues_event_max_datetime": "2020-11-09T16:40:39.000Z",
"max_issues_repo_issues_event_min_datetime": "2020-10-19T10:13:16.000Z",
"max_issues_repo_licenses": [
"BSD-2-Clause"
],
"max_issues_repo_name": "borszag/smallib",
"max_issues_repo_path": "src/L/Base/Empty/Core.agda",
"max_line_length": 46,
"max_stars_count": null,
"max_stars_repo_head_hexsha": "83707537b182ba8906228ac0bcb9ccef972eaaa3",
"max_stars_repo_licenses": [
"BSD-2-Clause"
],
"max_stars_repo_name": "borszag/smallib",
"max_stars_repo_path": "src/L/Base/Empty/Core.agda",
"max_stars_repo_stars_event_max_datetime": null,
"max_stars_repo_stars_event_min_datetime": null,
"num_tokens": 63,
"size": 174
} |
-- Andreas, 2020-03-26, issue #4481, reported by gallais
-- #952 unintentionally added named lambdas; tests here.
-- {-# OPTIONS --show-implicit #-}
-- {-# OPTIONS -v tc.term.expr.top:15 #-}
-- {-# OPTIONS -v tc.term.lambda:30 #-}
open import Agda.Primitive
-- Named lambdas:
postulate f : ({A : Set} → Set) → Set
_ = f λ {A = A} → A
postulate
A : Set
g : ({{a : A}} → A) → A
_ = g λ {{a = a}} → a
data ⊥ : Set where
record ⊤ : Set where
proj2 : ∀ a {A B : Set a} → Set a
proj2 = λ _ {B = B} → B
agdaIsConsistent : proj2 lzero {⊥} {⊤}
agdaIsConsistent = _
| {
"alphanum_fraction": 0.5782073814,
"avg_line_length": 19.6206896552,
"ext": "agda",
"hexsha": "f32d1d65ec1af1d0262caa6e77b44283300357b5",
"lang": "Agda",
"max_forks_count": 371,
"max_forks_repo_forks_event_max_datetime": "2022-03-30T19:00:30.000Z",
"max_forks_repo_forks_event_min_datetime": "2015-01-03T14:04:08.000Z",
"max_forks_repo_head_hexsha": "ed8ac6f4062ea8a20fa0f62d5db82d4e68278338",
"max_forks_repo_licenses": [
"BSD-3-Clause"
],
"max_forks_repo_name": "shlevy/agda",
"max_forks_repo_path": "test/Succeed/Issue4481.agda",
"max_issues_count": 4066,
"max_issues_repo_head_hexsha": "ed8ac6f4062ea8a20fa0f62d5db82d4e68278338",
"max_issues_repo_issues_event_max_datetime": "2022-03-31T21:14:49.000Z",
"max_issues_repo_issues_event_min_datetime": "2015-01-10T11:24:51.000Z",
"max_issues_repo_licenses": [
"BSD-3-Clause"
],
"max_issues_repo_name": "shlevy/agda",
"max_issues_repo_path": "test/Succeed/Issue4481.agda",
"max_line_length": 56,
"max_stars_count": 1989,
"max_stars_repo_head_hexsha": "ed8ac6f4062ea8a20fa0f62d5db82d4e68278338",
"max_stars_repo_licenses": [
"BSD-3-Clause"
],
"max_stars_repo_name": "shlevy/agda",
"max_stars_repo_path": "test/Succeed/Issue4481.agda",
"max_stars_repo_stars_event_max_datetime": "2022-03-30T18:20:48.000Z",
"max_stars_repo_stars_event_min_datetime": "2015-01-09T23:51:16.000Z",
"num_tokens": 212,
"size": 569
} |
{-# OPTIONS --without-K --rewriting #-}
open import HoTT renaming (pt to ⊙pt)
open import cw.CW
open import cw.FinCW
open import cohomology.Theory
open import groups.Int
open import groups.DisjointlyPointedSet
module cw.cohomology.cochainequiv.AugmentCommSquare (OT : OrdinaryTheory lzero)
(⊙fin-skel : ⊙FinSkeleton 0) where
open OrdinaryTheory OT
open import cw.cohomology.reconstructed.TipAndAugment OT ⊙⦉ ⊙fin-skel ⦊
private
I = ⊙FinSkeleton.skel ⊙fin-skel
ac = ⊙FinSkeleton-has-cells-with-choice 0 ⊙fin-skel lzero
pt = ⊙FinSkeleton.skel ⊙fin-skel
abstract
augment-comm-sqr :
CommSquareEquiv
(GroupHom.f cw-coε)
(_∘ᴳ FreeAbGroup-extend (Lift-abgroup {j = lzero} ℤ-abgroup) λ _ → lift 1)
((_∘ᴳ lower-hom {j = lzero}) ∘ <– (ℤ→ᴳ-equiv-idf (C2 0)))
(FreeAbGroup-extend (C2-abgroup 0) ∘ GroupIso.f (C2×CX₀-diag-β ac))
augment-comm-sqr = comm-sqr (λ g → equiv-adj'
(GroupIso.f-equiv (FreeAbGroup-extend-iso (C2-abgroup 0) ∘eᴳ C2×CX₀-diag-β ac))
(! $ pair×= idp
( ap (GroupIso.g (CX₀-diag-β ac)) (λ= λ _ → Group.inv-r (C2 0) g)
∙ GroupHom.pres-ident (GroupIso.g-hom (CX₀-diag-β ac))))) ,
(GroupIso.f-is-equiv (pre∘ᴳ-iso (C2-abgroup 0) (lower-iso {j = lzero}) ∘eᴳ ℤ→ᴳ-iso-idf (C2-abgroup 0) ⁻¹ᴳ)) ,
(GroupIso.f-is-equiv (FreeAbGroup-extend-iso (C2-abgroup 0) ∘eᴳ C2×CX₀-diag-β ac))
augment-comm-sqrᴳ :
CommSquareEquivᴳ
cw-coε
(pre∘ᴳ-hom (C2-abgroup 0) (FreeAbGroup-extend (Lift-abgroup {j = lzero} ℤ-abgroup) λ _ → lift 1))
(pre∘ᴳ-hom (C2-abgroup 0) (lower-hom {j = lzero}) ∘ᴳ GroupIso.g-hom (ℤ→ᴳ-iso-idf (C2-abgroup 0)))
(FreeAbGroup-extend-hom (C2-abgroup 0) ∘ᴳ GroupIso.f-hom (C2×CX₀-diag-β ac))
augment-comm-sqrᴳ =
comm-sqrᴳ (fst augment-comm-sqr □$_) , snd augment-comm-sqr
| {
"alphanum_fraction": 0.6659192825,
"avg_line_length": 40.5454545455,
"ext": "agda",
"hexsha": "78444c60deeee742f6dc0161a06d13d2ed4a7eb4",
"lang": "Agda",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "66f800adef943afdf08c17b8ecfba67340fead5e",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "timjb/HoTT-Agda",
"max_forks_repo_path": "theorems/cw/cohomology/cochainequiv/AugmentCommSquare.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "66f800adef943afdf08c17b8ecfba67340fead5e",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "timjb/HoTT-Agda",
"max_issues_repo_path": "theorems/cw/cohomology/cochainequiv/AugmentCommSquare.agda",
"max_line_length": 113,
"max_stars_count": null,
"max_stars_repo_head_hexsha": "66f800adef943afdf08c17b8ecfba67340fead5e",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "timjb/HoTT-Agda",
"max_stars_repo_path": "theorems/cw/cohomology/cochainequiv/AugmentCommSquare.agda",
"max_stars_repo_stars_event_max_datetime": null,
"max_stars_repo_stars_event_min_datetime": null,
"num_tokens": 740,
"size": 1784
} |
module WErrorOverride where
postulate
IO : Set → Set
{-# COMPILE GHC IO = type IO #-}
{-# BUILTIN IO IO #-}
infixl 1 _>>=_
postulate
return : {A : Set} → A → IO A
_>>=_ : {A : Set} {B : Set} → IO A → (A → IO B) → IO B
{-# COMPILE GHC return = \_ -> return #-}
{-# COMPILE GHC _>>=_ = \_ _ -> (>>=) #-}
------------------------------------------------------------------------
-- An error should be raised if one tries to do something like this:
data PartialBool : Set where
true : PartialBool
{-# COMPILE GHC PartialBool = data Bool (True) #-}
-- However one can override such behaviour by passing the flag
-- --ghc-flag=-Wwarn to Agda upon compilation.
main = return true
| {
"alphanum_fraction": 0.5467625899,
"avg_line_length": 21.71875,
"ext": "agda",
"hexsha": "6d68c69d852cbfd63b42482a1147ffd52ab9d686",
"lang": "Agda",
"max_forks_count": 371,
"max_forks_repo_forks_event_max_datetime": "2022-03-30T19:00:30.000Z",
"max_forks_repo_forks_event_min_datetime": "2015-01-03T14:04:08.000Z",
"max_forks_repo_head_hexsha": "7f58030124fa99dfbf8db376659416f3ad8384de",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "cruhland/agda",
"max_forks_repo_path": "test/Succeed/WErrorOverride.agda",
"max_issues_count": 4066,
"max_issues_repo_head_hexsha": "7f58030124fa99dfbf8db376659416f3ad8384de",
"max_issues_repo_issues_event_max_datetime": "2022-03-31T21:14:49.000Z",
"max_issues_repo_issues_event_min_datetime": "2015-01-10T11:24:51.000Z",
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "cruhland/agda",
"max_issues_repo_path": "test/Succeed/WErrorOverride.agda",
"max_line_length": 72,
"max_stars_count": 1989,
"max_stars_repo_head_hexsha": "7f58030124fa99dfbf8db376659416f3ad8384de",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "cruhland/agda",
"max_stars_repo_path": "test/Succeed/WErrorOverride.agda",
"max_stars_repo_stars_event_max_datetime": "2022-03-30T18:20:48.000Z",
"max_stars_repo_stars_event_min_datetime": "2015-01-09T23:51:16.000Z",
"num_tokens": 191,
"size": 695
} |
{-# OPTIONS --safe #-}
module Cubical.Categories.Limits.Base where
open import Cubical.Foundations.Prelude
open import Cubical.Foundations.HLevels
open import Cubical.Data.Unit
open import Cubical.Data.Sigma using (ΣPathP)
open import Cubical.Categories.Category
open import Cubical.Categories.Functor
open import Cubical.Categories.NaturalTransformation
open import Cubical.Categories.Instances.Sets
private
variable
ℓJ ℓJ' ℓC ℓC' : Level
ℓ ℓ' ℓ'' : Level
module _ {J : Category ℓJ ℓJ'}
{C : Category ℓC ℓC'} where
open Category
open Functor
open NatTrans
-- functor which sends all objects to c and all
-- morphisms to the identity
constF : (c : C .ob) → Functor J C
constF c .F-ob _ = c
constF c .F-hom _ = C .id
constF c .F-id = refl
constF c .F-seq _ _ = sym (C .⋆IdL _)
-- a cone is a natural transformation from the constant functor at x to K
Cone : (K : Functor J C) → C .ob → Type _
Cone K x = NatTrans (constF x) K
module _ {K : Functor J C} where
-- precomposes a cone with a morphism
_◼_ : ∀ {d c : C .ob}
→ (f : C [ d , c ])
→ Cone K c
→ Cone K d
(f ◼ μ) .N-ob x = f ⋆⟨ C ⟩ μ ⟦ x ⟧
(f ◼ μ) .N-hom {x = x} {y} k
= C .id ⋆⟨ C ⟩ (f ⋆⟨ C ⟩ μ ⟦ y ⟧)
≡⟨ C .⋆IdL _ ⟩
f ⋆⟨ C ⟩ μ ⟦ y ⟧
≡⟨ cong (λ v → f ⋆⟨ C ⟩ v) (sym (C .⋆IdL _)) ⟩
f ⋆⟨ C ⟩ (C .id ⋆⟨ C ⟩ μ ⟦ y ⟧)
≡⟨ cong (λ v → f ⋆⟨ C ⟩ v) (μ .N-hom k) ⟩
f ⋆⟨ C ⟩ (μ ⟦ x ⟧ ⋆⟨ C ⟩ K ⟪ k ⟫)
≡⟨ sym (C .⋆Assoc _ _ _) ⟩
f ⋆⟨ C ⟩ μ ⟦ x ⟧ ⋆⟨ C ⟩ K ⟪ k ⟫
∎
-- μ factors ν if there's a morphism such that the natural transformation
-- from precomposing it with ν gives you back μ
_factors_ : {u v : C .ob} (μ : Cone K u) (ν : Cone K v) → Type _
_factors_ {u} {v} μ ν = Σ[ mor ∈ C [ v , u ] ] ν ≡ (mor ◼ μ)
-- μ uniquely factors ν if the factor from above is contractible
_uniquelyFactors_ : {u v : C .ob} (μ : Cone K u) (ν : Cone K v) → Type _
_uniquelyFactors_ {u} {v} μ ν = isContr (μ factors ν)
module _ (K : Functor J C) where
-- a Limit is a cone such that all cones are uniquely factored by it
record isLimit (head : C .ob) : Type (ℓ-max (ℓ-max ℓJ ℓJ') (ℓ-max ℓC ℓC')) where
field
cone : Cone K head
-- TODO: change this to terminal object in category of Cones?
up : ∀ {v} (ν : Cone K v) → cone uniquelyFactors ν
record Limit : Type (ℓ-max (ℓ-max ℓJ ℓJ') (ℓ-max ℓC ℓC')) where
field
head : C .ob
islim : isLimit head
-- a Category is complete if it has all limits
complete' : {ℓJ ℓJ' : Level} (C : Category ℓC ℓC') → Type _
complete' {ℓJ = ℓJ} {ℓJ'} C = (J : Category ℓJ ℓJ') (K : Functor J C) → Limit K
complete : (C : Category ℓC ℓC') → Typeω
complete C = ∀ {ℓJ ℓJ'} → complete' {ℓJ = ℓJ} {ℓJ'} C
open Limit
open NatTrans
open Category
-- TODO:
-- 1. every diagram has limits isomorphic to the limit of an equalizer of products
-- 2. every equalizer can be made into a pullback
-- 3. every product can be made into an equalizer
-- 4. a category with all pullbacks and a terminal object has all limits
-- SET is complete
-- notes:
-- didn't need to restrict to *finite* diagrams , why is that required in Set theoretic?
-- didn't use coinduction here because Agda didn't like me referencing 'cone' frome 'up' (termination check)
isCompleteSET : ∀ {ℓJ ℓJ'} → complete' {ℓJ = ℓJ} {ℓJ'} (SET (ℓ-max ℓJ ℓJ'))
isCompleteSET J K = record
{ head = head'
; islim = record { cone = cone' ; up = up' } }
where
-- the limit is defined as the Set of all cones with head Unit
head' = Cone K (Unit* , isOfHLevelLift 2 isSetUnit) , isSetNat
-- the legs are defined by taking a cone to its component at j
cone' : Cone K head'
cone' .N-ob j μ = (μ ⟦ j ⟧) tt*
-- Naturality follows from naturality of the Unit cone
cone' .N-hom {x = i} {j} f
= funExt λ μ → (μ ⟦ j ⟧) tt*
≡[ i ]⟨ (μ .N-hom f i) tt* ⟩
(K ⟪ f ⟫) ((μ ⟦ i ⟧) tt*)
∎
-- Given another cone α, we want a unique function f from α → cone' which factors it
-- factorization property enforces that (cone' ⟦ j ⟧ ● f) ≡ α ⟦ j ⟧
-- but cone' ⟦ j ⟧ simply takes the jth component the output Cone K Unit from f
-- so this enforces that for all x ∈ A, (f x) ⟦ j ⟧ ≡ α ⟦ j ⟧ x
-- this determines the *only* possible factoring morphism
up' : ∀ {A} (α : Cone K A) → cone' uniquelyFactors α
up' {A} α = (f , fact) , unique
where
f : fst A → Cone K (Unit* , isOfHLevelLift 2 isSetUnit)
f x = natTrans (λ j _ → α .N-ob j x)
(λ {m} {n} f → funExt λ μ i → α .N-hom f i x)
fact : α ≡ (f ◼ cone')
fact = makeNatTransPath refl -- I LOVE DEFINITIONAL EQUALITY
unique : (τ : cone' factors α) → (f , fact) ≡ τ
unique (f' , fact') = ΣPathP (f≡f' , fact≡fact')
where
f≡f' : f ≡ f'
f≡f' = funExt λ x → makeNatTransPath (funExt λ _ → sym eq2)
where
-- the factorization property enforces that f' must have the same behavior as f
eq1 : ∀ {x j} → ((cone' ⟦ j ⟧) (f' x)) ≡ (α ⟦ j ⟧) x
eq1 {x} {j} i = ((fact' (~ i)) ⟦ j ⟧) x
eq2 : ∀ {x j} → (f' x) ⟦ j ⟧ ≡ λ _ → (α ⟦ j ⟧) x -- = (f x) ⟦ j ⟧
eq2 {x} {j} = funExt λ _ → eq1
-- follows from Set having homsets
fact≡fact' : PathP (λ i → α ≡ ((f≡f' i) ◼ cone')) fact fact'
fact≡fact' = isOfHLevel→isOfHLevelDep 1 (λ β → isSetNat α β) fact fact' λ i → (f≡f' i) ◼ cone'
| {
"alphanum_fraction": 0.5537014024,
"avg_line_length": 34.9875776398,
"ext": "agda",
"hexsha": "8d185082a5c6145822c4d2ad5c3491859ada6026",
"lang": "Agda",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "63c770b381039c0132c17d7913f4566b35984701",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "mzeuner/cubical",
"max_forks_repo_path": "Cubical/Categories/Limits/Base.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "63c770b381039c0132c17d7913f4566b35984701",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "mzeuner/cubical",
"max_issues_repo_path": "Cubical/Categories/Limits/Base.agda",
"max_line_length": 108,
"max_stars_count": null,
"max_stars_repo_head_hexsha": "63c770b381039c0132c17d7913f4566b35984701",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "mzeuner/cubical",
"max_stars_repo_path": "Cubical/Categories/Limits/Base.agda",
"max_stars_repo_stars_event_max_datetime": null,
"max_stars_repo_stars_event_min_datetime": null,
"num_tokens": 2099,
"size": 5633
} |
{-# OPTIONS --cubical --safe --no-import-sorts #-}
module Cubical.Data.Fin.Recursive.Base where
open import Cubical.Foundations.Prelude
open import Cubical.Data.Empty as Empty hiding (rec; elim)
open import Cubical.Data.Nat hiding (elim)
data FinF (X : Type₀) : Type₀ where
zero : FinF X
suc : X → FinF X
Fin : ℕ → Type₀
Fin zero = ⊥
Fin (suc k) = FinF (Fin k)
private
variable
ℓ : Level
k : ℕ
R : Type ℓ
rec : R → (R → R) → Fin k → R
rec {k = suc k} z _ zero = z
rec {k = suc k} z s (suc x) = s (rec z s x)
elim
: ∀(P : ∀{k} → Fin k → Type ℓ)
→ (∀{k} → P {suc k} zero)
→ (∀{k} (fn : Fin k) → P fn → P {suc k} (suc fn))
→ (fn : Fin k) → P fn
elim {k = suc k} P fz fs zero = fz
elim {k = suc k} P fz fs (suc x) = fs x (elim P fz fs x)
| {
"alphanum_fraction": 0.5703125,
"avg_line_length": 21.9428571429,
"ext": "agda",
"hexsha": "042c0c105f6cbd4342f7f1c55ac0b98e602b28ef",
"lang": "Agda",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "fd8059ec3eed03f8280b4233753d00ad123ffce8",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "dan-iel-lee/cubical",
"max_forks_repo_path": "Cubical/Data/Fin/Recursive/Base.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "fd8059ec3eed03f8280b4233753d00ad123ffce8",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "dan-iel-lee/cubical",
"max_issues_repo_path": "Cubical/Data/Fin/Recursive/Base.agda",
"max_line_length": 58,
"max_stars_count": null,
"max_stars_repo_head_hexsha": "fd8059ec3eed03f8280b4233753d00ad123ffce8",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "dan-iel-lee/cubical",
"max_stars_repo_path": "Cubical/Data/Fin/Recursive/Base.agda",
"max_stars_repo_stars_event_max_datetime": null,
"max_stars_repo_stars_event_min_datetime": null,
"num_tokens": 304,
"size": 768
} |
{-# OPTIONS --cubical --safe #-}
module Cubical.Data.Bool where
open import Cubical.Data.Bool.Base public
open import Cubical.Data.Bool.Properties public
| {
"alphanum_fraction": 0.7692307692,
"avg_line_length": 22.2857142857,
"ext": "agda",
"hexsha": "6918841aea0fd55a5e26fce3b6173d868fb5fc2f",
"lang": "Agda",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "df4ef7edffd1c1deb3d4ff342c7178e9901c44f1",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "limemloh/cubical",
"max_forks_repo_path": "Cubical/Data/Bool.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "df4ef7edffd1c1deb3d4ff342c7178e9901c44f1",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "limemloh/cubical",
"max_issues_repo_path": "Cubical/Data/Bool.agda",
"max_line_length": 47,
"max_stars_count": 1,
"max_stars_repo_head_hexsha": "df4ef7edffd1c1deb3d4ff342c7178e9901c44f1",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "limemloh/cubical",
"max_stars_repo_path": "Cubical/Data/Bool.agda",
"max_stars_repo_stars_event_max_datetime": "2020-03-23T23:52:11.000Z",
"max_stars_repo_stars_event_min_datetime": "2020-03-23T23:52:11.000Z",
"num_tokens": 34,
"size": 156
} |
------------------------------------------------------------------------
-- The Agda standard library
--
-- Propositional (intensional) equality
------------------------------------------------------------------------
{-# OPTIONS --without-K --safe #-}
module Relation.Binary.PropositionalEquality where
import Axiom.Extensionality.Propositional as Ext
open import Axiom.UniquenessOfIdentityProofs
open import Function
open import Function.Equality using (Π; _⟶_; ≡-setoid)
open import Level
open import Data.Empty
open import Data.Product
open import Relation.Nullary using (yes ; no)
open import Relation.Unary using (Pred)
open import Relation.Binary
open import Relation.Binary.Indexed.Heterogeneous
using (IndexedSetoid)
import Relation.Binary.Indexed.Heterogeneous.Construct.Trivial
as Trivial
------------------------------------------------------------------------
-- Re-export contents of core module
open import Relation.Binary.PropositionalEquality.Core public
------------------------------------------------------------------------
-- Some properties
subst₂ : ∀ {a b p} {A : Set a} {B : Set b} (P : A → B → Set p)
{x₁ x₂ y₁ y₂} → x₁ ≡ x₂ → y₁ ≡ y₂ → P x₁ y₁ → P x₂ y₂
subst₂ P refl refl p = p
cong-app : ∀ {a b} {A : Set a} {B : A → Set b} {f g : (x : A) → B x} →
f ≡ g → (x : A) → f x ≡ g x
cong-app refl x = refl
cong₂ : ∀ {a b c} {A : Set a} {B : Set b} {C : Set c}
(f : A → B → C) {x y u v} → x ≡ y → u ≡ v → f x u ≡ f y v
cong₂ f refl refl = refl
setoid : ∀ {a} → Set a → Setoid _ _
setoid A = record
{ Carrier = A
; _≈_ = _≡_
; isEquivalence = isEquivalence
}
decSetoid : ∀ {a} {A : Set a} → Decidable {A = A} _≡_ → DecSetoid _ _
decSetoid dec = record
{ _≈_ = _≡_
; isDecEquivalence = record
{ isEquivalence = isEquivalence
; _≟_ = dec
}
}
isPreorder : ∀ {a} {A : Set a} → IsPreorder {A = A} _≡_ _≡_
isPreorder = record
{ isEquivalence = isEquivalence
; reflexive = id
; trans = trans
}
preorder : ∀ {a} → Set a → Preorder _ _ _
preorder A = record
{ Carrier = A
; _≈_ = _≡_
; _∼_ = _≡_
; isPreorder = isPreorder
}
------------------------------------------------------------------------
-- Pointwise equality
infix 4 _≗_
_→-setoid_ : ∀ {a b} (A : Set a) (B : Set b) → Setoid _ _
A →-setoid B = ≡-setoid A (Trivial.indexedSetoid (setoid B))
_≗_ : ∀ {a b} {A : Set a} {B : Set b} (f g : A → B) → Set _
_≗_ {A = A} {B} = Setoid._≈_ (A →-setoid B)
:→-to-Π : ∀ {a b₁ b₂} {A : Set a} {B : IndexedSetoid _ b₁ b₂} →
((x : A) → IndexedSetoid.Carrier B x) → Π (setoid A) B
:→-to-Π {B = B} f = record { _⟨$⟩_ = f; cong = cong′ }
where
open IndexedSetoid B using (_≈_)
cong′ : ∀ {x y} → x ≡ y → f x ≈ f y
cong′ refl = IndexedSetoid.refl B
→-to-⟶ : ∀ {a b₁ b₂} {A : Set a} {B : Setoid b₁ b₂} →
(A → Setoid.Carrier B) → setoid A ⟶ B
→-to-⟶ = :→-to-Π
------------------------------------------------------------------------
-- Inspect
-- Inspect can be used when you want to pattern match on the result r
-- of some expression e, and you also need to "remember" that r ≡ e.
record Reveal_·_is_ {a b} {A : Set a} {B : A → Set b}
(f : (x : A) → B x) (x : A) (y : B x) :
Set (a ⊔ b) where
constructor [_]
field eq : f x ≡ y
inspect : ∀ {a b} {A : Set a} {B : A → Set b}
(f : (x : A) → B x) (x : A) → Reveal f · x is f x
inspect f x = [ refl ]
-- Example usage:
-- f x y with g x | inspect g x
-- f x y | c z | [ eq ] = ...
------------------------------------------------------------------------
-- Propositionality
isPropositional : ∀ {a} → Set a → Set a
isPropositional A = (a b : A) → a ≡ b
------------------------------------------------------------------------
-- Various equality rearrangement lemmas
module _ {a} {A : Set a} {x y : A} where
trans-injectiveˡ : ∀ {z} {p₁ p₂ : x ≡ y} (q : y ≡ z) →
trans p₁ q ≡ trans p₂ q → p₁ ≡ p₂
trans-injectiveˡ refl = subst₂ _≡_ (trans-reflʳ _) (trans-reflʳ _)
trans-injectiveʳ : ∀ {z} (p : x ≡ y) {q₁ q₂ : y ≡ z} →
trans p q₁ ≡ trans p q₂ → q₁ ≡ q₂
trans-injectiveʳ refl eq = eq
cong-id :
∀ {a} {A : Set a} {x y : A} (p : x ≡ y) →
cong id p ≡ p
cong-id refl = refl
cong-∘ :
∀ {a b c} {A : Set a} {B : Set b} {C : Set c} {x y : A}
{f : B → C} {g : A → B}
(p : x ≡ y) →
cong (f ∘ g) p ≡ cong f (cong g p)
cong-∘ refl = refl
module _ {a p} {A : Set a} {P : A → Set p} {x y : A} where
subst-injective : ∀ (x≡y : x ≡ y) {p q : P x} →
subst P x≡y p ≡ subst P x≡y q → p ≡ q
subst-injective refl p≡q = p≡q
subst-subst : ∀ {z} (x≡y : x ≡ y) {y≡z : y ≡ z} {p : P x} →
subst P y≡z (subst P x≡y p) ≡ subst P (trans x≡y y≡z) p
subst-subst refl = refl
subst-subst-sym : (x≡y : x ≡ y) {p : P y} →
subst P x≡y (subst P (sym x≡y) p) ≡ p
subst-subst-sym refl = refl
subst-sym-subst : (x≡y : x ≡ y) {p : P x} →
subst P (sym x≡y) (subst P x≡y p) ≡ p
subst-sym-subst refl = refl
subst-∘ :
∀ {a b p} {A : Set a} {B : Set b} {x y : A} {P : B → Set p}
{f : A → B}
(x≡y : x ≡ y) {p : P (f x)} →
subst (P ∘ f) x≡y p ≡ subst P (cong f x≡y) p
subst-∘ refl = refl
subst-application :
∀ {a₁ a₂ b₁ b₂} {A₁ : Set a₁} {A₂ : Set a₂}
(B₁ : A₁ → Set b₁) {B₂ : A₂ → Set b₂}
{f : A₂ → A₁} {x₁ x₂ : A₂} {y : B₁ (f x₁)}
(g : ∀ x → B₁ (f x) → B₂ x) (eq : x₁ ≡ x₂) →
subst B₂ eq (g x₁ y) ≡ g x₂ (subst B₁ (cong f eq) y)
subst-application _ _ refl = refl
-- A lemma that is very similar to Lemma 2.4.3 from the HoTT book.
naturality :
∀ {a b} {A : Set a} {B : Set b} {x y} {x≡y : x ≡ y} {f g : A → B}
(f≡g : ∀ x → f x ≡ g x) →
trans (cong f x≡y) (f≡g y) ≡ trans (f≡g x) (cong g x≡y)
naturality {x = x} {x≡y = refl} f≡g =
f≡g x ≡⟨ sym (trans-reflʳ _) ⟩
trans (f≡g x) refl ∎
where
open ≡-Reasoning
-- A lemma that is very similar to Corollary 2.4.4 from the HoTT book.
cong-≡id :
∀ {a} {A : Set a} {f : A → A} {x : A}
(f≡id : ∀ x → f x ≡ x) →
cong f (f≡id x) ≡ f≡id (f x)
cong-≡id {f = f} {x} f≡id =
cong f (f≡id x) ≡⟨ sym (trans-reflʳ _) ⟩
trans (cong f (f≡id x)) refl ≡⟨ cong (trans _) (sym (trans-symʳ (f≡id x))) ⟩
trans (cong f (f≡id x)) (trans (f≡id x) (sym (f≡id x))) ≡⟨ sym (trans-assoc (cong f (f≡id x))) ⟩
trans (trans (cong f (f≡id x)) (f≡id x)) (sym (f≡id x)) ≡⟨ cong (λ p → trans p (sym _)) (naturality f≡id) ⟩
trans (trans (f≡id (f x)) (cong id (f≡id x))) (sym (f≡id x)) ≡⟨ cong (λ p → trans (trans (f≡id (f x)) p) (sym (f≡id x))) (cong-id _) ⟩
trans (trans (f≡id (f x)) (f≡id x)) (sym (f≡id x)) ≡⟨ trans-assoc (f≡id (f x)) ⟩
trans (f≡id (f x)) (trans (f≡id x) (sym (f≡id x))) ≡⟨ cong (trans _) (trans-symʳ (f≡id x)) ⟩
trans (f≡id (f x)) refl ≡⟨ trans-reflʳ _ ⟩
f≡id (f x) ∎
where
open ≡-Reasoning
module _ {a} {A : Set a} (_≟_ : Decidable (_≡_ {A = A})) {a : A} where
≡-≟-identity : ∀ {b} (eq : a ≡ b) → a ≟ b ≡ yes eq
≡-≟-identity {b} eq with a ≟ b
... | yes p = cong yes (Decidable⇒UIP.≡-irrelevant _≟_ p eq)
... | no ¬p = ⊥-elim (¬p eq)
≢-≟-identity : ∀ {b} → a ≢ b → ∃ λ ¬eq → a ≟ b ≡ no ¬eq
≢-≟-identity {b} ¬eq with a ≟ b
... | yes p = ⊥-elim (¬eq p)
... | no ¬p = ¬p , refl
------------------------------------------------------------------------
-- DEPRECATED NAMES
------------------------------------------------------------------------
-- Please use the new names as continuing support for the old names is
-- not guaranteed.
-- Version 1.0
Extensionality = Ext.Extensionality
{-# WARNING_ON_USAGE Extensionality
"Warning: Extensionality was deprecated in v1.0.
Please use Extensionality from `Axiom.Extensionality.Propositional` instead."
#-}
extensionality-for-lower-levels = Ext.lower-extensionality
{-# WARNING_ON_USAGE extensionality-for-lower-levels
"Warning: extensionality-for-lower-levels was deprecated in v1.0.
Please use lower-extensionality from `Axiom.Extensionality.Propositional` instead."
#-}
∀-extensionality = Ext.∀-extensionality
{-# WARNING_ON_USAGE ∀-extensionality
"Warning: ∀-extensionality was deprecated in v1.0.
Please use ∀-extensionality from `Axiom.Extensionality.Propositional` instead."
#-}
| {
"alphanum_fraction": 0.4928241015,
"avg_line_length": 33.1929133858,
"ext": "agda",
"hexsha": "c8af2e363949144075df554401be52895193de19",
"lang": "Agda",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "0debb886eb5dbcd38dbeebd04b34cf9d9c5e0e71",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "omega12345/agda-mode",
"max_forks_repo_path": "test/asset/agda-stdlib-1.0/Relation/Binary/PropositionalEquality.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "0debb886eb5dbcd38dbeebd04b34cf9d9c5e0e71",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "omega12345/agda-mode",
"max_issues_repo_path": "test/asset/agda-stdlib-1.0/Relation/Binary/PropositionalEquality.agda",
"max_line_length": 137,
"max_stars_count": null,
"max_stars_repo_head_hexsha": "0debb886eb5dbcd38dbeebd04b34cf9d9c5e0e71",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "omega12345/agda-mode",
"max_stars_repo_path": "test/asset/agda-stdlib-1.0/Relation/Binary/PropositionalEquality.agda",
"max_stars_repo_stars_event_max_datetime": null,
"max_stars_repo_stars_event_min_datetime": null,
"num_tokens": 3222,
"size": 8431
} |
{-# OPTIONS --without-K --safe #-}
open import Definition.Typed.EqualityRelation
module Definition.LogicalRelation.Substitution.Introductions.SingleSubst {{eqrel : EqRelSet}} where
open EqRelSet {{...}}
open import Definition.Untyped
open import Definition.Untyped.Properties
open import Definition.Typed
open import Definition.Typed.Weakening using (id)
open import Definition.Typed.Properties
open import Definition.LogicalRelation
open import Definition.LogicalRelation.ShapeView
open import Definition.LogicalRelation.Irrelevance
open import Definition.LogicalRelation.Properties
open import Definition.LogicalRelation.Substitution
open import Definition.LogicalRelation.Substitution.Properties
open import Definition.LogicalRelation.Substitution.Conversion
open import Definition.LogicalRelation.Substitution.Weakening
open import Tools.Embedding
open import Tools.Product
import Tools.PropositionalEquality as PE
-- Validity of substitution of single variable in types.
substS : ∀ {F G t Γ l} ([Γ] : ⊩ᵛ Γ)
([F] : Γ ⊩ᵛ⟨ l ⟩ F / [Γ])
([G] : Γ ∙ F ⊩ᵛ⟨ l ⟩ G / ([Γ] ∙″ [F]))
([t] : Γ ⊩ᵛ⟨ l ⟩ t ∷ F / [Γ] / [F])
→ Γ ⊩ᵛ⟨ l ⟩ G [ t ] / [Γ]
substS {F} {G} {t} [Γ] [F] [G] [t] {σ = σ} ⊢Δ [σ] =
let Geq = substConsId G
G[t] = proj₁ ([G] ⊢Δ ([σ] , (proj₁ ([t] ⊢Δ [σ]))))
G[t]′ = irrelevance′ Geq G[t]
in G[t]′
, (λ {σ′} [σ′] [σ≡σ′] →
irrelevanceEq″ Geq
(substConsId G)
G[t] G[t]′
(proj₂ ([G] ⊢Δ
([σ] , proj₁ ([t] ⊢Δ [σ])))
([σ′] , proj₁ ([t] ⊢Δ [σ′]))
(([σ≡σ′] , (proj₂ ([t] ⊢Δ [σ]) [σ′] [σ≡σ′])))))
-- Validity of substitution of single variable in type equality.
substSEq : ∀ {F F′ G G′ t t′ Γ l} ([Γ] : ⊩ᵛ Γ)
([F] : Γ ⊩ᵛ⟨ l ⟩ F / [Γ])
([F′] : Γ ⊩ᵛ⟨ l ⟩ F′ / [Γ])
([F≡F′] : Γ ⊩ᵛ⟨ l ⟩ F ≡ F′ / [Γ] / [F])
([G] : Γ ∙ F ⊩ᵛ⟨ l ⟩ G / ([Γ] ∙″ [F]))
([G′] : Γ ∙ F′ ⊩ᵛ⟨ l ⟩ G′ / ([Γ] ∙″ [F′]))
([G≡G′] : Γ ∙ F ⊩ᵛ⟨ l ⟩ G ≡ G′ / [Γ] ∙″ [F] / [G])
([t] : Γ ⊩ᵛ⟨ l ⟩ t ∷ F / [Γ] / [F])
([t′] : Γ ⊩ᵛ⟨ l ⟩ t′ ∷ F′ / [Γ] / [F′])
([t≡t′] : Γ ⊩ᵛ⟨ l ⟩ t ≡ t′ ∷ F / [Γ] / [F])
→ Γ ⊩ᵛ⟨ l ⟩ G [ t ] ≡ G′ [ t′ ] / [Γ]
/ substS {F} {G} {t} [Γ] [F] [G] [t]
substSEq {F} {F′} {G} {G′} {t} {t′}
[Γ] [F] [F′] [F≡F′] [G] [G′] [G≡G′] [t] [t′] [t≡t′] {σ = σ} ⊢Δ [σ] =
let Geq = substConsId G
G′eq = substConsId G′
G[t] = (proj₁ ([G] ⊢Δ ([σ] , (proj₁ ([t] ⊢Δ [σ])))))
G[t]′ = irrelevance′ Geq G[t]
[t]′ = convᵛ {t} {F} {F′} [Γ] [F] [F′] [F≡F′] [t]
G′[t] = (proj₁ ([G′] ⊢Δ ([σ] , proj₁ ([t]′ ⊢Δ [σ]))))
G[t]≡G′[t] = irrelevanceEq′ Geq G[t] G[t]′
([G≡G′] ⊢Δ ([σ] , proj₁ ([t] ⊢Δ [σ])))
G′[t]≡G′[t′] = irrelevanceEq″ PE.refl G′eq G′[t] G′[t]
(proj₂ ([G′] ⊢Δ ([σ] , proj₁ ([t]′ ⊢Δ [σ])))
([σ] , proj₁ ([t′] ⊢Δ [σ]))
(reflSubst [Γ] ⊢Δ [σ] ,
convEqᵛ {t} {t′} {F} {F′}
[Γ] [F] [F′] [F≡F′] [t≡t′] ⊢Δ [σ]))
G′[t′] = (proj₁ ([G′] ⊢Δ ([σ] , proj₁ ([t′] ⊢Δ [σ]))))
G′[t′]′ = irrelevance′ G′eq G′[t′]
in transEq G[t]′ G′[t] G′[t′]′ G[t]≡G′[t] G′[t]≡G′[t′]
-- Validity of substitution of single variable in terms.
substSTerm : ∀ {F G t f Γ l} ([Γ] : ⊩ᵛ Γ)
([F] : Γ ⊩ᵛ⟨ l ⟩ F / [Γ])
([G] : Γ ∙ F ⊩ᵛ⟨ l ⟩ G / ([Γ] ∙″ [F]))
([f] : Γ ∙ F ⊩ᵛ⟨ l ⟩ f ∷ G / ([Γ] ∙″ [F]) / [G])
([t] : Γ ⊩ᵛ⟨ l ⟩ t ∷ F / [Γ] / [F])
→ Γ ⊩ᵛ⟨ l ⟩ f [ t ] ∷ G [ t ] / [Γ]
/ substS {F} {G} {t} [Γ] [F] [G] [t]
substSTerm {F} {G} {t} {f} [Γ] [F] [G] [f] [t] {σ = σ} ⊢Δ [σ] =
let prfG = substConsId G
prff = substConsId f
G[t] = proj₁ ([G] ⊢Δ ([σ] , proj₁ ([t] ⊢Δ [σ])))
G[t]′ = irrelevance′ prfG G[t]
f[t] = proj₁ ([f] ⊢Δ ([σ] , proj₁ ([t] ⊢Δ [σ])))
f[t]′ = irrelevanceTerm″ prfG prff G[t] G[t]′ f[t]
in f[t]′
, (λ {σ′} [σ′] [σ≡σ′] →
irrelevanceEqTerm″
prff
(substConsId f)
prfG G[t] G[t]′
(proj₂ ([f] ⊢Δ ([σ] , proj₁ ([t] ⊢Δ [σ])))
([σ′] , proj₁ ([t] ⊢Δ [σ′]))
([σ≡σ′] , proj₂ ([t] ⊢Δ [σ]) [σ′] [σ≡σ′])))
-- Validity of substitution of single lifted variable in types.
subst↑S : ∀ {F G t Γ l} ([Γ] : ⊩ᵛ Γ)
([F] : Γ ⊩ᵛ⟨ l ⟩ F / [Γ])
([G] : Γ ∙ F ⊩ᵛ⟨ l ⟩ G / ([Γ] ∙″ [F]))
([t] : Γ ∙ F ⊩ᵛ⟨ l ⟩ t ∷ wk1 F / ([Γ] ∙″ [F])
/ wk1ᵛ {F} {F} [Γ] [F] [F])
→ Γ ∙ F ⊩ᵛ⟨ l ⟩ G [ t ]↑ / ([Γ] ∙″ [F])
subst↑S {F} {G} {t} [Γ] [F] [G] [t] {σ = σ} ⊢Δ [σ] =
let [wk1F] = wk1ᵛ {F} {F} [Γ] [F] [F]
[σwk1F] = proj₁ ([wk1F] {σ = σ} ⊢Δ [σ])
[σwk1F]′ = proj₁ ([F] {σ = tail σ} ⊢Δ (proj₁ [σ]))
[t]′ = irrelevanceTerm′ (subst-wk F) [σwk1F] [σwk1F]′ (proj₁ ([t] ⊢Δ [σ]))
G[t] = proj₁ ([G] {σ = consSubst (tail σ) (subst σ t)} ⊢Δ
(proj₁ [σ] , [t]′))
G[t]′ = irrelevance′ (substConsTailId {G} {t} {σ}) G[t]
in G[t]′
, (λ {σ′} [σ′] [σ≡σ′] →
let [σ′t] = irrelevanceTerm′ (subst-wk F)
(proj₁ ([wk1F] {σ = σ′} ⊢Δ [σ′]))
(proj₁ ([F] ⊢Δ (proj₁ [σ′])))
(proj₁ ([t] ⊢Δ [σ′]))
[σt≡σ′t] = irrelevanceEqTerm′ (subst-wk F) [σwk1F] [σwk1F]′
(proj₂ ([t] ⊢Δ [σ]) [σ′] [σ≡σ′])
[σG[t]≡σ′G[t]] = proj₂ ([G] ⊢Δ (proj₁ [σ] , [t]′))
(proj₁ [σ′] , [σ′t])
(proj₁ [σ≡σ′] , [σt≡σ′t])
in irrelevanceEq″ (substConsTailId {G} {t} {σ}) (substConsTailId {G} {t} {σ′})
G[t] G[t]′ [σG[t]≡σ′G[t]])
-- Validity of substitution of single lifted variable in type equality.
subst↑SEq : ∀ {F G G′ t t′ Γ l} ([Γ] : ⊩ᵛ Γ)
([F] : Γ ⊩ᵛ⟨ l ⟩ F / [Γ])
([G] : Γ ∙ F ⊩ᵛ⟨ l ⟩ G / ([Γ] ∙″ [F]))
([G′] : Γ ∙ F ⊩ᵛ⟨ l ⟩ G′ / ([Γ] ∙″ [F]))
([G≡G′] : Γ ∙ F ⊩ᵛ⟨ l ⟩ G ≡ G′ / [Γ] ∙″ [F] / [G])
([t] : Γ ∙ F ⊩ᵛ⟨ l ⟩ t ∷ wk1 F / [Γ] ∙″ [F]
/ wk1ᵛ {F} {F} [Γ] [F] [F])
([t′] : Γ ∙ F ⊩ᵛ⟨ l ⟩ t′ ∷ wk1 F / [Γ] ∙″ [F]
/ wk1ᵛ {F} {F} [Γ] [F] [F])
([t≡t′] : Γ ∙ F ⊩ᵛ⟨ l ⟩ t ≡ t′ ∷ wk1 F / [Γ] ∙″ [F]
/ wk1ᵛ {F} {F} [Γ] [F] [F])
→ Γ ∙ F ⊩ᵛ⟨ l ⟩ G [ t ]↑ ≡ G′ [ t′ ]↑ / [Γ] ∙″ [F]
/ subst↑S {F} {G} {t} [Γ] [F] [G] [t]
subst↑SEq {F} {G} {G′} {t} {t′}
[Γ] [F] [G] [G′] [G≡G′] [t] [t′] [t≡t′] {σ = σ} ⊢Δ [σ] =
let [wk1F] = wk1ᵛ {F} {F} [Γ] [F] [F]
[σwk1F] = proj₁ ([wk1F] {σ = σ} ⊢Δ [σ])
[σwk1F]′ = proj₁ ([F] {σ = tail σ} ⊢Δ (proj₁ [σ]))
[t]′ = irrelevanceTerm′ (subst-wk F) [σwk1F] [σwk1F]′ (proj₁ ([t] ⊢Δ [σ]))
[t′]′ = irrelevanceTerm′ (subst-wk F) [σwk1F] [σwk1F]′ (proj₁ ([t′] ⊢Δ [σ]))
[t≡t′]′ = irrelevanceEqTerm′ (subst-wk F) [σwk1F] [σwk1F]′ ([t≡t′] ⊢Δ [σ])
G[t] = proj₁ ([G] ⊢Δ (proj₁ [σ] , [t]′))
G[t]′ = irrelevance′ (substConsTailId {G} {t} {σ}) G[t]
G′[t] = proj₁ ([G′] ⊢Δ (proj₁ [σ] , [t]′))
G′[t]′ = irrelevance′ (substConsTailId {G′} {t} {σ}) G′[t]
G′[t′] = proj₁ ([G′] ⊢Δ (proj₁ [σ] , [t′]′))
G′[t′]′ = irrelevance′ (substConsTailId {G′} {t′} {σ}) G′[t′]
G[t]≡G′[t] = irrelevanceEq″ (substConsTailId {G} {t} {σ}) (substConsTailId {G′} {t} {σ})
G[t] G[t]′ ([G≡G′] ⊢Δ (proj₁ [σ] , [t]′))
G′[t]≡G′[t′] = irrelevanceEq″ (substConsTailId {G′} {t} {σ})
(substConsTailId {G′} {t′} {σ})
G′[t] G′[t]′
(proj₂ ([G′] ⊢Δ (proj₁ [σ] , [t]′))
(proj₁ [σ] , [t′]′)
(reflSubst [Γ] ⊢Δ (proj₁ [σ]) , [t≡t′]′))
in transEq G[t]′ G′[t]′ G′[t′]′ G[t]≡G′[t] G′[t]≡G′[t′]
-- Helper function for reducible substitution of Π-types with specific typing derivations.
substSΠ₁′ : ∀ {F G t Γ l l′}
([ΠFG] : Γ ⊩⟨ l ⟩Π Π F ▹ G)
([F] : Γ ⊩⟨ l′ ⟩ F)
([t] : Γ ⊩⟨ l′ ⟩ t ∷ F / [F])
→ Γ ⊩⟨ l ⟩ G [ t ]
substSΠ₁′ {t = t} (noemb (Πᵣ F G D ⊢F ⊢G A≡A [F] [G] G-ext)) [F]₁ [t] =
let F≡F′ , G≡G′ = Π-PE-injectivity (whnfRed* (red D) Πₙ)
Feq = PE.trans F≡F′ (PE.sym (wk-id _))
Geq = PE.cong (λ x → x [ _ ]) (PE.trans (wk-lift-id _) (PE.sym G≡G′))
⊢Γ = wf (escape [F]₁)
[t]′ = irrelevanceTerm′ Feq [F]₁ ([F] id ⊢Γ) [t]
in irrelevance′ Geq ([G] id ⊢Γ [t]′)
substSΠ₁′ (emb 0<1 x) [F]₁ [t] = emb′ 0<1 (substSΠ₁′ x [F]₁ [t])
-- Reducible substitution of Π-types.
substSΠ₁ : ∀ {F G t Γ l l′}
([ΠFG] : Γ ⊩⟨ l ⟩ Π F ▹ G)
([F] : Γ ⊩⟨ l′ ⟩ F)
([t] : Γ ⊩⟨ l′ ⟩ t ∷ F / [F])
→ Γ ⊩⟨ l ⟩ G [ t ]
substSΠ₁ [ΠFG] [F] [t] = substSΠ₁′ (Π-elim [ΠFG]) [F] [t]
-- Helper function for reducible substitution of Π-congurence with specific typing derivations.
substSΠ₂′ : ∀ {F F′ G G′ t t′ Γ l l′ l″ l‴}
([ΠFG] : Γ ⊩⟨ l ⟩Π Π F ▹ G)
([ΠFG≡ΠF′G′] : Γ ⊩⟨ l ⟩ Π F ▹ G ≡ Π F′ ▹ G′ / Π-intr [ΠFG])
([F] : Γ ⊩⟨ l′ ⟩ F)
([F′] : Γ ⊩⟨ l′ ⟩ F′)
([t] : Γ ⊩⟨ l′ ⟩ t ∷ F / [F])
([t′] : Γ ⊩⟨ l′ ⟩ t′ ∷ F′ / [F′])
([t≡t′] : Γ ⊩⟨ l′ ⟩ t ≡ t′ ∷ F / [F])
([G[t]] : Γ ⊩⟨ l″ ⟩ G [ t ])
([G′[t′]] : Γ ⊩⟨ l‴ ⟩ G′ [ t′ ])
→ Γ ⊩⟨ l″ ⟩ G [ t ] ≡ G′ [ t′ ] / [G[t]]
substSΠ₂′ (noemb (Πᵣ F G D ⊢F ⊢G A≡A [F] [G] G-ext))
(Π₌ F″ G″ D′ A≡B [F≡F′] [G≡G′])
[F]₁ [F′] [t] [t′] [t≡t′] [G[t]] [G′[t′]] =
let F≡F′ , G≡G′ = Π-PE-injectivity (whnfRed* (red D) Πₙ)
F′≡F″ , G′≡G″ = Π-PE-injectivity (whnfRed* D′ Πₙ)
Feq = PE.trans F≡F′ (PE.sym (wk-id _))
F′eq = PE.trans F′≡F″ (PE.sym (wk-id _))
Geq = PE.cong (λ x → x [ _ ]) (PE.trans (wk-lift-id _) (PE.sym G≡G′))
Geq′ = PE.cong (λ x → x [ _ ]) (PE.trans G′≡G″ (PE.sym (wk-lift-id _)))
⊢Γ = wf (escape [F]₁)
[t]′ = irrelevanceTerm′ Feq [F]₁ ([F] id ⊢Γ) [t]
[t′]′ = convTerm₂′ F′eq ([F] id ⊢Γ) [F′] ([F≡F′] id ⊢Γ) [t′]
[t≡t′]′ = irrelevanceEqTerm′ Feq [F]₁ ([F] id ⊢Γ) [t≡t′]
[Gt≡Gt′] = G-ext id ⊢Γ [t]′ [t′]′ [t≡t′]′
[Gt′≡G′t′] = [G≡G′] id ⊢Γ [t′]′
in irrelevanceEq′ Geq ([G] id ⊢Γ [t]′) [G[t]]
(transEq′ PE.refl Geq′ ([G] id ⊢Γ [t]′) ([G] id ⊢Γ [t′]′)
[G′[t′]] [Gt≡Gt′] [Gt′≡G′t′])
substSΠ₂′ (emb 0<1 x) (ιx y) = substSΠ₂′ x y
-- Reducible substitution of Π-congurence.
substSΠ₂ : ∀ {F F′ G G′ t t′ Γ l l′ l″ l‴}
([ΠFG] : Γ ⊩⟨ l ⟩ Π F ▹ G)
([ΠFG≡ΠF′G′] : Γ ⊩⟨ l ⟩ Π F ▹ G ≡ Π F′ ▹ G′ / [ΠFG])
([F] : Γ ⊩⟨ l′ ⟩ F)
([F′] : Γ ⊩⟨ l′ ⟩ F′)
([t] : Γ ⊩⟨ l′ ⟩ t ∷ F / [F])
([t′] : Γ ⊩⟨ l′ ⟩ t′ ∷ F′ / [F′])
([t≡t′] : Γ ⊩⟨ l′ ⟩ t ≡ t′ ∷ F / [F])
([G[t]] : Γ ⊩⟨ l″ ⟩ G [ t ])
([G′[t′]] : Γ ⊩⟨ l‴ ⟩ G′ [ t′ ])
→ Γ ⊩⟨ l″ ⟩ G [ t ] ≡ G′ [ t′ ] / [G[t]]
substSΠ₂ [ΠFG] [ΠFG≡ΠF′G′] =
let [ΠFG≡ΠF′G′]′ = irrelevanceEq [ΠFG] (Π-intr (Π-elim [ΠFG])) [ΠFG≡ΠF′G′]
in substSΠ₂′ (Π-elim [ΠFG]) [ΠFG≡ΠF′G′]′
-- Valid substitution of Π-types.
substSΠ : ∀ {F G t Γ l}
([Γ] : ⊩ᵛ Γ)
([F] : Γ ⊩ᵛ⟨ l ⟩ F / [Γ])
([ΠFG] : Γ ⊩ᵛ⟨ l ⟩ Π F ▹ G / [Γ])
([t] : Γ ⊩ᵛ⟨ l ⟩ t ∷ F / [Γ] / [F])
→ Γ ⊩ᵛ⟨ l ⟩ G [ t ] / [Γ]
substSΠ {F} {G} {t} [Γ] [F] [ΠFG] [t] ⊢Δ [σ] =
let [σG[t]] = substSΠ₁ (proj₁ ([ΠFG] ⊢Δ [σ])) (proj₁ ([F] ⊢Δ [σ]))
(proj₁ ([t] ⊢Δ [σ]))
[σG[t]]′ = irrelevance′ (PE.sym (singleSubstLift G t))
[σG[t]]
in [σG[t]]′
, (λ [σ′] [σ≡σ′] →
irrelevanceEq″ (PE.sym (singleSubstLift G t))
(PE.sym (singleSubstLift G t))
[σG[t]] [σG[t]]′
(substSΠ₂ (proj₁ ([ΠFG] ⊢Δ [σ]))
(proj₂ ([ΠFG] ⊢Δ [σ]) [σ′] [σ≡σ′])
(proj₁ ([F] ⊢Δ [σ])) (proj₁ ([F] ⊢Δ [σ′]))
(proj₁ ([t] ⊢Δ [σ])) (proj₁ ([t] ⊢Δ [σ′]))
(proj₂ ([t] ⊢Δ [σ]) [σ′] [σ≡σ′]) [σG[t]]
(substSΠ₁ (proj₁ ([ΠFG] ⊢Δ [σ′]))
(proj₁ ([F] ⊢Δ [σ′]))
(proj₁ ([t] ⊢Δ [σ′])))))
-- Valid substitution of Π-congurence.
substSΠEq : ∀ {F G F′ G′ t u Γ l}
([Γ] : ⊩ᵛ Γ)
([F] : Γ ⊩ᵛ⟨ l ⟩ F / [Γ])
([F′] : Γ ⊩ᵛ⟨ l ⟩ F′ / [Γ])
([ΠFG] : Γ ⊩ᵛ⟨ l ⟩ Π F ▹ G / [Γ])
([ΠF′G′] : Γ ⊩ᵛ⟨ l ⟩ Π F′ ▹ G′ / [Γ])
([ΠFG≡ΠF′G′] : Γ ⊩ᵛ⟨ l ⟩ Π F ▹ G ≡ Π F′ ▹ G′ / [Γ] / [ΠFG])
([t] : Γ ⊩ᵛ⟨ l ⟩ t ∷ F / [Γ] / [F])
([u] : Γ ⊩ᵛ⟨ l ⟩ u ∷ F′ / [Γ] / [F′])
([t≡u] : Γ ⊩ᵛ⟨ l ⟩ t ≡ u ∷ F / [Γ] / [F])
→ Γ ⊩ᵛ⟨ l ⟩ G [ t ] ≡ G′ [ u ] / [Γ]
/ substSΠ {F} {G} {t} [Γ] [F] [ΠFG] [t]
substSΠEq {F} {G} {F′} {G′} {t} {u} [Γ] [F] [F′] [ΠFG] [ΠF′G′] [ΠFG≡ΠF′G′]
[t] [u] [t≡u] {Δ = Δ} {σ = σ} ⊢Δ [σ] =
let [σΠFG] = proj₁ ([ΠFG] ⊢Δ [σ])
Πᵣ F₁ G₁ D₁ ⊢F₁ ⊢G₁ A≡A₁ [F]₁ [G]₁ G-ext₁ = extractMaybeEmbΠ (Π-elim [σΠFG])
F≡F₁ , G≡G₁ = Π-PE-injectivity (whnfRed* (red D₁) Πₙ)
[σΠF′G′] = proj₁ ([ΠF′G′] ⊢Δ [σ])
Πᵣ F₂ G₂ D₂ ⊢F₂ ⊢G₂ A≡A₂ [F]₂ [G]₂ G-ext₂ = extractMaybeEmbΠ (Π-elim [σΠF′G′])
F′≡F₂ , G′≡G₂ = Π-PE-injectivity (whnfRed* (red D₂) Πₙ)
[σF] = proj₁ ([F] ⊢Δ [σ])
[σF′] = proj₁ ([F′] ⊢Δ [σ])
[σt] = proj₁ ([t] ⊢Δ [σ])
[σu] = proj₁ ([u] ⊢Δ [σ])
[σt]′ = irrelevanceTerm′ (PE.trans F≡F₁ (PE.sym (wk-id F₁)))
[σF] ([F]₁ id ⊢Δ) [σt]
[σu]′ = irrelevanceTerm′ (PE.trans F′≡F₂ (PE.sym (wk-id F₂)))
[σF′] ([F]₂ id ⊢Δ) [σu]
[σt≡σu] = [t≡u] ⊢Δ [σ]
[G[t]] = irrelevance′ (PE.cong (λ x → x [ subst σ t ])
(PE.trans (wk-lift-id G₁) (PE.sym G≡G₁)))
([G]₁ id ⊢Δ [σt]′)
[G′[u]] = irrelevance′ (PE.cong (λ x → x [ subst σ u ])
(PE.trans (wk-lift-id G₂) (PE.sym G′≡G₂)))
([G]₂ id ⊢Δ [σu]′)
in irrelevanceEq″ (PE.sym (singleSubstLift G t))
(PE.sym (singleSubstLift G′ u))
[G[t]]
(proj₁ (substSΠ {F} {G} {t} [Γ] [F] [ΠFG] [t] ⊢Δ [σ]))
(substSΠ₂ {subst σ F} {subst σ F′}
{subst (liftSubst σ) G}
{subst (liftSubst σ) G′}
(proj₁ ([ΠFG] ⊢Δ [σ]))
([ΠFG≡ΠF′G′] ⊢Δ [σ])
[σF] [σF′] [σt] [σu] [σt≡σu] [G[t]] [G′[u]])
| {
"alphanum_fraction": 0.3625466693,
"avg_line_length": 48.4666666667,
"ext": "agda",
"hexsha": "6beba4154540c57c0f369c20720a1fca55237e34",
"lang": "Agda",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "2251b8da423be0c6fb916f2675d7bd8537e4cd96",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "loic-p/logrel-mltt",
"max_forks_repo_path": "Definition/LogicalRelation/Substitution/Introductions/SingleSubst.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "2251b8da423be0c6fb916f2675d7bd8537e4cd96",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "loic-p/logrel-mltt",
"max_issues_repo_path": "Definition/LogicalRelation/Substitution/Introductions/SingleSubst.agda",
"max_line_length": 99,
"max_stars_count": null,
"max_stars_repo_head_hexsha": "2251b8da423be0c6fb916f2675d7bd8537e4cd96",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "loic-p/logrel-mltt",
"max_stars_repo_path": "Definition/LogicalRelation/Substitution/Introductions/SingleSubst.agda",
"max_stars_repo_stars_event_max_datetime": null,
"max_stars_repo_stars_event_min_datetime": null,
"num_tokens": 7333,
"size": 15267
} |
------------------------------------------------------------------------
-- The Agda standard library
--
-- Decidable equality over lists using propositional equality
------------------------------------------------------------------------
{-# OPTIONS --without-K --safe #-}
open import Relation.Binary
open import Relation.Binary.PropositionalEquality
module Data.List.Relation.Binary.Equality.DecPropositional
{a} {A : Set a} (_≟_ : Decidable {A = A} _≡_) where
open import Data.List using (List)
open import Data.List.Properties using (≡-dec)
import Data.List.Relation.Binary.Equality.Propositional as PropositionalEq
import Data.List.Relation.Binary.Equality.DecSetoid as DecSetoidEq
------------------------------------------------------------------------
-- Publically re-export everything from decSetoid and propositional
-- equality
open PropositionalEq public
open DecSetoidEq (decSetoid _≟_) public
using (_≋?_; ≋-isDecEquivalence; ≋-decSetoid)
------------------------------------------------------------------------
-- Additional proofs
_≡?_ : Decidable (_≡_ {A = List A})
_≡?_ = ≡-dec _≟_
| {
"alphanum_fraction": 0.5592459605,
"avg_line_length": 33.7575757576,
"ext": "agda",
"hexsha": "356f35de9dfb571d773b8a82a0a66d778eee87ae",
"lang": "Agda",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "0debb886eb5dbcd38dbeebd04b34cf9d9c5e0e71",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "omega12345/agda-mode",
"max_forks_repo_path": "test/asset/agda-stdlib-1.0/Data/List/Relation/Binary/Equality/DecPropositional.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "0debb886eb5dbcd38dbeebd04b34cf9d9c5e0e71",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "omega12345/agda-mode",
"max_issues_repo_path": "test/asset/agda-stdlib-1.0/Data/List/Relation/Binary/Equality/DecPropositional.agda",
"max_line_length": 74,
"max_stars_count": null,
"max_stars_repo_head_hexsha": "0debb886eb5dbcd38dbeebd04b34cf9d9c5e0e71",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "omega12345/agda-mode",
"max_stars_repo_path": "test/asset/agda-stdlib-1.0/Data/List/Relation/Binary/Equality/DecPropositional.agda",
"max_stars_repo_stars_event_max_datetime": null,
"max_stars_repo_stars_event_min_datetime": null,
"num_tokens": 239,
"size": 1114
} |
module Data.Real.Base where
open import Data.Float renaming (Float to ℝ) public
| {
"alphanum_fraction": 0.7901234568,
"avg_line_length": 20.25,
"ext": "agda",
"hexsha": "de85d33f24bddfe53c57b3d2106def51e4f31a2a",
"lang": "Agda",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "a193aeebf1326f960975b19d3e31b46fddbbfaa2",
"max_forks_repo_licenses": [
"CC0-1.0"
],
"max_forks_repo_name": "cspollard/reals",
"max_forks_repo_path": "src/Data/Real/Base.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "a193aeebf1326f960975b19d3e31b46fddbbfaa2",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"CC0-1.0"
],
"max_issues_repo_name": "cspollard/reals",
"max_issues_repo_path": "src/Data/Real/Base.agda",
"max_line_length": 51,
"max_stars_count": null,
"max_stars_repo_head_hexsha": "a193aeebf1326f960975b19d3e31b46fddbbfaa2",
"max_stars_repo_licenses": [
"CC0-1.0"
],
"max_stars_repo_name": "cspollard/reals",
"max_stars_repo_path": "src/Data/Real/Base.agda",
"max_stars_repo_stars_event_max_datetime": null,
"max_stars_repo_stars_event_min_datetime": null,
"num_tokens": 18,
"size": 81
} |
{-# OPTIONS --cubical --no-import-sorts --safe #-}
module Cubical.Algebra.Semigroup.Morphism where
open import Cubical.Foundations.Prelude
open import Cubical.Foundations.Equiv
open import Cubical.Foundations.Isomorphism
open import Cubical.Functions.Embedding
open import Cubical.Algebra
open import Cubical.Algebra.Magma.Morphism
private
variable
s t : Level
IsSemigroupHom : (S : Semigroup s) (T : Semigroup t) → (⟨ S ⟩ → ⟨ T ⟩) → Type (ℓ-max s t)
IsSemigroupHom S T fun = Homomorphic₂ fun (Semigroup._•_ S) (Semigroup._•_ T)
record SemigroupHom (S : Semigroup s) (T : Semigroup t) : Type (ℓ-max s t) where
constructor semigrouphom
field
fun : ⟨ S ⟩ → ⟨ T ⟩
isHom : IsSemigroupHom S T fun
record SemigroupEquiv (S : Semigroup s) (T : Semigroup t) : Type (ℓ-max s t) where
constructor semigroupequiv
field
eq : ⟨ S ⟩ ≃ ⟨ T ⟩
isHom : IsSemigroupHom S T (equivFun eq)
hom : SemigroupHom S T
hom = record { isHom = isHom }
instance
SemigroupHomOperators : HomOperators (Semigroup s) (Semigroup t) (ℓ-max s t)
SemigroupHomOperators = record { _⟶ᴴ_ = SemigroupHom; _≃ᴴ_ = SemigroupEquiv }
private
variable
S : Semigroup s
T : Semigroup t
SemigroupHom→MagmaHom : (S ⟶ᴴ T) → (Semigroup.magma S ⟶ᴴ Semigroup.magma T)
SemigroupHom→MagmaHom hom .MagmaHom.fun = hom .SemigroupHom.fun
SemigroupHom→MagmaHom hom .MagmaHom.isHom = hom .SemigroupHom.isHom
MagmaHom→SemigroupHom : (Semigroup.magma S ⟶ᴴ Semigroup.magma T) → (S ⟶ᴴ T)
MagmaHom→SemigroupHom hom .SemigroupHom.fun = hom .MagmaHom.fun
MagmaHom→SemigroupHom hom .SemigroupHom.isHom = hom .MagmaHom.isHom
SemigroupHom≃MagmaHom : (S ⟶ᴴ T) ≃ (Semigroup.magma S ⟶ᴴ Semigroup.magma T)
SemigroupHom≃MagmaHom = isoToEquiv (iso SemigroupHom→MagmaHom MagmaHom→SemigroupHom (λ _ → refl) (λ _ → refl))
SemigroupEquiv→MagmaEquiv : S ≃ᴴ T → Semigroup.magma S ≃ᴴ Semigroup.magma T
SemigroupEquiv→MagmaEquiv eq .MagmaEquiv.eq = eq .SemigroupEquiv.eq
SemigroupEquiv→MagmaEquiv eq .MagmaEquiv.isHom = eq .SemigroupEquiv.isHom
MagmaEquiv→SemigroupEquiv : Semigroup.magma S ≃ᴴ Semigroup.magma T → S ≃ᴴ T
MagmaEquiv→SemigroupEquiv eq .SemigroupEquiv.eq = eq .MagmaEquiv.eq
MagmaEquiv→SemigroupEquiv eq .SemigroupEquiv.isHom = eq .MagmaEquiv.isHom
SemigroupEquiv≃MagmaEquiv : (S ≃ᴴ T) ≃ (Semigroup.magma S ≃ᴴ Semigroup.magma T)
SemigroupEquiv≃MagmaEquiv = isoToEquiv (iso SemigroupEquiv→MagmaEquiv MagmaEquiv→SemigroupEquiv (λ _ → refl) (λ _ → refl))
| {
"alphanum_fraction": 0.7393617021,
"avg_line_length": 35.9411764706,
"ext": "agda",
"hexsha": "1c57c0465453855531c5fa9a73bb78818ccd2d0e",
"lang": "Agda",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "737f922d925da0cd9a875cb0c97786179f1f4f61",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "bijan2005/univalent-foundations",
"max_forks_repo_path": "Cubical/Algebra/Semigroup/Morphism.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "737f922d925da0cd9a875cb0c97786179f1f4f61",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "bijan2005/univalent-foundations",
"max_issues_repo_path": "Cubical/Algebra/Semigroup/Morphism.agda",
"max_line_length": 122,
"max_stars_count": null,
"max_stars_repo_head_hexsha": "737f922d925da0cd9a875cb0c97786179f1f4f61",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "bijan2005/univalent-foundations",
"max_stars_repo_path": "Cubical/Algebra/Semigroup/Morphism.agda",
"max_stars_repo_stars_event_max_datetime": null,
"max_stars_repo_stars_event_min_datetime": null,
"num_tokens": 891,
"size": 2444
} |
{-# OPTIONS --without-K #-}
module Ch2-5 where
open import Level hiding (lift)
open import Ch2-1
open import Ch2-2
open import Ch2-3
open import Ch2-4
open import Data.Product
open import Function using (_∘_; id)
-- Example 2.5.1 (equivalence)
Example-2-5-1 : ∀ {a b} {A : Set a} {B : Set b}
→ (a a' : A) (b b' : B)
→ ((a , b) ≡ (a' , b')) ≅ ((a ≡ a') × (b ≡ b'))
Example-2-5-1 {_} {_} {A} {B} a a' b b' = f , f-isequiv
where
f : ∀ {a b a' b'} → (a , b) ≡ (a' , b') → a ≡ a' × b ≡ b'
f {a} {b} {a'} {b'} eq = J (A × B) D d (a , b) (a' , b') eq
where
D : (x y : A × B) → (p : x ≡ y) → Set _
D (a , b) (a' , b') p = a ≡ a' × b ≡ b'
d : (x : A × B) → D x x refl
d x = refl , refl
f-isequiv : isequiv f
f-isequiv = (g , α) , (g , β)
where
g : ∀ {a b a' b'} → a ≡ a' × b ≡ b' → (a , b) ≡ (a' , b')
g {a} {b} {a'} {b'} (fst , snd) = J A D d a a' fst b b' snd
where
D : (a a' : A) → (p : a ≡ a') → Set _
D a a' p = (b b' : B) (q : b ≡ b') → (a , b) ≡ (a' , b')
d : (x : A) → D x x refl
d x b b' q = J B E e b b' q
where
E : (b b' : B) → (q : b ≡ b') → Set _
E b b' q = (x , b) ≡ (x , b')
e : (x : B) → E x x refl
e x = refl
α : f ∘ g ~ id
α (fst , snd) = J A D d a a' fst b b' snd
where
D : (x y : A) (p : x ≡ y) → Set _
D x y p = (x' y' : B) (snd : x' ≡ y')
→ (f ∘ g) (p , snd) ≡ ((p , snd))
d : (x : A) → D x x refl
d x x' y' q = J B E e x' y' q
where
E : (x' y' : B) (q : x' ≡ y') → Set _
E x' y' q = (f ∘ g) (refl , q) ≡ ((refl , q))
e : (x' : B) → E x' x' refl
e x' = refl
β : g ∘ f ~ id
β p = J (A × B) D d (a , b) (a' , b') p
where
D : (x y : A × B) (p : x ≡ y) → Set _
D x y p = (g ∘ f) p ≡ p
d : (x : A × B) → D x x refl
d x = refl
| {
"alphanum_fraction": 0.32415757,
"avg_line_length": 28.8630136986,
"ext": "agda",
"hexsha": "78ca3962cf15d8271685528979aeaa7fad802977",
"lang": "Agda",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "75eea99a879e100304bd48c538c9d2db0b4a4ff3",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "banacorn/hott",
"max_forks_repo_path": "src/Ch2-5.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "75eea99a879e100304bd48c538c9d2db0b4a4ff3",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "banacorn/hott",
"max_issues_repo_path": "src/Ch2-5.agda",
"max_line_length": 68,
"max_stars_count": null,
"max_stars_repo_head_hexsha": "75eea99a879e100304bd48c538c9d2db0b4a4ff3",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "banacorn/hott",
"max_stars_repo_path": "src/Ch2-5.agda",
"max_stars_repo_stars_event_max_datetime": null,
"max_stars_repo_stars_event_min_datetime": null,
"num_tokens": 893,
"size": 2107
} |
{-# OPTIONS --universe-polymorphism #-}
open import Categories.Category
module Categories.Slice {o ℓ e} (C : Category o ℓ e) where
open Category C
open Equiv
open import Level
open import Relation.Binary using (Rel)
record SliceObj (X : Obj) : Set (o ⊔ ℓ) where
constructor sliceobj
field
{Y} : Obj
arr : Y ⇒ X
record Slice⇒ {A : Obj} (X Y : SliceObj A) : Set (ℓ ⊔ e) where
constructor slicearr
module X = SliceObj X
module Y = SliceObj Y
field
{h} : X.Y ⇒ Y.Y
.triangle : Y.arr ∘ h ≡ X.arr
slice : Obj → Category _ _ _
slice x = record
{ Obj = Obj′
; _⇒_ = _⇒′_
; _≡_ = _≡′_
; _∘_ = _∘′_
; id = slicearr identityʳ
; assoc = λ {_} {_} {_} {_} {f} {g} {h} → assoc′ {f = f} {g} {h}
; identityˡ = identityˡ
; identityʳ = identityʳ
; equiv = record
{ refl = refl
; sym = sym
; trans = trans
}
; ∘-resp-≡ = λ {_} {_} {_} {f} {h} {g} {i} → ∘-resp-≡′ {f = f} {h} {g} {i}
}
where
Obj′ = SliceObj x
_⇒′_ : Rel Obj′ _
_⇒′_ = Slice⇒
infixr 9 _∘′_
infix 4 _≡′_
_≡′_ : ∀ {A B} → Rel (A ⇒′ B) _
slicearr {f} _ ≡′ slicearr {g} _ = f ≡ g
_∘′_ : ∀ {A B C} → (B ⇒′ C) → (A ⇒′ B) → (A ⇒′ C)
_∘′_ {sliceobj a⇒x} {sliceobj b⇒x} {sliceobj c⇒x} (slicearr {b⇒c} pf₁) (slicearr {a⇒b} pf₂) = slicearr pf
where
.pf : c⇒x ∘ (b⇒c ∘ a⇒b) ≡ a⇒x
pf = begin
c⇒x ∘ (b⇒c ∘ a⇒b)
↑⟨ assoc ⟩
(c⇒x ∘ b⇒c) ∘ a⇒b
↓⟨ ∘-resp-≡ˡ pf₁ ⟩
b⇒x ∘ a⇒b
↓⟨ pf₂ ⟩
a⇒x
∎
where
open HomReasoning
.assoc′ : ∀ {A B C D} {f : A ⇒′ B} {g : B ⇒′ C} {h : C ⇒′ D}
→ (h ∘′ g) ∘′ f ≡′ h ∘′ (g ∘′ f)
assoc′ = assoc
.∘-resp-≡′ : ∀ {A B C} {f h : B ⇒′ C} {g i : A ⇒′ B}
→ f ≡′ h
→ g ≡′ i
→ f ∘′ g ≡′ h ∘′ i
∘-resp-≡′ f≡h g≡i = ∘-resp-≡ f≡h g≡i
| {
"alphanum_fraction": 0.4537037037,
"avg_line_length": 22.3902439024,
"ext": "agda",
"hexsha": "65764aa8f757493c141fa86699cdfda9c8c2ba8f",
"lang": "Agda",
"max_forks_count": 23,
"max_forks_repo_forks_event_max_datetime": "2021-11-11T13:50:56.000Z",
"max_forks_repo_forks_event_min_datetime": "2015-02-05T13:03:09.000Z",
"max_forks_repo_head_hexsha": "e41aef56324a9f1f8cf3cd30b2db2f73e01066f2",
"max_forks_repo_licenses": [
"BSD-3-Clause"
],
"max_forks_repo_name": "p-pavel/categories",
"max_forks_repo_path": "Categories/Slice.agda",
"max_issues_count": 19,
"max_issues_repo_head_hexsha": "e41aef56324a9f1f8cf3cd30b2db2f73e01066f2",
"max_issues_repo_issues_event_max_datetime": "2019-08-09T16:31:40.000Z",
"max_issues_repo_issues_event_min_datetime": "2015-05-23T06:47:10.000Z",
"max_issues_repo_licenses": [
"BSD-3-Clause"
],
"max_issues_repo_name": "p-pavel/categories",
"max_issues_repo_path": "Categories/Slice.agda",
"max_line_length": 107,
"max_stars_count": 98,
"max_stars_repo_head_hexsha": "36f4181d751e2ecb54db219911d8c69afe8ba892",
"max_stars_repo_licenses": [
"BSD-3-Clause"
],
"max_stars_repo_name": "copumpkin/categories",
"max_stars_repo_path": "Categories/Slice.agda",
"max_stars_repo_stars_event_max_datetime": "2022-03-08T05:20:36.000Z",
"max_stars_repo_stars_event_min_datetime": "2015-04-15T14:57:33.000Z",
"num_tokens": 908,
"size": 1836
} |
module Formalization.LambdaCalculus.Semantics.CallByName where
import Lvl
open import Data
open import Formalization.LambdaCalculus
open import Formalization.LambdaCalculus.Semantics
open import Formalization.LambdaCalculus.SyntaxTransformation
open import Logic.Predicate
open import Numeral.Natural
open import Syntax.Number
open import Type
private variable d db : ℕ
private variable f t x : Term(d)
private variable body : Term(db)
private variable v : ∃(Value)
data _⇓_ : Term(d) → ∃(Value) → Type{0} where
value : ⦃ val : Value(t) ⦄ → (t ⇓ [∃]-intro t)
apply : (f ⇓ [∃]-intro(Abstract body)) → (substituteVar0 x body ⇓ v) → (Apply f x ⇓ v)
| {
"alphanum_fraction": 0.7446808511,
"avg_line_length": 31.3333333333,
"ext": "agda",
"hexsha": "b406154ce87e92a106d2ac3c702d482c005a09c8",
"lang": "Agda",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "Lolirofle/stuff-in-agda",
"max_forks_repo_path": "Formalization/LambdaCalculus/Semantics/CallByName.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "Lolirofle/stuff-in-agda",
"max_issues_repo_path": "Formalization/LambdaCalculus/Semantics/CallByName.agda",
"max_line_length": 88,
"max_stars_count": 6,
"max_stars_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "Lolirofle/stuff-in-agda",
"max_stars_repo_path": "Formalization/LambdaCalculus/Semantics/CallByName.agda",
"max_stars_repo_stars_event_max_datetime": "2022-02-05T06:53:22.000Z",
"max_stars_repo_stars_event_min_datetime": "2020-04-07T17:58:13.000Z",
"num_tokens": 193,
"size": 658
} |
------------------------------------------------------------------------
-- The Agda standard library
--
-- Some derivable properties
------------------------------------------------------------------------
{-# OPTIONS --without-K --safe #-}
open import Algebra
module Algebra.Properties.AbelianGroup
{g₁ g₂} (G : AbelianGroup g₁ g₂) where
open AbelianGroup G
open import Function
open import Relation.Binary.Reasoning.Setoid setoid
------------------------------------------------------------------------
-- Publicly re-export group properties
open import Algebra.Properties.Group group public
------------------------------------------------------------------------
-- Properties of abelian groups
private
lemma₁ : ∀ x y → x ∙ y ∙ x ⁻¹ ≈ y
lemma₁ x y = begin
x ∙ y ∙ x ⁻¹ ≈⟨ ∙-congʳ $ comm _ _ ⟩
y ∙ x ∙ x ⁻¹ ≈⟨ assoc _ _ _ ⟩
y ∙ (x ∙ x ⁻¹) ≈⟨ ∙-congˡ $ inverseʳ _ ⟩
y ∙ ε ≈⟨ identityʳ _ ⟩
y ∎
lemma₂ : ∀ x y → x ∙ (y ∙ (x ∙ y) ⁻¹ ∙ y ⁻¹) ≈ y ⁻¹
lemma₂ x y = begin
x ∙ (y ∙ (x ∙ y) ⁻¹ ∙ y ⁻¹) ≈˘⟨ assoc _ _ _ ⟩
x ∙ (y ∙ (x ∙ y) ⁻¹) ∙ y ⁻¹ ≈˘⟨ ∙-congʳ $ assoc _ _ _ ⟩
x ∙ y ∙ (x ∙ y) ⁻¹ ∙ y ⁻¹ ≈⟨ ∙-congʳ $ inverseʳ _ ⟩
ε ∙ y ⁻¹ ≈⟨ identityˡ _ ⟩
y ⁻¹ ∎
⁻¹-∙-comm : ∀ x y → x ⁻¹ ∙ y ⁻¹ ≈ (x ∙ y) ⁻¹
⁻¹-∙-comm x y = begin
x ⁻¹ ∙ y ⁻¹ ≈⟨ comm _ _ ⟩
y ⁻¹ ∙ x ⁻¹ ≈˘⟨ ∙-congʳ $ lemma₂ x y ⟩
x ∙ (y ∙ (x ∙ y) ⁻¹ ∙ y ⁻¹) ∙ x ⁻¹ ≈⟨ lemma₁ _ _ ⟩
y ∙ (x ∙ y) ⁻¹ ∙ y ⁻¹ ≈⟨ lemma₁ _ _ ⟩
(x ∙ y) ⁻¹ ∎
| {
"alphanum_fraction": 0.3671970624,
"avg_line_length": 32.0392156863,
"ext": "agda",
"hexsha": "73cbdf60b5e878500f7331d8cdb1ee6b49f40057",
"lang": "Agda",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "0debb886eb5dbcd38dbeebd04b34cf9d9c5e0e71",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "omega12345/agda-mode",
"max_forks_repo_path": "test/asset/agda-stdlib-1.0/Algebra/Properties/AbelianGroup.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "0debb886eb5dbcd38dbeebd04b34cf9d9c5e0e71",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "omega12345/agda-mode",
"max_issues_repo_path": "test/asset/agda-stdlib-1.0/Algebra/Properties/AbelianGroup.agda",
"max_line_length": 72,
"max_stars_count": null,
"max_stars_repo_head_hexsha": "0debb886eb5dbcd38dbeebd04b34cf9d9c5e0e71",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "omega12345/agda-mode",
"max_stars_repo_path": "test/asset/agda-stdlib-1.0/Algebra/Properties/AbelianGroup.agda",
"max_stars_repo_stars_event_max_datetime": null,
"max_stars_repo_stars_event_min_datetime": null,
"num_tokens": 639,
"size": 1634
} |
import Relation.Binary.Reasoning.Setoid as SetoidR
open import SingleSorted.AlgebraicTheory
import SingleSorted.Interpretation as Interpretation
import SingleSorted.Model as Model
import SingleSorted.UniversalInterpretation as UniversalInterpretation
import SingleSorted.Substitution as Substitution
import SingleSorted.SyntacticCategory as SyntacticCategory
module SingleSorted.UniversalModel
{ℓt}
{Σ : Signature}
(T : Theory ℓt Σ) where
open Theory T
open Substitution T
open UniversalInterpretation T
open Interpretation.Interpretation ℐ
open SyntacticCategory T
𝒰 : Model.Model T cartesian-𝒮 ℐ
𝒰 =
record
{ model-eq = λ ε var-var →
let open SetoidR (eq-setoid (ax-ctx ε)) in
begin
interp-term (ax-lhs ε) var-var ≈⟨ interp-term-self (ax-lhs ε) var-var ⟩
ax-lhs ε ≈⟨ id-action ⟩
ax-lhs ε [ id-s ]s ≈⟨ eq-axiom ε id-s ⟩
ax-rhs ε [ id-s ]s ≈˘⟨ id-action ⟩
ax-rhs ε ≈˘⟨ interp-term-self (ax-rhs ε) var-var ⟩
interp-term (ax-rhs ε) var-var ∎ }
| {
"alphanum_fraction": 0.6185216653,
"avg_line_length": 35.6666666667,
"ext": "agda",
"hexsha": "e98d64dc4e8521e141b7e4a30a1345fd885335e8",
"lang": "Agda",
"max_forks_count": 6,
"max_forks_repo_forks_event_max_datetime": "2021-05-24T02:51:43.000Z",
"max_forks_repo_forks_event_min_datetime": "2021-02-16T13:43:07.000Z",
"max_forks_repo_head_hexsha": "2aaf850bb1a262681c5a232cdefae312f921b9d4",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "andrejbauer/formaltt",
"max_forks_repo_path": "src/SingleSorted/UniversalModel.agda",
"max_issues_count": 1,
"max_issues_repo_head_hexsha": "2aaf850bb1a262681c5a232cdefae312f921b9d4",
"max_issues_repo_issues_event_max_datetime": "2021-05-14T16:15:17.000Z",
"max_issues_repo_issues_event_min_datetime": "2021-04-30T14:18:25.000Z",
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "andrejbauer/formaltt",
"max_issues_repo_path": "src/SingleSorted/UniversalModel.agda",
"max_line_length": 96,
"max_stars_count": 21,
"max_stars_repo_head_hexsha": "0a9d25e6e3965913d9b49a47c88cdfb94b55ffeb",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "cilinder/formaltt",
"max_stars_repo_path": "src/SingleSorted/UniversalModel.agda",
"max_stars_repo_stars_event_max_datetime": "2021-11-19T15:50:08.000Z",
"max_stars_repo_stars_event_min_datetime": "2021-02-16T14:07:06.000Z",
"num_tokens": 330,
"size": 1177
} |
{-# OPTIONS --without-K #-}
open import lib.Base
module lib.Relation where
Rel : ∀ {i} (A : Type i) j → Type (lmax i (lsucc j))
Rel A j = A → A → Type j
Decidable : ∀ {i} {A : Type i} {j} → Rel A j → Type (lmax i j)
Decidable rel = ∀ a₁ a₂ → Dec (rel a₁ a₂)
| {
"alphanum_fraction": 0.572519084,
"avg_line_length": 21.8333333333,
"ext": "agda",
"hexsha": "bab64a09e5ea38e834aae72582cb4aac60307227",
"lang": "Agda",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "bc849346a17b33e2679a5b3f2b8efbe7835dc4b6",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "cmknapp/HoTT-Agda",
"max_forks_repo_path": "core/lib/Relation.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "bc849346a17b33e2679a5b3f2b8efbe7835dc4b6",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "cmknapp/HoTT-Agda",
"max_issues_repo_path": "core/lib/Relation.agda",
"max_line_length": 62,
"max_stars_count": null,
"max_stars_repo_head_hexsha": "bc849346a17b33e2679a5b3f2b8efbe7835dc4b6",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "cmknapp/HoTT-Agda",
"max_stars_repo_path": "core/lib/Relation.agda",
"max_stars_repo_stars_event_max_datetime": null,
"max_stars_repo_stars_event_min_datetime": null,
"num_tokens": 98,
"size": 262
} |
{-# OPTIONS --without-K #-}
module Data.Word8.FromNat where
open import Data.Word8.Primitive
-- open import Agda.Builtin.Bool using (Bool; true)
-- open import Agda.Builtin.Nat using (Nat; _<_)
open import Agda.Builtin.Unit using (⊤)
open import Agda.Builtin.FromNat using (Number)
{-
instance
NumberNat : Number Nat
NumberNat = record
{ Constraint = λ _ → ⊤
; fromNat = λ n → n
}
data IsTrue : Bool → Set where
itis : IsTrue true
instance
indeed : IsTrue true
indeed = itis
-}
instance
NumberWord8 : Number Word8
NumberWord8 = record
{ Constraint = λ n → ⊤ -- IsTrue (n < 256)
; fromNat = λ n → primWord8fromNat n
}
| {
"alphanum_fraction": 0.6621417798,
"avg_line_length": 18.9428571429,
"ext": "agda",
"hexsha": "e88e190e77b8bd49d5ef41e232e6e5059ecea8fb",
"lang": "Agda",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "98a53f35fca27e3379cf851a9a6bdfe5bd8c9626",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "semenov-vladyslav/bytes-agda",
"max_forks_repo_path": "src/Data/Word8/FromNat.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "98a53f35fca27e3379cf851a9a6bdfe5bd8c9626",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "semenov-vladyslav/bytes-agda",
"max_issues_repo_path": "src/Data/Word8/FromNat.agda",
"max_line_length": 51,
"max_stars_count": null,
"max_stars_repo_head_hexsha": "98a53f35fca27e3379cf851a9a6bdfe5bd8c9626",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "semenov-vladyslav/bytes-agda",
"max_stars_repo_path": "src/Data/Word8/FromNat.agda",
"max_stars_repo_stars_event_max_datetime": null,
"max_stars_repo_stars_event_min_datetime": null,
"num_tokens": 203,
"size": 663
} |
module PiQ.Invariants where
open import Data.Empty
open import Data.Unit
open import Data.Sum
open import Data.Product
open import Relation.Binary.Core
open import Relation.Binary
open import Relation.Nullary
open import Relation.Binary.PropositionalEquality
open import Data.Nat
open import Data.Nat.Properties
open import Function using (_∘_)
open import PiQ.Syntax
open import PiQ.Opsem
open import PiQ.NoRepeat
-- Reconstruct the whole combinator from context
getℂκ : ∀ {A B} → A ↔ B → Context {A} {B} → ∃[ C ] ∃[ D ] (C ↔ D)
getℂκ c ☐ = _ , _ , c
getℂκ c (☐⨾ c₂ • κ) = getℂκ (c ⨾ c₂) κ
getℂκ c (c₁ ⨾☐• κ) = getℂκ (c₁ ⨾ c) κ
getℂκ c (☐⊕ c₂ • κ) = getℂκ (c ⊕ c₂) κ
getℂκ c (c₁ ⊕☐• κ) = getℂκ (c₁ ⊕ c) κ
getℂκ c (☐⊗[ c₂ , x ]• κ) = getℂκ (c ⊗ c₂) κ
getℂκ c ([ c₁ , x ]⊗☐• κ) = getℂκ (c₁ ⊗ c) κ
getℂ : (st : State) → st ≢ ⊠ → ∃[ A ] ∃[ B ] (A ↔ B)
getℂ ⟨ c ∣ _ ∣ κ ⟩▷ _ = getℂκ c κ
getℂ [ c ∣ _ ∣ κ ]▷ _ = getℂκ c κ
getℂ ⟨ c ∣ _ ∣ κ ⟩◁ _ = getℂκ c κ
getℂ [ c ∣ _ ∣ κ ]◁ _ = getℂκ c κ
getℂ ⊠ st≢⊠ = ⊥-elim (st≢⊠ refl)
-- The reconstructed combinator stays the same
ℂInvariant : ∀ {st st'} → st ↦ st' → (¬fail : st ≢ ⊠) → (¬fail' : st' ≢ ⊠) → getℂ st ¬fail ≡ getℂ st' ¬fail'
ℂInvariant ↦⃗₁ _ _ = refl
ℂInvariant ↦⃗₂ _ _ = refl
ℂInvariant ↦⃗₃ _ _ = refl
ℂInvariant ↦⃗₄ _ _ = refl
ℂInvariant ↦⃗₅ _ _ = refl
ℂInvariant ↦⃗₆ _ _ = refl
ℂInvariant ↦⃗₇ _ _ = refl
ℂInvariant ↦⃗₈ _ _ = refl
ℂInvariant ↦⃗₉ _ _ = refl
ℂInvariant ↦⃗₁₀ _ _ = refl
ℂInvariant ↦⃗₁₁ _ _ = refl
ℂInvariant ↦⃗₁₂ _ _ = refl
ℂInvariant ↦⃖₁ _ _ = refl
ℂInvariant ↦⃖₂ _ _ = refl
ℂInvariant ↦⃖₃ _ _ = refl
ℂInvariant ↦⃖₄ _ _ = refl
ℂInvariant ↦⃖₅ _ _ = refl
ℂInvariant ↦⃖₆ _ _ = refl
ℂInvariant ↦⃖₇ _ _ = refl
ℂInvariant ↦⃖₈ _ _ = refl
ℂInvariant ↦⃖₉ _ _ = refl
ℂInvariant ↦⃖₁₀ _ _ = refl
ℂInvariant ↦⃖₁₁ _ _ = refl
ℂInvariant ↦⃖₁₂ _ _ = refl
ℂInvariant ↦η₊₁ _ _ = refl
ℂInvariant ↦η₊₂ _ _ = refl
ℂInvariant ↦ε₊₁ _ _ = refl
ℂInvariant ↦ε₊₂ _ _ = refl
ℂInvariant ↦⃗ηₓ _ _ = refl
ℂInvariant ↦⃖ηₓ₁ _ _ = refl
ℂInvariant ↦⃖ηₓ₂ _ ¬fail' = ⊥-elim (¬fail' refl)
ℂInvariant ↦⃗εₓ₁ _ _ = refl
ℂInvariant ↦⃗εₓ₂ _ ¬fail' = ⊥-elim (¬fail' refl)
ℂInvariant ↦⃖εₓ _ _ = refl
ℂInvariant* : ∀ {st st'} → st ↦* st' → (¬fail : st ≢ ⊠) → (¬fail' : st' ≢ ⊠) → getℂ st ¬fail ≡ getℂ st' ¬fail'
ℂInvariant* {⟨ _ ∣ _ ∣ _ ⟩▷} ◾ _ _ = refl
ℂInvariant* {[ _ ∣ _ ∣ _ ]▷} ◾ _ _ = refl
ℂInvariant* {⟨ _ ∣ _ ∣ _ ⟩◁} ◾ _ _ = refl
ℂInvariant* {[ _ ∣ _ ∣ _ ]◁} ◾ _ _ = refl
ℂInvariant* {⊠} ◾ ¬fail _ = ⊥-elim (¬fail refl)
ℂInvariant* (r ∷ ◾) ¬fail ¬fail' = ℂInvariant r ¬fail ¬fail'
ℂInvariant* (r ∷ (r' ∷ rs)) ¬fail ¬fail' = trans (ℂInvariant r ¬fail λ {refl → ⊠-is-stuck refl (_ , r')})
(ℂInvariant* (r' ∷ rs) _ ¬fail')
-- Get the type of the deepest context
get𝕌 : ∀ {A B} → Context {A} {B} → 𝕌 × 𝕌
get𝕌 {A} {B} ☐ = A , B
get𝕌 (☐⨾ c₂ • κ) = get𝕌 κ
get𝕌 (c₁ ⨾☐• κ) = get𝕌 κ
get𝕌 (☐⊕ c₂ • κ) = get𝕌 κ
get𝕌 (c₁ ⊕☐• κ) = get𝕌 κ
get𝕌 (☐⊗[ c₂ , x ]• κ) = get𝕌 κ
get𝕌 ([ c₁ , x ]⊗☐• κ) = get𝕌 κ
get𝕌State : (st : State) → st ≢ ⊠ → 𝕌 × 𝕌
get𝕌State ⟨ c ∣ v ∣ κ ⟩▷ _ = get𝕌 κ
get𝕌State [ c ∣ v ∣ κ ]▷ _ = get𝕌 κ
get𝕌State ⟨ c ∣ v ∣ κ ⟩◁ _ = get𝕌 κ
get𝕌State [ c ∣ v ∣ κ ]◁ _ = get𝕌 κ
get𝕌State ⊠ nf = ⊥-elim (nf refl)
-- Append a context to another context
appendκ : ∀ {A B} → (ctx : Context {A} {B}) → let (C , D) = get𝕌 ctx
in Context {C} {D} → Context {A} {B}
appendκ ☐ ctx = ctx
appendκ (☐⨾ c₂ • κ) ctx = ☐⨾ c₂ • appendκ κ ctx
appendκ (c₁ ⨾☐• κ) ctx = c₁ ⨾☐• appendκ κ ctx
appendκ (☐⊕ c₂ • κ) ctx = ☐⊕ c₂ • appendκ κ ctx
appendκ (c₁ ⊕☐• κ) ctx = c₁ ⊕☐• appendκ κ ctx
appendκ (☐⊗[ c₂ , x ]• κ) ctx = ☐⊗[ c₂ , x ]• appendκ κ ctx
appendκ ([ c₁ , x ]⊗☐• κ) ctx = [ c₁ , x ]⊗☐• appendκ κ ctx
appendκState : ∀ st → (nf : st ≢ ⊠)
→ let (A , B) = get𝕌State st nf
in Context {A} {B} → State
appendκState ⟨ c ∣ v ∣ κ ⟩▷ _ ctx = ⟨ c ∣ v ∣ appendκ κ ctx ⟩▷
appendκState [ c ∣ v ∣ κ ]▷ _ ctx = [ c ∣ v ∣ appendκ κ ctx ]▷
appendκState ⟨ c ∣ v ∣ κ ⟩◁ _ ctx = ⟨ c ∣ v ∣ appendκ κ ctx ⟩◁
appendκState [ c ∣ v ∣ κ ]◁ _ ctx = [ c ∣ v ∣ appendκ κ ctx ]◁
appendκState ⊠ nf = ⊥-elim (nf refl)
-- The type of context does not change during execution
𝕌Invariant : ∀ {st st'} → st ↦ st' → (nf : st ≢ ⊠) → (nf' : st' ≢ ⊠) → get𝕌State st nf ≡ get𝕌State st' nf'
𝕌Invariant ↦⃗₁ nf nf' = refl
𝕌Invariant ↦⃗₂ nf nf' = refl
𝕌Invariant ↦⃗₃ nf nf' = refl
𝕌Invariant ↦⃗₄ nf nf' = refl
𝕌Invariant ↦⃗₅ nf nf' = refl
𝕌Invariant ↦⃗₆ nf nf' = refl
𝕌Invariant ↦⃗₇ nf nf' = refl
𝕌Invariant ↦⃗₈ nf nf' = refl
𝕌Invariant ↦⃗₉ nf nf' = refl
𝕌Invariant ↦⃗₁₀ nf nf' = refl
𝕌Invariant ↦⃗₁₁ nf nf' = refl
𝕌Invariant ↦⃗₁₂ nf nf' = refl
𝕌Invariant ↦⃖₁ nf nf' = refl
𝕌Invariant ↦⃖₂ nf nf' = refl
𝕌Invariant ↦⃖₃ nf nf' = refl
𝕌Invariant ↦⃖₄ nf nf' = refl
𝕌Invariant ↦⃖₅ nf nf' = refl
𝕌Invariant ↦⃖₆ nf nf' = refl
𝕌Invariant ↦⃖₇ nf nf' = refl
𝕌Invariant ↦⃖₈ nf nf' = refl
𝕌Invariant ↦⃖₉ nf nf' = refl
𝕌Invariant ↦⃖₁₀ nf nf' = refl
𝕌Invariant ↦⃖₁₁ nf nf' = refl
𝕌Invariant ↦⃖₁₂ nf nf' = refl
𝕌Invariant ↦η₊₁ nf nf' = refl
𝕌Invariant ↦η₊₂ nf nf' = refl
𝕌Invariant ↦ε₊₁ nf nf' = refl
𝕌Invariant ↦ε₊₂ nf nf' = refl
𝕌Invariant ↦⃗ηₓ nf nf' = refl
𝕌Invariant ↦⃖ηₓ₁ nf nf' = refl
𝕌Invariant ↦⃖ηₓ₂ nf nf' = ⊥-elim (nf' refl)
𝕌Invariant ↦⃗εₓ₁ nf nf' = refl
𝕌Invariant ↦⃗εₓ₂ nf nf' = ⊥-elim (nf' refl)
𝕌Invariant ↦⃖εₓ nf nf' = refl
𝕌Invariant* : ∀ {st st'} → st ↦* st' → (nf : st ≢ ⊠) → (nf' : st' ≢ ⊠) → get𝕌State st nf ≡ get𝕌State st' nf'
𝕌Invariant* {⟨ _ ∣ _ ∣ _ ⟩▷} ◾ nf nf' = refl
𝕌Invariant* {[ _ ∣ _ ∣ _ ]▷} ◾ nf nf' = refl
𝕌Invariant* {⟨ _ ∣ _ ∣ _ ⟩◁} ◾ nf nf' = refl
𝕌Invariant* {[ _ ∣ _ ∣ _ ]◁} ◾ nf nf' = refl
𝕌Invariant* {⊠} ◾ nf nf' = ⊥-elim (nf' refl)
𝕌Invariant* (r ∷ ◾) nf nf' = 𝕌Invariant r nf nf'
𝕌Invariant* (r ∷ (r' ∷ rs)) nf nf' = trans (𝕌Invariant r nf nf'') (𝕌Invariant* (r' ∷ rs) nf'' nf')
where
nf'' = λ eq → ⊠-is-stuck eq (_ , r')
-- Appending context does not affect reductions
appendκ↦ : ∀ {st st'} → (r : st ↦ st') (nf : st ≢ ⊠) (nf' : st' ≢ ⊠) (eq : get𝕌State st nf ≡ get𝕌State st' nf')
→ (κ : Context {proj₁ (get𝕌State st nf)} {proj₂ (get𝕌State st nf)})
→ appendκState st nf κ ↦ appendκState st' nf' (subst (λ {(A , B) → Context {A} {B}}) eq κ)
appendκ↦ ↦⃗₁ nf nf' refl ctx = ↦⃗₁
appendκ↦ ↦⃗₂ nf nf' refl ctx = ↦⃗₂
appendκ↦ ↦⃗₃ nf nf' refl ctx = ↦⃗₃
appendκ↦ ↦⃗₄ nf nf' refl ctx = ↦⃗₄
appendκ↦ ↦⃗₅ nf nf' refl ctx = ↦⃗₅
appendκ↦ ↦⃗₆ nf nf' refl ctx = ↦⃗₆
appendκ↦ ↦⃗₇ nf nf' refl ctx = ↦⃗₇
appendκ↦ ↦⃗₈ nf nf' refl ctx = ↦⃗₈
appendκ↦ ↦⃗₉ nf nf' refl ctx = ↦⃗₉
appendκ↦ ↦⃗₁₀ nf nf' refl ctx = ↦⃗₁₀
appendκ↦ ↦⃗₁₁ nf nf' refl ctx = ↦⃗₁₁
appendκ↦ ↦⃗₁₂ nf nf' refl ctx = ↦⃗₁₂
appendκ↦ ↦⃖₁ nf nf' refl ctx = ↦⃖₁
appendκ↦ ↦⃖₂ nf nf' refl ctx = ↦⃖₂
appendκ↦ ↦⃖₃ nf nf' refl ctx = ↦⃖₃
appendκ↦ ↦⃖₄ nf nf' refl ctx = ↦⃖₄
appendκ↦ ↦⃖₅ nf nf' refl ctx = ↦⃖₅
appendκ↦ ↦⃖₆ nf nf' refl ctx = ↦⃖₆
appendκ↦ ↦⃖₇ nf nf' refl ctx = ↦⃖₇
appendκ↦ ↦⃖₈ nf nf' refl ctx = ↦⃖₈
appendκ↦ ↦⃖₉ nf nf' refl ctx = ↦⃖₉
appendκ↦ ↦⃖₁₀ nf nf' refl ctx = ↦⃖₁₀
appendκ↦ ↦⃖₁₁ nf nf' refl ctx = ↦⃖₁₁
appendκ↦ ↦⃖₁₂ nf nf' refl ctx = ↦⃖₁₂
appendκ↦ ↦η₊₁ nf nf' refl ctx = ↦η₊₁
appendκ↦ ↦η₊₂ nf nf' refl ctx = ↦η₊₂
appendκ↦ ↦ε₊₁ nf nf' refl ctx = ↦ε₊₁
appendκ↦ ↦ε₊₂ nf nf' refl ctx = ↦ε₊₂
appendκ↦ ↦⃗ηₓ nf nf' refl ctx = ↦⃗ηₓ
appendκ↦ (↦⃖ηₓ₁ {eq = eq}) nf nf' refl ctx = ↦⃖ηₓ₁ {eq = eq}
appendκ↦ ↦⃖ηₓ₂ nf nf' eq ctx = ⊥-elim (nf' refl)
appendκ↦ (↦⃗εₓ₁ {eq = eq}) nf nf' refl ctx = ↦⃗εₓ₁ {eq = eq}
appendκ↦ ↦⃗εₓ₂ nf nf' eq ctx = ⊥-elim (nf' refl)
appendκ↦ ↦⃖εₓ nf nf' refl ctx = ↦⃖εₓ
appendκ↦* : ∀ {st st'} → (r : st ↦* st') (nf : st ≢ ⊠) (nf' : st' ≢ ⊠) (eq : get𝕌State st nf ≡ get𝕌State st' nf')
→ (κ : Context {proj₁ (get𝕌State st nf)} {proj₂ (get𝕌State st nf)})
→ appendκState st nf κ ↦* appendκState st' nf' (subst (λ {(A , B) → Context {A} {B}}) eq κ)
appendκ↦* {⟨ _ ∣ _ ∣ _ ⟩▷} ◾ nf nf' refl ctx = ◾
appendκ↦* {[ _ ∣ _ ∣ _ ]▷} ◾ nf nf' refl ctx = ◾
appendκ↦* {⟨ _ ∣ _ ∣ _ ⟩◁} ◾ nf nf' refl ctx = ◾
appendκ↦* {[ _ ∣ _ ∣ _ ]◁} ◾ nf nf' refl ctx = ◾
appendκ↦* {⊠} ◾ nf nf' eq ctx = ⊥-elim (nf' refl)
appendκ↦* (↦⃗₁ {b = b} {v} {κ} ∷ rs) nf nf' eq ctx = appendκ↦ (↦⃗₁ {b = b} {v} {κ}) nf (λ ()) refl ctx ∷ appendκ↦* rs (λ ()) nf' eq ctx
appendκ↦* (↦⃗₂ {v = v} {κ} ∷ rs) nf nf' eq ctx = appendκ↦ (↦⃗₂ {v = v} {κ}) nf (λ ()) refl ctx ∷ appendκ↦* rs (λ ()) nf' eq ctx
appendκ↦* (↦⃗₃ {v = v} {κ} ∷ rs) nf nf' eq ctx = appendκ↦ (↦⃗₃ {v = v} {κ}) nf (λ ()) refl ctx ∷ appendκ↦* rs (λ ()) nf' eq ctx
appendκ↦* (↦⃗₄ {x = x} {κ} ∷ rs) nf nf' eq ctx = appendκ↦ (↦⃗₄ {x = x} {κ}) nf (λ ()) refl ctx ∷ appendκ↦* rs (λ ()) nf' eq ctx
appendκ↦* (↦⃗₅ {y = y} {κ} ∷ rs) nf nf' eq ctx = appendκ↦ (↦⃗₅ {y = y} {κ}) nf (λ ()) refl ctx ∷ appendκ↦* rs (λ ()) nf' eq ctx
appendκ↦* (↦⃗₆ {κ = κ} ∷ rs) nf nf' eq ctx = appendκ↦ (↦⃗₆ {κ = κ}) nf (λ ()) refl ctx ∷ appendκ↦* rs (λ ()) nf' eq ctx
appendκ↦* (↦⃗₇ {κ = κ} ∷ rs) nf nf' eq ctx = appendκ↦ (↦⃗₇ {κ = κ}) nf (λ ()) refl ctx ∷ appendκ↦* rs (λ ()) nf' eq ctx
appendκ↦* (↦⃗₈ {κ = κ} ∷ rs) nf nf' eq ctx = appendκ↦ (↦⃗₈ {κ = κ}) nf (λ ()) refl ctx ∷ appendκ↦* rs (λ ()) nf' eq ctx
appendκ↦* (↦⃗₉ {κ = κ} ∷ rs) nf nf' eq ctx = appendκ↦ (↦⃗₉ {κ = κ}) nf (λ ()) refl ctx ∷ appendκ↦* rs (λ ()) nf' eq ctx
appendκ↦* (↦⃗₁₀ {κ = κ} ∷ rs) nf nf' eq ctx = appendκ↦ (↦⃗₁₀ {κ = κ}) nf (λ ()) refl ctx ∷ appendκ↦* rs (λ ()) nf' eq ctx
appendκ↦* (↦⃗₁₁ {κ = κ} ∷ rs) nf nf' eq ctx = appendκ↦ (↦⃗₁₁ {κ = κ}) nf (λ ()) refl ctx ∷ appendκ↦* rs (λ ()) nf' eq ctx
appendκ↦* (↦⃗₁₂ {κ = κ} ∷ rs) nf nf' eq ctx = appendκ↦ (↦⃗₁₂ {κ = κ}) nf (λ ()) refl ctx ∷ appendκ↦* rs (λ ()) nf' eq ctx
appendκ↦* (↦⃖₁ {b = b} {v} {κ} ∷ rs) nf nf' eq ctx = appendκ↦ (↦⃖₁ {b = b} {v} {κ}) nf (λ ()) refl ctx ∷ appendκ↦* rs (λ ()) nf' eq ctx
appendκ↦* (↦⃖₂ {v = v} {κ} ∷ rs) nf nf' eq ctx = appendκ↦ (↦⃖₂ {v = v} {κ}) nf (λ ()) refl ctx ∷ appendκ↦* rs (λ ()) nf' eq ctx
appendκ↦* (↦⃖₃ {v = v} {κ} ∷ rs) nf nf' eq ctx = appendκ↦ (↦⃖₃ {v = v} {κ}) nf (λ ()) refl ctx ∷ appendκ↦* rs (λ ()) nf' eq ctx
appendκ↦* (↦⃖₄ {x = x} {κ} ∷ rs) nf nf' eq ctx = appendκ↦ (↦⃖₄ {x = x} {κ}) nf (λ ()) refl ctx ∷ appendκ↦* rs (λ ()) nf' eq ctx
appendκ↦* (↦⃖₅ {y = y} {κ} ∷ rs) nf nf' eq ctx = appendκ↦ (↦⃖₅ {y = y} {κ}) nf (λ ()) refl ctx ∷ appendκ↦* rs (λ ()) nf' eq ctx
appendκ↦* (↦⃖₆ {κ = κ} ∷ rs) nf nf' eq ctx = appendκ↦ (↦⃖₆ {κ = κ}) nf (λ ()) refl ctx ∷ appendκ↦* rs (λ ()) nf' eq ctx
appendκ↦* (↦⃖₇ {κ = κ} ∷ rs) nf nf' eq ctx = appendκ↦ (↦⃖₇ {κ = κ}) nf (λ ()) refl ctx ∷ appendκ↦* rs (λ ()) nf' eq ctx
appendκ↦* (↦⃖₈ {κ = κ} ∷ rs) nf nf' eq ctx = appendκ↦ (↦⃖₈ {κ = κ}) nf (λ ()) refl ctx ∷ appendκ↦* rs (λ ()) nf' eq ctx
appendκ↦* (↦⃖₉ {κ = κ} ∷ rs) nf nf' eq ctx = appendκ↦ (↦⃖₉ {κ = κ}) nf (λ ()) refl ctx ∷ appendκ↦* rs (λ ()) nf' eq ctx
appendκ↦* (↦⃖₁₀ {κ = κ} ∷ rs) nf nf' eq ctx = appendκ↦ (↦⃖₁₀ {κ = κ}) nf (λ ()) refl ctx ∷ appendκ↦* rs (λ ()) nf' eq ctx
appendκ↦* (↦⃖₁₁ {κ = κ} ∷ rs) nf nf' eq ctx = appendκ↦ (↦⃖₁₁ {κ = κ}) nf (λ ()) refl ctx ∷ appendκ↦* rs (λ ()) nf' eq ctx
appendκ↦* (↦⃖₁₂ {κ = κ} ∷ rs) nf nf' eq ctx = appendκ↦ (↦⃖₁₂ {κ = κ}) nf (λ ()) refl ctx ∷ appendκ↦* rs (λ ()) nf' eq ctx
appendκ↦* (↦η₊₁ {κ = κ} ∷ rs) nf nf' eq ctx = appendκ↦ (↦η₊₁ {κ = κ}) nf (λ ()) refl ctx ∷ appendκ↦* rs (λ ()) nf' eq ctx
appendκ↦* (↦η₊₂ {κ = κ} ∷ rs) nf nf' eq ctx = appendκ↦ (↦η₊₂ {κ = κ}) nf (λ ()) refl ctx ∷ appendκ↦* rs (λ ()) nf' eq ctx
appendκ↦* (↦ε₊₁ {κ = κ} ∷ rs) nf nf' eq ctx = appendκ↦ (↦ε₊₁ {κ = κ}) nf (λ ()) refl ctx ∷ appendκ↦* rs (λ ()) nf' eq ctx
appendκ↦* (↦ε₊₂ {κ = κ} ∷ rs) nf nf' eq ctx = appendκ↦ (↦ε₊₂ {κ = κ}) nf (λ ()) refl ctx ∷ appendκ↦* rs (λ ()) nf' eq ctx
appendκ↦* (↦⃗ηₓ ∷ rs) nf nf' eq ctx = appendκ↦ ↦⃗ηₓ nf (λ ()) refl ctx ∷ appendκ↦* rs (λ ()) nf' eq ctx
appendκ↦* (↦⃖ηₓ₁ {eq = eq'} ∷ rs) nf nf' eq ctx = appendκ↦ (↦⃖ηₓ₁ {eq = eq'}) nf (λ ()) refl ctx ∷ appendκ↦* rs (λ ()) nf' eq ctx
appendκ↦* (↦⃖ηₓ₂ ∷ ◾) nf nf' eq ctx = ⊥-elim (nf' refl)
appendκ↦* (↦⃗εₓ₁ {eq = eq'} ∷ rs) nf nf' eq ctx = appendκ↦ (↦⃗εₓ₁ {eq = eq'}) nf (λ ()) refl ctx ∷ appendκ↦* rs (λ ()) nf' eq ctx
appendκ↦* (↦⃗εₓ₂ ∷ ◾) nf nf' eq ctx = ⊥-elim (nf' refl)
appendκ↦* (↦⃖εₓ ∷ rs) nf nf' eq ctx = appendκ↦ ↦⃖εₓ nf (λ ()) refl ctx ∷ appendκ↦* rs (λ ()) nf' eq ctx
appendκ↦⊠ : ∀ {st} → (r : st ↦ ⊠) (nf : st ≢ ⊠)
→ (κ : Context {proj₁ (get𝕌State st nf)} {proj₂ (get𝕌State st nf)})
→ appendκState st nf κ ↦ ⊠
appendκ↦⊠ (↦⃖ηₓ₂ {neq = neq}) nf ctx = ↦⃖ηₓ₂ {neq = neq}
appendκ↦⊠ (↦⃗εₓ₂ {neq = neq}) nf ctx = ↦⃗εₓ₂ {neq = neq}
appendκ↦*⊠ : ∀ {st} → (r : st ↦* ⊠) (nf : st ≢ ⊠)
→ (κ : Context {proj₁ (get𝕌State st nf)} {proj₂ (get𝕌State st nf)})
→ appendκState st nf κ ↦* ⊠
appendκ↦*⊠ ◾ nf ctx = ⊥-elim (nf refl)
appendκ↦*⊠ (r ∷ ◾) nf ctx = appendκ↦⊠ r nf ctx ∷ ◾
appendκ↦*⊠ (↦⃗₁ ∷ (r' ∷ rs)) nf ctx = ↦⃗₁ ∷ appendκ↦*⊠ (r' ∷ rs) (λ ()) ctx
appendκ↦*⊠ (↦⃗₂ ∷ (r' ∷ rs)) nf ctx = ↦⃗₂ ∷ appendκ↦*⊠ (r' ∷ rs) (λ ()) ctx
appendκ↦*⊠ (↦⃗₃ ∷ (r' ∷ rs)) nf ctx = ↦⃗₃ ∷ appendκ↦*⊠ (r' ∷ rs) (λ ()) ctx
appendκ↦*⊠ (↦⃗₄ ∷ (r' ∷ rs)) nf ctx = ↦⃗₄ ∷ appendκ↦*⊠ (r' ∷ rs) (λ ()) ctx
appendκ↦*⊠ (↦⃗₅ ∷ (r' ∷ rs)) nf ctx = ↦⃗₅ ∷ appendκ↦*⊠ (r' ∷ rs) (λ ()) ctx
appendκ↦*⊠ (↦⃗₆ ∷ (r' ∷ rs)) nf ctx = ↦⃗₆ ∷ appendκ↦*⊠ (r' ∷ rs) (λ ()) ctx
appendκ↦*⊠ (↦⃗₇ ∷ (r' ∷ rs)) nf ctx = ↦⃗₇ ∷ appendκ↦*⊠ (r' ∷ rs) (λ ()) ctx
appendκ↦*⊠ (↦⃗₈ ∷ (r' ∷ rs)) nf ctx = ↦⃗₈ ∷ appendκ↦*⊠ (r' ∷ rs) (λ ()) ctx
appendκ↦*⊠ (↦⃗₉ ∷ (r' ∷ rs)) nf ctx = ↦⃗₉ ∷ appendκ↦*⊠ (r' ∷ rs) (λ ()) ctx
appendκ↦*⊠ (↦⃗₁₀ ∷ (r' ∷ rs)) nf ctx = ↦⃗₁₀ ∷ appendκ↦*⊠ (r' ∷ rs) (λ ()) ctx
appendκ↦*⊠ (↦⃗₁₁ ∷ (r' ∷ rs)) nf ctx = ↦⃗₁₁ ∷ appendκ↦*⊠ (r' ∷ rs) (λ ()) ctx
appendκ↦*⊠ (↦⃗₁₂ ∷ (r' ∷ rs)) nf ctx = ↦⃗₁₂ ∷ appendκ↦*⊠ (r' ∷ rs) (λ ()) ctx
appendκ↦*⊠ (↦⃖₁ ∷ (r' ∷ rs)) nf ctx = ↦⃖₁ ∷ appendκ↦*⊠ (r' ∷ rs) (λ ()) ctx
appendκ↦*⊠ (↦⃖₂ ∷ (r' ∷ rs)) nf ctx = ↦⃖₂ ∷ appendκ↦*⊠ (r' ∷ rs) (λ ()) ctx
appendκ↦*⊠ (↦⃖₃ ∷ (r' ∷ rs)) nf ctx = ↦⃖₃ ∷ appendκ↦*⊠ (r' ∷ rs) (λ ()) ctx
appendκ↦*⊠ (↦⃖₄ ∷ (r' ∷ rs)) nf ctx = ↦⃖₄ ∷ appendκ↦*⊠ (r' ∷ rs) (λ ()) ctx
appendκ↦*⊠ (↦⃖₅ ∷ (r' ∷ rs)) nf ctx = ↦⃖₅ ∷ appendκ↦*⊠ (r' ∷ rs) (λ ()) ctx
appendκ↦*⊠ (↦⃖₆ ∷ (r' ∷ rs)) nf ctx = ↦⃖₆ ∷ appendκ↦*⊠ (r' ∷ rs) (λ ()) ctx
appendκ↦*⊠ (↦⃖₇ ∷ (r' ∷ rs)) nf ctx = ↦⃖₇ ∷ appendκ↦*⊠ (r' ∷ rs) (λ ()) ctx
appendκ↦*⊠ (↦⃖₈ ∷ (r' ∷ rs)) nf ctx = ↦⃖₈ ∷ appendκ↦*⊠ (r' ∷ rs) (λ ()) ctx
appendκ↦*⊠ (↦⃖₉ ∷ (r' ∷ rs)) nf ctx = ↦⃖₉ ∷ appendκ↦*⊠ (r' ∷ rs) (λ ()) ctx
appendκ↦*⊠ (↦⃖₁₀ ∷ (r' ∷ rs)) nf ctx = ↦⃖₁₀ ∷ appendκ↦*⊠ (r' ∷ rs) (λ ()) ctx
appendκ↦*⊠ (↦⃖₁₁ ∷ (r' ∷ rs)) nf ctx = ↦⃖₁₁ ∷ appendκ↦*⊠ (r' ∷ rs) (λ ()) ctx
appendκ↦*⊠ (↦⃖₁₂ ∷ (r' ∷ rs)) nf ctx = ↦⃖₁₂ ∷ appendκ↦*⊠ (r' ∷ rs) (λ ()) ctx
appendκ↦*⊠ (↦η₊₁ ∷ (r' ∷ rs)) nf ctx = ↦η₊₁ ∷ appendκ↦*⊠ (r' ∷ rs) (λ ()) ctx
appendκ↦*⊠ (↦η₊₂ ∷ (r' ∷ rs)) nf ctx = ↦η₊₂ ∷ appendκ↦*⊠ (r' ∷ rs) (λ ()) ctx
appendκ↦*⊠ (↦ε₊₁ ∷ (r' ∷ rs)) nf ctx = ↦ε₊₁ ∷ appendκ↦*⊠ (r' ∷ rs) (λ ()) ctx
appendκ↦*⊠ (↦ε₊₂ ∷ (r' ∷ rs)) nf ctx = ↦ε₊₂ ∷ appendκ↦*⊠ (r' ∷ rs) (λ ()) ctx
appendκ↦*⊠ (↦⃗ηₓ ∷ (r' ∷ rs)) nf ctx = ↦⃗ηₓ ∷ appendκ↦*⊠ (r' ∷ rs) (λ ()) ctx
appendκ↦*⊠ (↦⃖ηₓ₁ {eq = eq} ∷ (r' ∷ rs)) nf ctx = ↦⃖ηₓ₁ {eq = eq} ∷ appendκ↦*⊠ (r' ∷ rs) (λ ()) ctx
appendκ↦*⊠ (↦⃗εₓ₁ {eq = eq} ∷ (r' ∷ rs)) nf ctx = ↦⃗εₓ₁ {eq = eq} ∷ appendκ↦*⊠ (r' ∷ rs) (λ ()) ctx
appendκ↦*⊠ (↦⃖εₓ ∷ (r' ∷ rs)) nf ctx = ↦⃖εₓ ∷ appendκ↦*⊠ (r' ∷ rs) (λ ()) ctx
| {
"alphanum_fraction": 0.5159307245,
"avg_line_length": 51.8082191781,
"ext": "agda",
"hexsha": "4811b1906d79ada820fc811b8dfa6a96ad8181ec",
"lang": "Agda",
"max_forks_count": 1,
"max_forks_repo_forks_event_max_datetime": "2021-11-04T06:54:45.000Z",
"max_forks_repo_forks_event_min_datetime": "2021-11-04T06:54:45.000Z",
"max_forks_repo_head_hexsha": "fb380f2e67dcb4a94f353dbaec91624fcb5b8933",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "DreamLinuxer/popl21-artifact",
"max_forks_repo_path": "PiQ/Invariants.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "fb380f2e67dcb4a94f353dbaec91624fcb5b8933",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "DreamLinuxer/popl21-artifact",
"max_issues_repo_path": "PiQ/Invariants.agda",
"max_line_length": 135,
"max_stars_count": 5,
"max_stars_repo_head_hexsha": "fb380f2e67dcb4a94f353dbaec91624fcb5b8933",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "DreamLinuxer/popl21-artifact",
"max_stars_repo_path": "PiQ/Invariants.agda",
"max_stars_repo_stars_event_max_datetime": "2020-10-10T21:41:32.000Z",
"max_stars_repo_stars_event_min_datetime": "2020-10-07T12:07:53.000Z",
"num_tokens": 8701,
"size": 15128
} |
module Pi-.Dir where
open import Relation.Binary.PropositionalEquality
data Dir : Set where
◁ : Dir
▷ : Dir
-ᵈⁱʳ_ : Dir → Dir
-ᵈⁱʳ ▷ = ◁
-ᵈⁱʳ ◁ = ▷
_×ᵈⁱʳ_ : Dir → Dir → Dir
◁ ×ᵈⁱʳ ◁ = ▷
◁ ×ᵈⁱʳ ▷ = ◁
▷ ×ᵈⁱʳ ◁ = ◁
▷ ×ᵈⁱʳ ▷ = ▷
identˡᵈⁱʳ : ∀ d → ▷ ×ᵈⁱʳ d ≡ d
identˡᵈⁱʳ ◁ = refl
identˡᵈⁱʳ ▷ = refl
assoclᵈⁱʳ : ∀ d₁ d₂ d₃ → d₁ ×ᵈⁱʳ (d₂ ×ᵈⁱʳ d₃) ≡ (d₁ ×ᵈⁱʳ d₂) ×ᵈⁱʳ d₃
assoclᵈⁱʳ ◁ ◁ ◁ = refl
assoclᵈⁱʳ ◁ ◁ ▷ = refl
assoclᵈⁱʳ ◁ ▷ ◁ = refl
assoclᵈⁱʳ ◁ ▷ ▷ = refl
assoclᵈⁱʳ ▷ ◁ ◁ = refl
assoclᵈⁱʳ ▷ ◁ ▷ = refl
assoclᵈⁱʳ ▷ ▷ ◁ = refl
assoclᵈⁱʳ ▷ ▷ ▷ = refl
commᵈⁱʳ : ∀ d₁ d₂ → d₁ ×ᵈⁱʳ d₂ ≡ d₂ ×ᵈⁱʳ d₁
commᵈⁱʳ ◁ ◁ = refl
commᵈⁱʳ ◁ ▷ = refl
commᵈⁱʳ ▷ ◁ = refl
commᵈⁱʳ ▷ ▷ = refl
assocl-commᵈⁱʳ : ∀ d₁ d₂ d₃ → d₁ ×ᵈⁱʳ (d₂ ×ᵈⁱʳ d₃) ≡ (d₂ ×ᵈⁱʳ d₁) ×ᵈⁱʳ d₃
assocl-commᵈⁱʳ ◁ ◁ ◁ = refl
assocl-commᵈⁱʳ ◁ ◁ ▷ = refl
assocl-commᵈⁱʳ ◁ ▷ ◁ = refl
assocl-commᵈⁱʳ ◁ ▷ ▷ = refl
assocl-commᵈⁱʳ ▷ ◁ ◁ = refl
assocl-commᵈⁱʳ ▷ ◁ ▷ = refl
assocl-commᵈⁱʳ ▷ ▷ ◁ = refl
assocl-commᵈⁱʳ ▷ ▷ ▷ = refl
assoc-commᵈⁱʳ : ∀ d₁ d₂ d₃ → d₁ ×ᵈⁱʳ (d₂ ×ᵈⁱʳ d₃) ≡ d₂ ×ᵈⁱʳ (d₁ ×ᵈⁱʳ d₃)
assoc-commᵈⁱʳ ◁ ◁ ◁ = refl
assoc-commᵈⁱʳ ◁ ◁ ▷ = refl
assoc-commᵈⁱʳ ◁ ▷ ◁ = refl
assoc-commᵈⁱʳ ◁ ▷ ▷ = refl
assoc-commᵈⁱʳ ▷ ◁ ◁ = refl
assoc-commᵈⁱʳ ▷ ◁ ▷ = refl
assoc-commᵈⁱʳ ▷ ▷ ◁ = refl
assoc-commᵈⁱʳ ▷ ▷ ▷ = refl
| {
"alphanum_fraction": 0.5734597156,
"avg_line_length": 22.2105263158,
"ext": "agda",
"hexsha": "d5f2344ec42c22ccf536196ad445d7435ff4a9d6",
"lang": "Agda",
"max_forks_count": 1,
"max_forks_repo_forks_event_max_datetime": "2021-11-04T06:54:45.000Z",
"max_forks_repo_forks_event_min_datetime": "2021-11-04T06:54:45.000Z",
"max_forks_repo_head_hexsha": "fb380f2e67dcb4a94f353dbaec91624fcb5b8933",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "DreamLinuxer/popl21-artifact",
"max_forks_repo_path": "Pi-/Dir.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "fb380f2e67dcb4a94f353dbaec91624fcb5b8933",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "DreamLinuxer/popl21-artifact",
"max_issues_repo_path": "Pi-/Dir.agda",
"max_line_length": 73,
"max_stars_count": 5,
"max_stars_repo_head_hexsha": "fb380f2e67dcb4a94f353dbaec91624fcb5b8933",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "DreamLinuxer/popl21-artifact",
"max_stars_repo_path": "Pi-/Dir.agda",
"max_stars_repo_stars_event_max_datetime": "2020-10-10T21:41:32.000Z",
"max_stars_repo_stars_event_min_datetime": "2020-10-07T12:07:53.000Z",
"num_tokens": 973,
"size": 1266
} |
{-# OPTIONS --safe #-}
module Parametrized where
open import Generics
open import Agda.Primitive
open import Function.Base
open import Data.Nat.Base hiding (pred)
open import Data.Fin.Base hiding (pred; _+_)
open import Data.List.Base hiding (sum; length)
open import Relation.Nullary
open import Relation.Nullary.Decidable as Decidable
open import Relation.Binary.HeterogeneousEquality.Core using (_≅_; refl)
open import Relation.Binary.PropositionalEquality
open import Data.String hiding (show; _≟_; length)
open import Data.Maybe.Base
module Nat where
instance
natD : HasDesc ℕ
natD = deriveDesc ℕ
---------------------------
-- Deriving the eliminator
elimℕ = deriveElim natD
plus : ℕ → ℕ → ℕ
plus n = elimℕ (const ℕ) n suc
mult : ℕ → ℕ → ℕ
mult n = elimℕ (const ℕ) 0 (plus n)
-- things defined with the eliminator reduce properly on open terms
plus0 : ∀ {n} → plus n 0 ≡ n
plus0 = refl
plusS : ∀ {n m} → plus n (suc m) ≡ suc (plus n m)
plusS = refl
mult0 : ∀ {n} → mult n 0 ≡ 0
mult0 = refl
multS : ∀ {n m} → mult n (suc m) ≡ plus n (mult n m)
multS = refl
-----------------
-- Deriving fold
foldℕ = deriveFold natD
t : ℕ
t = foldℕ 1 suc 2
-----------------
-- Deriving show
instance showℕ : Show ℕ
showℕ = deriveShow natD
_ : show 2 ≡ "suc (suc (zero))"
_ = refl
------------------------------------
-- Deriving case analysis principle
caseℕ = deriveCase natD
pred : ℕ → ℕ
pred = caseℕ (const ℕ) 0 id
pred0 : pred 0 ≡ 0
pred0 = refl
predS : ∀ {n} → pred (suc n) ≡ n
predS = refl
-----------------------
-- Deriving congruence
congℕ = deriveCong natD
ze≅ze : 0 ≅ 0
ze≅ze = congℕ zero
su≅su : ∀ {n m} → n ≅ m → suc n ≅ suc m
su≅su = congℕ (suc zero)
-------------------------------
-- Deriving decidable equality
instance decℕ : DecEq ℕ
decℕ = deriveDecEq natD
_ : 3 ≟ 3 ≡ yes refl
_ = refl
_ : 3 ≟ 2 ≡ no _
_ = refl
module ListDemo where
data list (A : Set) : Set where
[] : list A
_∷_ : A → list A → list A
listD : HasDesc list
listD = deriveDesc list
foldList = deriveFold listD
sum : list ℕ → ℕ
sum = foldList 0 _+_
[]-sum : sum [] ≡ 0
[]-sum = refl
∷-sum : ∀ {x xs} → sum (x ∷ xs) ≡ x + sum xs
∷-sum = refl
mul : list ℕ → ℕ
mul = foldList 1 _*_
module Vec where
private variable A : Set
n : ℕ
data Vec (A : Set) : ℕ → Set where
nil : Vec A 0
cons : ∀ {n} → A → Vec A n → Vec A (suc n)
instance
vekD : HasDesc Vec
vekD = deriveDesc Vec
---------------------------
-- Deriving the eliminator
elimVec = deriveElim vekD
length : Vec A n → ℕ
length = elimVec (const ℕ) 0 (const suc)
length0 : length (nil {A}) ≡ 0
length0 = refl
lengthP : (x : Vec A n) → length x ≡ n
lengthP = elimVec (λ {n} x → length x ≡ n) refl (const (cong suc))
---------------------------
-- Deriving fold
foldVec = deriveFold vekD
vekToList : ∀ {A n} → Vec A n → List A
vekToList = foldVec [] _∷_
-----------------------
-- Deriving congruence
congV = deriveCong vekD
[]≅[] : ∀ {A} → nil {A} ≅ nil {A}
[]≅[] = congV zero
cong-cons : ∀ {A n} {x y : A} → x ≅ y → {xs ys : Vec A n} → xs ≅ ys
→ cons x xs ≅ cons y ys
cong-cons = congV (suc zero) refl
module WType where
private variable A : Set
B : A → Set
c : Level
data W (A : Set) (B : A → Set) : Set where
node : ∀ x → (B x → W A B) → W A B
wD : HasDesc W
wD = deriveDesc W
---------------------------
-- Deriving the eliminator
elimW : (Pr : W A B → Set c)
→ (∀ x {g} → (∀ y → Pr (g y)) → Pr (node x g) )
→ ∀ x → Pr x
elimW = deriveElim wD
elimW-node
: {Pr : W A B → Set c}
(M : ∀ x {g} → (∀ y → Pr (g y)) → Pr (node x g) )
→ ∀ {x g}
→ elimW Pr M (node x g) ≡ M x (λ y → elimW Pr M (g y))
elimW-node M = refl
module Irrelevance where
data Squash (A : Set) : Set where
squash : .(x : A) → Squash A
-- Irrelevant arguments are supported
squashD : HasDesc Squash
squashD = deriveDesc Squash
-----------------
-- Deriving fold
foldSquash : ∀ {A X : Set} → (.A → X) → Squash A → X
foldSquash = deriveFold squashD
------------------------------
-- Deriving printing function
-- Because the value of type A is irrelevant,
-- we don't require an instance of Show A
instance showSquash : ∀ {A} → Show (Squash A)
showSquash = deriveShow squashD
_ : show (squash 3) ≡ "squash (._)"
_ = refl
| {
"alphanum_fraction": 0.5355976486,
"avg_line_length": 19.8831168831,
"ext": "agda",
"hexsha": "820fabe4558d678b4b9824d6cc36840c833789a3",
"lang": "Agda",
"max_forks_count": 3,
"max_forks_repo_forks_event_max_datetime": "2022-01-14T10:35:16.000Z",
"max_forks_repo_forks_event_min_datetime": "2021-04-08T08:32:42.000Z",
"max_forks_repo_head_hexsha": "db764f858d908aa39ea4901669a6bbce1525f757",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "flupe/generics",
"max_forks_repo_path": "examples/Parametrized.agda",
"max_issues_count": 4,
"max_issues_repo_head_hexsha": "db764f858d908aa39ea4901669a6bbce1525f757",
"max_issues_repo_issues_event_max_datetime": "2022-01-14T10:48:30.000Z",
"max_issues_repo_issues_event_min_datetime": "2021-09-13T07:33:50.000Z",
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "flupe/generics",
"max_issues_repo_path": "examples/Parametrized.agda",
"max_line_length": 72,
"max_stars_count": 11,
"max_stars_repo_head_hexsha": "db764f858d908aa39ea4901669a6bbce1525f757",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "flupe/generics",
"max_stars_repo_path": "examples/Parametrized.agda",
"max_stars_repo_stars_event_max_datetime": "2022-02-05T09:35:17.000Z",
"max_stars_repo_stars_event_min_datetime": "2021-04-08T15:10:20.000Z",
"num_tokens": 1592,
"size": 4593
} |
{-# OPTIONS --without-K --safe #-}
-- Constructions of a Cocone from the Twisted Arrow function from a Cowedge
-- and vice-versa, by Duality.
-- Note that the proper functioning of this relies crucially on
-- Functor.op (Functor.op F) being definitionally equal to F.
open import Categories.Category using (Category)
open import Categories.Functor.Bifunctor using (Bifunctor)
module Categories.Diagram.Cowedge.Properties {o ℓ e o′ ℓ′ e′} {C : Category o ℓ e} {D : Category o′ ℓ′ e′}
(F : Bifunctor (Category.op C) C D) where
open import Level
open import Categories.Category.Construction.Cocones using (Cocones)
open import Categories.Category.Construction.Cowedges
open import Categories.Category.Construction.TwistedArrow
open import Categories.Category.Equivalence using (StrongEquivalence)
open import Categories.Diagram.Cocone
open import Categories.Diagram.Cowedge
open import Categories.Diagram.Duality
open import Categories.Diagram.Wedge.Properties
open import Categories.Functor hiding (id)
open import Categories.Functor.Instance.Twisted C D
import Categories.Morphism.Reasoning as MR
open import Categories.NaturalTransformation.Dinatural
open import Categories.NaturalTransformation.NaturalIsomorphism using (niHelper)
Cowedge-to-Cocone : (W : Cowedge F) → Cocone (Twist′ F)
Cowedge-to-Cocone W = coCone⇒Cocone D (Wedge-to-Cone (Functor.op F) (Cowedge⇒coWedge D W))
Cocone-to-Cowedge : Cocone (Twist′ F) → Cowedge F
Cocone-to-Cowedge C = coWedge⇒Cowedge D (Cone-to-Wedge (Functor.op F) (Cocone⇒coCone D C))
CooneTwist⇒CowedgeF : Functor (Cocones (Twist′ F)) (Cowedges F)
CooneTwist⇒CowedgeF = record
{ F₀ = Cocone-to-Cowedge
; F₁ = λ co⇒ → record { u = arr co⇒ ; commute = commute co⇒ }
; identity = Equiv.refl
; homomorphism = Equiv.refl
; F-resp-≈ = λ f≈g → f≈g
}
where
open Cocone⇒
open Category D
Cowedge⇒CoconeTwistF : Functor (Cowedges F) (Cocones (Twist′ F))
Cowedge⇒CoconeTwistF = record
{ F₀ = Cowedge-to-Cocone
; F₁ = λ we⇒ → record
{ arr = u we⇒
; commute = pullˡ (commute we⇒)
}
; identity = Equiv.refl
; homomorphism = Equiv.refl
; F-resp-≈ = λ f≈g → f≈g
}
where
open Cowedge
open Cowedge-Morphism
open Category D
open MR D
-- The duality here is not just 'op', so spell out some of it. Note how the proofs need the explicit commutations.
CoconesTwist≅Cowedges : StrongEquivalence (Cocones (Twist′ F)) (Cowedges F)
CoconesTwist≅Cowedges = record
{ F = CooneTwist⇒CowedgeF
; G = Cowedge⇒CoconeTwistF
; weak-inverse = record
{ F∘G≈id = niHelper (record
{ η = λ X → record { u = id ; commute = identityˡ ○ MR.elimʳ D identity }
; η⁻¹ = λ X → record { u = id ; commute = MR.id-comm-sym D ○ (refl⟩∘⟨ Equiv.sym identity) }
; commute = λ _ → MR.id-comm-sym D
; iso = λ _ → record { isoˡ = identity² ; isoʳ = identity² }
})
; G∘F≈id = niHelper record
{ η = λ X → record { arr = id ; commute = λ {Y} → identityˡ ○ Coapex.commute (coapex X) (mor⇒ (MR.elimˡ C C.identity²)) }
; η⁻¹ = λ X → record { arr = id ; commute = λ {Y} → identityˡ ○ Equiv.sym (Coapex.commute (coapex X) (mor⇒ (MR.elimˡ C C.identity²))) }
; commute = λ _ → MR.id-comm-sym D
; iso = λ X → record { isoˡ = identity² ; isoʳ = identity² }
}
}
}
where
module C = Category C
open Category D
open HomReasoning
open Cocone
open Functor F
open Cowedge
open DinaturalTransformation
| {
"alphanum_fraction": 0.6939491377,
"avg_line_length": 36.7849462366,
"ext": "agda",
"hexsha": "7f96aef3c3682caebc37295b10c3a3bef823333a",
"lang": "Agda",
"max_forks_count": 64,
"max_forks_repo_forks_event_max_datetime": "2022-03-14T02:00:59.000Z",
"max_forks_repo_forks_event_min_datetime": "2019-06-02T16:58:15.000Z",
"max_forks_repo_head_hexsha": "d9e4f578b126313058d105c61707d8c8ae987fa8",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "Code-distancing/agda-categories",
"max_forks_repo_path": "src/Categories/Diagram/Cowedge/Properties.agda",
"max_issues_count": 236,
"max_issues_repo_head_hexsha": "d9e4f578b126313058d105c61707d8c8ae987fa8",
"max_issues_repo_issues_event_max_datetime": "2022-03-28T14:31:43.000Z",
"max_issues_repo_issues_event_min_datetime": "2019-06-01T14:53:54.000Z",
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "Code-distancing/agda-categories",
"max_issues_repo_path": "src/Categories/Diagram/Cowedge/Properties.agda",
"max_line_length": 141,
"max_stars_count": 279,
"max_stars_repo_head_hexsha": "d9e4f578b126313058d105c61707d8c8ae987fa8",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "Trebor-Huang/agda-categories",
"max_stars_repo_path": "src/Categories/Diagram/Cowedge/Properties.agda",
"max_stars_repo_stars_event_max_datetime": "2022-03-22T00:40:14.000Z",
"max_stars_repo_stars_event_min_datetime": "2019-06-01T14:36:40.000Z",
"num_tokens": 1165,
"size": 3421
} |
module InstanceArgumentsSections where
postulate A : Set
module Basic where
record B : Set where
field bA : A
open B {{...}}
bA' : B → A
bA' _ = bA
module Parameterised (a : A) where
record C : Set where
field cA : A
open C {{...}}
cA' : C → A
cA' _ = cA
module RecordFromParameterised where
postulate a : A
open Parameterised a
open C {{...}}
cA'' : C → A
cA'' _ = cA
module RecordFromParameterisedInParameterised (a : A) where
open Parameterised a
open C {{...}}
cA'' : C → A
cA'' _ = cA
module RecordFromParameterised' (a : A) where
open Parameterised
open C {{...}}
cA'' : C a → A
cA'' _ = cA a
module AppliedRecord (a : A) where
open Parameterised
D : Set
D = C a
module D = C a
open D {{...}}
dA' : D → A
dA' _ = cA
| {
"alphanum_fraction": 0.5772558714,
"avg_line_length": 13.4833333333,
"ext": "agda",
"hexsha": "97c261688072c9aa0eba1d75c5c3a942fe301c46",
"lang": "Agda",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "aa10ae6a29dc79964fe9dec2de07b9df28b61ed5",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "asr/agda-kanso",
"max_forks_repo_path": "test/succeed/InstanceArgumentsSections.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "aa10ae6a29dc79964fe9dec2de07b9df28b61ed5",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "asr/agda-kanso",
"max_issues_repo_path": "test/succeed/InstanceArgumentsSections.agda",
"max_line_length": 59,
"max_stars_count": null,
"max_stars_repo_head_hexsha": "aa10ae6a29dc79964fe9dec2de07b9df28b61ed5",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "asr/agda-kanso",
"max_stars_repo_path": "test/succeed/InstanceArgumentsSections.agda",
"max_stars_repo_stars_event_max_datetime": null,
"max_stars_repo_stars_event_min_datetime": null,
"num_tokens": 291,
"size": 809
} |
-- MIT License
-- Copyright (c) 2021 Luca Ciccone and Luca Padovani
-- Permission is hereby granted, free of charge, to any person
-- obtaining a copy of this software and associated documentation
-- files (the "Software"), to deal in the Software without
-- restriction, including without limitation the rights to use,
-- copy, modify, merge, publish, distribute, sublicense, and/or sell
-- copies of the Software, and to permit persons to whom the
-- Software is furnished to do so, subject to the following
-- conditions:
-- The above copyright notice and this permission notice shall be
-- included in all copies or substantial portions of the Software.
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-- OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-- HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-- WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-- FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-- OTHER DEALINGS IN THE SOFTWARE.
{-# OPTIONS --guardedness #-}
import Level
open import Data.Empty
open import Data.Product
open import Data.List using (_∷_; []; _++_)
open import Data.List.Properties using (∷-injectiveʳ)
open import Relation.Unary using (Pred; _⊆_; _∈_)
open import Relation.Binary.PropositionalEquality using (_≡_; refl; sym; subst)
open import Common
module TraceSet {ℙ : Set} (message : Message ℙ)
where
open import Trace message
open import SessionType message
open import Transitions message
open import HasTrace message
TraceSet : Set₁
TraceSet = Pred Trace Level.zero
⟦_⟧ : SessionType -> TraceSet
⟦_⟧ = _HasTrace_
_⊆⊇_ : TraceSet -> TraceSet -> Set
X ⊆⊇ Y = X ⊆ Y × Y ⊆ X
PrefixClosed : TraceSet -> Set
PrefixClosed X = ∀{φ ψ} -> ψ ⊑ φ -> X φ -> X ψ
Coherent : TraceSet -> Set
Coherent X = ∀{φ ψ₁ ψ₂ x y} -> X (φ ++ I x ∷ ψ₁) -> X (φ ++ O y ∷ ψ₂) -> ⊥
_∂_ : TraceSet -> Action -> TraceSet
(X ∂ α) φ = X (α ∷ φ)
--| CO-SETS |--
CoSet : TraceSet -> TraceSet
CoSet X φ = X (co-trace φ)
co-set-involution : ∀{X} -> CoSet (CoSet X) ≡ X
co-set-involution {X} =
extensionality λ φ -> subst (λ z -> X z ≡ X φ) (sym (co-trace-involution φ)) refl
co-set-⊆ : ∀{X Y} -> X ⊆ Y -> CoSet X ⊆ CoSet Y
co-set-⊆ sub xcφ = sub xcφ
co-set-right->left : ∀{X Y} -> X ⊆ CoSet Y -> CoSet X ⊆ Y
co-set-right->left {X} {Y} sub xcφ with co-set-⊆ {X} {CoSet Y} sub
... | sub' = subst Y (co-trace-involution _) (sub' xcφ)
co-definition : ∀{X φ} -> φ ∈ X -> co-trace φ ∈ CoSet X
co-definition {_} {φ} xφ rewrite co-trace-involution φ = xφ
co-inversion : ∀{X φ} -> co-trace φ ∈ CoSet X -> φ ∈ X
co-inversion {_} {φ} coφ rewrite co-trace-involution φ = coφ
--| MAXIMAL TRACES |--
data Maximal : TraceSet -> Trace -> Set where
maximal : ∀{X φ} (wit : φ ∈ X) (F : ∀{ψ} -> φ ⊑ ψ -> ψ ∈ X -> ψ ≡ φ) -> Maximal X φ
maximal-sub : ∀{X} -> Maximal X ⊆ X
maximal-sub (maximal x _) = x
derive-maximal : ∀{α φ X} -> α ∷ φ ∈ Maximal X -> φ ∈ Maximal (X ∂ α)
derive-maximal (maximal wit F) = maximal wit λ le p -> ∷-injectiveʳ (F (some le) p)
input-maximal : ∀{x φ f} -> I x ∷ φ ∈ Maximal ⟦ inp f ⟧ -> φ ∈ Maximal ⟦ f x .force ⟧
input-maximal (maximal (_ , def , step inp tr) F) =
maximal (_ , def , tr) λ { le tψ -> ∷-injectiveʳ (F (some le) (inp-has-trace tψ)) }
output-maximal : ∀{x φ f} -> O x ∷ φ ∈ Maximal ⟦ out f ⟧ -> φ ∈ Maximal ⟦ f x .force ⟧
output-maximal (maximal (_ , def , step (out _) tr) F) =
maximal (_ , def , tr) λ { le tψ -> ∷-injectiveʳ (F (some le) (out-has-trace tψ)) }
| {
"alphanum_fraction": 0.6559050773,
"avg_line_length": 34.1886792453,
"ext": "agda",
"hexsha": "452d14988bb5b617f74650a042223d057ad60e78",
"lang": "Agda",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "c4b78e70c3caf68d509f4360b9171d9f80ecb825",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "boystrange/FairSubtypingAgda",
"max_forks_repo_path": "src/TraceSet.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "c4b78e70c3caf68d509f4360b9171d9f80ecb825",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "boystrange/FairSubtypingAgda",
"max_issues_repo_path": "src/TraceSet.agda",
"max_line_length": 86,
"max_stars_count": 4,
"max_stars_repo_head_hexsha": "c4b78e70c3caf68d509f4360b9171d9f80ecb825",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "boystrange/FairSubtypingAgda",
"max_stars_repo_path": "src/TraceSet.agda",
"max_stars_repo_stars_event_max_datetime": "2022-01-24T14:38:47.000Z",
"max_stars_repo_stars_event_min_datetime": "2021-07-29T14:32:30.000Z",
"num_tokens": 1192,
"size": 3624
} |
module Data.List.Relation.Quantification.Proofs where
import Lvl
open import Data.List
open import Data.List.Functions
open import Data.List.Equiv.Id
open import Data.List.Relation.Permutation
open import Data.List.Relation.Quantification
open import Functional
open import Logic.Propositional
open import Logic
open import Structure.Relator.Properties
open import Type.Dependent
open import Type
private variable ℓ : Lvl.Level
private variable T A B C : Type{ℓ}
private variable l l₁ l₂ : List(T)
private variable ll : List(List(T))
private variable x : T
private variable P Q : T → Stmt{ℓ}
private variable Q₂ : A → B → Stmt{ℓ}
private variable _▫_ : T → T → Stmt{ℓ}
AllElements-map : (f : A → B) → (g : A → C) → (∀{x} → P(f(x)) → Q(g(x))) → (AllElements P(map f(l)) → AllElements Q(map g(l)))
AllElements-map {l = ∅} f g pq ∅ = ∅
AllElements-map {l = x ⊰ l} f g pq (p ⊰ ap) = pq p ⊰ AllElements-map f g pq ap
AllElements-mapᵣ : (f : A → B) → (∀{x} → P(x) → Q(f(x))) → (AllElements P l → AllElements Q (map f(l)))
AllElements-mapᵣ = AllElements-map id
AllElements-mapₗ : (f : A → B) → (∀{x} → P(f(x)) → Q(x)) → (AllElements P (map f(l)) → AllElements Q l)
AllElements-mapₗ f = AllElements-map f id
AllElements-fn : (∀{x} → P(x) → Q(x)) → (AllElements P l → AllElements Q l)
AllElements-fn = AllElements-map id id
AllElements-[++] : AllElements P l₁ → AllElements P l₂ → AllElements P (l₁ ++ l₂)
AllElements-[++] {l₁ = ∅} p q = q
AllElements-[++] {l₁ = _ ⊰ _} (x ⊰ p) q = x ⊰ AllElements-[++] p q
AllElements-concat : (AllElements (AllElements P) l → AllElements P (concat l))
AllElements-concat ∅ = ∅
AllElements-concat (p ⊰ pl) = AllElements-[++] p (AllElements-concat pl)
AllElements-concatMap : (f : A → List(B)) → (∀{x} → P(x) → AllElements Q(f(x))) → (AllElements P(l) → AllElements Q(concatMap f(l)))
AllElements-concatMap f pq ∅ = ∅
AllElements-concatMap f pq (x ⊰ p) = AllElements-[++] (pq x) (AllElements-concatMap f pq p)
AllElements-order-independent : ∀{P : T → Type{ℓ}}{l₁ l₂} → (l₁ permutes l₂) → (AllElements P(l₁) → AllElements P(l₂))
AllElements-order-independent _permutes_.empty ∅ = ∅
AllElements-order-independent (_permutes_.prepend perm) (x ⊰ p) = x ⊰ AllElements-order-independent perm p
AllElements-order-independent _permutes_.swap (x ⊰ y ⊰ p) = y ⊰ x ⊰ p
AllElements-order-independent (trans perm₁ perm₂) = AllElements-order-independent perm₂ ∘ AllElements-order-independent perm₁
AllElements-of-transitive-binary-relationₗ : ⦃ trans : Transitivity(_▫_) ⦄ → (l₁ ▫ l₂) → (AllElements (_▫ l₁) ll → AllElements (_▫ l₂) ll)
AllElements-of-transitive-binary-relationₗ _ ∅ = ∅
AllElements-of-transitive-binary-relationₗ {_▫_ = _▫_} p (a ⊰ al) = transitivity(_▫_) a p ⊰ AllElements-of-transitive-binary-relationₗ p al
AllElements-of-transitive-binary-relationᵣ : ⦃ trans : Transitivity(_▫_) ⦄ → (l₂ ▫ l₁) → (AllElements (l₁ ▫_) ll → AllElements (l₂ ▫_) ll)
AllElements-of-transitive-binary-relationᵣ _ ∅ = ∅
AllElements-of-transitive-binary-relationᵣ {_▫_ = _▫_} p (a ⊰ al) = (transitivity(_▫_) p a) ⊰ AllElements-of-transitive-binary-relationᵣ p al
AllElements-sigma : Σ(List(T)) (AllElements(P)) ↔ List(Σ T P)
AllElements-sigma = [↔]-intro L R where
L : Σ(List(T)) (AllElements(P)) ← List(Σ T P)
L ∅ = intro ∅ ∅
L ((intro x p) ⊰ sl) =
let (intro l pl) = L sl
in intro (x ⊰ l) (p ⊰ pl)
R : Σ(List(T)) (AllElements(P)) → List(Σ T P)
R (intro ∅ ∅) = ∅
R (intro (x ⊰ l) (p ⊰ pl)) = intro x p ⊰ R(intro l pl)
| {
"alphanum_fraction": 0.6407847472,
"avg_line_length": 48.2533333333,
"ext": "agda",
"hexsha": "d023c80feddbba23408f4094d9f4d13944c7b5f4",
"lang": "Agda",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "Lolirofle/stuff-in-agda",
"max_forks_repo_path": "Data/List/Relation/Quantification/Proofs.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "Lolirofle/stuff-in-agda",
"max_issues_repo_path": "Data/List/Relation/Quantification/Proofs.agda",
"max_line_length": 143,
"max_stars_count": 6,
"max_stars_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "Lolirofle/stuff-in-agda",
"max_stars_repo_path": "Data/List/Relation/Quantification/Proofs.agda",
"max_stars_repo_stars_event_max_datetime": "2022-02-05T06:53:22.000Z",
"max_stars_repo_stars_event_min_datetime": "2020-04-07T17:58:13.000Z",
"num_tokens": 1241,
"size": 3619
} |
{-# OPTIONS --safe #-}
module Cubical.Data.Int.MoreInts.QuoInt where
open import Cubical.Data.Int.MoreInts.QuoInt.Base public
open import Cubical.Data.Int.MoreInts.QuoInt.Properties public
| {
"alphanum_fraction": 0.7958115183,
"avg_line_length": 27.2857142857,
"ext": "agda",
"hexsha": "a4044824286adb33224fda852328a2f1020a3965",
"lang": "Agda",
"max_forks_count": 134,
"max_forks_repo_forks_event_max_datetime": "2022-03-23T16:22:13.000Z",
"max_forks_repo_forks_event_min_datetime": "2018-11-16T06:11:03.000Z",
"max_forks_repo_head_hexsha": "53e159ec2e43d981b8fcb199e9db788e006af237",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "marcinjangrzybowski/cubical",
"max_forks_repo_path": "Cubical/Data/Int/MoreInts/QuoInt.agda",
"max_issues_count": 584,
"max_issues_repo_head_hexsha": "53e159ec2e43d981b8fcb199e9db788e006af237",
"max_issues_repo_issues_event_max_datetime": "2022-03-30T12:09:17.000Z",
"max_issues_repo_issues_event_min_datetime": "2018-10-15T09:49:02.000Z",
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "marcinjangrzybowski/cubical",
"max_issues_repo_path": "Cubical/Data/Int/MoreInts/QuoInt.agda",
"max_line_length": 62,
"max_stars_count": 301,
"max_stars_repo_head_hexsha": "53e159ec2e43d981b8fcb199e9db788e006af237",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "marcinjangrzybowski/cubical",
"max_stars_repo_path": "Cubical/Data/Int/MoreInts/QuoInt.agda",
"max_stars_repo_stars_event_max_datetime": "2022-03-24T02:10:47.000Z",
"max_stars_repo_stars_event_min_datetime": "2018-10-17T18:00:24.000Z",
"num_tokens": 48,
"size": 191
} |
-- Andreas, 2012-01-11
module Issue551a where
data Box (A : Set) : Set where
[_] : A → Box A
implicit : {A : Set}{{a : A}} -> A
implicit {{a}} = a
postulate
A : Set
.a : A -- this irrelevant definition needs to be ignored by instance search
a' : Box A
a' = [ implicit ]
-- this should fail
| {
"alphanum_fraction": 0.6112956811,
"avg_line_length": 17.7058823529,
"ext": "agda",
"hexsha": "7c8e34eb45aebfb87445e8ec2df53161b236e637",
"lang": "Agda",
"max_forks_count": 1,
"max_forks_repo_forks_event_max_datetime": "2022-03-12T11:35:18.000Z",
"max_forks_repo_forks_event_min_datetime": "2022-03-12T11:35:18.000Z",
"max_forks_repo_head_hexsha": "477c8c37f948e6038b773409358fd8f38395f827",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "larrytheliquid/agda",
"max_forks_repo_path": "test/fail/Issue551a.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "477c8c37f948e6038b773409358fd8f38395f827",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "larrytheliquid/agda",
"max_issues_repo_path": "test/fail/Issue551a.agda",
"max_line_length": 78,
"max_stars_count": null,
"max_stars_repo_head_hexsha": "477c8c37f948e6038b773409358fd8f38395f827",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "larrytheliquid/agda",
"max_stars_repo_path": "test/fail/Issue551a.agda",
"max_stars_repo_stars_event_max_datetime": null,
"max_stars_repo_stars_event_min_datetime": null,
"num_tokens": 102,
"size": 301
} |
------------------------------------------------------------------------
-- The Agda standard library
--
-- Dependent product combinators for setoid equality preserving
-- functions
------------------------------------------------------------------------
{-# OPTIONS --with-K --safe #-}
module Data.Product.Function.Dependent.Setoid.WithK where
open import Data.Product
open import Data.Product.Function.Dependent.Setoid using (surjection)
open import Data.Product.Relation.Binary.Pointwise.Dependent
open import Relation.Binary
open import Function
open import Function.Equality as F using (_⟶_; _⟨$⟩_)
open import Function.Equivalence as Eq
using (Equivalence; _⇔_; module Equivalence)
open import Function.Injection as Inj
using (Injection; Injective; _↣_; module Injection)
open import Function.Inverse as Inv
using (Inverse; _↔_; module Inverse)
open import Function.LeftInverse as LeftInv
using (LeftInverse; _↞_; _LeftInverseOf_; _RightInverseOf_; module LeftInverse)
open import Function.Surjection as Surj
using (Surjection; _↠_; module Surjection)
open import Relation.Binary as B
open import Relation.Binary.Indexed.Heterogeneous
using (IndexedSetoid)
open import Relation.Binary.Indexed.Heterogeneous.Construct.At
using (_atₛ_)
open import Relation.Binary.PropositionalEquality as P using (_≡_)
------------------------------------------------------------------------
-- Combinator for Inverse
module _ {a₁ a₂ b₁ b₁′ b₂ b₂′} {A₁ : Set a₁} {A₂ : Set a₂} where
inverse : {B₁ : IndexedSetoid A₁ b₁ b₁′} (B₂ : IndexedSetoid A₂ b₂ b₂′) →
(A₁↔A₂ : A₁ ↔ A₂) →
(∀ {x} → Inverse (B₁ atₛ x) (B₂ atₛ (Inverse.to A₁↔A₂ ⟨$⟩ x))) →
Inverse (setoid (P.setoid A₁) B₁) (setoid (P.setoid A₂) B₂)
inverse {B₁} B₂ A₁↔A₂ B₁↔B₂ = record
{ to = Surjection.to surj
; from = Surjection.from surj
; inverse-of = record
{ left-inverse-of = left
; right-inverse-of = Surjection.right-inverse-of surj
}
}
where
surj = surjection B₂ (Inverse.surjection A₁↔A₂)
(Inverse.surjection B₁↔B₂)
left : Surjection.from surj LeftInverseOf Surjection.to surj
left (x , y) =
Inverse.left-inverse-of A₁↔A₂ x ,
IndexedSetoid.trans B₁
(lemma (P.sym (Inverse.left-inverse-of A₁↔A₂ x))
(P.sym (Inverse.right-inverse-of A₁↔A₂
(Inverse.to A₁↔A₂ ⟨$⟩ x))))
(Inverse.left-inverse-of B₁↔B₂ y)
where
lemma :
∀ {x x′ y} → x ≡ x′ →
(eq : (Inverse.to A₁↔A₂ ⟨$⟩ x) ≡ (Inverse.to A₁↔A₂ ⟨$⟩ x′)) →
IndexedSetoid._≈_ B₁
(Inverse.from B₁↔B₂ ⟨$⟩ P.subst (IndexedSetoid.Carrier B₂) eq y)
(Inverse.from B₁↔B₂ ⟨$⟩ y)
lemma P.refl P.refl = IndexedSetoid.refl B₁
| {
"alphanum_fraction": 0.6128798842,
"avg_line_length": 38.3888888889,
"ext": "agda",
"hexsha": "1673279d19c4ea24aaba88a62cc1498cbe10c556",
"lang": "Agda",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "0debb886eb5dbcd38dbeebd04b34cf9d9c5e0e71",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "omega12345/agda-mode",
"max_forks_repo_path": "test/asset/agda-stdlib-1.0/Data/Product/Function/Dependent/Setoid/WithK.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "0debb886eb5dbcd38dbeebd04b34cf9d9c5e0e71",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "omega12345/agda-mode",
"max_issues_repo_path": "test/asset/agda-stdlib-1.0/Data/Product/Function/Dependent/Setoid/WithK.agda",
"max_line_length": 81,
"max_stars_count": null,
"max_stars_repo_head_hexsha": "0debb886eb5dbcd38dbeebd04b34cf9d9c5e0e71",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "omega12345/agda-mode",
"max_stars_repo_path": "test/asset/agda-stdlib-1.0/Data/Product/Function/Dependent/Setoid/WithK.agda",
"max_stars_repo_stars_event_max_datetime": null,
"max_stars_repo_stars_event_min_datetime": null,
"num_tokens": 817,
"size": 2764
} |
{-# OPTIONS --cubical --safe #-}
module Categories.Functor where
open import Prelude
open import Categories
record Functor {ℓ₁ ℓ₂ ℓ₃ ℓ₄} (C : PreCategory ℓ₁ ℓ₂) (D : PreCategory ℓ₃ ℓ₄) : Type (ℓ₁ ℓ⊔ ℓ₂ ℓ⊔ ℓ₃ ℓ⊔ ℓ₄) where
private module C = PreCategory C
private module D = PreCategory D
field
F₀ : C.Ob → D.Ob
F₁ : ∀ {X Y} → (X C.⟶ Y) → (F₀ X D.⟶ F₀ Y)
identity : ∀ {X} → F₁ (C.Id {X}) ≡ D.Id
homomorphism : ∀ {X Y Z} → (f : X C.⟶ Y) (g : Y C.⟶ Z) →
F₁ (g C.· f) ≡ F₁ g D.· F₁ f
| {
"alphanum_fraction": 0.5496183206,
"avg_line_length": 29.1111111111,
"ext": "agda",
"hexsha": "f689fa30d9f7a3ee2a69337fe5ab8893bb5c139c",
"lang": "Agda",
"max_forks_count": 1,
"max_forks_repo_forks_event_max_datetime": "2021-01-05T14:05:30.000Z",
"max_forks_repo_forks_event_min_datetime": "2021-01-05T14:05:30.000Z",
"max_forks_repo_head_hexsha": "3c176d4690566d81611080e9378f5a178b39b851",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "oisdk/combinatorics-paper",
"max_forks_repo_path": "agda/Categories/Functor.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "3c176d4690566d81611080e9378f5a178b39b851",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "oisdk/combinatorics-paper",
"max_issues_repo_path": "agda/Categories/Functor.agda",
"max_line_length": 112,
"max_stars_count": 6,
"max_stars_repo_head_hexsha": "3c176d4690566d81611080e9378f5a178b39b851",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "oisdk/combinatorics-paper",
"max_stars_repo_path": "agda/Categories/Functor.agda",
"max_stars_repo_stars_event_max_datetime": "2021-11-16T08:11:34.000Z",
"max_stars_repo_stars_event_min_datetime": "2020-09-11T17:45:41.000Z",
"num_tokens": 244,
"size": 524
} |
------------------------------------------------------------------------
-- Raw terms
------------------------------------------------------------------------
import Level
open import Data.Universe
module README.DependentlyTyped.Raw-term
(Uni₀ : Universe Level.zero Level.zero)
where
open import Data.Nat
import README.DependentlyTyped.Term as Term; open Term Uni₀
open import Relation.Binary.PropositionalEquality as P using (_≡_)
mutual
infixl 9 _·_
infix 5 _∶_
-- Raw types.
data Raw-ty : Set where
⋆ : Raw-ty
el : (t : Raw) → Raw-ty
π : (t₁ t₂ : Raw-ty) → Raw-ty
-- Raw terms.
--
-- One could distinguish between "checkable" and "inferrable" terms,
-- but without a corresponding split for the well-typed terms this
-- seems awkward.
data Raw : Set where
var : (x : ℕ) → Raw
ƛ : (t : Raw) → Raw
_·_ : (t₁ t₂ : Raw) → Raw
-- Type annotation.
_∶_ : (t : Raw) (σ : Raw-ty) → Raw
-- The context position corresponding to a variable.
position : ∀ {Γ σ} → Γ ∋ σ → ℕ
position zero = zero
position (suc x) = suc (position x)
-- Well-typed terms can be turned into raw ones.
⌊_⌋ : ∀ {Γ σ} → Γ ⊢ σ → Raw
⌊ var x ⌋ = var (position x)
⌊ ƛ t ⌋ = ƛ ⌊ t ⌋
⌊ t₁ · t₂ ⌋ = ⌊ t₁ ⌋ · ⌊ t₂ ⌋
-- The same applies to syntactic types.
⌊_⌋ty : ∀ {Γ σ} → Γ ⊢ σ type → Raw-ty
⌊ ⋆ ⌋ty = ⋆
⌊ el t ⌋ty = el ⌊ t ⌋
⌊ π σ′ τ′ ⌋ty = π ⌊ σ′ ⌋ty ⌊ τ′ ⌋ty
mutual
-- The following functions remove type-annotations.
⌊_⌋raw-ty : Raw-ty → Raw-ty
⌊ ⋆ ⌋raw-ty = ⋆
⌊ el t ⌋raw-ty = el ⌊ t ⌋raw
⌊ π t₁ t₂ ⌋raw-ty = π ⌊ t₁ ⌋raw-ty ⌊ t₂ ⌋raw-ty
⌊_⌋raw : Raw → Raw
⌊ var x ⌋raw = var x
⌊ ƛ t ⌋raw = ƛ ⌊ t ⌋raw
⌊ t₁ · t₂ ⌋raw = ⌊ t₁ ⌋raw · ⌊ t₂ ⌋raw
⌊ t ∶ σ ⌋raw = ⌊ t ⌋raw
-- Some congruence lemmas.
position-cong : ∀ {Γ₁ σ₁} {x₁ : Γ₁ ∋ σ₁}
{Γ₂ σ₂} {x₂ : Γ₂ ∋ σ₂} →
x₁ ≅-∋ x₂ → position x₁ ≡ position x₂
position-cong P.refl = P.refl
⌊⌋-cong : ∀ {Γ₁ σ₁} {t₁ : Γ₁ ⊢ σ₁}
{Γ₂ σ₂} {t₂ : Γ₂ ⊢ σ₂} →
t₁ ≅-⊢ t₂ → ⌊ t₁ ⌋ ≡ ⌊ t₂ ⌋
⌊⌋-cong P.refl = P.refl
⌊⌋ty-cong : ∀ {Γ₁ σ₁} {σ′₁ : Γ₁ ⊢ σ₁ type}
{Γ₂ σ₂} {σ′₂ : Γ₂ ⊢ σ₂ type} →
σ′₁ ≅-type σ′₂ → ⌊ σ′₁ ⌋ty ≡ ⌊ σ′₂ ⌋ty
⌊⌋ty-cong P.refl = P.refl
| {
"alphanum_fraction": 0.4946996466,
"avg_line_length": 24.3440860215,
"ext": "agda",
"hexsha": "490ead96b3a092f27ec65c46095fea0014cdd4c5",
"lang": "Agda",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "498f8aefc570f7815fd1d6616508eeb92c52abce",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "nad/dependently-typed-syntax",
"max_forks_repo_path": "README/DependentlyTyped/Raw-term.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "498f8aefc570f7815fd1d6616508eeb92c52abce",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "nad/dependently-typed-syntax",
"max_issues_repo_path": "README/DependentlyTyped/Raw-term.agda",
"max_line_length": 72,
"max_stars_count": 5,
"max_stars_repo_head_hexsha": "498f8aefc570f7815fd1d6616508eeb92c52abce",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "nad/dependently-typed-syntax",
"max_stars_repo_path": "README/DependentlyTyped/Raw-term.agda",
"max_stars_repo_stars_event_max_datetime": "2020-07-08T22:51:36.000Z",
"max_stars_repo_stars_event_min_datetime": "2020-04-16T12:14:44.000Z",
"num_tokens": 1036,
"size": 2264
} |
module FStream.Bisimulation where
open import Library
open import Relation.Binary
open import Relation.Binary.PropositionalEquality
open import Relation.Binary.PropositionalEquality.Core as Core
-- open ≡-Reasoning
open import FStream.Core
mutual
record _~_ {i} {ℓ₁ ℓ₂} {X : Set ℓ₁} {C : Container ℓ₂} (s₁ s₂ : FStream {i} C X) : Set (ℓ₁ ⊔ ℓ₂) where
coinductive
field
sameInitShapes : proj₁ (inF s₁) ≡ proj₁ (inF s₂)
bisim : ∀ pos → proj₂ (inF s₁) pos ~' proj₂ (inF s₂) (subst (Position C) sameInitShapes pos)
record _~'_ {i} {ℓ₁ ℓ₂} {X : Set ℓ₁} {C : Container ℓ₂} (s₁ s₂ : FStream' {i} C X) : Set (ℓ₁ ⊔ ℓ₂) where
coinductive
field
hd∼ : head s₁ ≡ head s₂
tl∼ : ∀ {j : Size< i} → tail s₁ ~ tail s₂
open _~_ public
open _~'_ public
-- alias
_∼_ = _~_
{-
mutual
BisimEquiv : ∀ {i : Size} → IsEquivalence (_~_ {i})
sameInitShapes (IsEquivalence.refl BisimEquiv {x = x}) = refl
bisim (IsEquivalence.refl (BisimEquiv {i}) {x}) {j} pos = IsEquivalence.refl (BisimEquiv' {i})
sameInitShapes (IsEquivalence.sym BisimEquiv x) = sym (sameInitShapes x)
bisim (IsEquivalence.sym (BisimEquiv {i}) {i = s1} {j = s2} x) pos with bisim x pos
... | bla = IsEquivalence.sym BisimEquiv' (subst (λ x₁ → {! !}) lemma x)
where
lemma = begin {! !}
sameInitShapes (IsEquivalence.trans BisimEquiv bisim1 bisim2) = trans (sameInitShapes bisim1) (sameInitShapes bisim2)
bisim (IsEquivalence.trans BisimEquiv bisim1 bisim2) pos = IsEquivalence.trans BisimEquiv' {! !} {! !}
BisimEquiv' : ∀ {i : Size} → IsEquivalence (_~'_ {i})
hd∼ (IsEquivalence.refl BisimEquiv' {x}) = refl
tl∼ (IsEquivalence.refl BisimEquiv' {x}) {j} = IsEquivalence.refl (BisimEquiv {j})
hd∼ (IsEquivalence.sym BisimEquiv' x) = sym (hd∼ x)
tl∼ (IsEquivalence.sym BisimEquiv' x) {j} = IsEquivalence.sym BisimEquiv (tl∼ x)
hd∼ (IsEquivalence.trans BisimEquiv' bisim1 bisim2) = trans (hd∼ bisim1) (hd∼ bisim2)
tl∼ (IsEquivalence.trans BisimEquiv' bisim1 bisim2) {j} = IsEquivalence.trans BisimEquiv (tl∼ bisim1) (tl∼ bisim2)
-}
| {
"alphanum_fraction": 0.6690821256,
"avg_line_length": 40.5882352941,
"ext": "agda",
"hexsha": "56fd7763c9476738e398362e406dd8e3aee17826",
"lang": "Agda",
"max_forks_count": 1,
"max_forks_repo_forks_event_max_datetime": "2019-12-13T15:56:38.000Z",
"max_forks_repo_forks_event_min_datetime": "2019-12-13T15:56:38.000Z",
"max_forks_repo_head_hexsha": "64d95885579395f641e9a9cb1b9487cf79280446",
"max_forks_repo_licenses": [
"Unlicense"
],
"max_forks_repo_name": "zimbatm/condatis",
"max_forks_repo_path": "FStream/Bisimulation.agda",
"max_issues_count": 5,
"max_issues_repo_head_hexsha": "64d95885579395f641e9a9cb1b9487cf79280446",
"max_issues_repo_issues_event_max_datetime": "2020-09-01T16:52:07.000Z",
"max_issues_repo_issues_event_min_datetime": "2017-06-03T20:02:22.000Z",
"max_issues_repo_licenses": [
"Unlicense"
],
"max_issues_repo_name": "zimbatm/condatis",
"max_issues_repo_path": "FStream/Bisimulation.agda",
"max_line_length": 119,
"max_stars_count": 1,
"max_stars_repo_head_hexsha": "64d95885579395f641e9a9cb1b9487cf79280446",
"max_stars_repo_licenses": [
"Unlicense"
],
"max_stars_repo_name": "Aerate/condatis",
"max_stars_repo_path": "FStream/Bisimulation.agda",
"max_stars_repo_stars_event_max_datetime": "2019-12-13T16:52:28.000Z",
"max_stars_repo_stars_event_min_datetime": "2019-12-13T16:52:28.000Z",
"num_tokens": 806,
"size": 2070
} |
data Maybe (A : Set) : Set where
just : A → Maybe A
nothing : Maybe A
data Is-nothing {A} : Maybe A → Set where
nothing : Is-nothing nothing
record ℕ∞ : Set where
coinductive
field
prd∞ : Maybe ℕ∞
open ℕ∞
f : ℕ∞ → ℕ∞
prd∞ (f m) with prd∞ m
prd∞ (f m) | just pm with f pm
prd∞ (f m) | just pm | x = prd∞ x
prd∞ (f m) | nothing = nothing
inf∞ : ℕ∞
prd∞ inf∞ = just inf∞
test : Is-nothing (prd∞ (f inf∞))
test = nothing
| {
"alphanum_fraction": 0.5890410959,
"avg_line_length": 16.8461538462,
"ext": "agda",
"hexsha": "f37ef88b66378ae64b06aee82c2d68b0ff7f6573",
"lang": "Agda",
"max_forks_count": 1,
"max_forks_repo_forks_event_max_datetime": "2015-09-15T14:36:15.000Z",
"max_forks_repo_forks_event_min_datetime": "2015-09-15T14:36:15.000Z",
"max_forks_repo_head_hexsha": "231d6ad8e77b67ff8c4b1cb35a6c31ccd988c3e9",
"max_forks_repo_licenses": [
"BSD-3-Clause"
],
"max_forks_repo_name": "Agda-zh/agda",
"max_forks_repo_path": "test/Fail/Issue3604.agda",
"max_issues_count": 3,
"max_issues_repo_head_hexsha": "ed8ac6f4062ea8a20fa0f62d5db82d4e68278338",
"max_issues_repo_issues_event_max_datetime": "2019-04-01T19:39:26.000Z",
"max_issues_repo_issues_event_min_datetime": "2018-11-14T15:31:44.000Z",
"max_issues_repo_licenses": [
"BSD-3-Clause"
],
"max_issues_repo_name": "shlevy/agda",
"max_issues_repo_path": "test/Fail/Issue3604.agda",
"max_line_length": 41,
"max_stars_count": 2,
"max_stars_repo_head_hexsha": "ed8ac6f4062ea8a20fa0f62d5db82d4e68278338",
"max_stars_repo_licenses": [
"BSD-3-Clause"
],
"max_stars_repo_name": "shlevy/agda",
"max_stars_repo_path": "test/Fail/Issue3604.agda",
"max_stars_repo_stars_event_max_datetime": "2020-09-20T00:28:57.000Z",
"max_stars_repo_stars_event_min_datetime": "2019-10-29T09:40:30.000Z",
"num_tokens": 188,
"size": 438
} |
-- Pattern matching on a (decidably) empty type allows you to omit the
-- right-hand side.
module AbsurdPattern where
data Empty : Set where
elim-Empty : {A : Set} -> Empty -> A
elim-Empty ()
| {
"alphanum_fraction": 0.693877551,
"avg_line_length": 17.8181818182,
"ext": "agda",
"hexsha": "a10908419d42e3f3f77ce9b9b38af6f675337ab6",
"lang": "Agda",
"max_forks_count": 371,
"max_forks_repo_forks_event_max_datetime": "2022-03-30T19:00:30.000Z",
"max_forks_repo_forks_event_min_datetime": "2015-01-03T14:04:08.000Z",
"max_forks_repo_head_hexsha": "231d6ad8e77b67ff8c4b1cb35a6c31ccd988c3e9",
"max_forks_repo_licenses": [
"BSD-3-Clause"
],
"max_forks_repo_name": "Agda-zh/agda",
"max_forks_repo_path": "test/Succeed/AbsurdPattern.agda",
"max_issues_count": 4066,
"max_issues_repo_head_hexsha": "ed8ac6f4062ea8a20fa0f62d5db82d4e68278338",
"max_issues_repo_issues_event_max_datetime": "2022-03-31T21:14:49.000Z",
"max_issues_repo_issues_event_min_datetime": "2015-01-10T11:24:51.000Z",
"max_issues_repo_licenses": [
"BSD-3-Clause"
],
"max_issues_repo_name": "shlevy/agda",
"max_issues_repo_path": "test/Succeed/AbsurdPattern.agda",
"max_line_length": 70,
"max_stars_count": 1989,
"max_stars_repo_head_hexsha": "ed8ac6f4062ea8a20fa0f62d5db82d4e68278338",
"max_stars_repo_licenses": [
"BSD-3-Clause"
],
"max_stars_repo_name": "shlevy/agda",
"max_stars_repo_path": "test/Succeed/AbsurdPattern.agda",
"max_stars_repo_stars_event_max_datetime": "2022-03-30T18:20:48.000Z",
"max_stars_repo_stars_event_min_datetime": "2015-01-09T23:51:16.000Z",
"num_tokens": 54,
"size": 196
} |
{-# OPTIONS --without-K --safe #-}
-- Polynomials over a commutative ring in sparse Horner normal form.
--
-- Much of the implementation is inspired by:
--
-- B. Grégoire and A. Mahboubi, ‘Proving Equalities in a Commutative
-- Ring Done Right in Coq’, in Theorem Proving in Higher Order
-- Logics, Berlin, Heidelberg, 2005, vol. 3603, pp. 98–113.
--
-- The main sources of efficience come from:
--
-- * Careful arrangement of operators to maintain *syntactic equality*.
--
-- * Avoiding of identities (like *1 or +0) with specialised data
-- structures.
open import Polynomial.Parameters
module Polynomial.NormalForm
{c r₁ r₂ r₃}
(homo : Homomorphism c r₁ r₂ r₃)
where
open Homomorphism homo
-- The "injection index" is what allows us to store the nested
-- polynomials sparsely.
open import Polynomial.NormalForm.InjectionIndex public
-- The definition and types for the polynomial.
open import Polynomial.NormalForm.Definition coeffs public
-- Normalizing constructors.
open import Polynomial.NormalForm.Construction coeffs public
-- Definition of arithmetic operations etc.
open import Polynomial.NormalForm.Operations coeffs public
-- "Running" the polynomial on some input.
open import Polynomial.NormalForm.Semantics homo public
| {
"alphanum_fraction": 0.7597454256,
"avg_line_length": 30.6585365854,
"ext": "agda",
"hexsha": "fbc592774280b81a74f677b925eae4f5074aaa09",
"lang": "Agda",
"max_forks_count": 4,
"max_forks_repo_forks_event_max_datetime": "2022-01-20T07:07:11.000Z",
"max_forks_repo_forks_event_min_datetime": "2019-04-16T02:23:16.000Z",
"max_forks_repo_head_hexsha": "f18d9c6bdfae5b4c3ead9a83e06f16a0b7204500",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "mckeankylej/agda-ring-solver",
"max_forks_repo_path": "src/Polynomial/NormalForm.agda",
"max_issues_count": 5,
"max_issues_repo_head_hexsha": "f18d9c6bdfae5b4c3ead9a83e06f16a0b7204500",
"max_issues_repo_issues_event_max_datetime": "2022-03-12T01:55:42.000Z",
"max_issues_repo_issues_event_min_datetime": "2019-04-17T20:48:48.000Z",
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "mckeankylej/agda-ring-solver",
"max_issues_repo_path": "src/Polynomial/NormalForm.agda",
"max_line_length": 71,
"max_stars_count": 36,
"max_stars_repo_head_hexsha": "f18d9c6bdfae5b4c3ead9a83e06f16a0b7204500",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "mckeankylej/agda-ring-solver",
"max_stars_repo_path": "src/Polynomial/NormalForm.agda",
"max_stars_repo_stars_event_max_datetime": "2022-02-15T00:57:55.000Z",
"max_stars_repo_stars_event_min_datetime": "2019-01-25T16:40:52.000Z",
"num_tokens": 310,
"size": 1257
} |
{-# OPTIONS --without-K --safe #-}
open import Relation.Binary.Core
module Definitions
{a ℓ} {A : Set a} -- The underlying set
(_≈_ : Rel A ℓ) -- The underlying equality
where
open import Algebra.Core
open import Data.Product
open import Algebra.Definitions
-- (x²y)x = x²(yx)
JordanIdentity: : Op₂ A → Set _
JordanIdentity: _∙_ = ∀ x y → (((x ∙ x) ∙ y) ∙ x) ≈ (((x ∙ x) ∙ y) ∙ x)
-- x = xyx
PesudoInverse₁ : Op₂ A → Set _
PesudoInverse₁ _∙_ = ∀ x y → ((x ∙ y) ∙ x) ≈ x
-- y = yxy
PseudoInverse₂ : Op₂ A → Set _
PseudoInverse₂ _∙_ = ∀ x y → ((y ∙ x) ∙ y) ≈ y
PseudoInverse : Op₂ A → Set _
PseudoInverse ∙ = (PesudoInverse₁ ∙) × (PseudoInverse₂ ∙)
-- JacobiIdentity is (x ∙ (y ∙ z)) + ((y ∙ (z ∙ x)) + (z ∙ (x ∙ y))) = 0
-- Using the antisymmetry property Jacobi identity may be rewritten as a modification of the associative property
JacobiIdentity : Op₂ A → Op₂ A → Set _
JacobiIdentity _∙_ _-_ = ∀ x y z → (x ∙ (y ∙ z)) ≈ ((y ∙ (z ∙ x)) - (z ∙ (x ∙ y)))
| {
"alphanum_fraction": 0.5940695297,
"avg_line_length": 28.7647058824,
"ext": "agda",
"hexsha": "2e77066fb00a47f4e3f7203da6c0571e7ba93f20",
"lang": "Agda",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "443e831e536b756acbd1afd0d6bae7bc0d288048",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "Akshobhya1234/agda-NonAssociativeAlgebra",
"max_forks_repo_path": "src/Definitions.agda",
"max_issues_count": 2,
"max_issues_repo_head_hexsha": "443e831e536b756acbd1afd0d6bae7bc0d288048",
"max_issues_repo_issues_event_max_datetime": "2021-10-09T08:24:56.000Z",
"max_issues_repo_issues_event_min_datetime": "2021-10-04T05:30:30.000Z",
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "Akshobhya1234/agda-NonAssociativeAlgebra",
"max_issues_repo_path": "src/Definitions.agda",
"max_line_length": 113,
"max_stars_count": 2,
"max_stars_repo_head_hexsha": "443e831e536b756acbd1afd0d6bae7bc0d288048",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "Akshobhya1234/agda-NonAssociativeAlgebra",
"max_stars_repo_path": "src/Definitions.agda",
"max_stars_repo_stars_event_max_datetime": "2021-08-17T09:14:03.000Z",
"max_stars_repo_stars_event_min_datetime": "2021-08-15T06:16:13.000Z",
"num_tokens": 382,
"size": 978
} |
-- We use instance argument to overload the algebraic operations + and
-- * etc.. For example, Ring record here is like what Num class in
-- Haskell. Also like Haskell, we don't require the operations abide
-- by any laws (we can use the algebraic definitions in stdlib if
-- needed).
{-# OPTIONS --without-K --safe #-}
module Typeclasses where
-- ----------------------------------------------------------------------
-- Type classes for Ring.
-- SemiRing typecalss has two operations + and * and two special
-- numbers 0 and 1.
record SemiRing (A : Set) : Set where
infixl 6 _+_
infixl 7 _*_
infixr 8 _^2
field
_+_ : A -> A -> A
_*_ : A -> A -> A
0# : A
1# : A
-- A useful shot-hand.
_^2 : A -> A
x ^2 = x * x
-- A special way to open a module in order to make the fields of the
-- record available as functions taking instance arguments.
open SemiRing {{...}} public
-- Ring typeclass is a subclass of SemiRing typeclass, and has
-- addtitve inverse. Hence we can define subtraction.
record Ring (A : Set) : Set where
infixl 6 _-_
infix 8 -_
field
{{sra}} : SemiRing A
-_ : A -> A
_-_ : A -> A -> A
_-_ x y = x + (- y)
open Ring {{...}} public
-- ----------------------------------------------------------------------
-- Type classes decidable order.
-- We will use orders on ℕ and ℤ simultaneously, so we also overload
-- the comparsion operations using typeclass.
-- Decidable order typeclass. Normally DecEq is a super class of
-- DecOrd, here we don't enforce this, since the main purpose is to
-- overload operators.
open import Relation.Binary using (Rel ; Decidable)
record DecOrd (A : Set) : Set₁ where
infixl 4 _≤_ _<_
infixl 4 _≤?_ _<?_
field
_≤_ : Rel A _
_≤?_ : Decidable _≤_
_<_ : Rel A _
_<?_ : Decidable _<_
open DecOrd {{...}} public
-- ----------------------------------------------------------------------
-- Type classes NonZero and DivMod
-- We will use irrelevant implicit argument to exlude the zero divisor
-- case when defining the partial function "div" and "mod".
record NonZeroTypeclass (A : Set) : Set₁ where
field
NonZero : (a : A) -> Set
open NonZeroTypeclass {{...}} public
-- DivMod typeclass is used to overload _/_ and _%_.
record DivMod (A : Set) : Set₁ where
infixl 7 _/_ _%_
field
{{NZT}} : NonZeroTypeclass A
_/_ : (n d : A) .{{_ : NonZero d}} -> A
_%_ : (n d : A) .{{_ : NonZero d}} -> A
open DivMod {{...}} public
-- ----------------------------------------------------------------------
-- Type classes for Rank (to be used in defining Euclidean structure)
-- Rank record has a rank function that spcifies the rank of the given
-- argument.
import Data.Nat as Nat
record Rank (A : Set) : Set where
field
rank : A -> Nat.ℕ
open Rank {{...}} public
| {
"alphanum_fraction": 0.5789660057,
"avg_line_length": 27.6862745098,
"ext": "agda",
"hexsha": "729216c0acf72a1cee3de3977a5430a39ac1c95b",
"lang": "Agda",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "7e268e8354065fde734c9c2d9998d2cfd4a21f71",
"max_forks_repo_licenses": [
"CC0-1.0"
],
"max_forks_repo_name": "onestruggler/EucDomain",
"max_forks_repo_path": "Typeclasses.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "7e268e8354065fde734c9c2d9998d2cfd4a21f71",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"CC0-1.0"
],
"max_issues_repo_name": "onestruggler/EucDomain",
"max_issues_repo_path": "Typeclasses.agda",
"max_line_length": 73,
"max_stars_count": null,
"max_stars_repo_head_hexsha": "7e268e8354065fde734c9c2d9998d2cfd4a21f71",
"max_stars_repo_licenses": [
"CC0-1.0"
],
"max_stars_repo_name": "onestruggler/EucDomain",
"max_stars_repo_path": "Typeclasses.agda",
"max_stars_repo_stars_event_max_datetime": null,
"max_stars_repo_stars_event_min_datetime": null,
"num_tokens": 783,
"size": 2824
} |
module Tactic.Nat.Subtract where
open import Tactic.Nat.Subtract.Auto public using (autosub-tactic)
open import Tactic.Nat.Subtract.Simplify public using (simplifysub-tactic; simplifygoal-tactic)
open import Tactic.Nat.Subtract.By public using (by-tactic)
open import Tactic.Nat.Subtract.Refute public using (refutesub-tactic)
| {
"alphanum_fraction": 0.8237082067,
"avg_line_length": 41.125,
"ext": "agda",
"hexsha": "1f29250ece6b28d81fa8022b7e781639023e60b8",
"lang": "Agda",
"max_forks_count": 24,
"max_forks_repo_forks_event_max_datetime": "2021-04-22T06:10:41.000Z",
"max_forks_repo_forks_event_min_datetime": "2015-03-12T18:03:45.000Z",
"max_forks_repo_head_hexsha": "158d299b1b365e186f00d8ef5b8c6844235ee267",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "L-TChen/agda-prelude",
"max_forks_repo_path": "src/Tactic/Nat/Subtract.agda",
"max_issues_count": 59,
"max_issues_repo_head_hexsha": "158d299b1b365e186f00d8ef5b8c6844235ee267",
"max_issues_repo_issues_event_max_datetime": "2022-01-14T07:32:36.000Z",
"max_issues_repo_issues_event_min_datetime": "2016-02-09T05:36:44.000Z",
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "L-TChen/agda-prelude",
"max_issues_repo_path": "src/Tactic/Nat/Subtract.agda",
"max_line_length": 95,
"max_stars_count": 111,
"max_stars_repo_head_hexsha": "158d299b1b365e186f00d8ef5b8c6844235ee267",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "L-TChen/agda-prelude",
"max_stars_repo_path": "src/Tactic/Nat/Subtract.agda",
"max_stars_repo_stars_event_max_datetime": "2022-02-12T23:29:26.000Z",
"max_stars_repo_stars_event_min_datetime": "2015-01-05T11:28:15.000Z",
"num_tokens": 88,
"size": 329
} |
module Acme.Data.Nat where
open import Acme.Type
ℕ : Type
isZ : Type
isS : Type
ℕ cs = isZ cs || isS cs
isZ [] = false
isZ (c ∷ cs) = c == 'Z' && isNil cs
isS [] = false
isS (c ∷ cs) = c == 'S' && ℕ cs
zero = ℕ ∋ "Z"
suc : Elt ℕ → Elt ℕ
suc [ n ] = [ 'S' ∷ n ]
one = ℕ ∋ "SZ"
two = suc (suc zero)
three = ℕ ∋ "SSSZ"
four = suc three
module _ (P : Elt ℕ → Set)
(P0 : P zero)
(PS : ∀ n → P n → P (suc n))
where
induction : ∀ n → P n
induction [ ccs@(c ∷ cs) ] = checkZ (c ≟ 'Z') cs refl where
checkS : ∀ {b} → Reflects c 'S' b → ∀ cs →
{{@0 _ : IsTrue (b && ℕ cs)}} →
∀ {ccs} → c ∷ cs ≡ ccs .value → P ccs
checkS true cs refl = PS [ cs ] (induction [ cs ])
checkZ : ∀ {b} → Reflects c 'Z' b → ∀ cs →
{{@0 _ : IsTrue (b && isNil cs || isS (c ∷ cs))}} →
∀ {ccs} → c ∷ cs ≡ ccs .value → P ccs
checkZ true [] refl = P0
checkZ false cs eq = checkS (c ≟ 'S') cs eq
_ : ∀ {P P0 PS} → induction P P0 PS zero ≡ P0
_ = refl
_ : ∀ {P P0 PS n} →
induction P P0 PS (suc n) ≡ PS n (induction P P0 PS n)
_ = refl
_+_ : Elt ℕ → Elt ℕ → Elt ℕ
m + n = induction (λ _ → Elt ℕ) n (λ _ → suc) m
_ : three + one ≡ four
_ = refl
_*_ : Elt ℕ → Elt ℕ → Elt ℕ
m * n = induction (λ _ → Elt ℕ) zero (λ _ → n +_) m
_ : two * three ≡ four + two
_ = refl
zero-+ : ∀ m → zero + m ≡ m
zero-+ m = refl
+-zero : ∀ m → m + zero ≡ m
+-zero =
induction
(λ m → m + zero ≡ m)
refl
(λ n → cong suc)
suc-+ : ∀ m n → suc m + n ≡ suc (m + n)
suc-+ m n = refl
+-suc : ∀ m n → m + suc n ≡ suc (m + n)
+-suc m n =
induction
(λ m → (m + suc n) ≡ suc (m + n))
refl
(λ n → cong suc)
m
+-comm : ∀ m n → m + n ≡ n + m
+-comm m n =
induction
(λ m → m + n ≡ n + m)
(sym (+-zero n))
(λ m ih → trans (cong suc ih) (sym (+-suc n m)))
m
+-assoc : ∀ m n p → (m + n) + p ≡ m + (n + p)
+-assoc m n p =
induction
(λ m → ((m + n) + p) ≡ (m + (n + p)))
refl
(λ m → cong suc)
m
| {
"alphanum_fraction": 0.4464197531,
"avg_line_length": 19.8529411765,
"ext": "agda",
"hexsha": "c05693975d6fefc20321fecce10129ab45e847d0",
"lang": "Agda",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "9e83fe708271b4437ae4e259175397d96d10aaf6",
"max_forks_repo_licenses": [
"CC0-1.0"
],
"max_forks_repo_name": "gallais/STRINaGda",
"max_forks_repo_path": "src/Acme/Data/Nat.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "9e83fe708271b4437ae4e259175397d96d10aaf6",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"CC0-1.0"
],
"max_issues_repo_name": "gallais/STRINaGda",
"max_issues_repo_path": "src/Acme/Data/Nat.agda",
"max_line_length": 64,
"max_stars_count": 2,
"max_stars_repo_head_hexsha": "9e83fe708271b4437ae4e259175397d96d10aaf6",
"max_stars_repo_licenses": [
"CC0-1.0"
],
"max_stars_repo_name": "gallais/STRINaGda",
"max_stars_repo_path": "src/Acme/Data/Nat.agda",
"max_stars_repo_stars_event_max_datetime": "2021-04-01T20:56:37.000Z",
"max_stars_repo_stars_event_min_datetime": "2018-02-14T22:26:17.000Z",
"num_tokens": 871,
"size": 2025
} |
module Agda.Builtin.List where
infixr 5 _∷_
data List {a} (A : Set a) : Set a where
[] : List A
_∷_ : (x : A) (xs : List A) → List A
{-# BUILTIN LIST List #-}
{-# BUILTIN NIL [] #-}
{-# BUILTIN CONS _∷_ #-}
{-# HASKELL type AgdaList a b = [b] #-}
{-# COMPILED_DATA List MAlonzo.Code.Agda.Builtin.List.AgdaList [] (:) #-}
{-# COMPILED_DATA_UHC List __LIST__ __NIL__ __CONS__ #-}
| {
"alphanum_fraction": 0.5954198473,
"avg_line_length": 21.8333333333,
"ext": "agda",
"hexsha": "98958ab72550008d3c4c71388cf9e9f246ccdb4f",
"lang": "Agda",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "c0ae7d20728b15d7da4efff6ffadae6fe4590016",
"max_forks_repo_licenses": [
"BSD-3-Clause"
],
"max_forks_repo_name": "redfish64/autonomic-agda",
"max_forks_repo_path": "src/data/lib/prim/Agda/Builtin/List.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "c0ae7d20728b15d7da4efff6ffadae6fe4590016",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"BSD-3-Clause"
],
"max_issues_repo_name": "redfish64/autonomic-agda",
"max_issues_repo_path": "src/data/lib/prim/Agda/Builtin/List.agda",
"max_line_length": 73,
"max_stars_count": null,
"max_stars_repo_head_hexsha": "c0ae7d20728b15d7da4efff6ffadae6fe4590016",
"max_stars_repo_licenses": [
"BSD-3-Clause"
],
"max_stars_repo_name": "redfish64/autonomic-agda",
"max_stars_repo_path": "src/data/lib/prim/Agda/Builtin/List.agda",
"max_stars_repo_stars_event_max_datetime": null,
"max_stars_repo_stars_event_min_datetime": null,
"num_tokens": 142,
"size": 393
} |
{-# OPTIONS --cubical --no-import-sorts --safe #-}
module Cubical.DStructures.Structures.Strict2Group where
open import Cubical.Foundations.Prelude
open import Cubical.Foundations.Equiv
open import Cubical.Foundations.HLevels
open import Cubical.Foundations.Isomorphism
open import Cubical.Functions.FunExtEquiv
open import Cubical.Homotopy.Base
open import Cubical.Data.Sigma
open import Cubical.Data.Unit
open import Cubical.Relation.Binary
open import Cubical.Algebra.Group
open import Cubical.Structures.LeftAction
open import Cubical.DStructures.Base
open import Cubical.DStructures.Meta.Properties
open import Cubical.DStructures.Structures.Constant
open import Cubical.DStructures.Structures.Type
open import Cubical.DStructures.Structures.Group
open import Cubical.DStructures.Structures.ReflGraph
open import Cubical.DStructures.Structures.VertComp
private
variable
ℓ ℓ' : Level
module _ (ℓ ℓ' : Level) where
private
ℓℓ' = ℓ-max ℓ ℓ'
𝒮ᴰ-Strict2Group : URGStrᴰ (𝒮-ReflGraph ℓ ℓ')
VertComp
ℓ-zero
𝒮ᴰ-Strict2Group = Subtype→Sub-𝒮ᴰ (λ 𝒢 → VertComp 𝒢 , isPropVertComp 𝒢)
(𝒮-ReflGraph ℓ ℓ')
Strict2Group : Type (ℓ-suc ℓℓ')
Strict2Group = Σ[ 𝒢 ∈ ReflGraph ℓ ℓ' ] VertComp 𝒢
record S2G : Type (ℓ-suc ℓℓ') where
no-eta-equality
field
G₀ : Group {ℓ}
G₁ : Group {ℓ'}
σ : GroupHom G₁ G₀
τ : GroupHom G₁ G₀
ι : GroupHom G₀ G₁
split-σ : isGroupSplitEpi ι σ
split-τ : isGroupSplitEpi ι τ
V : VertComp (((((G₀ , G₁) , ι , σ) , split-σ) , τ) , split-τ)
{-
open S2G
make-S2G : {G₀ : Group {ℓ}} {G₁ : Group {ℓ'}}
→ (σ τ : GroupHom G₁ G₀)
→ (ι : GroupHom G₀ G₁)
→ (split-σ : isGroupSplitEpi ι σ)
→ (split-τ : isGroupSplitEpi ι τ)
→ VertComp (((((G₀ , G₁) , ι , σ) , split-σ) , τ) , split-τ)
→ S2G
make-S2G = {!!}
Group→S2G : Group {ℓ} → S2G ℓ ℓ
Group→S2G G .G₀ = G
Group→S2G G .G₁ = G
Group→S2G G .σ = idGroupHom G
Group→S2G G .τ = idGroupHom G
Group→S2G G .ι = idGroupHom G
Group→S2G G .split-σ = GroupMorphismExt (λ _ → refl)
Group→S2G G .split-τ = GroupMorphismExt (λ _ → refl)
Group→S2G G .V = {!!}
-}
| {
"alphanum_fraction": 0.64329806,
"avg_line_length": 26.6823529412,
"ext": "agda",
"hexsha": "08436ac59ba2451b647ea0fb5e2e1aab9388a31c",
"lang": "Agda",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "c345dc0c49d3950dc57f53ca5f7099bb53a4dc3a",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "Schippmunk/cubical",
"max_forks_repo_path": "Cubical/DStructures/Structures/Strict2Group.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "c345dc0c49d3950dc57f53ca5f7099bb53a4dc3a",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "Schippmunk/cubical",
"max_issues_repo_path": "Cubical/DStructures/Structures/Strict2Group.agda",
"max_line_length": 73,
"max_stars_count": null,
"max_stars_repo_head_hexsha": "c345dc0c49d3950dc57f53ca5f7099bb53a4dc3a",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "Schippmunk/cubical",
"max_stars_repo_path": "Cubical/DStructures/Structures/Strict2Group.agda",
"max_stars_repo_stars_event_max_datetime": null,
"max_stars_repo_stars_event_min_datetime": null,
"num_tokens": 803,
"size": 2268
} |
{-# OPTIONS --without-K --rewriting #-}
open import HoTT
open import groups.Cokernel
open import cohomology.Theory
open import cw.CW
module cw.cohomology.HigherCoboundary {i} (OT : OrdinaryTheory i)
{n} (⊙skel : ⊙Skeleton {i} (S (S n))) where
open OrdinaryTheory OT
open import cw.cohomology.WedgeOfCells OT
open import cw.cohomology.GridLongExactSequence cohomology-theory
(ℕ-to-ℤ (S n)) (⊙cw-incl-last (⊙cw-init ⊙skel)) (⊙cw-incl-last ⊙skel)
cw-co∂-last : CXₙ/Xₙ₋₁ (⊙cw-init ⊙skel) (ℕ-to-ℤ (S n)) →ᴳ CXₙ/Xₙ₋₁ ⊙skel (ℕ-to-ℤ (S (S n)))
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
| {
"alphanum_fraction": 0.6844319776,
"avg_line_length": 28.52,
"ext": "agda",
"hexsha": "21d8f1c7619cec7c75932961656cca0a3fb40e87",
"lang": "Agda",
"max_forks_count": 1,
"max_forks_repo_forks_event_max_datetime": "2018-12-26T21:31:57.000Z",
"max_forks_repo_forks_event_min_datetime": "2018-12-26T21:31:57.000Z",
"max_forks_repo_head_hexsha": "e7d663b63d89f380ab772ecb8d51c38c26952dbb",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "mikeshulman/HoTT-Agda",
"max_forks_repo_path": "theorems/cw/cohomology/HigherCoboundary.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "e7d663b63d89f380ab772ecb8d51c38c26952dbb",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "mikeshulman/HoTT-Agda",
"max_issues_repo_path": "theorems/cw/cohomology/HigherCoboundary.agda",
"max_line_length": 91,
"max_stars_count": null,
"max_stars_repo_head_hexsha": "e7d663b63d89f380ab772ecb8d51c38c26952dbb",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "mikeshulman/HoTT-Agda",
"max_stars_repo_path": "theorems/cw/cohomology/HigherCoboundary.agda",
"max_stars_repo_stars_event_max_datetime": null,
"max_stars_repo_stars_event_min_datetime": null,
"num_tokens": 310,
"size": 713
} |
-- The "intro" command manages to refine goals of type ∞ A with the
-- term ♯ ?.
module IntroSharp where
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 = ?
| {
"alphanum_fraction": 0.4846625767,
"avg_line_length": 19.1764705882,
"ext": "agda",
"hexsha": "e64c9b3c314a3fa4761d3c9754638312c14c32d1",
"lang": "Agda",
"max_forks_count": 371,
"max_forks_repo_forks_event_max_datetime": "2022-03-30T19:00:30.000Z",
"max_forks_repo_forks_event_min_datetime": "2015-01-03T14:04:08.000Z",
"max_forks_repo_head_hexsha": "231d6ad8e77b67ff8c4b1cb35a6c31ccd988c3e9",
"max_forks_repo_licenses": [
"BSD-3-Clause"
],
"max_forks_repo_name": "Agda-zh/agda",
"max_forks_repo_path": "test/interaction/IntroSharp.agda",
"max_issues_count": 4066,
"max_issues_repo_head_hexsha": "ed8ac6f4062ea8a20fa0f62d5db82d4e68278338",
"max_issues_repo_issues_event_max_datetime": "2022-03-31T21:14:49.000Z",
"max_issues_repo_issues_event_min_datetime": "2015-01-10T11:24:51.000Z",
"max_issues_repo_licenses": [
"BSD-3-Clause"
],
"max_issues_repo_name": "shlevy/agda",
"max_issues_repo_path": "test/interaction/IntroSharp.agda",
"max_line_length": 67,
"max_stars_count": 1989,
"max_stars_repo_head_hexsha": "ed8ac6f4062ea8a20fa0f62d5db82d4e68278338",
"max_stars_repo_licenses": [
"BSD-3-Clause"
],
"max_stars_repo_name": "shlevy/agda",
"max_stars_repo_path": "test/interaction/IntroSharp.agda",
"max_stars_repo_stars_event_max_datetime": "2022-03-30T18:20:48.000Z",
"max_stars_repo_stars_event_min_datetime": "2015-01-09T23:51:16.000Z",
"num_tokens": 135,
"size": 326
} |
module par-swap.dpg-e-view where
open import par-swap
open import par-swap.properties
open import par-swap.confluent
open import par-swap.dpg-pot
open import utility
open import Esterel.Lang
open import Esterel.Lang.Binding
open import Esterel.Lang.Properties
open import Esterel.Lang.CanFunction
open import Esterel.Lang.CanFunction.Plug
open import Esterel.Environment as Env
open import Esterel.Context
open import Data.Product
open import Data.Sum
open import Data.Bool
open import Data.List using ([] ; [_] ; _∷_ ; List ; _++_)
open import Data.Empty
open import sn-calculus
open import context-properties -- get view, E-views
DPG-E-view :
∀ {E C r₁ r₂ p q θ θ' pin qin A A'} ->
(peq : p ≐ E ⟦ pin ⟧e) ->
(qeq : q ≐ E ⟦ qin ⟧e) ->
p ≐ C ⟦ r₁ ∥ r₂ ⟧c ->
(psn⟶₁q : ρ⟨ θ , A ⟩· p sn⟶₁ ρ⟨ θ' , A' ⟩· q) ->
->E-view psn⟶₁q peq qeq ->
Σ[ d ∈ Term ]
Σ[ sn⟶₁d ∈ ρ⟨ θ , A ⟩· C ⟦ r₂ ∥ r₁ ⟧c sn⟶₁ ρ⟨ θ' , A' ⟩· d ]
Σ[ ∥Rd ∈ q ∥R* d ]
Σ[ E′ ∈ List EvaluationContext1 ]
Σ[ pin′ ∈ Term ]
Σ[ qin′ ∈ Term ]
Σ[ peq′ ∈ C ⟦ r₂ ∥ r₁ ⟧c ≐ E′ ⟦ pin′ ⟧e ]
Σ[ qeq′ ∈ d ≐ E′ ⟦ qin′ ⟧e ]
->E-view sn⟶₁d peq′ qeq′
DPG-E-view dehole dehole dchole psn⟶₁q ()
DPG-E-view dehole dehole (dcpar₁ pC) psn⟶₁q ()
DPG-E-view dehole dehole (dcpar₂ pC) psn⟶₁q ()
DPG-E-view dehole dehole (dcseq₁ pC) psn⟶₁q ()
DPG-E-view dehole dehole (dcseq₂ pC) psn⟶₁q ()
DPG-E-view dehole dehole (dcsuspend pC) psn⟶₁q ()
DPG-E-view dehole dehole (dctrap pC) psn⟶₁q ()
DPG-E-view dehole dehole (dcsignl pC) psn⟶₁q ()
DPG-E-view dehole dehole (dcloop pC) psn⟶₁q ()
DPG-E-view dehole dehole (dcloopˢ₁ pC) psn⟶₁q ()
DPG-E-view dehole dehole (dcloopˢ₂ pC) psn⟶₁q ()
DPG-E-view dehole dehole (dcpresent₁ pC)
(ris-present S∈ s[θ]≡p dehole)
vis-present
= _ , ris-present S∈ s[θ]≡p dehole , ∥Rn (∥Rstep pC) ∥R0 ,
_ , _ , _ , dehole , dehole , vis-present
DPG-E-view dehole dehole (dcpresent₁ pC)
(ris-absent S∈ s[θ]≡p dehole)
vis-absent
= _ , ris-absent S∈ s[θ]≡p dehole , ∥R0 ,
_ , _ , _ , dehole , dehole , vis-absent
DPG-E-view dehole dehole (dcpresent₂ pC)
(ris-present S∈ s[θ]≡a dehole)
vis-present
= _ , ris-present S∈ s[θ]≡a dehole , ∥R0 ,
_ , _ , _ , dehole , dehole , vis-present
DPG-E-view dehole dehole (dcpresent₂ pC)
(ris-absent S∈ s[θ]≡a dehole)
vis-absent
= _ , ris-absent S∈ s[θ]≡a dehole , ∥Rn (∥Rstep pC) ∥R0 ,
_ , _ , _ , dehole , dehole , vis-absent
DPG-E-view dehole dehole (dcshared pC)
(rraise-shared allready dehole)
vraise-shared
= _ , rraise-shared allready dehole ,
Context1-∥R* (cenv _ _) (∥Rn (∥Rstep pC) ∥R0) ,
_ , _ , _ , dehole , dehole , vraise-shared
DPG-E-view dehole dehole (dcvar pC)
(rraise-var allready dehole)
vraise-var
= _ , rraise-var allready dehole ,
Context1-∥R* (cenv _ _) (∥Rn (∥Rstep pC) ∥R0) ,
_ , _ , _ , dehole , dehole , vraise-var
DPG-E-view dehole dehole (dcif₁ pC)
(rif-false x∈ x[θ]≡0 dehole)
vif-false
= _ , rif-false x∈ x[θ]≡0 dehole , ∥R0 ,
_ , _ , _ , dehole , dehole , vif-false
DPG-E-view dehole dehole (dcif₁ pC)
(rif-true x∈ x[θ]≡s dehole)
vif-true
= _ , rif-true x∈ x[θ]≡s dehole , ∥Rn (∥Rstep pC) ∥R0 ,
_ , _ , _ , dehole , dehole , vif-true
DPG-E-view dehole dehole (dcif₂ pC)
(rif-false x∈ x[θ]≡0 dehole)
vif-false
= _ , rif-false x∈ x[θ]≡0 dehole , ∥Rn (∥Rstep pC) ∥R0 ,
_ , _ , _ , dehole , dehole , vif-false
DPG-E-view dehole dehole (dcif₂ pC)
(rif-true x∈ x[θ]≡s dehole)
vif-true
= _ , rif-true x∈ x[θ]≡s dehole , ∥R0 ,
_ , _ , _ , dehole , dehole , vif-true
DPG-E-view dehole dehole (dcenv pC)
(rmerge dehole)
vmerge
= _ , rmerge dehole , ∥Rn (∥Rstep pC) ∥R0 ,
_ , _ , _ , dehole , dehole , vmerge
DPG-E-view (depar₁ pE) (depar₁ qE) dchole psn⟶₁q E-view
with unwrap-rho psn⟶₁q (depar₁ pE) (depar₁ qE) pE qE E-view
... | (redo-sub , E-view-sub)
with wrap-rho redo-sub pE qE E-view-sub
_ (depar₂ pE) (depar₂ qE)
... | (redo′ , E-view′)
= _ , redo′ , ∥Rn (∥Rstep dchole) ∥R0 ,
_ , _ , _ , depar₂ pE , depar₂ qE , E-view′
DPG-E-view (depar₂ pE) (depar₂ qE) dchole psn⟶₁q E-view
with unwrap-rho psn⟶₁q (depar₂ pE) (depar₂ qE) pE qE E-view
... | (redo-sub , E-view-sub)
with wrap-rho redo-sub pE qE E-view-sub
_ (depar₁ pE) (depar₁ qE)
... | (redo′ , E-view′)
= _ , redo′ , ∥Rn (∥Rstep dchole) ∥R0 ,
_ , _ , _ , depar₁ pE , depar₁ qE , E-view′
DPG-E-view {e ∷ _} (depar₁ pE) (depar₁ qE) (dcpar₁ pC) psn⟶₁q E-view
with unwrap-rho psn⟶₁q (depar₁ pE) (depar₁ qE) pE qE E-view
... | (redo-sub , E-view-sub)
with DPG-E-view pE qE pC redo-sub E-view-sub
... | (ds , pssn⟶₁ds , qs∥Rds , _ , _ , _ , pE′ , qE′ , E-view-sub′)
with wrap-rho pssn⟶₁ds pE′ qE′ E-view-sub′ _ (depar₁ pE′) (depar₁ qE′)
... | (redo , E-view′)
= _ , redo , Context1-∥R* (ceval e) qs∥Rds ,
_ , _ , _ , depar₁ pE′ , depar₁ qE′ , E-view′
DPG-E-view {e ∷ _} (depar₂ pE) (depar₂ qE) (dcpar₂ pC) psn⟶₁q E-view
with unwrap-rho psn⟶₁q (depar₂ pE) (depar₂ qE) pE qE E-view
... | (redo-sub , E-view-sub)
with DPG-E-view pE qE pC redo-sub E-view-sub
... | (ds , pssn⟶₁ds , qs∥Rds , _ , _ , _ , pE′ , qE′ , E-view-sub′)
with wrap-rho pssn⟶₁ds pE′ qE′ E-view-sub′ _ (depar₂ pE′) (depar₂ qE′)
... | (redo , E-view′)
= _ , redo , Context1-∥R* (ceval e) qs∥Rds ,
_ , _ , _ , depar₂ pE′ , depar₂ qE′ , E-view′
DPG-E-view {e ∷ _} (desuspend pE) (desuspend qE) (dcsuspend pC) psn⟶₁q E-view
with unwrap-rho psn⟶₁q (desuspend pE) (desuspend qE) pE qE E-view
... | (redo-sub , E-view-sub)
with DPG-E-view pE qE pC redo-sub E-view-sub
... | (ds , pssn⟶₁ds , qs∥Rds , _ , _ , _ , pE′ , qE′ , E-view-sub′)
with wrap-rho pssn⟶₁ds pE′ qE′ E-view-sub′ _ (desuspend pE′) (desuspend qE′)
... | (redo , E-view′)
= _ , redo , Context1-∥R* (ceval e) qs∥Rds ,
_ , _ , _ , desuspend pE′ , desuspend qE′ , E-view′
DPG-E-view {e ∷ _} (detrap pE) (detrap qE) (dctrap pC) psn⟶₁q E-view
with unwrap-rho psn⟶₁q (detrap pE) (detrap qE) pE qE E-view
... | (redo-sub , E-view-sub)
with DPG-E-view pE qE pC redo-sub E-view-sub
... | (ds , pssn⟶₁ds , qs∥Rds , _ , _ , _ , pE′ , qE′ , E-view-sub′)
with wrap-rho pssn⟶₁ds pE′ qE′ E-view-sub′ _ (detrap pE′) (detrap qE′)
... | (redo , E-view′)
= _ , redo , Context1-∥R* (ceval e) qs∥Rds ,
_ , _ , _ , detrap pE′ , detrap qE′ , E-view′
DPG-E-view {e ∷ _} (deseq pE) (deseq qE) (dcseq₁ pC) psn⟶₁q E-view
with unwrap-rho psn⟶₁q (deseq pE) (deseq qE) pE qE E-view
... | (redo-sub , E-view-sub)
with DPG-E-view pE qE pC redo-sub E-view-sub
... | (ds , pssn⟶₁ds , qs∥Rds , _ , _ , _ , pE′ , qE′ , E-view-sub′)
with wrap-rho pssn⟶₁ds pE′ qE′ E-view-sub′ _ (deseq pE′) (deseq qE′)
... | (redo , E-view′)
= _ , redo , Context1-∥R* (ceval e) qs∥Rds ,
_ , _ , _ , deseq pE′ , deseq qE′ , E-view′
DPG-E-view {e ∷ _} (deloopˢ pE) (deloopˢ qE) (dcloopˢ₁ pC) psn⟶₁q E-view
with unwrap-rho psn⟶₁q (deloopˢ pE) (deloopˢ qE) pE qE E-view
... | (redo-sub , E-view-sub)
with DPG-E-view pE qE pC redo-sub E-view-sub
... | (ds , pssn⟶₁ds , qs∥Rds , _ , _ , _ , pE′ , qE′ , E-view-sub′)
with wrap-rho pssn⟶₁ds pE′ qE′ E-view-sub′ _ (deloopˢ pE′) (deloopˢ qE′)
... | (redo , E-view′)
= _ , redo , Context1-∥R* (ceval e) qs∥Rds ,
_ , _ , _ , deloopˢ pE′ , deloopˢ qE′ , E-view′
DPG-E-view{_}{_}{r₁}{r₂} (depar₁ pE) (depar₁ qE) (dcpar₂{C = C} pC) psn⟶₁q E-view
with unwrap-rho psn⟶₁q (depar₁ pE) (depar₁ qE) pE qE E-view
... | (redo-sub , E-view-sub)
with wrap-rho redo-sub pE qE E-view-sub
(epar₁ (C ⟦ r₂ ∥ r₁ ⟧c))
(depar₁ pE) (depar₁ qE)
... | (redo′ , E-view′)
= _ , redo′ , ∥Rn (Context1-∥R (ceval (epar₂ _)) (∥Rstep pC)) ∥R0 ,
_ , _ , _ , depar₁ pE , depar₁ qE , E-view′
DPG-E-view{_}{_}{r₁}{r₂} (depar₂ pE) (depar₂ qE) (dcpar₁{C = C} pC) psn⟶₁q E-view
with unwrap-rho psn⟶₁q (depar₂ pE) (depar₂ qE) pE qE E-view
... | (redo-sub , E-view-sub)
with wrap-rho redo-sub pE qE E-view-sub
(epar₂ (C ⟦ r₂ ∥ r₁ ⟧c))
(depar₂ pE) (depar₂ qE)
... | (redo′ , E-view′)
= _ , redo′ , ∥Rn (Context1-∥R (ceval (epar₁ _)) (∥Rstep pC)) ∥R0 ,
_ , _ , _ , depar₂ pE , depar₂ qE , E-view′
DPG-E-view{_}{_}{r₁}{r₂} (deseq pE) (deseq qE) (dcseq₂{C = C} pC) psn⟶₁q E-view
with unwrap-rho psn⟶₁q (deseq pE) (deseq qE) pE qE E-view
... | (redo-sub , E-view-sub)
with wrap-rho redo-sub pE qE E-view-sub
(eseq (C ⟦ r₂ ∥ r₁ ⟧c))
(deseq pE) (deseq qE)
... | (redo′ , E-view′)
= _ , redo′ , ∥Rn (Context1-∥R (cseq₂ _) (∥Rstep pC)) ∥R0 ,
_ , _ , _ , deseq pE , deseq qE , E-view′
DPG-E-view{_}{_}{r₁}{r₂} (deloopˢ pE) (deloopˢ qE) (dcloopˢ₂{C = C} pC) psn⟶₁q E-view
with unwrap-rho psn⟶₁q (deloopˢ pE) (deloopˢ qE) pE qE E-view
... | (redo-sub , E-view-sub)
with wrap-rho redo-sub pE qE E-view-sub
(eloopˢ (C ⟦ r₂ ∥ r₁ ⟧c))
(deloopˢ pE) (deloopˢ qE)
... | (redo′ , E-view′)
= _ , redo′ , ∥Rn (Context1-∥R (cloopˢ₂ _) (∥Rstep pC)) ∥R0 ,
_ , _ , _ , deloopˢ pE , deloopˢ qE , E-view′
| {
"alphanum_fraction": 0.5783861038,
"avg_line_length": 38.3797468354,
"ext": "agda",
"hexsha": "9ad1ae079ecdb013d8fbe5b27f71166e911e1c21",
"lang": "Agda",
"max_forks_count": 1,
"max_forks_repo_forks_event_max_datetime": "2020-04-15T20:02:49.000Z",
"max_forks_repo_forks_event_min_datetime": "2020-04-15T20:02:49.000Z",
"max_forks_repo_head_hexsha": "4340bef3f8df42ab8167735d35a4cf56243a45cd",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "florence/esterel-calculus",
"max_forks_repo_path": "agda/par-swap/dpg-e-view.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "4340bef3f8df42ab8167735d35a4cf56243a45cd",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "florence/esterel-calculus",
"max_issues_repo_path": "agda/par-swap/dpg-e-view.agda",
"max_line_length": 85,
"max_stars_count": 3,
"max_stars_repo_head_hexsha": "4340bef3f8df42ab8167735d35a4cf56243a45cd",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "florence/esterel-calculus",
"max_stars_repo_path": "agda/par-swap/dpg-e-view.agda",
"max_stars_repo_stars_event_max_datetime": "2020-07-01T03:59:31.000Z",
"max_stars_repo_stars_event_min_datetime": "2020-04-16T10:58:53.000Z",
"num_tokens": 4165,
"size": 9096
} |
module Fixities where
open import Haskell.Prelude
leftAssoc : Int → List Int
leftAssoc n = 2 * n + 1
∷ 2 * (n + 1)
∷ 1 + n * 2
∷ (1 + n) * 2
∷ (n + n) + n
∷ n + (n + n)
∷ []
rightAssoc : List Int → List Int
rightAssoc xs = xs ++ xs ++ ((xs ++ xs) ++ xs) ++ xs
nonAssoc : Bool → Bool
nonAssoc b = (b == b) == (b == b)
mixedAssoc : Maybe Int → (Int → Maybe Int) → Maybe Int
mixedAssoc m f = f =<< (((f =<< m) >>= f) >>= f)
{-# COMPILE AGDA2HS leftAssoc #-}
{-# COMPILE AGDA2HS rightAssoc #-}
{-# COMPILE AGDA2HS nonAssoc #-}
{-# COMPILE AGDA2HS mixedAssoc #-}
| {
"alphanum_fraction": 0.490625,
"avg_line_length": 22.8571428571,
"ext": "agda",
"hexsha": "c18377c9415cd8d342371ff43e15790e4e9fb83b",
"lang": "Agda",
"max_forks_count": 18,
"max_forks_repo_forks_event_max_datetime": "2022-03-12T11:42:52.000Z",
"max_forks_repo_forks_event_min_datetime": "2020-10-21T22:19:09.000Z",
"max_forks_repo_head_hexsha": "160478a51bc78b0fdab07b968464420439f9fed6",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "seanpm2001/agda2hs",
"max_forks_repo_path": "test/Fixities.agda",
"max_issues_count": 63,
"max_issues_repo_head_hexsha": "160478a51bc78b0fdab07b968464420439f9fed6",
"max_issues_repo_issues_event_max_datetime": "2022-02-25T15:47:30.000Z",
"max_issues_repo_issues_event_min_datetime": "2020-10-22T05:19:27.000Z",
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "seanpm2001/agda2hs",
"max_issues_repo_path": "test/Fixities.agda",
"max_line_length": 54,
"max_stars_count": 55,
"max_stars_repo_head_hexsha": "8c8f24a079ed9677dbe6893cf786e7ed52dfe8b6",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "dxts/agda2hs",
"max_stars_repo_path": "test/Fixities.agda",
"max_stars_repo_stars_event_max_datetime": "2022-03-26T21:57:56.000Z",
"max_stars_repo_stars_event_min_datetime": "2020-10-20T13:36:25.000Z",
"num_tokens": 220,
"size": 640
} |
-- Nils' suggestion
import Relation.Binary.PropositionalEquality as Eq
open Eq using (_≡_; refl; sym; trans; cong)
open Eq.≡-Reasoning
open import Data.Nat using (ℕ; zero; suc; _+_; _*_)
open import Data.Nat.Properties.Simple using (+-suc)
open import Relation.Nullary using (¬_)
open import Function using (_∘_; id)
open import Data.Product using (_×_; _,_; proj₁; proj₂; map; ∃; ∃-syntax)
open import Data.Sum using (_⊎_; inj₁; inj₂)
data even : ℕ → Set
data odd : ℕ → Set
data even where
even-zero : even zero
even-suc : ∀ {n : ℕ} → odd n → even (suc n)
data odd where
odd-suc : ∀ {n : ℕ} → even n → odd (suc n)
∃-even : ∀ {n : ℕ} → even n → ∃[ m ] (n ≡ m * 2)
∃-odd : ∀ {n : ℕ} → odd n → ∃[ m ] (n ≡ 1 + m * 2)
∃-even even-zero = zero , refl
∃-even (even-suc o) with ∃-odd o
... | m , refl = suc m , refl
∃-odd (odd-suc e) with ∃-even e
... | m , refl = m , refl
| {
"alphanum_fraction": 0.5737351991,
"avg_line_length": 29.03125,
"ext": "agda",
"hexsha": "a41cfb3477a51a10e26954f042b9f86408fdde53",
"lang": "Agda",
"max_forks_count": 304,
"max_forks_repo_forks_event_max_datetime": "2022-03-28T11:35:02.000Z",
"max_forks_repo_forks_event_min_datetime": "2018-07-16T18:24:59.000Z",
"max_forks_repo_head_hexsha": "8a2c2ace545092fd0e04bf5831ed458267f18ae4",
"max_forks_repo_licenses": [
"CC-BY-4.0"
],
"max_forks_repo_name": "manikdv/plfa.github.io",
"max_forks_repo_path": "extra/extra/EvenOdd3.agda",
"max_issues_count": 323,
"max_issues_repo_head_hexsha": "8a2c2ace545092fd0e04bf5831ed458267f18ae4",
"max_issues_repo_issues_event_max_datetime": "2022-03-30T07:42:57.000Z",
"max_issues_repo_issues_event_min_datetime": "2018-07-05T22:34:34.000Z",
"max_issues_repo_licenses": [
"CC-BY-4.0"
],
"max_issues_repo_name": "manikdv/plfa.github.io",
"max_issues_repo_path": "extra/extra/EvenOdd3.agda",
"max_line_length": 73,
"max_stars_count": 1003,
"max_stars_repo_head_hexsha": "8a2c2ace545092fd0e04bf5831ed458267f18ae4",
"max_stars_repo_licenses": [
"CC-BY-4.0"
],
"max_stars_repo_name": "manikdv/plfa.github.io",
"max_stars_repo_path": "extra/extra/EvenOdd3.agda",
"max_stars_repo_stars_event_max_datetime": "2022-03-27T07:03:28.000Z",
"max_stars_repo_stars_event_min_datetime": "2018-07-05T18:15:14.000Z",
"num_tokens": 342,
"size": 929
} |
-- Andreas, 2014-03-03, report and test case by Nisse.
-- {-# OPTIONS -v tc.lhs.unify:60 #-}
module Issue1071 where
postulate
F : Set → Set
module M (_ : Set₁) where
postulate A : Set
open M Set
data P : Set → Set₁ where
c : (R : Set) → P (F R)
data Q : (R : Set) → R → P R → Set₁ where
d : (R : Set) (f : F R) → Q (F R) f (c R)
Foo : (f' : F A) → Q (F A) f' (c A) → Set₁
Foo ._ (d ._ _) = Set
-- WAS:
-- Refuse to solve heterogeneous constraint f₁ : F A =?= f : F A
-- when checking that the pattern d ._ _ has type Q (F A) f (c A)
-- SHOULD: succeed
| {
"alphanum_fraction": 0.5614035088,
"avg_line_length": 19.6551724138,
"ext": "agda",
"hexsha": "c2d46f0a5b257a68161bf24b562f268e9bca69cc",
"lang": "Agda",
"max_forks_count": 371,
"max_forks_repo_forks_event_max_datetime": "2022-03-30T19:00:30.000Z",
"max_forks_repo_forks_event_min_datetime": "2015-01-03T14:04:08.000Z",
"max_forks_repo_head_hexsha": "231d6ad8e77b67ff8c4b1cb35a6c31ccd988c3e9",
"max_forks_repo_licenses": [
"BSD-3-Clause"
],
"max_forks_repo_name": "Agda-zh/agda",
"max_forks_repo_path": "test/Succeed/Issue1071.agda",
"max_issues_count": 4066,
"max_issues_repo_head_hexsha": "ed8ac6f4062ea8a20fa0f62d5db82d4e68278338",
"max_issues_repo_issues_event_max_datetime": "2022-03-31T21:14:49.000Z",
"max_issues_repo_issues_event_min_datetime": "2015-01-10T11:24:51.000Z",
"max_issues_repo_licenses": [
"BSD-3-Clause"
],
"max_issues_repo_name": "shlevy/agda",
"max_issues_repo_path": "test/Succeed/Issue1071.agda",
"max_line_length": 65,
"max_stars_count": 1989,
"max_stars_repo_head_hexsha": "ed8ac6f4062ea8a20fa0f62d5db82d4e68278338",
"max_stars_repo_licenses": [
"BSD-3-Clause"
],
"max_stars_repo_name": "shlevy/agda",
"max_stars_repo_path": "test/Succeed/Issue1071.agda",
"max_stars_repo_stars_event_max_datetime": "2022-03-30T18:20:48.000Z",
"max_stars_repo_stars_event_min_datetime": "2015-01-09T23:51:16.000Z",
"num_tokens": 217,
"size": 570
} |
{-# OPTIONS --exact-split #-}
{-# OPTIONS --no-sized-types #-}
{-# OPTIONS --no-universe-polymorphism #-}
{-# OPTIONS --without-K #-}
module CombiningProofs.CommDisjunctionSchema where
open import Common.FOL.FOL
postulate ∨-comm : {A B : Set} → A ∨ B → B ∨ A
{-# ATP prove ∨-comm #-}
| {
"alphanum_fraction": 0.5630769231,
"avg_line_length": 27.0833333333,
"ext": "agda",
"hexsha": "c69a627d82dd56667f9675e9d892e1bcd2ddf80c",
"lang": "Agda",
"max_forks_count": 3,
"max_forks_repo_forks_event_max_datetime": "2018-03-14T08:50:00.000Z",
"max_forks_repo_forks_event_min_datetime": "2016-09-19T14:18:30.000Z",
"max_forks_repo_head_hexsha": "2fc9f2b81052a2e0822669f02036c5750371b72d",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "asr/fotc",
"max_forks_repo_path": "notes/thesis/report/CombiningProofs/CommDisjunctionSchema.agda",
"max_issues_count": 2,
"max_issues_repo_head_hexsha": "2fc9f2b81052a2e0822669f02036c5750371b72d",
"max_issues_repo_issues_event_max_datetime": "2017-01-01T14:34:26.000Z",
"max_issues_repo_issues_event_min_datetime": "2016-10-12T17:28:16.000Z",
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "asr/fotc",
"max_issues_repo_path": "notes/thesis/report/CombiningProofs/CommDisjunctionSchema.agda",
"max_line_length": 50,
"max_stars_count": 11,
"max_stars_repo_head_hexsha": "2fc9f2b81052a2e0822669f02036c5750371b72d",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "asr/fotc",
"max_stars_repo_path": "notes/thesis/report/CombiningProofs/CommDisjunctionSchema.agda",
"max_stars_repo_stars_event_max_datetime": "2021-09-12T16:09:54.000Z",
"max_stars_repo_stars_event_min_datetime": "2015-09-03T20:53:42.000Z",
"num_tokens": 83,
"size": 325
} |
-- Andreas, 2018-08-14, issue #1556
-- Rule out very dependent types by looking for recursive calls
-- in the types of definitions.
-- {-# OPTIONS -v term:20 -v rec.graph:80 #-}
A : Set
data D : A → Set -- D --> A (new!)
a : A -- a --> A (new!)
A = D a -- A --> D, a
data D where d : D a -- TODO: D --> a
a = d -- a --> d
-- Should be rejected, e.g., by termination checker.
| {
"alphanum_fraction": 0.4965357968,
"avg_line_length": 27.0625,
"ext": "agda",
"hexsha": "ed7a60ed2df4e93358cfee653c9fd9ac69570250",
"lang": "Agda",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "6043e77e4a72518711f5f808fb4eb593cbf0bb7c",
"max_forks_repo_licenses": [
"BSD-3-Clause"
],
"max_forks_repo_name": "alhassy/agda",
"max_forks_repo_path": "test/Fail/Issue1556.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "6043e77e4a72518711f5f808fb4eb593cbf0bb7c",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"BSD-3-Clause"
],
"max_issues_repo_name": "alhassy/agda",
"max_issues_repo_path": "test/Fail/Issue1556.agda",
"max_line_length": 63,
"max_stars_count": 1,
"max_stars_repo_head_hexsha": "6043e77e4a72518711f5f808fb4eb593cbf0bb7c",
"max_stars_repo_licenses": [
"BSD-3-Clause"
],
"max_stars_repo_name": "alhassy/agda",
"max_stars_repo_path": "test/Fail/Issue1556.agda",
"max_stars_repo_stars_event_max_datetime": "2021-07-07T10:49:57.000Z",
"max_stars_repo_stars_event_min_datetime": "2021-07-07T10:49:57.000Z",
"num_tokens": 130,
"size": 433
} |
{-# OPTIONS --universe-polymorphism #-}
module Categories.Monoidal.Traced where
open import Level
open import Data.Product
open import Data.Fin
open import Categories.Category
open import Categories.Monoidal
open import Categories.Functor hiding (id; _∘_; identityʳ; assoc)
open import Categories.Monoidal.Braided
open import Categories.Monoidal.Helpers
open import Categories.Monoidal.Braided.Helpers
open import Categories.Monoidal.Symmetric
open import Categories.NaturalIsomorphism
open import Categories.NaturalTransformation hiding (id)
------------------------------------------------------------------------------
-- Helpers
unary : ∀ {o ℓ e} → (C : Category o ℓ e) → (A : Category.Obj C) →
Fin 1 → Category.Obj C
unary C A zero = A
unary C A (suc ())
binary : ∀ {o ℓ e} → (C : Category o ℓ e) → (A B : Category.Obj C) →
Fin 2 → Category.Obj C
binary C A B zero = A
binary C A B (suc zero) = B
binary C A B (suc (suc ()))
ternary : ∀ {o ℓ e} → (C : Category o ℓ e) → (A X Y : Category.Obj C) →
Fin 3 → Category.Obj C
ternary C A X Y zero = A
ternary C A X Y (suc zero) = X
ternary C A X Y (suc (suc zero)) = Y
ternary C A X Y (suc (suc (suc ())))
------------------------------------------------------------------------------
-- Def from http://ncatlab.org/nlab/show/traced+monoidal+category
--
-- A symmetric monoidal category (C,⊗,1,b) (where b is the symmetry) is
-- said to be traced if it is equipped with a natural family of functions
--
-- TrXA,B:C(A⊗X,B⊗X)→C(A,B)
-- satisfying three axioms:
--
-- Vanishing: Tr1A,B(f)=f (for all f:A→B) and
-- TrX⊗YA,B=TrXA,B(TrYA⊗X,B⊗X(f)) (for all f:A⊗X⊗Y→B⊗X⊗Y)
--
-- Superposing: TrXC⊗A,C⊗B(idC⊗f)=idC⊗TrXA,B(f) (for all f:A⊗X→B⊗X)
--
-- Yanking: TrXX,X(bX,X)=idX
record Traced {o ℓ e} {C : Category o ℓ e} {M : Monoidal C} {B : Braided M}
(S : Symmetric B) : Set (o ⊔ ℓ ⊔ e) where
private module C = Category C
open C using (Obj; id; _∘_)
private module M = Monoidal M
open M using (⊗; identityʳ; assoc) renaming (id to 𝟙)
private module F = Functor ⊗
open F using () renaming (F₀ to ⊗ₒ; F₁ to ⊗ₘ)
private module NIʳ = NaturalIsomorphism identityʳ
open NaturalTransformation NIʳ.F⇒G renaming (η to ηidr⇒)
open NaturalTransformation NIʳ.F⇐G renaming (η to ηidr⇐)
private module NIassoc = NaturalIsomorphism assoc
open NaturalTransformation NIassoc.F⇒G renaming (η to ηassoc⇒)
open NaturalTransformation NIassoc.F⇐G renaming (η to ηassoc⇐)
private module B = Braided B
open B using (braid)
private module NIbraid = NaturalIsomorphism braid
open NaturalTransformation NIbraid.F⇒G renaming (η to ηbraid⇒)
field
trace : ∀ {X A B} → C [ ⊗ₒ (A , X) , ⊗ₒ (B , X) ] → C [ A , B ]
vanish_id : ∀ {A B f} →
C [
trace {𝟙} {A} {B} f
≡
(ηidr⇒ (unary C B) ∘ f ∘ ηidr⇐ (unary C A))
]
vanish_⊗ : ∀ {X Y A B f} →
C [
trace {⊗ₒ (X , Y)} {A} {B} f
≡
trace {X} {A} {B}
(trace {Y} {⊗ₒ (A , X)} {⊗ₒ (B , X)}
((ηassoc⇐ (ternary C B X Y)) ∘ f ∘ (ηassoc⇒ (ternary C A X Y))))
]
superpose : ∀ {X Y A B} {f : C [ ⊗ₒ (A , X) , ⊗ₒ (B , X) ]} →
C [
trace {X} {⊗ₒ (Y , A)} {⊗ₒ (Y , B)}
(ηassoc⇐ (ternary C Y B X) ∘ ⊗ₘ (id , f) ∘ ηassoc⇒ (ternary C Y A X))
≡
⊗ₘ (id , (trace {X} {A} {B} f))
]
yank : ∀ {X} →
C [
trace {X} {X} {X} (ηbraid⇒ (binary C X X))
≡
id
]
------------------------------------------------------------------------------
| {
"alphanum_fraction": 0.5153583618,
"avg_line_length": 32.5555555556,
"ext": "agda",
"hexsha": "1cba3acd85a88fcc3a852119c172041325616fe8",
"lang": "Agda",
"max_forks_count": 23,
"max_forks_repo_forks_event_max_datetime": "2021-11-11T13:50:56.000Z",
"max_forks_repo_forks_event_min_datetime": "2015-02-05T13:03:09.000Z",
"max_forks_repo_head_hexsha": "36f4181d751e2ecb54db219911d8c69afe8ba892",
"max_forks_repo_licenses": [
"BSD-3-Clause"
],
"max_forks_repo_name": "copumpkin/categories",
"max_forks_repo_path": "Categories/Monoidal/Traced.agda",
"max_issues_count": 19,
"max_issues_repo_head_hexsha": "36f4181d751e2ecb54db219911d8c69afe8ba892",
"max_issues_repo_issues_event_max_datetime": "2019-08-09T16:31:40.000Z",
"max_issues_repo_issues_event_min_datetime": "2015-05-23T06:47:10.000Z",
"max_issues_repo_licenses": [
"BSD-3-Clause"
],
"max_issues_repo_name": "copumpkin/categories",
"max_issues_repo_path": "Categories/Monoidal/Traced.agda",
"max_line_length": 91,
"max_stars_count": 98,
"max_stars_repo_head_hexsha": "36f4181d751e2ecb54db219911d8c69afe8ba892",
"max_stars_repo_licenses": [
"BSD-3-Clause"
],
"max_stars_repo_name": "copumpkin/categories",
"max_stars_repo_path": "Categories/Monoidal/Traced.agda",
"max_stars_repo_stars_event_max_datetime": "2022-03-08T05:20:36.000Z",
"max_stars_repo_stars_event_min_datetime": "2015-04-15T14:57:33.000Z",
"num_tokens": 1315,
"size": 3809
} |
------------------------------------------------------------------------
-- The Agda standard library
--
-- This module is DEPRECATED. Please use the
-- Relation.Binary.Reasoning.Setoid module directly.
------------------------------------------------------------------------
{-# OPTIONS --without-K --safe #-}
open import Relation.Binary
module Relation.Binary.EqReasoning {s₁ s₂} (S : Setoid s₁ s₂) where
open import Relation.Binary.Reasoning.Setoid S public
| {
"alphanum_fraction": 0.5139784946,
"avg_line_length": 31,
"ext": "agda",
"hexsha": "34c77fc7f97893289fb803277c0db3d3655b12c3",
"lang": "Agda",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "0debb886eb5dbcd38dbeebd04b34cf9d9c5e0e71",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "omega12345/agda-mode",
"max_forks_repo_path": "test/asset/agda-stdlib-1.0/Relation/Binary/EqReasoning.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "0debb886eb5dbcd38dbeebd04b34cf9d9c5e0e71",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "omega12345/agda-mode",
"max_issues_repo_path": "test/asset/agda-stdlib-1.0/Relation/Binary/EqReasoning.agda",
"max_line_length": 72,
"max_stars_count": null,
"max_stars_repo_head_hexsha": "0debb886eb5dbcd38dbeebd04b34cf9d9c5e0e71",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "omega12345/agda-mode",
"max_stars_repo_path": "test/asset/agda-stdlib-1.0/Relation/Binary/EqReasoning.agda",
"max_stars_repo_stars_event_max_datetime": null,
"max_stars_repo_stars_event_min_datetime": null,
"num_tokens": 84,
"size": 465
} |
open import LibraBFT.Impl.Consensus.MetricsSafetyRules
open import LibraBFT.Impl.OBM.Logging.Logging
open import LibraBFT.Impl.Properties.Util
open import LibraBFT.ImplShared.Consensus.Types
open import LibraBFT.ImplShared.Consensus.Types.EpochIndep
open import LibraBFT.ImplShared.Util.Dijkstra.All
open import Optics.All
open import Util.Prelude hiding (_++_)
module LibraBFT.Impl.Consensus.Properties.MetricsSafetyRules where
open Invariants
module performInitializeSpec
(safetyRules : SafetyRules)
(storage : PersistentLivenessStorage)
where
record ContractOk (sr : SafetyRules) : Set where
constructor mkContractOk
field
srPres : Preserves SafetyRulesInv safetyRules sr
lvNothing : sr ^∙ srPersistentStorage ∙ pssSafetyData ∙ sdLastVote ≡ nothing
open ContractOk
Contract : EitherD-Post ErrLog SafetyRules
Contract (Left _) = ⊤
Contract (Right sr) = ContractOk sr
module _ (sri : SafetyRulesInv safetyRules)
(lvNothing : safetyRules ^∙ srPersistentStorage ∙ pssSafetyData ∙ sdLastVote ≡ nothing)
where
-- TODO-2: Requires refinement
postulate
contract' : EitherD-weakestPre (performInitialize-ed-abs safetyRules storage) Contract
contract : Contract (performInitialize-abs safetyRules storage)
contract rewrite performInitialize-abs-≡ safetyRules storage =
EitherD-contract (performInitialize-ed-abs safetyRules storage) Contract contract'
| {
"alphanum_fraction": 0.7579661017,
"avg_line_length": 36.875,
"ext": "agda",
"hexsha": "0634e9170bbde22552080142c2de5f54104a8f16",
"lang": "Agda",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "a4674fc473f2457fd3fe5123af48253cfb2404ef",
"max_forks_repo_licenses": [
"UPL-1.0"
],
"max_forks_repo_name": "LaudateCorpus1/bft-consensus-agda",
"max_forks_repo_path": "src/LibraBFT/Impl/Consensus/Properties/MetricsSafetyRules.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "a4674fc473f2457fd3fe5123af48253cfb2404ef",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"UPL-1.0"
],
"max_issues_repo_name": "LaudateCorpus1/bft-consensus-agda",
"max_issues_repo_path": "src/LibraBFT/Impl/Consensus/Properties/MetricsSafetyRules.agda",
"max_line_length": 98,
"max_stars_count": null,
"max_stars_repo_head_hexsha": "a4674fc473f2457fd3fe5123af48253cfb2404ef",
"max_stars_repo_licenses": [
"UPL-1.0"
],
"max_stars_repo_name": "LaudateCorpus1/bft-consensus-agda",
"max_stars_repo_path": "src/LibraBFT/Impl/Consensus/Properties/MetricsSafetyRules.agda",
"max_stars_repo_stars_event_max_datetime": null,
"max_stars_repo_stars_event_min_datetime": null,
"num_tokens": 368,
"size": 1475
} |
{-# OPTIONS --without-K --safe #-}
module Fragment.Prelude where
open import Fragment.Tactic.Fragment using (fragment) public
open import Fragment.Equational.Theory.Bundles public
open import Fragment.Equational.Structures public
open import Fragment.Extensions.Semigroup using (SemigroupFrex) public
open import Fragment.Extensions.CSemigroup using (CSemigroupFrex) public
| {
"alphanum_fraction": 0.8227513228,
"avg_line_length": 31.5,
"ext": "agda",
"hexsha": "da3b46b669e3ed12bc416cf0a276c88c57de183e",
"lang": "Agda",
"max_forks_count": 3,
"max_forks_repo_forks_event_max_datetime": "2021-06-16T08:04:31.000Z",
"max_forks_repo_forks_event_min_datetime": "2021-06-15T15:34:50.000Z",
"max_forks_repo_head_hexsha": "f2a6b1cf4bc95214bd075a155012f84c593b9496",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "yallop/agda-fragment",
"max_forks_repo_path": "src/Fragment/Prelude.agda",
"max_issues_count": 1,
"max_issues_repo_head_hexsha": "f2a6b1cf4bc95214bd075a155012f84c593b9496",
"max_issues_repo_issues_event_max_datetime": "2021-06-16T10:24:15.000Z",
"max_issues_repo_issues_event_min_datetime": "2021-06-16T09:44:31.000Z",
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "yallop/agda-fragment",
"max_issues_repo_path": "src/Fragment/Prelude.agda",
"max_line_length": 72,
"max_stars_count": 18,
"max_stars_repo_head_hexsha": "f2a6b1cf4bc95214bd075a155012f84c593b9496",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "yallop/agda-fragment",
"max_stars_repo_path": "src/Fragment/Prelude.agda",
"max_stars_repo_stars_event_max_datetime": "2022-01-17T17:26:09.000Z",
"max_stars_repo_stars_event_min_datetime": "2021-06-15T15:45:39.000Z",
"num_tokens": 81,
"size": 378
} |
module Cats.Category.Arrow where
open import Level
open import Relation.Binary using (IsEquivalence ; _Preserves₂_⟶_⟶_)
open import Cats.Category
module _ {lo la l≈} (C : Category lo la l≈) where
infixr 9 _∘_
infixr 4 _≈_
private
module C = Category C
module ≈ = C.≈
record Obj : Set (lo ⊔ la) where
field
Dom : C.Obj
Cod : C.Obj
arr : Dom C.⇒ Cod
open Obj
record _⇒_ (f g : Obj) : Set (la ⊔ l≈) where
field
dom : Dom f C.⇒ Dom g
cod : Cod f C.⇒ Cod g
commute : arr g C.∘ dom C.≈ cod C.∘ arr f
open _⇒_
record _≈_ {A B} (F G : A ⇒ B) : Set l≈ where
field
dom : dom F C.≈ dom G
cod : cod F C.≈ cod G
id : ∀ {A} → A ⇒ A
id {record { Dom = Dom ; Cod = Cod ; arr = arr }}
= record
{ dom = C.id
; cod = C.id
; commute = ≈.trans C.id-r (≈.sym C.id-l)
}
_∘_ : ∀ {A B C} → (B ⇒ C) → (A ⇒ B) → (A ⇒ C)
_∘_ {F} {G} {H}
record { dom = F-dom ; cod = F-cod ; commute = F-commute }
record { dom = G-dom ; cod = G-cod ; commute = G-commute }
= record
{ dom = F-dom C.∘ G-dom
; cod = F-cod C.∘ G-cod
; commute
= begin
arr H C.∘ F-dom C.∘ G-dom
≈⟨ C.unassoc ⟩
(arr H C.∘ F-dom) C.∘ G-dom
≈⟨ C.∘-resp-l F-commute ⟩
(F-cod C.∘ arr G) C.∘ G-dom
≈⟨ C.assoc ⟩
F-cod C.∘ arr G C.∘ G-dom
≈⟨ C.∘-resp-r G-commute ⟩
F-cod C.∘ G-cod C.∘ arr F
≈⟨ C.unassoc ⟩
(F-cod C.∘ G-cod) C.∘ arr F
∎
}
where
open C.≈-Reasoning
equiv : ∀ {A B} → IsEquivalence (_≈_ {A} {B})
equiv = record
{ refl = record { dom = ≈.refl ; cod = ≈.refl }
; sym = λ where
record { dom = dom ; cod = cod } → record
{ dom = ≈.sym dom
; cod = ≈.sym cod
}
; trans = λ where
record { dom = dom₁ ; cod = cod₁ } record { dom = dom₂ ; cod = cod₂ }
→ record
{ dom = ≈.trans dom₁ dom₂
; cod = ≈.trans cod₁ cod₂
}
}
∘-resp : ∀ {A B C} → (_∘_ {A} {B} {C}) Preserves₂ _≈_ ⟶ _≈_ ⟶ _≈_
∘-resp
record { dom = dom-FG ; cod = cod-FG }
record { dom = dom-HI ; cod = cod-HI }
= record
{ dom = C.∘-resp dom-FG dom-HI
; cod = C.∘-resp cod-FG cod-HI
}
id-r : ∀ {A B} {F : A ⇒ B} → F ∘ id ≈ F
id-r = record
{ dom = C.id-r
; cod = C.id-r
}
id-l : ∀ {A B} {F : A ⇒ B} → id ∘ F ≈ F
id-l = record
{ dom = C.id-l
; cod = C.id-l
}
assoc : ∀ {A B C D} {F : C ⇒ D} {G : B ⇒ C} {H : A ⇒ B}
→ (F ∘ G) ∘ H ≈ F ∘ (G ∘ H)
assoc = record
{ dom = C.assoc
; cod = C.assoc
}
_⃗ : Category (la ⊔ lo) (l≈ ⊔ la) l≈
_⃗ = record
{ Obj = Obj
; _⇒_ = _⇒_
; _≈_ = _≈_
; id = id
; _∘_ = _∘_
; equiv = equiv
; ∘-resp = ∘-resp
; id-r = id-r
; id-l = id-l
; assoc = assoc
}
| {
"alphanum_fraction": 0.4186429513,
"avg_line_length": 21.6857142857,
"ext": "agda",
"hexsha": "15004ceb2b97f865ae1ca6a7ff7aaaa5ef887eed",
"lang": "Agda",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "a3b69911c4c6ec380ddf6a0f4510d3a755734b86",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "alessio-b-zak/cats",
"max_forks_repo_path": "Cats/Category/Arrow.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "a3b69911c4c6ec380ddf6a0f4510d3a755734b86",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "alessio-b-zak/cats",
"max_issues_repo_path": "Cats/Category/Arrow.agda",
"max_line_length": 79,
"max_stars_count": null,
"max_stars_repo_head_hexsha": "a3b69911c4c6ec380ddf6a0f4510d3a755734b86",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "alessio-b-zak/cats",
"max_stars_repo_path": "Cats/Category/Arrow.agda",
"max_stars_repo_stars_event_max_datetime": null,
"max_stars_repo_stars_event_min_datetime": null,
"num_tokens": 1240,
"size": 3036
} |
module _ where
open import Agda.Builtin.Nat
module M (n : Nat) where
postulate A : Set
module M₁ (m : Nat) where
open module Mm = M m
-- bar : M.A (m + 1)
-- bar = m -- Nat !=< M.A (m + 1)
postulate
n : Nat
foo : M.A n
foo = n -- Nat !=< M.A n
| {
"alphanum_fraction": 0.5416666667,
"avg_line_length": 12,
"ext": "agda",
"hexsha": "e5715b5c415a747a024ad4aaa7cddcc5832e2abc",
"lang": "Agda",
"max_forks_count": 371,
"max_forks_repo_forks_event_max_datetime": "2022-03-30T19:00:30.000Z",
"max_forks_repo_forks_event_min_datetime": "2015-01-03T14:04:08.000Z",
"max_forks_repo_head_hexsha": "231d6ad8e77b67ff8c4b1cb35a6c31ccd988c3e9",
"max_forks_repo_licenses": [
"BSD-3-Clause"
],
"max_forks_repo_name": "Agda-zh/agda",
"max_forks_repo_path": "test/Fail/Issue2067b.agda",
"max_issues_count": 4066,
"max_issues_repo_head_hexsha": "ed8ac6f4062ea8a20fa0f62d5db82d4e68278338",
"max_issues_repo_issues_event_max_datetime": "2022-03-31T21:14:49.000Z",
"max_issues_repo_issues_event_min_datetime": "2015-01-10T11:24:51.000Z",
"max_issues_repo_licenses": [
"BSD-3-Clause"
],
"max_issues_repo_name": "shlevy/agda",
"max_issues_repo_path": "test/Fail/Issue2067b.agda",
"max_line_length": 36,
"max_stars_count": 1989,
"max_stars_repo_head_hexsha": "ed8ac6f4062ea8a20fa0f62d5db82d4e68278338",
"max_stars_repo_licenses": [
"BSD-3-Clause"
],
"max_stars_repo_name": "shlevy/agda",
"max_stars_repo_path": "test/Fail/Issue2067b.agda",
"max_stars_repo_stars_event_max_datetime": "2022-03-30T18:20:48.000Z",
"max_stars_repo_stars_event_min_datetime": "2015-01-09T23:51:16.000Z",
"num_tokens": 104,
"size": 264
} |
{-# OPTIONS --without-K --safe #-}
open import Categories.Category using () renaming (Category to Setoid-Category)
open import Categories.Category.Monoidal
module Categories.Category.Construction.EnrichedFunctors
{o ℓ e} {V : Setoid-Category o ℓ e} (M : Monoidal V) where
-- The (enriched) functor category for a given pair of V-enriched categories
open import Level
open import Data.Product using (_,_; uncurry′)
open import Categories.Enriched.Category M
open import Categories.Enriched.Functor M renaming (id to idF)
open import Categories.Enriched.NaturalTransformation M renaming (id to idNT)
open import Categories.Functor.Bifunctor using (Bifunctor)
open NaturalTransformation using (_[_])
EnrichedFunctors : ∀ {c d} (C : Category c) (D : Category d) →
Setoid-Category (ℓ ⊔ e ⊔ c ⊔ d) (ℓ ⊔ e ⊔ c) (e ⊔ c)
EnrichedFunctors C D = record
{ Obj = Functor C D
; _⇒_ = NaturalTransformation
; _≈_ = λ α β → ∀ {X} → α [ X ] ≈ β [ X ]
; id = idNT
; _∘_ = _∘ᵥ_
; assoc = assoc
; sym-assoc = sym-assoc
; identityˡ = identityˡ
; identityʳ = identityʳ
; identity² = identity²
; equiv = record
{ refl = Equiv.refl
; sym = λ α≈β → Equiv.sym α≈β
; trans = λ α≈β β≈γ → Equiv.trans α≈β β≈γ
}
; ∘-resp-≈ = λ α₁≈β₁ α₂≈β₂ → ∘-resp-≈ α₁≈β₁ α₂≈β₂
}
where open Underlying D
-- Horizontal composition of natural transformations (aka the Godement
-- product) induces a composition functor over functor categories.
--
-- Note that all the equational reasoning happens in the underlying
-- (ordinary) categories!
⊚ : ∀ {c d e} {C : Category c} {D : Category d} {E : Category e} →
Bifunctor (EnrichedFunctors D E) (EnrichedFunctors C D) (EnrichedFunctors C E)
⊚ {_} {_} {_} {_} {D} {E} = record
{ F₀ = uncurry′ _∘F_
; F₁ = uncurry′ _∘ₕ_
; identity = λ{ {F , G} {X} →
begin
(F $₁ D.id) ∘ E.id ≈⟨ identityʳ ⟩
F $₁ D.id ≈⟨ identity F ⟩
E.id ∎ }
; homomorphism = λ{ {_ , F₂} {G₁ , G₂} {H₁ , _} {α₁ , α₂} {β₁ , β₂} {X} →
begin
H₁ $₁ (β₂ [ X ] D.∘ α₂ [ X ]) ∘ β₁ [ F₂ $₀ X ] ∘ α₁ [ F₂ $₀ X ]
≈⟨ homomorphism H₁ ⟩∘⟨refl ⟩
(H₁ $₁ β₂ [ X ] ∘ H₁ $₁ α₂ [ X ]) ∘ β₁ [ F₂ $₀ X ] ∘ α₁ [ F₂ $₀ X ]
≈⟨ ⟺ assoc ○ ∘-resp-≈ˡ assoc ⟩
(H₁ $₁ β₂ [ X ] ∘ (H₁ $₁ α₂ [ X ] ∘ β₁ [ F₂ $₀ X ])) ∘ α₁ [ F₂ $₀ X ]
≈˘⟨ (refl⟩∘⟨ commute β₁ (α₂ [ X ])) ⟩∘⟨refl ⟩
(H₁ $₁ β₂ [ X ] ∘ (β₁ [ G₂ $₀ X ] ∘ G₁ $₁ α₂ [ X ])) ∘ α₁ [ F₂ $₀ X ]
≈˘⟨ ⟺ assoc ○ ∘-resp-≈ˡ assoc ⟩
(H₁ $₁ β₂ [ X ] ∘ β₁ [ G₂ $₀ X ]) ∘ G₁ $₁ α₂ [ X ] ∘ α₁ [ F₂ $₀ X ]
∎ }
; F-resp-≈ = λ{ {_} {F , _} (eq₁ , eq₂) → ∘-resp-≈ (F-resp-≈ F eq₂) eq₁ }
}
where
module D = Underlying D
module E = Underlying E
open E hiding (id)
open HomReasoning
open UnderlyingFunctor hiding (F₀; F₁)
open UnderlyingNT
-- Aliases used to shorten some proof expressions
infixr 14 _$₀_ _$₁_
_$₀_ = UnderlyingFunctor.F₀
_$₁_ = UnderlyingFunctor.F₁
| {
"alphanum_fraction": 0.577077748,
"avg_line_length": 34.6976744186,
"ext": "agda",
"hexsha": "d06ccf83e04074488e927c138f78301a1668726a",
"lang": "Agda",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "6ebc1349ee79669c5c496dcadd551d5bbefd1972",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "Taneb/agda-categories",
"max_forks_repo_path": "Categories/Category/Construction/EnrichedFunctors.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "6ebc1349ee79669c5c496dcadd551d5bbefd1972",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "Taneb/agda-categories",
"max_issues_repo_path": "Categories/Category/Construction/EnrichedFunctors.agda",
"max_line_length": 82,
"max_stars_count": null,
"max_stars_repo_head_hexsha": "6ebc1349ee79669c5c496dcadd551d5bbefd1972",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "Taneb/agda-categories",
"max_stars_repo_path": "Categories/Category/Construction/EnrichedFunctors.agda",
"max_stars_repo_stars_event_max_datetime": null,
"max_stars_repo_stars_event_min_datetime": null,
"num_tokens": 1216,
"size": 2984
} |
module RandomAccessList.General.Core where
open import Data.List
open import Data.Nat
open import Data.Vec
open import Relation.Binary.PropositionalEquality as PropEq
using (_≡_)
data General (A : Set) : ℕ → ℕ → ℕ → Set where
[] : ∀ {a b n} → General A a b n
∺ : ∀ {v a a' b b' n}
→ Vec A v
→ a ⊓ v ≡ a'
→ b ⊔ b ≡ b'
→ General A a b n
→ General A a' b' n
--------------------------------------------------------------------------------
-- Beispiele
--------------------------------------------------------------------------------
| {
"alphanum_fraction": 0.405451448,
"avg_line_length": 26.6818181818,
"ext": "agda",
"hexsha": "c0989b369f3bc69d68c5a66650f6552fd73d989a",
"lang": "Agda",
"max_forks_count": 1,
"max_forks_repo_forks_event_max_datetime": "2015-05-30T05:50:50.000Z",
"max_forks_repo_forks_event_min_datetime": "2015-05-30T05:50:50.000Z",
"max_forks_repo_head_hexsha": "aae093cc9bf21f11064e7f7b12049448cd6449f1",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "banacorn/numeral",
"max_forks_repo_path": "legacy/RandomAccessList/General/Core.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "aae093cc9bf21f11064e7f7b12049448cd6449f1",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "banacorn/numeral",
"max_issues_repo_path": "legacy/RandomAccessList/General/Core.agda",
"max_line_length": 80,
"max_stars_count": 1,
"max_stars_repo_head_hexsha": "aae093cc9bf21f11064e7f7b12049448cd6449f1",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "banacorn/numeral",
"max_stars_repo_path": "legacy/RandomAccessList/General/Core.agda",
"max_stars_repo_stars_event_max_datetime": "2015-04-23T15:58:28.000Z",
"max_stars_repo_stars_event_min_datetime": "2015-04-23T15:58:28.000Z",
"num_tokens": 146,
"size": 587
} |
------------------------------------------------------------------------------
-- Agda-Prop Library.
-- Theorems of ∨ connective.
------------------------------------------------------------------------------
open import Data.Nat using ( ℕ )
module Data.PropFormula.Theorems.Disjunction ( n : ℕ ) where
------------------------------------------------------------------------------
open import Data.PropFormula.Syntax n
open import Data.PropFormula.Theorems.Classical n
open import Data.PropFormula.Properties n
open import Data.PropFormula.Theorems.Conjunction n using ( ∧-dmorgan₁ )
open import Data.PropFormula.Theorems.Implication n using ( vanDalen244e )
open import Function using ( _$_; _∘_ )
open import Relation.Binary.PropositionalEquality using ( _≡_ )
------------------------------------------------------------------------------
-- Theorem.
∨-assoc₁
: ∀ {Γ} {φ ψ γ}
→ Γ ⊢ φ ∨ (ψ ∨ γ)
→ Γ ⊢ (φ ∨ ψ) ∨ γ
-- Proof.
∨-assoc₁ {Γ}{φ}{ψ}{γ} =
⊃-elim
(⊃-intro
(∨-elim
(∨-intro₁ γ
(∨-intro₁ ψ
(assume φ)))
(⊃-elim
(⊃-intro
(∨-elim {Γ = Γ , ψ ∨ γ}
(∨-intro₁ γ
(∨-intro₂ φ (assume {Γ = Γ , ψ ∨ γ} ψ)))
(∨-intro₂ (φ ∨ ψ) (assume {Γ = Γ , ψ ∨ γ} γ))))
(assume (ψ ∨ γ)))))
-------------------------------------------------------------------------- ∎
-- Theorem.
∨-assoc₂
: ∀ {Γ} {φ ψ γ}
→ Γ ⊢ (φ ∨ ψ) ∨ γ
→ Γ ⊢ φ ∨ (ψ ∨ γ)
-- Proof.
∨-assoc₂ {Γ}{φ}{ψ}{γ} =
⊃-elim
(⊃-intro
(∨-elim
(⊃-elim
(⊃-intro
(∨-elim {Γ = Γ , φ ∨ ψ}
(∨-intro₁ (ψ ∨ γ)
(assume {Γ = Γ , φ ∨ ψ} φ))
(∨-intro₂ φ
(∨-intro₁ γ
(assume {Γ = Γ , φ ∨ ψ} ψ)))))
(assume (φ ∨ ψ)))
(∨-intro₂ φ
(∨-intro₂ ψ
(assume γ)))))
-------------------------------------------------------------------------- ∎
-- Theorem.
∨-assoc
: ∀ {Γ} {φ ψ γ}
→ Γ ⊢ (φ ∨ (ψ ∨ γ)) ⇔ ((φ ∨ ψ) ∨ γ)
-- Proof.
∨-assoc {φ = φ}{ψ}{γ} =
⇔-intro
(∨-assoc₁ (assume (φ ∨ (ψ ∨ γ))))
(∨-assoc₂ (assume (φ ∨ ψ ∨ γ)))
-------------------------------------------------------------------------- ∎
-- Theorem.
∨-comm
: ∀ {Γ} {φ ψ}
→ Γ ⊢ φ ∨ ψ
→ Γ ⊢ ψ ∨ φ
-- Proof.
∨-comm {φ = φ}{ψ} =
⊃-elim $
⊃-intro
(∨-elim
(∨-intro₂ ψ
(assume φ))
(∨-intro₁ φ $
assume ψ))
-------------------------------------------------------------------------- ∎
-- Theorem.
∨-dist₁
: ∀ {Γ} {φ ψ γ}
→ Γ ⊢ φ ∨ (ψ ∧ γ)
→ Γ ⊢ (φ ∨ ψ) ∧ (φ ∨ γ)
-- Proof.
∨-dist₁ {Γ}{φ}{ψ}{γ} =
⊃-elim
(⊃-intro
(∨-elim
(∧-intro
(∨-intro₁ ψ
(assume φ))
(∨-intro₁ γ
(assume φ)))
(∧-intro
(∨-intro₂ φ
(∧-proj₁
(assume (ψ ∧ γ))))
(∨-intro₂ φ
(∧-proj₂
(assume (ψ ∧ γ)))))))
-------------------------------------------------------------------------- ∎
-- Theorem.
∨-dist₂
: ∀ {Γ} {φ ψ γ}
→ Γ ⊢ (φ ∨ ψ) ∧ (φ ∨ γ)
→ Γ ⊢ φ ∨ (ψ ∧ γ)
-- Proof.
∨-dist₂ {Γ}{φ}{ψ}{γ} Γ⊢⟪φ∨ψ⟫∧⟪φ∨γ⟫ =
⊃-elim
(⊃-intro
(∨-elim
(∨-intro₁ (ψ ∧ γ)
(assume φ))
(⊃-elim
(⊃-intro
(∨-elim
(∨-intro₁ (ψ ∧ γ)
(assume {Γ = Γ , ψ} φ))
(∨-intro₂ φ
(∧-intro
(weaken γ
(assume ψ))
(assume {Γ = Γ , ψ} γ)))))
(∧-proj₂
(weaken ψ Γ⊢⟪φ∨ψ⟫∧⟪φ∨γ⟫)))))
(∧-proj₁ Γ⊢⟪φ∨ψ⟫∧⟪φ∨γ⟫)
-------------------------------------------------------------------------- ∎
-- Theorem.
∨-dist
: ∀ {Γ} {φ ψ γ}
→ Γ ⊢ (φ ∨ (ψ ∧ γ)) ⇔ ((φ ∨ ψ) ∧ (φ ∨ γ))
-- Proof.
∨-dist {φ = φ}{ψ}{γ} =
⇔-intro
(∨-dist₁ (assume (φ ∨ (ψ ∧ γ))))
(∨-dist₂ (assume (φ ∨ ψ ∧ (φ ∨ γ))))
-------------------------------------------------------------------------- ∎
-- Theorem.
∨-equiv
: ∀ {Γ} {φ ψ}
→ Γ ⊢ φ ∨ ψ
→ Γ ⊢ ¬ (¬ φ ∧ ¬ ψ)
∨-to-¬¬∧¬ = ∨-equiv
-- Proof.
∨-equiv {Γ}{φ}{ψ} Γ⊢φ∨ψ =
¬-intro
(⊃-elim
(⊃-intro
(∨-elim {Γ = Γ , ¬ φ ∧ ¬ ψ}
(¬-elim
(weaken φ
(∧-proj₁
(assume (¬ φ ∧ ¬ ψ))))
(assume {Γ = Γ , ¬ φ ∧ ¬ ψ } φ))
(¬-elim
(weaken ψ
(∧-proj₂
(assume (¬ φ ∧ ¬ ψ))))
(assume {Γ = Γ , ¬ φ ∧ ¬ ψ} ψ))))
(weaken (¬ φ ∧ ¬ ψ) Γ⊢φ∨ψ))
-------------------------------------------------------------------------- ∎
-- Theorem.
∨-dmorgan₁
: ∀ {Γ} {φ ψ}
→ Γ ⊢ ¬ (φ ∨ ψ)
→ Γ ⊢ ¬ φ ∧ ¬ ψ
¬∨-to-¬∧¬ = ∨-dmorgan₁
-- Proof.
∨-dmorgan₁ {Γ}{φ}{ψ} =
⊃-elim $
⊃-intro $
∧-intro
(¬-intro $
¬-elim
(weaken φ $
assume (¬ (φ ∨ ψ)))
(∨-intro₁ ψ $
assume {Γ = Γ , ¬ (φ ∨ ψ)} φ))
(¬-intro $
¬-elim
(weaken ψ $
assume (¬ (φ ∨ ψ)))
(∨-intro₂ φ $
assume {Γ = Γ , ¬ (φ ∨ ψ)} ψ))
-------------------------------------------------------------------------- ∎
-- Theorem.
∨-dmorgan₂
: ∀ {Γ} {φ ψ}
→ Γ ⊢ ¬ φ ∧ ¬ ψ
→ Γ ⊢ ¬ (φ ∨ ψ)
¬∧¬-to-¬∨ = ∨-dmorgan₂
-- Proof.
∨-dmorgan₂ {φ = φ}{ψ} Γ⊢¬φ∧¬ψ =
¬-intro
(∨-elim
(¬-elim
(weaken φ
(∧-proj₁ Γ⊢¬φ∧¬ψ ))
(assume φ))
(¬-elim
(weaken ψ
(∧-proj₂ Γ⊢¬φ∧¬ψ ))
(assume ψ)))
-------------------------------------------------------------------------- ∎
-- Theorem.
∨-dmorgan
: ∀ {Γ} {φ ψ}
→ Γ ⊢ ¬ (φ ∨ ψ) ⇔ (¬ φ ∧ ¬ ψ)
¬∨-⇔-¬∧¬ = ∨-dmorgan
-- Proof.
∨-dmorgan {φ = φ}{ψ} =
⇔-intro
(∨-dmorgan₁
(assume (¬ (φ ∨ ψ))))
(∨-dmorgan₂
(assume (¬ φ ∧ ¬ ψ)))
-------------------------------------------------------------------------- ∎
-- Theorem.
lem1
: ∀ {Γ} {φ ψ}
→ Γ ⊢ ¬ ¬ φ ∨ ¬ ¬ ψ
→ Γ ⊢ φ ∨ ψ
¬¬∨¬¬-to-∨ = lem1
-- Proof.
lem1 {φ = φ}{ψ} =
⊃-elim $
⊃-intro $
∨-elim
(∨-intro₁ ψ $
⊃-elim vanDalen244e $ assume $ ¬ ¬ φ)
(∨-intro₂ φ $
⊃-elim vanDalen244e $ assume $ ¬ ¬ ψ)
-------------------------------------------------------------------------- ∎
-- Theorem.
lem2
: ∀ {Γ} {φ ψ}
→ Γ ⊢ (φ ∨ ψ) ∧ ¬ ψ
→ Γ ⊢ φ
-- Proof.
lem2 {φ = φ}{ψ} Γ⊢⟪φ∨ψ⟫∧¬ψ =
⊃-elim
(⊃-intro $
(∨-elim
(assume φ)
(⊥-elim φ
(¬-elim
(weaken ψ (∧-proj₂ Γ⊢⟪φ∨ψ⟫∧¬ψ))
(assume ψ)))))
(∧-proj₁ Γ⊢⟪φ∨ψ⟫∧¬ψ)
-------------------------------------------------------------------------- ∎
-- Theorem.
resolve₀
: ∀ {Γ} {φ ψ γ}
→ Γ ⊢ φ ∨ ψ → Γ ⊢ ¬ φ ∨ γ
→ Γ ⊢ ψ ∨ γ
-- Proof.
resolve₀ {Γ}{φ}{ψ}{γ} Γ⊢φ∨ψ Γ⊢¬φ∨γ =
lem1 $
∧-dmorgan₁ $
¬-intro $
¬-elim
(lem2 {Γ = Γ , ¬ ψ ∧ ¬ γ} $
∧-intro
(weaken (¬ ψ ∧ ¬ γ) Γ⊢¬φ∨γ)
(∧-proj₂ $ assume $ ¬ ψ ∧ ¬ γ))
(lem2 $
∧-intro
(weaken (¬ ψ ∧ ¬ γ) Γ⊢φ∨ψ)
(∧-proj₁ $ assume $ ¬ ψ ∧ ¬ γ))
-------------------------------------------------------------------------- ∎
-- Theorem.
resolve₁
: ∀ {Γ} {φ ψ γ}
→ Γ ⊢ ψ ∨ φ → Γ ⊢ ¬ φ ∨ γ
→ Γ ⊢ ψ ∨ γ
-- Proof.
resolve₁ = resolve₀ ∘ ∨-comm
-------------------------------------------------------------------------- ∎
-- Theorem.
resolve₂
: ∀ {Γ} {φ ψ γ}
→ Γ ⊢ φ ∨ ψ → Γ ⊢ γ ∨ ¬ φ
→ Γ ⊢ ψ ∨ γ
-- Proof.
resolve₂ Γ⊢φ∨ψ Γ⊢γ∨¬φ = resolve₀ Γ⊢φ∨ψ (∨-comm Γ⊢γ∨¬φ)
-------------------------------------------------------------------------- ∎
-- Theorem.
resolve₃
: ∀ {Γ} {φ ψ γ}
→ Γ ⊢ ψ ∨ φ → Γ ⊢ γ ∨ ¬ φ
→ Γ ⊢ ψ ∨ γ
-- Proof.
resolve₃ Γ⊢ψ∨φ Γ⊢γ∨¬φ = resolve₀ (∨-comm Γ⊢ψ∨φ) (∨-comm Γ⊢γ∨¬φ)
-------------------------------------------------------------------------- ∎
-- Theorem.
resolve₄
: ∀ {Γ} {φ ψ}
→ Γ ⊢ ¬ φ ∨ ψ → Γ ⊢ φ
→ Γ ⊢ ψ
-- Proof.
resolve₄ {φ = φ}{ψ} Γ⊢¬φ∨ψ Γ⊢φ =
⊃-elim
(⊃-intro $
∨-elim
(assume ψ)
(assume ψ))
(resolve₀
(∨-intro₁ ψ Γ⊢φ)
Γ⊢¬φ∨ψ)
-------------------------------------------------------------------------- ∎
-- Theorem.
resolve₅
: ∀ {Γ} {φ ψ}
→ Γ ⊢ ψ ∨ ¬ φ
→ Γ ⊢ φ
→ Γ ⊢ ψ
-- Proof.
resolve₅ = resolve₄ ∘ ∨-comm
-------------------------------------------------------------------------- ∎
-- Theorem.
resolve₆
: ∀ {Γ} {φ ψ}
→ Γ ⊢ ψ ∨ φ → Γ ⊢ ¬ φ
→ Γ ⊢ ψ
-- Proof.
resolve₆ {φ = φ}{ψ} Γ⊢ψ∨φ Γ⊢¬φ =
⊃-elim
(⊃-intro $
∨-elim
(assume ψ)
(assume ψ))
(resolve₀ (∨-comm Γ⊢ψ∨φ) (∨-intro₁ ψ Γ⊢¬φ))
-------------------------------------------------------------------------- ∎
-- Theorem.
resolve₇
: ∀ {Γ} {φ ψ}
→ Γ ⊢ φ ∨ ψ → Γ ⊢ ¬ φ
→ Γ ⊢ ψ
-- Proof.
resolve₇ Γ⊢φ∨ψ Γ⊢¬φ = resolve₆ (∨-comm Γ⊢φ∨ψ) Γ⊢¬φ
-------------------------------------------------------------------------- ∎
-- Theorem.
resolve₈
: ∀ {Γ} {φ}
→ Γ ⊢ φ → Γ ⊢ ¬ φ
→ Γ ⊢ ⊥
-- Proof.
resolve₈ Γ⊢φ Γ⊢¬φ = ¬-elim Γ⊢¬φ Γ⊢φ
-------------------------------------------------------------------------- ∎
-- Theorem.
resolve₉
: ∀ {Γ} {φ}
→ Γ ⊢ ¬ φ → Γ ⊢ φ
→ Γ ⊢ ⊥
-- Proof.
resolve₉ = ¬-elim
-------------------------------------------------------------------------- ∎
-- Theorem.
subst⊢∨₁
: ∀ {Γ} {φ ψ γ}
→ Γ ⊢ φ ⊃ γ
→ Γ ⊢ φ ∨ ψ
→ Γ ⊢ γ ∨ ψ
-- Proof.
subst⊢∨₁ {φ = φ}{ψ}{γ} Γ⊢φ⊃γ Γ⊢φ∨ψ =
⊃-elim
(⊃-intro
(∨-elim
(∨-intro₁ ψ (⊃-elim (weaken φ Γ⊢φ⊃γ) (assume φ)))
(∨-intro₂ γ (assume ψ))))
Γ⊢φ∨ψ
-------------------------------------------------------------------------- ∎
-- Theorem.
subst⊢∨₂
: ∀ {Γ} {φ ψ γ}
→ Γ ⊢ ψ ⊃ γ
→ Γ ⊢ φ ∨ ψ
→ Γ ⊢ φ ∨ γ
-- Proof.
subst⊢∨₂ {φ = φ}{ψ}{γ} Γ⊢ψ⊃γ Γ⊢φ∨ψ =
⊃-elim
(⊃-intro
(∨-elim
(∨-intro₁ γ (assume φ))
(∨-intro₂ φ (⊃-elim (weaken ψ Γ⊢ψ⊃γ) (assume ψ)))))
Γ⊢φ∨ψ
-------------------------------------------------------------------------- ∎
-- Theorem.
∨-to-¬⊃
: ∀ {Γ} {φ ψ}
→ Γ ⊢ φ ∨ ψ
→ Γ ⊢ ¬ φ ⊃ ψ
-- Proof.
∨-to-¬⊃ {Γ}{φ}{ψ} Γ⊢φ∨ψ =
⊃-intro
(⊃-elim
(⊃-intro
(∨-elim {Γ = Γ , ¬ φ}
(⊥-elim ψ
(¬-elim
(weaken φ
(assume (¬ φ)))
(assume {Γ = Γ , ¬ φ} φ)))
(assume {Γ = Γ , ¬ φ} ψ)))
(weaken (¬ φ) Γ⊢φ∨ψ))
-------------------------------------------------------------------------- ∎
-- Theorem.
φ∨⊥-to-φ
: ∀ {Γ} {φ}
→ Γ ⊢ φ ∨ ⊥
→ Γ ⊢ φ
-- Proof.
φ∨⊥-to-φ {φ = φ} Γ⊢φ∨⊥ =
⊃-elim
(⊃-intro
(∨-elim
(assume φ)
(⊥-elim φ (assume ⊥))))
Γ⊢φ∨⊥
-------------------------------------------------------------------------- ∎
-- Theorem.
subst⊢∨₁≡
: ∀ {Γ} {φ ψ γ}
→ φ ≡ γ
→ Γ ⊢ φ ∨ ψ
→ Γ ⊢ γ ∨ ψ
-- Proof.
subst⊢∨₁≡ {φ = φ}{ψ}{γ} φ≡γ Γ⊢φ∨ψ =
⊃-elim
(⊃-intro
(∨-elim
(∨-intro₁ ψ (subst φ≡γ (assume φ)))
(∨-intro₂ γ (assume ψ))))
Γ⊢φ∨ψ
-------------------------------------------------------------------------- ∎
| {
"alphanum_fraction": 0.2833241909,
"avg_line_length": 21.6594059406,
"ext": "agda",
"hexsha": "d8eecff313d154bedc39c7874c68f2e6f5d2f370",
"lang": "Agda",
"max_forks_count": 2,
"max_forks_repo_forks_event_max_datetime": "2017-12-01T17:01:25.000Z",
"max_forks_repo_forks_event_min_datetime": "2017-03-30T16:41:56.000Z",
"max_forks_repo_head_hexsha": "a1730062a6aaced2bb74878c1071db06477044ae",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "jonaprieto/agda-prop",
"max_forks_repo_path": "src/Data/PropFormula/Theorems/Disjunction.agda",
"max_issues_count": 18,
"max_issues_repo_head_hexsha": "a1730062a6aaced2bb74878c1071db06477044ae",
"max_issues_repo_issues_event_max_datetime": "2017-12-18T16:34:21.000Z",
"max_issues_repo_issues_event_min_datetime": "2017-03-08T14:33:10.000Z",
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "jonaprieto/agda-prop",
"max_issues_repo_path": "src/Data/PropFormula/Theorems/Disjunction.agda",
"max_line_length": 78,
"max_stars_count": 13,
"max_stars_repo_head_hexsha": "a1730062a6aaced2bb74878c1071db06477044ae",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "jonaprieto/agda-prop",
"max_stars_repo_path": "src/Data/PropFormula/Theorems/Disjunction.agda",
"max_stars_repo_stars_event_max_datetime": "2022-01-17T03:33:12.000Z",
"max_stars_repo_stars_event_min_datetime": "2017-05-01T16:45:41.000Z",
"num_tokens": 4470,
"size": 10938
} |
{-# OPTIONS --without-K --rewriting #-}
open import HoTT
module homotopy.elims.Lemmas where
fill-upper-right : ∀ {i j} {A : Type i} {B : A → Type j}
{a₀₀ a₀₁ a₁₀ a₁₁ : A}
{p₀₋ : a₀₀ == a₀₁} {p₋₀ : a₀₀ == a₁₀} {p₋₁ : a₀₁ == a₁₁} {p₁₋ : a₁₀ == a₁₁}
(sq : Square p₀₋ p₋₀ p₋₁ p₁₋)
{b₀₀ : B a₀₀} {b₀₁ : B a₀₁} {b₁₀ b₁₀' : B a₁₀} {b₁₁ : B a₁₁}
(q₀₋ : b₀₀ == b₀₁ [ B ↓ p₀₋ ]) (q₋₀ : b₀₀ == b₁₀ [ B ↓ p₋₀ ])
(q₋₁ : b₀₁ == b₁₁ [ B ↓ p₋₁ ]) (q₁₋ : b₁₀' == b₁₁ [ B ↓ p₁₋ ])
→ Σ (b₁₀ == b₁₀')
(λ r → SquareOver B sq q₀₋ q₋₀ q₋₁ (r ◃ q₁₋))
fill-upper-right ids idp idp idp idp = (idp , ids)
fill-upper-right-unique : ∀ {i j} {A : Type i} {B : A → Type j}
{a₀₀ a₀₁ a₁₀ a₁₁ : A}
{p₀₋ : a₀₀ == a₀₁} {p₋₀ : a₀₀ == a₁₀} {p₋₁ : a₀₁ == a₁₁} {p₁₋ : a₁₀ == a₁₁}
(sq : Square p₀₋ p₋₀ p₋₁ p₁₋)
{b₀₀ : B a₀₀} {b₀₁ : B a₀₁} {b₁₀ b₁₀' : B a₁₀} {b₁₁ : B a₁₁}
(q₀₋ : b₀₀ == b₀₁ [ B ↓ p₀₋ ]) (q₋₀ : b₀₀ == b₁₀ [ B ↓ p₋₀ ])
(q₋₁ : b₀₁ == b₁₁ [ B ↓ p₋₁ ]) (q₁₋ : b₁₀' == b₁₁ [ B ↓ p₁₋ ])
(r : b₁₀ == b₁₀')
→ SquareOver B sq q₀₋ q₋₀ q₋₁ (r ◃ q₁₋)
→ r == fst (fill-upper-right sq q₀₋ q₋₀ q₋₁ q₁₋)
fill-upper-right-unique {B = B} ids idp idp idp idp r sq' =
! (◃idp {B = B} r) ∙ ! (horiz-degen-path sq')
| {
"alphanum_fraction": 0.4855729596,
"avg_line_length": 40.4333333333,
"ext": "agda",
"hexsha": "0a63314c1795fd312e746e1fe9acb5b67bc748d4",
"lang": "Agda",
"max_forks_count": 1,
"max_forks_repo_forks_event_max_datetime": "2018-12-26T21:31:57.000Z",
"max_forks_repo_forks_event_min_datetime": "2018-12-26T21:31:57.000Z",
"max_forks_repo_head_hexsha": "e7d663b63d89f380ab772ecb8d51c38c26952dbb",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "mikeshulman/HoTT-Agda",
"max_forks_repo_path": "theorems/homotopy/elims/Lemmas.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "e7d663b63d89f380ab772ecb8d51c38c26952dbb",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "mikeshulman/HoTT-Agda",
"max_issues_repo_path": "theorems/homotopy/elims/Lemmas.agda",
"max_line_length": 77,
"max_stars_count": null,
"max_stars_repo_head_hexsha": "e7d663b63d89f380ab772ecb8d51c38c26952dbb",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "mikeshulman/HoTT-Agda",
"max_stars_repo_path": "theorems/homotopy/elims/Lemmas.agda",
"max_stars_repo_stars_event_max_datetime": null,
"max_stars_repo_stars_event_min_datetime": null,
"num_tokens": 705,
"size": 1213
} |
open import Common.Equality
open import Common.Prelude
NaN : Float
NaN = primFloatDiv 0.0 0.0
NaN≢-NaN : primFloatEquality NaN (primFloatNegate NaN) ≡ true
NaN≢-NaN = refl
NaN≢N-NaN : primFloatNumericalEquality NaN (primFloatNegate NaN) ≡ false
NaN≢N-NaN = refl
| {
"alphanum_fraction": 0.7593984962,
"avg_line_length": 20.4615384615,
"ext": "agda",
"hexsha": "4bee6da64b19efe77d676fd1f5ce97be24c6bbd3",
"lang": "Agda",
"max_forks_count": 1,
"max_forks_repo_forks_event_max_datetime": "2019-03-05T20:02:38.000Z",
"max_forks_repo_forks_event_min_datetime": "2019-03-05T20:02:38.000Z",
"max_forks_repo_head_hexsha": "231d6ad8e77b67ff8c4b1cb35a6c31ccd988c3e9",
"max_forks_repo_licenses": [
"BSD-3-Clause"
],
"max_forks_repo_name": "Agda-zh/agda",
"max_forks_repo_path": "test/Succeed/Issue2194.agda",
"max_issues_count": 3,
"max_issues_repo_head_hexsha": "aac88412199dd4cbcb041aab499d8a6b7e3f4a2e",
"max_issues_repo_issues_event_max_datetime": "2019-04-01T19:39:26.000Z",
"max_issues_repo_issues_event_min_datetime": "2018-11-14T15:31:44.000Z",
"max_issues_repo_licenses": [
"BSD-3-Clause"
],
"max_issues_repo_name": "hborum/agda",
"max_issues_repo_path": "test/Succeed/Issue2194.agda",
"max_line_length": 72,
"max_stars_count": 3,
"max_stars_repo_head_hexsha": "aac88412199dd4cbcb041aab499d8a6b7e3f4a2e",
"max_stars_repo_licenses": [
"BSD-3-Clause"
],
"max_stars_repo_name": "hborum/agda",
"max_stars_repo_path": "test/Succeed/Issue2194.agda",
"max_stars_repo_stars_event_max_datetime": "2015-12-07T20:14:00.000Z",
"max_stars_repo_stars_event_min_datetime": "2015-03-28T14:51:03.000Z",
"num_tokens": 93,
"size": 266
} |
{-# 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
| {
"alphanum_fraction": 0.5242577842,
"avg_line_length": 30.3516483516,
"ext": "agda",
"hexsha": "36606c14dd617e0e112f90b292a288d122d14525",
"lang": "Agda",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "9f9ad9dad7404c75cf457f81ba5ac269afe1b1a7",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "lpw25/cubical",
"max_forks_repo_path": "Cubical/Categories/Category/Base.agda",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "9f9ad9dad7404c75cf457f81ba5ac269afe1b1a7",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "lpw25/cubical",
"max_issues_repo_path": "Cubical/Categories/Category/Base.agda",
"max_line_length": 93,
"max_stars_count": null,
"max_stars_repo_head_hexsha": "9f9ad9dad7404c75cf457f81ba5ac269afe1b1a7",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "lpw25/cubical",
"max_stars_repo_path": "Cubical/Categories/Category/Base.agda",
"max_stars_repo_stars_event_max_datetime": null,
"max_stars_repo_stars_event_min_datetime": null,
"num_tokens": 1196,
"size": 2762
} |
{-# OPTIONS --without-K #-}
-- Two equivalent approached to define the advantage in
-- a (bit) guessing game
open import Data.Two
open import Data.Nat.NP hiding (_==_)
open import Data.Nat.Distance
open import Data.Product.NP
open import Function
open import Explore.Core
open import Explore.Properties
open import Explore.Summable
open import Explore.Sum
open import Explore.Product
open import Explore.Two
open import Relation.Binary.PropositionalEquality.NP
module Explore.GuessingGameFlipping
(R : Set)(sum : Sum R)(sum-ind : SumInd sum)(⅁ : 𝟚 → R → 𝟚) where
open Operators
X Y : R → 𝟚
X = ⅁ 0₂
Y = ⅁ 1₂
R' = 𝟚 × R
sum' : Sum R'
sum' = 𝟚ˢ ×ˢ sum
open FromSum sum' renaming (count to #'_)
open FromSumInd sum-ind renaming (count to #_)
G : R' → 𝟚
G (b , r) = b == ⅁ b r
1/2 : R' → 𝟚
1/2 = fst
-- TODO use the library
lemma : ∀ X → sum (const 1) ≡ #(not ∘ X) + # X
lemma X = sum-ind P refl (λ {a}{b} → part1 {a}{b}) part2
where
count = FromSum.count
P = λ s → s (const 1) ≡ count s (not ∘ X) + count s X
part1 : ∀ {s₀ s₁} → P s₀ → P s₁ → P (λ f → s₀ f + s₁ f)
part1 {s₀} {s₁} Ps₀ Ps₁ rewrite Ps₀ | Ps₁ = +-interchange (count s₀ (not ∘ X)) (count s₀ X) (count s₁ (not ∘ X)) (count s₁ X)
part2 : ∀ x → P (λ f → f x)
part2 x with X x
part2 x | 0₂ = refl
part2 x | 1₂ = refl
thm : dist (#' G) (#' 1/2) ≡ dist (# Y) (# X)
thm = dist (#' G) (#' 1/2)
≡⟨ cong (dist (#' G)) helper ⟩
dist (#' G) (#(not ∘ X) + # X)
≡⟨ refl ⟩ -- #' definition
dist (# (_==_ 0₂ ∘ X) + # (_==_ 1₂ ∘ Y)) (# (not ∘ X) + # X)
≡⟨ refl ⟩ -- #' definition
dist (# (not ∘ X) + # Y) (# (not ∘ X) + # X)
≡⟨ dist-x+ (# (not ∘ X)) (# Y) (# X) ⟩
dist (# Y) (# X)
∎
where
open ≡-Reasoning
helper = #' 1/2
≡⟨ refl ⟩
sum (const 0) + sum (const 1)
≡⟨ cong (λ p → p + sum (const 1)) sum-zero ⟩
sum (const 1)
≡⟨ lemma X ⟩
# (not ∘ X) + # X
∎
| {
"alphanum_fraction": 0.5004770992,
"avg_line_length": 27.2207792208,
"ext": "agda",
"hexsha": "55b8ad5fa85c3fb7ba5fb4f876202850558c946c",
"lang": "Agda",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "16bc8333503ff9c00d47d56f4ec6113b9269a43e",
"max_forks_repo_licenses": [
"BSD-3-Clause"
],
"max_forks_repo_name": "crypto-agda/explore",
"max_forks_repo_path": "lib/Explore/GuessingGameFlipping.agda",
"max_issues_count": 1,
"max_issues_repo_head_hexsha": "16bc8333503ff9c00d47d56f4ec6113b9269a43e",
"max_issues_repo_issues_event_max_datetime": "2019-03-16T14:24:04.000Z",
"max_issues_repo_issues_event_min_datetime": "2019-03-16T14:24:04.000Z",
"max_issues_repo_licenses": [
"BSD-3-Clause"
],
"max_issues_repo_name": "crypto-agda/explore",
"max_issues_repo_path": "lib/Explore/GuessingGameFlipping.agda",
"max_line_length": 131,
"max_stars_count": 2,
"max_stars_repo_head_hexsha": "16bc8333503ff9c00d47d56f4ec6113b9269a43e",
"max_stars_repo_licenses": [
"BSD-3-Clause"
],
"max_stars_repo_name": "crypto-agda/explore",
"max_stars_repo_path": "lib/Explore/GuessingGameFlipping.agda",
"max_stars_repo_stars_event_max_datetime": "2017-06-28T19:19:29.000Z",
"max_stars_repo_stars_event_min_datetime": "2016-06-05T09:25:32.000Z",
"num_tokens": 814,
"size": 2096
} |
{-# OPTIONS --profile=interactive #-}
open import Common.Prelude
open import Common.Equality
`1 = suc zero
`2 = `1 + `1
`4 = `2 + `2
`8 = `4 + `4
`16 = `8 + `8
`32 = `16 + `16
`64 = `32 + `32
`128 = `64 + `64
`256 = `128 + `128
`512 = `256 + `256
`1024 = `512 + `512
`2048 = `1024 + `1024
`4096 = `2048 + `2048
`8192 = `4096 + `4096
`16384 = `8192 + `8192
`32768 = `16384 + `16384
`65536 = `32768 + `32768
prf8 : `8 ≡ 8
prf8 = refl
prf65k : `65536 ≡ 65536
prf65k = refl
| {
"alphanum_fraction": 0.4480968858,
"avg_line_length": 20.6428571429,
"ext": "agda",
"hexsha": "4afb824677c03ca4b5525e8b98ee1baf1942d3a0",
"lang": "Agda",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "b5b3b1657556f720a7310cb7744edb1fac71eaf4",
"max_forks_repo_licenses": [
"BSD-2-Clause"
],
"max_forks_repo_name": "Seanpm2001-Agda-lang/agda",
"max_forks_repo_path": "test/Succeed/SharedDefinitions.agda",
"max_issues_count": 6,
"max_issues_repo_head_hexsha": "b5b3b1657556f720a7310cb7744edb1fac71eaf4",
"max_issues_repo_issues_event_max_datetime": "2021-11-24T08:31:10.000Z",
"max_issues_repo_issues_event_min_datetime": "2021-10-18T08:12:24.000Z",
"max_issues_repo_licenses": [
"BSD-2-Clause"
],
"max_issues_repo_name": "Seanpm2001-Agda-lang/agda",
"max_issues_repo_path": "test/Succeed/SharedDefinitions.agda",
"max_line_length": 37,
"max_stars_count": 1,
"max_stars_repo_head_hexsha": "6b13364d36eeb60d8ec15eaf8effe23c73401900",
"max_stars_repo_licenses": [
"BSD-2-Clause"
],
"max_stars_repo_name": "sseefried/agda",
"max_stars_repo_path": "test/Succeed/SharedDefinitions.agda",
"max_stars_repo_stars_event_max_datetime": "2022-03-05T00:25:14.000Z",
"max_stars_repo_stars_event_min_datetime": "2022-03-05T00:25:14.000Z",
"num_tokens": 268,
"size": 578
} |
------------------------------------------------------------------------
-- INCREMENTAL λ-CALCULUS
--
-- Standard evaluation with the Nehemiah plugin.
------------------------------------------------------------------------
module Nehemiah.Denotation.Evaluation where
open import Nehemiah.Syntax.Type
open import Nehemiah.Syntax.Term
open import Nehemiah.Denotation.Value
open import Data.Integer
open import Structure.Bag.Nehemiah
import Parametric.Denotation.Evaluation Const ⟦_⟧Base as Evaluation
⟦_⟧Const : Evaluation.Structure
⟦ intlit-const n ⟧Const = n
⟦ add-const ⟧Const = λ m n → m + n
⟦ minus-const ⟧Const = λ n → - n
⟦ empty-const ⟧Const = emptyBag
⟦ insert-const ⟧Const = λ n b → singletonBag n ++ b
⟦ union-const ⟧Const = λ b₁ b₂ → b₁ ++ b₂
⟦ negate-const ⟧Const = λ b → negateBag b
⟦ flatmap-const ⟧Const = λ f b → flatmapBag f b
⟦ sum-const ⟧Const = λ b → sumBag b
open Evaluation.Structure ⟦_⟧Const public
| {
"alphanum_fraction": 0.6163793103,
"avg_line_length": 30.9333333333,
"ext": "agda",
"hexsha": "44d8f97fc8ba6fff6cf88688407a960f539b5af5",
"lang": "Agda",
"max_forks_count": 1,
"max_forks_repo_forks_event_max_datetime": "2016-02-18T12:26:44.000Z",
"max_forks_repo_forks_event_min_datetime": "2016-02-18T12:26:44.000Z",
"max_forks_repo_head_hexsha": "39bb081c6f192bdb87bd58b4a89291686d2d7d03",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "inc-lc/ilc-agda",
"max_forks_repo_path": "Nehemiah/Denotation/Evaluation.agda",
"max_issues_count": 6,
"max_issues_repo_head_hexsha": "39bb081c6f192bdb87bd58b4a89291686d2d7d03",
"max_issues_repo_issues_event_max_datetime": "2017-05-04T13:53:59.000Z",
"max_issues_repo_issues_event_min_datetime": "2015-07-01T18:09:31.000Z",
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "inc-lc/ilc-agda",
"max_issues_repo_path": "Nehemiah/Denotation/Evaluation.agda",
"max_line_length": 72,
"max_stars_count": 10,
"max_stars_repo_head_hexsha": "39bb081c6f192bdb87bd58b4a89291686d2d7d03",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "inc-lc/ilc-agda",
"max_stars_repo_path": "Nehemiah/Denotation/Evaluation.agda",
"max_stars_repo_stars_event_max_datetime": "2019-07-19T07:06:59.000Z",
"max_stars_repo_stars_event_min_datetime": "2015-03-04T06:09:20.000Z",
"num_tokens": 262,
"size": 928
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.