Search is not available for this dataset
text
string
meta
dict
module Examples.Main where import Examples.PingPong as PingPong import Examples.InfiniteBind as InfiniteBind import Examples.TestSelectiveReceive as SelectiveReceive import Examples.TestCall as Call open import Runtime open import SimulationEnvironment open import ActorMonad import IO open ∞ActorM pingpongEntry = singleton-env (PingPong.spawner .force) infinitebindEntry = singleton-env (InfiniteBind.binder .force) selectiveReceiveEntry = singleton-env SelectiveReceive.spawner callEntry = singleton-env (Call.calltestActor .force) main = IO.run (run-env pingpongEntry)
{ "alphanum_fraction": 0.8434782609, "avg_line_length": 31.9444444444, "ext": "agda", "hexsha": "67f28d50bee844152eb42c2a486f9efd87fb6444", "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": "ae541df13d069df4eb1464f29fbaa9804aad439f", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "Zalastax/singly-typed-actors", "max_forks_repo_path": "src/Examples/Main.agda", "max_issues_count": null, "max_issues_repo_head_hexsha": "ae541df13d069df4eb1464f29fbaa9804aad439f", "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": "Zalastax/singly-typed-actors", "max_issues_repo_path": "src/Examples/Main.agda", "max_line_length": 62, "max_stars_count": 1, "max_stars_repo_head_hexsha": "ae541df13d069df4eb1464f29fbaa9804aad439f", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "Zalastax/thesis", "max_stars_repo_path": "src/Examples/Main.agda", "max_stars_repo_stars_event_max_datetime": "2018-02-02T16:44:43.000Z", "max_stars_repo_stars_event_min_datetime": "2018-02-02T16:44:43.000Z", "num_tokens": 133, "size": 575 }
{- This second-order signature was created from the following second-order syntax description: syntax GroupAction | GA type * : 0-ary X : 0-ary term unit : * | ε add : * * -> * | _⊕_ l20 neg : * -> * | ⊖_ r40 act : * X -> X | _⊙_ r30 theory (εU⊕ᴸ) a |> add (unit, a) = a (εU⊕ᴿ) a |> add (a, unit) = a (⊕A) a b c |> add (add(a, b), c) = add (a, add(b, c)) (⊖N⊕ᴸ) a |> add (neg (a), a) = unit (⊖N⊕ᴿ) a |> add (a, neg (a)) = unit (εU⊙) x : X |> act (unit, x) = x (⊕A⊙) g h x : X |> act (add(g, h), x) = act (g, act(h, x)) -} module GroupAction.Signature where open import SOAS.Context -- Type declaration data GAT : Set where * : GAT X : GAT open import SOAS.Syntax.Signature GAT public open import SOAS.Syntax.Build GAT public -- Operator symbols data GAₒ : Set where unitₒ addₒ negₒ actₒ : GAₒ -- Term signature GA:Sig : Signature GAₒ GA:Sig = sig λ { unitₒ → ⟼₀ * ; addₒ → (⊢₀ *) , (⊢₀ *) ⟼₂ * ; negₒ → (⊢₀ *) ⟼₁ * ; actₒ → (⊢₀ *) , (⊢₀ X) ⟼₂ X } open Signature GA:Sig public
{ "alphanum_fraction": 0.5314553991, "avg_line_length": 19.7222222222, "ext": "agda", "hexsha": "efdca085184b7a71bbbbfec15f7cf3fbda12f549", "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": "out/GroupAction/Signature.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": "out/GroupAction/Signature.agda", "max_line_length": 91, "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": "out/GroupAction/Signature.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": 492, "size": 1065 }
module Typechecker where data Nat : Set where zero : Nat suc : Nat -> Nat {-# BUILTIN NATURAL Nat #-} {-# BUILTIN ZERO zero #-} {-# BUILTIN SUC suc #-} _+_ : Nat -> Nat -> Nat zero + m = m suc n + m = suc (n + m) data Fin : Nat -> Set where f0 : {n : Nat} -> Fin (suc n) fs : {n : Nat} -> Fin n -> Fin (suc n) infixl 30 _::_ _++_ data Vect (A : Set) : Nat -> Set where ε : Vect A zero _::_ : {n : Nat} -> Vect A n -> A -> Vect A (suc n) fs^ : {n : Nat}(m : Nat) -> Fin n -> Fin (m + n) fs^ zero i = i fs^ (suc m) i = fs (fs^ m i) _++_ : {A : Set}{n m : Nat} -> Vect A n -> Vect A m -> Vect A (m + n) xs ++ ε = xs xs ++ (ys :: y) = (xs ++ ys) :: y data Chop {A : Set} : {n : Nat} -> Vect A n -> Fin n -> Set where chopGlue : {m n : Nat}(xs : Vect A n)(x : A)(ys : Vect A m) -> Chop (xs :: x ++ ys) (fs^ m f0) chop : {A : Set}{n : Nat}(xs : Vect A n)(i : Fin n) -> Chop xs i chop ε () chop (xs :: x) f0 = chopGlue xs x ε chop (xs :: y) (fs i) with chop xs i chop (.(xs :: x ++ ys) :: y) (fs .(fs^ m f0)) | chopGlue {m} xs x ys = chopGlue xs x (ys :: y) infixr 40 _⊃_ data Simp : Set where o : Simp _⊃_ : Simp -> Simp -> Simp infix 20 Simp-_ data Simp-_ : Simp -> Set where neqo : Simp -> Simp -> Simp- o neq⊃ : {S T : Simp} -> Simp- (S ⊃ T) neqT : {S T : Simp}(T' : Simp- T) -> Simp- (S ⊃ T) neqS : {S : Simp}{T₁ : Simp}(S' : Simp- S)(T₂ : Simp) -> Simp- (S ⊃ T₁) infixl 60 _∖_ _∖_ : (S : Simp) -> Simp- S -> Simp .o ∖ neqo S T = S ⊃ T .(_ ⊃ _) ∖ neq⊃ = o .(S ⊃ T) ∖ neqT {S}{T} T' = S ⊃ T ∖ T' .(S ⊃ _) ∖ neqS {S} S' T₂ = S ∖ S' ⊃ T₂ data SimpEq? (S : Simp) : Simp -> Set where simpSame : SimpEq? S S simpDiff : (T : Simp- S) -> SimpEq? S (S ∖ T) simpEq? : (S T : Simp) -> SimpEq? S T simpEq? o o = simpSame simpEq? o (S ⊃ T) = simpDiff (neqo S T) simpEq? (S ⊃ T) o = simpDiff neq⊃ simpEq? (S₁ ⊃ T₁) (S₂ ⊃ T₂) with simpEq? S₁ S₂ simpEq? (S ⊃ T₁) (.S ⊃ T₂) | simpSame with simpEq? T₁ T₂ simpEq? (S ⊃ T) (.S ⊃ .T) | simpSame | simpSame = simpSame simpEq? (S ⊃ T) (.S ⊃ .(T ∖ T')) | simpSame | simpDiff T' = simpDiff (neqT T') simpEq? (S ⊃ T₁) (.(S ∖ S') ⊃ T₂) | simpDiff S' = simpDiff (neqS S' T₂) data Term : Nat -> Set where var : {n : Nat} -> Fin n -> Term n app : {n : Nat} -> Term n -> Term n -> Term n lam : {n : Nat} -> Simp -> Term (suc n) -> Term n data Good : {n : Nat} -> Vect Simp n -> Simp -> Set where gVar : {n m : Nat}(Γ : Vect Simp n)(T : Simp)(Δ : Vect Simp m) -> Good (Γ :: T ++ Δ) T gApp : {n : Nat}{Γ : Vect Simp n}{S T : Simp} -> Good Γ (S ⊃ T) -> Good Γ S -> Good Γ T gLam : {n : Nat}{Γ : Vect Simp n}(S : Simp){T : Simp} -> Good (Γ :: S) T -> Good Γ (S ⊃ T) g : {n : Nat}{Γ : Vect Simp n}(T : Simp) -> Good Γ T -> Term n g T (gVar{n}{m} Γ .T Δ) = var (fs^ m f0) g T (gApp f s) = app (g _ f) (g _ s) g .(S ⊃ _) (gLam S t) = lam S (g _ t) data Bad {n : Nat}(Γ : Vect Simp n) : Set where bNonFun : Good Γ o -> Term n -> Bad Γ bMismatch : {S T : Simp}(S' : Simp- S) -> Good Γ (S ⊃ T) -> Good Γ (S ∖ S') -> Bad Γ bArg : {S T : Simp} -> Good Γ (S ⊃ T) -> Bad Γ -> Bad Γ bFun : Bad Γ -> Term n -> Bad Γ bLam : (S : Simp) -> Bad (Γ :: S) -> Bad Γ b : {n : Nat}{Γ : Vect Simp n} -> Bad Γ -> Term n b (bNonFun f s) = app (g o f) s b (bMismatch _ f s) = app (g _ f) (g _ s) b (bArg f s) = app (g _ f) (b s) b (bFun f s) = app (b f) s b (bLam S t) = lam S (b t) data TypeCheck? {n : Nat}(Γ : Vect Simp n) : Term n -> Set where good : (T : Simp)(t : Good Γ T) -> TypeCheck? Γ (g T t) bad : (t : Bad Γ) -> TypeCheck? Γ (b t) typeCheck? : {n : Nat}(Γ : Vect Simp n)(t : Term n) -> TypeCheck? Γ t typeCheck? Γ (var i) with chop Γ i typeCheck? .(Γ :: T ++ Δ) (var ._) | chopGlue Γ T Δ = good T (gVar Γ T Δ) typeCheck? Γ (app f s) with typeCheck? Γ f typeCheck? Γ (app .(g (S ⊃ T) f) s) | good (S ⊃ T) f with typeCheck? Γ s typeCheck? Γ (app .(g (S ⊃ T) f) .(g S' s)) | good (S ⊃ T) f | good S' s with simpEq? S S' typeCheck? Γ (app .(g (S ⊃ T) f) .(g S s)) | good (S ⊃ T) f | good .S s | simpSame = good T (gApp f s) typeCheck? Γ (app .(g (S ⊃ T) f) .(g (S ∖ S') s)) | good (S ⊃ T) f | good .(S ∖ S') s | simpDiff S' = bad (bMismatch S' f s) typeCheck? Γ (app .(g (S ⊃ T) f) .(b s)) | good (S ⊃ T) f | bad s = bad (bArg f s) typeCheck? Γ (app .(g o f) s) | good o f = bad (bNonFun f s) typeCheck? Γ (app .(b f) s) | bad f = bad (bFun f s) typeCheck? Γ (lam S t) with typeCheck? (Γ :: S) t typeCheck? Γ (lam S .(g T t)) | good T t = good (S ⊃ T) (gLam S t) typeCheck? Γ (lam S .(b t)) | bad t = bad (bLam S t)
{ "alphanum_fraction": 0.4732570239, "avg_line_length": 35.0729927007, "ext": "agda", "hexsha": "51669df557a25e5f6a1bba4eed060d6ba3519c9c", "lang": "Agda", "max_forks_count": null, "max_forks_repo_forks_event_max_datetime": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_head_hexsha": "20596e9dd9867166a64470dd24ea68925ff380ce", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "np/agda-git-experiment", "max_forks_repo_path": "examples/vfl/Typechecker.agda", "max_issues_count": null, "max_issues_repo_head_hexsha": "20596e9dd9867166a64470dd24ea68925ff380ce", "max_issues_repo_issues_event_max_datetime": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_licenses": [ "MIT" ], "max_issues_repo_name": "np/agda-git-experiment", "max_issues_repo_path": "examples/vfl/Typechecker.agda", "max_line_length": 87, "max_stars_count": 1, "max_stars_repo_head_hexsha": "aa10ae6a29dc79964fe9dec2de07b9df28b61ed5", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "asr/agda-kanso", "max_stars_repo_path": "examples/vfl/Typechecker.agda", "max_stars_repo_stars_event_max_datetime": "2019-11-27T04:41:05.000Z", "max_stars_repo_stars_event_min_datetime": "2019-11-27T04:41:05.000Z", "num_tokens": 2121, "size": 4805 }
{-# OPTIONS --without-K #-} open import Base module Homotopy.VanKampen.Guide where open import Homotopy.Truncation open import Homotopy.Connected record legend i (city : Set i) : Set (suc i) where constructor leg_,_,_ field name : Set i loc : name → city all-listed : ∀ c → [ hfiber loc c ] id-legend : ∀ {i} (A : Set i) → legend i A id-legend A = leg A , id A , λ x → proj $ x , refl private module Book {i} {city : Set i} {l : legend i city} where open legend l private data #guide : Set i where #point : name → #guide guide : Set i guide = #guide point : name → guide point = #point postulate -- HIT route : ∀ n₁ n₂ → loc n₁ ≡ loc n₂ → point n₁ ≡ point n₂ guide-rec : ∀ {l} (P : guide → Set l) (point* : (n : name) → P (point n)) (route* : ∀ n₁ n₂ (p : loc n₁ ≡ loc n₂) → transport P (route n₁ n₂ p) (point* n₁) ≡ point* n₂) → (x : guide) → P x guide-rec P point* route* (#point n) = point* n postulate -- HIT guide-β-route : ∀ {l} (P : guide → Set l) (point* : (n : name) → P (point n)) (route* : ∀ n₁ n₂ (p : loc n₁ ≡ loc n₂) → transport P (route n₁ n₂ p) (point* n₁) ≡ point* n₂) n₁ n₂ (p : loc n₁ ≡ loc n₂) → apd (guide-rec {l} P point* route*) (route n₁ n₂ p) ≡ route* n₁ n₂ p guide-rec-nondep : ∀ {l} (P : Set l) (point* : name → P) (route* : ∀ n₁ n₂ → loc n₁ ≡ loc n₂ → point* n₁ ≡ point* n₂) → (guide → P) guide-rec-nondep P point* route* (#point n) = point* n postulate -- HIT guide-β-route-nondep : ∀ {l} (P : Set l) (point* : name → P) (route* : ∀ n₁ n₂ → loc n₁ ≡ loc n₂ → point* n₁ ≡ point* n₂) n₁ n₂ (p : loc n₁ ≡ loc n₂) → ap (guide-rec-nondep P point* route*) (route n₁ n₂ p) ≡ route* n₁ n₂ p open Book public hiding (guide) module _ {i} {city : Set i} (l : legend i city) where open legend l guide : Set i guide = Book.guide {i} {city} {l} visit : guide → city visit = guide-rec-nondep city loc (λ _ _ p → p) visit-β-route : ∀ n₁ n₂ (p : loc n₁ ≡ loc n₂) → ap visit (route n₁ n₂ p) ≡ p visit-β-route = guide-β-route-nondep city loc (λ _ _ p → p) private drawn-as-one : ∀ c → is-contr (π₀ $ hfiber visit c) drawn-as-one c = []-extend-nondep ⦃ is-connected-is-prop ⟨0⟩ ⦄ ( λ {(n₁ , p₁) → proj (point n₁ , p₁) , π₀-extend ⦃ λ _ → ≡-is-set $ π₀-is-set $ hfiber visit c ⦄ ( uncurry $ guide-rec (λ x → ∀ p₂ → proj (x , p₂) ≡ proj (point n₁ , p₁)) (λ n₂ p₂ → ap proj let p₃ = p₂ ∘ ! p₁ in Σ-eq (route n₂ n₁ p₃) $ transport (λ x → visit x ≡ c) (route n₂ n₁ p₃) p₂ ≡⟨ trans-app≡cst visit c (route n₂ n₁ p₃) p₂ ⟩ ! (ap visit (route n₂ n₁ p₃)) ∘ p₂ ≡⟨ ap (λ x → ! x ∘ p₂) $ visit-β-route n₂ n₁ p₃ ⟩ ! (p₂ ∘ ! p₁) ∘ p₂ ≡⟨ ap (λ x → x ∘ p₂) $ opposite-concat p₂ (! p₁) ⟩ (! (! p₁) ∘ ! p₂) ∘ p₂ ≡⟨ concat-assoc (! (! p₁)) (! p₂) p₂ ⟩ ! (! p₁) ∘ (! p₂ ∘ p₂) ≡⟨ ap (λ x → ! (! p₁) ∘ x) $ opposite-left-inverse p₂ ⟩ ! (! p₁) ∘ refl ≡⟨ refl-right-unit $ ! (! p₁) ⟩ ! (! p₁) ≡⟨ opposite-opposite p₁ ⟩∎ p₁ ∎) (λ _ _ _ → funext λ _ → prop-has-all-paths (π₀-is-set _ _ _) _ _))}) (all-listed c) private visit-fiber-rec′ : ∀ {j} (P : city → Set j) (h₀-point : ∀ n → P (loc n)) (h₁-route : ∀ n₁ n₂ r → transport P r (h₀-point n₁) ≡ h₀-point n₂) → (∀ c → hfiber visit c → P c) visit-fiber-rec′ P h₀-p h₁-r c (pt , p₁) = transport P p₁ $ guide-rec (P ◯ visit) h₀-p (λ n₁ n₂ r → transport (P ◯ visit) (route n₁ n₂ r) (h₀-p n₁) ≡⟨ ! $ trans-ap P visit (route n₁ n₂ r) $ h₀-p n₁ ⟩ transport P (ap visit $ route n₁ n₂ r) (h₀-p n₁) ≡⟨ ap (λ x → transport P x $ h₀-p n₁) $ visit-β-route n₁ n₂ r ⟩ transport P r (h₀-p n₁) ≡⟨ h₁-r n₁ n₂ r ⟩∎ h₀-p n₂ ∎) pt visit-fiber-rec : ∀ {j} (P : city → Set j) ⦃ _ : ∀ (c : city) → is-set $ P c ⦄ (h₀-point : ∀ n → P (loc n)) (h₁-route : ∀ n₁ n₂ r → transport P r (h₀-point n₁) ≡ h₀-point n₂) → (∀ c → P c) visit-fiber-rec P ⦃ P-is-set ⦄ h₀-p h₁-r c = π₀-extend-nondep ⦃ P-is-set c ⦄ (visit-fiber-rec′ P h₀-p h₁-r c) (π₁ $ drawn-as-one c) visit-fiber-β-loc : ∀ {j} (P : city → Set j) ⦃ P-is-set : ∀ (c : city) → is-set $ P c ⦄ (h₀-p : ∀ n → P (loc n)) (h₁-r : ∀ n₁ n₂ r → transport P r (h₀-p n₁) ≡ h₀-p n₂) → ∀ n → visit-fiber-rec P ⦃ P-is-set ⦄ h₀-p h₁-r (loc n) ≡ h₀-p n visit-fiber-β-loc P ⦃ P-is-set ⦄ h₀-p h₁-r n = visit-fiber-rec P ⦃ P-is-set ⦄ h₀-p h₁-r (loc n) ≡⟨ ap (π₀-extend-nondep ⦃ P-is-set $ loc n ⦄ (visit-fiber-rec′ P h₀-p h₁-r $ loc n)) $ ! $ π₂ (drawn-as-one $ loc n) (proj $ point n , refl) ⟩∎ h₀-p n ∎ private loc-fiber-rec′ : ∀ {j} (P : city → Set j) (h₀-point : ∀ n → P (loc n)) → (∀ c → hfiber loc c → P c) loc-fiber-rec′ P h₀-p c (n , p) = transport P p (h₀-p n) loc-fiber-rec : ∀ {j} (P : city → Set j) ⦃ _ : ∀ c → is-prop $ P c ⦄ (h₀-point : ∀ n → P (loc n)) → (∀ c → P c) loc-fiber-rec P ⦃ P-is-prop ⦄ h₀-p c = []-extend-nondep ⦃ P-is-prop c ⦄ (loc-fiber-rec′ P h₀-p c) (all-listed c) loc-fiber-β-loc : ∀ {j} (P : city → Set j) ⦃ P-is-prop : ∀ (c : city) → is-prop $ P c ⦄ (h₀-p : ∀ n → P (loc n)) → ∀ n → loc-fiber-rec P ⦃ P-is-prop ⦄ h₀-p (loc n) ≡ h₀-p n loc-fiber-β-loc P ⦃ P-is-prop ⦄ h₀-p n = loc-fiber-rec P ⦃ P-is-prop ⦄ h₀-p (loc n) ≡⟨ ap ([]-extend-nondep ⦃ P-is-prop $ loc n ⦄ (loc-fiber-rec′ P h₀-p $ loc n)) $ prop-has-all-paths []-is-prop (all-listed $ loc n) $ proj $ n , refl ⟩∎ h₀-p n ∎ -- Did I preserve the computational contents for identity legend? private module IdTest {i} {city : Set i} where open legend (id-legend city) visit-fiber-β-id : ∀ {j} (P : city → Set j) ⦃ P-is-set : ∀ (c : city) → is-set $ P c ⦄ (h₀-p : ∀ n → P n) (h₁-r : ∀ n₁ n₂ r → transport P r (h₀-p n₁) ≡ h₀-p n₂) → ∀ n → visit-fiber-rec (id-legend city) P ⦃ P-is-set ⦄ h₀-p h₁-r n ≡ h₀-p n visit-fiber-β-id P ⦃ P-is-set ⦄ h₀-p h₁-r n = refl loc-fiber-β-id : ∀ {j} (P : city → Set j) ⦃ P-is-prop : ∀ (c : city) → is-prop $ P c ⦄ (h₀-p : ∀ n → P n) → ∀ n → loc-fiber-rec (id-legend city) P ⦃ P-is-prop ⦄ h₀-p n ≡ h₀-p n loc-fiber-β-id P ⦃ P-is-prop ⦄ h₀-p n = refl
{ "alphanum_fraction": 0.4853425067, "avg_line_length": 35.5638297872, "ext": "agda", "hexsha": "315008bbec41dc6135d8089597aa90339d9d0d95", "lang": "Agda", "max_forks_count": 50, "max_forks_repo_forks_event_max_datetime": "2022-02-14T03:03:25.000Z", "max_forks_repo_forks_event_min_datetime": "2015-01-10T01:48:08.000Z", "max_forks_repo_head_hexsha": "939a2d83e090fcc924f69f7dfa5b65b3b79fe633", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "nicolaikraus/HoTT-Agda", "max_forks_repo_path": "old/Homotopy/VanKampen/Guide.agda", "max_issues_count": 31, "max_issues_repo_head_hexsha": "939a2d83e090fcc924f69f7dfa5b65b3b79fe633", "max_issues_repo_issues_event_max_datetime": "2021-10-03T19:15:25.000Z", "max_issues_repo_issues_event_min_datetime": "2015-03-05T20:09:00.000Z", "max_issues_repo_licenses": [ "MIT" ], "max_issues_repo_name": "nicolaikraus/HoTT-Agda", "max_issues_repo_path": "old/Homotopy/VanKampen/Guide.agda", "max_line_length": 90, "max_stars_count": 294, "max_stars_repo_head_hexsha": "66f800adef943afdf08c17b8ecfba67340fead5e", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "timjb/HoTT-Agda", "max_stars_repo_path": "old/Homotopy/VanKampen/Guide.agda", "max_stars_repo_stars_event_max_datetime": "2022-03-20T13:54:45.000Z", "max_stars_repo_stars_event_min_datetime": "2015-01-09T16:23:23.000Z", "num_tokens": 2726, "size": 6686 }
{-# OPTIONS --profile=notclose #-}
{ "alphanum_fraction": 0.6285714286, "avg_line_length": 17.5, "ext": "agda", "hexsha": "13d249f7b3d88fbadd843df4df4ae2b5cae1fba8", "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/Fail/Issue5781a.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/Fail/Issue5781a.agda", "max_line_length": 34, "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/Fail/Issue5781a.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": 8, "size": 35 }
{- Descriptor language for easily defining relational structures -} {-# OPTIONS --cubical --no-import-sorts --no-exact-split --safe #-} module Cubical.Structures.Relational.Macro where open import Cubical.Foundations.Prelude open import Cubical.Foundations.Equiv open import Cubical.Foundations.HLevels open import Cubical.Foundations.Structure open import Cubical.Foundations.RelationalStructure open import Cubical.Data.Sigma open import Cubical.Structures.Relational.Constant open import Cubical.Structures.Relational.Function open import Cubical.Structures.Relational.Maybe open import Cubical.Structures.Relational.Parameterized open import Cubical.Structures.Relational.Pointed open import Cubical.Structures.Relational.Product open import Cubical.Structures.Macro open import Cubical.Structures.Maybe data PosRelDesc (ℓ : Level) : Typeω where -- constant structure: X ↦ A constant : ∀ {ℓ'} → hSet ℓ' → PosRelDesc ℓ -- pointed structure: X ↦ X var : PosRelDesc ℓ -- product of structures S,T : X ↦ (S X × T X) _,_ : PosRelDesc ℓ → PosRelDesc ℓ → PosRelDesc ℓ -- Maybe on a structure S: X ↦ Maybe (S X) maybe : PosRelDesc ℓ → PosRelDesc ℓ data RelDesc (ℓ : Level) : Typeω where -- constant structure: X ↦ A constant : ∀ {ℓ'} → hSet ℓ' → RelDesc ℓ -- pointed structure: X ↦ X var : RelDesc ℓ -- product of structures S,T : X ↦ (S X × T X) _,_ : RelDesc ℓ → RelDesc ℓ → RelDesc ℓ -- structure S parameterized by constant A : X ↦ (A → S X) param : ∀ {ℓ'} → (A : Type ℓ') → RelDesc ℓ → RelDesc ℓ -- function from positive structure S to T: X ↦ (S X → T X) function+ : PosRelDesc ℓ → RelDesc ℓ → RelDesc ℓ -- Maybe on a structure S: X ↦ Maybe (S X) maybe : RelDesc ℓ → RelDesc ℓ infixr 4 _,_ posRelDesc→TranspDesc : ∀ {ℓ} → PosRelDesc ℓ → TranspDesc ℓ posRelDesc→TranspDesc (constant A) = constant (A .fst) posRelDesc→TranspDesc var = var posRelDesc→TranspDesc (d₀ , d₁) = posRelDesc→TranspDesc d₀ , posRelDesc→TranspDesc d₁ posRelDesc→TranspDesc (maybe d) = maybe (posRelDesc→TranspDesc d) posRelDesc→RelDesc : ∀ {ℓ} → PosRelDesc ℓ → RelDesc ℓ posRelDesc→RelDesc (constant A) = constant A posRelDesc→RelDesc var = var posRelDesc→RelDesc (d₀ , d₁) = posRelDesc→RelDesc d₀ , posRelDesc→RelDesc d₁ posRelDesc→RelDesc (maybe d) = maybe (posRelDesc→RelDesc d) relDesc→Desc : ∀ {ℓ} → RelDesc ℓ → Desc ℓ relDesc→Desc (constant A) = constant (A .fst) relDesc→Desc var = var relDesc→Desc (d₀ , d₁) = relDesc→Desc d₀ , relDesc→Desc d₁ relDesc→Desc (param A d) = function+ (constant A) (relDesc→Desc d) relDesc→Desc (function+ d₀ d₁) = function+ (posRelDesc→TranspDesc d₀) (relDesc→Desc d₁) relDesc→Desc (maybe d) = maybe (relDesc→Desc d) {- Universe level calculations -} posRelMacroStrLevel : ∀ {ℓ} → PosRelDesc ℓ → Level posRelMacroStrLevel d = transpMacroLevel (posRelDesc→TranspDesc d) relMacroStrLevel : ∀ {ℓ} → RelDesc ℓ → Level relMacroStrLevel d = macroStrLevel (relDesc→Desc d) posRelMacroRelLevel : ∀ {ℓ} → PosRelDesc ℓ → Level posRelMacroRelLevel (constant {ℓ'} A) = ℓ' posRelMacroRelLevel {ℓ} var = ℓ posRelMacroRelLevel (d₀ , d₁) = ℓ-max (posRelMacroRelLevel d₀) (posRelMacroRelLevel d₁) posRelMacroRelLevel (maybe d) = posRelMacroRelLevel d relMacroRelLevel : ∀ {ℓ} → RelDesc ℓ → Level relMacroRelLevel (constant {ℓ'} A) = ℓ' relMacroRelLevel {ℓ} var = ℓ relMacroRelLevel (d₀ , d₁) = ℓ-max (relMacroRelLevel d₀) (relMacroRelLevel d₁) relMacroRelLevel (param {ℓ'} A d) = ℓ-max ℓ' (relMacroRelLevel d) relMacroRelLevel (function+ d₀ d₁) = ℓ-max (posRelMacroStrLevel d₀) (ℓ-max (posRelMacroRelLevel d₀) (relMacroRelLevel d₁)) relMacroRelLevel (maybe d) = relMacroRelLevel d {- Definition of structure -} PosRelMacroStructure : ∀ {ℓ} (d : PosRelDesc ℓ) → Type ℓ → Type (posRelMacroStrLevel d) PosRelMacroStructure d = TranspMacroStructure (posRelDesc→TranspDesc d) RelMacroStructure : ∀ {ℓ} (d : RelDesc ℓ) → Type ℓ → Type (relMacroStrLevel d) RelMacroStructure d = MacroStructure (relDesc→Desc d) {- Notion of structured relation defined by a descriptor -} PosRelMacroRelStr : ∀ {ℓ} (d : PosRelDesc ℓ) → StrRel {ℓ} (PosRelMacroStructure d) (posRelMacroRelLevel d) PosRelMacroRelStr (constant A) = ConstantRelStr A PosRelMacroRelStr var = PointedRelStr PosRelMacroRelStr (d₀ , d₁) = ProductRelStr (PosRelMacroRelStr d₀) (PosRelMacroRelStr d₁) PosRelMacroRelStr (maybe d) = MaybeRelStr (PosRelMacroRelStr d) RelMacroRelStr : ∀ {ℓ} (d : RelDesc ℓ) → StrRel {ℓ} (RelMacroStructure d) (relMacroRelLevel d) RelMacroRelStr (constant A) = ConstantRelStr A RelMacroRelStr var = PointedRelStr RelMacroRelStr (d₀ , d₁) = ProductRelStr (RelMacroRelStr d₀) (RelMacroRelStr d₁) RelMacroRelStr (param A d) = ParamRelStr A (λ _ → RelMacroRelStr d) RelMacroRelStr (function+ d₀ d₁) = FunctionRelStr (PosRelMacroRelStr d₀) (RelMacroRelStr d₁) RelMacroRelStr (maybe d) = MaybeRelStr (RelMacroRelStr d) {- Proof that structure induced by descriptor is suitable or positive -} posRelMacroSuitableRel : ∀ {ℓ} (d : PosRelDesc ℓ) → SuitableStrRel _ (PosRelMacroRelStr d) posRelMacroSuitableRel (constant A) = constantSuitableRel A posRelMacroSuitableRel var = pointedSuitableRel posRelMacroSuitableRel (d₀ , d₁) = productSuitableRel (posRelMacroSuitableRel d₀) (posRelMacroSuitableRel d₁) posRelMacroSuitableRel (maybe d) = maybeSuitableRel (posRelMacroSuitableRel d) posRelMacroPositiveRel : ∀ {ℓ} (d : PosRelDesc ℓ) → PositiveStrRel (posRelMacroSuitableRel d) posRelMacroPositiveRel (constant A) = constantPositiveRel A posRelMacroPositiveRel var = pointedPositiveRel posRelMacroPositiveRel (d₀ , d₁) = productPositiveRel (posRelMacroPositiveRel d₀) (posRelMacroPositiveRel d₁) posRelMacroPositiveRel (maybe d) = maybePositiveRel (posRelMacroPositiveRel d) relMacroSuitableRel : ∀ {ℓ} (d : RelDesc ℓ) → SuitableStrRel _ (RelMacroRelStr d) relMacroSuitableRel (constant A) = constantSuitableRel A relMacroSuitableRel var = pointedSuitableRel relMacroSuitableRel (d₀ , d₁) = productSuitableRel (relMacroSuitableRel d₀) (relMacroSuitableRel d₁) relMacroSuitableRel (param A d) = paramSuitableRel A (λ _ → relMacroSuitableRel d) relMacroSuitableRel (function+ d₀ d₁) = functionSuitableRel (posRelMacroSuitableRel d₀) (posRelMacroPositiveRel d₀) (relMacroSuitableRel d₁) relMacroSuitableRel (maybe d) = maybeSuitableRel (relMacroSuitableRel d) {- Proof that structured relations and equivalences agree -} posRelMacroMatchesEquiv : ∀ {ℓ} (d : PosRelDesc ℓ) → StrRelMatchesEquiv (PosRelMacroRelStr d) (EquivAction→StrEquiv (transpMacroAction (posRelDesc→TranspDesc d))) posRelMacroMatchesEquiv (constant A) _ _ _ = idEquiv _ posRelMacroMatchesEquiv var _ _ _ = idEquiv _ posRelMacroMatchesEquiv (d₀ , d₁) = productRelMatchesTransp (PosRelMacroRelStr d₀) (transpMacroAction (posRelDesc→TranspDesc d₀)) (PosRelMacroRelStr d₁) (transpMacroAction (posRelDesc→TranspDesc d₁)) (posRelMacroMatchesEquiv d₀) (posRelMacroMatchesEquiv d₁) posRelMacroMatchesEquiv (maybe d) = maybeRelMatchesTransp (PosRelMacroRelStr d) (transpMacroAction (posRelDesc→TranspDesc d)) (posRelMacroMatchesEquiv d) relMacroMatchesEquiv : ∀ {ℓ} (d : RelDesc ℓ) → StrRelMatchesEquiv (RelMacroRelStr d) (MacroEquivStr (relDesc→Desc d)) relMacroMatchesEquiv (constant A) = constantRelMatchesEquiv A relMacroMatchesEquiv var = pointedRelMatchesEquiv relMacroMatchesEquiv (d₁ , d₂) = productRelMatchesEquiv (RelMacroRelStr d₁) (RelMacroRelStr d₂) (relMacroMatchesEquiv d₁) (relMacroMatchesEquiv d₂) relMacroMatchesEquiv (param A d) = paramRelMatchesEquiv A (λ _ → RelMacroRelStr d) (λ _ → relMacroMatchesEquiv d) relMacroMatchesEquiv (function+ d₀ d₁) = functionRelMatchesEquiv+ (PosRelMacroRelStr d₀) (transpMacroAction (posRelDesc→TranspDesc d₀)) (RelMacroRelStr d₁) (MacroEquivStr (relDesc→Desc d₁)) (posRelMacroMatchesEquiv d₀) (relMacroMatchesEquiv d₁) relMacroMatchesEquiv (maybe d) = maybeRelMatchesEquiv (RelMacroRelStr d) (relMacroMatchesEquiv d) -- Module for easy importing module RelMacro ℓ (d : RelDesc ℓ) where relation = RelMacroRelStr d suitable = relMacroSuitableRel d matches = relMacroMatchesEquiv d open Macro ℓ (relDesc→Desc d) public
{ "alphanum_fraction": 0.7625598821, "avg_line_length": 44.0054054054, "ext": "agda", "hexsha": "2d7ee9a9bffa53f5dd21125725858a028242c8d8", "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/Structures/Relational/Macro.agda", "max_issues_count": 1, "max_issues_repo_head_hexsha": "c345dc0c49d3950dc57f53ca5f7099bb53a4dc3a", "max_issues_repo_issues_event_max_datetime": "2022-01-27T02:07:48.000Z", "max_issues_repo_issues_event_min_datetime": "2022-01-27T02:07:48.000Z", "max_issues_repo_licenses": [ "MIT" ], "max_issues_repo_name": "Schippmunk/cubical", "max_issues_repo_path": "Cubical/Structures/Relational/Macro.agda", "max_line_length": 113, "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/Structures/Relational/Macro.agda", "max_stars_repo_stars_event_max_datetime": null, "max_stars_repo_stars_event_min_datetime": null, "num_tokens": 2708, "size": 8141 }
------------------------------------------------------------------------------ -- Totality properties respect to OrdList ------------------------------------------------------------------------------ {-# OPTIONS --exact-split #-} {-# OPTIONS --no-sized-types #-} {-# OPTIONS --no-universe-polymorphism #-} {-# OPTIONS --without-K #-} module FOTC.Program.SortList.Properties.Totality.OrdListI where open import Common.FOL.Relation.Binary.EqReasoning open import FOTC.Base open import FOTC.Base.List open import FOTC.Data.Bool open import FOTC.Data.Bool.PropertiesI open import FOTC.Data.Nat.Inequalities open import FOTC.Data.Nat.List.Type open import FOTC.Data.Nat.Type open import FOTC.Data.List open import FOTC.Data.List.PropertiesI open import FOTC.Program.SortList.Properties.Totality.BoolI open import FOTC.Program.SortList.SortList ------------------------------------------------------------------------------ -- If (i ∷ is) is ordered then 'is' is ordered. subList-OrdList : ∀ {i is} → N i → ListN is → OrdList (i ∷ is) → OrdList is subList-OrdList {i} Ni lnnil LOi∷is = ordList-[] subList-OrdList {i} Ni (lncons {j} {js} Nj Ljs) LOi∷j∷js = &&-list₂-t₂ (le-ItemList-Bool Ni (lncons Nj Ljs)) (ordList-Bool (lncons Nj Ljs)) (trans (sym (ordList-∷ i (j ∷ js))) LOi∷j∷js) ++-OrdList-helper : ∀ {item is js} → N item → ListN is → ListN js → ≤-ItemList item is → ≤-ItemList item js → ≤-Lists is js → ≤-ItemList item (is ++ js) ++-OrdList-helper {item} {js = js} _ lnnil _ _ item≤js _ = subst (≤-ItemList item) (sym (++-leftIdentity js)) item≤js ++-OrdList-helper {item} {js = js} Nitem (lncons {i} {is} Ni LNis) LNjs item≤i∷is item≤js i∷is≤js = le-ItemList item ((i ∷ is) ++ js) ≡⟨ subst (λ t → le-ItemList item ((i ∷ is) ++ js) ≡ le-ItemList item t) (++-∷ i is js) refl ⟩ le-ItemList item (i ∷ (is ++ js)) ≡⟨ le-ItemList-∷ item i (is ++ js) ⟩ le item i && le-ItemList item (is ++ js) ≡⟨ subst (λ t → le item i && le-ItemList item (is ++ js) ≡ t && le-ItemList item (is ++ js)) (&&-list₂-t₁ (le-Bool Nitem Ni) (le-ItemList-Bool Nitem LNis) (trans (sym (le-ItemList-∷ item i is)) item≤i∷is)) refl ⟩ true && le-ItemList item (is ++ js) ≡⟨ subst (λ t → true && le-ItemList item (is ++ js) ≡ true && t) (++-OrdList-helper Nitem LNis LNjs lemma₁ item≤js lemma₂) refl ⟩ true && true ≡⟨ t&&x≡x true ⟩ true ∎ where lemma₁ : le-ItemList item is ≡ true lemma₁ = &&-list₂-t₂ (le-Bool Nitem Ni) (le-ItemList-Bool Nitem LNis) (trans (sym (le-ItemList-∷ item i is)) item≤i∷is) lemma₂ : le-Lists is js ≡ true lemma₂ = &&-list₂-t₂ (le-ItemList-Bool Ni LNjs) (le-Lists-Bool LNis LNjs) (trans (sym (le-Lists-∷ i is js)) i∷is≤js)
{ "alphanum_fraction": 0.5130434783, "avg_line_length": 39.3037974684, "ext": "agda", "hexsha": "7d63e4a17ffddddc7b7e3837ace4a1d477f8132a", "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/SortList/Properties/Totality/OrdListI.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/SortList/Properties/Totality/OrdListI.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/SortList/Properties/Totality/OrdListI.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": 947, "size": 3105 }
{- Byzantine Fault Tolerant Consensus Verification in Agda, version 0.9. Copyright (c) 2021, Oracle and/or its affiliates. Licensed under the Universal Permissive License v 1.0 as shown at https://opensource.oracle.com/licenses/upl -} -- This module contains properties that are only about the behavior of the handlers, nothing to do -- with system state open import Optics.All open import LibraBFT.Prelude open import LibraBFT.Base.ByteString open import LibraBFT.Base.Types open import LibraBFT.Hash open import LibraBFT.Impl.Base.Types open import LibraBFT.Impl.Consensus.Types open import LibraBFT.Impl.Util.Util module LibraBFT.Impl.Consensus.RoundManager.Properties where open import LibraBFT.Impl.Consensus.RoundManager voteForCurrentEpoch : ∀ {ts pm pre vm αs} → (SendVote vm αs) ∈ LBFT-outs (processProposalMsg ts pm) pre → (₋rmEC pre) ^∙ rmEpoch ≡ vm ^∙ vmVote ∙ vEpoch voteForCurrentEpoch (here refl) = refl -- The quorum certificates sent in SyncInfo with votes are those from the peer state procPMCerts≡ : ∀ {ts pm pre vm αs} → (SendVote vm αs) ∈ LBFT-outs (processProposalMsg ts pm) pre → vm ^∙ vmSyncInfo ≡ SyncInfo∙new (₋rmHighestQC pre) (₋rmHighestCommitQC pre) procPMCerts≡ (there x) = ⊥-elim (¬Any[] x) -- processProposalMsg sends only one vote procPMCerts≡ (here refl) = refl
{ "alphanum_fraction": 0.7185714286, "avg_line_length": 41.1764705882, "ext": "agda", "hexsha": "c24db70067cf91820848fe104fdd026aa06f69bd", "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": "71aa2168e4875ffdeece9ba7472ee3cee5fa9084", "max_forks_repo_licenses": [ "UPL-1.0" ], "max_forks_repo_name": "cwjnkins/bft-consensus-agda", "max_forks_repo_path": "LibraBFT/Impl/Consensus/RoundManager/Properties.agda", "max_issues_count": null, "max_issues_repo_head_hexsha": "71aa2168e4875ffdeece9ba7472ee3cee5fa9084", "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": "cwjnkins/bft-consensus-agda", "max_issues_repo_path": "LibraBFT/Impl/Consensus/RoundManager/Properties.agda", "max_line_length": 111, "max_stars_count": null, "max_stars_repo_head_hexsha": "71aa2168e4875ffdeece9ba7472ee3cee5fa9084", "max_stars_repo_licenses": [ "UPL-1.0" ], "max_stars_repo_name": "cwjnkins/bft-consensus-agda", "max_stars_repo_path": "LibraBFT/Impl/Consensus/RoundManager/Properties.agda", "max_stars_repo_stars_event_max_datetime": null, "max_stars_repo_stars_event_min_datetime": null, "num_tokens": 400, "size": 1400 }
{-# OPTIONS --universe-polymorphism #-} module Categories.Cones where open import Level open import Categories.Support.PropositionalEquality open import Categories.Category open import Categories.Functor hiding (_∘_; _≡_; equiv; id; assoc; identityˡ; identityʳ; ∘-resp-≡) open import Categories.Cone record ConeMorphism {o ℓ e} {o′ ℓ′ e′} {C : Category o ℓ e} {J : Category o′ ℓ′ e′} {F : Functor J C} (c₁ c₂ : Cone F) : Set (ℓ ⊔ e ⊔ o′ ⊔ ℓ′) where module c₁ = Cone c₁ module c₂ = Cone c₂ module C = Category C module J = Category J open C field f : C [ c₁.N , c₂.N ] .commute : ∀ {X} → c₁.ψ X ≡ c₂.ψ X ∘ f Cones : ∀ {o ℓ e} {o′ ℓ′ e′} {C : Category o ℓ e} {J : Category o′ ℓ′ e′} (F : Functor J C) → Category (o ⊔ ℓ ⊔ e ⊔ o′ ⊔ ℓ′) (ℓ ⊔ e ⊔ o′ ⊔ ℓ′) e Cones {C = C} F = record { Obj = Obj′ ; _⇒_ = Hom′ ; _≡_ = _≡′_ ; _∘_ = _∘′_ ; id = record { f = id; commute = Equiv.sym identityʳ } ; assoc = assoc ; identityˡ = identityˡ ; identityʳ = identityʳ ; equiv = record { refl = Equiv.refl ; sym = Equiv.sym ; trans = Equiv.trans } ; ∘-resp-≡ = ∘-resp-≡ } where open Category C open Cone open ConeMorphism open Functor F infixr 9 _∘′_ infix 4 _≡′_ Obj′ = Cone F Hom′ : Obj′ → Obj′ → Set _ Hom′ = ConeMorphism _≡′_ : ∀ {A B} → Hom′ A B → Hom′ A B → Set _ F ≡′ G = f F ≡ f G _∘′_ : ∀ {A B C} → Hom′ B C → Hom′ A B → Hom′ A C _∘′_ {A} {B} {C} F G = record { f = f F ∘ f G ; commute = commute′ } where .commute′ : ∀ {X} → ψ A X ≡ ψ C X ∘ (f F ∘ f G) commute′ {X} = begin ψ A X ↓⟨ ConeMorphism.commute G ⟩ ψ B X ∘ f G ↓⟨ ∘-resp-≡ˡ (ConeMorphism.commute F) ⟩ (ψ C X ∘ f F) ∘ f G ↓⟨ assoc ⟩ ψ C X ∘ (f F ∘ f G) ∎ where open HomReasoning -- Equality of cone morphisms is equality of the underlying arrows in the -- base category, but the same is not (directly) true of the heterogeneous -- equality. These functions make the equivalence manifest. module Heteroconic {o ℓ e} {o′ ℓ′ e′} {C : Category o ℓ e} {J : Category o′ ℓ′ e′} (F : Functor J C) where open Heterogeneous C module ▵ = Heterogeneous (Cones F) open ▵ public using () renaming (_∼_ to _▵̃_) open ConeMorphism using () renaming (f to ⌞_⌝) demote-∼ : ∀ {K L K′ L′} {f : ConeMorphism K L} {g : ConeMorphism K′ L′} → f ▵̃ g → ⌞ f ⌝ ∼ ⌞ g ⌝ demote-∼ (≡⇒∼ y) = Heterogeneous.≡⇒∼ y -- XXX probably need another argument or something to nail things down -- promote-∼ : ∀ {K L K′ L′} {f : ConeMorphism {C = C} K L} {g : ConeMorphism {C = C} K′ L′} -- → ⌞ f ⌝ ∼ ⌞ g ⌝ → f ▵̃ g -- promote-∼ h = {!h!} -- The category of cones comes with an equivalence of objects, which can be -- used to float morphisms from one to another. Really it should have a -- setoid of objects, but we're not equipped for that. module Float {o ℓ e} {o′ ℓ′ e′} {C : Category o ℓ e} {J : Category o′ ℓ′ e′} (F : Functor J C) where module H = Heterogeneous C open H hiding (float₂; floatˡ; floatʳ; floatˡ-resp-trans; float₂-breakdown-lr; float₂-breakdown-rl) private lemma₁ : ∀ (A B : Cone F) {f₁ f₂ : C [ Cone.N A , Cone.N B ]} (f₁≣f₂ : f₁ ≣ f₂) .(pf₁ : ∀ {X} → C [ Cone.ψ A X ≡ C [ Cone.ψ B X ∘ f₁ ] ]) .(pf₂ : ∀ {X} → C [ Cone.ψ A X ≡ C [ Cone.ψ B X ∘ f₂ ] ]) → _≣_ {A = ConeMorphism A B} record { f = f₁ ; commute = pf₁ } record { f = f₂ ; commute = pf₂ } lemma₁ A B ≣-refl = λ ._ ._ → ≣-refl morphism-determines-cone-morphism-≣ : ∀ {A B} {m m′ : Cones F [ A , B ]} → ConeMorphism.f m ≣ ConeMorphism.f m′ → m ≣ m′ morphism-determines-cone-morphism-≣ {A} {B} {m} {m′} pf = lemma₁ A B pf (ConeMorphism.commute m) (ConeMorphism.commute m′) float₂ : ∀ {A A′ B B′} → F [ A ≜ A′ ] → F [ B ≜ B′ ] → Cones F [ A , B ] → Cones F [ A′ , B′ ] float₂ A≜A′ B≜B′ κ = record { f = H.float₂ (N-≣ A≜A′) (N-≣ B≜B′) f ; commute = λ {j} → ∼⇒≡ (trans (sym (ψ-≡ A≜A′ j)) (trans (≡⇒∼ commute) (∘-resp-∼ (ψ-≡ B≜B′ j) (float₂-resp-∼ (N-≣ A≜A′) (N-≣ B≜B′))))) } where open ConeMorphism κ open ConeOver._≜_ floatˡ : ∀ {A B B′} → F [ B ≜ B′ ] → Cones F [ A , B ] → Cones F [ A , B′ ] floatˡ {A = A} B≜B′ κ = record { f = H.floatˡ N-≣ f ; commute = λ {j} → C.Equiv.trans commute (∼⇒≡ (∘-resp-∼ (ψ-≡ j) (floatˡ-resp-∼ N-≣))) } where module A = Cone A open ConeMorphism κ open ConeOver._≜_ B≜B′ floatˡ-resp-refl : ∀ {A B} (κ : Cones F [ A , B ]) → floatˡ {A} {B} (ConeOver.≜-refl F) κ ≣ κ floatˡ-resp-refl f = ≣-refl floatˡ-resp-trans : ∀ {A B B′ B″} (B≜B′ : F [ B ≜ B′ ]) (B′≜B″ : F [ B′ ≜ B″ ]) (κ : Cones F [ A , B ]) → floatˡ {A} {B} {B″} (ConeOver.≜-trans F B≜B′ B′≜B″) κ ≣ floatˡ {A} {B′} {B″} B′≜B″ (floatˡ {A} {B} {B′} B≜B′ κ) floatˡ-resp-trans {A} {B} {B′} {B″} B≜B′ B′≜B″ κ = morphism-determines-cone-morphism-≣ {A} {B″} {floatˡ {A} {B} {B″} (ConeOver.≜-trans F B≜B′ B′≜B″) κ} {floatˡ {A} {B′} {B″} B′≜B″ (floatˡ {A} {B} {B′} B≜B′ κ)} (H.floatˡ-resp-trans (N-≣ B≜B′) (N-≣ B′≜B″) f) where module A = Cone A open ConeOver._≜_ open ConeMorphism κ floatʳ : ∀ {A A′ B} → F [ A ≜ A′ ] → Cones F [ A , B ] → Cones F [ A′ , B ] floatʳ {B = B} A≜A′ κ = record { f = ≣-subst (λ X → C [ X , B.N ]) N-≣ f ; commute = λ {j} → ∼⇒≡ (trans (sym (ψ-≡ j)) (trans (≡⇒∼ commute) (∘-resp-∼ʳ (floatʳ-resp-∼ N-≣)))) } where module B = Cone B open ConeMorphism κ open ConeOver._≜_ A≜A′ float₂-breakdown-lr : ∀ {A A′ B B′ : Cone F} (A≜A′ : F [ A ≜ A′ ]) (B≜B′ : F [ B ≜ B′ ]) (κ : Cones F [ A , B ]) → float₂ A≜A′ B≜B′ κ ≣ floatˡ B≜B′ (floatʳ A≜A′ κ) float₂-breakdown-lr {A′ = A′} {B′ = B′} A≜A′ B≜B′ κ = morphism-determines-cone-morphism-≣ {A = A′} {B′} {float₂ A≜A′ B≜B′ κ} {floatˡ B≜B′ (floatʳ A≜A′ κ)} (H.float₂-breakdown-lr (N-≣ A≜A′) (N-≣ B≜B′) (ConeMorphism.f κ)) where open ConeOver._≜_ float₂-breakdown-rl : ∀ {A A′ B B′ : Cone F} (A≜A′ : F [ A ≜ A′ ]) (B≜B′ : F [ B ≜ B′ ]) (κ : Cones F [ A , B ]) → float₂ A≜A′ B≜B′ κ ≣ floatʳ A≜A′ (floatˡ B≜B′ κ) float₂-breakdown-rl {A′ = A′} {B′ = B′} A≜A′ B≜B′ κ = morphism-determines-cone-morphism-≣ {A = A′} {B′} {float₂ A≜A′ B≜B′ κ} {floatʳ A≜A′ (floatˡ B≜B′ κ)} (H.float₂-breakdown-rl (N-≣ A≜A′) (N-≣ B≜B′) (ConeMorphism.f κ)) where open ConeOver._≜_
{ "alphanum_fraction": 0.5288980629, "avg_line_length": 40.1146496815, "ext": "agda", "hexsha": "10c0de888fa4e8be01ca51a34e5e63cbe09d683f", "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/Cones.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/Cones.agda", "max_line_length": 296, "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/Cones.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": 2979, "size": 6298 }
module L.Base.Core where -- Reexport all of the Cores open import L.Base.Sigma.Core public open import L.Base.Coproduct.Core public open import L.Base.Empty.Core public open import L.Base.Unit.Core public open import L.Base.Nat.Core public open import L.Base.Id.Core public
{ "alphanum_fraction": 0.7963636364, "avg_line_length": 27.5, "ext": "agda", "hexsha": "3bf375719f17379bd431f2e4f59c4d306398d0a5", "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/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/Core.agda", "max_line_length": 40, "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/Core.agda", "max_stars_repo_stars_event_max_datetime": null, "max_stars_repo_stars_event_min_datetime": null, "num_tokens": 67, "size": 275 }
module Data.DependentWidthTree where import Lvl open import Functional using (id) open import Functional.Dependent open import Numeral.Finite open import Numeral.Natural open import Type private variable ℓ ℓᵢ ℓₗ ℓₙ ℓₒ : Lvl.Level private variable N N₁ N₂ L T A B : Type{ℓ} module _ {N : Type{ℓₙ}} (Index : N → Type{ℓᵢ}) where -- A tree where the number of children depends on the data stored in a node. -- Leaves should be represented by having nodes that indicate no children. -- Note: A tree that have no leaves will not be constructible. data Tree : Type{ℓₙ Lvl.⊔ ℓᵢ} where Node : (node : N) → (Index(node) → Tree) → Tree -- The data of the root node of a tree. root : Tree → N root (Node node _) = node -- The children of a node of a tree. -- They are indexed by `Index`. child : (t : Tree) → (Index(root t) → Tree) child (Node _ child) = child Tree-elim : ∀{P : Tree → Type{ℓ}} → (∀(node)(child) → (∀(i) → P(child(i))) → P(Node node child)) → ((tree : Tree) → P(tree)) Tree-elim{P = P} f (Node node child) = f node child (Tree-elim{P = P} f ∘ child) open import Logic.Propositional -- It is impossible for every node to have at least one child while at the same time a tree exists. -- Note that constructively, this is not enough to prove the existence of leaves. Tree-no-leaves-impossibility : (∀{node} → Index(node)) → Tree → ⊥ Tree-no-leaves-impossibility p (Node n c) = Tree-no-leaves-impossibility p (c(p{n})) module _ {N : Type{ℓₙ}} (width : N → ℕ) where FiniteTree = Tree(𝕟 ∘ width) module _ where open import Data.Boolean -- A tree of finite variating width holding no data other than the structure of the tree (the number of children for each node). -- Example: -- 3: -- ├1: -- │└0 -- ├2: -- │├0 -- │└1: -- │ └0 -- └0 FiniteTreeStructure = FiniteTree id -- An empty tree contains no children. -- This is also functioning as a leaf to a tree. empty : FiniteTreeStructure empty = Node 0 \() -- A tree containing a single child that contains a leaf. singleton : FiniteTreeStructure singleton = Node 1 \{𝟎 → empty} isLeaf : FiniteTreeStructure → Bool isLeaf(Node 𝟎 _) = 𝑇 isLeaf(Node (𝐒 _) _) = 𝐹 isNode : FiniteTreeStructure → Bool isNode(Node 𝟎 _) = 𝐹 isNode(Node (𝐒 _) _) = 𝑇 import Numeral.CoordinateVector as CoordinateVector open import Numeral.Natural.Function open import Numeral.Natural.Oper -- The height is the length of the longest path from the root node. -- Alternative implementation (will not pass the termination checker): -- height(Node 𝟎 child) = 𝟎 -- height(Node (𝐒(node)) child) = 𝐒(CoordinateVector.foldᵣ(max ∘ height) 𝟎 child) height : FiniteTreeStructure → ℕ height = Tree-elim 𝕟 (\{𝟎 _ _ → 𝟎 ; (𝐒(c)) _ prev → 𝐒(CoordinateVector.foldᵣ max 𝟎 prev)}) -- The size of a tree is the number of nodes in the tree. size : FiniteTreeStructure → ℕ size = Tree-elim 𝕟 (\{𝟎 _ _ → 𝟎 ; (𝐒(c)) _ prev → 𝐒(CoordinateVector.foldᵣ (_+_) 𝟎 prev)})
{ "alphanum_fraction": 0.6598751232, "avg_line_length": 34.9770114943, "ext": "agda", "hexsha": "66269191a2c08ce5a4ffcc05fbdc678b1e224e21", "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/DependentWidthTree.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/DependentWidthTree.agda", "max_line_length": 130, "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/DependentWidthTree.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": 1008, "size": 3043 }
module SafeFlagPrimTrustMe where -- Cannot make an example with the correct type signature for -- primTrustMe since it requires postulated universe level builtins, -- which --safe flag will reject. private primitive primTrustMe : Set
{ "alphanum_fraction": 0.7875, "avg_line_length": 24, "ext": "agda", "hexsha": "75e7b27ae298537c396eb46836d5495cec6823c9", "lang": "Agda", "max_forks_count": 1, "max_forks_repo_forks_event_max_datetime": "2022-03-12T11:35:18.000Z", "max_forks_repo_forks_event_min_datetime": "2022-03-12T11:35:18.000Z", "max_forks_repo_head_hexsha": "70c8a575c46f6a568c7518150a1a64fcd03aa437", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "masondesu/agda", "max_forks_repo_path": "test/fail/SafeFlagPrimTrustMe.agda", "max_issues_count": null, "max_issues_repo_head_hexsha": "70c8a575c46f6a568c7518150a1a64fcd03aa437", "max_issues_repo_issues_event_max_datetime": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_licenses": [ "MIT" ], "max_issues_repo_name": "masondesu/agda", "max_issues_repo_path": "test/fail/SafeFlagPrimTrustMe.agda", "max_line_length": 68, "max_stars_count": 1, "max_stars_repo_head_hexsha": "c0ae7d20728b15d7da4efff6ffadae6fe4590016", "max_stars_repo_licenses": [ "BSD-3-Clause" ], "max_stars_repo_name": "redfish64/autonomic-agda", "max_stars_repo_path": "test/Fail/SafeFlagPrimTrustMe.agda", "max_stars_repo_stars_event_max_datetime": "2019-11-27T04:41:05.000Z", "max_stars_repo_stars_event_min_datetime": "2019-11-27T04:41:05.000Z", "num_tokens": 53, "size": 240 }
-- {-# OPTIONS --no-forcing #-} {-# OPTIONS --rewriting #-} {-# OPTIONS --sized-types #-} open import Agda.Builtin.Equality open import Agda.Builtin.Size {-# BUILTIN REWRITE _≡_ #-} variable i j : Size postulate ANY : ∀{A : Set} → A data Ty : Set where bool : Ty variable a b c d : Ty infixl 5 _∘_ infixr 6 _∷_ _++_ mutual data Tm (c : Ty) : Set where tm : ∀{i a} (E : Stack i a c) → Tm c data Stack (i : Size) : (a c : Ty) → Set where ε : ∀{c} → Stack i c c _∷_ : ∀{j : Size< i}{b} (u : Tm b) (E : Stack j b c) → Stack i bool c variable E E' E′ : Stack i a c _++_ : ∀{a b c} → Stack ∞ a b → Stack ∞ b c → Stack ∞ a c ε ++ E′ = E′ (u ∷ E) ++ E′ = u ∷ (E ++ E′) postulate _∘_ : ∀{a c} → Tm a → Stack ∞ a c → Tm c app-app : ∀{i j a b c}{t : Tm a} {E : Stack i a b} {E′ : Stack j b c} → t ∘ E ∘ E′ ≡ t ∘ E ++ E′ {-# REWRITE app-app #-} infix 4 _↦_ _↦ₛ_ mutual data _↦_ {c} : (t t′ : Tm c) → Set where ↦E : (r : E ↦ₛ E′) → tm E ↦ tm E′ -- ↦E : ∀{i a} {E E′ : Stack i a c} (r : E ↦ₛ E′) → tm E ↦ tm E′ -- no internal error data _↦ₛ_ {c} : ∀ {i a} (E E′ : Stack i a c) → Set where π : ∀{i a u v} {E : Stack i a c} → (u ∷ v ∷ E) ↦ₛ ((u ∘ v ∷ ε) ∷ E) there : ∀{i a u} {E E′ : Stack i a c} (r : E ↦ₛ E′) → u ∷ E ↦ₛ u ∷ E′ data SN {a} (t : Tm a) : Set where acc : (h : {t′ : Tm a} (r : t ↦ t′) → SN t′) → SN t -- {-# TERMINATING #-} -- removes internal error test : {i : Size} {a c : Ty} {t : Tm a} {E : Stack i a c} (sntE : SN (t ∘ E)) → SN (tm (t ∷ E)) test {i = i} {t = t} (acc sntE) = acc λ { (↦E (there r)) → test (sntE ANY) ; (↦E (π {i = j})) → test {i = j} (acc sntE) }
{ "alphanum_fraction": 0.4563279857, "avg_line_length": 25.1194029851, "ext": "agda", "hexsha": "a08b95d83b8f92e217f91ca67ae86ea00531c3c9", "lang": "Agda", "max_forks_count": null, "max_forks_repo_forks_event_max_datetime": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_head_hexsha": "ed8ac6f4062ea8a20fa0f62d5db82d4e68278338", "max_forks_repo_licenses": [ "BSD-3-Clause" ], "max_forks_repo_name": "shlevy/agda", "max_forks_repo_path": "test/Fail/Issue4929.agda", "max_issues_count": null, "max_issues_repo_head_hexsha": "ed8ac6f4062ea8a20fa0f62d5db82d4e68278338", "max_issues_repo_issues_event_max_datetime": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_licenses": [ "BSD-3-Clause" ], "max_issues_repo_name": "shlevy/agda", "max_issues_repo_path": "test/Fail/Issue4929.agda", "max_line_length": 98, "max_stars_count": null, "max_stars_repo_head_hexsha": "ed8ac6f4062ea8a20fa0f62d5db82d4e68278338", "max_stars_repo_licenses": [ "BSD-3-Clause" ], "max_stars_repo_name": "shlevy/agda", "max_stars_repo_path": "test/Fail/Issue4929.agda", "max_stars_repo_stars_event_max_datetime": null, "max_stars_repo_stars_event_min_datetime": null, "num_tokens": 790, "size": 1683 }
module Sets where import Equality open Equality public infixr 10 _$_ infixr 40 _[+]_ _<+>_ _>+<_ infixr 60 _[×]_ _<×>_ _>×<_ infixr 90 _∘_ id : {A : Set} -> A -> A id x = x _∘_ : {A B C : Set} -> (B -> C) -> (A -> B) -> A -> C f ∘ g = \x -> f (g x) _$_ : {A B : Set} -> (A -> B) -> A -> B f $ x = f x data _[+]_ (A B : Set) : Set where inl : A -> A [+] B inr : B -> A [+] B _<+>_ : {A₁ A₂ B₁ B₂ : Set} -> (A₁ -> A₂) -> (B₁ -> B₂) -> A₁ [+] B₁ -> A₂ [+] B₂ (f <+> g) (inl x) = inl (f x) (f <+> g) (inr y) = inr (g y) _>+<_ : {A B C : Set} -> (A -> C) -> (B -> C) -> A [+] B -> C (f >+< g) (inl x) = f x (f >+< g) (inr y) = g y data _[×]_ (A B : Set) : Set where <_,_> : A -> B -> A [×] B -- sections <∙,_> : {A B : Set} -> B -> A -> A [×] B <∙, x > = \y -> < y , x > <_,∙> : {A B : Set} -> A -> B -> A [×] B < x ,∙> = \y -> < x , y > _<×>_ : {A₁ A₂ B₁ B₂ : Set} -> (A₁ -> A₂) -> (B₁ -> B₂) -> A₁ [×] B₁ -> A₂ [×] B₂ (f <×> g) < x , y > = < f x , g y > _>×<_ : {A B C : Set} -> (A -> B) -> (A -> C) -> A -> B [×] C (f >×< g) x = < f x , g x > fst : {A B : Set} -> A [×] B -> A fst < a , b > = a snd : {A B : Set} -> A [×] B -> B snd < a , b > = b η-[×] : {A B : Set}(p : A [×] B) -> p == < fst p , snd p > η-[×] < a , b > = refl data [1] : Set where <> : [1] data [0] : Set where data List (A : Set) : Set where [] : List A _::_ : A -> List A -> List A
{ "alphanum_fraction": 0.3385345997, "avg_line_length": 22, "ext": "agda", "hexsha": "49a371521358f6f6b0a209ddab83df9877a91d13", "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": "examples/outdated-and-incorrect/clowns/Sets.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": "examples/outdated-and-incorrect/clowns/Sets.agda", "max_line_length": 83, "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": "examples/outdated-and-incorrect/clowns/Sets.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": 745, "size": 1474 }
-- 2014-04-24 module _ where open import Common.Size open import Common.Prelude using (Bool; true; false; if_then_else_) open import Common.Product -- sized lists data List A {i} : Set where [] : List A _∷_ : {i' : Size< i} (x : A) (xs : List A {i'}) → List A _++_ : ∀{A} → List A → List A → List A [] ++ ys = ys (x ∷ xs) ++ ys = x ∷ (xs ++ ys) partition : ∀{A i} (p : A → Bool) (l : List A {i}) → List A {i} × List A {i} partition p [] = [] , [] partition p (x ∷ xs) = let l , r = partition p xs in if p x then ((x ∷ l) , r) else (l , (x ∷ r)) module Sort {A : Set} (_≤_ : A → A → Bool) where quicksort : ∀{i} → List A {i} → List A quicksort [] = [] quicksort (x ∷ []) = x ∷ [] quicksort (x ∷ xs) = let x≤ , ≤x = partition (_≤_ x) xs in quicksort ≤x ++ (x ∷ quicksort x≤)
{ "alphanum_fraction": 0.5171149144, "avg_line_length": 26.3870967742, "ext": "agda", "hexsha": "0a11af416a2793f248bc96f383691f4eceeaae69", "lang": "Agda", "max_forks_count": 1, "max_forks_repo_forks_event_max_datetime": "2019-03-05T20:02:38.000Z", "max_forks_repo_forks_event_min_datetime": "2019-03-05T20:02:38.000Z", "max_forks_repo_head_hexsha": "c0ae7d20728b15d7da4efff6ffadae6fe4590016", "max_forks_repo_licenses": [ "BSD-3-Clause" ], "max_forks_repo_name": "redfish64/autonomic-agda", "max_forks_repo_path": "test/Succeed/SizedQuicksort.agda", "max_issues_count": null, "max_issues_repo_head_hexsha": "c0ae7d20728b15d7da4efff6ffadae6fe4590016", "max_issues_repo_issues_event_max_datetime": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_licenses": [ "BSD-3-Clause" ], "max_issues_repo_name": "redfish64/autonomic-agda", "max_issues_repo_path": "test/Succeed/SizedQuicksort.agda", "max_line_length": 76, "max_stars_count": 3, "max_stars_repo_head_hexsha": "c0ae7d20728b15d7da4efff6ffadae6fe4590016", "max_stars_repo_licenses": [ "BSD-3-Clause" ], "max_stars_repo_name": "redfish64/autonomic-agda", "max_stars_repo_path": "test/Succeed/SizedQuicksort.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": 320, "size": 818 }
{-# OPTIONS --safe --warning=error --without-K #-} open import LogicalFormulae open import Functions.Definition open import Groups.Definition open import Groups.Abelian.Definition open import Setoids.Setoids open import Rings.Definition open import Sets.FinSet.Definition open import Vectors open import Numbers.Naturals.Semiring open import Numbers.Naturals.Order open import Sets.EquivalenceRelations open import Agda.Primitive using (Level; lzero; lsuc; _⊔_) open import Modules.Definition module Modules.Span {a b : _} {A : Set a} {S : Setoid {a} {b} A} {_+R_ : A → A → A} {_*_ : A → A → A} {R : Ring S _+R_ _*_} {m n : _} {M : Set m} {T : Setoid {m} {n} M} {_+_ : M → M → M} {G' : Group T _+_} {G : AbelianGroup G'} {_·_ : A → M → M} (mod : Module R G _·_) where open Group G' open Setoid T open Equivalence eq _=V_ : {a b : _} {A : Set a} {S : Setoid {a} {b} A} {_+_ : A → A → A} (G : Group S _+_) {n1 : ℕ} → Rel {a} {b ⊔ n} (Vec A n1) _=V_ G [] [] = True' _=V_ {S = S} G (x ,- xs) (y ,- ys) = (Setoid._∼_ S x y) && (_=V_ G xs ys) dot : {n : ℕ} → (Vec M n) → (Vec A n) → M dot [] [] = 0G dot (v ,- vs) (x ,- xs) = (x · v) + (dot vs xs) Spans : {c : _} {C : Set c} (f : C → M) → Set (a ⊔ m ⊔ n ⊔ c) Spans {C = C} f = (m : M) → Sg ℕ (λ n → Sg ((Vec C n) && (Vec A n)) (λ t → (dot (vecMap f (_&&_.fst t)) (_&&_.snd t)) ∼ m)) Independent : {c : _} {C : Set c} (f : C → M) → Set (a ⊔ b ⊔ n ⊔ c) Independent {C = C} f = {n : ℕ} → (r : Vec C n) → ({a b : ℕ} → (a<n : a <N n) → (b<n : b <N n) → vecIndex r a a<n ≡ vecIndex r b b<n → a ≡ b) → (b : Vec A n) → (dot (vecMap f r) b) ∼ 0G → _=V_ (Ring.additiveGroup R) (vecPure (Group.0G (Ring.additiveGroup R))) b independentSubset : {c : _} {C : Set c} (f : C → M) → {d : _} {D : Set d} {inj : D → C} (isInj : Injection inj) → Independent f → Independent (f ∘ inj) independentSubset f {inj = inj} isInj indp {n = n} r coeffInj coeffs dotZero = indp {n = n} (vecMap inj r) inj' coeffs (transitive (identityOfIndiscernablesRight _∼_ reflexive (applyEquality (λ i → dot i coeffs) (vecMapCompose inj f r))) dotZero) where inj' : {a b : ℕ} (a<n : a <N n) (b<n : b <N n) → vecIndex (vecMap inj r) a a<n ≡ vecIndex (vecMap inj r) b b<n → a ≡ b inj' a<n b<n x rewrite vecMapAndIndex r inj a<n | vecMapAndIndex r inj b<n = coeffInj a<n b<n (isInj x) spanSuperset : {c : _} {C : Set c} (f : C → M) → {d : _} {D : Set d} {surj : D → C} (isSurj : Surjection surj) → Spans f → Spans (f ∘ surj) spanSuperset f {surj = surj} isSurj spans m with spans m spanSuperset {C = C} f {surj = surj} isSurj spans m | n , ((coeffs ,, basis) , b) = n , ((vecMap (λ c → underlying (isSurj c)) coeffs ,, basis) , transitive (identityOfIndiscernablesLeft _∼_ reflexive (applyEquality (λ i → dot i basis) (equalityCommutative {x = vecMap (λ i → f (surj i)) (vecMap (λ c → underlying (isSurj c)) coeffs)} {vecMap f coeffs} (transitivity (vecMapCompose (λ i → underlying (isSurj i)) (λ z → f (surj z)) coeffs) (t coeffs))))) b) where t : {n : ℕ} (coeffs : Vec C n) → vecMap (λ i → f (surj (underlying (isSurj i)))) coeffs ≡ vecMap f coeffs t [] = refl t (x ,- coeffs) with isSurj x ... | img , pr rewrite pr | t coeffs = refl Basis : {c : _} {C : Set c} (f : C → M) → Set (a ⊔ b ⊔ m ⊔ n ⊔ c) Basis v = Spans v && Independent v
{ "alphanum_fraction": 0.5857230018, "avg_line_length": 59.6, "ext": "agda", "hexsha": "c53c8be096e05f59282e50d8819a71e0f1604c07", "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": "Modules/Span.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": "Modules/Span.agda", "max_line_length": 456, "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": "Modules/Span.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": 1310, "size": 3278 }
------------------------------------------------------------------------ -- "Equational" reasoning combinator setup ------------------------------------------------------------------------ {-# OPTIONS --sized-types #-} open import Labelled-transition-system module Bisimilarity.Weak.Equational-reasoning-instances {ℓ} {lts : LTS ℓ} where open import Prelude open import Bisimilarity lts import Bisimilarity.Equational-reasoning-instances open import Bisimilarity.Weak lts open import Equational-reasoning open import Expansion lts import Expansion.Equational-reasoning-instances instance reflexive≈ : ∀ {i} → Reflexive [ i ]_≈_ reflexive≈ = is-reflexive reflexive-≈ reflexive≈′ : ∀ {i} → Reflexive [ i ]_≈′_ reflexive≈′ = is-reflexive reflexive-≈′ symmetric≈ : ∀ {i} → Symmetric [ i ]_≈_ symmetric≈ = is-symmetric symmetric-≈ symmetric≈′ : ∀ {i} → Symmetric [ i ]_≈′_ symmetric≈′ = is-symmetric symmetric-≈′ convert≈≈ : ∀ {i} → Convertible [ i ]_≈_ [ i ]_≈_ convert≈≈ = is-convertible id convert≈′≈ : ∀ {i} → Convertible _≈′_ [ i ]_≈_ convert≈′≈ = is-convertible (λ p≈′q → force p≈′q) convert≈≈′ : ∀ {i} → Convertible [ i ]_≈_ [ i ]_≈′_ convert≈≈′ {i} = is-convertible lemma where lemma : ∀ {p q} → [ i ] p ≈ q → [ i ] p ≈′ q force (lemma p≈q) = p≈q convert≈′≈′ : ∀ {i} → Convertible [ i ]_≈′_ [ i ]_≈′_ convert≈′≈′ = is-convertible id convert∼≈ : ∀ {i} → Convertible [ i ]_∼_ [ i ]_≈_ convert∼≈ = is-convertible ∼⇒≈ convert∼′≈ : ∀ {i} → Convertible _∼′_ [ i ]_≈_ convert∼′≈ = is-convertible (convert ∘ ∼⇒≈′) convert∼≈′ : ∀ {i} → Convertible [ i ]_∼_ [ i ]_≈′_ convert∼≈′ {i} = is-convertible lemma where lemma : ∀ {p q} → [ i ] p ∼ q → [ i ] p ≈′ q force (lemma p∼q) = ∼⇒≈ p∼q convert∼′≈′ : ∀ {i} → Convertible [ i ]_∼′_ [ i ]_≈′_ convert∼′≈′ = is-convertible ∼⇒≈′ convert≳≈ : ∀ {i} → Convertible [ i ]_≳_ [ i ]_≈_ convert≳≈ = is-convertible ≳⇒≈ convert≳′≈ : ∀ {i} → Convertible _≳′_ [ i ]_≈_ convert≳′≈ = is-convertible (convert ∘ ≳⇒≈′) convert≳≈′ : ∀ {i} → Convertible [ i ]_≳_ [ i ]_≈′_ convert≳≈′ {i} = is-convertible lemma where lemma : ∀ {p q} → [ i ] p ≳ q → [ i ] p ≈′ q force (lemma p≳q) = ≳⇒≈ p≳q convert≳′≈′ : ∀ {i} → Convertible [ i ]_≳′_ [ i ]_≈′_ convert≳′≈′ = is-convertible ≳⇒≈′ trans≈≈ : Transitive _≈_ _≈_ trans≈≈ = is-transitive transitive-≈ trans≈′≈ : Transitive _≈′_ _≈_ trans≈′≈ = is-transitive λ p≈′q → transitive (force p≈′q) trans≈′≈′ : Transitive _≈′_ _≈′_ trans≈′≈′ = is-transitive λ p≈′q q≈′r → transitive-≈′ p≈′q (convert q≈′r) trans≈≈′ : Transitive _≈_ _≈′_ trans≈≈′ = is-transitive λ p≈q q≈′r → transitive-≈′ (convert p≈q) (convert q≈′r) trans∼≈ : ∀ {i} → Transitive _∼_ [ i ]_≈_ trans∼≈ = is-transitive (transitive-≳≈ ∘ convert {a = ℓ}) trans∼′≈ : ∀ {i} → Transitive _∼′_ [ i ]_≈_ trans∼′≈ = is-transitive (transitive-≳≈ ∘ convert {a = ℓ}) trans∼′≈′ : ∀ {i} → Transitive _∼′_ [ i ]_≈′_ trans∼′≈′ {i} = is-transitive lemma where lemma : ∀ {p q r} → p ∼′ q → [ i ] q ≈′ r → [ i ] p ≈′ r force (lemma p∼′q q≈′r) = transitive-≳≈ (convert {a = ℓ} p∼′q) (force q≈′r) trans∼≈′ : ∀ {i} → Transitive _∼_ [ i ]_≈′_ trans∼≈′ {i} = is-transitive lemma where lemma : ∀ {p q r} → p ∼ q → [ i ] q ≈′ r → [ i ] p ≈′ r force (lemma p∼q q≈′r) = transitive-≳≈ (convert {a = ℓ} p∼q) (force q≈′r) trans≈∼ : ∀ {i} → Transitive′ [ i ]_≈_ _∼_ trans≈∼ = is-transitive transitive-≈∼ trans≈∼′ : ∀ {i} → Transitive′ [ i ]_≈_ _∼′_ trans≈∼′ = is-transitive (λ p≈q q∼′r → transitive-≈∼ p≈q (convert {a = ℓ} q∼′r)) trans≈′∼ : ∀ {i} → Transitive′ [ i ]_≈′_ _∼_ trans≈′∼ {i} = is-transitive lemma where lemma : ∀ {p q r} → [ i ] p ≈′ q → q ∼ r → [ i ] p ≈′ r force (lemma p≈′q q∼r) = transitive-≈∼ (force p≈′q) q∼r trans≈′∼′ : ∀ {i} → Transitive′ [ i ]_≈′_ _∼′_ trans≈′∼′ {i} = is-transitive lemma where lemma : ∀ {p q r} → [ i ] p ≈′ q → q ∼′ r → [ i ] p ≈′ r force (lemma p≈′q q∼r) = transitive-≈∼ (force p≈′q) (convert {a = ℓ} q∼r) trans≳≈ : ∀ {i} → Transitive _≳_ [ i ]_≈_ trans≳≈ = is-transitive transitive-≳≈ trans≳′≈ : ∀ {i} → Transitive _≳′_ [ i ]_≈_ trans≳′≈ = is-transitive (transitive-≳≈ ∘ convert {a = ℓ}) trans≳′≈′ : ∀ {i} → Transitive _≳′_ [ i ]_≈′_ trans≳′≈′ {i} = is-transitive lemma where lemma : ∀ {p q r} → p ≳′ q → [ i ] q ≈′ r → [ i ] p ≈′ r force (lemma p≳′q q≈′r) = transitive-≳≈ (convert {a = ℓ} p≳′q) (force q≈′r) trans≳≈′ : ∀ {i} → Transitive _≳_ [ i ]_≈′_ trans≳≈′ {i} = is-transitive lemma where lemma : ∀ {p q r} → p ≳ q → [ i ] q ≈′ r → [ i ] p ≈′ r force (lemma p≳q q≈′r) = transitive-≳≈ p≳q (force q≈′r) -- For a proof showing that the following lemma cannot, in general, -- be made size-preserving in its first argument, see -- Bisimilarity.Weak.Delay-monad.size-preserving-transitivity-≈≳ˡ⇔uninhabited. trans≈≳ : Transitive′ _≈_ _≳_ trans≈≳ = is-transitive (λ p≈q → transitive p≈q ∘ ≳⇒≈) trans≈≳′ : Transitive′ _≈_ _≳′_ trans≈≳′ = is-transitive (λ p≈q → transitive p≈q ∘ ≳⇒≈ ∘ convert) trans≈′≳′ : Transitive′ _≈′_ _≳′_ trans≈′≳′ = is-transitive (λ p≈′q → transitive p≈′q ∘ ≳⇒≈′) trans≈′≳ : Transitive′ _≈′_ _≳_ trans≈′≳ = is-transitive (λ p≈′q → transitive p≈′q ∘ ≳⇒≈′ ∘ convert) trans≈≲ : ∀ {i} → Transitive′ [ i ]_≈_ _≲_ trans≈≲ = is-transitive transitive-≈≲ trans≈≲′ : ∀ {i} → Transitive′ [ i ]_≈_ _≲′_ trans≈≲′ = is-transitive (λ p≈q q≲r → transitive-≈≲ p≈q (force q≲r)) trans≈′≲ : ∀ {i} → Transitive′ [ i ]_≈′_ _≲_ trans≈′≲ {i} = is-transitive lemma where lemma : ∀ {p q r} → [ i ] p ≈′ q → q ≲ r → [ i ] p ≈′ r force (lemma p≈′q q≳′r) = transitive-≈≲ (force p≈′q) q≳′r trans≈′≲′ : ∀ {i} → Transitive′ [ i ]_≈′_ _≲′_ trans≈′≲′ = is-transitive (λ p≈′q q≲′r → transitive′ p≈′q (force q≲′r))
{ "alphanum_fraction": 0.5204116059, "avg_line_length": 32.0432432432, "ext": "agda", "hexsha": "6b837b90affa0078b0a03f8155687ea6f025466c", "lang": "Agda", "max_forks_count": null, "max_forks_repo_forks_event_max_datetime": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_head_hexsha": "b936ff85411baf3401ad85ce85d5ff2e9aa0ca14", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "nad/up-to", "max_forks_repo_path": "src/Bisimilarity/Weak/Equational-reasoning-instances.agda", "max_issues_count": null, "max_issues_repo_head_hexsha": "b936ff85411baf3401ad85ce85d5ff2e9aa0ca14", "max_issues_repo_issues_event_max_datetime": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_licenses": [ "MIT" ], "max_issues_repo_name": "nad/up-to", "max_issues_repo_path": "src/Bisimilarity/Weak/Equational-reasoning-instances.agda", "max_line_length": 80, "max_stars_count": null, "max_stars_repo_head_hexsha": "b936ff85411baf3401ad85ce85d5ff2e9aa0ca14", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "nad/up-to", "max_stars_repo_path": "src/Bisimilarity/Weak/Equational-reasoning-instances.agda", "max_stars_repo_stars_event_max_datetime": null, "max_stars_repo_stars_event_min_datetime": null, "num_tokens": 2863, "size": 5928 }
open import Data.Product using ( _,_ ) open import Data.Sum using ( _⊎_ ) open import Web.Semantic.DL.ABox.Interp using ( Interp ; _*_ ) open import Web.Semantic.DL.ABox.Model using ( _⊨a_ ; _⊨b_ ; *-resp-⟨ABox⟩ ) open import Web.Semantic.DL.Category.Object using ( Object ; _,_ ; IN ) open import Web.Semantic.DL.Category.Morphism using ( _⇒_ ; _,_ ; BN ; impl ) open import Web.Semantic.DL.Category.Tensor using ( _⟨⊗⟩_ ; ⊨a-intro-⟨&⟩ ; ⊨b-intro-⟨&⟩ ) open import Web.Semantic.DL.Signature using ( Signature ) open import Web.Semantic.DL.TBox using ( TBox ) open import Web.Semantic.Util using ( _⊕_⊕_ ; up ; down ) module Web.Semantic.DL.Category.Properties.Tensor.Lemmas {Σ : Signature} {S T : TBox Σ} where tensor-up : ∀ {A₁ A₂ B₁ B₂ : Object S T} (F₁ : A₁ ⇒ B₁) (F₂ : A₂ ⇒ B₂) I → (I ⊨a impl (F₁ ⟨⊗⟩ F₂)) → (up * I ⊨a impl F₁) tensor-up {X₁ , X₁∈Fin , A₁} {X₂ , X₂∈Fin , A₂} {Y₁ , Y₁∈Fin , B₁} {Y₂ , Y₂∈Fin , B₂} (V₁ , F₁ , F₁✓) (V₂ , F₂ , F₂✓) I (I⊨F₁ , I⊨F₂) = *-resp-⟨ABox⟩ up I F₁ I⊨F₁ tensor-down : ∀ {A₁ A₂ B₁ B₂ : Object S T} (F₁ : A₁ ⇒ B₁) (F₂ : A₂ ⇒ B₂) I → (I ⊨a impl (F₁ ⟨⊗⟩ F₂)) → (down * I ⊨a impl F₂) tensor-down {X₁ , X₁∈Fin , A₁} {X₂ , X₂∈Fin , A₂} {Y₁ , Y₁∈Fin , B₁} {Y₂ , Y₂∈Fin , B₂} (V₁ , F₁ , F₁✓) (V₂ , F₂ , F₂✓) I (I⊨F₁ , I⊨F₂) = *-resp-⟨ABox⟩ down I F₂ I⊨F₂ tensor-resp-⊨a : ∀ {A₁ A₂ B₁ B₂ : Object S T} (F₁ : A₁ ⇒ B₁) (F₂ : A₂ ⇒ B₂) → (I : Interp Σ ((IN A₁ ⊎ IN A₂) ⊕ (BN F₁ ⊎ BN F₂) ⊕ (IN B₁ ⊎ IN B₂))) → (up * I ⊨a impl F₁) → (down * I ⊨a impl F₂) → (I ⊨a impl (F₁ ⟨⊗⟩ F₂)) tensor-resp-⊨a {X₁ , X₁∈Fin , A₁} {X₂ , X₂∈Fin , A₂} {Y₁ , Y₁∈Fin , B₁} {Y₂ , Y₂∈Fin , B₂} (V₁ , F₁ , F₁✓) (V₂ , F₂ , F₂✓) I I₁⊨F₁ I₂⊨F₂ = ⊨a-intro-⟨&⟩ I F₁ F₂ I₁⊨F₁ I₂⊨F₂ tensor-resp-⊨b : ∀ {A₁ A₂ B₁ B₂ : Object S T} {V₁ V₂ : Set} (F₁ : A₁ ⇒ B₁) (F₂ : A₂ ⇒ B₂) → (I : Interp Σ ((IN A₁ ⊎ IN A₂) ⊕ (V₁ ⊎ V₂) ⊕ (IN B₁ ⊎ IN B₂))) → (up * I ⊨b impl F₁) → (down * I ⊨b impl F₂) → (I ⊨b impl (F₁ ⟨⊗⟩ F₂)) tensor-resp-⊨b {X₁ , X₁∈Fin , A₁} {X₂ , X₂∈Fin , A₂} {Y₁ , Y₁∈Fin , B₁} {Y₂ , Y₂∈Fin , B₂} (V₁ , F₁ , F₁✓) (V₂ , F₂ , F₂✓) I I⊨F₁ I⊨F₂ = ⊨b-intro-⟨&⟩ I F₁ F₂ I⊨F₁ I⊨F₂
{ "alphanum_fraction": 0.5424836601, "avg_line_length": 52.243902439, "ext": "agda", "hexsha": "b7d9d21d89484a327379c5aadf86aeba687900f4", "lang": "Agda", "max_forks_count": 3, "max_forks_repo_forks_event_max_datetime": "2022-03-12T11:40:03.000Z", "max_forks_repo_forks_event_min_datetime": "2017-12-03T14:52:09.000Z", "max_forks_repo_head_hexsha": "38fbc3af7062ba5c3d7d289b2b4bcfb995d99057", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "bblfish/agda-web-semantic", "max_forks_repo_path": "src/Web/Semantic/DL/Category/Properties/Tensor/Lemmas.agda", "max_issues_count": 4, "max_issues_repo_head_hexsha": "38fbc3af7062ba5c3d7d289b2b4bcfb995d99057", "max_issues_repo_issues_event_max_datetime": "2021-01-04T20:57:19.000Z", "max_issues_repo_issues_event_min_datetime": "2018-11-14T02:32:28.000Z", "max_issues_repo_licenses": [ "MIT" ], "max_issues_repo_name": "bblfish/agda-web-semantic", "max_issues_repo_path": "src/Web/Semantic/DL/Category/Properties/Tensor/Lemmas.agda", "max_line_length": 92, "max_stars_count": 9, "max_stars_repo_head_hexsha": "8ddbe83965a616bff6fc7a237191fa261fa78bab", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "agda/agda-web-semantic", "max_stars_repo_path": "src/Web/Semantic/DL/Category/Properties/Tensor/Lemmas.agda", "max_stars_repo_stars_event_max_datetime": "2020-03-14T14:21:08.000Z", "max_stars_repo_stars_event_min_datetime": "2015-09-13T17:46:41.000Z", "num_tokens": 1166, "size": 2142 }
{-# OPTIONS --type-in-type #-} module TabsInPragmas where
{ "alphanum_fraction": 0.6949152542, "avg_line_length": 14.75, "ext": "agda", "hexsha": "558e87bcdf5337d4585f95c6831b0c7f43ce1e71", "lang": "Agda", "max_forks_count": 371, "max_forks_repo_forks_event_max_datetime": "2022-03-30T19:00:30.000Z", "max_forks_repo_forks_event_min_datetime": "2015-01-03T14:04:08.000Z", "max_forks_repo_head_hexsha": "7f58030124fa99dfbf8db376659416f3ad8384de", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "cruhland/agda", "max_forks_repo_path": "test/Fail/TabsInPragmas.agda", "max_issues_count": 4066, "max_issues_repo_head_hexsha": "7f58030124fa99dfbf8db376659416f3ad8384de", "max_issues_repo_issues_event_max_datetime": "2022-03-31T21:14:49.000Z", "max_issues_repo_issues_event_min_datetime": "2015-01-10T11:24:51.000Z", "max_issues_repo_licenses": [ "MIT" ], "max_issues_repo_name": "cruhland/agda", "max_issues_repo_path": "test/Fail/TabsInPragmas.agda", "max_line_length": 30, "max_stars_count": 1989, "max_stars_repo_head_hexsha": "7f58030124fa99dfbf8db376659416f3ad8384de", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "cruhland/agda", "max_stars_repo_path": "test/Fail/TabsInPragmas.agda", "max_stars_repo_stars_event_max_datetime": "2022-03-30T18:20:48.000Z", "max_stars_repo_stars_event_min_datetime": "2015-01-09T23:51:16.000Z", "num_tokens": 16, "size": 59 }
import Lvl open import Structure.Setoid open import Type module Automaton.Deterministic.Accessible where open import Automaton.Deterministic open import Data.List renaming (∅ to ε ; _⊰_ to _·_) open import Data.List.Functions using (postpend ; _++_) open import Logic.Predicate open import Logic.Predicate.Equiv open import Sets.ExtensionalPredicateSet using (PredSet ; intro ; _∈_ ; _∋_ ; ⊶ ; [∋]-binaryRelator) open import Structure.Operator open import Structure.Relator open import Structure.Relator.Properties open import Syntax.Transitivity private variable ℓₚ ℓₛ ℓₑ₁ ℓₐ ℓₑ₂ : Lvl.Level module _ {State : Type{ℓₛ}} ⦃ equiv-state : Equiv{ℓₑ₁}(State) ⦄ {Alphabet : Type{ℓₐ}} ⦃ equiv-alphabet : Equiv{ℓₑ₂}(Alphabet) ⦄ where module _ (d : Deterministic{ℓₚ = ℓₚ}(State)(Alphabet)) where open Deterministic(d) -- The subset of State which are the accessible states from the start state by chained transitions. Accessible : PredSet(State) Accessible = ⊶(wordTransition start) instance accessible-start : (start ∈ Accessible) accessible-start = [∃]-intro ε ⦃ reflexivity(_≡_) {x = start} ⦄ instance accessible-transition : ∀{s}{a} → ⦃ _ : (s ∈ Accessible) ⦄ → (transition s a ∈ Accessible) accessible-transition {s} {a = a} ⦃ [∃]-intro w ⦃ p ⦄ ⦄ = [∃]-intro (postpend a w) ⦃ wordTransition start (postpend a w) 🝖-[ wordTransition-postpend {d = d} {start}{w}{a} ] transition (wordTransition start w) a 🝖-[ congruence₂ₗ(transition) a p ] transition s a 🝖-end ⦄ module _ where open Deterministic accessibleAutomaton : (d : Deterministic{ℓₚ = ℓₚ}(State)(Alphabet)) → Deterministic(∃(_∈ Accessible d)) (Alphabet) transition (accessibleAutomaton d) ([∃]-intro s) a = [∃]-intro (transition d s a) ⦃ accessible-transition d ⦄ BinaryOperator.congruence (transition-binaryOperator (accessibleAutomaton d)) = congruence₂(transition d) start (accessibleAutomaton d) = [∃]-intro (start d) ⦃ accessible-start d ⦄ Final (accessibleAutomaton d) PredSet.∋ [∃]-intro s = s ∈ Final d UnaryRelator.substitution (PredSet.preserve-equiv (Final (accessibleAutomaton d))) {[∃]-intro x} {[∃]-intro y} = substitute₂ᵣ(_∋_) {intro (_∈ Final d)}
{ "alphanum_fraction": 0.6803672934, "avg_line_length": 42.3518518519, "ext": "agda", "hexsha": "b7ef4d0befab66832d67c0697e97b40cfb10e290", "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": "Automaton/Deterministic/Accessible.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": "Automaton/Deterministic/Accessible.agda", "max_line_length": 155, "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": "Automaton/Deterministic/Accessible.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": 726, "size": 2287 }
open import Data.Char using ( Char ) open import Data.Bool using ( Bool ) module Data.Char.Classifier.Primitive where postulate isAscii : Char → Bool isLatin1 : Char → Bool isControl : Char → Bool isSpace : Char → Bool isLower : Char → Bool isUpper : Char → Bool isAlpha : Char → Bool isAlphaNum : Char → Bool isPrint : Char → Bool isDigit : Char → Bool isOctDigit : Char → Bool isHexDigit : Char → Bool {-# FOREIGN GHC import qualified Data.Char #-} {-# COMPILE GHC isAscii = type Data.Char.isAscii #-} {-# COMPILE GHC isLatin1 = type Data.Char.isLatin1 #-} {-# COMPILE GHC isControl = type Data.Char.isControl #-} {-# COMPILE GHC isSpace = type Data.Char.isSpace #-} {-# COMPILE GHC isLower = type Data.Char.isLower #-} {-# COMPILE GHC isUpper = type Data.Char.isUpper #-} {-# COMPILE GHC isAlpha = type Data.Char.isAlpha #-} {-# COMPILE GHC isAlphaNum = type Data.Char.isAlphaNum #-} {-# COMPILE GHC isPrint = type Data.Char.isPrint #-} {-# COMPILE GHC isDigit = type Data.Char.isDigit #-} {-# COMPILE GHC isOctDigit = type Data.Char.isOctDigit #-} {-# COMPILE GHC isHexDigit = type Data.Char.isHexDigit #-}
{ "alphanum_fraction": 0.6859649123, "avg_line_length": 34.5454545455, "ext": "agda", "hexsha": "b27a81647eb4789bfa68b43c64002a898a5176a0", "lang": "Agda", "max_forks_count": 2, "max_forks_repo_forks_event_max_datetime": "2022-03-12T11:40:23.000Z", "max_forks_repo_forks_event_min_datetime": "2017-08-10T06:12:54.000Z", "max_forks_repo_head_hexsha": "121d6c66cba34b4c15b437366b80c65dd2b02a8d", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "agda/agda-system-io", "max_forks_repo_path": "src/Data/Char/Classifier/Primitive.agda", "max_issues_count": null, "max_issues_repo_head_hexsha": "121d6c66cba34b4c15b437366b80c65dd2b02a8d", "max_issues_repo_issues_event_max_datetime": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_licenses": [ "MIT" ], "max_issues_repo_name": "agda/agda-system-io", "max_issues_repo_path": "src/Data/Char/Classifier/Primitive.agda", "max_line_length": 58, "max_stars_count": 10, "max_stars_repo_head_hexsha": "121d6c66cba34b4c15b437366b80c65dd2b02a8d", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "agda/agda-system-io", "max_stars_repo_path": "src/Data/Char/Classifier/Primitive.agda", "max_stars_repo_stars_event_max_datetime": "2021-09-15T04:35:41.000Z", "max_stars_repo_stars_event_min_datetime": "2015-01-04T13:45:16.000Z", "num_tokens": 302, "size": 1140 }
{-# OPTIONS --without-K --rewriting #-} open import lib.Basics open import lib.NType2 open import lib.NConnected open import lib.types.Truncation open import lib.types.Group module lib.types.EilenbergMacLane1.Core {i} where module _ (G : Group i) where private module G = Group G postulate -- HIT EM₁ : Type i embase' : EM₁ emloop' : G.El → embase' == embase' emloop-comp' : ∀ g₁ g₂ → emloop' (G.comp g₁ g₂) == emloop' g₁ ∙ emloop' g₂ emloop-coh₁' : (g₁ g₂ g₃ : G.El) → emloop' (G.comp (G.comp g₁ g₂) g₃) =-= emloop' g₁ ∙ (emloop' g₂ ∙ emloop' g₃) emloop-coh₁' g₁ g₂ g₃ = emloop' (G.comp (G.comp g₁ g₂) g₃) =⟪ emloop-comp' (G.comp g₁ g₂) g₃ ⟫ emloop' (G.comp g₁ g₂) ∙ emloop' g₃ =⟪ ap (λ l → l ∙ emloop' g₃) (emloop-comp' g₁ g₂) ⟫ (emloop' g₁ ∙ emloop' g₂) ∙ emloop' g₃ =⟪ ∙-assoc (emloop' g₁) (emloop' g₂) (emloop' g₃) ⟫ emloop' g₁ ∙ (emloop' g₂ ∙ emloop' g₃) ∎∎ emloop-coh₂' : (g₁ g₂ g₃ : G.El) → emloop' (G.comp (G.comp g₁ g₂) g₃) =-= emloop' g₁ ∙ (emloop' g₂ ∙ emloop' g₃) emloop-coh₂' g₁ g₂ g₃ = emloop' (G.comp (G.comp g₁ g₂) g₃) =⟪ ap emloop' (Group.assoc G g₁ g₂ g₃) ⟫ emloop' (G.comp g₁ (G.comp g₂ g₃)) =⟪ emloop-comp' g₁ (Group.comp G g₂ g₃) ⟫ emloop' g₁ ∙ emloop' (G.comp g₂ g₃) =⟪ ap (λ l → emloop' g₁ ∙ l) (emloop-comp' g₂ g₃) ⟫ emloop' g₁ ∙ (emloop' g₂ ∙ emloop' g₃) ∎∎ postulate emloop-coh' : ∀ g₁ g₂ g₃ → emloop-coh₁' g₁ g₂ g₃ =ₛ emloop-coh₂' g₁ g₂ g₃ EM₁-level' : has-level 2 EM₁ ⊙EM₁ : Ptd i ⊙EM₁ = ⊙[ EM₁ , embase' ] module _ {G : Group i} where private module G = Group G embase = embase' G emloop = emloop' G emloop-comp = emloop-comp' G emloop-coh₁ = emloop-coh₁' G emloop-coh₂ = emloop-coh₂' G emloop-coh = emloop-coh' G instance EM₁-level : {n : ℕ₋₂} → has-level (S (S (S (S n)))) (EM₁ G) EM₁-level {⟨-2⟩} = EM₁-level' G EM₁-level {S n} = raise-level _ EM₁-level abstract -- This was in the original paper, but is actually derivable. emloop-ident : emloop G.ident == idp emloop-ident = ! $ anti-whisker-right (emloop G.ident) $ ap emloop (! $ G.unit-r G.ident) ∙ emloop-comp G.ident G.ident module EM₁Elim {j} {P : EM₁ G → Type j} {{_ : (x : EM₁ G) → has-level 2 (P x)}} (embase* : P embase) (emloop* : ∀ g → embase* == embase* [ P ↓ emloop g ]) (emloop-comp* : ∀ g₁ g₂ → emloop* (G.comp g₁ g₂) == emloop* g₁ ∙ᵈ emloop* g₂ [ (λ p → embase* == embase* [ P ↓ p ]) ↓ emloop-comp g₁ g₂ ]) (emloop-coh* : ∀ g₁ g₂ g₃ → emloop-comp* (G.comp g₁ g₂) g₃ ∙ᵈ (emloop-comp* g₁ g₂ ∙ᵈᵣ emloop* g₃) ∙ᵈ ∙ᵈ-assoc (emloop* g₁) (emloop* g₂) (emloop* g₃) == ↓-ap-in (λ p → embase* == embase* [ P ↓ p ]) emloop (apd emloop* (G.assoc g₁ g₂ g₃)) ∙ᵈ emloop-comp* g₁ (G.comp g₂ g₃) ∙ᵈ (emloop* g₁ ∙ᵈₗ emloop-comp* g₂ g₃) [ (λ e → emloop* (G.comp (G.comp g₁ g₂) g₃) == emloop* g₁ ∙ᵈ (emloop* g₂ ∙ᵈ emloop* g₃) [ (λ p → embase* == embase* [ P ↓ p ]) ↓ e ]) ↓ =ₛ-out (emloop-coh g₁ g₂ g₃) ]) where postulate -- HIT f : Π (EM₁ G) P embase-β : f embase ↦ embase* {-# REWRITE embase-β #-} postulate -- HIT emloop-β : (g : G.El) → apd f (emloop g) == emloop* g emloop-comp-path : (g₁ g₂ : G.El) → apd (apd f) (emloop-comp g₁ g₂) ▹ apd-∙ f (emloop g₁) (emloop g₂) ∙ ap2 _∙ᵈ_ (emloop-β g₁) (emloop-β g₂) == emloop-β (G.comp g₁ g₂) ◃ emloop-comp* g₁ g₂ open EM₁Elim public using () renaming (f to EM₁-elim) module EM₁Level₁Elim {j} {P : EM₁ G → Type j} {{is-1-type : (x : EM₁ G) → has-level 1 (P x)}} (embase* : P embase) (emloop* : (g : G.El) → embase* == embase* [ P ↓ emloop g ]) (emloop-comp* : (g₁ g₂ : G.El) → emloop* (G.comp g₁ g₂) == emloop* g₁ ∙ᵈ emloop* g₂ [ (λ p → embase* == embase* [ P ↓ p ]) ↓ emloop-comp g₁ g₂ ]) where private module M = EM₁Elim {{λ x → raise-level 1 (is-1-type x)}} embase* emloop* emloop-comp* (λ g₁ g₂ g₃ → prop-has-all-paths-↓ {{↓-level (↓-level (is-1-type embase))}}) abstract f : Π (EM₁ G) P f = M.f embase-β : f embase ↦ embase* embase-β = M.embase-β {-# REWRITE embase-β #-} emloop-β : (g : G.El) → apd f (emloop g) == emloop* g emloop-β = M.emloop-β open EM₁Level₁Elim public using () renaming (f to EM₁-level₁-elim) module EM₁SetElim {j} {P : EM₁ G → Type j} {{is-set : (x : EM₁ G) → is-set (P x)}} (embase* : P embase) (emloop* : (g : G.El) → embase* == embase* [ P ↓ emloop g ]) where private module M = EM₁Level₁Elim {P = P} {{λ x → raise-level 0 (is-set x)}} embase* emloop* (λ g₁ g₂ → set-↓-has-all-paths-↓ {{is-set embase}}) open M public open EM₁SetElim public using () renaming (f to EM₁-set-elim) module EM₁PropElim {j} {P : EM₁ G → Type j} {{is-prop : (x : EM₁ G) → is-prop (P x)}} (embase* : P embase) where module P = EM₁SetElim {{λ x → raise-level -1 (is-prop x)}} embase* (λ g → prop-has-all-paths-↓ {{is-prop embase}}) open P public open EM₁PropElim public using () renaming (f to EM₁-prop-elim) -- basic lemmas about [EM₁] module _ {G : Group i} where private module G = Group G abstract emloop-inv : ∀ g → emloop' G (G.inv g) == ! (emloop g) emloop-inv g = cancels-inverse _ _ lemma where cancels-inverse : ∀ {i} {A : Type i} {x y : A} (p : x == y) (q : y == x) → p ∙ q == idp → p == ! q cancels-inverse p idp r = ! (∙-unit-r p) ∙ r lemma : emloop' G (G.inv g) ∙ emloop g == idp lemma = ! (emloop-comp (G.inv g) g) ∙ ap emloop (G.inv-l g) ∙ emloop-ident {- EM₁ is 0-connected -} instance EM₁-conn : is-connected 0 (EM₁ G) EM₁-conn = has-level-in ([ embase ] , Trunc-elim (EM₁-level₁-elim {P = λ x → [ embase ] == [ x ]} {{λ _ → raise-level _ (=-preserves-level Trunc-level)}} idp (λ _ → prop-has-all-paths-↓) (λ _ _ → set-↓-has-all-paths-↓)))
{ "alphanum_fraction": 0.5298256837, "avg_line_length": 33.8, "ext": "agda", "hexsha": "140d42f78b8b73073e3b72c3e981988ab5b30849", "lang": "Agda", "max_forks_count": 50, "max_forks_repo_forks_event_max_datetime": "2022-02-14T03:03:25.000Z", "max_forks_repo_forks_event_min_datetime": "2015-01-10T01:48:08.000Z", "max_forks_repo_head_hexsha": "1037d82edcf29b620677a311dcfd4fc2ade2faa6", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "AntoineAllioux/HoTT-Agda", "max_forks_repo_path": "core/lib/types/EilenbergMacLane1/Core.agda", "max_issues_count": 31, "max_issues_repo_head_hexsha": "1037d82edcf29b620677a311dcfd4fc2ade2faa6", "max_issues_repo_issues_event_max_datetime": "2021-10-03T19:15:25.000Z", "max_issues_repo_issues_event_min_datetime": "2015-03-05T20:09:00.000Z", "max_issues_repo_licenses": [ "MIT" ], "max_issues_repo_name": "AntoineAllioux/HoTT-Agda", "max_issues_repo_path": "core/lib/types/EilenbergMacLane1/Core.agda", "max_line_length": 101, "max_stars_count": 294, "max_stars_repo_head_hexsha": "1037d82edcf29b620677a311dcfd4fc2ade2faa6", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "AntoineAllioux/HoTT-Agda", "max_stars_repo_path": "core/lib/types/EilenbergMacLane1/Core.agda", "max_stars_repo_stars_event_max_datetime": "2022-03-20T13:54:45.000Z", "max_stars_repo_stars_event_min_datetime": "2015-01-09T16:23:23.000Z", "num_tokens": 2567, "size": 6253 }
{-# OPTIONS --without-K --safe #-} module Categories.Category.CMonoidEnriched where -- A category where the Homs are not sets, but commutative monoids -- There are weak kind of Ab-enriched. -- The reason to do these "by hand" is that the -- "free commutative monoid monad", i.e. Bag, is very hard to work -- with in type theory, so it is easier to work axiomatically. open import Level open import Algebra.Bundles using (CommutativeMonoid) open import Function.Base using (flip) open import Relation.Binary using (Rel; IsEquivalence) open import Categories.Category.Core using (Category) record CM-Category (o ℓ e : Level) : Set (suc (o ⊔ ℓ ⊔ e)) where infix 4 _≈_ _⇒_ infixr 9 _∘_ infixl 7 _+_ open CommutativeMonoid using (_∙_; ε) renaming (Carrier to ∣_∣) field Obj : Set o Hom : (A B : Obj) → CommutativeMonoid ℓ e _⇒_ : (A B : Obj) → Set ℓ A ⇒ B = ∣ Hom A B ∣ _+_ : {A B : Obj} → A ⇒ B → A ⇒ B → A ⇒ B _+_ {A} {B} f g = _∙_ (Hom A B) f g 0M : {A B : Obj} → A ⇒ B 0M {A} {B} = ε (Hom A B) field _≈_ : ∀ {A B : Obj} → Rel (A ⇒ B) e id : ∀ {A} → A ⇒ A _∘_ : ∀ {A B C} → B ⇒ C → A ⇒ B → A ⇒ C -- The usual categorical structure field assoc : ∀ {A B C D} {f : A ⇒ B} {g : B ⇒ C} {h : C ⇒ D} → (h ∘ g) ∘ f ≈ h ∘ (g ∘ f) -- We add a symmetric proof of associativity so that the opposite category of the -- opposite category is definitionally equal to the original category. See how -- `op` is implemented. sym-assoc : ∀ {A B C D} {f : A ⇒ B} {g : B ⇒ C} {h : C ⇒ D} → h ∘ (g ∘ f) ≈ (h ∘ g) ∘ f identityˡ : ∀ {A B} {f : A ⇒ B} → id ∘ f ≈ f identityʳ : ∀ {A B} {f : A ⇒ B} → f ∘ id ≈ f -- We add a proof of "neutral" identity proof, in order to ensure the opposite of -- constant functor is definitionally equal to itself. identity² : ∀ {A} → id ∘ id {A} ≈ id {A} equiv : ∀ {A B} → IsEquivalence (_≈_ {A} {B}) ∘-resp-≈ : ∀ {A B C} {f h : B ⇒ C} {g i : A ⇒ B} → f ≈ h → g ≈ i → f ∘ g ≈ h ∘ i -- preservation of additive structure +-resp-∘ : ∀ {A B C D} {f g : B ⇒ C} {h : A ⇒ B} {k : C ⇒ D} → k ∘ (f + g) ∘ h ≈ k ∘ f ∘ h + k ∘ g ∘ h 0-resp-∘ : ∀ {A C D} {h : A ⇒ C} {k : C ⇒ D} → k ∘ 0M ∘ h ≈ 0M Underlying : {o ℓ e : Level} → CM-Category o ℓ e → Category o ℓ e Underlying C = record { CM-Category C }
{ "alphanum_fraction": 0.5505136986, "avg_line_length": 35.9384615385, "ext": "agda", "hexsha": "b7898c2b879b0d1675a13a8052584fec13759437", "lang": "Agda", "max_forks_count": 64, "max_forks_repo_forks_event_max_datetime": "2022-03-14T02:00:59.000Z", "max_forks_repo_forks_event_min_datetime": "2019-06-02T16:58:15.000Z", "max_forks_repo_head_hexsha": "d9e4f578b126313058d105c61707d8c8ae987fa8", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "Code-distancing/agda-categories", "max_forks_repo_path": "src/Categories/Category/CMonoidEnriched.agda", "max_issues_count": 236, "max_issues_repo_head_hexsha": "d9e4f578b126313058d105c61707d8c8ae987fa8", "max_issues_repo_issues_event_max_datetime": "2022-03-28T14:31:43.000Z", "max_issues_repo_issues_event_min_datetime": "2019-06-01T14:53:54.000Z", "max_issues_repo_licenses": [ "MIT" ], "max_issues_repo_name": "Code-distancing/agda-categories", "max_issues_repo_path": "src/Categories/Category/CMonoidEnriched.agda", "max_line_length": 91, "max_stars_count": 279, "max_stars_repo_head_hexsha": "d9e4f578b126313058d105c61707d8c8ae987fa8", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "Trebor-Huang/agda-categories", "max_stars_repo_path": "src/Categories/Category/CMonoidEnriched.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": 931, "size": 2336 }
{-# OPTIONS --cubical --no-import-sorts --safe #-} module Cubical.DStructures.Structures.Nat 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.Nat open import Cubical.Data.Empty open import Cubical.Data.Unit open import Cubical.Relation.Binary open import Cubical.DStructures.Base private variable ℓA ℓ≅A : Level -- observational equality on ℕ ℕ-≅ : ℕ → ℕ → Type ℓ-zero ℕ-≅ 0 0 = Unit ℕ-≅ 0 (suc _) = ⊥ ℕ-≅ (suc _) 0 = ⊥ ℕ-≅ (suc n) (suc m) = ℕ-≅ n m -- observational equality is reflexive ℕ-≅-ρ : isRefl ℕ-≅ ℕ-≅-ρ 0 = tt ℕ-≅-ρ (suc n) = ℕ-≅-ρ n -- observational equality implies identity ℕ-≅→≡ : {n m : ℕ} → ℕ-≅ n m → n ≡ m ℕ-≅→≡ {0} {0} p = refl ℕ-≅→≡ {0} {suc _} p = rec p ℕ-≅→≡ {suc _} {0} p = rec p ℕ-≅→≡ {suc n} {suc m} p = cong suc (ℕ-≅→≡ {n} {m} p) -- observational equality is prop-valued ℕ-≅-prop : (n m : ℕ) → isProp (ℕ-≅ n m) ℕ-≅-prop 0 0 = isContr→isProp isContrUnit ℕ-≅-prop 0 (suc _) = isProp⊥ ℕ-≅-prop (suc _) 0 = isProp⊥ ℕ-≅-prop (suc n) (suc m) = ℕ-≅-prop n m -- This module contains the first half of the proof of -- theorem 10.2.3 of Egbert Rijkes Intro to Hott -- TODO: privatize module _ {A : Type ℓA} (_≅_ : A → A → Type ℓ≅A) (ρ : (a : A) → a ≅ a) (prop : (a a' : A) → isProp (a ≅ a')) (f : (a a' : A) → (a ≅ a') → a ≡ a') where module _ (a : A) where φ : (a' : A) (p : a ≡ a') → a ≅ a' φ a' p = J (λ b q → a ≅ b) (ρ a) p tot-f : Σ[ a' ∈ A ] a ≅ a' → singl a tot-f (a' , p) = a' , f a a' p tot-φ : singl a → Σ[ a' ∈ A ] a ≅ a' tot-φ (a' , p) = a' , (φ a' p) ret-f-φ : (a' : A) → retract (f a a') (φ a') ret-f-φ a' p = prop a a' (φ a' (f a a' p)) p retract-totf-totφ : retract tot-f tot-φ retract-totf-totφ (a' , p) = ΣPathP (refl , ret-f-φ a' p) contr-singl-≅ : isContr (Σ[ a' ∈ A ] a ≅ a') contr-singl-≅ = isContrRetract tot-f tot-φ retract-totf-totφ (isContrSingl a) ℕ-≅-contrSingl : (n : ℕ) → isContr (Σ[ m ∈ ℕ ] ℕ-≅ n m) ℕ-≅-contrSingl n = contr-singl-≅ ℕ-≅ ℕ-≅-ρ ℕ-≅-prop (λ m m' → ℕ-≅→≡ {m} {m'}) n 𝒮-Nat : URGStr ℕ ℓ-zero 𝒮-Nat = make-𝒮 {_≅_ = ℕ-≅} ℕ-≅-ρ ℕ-≅-contrSingl
{ "alphanum_fraction": 0.5619765494, "avg_line_length": 28.0941176471, "ext": "agda", "hexsha": "61d25b628da2c116fdc09173b10f98850cce3ed3", "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/Nat.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/Nat.agda", "max_line_length": 83, "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/Nat.agda", "max_stars_repo_stars_event_max_datetime": null, "max_stars_repo_stars_event_min_datetime": null, "num_tokens": 1106, "size": 2388 }
open import SOAS.Common open import SOAS.Families.Core open import Categories.Object.Initial open import SOAS.Coalgebraic.Strength import SOAS.Metatheory.MetaAlgebra -- Coalgebraic traversal maps module SOAS.Metatheory.Coalgebraic {T : Set} (⅀F : Functor 𝔽amiliesₛ 𝔽amiliesₛ) (⅀:Str : Strength ⅀F) (𝔛 : Familyₛ) (open SOAS.Metatheory.MetaAlgebra ⅀F 𝔛) (𝕋:Init : Initial 𝕄etaAlgebras) where open import SOAS.Context open import SOAS.Variable open import SOAS.Abstract.Hom import SOAS.Abstract.Coalgebra as →□ ; open →□.Sorted import SOAS.Abstract.Box as □ ; open □.Sorted open import SOAS.Coalgebraic.Map open import SOAS.Metatheory.Algebra {T} ⅀F open import SOAS.Metatheory.Semantics ⅀F ⅀:Str 𝔛 𝕋:Init open import SOAS.Metatheory.Traversal ⅀F ⅀:Str 𝔛 𝕋:Init open import SOAS.Metatheory.Renaming ⅀F ⅀:Str 𝔛 𝕋:Init open Strength ⅀:Str -- Relationship of traversal and interpretation, assuming 𝒜 has compatible renaming structure module _ {𝒜 : Familyₛ}(𝒜ᵇ : Coalg 𝒜)(𝒜ᵃ : MetaAlg 𝒜) (open Semantics 𝒜ᵃ)(open Coalg 𝒜ᵇ) (rᵃ⇒ : MetaAlg⇒ 𝒜ᵃ (□ᵃ 𝒜ᵃ) r) where open MetaAlg 𝒜ᵃ open MetaAlg⇒ rᵃ⇒ 𝒜ᴮ : Coalgₚ 𝒜 𝒜ᴮ = record { ᵇ = 𝒜ᵇ ; η = 𝑣𝑎𝑟 ; r∘η = cong (λ - → - _) ⟨𝑣𝑎𝑟⟩ } -- Interpretation and renaming commute 𝕤𝕖𝕞∘ren : MapEq₁ ℐᴮ 𝑎𝑙𝑔 (λ t ρ → 𝕤𝕖𝕞 (𝕣𝕖𝕟 t ρ)) (λ t ρ → r (𝕤𝕖𝕞 t) ρ) 𝕤𝕖𝕞∘ren = record { φ = 𝑣𝑎𝑟 ; χ = 𝑚𝑣𝑎𝑟 ; f⟨𝑣⟩ = trans (cong 𝕤𝕖𝕞 Renaming.𝕥⟨𝕧⟩) ⟨𝕧⟩ ; f⟨𝑚⟩ = trans (cong 𝕤𝕖𝕞 Renaming.𝕥⟨𝕞⟩) ⟨𝕞⟩ ; f⟨𝑎⟩ = λ{ {σ = σ}{t} → begin 𝕤𝕖𝕞 (𝕣𝕖𝕟 (𝕒𝕝𝕘 t) σ) ≡⟨ cong 𝕤𝕖𝕞 Renaming.𝕥⟨𝕒⟩ ⟩ 𝕤𝕖𝕞 (𝕒𝕝𝕘 (str ℐᴮ 𝕋 (⅀₁ 𝕣𝕖𝕟 t) σ)) ≡⟨ ⟨𝕒⟩ ⟩ 𝑎𝑙𝑔 (⅀₁ 𝕤𝕖𝕞 (str ℐᴮ 𝕋 (⅀₁ 𝕣𝕖𝕟 t) σ)) ≡˘⟨ cong 𝑎𝑙𝑔 (str-nat₂ 𝕤𝕖𝕞 (⅀₁ 𝕣𝕖𝕟 t) σ) ⟩ 𝑎𝑙𝑔 (str ℐᴮ 𝒜 (⅀.F₁ (λ { h′ ς → 𝕤𝕖𝕞 (h′ ς) }) (⅀₁ 𝕣𝕖𝕟 t)) σ) ≡˘⟨ congr ⅀.homomorphism (λ - → 𝑎𝑙𝑔 (str ℐᴮ 𝒜 - σ)) ⟩ 𝑎𝑙𝑔 (str ℐᴮ 𝒜 (⅀₁ (λ{ t ρ → 𝕤𝕖𝕞 (𝕣𝕖𝕟 t ρ)}) t) σ) ∎ } ; g⟨𝑣⟩ = trans (r≈₁ ⟨𝕧⟩) (cong (λ - → - _) ⟨𝑣𝑎𝑟⟩) ; g⟨𝑚⟩ = trans (r≈₁ ⟨𝕞⟩) (cong (λ - → - _) ⟨𝑚𝑣𝑎𝑟⟩) ; g⟨𝑎⟩ = λ{ {σ = σ}{t} → begin r (𝕤𝕖𝕞 (𝕒𝕝𝕘 t)) σ ≡⟨ r≈₁ ⟨𝕒⟩ ⟩ r (𝑎𝑙𝑔 (⅀₁ 𝕤𝕖𝕞 t)) σ ≡⟨ cong (λ - → - σ) ⟨𝑎𝑙𝑔⟩ ⟩ 𝑎𝑙𝑔 (str ℐᴮ 𝒜 (⅀₁ r (⅀₁ 𝕤𝕖𝕞 t)) σ) ≡˘⟨ congr ⅀.homomorphism (λ - → 𝑎𝑙𝑔 (str ℐᴮ 𝒜 - σ)) ⟩ 𝑎𝑙𝑔 (str ℐᴮ 𝒜 (⅀₁ (λ{ t ρ → r (𝕤𝕖𝕞 t) ρ}) t) σ) ∎ } } where open ≡-Reasoning -- Interpretation is a pointed □-coalgebra homomorphism 𝕤𝕖𝕞ᵇ⇒ : Coalg⇒ 𝕋ᵇ 𝒜ᵇ 𝕤𝕖𝕞 𝕤𝕖𝕞ᵇ⇒ = record { ⟨r⟩ = λ{ {t = t} → MapEq₁.≈ 𝕤𝕖𝕞∘ren t } } 𝕤𝕖𝕞ᴮ⇒ : Coalgₚ⇒ 𝕋ᴮ 𝒜ᴮ 𝕤𝕖𝕞 𝕤𝕖𝕞ᴮ⇒ = record { ᵇ⇒ = 𝕤𝕖𝕞ᵇ⇒ ; ⟨η⟩ = ⟨𝕧⟩ } -- Coalgebraic traversal maps module Travᶜ {𝒫 𝒜 : Familyₛ}(𝒫ᴮ : Coalgₚ 𝒫)(𝑎𝑙𝑔 : ⅀ 𝒜 ⇾̣ 𝒜) (φ : 𝒫 ⇾̣ 𝒜)(χ : 𝔛 ⇾̣ 〖 𝒜 , 𝒜 〗) where open Coalgₚ 𝒫ᴮ open Traversal 𝒫ᴮ 𝑎𝑙𝑔 φ χ -- Traversal is derived from 𝕤𝕖𝕞, so it is also a pointed coalgebra homomorphism 𝕥𝕣𝕒𝕧ᵇ⇒ : Coalg⇒ 𝕋ᵇ Travᵇ 𝕥𝕣𝕒𝕧 𝕥𝕣𝕒𝕧ᵇ⇒ = 𝕤𝕖𝕞ᵇ⇒ Travᵇ Travᵃ record { ⟨𝑎𝑙𝑔⟩ = λ{ {t = t} → dext² (λ ρ ς → cong 𝑎𝑙𝑔 (str-dist 𝒜 (jᶜ 𝒫ᴮ) t ρ ς)) } ; ⟨𝑣𝑎𝑟⟩ = refl ; ⟨𝑚𝑣𝑎𝑟⟩ = refl } 𝕥𝕣𝕒𝕧ᴮ⇒ : Coalgₚ⇒ 𝕋ᴮ Travᴮ 𝕥𝕣𝕒𝕧 𝕥𝕣𝕒𝕧ᴮ⇒ = record { ᵇ⇒ = 𝕥𝕣𝕒𝕧ᵇ⇒ ; ⟨η⟩ = ⟨𝕧⟩ } -- Assuming 𝒜 is also a pointed □-coalgebra, traversal also commutes with renaming module _ (𝒜ᴮ : Coalgₚ 𝒜)(φᴮ : Coalgₚ⇒ 𝒫ᴮ 𝒜ᴮ φ) (𝒜rᵃ : MetaAlg⇒ 𝒜ᵃ (□ᵃ 𝒜ᵃ) (Coalgₚ.r 𝒜ᴮ)) where private module 𝒜ᴮ = Coalgₚ 𝒜ᴮ private module φᴮ = Coalgₚ⇒ φᴮ private module 𝒜rᵃ = MetaAlg⇒ 𝒜rᵃ -- Renaming and interpretation can commute r∘𝕥𝕣𝕒𝕧 : MapEq₂ 𝒫ᴮ ℐᴮ 𝑎𝑙𝑔 (λ t σ ϱ → 𝒜ᴮ.r (𝕥𝕣𝕒𝕧 t σ) ϱ) (λ t σ ϱ → 𝕥𝕣𝕒𝕧 t (λ v → r (σ v) ϱ)) r∘𝕥𝕣𝕒𝕧 = record { φ = 𝒜ᴮ.η ; ϕ = λ v → 𝒜ᴮ.r (φ v) ; χ = χ ; f⟨𝑣⟩ = 𝒜ᴮ.r≈₁ 𝕥⟨𝕧⟩ ; f⟨𝑚⟩ = trans (𝒜ᴮ.r≈₁ 𝕥⟨𝕞⟩) (cong (λ - → - _) 𝒜rᵃ.⟨𝑚𝑣𝑎𝑟⟩) ; f⟨𝑎⟩ = λ{ {σ = σ}{ϱ}{t} → begin 𝒜ᴮ.r (𝕥𝕣𝕒𝕧 (𝕒𝕝𝕘 t) σ) ϱ ≡⟨ 𝒜ᴮ.r≈₁ 𝕥⟨𝕒⟩ ⟩ 𝒜ᴮ.r (𝑎𝑙𝑔 (str 𝒫ᴮ 𝒜 (⅀₁ 𝕥𝕣𝕒𝕧 t) σ)) ϱ ≡⟨ cong (λ - → - ϱ) 𝒜rᵃ.⟨𝑎𝑙𝑔⟩ ⟩ 𝑎𝑙𝑔 (str ℐᴮ 𝒜 (⅀.F₁ 𝒜ᴮ.r (str 𝒫ᴮ 𝒜 (⅀.F₁ 𝕥𝕣𝕒𝕧 t) σ)) ϱ) ≡˘⟨ congr (str-nat₂ 𝒜ᴮ.r (⅀.F₁ 𝕥𝕣𝕒𝕧 t) σ) (λ - → 𝑎𝑙𝑔 (str ℐᴮ 𝒜 - ϱ)) ⟩ 𝑎𝑙𝑔 (str ℐᴮ 𝒜 (str 𝒫ᴮ (□ 𝒜) (⅀.F₁ (λ { h ς → 𝒜ᴮ.r (h ς) }) (⅀.F₁ 𝕥𝕣𝕒𝕧 t)) σ) ϱ) ≡˘⟨ congr ⅀.homomorphism (λ - → 𝑎𝑙𝑔 (str ℐᴮ 𝒜 (str 𝒫ᴮ (□ 𝒜) - σ) ϱ)) ⟩ 𝑎𝑙𝑔 (str ℐᴮ 𝒜 (str 𝒫ᴮ (□ 𝒜) (⅀₁ (λ{ t σ → 𝒜ᴮ.r (𝕥𝕣𝕒𝕧 t σ)}) t) σ) ϱ) ∎ } ; g⟨𝑣⟩ = trans 𝕥⟨𝕧⟩ φᴮ.⟨r⟩ ; g⟨𝑚⟩ = 𝕥⟨𝕞⟩ ; g⟨𝑎⟩ = λ{ {σ = σ}{ϱ}{t} → begin 𝕥𝕣𝕒𝕧 (𝕒𝕝𝕘 t) (λ x → r (σ x) ϱ) ≡⟨ 𝕥⟨𝕒⟩ ⟩ 𝑎𝑙𝑔 (str 𝒫ᴮ 𝒜 (⅀₁ 𝕥𝕣𝕒𝕧 t) (λ x → r (σ x) ϱ)) ≡⟨ cong 𝑎𝑙𝑔 (str-dist 𝒜 (rᶜ 𝒫ᴮ) (⅀₁ 𝕥𝕣𝕒𝕧 t) σ ϱ) ⟩ 𝑎𝑙𝑔 (str ℐᴮ 𝒜 (str 𝒫ᴮ (□ 𝒜) (⅀.F₁ (precomp 𝒜 r) (⅀₁ 𝕥𝕣𝕒𝕧 t)) σ) ϱ) ≡˘⟨ congr ⅀.homomorphism (λ - → 𝑎𝑙𝑔 (str ℐᴮ 𝒜 (str 𝒫ᴮ (□ 𝒜) - σ) ϱ)) ⟩ 𝑎𝑙𝑔 (str ℐᴮ 𝒜 (str 𝒫ᴮ (□ 𝒜) (⅀₁ (λ{ t σ ϱ → 𝕥𝕣𝕒𝕧 t (λ v → r (σ v) ϱ)}) t) σ) ϱ) ∎ } } where open ≡-Reasoning -- The traversal map 𝕋 ⇾ 〖𝒫, 𝒜〗 is pointed coalgebraic if 𝒜 has coalgebra structure 𝕥𝕣𝕒𝕧ᶜ : Coalgebraic 𝕋ᴮ 𝒫ᴮ 𝒜ᴮ 𝕥𝕣𝕒𝕧 𝕥𝕣𝕒𝕧ᶜ = record { r∘f = λ{ {σ = σ}{ϱ}{t = t} → MapEq₂.≈ r∘𝕥𝕣𝕒𝕧 t } ; f∘r = λ{ {ρ = ρ}{ς}{t = t} → cong (λ - → - ς) (Coalg⇒.⟨r⟩ 𝕥𝕣𝕒𝕧ᵇ⇒ {ρ = ρ}{t = t}) } ; f∘η = trans 𝕥⟨𝕧⟩ φᴮ.⟨η⟩ }
{ "alphanum_fraction": 0.5091011447, "avg_line_length": 37.5281690141, "ext": "agda", "hexsha": "a4a1e25df1ee718873c8d3ca2250ba3f27380942", "lang": "Agda", "max_forks_count": 4, "max_forks_repo_forks_event_max_datetime": "2022-01-24T12:49:17.000Z", "max_forks_repo_forks_event_min_datetime": "2021-11-09T20:39:59.000Z", "max_forks_repo_head_hexsha": "ff1a985a6be9b780d3ba2beff68e902394f0a9d8", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "JoeyEremondi/agda-soas", "max_forks_repo_path": "SOAS/Metatheory/Coalgebraic.agda", "max_issues_count": 1, "max_issues_repo_head_hexsha": "ff1a985a6be9b780d3ba2beff68e902394f0a9d8", "max_issues_repo_issues_event_max_datetime": "2021-11-21T12:19:32.000Z", "max_issues_repo_issues_event_min_datetime": "2021-11-21T12:19:32.000Z", "max_issues_repo_licenses": [ "MIT" ], "max_issues_repo_name": "JoeyEremondi/agda-soas", "max_issues_repo_path": "SOAS/Metatheory/Coalgebraic.agda", "max_line_length": 102, "max_stars_count": 39, "max_stars_repo_head_hexsha": "ff1a985a6be9b780d3ba2beff68e902394f0a9d8", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "JoeyEremondi/agda-soas", "max_stars_repo_path": "SOAS/Metatheory/Coalgebraic.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": 3933, "size": 5329 }
{-# OPTIONS --cubical --no-import-sorts --safe #-} module Cubical.Data.Bool.SwitchStatement where open import Cubical.Core.Everything open import Cubical.Foundations.Prelude open import Cubical.Data.Bool.Base open import Cubical.Data.Nat {- Switch-case: _==_ : A → A → Bool _ : B _ = switch (λ x → x == fixedValue) cases case value1 ⇒ result1 break case value2 ⇒ result2 break ... case valueN ⇒ resultN break default⇒ defaultResult -} private variable ℓ ℓ′ : Level infixr 6 default⇒_ infixr 5 case_⇒_break_ infixr 4 switch_cases_ switch_cases_ : {A : Type ℓ} {B : Type ℓ′} → (A → Bool) → ((A → Bool) → B) → B switch caseIndicator cases caseData = caseData caseIndicator case_⇒_break_ : {A : Type ℓ} {B : Type ℓ′} → A → B → (otherCases : (A → Bool) → B) → (A → Bool) → B case forValue ⇒ result break otherCases = λ caseIndicator → if (caseIndicator forValue) then result else (otherCases caseIndicator) default⇒_ : {A : Type ℓ} {B : Type ℓ′} → B → (A → Bool) → B default⇒_ value caseIndicator = value
{ "alphanum_fraction": 0.6443014706, "avg_line_length": 25.3023255814, "ext": "agda", "hexsha": "2a543d59ecb7a2a6b93e78eee408c82ee9069162", "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/Bool/SwitchStatement.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/Bool/SwitchStatement.agda", "max_line_length": 131, "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/Bool/SwitchStatement.agda", "max_stars_repo_stars_event_max_datetime": null, "max_stars_repo_stars_event_min_datetime": null, "num_tokens": 351, "size": 1088 }
module Data.Lens.Proofs.LensComposition where open import Haskell.Prelude renaming (zero to Z; suc to S) open import Data.Lens.Lens open import Data.Logic open import Agda.Primitive open import Data.Lens.Proofs.LensLaws open import Data.Lens.Proofs.LensPostulates -- We proof that if we have 2 valid lenses l1 and l2, that l1 ∘ l2 is also valid -- We do this law by law prop-Composition-ViewSet : {a b c : Set} -> (l1 : ValidLens a b) -> (l2 : ValidLens b c) -> ViewSet ((toLens l1) ∘ (toLens l2)) prop-Composition-ViewSet vl1@(CValidLens l1 vs1 sv1 ss1) vl2@(CValidLens l2 vs2 sv2 ss2) v s = begin view (l1 ∘ l2) (set (l1 ∘ l2) v s) =⟨ prop-view-compose vl1 vl2 (set (l1 ∘ l2) v s) ⟩ view l2 ( view l1 (set (l1 ∘ l2) v s)) =⟨ cong (view l2 ∘ view l1) (prop-set-compose-dir vl1 vl2 s v) ⟩ view l2 ( view l1 (set l1 ((set l2 v) (view l1 s)) s)) =⟨ cong (view l2) (vs1 ((set l2 v) (view l1 s)) s) ⟩ view l2 (set l2 v (view l1 s)) =⟨ vs2 v (view l1 s) ⟩ v end prop-Composition-SetView : {a b c : Set} -> (l1 : ValidLens a b) -> (l2 : ValidLens b c) -> SetView ((toLens l1) ∘ (toLens l2)) prop-Composition-SetView vl1@(CValidLens l1 vs1 sv1 ss1) vl2@(CValidLens l2 vs2 sv2 ss2) s = begin set (l1 ∘ l2) (view (l1 ∘ l2) s) s =⟨ cong (λ x -> set (l1 ∘ l2) x s) (prop-view-compose vl1 vl2 s) ⟩ set (l1 ∘ l2) (view l2 (view l1 s)) s =⟨ prop-set-compose-dir vl1 vl2 s (view l2 (view l1 s)) ⟩ set l1 (set l2 (view l2 (view l1 s)) (view l1 s)) s =⟨ cong (λ x -> set l1 x s) (sv2 (view l1 s)) ⟩ set l1 (view l1 s) s =⟨ sv1 s ⟩ s end prop-Composition-SetSet : {a b c : Set} -> (l1 : ValidLens a b) -> (l2 : ValidLens b c) -> SetSet ((toLens l1) ∘ (toLens l2)) prop-Composition-SetSet vl1@(CValidLens l1 vs1 sv1 ss1) vl2@(CValidLens l2 vs2 sv2 ss2) v1 v2 s = begin set (l1 ∘ l2) v2 (set (l1 ∘ l2) v1 s) =⟨ cong (set (l1 ∘ l2) v2) (prop-set-compose-dir vl1 vl2 s v1) ⟩ set (l1 ∘ l2) v2 (set l1 (set l2 v1 (view l1 s)) s) =⟨ prop-set-compose-dir vl1 vl2 (set l1 ((set l2 v1) (view l1 s)) s) v2 ⟩ set l1 (set l2 v2 (view l1 (set l1 ((set l2 v1) (view l1 s)) s) ) ) (set l1 (set l2 v1 (view l1 s)) s) =⟨ cong (λ x -> set l1 (set l2 v2 x) (set l1 ((set l2 v1) (view l1 s)) s)) (vs1 ((set l2 v1) (view l1 s)) s) ⟩ set l1 (set l2 v2 (set l2 v1 (view l1 s)) ) (set l1 (set l2 v1 (view l1 s)) s) =⟨ cong (λ x -> set l1 x (set l1 (set l2 v1 (view l1 s)) s)) (ss2 v1 v2 (view l1 s)) ⟩ set l1 (set l2 v2 (view l1 s) ) (set l1 (set l2 v1 (view l1 s)) s) =⟨ ss1 ((set l2 v1 (view l1 s))) ((set l2 v2 (view l1 s))) s ⟩ set l1 (set l2 v2 (view l1 s) ) s =⟨ sym (prop-set-compose-dir vl1 vl2 s v2) ⟩ set (l1 ∘ l2) v2 s end -- Create a function that does the composition composeLens : {a b c : Set} -> (ValidLens a b) -> (ValidLens b c) -> (ValidLens a c) composeLens vl1@(CValidLens l1 vs1 sv1 ss1) vl2@(CValidLens l2 vs2 sv2 ss2) = CValidLens (l1 ∘ l2) (prop-Composition-ViewSet vl1 vl2) (prop-Composition-SetView vl1 vl2) (prop-Composition-SetSet vl1 vl2)
{ "alphanum_fraction": 0.5265248227, "avg_line_length": 37.9032258065, "ext": "agda", "hexsha": "769bb9537f617ed1d0a701b81203b415efae6ff4", "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": "4959a3c9cd8563a1726e0e968e6a179008cd4d9f", "max_forks_repo_licenses": [ "Unlicense" ], "max_forks_repo_name": "JonathanBrouwer/research-project", "max_forks_repo_path": "src/Data/Lens/Proofs/LensComposition.agda", "max_issues_count": null, "max_issues_repo_head_hexsha": "4959a3c9cd8563a1726e0e968e6a179008cd4d9f", "max_issues_repo_issues_event_max_datetime": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_licenses": [ "Unlicense" ], "max_issues_repo_name": "JonathanBrouwer/research-project", "max_issues_repo_path": "src/Data/Lens/Proofs/LensComposition.agda", "max_line_length": 130, "max_stars_count": 1, "max_stars_repo_head_hexsha": "4959a3c9cd8563a1726e0e968e6a179008cd4d9f", "max_stars_repo_licenses": [ "Unlicense" ], "max_stars_repo_name": "JonathanBrouwer/research-project", "max_stars_repo_path": "src/Data/Lens/Proofs/LensComposition.agda", "max_stars_repo_stars_event_max_datetime": "2021-05-25T09:10:20.000Z", "max_stars_repo_stars_event_min_datetime": "2021-05-25T09:10:20.000Z", "num_tokens": 1394, "size": 3525 }
-- Andreas, 2018-09-07 issue #3217 reported by Nisse -- -- Missing range for cubical error {-# OPTIONS --cubical #-} -- {-# OPTIONS -v tc.term.lambda:100 -v tc.term:10 #-} open import Agda.Builtin.Cubical.Path data Bool : Set where true false : Bool eq : true ≡ false eq = λ i → true -- Expected error -- Issue3217.agda:15,12-16 -- true != false of type Bool -- when checking that the expression λ i → true has type true ≡ false
{ "alphanum_fraction": 0.6727688787, "avg_line_length": 20.8095238095, "ext": "agda", "hexsha": "90d813de971c828bae3f9bd2f7c497724d1de543", "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/Issue3217.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/Issue3217.agda", "max_line_length": 69, "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/Issue3217.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": 132, "size": 437 }
-- Andreas, 2015-07-07 continuation of issue 665 -- Jesper, 2015-12-18 some of these don't work anymore with the new unifier, -- but a few others that weren't accepted are now. {-# OPTIONS --show-implicit #-} -- {-# OPTIONS -v tc.with.strip:10 #-} -- {-# OPTIONS -v tc.with.strip:60 -v tc.lhs:20 -v tc.lhs.unify:20 #-} postulate C : Set anything : C record I : Set where constructor c field {f} : C data Wrap : (i : I) → Set where wrap : ∀ {i} → Wrap i -- Test 0: first argument not given test0 : ∀ {j} → Wrap j → C test0 wrap with anything test0 wrap | z = z test0a : ∀ {j} → Wrap j → C test0a (wrap {c {x}}) with anything test0a wrap | z = z test0b : ∀ {j} → Wrap j → C test0b (wrap {c {_}}) with anything test0b wrap | z = z test0c : ∀ {j} → Wrap j → C test0c (wrap {c}) with anything test0c wrap | z = z test0d : ∀ {j} → Wrap j → C test0d (wrap {c {._}}) with anything test0d wrap | z = z test0e : ∀ {j} → Wrap j → C test0e (wrap .{c}) with anything test0e wrap | z = z test0f : ∀ {j} → Wrap j → C test0f (wrap .{c {_}}) with anything test0f wrap | z = z --test00 : ∀ {j} → Wrap j → C --test00 wrap with anything --test00 {.c} wrap | z = z test00a : ∀ {j} → Wrap j → C test00a (wrap {c {x}}) with anything test00a {.c} wrap | z = z --test00b : ∀ {j} → Wrap j → C --test00b (wrap {c {_}}) with anything --test00b {.c} wrap | z = z --test00c : ∀ {j} → Wrap j → C --test00c (wrap {c}) with anything --test00c {.c} wrap | z = z --test00d : ∀ {j} → Wrap j → C --test00d (wrap {c {._}}) with anything --test00d {.c} wrap | z = z --test00e : ∀ {j} → Wrap j → C --test00e (wrap .{c}) with anything --test00e {.c} wrap | z = z --test00f : ∀ {j} → Wrap j → C --test00f (wrap .{c {_}}) with anything --test00f {.c} wrap | z = z --test000 : ∀ {j} → Wrap j → C --test000 wrap with anything --test000 .{c {_}} wrap | z = z test000a : ∀ {j} → Wrap j → C test000a (wrap {c {x}}) with anything test000a .{c {_}} wrap | z = z --test000b : ∀ {j} → Wrap j → C --test000b (wrap {c {_}}) with anything --test000b .{c {_}} wrap | z = z --test000c : ∀ {j} → Wrap j → C --test000c (wrap {c}) with anything --test000c .{c {_}} wrap | z = z --test000d : ∀ {j} → Wrap j → C --test000d (wrap {c {._}}) with anything --test000d .{c {_}} wrap | z = z --test000e : ∀ {j} → Wrap j → C --test000e (wrap .{c}) with anything --test000e .{c {_}} wrap | z = z --test000f : ∀ {j} → Wrap j → C --test000f (wrap .{c {_}}) with anything --test000f .{c {_}} wrap | z = z -- Test 1: first argument is dot pattern test1a : ∀ {j} → Wrap j → C test1a .{c} (wrap {c {x}}) with anything test1a .{c} wrap | z = z test1b : ∀ {j} → Wrap j → C test1b .{c} (wrap {c {_}}) with anything test1b .{c} wrap | z = z test1c : ∀ {j} → Wrap j → C test1c .{c} (wrap {c}) with anything test1c .{c} wrap | z = z test11a : ∀ {j} → Wrap j → C test11a .{c} (wrap {c {x}}) with anything test11a wrap | z = z test11b : ∀ {j} → Wrap j → C test11b .{c} (wrap {c {_}}) with anything test11b wrap | z = z test11c : ∀ {j} → Wrap j → C test11c .{c} (wrap {c}) with anything test11c wrap | z = z test111a : ∀ {j} → Wrap j → C test111a (wrap {c {x}}) with anything test111a .{c} wrap | z = z --test111b : ∀ {j} → Wrap j → C --test111b (wrap {c {_}}) with anything --test111b .{c} wrap | z = z --test111c : ∀ {j} → Wrap j → C --test111c (wrap {c}) with anything --test111c .{c} wrap | z = z -- Test 2: First argument is record pattern test2a : ∀ {j} → Wrap j → C test2a {c} wrap with anything test2a {c} wrap | z = z test2b : ∀ {j} → Wrap j → C test2b {c} wrap with anything test2b wrap | z = z test2c : ∀ {j} → Wrap j → C test2c {c} (wrap {c}) with anything test2c {c} wrap | z = z test2d : ∀ {j} → Wrap j → C test2d {c} (wrap {c}) with anything test2d wrap | z = z test2e : ∀ {j} → Wrap j → C test2e {c} (wrap {c {._}}) with anything test2e {c} wrap | z = z test2f : ∀ {j} → Wrap j → C test2f {c} (wrap {c {._}}) with anything test2f wrap | z = z test2g : ∀ {j} → Wrap j → C test2g {c} (wrap {c {x}}) with anything test2g {c} wrap | z = z test2h : ∀ {j} → Wrap j → C test2h {c} (wrap {c {x}}) with anything test2h wrap | z = z test2i : ∀ {j} → Wrap j → C test2i {c} (wrap {c {_}}) with anything test2i {c} wrap | z = z test2j : ∀ {j} → Wrap j → C test2j {c} (wrap {c {_}}) with anything test2j wrap | z = z -- Test 3: First argument is record of dot pattern, second is record pattern -- The commented-out ones fail due to issue 1608 -- test3a : ∀ {j} → Wrap j → C -- test3a {c {._}} wrap with anything -- test3a {c {._}} wrap | z = z test3b : ∀ {j} → Wrap j → C test3b {c {._}} wrap with anything test3b wrap | z = z -- test3c : ∀ {j} → Wrap j → C -- test3c {c {._}} (wrap {c}) with anything -- test3c {c {._}} wrap | z = z test3d : ∀ {j} → Wrap j → C test3d {c {._}} (wrap {c}) with anything test3d wrap | z = z -- test3e : ∀ {j} → Wrap j → C -- test3e {c {._}} (wrap {c {._}}) with anything -- test3e {c {._}} wrap | z = z -- test3f : ∀ {j} → Wrap j → C -- test3f {c {._}} (wrap {c {._}}) with anything -- test3f wrap | z = z test3g : ∀ {j} → Wrap j → C test3g {c {._}} (wrap {c {x}}) with anything test3g {c {._}} wrap | z = z test3h : ∀ {j} → Wrap j → C test3h {c {._}} (wrap {c {x}}) with anything test3h wrap | z = z -- test3i : ∀ {j} → Wrap j → C -- test3i {c {._}} (wrap {c {_}}) with anything -- test3i {c {._}} wrap | z = z test3j : ∀ {j} → Wrap j → C test3j {c {._}} (wrap {c {_}}) with anything test3j wrap | z = z
{ "alphanum_fraction": 0.5641686614, "avg_line_length": 23.6130434783, "ext": "agda", "hexsha": "e38a31e5c9dc1dbf70e303c041a0387015a5f223", "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": "test/Succeed/Issue473-1606.agda", "max_issues_count": null, "max_issues_repo_head_hexsha": "c0ae7d20728b15d7da4efff6ffadae6fe4590016", "max_issues_repo_issues_event_max_datetime": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_licenses": [ "BSD-3-Clause" ], "max_issues_repo_name": "redfish64/autonomic-agda", "max_issues_repo_path": "test/Succeed/Issue473-1606.agda", "max_line_length": 76, "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": "test/Succeed/Issue473-1606.agda", "max_stars_repo_stars_event_max_datetime": null, "max_stars_repo_stars_event_min_datetime": null, "num_tokens": 2249, "size": 5431 }
{-# OPTIONS --without-K --safe #-} open import Categories.Category using (Category; _[_,_]; _[_∘_]; _[_≈_]) -- Bundled versions of Idempotents, as well as maps between idempotents. module Categories.Morphism.Idempotent.Bundles {o ℓ e} (𝒞 : Category o ℓ e) where open import Level import Categories.Morphism.Idempotent 𝒞 as Idem open import Categories.Morphism.Reasoning 𝒞 private module 𝒞 = Category 𝒞 open 𝒞.HomReasoning open 𝒞.Equiv -------------------------------------------------------------------------------- -- Bundled Idempotents, and maps between them record Idempotent : Set (o ⊔ ℓ ⊔ e) where field {obj} : 𝒞.Obj isIdempotent : Idem.Idempotent obj open Idem.Idempotent isIdempotent public open Idempotent record Idempotent⇒ (I J : Idempotent) : Set (ℓ ⊔ e) where private module I = Idempotent I module J = Idempotent J field hom : 𝒞 [ I.obj , J.obj ] absorbˡ : 𝒞 [ 𝒞 [ J.idem ∘ hom ] ≈ hom ] absorbʳ : 𝒞 [ 𝒞 [ hom ∘ I.idem ] ≈ hom ] open Idempotent⇒ -------------------------------------------------------------------------------- -- Identity and Composition of maps between Idempotents id : ∀ {I} → Idempotent⇒ I I id {I} = record { hom = idem I ; absorbˡ = idempotent I ; absorbʳ = idempotent I } _∘_ : ∀ {I J K} → (f : Idempotent⇒ J K) → (g : Idempotent⇒ I J) → Idempotent⇒ I K _∘_ {I} {J} {K} f g = record { hom = 𝒞 [ f.hom ∘ g.hom ] ; absorbˡ = pullˡ f.absorbˡ ; absorbʳ = pullʳ g.absorbʳ } where module f = Idempotent⇒ f module g = Idempotent⇒ g
{ "alphanum_fraction": 0.5816655907, "avg_line_length": 25.8166666667, "ext": "agda", "hexsha": "c838d7bd073f9e90714acfc9ff870147c061cffb", "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/Morphism/Idempotent/Bundles.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/Morphism/Idempotent/Bundles.agda", "max_line_length": 81, "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/Morphism/Idempotent/Bundles.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": 547, "size": 1549 }
{-# OPTIONS --cubical --safe --no-import-sorts #-} module Cubical.Algebra.Algebra.Base where open import Cubical.Foundations.Prelude open import Cubical.Foundations.Equiv open import Cubical.Foundations.Equiv.HalfAdjoint open import Cubical.Foundations.HLevels open import Cubical.Foundations.Isomorphism open import Cubical.Foundations.Function open import Cubical.Foundations.SIP open import Cubical.Data.Sigma open import Cubical.Structures.Axioms open import Cubical.Structures.Auto open import Cubical.Structures.Macro open import Cubical.Algebra.Module renaming (⟨_⟩ to ⟨_⟩m) open import Cubical.Algebra.Ring renaming (⟨_⟩ to ⟨_⟩r) open import Cubical.Algebra.AbGroup hiding (⟨_⟩) open import Cubical.Algebra.Group hiding (⟨_⟩) open import Cubical.Algebra.Monoid hiding (⟨_⟩) open Iso private variable ℓ : Level record IsAlgebra (R : Ring {ℓ}) {A : Type ℓ} (0a 1a : A) (_+_ _·_ : A → A → A) (-_ : A → A) (_⋆_ : ⟨ R ⟩r → A → A) : Type ℓ where constructor isalgebra open Ring R using (1r) renaming (_+_ to _+r_; _·_ to _·r_) field isLeftModule : IsLeftModule R 0a _+_ -_ _⋆_ ·-isMonoid : IsMonoid 1a _·_ dist : (x y z : A) → (x · (y + z) ≡ (x · y) + (x · z)) × ((x + y) · z ≡ (x · z) + (y · z)) ⋆-lassoc : (r : ⟨ R ⟩r) (x y : A) → (r ⋆ x) · y ≡ r ⋆ (x · y) ⋆-rassoc : (r : ⟨ R ⟩r) (x y : A) → r ⋆ (x · y) ≡ x · (r ⋆ y) open IsLeftModule isLeftModule public isRing : IsRing _ _ _ _ _ isRing = isring (IsLeftModule.+-isAbGroup isLeftModule) ·-isMonoid dist open IsRing isRing public hiding (_-_; +-assoc; +-lid; +-linv; +-rid; +-rinv; +-comm) record Algebra (R : Ring {ℓ}) : Type (ℓ-suc ℓ) where constructor algebra field Carrier : Type ℓ 0a : Carrier 1a : Carrier _+_ : Carrier → Carrier → Carrier _·_ : Carrier → Carrier → Carrier -_ : Carrier → Carrier _⋆_ : ⟨ R ⟩r → Carrier → Carrier isAlgebra : IsAlgebra R 0a 1a _+_ _·_ -_ _⋆_ open IsAlgebra isAlgebra public module commonExtractors {R : Ring {ℓ}} where ⟨_⟩ : Algebra R → Type ℓ ⟨_⟩ = Algebra.Carrier Algebra→Module : (A : Algebra R) → LeftModule R Algebra→Module (algebra A _ _ _ _ _ _ (isalgebra isLeftModule _ _ _ _)) = leftmodule A _ _ _ _ isLeftModule Algebra→Ring : (A : Algebra R) → Ring {ℓ} Algebra→Ring A = ring _ _ _ _ _ _ (IsAlgebra.isRing (Algebra.isAlgebra A)) Algebra→AbGroup : (A : Algebra R) → AbGroup {ℓ} Algebra→AbGroup A = LeftModule→AbGroup (Algebra→Module A) Algebra→Monoid : (A : Algebra R) → Monoid {ℓ} Algebra→Monoid A = Ring→Monoid (Algebra→Ring A) isSetAlgebra : (A : Algebra R) → isSet ⟨ A ⟩ isSetAlgebra A = isSetAbGroup (Algebra→AbGroup A) open Ring R using (1r; ·-ldist-+) renaming (_+_ to _+r_; _·_ to _·s_) makeIsAlgebra : {A : Type ℓ} {0a 1a : A} {_+_ _·_ : A → A → A} { -_ : A → A} {_⋆_ : ⟨ R ⟩r → A → A} (isSet-A : isSet A) (+-assoc : (x y z : A) → x + (y + z) ≡ (x + y) + z) (+-rid : (x : A) → x + 0a ≡ x) (+-rinv : (x : A) → x + (- x) ≡ 0a) (+-comm : (x y : A) → x + y ≡ y + x) (·-assoc : (x y z : A) → x · (y · z) ≡ (x · y) · z) (·-rid : (x : A) → x · 1a ≡ x) (·-lid : (x : A) → 1a · x ≡ x) (·-rdist-+ : (x y z : A) → x · (y + z) ≡ (x · y) + (x · z)) (·-ldist-+ : (x y z : A) → (x + y) · z ≡ (x · z) + (y · z)) (⋆-assoc : (r s : ⟨ R ⟩r) (x : A) → (r ·s s) ⋆ x ≡ r ⋆ (s ⋆ x)) (⋆-ldist : (r s : ⟨ R ⟩r) (x : A) → (r +r s) ⋆ x ≡ (r ⋆ x) + (s ⋆ x)) (⋆-rdist : (r : ⟨ R ⟩r) (x y : A) → r ⋆ (x + y) ≡ (r ⋆ x) + (r ⋆ y)) (⋆-lid : (x : A) → 1r ⋆ x ≡ x) (⋆-lassoc : (r : ⟨ R ⟩r) (x y : A) → (r ⋆ x) · y ≡ r ⋆ (x · y)) (⋆-rassoc : (r : ⟨ R ⟩r) (x y : A) → r ⋆ (x · y) ≡ x · (r ⋆ y)) → IsAlgebra R 0a 1a _+_ _·_ -_ _⋆_ makeIsAlgebra isSet-A +-assoc +-rid +-rinv +-comm ·-assoc ·-rid ·-lid ·-rdist-+ ·-ldist-+ ⋆-assoc ⋆-ldist ⋆-rdist ⋆-lid ⋆-lassoc ⋆-rassoc = isalgebra (makeIsLeftModule isSet-A +-assoc +-rid +-rinv +-comm ⋆-assoc ⋆-ldist ⋆-rdist ⋆-lid) (makeIsMonoid isSet-A ·-assoc ·-rid ·-lid) (λ x y z → ·-rdist-+ x y z , ·-ldist-+ x y z) ⋆-lassoc ⋆-rassoc open commonExtractors public record AlgebraEquiv {R : Ring {ℓ}} (A B : Algebra R) : Type ℓ where constructor algebraiso instance _ : Algebra R _ = A _ : Algebra R _ = B open Algebra {{...}} field e : ⟨ A ⟩ ≃ ⟨ B ⟩ isHom+ : (x y : ⟨ A ⟩) → equivFun e (x + y) ≡ equivFun e x + equivFun e y isHom· : (x y : ⟨ A ⟩) → equivFun e (x · y) ≡ equivFun e x · equivFun e y pres1 : equivFun e 1a ≡ 1a comm⋆ : (r : ⟨ R ⟩r) (x : ⟨ A ⟩) → equivFun e (r ⋆ x) ≡ r ⋆ equivFun e x record AlgebraHom {R : Ring {ℓ}} (A B : Algebra R) : Type ℓ where constructor algebrahom private instance _ : Algebra R _ = A _ : Algebra R _ = B open Algebra {{...}} field f : ⟨ A ⟩ → ⟨ B ⟩ isHom+ : (x y : ⟨ A ⟩) → f (x + y) ≡ f x + f y isHom· : (x y : ⟨ A ⟩) → f (x · y) ≡ f x · f y pres1 : f 1a ≡ 1a comm⋆ : (r : ⟨ R ⟩r) (x : ⟨ A ⟩) → f (r ⋆ x) ≡ r ⋆ f x pres0 : f 0a ≡ 0a pres0 = sym (Theory.+-idempotency→0 (Algebra→Ring B) (f 0a) (f 0a ≡⟨ cong f (sym (+-rid _)) ⟩ f (0a + 0a) ≡⟨ isHom+ _ _ ⟩ f 0a + f 0a ∎)) isHom- : (x : ⟨ A ⟩) → f (- x) ≡ - f x isHom- x = Theory.implicitInverse (Algebra→Ring B) (f x) (f (- x)) (f (x) + f (- x) ≡⟨ sym (isHom+ _ _) ⟩ f (x - x) ≡⟨ cong f (+-rinv _) ⟩ f 0a ≡⟨ pres0 ⟩ 0a ∎) _$a_ : {R : Ring {ℓ}} {A B : Algebra R} → AlgebraHom A B → ⟨ A ⟩ → ⟨ B ⟩ f $a x = AlgebraHom.f f x _∘a_ : {R : Ring {ℓ}} {A B C : Algebra R} → AlgebraHom B C → AlgebraHom A B → AlgebraHom A C _∘a_ {ℓ} {R} {A} {B} {C} (algebrahom f isHom+f isHom·f pres1f comm⋆f) (algebrahom g isHom+g isHom·g pres1g comm⋆g) = let open Algebra ⦃...⦄ instance _ : Algebra R _ = A _ : Algebra R _ = B _ : Algebra R _ = C in algebrahom (f ∘ g) (λ x y → f (g (x + y)) ≡⟨ cong f (isHom+g x y) ⟩ f (g x + g y) ≡⟨ isHom+f _ _ ⟩ f (g x) + f (g y) ∎) (λ x y → f (g (x · y)) ≡⟨ cong f (isHom·g x y) ⟩ f (g x · g y) ≡⟨ isHom·f _ _ ⟩ f (g x) · f (g y) ∎) (f (g 1a) ≡⟨ cong f pres1g ⟩ f 1a ≡⟨ pres1f ⟩ 1a ∎) λ r x → f (g (r ⋆ x)) ≡⟨ cong f (comm⋆g _ _) ⟩ f (r ⋆ (g x)) ≡⟨ comm⋆f _ _ ⟩ r ⋆ (f (g x)) ∎ module AlgebraΣTheory (R : Ring {ℓ}) where RawAlgebraStructure = λ (A : Type ℓ) → (A → A → A) × (A → A → A) × A × (⟨ R ⟩r → A → A) RawAlgebraEquivStr = AutoEquivStr RawAlgebraStructure rawAlgebraUnivalentStr : UnivalentStr _ RawAlgebraEquivStr rawAlgebraUnivalentStr = autoUnivalentStr RawAlgebraStructure open Ring R using (1r) renaming (_+_ to _+r_; _·_ to _·r_) open RingΣTheory open LeftModuleΣTheory R open MonoidΣTheory AlgebraAxioms : (A : Type ℓ) (str : RawAlgebraStructure A) → Type ℓ AlgebraAxioms A (_+_ , _·_ , 1a , _⋆_) = LeftModuleAxioms A (_+_ , _⋆_) × (MonoidAxioms A (1a , _·_)) × ((x y z : A) → (x · (y + z) ≡ (x · y) + (x · z)) × ((x + y) · z ≡ (x · z) + (y · z))) × ((r : ⟨ R ⟩r) (x y : A) → (r ⋆ x) · y ≡ r ⋆ (x · y)) × ((r : ⟨ R ⟩r) (x y : A) → r ⋆ (x · y) ≡ x · (r ⋆ y)) AlgebraStructure : Type ℓ → Type ℓ AlgebraStructure = AxiomsStructure RawAlgebraStructure AlgebraAxioms AlgebraΣ : Type (ℓ-suc ℓ) AlgebraΣ = TypeWithStr ℓ AlgebraStructure AlgebraEquivStr : StrEquiv AlgebraStructure ℓ AlgebraEquivStr = AxiomsEquivStr RawAlgebraEquivStr AlgebraAxioms isSetAlgebraΣ : (A : AlgebraΣ) → isSet _ isSetAlgebraΣ (A , _ , (isLeftModule , _ , _) ) = isSetLeftModuleΣ (A , _ , isLeftModule) isPropAlgebraAxioms : (A : Type ℓ) (s : RawAlgebraStructure A) → isProp (AlgebraAxioms A s) isPropAlgebraAxioms A (_+_ , _·_ , 1a , _⋆_) = isPropΣ (isPropLeftModuleAxioms A (_+_ , _⋆_)) (λ isLeftModule → isProp× (isPropMonoidAxioms A (1a , _·_)) (isProp× (isPropΠ3 (λ _ _ _ → isProp× ((isSetLeftModuleΣ (A , _ , isLeftModule)) _ _) ((isSetLeftModuleΣ (A , _ , isLeftModule)) _ _))) (isProp× (isPropΠ3 (λ _ _ _ → (isSetLeftModuleΣ (A , _ , isLeftModule)) _ _)) (isPropΠ3 (λ _ _ _ → (isSetLeftModuleΣ (A , _ , isLeftModule)) _ _))))) Algebra→AlgebraΣ : Algebra R → AlgebraΣ Algebra→AlgebraΣ (algebra A 0a 1a _+_ _·_ -_ _⋆_ (isalgebra isLeftModule isMonoid dist ⋆-lassoc ⋆-rassoc)) = A , (_+_ , _·_ , 1a , _⋆_) , (LeftModule→LeftModuleΣ (leftmodule A _ _ _ _ isLeftModule) .snd .snd) , Monoid→MonoidΣ (monoid A _ _ isMonoid) .snd .snd , dist , ⋆-lassoc , ⋆-rassoc AlgebraΣ→Algebra : AlgebraΣ → Algebra R AlgebraΣ→Algebra (A , (_+_ , _·_ , 1a , _⋆_) , isLeftModule , isMonoid , dist , lassoc , rassoc) = algebra A _ 1a _+_ _·_ _ _⋆_ (isalgebra (LeftModule.isLeftModule (LeftModuleΣ→LeftModule (A , (_ , isLeftModule)))) (Monoid.isMonoid (MonoidΣ→Monoid (A , (_ , isMonoid)))) dist lassoc rassoc) AlgebraIsoAlgebraΣ : Iso (Algebra R) AlgebraΣ AlgebraIsoAlgebraΣ = iso Algebra→AlgebraΣ AlgebraΣ→Algebra (λ _ → refl) helper where -- helper will be refl, if eta-equality is activated for all structure-records open MonoidΣTheory monoid-helper : retract (Monoid→MonoidΣ {ℓ}) MonoidΣ→Monoid monoid-helper = Iso.leftInv MonoidIsoMonoidΣ module-helper : retract (LeftModule→LeftModuleΣ) LeftModuleΣ→LeftModule module-helper = Iso.leftInv LeftModuleIsoLeftModuleΣ open Algebra helper : _ Carrier (helper a i) = Carrier a 0a (helper a i) = 0a a 1a (helper a i) = 1a a _+_ (helper a i) = _+_ a _·_ (helper a i) = _·_ a -_ (helper a i) = -_ a _⋆_ (helper a i) = _⋆_ a IsAlgebra.isLeftModule (isAlgebra (helper a i)) = LeftModule.isLeftModule (module-helper (leftmodule _ _ _ _ _ (isLeftModule a)) i) IsAlgebra.·-isMonoid (isAlgebra (helper a i)) = Monoid.isMonoid (monoid-helper (monoid _ _ _ (·-isMonoid a)) i) IsAlgebra.dist (isAlgebra (helper a i)) = dist a IsAlgebra.⋆-lassoc (isAlgebra (helper a i)) = ⋆-lassoc a IsAlgebra.⋆-rassoc (isAlgebra (helper a i)) = ⋆-rassoc a algebraUnivalentStr : UnivalentStr AlgebraStructure AlgebraEquivStr algebraUnivalentStr = axiomsUnivalentStr _ isPropAlgebraAxioms rawAlgebraUnivalentStr AlgebraΣPath : (M N : AlgebraΣ) → (M ≃[ AlgebraEquivStr ] N) ≃ (M ≡ N) AlgebraΣPath = SIP algebraUnivalentStr AlgebraEquivΣ : (M N : Algebra R) → Type ℓ AlgebraEquivΣ M N = Algebra→AlgebraΣ M ≃[ AlgebraEquivStr ] Algebra→AlgebraΣ N AlgebraEquivΣPath : {M N : Algebra R} → Iso (AlgebraEquiv M N) (AlgebraEquivΣ M N) fun AlgebraEquivΣPath (algebraiso e isHom+ isHom· pres1 comm⋆) = e , isHom+ , (isHom· , (pres1 , comm⋆)) inv AlgebraEquivΣPath (f , isHom+ , isHom· , pres1 , comm⋆) = algebraiso f isHom+ isHom· pres1 comm⋆ rightInv AlgebraEquivΣPath _ = refl leftInv AlgebraEquivΣPath _ = refl AlgebraPath : (M N : Algebra R) → (AlgebraEquiv M N) ≃ (M ≡ N) AlgebraPath M N = AlgebraEquiv M N ≃⟨ isoToEquiv AlgebraEquivΣPath ⟩ AlgebraEquivΣ M N ≃⟨ AlgebraΣPath _ _ ⟩ Algebra→AlgebraΣ M ≡ Algebra→AlgebraΣ N ≃⟨ isoToEquiv (invIso (congIso AlgebraIsoAlgebraΣ)) ⟩ M ≡ N ■ AlgebraPath : {R : Ring {ℓ}} (M N : Algebra R) → (AlgebraEquiv M N) ≃ (M ≡ N) AlgebraPath {ℓ} {R} = AlgebraΣTheory.AlgebraPath R module AlgebraTheory (R : Ring {ℓ}) (A : Algebra R) where open Ring R renaming (_+_ to _+r_) open Algebra A 0-actsNullifying : (x : ⟨ A ⟩) → 0r ⋆ x ≡ 0a 0-actsNullifying x = let idempotent-+ = 0r ⋆ x ≡⟨ cong (λ u → u ⋆ x) (sym (Theory.0-idempotent R)) ⟩ (0r +r 0r) ⋆ x ≡⟨ ⋆-ldist 0r 0r x ⟩ (0r ⋆ x) + (0r ⋆ x) ∎ in sym (Theory.+-idempotency→0 (Algebra→Ring A) (0r ⋆ x) idempotent-+)
{ "alphanum_fraction": 0.5158796969, "avg_line_length": 38.2076023392, "ext": "agda", "hexsha": "a63fb17e05fe671500b915dbf2cb42c3cd8f4334", "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": "f6771617374bfe65a7043d00731fed5a673aa729", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "knrafto/cubical", "max_forks_repo_path": "Cubical/Algebra/Algebra/Base.agda", "max_issues_count": null, "max_issues_repo_head_hexsha": "f6771617374bfe65a7043d00731fed5a673aa729", "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": "knrafto/cubical", "max_issues_repo_path": "Cubical/Algebra/Algebra/Base.agda", "max_line_length": 100, "max_stars_count": null, "max_stars_repo_head_hexsha": "f6771617374bfe65a7043d00731fed5a673aa729", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "knrafto/cubical", "max_stars_repo_path": "Cubical/Algebra/Algebra/Base.agda", "max_stars_repo_stars_event_max_datetime": null, "max_stars_repo_stars_event_min_datetime": null, "num_tokens": 5107, "size": 13067 }
-- Andreas, 2016-10-03, re issue #2231 -- Termination checking a corecursive definition in abstract mode. {-# OPTIONS --guardedness #-} infix 1000 ♯_ {-# BUILTIN INFINITY ∞ #-} {-# BUILTIN SHARP ♯_ #-} {-# BUILTIN FLAT ♭ #-} abstract data Functor : Set where Id : Functor _·_ : Functor → Set → Set Id · A = A data ν (F : Functor) : Set where inn : ∞ (F · ν F) → ν F -- Evaluation is required to see that Id · ν Id is a coinductive type. foo : ∀ F → F · ν F foo Id = inn (♯ foo Id) -- The termination checker needs to treat the generated #-foo function -- in abstract mode, to have constructor Id in scope.
{ "alphanum_fraction": 0.6191950464, "avg_line_length": 22.275862069, "ext": "agda", "hexsha": "23b3e61d701b71ac736c890f978366b1d139c9be", "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": "98d6f195fe672e54ef0389b4deb62e04e3e98327", "max_forks_repo_licenses": [ "BSD-3-Clause" ], "max_forks_repo_name": "caryoscelus/agda", "max_forks_repo_path": "test/Succeed/Issue2231sharp.agda", "max_issues_count": null, "max_issues_repo_head_hexsha": "98d6f195fe672e54ef0389b4deb62e04e3e98327", "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": "caryoscelus/agda", "max_issues_repo_path": "test/Succeed/Issue2231sharp.agda", "max_line_length": 72, "max_stars_count": null, "max_stars_repo_head_hexsha": "98d6f195fe672e54ef0389b4deb62e04e3e98327", "max_stars_repo_licenses": [ "BSD-3-Clause" ], "max_stars_repo_name": "caryoscelus/agda", "max_stars_repo_path": "test/Succeed/Issue2231sharp.agda", "max_stars_repo_stars_event_max_datetime": null, "max_stars_repo_stars_event_min_datetime": null, "num_tokens": 201, "size": 646 }
module _ (A : Set) where open import Common.Prelude open import Common.Reflection macro foo : Tactic foo _ = returnTC _ bar : ⊤ bar = foo
{ "alphanum_fraction": 0.6917808219, "avg_line_length": 11.2307692308, "ext": "agda", "hexsha": "fd57bf68d08f0a0801d287a037339a6201acba4b", "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/Issue1538.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/Issue1538.agda", "max_line_length": 29, "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/Issue1538.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": 45, "size": 146 }
------------------------------------------------------------------------ -- Some results related to CCS, implemented without using a fixed form -- of bisimilarity ------------------------------------------------------------------------ {-# OPTIONS --sized-types #-} open import Prelude module Bisimilarity.CCS.General {ℓ} {Name : Type ℓ} where open import Equality.Propositional open import List equality-with-J open import Prelude.Size open import Labelled-transition-system open import Labelled-transition-system.CCS Name ------------------------------------------------------------------------ -- Exercise 6.1.3 (1) from "Enhancements of the bisimulation proof -- method" by Pous and Sangiorgi 6-1-3-1-proc : Proc ∞ → Proc ∞ → ℕ → Proc ∞ 6-1-3-1-proc P P′ zero = ! P ∣ P′ 6-1-3-1-proc P P′ (suc n) = 6-1-3-1-proc P P′ n ∣ P -- Note that the form of the expression is a bit more restrictive -- than in the exercise formulation: (((! P | P′) | P)…) ∣ P. 6-1-3-1-without-τ : ∀ {a P P₀} → let μ = name a in ! P [ μ ]⟶ P₀ → ∃ λ P′ → ∃ λ n → P [ μ ]⟶ P′ × P₀ ≡ 6-1-3-1-proc P P′ n 6-1-3-1-without-τ {a} {P} (replication (par-right {Q′ = P′} tr)) = P′ , 0 , (P [ name a ]⟶⟨ tr ⟩ P′) , (! P ∣ P′ ≡⟨ refl ⟩∎ 6-1-3-1-proc P P′ 0 ∎) 6-1-3-1-without-τ {a} {P} (replication (par-left {P′ = P′} tr)) = let P″ , n , tr′ , eq = 6-1-3-1-without-τ tr in P″ , suc n , (P [ name a ]⟶⟨ tr′ ⟩ P″) , (P′ ∣ P ≡⟨ cong (_∣ _) eq ⟩ 6-1-3-1-proc P P″ n ∣ P ≡⟨ refl ⟩∎ 6-1-3-1-proc P P″ (suc n) ∎) One-step-away : {A : Type ℓ} → (A → Action) → Proc ∞ → Type ℓ One-step-away f P = ∃ λ a → ∃ λ P′ → P [ f a ]⟶ P′ cons : {A B : Type ℓ} → A → List A × B → List A × B cons x (xs , y) = x ∷ xs , y 6-1-3-1-proc′ : (P : Proc ∞) → List (Maybe (One-step-away name P)) × One-step-away id P → Proc ∞ 6-1-3-1-proc′ P ([] , (_ , P′ , _)) = ! P ∣ P′ 6-1-3-1-proc′ P (just (_ , P′ , _) ∷ Ps , o) = 6-1-3-1-proc′ P (Ps , o) ∣ P′ 6-1-3-1-proc′ P (nothing ∷ Ps , o) = 6-1-3-1-proc′ P (Ps , o) ∣ P 6-1-3-1-with-τ : ∀ {μ P P₀} → ! P [ μ ]⟶ P₀ → ∃ λ Ps → P₀ ≡ 6-1-3-1-proc′ P Ps 6-1-3-1-with-τ {μ} {P} (replication (par-right {Q′ = P′} tr)) = Ps , (! P ∣ P′ ≡⟨ refl ⟩∎ 6-1-3-1-proc′ P Ps ∎) where Ps = [] , (μ , P′ , tr) 6-1-3-1-with-τ {μ} {P} (replication (par-left {P′ = P′} tr)) = let Ps , eq = 6-1-3-1-with-τ tr Ps′ = cons nothing Ps in Ps′ , (P′ ∣ P ≡⟨ cong (_∣ _) eq ⟩ 6-1-3-1-proc′ P Ps ∣ P ≡⟨ refl ⟩∎ 6-1-3-1-proc′ P Ps′ ∎) 6-1-3-1-with-τ .{τ} {P} (replication (par-τ {P′ = P′} {Q′ = Q′} {a = a} tr₁ tr₂)) = let Ps , eq = 6-1-3-1-with-τ tr₁ Ps′ = cons (just (co a , Q′ , tr₂)) Ps in Ps′ , (P′ ∣ Q′ ≡⟨ cong (_∣ _) eq ⟩ 6-1-3-1-proc′ P Ps ∣ Q′ ≡⟨ refl ⟩∎ 6-1-3-1-proc′ P Ps′ ∎) ------------------------------------------------------------------------ -- Exercise 6.1.3 (2) from "Enhancements of the bisimulation proof -- method" by Pous and Sangiorgi -- Assumptions used to state and solve the exercise. record 6-1-3-2-assumptions ℓ′ : Type (ℓ ⊔ lsuc ℓ′) where infix 4 _∼_ infix -1 finally-∼ infixr -2 step-∼ syntax finally-∼ p q p∼q = p ∼⟨ p∼q ⟩∎ q ∎ syntax step-∼ p q∼r p∼q = p ∼⟨ p∼q ⟩ q∼r field _∼_ : Proc ∞ → Proc ∞ → Type ℓ′ step-∼ : ∀ P {Q R} → Q ∼ R → P ∼ Q → P ∼ R finally-∼ : ∀ P Q → P ∼ Q → P ∼ Q reflexive : ∀ {P} → P ∼ P symmetric : ∀ {P Q} → P ∼ Q → Q ∼ P ∣-comm : ∀ {P Q} → P ∣ Q ∼ Q ∣ P ∣-assoc : ∀ {P Q R} → P ∣ (Q ∣ R) ∼ (P ∣ Q) ∣ R _∣-cong_ : ∀ {P P′ Q Q′} → P ∼ P′ → Q ∼ Q′ → P ∣ Q ∼ P′ ∣ Q′ 6-1-2 : ∀ {P} → ! P ∣ P ∼ ! P module 6-1-3-2 {ℓ′} (assumptions : 6-1-3-2-assumptions ℓ′) where open 6-1-3-2-assumptions assumptions swap-rightmost : ∀ {P Q R} → (P ∣ Q) ∣ R ∼ (P ∣ R) ∣ Q swap-rightmost {P} {Q} {R} = (P ∣ Q) ∣ R ∼⟨ symmetric ∣-assoc ⟩ P ∣ (Q ∣ R) ∼⟨ reflexive ∣-cong ∣-comm ⟩ P ∣ (R ∣ Q) ∼⟨ ∣-assoc ⟩∎ (P ∣ R) ∣ Q ∎ 6-1-3-2 : ∀ {μ P P₀} → ! P [ μ ]⟶ P₀ → (∃ λ P′ → P [ μ ]⟶ P′ × P₀ ∼ ! P ∣ P′) ⊎ (μ ≡ τ × ∃ λ P′ → ∃ λ P″ → ∃ λ a → P [ name a ]⟶ P′ × P [ name (co a) ]⟶ P″ × P₀ ∼ (! P ∣ P′) ∣ P″) 6-1-3-2 {μ} {P} (replication (par-right {Q′ = P′} P⟶P′)) = inj₁ ( _ , (P [ μ ]⟶⟨ P⟶P′ ⟩ P′) , (! P ∣ P′ ∼⟨ reflexive ⟩∎ ! P ∣ P′ ∎)) 6-1-3-2 {μ} {P} (replication (par-left {P′ = P′} tr)) with 6-1-3-2 tr ... | inj₁ (P″ , P⟶P″ , P′∼!P∣P″) = inj₁ ( _ , (P [ μ ]⟶⟨ P⟶P″ ⟩ P″) , (P′ ∣ P ∼⟨ P′∼!P∣P″ ∣-cong reflexive ⟩ (! P ∣ P″) ∣ P ∼⟨ swap-rightmost ⟩ (! P ∣ P) ∣ P″ ∼⟨ 6-1-2 ∣-cong reflexive ⟩∎ ! P ∣ P″ ∎)) ... | inj₂ (μ≡τ , P″ , P‴ , a , P⟶P″ , P⟶P‴ , P′∼!P∣P″∣P‴) = inj₂ ( μ≡τ , _ , _ , _ , (P [ name a ]⟶⟨ P⟶P″ ⟩ P″) , (P [ name (co a) ]⟶⟨ P⟶P‴ ⟩ P‴) , (P′ ∣ P ∼⟨ P′∼!P∣P″∣P‴ ∣-cong reflexive ⟩ ((! P ∣ P″) ∣ P‴) ∣ P ∼⟨ swap-rightmost ⟩ ((! P ∣ P″) ∣ P) ∣ P‴ ∼⟨ swap-rightmost ∣-cong reflexive ⟩ ((! P ∣ P) ∣ P″) ∣ P‴ ∼⟨ (6-1-2 ∣-cong reflexive) ∣-cong reflexive ⟩∎ (! P ∣ P″) ∣ P‴ ∎)) 6-1-3-2 {P = P} (replication (par-τ {P′ = P′} {Q′ = Q′} {a = a} tr P⟶Q′)) with 6-1-3-2 tr ... | inj₁ (P″ , P⟶P″ , P′∼!P∣P″) = inj₂ ( refl , _ , _ , _ , (P [ name a ]⟶⟨ P⟶P″ ⟩ P″) , (P [ name (co a) ]⟶⟨ P⟶Q′ ⟩ Q′) , (P′ ∣ Q′ ∼⟨ P′∼!P∣P″ ∣-cong reflexive ⟩∎ (! P ∣ P″) ∣ Q′ ∎)) ... | inj₂ (() , _)
{ "alphanum_fraction": 0.390051458, "avg_line_length": 33.3142857143, "ext": "agda", "hexsha": "708f021c64923e16083e363c1c5f555bed88293c", "lang": "Agda", "max_forks_count": null, "max_forks_repo_forks_event_max_datetime": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_head_hexsha": "b936ff85411baf3401ad85ce85d5ff2e9aa0ca14", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "nad/up-to", "max_forks_repo_path": "src/Bisimilarity/CCS/General.agda", "max_issues_count": null, "max_issues_repo_head_hexsha": "b936ff85411baf3401ad85ce85d5ff2e9aa0ca14", "max_issues_repo_issues_event_max_datetime": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_licenses": [ "MIT" ], "max_issues_repo_name": "nad/up-to", "max_issues_repo_path": "src/Bisimilarity/CCS/General.agda", "max_line_length": 82, "max_stars_count": null, "max_stars_repo_head_hexsha": "b936ff85411baf3401ad85ce85d5ff2e9aa0ca14", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "nad/up-to", "max_stars_repo_path": "src/Bisimilarity/CCS/General.agda", "max_stars_repo_stars_event_max_datetime": null, "max_stars_repo_stars_event_min_datetime": null, "num_tokens": 2810, "size": 5830 }
record R : Set₁ where field _f_ : Set → Set postulate A : Set I₁ : R I₁ R.f x = A
{ "alphanum_fraction": 0.5652173913, "avg_line_length": 8.3636363636, "ext": "agda", "hexsha": "3f9946c26680b774ff7f8730ad03886e3352e53a", "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/Issue2332.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/Issue2332.agda", "max_line_length": 19, "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/Issue2332.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": 40, "size": 92 }
module A.B.M where
{ "alphanum_fraction": 0.7368421053, "avg_line_length": 9.5, "ext": "agda", "hexsha": "2e7461e02d1eeda7242ed10c4f36acf7656f25f4", "lang": "Agda", "max_forks_count": 371, "max_forks_repo_forks_event_max_datetime": "2022-03-30T19:00:30.000Z", "max_forks_repo_forks_event_min_datetime": "2015-01-03T14:04:08.000Z", "max_forks_repo_head_hexsha": "7f58030124fa99dfbf8db376659416f3ad8384de", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "cruhland/agda", "max_forks_repo_path": "test/Fail/A/B/M.agda", "max_issues_count": 4066, "max_issues_repo_head_hexsha": "7f58030124fa99dfbf8db376659416f3ad8384de", "max_issues_repo_issues_event_max_datetime": "2022-03-31T21:14:49.000Z", "max_issues_repo_issues_event_min_datetime": "2015-01-10T11:24:51.000Z", "max_issues_repo_licenses": [ "MIT" ], "max_issues_repo_name": "cruhland/agda", "max_issues_repo_path": "test/Fail/A/B/M.agda", "max_line_length": 18, "max_stars_count": 1989, "max_stars_repo_head_hexsha": "7f58030124fa99dfbf8db376659416f3ad8384de", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "cruhland/agda", "max_stars_repo_path": "test/Fail/A/B/M.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": 6, "size": 19 }
module SetClash where postulate x : Set y : Set1 y = x
{ "alphanum_fraction": 0.6842105263, "avg_line_length": 8.1428571429, "ext": "agda", "hexsha": "d608e4aef87b9c4a99c26122eec3e853f927e470", "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": "dc333ed142584cf52cc885644eed34b356967d8b", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "andrejtokarcik/agda-semantics", "max_forks_repo_path": "tests/covered/SetClash.agda", "max_issues_count": null, "max_issues_repo_head_hexsha": "dc333ed142584cf52cc885644eed34b356967d8b", "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": "andrejtokarcik/agda-semantics", "max_issues_repo_path": "tests/covered/SetClash.agda", "max_line_length": 21, "max_stars_count": 3, "max_stars_repo_head_hexsha": "dc333ed142584cf52cc885644eed34b356967d8b", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "andrejtokarcik/agda-semantics", "max_stars_repo_path": "tests/covered/SetClash.agda", "max_stars_repo_stars_event_max_datetime": "2018-12-06T17:24:25.000Z", "max_stars_repo_stars_event_min_datetime": "2015-08-10T15:33:56.000Z", "num_tokens": 21, "size": 57 }
------------------------------------------------------------------------------ -- Equivalent approaches for implement the inductive predicate N ------------------------------------------------------------------------------ {-# OPTIONS --exact-split #-} {-# OPTIONS --no-sized-types #-} {-# OPTIONS --no-universe-polymorphism #-} {-# OPTIONS --without-K #-} module FOTC.EquivalenceInductivePredicateN where open import FOTC.Base ------------------------------------------------------------------------------ -- Using succ : D instead of succ₁ : D → D. module Constant where module LFP where NatF : (D → Set) → D → Set NatF A n = n ≡ zero ∨ (∃[ n' ] n ≡ succ · n' ∧ A n') postulate N : D → Set N-in-ho : ∀ {n} → NatF N n → N n N-ind'-ho : (A : D → Set) → (∀ {n} → NatF A n → A n) → ∀ {n} → N n → A n N-in : ∀ {n} → n ≡ zero ∨ (∃[ n' ] n ≡ succ · n' ∧ N n') → N n N-in = N-in-ho N-ind' : (A : D → Set) → (∀ {n} → n ≡ zero ∨ (∃[ n' ] n ≡ succ · n' ∧ A n') → A n) → ∀ {n} → N n → A n N-ind' = N-ind'-ho -------------------------------------------------------------------------- -- The data constructors of N using LFP. nzero : N zero nzero = N-in (inj₁ refl) nsucc : ∀ {n} → N n → N (succ · n) nsucc Nn = N-in (inj₂ (_ , refl , Nn)) -------------------------------------------------------------------------- -- The induction principle of N using LFP. N-ind : (A : D → Set) → A zero → (∀ {n} → A n → A (succ · n)) → ∀ {n} → N n → A n N-ind A A0 h = N-ind' A h' where h' : ∀ {m} → m ≡ zero ∨ (∃[ m' ] m ≡ succ · m' ∧ A m') → A m h' (inj₁ m≡0) = subst A (sym m≡0) A0 h' (inj₂ (m' , prf , Am')) = subst A (sym prf) (h Am') ---------------------------------------------------------------------------- module Data where data N : D → Set where nzero : N zero nsucc : ∀ {n} → N n → N (succ · n) N-ind : (A : D → Set) → A zero → (∀ {n} → A n → A (succ · n)) → ∀ {n} → N n → A n N-ind A A0 h nzero = A0 N-ind A A0 h (nsucc Nn) = h (N-ind A A0 h Nn) -------------------------------------------------------------------------- -- The introduction rule of N using data. N-in : ∀ {n} → n ≡ zero ∨ (∃[ n' ] n ≡ succ · n' ∧ N n') → N n N-in {n} h = case prf₁ prf₂ h where prf₁ : n ≡ zero → N n prf₁ n≡0 = subst N (sym n≡0) nzero prf₂ : ∃[ n' ] n ≡ succ · n' ∧ N n' → N n prf₂ (n' , prf , Nn') = subst N (sym prf) (nsucc Nn') -------------------------------------------------------------------------- -- The induction principle for N using data. N-ind' : (A : D → Set) → (∀ {n} → n ≡ zero ∨ (∃[ n' ] n ≡ succ · n' ∧ A n') → A n) → ∀ {n} → N n → A n N-ind' A h = N-ind A h₁ h₂ where h₁ : A zero h₁ = h (inj₁ refl) h₂ : ∀ {m} → A m → A (succ · m) h₂ {m} Am = h (inj₂ (m , refl , Am)) ------------------------------------------------------------------------------ -- Using succ₁ : D → D instead of succ : D. module UnaryFunction where module LFP where NatF : (D → Set) → D → Set NatF A n = n ≡ zero ∨ (∃[ n' ] n ≡ succ₁ n' ∧ A n') postulate N : D → Set N-in-ho : ∀ {n} → NatF N n → N n N-ind'-ho : (A : D → Set) → (∀ {n} → NatF A n → A n) → ∀ {n} → N n → A n N-in : ∀ {n} → n ≡ zero ∨ (∃[ n' ] n ≡ succ₁ n' ∧ N n') → N n N-in = N-in-ho N-ind' : (A : D → Set) → (∀ {n} → n ≡ zero ∨ (∃[ n' ] n ≡ succ₁ n' ∧ A n') → A n) → ∀ {n} → N n → A n N-ind' = N-ind'-ho -------------------------------------------------------------------------- -- The data constructors of N using LFP. nzero : N zero nzero = N-in (inj₁ refl) nsucc : ∀ {n} → N n → N (succ₁ n) nsucc Nn = N-in (inj₂ (_ , refl , Nn)) -------------------------------------------------------------------------- -- The induction principle of N using LFP. N-ind : (A : D → Set) → A zero → (∀ {n} → A n → A (succ₁ n)) → ∀ {n} → N n → A n N-ind A A0 h = N-ind' A h' where h' : ∀ {m} → m ≡ zero ∨ (∃[ m' ] m ≡ succ₁ m' ∧ A m') → A m h' (inj₁ m≡0) = subst A (sym m≡0) A0 h' (inj₂ (m' , prf , Am')) = subst A (sym prf) (h Am') ---------------------------------------------------------------------------- module Data where data N : D → Set where nzero : N zero nsucc : ∀ {n} → N n → N (succ₁ n) N-ind : (A : D → Set) → A zero → (∀ {n} → A n → A (succ₁ n)) → ∀ {n} → N n → A n N-ind A A0 h nzero = A0 N-ind A A0 h (nsucc Nn) = h (N-ind A A0 h Nn) -------------------------------------------------------------------------- -- The introduction rule of N using data. N-in : ∀ {n} → n ≡ zero ∨ (∃[ n' ] n ≡ succ₁ n' ∧ N n') → N n N-in {n} h = case prf₁ prf₂ h where prf₁ : n ≡ zero → N n prf₁ n≡0 = subst N (sym n≡0) nzero prf₂ : ∃[ n' ] n ≡ succ₁ n' ∧ N n' → N n prf₂ (n' , prf , Nn') = subst N (sym prf) (nsucc Nn') -------------------------------------------------------------------------- -- The induction principle for N using data. N-ind' : (A : D → Set) → (∀ {n} → n ≡ zero ∨ (∃[ n' ] n ≡ succ₁ n' ∧ A n') → A n) → ∀ {n} → N n → A n N-ind' A h = N-ind A h₁ h₂ where h₁ : A zero h₁ = h (inj₁ refl) h₂ : ∀ {m} → A m → A (succ₁ m) h₂ {m} Am = h (inj₂ (m , refl , Am)) module EsikProposition2Dot1 where postulate N : D → Set N-ind' : (A : D → Set) → (∀ {n} → n ≡ zero ∨ (∃[ n' ] n ≡ succ₁ n' ∧ A n') → A n) → ∀ {n} → N n → A n
{ "alphanum_fraction": 0.3367122825, "avg_line_length": 31.4840425532, "ext": "agda", "hexsha": "4c1e567ae37cde8899edf047cb073b495b442cba", "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/FOTC/EquivalenceInductivePredicateN.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/FOTC/EquivalenceInductivePredicateN.agda", "max_line_length": 78, "max_stars_count": 11, "max_stars_repo_head_hexsha": "2fc9f2b81052a2e0822669f02036c5750371b72d", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "asr/fotc", "max_stars_repo_path": "notes/thesis/report/FOTC/EquivalenceInductivePredicateN.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": 2009, "size": 5919 }
postulate F : Set → Set {-# POLARITY F * #-} data D : Set where d : F D → D
{ "alphanum_fraction": 0.512195122, "avg_line_length": 10.25, "ext": "agda", "hexsha": "d7ae3d0617662e71c154ef9feff88cbcc9f72c70", "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/Polarity-pragma-and-mixed-polarity.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/Polarity-pragma-and-mixed-polarity.agda", "max_line_length": 20, "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/Polarity-pragma-and-mixed-polarity.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": 31, "size": 82 }
module Where where -- all these examples should not termination check f : forall {A : Set} -> A f {A} = g where g : A g = f f1 : forall {A : Set} -> A -> A f1 {A} a = g a where g : A -> A g a = f1 a f2 : forall {A : Set} -> A -> A f2 {A} a = g a where g : A -> A g = f2
{ "alphanum_fraction": 0.4341317365, "avg_line_length": 13.9166666667, "ext": "agda", "hexsha": "804b9e16dd75eb7f6ba7d0c0d943b6ff8bcede01", "lang": "Agda", "max_forks_count": null, "max_forks_repo_forks_event_max_datetime": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_head_hexsha": "70c8a575c46f6a568c7518150a1a64fcd03aa437", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "masondesu/agda", "max_forks_repo_path": "examples/Termination/Where.agda", "max_issues_count": null, "max_issues_repo_head_hexsha": "70c8a575c46f6a568c7518150a1a64fcd03aa437", "max_issues_repo_issues_event_max_datetime": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_licenses": [ "MIT" ], "max_issues_repo_name": "masondesu/agda", "max_issues_repo_path": "examples/Termination/Where.agda", "max_line_length": 50, "max_stars_count": 1, "max_stars_repo_head_hexsha": "aa10ae6a29dc79964fe9dec2de07b9df28b61ed5", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "asr/agda-kanso", "max_stars_repo_path": "examples/Termination/Where.agda", "max_stars_repo_stars_event_max_datetime": "2019-11-27T04:41:05.000Z", "max_stars_repo_stars_event_min_datetime": "2019-11-27T04:41:05.000Z", "num_tokens": 120, "size": 334 }
module Cats.Util.Function where open import Relation.Binary using (Rel ; IsEquivalence ; _Preserves₂_⟶_⟶_) open import Relation.Binary.PropositionalEquality as ≡ open import Function as Fun public using (id ; _on_) open import Relation.Binary.Construct.On public renaming (isEquivalence to on-isEquivalence) infixr 9 _∘_ _∘_ : ∀ {a b c} {A : Set a} {B : Set b} {C : Set c} → (B → C) → (A → B) → A → C f ∘ g = f Fun.∘ g
{ "alphanum_fraction": 0.6885245902, "avg_line_length": 26.6875, "ext": "agda", "hexsha": "1dc00c0e89b3d9eb33593835750b2a2981210699", "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/Util/Function.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/Util/Function.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/Util/Function.agda", "max_stars_repo_stars_event_max_datetime": null, "max_stars_repo_stars_event_min_datetime": null, "num_tokens": 143, "size": 427 }
{- Name: Bowornmet (Ben) Hudson -- define the complexity language from the paper -} open import Preliminaries open import Preorder-withmax module Comp-lang where -- define the complexity language from the paper -- we want to focus on arrow, cross, and nat types -- do I need unit types? data CTp : Set where unit : CTp nat : CTp _->c_ : CTp → CTp → CTp _×c_ : CTp → CTp → CTp C : CTp -- represent a context as a list of types Ctx = List CTp -- de Bruijn indices (for free variables) data _∈_ : CTp → Ctx → Set where i0 : ∀ {Γ τ} → τ ∈ (τ :: Γ) iS : ∀ {Γ τ τ1} → τ ∈ Γ → τ ∈ (τ1 :: Γ) data _|-_ : Ctx → CTp → Set where unit : ∀ {Γ} → Γ |- unit 0C : ∀ {Γ} → Γ |- C 1C : ∀ {Γ} → Γ |- C plusC : ∀ {Γ} → Γ |- C → Γ |- C → Γ |- C var : ∀ {Γ τ} → τ ∈ Γ → Γ |- τ z : ∀ {Γ} → Γ |- nat suc : ∀ {Γ} → (e : Γ |- nat) → Γ |- nat rec : ∀ {Γ τ} → Γ |- nat → Γ |- τ → (nat :: (τ :: Γ)) |- τ → Γ |- τ lam : ∀ {Γ τ ρ} → (ρ :: Γ) |- τ → Γ |- (ρ ->c τ) app : ∀ {Γ τ1 τ2} → Γ |- (τ2 ->c τ1) → Γ |- τ2 → Γ |- τ1 prod : ∀ {Γ τ1 τ2} → Γ |- τ1 → Γ |- τ2 → Γ |- (τ1 ×c τ2) l-proj : ∀ {Γ τ1 τ2} → Γ |- (τ1 ×c τ2) → Γ |- τ1 r-proj : ∀ {Γ τ1 τ2} → Γ |- (τ1 ×c τ2) → Γ |- τ2 _+C_ : ∀ {Γ τ} → Γ |- C → Γ |- (C ×c τ)→ Γ |- (C ×c τ) c +C e = prod (plusC c (l-proj e)) (r-proj e) ------weakening and substitution lemmas -- renaming function rctx : Ctx → Ctx → Set rctx Γ Γ' = ∀ {τ} → τ ∈ Γ' → τ ∈ Γ -- re: transferring variables in contexts lem1 : ∀ {Γ Γ' τ} → rctx Γ Γ' → rctx (τ :: Γ) (τ :: Γ') lem1 d i0 = i0 lem1 d (iS x) = iS (d x) -- renaming lemma ren : ∀ {Γ Γ' τ} → Γ' |- τ → rctx Γ Γ' → Γ |- τ ren unit d = unit ren 0C d = 0C ren 1C d = 1C ren (plusC e1 e2) d = plusC (ren e1 d) (ren e2 d) ren (var x) d = var (d x) ren z d = z ren (suc e) d = suc (ren e d) ren (rec e e0 e1) d = rec (ren e d) (ren e0 d) (ren e1 (lem1 (lem1 d))) ren (lam e) d = lam (ren e (lem1 d)) ren (app e1 e2) d = app (ren e1 d) (ren e2 d) ren (prod e1 e2) d = prod (ren e1 d) (ren e2 d) ren (l-proj e) d = l-proj (ren e d) ren (r-proj e) d = r-proj (ren e d) -- substitution sctx : Ctx → Ctx → Set sctx Γ Γ' = ∀ {τ} → τ ∈ Γ' → Γ |- τ -- weakening a context wkn : ∀ {Γ τ1 τ2} → Γ |- τ2 → (τ1 :: Γ) |- τ2 wkn e = ren e iS -- weakening also works with substitution wkn-s : ∀ {Γ τ1 Γ'} → sctx Γ Γ' → sctx (τ1 :: Γ) Γ' wkn-s d = λ f → wkn (d f) wkn-r : ∀ {Γ τ1 Γ'} → rctx Γ Γ' → rctx (τ1 :: Γ) Γ' wkn-r d = λ x → iS (d x) -- lem2 (need a lemma for subst like we did for renaming) lem2 : ∀ {Γ Γ' τ} → sctx Γ Γ' → sctx (τ :: Γ) (τ :: Γ') lem2 d i0 = var i0 lem2 d (iS i) = wkn (d i) -- another substitution lemma lem3 : ∀ {Γ τ} → Γ |- τ → sctx Γ (τ :: Γ) lem3 e i0 = e lem3 e (iS i) = var i lem3' : ∀ {Γ Γ' τ} → sctx Γ Γ' → Γ |- τ → sctx Γ (τ :: Γ') lem3' Θ e i0 = e lem3' Θ e (iS i) = Θ i -- one final lemma needed for the last stepping rule. Thank you Professor Licata! lem4 : ∀ {Γ τ1 τ2} → Γ |- τ1 → Γ |- τ2 → sctx Γ (τ1 :: (τ2 :: Γ)) lem4 e1 e2 i0 = e1 lem4 e1 e2 (iS i0) = e2 lem4 e1 e2 (iS (iS i)) = var i lem4' : ∀ {Γ Γ' τ1 τ2} → sctx Γ Γ' → Γ |- τ1 → Γ |- τ2 → sctx Γ (τ1 :: (τ2 :: Γ')) lem4' Θ a b i0 = a lem4' Θ a b (iS i0) = b lem4' Θ a b (iS (iS i)) = Θ i -- the 'real' substitution lemma (if (x : τ') :: Γ |- (e : τ) and Γ |- (e : τ') , then Γ |- e[x -> e'] : τ) subst : ∀ {Γ Γ' τ} → sctx Γ Γ' → Γ' |- τ → Γ |- τ subst d unit = unit subst d 0C = 0C subst d 1C = 1C subst d (plusC e1 e2) = plusC (subst d e1) (subst d e2) subst d (var x) = d x subst d z = z subst d (suc x) = suc (subst d x) subst d (rec e e0 e1) = rec (subst d e) (subst d e0) (subst (lem2 (lem2 d)) e1) subst d (lam e) = lam (subst (lem2 d) e) subst d (app e1 e2) = app (subst d e1) (subst d e2) subst d (prod e1 e2) = prod (subst d e1) (subst d e2) subst d (l-proj e) = l-proj (subst d e) subst d (r-proj e) = r-proj (subst d e) postulate subst-compose : ∀ {Γ Γ' τ τ1} (Θ : sctx Γ Γ') (v : Γ |- τ) (e : (τ :: Γ' |- τ1) ) → subst (lem3 v) (subst (lem2 Θ) e) == subst (lem3' Θ v) e postulate subst-compose2 : ∀ {Γ Γ' τ} (Θ : sctx Γ Γ') (n : Γ |- nat) (e1 : Γ' |- τ) (e2 : (nat :: (τ :: Γ')) |- τ) → subst (lem4 n (rec n (subst Θ e1) (subst (lem2 (lem2 Θ)) e2))) (subst (lem2 (lem2 Θ)) e2) == subst (lem4' Θ n (rec n (subst Θ e1) (subst (lem2 (lem2 Θ)) e2))) e2 postulate subst-compose3 : ∀ {Γ Γ' τ τ1 τ2} (Θ : sctx Γ Γ') (e1 : (τ1 :: (τ2 :: Γ')) |- τ) (v1 : Γ' |- τ1) (v2 : Γ' |- τ2) → subst Θ (subst (lem4 v1 v2) e1) == subst (lem4' Θ (subst Θ v1) (subst Θ v2)) e1 postulate subst-compose4 : ∀ {Γ Γ' τ} (Θ : sctx Γ Γ') (v' : Γ |- nat) (r : Γ |- τ) (e2 : (nat :: (τ :: Γ')) |- τ) → subst (lem4 v' r) (subst (lem2 (lem2 Θ)) e2) == subst (lem4' Θ v' r) e2 ------- -- define 'stepping' as a datatype (fig. 1 of proof) data _≤s_ : ∀ {Γ T} → Γ |- T → Γ |- T → Set where refl-s : ∀ {Γ T} → {e : Γ |- T} → e ≤s e trans-s : ∀ {Γ T} → {e e' e'' : Γ |- T} → e ≤s e' → e' ≤s e'' → e ≤s e'' plus-s : ∀ {Γ} → {e1 e2 n1 n2 : Γ |- C} → e1 ≤s n1 → e2 ≤s n2 → (plusC e1 e2) ≤s (plusC n1 n2) cong-refl : ∀ {Γ τ} {e e' : Γ |- τ} → e == e' → e ≤s e' +-unit-l : ∀ {Γ} {e : Γ |- C} → (plusC 0C e) ≤s e +-unit-l' : ∀ {Γ} {e : Γ |- C} → e ≤s (plusC 0C e) +-unit-r : ∀ {Γ} {e : Γ |- C} → (plusC e 0C) ≤s e +-unit-r' : ∀ {Γ} {e : Γ |- C} → e ≤s (plusC e 0C) +-assoc : ∀ {Γ} {e1 e2 e3 : Γ |- C} → (plusC e1 (plusC e2 e3)) ≤s (plusC (plusC e1 e2) e3) +-assoc' : ∀ {Γ} {e1 e2 e3 : Γ |- C} → (plusC e1 (plusC e2 e3)) ≤s (plusC (plusC e1 e2) e3) refl-+ : ∀ {Γ} {e0 e1 : Γ |- C} → (plusC e0 e1) ≤s (plusC e1 e0) cong-+ : ∀ {Γ} {e0 e1 e0' e1' : Γ |- C} → e0 ≤s e0' → e1 ≤s e1' → (plusC e0 e1) ≤s (plusC e0' e1') cong-lproj : ∀ {Γ τ τ'} {e e' : Γ |- (τ ×c τ')} → e ≤s e' → (l-proj e) ≤s (l-proj e') cong-rproj : ∀ {Γ τ τ'} {e e' : Γ |- (τ ×c τ')} → e ≤s e' → (r-proj e) ≤s (r-proj e') cong-app : ∀ {Γ τ τ'} {e e' : Γ |- (τ ->c τ')} {e1 : Γ |- τ} → e ≤s e' → (app e e1) ≤s (app e' e1) cong-rec : ∀ {Γ τ} {e e' : Γ |- nat} {e0 : Γ |- τ} {e1 : (nat :: (τ :: Γ)) |- τ} → e ≤s e' → rec e e0 e1 ≤s rec e' e0 e1 lam-s : ∀ {Γ T T'} → {e : (T :: Γ) |- T'} → {e2 : Γ |- T} → subst (lem3 e2) e ≤s app (lam e) e2 l-proj-s : ∀ {Γ T1 T2} → {e1 : Γ |- T1} {e2 : Γ |- T2} → e1 ≤s (l-proj (prod e1 e2)) r-proj-s : ∀ {Γ T1 T2} → {e1 : Γ |- T1} → {e2 : Γ |- T2} → e2 ≤s (r-proj (prod e1 e2)) rec-steps-s : ∀ {Γ T} → {e : Γ |- nat} → {e0 : Γ |- T} → {e1 : (nat :: (T :: Γ)) |- T} → subst (lem4 e (rec e e0 e1)) e1 ≤s (rec (suc e) e0 e1) rec-steps-z : ∀ {Γ T} → {e0 : Γ |- T} → {e1 : (nat :: (T :: Γ)) |- T} → e0 ≤s (rec z e0 e1) _trans_ : ∀ {Γ T} → {e e' e'' : Γ |- T} → e ≤s e' → e' ≤s e'' → e ≤s e'' _trans_ = trans-s infixr 10 _trans_ ------- -- interpret complexity types as preorders [_]t : CTp → PREORDER [ unit ]t = unit-p [ nat ]t = Nat , nat-p [ A ->c B ]t = [ A ]t ->p [ B ]t [ A ×c B ]t = [ A ]t ×p [ B ]t [ C ]t = Nat , nat-p -- interpret contexts as preorders [_]c : Ctx → PREORDER [ [] ]c = unit-p [ τ :: Γ ]c = [ τ ]t ×p [ Γ ]c
{ "alphanum_fraction": 0.4200251889, "avg_line_length": 31.8875502008, "ext": "agda", "hexsha": "9a8ffe895ae376fb2cdc98dabb02df73c2b8cb70", "lang": "Agda", "max_forks_count": null, "max_forks_repo_forks_event_max_datetime": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_head_hexsha": "2404a6ef2688f879bda89860bb22f77664ad813e", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "benhuds/Agda", "max_forks_repo_path": "complexity-drafts/Comp-lang.agda", "max_issues_count": 1, "max_issues_repo_head_hexsha": "2404a6ef2688f879bda89860bb22f77664ad813e", "max_issues_repo_issues_event_max_datetime": "2020-05-12T00:32:45.000Z", "max_issues_repo_issues_event_min_datetime": "2020-03-23T08:39:04.000Z", "max_issues_repo_licenses": [ "MIT" ], "max_issues_repo_name": "benhuds/Agda", "max_issues_repo_path": "complexity-drafts/Comp-lang.agda", "max_line_length": 116, "max_stars_count": 2, "max_stars_repo_head_hexsha": "2404a6ef2688f879bda89860bb22f77664ad813e", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "benhuds/Agda", "max_stars_repo_path": "complexity-drafts/Comp-lang.agda", "max_stars_repo_stars_event_max_datetime": "2019-08-08T12:27:18.000Z", "max_stars_repo_stars_event_min_datetime": "2016-04-26T20:22:22.000Z", "num_tokens": 3538, "size": 7940 }
{-# OPTIONS --without-K --rewriting #-} open import HoTT open import cohomology.Theory open import cw.CW module cw.cohomology.TipAndAugment {i} (OT : OrdinaryTheory i) (⊙skel : ⊙Skeleton {i} 0) where open OrdinaryTheory OT open import homotopy.DisjointlyPointedSet open import cohomology.DisjointlyPointedSet OT module _ (m : ℤ) where CX₀ : Group i CX₀ = C m (⊙cw-head ⊙skel) CX₀-is-abelian : is-abelian CX₀ CX₀-is-abelian = C-is-abelian m (⊙cw-head ⊙skel) C2×CX₀ : Group i C2×CX₀ = C2 m ×ᴳ CX₀ abstract C2×CX₀-is-abelian : is-abelian C2×CX₀ C2×CX₀-is-abelian = ×ᴳ-is-abelian (C2 m) CX₀ (C2-is-abelian m) CX₀-is-abelian C2×CX₀-abgroup : AbGroup i C2×CX₀-abgroup = C2×CX₀ , C2×CX₀-is-abelian CX₀-β : ⊙has-cells-with-choice 0 ⊙skel i → CX₀ ≃ᴳ Πᴳ (MinusPoint (⊙cw-head ⊙skel)) (λ _ → C2 m) CX₀-β ac = C-set m (⊙cw-head ⊙skel) (snd (⊙Skeleton.skel ⊙skel)) (⊙Skeleton.pt-dec ⊙skel) ac abstract CX₀-≠-is-trivial : ∀ {m} (m≠0 : m ≠ 0) → ⊙has-cells-with-choice 0 ⊙skel i → is-trivialᴳ (CX₀ m) CX₀-≠-is-trivial {m} m≠0 ac = iso-preserves'-trivial (CX₀-β m ac) $ Πᴳ-is-trivial (MinusPoint (⊙cw-head ⊙skel)) (λ _ → C2 m) (λ _ → C-dimension m≠0) cw-coε : C2 0 →ᴳ C2×CX₀ 0 cw-coε = ×ᴳ-inl {G = C2 0} {H = CX₀ 0}
{ "alphanum_fraction": 0.6358653093, "avg_line_length": 27.170212766, "ext": "agda", "hexsha": "3f7b5752591469cff8e4fbffeb045a91f9c78519", "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/TipAndAugment.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/TipAndAugment.agda", "max_line_length": 94, "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/TipAndAugment.agda", "max_stars_repo_stars_event_max_datetime": null, "max_stars_repo_stars_event_min_datetime": null, "num_tokens": 593, "size": 1277 }
module Class.Monad.State where open import Class.Monad open import Data.Product open import Data.Unit.Polymorphic open import Function open import Level private variable a : Level A : Set a record MonadState {a} (M : Set a → Set a) {{_ : Monad M}} (S : Set a) : Set (suc a) where field get : M S put : S → M ⊤ modify : (S → S) → M ⊤ modify f = do s <- get put (f s) gets : (S → A) → M A gets f = do s <- get return (f s) state : (S → A × S) → M A state f = do s ← get let (a , s') = f s put s' return a open MonadState {{...}} public module _ {M : Set a → Set a} {{_ : Monad M}} {S S' : Set a} {{_ : MonadState M (S × S')}} where MonadStateProj₁ : MonadState M S MonadStateProj₁ = record { get = get >>= return ∘ proj₁ ; put = λ x → modify λ { (s , s') → (x , s') } } MonadStateProj₂ : MonadState M S' MonadStateProj₂ = record { get = get >>= return ∘ proj₂ ; put = λ x → modify λ { (s , s') → (s , x) } }
{ "alphanum_fraction": 0.5418326693, "avg_line_length": 20.4897959184, "ext": "agda", "hexsha": "d79537ff0f2dd09f7e96658433f609f55f0efa9d", "lang": "Agda", "max_forks_count": 2, "max_forks_repo_forks_event_max_datetime": "2021-10-20T10:46:20.000Z", "max_forks_repo_forks_event_min_datetime": "2019-06-27T23:12:48.000Z", "max_forks_repo_head_hexsha": "62fa6f36e4555360d94041113749bbb6d291691c", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "WhatisRT/meta-cedille", "max_forks_repo_path": "stdlib-exts/Class/Monad/State.agda", "max_issues_count": 10, "max_issues_repo_head_hexsha": "62fa6f36e4555360d94041113749bbb6d291691c", "max_issues_repo_issues_event_max_datetime": "2020-04-25T15:29:17.000Z", "max_issues_repo_issues_event_min_datetime": "2019-06-13T17:44:43.000Z", "max_issues_repo_licenses": [ "MIT" ], "max_issues_repo_name": "WhatisRT/meta-cedille", "max_issues_repo_path": "stdlib-exts/Class/Monad/State.agda", "max_line_length": 95, "max_stars_count": 35, "max_stars_repo_head_hexsha": "62fa6f36e4555360d94041113749bbb6d291691c", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "WhatisRT/meta-cedille", "max_stars_repo_path": "stdlib-exts/Class/Monad/State.agda", "max_stars_repo_stars_event_max_datetime": "2021-10-12T22:59:10.000Z", "max_stars_repo_stars_event_min_datetime": "2019-06-13T07:44:50.000Z", "num_tokens": 360, "size": 1004 }
postulate M : Set → Set _>>=_ : ∀ {A B} → M A → (A → M B) → M B _>>_ : ∀ {A B} → M A → M B → M B _<|>_ : ∀ {A} → M A → M A → M A infixr 4 _>>=_ _>>_ infixr -100 _<|>_ expr : ∀ {A} → (A → M A) → (A → M A) expr f a = do x ← {!f a!} y ← {!f x <|> f a!} {!f x <|> f y!} {!f x <|> f y!}
{ "alphanum_fraction": 0.3410596026, "avg_line_length": 17.7647058824, "ext": "agda", "hexsha": "1372660b57ba6b890bd1d54780c03383fc46f233", "lang": "Agda", "max_forks_count": 371, "max_forks_repo_forks_event_max_datetime": "2022-03-30T19:00:30.000Z", "max_forks_repo_forks_event_min_datetime": "2015-01-03T14:04:08.000Z", "max_forks_repo_head_hexsha": "7f58030124fa99dfbf8db376659416f3ad8384de", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "cruhland/agda", "max_forks_repo_path": "test/interaction/Issue3152.agda", "max_issues_count": 4066, "max_issues_repo_head_hexsha": "7f58030124fa99dfbf8db376659416f3ad8384de", "max_issues_repo_issues_event_max_datetime": "2022-03-31T21:14:49.000Z", "max_issues_repo_issues_event_min_datetime": "2015-01-10T11:24:51.000Z", "max_issues_repo_licenses": [ "MIT" ], "max_issues_repo_name": "cruhland/agda", "max_issues_repo_path": "test/interaction/Issue3152.agda", "max_line_length": 41, "max_stars_count": 1989, "max_stars_repo_head_hexsha": "7f58030124fa99dfbf8db376659416f3ad8384de", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "cruhland/agda", "max_stars_repo_path": "test/interaction/Issue3152.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": 163, "size": 302 }
{-# OPTIONS --no-copatterns #-} -- Andreas, 2015-08-26: copatterns are on by default now. -- Andreas, James, 2011-11-24 -- trigger error message 'NeedOptionCopatterns' module NeedOptionCopatterns where record Bla : Set2 where field bla : Set1 open Bla f : Bla bla f = Set -- should request option --copatterns
{ "alphanum_fraction": 0.7147335423, "avg_line_length": 19.9375, "ext": "agda", "hexsha": "53985899ed087e14e733d0dd40411e5978ac6814", "lang": "Agda", "max_forks_count": 371, "max_forks_repo_forks_event_max_datetime": "2022-03-30T19:00:30.000Z", "max_forks_repo_forks_event_min_datetime": "2015-01-03T14:04:08.000Z", "max_forks_repo_head_hexsha": "7f58030124fa99dfbf8db376659416f3ad8384de", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "cruhland/agda", "max_forks_repo_path": "test/Fail/NeedOptionCopatterns.agda", "max_issues_count": 4066, "max_issues_repo_head_hexsha": "7f58030124fa99dfbf8db376659416f3ad8384de", "max_issues_repo_issues_event_max_datetime": "2022-03-31T21:14:49.000Z", "max_issues_repo_issues_event_min_datetime": "2015-01-10T11:24:51.000Z", "max_issues_repo_licenses": [ "MIT" ], "max_issues_repo_name": "cruhland/agda", "max_issues_repo_path": "test/Fail/NeedOptionCopatterns.agda", "max_line_length": 57, "max_stars_count": 1989, "max_stars_repo_head_hexsha": "7f58030124fa99dfbf8db376659416f3ad8384de", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "cruhland/agda", "max_stars_repo_path": "test/Fail/NeedOptionCopatterns.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": 101, "size": 319 }
------------------------------------------------------------------------ -- The Agda standard library -- -- Definitions of algebraic structures like monoids and rings -- (packed in records together with sets, operations, etc.) ------------------------------------------------------------------------ {-# OPTIONS --without-K --safe #-} module Algebra where open import Algebra.Core public open import Algebra.Definitions public open import Algebra.Structures public open import Algebra.Bundles public
{ "alphanum_fraction": 0.5526838966, "avg_line_length": 31.4375, "ext": "agda", "hexsha": "5d806b52448f550ca6d44380e1795202c84d8ab9", "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/Algebra.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/Algebra.agda", "max_line_length": 72, "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/Algebra.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": 77, "size": 503 }
variable ℓ : _ A : Set ℓ
{ "alphanum_fraction": 0.5172413793, "avg_line_length": 7.25, "ext": "agda", "hexsha": "de253d6646d42232cc2d19374684cc403862e37b", "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": "cc026a6a97a3e517bb94bafa9d49233b067c7559", "max_forks_repo_licenses": [ "BSD-2-Clause" ], "max_forks_repo_name": "cagix/agda", "max_forks_repo_path": "test/Succeed/Issue5565.agda", "max_issues_count": 4066, "max_issues_repo_head_hexsha": "cc026a6a97a3e517bb94bafa9d49233b067c7559", "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-2-Clause" ], "max_issues_repo_name": "cagix/agda", "max_issues_repo_path": "test/Succeed/Issue5565.agda", "max_line_length": 11, "max_stars_count": 1989, "max_stars_repo_head_hexsha": "cc026a6a97a3e517bb94bafa9d49233b067c7559", "max_stars_repo_licenses": [ "BSD-2-Clause" ], "max_stars_repo_name": "cagix/agda", "max_stars_repo_path": "test/Succeed/Issue5565.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": 14, "size": 29 }
{-# OPTIONS --cubical --no-import-sorts --safe #-} module Cubical.ZCohomology.Groups.Sn where open import Cubical.ZCohomology.Base open import Cubical.ZCohomology.Properties open import Cubical.ZCohomology.MayerVietorisUnreduced open import Cubical.ZCohomology.Groups.Unit open import Cubical.ZCohomology.Groups.Connected open import Cubical.ZCohomology.KcompPrelims open import Cubical.ZCohomology.Groups.Prelims open import Cubical.Foundations.HLevels open import Cubical.Foundations.Equiv open import Cubical.Foundations.Function open import Cubical.Foundations.Prelude open import Cubical.Foundations.Structure open import Cubical.Foundations.Pointed open import Cubical.Foundations.Isomorphism open import Cubical.Foundations.GroupoidLaws open import Cubical.HITs.Pushout open import Cubical.HITs.Sn open import Cubical.HITs.S1 open import Cubical.HITs.Susp open import Cubical.HITs.SetTruncation renaming (rec to sRec ; elim to sElim ; elim2 to sElim2) open import Cubical.HITs.PropositionalTruncation renaming (rec to pRec ; elim to pElim ; elim2 to pElim2 ; ∥_∥ to ∥_∥₁ ; ∣_∣ to ∣_∣₁) hiding (map) open import Cubical.Data.Bool open import Cubical.Data.Sigma open import Cubical.Data.Int renaming (_+_ to _+ℤ_; +-comm to +ℤ-comm ; +-assoc to +ℤ-assoc) open import Cubical.Data.Nat open import Cubical.HITs.Truncation renaming (elim to trElim ; map to trMap ; rec to trRec) open import Cubical.Data.Unit open import Cubical.Algebra.Group infixr 31 _□_ _□_ : _ _□_ = compGroupIso open GroupEquiv open vSES open GroupIso open GroupHom open BijectionIso Sn-connected : (n : ℕ) (x : typ (S₊∙ (suc n))) → ∥ pt (S₊∙ (suc n)) ≡ x ∥₁ Sn-connected zero = toPropElim (λ _ → propTruncIsProp) ∣ refl ∣₁ Sn-connected (suc zero) = suspToPropElim base (λ _ → propTruncIsProp) ∣ refl ∣₁ Sn-connected (suc (suc n)) = suspToPropElim north (λ _ → propTruncIsProp) ∣ refl ∣₁ H⁰-Sⁿ≅ℤ : (n : ℕ) → GroupIso (coHomGr 0 (S₊ (suc n))) intGroup H⁰-Sⁿ≅ℤ zero = H⁰-connected base (Sn-connected 0) H⁰-Sⁿ≅ℤ (suc n) = H⁰-connected north (Sn-connected (suc n)) -- -- ---------------------------------------------------------------------- --- We will need to switch between Sⁿ defined using suspensions and using pushouts --- in order to apply Mayer Vietoris. S1Iso : Iso S¹ (Pushout {A = Bool} (λ _ → tt) λ _ → tt) S1Iso = S¹IsoSuspBool ⋄ invIso PushoutSuspIsoSusp coHomPushout≅coHomSn : (n m : ℕ) → GroupIso (coHomGr m (S₊ (suc n))) (coHomGr m (Pushout {A = S₊ n} (λ _ → tt) λ _ → tt)) coHomPushout≅coHomSn zero m = Iso+Hom→GrIso (setTruncIso (domIso S1Iso)) (sElim2 (λ _ _ → isSet→isGroupoid setTruncIsSet _ _) (λ _ _ → refl)) coHomPushout≅coHomSn (suc n) m = Iso+Hom→GrIso (setTruncIso (domIso (invIso PushoutSuspIsoSusp))) (sElim2 (λ _ _ → isSet→isGroupoid setTruncIsSet _ _) (λ _ _ → refl)) -------------------------- H⁰(S⁰) ----------------------------- S0→Int : (a : Int × Int) → S₊ 0 → Int S0→Int a true = fst a S0→Int a false = snd a H⁰-S⁰≅ℤ×ℤ : GroupIso (coHomGr 0 (S₊ 0)) (dirProd intGroup intGroup) fun (map H⁰-S⁰≅ℤ×ℤ) = sRec (isSet× isSetInt isSetInt) λ f → (f true) , (f false) isHom (map H⁰-S⁰≅ℤ×ℤ) = sElim2 (λ _ _ → isSet→isGroupoid (isSet× isSetInt isSetInt) _ _) λ a b i → addLemma (a true) (b true) i , addLemma (a false) (b false) i inv H⁰-S⁰≅ℤ×ℤ a = ∣ S0→Int a ∣₂ rightInv H⁰-S⁰≅ℤ×ℤ _ = refl leftInv H⁰-S⁰≅ℤ×ℤ = sElim (λ _ → isSet→isGroupoid setTruncIsSet _ _) λ f → cong ∣_∣₂ (funExt (λ {true → refl ; false → refl})) -- --------------------------H¹(S¹) ----------------------------------- {- In order to apply Mayer-Vietoris, we need the following lemma. Given the following diagram a ↦ (a , 0) ψ ϕ A --> A × A -------> B ---> C If ψ is an isomorphism and ϕ is surjective with ker ϕ ≡ {ψ (a , a) ∣ a ∈ A}, then C ≅ B -} diagonalIso : ∀ {ℓ ℓ' ℓ''} {A : Group {ℓ}} (B : Group {ℓ'}) {C : Group {ℓ''}} (ψ : GroupIso (dirProd A A) B) (ϕ : GroupHom B C) → isSurjective _ _ ϕ → ((x : ⟨ B ⟩) → isInKer B C ϕ x → ∃[ y ∈ ⟨ A ⟩ ] x ≡ (fun (map ψ)) (y , y)) → ((x : ⟨ B ⟩) → (∃[ y ∈ ⟨ A ⟩ ] x ≡ (fun (map ψ)) (y , y)) → isInKer B C ϕ x) → GroupIso A C diagonalIso {A = A} B {C = C} ψ ϕ issurj ker→diag diag→ker = BijectionIsoToGroupIso bijIso where open GroupStr module A = GroupStr (snd A) module B = GroupStr (snd B) module C = GroupStr (snd C) module A×A = GroupStr (snd (dirProd A A)) module ψ = GroupIso ψ module ϕ = GroupHom ϕ ψ⁻ = inv ψ fstProj : GroupHom A (dirProd A A) fun fstProj a = a , GroupStr.0g (snd A) isHom fstProj g0 g1 i = (g0 A.+ g1) , GroupStr.lid (snd A) (GroupStr.0g (snd A)) (~ i) bijIso : BijectionIso A C map' bijIso = compGroupHom fstProj (compGroupHom (map ψ) ϕ) inj bijIso a inker = pRec (isSetCarrier A _ _) (λ {(a' , id) → (cong fst (sym (leftInv ψ (a , GroupStr.0g (snd A))) ∙∙ cong ψ⁻ id ∙∙ leftInv ψ (a' , a'))) ∙ cong snd (sym (leftInv ψ (a' , a')) ∙∙ cong ψ⁻ (sym id) ∙∙ leftInv ψ (a , GroupStr.0g (snd A)))}) (ker→diag _ inker) surj bijIso c = pRec propTruncIsProp (λ { (b , id) → ∣ (fst (ψ⁻ b) A.+ (A.- snd (ψ⁻ b))) , ((sym (GroupStr.rid (snd C) _) ∙∙ cong ((fun ϕ) ((fun (map ψ)) (fst (ψ⁻ b) A.+ (A.- snd (ψ⁻ b)) , GroupStr.0g (snd A))) C.+_) (sym (diag→ker (fun (map ψ) ((snd (ψ⁻ b)) , (snd (ψ⁻ b)))) ∣ (snd (ψ⁻ b)) , refl ∣₁)) ∙∙ sym ((isHom ϕ) _ _)) ∙∙ cong (fun ϕ) (sym ((isHom (map ψ)) _ _) ∙∙ cong (fun (map ψ)) (ΣPathP (sym (GroupStr.assoc (snd A) _ _ _) ∙∙ cong (fst (ψ⁻ b) A.+_) (GroupStr.invl (snd A) _) ∙∙ GroupStr.rid (snd A) _ , (GroupStr.lid (snd A) _))) ∙∙ rightInv ψ b) ∙∙ id) ∣₁ }) (issurj c) H¹-S¹≅ℤ : GroupIso intGroup (coHomGr 1 (S₊ 1)) H¹-S¹≅ℤ = diagonalIso (coHomGr 0 (S₊ 0)) (invGroupIso H⁰-S⁰≅ℤ×ℤ) (K.d 0) (λ x → K.Ker-i⊂Im-d 0 x (ΣPathP (isOfHLevelSuc 0 (isContrHⁿ-Unit 0) _ _ , isOfHLevelSuc 0 (isContrHⁿ-Unit 0) _ _))) ((sElim (λ _ → isOfHLevelΠ 2 λ _ → isOfHLevelSuc 1 propTruncIsProp) (λ x inker → pRec propTruncIsProp (λ {((f , g) , id') → helper x f g id' inker}) ((K.Ker-d⊂Im-Δ 0 ∣ x ∣₂ inker))))) ((sElim (λ _ → isOfHLevelΠ 2 λ _ → isOfHLevelPath 2 setTruncIsSet _ _) λ F surj → pRec (setTruncIsSet _ _) (λ { (x , id) → K.Im-Δ⊂Ker-d 0 ∣ F ∣₂ ∣ (∣ (λ _ → x) ∣₂ , ∣ (λ _ → 0) ∣₂) , (cong ∣_∣₂ (funExt (surjHelper x))) ∙ sym id ∣₁ }) surj) ) □ invGroupIso (coHomPushout≅coHomSn 0 1) where module K = MV Unit Unit (S₊ 0) (λ _ → tt) (λ _ → tt) surjHelper : (x : Int) (x₁ : S₊ 0) → x -[ 0 ]ₖ 0 ≡ S0→Int (x , x) x₁ surjHelper x true = Iso.leftInv (Iso-Kn-ΩKn+1 0) x surjHelper x false = Iso.leftInv (Iso-Kn-ΩKn+1 0) x helper : (F : S₊ 0 → Int) (f g : ∥ (Unit → Int) ∥₂) (id : GroupHom.fun (K.Δ 0) (f , g) ≡ ∣ F ∣₂) → isInKer (coHomGr 0 (S₊ 0)) (coHomGr 1 (Pushout (λ _ → tt) (λ _ → tt))) (K.d 0) ∣ F ∣₂ → ∃[ x ∈ Int ] ∣ F ∣₂ ≡ inv H⁰-S⁰≅ℤ×ℤ (x , x) helper F = sElim2 (λ _ _ → isOfHLevelΠ 2 λ _ → isOfHLevelΠ 2 λ _ → isOfHLevelSuc 1 propTruncIsProp) λ f g id inker → pRec propTruncIsProp (λ ((a , b) , id2) → sElim2 {C = λ f g → GroupHom.fun (K.Δ 0) (f , g) ≡ ∣ F ∣₂ → _ } (λ _ _ → isOfHLevelΠ 2 λ _ → isOfHLevelSuc 1 propTruncIsProp) (λ f g id → ∣ (helper2 f g .fst) , (sym id ∙ sym (helper2 f g .snd)) ∣₁) a b id2) (MV.Ker-d⊂Im-Δ _ _ (S₊ 0) (λ _ → tt) (λ _ → tt) 0 ∣ F ∣₂ inker) where helper2 : (f g : Unit → Int) → Σ[ x ∈ Int ] (inv H⁰-S⁰≅ℤ×ℤ (x , x)) ≡ GroupHom.fun (K.Δ 0) (∣ f ∣₂ , ∣ g ∣₂) helper2 f g = (f _ -[ 0 ]ₖ g _) , cong ∣_∣₂ (funExt λ {true → refl ; false → refl}) ------------------------- H¹(S⁰) ≅ 0 ------------------------------- private Hⁿ-S0≃Kₙ×Kₙ : (n : ℕ) → Iso (S₊ 0 → coHomK (suc n)) (coHomK (suc n) × coHomK (suc n)) Iso.fun (Hⁿ-S0≃Kₙ×Kₙ n) f = (f true) , (f false) Iso.inv (Hⁿ-S0≃Kₙ×Kₙ n) (a , b) true = a Iso.inv (Hⁿ-S0≃Kₙ×Kₙ n) (a , b) false = b Iso.rightInv (Hⁿ-S0≃Kₙ×Kₙ n) a = refl Iso.leftInv (Hⁿ-S0≃Kₙ×Kₙ n) b = funExt λ {true → refl ; false → refl} isContrHⁿ-S0 : (n : ℕ) → isContr (coHom (suc n) (S₊ 0)) isContrHⁿ-S0 n = isContrRetract (Iso.fun (setTruncIso (Hⁿ-S0≃Kₙ×Kₙ n))) (Iso.inv (setTruncIso (Hⁿ-S0≃Kₙ×Kₙ n))) (Iso.leftInv (setTruncIso (Hⁿ-S0≃Kₙ×Kₙ n))) (isContrHelper n) where isContrHelper : (n : ℕ) → isContr (∥ (coHomK (suc n) × coHomK (suc n)) ∥₂) fst (isContrHelper zero) = ∣ (0₁ , 0₁) ∣₂ snd (isContrHelper zero) = sElim (λ _ → isOfHLevelPath 2 setTruncIsSet _ _) λ y → elim2 {B = λ x y → ∣ (0₁ , 0₁) ∣₂ ≡ ∣(x , y) ∣₂ } (λ _ _ → isOfHLevelPlus {n = 2} 2 setTruncIsSet _ _) (toPropElim2 (λ _ _ → setTruncIsSet _ _) refl) (fst y) (snd y) isContrHelper (suc zero) = ∣ (0₂ , 0₂) ∣₂ , sElim (λ _ → isOfHLevelPath 2 setTruncIsSet _ _) λ y → elim2 {B = λ x y → ∣ (0₂ , 0₂) ∣₂ ≡ ∣(x , y) ∣₂ } (λ _ _ → isOfHLevelPlus {n = 2} 3 setTruncIsSet _ _) (suspToPropElim2 base (λ _ _ → setTruncIsSet _ _) refl) (fst y) (snd y) isContrHelper (suc (suc n)) = ∣ (0ₖ (3 + n) , 0ₖ (3 + n)) ∣₂ , sElim (λ _ → isOfHLevelPath 2 setTruncIsSet _ _) λ y → elim2 {B = λ x y → ∣ (0ₖ (3 + n) , 0ₖ (3 + n)) ∣₂ ≡ ∣(x , y) ∣₂ } (λ _ _ → isProp→isOfHLevelSuc (4 + n) (setTruncIsSet _ _)) (suspToPropElim2 north (λ _ _ → setTruncIsSet _ _) refl) (fst y) (snd y) H¹-S⁰≅0 : (n : ℕ) → GroupIso (coHomGr (suc n) (S₊ 0)) trivialGroup H¹-S⁰≅0 n = IsoContrGroupTrivialGroup (isContrHⁿ-S0 n) ------------------------- H²(S¹) ≅ 0 ------------------------------- H²-S¹≅0 : GroupIso (coHomGr 2 (S₊ 1)) trivialGroup H²-S¹≅0 = coHomPushout≅coHomSn 0 2 □ invGroupIso (vSES→GroupIso _ _ vSES-helper) □ H¹-S⁰≅0 0 where module I = MV Unit Unit (S₊ 0) (λ _ → tt) (λ _ → tt) vSES-helper : vSES (coHomGr 1 (S₊ 0)) (coHomGr 2 (Pushout (λ _ → tt) (λ _ → tt))) _ _ isTrivialLeft vSES-helper = isOfHLevelSuc 0 (isOfHLevelΣ 0 (isContrHⁿ-Unit 0) (λ _ → isContrHⁿ-Unit 0)) isTrivialRight vSES-helper = isOfHLevelSuc 0 (isOfHLevelΣ 0 (isContrHⁿ-Unit 1) (λ _ → isContrHⁿ-Unit 1)) left vSES-helper = I.Δ 1 right vSES-helper = I.i 2 vSES.ϕ vSES-helper = I.d 1 Ker-ϕ⊂Im-left vSES-helper = I.Ker-d⊂Im-Δ 1 Ker-right⊂Im-ϕ vSES-helper = sElim (λ _ → isOfHLevelΠ 2 λ _ → isOfHLevelSuc 1 propTruncIsProp) -- doesn't terminate without elimination λ a → I.Ker-i⊂Im-d 1 ∣ a ∣₂ -- --------------- H¹(Sⁿ), n ≥ 1 -------------------------------------------- H¹-Sⁿ≅0 : (n : ℕ) → GroupIso (coHomGr 1 (S₊ (2 + n))) trivialGroup H¹-Sⁿ≅0 zero = coHomPushout≅coHomSn 1 1 □ BijectionIsoToGroupIso bijIso □ dirProdGroupIso (Hⁿ-Unit≅0 0) (Hⁿ-Unit≅0 0) □ lUnitGroupIso where module K = MV Unit Unit (S₊ 1) (λ _ → tt) (λ _ → tt) surj-helper : (x : ⟨ coHomGr 0 (S₊ _) ⟩) → isInIm _ _ (K.Δ 0) x surj-helper = sElim (λ _ → isOfHLevelSuc 1 propTruncIsProp) λ f → ∣ (∣ (λ _ → f base) ∣₂ , 0ₕ 0) , (cong ∣_∣₂ (funExt (toPropElim (λ _ → isSetInt _ _) (cong (λ x → f base +[ 0 ]ₖ x) (-0ₖ {n = 0}) ∙ rUnitₖ 0 (f base))))) ∣₁ helper : isInjective _ _ (K.i 1) helper = sElim (λ _ → isOfHLevelΠ 2 λ _ → isOfHLevelSuc 1 (setTruncIsSet _ _)) λ x inker → pRec (setTruncIsSet _ _) (sigmaElim (λ _ → isOfHLevelPath 2 setTruncIsSet _ _) λ a id → sym id ∙ K.Im-Δ⊂Ker-d 0 ∣ a ∣₂ (surj-helper _)) (K.Ker-i⊂Im-d 0 ∣ x ∣₂ inker) bijIso : BijectionIso (coHomGr 1 (Pushout (λ _ → tt) (λ _ → tt))) (dirProd (coHomGr 1 Unit) (coHomGr 1 Unit)) map' bijIso = K.i 1 inj bijIso = helper surj bijIso x = ∣ 0ₕ _ , isOfHLevelSuc 0 (isOfHLevelΣ 0 (isContrHⁿ-Unit zero) (λ _ → isContrHⁿ-Unit 0)) _ x ∣₁ H¹-Sⁿ≅0 (suc n) = coHomPushout≅coHomSn (2 + n) 1 □ BijectionIsoToGroupIso bijIso □ dirProdGroupIso (Hⁿ-Unit≅0 0) (Hⁿ-Unit≅0 0) □ lUnitGroupIso where module K = MV Unit Unit (S₊ (2 + n)) (λ _ → tt) (λ _ → tt) surj-helper : (x : ⟨ coHomGr 0 (S₊ _) ⟩) → isInIm _ _ (K.Δ 0) x surj-helper = sElim (λ _ → isOfHLevelSuc 1 propTruncIsProp) λ f → ∣ (∣ (λ _ → f north) ∣₂ , 0ₕ 0) , cong ∣_∣₂ (funExt (suspToPropElim (ptSn (suc n)) (λ _ → isSetInt _ _) (cong (λ x → f north +[ 0 ]ₖ x) (-0ₖ {n = 0}) ∙ rUnitₖ 0 (f north)))) ∣₁ helper : isInjective _ _ (K.i 1) helper = sElim (λ _ → isOfHLevelΠ 2 λ _ → isOfHLevelSuc 1 (setTruncIsSet _ _)) λ x inker → pRec (setTruncIsSet _ _) (sigmaElim (λ _ → isOfHLevelPath 2 setTruncIsSet _ _) λ a id → sym id ∙ K.Im-Δ⊂Ker-d 0 ∣ a ∣₂ (surj-helper _)) (K.Ker-i⊂Im-d 0 ∣ x ∣₂ inker) bijIso : BijectionIso (coHomGr 1 (Pushout (λ _ → tt) (λ _ → tt))) (dirProd (coHomGr 1 Unit) (coHomGr 1 Unit)) map' bijIso = K.i 1 inj bijIso = helper surj bijIso x = ∣ 0ₕ _ , isOfHLevelSuc 0 (isOfHLevelΣ 0 (isContrHⁿ-Unit zero) (λ _ → isContrHⁿ-Unit 0)) _ x ∣₁ --------- Direct proof of H¹(S¹) ≅ ℤ without Mayer-Vietoris ------- -- The strategy is to use the proof that ΩS¹ ≃ ℤ. Since we only have this for S¹ with the base/loop definition -- we begin with some functions translating between H¹(S₊ 1) and ∥ S¹ → S¹ ∥₀. The latter type is easy to characterise, -- by (S¹ → S¹) ≃ S¹ × ℤ (see Cubical.ZCohomology.Groups.Prelims). Truncating this leaves only ℤ, since S¹ is connected. -- The translation mentioned above uses the basechange function. We use basechange-lemma (Cubical.ZCohomology.Groups.Prelims) to prove the basechange2⁻ preserves -- path composition (in a more general sense than what is proved in basechange2⁻-morph) -- We can now give the group equivalence. The first bit is just a big composition of our previously defined translations and is pretty uninteresting. -- The harder step is proving that the equivalence is a morphism. This relies heavily on the fact that addition the cohomology groups essentially is defined using an -- application of cong₂, which allows us to use basechange-lemma. coHom1S1≃ℤ : GroupIso (coHomGr 1 (S₊ 1)) intGroup coHom1S1≃ℤ = theIso where F = Iso.fun S¹→S¹≡S¹×Int F⁻ = Iso.inv S¹→S¹≡S¹×Int theIso : GroupIso (coHomGr 1 (S₊ 1)) intGroup fun (map theIso) = sRec isSetInt (λ f → snd (F f)) isHom (map theIso) = sElim2 (λ _ _ → isOfHLevelPath 2 isSetInt _ _) λ f g → ((λ i → winding (guy (ΩKn+1→Kn 1 (Kn→ΩKn+1 1 (f base) ∙ Kn→ΩKn+1 1 (g base))) (λ i → S¹map (ΩKn+1→Kn 1 (Kn→ΩKn+1 1 (f (loop i)) ∙ Kn→ΩKn+1 1 (g (loop i)))))))) ∙∙ cong winding (helper (f base) (g base) f g refl refl) ∙∙ winding-hom (guy (f base) (λ i → S¹map (f (loop i)))) (guy (g base) (λ i → S¹map (g (loop i)))) where guy = basechange2⁻ ∘ S¹map helper : (x y : coHomK 1) (f g : S₊ 1 → coHomK 1) → (f base) ≡ x → (g base) ≡ y → (guy (ΩKn+1→Kn 1 (Kn→ΩKn+1 1 (f base) ∙ Kn→ΩKn+1 1 (g base))) (λ i → S¹map ((ΩKn+1→Kn 1 (Kn→ΩKn+1 1 (f (loop i)) ∙ Kn→ΩKn+1 1 (g (loop i))))))) ≡ (guy (f base) (λ i → S¹map (f (loop i)))) ∙ (guy (g base) (λ i → S¹map ((g (loop i))))) helper = elim2 (λ _ _ → isGroupoidΠ4 λ _ _ _ _ → isOfHLevelPath 3 (isOfHLevelSuc 3 (isGroupoidS¹) base base) _ _) (toPropElim2 (λ _ _ → isPropΠ4 λ _ _ _ _ → isGroupoidS¹ _ _ _ _) λ f g reflf reflg → basechange-lemma base base (S¹map ∘ (ΩKn+1→Kn 1)) ((Kn→ΩKn+1 1) ∘ f) ((Kn→ΩKn+1 1) ∘ g) (cong (Kn→ΩKn+1 1) reflf ∙ Kn→ΩKn+10ₖ 1) (cong (Kn→ΩKn+1 1) reflg ∙ Kn→ΩKn+10ₖ 1) ∙ λ j → guy (Iso.leftInv (Iso-Kn-ΩKn+1 1) (f base) j) (λ i → S¹map (Iso.leftInv (Iso-Kn-ΩKn+1 1) (f (loop i)) j)) ∙ guy (Iso.leftInv (Iso-Kn-ΩKn+1 1) (g base) j) (λ i → S¹map (Iso.leftInv (Iso-Kn-ΩKn+1 1) (g (loop i)) j))) inv theIso a = ∣ (F⁻ (base , a)) ∣₂ rightInv theIso a = cong snd (Iso.rightInv S¹→S¹≡S¹×Int (base , a)) leftInv theIso = sElim (λ _ → isOfHLevelPath 2 setTruncIsSet _ _) λ f → cong ((sRec setTruncIsSet ∣_∣₂) ∘ sRec setTruncIsSet λ x → ∣ F⁻ (x , (snd (F f))) ∣₂) (Iso.inv PathIdTrunc₀Iso (isConnectedS¹ (fst (F f)))) ∙ cong ∣_∣₂ (Iso.leftInv S¹→S¹≡S¹×Int f) ---------------------------- Hⁿ(Sⁿ) ≅ ℤ , n ≥ 1 ------------------- Hⁿ-Sⁿ≅ℤ : (n : ℕ) → GroupIso intGroup (coHomGr (suc n) (S₊ (suc n))) Hⁿ-Sⁿ≅ℤ zero = invGroupIso coHom1S1≃ℤ Hⁿ-Sⁿ≅ℤ (suc n) = Hⁿ-Sⁿ≅ℤ n □ vSES→GroupIso _ _ theIso □ invGroupIso (coHomPushout≅coHomSn (suc n) (suc (suc n))) where module K = MV Unit Unit (S₊ (suc n)) (λ _ → tt) (λ _ → tt) theIso : vSES (coHomGr (suc n) (S₊ (suc n))) (coHomGr (suc (suc n)) (Pushout {A = S₊ (suc n)} (λ _ → tt) (λ _ → tt))) _ _ isTrivialLeft theIso p q = ΣPathP (isOfHLevelSuc 0 (isContrHⁿ-Unit n) (fst p) (fst q) , isOfHLevelSuc 0 (isContrHⁿ-Unit n) (snd p) (snd q)) isTrivialRight theIso p q = ΣPathP (isOfHLevelSuc 0 (isContrHⁿ-Unit (suc n)) (fst p) (fst q) , isOfHLevelSuc 0 (isContrHⁿ-Unit (suc n)) (snd p) (snd q)) left theIso = K.Δ (suc n) right theIso = K.i (2 + n) vSES.ϕ theIso = K.d (suc n) Ker-ϕ⊂Im-left theIso = K.Ker-d⊂Im-Δ (suc n) Ker-right⊂Im-ϕ theIso = K.Ker-i⊂Im-d (suc n)
{ "alphanum_fraction": 0.5015839493, "avg_line_length": 50.4746192893, "ext": "agda", "hexsha": "d6c1aebfbd37a2e2dd8509086b693796822734cd", "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": "69d358f6be7842f77105634712821eda22d9c044", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "aljungstrom/cubical", "max_forks_repo_path": "Cubical/ZCohomology/Groups/Sn.agda", "max_issues_count": 1, "max_issues_repo_head_hexsha": "cc6ad25d5ffbe4f20ea7020474f266d24b97caa0", "max_issues_repo_issues_event_max_datetime": "2022-01-27T02:07:48.000Z", "max_issues_repo_issues_event_min_datetime": "2022-01-27T02:07:48.000Z", "max_issues_repo_licenses": [ "MIT" ], "max_issues_repo_name": "mchristianl/cubical", "max_issues_repo_path": "Cubical/ZCohomology/Groups/Sn.agda", "max_line_length": 165, "max_stars_count": null, "max_stars_repo_head_hexsha": "cc6ad25d5ffbe4f20ea7020474f266d24b97caa0", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "mchristianl/cubical", "max_stars_repo_path": "Cubical/ZCohomology/Groups/Sn.agda", "max_stars_repo_stars_event_max_datetime": null, "max_stars_repo_stars_event_min_datetime": null, "num_tokens": 7569, "size": 19887 }
{-# OPTIONS --safe --sized-types #-} module Generic.Semantics.Elaboration.LetBinder where open import Size open import Data.Product open import Agda.Builtin.List open import Function open import Relation.Unary open import Data.Environment open import Generic.Syntax open import Generic.Syntax.LetBinder open import Generic.Semantics open import Generic.Semantics.Syntactic private variable I : Set d : Desc I σ : I Γ Δ : List I s : Size -- Elaborating away a single let-binder. The algebra is defined by case analysis -- over the constructors: -- * let-binders are inlined thanks to the substitution _[_/0] which takes two -- arguments t and e and instatiates the first free variable of t with e. -- * the other constructors are left as is by reusing Substitution's algebra UnLet : Semantics (d `+ Let) (Tm d ∞) (Tm d ∞) Semantics.th^𝓥 UnLet = th^Tm Semantics.var UnLet = id Semantics.alg UnLet = case (Semantics.alg Sub) $ λ where (`IN' e t) → extract t (ε ∙ e) unLet : (Γ ─Env) (Tm d ∞) Δ → Tm (d `+ Let) s σ Γ → Tm d ∞ σ Δ unLet ρ t = Semantics.semantics UnLet ρ t unlet : ∀[ Tm (d `+ Let) ∞ σ ⇒ Tm d ∞ σ ] unlet = Semantics.semantics UnLet (pack `var)
{ "alphanum_fraction": 0.6980817348, "avg_line_length": 24.9791666667, "ext": "agda", "hexsha": "e9dda8c75643394ca509bbca3a1ae65b81f2ee0c", "lang": "Agda", "max_forks_count": 3, "max_forks_repo_forks_event_max_datetime": "2022-01-06T19:34:26.000Z", "max_forks_repo_forks_event_min_datetime": "2019-11-13T12:44:41.000Z", "max_forks_repo_head_hexsha": "34e2980af98ff2ded500619edce3e0907a6e9050", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "ajnavarro/language-dataset", "max_forks_repo_path": "data/github.com/gallais/generic-syntax/d458d7520ad52f8e089691348780caab991a0b2d/src/Generic/Semantics/Elaboration/LetBinder.agda", "max_issues_count": 91, "max_issues_repo_head_hexsha": "34e2980af98ff2ded500619edce3e0907a6e9050", "max_issues_repo_issues_event_max_datetime": "2022-03-21T04:17:18.000Z", "max_issues_repo_issues_event_min_datetime": "2019-11-11T15:41:26.000Z", "max_issues_repo_licenses": [ "MIT" ], "max_issues_repo_name": "ajnavarro/language-dataset", "max_issues_repo_path": "data/github.com/gallais/generic-syntax/d458d7520ad52f8e089691348780caab991a0b2d/src/Generic/Semantics/Elaboration/LetBinder.agda", "max_line_length": 80, "max_stars_count": 9, "max_stars_repo_head_hexsha": "34e2980af98ff2ded500619edce3e0907a6e9050", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "ajnavarro/language-dataset", "max_stars_repo_path": "data/github.com/gallais/generic-syntax/d458d7520ad52f8e089691348780caab991a0b2d/src/Generic/Semantics/Elaboration/LetBinder.agda", "max_stars_repo_stars_event_max_datetime": "2022-03-11T09:48:45.000Z", "max_stars_repo_stars_event_min_datetime": "2018-08-07T11:54:33.000Z", "num_tokens": 377, "size": 1199 }
module reverse-involution where import Relation.Binary.PropositionalEquality as Eq open Eq using (_≡_; refl; sym; cong) open Eq.≡-Reasoning open import lists using (List; []; _∷_; [_]; _++_; reverse) open import reverse-++-distrib using (reverse-++-distrib) -- reverseが対合(involution)である事の証明 reverse-involution : {A : Set} → (xs : List A) → reverse (reverse xs) ≡ xs reverse-involution [] = begin reverse (reverse []) ≡⟨⟩ reverse [] ≡⟨⟩ [] ∎ reverse-involution (x ∷ xs) = begin reverse (reverse (x ∷ xs)) ≡⟨⟩ reverse ((reverse xs) ++ [ x ]) ≡⟨ reverse-++-distrib (reverse xs) [ x ] ⟩ (reverse [ x ]) ++ (reverse (reverse xs)) ≡⟨⟩ [ x ] ++ reverse (reverse xs) ≡⟨ cong (x ∷_) (reverse-involution xs) ⟩ x ∷ xs ∎
{ "alphanum_fraction": 0.6, "avg_line_length": 23.90625, "ext": "agda", "hexsha": "410fc1fba380510879efdb75d6548fd019c45a12", "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": "df7722b88a9b3dfde320a690b78c4c1ef8c7c547", "max_forks_repo_licenses": [ "Apache-2.0" ], "max_forks_repo_name": "akiomik/plfa-solutions", "max_forks_repo_path": "part1/lists/reverse-involution.agda", "max_issues_count": null, "max_issues_repo_head_hexsha": "df7722b88a9b3dfde320a690b78c4c1ef8c7c547", "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": "akiomik/plfa-solutions", "max_issues_repo_path": "part1/lists/reverse-involution.agda", "max_line_length": 59, "max_stars_count": 1, "max_stars_repo_head_hexsha": "df7722b88a9b3dfde320a690b78c4c1ef8c7c547", "max_stars_repo_licenses": [ "Apache-2.0" ], "max_stars_repo_name": "akiomik/plfa-solutions", "max_stars_repo_path": "part1/lists/reverse-involution.agda", "max_stars_repo_stars_event_max_datetime": "2020-07-07T09:42:22.000Z", "max_stars_repo_stars_event_min_datetime": "2020-07-07T09:42:22.000Z", "num_tokens": 276, "size": 765 }
------------------------------------------------------------------------------ -- Definition of the gcd of two natural numbers using the Euclid's algorithm ------------------------------------------------------------------------------ {-# OPTIONS --exact-split #-} {-# OPTIONS --no-sized-types #-} {-# OPTIONS --no-universe-polymorphism #-} {-# OPTIONS --without-K #-} module FOTC.Program.GCD.Partial.GCD where open import FOTC.Base open import FOTC.Base.Loop open import FOTC.Data.Nat open import FOTC.Data.Nat.Inequalities ------------------------------------------------------------------------------ -- In GHC ≤ 7.0.4 the gcd is a partial function, i.e. gcd 0 0 = undefined. postulate gcd : D → D → D gcd-eq : ∀ m n → gcd m n ≡ (if (iszero₁ n) then (if (iszero₁ m) then error else m) else (if (iszero₁ m) then n else (if (gt m n) then gcd (m ∸ n) n else gcd m (n ∸ m)))) {-# ATP axiom gcd-eq #-}
{ "alphanum_fraction": 0.3913808267, "avg_line_length": 34.4545454545, "ext": "agda", "hexsha": "fcfd7516f91b5e7fb1d88f92f738cdd694c56cde", "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/GCD.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/GCD.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/GCD.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": 238, "size": 1137 }
module Cats.Limit.Product where open import Data.Bool using (Bool ; true ; false) open import Data.Product using (_×_ ; _,_ ; ∃-syntax ; proj₁ ; proj₂) open import Cats.Category open import Cats.Category.Cones using (Cones ; Cone ; HasObj-Cone) open import Cats.Category.Discrete as Discrete using (Discrete) open import Cats.Functor using (Functor) open import Cats.Limit open import Cats.Util.Conv module _ {lo la l≈ li} {Cat : Category lo la l≈} {I : Set li} {O : I → Category.Obj Cat} where open Category Cat open Product using (isProduct) open Cone using (arr) F : Functor (Discrete I) Cat F = Discrete.functor I O private module Cones = Category (Cones F) productData→cone : ∀ {P} → (∀ i → P ⇒ O i) → Cone F productData→cone {P} proj = record { Apex = P ; arr = proj ; commute = λ { Discrete.id → ≈.sym id-l } } cone→productData : Cone F → ∃[ P ] (∀ i → P ⇒ O i) cone→productData c = c ᴼ , arr c terminal : ∀ {P} {proj : ∀ i → P ⇒ O i} → IsProduct O P proj → Cones.IsTerminal (productData→cone proj) terminal {P} {proj} isProduct c = record { arr = record { θ = θ ; commute = commute } ; unique = λ where {record { θ = θ′ ; commute = commute′ }} _ → ∃!′.unique prod (λ i → ≈.sym (commute′ i)) } where prod : ∃![ u ] (∀ i → arr c i ≈ proj i ∘ u) prod = isProduct (arr c) θ : c ᴼ ⇒ P θ = prod ⃗ commute : ∀ j → arr (productData→cone proj) j ∘ θ ≈ arr c j commute j = ≈.sym (∃!′.prop prod j) product : ∀ {c} → Cones.IsTerminal c → let (P , proj) = cone→productData c in IsProduct O P proj product {c} term {X} x = record { arr = f ; prop = prop ; unique = uniq } where open Cats.Category.Cones._⇒_ using (θ ; commute) P = proj₁ (cone→productData c) proj = proj₂ (cone→productData c) u : Cones.∃! (productData→cone x) c u = term (productData→cone x) f : X ⇒ P f = θ (u ⃗) prop : ∀ i → x i ≈ proj i ∘ f prop i = ≈.sym (commute (u ⃗) _) uniq : IsUniqueSuchThat (λ g → ∀ i → x i ≈ proj i ∘ g) f uniq {g} eq = Cones.∃!′.unique u {f′} _ where f′ : productData→cone x Cones.⇒ c f′ = record { θ = g ; commute = λ i → ≈.sym (eq i) } product→limit : Product O → Limit F product→limit P = record { cone = productData→cone (Product.proj P) ; isLimit = terminal (isProduct P) } limit→product : Limit F → Product O limit→product L = let (P , proj) = cone→productData (L ᴼ) in record { prod = P ; proj = proj ; isProduct = product (Limit.isLimit L) } product-unique : (P Q : Product O) → P ᴼ ≅ Q ᴼ product-unique P Q = obj-unique (product→limit P) (product→limit Q)
{ "alphanum_fraction": 0.540328093, "avg_line_length": 24.3833333333, "ext": "agda", "hexsha": "d33d5f7ad65785ce9751924e87dbad8955a59e82", "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/Limit/Product.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/Limit/Product.agda", "max_line_length": 69, "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/Limit/Product.agda", "max_stars_repo_stars_event_max_datetime": null, "max_stars_repo_stars_event_min_datetime": null, "num_tokens": 977, "size": 2926 }
-- Very simple facts about natural numbers module NatSimple where import Data.Fin as F open import Data.Empty open import Data.Unit open import Data.Unit.Core open import Data.Nat renaming (_⊔_ to _⊔ℕ_) open import Data.Sum renaming (map to _⊎→_) open import Data.Product renaming (map to _×→_) open import Function renaming (_∘_ to _○_) open import Relation.Binary.PropositionalEquality open ≡-Reasoning open import FT ------------------------------------------------------------------------------ -- Equivalences (not used) data Dec (A : Set) : Set where yes : A → Dec A no : (A → ⊥) → Dec A sucEq : {n : ℕ} → (i j : F.Fin n) → (F.suc i) ≡ (F.suc j) → i ≡ j sucEq i .i refl = refl _=F=_ : {n : ℕ} → (i j : F.Fin n) → Dec (i ≡ j) F.zero =F= F.zero = yes refl (F.suc i) =F= F.zero = no (λ ()) F.zero =F= (F.suc j) = no (λ ()) (F.suc i) =F= (F.suc j) with i =F= j (F.suc i) =F= (F.suc .i) | yes refl = yes refl (F.suc i) =F= (F.suc j) | no p = no (λ q → p (sucEq i j q)) ------------------------------------------------------------------ -- Finite Types and the natural numbers are intimately related. toℕ : FT → ℕ toℕ ZERO = zero toℕ ONE = suc zero toℕ (PLUS b₀ b₁) = (toℕ b₀) + (toℕ b₁) toℕ (TIMES b₀ b₁) = (toℕ b₀) * (toℕ b₁) fromℕ : ℕ → FT fromℕ zero = ZERO fromℕ (suc n) = PLUS ONE (fromℕ n) normalize : FT → FT normalize = fromℕ ○ toℕ assocr : {m : ℕ} (n : ℕ) → (PLUS (fromℕ n) (fromℕ m)) ⇛ fromℕ (n + m) assocr zero = unite₊⇛ assocr (suc n) = assocr₊⇛ ◎ (id⇛ ⊕ (assocr n)) distr : (n₀ : ℕ) {n₁ : ℕ} → TIMES (fromℕ n₀) (fromℕ n₁) ⇛ fromℕ (n₀ * n₁) distr zero = distz⇛ distr (suc n) {m} = dist⇛ ◎ (unite⋆⇛ ⊕ distr n) ◎ assocr m normal : (b : FT) → b ⇛ normalize b normal ZERO = id⇛ normal ONE = uniti₊⇛ ◎ swap₊⇛ normal (PLUS b₀ b₁) = (normal b₀ ⊕ normal b₁) ◎ assocr (toℕ b₀) normal (TIMES b₀ b₁) = (normal b₀ ⊗ normal b₁) ◎ distr (toℕ b₀) -- normalize a finite type to (1 + (1 + (1 + ... + (1 + 0) ... ))) -- a bunch of ones ending with zero with left biased + in between ⟦_⟧ℕ : ℕ → Set ⟦ zero ⟧ℕ = ⊥ ⟦ suc n ⟧ℕ = ⊤ ⊎ ⟦ n ⟧ℕ -- Take a natural number n, and a value of the type represented by that n, -- and return the canonical finite set of size n. fromNormalNat : (n : ℕ) → ⟦ n ⟧ℕ → F.Fin n fromNormalNat zero () fromNormalNat (suc n) (inj₁ tt) = F.zero fromNormalNat (suc n) (inj₂ x) = F.suc (fromNormalNat n x) -- Take a natural number n, a finite set of size n, and return a -- (canonical) value of the type represented by n toNormalNat : (n : ℕ) → F.Fin n → ⟦ n ⟧ℕ toNormalNat zero () toNormalNat (suc n) F.zero = inj₁ tt toNormalNat (suc n) (F.suc f) = inj₂ (toNormalNat n f) -- BEGIN CODE COPIED (AND SOMEWHAT MODIFIED) FROM Nat.Properties -- (for some reason +-comm is a private field so I can't get to it without -- importing superfluous files and going through a bunch of administrative -- garbage that isn't worth my time) m+1+n≡1+m+n : ∀ m n → m + suc n ≡ suc (m + n) m+1+n≡1+m+n zero n = refl m+1+n≡1+m+n (suc m) n = cong suc (m+1+n≡1+m+n m n) +-identity : {n : ℕ} → n + zero ≡ n +-identity = n+0≡n _ where n+0≡n : (n : ℕ) → n + zero ≡ n n+0≡n zero = refl n+0≡n (suc n) = cong suc (n+0≡n n) +-comm : (m n : ℕ) → m + n ≡ n + m +-comm zero n = sym +-identity +-comm (suc m) n = begin suc m + n ≡⟨ refl ⟩ suc (m + n) ≡⟨ cong suc (+-comm m n) ⟩ suc (n + m) ≡⟨ sym (m+1+n≡1+m+n n m) ⟩ n + suc m ∎ -- END CODE COPIED FROM Nat.Properties -- add1modn : ℕ → ℕ → ℕ → ℕ add1modn zero zero acc = zero add1modn zero (suc n) acc = (suc n) + acc add1modn (suc max) zero acc = suc acc add1modn (suc max) (suc n) acc = add1modn max n (suc acc) -- Useful for testing one : ℕ one = suc (zero) two : ℕ two = suc one three : ℕ three = suc two four : ℕ four = suc three five : ℕ five = suc four six : ℕ six = suc five
{ "alphanum_fraction": 0.5658097686, "avg_line_length": 27.5886524823, "ext": "agda", "hexsha": "8d41ffffa5a5e4951e1e38f46910ec5f3d56dbcb", "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/NatSimple.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/NatSimple.agda", "max_line_length": 78, "max_stars_count": 14, "max_stars_repo_head_hexsha": "003835484facfde0b770bc2b3d781b42b76184c1", "max_stars_repo_licenses": [ "BSD-2-Clause" ], "max_stars_repo_name": "JacquesCarette/pi-dual", "max_stars_repo_path": "Univalence/OldUnivalence/NatSimple.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": 1543, "size": 3890 }
{-# OPTIONS --cubical --no-import-sorts --safe #-} module Cubical.Algebra.Group where open import Cubical.Algebra.Base public open import Cubical.Algebra.Definitions public open import Cubical.Algebra.Structures public using (IsGroup; isgroup) open import Cubical.Algebra.Bundles public using (Group; mkgroup; GroupCarrier) open import Cubical.Structures.Carrier public open import Cubical.Algebra.Group.Properties public open import Cubical.Algebra.Group.Morphism public open import Cubical.Algebra.Group.MorphismProperties public hiding (isPropIsGroup)
{ "alphanum_fraction": 0.8261648746, "avg_line_length": 39.8571428571, "ext": "agda", "hexsha": "9beeed7e15423850201f4c97e585a07012607c30", "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/Group.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/Group.agda", "max_line_length": 82, "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/Group.agda", "max_stars_repo_stars_event_max_datetime": null, "max_stars_repo_stars_event_min_datetime": null, "num_tokens": 127, "size": 558 }
------------------------------------------------------------------------ -- List-related properties ------------------------------------------------------------------------ -- Note that the lemmas below could be generalised to work with other -- equalities than _≡_. module Data.List.Properties where open import Data.List open import Data.Nat open import Data.Nat.Properties open import Data.Bool open import Data.Function open import Data.Product as Prod hiding (map) open import Data.Maybe open import Relation.Binary.PropositionalEquality import Relation.Binary.EqReasoning as Eq open import Algebra ∷-injective : ∀ {A} {x y xs ys} → (List A ∶ x ∷ xs) ≡ (y ∷ ys) → (x ≡ y) × (xs ≡ ys) ∷-injective refl = (refl , refl) right-identity-unique : ∀ {A} (xs : List A) {ys} → xs ≡ xs ++ ys → ys ≡ [] right-identity-unique [] refl = refl right-identity-unique (x ∷ xs) eq = right-identity-unique xs (proj₂ (∷-injective eq)) -- Map, sum, and append. map-++-commute : ∀ {a b} (f : a → b) xs ys → map f (xs ++ ys) ≡ map f xs ++ map f ys map-++-commute f [] ys = refl map-++-commute f (x ∷ xs) ys = cong (_∷_ (f x)) (map-++-commute f xs ys) sum-++-commute : ∀ xs ys → sum (xs ++ ys) ≡ sum xs + sum ys sum-++-commute [] ys = refl sum-++-commute (x ∷ xs) ys = begin x + sum (xs ++ ys) ≡⟨ cong (_+_ x) (sum-++-commute xs ys) ⟩ x + (sum xs + sum ys) ≡⟨ sym $ +-assoc x _ _ ⟩ (x + sum xs) + sum ys ∎ where open CommutativeSemiring commutativeSemiring hiding (_+_; sym) open ≡-Reasoning -- Various properties about folds. foldr-universal : ∀ {a b} (h : List a → b) f e → (h [] ≡ e) → (∀ x xs → h (x ∷ xs) ≡ f x (h xs)) → h ≗ foldr f e foldr-universal h f e base step [] = base foldr-universal h f e base step (x ∷ xs) = begin h (x ∷ xs) ≡⟨ step x xs ⟩ f x (h xs) ≡⟨ cong (f x) (foldr-universal h f e base step xs) ⟩ f x (foldr f e xs) ∎ where open ≡-Reasoning foldr-fusion : ∀ {a b c} (h : b → c) {f : a → b → b} {g : a → c → c} (e : b) → (∀ x y → h (f x y) ≡ g x (h y)) → h ∘ foldr f e ≗ foldr g (h e) foldr-fusion h {f} {g} e fuse = foldr-universal (h ∘ foldr f e) g (h e) refl (λ x xs → fuse x (foldr f e xs)) idIsFold : ∀ {a} → id {a = List a} ≗ foldr _∷_ [] idIsFold = foldr-universal id _∷_ [] refl (λ _ _ → refl) ++IsFold : ∀ {a} (xs ys : List a) → xs ++ ys ≡ foldr _∷_ ys xs ++IsFold xs ys = begin xs ++ ys ≡⟨ cong (λ xs → xs ++ ys) (idIsFold xs) ⟩ foldr _∷_ [] xs ++ ys ≡⟨ foldr-fusion (λ xs → xs ++ ys) [] (λ _ _ → refl) xs ⟩ foldr _∷_ ([] ++ ys) xs ≡⟨ refl ⟩ foldr _∷_ ys xs ∎ where open ≡-Reasoning mapIsFold : ∀ {a b} {f : a → b} → map f ≗ foldr (λ x ys → f x ∷ ys) [] mapIsFold {f = f} = begin map f ≈⟨ cong (map f) ∘ idIsFold ⟩ map f ∘ foldr _∷_ [] ≈⟨ foldr-fusion (map f) [] (λ _ _ → refl) ⟩ foldr (λ x ys → f x ∷ ys) [] ∎ where open Eq (_ →-setoid _) concat-map : ∀ {a b} {f : a → b} → concat ∘ map (map f) ≗ map f ∘ concat concat-map {f = f} = begin concat ∘ map (map f) ≈⟨ cong concat ∘ mapIsFold ⟩ concat ∘ foldr (λ xs ys → map f xs ∷ ys) [] ≈⟨ foldr-fusion concat [] (λ _ _ → refl) ⟩ foldr (λ ys zs → map f ys ++ zs) [] ≈⟨ sym ∘ foldr-fusion (map f) [] (λ ys zs → map-++-commute f ys zs) ⟩ map f ∘ concat ∎ where open Eq (_ →-setoid _) map-id : ∀ {A} → map id ≗ id {List A} map-id = begin map id ≈⟨ mapIsFold ⟩ foldr _∷_ [] ≈⟨ sym ∘ idIsFold ⟩ id ∎ where open Eq (_ →-setoid _) map-compose : ∀ {a b c} {g : b → c} {f : a → b} → map (g ∘ f) ≗ map g ∘ map f map-compose {g = g} {f} = begin map (g ∘ f) ≈⟨ cong (map (g ∘ f)) ∘ idIsFold ⟩ map (g ∘ f) ∘ foldr _∷_ [] ≈⟨ foldr-fusion (map (g ∘ f)) [] (λ _ _ → refl) ⟩ foldr (λ a y → g (f a) ∷ y) [] ≈⟨ sym ∘ foldr-fusion (map g) [] (λ _ _ → refl) ⟩ map g ∘ foldr (λ a y → f a ∷ y) [] ≈⟨ cong (map g) ∘ sym ∘ mapIsFold ⟩ map g ∘ map f ∎ where open Eq (_ →-setoid _) foldr-cong : ∀ {a b} {f₁ f₂ : a → b → b} {e₁ e₂ : b} → (∀ x y → f₁ x y ≡ f₂ x y) → e₁ ≡ e₂ → foldr f₁ e₁ ≗ foldr f₂ e₂ foldr-cong {f₁ = f₁} {f₂} {e} f₁≗₂f₂ refl = begin foldr f₁ e ≈⟨ cong (foldr f₁ e) ∘ idIsFold ⟩ foldr f₁ e ∘ foldr _∷_ [] ≈⟨ foldr-fusion (foldr f₁ e) [] (λ x xs → f₁≗₂f₂ x (foldr f₁ e xs)) ⟩ foldr f₂ e ∎ where open Eq (_ →-setoid _) map-cong : ∀ {a b} {f g : a → b} → f ≗ g → map f ≗ map g map-cong {f = f} {g} f≗g = begin map f ≈⟨ mapIsFold ⟩ foldr (λ x ys → f x ∷ ys) [] ≈⟨ foldr-cong (λ x ys → cong₂ _∷_ (f≗g x) refl) refl ⟩ foldr (λ x ys → g x ∷ ys) [] ≈⟨ sym ∘ mapIsFold ⟩ map g ∎ where open Eq (_ →-setoid _) -- Take, drop, and splitAt. take++drop : ∀ {a} n (xs : List a) → take n xs ++ drop n xs ≡ xs take++drop zero xs = refl take++drop (suc n) [] = refl take++drop (suc n) (x ∷ xs) = cong (λ xs → x ∷ xs) (take++drop n xs) splitAt-defn : ∀ {a} n → splitAt {a} n ≗ < take n , drop n > splitAt-defn zero xs = refl splitAt-defn (suc n) [] = refl splitAt-defn (suc n) (x ∷ xs) with splitAt n xs | splitAt-defn n xs ... | (ys , zs) | ih = cong (Prod.map (_∷_ x) id) ih -- TakeWhile, dropWhile, and span. takeWhile++dropWhile : ∀ {a} (p : a → Bool) (xs : List a) → takeWhile p xs ++ dropWhile p xs ≡ xs takeWhile++dropWhile p [] = refl takeWhile++dropWhile p (x ∷ xs) with p x ... | true = cong (_∷_ x) (takeWhile++dropWhile p xs) ... | false = refl span-defn : ∀ {a} (p : a → Bool) → span p ≗ < takeWhile p , dropWhile p > span-defn p [] = refl span-defn p (x ∷ xs) with p x ... | true = cong (Prod.map (_∷_ x) id) (span-defn p xs) ... | false = refl -- Partition. partition-defn : ∀ {a} (p : a → Bool) → partition p ≗ < filter p , filter (not ∘ p) > partition-defn p [] = refl partition-defn p (x ∷ xs) with p x | partition p xs | partition-defn p xs ... | true | (ys , zs) | eq = cong (Prod.map (_∷_ x) id) eq ... | false | (ys , zs) | eq = cong (Prod.map id (_∷_ x)) eq -- Inits, tails, and scanr. scanr-defn : ∀ {a b} (f : a → b → b) (e : b) → scanr f e ≗ map (foldr f e) ∘ tails scanr-defn f e [] = refl scanr-defn f e (x ∷ []) = refl scanr-defn f e (x₁ ∷ x₂ ∷ xs) with scanr f e (x₂ ∷ xs) | scanr-defn f e (x₂ ∷ xs) ... | [] | () ... | y ∷ ys | eq with ∷-injective eq ... | y≡fx₂⦇f⦈xs , _ = cong₂ (λ z zs → f x₁ z ∷ zs) y≡fx₂⦇f⦈xs eq scanl-defn : ∀ {a b} (f : a → b → a) (e : a) → scanl f e ≗ map (foldl f e) ∘ inits scanl-defn f e [] = refl scanl-defn f e (x ∷ xs) = cong (_∷_ e) (begin scanl f (f e x) xs ≡⟨ scanl-defn f (f e x) xs ⟩ map (foldl f (f e x)) (inits xs) ≡⟨ refl ⟩ map (foldl f e ∘ (_∷_ x)) (inits xs) ≡⟨ map-compose (inits xs) ⟩ map (foldl f e) (map (_∷_ x) (inits xs)) ∎) where open ≡-Reasoning -- Length. length-map : ∀ {A B} (f : A → B) xs → length (map f xs) ≡ length xs length-map f [] = refl length-map f (x ∷ xs) = cong suc (length-map f xs) length-gfilter : ∀ {A B} (p : A → Maybe B) xs → length (gfilter p xs) ≤ length xs length-gfilter p [] = z≤n length-gfilter p (x ∷ xs) with p x length-gfilter p (x ∷ xs) | just y = s≤s (length-gfilter p xs) length-gfilter p (x ∷ xs) | nothing = ≤-step (length-gfilter p xs)
{ "alphanum_fraction": 0.4937172775, "avg_line_length": 30.8064516129, "ext": "agda", "hexsha": "702067fa8a77f846e51261aa98a3690d132b38b4", "lang": "Agda", "max_forks_count": 3, "max_forks_repo_forks_event_max_datetime": "2022-03-12T11:54:10.000Z", "max_forks_repo_forks_event_min_datetime": "2015-07-21T16:37:58.000Z", "max_forks_repo_head_hexsha": "8ef786b40e4a9ab274c6103dc697dcb658cf3db3", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "isabella232/Lemmachine", "max_forks_repo_path": "vendor/stdlib/src/Data/List/Properties.agda", "max_issues_count": 1, "max_issues_repo_head_hexsha": "8ef786b40e4a9ab274c6103dc697dcb658cf3db3", "max_issues_repo_issues_event_max_datetime": "2022-03-12T12:17:51.000Z", "max_issues_repo_issues_event_min_datetime": "2022-03-12T12:17:51.000Z", "max_issues_repo_licenses": [ "MIT" ], "max_issues_repo_name": "larrytheliquid/Lemmachine", "max_issues_repo_path": "vendor/stdlib/src/Data/List/Properties.agda", "max_line_length": 72, "max_stars_count": 56, "max_stars_repo_head_hexsha": "8ef786b40e4a9ab274c6103dc697dcb658cf3db3", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "isabella232/Lemmachine", "max_stars_repo_path": "vendor/stdlib/src/Data/List/Properties.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": 3083, "size": 7640 }
{- Byzantine Fault Tolerant Consensus Verification in Agda, version 0.9. Copyright (c) 2021, Oracle and/or its affiliates. Licensed under the Universal Permissive License v 1.0 as shown at https://opensource.oracle.com/licenses/upl -} open import LibraBFT.Base.Types open import LibraBFT.Impl.OBM.Logging.Logging import LibraBFT.Impl.Types.Verifier as Verifier open import LibraBFT.ImplShared.Consensus.Types open import Optics.All open import Util.Encode open import Util.PKCS hiding (verify) open import Util.Prelude ------------------------------------------------------------------------------ import Data.List.Base as List open import Data.String using (String) module LibraBFT.Impl.Types.EpochChangeProof where obmLastLIWS : EpochChangeProof → Either ErrLog LedgerInfoWithSignatures obmLastLIWS self = maybeS (lastMay (self ^∙ ecpLedgerInfoWithSigs)) (Left fakeErr {-["EpochChangeProof", "obmLastLIWS", "empty"]-}) pure -- first/lowest epoch of the proof to indicate which epoch this proof is helping with epoch : EpochChangeProof -> Either ErrLog Epoch epoch self = maybeS (headMay (self ^∙ ecpLedgerInfoWithSigs)) (Left fakeErr {-["EpochChangeProof", "epoch", "empty"]-}) (pure ∘ (_^∙ liwsLedgerInfo ∙ liEpoch)) obmLastEpoch : EpochChangeProof → Epoch obmLastEpoch self = eitherS (obmLastLIWS self) (const ({-Epoch-} 0)) (_^∙ liwsLedgerInfo ∙ liEpoch) verify : {verifier : Set} ⦃ _ : Verifier.Verifier verifier ⦄ → EpochChangeProof → verifier → Either ErrLog LedgerInfoWithSignatures verify self verifier = do lcheck (not (null (self ^∙ ecpLedgerInfoWithSigs))) (here' ("empty" ∷ [])) lastLedgerInfoWithSigs ← last (self ^∙ ecpLedgerInfoWithSigs) lcheckInfo (not (Verifier.isLedgerInfoStale verifier (lastLedgerInfoWithSigs ^∙ liwsLedgerInfo))) (here' ("stale" ∷ [])) -- Skip stale ledger infos in the proof prefix. let ledgerInfosWithSigs = List.boolFilter (λ liws → not (Verifier.isLedgerInfoStale verifier (liws ^∙ liwsLedgerInfo))) (self ^∙ ecpLedgerInfoWithSigs) -- check the non-stale chain loop verifier ledgerInfosWithSigs pure lastLedgerInfoWithSigs where loop : {verifier : Set} ⦃ _ : Verifier.Verifier verifier ⦄ → verifier → List LedgerInfoWithSignatures → Either ErrLog Unit loop verifierRef = λ where [] → pure unit (liws ∷ liwss) → do Verifier.verify verifierRef liws verifierRef' ← case liws ^∙ liwsLedgerInfo ∙ liNextEpochState of λ where nothing → Left fakeErr -- ["empty ValidatorSet"] (just vs) → pure vs loop verifierRef' liwss here' : List String → List String here' t = "EpochChangeProof" ∷ "verify" ∷ t last : ∀ {A : Set} → List A → Either ErrLog A last [] = Left fakeErr last (x ∷ []) = Right x last (_ ∷ x ∷ xs) = last xs
{ "alphanum_fraction": 0.649535809, "avg_line_length": 39.6842105263, "ext": "agda", "hexsha": "3330fa767c17a58624d8f64f37207d920c50db0f", "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/Types/EpochChangeProof.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/Types/EpochChangeProof.agda", "max_line_length": 111, "max_stars_count": null, "max_stars_repo_head_hexsha": "a4674fc473f2457fd3fe5123af48253cfb2404ef", "max_stars_repo_licenses": [ "UPL-1.0" ], "max_stars_repo_name": "LaudateCorpus1/bft-consensus-agda", "max_stars_repo_path": "src/LibraBFT/Impl/Types/EpochChangeProof.agda", "max_stars_repo_stars_event_max_datetime": null, "max_stars_repo_stars_event_min_datetime": null, "num_tokens": 852, "size": 3016 }
------------------------------------------------------------------------------ -- The program to sort a list is correct ------------------------------------------------------------------------------ {-# OPTIONS --exact-split #-} {-# OPTIONS --no-sized-types #-} {-# OPTIONS --no-universe-polymorphism #-} {-# OPTIONS --without-K #-} -- This module proves the correctness of a program which sorts a list -- by converting it into an ordered tree and then back to a list -- (Burstall, 1969, p. 45). module FOTC.Program.SortList.CorrectnessProofATP where open import FOTC.Base open import FOTC.Data.Nat.List.Type open import FOTC.Program.SortList.PropertiesATP open import FOTC.Program.SortList.Properties.Totality.TreeATP open import FOTC.Program.SortList.SortList ------------------------------------------------------------------------------ -- Main theorem: The sort program generates an ordered list. postulate sortCorrect : ∀ {is} → ListN is → OrdList (sort is) {-# ATP prove sortCorrect flatten-OrdList makeTree-Tree makeTree-OrdTree #-} ------------------------------------------------------------------------------ -- References -- -- Burstall, R. M. (1969). Proving properties of programs by -- structural induction. The Computer Journal 12.1, pp. 41–48.
{ "alphanum_fraction": 0.5409961686, "avg_line_length": 40.78125, "ext": "agda", "hexsha": "cba2af89148bc43f973f694b31fadf1b738def7e", "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/SortList/CorrectnessProofATP.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/SortList/CorrectnessProofATP.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/SortList/CorrectnessProofATP.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": 258, "size": 1305 }
module Builtin.Coinduction where open import Agda.Builtin.Coinduction public
{ "alphanum_fraction": 0.8481012658, "avg_line_length": 15.8, "ext": "agda", "hexsha": "898d6a5b6326be89a132516c5f35ca7977a14a91", "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": "158d299b1b365e186f00d8ef5b8c6844235ee267", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "L-TChen/agda-prelude", "max_forks_repo_path": "src/Builtin/Coinduction.agda", "max_issues_count": null, "max_issues_repo_head_hexsha": "158d299b1b365e186f00d8ef5b8c6844235ee267", "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": "L-TChen/agda-prelude", "max_issues_repo_path": "src/Builtin/Coinduction.agda", "max_line_length": 43, "max_stars_count": null, "max_stars_repo_head_hexsha": "158d299b1b365e186f00d8ef5b8c6844235ee267", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "L-TChen/agda-prelude", "max_stars_repo_path": "src/Builtin/Coinduction.agda", "max_stars_repo_stars_event_max_datetime": null, "max_stars_repo_stars_event_min_datetime": null, "num_tokens": 20, "size": 79 }
{- This second-order signature was created from the following second-order syntax description: syntax TLC | Λ type N : 0-ary _↣_ : 2-ary | r30 𝟙 : 0-ary _⊗_ : 2-ary | l40 𝟘 : 0-ary _⊕_ : 2-ary | l30 term app : α ↣ β α -> β | _$_ l20 lam : α.β -> α ↣ β | ƛ_ r10 unit : 𝟙 pair : α β -> α ⊗ β | ⟨_,_⟩ fst : α ⊗ β -> α snd : α ⊗ β -> β abort : 𝟘 -> α inl : α -> α ⊕ β inr : β -> α ⊕ β case : α ⊕ β α.γ β.γ -> γ ze : N su : N -> N nrec : N α (α,N).α -> α theory (ƛβ) b : α.β a : α |> app (lam(x.b[x]), a) = b[a] (ƛη) f : α ↣ β |> lam (x. app(f, x)) = f (𝟙η) u : 𝟙 |> u = unit (fβ) a : α b : β |> fst (pair(a, b)) = a (sβ) a : α b : β |> snd (pair(a, b)) = b (pη) p : α ⊗ β |> pair (fst(p), snd(p)) = p (𝟘η) e : 𝟘 c : α |> abort(e) = c (lβ) a : α f : α.γ g : β.γ |> case (inl(a), x.f[x], y.g[y]) = f[a] (rβ) b : β f : α.γ g : β.γ |> case (inr(b), x.f[x], y.g[y]) = g[b] (cη) s : α ⊕ β c : (α ⊕ β).γ |> case (s, x.c[inl(x)], y.c[inr(y)]) = c[s] (zeβ) z : α s : (α,N).α |> nrec (ze, z, r m. s[r,m]) = z (suβ) z : α s : (α,N).α n : N |> nrec (su (n), z, r m. s[r,m]) = s[nrec (n, z, r m. s[r,m]), n] (ift) t f : α |> if (true, t, f) = t (iff) t f : α |> if (false, t, f) = f -} module TLC.Signature where open import SOAS.Context -- Type declaration data ΛT : Set where N : ΛT _↣_ : ΛT → ΛT → ΛT 𝟙 : ΛT _⊗_ : ΛT → ΛT → ΛT 𝟘 : ΛT _⊕_ : ΛT → ΛT → ΛT infixr 30 _↣_ infixl 40 _⊗_ infixl 30 _⊕_ -- Derived types B : ΛT B = 𝟙 ⊕ 𝟙 open import SOAS.Syntax.Signature ΛT public open import SOAS.Syntax.Build ΛT public -- Operator symbols data Λₒ : Set where appₒ lamₒ pairₒ fstₒ sndₒ inlₒ inrₒ : {α β : ΛT} → Λₒ unitₒ zeₒ suₒ : Λₒ abortₒ nrecₒ : {α : ΛT} → Λₒ caseₒ : {α β γ : ΛT} → Λₒ -- Term signature Λ:Sig : Signature Λₒ Λ:Sig = sig λ { (appₒ {α}{β}) → (⊢₀ α ↣ β) , (⊢₀ α) ⟼₂ β ; (lamₒ {α}{β}) → (α ⊢₁ β) ⟼₁ α ↣ β ; unitₒ → ⟼₀ 𝟙 ; (pairₒ {α}{β}) → (⊢₀ α) , (⊢₀ β) ⟼₂ α ⊗ β ; (fstₒ {α}{β}) → (⊢₀ α ⊗ β) ⟼₁ α ; (sndₒ {α}{β}) → (⊢₀ α ⊗ β) ⟼₁ β ; (abortₒ {α}) → (⊢₀ 𝟘) ⟼₁ α ; (inlₒ {α}{β}) → (⊢₀ α) ⟼₁ α ⊕ β ; (inrₒ {α}{β}) → (⊢₀ β) ⟼₁ α ⊕ β ; (caseₒ {α}{β}{γ}) → (⊢₀ α ⊕ β) , (α ⊢₁ γ) , (β ⊢₁ γ) ⟼₃ γ ; zeₒ → ⟼₀ N ; suₒ → (⊢₀ N) ⟼₁ N ; (nrecₒ {α}) → (⊢₀ N) , (⊢₀ α) , (α , N ⊢₂ α) ⟼₃ α } open Signature Λ:Sig public
{ "alphanum_fraction": 0.415615142, "avg_line_length": 26.6947368421, "ext": "agda", "hexsha": "5a7e31d0c1b40043e55860a088d878d829a5b4c4", "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": "out/TLC/Signature.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": "out/TLC/Signature.agda", "max_line_length": 100, "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": "out/TLC/Signature.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": 1438, "size": 2536 }
-- A discussion from -- https://twitter.com/YuumuKonpaku/status/1052959340468953088 module MdJustHighlightAgdaAsHtml where open import Agda.Builtin.Nat open import Agda.Builtin.Equality open import Agda.Primitive public using (lzero) renaming (Level to ULevel; lsuc to lsucc; _⊔_ to lmax) Type : (i : ULevel) -> Set (lsucc i) Type i = Set i data ⊥ : Type lzero where pattern O = zero pattern S n = (suc n) variable i : ULevel ¬ : (A : Type i) → Type i ¬ A = A → ⊥ _≠_ : {A : Type i} → (A → A → Type i) x ≠ y = ¬ (x ≡ y) infix 10 _∨_ data _∨_ {a b} (A : Type a) (B : Type b) : Set (lmax a b) where a-intro : A -> A ∨ B b-intro : B -> A ∨ B test : (x y : Nat) -> (x ≡ y) ∨ (x ≠ y) test O O = a-intro refl test O (S y) = b-intro (λ ()) test (S x) O = b-intro (λ ()) test (S x) (S y) with test x y ... | a-intro refl = a-intro refl ... | b-intro k = b-intro (lemma k) where lemma : {a b : Nat} -> a ≠ b -> S a ≠ S b lemma p refl = p refl
{ "alphanum_fraction": 0.5897703549, "avg_line_length": 24.5641025641, "ext": "agda", "hexsha": "86a0d13a4b1b08bde1424cfe610e3ad90b876db3", "lang": "Agda", "max_forks_count": 1, "max_forks_repo_forks_event_max_datetime": "2021-04-01T18:30:09.000Z", "max_forks_repo_forks_event_min_datetime": "2021-04-01T18:30:09.000Z", "max_forks_repo_head_hexsha": "2fa8ede09451d43647f918dbfb24ff7b27c52edc", "max_forks_repo_licenses": [ "BSD-3-Clause" ], "max_forks_repo_name": "phadej/agda", "max_forks_repo_path": "test/LaTeXAndHTML/succeed/MdJustHighlightAgdaAsHtml.agda", "max_issues_count": null, "max_issues_repo_head_hexsha": "2fa8ede09451d43647f918dbfb24ff7b27c52edc", "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": "phadej/agda", "max_issues_repo_path": "test/LaTeXAndHTML/succeed/MdJustHighlightAgdaAsHtml.agda", "max_line_length": 83, "max_stars_count": null, "max_stars_repo_head_hexsha": "2fa8ede09451d43647f918dbfb24ff7b27c52edc", "max_stars_repo_licenses": [ "BSD-3-Clause" ], "max_stars_repo_name": "phadej/agda", "max_stars_repo_path": "test/LaTeXAndHTML/succeed/MdJustHighlightAgdaAsHtml.agda", "max_stars_repo_stars_event_max_datetime": null, "max_stars_repo_stars_event_min_datetime": null, "num_tokens": 380, "size": 958 }
{-# OPTIONS --safe #-} open import Definition.Typed.EqualityRelation module Definition.LogicalRelation {{eqrel : EqRelSet}} where open EqRelSet {{...}} open import Definition.Untyped as U open import Definition.Typed open import Definition.Typed.Weakening open import Definition.Typed.Reduction open import Tools.Product import Tools.PropositionalEquality as PE import Data.Fin as Fin import Data.Nat as Nat -- The different cases of the logical relation are spread out through out -- this file. This is due to them having different dependencies. -- We will refer to expressions that satisfies the logical relation as reducible. -- Reducibility of Neutrals: -- Neutral type record _⊩ne_^[_,_] (Γ : Con Term) (A : Term) (r : Relevance) (l : Level) : Set where constructor ne field K : Term D : Γ ⊢ A :⇒*: K ^ [ r , ι l ] neK : Neutral K K≡K : Γ ⊢ K ~ K ∷ (Univ r l) ^ [ ! , next l ] -- Neutral type equality record _⊩ne_≡_^[_,_]/_ (Γ : Con Term) (A B : Term) (r : Relevance) (l : Level) ([A] : Γ ⊩ne A ^[ r , l ]) : Set where constructor ne₌ open _⊩ne_^[_,_] [A] field M : Term D′ : Γ ⊢ B :⇒*: M ^ [ r , ι l ] neM : Neutral M K≡M : Γ ⊢ K ~ M ∷ (Univ r l) ^ [ ! , next l ] -- Neutral term in WHNF record _⊩neNf_∷_^_ (Γ : Con Term) (k A : Term) (r : TypeInfo) : Set where inductive constructor neNfₜ field neK : Neutral k ⊢k : Γ ⊢ k ∷ A ^ r k≡k : Γ ⊢ k ~ k ∷ A ^ r -- Neutral relevant term record _⊩ne_∷_^_/_ (Γ : Con Term) (t A : Term) (l : Level) ([A] : Γ ⊩ne A ^[ ! , l ]) : Set where inductive constructor neₜ open _⊩ne_^[_,_] [A] field k : Term d : Γ ⊢ t :⇒*: k ∷ K ^ ι l nf : Γ ⊩neNf k ∷ K ^ [ ! , ι l ] -- Neutral irrelevant term record _⊩neIrr_∷_^_/_ (Γ : Con Term) (t A : Term) (l : Level) ([A] : Γ ⊩ne A ^[ % , l ]) : Set where inductive constructor neₜ open _⊩ne_^[_,_] [A] field d : Γ ⊢ t ∷ A ^ [ % , ι l ] -- Neutral term equality in WHNF record _⊩neNf_≡_∷_^_ (Γ : Con Term) (k m A : Term) (r : TypeInfo) : Set where inductive constructor neNfₜ₌ field neK : Neutral k neM : Neutral m k≡m : Γ ⊢ k ~ m ∷ A ^ r -- Neutral relevant term equality record _⊩ne_≡_∷_^_/_ (Γ : Con Term) (t u A : Term) (l : Level) ([A] : Γ ⊩ne A ^[ ! , l ]) : Set where constructor neₜ₌ open _⊩ne_^[_,_] [A] field k m : Term d : Γ ⊢ t :⇒*: k ∷ K ^ ι l d′ : Γ ⊢ u :⇒*: m ∷ K ^ ι l nf : Γ ⊩neNf k ≡ m ∷ K ^ [ ! , ι l ] -- Neutral irrelevant term equality record _⊩neIrr_≡_∷_^_/_ (Γ : Con Term) (t u A : Term) (l : Level) ([A] : Γ ⊩ne A ^[ % , l ]) : Set where constructor neₜ₌ open _⊩ne_^[_,_] [A] field d : Γ ⊢ t ∷ A ^ [ % , ι l ] d′ : Γ ⊢ u ∷ A ^ [ % , ι l ] -- Reducibility of natural numbers: -- Natural number type _⊩ℕ_ : (Γ : Con Term) (A : Term) → Set Γ ⊩ℕ A = Γ ⊢ A :⇒*: ℕ ^ [ ! , ι ⁰ ] -- Natural number type equality _⊩ℕ_≡_ : (Γ : Con Term) (A B : Term) → Set Γ ⊩ℕ A ≡ B = Γ ⊢ B ⇒* ℕ ^ [ ! , ι ⁰ ] mutual -- Natural number term data _⊩ℕ_∷ℕ (Γ : Con Term) (t : Term) : Set where ℕₜ : (n : Term) (d : Γ ⊢ t :⇒*: n ∷ ℕ ^ ι ⁰) (n≡n : Γ ⊢ n ≅ n ∷ ℕ ^ [ ! , ι ⁰ ]) (prop : Natural-prop Γ n) → Γ ⊩ℕ t ∷ℕ -- WHNF property of natural number terms data Natural-prop (Γ : Con Term) : (n : Term) → Set where sucᵣ : ∀ {n} → Γ ⊩ℕ n ∷ℕ → Natural-prop Γ (suc n) zeroᵣ : Natural-prop Γ zero ne : ∀ {n} → Γ ⊩neNf n ∷ ℕ ^ [ ! , ι ⁰ ] → Natural-prop Γ n mutual -- Natural number term equality data _⊩ℕ_≡_∷ℕ (Γ : Con Term) (t u : Term) : Set where ℕₜ₌ : (k k′ : Term) (d : Γ ⊢ t :⇒*: k ∷ ℕ ^ ι ⁰) (d′ : Γ ⊢ u :⇒*: k′ ∷ ℕ ^ ι ⁰) (k≡k′ : Γ ⊢ k ≅ k′ ∷ ℕ ^ [ ! , ι ⁰ ]) (prop : [Natural]-prop Γ k k′) → Γ ⊩ℕ t ≡ u ∷ℕ -- WHNF property of Natural number term equality data [Natural]-prop (Γ : Con Term) : (n n′ : Term) → Set where sucᵣ : ∀ {n n′} → Γ ⊩ℕ n ≡ n′ ∷ℕ → [Natural]-prop Γ (suc n) (suc n′) zeroᵣ : [Natural]-prop Γ zero zero ne : ∀ {n n′} → Γ ⊩neNf n ≡ n′ ∷ ℕ ^ [ ! , ι ⁰ ] → [Natural]-prop Γ n n′ -- Natural extraction from term WHNF property natural : ∀ {Γ n} → Natural-prop Γ n → Natural n natural (sucᵣ x) = sucₙ natural zeroᵣ = zeroₙ natural (ne (neNfₜ neK ⊢k k≡k)) = ne neK -- Natural extraction from term equality WHNF property split : ∀ {Γ a b} → [Natural]-prop Γ a b → Natural a × Natural b split (sucᵣ x) = sucₙ , sucₙ split zeroᵣ = zeroₙ , zeroₙ split (ne (neNfₜ₌ neK neM k≡m)) = ne neK , ne neM -- Reducibility of Empty -- Empty type _⊩Empty_^_ : (Γ : Con Term) (A : Term) (l : Level) → Set Γ ⊩Empty A ^ l = Γ ⊢ A :⇒*: Empty l ^ [ % , ι l ] -- Empty type equality _⊩Empty_≡_^_ : (Γ : Con Term) (A B : Term) (l : Level) → Set Γ ⊩Empty A ≡ B ^ l = Γ ⊢ B ⇒* Empty l ^ [ % , ι l ] data Empty-prop (Γ : Con Term) (n : Term) (l : Level) : Set where ne : Γ ⊢ n ∷ Empty l ^ [ % , ι l ] → Empty-prop Γ n l -- -- Empty term data _⊩Empty_∷Empty^_ (Γ : Con Term) (t : Term) (l : Level) : Set where Emptyₜ : (prop : Empty-prop Γ t l) → Γ ⊩Empty t ∷Empty^ l data [Empty]-prop (Γ : Con Term) : (n n′ : Term) (l : Level) → Set where ne : ∀ {n n′ l} → Γ ⊢ n ∷ Empty l ^ [ % , ι l ] → Γ ⊢ n′ ∷ Empty l ^ [ % , ι l ] → [Empty]-prop Γ n n′ l -- Empty term equality data _⊩Empty_≡_∷Empty^_ (Γ : Con Term) (t u : Term) (l : Level) : Set where Emptyₜ₌ : (prop : [Empty]-prop Γ t u l) → Γ ⊩Empty t ≡ u ∷Empty^ l -- Logical relation record LogRelKit : Set₁ where constructor Kit field _⊩U_^_ : (Γ : Con Term) → Term → TypeLevel → Set _⊩Π_^[_,_] : (Γ : Con Term) → Term → Relevance → Level → Set _⊩∃_^_ : (Γ : Con Term) → Term → Level → Set _⊩_^_ : (Γ : Con Term) → Term → TypeInfo → Set _⊩_≡_^_/_ : (Γ : Con Term) (A B : Term) (r : TypeInfo) → Γ ⊩ A ^ r → Set _⊩_∷_^_/_ : (Γ : Con Term) (t A : Term) (r : TypeInfo) → Γ ⊩ A ^ r → Set _⊩_≡_∷_^_/_ : (Γ : Con Term) (t u A : Term) (r : TypeInfo) → Γ ⊩ A ^ r → Set module LogRel (l : TypeLevel) (rec : ∀ {l′} → l′ <∞ l → LogRelKit) where -- Reducibility of Universe: -- Universe type record _⊩¹U_^_ (Γ : Con Term) (A : Term) (ll : TypeLevel) : Set where constructor Uᵣ field r : Relevance l′ : Level l< : ι l′ <∞ l eq : next l′ PE.≡ ll d : Γ ⊢ A :⇒*: Univ r l′ ^ [ ! , next l′ ] -- Universe type equality _⊩¹U_≡_^_/_ : (Γ : Con Term) (A B : Term) (ll : TypeLevel) ([A] : Γ ⊩¹U A ^ ll) → Set Γ ⊩¹U A ≡ B ^ ll / [A] = Γ ⊢ B ⇒* Univ (_⊩¹U_^_.r [A]) (_⊩¹U_^_.l′ [A]) ^ [ ! , ll ] -- Universe term record _⊩¹U_∷_^_/_ (Γ : Con Term) (t : Term) (A : Term) (ll : TypeLevel) ([A] : Γ ⊩¹U A ^ ll) : Set where constructor Uₜ open _⊩¹U_^_ [A] open LogRelKit (rec l<) field K : Term d : Γ ⊢ t :⇒*: K ∷ Univ r l′ ^ next l′ typeK : Type K K≡K : Γ ⊢ K ≅ K ∷ Univ r l′ ^ [ ! , next l′ ] [t] : ∀ {ρ Δ} → ρ ∷ Δ ⊆ Γ → (⊢Δ : ⊢ Δ) → Δ ⊩ U.wk ρ t ^ [ r , ι l′ ] -- Universe term equality record _⊩¹U_≡_∷_^_/_ (Γ : Con Term) (t u : Term) (X : Term) (ll : TypeLevel) ([X] : Γ ⊩¹U X ^ ll) : Set where constructor Uₜ₌ open _⊩¹U_^_ [X] open LogRelKit (rec l<) field [t] : Γ ⊩¹U t ∷ X ^ ll / [X] [u] : Γ ⊩¹U u ∷ X ^ ll / [X] A≡B : Γ ⊢ _⊩¹U_∷_^_/_.K [t] ≅ _⊩¹U_∷_^_/_.K [u] ∷ Univ r l′ ^ [ ! , next l′ ] [t≡u] : ∀ {ρ Δ} → ([ρ] : ρ ∷ Δ ⊆ Γ) → (⊢Δ : ⊢ Δ) → Δ ⊩ U.wk ρ t ≡ U.wk ρ u ^ [ r , ι l′ ] / _⊩¹U_∷_^_/_.[t] [t] [ρ] ⊢Δ mutual -- Reducibility of Π: -- Π-type record _⊩¹Π_^[_,_] (Γ : Con Term) (A : Term) (r : Relevance) (lΠ : Level) : Set where inductive eta-equality constructor Πᵣ field rF : Relevance lF : Level lG : Level lF≤ : lF ≤ lΠ lG≤ : lG ≤ lΠ F : Term G : Term D : Γ ⊢ A :⇒*: Π F ^ rF ° lF ▹ G ° lG ° lΠ ^ [ r , ι lΠ ] ⊢F : Γ ⊢ F ^ [ rF , ι lF ] ⊢G : Γ ∙ F ^ [ rF , ι lF ] ⊢ G ^ [ r , ι lG ] A≡A : Γ ⊢ Π F ^ rF ° lF ▹ G ° lG ° lΠ ≅ Π F ^ rF ° lF ▹ G ° lG ° lΠ ^ [ r , ι lΠ ] [F] : ∀ {ρ Δ} → ρ ∷ Δ ⊆ Γ → (⊢Δ : ⊢ Δ) → Δ ⊩¹ U.wk ρ F ^ [ rF , ι lF ] [G] : ∀ {ρ Δ a} → ([ρ] : ρ ∷ Δ ⊆ Γ) (⊢Δ : ⊢ Δ) → Δ ⊩¹ a ∷ U.wk ρ F ^ [ rF , ι lF ] / [F] [ρ] ⊢Δ → Δ ⊩¹ U.wk (lift ρ) G [ a ] ^ [ r , ι lG ] G-ext : ∀ {ρ Δ a b} → ([ρ] : ρ ∷ Δ ⊆ Γ) (⊢Δ : ⊢ Δ) → ([a] : Δ ⊩¹ a ∷ U.wk ρ F ^ [ rF , ι lF ] / [F] [ρ] ⊢Δ) → ([b] : Δ ⊩¹ b ∷ U.wk ρ F ^ [ rF , ι lF ] / [F] [ρ] ⊢Δ) → Δ ⊩¹ a ≡ b ∷ U.wk ρ F ^ [ rF , ι lF ] / [F] [ρ] ⊢Δ → Δ ⊩¹ U.wk (lift ρ) G [ a ] ≡ U.wk (lift ρ) G [ b ] ^ [ r , ι lG ] / [G] [ρ] ⊢Δ [a] -- Π-type equality record _⊩¹Π_≡_^[_,_]/_ (Γ : Con Term) (A B : Term) (r : Relevance) (lΠ : Level) ([A] : Γ ⊩¹Π A ^[ r , lΠ ]) : Set where inductive eta-equality constructor Π₌ open _⊩¹Π_^[_,_] [A] field F′ : Term G′ : Term D′ : Γ ⊢ B ⇒* Π F′ ^ rF ° lF ▹ G′ ° lG ° lΠ ^ [ r , ι lΠ ] A≡B : Γ ⊢ Π F ^ rF ° lF ▹ G ° lG ° lΠ ≅ Π F′ ^ rF ° lF ▹ G′ ° lG ° lΠ ^ [ r , ι lΠ ] [F≡F′] : ∀ {ρ Δ} → ([ρ] : ρ ∷ Δ ⊆ Γ) (⊢Δ : ⊢ Δ) → Δ ⊩¹ U.wk ρ F ≡ U.wk ρ F′ ^ [ rF , ι lF ] / [F] [ρ] ⊢Δ [G≡G′] : ∀ {ρ Δ a} → ([ρ] : ρ ∷ Δ ⊆ Γ) (⊢Δ : ⊢ Δ) → ([a] : Δ ⊩¹ a ∷ U.wk ρ F ^ [ rF , ι lF ] / [F] [ρ] ⊢Δ) → Δ ⊩¹ U.wk (lift ρ) G [ a ] ≡ U.wk (lift ρ) G′ [ a ] ^ [ r , ι lG ] / [G] [ρ] ⊢Δ [a] -- relevant Term of Π-type _⊩¹Π_∷_^_/_ : (Γ : Con Term) (t A : Term) (lΠ : Level) ([A] : Γ ⊩¹Π A ^[ ! , lΠ ]) → Set Γ ⊩¹Π t ∷ A ^ lΠ / Πᵣ rF lF lG lF≤ lG≤ F G D ⊢F ⊢G A≡A [F] [G] G-ext = ∃ λ f → Γ ⊢ t :⇒*: f ∷ Π F ^ rF ° lF ▹ G ° lG ° lΠ ^ ι lΠ × Function f × Γ ⊢ f ≅ f ∷ Π F ^ rF ° lF ▹ G ° lG ° lΠ ^ [ ! , ι lΠ ] × (∀ {ρ Δ a b} → ([ρ] : ρ ∷ Δ ⊆ Γ) (⊢Δ : ⊢ Δ) ([a] : Δ ⊩¹ a ∷ U.wk ρ F ^ [ rF , ι lF ] / [F] [ρ] ⊢Δ) ([b] : Δ ⊩¹ b ∷ U.wk ρ F ^ [ rF , ι lF ] / [F] [ρ] ⊢Δ) ([a≡b] : Δ ⊩¹ a ≡ b ∷ U.wk ρ F ^ [ rF , ι lF ] / [F] [ρ] ⊢Δ) → Δ ⊩¹ U.wk ρ f ∘ a ^ lΠ ≡ U.wk ρ f ∘ b ^ lΠ ∷ U.wk (lift ρ) G [ a ] ^ [ ! , ι lG ] / [G] [ρ] ⊢Δ [a]) × (∀ {ρ Δ a} → ([ρ] : ρ ∷ Δ ⊆ Γ) (⊢Δ : ⊢ Δ) → ([a] : Δ ⊩¹ a ∷ U.wk ρ F ^ [ rF , ι lF ] / [F] [ρ] ⊢Δ) → Δ ⊩¹ U.wk ρ f ∘ a ^ lΠ ∷ U.wk (lift ρ) G [ a ] ^ [ ! , ι lG ] / [G] [ρ] ⊢Δ [a]) -- Issue: Agda complains about record use not being strictly positive. -- Therefore we have to use × -- Irrelevant term of Π-type _⊩¹Πirr_∷_^_/_ : (Γ : Con Term) (t A : Term) (l′ : Level) ([A] : Γ ⊩¹Π A ^[ % , l′ ]) → Set Γ ⊩¹Πirr t ∷ A ^ l′ / Πᵣ rF lF lG lF≤ lG≤ F G D ⊢F ⊢G A≡A [F] [G] G-ext = Γ ⊢ t ∷ Π F ^ rF ° lF ▹ G ° lG ° l′ ^ [ % , ι l′ ] -- Term equality of Π-type _⊩¹Π_≡_∷_^_/_ : (Γ : Con Term) (t u A : Term) (l′ : Level) ([A] : Γ ⊩¹Π A ^[ ! , l′ ]) → Set Γ ⊩¹Π t ≡ u ∷ A ^ l′ / Πᵣ rF lF lG lF≤ lG≤ F G D ⊢F ⊢G A≡A [F] [G] G-ext = let [A] = Πᵣ rF lF lG lF≤ lG≤ F G D ⊢F ⊢G A≡A [F] [G] G-ext in ∃₂ λ f g → ( Γ ⊢ t :⇒*: f ∷ Π F ^ rF ° lF ▹ G ° lG ° l′ ^ ι l′ ) × ( Γ ⊢ u :⇒*: g ∷ Π F ^ rF ° lF ▹ G ° lG ° l′ ^ ι l′ ) × Function f × Function g × Γ ⊢ f ≅ g ∷ Π F ^ rF ° lF ▹ G ° lG ° l′ ^ [ ! , ι l′ ] × Γ ⊩¹Π t ∷ A ^ l′ / [A] × Γ ⊩¹Π u ∷ A ^ l′ / [A] × (∀ {ρ Δ a} → ([ρ] : ρ ∷ Δ ⊆ Γ) (⊢Δ : ⊢ Δ) → ([a] : Δ ⊩¹ a ∷ U.wk ρ F ^ [ rF , ι lF ] / [F] [ρ] ⊢Δ) → Δ ⊩¹ U.wk ρ f ∘ a ^ l′ ≡ U.wk ρ g ∘ a ^ l′ ∷ U.wk (lift ρ) G [ a ] ^ [ ! , ι lG ] / [G] [ρ] ⊢Δ [a]) -- Issue: Same as above. -- Irrelevant term equality of Π-type _⊩¹Πirr_≡_∷_^_/_ : (Γ : Con Term) (t u A : Term) (l′ : Level) ([A] : Γ ⊩¹Π A ^[ % , l′ ] ) → Set Γ ⊩¹Πirr t ≡ u ∷ A ^ l′ / Πᵣ rF lF lG lF≤ lG≤ F G D ⊢F ⊢G A≡A [F] [G] G-ext = (Γ ⊢ t ∷ Π F ^ rF ° lF ▹ G ° lG ° l′ ^ [ % , ι l′ ]) × (Γ ⊢ u ∷ Π F ^ rF ° lF ▹ G ° lG ° l′ ^ [ % , ι l′ ]) -- Existential types record _⊩¹∃_^_ (Γ : Con Term) (A : Term) (l′ : Level) : Set where inductive eta-equality constructor ∃ᵣ field F : Term G : Term D : Γ ⊢ A :⇒*: ∃ F ▹ G ^ [ % , ι l′ ] ⊢F : Γ ⊢ F ^ [ % , ι l′ ] ⊢G : Γ ∙ F ^ [ % , ι l′ ] ⊢ G ^ [ % , ι l′ ] A≡A : Γ ⊢ (∃ F ▹ G) ≅ (∃ F ▹ G) ^ [ % , ι l′ ] [F] : ∀ {ρ Δ} → ρ ∷ Δ ⊆ Γ → (⊢Δ : ⊢ Δ) → Δ ⊩¹ U.wk ρ F ^ [ % , ι l′ ] [G] : ∀ {ρ Δ a} → ([ρ] : ρ ∷ Δ ⊆ Γ) (⊢Δ : ⊢ Δ) → Δ ⊩¹ a ∷ U.wk ρ F ^ [ % , ι l′ ] / [F] [ρ] ⊢Δ → Δ ⊩¹ U.wk (lift ρ) G [ a ] ^ [ % , ι l′ ] G-ext : ∀ {ρ Δ a b} → ([ρ] : ρ ∷ Δ ⊆ Γ) (⊢Δ : ⊢ Δ) → ([a] : Δ ⊩¹ a ∷ U.wk ρ F ^ [ % , ι l′ ] / [F] [ρ] ⊢Δ) → ([b] : Δ ⊩¹ b ∷ U.wk ρ F ^ [ % , ι l′ ] / [F] [ρ] ⊢Δ) → Δ ⊩¹ a ≡ b ∷ U.wk ρ F ^ [ % , ι l′ ] / [F] [ρ] ⊢Δ → Δ ⊩¹ U.wk (lift ρ) G [ a ] ≡ U.wk (lift ρ) G [ b ] ^ [ % , ι l′ ] / [G] [ρ] ⊢Δ [a] -- ∃-type equality record _⊩¹∃_≡_^_/_ (Γ : Con Term) (A B : Term) (l′ : Level) ([A] : Γ ⊩¹∃ A ^ l′) : Set where inductive eta-equality constructor ∃₌ open _⊩¹∃_^_ [A] field F′ : Term G′ : Term D′ : Γ ⊢ B ⇒* ∃ F′ ▹ G′ ^ [ % , ι l′ ] A≡B : Γ ⊢ ∃ F ▹ G ≅ ∃ F′ ▹ G′ ^ [ % , ι l′ ] [F≡F′] : ∀ {ρ Δ} → ([ρ] : ρ ∷ Δ ⊆ Γ) (⊢Δ : ⊢ Δ) → Δ ⊩¹ U.wk ρ F ≡ U.wk ρ F′ ^ [ % , ι l′ ] / [F] [ρ] ⊢Δ [G≡G′] : ∀ {ρ Δ a} → ([ρ] : ρ ∷ Δ ⊆ Γ) (⊢Δ : ⊢ Δ) → ([a] : Δ ⊩¹ a ∷ U.wk ρ F ^ [ % , ι l′ ] / [F] [ρ] ⊢Δ) → Δ ⊩¹ U.wk (lift ρ) G [ a ] ≡ U.wk (lift ρ) G′ [ a ] ^ [ % , ι l′ ] / [G] [ρ] ⊢Δ [a] -- Terms of ∃-types (always irrelevant) _⊩¹∃_∷_^_/_ : (Γ : Con Term) (t A : Term) (l′ : Level) ([A] : Γ ⊩¹∃ A ^ l′) → Set Γ ⊩¹∃ t ∷ A ^ l′ / ∃ᵣ F G D ⊢F ⊢G A≡A [F] [G] G-ext = Γ ⊢ t ∷ ∃ F ▹ G ^ [ % , ι l′ ] -- Term equality for ∃-types _⊩¹∃_≡_∷_^_/_ : (Γ : Con Term) (t u A : Term) (l′ : Level) ([A] : Γ ⊩¹∃ A ^ l′) → Set Γ ⊩¹∃ t ≡ u ∷ A ^ l′ / ∃ᵣ F G D ⊢F ⊢G A≡A [F] [G] G-ext = (Γ ⊢ t ∷ ∃ F ▹ G ^ [ % , ι l′ ]) × (Γ ⊢ u ∷ ∃ F ▹ G ^ [ % , ι l′ ]) -- Logical relation definition data _⊩¹_^_ (Γ : Con Term) : Term → TypeInfo → Set where Uᵣ : ∀ {A ll} → (UA : Γ ⊩¹U A ^ ll) → Γ ⊩¹ A ^ [ ! , ll ] ℕᵣ : ∀ {A} → Γ ⊩ℕ A → Γ ⊩¹ A ^ [ ! , ι ⁰ ] Emptyᵣ : ∀ {A l} → Γ ⊩Empty A ^ l → Γ ⊩¹ A ^ [ % , ι l ] ne : ∀ {A r l} → Γ ⊩ne A ^[ r , l ] → Γ ⊩¹ A ^ [ r , ι l ] Πᵣ : ∀ {A r l} → Γ ⊩¹Π A ^[ r , l ] → Γ ⊩¹ A ^ [ r , ι l ] ∃ᵣ : ∀ {A l} → Γ ⊩¹∃ A ^ l → Γ ⊩¹ A ^ [ % , ι l ] emb : ∀ {A r l′} (l< : l′ <∞ l) (let open LogRelKit (rec l<)) ([A] : Γ ⊩ A ^ r) → Γ ⊩¹ A ^ r _⊩¹_≡_^_/_ : (Γ : Con Term) (A B : Term) (r : TypeInfo) → Γ ⊩¹ A ^ r → Set Γ ⊩¹ A ≡ B ^ [ .! , l ] / Uᵣ UA = Γ ⊩¹U A ≡ B ^ l / UA Γ ⊩¹ A ≡ B ^ [ .! , .ι ⁰ ] / ℕᵣ D = Γ ⊩ℕ A ≡ B Γ ⊩¹ A ≡ B ^ [ .% , .ι l ] / Emptyᵣ D = Γ ⊩Empty A ≡ B ^ l Γ ⊩¹ A ≡ B ^ [ r , ι l ] / ne neA = Γ ⊩ne A ≡ B ^[ r , l ]/ neA Γ ⊩¹ A ≡ B ^ [ r , ι l ] / Πᵣ ΠA = Γ ⊩¹Π A ≡ B ^[ r , l ]/ ΠA Γ ⊩¹ A ≡ B ^ [ .% , ι l ] / ∃ᵣ ∃A = Γ ⊩¹∃ A ≡ B ^ l / ∃A Γ ⊩¹ A ≡ B ^ r / emb l< [A] = Γ ⊩ A ≡ B ^ r / [A] where open LogRelKit (rec l<) _⊩¹_∷_^_/_ : (Γ : Con Term) (t A : Term) (r : TypeInfo) → Γ ⊩¹ A ^ r → Set Γ ⊩¹ t ∷ A ^ [ .! , ll ] / Uᵣ UA = Γ ⊩¹U t ∷ A ^ ll / UA Γ ⊩¹ t ∷ A ^ .([ ! , ι ⁰ ]) / ℕᵣ x = Γ ⊩ℕ t ∷ℕ Γ ⊩¹ t ∷ A ^ [ .% , ι ll ] / Emptyᵣ x = Γ ⊩Empty t ∷Empty^ ll Γ ⊩¹ t ∷ A ^ .([ ! , ι l ]) / ne {r = !} {l} neA = Γ ⊩ne t ∷ A ^ l / neA Γ ⊩¹ t ∷ A ^ .([ % , ι l ]) / ne {r = %} {l} neA = Γ ⊩neIrr t ∷ A ^ l / neA Γ ⊩¹ t ∷ A ^ [ ! , ι l ] / Πᵣ ΠA = Γ ⊩¹Π t ∷ A ^ l / ΠA Γ ⊩¹ t ∷ A ^ [ % , ι l ] / Πᵣ ΠA = Γ ⊩¹Πirr t ∷ A ^ l / ΠA Γ ⊩¹ t ∷ A ^ .([ % , ι l ]) / ∃ᵣ {l = l} ∃A = Γ ⊩¹∃ t ∷ A ^ l / ∃A Γ ⊩¹ t ∷ A ^ r / emb l< [A] = Γ ⊩ t ∷ A ^ r / [A] where open LogRelKit (rec l<) _⊩¹_≡_∷_^_/_ : (Γ : Con Term) (t u A : Term) (r : TypeInfo) → Γ ⊩¹ A ^ r → Set Γ ⊩¹ t ≡ u ∷ A ^ [ .! , ll ] / Uᵣ UA = Γ ⊩¹U t ≡ u ∷ A ^ ll / UA Γ ⊩¹ t ≡ u ∷ A ^ .([ ! , ι ⁰ ]) / ℕᵣ D = Γ ⊩ℕ t ≡ u ∷ℕ Γ ⊩¹ t ≡ u ∷ A ^ [ .% , ι ll ] / Emptyᵣ D = Γ ⊩Empty t ≡ u ∷Empty^ ll Γ ⊩¹ t ≡ u ∷ A ^ .([ ! , ι l ]) / ne {r = !} {l} neA = Γ ⊩ne t ≡ u ∷ A ^ l / neA Γ ⊩¹ t ≡ u ∷ A ^ .([ % , ι l ]) / ne {r = %} {l} neA = Γ ⊩neIrr t ≡ u ∷ A ^ l / neA Γ ⊩¹ t ≡ u ∷ A ^ [ ! , ι l ] / Πᵣ ΠA = Γ ⊩¹Π t ≡ u ∷ A ^ l / ΠA Γ ⊩¹ t ≡ u ∷ A ^ [ % , ι l ] / Πᵣ ΠA = Γ ⊩¹Πirr t ≡ u ∷ A ^ l / ΠA Γ ⊩¹ t ≡ u ∷ A ^ .([ % , ι l ]) / ∃ᵣ {l = l} ∃A = Γ ⊩¹∃ t ≡ u ∷ A ^ l / ∃A Γ ⊩¹ t ≡ u ∷ A ^ r / emb l< [A] = Γ ⊩ t ≡ u ∷ A ^ r / [A] where open LogRelKit (rec l<) kit : LogRelKit kit = Kit _⊩¹U_^_ _⊩¹Π_^[_,_] _⊩¹∃_^_ _⊩¹_^_ _⊩¹_≡_^_/_ _⊩¹_∷_^_/_ _⊩¹_≡_∷_^_/_ open LogRel public using (Uᵣ; ℕᵣ; Emptyᵣ; ne; Πᵣ ; ∃ᵣ ; emb; Uₜ; Uₜ₌; Π₌; ∃₌) -- Patterns for the non-records of Π pattern Πₜ a b c d e f = a , b , c , d , e , f pattern Πₜ₌ a b c d e f g h i j = a , b , c , d , e , f , g , h , i , j pattern Uᵣ′ A ll r l a e d = Uᵣ {A = A} {ll = ll} (Uᵣ r l a e d) pattern ne′ b c d e = ne (ne b c d e) pattern Πᵣ′ a a' a'' lf lg b c d e f g h i j = Πᵣ (Πᵣ a a' a'' lf lg b c d e f g h i j) pattern ∃ᵣ′ a b c d e f g h i = ∃ᵣ (∃ᵣ a b c d e f g h i) -- we need to split the LogRelKit into the level part and the general part to convince Agda termination checker logRelRec : ∀ l {l′} → l′ <∞ l → LogRelKit logRelRec (ι ⁰) = λ () logRelRec (ι ¹) X = LogRel.kit (ι ⁰) λ () logRelRec ∞ X = LogRel.kit (ι ¹) (λ X → LogRel.kit (ι ⁰) λ ()) kit : ∀ (i : TypeLevel) → LogRelKit kit l = LogRel.kit l (logRelRec l) _⊩′⟨_⟩U_^_ : (Γ : Con Term) (l : TypeLevel) → Term → TypeLevel → Set Γ ⊩′⟨ l ⟩U A ^ ll = Γ ⊩U A ^ ll where open LogRelKit (kit l) _⊩′⟨_⟩Π_^[_,_] : (Γ : Con Term) (l : TypeLevel) → Term → Relevance → Level → Set Γ ⊩′⟨ l ⟩Π A ^[ r , lΠ ] = Γ ⊩Π A ^[ r , lΠ ] where open LogRelKit (kit l) _⊩′⟨_⟩∃_^_ : (Γ : Con Term) (l : TypeLevel) → Term → Level → Set Γ ⊩′⟨ l ⟩∃ A ^ l' = Γ ⊩∃ A ^ l' where open LogRelKit (kit l) _⊩⟨_⟩_^_ : (Γ : Con Term) (l : TypeLevel) → Term → TypeInfo → Set Γ ⊩⟨ l ⟩ A ^ r = Γ ⊩ A ^ r where open LogRelKit (kit l) _⊩⟨_⟩_≡_^_/_ : (Γ : Con Term) (l : TypeLevel) (A B : Term) (r : TypeInfo) → Γ ⊩⟨ l ⟩ A ^ r → Set Γ ⊩⟨ l ⟩ A ≡ B ^ r / [A] = Γ ⊩ A ≡ B ^ r / [A] where open LogRelKit (kit l) _⊩⟨_⟩_∷_^_/_ : (Γ : Con Term) (l : TypeLevel) (t A : Term) (r : TypeInfo) → Γ ⊩⟨ l ⟩ A ^ r → Set Γ ⊩⟨ l ⟩ t ∷ A ^ r / [A] = Γ ⊩ t ∷ A ^ r / [A] where open LogRelKit (kit l) _⊩⟨_⟩_≡_∷_^_/_ : (Γ : Con Term) (l : TypeLevel) (t u A : Term) (r : TypeInfo) → Γ ⊩⟨ l ⟩ A ^ r → Set Γ ⊩⟨ l ⟩ t ≡ u ∷ A ^ r / [A] = Γ ⊩ t ≡ u ∷ A ^ r / [A] where open LogRelKit (kit l) -- Well-typed irrelevant terms are always reducible logRelIrr : ∀ {l t Γ l' A} ([A] : Γ ⊩⟨ l ⟩ A ^ [ % , l' ]) (⊢t : Γ ⊢ t ∷ A ^ [ % , l' ]) → Γ ⊩⟨ l ⟩ t ∷ A ^ [ % , l' ] / [A] logRelIrr (Emptyᵣ [[ ⊢A , ⊢B , D ]]) ⊢t = Emptyₜ (ne (conv ⊢t (reduction D (id ⊢B) Emptyₙ Emptyₙ (refl ⊢B)))) logRelIrr (ne x) ⊢t = neₜ ⊢t logRelIrr (Πᵣ′ rF lF lG _ _ F G D ⊢F ⊢G A≡A [F] [G] G-ext) ⊢t = conv ⊢t (reduction (red D) (id (_⊢_:⇒*:_^_.⊢B D)) Πₙ Πₙ (refl (_⊢_:⇒*:_^_.⊢B D))) logRelIrr (∃ᵣ′ F G D ⊢F ⊢G A≡A [F] [G] G-ext) ⊢t = conv ⊢t (reduction (red D) (id (_⊢_:⇒*:_^_.⊢B D)) ∃ₙ ∃ₙ (refl (_⊢_:⇒*:_^_.⊢B D))) logRelIrr {ι ¹} (emb X [A]) ⊢t = logRelIrr [A] ⊢t logRelIrr {∞} (emb X [A]) ⊢t = logRelIrr [A] ⊢t -- Well-typed irrelevant terms are reducibly equal as soon as they have the same type logRelIrrEq : ∀ {l t u Γ l' A} ([A] : Γ ⊩⟨ l ⟩ A ^ [ % , l' ]) (⊢t : Γ ⊢ t ∷ A ^ [ % , l' ]) (⊢u : Γ ⊢ u ∷ A ^ [ % , l' ]) → Γ ⊩⟨ l ⟩ t ≡ u ∷ A ^ [ % , l' ] / [A] logRelIrrEq (Emptyᵣ [[ ⊢A , ⊢B , D ]]) ⊢t ⊢u = Emptyₜ₌ (ne ((conv ⊢t (reduction D (id ⊢B) Emptyₙ Emptyₙ (refl ⊢B)))) (conv ⊢u (reduction D (id ⊢B) Emptyₙ Emptyₙ (refl ⊢B)))) logRelIrrEq (ne x) ⊢t ⊢u = neₜ₌ ⊢t ⊢u logRelIrrEq (Πᵣ′ rF lF lG _ _ F G D ⊢F ⊢G A≡A [F] [G] G-ext) ⊢t ⊢u = (conv ⊢t (reduction (red D) (id (_⊢_:⇒*:_^_.⊢B D)) Πₙ Πₙ (refl (_⊢_:⇒*:_^_.⊢B D))) ) , (conv ⊢u (reduction (red D) (id (_⊢_:⇒*:_^_.⊢B D)) Πₙ Πₙ (refl (_⊢_:⇒*:_^_.⊢B D))) ) logRelIrrEq (∃ᵣ′ F G D ⊢F ⊢G A≡A [F] [G] G-ext) ⊢t ⊢u = (conv ⊢t (reduction (red D) (id (_⊢_:⇒*:_^_.⊢B D)) ∃ₙ ∃ₙ (refl (_⊢_:⇒*:_^_.⊢B D))) ) , (conv ⊢u (reduction (red D) (id (_⊢_:⇒*:_^_.⊢B D)) ∃ₙ ∃ₙ (refl (_⊢_:⇒*:_^_.⊢B D))) ) logRelIrrEq {ι ¹} (emb X [A]) ⊢t = logRelIrrEq [A] ⊢t logRelIrrEq {∞} (emb X [A]) ⊢t = logRelIrrEq [A] ⊢t
{ "alphanum_fraction": 0.4235373299, "avg_line_length": 42.2784552846, "ext": "agda", "hexsha": "0e7dbfd211145d66629440d6605316a326c8e0aa", "lang": "Agda", "max_forks_count": 2, "max_forks_repo_forks_event_max_datetime": "2022-02-15T19:42:19.000Z", "max_forks_repo_forks_event_min_datetime": "2022-01-26T14:55:51.000Z", "max_forks_repo_head_hexsha": "e0eeebc4aa5ed791ce3e7c0dc9531bd113dfcc04", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "CoqHott/logrel-mltt", "max_forks_repo_path": "Definition/LogicalRelation.agda", "max_issues_count": null, "max_issues_repo_head_hexsha": "e0eeebc4aa5ed791ce3e7c0dc9531bd113dfcc04", "max_issues_repo_issues_event_max_datetime": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_licenses": [ "MIT" ], "max_issues_repo_name": "CoqHott/logrel-mltt", "max_issues_repo_path": "Definition/LogicalRelation.agda", "max_line_length": 240, "max_stars_count": 2, "max_stars_repo_head_hexsha": "e0eeebc4aa5ed791ce3e7c0dc9531bd113dfcc04", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "CoqHott/logrel-mltt", "max_stars_repo_path": "Definition/LogicalRelation.agda", "max_stars_repo_stars_event_max_datetime": "2022-01-17T16:13:53.000Z", "max_stars_repo_stars_event_min_datetime": "2018-06-21T08:39:01.000Z", "num_tokens": 10855, "size": 20801 }
module DualCoinductive where open import Data.Nat hiding (compare) open import Data.Nat.Properties open import Data.Fin hiding (_+_) open import Function open import Relation.Binary.PropositionalEquality hiding (Extensionality) open import Agda.Builtin.Equality.Rewrite open import Direction -- variables variable n m : ℕ -- session types coinductively module COI where mutual data Type : Set where TUnit TInt : Type TPair : Type → Type → Type TChan : SType → Type data STypeF (S : Set) : Set where transmit : (d : Dir) (t : Type) (s : S) → STypeF S choice : (d : Dir) (m : ℕ) (alt : Fin m → S) → STypeF S end : STypeF S record SType : Set where coinductive constructor delay field force : STypeF SType open SType variable t t₁ t₂ t₃ t₁' t₂' t₃' : Type s s₁ s₂ s₃ : SType s' s₁' s₂' s₃' : STypeF SType -- type equivalence data EquivT (R : SType → SType → Set) : Type → Type → Set where eq-unit : EquivT R TUnit TUnit eq-int : EquivT R TInt TInt eq-pair : EquivT R t₁ t₁' → EquivT R t₂ t₂' → EquivT R (TPair t₁ t₂) (TPair t₁' t₂') eq-chan : R s₁ s₂ → EquivT R (TChan s₁) (TChan s₂) -- session type equivalence data EquivF (R : SType → SType → Set) : STypeF SType → STypeF SType → Set where eq-transmit : (d : Dir) → EquivT R t₁ t₂ → R s₁ s₂ → EquivF R (transmit d t₁ s₁) (transmit d t₂ s₂) eq-choice : ∀ {alt alt'} → (d : Dir) → ((i : Fin m) → R (alt i) (alt' i)) → EquivF R (choice d m alt) (choice d m alt') eq-end : EquivF R end end record Equiv (s₁ : SType) (s₂ : SType) : Set where coinductive field force : EquivF Equiv (force s₁) (force s₂) open Equiv _≈_ = Equiv _≈'_ = EquivF Equiv _≈ᵗ_ = EquivT Equiv -- reflexivity ≈ᵗ-refl : t ≈ᵗ t ≈-refl : s ≈ s ≈'-refl : s' ≈' s' force (≈-refl {s}) = ≈'-refl ≈'-refl {transmit d t s} = eq-transmit d ≈ᵗ-refl ≈-refl ≈'-refl {choice d m alt} = eq-choice d λ i → ≈-refl ≈'-refl {end} = eq-end ≈ᵗ-refl {TUnit} = eq-unit ≈ᵗ-refl {TInt} = eq-int ≈ᵗ-refl {TPair t t₁} = eq-pair ≈ᵗ-refl ≈ᵗ-refl ≈ᵗ-refl {TChan x} = eq-chan ≈-refl -- symmetry ≈-symm : s₁ ≈ s₂ → s₂ ≈ s₁ ≈'-symm : s₁' ≈' s₂' → s₂' ≈' s₁' ≈ᵗ-symm : t₁ ≈ᵗ t₂ → t₂ ≈ᵗ t₁ force (≈-symm s₁≈s₂) = ≈'-symm (force s₁≈s₂) ≈'-symm (eq-transmit d x x₁) = eq-transmit d (≈ᵗ-symm x) (≈-symm x₁) ≈'-symm (eq-choice d x) = eq-choice d (λ i → ≈-symm (x i)) ≈'-symm eq-end = eq-end ≈ᵗ-symm eq-unit = eq-unit ≈ᵗ-symm eq-int = eq-int ≈ᵗ-symm (eq-pair t₁≈t₂ t₁≈t₃) = eq-pair (≈ᵗ-symm t₁≈t₂) (≈ᵗ-symm t₁≈t₃) ≈ᵗ-symm (eq-chan x) = eq-chan (≈-symm x) -- transitivity ≈-trans : s₁ ≈ s₂ → s₂ ≈ s₃ → s₁ ≈ s₃ ≈'-trans : s₁' ≈' s₂' → s₂' ≈' s₃' → s₁' ≈' s₃' ≈ᵗ-trans : t₁ ≈ᵗ t₂ → t₂ ≈ᵗ t₃ → t₁ ≈ᵗ t₃ force (≈-trans s₁≈s₂ s₂≈s₃) = ≈'-trans (force s₁≈s₂) (force s₂≈s₃) ≈'-trans (eq-transmit d tt₁ ss₁) (eq-transmit .d tt₂ ss₂) = eq-transmit d (≈ᵗ-trans tt₁ tt₂) (≈-trans ss₁ ss₂) ≈'-trans (eq-choice d x) (eq-choice .d x₁) = eq-choice d (λ i → ≈-trans (x i) (x₁ i)) ≈'-trans eq-end eq-end = eq-end ≈ᵗ-trans eq-unit eq-unit = eq-unit ≈ᵗ-trans eq-int eq-int = eq-int ≈ᵗ-trans (eq-pair t₁≈ᵗt₂ t₁≈ᵗt₃) (eq-pair t₂≈ᵗt₃ t₂≈ᵗt₄) = eq-pair (≈ᵗ-trans t₁≈ᵗt₂ t₂≈ᵗt₃) (≈ᵗ-trans t₁≈ᵗt₃ t₂≈ᵗt₄) ≈ᵗ-trans (eq-chan ss₁) (eq-chan ss₂) = eq-chan (≈-trans ss₁ ss₂) ---------------------------------------------------------------------- -- relational duality data DualD : Dir → Dir → Set where dual-sr : DualD SND RCV dual-rs : DualD RCV SND -- session type duality data DualF (R : SType → SType → Set) : STypeF SType → STypeF SType → Set where dual-transmit : DualD d₁ d₂ → t₁ ≈ᵗ t₂ → R s₁ s₂ → DualF R (transmit d₁ t₁ s₁) (transmit d₂ t₂ s₂) dual-choice : ∀ {alt alt'} → DualD d₁ d₂ → ((i : Fin m) → R (alt i) (alt' i)) → DualF R (choice d₁ m alt) (choice d₂ m alt') dual-end : DualF R end end record Dual (s₁ : SType) (s₂ : SType) : Set where coinductive field force : DualF Dual (force s₁) (force s₂) -- open Dual _⊥_ = Dual _⊥'_ = DualF Dual -- _≈ᵗ_ = EquivT Equiv -- symmetric DualD-symm : DualD d₁ d₂ → DualD d₂ d₁ DualD-symm dual-sr = dual-rs DualD-symm dual-rs = dual-sr ⊥-symm : s₁ ⊥ s₂ → s₂ ⊥ s₁ ⊥'-symm : s₁' ⊥' s₂' → s₂' ⊥' s₁' Dual.force (⊥-symm s₁⊥s₂) = ⊥'-symm (Dual.force s₁⊥s₂) ⊥'-symm (dual-transmit x x₁ x₂) = dual-transmit (DualD-symm x) (≈ᵗ-symm x₁) (⊥-symm x₂) ⊥'-symm (dual-choice x x₁) = dual-choice (DualD-symm x) (⊥-symm ∘ x₁) ⊥'-symm dual-end = dual-end -- involutory DualD-inv : DualD d₁ d₂ → DualD d₂ d₃ → d₁ ≡ d₃ DualD-inv dual-sr dual-rs = refl DualD-inv dual-rs dual-sr = refl ⊥-inv : s₁ ⊥ s₂ → s₂ ⊥ s₃ → s₁ ≈ s₃ ⊥'-inv : s₁' ⊥' s₂' → s₂' ⊥' s₃' → s₁' ≈' s₃' force (⊥-inv s₁⊥s₂ s₂⊥s₃) = ⊥'-inv (Dual.force s₁⊥s₂) (Dual.force s₂⊥s₃) ⊥'-inv (dual-transmit dd₁ tt₁ ss₁) (dual-transmit dd₂ tt₂ ss₂) rewrite DualD-inv dd₁ dd₂ = eq-transmit _ (≈ᵗ-trans tt₁ tt₂) (⊥-inv ss₁ ss₂) ⊥'-inv (dual-choice dd₁ ss₁) (dual-choice dd₂ ss₂) rewrite DualD-inv dd₁ dd₂ = eq-choice _ (λ i → ⊥-inv (ss₁ i) (ss₂ i)) ⊥'-inv dual-end dual-end = eq-end ---------------------------------------------------------------------- -- duality dual : SType → SType dualF : STypeF SType → STypeF SType force (dual s) = dualF (force s) dualF (transmit d t s) = transmit (dual-dir d) t (dual s) dualF (choice d m alt) = choice (dual-dir d) m (dual ∘ alt) dualF end = end -- properties dual-involution : ∀ s → s ≈ dual (dual s) dual-involutionF : ∀ s' → s' ≈' dualF (dualF s') force (dual-involution s) = dual-involutionF (force s) dual-involutionF (transmit d t s) rewrite dual-dir-inv d = eq-transmit d ≈ᵗ-refl (dual-involution s) dual-involutionF (choice d m alt) rewrite dual-dir-inv d = eq-choice d (dual-involution ∘ alt) dual-involutionF end = eq-end ----------------------------------------------------------------------- -- relational duality vs functional duality -- soundness dual-soundD : DualD d (dual-dir d) dual-soundD {SND} = dual-sr dual-soundD {RCV} = dual-rs dual-soundS : s ⊥ dual s dual-soundF : s' ⊥' dualF s' Dual.force dual-soundS = dual-soundF dual-soundF {transmit d t s} = dual-transmit dual-soundD ≈ᵗ-refl dual-soundS dual-soundF {choice d m alt} = dual-choice dual-soundD (λ i → dual-soundS) dual-soundF {end} = dual-end -- completeness dual-completeD : DualD d₁ d₂ → d₁ ≡ dual-dir d₂ dual-completeD dual-sr = refl dual-completeD dual-rs = refl dual-completeS : s₁ ⊥ s₂ → s₁ ≈ dual s₂ dual-completeF : s₁' ⊥' s₂' → s₁' ≈' dualF s₂' force (dual-completeS s₁⊥s₂) = dual-completeF (Dual.force s₁⊥s₂) dual-completeF (dual-transmit dd tt ss) rewrite dual-completeD dd = eq-transmit _ tt (dual-completeS ss) dual-completeF (dual-choice dd x₁) rewrite dual-completeD dd = eq-choice _ (λ i → dual-completeS (x₁ i)) dual-completeF dual-end = eq-end
{ "alphanum_fraction": 0.5900273028, "avg_line_length": 31.6318181818, "ext": "agda", "hexsha": "588226f43b247ffb1bdb78ede97b2b98d593d045", "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": "cd41919582013e75463308c32750e2712cf2de86", "max_forks_repo_licenses": [ "BSD-2-Clause" ], "max_forks_repo_name": "kcaliban/dual-session", "max_forks_repo_path": "src/DualCoinductive.agda", "max_issues_count": null, "max_issues_repo_head_hexsha": "cd41919582013e75463308c32750e2712cf2de86", "max_issues_repo_issues_event_max_datetime": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_licenses": [ "BSD-2-Clause" ], "max_issues_repo_name": "kcaliban/dual-session", "max_issues_repo_path": "src/DualCoinductive.agda", "max_line_length": 141, "max_stars_count": null, "max_stars_repo_head_hexsha": "cd41919582013e75463308c32750e2712cf2de86", "max_stars_repo_licenses": [ "BSD-2-Clause" ], "max_stars_repo_name": "kcaliban/dual-session", "max_stars_repo_path": "src/DualCoinductive.agda", "max_stars_repo_stars_event_max_datetime": null, "max_stars_repo_stars_event_min_datetime": null, "num_tokens": 3034, "size": 6959 }
------------------------------------------------------------------------ -- A simplified parser type ------------------------------------------------------------------------ module StructurallyRecursiveDescentParsing.Simplified where open import Category.Monad open import Codata.Musical.Notation open import Data.Bool open import Data.List using (List; _∷_; []; _++_) import Data.List.Categorical as ListMonad import Data.List.Properties as ListProp open import Data.List.Relation.Binary.BagAndSetEquality open import Data.List.NonEmpty using (List⁺; _∷_; [_]; _⁺++_; head; tail) import Data.List.NonEmpty.Categorical as List⁺ open import Data.List.NonEmpty.Properties open import Level open import Relation.Binary open import Relation.Binary.PropositionalEquality using (_≡_; refl) open RawMonad {f = zero} ListMonad.monad using () renaming (_>>=_ to _>>=′_) open RawMonad {f = zero} List⁺.monad using () renaming (_>>=_ to _>>=⁺_) private open module BagS {A : Set} = Setoid ([ bag ]-Equality A) using () renaming (_≈_ to _Bag-≈_) open import TotalParserCombinators.Parser as P hiding (Parser; module Parser) ------------------------------------------------------------------------ -- Parsers infixl 10 _!>>=_ _?>>=_ infixl 5 _∣_ -- A type for parsers which are not left recursive. -- -- The boolean index is true iff the parser is nullable (accepts the -- empty string). data Parser (Tok : Set) : Bool → Set → Set1 where return : ∀ {R} (x : R) → Parser Tok true R fail : ∀ {R} → Parser Tok false R token : Parser Tok false Tok _∣_ : ∀ {e₁ e₂ R} (p₁ : Parser Tok e₁ R) (p₂ : Parser Tok e₂ R) → Parser Tok (e₁ ∨ e₂) R _?>>=_ : ∀ {e₂ R₁ R₂} (p₁ : Parser Tok true R₁) (p₂ : R₁ → Parser Tok e₂ R₂) → Parser Tok e₂ R₂ _!>>=_ : ∀ {R₁ R₂} {e₂ : R₁ → Bool} (p₁ : Parser Tok false R₁) (p₂ : (x : R₁) → ∞ (Parser Tok (e₂ x) R₂)) → Parser Tok false R₂ -- Note that Parser has only one coinductive recursive component. -- Making any other recursive component coinductive would allow left -- recursive grammars to be formed, but it is safe to use coinduction -- in _>>=_ when we know that a token has been consumed, because for -- every successive use of coinduction we are at least one step closer -- to the end of the input. ------------------------------------------------------------------------ -- "Initial bags" -- The initial bag of a parser is calculated in such a way that it is -- obvious, given the nullability of the parser, whether or not the -- bag is empty. mutual initial⁺ : ∀ {Tok e R} → Parser Tok e R → e ≡ true → List⁺ R initial⁺ (return x) refl = [ x ] initial⁺ fail () initial⁺ token () initial⁺ (_∣_ {true} p₁ p₂) refl = initial⁺ p₁ refl ⁺++ initial p₂ initial⁺ (_∣_ {false} {true} p₁ p₂) refl = initial⁺ p₂ refl initial⁺ (_∣_ {false} {false} p₁ p₂) () initial⁺ (p₁ ?>>= p₂) refl = initial⁺ p₁ refl >>=⁺ λ x → initial⁺ (p₂ x) refl initial⁺ (p₁ !>>= p₂) () initial : ∀ {e Tok R} → Parser Tok e R → List R initial {false} p = [] initial {true} p = head is ∷ tail is where is = initial⁺ p refl -- Some boring lemmas. private ∣-lemma : ∀ {e₁ e₂ Tok R} (p₁ : Parser Tok e₁ R) (p₂ : Parser Tok e₂ R) → initial p₁ ++ initial p₂ ≡ initial (p₁ ∣ p₂) ∣-lemma {false} {false} p₁ p₂ = refl ∣-lemma {false} {true} p₁ p₂ = refl ∣-lemma {true} p₁ p₂ = refl ?>>=-lemma : ∀ {e₂ Tok R₁ R₂} (p₁ : Parser Tok true R₁) (p₂ : R₁ → Parser Tok e₂ R₂) → initial (p₂ (head (initial⁺ p₁ refl))) ++ (tail (initial⁺ p₁ refl) >>=′ λ x → initial (p₂ x)) ≡ initial (p₁ ?>>= p₂) ?>>=-lemma {false} p₁ p₂ = ListMonad.MonadProperties.right-zero (tail (initial⁺ p₁ refl)) ?>>=-lemma {true} p₁ p₂ = toList->>= f xs where f = λ x → initial⁺ (p₂ x) refl xs = initial⁺ p₁ refl ------------------------------------------------------------------------ -- Semantics -- The semantics of simplified parsers is defined by translation. ⟦_⟧ : ∀ {Tok e R} (p : Parser Tok e R) → P.Parser Tok R (initial p) ⟦ return x ⟧ = return x ⟦ fail ⟧ = fail ⟦ token ⟧ = token ⟦ p₁ ∣ p₂ ⟧ = cast lem (⟦ p₁ ⟧ ∣ ⟦ p₂ ⟧) where lem : _ Bag-≈ _ lem = BagS.reflexive (∣-lemma p₁ p₂) ⟦ p₁ !>>= p₂ ⟧ = ⟦ p₁ ⟧ >>= λ x → ♯ ⟦ ♭ (p₂ x) ⟧ ⟦ p₁ ?>>= p₂ ⟧ = cast lem (⟦ p₁ ⟧ >>= λ x → ⟦ p₂ x ⟧) where lem : _ Bag-≈ _ lem = BagS.reflexive (?>>=-lemma p₁ p₂)
{ "alphanum_fraction": 0.5151205558, "avg_line_length": 36.7969924812, "ext": "agda", "hexsha": "ebca6f9a6bbe65e0dcfe18f4bda7ff7cfb2d3530", "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": "76774f54f466cfe943debf2da731074fe0c33644", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "nad/parser-combinators", "max_forks_repo_path": "StructurallyRecursiveDescentParsing/Simplified.agda", "max_issues_count": null, "max_issues_repo_head_hexsha": "76774f54f466cfe943debf2da731074fe0c33644", "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/parser-combinators", "max_issues_repo_path": "StructurallyRecursiveDescentParsing/Simplified.agda", "max_line_length": 77, "max_stars_count": 1, "max_stars_repo_head_hexsha": "76774f54f466cfe943debf2da731074fe0c33644", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "nad/parser-combinators", "max_stars_repo_path": "StructurallyRecursiveDescentParsing/Simplified.agda", "max_stars_repo_stars_event_max_datetime": "2020-07-03T08:56:13.000Z", "max_stars_repo_stars_event_min_datetime": "2020-07-03T08:56:13.000Z", "num_tokens": 1469, "size": 4894 }
------------------------------------------------------------------------ -- The Agda standard library -- -- Core definitions for Functions ------------------------------------------------------------------------ -- The contents of this file should usually be accessed from `Function`. {-# OPTIONS --without-K --safe #-} module Function.Core where ------------------------------------------------------------------------ -- Types Fun₁ : ∀ {a} → Set a → Set a Fun₁ A = A → A Fun₂ : ∀ {a} → Set a → Set a Fun₂ A = A → A → A
{ "alphanum_fraction": 0.3662239089, "avg_line_length": 25.0952380952, "ext": "agda", "hexsha": "7997882df06ed77c46b7e72ba79b7066a7edb14c", "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/Function/Core.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/Function/Core.agda", "max_line_length": 72, "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/Function/Core.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": 96, "size": 527 }
{-# OPTIONS --cubical --safe #-} module Cubical.Foundations.Pointed.Properties where open import Cubical.Foundations.Prelude open import Cubical.Foundations.Pointed.Base open import Cubical.Data.Prod Π∙ : ∀ {ℓ ℓ'} (A : Type ℓ) (B∙ : A → Pointed ℓ') → Pointed (ℓ-max ℓ ℓ') Π∙ A B∙ = (∀ a → typ (B∙ a)) , (λ a → pt (B∙ a)) Σ∙ : ∀ {ℓ ℓ'} (A∙ : Pointed ℓ) (B∙ : typ A∙ → Pointed ℓ') → Pointed (ℓ-max ℓ ℓ') Σ∙ A∙ B∙ = (Σ[ a ∈ typ A∙ ] typ (B∙ a)) , (pt A∙ , pt (B∙ (pt A∙))) _×∙_ : ∀ {ℓ ℓ'} (A∙ : Pointed ℓ) (B∙ : Pointed ℓ') → Pointed (ℓ-max ℓ ℓ') A∙ ×∙ B∙ = ((typ A∙) × (typ B∙)) , (pt A∙ , pt B∙)
{ "alphanum_fraction": 0.5375626043, "avg_line_length": 37.4375, "ext": "agda", "hexsha": "b093c0e1ef6644ab67478c545cc38b859a594226", "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": "a01973ef7264f9454a40697313a2073c51a6b77a", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "oisdk/cubical", "max_forks_repo_path": "Cubical/Foundations/Pointed/Properties.agda", "max_issues_count": null, "max_issues_repo_head_hexsha": "a01973ef7264f9454a40697313a2073c51a6b77a", "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/cubical", "max_issues_repo_path": "Cubical/Foundations/Pointed/Properties.agda", "max_line_length": 80, "max_stars_count": null, "max_stars_repo_head_hexsha": "a01973ef7264f9454a40697313a2073c51a6b77a", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "oisdk/cubical", "max_stars_repo_path": "Cubical/Foundations/Pointed/Properties.agda", "max_stars_repo_stars_event_max_datetime": null, "max_stars_repo_stars_event_min_datetime": null, "num_tokens": 300, "size": 599 }
module FStream.Containers where ------------------------------------------------------------------------ -- Containers & their extension ------------------------------------------------------------------------ open import Data.Fin open import Data.Maybe open import Data.Unit open import Library ListC : Container ℓ₀ Shape ListC = ℕ Position ListC n = Fin n StateC : ∀ {ℓ} → Set ℓ → Container ℓ Shape (StateC S) = S → S Position (StateC S) _ = S StreamC : Container ℓ₀ Shape StreamC = ⊤ Position StreamC = const ℕ ReaderC : Set → Container ℓ₀ Shape (ReaderC R) = ⊤ Position (ReaderC R) _ = R runReader : {R A : Set} → ⟦ ReaderC R ⟧ A → R → A runReader (proj₁ , proj₂) r = proj₂ r ask : ∀ {R} → ⟦ ReaderC R ⟧ R proj₁ ask = tt proj₂ ask x = x returnReader : ∀ {ℓ} {A : Set ℓ} {R : Set} → A → ⟦ ReaderC R ⟧ A returnReader a = tt , (λ _ → a) ExceptC : Set → Container ℓ₀ Shape (ExceptC E) = Maybe E Position (ExceptC E₁) (just x) = ⊥ Position (ExceptC E₁) nothing = ⊤ -- TODO Use stdlib IdC : Container ℓ₀ Shape IdC = ⊤ Position IdC tt = ⊤
{ "alphanum_fraction": 0.5612535613, "avg_line_length": 21.9375, "ext": "agda", "hexsha": "9f5812801b1c6ff2aa44d6590732ad90b1e2fef7", "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/Containers.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/Containers.agda", "max_line_length": 72, "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/Containers.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": 338, "size": 1053 }
module MJ.Types where open import Prelude hiding (_≟_) open import Data.Fin.Properties as FinP using () open import Data.Vec open import Data.List open import Relation.Binary.Core open import Relation.Nullary open import Relation.Binary data Cid (c : ℕ) : Set where cls : Fin c → Cid c Object : Cid c _cid≟_ : ∀ {c} → Decidable (_≡_ {A = Cid c}) cls x cid≟ cls y with x FinP.≟ y cls x cid≟ cls .x | yes refl = yes refl cls x cid≟ cls y | no ¬p = no (λ{ refl → ¬p refl}) cls x cid≟ Object = no (λ ()) Object cid≟ cls x = no (λ ()) Object cid≟ Object = yes refl data Ty (c : ℕ) : Set where void : Ty c int : Ty c ref : Cid c → Ty c data Ty⁺ (c : ℕ) : Set where vty : Ty c → Ty⁺ c obj : Cid c → Ty⁺ c World : ℕ → Set World c = List (Ty⁺ c) Sig : ℕ → Set Sig c = List (Ty c) × Ty c _≟_ : ∀ {c} → Decidable (_≡_ {A = Ty c}) void ≟ void = yes refl void ≟ int = no (λ ()) void ≟ ref x = no (λ ()) int ≟ void = no (λ ()) int ≟ int = yes refl int ≟ ref x = no (λ ()) ref x ≟ void = no (λ ()) ref x ≟ int = no (λ ()) ref x ≟ ref y with x cid≟ y ref x ≟ ref y | yes p = yes (cong ref p) ref x ≟ ref y | no ¬p = no λ{ refl → ¬p refl }
{ "alphanum_fraction": 0.581010453, "avg_line_length": 22.5098039216, "ext": "agda", "hexsha": "ea2eac19e81667ef6c633ae6e4d695294a74540c", "lang": "Agda", "max_forks_count": 1, "max_forks_repo_forks_event_max_datetime": "2021-12-28T17:38:05.000Z", "max_forks_repo_forks_event_min_datetime": "2021-12-28T17:38:05.000Z", "max_forks_repo_head_hexsha": "0c096fea1716d714db0ff204ef2a9450b7a816df", "max_forks_repo_licenses": [ "Apache-2.0" ], "max_forks_repo_name": "metaborg/mj.agda", "max_forks_repo_path": "src/MJ/Types.agda", "max_issues_count": 1, "max_issues_repo_head_hexsha": "0c096fea1716d714db0ff204ef2a9450b7a816df", "max_issues_repo_issues_event_max_datetime": "2020-10-14T13:41:58.000Z", "max_issues_repo_issues_event_min_datetime": "2019-01-13T13:03:47.000Z", "max_issues_repo_licenses": [ "Apache-2.0" ], "max_issues_repo_name": "metaborg/mj.agda", "max_issues_repo_path": "src/MJ/Types.agda", "max_line_length": 50, "max_stars_count": 10, "max_stars_repo_head_hexsha": "0c096fea1716d714db0ff204ef2a9450b7a816df", "max_stars_repo_licenses": [ "Apache-2.0" ], "max_stars_repo_name": "metaborg/mj.agda", "max_stars_repo_path": "src/MJ/Types.agda", "max_stars_repo_stars_event_max_datetime": "2021-09-24T08:02:33.000Z", "max_stars_repo_stars_event_min_datetime": "2017-11-17T17:10:36.000Z", "num_tokens": 440, "size": 1148 }
{-# OPTIONS --without-K --safe #-} module Math.NumberTheory.Summation.Generic where -- agda-stdlib open import Algebra open import Data.Nat module MonoidSummation {c e} (M : Monoid c e) where open Monoid M renaming (Carrier to A) -- Σ< n f = Σₖ₌₀ⁿ⁻¹[f k] Σ< : ℕ → (ℕ → A) → A Σ< 0 f = ε Σ< (suc n) f = Σ< n f ∙ f n -- Σ≤ n f = Σₖ₌₀ⁿ[f k] Σ≤ : ℕ → (ℕ → A) → A Σ≤ n f = Σ< (suc n) f -- Σ<range m n f = Σₖ₌ₘⁿ⁻¹[f k] Σ<range : ℕ → ℕ → (ℕ → A) → A Σ<range m n f = Σ< (n ∸ m) (λ o → f (m + o)) -- Σ≤range m n f = Σₖ₌ₘⁿ[f k] Σ≤range : ℕ → ℕ → (ℕ → A) → A Σ≤range m n f = Σ<range m (suc n) f -- syntax syntax Σ< n (λ k → e) = Σ[ k < n ] e syntax Σ≤ n (λ k → e) = Σ[ k ≤ n ] e syntax Σ<range m n (λ k → e) = Σ[ m ≤ k < n ] e syntax Σ≤range m n (λ k → e) = Σ[ m ≤ k ≤ n ] e
{ "alphanum_fraction": 0.4852941176, "avg_line_length": 24, "ext": "agda", "hexsha": "a41cdf1d6e1cbaf83660dbb75479dee796e48873", "lang": "Agda", "max_forks_count": null, "max_forks_repo_forks_event_max_datetime": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_head_hexsha": "37200ea91d34a6603d395d8ac81294068303f577", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "rei1024/agda-misc", "max_forks_repo_path": "Math/NumberTheory/Summation/Generic.agda", "max_issues_count": null, "max_issues_repo_head_hexsha": "37200ea91d34a6603d395d8ac81294068303f577", "max_issues_repo_issues_event_max_datetime": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_licenses": [ "MIT" ], "max_issues_repo_name": "rei1024/agda-misc", "max_issues_repo_path": "Math/NumberTheory/Summation/Generic.agda", "max_line_length": 51, "max_stars_count": 3, "max_stars_repo_head_hexsha": "37200ea91d34a6603d395d8ac81294068303f577", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "rei1024/agda-misc", "max_stars_repo_path": "Math/NumberTheory/Summation/Generic.agda", "max_stars_repo_stars_event_max_datetime": "2020-04-21T00:03:43.000Z", "max_stars_repo_stars_event_min_datetime": "2020-04-07T17:49:42.000Z", "num_tokens": 433, "size": 816 }
module Type.Dependent where import Lvl open import Type private module Module where -- Dependent product type (pi-type). -- Also called: Dependent function type. -- The right-hand side's type is a function type that uses the left-hand side's type as its "domain". -- And then the type of the resulting function of the two types depends on the argument. record Π {ℓ₁ ℓ₂} (A : Type{ℓ₁}) (B : A → Type{ℓ₂}) : Type{ℓ₁ Lvl.⊔ ℓ₂} where constructor intro field apply : (a : A) → B(a) -- Dependent sum type (sigma-type). -- Also called: Dependent pair type. -- The right-hand side's type is a function type that uses the left-hand side's type as its "domain". -- And then the type of the resulting pair depends on the left-hand side. record Σ {ℓ₁ ℓ₂} (A : Type{ℓ₁}) (B : A → Type{ℓ₂}) : Type{ℓ₁ Lvl.⊔ ℓ₂} where constructor intro field left : A right : B(left) ℰ : ∀{ℓ₁ ℓ₂}{A : Type{ℓ₁}} → (A → Type{ℓ₂}) → Type{ℓ₁ Lvl.⊔ ℓ₂} ℰ {A = A} B = Module.Σ A B module ℰ where pattern intro {left} right = Module.intro left right open Module public {-# BUILTIN SIGMA Σ #-}
{ "alphanum_fraction": 0.6309420916, "avg_line_length": 34.0294117647, "ext": "agda", "hexsha": "91bae74156478b4cbff5e1fe5d65faa3d0976423", "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": "Type/Dependent.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": "Type/Dependent.agda", "max_line_length": 105, "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": "Type/Dependent.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": 379, "size": 1157 }
{-# OPTIONS --without-K --safe #-} open import Categories.Category.Core module Categories.Object.Product.Limit {o ℓ e} (C : Category o ℓ e) where open import Level open import Data.Nat.Base using (ℕ) open import Data.Fin.Base using (Fin) open import Data.Fin.Patterns open import Categories.Category.Lift open import Categories.Category.Finite.Fin open import Categories.Category.Finite.Fin.Construction.Discrete open import Categories.Object.Product C open import Categories.Diagram.Limit open import Categories.Functor.Core import Categories.Category.Construction.Cones as Co import Categories.Morphism.Reasoning as MR private module C = Category C open C open MR C open HomReasoning module _ {o′ ℓ′ e′} {F : Functor (liftC o′ ℓ′ e′ (Discrete 2)) C} where private module F = Functor F open F limit⇒product : Limit F → Product (F₀ (lift 0F)) (F₀ (lift 1F)) limit⇒product L = record { A×B = apex ; π₁ = proj (lift 0F) ; π₂ = proj (lift 1F) ; ⟨_,_⟩ = λ f g → rep record { apex = record { ψ = λ { (lift 0F) → f ; (lift 1F) → g } ; commute = λ { {lift 0F} {lift 0F} (lift 0F) → elimˡ identity ; {lift 1F} {lift 1F} (lift 0F) → elimˡ identity } } } ; project₁ = commute ; project₂ = commute ; unique = λ {_} {h} eq eq′ → terminal.!-unique record { arr = h ; commute = λ { {lift 0F} → eq ; {lift 1F} → eq′ } } } where open Limit L module _ o′ ℓ′ e′ A B where open Equiv product⇒limit-F : Functor (liftC o′ ℓ′ e′ (Discrete 2)) C product⇒limit-F = record { F₀ = λ { (lift 0F) → A ; (lift 1F) → B } ; F₁ = λ { {lift 0F} {lift 0F} _ → C.id ; {lift 1F} {lift 1F} _ → C.id } ; identity = λ { {lift 0F} → refl ; {lift 1F} → refl } ; homomorphism = λ { {lift 0F} {lift 0F} {lift 0F} → sym identity² ; {lift 1F} {lift 1F} {lift 1F} → sym identity² } ; F-resp-≈ = λ { {lift 0F} {lift 0F} _ → refl ; {lift 1F} {lift 1F} _ → refl } } module _ o′ ℓ′ e′ {A B} (p : Product A B) where open Product p private F = product⇒limit-F o′ ℓ′ e′ A B open Functor F product⇒limit : Limit F product⇒limit = record { terminal = record { ⊤ = record { N = A×B ; apex = record { ψ = λ { (lift 0F) → π₁ ; (lift 1F) → π₂ } ; commute = λ { {lift 0F} {lift 0F} (lift 0F) → identityˡ ; {lift 1F} {lift 1F} (lift 0F) → identityˡ } } } ; ! = λ {K} → let open Co.Cone F K in record { arr = ⟨ ψ (lift 0F) , ψ (lift 1F) ⟩ ; commute = λ { {lift 0F} → project₁ ; {lift 1F} → project₂ } } ; !-unique = λ {K} f → let module K = Co.Cone F K module f = Co.Cone⇒ F f in begin ⟨ K.ψ (lift 0F) , K.ψ (lift 1F) ⟩ ≈˘⟨ ⟨⟩-cong₂ f.commute f.commute ⟩ ⟨ π₁ ∘ f.arr , π₂ ∘ f.arr ⟩ ≈⟨ g-η ⟩ f.arr ∎ } }
{ "alphanum_fraction": 0.4947948561, "avg_line_length": 30.523364486, "ext": "agda", "hexsha": "60fe46a373f8672b70af4a3838e02a2c3bce15da", "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": "5a49c6ac87cbb7e20511c28f28205163fe69f48f", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "laMudri/agda-categories", "max_forks_repo_path": "src/Categories/Object/Product/Limit.agda", "max_issues_count": null, "max_issues_repo_head_hexsha": "5a49c6ac87cbb7e20511c28f28205163fe69f48f", "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": "laMudri/agda-categories", "max_issues_repo_path": "src/Categories/Object/Product/Limit.agda", "max_line_length": 78, "max_stars_count": null, "max_stars_repo_head_hexsha": "5a49c6ac87cbb7e20511c28f28205163fe69f48f", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "laMudri/agda-categories", "max_stars_repo_path": "src/Categories/Object/Product/Limit.agda", "max_stars_repo_stars_event_max_datetime": null, "max_stars_repo_stars_event_min_datetime": null, "num_tokens": 1131, "size": 3266 }
module Scratch.FinDecEq1 where open import Data.Bool.Base hiding (_≤_) open import Data.Product open import Data.Sum open import Level renaming (suc to lsuc; _⊔_ to _⊔ℓ_; zero to lzero) open import Relation.Nullary open import Relation.Nullary.Decidable open import Relation.Unary using (Decidable) open import Relation.Binary hiding (Decidable) open import Function.Base -- open import Function.Bijection hiding (_∘_) -- open import Function.Equality hiding (≡-setoid; _∘_) open import Data.Nat.Base hiding (_≤_) open import Data.Fin renaming (zero to fzero; suc to fsuc) open import Data.Fin.Properties hiding (to-from) -- see http://firsov.ee/finset/finset.pdf open import Data.List.Base renaming (tabulate to tab; lookup to nth; filter to lfilter; allFin to allF) open import Data.List.Properties open import Data.List.Relation.Unary.Any -- open import Data.List.Membership.Propositional renaming (_∈_ to _∈ℓ_) -- open import Data.List.Membership.Propositional.Properties open import Data.List.Relation.Unary.Any as Any -- hiding (tail) open import Data.List.Relation.Unary.Any.Properties hiding (tabulate⁺) open import Data.List.Relation.Unary.All as All hiding (tabulate) open import Data.List.Relation.Unary.AllPairs as AllPairs open import Data.List.Relation.Unary.AllPairs.Properties renaming (map⁺ to ap-map⁺) -- :-( can't use Vector because it doesn't have a filter -- open import Data.Vec.Functional as Coll -- open import Data.Vec.Functional.Relation.Unary.Any -- renaming (here to here'; there to there') open import Relation.Binary.PropositionalEquality as Eq open Eq.≡-Reasoning open import Scratch.Data.List.Relation.Helpers open import Scratch.Subset -- record StronglyFiniteSetoid (n : ℕ) : Set (lsuc (c ⊔ℓ ℓ)) where -- field -- S : Setoid c ℓ -- χ : Bijection (≡-setoid n) S -- -- open Setoid S -- open Bijection χ -- open Π to renaming (_⟨$⟩_ to to') -- open Π from renaming (_⟨$⟩_ to from') -- -- ι : Fin n → Carrier -- ι x = to' x -- -- ρ : Carrier → Fin n -- ρ y = from' y -- TODO: pullback of ω where ω ≤ _≈_ (see orbital relation) -- /Users/amantini/dev/agda/agda-stdlib/README/Data/Interleaving.agda -- if ω is decidable then the pullback is a FinDecEq open import Data.Vec hiding (length) renaming (lookup to vlookup) open import Data.Vec.Properties -- open import Data.Vec.Relation.Unary.Any open import Data.Fin.Subset open import Data.Fin.Subset.Properties lmap = Data.List.Base.map syntax lmap (λ x → B) L = ⟦ B ∣ x ∈ℓ L ⟧ fsuc∈ : ∀ {n} → { p : Subset n} → {x : Fin n} → {s : Side} → (x ∈ p) → (fsuc x) ∈ (s Data.Vec.∷ p) fsuc∈ here = there here fsuc∈ (there x∈p) = there (fsuc∈ x∈p) fst₊ : ∀ {n} → (s : Subset n) → Nonempty s → Σ (Fin n) (λ x → ( x ∈ s × (∀ {y} → (y ∈ s) → x ≤ y ))) fst₊ {suc n} (inside ∷ rest) ne = ( fzero , here , λ _ → z≤n ) fst₊ {suc n} (outside ∷ rest) ne with (∃-toSum ne) ... | inj₂ b = let w = drop-there (proj₂ b) z = (proj₁ b , w) ( a , bb , c ) = (fst₊ rest z) in (fsuc a , fsuc∈ bb , λ { (there y∈s) → s≤s (c y∈s) } ) fst₋ : ∀ {n} → (s : Subset n) → Nonempty s → Fin n fst₋ s ne = proj₁ (fst₊ s ne) fst₋unique : ∀ {n} → ∀ (s t : Subset n) → (ns : Nonempty s) → (nt : Nonempty t) → s ≡ t → (fst₋ s ns) ≡ (fst₋ t nt) fst₋unique s t ns nt s≡t = let fs , fs∈s , fs≤ = (fst₊ s ns) ft , ft∈t , ft≤ = (fst₊ t nt) ft∈s : ft ∈ s ft∈s = subst _ (sym s≡t) ft∈t fs∈t : fs ∈ t fs∈t = subst _ s≡t fs∈s in ≤-antisym (fs≤ ft∈s) (ft≤ fs∈t) open import Data.Unit hiding (_≟_; ⊤) -- TODO: see src/Data/List/Membership/Setoid.agda -- see src/Relation/Nullary/Decidable.agda ≡→T : ∀ {b : Bool} → b ≡ true → T b ≡→T refl = tt record FinDecEq {a} (n : ℕ) : Set (lsuc a) where field _ω_ : Rel (Fin n) a isDecEq : IsDecEquivalence _ω_ std : DecSetoid _ _ std = record { Carrier = (Fin n) ; _≈_ = _ω_ ; isDecEquivalence = isDecEq } open DecSetoid std renaming (_≟_ to _ω?_ ; refl to r ; sym to s ; trans to t ; Carrier to F; setoid to std') public import Data.List.Membership.Propositional module MP = Data.List.Membership.Propositional {A = F} open MP renaming (_∈_ to _∈ℓ_) -- open import Data.List.Membership.Propositional renaming (_∈_ to _∈ℓ_) open import Data.List.Membership.Propositional.Properties [_]ω : (Fin n) → Subset n [ o ]ω = tabulate (does ∘ (_ω? o)) -- TODO: use src/Data/List/Membership/Setoid.agda -- and src/Data/Fin/Subset/Properties.agda ω⇒∈ : ∀ {x y} → x ω y → x ∈ [ y ]ω ω⇒∈ {x} {y} xωy = let lkp = begin vlookup [ y ]ω x ≡⟨ lookup∘tabulate _ x ⟩ does (x ω? y) ≡⟨ dec-true (x ω? y) xωy ⟩ true ∎ in lookup⇒[]= x [ y ]ω lkp -- in particular classes are not empty o∈[o]ω : ∀ { o : Fin n } → o ∈ [ o ]ω o∈[o]ω = ω⇒∈ r -- and actually equal -- conversely ∈⇒ω : ∀ {x y} → x ∈ [ y ]ω → x ω y ∈⇒ω {x} {y} x∈[y] = let w = begin true ≡˘⟨ []=⇒lookup x∈[y] ⟩ vlookup [ y ]ω x ≡⟨ lookup∘tabulate _ x ⟩ does (x ω? y) ≡˘⟨ isYes≗does _ ⟩ isYes (x ω? y) ∎ r : True (x ω? y) r = ≡→T (sym w) in toWitness r ω⇒⊆ : ∀ {x y} → x ω y → [ x ]ω ⊆ [ y ]ω ω⇒⊆ {x} {y} xωy {s} s∈[x] = ω⇒∈ (t (∈⇒ω s∈[x]) xωy ) ω⇒≡ : ∀ {x y} → x ω y → [ x ]ω ≡ [ y ]ω ω⇒≡ {x} {y} xωy = ⊆-antisym (ω⇒⊆ xωy) (ω⇒⊆ (s xωy)) -- canonical choice - TODO c : F → F c f = fst₋ {n} [ f ]ω ( f , o∈[o]ω ) -- cx∈[x] : ∀ (x : Fin n) → (c x) ∈ [ x ]ω cx∈[x] x = proj₁ (proj₂ (fst₊ [ x ]ω ( x , o∈[o]ω ))) xωcx : ∀ (x : F) → x ω (c x) xωcx x = s (∈⇒ω (cx∈[x] x)) -- c⇒ω : ∀ {x y} → c x ≡ c y → x ω y c⇒ω {x} {y} cx≡cy = let P = λ q → q ∈ [ y ]ω w : (c x) ∈ [ y ]ω w = subst P (sym cx≡cy) (cx∈[x] y) in t (xωcx x) (∈⇒ω w) -- ω⇒c : ∀ {x y} → x ω y → c x ≡ c y ω⇒c {x} {y} xωy = fst₋unique _ _ _ _ (ω⇒≡ xωy) c-idempt : (x : F) → c (c x) ≡ c x c-idempt x = ω⇒c {c x} {x} (s (xωcx x)) ω-disj : ∀ {x y} → ¬ (x ω y) → Empty ([ x ]ω ∩ [ y ]ω) ω-disj {x} {y} ¬xωy f∈∩ = let f , [x]∩[y] = f∈∩ l , r = x∈p∩q⁻ _ _ [x]∩[y] fωx : f ω x fωx = ∈⇒ω l fωy = ∈⇒ω r in ¬xωy (t (s fωx) fωy) ω-Disj : ∀ {x y} → ¬ (x ω y) → Disj [ x ]ω [ y ]ω ω-Disj ¬xωy = Empty-unique (ω-disj ¬xωy) -- canonical representative cr : (i : F) → Set cr i = i ≡ (c i) -- c' : (i : F) → cr i × i ω (c i) -- _≟_ cr? : Decidable cr cr? = λ i → i ≟ (c i) cr-disj : ∀ {x y} → (cr x) → (cr y) → x ≢ y → ¬ (x ω y) cr-disj {x} {y} crx cry x≢y xωy = let x≡y = begin x ≡⟨ crx ⟩ c x ≡⟨ ω⇒c xωy ⟩ c y ≡˘⟨ cry ⟩ y ∎ in x≢y x≡y Tr : List F Tr = (lfilter cr? (allF n)) -- ∈-filter⁻ : ∀ {v xs} → v ∈ filter P? xs → v ∈ xs × P v -- C : List (Subset n) -- C = ⟦ [ x ]ω ∣ x ∈ℓ Tr ⟧ -- ap x≢y allF -- ap ¬ x ω y Tr -- ap Disj (map [_] Tr) ap1 : AllPairs _≢_ (allF n) ap1 = tabulate⁺ id ap2 : AllPairs (λ x y → ¬ x ω y) Tr ap2 = filter⁺⁺ cr? cr-disj ap1 ap3 : AllPairs Disj ⟦ [ x ]ω ∣ x ∈ℓ Tr ⟧ ap3 = ap-map⁺ (AllPairs.map ω-Disj ap2) C-cover' : ∀ (x : F) → (∃ λ k → cr k × x ω k) C-cover' x = (c x) , sym (c-idempt x) , xωcx x C-cover : ∀ (x : F) → Any (x ∈_) ⟦ [ x ]ω ∣ x ∈ℓ Tr ⟧ C-cover x = let (k , crk , xωk) = C-cover' x k∈ℓallF : k ∈ℓ allF n k∈ℓallF = ∈-allFin {n} k k∈ℓTr : k ∈ℓ Tr k∈ℓTr = ∈-filter⁺ cr? k∈ℓallF crk a : Any (x ω_) Tr a = lose k∈ℓTr xωk b : Any ((x ∈_) ∘ [_]ω) Tr b = Any.map ω⇒∈ a -- map⁺ : Any (P ∘ f) xs → Any P (List.map f xs) in map⁺ b -- []ω-cover : ⊤ ≡ ⋃ ⟦ [ x ]ω ∣ x ∈ℓ Tr ⟧ []ω-cover = cover-⊤ ⟦ [ x ]ω ∣ x ∈ℓ Tr ⟧ C-cover -- Cardinality : n ≡ Data.List.Base.sum ⟦ ∣ [ x ]ω ∣ ∣ x ∈ℓ Tr ⟧ -- Cardinality = -- let c = ∣⋃ᵢpᵢ∣≡Σᵢ∣pᵢ∣ ⟦ [ x ]ω ∣ x ∈ℓ Tr ⟧ ap3 -- in begin -- n ≡˘⟨ ∣⊤∣≡n n ⟩ -- ∣ ⊤ {n} ∣ ≡⟨ cong ∣_∣ []ω-cover ⟩ -- ∣ ⋃ ⟦ [ x ]ω ∣ x ∈ℓ Tr ⟧ ∣ ≡⟨ c ⟩ -- -- cong List.sum (map-compose λ t → ∣ [ t ]ω ∣ ) refl -- Data.List.Base.sum (lmap ∣_∣ ⟦ [ x ]ω ∣ x ∈ℓ Tr ⟧) ≡˘⟨ ? ⟩ -- Data.List.Base.sum ⟦ ∣ [ x ]ω ∣ ∣ x ∈ℓ Tr ⟧ ∎
{ "alphanum_fraction": 0.4762787654, "avg_line_length": 33.2210144928, "ext": "agda", "hexsha": "4a0ea43afec71e24f6d20cb96cf547d2cce05282", "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": "e2d6b5f9bea15dd67817bf67e273f6b9a14335af", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "zampino/ggt", "max_forks_repo_path": "src/scratch/FinDecEq1.agda", "max_issues_count": null, "max_issues_repo_head_hexsha": "e2d6b5f9bea15dd67817bf67e273f6b9a14335af", "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": "zampino/ggt", "max_issues_repo_path": "src/scratch/FinDecEq1.agda", "max_line_length": 100, "max_stars_count": 2, "max_stars_repo_head_hexsha": "e2d6b5f9bea15dd67817bf67e273f6b9a14335af", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "zampino/ggt", "max_stars_repo_path": "src/scratch/FinDecEq1.agda", "max_stars_repo_stars_event_max_datetime": "2020-11-28T05:48:39.000Z", "max_stars_repo_stars_event_min_datetime": "2020-04-17T11:10:00.000Z", "num_tokens": 3646, "size": 9169 }
module Web.Semantic.DL.Signature where infixr 4 _,_ -- a Signature is constructed from Concept Names and Role/Relation Names data Signature : Set₁ where _,_ : (CN RN : Set) → Signature -- concept name (maps to Sets) CN : Signature → Set CN (CN , RN) = CN -- Role Names (or relation names) RN : Signature → Set RN (CN , RN) = RN
{ "alphanum_fraction": 0.6886227545, "avg_line_length": 20.875, "ext": "agda", "hexsha": "8db396dd7a181a6f298e36566ac53f4c3f736c2e", "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": "38fbc3af7062ba5c3d7d289b2b4bcfb995d99057", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "bblfish/agda-web-semantic", "max_forks_repo_path": "src/Web/Semantic/DL/Signature.agda", "max_issues_count": null, "max_issues_repo_head_hexsha": "38fbc3af7062ba5c3d7d289b2b4bcfb995d99057", "max_issues_repo_issues_event_max_datetime": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_licenses": [ "MIT" ], "max_issues_repo_name": "bblfish/agda-web-semantic", "max_issues_repo_path": "src/Web/Semantic/DL/Signature.agda", "max_line_length": 72, "max_stars_count": 1, "max_stars_repo_head_hexsha": "38fbc3af7062ba5c3d7d289b2b4bcfb995d99057", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "bblfish/agda-web-semantic", "max_stars_repo_path": "src/Web/Semantic/DL/Signature.agda", "max_stars_repo_stars_event_max_datetime": "2022-02-22T09:43:23.000Z", "max_stars_repo_stars_event_min_datetime": "2022-02-22T09:43:23.000Z", "num_tokens": 98, "size": 334 }
------------------------------------------------------------------------ -- The Agda standard library -- -- Every respectful binary relation induces a preorder. No claim is -- made that this preorder is unique. ------------------------------------------------------------------------ {-# OPTIONS --without-K --safe #-} open import Relation.Binary open Setoid using (Carrier) module Relation.Binary.Construct.FromRel {s₁ s₂} (S : Setoid s₁ s₂) -- The underlying equality {a r} {A : Set a} (_R_ : REL A (Carrier S) r) -- The relation where open import Data.Product open import Function open import Level using (_⊔_) open module Eq = Setoid S using (_≈_) renaming (Carrier to B) ------------------------------------------------------------------------ -- Definition Resp : Rel B (a ⊔ r) Resp x y = ∀ {a} → a R x → a R y ------------------------------------------------------------------------ -- Properties reflexive : (∀ {a} → (a R_) Respects _≈_) → _≈_ ⇒ Resp reflexive resp x≈y = resp x≈y trans : Transitive Resp trans x∼y y∼z = y∼z ∘ x∼y isPreorder : (∀ {a} → (a R_) Respects _≈_) → IsPreorder _≈_ Resp isPreorder resp = record { isEquivalence = Eq.isEquivalence ; reflexive = reflexive resp ; trans = trans } preorder : (∀ {a} → (a R_) Respects _≈_) → Preorder _ _ _ preorder resp = record { isPreorder = isPreorder resp }
{ "alphanum_fraction": 0.5086580087, "avg_line_length": 27.72, "ext": "agda", "hexsha": "c228bd1f7b68348496c193ebdd54c79dd98e88ae", "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": "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/Construct/FromRel.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/Construct/FromRel.agda", "max_line_length": 74, "max_stars_count": 5, "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/Construct/FromRel.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": 369, "size": 1386 }
module regular-star where open import Level renaming ( suc to Suc ; zero to Zero ) open import Data.List open import Data.Nat hiding ( _≟_ ) open import Data.Fin hiding ( _+_ ) open import Data.Empty open import Data.Unit open import Data.Product -- open import Data.Maybe open import Relation.Nullary open import Relation.Binary.PropositionalEquality hiding ( [_] ) open import logic open import nat open import automaton open import regular-language open import nfa open import sbconst2 open import finiteSet open import finiteSetUtil open import Relation.Binary.PropositionalEquality hiding ( [_] ) open import regular-concat open Automaton open FiniteSet open RegularLanguage Star-NFA : {Σ : Set} → (A : RegularLanguage Σ ) → NAutomaton (states A ) Σ Star-NFA {Σ} A = record { Nδ = δnfa ; Nend = nend } module Star-NFA where δnfa : states A → Σ → states A → Bool δnfa q i q₁ with aend (automaton A) q ... | true = equal? (afin A) ( astart A) q₁ ... | false = equal? (afin A) (δ (automaton A) q i) q₁ nend : states A → Bool nend q = aend (automaton A) q Star-NFA-start : {Σ : Set} → (A : RegularLanguage Σ ) → states A → Bool Star-NFA-start A q = equal? (afin A) (astart A) q \/ aend (automaton A) q SNFA-exist : {Σ : Set} → (A : RegularLanguage Σ ) → (states A → Bool) → Bool SNFA-exist A qs = exists (afin A) qs M-Star : {Σ : Set} → (A : RegularLanguage Σ ) → RegularLanguage Σ M-Star {Σ} A = record { states = states A → Bool ; astart = Star-NFA-start A ; afin = fin→ (afin A) ; automaton = subset-construction (SNFA-exist A ) (Star-NFA A ) } open Split open _∧_ open NAutomaton open import Data.List.Properties closed-in-star : {Σ : Set} → (A B : RegularLanguage Σ ) → ( x : List Σ ) → isRegular (Star (contain A) ) x ( M-Star A ) closed-in-star {Σ} A B x = ≡-Bool-func closed-in-star→ closed-in-star← where NFA = (Star-NFA A ) closed-in-star→ : Star (contain A) x ≡ true → contain (M-Star A ) x ≡ true closed-in-star→ star = {!!} open Found closed-in-star← : contain (M-Star A ) x ≡ true → Star (contain A) x ≡ true closed-in-star← C with subset-construction-lemma← (SNFA-exist A ) NFA {!!} x C ... | CC = {!!}
{ "alphanum_fraction": 0.6412516527, "avg_line_length": 29.4675324675, "ext": "agda", "hexsha": "df6c57d9c4a5497b18535f6543357d0c01433d32", "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/regular-star.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/regular-star.agda", "max_line_length": 121, "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/regular-star.agda", "max_stars_repo_stars_event_max_datetime": null, "max_stars_repo_stars_event_min_datetime": null, "num_tokens": 726, "size": 2269 }
-- Andreas, Ulf, 2022-05-06, AIM XXXV -- Make sure you cannot trick Agda into admitting data types in IUniv. -- The previous check let this exploit through. -- Note: I : IUniv : SSet₁ open import Agda.Primitive.Cubical mutual Univ = _ data False : Univ where I' : Univ I' = I -- Should fail. -- Error: -- The universe _6 of False -- is unresolved, thus does not permit data or record declarations -- when checking the definition of False
{ "alphanum_fraction": 0.7050997783, "avg_line_length": 21.4761904762, "ext": "agda", "hexsha": "fabcbd2c65c1f0d15d5f08ce7edee34c342db4a6", "lang": "Agda", "max_forks_count": null, "max_forks_repo_forks_event_max_datetime": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_head_hexsha": "98c9382a59f707c2c97d75919e389fc2a783ac75", "max_forks_repo_licenses": [ "BSD-2-Clause" ], "max_forks_repo_name": "KDr2/agda", "max_forks_repo_path": "test/Fail/Issue5891DataInIUniv.agda", "max_issues_count": 6, "max_issues_repo_head_hexsha": "98c9382a59f707c2c97d75919e389fc2a783ac75", "max_issues_repo_issues_event_max_datetime": "2021-11-24T08:31:10.000Z", "max_issues_repo_issues_event_min_datetime": "2021-10-18T08:12:24.000Z", "max_issues_repo_licenses": [ "BSD-2-Clause" ], "max_issues_repo_name": "KDr2/agda", "max_issues_repo_path": "test/Fail/Issue5891DataInIUniv.agda", "max_line_length": 70, "max_stars_count": null, "max_stars_repo_head_hexsha": "98c9382a59f707c2c97d75919e389fc2a783ac75", "max_stars_repo_licenses": [ "BSD-2-Clause" ], "max_stars_repo_name": "KDr2/agda", "max_stars_repo_path": "test/Fail/Issue5891DataInIUniv.agda", "max_stars_repo_stars_event_max_datetime": null, "max_stars_repo_stars_event_min_datetime": null, "num_tokens": 129, "size": 451 }
module Run where open import Data.Bool open import Data.Maybe open import Data.Nat open import Data.List open import Data.List.All open import Typing open import Syntax open import Global open import Channel open import Values open import Session open import Schedule open import Examples open import Aexamples gas : ℕ → Gas gas zero = Empty gas (suc n) = More (gas n) -- the magic number shows the last state before termination -- runs to completion: the magic number is 7 runex1 : Outcome runex1 = start (gas 8) ex1 -- runs to completion, but gets slow at 9 runex2 : Outcome runex2 = start (gas 14) ex2 -- need more steps, but gets *very* slow runex3 : Outcome runex3 = start (gas 6) ex3 -- runs to completion runex4 : Outcome runex4 = start (gas 11) ex4 -- just lambda calculus -- runs to completion: the magic number is 2 runex5 : Outcome runex5 = start (gas 3) ex5 -- just lambda calculus -- magic number is 6 runex6 : Outcome runex6 = start (gas 7) ex6 -- now asynchronous examples runaex1 : Outcome runaex1 = start (gas 40) aex1 runasyncex1 : Outcome runasyncex1 = start (gas 40) asyncex1 runasyncex2 : Outcome runasyncex2 = start (gas 80) asyncex2
{ "alphanum_fraction": 0.7452991453, "avg_line_length": 19.1803278689, "ext": "agda", "hexsha": "440d887d30771ec0efab0001a2d656d38fa72b96", "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": "c2213909c8a308fb1c1c1e4e789d65ba36f6042c", "max_forks_repo_licenses": [ "BSD-3-Clause" ], "max_forks_repo_name": "peterthiemann/definitional-session", "max_forks_repo_path": "src/Run.agda", "max_issues_count": null, "max_issues_repo_head_hexsha": "c2213909c8a308fb1c1c1e4e789d65ba36f6042c", "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": "peterthiemann/definitional-session", "max_issues_repo_path": "src/Run.agda", "max_line_length": 59, "max_stars_count": 9, "max_stars_repo_head_hexsha": "c2213909c8a308fb1c1c1e4e789d65ba36f6042c", "max_stars_repo_licenses": [ "BSD-3-Clause" ], "max_stars_repo_name": "peterthiemann/definitional-session", "max_stars_repo_path": "src/Run.agda", "max_stars_repo_stars_event_max_datetime": "2021-01-18T08:10:14.000Z", "max_stars_repo_stars_event_min_datetime": "2019-01-19T16:33:27.000Z", "num_tokens": 358, "size": 1170 }
import Lvl open import Type module Type.Cardinality.Proofs {ℓₗ : Lvl.Level} where open import Functional import Logic.Predicate import Logic.Predicate.Theorems import Relator.Equals import Relator.Equals.Proofs import Type.Cardinality import Type.Functions import Type.Functions.Proofs import Type.Functions.Inverse import Type.Functions.Inverse.Proofs module _ {ℓₒ₁}{ℓₒ₂} {X : Type{ℓₒ₁}} {Y : Type{ℓₒ₂}} where open Logic.Predicate {ℓₗ} open Logic.Predicate.Theorems {ℓₗ} open Type.Cardinality {ℓₗ} open Type.Functions {ℓₗ} open Type.Functions.Inverse {ℓₗ} open Type.Functions.Inverse.Proofs {ℓₗ} open Type.Functions.Proofs {ℓₗ} instance [≍]-to-[≼] : ⦃ _ : X ≍ Y ⦄ → (X ≼ Y) [≍]-to-[≼] ⦃ proof ⦄ = [∃]-map (proof ↦ bijective-to-injective ⦃ proof ⦄) proof instance [≍]-to-[≽] : ⦃ _ : X ≍ Y ⦄ → (X ≼ Y) [≍]-to-[≽] ⦃ proof ⦄ = [∃]-map (proof ↦ bijective-to-injective ⦃ proof ⦄) proof [≍]-symmetry : (X ≍ Y) → (Y ≍ X) [≍]-symmetry ([∃]-intro f ⦃ proof ⦄) = [∃]-intro (inv f ⦃ proof ⦄) ⦃ inv-bijective {ℓₒ₁}{ℓₒ₂} {_}{_} {f} ⦃ proof ⦄ ⦄ -- TODO: Is it possible to prove these? -- [≍]-antisymmetry : (X ≼ Y) → (X ≽ Y) → (X ≍ Y) -- [≍]-antisymmetry = [∃]-map () -- [≼][≽]-swap : (X ≼ Y) → (Y ≽ X) -- [≽][≼]-swap : (X ≽ Y) → (Y ≼ X) module _ {ℓₒ} {X : Type{ℓₒ}} where open Logic.Predicate {ℓₗ Lvl.⊔ ℓₒ} open Logic.Predicate.Theorems {ℓₗ Lvl.⊔ ℓₒ} open Type.Cardinality {ℓₗ Lvl.⊔ ℓₒ} open Type.Functions.Proofs {ℓₗ Lvl.⊔ ℓₒ} instance [≍]-reflexivity : (X ≍ X) [≍]-reflexivity = [∃]-intro (id) ⦃ id-is-bijective ⦄ instance [≼]-reflexivity : (X ≼ X) [≼]-reflexivity = [∃]-intro(id) ⦃ bijective-to-injective ⦃ id-is-bijective ⦄ ⦄ instance [≽]-reflexivity : (X ≽ X) [≽]-reflexivity = [∃]-intro(id) ⦃ bijective-to-surjective ⦃ id-is-bijective ⦄ ⦄ module _ {ℓₒ} {X : Type{ℓₒ}} {Y : Type{ℓₒ}} where open Type.Cardinality {ℓₗ Lvl.⊔ ℓₒ} open Relator.Equals {ℓₗ Lvl.⊔ ℓₒ}{Lvl.𝐒(ℓₒ)} [≡]-to-[≍] : (X ≡ Y) → (X ≍ Y) [≡]-to-[≍] [≡]-intro = [≍]-reflexivity
{ "alphanum_fraction": 0.5574448529, "avg_line_length": 32, "ext": "agda", "hexsha": "e433950842ac64f05c01ab02a2a045973df8e1a6", "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": "old/Type/Cardinality/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": "old/Type/Cardinality/Proofs.agda", "max_line_length": 118, "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": "old/Type/Cardinality/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": 983, "size": 2176 }
-- Andreas, 2016-06-03, bug found by Ulf -- {-# OPTIONS -v tc.cover:20 #-} open import Agda.Builtin.Bool open import Agda.Builtin.Equality record Σ (A : Set) (B : A → Set) : Set where constructor _,_ field fst : A snd : B fst open Σ record ⊤ : Set where data ⊥ : Set where T : Bool → Set T true = ⊤ T false = ⊥ p : Σ Bool T fst p = false p = true , _ loop : ⊥ loop = snd p
{ "alphanum_fraction": 0.6035805627, "avg_line_length": 15.0384615385, "ext": "agda", "hexsha": "dd2471acaa0a68d7954cb6dba851a23fb37a9c1a", "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/Issue1986u.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/Issue1986u.agda", "max_line_length": 44, "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/Issue1986u.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": 143, "size": 391 }
module Data.List.Relation.Permutation where import Data open import Data.Boolean open import Data.List open import Data.List.Functions renaming (module LongOper to List) open import Data.List.Relation open import Functional using (id ; _∘_ ; const) open import Logic.Propositional open import Logic import Lvl open import Numeral.Finite open import Syntax.Function open import Type private variable ℓ : Lvl.Level private variable T A B : Type{ℓ} private variable l l₁ l₂ l₃ l₄ : List(T) private variable x y z : T private variable f : A → B private variable P : T → Bool -- The relation for two lists that are permutations of each other. -- This means that they contain the same elements and the same number of them but possibly in a different order. -- Or in other words, the first list is a reordered list of the second. data _permutes_ {ℓ} : List{ℓ}(T) → List{ℓ}(T) → Stmt{Lvl.𝐒(ℓ)} where empty : ∅ permutes (∅ {T = T}) prepend : (l₁ permutes l₂) → ((x ⊰ l₁) permutes (x ⊰ l₂)) swap : (x ⊰ y ⊰ l) permutes (y ⊰ x ⊰ l) trans : (l₁ permutes l₂) → (l₂ permutes l₃) → (l₁ permutes l₃) trans-swap : (l₁ permutes l₂) → ((x ⊰ y ⊰ l₁) permutes (y ⊰ x ⊰ l₂)) trans-swap p = trans swap (prepend (prepend p)) -- TODO -- _partition-of_ : List(List(T)) → List(T) → Stmt -- p partition-of l = (foldᵣ (x ↦ ¬ Empty(x) ∧_) Data.Unit p) ∧ (concat(p) permutes l) -- The permutation as a function between the permutated elements' indices. -- Example: -- p : [a,b,c,d,e,f] permutes [a,f,e,d,b,c] -- map(permutation-mapping(p)) [0,1,2,3,4,5] = [0,4,5,3,2,1] permutation-mapping : (l₁ permutes l₂) → (𝕟(length(l₁)) → 𝕟(length(l₂))) permutation-mapping empty = id permutation-mapping (prepend p) 𝟎 = 𝟎 permutation-mapping (prepend p) (𝐒 n) = 𝐒(permutation-mapping p n) permutation-mapping swap 𝟎 = 𝐒(𝟎) permutation-mapping swap (𝐒 𝟎) = 𝟎 permutation-mapping swap (𝐒(𝐒 n)) = 𝐒 (𝐒 n) permutation-mapping (trans p q) = permutation-mapping q ∘ permutation-mapping p -- TODO: It should be possible to make (_permutes_) the morphism of a category with some correct notion of equivalence (maybe trans swap swap ≡ refl for example?). Then permutation-mapping would be an instance of Functor(length) for the ((_→_) on₂ 𝕟) category? module Proofs where open import Data.List.Proofs open import Data.List.Equiv.Id open import Lang.Inspect open import Logic.Predicate open import Numeral.Natural open import Numeral.Finite.Proofs open import Relator.Equals open import Relator.Equals.Proofs open import Structure.Function.Domain open import Structure.Function.Domain.Proofs import Structure.Function.Names as Names open import Structure.Function.Proofs open import Structure.Function import Structure.Operator.Names as Names open import Structure.Operator.Properties open import Structure.Operator import Structure.Relator.Names as Names open import Structure.Relator.Equivalence open import Structure.Relator.Properties open import Structure.Setoid using (Equiv) open import Syntax.Function open import Syntax.Transitivity instance permutes-reflexivity : Reflexivity(_permutes_ {T = T}) permutes-reflexivity = intro proof where proof : Names.Reflexivity(_permutes_) proof {∅} = empty proof {_ ⊰ _} = prepend proof instance permutes-symmetry : Symmetry(_permutes_ {T = T}) permutes-symmetry = intro proof where proof : Names.Symmetry(_permutes_) proof empty = empty proof (prepend p) = prepend (proof p) proof swap = swap proof (trans p q) = trans (proof q) (proof p) instance permutes-transitivity : Transitivity(_permutes_ {T = T}) permutes-transitivity = intro trans instance permutes-equivalence : Equivalence(_permutes_ {T = T}) permutes-equivalence = intro permutes-equiv : Equiv(List(T)) Equiv._≡_ permutes-equiv = _permutes_ Equiv.equivalence permutes-equiv = permutes-equivalence -- If permutation relation had empty, prepend and trans-swap module _ where swap-from-trans-swap : (x ⊰ y ⊰ l) permutes (y ⊰ x ⊰ l) swap-from-trans-swap = trans-swap(reflexivity(_permutes_)) PermutationMappingCorrectness : (l₁ l₂ : List(T)) → (𝕟(length(l₁)) → 𝕟(length(l₂))) → Stmt PermutationMappingCorrectness l₁ l₂ mapping = ∀{i} → (index l₁(i) ≡ index l₂(mapping i)) permutation-mapping-correctness : (p : (l₁ permutes l₂)) → PermutationMappingCorrectness l₁ l₂ (permutation-mapping p) permutation-mapping-correctness empty = reflexivity(_≡_) permutation-mapping-correctness (prepend p) {𝟎} = reflexivity(_≡_) permutation-mapping-correctness (prepend p) {𝐒 i} = permutation-mapping-correctness p {i} permutation-mapping-correctness swap {𝟎} = reflexivity(_≡_) permutation-mapping-correctness swap {𝐒 𝟎} = reflexivity(_≡_) permutation-mapping-correctness swap {𝐒 (𝐒 i)} = reflexivity(_≡_) permutation-mapping-correctness (trans p q) = permutation-mapping-correctness p 🝖 permutation-mapping-correctness q instance permutation-mapping-injective : ∀{p : (l₁ permutes l₂)} → Injective(permutation-mapping p) permutation-mapping-injective {p = p} = intro(proof p) where proof : (p : (l₁ permutes l₂)) → Names.Injective(permutation-mapping p) proof (prepend p) {𝟎} {𝟎} eq = [≡]-intro proof (prepend p) {𝐒 x} {𝐒 y} eq = congruence₁(𝐒) (proof p (injective(𝐒) ⦃ [𝐒]-injective ⦄ eq)) proof swap {𝟎} {𝟎} eq = [≡]-intro proof swap {𝟎} {𝐒 (𝐒 y)} () proof swap {𝐒 (𝐒 x)} {𝟎} () proof swap {𝐒 𝟎} {𝐒 𝟎} eq = [≡]-intro proof swap {𝐒 (𝐒 x)} {𝐒 (𝐒 y)} eq = eq proof (trans p q) = proof p ∘ proof q instance permutation-mapping-surjective : ∀{p : (l₁ permutes l₂)} → Surjective(permutation-mapping p) permutation-mapping-surjective {p = p} = intro(proof p) where proof : (p : (l₁ permutes l₂)) → Names.Surjective(permutation-mapping p) ∃.witness (proof p {y}) = permutation-mapping(symmetry(_permutes_) p) y ∃.proof (proof (prepend p) {𝟎}) = [≡]-intro ∃.proof (proof (prepend p) {𝐒 y}) = congruence₁(𝐒) (∃.proof (proof p {y})) ∃.proof (proof swap {𝟎}) = [≡]-intro ∃.proof (proof swap {𝐒 𝟎}) = [≡]-intro ∃.proof (proof swap {𝐒 (𝐒 y)}) = [≡]-intro ∃.proof (proof (trans p q) {y}) = permutation-mapping (trans p q) (∃.witness (proof (trans p q))) 🝖[ _≡_ ]-[] (permutation-mapping (trans p q) ∘ permutation-mapping(symmetry(_permutes_) p) ∘ permutation-mapping (symmetry(_permutes_) q)) y 🝖[ _≡_ ]-[] (permutation-mapping q ∘ permutation-mapping p ∘ permutation-mapping(symmetry(_permutes_) p) ∘ permutation-mapping (symmetry(_permutes_) q)) y 🝖[ _≡_ ]-[ congruence₁(permutation-mapping q) (∃.proof (proof p {_})) ] (permutation-mapping q ∘ permutation-mapping (symmetry(_permutes_) q)) y 🝖[ _≡_ ]-[ ∃.proof (proof q {y}) ] y 🝖[ _≡_ ]-end permutation-mapping-bijective : ∀{p : (l₁ permutes l₂)} → Bijective(permutation-mapping p) permutation-mapping-bijective {p = p} = injective-surjective-to-bijective(permutation-mapping p) ⦃ permutation-mapping-injective {p = p} ⦄ ⦃ permutation-mapping-surjective {p = p} ⦄ {- permutation-from-mapping : (p : 𝕟(length(l₁)) → 𝕟(length(l₂))) ⦃ bij : Bijective(p) ⦄ (correctness : PermutationMappingCorrectness l₁ l₂ p) → (l₁ permutes l₂) permutation-from-mapping {l₁ = ∅} {l₂ = ∅} p _ = empty permutation-from-mapping {l₁ = ∅} {l₂ = x₂ ⊰ l₂} p _ = {!!} permutation-from-mapping {l₁ = x₁ ⊰ l₁} {l₂ = ∅} p _ = {!!} permutation-from-mapping {l₁ = x₁ ⊰ l₁} {l₂ = x₂ ⊰ l₂} p correctness with p(𝟎) | correctness{𝟎} ... | 𝟎 | [≡]-intro = prepend (permutation-from-mapping (forgetFirstCutoffOfBij p) ⦃ forgetFirstCutoffOfBij-bijective ⦄ {!!}) where bijective-equinumerous : ∀{a b}{f : 𝕟(a) → 𝕟(b)} → Bijective(f) → (a ≡ b) forgetFirstCutoff : ∀{a} → (𝕟(𝐒(a)) → 𝕟(𝐒(a))) → (𝕟(a) → 𝕟(a)) forgetFirstCutoff {𝐒(a)} f(x) with f(𝐒(x)) ... | 𝟎 = 𝟎 ... | 𝐒(y) = y forgetFirstCutoffOfBij : ∀{a b} → (f : 𝕟(𝐒(a)) → 𝕟(𝐒(b))) ⦃ bij : Bijective(f) ⦄ → (𝕟(a) → 𝕟(b)) forgetFirstCutoffOfBij {𝐒 a} f ⦃ bij ⦄ with [≡]-intro ← bijective-equinumerous bij = forgetFirstCutoff f forgetFirstCutoffOfBij-bijective : ∀{a b}{f : 𝕟(𝐒(a)) → 𝕟(𝐒(b))} ⦃ bij : Bijective(f) ⦄ → Bijective(forgetFirstCutoffOfBij f) -- proof : ∀{l₁ l₂ : List(T)}{p : 𝕟(length(l₁)) → 𝕟(length(l₂))} → PermutationMappingCorrectness l₁ l₂ (forgetFirstCutoffOfBij p) proof : PermutationMappingCorrectness l₁ l₂ (forgetFirstCutoffOfBij p) proof {i} = index l₁ i 🝖[ _≡_ ]-[ {!correctness!} ] index l₂ (forgetFirstCutoffOfBij p i) 🝖-end ... | 𝐒 w | _ = {!!} -} permutes-prepend-function : Function ⦃ permutes-equiv ⦄ ⦃ permutes-equiv ⦄ (List.prepend x) permutes-prepend-function = intro prepend permutes-postpend-function : Function ⦃ permutes-equiv ⦄ ⦃ permutes-equiv ⦄ (postpend x) permutes-postpend-function = intro proof where proof : (l₁ permutes l₂) → (postpend x l₁) permutes (postpend x l₂) proof empty = prepend empty proof (prepend x) = prepend (proof x) proof swap = swap proof (trans x y) = trans (proof x) (proof y) postpend-prepend-permutes : (postpend x l) permutes (List.prepend x l) postpend-prepend-permutes {l = ∅} = prepend empty postpend-prepend-permutes {l = x ⊰ l} = trans (prepend postpend-prepend-permutes) swap permutes-reverse : (reverse l) permutes l permutes-reverse {l = ∅} = empty permutes-reverse {l = x ⊰ l} = trans (Function.congruence ⦃ _ ⦄ ⦃ _ ⦄ permutes-postpend-function(permutes-reverse {l = l})) postpend-prepend-permutes permutes-length-function : Function ⦃ permutes-equiv {T = T} ⦄ (length) permutes-length-function = intro proof where proof : (l₁ permutes l₂) → (length l₁ ≡ length l₂) proof empty = [≡]-intro proof (prepend p) = congruence₁(𝐒) (proof p) proof swap = [≡]-intro proof (trans p q) = transitivity(_≡_) (proof p) (proof q) permutes-countᵣ-function : Function ⦃ permutes-equiv ⦄ (count P) permutes-countᵣ-function = intro proof where proof : (l₁ permutes l₂) → (count P l₁ ≡ count P l₂) proof empty = [≡]-intro proof {l₁ = x₁ ⊰ l₁} {P = P} (prepend {x = x} p) with P(x) ... | 𝑇 = [≡]-with 𝐒(proof {l₁ = l₁} {P = P} p) ... | 𝐹 = proof {l₁ = l₁} {P = P} p proof {P = P} (swap {x = x} {y = y}) with P(x) | P(y) ... | 𝑇 | 𝑇 = [≡]-intro ... | 𝑇 | 𝐹 = [≡]-intro ... | 𝐹 | 𝑇 = [≡]-intro ... | 𝐹 | 𝐹 = [≡]-intro proof (trans p q) = proof p 🝖 proof q permutes-satisfiesAny-functionᵣ : Function ⦃ permutes-equiv ⦄ (satisfiesAny f) permutes-satisfiesAny-functionᵣ = intro proof where proof : (l₁ permutes l₂) → (satisfiesAny f l₁ ≡ satisfiesAny f l₂) proof empty = [≡]-intro proof {f = f} (prepend{x = x} p) with f(x) ... | 𝑇 = [≡]-intro ... | 𝐹 = proof p proof {l₁ = x ⊰ y ⊰ l₁}{y ⊰ x ⊰ l₂}{f = f} (swap{x = x}{y = y}) with f(x) | f(y) | inspect f(x) | inspect f(y) ... | 𝑇 | 𝑇 | intro _ | intro _ = [≡]-intro ... | 𝑇 | 𝐹 | intro _ | intro _ with 𝑇 ← f(x) = [≡]-intro ... | 𝐹 | 𝑇 | intro _ | intro _ with 𝑇 ← f(y) = [≡]-intro ... | 𝐹 | 𝐹 | intro _ | intro _ with 𝐹 ← f(x) | 𝐹 ← f(y)= reflexivity(_≡_) proof (trans p q) = proof p 🝖 proof q {- TODO permutes-countₗ : (∀{P} → count P l₁ ≡ count P l₂) → (l₁ permutes l₂) permutes-countₗ {l₁ = ∅} {l₂ = ∅} p = empty permutes-countₗ {l₁ = ∅} {l₂ = x ⊰ l₂} p with () ← p{const 𝑇} permutes-countₗ {l₁ = x ⊰ l₁} {l₂ = ∅} p with () ← p{const 𝑇} permutes-countₗ {l₁ = x ⊰ l₁} {l₂ = x₁ ⊰ l₂} p = {!!} -- TODO: The rest of the cases from _permutes_. Maybe decidable equality on the items are required? -} permutes-[++]-function : BinaryOperator ⦃ permutes-equiv ⦄ ⦃ permutes-equiv ⦄ ⦃ permutes-equiv ⦄ (_++_ {T = T}) permutes-[++]-function = binaryOperator-from-function ⦃ _ ⦄ ⦃ _ ⦄ ⦃ _ ⦄ ⦃ \{l} → intro(R{l = l}) ⦄ ⦃ intro L ⦄ where L : Names.Congruence₁ ⦃ permutes-equiv ⦄ ⦃ permutes-equiv ⦄ (_++ l) L {l = l} empty = reflexivity(_permutes_) L {l = l} (prepend l12) = prepend (L {l = l} l12) L {l = l} swap = swap L {l = l} (trans l13 l32) = transitivity(_permutes_) (L {l = l} l13) (L {l = l} l32) R : Names.Congruence₁ ⦃ permutes-equiv ⦄ ⦃ permutes-equiv ⦄ (l ++_) R {l = ∅} l12 = l12 R {l = x ⊰ l} l12 = prepend (R {l = l} l12) permutes-[++]-commutativity : Commutativity ⦃ permutes-equiv {T = T} ⦄ (_++_) permutes-[++]-commutativity = intro(\{l₁}{l₂} → proof{l₁}{l₂}) where proof : Names.Commutativity ⦃ permutes-equiv ⦄ (_++_) proof {∅} {l₂} rewrite identityᵣ(_++_)(∅) {l₂} = reflexivity(_permutes_) proof {x ⊰ l₁} {l₂} = (x ⊰ l₁) ++ l₂ 🝖[ _permutes_ ]-[] x ⊰ (l₁ ++ l₂) 🝖[ _permutes_ ]-[ prepend (proof {l₁} {l₂}) ] x ⊰ (l₂ ++ l₁) 🝖[ _permutes_ ]-[] (x ⊰ l₂) ++ l₁ 🝖[ _permutes_ ]-[ BinaryOperator.congruence ⦃ _ ⦄ ⦃ _ ⦄ ⦃ _ ⦄ permutes-[++]-function (postpend-prepend-permutes {l = l₂}) (reflexivity(_permutes_)) ]-sym (postpend x l₂) ++ l₁ 🝖[ _permutes_ ]-[ sub₂(_≡_)(_permutes_) ([++]-middle-prepend-postpend {l₁ = l₂}{l₂ = l₁}) ] l₂ ++ (x ⊰ l₁) 🝖[ _permutes_ ]-end permutes-empty-not-empty : ¬(∅ permutes (x ⊰ l)) permutes-empty-not-empty (trans {l₂ = ∅} p q) = permutes-empty-not-empty q permutes-empty-not-empty (trans {l₂ = _ ⊰ _} p q) = permutes-empty-not-empty p permutes-map : ∀{f : A → B} → Function ⦃ permutes-equiv ⦄ ⦃ permutes-equiv ⦄ (map f) permutes-map {f = f} = intro proof where proof : Names.Congruence₁ ⦃ permutes-equiv ⦄ ⦃ permutes-equiv ⦄ (map f) proof empty = empty proof (prepend p) = prepend (proof p) proof swap = swap proof (trans p q) = trans(proof p) (proof q) permutes-on-empty : (l permutes ∅) → (l ≡ ∅) permutes-on-empty empty = [≡]-intro permutes-on-empty (trans p q) rewrite permutes-on-empty q rewrite permutes-on-empty p = [≡]-intro permutes-on-singleton : (l permutes (singleton x)) → (l ≡ singleton x) permutes-on-singleton (prepend empty) = [≡]-intro permutes-on-singleton (prepend (trans p q)) rewrite permutes-on-empty q rewrite permutes-on-empty p = [≡]-intro permutes-on-singleton (trans p q) rewrite permutes-on-singleton q rewrite permutes-on-singleton p = [≡]-intro permutes-insertIn : ∀{n} → ((insertIn x l n) permutes (x ⊰ l)) permutes-insertIn {n = 𝟎} = reflexivity(_permutes_) permutes-insertIn {l = x ⊰ l} {n = 𝐒 n} = trans (prepend (permutes-insertIn {n = n})) swap module InsertionPermutation where data _insertion-permutes_ {ℓ} : List{ℓ}(T) → List{ℓ}(T) → Stmt{Lvl.𝐒(ℓ)} where empty : ∅ insertion-permutes (∅ {T = T}) ins : (n : 𝕟₌(length l₁)) → (l₁ insertion-permutes l₂) → ((insertIn x l₁ n) insertion-permutes (x ⊰ l₂)) open import Data.List.Proofs.Length open import Relator.Equals.Proofs open import Structure.Relator insertion-permutation-mapping : (l₁ insertion-permutes l₂) → (𝕟(length(l₁)) → 𝕟(length(l₂))) insertion-permutation-mapping empty () insertion-permutation-mapping (ins 𝟎 p) 𝟎 = 𝟎 insertion-permutation-mapping (ins 𝟎 p) (𝐒 i) = 𝐒(insertion-permutation-mapping p i) insertion-permutation-mapping (ins {l₁ = x ⊰ l₁} (𝐒 n) p) 𝟎 = 𝟎 insertion-permutation-mapping (ins {l₁ = x ⊰ l₁} (𝐒 n) p) (𝐒 i) = 𝐒(insertion-permutation-mapping p (substitute₁(𝕟) (length-insertIn {l = l₁} {n = n}) i)) open import Data using () open import Numeral.Natural open import Relator.Equals open import Syntax.Number insertion-permutes-prepend : (l₁ insertion-permutes l₂) → ((x ⊰ l₁) insertion-permutes (x ⊰ l₂)) insertion-permutes-prepend p = ins 𝟎 p insertion-permutes-refl : l insertion-permutes l insertion-permutes-refl {l = ∅} = empty insertion-permutes-refl {l = x ⊰ l} = insertion-permutes-prepend insertion-permutes-refl insertion-permutes-swap : (x ⊰ y ⊰ l) insertion-permutes (y ⊰ x ⊰ l) insertion-permutes-swap = ins 1 (insertion-permutes-prepend insertion-permutes-refl) insertion-permutes-to-permutes : (l₁ insertion-permutes l₂) → (l₁ permutes l₂) insertion-permutes-to-permutes empty = empty insertion-permutes-to-permutes (ins n p) = trans Proofs.permutes-insertIn (prepend (insertion-permutes-to-permutes p)) insertion-permutes-flipped-ins : ∀{n} → (l₁ insertion-permutes l₂) → ((x ⊰ l₁) insertion-permutes (insertIn x l₂ n)) insertion-permutes-flipped-ins {n = 𝟎} empty = insertion-permutes-refl insertion-permutes-flipped-ins {n = 𝟎} (ins k p) = insertion-permutes-prepend (ins k p) insertion-permutes-flipped-ins {n = 𝐒 n} (ins k p) = ins (𝐒 k) (insertion-permutes-flipped-ins {n = n} p) insertion-permutes-sym : (l₁ insertion-permutes l₂) → (l₂ insertion-permutes l₁) insertion-permutes-sym empty = empty insertion-permutes-sym (ins n p) = insertion-permutes-flipped-ins(insertion-permutes-sym p) {- insertion-permutes-trans : (l₁ insertion-permutes l₂) → (l₃ insertion-permutes l₂) → (l₁ insertion-permutes l₃) ins2 : ∀{n₁ n₂} → (l₁ insertion-permutes l₂) → ((insertIn x l₁ n₁) insertion-permutes (insertIn x l₂ n₂)) ins2 {l₁ = l₁} {l₂} {n₁ = n₁} {𝟎} p = ins n₁ p ins2 {l₁ = .(insertIn x _ n)} {x ⊰ l₂} {n₁ = 𝟎} {𝐒 n₂} (ins n p) = insertion-permutes-trans (insertion-permutes-prepend (ins n p)) (ins(𝐒 n₂) insertion-permutes-refl) ins2 {l₁ = .(insertIn x _ n)} {x ⊰ l₂} {n₁ = 𝐒 n₁} {𝐒 n₂} (ins n p) = {!!} insertion-permutes-trans empty empty = empty insertion-permutes-trans (ins m p) (ins n q) = {!!} -- ins2(insertion-permutes-trans p q) -} {- insertion-permutation-mapping-correctness : (p : (l₁ insertion-permutes l₂)) → Proofs.PermutationMappingCorrectness l₁ l₂ (insertion-permutation-mapping p) insertion-permutation-mapping-correctness (ins {l₁ = ∅} 𝟎 p) {𝟎} = [≡]-intro insertion-permutation-mapping-correctness (ins {l₁ = x ⊰ l₁} 𝟎 p) {𝟎} = [≡]-intro insertion-permutation-mapping-correctness (ins {l₁ = x ⊰ l₁} 𝟎 p) {𝐒 i} = insertion-permutation-mapping-correctness p insertion-permutation-mapping-correctness (ins {l₁ = x ⊰ l₁} (𝐒 n) p) {𝟎} = {!!} insertion-permutation-mapping-correctness (ins {l₁ = x ⊰ l₁} (𝐒 n) p) {𝐒 i} = {!!} -} -- test : (p : (l₁ insertion-permutes l₂)) → (∀{i} → (index l₁(insertion-permutation-mapping p i) ≡ index l₂(i))) -- test p = ? {- open import Data.Boolean.Stmt open import Numeral.Finite.Oper.Comparisons test : ∀{l : List(T)}{n₁ : 𝕟(𝐒(length l))}{n₂ : 𝕟(𝐒(length (insertIn y l n₁)))} → IsTrue(n₁ >? n₂) → (insertIn y (insertIn x l n₁) n₂ ≡ insertIn x (insertIn y l n₁) n₂) test p = {!!} -} {- ins2 : ∀{n₁ n₂} → (l₁ insertion-permutes l₂) → ((insertIn x l₁ n₁) insertion-permutes (insertIn x l₂ n₂)) ins2 {n₁ = 𝟎} {𝟎} empty = insertion-permutes-refl ins2 {n₁ = n₁} {𝟎} (ins n p) = ins n₁ (ins n p) ins2 {x = x} {n₁ = n₁} {𝐒 n₂} (ins {x = y} n p) = {!(ins2 {x = x}{n₁ = n}{n₂ = n₂} p)!} insertion-permutes-trans : (l₁ insertion-permutes l₂) → (l₃ insertion-permutes l₂) → (l₁ insertion-permutes l₃) insertion-permutes-trans empty empty = empty insertion-permutes-trans (ins m p) (ins n q) = {!!} -} {- test : ∀{n} → (l₁ insertion-permutes (y ⊰ insertIn x l₂ n)) → (l₁ insertion-permutes (x ⊰ insertIn y l₂ n)) test {l₂ = l₂} (ins {l₁ = l₁} n p) = {!!} ins2 : ∀{n₁ n₂} → (l₁ insertion-permutes l₂) → ((insertIn x l₁ n₁) insertion-permutes (insertIn x l₂ n₂)) ins2 {n₁ = n₁} {𝟎} p = ins n₁ p ins2 {n₁ = n₁} {𝐒 n₂} (ins {x = x} n p) = test(ins n₁ (ins2{x = x}{n}{n₂} p)) -- insertIn x₁ (insertIn x l₁ n) n₁ -- x ⊰ insertIn x₁ l₂ n₂ tr : (l₁ insertion-permutes l₂) → (l₃ insertion-permutes l₂) → (l₁ insertion-permutes l₃) tr {l₂ = ∅} empty empty = empty tr {l₂ = x₂ ⊰ l₂} (ins n₁ p) (ins n₂ q) = ins2(tr p q) sym : (l₁ insertion-permutes l₂) → (l₂ insertion-permutes l₁) sym = tr insertion-permutes-refl -}
{ "alphanum_fraction": 0.6315137706, "avg_line_length": 49.601965602, "ext": "agda", "hexsha": "6569ef05376ccf6560bf6021296f98f7acf8160c", "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/Permutation.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/Permutation.agda", "max_line_length": 260, "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/Permutation.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": 7474, "size": 20188 }
{-# OPTIONS --without-K #-} open import lib.Basics open import lib.types.Pi open import lib.types.Sigma open import lib.types.Span open import lib.types.Paths import lib.types.Generic1HIT as Generic1HIT open import lib.types.Pushout module lib.types.PushoutFlattening {i} {j} {k} {d : Span {i} {j} {k}} where open Span d renaming (f to g; g to h) module PushoutRecType {l} (left* : A → Type l) (right* : B → Type l) (glue* : (c : C) → left* (g c) ≃ right* (h c)) where open PushoutRec left* right* (ua ∘ glue*) public abstract coe-glue-β : (c : C) (a : left* (g c)) → coe (ap f (glue c)) a == –> (glue* c) a coe-glue-β c a = coe (ap f (glue c)) a =⟨ glue-β c |in-ctx (λ u → coe u a) ⟩ coe (ua (glue* c)) a =⟨ coe-β (glue* c) a ⟩ –> (glue* c) a ∎ coe!-glue-β : (c : C) (b : right* (h c)) → coe! (ap f (glue c)) b == <– (glue* c) b coe!-glue-β c b = coe! (ap f (glue c)) b =⟨ glue-β c |in-ctx (λ u → coe! u b) ⟩ coe! (ua (glue* c)) b =⟨ coe!-β (glue* c) b ⟩ <– (glue* c) b ∎ ↓-glue-out : (c : C) {a : left* (g c)} {b : right* (h c)} → a == b [ f ↓ glue c ] → –> (glue* c) a == b ↓-glue-out c {a} {b} p = –> (glue* c) a =⟨ ! (coe-glue-β c a) ⟩ coe (ap f (glue c)) a =⟨ to-transp p ⟩ b ∎ ↓-glue-in : (c : C) {a : left* (g c)} {b : right* (h c)} → –> (glue* c) a == b → a == b [ f ↓ glue c ] ↓-glue-in c {a} {b} p = from-transp f (glue c) (coe-glue-β c a ∙ p) private module _ where fA : Type _ fA = Σ A left* fB : Type _ fB = Σ B right* fC : Type _ fC = Σ C (left* ∘ g) fg : fC → fA fg (c , c') = (g c , c') fh : fC → fB fh (c , c') = (h c , –> (glue* c) c') f-d : Span f-d = span fA fB fC fg fh flattening : Σ (Pushout d) f == Pushout f-d flattening = Σ= p p' ∙ q ∙ r ∙ s where module G = PushoutGeneric {d = d} P-cc : Coprod A B → Type _ P-cc (inl a) = left* a P-cc (inr b) = right* b module P = G.RecType P-cc glue* import lib.types.Flattening as Flattening module FlatteningPushout = Flattening (Coprod A B) C (inl ∘ g) (inr ∘ h) P-cc glue* open FlatteningPushout public hiding (flattening-equiv; module P) p-equiv : Pushout d ≃ G.T p-equiv = G.generic-pushout p : Pushout d == G.T p = ua p-equiv p' : f == P.f [ (λ X → (X → Type _)) ↓ p ] p' = ↓-app→cst-in (λ {t} {t'} q → Pushout-elim {P = λ t → f t == P.f (–> p-equiv t)} (λ a → idp) (λ b → idp) (λ c → ↓-='-in (ap (P.f ∘ (–> p-equiv)) (glue c) =⟨ ap-∘ P.f (–> p-equiv) (glue c) ⟩ ap P.f (ap (–> p-equiv) (glue c)) =⟨ G.To.glue-β c |in-ctx ap P.f ⟩ ap P.f (pp c) =⟨ P.pp-β c ⟩ ua (glue* c) =⟨ ! (glue-β c) ⟩ ap f (glue c) ∎)) t ∙ ap P.f (↓-idf-ua-out _ q)) -- module fG' = Generic1HIT At Bt ft gt q : Σ G.T P.f == fG'.T q = ua FlatteningPushout.flattening-equiv -- {- This part is basically [Generic1HIT=] applied to the flattening lemma for coproducts. Maybe it would make sense to refactor it that way. -} module fG = PushoutGeneric {d = f-d} r : fG'.T == fG.T r = ua (equiv to from to-from from-to) where to-cc : At → fG.T to-cc (inl a , a') = fG.cc (inl (a , a')) to-cc (inr b , b') = fG.cc (inr (b , b')) module To = fG'.Rec to-cc fG.pp to : fG'.T → fG.T to = To.f from-cc : Coprod fA fB → fG'.T from-cc (inl (a , a')) = fG'.cc (inl a , a') from-cc (inr (b , b')) = fG'.cc (inr b , b') module From = fG.Rec from-cc fG'.pp from : fG.T → fG'.T from = From.f abstract to-from : (x : fG.T) → to (from x) == x to-from = fG.elim to-from-cc to-from-pp where to-from-cc : (x : Coprod fA fB) → to (from (fG.cc x)) == fG.cc x to-from-cc (inl _) = idp to-from-cc (inr _) = idp to-from-pp : (c : fC) → idp == idp [ (λ x → to (from x) == x) ↓ fG.pp c ] to-from-pp c = ↓-∘=idf-in to from (ap to (ap from (fG.pp c)) =⟨ From.pp-β c |in-ctx ap to ⟩ ap to (fG'.pp c) =⟨ To.pp-β c ⟩ fG.pp c ∎) from-to : (x : fG'.T) → from (to x) == x from-to = fG'.elim from-to-cc from-to-pp where from-to-cc : (a : At) → from (to (fG'.cc a)) == fG'.cc a from-to-cc (inl _ , _) = idp from-to-cc (inr _ , _) = idp from-to-pp : (b : Bt) → idp == idp [ (λ x → from (to x) == x) ↓ fG'.pp b ] from-to-pp b = ↓-∘=idf-in from to (ap from (ap to (fG'.pp b)) =⟨ To.pp-β b |in-ctx ap from ⟩ ap from (fG.pp b) =⟨ From.pp-β b ⟩ fG'.pp b ∎) -- s : fG.T == Pushout f-d s = ! (ua fG.generic-pushout)
{ "alphanum_fraction": 0.4530254777, "avg_line_length": 29.3801169591, "ext": "agda", "hexsha": "63c42070eba81dc52353eb7e6bb723023793127d", "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": "939a2d83e090fcc924f69f7dfa5b65b3b79fe633", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "nicolaikraus/HoTT-Agda", "max_forks_repo_path": "lib/types/PushoutFlattening.agda", "max_issues_count": null, "max_issues_repo_head_hexsha": "939a2d83e090fcc924f69f7dfa5b65b3b79fe633", "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": "nicolaikraus/HoTT-Agda", "max_issues_repo_path": "lib/types/PushoutFlattening.agda", "max_line_length": 87, "max_stars_count": 1, "max_stars_repo_head_hexsha": "f8fa68bf753d64d7f45556ca09d0da7976709afa", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "UlrikBuchholtz/HoTT-Agda", "max_stars_repo_path": "lib/types/PushoutFlattening.agda", "max_stars_repo_stars_event_max_datetime": "2021-06-30T00:17:55.000Z", "max_stars_repo_stars_event_min_datetime": "2021-06-30T00:17:55.000Z", "num_tokens": 2041, "size": 5024 }
postulate A : Set I : (@erased _ : A) → Set R : A → Set f : ∀ (@erased x : A) (r : R x) → I x -- can now be used here ^
{ "alphanum_fraction": 0.4615384615, "avg_line_length": 16.25, "ext": "agda", "hexsha": "92939634d6e9cde826630ccd9af4a1f45cdcd159", "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/Issue2128.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/Issue2128.agda", "max_line_length": 39, "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/Issue2128.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": 57, "size": 130 }
{-# OPTIONS --cubical --no-import-sorts --no-exact-split --safe #-} module Cubical.Data.NatMinusOne.Properties where open import Cubical.Foundations.Prelude open import Cubical.Foundations.Isomorphism open import Cubical.Data.Nat open import Cubical.Data.NatMinusOne.Base -1+Path : ℕ ≡ ℕ₋₁ -1+Path = isoToPath (iso -1+_ 1+_ (λ _ → refl) (λ _ → refl))
{ "alphanum_fraction": 0.7393767705, "avg_line_length": 32.0909090909, "ext": "agda", "hexsha": "af797a3dcd7eeb3e29102c9943dd5045a2144dbf", "lang": "Agda", "max_forks_count": 1, "max_forks_repo_forks_event_max_datetime": "2021-11-22T02:02:01.000Z", "max_forks_repo_forks_event_min_datetime": "2021-11-22T02:02:01.000Z", "max_forks_repo_head_hexsha": "fd8059ec3eed03f8280b4233753d00ad123ffce8", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "dan-iel-lee/cubical", "max_forks_repo_path": "Cubical/Data/NatMinusOne/Properties.agda", "max_issues_count": 1, "max_issues_repo_head_hexsha": "fd8059ec3eed03f8280b4233753d00ad123ffce8", "max_issues_repo_issues_event_max_datetime": "2022-01-27T02:07:48.000Z", "max_issues_repo_issues_event_min_datetime": "2022-01-27T02:07:48.000Z", "max_issues_repo_licenses": [ "MIT" ], "max_issues_repo_name": "dan-iel-lee/cubical", "max_issues_repo_path": "Cubical/Data/NatMinusOne/Properties.agda", "max_line_length": 67, "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/NatMinusOne/Properties.agda", "max_stars_repo_stars_event_max_datetime": null, "max_stars_repo_stars_event_min_datetime": null, "num_tokens": 111, "size": 353 }
data _ : Set where
{ "alphanum_fraction": 0.6842105263, "avg_line_length": 9.5, "ext": "agda", "hexsha": "61ec1fffe9463c8feb41860d570d4cf103419101", "lang": "Agda", "max_forks_count": 371, "max_forks_repo_forks_event_max_datetime": "2022-03-30T19:00:30.000Z", "max_forks_repo_forks_event_min_datetime": "2015-01-03T14:04:08.000Z", "max_forks_repo_head_hexsha": "7f58030124fa99dfbf8db376659416f3ad8384de", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "cruhland/agda", "max_forks_repo_path": "test/Fail/Issue1465-data.agda", "max_issues_count": 4066, "max_issues_repo_head_hexsha": "7f58030124fa99dfbf8db376659416f3ad8384de", "max_issues_repo_issues_event_max_datetime": "2022-03-31T21:14:49.000Z", "max_issues_repo_issues_event_min_datetime": "2015-01-10T11:24:51.000Z", "max_issues_repo_licenses": [ "MIT" ], "max_issues_repo_name": "cruhland/agda", "max_issues_repo_path": "test/Fail/Issue1465-data.agda", "max_line_length": 18, "max_stars_count": 1989, "max_stars_repo_head_hexsha": "7f58030124fa99dfbf8db376659416f3ad8384de", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "cruhland/agda", "max_stars_repo_path": "test/Fail/Issue1465-data.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": 6, "size": 19 }
-- Andreas, 2016-09-28, Level meta below neutral level -- Agda previously simplified X <= a to X = a. -- This loses the solution X = lzero. -- {-# OPTIONS -v tc.constr.add:40 #-} open import Common.Level module _ (a : Level) where module WorksWithSwappedDeclarations where mutual X : Level X = _ data E : Set₁ where c : Set X → E -- constraint lsuc X <= 1 solves X = lzero data D : Set (lsuc a) where c : Set X → D -- fine since lzero <= a module WorksWithGivenSolution where mutual X : Level X = lzero data D : Set (lsuc a) where c : Set X → D data E : Set₁ where c : Set X → E module Test where mutual X : Level X = _ data D : Set (lsuc a) where c : Set X → D -- solved X (prematurely) since X <= a implies X = a ?? (Wrong!) data E : Set₁ where c : Set X → E -- constraint X <= 0 became contradictory constraint a <= 0 -- ERROR WAS: -- The type of the constructor does not fit in the sort of the -- datatype, since Set (lsuc a) is not less or equal than Set₁ -- when checking the constructor c in the declaration of E -- should succeed
{ "alphanum_fraction": 0.6144473455, "avg_line_length": 21.679245283, "ext": "agda", "hexsha": "434905d00b2d4b9bc14fc2cb5cf880d9773241b0", "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/LevelMetaLeqNeutralLevel.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/LevelMetaLeqNeutralLevel.agda", "max_line_length": 85, "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/LevelMetaLeqNeutralLevel.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": 344, "size": 1149 }
open import Data.Product using ( ∃ ; _×_ ; _,_ ; proj₁ ; proj₂ ) open import Relation.Unary using ( _∈_ ) open import Web.Semantic.DL.TBox.Interp using ( Δ ; _⊨_≈_ ) renaming ( Interp to Interp′ ; emp to emp′ ) open import Web.Semantic.DL.Signature using ( Signature ) open import Web.Semantic.Util using ( False ; id ) module Web.Semantic.DL.ABox.Interp where infixr 4 _,_ infixr 5 _*_ data Interp (Σ : Signature) (X : Set) : Set₁ where _,_ : ∀ I → (X → Δ {Σ} I) → (Interp Σ X) ⌊_⌋ : ∀ {Σ X} → Interp Σ X → Interp′ Σ ⌊ I , i ⌋ = I ind : ∀ {Σ X} → (I : Interp Σ X) → X → Δ ⌊ I ⌋ ind (I , i) = i ind² : ∀ {Σ X} → (I : Interp Σ X) → (X × X) → (Δ ⌊ I ⌋ × Δ ⌊ I ⌋) ind² I (x , y) = (ind I x , ind I y) _*_ : ∀ {Σ X Y} → (Y → X) → Interp Σ X → Interp Σ Y f * I = (⌊ I ⌋ , λ x → ind I (f x)) emp : ∀ {Σ} → Interp Σ False emp = (emp′ , id) data Surjective {Σ X} (I : Interp Σ X) : Set where surj : (∀ x → ∃ λ y → ⌊ I ⌋ ⊨ x ≈ ind I y) → (I ∈ Surjective) ind⁻¹ : ∀ {Σ X} {I : Interp Σ X} → (I ∈ Surjective) → (Δ ⌊ I ⌋ → X) ind⁻¹ (surj i) x = proj₁ (i x) surj✓ : ∀ {Σ X} {I : Interp Σ X} (I∈Surj : I ∈ Surjective) → ∀ x → (⌊ I ⌋ ⊨ x ≈ ind I (ind⁻¹ I∈Surj x)) surj✓ (surj i) x = proj₂ (i x)
{ "alphanum_fraction": 0.5287739783, "avg_line_length": 30.7435897436, "ext": "agda", "hexsha": "beba36f3b1b7b5919ef5e8e12b6934eb06520ad2", "lang": "Agda", "max_forks_count": 3, "max_forks_repo_forks_event_max_datetime": "2022-03-12T11:40:03.000Z", "max_forks_repo_forks_event_min_datetime": "2017-12-03T14:52:09.000Z", "max_forks_repo_head_hexsha": "8ddbe83965a616bff6fc7a237191fa261fa78bab", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "agda/agda-web-semantic", "max_forks_repo_path": "src/Web/Semantic/DL/ABox/Interp.agda", "max_issues_count": 4, "max_issues_repo_head_hexsha": "8ddbe83965a616bff6fc7a237191fa261fa78bab", "max_issues_repo_issues_event_max_datetime": "2021-01-04T20:57:19.000Z", "max_issues_repo_issues_event_min_datetime": "2018-11-14T02:32:28.000Z", "max_issues_repo_licenses": [ "MIT" ], "max_issues_repo_name": "agda/agda-web-semantic", "max_issues_repo_path": "src/Web/Semantic/DL/ABox/Interp.agda", "max_line_length": 103, "max_stars_count": 9, "max_stars_repo_head_hexsha": "8ddbe83965a616bff6fc7a237191fa261fa78bab", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "agda/agda-web-semantic", "max_stars_repo_path": "src/Web/Semantic/DL/ABox/Interp.agda", "max_stars_repo_stars_event_max_datetime": "2020-03-14T14:21:08.000Z", "max_stars_repo_stars_event_min_datetime": "2015-09-13T17:46:41.000Z", "num_tokens": 584, "size": 1199 }
module cwf where open import Nat open import Base open import univ open import help -- Category with Families infix 40 _─→_ infixl 50 _,_ _,,_ infixl 70 _∘_ _∙_ infixl 60 _/_ _//_ Con : Set Con = S _─→_ : Con -> Con -> Set Γ ─→ Δ = El (pi Γ (K Δ)) p─→ : {Γ Δ : Con}(σ : Γ ─→ Δ){x y : El Γ} -> x == y -> σ # x == σ # y p─→ σ {x}{y} x=y = chain> σ # x === refS << σ # y by pFun σ x=y === σ # y by ref<< (σ # y) where open module C13 = Chain _==_ (ref {_}) (trans {_}) id : {Γ : Con} -> Γ ─→ Γ id = el < (\x -> x) , (\{x}{y} -> prf x y) > where prf : (x y : El _)(x=y : x == y) -> x == refS << y prf x y x=y = chain> x === refS << x by sym (ref<< x) === refS << y by p<< refS x=y where open module C0 = Chain _==_ (ref {_}) (trans {_}) _∘_ : {Γ Δ Θ : Con} -> (Δ ─→ Θ) -> (Γ ─→ Δ) -> Γ ─→ Θ σ ∘ δ = el < (\x -> σ # (δ # x)) , (\{x}{y} -> prf x y) > where prf : (x y : El _)(x=y : x == y) -> σ # (δ # x) == _ << σ # (δ # y) prf x y x=y = chain> σ # (δ # x) === σ # (δ # y) by p─→ σ (p─→ δ x=y) === _ << σ # (δ # y) by sym (castref _ _) where open module C1 = Chain _==_ (ref {_}) (trans {_}) Type : Con -> Set Type Γ = Fam Γ data _=Ty_ {Γ : Con}(A B : Type Γ) : Set where eqTy : A =Fam B -> A =Ty B symTy : {Γ : Con}{A B : Type Γ} -> A =Ty B -> B =Ty A symTy {Γ}{A}{B} (eqTy A=B) = eqTy (symFam {Γ}{A}{B} A=B) _/_ : {Γ Δ : Con} -> Type Γ -> (Δ ─→ Γ) -> Type Δ _/_ {Γ}{Δ} A (el < σ , pσ >) = fam B pB where B : El Δ -> S B x = A ! σ x σ' : Δ ─→ Γ σ' = el < σ , (\{x}{y} -> pσ) > pB : Map _==_ _=S_ B pB {x}{y} x=y = pFam A (p─→ σ' x=y) lem-/id : {Γ : Con}{A : Type Γ} -> A / id =Ty A lem-/id {Γ}{A} = eqTy \x -> refS data Elem (Γ : Con)(A : Type Γ) : Set where elem : El (pi Γ A) -> Elem Γ A _=El'_ : {Γ : Con}{A : Type Γ} -> Elem Γ A -> Elem Γ A -> Set elem u =El' elem v = u == v data _=El_ {Γ : Con}{A : Type Γ}(u v : Elem Γ A) : Set where eqEl : u =El' v -> u =El v castElem : {Γ : Con}{A B : Type Γ} -> B =Ty A -> Elem Γ A -> Elem Γ B castElem {Γ}{A}{B} (eqTy B=A) (elem u) = elem (ΓB=ΓA << u) where ΓB=ΓA : pi Γ B =S pi Γ A ΓB=ΓA = eqS < refS , Bx=Acx > where Bx=Acx : (x : El Γ) -> B ! x =S A ! (refS << x) Bx=Acx x = chain> B ! x === A ! x by B=A x === A ! (refS << x) by pFam A (sym (ref<< x)) where open module C2-5 = Chain _=S_ refS transS _//_ : {Γ Δ : Con}{A : Type Γ} -> Elem Γ A -> (σ : Δ ─→ Γ) -> Elem Δ (A / σ) _//_ {Γ}{Δ}{A} (elem t) (el < σ , pσ >) = elem (el < tσ , (\{x}{y} -> prf x y) >) where tσ : (x : El Δ) -> El (A ! σ x) tσ x = t # σ x σ' : Δ ─→ Γ σ' = el < σ , (\{x}{y} -> pσ) > prf : (x y : El Δ)(x=y : x == y) -> t # σ x == _ << t # σ y prf x y x=y = chain> t # σ x === _ << t # σ y by pFun t (p─→ σ' x=y) === _ << t # σ y by pfi _ _ _ where open module C3 = Chain _==_ (ref {_}) (trans {_}) _,_ : (Γ : Con)(A : Type Γ) -> Con Γ , A = sigma Γ A wk : {Γ : Con}{A : Type Γ} -> Γ , A ─→ Γ wk {Γ}{A} = el < f , (\{x}{y} -> pf x y) > where f : El (Γ , A) -> El Γ f (el < x , _ >) = x pf : (x y : El (Γ , A))(x=y : x == y) -> f x == _ << f y pf (el < x , _ >) (el < y , _ >) (eq < x=y , _ >) = chain> x === y by x=y === _ << y by sym (castref _ _) where open module C4 = Chain _==_ (ref {_}) (trans {_}) vz : {Γ : Con}{A : Type Γ} -> Elem (Γ , A) (A / wk) vz {Γ}{A} = elem (el < f , (\{x}{y} -> pf x y) >) where f : (x : El (Γ , A)) -> El ((A / wk) ! x) f (el < _ , z >) = z pf : (x y : El (Γ , A))(x=y : x == y) -> f x == _ << f y pf (el < _ , x >)(el < _ , y >)(eq < _ , x=y >) = chain> x === _ << y by x=y === _ << y by pfi _ _ _ where open module C5 = Chain _==_ (ref {_}) (trans {_}) _,,_ : {Γ Δ : Con}{A : Type Γ}(σ : Δ ─→ Γ)(u : Elem Δ (A / σ)) -> Δ ─→ Γ , A _,,_ {Γ}{Δ}{A} (el < σ , pσ >) (elem (el < u , pu >)) = build δ pδ where -- We need to generalise to be able to infer the proof of Γ, A =S Γ, A Ok : (f : El Δ -> El (Γ , A)) -> Set Ok f = (x y : El Δ)(p : Γ , A =S Γ , A)(x=y : x == y) -> f x == p << f y build : (f : El Δ -> El (Γ , A)) -> Ok f -> Δ ─→ Γ , A build f p = el < f , (\{x}{y} -> p x y _) > δ : El Δ -> El (Γ , A) δ x = el {Γ , A} < σ x , u x > pδ : Ok δ pδ x y (eqS < Γ=Γ , A=A >) x=y = eq < σx=cσy , ux=ccuy > where σx=cσy = trans (pσ x=y) (pfi _ _ _) ux=ccuy = chain> u x === _ << u y by pu x=y === _ << _ << u y by sym (casttrans _ _ _ _) where open module C6 = Chain _==_ (ref {_}) (trans {_}) {- TODO: Prove wk ∘ (σ ,, u) = σ vz / (σ ,, u) = u (σ ,, u) ∘ δ = (σ ∘ δ ,, u) wk ,, vz = id -} [_] : {Γ : Con}{A : Type Γ} -> Elem Γ A -> Γ ─→ Γ , A [_] {Γ}{A} u = id ,, castElem lem-/id u Π : {Γ : Con}(A : Type Γ)(B : Type (Γ , A)) -> Type Γ Π {Γ} A B = fam F pF where F : El Γ -> S F x = pi (A ! x) (curryFam B x) pF : Map _==_ _=S_ F pF {y}{z} y=z = eqS < pFam A (sym y=z) , (\x -> pFam B (eq < y=z , trans (sym (castref _ _)) (trans<< _ _ _) > ) ) > {- TODO: Prove (Π A B) / σ = Π (A / σ) (B / (σ / wk ,, vz)) -} ƛ : {Γ : Con}{A : Type Γ}{B : Type (Γ , A)} -> Elem (Γ , A) B -> Elem Γ (Π A B) ƛ {Γ}{A}{B} (elem u) = elem (mkFun f pf) where f : (x : El Γ) -> El (Π A B ! x) f x = el < g , (\{x}{y} -> pg) > where g : (y : El (A ! x)) -> El (B ! el < x , y >) g y = u # el < x , y > pg : {y z : El (A ! x)}(y=z : y == z) -> g y == _ << g z pg {y}{z} y=z = chain> u # el < x , y > === _ << u # el < x , z > by pFun u (eqSnd y=z) === _ << u # el < x , z > by pfi _ _ _ where open module C7 = Chain _==_ (ref {_}) (trans {_}) pf : IsFun {F = Π A B} f pf {y}{z} (eqS < Ay=Az , B'=B' >) y=z = eq prf where prf : (x : El (A ! y)) -> _ == _ prf x = chain> u # el < y , x > === _ << u # el < z , _ << x > by pFun u (eq < y=z , sym (castref2 _ _ _) >) === _ << u # el < z , _ << x > by pfi _ _ _ where open module C8 = Chain _==_ (ref {_}) (trans {_}) _∙_ : {Γ : Con}{A : Type Γ}{B : Type (Γ , A)} (w : Elem Γ (Π A B))(u : Elem Γ A) -> Elem Γ (B / [ u ]) _∙_ {Γ}{A}{B} (elem w) (elem u) = elem (el < f , (\{x}{y} -> pf) >) where f : (x : El Γ) -> El ((B / [ elem u ]) ! x) f x = p u << y where y : El (B ! el < x , u # x >) y = (w # x) # (u # x) p : (u : El (pi Γ A)) -> (B / [ elem u ]) ! x =S B ! el < x , u # x > p (el < u , pu >) = pFam B ( chain> el < x , _ << u (refS << x) > === el < x , _ << _ << u x > by eqSnd (p<< _ (pu (ref<< _))) === el < x , u x > by eqSnd (castref2 _ _ _) ) where open module C9 = Chain _==_ (ref {_}) (trans {_}) pf : {x y : El Γ}(x=y : x == y) -> f x == _ << f y pf {x}{y} x=y = chain> q1 << (w # x) # (u # x) === q1 << (q3 << w # y) ## (u # x) by p<< q1 (p# (pFun w x=y)) === q1 << q4 << (w # y) # (q5 << u # x) by p<< q1 (distr<<# (w # y) q3) === q7 << (w # y) # (q5 << u # x) by sym (trans<< q1 q4 _) === q7 << q8 << (w # y) # (q5 << q9 << u # y) by p<< q7 (pFun (w # y) (p<< q5 (pFun u x=y))) === qA << (w # y) # (q5 << q9 << u # y) by sym (trans<< q7 q8 _) === qA << qB << (w # y) # (u # y) by p<< qA (pFun (w # y) (castref2 q5 q9 _)) === q2 << q6 << (w # y) # (u # y) by pfi2 qA q2 qB q6 _ where open module C10 = Chain _==_ (ref {_}) (trans {_}) q1 = _ q2 = _ q3 = _ q4 = _ q5 = _ q6 = _ q7 = _ q8 = _ q9 = _ qA = _ qB = _ infixl 150 _##_ _##_ = _#_ {F = curryFam B x} {- TODO: Prove (ƛ v) ∙ u = v // [ u ] (β) w = ƛ ((w // wk) ∙ vz) (η) ƛ v // σ = ƛ (v // (σ ∘ wk ,, vz)) w ∙ u // σ = (w // σ) ∙ (u // σ) -}
{ "alphanum_fraction": 0.3632900845, "avg_line_length": 29.0692041522, "ext": "agda", "hexsha": "40bf35c7fa6128ac65eda2449fe037d4a2b5bd9f", "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": "examples/outdated-and-incorrect/univ/cwf.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": "examples/outdated-and-incorrect/univ/cwf.agda", "max_line_length": 79, "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": "examples/outdated-and-incorrect/univ/cwf.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": 3636, "size": 8401 }
{-# OPTIONS --safe --experimental-lossy-unification #-} module Cubical.Algebra.CommRing.Instances.Polynomials.UnivariatePolyFun where open import Cubical.Foundations.Prelude open import Cubical.Data.Empty as ⊥ open import Cubical.Data.Nat hiding (_·_) renaming (_+_ to _+n_) open import Cubical.Data.Nat.Order open import Cubical.Data.Sigma open import Cubical.Algebra.Monoid open import Cubical.Algebra.Ring open import Cubical.Algebra.CommRing open import Cubical.Algebra.GradedRing.DirectSumFun private variable ℓ : Level module _ (ACommRing@(A , Astr) : CommRing ℓ) where open CommRingStr Astr open RingTheory (CommRing→Ring ACommRing) UnivariatePolyFun-CommRing : CommRing ℓ UnivariatePolyFun-CommRing = ⊕FunGradedRing-CommRing _+n_ (makeIsMonoid isSetℕ +-assoc +-zero λ _ → refl) (λ _ _ → refl) (λ _ → A) (λ _ → snd (Ring→AbGroup (CommRing→Ring ACommRing))) 1r _·_ 0LeftAnnihilates 0RightAnnihilates (λ a b c → ΣPathP ((+-assoc _ _ _) , (·Assoc _ _ _))) (λ a → ΣPathP ((+-zero _) , (·IdR _))) (λ a → ΣPathP (refl , (·IdL _))) ·DistR+ ·DistL+ λ x y → ΣPathP ((+-comm _ _) , (·Comm _ _)) nUnivariatePolyFun : (A' : CommRing ℓ) → (n : ℕ) → CommRing ℓ nUnivariatePolyFun A' zero = A' nUnivariatePolyFun A' (suc n) = UnivariatePolyFun-CommRing (nUnivariatePolyFun A' n)
{ "alphanum_fraction": 0.6345246123, "avg_line_length": 35.3095238095, "ext": "agda", "hexsha": "d0b05d7a4a3dc47a9ecd01af2f7313dc1cc9dc81", "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/Algebra/CommRing/Instances/Polynomials/UnivariatePolyFun.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/Algebra/CommRing/Instances/Polynomials/UnivariatePolyFun.agda", "max_line_length": 86, "max_stars_count": null, "max_stars_repo_head_hexsha": "58c0b83bb0fed0dc683f3d29b1709effe51c1689", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "thomas-lamiaux/cubical", "max_stars_repo_path": "Cubical/Algebra/CommRing/Instances/Polynomials/UnivariatePolyFun.agda", "max_stars_repo_stars_event_max_datetime": null, "max_stars_repo_stars_event_min_datetime": null, "num_tokens": 449, "size": 1483 }
{- Byzantine Fault Tolerant Consensus Verification in Agda, version 0.9. Copyright (c) 2021, Oracle and/or its affiliates. Licensed under the Universal Permissive License v 1.0 as shown at https://opensource.oracle.com/licenses/upl -} open import LibraBFT.ImplShared.Consensus.Types open import Optics.All module LibraBFT.Impl.Execution.ExecutorTypes.StateComputeResult where extensionProof : StateComputeResult → AccumulatorExtensionProof extensionProof self = AccumulatorExtensionProof∙new (self ^∙ scrObmNumLeaves)
{ "alphanum_fraction": 0.8162878788, "avg_line_length": 37.7142857143, "ext": "agda", "hexsha": "6b3c4e52d37da0d70e09e8e984586b4a7b3cb94f", "lang": "Agda", "max_forks_count": 6, "max_forks_repo_forks_event_max_datetime": "2022-02-18T01:04:32.000Z", "max_forks_repo_forks_event_min_datetime": "2020-12-16T19:43:52.000Z", "max_forks_repo_head_hexsha": "a4674fc473f2457fd3fe5123af48253cfb2404ef", "max_forks_repo_licenses": [ "UPL-1.0" ], "max_forks_repo_name": "LaudateCorpus1/bft-consensus-agda", "max_forks_repo_path": "src/LibraBFT/Impl/Execution/ExecutorTypes/StateComputeResult.agda", "max_issues_count": 72, "max_issues_repo_head_hexsha": "a4674fc473f2457fd3fe5123af48253cfb2404ef", "max_issues_repo_issues_event_max_datetime": "2022-03-25T05:36:11.000Z", "max_issues_repo_issues_event_min_datetime": "2021-02-04T05:04:33.000Z", "max_issues_repo_licenses": [ "UPL-1.0" ], "max_issues_repo_name": "LaudateCorpus1/bft-consensus-agda", "max_issues_repo_path": "src/LibraBFT/Impl/Execution/ExecutorTypes/StateComputeResult.agda", "max_line_length": 111, "max_stars_count": 4, "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/Execution/ExecutorTypes/StateComputeResult.agda", "max_stars_repo_stars_event_max_datetime": "2021-12-18T19:24:05.000Z", "max_stars_repo_stars_event_min_datetime": "2020-12-16T19:43:41.000Z", "num_tokens": 131, "size": 528 }
{-# OPTIONS --without-K --rewriting #-} open import lib.Basics open import lib.NType2 open import lib.types.Sigma module lib.types.Modality where -- Where to put this? Or maybe there's -- a simpler proof from some library function? !ᵈ-inv-l-out : ∀ {ℓ} {A : Type ℓ} {P : A → Type ℓ} {a₀ a₁ : A} {p : a₀ == a₁} {x₀ x₁ : P a₁} → (q : x₀ == x₁ [ P ↓ ! p ∙ p ]) → x₀ == x₁ !ᵈ-inv-l-out {p = idp} q = q record Modality ℓ : Type (lsucc ℓ) where field is-local : Type ℓ → Type ℓ is-local-is-prop : {A : Type ℓ} → is-prop (is-local A) ◯ : Type ℓ → Type ℓ ◯-is-local : {A : Type ℓ} → is-local (◯ A) η : {A : Type ℓ} → A → ◯ A ◯-elim : {A : Type ℓ} {B : ◯ A → Type ℓ} (B-local : (x : ◯ A) → is-local (B x)) → Π A (B ∘ η) → Π (◯ A) B ◯-elim-β : {A : Type ℓ} {B : ◯ A → Type ℓ} (B-local : (x : ◯ A) → is-local (B x)) (f : Π A (B ∘ η)) → (a : A) → ◯-elim B-local f (η a) == f a ◯-=-is-local : {A : Type ℓ} (a₀ a₁ : ◯ A) → is-local (a₀ == a₁) ◯-Type : Type (lsucc ℓ) ◯-Type = Σ (Type ℓ) is-local {- elimination rules -} module ◯Elim {A : Type ℓ} {B : ◯ A → Type ℓ} (B-local : (x : ◯ A) → is-local (B x)) (η* : Π A (B ∘ η)) where f = ◯-elim B-local η* η-β = ◯-elim-β B-local η* module ◯Rec {A : Type ℓ} {B : Type ℓ} (B-local : is-local B) (η* : A → B) = ◯Elim (λ _ → B-local) η* ◯-rec = ◯Rec.f ◯-rec-β = ◯Rec.η-β {- functoriality -} module ◯Fmap {A B : Type ℓ} (f : A → B) = ◯Rec ◯-is-local (η ∘ f) ◯-fmap = ◯Fmap.f ◯-fmap-β = ◯Fmap.η-β ◯-isemap : {A B : Type ℓ} (f : A → B) → is-equiv f → is-equiv (◯-fmap f) ◯-isemap f f-ise = is-eq _ (◯-fmap g) to-from from-to where open is-equiv f-ise abstract to-from : ∀ ◯b → ◯-fmap f (◯-fmap g ◯b) == ◯b to-from = ◯-elim (λ ◯b → ◯-=-is-local (◯-fmap f (◯-fmap g ◯b)) ◯b) (λ b → ap (◯-fmap f) (◯-fmap-β g b) ∙ ◯-fmap-β f (g b) ∙ ap η (f-g b)) from-to : ∀ ◯a → ◯-fmap g (◯-fmap f ◯a) == ◯a from-to = ◯-elim (λ ◯a → ◯-=-is-local (◯-fmap g (◯-fmap f ◯a)) ◯a) (λ a → ap (◯-fmap g) (◯-fmap-β f a) ∙ ◯-fmap-β g (f a) ∙ ap η (g-f a)) ◯-emap : {A B : Type ℓ} → A ≃ B → ◯ A ≃ ◯ B ◯-emap (f , f-ise) = ◯-fmap f , ◯-isemap f f-ise {- equivalences preserve locality -} -- This is the only appearence of univalence, but ... local-is-replete : {A B : Type ℓ} → is-local A → A ≃ B → is-local B local-is-replete w eq = transport is-local (ua eq) w -- This name aligns with the current codebase better. equiv-preserves-local : {A B : Type ℓ} → A ≃ B → is-local A → is-local B equiv-preserves-local e A-is-loc = local-is-replete A-is-loc e {- locality and [η] being an equivalence -} local-implies-η-equiv : {A : Type ℓ} → is-local A → is-equiv (η {A}) local-implies-η-equiv {A} w = is-eq (η {A}) η-inv inv-l inv-r where η-inv : ◯ A → A η-inv = ◯-rec w (idf A) abstract inv-r : (a : A) → η-inv (η a) == a inv-r = ◯-rec-β w (idf A) inv-l : (a : ◯ A) → η (η-inv a) == a inv-l = ◯-elim (λ a₀ → ◯-=-is-local _ _) (λ a₀ → ap η (inv-r a₀)) abstract η-equiv-implies-local : {A : Type ℓ} → is-equiv (η {A}) → is-local A η-equiv-implies-local {A} eq = local-is-replete {◯ A} {A} ◯-is-local ((η , eq) ⁻¹) retract-is-local : {A B : Type ℓ} (w : is-local A) (f : A → B) (g : B → A) (r : (b : B) → f (g b) == b) → is-local B retract-is-local {A} {B} w f g r = η-equiv-implies-local (is-eq η η-inv inv-l inv-r) where η-inv : ◯ B → B η-inv = f ∘ (◯-rec w g) inv-r : (b : B) → η-inv (η b) == b inv-r b = ap f (◯-rec-β w g b) ∙ r b inv-l : (b : ◯ B) → η (η-inv b) == b inv-l = ◯-elim (λ b → ◯-=-is-local _ _) (λ b → ap η (inv-r b)) {- locality of identification -} abstract =-preserves-local : {A : Type ℓ} → is-local A → {a₀ a₁ : A} → is-local (a₀ == a₁) =-preserves-local {A} w {a₀} {a₁} = local-is-replete (◯-=-is-local (η a₀) (η a₁)) (ap-equiv (η , local-implies-η-equiv w) a₀ a₁ ⁻¹) {- ◯-connectness and ◯-equivalences -} is-◯-connected : Type ℓ → Type ℓ is-◯-connected A = is-contr (◯ A) is-◯-connected-is-prop : ∀ {A} → is-prop (is-◯-connected A) is-◯-connected-is-prop {A} = is-contr-is-prop is-◯-equiv : {A B : Type ℓ} → (A → B) → Type ℓ is-◯-equiv {B = B} f = (b : B) → is-◯-connected (hfiber f b) has-◯-conn-fibers = is-◯-equiv is-lex : Type (lsucc ℓ) is-lex = {A B : Type ℓ} (f : A → B) → is-◯-connected A → is-◯-connected B → is-◯-equiv f equiv-preserves-◯-conn : {A B : Type ℓ} → A ≃ B → is-◯-connected A → is-◯-connected B equiv-preserves-◯-conn e c = equiv-preserves-level (◯-emap e) {{c}} total-◯-equiv : {A : Type ℓ} {P Q : A → Type ℓ} (φ : ∀ a → P a → Q a) → (∀ a → is-◯-equiv (φ a)) → is-◯-equiv (Σ-fmap-r φ) total-◯-equiv φ e (a , q) = equiv-preserves-◯-conn (hfiber-Σ-fmap-r φ q ⁻¹) (e a q) module _ {A B : Type ℓ} {h : A → B} (c : is-◯-equiv h) (P : B → ◯-Type) where abstract pre∘-◯-conn-is-equiv : is-equiv (λ (s : Π B (fst ∘ P)) → s ∘ h) pre∘-◯-conn-is-equiv = is-eq f g f-g g-f where f : Π B (fst ∘ P) → Π A (fst ∘ P ∘ h) f k a = k (h a) helper : Π A (fst ∘ P ∘ h) → (b : B) → ◯ (Σ A (λ a → h a == b)) → (fst (P b)) helper t b = ◯-rec (snd (P b)) (λ x → transport (fst ∘ P) (snd x) (t (fst x))) helper-β : (t : Π A (fst ∘ P ∘ h)) → (b : B) → (r : hfiber h b) → helper t b (η r) == transport (fst ∘ P) (snd r) (t (fst r)) helper-β t b = ◯-rec-β (snd (P b)) (λ x → transport (fst ∘ P) (snd x) (t (fst x))) g : Π A (fst ∘ P ∘ h) → Π B (fst ∘ P) g t b = helper t b (contr-center (c b)) f-g : ∀ t → f (g t) == t f-g t = λ= $ λ a → transport (λ r → ◯-rec (snd (P (h a))) _ r == t a) (! (contr-path (c (h a)) (η (a , idp)))) (◯-rec-β (snd (P (h a))) _ (a , idp)) g-f : ∀ k → g (f k) == k g-f k = λ= λ (b : B) → ◯-elim {A = hfiber h b} (λ r → =-preserves-local (snd (P b)) {g (f k) b}) (λ r → lemma₁ (fst r) b (snd r)) (contr-center (c b)) where lemma₀ : (a : A) → (b : B) → (p : h a == b) → helper (k ∘ h) b (η (a , p)) == k b lemma₀ a .(h a) idp = helper-β (k ∘ h) (h a) (a , idp) lemma₁ : (a : A) → (b : B) → (p : h a == b) → helper (k ∘ h) b (contr-center (c b)) == k b lemma₁ a b p = transport! (λ r → helper (k ∘ h) b r == k b) (contr-path (c b) (η (a , p))) (lemma₀ a b p) ◯-extend : Π A (fst ∘ P ∘ h) → Π B (fst ∘ P) ◯-extend = is-equiv.g pre∘-◯-conn-is-equiv ◯-extend-β : ∀ f a → ◯-extend f (h a) == f a ◯-extend-β f = app= (is-equiv.f-g pre∘-◯-conn-is-equiv f) {- locality of function types -} abstract Π-is-local : {A : Type ℓ} {B : A → Type ℓ} (w : (a : A) → is-local (B a)) → is-local (Π A B) Π-is-local {A} {B} w = retract-is-local {◯ (Π A B)} {Π A B} ◯-is-local η-inv η r where η-inv : ◯ (Π A B) → Π A B η-inv φ' a = ◯-rec (w a) (λ φ → φ a) φ' r : (φ : Π A B) → η-inv (η φ) == φ r φ = λ= (λ a → ◯-rec-β (w a) (λ φ₀ → φ₀ a) φ) →-is-local : {A B : Type ℓ} → is-local B → is-local (A → B) →-is-local w = Π-is-local (λ _ → w) -- Fmap2 because of locality of function types module ◯Fmap2 {A B C : Type ℓ} (η* : A → B → C) where private module M = ◯Rec (→-is-local ◯-is-local) (◯-fmap ∘ η*) f = M.f η-β : ∀ a b → f (η a) (η b) == η (η* a b) η-β a b = app= (M.η-β a) (η b) ∙ ◯-fmap-β (η* a) b ◯-fmap2 = ◯Fmap2.f ◯-fmap2-β = ◯Fmap2.η-β {- locality of sigma types -} abstract Σ-is-local : {A : Type ℓ} (B : A → Type ℓ) → is-local A → ((a : A) → is-local (B a)) → is-local (Σ A B) Σ-is-local {A} B lA lB = retract-is-local {◯ (Σ A B)} {Σ A B} ◯-is-local η-inv η r where h : ◯ (Σ A B) → A h = ◯-rec lA fst h-β : (ab : Σ A B) → h (η ab) == fst ab h-β = ◯-rec-β lA fst k : (w : ◯ (Σ A B)) → B (h w) k = ◯-elim (lB ∘ h) λ ab → transport! B (h-β ab) (snd ab) k-β : (ab : Σ A B) → k (η ab) == snd ab [ B ↓ h-β ab ] k-β ab = from-transp! B (h-β ab) $ ◯-elim-β (lB ∘ h) (λ ab → transport! B (h-β ab) (snd ab)) ab η-inv : ◯ (Σ A B) → Σ A B η-inv w = h w , k w r : (x : Σ A B) → η-inv (η x) == x r ab = pair= (h-β ab) (k-β ab) ×-is-local : {A B : Type ℓ} → is-local A → is-local B → is-local (A × B) ×-is-local {B = B} lA lB = Σ-is-local (λ _ → B) lA (λ _ → lB) ◯-×-econv : {A B : Type ℓ} → ◯ (A × B) ≃ ◯ A × ◯ B ◯-×-econv {A} {B} = equiv ◯-split ◯-pair inv-l inv-r where ◯-fst : ◯ (A × B) → ◯ A ◯-fst = ◯-fmap fst ◯-fst-β : (ab : A × B) → ◯-fst (η ab) == η (fst ab) ◯-fst-β = ◯-fmap-β fst ◯-snd : ◯ (A × B) → ◯ B ◯-snd = ◯-fmap snd ◯-snd-β : (ab : A × B) → ◯-snd (η ab) == η (snd ab) ◯-snd-β = ◯-fmap-β snd ◯-split : ◯ (A × B) → ◯ A × ◯ B ◯-split = fanout ◯-fst ◯-snd ◯-pair : ◯ A × ◯ B → ◯ (A × B) ◯-pair = uncurry (◯-fmap2 _,_) ◯-pair-β : (a : A) (b : B) → ◯-pair (η a , η b) == η (a , b) ◯-pair-β = ◯-fmap2-β _,_ abstract inv-l : (ab : ◯ A × ◯ B) → ◯-split (◯-pair ab) == ab inv-l = uncurry $ ◯-elim (λ _ → Π-is-local λ _ → =-preserves-local (×-is-local ◯-is-local ◯-is-local)) (λ a → ◯-elim (λ _ → =-preserves-local (×-is-local ◯-is-local ◯-is-local)) (λ b → ap ◯-split (◯-pair-β a b) ∙ pair×= (◯-fst-β (a , b)) (◯-snd-β (a , b)))) inv-r : (ab : ◯ (A × B)) → ◯-pair (◯-split ab) == ab inv-r = ◯-elim (λ _ → ◯-=-is-local _ _) (λ ab → ap ◯-pair (pair×= (◯-fst-β ab) (◯-snd-β ab)) ∙ ◯-pair-β (fst ab) (snd ab))
{ "alphanum_fraction": 0.4124953652, "avg_line_length": 37.0721649485, "ext": "agda", "hexsha": "c7b40b41c557889beedf15d31cfedae58d341107", "lang": "Agda", "max_forks_count": 50, "max_forks_repo_forks_event_max_datetime": "2022-02-14T03:03:25.000Z", "max_forks_repo_forks_event_min_datetime": "2015-01-10T01:48:08.000Z", "max_forks_repo_head_hexsha": "66f800adef943afdf08c17b8ecfba67340fead5e", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "timjb/HoTT-Agda", "max_forks_repo_path": "core/lib/types/Modality.agda", "max_issues_count": 31, "max_issues_repo_head_hexsha": "66f800adef943afdf08c17b8ecfba67340fead5e", "max_issues_repo_issues_event_max_datetime": "2021-10-03T19:15:25.000Z", "max_issues_repo_issues_event_min_datetime": "2015-03-05T20:09:00.000Z", "max_issues_repo_licenses": [ "MIT" ], "max_issues_repo_name": "timjb/HoTT-Agda", "max_issues_repo_path": "core/lib/types/Modality.agda", "max_line_length": 111, "max_stars_count": 294, "max_stars_repo_head_hexsha": "66f800adef943afdf08c17b8ecfba67340fead5e", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "timjb/HoTT-Agda", "max_stars_repo_path": "core/lib/types/Modality.agda", "max_stars_repo_stars_event_max_datetime": "2022-03-20T13:54:45.000Z", "max_stars_repo_stars_event_min_datetime": "2015-01-09T16:23:23.000Z", "num_tokens": 4527, "size": 10788 }
{-# OPTIONS --cubical --safe #-} module Cubical.Data.DiffInt where open import Cubical.Data.DiffInt.Base public open import Cubical.Data.DiffInt.Properties public
{ "alphanum_fraction": 0.7865853659, "avg_line_length": 27.3333333333, "ext": "agda", "hexsha": "eb47c48d0829ff25f97d7fc456d2500c22b58642", "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/DiffInt.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/DiffInt.agda", "max_line_length": 50, "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/DiffInt.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": 37, "size": 164 }
module MLib.Fin.Parts where open import MLib.Prelude open import MLib.Prelude.RelProps import MLib.Fin.Parts.Core as C open import MLib.Fin.Parts.Nat open import Function.Surjection using (_↠_) open import Function.Related renaming (module EquationalReasoning to BijReasoning) import Relation.Binary.Indexed as I open Nat using (_*_; _+_; _<_) open Fin using (toℕ; fromℕ≤) open Table open C using (Parts; constParts) hiding (module Parts) public module Parts {a} {A : Set a} {size : A → ℕ} (P : Parts A size) where open C.Parts P public module PN = Partsℕ P -- Fin functions private bounded′ : ∀ {i} (j : Fin (sizeAt i)) → toℕ j < PN.sizeAt (fromℕ≤ (Fin.bounded i)) bounded′ j = Nat.≤-trans (Fin.bounded j) (Nat.≤-reflexive (≡.sym (≡.cong sizeAt (Fin.fromℕ≤-toℕ _ _)))) fromParts : Σ (Fin numParts) (Fin ∘ sizeAt) → Fin totalSize fromParts (i , j) = fromℕ≤ {PN.fromParts (toℕ i , toℕ j)} (PN.fromParts-prop (Fin.bounded i) (bounded′ j)) toParts : Fin totalSize → Σ (Fin numParts) (Fin ∘ sizeAt) toParts k = let p , q = PN.toParts-prop (Fin.bounded k) in fromℕ≤ p , fromℕ≤ q abstract fromParts-fromPartsℕ : (i : Fin numParts) (j : Fin (sizeAt i)) → toℕ (fromParts (i , j)) ≡ PN.fromParts (toℕ i , toℕ j) fromParts-fromPartsℕ _ _ = Fin.toℕ-fromℕ≤ _ toParts-toPartsℕ : (k : Fin totalSize) → Σ.map toℕ toℕ (toParts k) ≡ PN.toParts (toℕ k) toParts-toPartsℕ k = Σ.≡×≡⇒≡ (Fin.toℕ-fromℕ≤ _ , Fin.toℕ-fromℕ≤ _) toParts-fromParts : ∀ {i j} → toParts (fromParts (i , j)) ≡ (i , j) toParts-fromParts {i} {j} = Fin.toℕ-injective₂ (begin Σ.map toℕ toℕ (toParts (fromParts (i , j))) ≡⟨ toParts-toPartsℕ _ ⟩ PN.toParts (toℕ (fromParts (i , j))) ≡⟨ ≡.cong PN.toParts (fromParts-fromPartsℕ i j) ⟩ PN.toParts (PN.fromParts (toℕ i , toℕ j)) ≡⟨ PN.toParts-fromParts (Fin.bounded i) (bounded′ j) ⟩ (toℕ i , toℕ j) ∎) where open ≡.Reasoning fromParts-toParts : ∀ {k} → fromParts (toParts k) ≡ k fromParts-toParts {k} = Fin.toℕ-injective ( begin toℕ (fromParts (toParts k)) ≡⟨ uncurry fromParts-fromPartsℕ (toParts k) ⟩ PN.fromParts (Σ.map toℕ toℕ (toParts k)) ≡⟨ ≡.cong PN.fromParts (toParts-toPartsℕ k) ⟩ PN.fromParts (PN.toParts (toℕ k)) ≡⟨ PN.fromParts-toParts (toℕ k) (Fin.bounded k) ⟩ toℕ k ∎) where open ≡.Reasoning asParts : Fin totalSize ↔ Σ (Fin numParts) (Fin ∘ sizeAt) asParts = record { to = ≡.→-to-⟶ toParts ; from = ≡.→-to-⟶ fromParts ; inverse-of = record { left-inverse-of = λ _ → fromParts-toParts ; right-inverse-of = λ _ → toParts-fromParts } } Parts² : ∀ {a} (A : Set a) (size : A → ℕ) → Set a Parts² A size = Parts (Parts A size) Parts.totalSize module _ {a} {A : Set a} {size : A → ℕ} (P₁ : Parts² A size) where private module P₁ = Parts P₁ module _ (i : Fin P₁.numParts) where private P₂ = P₁.partAt i module P₂ = Parts P₂ fromParts² : (j : Fin P₂.numParts) → Fin (size (P₂.partAt j)) → Fin P₁.totalSize fromParts² j = curry P₁.fromParts i ∘ curry P₂.fromParts j asParts² : Fin P₁.totalSize ↔ Σ (Fin P₁.numParts) (λ i → let P₂ = P₁.partAt i module P₂ = Parts P₂ in Σ (Fin P₂.numParts) (Fin ∘ P₂.sizeAt)) asParts² = Fin P₁.totalSize ↔⟨ P₁.asParts ⟩ Σ (Fin P₁.numParts) (Fin ∘ P₁.sizeAt) ↔⟨ Σ-bij (Parts.asParts ∘ P₁.partAt) ⟩ Σ (Fin P₁.numParts) (λ i → let P₂ = P₁.partAt i module P₂ = Parts P₂ in Σ (Fin P₂.numParts) (Fin ∘ P₂.sizeAt)) ∎ where open BijReasoning
{ "alphanum_fraction": 0.6025606102, "avg_line_length": 36.71, "ext": "agda", "hexsha": "fa6ba18ad0844606add92d8bd4504de36ffb9988", "lang": "Agda", "max_forks_count": null, "max_forks_repo_forks_event_max_datetime": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_head_hexsha": "e26ae2e0aa7721cb89865aae78625a2f3fd2b574", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "bch29/agda-matrices", "max_forks_repo_path": "src/MLib/Fin/Parts.agda", "max_issues_count": null, "max_issues_repo_head_hexsha": "e26ae2e0aa7721cb89865aae78625a2f3fd2b574", "max_issues_repo_issues_event_max_datetime": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_licenses": [ "MIT" ], "max_issues_repo_name": "bch29/agda-matrices", "max_issues_repo_path": "src/MLib/Fin/Parts.agda", "max_line_length": 123, "max_stars_count": null, "max_stars_repo_head_hexsha": "e26ae2e0aa7721cb89865aae78625a2f3fd2b574", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "bch29/agda-matrices", "max_stars_repo_path": "src/MLib/Fin/Parts.agda", "max_stars_repo_stars_event_max_datetime": null, "max_stars_repo_stars_event_min_datetime": null, "num_tokens": 1394, "size": 3671 }
{-# OPTIONS --cubical --no-import-sorts --safe #-} open import Cubical.Core.Everything open import Cubical.Algebra.Semigroup module Cubical.Algebra.Semigroup.Construct.Opposite {ℓ} (S : Semigroup ℓ) where open import Cubical.Foundations.Prelude open Semigroup S import Cubical.Algebra.Magma.Construct.Opposite magma as OpMagma open OpMagma public hiding (Op-isMagma; Mᵒᵖ) •ᵒᵖ-assoc : Associative _•ᵒᵖ_ •ᵒᵖ-assoc _ _ _ = sym (assoc _ _ _) Op-isSemigroup : IsSemigroup Carrier _•ᵒᵖ_ Op-isSemigroup = record { isMagma = OpMagma.Op-isMagma ; assoc = •ᵒᵖ-assoc } Sᵒᵖ : Semigroup ℓ Sᵒᵖ = record { isSemigroup = Op-isSemigroup }
{ "alphanum_fraction": 0.744913928, "avg_line_length": 23.6666666667, "ext": "agda", "hexsha": "8f98b841a87cffa5473b99e17b485514cfde58d5", "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/Construct/Opposite.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/Construct/Opposite.agda", "max_line_length": 79, "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/Construct/Opposite.agda", "max_stars_repo_stars_event_max_datetime": null, "max_stars_repo_stars_event_min_datetime": null, "num_tokens": 242, "size": 639 }
-- Andreas, 2014-09-09 {-# NON_TERMINATING #-} Foo : Set Foo = Foo
{ "alphanum_fraction": 0.6176470588, "avg_line_length": 11.3333333333, "ext": "agda", "hexsha": "5018ea66e48c3cdf467466b50cef6ccc66954e76", "lang": "Agda", "max_forks_count": 371, "max_forks_repo_forks_event_max_datetime": "2022-03-30T19:00:30.000Z", "max_forks_repo_forks_event_min_datetime": "2015-01-03T14:04:08.000Z", "max_forks_repo_head_hexsha": "7f58030124fa99dfbf8db376659416f3ad8384de", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "cruhland/agda", "max_forks_repo_path": "test/Fail/Issue586a.agda", "max_issues_count": 4066, "max_issues_repo_head_hexsha": "7f58030124fa99dfbf8db376659416f3ad8384de", "max_issues_repo_issues_event_max_datetime": "2022-03-31T21:14:49.000Z", "max_issues_repo_issues_event_min_datetime": "2015-01-10T11:24:51.000Z", "max_issues_repo_licenses": [ "MIT" ], "max_issues_repo_name": "cruhland/agda", "max_issues_repo_path": "test/Fail/Issue586a.agda", "max_line_length": 23, "max_stars_count": 1989, "max_stars_repo_head_hexsha": "7f58030124fa99dfbf8db376659416f3ad8384de", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "cruhland/agda", "max_stars_repo_path": "test/Fail/Issue586a.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": 24, "size": 68 }
{-# OPTIONS --safe #-} module Definition.Typed.Consequences.SucCong where open import Definition.Untyped open import Definition.Typed open import Definition.Typed.Weakening open import Definition.Typed.Properties open import Definition.Typed.Consequences.Syntactic open import Definition.Typed.Consequences.Substitution open import Tools.Product import Tools.PropositionalEquality as PE -- Congurence of the type of the successor case in natrec. sucCong : ∀ {F G rF lF Γ} → Γ ∙ ℕ ^ [ ! , ι ⁰ ] ⊢ F ≡ G ^ [ rF , ι lF ] → Γ ⊢ Π ℕ ^ ! ° ⁰ ▹ (F ^ rF ° lF ▹▹ F [ suc (var 0) ]↑ ° lF ° lF) ° lF ° lF ≡ Π ℕ ^ ! ° ⁰ ▹ (G ^ rF ° lF ▹▹ G [ suc (var 0) ]↑ ° lF ° lF) ° lF ° lF ^ [ rF , ι lF ] sucCong F≡G with wfEq F≡G sucCong {lF = lF} F≡G | ⊢Γ ∙ ⊢ℕ = let ⊢F , _ = syntacticEq F≡G in univ (Π-cong (⁰min lF) (≡is≤ PE.refl) ⊢ℕ (refl (un-univ ⊢ℕ)) (Π-cong (≡is≤ PE.refl) (≡is≤ PE.refl) ⊢F (un-univ≡ F≡G) (wkEqTerm (step id) (⊢Γ ∙ ⊢ℕ ∙ ⊢F) (un-univ≡ (subst↑TypeEq F≡G (refl (sucⱼ (var (⊢Γ ∙ ⊢ℕ) here))))))))
{ "alphanum_fraction": 0.5472027972, "avg_line_length": 40.8571428571, "ext": "agda", "hexsha": "f627c313a35a07df2689fb60218460d0ddf4fab5", "lang": "Agda", "max_forks_count": 2, "max_forks_repo_forks_event_max_datetime": "2022-02-15T19:42:19.000Z", "max_forks_repo_forks_event_min_datetime": "2022-01-26T14:55:51.000Z", "max_forks_repo_head_hexsha": "e0eeebc4aa5ed791ce3e7c0dc9531bd113dfcc04", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "CoqHott/logrel-mltt", "max_forks_repo_path": "Definition/Typed/Consequences/SucCong.agda", "max_issues_count": null, "max_issues_repo_head_hexsha": "e0eeebc4aa5ed791ce3e7c0dc9531bd113dfcc04", "max_issues_repo_issues_event_max_datetime": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_licenses": [ "MIT" ], "max_issues_repo_name": "CoqHott/logrel-mltt", "max_issues_repo_path": "Definition/Typed/Consequences/SucCong.agda", "max_line_length": 99, "max_stars_count": 2, "max_stars_repo_head_hexsha": "e0eeebc4aa5ed791ce3e7c0dc9531bd113dfcc04", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "CoqHott/logrel-mltt", "max_stars_repo_path": "Definition/Typed/Consequences/SucCong.agda", "max_stars_repo_stars_event_max_datetime": "2022-01-17T16:13:53.000Z", "max_stars_repo_stars_event_min_datetime": "2018-06-21T08:39:01.000Z", "num_tokens": 456, "size": 1144 }
module Reasoning where open import Algebra -- Standard syntax sugar for writing equational proofs infix 4 _≈_ data _≈_ {A} (x y : Graph A) : Set where prove : x ≡ y -> x ≈ y infix 1 begin_ begin_ : ∀ {A} {x y : Graph A} -> x ≈ y -> x ≡ y begin prove p = p infixr 2 _≡⟨_⟩_ _≡⟨_⟩_ : ∀ {A} (x : Graph A) {y z : Graph A} -> x ≡ y -> y ≈ z -> x ≈ z _ ≡⟨ p ⟩ prove q = prove (transitivity p q) infix 3 _∎ _∎ : ∀ {A} (x : Graph A) -> x ≈ x _∎ _ = prove reflexivity infixl 8 _>>_ _>>_ : ∀ {A} {x y z : Graph A} -> x ≡ y -> y ≡ z -> x ≡ z _>>_ = transitivity data BinaryOperator : Set where +op : BinaryOperator *op : BinaryOperator apply : ∀ {A} -> BinaryOperator -> Graph A -> Graph A -> Graph A apply +op a b = a + b apply *op a b = a * b L : ∀ {op : BinaryOperator} -> ∀ {A} {x y z : Graph A} -> x ≡ y -> apply op x z ≡ apply op y z L {+op} {x} {y} {z} eq = +left-congruence {x} {y} {z} eq L {*op} {x} {y} {z} eq = *left-congruence {x} {y} {z} eq R : ∀ {op : BinaryOperator} -> ∀ {A} {x y z : Graph A} -> x ≡ y -> apply op z x ≡ apply op z y R {+op} {x} {y} {z} eq = +right-congruence {x} {y} {z} eq R {*op} {x} {y} {z} eq = *right-congruence {x} {y} {z} eq
{ "alphanum_fraction": 0.5345858241, "avg_line_length": 28.5609756098, "ext": "agda", "hexsha": "5a051d2c44f2f866c4bc3ae01783dfc1ea546347", "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": "01f5f9f53ea81f692215300744aa77e26d8bf332", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "asr/alga", "max_forks_repo_path": "src/Reasoning.agda", "max_issues_count": null, "max_issues_repo_head_hexsha": "01f5f9f53ea81f692215300744aa77e26d8bf332", "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/alga", "max_issues_repo_path": "src/Reasoning.agda", "max_line_length": 94, "max_stars_count": null, "max_stars_repo_head_hexsha": "01f5f9f53ea81f692215300744aa77e26d8bf332", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "asr/alga", "max_stars_repo_path": "src/Reasoning.agda", "max_stars_repo_stars_event_max_datetime": null, "max_stars_repo_stars_event_min_datetime": null, "num_tokens": 520, "size": 1171 }
module CTL.Modalities.EG where open import FStream.Core open import Library -- Possibly forever : s₀ ⊧ φ ⇔ ∃ s₀ R s₁ R ... ∀ i . sᵢ ⊧ φ {-# NO_POSITIVITY_CHECK #-} -- Not necessary from EGda 2.6 upwards record EG' {i : Size} {ℓ₁ ℓ₂} {C : Container ℓ₁} (props : FStream' C (Set ℓ₂)) : Set (ℓ₁ ⊔ ℓ₂) where coinductive field nowE : head props laterE : {j : Size< i} → E (fmap EG' (inF (tail props))) open EG' public EG : ∀ {i : Size} {ℓ₁ ℓ₂} {C : Container ℓ₁} → FStream C (Set ℓ₂) → Set (ℓ₁ ⊔ ℓ₂) EG props = EPred EG' (inF props) mutual EGₛ' : ∀ {i ℓ₁ ℓ₂} {C : Container ℓ₁} → FStream' C (Set ℓ₂) → FStream' {i} C (Set (ℓ₁ ⊔ ℓ₂)) head (EGₛ' props) = EG' props tail (EGₛ' props) = EGₛ (tail props) EGₛ : ∀ {i ℓ₁ ℓ₂} {C : Container ℓ₁} → FStream C (Set ℓ₂) → FStream {i} C (Set (ℓ₁ ⊔ ℓ₂)) inF (EGₛ props) = fmap EGₛ' (inF props)
{ "alphanum_fraction": 0.5837155963, "avg_line_length": 30.0689655172, "ext": "agda", "hexsha": "abd4b1c0533b50e842f35e5518131db72c8228c6", "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": "CTL/Modalities/EG.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": "CTL/Modalities/EG.agda", "max_line_length": 66, "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": "CTL/Modalities/EG.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": 390, "size": 872 }
module IPL where data _∧_ (P : Set) (Q : Set) : Set where ∧-intro : P → Q → (P ∧ Q) _⇔_ : (P : Set) → (Q : Set) → Set a ⇔ b = (a → b) ∧ (b → a) proof₁ : {P Q : Set} → (P ∧ Q) → P proof₁ (∧-intro p q) = p proof₂ : {P Q : Set} → (P ∧ Q) → Q proof₂ (∧-intro p q) = q ∧-assoc₁ : { P Q R : Set } → ((P ∧ Q) ∧ R) → (P ∧ (Q ∧ R)) ∧-assoc₁ (∧-intro (∧-intro p q) r) = ∧-intro p (∧-intro q r) ∧-assoc₂ : { P Q R : Set } → (P ∧ (Q ∧ R)) → ((P ∧ Q) ∧ R) ∧-assoc₂ (∧-intro p (∧-intro q r)) = ∧-intro (∧-intro p q) r ∧-assoc : { P Q R : Set } → ((P ∧ Q) ∧ R) ⇔ (P ∧ (Q ∧ R)) ∧-assoc = ∧-intro ∧-assoc₁ ∧-assoc₂ data _∨_ (P Q : Set) : Set where ∨-intro₁ : P → P ∨ Q ∨-intro₂ : Q → P ∨ Q ∨-elim : {A B C : Set} → (A → C) → (B → C) → (A ∨ B) → C ∨-elim ac bc (∨-intro₁ a) = ac a ∨-elim ac bc (∨-intro₂ b) = bc b ∨-comm′ : {P Q : Set} → (P ∨ Q) → (Q ∨ P) ∨-comm′ (∨-intro₁ p) = ∨-intro₂ p ∨-comm′ (∨-intro₂ q) = ∨-intro₁ q ∨-comm : {P Q : Set} → (P ∨ Q) ⇔ (Q ∨ P) ∨-comm = ∧-intro ∨-comm′ ∨-comm′ ∨-assoc : { P Q R : Set } → ((P ∨ Q) ∨ R) → (P ∨ (Q ∨ R)) ∨-assoc (∨-intro₁ (∨-intro₁ p)) = ∨-intro₁ p ∨-assoc (∨-intro₁ (∨-intro₂ q)) = ∨-intro₂ (∨-intro₁ q) ∨-assoc (∨-intro₂ r) = ∨-intro₂ (∨-intro₂ r) data ⊥ : Set where ¬ : Set → Set ¬ A = A → ⊥
{ "alphanum_fraction": 0.4145785877, "avg_line_length": 26.8775510204, "ext": "agda", "hexsha": "177f58f77f5094cc5cfa428722708771dc81856d", "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": "11f8071e325d07d19a53157cb065d88244b20cb4", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "alf239/tao", "max_forks_repo_path": "IPL.agda", "max_issues_count": null, "max_issues_repo_head_hexsha": "11f8071e325d07d19a53157cb065d88244b20cb4", "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": "alf239/tao", "max_issues_repo_path": "IPL.agda", "max_line_length": 62, "max_stars_count": null, "max_stars_repo_head_hexsha": "11f8071e325d07d19a53157cb065d88244b20cb4", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "alf239/tao", "max_stars_repo_path": "IPL.agda", "max_stars_repo_stars_event_max_datetime": null, "max_stars_repo_stars_event_min_datetime": null, "num_tokens": 683, "size": 1317 }
{-# OPTIONS --without-K #-} open import Base open import Homotopy.Connected {- An example of using the overkilling covering space library. -} module Homotopy.Cover.ExamplePi1Circle where open import Homotopy.Truncation open import Homotopy.PathTruncation open import Spaces.Circle {- The 1st step: Show that the circle is connected. -} S¹-is-conn : is-connected ⟨0⟩ S¹ S¹-is-conn = proj base , τ-extend ⦃ λ _ → ≡-is-set $ π₀-is-set S¹ ⦄ (S¹-rec (λ x → proj x ≡ proj base) refl (prop-has-all-paths (π₀-is-set S¹ _ _) _ _)) open import Integers open import Homotopy.Pointed open import Homotopy.Cover.Def S¹ open import Homotopy.Cover.HomotopyGroupSetIsomorphism (⋆[ S¹ , base ]) S¹-is-conn S¹-covering : covering S¹-covering = let fiber = S¹-rec-nondep Set ℤ (eq-to-path succ-equiv) in cov[ fiber , S¹-rec (is-set ◯ fiber) ℤ-is-set (prop-has-all-paths is-set-is-prop _ _) ] open covering S¹-covering {- The 2nd step : Show that S¹ is contractible. -} -- One step. trans-fiber-!loop : ∀ z → transport fiber (! loop) z ≡ pred z trans-fiber-!loop z = transport fiber (! loop) z ≡⟨ ! $ trans-ap (id _) fiber (! loop) z ⟩ transport (id _) (ap fiber (! loop)) z ≡⟨ ap (λ x → transport (id _) x z) $ ap-opposite fiber loop ⟩ transport (id _) (! (ap fiber loop)) z ≡⟨ ap (λ x → transport (id _) (! x) z) $ S¹-β-loop-nondep Set ℤ (eq-to-path _) ⟩ transport (id _) (! (eq-to-path succ-equiv)) z ≡⟨ trans-id-!eq-to-path _ _ ⟩∎ pred z ∎ -- The end of this function. This can save some type annotations. loop⁻ⁿ-end : Σ S¹ fiber loop⁻ⁿ-end = (base , O) -- Climbing up the stairs. loop⁻¹ : ∀ z → _≡_ {A = Σ S¹ fiber} (base , z) (base , pred z) loop⁻¹ z = Σ-eq (! loop) (trans-fiber-!loop z) -- Agda needs us to show the induction order explicitly, -- and so there are so many functions. loop⁻ⁿ : ∀ z → (base , z) ≡ loop⁻ⁿ-end loop⁻ⁿ-pos : ∀ n → (base , pos n) ≡ loop⁻ⁿ-end loop⁻ⁿ-neg : ∀ n → (base , neg n) ≡ loop⁻ⁿ-end loop⁻ⁿ O = refl loop⁻ⁿ (pos _) = loop⁻ⁿ-pos _ loop⁻ⁿ (neg _) = loop⁻ⁿ-neg _ loop⁻ⁿ-pos 0 = loop⁻¹ _ loop⁻ⁿ-pos (S _) = loop⁻¹ _ ∘ loop⁻ⁿ-pos _ loop⁻ⁿ-neg 0 = ! (loop⁻¹ _) loop⁻ⁿ-neg (S _) = ! (loop⁻¹ _) ∘ loop⁻ⁿ-neg _ private -- These are specialized J rules that work for this development only. -- I am too lazy to generalize them. lemma₁ : ∀ {x₁ x₂} (q : x₁ ≡ x₂) (f : ∀ z → (x₁ , z) ≡ loop⁻ⁿ-end) (z : fiber x₂) → transport (λ s → ∀ z → (s , z) ≡ loop⁻ⁿ-end) q f z ≡ Σ-eq (! q) refl ∘ f (transport fiber (! q) z) lemma₁ refl f z = refl lemma₂ : ∀ {b₁} {b₂} (q : b₁ ≡ b₂) p → transport (λ z → (base , z) ≡ loop⁻ⁿ-end) (! q) p ≡ Σ-eq refl q ∘ p lemma₂ refl p = refl compose-Σ-eq : ∀ {a₁} {a₂} (p : a₁ ≡ a₂) {b₁ : fiber a₁} {b₂} (q : transport fiber p b₁ ≡ b₂) → Σ-eq {A = S¹} {P = fiber} p refl ∘ Σ-eq refl q ≡ Σ-eq p q compose-Σ-eq refl q = refl loop⁻¹-loop⁻ⁿ-pred : ∀ z → loop⁻¹ z ∘ loop⁻ⁿ (pred z) ≡ loop⁻ⁿ z loop⁻¹-loop⁻ⁿ-pred O = opposite-right-inverse (loop⁻¹ _) loop⁻¹-loop⁻ⁿ-pred (pos O) = refl-right-unit _ loop⁻¹-loop⁻ⁿ-pred (pos (S _)) = refl loop⁻¹-loop⁻ⁿ-pred (neg _) = loop⁻¹ _ ∘ (! (loop⁻¹ _) ∘ loop⁻ⁿ-neg _) ≡⟨ ! $ concat-assoc (loop⁻¹ _) (! (loop⁻¹ _)) _ ⟩ (loop⁻¹ _ ∘ ! (loop⁻¹ _)) ∘ loop⁻ⁿ-neg _ ≡⟨ ap (λ x → x ∘ loop⁻ⁿ-neg _) $ opposite-right-inverse (loop⁻¹ _) ⟩∎ loop⁻ⁿ-neg _ ∎ path : ∀ x z → (x , z) ≡ loop⁻ⁿ-end path = S¹-rec (λ s → ∀ z → (s , z) ≡ loop⁻ⁿ-end) loop⁻ⁿ $ funext λ z → transport (λ s → ∀ z → (s , z) ≡ loop⁻ⁿ-end) loop loop⁻ⁿ z ≡⟨ lemma₁ loop loop⁻ⁿ z ⟩ Σ-eq (! loop) refl ∘ loop⁻ⁿ (transport fiber (! loop) z) ≡⟨ ap (λ x → Σ-eq (! loop) refl ∘ x) $ apd! loop⁻ⁿ (trans-fiber-!loop z) ⟩ Σ-eq (! loop) refl ∘ (transport (λ z → (base , z) ≡ loop⁻ⁿ-end) (! $ trans-fiber-!loop z) (loop⁻ⁿ (pred z))) ≡⟨ ap (λ x → Σ-eq (! loop) refl ∘ x) $ lemma₂ (trans-fiber-!loop z) (loop⁻ⁿ (pred z)) ⟩ Σ-eq (! loop) refl ∘ (Σ-eq refl (trans-fiber-!loop z) ∘ loop⁻ⁿ (pred z)) ≡⟨ ! $ concat-assoc (Σ-eq (! loop) refl) _ _ ⟩ (Σ-eq (! loop) refl ∘ Σ-eq refl (trans-fiber-!loop z)) ∘ loop⁻ⁿ (pred z) ≡⟨ ap (λ x → x ∘ loop⁻ⁿ (pred z)) $ compose-Σ-eq (! loop) (trans-fiber-!loop z) ⟩ loop⁻¹ z ∘ loop⁻ⁿ (pred z) ≡⟨ loop⁻¹-loop⁻ⁿ-pred z ⟩∎ loop⁻ⁿ z ∎ S¹-covering-is-universal : is-universal S¹-covering S¹-covering-is-universal = contr-is-connected ⟨1⟩ $ loop⁻ⁿ-end , uncurry path ℤ-π¹S¹-equiv : ℤ ≃ (base ≡₀ base) ℤ-π¹S¹-equiv = GiveMeAPoint.fiber-a≃fg S¹-covering S¹-covering-is-universal O
{ "alphanum_fraction": 0.5661375661, "avg_line_length": 36.3461538462, "ext": "agda", "hexsha": "2510fe04426533034cce078b2977d413be76d15a", "lang": "Agda", "max_forks_count": 50, "max_forks_repo_forks_event_max_datetime": "2022-02-14T03:03:25.000Z", "max_forks_repo_forks_event_min_datetime": "2015-01-10T01:48:08.000Z", "max_forks_repo_head_hexsha": "939a2d83e090fcc924f69f7dfa5b65b3b79fe633", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "nicolaikraus/HoTT-Agda", "max_forks_repo_path": "old/Homotopy/Cover/ExamplePi1Circle.agda", "max_issues_count": 31, "max_issues_repo_head_hexsha": "939a2d83e090fcc924f69f7dfa5b65b3b79fe633", "max_issues_repo_issues_event_max_datetime": "2021-10-03T19:15:25.000Z", "max_issues_repo_issues_event_min_datetime": "2015-03-05T20:09:00.000Z", "max_issues_repo_licenses": [ "MIT" ], "max_issues_repo_name": "nicolaikraus/HoTT-Agda", "max_issues_repo_path": "old/Homotopy/Cover/ExamplePi1Circle.agda", "max_line_length": 95, "max_stars_count": 294, "max_stars_repo_head_hexsha": "66f800adef943afdf08c17b8ecfba67340fead5e", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "timjb/HoTT-Agda", "max_stars_repo_path": "old/Homotopy/Cover/ExamplePi1Circle.agda", "max_stars_repo_stars_event_max_datetime": "2022-03-20T13:54:45.000Z", "max_stars_repo_stars_event_min_datetime": "2015-01-09T16:23:23.000Z", "num_tokens": 2003, "size": 4725 }
-- The NO_POSITIVITY_CHECK pragma can only precede a mutual block or a -- data/record definition. module Issue1614c where {-# NO_POSITIVITY_CHECK #-} postulate Foo : Set
{ "alphanum_fraction": 0.7674418605, "avg_line_length": 21.5, "ext": "agda", "hexsha": "787d802240bdc30dabc444c690c5df26d70ac143", "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": "test/Fail/Issue1614c.agda", "max_issues_count": null, "max_issues_repo_head_hexsha": "c0ae7d20728b15d7da4efff6ffadae6fe4590016", "max_issues_repo_issues_event_max_datetime": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_licenses": [ "BSD-3-Clause" ], "max_issues_repo_name": "redfish64/autonomic-agda", "max_issues_repo_path": "test/Fail/Issue1614c.agda", "max_line_length": 70, "max_stars_count": 3, "max_stars_repo_head_hexsha": "c0ae7d20728b15d7da4efff6ffadae6fe4590016", "max_stars_repo_licenses": [ "BSD-3-Clause" ], "max_stars_repo_name": "redfish64/autonomic-agda", "max_stars_repo_path": "test/Fail/Issue1614c.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": 44, "size": 172 }